Auto merge of #91455 - matthiaskrgr:rollup-gix2hy6, r=matthiaskrgr

Rollup of 4 iffy pull requests

Successful merges:

 - #89234 (Disallow non-c-like but "fieldless" ADTs from being casted to integer if they use arbitrary enum discriminant)
 - #91045 (Issue 90702 fix: Stop treating some crate loading failures as fatal errors)
 - #91394 (Bump stage0 compiler)
 - #91411 (Enable svh tests on msvc)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2021-12-02 14:53:20 +00:00
commit e5038e2099
69 changed files with 713 additions and 599 deletions

View file

@ -0,0 +1,13 @@
#![feature(arbitrary_enum_discriminant)]
#[repr(u8)]
enum Kind2 {
Foo() = 1,
Bar{} = 2,
Baz = 3,
}
fn main() {
let _ = Kind2::Foo() as u8;
//~^ ERROR non-primitive cast
}

View file

@ -0,0 +1,9 @@
error[E0605]: non-primitive cast: `Kind2` as `u8`
--> $DIR/issue-88621.rs:11:13
|
LL | let _ = Kind2::Foo() as u8;
| ^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
error: aborting due to previous error
For more information about this error, try `rustc --explain E0605`.

View file

@ -6,3 +6,5 @@
#![no_std]
use ::foo; //~ ERROR invalid metadata files for crate `foo`
//~| NOTE failed to mmap file
//~^^ ERROR invalid metadata files for crate `foo`
//~| NOTE failed to mmap file

View file

@ -6,6 +6,14 @@ LL | use ::foo;
|
= note: failed to mmap file 'auxiliary/libfoo.rlib'
error: aborting due to previous error
error[E0786]: found invalid metadata files for crate `foo`
--> $DIR/invalid-rlib.rs:7:7
|
LL | use ::foo;
| ^^^
|
= note: failed to mmap file 'auxiliary/libfoo.rlib'
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0786`.

View file

@ -1,6 +1,7 @@
// compile-flags: --target x86_64-unknown-uefi
// needs-llvm-components: x86
// rustc-env:CARGO=/usr/bin/cargo
#![feature(no_core)]
#![no_core]
extern crate core;
//~^ ERROR can't find crate for `core`

View file

@ -1,5 +1,5 @@
error[E0463]: can't find crate for `core`
--> $DIR/missing-std.rs:5:1
--> $DIR/missing-std.rs:6:1
|
LL | extern crate core;
| ^^^^^^^^^^^^^^^^^^ can't find crate
@ -8,6 +8,8 @@ LL | extern crate core;
= help: consider downloading the target with `rustup target add x86_64-unknown-uefi`
= help: consider building the standard library from source with `cargo build -Zbuild-std`
error: aborting due to previous error
error: requires `sized` lang_item
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0463`.

View file

@ -22,14 +22,6 @@ impl Enum {
}
}
#[allow(dead_code)]
#[repr(u8)]
enum FieldlessEnum {
Unit = 3,
Tuple() = 2,
Struct {} = 1,
}
fn main() {
const UNIT: Enum = Enum::Unit;
const TUPLE: Enum = Enum::Tuple(5);
@ -48,9 +40,4 @@ fn main() {
assert_eq!(3, UNIT_TAG);
assert_eq!(2, TUPLE_TAG);
assert_eq!(1, STRUCT_TAG);
// Ensure `as` conversions are correct
assert_eq!(3, FieldlessEnum::Unit as u8);
assert_eq!(2, FieldlessEnum::Tuple() as u8);
assert_eq!(1, FieldlessEnum::Struct{} as u8);
}

View file

@ -1,4 +1,6 @@
// compile-flags: --extern std=
// error-pattern: extern location for std does not exist
// needs-unwind since it affects the error output
// ignore-emscripten compiled with panic=abort, personality not required
fn main() {}

View file

@ -1,4 +1,8 @@
error: extern location for std does not exist:
error: aborting due to previous error
error: language item required, but not found: `eh_personality`
error: `#[panic_handler]` function required, but not found
error: aborting due to 3 previous errors

View file

@ -0,0 +1,10 @@
// If multiple `extern crate` resolutions fail each of them should produce an error
extern crate bar; //~ ERROR can't find crate for `bar`
extern crate foo; //~ ERROR can't find crate for `foo`
fn main() {
// If the crate name introduced by `extern crate` failed to resolve then subsequent
// derived paths do not emit additional errors
foo::something();
bar::something();
}

View file

@ -0,0 +1,15 @@
error[E0463]: can't find crate for `bar`
--> $DIR/extern-crate-multiple-missing.rs:2:1
|
LL | extern crate bar;
| ^^^^^^^^^^^^^^^^^ can't find crate
error[E0463]: can't find crate for `foo`
--> $DIR/extern-crate-multiple-missing.rs:3:1
|
LL | extern crate foo;
| ^^^^^^^^^^^^^^^^^ can't find crate
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0463`.

View file

@ -2,7 +2,12 @@ error: `extern crate self;` requires renaming
--> $DIR/extern-crate-self-fail.rs:1:1
|
LL | extern crate self;
| ^^^^^^^^^^^^^^^^^^ help: try: `extern crate self as name;`
| ^^^^^^^^^^^^^^^^^^
|
help: rename the `self` crate to be able to import it
|
LL | extern crate self as name;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
error: `#[macro_use]` is not supported on `extern crate self`
--> $DIR/extern-crate-self-fail.rs:3:1

View file

@ -4,6 +4,8 @@ error[E0463]: can't find crate for `std`
= help: consider downloading the target with `rustup target add thumbv6m-none-eabi`
= help: consider building the standard library from source with `cargo build -Zbuild-std`
error: aborting due to previous error
error: requires `sized` lang_item
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0463`.

View file

@ -1,4 +1,5 @@
//~ ERROR 1:1: 1:1: can't find crate for `core` [E0463]
//~ ERROR can't find crate for `core`
//~^ ERROR can't find crate for `compiler_builtins`
// compile-flags: --target thumbv7em-none-eabihf
// needs-llvm-components: arm
@ -7,3 +8,6 @@
#![no_std]
extern crate cortex_m;
//~^ ERROR can't find crate for `cortex_m`
fn main() {}

View file

@ -4,6 +4,16 @@ error[E0463]: can't find crate for `core`
= help: consider downloading the target with `rustup target add thumbv7em-none-eabihf`
= help: consider building the standard library from source with `cargo build -Zbuild-std`
error: aborting due to previous error
error[E0463]: can't find crate for `compiler_builtins`
error[E0463]: can't find crate for `cortex_m`
--> $DIR/compiler-builtins-error.rs:10:1
|
LL | extern crate cortex_m;
| ^^^^^^^^^^^^^^^^^^^^^^ can't find crate
error: requires `sized` lang_item
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0463`.

View file

@ -1,7 +1,8 @@
// edition:2018
// compile-flags:--extern foo --extern bar
use bar::foo; //~ ERROR can't find crate for `bar`
use foo::bar; //~ ERROR can't find crate for `foo`
use bar::foo;
//~^^ ERROR unresolved imports `bar::foo`, `foo::bar`
fn main() {}

View file

@ -1,9 +1,24 @@
error[E0463]: can't find crate for `foo`
error[E0463]: can't find crate for `bar`
--> $DIR/deadlock.rs:4:5
|
LL | use bar::foo;
| ^^^ can't find crate
error[E0463]: can't find crate for `foo`
--> $DIR/deadlock.rs:5:5
|
LL | use foo::bar;
| ^^^ can't find crate
error: aborting due to previous error
error[E0432]: unresolved imports `bar::foo`, `foo::bar`
--> $DIR/deadlock.rs:4:5
|
LL | use bar::foo;
| ^^^^^^^^
LL | use foo::bar;
| ^^^^^^^^
For more information about this error, try `rustc --explain E0463`.
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0432, E0463.
For more information about an error, try `rustc --explain E0432`.

View file

@ -1,5 +1,3 @@
// ignore-msvc FIXME #31306
// note that these aux-build directives must be in this order
// aux-build:changing-crates-a1.rs
// aux-build:changing-crates-b.rs

View file

@ -1,5 +1,5 @@
error[E0460]: found possibly newer version of crate `a` which `b` depends on
--> $DIR/changing-crates.rs:10:1
--> $DIR/changing-crates.rs:8:1
|
LL | extern crate b;
| ^^^^^^^^^^^^^^^

View file

@ -1,5 +1,3 @@
// ignore-msvc FIXME #31306
// note that these aux-build directives must be in this order
// aux-build:svh-a-base.rs
// aux-build:svh-b.rs

View file

@ -1,5 +1,5 @@
error[E0460]: found possibly newer version of crate `a` which `b` depends on
--> $DIR/svh-change-lit.rs:10:1
--> $DIR/svh-change-lit.rs:8:1
|
LL | extern crate b;
| ^^^^^^^^^^^^^^^

View file

@ -1,5 +1,3 @@
// ignore-msvc FIXME #31306
// note that these aux-build directives must be in this order
// aux-build:svh-a-base.rs
// aux-build:svh-b.rs

View file

@ -1,5 +1,5 @@
error[E0460]: found possibly newer version of crate `a` which `b` depends on
--> $DIR/svh-change-significant-cfg.rs:10:1
--> $DIR/svh-change-significant-cfg.rs:8:1
|
LL | extern crate b;
| ^^^^^^^^^^^^^^^

View file

@ -1,5 +1,3 @@
// ignore-msvc FIXME #31306
// note that these aux-build directives must be in this order
// aux-build:svh-a-base.rs
// aux-build:svh-b.rs

View file

@ -1,5 +1,5 @@
error[E0460]: found possibly newer version of crate `a` which `b` depends on
--> $DIR/svh-change-trait-bound.rs:10:1
--> $DIR/svh-change-trait-bound.rs:8:1
|
LL | extern crate b;
| ^^^^^^^^^^^^^^^

View file

@ -1,5 +1,3 @@
// ignore-msvc FIXME #31306
// note that these aux-build directives must be in this order
// aux-build:svh-a-base.rs
// aux-build:svh-b.rs

View file

@ -1,5 +1,5 @@
error[E0460]: found possibly newer version of crate `a` which `b` depends on
--> $DIR/svh-change-type-arg.rs:10:1
--> $DIR/svh-change-type-arg.rs:8:1
|
LL | extern crate b;
| ^^^^^^^^^^^^^^^

View file

@ -1,5 +1,3 @@
// ignore-msvc FIXME #31306
// note that these aux-build directives must be in this order
// aux-build:svh-a-base.rs
// aux-build:svh-b.rs

View file

@ -1,5 +1,5 @@
error[E0460]: found possibly newer version of crate `a` which `b` depends on
--> $DIR/svh-change-type-ret.rs:10:1
--> $DIR/svh-change-type-ret.rs:8:1
|
LL | extern crate b;
| ^^^^^^^^^^^^^^^

View file

@ -1,5 +1,3 @@
// ignore-msvc FIXME #31306
// note that these aux-build directives must be in this order
// aux-build:svh-a-base.rs
// aux-build:svh-b.rs

View file

@ -1,5 +1,5 @@
error[E0460]: found possibly newer version of crate `a` which `b` depends on
--> $DIR/svh-change-type-static.rs:10:1
--> $DIR/svh-change-type-static.rs:8:1
|
LL | extern crate b;
| ^^^^^^^^^^^^^^^

View file

@ -1,5 +1,3 @@
// ignore-msvc FIXME #31306
// note that these aux-build directives must be in this order
// aux-build:svh-uta-base.rs
// aux-build:svh-utb.rs

View file

@ -1,5 +1,5 @@
error[E0460]: found possibly newer version of crate `uta` which `utb` depends on
--> $DIR/svh-use-trait.rs:15:1
--> $DIR/svh-use-trait.rs:13:1
|
LL | extern crate utb;
| ^^^^^^^^^^^^^^^^^