about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/astconv/mod.rs
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2023-12-18 17:55:55 +0100
committerLeón Orell Valerian Liehr <me@fmease.dev>2023-12-27 12:51:32 +0100
commit3eb48a35c8ae8335da66dc2bdb4f60e6ae22e1dd (patch)
treeeadb378f48629728c106252798e74f8faf1bf745 /compiler/rustc_hir_analysis/src/astconv/mod.rs
parent2fe50cd72c476ebacdedb14893e9632b4de961c2 (diff)
downloadrust-3eb48a35c8ae8335da66dc2bdb4f60e6ae22e1dd.tar.gz
rust-3eb48a35c8ae8335da66dc2bdb4f60e6ae22e1dd.zip
Introduce `const Trait` (always-const trait bounds)
Diffstat (limited to 'compiler/rustc_hir_analysis/src/astconv/mod.rs')
-rw-r--r--compiler/rustc_hir_analysis/src/astconv/mod.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_hir_analysis/src/astconv/mod.rs b/compiler/rustc_hir_analysis/src/astconv/mod.rs
index 8197fea5b29..092df257dbf 100644
--- a/compiler/rustc_hir_analysis/src/astconv/mod.rs
+++ b/compiler/rustc_hir_analysis/src/astconv/mod.rs
@@ -560,11 +560,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
             inferred_params: vec![],
             infer_args,
         };
-        if let ty::BoundConstness::ConstIfConst = constness
+        if let ty::BoundConstness::Const | ty::BoundConstness::ConstIfConst = constness
             && generics.has_self
             && !tcx.has_attr(def_id, sym::const_trait)
         {
-            let e = tcx.dcx().emit_err(crate::errors::ConstBoundForNonConstTrait { span });
+            let e = tcx.dcx().emit_err(crate::errors::ConstBoundForNonConstTrait {
+                span,
+                modifier: constness.as_str(),
+            });
             arg_count.correct =
                 Err(GenericArgCountMismatch { reported: Some(e), invalid_args: vec![] });
         }