-
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
undefined reference link error regression #34796
Comments
cc @rust-lang/compiler |
Ok, minimized: // foo.rs
#![crate_type = "lib"]
#![crate_name = "foo"]
pub trait Future {
type Item;
type Error;
}
fn foo() -> Box<Future<Item=(), Error=Box<()>>> {
loop {}
}
pub fn bar<F, A, B>(_s: F)
where F: Fn(A) -> B,
{
foo();
}
// bar.rs
extern crate foo;
fn mk<T>() -> T { loop {} }
struct Data<T, E> {
data: T,
error: E,
}
fn main() {
foo::bar(|()| {
Data::<(), std::io::Error> {
data: mk(),
error: mk(),
}
})
}
|
So it looks like the IR for the foo.rs file emits a symbol of the name
Yet when bar.rs is compiled it expects a symbol of the name
Seems... bad! I wonder if #33703 is related... |
So, my guess is that both stable and beta compute different symbol names here, but in stable symbol names are still store in metadata and thus we don't see the discrepancy. Why they compute different names, I don't know yet. |
@michaelwoerister If |
We are hashing the type parameters as they are encoded for metadata, which should be a stable representation. |
So, here is some debug output from symbol hashing:
If you look closely, you might see that the named type parameters are encoded in a different order in the two cases. |
Yeah, it looks like the projection bounds are sorted by |
@michaelwoerister awesome, thanks for the investigation! |
tyencode: Make sure that projection bounds are handled in stable order. Fixes #34796. r? @alexcrichton
This looks to be a regression from stable to beta unfortunately, compiling rust-lang/futures-rs@6ae0345 succeeds on stable but fails on beta:
cc @michaelwoerister, does this look familiar?
I'll try to reduce down as well, but wanted to file an issue nonetheless.
The text was updated successfully, but these errors were encountered: