2015-05-05 07:47:04 -05:00
|
|
|
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
// Test that we can't declare a const fn in an impl -- right now it's
|
|
|
|
// just not allowed at all, though eventually it'd make sense to allow
|
|
|
|
// it if the trait fn is const (but right now no trait fns can be
|
|
|
|
// const).
|
|
|
|
|
|
|
|
#![feature(const_fn)]
|
|
|
|
|
|
|
|
trait Foo {
|
|
|
|
fn f() -> u32;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Foo for u32 {
|
2016-08-05 05:52:57 -05:00
|
|
|
const fn f() -> u32 { 22 }
|
2016-08-07 16:33:35 -05:00
|
|
|
//~^ ERROR trait fns cannot be declared const
|
2016-08-05 05:52:57 -05:00
|
|
|
//~| NOTE trait fns cannot be const
|
2015-05-05 07:47:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|