-
Notifications
You must be signed in to change notification settings - Fork 292
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
segfault at HashMap.get #552
Comments
Is it reproducible with the current Rust 1.81.0 toolchain? That will also be using the latest |
OK, let me try it. |
NOT reproducible on Rust 1.81.0~ Do we have any fixes on this? Why? |
I don't know what in particular may have fixed it. If you share your code and reproduction steps, I may be able to investigate, but generally speaking only the current version will receive any support. You could also try cargo-bisect-rustc to look for the exact toolchain change where the problem went away. |
Is the I use When I glanced at the contains_key source code, it looks same as hashmap.get but haven't the reference of the value. 1163 pub fn contains_key<Q: ?Sized>(&self, k: &Q) → bool
1164 where
1165 K: Borrow<Q>,
1166 Q: Hash + Eq,
1167 {
1168 self.get_inner(k).is_some()
1169 }
the hashmap get which inside rust 1.81.0 also haven't the reference of the value
```rust
1308 pub fn get<Q: ?Sized>(&self, k: &Q) → Option<&V>
1309 where
1310 Q: Hash + Equivalent<K>,
1311 {
1312 // Avoid `Option::map` because it bloats LLVM IR.
1313 match self.get_inner(k) {
1314 Some((_, v)) ⇒ Some(v), <<<------
1315 None ⇒ None,
1316 }
1317 }
the hashap get which inside rust 1.60.0
```rust
1049 pub fn get<Q: ?Sized>(&self, k: &Q) → Option<&V>
1050 where
1051 K: Borrow<Q>,
1052 Q: Hash + Eq,
1053 {
1054 // Avoid `Option::map` because it bloats LLVM IR.
1055 match self.get_inner(k) {
1056 Some(&(_, ref v)) ⇒ Some(v), <<<----
1057 None ⇒ None,
1058 }
1059 } |
That sounds like it may be a miscompilation by
The references should be identical. Since Here's a demo that the MIR is the same for either style of pattern: https://rust.godbolt.org/z/hMzjnccja |
We're on going to upgrade to 1.81.0. In order to push 1.81.0 upgrading, we should find the rootcause , testing, and production ready. |
I'm following your guide to build rust compiler to bisect the rustc which custom build HashMap and failed to build.
|
|
rust toolchain 1.60.0 glibc 2.32-1.4 with gnu build hashbrown 0.12.0
Tasks
The text was updated successfully, but these errors were encountered: