diff options
| author | David Wood <david.wood2@arm.com> | 2025-01-07 11:27:04 +0000 |
|---|---|---|
| committer | David Wood <david.wood2@arm.com> | 2025-01-10 18:37:57 +0000 |
| commit | cc9a9ecccb2fbbb7687ed076e06411c2f4ac5fbb (patch) | |
| tree | c2ac8174b0be897938a5a801c58a97a87eee2b1d /tests/ui/force-inlining | |
| parent | ce602acfc22724c30b6154f650225d2e1d1550ed (diff) | |
| download | rust-cc9a9ecccb2fbbb7687ed076e06411c2f4ac5fbb.tar.gz rust-cc9a9ecccb2fbbb7687ed076e06411c2f4ac5fbb.zip | |
mir_build: check annotated functions w/out callers
Diffstat (limited to 'tests/ui/force-inlining')
| -rw-r--r-- | tests/ui/force-inlining/deny-async.rs | 5 | ||||
| -rw-r--r-- | tests/ui/force-inlining/deny-async.stderr | 27 | ||||
| -rw-r--r-- | tests/ui/force-inlining/deny-closure.rs | 7 | ||||
| -rw-r--r-- | tests/ui/force-inlining/deny-closure.stderr | 36 | ||||
| -rw-r--r-- | tests/ui/force-inlining/deny.rs | 7 | ||||
| -rw-r--r-- | tests/ui/force-inlining/deny.stderr | 27 | ||||
| -rw-r--r-- | tests/ui/force-inlining/early-deny.rs | 21 | ||||
| -rw-r--r-- | tests/ui/force-inlining/early-deny.stderr | 35 |
8 files changed, 112 insertions, 53 deletions
diff --git a/tests/ui/force-inlining/deny-async.rs b/tests/ui/force-inlining/deny-async.rs index d5b6dc000f7..bdf6271bd2a 100644 --- a/tests/ui/force-inlining/deny-async.rs +++ b/tests/ui/force-inlining/deny-async.rs @@ -8,18 +8,17 @@ #[rustc_no_mir_inline] #[rustc_force_inline] +//~^ ERROR `callee` is incompatible with `#[rustc_force_inline]` pub fn callee() { } #[rustc_no_mir_inline] #[rustc_force_inline = "the test requires it"] +//~^ ERROR `callee_justified` is incompatible with `#[rustc_force_inline]` pub fn callee_justified() { } async fn async_caller() { callee(); -//~^ ERROR `callee` could not be inlined into `async_caller::{closure#0}` but is required to be inlined - callee_justified(); -//~^ ERROR `callee_justified` could not be inlined into `async_caller::{closure#0}` but is required to be inlined } diff --git a/tests/ui/force-inlining/deny-async.stderr b/tests/ui/force-inlining/deny-async.stderr index 7b077174ee8..302ca419071 100644 --- a/tests/ui/force-inlining/deny-async.stderr +++ b/tests/ui/force-inlining/deny-async.stderr @@ -1,19 +1,24 @@ -error: `callee` could not be inlined into `async_caller::{closure#0}` but is required to be inlined - --> $DIR/deny-async.rs:20:5 +error: `callee` is incompatible with `#[rustc_force_inline]` + --> $DIR/deny-async.rs:10:1 | -LL | callee(); - | ^^^^^^^^ ...`callee` called here +LL | #[rustc_force_inline] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | pub fn callee() { + | --------------- `callee` defined here | - = note: could not be inlined due to: #[rustc_no_mir_inline] + = note: incompatible due to: #[rustc_no_mir_inline] -error: `callee_justified` could not be inlined into `async_caller::{closure#0}` but is required to be inlined - --> $DIR/deny-async.rs:23:5 +error: `callee_justified` is incompatible with `#[rustc_force_inline]` + --> $DIR/deny-async.rs:16:1 | -LL | callee_justified(); - | ^^^^^^^^^^^^^^^^^^ ...`callee_justified` called here +LL | #[rustc_force_inline = "the test requires it"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | pub fn callee_justified() { + | ------------------------- `callee_justified` defined here | - = note: could not be inlined due to: #[rustc_no_mir_inline] - = note: `callee_justified` is required to be inlined to: the test requires it + = note: incompatible due to: #[rustc_no_mir_inline] error: aborting due to 2 previous errors diff --git a/tests/ui/force-inlining/deny-closure.rs b/tests/ui/force-inlining/deny-closure.rs index 0057f1e7854..31314c450fc 100644 --- a/tests/ui/force-inlining/deny-closure.rs +++ b/tests/ui/force-inlining/deny-closure.rs @@ -1,4 +1,4 @@ -//@ build-fail +//@ check-fail //@ compile-flags: --crate-type=lib #![allow(internal_features)] #![feature(rustc_attrs)] @@ -7,20 +7,19 @@ #[rustc_no_mir_inline] #[rustc_force_inline] +//~^ ERROR `callee` is incompatible with `#[rustc_force_inline]` pub fn callee() { } #[rustc_no_mir_inline] #[rustc_force_inline = "the test requires it"] +//~^ ERROR `callee_justified` is incompatible with `#[rustc_force_inline]` pub fn callee_justified() { } pub fn caller() { (|| { callee(); -//~^ ERROR `callee` could not be inlined into `caller::{closure#0}` but is required to be inlined - callee_justified(); -//~^ ERROR `callee_justified` could not be inlined into `caller::{closure#0}` but is required to be inlined })(); } diff --git a/tests/ui/force-inlining/deny-closure.stderr b/tests/ui/force-inlining/deny-closure.stderr index 7d42145f1c8..e657a295420 100644 --- a/tests/ui/force-inlining/deny-closure.stderr +++ b/tests/ui/force-inlining/deny-closure.stderr @@ -1,28 +1,24 @@ -error: `callee` could not be inlined into `caller::{closure#0}` but is required to be inlined - --> $DIR/deny-closure.rs:20:9 +error: `callee` is incompatible with `#[rustc_force_inline]` + --> $DIR/deny-closure.rs:9:1 | -LL | callee(); - | ^^^^^^^^ ...`callee` called here +LL | #[rustc_force_inline] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | pub fn callee() { + | --------------- `callee` defined here | - = note: could not be inlined due to: #[rustc_no_mir_inline] + = note: incompatible due to: #[rustc_no_mir_inline] -error: `callee_justified` could not be inlined into `caller::{closure#0}` but is required to be inlined - --> $DIR/deny-closure.rs:23:9 +error: `callee_justified` is incompatible with `#[rustc_force_inline]` + --> $DIR/deny-closure.rs:15:1 | -LL | callee_justified(); - | ^^^^^^^^^^^^^^^^^^ ...`callee_justified` called here +LL | #[rustc_force_inline = "the test requires it"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | pub fn callee_justified() { + | ------------------------- `callee_justified` defined here | - = note: could not be inlined due to: #[rustc_no_mir_inline] - = note: `callee_justified` is required to be inlined to: the test requires it - -note: the above error was encountered while instantiating `fn caller::{closure#0}` - --> $DIR/deny-closure.rs:19:5 - | -LL | / (|| { -LL | | callee(); -... | -LL | | })(); - | |________^ + = note: incompatible due to: #[rustc_no_mir_inline] error: aborting due to 2 previous errors diff --git a/tests/ui/force-inlining/deny.rs b/tests/ui/force-inlining/deny.rs index a19e820cff2..7712f5f50f3 100644 --- a/tests/ui/force-inlining/deny.rs +++ b/tests/ui/force-inlining/deny.rs @@ -1,4 +1,4 @@ -//@ build-fail +//@ check-fail //@ compile-flags: --crate-type=lib #![allow(internal_features)] #![feature(rustc_attrs)] @@ -7,18 +7,17 @@ #[rustc_no_mir_inline] #[rustc_force_inline] +//~^ ERROR `callee` is incompatible with `#[rustc_force_inline]` pub fn callee() { } #[rustc_no_mir_inline] #[rustc_force_inline = "the test requires it"] +//~^ ERROR `callee_justified` is incompatible with `#[rustc_force_inline]` pub fn callee_justified() { } pub fn caller() { callee(); -//~^ ERROR `callee` could not be inlined into `caller` but is required to be inlined - callee_justified(); -//~^ ERROR `callee_justified` could not be inlined into `caller` but is required to be inlined } diff --git a/tests/ui/force-inlining/deny.stderr b/tests/ui/force-inlining/deny.stderr index 3983bead182..c276fa28ba8 100644 --- a/tests/ui/force-inlining/deny.stderr +++ b/tests/ui/force-inlining/deny.stderr @@ -1,19 +1,24 @@ -error: `callee` could not be inlined into `caller` but is required to be inlined - --> $DIR/deny.rs:19:5 +error: `callee` is incompatible with `#[rustc_force_inline]` + --> $DIR/deny.rs:9:1 | -LL | callee(); - | ^^^^^^^^ ...`callee` called here +LL | #[rustc_force_inline] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | pub fn callee() { + | --------------- `callee` defined here | - = note: could not be inlined due to: #[rustc_no_mir_inline] + = note: incompatible due to: #[rustc_no_mir_inline] -error: `callee_justified` could not be inlined into `caller` but is required to be inlined - --> $DIR/deny.rs:22:5 +error: `callee_justified` is incompatible with `#[rustc_force_inline]` + --> $DIR/deny.rs:15:1 | -LL | callee_justified(); - | ^^^^^^^^^^^^^^^^^^ ...`callee_justified` called here +LL | #[rustc_force_inline = "the test requires it"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | pub fn callee_justified() { + | ------------------------- `callee_justified` defined here | - = note: could not be inlined due to: #[rustc_no_mir_inline] - = note: `callee_justified` is required to be inlined to: the test requires it + = note: incompatible due to: #[rustc_no_mir_inline] error: aborting due to 2 previous errors diff --git a/tests/ui/force-inlining/early-deny.rs b/tests/ui/force-inlining/early-deny.rs new file mode 100644 index 00000000000..99b03a4e0e2 --- /dev/null +++ b/tests/ui/force-inlining/early-deny.rs @@ -0,0 +1,21 @@ +//@ check-fail +//@ compile-flags: --crate-type=lib +#![feature(c_variadic)] +#![feature(rustc_attrs)] + +#[rustc_no_mir_inline] +#[rustc_force_inline] +//~^ ERROR `rustc_attr` is incompatible with `#[rustc_force_inline]` +pub fn rustc_attr() { +} + +#[cold] +#[rustc_force_inline] +//~^ ERROR `cold` is incompatible with `#[rustc_force_inline]` +pub fn cold() { +} + +#[rustc_force_inline] +//~^ ERROR `variadic` is incompatible with `#[rustc_force_inline]` +pub unsafe extern "C" fn variadic(args: ...) { +} diff --git a/tests/ui/force-inlining/early-deny.stderr b/tests/ui/force-inlining/early-deny.stderr new file mode 100644 index 00000000000..abee66fd293 --- /dev/null +++ b/tests/ui/force-inlining/early-deny.stderr @@ -0,0 +1,35 @@ +error: `rustc_attr` is incompatible with `#[rustc_force_inline]` + --> $DIR/early-deny.rs:7:1 + | +LL | #[rustc_force_inline] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | pub fn rustc_attr() { + | ------------------- `rustc_attr` defined here + | + = note: incompatible due to: #[rustc_no_mir_inline] + +error: `cold` is incompatible with `#[rustc_force_inline]` + --> $DIR/early-deny.rs:13:1 + | +LL | #[rustc_force_inline] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | pub fn cold() { + | ------------- `cold` defined here + | + = note: incompatible due to: cold + +error: `variadic` is incompatible with `#[rustc_force_inline]` + --> $DIR/early-deny.rs:18:1 + | +LL | #[rustc_force_inline] + | ^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | pub unsafe extern "C" fn variadic(args: ...) { + | -------------------------------------------- `variadic` defined here + | + = note: incompatible due to: C variadic + +error: aborting due to 3 previous errors + |
