From 4154df8c76210d4db14675537f5fdf664b577860 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 16 Apr 2020 10:09:16 +0900 Subject: [PATCH 1/4] Add test for issue-24843 --- src/test/ui/static/auxiliary/issue_24843.rs | 1 + src/test/ui/static/issue-24843.rs | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 src/test/ui/static/auxiliary/issue_24843.rs create mode 100644 src/test/ui/static/issue-24843.rs diff --git a/src/test/ui/static/auxiliary/issue_24843.rs b/src/test/ui/static/auxiliary/issue_24843.rs new file mode 100644 index 0000000000000..6ca04f8606038 --- /dev/null +++ b/src/test/ui/static/auxiliary/issue_24843.rs @@ -0,0 +1 @@ +pub static TEST_STR: &'static str = "Hello world"; diff --git a/src/test/ui/static/issue-24843.rs b/src/test/ui/static/issue-24843.rs new file mode 100644 index 0000000000000..0b3397e210d70 --- /dev/null +++ b/src/test/ui/static/issue-24843.rs @@ -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() {} From f0f4653ce9e309b2cc675e08935fd326b5063e06 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 16 Apr 2020 10:09:34 +0900 Subject: [PATCH 2/4] Add test for issue-28575 --- src/test/ui/intrinsics/issue-28575.rs | 9 +++++++++ src/test/ui/intrinsics/issue-28575.stderr | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/test/ui/intrinsics/issue-28575.rs create mode 100644 src/test/ui/intrinsics/issue-28575.stderr diff --git a/src/test/ui/intrinsics/issue-28575.rs b/src/test/ui/intrinsics/issue-28575.rs new file mode 100644 index 0000000000000..141136d25b215 --- /dev/null +++ b/src/test/ui/intrinsics/issue-28575.rs @@ -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 +} diff --git a/src/test/ui/intrinsics/issue-28575.stderr b/src/test/ui/intrinsics/issue-28575.stderr new file mode 100644 index 0000000000000..66369decf4224 --- /dev/null +++ b/src/test/ui/intrinsics/issue-28575.stderr @@ -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`. From 2687894459ae4497a2afe79b082e38067251c093 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 16 Apr 2020 10:09:47 +0900 Subject: [PATCH 3/4] Add test for issue-54067 --- src/test/ui/asm/issue-54067.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/test/ui/asm/issue-54067.rs diff --git a/src/test/ui/asm/issue-54067.rs b/src/test/ui/asm/issue-54067.rs new file mode 100644 index 0000000000000..f2e097222bd7d --- /dev/null +++ b/src/test/ui/asm/issue-54067.rs @@ -0,0 +1,12 @@ +// check-pass +// ignore-emscripten no llvm_asm! support + +#![feature(llvm_asm)] + +pub fn boot(addr: Option) { + unsafe { + llvm_asm!("mov sp, $0"::"r" (addr)); + } +} + +fn main() {} From 61ed813c789dc5e60ec39f907e771540d7a8c1b6 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 16 Apr 2020 10:09:59 +0900 Subject: [PATCH 4/4] Add test for issue-67893 --- .../issues/auxiliary/issue_67893.rs | 10 ++++++++ src/test/ui/async-await/issues/issue-67893.rs | 11 +++++++++ .../ui/async-await/issues/issue-67893.stderr | 24 +++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 src/test/ui/async-await/issues/auxiliary/issue_67893.rs create mode 100644 src/test/ui/async-await/issues/issue-67893.rs create mode 100644 src/test/ui/async-await/issues/issue-67893.stderr diff --git a/src/test/ui/async-await/issues/auxiliary/issue_67893.rs b/src/test/ui/async-await/issues/auxiliary/issue_67893.rs new file mode 100644 index 0000000000000..387966a5064fa --- /dev/null +++ b/src/test/ui/async-await/issues/auxiliary/issue_67893.rs @@ -0,0 +1,10 @@ +// edition:2018 + +use std::sync::{Arc, Mutex}; + +pub async fn f(_: ()) {} + +pub async fn run() { + let x: Arc> = unimplemented!(); + f(*x.lock().unwrap()).await; +} diff --git a/src/test/ui/async-await/issues/issue-67893.rs b/src/test/ui/async-await/issues/issue-67893.rs new file mode 100644 index 0000000000000..9679e3807b629 --- /dev/null +++ b/src/test/ui/async-await/issues/issue-67893.rs @@ -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 +} diff --git a/src/test/ui/async-await/issues/issue-67893.stderr b/src/test/ui/async-await/issues/issue-67893.stderr new file mode 100644 index 0000000000000..567a4c91b5570 --- /dev/null +++ b/src/test/ui/async-await/issues/issue-67893.stderr @@ -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>, &'r std::sync::Mutex<()>, std::result::Result, std::sync::PoisonError>>, &'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>, &'r std::sync::Mutex<()>, std::result::Result, std::sync::PoisonError>>, &'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>, &'r std::sync::Mutex<()>, std::result::Result, std::sync::PoisonError>>, &'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`.