Closed
Description
openedon Nov 28, 2018
This code is valid in both edition 2015 and 2018, but cargo fix --edition
tries to fix it and fails.
Cargo.toml
[package]
name = "error"
version = "0.1.0"
edition = "2015"
[dependencies]
src/main.rs
pub trait PotentialBuilder: DynCloneDetail {}
pub trait DynCloneDetail {
fn box_clone(&self) -> Box<dyn PotentialBuilder>;
fn _as_ref_dyn(&self) -> &dyn PotentialBuilder;
}
#[macro_export]
macro_rules! impl_dyn_clone_detail {
(impl[$($bnd:tt)*] DynCloneDetail for $Type:ty { ... }) => {
impl<$($bnd)*> DynCloneDetail for $Type {
fn box_clone(&self) -> Box<dyn PotentialBuilder> {
Box::new(<$Type as Clone>::clone(self))
}
fn _as_ref_dyn(&self) -> &dyn PotentialBuilder { self }
}
};
}
#[derive(Clone)]
struct Pot;
impl PotentialBuilder for Pot {}
impl_dyn_clone_detail!{
impl[] DynCloneDetail for Pot { ... }
}
fn main() {}
Command & output
$ cargo +nightly fix --edition
Checking error v0.1.0 (/home/lampam/cpp/throwaway/error)
warning: failed to automatically apply fixes suggested by rustc to crate `error`
after fixes were automatically applied the compiler reported errors within these files:
* src/main.rs
This likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at
https://github.com/rust-lang/cargo/issues
quoting the full output of this command we'd be very appreciative!
warning: `dyn` is a keyword in the 2018 edition
warning: `dyn` is a keyword in the 2018 edition
--> src/main.rs:13:40
|
13 | fn box_clone(&self) -> Box<dyn PotentialBuilder> {
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
--> src/main.rs:13:40
|
13 | fn box_clone(&self) -> Box<dyn PotentialBuilder> {
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
|
|
= note: `-W keyword-idents` implied by `-W rust-2018-compatibility`
= note: `-W keyword-idents` implied by `-W rust-2018-compatibility`
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
warning: `dyn` is a keyword in the 2018 edition
--> src/main.rs:16:39
|
16 | fn _as_ref_dyn(&self) -> &dyn PotentialBuilder { self }
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
warning: `dyn` is a keyword in the 2018 edition
--> src/main.rs:16:39
|
16 | fn _as_ref_dyn(&self) -> &dyn PotentialBuilder { self }
| ^^^ help: you can use a raw identifier to stay compatible: `r#dyn`
|
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
= note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716>
Finished dev [unoptimized + debuginfo] target(s) in 0.31s
$ cargo +nightly --version
cargo 1.32.0-nightly (b3d0b2e54 2018-11-15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels