|
1 |
| -error[E0277]: the trait bound `(): std::error::Error` is not satisfied |
2 |
| - --> $DIR/coerce-issue-49593-box-never.rs:18:53 |
| 1 | +error[E0277]: the size for values of type `dyn std::error::Error` cannot be known at compilation time |
| 2 | + --> $DIR/coerce-issue-49593-box-never.rs:18:75 |
3 | 3 | |
|
4 | 4 | LL | /* *mut $0 is coerced to Box<dyn Error> here */ Box::<_ /* ! */>::new(x)
|
5 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()` |
| 5 | + | --------------------- ^ doesn't have a size known at compile-time |
| 6 | + | | |
| 7 | + | required by a bound introduced by this call |
6 | 8 | |
|
7 |
| - = note: required for the cast from `()` to the object type `dyn std::error::Error` |
| 9 | + = help: the trait `Sized` is not implemented for `dyn std::error::Error` |
| 10 | +note: required by a bound in `Box::<T>::new` |
| 11 | + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL |
| 12 | + | |
| 13 | +LL | impl<T> Box<T> { |
| 14 | + | ^ required by this bound in `Box::<T>::new` |
8 | 15 |
|
9 |
| -error[E0277]: the trait bound `(): std::error::Error` is not satisfied |
10 |
| - --> $DIR/coerce-issue-49593-box-never.rs:23:49 |
| 16 | +error[E0277]: the size for values of type `(dyn std::error::Error + 'static)` cannot be known at compilation time |
| 17 | + --> $DIR/coerce-issue-49593-box-never.rs:23:74 |
11 | 18 | |
|
12 | 19 | LL | /* *mut $0 is coerced to *mut Error here */ raw_ptr_box::<_ /* ! */>(x)
|
13 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()` |
| 20 | + | ------------------------ ^ doesn't have a size known at compile-time |
| 21 | + | | |
| 22 | + | required by a bound introduced by this call |
| 23 | + | |
| 24 | + = help: the trait `Sized` is not implemented for `(dyn std::error::Error + 'static)` |
| 25 | +note: required by a bound in `raw_ptr_box` |
| 26 | + --> $DIR/coerce-issue-49593-box-never.rs:13:16 |
| 27 | + | |
| 28 | +LL | fn raw_ptr_box<T>(t: T) -> *mut T { |
| 29 | + | ^ required by this bound in `raw_ptr_box` |
| 30 | +help: consider relaxing the implicit `Sized` restriction |
| 31 | + | |
| 32 | +LL | fn raw_ptr_box<T: ?Sized>(t: T) -> *mut T { |
| 33 | + | ++++++++ |
| 34 | + |
| 35 | +error[E0277]: the size for values of type `dyn Xyz` cannot be known at compilation time |
| 36 | + --> $DIR/coerce-issue-49593-box-never.rs:45:70 |
| 37 | + | |
| 38 | +LL | = /* Box<$0> is coerced to Box<Xyz> here */ Box::new(x.unwrap()); |
| 39 | + | -------- ^^^^^^^^^^ doesn't have a size known at compile-time |
| 40 | + | | |
| 41 | + | required by a bound introduced by this call |
| 42 | + | |
| 43 | + = help: the trait `Sized` is not implemented for `dyn Xyz` |
| 44 | +note: required by a bound in `Box::<T>::new` |
| 45 | + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL |
| 46 | + | |
| 47 | +LL | impl<T> Box<T> { |
| 48 | + | ^ required by this bound in `Box::<T>::new` |
| 49 | + |
| 50 | +error[E0277]: the size for values of type `dyn Xyz` cannot be known at compilation time |
| 51 | + --> $DIR/coerce-issue-49593-box-never.rs:45:70 |
| 52 | + | |
| 53 | +LL | = /* Box<$0> is coerced to Box<Xyz> here */ Box::new(x.unwrap()); |
| 54 | + | ^ ------ required by a bound introduced by this call |
| 55 | + | | |
| 56 | + | doesn't have a size known at compile-time |
| 57 | + | |
| 58 | + = help: the trait `Sized` is not implemented for `dyn Xyz` |
| 59 | +note: required by a bound in `Option::<T>::unwrap` |
| 60 | + --> $SRC_DIR/core/src/option.rs:LL:COL |
| 61 | + | |
| 62 | +LL | impl<T> Option<T> { |
| 63 | + | ^ required by this bound in `Option::<T>::unwrap` |
| 64 | + |
| 65 | +error[E0277]: the size for values of type `dyn Xyz` cannot be known at compilation time |
| 66 | + --> $DIR/coerce-issue-49593-box-never.rs:40:35 |
| 67 | + | |
| 68 | +LL | let mut x /* : Option<S> */ = None; |
| 69 | + | ^^^^ doesn't have a size known at compile-time |
| 70 | + | |
| 71 | + = help: the trait `Sized` is not implemented for `dyn Xyz` |
| 72 | +note: required by a bound in `None` |
| 73 | + --> $SRC_DIR/core/src/option.rs:LL:COL |
| 74 | + | |
| 75 | +LL | pub enum Option<T> { |
| 76 | + | ^ required by this bound in `None` |
| 77 | + |
| 78 | +error[E0308]: mismatched types |
| 79 | + --> $DIR/coerce-issue-49593-box-never.rs:48:13 |
| 80 | + | |
| 81 | +LL | let mut x /* : Option<S> */ = None; |
| 82 | + | ---- expected due to this value |
| 83 | +... |
| 84 | +LL | x = Some(S); |
| 85 | + | ^^^^^^^ expected trait object `dyn Xyz`, found struct `S` |
| 86 | + | |
| 87 | + = note: expected enum `Option<dyn Xyz>` |
| 88 | + found enum `Option<S>` |
| 89 | + |
| 90 | +error[E0277]: the size for values of type `dyn Xyz` cannot be known at compilation time |
| 91 | + --> $DIR/coerce-issue-49593-box-never.rs:54:5 |
| 92 | + | |
| 93 | +LL | mem::swap(&mut x, &mut y); |
| 94 | + | ^^^^^^^^^ doesn't have a size known at compile-time |
| 95 | + | |
| 96 | + = help: the trait `Sized` is not implemented for `dyn Xyz` |
| 97 | +note: required by a bound in `Option` |
| 98 | + --> $SRC_DIR/core/src/option.rs:LL:COL |
| 99 | + | |
| 100 | +LL | pub enum Option<T> { |
| 101 | + | ^ required by this bound in `Option` |
| 102 | + |
| 103 | +error[E0308]: mismatched types |
| 104 | + --> $DIR/coerce-issue-49593-box-never.rs:54:23 |
| 105 | + | |
| 106 | +LL | mem::swap(&mut x, &mut y); |
| 107 | + | --------- ^^^^^^ expected trait object `dyn Xyz`, found struct `S` |
| 108 | + | | |
| 109 | + | arguments to this function are incorrect |
| 110 | + | |
| 111 | + = note: expected mutable reference `&mut Option<dyn Xyz>` |
| 112 | + found mutable reference `&mut Option<S>` |
| 113 | +note: function defined here |
| 114 | + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL |
14 | 115 | |
|
15 |
| - = note: required for the cast from `()` to the object type `(dyn std::error::Error + 'static)` |
| 116 | +LL | pub const fn swap<T>(x: &mut T, y: &mut T) { |
| 117 | + | ^^^^ |
16 | 118 |
|
17 |
| -error: aborting due to 2 previous errors |
| 119 | +error: aborting due to 8 previous errors |
18 | 120 |
|
19 |
| -For more information about this error, try `rustc --explain E0277`. |
| 121 | +Some errors have detailed explanations: E0277, E0308. |
| 122 | +For more information about an error, try `rustc --explain E0277`. |
0 commit comments