Skip to content

Commit

Permalink
Rollup merge of rust-lang#71182 - JohnTitor:regression-tests, r=Mark-…
Browse files Browse the repository at this point in the history
…Simulacrum

Add some regression tests

Closes rust-lang#24843
Closes rust-lang#28575
Closes rust-lang#54067
Closes rust-lang#67893
Closes rust-lang#68813

I'm not sure who's the best person to ask to review since Centril is taking a break now.
  • Loading branch information
Dylan-DPC authored Apr 16, 2020
2 parents 909a2e4 + 61ed813 commit c3c96eb
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/ui/asm/issue-54067.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// check-pass
// ignore-emscripten no llvm_asm! support

#![feature(llvm_asm)]

pub fn boot(addr: Option<u32>) {
unsafe {
llvm_asm!("mov sp, $0"::"r" (addr));
}
}

fn main() {}
10 changes: 10 additions & 0 deletions src/test/ui/async-await/issues/auxiliary/issue_67893.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// edition:2018

use std::sync::{Arc, Mutex};

pub async fn f(_: ()) {}

pub async fn run() {
let x: Arc<Mutex<()>> = unimplemented!();
f(*x.lock().unwrap()).await;
}
11 changes: 11 additions & 0 deletions src/test/ui/async-await/issues/issue-67893.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// aux-build: issue_67893.rs
// edition:2018

extern crate issue_67893;

fn g(_: impl Send) {}

fn main() {
g(issue_67893::run())
//~^ ERROR: `std::sync::MutexGuard<'_, ()>` cannot be sent between threads safely
}
24 changes: 24 additions & 0 deletions src/test/ui/async-await/issues/issue-67893.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
error[E0277]: `std::sync::MutexGuard<'_, ()>` cannot be sent between threads safely
--> $DIR/issue-67893.rs:9:5
|
LL | fn g(_: impl Send) {}
| ---- required by this bound in `g`
...
LL | g(issue_67893::run())
| ^ `std::sync::MutexGuard<'_, ()>` cannot be sent between threads safely
|
::: $DIR/auxiliary/issue_67893.rs:7:20
|
LL | pub async fn run() {
| - within this `impl std::future::Future`
|
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::sync::MutexGuard<'_, ()>`
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3> {std::future::ResumeTy, std::sync::Arc<std::sync::Mutex<()>>, &'r std::sync::Mutex<()>, std::result::Result<std::sync::MutexGuard<'s, ()>, std::sync::PoisonError<std::sync::MutexGuard<'t0, ()>>>, &'t1 std::sync::MutexGuard<'t2, ()>, std::sync::MutexGuard<'t3, ()>, (), impl std::future::Future}`
= note: required because it appears within the type `[static generator@DefId(15:11 ~ issue_67893[8787]::run[0]::{{closure}}[0]) for<'r, 's, 't0, 't1, 't2, 't3> {std::future::ResumeTy, std::sync::Arc<std::sync::Mutex<()>>, &'r std::sync::Mutex<()>, std::result::Result<std::sync::MutexGuard<'s, ()>, std::sync::PoisonError<std::sync::MutexGuard<'t0, ()>>>, &'t1 std::sync::MutexGuard<'t2, ()>, std::sync::MutexGuard<'t3, ()>, (), impl std::future::Future}]`
= note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@DefId(15:11 ~ issue_67893[8787]::run[0]::{{closure}}[0]) for<'r, 's, 't0, 't1, 't2, 't3> {std::future::ResumeTy, std::sync::Arc<std::sync::Mutex<()>>, &'r std::sync::Mutex<()>, std::result::Result<std::sync::MutexGuard<'s, ()>, std::sync::PoisonError<std::sync::MutexGuard<'t0, ()>>>, &'t1 std::sync::MutexGuard<'t2, ()>, std::sync::MutexGuard<'t3, ()>, (), impl std::future::Future}]>`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `impl std::future::Future`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
9 changes: 9 additions & 0 deletions src/test/ui/intrinsics/issue-28575.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#![feature(intrinsics)]

extern "C" {
pub static FOO: extern "rust-intrinsic" fn();
}

fn main() {
FOO() //~ ERROR: use of extern static is unsafe
}
11 changes: 11 additions & 0 deletions src/test/ui/intrinsics/issue-28575.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/issue-28575.rs:8:5
|
LL | FOO()
| ^^^ 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: aborting due to previous error

For more information about this error, try `rustc --explain E0133`.
1 change: 1 addition & 0 deletions src/test/ui/static/auxiliary/issue_24843.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub static TEST_STR: &'static str = "Hello world";
8 changes: 8 additions & 0 deletions src/test/ui/static/issue-24843.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// aux-build: issue_24843.rs
// check-pass

extern crate issue_24843;

static _TEST_STR_2: &'static str = &issue_24843::TEST_STR;

fn main() {}

0 comments on commit c3c96eb

Please sign in to comment.