]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/const-fn-mismatch.rs
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / ui / consts / const-fn-mismatch.rs
CommitLineData
62682a34
SL
1// Test that we can't declare a const fn in an impl -- right now it's
2// just not allowed at all, though eventually it'd make sense to allow
3// it if the trait fn is const (but right now no trait fns can be
4// const).
85aaf69f 5
62682a34
SL
6trait Foo {
7 fn f() -> u32;
8}
9
10impl Foo for u32 {
74b04a01
XL
11 const fn f() -> u32 {
12 //~^ ERROR functions in traits cannot be declared const
13 22
14 }
62682a34
SL
15}
16
74b04a01 17fn main() {}