mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-06 12:18:33 +00:00
With the revert of PR 83091, swap
is not a const fn
anymore.
(for the short term, that is; see issue 84297.)
This commit is contained in:
parent
a5cb9afad8
commit
34deda3cc2
@ -11,6 +11,7 @@ const fn g(x: &mut [u32; 8]) {
|
|||||||
//~| ERROR mutable references are not allowed
|
//~| ERROR mutable references are not allowed
|
||||||
//~| ERROR use of mutable static is unsafe
|
//~| ERROR use of mutable static is unsafe
|
||||||
//~| constant functions cannot refer to statics
|
//~| constant functions cannot refer to statics
|
||||||
|
//~| ERROR calls in constant functions are limited to constant functions
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -30,6 +30,12 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2)
|
|||||||
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
|
||||||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
||||||
|
|
||||||
|
error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||||
|
--> $DIR/thread-local-static.rs:9:5
|
||||||
|
|
|
||||||
|
LL | std::mem::swap(x, &mut STATIC_VAR_2)
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
|
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
|
||||||
--> $DIR/thread-local-static.rs:9:23
|
--> $DIR/thread-local-static.rs:9:23
|
||||||
|
|
|
|
||||||
@ -38,7 +44,7 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2)
|
|||||||
|
|
|
|
||||||
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
|
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 6 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0013, E0133, E0658.
|
Some errors have detailed explanations: E0013, E0015, E0133, E0658.
|
||||||
For more information about an error, try `rustc --explain E0013`.
|
For more information about an error, try `rustc --explain E0013`.
|
||||||
|
Loading…
Reference in New Issue
Block a user