Skip to content

Commit f2c3289

Browse files
Use super_fold in RegionsToStatic visitor
1 parent 25e3949 commit f2c3289

File tree

7 files changed

+30
-3
lines changed

7 files changed

+30
-3
lines changed

compiler/rustc_next_trait_solver/src/canonicalizer.rs

Lines changed: 1 addition & 1 deletion
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
}

compiler/rustc_trait_selection/src/traits/select/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2583,7 +2583,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
25832583
self.infcx
25842584
.at(&obligation.cause, obligation.param_env)
25852585
.eq(
2586-
DefineOpaqueTypes::No,
2586+
DefineOpaqueTypes::Yes,
25872587
upcast_principal.map_bound(|trait_ref| {
25882588
ty::ExistentialTraitRef::erase_self_ty(tcx, trait_ref)
25892589
}),
@@ -2620,7 +2620,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
26202620
nested.extend(
26212621
self.infcx
26222622
.at(&obligation.cause, obligation.param_env)
2623-
.eq(DefineOpaqueTypes::No, source_projection, target_projection)
2623+
.eq(DefineOpaqueTypes::Yes, source_projection, target_projection)
26242624
.map_err(|_| SelectionError::Unimplemented)?
26252625
.into_obligations(),
26262626
);
Lines changed: 8 additions & 0 deletions
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() {}
Lines changed: 19 additions & 0 deletions
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)