Skip to content
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

rustc should warn when a (library) crate's name doesn't match its filename #29994

Closed
wthrowe opened this issue Nov 23, 2015 · 3 comments
Closed
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@wthrowe
Copy link
Contributor

wthrowe commented Nov 23, 2015

Staring at libfoo.rlib while having rustc insist that it can't find crate foo is really confusing.

$ cat lib.rs 
#![crate_type = "rlib"]

pub fn foo() {}
$ cat main.rs 
extern crate foo;

fn main() { foo::foo(); }
$ rustc lib.rs -o libfoo.rlib
$ rustc -L. main.rs
main.rs:1:1: 1:18 error: can't find crate for `foo` [E0463]
main.rs:1 extern crate foo;
          ^~~~~~~~~~~~~~~~~
error: aborting due to previous error
$ ls
lib.rs  libfoo.rlib  main.rs
$ 
@steveklabnik
Copy link
Member

Triage: still reproduces today.

@steveklabnik steveklabnik added A-frontend Area: Compiler frontend (errors, parsing and HIR) A-compiler labels Jul 25, 2016
@steveklabnik steveklabnik added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed A-compiler labels Mar 24, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Jul 24, 2017
@steveklabnik
Copy link
Member

Triage: there's been no other comments in over three years; given that people use cargo 99% of the time, and are not very likely to invoke rustc in this particular way, I'm not sure this is going to be implemented.

@jieyouxu
Copy link
Member

jieyouxu commented Mar 1, 2025

Triage: I don't think it's worth the implementation complexity and potential for false positives, and users are unlikely to invoke rustc directly in this form. I'm going to close as not super actionable.

@jieyouxu jieyouxu closed this as not planned Won't fix, can't repro, duplicate, stale Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants