Skip to content

Lint for adding crate:: misses a renamed extern crate: #50996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alexcrichton opened this issue May 23, 2018 · 3 comments
Closed

Lint for adding crate:: misses a renamed extern crate: #50996

alexcrichton opened this issue May 23, 2018 · 3 comments
Labels
A-edition-2018 Area: The 2018 edition F-rust_2018_preview `#![feature(rust_2018_preview)]`

Comments

@alexcrichton
Copy link
Member

alexcrichton commented May 23, 2018

The following code:

#![warn(rust_2018_compatibility)]
#![allow(dead_code, unused_imports)]
#![feature(rust_2018_preview)]

extern crate libc as foo;

use foo::getpid;

fn main() {}

generates no warnings, but when compiling with --edition 2018 it will yield an error about no crate foo

@alexcrichton alexcrichton added the F-rust_2018_preview `#![feature(rust_2018_preview)]` label May 23, 2018
@Mark-Simulacrum
Copy link
Member

Is this something we expect rustfix to work with? It would have to move the rename into Cargo.toml, right? I don't know if we expect it to make changes there.

@alexcrichton
Copy link
Member Author

In the sense that this prevents entering the 2018 edition I think we'll want rustfix to handle this yeah. Although the ideal solution here is to add the rename to Cargo.toml using use crate::foo::getpid will also work in this situation. Editing Cargo.toml I think is definitely outside of rustfix's scope, though

@nikomatsakis
Copy link
Contributor

Got a fix

bors added a commit that referenced this issue May 24, 2018
… r=acrichto

"crate-ify" paths that begin with a renamed crate

This does two things:

- crate-ify paths that begin with a renamed crate (i.e., add `crate::`) to the front

Fixes #50996

I also added tests for a few other scenarios.

r? @alexcrichton
@fmease fmease added the A-edition-2018 Area: The 2018 edition label Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2018 Area: The 2018 edition F-rust_2018_preview `#![feature(rust_2018_preview)]`
Projects
None yet
Development

No branches or pull requests

4 participants