Skip to content

Commit 238c5de

Browse files
compiler-errorsMark-Simulacrum
authored andcommitted
No need to probe when relating opaques in nll_relate
1 parent 390e475 commit 238c5de

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

compiler/rustc_infer/src/infer/nll_relate/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ where
596596
(&ty::Infer(ty::TyVar(vid)), _) => self.relate_ty_var((vid, b)),
597597

598598
(&ty::Opaque(a_def_id, _), &ty::Opaque(b_def_id, _)) if a_def_id == b_def_id => {
599-
infcx.commit_if_ok(|_| infcx.super_combine_tys(self, a, b)).or_else(|err| {
599+
infcx.super_combine_tys(self, a, b).or_else(|err| {
600600
self.tcx().sess.delay_span_bug(
601601
self.delegate.span(),
602602
"failure to relate an opaque to itself should result in an error later on",
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// check-pass
2+
3+
trait T {}
4+
5+
fn wrap(x: impl T) -> impl T {
6+
//~^ WARN function cannot return without recursing
7+
wrap(wrap(x))
8+
}
9+
10+
fn main() {}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
warning: function cannot return without recursing
2+
--> $DIR/issue-103599.rs:5:1
3+
|
4+
LL | fn wrap(x: impl T) -> impl T {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
6+
LL |
7+
LL | wrap(wrap(x))
8+
| ------- recursive call site
9+
|
10+
= help: a `loop` may express intention better if this is on purpose
11+
= note: `#[warn(unconditional_recursion)]` on by default
12+
13+
warning: 1 warning emitted
14+

0 commit comments

Comments
 (0)