Skip to content

Commit ad73b16

Browse files
authored
Rollup merge of rust-lang#124808 - compiler-errors:super, r=lcnr
Use `super_fold` in `RegionsToStatic` visitor so as to avoid an infinite stack cycle fixes rust-lang#124805 r? lcnr
2 parents 43de822 + 116f95b commit ad73b16

File tree

6 files changed

+28
-1
lines changed

6 files changed

+28
-1
lines changed

compiler/rustc_next_trait_solver/src/canonicalizer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ impl<I: Interner> TypeFolder<I> for RegionsToStatic<I> {
455455
I::Binder<T>: TypeSuperFoldable<I>,
456456
{
457457
self.binder.shift_in(1);
458-
let t = t.fold_with(self);
458+
let t = t.super_fold_with(self);
459459
self.binder.shift_out(1);
460460
t
461461
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//@ compile-flags: -Znext-solver=coherence
2+
3+
#[derive(Debug)]
4+
struct X<const FN: fn() = { || {} }>;
5+
//~^ ERROR using function pointers as const generic parameters is forbidden
6+
//~| ERROR using function pointers as const generic parameters is forbidden
7+
8+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error: using function pointers as const generic parameters is forbidden
2+
--> $DIR/const-region-infer-to-static-in-binder.rs:4:20
3+
|
4+
LL | struct X<const FN: fn() = { || {} }>;
5+
| ^^^^
6+
|
7+
= note: the only supported types are integers, `bool` and `char`
8+
9+
error: using function pointers as const generic parameters is forbidden
10+
--> $DIR/const-region-infer-to-static-in-binder.rs:4:20
11+
|
12+
LL | struct X<const FN: fn() = { || {} }>;
13+
| ^^^^
14+
|
15+
= note: the only supported types are integers, `bool` and `char`
16+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
17+
18+
error: aborting due to 2 previous errors
19+

0 commit comments

Comments
 (0)