diff options
| author | Ralf Jung <post@ralfj.de> | 2024-02-05 21:24:32 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-02-10 16:13:48 +0100 |
| commit | 04bc624ea0af4757e4464695193ba952e3c0951d (patch) | |
| tree | 286fc7eb3193e57c02d1fc7a3bb698e30d29d11b | |
| parent | 77f8c3caea901df51ef723251a7a58b27f96bb3a (diff) | |
| download | rust-04bc624ea0af4757e4464695193ba952e3c0951d.tar.gz rust-04bc624ea0af4757e4464695193ba952e3c0951d.zip | |
rebless after rebase
| -rw-r--r-- | tests/ui/asm/x86_64/type-check-4.stderr | 3 | ||||
| -rw-r--r-- | tests/ui/consts/const-fn-not-safe-for-const.stderr | 2 | ||||
| -rw-r--r-- | tests/ui/consts/const_refs_to_static_fail_invalid.rs | 1 | ||||
| -rw-r--r-- | tests/ui/consts/const_refs_to_static_fail_invalid.stderr | 19 | ||||
| -rw-r--r-- | tests/ui/consts/issue-17718-const-bad-values.stderr | 2 | ||||
| -rw-r--r-- | tests/ui/consts/issue-17718-references.stderr | 3 | ||||
| -rw-r--r-- | tests/ui/consts/issue-52060.stderr | 1 | ||||
| -rw-r--r-- | tests/ui/consts/min_const_fn/min_const_fn.stderr | 2 | ||||
| -rw-r--r-- | tests/ui/feature-gates/feature-gate-const-refs-to-static.stderr | 3 | ||||
| -rw-r--r-- | tests/ui/static/issue-18118-2.stderr | 1 | ||||
| -rw-r--r-- | tests/ui/thread-local/thread-local-static.stderr | 1 |
11 files changed, 36 insertions, 2 deletions
diff --git a/tests/ui/asm/x86_64/type-check-4.stderr b/tests/ui/asm/x86_64/type-check-4.stderr index fbca868c083..cbdc051b343 100644 --- a/tests/ui/asm/x86_64/type-check-4.stderr +++ b/tests/ui/asm/x86_64/type-check-4.stderr @@ -6,6 +6,7 @@ LL | global_asm!("{}", const S); | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. @@ -17,6 +18,7 @@ LL | global_asm!("{}", const const_foo(S)); | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. @@ -28,6 +30,7 @@ LL | global_asm!("{}", const const_bar(S)); | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. diff --git a/tests/ui/consts/const-fn-not-safe-for-const.stderr b/tests/ui/consts/const-fn-not-safe-for-const.stderr index 1793c734280..7d7e94da86f 100644 --- a/tests/ui/consts/const-fn-not-safe-for-const.stderr +++ b/tests/ui/consts/const-fn-not-safe-for-const.stderr @@ -14,6 +14,7 @@ LL | Y | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. @@ -25,6 +26,7 @@ LL | &Y | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. diff --git a/tests/ui/consts/const_refs_to_static_fail_invalid.rs b/tests/ui/consts/const_refs_to_static_fail_invalid.rs index ee20db6c6c0..bf52f884209 100644 --- a/tests/ui/consts/const_refs_to_static_fail_invalid.rs +++ b/tests/ui/consts/const_refs_to_static_fail_invalid.rs @@ -38,6 +38,7 @@ fn mutable() { const C: &i32 = unsafe { &S_MUT }; //~^ERROR: undefined behavior //~| encountered reference to mutable memory + //~| WARN shared reference of mutable static is discouraged // This *must not build*, the constant we are matching against // could change its value! diff --git a/tests/ui/consts/const_refs_to_static_fail_invalid.stderr b/tests/ui/consts/const_refs_to_static_fail_invalid.stderr index 56006f7ae25..35051557b61 100644 --- a/tests/ui/consts/const_refs_to_static_fail_invalid.stderr +++ b/tests/ui/consts/const_refs_to_static_fail_invalid.stderr @@ -1,3 +1,18 @@ +warning: shared reference of mutable static is discouraged + --> $DIR/const_refs_to_static_fail_invalid.rs:38:30 + | +LL | const C: &i32 = unsafe { &S_MUT }; + | ^^^^^^ shared reference of mutable static + | + = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447> + = note: reference of mutable static is a hard error from 2024 edition + = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior + = note: `#[warn(static_mut_ref)]` on by default +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 + | +LL | const C: &i32 = unsafe { addr_of!(S_MUT) }; + | ~~~~~~~~~~~~~~~ + error[E0080]: it is undefined behavior to use this value --> $DIR/const_refs_to_static_fail_invalid.rs:8:5 | @@ -44,11 +59,11 @@ LL | const C: &i32 = unsafe { &S_MUT }; } error: could not evaluate constant pattern - --> $DIR/const_refs_to_static_fail_invalid.rs:45:9 + --> $DIR/const_refs_to_static_fail_invalid.rs:46:9 | LL | C => {}, | ^ -error: aborting due to 6 previous errors +error: aborting due to 6 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/issue-17718-const-bad-values.stderr b/tests/ui/consts/issue-17718-const-bad-values.stderr index 248cd999bb6..cda94490155 100644 --- a/tests/ui/consts/issue-17718-const-bad-values.stderr +++ b/tests/ui/consts/issue-17718-const-bad-values.stderr @@ -27,6 +27,7 @@ LL | const C2: &'static mut usize = unsafe { &mut S }; | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. @@ -38,6 +39,7 @@ LL | const C2: &'static mut usize = unsafe { &mut S }; | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/consts/issue-17718-references.stderr b/tests/ui/consts/issue-17718-references.stderr index 4e5a44f6b6e..8b572203781 100644 --- a/tests/ui/consts/issue-17718-references.stderr +++ b/tests/ui/consts/issue-17718-references.stderr @@ -6,6 +6,7 @@ LL | const T2: &'static usize = &S; | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. @@ -17,6 +18,7 @@ LL | const T6: usize = S; | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. @@ -28,6 +30,7 @@ LL | const T10: Struct = Struct { a: S }; | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. diff --git a/tests/ui/consts/issue-52060.stderr b/tests/ui/consts/issue-52060.stderr index 9d5dff1ef22..644a5314622 100644 --- a/tests/ui/consts/issue-52060.stderr +++ b/tests/ui/consts/issue-52060.stderr @@ -6,6 +6,7 @@ LL | static B: [u32; 1] = [0; A.len()]; | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. diff --git a/tests/ui/consts/min_const_fn/min_const_fn.stderr b/tests/ui/consts/min_const_fn/min_const_fn.stderr index 64b13e941a5..daa0ab2614f 100644 --- a/tests/ui/consts/min_const_fn/min_const_fn.stderr +++ b/tests/ui/consts/min_const_fn/min_const_fn.stderr @@ -150,6 +150,7 @@ LL | const fn foo25() -> u32 { BAR } | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. @@ -161,6 +162,7 @@ LL | const fn foo26() -> &'static u32 { &BAR } | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. diff --git a/tests/ui/feature-gates/feature-gate-const-refs-to-static.stderr b/tests/ui/feature-gates/feature-gate-const-refs-to-static.stderr index 259e96e71dd..f94cff5b550 100644 --- a/tests/ui/feature-gates/feature-gate-const-refs-to-static.stderr +++ b/tests/ui/feature-gates/feature-gate-const-refs-to-static.stderr @@ -6,6 +6,7 @@ LL | const C1: &i32 = &S; | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. @@ -17,6 +18,7 @@ LL | const C2: *const i32 = unsafe { std::ptr::addr_of!(S_MUT) }; | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. @@ -28,6 +30,7 @@ LL | const C2: *const i32 = unsafe { std::ptr::addr_of!(S_MUT) }; | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/static/issue-18118-2.stderr b/tests/ui/static/issue-18118-2.stderr index 04604709c8a..f084f2b9fdf 100644 --- a/tests/ui/static/issue-18118-2.stderr +++ b/tests/ui/static/issue-18118-2.stderr @@ -6,6 +6,7 @@ LL | &p | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. diff --git a/tests/ui/thread-local/thread-local-static.stderr b/tests/ui/thread-local/thread-local-static.stderr index 46b6519c80b..d91742686c6 100644 --- a/tests/ui/thread-local/thread-local-static.stderr +++ b/tests/ui/thread-local/thread-local-static.stderr @@ -45,6 +45,7 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2) | = note: see issue #119618 <https://github.com/rust-lang/rust/issues/119618> for more information = help: add `#![feature(const_refs_to_static)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. |
