Detect stability attributes on methods.
If it's a trait method, this checks the stability attribute of the method inside the trait definition. Otherwise, it checks the method implementation itself.
This commit is contained in:
parent
35e5056b6a
commit
4f95dceb59
5 changed files with 173 additions and 55 deletions
|
|
@ -26,32 +26,32 @@ mod cross_crate {
|
|||
let foo = MethodTester;
|
||||
|
||||
deprecated(); //~ ERROR use of deprecated item
|
||||
foo.method_deprecated(); // ~ ERROR use of deprecated item
|
||||
foo.trait_deprecated(); // ~ ERROR use of deprecated item
|
||||
foo.method_deprecated(); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
||||
|
||||
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
|
||||
foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
|
||||
experimental(); //~ ERROR use of experimental item
|
||||
foo.method_experimental(); // ~ ERROR use of experimental item
|
||||
foo.trait_experimental(); // ~ ERROR use of experimental item
|
||||
foo.method_experimental(); //~ ERROR use of experimental item
|
||||
foo.trait_experimental(); //~ ERROR use of experimental item
|
||||
|
||||
experimental_text(); //~ ERROR use of experimental item: text
|
||||
foo.method_experimental_text(); // ~ ERROR use of experimental item: text
|
||||
foo.trait_experimental_text(); // ~ ERROR use of experimental item: text
|
||||
foo.method_experimental_text(); //~ ERROR use of experimental item: text
|
||||
foo.trait_experimental_text(); //~ ERROR use of experimental item: text
|
||||
|
||||
unstable(); //~ ERROR use of unstable item
|
||||
foo.method_unstable(); // ~ ERROR use of unstable item
|
||||
foo.trait_unstable(); // ~ ERROR use of unstable item
|
||||
foo.method_unstable(); //~ ERROR use of unstable item
|
||||
foo.trait_unstable(); //~ ERROR use of unstable item
|
||||
|
||||
unstable_text(); //~ ERROR use of unstable item: text
|
||||
foo.method_unstable_text(); // ~ ERROR use of unstable item: text
|
||||
foo.trait_unstable_text(); // ~ ERROR use of unstable item: text
|
||||
foo.method_unstable_text(); //~ ERROR use of unstable item: text
|
||||
foo.trait_unstable_text(); //~ ERROR use of unstable item: text
|
||||
|
||||
unmarked(); //~ ERROR use of unmarked item
|
||||
foo.method_unmarked(); // ~ ERROR use of unmarked item
|
||||
foo.trait_unmarked(); // ~ ERROR use of unmarked item
|
||||
foo.method_unmarked(); //~ ERROR use of unmarked item
|
||||
foo.trait_unmarked(); //~ ERROR use of unmarked item
|
||||
|
||||
stable();
|
||||
foo.method_stable();
|
||||
|
|
@ -102,6 +102,28 @@ mod cross_crate {
|
|||
let _ = FrozenVariant;
|
||||
let _ = LockedVariant;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
mod this_crate {
|
||||
|
|
@ -259,32 +281,32 @@ mod this_crate {
|
|||
let foo = MethodTester;
|
||||
|
||||
deprecated(); //~ ERROR use of deprecated item
|
||||
foo.method_deprecated(); // ~ ERROR use of deprecated item
|
||||
foo.trait_deprecated(); // ~ ERROR use of deprecated item
|
||||
foo.method_deprecated(); //~ ERROR use of deprecated item
|
||||
foo.trait_deprecated(); //~ ERROR use of deprecated item
|
||||
|
||||
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
|
||||
foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
|
||||
|
||||
experimental(); //~ ERROR use of experimental item
|
||||
foo.method_experimental(); // ~ ERROR use of experimental item
|
||||
foo.trait_experimental(); // ~ ERROR use of experimental item
|
||||
foo.method_experimental(); //~ ERROR use of experimental item
|
||||
foo.trait_experimental(); //~ ERROR use of experimental item
|
||||
|
||||
experimental_text(); //~ ERROR use of experimental item: text
|
||||
foo.method_experimental_text(); // ~ ERROR use of experimental item: text
|
||||
foo.trait_experimental_text(); // ~ ERROR use of experimental item: text
|
||||
foo.method_experimental_text(); //~ ERROR use of experimental item: text
|
||||
foo.trait_experimental_text(); //~ ERROR use of experimental item: text
|
||||
|
||||
unstable(); //~ ERROR use of unstable item
|
||||
foo.method_unstable(); // ~ ERROR use of unstable item
|
||||
foo.trait_unstable(); // ~ ERROR use of unstable item
|
||||
foo.method_unstable(); //~ ERROR use of unstable item
|
||||
foo.trait_unstable(); //~ ERROR use of unstable item
|
||||
|
||||
unstable_text(); //~ ERROR use of unstable item: text
|
||||
foo.method_unstable_text(); // ~ ERROR use of unstable item: text
|
||||
foo.trait_unstable_text(); // ~ ERROR use of unstable item: text
|
||||
foo.method_unstable_text(); //~ ERROR use of unstable item: text
|
||||
foo.trait_unstable_text(); //~ ERROR use of unstable item: text
|
||||
|
||||
unmarked(); //~ ERROR use of unmarked item
|
||||
foo.method_unmarked(); // ~ ERROR use of unmarked item
|
||||
foo.trait_unmarked(); // ~ ERROR use of unmarked item
|
||||
foo.method_unmarked(); //~ ERROR use of unmarked item
|
||||
foo.trait_unmarked(); //~ ERROR use of unmarked item
|
||||
|
||||
stable();
|
||||
foo.method_stable();
|
||||
|
|
@ -335,6 +357,28 @@ mod this_crate {
|
|||
let _ = FrozenVariant;
|
||||
let _ = LockedVariant;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue