Skip to content

Commit

Permalink
Rollup merge of #108202 - compiler-errors:non_lifetime_binders-type-m…
Browse files Browse the repository at this point in the history
…atch-ice, r=davidtwco

Make sure `test_type_match` doesn't ICE with late-bound types

Fixes #108190 (in a kind of hacky way, anyways doesn't really matter)
  • Loading branch information
matthiaskrgr committed Feb 21, 2023
2 parents 314fe4d + c13d5f1 commit 8a5843f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/rustc_infer/src/infer/outlives/test_type_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ impl<'tcx> TypeRelation<'tcx> for Match<'tcx> {

#[instrument(skip(self), level = "debug")]
fn tys(&mut self, pattern: Ty<'tcx>, value: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
if let ty::Error(_) = pattern.kind() {
// FIXME(non_lifetime_binders): What to do here?
if matches!(pattern.kind(), ty::Error(_) | ty::Bound(..)) {
// Unlike normal `TypeRelation` rules, `ty::Error` does not equal any type.
self.no_match()
} else if pattern == value {
Expand Down
14 changes: 14 additions & 0 deletions tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// edition:2021
// check-pass

// Checks that test_type_match code doesn't ICE when predicates have late-bound types

#![feature(non_lifetime_binders)]
//~^ WARN is incomplete and may not be safe to use

async fn walk2<'a, T: 'a>(_: T)
where
for<F> F: 'a,
{}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/type-match-with-late-bound.rs:6:12
|
LL | #![feature(non_lifetime_binders)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
= note: `#[warn(incomplete_features)]` on by default

warning: 1 warning emitted

0 comments on commit 8a5843f

Please sign in to comment.