Auto merge of #52644 - varkor:lib-feature-gate-2, r=withoutboats

Add errors for unknown, stable and duplicate feature attributes

- Adds an error for unknown (lang and lib) features.
- Extends the lint for unnecessary feature attributes for stable features to libs features (this already exists for lang features).
- Adds an error for duplicate (lang and lib) features.

```rust
#![feature(fake_feature)] //~ ERROR unknown feature `fake_feature`

#![feature(i128_type)] //~ WARNING the feature `i128_type` has been stable since 1.26.0

#![feature(non_exhaustive)]
#![feature(non_exhaustive)] //~ ERROR duplicate `non_exhaustive` feature attribute
```

Fixes #52053, fixes #53032 and address some of the problems noted in #44232 (though not unused features).

There are a few outstanding problems, that I haven't narrowed down yet:
- [x] Stability attributes on macros do not seem to be taken into account.
- [x] Stability attributes behind `cfg` attributes are not taken into account.
- [x] There are failing incremental tests.
This commit is contained in:
bors 2018-08-06 16:58:27 +00:00
commit b239743753
399 changed files with 1040 additions and 1210 deletions

View File

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

View File

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

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rand)]
#![feature(repr_simd)]
#![feature(slice_sort_by_cached_key)]
#![feature(test)]

View File

@ -2370,7 +2370,7 @@ macro_rules! __impl_slice_eq1 {
__impl_slice_eq1! { $Lhs, $Rhs, Sized }
};
($Lhs: ty, $Rhs: ty, $Bound: ident) => {
#[stable(feature = "vec-deque-partial-eq-slice", since = "1.17.0")]
#[stable(feature = "vec_deque_partial_eq_slice", since = "1.17.0")]
impl<'a, 'b, A: $Bound, B> PartialEq<$Rhs> for $Lhs where A: PartialEq<B> {
fn eq(&self, other: &$Rhs) -> bool {
if self.len() != other.len() {

View File

@ -74,27 +74,24 @@
#![needs_allocator]
#![deny(missing_debug_implementations)]
#![cfg_attr(test, allow(deprecated))] // rand
#![cfg_attr(not(test), feature(exact_size_is_empty))]
#![cfg_attr(not(test), feature(fn_traits))]
#![cfg_attr(not(test), feature(generator_trait))]
#![cfg_attr(test, feature(rand, test))]
#![cfg_attr(test, feature(test))]
#![feature(allocator_api)]
#![feature(allow_internal_unstable)]
#![feature(arbitrary_self_types)]
#![feature(ascii_ctype)]
#![feature(box_into_raw_non_null)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(cfg_target_has_atomic)]
#![feature(coerce_unsized)]
#![feature(collections_range)]
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(custom_attribute)]
#![feature(dropck_eyepatch)]
#![feature(exact_size_is_empty)]
#![feature(fmt_internals)]
#![feature(from_ref)]
#![feature(fundamental)]
#![feature(futures_api)]
#![feature(lang_items)]
@ -118,14 +115,9 @@
#![feature(allocator_internals)]
#![feature(on_unimplemented)]
#![feature(exact_chunks)]
#![feature(pointer_methods)]
#![feature(inclusive_range_methods)]
#![feature(rustc_const_unstable)]
#![feature(const_vec_new)]
#![cfg_attr(not(test), feature(fn_traits, i128))]
#![cfg_attr(test, feature(test))]
// Allow testing this library
#[cfg(test)]

View File

@ -16,11 +16,8 @@
#![feature(drain_filter)]
#![feature(exact_size_is_empty)]
#![feature(pattern)]
#![feature(rand)]
#![feature(slice_sort_by_cached_key)]
#![feature(splice)]
#![feature(str_escape)]
#![feature(string_retain)]
#![feature(try_reserve)]
#![feature(unboxed_closures)]
#![feature(exact_chunks)]

View File

@ -1050,8 +1050,6 @@ impl char {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = 'A';
/// let uppercase_g = 'G';
/// let a = 'a';
@ -1084,8 +1082,6 @@ impl char {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = 'A';
/// let uppercase_g = 'G';
/// let a = 'a';
@ -1118,8 +1114,6 @@ impl char {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = 'A';
/// let uppercase_g = 'G';
/// let a = 'a';
@ -1155,8 +1149,6 @@ impl char {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = 'A';
/// let uppercase_g = 'G';
/// let a = 'a';
@ -1189,8 +1181,6 @@ impl char {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = 'A';
/// let uppercase_g = 'G';
/// let a = 'a';
@ -1226,8 +1216,6 @@ impl char {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = 'A';
/// let uppercase_g = 'G';
/// let a = 'a';
@ -1264,8 +1252,6 @@ impl char {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = 'A';
/// let uppercase_g = 'G';
/// let a = 'a';
@ -1298,8 +1284,6 @@ impl char {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = 'A';
/// let uppercase_g = 'G';
/// let a = 'a';
@ -1349,8 +1333,6 @@ impl char {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = 'A';
/// let uppercase_g = 'G';
/// let a = 'a';
@ -1385,8 +1367,6 @@ impl char {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = 'A';
/// let uppercase_g = 'G';
/// let a = 'a';

View File

@ -82,7 +82,6 @@
#![feature(concat_idents)]
#![feature(const_fn)]
#![feature(const_int_ops)]
#![feature(core_float)]
#![feature(custom_attribute)]
#![feature(doc_cfg)]
#![feature(doc_spotlight)]
@ -102,8 +101,6 @@
#![feature(rustc_attrs)]
#![feature(rustc_const_unstable)]
#![feature(simd_ffi)]
#![feature(core_slice_ext)]
#![feature(core_str_ext)]
#![feature(specialization)]
#![feature(staged_api)]
#![feature(stmt_expr_attributes)]
@ -111,7 +108,6 @@
#![feature(untagged_unions)]
#![feature(unwind_attributes)]
#![feature(doc_alias)]
#![feature(inclusive_range_methods)]
#![feature(mmx_target_feature)]
#![feature(tbm_target_feature)]
#![feature(sse4a_target_feature)]

View File

@ -3761,8 +3761,6 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
@ -3799,8 +3797,6 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
@ -3837,8 +3833,6 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
@ -3878,8 +3872,6 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
@ -3916,8 +3908,6 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
@ -3957,8 +3947,6 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
@ -3999,8 +3987,6 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
@ -4037,8 +4023,6 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
@ -4092,8 +4076,6 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
@ -4132,8 +4114,6 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';

View File

@ -2007,7 +2007,7 @@ pub trait SliceIndex<T: ?Sized>: private_slice_index::Sealed {
fn index_mut(self, slice: &mut T) -> &mut Self::Output;
}
#[stable(feature = "slice-get-slice-impls", since = "1.15.0")]
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
impl<T> SliceIndex<[T]> for usize {
type Output = T;
@ -2056,7 +2056,7 @@ impl<T> SliceIndex<[T]> for usize {
}
}
#[stable(feature = "slice-get-slice-impls", since = "1.15.0")]
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
impl<T> SliceIndex<[T]> for ops::Range<usize> {
type Output = [T];
@ -2117,7 +2117,7 @@ impl<T> SliceIndex<[T]> for ops::Range<usize> {
}
}
#[stable(feature = "slice-get-slice-impls", since = "1.15.0")]
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
impl<T> SliceIndex<[T]> for ops::RangeTo<usize> {
type Output = [T];
@ -2152,7 +2152,7 @@ impl<T> SliceIndex<[T]> for ops::RangeTo<usize> {
}
}
#[stable(feature = "slice-get-slice-impls", since = "1.15.0")]
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
impl<T> SliceIndex<[T]> for ops::RangeFrom<usize> {
type Output = [T];
@ -2187,7 +2187,7 @@ impl<T> SliceIndex<[T]> for ops::RangeFrom<usize> {
}
}
#[stable(feature = "slice-get-slice-impls", since = "1.15.0")]
#[stable(feature = "slice_get_slice_impls", since = "1.15.0")]
impl<T> SliceIndex<[T]> for ops::RangeFull {
type Output = [T];

View File

@ -8,18 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(ascii_ctype)]
#![feature(box_syntax)]
#![feature(cell_update)]
#![feature(core_float)]
#![feature(core_private_bignum)]
#![feature(core_private_diy_float)]
#![feature(dec2flt)]
#![feature(decode_utf8)]
#![feature(euclidean_division)]
#![feature(exact_size_is_empty)]
#![feature(fixed_size_array)]
#![feature(float_internals)]
#![feature(flt2dec)]
#![feature(fmt_internals)]
#![feature(hashmap_internals)]
@ -29,7 +25,6 @@
#![feature(refcell_map_split)]
#![feature(refcell_replace_swap)]
#![feature(slice_patterns)]
#![feature(slice_rotate)]
#![feature(sort_internals)]
#![feature(specialization)]
#![feature(step_trait)]

View File

@ -39,7 +39,6 @@
#![feature(staged_api)]
#![feature(std_internals)]
#![feature(unwind_attributes)]
#![cfg_attr(target_env = "msvc", feature(raw))]
#![panic_runtime]
#![feature(panic_runtime)]

View File

@ -615,7 +615,9 @@ define_dep_nodes!( <'tcx>
[input] CrateName(CrateNum),
[] ItemChildren(DefId),
[] ExternModStmtCnum(DefId),
[input] GetLangItems,
[eval_always] GetLibFeatures,
[] DefinedLibFeatures(CrateNum),
[eval_always] GetLangItems,
[] DefinedLangItems(CrateNum),
[] MissingLangItems(CrateNum),
[] VisibleParentMap,

View File

@ -1918,6 +1918,30 @@ fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 {
```
"##,
E0635: r##"
The `#![feature]` attribute specified an unknown feature.
Erroneous code example:
```compile_fail,E0635
#![feature(nonexistent_rust_feature)] // error: unknown feature
```
"##,
E0636: r##"
A `#![feature]` attribute was declared multiple times.
Erroneous code example:
```compile_fail,E0636
#![allow(stable_features)]
#![feature(rust1)]
#![feature(rust1)] // error: the feature `rust1` has already been declared
```
"##,
E0644: r##"
A closure or generator was constructed that references its own type.
@ -2138,4 +2162,5 @@ register_diagnostics! {
E0708, // `async` non-`move` closures with arguments are not currently supported
E0709, // multiple different lifetimes used in arguments of `async fn`
E0710, // an unknown tool name found in scoped lint
E0711, // a feature has been declared with conflicting stability attributes
}

View File

@ -1072,6 +1072,11 @@ impl_stable_hash_for!(struct hir::def::Export {
span
});
impl_stable_hash_for!(struct ::middle::lib_features::LibFeatures {
stable,
unstable
});
impl<'a> HashStable<StableHashingContext<'a>> for ::middle::lang_items::LangItem {
fn hash_stable<W: StableHasherResult>(&self,
_: &mut StableHashingContext<'a>,

View File

@ -511,7 +511,7 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for feature_gate::Features {
hasher: &mut StableHasher<W>) {
// Unfortunately we cannot exhaustively list fields here, since the
// struct is macro generated.
self.declared_stable_lang_features.hash_stable(hcx, hasher);
self.declared_lang_features.hash_stable(hcx, hasher);
self.declared_lib_features.hash_stable(hcx, hasher);
self.walk_feature_fields(|feature_name, value| {

View File

@ -45,8 +45,6 @@
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(drain_filter)]
#![feature(from_ref)]
#![feature(fs_read_write)]
#![feature(iterator_find_map)]
#![cfg_attr(windows, feature(libc))]
#![feature(macro_vis_matcher)]
@ -72,7 +70,6 @@
#![feature(test)]
#![feature(in_band_lifetimes)]
#![feature(macro_at_most_once_rep)]
#![feature(inclusive_range_methods)]
#![feature(crate_in_paths)]
#![recursion_limit="512"]
@ -141,6 +138,7 @@ pub mod middle {
pub mod exported_symbols;
pub mod free_region;
pub mod intrinsicck;
pub mod lib_features;
pub mod lang_items;
pub mod liveness;
pub mod mem_categorization;

View File

@ -102,7 +102,7 @@ declare_lint! {
declare_lint! {
pub UNUSED_FEATURES,
Warn,
"unused or unknown features found in crate-level #[feature] directives"
"unused features found in crate-level #[feature] directives"
}
declare_lint! {

View File

@ -0,0 +1,178 @@
// Copyright 2018 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.
// Detecting lib features (i.e. features that are not lang features).
//
// These are declared using stability attributes (e.g. `#[stable (..)]`
// and `#[unstable (..)]`), but are not declared in one single location
// (unlike lang features), which means we need to collect them instead.
use ty::TyCtxt;
use syntax::symbol::Symbol;
use syntax::ast::{Attribute, MetaItem, MetaItemKind};
use syntax_pos::{Span, DUMMY_SP};
use hir;
use hir::itemlikevisit::ItemLikeVisitor;
use rustc_data_structures::fx::{FxHashSet, FxHashMap};
use errors::DiagnosticId;
pub struct LibFeatures {
// A map from feature to stabilisation version.
pub stable: FxHashMap<Symbol, Symbol>,
pub unstable: FxHashSet<Symbol>,
}
impl LibFeatures {
fn new() -> LibFeatures {
LibFeatures {
stable: FxHashMap(),
unstable: FxHashSet(),
}
}
pub fn to_vec(&self) -> Vec<(Symbol, Option<Symbol>)> {
let mut all_features: Vec<_> = self.stable.iter().map(|(f, s)| (*f, Some(*s)))
.chain(self.unstable.iter().map(|f| (*f, None)))
.collect();
all_features.sort_unstable_by_key(|f| f.0.as_str());
all_features
}
}
pub struct LibFeatureCollector<'a, 'tcx: 'a> {
tcx: TyCtxt<'a, 'tcx, 'tcx>,
lib_features: LibFeatures,
}
impl<'a, 'tcx> LibFeatureCollector<'a, 'tcx> {
fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> LibFeatureCollector<'a, 'tcx> {
LibFeatureCollector {
tcx,
lib_features: LibFeatures::new(),
}
}
fn extract(&self, attrs: &[Attribute]) -> Vec<(Symbol, Option<Symbol>, Span)> {
let stab_attrs = vec!["stable", "unstable", "rustc_const_unstable"];
let mut features = vec![];
for attr in attrs {
// Find a stability attribute (i.e. `#[stable (..)]`, `#[unstable (..)]`,
// `#[rustc_const_unstable (..)]`).
if let Some(stab_attr) = stab_attrs.iter().find(|stab_attr| {
attr.check_name(stab_attr)
}) {
let meta_item = attr.meta();
if let Some(MetaItem { node: MetaItemKind::List(ref metas), .. }) = meta_item {
let mut feature = None;
let mut since = None;
for meta in metas {
if let Some(mi) = meta.meta_item() {
// Find the `feature = ".."` meta-item.
match (&*mi.name().as_str(), mi.value_str()) {
("feature", val) => feature = val,
("since", val) => since = val,
_ => {}
}
}
}
if let Some(feature) = feature {
// This additional check for stability is to make sure we
// don't emit additional, irrelevant errors for malformed
// attributes.
if *stab_attr != "stable" || since.is_some() {
features.push((feature, since, attr.span));
}
}
// We need to iterate over the other attributes, because
// `rustc_const_unstable` is not mutually exclusive with
// the other stability attributes, so we can't just `break`
// here.
}
}
}
features
}
fn collect_feature(&mut self, feature: Symbol, since: Option<Symbol>, span: Span) {
let already_in_stable = self.lib_features.stable.contains_key(&feature);
let already_in_unstable = self.lib_features.unstable.contains(&feature);
match (since, already_in_stable, already_in_unstable) {
(Some(since), _, false) => {
if let Some(prev_since) = self.lib_features.stable.get(&feature) {
if *prev_since != since {
let msg = format!(
"feature `{}` is declared stable since {}, \
but was previously declared stable since {}",
feature,
since,
prev_since,
);
self.tcx.sess.struct_span_err_with_code(span, &msg,
DiagnosticId::Error("E0711".into())).emit();
return;
}
}
self.lib_features.stable.insert(feature, since);
}
(None, false, _) => {
self.lib_features.unstable.insert(feature);
}
(Some(_), _, true) | (None, true, _) => {
let msg = format!(
"feature `{}` is declared {}, but was previously declared {}",
feature,
if since.is_some() { "stable"} else { "unstable" },
if since.is_none() { "stable"} else { "unstable" },
);
self.tcx.sess.struct_span_err_with_code(span, &msg,
DiagnosticId::Error("E0711".into())).emit();
}
}
}
fn collect_from_attrs(&mut self, attrs: &[Attribute]) {
for (feature, stable, span) in self.extract(attrs) {
self.collect_feature(feature, stable, span);
}
}
}
impl<'a, 'v, 'tcx> ItemLikeVisitor<'v> for LibFeatureCollector<'a, 'tcx> {
fn visit_item(&mut self, item: &hir::Item) {
self.collect_from_attrs(&item.attrs);
}
fn visit_trait_item(&mut self, trait_item: &hir::TraitItem) {
self.collect_from_attrs(&trait_item.attrs);
}
fn visit_impl_item(&mut self, impl_item: &hir::ImplItem) {
self.collect_from_attrs(&impl_item.attrs);
}
}
pub fn collect<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> LibFeatures {
let mut collector = LibFeatureCollector::new(tcx);
for &cnum in tcx.crates().iter() {
for &(feature, since) in tcx.defined_lib_features(cnum).iter() {
collector.collect_feature(feature, since, DUMMY_SP);
}
}
collector.collect_from_attrs(&tcx.hir.krate().attrs);
tcx.hir.krate().visit_all_item_likes(&mut collector);
for exported_macro in &tcx.hir.krate().exported_macros {
collector.collect_from_attrs(&exported_macro.attrs);
}
collector.lib_features
}

View File

@ -18,12 +18,12 @@ use hir::def::Def;
use hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefId, LOCAL_CRATE};
use ty::{self, TyCtxt};
use middle::privacy::AccessLevels;
use session::DiagnosticMessageId;
use session::{DiagnosticMessageId, Session};
use syntax::symbol::Symbol;
use syntax_pos::{Span, MultiSpan};
use syntax::ast;
use syntax::ast::{NodeId, Attribute};
use syntax::feature_gate::{GateIssue, emit_feature_err, find_lang_feature_accepted_version};
use syntax::feature_gate::{GateIssue, emit_feature_err};
use syntax::attr::{self, Stability, Deprecation};
use util::nodemap::{FxHashSet, FxHashMap};
@ -813,37 +813,70 @@ pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
krate.visit_all_item_likes(&mut missing.as_deep_visitor());
}
let ref declared_lib_features = tcx.features().declared_lib_features;
let mut remaining_lib_features: FxHashMap<Symbol, Span>
= declared_lib_features.clone().into_iter().collect();
remaining_lib_features.remove(&Symbol::intern("proc_macro"));
for &(ref stable_lang_feature, span) in &tcx.features().declared_stable_lang_features {
let version = find_lang_feature_accepted_version(&stable_lang_feature.as_str())
.expect("unexpectedly couldn't find version feature was stabilized");
tcx.lint_node(lint::builtin::STABLE_FEATURES,
ast::CRATE_NODE_ID,
span,
&format_stable_since_msg(version));
let declared_lang_features = &tcx.features().declared_lang_features;
let mut lang_features = FxHashSet();
for &(feature, span, since) in declared_lang_features {
if let Some(since) = since {
// Warn if the user has enabled an already-stable lang feature.
unnecessary_stable_feature_lint(tcx, span, feature, since);
}
if lang_features.contains(&feature) {
// Warn if the user enables a lang feature multiple times.
duplicate_feature_err(tcx.sess, span, feature);
}
lang_features.insert(feature);
}
// FIXME(#44232) the `used_features` table no longer exists, so we don't
// lint about unknown or unused features. We should reenable
// this one day!
//
// let index = tcx.stability();
// for (used_lib_feature, level) in &index.used_features {
// remaining_lib_features.remove(used_lib_feature);
// }
//
// for &span in remaining_lib_features.values() {
// tcx.lint_node(lint::builtin::UNUSED_FEATURES,
// ast::CRATE_NODE_ID,
// span,
// "unused or unknown feature");
// }
let declared_lib_features = &tcx.features().declared_lib_features;
let mut remaining_lib_features = FxHashMap();
for (feature, span) in declared_lib_features {
if remaining_lib_features.contains_key(&feature) {
// Warn if the user enables a lib feature multiple times.
duplicate_feature_err(tcx.sess, *span, *feature);
}
remaining_lib_features.insert(feature, span.clone());
}
// `stdbuild` has special handling for `libc`, so we need to
// recognise the feature when building std.
// Likewise, libtest is handled specially, so `test` isn't
// available as we'd like it to be.
// FIXME: only remove `libc` when `stdbuild` is active.
// FIXME: remove special casing for `test`.
remaining_lib_features.remove(&Symbol::intern("libc"));
remaining_lib_features.remove(&Symbol::intern("test"));
for (feature, stable) in tcx.lib_features().to_vec() {
if let Some(since) = stable {
if let Some(span) = remaining_lib_features.get(&feature) {
// Warn if the user has enabled an already-stable lib feature.
unnecessary_stable_feature_lint(tcx, *span, feature, since);
}
}
remaining_lib_features.remove(&feature);
}
for (feature, span) in remaining_lib_features {
struct_span_err!(tcx.sess, span, E0635, "unknown feature `{}`", feature).emit();
}
// FIXME(#44232): the `used_features` table no longer exists, so we
// don't lint about unused features. We should reenable this one day!
}
fn format_stable_since_msg(version: &str) -> String {
format!("this feature has been stable since {}. Attribute no longer needed", version)
fn unnecessary_stable_feature_lint<'a, 'tcx>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
span: Span,
feature: Symbol,
since: Symbol
) {
tcx.lint_node(lint::builtin::STABLE_FEATURES,
ast::CRATE_NODE_ID,
span,
&format!("the feature `{}` has been stable since {} and no longer requires \
an attribute to enable", feature, since));
}
fn duplicate_feature_err(sess: &Session, span: Span, feature: Symbol) {
struct_span_err!(sess, span, E0636, "the feature `{}` has already been declared", feature)
.emit();
}

View File

@ -1192,6 +1192,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
self.sess.consider_optimizing(&cname, msg)
}
pub fn lib_features(self) -> Lrc<middle::lib_features::LibFeatures> {
self.get_lib_features(LOCAL_CRATE)
}
pub fn lang_items(self) -> Lrc<middle::lang_items::LanguageItems> {
self.get_lang_items(LOCAL_CRATE)
}
@ -2840,17 +2844,13 @@ pub fn provide(providers: &mut ty::query::Providers) {
assert_eq!(id, LOCAL_CRATE);
tcx.crate_name
};
providers.get_lib_features = |tcx, id| {
assert_eq!(id, LOCAL_CRATE);
Lrc::new(middle::lib_features::collect(tcx))
};
providers.get_lang_items = |tcx, id| {
assert_eq!(id, LOCAL_CRATE);
// FIXME(#42293) Right now we insert a `with_ignore` node in the dep
// graph here to ignore the fact that `get_lang_items` below depends on
// the entire crate. For now this'll prevent false positives of
// recompiling too much when anything changes.
//
// Once red/green incremental compilation lands we should be able to
// remove this because while the crate changes often the lint level map
// will change rarely.
tcx.dep_graph.with_ignore(|| Lrc::new(middle::lang_items::collect(tcx)))
Lrc::new(middle::lang_items::collect(tcx))
};
providers.freevars = |tcx, id| tcx.gcx.freevars.get(&id).cloned();
providers.maybe_unused_trait_import = |tcx, id| {

View File

@ -626,6 +626,18 @@ impl<'tcx> QueryDescription<'tcx> for queries::crate_name<'tcx> {
}
}
impl<'tcx> QueryDescription<'tcx> for queries::get_lib_features<'tcx> {
fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
format!("calculating the lib features map")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::defined_lib_features<'tcx> {
fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
format!("calculating the lib features defined in a crate")
}
}
impl<'tcx> QueryDescription<'tcx> for queries::get_lang_items<'tcx> {
fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
"calculating the lang items map".to_string()

View File

@ -24,6 +24,7 @@ use middle::reachable::ReachableSet;
use middle::region;
use middle::resolve_lifetime::{ResolveLifetimes, Region, ObjectLifetimeDefault};
use middle::stability::{self, DeprecationEntry};
use middle::lib_features::LibFeatures;
use middle::lang_items::{LanguageItems, LangItem};
use middle::exported_symbols::{SymbolExportLevel, ExportedSymbol};
use mir::interpret::ConstEvalResult;
@ -492,6 +493,9 @@ define_queries! { <'tcx>
[] fn item_children: ItemChildren(DefId) -> Lrc<Vec<Export>>,
[] fn extern_mod_stmt_cnum: ExternModStmtCnum(DefId) -> Option<CrateNum>,
[] fn get_lib_features: get_lib_features_node(CrateNum) -> Lrc<LibFeatures>,
[] fn defined_lib_features: DefinedLibFeatures(CrateNum)
-> Lrc<Vec<(Symbol, Option<Symbol>)>>,
[] fn get_lang_items: get_lang_items_node(CrateNum) -> Lrc<LanguageItems>,
[] fn defined_lang_items: DefinedLangItems(CrateNum) -> Lrc<Vec<(DefId, usize)>>,
[] fn missing_lang_items: MissingLangItems(CrateNum) -> Lrc<Vec<LangItem>>,
@ -800,6 +804,10 @@ fn link_args_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
DepConstructor::LinkArgs
}
fn get_lib_features_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
DepConstructor::GetLibFeatures
}
fn get_lang_items_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> {
DepConstructor::GetLangItems
}

View File

@ -1218,6 +1218,8 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
DepKind::CrateName => { force!(crate_name, krate!()); }
DepKind::ItemChildren => { force!(item_children, def_id!()); }
DepKind::ExternModStmtCnum => { force!(extern_mod_stmt_cnum, def_id!()); }
DepKind::GetLibFeatures => { force!(get_lib_features, LOCAL_CRATE); }
DepKind::DefinedLibFeatures => { force!(defined_lib_features, krate!()); }
DepKind::GetLangItems => { force!(get_lang_items, LOCAL_CRATE); }
DepKind::DefinedLangItems => { force!(defined_lang_items, krate!()); }
DepKind::MissingLangItems => { force!(missing_lang_items, krate!()); }

View File

@ -14,7 +14,6 @@
#![allow(non_camel_case_types)]
#![feature(from_ref)]
#![feature(quote)]
#![recursion_limit="256"]

View File

@ -23,7 +23,6 @@
#![feature(crate_visibility_modifier)]
#![feature(custom_attribute)]
#![feature(extern_types)]
#![feature(fs_read_write)]
#![feature(in_band_lifetimes)]
#![allow(unused_attributes)]
#![feature(libc)]

View File

@ -20,7 +20,6 @@
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(collections_range)]
#![feature(unboxed_closures)]
#![feature(fn_traits)]
#![feature(unsize)]

View File

@ -14,7 +14,6 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(fs_read_write)]
#![feature(specialization)]
#![recursion_limit="256"]

View File

@ -342,7 +342,7 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
store.register_renamed("bare_trait_object", "bare_trait_objects");
store.register_renamed("unstable_name_collision", "unstable_name_collisions");
store.register_renamed("unused_doc_comment", "unused_doc_comments");
store.register_renamed("unknown_features", "unused_features");
store.register_removed("unknown_features", "replaced by an error");
store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate");
store.register_removed("negate_unsigned", "cast a signed value instead");
store.register_removed("raw_pointer_derive", "using derive with raw pointers is ok");

View File

@ -240,6 +240,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
cdata.each_child_of_item(def_id.index, |child| result.push(child), tcx.sess);
Lrc::new(result)
}
defined_lib_features => { Lrc::new(cdata.get_lib_features()) }
defined_lang_items => { Lrc::new(cdata.get_lang_items()) }
missing_lang_items => { Lrc::new(cdata.get_missing_lang_items()) }

View File

@ -645,6 +645,14 @@ impl<'a, 'tcx> CrateMetadata {
self.get_impl_data(id).trait_ref.map(|tr| tr.decode((self, tcx)))
}
/// Iterates over all the stability attributes in the given crate.
pub fn get_lib_features(&self) -> Vec<(ast::Name, Option<ast::Name>)> {
self.root
.lib_features
.decode(self)
.collect()
}
/// Iterates over the language items in the given crate.
pub fn get_lang_items(&self) -> Vec<(DefId, usize)> {
self.root

View File

@ -394,6 +394,11 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
());
let dep_bytes = self.position() - i;
// Encode the lib features.
i = self.position();
let lib_features = self.tracked(IsolatedEncoder::encode_lib_features, ());
let lib_feature_bytes = self.position() - i;
// Encode the language items.
i = self.position();
let lang_items = self.tracked(IsolatedEncoder::encode_lang_items, ());
@ -513,6 +518,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
crate_deps,
dylib_dependency_formats,
lib_features,
lang_items,
lang_items_missing,
native_libraries,
@ -537,6 +543,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
println!("metadata stats:");
println!(" dep bytes: {}", dep_bytes);
println!(" lib feature bytes: {}", lib_feature_bytes);
println!(" lang item bytes: {}", lang_item_bytes);
println!(" native bytes: {}", native_lib_bytes);
println!(" codemap bytes: {}", codemap_bytes);
@ -1456,6 +1463,12 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
self.lazy_seq_ref(deps.iter().map(|&(_, ref dep)| dep))
}
fn encode_lib_features(&mut self, _: ()) -> LazySeq<(ast::Name, Option<ast::Name>)> {
let tcx = self.tcx;
let lib_features = tcx.lib_features();
self.lazy_seq(lib_features.to_vec())
}
fn encode_lang_items(&mut self, _: ()) -> LazySeq<(DefIndex, usize)> {
let tcx = self.tcx;
let lang_items = tcx.lang_items();

View File

@ -13,7 +13,6 @@
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(box_patterns)]
#![feature(fs_read_write)]
#![feature(libc)]
#![feature(macro_at_most_once_rep)]
#![feature(proc_macro_internals)]

View File

@ -198,6 +198,7 @@ pub struct CrateRoot {
pub crate_deps: LazySeq<CrateDep>,
pub dylib_dependency_formats: LazySeq<Option<LinkagePreference>>,
pub lib_features: LazySeq<(Symbol, Option<Symbol>)>,
pub lang_items: LazySeq<(DefIndex, usize)>,
pub lang_items_missing: LazySeq<lang_items::LangItem>,
pub native_libraries: LazySeq<NativeLibrary>,

View File

@ -18,7 +18,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![feature(in_band_lifetimes)]
#![feature(slice_patterns)]
#![feature(slice_sort_by_cached_key)]
#![feature(from_ref)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(catch_expr)]
@ -26,13 +25,10 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(decl_macro)]
#![feature(fs_read_write)]
#![feature(in_band_lifetimes)]
#![feature(macro_vis_matcher)]
#![feature(exhaustive_patterns)]
#![feature(range_contains)]
#![feature(rustc_diagnostic_macros)]
#![feature(crate_visibility_modifier)]
#![feature(never_type)]
#![feature(specialization)]
#![feature(try_trait)]

View File

@ -23,8 +23,6 @@
#![feature(box_syntax)]
#![feature(const_fn)]
#![feature(fs_read_write)]
#![feature(inclusive_range)]
#![feature(slice_patterns)]
#[macro_use]

View File

@ -74,7 +74,6 @@ This API is completely unstable and subject to change.
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(crate_visibility_modifier)]
#![feature(from_ref)]
#![feature(exhaustive_patterns)]
#![feature(iterator_find_map)]
#![feature(quote)]

View File

@ -13,17 +13,14 @@
html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/")]
#![feature(ascii_ctype)]
#![feature(rustc_private)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(fs_read_write)]
#![feature(iterator_find_map)]
#![feature(set_stdio)]
#![feature(slice_sort_by_cached_key)]
#![feature(test)]
#![feature(vec_remove_item)]
#![feature(entry_and_modify)]
#![feature(ptr_offset_from)]
#![feature(crate_visibility_modifier)]
#![feature(const_fn)]

View File

@ -232,6 +232,7 @@
// std is implemented with unstable features, many of which are internal
// compiler details that will never be stable
#![cfg_attr(test, feature(test, update_panic_count))]
#![feature(alloc)]
#![feature(alloc_error_handler)]
#![feature(alloc_system)]
@ -242,7 +243,6 @@
#![feature(align_offset)]
#![feature(arbitrary_self_types)]
#![feature(array_error_internals)]
#![feature(ascii_ctype)]
#![feature(asm)]
#![feature(attr_literals)]
#![feature(box_syntax)]
@ -250,17 +250,13 @@
#![feature(cfg_target_thread_local)]
#![feature(cfg_target_vendor)]
#![feature(char_error_internals)]
#![feature(char_internals)]
#![feature(collections_range)]
#![feature(compiler_builtins_lib)]
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(dropck_eyepatch)]
#![feature(exact_size_is_empty)]
#![feature(external_doc)]
#![feature(fs_read_write)]
#![feature(fixed_size_array)]
#![feature(float_from_str_radix)]
#![feature(fn_traits)]
#![feature(fnbox)]
#![feature(futures_api)]
@ -268,7 +264,6 @@
#![feature(hashmap_internals)]
#![feature(int_error_internals)]
#![feature(integer_atomics)]
#![feature(into_cow)]
#![feature(lang_items)]
#![feature(libc)]
#![feature(link_args)]
@ -277,34 +272,25 @@
#![feature(needs_panic_runtime)]
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(num_bits_bytes)]
#![feature(old_wrapping)]
#![feature(on_unimplemented)]
#![feature(oom)]
#![feature(optin_builtin_traits)]
#![feature(panic_internals)]
#![feature(panic_unwind)]
#![feature(peek)]
#![feature(pin)]
#![feature(placement_new_protocol)]
#![feature(prelude_import)]
#![feature(ptr_internals)]
#![feature(rand)]
#![feature(raw)]
#![feature(rustc_attrs)]
#![feature(std_internals)]
#![feature(stdsimd)]
#![feature(shrink_to)]
#![feature(slice_bytes)]
#![feature(slice_concat_ext)]
#![feature(slice_internals)]
#![feature(slice_patterns)]
#![feature(staged_api)]
#![feature(stmt_expr_attributes)]
#![feature(str_char)]
#![feature(str_internals)]
#![feature(str_utf16)]
#![feature(test, rustc_private)]
#![feature(rustc_private)]
#![feature(thread_local)]
#![feature(toowned_clone_into)]
#![feature(try_from)]
@ -313,15 +299,12 @@
#![feature(untagged_unions)]
#![feature(unwind_attributes)]
#![feature(use_extern_macros)]
#![feature(vec_push_all)]
#![feature(doc_cfg)]
#![feature(doc_masked)]
#![feature(doc_spotlight)]
#![cfg_attr(test, feature(update_panic_count))]
#![cfg_attr(windows, feature(used))]
#![feature(doc_alias)]
#![feature(doc_keyword)]
#![feature(float_internals)]
#![feature(panic_info_message)]
#![feature(panic_implementation)]

View File

@ -374,6 +374,20 @@ and likely to change in the future.
"##,
E0705: r##"
A `#![feature]` attribute was declared for a feature that is stable in
the current edition.
Erroneous code example:
```ignore (limited to a warning during 2018 edition development)
#![feature(rust_2018_preview)]
#![feature(raw_identifiers)] // error: the feature `raw_identifiers` is
// included in the Rust 2018 edition
```
"##,
}
register_diagnostics! {

View File

@ -25,6 +25,7 @@
use self::AttributeType::*;
use self::AttributeGate::*;
use rustc_data_structures::fx::FxHashMap;
use rustc_target::spec::abi::Abi;
use ast::{self, NodeId, PatKind, RangeEnd};
use attr;
@ -59,8 +60,8 @@ macro_rules! declare_features {
/// A set of features to be used by later passes.
#[derive(Clone)]
pub struct Features {
/// `#![feature]` attrs for stable language features, for error reporting
pub declared_stable_lang_features: Vec<(Symbol, Span)>,
/// `#![feature]` attrs for language features, for error reporting
pub declared_lang_features: Vec<(Symbol, Span, Option<Symbol>)>,
/// `#![feature]` attrs for non-language (library) features
pub declared_lib_features: Vec<(Symbol, Span)>,
$(pub $feature: bool),+
@ -69,7 +70,7 @@ macro_rules! declare_features {
impl Features {
pub fn new() -> Features {
Features {
declared_stable_lang_features: Vec::new(),
declared_lang_features: Vec::new(),
declared_lib_features: Vec::new(),
$($feature: false),+
}
@ -140,7 +141,6 @@ declare_features! (
(active, linkage, "1.0.0", Some(29603), None),
(active, quote, "1.0.0", Some(29601), None),
// rustc internal
(active, rustc_diagnostic_macros, "1.0.0", None, None),
(active, rustc_const_unstable, "1.0.0", None, None),
@ -322,7 +322,6 @@ declare_features! (
// `extern "x86-interrupt" fn()`
(active, abi_x86_interrupt, "1.17.0", Some(40180), None),
// Allows the `catch {...}` expression
(active, catch_expr, "1.17.0", Some(31436), Some(Edition::Edition2018)),
@ -1220,10 +1219,6 @@ pub fn check_attribute(attr: &ast::Attribute, parse_sess: &ParseSess, features:
cx.check_attribute(attr, true);
}
pub fn find_lang_feature_accepted_version(feature: &str) -> Option<&'static str> {
ACCEPTED_FEATURES.iter().find(|t| t.0 == feature).map(|t| t.1)
}
fn find_lang_feature_issue(feature: &str) -> Option<u32> {
if let Some(info) = ACTIVE_FEATURES.iter().find(|t| t.0 == feature) {
let issue = info.2;
@ -1906,10 +1901,13 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
let mut feature_checker = FeatureChecker::default();
for &(.., f_edition, set) in ACTIVE_FEATURES.iter() {
let mut edition_enabled_features = FxHashMap();
for &(name, .., f_edition, set) in ACTIVE_FEATURES.iter() {
if let Some(f_edition) = f_edition {
if f_edition <= crate_edition {
set(&mut features, DUMMY_SP);
edition_enabled_features.insert(Symbol::intern(name), crate_edition);
}
}
}
@ -1937,9 +1935,40 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
continue
};
if let Some(edition) = ALL_EDITIONS.iter().find(|e| name == e.feature_name()) {
if *edition <= crate_edition {
continue
}
for &(name, .., f_edition, set) in ACTIVE_FEATURES.iter() {
if let Some(f_edition) = f_edition {
if f_edition <= *edition {
// FIXME(Manishearth) there is currently no way to set
// lib features by edition
set(&mut features, DUMMY_SP);
edition_enabled_features.insert(Symbol::intern(name), *edition);
}
}
}
continue
}
if let Some((.., set)) = ACTIVE_FEATURES.iter().find(|f| name == f.0) {
set(&mut features, mi.span);
feature_checker.collect(&features, mi.span);
if let Some(edition) = edition_enabled_features.get(&name) {
struct_span_warn!(
span_handler,
mi.span,
E0705,
"the feature `{}` is included in the Rust {} edition",
name,
edition,
).emit();
} else {
set(&mut features, mi.span);
feature_checker.collect(&features, mi.span);
features.declared_lang_features.push((name, mi.span, None));
}
continue
}
@ -1950,26 +1979,9 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
continue
}
if ACCEPTED_FEATURES.iter().any(|f| name == f.0) {
features.declared_stable_lang_features.push((name, mi.span));
continue
}
if let Some(edition) = ALL_EDITIONS.iter().find(|e| name == e.feature_name()) {
if *edition <= crate_edition {
continue
}
for &(.., f_edition, set) in ACTIVE_FEATURES.iter() {
if let Some(f_edition) = f_edition {
if *edition >= f_edition {
// FIXME(Manishearth) there is currently no way to set
// lib features by edition
set(&mut features, DUMMY_SP);
}
}
}
if let Some((_, since, ..)) = ACCEPTED_FEATURES.iter().find(|f| name == f.0) {
let since = Some(Symbol::intern(since));
features.declared_lang_features.push((name, mi.span, since));
continue
}

View File

@ -19,7 +19,6 @@
html_root_url = "https://doc.rust-lang.org/nightly/",
test(attr(deny(warnings))))]
#![feature(const_atomic_usize_new)]
#![feature(crate_visibility_modifier)]
#![feature(macro_at_most_once_rep)]
#![feature(rustc_attrs)]

View File

@ -36,16 +36,16 @@
#![feature(staged_api)]
#![stable(feature = "unit_test", since = "0.0.0")]
#![stable(feature = "unit_test", since = "1.0.0")]
#[stable(feature = "unit_test", since = "0.0.0")]
#[stable(feature = "unit_test", since = "1.0.0")]
pub use m::{Record, Trait, Tuple};
mod m {
#[derive(Default)]
#[stable(feature = "unit_test", since = "0.0.0")]
#[stable(feature = "unit_test", since = "1.0.0")]
pub struct Record {
#[stable(feature = "unit_test", since = "0.0.0")]
#[stable(feature = "unit_test", since = "1.0.0")]
pub a_stable_pub: i32,
#[unstable(feature = "unstable_declared", issue = "38412")]
pub a_unstable_declared_pub: i32,
@ -55,14 +55,14 @@ mod m {
pub(crate) b_crate: i32,
#[unstable(feature = "unstable_declared", issue = "38412")] // SILLY
pub(in m) c_mod: i32,
#[stable(feature = "unit_test", since = "0.0.0")] // SILLY
#[stable(feature = "unit_test", since = "1.0.0")] // SILLY
d_priv: i32
}
#[derive(Default)]
#[stable(feature = "unit_test", since = "1.0.0")]
pub struct Tuple(
#[stable(feature = "unit_test", since = "0.0.0")]
#[stable(feature = "unit_test", since = "1.0.0")]
pub i32,
#[unstable(feature = "unstable_declared", issue = "38412")]
pub i32,
@ -84,11 +84,11 @@ mod m {
}
#[stable(feature = "unit_test", since = "0.0.0")]
#[stable(feature = "unit_test", since = "1.0.0")]
pub trait Trait {
#[stable(feature = "unit_test", since = "0.0.0")]
#[stable(feature = "unit_test", since = "1.0.0")]
type Type;
#[stable(feature = "unit_test", since = "0.0.0")]
#[stable(feature = "unit_test", since = "1.0.0")]
fn stable_trait_method(&self) -> Self::Type;
#[unstable(feature = "unstable_undeclared", issue = "38412")]
fn unstable_undeclared_trait_method(&self) -> Self::Type;
@ -96,7 +96,7 @@ mod m {
fn unstable_declared_trait_method(&self) -> Self::Type;
}
#[stable(feature = "unit_test", since = "0.0.0")]
#[stable(feature = "unit_test", since = "1.0.0")]
impl Trait for Record {
type Type = i32;
fn stable_trait_method(&self) -> i32 { self.d_priv }
@ -104,7 +104,7 @@ mod m {
fn unstable_declared_trait_method(&self) -> i32 { self.d_priv }
}
#[stable(feature = "unit_test", since = "0.0.0")]
#[stable(feature = "unit_test", since = "1.0.0")]
impl Trait for Tuple {
type Type = i32;
fn stable_trait_method(&self) -> i32 { self.3 }
@ -117,14 +117,14 @@ mod m {
pub fn unstable_undeclared(&self) -> i32 { self.d_priv }
#[unstable(feature = "unstable_declared", issue = "38412")]
pub fn unstable_declared(&self) -> i32 { self.d_priv }
#[stable(feature = "unit_test", since = "0.0.0")]
#[stable(feature = "unit_test", since = "1.0.0")]
pub fn stable(&self) -> i32 { self.d_priv }
#[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY
pub(crate) fn pub_crate(&self) -> i32 { self.d_priv }
#[unstable(feature = "unstable_declared", issue = "38412")] // SILLY
pub(in m) fn pub_mod(&self) -> i32 { self.d_priv }
#[stable(feature = "unit_test", since = "0.0.0")] // SILLY
#[stable(feature = "unit_test", since = "1.0.0")] // SILLY
fn private(&self) -> i32 { self.d_priv }
}
@ -133,7 +133,7 @@ mod m {
pub fn unstable_undeclared(&self) -> i32 { self.0 }
#[unstable(feature = "unstable_declared", issue = "38412")]
pub fn unstable_declared(&self) -> i32 { self.0 }
#[stable(feature = "unit_test", since = "0.0.0")]
#[stable(feature = "unit_test", since = "1.0.0")]
pub fn stable(&self) -> i32 { self.0 }
pub(crate) fn pub_crate(&self) -> i32 { self.0 }

View File

@ -9,7 +9,7 @@
// except according to those terms.
#![crate_name="inherited_stability"]
#![crate_type = "lib"]
#![unstable(feature = "test_feature", issue = "0")]
#![unstable(feature = "unstable_test_feature", issue = "0")]
#![feature(staged_api)]
pub fn unstable() {}
@ -19,16 +19,16 @@ pub fn stable() {}
#[stable(feature = "rust1", since = "1.0.0")]
pub mod stable_mod {
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub fn unstable() {}
#[stable(feature = "rust1", since = "1.0.0")]
pub fn stable() {}
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub mod unstable_mod {
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn deprecated() {}
@ -37,7 +37,7 @@ pub mod unstable_mod {
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Stable {
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
fn unstable(&self);
#[stable(feature = "rust1", since = "1.0.0")]

View File

@ -11,20 +11,20 @@
#![crate_name="lint_output_format"]
#![crate_type = "lib"]
#![feature(staged_api)]
#![unstable(feature = "test_feature", issue = "0")]
#![unstable(feature = "unstable_test_feature", issue = "0")]
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn foo() -> usize {
20
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub fn bar() -> usize {
40
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub fn baz() -> usize {
30
}

View File

@ -14,27 +14,27 @@
#![feature(associated_type_defaults)]
#![stable(feature = "lint_stability", since = "1.0.0")]
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn deprecated() {}
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn deprecated_text() {}
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "99.99.99", reason = "text")]
pub fn deprecated_future() {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn deprecated_unstable() {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn deprecated_unstable_text() {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub fn unstable() {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
pub fn unstable_text() {}
#[stable(feature = "rust1", since = "1.0.0")]
@ -46,23 +46,23 @@ pub fn stable_text() {}
pub struct MethodTester;
impl MethodTester {
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn method_deprecated(&self) {}
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn method_deprecated_text(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn method_deprecated_unstable(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn method_deprecated_unstable_text(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub fn method_unstable(&self) {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
pub fn method_unstable_text(&self) {}
#[stable(feature = "rust1", since = "1.0.0")]
@ -71,25 +71,25 @@ impl MethodTester {
pub fn method_stable_text(&self) {}
}
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
pub trait Trait {
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn trait_deprecated(&self) {}
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn trait_deprecated_text(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn trait_deprecated_unstable(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn trait_deprecated_unstable_text(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
fn trait_unstable(&self) {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
fn trait_unstable_text(&self) {}
#[stable(feature = "rust1", since = "1.0.0")]
@ -98,100 +98,100 @@ pub trait Trait {
fn trait_stable_text(&self) {}
}
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
pub trait TraitWithAssociatedTypes {
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
type TypeUnstable = u8;
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
type TypeDeprecated = u8;
}
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
impl Trait for MethodTester {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub trait UnstableTrait { fn dummy(&self) { } }
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub trait DeprecatedTrait {
#[stable(feature = "test_feature", since = "1.0.0")] fn dummy(&self) { }
#[stable(feature = "stable_test_feature", since = "1.0.0")] fn dummy(&self) { }
}
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedStruct {
#[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
#[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedUnstableStruct {
#[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
#[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub struct UnstableStruct {
#[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
#[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
}
#[stable(feature = "rust1", since = "1.0.0")]
pub struct StableStruct {
#[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
#[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub enum UnstableEnum {}
#[stable(feature = "rust1", since = "1.0.0")]
pub enum StableEnum {}
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedUnitStruct;
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedUnstableUnitStruct;
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub struct UnstableUnitStruct;
#[stable(feature = "rust1", since = "1.0.0")]
pub struct StableUnitStruct;
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
pub enum Enum {
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
DeprecatedVariant,
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
DeprecatedUnstableVariant,
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
UnstableVariant,
#[stable(feature = "rust1", since = "1.0.0")]
StableVariant,
}
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedUnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub struct UnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
#[stable(feature = "rust1", since = "1.0.0")]
pub struct StableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[macro_export]
macro_rules! macro_test {
() => (deprecated());
}
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[macro_export]
macro_rules! macro_test_arg {
($func:expr) => ($func);
}
#[stable(feature = "test_feature", since = "1.0.0")]
#[stable(feature = "stable_test_feature", since = "1.0.0")]
#[macro_export]
macro_rules! macro_test_arg_nested {
($func:ident) => (macro_test_arg!($func()));

View File

@ -15,47 +15,47 @@
pub struct Stable {
#[stable(feature = "rust1", since = "1.0.0")]
pub inherit: u8, // it's a lie (stable doesn't inherit)
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub override1: u8,
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub override2: u8,
}
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Stable2(#[stable(feature = "rust1", since = "1.0.0")] pub u8,
#[unstable(feature = "test_feature", issue = "0")] pub u8,
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")] pub u8,
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")] pub u8);
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub struct Unstable {
pub inherit: u8,
#[stable(feature = "rust1", since = "1.0.0")]
pub override1: u8,
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub override2: u8,
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub struct Unstable2(pub u8,
#[stable(feature = "rust1", since = "1.0.0")] pub u8,
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")] pub u8);
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct Deprecated {
pub inherit: u8,
#[stable(feature = "rust1", since = "1.0.0")]
pub override1: u8,
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub override2: u8,
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct Deprecated2(pub u8,
#[stable(feature = "rust1", since = "1.0.0")] pub u8,
#[unstable(feature = "test_feature", issue = "0")] pub u8);
#[unstable(feature = "unstable_test_feature", issue = "0")] pub u8);

View File

@ -9,11 +9,11 @@
// except according to those terms.
#![feature(staged_api)]
#![stable(feature = "foo", since = "1.2.0")]
#![stable(feature = "stable_test_feature", since = "1.2.0")]
#[unstable(feature = "foo", issue = "1")]
#[unstable(feature = "unstable_test_feature", issue = "1")]
pub fn unstable() {}
#[unstable(feature = "foo", reason = "message", issue = "2")]
#[unstable(feature = "unstable_test_feature", reason = "message", issue = "2")]
pub fn unstable_msg() {}

View File

@ -10,6 +10,6 @@
// compile-flags:--cfg foo
#![cfg_attr(foo, unstable(feature = "test_feature", issue = "0"))]
#![cfg_attr(foo, unstable(feature = "unstable_test_feature", issue = "0"))]
#![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))]
#![feature(staged_api)]

View File

@ -9,7 +9,7 @@
// except according to those terms.
#![feature(staged_api)]
#![stable(feature = "unit_test", since = "0.0.0")]
#![stable(feature = "unit_test", since = "1.0.0")]
#[unstable(feature = "unstable_macros", issue = "0")]
#[macro_export]

View File

@ -12,7 +12,7 @@
#![feature(staged_api)]
#![stable(feature = "test_feature", since = "1.0.0")]
#![stable(feature = "stable_test_feature", since = "1.0.0")]
#[deprecated]
fn main() { } //~ERROR `#[deprecated]` cannot be used in staged api

View File

@ -12,7 +12,7 @@
// aux-build:stability_cfg2.rs
#![feature(test_feature)]
#![feature(unstable_test_feature)]
#![deny(non_snake_case)] // To trigger a hard error
// Shouldn't generate a warning about unstable features

View File

@ -16,7 +16,8 @@
extern crate lint_stability;
use lint_stability::{unstable, deprecated}; //~ ERROR use of unstable library feature 'test_feature'
use lint_stability::{unstable, deprecated};
//~^ ERROR use of unstable library feature 'unstable_test_feature'
fn main() {
}

View File

@ -14,7 +14,8 @@
extern crate lint_stability;
use lint_stability::UnstableEnum::{}; //~ ERROR use of unstable library feature 'test_feature'
use lint_stability::UnstableEnum::{};
//~^ ERROR use of unstable library feature 'unstable_test_feature'
use lint_stability::StableEnum::{}; // OK
fn main() {}

View File

@ -13,6 +13,6 @@
#![allow(renamed_and_removed_lints)]
#[deny(unknown_features)]
#[deny(single_use_lifetime)]
#[deny(unused)]
fn main() { let unused = (); } //~ ERROR unused

View File

@ -8,10 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags:-D unknown_features
// compile-flags:-D bare_trait_object
// error-pattern:lint `unknown_features` has been renamed to `unused_features`
// error-pattern:requested on the command line with `-D unknown_features`
// error-pattern:lint `bare_trait_object` has been renamed to `bare_trait_objects`
// error-pattern:requested on the command line with `-D bare_trait_object`
// error-pattern:unused
#[deny(unused)]

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[deny(unknown_features)] //~ WARN lint `unknown_features` has been renamed to `unused_features`
#[deny(bare_trait_object)]
//~^ WARN lint `bare_trait_object` has been renamed to `bare_trait_objects`
#[deny(unused)]
fn main() { let unused = (); } //~ ERROR unused

View File

@ -76,15 +76,15 @@ mod cross_crate {
<Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature
foo.method_unstable_text();
//~^ ERROR use of unstable library feature 'test_feature': text
//~^ ERROR use of unstable library feature 'unstable_test_feature': text
Foo::method_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
//~^ ERROR use of unstable library feature 'unstable_test_feature': text
<Foo>::method_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
//~^ ERROR use of unstable library feature 'unstable_test_feature': text
foo.trait_unstable_text();
//~^ ERROR use of unstable library feature 'test_feature': text
//~^ ERROR use of unstable library feature 'unstable_test_feature': text
<Foo>::trait_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
//~^ ERROR use of unstable library feature 'unstable_test_feature': text
stable();
foo.method_stable();
@ -149,9 +149,9 @@ mod cross_crate {
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
//~^ ERROR use of unstable library feature 'unstable_test_feature': text
<Foo>::trait_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
//~^ ERROR use of unstable library feature 'unstable_test_feature': text
foo.trait_stable();
Trait::trait_stable(&foo);
<Foo>::trait_stable(&foo);
@ -167,7 +167,7 @@ mod cross_crate {
//~^ 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
//~^ ERROR use of unstable library feature 'unstable_test_feature': text
foo.trait_stable();
}
@ -178,16 +178,16 @@ mod cross_crate {
}
mod this_crate {
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn deprecated() {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn deprecated_text() {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub fn unstable() {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
pub fn unstable_text() {}
#[stable(feature = "rust1", since = "1.0.0")]
@ -199,16 +199,16 @@ mod this_crate {
pub struct MethodTester;
impl MethodTester {
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn method_deprecated(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn method_deprecated_text(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub fn method_unstable(&self) {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
pub fn method_unstable_text(&self) {}
#[stable(feature = "rust1", since = "1.0.0")]
@ -218,16 +218,16 @@ mod this_crate {
}
pub trait Trait {
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn trait_deprecated(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn trait_deprecated_text(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
fn trait_unstable(&self) {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
fn trait_unstable_text(&self) {}
#[stable(feature = "rust1", since = "1.0.0")]
@ -238,43 +238,43 @@ mod this_crate {
impl Trait for MethodTester {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_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
#[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub struct UnstableStruct {
#[stable(feature = "test_feature", since = "1.0.0")] i: isize
#[stable(feature = "stable_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
#[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedUnitStruct;
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_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")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
DeprecatedVariant,
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
UnstableVariant,
#[stable(feature = "rust1", since = "1.0.0")]
StableVariant,
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedTupleStruct(isize);
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub struct UnstableTupleStruct(isize);
#[stable(feature = "rust1", since = "1.0.0")]
pub struct StableTupleStruct(isize);
@ -391,7 +391,7 @@ mod this_crate {
foo.trait_stable();
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn test_fn_body() {
fn fn_in_body() {}
@ -399,7 +399,7 @@ mod this_crate {
}
impl MethodTester {
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn test_method_body(&self) {
fn fn_in_body() {}
@ -407,7 +407,7 @@ mod this_crate {
}
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub trait DeprecatedTrait {
fn dummy(&self) { }

View File

@ -16,7 +16,7 @@
#![warn(deprecated)]
#![allow(dead_code, unused_extern_crates)]
#![feature(staged_api, test_feature, rustc_attrs)]
#![feature(staged_api, unstable_test_feature, rustc_attrs)]
#![stable(feature = "rust1", since = "1.0.0")]
@ -227,16 +227,16 @@ mod inheritance {
}
mod this_crate {
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn deprecated() {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn deprecated_text() {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub fn unstable() {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
pub fn unstable_text() {}
#[stable(feature = "rust1", since = "1.0.0")]
@ -248,16 +248,16 @@ mod this_crate {
pub struct MethodTester;
impl MethodTester {
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn method_deprecated(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn method_deprecated_text(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub fn method_unstable(&self) {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
pub fn method_unstable_text(&self) {}
#[stable(feature = "rust1", since = "1.0.0")]
@ -267,16 +267,16 @@ mod this_crate {
}
pub trait Trait {
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn trait_deprecated(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn trait_deprecated_text(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
fn trait_unstable(&self) {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
fn trait_unstable_text(&self) {}
#[stable(feature = "rust1", since = "1.0.0")]
@ -287,43 +287,43 @@ mod this_crate {
impl Trait for MethodTester {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_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
#[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub struct UnstableStruct {
#[stable(feature = "test_feature", since = "1.0.0")] i: isize
#[stable(feature = "stable_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
#[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedUnitStruct;
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_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")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
DeprecatedVariant,
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
UnstableVariant,
#[stable(feature = "rust1", since = "1.0.0")]
StableVariant,
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedTupleStruct(isize);
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub struct UnstableTupleStruct(isize);
#[stable(feature = "rust1", since = "1.0.0")]
pub struct StableTupleStruct(isize);
@ -441,7 +441,7 @@ mod this_crate {
foo.trait_stable();
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn test_fn_body() {
fn fn_in_body() {}
@ -449,7 +449,7 @@ mod this_crate {
}
impl MethodTester {
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn test_method_body(&self) {
fn fn_in_body() {}
@ -457,7 +457,7 @@ mod this_crate {
}
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub trait DeprecatedTrait {
fn dummy(&self) { }

View File

@ -9,9 +9,10 @@
// except according to those terms.
// aux-build:lint_stability_fields.rs
#![deny(deprecated)]
#![allow(dead_code)]
#![feature(staged_api, test_feature)]
#![feature(staged_api, unstable_test_feature)]
#![stable(feature = "rust1", since = "1.0.0")]
@ -162,50 +163,50 @@ mod this_crate {
#[stable(feature = "rust1", since = "1.0.0")]
struct Stable {
inherit: u8,
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
override1: u8,
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_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")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")] u8);
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_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")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
override2: u8,
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
struct Unstable2(u8,
#[stable(feature = "rust1", since = "1.0.0")] u8,
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")] u8);
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_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")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
override2: u8,
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_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);
#[unstable(feature = "unstable_test_feature", issue = "0")] u8);
pub fn foo() {
let x = Stable {

View File

@ -138,50 +138,50 @@ mod this_crate {
#[stable(feature = "rust1", since = "1.0.0")]
struct Stable {
inherit: u8,
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
override1: u8,
#[rustc_deprecated(since = "1.0.0", reason = "text")]
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_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")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")] u8);
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_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")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
override2: u8,
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
struct Unstable2(u8,
#[stable(feature = "rust1", since = "1.0.0")] u8,
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")] u8);
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_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")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
override2: u8,
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_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);
#[unstable(feature = "unstable_test_feature", issue = "0")] u8);
pub fn foo() {
let x = Stable {

View File

@ -71,11 +71,11 @@ mod cross_crate {
<Foo as Trait>::trait_unstable(&foo); //~ ERROR use of unstable library feature
unstable_text();
//~^ ERROR use of unstable library feature 'test_feature': text
//~^ ERROR use of unstable library feature 'unstable_test_feature': text
Trait::trait_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
//~^ ERROR use of unstable library feature 'unstable_test_feature': text
<Foo as Trait>::trait_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
//~^ ERROR use of unstable library feature 'unstable_test_feature': text
stable();
foo.method_stable();
@ -162,9 +162,9 @@ mod cross_crate {
Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature
<Foo as Trait>::trait_unstable(&foo); //~ ERROR use of unstable library feature
Trait::trait_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
//~^ ERROR use of unstable library feature 'unstable_test_feature': text
<Foo as Trait>::trait_unstable_text(&foo);
//~^ ERROR use of unstable library feature 'test_feature': text
//~^ ERROR use of unstable library feature 'unstable_test_feature': text
foo.trait_stable();
Trait::trait_stable(&foo);
<Foo>::trait_stable(&foo);
@ -213,10 +213,10 @@ mod inheritance {
}
mod this_crate {
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn deprecated() {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn deprecated_text() {}
@ -224,9 +224,9 @@ mod this_crate {
#[rustc_deprecated(since = "99.99.99", reason = "text")]
pub fn deprecated_future() {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub fn unstable() {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
pub fn unstable_text() {}
#[stable(feature = "rust1", since = "1.0.0")]
@ -238,16 +238,16 @@ mod this_crate {
pub struct MethodTester;
impl MethodTester {
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn method_deprecated(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub fn method_deprecated_text(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub fn method_unstable(&self) {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
pub fn method_unstable_text(&self) {}
#[stable(feature = "rust1", since = "1.0.0")]
@ -257,16 +257,16 @@ mod this_crate {
}
pub trait Trait {
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn trait_deprecated(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn trait_deprecated_text(&self) {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
fn trait_unstable(&self) {}
#[unstable(feature = "test_feature", reason = "text", issue = "0")]
#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")]
fn trait_unstable_text(&self) {}
#[stable(feature = "rust1", since = "1.0.0")]
@ -277,43 +277,43 @@ mod this_crate {
impl Trait for MethodTester {}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_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
#[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub struct UnstableStruct {
#[stable(feature = "test_feature", since = "1.0.0")] i: isize
#[stable(feature = "stable_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
#[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedUnitStruct;
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_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")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
DeprecatedVariant,
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
UnstableVariant,
#[stable(feature = "rust1", since = "1.0.0")]
StableVariant,
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub struct DeprecatedTupleStruct(isize);
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub struct UnstableTupleStruct(isize);
#[stable(feature = "rust1", since = "1.0.0")]
pub struct StableTupleStruct(isize);
@ -432,7 +432,7 @@ mod this_crate {
foo.trait_stable();
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn test_fn_body() {
fn fn_in_body() {}
@ -440,7 +440,7 @@ mod this_crate {
}
impl MethodTester {
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
fn test_method_body(&self) {
fn fn_in_body() {}
@ -448,7 +448,7 @@ mod this_crate {
}
}
#[unstable(feature = "test_feature", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
#[rustc_deprecated(since = "1.0.0", reason = "text")]
pub trait DeprecatedTrait {
fn dummy(&self) { }

View File

@ -10,8 +10,9 @@
// Tests the default for the unused_features lint
#![allow(stable_features)]
// FIXME(#44232) we should warn that this isn't used.
#![feature(this_is_not_a_feature)]
#![feature(rust1)]
#![feature(rustc_attrs)]

View File

@ -10,8 +10,9 @@
#![warn(unused_features)]
#![allow(stable_features)]
// FIXME(#44232) we should warn that this isn't used.
#![feature(this_is_not_a_feature)]
#![feature(rust1)]
#![feature(rustc_attrs)]

View File

@ -13,20 +13,20 @@
#![crate_type="lib"]
#![feature(staged_api)]
#![stable(feature = "test_feature", since = "1.0.0")]
#![stable(feature = "stable_test_feature", since = "1.0.0")]
pub fn unmarked() {
//~^ ERROR This node does not have a stability attribute
()
}
#[unstable(feature = "foo", issue = "0")]
#[unstable(feature = "unstable_test_feature", issue = "0")]
pub mod foo {
// #[unstable] is inherited
pub fn unmarked() {}
}
#[stable(feature = "bar", since="1.0.0")]
#[stable(feature = "stable_test_feature", since="1.0.0")]
pub mod bar {
// #[stable] is not inherited
pub fn unmarked() {}

View File

@ -10,8 +10,6 @@
// edition:2018
#![feature(extern_absolute_paths)]
use xcrate::S; //~ ERROR can't find crate for `xcrate`
fn main() {}

View File

@ -10,8 +10,6 @@
// edition:2018
#![feature(extern_absolute_paths)]
fn main() {
let s = ::xcrate::S; //~ ERROR can't find crate for `xcrate`
}

View File

@ -10,8 +10,6 @@
// edition:2018
#![feature(extern_absolute_paths)]
use ycrate; //~ ERROR can't find crate for `ycrate`
fn main() {}

View File

@ -11,9 +11,6 @@
// aux-build:xcrate.rs
// edition:2018
#![feature(crate_in_paths)]
#![feature(extern_absolute_paths)]
use crate; //~ ERROR unresolved import `crate`
//~^ NOTE crate root imports need to be explicitly named: `use crate as name;`
use *; //~ ERROR unresolved import `*`

View File

@ -9,6 +9,7 @@
// except according to those terms.
// aux-build:stability_attribute_issue.rs
// ignore-tidy-linelength
#![deny(deprecated)]
@ -16,6 +17,8 @@ extern crate stability_attribute_issue;
use stability_attribute_issue::*;
fn main() {
unstable(); //~ ERROR use of unstable library feature 'foo' (see issue #1)
unstable_msg(); //~ ERROR use of unstable library feature 'foo': message (see issue #2)
unstable();
//~^ ERROR use of unstable library feature 'unstable_test_feature' (see issue #1)
unstable_msg();
//~^ ERROR use of unstable library feature 'unstable_test_feature': message (see issue #2)
}

View File

@ -12,7 +12,7 @@
#![feature(staged_api)]
#![stable(feature = "test_feature", since = "1.0.0")]
#![stable(feature = "stable_test_feature", since = "1.0.0")]
#[stable(feature = "a", feature = "b", since = "1.0.0")] //~ ERROR multiple 'feature' items
fn f1() { }

View File

@ -12,7 +12,7 @@
#![feature(staged_api)]
#![stable(feature = "test_feature", since = "1.0.0")]
#![stable(feature = "stable_test_feature", since = "1.0.0")]
#[macro_export]
macro_rules! mac { //~ ERROR This node does not have a stability attribute

View File

@ -15,7 +15,7 @@
#![stable(feature = "rust1", since = "1.0.0")]
mod bogus_attribute_types_1 {
#[stable(feature = "a", since = "a", reason)] //~ ERROR unknown meta item 'reason' [E0541]
#[stable(feature = "a", since = "b", reason)] //~ ERROR unknown meta item 'reason' [E0541]
fn f1() { }
#[stable(feature = "a", since)] //~ ERROR incorrect meta item [E0539]
@ -35,7 +35,7 @@ mod bogus_attribute_types_2 {
#[unstable] //~ ERROR incorrect stability attribute type [E0548]
fn f1() { }
#[unstable = "a"] //~ ERROR incorrect stability attribute type [E0548]
#[unstable = "b"] //~ ERROR incorrect stability attribute type [E0548]
fn f2() { }
#[stable] //~ ERROR incorrect stability attribute type [E0548]
@ -57,7 +57,7 @@ mod missing_feature_names {
#[unstable(issue = "0")] //~ ERROR missing 'feature' [E0546]
fn f1() { }
#[unstable(feature = "a")] //~ ERROR missing 'issue' [E0547]
#[unstable(feature = "b")] //~ ERROR missing 'issue' [E0547]
fn f2() { }
#[stable(since = "a")] //~ ERROR missing 'feature' [E0546]
@ -73,12 +73,12 @@ mod missing_version {
fn f2() { }
}
#[unstable(feature = "a", issue = "0")]
#[unstable(feature = "b", issue = "0")]
#[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544]
fn multiple1() { }
#[unstable(feature = "a", issue = "0")]
#[unstable(feature = "a", issue = "0")] //~ ERROR multiple stability levels [E0544]
#[unstable(feature = "b", issue = "0")]
#[unstable(feature = "b", issue = "0")] //~ ERROR multiple stability levels [E0544]
fn multiple2() { }
#[stable(feature = "a", since = "b")]
@ -88,8 +88,8 @@ fn multiple3() { }
#[stable(feature = "a", since = "b")]
#[rustc_deprecated(since = "b", reason = "text")]
#[rustc_deprecated(since = "b", reason = "text")]
#[rustc_const_unstable(feature = "a")]
#[rustc_const_unstable(feature = "b")]
#[rustc_const_unstable(feature = "c")]
#[rustc_const_unstable(feature = "d")]
pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540]
//~^ ERROR Invalid stability or deprecation version found
//~| ERROR multiple rustc_const_unstable attributes

View File

@ -13,10 +13,11 @@
#![deny(stable_features)]
#![feature(test_accepted_feature)] //~ ERROR this feature has been stable since 1.0.0
#![feature(test_accepted_feature)]
//~^ ERROR the feature `test_accepted_feature` has been stable since 1.0.0
// FIXME(#44232) we should error that this isn't used.
#![feature(rust1)]
//~^ ERROR the feature `rust1` has been stable since 1.0.0
fn main() {
let _foo: Vec<()> = Vec::new();

View File

@ -15,7 +15,6 @@
#![allow(dead_code, unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]
#![feature(static_mutex)]
// This test makes sure that the compiler doesn't crash when trying to assign
// debug locations to const-expressions.

View File

@ -11,7 +11,6 @@
// error-pattern:meep
#![allow(unknown_features)]
#![feature(box_syntax)]
fn f(_a: isize, _b: isize, _c: Box<isize>) {

View File

@ -10,7 +10,6 @@
// error-pattern:panicked at 'Box<Any>'
#![allow(unknown_features)]
#![feature(box_syntax)]
fn main() {

View File

@ -10,8 +10,6 @@
// error-pattern:greetings from the panic handler
#![feature(panic_handler)]
use std::panic;
fn main() {

View File

@ -10,8 +10,6 @@
// error-pattern:thread 'main' panicked at 'foobar'
#![feature(panic_handler)]
use std::panic;
fn main() {

View File

@ -10,8 +10,6 @@
// error-pattern:thread 'main' panicked at 'foobar'
#![feature(panic_handler)]
use std::panic;
fn main() {

View File

@ -10,6 +10,6 @@
#![crate_type = "lib"]
#![feature(staged_api)]
#![unstable(feature = "test_feature", issue = "0")]
#![unstable(feature = "unstable_test_feature", issue = "0")]
pub fn baz() { }
pub fn baz() {}

View File

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

View File

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

View File

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

View File

@ -9,7 +9,6 @@
// except according to those terms.
#![crate_type = "cdylib"]
#![feature(wasm_custom_section)]
#![deny(warnings)]
extern crate foo;

View File

@ -9,7 +9,6 @@
// except according to those terms.
#![crate_type = "rlib"]
#![feature(wasm_custom_section)]
#![deny(warnings)]
#[link_section = "foo"]

View File

@ -12,8 +12,7 @@
// ignore-cross-compile
#![feature(rustc_private, path)]
#![feature(core)]
#![feature(rustc_private)]
extern crate getopts;
extern crate rustc;

View File

@ -9,7 +9,6 @@
// except according to those terms.
#![allow(unknown_features)]
#![feature(box_syntax)]
#![feature(rustc_private)]

View File

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

View File

@ -11,7 +11,7 @@
// aux-build:attr-stmt-expr.rs
// ignore-stage1
#![feature(use_extern_macros, stmt_expr_attributes, proc_macro_stmt, proc_macro_expr)]
#![feature(use_extern_macros, stmt_expr_attributes, proc_macro_expr)]
extern crate attr_stmt_expr;
use attr_stmt_expr::{expect_let, expect_print_stmt, expect_expr, expect_print_expr,

View File

@ -12,7 +12,6 @@
// pretty-expanded FIXME #23616
#![allow(unknown_features)]
#![feature(box_syntax)]
pub fn main() {

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(unknown_features)]
#![feature(box_syntax)]
struct pair<A,B> {

View File

@ -10,7 +10,7 @@
// no-prefer-dynamic
#![feature(heap_api, allocator_api)]
#![feature(allocator_api)]
#![crate_type = "rlib"]
use std::alloc::{GlobalAlloc, System, Layout};

View File

@ -13,7 +13,7 @@
// aux-build:helper.rs
// no-prefer-dynamic
#![feature(heap_api, allocator_api)]
#![feature(allocator_api)]
extern crate custom;
extern crate custom_as_global;

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(unknown_features)]
#![feature(box_syntax)]
fn pairwise_sub(mut t: Box<DoubleEndedIterator<Item=isize>>) -> isize {

View File

@ -12,8 +12,6 @@
// pretty-expanded FIXME #23616
#![feature(core)]
use std::slice;
trait Bound {}

View File

@ -1,4 +1,4 @@
#![allow(unknown_features)]
#![feature(bogus)]
#![allow(stable_features)]
#![feature(rust1)]
pub fn main() { }
// ignore-license

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(unknown_features)]
#![feature(box_syntax)]
trait double {

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(unknown_features)]
#![feature(box_syntax)]
trait double {

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(unknown_features)]
#![feature(box_syntax)]
trait double {

Some files were not shown because too many files have changed in this diff Show More