Skip to content

Commit 7de63be

Browse files
committed
Revert "With the revert of PR 83091, swap is not a const fn anymore."
This reverts commit 34deda3.
1 parent 38e9538 commit 7de63be

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

src/test/ui/thread-local-static.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const fn g(x: &mut [u32; 8]) {
1111
//~| ERROR mutable references are not allowed
1212
//~| ERROR use of mutable static is unsafe
1313
//~| constant functions cannot refer to statics
14-
//~| ERROR calls in constant functions are limited to constant functions
1514
}
1615

1716
fn main() {}

src/test/ui/thread-local-static.stderr

+2-8
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2)
3030
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
3131
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
3232

33-
error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
34-
--> $DIR/thread-local-static.rs:9:5
35-
|
36-
LL | std::mem::swap(x, &mut STATIC_VAR_2)
37-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38-
3933
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
4034
--> $DIR/thread-local-static.rs:9:23
4135
|
@@ -44,7 +38,7 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2)
4438
|
4539
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
4640

47-
error: aborting due to 6 previous errors
41+
error: aborting due to 5 previous errors
4842

49-
Some errors have detailed explanations: E0013, E0015, E0133, E0658.
43+
Some errors have detailed explanations: E0013, E0133, E0658.
5044
For more information about an error, try `rustc --explain E0013`.

0 commit comments

Comments
 (0)