Define hidden types in confirmation
This commit is contained in:
parent
e927184629
commit
08fc5e8acd
@ -2466,7 +2466,7 @@ fn confirm_param_env_candidate<'cx, 'tcx>(
|
|||||||
debug!(?cache_projection, ?obligation_projection);
|
debug!(?cache_projection, ?obligation_projection);
|
||||||
|
|
||||||
match infcx.at(cause, param_env).eq(
|
match infcx.at(cause, param_env).eq(
|
||||||
DefineOpaqueTypes::No,
|
DefineOpaqueTypes::Yes,
|
||||||
cache_projection,
|
cache_projection,
|
||||||
obligation_projection,
|
obligation_projection,
|
||||||
) {
|
) {
|
||||||
|
26
tests/ui/type-alias-impl-trait/nested_inference_failure.rs
Normal file
26
tests/ui/type-alias-impl-trait/nested_inference_failure.rs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// check-pass
|
||||||
|
|
||||||
|
//! This test checks that we can successfully infer
|
||||||
|
//! the hidden type of `FooImpl` to be `Foo<i32, {closure}>`
|
||||||
|
//! and `ImplT` to be `i32`. This test used to fail, because
|
||||||
|
//! we were unable to make the connection that the closure
|
||||||
|
//! argument is the same as the first argument of `Foo`.
|
||||||
|
|
||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
use std::fmt::Debug;
|
||||||
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
|
struct Foo<T: Debug, F: FnOnce(T)> {
|
||||||
|
f: F,
|
||||||
|
_phantom: PhantomData<T>,
|
||||||
|
}
|
||||||
|
|
||||||
|
type ImplT = impl Debug;
|
||||||
|
type FooImpl = Foo<ImplT, impl FnOnce(ImplT)>;
|
||||||
|
|
||||||
|
fn bar() -> FooImpl {
|
||||||
|
Foo::<i32, _> { f: |_| (), _phantom: PhantomData }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Reference in New Issue
Block a user