Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upundefined reference link error regression #34796
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
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(),
}
})
}
|
This comment has been minimized.
This comment has been minimized.
|
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... |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
@michaelwoerister If |
This comment has been minimized.
This comment has been minimized.
|
We are hashing the type parameters as they are encoded for metadata, which should be a stable representation. |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
Yeah, it looks like the projection bounds are sorted by |
This comment has been minimized.
This comment has been minimized.
|
@michaelwoerister awesome, thanks for the investigation! |
alexcrichton commentedJul 13, 2016
•
edited
This looks to be a regression from stable to beta unfortunately, compiling rust-lang-nursery/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.