mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Also resolve the type of constants, even if we already turned it into an error constant
This commit is contained in:
parent
366da30d55
commit
06c4cc44b6
@ -865,6 +865,7 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Resolver<'cx, 'tcx> {
|
||||
self.handle_term(ct, ty::Const::outer_exclusive_binder, |tcx, guar| {
|
||||
ty::Const::new_error(tcx, guar, ct.ty())
|
||||
})
|
||||
.super_fold_with(self)
|
||||
}
|
||||
|
||||
fn fold_predicate(&mut self, predicate: ty::Predicate<'tcx>) -> ty::Predicate<'tcx> {
|
||||
|
10
tests/ui/type-alias-impl-trait/const_generic_type.rs
Normal file
10
tests/ui/type-alias-impl-trait/const_generic_type.rs
Normal file
@ -0,0 +1,10 @@
|
||||
//@edition: 2021
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
type Bar = impl std::fmt::Display;
|
||||
|
||||
async fn test<const N: crate::Bar>() {}
|
||||
//~^ ERROR: type annotations needed
|
||||
//~| ERROR: `Bar` is forbidden as the type of a const generic parameter
|
||||
|
||||
fn main() {}
|
19
tests/ui/type-alias-impl-trait/const_generic_type.stderr
Normal file
19
tests/ui/type-alias-impl-trait/const_generic_type.stderr
Normal file
@ -0,0 +1,19 @@
|
||||
error[E0283]: type annotations needed
|
||||
--> $DIR/const_generic_type.rs:6:1
|
||||
|
|
||||
LL | async fn test<const N: crate::Bar>() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
|
||||
|
|
||||
= note: cannot satisfy `_: std::fmt::Display`
|
||||
|
||||
error: `Bar` is forbidden as the type of a const generic parameter
|
||||
--> $DIR/const_generic_type.rs:6:24
|
||||
|
|
||||
LL | async fn test<const N: crate::Bar>() {}
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: the only supported types are integers, `bool` and `char`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0283`.
|
Loading…
Reference in New Issue
Block a user