Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4387eea

Browse filesBrowse files
committed
Support constraining opaque types while trait upcasting with binders
1 parent 7f292f4 commit 4387eea
Copy full SHA for 4387eea

File tree

Expand file treeCollapse file tree

3 files changed

+3
-11
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+3
-11
lines changed

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

Copy file name to clipboardExpand all lines: compiler/rustc_trait_selection/src/traits/select/mod.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2594,7 +2594,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
25942594
self.infcx
25952595
.at(&obligation.cause, obligation.param_env)
25962596
.eq(
2597-
DefineOpaqueTypes::No,
2597+
DefineOpaqueTypes::Yes,
25982598
upcast_principal.map_bound(|trait_ref| {
25992599
ty::ExistentialTraitRef::erase_self_ty(tcx, trait_ref)
26002600
}),

‎tests/ui/traits/trait-upcasting/type-checking-test-opaques.rs

Copy file name to clipboardExpand all lines: tests/ui/traits/trait-upcasting/type-checking-test-opaques.rs
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#![feature(trait_upcasting, type_alias_impl_trait)]
22

3+
//@ check-pass
4+
35
type Tait = impl Sized;
46

57
trait Foo<'a>: Bar<'a, 'a, Tait> {}
@@ -15,7 +17,6 @@ fn test_correct2<'a>(x: &dyn Foo<'a>) {
1517

1618
fn test_correct3<'a>(x: &dyn Foo<'a>, _: Tait) {
1719
let _ = x as &dyn Bar<'_, '_, ()>;
18-
//~^ ERROR: non-primitive cast
1920
}
2021

2122
fn main() {}

‎tests/ui/traits/trait-upcasting/type-checking-test-opaques.stderr

Copy file name to clipboardExpand all lines: tests/ui/traits/trait-upcasting/type-checking-test-opaques.stderr
-9Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.