Skip to content

Commit

Permalink
diagnostics: update test cases to refer to assoc fn with self as me…
Browse files Browse the repository at this point in the history
…thod
  • Loading branch information
notriddle committed Feb 22, 2023
1 parent 3d056c3 commit 3f37412
Show file tree
Hide file tree
Showing 133 changed files with 650 additions and 636 deletions.
2 changes: 1 addition & 1 deletion tests/ui/argument-suggestions/too-long.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | qux.foo(a, b, c, d, e, f, g, h, i, j, k, l);
| |
| arguments to this method are incorrect
|
note: associated function defined here
note: method defined here
--> $DIR/too-long.rs:4:8
|
LL | fn foo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ LL | fn f() { ModelT.chip_paint(Blue); }
| |
| arguments to this method are incorrect
|
note: associated function defined here
note: method defined here
--> $DIR/associated-type-projection-from-supertrait.rs:12:8
|
LL | fn chip_paint(&self, c: Self::Color) { }
Expand All @@ -48,7 +48,7 @@ LL | fn g() { ModelU.chip_paint(Black); }
| |
| arguments to this method are incorrect
|
note: associated function defined here
note: method defined here
--> $DIR/associated-type-projection-from-supertrait.rs:12:8
|
LL | fn chip_paint(&self, c: Self::Color) { }
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/async-await/issues/issue-62097.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl Struct {
pub async fn run_dummy_fn(&self) {
foo(|| self.bar()).await;
//~^ ERROR closure may outlive the current function
//~| ERROR borrowed data escapes outside of associated function
//~| ERROR borrowed data escapes outside of method
}

pub fn bar(&self) {}
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/async-await/issues/issue-62097.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ help: to force the closure to take ownership of `self` (and any other referenced
LL | foo(move || self.bar()).await;
| ++++

error[E0521]: borrowed data escapes outside of associated function
error[E0521]: borrowed data escapes outside of method
--> $DIR/issue-62097.rs:13:9
|
LL | pub async fn run_dummy_fn(&self) {
| -----
| |
| `self` is a reference that is only valid in the associated function body
| `self` is a reference that is only valid in the method body
| let's call the lifetime of this reference `'1`
LL | foo(|| self.bar()).await;
| ^^^^^^^^^^^^^^^^^^
| |
| `self` escapes the associated function body here
| `self` escapes the method body here
| argument requires that `'1` must outlive `'static`

error: aborting due to 2 previous errors
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/async-await/issues/issue-72312.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
error[E0521]: borrowed data escapes outside of associated function
error[E0521]: borrowed data escapes outside of method
--> $DIR/issue-72312.rs:12:9
|
LL | pub async fn start(&self) {
| -----
| |
| `self` is a reference that is only valid in the associated function body
| `self` is a reference that is only valid in the method body
| let's call the lifetime of this reference `'1`
...
LL | / require_static(async move {
Expand All @@ -15,7 +15,7 @@ LL | | &self;
LL | | });
| | ^
| | |
| |__________`self` escapes the associated function body here
| |__________`self` escapes the method body here
| argument requires that `'1` must outlive `'static`

error: aborting due to previous error
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/borrowck/issue-103624.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl StructA {
async fn foo(&self) {
let bar = self.b.bar().await;
spawn_blocking(move || {
//~^ ERROR borrowed data escapes outside of associated function
//~^ ERROR borrowed data escapes outside of method
self.b;
//~^ ERROR cannot move out of `self.b`, as `self` is a captured variable in an `Fn` closure
})
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/borrowck/issue-103624.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ LL |
LL | self.b;
| ^^^^^^ move occurs because `self.b` has type `StructB`, which does not implement the `Copy` trait

error[E0521]: borrowed data escapes outside of associated function
error[E0521]: borrowed data escapes outside of method
--> $DIR/issue-103624.rs:14:9
|
LL | async fn foo(&self) {
| -----
| |
| `self` is a reference that is only valid in the associated function body
| `self` is a reference that is only valid in the method body
| let's call the lifetime of this reference `'1`
LL | let bar = self.b.bar().await;
LL | / spawn_blocking(move || {
Expand All @@ -26,7 +26,7 @@ LL | |
LL | | })
| | ^
| | |
| |__________`self` escapes the associated function body here
| |__________`self` escapes the method body here
| argument requires that `'1` must outlive `'static`

error: aborting due to 2 previous errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/issue-105608.rs:13:22
|
LL | Combination::<0>.and::<_>().and::<_>();
| ^^^ cannot infer type of the type parameter `M` declared on the associated function `and`
| ^^^ cannot infer type of the type parameter `M` declared on the method `and`
|
help: consider specifying the generic argument
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/const-generics/infer/method-chain.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/method-chain.rs:15:33
|
LL | Foo.bar().bar().bar().bar().baz();
| ^^^ cannot infer the value of the const parameter `N` declared on the associated function `baz`
| ^^^ cannot infer the value of the const parameter `N` declared on the method `baz`
|
help: consider specifying the generic argument
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/const-generics/infer/uninferred-consts.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0282]: type annotations needed
--> $DIR/uninferred-consts.rs:9:9
|
LL | Foo.foo();
| ^^^ cannot infer the value of the const parameter `A` declared on the associated function `foo`
| ^^^ cannot infer the value of the const parameter `A` declared on the method `foo`
|
help: consider specifying the generic arguments
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ struct S;

fn main() {
let _: u32 = 5i32.try_into::<32>().unwrap();
//~^ ERROR this associated function takes
//~^ ERROR this method takes

S.f::<0>();
//~^ ERROR no method named `f`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
error[E0107]: this method takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/invalid-const-arg-for-type-param.rs:6:23
|
LL | let _: u32 = 5i32.try_into::<32>().unwrap();
Expand Down
Loading

0 comments on commit 3f37412

Please sign in to comment.