Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it an error to not declare used features #23598

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
Next Next commit
Require feature attributes, and add them where necessary
  • Loading branch information
brson committed Mar 23, 2015

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 3a21c4b85b17c6b68d710e041bda664326724b3c
1 change: 1 addition & 0 deletions src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
#![feature(std_misc)]
#![feature(test)]
#![feature(path_ext)]
#![feature(str_char)]

#![deny(warnings)]

2 changes: 1 addition & 1 deletion src/libcollections/lib.rs
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@
#![feature(unsafe_no_drop_flag)]
#![feature(step_by)]
#![feature(str_char)]
#![cfg_attr(test, feature(rand, rustc_private, test))]
#![cfg_attr(test, feature(rand, rustc_private, test, hash, collections))]
#![cfg_attr(test, allow(deprecated))] // rand

#![feature(no_std)]
1 change: 1 addition & 0 deletions src/libcollectionstest/lib.rs
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
#![feature(unboxed_closures)]
#![feature(unicode)]
#![feature(unsafe_destructor)]
#![cfg_attr(test, feature(str_char))]

#[macro_use] extern crate log;

2 changes: 2 additions & 0 deletions src/libcoretest/lib.rs
Original file line number Diff line number Diff line change
@@ -24,6 +24,8 @@
#![feature(io)]
#![feature(collections)]
#![feature(debug_builders)]
#![feature(unique)]
#![feature(step_by)]
#![allow(deprecated)] // rand

extern crate core;
1 change: 1 addition & 0 deletions src/libflate/lib.rs
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@
#![feature(libc)]
#![feature(staged_api)]
#![feature(unique)]
#![cfg_attr(test, feature(rustc_private, rand, collections))]

#[cfg(test)] #[macro_use] extern crate log;

2 changes: 1 addition & 1 deletion src/librand/lib.rs
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@
#![deprecated(reason = "use the crates.io `rand` library instead",
since = "1.0.0-alpha")]

#![cfg_attr(test, feature(test, rand))]
#![cfg_attr(test, feature(test, rand, rustc_private))]

#![allow(deprecated)]

2 changes: 1 addition & 1 deletion src/librustc/lint/context.rs
Original file line number Diff line number Diff line change
@@ -212,7 +212,7 @@ impl LintStore {
fn maybe_stage_features(&mut self, sess: &Session) {
let lvl = match sess.opts.unstable_features {
UnstableFeatures::Default => return,
UnstableFeatures::Disallow => Warn,
UnstableFeatures::Disallow => Forbid,
UnstableFeatures::Cheat => Allow
};
match self.by_name.get("unstable_features") {
4 changes: 2 additions & 2 deletions src/librustc/middle/stability.rs
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ use syntax::ast::{Item, Generics, StructField};
use syntax::ast_util::is_local;
use syntax::attr::{Stability, AttrMetaMethods};
use syntax::visit::{FnKind, Visitor};
use syntax::feature_gate::emit_feature_warn;
use syntax::feature_gate::emit_feature_err;
use util::nodemap::{NodeMap, DefIdMap, FnvHashSet, FnvHashMap};
use util::ppaux::Repr;

@@ -237,7 +237,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
None => format!("use of unstable library feature '{}'", &feature)
};

emit_feature_warn(&self.tcx.sess.parse_sess.span_diagnostic,
emit_feature_err(&self.tcx.sess.parse_sess.span_diagnostic,
&feature, span, &msg);
}
}
1 change: 1 addition & 0 deletions src/librustc_back/lib.rs
Original file line number Diff line number Diff line change
@@ -49,6 +49,7 @@
#![feature(std_misc)]
#![feature(path_relative_from)]
#![feature(step_by)]
#![cfg_attr(test, feature(test, rand))]

extern crate syntax;
extern crate serialize;
1 change: 1 addition & 0 deletions src/librustc_bitflags/lib.rs
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
#![feature(no_std)]
#![no_std]
#![unstable(feature = "rustc_private")]
#![cfg_attr(test, feature(hash))]

//! A typesafe bitmask flag generator.

2 changes: 1 addition & 1 deletion src/libserialize/lib.rs
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ Core encoding and decoding interfaces.
#![feature(std_misc)]
#![feature(unicode)]
#![feature(str_char)]
#![cfg_attr(test, feature(test))]
#![cfg_attr(test, feature(test, old_io))]

// test harness access
#[cfg(test)] extern crate test;
2 changes: 1 addition & 1 deletion src/libstd/lib.rs
Original file line number Diff line number Diff line change
@@ -128,7 +128,7 @@
#![feature(unique)]
#![feature(allow_internal_unstable)]
#![feature(str_char)]
#![cfg_attr(test, feature(test, rustc_private))]
#![cfg_attr(test, feature(test, rustc_private, std_misc))]

// Don't link to std. We are std.
#![feature(no_std)]
1 change: 1 addition & 0 deletions src/libtest/lib.rs
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@
#![feature(libc)]
#![feature(set_stdio)]
#![feature(os)]
#![cfg_attr(test, feature(old_io))]

extern crate getopts;
extern crate serialize;
4 changes: 4 additions & 0 deletions src/libunicode/char.rs
Original file line number Diff line number Diff line change
@@ -653,6 +653,7 @@ impl char {
/// In both of these examples, 'ß' takes two bytes to encode.
///
/// ```
/// # #![feature(unicode)]
/// let mut b = [0; 2];
///
/// let result = 'ß'.encode_utf8(&mut b);
@@ -663,6 +664,7 @@ impl char {
/// A buffer that's too small:
///
/// ```
/// # #![feature(unicode)]
/// let mut b = [0; 1];
///
/// let result = 'ß'.encode_utf8(&mut b);
@@ -685,6 +687,7 @@ impl char {
/// In both of these examples, 'ß' takes one `u16` to encode.
///
/// ```
/// # #![feature(unicode)]
/// let mut b = [0; 1];
///
/// let result = 'ß'.encode_utf16(&mut b);
@@ -695,6 +698,7 @@ impl char {
/// A buffer that's too small:
///
/// ```
/// # #![feature(unicode)]
/// let mut b = [0; 0];
///
/// let result = 'ß'.encode_utf8(&mut b);
1 change: 1 addition & 0 deletions src/test/auxiliary/anon-extern-mod-cross-crate-1.rs
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
// except according to those terms.

#![crate_name="anonexternmod"]
#![feature(libc)]

extern crate libc;

2 changes: 2 additions & 0 deletions src/test/auxiliary/check_static_recursion_foreign_helper.rs
Original file line number Diff line number Diff line change
@@ -10,6 +10,8 @@

// Helper definition for test/run-pass/check-static-recursion-foreign.rs.

#![feature(libc)]

#[crate_id = "check_static_recursion_foreign_helper"]
#[crate_type = "lib"]

1 change: 1 addition & 0 deletions src/test/auxiliary/extern-crosscrate-source.rs
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@

#![crate_name="externcallback"]
#![crate_type = "lib"]
#![feature(libc)]

extern crate libc;

1 change: 1 addition & 0 deletions src/test/auxiliary/foreign_lib.rs
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
// except according to those terms.

#![crate_name="foreign_lib"]
#![feature(libc)]

pub mod rustrt {
extern crate libc;
1 change: 1 addition & 0 deletions src/test/auxiliary/issue-3012-1.rs
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@

#![crate_name="socketlib"]
#![crate_type = "lib"]
#![feature(libc)]

pub mod socket {
extern crate libc;
2 changes: 2 additions & 0 deletions src/test/auxiliary/issue13507.rs
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(core)]

pub mod testtypes {
use std::any::TypeId;

Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
// ignore-stage1
// force-host

#![feature(plugin_registrar, quote)]
#![feature(plugin_registrar, quote, rustc_private)]
#![crate_type = "dylib"]

extern crate syntax;
2 changes: 2 additions & 0 deletions src/test/auxiliary/issue_3907.rs
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(core)]

use std::marker::MarkerTrait;

pub trait Foo : MarkerTrait {
2 changes: 2 additions & 0 deletions src/test/auxiliary/issue_5844_aux.rs
Original file line number Diff line number Diff line change
@@ -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 "C" {
2 changes: 2 additions & 0 deletions src/test/auxiliary/linkage-visibility.rs
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(std_misc, old_path)]

use std::dynamic_lib::DynamicLibrary;

#[no_mangle]
2 changes: 1 addition & 1 deletion src/test/auxiliary/lint_for_crate.rs
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@

// force-host

#![feature(plugin_registrar)]
#![feature(plugin_registrar, rustc_private)]
#![feature(box_syntax)]

extern crate syntax;
2 changes: 1 addition & 1 deletion src/test/auxiliary/lint_group_plugin_test.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
// force-host

#![feature(plugin_registrar)]
#![feature(box_syntax)]
#![feature(box_syntax, rustc_private)]

extern crate syntax;

2 changes: 1 addition & 1 deletion src/test/auxiliary/lint_plugin_test.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
// force-host

#![feature(plugin_registrar)]
#![feature(box_syntax)]
#![feature(box_syntax, rustc_private)]

extern crate syntax;

2 changes: 2 additions & 0 deletions src/test/auxiliary/logging_right_crate.rs
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(rustc_private)]

#[macro_use] extern crate log;

pub fn foo<T>() {
2 changes: 1 addition & 1 deletion src/test/auxiliary/macro_crate_MacroRulesTT.rs
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@

// force-host

#![feature(plugin_registrar)]
#![feature(plugin_registrar, rustc_private)]

extern crate syntax;
extern crate rustc;
2 changes: 1 addition & 1 deletion src/test/auxiliary/macro_crate_test.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
// force-host

#![feature(plugin_registrar, quote)]
#![feature(box_syntax)]
#![feature(box_syntax, rustc_private)]

extern crate syntax;
extern crate rustc;
2 changes: 1 addition & 1 deletion src/test/auxiliary/plugin_args.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
// force-host

#![feature(plugin_registrar)]
#![feature(box_syntax)]
#![feature(box_syntax, rustc_private)]

extern crate syntax;
extern crate rustc;
2 changes: 1 addition & 1 deletion src/test/auxiliary/plugin_crate_outlive_expansion_phase.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
// force-host

#![feature(plugin_registrar)]
#![feature(box_syntax)]
#![feature(box_syntax, rustc_private)]

extern crate rustc;

2 changes: 1 addition & 1 deletion src/test/auxiliary/plugin_with_plugin_lib.rs
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@

// force-host

#![feature(plugin_registrar)]
#![feature(plugin_registrar, rustc_private)]
#![deny(plugin_as_library)] // should have no effect in a plugin crate

extern crate macro_crate_test;
2 changes: 2 additions & 0 deletions src/test/auxiliary/private_trait_xc.rs
Original file line number Diff line number Diff line change
@@ -8,4 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(core)]

trait Foo : ::std::marker::MarkerTrait {}
2 changes: 1 addition & 1 deletion src/test/auxiliary/procedural_mbe_matching.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
// force-host

#![crate_type="dylib"]
#![feature(plugin_registrar, quote)]
#![feature(plugin_registrar, quote, rustc_private)]

extern crate syntax;
extern crate rustc;
2 changes: 1 addition & 1 deletion src/test/auxiliary/rlib_crate_test.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
// no-prefer-dynamic

#![crate_type = "rlib"]
#![feature(plugin_registrar)]
#![feature(plugin_registrar, rustc_private)]

extern crate rustc;

2 changes: 1 addition & 1 deletion src/test/auxiliary/roman_numerals.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
// force-host

#![crate_type="dylib"]
#![feature(plugin_registrar)]
#![feature(plugin_registrar, rustc_private)]

extern crate syntax;
extern crate rustc;
1 change: 1 addition & 0 deletions src/test/auxiliary/svh-a-base.rs
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
//! (#14132).

#![crate_name = "a"]
#![feature(core)]

use std::marker::MarkerTrait;

1 change: 1 addition & 0 deletions src/test/auxiliary/svh-a-change-lit.rs
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
//! (#14132).

#![crate_name = "a"]
#![feature(core)]

use std::marker::MarkerTrait;

1 change: 1 addition & 0 deletions src/test/auxiliary/svh-a-change-significant-cfg.rs
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
//! (#14132).

#![crate_name = "a"]
#![feature(core)]

use std::marker::MarkerTrait;

1 change: 1 addition & 0 deletions src/test/auxiliary/svh-a-change-trait-bound.rs
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
//! (#14132).

#![crate_name = "a"]
#![feature(core)]

use std::marker::MarkerTrait;

1 change: 1 addition & 0 deletions src/test/auxiliary/svh-a-change-type-arg.rs
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
//! (#14132).

#![crate_name = "a"]
#![feature(core)]

use std::marker::MarkerTrait;

Loading