]> git.proxmox.com Git - rustc.git/blame - src/test/ui/rfc-2632-const-trait-impl/call-const-trait-method-fail.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / rfc-2632-const-trait-impl / call-const-trait-method-fail.rs
CommitLineData
74b04a01 1#![feature(const_trait_impl)]
74b04a01 2
2b03887a 3#[const_trait]
74b04a01
XL
4pub trait Plus {
5 fn plus(self, rhs: Self) -> Self;
6}
7
8impl const Plus for i32 {
9 fn plus(self, rhs: Self) -> Self {
10 self + rhs
11 }
12}
13
14impl Plus for u32 {
15 fn plus(self, rhs: Self) -> Self {
16 self + rhs
17 }
18}
19
20pub const fn add_i32(a: i32, b: i32) -> i32 {
21 a.plus(b) // ok
22}
23
24pub const fn add_u32(a: u32, b: u32) -> u32 {
25 a.plus(b)
5099ac24 26 //~^ ERROR the trait bound
74b04a01
XL
27}
28
29fn main() {}