forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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
dd557d8
commit 6521c39
Showing
12 changed files
with
107 additions
and
45 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
20 changes: 20 additions & 0 deletions
20
tests/ui/impl-trait/precise-capturing/redundant.normal.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
warning: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant | ||
--> $DIR/redundant.rs:7:19 | ||
| | ||
LL | fn hello<'a>() -> impl Sized + use<'a> {} | ||
| ^^^^^^^^^^^^^------- | ||
| | | ||
| help: remove the `use<...>` syntax | ||
| | ||
= note: `#[warn(impl_trait_redundant_captures)]` on by default | ||
|
||
warning: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant | ||
--> $DIR/redundant.rs:12:27 | ||
| | ||
LL | fn inherent(&self) -> impl Sized + use<'_> {} | ||
| ^^^^^^^^^^^^^------- | ||
| | | ||
| help: remove the `use<...>` syntax | ||
|
||
warning: 2 warnings emitted | ||
|
18 changes: 18 additions & 0 deletions
18
tests/ui/impl-trait/precise-capturing/redundant.rpitit.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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error: `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits | ||
--> $DIR/redundant.rs:18:35 | ||
| | ||
LL | fn in_trait() -> impl Sized + use<'a, Self>; | ||
| ^^^^^^^^^^^^^ | ||
| | ||
= note: currently, return-position `impl Trait` in traits and trait implementations capture all lifetimes in scope | ||
|
||
error: `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits | ||
--> $DIR/redundant.rs:23:35 | ||
| | ||
LL | fn in_trait() -> impl Sized + use<'a> {} | ||
| ^^^^^^^ | ||
| | ||
= note: currently, return-position `impl Trait` in traits and trait implementations capture all lifetimes in scope | ||
|
||
error: aborting due to 2 previous errors | ||
|
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,24 +1,27 @@ | ||
//@ compile-flags: -Zunstable-options --edition=2024 | ||
//@ check-pass | ||
//@ revisions: normal rpitit | ||
//@[normal] check-pass | ||
|
||
#![feature(precise_capturing)] | ||
|
||
fn hello<'a>() -> impl Sized + use<'a> {} | ||
//~^ WARN all possible in-scope parameters are already captured | ||
//[normal]~^ WARN all possible in-scope parameters are already captured | ||
|
||
struct Inherent; | ||
impl Inherent { | ||
fn inherent(&self) -> impl Sized + use<'_> {} | ||
//~^ WARN all possible in-scope parameters are already captured | ||
//[normal]~^ WARN all possible in-scope parameters are already captured | ||
} | ||
|
||
#[cfg(rpitit)] | ||
trait Test<'a> { | ||
fn in_trait() -> impl Sized + use<'a, Self>; | ||
//~^ WARN all possible in-scope parameters are already captured | ||
//[rpitit]~^ ERROR `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits | ||
} | ||
#[cfg(rpitit)] | ||
impl<'a> Test<'a> for () { | ||
fn in_trait() -> impl Sized + use<'a> {} | ||
//~^ WARN all possible in-scope parameters are already captured | ||
//[rpitit]~^ ERROR `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits | ||
} | ||
|
||
fn main() {} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
//@ check-pass | ||
|
||
#![feature(precise_capturing)] | ||
|
||
trait Foo { | ||
fn bar<'a>() -> impl Sized + use<Self>; | ||
//~^ ERROR `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error: `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits | ||
--> $DIR/self-capture.rs:4:34 | ||
| | ||
LL | fn bar<'a>() -> impl Sized + use<Self>; | ||
| ^^^^^^^^^ | ||
| | ||
= note: currently, return-position `impl Trait` in traits and trait implementations capture all lifetimes in scope | ||
|
||
error: aborting due to 1 previous error | ||
|