2014-02-07 13:08:32 -06:00
|
|
|
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
2013-08-31 02:13:57 -05:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
// aux-build:lint_stability.rs
|
Add stability inheritance
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
Closes #13540.
2014-06-11 19:23:11 -05:00
|
|
|
// aux-build:inherited_stability.rs
|
2014-11-04 16:59:42 -06:00
|
|
|
// aux-build:stability_cfg1.rs
|
|
|
|
// aux-build:stability_cfg2.rs
|
2013-08-31 02:13:57 -05:00
|
|
|
|
2014-03-21 20:05:05 -05:00
|
|
|
#![deny(unstable)]
|
|
|
|
#![deny(deprecated)]
|
|
|
|
#![deny(experimental)]
|
|
|
|
#![allow(dead_code)]
|
2013-08-31 02:13:57 -05:00
|
|
|
|
2015-01-03 00:21:28 -06:00
|
|
|
#[macro_use]
|
|
|
|
extern crate lint_stability; //~ ERROR: use of unmarked item
|
|
|
|
|
2013-08-31 02:13:57 -05:00
|
|
|
mod cross_crate {
|
2014-11-04 16:59:42 -06:00
|
|
|
extern crate stability_cfg1;
|
|
|
|
extern crate stability_cfg2; //~ ERROR: use of experimental item
|
|
|
|
|
2015-01-03 00:21:28 -06:00
|
|
|
use lint_stability::*;
|
2013-08-31 02:13:57 -05:00
|
|
|
|
|
|
|
fn test() {
|
|
|
|
let foo = MethodTester;
|
|
|
|
|
|
|
|
deprecated(); //~ ERROR use of deprecated item
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.method_deprecated(); //~ ERROR use of deprecated item
|
|
|
|
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
2013-08-31 02:13:57 -05:00
|
|
|
|
|
|
|
deprecated_text(); //~ ERROR use of deprecated item: text
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
|
|
|
|
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
2013-08-31 02:13:57 -05:00
|
|
|
|
|
|
|
experimental(); //~ ERROR use of experimental item
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.method_experimental(); //~ ERROR use of experimental item
|
|
|
|
foo.trait_experimental(); //~ ERROR use of experimental item
|
2013-08-31 02:13:57 -05:00
|
|
|
|
|
|
|
experimental_text(); //~ ERROR use of experimental item: text
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.method_experimental_text(); //~ ERROR use of experimental item: text
|
|
|
|
foo.trait_experimental_text(); //~ ERROR use of experimental item: text
|
2013-08-31 02:13:57 -05:00
|
|
|
|
|
|
|
unstable(); //~ ERROR use of unstable item
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.method_unstable(); //~ ERROR use of unstable item
|
|
|
|
foo.trait_unstable(); //~ ERROR use of unstable item
|
2013-08-31 02:13:57 -05:00
|
|
|
|
|
|
|
unstable_text(); //~ ERROR use of unstable item: text
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.method_unstable_text(); //~ ERROR use of unstable item: text
|
|
|
|
foo.trait_unstable_text(); //~ ERROR use of unstable item: text
|
2013-08-31 02:13:57 -05:00
|
|
|
|
|
|
|
unmarked(); //~ ERROR use of unmarked item
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.method_unmarked(); //~ ERROR use of unmarked item
|
|
|
|
foo.trait_unmarked(); //~ ERROR use of unmarked item
|
2013-08-31 02:13:57 -05:00
|
|
|
|
|
|
|
stable();
|
|
|
|
foo.method_stable();
|
|
|
|
foo.trait_stable();
|
|
|
|
|
|
|
|
stable_text();
|
|
|
|
foo.method_stable_text();
|
|
|
|
foo.trait_stable_text();
|
|
|
|
|
|
|
|
frozen();
|
|
|
|
foo.method_frozen();
|
|
|
|
foo.trait_frozen();
|
|
|
|
|
|
|
|
frozen_text();
|
|
|
|
foo.method_frozen_text();
|
|
|
|
foo.trait_frozen_text();
|
|
|
|
|
|
|
|
locked();
|
|
|
|
foo.method_locked();
|
|
|
|
foo.trait_locked();
|
|
|
|
|
|
|
|
locked_text();
|
|
|
|
foo.method_locked_text();
|
|
|
|
foo.trait_locked_text();
|
|
|
|
|
|
|
|
let _ = DeprecatedStruct { i: 0 }; //~ ERROR use of deprecated item
|
|
|
|
let _ = ExperimentalStruct { i: 0 }; //~ ERROR use of experimental item
|
|
|
|
let _ = UnstableStruct { i: 0 }; //~ ERROR use of unstable item
|
|
|
|
let _ = UnmarkedStruct { i: 0 }; //~ ERROR use of unmarked item
|
|
|
|
let _ = StableStruct { i: 0 };
|
|
|
|
let _ = FrozenStruct { i: 0 };
|
|
|
|
let _ = LockedStruct { i: 0 };
|
|
|
|
|
|
|
|
let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
|
|
|
|
let _ = ExperimentalUnitStruct; //~ ERROR use of experimental item
|
|
|
|
let _ = UnstableUnitStruct; //~ ERROR use of unstable item
|
|
|
|
let _ = UnmarkedUnitStruct; //~ ERROR use of unmarked item
|
|
|
|
let _ = StableUnitStruct;
|
|
|
|
let _ = FrozenUnitStruct;
|
|
|
|
let _ = LockedUnitStruct;
|
|
|
|
|
2014-11-06 02:05:53 -06:00
|
|
|
let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
|
|
|
|
let _ = Enum::ExperimentalVariant; //~ ERROR use of experimental item
|
|
|
|
let _ = Enum::UnstableVariant; //~ ERROR use of unstable item
|
|
|
|
let _ = Enum::UnmarkedVariant; //~ ERROR use of unmarked item
|
|
|
|
let _ = Enum::StableVariant;
|
|
|
|
let _ = Enum::FrozenVariant;
|
|
|
|
let _ = Enum::LockedVariant;
|
2014-01-30 06:36:05 -06:00
|
|
|
|
|
|
|
let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
|
|
|
|
let _ = ExperimentalTupleStruct (1); //~ ERROR use of experimental item
|
|
|
|
let _ = UnstableTupleStruct (1); //~ ERROR use of unstable item
|
|
|
|
let _ = UnmarkedTupleStruct (1); //~ ERROR use of unmarked item
|
|
|
|
let _ = StableTupleStruct (1);
|
|
|
|
let _ = FrozenTupleStruct (1);
|
|
|
|
let _ = LockedTupleStruct (1);
|
2014-07-16 15:50:33 -05:00
|
|
|
|
2014-09-17 17:15:36 -05:00
|
|
|
// At the moment, the lint checker only checks stability in
|
|
|
|
// in the arguments of macros.
|
|
|
|
// Eventually, we will want to lint the contents of the
|
2014-07-16 15:50:33 -05:00
|
|
|
// macro in the module *defining* it. Also, stability levels
|
|
|
|
// on macros themselves are not yet linted.
|
|
|
|
macro_test!();
|
2014-09-17 17:15:36 -05:00
|
|
|
macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item: text
|
2014-09-24 04:14:19 -05:00
|
|
|
macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item: text
|
2014-09-17 17:15:36 -05:00
|
|
|
macro_test_arg_nested!(deprecated_text);
|
2013-08-31 02:13:57 -05:00
|
|
|
}
|
2013-12-15 20:52:48 -06:00
|
|
|
|
|
|
|
fn test_method_param<F: Trait>(foo: F) {
|
|
|
|
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
|
|
|
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
|
|
|
foo.trait_experimental(); //~ ERROR use of experimental item
|
|
|
|
foo.trait_experimental_text(); //~ ERROR use of experimental item: text
|
|
|
|
foo.trait_unstable(); //~ ERROR use of unstable item
|
|
|
|
foo.trait_unstable_text(); //~ ERROR use of unstable item: text
|
|
|
|
foo.trait_unmarked(); //~ ERROR use of unmarked item
|
|
|
|
foo.trait_stable();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn test_method_object(foo: &Trait) {
|
|
|
|
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
|
|
|
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
|
|
|
foo.trait_experimental(); //~ ERROR use of experimental item
|
|
|
|
foo.trait_experimental_text(); //~ ERROR use of experimental item: text
|
|
|
|
foo.trait_unstable(); //~ ERROR use of unstable item
|
|
|
|
foo.trait_unstable_text(); //~ ERROR use of unstable item: text
|
|
|
|
foo.trait_unmarked(); //~ ERROR use of unmarked item
|
|
|
|
foo.trait_stable();
|
|
|
|
}
|
2014-11-05 17:49:37 -06:00
|
|
|
|
|
|
|
struct S;
|
|
|
|
|
|
|
|
impl ExperimentalTrait for S { } //~ ERROR use of experimental item
|
|
|
|
|
|
|
|
trait LocalTrait : ExperimentalTrait { } //~ ERROR use of experimental item
|
2013-08-31 02:13:57 -05:00
|
|
|
}
|
|
|
|
|
Add stability inheritance
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
Closes #13540.
2014-06-11 19:23:11 -05:00
|
|
|
mod inheritance {
|
2014-11-04 01:54:12 -06:00
|
|
|
extern crate inherited_stability; //~ ERROR: use of experimental item
|
Add stability inheritance
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
Closes #13540.
2014-06-11 19:23:11 -05:00
|
|
|
use self::inherited_stability::*;
|
|
|
|
|
|
|
|
fn test_inheritance() {
|
|
|
|
experimental(); //~ ERROR use of experimental item
|
|
|
|
stable();
|
|
|
|
|
|
|
|
stable_mod::experimental(); //~ ERROR use of experimental item
|
|
|
|
stable_mod::stable();
|
|
|
|
|
2014-11-11 14:52:12 -06:00
|
|
|
unstable_mod::experimental(); //~ ERROR use of experimental item
|
|
|
|
unstable_mod::unstable(); //~ ERROR use of unstable item
|
|
|
|
|
Add stability inheritance
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
Closes #13540.
2014-06-11 19:23:11 -05:00
|
|
|
experimental_mod::experimental(); //~ ERROR use of experimental item
|
|
|
|
experimental_mod::stable();
|
|
|
|
|
2014-11-06 02:05:53 -06:00
|
|
|
let _ = Experimental::ExperimentalVariant; //~ ERROR use of experimental item
|
|
|
|
let _ = Experimental::StableVariant;
|
Add stability inheritance
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
Closes #13540.
2014-06-11 19:23:11 -05:00
|
|
|
|
|
|
|
let x: uint = 0;
|
|
|
|
x.experimental(); //~ ERROR use of experimental item
|
|
|
|
x.stable();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-31 02:13:57 -05:00
|
|
|
mod this_crate {
|
|
|
|
#[deprecated]
|
|
|
|
pub fn deprecated() {}
|
|
|
|
#[deprecated="text"]
|
|
|
|
pub fn deprecated_text() {}
|
|
|
|
|
|
|
|
#[experimental]
|
|
|
|
pub fn experimental() {}
|
|
|
|
#[experimental="text"]
|
|
|
|
pub fn experimental_text() {}
|
|
|
|
|
|
|
|
#[unstable]
|
|
|
|
pub fn unstable() {}
|
|
|
|
#[unstable="text"]
|
|
|
|
pub fn unstable_text() {}
|
|
|
|
|
|
|
|
pub fn unmarked() {}
|
|
|
|
|
|
|
|
#[stable]
|
|
|
|
pub fn stable() {}
|
|
|
|
#[stable="text"]
|
|
|
|
pub fn stable_text() {}
|
|
|
|
|
|
|
|
#[locked]
|
|
|
|
pub fn locked() {}
|
|
|
|
#[locked="text"]
|
|
|
|
pub fn locked_text() {}
|
|
|
|
|
|
|
|
#[frozen]
|
|
|
|
pub fn frozen() {}
|
|
|
|
#[frozen="text"]
|
|
|
|
pub fn frozen_text() {}
|
|
|
|
|
|
|
|
#[stable]
|
|
|
|
pub struct MethodTester;
|
|
|
|
|
|
|
|
impl MethodTester {
|
|
|
|
#[deprecated]
|
|
|
|
pub fn method_deprecated(&self) {}
|
|
|
|
#[deprecated="text"]
|
|
|
|
pub fn method_deprecated_text(&self) {}
|
|
|
|
|
|
|
|
#[experimental]
|
|
|
|
pub fn method_experimental(&self) {}
|
|
|
|
#[experimental="text"]
|
|
|
|
pub fn method_experimental_text(&self) {}
|
|
|
|
|
|
|
|
#[unstable]
|
|
|
|
pub fn method_unstable(&self) {}
|
|
|
|
#[unstable="text"]
|
|
|
|
pub fn method_unstable_text(&self) {}
|
|
|
|
|
|
|
|
pub fn method_unmarked(&self) {}
|
|
|
|
|
|
|
|
#[stable]
|
|
|
|
pub fn method_stable(&self) {}
|
|
|
|
#[stable="text"]
|
|
|
|
pub fn method_stable_text(&self) {}
|
|
|
|
|
|
|
|
#[locked]
|
|
|
|
pub fn method_locked(&self) {}
|
|
|
|
#[locked="text"]
|
|
|
|
pub fn method_locked_text(&self) {}
|
|
|
|
|
|
|
|
#[frozen]
|
|
|
|
pub fn method_frozen(&self) {}
|
|
|
|
#[frozen="text"]
|
|
|
|
pub fn method_frozen_text(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait Trait {
|
|
|
|
#[deprecated]
|
|
|
|
fn trait_deprecated(&self) {}
|
|
|
|
#[deprecated="text"]
|
|
|
|
fn trait_deprecated_text(&self) {}
|
|
|
|
|
|
|
|
#[experimental]
|
|
|
|
fn trait_experimental(&self) {}
|
|
|
|
#[experimental="text"]
|
|
|
|
fn trait_experimental_text(&self) {}
|
|
|
|
|
|
|
|
#[unstable]
|
|
|
|
fn trait_unstable(&self) {}
|
|
|
|
#[unstable="text"]
|
|
|
|
fn trait_unstable_text(&self) {}
|
|
|
|
|
|
|
|
fn trait_unmarked(&self) {}
|
|
|
|
|
|
|
|
#[stable]
|
|
|
|
fn trait_stable(&self) {}
|
|
|
|
#[stable="text"]
|
|
|
|
fn trait_stable_text(&self) {}
|
|
|
|
|
|
|
|
#[locked]
|
|
|
|
fn trait_locked(&self) {}
|
|
|
|
#[locked="text"]
|
|
|
|
fn trait_locked_text(&self) {}
|
|
|
|
|
|
|
|
#[frozen]
|
|
|
|
fn trait_frozen(&self) {}
|
|
|
|
#[frozen="text"]
|
|
|
|
fn trait_frozen_text(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Trait for MethodTester {}
|
|
|
|
|
|
|
|
#[deprecated]
|
|
|
|
pub struct DeprecatedStruct { i: int }
|
|
|
|
#[experimental]
|
|
|
|
pub struct ExperimentalStruct { i: int }
|
|
|
|
#[unstable]
|
|
|
|
pub struct UnstableStruct { i: int }
|
|
|
|
pub struct UnmarkedStruct { i: int }
|
|
|
|
#[stable]
|
|
|
|
pub struct StableStruct { i: int }
|
|
|
|
#[frozen]
|
|
|
|
pub struct FrozenStruct { i: int }
|
|
|
|
#[locked]
|
|
|
|
pub struct LockedStruct { i: int }
|
|
|
|
|
|
|
|
#[deprecated]
|
|
|
|
pub struct DeprecatedUnitStruct;
|
|
|
|
#[experimental]
|
|
|
|
pub struct ExperimentalUnitStruct;
|
|
|
|
#[unstable]
|
|
|
|
pub struct UnstableUnitStruct;
|
|
|
|
pub struct UnmarkedUnitStruct;
|
|
|
|
#[stable]
|
|
|
|
pub struct StableUnitStruct;
|
|
|
|
#[frozen]
|
|
|
|
pub struct FrozenUnitStruct;
|
|
|
|
#[locked]
|
|
|
|
pub struct LockedUnitStruct;
|
|
|
|
|
|
|
|
pub enum Enum {
|
|
|
|
#[deprecated]
|
|
|
|
DeprecatedVariant,
|
|
|
|
#[experimental]
|
|
|
|
ExperimentalVariant,
|
|
|
|
#[unstable]
|
|
|
|
UnstableVariant,
|
|
|
|
|
|
|
|
UnmarkedVariant,
|
|
|
|
#[stable]
|
|
|
|
StableVariant,
|
|
|
|
#[frozen]
|
|
|
|
FrozenVariant,
|
|
|
|
#[locked]
|
|
|
|
LockedVariant,
|
|
|
|
}
|
|
|
|
|
2014-01-30 06:36:05 -06:00
|
|
|
#[deprecated]
|
|
|
|
pub struct DeprecatedTupleStruct(int);
|
|
|
|
#[experimental]
|
|
|
|
pub struct ExperimentalTupleStruct(int);
|
|
|
|
#[unstable]
|
|
|
|
pub struct UnstableTupleStruct(int);
|
|
|
|
pub struct UnmarkedTupleStruct(int);
|
|
|
|
#[stable]
|
|
|
|
pub struct StableTupleStruct(int);
|
|
|
|
#[frozen]
|
|
|
|
pub struct FrozenTupleStruct(int);
|
|
|
|
#[locked]
|
|
|
|
pub struct LockedTupleStruct(int);
|
|
|
|
|
2013-08-31 02:13:57 -05:00
|
|
|
fn test() {
|
2014-08-11 18:39:34 -05:00
|
|
|
// Only the deprecated cases of the following should generate
|
|
|
|
// errors, because other stability attributes now have meaning
|
|
|
|
// only *across* crates, not within a single crate.
|
Add stability inheritance
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
Closes #13540.
2014-06-11 19:23:11 -05:00
|
|
|
|
2013-08-31 02:13:57 -05:00
|
|
|
let foo = MethodTester;
|
|
|
|
|
2014-08-11 18:39:34 -05:00
|
|
|
deprecated(); //~ ERROR use of deprecated item
|
|
|
|
foo.method_deprecated(); //~ ERROR use of deprecated item
|
|
|
|
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
2013-08-31 02:13:57 -05:00
|
|
|
|
2014-08-11 18:39:34 -05:00
|
|
|
deprecated_text(); //~ ERROR use of deprecated item: text
|
|
|
|
foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
|
|
|
|
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
2013-08-31 02:13:57 -05:00
|
|
|
|
Add stability inheritance
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
Closes #13540.
2014-06-11 19:23:11 -05:00
|
|
|
experimental();
|
|
|
|
foo.method_experimental();
|
|
|
|
foo.trait_experimental();
|
2013-08-31 02:13:57 -05:00
|
|
|
|
Add stability inheritance
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
Closes #13540.
2014-06-11 19:23:11 -05:00
|
|
|
experimental_text();
|
|
|
|
foo.method_experimental_text();
|
|
|
|
foo.trait_experimental_text();
|
2013-08-31 02:13:57 -05:00
|
|
|
|
Add stability inheritance
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
Closes #13540.
2014-06-11 19:23:11 -05:00
|
|
|
unstable();
|
|
|
|
foo.method_unstable();
|
|
|
|
foo.trait_unstable();
|
2013-08-31 02:13:57 -05:00
|
|
|
|
Add stability inheritance
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
Closes #13540.
2014-06-11 19:23:11 -05:00
|
|
|
unstable_text();
|
|
|
|
foo.method_unstable_text();
|
|
|
|
foo.trait_unstable_text();
|
2013-08-31 02:13:57 -05:00
|
|
|
|
Add stability inheritance
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
Closes #13540.
2014-06-11 19:23:11 -05:00
|
|
|
unmarked();
|
|
|
|
foo.method_unmarked();
|
|
|
|
foo.trait_unmarked();
|
2013-08-31 02:13:57 -05:00
|
|
|
|
|
|
|
stable();
|
|
|
|
foo.method_stable();
|
|
|
|
foo.trait_stable();
|
|
|
|
|
|
|
|
stable_text();
|
|
|
|
foo.method_stable_text();
|
|
|
|
foo.trait_stable_text();
|
|
|
|
|
|
|
|
frozen();
|
|
|
|
foo.method_frozen();
|
|
|
|
foo.trait_frozen();
|
|
|
|
|
|
|
|
frozen_text();
|
|
|
|
foo.method_frozen_text();
|
|
|
|
foo.trait_frozen_text();
|
|
|
|
|
|
|
|
locked();
|
|
|
|
foo.method_locked();
|
|
|
|
foo.trait_locked();
|
|
|
|
|
|
|
|
locked_text();
|
|
|
|
foo.method_locked_text();
|
|
|
|
foo.trait_locked_text();
|
|
|
|
|
2014-08-11 18:39:34 -05:00
|
|
|
let _ = DeprecatedStruct { i: 0 }; //~ ERROR use of deprecated item
|
Add stability inheritance
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
Closes #13540.
2014-06-11 19:23:11 -05:00
|
|
|
let _ = ExperimentalStruct { i: 0 };
|
|
|
|
let _ = UnstableStruct { i: 0 };
|
|
|
|
let _ = UnmarkedStruct { i: 0 };
|
2013-08-31 02:13:57 -05:00
|
|
|
let _ = StableStruct { i: 0 };
|
|
|
|
let _ = FrozenStruct { i: 0 };
|
|
|
|
let _ = LockedStruct { i: 0 };
|
|
|
|
|
2014-08-11 18:39:34 -05:00
|
|
|
let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
|
Add stability inheritance
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
Closes #13540.
2014-06-11 19:23:11 -05:00
|
|
|
let _ = ExperimentalUnitStruct;
|
|
|
|
let _ = UnstableUnitStruct;
|
|
|
|
let _ = UnmarkedUnitStruct;
|
2013-08-31 02:13:57 -05:00
|
|
|
let _ = StableUnitStruct;
|
|
|
|
let _ = FrozenUnitStruct;
|
|
|
|
let _ = LockedUnitStruct;
|
|
|
|
|
2014-11-06 02:05:53 -06:00
|
|
|
let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
|
|
|
|
let _ = Enum::ExperimentalVariant;
|
|
|
|
let _ = Enum::UnstableVariant;
|
|
|
|
let _ = Enum::UnmarkedVariant;
|
|
|
|
let _ = Enum::StableVariant;
|
|
|
|
let _ = Enum::FrozenVariant;
|
|
|
|
let _ = Enum::LockedVariant;
|
2014-01-30 06:36:05 -06:00
|
|
|
|
2014-08-11 18:39:34 -05:00
|
|
|
let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
|
Add stability inheritance
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
Closes #13540.
2014-06-11 19:23:11 -05:00
|
|
|
let _ = ExperimentalTupleStruct (1);
|
|
|
|
let _ = UnstableTupleStruct (1);
|
|
|
|
let _ = UnmarkedTupleStruct (1);
|
2014-01-30 06:36:05 -06:00
|
|
|
let _ = StableTupleStruct (1);
|
|
|
|
let _ = FrozenTupleStruct (1);
|
|
|
|
let _ = LockedTupleStruct (1);
|
2013-08-31 02:13:57 -05:00
|
|
|
}
|
2013-12-15 20:52:48 -06:00
|
|
|
|
|
|
|
fn test_method_param<F: Trait>(foo: F) {
|
2014-08-11 18:39:34 -05:00
|
|
|
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
|
|
|
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
Add stability inheritance
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
Closes #13540.
2014-06-11 19:23:11 -05:00
|
|
|
foo.trait_experimental();
|
|
|
|
foo.trait_experimental_text();
|
|
|
|
foo.trait_unstable();
|
|
|
|
foo.trait_unstable_text();
|
|
|
|
foo.trait_unmarked();
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.trait_stable();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn test_method_object(foo: &Trait) {
|
2014-08-11 18:39:34 -05:00
|
|
|
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
|
|
|
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
Add stability inheritance
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
Closes #13540.
2014-06-11 19:23:11 -05:00
|
|
|
foo.trait_experimental();
|
|
|
|
foo.trait_experimental_text();
|
|
|
|
foo.trait_unstable();
|
|
|
|
foo.trait_unstable_text();
|
|
|
|
foo.trait_unmarked();
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.trait_stable();
|
|
|
|
}
|
2014-11-05 17:49:37 -06:00
|
|
|
|
2014-11-17 04:37:07 -06:00
|
|
|
#[deprecated]
|
|
|
|
fn test_fn_body() {
|
|
|
|
fn fn_in_body() {}
|
|
|
|
fn_in_body();
|
|
|
|
}
|
|
|
|
|
|
|
|
impl MethodTester {
|
|
|
|
#[deprecated]
|
|
|
|
fn test_method_body(&self) {
|
|
|
|
fn fn_in_body() {}
|
|
|
|
fn_in_body();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-05 17:49:37 -06:00
|
|
|
#[deprecated]
|
|
|
|
pub trait DeprecatedTrait {}
|
|
|
|
|
|
|
|
struct S;
|
|
|
|
|
|
|
|
impl DeprecatedTrait for S { } //~ ERROR use of deprecated item
|
|
|
|
|
|
|
|
trait LocalTrait : DeprecatedTrait { } //~ ERROR use of deprecated item
|
2013-08-31 02:13:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|