You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #57745 - petrochenkov:uni2015, r=<try>
[WIP] resolve: Fallback to extern crates in absolute paths on 2015 edition
TODO: Run crater, fix diagnostics
This PR changes the resolution scheme for imports and absolute paths from
| Local edition | Global edition | Imports (`use foo;`) | Absolute paths (`::foo`) |
| ------------- |----------------|-----------------------------------------|------------------------------------------------|
| 2018 | Any | Uniform | Extern prelude |
| 2015 | 2015 | Crate-relative | Crate-relative |
| 2015 | 2018 | Crate-relative with fallback to Uniform | Crate-relative with fallback to Extern prelude |
(which was introduced in #56053) to
| Local edition | Global edition | Imports (`use foo;`) | Absolute paths (`::foo`) |
| ------------- |----------------|-----------------------------------------|------------------------------------------------|
| 2018 | Any | Uniform | Extern prelude |
| 2015 | Any | Crate-relative with fallback to Extern prelude | Crate-relative with fallback to Extern prelude |
(with `use foo;` still desugaring into `use ::foo;` on 2015 edition).
This way we
- Get rid of the special case "2015 macro used on 2018 edition".
- Resolve the issue discussed in #55478, i.e. "on 2015 edition you don't need `extern crate` until you need `use`, then you need `extern crate`". With this change `use my_crate::foo` and `let x = ::my_crate::foo` work without needing `extern crate` consistently with `let x = my_crate::foo`.
r? @Centril
0 commit comments