forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#87808 - JohnTitor:rollup-qqp79xs, r=JohnTitor
Rollup of 9 pull requests Successful merges: - rust-lang#87561 (thread set_name haiku implementation.) - rust-lang#87715 (Add long error explanation for E0625) - rust-lang#87727 (explicit_generic_args_with_impl_trait: fix min expected number of generics) - rust-lang#87742 (Validate FFI-safety warnings on naked functions) - rust-lang#87756 (Add back -Zno-profiler-runtime) - rust-lang#87759 (Re-use std::sealed::Sealed in os/linux/process.) - rust-lang#87760 (Promote `aarch64-apple-ios-sim` to Tier 2) - rust-lang#87770 (permit drop impls with generic constants in where clauses) - rust-lang#87780 (alloc: Use intra doc links for the reserve function) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
26 changed files
with
179 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
A compile-time const variable is referring to a thread-local static variable. | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0625 | ||
#![feature(thread_local)] | ||
#[thread_local] | ||
static X: usize = 12; | ||
const Y: usize = 2 * X; | ||
``` | ||
|
||
Static and const variables can refer to other const variables but a const | ||
variable cannot refer to a thread-local static variable. In this example, | ||
`Y` cannot refer to `X`. To fix this, the value can be extracted as a const | ||
and then used: | ||
|
||
``` | ||
#![feature(thread_local)] | ||
const C: usize = 12; | ||
#[thread_local] | ||
static X: usize = C; | ||
const Y: usize = 2 * C; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// check-pass | ||
// only-x86_64 | ||
#![feature(asm)] | ||
#![feature(naked_functions)] | ||
#![crate_type = "lib"] | ||
|
||
#[naked] | ||
pub extern "C" fn naked(p: char) -> u128 { | ||
//~^ WARN uses type `char` | ||
//~| WARN uses type `u128` | ||
unsafe { asm!("", options(noreturn)); } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
warning: `extern` fn uses type `char`, which is not FFI-safe | ||
--> $DIR/naked-functions-ffi.rs:8:28 | ||
| | ||
LL | pub extern "C" fn naked(p: char) -> u128 { | ||
| ^^^^ not FFI-safe | ||
| | ||
= note: `#[warn(improper_ctypes_definitions)]` on by default | ||
= help: consider using `u32` or `libc::wchar_t` instead | ||
= note: the `char` type has no C equivalent | ||
|
||
warning: `extern` fn uses type `u128`, which is not FFI-safe | ||
--> $DIR/naked-functions-ffi.rs:8:37 | ||
| | ||
LL | pub extern "C" fn naked(p: char) -> u128 { | ||
| ^^^^ not FFI-safe | ||
| | ||
= note: 128-bit integers don't currently have a known stable ABI | ||
|
||
warning: 2 warnings emitted | ||
|
16 changes: 16 additions & 0 deletions
16
src/test/ui/const-generics/const_evaluatable_checked/drop_impl.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//check-pass | ||
#![feature(const_generics, const_evaluatable_checked)] | ||
#![allow(incomplete_features)] | ||
|
||
struct Foo<const N: usize> | ||
where | ||
[(); N + 1]: ; | ||
|
||
impl<const N: usize> Drop for Foo<N> | ||
where | ||
[(); N + 1]: , | ||
{ | ||
fn drop(&mut self) {} | ||
} | ||
|
||
fn main() {} |
6 changes: 3 additions & 3 deletions
6
...ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.