nrc / derive-new

derive simple constructor functions for Rust structs
MIT License
525 stars 35 forks source link

Build fails on nightly #47

Closed Hoverbear closed 2 years ago

Hoverbear commented 4 years ago

It seems like name resolution for macros has changed on nightly 2019-11-17?

hoverbear@Obsidian:~/git/derive-new$ cargo +nightly-2019-11-17 test
   Compiling derive-new v0.5.8 (/home/hoverbear/git/derive-new)
error[E0659]: `new` is ambiguous (derive helper attribute vs any other name)
   --> tests/test.rs:163:7
    |
163 |     #[new(default)]
    |       ^^^ ambiguous name
    |
note: `new` could refer to the derive helper attribute defined here
   --> tests/test.rs:161:10
    |
161 | #[derive(new, PartialEq, Debug)]
    |          ^^^
note: `new` could also refer to the derive macro imported here
   --> tests/test.rs:3:1
    |
3   | #[macro_use]
    | ^^^^^^^^^^^^

error[E0659]: `new` is ambiguous (derive helper attribute vs any other name)
   --> tests/test.rs:166:7
    |
166 |     #[new(default)]
    |       ^^^ ambiguous name
    |
note: `new` could refer to the derive helper attribute defined here
   --> tests/test.rs:161:10
    |
161 | #[derive(new, PartialEq, Debug)]
    |          ^^^
note: `new` could also refer to the derive macro imported here
   --> tests/test.rs:3:1
    |
3   | #[macro_use]
    | ^^^^^^^^^^^^

error[E0659]: `new` is ambiguous (derive helper attribute vs any other name)
   --> tests/test.rs:186:7
    |
186 |     #[new(value = "1 + 2")]
    |       ^^^ ambiguous name
    |
note: `new` could refer to the derive helper attribute defined here
   --> tests/test.rs:184:10
    |
184 | #[derive(new, PartialEq, Debug)]
    |          ^^^
note: `new` could also refer to the derive macro imported here
   --> tests/test.rs:3:1
    |
3   | #[macro_use]
    | ^^^^^^^^^^^^

error[E0659]: `new` is ambiguous (derive helper attribute vs any other name)
   --> tests/test.rs:189:7
    |
189 |     #[new(value = "vec![-42, 42]")]
    |       ^^^ ambiguous name
    |
note: `new` could refer to the derive helper attribute defined here
   --> tests/test.rs:184:10
    |
184 | #[derive(new, PartialEq, Debug)]
    |          ^^^
note: `new` could also refer to the derive macro imported here
   --> tests/test.rs:3:1
    |
3   | #[macro_use]
    | ^^^^^^^^^^^^

error[E0659]: `new` is ambiguous (derive helper attribute vs any other name)
   --> tests/test.rs:209:7
    |
209 |     #[new(value = r#""Thud".to_owned()"#)]
    |       ^^^ ambiguous name
    |
note: `new` could refer to the derive helper attribute defined here
   --> tests/test.rs:207:10
    |
207 | #[derive(new, PartialEq, Debug)]
    |          ^^^
note: `new` could also refer to the derive macro imported here
   --> tests/test.rs:3:1
    |
3   | #[macro_use]
    | ^^^^^^^^^^^^

error[E0659]: `new` is ambiguous (derive helper attribute vs any other name)
   --> tests/test.rs:211:7
    |
211 |     #[new(default)]
    |       ^^^ ambiguous name
    |
note: `new` could refer to the derive helper attribute defined here
   --> tests/test.rs:207:10
    |
207 | #[derive(new, PartialEq, Debug)]
    |          ^^^
note: `new` could also refer to the derive macro imported here
   --> tests/test.rs:3:1
    |
3   | #[macro_use]
    | ^^^^^^^^^^^^

error[E0659]: `new` is ambiguous (derive helper attribute vs any other name)
   --> tests/test.rs:249:7
    |
249 |     #[new(default)] pub i32,
    |       ^^^ ambiguous name
    |
note: `new` could refer to the derive helper attribute defined here
   --> tests/test.rs:247:10
    |
247 | #[derive(new, PartialEq, Debug)]
    |          ^^^
note: `new` could also refer to the derive macro imported here
   --> tests/test.rs:3:1
    |
3   | #[macro_use]
    | ^^^^^^^^^^^^

error[E0659]: `new` is ambiguous (derive helper attribute vs any other name)
   --> tests/test.rs:251:7
    |
251 |     #[new(default)] pub T,
    |       ^^^ ambiguous name
    |
note: `new` could refer to the derive helper attribute defined here
   --> tests/test.rs:247:10
    |
247 | #[derive(new, PartialEq, Debug)]
    |          ^^^
note: `new` could also refer to the derive macro imported here
   --> tests/test.rs:3:1
    |
3   | #[macro_use]
    | ^^^^^^^^^^^^

error[E0659]: `new` is ambiguous (derive helper attribute vs any other name)
   --> tests/test.rs:263:7
    |
263 |     #[new(value = "1 + 2")] pub i32,
    |       ^^^ ambiguous name
    |
note: `new` could refer to the derive helper attribute defined here
   --> tests/test.rs:261:10
    |
261 | #[derive(new, PartialEq, Debug)]
    |          ^^^
note: `new` could also refer to the derive macro imported here
   --> tests/test.rs:3:1
    |
3   | #[macro_use]
    | ^^^^^^^^^^^^

error[E0659]: `new` is ambiguous (derive helper attribute vs any other name)
   --> tests/test.rs:265:7
    |
265 |     #[new(value = "vec![-42, 42]")] pub Vec<i8>,
    |       ^^^ ambiguous name
    |
note: `new` could refer to the derive helper attribute defined here
   --> tests/test.rs:261:10
    |
261 | #[derive(new, PartialEq, Debug)]
    |          ^^^
note: `new` could also refer to the derive macro imported here
   --> tests/test.rs:3:1
    |
3   | #[macro_use]
    | ^^^^^^^^^^^^

error[E0659]: `new` is ambiguous (derive helper attribute vs any other name)
   --> tests/test.rs:277:7
    |
277 |     #[new(value = r#""Thud".to_owned()"#)] pub String,
    |       ^^^ ambiguous name
    |
note: `new` could refer to the derive helper attribute defined here
   --> tests/test.rs:275:10
    |
275 | #[derive(new, PartialEq, Debug)]
    |          ^^^
note: `new` could also refer to the derive macro imported here
   --> tests/test.rs:3:1
    |
3   | #[macro_use]
    | ^^^^^^^^^^^^

error[E0659]: `new` is ambiguous (derive helper attribute vs any other name)
   --> tests/test.rs:278:7
    |
278 |     #[new(default)] pub String,
    |       ^^^ ambiguous name
    |
note: `new` could refer to the derive helper attribute defined here
   --> tests/test.rs:275:10
    |
275 | #[derive(new, PartialEq, Debug)]
    |          ^^^
note: `new` could also refer to the derive macro imported here
   --> tests/test.rs:3:1
    |
3   | #[macro_use]
    | ^^^^^^^^^^^^

error[E0659]: `new` is ambiguous (derive helper attribute vs any other name)
   --> tests/test.rs:318:11
    |
318 |         #[new(value = "\"fascinating\".to_owned()")] String,
    |           ^^^ ambiguous name
    |
note: `new` could refer to the derive helper attribute defined here
   --> tests/test.rs:314:10
    |
314 | #[derive(new, PartialEq, Debug)]
    |          ^^^
note: `new` could also refer to the derive macro imported here
   --> tests/test.rs:3:1
    |
3   | #[macro_use]
    | ^^^^^^^^^^^^

error[E0659]: `new` is ambiguous (derive helper attribute vs any other name)
   --> tests/test.rs:319:11
    |
319 |         #[new(default)] T,
    |           ^^^ ambiguous name
    |
note: `new` could refer to the derive helper attribute defined here
   --> tests/test.rs:314:10
    |
314 | #[derive(new, PartialEq, Debug)]
    |          ^^^
note: `new` could also refer to the derive macro imported here
   --> tests/test.rs:3:1
    |
3   | #[macro_use]
    | ^^^^^^^^^^^^

error: aborting due to 14 previous errors

For more information about this error, try `rustc --explain E0659`.
error: could not compile `derive-new`.

To learn more, run the command again with --verbose.

Works on 2019-11-16:

hoverbear@Obsidian:~/git/derive-new$ cargo +nightly-2019-11-16 test
    Finished test [unoptimized + debuginfo] target(s) in 0.04s
     Running target/debug/deps/derive_new-2aab09fd7c964d03

running 1 test
test test_to_snake_case ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/test-a81e668b709555b1

running 18 tests
test test_empty_struct ... ok
test test_enum_unit_variants ... ok
test test_more_involved_enum ... ok
test test_simple_struct ... ok
test test_simple_tuple_struct ... ok
test test_struct_phantom_data ... ok
test test_struct_lifetime_bounds ... ok
test test_struct_mixed_defaults ... ok
test test_struct_with_bounds ... ok
test test_struct_with_defaults ... ok
test test_struct_with_lifetime ... ok
test test_struct_with_values ... ok
test test_tuple_mixed_defaults ... ok
test test_tuple_phantom_data ... ok
test test_tuple_struct_lifetime ... ok
test test_tuple_with_defaults ... ok
test test_tuple_with_values ... ok
test test_unit_struct ... ok

test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

   Doc-tests derive-new

running 5 tests
test src/lib.rs -  (line 70) ... ok
test src/lib.rs -  (line 24) ... ok
test src/lib.rs -  (line 92) ... ok
test src/lib.rs -  (line 50) ... ok
test src/lib.rs -  (line 32) ... ok

test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Stargateur commented 2 years ago

I guess it can be close ? can't reproduce today, either fixed or a nightly regression.