mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
3ea438eb3a
Implement an internal lint encouraging use of `Span::eq_ctxt` Adds a new Rustc internal lint that forbids use of `.ctxt() == .ctxt()` for spans, encouraging use of `.eq_ctxt()` instead (see https://github.com/rust-lang/rust/issues/49509). Also fixed a few violations of the lint in the Rustc codebase (a fun additional way I could test my code). Edit: MIR opt folks I believe that's why you're CC'ed, just a heads up. Two things I'm not sure about: 1. The way I chose to detect calls to `Span::ctxt`. I know adding diagnostic items to methods is generally discouraged, but after some searching and experimenting I couldn't find anything else that worked, so I went with it. That said, I'm happy to implement something different if there's a better way out there. (For what it's worth, if there is a better way, it might be worth documenting in the rustc-dev-guide, which I'm happy to take care of) 2. The error message for the lint. Ideally it would probably be good to give some context as to why the suggestion is made (e.g. `rustc::default_hash_types` tells the user that it's because of performance), but I don't have that context so I couldn't put it in the error message. Happy to iterate on the error message based on feedback during review. r? ``@oli-obk`` |
||
---|---|---|
.. | ||
auxiliary | ||
fluent-messages | ||
internal-lints | ||
mod_dir_simple | ||
plugin | ||
session-diagnostic | ||
stable-mir | ||
compiler-calls.rs | ||
deriving-global.rs | ||
deriving-hygiene.rs | ||
dropck_tarena_sound_drop.rs | ||
dropck-tarena-cycle-checked.rs | ||
dropck-tarena-cycle-checked.stderr | ||
dropck-tarena-unsound-drop.rs | ||
dropck-tarena-unsound-drop.stderr | ||
empty-struct-braces-derive.rs | ||
hash-stable-is-unstable.rs | ||
hash-stable-is-unstable.stderr | ||
lint-pass-macros.rs | ||
missing-rustc-driver-error.rs | ||
missing-rustc-driver-error.stderr | ||
mod_dir_path_canonicalized.rs | ||
pathless-extern-unstable.rs | ||
pathless-extern-unstable.stderr | ||
pprust-expr-roundtrip.rs | ||
regions-mock-tcx.rs | ||
rustc_encodable_hygiene.rs |