Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

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

Closed
bvinc opened this issue Dec 6, 2018 · 1 comment
Closed

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

bvinc opened this issue Dec 6, 2018 · 1 comment

Comments

@bvinc
Copy link

bvinc commented Dec 6, 2018

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.

@alexcrichton
Copy link
Member

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants