Process alias-relate obligations in CoerceUnsized loop
This commit is contained in:
parent
8790c3cc7c
commit
cc584ba245
@ -636,6 +636,20 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
|
||||
{
|
||||
self.resolve_vars_if_possible(trait_pred)
|
||||
}
|
||||
// Eagerly process alias-relate obligations in new trait solver,
|
||||
// since these can be emitted in the process of solving trait goals,
|
||||
// but we need to constrain vars before processing goals mentioning
|
||||
// them.
|
||||
Some(ty::PredicateKind::AliasRelate(..)) => {
|
||||
let mut fulfill_cx = <dyn TraitEngine<'tcx>>::new(self);
|
||||
fulfill_cx.register_predicate_obligation(self, obligation);
|
||||
let errs = fulfill_cx.select_where_possible(self);
|
||||
if !errs.is_empty() {
|
||||
return Err(TypeError::Mismatch);
|
||||
}
|
||||
coercion.obligations.extend(fulfill_cx.pending_obligations());
|
||||
continue;
|
||||
}
|
||||
_ => {
|
||||
coercion.obligations.push(obligation);
|
||||
continue;
|
||||
|
@ -0,0 +1,18 @@
|
||||
//@ compile-flags: -Znext-solver
|
||||
//@ check-pass
|
||||
|
||||
use std::mem::ManuallyDrop;
|
||||
|
||||
trait Foo {}
|
||||
|
||||
struct Guard<T> {
|
||||
value: ManuallyDrop<T>,
|
||||
}
|
||||
|
||||
impl<T: Foo> Guard<T> {
|
||||
fn uwu(&self) {
|
||||
let x: &dyn Foo = &*self.value;
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
x
Reference in New Issue
Block a user