Skip to content

Commit 039e9e2

Browse files
authored
Rollup merge of #102399 - b-naber:binder-print-ice, r=lcnr
Account for use of index-based lifetime names in print of binder Fixes #102374 r? ```@lcnr``` cc ```@steffahn```
2 parents cf158a4 + a670897 commit 039e9e2

File tree

3 files changed

+44
-4
lines changed

3 files changed

+44
-4
lines changed

compiler/rustc_middle/src/ty/print/pretty.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -2173,10 +2173,16 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
21732173

21742174
let mut region_index = self.region_index;
21752175
let mut next_name = |this: &Self| {
2176-
let name = name_by_region_index(region_index, &mut available_names, num_available);
2177-
debug!(?name);
2178-
region_index += 1;
2179-
assert!(!this.used_region_names.contains(&name));
2176+
let mut name;
2177+
2178+
loop {
2179+
name = name_by_region_index(region_index, &mut available_names, num_available);
2180+
region_index += 1;
2181+
2182+
if !this.used_region_names.contains(&name) {
2183+
break;
2184+
}
2185+
}
21802186

21812187
name
21822188
};

src/test/ui/regions/issue-102374.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
use std::cell::Cell;
2+
3+
#[rustfmt::skip]
4+
fn f(
5+
f: for<'a, 'b, 'c, 'd, 'e, 'f, 'g,
6+
'h, 'i, 'j, 'k, 'l, 'm, 'n,
7+
'o, 'p, 'q, 'r, 's, 't, 'u,
8+
'v, 'w, 'x, 'y, 'z, 'z0>
9+
fn(Cell<(& i32, &'a i32, &'b i32, &'c i32, &'d i32,
10+
&'e i32, &'f i32, &'g i32, &'h i32, &'i i32,
11+
&'j i32, &'k i32, &'l i32, &'m i32, &'n i32,
12+
&'o i32, &'p i32, &'q i32, &'r i32, &'s i32,
13+
&'t i32, &'u i32, &'v i32, &'w i32, &'x i32,
14+
&'y i32, &'z i32, &'z0 i32)>),
15+
) -> i32 {
16+
f
17+
//~^ ERROR mismatched types
18+
}
19+
20+
fn main() {}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/issue-102374.rs:16:5
3+
|
4+
LL | ) -> i32 {
5+
| --- expected `i32` because of return type
6+
LL | f
7+
| ^ expected `i32`, found fn pointer
8+
|
9+
= note: expected type `i32`
10+
found fn pointer `for<'z1, 'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, 'p, 'q, 'r, 's, 't, 'u, 'v, 'w, 'x, 'y, 'z, 'z0> fn(Cell<(&'z1 i32, &'a i32, &'b i32, &'c i32, &'d i32, &'e i32, &'f i32, &'g i32, &'h i32, &'i i32, &'j i32, &'k i32, &'l i32, &'m i32, &'n i32, &'o i32, &'p i32, &'q i32, &'r i32, &'s i32, &'t i32, &'u i32, &'v i32, &'w i32, &'x i32, &'y i32, &'z i32, &'z0 i32)>)`
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)