1 error[E0033]: type `&dyn T` cannot be dereferenced
2 --> $DIR/destructure-trait-ref.rs:26:9
4 LL | let &x = &1isize as &dyn T;
5 | ^^ type `&dyn T` cannot be dereferenced
7 error[E0033]: type `&dyn T` cannot be dereferenced
8 --> $DIR/destructure-trait-ref.rs:27:10
10 LL | let &&x = &(&1isize as &dyn T);
11 | ^^ type `&dyn T` cannot be dereferenced
13 error[E0033]: type `Box<dyn T>` cannot be dereferenced
14 --> $DIR/destructure-trait-ref.rs:28:9
16 LL | let box x = Box::new(1isize) as Box<dyn T>;
17 | ^^^^^ type `Box<dyn T>` cannot be dereferenced
19 error[E0308]: mismatched types
20 --> $DIR/destructure-trait-ref.rs:32:10
22 LL | let &&x = &1isize as &dyn T;
23 | ^^ ----------------- this expression has type `&dyn T`
25 | expected trait object `dyn T`, found reference
27 = note: expected trait object `dyn T`
29 help: consider removing `&` from the pattern
31 LL - let &&x = &1isize as &dyn T;
32 LL + let &x = &1isize as &dyn T;
35 error[E0308]: mismatched types
36 --> $DIR/destructure-trait-ref.rs:36:11
38 LL | let &&&x = &(&1isize as &dyn T);
39 | ^^ -------------------- this expression has type `&&dyn T`
41 | expected trait object `dyn T`, found reference
43 = note: expected trait object `dyn T`
45 help: consider removing `&` from the pattern
47 LL - let &&&x = &(&1isize as &dyn T);
48 LL + let &&x = &(&1isize as &dyn T);
51 error[E0308]: mismatched types
52 --> $DIR/destructure-trait-ref.rs:40:13
54 LL | let box box x = Box::new(1isize) as Box<dyn T>;
55 | ^^^^^ ------------------------------ this expression has type `Box<dyn T>`
57 | expected trait object `dyn T`, found struct `Box`
59 = note: expected trait object `dyn T`
62 error: aborting due to 6 previous errors
64 Some errors have detailed explanations: E0033, E0308.
65 For more information about an error, try `rustc --explain E0033`.