Skip to content

Commit af23ad9

Browse files
committed
Improve comments
1 parent 645c0fd commit af23ad9

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

compiler/rustc_ty_utils/src/abi.rs

-6
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ fn adjust_for_rust_scalar<'tcx>(
219219
return;
220220
}
221221

222-
// Scalars which have invalid values cannot be undef.
223222
if !scalar.is_uninit_valid() {
224223
attrs.set(ArgAttribute::NoUndef);
225224
}
@@ -246,11 +245,6 @@ fn adjust_for_rust_scalar<'tcx>(
246245
PointerKind::SharedMutable | PointerKind::UniqueOwned => Size::ZERO,
247246
};
248247

249-
// `Box`, `&T`, and `&mut T` cannot be undef.
250-
// Note that this only applies to the value of the pointer itself;
251-
// this attribute doesn't make it UB for the pointed-to data to be undef.
252-
attrs.set(ArgAttribute::NoUndef);
253-
254248
// The aliasing rules for `Box<T>` are still not decided, but currently we emit
255249
// `noalias` for it. This can be turned off using an unstable flag.
256250
// See https://github.com/rust-lang/unsafe-code-guidelines/issues/326

tests/codegen/loads.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub fn load_scalar_pair<'a>(x: &(&'a i32, &'a Align16)) -> (&'a i32, &'a Align16
5050
// CHECK-LABEL: @load_raw_pointer
5151
#[no_mangle]
5252
pub fn load_raw_pointer<'a>(x: &*const i32) -> *const i32 {
53-
// loaded raw pointer should not have !nonnull, !align, or !noundef metadata
53+
// loaded raw pointer should not have !nonnull or !align metadata
5454
// CHECK: load {{i32\*|ptr}}, {{i32\*\*|ptr}} %x, align [[PTR_ALIGNMENT]], !noundef !2{{$}}
5555
*x
5656
}

0 commit comments

Comments
 (0)