Commit 4551dc2
authored
Rollup merge of rust-lang#63093 - Aaron1011:fix/existential-closure, r=cramertj
Properly check the defining scope of existential types
Fixes rust-lang#52632
Existential types (soon to be 'impl trait' aliases) can either be
delcared at a top-level crate/module scope, or within another item such
as an fn. Previously, we were handling the second case incorrectly when
recursively searching for defining usages - we would check children of
the item, but not the item itself. This lead to us missing closures
that consituted a defining use of the existential type, as their opaque
type instantiations are stored in the TypeckTables of their parent
function.
This commit ensures that we explicitly visit the defining item itself,
not just its children.File tree
4 files changed
+61
-9
lines changed- src
- librustc_typeck
- librustc/infer/opaque_types
- test/ui/existential-type
4 files changed
+61
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1189 | 1189 | | |
1190 | 1190 | | |
1191 | 1191 | | |
1192 | | - | |
1193 | | - | |
1194 | | - | |
1195 | | - | |
1196 | | - | |
| 1192 | + | |
1197 | 1193 | | |
1198 | 1194 | | |
1199 | 1195 | | |
| |||
1202 | 1198 | | |
1203 | 1199 | | |
1204 | 1200 | | |
1205 | | - | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
1206 | 1209 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1664 | 1664 | | |
1665 | 1665 | | |
1666 | 1666 | | |
| 1667 | + | |
1667 | 1668 | | |
1668 | 1669 | | |
1669 | 1670 | | |
| |||
1672 | 1673 | | |
1673 | 1674 | | |
1674 | 1675 | | |
| 1676 | + | |
1675 | 1677 | | |
1676 | 1678 | | |
1677 | 1679 | | |
| |||
1680 | 1682 | | |
1681 | 1683 | | |
1682 | 1684 | | |
| 1685 | + | |
1683 | 1686 | | |
1684 | 1687 | | |
1685 | 1688 | | |
| |||
1703 | 1706 | | |
1704 | 1707 | | |
1705 | 1708 | | |
1706 | | - | |
1707 | | - | |
1708 | | - | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
1709 | 1726 | | |
1710 | 1727 | | |
1711 | 1728 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
0 commit comments