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
The library team still needs to formally approve these, which will likely happen soon.
35
-
<!-- TODO: hopefully this happens before we publish this -->
34
+
The tracking issue [can be found here](https://github.com/rust-lang/rust/issues/85684).
35
+
36
+
## Migration
37
+
38
+
As a part of the 2021 edition a migration lint, currently `future_prelude_collision`, has been added in order to aid in automatic migration of Rust 2018 codebases to Rust 2021.
39
+
40
+
### Implementation Reference
41
+
42
+
The lint needs to take a couple of factors into account when determining whether or not introducing 2021 Edition to a codebase will cause a name resolution collision (thus breaking the code after changing edition). These factors include:
43
+
44
+
- Is the call a [fully-qualified call] or does it use [dot-call method syntax]?
45
+
- This will affect how the name is resolved due to auto-reference and auto-dereferencing on method call syntax. Manually dereferencing/referencing will allow specifying priority in the case of dot-call method syntax, while fully-qualified call requires specification of the type and the trait name in the method path (e.g. `<Type as Trait>::method`)
46
+
- Is this an [inherent method] or [a trait method]?
47
+
- Inherent methods that take `self` will take priority over `TryInto::try_into` as inherent methods take priority over trait methods, but inherent methods that take `&self` or `&mut self` won't take priority due to requiring a auto-reference (while `TryInto::try_into` does not, as it takes `self`)
48
+
- Is the origin of this method from `core`/`std`? (As the traits can't have a collision with themselves)
49
+
- Does the given type implement the trait it could have a collision against?
50
+
- Is the method being called via dynamic dispatch? (i.e. is the `self` type `dyn Trait`)
51
+
- If so, trait imports don't affect resolution, and no migration lint needs to occur
0 commit comments