From 0768892abee31e1f8065deb4c61f0a88a682b17a Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 16 Jan 2015 14:08:24 -0800 Subject: [PATCH] Minor fixes --- mk/tests.mk | 2 +- src/etc/featureck.py | 21 +++--- src/liballoc/rc.rs | 2 - src/libcore/hash/mod.rs | 3 +- src/libcoretest/cell.rs | 1 - src/librustc/middle/stability.rs | 2 +- src/librustc_driver/driver.rs | 2 +- src/test/auxiliary/lint_output_format.rs | 1 + src/test/compile-fail/lint-forbid-cmdline.rs | 4 +- src/test/compile-fail/lint-output-format.rs | 8 ++- src/test/compile-fail/lint-stability.rs | 69 +++++++++---------- src/test/compile-fail/lint-unknown-feature.rs | 4 +- src/test/compile-fail/simd-experimental.rs | 18 ----- 13 files changed, 60 insertions(+), 77 deletions(-) delete mode 100644 src/test/compile-fail/simd-experimental.rs diff --git a/mk/tests.mk b/mk/tests.mk index 33890652124..bf0b58f70a9 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -300,7 +300,7 @@ tidy: | grep '^$(S)src/libbacktrace' -v \ | grep '^$(S)src/rust-installer' -v \ | 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 diff --git a/src/etc/featureck.py b/src/etc/featureck.py index 06ef2d7c605..616596aa352 100644 --- a/src/etc/featureck.py +++ b/src/etc/featureck.py @@ -43,7 +43,7 @@ with open(feature_gate_source, 'r') as f: line = line.replace("(", "").replace("),", "").replace(")", "") parts = line.split(",") 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) feature_name = parts[0].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 if lib_features_and_level.get((feature_name, level)) is None: # 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: # Verify that for this combination of feature_name and level the 'since' # attribute matches. (expected_since, source_path, source_line_num, source_line) = \ lib_features_and_level.get((feature_name, level)) 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 source_line 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 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 errors = True else: - print "misformed stability attribute" + print "error: misformed stability attribute" print "line " + str(line_num) + " of " + path + ":" print line errors = True @@ -141,7 +142,7 @@ for f in language_features: status = "unstable" stable_since = None partially_deprecated = False - + if f[2] == "Accepted": 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 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 if is_stable: @@ -189,7 +190,7 @@ merged_stats = { } for name in lib_feature_stats: if language_feature_stats.get(name) is not None: 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 lang_status = lang_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] 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 errors = True @@ -208,7 +209,7 @@ for name in lib_feature_stats: partially_deprecated = True 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 errors = True diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 5e828106739..07eebe600d5 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -742,11 +742,9 @@ pub struct Weak { } #[cfg(not(stage0))] // NOTE remove cfg after next snapshot -#[allow(unstable)] impl !marker::Send for Weak {} #[cfg(not(stage0))] // NOTE remove cfg after next snapshot -#[allow(unstable)] impl !marker::Sync for Weak {} diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index 51212bcdb68..9e436367e6c 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -96,7 +96,8 @@ pub trait Hasher { /// A common bound on the `Hasher` parameter to `Hash` implementations in order /// 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)] pub trait Writer { fn write(&mut self, bytes: &[u8]); diff --git a/src/libcoretest/cell.rs b/src/libcoretest/cell.rs index a808593ffbd..8bd2ed95ed5 100644 --- a/src/libcoretest/cell.rs +++ b/src/libcoretest/cell.rs @@ -114,7 +114,6 @@ fn discard_doesnt_unborrow() { } #[test] -#[allow(unstable)] fn clone_ref_updates_flag() { let x = RefCell::new(0i); { diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index b1f6a19ea3e..e91571a270f 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -233,7 +233,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { None => { // This is an 'unmarked' API, which should not exist // 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 \ using or a bug in the compiler - there is \ no way to use this feature"); diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 4626c5216bc..4d5c2b765fe 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -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. time(time_passes, "complete gated feature checking", (), |_| { - let features = + let features = syntax::feature_gate::check_crate(sess.codemap(), &sess.parse_sess.span_diagnostic, &krate); diff --git a/src/test/auxiliary/lint_output_format.rs b/src/test/auxiliary/lint_output_format.rs index 3af319197e3..e47d1eeb401 100755 --- a/src/test/auxiliary/lint_output_format.rs +++ b/src/test/auxiliary/lint_output_format.rs @@ -11,6 +11,7 @@ #![crate_name="lint_output_format"] #![crate_type = "lib"] #![staged_api] +#![unstable(feature = "unnamed_feature", since = "1.0.0")] #[deprecated(feature = "oldstuff", since = "1.0.0")] pub fn foo() -> uint { diff --git a/src/test/compile-fail/lint-forbid-cmdline.rs b/src/test/compile-fail/lint-forbid-cmdline.rs index e3be0d06a35..53575192965 100644 --- a/src/test/compile-fail/lint-forbid-cmdline.rs +++ b/src/test/compile-fail/lint-forbid-cmdline.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: -F unstable +// compile-flags: -F deprecated #![staged_api] -#[allow(unstable)] //~ ERROR allow(unstable) overruled by outer forbid(unstable) +#[allow(deprecated)] //~ ERROR allow(deprecated) overruled by outer forbid(deprecated) fn main() { } diff --git a/src/test/compile-fail/lint-output-format.rs b/src/test/compile-fail/lint-output-format.rs index 10217481bf3..ec4e3c774db 100644 --- a/src/test/compile-fail/lint-output-format.rs +++ b/src/test/compile-fail/lint-output-format.rs @@ -8,13 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags:-F unstable +// compile-flags: -F unused_features // 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}; fn main() { let _x = foo(); //~ WARNING #[warn(deprecated)] on by default - let _y = bar(); //~ ERROR [-F unstable] + let _y = bar(); //~ WARNING: use of unstable library feature } diff --git a/src/test/compile-fail/lint-stability.rs b/src/test/compile-fail/lint-stability.rs index 316c971e016..130b396387c 100644 --- a/src/test/compile-fail/lint-stability.rs +++ b/src/test/compile-fail/lint-stability.rs @@ -12,19 +12,18 @@ // aux-build:inherited_stability.rs // aux-build:stability_cfg1.rs // aux-build:stability_cfg2.rs +// ignore-tidy-linelength -#![deny(unstable)] #![deny(deprecated)] -#![deny(unstable)] #![allow(dead_code)] #![staged_api] #[macro_use] -extern crate lint_stability; //~ ERROR: use of unmarked item +extern crate lint_stability; //~ ERROR: use of unmarked library feature mod cross_crate { 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::*; @@ -39,17 +38,17 @@ mod cross_crate { foo.method_deprecated_text(); //~ ERROR use of deprecated item: text foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text - unstable(); //~ ERROR use of unstable item - foo.method_unstable(); //~ ERROR use of unstable item - foo.trait_unstable(); //~ ERROR use of unstable item + unstable(); //~ WARNING use of unstable library feature + foo.method_unstable(); //~ WARNING use of unstable library feature + foo.trait_unstable(); //~ WARNING use of unstable library feature - unstable_text(); //~ ERROR use of unstable item: text - foo.method_unstable_text(); //~ ERROR use of unstable item: text - foo.trait_unstable_text(); //~ ERROR use of unstable item: text + unstable_text(); //~ WARNING use of unstable library feature 'unnamed_feature': text + foo.method_unstable_text(); //~ WARNING use of unstable library feature 'unnamed_feature': text + foo.trait_unstable_text(); //~ WARNING use of unstable library feature 'unnamed_feature': text - unmarked(); //~ ERROR use of unmarked item - foo.method_unmarked(); //~ ERROR use of unmarked item - foo.trait_unmarked(); //~ ERROR use of unmarked item + unmarked(); //~ ERROR use of unmarked library feature + foo.method_unmarked(); //~ ERROR use of unmarked library feature + foo.trait_unmarked(); //~ ERROR use of unmarked library feature stable(); foo.method_stable(); @@ -60,23 +59,23 @@ mod cross_crate { foo.trait_stable_text(); let _ = DeprecatedStruct { i: 0 }; //~ ERROR use of deprecated item - let _ = UnstableStruct { i: 0 }; //~ ERROR use of unstable item - let _ = UnmarkedStruct { i: 0 }; //~ ERROR use of unmarked item + let _ = UnstableStruct { i: 0 }; //~ WARNING use of unstable library feature + let _ = UnmarkedStruct { i: 0 }; //~ ERROR use of unmarked library feature let _ = StableStruct { i: 0 }; let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item - let _ = UnstableUnitStruct; //~ ERROR use of unstable item - let _ = UnmarkedUnitStruct; //~ ERROR use of unmarked item + let _ = UnstableUnitStruct; //~ WARNING use of unstable library feature + let _ = UnmarkedUnitStruct; //~ ERROR use of unmarked library feature let _ = StableUnitStruct; let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item - let _ = Enum::UnstableVariant; //~ ERROR use of unstable item - let _ = Enum::UnmarkedVariant; //~ ERROR use of unmarked item + let _ = Enum::UnstableVariant; //~ WARNING use of unstable library feature + let _ = Enum::UnmarkedVariant; //~ ERROR use of unmarked library feature let _ = Enum::StableVariant; let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item - let _ = UnstableTupleStruct (1); //~ ERROR use of unstable item - let _ = UnmarkedTupleStruct (1); //~ ERROR use of unmarked item + let _ = UnstableTupleStruct (1); //~ WARNING use of unstable library feature + let _ = UnmarkedTupleStruct (1); //~ ERROR use of unmarked library feature let _ = StableTupleStruct (1); // At the moment, the lint checker only checks stability in @@ -93,47 +92,47 @@ mod cross_crate { fn test_method_param(foo: F) { foo.trait_deprecated(); //~ ERROR use of deprecated item foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text - foo.trait_unstable(); //~ ERROR use of unstable item - foo.trait_unstable_text(); //~ ERROR use of unstable item: text - foo.trait_unmarked(); //~ ERROR use of unmarked item + foo.trait_unstable(); //~ WARNING use of unstable library feature + foo.trait_unstable_text(); //~ WARNING use of unstable library feature 'unnamed_feature': text + foo.trait_unmarked(); //~ ERROR use of unmarked library feature foo.trait_stable(); } fn test_method_object(foo: &Trait) { foo.trait_deprecated(); //~ ERROR use of deprecated item foo.trait_deprecated_text(); //~ ERROR use of deprecated item: text - foo.trait_unstable(); //~ ERROR use of unstable item - foo.trait_unstable_text(); //~ ERROR use of unstable item: text - foo.trait_unmarked(); //~ ERROR use of unmarked item + foo.trait_unstable(); //~ WARNING use of unstable library feature + foo.trait_unstable_text(); //~ WARNING use of unstable library feature 'unnamed_feature': text + foo.trait_unmarked(); //~ ERROR use of unmarked library feature foo.trait_stable(); } 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 { - extern crate inherited_stability; //~ ERROR: use of unstable item + extern crate inherited_stability; //~ WARNING: use of unstable library feature use self::inherited_stability::*; fn test_inheritance() { - unstable(); //~ ERROR use of unstable item + unstable(); //~ WARNING use of unstable library feature stable(); - stable_mod::unstable(); //~ ERROR use of unstable item + stable_mod::unstable(); //~ WARNING use of unstable library feature stable_mod::stable(); 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 x: usize = 0; - x.unstable(); //~ ERROR use of unstable item + x.unstable(); //~ WARNING use of unstable library feature x.stable(); } } diff --git a/src/test/compile-fail/lint-unknown-feature.rs b/src/test/compile-fail/lint-unknown-feature.rs index 6252e01749b..ac1720b339e 100644 --- a/src/test/compile-fail/lint-unknown-feature.rs +++ b/src/test/compile-fail/lint-unknown-feature.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // 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() {} diff --git a/src/test/compile-fail/simd-experimental.rs b/src/test/compile-fail/simd-experimental.rs deleted file mode 100644 index f817f943dbe..00000000000 --- a/src/test/compile-fail/simd-experimental.rs +++ /dev/null @@ -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 or the MIT license -// , 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 -}