diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2021-06-28 11:22:47 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2021-07-30 09:26:31 -0700 |
| commit | 0b8f192cfee2f107867e7b9a0b0f781a5cb48787 (patch) | |
| tree | 7740090507212c2bf5f630672125bab43d68d093 /src/test/ui/impl-trait | |
| parent | 5fb3394cbdf0622c9d0c292feb55db0f4c828dc3 (diff) | |
| download | rust-0b8f192cfee2f107867e7b9a0b0f781a5cb48787.tar.gz rust-0b8f192cfee2f107867e7b9a0b0f781a5cb48787.zip | |
Use multispan suggestions more often
* Use more accurate span for `async move` suggestion * Use more accurate span for deref suggestion * Use `multipart_suggestion` more often
Diffstat (limited to 'src/test/ui/impl-trait')
| -rw-r--r-- | src/test/ui/impl-trait/does-not-live-long-enough.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr | 72 |
2 files changed, 41 insertions, 33 deletions
diff --git a/src/test/ui/impl-trait/does-not-live-long-enough.stderr b/src/test/ui/impl-trait/does-not-live-long-enough.stderr index 468c2f36629..73fd5e8ded3 100644 --- a/src/test/ui/impl-trait/does-not-live-long-enough.stderr +++ b/src/test/ui/impl-trait/does-not-live-long-enough.stderr @@ -14,7 +14,7 @@ LL | fn started_with<'a>(&'a self, prefix: &'a str) -> impl Iterator<Item=&' help: to force the closure to take ownership of `prefix` (and any other referenced variables), use the `move` keyword | LL | self.data.iter().filter(move |s| s.starts_with(prefix)).map(|s| s.as_ref()) - | ^^^^^^^^ + | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr b/src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr index 00145d10ed7..0ecec5eea36 100644 --- a/src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr +++ b/src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr @@ -140,14 +140,15 @@ LL | fn bam() -> Box<dyn Trait> { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type LL | if true { LL | return Struct; - | ^^^^^^ - | | - | expected struct `Box`, found struct `Struct` - | help: store this in the heap by calling `Box::new`: `Box::new(Struct)` + | ^^^^^^ expected struct `Box`, found struct `Struct` | = note: expected struct `Box<(dyn Trait + 'static)>` found struct `Struct` = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +help: store this in the heap by calling `Box::new` + | +LL | return Box::new(Struct); + | ^^^^^^^^^ ^ error[E0308]: mismatched types --> $DIR/dyn-trait-return-should-be-impl-trait.rs:36:5 @@ -156,14 +157,15 @@ LL | fn bam() -> Box<dyn Trait> { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type ... LL | 42 - | ^^ - | | - | expected struct `Box`, found integer - | help: store this in the heap by calling `Box::new`: `Box::new(42)` + | ^^ expected struct `Box`, found integer | = note: expected struct `Box<(dyn Trait + 'static)>` found type `{integer}` = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +help: store this in the heap by calling `Box::new` + | +LL | Box::new(42) + | ^^^^^^^^^ ^ error[E0308]: mismatched types --> $DIR/dyn-trait-return-should-be-impl-trait.rs:40:16 @@ -172,14 +174,15 @@ LL | fn baq() -> Box<dyn Trait> { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type LL | if true { LL | return 0; - | ^ - | | - | expected struct `Box`, found integer - | help: store this in the heap by calling `Box::new`: `Box::new(0)` + | ^ expected struct `Box`, found integer | = note: expected struct `Box<(dyn Trait + 'static)>` found type `{integer}` = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +help: store this in the heap by calling `Box::new` + | +LL | return Box::new(0); + | ^^^^^^^^^ ^ error[E0308]: mismatched types --> $DIR/dyn-trait-return-should-be-impl-trait.rs:42:5 @@ -188,14 +191,15 @@ LL | fn baq() -> Box<dyn Trait> { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type ... LL | 42 - | ^^ - | | - | expected struct `Box`, found integer - | help: store this in the heap by calling `Box::new`: `Box::new(42)` + | ^^ expected struct `Box`, found integer | = note: expected struct `Box<(dyn Trait + 'static)>` found type `{integer}` = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +help: store this in the heap by calling `Box::new` + | +LL | Box::new(42) + | ^^^^^^^^^ ^ error[E0308]: mismatched types --> $DIR/dyn-trait-return-should-be-impl-trait.rs:46:9 @@ -204,14 +208,15 @@ LL | fn baz() -> Box<dyn Trait> { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type LL | if true { LL | Struct - | ^^^^^^ - | | - | expected struct `Box`, found struct `Struct` - | help: store this in the heap by calling `Box::new`: `Box::new(Struct)` + | ^^^^^^ expected struct `Box`, found struct `Struct` | = note: expected struct `Box<(dyn Trait + 'static)>` found struct `Struct` = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +help: store this in the heap by calling `Box::new` + | +LL | Box::new(Struct) + | ^^^^^^^^^ ^ error[E0308]: mismatched types --> $DIR/dyn-trait-return-should-be-impl-trait.rs:48:9 @@ -220,14 +225,15 @@ LL | fn baz() -> Box<dyn Trait> { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type ... LL | 42 - | ^^ - | | - | expected struct `Box`, found integer - | help: store this in the heap by calling `Box::new`: `Box::new(42)` + | ^^ expected struct `Box`, found integer | = note: expected struct `Box<(dyn Trait + 'static)>` found type `{integer}` = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +help: store this in the heap by calling `Box::new` + | +LL | Box::new(42) + | ^^^^^^^^^ ^ error[E0308]: mismatched types --> $DIR/dyn-trait-return-should-be-impl-trait.rs:53:9 @@ -236,14 +242,15 @@ LL | fn baw() -> Box<dyn Trait> { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type LL | if true { LL | 0 - | ^ - | | - | expected struct `Box`, found integer - | help: store this in the heap by calling `Box::new`: `Box::new(0)` + | ^ expected struct `Box`, found integer | = note: expected struct `Box<(dyn Trait + 'static)>` found type `{integer}` = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +help: store this in the heap by calling `Box::new` + | +LL | Box::new(0) + | ^^^^^^^^^ ^ error[E0308]: mismatched types --> $DIR/dyn-trait-return-should-be-impl-trait.rs:55:9 @@ -252,14 +259,15 @@ LL | fn baw() -> Box<dyn Trait> { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type ... LL | 42 - | ^^ - | | - | expected struct `Box`, found integer - | help: store this in the heap by calling `Box::new`: `Box::new(42)` + | ^^ expected struct `Box`, found integer | = note: expected struct `Box<(dyn Trait + 'static)>` found type `{integer}` = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +help: store this in the heap by calling `Box::new` + | +LL | Box::new(42) + | ^^^^^^^^^ ^ error[E0746]: return type cannot have an unboxed trait object --> $DIR/dyn-trait-return-should-be-impl-trait.rs:60:13 |
