Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Support constraining opaque types while trait upcasting with binders
  • Loading branch information
oli-obk committed May 23, 2024
commit 4387eea7f76e82d6f6050df99196c15d53b4914a
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2594,7 +2594,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
self.infcx
.at(&obligation.cause, obligation.param_env)
.eq(
DefineOpaqueTypes::No,
DefineOpaqueTypes::Yes,
upcast_principal.map_bound(|trait_ref| {
ty::ExistentialTraitRef::erase_self_ty(tcx, trait_ref)
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#![feature(trait_upcasting, type_alias_impl_trait)]

//@ check-pass

type Tait = impl Sized;

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

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

fn main() {}

This file was deleted.