-
Notifications
You must be signed in to change notification settings - Fork 554
Commit f4a429e
authored
Rollup merge of #145563 - Kobzol:remove-from-from-prelude, r=petrochenkov
Remove the `From` derive macro from prelude
The new `#[derive(From)]` functionality (implemented in rust-lang/rust#144922) caused name resolution ambiguity issues (rust-lang/rust#145524). The reproducer looks e.g. like this:
```rust
mod foo {
pub use derive_more::From;
}
use foo::*;
#[derive(From)] // ERROR: `From` is ambiguous
struct S(u32);
```
It's pretty unfortunate that it works like this, but I guess that there's not much to be done here, and we'll have to wait for the next edition to put the `From` macro into the prelude. That will probably require rust-lang/rust#139493 to land.
I created a new module in core (and re-exported it in std) called `from`, where I re-exported the `From` macro. I *think* that since this is a new module, it should not have the same backwards incompatibility issue.
Happy to hear suggestions about the naming - maybe it would make sense as `core::macros::from::From`? But we already had a precedent in the `core::assert_matches` module, so I just followed suit.
Fixes: rust-lang/rust#145524
r? ``@petrochenkov``File tree
Expand file treeCollapse file tree
0 file changed
+0
-0
lines changedFilter options
Expand file treeCollapse file tree
0 file changed
+0
-0
lines changed
0 commit comments