about summary refs log tree commit diff
path: root/tests/ui/span
diff options
context:
space:
mode:
authoryukang <moorekang@gmail.com>2023-02-28 07:55:19 +0000
committeryukang <moorekang@gmail.com>2023-02-28 07:55:19 +0000
commitf01d0c02e7fccc866c3adb7b95e96ec9b4974a37 (patch)
tree62799a2d945560f70d49742c5c65de37696cf271 /tests/ui/span
parentf0bc76ac41a0a832c9ee621e31aaf1f515d3d6a5 (diff)
downloadrust-f01d0c02e7fccc866c3adb7b95e96ec9b4974a37.tar.gz
rust-f01d0c02e7fccc866c3adb7b95e96ec9b4974a37.zip
Exit when there are unmatched delims to avoid noisy diagnostics
Diffstat (limited to 'tests/ui/span')
-rw-r--r--tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs12
-rw-r--r--tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr93
2 files changed, 6 insertions, 99 deletions
diff --git a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs
index 4559da91e47..f20024e759a 100644
--- a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs
+++ b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs
@@ -3,16 +3,10 @@
 pub struct A {}
 
 impl A {
-    async fn create(path: impl AsRef<std::path::Path>)  { //~ ERROR  `async fn` is not permitted in Rust 2015
-    //~^ WARN changes to closure capture in Rust 2021 will affect drop order [rust_2021_incompatible_closure_captures]
+    async fn create(path: impl AsRef<std::path::Path>)  {
     ;
-    crate(move || {} ).await //~ ERROR expected function, found module `crate`
+    crate(move || {} ).await
     }
 }
 
-trait C{async fn new(val: T) {} //~ ERROR  `async fn` is not permitted in Rust 2015
-//~^ ERROR functions in traits cannot be declared `async`
-//~| ERROR cannot find type `T` in this scope
-//~| WARN changes to closure capture in Rust 2021 will affect drop order [rust_2021_incompatible_closure_captures]
-
-//~ ERROR  this file contains an unclosed delimiter
+trait C{async fn new(val: T) {}  //~ ERROR this file contains an unclosed delimiter
diff --git a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr
index df1cafdb7d3..1ec8ca4275b 100644
--- a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr
+++ b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr
@@ -1,95 +1,8 @@
 error: this file contains an unclosed delimiter
-  --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:18:53
+  --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:12:85
    |
 LL | trait C{async fn new(val: T) {}
-   |        - unclosed delimiter
-...
-LL |
-   |                                                     ^
+   |        - unclosed delimiter                                                         ^
 
-error[E0670]: `async fn` is not permitted in Rust 2015
-  --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:6:5
-   |
-LL |     async fn create(path: impl AsRef<std::path::Path>)  {
-   |     ^^^^^ to use `async fn`, switch to Rust 2018 or later
-   |
-   = help: pass `--edition 2021` to `rustc`
-   = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0670]: `async fn` is not permitted in Rust 2015
-  --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:9
-   |
-LL | trait C{async fn new(val: T) {}
-   |         ^^^^^ to use `async fn`, switch to Rust 2018 or later
-   |
-   = help: pass `--edition 2021` to `rustc`
-   = note: for more on editions, read https://doc.rust-lang.org/edition-guide
-
-error[E0412]: cannot find type `T` in this scope
-  --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:27
-   |
-LL | pub struct A {}
-   | ------------ similarly named struct `A` defined here
-...
-LL | trait C{async fn new(val: T) {}
-   |                           ^ help: a struct with a similar name exists: `A`
-
-error[E0706]: functions in traits cannot be declared `async`
-  --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:9
-   |
-LL | trait C{async fn new(val: T) {}
-   |         -----^^^^^^^^^^^^^^^
-   |         |
-   |         `async` because of this
-   |
-   = note: `async` trait functions are not currently supported
-   = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
-   = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
-   = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
-
-error[E0423]: expected function, found module `crate`
-  --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:9:5
-   |
-LL |     crate(move || {} ).await
-   |     ^^^^^ not a function
-
-warning: changes to closure capture in Rust 2021 will affect drop order
-  --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:6:57
-   |
-LL |       async fn create(path: impl AsRef<std::path::Path>)  {
-   |  _____________________----_____________________________-__^
-   | |                     |                                |
-   | |                     |                                in Rust 2018, `path` is dropped here along with the closure, but in Rust 2021 `path` is not part of the closure
-   | |                     in Rust 2018, this causes the closure to capture `path`, but in Rust 2021, it has no effect
-LL | |
-LL | |     ;
-LL | |     crate(move || {} ).await
-LL | |     }
-   | |_____^
-   |
-   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
-   = note: requested on the command line with `-W rust-2021-incompatible-closure-captures`
-help: add a dummy let to cause `path` to be fully captured
-   |
-LL |     async fn create(path: impl AsRef<std::path::Path>)  { let _ = &path;
-   |                                                           ++++++++++++++
-
-warning: changes to closure capture in Rust 2021 will affect drop order
-  --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:30
-   |
-LL | trait C{async fn new(val: T) {}
-   |                      ---   - ^^
-   |                      |     |
-   |                      |     in Rust 2018, `val` is dropped here along with the closure, but in Rust 2021 `val` is not part of the closure
-   |                      in Rust 2018, this causes the closure to capture `val`, but in Rust 2021, it has no effect
-   |
-   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
-help: add a dummy let to cause `val` to be fully captured
-   |
-LL | trait C{async fn new(val: T) { let _ = &val;}
-   |                                +++++++++++++
-
-error: aborting due to 6 previous errors; 2 warnings emitted
+error: aborting due to previous error
 
-Some errors have detailed explanations: E0412, E0423, E0670, E0706.
-For more information about an error, try `rustc --explain E0412`.