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 17 pull requests #106006

Closed
wants to merge 47 commits into from
Closed
Changes from 3 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
46f6e39
add assert messages if chunks/windows are length 0
raffimolero Dec 12, 2022
1588944
interpret: add read_machine_[ui]size convenience methods
RalfJung Dec 12, 2022
8b2a7da
Rename `assert_uninit_valid` intrinsic
Noratrieb Dec 12, 2022
7f94389
str.lines() docstring: clarify that line endings are not returned
zacchiro Dec 17, 2022
ee1a905
Fix arch flag on i686-apple-darwin
MarcusCalhoun-Lopez Dec 19, 2022
a213bb3
implement the skeleton of the updated trait solver
lcnr Dec 4, 2022
55c4164
Correct ModFlagBehavior for Aarch64 on LLVM-15
MasterAwesome Dec 20, 2022
750bf36
dedup assembly
lcnr Dec 19, 2022
082ca1e
docs: add long error explanation for error E0472
Ezrashaw Dec 16, 2022
b859b8b
Bump `cfg-if` to `1.0`
ChrisDenton Dec 20, 2022
8b5a96e
Some tracing cleanups
oli-obk Dec 19, 2022
562d846
Make it easier to debug where a region error was created
oli-obk Dec 19, 2022
8b15302
Replace a `find` with a loop to simplify the logic.
oli-obk Dec 19, 2022
e405dab
Some style nits
oli-obk Dec 19, 2022
c9588d5
Hackily fix an opaque type ICE
oli-obk Dec 19, 2022
f1ef038
use `track_caller` to show where the panic is actually from
oli-obk Nov 30, 2022
872a6da
Remove an unused function
oli-obk Oct 6, 2022
c787de3
Fix some `~const` usage in libcore
oli-obk Oct 11, 2022
b0ed631
Some hir cleanups
oli-obk Nov 10, 2022
b2b859b
Some track_caller additions
oli-obk Oct 12, 2022
fedcc73
tracing: make flag checking less noisy
oli-obk Oct 11, 2022
ed61be6
Some ICE debugging aids
oli-obk Sep 21, 2022
168e3da
rustdoc: prevent CSS layout of line numbers shrinking into nothing
notriddle Dec 20, 2022
1c5b53b
Avoid going through the happy path in case of non-fn builtin calls
oli-obk Dec 20, 2022
b29a9e3
rustdoc: simplify section anchor CSS
notriddle Dec 20, 2022
5480ac5
Use `Error` behavior for LLVM versions prior to 15
MasterAwesome Dec 20, 2022
fb89ae4
Remove unused `check-stage2-T-arm-linux-androideabi-H-x86_64-unknown-…
jyn514 Dec 20, 2022
f5e776c
Refer to "Waker" rather than "RawWaker" in `drop` comment
goffrie Dec 20, 2022
5538c92
Fix typo in reading_half_a_pointer.rs
eltociear Dec 21, 2022
6f21ba4
less specific wording
RalfJung Dec 21, 2022
7ce7169
Rollup merge of #105584 - raffimolero:patch-1, r=JohnTitor
fee1-dead Dec 21, 2022
6d12349
Rollup merge of #105602 - RalfJung:read-convenience, r=oli-obk
fee1-dead Dec 21, 2022
944c0f9
Rollup merge of #105613 - Nilstrieb:rename-assert_uninit_valid, r=Ral…
fee1-dead Dec 21, 2022
a6d2e34
Rollup merge of #105661 - lcnr:evaluate-new, r=compiler-errors
fee1-dead Dec 21, 2022
0d92836
Rollup merge of #105791 - Ezrashaw:add-e0472-long-docs, r=GuillaumeGomez
fee1-dead Dec 21, 2022
7bdef9e
Rollup merge of #105824 - zacchiro:patch-1, r=JohnTitor
fee1-dead Dec 21, 2022
a270e40
Rollup merge of #105897 - oli-obk:tait_patterns, r=TaKO8Ki
fee1-dead Dec 21, 2022
0e25271
Rollup merge of #105904 - MarcusCalhoun-Lopez:darwin_arch_i386, r=bjorn3
fee1-dead Dec 21, 2022
a8e3c7f
Rollup merge of #105932 - MasterAwesome:aarch64-bti-llvm-15, r=nikic
fee1-dead Dec 21, 2022
6bc6dcb
Rollup merge of #105949 - ChrisDenton:bump-cfg-if, r=Nilstrieb
fee1-dead Dec 21, 2022
4f90c56
Rollup merge of #105960 - oli-obk:effect_cleanup, r=fee1-dead
fee1-dead Dec 21, 2022
a9047a1
Rollup merge of #105964 - notriddle:notriddle/scraped-example-length,…
fee1-dead Dec 21, 2022
4cfdd16
Rollup merge of #105972 - notriddle:notriddle/anchor, r=GuillaumeGomez
fee1-dead Dec 21, 2022
e20a166
Rollup merge of #105973 - oli-obk:simplify_callee_checks, r=jackh726
fee1-dead Dec 21, 2022
3ca1bb0
Rollup merge of #105976 - jyn514:unused-make-targets, r=Mark-Simulacrum
fee1-dead Dec 21, 2022
200ddcb
Rollup merge of #105980 - goffrie:waker-drop, r=thomcc
fee1-dead Dec 21, 2022
3f51a54
Rollup merge of #105986 - eltociear:patch-18, r=RalfJung
fee1-dead Dec 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
@@ -644,7 +644,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let res = CValue::by_val(res, arg.layout());
ret.write_cvalue(fx, res);
}
sym::assert_inhabited | sym::assert_zero_valid | sym::assert_uninit_valid => {
sym::assert_inhabited | sym::assert_zero_valid | sym::assert_mem_uninitialized_valid => {
intrinsic_args!(fx, args => (); intrinsic);

let layout = fx.layout_of(substs.type_at(0));
@@ -673,7 +673,9 @@ fn codegen_regular_intrinsic_call<'tcx>(
return;
}

if intrinsic == sym::assert_uninit_valid && !fx.tcx.permits_uninit_init(layout) {
if intrinsic == sym::assert_mem_uninitialized_valid
&& !fx.tcx.permits_uninit_init(layout)
{
with_no_trimmed_paths!({
crate::base::codegen_panic(
fx,
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_ssa/src/mir/block.rs
Original file line number Diff line number Diff line change
@@ -663,12 +663,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
enum AssertIntrinsic {
Inhabited,
ZeroValid,
UninitValid,
MemUninitializedValid,
}
let panic_intrinsic = intrinsic.and_then(|i| match i {
sym::assert_inhabited => Some(AssertIntrinsic::Inhabited),
sym::assert_zero_valid => Some(AssertIntrinsic::ZeroValid),
sym::assert_uninit_valid => Some(AssertIntrinsic::UninitValid),
sym::assert_mem_uninitialized_valid => Some(AssertIntrinsic::MemUninitializedValid),
_ => None,
});
if let Some(intrinsic) = panic_intrinsic {
@@ -679,7 +679,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let do_panic = match intrinsic {
Inhabited => layout.abi.is_uninhabited(),
ZeroValid => !bx.tcx().permits_zero_init(layout),
UninitValid => !bx.tcx().permits_uninit_init(layout),
MemUninitializedValid => !bx.tcx().permits_uninit_init(layout),
};
Some(if do_panic {
let msg_str = with_no_visible_paths!({
6 changes: 4 additions & 2 deletions compiler/rustc_const_eval/src/interpret/intrinsics.rs
Original file line number Diff line number Diff line change
@@ -428,7 +428,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
sym::transmute => {
self.copy_op(&args[0], dest, /*allow_transmute*/ true)?;
}
sym::assert_inhabited | sym::assert_zero_valid | sym::assert_uninit_valid => {
sym::assert_inhabited
| sym::assert_zero_valid
| sym::assert_mem_uninitialized_valid => {
let ty = instance.substs.type_at(0);
let layout = self.layout_of(ty)?;

@@ -460,7 +462,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
}
}

if intrinsic_name == sym::assert_uninit_valid {
if intrinsic_name == sym::assert_mem_uninitialized_valid {
let should_panic = !self.tcx.permits_uninit_init(layout);

if should_panic {
8 changes: 4 additions & 4 deletions compiler/rustc_hir_analysis/src/check/intrinsic.rs
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ pub fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: DefId) -> hir
sym::abort
| sym::assert_inhabited
| sym::assert_zero_valid
| sym::assert_uninit_valid
| sym::assert_mem_uninitialized_valid
| sym::size_of
| sym::min_align_of
| sym::needs_drop
@@ -193,9 +193,9 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
}
sym::rustc_peek => (1, vec![param(0)], param(0)),
sym::caller_location => (0, vec![], tcx.caller_location_ty()),
sym::assert_inhabited | sym::assert_zero_valid | sym::assert_uninit_valid => {
(1, Vec::new(), tcx.mk_unit())
}
sym::assert_inhabited
| sym::assert_zero_valid
| sym::assert_mem_uninitialized_valid => (1, Vec::new(), tcx.mk_unit()),
sym::forget => (1, vec![param(0)], tcx.mk_unit()),
sym::transmute => (2, vec![param(0)], param(1)),
sym::prefetch_read_data
2 changes: 1 addition & 1 deletion compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
@@ -376,9 +376,9 @@ symbols! {
assert_eq_macro,
assert_inhabited,
assert_macro,
assert_mem_uninitialized_valid,
assert_ne_macro,
assert_receiver_is_total_eq,
assert_uninit_valid,
assert_zero_valid,
asserting,
associated_const_equality,
6 changes: 3 additions & 3 deletions library/core/src/intrinsics.rs
Original file line number Diff line number Diff line change
@@ -959,13 +959,13 @@ extern "rust-intrinsic" {
#[rustc_safe_intrinsic]
pub fn assert_zero_valid<T>();

/// A guard for unsafe functions that cannot ever be executed if `T` has invalid
/// bit patterns: This will statically either panic, or do nothing.
/// A guard for `std::mem::uninitialized`. This will statically either panic, or do nothing.
///
/// This intrinsic does not have a stable counterpart.
#[rustc_const_unstable(feature = "const_assert_type2", issue = "none")]
#[rustc_safe_intrinsic]
pub fn assert_uninit_valid<T>();
#[cfg(not(bootstrap))]
pub fn assert_mem_uninitialized_valid<T>();

/// Gets a reference to a static `Location` indicating where it was called.
///
3 changes: 2 additions & 1 deletion library/core/src/mem/mod.rs
Original file line number Diff line number Diff line change
@@ -682,7 +682,8 @@ pub unsafe fn zeroed<T>() -> T {
pub unsafe fn uninitialized<T>() -> T {
// SAFETY: the caller must guarantee that an uninitialized value is valid for `T`.
unsafe {
intrinsics::assert_uninit_valid::<T>();
#[cfg(not(bootstrap))] // If the compiler hits this itself then it deserves the UB.
intrinsics::assert_mem_uninitialized_valid::<T>();
let mut val = MaybeUninit::<T>::uninit();

// Fill memory with 0x01, as an imperfect mitigation for old code that uses this function on
2 changes: 1 addition & 1 deletion src/test/ui/consts/assert-type-intrinsics.rs
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ fn main() {
//~^ERROR: evaluation of constant value failed
};
const _BAD2: () = {
intrinsics::assert_uninit_valid::<&'static i32>();
intrinsics::assert_mem_uninitialized_valid::<&'static i32>();
//~^ERROR: evaluation of constant value failed
};
const _BAD3: () = {
4 changes: 2 additions & 2 deletions src/test/ui/consts/assert-type-intrinsics.stderr
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@ LL | MaybeUninit::<!>::uninit().assume_init();
error[E0080]: evaluation of constant value failed
--> $DIR/assert-type-intrinsics.rs:16:9
|
LL | intrinsics::assert_uninit_valid::<&'static i32>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to leave type `&i32` uninitialized, which is invalid
LL | intrinsics::assert_mem_uninitialized_valid::<&'static i32>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to leave type `&i32` uninitialized, which is invalid

error[E0080]: evaluation of constant value failed
--> $DIR/assert-type-intrinsics.rs:20:9