Parse, feature-gate, and validate the #[marker] attribute
This commit is contained in:
parent
62c6e4e145
commit
6149a83c0b
6 changed files with 97 additions and 2 deletions
19
src/test/ui/feature-gates/feature-gate-marker_trait_attr.rs
Normal file
19
src/test/ui/feature-gates/feature-gate-marker_trait_attr.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2017 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.
|
||||
|
||||
use std::fmt::{Debug, Display};
|
||||
|
||||
#[marker] trait ExplicitMarker {}
|
||||
//~^ ERROR marker traits is an experimental feature (see issue #29864)
|
||||
|
||||
impl<T: Display> ExplicitMarker for T {}
|
||||
impl<T: Debug> ExplicitMarker for T {}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
error[E0658]: marker traits is an experimental feature (see issue #29864)
|
||||
--> $DIR/feature-gate-marker_trait_attr.rs:13:1
|
||||
|
|
||||
LL | #[marker] trait ExplicitMarker {}
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(marker_trait_attr)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue