Skip to content
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

Rollup of 7 pull requests #86226

Merged
merged 17 commits into from
Jun 12, 2021
Merged

Rollup of 7 pull requests #86226

merged 17 commits into from
Jun 12, 2021

Conversation

JohnTitor
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

BoxyUwU and others added 15 commits May 29, 2021 03:54
also add tests for these 2 kinds of errors for size and alignment,
as the existing size check wasn't apparently tested
…tics, r=oli-obk

Fix some diagnostic issues with const_generics_defaults feature gate

This PR makes a few changes:
- print out const param defaults in "lifetime ordering" errors rather than discarding them
- update `is_simple_text` to account for const params when checking if a type has no generics, this was causing a note to be failed to add to an error message
- fixes some diagnostic wording that incorrectly said there was ordering restrictions between type/const params despite the `const_generics_defaults` feature gate is active
Do not suggest ampmut if rhs is already mutable

Removes invalid suggestion in rust-lang#85765, although it should highlight the user type instead of the local variable.

Looking at the comments of this line:
https://github.com/rust-lang/rust/blob/84b1005bfd22e2cb2a4c13b0b81958fe72628354/compiler/rustc_mir_build/src/build/matches/mod.rs#L2107

It was intentionally set to `None`, causing it to highlight the local variable instead. I am not sure if I will be able to fix it.

Fixes rust-lang#85765
Detect incorrect vtable alignment during const eval

This PR fixes rust-lang#86132 by detecting invalid alignment values for trait objects in the interpreter, and emitting an error about this conversion failure, to avoid the ICE.

I've noticed that the error emitted at https://github.com/rust-lang/rust/blob/a50d72158e08e02cfc051b863017bdbd2c45b637/compiler/rustc_mir/src/interpret/traits.rs#L163-L166 doesn't seem to be present in the const-ub tests, so I've tried adding a test that triggers both of these cases: one for the invalid size, and another for the invalid alignment that rust-lang#86132 tracks (I have found different magic values triggering different `Align::from_bytes` errors than the "power of 2" one, if need be).

However, when doing that, I *cannot* for the life of me figure out the correct incantation to make these 2 errors trigger with the "it is undefined behavior to use this value" message rather than the "any use of this value will cause an error" lint.

I've tried Oli's suggestions of different values, tuples and arrays, using the transparent wrapper trick from the other tests and I was only able to trigger the regular const-ub errors about the size of the vtable, or that the drop pointer was invalid. Maybe these "type validation failed" errors happen before this part of the interpreter is reached and there just needs some magic incorrect values to bypass them, I don't know.

Since this fixes an ICE, and if the constants are indeed used, these 2 tests will turn into a hard error, I thought I'd open the PR anyways. And if ```@RalfJung``` you know of a way I could manage that (if you think that these tests are worth checking that the `throw_ub_format!` does indeed create const-ub errors as we expect) I'd be grateful.

For that reason, r? ```@RalfJung``` and cc ```@oli-obk.```
Make `relate_type_and_mut` public

rust-lang#85343 improved diagnostics around `Relate` impls but made `relate_type_and_mut` private, which was accessible as `relate` previously. This makes it public so that we can use it on rust-semverver.

r? ```@Aaron1011```
…i-obk

Run full const-generics test for issue-72293

Closes rust-lang#72293
r? ```@oli-obk```
@rustbot rustbot added the rollup A PR which is a rollup label Jun 11, 2021
@JohnTitor
Copy link
Member Author

@bors r+ p=7 rollup=never

@bors
Copy link
Contributor

bors commented Jun 11, 2021

📌 Commit e13b53e has been approved by JohnTitor

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jun 11, 2021
@bors
Copy link
Contributor

bors commented Jun 11, 2021

⌛ Testing commit e13b53e with merge 6c4efce5c40629caacc087e31168300377606451...

@bors
Copy link
Contributor

bors commented Jun 11, 2021

💥 Test timed out

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 11, 2021
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@JohnTitor
Copy link
Member Author

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 11, 2021
@bors
Copy link
Contributor

bors commented Jun 12, 2021

⌛ Testing commit e13b53e with merge 3198c52...

@bors
Copy link
Contributor

bors commented Jun 12, 2021

☀️ Test successful - checks-actions
Approved by: JohnTitor
Pushing 3198c52 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 12, 2021
@bors bors merged commit 3198c52 into rust-lang:master Jun 12, 2021
@rustbot rustbot added this to the 1.54.0 milestone Jun 12, 2021
@JohnTitor JohnTitor deleted the rollup-5ubdolf branch June 12, 2021 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants