Fix emission of niche-filling discriminant values#55701
Merged
bors merged 1 commit intorust-lang:masterfrom Nov 12, 2018
Merged
Fix emission of niche-filling discriminant values#55701bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
Bug rust-lang#55606 points out a regression introduced by rust-lang#54004; namely that an assertion can erroneously fire when a niche-filling discriminant value is emitted. This fixes the bug by removing the assertion, and furthermore by arranging for the discriminant value to be masked according to the size of the niche. This makes handling the discriminant a bit simpler for debuggers. The test case is from Jonathan Turner. Closes rust-lang#55606
Contributor
|
(rust_highfive has picked a reviewer for you, use r? to override) |
| // CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i64 0{{[,)].*}} | ||
|
|
||
| #![feature(never_type)] | ||
| #![feature(nll)] |
Contributor
There was a problem hiding this comment.
This appears to be unnecessary
Contributor
|
@bors r+ |
Collaborator
|
📌 Commit 4d20dd4 has been approved by |
bors
added a commit
that referenced
this pull request
Nov 12, 2018
Fix emission of niche-filling discriminant values Bug #55606 points out a regression introduced by #54004; namely that an assertion can erroneously fire when a niche-filling discriminant value is emitted. This fixes the bug by removing the assertion, and furthermore by arranging for the discriminant value to be masked according to the size of the niche. This makes handling the discriminant a bit simpler for debuggers. The test case is from Jonathan Turner. Closes #55606
Collaborator
Collaborator
|
☀️ Test successful - status-appveyor, status-travis |
eddyb
reviewed
Mar 28, 2019
| .wrapping_add(niche_start); | ||
| assert_eq!(niche as u64 as u128, niche); | ||
| Some(niche as u64) | ||
| let value = value & ((1u128 << niche.value.size(cx).bits()) - 1); |
Member
There was a problem hiding this comment.
Removing the assert is wrong, because you're throwing away bits just below!
After this change, assert_eq!(value as u64 as u128, value); should be between the truncation (let value = value & ...;) and the lossy cast (value as u64).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug #55606 points out a regression introduced by #54004; namely that
an assertion can erroneously fire when a niche-filling discriminant
value is emitted.
This fixes the bug by removing the assertion, and furthermore by
arranging for the discriminant value to be masked according to the
size of the niche. This makes handling the discriminant a bit simpler
for debuggers.
The test case is from Jonathan Turner.
Closes #55606