diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2022-12-15 00:51:34 +0000 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2022-12-15 11:26:15 +0000 |
| commit | 5da1a04278ffddfb9252ee4a0eb9b1f19738673d (patch) | |
| tree | 092ca9f403b975ef828443f11000c3383d63c6bb /compiler | |
| parent | b70baa4f922a1809d79caeaeb902800c3be283b9 (diff) | |
| download | rust-5da1a04278ffddfb9252ee4a0eb9b1f19738673d.tar.gz rust-5da1a04278ffddfb9252ee4a0eb9b1f19738673d.zip | |
Allow `impl ~const Trait` opaque types
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_ast_passes/src/ast_validation.rs | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index eb9c841d80c..55ea12d25ea 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -42,7 +42,6 @@ enum SelfSemantic { /// What is the context that prevents using `~const`? enum DisallowTildeConstContext<'a> { TraitObject, - ImplTrait, Fn(FnKind<'a>), } @@ -187,11 +186,7 @@ impl<'a> AstValidator<'a> { fn with_impl_trait(&mut self, outer: Option<Span>, f: impl FnOnce(&mut Self)) { let old = mem::replace(&mut self.outer_impl_trait, outer); - if outer.is_some() { - self.with_banned_tilde_const(DisallowTildeConstContext::ImplTrait, f); - } else { - f(self); - } + f(self); self.outer_impl_trait = old; } @@ -1384,7 +1379,6 @@ impl<'a> Visitor<'a> for AstValidator<'a> { let mut err = self.err_handler().struct_span_err(bound.span(), "`~const` is not allowed here"); match reason { DisallowTildeConstContext::TraitObject => err.note("trait objects cannot have `~const` trait bounds"), - DisallowTildeConstContext::ImplTrait => err.note("`impl Trait`s cannot have `~const` trait bounds"), DisallowTildeConstContext::Fn(FnKind::Closure(..)) => err.note("closures cannot have `~const` trait bounds"), DisallowTildeConstContext::Fn(FnKind::Fn(_, ident, ..)) => err.span_note(ident.span, "this function is not `const`, so it cannot have `~const` trait bounds"), }; |
