Skip to content

Commit 4ffee83

Browse files
committed
revert buffering of KeywordIdents Lint
this also reverts a fix for keywords_idents linting from other files
1 parent 1948ee1 commit 4ffee83

3 files changed

Lines changed: 9 additions & 67 deletions

File tree

compiler/rustc_lint/src/builtin.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,10 +1901,9 @@ impl KeywordIdents {
19011901
return;
19021902
}
19031903

1904-
cx.sess().psess.buffer_lint(
1904+
cx.emit_span_lint(
19051905
lint,
19061906
ident.span,
1907-
CRATE_NODE_ID,
19081907
BuiltinKeywordIdents { kw: ident, next: edition, suggestion: ident.span, prefix },
19091908
);
19101909
}
Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
#![deny(keyword_idents)]
1+
#![deny(keyword_idents)] // Should affect the submodule, but doesn't.
22
//@ edition: 2015
3+
//@ known-bug: #132218
4+
//@ check-pass (known bug; should be check-fail)
5+
6+
// Because `keyword_idents_2018` and `keyword_idents_2024` are pre-expansion
7+
// lints, configuring them via lint attributes doesn't propagate to submodules
8+
// in other files.
9+
// <https://github.com/rust-lang/rust/issues/132218>
310

411
#[path = "./auxiliary/multi_file_submod.rs"]
512
mod multi_file_submod;
6-
//~? ERROR `async` is a keyword
7-
//~? WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
8-
//~? ERROR `await` is a keyword
9-
//~? WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
10-
//~? ERROR `try` is a keyword
11-
//~? WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
12-
//~? ERROR `dyn` is a keyword
13-
//~? WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
14-
//~? ERROR `gen` is a keyword
15-
//~? WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024!
1613

1714
fn main() {}

tests/ui/lint/keyword-idents/multi-file.stderr

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)