Skip to content

Commit 7f292f4

Browse files
committed
Allow defining opaque types during trait object upcasting.
No stable code is affected, as this requires the `trait_upcasting` feature gate.
1 parent 29a630e commit 7f292f4

File tree

3 files changed

+3
-20
lines changed

3 files changed

+3
-20
lines changed

Diff for: compiler/rustc_trait_selection/src/traits/select/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2631,7 +2631,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
26312631
nested.extend(
26322632
self.infcx
26332633
.at(&obligation.cause, obligation.param_env)
2634-
.eq(DefineOpaqueTypes::No, source_projection, target_projection)
2634+
.eq(DefineOpaqueTypes::Yes, source_projection, target_projection)
26352635
.map_err(|_| SelectionError::Unimplemented)?
26362636
.into_obligations(),
26372637
);

Diff for: tests/ui/traits/trait-upcasting/upcast-defining-opaque.current.stderr

-17
This file was deleted.

Diff for: tests/ui/traits/trait-upcasting/upcast-defining-opaque.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ revisions: current next
22
//@[next] compile-flags: -Znext-solver
33
//@ ignore-compare-mode-next-solver (explicit revisions)
4-
//@[next] check-pass
4+
//@check-pass
55

66
#![feature(trait_upcasting, type_alias_impl_trait)]
77

@@ -18,7 +18,7 @@ impl<T: ?Sized> Super for T {
1818
type Foo = impl Sized;
1919

2020
fn upcast(x: &dyn Sub<Assoc = Foo>) -> &dyn Super<Assoc = i32> {
21-
x //[current]~ mismatched types
21+
x
2222
}
2323

2424
fn main() {}

0 commit comments

Comments
 (0)