Skip to content

Commit 34b2d52

Browse files
Centri3NCGThompson
authored andcommitted
Update MIRI comment and fix test in stage2
1 parent df236a5 commit 34b2d52

File tree

4 files changed

+19
-22
lines changed

4 files changed

+19
-22
lines changed

compiler/rustc_const_eval/src/const_eval/machine.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -531,11 +531,10 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
531531
)?;
532532
}
533533
}
534-
// The name of this intrinsic is actually misleading. It actually
535-
// represents whether the value is known to the optimizer (LLVM).
536-
// The value of `arg`, while known to the machine, should be
537-
// considered unknown to the optimizer as we haven't gotten to the
538-
// codegen stage or ran any sort of optimizations yet.
534+
// The intrinsic represents whether the value is known to the optimizer (LLVM).
535+
// We're not doing any optimizations here, so there is no optimizer that could know the value.
536+
// (We know the value here in the machine of course, but this is the runtime of that code,
537+
// not the optimization stage.)
539538
sym::is_val_statically_known => ecx.write_scalar(Scalar::from_bool(false), dest)?,
540539
_ => {
541540
throw_unsup_format!(

compiler/rustc_hir_analysis/messages.ftl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,6 @@ hir_analysis_invalid_union_field =
178178
hir_analysis_invalid_union_field_sugg =
179179
wrap the field type in `ManuallyDrop<...>`
180180
181-
hir_analysis_is_constant_zst = parameter for `is_constant` cannot be zero-sized
182-
183181
hir_analysis_late_bound_const_in_apit = `impl Trait` can only mention const parameters from an fn or impl
184182
.label = const parameter declared here
185183

tests/codegen/is_val_statically_known.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,39 @@ pub enum B {
99
}
1010

1111
#[inline]
12-
pub fn tuple_struct(a: A) -> i32 {
12+
pub fn _u32(a: u32) -> i32 {
1313
if unsafe { is_val_statically_known(a) } { 1 } else { 0 }
1414
}
1515

16-
// CHECK-LABEL: @tuple_struct_true(
16+
// CHECK-LABEL: @_u32_true(
1717
#[no_mangle]
18-
pub fn tuple_struct_true() -> i32 {
18+
pub fn _u32_true() -> i32 {
1919
// CHECK: ret i32 1
20-
tuple_struct(A(1))
20+
_u32(1)
2121
}
2222

23-
// CHECK-LABEL: @tuple_struct_false(
23+
// CHECK-LABEL: @_u32_false(
2424
#[no_mangle]
25-
pub fn tuple_struct_false(a: A) -> i32 {
25+
pub fn _u32_false(a: u32) -> i32 {
2626
// CHECK: ret i32 0
27-
tuple_struct(a)
27+
_u32(a)
2828
}
2929

3030
#[inline]
31-
pub fn r#enum(b: B) -> i32 {
31+
pub fn _bool(b: bool) -> i32 {
3232
if unsafe { is_val_statically_known(b) } { 3 } else { 2 }
3333
}
3434

35-
// CHECK-LABEL: @enum_true(
35+
// CHECK-LABEL: @_bool_true(
3636
#[no_mangle]
37-
pub fn enum_true() -> i32 {
37+
pub fn _bool_true() -> i32 {
3838
// CHECK: ret i32 3
39-
r#enum(B::Ye(2))
39+
_bool(true)
4040
}
4141

42-
// CHECK-LABEL: @enum_false(
42+
// CHECK-LABEL: @_bool_false(
4343
#[no_mangle]
44-
pub fn enum_false(b: B) -> i32 {
44+
pub fn _bool_false(b: bool) -> i32 {
4545
// CHECK: ret i32 2
46-
r#enum(b)
46+
_bool(b)
4747
}

tests/codegen/pow_of_two.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// compile-flags: --crate-type=lib
22

3-
// CHECK: @b = unnamed_addr alias i64 (i32), ptr @a
43
// CHECK-LABEL: @a(
54
#[no_mangle]
65
pub fn a(exp: u32) -> u64 {
@@ -11,6 +10,7 @@ pub fn a(exp: u32) -> u64 {
1110
2u64.pow(exp)
1211
}
1312

13+
// This is sometimes an alias to `a`, but this isn't guaranteed
1414
#[no_mangle]
1515
pub fn b(exp: u32) -> i64 {
1616
2i64.pow(exp)

0 commit comments

Comments
 (0)