diff --git a/Cargo.lock b/Cargo.lock index 40b8cf507e97c..657831be894f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3801,9 +3801,11 @@ dependencies = [ name = "tidy" version = "0.1.0" dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 74caaae2840c5..2f9bd067c3115 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -709,8 +709,8 @@ impl Step for Tidy { if !builder.config.vendor { cmd.arg("--no-vendor"); } - if !builder.config.verbose_tests { - cmd.arg("--quiet"); + if builder.is_verbose() { + cmd.arg("--verbose"); } let _folder = builder.fold_output(|| "tidy"); diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index c87ab68693726..3947327b46317 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -1382,7 +1382,7 @@ impl<'a> LoweringContext<'a> { attrs: self.lower_attrs(&arm.attrs), pats: arm.pats.iter().map(|x| self.lower_pat(x)).collect(), guard: match arm.guard { - Some(Guard::If(ref x)) => Some(hir::Guard::If(P(self.lower_expr(x)))), + Some(ref x) => Some(hir::Guard::If(P(self.lower_expr(x)))), _ => None, }, body: P(self.lower_expr(&arm.body)), diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 0fbd0666ad1c1..0b27bfdbe675b 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -3065,7 +3065,7 @@ impl<'a> Resolver<'a> { // This has to happen *after* we determine which pat_idents are variants. self.check_consistent_bindings(&arm.pats); - if let Some(ast::Guard::If(ref expr)) = arm.guard { + if let Some(ref expr) = arm.guard { self.visit_expr(expr) } self.visit_expr(&arm.body); diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index f67241ef23efc..fd746ef0832af 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -1617,9 +1617,8 @@ impl<'l, 'tcx, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, ' fn visit_arm(&mut self, arm: &'l ast::Arm) { self.process_var_decl_multi(&arm.pats); - match arm.guard { - Some(ast::Guard::If(ref expr)) => self.visit_expr(expr), - _ => {} + if let Some(expr) = &arm.guard { + self.visit_expr(expr); } self.visit_expr(&arm.body); } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index b1a62ac81d033..8a2b36e75bef0 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -893,16 +893,11 @@ pub struct Local { pub struct Arm { pub attrs: Vec, pub pats: Vec>, - pub guard: Option, + pub guard: Option>, pub body: P, pub span: Span, } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] -pub enum Guard { - If(P), -} - #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Field { pub ident: Ident, diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 7f051c260ec82..1a448cb2a43cf 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -1,37 +1,37 @@ -use crate::{ast, attr}; use crate::edition::Edition; -use crate::ext::base::{SyntaxExtension, SyntaxExtensionKind}; use crate::ext::base::{DummyResult, ExtCtxt, MacResult, TTMacroExpander}; +use crate::ext::base::{SyntaxExtension, SyntaxExtensionKind}; use crate::ext::expand::{AstFragment, AstFragmentKind}; use crate::ext::hygiene::Transparency; -use crate::ext::tt::macro_parser::{Success, Error, Failure}; -use crate::ext::tt::macro_parser::{MatchedSeq, MatchedNonterminal}; use crate::ext::tt::macro_parser::{parse, parse_failure_msg}; +use crate::ext::tt::macro_parser::{Error, Failure, Success}; +use crate::ext::tt::macro_parser::{MatchedNonterminal, MatchedSeq}; use crate::ext::tt::quoted; use crate::ext::tt::transcribe::transcribe; use crate::feature_gate::Features; -use crate::parse::{Directory, ParseSess}; use crate::parse::parser::Parser; -use crate::parse::token::{self, Token, NtTT}; use crate::parse::token::TokenKind::*; -use crate::symbol::{Symbol, kw, sym}; +use crate::parse::token::{self, NtTT, Token}; +use crate::parse::{Directory, ParseSess}; +use crate::symbol::{kw, sym, Symbol}; use crate::tokenstream::{DelimSpan, TokenStream, TokenTree}; +use crate::{ast, attr}; use errors::FatalError; -use syntax_pos::{Span, symbol::Ident}; use log::debug; +use syntax_pos::{symbol::Ident, Span}; -use rustc_data_structures::fx::{FxHashMap}; +use rustc_data_structures::fx::FxHashMap; use std::borrow::Cow; use std::collections::hash_map::Entry; use std::slice; -use rustc_data_structures::sync::Lrc; use errors::Applicability; +use rustc_data_structures::sync::Lrc; const VALID_FRAGMENT_NAMES_MSG: &str = "valid fragment specifiers are \ - `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, \ - `path`, `meta`, `tt`, `item` and `vis`"; + `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, \ + `literal`, `path`, `meta`, `tt`, `item` and `vis`"; pub struct ParserAnyMacro<'a> { parser: Parser<'a>, @@ -48,7 +48,8 @@ impl<'a> ParserAnyMacro<'a> { let ParserAnyMacro { site_span, macro_ident, ref mut parser, arm_span } = *self; let fragment = panictry!(parser.parse_ast_fragment(kind, true).map_err(|mut e| { if parser.token == token::Eof && e.message().ends_with(", found ``") { - if !e.span.is_dummy() { // early end of macro arm (#52866) + if !e.span.is_dummy() { + // early end of macro arm (#52866) e.replace_span_with(parser.sess.source_map().next_point(parser.token.span)); } let msg = &e.message[0]; @@ -60,7 +61,8 @@ impl<'a> ParserAnyMacro<'a> { msg.1, ); } - if e.span.is_dummy() { // Get around lack of span in error (#30128) + if e.span.is_dummy() { + // Get around lack of span in error (#30128) e.replace_span_with(site_span); if parser.sess.source_map().span_to_filename(arm_span).is_real() { e.span_label(arm_span, "in this macro arm"); @@ -99,17 +101,11 @@ impl TTMacroExpander for MacroRulesMacroExpander { sp: Span, input: TokenStream, def_span: Option, - ) -> Box { + ) -> Box { if !self.valid { return DummyResult::any(sp); } - generic_extension(cx, - sp, - def_span, - self.name, - input, - &self.lhses, - &self.rhses) + generic_extension(cx, sp, def_span, self.name, input, &self.lhses, &self.rhses) } } @@ -119,14 +115,15 @@ fn trace_macros_note(cx: &mut ExtCtxt<'_>, sp: Span, message: String) { } /// Given `lhses` and `rhses`, this is the new macro we create -fn generic_extension<'cx>(cx: &'cx mut ExtCtxt<'_>, - sp: Span, - def_span: Option, - name: ast::Ident, - arg: TokenStream, - lhses: &[quoted::TokenTree], - rhses: &[quoted::TokenTree]) - -> Box { +fn generic_extension<'cx>( + cx: &'cx mut ExtCtxt<'_>, + sp: Span, + def_span: Option, + name: ast::Ident, + arg: TokenStream, + lhses: &[quoted::TokenTree], + rhses: &[quoted::TokenTree], +) -> Box { if cx.trace_macros() { trace_macros_note(cx, sp, format!("expanding `{}! {{ {} }}`", name, arg)); } @@ -134,10 +131,11 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt<'_>, // Which arm's failure should we report? (the one furthest along) let mut best_failure: Option<(Token, &str)> = None; - for (i, lhs) in lhses.iter().enumerate() { // try each arm's matchers + for (i, lhs) in lhses.iter().enumerate() { + // try each arm's matchers let lhs_tt = match *lhs { quoted::TokenTree::Delimited(_, ref delim) => &delim.tts[..], - _ => cx.span_bug(sp, "malformed macro lhs") + _ => cx.span_bug(sp, "malformed macro lhs"), }; match TokenTree::parse(cx, lhs_tt, arg.clone()) { @@ -173,8 +171,8 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt<'_>, ownership: cx.current_expansion.directory_ownership, }; let mut p = Parser::new(cx.parse_sess(), tts, Some(directory), true, false, None); - p.root_module_name = cx.current_expansion.module.mod_path.last() - .map(|id| id.as_str().to_string()); + p.root_module_name = + cx.current_expansion.module.mod_path.last().map(|id| id.as_str().to_string()); p.process_potential_macro_variable(); // Let the context choose how to interpret the result. @@ -188,15 +186,13 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt<'_>, site_span: sp, macro_ident: name, arm_span, - }) + }); } Failure(token, msg) => match best_failure { Some((ref best_token, _)) if best_token.span.lo() >= token.span.lo() => {} - _ => best_failure = Some((token, msg)) - } - Error(err_sp, ref msg) => { - cx.span_fatal(err_sp.substitute_dummy(sp), &msg[..]) - } + _ => best_failure = Some((token, msg)), + }, + Error(err_sp, ref msg) => cx.span_fatal(err_sp.substitute_dummy(sp), &msg[..]), } } @@ -212,7 +208,8 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt<'_>, // Check whether there's a missing comma in this macro call, like `println!("{}" a);` if let Some((arg, comma_span)) = arg.add_comma() { - for lhs in lhses { // try each arm's matchers + for lhs in lhses { + // try each arm's matchers let lhs_tt = match *lhs { quoted::TokenTree::Delimited(_, ref delim) => &delim.tts[..], _ => continue, @@ -249,7 +246,7 @@ pub fn compile( sess: &ParseSess, features: &Features, def: &ast::Item, - edition: Edition + edition: Edition, ) -> SyntaxExtension { let lhs_nm = ast::Ident::new(sym::lhs, def.span); let rhs_nm = ast::Ident::new(sym::rhs, def.span); @@ -267,25 +264,32 @@ pub fn compile( // ...quasiquoting this would be nice. // These spans won't matter, anyways let argument_gram = vec![ - quoted::TokenTree::Sequence(DelimSpan::dummy(), Lrc::new(quoted::SequenceRepetition { - tts: vec![ - quoted::TokenTree::MetaVarDecl(def.span, lhs_nm, tt_spec), - quoted::TokenTree::token(token::FatArrow, def.span), - quoted::TokenTree::MetaVarDecl(def.span, rhs_nm, tt_spec), - ], - separator: Some(Token::new( - if body.legacy { token::Semi } else { token::Comma }, def.span - )), - op: quoted::KleeneOp::OneOrMore, - num_captures: 2, - })), + quoted::TokenTree::Sequence( + DelimSpan::dummy(), + Lrc::new(quoted::SequenceRepetition { + tts: vec![ + quoted::TokenTree::MetaVarDecl(def.span, lhs_nm, tt_spec), + quoted::TokenTree::token(token::FatArrow, def.span), + quoted::TokenTree::MetaVarDecl(def.span, rhs_nm, tt_spec), + ], + separator: Some(Token::new( + if body.legacy { token::Semi } else { token::Comma }, + def.span, + )), + op: quoted::KleeneOp::OneOrMore, + num_captures: 2, + }), + ), // to phase into semicolon-termination instead of semicolon-separation - quoted::TokenTree::Sequence(DelimSpan::dummy(), Lrc::new(quoted::SequenceRepetition { - tts: vec![quoted::TokenTree::token(token::Semi, def.span)], - separator: None, - op: quoted::KleeneOp::ZeroOrMore, - num_captures: 0 - })), + quoted::TokenTree::Sequence( + DelimSpan::dummy(), + Lrc::new(quoted::SequenceRepetition { + tts: vec![quoted::TokenTree::token(token::Semi, def.span)], + separator: None, + op: quoted::KleeneOp::ZeroOrMore, + num_captures: 0, + }), + ), ]; let argument_map = match parse(sess, body.stream(), &argument_gram, None, true) { @@ -307,8 +311,9 @@ pub fn compile( // Extract the arguments: let lhses = match *argument_map[&lhs_nm] { - MatchedSeq(ref s, _) => { - s.iter().map(|m| { + MatchedSeq(ref s, _) => s + .iter() + .map(|m| { if let MatchedNonterminal(ref nt) = *m { if let NtTT(ref tt) = **nt { let tt = quoted::parse( @@ -327,14 +332,15 @@ pub fn compile( } } sess.span_diagnostic.span_bug(def.span, "wrong-structured lhs") - }).collect::>() - } - _ => sess.span_diagnostic.span_bug(def.span, "wrong-structured lhs") + }) + .collect::>(), + _ => sess.span_diagnostic.span_bug(def.span, "wrong-structured lhs"), }; let rhses = match *argument_map[&rhs_nm] { - MatchedSeq(ref s, _) => { - s.iter().map(|m| { + MatchedSeq(ref s, _) => s + .iter() + .map(|m| { if let MatchedNonterminal(ref nt) = *m { if let NtTT(ref tt) = **nt { return quoted::parse( @@ -345,14 +351,15 @@ pub fn compile( &def.attrs, edition, def.id, - ).pop() - .unwrap(); + ) + .pop() + .unwrap(); } } sess.span_diagnostic.span_bug(def.span, "wrong-structured lhs") - }).collect::>() - } - _ => sess.span_diagnostic.span_bug(def.span, "wrong-structured rhs") + }) + .collect::>(), + _ => sess.span_diagnostic.span_bug(def.span, "wrong-structured rhs"), }; for rhs in &rhses { @@ -366,16 +373,12 @@ pub fn compile( sess, slice::from_ref(lhs), &mut FxHashMap::default(), - def.id + def.id, ); } - let expander: Box<_> = Box::new(MacroRulesMacroExpander { - name: def.ident, - lhses, - rhses, - valid, - }); + let expander: Box<_> = + Box::new(MacroRulesMacroExpander { name: def.ident, lhses, rhses, valid }); let default_transparency = if attr::contains_name(&def.attrs, sym::rustc_transparent_macro) { Transparency::Transparent @@ -385,29 +388,34 @@ pub fn compile( Transparency::Opaque }; - let allow_internal_unstable = attr::find_by_name(&def.attrs, sym::allow_internal_unstable) - .map(|attr| attr - .meta_item_list() - .map(|list| list.iter() - .filter_map(|it| { - let name = it.ident().map(|ident| ident.name); - if name.is_none() { - sess.span_diagnostic.span_err(it.span(), - "allow internal unstable expects feature names") - } - name + let allow_internal_unstable = + attr::find_by_name(&def.attrs, sym::allow_internal_unstable).map(|attr| { + attr.meta_item_list() + .map(|list| { + list.iter() + .filter_map(|it| { + let name = it.ident().map(|ident| ident.name); + if name.is_none() { + sess.span_diagnostic.span_err( + it.span(), + "allow internal unstable expects feature names", + ) + } + name + }) + .collect::>() + .into() }) - .collect::>().into() - ) - .unwrap_or_else(|| { - sess.span_diagnostic.span_warn( - attr.span, "allow_internal_unstable expects list of feature names. In the \ - future this will become a hard error. Please use `allow_internal_unstable(\ - foo, bar)` to only allow the `foo` and `bar` features", - ); - vec![sym::allow_internal_unstable_backcompat_hack].into() - }) - ); + .unwrap_or_else(|| { + sess.span_diagnostic.span_warn( + attr.span, + "allow_internal_unstable expects list of feature names. In the \ + future this will become a hard error. Please use `allow_internal_unstable(\ + foo, bar)` to only allow the `foo` and `bar` features", + ); + vec![sym::allow_internal_unstable_backcompat_hack].into() + }) + }); let allow_internal_unsafe = attr::contains_name(&def.attrs, sym::allow_internal_unsafe); @@ -418,14 +426,14 @@ pub fn compile( } } - let unstable_feature = attr::find_stability(&sess, - &def.attrs, def.span).and_then(|stability| { - if let attr::StabilityLevel::Unstable { issue, .. } = stability.level { - Some((stability.feature, issue)) - } else { - None - } - }); + let unstable_feature = + attr::find_stability(&sess, &def.attrs, def.span).and_then(|stability| { + if let attr::StabilityLevel::Unstable { issue, .. } = stability.level { + Some((stability.feature, issue)) + } else { + None + } + }); SyntaxExtension { kind: SyntaxExtensionKind::LegacyBang(expander), @@ -440,10 +448,12 @@ pub fn compile( } } -fn check_lhs_nt_follows(sess: &ParseSess, - features: &Features, - attrs: &[ast::Attribute], - lhs: "ed::TokenTree) -> bool { +fn check_lhs_nt_follows( + sess: &ParseSess, + features: &Features, + attrs: &[ast::Attribute], + lhs: "ed::TokenTree, +) -> bool { // lhs is going to be like TokenTree::Delimited(...), where the // entire lhs is those tts. Or, it can be a "bare sequence", not wrapped in parens. if let quoted::TokenTree::Delimited(_, ref tts) = *lhs { @@ -464,19 +474,22 @@ fn check_lhs_no_empty_seq(sess: &ParseSess, tts: &[quoted::TokenTree]) -> bool { for tt in tts { match *tt { TokenTree::Token(..) | TokenTree::MetaVar(..) | TokenTree::MetaVarDecl(..) => (), - TokenTree::Delimited(_, ref del) => if !check_lhs_no_empty_seq(sess, &del.tts) { - return false; - }, + TokenTree::Delimited(_, ref del) => { + if !check_lhs_no_empty_seq(sess, &del.tts) { + return false; + } + } TokenTree::Sequence(span, ref seq) => { - if seq.separator.is_none() && seq.tts.iter().all(|seq_tt| { - match *seq_tt { + if seq.separator.is_none() + && seq.tts.iter().all(|seq_tt| match *seq_tt { TokenTree::MetaVarDecl(_, _, id) => id.name == sym::vis, - TokenTree::Sequence(_, ref sub_seq) => + TokenTree::Sequence(_, ref sub_seq) => { sub_seq.op == quoted::KleeneOp::ZeroOrMore - || sub_seq.op == quoted::KleeneOp::ZeroOrOne, + || sub_seq.op == quoted::KleeneOp::ZeroOrOne + } _ => false, - } - }) { + }) + { let sp = span.entire(); sess.span_diagnostic.span_err(sp, "repetition matches empty token tree"); return false; @@ -517,7 +530,7 @@ fn check_lhs_duplicate_matcher_bindings( if !check_lhs_duplicate_matcher_bindings(sess, &del.tts, metavar_names, node_id) { return false; } - }, + } TokenTree::Sequence(_, ref seq) => { if !check_lhs_duplicate_matcher_bindings(sess, &seq.tts, metavar_names, node_id) { return false; @@ -533,15 +546,17 @@ fn check_lhs_duplicate_matcher_bindings( fn check_rhs(sess: &ParseSess, rhs: "ed::TokenTree) -> bool { match *rhs { quoted::TokenTree::Delimited(..) => return true, - _ => sess.span_diagnostic.span_err(rhs.span(), "macro rhs must be delimited") + _ => sess.span_diagnostic.span_err(rhs.span(), "macro rhs must be delimited"), } false } -fn check_matcher(sess: &ParseSess, - features: &Features, - attrs: &[ast::Attribute], - matcher: &[quoted::TokenTree]) -> bool { +fn check_matcher( + sess: &ParseSess, + features: &Features, + attrs: &[ast::Attribute], + matcher: &[quoted::TokenTree], +) -> bool { let first_sets = FirstSets::new(matcher); let empty_suffix = TokenSet::empty(); let err = sess.span_diagnostic.err_count(); @@ -620,8 +635,8 @@ impl FirstSets { // Reverse scan: Sequence comes before `first`. if subfirst.maybe_empty - || seq_rep.op == quoted::KleeneOp::ZeroOrMore - || seq_rep.op == quoted::KleeneOp::ZeroOrOne + || seq_rep.op == quoted::KleeneOp::ZeroOrMore + || seq_rep.op == quoted::KleeneOp::ZeroOrOne { // If sequence is potentially empty, then // union them (preserving first emptiness). @@ -659,7 +674,6 @@ impl FirstSets { TokenTree::Sequence(sp, ref seq_rep) => { match self.first.get(&sp.entire()) { Some(&Some(ref subfirst)) => { - // If the sequence contents can be empty, then the first // token could be the separator token itself. @@ -670,8 +684,8 @@ impl FirstSets { assert!(first.maybe_empty); first.add_all(subfirst); if subfirst.maybe_empty - || seq_rep.op == quoted::KleeneOp::ZeroOrMore - || seq_rep.op == quoted::KleeneOp::ZeroOrOne + || seq_rep.op == quoted::KleeneOp::ZeroOrMore + || seq_rep.op == quoted::KleeneOp::ZeroOrOne { // continue scanning for more first // tokens, but also make sure we @@ -720,7 +734,9 @@ struct TokenSet { impl TokenSet { // Returns a set for the empty sequence. - fn empty() -> Self { TokenSet { tokens: Vec::new(), maybe_empty: true } } + fn empty() -> Self { + TokenSet { tokens: Vec::new(), maybe_empty: true } + } // Returns the set `{ tok }` for the single-token (and thus // non-empty) sequence [tok]. @@ -789,12 +805,14 @@ impl TokenSet { // // Requires that `first_sets` is pre-computed for `matcher`; // see `FirstSets::new`. -fn check_matcher_core(sess: &ParseSess, - features: &Features, - attrs: &[ast::Attribute], - first_sets: &FirstSets, - matcher: &[quoted::TokenTree], - follow: &TokenSet) -> TokenSet { +fn check_matcher_core( + sess: &ParseSess, + features: &Features, + attrs: &[ast::Attribute], + first_sets: &FirstSets, + matcher: &[quoted::TokenTree], + follow: &TokenSet, +) -> TokenSet { use quoted::TokenTree; let mut last = TokenSet::empty(); @@ -804,11 +822,13 @@ fn check_matcher_core(sess: &ParseSess, // then ensure T can also be followed by any element of FOLLOW. 'each_token: for i in 0..matcher.len() { let token = &matcher[i]; - let suffix = &matcher[i+1..]; + let suffix = &matcher[i + 1..]; let build_suffix_first = || { let mut s = first_sets.first(suffix); - if s.maybe_empty { s.add_all(follow); } + if s.maybe_empty { + s.add_all(follow); + } s }; @@ -824,7 +844,8 @@ fn check_matcher_core(sess: &ParseSess, let can_be_followed_by_any; if let Err(bad_frag) = has_legal_fragment_specifier(sess, features, attrs, token) { let msg = format!("invalid fragment specifier `{}`", bad_frag); - sess.span_diagnostic.struct_span_err(token.span(), &msg) + sess.span_diagnostic + .struct_span_err(token.span(), &msg) .help(VALID_FRAGMENT_NAMES_MSG) .emit(); // (This eliminates false positives and duplicates @@ -879,12 +900,8 @@ fn check_matcher_core(sess: &ParseSess, // At this point, `suffix_first` is built, and // `my_suffix` is some TokenSet that we can use // for checking the interior of `seq_rep`. - let next = check_matcher_core(sess, - features, - attrs, - first_sets, - &seq_rep.tts, - my_suffix); + let next = + check_matcher_core(sess, features, attrs, first_sets, &seq_rep.tts, my_suffix); if next.maybe_empty { last.add_all(&next); } else { @@ -906,16 +923,17 @@ fn check_matcher_core(sess: &ParseSess, for next_token in &suffix_first.tokens { match is_in_follow(next_token, &frag_spec.as_str()) { IsInFollow::Invalid(msg, help) => { - sess.span_diagnostic.struct_span_err(next_token.span(), &msg) - .help(help).emit(); + sess.span_diagnostic + .struct_span_err(next_token.span(), &msg) + .help(help) + .emit(); // don't bother reporting every source of // conflict for a particular element of `last`. continue 'each_last; } IsInFollow::Yes => {} IsInFollow::No(possible) => { - let may_be = if last.tokens.len() == 1 && - suffix_first.tokens.len() == 1 + let may_be = if last.tokens.len() == 1 && suffix_first.tokens.len() == 1 { "is" } else { @@ -925,12 +943,14 @@ fn check_matcher_core(sess: &ParseSess, let sp = next_token.span(); let mut err = sess.span_diagnostic.struct_span_err( sp, - &format!("`${name}:{frag}` {may_be} followed by `{next}`, which \ - is not allowed for `{frag}` fragments", - name=name, - frag=frag_spec, - next=quoted_tt_to_string(next_token), - may_be=may_be), + &format!( + "`${name}:{frag}` {may_be} followed by `{next}`, which \ + is not allowed for `{frag}` fragments", + name = name, + frag = frag_spec, + next = quoted_tt_to_string(next_token), + may_be = may_be + ), ); err.span_label( sp, @@ -942,16 +962,18 @@ fn check_matcher_core(sess: &ParseSess, &[t] => { err.note(&format!( "only {} is allowed after `{}` fragments", - t, - frag_spec, + t, frag_spec, )); } ts => { err.note(&format!( "{}{} or {}", msg, - ts[..ts.len() - 1].iter().map(|s| *s) - .collect::>().join(", "), + ts[..ts.len() - 1] + .iter() + .map(|s| *s) + .collect::>() + .join(", "), ts[ts.len() - 1], )); } @@ -1026,13 +1048,13 @@ fn is_in_follow(tok: "ed::TokenTree, frag: &str) -> IsInFollow { // since items *must* be followed by either a `;` or a `}`, we can // accept anything after them IsInFollow::Yes - }, + } "block" => { // anything can follow block, the braces provide an easy boundary to // maintain IsInFollow::Yes - }, - "stmt" | "expr" => { + } + "stmt" | "expr" => { const TOKENS: &[&str] = &["`=>`", "`,`", "`;`"]; match tok { TokenTree::Token(token) => match token.kind { @@ -1041,7 +1063,7 @@ fn is_in_follow(tok: "ed::TokenTree, frag: &str) -> IsInFollow { }, _ => IsInFollow::No(TOKENS), } - }, + } "pat" => { const TOKENS: &[&str] = &["`=>`", "`,`", "`=`", "`|`", "`if`", "`in`"]; match tok { @@ -1052,40 +1074,48 @@ fn is_in_follow(tok: "ed::TokenTree, frag: &str) -> IsInFollow { }, _ => IsInFollow::No(TOKENS), } - }, + } "path" | "ty" => { const TOKENS: &[&str] = &[ - "`{`", "`[`", "`=>`", "`,`", "`>`","`=`", "`:`", "`;`", "`|`", "`as`", + "`{`", "`[`", "`=>`", "`,`", "`>`", "`=`", "`:`", "`;`", "`|`", "`as`", "`where`", ]; match tok { TokenTree::Token(token) => match token.kind { - OpenDelim(token::DelimToken::Brace) | - OpenDelim(token::DelimToken::Bracket) | - Comma | FatArrow | Colon | Eq | Gt | BinOp(token::Shr) | Semi | - BinOp(token::Or) => IsInFollow::Yes, - Ident(name, false) if name == kw::As || - name == kw::Where => IsInFollow::Yes, + OpenDelim(token::DelimToken::Brace) + | OpenDelim(token::DelimToken::Bracket) + | Comma + | FatArrow + | Colon + | Eq + | Gt + | BinOp(token::Shr) + | Semi + | BinOp(token::Or) => IsInFollow::Yes, + Ident(name, false) if name == kw::As || name == kw::Where => { + IsInFollow::Yes + } _ => IsInFollow::No(TOKENS), }, - TokenTree::MetaVarDecl(_, _, frag) if frag.name == sym::block => - IsInFollow::Yes, + TokenTree::MetaVarDecl(_, _, frag) if frag.name == sym::block => { + IsInFollow::Yes + } _ => IsInFollow::No(TOKENS), } - }, + } "ident" | "lifetime" => { // being a single token, idents and lifetimes are harmless IsInFollow::Yes - }, + } "literal" => { // literals may be of a single token, or two tokens (negative numbers) IsInFollow::Yes - }, + } "meta" | "tt" => { // being either a single token or a delimited sequence, tt is // harmless IsInFollow::Yes - }, + } "vis" => { // Explicitly disallow `priv`, on the off chance it comes back. const TOKENS: &[&str] = &["`,`", "an ident", "a type"]; @@ -1093,30 +1123,39 @@ fn is_in_follow(tok: "ed::TokenTree, frag: &str) -> IsInFollow { TokenTree::Token(token) => match token.kind { Comma => IsInFollow::Yes, Ident(name, is_raw) if is_raw || name != kw::Priv => IsInFollow::Yes, - _ => if token.can_begin_type() { - IsInFollow::Yes - } else { - IsInFollow::No(TOKENS) + _ => { + if token.can_begin_type() { + IsInFollow::Yes + } else { + IsInFollow::No(TOKENS) + } } }, - TokenTree::MetaVarDecl(_, _, frag) if frag.name == sym::ident - || frag.name == sym::ty - || frag.name == sym::path => - IsInFollow::Yes, + TokenTree::MetaVarDecl(_, _, frag) + if frag.name == sym::ident + || frag.name == sym::ty + || frag.name == sym::path => + { + IsInFollow::Yes + } _ => IsInFollow::No(TOKENS), } - }, + } "" => IsInFollow::Yes, // kw::Invalid - _ => IsInFollow::Invalid(format!("invalid fragment specifier `{}`", frag), - VALID_FRAGMENT_NAMES_MSG), + _ => IsInFollow::Invalid( + format!("invalid fragment specifier `{}`", frag), + VALID_FRAGMENT_NAMES_MSG, + ), } } } -fn has_legal_fragment_specifier(sess: &ParseSess, - features: &Features, - attrs: &[ast::Attribute], - tok: "ed::TokenTree) -> Result<(), String> { +fn has_legal_fragment_specifier( + sess: &ParseSess, + features: &Features, + attrs: &[ast::Attribute], + tok: "ed::TokenTree, +) -> Result<(), String> { debug!("has_legal_fragment_specifier({:?})", tok); if let quoted::TokenTree::MetaVarDecl(_, _, ref frag_spec) = *tok { let frag_span = tok.span(); @@ -1127,11 +1166,13 @@ fn has_legal_fragment_specifier(sess: &ParseSess, Ok(()) } -fn is_legal_fragment_specifier(_sess: &ParseSess, - _features: &Features, - _attrs: &[ast::Attribute], - frag_name: Symbol, - _frag_span: Span) -> bool { +fn is_legal_fragment_specifier( + _sess: &ParseSess, + _features: &Features, + _attrs: &[ast::Attribute], + frag_name: Symbol, + _frag_span: Span, +) -> bool { /* * If new fragment specifiers are invented in nightly, `_sess`, * `_features`, `_attrs`, and `_frag_span` will be useful here @@ -1139,9 +1180,20 @@ fn is_legal_fragment_specifier(_sess: &ParseSess, * this function. */ match frag_name { - sym::item | sym::block | sym::stmt | sym::expr | sym::pat | - sym::lifetime | sym::path | sym::ty | sym::ident | sym::meta | sym::tt | - sym::vis | sym::literal | kw::Invalid => true, + sym::item + | sym::block + | sym::stmt + | sym::expr + | sym::pat + | sym::lifetime + | sym::path + | sym::ty + | sym::ident + | sym::meta + | sym::tt + | sym::vis + | sym::literal + | kw::Invalid => true, _ => false, } } @@ -1151,7 +1203,9 @@ fn quoted_tt_to_string(tt: "ed::TokenTree) -> String { quoted::TokenTree::Token(ref token) => crate::print::pprust::token_to_string(&token), quoted::TokenTree::MetaVar(_, name) => format!("${}", name), quoted::TokenTree::MetaVarDecl(_, name, kind) => format!("${}:{}", name, kind), - _ => panic!("unexpected quoted::TokenTree::{{Sequence or Delimited}} \ - in follow set checker"), + _ => panic!( + "unexpected quoted::TokenTree::{{Sequence or Delimited}} \ + in follow set checker" + ), } } diff --git a/src/libsyntax/ext/tt/quoted.rs b/src/libsyntax/ext/tt/quoted.rs index b52e3b7150567..6f5ce89bc315a 100644 --- a/src/libsyntax/ext/tt/quoted.rs +++ b/src/libsyntax/ext/tt/quoted.rs @@ -1,12 +1,12 @@ +use crate::ast; use crate::ast::NodeId; use crate::ext::tt::macro_parser; use crate::feature_gate::Features; use crate::parse::token::{self, Token, TokenKind}; use crate::parse::ParseSess; use crate::print::pprust; -use crate::tokenstream::{self, DelimSpan}; -use crate::ast; use crate::symbol::kw; +use crate::tokenstream::{self, DelimSpan}; use syntax_pos::{edition::Edition, BytePos, Span}; @@ -137,8 +137,7 @@ impl TokenTree { TokenTree::Token(Token { span, .. }) | TokenTree::MetaVar(span, _) | TokenTree::MetaVarDecl(span, _, _) => span, - TokenTree::Delimited(span, _) - | TokenTree::Sequence(span, _) => span.entire(), + TokenTree::Delimited(span, _) | TokenTree::Sequence(span, _) => span.entire(), } } @@ -199,7 +198,7 @@ pub fn parse( match tree { TokenTree::MetaVar(start_sp, ident) if expect_matchers => { let span = match trees.next() { - Some(tokenstream::TokenTree::Token(Token { kind: token::Colon, span })) => + Some(tokenstream::TokenTree::Token(Token { kind: token::Colon, span })) => { match trees.next() { Some(tokenstream::TokenTree::Token(token)) => match token.ident() { Some((kind, _)) => { @@ -209,22 +208,13 @@ pub fn parse( } _ => token.span, }, - tree => tree - .as_ref() - .map(tokenstream::TokenTree::span) - .unwrap_or(span), - }, - tree => tree - .as_ref() - .map(tokenstream::TokenTree::span) - .unwrap_or(start_sp), + tree => tree.as_ref().map(tokenstream::TokenTree::span).unwrap_or(span), + } + } + tree => tree.as_ref().map(tokenstream::TokenTree::span).unwrap_or(start_sp), }; sess.missing_fragment_specifiers.borrow_mut().insert(span); - result.push(TokenTree::MetaVarDecl( - span, - ident, - ast::Ident::invalid(), - )); + result.push(TokenTree::MetaVarDecl(span, ident, ast::Ident::invalid())); } // Not a metavar or no matchers allowed, so just return the tree @@ -311,10 +301,8 @@ fn parse_tree( // `tree` is followed by a random token. This is an error. Some(tokenstream::TokenTree::Token(token)) => { - let msg = format!( - "expected identifier, found `{}`", - pprust::token_to_string(&token), - ); + let msg = + format!("expected identifier, found `{}`", pprust::token_to_string(&token),); sess.span_diagnostic.span_err(token.span, &msg); TokenTree::MetaVar(token.span, ast::Ident::invalid()) } @@ -371,10 +359,7 @@ fn parse_kleene_op( Some(op) => Ok(Ok((op, token.span))), None => Ok(Err(token)), }, - tree => Err(tree - .as_ref() - .map(tokenstream::TokenTree::span) - .unwrap_or(span)), + tree => Err(tree.as_ref().map(tokenstream::TokenTree::span).unwrap_or(span)), } } @@ -426,8 +411,7 @@ fn parse_sep_and_kleene_op( }; // If we ever get to this point, we have experienced an "unexpected token" error - sess.span_diagnostic - .span_err(span, "expected one of: `*`, `+`, or `?`"); + sess.span_diagnostic.span_err(span, "expected one of: `*`, `+`, or `?`"); // Return a dummy (None, KleeneOp::ZeroOrMore) diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index 5a5b633e3151f..076557ab11ae7 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -131,10 +131,6 @@ pub trait MutVisitor: Sized { noop_visit_arm(a, self); } - fn visit_guard(&mut self, g: &mut Guard) { - noop_visit_guard(g, self); - } - fn visit_pat(&mut self, p: &mut P) { noop_visit_pat(p, self); } @@ -389,17 +385,11 @@ pub fn noop_visit_arm( ) { visit_attrs(attrs, vis); visit_vec(pats, |pat| vis.visit_pat(pat)); - visit_opt(guard, |guard| vis.visit_guard(guard)); + visit_opt(guard, |guard| vis.visit_expr(guard)); vis.visit_expr(body); vis.visit_span(span); } -pub fn noop_visit_guard(g: &mut Guard, vis: &mut T) { - match g { - Guard::If(e) => vis.visit_expr(e), - } -} - pub fn noop_visit_ty_constraint( AssocTyConstraint { id, ident, kind, span }: &mut AssocTyConstraint, vis: &mut T diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index fa697e06d269d..7b91ad4a0b410 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3,7 +3,7 @@ use crate::ast::{AngleBracketedArgs, ParenthesizedArgs, AttrStyle, BareFnTy}; use crate::ast::{GenericBound, TraitBoundModifier}; use crate::ast::Unsafety; -use crate::ast::{Mod, AnonConst, Arg, Arm, Guard, Attribute, BindingMode, TraitItemKind}; +use crate::ast::{Mod, AnonConst, Arg, Arm, Attribute, BindingMode, TraitItemKind}; use crate::ast::Block; use crate::ast::{BlockCheckMode, CaptureBy, Movability}; use crate::ast::{Constness, Crate}; @@ -3413,7 +3413,7 @@ impl<'a> Parser<'a> { let lo = self.token.span; let pats = self.parse_pats()?; let guard = if self.eat_keyword(kw::If) { - Some(Guard::If(self.parse_expr()?)) + Some(self.parse_expr()?) } else { None }; diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 0aac4f83658b9..9edd09576e782 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -2663,14 +2663,10 @@ impl<'a> State<'a> { self.print_outer_attributes(&arm.attrs)?; self.print_pats(&arm.pats)?; self.s.space()?; - if let Some(ref g) = arm.guard { - match g { - ast::Guard::If(ref e) => { - self.word_space("if")?; - self.print_expr(e)?; - self.s.space()?; - } - } + if let Some(ref e) = arm.guard { + self.word_space("if")?; + self.print_expr(e)?; + self.s.space()?; } self.word_space("=>")?; diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 8132024416a30..e2489c16c3157 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -834,10 +834,8 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) { pub fn walk_arm<'a, V: Visitor<'a>>(visitor: &mut V, arm: &'a Arm) { walk_list!(visitor, visit_pat, &arm.pats); - if let Some(ref g) = &arm.guard { - match g { - Guard::If(ref e) => visitor.visit_expr(e), - } + if let Some(ref e) = &arm.guard { + visitor.visit_expr(e); } visitor.visit_expr(&arm.body); walk_list!(visitor, visit_attribute, &arm.attrs); diff --git a/src/test/incremental/issue-59523-on-implemented-is-not-unused.rs b/src/test/incremental/issue-59523-on-implemented-is-not-unused.rs index 3d16a1543f43a..afc086213403c 100644 --- a/src/test/incremental/issue-59523-on-implemented-is-not-unused.rs +++ b/src/test/incremental/issue-59523-on-implemented-is-not-unused.rs @@ -2,7 +2,7 @@ // rustc_on_unimplemented, but with this bug we are seeing it fire (on // subsequent runs) if incremental compilation is enabled. -// revisions: rpass1 rpass2 +// revisions: cfail1 cfail2 // compile-pass #![feature(on_unimplemented)] diff --git a/src/test/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs b/src/test/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs index e4802cba9b6d7..37bd8d0641fb9 100644 --- a/src/test/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs +++ b/src/test/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs @@ -3,7 +3,7 @@ // seeing it fire (on subsequent runs) if incremental compilation is // enabled. -// revisions: rpass1 rpass2 +// revisions: cfail1 cfail2 // compile-pass #![feature(rustc_attrs)] diff --git a/src/test/incremental/no_mangle.rs b/src/test/incremental/no_mangle.rs index 1b17886a4f9b5..b1c9b2bc37f64 100644 --- a/src/test/incremental/no_mangle.rs +++ b/src/test/incremental/no_mangle.rs @@ -1,6 +1,6 @@ -// revisions:rpass1 rpass2 +// revisions:cfail1 cfail2 +// check-pass // compile-flags: --crate-type cdylib -// skip-codegen #![deny(unused_attributes)] diff --git a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs index 5f76caabc796b..796729ac4cc28 100644 --- a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs +++ b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs @@ -1,4 +1,4 @@ -// compile-pass +// error-pattern:returned Box from main() // failure-status: 1 use std::error::Error; diff --git a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-result-box-error_err.rs b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-result-box-error_err.rs index bd47a9768f94b..2f3a73a30ad95 100644 --- a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-result-box-error_err.rs +++ b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-result-box-error_err.rs @@ -1,4 +1,4 @@ -// compile-pass +// error-pattern:returned Box from main() // failure-status: 1 use std::io::{Error, ErrorKind}; diff --git a/src/test/run-pass/compiletest-skip-codegen.rs b/src/test/run-pass/compiletest-skip-codegen.rs deleted file mode 100644 index 3c0e22613128a..0000000000000 --- a/src/test/run-pass/compiletest-skip-codegen.rs +++ /dev/null @@ -1,7 +0,0 @@ -// Test that with the `skip-codegen` option the test isn't executed. - -// skip-codegen - -fn main() { - unreachable!(); -} diff --git a/src/test/ui/asm/asm-misplaced-option.rs b/src/test/ui/asm/asm-misplaced-option.rs index 5c202a158f401..14ff4c2e981b3 100644 --- a/src/test/ui/asm/asm-misplaced-option.rs +++ b/src/test/ui/asm/asm-misplaced-option.rs @@ -1,3 +1,4 @@ +// check-pass // ignore-android // ignore-arm // ignore-aarch64 @@ -11,14 +12,11 @@ // ignore-mips // ignore-mips64 -// compile-pass -// skip-codegen #![feature(asm)] -#![allow(dead_code, non_upper_case_globals)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -pub fn main() { +fn main() { // assignment not dead let mut x: isize = 0; unsafe { diff --git a/src/test/ui/asm/asm-misplaced-option.stderr b/src/test/ui/asm/asm-misplaced-option.stderr index 39d88e3fb56dc..3d4b28c3dc444 100644 --- a/src/test/ui/asm/asm-misplaced-option.stderr +++ b/src/test/ui/asm/asm-misplaced-option.stderr @@ -1,11 +1,11 @@ warning: unrecognized option - --> $DIR/asm-misplaced-option.rs:26:64 + --> $DIR/asm-misplaced-option.rs:24:64 | LL | asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc"); | ^^^^ warning: expected a clobber, found an option - --> $DIR/asm-misplaced-option.rs:33:80 + --> $DIR/asm-misplaced-option.rs:31:80 | LL | asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile"); | ^^^^^^^^^^ diff --git a/src/test/ui/associated-types/cache/chrono-scan.rs b/src/test/ui/associated-types/cache/chrono-scan.rs index 00d47c92a374c..8ddd347ff3607 100644 --- a/src/test/ui/associated-types/cache/chrono-scan.rs +++ b/src/test/ui/associated-types/cache/chrono-scan.rs @@ -1,10 +1,10 @@ -// compile-pass -// skip-codegen -#![allow(warnings)] +// check-pass + pub type ParseResult = Result; -pub enum Item<'a> { Literal(&'a str), - } +pub enum Item<'a> { + Literal(&'a str) +} pub fn colon_or_space(s: &str) -> ParseResult<&str> { unimplemented!() @@ -20,10 +20,9 @@ pub fn parse<'a, I>(mut s: &str, items: I) -> ParseResult<()> macro_rules! try_consume { ($e:expr) => ({ let (s_, v) = try!($e); s = s_; v }) } - let offset = try_consume!(timezone_offset_zulu(s.trim_left(), colon_or_space)); - let offset = try_consume!(timezone_offset_zulu(s.trim_left(), colon_or_space)); + let offset = try_consume!(timezone_offset_zulu(s.trim_start(), colon_or_space)); + let offset = try_consume!(timezone_offset_zulu(s.trim_start(), colon_or_space)); Ok(()) } - -fn main() { } +fn main() {} diff --git a/src/test/ui/associated-types/cache/elision.rs b/src/test/ui/associated-types/cache/elision.rs index 2b49cd33ba09b..b3e1ec8ad703c 100644 --- a/src/test/ui/associated-types/cache/elision.rs +++ b/src/test/ui/associated-types/cache/elision.rs @@ -1,10 +1,9 @@ -// compile-pass -// skip-codegen -#![allow(warnings)] // Check that you are allowed to implement using elision but write // trait without elision (a bug in this cropped up during // bootstrapping, so this is a regression test). +// check-pass + pub struct SplitWhitespace<'a> { x: &'a u8 } diff --git a/src/test/ui/bad/bad-lint-cap3.rs b/src/test/ui/bad/bad-lint-cap3.rs index 4cfa0b266c8c7..c38105870e4c0 100644 --- a/src/test/ui/bad/bad-lint-cap3.rs +++ b/src/test/ui/bad/bad-lint-cap3.rs @@ -1,10 +1,9 @@ +// check-pass // compile-flags: --cap-lints warn #![warn(unused)] #![deny(warnings)] -// compile-pass -// skip-codegen -use std::option; //~ WARN +use std::option; //~ WARN fn main() {} diff --git a/src/test/ui/bad/bad-lint-cap3.stderr b/src/test/ui/bad/bad-lint-cap3.stderr index a1ea3f774b40d..b898d792f65ca 100644 --- a/src/test/ui/bad/bad-lint-cap3.stderr +++ b/src/test/ui/bad/bad-lint-cap3.stderr @@ -5,7 +5,7 @@ LL | use std::option; | ^^^^^^^^^^^ | note: lint level defined here - --> $DIR/bad-lint-cap3.rs:4:9 + --> $DIR/bad-lint-cap3.rs:5:9 | LL | #![deny(warnings)] | ^^^^^^^^ diff --git a/src/test/ui/coherence/coherence-projection-ok-orphan.rs b/src/test/ui/coherence/coherence-projection-ok-orphan.rs index 652b438feb137..b34c31dcddb3d 100644 --- a/src/test/ui/coherence/coherence-projection-ok-orphan.rs +++ b/src/test/ui/coherence/coherence-projection-ok-orphan.rs @@ -1,11 +1,10 @@ -// compile-pass -// skip-codegen +// Here we do not get a coherence conflict because `Baz: Iterator` +// does not hold and (due to the orphan rules), we can rely on that. + +// check-pass // revisions: old re #![cfg_attr(re, feature(re_rebalance_coherence))] -#![allow(dead_code)] -// Here we do not get a coherence conflict because `Baz: Iterator` -// does not hold and (due to the orphan rules), we can rely on that. pub trait Foo

{} @@ -18,5 +17,4 @@ impl Foo for Baz { } impl Foo for A { } - fn main() {} diff --git a/src/test/ui/coherence/coherence-projection-ok.rs b/src/test/ui/coherence/coherence-projection-ok.rs index f759a9e1b4508..f4f5ca64de738 100644 --- a/src/test/ui/coherence/coherence-projection-ok.rs +++ b/src/test/ui/coherence/coherence-projection-ok.rs @@ -1,8 +1,8 @@ -// compile-pass -// skip-codegen +// check-pass // revisions: old re #![cfg_attr(re, feature(re_rebalance_coherence))] + pub trait Foo

{} pub trait Bar { @@ -17,5 +17,4 @@ impl Bar for i32 { type Output = u32; } - fn main() {} diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.rs b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.rs index bd8317e224699..0d677800f7949 100644 --- a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.rs +++ b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.rs @@ -1,13 +1,11 @@ // Test that we are able to introduce a negative constraint that // `MyType: !MyTrait` along with other "fundamental" wrappers. +// check-pass // aux-build:coherence_copy_like_lib.rs -// compile-pass -// skip-codegen // revisions: old re #![cfg_attr(re, feature(re_rebalance_coherence))] -#![allow(dead_code)] extern crate coherence_copy_like_lib as lib; @@ -23,5 +21,4 @@ impl MyTrait for T { } // Huzzah. impl<'a> MyTrait for lib::MyFundamentalStruct<&'a MyType> { } - fn main() { } diff --git a/src/test/ui/coherence/coherence_local.rs b/src/test/ui/coherence/coherence_local.rs index cac45b0b9edff..3eab6e03ae3e2 100644 --- a/src/test/ui/coherence/coherence_local.rs +++ b/src/test/ui/coherence/coherence_local.rs @@ -1,13 +1,11 @@ // Test that we are able to introduce a negative constraint that // `MyType: !MyTrait` along with other "fundamental" wrappers. +// check-pass // aux-build:coherence_copy_like_lib.rs -// compile-pass -// skip-codegen // revisions: old re #![cfg_attr(re, feature(re_rebalance_coherence))] -#![allow(dead_code)] extern crate coherence_copy_like_lib as lib; @@ -22,5 +20,4 @@ impl lib::MyCopy for Box { } impl lib::MyCopy for lib::MyFundamentalStruct { } impl lib::MyCopy for lib::MyFundamentalStruct> { } - -fn main() { } +fn main() {} diff --git a/src/test/ui/coherence/coherence_local_ref.rs b/src/test/ui/coherence/coherence_local_ref.rs index a52510b8ea9ca..dff684c1699af 100644 --- a/src/test/ui/coherence/coherence_local_ref.rs +++ b/src/test/ui/coherence/coherence_local_ref.rs @@ -1,13 +1,11 @@ // Test that we are able to introduce a negative constraint that // `MyType: !MyTrait` along with other "fundamental" wrappers. +// check-pass // aux-build:coherence_copy_like_lib.rs -// compile-pass -// skip-codegen // revisions: old re #![cfg_attr(re, feature(re_rebalance_coherence))] -#![allow(dead_code)] extern crate coherence_copy_like_lib as lib; @@ -16,5 +14,4 @@ struct MyType { x: i32 } // naturally, legal impl lib::MyCopy for MyType { } - fn main() { } diff --git a/src/test/ui/conditional-compilation/cfg_attr_path.rs b/src/test/ui/conditional-compilation/cfg_attr_path.rs index 9e9ff6622ce96..efb718b786fa6 100644 --- a/src/test/ui/conditional-compilation/cfg_attr_path.rs +++ b/src/test/ui/conditional-compilation/cfg_attr_path.rs @@ -1,13 +1,12 @@ -// compile-pass -// skip-codegen -#![allow(dead_code)] +// check-pass + #![deny(unused_attributes)] // c.f #35584 + mod auxiliary { #[cfg_attr(any(), path = "nonexistent_file.rs")] pub mod namespaced_enums; #[cfg_attr(all(), path = "namespaced_enums.rs")] pub mod nonexistent_file; } - fn main() { let _ = auxiliary::namespaced_enums::Foo::A; let _ = auxiliary::nonexistent_file::Foo::A; diff --git a/src/test/ui/consts/const-eval/const_transmute.rs b/src/test/ui/consts/const-eval/const_transmute.rs index 4726f9dde3a84..0e0e003dcf476 100644 --- a/src/test/ui/consts/const-eval/const_transmute.rs +++ b/src/test/ui/consts/const-eval/const_transmute.rs @@ -1,4 +1,3 @@ -// compile-pass // run-pass #![feature(const_fn_union)] diff --git a/src/test/ui/consts/const-eval/enum_discr.rs b/src/test/ui/consts/const-eval/enum_discr.rs index 4851e7520948d..e09258f11206e 100644 --- a/src/test/ui/consts/const-eval/enum_discr.rs +++ b/src/test/ui/consts/const-eval/enum_discr.rs @@ -1,4 +1,3 @@ -// compile-pass // run-pass enum Foo { diff --git a/src/test/ui/consts/const-fn-stability-calls-3.rs b/src/test/ui/consts/const-fn-stability-calls-3.rs index 44bcca8d8023a..b831dee580c1a 100644 --- a/src/test/ui/consts/const-fn-stability-calls-3.rs +++ b/src/test/ui/consts/const-fn-stability-calls-3.rs @@ -1,15 +1,12 @@ // Test use of const fn from another crate without a feature gate. -// compile-pass -// skip-codegen -#![allow(unused_variables)] +// check-pass // aux-build:const_fn_lib.rs extern crate const_fn_lib; use const_fn_lib::foo; - fn main() { let x = foo(); // use outside a constant is ok } diff --git a/src/test/ui/expanded-cfg.rs b/src/test/ui/expanded-cfg.rs index c98fd7ffea8be..baa161af76abc 100644 --- a/src/test/ui/expanded-cfg.rs +++ b/src/test/ui/expanded-cfg.rs @@ -1,5 +1,4 @@ -// skip-codegen -// compile-pass +// check-pass macro_rules! mac { {} => { @@ -19,5 +18,4 @@ macro_rules! mac { mac! {} - fn main() {} diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs index ca0a432d3396e..3187b4cae55ee 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs @@ -30,8 +30,9 @@ // inputs are handled by each, and (2.) to ease searching for related // occurrences in the source text. +// check-pass + #![warn(unused_attributes, unknown_lints)] -#![allow(stable_features)] // UNGATED WHITE-LISTED BUILT-IN ATTRIBUTES @@ -75,7 +76,7 @@ // see issue-43106-gating-of-stable.rs // see issue-43106-gating-of-unstable.rs // see issue-43106-gating-of-deprecated.rs -#![windows_subsystem = "1000"] +#![windows_subsystem = "windows"] // UNGATED CRATE-LEVEL BUILT-IN ATTRIBUTES @@ -539,7 +540,7 @@ mod export_name { #[export_name = "2200"] impl S { } } -// Note that this test has a `skip-codegen`, so it +// Note that this is a `check-pass` test, so it // will never invoke the linker. These are here nonetheless to point // out that we allow them at non-crate-level (though I do not know // whether they have the same effect here as at crate-level). @@ -611,17 +612,17 @@ mod must_use { #[must_use] impl S { } } -#[windows_subsystem = "1000"] +#[windows_subsystem = "windows"] mod windows_subsystem { - mod inner { #![windows_subsystem="1000"] } + mod inner { #![windows_subsystem="windows"] } - #[windows_subsystem = "1000"] fn f() { } + #[windows_subsystem = "windows"] fn f() { } - #[windows_subsystem = "1000"] struct S; + #[windows_subsystem = "windows"] struct S; - #[windows_subsystem = "1000"] type T = S; + #[windows_subsystem = "windows"] type T = S; - #[windows_subsystem = "1000"] impl S { } + #[windows_subsystem = "windows"] impl S { } } // BROKEN USES OF CRATE-LEVEL BUILT-IN ATTRIBUTES diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr index c7081205e1481..e03b7124ac882 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr @@ -1,1182 +1,1186 @@ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:38:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:39:9 | LL | #![warn(x5400)] | ^^^^^ | note: lint level defined here - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:33:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:35:28 | LL | #![warn(unused_attributes, unknown_lints)] | ^^^^^^^^^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:39:10 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:40:10 | LL | #![allow(x5300)] | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:40:11 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:41:11 | LL | #![forbid(x5200)] | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:41:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:42:9 | LL | #![deny(x5100)] | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:99:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:100:8 | LL | #[warn(x5400)] | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:102:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:103:25 | LL | mod inner { #![warn(x5400)] } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:105:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:106:12 | LL | #[warn(x5400)] fn f() { } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:108:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:109:12 | LL | #[warn(x5400)] struct S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:111:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:112:12 | LL | #[warn(x5400)] type T = S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:114:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:115:12 | LL | #[warn(x5400)] impl S { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:118:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:119:9 | LL | #[allow(x5300)] | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:121:26 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:122:26 | LL | mod inner { #![allow(x5300)] } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:124:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:125:13 | LL | #[allow(x5300)] fn f() { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:127:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:128:13 | LL | #[allow(x5300)] struct S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:130:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:131:13 | LL | #[allow(x5300)] type T = S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:133:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:134:13 | LL | #[allow(x5300)] impl S { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:137:10 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:138:10 | LL | #[forbid(x5200)] | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:140:27 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:141:27 | LL | mod inner { #![forbid(x5200)] } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:143:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:144:14 | LL | #[forbid(x5200)] fn f() { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:146:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:147:14 | LL | #[forbid(x5200)] struct S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:149:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:150:14 | LL | #[forbid(x5200)] type T = S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:152:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:153:14 | LL | #[forbid(x5200)] impl S { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:156:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:157:8 | LL | #[deny(x5100)] | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:159:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:160:25 | LL | mod inner { #![deny(x5100)] } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:162:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:163:12 | LL | #[deny(x5100)] fn f() { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:165:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:166:12 | LL | #[deny(x5100)] struct S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:168:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:169:12 | LL | #[deny(x5100)] type T = S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:171:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:172:12 | LL | #[deny(x5100)] impl S { } | ^^^^^ warning: macro_escape is a deprecated synonym for macro_use - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:455:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:456:1 | LL | #[macro_escape] | ^^^^^^^^^^^^^^^ warning: macro_escape is a deprecated synonym for macro_use - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:458:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:459:17 | LL | mod inner { #![macro_escape] } | ^^^^^^^^^^^^^^^^ | = help: consider an outer attribute, #[macro_use] mod ... +warning: the feature `rust1` has been stable since 1.0.0 and no longer requires an attribute to enable + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:89:12 + | +LL | #![feature(rust1)] + | ^^^^^ + | + = note: #[warn(stable_features)] on by default + warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:179:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:180:5 | LL | #[macro_use] fn f() { } | ^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:33:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:35:9 | LL | #![warn(unused_attributes, unknown_lints)] | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:182:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:183:5 | LL | #[macro_use] struct S; | ^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:185:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:186:5 | LL | #[macro_use] type T = S; | ^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:188:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:189:5 | LL | #[macro_use] impl S { } | ^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:195:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:196:17 | LL | mod inner { #![macro_export] } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:198:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:199:5 | LL | #[macro_export] fn f() { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:201:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:202:5 | LL | #[macro_export] struct S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:204:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:205:5 | LL | #[macro_export] type T = S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:207:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:208:5 | LL | #[macro_export] impl S { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:192:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:193:1 | LL | #[macro_export] | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:214:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:215:17 | LL | mod inner { #![plugin_registrar] } | ^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:219:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:220:5 | LL | #[plugin_registrar] struct S; | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:222:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:223:5 | LL | #[plugin_registrar] type T = S; | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:225:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:226:5 | LL | #[plugin_registrar] impl S { } | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:211:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:212:1 | LL | #[plugin_registrar] | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:232:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:233:17 | LL | mod inner { #![main] } | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:237:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:238:5 | LL | #[main] struct S; | ^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:240:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:241:5 | LL | #[main] type T = S; | ^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:243:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:244:5 | LL | #[main] impl S { } | ^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:229:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:230:1 | LL | #[main] | ^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:250:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:251:17 | LL | mod inner { #![start] } | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:255:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:256:5 | LL | #[start] struct S; | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:258:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:259:5 | LL | #[start] type T = S; | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:261:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:262:5 | LL | #[start] impl S { } | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:247:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:248:1 | LL | #[start] | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:314:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:315:5 | LL | #[path = "3800"] fn f() { } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:317:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:318:5 | LL | #[path = "3800"] struct S; | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:320:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:321:5 | LL | #[path = "3800"] type T = S; | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:323:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:324:5 | LL | #[path = "3800"] impl S { } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:330:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:331:17 | LL | mod inner { #![automatically_derived] } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:333:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:334:5 | LL | #[automatically_derived] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:336:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:337:5 | LL | #[automatically_derived] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:339:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:340:5 | LL | #[automatically_derived] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:342:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:343:5 | LL | #[automatically_derived] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:327:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:328:1 | LL | #[automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:362:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:363:17 | LL | mod inner { #![no_link] } | ^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:365:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:366:5 | LL | #[no_link] fn f() { } | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:368:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:369:5 | LL | #[no_link] struct S; | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:371:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:372:5 | LL | #[no_link]type T = S; | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:374:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:375:5 | LL | #[no_link] impl S { } | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:359:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:360:1 | LL | #[no_link] | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:381:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:382:17 | LL | mod inner { #![should_panic] } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:384:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:385:5 | LL | #[should_panic] fn f() { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:387:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:388:5 | LL | #[should_panic] struct S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:390:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:391:5 | LL | #[should_panic] type T = S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:393:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:394:5 | LL | #[should_panic] impl S { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:378:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:379:1 | LL | #[should_panic] | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:400:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:401:17 | LL | mod inner { #![ignore] } | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:403:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:404:5 | LL | #[ignore] fn f() { } | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:406:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:407:5 | LL | #[ignore] struct S; | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:409:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:410:5 | LL | #[ignore] type T = S; | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:412:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:413:5 | LL | #[ignore] impl S { } | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:397:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:398:1 | LL | #[ignore] | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:419:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:420:17 | LL | mod inner { #![no_implicit_prelude] } | ^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:422:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:423:5 | LL | #[no_implicit_prelude] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:425:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:426:5 | LL | #[no_implicit_prelude] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:428:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:429:5 | LL | #[no_implicit_prelude] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:431:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:432:5 | LL | #[no_implicit_prelude] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:416:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:417:1 | LL | #[no_implicit_prelude] | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:438:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:439:17 | LL | mod inner { #![reexport_test_harness_main="2900"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:441:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:442:5 | LL | #[reexport_test_harness_main = "2900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:444:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:445:5 | LL | #[reexport_test_harness_main = "2900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:447:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:448:5 | LL | #[reexport_test_harness_main = "2900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:450:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:451:5 | LL | #[reexport_test_harness_main = "2900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:435:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:436:1 | LL | #[reexport_test_harness_main = "2900"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:461:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:462:5 | LL | #[macro_escape] fn f() { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:464:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:465:5 | LL | #[macro_escape] struct S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:467:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:468:5 | LL | #[macro_escape] type T = S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:470:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:471:5 | LL | #[macro_escape] impl S { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:478:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:479:17 | LL | mod inner { #![no_std] } | ^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:478:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:479:17 | LL | mod inner { #![no_std] } | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:482:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:483:5 | LL | #[no_std] fn f() { } | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:482:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:483:5 | LL | #[no_std] fn f() { } | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:486:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:487:5 | LL | #[no_std] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:486:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:487:5 | LL | #[no_std] struct S; | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:490:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:491:5 | LL | #[no_std] type T = S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:490:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:491:5 | LL | #[no_std] type T = S; | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:494:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:495:5 | LL | #[no_std] impl S { } | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:494:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:495:5 | LL | #[no_std] impl S { } | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:474:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:475:1 | LL | #[no_std] | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:474:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:475:1 | LL | #[no_std] | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:633:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:634:17 | LL | mod inner { #![crate_name="0900"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:633:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:634:17 | LL | mod inner { #![crate_name="0900"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:637:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:638:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:637:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:638:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:641:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:642:5 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:641:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:642:5 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:645:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:646:5 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:645:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:646:5 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:649:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:650:5 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:649:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:650:5 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:629:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:630:1 | LL | #[crate_name = "0900"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:629:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:630:1 | LL | #[crate_name = "0900"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:658:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:659:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:658:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:659:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:662:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:663:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:662:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:663:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:666:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:667:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:666:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:667:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:670:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:671:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:670:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:671:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:674:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:675:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:674:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:675:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:654:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:655:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:654:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:655:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:683:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:684:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:683:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:684:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:687:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:688:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:687:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:688:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:692:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:692:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:695:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:696:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:695:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:696:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:699:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:700:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:699:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:700:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:679:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:680:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:679:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:680:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:709:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:710:17 | LL | mod inner { #![no_main] } | ^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:709:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:710:17 | LL | mod inner { #![no_main] } | ^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:713:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:714:5 | LL | #[no_main] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:713:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:714:5 | LL | #[no_main] fn f() { } | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:717:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:718:5 | LL | #[no_main] struct S; | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:717:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:718:5 | LL | #[no_main] struct S; | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:721:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:722:5 | LL | #[no_main] type T = S; | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:721:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:722:5 | LL | #[no_main] type T = S; | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:725:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:726:5 | LL | #[no_main] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:725:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:726:5 | LL | #[no_main] impl S { } | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:705:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:706:1 | LL | #[no_main] | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:705:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:706:1 | LL | #[no_main] | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:747:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:748:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:747:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:748:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:751:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:752:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:751:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:752:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:755:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:756:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:755:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:756:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:759:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:760:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:759:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:760:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:763:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:764:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:763:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:764:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:743:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:744:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:743:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:744:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:772:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:773:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:772:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:773:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:776:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:777:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:776:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:777:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:780:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:781:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:780:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:781:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:784:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:785:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:784:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:785:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:788:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:788:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:768:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:769:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:768:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:769:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:43:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:44:1 | LL | #![macro_export] | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:44:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:45:1 | LL | #![plugin_registrar] | ^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:47:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:48:1 | LL | #![main] | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:48:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:49:1 | LL | #![start] | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:51:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:52:1 | LL | #![repr()] | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:54:1 | LL | #![path = "3800"] | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:54:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:55:1 | LL | #![automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:56:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:57:1 | LL | #![no_link] | ^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:58:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:59:1 | LL | #![should_panic] | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:59:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:60:1 | LL | #![ignore] | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:65:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:66:1 | LL | #![proc_macro_derive()] | ^^^^^^^^^^^^^^^^^^^^^^^ -error: invalid windows subsystem `1000`, only `windows` and `console` are allowed - -error: aborting due to previous error - diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.rs b/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.rs index 360d570b65061..5e1d08dd919d0 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.rs @@ -5,8 +5,7 @@ // // (For non-crate-level cases, see issue-43106-gating-of-builtin-attrs.rs) -// compile-pass -// skip-codegen +// check-pass #![deprecated] diff --git a/src/test/ui/glob-cycles.rs b/src/test/ui/glob-cycles.rs index 84f9e5d843608..f354cc885d00d 100644 --- a/src/test/ui/glob-cycles.rs +++ b/src/test/ui/glob-cycles.rs @@ -1,5 +1,5 @@ -// compile-pass -// skip-codegen +// check-pass + mod foo { pub use bar::*; pub use main as f; @@ -15,5 +15,4 @@ mod baz { pub use super::*; } - pub fn main() {} diff --git a/src/test/ui/hygiene/assoc_ty_bindings.rs b/src/test/ui/hygiene/assoc_ty_bindings.rs index eb0ca6a7d5f76..93cf7591a0db2 100644 --- a/src/test/ui/hygiene/assoc_ty_bindings.rs +++ b/src/test/ui/hygiene/assoc_ty_bindings.rs @@ -1,8 +1,8 @@ +// check-pass // ignore-pretty pretty-printing is unhygienic #![feature(decl_macro, associated_type_defaults)] -// compile-pass -// skip-codegen + trait Base { type AssocTy; fn f(); @@ -35,5 +35,4 @@ macro mac() { mac!(); - fn main() {} diff --git a/src/test/ui/if/if-loop.rs b/src/test/ui/if/if-loop.rs index c799df2380013..06d0bdf456cdb 100644 --- a/src/test/ui/if/if-loop.rs +++ b/src/test/ui/if/if-loop.rs @@ -1,10 +1,8 @@ -// compile-pass -// skip-codegen -#![allow(warnings)] +// check-pass + // This used to ICE because the "if" being unreachable was not handled correctly fn err() { if loop {} {} } - fn main() {} diff --git a/src/test/ui/imports/import-crate-var.rs b/src/test/ui/imports/import-crate-var.rs index ab260500bb31f..b9d146d3735f2 100644 --- a/src/test/ui/imports/import-crate-var.rs +++ b/src/test/ui/imports/import-crate-var.rs @@ -1,10 +1,8 @@ +// check-pass // aux-build:import_crate_var.rs -// compile-pass -// skip-codegen #[macro_use] extern crate import_crate_var; - fn main() { m!(); //~^ WARN `$crate` may not be imported diff --git a/src/test/ui/imports/import-crate-var.stderr b/src/test/ui/imports/import-crate-var.stderr index 4c358a81cc1a4..2f8c845156a82 100644 --- a/src/test/ui/imports/import-crate-var.stderr +++ b/src/test/ui/imports/import-crate-var.stderr @@ -1,5 +1,5 @@ warning: `$crate` may not be imported - --> $DIR/import-crate-var.rs:9:5 + --> $DIR/import-crate-var.rs:7:5 | LL | m!(); | ^^^^^ diff --git a/src/test/ui/issues/issue-11740.rs b/src/test/ui/issues/issue-11740.rs index 47bdf085ee5db..dc10a205f2418 100644 --- a/src/test/ui/issues/issue-11740.rs +++ b/src/test/ui/issues/issue-11740.rs @@ -1,6 +1,5 @@ -// compile-pass -// skip-codegen -#![allow(warnings)] +// check-pass + struct Attr { name: String, value: String, @@ -21,7 +20,6 @@ impl Element { } } - fn main() { let element = Element { attrs: Vec::new() }; let _ = unsafe { element.get_attr("foo") }; diff --git a/src/test/ui/issues/issue-16994.rs b/src/test/ui/issues/issue-16994.rs index d5f1b1310eb5c..8d3074bcee9cc 100644 --- a/src/test/ui/issues/issue-16994.rs +++ b/src/test/ui/issues/issue-16994.rs @@ -1,10 +1,9 @@ -// compile-pass -// skip-codegen +// check-pass + fn cb<'a,T>(_x: Box, bool))) -> T>) -> T { panic!() } - fn main() { cb(Box::new(|(k, &(ref v, b))| (*k, v.clone(), b))); } diff --git a/src/test/ui/issues/issue-19601.rs b/src/test/ui/issues/issue-19601.rs index faaa2db370eea..176e6ba410670 100644 --- a/src/test/ui/issues/issue-19601.rs +++ b/src/test/ui/issues/issue-19601.rs @@ -1,9 +1,6 @@ -// compile-pass -// skip-codegen -#![allow(warnings)] +// check-pass + trait A {} struct B where B: A> { t: T } - -fn main() { -} +fn main() {} diff --git a/src/test/ui/issues/issue-22603.rs b/src/test/ui/issues/issue-22603.rs index e298316f3b98e..a83e291f999ab 100644 --- a/src/test/ui/issues/issue-22603.rs +++ b/src/test/ui/issues/issue-22603.rs @@ -1,6 +1,7 @@ -// skip-codegen -// compile-pass +// check-pass + #![feature(unboxed_closures, fn_traits)] + struct Foo; impl FnOnce<(A,)> for Foo { diff --git a/src/test/ui/issues/issue-22789.rs b/src/test/ui/issues/issue-22789.rs index e6680124f85a8..cef4075376686 100644 --- a/src/test/ui/issues/issue-22789.rs +++ b/src/test/ui/issues/issue-22789.rs @@ -1,6 +1,7 @@ -// compile-pass -// skip-codegen +// check-pass + #![feature(unboxed_closures, fn_traits)] + fn main() { let k = |x: i32| { x + 1 }; Fn::call(&k, (0,)); diff --git a/src/test/ui/issues/issue-22933-1.rs b/src/test/ui/issues/issue-22933-1.rs index 1bf8cb01cf7b5..3c9aa26697907 100644 --- a/src/test/ui/issues/issue-22933-1.rs +++ b/src/test/ui/issues/issue-22933-1.rs @@ -1,6 +1,5 @@ -// compile-pass -// skip-codegen -#![allow(warnings)] +// check-pass + struct CNFParser { token: char, } @@ -14,12 +13,11 @@ impl CNFParser { self.consume_while(&(CNFParser::is_whitespace)) } - fn consume_while(&mut self, p: &Fn(char) -> bool) { + fn consume_while(&mut self, p: &dyn Fn(char) -> bool) { while p(self.token) { return } } } - fn main() {} diff --git a/src/test/ui/issues/issue-24883.rs b/src/test/ui/issues/issue-24883.rs index 1aa62d3a3b6ed..819a20ddbda92 100644 --- a/src/test/ui/issues/issue-24883.rs +++ b/src/test/ui/issues/issue-24883.rs @@ -1,5 +1,5 @@ -// compile-pass -// skip-codegen +// check-pass + mod a { pub mod b { pub struct Foo; } @@ -11,7 +11,6 @@ mod a { pub use self::c::*; } - fn main() { let _ = a::c::Bar(a::b::Foo); let _ = a::Bar(a::b::Foo); diff --git a/src/test/ui/issues/issue-26614.rs b/src/test/ui/issues/issue-26614.rs index 11c22020733bb..b8ebbdc5abc3e 100644 --- a/src/test/ui/issues/issue-26614.rs +++ b/src/test/ui/issues/issue-26614.rs @@ -1,6 +1,5 @@ -// compile-pass -// skip-codegen -#![allow(warnings)] +// check-pass + trait Mirror { type It; } @@ -9,8 +8,6 @@ impl Mirror for T { type It = Self; } - - fn main() { let c: ::It = 5; const CCCC: ::It = 5; diff --git a/src/test/ui/issues/issue-26930.rs b/src/test/ui/issues/issue-26930.rs index abf6b933c3b5f..707e71b11249d 100644 --- a/src/test/ui/issues/issue-26930.rs +++ b/src/test/ui/issues/issue-26930.rs @@ -1,10 +1,8 @@ -// compile-pass -// skip-codegen -#![allow(unused)] +// check-pass + extern crate core; use core as core_export; use self::x::*; mod x {} - fn main() {} diff --git a/src/test/ui/issues/issue-29857.rs b/src/test/ui/issues/issue-29857.rs index 5aff968bb6a89..6f4c5f45d0d9c 100644 --- a/src/test/ui/issues/issue-29857.rs +++ b/src/test/ui/issues/issue-29857.rs @@ -1,5 +1,4 @@ -// compile-pass -// skip-codegen +// check-pass use std::marker::PhantomData; @@ -17,5 +16,4 @@ pub trait Bar { impl> Foo<*mut T> for W {} - fn main() {} diff --git a/src/test/ui/issues/issue-31924-non-snake-ffi.rs b/src/test/ui/issues/issue-31924-non-snake-ffi.rs index 5e2336cce2cc5..63e42b484427e 100644 --- a/src/test/ui/issues/issue-31924-non-snake-ffi.rs +++ b/src/test/ui/issues/issue-31924-non-snake-ffi.rs @@ -1,8 +1,8 @@ -// compile-pass -// skip-codegen +// check-pass + #![deny(non_snake_case)] -#[no_mangle] -pub extern "C" fn SparklingGenerationForeignFunctionInterface() {} +#[no_mangle] +pub extern "C" fn SparklingGenerationForeignFunctionInterface() {} // OK fn main() {} diff --git a/src/test/ui/issues/issue-32119.rs b/src/test/ui/issues/issue-32119.rs index ea8824b7966e8..36adb5289aca5 100644 --- a/src/test/ui/issues/issue-32119.rs +++ b/src/test/ui/issues/issue-32119.rs @@ -1,6 +1,5 @@ -// compile-pass -// skip-codegen -#![allow(dead_code)] +// check-pass + pub type T = (); mod foo { pub use super::T; } mod bar { pub use super::T; } @@ -15,5 +14,4 @@ mod baz { pub use self::bar::*; } - fn main() {} diff --git a/src/test/ui/issues/issue-32222.rs b/src/test/ui/issues/issue-32222.rs index 91f53ab2805a8..4ed06bff80341 100644 --- a/src/test/ui/issues/issue-32222.rs +++ b/src/test/ui/issues/issue-32222.rs @@ -1,6 +1,4 @@ -// compile-pass -// skip-codegen -#![allow(warnings)] +// check-pass mod foo { pub fn bar() {} @@ -21,5 +19,4 @@ mod b { pub use a::bar; } - fn main() {} diff --git a/src/test/ui/issues/issue-32797.rs b/src/test/ui/issues/issue-32797.rs index 5ceb7f49331e5..b12b929f8fcf8 100644 --- a/src/test/ui/issues/issue-32797.rs +++ b/src/test/ui/issues/issue-32797.rs @@ -1,5 +1,4 @@ -// compile-pass -// skip-codegen +// check-pass pub use bar::*; mod bar { @@ -11,5 +10,4 @@ mod baz { pub use main as f; } - pub fn main() {} diff --git a/src/test/ui/issues/issue-32922.rs b/src/test/ui/issues/issue-32922.rs index b06b63cbdc3ff..54ec44a1cf4e5 100644 --- a/src/test/ui/issues/issue-32922.rs +++ b/src/test/ui/issues/issue-32922.rs @@ -1,6 +1,4 @@ -// compile-pass -// skip-codegen -#![allow(warnings)] +// check-pass macro_rules! foo { () => { let x = 1; @@ -22,7 +20,6 @@ macro_rules! baz { } } - fn main() { foo! {}; bar! {}; diff --git a/src/test/ui/issues/issue-33241.rs b/src/test/ui/issues/issue-33241.rs index 4d6204cb28832..5f9f1e4a74211 100644 --- a/src/test/ui/issues/issue-33241.rs +++ b/src/test/ui/issues/issue-33241.rs @@ -1,5 +1,4 @@ -// compile-pass -// skip-codegen +// check-pass use std::fmt; @@ -7,7 +6,6 @@ use std::fmt; // an unsized tuple by transmuting a trait object. fn any() -> T { unreachable!() } - fn main() { let t: &(u8, dyn fmt::Debug) = any(); println!("{:?}", &t.1); diff --git a/src/test/ui/issues/issue-34028.rs b/src/test/ui/issues/issue-34028.rs index 8ebc730755faa..d761c0c823bcd 100644 --- a/src/test/ui/issues/issue-34028.rs +++ b/src/test/ui/issues/issue-34028.rs @@ -1,5 +1,4 @@ -// compile-pass -// skip-codegen +// check-pass macro_rules! m { () => { #[cfg(any())] fn f() {} } @@ -8,5 +7,4 @@ macro_rules! m { trait T {} impl T for () { m!(); } - fn main() {} diff --git a/src/test/ui/issues/issue-34171.rs b/src/test/ui/issues/issue-34171.rs index 25a5f72e803ba..157c58c459d66 100644 --- a/src/test/ui/issues/issue-34171.rs +++ b/src/test/ui/issues/issue-34171.rs @@ -1,12 +1,10 @@ -// compile-pass -// skip-codegen +// check-pass macro_rules! null { ($i:tt) => {} } macro_rules! apply_null { ($i:item) => { null! { $i } } } - fn main() { apply_null!(#[cfg(all())] fn f() {}); } diff --git a/src/test/ui/issues/issue-34418.rs b/src/test/ui/issues/issue-34418.rs index 6a86c277eafa6..6132f744b50a9 100644 --- a/src/test/ui/issues/issue-34418.rs +++ b/src/test/ui/issues/issue-34418.rs @@ -1,6 +1,4 @@ -// compile-pass -// skip-codegen -#![allow(unused)] +// check-pass macro_rules! make_item { () => { fn f() {} } @@ -18,5 +16,4 @@ fn g() { make_stmt! {} } - fn main() {} diff --git a/src/test/ui/issues/issue-34839.rs b/src/test/ui/issues/issue-34839.rs index 01669f01e2ff4..8ffed827e9087 100644 --- a/src/test/ui/issues/issue-34839.rs +++ b/src/test/ui/issues/issue-34839.rs @@ -1,6 +1,4 @@ -// compile-pass -// skip-codegen -#![allow(dead_code)] +// check-pass trait RegularExpression: Sized { type Text; @@ -18,5 +16,4 @@ enum FindCapturesInner<'r, 't> { Dynamic(FindCaptures<'t, ExecNoSyncStr<'r>>), } - fn main() {} diff --git a/src/test/ui/issues/issue-35570.rs b/src/test/ui/issues/issue-35570.rs index 9bb9db63951c3..fafef79ea5b86 100644 --- a/src/test/ui/issues/issue-35570.rs +++ b/src/test/ui/issues/issue-35570.rs @@ -1,5 +1,4 @@ -// compile-pass -// skip-codegen +// check-pass use std::mem; @@ -25,7 +24,6 @@ fn foo<'a>(x: &'a ()) -> <() as Lifetime<'a>>::Out { fn takes_lifetime(_f: for<'a> fn(&'a ()) -> <() as Lifetime<'a>>::Out) { } - fn main() { takes_lifetime(foo); } diff --git a/src/test/ui/issues/issue-36116.rs b/src/test/ui/issues/issue-36116.rs index b4bfba4d6e5d7..c7c70c7afe743 100644 --- a/src/test/ui/issues/issue-36116.rs +++ b/src/test/ui/issues/issue-36116.rs @@ -1,8 +1,7 @@ // Unnecessary path disambiguator is ok -// compile-pass -// skip-codegen -#![allow(unused)] +// check-pass + macro_rules! m { ($p: path) => { let _ = $p(0); @@ -23,5 +22,4 @@ fn f() { m!(S::); } - fn main() {} diff --git a/src/test/ui/issues/issue-36379.rs b/src/test/ui/issues/issue-36379.rs index b2da65131fb17..3a3e6f47067d9 100644 --- a/src/test/ui/issues/issue-36379.rs +++ b/src/test/ui/issues/issue-36379.rs @@ -1,7 +1,5 @@ -// compile-pass -// skip-codegen +// check-pass fn _test() -> impl Default { } - -fn main() { } +fn main() {} diff --git a/src/test/ui/issues/issue-36839.rs b/src/test/ui/issues/issue-36839.rs index a660368f40153..ca3d66b1c8eb7 100644 --- a/src/test/ui/issues/issue-36839.rs +++ b/src/test/ui/issues/issue-36839.rs @@ -1,5 +1,4 @@ -// compile-pass -// skip-codegen +// check-pass pub trait Foo { type Bar; @@ -17,7 +16,6 @@ impl Broken for T { } } - fn main() { let _m: &dyn Broken = &(); } diff --git a/src/test/ui/issues/issue-37051.rs b/src/test/ui/issues/issue-37051.rs index 1ccf5b9780190..9cae6cf5e7665 100644 --- a/src/test/ui/issues/issue-37051.rs +++ b/src/test/ui/issues/issue-37051.rs @@ -1,7 +1,7 @@ -// compile-pass -// skip-codegen +// check-pass + #![feature(associated_type_defaults)] -#![allow(warnings)] + trait State: Sized { type NextState: State = StateMachineEnded; fn execute(self) -> Option; @@ -15,6 +15,4 @@ impl State for StateMachineEnded { } } - -fn main() { -} +fn main() {} diff --git a/src/test/ui/issues/issue-37366.rs b/src/test/ui/issues/issue-37366.rs index 1c27960e9afb2..6bf3a276ce138 100644 --- a/src/test/ui/issues/issue-37366.rs +++ b/src/test/ui/issues/issue-37366.rs @@ -1,6 +1,6 @@ +// check-pass // ignore-emscripten -// compile-pass -// skip-codegen + #![feature(asm)] macro_rules! interrupt_handler { @@ -12,6 +12,4 @@ macro_rules! interrupt_handler { } interrupt_handler!{} - -fn main() { -} +fn main() {} diff --git a/src/test/ui/issues/issue-37510.rs b/src/test/ui/issues/issue-37510.rs index 465e680995704..2081c9f7e26ec 100644 --- a/src/test/ui/issues/issue-37510.rs +++ b/src/test/ui/issues/issue-37510.rs @@ -1,9 +1,7 @@ -// compile-pass -// skip-codegen +// check-pass fn foo(_: &mut i32) -> bool { true } - fn main() { let opt = Some(92); let mut x = 62; diff --git a/src/test/ui/issues/issue-37515.rs b/src/test/ui/issues/issue-37515.rs index cc07bd1d91509..caff507c91833 100644 --- a/src/test/ui/issues/issue-37515.rs +++ b/src/test/ui/issues/issue-37515.rs @@ -1,10 +1,8 @@ -// skip-codegen -// compile-pass +// check-pass + #![warn(unused)] type Z = dyn for<'x> Send; //~^ WARN type alias is never used - -fn main() { -} +fn main() {} diff --git a/src/test/ui/issues/issue-38160.rs b/src/test/ui/issues/issue-38160.rs index a454211c4df87..0da8b7900a8a5 100644 --- a/src/test/ui/issues/issue-38160.rs +++ b/src/test/ui/issues/issue-38160.rs @@ -1,7 +1,5 @@ -// compile-pass -// skip-codegen -#![feature(associated_consts)] -#![allow(warnings)] +// check-pass + trait MyTrait { const MY_CONST: &'static str; } @@ -18,5 +16,4 @@ macro_rules! my_macro { my_macro!(); - fn main() {} diff --git a/src/test/ui/issues/issue-38381.rs b/src/test/ui/issues/issue-38381.rs index 135137690e577..82d4a4e325ac0 100644 --- a/src/test/ui/issues/issue-38381.rs +++ b/src/test/ui/issues/issue-38381.rs @@ -1,9 +1,7 @@ -// compile-pass -// skip-codegen +// check-pass use std::ops::Deref; - fn main() { let _x: fn(&i32) -> <&i32 as Deref>::Target = unimplemented!(); } diff --git a/src/test/ui/issues/issue-40350.rs b/src/test/ui/issues/issue-40350.rs index b2cc0047bb885..a39a8519aa986 100644 --- a/src/test/ui/issues/issue-40350.rs +++ b/src/test/ui/issues/issue-40350.rs @@ -1,6 +1,4 @@ -// compile-pass -// skip-codegen -#![allow(warnings)] +// check-pass enum E { A = { @@ -9,5 +7,4 @@ enum E { } } - fn main() {} diff --git a/src/test/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs b/src/test/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs index 5a008ad26b444..a558e8a1813fd 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs +++ b/src/test/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs @@ -1,12 +1,11 @@ // Basic test for free regions in the NLL code. This test does not // report an error because of the (implied) bound that `'b: 'a`. +// check-pass // compile-flags:-Zborrowck=mir -Zverbose -// compile-pass -// skip-codegen fn foo<'a, 'b>(x: &'a &'b u32) -> &'a u32 { &**x } -fn main() { } +fn main() {} diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns_same_crate.rs b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns_same_crate.rs index 5dbd38e07df02..d1e7c3b4d518a 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns_same_crate.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns_same_crate.rs @@ -1,5 +1,5 @@ -// compile-pass -// skip-codegen +// check-pass + #![deny(unreachable_patterns)] #![feature(exhaustive_patterns)] #![feature(never_type)] diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns_same_crate.rs b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns_same_crate.rs index 74922d4bcb5d5..8973d21bff6fa 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns_same_crate.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns_same_crate.rs @@ -1,5 +1,5 @@ -// compile-pass -// skip-codegen +// check-pass + #![deny(unreachable_patterns)] #![feature(exhaustive_patterns)] #![feature(never_type)] diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-return.rs b/src/test/ui/single-use-lifetime/one-use-in-fn-return.rs index 876a0a564daf5..92b25cbf58410 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-return.rs +++ b/src/test/ui/single-use-lifetime/one-use-in-fn-return.rs @@ -1,20 +1,16 @@ -// compile-pass - -#![deny(single_use_lifetimes)] -#![allow(dead_code)] -#![allow(unused_variables)] - // Test that we DO NOT warn when lifetime name is used only // once in a fn return type -- using `'_` is not legal there, // as it must refer back to an argument. // // (Normally, using `'static` would be preferred, but there are // times when that is not what you want.) -// -// run-pass + +// compile-pass + +#![deny(single_use_lifetimes)] fn b<'a>() -> &'a u32 { // OK: used only in return type &22 } -fn main() { } +fn main() {} diff --git a/src/tools/clippy b/src/tools/clippy index 5a11ed7b92cc4..c5d1ecd4747d7 160000 --- a/src/tools/clippy +++ b/src/tools/clippy @@ -1 +1 @@ -Subproject commit 5a11ed7b92cc4cf40a4568a8fc1ff54b198c333b +Subproject commit c5d1ecd4747d73e0c8a62b82b97cb6d5f83db45f diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index ab5594f36050d..6ce7461f759a4 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -290,6 +290,13 @@ impl EarlyProps { } } +#[derive(Clone, Copy, PartialEq, Debug)] +pub enum PassMode { + Check, + Build, + Run, +} + #[derive(Clone, Debug)] pub struct TestProps { // Lines that should be expected, in order, on standard out @@ -349,14 +356,10 @@ pub struct TestProps { // testing harness and used when generating compilation // arguments. (In particular, it propagates to the aux-builds.) pub incremental_dir: Option, - // Specifies that a test must actually compile without errors. - pub compile_pass: bool, + // How far should the test proceed while still passing. + pub pass_mode: Option, // rustdoc will test the output of the `--test` option pub check_test_line_numbers_match: bool, - // The test must be compiled and run successfully. Only used in UI tests for now. - pub run_pass: bool, - // Skip any codegen step and running the executable. Only for run-pass. - pub skip_codegen: bool, // Do not pass `-Z ui-testing` to UI tests pub disable_ui_testing_normalization: bool, // customized normalization rules @@ -396,10 +399,8 @@ impl TestProps { pretty_compare_only: false, forbid_output: vec![], incremental_dir: None, - compile_pass: false, + pass_mode: None, check_test_line_numbers_match: false, - run_pass: false, - skip_codegen: false, disable_ui_testing_normalization: false, normalize_stdout: vec![], normalize_stderr: vec![], @@ -525,18 +526,7 @@ impl TestProps { self.check_test_line_numbers_match = config.parse_check_test_line_numbers_match(ln); } - if !self.run_pass { - self.run_pass = config.parse_run_pass(ln); - } - - if !self.compile_pass { - // run-pass implies compile_pass - self.compile_pass = config.parse_compile_pass(ln) || self.run_pass; - } - - if !self.skip_codegen { - self.skip_codegen = config.parse_skip_codegen(ln); - } + self.update_pass_mode(ln, cfg, config); if !self.disable_ui_testing_normalization { self.disable_ui_testing_normalization = @@ -583,6 +573,41 @@ impl TestProps { } } } + + fn update_pass_mode(&mut self, ln: &str, revision: Option<&str>, config: &Config) { + let check_no_run = |s| { + if config.mode != Mode::Ui && config.mode != Mode::Incremental { + panic!("`{}` header is only supported in UI and incremental tests", s); + } + if config.mode == Mode::Incremental && + !revision.map_or(false, |r| r.starts_with("cfail")) && + !self.revisions.iter().all(|r| r.starts_with("cfail")) { + panic!("`{}` header is only supported in `cfail` incremental tests", s); + } + }; + let pass_mode = if config.parse_name_directive(ln, "check-pass") { + check_no_run("check-pass"); + Some(PassMode::Check) + } else if config.parse_name_directive(ln, "build-pass") { + check_no_run("build-pass"); + Some(PassMode::Build) + } else if config.parse_name_directive(ln, "compile-pass") /* compatibility */ { + check_no_run("compile-pass"); + Some(PassMode::Build) + } else if config.parse_name_directive(ln, "run-pass") { + if config.mode != Mode::Ui && config.mode != Mode::RunPass /* compatibility */ { + panic!("`run-pass` header is only supported in UI tests") + } + Some(PassMode::Run) + } else { + None + }; + match (self.pass_mode, pass_mode) { + (None, Some(_)) => self.pass_mode = pass_mode, + (Some(_), Some(_)) => panic!("multiple `*-pass` headers in a single test"), + (_, None) => {} + } + } } fn iter_header(testfile: &Path, cfg: Option<&str>, it: &mut dyn FnMut(&str)) { @@ -710,10 +735,6 @@ impl Config { } } - fn parse_compile_pass(&self, line: &str) -> bool { - self.parse_name_directive(line, "compile-pass") - } - fn parse_disable_ui_testing_normalization(&self, line: &str) -> bool { self.parse_name_directive(line, "disable-ui-testing-normalization") } @@ -722,14 +743,6 @@ impl Config { self.parse_name_directive(line, "check-test-line-numbers-match") } - fn parse_run_pass(&self, line: &str) -> bool { - self.parse_name_directive(line, "run-pass") - } - - fn parse_skip_codegen(&self, line: &str) -> bool { - self.parse_name_directive(line, "skip-codegen") - } - fn parse_assembly_output(&self, line: &str) -> Option { self.parse_name_value_directive(line, "assembly-output") .map(|r| r.trim().to_string()) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index d87bd66a1ac70..8b52a529d440a 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -10,7 +10,7 @@ use crate::common::{Config, TestPaths}; use crate::common::{Incremental, MirOpt, RunMake, Ui, JsDocTest, Assembly}; use diff; use crate::errors::{self, Error, ErrorKind}; -use crate::header::TestProps; +use crate::header::{TestProps, PassMode}; use crate::json; use regex::{Captures, Regex}; use rustfix::{apply_suggestions, get_suggestions_from_json, Filter}; @@ -310,20 +310,19 @@ impl<'test> TestCx<'test> { } fn should_run_successfully(&self) -> bool { - let run_pass = match self.config.mode { + match self.config.mode { RunPass => true, - Ui => self.props.run_pass, - _ => unimplemented!(), - }; - return run_pass && !self.props.skip_codegen; + Ui => self.props.pass_mode == Some(PassMode::Run), + mode => panic!("unimplemented for mode {:?}", mode), + } } fn should_compile_successfully(&self) -> bool { match self.config.mode { - CompileFail => self.props.compile_pass, + CompileFail => false, RunPass => true, JsDocTest => true, - Ui => self.props.compile_pass, + Ui => self.props.pass_mode.is_some(), Incremental => { let revision = self.revision .expect("incremental tests require a list of revisions"); @@ -331,7 +330,7 @@ impl<'test> TestCx<'test> { true } else if revision.starts_with("cfail") { // FIXME: would be nice if incremental revs could start with "cpass" - self.props.compile_pass + self.props.pass_mode.is_some() } else { panic!("revision name must begin with rpass, rfail, or cfail"); } @@ -433,11 +432,9 @@ impl<'test> TestCx<'test> { "run-pass tests with expected warnings should be moved to ui/" ); - if !self.props.skip_codegen { - let proc_res = self.exec_compiled_test(); - if !proc_res.status.success() { - self.fatal_proc_rec("test run failed!", &proc_res); - } + let proc_res = self.exec_compiled_test(); + if !proc_res.status.success() { + self.fatal_proc_rec("test run failed!", &proc_res); } } @@ -1344,7 +1341,7 @@ impl<'test> TestCx<'test> { fn check_error_patterns(&self, output_to_check: &str, proc_res: &ProcRes) { debug!("check_error_patterns"); if self.props.error_patterns.is_empty() { - if self.props.compile_pass { + if self.props.pass_mode.is_some() { return; } else { self.fatal(&format!( @@ -1971,7 +1968,7 @@ impl<'test> TestCx<'test> { } } - if self.props.skip_codegen { + if self.props.pass_mode == Some(PassMode::Check) { assert!( !self .props diff --git a/src/tools/tidy/Cargo.toml b/src/tools/tidy/Cargo.toml index eeac6cfbb30e0..43cae31f33f1f 100644 --- a/src/tools/tidy/Cargo.toml +++ b/src/tools/tidy/Cargo.toml @@ -8,3 +8,5 @@ edition = "2018" regex = "1" serde = { version = "1.0.8", features = ["derive"] } serde_json = "1.0.2" +lazy_static = "1" +walkdir = "2" diff --git a/src/tools/tidy/src/bins.rs b/src/tools/tidy/src/bins.rs index 610d1d8af3b5e..680585a6e04a7 100644 --- a/src/tools/tidy/src/bins.rs +++ b/src/tools/tidy/src/bins.rs @@ -25,16 +25,17 @@ pub fn check(path: &Path, bad: &mut bool) { } } - super::walk(path, + super::walk_no_read(path, &mut |path| super::filter_dirs(path) || path.ends_with("src/etc"), - &mut |file| { + &mut |entry| { + let file = entry.path(); let filename = file.file_name().unwrap().to_string_lossy(); let extensions = [".py", ".sh"]; if extensions.iter().any(|e| filename.ends_with(e)) { return; } - let metadata = t!(fs::symlink_metadata(&file), &file); + let metadata = t!(entry.metadata(), file); if metadata.mode() & 0o111 != 0 { let rel_path = file.strip_prefix(path).unwrap(); let git_friendly_path = rel_path.to_str().unwrap().replace("\\", "/"); diff --git a/src/tools/tidy/src/errors.rs b/src/tools/tidy/src/errors.rs index ef1000ee5065a..1bc27745376cc 100644 --- a/src/tools/tidy/src/errors.rs +++ b/src/tools/tidy/src/errors.rs @@ -4,24 +4,19 @@ //! statistics about the error codes. use std::collections::HashMap; -use std::fs::File; -use std::io::prelude::*; use std::path::Path; pub fn check(path: &Path, bad: &mut bool) { - let mut contents = String::new(); let mut map: HashMap<_, Vec<_>> = HashMap::new(); super::walk(path, &mut |path| super::filter_dirs(path) || path.ends_with("src/test"), - &mut |file| { + &mut |entry, contents| { + let file = entry.path(); let filename = file.file_name().unwrap().to_string_lossy(); if filename != "error_codes.rs" { return } - contents.truncate(0); - t!(t!(File::open(file)).read_to_string(&mut contents)); - // In the `register_long_diagnostics!` macro, entries look like this: // // ``` diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index 637f10c5ae745..1841beb1fd116 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -11,11 +11,10 @@ use std::collections::HashMap; use std::fmt; -use std::fs::{self, File}; -use std::io::prelude::*; +use std::fs; use std::path::Path; -use regex::{Regex, escape}; +use regex::Regex; mod version; use version::Version; @@ -51,20 +50,48 @@ pub struct Feature { pub type Features = HashMap; -pub fn check(path: &Path, bad: &mut bool, quiet: bool) { +pub struct CollectedFeatures { + pub lib: Features, + pub lang: Features, +} + +// Currently only used for unstable book generation +pub fn collect_lib_features(base_src_path: &Path) -> Features { + let mut lib_features = Features::new(); + + // This library feature is defined in the `compiler_builtins` crate, which + // has been moved out-of-tree. Now it can no longer be auto-discovered by + // `tidy`, because we need to filter out its (submodule) directory. Manually + // add it to the set of known library features so we can still generate docs. + lib_features.insert("compiler_builtins_lib".to_owned(), Feature { + level: Status::Unstable, + since: None, + has_gate_test: false, + tracking_issue: None, + }); + + map_lib_features(base_src_path, + &mut |res, _, _| { + if let Ok((name, feature)) = res { + lib_features.insert(name.to_owned(), feature); + } + }); + lib_features +} + +pub fn check(path: &Path, bad: &mut bool, verbose: bool) -> CollectedFeatures { let mut features = collect_lang_features(path, bad); assert!(!features.is_empty()); let lib_features = get_and_check_lib_features(path, bad, &features); assert!(!lib_features.is_empty()); - let mut contents = String::new(); - super::walk_many(&[&path.join("test/ui"), &path.join("test/ui-fulldeps"), &path.join("test/compile-fail")], &mut |path| super::filter_dirs(path), - &mut |file| { + &mut |entry, contents| { + let file = entry.path(); let filename = file.file_name().unwrap().to_string_lossy(); if !filename.ends_with(".rs") || filename == "features.rs" || filename == "diagnostic_list.rs" { @@ -74,9 +101,6 @@ pub fn check(path: &Path, bad: &mut bool, quiet: bool) { let filen_underscore = filename.replace('-',"_").replace(".rs",""); let filename_is_gate_test = test_filen_gate(&filen_underscore, &mut features); - contents.truncate(0); - t!(t!(File::open(&file), &file).read_to_string(&mut contents)); - for (i, line) in contents.lines().enumerate() { let mut err = |msg: &str| { tidy_error!(bad, "{}:{}: {}", file.display(), i + 1, msg); @@ -130,21 +154,23 @@ pub fn check(path: &Path, bad: &mut bool, quiet: bool) { } if *bad { - return; - } - if quiet { - println!("* {} features", features.len()); - return; + return CollectedFeatures { lib: lib_features, lang: features }; } - let mut lines = Vec::new(); - lines.extend(format_features(&features, "lang")); - lines.extend(format_features(&lib_features, "lib")); + if verbose { + let mut lines = Vec::new(); + lines.extend(format_features(&features, "lang")); + lines.extend(format_features(&lib_features, "lib")); - lines.sort(); - for line in lines { - println!("* {}", line); + lines.sort(); + for line in lines { + println!("* {}", line); + } + } else { + println!("* {} features", features.len()); } + + CollectedFeatures { lib: lib_features, lang: features } } fn format_features<'a>(features: &'a Features, family: &'a str) -> impl Iterator + 'a { @@ -159,8 +185,19 @@ fn format_features<'a>(features: &'a Features, family: &'a str) -> impl Iterator } fn find_attr_val<'a>(line: &'a str, attr: &str) -> Option<&'a str> { - let r = Regex::new(&format!(r#"{}\s*=\s*"([^"]*)""#, escape(attr))) - .expect("malformed regex for find_attr_val"); + lazy_static::lazy_static! { + static ref ISSUE: Regex = Regex::new(r#"issue\s*=\s*"([^"]*)""#).unwrap(); + static ref FEATURE: Regex = Regex::new(r#"feature\s*=\s*"([^"]*)""#).unwrap(); + static ref SINCE: Regex = Regex::new(r#"since\s*=\s*"([^"]*)""#).unwrap(); + } + + let r = match attr { + "issue" => &*ISSUE, + "feature" => &*FEATURE, + "since" => &*SINCE, + _ => unimplemented!("{} not handled", attr), + }; + r.captures(line) .and_then(|c| c.get(1)) .map(|m| m.as_str()) @@ -175,9 +212,11 @@ fn test_find_attr_val() { } fn test_filen_gate(filen_underscore: &str, features: &mut Features) -> bool { - if filen_underscore.starts_with("feature_gate") { + let prefix = "feature_gate_"; + if filen_underscore.starts_with(prefix) { for (n, f) in features.iter_mut() { - if filen_underscore == format!("feature_gate_{}", n) { + // Equivalent to filen_underscore == format!("feature_gate_{}", n) + if &filen_underscore[prefix.len()..] == n { f.has_gate_test = true; return true; } @@ -295,32 +334,6 @@ pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features { .collect() } -pub fn collect_lib_features(base_src_path: &Path) -> Features { - let mut lib_features = Features::new(); - - // This library feature is defined in the `compiler_builtins` crate, which - // has been moved out-of-tree. Now it can no longer be auto-discovered by - // `tidy`, because we need to filter out its (submodule) directory. Manually - // add it to the set of known library features so we can still generate docs. - lib_features.insert("compiler_builtins_lib".to_owned(), Feature { - level: Status::Unstable, - since: None, - has_gate_test: false, - tracking_issue: None, - }); - - map_lib_features(base_src_path, - &mut |res, _, _| { - if let Ok((name, feature)) = res { - if lib_features.contains_key(name) { - return; - } - lib_features.insert(name.to_owned(), feature); - } - }); - lib_features -} - fn get_and_check_lib_features(base_src_path: &Path, bad: &mut bool, lang_features: &Features) -> Features { @@ -355,20 +368,25 @@ fn get_and_check_lib_features(base_src_path: &Path, fn map_lib_features(base_src_path: &Path, mf: &mut dyn FnMut(Result<(&str, Feature), &str>, &Path, usize)) { - let mut contents = String::new(); super::walk(base_src_path, &mut |path| super::filter_dirs(path) || path.ends_with("src/test"), - &mut |file| { + &mut |entry, contents| { + let file = entry.path(); let filename = file.file_name().unwrap().to_string_lossy(); if !filename.ends_with(".rs") || filename == "features.rs" || filename == "diagnostic_list.rs" { return; } - contents.truncate(0); - t!(t!(File::open(&file), &file).read_to_string(&mut contents)); + // This is an early exit -- all the attributes we're concerned with must contain this: + // * rustc_const_unstable( + // * unstable( + // * stable( + if !contents.contains("stable(") { + return; + } - let mut becoming_feature: Option<(String, Feature)> = None; + let mut becoming_feature: Option<(&str, Feature)> = None; for (i, line) in contents.lines().enumerate() { macro_rules! err { ($msg:expr) => {{ @@ -447,7 +465,7 @@ fn map_lib_features(base_src_path: &Path, if line.contains(']') { mf(Ok((feature_name, feature)), file, i + 1); } else { - becoming_feature = Some((feature_name.to_owned(), feature)); + becoming_feature = Some((feature_name, feature)); } } }); diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs index d06c99725bc6a..a0bf0b0735418 100644 --- a/src/tools/tidy/src/lib.rs +++ b/src/tools/tidy/src/lib.rs @@ -3,7 +3,9 @@ //! This library contains the tidy lints and exposes it //! to be used by tools. -use std::fs; +use walkdir::{DirEntry, WalkDir}; +use std::fs::File; +use std::io::Read; use std::path::Path; @@ -65,25 +67,35 @@ fn filter_dirs(path: &Path) -> bool { skip.iter().any(|p| path.ends_with(p)) } -fn walk_many(paths: &[&Path], skip: &mut dyn FnMut(&Path) -> bool, f: &mut dyn FnMut(&Path)) { + +fn walk_many( + paths: &[&Path], skip: &mut dyn FnMut(&Path) -> bool, f: &mut dyn FnMut(&DirEntry, &str) +) { for path in paths { walk(path, skip, f); } } -fn walk(path: &Path, skip: &mut dyn FnMut(&Path) -> bool, f: &mut dyn FnMut(&Path)) { - if let Ok(dir) = fs::read_dir(path) { - for entry in dir { - let entry = t!(entry); - let kind = t!(entry.file_type()); - let path = entry.path(); - if kind.is_dir() { - if !skip(&path) { - walk(&path, skip, f); - } - } else { - f(&path); +fn walk(path: &Path, skip: &mut dyn FnMut(&Path) -> bool, f: &mut dyn FnMut(&DirEntry, &str)) { + let mut contents = String::new(); + walk_no_read(path, skip, &mut |entry| { + contents.clear(); + if t!(File::open(entry.path()), entry.path()).read_to_string(&mut contents).is_err() { + contents.clear(); + } + f(&entry, &contents); + }); +} + +fn walk_no_read(path: &Path, skip: &mut dyn FnMut(&Path) -> bool, f: &mut dyn FnMut(&DirEntry)) { + let walker = WalkDir::new(path).into_iter() + .filter_entry(|e| !skip(e.path())); + for entry in walker { + if let Ok(entry) = entry { + if entry.file_type().is_dir() { + continue; } + f(&entry); } } } diff --git a/src/tools/tidy/src/libcoretest.rs b/src/tools/tidy/src/libcoretest.rs index b15b9c3462f79..ea92f989ada7d 100644 --- a/src/tools/tidy/src/libcoretest.rs +++ b/src/tools/tidy/src/libcoretest.rs @@ -4,29 +4,22 @@ //! item. All tests must be written externally in `libcore/tests`. use std::path::Path; -use std::fs::read_to_string; pub fn check(path: &Path, bad: &mut bool) { let libcore_path = path.join("libcore"); super::walk( &libcore_path, &mut |subpath| t!(subpath.strip_prefix(&libcore_path)).starts_with("tests"), - &mut |subpath| { + &mut |entry, contents| { + let subpath = entry.path(); if let Some("rs") = subpath.extension().and_then(|e| e.to_str()) { - match read_to_string(subpath) { - Ok(contents) => { - if contents.contains("#[test]") { - tidy_error!( - bad, - "{} contains #[test]; libcore tests must be placed inside \ - `src/libcore/tests/`", - subpath.display() - ); - } - } - Err(err) => { - panic!("failed to read file {:?}: {}", subpath, err); - } + if contents.contains("#[test]") { + tidy_error!( + bad, + "{} contains #[test]; libcore tests must be placed inside \ + `src/libcore/tests/`", + subpath.display() + ); } } }, diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index eef3719043825..918762ed6e69a 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -19,14 +19,14 @@ fn main() { let args: Vec = env::args().skip(1).collect(); let mut bad = false; - let quiet = args.iter().any(|s| *s == "--quiet"); + let verbose = args.iter().any(|s| *s == "--verbose"); bins::check(&path, &mut bad); style::check(&path, &mut bad); errors::check(&path, &mut bad); cargo::check(&path, &mut bad); - features::check(&path, &mut bad, quiet); + let collected = features::check(&path, &mut bad, verbose); pal::check(&path, &mut bad); - unstable_book::check(&path, &mut bad); + unstable_book::check(&path, collected, &mut bad); libcoretest::check(&path, &mut bad); if !args.iter().any(|s| *s == "--no-vendor") { deps::check(&path, &mut bad); diff --git a/src/tools/tidy/src/pal.rs b/src/tools/tidy/src/pal.rs index d4a6cf73bf98c..c6bb16318b6ee 100644 --- a/src/tools/tidy/src/pal.rs +++ b/src/tools/tidy/src/pal.rs @@ -31,8 +31,6 @@ //! platform-specific cfgs are allowed. Not sure yet how to deal with //! this in the long term. -use std::fs::File; -use std::io::Read; use std::path::Path; use std::iter::Iterator; @@ -87,29 +85,26 @@ const EXCEPTION_PATHS: &[&str] = &[ ]; pub fn check(path: &Path, bad: &mut bool) { - let mut contents = String::new(); // Sanity check that the complex parsing here works. let mut saw_target_arch = false; let mut saw_cfg_bang = false; - super::walk(path, &mut super::filter_dirs, &mut |file| { + super::walk(path, &mut super::filter_dirs, &mut |entry, contents| { + let file = entry.path(); let filestr = file.to_string_lossy().replace("\\", "/"); if !filestr.ends_with(".rs") { return } let is_exception_path = EXCEPTION_PATHS.iter().any(|s| filestr.contains(&**s)); if is_exception_path { return } - check_cfgs(&mut contents, &file, bad, &mut saw_target_arch, &mut saw_cfg_bang); + check_cfgs(contents, &file, bad, &mut saw_target_arch, &mut saw_cfg_bang); }); assert!(saw_target_arch); assert!(saw_cfg_bang); } -fn check_cfgs(contents: &mut String, file: &Path, +fn check_cfgs(contents: &str, file: &Path, bad: &mut bool, saw_target_arch: &mut bool, saw_cfg_bang: &mut bool) { - contents.truncate(0); - t!(t!(File::open(file), file).read_to_string(contents)); - // For now it's ok to have platform-specific code after 'mod tests'. let mod_tests_idx = find_test_mod(contents); let contents = &contents[..mod_tests_idx]; diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index e860f2e9df0ad..4a159d926b7cc 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -13,8 +13,6 @@ //! A number of these checks can be opted-out of with various directives of the form: //! `// ignore-tidy-CHECK-NAME`. -use std::fs::File; -use std::io::prelude::*; use std::path::Path; const COLS: usize = 100; @@ -109,7 +107,11 @@ enum Directive { Ignore(bool), } -fn contains_ignore_directive(contents: &String, check: &str) -> Directive { +fn contains_ignore_directive(can_contain: bool, contents: &str, check: &str) -> Directive { + if !can_contain { + return Directive::Deny; + } + // Update `can_contain` when changing this if contents.contains(&format!("// ignore-tidy-{}", check)) || contents.contains(&format!("# ignore-tidy-{}", check)) { Directive::Ignore(false) @@ -129,8 +131,8 @@ macro_rules! suppressible_tidy_err { } pub fn check(path: &Path, bad: &mut bool) { - let mut contents = String::new(); - super::walk(path, &mut super::filter_dirs, &mut |file| { + super::walk(path, &mut super::filter_dirs, &mut |entry, contents| { + let file = entry.path(); let filename = file.file_name().unwrap().to_string_lossy(); let extensions = [".rs", ".py", ".js", ".sh", ".c", ".cpp", ".h"]; if extensions.iter().all(|e| !filename.ends_with(e)) || @@ -138,19 +140,19 @@ pub fn check(path: &Path, bad: &mut bool) { return } - contents.truncate(0); - t!(t!(File::open(file), file).read_to_string(&mut contents)); - if contents.is_empty() { tidy_error!(bad, "{}: empty file", file.display()); } - let mut skip_cr = contains_ignore_directive(&contents, "cr"); - let mut skip_tab = contains_ignore_directive(&contents, "tab"); - let mut skip_line_length = contains_ignore_directive(&contents, "linelength"); - let mut skip_file_length = contains_ignore_directive(&contents, "filelength"); - let mut skip_end_whitespace = contains_ignore_directive(&contents, "end-whitespace"); - let mut skip_copyright = contains_ignore_directive(&contents, "copyright"); + let can_contain = contents.contains("// ignore-tidy-") || + contents.contains("# ignore-tidy-"); + let mut skip_cr = contains_ignore_directive(can_contain, &contents, "cr"); + let mut skip_tab = contains_ignore_directive(can_contain, &contents, "tab"); + let mut skip_line_length = contains_ignore_directive(can_contain, &contents, "linelength"); + let mut skip_file_length = contains_ignore_directive(can_contain, &contents, "filelength"); + let mut skip_end_whitespace = + contains_ignore_directive(can_contain, &contents, "end-whitespace"); + let mut skip_copyright = contains_ignore_directive(can_contain, &contents, "copyright"); let mut leading_new_lines = false; let mut trailing_new_lines = 0; let mut lines = 0; diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index b572b52ea8f35..2c52cecccb5df 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -4,10 +4,9 @@ use std::fs; use std::path::Path; pub fn check(path: &Path, bad: &mut bool) { - super::walk_many( - &[&path.join("test/ui"), &path.join("test/ui-fulldeps")], - &mut |_| false, - &mut |file_path| { + for path in &[&path.join("test/ui"), &path.join("test/ui-fulldeps")] { + super::walk_no_read(path, &mut |_| false, &mut |entry| { + let file_path = entry.path(); if let Some(ext) = file_path.extension() { if ext == "stderr" || ext == "stdout" { // Test output filenames have one of the formats: @@ -45,6 +44,6 @@ pub fn check(path: &Path, bad: &mut bool) { } } } - }, - ); + }); + } } diff --git a/src/tools/tidy/src/unstable_book.rs b/src/tools/tidy/src/unstable_book.rs index f7e40ce4bae36..fb63520f0684a 100644 --- a/src/tools/tidy/src/unstable_book.rs +++ b/src/tools/tidy/src/unstable_book.rs @@ -1,7 +1,7 @@ use std::collections::BTreeSet; use std::fs; -use std::path; -use crate::features::{collect_lang_features, collect_lib_features, Features, Status}; +use std::path::{PathBuf, Path}; +use crate::features::{CollectedFeatures, Features, Feature, Status}; pub const PATH_STR: &str = "doc/unstable-book"; @@ -12,19 +12,19 @@ pub const LANG_FEATURES_DIR: &str = "src/language-features"; pub const LIB_FEATURES_DIR: &str = "src/library-features"; /// Builds the path to the Unstable Book source directory from the Rust 'src' directory. -pub fn unstable_book_path(base_src_path: &path::Path) -> path::PathBuf { +pub fn unstable_book_path(base_src_path: &Path) -> PathBuf { base_src_path.join(PATH_STR) } /// Builds the path to the directory where the features are documented within the Unstable Book /// source directory. -pub fn unstable_book_lang_features_path(base_src_path: &path::Path) -> path::PathBuf { +pub fn unstable_book_lang_features_path(base_src_path: &Path) -> PathBuf { unstable_book_path(base_src_path).join(LANG_FEATURES_DIR) } /// Builds the path to the directory where the features are documented within the Unstable Book /// source directory. -pub fn unstable_book_lib_features_path(base_src_path: &path::Path) -> path::PathBuf { +pub fn unstable_book_lib_features_path(base_src_path: &Path) -> PathBuf { unstable_book_path(base_src_path).join(LIB_FEATURES_DIR) } @@ -45,7 +45,7 @@ pub fn collect_unstable_feature_names(features: &Features) -> BTreeSet { .collect() } -pub fn collect_unstable_book_section_file_names(dir: &path::Path) -> BTreeSet { +pub fn collect_unstable_book_section_file_names(dir: &Path) -> BTreeSet { fs::read_dir(dir) .expect("could not read directory") .map(|entry| entry.expect("could not read directory entry")) @@ -60,7 +60,7 @@ pub fn collect_unstable_book_section_file_names(dir: &path::Path) -> BTreeSet BTreeSet { collect_unstable_book_section_file_names(&unstable_book_lang_features_path(base_src_path)) } @@ -69,18 +69,26 @@ fn collect_unstable_book_lang_features_section_file_names(base_src_path: &path:: /// /// * hyphens replaced by underscores, /// * the markdown suffix ('.md') removed. -fn collect_unstable_book_lib_features_section_file_names(base_src_path: &path::Path) - -> BTreeSet { +fn collect_unstable_book_lib_features_section_file_names(base_src_path: &Path) -> BTreeSet { collect_unstable_book_section_file_names(&unstable_book_lib_features_path(base_src_path)) } -pub fn check(path: &path::Path, bad: &mut bool) { - // Library features - - let lang_features = collect_lang_features(path, bad); - let lib_features = collect_lib_features(path).into_iter().filter(|&(ref name, _)| { +pub fn check(path: &Path, features: CollectedFeatures, bad: &mut bool) { + let lang_features = features.lang; + let mut lib_features = features.lib.into_iter().filter(|&(ref name, _)| { !lang_features.contains_key(name) - }).collect(); + }).collect::(); + + // This library feature is defined in the `compiler_builtins` crate, which + // has been moved out-of-tree. Now it can no longer be auto-discovered by + // `tidy`, because we need to filter out its (submodule) directory. Manually + // add it to the set of known library features so we can still generate docs. + lib_features.insert("compiler_builtins_lib".to_owned(), Feature { + level: Status::Unstable, + since: None, + has_gate_test: false, + tracking_issue: None, + }); // Library features let unstable_lib_feature_names = collect_unstable_feature_names(&lib_features);