about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-11-25 22:45:50 +0000
committerbors <bors@rust-lang.org>2019-11-25 22:45:50 +0000
commit483a83b6e648d9e6cb21af75dba289a9aef150b1 (patch)
tree15eafda02beb085de7b362f089c626422bf7adc3 /src/libstd/sys/unix/stack_overflow.rs
parenta44774c3a9739b2eea8923e09d67b14312c78ef3 (diff)
parentdf3f33870ad48b29a82cce524c1fa092280e76c8 (diff)
downloadrust-483a83b6e648d9e6cb21af75dba289a9aef150b1.tar.gz
rust-483a83b6e648d9e6cb21af75dba289a9aef150b1.zip
Auto merge of #66178 - Aaron1011:fix/opaque-normalize, r=varkor
Fix opaque types resulting from projections in function signature

When we normalize the types in a function signature, we may end up
resolving a projection to an opaque type (e.g. `Self::MyType` when
we have `type MyType = impl SomeTrait`). When the projection is
resolved, we will instantiate the generic parameters into fresh
inference variables.

While we do want to normalize projections to opaque types, we don't want
to replace the explicit generic parameters (e.g. `T` in `impl
MyTrait<T>`) with inference variables. We want the opaque type in the
function signature to be eligible to be a defining use of that opaque
type - adding inference variables prevents this, since the opaque type
substs now appears to refer to some specific type, rather than a generic
type.

To resolve this issue, we inspect the opaque types in the function
signature after normalization. Any inference variables in the substs are
replaced with the corresponding generic parameter in the identity substs
(e.g. `T` in `impl MyTrait<T>`). Note that normalization is the only way
that we can end up with inference variables in opaque substs in a
function signature - users have no way of getting inference variables
into a function signature.

Note that all of this refers to the opaque type (ty::Opaque) and its
subst - *not* to the underlying type.

Fixes #59342
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions