2015-01-22 14:33:46 -06: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.
|
|
|
|
|
|
|
|
// Various checks that stability attributes are used correctly, per RFC 507
|
|
|
|
|
|
|
|
#![feature(staged_api)]
|
|
|
|
|
2015-11-16 10:54:28 -06:00
|
|
|
#![stable(feature = "rust1", since = "1.0.0")]
|
|
|
|
|
2015-01-22 14:33:46 -06:00
|
|
|
mod bogus_attribute_types_1 {
|
2015-10-12 22:01:31 -05:00
|
|
|
#[stable(feature = "a", since = "a", reason)] //~ ERROR unknown meta item 'reason'
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f1() { }
|
|
|
|
|
2015-10-12 22:01:31 -05:00
|
|
|
#[stable(feature = "a", since)] //~ ERROR incorrect meta item
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f2() { }
|
|
|
|
|
2015-10-12 22:01:31 -05:00
|
|
|
#[stable(feature, since = "a")] //~ ERROR incorrect meta item
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f3() { }
|
|
|
|
|
2015-10-12 22:01:31 -05:00
|
|
|
#[stable(feature = "a", since(b))] //~ ERROR incorrect meta item
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f5() { }
|
|
|
|
|
2015-10-12 22:01:31 -05:00
|
|
|
#[stable(feature(b), since = "a")] //~ ERROR incorrect meta item
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f6() { }
|
|
|
|
}
|
|
|
|
|
|
|
|
mod bogus_attribute_types_2 {
|
|
|
|
#[unstable] //~ ERROR incorrect stability attribute type
|
|
|
|
fn f1() { }
|
|
|
|
|
|
|
|
#[unstable = "a"] //~ ERROR incorrect stability attribute type
|
|
|
|
fn f2() { }
|
|
|
|
|
|
|
|
#[stable] //~ ERROR incorrect stability attribute type
|
|
|
|
fn f3() { }
|
|
|
|
|
|
|
|
#[stable = "a"] //~ ERROR incorrect stability attribute type
|
|
|
|
fn f4() { }
|
|
|
|
|
|
|
|
#[stable(feature = "a", since = "b")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated] //~ ERROR incorrect stability attribute type
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f5() { }
|
|
|
|
|
|
|
|
#[stable(feature = "a", since = "b")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated = "a"] //~ ERROR incorrect stability attribute type
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f6() { }
|
|
|
|
}
|
|
|
|
|
|
|
|
mod missing_feature_names {
|
2015-10-12 22:01:31 -05:00
|
|
|
#[unstable(issue = "0")] //~ ERROR missing 'feature'
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f1() { }
|
|
|
|
|
2015-10-12 22:01:31 -05:00
|
|
|
#[unstable(feature = "a")] //~ ERROR missing 'issue'
|
|
|
|
fn f2() { }
|
2015-08-13 15:06:25 -05:00
|
|
|
|
2015-01-22 14:33:46 -06:00
|
|
|
#[stable(since = "a")] //~ ERROR missing 'feature'
|
2015-08-13 15:06:25 -05:00
|
|
|
fn f3() { }
|
2015-01-22 14:33:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
mod missing_version {
|
|
|
|
#[stable(feature = "a")] //~ ERROR missing 'since'
|
|
|
|
fn f1() { }
|
|
|
|
|
|
|
|
#[stable(feature = "a", since = "b")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated(reason = "a")] //~ ERROR missing 'since'
|
2015-01-22 14:33:46 -06:00
|
|
|
fn f2() { }
|
|
|
|
}
|
|
|
|
|
2015-10-12 22:01:31 -05:00
|
|
|
#[unstable(feature = "a", issue = "0")]
|
2015-01-22 14:33:46 -06:00
|
|
|
#[stable(feature = "a", since = "b")]
|
|
|
|
fn multiple1() { } //~ ERROR multiple stability levels
|
|
|
|
|
2015-10-12 22:01:31 -05:00
|
|
|
#[unstable(feature = "a", issue = "0")]
|
|
|
|
#[unstable(feature = "a", issue = "0")]
|
2015-01-22 14:33:46 -06:00
|
|
|
fn multiple2() { } //~ ERROR multiple stability levels
|
|
|
|
|
|
|
|
#[stable(feature = "a", since = "b")]
|
|
|
|
#[stable(feature = "a", since = "b")]
|
|
|
|
fn multiple3() { } //~ ERROR multiple stability levels
|
|
|
|
|
|
|
|
#[stable(feature = "a", since = "b")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated(since = "b", reason = "text")]
|
|
|
|
#[rustc_deprecated(since = "b", reason = "text")]
|
|
|
|
fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes
|
2015-06-11 19:18:46 -05:00
|
|
|
//~^ ERROR Invalid stability or deprecation version found
|
2015-01-22 14:33:46 -06:00
|
|
|
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated(since = "a", reason = "text")]
|
|
|
|
fn deprecated_without_unstable_or_stable() { } //~ ERROR rustc_deprecated attribute must be paired
|
2015-01-22 14:33:46 -06:00
|
|
|
|
|
|
|
fn main() { }
|