-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Fix miri Discriminant() for non-ADT #49540
Conversation
} | ||
layout::Variants::Tagged { ref variants, .. } | | ||
layout::Variants::NicheFilling { ref variants, .. } => { | ||
if variants.get(discr_val as usize).is_none() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discriminants and variant indices don't match. You also need to adjust read_discriminant_value
to return the variant index (so a usize) and adjust all calls to it to stop doing weird magic. In case of tagged encoding you always need to iterate like the old code did, but we should be doing so inside read_discriminant_value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed it too
Your PR failed on Travis. Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nit.
Also please squash the commits down to a single one
layout::Variants::Tagged { ref discr, .. } => { | ||
if let ty::TyAdt(adt_def, _) = ty.sty { | ||
let raw_discr = raw_discr.to_bytes()?; | ||
println!("Read discriminant {}, valid discriminants {:?}", raw_discr, adt_def.discriminants(*self.tcx).collect::<Vec<_>>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change this to a trace!
call
8267032
to
cd7fafe
Compare
This is ready. Locally I have one miri run-pass test failing with a different error 🎊 |
cd7fafe
to
7a28ffc
Compare
@bors r+ |
📌 Commit 7a28ffc has been approved by |
⌛ Testing commit 7a28ffc with merge 7586c9471cb9f02357aa9cde09a92363205daa77... |
💔 Test failed - status-travis |
Your PR failed on Travis. Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
1 similar comment
Your PR failed on Travis. Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
ping @oli-obk test timeout |
@bors retry |
…-obk Fix miri Discriminant() for non-ADT Fixes rust-lang#49327
Rollup of 25 pull requests Successful merges: - #49179 (Handle future deprecation annotations ) - #49512 (Add support for variant and types fields for intra links) - #49515 (fix targetted value background) - #49516 (Add missing anchor for union type fields) - #49532 (Add test for rustdoc ignore test) - #49533 (Add #[must_use] to a few standard library methods) - #49540 (Fix miri Discriminant() for non-ADT) - #49559 (Introduce Vec::resize_with method (see #41758)) - #49570 (avoid IdxSets containing garbage above the universe length) - #49577 (Stabilize String::replace_range) - #49599 (Fix typo) - #49603 (Fix url for intra link provided method) - #49607 (Stabilize iterator methods in 1.27) - #49609 (run-pass/attr-stmt-expr: expand test cases) - #49612 (Fix "since" version for getpid feature.) - #49618 (Fix build error when compiling libcore for 16bit targets) - #49619 (tweak core::fmt docs) - #49637 (Stabilize parent_id()) - #49639 (Update Cargo) - #49628 (Re-write the documentation index) - #49594 (Add some performance guidance to std::fs and std::io docs) - #49625 (miri: add public alloc_kind accessor) - #49634 (Add a test for the fix to issue #43058) - #49641 (Regression test for #46314) - #49547 (Unignore borrowck test) Failed merges:
Fixes #49327