rust/compiler
Matthias Krüger 3ea438eb3a
Rollup merge of #116787 - a-lafrance:span-internal-lint, r=oli-obk
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``
2023-10-17 19:07:23 +02:00
..
rustc Split out the stable part of smir into its own crate to prevent accidental usage of forever unstable things 2023-09-25 14:38:27 +00:00
rustc_abi docs: add Rust logo to more compiler crates 2023-10-16 15:38:08 -07:00
rustc_arena rustdoc: remove rust logo from non-Rust crates 2023-10-08 20:17:53 -07:00
rustc_ast Auto merge of #116688 - compiler-errors:rustfmt-up, r=WaffleLapkin,Nilstrieb 2023-10-15 13:23:55 +00:00
rustc_ast_lowering docs: add Rust logo to more compiler crates 2023-10-16 15:38:08 -07:00
rustc_ast_passes docs: add Rust logo to more compiler crates 2023-10-16 15:38:08 -07:00
rustc_ast_pretty Auto merge of #116822 - notriddle:notriddle/rust-logo, r=fmease 2023-10-17 04:41:20 +00:00
rustc_attr docs: add Rust logo to more compiler crates 2023-10-16 15:38:08 -07:00
rustc_baked_icu_data docs: add Rust logo to more compiler crates 2023-10-16 15:38:08 -07:00
rustc_borrowck Auto merge of #116822 - notriddle:notriddle/rust-logo, r=fmease 2023-10-17 04:41:20 +00:00
rustc_builtin_macros docs: add Rust logo to more compiler crates 2023-10-16 15:38:08 -07:00
rustc_codegen_cranelift docs: add Rust logo to more compiler crates 2023-10-16 15:38:08 -07:00
rustc_codegen_gcc docs: add Rust logo to more compiler crates 2023-10-16 15:38:08 -07:00
rustc_codegen_llvm docs: add Rust logo to more compiler crates 2023-10-16 15:38:08 -07:00
rustc_codegen_ssa Auto merge of #116688 - compiler-errors:rustfmt-up, r=WaffleLapkin,Nilstrieb 2023-10-15 13:23:55 +00:00
rustc_const_eval docs: add Rust logo to more compiler crates 2023-10-16 15:38:08 -07:00
rustc_data_structures docs: add Rust logo to more compiler crates 2023-10-16 15:38:08 -07:00
rustc_driver docs: add Rust logo to more compiler crates 2023-10-16 15:38:08 -07:00
rustc_driver_impl Auto merge of #116477 - nnethercote:tidy-alpha-deps, r=wesleywiser 2023-10-17 02:48:03 +00:00
rustc_error_codes docs: add Rust logo to more compiler crates 2023-10-16 15:38:08 -07:00
rustc_error_messages docs: add Rust logo to more compiler crates 2023-10-16 15:38:08 -07:00
rustc_errors Rollup merge of #115196 - chenyukang:yukang-fix-86094, r=estebank 2023-10-16 06:26:20 +02:00
rustc_expand docs: add Rust logo to more compiler crates 2023-10-16 15:38:08 -07:00
rustc_feature docs: add Rust logo to more compiler crates 2023-10-16 15:38:08 -07:00
rustc_fluent_macro rustdoc: remove rust logo from non-Rust crates 2023-10-08 20:17:53 -07:00
rustc_fs_util
rustc_graphviz rustdoc: remove rust logo from non-Rust crates 2023-10-08 20:17:53 -07:00
rustc_hir Auto merge of #115670 - Zoxc:outline-panic-macro-1, r=Mark-Simulacrum 2023-10-01 05:56:47 +00:00
rustc_hir_analysis Auto merge of #116756 - fee1-dead-contrib:dupe-those-bounds, r=oli-obk 2023-10-17 12:16:54 +00:00
rustc_hir_pretty Fiddle with State functions. 2023-10-11 10:46:55 +11:00
rustc_hir_typeck Rollup merge of #116787 - a-lafrance:span-internal-lint, r=oli-obk 2023-10-17 19:07:23 +02:00
rustc_incremental Auto merge of #115964 - bjorn3:cgu_reuse_tracker_global_state, r=cjgillot 2023-10-13 00:09:30 +00:00
rustc_index Preserve DebugInfo in DeadStoreElimination. 2023-10-06 15:46:11 +00:00
rustc_infer Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
rustc_interface Rollup merge of #111072 - Urgau:check-cfg-new-syntax, r=petrochenkov 2023-10-17 19:07:21 +02:00
rustc_lexer Update lexer emoji diagnostics to Unicode 15.0 2023-07-29 08:47:21 +08:00
rustc_lint tweak pass description and fix lint fail post-rebase 2023-10-16 19:50:31 -07:00
rustc_lint_defs Auto merge of #115822 - compiler-errors:stabilize-rpitit, r=jackh726 2023-10-14 07:29:08 +00:00
rustc_llvm rustdoc: remove rust logo from non-Rust crates 2023-10-08 20:17:53 -07:00
rustc_log use env variable to control thread ids in rustc_log 2023-10-10 09:39:47 +08:00
rustc_macros Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
rustc_metadata Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
rustc_middle Auto merge of #116756 - fee1-dead-contrib:dupe-those-bounds, r=oli-obk 2023-10-17 12:16:54 +00:00
rustc_mir_build Rollup merge of #116522 - bvanjoi:fix-115599, r=oli-obk 2023-10-15 21:29:07 +02:00
rustc_mir_dataflow Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
rustc_mir_transform debug Span::ctxt() call detection 2023-10-16 19:50:29 -07:00
rustc_monomorphize rustc_monomorphize: Introduce check_fn_args_move_size() 2023-10-07 10:29:37 +02:00
rustc_parse Auto merge of #116688 - compiler-errors:rustfmt-up, r=WaffleLapkin,Nilstrieb 2023-10-15 13:23:55 +00:00
rustc_parse_format rustdoc: remove rust logo from non-Rust crates 2023-10-08 20:17:53 -07:00
rustc_passes tweak pass description and fix lint fail post-rebase 2023-10-16 19:50:31 -07:00
rustc_plugin_impl rustdoc: remove rust logo from non-Rust crates 2023-10-08 20:17:53 -07:00
rustc_privacy Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
rustc_query_impl rustdoc: remove rust logo from non-Rust crates 2023-10-08 20:17:53 -07:00
rustc_query_system Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
rustc_resolve Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
rustc_serialize rustdoc: remove rust logo from non-Rust crates 2023-10-08 20:17:53 -07:00
rustc_session Auto merge of #116731 - Alexendoo:hash-untracked-state, r=oli-obk 2023-10-16 16:33:42 +00:00
rustc_smir Add MonoItems and Instance to stable_mir 2023-10-16 12:01:24 -07:00
rustc_span debug Span::ctxt() call detection 2023-10-16 19:50:29 -07:00
rustc_symbol_mangling rustdoc: remove rust logo from non-Rust crates 2023-10-08 20:17:53 -07:00
rustc_target Rename ACTIVE_FEATURES as UNSTABLE_FEATURES. 2023-10-16 08:17:23 +11:00
rustc_trait_selection Rollup merge of #116717 - estebank:issue-9082, r=oli-obk 2023-10-17 19:07:22 +02:00
rustc_traits Detect cycle errors hidden by opaques during monomorphization 2023-09-13 17:35:44 +00:00
rustc_transmute Remove the MaybeTransmutableQuery<&'l Dfa<...>, C> impl. 2023-10-06 11:25:32 +11:00
rustc_ty_utils Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
rustc_type_ir Avoid emitting the non_exhaustive error if other errors already occurred 2023-10-11 12:49:57 +00:00
stable_mir Add MonoItems and Instance to stable_mir 2023-10-16 12:01:24 -07:00