Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

ices/93117.sh: fixed with errors #1329

Merged
merged 1 commit into from
Jul 2, 2022
Merged

ices/93117.sh: fixed with errors #1329

merged 1 commit into from
Jul 2, 2022

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Jul 2, 2022

Issue: rust-lang/rust#93117

#!/usr/bin/env bash

rustc --crate-type lib -Wrust-2021-incompatible-closure-captures - 2>&1 << EOF

pub struct A {}

impl A {
    async fn create(path: impl AsRef<std::path::Path>)  {
    ;
    crate(move || {} ).await
    }
}


EOF
=== stdout ===
error[E0670]: `async fn` is not permitted in Rust 2015
 --> <anon>:5:5
  |
5 |     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[E0423]: expected function, found module `crate`
 --> <anon>:7:5
  |
7 |     crate(move || {} ).await
  |     ^^^^^ not a function

warning: unnecessary trailing semicolon
 --> <anon>:6:5
  |
6 |     ;
  |     ^ help: remove this semicolon
  |
  = note: `#[warn(redundant_semicolons)]` on by default

warning: changes to closure capture in Rust 2021 will affect drop order
 --> <anon>:5:57
  |
5 |       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
6 | |     ;
7 | |     crate(move || {} ).await
8 | |     }
  | |_____^
  |
  = note: requested on the command line with `-W rust-2021-incompatible-closure-captures`
  = 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 `path` to be fully captured
  |
5 ~     async fn create(path: impl AsRef<std::path::Path>)  {
6 +     let _ = &path;
  |

error: aborting due to 2 previous errors; 2 warnings emitted

Some errors have detailed explanations: E0423, E0670.
For more information about an error, try `rustc --explain E0423`.
=== stderr ===
==============

=== stdout ===
error[E0670]: `async fn` is not permitted in Rust 2015
 --> <anon>:5:5
  |
5 |     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[E0423]: expected function, found module `crate`
 --> <anon>:7:5
  |
7 |     crate(move || {} ).await
  |     ^^^^^ not a function

warning: unnecessary trailing semicolon
 --> <anon>:6:5
  |
6 |     ;
  |     ^ help: remove this semicolon
  |
  = note: `#[warn(redundant_semicolons)]` on by default

warning: changes to closure capture in Rust 2021 will affect drop order
 --> <anon>:5:57
  |
5 |       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
6 | |     ;
7 | |     crate(move || {} ).await
8 | |     }
  | |_____^
  |
  = note: requested on the command line with `-W rust-2021-incompatible-closure-captures`
  = 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 `path` to be fully captured
  |
5 ~     async fn create(path: impl AsRef<std::path::Path>)  {
6 +     let _ = &path;
  |

error: aborting due to 2 previous errors; 2 warnings emitted

Some errors have detailed explanations: E0423, E0670.
For more information about an error, try `rustc --explain E0423`.
=== stderr ===
==============
@JohnTitor JohnTitor merged commit df9092a into master Jul 2, 2022
@JohnTitor JohnTitor deleted the autofix/ices/93117.sh branch July 2, 2022 05:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants