mirror of
https://github.com/rust-lang/rust
synced 2024-09-05 16:57:03 +00:00
6efddac288
Expand the primary span of E0277 when the immediate unmet bound is not what the user wrote: ``` error[E0277]: the trait bound `i32: Bar` is not satisfied --> f100.rs:6:6 | 6 | <i32 as Foo>::foo(); | ^^^ the trait `Bar` is not implemented for `i32`, which is required by `i32: Foo` | help: this trait has no implementations, consider adding one --> f100.rs:2:1 | 2 | trait Bar {} | ^^^^^^^^^ note: required for `i32` to implement `Foo` --> f100.rs:3:14 | 3 | impl<T: Bar> Foo for T {} | --- ^^^ ^ | | | unsatisfied trait bound introduced here ``` Fix #40120.
100 lines
4.8 KiB
Plaintext
100 lines
4.8 KiB
Plaintext
error[E0277]: the size for values of type `dyn A` cannot be known at compilation time
|
|
--> $DIR/closure-return-type-must-be-sized.rs:54:5
|
|
|
|
|
LL | a::foo::<fn() -> dyn A>();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
|
|
|
|
= help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: FnOnce()`
|
|
= note: required because it appears within the type `fn() -> dyn A`
|
|
|
|
error[E0277]: the size for values of type `dyn A` cannot be known at compilation time
|
|
--> $DIR/closure-return-type-must-be-sized.rs:55:14
|
|
|
|
|
LL | a::bar::<fn() -> dyn A, _>();
|
|
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
|
|
|
|
= help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: FnOnce()`
|
|
= note: required because it appears within the type `fn() -> dyn A`
|
|
note: required by a bound in `a::bar`
|
|
--> $DIR/closure-return-type-must-be-sized.rs:14:19
|
|
|
|
|
LL | pub fn bar<F: FnOnce() -> R, R: ?Sized>() {}
|
|
| ^^^^^^^^^^^^^ required by this bound in `bar`
|
|
|
|
error[E0277]: the size for values of type `dyn A` cannot be known at compilation time
|
|
--> $DIR/closure-return-type-must-be-sized.rs:56:5
|
|
|
|
|
LL | a::baz::<fn() -> dyn A>();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
|
|
|
|
= help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: FnOnce()`
|
|
= note: required because it appears within the type `fn() -> dyn A`
|
|
|
|
error[E0277]: the size for values of type `dyn A` cannot be known at compilation time
|
|
--> $DIR/closure-return-type-must-be-sized.rs:61:5
|
|
|
|
|
LL | b::foo::<fn() -> dyn A>();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
|
|
|
|
= help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: FnOnce()`
|
|
= note: required because it appears within the type `fn() -> dyn A`
|
|
|
|
error[E0277]: the size for values of type `dyn A` cannot be known at compilation time
|
|
--> $DIR/closure-return-type-must-be-sized.rs:62:14
|
|
|
|
|
LL | b::bar::<fn() -> dyn A, _>();
|
|
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
|
|
|
|
= help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: Fn()`
|
|
= note: required because it appears within the type `fn() -> dyn A`
|
|
note: required by a bound in `b::bar`
|
|
--> $DIR/closure-return-type-must-be-sized.rs:28:19
|
|
|
|
|
LL | pub fn bar<F: Fn() -> R, R: ?Sized>() {}
|
|
| ^^^^^^^^^ required by this bound in `bar`
|
|
|
|
error[E0277]: the size for values of type `dyn A` cannot be known at compilation time
|
|
--> $DIR/closure-return-type-must-be-sized.rs:63:5
|
|
|
|
|
LL | b::baz::<fn() -> dyn A>();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
|
|
|
|
= help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: FnOnce()`
|
|
= note: required because it appears within the type `fn() -> dyn A`
|
|
|
|
error[E0277]: the size for values of type `dyn A` cannot be known at compilation time
|
|
--> $DIR/closure-return-type-must-be-sized.rs:68:5
|
|
|
|
|
LL | c::foo::<fn() -> dyn A>();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
|
|
|
|
= help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: FnOnce()`
|
|
= note: required because it appears within the type `fn() -> dyn A`
|
|
|
|
error[E0277]: the size for values of type `dyn A` cannot be known at compilation time
|
|
--> $DIR/closure-return-type-must-be-sized.rs:69:14
|
|
|
|
|
LL | c::bar::<fn() -> dyn A, _>();
|
|
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
|
|
|
|
= help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: FnMut()`
|
|
= note: required because it appears within the type `fn() -> dyn A`
|
|
note: required by a bound in `c::bar`
|
|
--> $DIR/closure-return-type-must-be-sized.rs:42:19
|
|
|
|
|
LL | pub fn bar<F: FnMut() -> R, R: ?Sized>() {}
|
|
| ^^^^^^^^^^^^ required by this bound in `bar`
|
|
|
|
error[E0277]: the size for values of type `dyn A` cannot be known at compilation time
|
|
--> $DIR/closure-return-type-must-be-sized.rs:70:5
|
|
|
|
|
LL | c::baz::<fn() -> dyn A>();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
|
|
|
|
= help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: FnOnce()`
|
|
= note: required because it appears within the type `fn() -> dyn A`
|
|
|
|
error: aborting due to 9 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|