Skip to content

Commit c3c96eb

Browse files
authored
Rollup merge of #71182 - JohnTitor:regression-tests, r=Mark-Simulacrum
Add some regression tests Closes #24843 Closes #28575 Closes #54067 Closes #67893 Closes #68813 I'm not sure who's the best person to ask to review since Centril is taking a break now.
2 parents 909a2e4 + 61ed813 commit c3c96eb

File tree

8 files changed

+86
-0
lines changed

8 files changed

+86
-0
lines changed

src/test/ui/asm/issue-54067.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// check-pass
2+
// ignore-emscripten no llvm_asm! support
3+
4+
#![feature(llvm_asm)]
5+
6+
pub fn boot(addr: Option<u32>) {
7+
unsafe {
8+
llvm_asm!("mov sp, $0"::"r" (addr));
9+
}
10+
}
11+
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// edition:2018
2+
3+
use std::sync::{Arc, Mutex};
4+
5+
pub async fn f(_: ()) {}
6+
7+
pub async fn run() {
8+
let x: Arc<Mutex<()>> = unimplemented!();
9+
f(*x.lock().unwrap()).await;
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// aux-build: issue_67893.rs
2+
// edition:2018
3+
4+
extern crate issue_67893;
5+
6+
fn g(_: impl Send) {}
7+
8+
fn main() {
9+
g(issue_67893::run())
10+
//~^ ERROR: `std::sync::MutexGuard<'_, ()>` cannot be sent between threads safely
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
error[E0277]: `std::sync::MutexGuard<'_, ()>` cannot be sent between threads safely
2+
--> $DIR/issue-67893.rs:9:5
3+
|
4+
LL | fn g(_: impl Send) {}
5+
| ---- required by this bound in `g`
6+
...
7+
LL | g(issue_67893::run())
8+
| ^ `std::sync::MutexGuard<'_, ()>` cannot be sent between threads safely
9+
|
10+
::: $DIR/auxiliary/issue_67893.rs:7:20
11+
|
12+
LL | pub async fn run() {
13+
| - within this `impl std::future::Future`
14+
|
15+
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `std::sync::MutexGuard<'_, ()>`
16+
= 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}`
17+
= 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}]`
18+
= 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}]>`
19+
= note: required because it appears within the type `impl std::future::Future`
20+
= note: required because it appears within the type `impl std::future::Future`
21+
22+
error: aborting due to previous error
23+
24+
For more information about this error, try `rustc --explain E0277`.

src/test/ui/intrinsics/issue-28575.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![feature(intrinsics)]
2+
3+
extern "C" {
4+
pub static FOO: extern "rust-intrinsic" fn();
5+
}
6+
7+
fn main() {
8+
FOO() //~ ERROR: use of extern static is unsafe
9+
}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0133]: use of extern static is unsafe and requires unsafe function or block
2+
--> $DIR/issue-28575.rs:8:5
3+
|
4+
LL | FOO()
5+
| ^^^ use of extern static
6+
|
7+
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0133`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub static TEST_STR: &'static str = "Hello world";

src/test/ui/static/issue-24843.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// aux-build: issue_24843.rs
2+
// check-pass
3+
4+
extern crate issue_24843;
5+
6+
static _TEST_STR_2: &'static str = &issue_24843::TEST_STR;
7+
8+
fn main() {}

0 commit comments

Comments
 (0)