about summary refs log tree commit diff
path: root/compiler/rustc_mir_build/src/errors.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-11-23 04:44:26 +0000
committerbors <bors@rust-lang.org>2024-11-23 04:44:26 +0000
commitc49a687d636e3464cdc6599fb562c29470526b01 (patch)
tree30f2f73f2b8c6db58561fa051982642a964d7d08 /compiler/rustc_mir_build/src/errors.rs
parent743003b1a6f838e0a694bd5824fd8a839d5d45e5 (diff)
parent7b3e593fb12f1ae1212ea42c054695f7b1c17a63 (diff)
downloadrust-c49a687d636e3464cdc6599fb562c29470526b01.tar.gz
rust-c49a687d636e3464cdc6599fb562c29470526b01.zip
Auto merge of #133360 - compiler-errors:rollup-a2o38tq, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #132090 (Stop being so bail-y in candidate assembly)
 - #132658 (Detect const in pattern with typo)
 - #132911 (Pretty print async fn sugar in opaques and trait bounds)
 - #133102 (aarch64 softfloat target: always pass floats in int registers)
 - #133159 (Don't allow `-Zunstable-options` to take a value )
 - #133208 (generate-copyright: Now generates a library file too.)
 - #133215 (Fix missing submodule in `./x vendor`)
 - #133264 (implement OsString::truncate)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_mir_build/src/errors.rs')
-rw-r--r--compiler/rustc_mir_build/src/errors.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs
index 676f7c98b8f..df3a2344c5e 100644
--- a/compiler/rustc_mir_build/src/errors.rs
+++ b/compiler/rustc_mir_build/src/errors.rs
@@ -593,6 +593,14 @@ pub(crate) struct UnreachablePattern<'tcx> {
     pub(crate) uninhabited_note: Option<()>,
     #[label(mir_build_unreachable_covered_by_catchall)]
     pub(crate) covered_by_catchall: Option<Span>,
+    #[subdiagnostic]
+    pub(crate) wanted_constant: Option<WantedConstant>,
+    #[note(mir_build_unreachable_pattern_const_reexport_accessible)]
+    pub(crate) accessible_constant: Option<Span>,
+    #[note(mir_build_unreachable_pattern_const_inaccessible)]
+    pub(crate) inaccessible_constant: Option<Span>,
+    #[note(mir_build_unreachable_pattern_let_binding)]
+    pub(crate) pattern_let_binding: Option<Span>,
     #[label(mir_build_unreachable_covered_by_one)]
     pub(crate) covered_by_one: Option<Span>,
     #[note(mir_build_unreachable_covered_by_many)]
@@ -602,6 +610,20 @@ pub(crate) struct UnreachablePattern<'tcx> {
     pub(crate) suggest_remove: Option<Span>,
 }
 
+#[derive(Subdiagnostic)]
+#[suggestion(
+    mir_build_unreachable_pattern_wanted_const,
+    code = "{const_path}",
+    applicability = "machine-applicable"
+)]
+pub(crate) struct WantedConstant {
+    #[primary_span]
+    pub(crate) span: Span,
+    pub(crate) is_typo: bool,
+    pub(crate) const_name: String,
+    pub(crate) const_path: String,
+}
+
 #[derive(Diagnostic)]
 #[diag(mir_build_const_pattern_depends_on_generic_parameter, code = E0158)]
 pub(crate) struct ConstPatternDependsOnGenericParameter {