]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/const-and-non-const-impl.stderr
Auto merge of #89551 - jhpratt:stabilize-const_raw_ptr_deref, r=oli-obk
[rust.git] / src / test / ui / rfc-2632-const-trait-impl / const-and-non-const-impl.stderr
1 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
2   --> $DIR/const-and-non-const-impl.rs:5:1
3    |
4 LL | impl const std::ops::Add for i32 {
5    | ^^^^^^^^^^^-------------^^^^^---
6    | |          |                 |
7    | |          |                 `i32` is not defined in the current crate
8    | |          `i32` is not defined in the current crate
9    | impl doesn't use only types from inside the current crate
10    |
11    = note: define and implement a trait or new type instead
12
13 error[E0119]: conflicting implementations of trait `std::ops::Add` for type `Int`
14   --> $DIR/const-and-non-const-impl.rs:22:1
15    |
16 LL | impl std::ops::Add for Int {
17    | -------------------------- first implementation here
18 ...
19 LL | impl const std::ops::Add for Int {
20    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Int`
21
22 error[E0283]: type annotations needed
23   --> $DIR/const-and-non-const-impl.rs:5:12
24    |
25 LL | impl const std::ops::Add for i32 {
26    |            ^^^^^^^^^^^^^ cannot infer type for type `i32`
27    |
28 note: multiple `impl`s satisfying `i32: Add` found
29   --> $DIR/const-and-non-const-impl.rs:5:1
30    |
31 LL | impl const std::ops::Add for i32 {
32    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33    = note: and another `impl` found in the `core` crate: `impl Add for i32;`
34 note: required by a bound in `Add`
35   --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
36    |
37 LL | / pub trait Add<Rhs = Self> {
38 LL | |     /// The resulting type after applying the `+` operator.
39 LL | |     #[stable(feature = "rust1", since = "1.0.0")]
40 LL | |     type Output;
41 ...  |
42 LL | |     fn add(self, rhs: Rhs) -> Self::Output;
43 LL | | }
44    | |_^ required by this bound in `Add`
45
46 error[E0283]: type annotations needed
47   --> $DIR/const-and-non-const-impl.rs:14:6
48    |
49 LL | impl std::ops::Add for Int {
50    |      ^^^^^^^^^^^^^ cannot infer type for struct `Int`
51    |
52 note: multiple `impl`s satisfying `Int: Add` found
53   --> $DIR/const-and-non-const-impl.rs:14:1
54    |
55 LL | impl std::ops::Add for Int {
56    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
57 ...
58 LL | impl const std::ops::Add for Int {
59    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60 note: required by a bound in `Add`
61   --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
62    |
63 LL | / pub trait Add<Rhs = Self> {
64 LL | |     /// The resulting type after applying the `+` operator.
65 LL | |     #[stable(feature = "rust1", since = "1.0.0")]
66 LL | |     type Output;
67 ...  |
68 LL | |     fn add(self, rhs: Rhs) -> Self::Output;
69 LL | | }
70    | |_^ required by this bound in `Add`
71
72 error[E0283]: type annotations needed
73   --> $DIR/const-and-non-const-impl.rs:22:12
74    |
75 LL | impl const std::ops::Add for Int {
76    |            ^^^^^^^^^^^^^ cannot infer type for struct `Int`
77    |
78 note: multiple `impl`s satisfying `Int: Add` found
79   --> $DIR/const-and-non-const-impl.rs:14:1
80    |
81 LL | impl std::ops::Add for Int {
82    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
83 ...
84 LL | impl const std::ops::Add for Int {
85    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
86 note: required by a bound in `Add`
87   --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
88    |
89 LL | / pub trait Add<Rhs = Self> {
90 LL | |     /// The resulting type after applying the `+` operator.
91 LL | |     #[stable(feature = "rust1", since = "1.0.0")]
92 LL | |     type Output;
93 ...  |
94 LL | |     fn add(self, rhs: Rhs) -> Self::Output;
95 LL | | }
96    | |_^ required by this bound in `Add`
97
98 error: aborting due to 5 previous errors
99
100 Some errors have detailed explanations: E0117, E0119, E0283.
101 For more information about an error, try `rustc --explain E0117`.