diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-02-13 16:27:59 +0100 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-07-01 17:39:19 +0200 |
| commit | 42e4eee8931479a02c11c88ddaddb3a494e136c6 (patch) | |
| tree | a1b3bade4e24fbe6bbcff84376aed94bc6505257 /src/test/ui/specialization/defaultimpl | |
| parent | ca1e68b3229e710c3948a361ee770d846a88e6da (diff) | |
| download | rust-42e4eee8931479a02c11c88ddaddb3a494e136c6.tar.gz rust-42e4eee8931479a02c11c88ddaddb3a494e136c6.zip | |
Shorten def_span for more items.
Diffstat (limited to 'src/test/ui/specialization/defaultimpl')
| -rw-r--r-- | src/test/ui/specialization/defaultimpl/specialization-no-default.stderr | 52 | ||||
| -rw-r--r-- | src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr | 15 |
2 files changed, 27 insertions, 40 deletions
diff --git a/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr b/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr index 3f1a5495e21..360b7bc787a 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr @@ -11,67 +11,55 @@ LL | #![feature(specialization)] error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/specialization-no-default.rs:20:5 | -LL | / impl<T> Foo for T { -LL | | fn foo(&self) {} -LL | | fn bar(&self) {} -LL | | } - | |_- parent `impl` is here +LL | impl<T> Foo for T { + | ----------------- parent `impl` is here ... -LL | fn foo(&self) {} - | ^^^^^^^^^^^^^^^^ cannot specialize default item `foo` +LL | fn foo(&self) {} + | ^^^^^^^^^^^^^^^^ cannot specialize default item `foo` | = note: to specialize, `foo` in the parent `impl` must be marked `default` error[E0520]: `bar` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/specialization-no-default.rs:23:5 | -LL | / impl<T> Foo for T { -LL | | fn foo(&self) {} -LL | | fn bar(&self) {} -LL | | } - | |_- parent `impl` is here +LL | impl<T> Foo for T { + | ----------------- parent `impl` is here ... -LL | fn bar(&self) {} - | ^^^^^^^^^^^^^^^^ cannot specialize default item `bar` +LL | fn bar(&self) {} + | ^^^^^^^^^^^^^^^^ cannot specialize default item `bar` | = note: to specialize, `bar` in the parent `impl` must be marked `default` error[E0520]: `T` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/specialization-no-default.rs:37:5 | -LL | / impl<T> Bar for T { -LL | | type T = u8; -LL | | } - | |_- parent `impl` is here +LL | impl<T> Bar for T { + | ----------------- parent `impl` is here ... -LL | type T = (); - | ^^^^^^^^^^^^ cannot specialize default item `T` +LL | type T = (); + | ^^^^^^^^^^^^ cannot specialize default item `T` | = note: to specialize, `T` in the parent `impl` must be marked `default` error[E0520]: `baz` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/specialization-no-default.rs:55:5 | -LL | / impl<T: Clone> Baz for T { -LL | | fn baz(&self) {} -LL | | } - | |_- parent `impl` is here +LL | impl<T: Clone> Baz for T { + | ------------------------ parent `impl` is here ... -LL | fn baz(&self) {} - | ^^^^^^^^^^^^^^^^ cannot specialize default item `baz` +LL | fn baz(&self) {} + | ^^^^^^^^^^^^^^^^ cannot specialize default item `baz` | = note: to specialize, `baz` in the parent `impl` must be marked `default` error[E0520]: `redundant` specializes an item from a parent `impl`, but that item is not marked `default` --> $DIR/specialization-no-default.rs:74:5 | -LL | / impl<T: Clone> Redundant for T { -LL | | fn redundant(&self) {} -LL | | } - | |_- parent `impl` is here +LL | impl<T: Clone> Redundant for T { + | ------------------------------ parent `impl` is here ... -LL | fn redundant(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant` +LL | fn redundant(&self) {} + | ^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant` | = note: to specialize, `redundant` in the parent `impl` must be marked `default` diff --git a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr index d2350bc7e4f..53a22305e81 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr @@ -12,7 +12,7 @@ error[E0599]: the method `foo_one` exists for struct `MyStruct`, but its trait b --> $DIR/specialization-trait-not-implemented.rs:22:29 | LL | struct MyStruct; - | ---------------- + | --------------- | | | | | method `foo_one` not found for this struct | doesn't satisfy `MyStruct: Foo` @@ -21,18 +21,17 @@ LL | println!("{}", MyStruct.foo_one()); | ^^^^^^^ method cannot be called on `MyStruct` due to unsatisfied trait bounds | note: trait bound `MyStruct: Foo` was not satisfied - --> $DIR/specialization-trait-not-implemented.rs:14:17 + --> $DIR/specialization-trait-not-implemented.rs:14:1 | LL | default impl<T> Foo for T { - | ^^^ ^ + | ^^^^^^^^^^^^^^^^---^^^^^- + | | + | unsatisfied trait bound introduced here note: the following trait must be implemented --> $DIR/specialization-trait-not-implemented.rs:7:1 | -LL | / trait Foo { -LL | | fn foo_one(&self) -> &'static str; -LL | | fn foo_two(&self) -> &'static str; -LL | | } - | |_^ +LL | trait Foo { + | ^^^^^^^^^ = help: items from traits can only be used if the trait is implemented and in scope note: `Foo` defines an item `foo_one`, perhaps you need to implement it --> $DIR/specialization-trait-not-implemented.rs:7:1 |
