Commit 3cd0a10
authored
Rollup merge of rust-lang#114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk
Store the laziness of type aliases in their `DefKind`
Previously, we would treat paths referring to type aliases as *lazy* type aliases if the current crate had lazy type aliases enabled independently of whether the crate which the alias was defined in had the feature enabled or not.
With this PR, the laziness of a type alias depends on the crate it is defined in. This generally makes more sense to me especially if / once lazy type aliases become the default in a new edition and we need to think about *edition interoperability*:
Consider the hypothetical case where the dependency crate has an older edition (and thus eager type aliases), it exports a type alias with bounds & a where-clause (which are void but technically valid), the dependent crate has the latest edition (and thus lazy type aliases) and it uses that type alias. Arguably, the bounds should *not* be checked since at any time, the dependency crate should be allowed to change the bounds at will with a *non*-major version bump & without negatively affecting downstream crates.
As for the reverse case (dependency: lazy type aliases, dependent: eager type aliases), I guess it rules out anything from slight confusion to mild annoyance from upstream crate authors that would be caused by the compiler ignoring the bounds of their type aliases in downstream crates with older editions.
---
This fixes rust-lang#114468 since before, my assumption that the type alias associated with a given weak projection was lazy (and therefore had its variances computed) did not necessarily hold in cross-crate scenarios (which [I kinda had a hunch about](rust-lang#114253 (comment))) as outlined above. Now it does hold.
`@rustbot` label F-lazy_type_alias
r? `@oli-obk`File tree
49 files changed
+208
-93
lines changed- compiler
- rustc_borrowck/src/diagnostics
- rustc_hir_analysis/src
- astconv
- check
- collect
- variance
- rustc_hir_typeck/src
- fn_ctxt
- rustc_hir/src
- rustc_infer/src/infer/error_reporting
- rustc_metadata/src/rmeta
- rustc_middle/src
- hir/map
- query
- ty
- print
- rustc_mir_build/src/thir/pattern
- rustc_monomorphize/src
- rustc_passes/src
- rustc_privacy/src
- rustc_query_system/src/query
- rustc_resolve/src
- late
- rustc_trait_selection/src/solve
- rustc_ty_utils/src
- src
- librustdoc
- clean
- formats
- passes
- tools/clippy
- clippy_lints/src
- clippy_utils/src
- ty/type_certainty
- tests/ui/lazy-type-alias
- auxiliary
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
49 files changed
+208
-93
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
519 | | - | |
| 519 | + | |
520 | 520 | | |
521 | 521 | | |
522 | 522 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| |||
141 | 143 | | |
142 | 144 | | |
143 | 145 | | |
144 | | - | |
| 146 | + | |
145 | 147 | | |
146 | 148 | | |
147 | 149 | | |
| |||
197 | 199 | | |
198 | 200 | | |
199 | 201 | | |
200 | | - | |
| 202 | + | |
201 | 203 | | |
202 | 204 | | |
203 | 205 | | |
| |||
248 | 250 | | |
249 | 251 | | |
250 | 252 | | |
251 | | - | |
| 253 | + | |
252 | 254 | | |
253 | 255 | | |
254 | 256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
907 | 907 | | |
908 | 908 | | |
909 | 909 | | |
| 910 | + | |
910 | 911 | | |
911 | | - | |
| 912 | + | |
912 | 913 | | |
913 | | - | |
914 | | - | |
| 914 | + | |
| 915 | + | |
915 | 916 | | |
916 | 917 | | |
917 | | - | |
| 918 | + | |
| 919 | + | |
918 | 920 | | |
919 | | - | |
920 | | - | |
| 921 | + | |
| 922 | + | |
921 | 923 | | |
922 | | - | |
| 924 | + | |
923 | 925 | | |
924 | 926 | | |
925 | 927 | | |
| |||
2158 | 2160 | | |
2159 | 2161 | | |
2160 | 2162 | | |
2161 | | - | |
| 2163 | + | |
2162 | 2164 | | |
2163 | 2165 | | |
2164 | 2166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
728 | 728 | | |
729 | 729 | | |
730 | 730 | | |
731 | | - | |
| 731 | + | |
732 | 732 | | |
733 | 733 | | |
734 | 734 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1480 | 1480 | | |
1481 | 1481 | | |
1482 | 1482 | | |
1483 | | - | |
| 1483 | + | |
1484 | 1484 | | |
1485 | 1485 | | |
1486 | 1486 | | |
| |||
1990 | 1990 | | |
1991 | 1991 | | |
1992 | 1992 | | |
1993 | | - | |
| 1993 | + | |
1994 | 1994 | | |
1995 | 1995 | | |
1996 | 1996 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
83 | | - | |
| 81 | + | |
| 82 | + | |
84 | 83 | | |
85 | 84 | | |
86 | 85 | | |
| |||
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | | - | |
115 | | - | |
| 113 | + | |
| 114 | + | |
116 | 115 | | |
117 | 116 | | |
118 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | | - | |
| 59 | + | |
| 60 | + | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
| 100 | + | |
| 101 | + | |
103 | 102 | | |
104 | 103 | | |
105 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1359 | 1359 | | |
1360 | 1360 | | |
1361 | 1361 | | |
1362 | | - | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
1363 | 1366 | | |
1364 | 1367 | | |
1365 | 1368 | | |
| |||
0 commit comments