-
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
Rollup of 5 pull requests #95624
Commits on Apr 1, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 0df84cd - Browse repository at this point
Copy the full SHA 0df84cdView commit details -
Configuration menu - View commit details
-
Copy full SHA for bf26d87 - Browse repository at this point
Copy the full SHA bf26d87View commit details
Commits on Apr 3, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 78698dd - Browse repository at this point
Copy the full SHA 78698ddView commit details -
Configuration menu - View commit details
-
Copy full SHA for 995513c - Browse repository at this point
Copy the full SHA 995513cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9d4d5a4 - Browse repository at this point
Copy the full SHA 9d4d5a4View commit details -
Configuration menu - View commit details
-
Copy full SHA for ccff48f - Browse repository at this point
Copy the full SHA ccff48fView commit details -
Configuration menu - View commit details
-
Copy full SHA for ce61d40 - Browse repository at this point
Copy the full SHA ce61d40View commit details -
Configuration menu - View commit details
-
Copy full SHA for c16a558 - Browse repository at this point
Copy the full SHA c16a558View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1a1f5b8 - Browse repository at this point
Copy the full SHA 1a1f5b8View commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for f4a7ed4 - Browse repository at this point
Copy the full SHA f4a7ed4View commit details -
Rollup merge of rust-lang#95202 - Urgau:check-cfg-perf-well-known-val…
…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)
Configuration menu - View commit details
-
Copy full SHA for 796bc7e - Browse repository at this point
Copy the full SHA 796bc7eView commit details -
Rollup merge of rust-lang#95553 - jam1garner:naked-function-compile-e…
…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".
Configuration menu - View commit details
-
Copy full SHA for 19a90c7 - Browse repository at this point
Copy the full SHA 19a90c7View commit details -
Rollup merge of rust-lang#95613 - GuillaumeGomez:fix-rustdoc-attr-dis…
…play, r=notriddle Fix rustdoc attribute display Fixes rust-lang#81482. r? `@notriddle`
Configuration menu - View commit details
-
Copy full SHA for 5925c8e - Browse repository at this point
Copy the full SHA 5925c8eView commit details -
Rollup merge of rust-lang#95617 - saethlin:swap-test-invalidation, r=…
…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 ```
Configuration menu - View commit details
-
Copy full SHA for f7f2d83 - Browse repository at this point
Copy the full SHA f7f2d83View commit details -
Rollup merge of rust-lang#95618 - adamse:master, r=dtolnay
core: document that the align_of* functions return the alignment in bytes
Configuration menu - View commit details
-
Copy full SHA for 1ea6e93 - Browse repository at this point
Copy the full SHA 1ea6e93View commit details