-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
ICE in ensure_public #29161
Comments
mod a {
struct A;
impl Default for A {
pub fn default() -> A {
A;
}
}
}
fn main() {
a::A::default();
} |
Works on current beta. Does not work on current nightly. |
triage: P-high |
The unwrap seems to be from trying to get a def-id from a node-id that is not registered. |
Problem seems to be that the def-id is not local to the current crate. |
OK, the problem is that when doing the def-id conversion, I converted this code: .. if id == source_did.unwrap_or(to_check).node .. into this: let def_id = source_did.unwrap_or(to_check);
debug!("ensure_public: def_id = {:?}", def_id);
let node_id = self.tcx.map.as_local_node_id(def_id).unwrap(); In particular, I used an unwrap when converting to a local node-id because the original code accessed the But I'm trying now to figure out what is SUPPOSED to happen here. I still don't quite understand the flow of this code. In particular I don't know what |
Probably the right fix is just to keep the let def_id = source_did.unwrap_or(to_check);
debug!("ensure_public: def_id = {:?}", def_id);
let node_id = self.tcx.map.as_local_node_id(def_id);
let (err_span, err_msg) = if Some(id) == node_id { |
`as_local_node_id`, instead just compare against `Some(id)`. Fixes rust-lang#29161.
Trying to make the test case now.
The text was updated successfully, but these errors were encountered: