-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests, suppress refine lint when errors
- Loading branch information
1 parent
9b53b64
commit 7b0e962
Showing
3 changed files
with
37 additions
and
1 deletion.
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
14 changes: 14 additions & 0 deletions
14
tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.rs
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,14 @@ | ||
#![feature(precise_capturing)] | ||
|
||
struct Invariant<'a>(&'a mut &'a mut ()); | ||
|
||
trait Trait { | ||
fn hello(self_: Invariant<'_>) -> impl Sized + use<Self>; | ||
} | ||
|
||
impl Trait for () { | ||
fn hello(self_: Invariant<'_>) -> impl Sized + use<'_> {} | ||
//~^ return type captures more lifetimes than trait definition | ||
} | ||
|
||
fn main() {} |
17 changes: 17 additions & 0 deletions
17
tests/ui/impl-trait/precise-capturing/rpitit-impl-captures-too-much.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,17 @@ | ||
error: return type captures more lifetimes than trait definition | ||
--> $DIR/rpitit-impl-captures-too-much.rs:10:39 | ||
| | ||
LL | fn hello(self_: Invariant<'_>) -> impl Sized + use<'_> {} | ||
| -- ^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| this lifetime was captured | ||
| | ||
note: hidden type must only reference lifetimes captured by this impl trait | ||
--> $DIR/rpitit-impl-captures-too-much.rs:6:39 | ||
| | ||
LL | fn hello(self_: Invariant<'_>) -> impl Sized + use<Self>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: hidden type inferred to be `impl Sized` | ||
|
||
error: aborting due to 1 previous error | ||
|