rustc: Fix a number of stability lint holes

There are a number of holes that the stability lint did not previously cover,
including:

* Types
* Bounds on type parameters on functions and impls
* Where clauses
* Imports
* Patterns (structs and enums)

These holes have all been fixed by overriding the `visit_path` function on the
AST visitor instead of a few specialized cases. This change also necessitated a
few stability changes:

* The `collections::fmt` module is now stable (it was already supposed to be).
* The `thread_local:👿:Key` type is now stable (it was already supposed to
  be).
* The `std::rt::{begin_unwind, begin_unwind_fmt}` functions are now stable.
  These are required via the `panic!` macro.
* The `std::old_io::stdio::{println, println_args}` functions are now stable.
  These are required by the `print!` and `println!` macros.
* The `ops::{FnOnce, FnMut, Fn}` traits are now `#[stable]`. This is required to
  make bounds with these traits stable. Note that manual implementations of
  these traits are still gated by default, this stability only allows bounds
  such as `F: FnOnce()`.

Additionally, the compiler now has special logic to ignore its own generated
`__test` module for the `--test` harness in terms of stability.

Closes #8962
Closes #16360
Closes #20327

[breaking-change]
This commit is contained in:
Alex Crichton 2015-02-09 16:33:19 -08:00
parent 446bc899b2
commit bbbb571fee
35 changed files with 187 additions and 127 deletions

View file

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

View file

@ -98,12 +98,10 @@ 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!();
macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item: text
macro_test_arg!(deprecated_unstable_text()); //~ ERROR use of deprecated item: text
//~^ WARNING use of unstable library feature
macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item: text
macro_test_arg_nested!(deprecated_text);
}
fn test_method_param<F: Trait>(foo: F) {
@ -139,7 +137,7 @@ mod cross_crate {
mod inheritance {
extern crate inherited_stability; //~ WARNING: use of unstable library feature
use self::inherited_stability::*;
use self::inherited_stability::*; //~ WARNING: use of unstable library feature
fn test_inheritance() {
unstable(); //~ WARNING use of unstable library feature

View file

@ -0,0 +1,23 @@
// 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.rs
// error-pattern: use of deprecated item
#![deny(deprecated)]
#[macro_use]
extern crate lint_stability;
use lint_stability::*;
fn main() {
macro_test!();
}

View file

@ -0,0 +1,25 @@
// 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.rs
// error-pattern: use of deprecated item
#![deny(deprecated)]
#![allow(warnings)]
#[macro_use]
extern crate lint_stability;
use lint_stability::*;
fn main() {
macro_test_arg_nested!(deprecated_text);
}