Collapse placeholders to root universe in canonicalizer if not preserving universes
This commit is contained in:
parent
f4a4a31479
commit
ec40b1a393
3 changed files with 53 additions and 6 deletions
|
@ -418,10 +418,15 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'cx, 'tcx> {
|
||||||
bug!("encountered a fresh type during canonicalization")
|
bug!("encountered a fresh type during canonicalization")
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::Placeholder(placeholder) => self.canonicalize_ty_var(
|
ty::Placeholder(mut placeholder) => {
|
||||||
CanonicalVarInfo { kind: CanonicalVarKind::PlaceholderTy(placeholder) },
|
if !self.canonicalize_mode.preserve_universes() {
|
||||||
t,
|
placeholder.universe = ty::UniverseIndex::ROOT;
|
||||||
),
|
}
|
||||||
|
self.canonicalize_ty_var(
|
||||||
|
CanonicalVarInfo { kind: CanonicalVarKind::PlaceholderTy(placeholder) },
|
||||||
|
t,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
ty::Bound(debruijn, _) => {
|
ty::Bound(debruijn, _) => {
|
||||||
if debruijn >= self.binder_index {
|
if debruijn >= self.binder_index {
|
||||||
|
|
|
@ -7,7 +7,15 @@ where
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn bar()
|
||||||
|
where
|
||||||
|
for<V> V: IntoIterator,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
foo();
|
foo();
|
||||||
//~^ ERROR the size for values of type `V` cannot be known at compilation time
|
//~^ ERROR the size for values of type `V` cannot be known at compilation time
|
||||||
|
|
||||||
|
bar();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ LL | #![feature(non_lifetime_binders)]
|
||||||
= note: `#[warn(incomplete_features)]` on by default
|
= note: `#[warn(incomplete_features)]` on by default
|
||||||
|
|
||||||
error[E0277]: the size for values of type `V` cannot be known at compilation time
|
error[E0277]: the size for values of type `V` cannot be known at compilation time
|
||||||
--> $DIR/bad-sized-cond.rs:11:5
|
--> $DIR/bad-sized-cond.rs:17:5
|
||||||
|
|
|
|
||||||
LL | foo();
|
LL | foo();
|
||||||
| ^^^ doesn't have a size known at compile-time
|
| ^^^ doesn't have a size known at compile-time
|
||||||
|
@ -23,6 +23,40 @@ LL | where
|
||||||
LL | for<V> V: Sized,
|
LL | for<V> V: Sized,
|
||||||
| ^^^^^ required by this bound in `foo`
|
| ^^^^^ required by this bound in `foo`
|
||||||
|
|
||||||
error: aborting due to previous error; 1 warning emitted
|
error[E0277]: the size for values of type `Placeholder(Placeholder { universe: U3, name: Param(DefId(0:6 ~ bad_sized_cond[9450]::bar::V), "V") })` cannot be known at compilation time
|
||||||
|
--> $DIR/bad-sized-cond.rs:20:5
|
||||||
|
|
|
||||||
|
LL | bar();
|
||||||
|
| ^^^ doesn't have a size known at compile-time
|
||||||
|
|
|
||||||
|
= help: the trait `Sized` is not implemented for `Placeholder(Placeholder { universe: U3, name: Param(DefId(0:6 ~ bad_sized_cond[9450]::bar::V), "V") })`
|
||||||
|
= note: required for `V` to implement `IntoIterator`
|
||||||
|
note: required by a bound in `bar`
|
||||||
|
--> $DIR/bad-sized-cond.rs:12:15
|
||||||
|
|
|
||||||
|
LL | pub fn bar()
|
||||||
|
| --- required by a bound in this
|
||||||
|
LL | where
|
||||||
|
LL | for<V> V: IntoIterator,
|
||||||
|
| ^^^^^^^^^^^^ required by this bound in `bar`
|
||||||
|
|
||||||
|
error[E0277]: `Placeholder(Placeholder { universe: U3, name: Param(DefId(0:6 ~ bad_sized_cond[9450]::bar::V), "V") })` is not an iterator
|
||||||
|
--> $DIR/bad-sized-cond.rs:20:5
|
||||||
|
|
|
||||||
|
LL | bar();
|
||||||
|
| ^^^ `Placeholder(Placeholder { universe: U3, name: Param(DefId(0:6 ~ bad_sized_cond[9450]::bar::V), "V") })` is not an iterator
|
||||||
|
|
|
||||||
|
= help: the trait `Iterator` is not implemented for `Placeholder(Placeholder { universe: U3, name: Param(DefId(0:6 ~ bad_sized_cond[9450]::bar::V), "V") })`
|
||||||
|
= note: required for `V` to implement `IntoIterator`
|
||||||
|
note: required by a bound in `bar`
|
||||||
|
--> $DIR/bad-sized-cond.rs:12:15
|
||||||
|
|
|
||||||
|
LL | pub fn bar()
|
||||||
|
| --- required by a bound in this
|
||||||
|
LL | where
|
||||||
|
LL | for<V> V: IntoIterator,
|
||||||
|
| ^^^^^^^^^^^^ required by this bound in `bar`
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors; 1 warning emitted
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0277`.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue