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