Skip to content

Commit 084c87d

Browse files
authored
Rollup merge of #114876 - compiler-errors:non-lifetime-binders-sized, r=wesleywiser
Don't ICE in `is_trivially_sized` when encountering late-bound self ty We can see a bound ty var here: https://github.com/rust-lang/rust/blob/b531630f4255216fce1400c45976e04f1ab35a84/compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs#L13-L34 Fixes #114872
2 parents f4cd7a5 + c31aedf commit 084c87d

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

compiler/rustc_middle/src/ty/sty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2827,11 +2827,11 @@ impl<'tcx> Ty<'tcx> {
28272827

28282828
ty::Adt(def, _args) => def.sized_constraint(tcx).skip_binder().is_empty(),
28292829

2830-
ty::Alias(..) | ty::Param(_) | ty::Placeholder(..) => false,
2830+
ty::Alias(..) | ty::Param(_) | ty::Placeholder(..) | ty::Bound(..) => false,
28312831

28322832
ty::Infer(ty::TyVar(_)) => false,
28332833

2834-
ty::Bound(..) | ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => {
2834+
ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => {
28352835
bug!("`is_trivially_sized` applied to unexpected type: {:?}", self)
28362836
}
28372837
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// check-pass
2+
3+
#![feature(non_lifetime_binders)]
4+
//~^ WARN is incomplete and may not be safe
5+
6+
pub fn foo()
7+
where
8+
for<V> V: Sized,
9+
{
10+
bar();
11+
}
12+
13+
pub fn bar()
14+
where
15+
for<V> V: Sized,
16+
{
17+
}
18+
19+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/sized-late-bound-issue-114872.rs:3:12
3+
|
4+
LL | #![feature(non_lifetime_binders)]
5+
| ^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
8+
= note: `#[warn(incomplete_features)]` on by default
9+
10+
warning: 1 warning emitted
11+

0 commit comments

Comments
 (0)