Minor fixes

This commit is contained in:
Brian Anderson 2015-01-16 14:08:24 -08:00
parent 18d144ac02
commit 0768892abe
13 changed files with 60 additions and 77 deletions

View File

@ -300,7 +300,7 @@ tidy:
| grep '^$(S)src/libbacktrace' -v \ | grep '^$(S)src/libbacktrace' -v \
| grep '^$(S)src/rust-installer' -v \ | grep '^$(S)src/rust-installer' -v \
| xargs $(CFG_PYTHON) $(S)src/etc/check-binaries.py | xargs $(CFG_PYTHON) $(S)src/etc/check-binaries.py
$(CFG_PYTHON) $(S)src/etc/featureck.py $(S)src/ $(Q)$(CFG_PYTHON) $(S)src/etc/featureck.py $(S)src/
endif endif

View File

@ -43,7 +43,7 @@ with open(feature_gate_source, 'r') as f:
line = line.replace("(", "").replace("),", "").replace(")", "") line = line.replace("(", "").replace("),", "").replace(")", "")
parts = line.split(",") parts = line.split(",")
if len(parts) != 3: if len(parts) != 3:
print "unexpected number of components in line: " + original_line print "error: unexpected number of components in line: " + original_line
sys.exit(1) sys.exit(1)
feature_name = parts[0].strip().replace('"', "") feature_name = parts[0].strip().replace('"', "")
since = parts[1].strip().replace('"', "") since = parts[1].strip().replace('"', "")
@ -102,14 +102,15 @@ for (dirpath, dirnames, filenames) in os.walk(src_dir):
lib_features[feature_name] = feature_name lib_features[feature_name] = feature_name
if lib_features_and_level.get((feature_name, level)) is None: if lib_features_and_level.get((feature_name, level)) is None:
# Add it to the observed features # Add it to the observed features
lib_features_and_level[(feature_name, level)] = (since, path, line_num, line) lib_features_and_level[(feature_name, level)] = \
(since, path, line_num, line)
else: else:
# Verify that for this combination of feature_name and level the 'since' # Verify that for this combination of feature_name and level the 'since'
# attribute matches. # attribute matches.
(expected_since, source_path, source_line_num, source_line) = \ (expected_since, source_path, source_line_num, source_line) = \
lib_features_and_level.get((feature_name, level)) lib_features_and_level.get((feature_name, level))
if since != expected_since: if since != expected_since:
print "mismatch in " + level + " feature '" + feature_name + "'" print "error: mismatch in " + level + " feature '" + feature_name + "'"
print "line " + str(source_line_num) + " of " + source_path + ":" print "line " + str(source_line_num) + " of " + source_path + ":"
print source_line print source_line
print "line " + str(line_num) + " of " + path + ":" print "line " + str(line_num) + " of " + path + ":"
@ -118,13 +119,13 @@ for (dirpath, dirnames, filenames) in os.walk(src_dir):
# Verify that this lib feature doesn't duplicate a lang feature # Verify that this lib feature doesn't duplicate a lang feature
if feature_name in language_feature_names: if feature_name in language_feature_names:
print "lib feature '" + feature_name + "' duplicates a lang feature" print "error: lib feature '" + feature_name + "' duplicates a lang feature"
print "line " + str(line_num) + " of " + path + ":" print "line " + str(line_num) + " of " + path + ":"
print line print line
errors = True errors = True
else: else:
print "misformed stability attribute" print "error: misformed stability attribute"
print "line " + str(line_num) + " of " + path + ":" print "line " + str(line_num) + " of " + path + ":"
print line print line
errors = True errors = True
@ -141,7 +142,7 @@ for f in language_features:
status = "unstable" status = "unstable"
stable_since = None stable_since = None
partially_deprecated = False partially_deprecated = False
if f[2] == "Accepted": if f[2] == "Accepted":
status = "stable" status = "stable"
if status == "stable": if status == "stable":
@ -165,7 +166,7 @@ for f in lib_features:
is_deprecated = lib_features_and_level.get((name, "deprecated")) is not None is_deprecated = lib_features_and_level.get((name, "deprecated")) is not None
if is_stable and is_unstable: if is_stable and is_unstable:
print "feature '" + name + "' is both stable and unstable" print "error: feature '" + name + "' is both stable and unstable"
errors = True errors = True
if is_stable: if is_stable:
@ -189,7 +190,7 @@ merged_stats = { }
for name in lib_feature_stats: for name in lib_feature_stats:
if language_feature_stats.get(name) is not None: if language_feature_stats.get(name) is not None:
if not name in joint_features: if not name in joint_features:
print "feature '" + name + "' is both a lang and lib feature but not whitelisted" print "error: feature '" + name + "' is both a lang and lib feature but not whitelisted"
errors = True errors = True
lang_status = lang_feature_stats[name][3] lang_status = lang_feature_stats[name][3]
lib_status = lib_feature_stats[name][3] lib_status = lib_feature_stats[name][3]
@ -199,7 +200,7 @@ for name in lib_feature_stats:
lib_partially_deprecated = lib_feature_stats[name][5] lib_partially_deprecated = lib_feature_stats[name][5]
if lang_status != lib_status and lib_status != "deprecated": if lang_status != lib_status and lib_status != "deprecated":
print "feature '" + name + "' has lang status " + lang_status + \ print "error: feature '" + name + "' has lang status " + lang_status + \
" but lib status " + lib_status " but lib status " + lib_status
errors = True errors = True
@ -208,7 +209,7 @@ for name in lib_feature_stats:
partially_deprecated = True partially_deprecated = True
if lang_stable_since != lib_stable_since: if lang_stable_since != lib_stable_since:
print "feature '" + name + "' has lang stable since " + lang_stable_since + \ print "error: feature '" + name + "' has lang stable since " + lang_stable_since + \
" but lib stable since " + lib_stable_since " but lib stable since " + lib_stable_since
errors = True errors = True

View File

@ -742,11 +742,9 @@ pub struct Weak<T> {
} }
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot #[cfg(not(stage0))] // NOTE remove cfg after next snapshot
#[allow(unstable)]
impl<T> !marker::Send for Weak<T> {} impl<T> !marker::Send for Weak<T> {}
#[cfg(not(stage0))] // NOTE remove cfg after next snapshot #[cfg(not(stage0))] // NOTE remove cfg after next snapshot
#[allow(unstable)]
impl<T> !marker::Sync for Weak<T> {} impl<T> !marker::Sync for Weak<T> {}

View File

@ -96,7 +96,8 @@ pub trait Hasher {
/// A common bound on the `Hasher` parameter to `Hash` implementations in order /// A common bound on the `Hasher` parameter to `Hash` implementations in order
/// to generically hash an aggregate. /// to generically hash an aggregate.
#[experimental = "this trait will likely be replaced by io::Writer"] #[unstable(feature = "unnamed_feature", since = "1.0.0",
reason = "this trait will likely be replaced by io::Writer")]
#[allow(missing_docs)] #[allow(missing_docs)]
pub trait Writer { pub trait Writer {
fn write(&mut self, bytes: &[u8]); fn write(&mut self, bytes: &[u8]);

View File

@ -114,7 +114,6 @@ fn discard_doesnt_unborrow() {
} }
#[test] #[test]
#[allow(unstable)]
fn clone_ref_updates_flag() { fn clone_ref_updates_flag() {
let x = RefCell::new(0i); let x = RefCell::new(0i);
{ {

View File

@ -233,7 +233,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
None => { None => {
// This is an 'unmarked' API, which should not exist // This is an 'unmarked' API, which should not exist
// in the standard library. // in the standard library.
self.tcx.sess.span_err(span, "use of unmarked staged library feature"); self.tcx.sess.span_err(span, "use of unmarked library feature");
self.tcx.sess.span_note(span, "this is either a bug in the library you are \ self.tcx.sess.span_note(span, "this is either a bug in the library you are \
using or a bug in the compiler - there is \ using or a bug in the compiler - there is \
no way to use this feature"); no way to use this feature");

View File

@ -486,7 +486,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
// Needs to go *after* expansion to be able to check the results of macro expansion. // Needs to go *after* expansion to be able to check the results of macro expansion.
time(time_passes, "complete gated feature checking", (), |_| { time(time_passes, "complete gated feature checking", (), |_| {
let features = let features =
syntax::feature_gate::check_crate(sess.codemap(), syntax::feature_gate::check_crate(sess.codemap(),
&sess.parse_sess.span_diagnostic, &sess.parse_sess.span_diagnostic,
&krate); &krate);

View File

@ -11,6 +11,7 @@
#![crate_name="lint_output_format"] #![crate_name="lint_output_format"]
#![crate_type = "lib"] #![crate_type = "lib"]
#![staged_api] #![staged_api]
#![unstable(feature = "unnamed_feature", since = "1.0.0")]
#[deprecated(feature = "oldstuff", since = "1.0.0")] #[deprecated(feature = "oldstuff", since = "1.0.0")]
pub fn foo() -> uint { pub fn foo() -> uint {

View File

@ -8,9 +8,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
// compile-flags: -F unstable // compile-flags: -F deprecated
#![staged_api] #![staged_api]
#[allow(unstable)] //~ ERROR allow(unstable) overruled by outer forbid(unstable) #[allow(deprecated)] //~ ERROR allow(deprecated) overruled by outer forbid(deprecated)
fn main() { fn main() {
} }

View File

@ -8,13 +8,15 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
// compile-flags:-F unstable // compile-flags: -F unused_features
// aux-build:lint_output_format.rs // aux-build:lint_output_format.rs
extern crate lint_output_format; //~ ERROR: use of unmarked item #![feature(foo)] //~ ERROR unused or unknown feature
extern crate lint_output_format; //~ WARNING: use of unstable library feature
use lint_output_format::{foo, bar}; use lint_output_format::{foo, bar};
fn main() { fn main() {
let _x = foo(); //~ WARNING #[warn(deprecated)] on by default let _x = foo(); //~ WARNING #[warn(deprecated)] on by default
let _y = bar(); //~ ERROR [-F unstable] let _y = bar(); //~ WARNING: use of unstable library feature
} }

View File

@ -12,19 +12,18 @@
// aux-build:inherited_stability.rs // aux-build:inherited_stability.rs
// aux-build:stability_cfg1.rs // aux-build:stability_cfg1.rs
// aux-build:stability_cfg2.rs // aux-build:stability_cfg2.rs
// ignore-tidy-linelength
#![deny(unstable)]
#![deny(deprecated)] #![deny(deprecated)]
#![deny(unstable)]
#![allow(dead_code)] #![allow(dead_code)]
#![staged_api] #![staged_api]
#[macro_use] #[macro_use]
extern crate lint_stability; //~ ERROR: use of unmarked item extern crate lint_stability; //~ ERROR: use of unmarked library feature
mod cross_crate { mod cross_crate {
extern crate stability_cfg1; extern crate stability_cfg1;
extern crate stability_cfg2; //~ ERROR: use of unstable item extern crate stability_cfg2; //~ WARNING: use of unstable library feature
use lint_stability::*; use lint_stability::*;
@ -39,17 +38,17 @@ mod cross_crate {
foo.method_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.trait_deprecated_text(); //~ ERROR use of deprecated item: text
unstable(); //~ ERROR use of unstable item unstable(); //~ WARNING use of unstable library feature
foo.method_unstable(); //~ ERROR use of unstable item foo.method_unstable(); //~ WARNING use of unstable library feature
foo.trait_unstable(); //~ ERROR use of unstable item foo.trait_unstable(); //~ WARNING use of unstable library feature
unstable_text(); //~ ERROR use of unstable item: text unstable_text(); //~ WARNING use of unstable library feature 'unnamed_feature': text
foo.method_unstable_text(); //~ ERROR use of unstable item: text foo.method_unstable_text(); //~ WARNING use of unstable library feature 'unnamed_feature': text
foo.trait_unstable_text(); //~ ERROR use of unstable item: text foo.trait_unstable_text(); //~ WARNING use of unstable library feature 'unnamed_feature': text
unmarked(); //~ ERROR use of unmarked item unmarked(); //~ ERROR use of unmarked library feature
foo.method_unmarked(); //~ ERROR use of unmarked item foo.method_unmarked(); //~ ERROR use of unmarked library feature
foo.trait_unmarked(); //~ ERROR use of unmarked item foo.trait_unmarked(); //~ ERROR use of unmarked library feature
stable(); stable();
foo.method_stable(); foo.method_stable();
@ -60,23 +59,23 @@ mod cross_crate {
foo.trait_stable_text(); foo.trait_stable_text();
let _ = DeprecatedStruct { i: 0 }; //~ ERROR use of deprecated item let _ = DeprecatedStruct { i: 0 }; //~ ERROR use of deprecated item
let _ = UnstableStruct { i: 0 }; //~ ERROR use of unstable item let _ = UnstableStruct { i: 0 }; //~ WARNING use of unstable library feature
let _ = UnmarkedStruct { i: 0 }; //~ ERROR use of unmarked item let _ = UnmarkedStruct { i: 0 }; //~ ERROR use of unmarked library feature
let _ = StableStruct { i: 0 }; let _ = StableStruct { i: 0 };
let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item
let _ = UnstableUnitStruct; //~ ERROR use of unstable item let _ = UnstableUnitStruct; //~ WARNING use of unstable library feature
let _ = UnmarkedUnitStruct; //~ ERROR use of unmarked item let _ = UnmarkedUnitStruct; //~ ERROR use of unmarked library feature
let _ = StableUnitStruct; let _ = StableUnitStruct;
let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item
let _ = Enum::UnstableVariant; //~ ERROR use of unstable item let _ = Enum::UnstableVariant; //~ WARNING use of unstable library feature
let _ = Enum::UnmarkedVariant; //~ ERROR use of unmarked item let _ = Enum::UnmarkedVariant; //~ ERROR use of unmarked library feature
let _ = Enum::StableVariant; let _ = Enum::StableVariant;
let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item
let _ = UnstableTupleStruct (1); //~ ERROR use of unstable item let _ = UnstableTupleStruct (1); //~ WARNING use of unstable library feature
let _ = UnmarkedTupleStruct (1); //~ ERROR use of unmarked item let _ = UnmarkedTupleStruct (1); //~ ERROR use of unmarked library feature
let _ = StableTupleStruct (1); let _ = StableTupleStruct (1);
// At the moment, the lint checker only checks stability in // At the moment, the lint checker only checks stability in
@ -93,47 +92,47 @@ mod cross_crate {
fn test_method_param<F: Trait>(foo: F) { fn test_method_param<F: Trait>(foo: F) {
foo.trait_deprecated(); //~ ERROR use of deprecated item foo.trait_deprecated(); //~ ERROR use of deprecated item
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
foo.trait_unstable(); //~ ERROR use of unstable item foo.trait_unstable(); //~ WARNING use of unstable library feature
foo.trait_unstable_text(); //~ ERROR use of unstable item: text foo.trait_unstable_text(); //~ WARNING use of unstable library feature 'unnamed_feature': text
foo.trait_unmarked(); //~ ERROR use of unmarked item foo.trait_unmarked(); //~ ERROR use of unmarked library feature
foo.trait_stable(); foo.trait_stable();
} }
fn test_method_object(foo: &Trait) { fn test_method_object(foo: &Trait) {
foo.trait_deprecated(); //~ ERROR use of deprecated item foo.trait_deprecated(); //~ ERROR use of deprecated item
foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text
foo.trait_unstable(); //~ ERROR use of unstable item foo.trait_unstable(); //~ WARNING use of unstable library feature
foo.trait_unstable_text(); //~ ERROR use of unstable item: text foo.trait_unstable_text(); //~ WARNING use of unstable library feature 'unnamed_feature': text
foo.trait_unmarked(); //~ ERROR use of unmarked item foo.trait_unmarked(); //~ ERROR use of unmarked library feature
foo.trait_stable(); foo.trait_stable();
} }
struct S; struct S;
impl UnstableTrait for S { } //~ ERROR use of unstable item impl UnstableTrait for S { } //~ WARNING use of unstable library feature
trait LocalTrait : UnstableTrait { } //~ ERROR use of unstable item trait LocalTrait : UnstableTrait { } //~ WARNING use of unstable library feature
} }
mod inheritance { mod inheritance {
extern crate inherited_stability; //~ ERROR: use of unstable item extern crate inherited_stability; //~ WARNING: use of unstable library feature
use self::inherited_stability::*; use self::inherited_stability::*;
fn test_inheritance() { fn test_inheritance() {
unstable(); //~ ERROR use of unstable item unstable(); //~ WARNING use of unstable library feature
stable(); stable();
stable_mod::unstable(); //~ ERROR use of unstable item stable_mod::unstable(); //~ WARNING use of unstable library feature
stable_mod::stable(); stable_mod::stable();
unstable_mod::deprecated(); //~ ERROR use of deprecated item unstable_mod::deprecated(); //~ ERROR use of deprecated item
unstable_mod::unstable(); //~ ERROR use of unstable item unstable_mod::unstable(); //~ WARNING use of unstable library feature
let _ = Unstable::UnstableVariant; //~ ERROR use of unstable item let _ = Unstable::UnstableVariant; //~ WARNING use of unstable library feature
let _ = Unstable::StableVariant; let _ = Unstable::StableVariant;
let x: usize = 0; let x: usize = 0;
x.unstable(); //~ ERROR use of unstable item x.unstable(); //~ WARNING use of unstable library feature
x.stable(); x.stable();
} }
} }

View File

@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![deny(unknown_features)] #![deny(unused_features)]
#![feature(this_is_not_a_feature)] //~ ERROR: unknown feature #![feature(this_is_not_a_feature)] //~ ERROR: unused or unknown feature
fn main() {} fn main() {}

View File

@ -1,18 +0,0 @@
// Copyright 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.
#![deny(unstable)]
#![feature(unnamed_feature)]
use std::simd;
fn main() {
let _ = simd::i64x2(0, 0); //~ ERROR: experimental
}