Skip to content

Commit a8bd7ef

Browse files
committed
Auto merge of #155691 - Bryntet:lint_attrs_v2, r=<try>
Re-add lint attributes
2 parents 827651f + a7db19b commit a8bd7ef

100 files changed

Lines changed: 1962 additions & 1476 deletions

File tree

Some content is hidden

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

Cargo.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4186,7 +4186,6 @@ dependencies = [
41864186
name = "rustc_lint_defs"
41874187
version = "0.0.0"
41884188
dependencies = [
4189-
"rustc_ast",
41904189
"rustc_data_structures",
41914190
"rustc_error_messages",
41924191
"rustc_hir_id",

compiler/rustc_ast_lowering/src/lib.rs

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

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

compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,15 @@ impl<S: Stage> AttributeParser<S> for NakedParser {
277277

278278
let span = self.span?;
279279

280+
let Some(tools) = cx.tools else {
281+
unreachable!("tools required while parsing attributes");
282+
};
283+
284+
let tools = tools.iter().map(|tool| tool.name).collect::<Vec<_>>();
280285
// only if we found a naked attribute do we do the somewhat expensive check
281286
'outer: for other_attr in cx.all_attrs {
282287
for allowed_attr in ALLOW_LIST {
283-
if other_attr.segments().next().is_some_and(|i| cx.tools.contains(&i.name)) {
288+
if other_attr.segments().next().is_some_and(|i| tools.contains(&i.name)) {
284289
// effectively skips the error message being emitted below
285290
// if it's a tool attribute
286291
continue 'outer;

0 commit comments

Comments
 (0)