Skip to content

Commit 04bc624

Browse files
committed
rebless after rebase
1 parent 77f8c3c commit 04bc624

11 files changed

+36
-2
lines changed

tests/ui/asm/x86_64/type-check-4.stderr

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LL | global_asm!("{}", const S);
66
|
77
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
88
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
910
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
1011
= help: to fix this, the value can be extracted to a `const` and then used.
1112

@@ -17,6 +18,7 @@ LL | global_asm!("{}", const const_foo(S));
1718
|
1819
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
1920
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
21+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2022
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
2123
= help: to fix this, the value can be extracted to a `const` and then used.
2224

@@ -28,6 +30,7 @@ LL | global_asm!("{}", const const_bar(S));
2830
|
2931
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
3032
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
33+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3134
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
3235
= help: to fix this, the value can be extracted to a `const` and then used.
3336

tests/ui/consts/const-fn-not-safe-for-const.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ LL | Y
1414
|
1515
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
1616
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
17+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1718
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
1819
= help: to fix this, the value can be extracted to a `const` and then used.
1920

@@ -25,6 +26,7 @@ LL | &Y
2526
|
2627
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
2728
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
29+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2830
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
2931
= help: to fix this, the value can be extracted to a `const` and then used.
3032

tests/ui/consts/const_refs_to_static_fail_invalid.rs

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ fn mutable() {
3838
const C: &i32 = unsafe { &S_MUT };
3939
//~^ERROR: undefined behavior
4040
//~| encountered reference to mutable memory
41+
//~| WARN shared reference of mutable static is discouraged
4142

4243
// This *must not build*, the constant we are matching against
4344
// could change its value!

tests/ui/consts/const_refs_to_static_fail_invalid.stderr

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
warning: shared reference of mutable static is discouraged
2+
--> $DIR/const_refs_to_static_fail_invalid.rs:38:30
3+
|
4+
LL | const C: &i32 = unsafe { &S_MUT };
5+
| ^^^^^^ shared reference of mutable static
6+
|
7+
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
8+
= note: reference of mutable static is a hard error from 2024 edition
9+
= note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
10+
= note: `#[warn(static_mut_ref)]` on by default
11+
help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
12+
|
13+
LL | const C: &i32 = unsafe { addr_of!(S_MUT) };
14+
| ~~~~~~~~~~~~~~~
15+
116
error[E0080]: it is undefined behavior to use this value
217
--> $DIR/const_refs_to_static_fail_invalid.rs:8:5
318
|
@@ -44,11 +59,11 @@ LL | const C: &i32 = unsafe { &S_MUT };
4459
}
4560

4661
error: could not evaluate constant pattern
47-
--> $DIR/const_refs_to_static_fail_invalid.rs:45:9
62+
--> $DIR/const_refs_to_static_fail_invalid.rs:46:9
4863
|
4964
LL | C => {},
5065
| ^
5166

52-
error: aborting due to 6 previous errors
67+
error: aborting due to 6 previous errors; 1 warning emitted
5368

5469
For more information about this error, try `rustc --explain E0080`.

tests/ui/consts/issue-17718-const-bad-values.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ LL | const C2: &'static mut usize = unsafe { &mut S };
2727
|
2828
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
2929
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
30+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3031
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
3132
= help: to fix this, the value can be extracted to a `const` and then used.
3233

@@ -38,6 +39,7 @@ LL | const C2: &'static mut usize = unsafe { &mut S };
3839
|
3940
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
4041
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
42+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4143
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
4244
= help: to fix this, the value can be extracted to a `const` and then used.
4345
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

tests/ui/consts/issue-17718-references.stderr

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LL | const T2: &'static usize = &S;
66
|
77
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
88
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
910
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
1011
= help: to fix this, the value can be extracted to a `const` and then used.
1112

@@ -17,6 +18,7 @@ LL | const T6: usize = S;
1718
|
1819
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
1920
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
21+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2022
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
2123
= help: to fix this, the value can be extracted to a `const` and then used.
2224

@@ -28,6 +30,7 @@ LL | const T10: Struct = Struct { a: S };
2830
|
2931
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
3032
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
33+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3134
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
3235
= help: to fix this, the value can be extracted to a `const` and then used.
3336

tests/ui/consts/issue-52060.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LL | static B: [u32; 1] = [0; A.len()];
66
|
77
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
88
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
910
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
1011
= help: to fix this, the value can be extracted to a `const` and then used.
1112

tests/ui/consts/min_const_fn/min_const_fn.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ LL | const fn foo25() -> u32 { BAR }
150150
|
151151
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
152152
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
153+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
153154
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
154155
= help: to fix this, the value can be extracted to a `const` and then used.
155156

@@ -161,6 +162,7 @@ LL | const fn foo26() -> &'static u32 { &BAR }
161162
|
162163
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
163164
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
165+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
164166
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
165167
= help: to fix this, the value can be extracted to a `const` and then used.
166168

tests/ui/feature-gates/feature-gate-const-refs-to-static.stderr

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LL | const C1: &i32 = &S;
66
|
77
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
88
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
910
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
1011
= help: to fix this, the value can be extracted to a `const` and then used.
1112

@@ -17,6 +18,7 @@ LL | const C2: *const i32 = unsafe { std::ptr::addr_of!(S_MUT) };
1718
|
1819
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
1920
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
21+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2022
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
2123
= help: to fix this, the value can be extracted to a `const` and then used.
2224

@@ -28,6 +30,7 @@ LL | const C2: *const i32 = unsafe { std::ptr::addr_of!(S_MUT) };
2830
|
2931
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
3032
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
33+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3134
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
3235
= help: to fix this, the value can be extracted to a `const` and then used.
3336
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

tests/ui/static/issue-18118-2.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LL | &p
66
|
77
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
88
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
910
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
1011
= help: to fix this, the value can be extracted to a `const` and then used.
1112

tests/ui/thread-local/thread-local-static.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2)
4545
|
4646
= note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information
4747
= help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable
48+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4849
= note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.
4950
= help: to fix this, the value can be extracted to a `const` and then used.
5051

0 commit comments

Comments
 (0)