about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/errors
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2024-09-18 19:30:20 +0200
committerLeón Orell Valerian Liehr <me@fmease.dev>2024-09-18 19:36:44 +0200
commit682c5f485b4cc55ce16315e0d76a5a16ab3064f5 (patch)
tree1825cb0551e8a7a7e26a0584460533256c2b04f3 /compiler/rustc_hir_analysis/src/errors
parentbd8e88fd7b2401242cbcc95d88ef7b8058d59a77 (diff)
Explicitly mark a hack as a HACK and elaborate its comment
Diffstat (limited to 'compiler/rustc_hir_analysis/src/errors')
-rw-r--r--compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs b/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs
index 418f12b7158..236543007fc 100644
--- a/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs
+++ b/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs
@@ -1049,13 +1049,14 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
             );
 
             if span.is_empty() {
-                // Avoid ICE when types with the same name with `derive`s are in the same scope:
-                // struct NotSM;
-                // #[derive(PartialEq, Eq)]
-                // struct NotSM<T>(T);
-                // With the above code, the suggestion is to remove the generics of the first
-                // `NotSM`, which doesn't *have* generics, so we're suggesting to remove no code
-                // with no code, which ICEs on nightly due to an `assert!`.
+                // HACK: Avoid ICE when types with the same name with `derive`s are in the same scope:
+                //     struct NotSM;
+                //     #[derive(PartialEq, Eq)]
+                //     struct NotSM<T>(T);
+                // With the above code, the suggestion would be to remove the generics of the first
+                // `NotSM`, which doesn't *have* generics, so we would suggest to remove no code with
+                // no code, which would trigger an `assert!` later. Ideally, we would do something a
+                // bit more principled. See closed PR #109082.
             } else {
                 err.span_suggestion(span, msg, "", Applicability::MaybeIncorrect);
             }