Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1901,10 +1901,9 @@ impl KeywordIdents {
return;
}

cx.sess().psess.buffer_lint(
cx.emit_span_lint(
lint,
ident.span,
CRATE_NODE_ID,
BuiltinKeywordIdents { kw: ident, next: edition, suggestion: ident.span, prefix },
);
}
Expand Down
19 changes: 8 additions & 11 deletions tests/ui/lint/keyword-idents/multi-file.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
#![deny(keyword_idents)]
#![deny(keyword_idents)] // Should affect the submodule, but doesn't.
//@ edition: 2015
//@ known-bug: #132218
//@ check-pass (known bug; should be check-fail)

// Because `keyword_idents_2018` and `keyword_idents_2024` are pre-expansion
// lints, configuring them via lint attributes doesn't propagate to submodules
// in other files.
// <https://github.com/rust-lang/rust/issues/132218>

#[path = "./auxiliary/multi_file_submod.rs"]
mod multi_file_submod;
//~? ERROR `async` is a keyword
//~? WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
//~? ERROR `await` is a keyword
//~? WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
//~? ERROR `try` is a keyword
//~? WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
//~? ERROR `dyn` is a keyword
//~? WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
//~? ERROR `gen` is a keyword
//~? WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024!

fn main() {}
54 changes: 0 additions & 54 deletions tests/ui/lint/keyword-idents/multi-file.stderr

This file was deleted.

7 changes: 7 additions & 0 deletions tests/ui/lint/pre-expansion-expect.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Regression test #155008
//@ edition: 2015
//@ check-pass
#[expect(keyword_idents_2024)]
fn main() {
let gen = 5;
}
Loading