diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2019-08-26 21:32:14 -0400 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2019-09-24 11:14:35 -0400 |
| commit | 33e1dd78646e712e7fe159e903fff58bd1734418 (patch) | |
| tree | 829ab43b6b30fe4a41d7de84fed422181b846a2b /src/rustllvm/RustWrapper.cpp | |
| parent | 6ef275e6c3cb1384ec78128eceeb4963ff788dca (diff) | |
| download | rust-33e1dd78646e712e7fe159e903fff58bd1734418.tar.gz rust-33e1dd78646e712e7fe159e903fff58bd1734418.zip | |
Fix coherence checking for impl trait in type aliases
Fixes #63677 RFC #2071 (impl-trait-existential-types) does not explicitly state how impl trait type alises should interact with coherence. However, there's only one choice which makes sense - coherence should look at the underlying type (i.e. the 'defining' type of the impl trait) of the type alias, just like we do for non-impl-trait type aliases. Specifically, impl trait type alises which resolve to a local type should be treated like a local type with respect to coherence (e.g. impl trait type aliases which resolve to a forieign type should be treated as a foreign type, and those that resolve to a local type should be treated as a local type). Since neither inherent impls nor direct trait impl (i.e. `impl MyType` or `impl MyTrait for MyType`) are allowd for type aliases, this usually does not come up. Before we ever attempt to do coherence checking, we will have errored out if an impl trait type alias was used directly in an 'impl' clause. However, during trait selection, we sometimes need to prove bounds like 'T: Sized' for some type 'T'. If 'T' is an impl trait type alias, this requires to know the coherence behavior for impl trait type aliases when we perform coherence checking. Note: Since determining the underlying type of an impl trait type alias requires us to perform body type checking, this commit causes us to type check some bodies easlier than we otherwise would have. However, since this is done through a query, this shouldn't cause any problems For completeness, I've added an additional test of the coherence-related behavior of impl trait type aliases.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
