diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2023-12-18 17:55:55 +0100 |
|---|---|---|
| committer | León Orell Valerian Liehr <me@fmease.dev> | 2023-12-27 12:51:32 +0100 |
| commit | 3eb48a35c8ae8335da66dc2bdb4f60e6ae22e1dd (patch) | |
| tree | eadb378f48629728c106252798e74f8faf1bf745 /compiler/rustc_hir_analysis/src/astconv/mod.rs | |
| parent | 2fe50cd72c476ebacdedb14893e9632b4de961c2 (diff) | |
| download | rust-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.rs | 7 |
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![] }); } |
