diff options
| author | bors <bors@rust-lang.org> | 2019-05-30 11:56:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-05-30 11:56:32 +0000 |
| commit | aee7012fab26d5e307a2fe767e4e7c847c5a45ee (patch) | |
| tree | c960557e317e8e2d73db61fd13894d62884b2a66 /src/test | |
| parent | c28084ac16af4ab594b6860958df140e7c876a13 (diff) | |
| parent | 528972a28aa9e7e303e2283a31469c12c3d87e23 (diff) | |
| download | rust-aee7012fab26d5e307a2fe767e4e7c847c5a45ee.tar.gz rust-aee7012fab26d5e307a2fe767e4e7c847c5a45ee.zip | |
Auto merge of #61343 - Centril:rollup-dzsuo01, r=Centril
Rollup of 11 pull requests Successful merges: - #60802 (upgrade rustdoc's `pulldown-cmark` to 0.5.2) - #60839 (Fix ICE with struct ctors and const generics.) - #60850 (Stabilize RefCell::try_borrow_unguarded) - #61231 (Fix linkage diagnostic so it doesn't ICE for external crates) - #61244 (Box::into_vec: use Box::into_raw instead of mem::forget) - #61279 (implicit `Option`-returning doctests) - #61280 (Revert "Disable solaris target since toolchain no longer builds") - #61284 (Update all s3 URLs used on CI with subdomains) - #61321 (libsyntax: introduce 'fn is_keyword_ahead(dist, keywords)'.) - #61322 (ci: display more debug information in the init_repo script) - #61333 (Fix ICE with APIT in a function with a const parameter) Failed merges: - #61304 (Speed up Azure CI installing Windows dependencies) r? @ghost
Diffstat (limited to 'src/test')
22 files changed, 149 insertions, 24 deletions
diff --git a/src/test/rustdoc/issue-60482.rs b/src/test/rustdoc/issue-60482.rs new file mode 100644 index 00000000000..0fd1daa746d --- /dev/null +++ b/src/test/rustdoc/issue-60482.rs @@ -0,0 +1,9 @@ +// This code caused a panic in `pulldown-cmark` 0.4.1. + +pub const BASIC_UNICODE: bool = true; + + +/// # `BASIC_UNICODE`: `A` `|` +/// ```text +/// ``` +pub const BASIC_FONTS: bool = true; diff --git a/src/test/rustdoc/process-termination.rs b/src/test/rustdoc/process-termination.rs index 32258792b6e..31ae0143d47 100644 --- a/src/test/rustdoc/process-termination.rs +++ b/src/test/rustdoc/process-termination.rs @@ -21,4 +21,16 @@ /// Err("This is returned from `main`, leading to panic")?; /// Ok::<(), &'static str>(()) /// ``` +/// +/// This also works with `Option<()>`s now: +/// +/// ```rust +/// Some(()) +/// ``` +/// +/// ```rust,should_panic +/// let x: &[u32] = &[]; +/// let _ = x.iter().next()?; +/// Some(()) +/// ``` pub fn check_process_termination() {} diff --git a/src/test/ui/const-generics/apit-with-const-param.rs b/src/test/ui/const-generics/apit-with-const-param.rs new file mode 100644 index 00000000000..70e718d8890 --- /dev/null +++ b/src/test/ui/const-generics/apit-with-const-param.rs @@ -0,0 +1,10 @@ +// run-pass + +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash + +trait Trait {} + +fn f<const N: usize>(_: impl Trait) {} + +fn main() {} diff --git a/src/test/ui/const-generics/apit-with-const-param.stderr b/src/test/ui/const-generics/apit-with-const-param.stderr new file mode 100644 index 00000000000..b3038ee6488 --- /dev/null +++ b/src/test/ui/const-generics/apit-with-const-param.stderr @@ -0,0 +1,6 @@ +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/apit-with-const-param.rs:3:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + diff --git a/src/test/ui/const-generics/cannot-infer-type-for-const-param.rs b/src/test/ui/const-generics/cannot-infer-type-for-const-param.rs index 26496ec4a90..f592e486be9 100644 --- a/src/test/ui/const-generics/cannot-infer-type-for-const-param.rs +++ b/src/test/ui/const-generics/cannot-infer-type-for-const-param.rs @@ -1,8 +1,9 @@ +// compile-pass #![feature(const_generics)] //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash -// We should probably be able to infer the types here. However, this test is checking that we don't -// get an ICE in this case. It may be modified later to not be an error. +// This test confirms that the types can be inferred correctly for this example with const +// generics. Previously this would ICE, and more recently error. struct Foo<const NUM_BYTES: usize>(pub [u8; NUM_BYTES]); diff --git a/src/test/ui/const-generics/cannot-infer-type-for-const-param.stderr b/src/test/ui/const-generics/cannot-infer-type-for-const-param.stderr index fb151648f2f..52907bbb677 100644 --- a/src/test/ui/const-generics/cannot-infer-type-for-const-param.stderr +++ b/src/test/ui/const-generics/cannot-infer-type-for-const-param.stderr @@ -1,25 +1,6 @@ warning: the feature `const_generics` is incomplete and may cause the compiler to crash - --> $DIR/cannot-infer-type-for-const-param.rs:1:12 + --> $DIR/cannot-infer-type-for-const-param.rs:2:12 | LL | #![feature(const_generics)] | ^^^^^^^^^^^^^^ -error[E0282]: type annotations needed - --> $DIR/cannot-infer-type-for-const-param.rs:10:19 - | -LL | let _ = Foo::<3>([1, 2, 3]); - | ^ cannot infer type for `{integer}` - -error[E0308]: mismatched types - --> $DIR/cannot-infer-type-for-const-param.rs:10:22 - | -LL | let _ = Foo::<3>([1, 2, 3]); - | ^^^^^^^^^ expected `3`, found `3usize` - | - = note: expected type `[u8; _]` - found type `[u8; 3]` - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0282, E0308. -For more information about an error, try `rustc --explain E0282`. diff --git a/src/test/ui/const-generics/issue-60818-struct-constructors.rs b/src/test/ui/const-generics/issue-60818-struct-constructors.rs new file mode 100644 index 00000000000..0b4aeae7a4a --- /dev/null +++ b/src/test/ui/const-generics/issue-60818-struct-constructors.rs @@ -0,0 +1,10 @@ +// compile-pass + +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash + +struct Generic<const V: usize>; + +fn main() { + let _ = Generic::<0>; +} diff --git a/src/test/ui/const-generics/issue-60818-struct-constructors.stderr b/src/test/ui/const-generics/issue-60818-struct-constructors.stderr new file mode 100644 index 00000000000..4b8f50b9b02 --- /dev/null +++ b/src/test/ui/const-generics/issue-60818-struct-constructors.stderr @@ -0,0 +1,6 @@ +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/issue-60818-struct-constructors.rs:3:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + diff --git a/src/test/ui/linkage-attr/auxiliary/def_colliding_external.rs b/src/test/ui/linkage-attr/auxiliary/def_colliding_external.rs new file mode 100644 index 00000000000..bbbfc485791 --- /dev/null +++ b/src/test/ui/linkage-attr/auxiliary/def_colliding_external.rs @@ -0,0 +1,7 @@ +#![feature(linkage)] +#![crate_type = "lib"] + +extern { + #[linkage="external"] + pub static collision: *const i32; +} diff --git a/src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs b/src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs new file mode 100644 index 00000000000..2300930e513 --- /dev/null +++ b/src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs @@ -0,0 +1,5 @@ +#![feature(linkage)] +#![crate_type = "lib"] + +#[linkage="external"] +pub static EXTERN: u32 = 0; diff --git a/src/test/ui/linkage-attr/linkage-detect-extern-generated-name-collision.rs b/src/test/ui/linkage-attr/linkage-detect-extern-generated-name-collision.rs new file mode 100644 index 00000000000..85a9a336b0d --- /dev/null +++ b/src/test/ui/linkage-attr/linkage-detect-extern-generated-name-collision.rs @@ -0,0 +1,21 @@ +// rust-lang/rust#61232: We used to ICE when trying to detect a +// collision on the symbol generated for the external linkage item in +// an extern crate. + +// aux-build:def_colliding_external.rs + +extern crate def_colliding_external as dep1; + +#[no_mangle] +pub static _rust_extern_with_linkage_collision: i32 = 0; + +mod dep2 { + #[no_mangle] + pub static collision: usize = 0; +} + +fn main() { + unsafe { + println!("{:p}", &dep1::collision); + } +} diff --git a/src/test/ui/linkage-attr/linkage-detect-extern-generated-name-collision.stderr b/src/test/ui/linkage-attr/linkage-detect-extern-generated-name-collision.stderr new file mode 100644 index 00000000000..dcb954a4bc0 --- /dev/null +++ b/src/test/ui/linkage-attr/linkage-detect-extern-generated-name-collision.stderr @@ -0,0 +1,8 @@ +error: symbol `collision` is already defined + --> $DIR/auxiliary/def_colliding_external.rs:6:5 + | +LL | pub static collision: *const i32; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.rs b/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.rs new file mode 100644 index 00000000000..dc15798e16a --- /dev/null +++ b/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.rs @@ -0,0 +1,23 @@ +#![feature(linkage)] + +mod dep1 { + extern { + #[linkage="external"] + #[no_mangle] + pub static collision: *const i32; //~ ERROR symbol `collision` is already defined + } +} + +#[no_mangle] +pub static _rust_extern_with_linkage_collision: i32 = 0; + +mod dep2 { + #[no_mangle] + pub static collision: usize = 0; +} + +fn main() { + unsafe { + println!("{:p}", &dep1::collision); + } +} diff --git a/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.stderr b/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.stderr new file mode 100644 index 00000000000..117c76f7f26 --- /dev/null +++ b/src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.stderr @@ -0,0 +1,8 @@ +error: symbol `collision` is already defined + --> $DIR/linkage-detect-local-generated-name-collision.rs:7:9 + | +LL | pub static collision: *const i32; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/linkage-attr/linkage-requires-raw-ptr.rs b/src/test/ui/linkage-attr/linkage-requires-raw-ptr.rs new file mode 100644 index 00000000000..014c715be0d --- /dev/null +++ b/src/test/ui/linkage-attr/linkage-requires-raw-ptr.rs @@ -0,0 +1,10 @@ +// rust-lang/rust#59548: We used to ICE when trying to use a static +// with a type that violated its own `#[linkage]`. + +// aux-build:def_illtyped_external.rs + +extern crate def_illtyped_external as dep; + +fn main() { + println!("{:p}", &dep::EXTERN); +} diff --git a/src/test/ui/linkage-attr/linkage-requires-raw-ptr.stderr b/src/test/ui/linkage-attr/linkage-requires-raw-ptr.stderr new file mode 100644 index 00000000000..a80b495f97f --- /dev/null +++ b/src/test/ui/linkage-attr/linkage-requires-raw-ptr.stderr @@ -0,0 +1,8 @@ +error: must have type `*const T` or `*mut T` due to `#[linkage]` attribute + --> $DIR/auxiliary/def_illtyped_external.rs:5:1 + | +LL | pub static EXTERN: u32 = 0; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/linkage2.rs b/src/test/ui/linkage-attr/linkage2.rs index f9ea5319d54..c8af1a69979 100644 --- a/src/test/ui/linkage2.rs +++ b/src/test/ui/linkage-attr/linkage2.rs @@ -7,7 +7,7 @@ extern { #[linkage = "extern_weak"] static foo: i32; - //~^ ERROR: must have type `*const T` or `*mut T` + //~^ ERROR: must have type `*const T` or `*mut T` due to `#[linkage]` attribute } fn main() { diff --git a/src/test/ui/linkage2.stderr b/src/test/ui/linkage-attr/linkage2.stderr index 8326c0baccc..2654ffd67b6 100644 --- a/src/test/ui/linkage2.stderr +++ b/src/test/ui/linkage-attr/linkage2.stderr @@ -1,4 +1,4 @@ -error: must have type `*const T` or `*mut T` +error: must have type `*const T` or `*mut T` due to `#[linkage]` attribute --> $DIR/linkage2.rs:9:32 | LL | #[linkage = "extern_weak"] static foo: i32; diff --git a/src/test/ui/linkage3.rs b/src/test/ui/linkage-attr/linkage3.rs index 1462079acf7..1462079acf7 100644 --- a/src/test/ui/linkage3.rs +++ b/src/test/ui/linkage-attr/linkage3.rs diff --git a/src/test/ui/linkage3.stderr b/src/test/ui/linkage-attr/linkage3.stderr index b74fdc91429..b74fdc91429 100644 --- a/src/test/ui/linkage3.stderr +++ b/src/test/ui/linkage-attr/linkage3.stderr diff --git a/src/test/ui/linkage4.rs b/src/test/ui/linkage-attr/linkage4.rs index 3b935f9723d..3b935f9723d 100644 --- a/src/test/ui/linkage4.rs +++ b/src/test/ui/linkage-attr/linkage4.rs diff --git a/src/test/ui/linkage4.stderr b/src/test/ui/linkage-attr/linkage4.stderr index f2aab164bd7..f2aab164bd7 100644 --- a/src/test/ui/linkage4.stderr +++ b/src/test/ui/linkage-attr/linkage4.stderr |
