rustc: rework stability to be on-demand for type-directed lookup.

This commit is contained in:
Eduard Burtescu 2016-11-10 19:08:21 +02:00 committed by Eduard-Mihai Burtescu
parent f97c132cac
commit 9aaf26e7aa
97 changed files with 1775 additions and 859 deletions

View file

@ -16,7 +16,7 @@
// which is a reduction of this code to more directly show the reason
// for the error message we see here.)
#![feature(const_fn)]
#![feature(const_fn, rustc_private)]
extern crate arena;

View file

@ -19,6 +19,8 @@
// (Also compare against dropck_tarena_cycle_checked.rs, from which
// this was reduced to better understand its error message.)
#![feature(rustc_private)]
extern crate arena;
use arena::TypedArena;

View file

@ -9,7 +9,7 @@
// except according to those terms.
#![crate_type = "proc-macro"]
#![feature(proc_macro)]
#![feature(proc_macro, proc_macro_lib)]
extern crate proc_macro;

View file

@ -9,7 +9,7 @@
// except according to those terms.
#![crate_type = "proc-macro"]
#![feature(proc_macro)]
#![feature(proc_macro, proc_macro_lib)]
extern crate proc_macro;

View file

@ -11,7 +11,7 @@
// no-prefer-dynamic
#![crate_type = "proc-macro"]
#![feature(proc_macro)]
#![feature(proc_macro, proc_macro_lib)]
extern crate proc_macro;

View file

@ -11,7 +11,7 @@
// compile-flags: --test
#![crate_type = "proc-macro"]
#![feature(proc_macro)]
#![feature(proc_macro, proc_macro_lib)]
extern crate proc_macro;

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(proc_macro)]
#![feature(proc_macro, proc_macro_lib)]
extern crate proc_macro;

View file

@ -9,7 +9,7 @@
// except according to those terms.
#![crate_type = "proc-macro"]
#![feature(proc_macro)]
#![feature(proc_macro, proc_macro_lib)]
extern crate proc_macro;

View file

@ -9,7 +9,7 @@
// except according to those terms.
#![crate_type = "proc-macro"]
#![feature(proc_macro)]
#![feature(proc_macro, proc_macro_lib)]
#![allow(warnings)]
extern crate proc_macro;

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(collections)]
extern crate collections;
//~^ NOTE previous import of `collections` here

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(collections, libc)]
extern crate collections;
//~^ NOTE previous import of `collections` here

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(collections)]
extern crate collections;
//~^ NOTE previous import of `collections` here

View file

@ -12,7 +12,6 @@
#![feature(box_syntax)]
extern crate collections;
use std::collections::HashMap;
fn main() {

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(fn_traits)]
// Ensure that invoking a closure counts as a unique immutable borrow
type Fn<'a> = Box<FnMut() + 'a>;

View file

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate collections;
use std::collections::HashSet;
struct Foo {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(unboxed_closures)]
#![feature(fn_traits, unboxed_closures)]
use std::ops::{Fn, FnMut, FnOnce};

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
#[derive(PartialEq)]
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
#[derive(PartialEq)]
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
#[derive(PartialEq)]
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
#[derive(PartialEq)]
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
#[derive(Eq,PartialOrd,PartialEq)]
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
#[derive(Eq,PartialOrd,PartialEq)]
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
#[derive(Eq,PartialOrd,PartialEq)]
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
#[derive(Eq,PartialOrd,PartialEq)]
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
#[derive(PartialEq)]
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
#[derive(PartialEq)]
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
#[derive(PartialEq)]
struct Error;

View file

@ -1,4 +1,4 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -10,8 +10,6 @@
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
#[derive(PartialEq)]
struct Error;

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(core_intrinsics)]
use std::intrinsics::{init, forget};
// Test that the `forget` and `init` intrinsics are really unsafe

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(unboxed_closures)]
#![feature(fn_traits, unboxed_closures)]
use std::{fmt, ops};

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(fn_traits)]
pub fn foo<'a, F: Fn(&'a ())>(bar: F) {
bar.call((
&(), //~ ERROR borrowed value does not live long enough

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(unboxed_closures)]
#![feature(fn_traits, unboxed_closures)]
struct Foo;

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(libc)]
extern crate libc;
fn main() {

View file

@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(core)]
#![feature(core, fnbox)]
use std::boxed::FnBox;
struct FuncContainer {

View file

@ -17,7 +17,6 @@
extern crate lint_stability;
use lint_stability::{unstable, deprecated}; //~ ERROR use of unstable library feature 'test_feature'
//~^ WARNING use of deprecated item
use lint_stability::unstable::{self as u}; //~ ERROR use of unstable library feature 'test_feature'

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rand)]
fn main() {
extern crate rand;
use rand::Rng; //~ ERROR unresolved import

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(fn_traits)]
fn id<T>(t: T) -> T { t }
fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {

View file

@ -0,0 +1,25 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags: -F unused_features
// aux-build:lint_output_format.rs
#![feature(foo)] //~ ERROR unused or unknown feature
#![feature(test_feature)]
extern crate lint_output_format;
use lint_output_format::{foo, bar};
//~^ WARNING use of deprecated item: text,
fn main() {
let _x = foo(); //~ WARNING #[warn(deprecated)] on by default
let _y = bar();
}

View file

@ -11,13 +11,12 @@
// compile-flags: -F unused_features
// aux-build:lint_output_format.rs
#![feature(foo)] //~ ERROR unused or unknown feature
#![allow(deprecated)]
extern crate lint_output_format; //~ ERROR use of unstable library feature
use lint_output_format::{foo, bar}; //~ ERROR use of unstable library feature
//~^ WARNING use of deprecated item: text,
fn main() {
let _x = foo(); //~ WARNING #[warn(deprecated)] on by default
let _x = foo();
let _y = bar(); //~ ERROR use of unstable library feature
}

View file

@ -0,0 +1,423 @@
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// aux-build:lint_stability.rs
// aux-build:stability_cfg1.rs
#![allow(deprecated)]
#![allow(dead_code)]
#![feature(staged_api)]
#![stable(feature = "rust1", since = "1.0.0")]
#[macro_use]
extern crate lint_stability;
mod cross_crate {
extern crate stability_cfg1;
use lint_stability::*;
fn test() {
type Foo = MethodTester;
let foo = MethodTester;
deprecated();
foo.method_deprecated();
Foo::method_deprecated(&foo);
<Foo>::method_deprecated(&foo);
foo.trait_deprecated();
Trait::trait_deprecated(&foo);
<Foo>::trait_deprecated(&foo);
<Foo as Trait>::trait_deprecated(&foo);
deprecated_text();
foo.method_deprecated_text();
Foo::method_deprecated_text(&foo);
<Foo>::method_deprecated_text(&foo);
foo.trait_deprecated_text();
Trait::trait_deprecated_text(&foo);
<Foo>::trait_deprecated_text(&foo);
<Foo as Trait>::trait_deprecated_text(&foo);
foo.method_deprecated_unstable();
//~^ ERROR use of unstable library feature
Foo::method_deprecated_unstable(&foo);
//~^ ERROR use of unstable library feature
<Foo>::method_deprecated_unstable(&foo);
//~^ ERROR use of unstable library feature
foo.trait_deprecated_unstable();
//~^ ERROR use of unstable library feature
<Foo>::trait_deprecated_unstable(&foo);
//~^ ERROR use of unstable library feature
foo.method_deprecated_unstable_text();
//~^ ERROR use of unstable library feature
Foo::method_deprecated_unstable_text(&foo);
//~^ ERROR use of unstable library feature
<Foo>::method_deprecated_unstable_text(&foo);
//~^ ERROR use of unstable library feature
foo.trait_deprecated_unstable_text();
//~^ ERROR use of unstable library feature
<Foo>::trait_deprecated_unstable_text(&foo);
//~^ 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
<Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature
foo.method_unstable_text();
//~^ ERROR use of unstable library feature 'test_feature': text
Foo::method_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
<Foo>::method_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
foo.trait_unstable_text();
//~^ ERROR use of unstable library feature 'test_feature': text
<Foo>::trait_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
stable();
foo.method_stable();
Foo::method_stable(&foo);
<Foo>::method_stable(&foo);
foo.trait_stable();
Trait::trait_stable(&foo);
<Foo>::trait_stable(&foo);
<Foo as Trait>::trait_stable(&foo);
stable_text();
foo.method_stable_text();
Foo::method_stable_text(&foo);
<Foo>::method_stable_text(&foo);
foo.trait_stable_text();
Trait::trait_stable_text(&foo);
<Foo>::trait_stable_text(&foo);
<Foo as Trait>::trait_stable_text(&foo);
struct S2<T: TraitWithAssociatedTypes>(T::TypeDeprecated);
let _ = DeprecatedStruct {
i: 0
};
let _ = StableStruct { i: 0 };
let _ = DeprecatedUnitStruct;
let _ = StableUnitStruct;
let _ = Enum::DeprecatedVariant;
let _ = Enum::StableVariant;
let _ = DeprecatedTupleStruct (1);
let _ = StableTupleStruct (1);
// 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
// macro in the module *defining* it. Also, stability levels
// on macros themselves are not yet linted.
macro_test_arg!(deprecated_text());
macro_test_arg!(macro_test_arg!(deprecated_text()));
}
fn test_method_param<Foo: Trait>(foo: Foo) {
foo.trait_deprecated();
Trait::trait_deprecated(&foo);
<Foo>::trait_deprecated(&foo);
<Foo as Trait>::trait_deprecated(&foo);
foo.trait_deprecated_text();
Trait::trait_deprecated_text(&foo);
<Foo>::trait_deprecated_text(&foo);
<Foo as Trait>::trait_deprecated_text(&foo);
foo.trait_deprecated_unstable();
//~^ ERROR use of unstable library feature
<Foo>::trait_deprecated_unstable(&foo);
//~^ ERROR use of unstable library feature
foo.trait_deprecated_unstable_text();
//~^ ERROR use of unstable library feature
<Foo>::trait_deprecated_unstable_text(&foo);
//~^ ERROR use of unstable library feature
foo.trait_unstable(); //~ ERROR use of unstable library feature
<Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature
foo.trait_unstable_text();
//~^ ERROR use of unstable library feature 'test_feature': text
<Foo>::trait_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
foo.trait_stable();
Trait::trait_stable(&foo);
<Foo>::trait_stable(&foo);
<Foo as Trait>::trait_stable(&foo);
}
fn test_method_object(foo: &Trait) {
foo.trait_deprecated();
foo.trait_deprecated_text();
foo.trait_deprecated_unstable();
//~^ ERROR use of unstable library feature
foo.trait_deprecated_unstable_text();
//~^ ERROR use of unstable library feature
foo.trait_unstable(); //~ ERROR use of unstable library feature
foo.trait_unstable_text();
//~^ ERROR use of unstable library feature 'test_feature': text
foo.trait_stable();
}
struct S;
impl DeprecatedTrait for S {}
trait LocalTrait2 : DeprecatedTrait { }
}
mod this_crate {
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn deprecated() {}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn deprecated_text() {}
#[unstable(feature = "test_feature", issue = "0")]
pub fn unstable() {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
pub fn unstable_text() {}
#[stable(feature = "rust1", since = "1.0.0")]
pub fn stable() {}
#[stable(feature = "rust1", since = "1.0.0")]
pub fn stable_text() {}
#[stable(feature = "rust1", since = "1.0.0")]
pub struct MethodTester;
impl MethodTester {
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn method_deprecated(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn method_deprecated_text(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
pub fn method_unstable(&self) {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
pub fn method_unstable_text(&self) {}
#[stable(feature = "rust1", since = "1.0.0")]
pub fn method_stable(&self) {}
#[stable(feature = "rust1", since = "1.0.0")]
pub fn method_stable_text(&self) {}
}
pub trait Trait {
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn trait_deprecated(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn trait_deprecated_text(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
fn trait_unstable(&self) {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
fn trait_unstable_text(&self) {}
#[stable(feature = "rust1", since = "1.0.0")]
fn trait_stable(&self) {}
#[stable(feature = "rust1", since = "1.0.0")]
fn trait_stable_text(&self) {}
}
impl Trait for MethodTester {}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedStruct {
#[stable(feature = "test_feature", since = "1.0.0")] i: isize
}
#[unstable(feature = "test_feature", issue = "0")]
pub struct UnstableStruct {
#[stable(feature = "test_feature", since = "1.0.0")] i: isize
}
#[stable(feature = "rust1", since = "1.0.0")]
pub struct StableStruct {
#[stable(feature = "test_feature", since = "1.0.0")] i: isize
}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedUnitStruct;
#[unstable(feature = "test_feature", issue = "0")]
pub struct UnstableUnitStruct;
#[stable(feature = "rust1", since = "1.0.0")]
pub struct StableUnitStruct;
pub enum Enum {
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
DeprecatedVariant,
#[unstable(feature = "test_feature", issue = "0")]
UnstableVariant,
#[stable(feature = "rust1", since = "1.0.0")]
StableVariant,
}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedTupleStruct(isize);
#[unstable(feature = "test_feature", issue = "0")]
pub struct UnstableTupleStruct(isize);
#[stable(feature = "rust1", since = "1.0.0")]
pub struct StableTupleStruct(isize);
fn test() {
// 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.
type Foo = MethodTester;
let foo = MethodTester;
deprecated();
foo.method_deprecated();
Foo::method_deprecated(&foo);
<Foo>::method_deprecated(&foo);
foo.trait_deprecated();
Trait::trait_deprecated(&foo);
<Foo>::trait_deprecated(&foo);
<Foo as Trait>::trait_deprecated(&foo);
deprecated_text();
foo.method_deprecated_text();
Foo::method_deprecated_text(&foo);
<Foo>::method_deprecated_text(&foo);
foo.trait_deprecated_text();
Trait::trait_deprecated_text(&foo);
<Foo>::trait_deprecated_text(&foo);
<Foo as Trait>::trait_deprecated_text(&foo);
unstable();
foo.method_unstable();
Foo::method_unstable(&foo);
<Foo>::method_unstable(&foo);
foo.trait_unstable();
Trait::trait_unstable(&foo);
<Foo>::trait_unstable(&foo);
<Foo as Trait>::trait_unstable(&foo);
unstable_text();
foo.method_unstable_text();
Foo::method_unstable_text(&foo);
<Foo>::method_unstable_text(&foo);
foo.trait_unstable_text();
Trait::trait_unstable_text(&foo);
<Foo>::trait_unstable_text(&foo);
<Foo as Trait>::trait_unstable_text(&foo);
stable();
foo.method_stable();
Foo::method_stable(&foo);
<Foo>::method_stable(&foo);
foo.trait_stable();
Trait::trait_stable(&foo);
<Foo>::trait_stable(&foo);
<Foo as Trait>::trait_stable(&foo);
stable_text();
foo.method_stable_text();
Foo::method_stable_text(&foo);
<Foo>::method_stable_text(&foo);
foo.trait_stable_text();
Trait::trait_stable_text(&foo);
<Foo>::trait_stable_text(&foo);
<Foo as Trait>::trait_stable_text(&foo);
let _ = DeprecatedStruct {
i: 0
};
let _ = UnstableStruct { i: 0 };
let _ = StableStruct { i: 0 };
let _ = DeprecatedUnitStruct;
let _ = UnstableUnitStruct;
let _ = StableUnitStruct;
let _ = Enum::DeprecatedVariant;
let _ = Enum::UnstableVariant;
let _ = Enum::StableVariant;
let _ = DeprecatedTupleStruct (1);
let _ = UnstableTupleStruct (1);
let _ = StableTupleStruct (1);
}
fn test_method_param<Foo: Trait>(foo: Foo) {
foo.trait_deprecated();
Trait::trait_deprecated(&foo);
<Foo>::trait_deprecated(&foo);
<Foo as Trait>::trait_deprecated(&foo);
foo.trait_deprecated_text();
Trait::trait_deprecated_text(&foo);
<Foo>::trait_deprecated_text(&foo);
<Foo as Trait>::trait_deprecated_text(&foo);
foo.trait_unstable();
Trait::trait_unstable(&foo);
<Foo>::trait_unstable(&foo);
<Foo as Trait>::trait_unstable(&foo);
foo.trait_unstable_text();
Trait::trait_unstable_text(&foo);
<Foo>::trait_unstable_text(&foo);
<Foo as Trait>::trait_unstable_text(&foo);
foo.trait_stable();
Trait::trait_stable(&foo);
<Foo>::trait_stable(&foo);
<Foo as Trait>::trait_stable(&foo);
}
fn test_method_object(foo: &Trait) {
foo.trait_deprecated();
foo.trait_deprecated_text();
foo.trait_unstable();
foo.trait_unstable_text();
foo.trait_stable();
}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn test_fn_body() {
fn fn_in_body() {}
fn_in_body();
}
impl MethodTester {
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn test_method_body(&self) {
fn fn_in_body() {}
fn_in_body();
}
}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub trait DeprecatedTrait {
fn dummy(&self) { }
}
struct S;
impl DeprecatedTrait for S { }
trait LocalTrait : DeprecatedTrait { }
}
fn main() {}

View file

@ -0,0 +1,467 @@
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// aux-build:lint_stability.rs
// aux-build:inherited_stability.rs
// aux-build:stability_cfg1.rs
// aux-build:stability_cfg2.rs
#![deny(deprecated)]
#![allow(dead_code)]
#![feature(staged_api, test_feature)]
#![stable(feature = "rust1", since = "1.0.0")]
#[macro_use]
extern crate lint_stability;
mod cross_crate {
extern crate stability_cfg1;
extern crate stability_cfg2;
use lint_stability::*;
fn test() {
type Foo = MethodTester;
let foo = MethodTester;
deprecated(); //~ ERROR use of deprecated item
foo.method_deprecated(); //~ ERROR use of deprecated item
Foo::method_deprecated(&foo); //~ ERROR use of deprecated item
<Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item
foo.trait_deprecated(); //~ ERROR use of deprecated item
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
deprecated_text(); //~ ERROR use of deprecated item: text
foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
<Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
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
deprecated_unstable(); //~ ERROR use of deprecated item
foo.method_deprecated_unstable(); //~ ERROR use of deprecated item
Foo::method_deprecated_unstable(&foo); //~ ERROR use of deprecated item
<Foo>::method_deprecated_unstable(&foo); //~ ERROR use of deprecated item
foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
Trait::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
<Foo>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
<Foo as Trait>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
deprecated_unstable_text(); //~ ERROR use of deprecated item: text
foo.method_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
Foo::method_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
<Foo>::method_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
Trait::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
<Foo>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
<Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
unstable();
foo.method_unstable();
Foo::method_unstable(&foo);
<Foo>::method_unstable(&foo);
foo.trait_unstable();
Trait::trait_unstable(&foo);
<Foo>::trait_unstable(&foo);
<Foo as Trait>::trait_unstable(&foo);
unstable_text();
foo.method_unstable_text();
Foo::method_unstable_text(&foo);
<Foo>::method_unstable_text(&foo);
foo.trait_unstable_text();
Trait::trait_unstable_text(&foo);
<Foo>::trait_unstable_text(&foo);
<Foo as Trait>::trait_unstable_text(&foo);
stable();
foo.method_stable();
Foo::method_stable(&foo);
<Foo>::method_stable(&foo);
foo.trait_stable();
Trait::trait_stable(&foo);
<Foo>::trait_stable(&foo);
<Foo as Trait>::trait_stable(&foo);
stable_text();
foo.method_stable_text();
Foo::method_stable_text(&foo);
<Foo>::method_stable_text(&foo);
foo.trait_stable_text();
Trait::trait_stable_text(&foo);
<Foo>::trait_stable_text(&foo);
<Foo as Trait>::trait_stable_text(&foo);
struct S1<T: TraitWithAssociatedTypes>(T::TypeUnstable);
struct S2<T: TraitWithAssociatedTypes>(T::TypeDeprecated);
//~^ ERROR use of deprecated item
let _ = DeprecatedStruct { //~ ERROR use of deprecated item
i: 0 //~ ERROR use of deprecated item
};
let _ = DeprecatedUnstableStruct {
//~^ ERROR use of deprecated item
i: 0 //~ ERROR use of deprecated item
};
let _ = UnstableStruct { i: 0 };
let _ = StableStruct { i: 0 };
let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
let _ = DeprecatedUnstableUnitStruct; //~ ERROR use of deprecated item
let _ = UnstableUnitStruct;
let _ = StableUnitStruct;
let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
let _ = Enum::DeprecatedUnstableVariant; //~ ERROR use of deprecated item
let _ = Enum::UnstableVariant;
let _ = Enum::StableVariant;
let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
let _ = DeprecatedUnstableTupleStruct (1); //~ ERROR use of deprecated item
let _ = UnstableTupleStruct (1);
let _ = StableTupleStruct (1);
// 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
// macro in the module *defining* it. Also, stability levels
// on macros themselves are not yet linted.
macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item: text
macro_test_arg!(deprecated_unstable_text()); //~ ERROR use of deprecated item: text
macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item: text
}
fn test_method_param<Foo: Trait>(foo: Foo) {
foo.trait_deprecated(); //~ ERROR use of deprecated item
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
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
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
foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
Trait::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
<Foo>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
<Foo as Trait>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
Trait::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
<Foo>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
<Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
foo.trait_unstable();
Trait::trait_unstable(&foo);
<Foo>::trait_unstable(&foo);
<Foo as Trait>::trait_unstable(&foo);
foo.trait_unstable_text();
Trait::trait_unstable_text(&foo);
<Foo>::trait_unstable_text(&foo);
<Foo as Trait>::trait_unstable_text(&foo);
foo.trait_stable();
Trait::trait_stable(&foo);
<Foo>::trait_stable(&foo);
<Foo as Trait>::trait_stable(&foo);
}
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_deprecated_unstable(); //~ ERROR use of deprecated item
foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
foo.trait_unstable();
foo.trait_unstable_text();
foo.trait_stable();
}
struct S;
impl UnstableTrait for S { }
impl DeprecatedTrait for S {} //~ ERROR use of deprecated item: text
trait LocalTrait : UnstableTrait { }
trait LocalTrait2 : DeprecatedTrait { } //~ ERROR use of deprecated item: text
impl Trait for S {
fn trait_stable(&self) {}
fn trait_unstable(&self) {}
}
}
mod inheritance {
extern crate inherited_stability;
use self::inherited_stability::*;
fn test_inheritance() {
unstable();
stable();
stable_mod::unstable();
stable_mod::stable();
unstable_mod::deprecated(); //~ ERROR use of deprecated item
unstable_mod::unstable();
let _ = Unstable::UnstableVariant;
let _ = Unstable::StableVariant;
let x: usize = 0;
x.unstable();
x.stable();
}
}
mod this_crate {
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn deprecated() {}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn deprecated_text() {}
#[unstable(feature = "test_feature", issue = "0")]
pub fn unstable() {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
pub fn unstable_text() {}
#[stable(feature = "rust1", since = "1.0.0")]
pub fn stable() {}
#[stable(feature = "rust1", since = "1.0.0")]
pub fn stable_text() {}
#[stable(feature = "rust1", since = "1.0.0")]
pub struct MethodTester;
impl MethodTester {
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn method_deprecated(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn method_deprecated_text(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
pub fn method_unstable(&self) {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
pub fn method_unstable_text(&self) {}
#[stable(feature = "rust1", since = "1.0.0")]
pub fn method_stable(&self) {}
#[stable(feature = "rust1", since = "1.0.0")]
pub fn method_stable_text(&self) {}
}
pub trait Trait {
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn trait_deprecated(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn trait_deprecated_text(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
fn trait_unstable(&self) {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
fn trait_unstable_text(&self) {}
#[stable(feature = "rust1", since = "1.0.0")]
fn trait_stable(&self) {}
#[stable(feature = "rust1", since = "1.0.0")]
fn trait_stable_text(&self) {}
}
impl Trait for MethodTester {}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedStruct {
#[stable(feature = "test_feature", since = "1.0.0")] i: isize
}
#[unstable(feature = "test_feature", issue = "0")]
pub struct UnstableStruct {
#[stable(feature = "test_feature", since = "1.0.0")] i: isize
}
#[stable(feature = "rust1", since = "1.0.0")]
pub struct StableStruct {
#[stable(feature = "test_feature", since = "1.0.0")] i: isize
}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedUnitStruct;
#[unstable(feature = "test_feature", issue = "0")]
pub struct UnstableUnitStruct;
#[stable(feature = "rust1", since = "1.0.0")]
pub struct StableUnitStruct;
pub enum Enum {
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
DeprecatedVariant,
#[unstable(feature = "test_feature", issue = "0")]
UnstableVariant,
#[stable(feature = "rust1", since = "1.0.0")]
StableVariant,
}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedTupleStruct(isize);
#[unstable(feature = "test_feature", issue = "0")]
pub struct UnstableTupleStruct(isize);
#[stable(feature = "rust1", since = "1.0.0")]
pub struct StableTupleStruct(isize);
fn test() {
// 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.
type Foo = MethodTester;
let foo = MethodTester;
deprecated(); //~ ERROR use of deprecated item
foo.method_deprecated(); //~ ERROR use of deprecated item
Foo::method_deprecated(&foo); //~ ERROR use of deprecated item
<Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item
foo.trait_deprecated(); //~ ERROR use of deprecated item
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
deprecated_text(); //~ ERROR use of deprecated item: text
foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
<Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
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
unstable();
foo.method_unstable();
Foo::method_unstable(&foo);
<Foo>::method_unstable(&foo);
foo.trait_unstable();
Trait::trait_unstable(&foo);
<Foo>::trait_unstable(&foo);
<Foo as Trait>::trait_unstable(&foo);
unstable_text();
foo.method_unstable_text();
Foo::method_unstable_text(&foo);
<Foo>::method_unstable_text(&foo);
foo.trait_unstable_text();
Trait::trait_unstable_text(&foo);
<Foo>::trait_unstable_text(&foo);
<Foo as Trait>::trait_unstable_text(&foo);
stable();
foo.method_stable();
Foo::method_stable(&foo);
<Foo>::method_stable(&foo);
foo.trait_stable();
Trait::trait_stable(&foo);
<Foo>::trait_stable(&foo);
<Foo as Trait>::trait_stable(&foo);
stable_text();
foo.method_stable_text();
Foo::method_stable_text(&foo);
<Foo>::method_stable_text(&foo);
foo.trait_stable_text();
Trait::trait_stable_text(&foo);
<Foo>::trait_stable_text(&foo);
<Foo as Trait>::trait_stable_text(&foo);
let _ = DeprecatedStruct {
//~^ ERROR use of deprecated item
i: 0 //~ ERROR use of deprecated item
};
let _ = UnstableStruct { i: 0 };
let _ = StableStruct { i: 0 };
let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
let _ = UnstableUnitStruct;
let _ = StableUnitStruct;
let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
let _ = Enum::UnstableVariant;
let _ = Enum::StableVariant;
let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
let _ = UnstableTupleStruct (1);
let _ = StableTupleStruct (1);
}
fn test_method_param<Foo: Trait>(foo: Foo) {
foo.trait_deprecated(); //~ ERROR use of deprecated item
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
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
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
foo.trait_unstable();
Trait::trait_unstable(&foo);
<Foo>::trait_unstable(&foo);
<Foo as Trait>::trait_unstable(&foo);
foo.trait_unstable_text();
Trait::trait_unstable_text(&foo);
<Foo>::trait_unstable_text(&foo);
<Foo as Trait>::trait_unstable_text(&foo);
foo.trait_stable();
Trait::trait_stable(&foo);
<Foo>::trait_stable(&foo);
<Foo as Trait>::trait_stable(&foo);
}
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_unstable();
foo.trait_unstable_text();
foo.trait_stable();
}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn test_fn_body() {
fn fn_in_body() {}
fn_in_body(); //~ ERROR use of deprecated item: text
}
impl MethodTester {
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn test_method_body(&self) {
fn fn_in_body() {}
fn_in_body(); //~ ERROR use of deprecated item: text
}
}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub trait DeprecatedTrait {
fn dummy(&self) { }
}
struct S;
impl DeprecatedTrait for S { } //~ ERROR use of deprecated item
trait LocalTrait : DeprecatedTrait { } //~ ERROR use of deprecated item
}
fn main() {}

View file

@ -0,0 +1,348 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// aux-build:lint_stability_fields.rs
#![deny(deprecated)]
#![allow(dead_code)]
#![feature(staged_api, test_feature)]
#![stable(feature = "rust1", since = "1.0.0")]
mod cross_crate {
extern crate lint_stability_fields;
use self::lint_stability_fields::*;
pub fn foo() {
let x = Stable {
inherit: 1,
override1: 2,
override2: 3,
//~^ ERROR use of deprecated item
};
let _ = x.inherit;
let _ = x.override1;
let _ = x.override2;
//~^ ERROR use of deprecated item
let Stable {
inherit: _,
override1: _,
override2: _
//~^ ERROR use of deprecated item
} = x;
// all fine
let Stable { .. } = x;
let x = Stable2(1, 2, 3);
let _ = x.0;
let _ = x.1;
let _ = x.2;
//~^ ERROR use of deprecated item
let Stable2(_,
_,
_)
//~^ ERROR use of deprecated item
= x;
// all fine
let Stable2(..) = x;
let x = Unstable {
inherit: 1,
override1: 2,
override2: 3,
//~^ ERROR use of deprecated item
};
let _ = x.inherit;
let _ = x.override1;
let _ = x.override2;
//~^ ERROR use of deprecated item
let Unstable {
inherit: _,
override1: _,
override2: _
//~^ ERROR use of deprecated item
} = x;
let Unstable
// the patterns are all fine:
{ .. } = x;
let x = Unstable2(1, 2, 3);
let _ = x.0;
let _ = x.1;
let _ = x.2;
//~^ ERROR use of deprecated item
let Unstable2
(_,
_,
_)
//~^ ERROR use of deprecated item
= x;
let Unstable2
// the patterns are all fine:
(..) = x;
let x = Deprecated {
//~^ ERROR use of deprecated item
inherit: 1,
//~^ ERROR use of deprecated item
override1: 2,
//~^ ERROR use of deprecated item
override2: 3,
//~^ ERROR use of deprecated item
};
let _ = x.inherit;
//~^ ERROR use of deprecated item
let _ = x.override1;
//~^ ERROR use of deprecated item
let _ = x.override2;
//~^ ERROR use of deprecated item
let Deprecated {
//~^ ERROR use of deprecated item
inherit: _,
//~^ ERROR use of deprecated item
override1: _,
//~^ ERROR use of deprecated item
override2: _
//~^ ERROR use of deprecated item
} = x;
let Deprecated
//~^ ERROR use of deprecated item
// the patterns are all fine:
{ .. } = x;
let x = Deprecated2(1, 2, 3);
//~^ ERROR use of deprecated item
let _ = x.0;
//~^ ERROR use of deprecated item
let _ = x.1;
//~^ ERROR use of deprecated item
let _ = x.2;
//~^ ERROR use of deprecated item
let Deprecated2
//~^ ERROR use of deprecated item
(_,
//~^ ERROR use of deprecated item
_,
//~^ ERROR use of deprecated item
_)
//~^ ERROR use of deprecated item
= x;
let Deprecated2
//~^ ERROR use of deprecated item
// the patterns are all fine:
(..) = x;
}
}
mod this_crate {
#[stable(feature = "rust1", since = "1.0.0")]
struct Stable {
inherit: u8,
#[unstable(feature = "test_feature", issue = "0")]
override1: u8,
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[unstable(feature = "test_feature", issue = "0")]
override2: u8,
}
#[stable(feature = "rust1", since = "1.0.0")]
struct Stable2(u8,
#[stable(feature = "rust1", since = "1.0.0")] u8,
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")] u8);
#[unstable(feature = "test_feature", issue = "0")]
struct Unstable {
inherit: u8,
#[stable(feature = "rust1", since = "1.0.0")]
override1: u8,
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[unstable(feature = "test_feature", issue = "0")]
override2: u8,
}
#[unstable(feature = "test_feature", issue = "0")]
struct Unstable2(u8,
#[stable(feature = "rust1", since = "1.0.0")] u8,
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")] u8);
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
struct Deprecated {
inherit: u8,
#[stable(feature = "rust1", since = "1.0.0")]
override1: u8,
#[unstable(feature = "test_feature", issue = "0")]
override2: u8,
}
#[unstable(feature = "test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
struct Deprecated2(u8,
#[stable(feature = "rust1", since = "1.0.0")] u8,
#[unstable(feature = "test_feature", issue = "0")] u8);
pub fn foo() {
let x = Stable {
inherit: 1,
override1: 2,
override2: 3,
//~^ ERROR use of deprecated item
};
let _ = x.inherit;
let _ = x.override1;
let _ = x.override2;
//~^ ERROR use of deprecated item
let Stable {
inherit: _,
override1: _,
override2: _
//~^ ERROR use of deprecated item
} = x;
// all fine
let Stable { .. } = x;
let x = Stable2(1, 2, 3);
let _ = x.0;
let _ = x.1;
let _ = x.2;
//~^ ERROR use of deprecated item
let Stable2(_,
_,
_)
//~^ ERROR use of deprecated item
= x;
// all fine
let Stable2(..) = x;
let x = Unstable {
inherit: 1,
override1: 2,
override2: 3,
//~^ ERROR use of deprecated item
};
let _ = x.inherit;
let _ = x.override1;
let _ = x.override2;
//~^ ERROR use of deprecated item
let Unstable {
inherit: _,
override1: _,
override2: _
//~^ ERROR use of deprecated item
} = x;
let Unstable
// the patterns are all fine:
{ .. } = x;
let x = Unstable2(1, 2, 3);
let _ = x.0;
let _ = x.1;
let _ = x.2;
//~^ ERROR use of deprecated item
let Unstable2
(_,
_,
_)
//~^ ERROR use of deprecated item
= x;
let Unstable2
// the patterns are all fine:
(..) = x;
let x = Deprecated {
//~^ ERROR use of deprecated item
inherit: 1,
//~^ ERROR use of deprecated item
override1: 2,
//~^ ERROR use of deprecated item
override2: 3,
//~^ ERROR use of deprecated item
};
let _ = x.inherit;
//~^ ERROR use of deprecated item
let _ = x.override1;
//~^ ERROR use of deprecated item
let _ = x.override2;
//~^ ERROR use of deprecated item
let Deprecated {
//~^ ERROR use of deprecated item
inherit: _,
//~^ ERROR use of deprecated item
override1: _,
//~^ ERROR use of deprecated item
override2: _
//~^ ERROR use of deprecated item
} = x;
let Deprecated
//~^ ERROR use of deprecated item
// the patterns are all fine:
{ .. } = x;
let x = Deprecated2(1, 2, 3);
//~^ ERROR use of deprecated item
let _ = x.0;
//~^ ERROR use of deprecated item
let _ = x.1;
//~^ ERROR use of deprecated item
let _ = x.2;
//~^ ERROR use of deprecated item
let Deprecated2
//~^ ERROR use of deprecated item
(_,
//~^ ERROR use of deprecated item
_,
//~^ ERROR use of deprecated item
_)
//~^ ERROR use of deprecated item
= x;
let Deprecated2
//~^ ERROR use of deprecated item
// the patterns are all fine:
(..) = x;
}
}
fn main() {}

View file

@ -9,7 +9,7 @@
// except according to those terms.
// aux-build:lint_stability_fields.rs
#![deny(deprecated)]
#![allow(deprecated)]
#![allow(dead_code)]
#![feature(staged_api)]
@ -24,23 +24,17 @@ mod cross_crate {
let x = Stable {
inherit: 1,
override1: 2, //~ ERROR use of unstable
override2: 3,
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
override2: 3, //~ ERROR use of unstable
};
let _ = x.inherit;
let _ = x.override1; //~ ERROR use of unstable
let _ = x.override2;
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
let _ = x.override2; //~ ERROR use of unstable
let Stable {
inherit: _,
override1: _, //~ ERROR use of unstable
override2: _
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
override2: _ //~ ERROR use of unstable
} = x;
// all fine
let Stable { .. } = x;
@ -49,15 +43,11 @@ mod cross_crate {
let _ = x.0;
let _ = x.1; //~ ERROR use of unstable
let _ = x.2;
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
let _ = x.2; //~ ERROR use of unstable
let Stable2(_,
_, //~ ERROR use of unstable
_)
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
_) //~ ERROR use of unstable
= x;
// all fine
let Stable2(..) = x;
@ -66,23 +56,17 @@ mod cross_crate {
let x = Unstable { //~ ERROR use of unstable
inherit: 1, //~ ERROR use of unstable
override1: 2,
override2: 3,
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
override2: 3, //~ ERROR use of unstable
};
let _ = x.inherit; //~ ERROR use of unstable
let _ = x.override1;
let _ = x.override2;
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
let _ = x.override2; //~ ERROR use of unstable
let Unstable { //~ ERROR use of unstable
inherit: _, //~ ERROR use of unstable
override1: _,
override2: _
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
override2: _ //~ ERROR use of unstable
} = x;
let Unstable //~ ERROR use of unstable
@ -94,91 +78,50 @@ mod cross_crate {
let _ = x.0; //~ ERROR use of unstable
let _ = x.1;
let _ = x.2;
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
let _ = x.2; //~ ERROR use of unstable
let Unstable2 //~ ERROR use of unstable
(_, //~ ERROR use of unstable
_,
_)
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
_) //~ ERROR use of unstable
= x;
let Unstable2 //~ ERROR use of unstable
// the patterns are all fine:
(..) = x;
let x = Deprecated {
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
inherit: 1,
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
let x = Deprecated { //~ ERROR use of unstable
inherit: 1, //~ ERROR use of unstable
override1: 2,
//~^ ERROR use of deprecated item
override2: 3,
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
override2: 3, //~ ERROR use of unstable
};
let _ = x.inherit;
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
let _ = x.inherit; //~ ERROR use of unstable
let _ = x.override1;
//~^ ERROR use of deprecated item
let _ = x.override2;
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
let _ = x.override2; //~ ERROR use of unstable
let Deprecated {
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
inherit: _,
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
let Deprecated { //~ ERROR use of unstable
inherit: _, //~ ERROR use of unstable
override1: _,
//~^ ERROR use of deprecated item
override2: _
//~^ ERROR use of unstable
//~^^ ERROR use of deprecated item
override2: _ //~ ERROR use of unstable
} = x;
let Deprecated
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
let Deprecated //~ ERROR use of unstable
// the patterns are all fine:
{ .. } = x;
let x = Deprecated2(1, 2, 3);
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
let x = Deprecated2(1, 2, 3); //~ ERROR use of unstable
let _ = x.0;
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
let _ = x.0; //~ ERROR use of unstable
let _ = x.1;
//~^ ERROR use of deprecated item
let _ = x.2;
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
let _ = x.2; //~ ERROR use of unstable
let Deprecated2
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
(_,
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
let Deprecated2 //~ ERROR use of unstable
(_, //~ ERROR use of unstable
_,
//~^ ERROR use of deprecated item
_)
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
_) //~ ERROR use of unstable
= x;
let Deprecated2
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable
let Deprecated2 //~ ERROR use of unstable
// the patterns are all fine:
(..) = x;
}
@ -238,19 +181,16 @@ mod this_crate {
inherit: 1,
override1: 2,
override2: 3,
//~^ ERROR use of deprecated item
};
let _ = x.inherit;
let _ = x.override1;
let _ = x.override2;
//~^ ERROR use of deprecated item
let Stable {
inherit: _,
override1: _,
override2: _
//~^ ERROR use of deprecated item
} = x;
// all fine
let Stable { .. } = x;
@ -260,12 +200,10 @@ mod this_crate {
let _ = x.0;
let _ = x.1;
let _ = x.2;
//~^ ERROR use of deprecated item
let Stable2(_,
_,
_)
//~^ ERROR use of deprecated item
= x;
// all fine
let Stable2(..) = x;
@ -275,19 +213,16 @@ mod this_crate {
inherit: 1,
override1: 2,
override2: 3,
//~^ ERROR use of deprecated item
};
let _ = x.inherit;
let _ = x.override1;
let _ = x.override2;
//~^ ERROR use of deprecated item
let Unstable {
inherit: _,
override1: _,
override2: _
//~^ ERROR use of deprecated item
} = x;
let Unstable
@ -300,13 +235,11 @@ mod this_crate {
let _ = x.0;
let _ = x.1;
let _ = x.2;
//~^ ERROR use of deprecated item
let Unstable2
(_,
_,
_)
//~^ ERROR use of deprecated item
= x;
let Unstable2
// the patterns are all fine:
@ -314,58 +247,37 @@ mod this_crate {
let x = Deprecated {
//~^ ERROR use of deprecated item
inherit: 1,
//~^ ERROR use of deprecated item
override1: 2,
//~^ ERROR use of deprecated item
override2: 3,
//~^ ERROR use of deprecated item
};
let _ = x.inherit;
//~^ ERROR use of deprecated item
let _ = x.override1;
//~^ ERROR use of deprecated item
let _ = x.override2;
//~^ ERROR use of deprecated item
let Deprecated {
//~^ ERROR use of deprecated item
inherit: _,
//~^ ERROR use of deprecated item
override1: _,
//~^ ERROR use of deprecated item
override2: _
//~^ ERROR use of deprecated item
} = x;
let Deprecated
//~^ ERROR use of deprecated item
// the patterns are all fine:
{ .. } = x;
let x = Deprecated2(1, 2, 3);
//~^ ERROR use of deprecated item
let _ = x.0;
//~^ ERROR use of deprecated item
let _ = x.1;
//~^ ERROR use of deprecated item
let _ = x.2;
//~^ ERROR use of deprecated item
let Deprecated2
//~^ ERROR use of deprecated item
(_,
//~^ ERROR use of deprecated item
_,
//~^ ERROR use of deprecated item
_)
//~^ ERROR use of deprecated item
= x;
let Deprecated2
//~^ ERROR use of deprecated item
// the patterns are all fine:
(..) = x;
}

View file

@ -13,7 +13,7 @@
// aux-build:stability_cfg1.rs
// aux-build:stability_cfg2.rs
#![deny(deprecated)]
#![allow(deprecated)]
#![allow(dead_code)]
#![feature(staged_api)]
@ -32,81 +32,46 @@ mod cross_crate {
type Foo = MethodTester;
let foo = MethodTester;
deprecated(); //~ ERROR use of deprecated item
foo.method_deprecated(); //~ ERROR use of deprecated item
Foo::method_deprecated(&foo); //~ ERROR use of deprecated item
<Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item
foo.trait_deprecated(); //~ ERROR use of deprecated item
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
deprecated();
foo.method_deprecated();
Foo::method_deprecated(&foo);
<Foo>::method_deprecated(&foo);
foo.trait_deprecated();
Trait::trait_deprecated(&foo);
<Foo>::trait_deprecated(&foo);
<Foo as Trait>::trait_deprecated(&foo);
deprecated_text(); //~ ERROR use of deprecated item: text
foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
<Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
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
deprecated_text();
foo.method_deprecated_text();
Foo::method_deprecated_text(&foo);
<Foo>::method_deprecated_text(&foo);
foo.trait_deprecated_text();
Trait::trait_deprecated_text(&foo);
<Foo>::trait_deprecated_text(&foo);
<Foo as Trait>::trait_deprecated_text(&foo);
deprecated_unstable(); //~ ERROR use of deprecated item
deprecated_unstable();
//~^ ERROR use of unstable library feature
foo.method_deprecated_unstable(); //~ ERROR use of deprecated item
Trait::trait_deprecated_unstable(&foo);
//~^ ERROR use of unstable library feature
Foo::method_deprecated_unstable(&foo); //~ ERROR use of deprecated item
//~^ ERROR use of unstable library feature
<Foo>::method_deprecated_unstable(&foo); //~ ERROR use of deprecated item
//~^ ERROR use of unstable library feature
foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
//~^ ERROR use of unstable library feature
Trait::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
//~^ ERROR use of unstable library feature
<Foo>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
//~^ ERROR use of unstable library feature
<Foo as Trait>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
<Foo as Trait>::trait_deprecated_unstable(&foo);
//~^ ERROR use of unstable library feature
deprecated_unstable_text(); //~ ERROR use of deprecated item: text
deprecated_unstable_text();
//~^ ERROR use of unstable library feature
foo.method_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
Trait::trait_deprecated_unstable_text(&foo);
//~^ ERROR use of unstable library feature
Foo::method_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
//~^ ERROR use of unstable library feature
<Foo>::method_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
//~^ ERROR use of unstable library feature
foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
//~^ ERROR use of unstable library feature
Trait::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
//~^ ERROR use of unstable library feature
<Foo>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
//~^ ERROR use of unstable library feature
<Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
<Foo as Trait>::trait_deprecated_unstable_text(&foo);
//~^ ERROR use of unstable library feature
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
unstable_text();
//~^ ERROR use of unstable library feature 'test_feature': text
foo.method_unstable_text();
//~^ ERROR use of unstable library feature 'test_feature': text
Foo::method_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
<Foo>::method_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
foo.trait_unstable_text();
//~^ ERROR use of unstable library feature 'test_feature': text
Trait::trait_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
<Foo>::trait_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
<Foo as Trait>::trait_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
@ -131,33 +96,31 @@ mod cross_crate {
struct S1<T: TraitWithAssociatedTypes>(T::TypeUnstable);
//~^ ERROR use of unstable library feature
struct S2<T: TraitWithAssociatedTypes>(T::TypeDeprecated);
//~^ ERROR use of deprecated item
let _ = DeprecatedStruct { //~ ERROR use of deprecated item
i: 0 //~ ERROR use of deprecated item
let _ = DeprecatedStruct {
i: 0
};
let _ = DeprecatedUnstableStruct {
//~^ ERROR use of deprecated item
//~^^ ERROR use of unstable library feature
i: 0 //~ ERROR use of deprecated item
//~^ ERROR use of unstable library feature
i: 0
};
let _ = UnstableStruct { i: 0 }; //~ ERROR use of unstable library feature
let _ = StableStruct { i: 0 };
let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
let _ = DeprecatedUnstableUnitStruct; //~ ERROR use of deprecated item
let _ = DeprecatedUnitStruct;
let _ = DeprecatedUnstableUnitStruct;
//~^ ERROR use of unstable library feature
let _ = UnstableUnitStruct; //~ ERROR use of unstable library feature
let _ = StableUnitStruct;
let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
let _ = Enum::DeprecatedUnstableVariant; //~ ERROR use of deprecated item
let _ = Enum::DeprecatedVariant;
let _ = Enum::DeprecatedUnstableVariant;
//~^ ERROR use of unstable library feature
let _ = Enum::UnstableVariant; //~ ERROR use of unstable library feature
let _ = Enum::StableVariant;
let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
let _ = DeprecatedUnstableTupleStruct (1); //~ ERROR use of deprecated item
let _ = DeprecatedTupleStruct (1);
let _ = DeprecatedUnstableTupleStruct (1);
//~^ ERROR use of unstable library feature
let _ = UnstableTupleStruct (1); //~ ERROR use of unstable library feature
let _ = StableTupleStruct (1);
@ -167,47 +130,33 @@ mod cross_crate {
// Eventually, we will want to lint the contents of the
// macro in the module *defining* it. Also, stability levels
// on macros themselves are not yet linted.
macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item: text
macro_test_arg!(deprecated_unstable_text()); //~ ERROR use of deprecated item: text
macro_test_arg!(deprecated_text());
macro_test_arg!(deprecated_unstable_text());
//~^ ERROR use of unstable library feature
macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item: text
macro_test_arg!(macro_test_arg!(deprecated_text()));
}
fn test_method_param<Foo: Trait>(foo: Foo) {
foo.trait_deprecated(); //~ ERROR use of deprecated item
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
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
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
foo.trait_deprecated_unstable(); //~ ERROR use of deprecated item
foo.trait_deprecated();
Trait::trait_deprecated(&foo);
<Foo>::trait_deprecated(&foo);
<Foo as Trait>::trait_deprecated(&foo);
foo.trait_deprecated_text();
Trait::trait_deprecated_text(&foo);
<Foo>::trait_deprecated_text(&foo);
<Foo as Trait>::trait_deprecated_text(&foo);
Trait::trait_deprecated_unstable(&foo);
//~^ ERROR use of unstable library feature
Trait::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
<Foo as Trait>::trait_deprecated_unstable(&foo);
//~^ ERROR use of unstable library feature
<Foo>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
Trait::trait_deprecated_unstable_text(&foo);
//~^ ERROR use of unstable library feature
<Foo as Trait>::trait_deprecated_unstable(&foo); //~ ERROR use of deprecated item
<Foo as Trait>::trait_deprecated_unstable_text(&foo);
//~^ ERROR use of unstable library feature
foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
//~^ ERROR use of unstable library feature
Trait::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
//~^ ERROR use of unstable library feature
<Foo>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
//~^ ERROR use of unstable library feature
<Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ ERROR use of deprecated item: text
//~^ 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
foo.trait_unstable_text();
//~^ ERROR use of unstable library feature 'test_feature': text
Trait::trait_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
<Foo>::trait_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
<Foo as Trait>::trait_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
foo.trait_stable();
@ -217,24 +166,17 @@ mod cross_crate {
}
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_deprecated_unstable(); //~ ERROR use of deprecated item
//~^ ERROR use of unstable library feature
foo.trait_deprecated_unstable_text(); //~ ERROR use of deprecated item: text
//~^ ERROR use of unstable library feature
foo.trait_unstable(); //~ ERROR use of unstable library feature
foo.trait_unstable_text();
//~^ ERROR use of unstable library feature 'test_feature': text
foo.trait_deprecated();
foo.trait_deprecated_text();
foo.trait_stable();
}
struct S;
impl UnstableTrait for S { } //~ ERROR use of unstable library feature
impl DeprecatedTrait for S {} //~ ERROR use of deprecated item: text
impl DeprecatedTrait for S {}
trait LocalTrait : UnstableTrait { } //~ ERROR use of unstable library feature
trait LocalTrait2 : DeprecatedTrait { } //~ ERROR use of deprecated item: text
trait LocalTrait2 : DeprecatedTrait { }
impl Trait for S {
fn trait_stable(&self) {}
@ -253,14 +195,13 @@ mod inheritance {
stable_mod::unstable(); //~ ERROR use of unstable library feature
stable_mod::stable();
unstable_mod::deprecated(); //~ ERROR use of deprecated item
unstable_mod::deprecated();
unstable_mod::unstable(); //~ ERROR use of unstable library feature
let _ = Unstable::UnstableVariant; //~ ERROR use of unstable library feature
let _ = Unstable::StableVariant;
let x: usize = 0;
x.unstable(); //~ ERROR use of unstable library feature
x.stable();
}
}
@ -375,23 +316,23 @@ mod this_crate {
type Foo = MethodTester;
let foo = MethodTester;
deprecated(); //~ ERROR use of deprecated item
foo.method_deprecated(); //~ ERROR use of deprecated item
Foo::method_deprecated(&foo); //~ ERROR use of deprecated item
<Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item
foo.trait_deprecated(); //~ ERROR use of deprecated item
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
deprecated();
foo.method_deprecated();
Foo::method_deprecated(&foo);
<Foo>::method_deprecated(&foo);
foo.trait_deprecated();
Trait::trait_deprecated(&foo);
<Foo>::trait_deprecated(&foo);
<Foo as Trait>::trait_deprecated(&foo);
deprecated_text(); //~ ERROR use of deprecated item: text
foo.method_deprecated_text(); //~ ERROR use of deprecated item: text
Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
<Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item: text
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
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
deprecated_text();
foo.method_deprecated_text();
Foo::method_deprecated_text(&foo);
<Foo>::method_deprecated_text(&foo);
foo.trait_deprecated_text();
Trait::trait_deprecated_text(&foo);
<Foo>::trait_deprecated_text(&foo);
<Foo as Trait>::trait_deprecated_text(&foo);
unstable();
foo.method_unstable();
@ -430,34 +371,33 @@ mod this_crate {
<Foo as Trait>::trait_stable_text(&foo);
let _ = DeprecatedStruct {
//~^ ERROR use of deprecated item
i: 0 //~ ERROR use of deprecated item
i: 0
};
let _ = UnstableStruct { i: 0 };
let _ = StableStruct { i: 0 };
let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
let _ = DeprecatedUnitStruct;
let _ = UnstableUnitStruct;
let _ = StableUnitStruct;
let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
let _ = Enum::DeprecatedVariant;
let _ = Enum::UnstableVariant;
let _ = Enum::StableVariant;
let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
let _ = DeprecatedTupleStruct (1);
let _ = UnstableTupleStruct (1);
let _ = StableTupleStruct (1);
}
fn test_method_param<Foo: Trait>(foo: Foo) {
foo.trait_deprecated(); //~ ERROR use of deprecated item
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
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
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
foo.trait_deprecated();
Trait::trait_deprecated(&foo);
<Foo>::trait_deprecated(&foo);
<Foo as Trait>::trait_deprecated(&foo);
foo.trait_deprecated_text();
Trait::trait_deprecated_text(&foo);
<Foo>::trait_deprecated_text(&foo);
<Foo as Trait>::trait_deprecated_text(&foo);
foo.trait_unstable();
Trait::trait_unstable(&foo);
<Foo>::trait_unstable(&foo);
@ -473,8 +413,8 @@ mod this_crate {
}
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_deprecated();
foo.trait_deprecated_text();
foo.trait_unstable();
foo.trait_unstable_text();
foo.trait_stable();
@ -484,7 +424,7 @@ mod this_crate {
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn test_fn_body() {
fn fn_in_body() {}
fn_in_body(); //~ ERROR use of deprecated item: text
fn_in_body();
}
impl MethodTester {
@ -492,7 +432,7 @@ mod this_crate {
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn test_method_body(&self) {
fn fn_in_body() {}
fn_in_body(); //~ ERROR use of deprecated item: text
fn_in_body();
}
}
@ -504,9 +444,9 @@ mod this_crate {
struct S;
impl DeprecatedTrait for S { } //~ ERROR use of deprecated item
impl DeprecatedTrait for S { }
trait LocalTrait : DeprecatedTrait { } //~ ERROR use of deprecated item
trait LocalTrait : DeprecatedTrait { }
}
fn main() {}

View file

@ -10,8 +10,6 @@
#![feature(box_syntax)]
extern crate collections;
use std::collections::HashMap;
trait Map<K, V>

View file

@ -10,7 +10,7 @@
// General test of maybe_uninits state computed by MIR dataflow.
#![feature(rustc_attrs)]
#![feature(core_intrinsics, rustc_attrs)]
use std::intrinsics::rustc_peek;
use std::mem::{drop, replace};

View file

@ -10,7 +10,7 @@
// General test of maybe_inits state computed by MIR dataflow.
#![feature(rustc_attrs)]
#![feature(core_intrinsics, rustc_attrs)]
use std::intrinsics::rustc_peek;
use std::mem::{drop, replace};

View file

@ -10,7 +10,7 @@
// General test of maybe_uninits state computed by MIR dataflow.
#![feature(rustc_attrs)]
#![feature(core_intrinsics, rustc_attrs)]
use std::intrinsics::rustc_peek;
use std::mem::{drop, replace};

View file

@ -10,7 +10,7 @@
// General test of maybe_uninits state computed by MIR dataflow.
#![feature(rustc_attrs)]
#![feature(core_intrinsics, rustc_attrs)]
use std::intrinsics::rustc_peek;
use std::mem::{drop, replace};

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(libc)]
extern crate libc;
fn main() {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(unboxed_closures)]
#![feature(fn_traits, unboxed_closures)]
use std::ops::FnMut;

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(unboxed_closures)]
#![feature(fn_traits, unboxed_closures)]
use std::ops::FnMut;

View file

@ -16,10 +16,8 @@
pub fn main() {
let _: std::ops::RangeInclusive<_> = { use std::intrinsics; 1 } ... { use std::intrinsics; 2 };
//~^ ERROR use of unstable library feature 'inclusive_range'
//~^^ ERROR core_intrinsics
//~^^^ ERROR core_intrinsics
//~^^^^ WARN unused_imports
//~^^^^^ WARN unused_imports
//~| ERROR core_intrinsics
//~| ERROR core_intrinsics
}

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(reflect_marker)]
// Test that types that appear in assoc bindings in an object
// type are subject to the reflect check.

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(reflect_marker)]
// Test that types that appear in input types in an object type are
// subject to the reflect check.

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(reflect_marker)]
// Test that there is no way to get a generic type `T` to be
// considered as `Reflect` (or accessible via something that is
// considered `Reflect`) without a reflect bound, but that any

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(fn_traits)]
struct closure_box<'a> {
cl: Box<FnMut() + 'a>,
}

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(collections)]
mod a {
extern crate collections;
use collections::HashMap;

View file

@ -23,9 +23,4 @@ fn f2() { }
#[unstable(feature = "a", issue = "no")] //~ ERROR incorrect 'issue'
fn f3() { }
#[macro_export]
macro_rules! mac { //~ ERROR This node does not have a stability attribute
() => ()
}
fn main() { }

View file

@ -0,0 +1,22 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// More checks that stability attributes are used correctly
#![feature(staged_api)]
#![stable(feature = "test_feature", since = "1.0.0")]
#[macro_export]
macro_rules! mac { //~ ERROR This node does not have a stability attribute
() => ()
}
fn main() { }

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(libc)]
extern crate libc;
extern {

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rand)]
// ensure that the ThreadRng isn't/doesn't become accidentally sendable.
use std::__rand::ThreadRng;

View file

@ -11,7 +11,7 @@
// Checks that the Fn trait hierarchy rules do not permit
// Fn to be used where FnMut is implemented.
#![feature(unboxed_closures)]
#![feature(fn_traits, unboxed_closures)]
#![feature(overloaded_calls)]
use std::ops::{Fn,FnMut,FnOnce};

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(fn_traits)]
// That a closure whose expected argument types include two distinct
// bound regions.

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(core,unboxed_closures)]
#![feature(core, fn_traits, unboxed_closures)]
use std::marker::PhantomData;

View file

@ -10,7 +10,7 @@
// Regression test for #23827
#![feature(core, unboxed_closures)]
#![feature(core, fn_traits, unboxed_closures)]
pub struct Prototype {
pub target: u32