Move the Error trait into core (without fn backtrace) by yaahc · Pull Request #90328 · rust-lang/rust (original) (raw)

@spastorino before adding the impl !Error for &str line I got this error

error[E0119]: conflicting implementations of trait core::convert::From<&str> for type boxed::Box<dyn core::error::Error + core:📑:Send + core:📑:Sync>
--> library/alloc/src/boxed.rs:1982:1
|
1880 | impl<'a, E: Error + Send + Sync + 'a> From for Box<dyn Error + Send + Sync + 'a> {
| ----------------------------------------------------------------------------------- first implementation here
...
1982 | impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for boxed::Box<dyn core::error::Error + core:📑:Send + core:📑:Sync>
|
= note: upstream crates may add a new impl of trait core::error::Error for type &str in future versions

error[E0119]: conflicting implementations of trait core::convert::From<&str> for type boxed::Box<dyn core::error::Error>
--> library/alloc/src/boxed.rs:2005:1
|
1848 | impl<'a, E: Error + 'a> From for Box<dyn Error + 'a> {
| ------------------------------------------------------- first implementation here
...
2005 | impl From<&str> for Box {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for boxed::Box<dyn core::error::Error>
|
= note: upstream crates may add a new impl of trait core::error::Error for type &str in future versions

For more information about this error, try rustc --explain E0119.
error: could not compile alloc due to 2 previous errors
Build completed unsuccessfully in 0:00:00

And now I get this error:

error[E0119]: conflicting implementations of trait core::convert::From<&str> for type boxed::Box<dyn core::error::Error + core:📑:Send + core:📑:Sync>
--> library/alloc/src/boxed.rs:1982:1
|
1880 | impl<'a, E: Error + Send + Sync + 'a> From for Box<dyn Error + Send + Sync + 'a> {
| ----------------------------------------------------------------------------------- first implementation here
...
1982 | impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for boxed::Box<dyn core::error::Error + core:📑:Send + core:📑:Sync>

error[E0119]: conflicting implementations of trait core::convert::From<&str> for type boxed::Box<dyn core::error::Error>
--> library/alloc/src/boxed.rs:2005:1
|
1848 | impl<'a, E: Error + 'a> From for Box<dyn Error + 'a> {
| ------------------------------------------------------- first implementation here
...
2005 | impl From<&str> for Box {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for boxed::Box<dyn core::error::Error>