diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2024-04-26 18:35:54 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2024-06-04 14:19:42 -0300 |
| commit | bbddc9b58f3b2fcf1b624c2d0cabd49461f94575 (patch) | |
| tree | e3512342f9e0b6e281870c861b2ee6312d1e5cea /tests/ui/parser | |
| parent | 3ba8de0b601ee1eaae710510ee8b0b8a9dbd78d8 (diff) | |
Allow using unsafe on functions inside extern blocks
Diffstat (limited to 'tests/ui/parser')
| -rw-r--r-- | tests/ui/parser/fn-header-semantic-fail.rs | 6 | ||||
| -rw-r--r-- | tests/ui/parser/fn-header-semantic-fail.stderr | 20 | ||||
| -rw-r--r-- | tests/ui/parser/no-const-fn-in-extern-block.rs | 1 | ||||
| -rw-r--r-- | tests/ui/parser/no-const-fn-in-extern-block.stderr | 11 | ||||
| -rw-r--r-- | tests/ui/parser/unsafe-foreign-mod-2.rs | 1 | ||||
| -rw-r--r-- | tests/ui/parser/unsafe-foreign-mod-2.stderr | 11 |
6 files changed, 6 insertions, 44 deletions
diff --git a/tests/ui/parser/fn-header-semantic-fail.rs b/tests/ui/parser/fn-header-semantic-fail.rs index 6ed173b6854..3b98433cdd8 100644 --- a/tests/ui/parser/fn-header-semantic-fail.rs +++ b/tests/ui/parser/fn-header-semantic-fail.rs @@ -44,11 +44,11 @@ fn main() { extern "C" { async fn fe1(); //~ ERROR functions in `extern` blocks cannot have qualifiers - unsafe fn fe2(); //~ ERROR functions in `extern` blocks cannot have qualifiers + unsafe fn fe2(); const fn fe3(); //~ ERROR functions in `extern` blocks cannot have qualifiers extern "C" fn fe4(); //~ ERROR functions in `extern` blocks cannot have qualifiers - const async unsafe extern "C" fn fe5(); //~ ERROR functions in `extern` blocks - //~| ERROR functions in `extern` blocks + const async unsafe extern "C" fn fe5(); + //~^ ERROR functions in `extern` blocks //~| ERROR functions in `extern` blocks //~| ERROR functions in `extern` blocks //~| ERROR functions cannot be both `const` and `async` diff --git a/tests/ui/parser/fn-header-semantic-fail.stderr b/tests/ui/parser/fn-header-semantic-fail.stderr index cfc54839eb7..dc2a216754d 100644 --- a/tests/ui/parser/fn-header-semantic-fail.stderr +++ b/tests/ui/parser/fn-header-semantic-fail.stderr @@ -79,15 +79,6 @@ LL | async fn fe1(); | ^^^^^ help: remove this qualifier error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:47:9 - | -LL | extern "C" { - | ---------- in this `extern` block -LL | async fn fe1(); -LL | unsafe fn fe2(); - | ^^^^^^ help: remove this qualifier - -error: functions in `extern` blocks cannot have qualifiers --> $DIR/fn-header-semantic-fail.rs:48:9 | LL | extern "C" { @@ -106,15 +97,6 @@ LL | extern "C" fn fe4(); | ^^^^^^^^^^ help: remove this qualifier error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:50:21 - | -LL | extern "C" { - | ---------- in this `extern` block -... -LL | const async unsafe extern "C" fn fe5(); - | ^^^^^^ help: remove this qualifier - -error: functions in `extern` blocks cannot have qualifiers --> $DIR/fn-header-semantic-fail.rs:50:15 | LL | extern "C" { @@ -150,6 +132,6 @@ LL | const async unsafe extern "C" fn fe5(); | | `async` because of this | `const` because of this -error: aborting due to 17 previous errors +error: aborting due to 15 previous errors For more information about this error, try `rustc --explain E0379`. diff --git a/tests/ui/parser/no-const-fn-in-extern-block.rs b/tests/ui/parser/no-const-fn-in-extern-block.rs index d6c578681cc..1993124edc3 100644 --- a/tests/ui/parser/no-const-fn-in-extern-block.rs +++ b/tests/ui/parser/no-const-fn-in-extern-block.rs @@ -3,7 +3,6 @@ extern "C" { //~^ ERROR functions in `extern` blocks cannot have qualifiers const unsafe fn bar(); //~^ ERROR functions in `extern` blocks cannot have qualifiers - //~| ERROR functions in `extern` blocks cannot have qualifiers } fn main() {} diff --git a/tests/ui/parser/no-const-fn-in-extern-block.stderr b/tests/ui/parser/no-const-fn-in-extern-block.stderr index 948ce669112..2dec6f76931 100644 --- a/tests/ui/parser/no-const-fn-in-extern-block.stderr +++ b/tests/ui/parser/no-const-fn-in-extern-block.stderr @@ -7,15 +7,6 @@ LL | const fn foo(); | ^^^^^ help: remove this qualifier error: functions in `extern` blocks cannot have qualifiers - --> $DIR/no-const-fn-in-extern-block.rs:4:11 - | -LL | extern "C" { - | ---------- in this `extern` block -... -LL | const unsafe fn bar(); - | ^^^^^^ help: remove this qualifier - -error: functions in `extern` blocks cannot have qualifiers --> $DIR/no-const-fn-in-extern-block.rs:4:5 | LL | extern "C" { @@ -24,5 +15,5 @@ LL | extern "C" { LL | const unsafe fn bar(); | ^^^^^ help: remove this qualifier -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/parser/unsafe-foreign-mod-2.rs b/tests/ui/parser/unsafe-foreign-mod-2.rs index c0994090eff..6d339cd9088 100644 --- a/tests/ui/parser/unsafe-foreign-mod-2.rs +++ b/tests/ui/parser/unsafe-foreign-mod-2.rs @@ -1,7 +1,6 @@ extern "C" unsafe { //~^ ERROR expected `{`, found keyword `unsafe` unsafe fn foo(); - //~^ ERROR functions in `extern` blocks cannot have qualifiers } fn main() {} diff --git a/tests/ui/parser/unsafe-foreign-mod-2.stderr b/tests/ui/parser/unsafe-foreign-mod-2.stderr index 620d042540e..0625e3362ed 100644 --- a/tests/ui/parser/unsafe-foreign-mod-2.stderr +++ b/tests/ui/parser/unsafe-foreign-mod-2.stderr @@ -4,14 +4,5 @@ error: expected `{`, found keyword `unsafe` LL | extern "C" unsafe { | ^^^^^^ expected `{` -error: functions in `extern` blocks cannot have qualifiers - --> $DIR/unsafe-foreign-mod-2.rs:3:5 - | -LL | extern "C" unsafe { - | ----------------- in this `extern` block -LL | -LL | unsafe fn foo(); - | ^^^^^^ help: remove this qualifier - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error |
