-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 #91320 - matthiaskrgr:rollup-r209seq, r=matthiaskrgr
Rollup of 3 pull requests Successful merges: - #91251 (Perform Sync check on static items in wf-check instead of during const checks) - #91308 (Fix ICE when lowering `trait A where for<'a> Self: 'a`) - #91319 (Change output path to {{build-base}} for rustdoc scrape_examples ui test) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
26 changed files
with
141 additions
and
144 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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// compile-flags: -Z unstable-options --scrape-examples-output-path t.calls --scrape-examples-target-crate foobar | ||
// compile-flags: -Z unstable-options --scrape-examples-output-path {{build-base}}/t.calls --scrape-examples-target-crate foobar | ||
// check-pass | ||
#![no_std] | ||
use core as _; |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
static a: &'static str = "foo"; | ||
static b: *const u8 = a as *const u8; //~ ERROR casting | ||
static c: *const u8 = &a as *const u8; //~ ERROR casting | ||
const a: &str = "foo"; | ||
const b: *const u8 = a as *const u8; //~ ERROR casting | ||
const c: *const u8 = &a as *const u8; //~ ERROR casting | ||
|
||
fn main() { | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
static a: [u8; 3] = ['h' as u8, 'i' as u8, 0 as u8]; | ||
static b: *const i8 = &a as *const i8; //~ ERROR mismatched types | ||
const a: [u8; 3] = ['h' as u8, 'i' as u8, 0 as u8]; | ||
const b: *const i8 = &a as *const i8; //~ ERROR mismatched types | ||
|
||
fn main() { | ||
} |
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
11 changes: 11 additions & 0 deletions
11
src/test/ui/higher-rank-trait-bounds/issue-88586-hr-self-outlives-in-trait-def.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,11 @@ | ||
// Regression test for #88586: a higher-ranked outlives bound on Self in a trait | ||
// definition caused an ICE when debug_assertions were enabled. | ||
// | ||
// FIXME: The error output in the absence of the ICE is unhelpful; this should be improved. | ||
|
||
trait A where for<'a> Self: 'a | ||
//~^ ERROR the parameter type `Self` may not live long enough | ||
{ | ||
} | ||
|
||
fn main() {} |
19 changes: 19 additions & 0 deletions
19
src/test/ui/higher-rank-trait-bounds/issue-88586-hr-self-outlives-in-trait-def.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
error[E0311]: the parameter type `Self` may not live long enough | ||
--> $DIR/issue-88586-hr-self-outlives-in-trait-def.rs:6:1 | ||
| | ||
LL | / trait A where for<'a> Self: 'a | ||
LL | | | ||
LL | | { | ||
LL | | } | ||
| |_^ | ||
| | ||
= help: consider adding an explicit lifetime bound `Self: 'a`... | ||
= note: ...so that the type `Self` will meet its required lifetime bounds... | ||
note: ...that is required by this bound | ||
--> $DIR/issue-88586-hr-self-outlives-in-trait-def.rs:6:29 | ||
| | ||
LL | trait A where for<'a> Self: 'a | ||
| ^^ | ||
|
||
error: aborting due to previous error | ||
|
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 |
---|---|---|
@@ -1,27 +1,26 @@ | ||
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants | ||
--> $DIR/issue-16538.rs:14:27 | ||
--> $DIR/issue-16538.rs:15:23 | ||
| | ||
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0277]: `*const usize` cannot be shared between threads safely | ||
--> $DIR/issue-16538.rs:14:1 | ||
error[E0133]: use of extern static is unsafe and requires unsafe function or block | ||
--> $DIR/issue-16538.rs:15:30 | ||
| | ||
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const usize` cannot be shared between threads safely | ||
LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); | ||
| ^^^^ use of extern static | ||
| | ||
= help: the trait `Sync` is not implemented for `*const usize` | ||
= note: shared static variables must have a type that implements `Sync` | ||
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior | ||
|
||
error[E0133]: use of extern static is unsafe and requires unsafe function or block | ||
--> $DIR/issue-16538.rs:14:34 | ||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block | ||
--> $DIR/issue-16538.rs:15:21 | ||
| | ||
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X); | ||
| ^^^^ use of extern static | ||
LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer | ||
| | ||
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior | ||
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0015, E0133, E0277. | ||
Some errors have detailed explanations: E0015, E0133. | ||
For more information about an error, try `rustc --explain E0015`. |
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 |
---|---|---|
@@ -1,27 +1,26 @@ | ||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block | ||
--> $DIR/issue-16538.rs:15:22 | ||
| | ||
LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer | ||
| | ||
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior | ||
|
||
error[E0133]: use of extern static is unsafe and requires unsafe function or block | ||
--> $DIR/issue-16538.rs:14:34 | ||
--> $DIR/issue-16538.rs:15:30 | ||
| | ||
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X); | ||
| ^^^^ use of extern static | ||
LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); | ||
| ^^^^ use of extern static | ||
| | ||
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior | ||
|
||
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants | ||
--> $DIR/issue-16538.rs:14:27 | ||
| | ||
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0277]: `*const usize` cannot be shared between threads safely | ||
--> $DIR/issue-16538.rs:14:1 | ||
| | ||
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const usize` cannot be shared between threads safely | ||
--> $DIR/issue-16538.rs:15:23 | ||
| | ||
= help: the trait `Sync` is not implemented for `*const usize` | ||
= note: shared static variables must have a type that implements `Sync` | ||
LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0015, E0133, E0277. | ||
Some errors have detailed explanations: E0015, E0133. | ||
For more information about an error, try `rustc --explain E0015`. |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
fn main() { | ||
static foo: dyn Fn() -> u32 = || -> u32 { | ||
//~^ ERROR the size for values of type | ||
//~| ERROR cannot be shared between threads safely | ||
0 | ||
}; | ||
} |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
fn f() { } | ||
struct S(Box<dyn FnMut()>); | ||
struct S(Box<dyn FnMut() + Sync>); | ||
pub static C: S = S(f); //~ ERROR mismatched types | ||
|
||
|
||
fn g() { } | ||
type T = Box<dyn FnMut()>; | ||
type T = Box<dyn FnMut() + Sync>; | ||
pub static D: T = g; //~ ERROR mismatched types | ||
|
||
fn main() {} |
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.