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(deprecated)]
|
|
|
|
#![allow(dead_code)]
|
2015-01-21 20:21:14 -06:00
|
|
|
#![feature(staged_api)]
|
2013-08-31 02:13:57 -05:00
|
|
|
|
2015-11-16 10:54:28 -06:00
|
|
|
#![stable(feature = "rust1", since = "1.0.0")]
|
|
|
|
|
2015-01-03 00:21:28 -06:00
|
|
|
#[macro_use]
|
2015-02-03 15:50:12 -06:00
|
|
|
extern crate lint_stability;
|
2015-01-03 00:21:28 -06:00
|
|
|
|
2013-08-31 02:13:57 -05:00
|
|
|
mod cross_crate {
|
2014-11-04 16:59:42 -06:00
|
|
|
extern crate stability_cfg1;
|
2015-03-05 20:33:58 -06:00
|
|
|
extern crate stability_cfg2; //~ ERROR use of unstable library feature
|
2014-11-04 16:59:42 -06:00
|
|
|
|
2015-01-03 00:21:28 -06:00
|
|
|
use lint_stability::*;
|
2013-08-31 02:13:57 -05:00
|
|
|
|
|
|
|
fn test() {
|
2015-02-19 14:28:20 -06:00
|
|
|
type Foo = MethodTester;
|
2013-08-31 02:13:57 -05:00
|
|
|
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
|
2015-02-19 14:28:20 -06:00
|
|
|
Foo::method_deprecated(&foo); //~ ERROR use of deprecated item
|
|
|
|
<Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
|
|
|
<Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
|
|
|
<Foo as Trait>::trait_deprecated(&foo); //~ 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
|
2015-02-19 14:28:20 -06:00
|
|
|
Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
|
|
|
<Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
|
|
|
<Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
|
|
|
<Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
2013-08-31 02:13:57 -05:00
|
|
|
|
2015-01-22 14:33:46 -06:00
|
|
|
deprecated_unstable(); //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-01-22 14:33:46 -06:00
|
|
|
foo.method_deprecated_unstable(); //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
Foo::method_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
<Foo>::method_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-01-22 14:33:46 -06:00
|
|
|
foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
<Foo>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
<Foo as Trait>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-01-22 14:33:46 -06:00
|
|
|
|
|
|
|
deprecated_unstable_text(); //~ ERROR use of deprecated item: text
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-01-22 14:33:46 -06:00
|
|
|
foo.method_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
Foo::method_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
<Foo>::method_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-01-22 14:33:46 -06:00
|
|
|
foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
<Foo>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
<Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-01-22 14:33:46 -06:00
|
|
|
|
2015-03-05 20:33:58 -06:00
|
|
|
unstable(); //~ ERROR use of unstable library feature
|
|
|
|
foo.method_unstable(); //~ ERROR use of unstable library feature
|
|
|
|
Foo::method_unstable(&foo); //~ ERROR use of unstable library feature
|
|
|
|
<Foo>::method_unstable(&foo); //~ ERROR use of unstable library feature
|
|
|
|
foo.trait_unstable(); //~ ERROR use of unstable library feature
|
|
|
|
Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature
|
|
|
|
<Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature
|
|
|
|
<Foo as Trait>::trait_unstable(&foo); //~ ERROR use of unstable library feature
|
2013-08-31 02:13:57 -05:00
|
|
|
|
2015-02-19 14:28:20 -06:00
|
|
|
unstable_text();
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature 'test_feature': text
|
2015-02-19 14:28:20 -06:00
|
|
|
foo.method_unstable_text();
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature 'test_feature': text
|
2015-02-19 14:28:20 -06:00
|
|
|
Foo::method_unstable_text(&foo);
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature 'test_feature': text
|
2015-02-19 14:28:20 -06:00
|
|
|
<Foo>::method_unstable_text(&foo);
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature 'test_feature': text
|
2015-02-19 14:28:20 -06:00
|
|
|
foo.trait_unstable_text();
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature 'test_feature': text
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_unstable_text(&foo);
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature 'test_feature': text
|
2015-02-19 14:28:20 -06:00
|
|
|
<Foo>::trait_unstable_text(&foo);
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature 'test_feature': text
|
2015-02-19 14:28:20 -06:00
|
|
|
<Foo as Trait>::trait_unstable_text(&foo);
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature 'test_feature': text
|
2013-08-31 02:13:57 -05:00
|
|
|
|
|
|
|
stable();
|
|
|
|
foo.method_stable();
|
2015-02-19 14:28:20 -06:00
|
|
|
Foo::method_stable(&foo);
|
|
|
|
<Foo>::method_stable(&foo);
|
2013-08-31 02:13:57 -05:00
|
|
|
foo.trait_stable();
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_stable(&foo);
|
|
|
|
<Foo>::trait_stable(&foo);
|
|
|
|
<Foo as Trait>::trait_stable(&foo);
|
2013-08-31 02:13:57 -05:00
|
|
|
|
|
|
|
stable_text();
|
|
|
|
foo.method_stable_text();
|
2015-02-19 14:28:20 -06:00
|
|
|
Foo::method_stable_text(&foo);
|
|
|
|
<Foo>::method_stable_text(&foo);
|
2013-08-31 02:13:57 -05:00
|
|
|
foo.trait_stable_text();
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_stable_text(&foo);
|
|
|
|
<Foo>::trait_stable_text(&foo);
|
|
|
|
<Foo as Trait>::trait_stable_text(&foo);
|
2013-08-31 02:13:57 -05:00
|
|
|
|
2016-06-11 10:47:47 -05:00
|
|
|
struct S1<T: TraitWithAssociatedTypes>(T::TypeUnstable);
|
|
|
|
//~^ ERROR use of unstable library feature
|
|
|
|
struct S2<T: TraitWithAssociatedTypes>(T::TypeDeprecated);
|
|
|
|
//~^ ERROR use of deprecated item
|
|
|
|
|
2015-11-16 10:54:28 -06:00
|
|
|
let _ = DeprecatedStruct { //~ ERROR use of deprecated item
|
|
|
|
i: 0 //~ ERROR use of deprecated item
|
|
|
|
};
|
2015-06-06 19:14:46 -05:00
|
|
|
let _ = DeprecatedUnstableStruct {
|
|
|
|
//~^ ERROR use of deprecated item
|
|
|
|
//~^^ ERROR use of unstable library feature
|
|
|
|
i: 0 //~ ERROR use of deprecated item
|
|
|
|
};
|
2015-03-05 20:33:58 -06:00
|
|
|
let _ = UnstableStruct { i: 0 }; //~ ERROR use of unstable library feature
|
2013-08-31 02:13:57 -05:00
|
|
|
let _ = StableStruct { i: 0 };
|
|
|
|
|
|
|
|
let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
|
2015-01-22 14:33:46 -06:00
|
|
|
let _ = DeprecatedUnstableUnitStruct; //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
|
|
|
let _ = UnstableUnitStruct; //~ ERROR use of unstable library feature
|
2013-08-31 02:13:57 -05:00
|
|
|
let _ = StableUnitStruct;
|
|
|
|
|
2014-11-06 02:05:53 -06:00
|
|
|
let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
|
2015-01-22 14:33:46 -06:00
|
|
|
let _ = Enum::DeprecatedUnstableVariant; //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
|
|
|
let _ = Enum::UnstableVariant; //~ ERROR use of unstable library feature
|
2014-11-06 02:05:53 -06:00
|
|
|
let _ = Enum::StableVariant;
|
2014-01-30 06:36:05 -06:00
|
|
|
|
|
|
|
let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
|
2015-01-22 14:33:46 -06:00
|
|
|
let _ = DeprecatedUnstableTupleStruct (1); //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
|
|
|
let _ = UnstableTupleStruct (1); //~ ERROR use of unstable library feature
|
2014-01-30 06:36:05 -06:00
|
|
|
let _ = StableTupleStruct (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.
|
2014-09-17 17:15:36 -05:00
|
|
|
macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item: text
|
2015-01-22 14:33:46 -06:00
|
|
|
macro_test_arg!(deprecated_unstable_text()); //~ ERROR use of deprecated item: text
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2014-09-24 04:14:19 -05:00
|
|
|
macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item: text
|
2013-08-31 02:13:57 -05:00
|
|
|
}
|
2013-12-15 20:52:48 -06:00
|
|
|
|
2015-02-19 14:28:20 -06:00
|
|
|
fn test_method_param<Foo: Trait>(foo: Foo) {
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
|
|
|
<Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
|
|
|
<Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
|
|
|
<Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
|
|
|
<Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
2015-01-22 14:33:46 -06:00
|
|
|
foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
<Foo>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
<Foo as Trait>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-01-22 14:33:46 -06:00
|
|
|
foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
<Foo>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
<Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
|
|
|
foo.trait_unstable(); //~ ERROR use of unstable library feature
|
|
|
|
Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature
|
|
|
|
<Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature
|
|
|
|
<Foo as Trait>::trait_unstable(&foo); //~ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
foo.trait_unstable_text();
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature 'test_feature': text
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_unstable_text(&foo);
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature 'test_feature': text
|
2015-02-19 14:28:20 -06:00
|
|
|
<Foo>::trait_unstable_text(&foo);
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature 'test_feature': text
|
2015-02-19 14:28:20 -06:00
|
|
|
<Foo as Trait>::trait_unstable_text(&foo);
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature 'test_feature': text
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.trait_stable();
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_stable(&foo);
|
|
|
|
<Foo>::trait_stable(&foo);
|
|
|
|
<Foo as Trait>::trait_stable(&foo);
|
2013-12-15 20:52:48 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn test_method_object(foo: &Trait) {
|
|
|
|
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
|
|
|
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
2015-01-22 14:33:46 -06:00
|
|
|
foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
2015-01-22 14:33:46 -06:00
|
|
|
foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature
|
|
|
|
foo.trait_unstable(); //~ ERROR use of unstable library feature
|
2015-02-19 14:28:20 -06:00
|
|
|
foo.trait_unstable_text();
|
2015-03-05 20:33:58 -06:00
|
|
|
//~^ ERROR use of unstable library feature 'test_feature': text
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.trait_stable();
|
|
|
|
}
|
2014-11-05 17:49:37 -06:00
|
|
|
|
|
|
|
struct S;
|
|
|
|
|
2015-03-05 20:33:58 -06:00
|
|
|
impl UnstableTrait for S { } //~ ERROR use of unstable library feature
|
2015-12-12 12:40:45 -06:00
|
|
|
impl DeprecatedTrait for S {} //~ ERROR use of deprecated item: text
|
2015-03-05 20:33:58 -06:00
|
|
|
trait LocalTrait : UnstableTrait { } //~ ERROR use of unstable library feature
|
2015-12-12 12:40:45 -06:00
|
|
|
trait LocalTrait2 : DeprecatedTrait { } //~ ERROR use of deprecated item: text
|
2015-02-17 15:56:06 -06:00
|
|
|
|
|
|
|
impl Trait for S {
|
|
|
|
fn trait_stable(&self) {}
|
2015-03-05 20:33:58 -06:00
|
|
|
fn trait_unstable(&self) {} //~ ERROR use of unstable library feature
|
2015-02-17 15:56:06 -06:00
|
|
|
}
|
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 {
|
2015-03-05 20:33:58 -06:00
|
|
|
extern crate inherited_stability; //~ ERROR use of unstable library feature
|
|
|
|
use self::inherited_stability::*; //~ ERROR use of unstable library feature
|
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
|
|
|
|
|
|
|
fn test_inheritance() {
|
2015-03-05 20:33:58 -06:00
|
|
|
unstable(); //~ ERROR use of unstable library feature
|
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
|
|
|
stable();
|
|
|
|
|
2015-03-05 20:33:58 -06:00
|
|
|
stable_mod::unstable(); //~ ERROR use of unstable library feature
|
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
|
|
|
stable_mod::stable();
|
|
|
|
|
2015-01-12 20:40:19 -06:00
|
|
|
unstable_mod::deprecated(); //~ ERROR use of deprecated item
|
2015-03-05 20:33:58 -06:00
|
|
|
unstable_mod::unstable(); //~ ERROR use of unstable library feature
|
2014-11-11 14:52:12 -06:00
|
|
|
|
2015-03-05 20:33:58 -06:00
|
|
|
let _ = Unstable::UnstableVariant; //~ ERROR use of unstable library feature
|
2015-01-12 20:40:19 -06:00
|
|
|
let _ = Unstable::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
|
|
|
|
2015-01-08 05:02:42 -06:00
|
|
|
let x: usize = 0;
|
2015-03-05 20:33:58 -06:00
|
|
|
x.unstable(); //~ ERROR use of unstable library feature
|
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
|
|
|
x.stable();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-31 02:13:57 -05:00
|
|
|
mod this_crate {
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated(since = "1.0.0", reason = "text")]
|
2013-08-31 02:13:57 -05:00
|
|
|
pub fn deprecated() {}
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated(since = "1.0.0", reason = "text")]
|
2013-08-31 02:13:57 -05:00
|
|
|
pub fn deprecated_text() {}
|
|
|
|
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
pub fn unstable() {}
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
pub fn unstable_text() {}
|
|
|
|
|
2015-01-23 23:48:20 -06:00
|
|
|
#[stable(feature = "rust1", since = "1.0.0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
pub fn stable() {}
|
2015-10-12 22:01:31 -05:00
|
|
|
#[stable(feature = "rust1", since = "1.0.0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
pub fn stable_text() {}
|
|
|
|
|
2015-01-23 23:48:20 -06:00
|
|
|
#[stable(feature = "rust1", since = "1.0.0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
pub struct MethodTester;
|
|
|
|
|
|
|
|
impl MethodTester {
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated(since = "1.0.0", reason = "text")]
|
2013-08-31 02:13:57 -05:00
|
|
|
pub fn method_deprecated(&self) {}
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated(since = "1.0.0", reason = "text")]
|
2013-08-31 02:13:57 -05:00
|
|
|
pub fn method_deprecated_text(&self) {}
|
|
|
|
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
pub fn method_unstable(&self) {}
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
pub fn method_unstable_text(&self) {}
|
|
|
|
|
2015-01-23 23:48:20 -06:00
|
|
|
#[stable(feature = "rust1", since = "1.0.0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
pub fn method_stable(&self) {}
|
2015-10-12 22:01:31 -05:00
|
|
|
#[stable(feature = "rust1", since = "1.0.0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
pub fn method_stable_text(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait Trait {
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated(since = "1.0.0", reason = "text")]
|
2013-08-31 02:13:57 -05:00
|
|
|
fn trait_deprecated(&self) {}
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated(since = "1.0.0", reason = "text")]
|
2013-08-31 02:13:57 -05:00
|
|
|
fn trait_deprecated_text(&self) {}
|
|
|
|
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
fn trait_unstable(&self) {}
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
fn trait_unstable_text(&self) {}
|
|
|
|
|
2015-01-23 23:48:20 -06:00
|
|
|
#[stable(feature = "rust1", since = "1.0.0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
fn trait_stable(&self) {}
|
2015-10-12 22:01:31 -05:00
|
|
|
#[stable(feature = "rust1", since = "1.0.0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
fn trait_stable_text(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Trait for MethodTester {}
|
|
|
|
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated(since = "1.0.0", reason = "text")]
|
2015-02-25 05:34:21 -06:00
|
|
|
pub struct DeprecatedStruct {
|
|
|
|
#[stable(feature = "test_feature", since = "1.0.0")] i: isize
|
|
|
|
}
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2015-02-25 05:34:21 -06:00
|
|
|
pub struct UnstableStruct {
|
|
|
|
#[stable(feature = "test_feature", since = "1.0.0")] i: isize
|
|
|
|
}
|
2015-01-23 23:48:20 -06:00
|
|
|
#[stable(feature = "rust1", since = "1.0.0")]
|
2015-02-25 05:34:21 -06:00
|
|
|
pub struct StableStruct {
|
|
|
|
#[stable(feature = "test_feature", since = "1.0.0")] i: isize
|
|
|
|
}
|
2013-08-31 02:13:57 -05:00
|
|
|
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated(since = "1.0.0", reason = "text")]
|
2013-08-31 02:13:57 -05:00
|
|
|
pub struct DeprecatedUnitStruct;
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
pub struct UnstableUnitStruct;
|
2015-01-23 23:48:20 -06:00
|
|
|
#[stable(feature = "rust1", since = "1.0.0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
pub struct StableUnitStruct;
|
|
|
|
|
|
|
|
pub enum Enum {
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated(since = "1.0.0", reason = "text")]
|
2013-08-31 02:13:57 -05:00
|
|
|
DeprecatedVariant,
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
UnstableVariant,
|
|
|
|
|
2015-01-23 23:48:20 -06:00
|
|
|
#[stable(feature = "rust1", since = "1.0.0")]
|
2013-08-31 02:13:57 -05:00
|
|
|
StableVariant,
|
|
|
|
}
|
|
|
|
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated(since = "1.0.0", reason = "text")]
|
2015-01-08 04:54:35 -06:00
|
|
|
pub struct DeprecatedTupleStruct(isize);
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2015-01-08 04:54:35 -06:00
|
|
|
pub struct UnstableTupleStruct(isize);
|
2015-01-23 23:48:20 -06:00
|
|
|
#[stable(feature = "rust1", since = "1.0.0")]
|
2015-01-08 04:54:35 -06:00
|
|
|
pub struct StableTupleStruct(isize);
|
2014-01-30 06:36:05 -06:00
|
|
|
|
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
|
|
|
|
2015-02-19 14:28:20 -06:00
|
|
|
type Foo = MethodTester;
|
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
|
2015-02-19 14:28:20 -06:00
|
|
|
Foo::method_deprecated(&foo); //~ ERROR use of deprecated item
|
|
|
|
<Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item
|
2014-08-11 18:39:34 -05:00
|
|
|
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
|
|
|
<Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
|
|
|
<Foo as Trait>::trait_deprecated(&foo); //~ 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
|
2015-02-19 14:28:20 -06:00
|
|
|
Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
|
|
|
<Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
2014-08-11 18:39:34 -05:00
|
|
|
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
|
|
|
<Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
|
|
|
<Foo as Trait>::trait_deprecated_text(&foo); //~ 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
|
|
|
unstable();
|
|
|
|
foo.method_unstable();
|
2015-02-19 14:28:20 -06:00
|
|
|
Foo::method_unstable(&foo);
|
|
|
|
<Foo>::method_unstable(&foo);
|
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_unstable();
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_unstable(&foo);
|
|
|
|
<Foo>::trait_unstable(&foo);
|
|
|
|
<Foo as Trait>::trait_unstable(&foo);
|
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();
|
2015-02-19 14:28:20 -06:00
|
|
|
Foo::method_unstable_text(&foo);
|
|
|
|
<Foo>::method_unstable_text(&foo);
|
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_unstable_text();
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_unstable_text(&foo);
|
|
|
|
<Foo>::trait_unstable_text(&foo);
|
|
|
|
<Foo as Trait>::trait_unstable_text(&foo);
|
2013-08-31 02:13:57 -05:00
|
|
|
|
|
|
|
stable();
|
|
|
|
foo.method_stable();
|
2015-02-19 14:28:20 -06:00
|
|
|
Foo::method_stable(&foo);
|
|
|
|
<Foo>::method_stable(&foo);
|
2013-08-31 02:13:57 -05:00
|
|
|
foo.trait_stable();
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_stable(&foo);
|
|
|
|
<Foo>::trait_stable(&foo);
|
|
|
|
<Foo as Trait>::trait_stable(&foo);
|
2013-08-31 02:13:57 -05:00
|
|
|
|
|
|
|
stable_text();
|
|
|
|
foo.method_stable_text();
|
2015-02-19 14:28:20 -06:00
|
|
|
Foo::method_stable_text(&foo);
|
|
|
|
<Foo>::method_stable_text(&foo);
|
2013-08-31 02:13:57 -05:00
|
|
|
foo.trait_stable_text();
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_stable_text(&foo);
|
|
|
|
<Foo>::trait_stable_text(&foo);
|
|
|
|
<Foo as Trait>::trait_stable_text(&foo);
|
2013-08-31 02:13:57 -05:00
|
|
|
|
2015-06-06 19:14:46 -05:00
|
|
|
let _ = DeprecatedStruct {
|
|
|
|
//~^ ERROR use of deprecated item
|
|
|
|
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 _ = UnstableStruct { i: 0 };
|
2013-08-31 02:13:57 -05:00
|
|
|
let _ = StableStruct { 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 _ = UnstableUnitStruct;
|
2013-08-31 02:13:57 -05:00
|
|
|
let _ = StableUnitStruct;
|
|
|
|
|
2014-11-06 02:05:53 -06:00
|
|
|
let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
|
|
|
|
let _ = Enum::UnstableVariant;
|
|
|
|
let _ = Enum::StableVariant;
|
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 _ = UnstableTupleStruct (1);
|
2014-01-30 06:36:05 -06:00
|
|
|
let _ = StableTupleStruct (1);
|
2013-08-31 02:13:57 -05:00
|
|
|
}
|
2013-12-15 20:52:48 -06:00
|
|
|
|
2015-02-19 14:28:20 -06:00
|
|
|
fn test_method_param<Foo: Trait>(foo: Foo) {
|
2014-08-11 18:39:34 -05:00
|
|
|
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
|
|
|
<Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
|
|
|
<Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item
|
2014-08-11 18:39:34 -05:00
|
|
|
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
|
|
|
<Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item: text
|
|
|
|
<Foo as Trait>::trait_deprecated_text(&foo); //~ 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_unstable();
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_unstable(&foo);
|
|
|
|
<Foo>::trait_unstable(&foo);
|
|
|
|
<Foo as Trait>::trait_unstable(&foo);
|
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_unstable_text();
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_unstable_text(&foo);
|
|
|
|
<Foo>::trait_unstable_text(&foo);
|
|
|
|
<Foo as Trait>::trait_unstable_text(&foo);
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.trait_stable();
|
2015-02-19 14:28:20 -06:00
|
|
|
Trait::trait_stable(&foo);
|
|
|
|
<Foo>::trait_stable(&foo);
|
|
|
|
<Foo as Trait>::trait_stable(&foo);
|
2013-12-15 20:52:48 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
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_unstable();
|
|
|
|
foo.trait_unstable_text();
|
2013-12-15 20:52:48 -06:00
|
|
|
foo.trait_stable();
|
|
|
|
}
|
2014-11-05 17:49:37 -06:00
|
|
|
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated(since = "1.0.0", reason = "text")]
|
2014-11-17 04:37:07 -06:00
|
|
|
fn test_fn_body() {
|
|
|
|
fn fn_in_body() {}
|
2015-11-16 10:54:28 -06:00
|
|
|
fn_in_body(); //~ ERROR use of deprecated item: text
|
2014-11-17 04:37:07 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
impl MethodTester {
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated(since = "1.0.0", reason = "text")]
|
2014-11-17 04:37:07 -06:00
|
|
|
fn test_method_body(&self) {
|
|
|
|
fn fn_in_body() {}
|
2015-11-16 10:54:28 -06:00
|
|
|
fn_in_body(); //~ ERROR use of deprecated item: text
|
2014-11-17 04:37:07 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-13 15:06:25 -05:00
|
|
|
#[unstable(feature = "test_feature", issue = "0")]
|
2015-11-20 07:11:20 -06:00
|
|
|
#[rustc_deprecated(since = "1.0.0", reason = "text")]
|
2015-02-12 09:29:52 -06:00
|
|
|
pub trait DeprecatedTrait {
|
|
|
|
fn dummy(&self) { }
|
|
|
|
}
|
2014-11-05 17:49:37 -06:00
|
|
|
|
|
|
|
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() {}
|