mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
@@ -0,0 +1,11 @@
|
||||
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
|
||||
--> $DIR/unsized_coercion.rs:14:17
|
||||
|
|
||||
LL | let x = hello();
|
||||
| ^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `dyn Trait`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -4,7 +4,6 @@
|
||||
//@ revisions: next old
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
//@[old] check-pass
|
||||
//@[next] check-pass
|
||||
|
||||
trait Trait {}
|
||||
|
||||
@@ -13,6 +12,7 @@ impl Trait for u32 {}
|
||||
fn hello() -> Box<impl Trait> {
|
||||
if true {
|
||||
let x = hello();
|
||||
//[next]~^ ERROR: the size for values of type `dyn Trait` cannot be known at compilation time
|
||||
let y: Box<dyn Trait> = x;
|
||||
}
|
||||
Box::new(1u32)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
error[E0277]: the trait bound `dyn Send: Trait` is not satisfied
|
||||
--> $DIR/unsized_coercion3.rs:14:17
|
||||
--> $DIR/unsized_coercion3.rs:13:17
|
||||
|
|
||||
LL | let x = hello();
|
||||
| ^^^^^^^ the trait `Trait` is not implemented for `dyn Send`
|
||||
@@ -9,37 +9,7 @@ help: the trait `Trait` is implemented for `u32`
|
||||
|
|
||||
LL | impl Trait for u32 {}
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
note: required by a bound in `Box`
|
||||
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/unsized_coercion3.rs:19:5
|
||||
|
|
||||
LL | fn hello() -> Box<impl Trait + ?Sized> {
|
||||
| ------------------------
|
||||
| | |
|
||||
| | the expected opaque type
|
||||
| expected `Box<impl Trait + ?Sized>` because of return type
|
||||
...
|
||||
LL | Box::new(1u32)
|
||||
| ^^^^^^^^^^^^^^ types differ
|
||||
|
|
||||
= note: expected struct `Box<impl Trait + ?Sized>`
|
||||
found struct `Box<u32>`
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
error[E0277]: the trait bound `dyn Send: Trait` is not satisfied
|
||||
--> $DIR/unsized_coercion3.rs:11:1
|
||||
|
|
||||
LL | fn hello() -> Box<impl Trait + ?Sized> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `dyn Send`
|
||||
|
|
||||
help: the trait `Trait` is implemented for `u32`
|
||||
--> $DIR/unsized_coercion3.rs:9:1
|
||||
|
|
||||
LL | impl Trait for u32 {}
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0308.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
error[E0277]: the size for values of type `impl Trait + ?Sized` cannot be known at compilation time
|
||||
--> $DIR/unsized_coercion3.rs:16:32
|
||||
--> $DIR/unsized_coercion3.rs:15:32
|
||||
|
|
||||
LL | let y: Box<dyn Send> = x;
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
||||
@@ -9,7 +9,6 @@ trait Trait {}
|
||||
impl Trait for u32 {}
|
||||
|
||||
fn hello() -> Box<impl Trait + ?Sized> {
|
||||
//[next]~^ ERROR: the trait bound `dyn Send: Trait` is not satisfied
|
||||
if true {
|
||||
let x = hello();
|
||||
//[next]~^ ERROR: the trait bound `dyn Send: Trait` is not satisfied
|
||||
@@ -17,7 +16,6 @@ fn hello() -> Box<impl Trait + ?Sized> {
|
||||
//[old]~^ ERROR: the size for values of type `impl Trait + ?Sized` cannot be know
|
||||
}
|
||||
Box::new(1u32)
|
||||
//[next]~^ ERROR: mismatched types
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -9,7 +9,7 @@ note: candidate #1 is defined in the trait `Trait1`
|
||||
|
|
||||
LL | fn method(&self) {
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
note: candidate #2 is defined in an impl of the trait `Trait2` for the type `T`
|
||||
note: candidate #2 is defined in the trait `Trait2`
|
||||
--> $DIR/rigid-alias-bound-is-not-inherent.rs:27:5
|
||||
|
|
||||
LL | fn method(&self) {
|
||||
|
||||
@@ -8,5 +8,6 @@ fn main() {
|
||||
//[next]~^^ ERROR expected a `FnMut(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item)` closure, found
|
||||
let _ = (-10..=10).find(|x: &i32| x.signum() == 0);
|
||||
//[current]~^ ERROR type mismatch in closure arguments
|
||||
//[next]~^^ ERROR expected a `FnMut(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item)` closure, found
|
||||
//[next]~^^ ERROR expected `RangeInclusive<{integer}>` to be an iterator that yields `&&i32`, but it yields `{integer}`
|
||||
//[next]~| ERROR expected a `FnMut(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item)` closure, found
|
||||
}
|
||||
|
||||
@@ -12,6 +12,12 @@ LL | let _ = (-10..=10).find(|x: i32| x.signum() == 0);
|
||||
note: required by a bound in `find`
|
||||
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
|
||||
|
||||
error[E0271]: expected `RangeInclusive<{integer}>` to be an iterator that yields `&&i32`, but it yields `{integer}`
|
||||
--> $DIR/closure-arg-type-mismatch-issue-45727.rs:9:24
|
||||
|
|
||||
LL | let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0);
|
||||
| ^^^^ expected `&&i32`, found integer
|
||||
|
||||
error[E0277]: expected a `FnMut(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item)` closure, found `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:9:29: 9:40}`
|
||||
--> $DIR/closure-arg-type-mismatch-issue-45727.rs:9:29
|
||||
|
|
||||
@@ -26,6 +32,7 @@ LL | let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0);
|
||||
note: required by a bound in `find`
|
||||
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
Some errors have detailed explanations: E0271, E0277.
|
||||
For more information about an error, try `rustc --explain E0271`.
|
||||
|
||||
@@ -8,5 +8,6 @@ fn main() {
|
||||
//[next]~^^ ERROR expected a `FnMut(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item)` closure, found
|
||||
let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0);
|
||||
//[current]~^ ERROR type mismatch in closure arguments
|
||||
//[next]~^^ ERROR expected a `FnMut(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item)` closure, found
|
||||
//[next]~^^ ERROR expected `RangeInclusive<{integer}>` to be an iterator that yields `&&i32`, but it yields `{integer}`
|
||||
//[next]~| ERROR expected a `FnMut(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item)` closure, found
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user