Skip to content

Commit dd82fd2

Browse files
committed
Auto merge of rust-lang#155056 - JonathanBrouwer:revert-lint-port, r=lqd,mati865
Revert "Port lint attributes to attribute parser" This PR reverts the following two PRs: - rust-lang#154808 - rust-lang#152369 This was not a clean revert, I manually solved several merge conflicts. Closes rust-lang#154878 Closes rust-lang#154800 Closes rust-lang#155008 Re-opens rust-lang#132218 (this was never closed, oops) r? @ghost
2 parents f5eca4f + 9c3661d commit dd82fd2

File tree

109 files changed

+2731
-2247
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+2731
-2247
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4224,6 +4224,7 @@ dependencies = [
42244224
name = "rustc_lint_defs"
42254225
version = "0.0.0"
42264226
dependencies = [
4227+
"rustc_ast",
42274228
"rustc_data_structures",
42284229
"rustc_error_messages",
42294230
"rustc_hir_id",

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ struct LoweringContext<'a, 'hir, R> {
155155

156156
impl<'a, 'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'a, 'hir, R> {
157157
fn new(tcx: TyCtxt<'hir>, resolver: &'a mut R) -> Self {
158-
let registered_tools = tcx.registered_tools(());
158+
let registered_tools = tcx.registered_tools(()).iter().map(|x| x.name).collect();
159159
Self {
160160
tcx,
161161
resolver,

compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,10 @@ impl<S: Stage> AttributeParser<S> for NakedParser {
295295

296296
let span = self.span?;
297297

298-
let Some(tools) = cx.tools else {
299-
unreachable!("tools required while parsing attributes");
300-
};
301-
302-
let tools = tools.iter().map(|tool| tool.name).collect::<Vec<_>>();
303298
// only if we found a naked attribute do we do the somewhat expensive check
304299
'outer: for other_attr in cx.all_attrs {
305300
for allowed_attr in ALLOW_LIST {
306-
if other_attr.segments().next().is_some_and(|i| tools.contains(&i.name)) {
301+
if other_attr.segments().next().is_some_and(|i| cx.tools.contains(&i.name)) {
307302
// effectively skips the error message being emitted below
308303
// if it's a tool attribute
309304
continue 'outer;

0 commit comments

Comments
 (0)