about summary refs log tree commit diff
path: root/tests/ui/unsized-locals/autoderef.stderr
blob: 785badce19913371c688c00c6d2177e1c6b97a56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
error[E0277]: the size for values of type `[char]` cannot be known at compilation time
  --> $DIR/autoderef.rs:26:9
   |
LL |     let x = *(Box::new(['h', 'e', 'l', 'l', 'o']) as Box<[char]>);
   |         ^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `[char]`
   = note: all local variables must have a statically known size
help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression
   |
LL -     let x = *(Box::new(['h', 'e', 'l', 'l', 'o']) as Box<[char]>);
LL +     let x = (Box::new(['h', 'e', 'l', 'l', 'o']) as Box<[char]>);
   |

error[E0277]: the size for values of type `str` cannot be known at compilation time
  --> $DIR/autoderef.rs:35:9
   |
LL |     let x = *("hello".to_owned().into_boxed_str());
   |         ^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `str`
   = note: all local variables must have a statically known size
help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression
   |
LL -     let x = *("hello".to_owned().into_boxed_str());
LL +     let x = ("hello".to_owned().into_boxed_str());
   |

error[E0277]: the size for values of type `dyn FnMut() -> String` cannot be known at compilation time
  --> $DIR/autoderef.rs:41:9
   |
LL |     let x = *(Box::new(|| "hello".to_owned()) as Box<dyn FnMut() -> String>);
   |         ^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `dyn FnMut() -> String`
   = note: all local variables must have a statically known size
help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression
   |
LL -     let x = *(Box::new(|| "hello".to_owned()) as Box<dyn FnMut() -> String>);
LL +     let x = (Box::new(|| "hello".to_owned()) as Box<dyn FnMut() -> String>);
   |

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0277`.