convert-id: tests for const gating.
This commit is contained in:
parent
f84ec02bf7
commit
b7772e6c9e
17
src/test/ui/rfc-2306/convert-id-const-no-gate.rs
Normal file
17
src/test/ui/rfc-2306/convert-id-const-no-gate.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright 2018 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.
|
||||
|
||||
// This test should fail since identity is not stable as a const fn yet.
|
||||
|
||||
#![feature(convert_id)]
|
||||
|
||||
fn main() {
|
||||
const _FOO: u8 = ::std::convert::identity(42u8);
|
||||
}
|
10
src/test/ui/rfc-2306/convert-id-const-no-gate.stderr
Normal file
10
src/test/ui/rfc-2306/convert-id-const-no-gate.stderr
Normal file
@ -0,0 +1,10 @@
|
||||
error: `std::convert::identity` is not yet stable as a const fn
|
||||
--> $DIR/convert-id-const-no-gate.rs:16:22
|
||||
|
|
||||
LL | const _FOO: u8 = ::std::convert::identity(42u8);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: in Nightly builds, add `#![feature(const_convert_id)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
20
src/test/ui/rfc-2306/convert-id-const-with-gate.rs
Normal file
20
src/test/ui/rfc-2306/convert-id-const-with-gate.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright 2018 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.
|
||||
|
||||
// This test should pass since we've opted into 'identity' as an
|
||||
// unstable const fn.
|
||||
|
||||
// compile-pass
|
||||
|
||||
#![feature(convert_id, const_convert_id)]
|
||||
|
||||
fn main() {
|
||||
const _FOO: u8 = ::std::convert::identity(42u8);
|
||||
}
|
Loading…
Reference in New Issue
Block a user