-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8129aea
commit 73fa299
Showing
19 changed files
with
119 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//@ check-pass | ||
|
||
#![feature(ergonomic_clones)] | ||
|
||
fn ergonomic_clone_closure() -> i32 { | ||
let cl = use || { | ||
1 | ||
}; | ||
cl() | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 42 additions & 34 deletions
76
tests/ui/feature-gates/feature-gate-ergonomic-clones.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,57 @@ | ||
error: incorrect use of `use` | ||
--> $DIR/feature-gate-ergonomic-clones.rs:9:14 | ||
error[E0658]: `.use` calls are experimental | ||
--> $DIR/feature-gate-ergonomic-clones.rs:2:7 | ||
| | ||
LL | let s2 = use || { | ||
| ______________^ | ||
LL | | | ||
LL | | s1 | ||
LL | | }; | ||
| |_____^ | ||
LL | x.use | ||
| ^^^ | ||
| | ||
help: `use` is a postfix operation | ||
= note: see issue #132290 <https://github.com/rust-lang/rust/issues/132290> for more information | ||
= help: add `#![feature(ergonomic_clones)]` to the crate attributes to enable | ||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | ||
|
||
error[E0658]: `.use` calls are experimental | ||
--> $DIR/feature-gate-ergonomic-clones.rs:9:14 | ||
| | ||
LL ~ let s2 = || { | ||
LL | | ||
LL | s1 | ||
LL ~ }.use; | ||
LL | let s2 = use || { | ||
| ^^^ | ||
| | ||
= note: see issue #132290 <https://github.com/rust-lang/rust/issues/132290> for more information | ||
= help: add `#![feature(ergonomic_clones)]` to the crate attributes to enable | ||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | ||
|
||
error: incorrect use of `use` | ||
error[E0658]: `.use` calls are experimental | ||
--> $DIR/feature-gate-ergonomic-clones.rs:14:14 | ||
| | ||
LL | let s3 = use || { | ||
| ______________^ | ||
LL | | | ||
LL | | s1 | ||
LL | | }; | ||
| |_____^ | ||
LL | let s3 = use || { | ||
| ^^^ | ||
| | ||
help: `use` is a postfix operation | ||
= note: see issue #132290 <https://github.com/rust-lang/rust/issues/132290> for more information | ||
= help: add `#![feature(ergonomic_clones)]` to the crate attributes to enable | ||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | ||
|
||
error[E0382]: use of moved value: `s1` | ||
--> $DIR/feature-gate-ergonomic-clones.rs:14:14 | ||
| | ||
LL ~ let s3 = || { | ||
LL | let s1 = String::from("hi!"); | ||
| -- move occurs because `s1` has type `String`, which does not implement the `Copy` trait | ||
LL | | ||
LL | let s2 = use || { | ||
| ------ value moved into closure here | ||
LL | | ||
LL | s1 | ||
LL ~ }.use; | ||
| | ||
|
||
error[E0658]: `.use` calls are experimental | ||
--> $DIR/feature-gate-ergonomic-clones.rs:2:7 | ||
| -- variable moved due to use in closure | ||
... | ||
LL | let s3 = use || { | ||
| ^^^^^^ value used here after move | ||
... | ||
LL | s1 | ||
| -- use occurs due to use in closure | ||
| | ||
LL | x.use | ||
| ^^^ | ||
help: consider cloning the value if the performance cost is acceptable | ||
| | ||
= note: see issue #132290 <https://github.com/rust-lang/rust/issues/132290> for more information | ||
= help: add `#![feature(ergonomic_clones)]` to the crate attributes to enable | ||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | ||
LL | s1.clone() | ||
| ++++++++ | ||
|
||
error: aborting due to 3 previous errors | ||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0658`. | ||
Some errors have detailed explanations: E0382, E0658. | ||
For more information about an error, try `rustc --explain E0382`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters