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

"can't find crate for std" error when rustc is a symlink #11713

Closed
bnoordhuis opened this issue Jan 22, 2014 · 1 comment
Closed

"can't find crate for std" error when rustc is a symlink #11713

bnoordhuis opened this issue Jan 22, 2014 · 1 comment

Comments

@bnoordhuis
Copy link
Contributor

With the current HEAD of master (commit 505572b), when I install rust to my home directory and symlink rustc in $HOME/bin (which is on my $PATH), I get the following error:

$ ./configure --prefix=$HOME/opt/rust && make install
# elided

$ echo 'fn main() {}' > t.rs

$ RUST_LOG=rustc::metadata rustc t.rs 
using sysroot = /Users/bnoordhuis
resolving extern mod stmt. ident: @"std" path_opt: Some((@"std#0.10-pre", CookedStr))
filesearch: searching additional lib search paths [0u]
filesearch: searching target lib path
searching /Users/bnoordhuis/lib/rustlib/x86_64-apple-darwin/lib
is /Users/bnoordhuis/src/rust/.rust/lib/x86_64-apple-darwin in visited_dirs? false
searching /Users/bnoordhuis/src/rust/.rust/lib/x86_64-apple-darwin
is /Users/bnoordhuis/src/rust/lib/x86_64-apple-darwin in visited_dirs? false
searching /Users/bnoordhuis/src/rust/lib/x86_64-apple-darwin
t.rs:1:1: 1:1 error: can't find crate for `std`
t.rs:1 fn main() {}
       ^

Invoking rustc as $HOME/opt/rust/bin/rustc fixes it as does linking with -L$HOME/opt/rust/lib/rustlib/x86_64-apple-darwin/lib.

I suspect that rustc is looking for the libraries relative to dirname(argv[0]). That should probably be dirname(realpath(argv[0])).

@alexcrichton
Copy link
Member

Closing as a dupe of #3632, but thanks for the report!

flip1995 pushed a commit to flip1995/rust that referenced this issue Jan 25, 2024
`unused_io_amount` captures `Ok(_)`s

Partial rewrite of `unused_io_amount` to lint over `Ok(_)` and `Ok(..)`.

Moved the check to `check_block` to simplify context checking for expressions and allow us to check only some expressions.

For match (expr, arms) we emit a lint for io ops used on `expr` when an arm is `Ok(_)|Ok(..)`. Also considers the cases when there are guards in the arms and `if let Ok(_) = ...` cases.

For `Ok(_)` and `Ok(..)` it emits a note indicating where the value is ignored.

changelog: False Negatives [`unused_io_amount`]: Extended `unused_io_amount` to catch `Ok(_)`s in `If let` and match exprs.

Closes rust-lang#11713

r? `@giraffate`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants