]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.precise.stderr
Improve selection errors for `~const` trait bounds
[rust.git] / src / test / ui / rfc-2632-const-trait-impl / const-drop-fail.precise.stderr
1 error[E0277]: the trait bound `NonTrivialDrop: ~const Drop` is not satisfied
2   --> $DIR/const-drop-fail.rs:44:5
3    |
4 LL |         const _: () = check($exp);
5    |                       ----- required by a bound introduced by this call
6 ...
7 LL |     NonTrivialDrop,
8    |     ^^^^^^^^^^^^^^ expected an implementor of trait `~const Drop`
9    |
10 note: required by a bound in `check`
11   --> $DIR/const-drop-fail.rs:35:19
12    |
13 LL | const fn check<T: ~const Drop>(_: T) {}
14    |                   ^^^^^^^^^^^ required by this bound in `check`
15 help: consider borrowing here
16    |
17 LL |     &NonTrivialDrop,
18    |     +
19 LL |     &mut NonTrivialDrop,
20    |     ++++
21
22 error[E0277]: the trait bound `NonTrivialDrop: ~const Drop` is not satisfied in `ConstImplWithDropGlue`
23   --> $DIR/const-drop-fail.rs:46:5
24    |
25 LL |         const _: () = check($exp);
26    |                       ----- required by a bound introduced by this call
27 ...
28 LL |     ConstImplWithDropGlue(NonTrivialDrop),
29    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `ConstImplWithDropGlue`, the trait `~const Drop` is not implemented for `NonTrivialDrop`
30    |
31 note: required because it appears within the type `ConstImplWithDropGlue`
32   --> $DIR/const-drop-fail.rs:17:8
33    |
34 LL | struct ConstImplWithDropGlue(NonTrivialDrop);
35    |        ^^^^^^^^^^^^^^^^^^^^^
36 note: required by a bound in `check`
37   --> $DIR/const-drop-fail.rs:35:19
38    |
39 LL | const fn check<T: ~const Drop>(_: T) {}
40    |                   ^^^^^^^^^^^ required by this bound in `check`
41
42 error[E0277]: the trait bound `ConstDropImplWithBounds<NonTrivialDrop>: ~const Drop` is not satisfied
43   --> $DIR/const-drop-fail.rs:48:5
44    |
45 LL |         const _: () = check($exp);
46    |                       ----- required by a bound introduced by this call
47 ...
48 LL |     ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
49    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an implementor of trait `~const Drop`
50    |
51 note: required because of the requirements on the impl of `~const Drop` for `ConstDropImplWithBounds<NonTrivialDrop>`
52   --> $DIR/const-drop-fail.rs:29:25
53    |
54 LL | impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> {
55    |                         ^^^^     ^^^^^^^^^^^^^^^^^^^^^^^^^^
56 note: required by a bound in `check`
57   --> $DIR/const-drop-fail.rs:35:19
58    |
59 LL | const fn check<T: ~const Drop>(_: T) {}
60    |                   ^^^^^^^^^^^ required by this bound in `check`
61 help: consider borrowing here
62    |
63 LL |     &ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
64    |     +
65 LL |     &mut ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
66    |     ++++
67
68 error: aborting due to 3 previous errors
69
70 For more information about this error, try `rustc --explain E0277`.