Auto merge of #91104 - matthiaskrgr:rollup-duk33o1, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #91008 (Adds IEEE 754-2019 minimun and maximum functions for f32/f64) - #91070 (Make `LLVMRustGetOrInsertGlobal` always return a `GlobalVariable`) - #91097 (Add spaces in opaque `impl Trait` with more than one trait) - #91098 (Don't suggest certain fixups (`.field`, `.await`, etc) when reporting errors while matching on arrays ) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
3bfde2f1f4
17 changed files with 344 additions and 27 deletions
|
|
@ -83,17 +83,17 @@ fn main() {
|
|||
//~^ ERROR type mismatch resolving `<impl DerivedTrait as Trait>::Associated == ()`
|
||||
|
||||
accepts_trait(returns_opaque_foo());
|
||||
//~^ ERROR type mismatch resolving `<impl Trait+Foo as Trait>::Associated == ()`
|
||||
//~^ ERROR type mismatch resolving `<impl Trait + Foo as Trait>::Associated == ()`
|
||||
|
||||
accepts_trait(returns_opaque_derived_foo());
|
||||
//~^ ERROR type mismatch resolving `<impl DerivedTrait+Foo as Trait>::Associated == ()`
|
||||
//~^ ERROR type mismatch resolving `<impl DerivedTrait + Foo as Trait>::Associated == ()`
|
||||
|
||||
accepts_generic_trait(returns_opaque_generic());
|
||||
//~^ ERROR type mismatch resolving `<impl GenericTrait<()> as GenericTrait<()>>::Associated == ()`
|
||||
|
||||
accepts_generic_trait(returns_opaque_generic_foo());
|
||||
//~^ ERROR type mismatch resolving `<impl GenericTrait<()>+Foo as GenericTrait<()>>::Associated == ()`
|
||||
//~^ ERROR type mismatch resolving `<impl GenericTrait<()> + Foo as GenericTrait<()>>::Associated == ()`
|
||||
|
||||
accepts_generic_trait(returns_opaque_generic_duplicate());
|
||||
//~^ ERROR type mismatch resolving `<impl GenericTrait<()>+GenericTrait<u8> as GenericTrait<()>>::Associated == ()`
|
||||
//~^ ERROR type mismatch resolving `<impl GenericTrait<()> + GenericTrait<u8> as GenericTrait<()>>::Associated == ()`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ help: consider constraining the associated type `<impl DerivedTrait as Trait>::A
|
|||
LL | fn returns_opaque_derived() -> impl DerivedTrait<Associated = ()> + 'static {
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0271]: type mismatch resolving `<impl Trait+Foo as Trait>::Associated == ()`
|
||||
error[E0271]: type mismatch resolving `<impl Trait + Foo as Trait>::Associated == ()`
|
||||
--> $DIR/issue-87261.rs:85:5
|
||||
|
|
||||
LL | fn returns_opaque_foo() -> impl Trait + Foo {
|
||||
|
|
@ -170,18 +170,18 @@ LL | accepts_trait(returns_opaque_foo());
|
|||
| ^^^^^^^^^^^^^ expected `()`, found associated type
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found associated type `<impl Trait+Foo as Trait>::Associated`
|
||||
found associated type `<impl Trait + Foo as Trait>::Associated`
|
||||
note: required by a bound in `accepts_trait`
|
||||
--> $DIR/issue-87261.rs:43:27
|
||||
|
|
||||
LL | fn accepts_trait<T: Trait<Associated = ()>>(_: T) {}
|
||||
| ^^^^^^^^^^^^^^^ required by this bound in `accepts_trait`
|
||||
help: consider constraining the associated type `<impl Trait+Foo as Trait>::Associated` to `()`
|
||||
help: consider constraining the associated type `<impl Trait + Foo as Trait>::Associated` to `()`
|
||||
|
|
||||
LL | fn returns_opaque_foo() -> impl Trait<Associated = ()> + Foo {
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0271]: type mismatch resolving `<impl DerivedTrait+Foo as Trait>::Associated == ()`
|
||||
error[E0271]: type mismatch resolving `<impl DerivedTrait + Foo as Trait>::Associated == ()`
|
||||
--> $DIR/issue-87261.rs:88:5
|
||||
|
|
||||
LL | fn returns_opaque_derived_foo() -> impl DerivedTrait + Foo {
|
||||
|
|
@ -191,8 +191,8 @@ LL | accepts_trait(returns_opaque_derived_foo());
|
|||
| ^^^^^^^^^^^^^ expected `()`, found associated type
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found associated type `<impl DerivedTrait+Foo as Trait>::Associated`
|
||||
= help: consider constraining the associated type `<impl DerivedTrait+Foo as Trait>::Associated` to `()`
|
||||
found associated type `<impl DerivedTrait + Foo as Trait>::Associated`
|
||||
= help: consider constraining the associated type `<impl DerivedTrait + Foo as Trait>::Associated` to `()`
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
|
||||
note: required by a bound in `accepts_trait`
|
||||
--> $DIR/issue-87261.rs:43:27
|
||||
|
|
@ -221,7 +221,7 @@ help: consider constraining the associated type `<impl GenericTrait<()> as Gener
|
|||
LL | fn returns_opaque_generic() -> impl GenericTrait<(), Associated = ()> + 'static {
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0271]: type mismatch resolving `<impl GenericTrait<()>+Foo as GenericTrait<()>>::Associated == ()`
|
||||
error[E0271]: type mismatch resolving `<impl GenericTrait<()> + Foo as GenericTrait<()>>::Associated == ()`
|
||||
--> $DIR/issue-87261.rs:94:5
|
||||
|
|
||||
LL | fn returns_opaque_generic_foo() -> impl GenericTrait<()> + Foo {
|
||||
|
|
@ -231,18 +231,18 @@ LL | accepts_generic_trait(returns_opaque_generic_foo());
|
|||
| ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found associated type `<impl GenericTrait<()>+Foo as GenericTrait<()>>::Associated`
|
||||
found associated type `<impl GenericTrait<()> + Foo as GenericTrait<()>>::Associated`
|
||||
note: required by a bound in `accepts_generic_trait`
|
||||
--> $DIR/issue-87261.rs:44:46
|
||||
|
|
||||
LL | fn accepts_generic_trait<T: GenericTrait<(), Associated = ()>>(_: T) {}
|
||||
| ^^^^^^^^^^^^^^^ required by this bound in `accepts_generic_trait`
|
||||
help: consider constraining the associated type `<impl GenericTrait<()>+Foo as GenericTrait<()>>::Associated` to `()`
|
||||
help: consider constraining the associated type `<impl GenericTrait<()> + Foo as GenericTrait<()>>::Associated` to `()`
|
||||
|
|
||||
LL | fn returns_opaque_generic_foo() -> impl GenericTrait<(), Associated = ()> + Foo {
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0271]: type mismatch resolving `<impl GenericTrait<()>+GenericTrait<u8> as GenericTrait<()>>::Associated == ()`
|
||||
error[E0271]: type mismatch resolving `<impl GenericTrait<()> + GenericTrait<u8> as GenericTrait<()>>::Associated == ()`
|
||||
--> $DIR/issue-87261.rs:97:5
|
||||
|
|
||||
LL | fn returns_opaque_generic_duplicate() -> impl GenericTrait<()> + GenericTrait<u8> {
|
||||
|
|
@ -252,8 +252,8 @@ LL | accepts_generic_trait(returns_opaque_generic_duplicate());
|
|||
| ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found associated type
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found associated type `<impl GenericTrait<()>+GenericTrait<u8> as GenericTrait<()>>::Associated`
|
||||
= help: consider constraining the associated type `<impl GenericTrait<()>+GenericTrait<u8> as GenericTrait<()>>::Associated` to `()`
|
||||
found associated type `<impl GenericTrait<()> + GenericTrait<u8> as GenericTrait<()>>::Associated`
|
||||
= help: consider constraining the associated type `<impl GenericTrait<()> + GenericTrait<u8> as GenericTrait<()>>::Associated` to `()`
|
||||
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
|
||||
note: required by a bound in `accepts_generic_trait`
|
||||
--> $DIR/issue-87261.rs:44:46
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0606]: casting `*mut impl Debug+?Sized` as `*mut impl Debug+?Sized` is invalid
|
||||
error[E0606]: casting `*mut impl Debug + ?Sized` as `*mut impl Debug + ?Sized` is invalid
|
||||
--> $DIR/casts-differing-anon.rs:21:13
|
||||
|
|
||||
LL | b_raw = f_raw as *mut _;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ LL | Either::Right(_) => {}
|
|||
|
|
||||
= note: expected struct `S`
|
||||
found enum `Either<_, _>`
|
||||
help: you might have meant to use field `0` whose type is `Either<usize, usize>`
|
||||
|
|
||||
LL | match S(Either::Left(5)).0 {
|
||||
| ~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
11
src/test/ui/match/issue-91058.rs
Normal file
11
src/test/ui/match/issue-91058.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
struct S(());
|
||||
|
||||
fn main() {
|
||||
let array = [S(())];
|
||||
|
||||
match array {
|
||||
[()] => {}
|
||||
//~^ ERROR mismatched types [E0308]
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
11
src/test/ui/match/issue-91058.stderr
Normal file
11
src/test/ui/match/issue-91058.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-91058.rs:7:10
|
||||
|
|
||||
LL | match array {
|
||||
| ----- this expression has type `[S; 1]`
|
||||
LL | [()] => {}
|
||||
| ^^ expected struct `S`, found `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
34
src/test/ui/statics/issue-91050-1.rs
Normal file
34
src/test/ui/statics/issue-91050-1.rs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// build-pass
|
||||
// compile-flags: --crate-type=rlib --emit=llvm-ir -Cno-prepopulate-passes
|
||||
|
||||
// This test declares globals by the same name with different types, which
|
||||
// caused problems because Module::getOrInsertGlobal would return a Constant*
|
||||
// bitcast instead of a GlobalVariable* that could access linkage/visibility.
|
||||
// In alt builds with LLVM assertions this would fail:
|
||||
//
|
||||
// rustc: /checkout/src/llvm-project/llvm/include/llvm/Support/Casting.h:269:
|
||||
// typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = llvm::GlobalValue, Y = llvm::Value]:
|
||||
// Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
|
||||
//
|
||||
// In regular builds, the bad cast was UB, like "Invalid LLVMRustVisibility value!"
|
||||
|
||||
pub mod before {
|
||||
#[no_mangle]
|
||||
pub static GLOBAL1: [u8; 1] = [1];
|
||||
}
|
||||
|
||||
pub mod inner {
|
||||
extern "C" {
|
||||
pub static GLOBAL1: u8;
|
||||
pub static GLOBAL2: u8;
|
||||
}
|
||||
|
||||
pub fn call() {
|
||||
drop(unsafe { (GLOBAL1, GLOBAL2) });
|
||||
}
|
||||
}
|
||||
|
||||
pub mod after {
|
||||
#[no_mangle]
|
||||
pub static GLOBAL2: [u8; 1] = [2];
|
||||
}
|
||||
24
src/test/ui/statics/issue-91050-2.rs
Normal file
24
src/test/ui/statics/issue-91050-2.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// build-pass
|
||||
// compile-flags: --crate-type=rlib --emit=llvm-ir -Cno-prepopulate-passes
|
||||
|
||||
// This is a variant of issue-91050-1.rs -- see there for an explanation.
|
||||
|
||||
pub mod before {
|
||||
extern "C" {
|
||||
pub static GLOBAL1: [u8; 1];
|
||||
}
|
||||
|
||||
pub unsafe fn do_something_with_array() -> u8 {
|
||||
GLOBAL1[0]
|
||||
}
|
||||
}
|
||||
|
||||
pub mod inner {
|
||||
extern "C" {
|
||||
pub static GLOBAL1: u8;
|
||||
}
|
||||
|
||||
pub unsafe fn call() -> u8 {
|
||||
GLOBAL1 + 42
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue