1
Fork 0

Actually walk into lifetimes and attrs in EarlyContextAndPass

This commit is contained in:
Michael Goulet 2024-12-07 01:11:23 +00:00
parent acabb52482
commit db9e3681f9
6 changed files with 95 additions and 5 deletions

View file

@ -245,6 +245,7 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
fn visit_lifetime(&mut self, lt: &'a ast::Lifetime, _: ast_visit::LifetimeCtxt) { fn visit_lifetime(&mut self, lt: &'a ast::Lifetime, _: ast_visit::LifetimeCtxt) {
self.check_id(lt.id); self.check_id(lt.id);
ast_visit::walk_lifetime(self, lt);
} }
fn visit_path(&mut self, p: &'a ast::Path, id: ast::NodeId) { fn visit_path(&mut self, p: &'a ast::Path, id: ast::NodeId) {
@ -259,6 +260,7 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
fn visit_attribute(&mut self, attr: &'a ast::Attribute) { fn visit_attribute(&mut self, attr: &'a ast::Attribute) {
lint_callback!(self, check_attribute, attr); lint_callback!(self, check_attribute, attr);
ast_visit::walk_attribute(self, attr);
} }
fn visit_mac_def(&mut self, mac: &'a ast::MacroDef, id: ast::NodeId) { fn visit_mac_def(&mut self, mac: &'a ast::MacroDef, id: ast::NodeId) {

View file

@ -9,6 +9,7 @@ use crate::lints::{
use crate::{EarlyContext, EarlyLintPass, LintContext}; use crate::{EarlyContext, EarlyLintPass, LintContext};
declare_lint! { declare_lint! {
#[allow(text_direction_codepoint_in_literal)]
/// The `text_direction_codepoint_in_literal` lint detects Unicode codepoints that change the /// The `text_direction_codepoint_in_literal` lint detects Unicode codepoints that change the
/// visual representation of text on screen in a way that does not correspond to their on /// visual representation of text on screen in a way that does not correspond to their on
/// memory representation. /// memory representation.

View file

@ -3929,6 +3929,7 @@ declare_lint! {
} }
declare_lint! { declare_lint! {
#[allow(text_direction_codepoint_in_literal)]
/// The `text_direction_codepoint_in_comment` lint detects Unicode codepoints in comments that /// The `text_direction_codepoint_in_comment` lint detects Unicode codepoints in comments that
/// change the visual representation of text on screen in a way that does not correspond to /// change the visual representation of text on screen in a way that does not correspond to
/// their on memory representation. /// their on memory representation.

View file

@ -34,11 +34,47 @@ LL | () => { mod test { fn gen() {} } }
error: `gen` is a keyword in the 2024 edition error: `gen` is a keyword in the 2024 edition
--> $DIR/gen-kw.rs:25:9 --> $DIR/gen-kw.rs:25:9
| |
LL | fn test<'gen>() {} LL | fn test<'gen>(_: &'gen i32) {}
| ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen`
| |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024!
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
error: aborting due to 4 previous errors error: `gen` is a keyword in the 2024 edition
--> $DIR/gen-kw.rs:25:19
|
LL | fn test<'gen>(_: &'gen i32) {}
| ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen`
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024!
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
error: `gen` is a keyword in the 2024 edition
--> $DIR/gen-kw.rs:33:13
|
LL | struct Test<'gen>(Box<Test<'gen>>, &'gen ());
| ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen`
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024!
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
error: `gen` is a keyword in the 2024 edition
--> $DIR/gen-kw.rs:33:28
|
LL | struct Test<'gen>(Box<Test<'gen>>, &'gen ());
| ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen`
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024!
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
error: `gen` is a keyword in the 2024 edition
--> $DIR/gen-kw.rs:33:37
|
LL | struct Test<'gen>(Box<Test<'gen>>, &'gen ());
| ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen`
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024!
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
error: aborting due to 8 previous errors

View file

@ -34,11 +34,47 @@ LL | () => { mod test { fn gen() {} } }
error: `gen` is a keyword in the 2024 edition error: `gen` is a keyword in the 2024 edition
--> $DIR/gen-kw.rs:25:9 --> $DIR/gen-kw.rs:25:9
| |
LL | fn test<'gen>() {} LL | fn test<'gen>(_: &'gen i32) {}
| ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen`
| |
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024!
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
error: aborting due to 4 previous errors error: `gen` is a keyword in the 2024 edition
--> $DIR/gen-kw.rs:25:19
|
LL | fn test<'gen>(_: &'gen i32) {}
| ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen`
|
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024!
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
error: `gen` is a keyword in the 2024 edition
--> $DIR/gen-kw.rs:33:13
|
LL | struct Test<'gen>(Box<Test<'gen>>, &'gen ());
| ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen`
|
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024!
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
error: `gen` is a keyword in the 2024 edition
--> $DIR/gen-kw.rs:33:28
|
LL | struct Test<'gen>(Box<Test<'gen>>, &'gen ());
| ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen`
|
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024!
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
error: `gen` is a keyword in the 2024 edition
--> $DIR/gen-kw.rs:33:37
|
LL | struct Test<'gen>(Box<Test<'gen>>, &'gen ());
| ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen`
|
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024!
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
error: aborting due to 8 previous errors

View file

@ -22,9 +22,23 @@ macro_rules! t {
//[e2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! //[e2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024!
} }
fn test<'gen>() {} fn test<'gen>(_: &'gen i32) {}
//~^ ERROR `gen` is a keyword in the 2024 edition //~^ ERROR `gen` is a keyword in the 2024 edition
//~| ERROR `gen` is a keyword in the 2024 edition
//[e2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! //[e2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024!
//[e2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024!
//[e2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024!
//[e2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024!
struct Test<'gen>(Box<Test<'gen>>, &'gen ());
//~^ ERROR `gen` is a keyword in the 2024 edition
//~| ERROR `gen` is a keyword in the 2024 edition
//~| ERROR `gen` is a keyword in the 2024 edition
//[e2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024!
//[e2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024!
//[e2015]~| WARNING this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024!
//[e2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024!
//[e2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024!
//[e2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! //[e2018]~| WARNING this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024!
t!(); t!();