rust-lang/rustfix

When a crate name conflicts with a macro, 2015 -> 2018

Closed this issue · 1 comments

bvinc commented

in lib.rs:

#[macro_use]
extern crate toml;

In another file:

use toml;

After running cargo fix --edition, it tells me that my code is valid for rust 2015 and rust 2018. When I switch the edition to "2018", I get the following error on the use line:


error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130)                                                      
  --> xxx.rs:33:5                                                                                                                                            
   |                                                                                                                                                                        
33 | use toml;                                                                                                                                                              
   |     ^^^^ not an extern crate passed with `--extern`                                                                                                                    
   |                                                                                                                                                                        
note: this import refers to the macro imported here                                                                                                                         
  --> xxx.rs:33:5                                                                                                                                            
   |                                                                                                                                                                        
33 | use toml;                                                                                                                                                              
   |     ^^^^                                                                                                              

I guess it's because there is a toml macro that's conflicting with the crate name. I'm not sure what cargo fix can do about that, but I thought I'd report it.

Thanks for the report! This is actually a bug in the compiler so I've moved this upstream to rust-lang/rust