mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-19 19:17:31 +00:00
normalize after substitution
This commit is contained in:
parent
f99300fcbd
commit
121f3c8d19
@ -1008,6 +1008,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
|
|||||||
|
|
||||||
let ty = self.tcx().type_of(def_id);
|
let ty = self.tcx().type_of(def_id);
|
||||||
let ty = ty.subst(tcx, substs);
|
let ty = ty.subst(tcx, substs);
|
||||||
|
let ty = self.normalize(ty, locations);
|
||||||
|
|
||||||
self.relate_types(ty, v1, a, locations, category)?;
|
self.relate_types(ty, v1, a, locations, category)?;
|
||||||
|
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
#![feature(nll)]
|
||||||
|
|
||||||
|
trait Mirror {
|
||||||
|
type Me;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> Mirror for T {
|
||||||
|
type Me = T;
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Foo<'a> {
|
||||||
|
const C: <&'a u32 as Mirror>::Me;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a, T> Foo<'a> for T {
|
||||||
|
const C: &'a u32 = &22;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn foo<'a>(_: &'a u32) -> &'static u32 {
|
||||||
|
<() as Foo<'a>>::C //~ ERROR
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
error: unsatisfied lifetime constraints
|
||||||
|
--> $DIR/constant-in-expr-normalize.rs:20:5
|
||||||
|
|
|
||||||
|
LL | fn foo<'a>(_: &'a u32) -> &'static u32 {
|
||||||
|
| -- lifetime `'a` defined here
|
||||||
|
LL | <() as Foo<'a>>::C //~ ERROR
|
||||||
|
| ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
Loading…
Reference in New Issue
Block a user