-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 5 pull requests #95624
Merged
Merged
Rollup of 5 pull requests #95624
Conversation
This file contains 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
Under Stacked Borrows with raw pointer tagging, the previous code was UB because the code which creates the the second pointer borrows the array through a tag in the borrow stacks below the Unique tag that our first pointer is based on, thus invalidating the first pointer. This is not definitely a bug and may never be real UB, but I desperately want people to write code that conforms to SB with raw pointer tagging so that I can write good diagnostics. The alternative aliasing models aren't possible to diagnose well due to state space explosion. Therefore, it would be super cool if the standard library nudged people towards writing code that is valid with respect to SB with raw pointer tagging.
…ues, r=petrochenkov Reduce the cost of loading all built-ins targets This PR started by measuring the exact slowdown of checking of well known conditional values. Than this PR implemented some technics to reduce the cost of loading all built-ins targets. cf. rust-lang#82450 (comment)
…rror, r=tmiasko Don't emit non-asm contents error for naked function composed of errors ## Motivation For naked functions an error is emitted when they are composed of anything other than a single asm!() block. However, this error triggers in a couple situations in which it adds no additional information or is actively misleading. One example is if you do have an asm!() block but simply one with a syntax error: ```rust #[naked] unsafe extern "C" fn compiler_errors() { asm!(invalid_syntax) } ``` This results in two errors, one for the syntax error itself and another telling you that you need an asm block in your function: ```rust error[E0787]: naked functions must contain a single asm block --> src/main.rs:6:1 | 6 | / unsafe extern "C" fn naked_compile_error() { 7 | | asm!(blah) 8 | | } | |_^ ``` This issue also comes up when [utilizing `compile_error!()` for improving your diagnostics](https://twitter.com/steveklabnik/status/1509538243020218372), such as raising a compiler error when compiling for an unsupported target. ## Implementation The rules this PR implements are as follows: 1. If any non-erroneous non-asm statement is included, an error will still occur 2. If multiple asm statements are included, an error will still occur 3. If 0 or 1 asm statements are present, as well as any non-zero number of erroneous statements, then this error will *not* be raised as it is likely either redundant or incorrect The rule of thumb is effectively "if an error is present and its correction could change things, don't raise an error".
…play, r=notriddle Fix rustdoc attribute display Fixes rust-lang#81482. r? `@notriddle`
…Dylan-DPC Fix &mut invalidation in ptr::swap doctest Under Stacked Borrows with raw pointer tagging, the previous code was UB because the code which creates the the second pointer borrows the array through a tag in the borrow stacks below the Unique tag that our first pointer is based on, thus invalidating the first pointer. This is not definitely a bug and may never be real UB, but I desperately want people to write code that conforms to SB with raw pointer tagging so that I can write good diagnostics. The alternative aliasing models aren't possible to diagnose well due to state space explosion. Therefore, it would be super cool if the standard library nudged people towards writing code that is valid with respect to SB with raw pointer tagging. The diagnostics that I want to write are implemented in a branch of Miri and the one for this case is below: ``` error: Undefined Behavior: attempting a read access using <2170> at alloc1068[0x0], but that tag does not exist in the borrow stack for this location --> /home/ben/rust/library/core/src/intrinsics.rs:2103:14 | 2103 | unsafe { copy_nonoverlapping(src, dst, count) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | attempting a read access using <2170> at alloc1068[0x0], but that tag does not exist in the borrow stack for this location | this error occurs as part of an access at alloc1068[0x0..0x8] | = help: this indicates a potential bug in the program: it performed an invalid operation, but the rules it violated are still experimental = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information help: <2170> was created due to a retag at offsets [0x0..0x10] --> ../libcore/src/ptr/mod.rs:640:9 | 8 | let x = array[0..].as_mut_ptr() as *mut [u32; 2]; // this is `array[0..2]` | ^^^^^^^^^^^^^^^^^^^^^^^ help: <2170> was later invalidated due to a retag at offsets [0x0..0x10] --> ../libcore/src/ptr/mod.rs:641:9 | 9 | let y = array[2..].as_mut_ptr() as *mut [u32; 2]; // this is `array[2..4]` | ^^^^^ = note: inside `std::intrinsics::copy_nonoverlapping::<[u32; 2]>` at /home/ben/rust/library/core/src/intrinsics.rs:2103:14 = note: inside `std::ptr::swap::<[u32; 2]>` at /home/ben/rust/library/core/src/ptr/mod.rs:685:9 note: inside `main::_doctest_main____libcore_src_ptr_mod_rs_635_0` at ../libcore/src/ptr/mod.rs:12:5 --> ../libcore/src/ptr/mod.rs:644:5 | 12 | ptr::swap(x, y); | ^^^^^^^^^^^^^^^ note: inside `main` at ../libcore/src/ptr/mod.rs:15:3 --> ../libcore/src/ptr/mod.rs:647:3 | 15 | } _doctest_main____libcore_src_ptr_mod_rs_635_0() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace error: aborting due to previous error ```
core: document that the align_of* functions return the alignment in bytes
rustbot
added
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
rollup
A PR which is a rollup
labels
Apr 3, 2022
@bors r+ rollup=never p=5 |
📌 Commit 1ea6e93 has been approved by |
bors
added
the
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
label
Apr 3, 2022
☀️ Test successful - checks-actions |
rust-highfive
added a commit
to rust-lang-nursery/rust-toolstate
that referenced
this pull request
Apr 3, 2022
Tested on commit rust-lang/rust@6af09d2. Direct link to PR: <rust-lang/rust#95624> 💔 miri on windows: test-pass → build-fail (cc @eddyb @RalfJung @oli-obk). 💔 miri on linux: test-pass → build-fail (cc @eddyb @RalfJung @oli-obk).
Finished benchmarking commit (6af09d2): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
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.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
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.
Successful merges:
Failed merges:
r? @ghost
@rustbot modify labels: rollup
Create a similar rollup