-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Spurious attempt to load a crate resulting in "multiple rlib candidates for debug_unreachable
found".
#56590
Comments
Crate loading is certainly not fully speculative, at leas with regards to non-existent paths (#55103), so it's possible that some other errors are also reported eagerly. |
This appears to be fixed in nightly, but the original issue is now in beta. Edit: Actually, using the non-existent import does still trigger the bug on nightly. use a::A;
struct S {
a: A,
} |
And stable 1.31.1 |
nightly release still has this, but nightly debug does not! (I hope it's not because I ran debug first and release later) I hit it with my example too (playground): #[derive(Debug)]
struct A(i32);
fn main() {
let mut v = vec![A(1), A(2)];
//let first = &v[0];
v.push(A(6));
//let first = &v[0]; //all errors go away if I uncomment this, even the "multiple rlib" one
println!("The first element is: {:?}", first);
} EDIT: New example(tested on rust nightly debug): fn main() {
for _ in 1..1 {}
}
fn change(i: &mut NewType) {} (I can't trigger any of these(or OP) examples locally with a rustc that's 1 day older than the nightly in playground - so I'm assuming it only happens in playground, or simply |
Stable (1.33.0), Beta (1.34.0-beta1), and Nightly (1.35.0-nightly 2019-03-14 bc44841) all continue to experience this problem. Here's an example that reproduces the problem: [package]
name = "repro"
version = "0.1.0"
edition = "2018"
[dependencies]
debug_unreachable = "0.1.1"
new_debug_unreachable = "1.0.3" use std::rc::Rc;
struct Wat(Rc<Derp>);
fn main() {
let mut b: [i32; 10] = Default::default();
}
Of interest is that |
This is now on stable, but it appears fixed on nightly |
My code example continues to have the error in nightly on the playground. |
The code example in #56590 (comment) still fails on nightly as well, but in Release mode only, while some examples from other comments fail in Debug only, and finally there are also examples (such as Shep's) failing in both Debug and Release. |
Is there a known workaround for this? I am still seeing this issue with 1.44.0-nightly. |
Fixed in #74071. |
Original message: Rollup merge of rust-lang#74071 - petrochenkov:cload3, r=matthewjasper rustc_metadata: Make crate loading fully speculative Instead of reporting `span_err`s on the spot crate loading errors are now wrapped into the `CrateError` enum and returned, so they are reported only at the top level `resolve_crate` call, and not reported at all if we are resolving speculatively with `maybe_resolve_crate`. As a result we can attempt loading crates for error recovery (e.g. import suggestions) without any risk of producing extra errors. Also, this means better separation between error reporting and actual logic. Fixes rust-lang#55103 Fixes rust-lang#56590
I've reduced a triggering example to this:
Producing (on playground, in Rust 2018 mode, only on nightly):
The names in the testcase appear to not matter, but I can't figure out why both a lifetime and a type parameter need to be present, or any of the other details.
My guess this is from the
rustc_resolve
speculative loading of crates, to give better suggestions, which I must've not made foolproof (I thought I made all the errors lazy, but maybe this from a different spot that I missed).cc @petrochenkov
The text was updated successfully, but these errors were encountered: