diff --git a/.mailmap b/.mailmap index 17232083679c..c29f6a66f5d7 100644 --- a/.mailmap +++ b/.mailmap @@ -258,11 +258,11 @@ Greg V Gregor Peach Grzegorz Bartoszek Guanqun Lu -Guillaume Gomez -Guillaume Gomez ggomez -Guillaume Gomez Guillaume Gomez -Guillaume Gomez Guillaume Gomez -Guillaume Gomez Guillaume Gomez +Guillaume Gomez +Guillaume Gomez Guillaume Gomez +Guillaume Gomez ggomez +Guillaume Gomez Guillaume Gomez +Guillaume Gomez Guillaume Gomez gnzlbg hamidreza kalbasi Hanna Kruppe diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 239daecd3d1f..07593a361ef8 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -1,13 +1,16 @@ use std::mem; +use std::sync::Arc; use rustc_abi::ExternAbi; use rustc_ast::visit::AssocCtxt; use rustc_ast::*; use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::steal::Steal; use rustc_errors::{E0570, ErrorGuaranteed, struct_span_code_err}; use rustc_hir::attrs::{AttributeKind, EiiImplResolution}; use rustc_hir::def::{DefKind, PerNS, Res}; -use rustc_hir::def_id::{CRATE_DEF_ID, LocalDefId}; +use rustc_hir::def_id::{CRATE_DEF_ID, LocalDefId, LocalDefIdMap}; +use rustc_hir::definitions::PerParentDisambiguatorState; use rustc_hir::{ self as hir, HirId, ImplItemImplKind, LifetimeSource, PredicateOrigin, Target, find_attr, }; @@ -48,11 +51,21 @@ fn get_or_insert_mut(&mut self, def_id: LocalDefId) -> &mut hir::MaybeOwner<'hir } } +/// Default disambiguators are used during default lowering, when we lower +/// AST owners in a loop we can use the whole map, in contrast delayed lowering +/// lowers each AST owner separately, so we use readonly disambiguators map +/// with `Steal`s to get disambiguators. +pub(super) enum Disambiguators { + Default(LocalDefIdMap), + Delayed(Arc>>), +} + pub(super) struct ItemLowerer<'a, 'hir, R> { pub(super) tcx: TyCtxt<'hir>, pub(super) resolver: &'a mut R, pub(super) ast_index: &'a IndexSlice>, pub(super) owners: Owners<'a, 'hir>, + pub(super) disambiguators: &'a mut Disambiguators, } /// When we have a ty alias we *may* have two where clauses. To give the best diagnostics, we set the span @@ -80,7 +93,7 @@ fn with_lctx( owner: NodeId, f: impl FnOnce(&mut LoweringContext<'_, 'hir, R>) -> hir::OwnerNode<'hir>, ) { - let mut lctx = LoweringContext::new(self.tcx, self.resolver); + let mut lctx = LoweringContext::new(self.tcx, self.resolver, self.disambiguators); lctx.with_hir_id_owner(owner, |lctx| f(lctx)); for (def_id, info) in lctx.children { diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 2ffb9c123b5f..bf773301ed4b 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -70,7 +70,7 @@ use tracing::{debug, instrument, trace}; use crate::errors::{AssocTyParentheses, AssocTyParenthesesSub, MisplacedImplTrait}; -use crate::item::Owners; +use crate::item::{Disambiguators, Owners}; macro_rules! arena_vec { ($this:expr; $($x:expr),*) => ( @@ -94,7 +94,8 @@ macro_rules! arena_vec { struct LoweringContext<'a, 'hir, R> { tcx: TyCtxt<'hir>, resolver: &'a mut R, - disambiguator: PerParentDisambiguatorState, + disambiguators: &'a mut Disambiguators, + current_disambiguator: PerParentDisambiguatorState, /// Used to allocate HIR nodes. arena: &'hir hir::Arena<'hir>, @@ -154,12 +155,13 @@ struct LoweringContext<'a, 'hir, R> { } impl<'a, 'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'a, 'hir, R> { - fn new(tcx: TyCtxt<'hir>, resolver: &'a mut R) -> Self { + fn new(tcx: TyCtxt<'hir>, resolver: &'a mut R, disambiguators: &'a mut Disambiguators) -> Self { let registered_tools = tcx.registered_tools(()).iter().map(|x| x.name).collect(); Self { tcx, resolver, - disambiguator: Default::default(), + disambiguators, + current_disambiguator: Default::default(), arena: tcx.hir_arena, // HirId handling. @@ -302,10 +304,6 @@ fn trait_candidates(&self, node_id: NodeId) -> Option<&'tcx [hir::TraitCandidate fn next_node_id(&mut self) -> NodeId { next_node_id(&mut self.next_node_id) } - - fn steal_or_create_disambiguator(&self, parent: LocalDefId) -> PerParentDisambiguatorState { - self.base.steal_or_create_disambiguator(parent) - } } fn next_node_id(current_id: &mut NodeId) -> NodeId { @@ -408,10 +406,6 @@ fn trait_candidates(&self, node_id: NodeId) -> Option<&'tcx [hir::TraitCandidate fn next_node_id(&mut self) -> NodeId { next_node_id(&mut self.next_node_id) } - - fn steal_or_create_disambiguator(&self, parent: LocalDefId) -> PerParentDisambiguatorState { - self.per_parent_disambiguators.get(&parent).map(|s| s.steal()).unwrap_or_default() - } } /// How relaxed bounds `?Trait` should be treated. @@ -632,11 +626,13 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> mid_hir::Crate<'_> { tcx.definitions_untracked().def_index_count(), ); + let mut disambiguators = Disambiguators::Default(resolver.disambiguators.steal()); let mut lowerer = item::ItemLowerer { tcx, resolver: &mut resolver, ast_index: &ast_index, owners: Owners::IndexVec(&mut owners), + disambiguators: &mut disambiguators, }; let mut delayed_ids: FxIndexSet = Default::default(); @@ -655,7 +651,11 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> mid_hir::Crate<'_> { let opt_hir_hash = if tcx.needs_crate_hash() { Some(compute_hir_hash(tcx, &owners)) } else { None }; - let delayed_resolver = Steal::new((resolver, krate)); + let Disambiguators::Default(disambiguators) = disambiguators else { unreachable!() }; + let delayed_disambigs = + Arc::new(disambiguators.into_items().map(|(id, d)| (id, Steal::new(d))).collect()); + + let delayed_resolver = Steal::new((resolver, krate, delayed_disambigs)); mid_hir::Crate::new(owners, delayed_ids, delayed_resolver, opt_hir_hash) } @@ -663,7 +663,7 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> mid_hir::Crate<'_> { pub fn lower_delayed_owner(tcx: TyCtxt<'_>, def_id: LocalDefId) { let krate = tcx.hir_crate(()); - let (resolver, krate) = &*krate.delayed_resolver.borrow(); + let (resolver, krate, delayed_disambigs) = &*krate.delayed_resolver.borrow(); // FIXME!!!(fn_delegation): make ast index lifetime same as resolver, // as it is too bad to reindex whole crate on each delegation lowering. @@ -677,12 +677,12 @@ pub fn lower_delayed_owner(tcx: TyCtxt<'_>, def_id: LocalDefId) { }; let mut map = Default::default(); - let mut lowerer = item::ItemLowerer { tcx, resolver: &mut resolver, ast_index: &ast_index, owners: Owners::Map(&mut map), + disambiguators: &mut Disambiguators::Delayed(Arc::clone(delayed_disambigs)), }; lowerer.lower_node(def_id); @@ -740,7 +740,7 @@ fn create_def( let def_id = self .tcx .at(span) - .create_def(parent, name, def_kind, None, &mut self.disambiguator) + .create_def(parent, name, def_kind, None, &mut self.current_disambiguator) .def_id(); debug!("create_def: def_id_to_node_id[{:?}] <-> {:?}", def_id, node_id); @@ -780,9 +780,16 @@ fn with_hir_id_owner( f: impl FnOnce(&mut Self) -> hir::OwnerNode<'hir>, ) { let owner_id = self.owner_id(owner); + let def_id = owner_id.def_id; - let new_disambig = self.resolver.steal_or_create_disambiguator(owner_id.def_id); - let disambiguator = std::mem::replace(&mut self.disambiguator, new_disambig); + let new_disambig = match &mut self.disambiguators { + Disambiguators::Default(map) => map.remove(&def_id), + Disambiguators::Delayed(map) => map.get(&def_id).map(Steal::steal), + }; + + let new_disambig = new_disambig.unwrap_or_else(|| PerParentDisambiguatorState::new(def_id)); + + let disambiguator = std::mem::replace(&mut self.current_disambiguator, new_disambig); let current_attrs = std::mem::take(&mut self.attrs); let current_bodies = std::mem::take(&mut self.bodies); let current_define_opaque = std::mem::take(&mut self.define_opaque); @@ -817,7 +824,7 @@ fn with_hir_id_owner( assert!(self.impl_trait_bounds.is_empty()); let info = self.make_owner_info(item); - self.disambiguator = disambiguator; + self.current_disambiguator = disambiguator; self.attrs = current_attrs; self.bodies = current_bodies; self.define_opaque = current_define_opaque; diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index 0541d39318f4..770189d8c799 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -208,7 +208,7 @@ fn with_impl_trait(&mut self, outer_span: Option, f: impl FnOnce(&mut Self } // Mirrors `visit::walk_ty`, but tracks relevant state. - fn walk_ty(&mut self, t: &'a Ty) { + fn walk_ty(&mut self, t: &Ty) { match &t.kind { TyKind::ImplTrait(_, bounds) => { self.with_impl_trait(Some(t.span), |this| visit::walk_ty(this, t)); @@ -731,7 +731,7 @@ fn check_foreign_item_ascii_only(&self, ident: Ident) { /// C-variadics must be: /// - Non-const /// - Either foreign, or free and `unsafe extern "C"` semantically - fn check_c_variadic_type(&self, fk: FnKind<'a>, attrs: &'a AttrVec) { + fn check_c_variadic_type(&self, fk: FnKind<'_>, attrs: &AttrVec) { // `...` is already rejected when it is not the final parameter. let variadic_param = match fk.decl().inputs.last() { Some(param) if matches!(param.ty.kind, TyKind::CVarArgs) => param, @@ -806,7 +806,7 @@ fn check_c_variadic_type(&self, fk: FnKind<'a>, attrs: &'a AttrVec) { fn check_c_variadic_abi( &self, abi: ExternAbi, - attrs: &'a AttrVec, + attrs: &AttrVec, dotdotdot_span: Span, sig: &FnSig, ) { @@ -976,7 +976,7 @@ fn check_generic_args_before_constraints(&self, data: &AngleBracketedArgs) { }); } - fn visit_ty_common(&mut self, ty: &'a Ty) { + fn visit_ty_common(&mut self, ty: &Ty) { match &ty.kind { TyKind::FnPtr(bfty) => { self.check_fn_ptr_safety(bfty.decl_span, bfty.safety); @@ -1039,13 +1039,13 @@ fn handle_missing_abi(&mut self, span: Span, id: NodeId) { } // Used within `visit_item` for item kinds where we don't call `visit::walk_item`. - fn visit_attrs_vis(&mut self, attrs: &'a AttrVec, vis: &'a Visibility) { + fn visit_attrs_vis(&mut self, attrs: &AttrVec, vis: &Visibility) { walk_list!(self, visit_attribute, attrs); self.visit_vis(vis); } // Used within `visit_item` for item kinds where we don't call `visit::walk_item`. - fn visit_attrs_vis_ident(&mut self, attrs: &'a AttrVec, vis: &'a Visibility, ident: &'a Ident) { + fn visit_attrs_vis_ident(&mut self, attrs: &AttrVec, vis: &Visibility, ident: &Ident) { walk_list!(self, visit_attribute, attrs); self.visit_vis(vis); self.visit_ident(ident); @@ -1125,17 +1125,17 @@ fn validate_generic_param_order(dcx: DiagCtxtHandle<'_>, generics: &[GenericPara } } -impl<'a> Visitor<'a> for AstValidator<'a> { +impl Visitor<'_> for AstValidator<'_> { fn visit_attribute(&mut self, attr: &Attribute) { validate_attr::check_attr(&self.sess.psess, attr); } - fn visit_ty(&mut self, ty: &'a Ty) { + fn visit_ty(&mut self, ty: &Ty) { self.visit_ty_common(ty); self.walk_ty(ty) } - fn visit_item(&mut self, item: &'a Item) { + fn visit_item(&mut self, item: &Item) { if item.attrs.iter().any(|attr| attr.is_proc_macro_attr()) { self.has_proc_macro_decls = true; } @@ -1477,7 +1477,7 @@ fn visit_item(&mut self, item: &'a Item) { self.lint_node_id = previous_lint_node_id; } - fn visit_foreign_item(&mut self, fi: &'a ForeignItem) { + fn visit_foreign_item(&mut self, fi: &ForeignItem) { match &fi.kind { ForeignItemKind::Fn(box Fn { defaultness, ident, sig, body, .. }) => { self.check_defaultness(fi.span, *defaultness, AllowDefault::No, AllowFinal::No); @@ -1527,7 +1527,7 @@ fn visit_foreign_item(&mut self, fi: &'a ForeignItem) { } // Mirrors `visit::walk_generic_args`, but tracks relevant state. - fn visit_generic_args(&mut self, generic_args: &'a GenericArgs) { + fn visit_generic_args(&mut self, generic_args: &GenericArgs) { match generic_args { GenericArgs::AngleBracketed(data) => { self.check_generic_args_before_constraints(data); @@ -1557,7 +1557,7 @@ fn visit_generic_args(&mut self, generic_args: &'a GenericArgs) { } } - fn visit_generics(&mut self, generics: &'a Generics) { + fn visit_generics(&mut self, generics: &Generics) { let mut prev_param_default = None; for param in &generics.params { match param.kind { @@ -1613,7 +1613,7 @@ fn visit_generics(&mut self, generics: &'a Generics) { } } - fn visit_param_bound(&mut self, bound: &'a GenericBound, ctxt: BoundKind) { + fn visit_param_bound(&mut self, bound: &GenericBound, ctxt: BoundKind) { match bound { GenericBound::Trait(trait_ref) => { match (ctxt, trait_ref.modifiers.constness, trait_ref.modifiers.polarity) { @@ -1671,7 +1671,7 @@ fn visit_param_bound(&mut self, bound: &'a GenericBound, ctxt: BoundKind) { visit::walk_param_bound(self, bound) } - fn visit_fn(&mut self, fk: FnKind<'a>, attrs: &AttrVec, span: Span, id: NodeId) { + fn visit_fn(&mut self, fk: FnKind<'_>, attrs: &AttrVec, span: Span, id: NodeId) { // Only associated `fn`s can have `self` parameters. let self_semantic = match fk.ctxt() { Some(FnCtxt::Assoc(_)) => SelfSemantic::Yes, @@ -1784,7 +1784,7 @@ fn visit_fn(&mut self, fk: FnKind<'a>, attrs: &AttrVec, span: Span, id: NodeId) self.with_tilde_const(disallowed, |this| visit::walk_fn(this, fk)); } - fn visit_assoc_item(&mut self, item: &'a AssocItem, ctxt: AssocCtxt) { + fn visit_assoc_item(&mut self, item: &AssocItem, ctxt: AssocCtxt) { if let Some(ident) = item.kind.ident() && attr::contains_name(&item.attrs, sym::no_mangle) { @@ -1931,7 +1931,7 @@ fn visit_assoc_item(&mut self, item: &'a AssocItem, ctxt: AssocCtxt) { } } - fn visit_anon_const(&mut self, anon_const: &'a AnonConst) { + fn visit_anon_const(&mut self, anon_const: &AnonConst) { self.with_tilde_const( Some(TildeConstReason::AnonConst { span: anon_const.value.span }), |this| visit::walk_anon_const(this, anon_const), diff --git a/compiler/rustc_attr_parsing/src/attributes/crate_level.rs b/compiler/rustc_attr_parsing/src/attributes/crate_level.rs index fed4ca7e76ab..3739461c2004 100644 --- a/compiler/rustc_attr_parsing/src/attributes/crate_level.rs +++ b/compiler/rustc_attr_parsing/src/attributes/crate_level.rs @@ -1,10 +1,11 @@ +use rustc_errors::Diagnostic; use rustc_hir::attrs::{CrateType, WindowsSubsystemKind}; -use rustc_hir::lints::AttributeLintKind; use rustc_session::lint::builtin::UNKNOWN_CRATE_TYPES; use rustc_span::Symbol; use rustc_span::edit_distance::find_best_match_for_name; use super::prelude::*; +use crate::errors::{UnknownCrateTypes, UnknownCrateTypesSuggestion}; pub(crate) struct CrateNameParser; @@ -65,13 +66,17 @@ fn extend( crate_type, None, ); - cx.emit_lint( + let span = n.value_span; + cx.emit_dyn_lint( UNKNOWN_CRATE_TYPES, - AttributeLintKind::CrateTypeUnknown { - span: n.value_span, - suggested: candidate, + move |dcx, level| { + UnknownCrateTypes { + sugg: candidate + .map(|s| UnknownCrateTypesSuggestion { span, snippet: s }), + } + .into_diag(dcx, level) }, - n.value_span, + span, ); } return None; diff --git a/compiler/rustc_attr_parsing/src/attributes/diagnostic/do_not_recommend.rs b/compiler/rustc_attr_parsing/src/attributes/diagnostic/do_not_recommend.rs index 9f3d1e29b4de..bf811438db93 100644 --- a/compiler/rustc_attr_parsing/src/attributes/diagnostic/do_not_recommend.rs +++ b/compiler/rustc_attr_parsing/src/attributes/diagnostic/do_not_recommend.rs @@ -1,11 +1,15 @@ +use rustc_errors::Diagnostic; use rustc_feature::{AttributeTemplate, template}; +use rustc_hir::Target; use rustc_hir::attrs::AttributeKind; -use rustc_hir::lints::AttributeLintKind; -use rustc_session::lint::builtin::MALFORMED_DIAGNOSTIC_ATTRIBUTES; +use rustc_session::lint::builtin::{ + MALFORMED_DIAGNOSTIC_ATTRIBUTES, MISPLACED_DIAGNOSTIC_ATTRIBUTES, +}; use rustc_span::{Symbol, sym}; use crate::attributes::{OnDuplicate, SingleAttributeParser}; use crate::context::{AcceptContext, Stage}; +use crate::errors::IncorrectDoNotRecommendLocation; use crate::parser::ArgParser; use crate::target_checking::{ALL_TARGETS, AllowedTargets}; @@ -13,18 +17,32 @@ impl SingleAttributeParser for DoNotRecommendParser { const PATH: &[Symbol] = &[sym::diagnostic, sym::do_not_recommend]; const ON_DUPLICATE: OnDuplicate = OnDuplicate::Warn; - const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(ALL_TARGETS); // Checked in check_attr. + // "Allowed" on any target, noop on all but trait impls + const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(ALL_TARGETS); const TEMPLATE: AttributeTemplate = template!(Word /*doesn't matter */); fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option { let attr_span = cx.attr_span; if !matches!(args, ArgParser::NoArgs) { - cx.emit_lint( + cx.emit_dyn_lint( MALFORMED_DIAGNOSTIC_ATTRIBUTES, - AttributeLintKind::DoNotRecommendDoesNotExpectArgs, + |dcx, level| crate::errors::DoNotRecommendDoesNotExpectArgs.into_diag(dcx, level), attr_span, ); } + + if !matches!(cx.target, Target::Impl { of_trait: true }) { + let target_span = cx.target_span; + cx.emit_dyn_lint( + MISPLACED_DIAGNOSTIC_ATTRIBUTES, + move |dcx, level| { + IncorrectDoNotRecommendLocation { target_span }.into_diag(dcx, level) + }, + attr_span, + ); + return None; + } + Some(AttributeKind::DoNotRecommend { attr_span }) } } diff --git a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_const.rs b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_const.rs index 1e62c03fc3b6..349b54706623 100644 --- a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_const.rs +++ b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_const.rs @@ -1,8 +1,10 @@ +use rustc_errors::Diagnostic; use rustc_hir::attrs::diagnostic::Directive; +use rustc_session::lint::builtin::MISPLACED_DIAGNOSTIC_ATTRIBUTES; use crate::attributes::diagnostic::*; use crate::attributes::prelude::*; - +use crate::errors::DiagnosticOnConstOnlyForTraitImpls; #[derive(Default)] pub(crate) struct OnConstParser { span: Option, @@ -21,6 +23,21 @@ impl AttributeParser for OnConstParser { let span = cx.attr_span; this.span = Some(span); + + // FIXME(mejrs) no constness field on `Target`, + // so non-constness is still checked in check_attr.rs + if !matches!(cx.target, Target::Impl { of_trait: true }) { + let target_span = cx.target_span; + cx.emit_dyn_lint( + MISPLACED_DIAGNOSTIC_ATTRIBUTES, + move |dcx, level| { + DiagnosticOnConstOnlyForTraitImpls { target_span }.into_diag(dcx, level) + }, + span, + ); + return; + } + let mode = Mode::DiagnosticOnConst; let Some(items) = parse_list(cx, args, mode) else { return }; @@ -32,7 +49,8 @@ impl AttributeParser for OnConstParser { }, )]; - //FIXME Still checked in `check_attr.rs` + // "Allowed" on all targets; noop on anything but non-const trait impls; + // this linted on in parser. const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(ALL_TARGETS); fn finalize(self, _cx: &FinalizeContext<'_, '_, S>) -> Option { diff --git a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_move.rs b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_move.rs index 2b62ab7f3d11..feb48fa868d4 100644 --- a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_move.rs +++ b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_move.rs @@ -1,10 +1,13 @@ +use rustc_errors::Diagnostic; use rustc_feature::template; use rustc_hir::attrs::AttributeKind; +use rustc_session::lint::builtin::MISPLACED_DIAGNOSTIC_ATTRIBUTES; use rustc_span::sym; use crate::attributes::diagnostic::*; use crate::attributes::prelude::*; use crate::context::{AcceptContext, Stage}; +use crate::errors::DiagnosticOnMoveOnlyForAdt; use crate::parser::ArgParser; use crate::target_checking::{ALL_TARGETS, AllowedTargets}; @@ -29,6 +32,15 @@ fn parse<'sess, S: Stage>( let span = cx.attr_span; self.span = Some(span); + if !matches!(cx.target, Target::Enum | Target::Struct | Target::Union) { + cx.emit_dyn_lint( + MISPLACED_DIAGNOSTIC_ATTRIBUTES, + move |dcx, level| DiagnosticOnMoveOnlyForAdt.into_diag(dcx, level), + span, + ); + return; + } + let Some(items) = parse_list(cx, args, mode) else { return }; if let Some(directive) = parse_directive_items(cx, mode, items.mixed(), true) { @@ -44,6 +56,8 @@ impl AttributeParser for OnMoveParser { this.parse(cx, args, Mode::DiagnosticOnMove); }, )]; + + // "Allowed" for all targets but noop if used on not-adt. const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(ALL_TARGETS); fn finalize(self, _cx: &FinalizeContext<'_, '_, S>) -> Option { diff --git a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unimplemented.rs b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unimplemented.rs index dce3226670a1..069cda28582e 100644 --- a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unimplemented.rs +++ b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unimplemented.rs @@ -1,7 +1,10 @@ +use rustc_errors::Diagnostic; use rustc_hir::attrs::diagnostic::Directive; +use rustc_session::lint::builtin::MISPLACED_DIAGNOSTIC_ATTRIBUTES; use crate::attributes::diagnostic::*; use crate::attributes::prelude::*; +use crate::errors::DiagnosticOnUnimplementedOnlyForTraits; #[derive(Default)] pub(crate) struct OnUnimplementedParser { @@ -19,11 +22,12 @@ fn parse<'sess, S: Stage>( let span = cx.attr_span; self.span = Some(span); - // If target is not a trait, returning early will make `finalize` emit a - // `AttributeKind::OnUnimplemented {span, directive: None }`, to prevent it being - // accidentally used on non-trait items like trait aliases. if !matches!(cx.target, Target::Trait) { - // Lint later emitted in check_attr + cx.emit_dyn_lint( + MISPLACED_DIAGNOSTIC_ATTRIBUTES, + move |dcx, level| DiagnosticOnUnimplementedOnlyForTraits.into_diag(dcx, level), + span, + ); return; } diff --git a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unknown.rs b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unknown.rs index a5364f968b21..d30ccfb73fe8 100644 --- a/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unknown.rs +++ b/compiler/rustc_attr_parsing/src/attributes/diagnostic/on_unknown.rs @@ -1,7 +1,11 @@ +use rustc_errors::Diagnostic; use rustc_hir::attrs::diagnostic::Directive; +use rustc_session::lint::builtin::MISPLACED_DIAGNOSTIC_ATTRIBUTES; +use crate::ShouldEmit; use crate::attributes::diagnostic::*; use crate::attributes::prelude::*; +use crate::errors::DiagnosticOnUnknownOnlyForImports; #[derive(Default)] pub(crate) struct OnUnknownParser { @@ -25,6 +29,22 @@ fn parse<'sess, S: Stage>( let span = cx.attr_span; self.span = Some(span); + // At early parsing we get passed `Target::Crate` regardless of the item we're on. + // Only do target checking if we're late. + let early = matches!(cx.stage.should_emit(), ShouldEmit::Nothing); + + if !early && !matches!(cx.target, Target::Use) { + let target_span = cx.target_span; + cx.emit_dyn_lint( + MISPLACED_DIAGNOSTIC_ATTRIBUTES, + move |dcx, level| { + DiagnosticOnUnknownOnlyForImports { target_span }.into_diag(dcx, level) + }, + span, + ); + return; + } + let Some(items) = parse_list(cx, args, mode) else { return }; if let Some(directive) = parse_directive_items(cx, mode, items.mixed(), true) { @@ -41,7 +61,7 @@ impl AttributeParser for OnUnknownParser { this.parse(cx, args, Mode::DiagnosticOnUnknown); }, )]; - //FIXME attribute is not parsed for non-use statements but diagnostics are issued in `check_attr.rs` + // "Allowed" for all targets, but noop for all but use statements. const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(ALL_TARGETS); fn finalize(self, _cx: &FinalizeContext<'_, '_, S>) -> Option { diff --git a/compiler/rustc_attr_parsing/src/attributes/doc.rs b/compiler/rustc_attr_parsing/src/attributes/doc.rs index 09d474a227fb..2b6d56c41193 100644 --- a/compiler/rustc_attr_parsing/src/attributes/doc.rs +++ b/compiler/rustc_attr_parsing/src/attributes/doc.rs @@ -14,8 +14,9 @@ use super::{AcceptMapping, AttributeParser}; use crate::context::{AcceptContext, FinalizeContext, Stage}; use crate::errors::{ - DocAliasDuplicated, DocAutoCfgExpectsHideOrShow, DocAutoCfgHideShowExpectsList, - DocAutoCfgHideShowUnexpectedItem, DocAutoCfgWrongLiteral, DocUnknownAny, DocUnknownInclude, + AttrCrateLevelOnly, DocAliasDuplicated, DocAutoCfgExpectsHideOrShow, + DocAutoCfgHideShowExpectsList, DocAutoCfgHideShowUnexpectedItem, DocAutoCfgWrongLiteral, + DocTestLiteral, DocTestTakesList, DocTestUnknown, DocUnknownAny, DocUnknownInclude, DocUnknownPasses, DocUnknownPlugins, DocUnknownSpotlight, IllFormedAttributeInput, }; use crate::parser::{ArgParser, MetaItemOrLitParser, MetaItemParser, OwnedPathParser}; @@ -67,9 +68,9 @@ fn check_attr_not_crate_level( /// Checks that an attribute is used at the crate level. Returns `true` if valid. fn check_attr_crate_level(cx: &mut AcceptContext<'_, '_, S>, span: Span) -> bool { if cx.shared.target != Target::Crate { - cx.emit_lint( + cx.emit_dyn_lint( rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES, - AttributeLintKind::AttrCrateLevelOnly, + |dcx, level| AttrCrateLevelOnly.into_diag(dcx, level), span, ); return false; @@ -216,16 +217,16 @@ fn parse_single_test_doc_attr_item( } } Some(name) => { - cx.emit_lint( + cx.emit_dyn_lint( rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES, - AttributeLintKind::DocTestUnknown { name }, + move |dcx, level| DocTestUnknown { name }.into_diag(dcx, level), path.span(), ); } None => { - cx.emit_lint( + cx.emit_dyn_lint( rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES, - AttributeLintKind::DocTestLiteral, + |dcx, level| DocTestLiteral.into_diag(dcx, level), path.span(), ); } @@ -587,9 +588,9 @@ macro_rules! string_arg_and_crate_level { Some(sym::auto_cfg) => self.parse_auto_cfg(cx, path, args), Some(sym::test) => { let Some(list) = args.list() else { - cx.emit_lint( + cx.emit_dyn_lint( rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES, - AttributeLintKind::DocTestTakesList, + |dcx, level| DocTestTakesList.into_diag(dcx, level), args.span().unwrap_or(path.span()), ); return; diff --git a/compiler/rustc_attr_parsing/src/errors.rs b/compiler/rustc_attr_parsing/src/errors.rs index ca57c25f25a0..96a4c473c3ae 100644 --- a/compiler/rustc_attr_parsing/src/errors.rs +++ b/compiler/rustc_attr_parsing/src/errors.rs @@ -252,3 +252,72 @@ pub(crate) struct DocUnknownAny { #[derive(Diagnostic)] #[diag("expected boolean for `#[doc(auto_cfg = ...)]`")] pub(crate) struct DocAutoCfgWrongLiteral; + +#[derive(Diagnostic)] +#[diag("`#[doc(test(...)]` takes a list of attributes")] +pub(crate) struct DocTestTakesList; + +#[derive(Diagnostic)] +#[diag("unknown `doc(test)` attribute `{$name}`")] +pub(crate) struct DocTestUnknown { + pub name: Symbol, +} + +#[derive(Diagnostic)] +#[diag("`#![doc(test(...)]` does not take a literal")] +pub(crate) struct DocTestLiteral; + +#[derive(Diagnostic)] +#[diag("this attribute can only be applied at the crate level")] +#[note( + "read for more information" +)] +pub(crate) struct AttrCrateLevelOnly; + +#[derive(Diagnostic)] +#[diag("`#[diagnostic::do_not_recommend]` does not expect any arguments")] +pub(crate) struct DoNotRecommendDoesNotExpectArgs; + +#[derive(Diagnostic)] +#[diag("invalid `crate_type` value")] +pub(crate) struct UnknownCrateTypes { + #[subdiagnostic] + pub sugg: Option, +} + +#[derive(Subdiagnostic)] +#[suggestion("did you mean", code = r#""{snippet}""#, applicability = "maybe-incorrect")] +pub(crate) struct UnknownCrateTypesSuggestion { + #[primary_span] + pub span: Span, + pub snippet: Symbol, +} + +#[derive(Diagnostic)] +#[diag("`#[diagnostic::on_const]` can only be applied to non-const trait implementations")] +pub(crate) struct DiagnosticOnConstOnlyForTraitImpls { + #[label("not a trait implementation")] + pub target_span: Span, +} + +#[derive(Diagnostic)] +#[diag("`#[diagnostic::on_move]` can only be applied to enums, structs or unions")] +pub(crate) struct DiagnosticOnMoveOnlyForAdt; + +#[derive(Diagnostic)] +#[diag("`#[diagnostic::on_unimplemented]` can only be applied to trait definitions")] +pub(crate) struct DiagnosticOnUnimplementedOnlyForTraits; + +#[derive(Diagnostic)] +#[diag("`#[diagnostic::on_unknown]` can only be applied to `use` statements")] +pub(crate) struct DiagnosticOnUnknownOnlyForImports { + #[label("not an import")] + pub target_span: Span, +} + +#[derive(Diagnostic)] +#[diag("`#[diagnostic::do_not_recommend]` can only be placed on trait implementations")] +pub(crate) struct IncorrectDoNotRecommendLocation { + #[label("not a trait implementation")] + pub target_span: Span, +} diff --git a/compiler/rustc_borrowck/src/region_infer/opaque_types/member_constraints.rs b/compiler/rustc_borrowck/src/region_infer/opaque_types/member_constraints.rs index abe3980031a4..c057d99c6a41 100644 --- a/compiler/rustc_borrowck/src/region_infer/opaque_types/member_constraints.rs +++ b/compiler/rustc_borrowck/src/region_infer/opaque_types/member_constraints.rs @@ -177,7 +177,7 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) { | ty::Coroutine(def_id, args) => self.visit_closure_args(def_id, args), ty::Alias(ty::AliasTy { kind, args, .. }) - if let Some(variances) = self.cx().opt_alias_variances(kind, kind.def_id()) => + if let Some(variances) = self.cx().opt_alias_variances(kind) => { // Skip lifetime parameters that are not captured, since they do // not need member constraints registered for them; we'll erase diff --git a/compiler/rustc_borrowck/src/region_infer/opaque_types/mod.rs b/compiler/rustc_borrowck/src/region_infer/opaque_types/mod.rs index 58511d35f91d..1348f30b4c98 100644 --- a/compiler/rustc_borrowck/src/region_infer/opaque_types/mod.rs +++ b/compiler/rustc_borrowck/src/region_infer/opaque_types/mod.rs @@ -501,7 +501,7 @@ fn try_fold_ty(&mut self, ty: Ty<'tcx>) -> Result, RegionVid> { } ty::Alias(ty::AliasTy { kind, args, .. }) - if let Some(variances) = tcx.opt_alias_variances(kind, kind.def_id()) => + if let Some(variances) = tcx.opt_alias_variances(kind) => { let args = tcx.mk_args_from_iter(std::iter::zip(variances, args.iter()).map( |(&v, s)| { diff --git a/compiler/rustc_codegen_gcc/src/back/lto.rs b/compiler/rustc_codegen_gcc/src/back/lto.rs index 401d4c244d5a..6fd9cc96328f 100644 --- a/compiler/rustc_codegen_gcc/src/back/lto.rs +++ b/compiler/rustc_codegen_gcc/src/back/lto.rs @@ -144,9 +144,12 @@ fn fat_lto( for module in modules { match module { FatLtoInput::InMemory(m) => in_memory.push(m), - FatLtoInput::Serialized { name, buffer } => { + FatLtoInput::Serialized { name, bitcode_path } => { info!("pushing serialized module {:?}", name); - serialized_modules.push((buffer, CString::new(name).unwrap())); + serialized_modules.push(( + SerializedModule::from_file(&bitcode_path), + CString::new(name).unwrap(), + )); } } } diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index 09863961c9d6..63c09fe94027 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -223,9 +223,12 @@ fn fat_lto( for module in modules { match module { FatLtoInput::InMemory(m) => in_memory.push(m), - FatLtoInput::Serialized { name, buffer } => { + FatLtoInput::Serialized { name, bitcode_path } => { info!("pushing serialized module {:?}", name); - serialized_modules.push((buffer, CString::new(name).unwrap())); + serialized_modules.push(( + SerializedModule::from_file(&bitcode_path), + CString::new(name).unwrap(), + )); } } } @@ -396,7 +399,9 @@ fn thin_lto( for (i, module) in modules.into_iter().enumerate() { let (name, buffer) = match module { ThinLtoInput::Red { name, buffer } => (name, buffer), - ThinLtoInput::Green { wp, buffer } => (wp.cgu_name, buffer), + ThinLtoInput::Green { wp, bitcode_path } => { + (wp.cgu_name, SerializedModule::from_file(&bitcode_path)) + } }; info!("local module: {} - {}", i, name); let cname = CString::new(name.as_bytes()).unwrap(); diff --git a/compiler/rustc_codegen_ssa/src/back/lto.rs b/compiler/rustc_codegen_ssa/src/back/lto.rs index cd380abb75e0..ddfcd8a85f6b 100644 --- a/compiler/rustc_codegen_ssa/src/back/lto.rs +++ b/compiler/rustc_codegen_ssa/src/back/lto.rs @@ -1,4 +1,6 @@ use std::ffi::CString; +use std::fs; +use std::path::Path; use std::sync::Arc; use rustc_data_structures::memmap::Mmap; @@ -49,6 +51,19 @@ pub enum SerializedModule { } impl SerializedModule { + pub fn from_file(bc_path: &Path) -> Self { + let file = fs::File::open(&bc_path).unwrap_or_else(|e| { + panic!("failed to open LTO bitcode file `{}`: {}", bc_path.display(), e) + }); + + let mmap = unsafe { + Mmap::map(file).unwrap_or_else(|e| { + panic!("failed to mmap LTO bitcode file `{}`: {}", bc_path.display(), e) + }) + }; + SerializedModule::FromUncompressedFile(mmap) + } + pub fn data(&self) -> &[u8] { match *self { SerializedModule::Local(ref m) => m.data(), diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 82d7e23602e2..5601a950fbdb 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -8,7 +8,6 @@ use rustc_abi::Size; use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::jobserver::{self, Acquired}; -use rustc_data_structures::memmap::Mmap; use rustc_data_structures::profiling::{SelfProfilerRef, VerboseTimingGuard}; use rustc_errors::emitter::Emitter; use rustc_errors::{ @@ -35,9 +34,8 @@ use rustc_target::spec::{MergeFunctions, SanitizerSet}; use tracing::debug; -use super::link::{self, ensure_removed}; -use super::lto::{self, SerializedModule}; -use crate::back::lto::check_lto_allowed; +use crate::back::link::{self, ensure_removed}; +use crate::back::lto::{self, SerializedModule, check_lto_allowed}; use crate::errors::ErrorCreatingRemarkDir; use crate::traits::*; use crate::{ @@ -774,13 +772,13 @@ pub(crate) enum WorkItemResult { } pub enum FatLtoInput { - Serialized { name: String, buffer: SerializedModule }, + Serialized { name: String, bitcode_path: PathBuf }, InMemory(ModuleCodegen), } pub enum ThinLtoInput { Red { name: String, buffer: SerializedModule }, - Green { wp: WorkProduct, buffer: SerializedModule }, + Green { wp: WorkProduct, bitcode_path: PathBuf }, } /// Actual LTO type we end up choosing based on multiple factors. @@ -866,7 +864,7 @@ fn execute_optimize_work_item( }); WorkItemResult::NeedsFatLto(FatLtoInput::Serialized { name: module.name, - buffer: SerializedModule::Local(buffer), + bitcode_path: path, }) } None => WorkItemResult::NeedsFatLto(FatLtoInput::InMemory(module)), @@ -1166,10 +1164,7 @@ pub(crate) enum Message { /// Similar to `CodegenDone`, but for reusing a pre-LTO artifact /// Sent from the main thread. - AddImportOnlyModule { - module_data: SerializedModule, - work_product: WorkProduct, - }, + AddImportOnlyModule { bitcode_path: PathBuf, work_product: WorkProduct }, /// The frontend has finished generating everything for all codegen units. /// Sent from the main thread. @@ -1729,10 +1724,10 @@ enum CodegenState { } } - Message::AddImportOnlyModule { module_data, work_product } => { + Message::AddImportOnlyModule { bitcode_path, work_product } => { assert_eq!(codegen_state, Ongoing); assert_eq!(main_thread_state, MainThreadState::Codegenning); - lto_import_only_modules.push((module_data, work_product)); + lto_import_only_modules.push((bitcode_path, work_product)); main_thread_state = MainThreadState::Idle; } } @@ -1758,8 +1753,8 @@ enum CodegenState { needs_fat_lto.push(FatLtoInput::InMemory(allocator_module)); } - for (module, wp) in lto_import_only_modules { - needs_fat_lto.push(FatLtoInput::Serialized { name: wp.cgu_name, buffer: module }) + for (bitcode_path, wp) in lto_import_only_modules { + needs_fat_lto.push(FatLtoInput::Serialized { name: wp.cgu_name, bitcode_path }) } return Ok(MaybeLtoModules::FatLto { @@ -1772,8 +1767,8 @@ enum CodegenState { assert!(compiled_modules.is_empty()); assert!(needs_fat_lto.is_empty()); - for (buffer, wp) in lto_import_only_modules { - needs_thin_lto.push(ThinLtoInput::Green { wp, buffer }) + for (bitcode_path, wp) in lto_import_only_modules { + needs_thin_lto.push(ThinLtoInput::Green { wp, bitcode_path }) } if cgcx.lto == Lto::ThinLocal { @@ -2133,14 +2128,14 @@ fn drop(&mut self) { } pub struct OngoingCodegen { - pub backend: B, - pub output_filenames: Arc, + backend: B, + output_filenames: Arc, // Field order below is intended to terminate the coordinator thread before two fields below // drop and prematurely close channels used by coordinator thread. See `Coordinator`'s // `Drop` implementation for more info. - pub coordinator: Coordinator, - pub codegen_worker_receive: Receiver, - pub shared_emitter_main: SharedEmitterMain, + pub(crate) coordinator: Coordinator, + codegen_worker_receive: Receiver, + shared_emitter_main: SharedEmitterMain, } impl OngoingCodegen { @@ -2285,20 +2280,13 @@ pub(crate) fn submit_pre_lto_module_to_llvm( module: CachedModuleCodegen, ) { let filename = pre_lto_bitcode_filename(&module.name); - let bc_path = in_incr_comp_dir_sess(tcx.sess, &filename); - let file = fs::File::open(&bc_path) - .unwrap_or_else(|e| panic!("failed to open bitcode file `{}`: {}", bc_path.display(), e)); - - let mmap = unsafe { - Mmap::map(file).unwrap_or_else(|e| { - panic!("failed to mmap bitcode file `{}`: {}", bc_path.display(), e) - }) - }; + let bitcode_path = in_incr_comp_dir_sess(tcx.sess, &filename); // Schedule the module to be loaded - drop(coordinator.sender.send(Message::AddImportOnlyModule:: { - module_data: SerializedModule::FromUncompressedFile(mmap), - work_product: module.source, - })); + drop( + coordinator + .sender + .send(Message::AddImportOnlyModule:: { bitcode_path, work_product: module.source }), + ); } fn pre_lto_bitcode_filename(module_name: &str) -> String { diff --git a/compiler/rustc_const_eval/src/interpret/intern.rs b/compiler/rustc_const_eval/src/interpret/intern.rs index 5d510a983526..57139d077d49 100644 --- a/compiler/rustc_const_eval/src/interpret/intern.rs +++ b/compiler/rustc_const_eval/src/interpret/intern.rs @@ -16,8 +16,11 @@ use hir::def::DefKind; use rustc_ast::Mutability; use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; -use rustc_hir as hir; -use rustc_hir::definitions::{DefPathData, DisambiguatorState}; +use rustc_hir::def_id::LocalDefIdMap; +use rustc_hir::definitions::{ + DefPathData, PerParentDisambiguatorState, PerParentDisambiguatorsMap, +}; +use rustc_hir::{self as hir}; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs; use rustc_middle::mir::interpret::{ AllocBytes, ConstAllocation, CtfeProvenance, InterpResult, Provenance, @@ -105,7 +108,7 @@ fn intern_shallow<'tcx, M: CompileTimeMachine<'tcx>>( ecx: &mut InterpCx<'tcx, M>, alloc_id: AllocId, mutability: Mutability, - disambiguator: Option<&mut DisambiguatorState>, + disambiguators: Option<&mut LocalDefIdMap>, ) -> Result + 'tcx, InternError> { trace!("intern_shallow {:?}", alloc_id); // remove allocation @@ -129,7 +132,7 @@ fn intern_shallow<'tcx, M: CompileTimeMachine<'tcx>>( static_id, alloc_id, alloc, - disambiguator.expect("disambiguator needed"), + disambiguators.expect("disambiguators needed"), ); } else { ecx.tcx.set_alloc_id_memory(alloc_id, alloc); @@ -144,7 +147,7 @@ fn intern_as_new_static<'tcx>( static_id: LocalDefId, alloc_id: AllocId, alloc: ConstAllocation<'tcx>, - disambiguator: &mut DisambiguatorState, + disambiguators: &mut LocalDefIdMap, ) { // `intern_const_alloc_recursive` is called once per static and it contains the `DisambiguatorState`. // The `::{{nested}}` path is thus unique to `intern_const_alloc_recursive` and the @@ -155,7 +158,8 @@ fn intern_as_new_static<'tcx>( None, DefKind::Static { safety: hir::Safety::Safe, mutability: alloc.0.mutability, nested: true }, Some(DefPathData::NestedStatic), - disambiguator, + //FIXME(oli-obk): cleanup (https://github.com/rust-lang/rust/pull/155547#discussion_r3110792640) + disambiguators.get_or_create(static_id), ); tcx.set_nested_alloc_id_static(alloc_id, feed.def_id()); @@ -205,7 +209,7 @@ pub fn intern_const_alloc_recursive<'tcx, M: CompileTimeMachine<'tcx>>( intern_kind: InternKind, ret: &MPlaceTy<'tcx>, ) -> Result<(), InternError> { - let mut disambiguator = DisambiguatorState::new(); + let mut disambiguators = Default::default(); // We are interning recursively, and for mutability we are distinguishing the "root" allocation // that we are starting in, and all other allocations that we are encountering recursively. @@ -250,7 +254,7 @@ pub fn intern_const_alloc_recursive<'tcx, M: CompileTimeMachine<'tcx>>( prepare_alloc(*ecx.tcx, *kind, alloc, base_mutability)?; alloc.provenance().ptrs().iter().map(|&(_, prov)| prov).collect() } else { - intern_shallow(ecx, base_alloc_id, base_mutability, Some(&mut disambiguator))?.collect() + intern_shallow(ecx, base_alloc_id, base_mutability, Some(&mut disambiguators))?.collect() }; // We need to distinguish "has just been interned" from "was already in `tcx`", // so we track this in a separate set. @@ -332,7 +336,7 @@ pub fn intern_const_alloc_recursive<'tcx, M: CompileTimeMachine<'tcx>>( // okay with losing some potential for immutability here. This can anyway only affect // `static mut`. just_interned.insert(alloc_id); - let next = intern_shallow(ecx, alloc_id, inner_mutability, Some(&mut disambiguator))?; + let next = intern_shallow(ecx, alloc_id, inner_mutability, Some(&mut disambiguators))?; todo.extend(next); } if found_bad_mutable_ptr { diff --git a/compiler/rustc_data_structures/src/flat_map_in_place.rs b/compiler/rustc_data_structures/src/flat_map_in_place.rs index 6d718059f9c8..d1fdd999d36a 100644 --- a/compiler/rustc_data_structures/src/flat_map_in_place.rs +++ b/compiler/rustc_data_structures/src/flat_map_in_place.rs @@ -1,81 +1,157 @@ use std::{mem, ptr}; -use smallvec::{Array, SmallVec}; +use smallvec::SmallVec; use thin_vec::ThinVec; -pub trait FlatMapInPlace: Sized { +pub trait FlatMapInPlace { + /// `f` turns each element into 0..many elements. This function will consume the existing + /// elements in a vec-like structure and replace them with any number of new elements — fewer, + /// more, or the same number — as efficiently as possible. fn flat_map_in_place(&mut self, f: F) where F: FnMut(T) -> I, I: IntoIterator; } -// The implementation of this method is syntactically identical for all the -// different vector types. -macro_rules! flat_map_in_place { - ($vec:ident $( where T: $bound:path)?) => { - fn flat_map_in_place(&mut self, mut f: F) - where - F: FnMut(T) -> I, - I: IntoIterator, - { - struct LeakGuard<'a, T $(: $bound)?>(&'a mut $vec); +// Blanket impl for all vec-like types that impl `FlatMapInPlaceVec`. +impl FlatMapInPlace for V { + fn flat_map_in_place(&mut self, mut f: F) + where + F: FnMut(V::Elem) -> I, + I: IntoIterator, + { + struct LeakGuard<'a, V: FlatMapInPlaceVec>(&'a mut V); - impl<'a, T $(: $bound)?> Drop for LeakGuard<'a, T> { - fn drop(&mut self) { - unsafe { - self.0.set_len(0); // make sure we just leak elements in case of panic - } + impl<'a, V: FlatMapInPlaceVec> Drop for LeakGuard<'a, V> { + fn drop(&mut self) { + unsafe { + // Leak all elements in case of panic. + self.0.set_len(0); } } - - let this = LeakGuard(self); - - let mut read_i = 0; - let mut write_i = 0; - unsafe { - while read_i < this.0.len() { - // move the read_i'th item out of the vector and map it - // to an iterator - let e = ptr::read(this.0.as_ptr().add(read_i)); - let iter = f(e).into_iter(); - read_i += 1; - - for e in iter { - if write_i < read_i { - ptr::write(this.0.as_mut_ptr().add(write_i), e); - write_i += 1; - } else { - // If this is reached we ran out of space - // in the middle of the vector. - // However, the vector is in a valid state here, - // so we just do a somewhat inefficient insert. - this.0.insert(write_i, e); - - read_i += 1; - write_i += 1; - } - } - } - - // write_i tracks the number of actually written new items. - this.0.set_len(write_i); - - // The ThinVec is in a sane state again. Prevent the LeakGuard from leaking the data. - mem::forget(this); - } } - }; + + let guard = LeakGuard(self); + + let mut read_i = 0; + let mut write_i = 0; + unsafe { + while read_i < guard.0.len() { + // Move the read_i'th item out of the vector and map it to an iterator. + let e = ptr::read(guard.0.as_ptr().add(read_i)); + let iter = f(e).into_iter(); + read_i += 1; + + for e in iter { + if write_i < read_i { + ptr::write(guard.0.as_mut_ptr().add(write_i), e); + write_i += 1; + } else { + // If this is reached we ran out of space in the middle of the vector. + // However, the vector is in a valid state here, so we just do a somewhat + // inefficient insert. + guard.0.insert(write_i, e); + + read_i += 1; + write_i += 1; + } + } + } + + // `write_i` tracks the number of actually written new items. + guard.0.set_len(write_i); + + // `vec` is in a sane state again. Prevent the LeakGuard from leaking the data. + mem::forget(guard); + } + } } -impl FlatMapInPlace for Vec { - flat_map_in_place!(Vec); +// A vec-like type must implement these operations to support `flat_map_in_place`. +pub trait FlatMapInPlaceVec { + type Elem; + + fn len(&self) -> usize; + unsafe fn set_len(&mut self, len: usize); + fn as_ptr(&self) -> *const Self::Elem; + fn as_mut_ptr(&mut self) -> *mut Self::Elem; + fn insert(&mut self, idx: usize, elem: Self::Elem); } -impl> FlatMapInPlace for SmallVec { - flat_map_in_place!(SmallVec where T: Array); +impl FlatMapInPlaceVec for Vec { + type Elem = T; + + fn len(&self) -> usize { + self.len() + } + + unsafe fn set_len(&mut self, len: usize) { + unsafe { + self.set_len(len); + } + } + + fn as_ptr(&self) -> *const Self::Elem { + self.as_ptr() + } + + fn as_mut_ptr(&mut self) -> *mut Self::Elem { + self.as_mut_ptr() + } + + fn insert(&mut self, idx: usize, elem: Self::Elem) { + self.insert(idx, elem); + } } -impl FlatMapInPlace for ThinVec { - flat_map_in_place!(ThinVec); +impl FlatMapInPlaceVec for ThinVec { + type Elem = T; + + fn len(&self) -> usize { + self.len() + } + + unsafe fn set_len(&mut self, len: usize) { + unsafe { + self.set_len(len); + } + } + + fn as_ptr(&self) -> *const Self::Elem { + self.as_slice().as_ptr() + } + + fn as_mut_ptr(&mut self) -> *mut Self::Elem { + self.as_mut_slice().as_mut_ptr() + } + + fn insert(&mut self, idx: usize, elem: Self::Elem) { + self.insert(idx, elem); + } +} + +impl FlatMapInPlaceVec for SmallVec<[T; N]> { + type Elem = T; + + fn len(&self) -> usize { + self.len() + } + + unsafe fn set_len(&mut self, len: usize) { + unsafe { + self.set_len(len); + } + } + + fn as_ptr(&self) -> *const Self::Elem { + self.as_ptr() + } + + fn as_mut_ptr(&mut self) -> *mut Self::Elem { + self.as_mut_ptr() + } + + fn insert(&mut self, idx: usize, elem: Self::Elem) { + self.insert(idx, elem); + } } diff --git a/compiler/rustc_hir/src/definitions.rs b/compiler/rustc_hir/src/definitions.rs index d18653f6267a..e9801a8a5231 100644 --- a/compiler/rustc_hir/src/definitions.rs +++ b/compiler/rustc_hir/src/definitions.rs @@ -7,11 +7,12 @@ use std::fmt::{self, Write}; use std::hash::Hash; +use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::StableHasher; -use rustc_data_structures::unord::UnordMap; use rustc_hashes::Hash64; use rustc_index::IndexVec; -use rustc_macros::{BlobDecodable, Decodable, Encodable}; +use rustc_macros::{BlobDecodable, Decodable, Encodable, extension}; +use rustc_span::def_id::LocalDefIdMap; use rustc_span::{Symbol, kw, sym}; use tracing::{debug, instrument}; @@ -97,45 +98,28 @@ pub fn enumerated_keys_and_path_hashes( } } -pub trait Disambiguator { - fn entry(&mut self, parent: LocalDefId, data: DefPathData) -> &mut u32; -} - #[derive(Debug, Default, Clone)] pub struct PerParentDisambiguatorState { - next: UnordMap, + #[cfg(debug_assertions)] + parent: Option, + next: FxHashMap, } -impl Disambiguator for PerParentDisambiguatorState { - #[inline] - fn entry(&mut self, _: LocalDefId, data: DefPathData) -> &mut u32 { - self.next.entry(data).or_insert(0) +impl PerParentDisambiguatorState { + #[inline(always)] + pub fn new(_parent: LocalDefId) -> PerParentDisambiguatorState { + PerParentDisambiguatorState { + #[cfg(debug_assertions)] + parent: Some(_parent), + next: Default::default(), + } } } -#[derive(Debug, Default, Clone)] -pub struct DisambiguatorState { - next: UnordMap<(LocalDefId, DefPathData), u32>, -} - -impl Disambiguator for DisambiguatorState { - #[inline] - fn entry(&mut self, parent: LocalDefId, data: DefPathData) -> &mut u32 { - self.next.entry((parent, data)).or_insert(0) - } -} - -impl DisambiguatorState { - pub const fn new() -> Self { - Self { next: Default::default() } - } - - /// Creates a `DisambiguatorState` where the next allocated `(LocalDefId, DefPathData)` pair - /// will have `index` as the disambiguator. - pub fn with(def_id: LocalDefId, data: DefPathData, index: u32) -> Self { - let mut this = Self::new(); - this.next.insert((def_id, data), index); - this +#[extension(pub trait PerParentDisambiguatorsMap)] +impl LocalDefIdMap { + fn get_or_create(&mut self, parent: LocalDefId) -> &mut PerParentDisambiguatorState { + self.entry(parent).or_insert_with(|| PerParentDisambiguatorState::new(parent)) } } @@ -408,7 +392,7 @@ pub fn create_def( &mut self, parent: LocalDefId, data: DefPathData, - disambiguator: &mut impl Disambiguator, + disambiguator: &mut PerParentDisambiguatorState, ) -> LocalDefId { // We can't use `Debug` implementation for `LocalDefId` here, since it tries to acquire a // reference to `Definitions` and we're already holding a mutable reference. @@ -422,7 +406,14 @@ pub fn create_def( // Find the next free disambiguator for this key. let disambiguator = { - let next_disamb = disambiguator.entry(parent, data); + #[cfg(debug_assertions)] + debug_assert_eq!( + parent, + disambiguator.parent.expect("must be set"), + "provided parent and parent in disambiguator must be the same" + ); + + let next_disamb = disambiguator.next.entry(data).or_insert(0); let disambiguator = *next_disamb; *next_disamb = next_disamb.checked_add(1).expect("disambiguator overflow"); disambiguator diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs index ffc4e41d3e3a..234231ed37fe 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs @@ -2735,7 +2735,7 @@ fn param_env_with_gat_bounds<'tcx>( _ => predicates.push( ty::Binder::bind_with_vars( ty::ProjectionPredicate { - projection_term: ty::AliasTerm::new_from_args( + projection_term: ty::AliasTerm::new_from_def_id( tcx, trait_ty.def_id, rebased_args, diff --git a/compiler/rustc_hir_analysis/src/check/mod.rs b/compiler/rustc_hir_analysis/src/check/mod.rs index 6862b6fe863f..fcdbb11b297c 100644 --- a/compiler/rustc_hir_analysis/src/check/mod.rs +++ b/compiler/rustc_hir_analysis/src/check/mod.rs @@ -370,10 +370,10 @@ fn bounds_from_generic_predicates<'tcx>( let mut projections_str = vec![]; for projection in &projections { let p = projection.skip_binder(); - if bound == tcx.parent(p.projection_term.def_id) + if bound == tcx.parent(p.projection_term.def_id()) && p.projection_term.self_ty() == ty { - let name = tcx.item_name(p.projection_term.def_id); + let name = tcx.item_name(p.projection_term.def_id()); projections_str.push(format!("{} = {}", name, p.term)); } } diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index 07ad2a79dc7a..32610619fe71 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -1655,7 +1655,7 @@ fn visit_const(&mut self, c: ty::Const<'tcx>) -> Self::Result { .map_bound(|pred| { pred.term.as_const().map(|ct| { let assoc_const_ty = tcx - .type_of(pred.projection_term.def_id) + .type_of(pred.projection_term.def_id()) .instantiate(tcx, pred.projection_term.args) .skip_norm_wip(); ty::ClauseKind::ConstArgHasType(ct, assoc_const_ty) diff --git a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs index 782eda0e00a3..2aebe267dc4b 100644 --- a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs +++ b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs @@ -14,7 +14,8 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; use rustc_errors::ErrorGuaranteed; use rustc_hir::def::{DefKind, Res}; -use rustc_hir::definitions::{DefPathData, DisambiguatorState}; +use rustc_hir::def_id::LocalDefIdMap; +use rustc_hir::definitions::{DefPathData, PerParentDisambiguatorsMap}; use rustc_hir::intravisit::{self, InferKind, Visitor, VisitorExt}; use rustc_hir::{ self as hir, AmbigArg, GenericArg, GenericParam, GenericParamKind, HirId, LifetimeKind, Node, @@ -30,6 +31,7 @@ use tracing::{debug, debug_span, instrument}; use crate::errors; +use crate::hir::definitions::PerParentDisambiguatorState; #[extension(trait RegionExt)] impl ResolvedArg { @@ -64,7 +66,7 @@ fn shifted(self, amount: u32) -> ResolvedArg { struct BoundVarContext<'a, 'tcx> { tcx: TyCtxt<'tcx>, rbv: &'a mut ResolveBoundVars<'tcx>, - disambiguator: &'a mut DisambiguatorState, + disambiguators: &'a mut LocalDefIdMap, scope: ScopeRef<'a, 'tcx>, opaque_capture_errors: RefCell>, } @@ -259,7 +261,7 @@ fn resolve_bound_vars(tcx: TyCtxt<'_>, local_def_id: hir::OwnerId) -> ResolveBou tcx, rbv: &mut rbv, scope: &Scope::Root { opt_parent_item: None }, - disambiguator: &mut DisambiguatorState::new(), + disambiguators: &mut Default::default(), opaque_capture_errors: RefCell::new(None), }; match tcx.hir_owner_node(local_def_id) { @@ -1104,12 +1106,12 @@ fn with(&mut self, wrap_scope: Scope<'_, 'tcx>, f: F) where F: for<'b> FnOnce(&mut BoundVarContext<'b, 'tcx>), { - let BoundVarContext { tcx, rbv, disambiguator, .. } = self; + let BoundVarContext { tcx, rbv, disambiguators, .. } = self; let nested_errors = RefCell::new(self.opaque_capture_errors.borrow_mut().take()); let mut this = BoundVarContext { tcx: *tcx, rbv, - disambiguator, + disambiguators, scope: &wrap_scope, opaque_capture_errors: nested_errors, }; @@ -1523,7 +1525,7 @@ fn remap_opaque_captures( None, DefKind::LifetimeParam, Some(DefPathData::OpaqueLifetime(ident.name)), - self.disambiguator, + self.disambiguators.get_or_create(opaque_def_id), ); feed.def_span(ident.span); feed.def_ident_span(Some(ident.span)); diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs index bf6b7e24f14e..6e2c7a82af3b 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs @@ -526,7 +526,7 @@ pub(super) fn lower_assoc_item_constraint( ); debug!(?alias_args); - ty::AliasTerm::new_from_args(tcx, assoc_item.def_id, alias_args) + ty::AliasTerm::new_from_def_id(tcx, assoc_item.def_id, alias_args) }) }; @@ -543,7 +543,7 @@ pub(super) fn lower_assoc_item_constraint( hir::Term::Ty(ty) => self.lower_ty(ty).into(), hir::Term::Const(ct) => { let ty = projection_term.map_bound(|alias| { - tcx.type_of(alias.def_id).instantiate(tcx, alias.args).skip_norm_wip() + tcx.type_of(alias.def_id()).instantiate(tcx, alias.args).skip_norm_wip() }); let ty = check_assoc_const_binding_type( self, diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs index a027c552d92b..a43e373415ab 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs @@ -1364,7 +1364,7 @@ fn probe_single_bound_for_assoc_item( &item_segment, trait_ref.args, ); - ty::AliasTerm::new_from_args( + ty::AliasTerm::new_from_def_id( tcx, assoc_item.def_id, alias_args, @@ -1374,7 +1374,7 @@ fn probe_single_bound_for_assoc_item( // FIXME(mgca): code duplication with other places we lower // the rhs' of associated const bindings let ty = projection_term.map_bound(|alias| { - tcx.type_of(alias.def_id) + tcx.type_of(alias.def_id()) .instantiate(tcx, alias.args) .skip_norm_wip() }); diff --git a/compiler/rustc_hir_typeck/src/closure.rs b/compiler/rustc_hir_typeck/src/closure.rs index d90cbaf935a7..d8240a0c9d70 100644 --- a/compiler/rustc_hir_typeck/src/closure.rs +++ b/compiler/rustc_hir_typeck/src/closure.rs @@ -1057,11 +1057,11 @@ fn deduce_future_output_from_projection( // The `Future` trait has only one associated item, `Output`, // so check that this is what we see. let output_assoc_item = self.tcx.associated_item_def_ids(trait_def_id)[0]; - if output_assoc_item != predicate.projection_term.def_id { + if output_assoc_item != predicate.projection_term.def_id() { span_bug!( cause_span, "projecting associated item `{:?}` from future, which is not Output `{:?}`", - predicate.projection_term.def_id, + predicate.projection_term.kind, output_assoc_item, ); } diff --git a/compiler/rustc_hir_typeck/src/errors.rs b/compiler/rustc_hir_typeck/src/errors.rs index b55e7933cc1e..3f8ac61eed08 100644 --- a/compiler/rustc_hir_typeck/src/errors.rs +++ b/compiler/rustc_hir_typeck/src/errors.rs @@ -173,6 +173,12 @@ pub(crate) enum ExpectedReturnTypeLabel<'tcx> { span: Span, expected: Ty<'tcx>, }, + #[label("expected a single type implementing `{$trait_name}` because of return type")] + ImplTrait { + #[primary_span] + span: Span, + trait_name: String, + }, } #[derive(Diagnostic)] diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs index eea5edd922de..1f08dff18f3e 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs @@ -931,6 +931,42 @@ pub(in super::super) fn suggest_missing_return_type( } hir::FnRetTy::Return(hir_ty) => { if let hir::TyKind::OpaqueDef(op_ty, ..) = hir_ty.kind + && let [hir::GenericBound::Trait(trait_ref)] = op_ty.bounds + && !trait_ref + .trait_ref + .path + .segments + .last() + .and_then(|seg| seg.args) + .map_or(false, |args| !args.constraints.is_empty()) + { + // Use the path to get the trait name string + let trait_name = trait_ref + .trait_ref + .path + .segments + .iter() + .map(|seg| seg.ident.as_str()) + .collect::>() + .join("::"); + + err.subdiagnostic(errors::ExpectedReturnTypeLabel::ImplTrait { + span: hir_ty.span, + trait_name, + }); + + if let Some(ret_coercion_span) = self.ret_coercion_span.get() { + let expected_name = expected.to_string(); + err.span_label( + ret_coercion_span, + format!("return type resolved to be `{expected_name}`"), + ); + } + + self.try_suggest_return_impl_trait(err, expected, found, fn_id); + self.try_note_caller_chooses_ty_for_ty_param(err, expected, found); + return true; + } else if let hir::TyKind::OpaqueDef(op_ty, ..) = hir_ty.kind // FIXME: account for RPITIT. && let [hir::GenericBound::Trait(trait_ref)] = op_ty.bounds && let Some(hir::PathSegment { args: Some(generic_args), .. }) = diff --git a/compiler/rustc_infer/src/infer/outlives/for_liveness.rs b/compiler/rustc_infer/src/infer/outlives/for_liveness.rs index 0a56b42c502e..b4594bd60f3b 100644 --- a/compiler/rustc_infer/src/infer/outlives/for_liveness.rs +++ b/compiler/rustc_infer/src/infer/outlives/for_liveness.rs @@ -95,7 +95,7 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) { } else { // Skip lifetime parameters that are not captured, since they do // not need to be live. - let variances = tcx.opt_alias_variances(kind, kind.def_id()); + let variances = tcx.opt_alias_variances(kind); for (idx, s) in args.iter().enumerate() { if variances.map(|variances| variances[idx]) != Some(ty::Bivariant) { diff --git a/compiler/rustc_infer/src/infer/outlives/obligations.rs b/compiler/rustc_infer/src/infer/outlives/obligations.rs index 28e1b0718245..e98bee3b12cd 100644 --- a/compiler/rustc_infer/src/infer/outlives/obligations.rs +++ b/compiler/rustc_infer/src/infer/outlives/obligations.rs @@ -485,7 +485,7 @@ fn alias_ty_must_outlive( && (alias_ty.has_infer_regions() || matches!(kind, ty::Opaque { .. })) { debug!("no declared bounds"); - let opt_variances = self.tcx.opt_alias_variances(kind, kind.def_id()); + let opt_variances = self.tcx.opt_alias_variances(kind); self.args_must_outlive(alias_ty.args, origin, region, opt_variances); return; } diff --git a/compiler/rustc_infer/src/infer/projection.rs b/compiler/rustc_infer/src/infer/projection.rs index 2a4f9db8963c..81bb5b42401b 100644 --- a/compiler/rustc_infer/src/infer/projection.rs +++ b/compiler/rustc_infer/src/infer/projection.rs @@ -22,7 +22,7 @@ pub fn projection_term_to_infer( ) -> Term<'tcx> { debug_assert!(!self.next_trait_solver()); - let span = self.tcx.def_span(alias_term.def_id); + let span = self.tcx.def_span(alias_term.def_id()); let infer_var = if alias_term.kind(self.tcx).is_type() { self.next_ty_var(span).into() } else { diff --git a/compiler/rustc_infer/src/infer/relate/generalize.rs b/compiler/rustc_infer/src/infer/relate/generalize.rs index 0229af53f2a6..5ec56b3e9dc4 100644 --- a/compiler/rustc_infer/src/infer/relate/generalize.rs +++ b/compiler/rustc_infer/src/infer/relate/generalize.rs @@ -184,11 +184,12 @@ fn instantiate_var>( relation.register_predicates([ty::PredicateKind::AliasRelate(lhs, rhs, direction)]); } else { - let Some(source_alias) = source_term.to_alias_term() else { + let Some(source_alias) = source_term.to_alias_term(self.tcx) else { bug!("generalized `{source_term:?} to infer, not an alias"); }; match source_alias.kind(self.tcx) { - ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst => { + ty::AliasTermKind::ProjectionTy { .. } + | ty::AliasTermKind::ProjectionConst { .. } => { // FIXME: This does not handle subtyping correctly, we could // instead create a new inference variable `?normalized_source`, emitting // `Projection(normalized_source, ?ty_normalized)` and @@ -199,14 +200,14 @@ fn instantiate_var>( }]); } // The old solver only accepts projection predicates for associated types. - ty::AliasTermKind::InherentTy - | ty::AliasTermKind::FreeTy - | ty::AliasTermKind::OpaqueTy => { + ty::AliasTermKind::InherentTy { .. } + | ty::AliasTermKind::FreeTy { .. } + | ty::AliasTermKind::OpaqueTy { .. } => { return Err(TypeError::CyclicTy(source_term.expect_type())); } - ty::AliasTermKind::InherentConst - | ty::AliasTermKind::FreeConst - | ty::AliasTermKind::UnevaluatedConst => { + ty::AliasTermKind::InherentConst { .. } + | ty::AliasTermKind::FreeConst { .. } + | ty::AliasTermKind::UnevaluatedConst { .. } => { return Err(TypeError::CyclicConst(source_term.expect_const())); } } @@ -755,7 +756,8 @@ fn consts( // path), as doing this new No path breaks some GCE things. I expect GCE to be // ripped out soon so this shouldn't matter soon. StructurallyRelateAliases::No if !self.cx().features().generic_const_exprs() => { - self.generalize_alias_term(uv.into()).map(|v| v.expect_const()) + self.generalize_alias_term(ty::AliasTerm::from_unevaluated_const(self.cx(), uv)) + .map(|v| v.expect_const()) } _ => { let ty::UnevaluatedConst { def, args } = uv; diff --git a/compiler/rustc_lint/src/early/diagnostics.rs b/compiler/rustc_lint/src/early/diagnostics.rs index 4a0320cbaf80..60bfdd689609 100644 --- a/compiler/rustc_lint/src/early/diagnostics.rs +++ b/compiler/rustc_lint/src/early/diagnostics.rs @@ -43,27 +43,6 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { .into_diag(dcx, level) } - &AttributeLintKind::DocTestTakesList => lints::DocTestTakesList.into_diag(dcx, level), - - &AttributeLintKind::DocTestUnknown { name } => { - lints::DocTestUnknown { name }.into_diag(dcx, level) - } - - &AttributeLintKind::DocTestLiteral => lints::DocTestLiteral.into_diag(dcx, level), - - &AttributeLintKind::AttrCrateLevelOnly => { - lints::AttrCrateLevelOnly.into_diag(dcx, level) - } - - &AttributeLintKind::DoNotRecommendDoesNotExpectArgs => { - lints::DoNotRecommendDoesNotExpectArgs.into_diag(dcx, level) - } - - &AttributeLintKind::CrateTypeUnknown { span, suggested } => lints::UnknownCrateTypes { - sugg: suggested.map(|s| lints::UnknownCrateTypesSuggestion { span, snippet: s }), - } - .into_diag(dcx, level), - &AttributeLintKind::MalformedDoc => lints::MalformedDoc.into_diag(dcx, level), &AttributeLintKind::ExpectedNoArgs => lints::ExpectedNoArgs.into_diag(dcx, level), diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index 19fabc51ae53..ccbc325648e3 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -3303,46 +3303,6 @@ fn add_to_diag(self, diag: &mut Diag<'_, G>) { )] pub(crate) struct ExpectedNameValue; -#[derive(Diagnostic)] -#[diag("`#[doc(test(...)]` takes a list of attributes")] -pub(crate) struct DocTestTakesList; - -#[derive(Diagnostic)] -#[diag("unknown `doc(test)` attribute `{$name}`")] -pub(crate) struct DocTestUnknown { - pub name: Symbol, -} - -#[derive(Diagnostic)] -#[diag("`#![doc(test(...)]` does not take a literal")] -pub(crate) struct DocTestLiteral; - -#[derive(Diagnostic)] -#[diag("this attribute can only be applied at the crate level")] -#[note( - "read for more information" -)] -pub(crate) struct AttrCrateLevelOnly; - -#[derive(Diagnostic)] -#[diag("`#[diagnostic::do_not_recommend]` does not expect any arguments")] -pub(crate) struct DoNotRecommendDoesNotExpectArgs; - -#[derive(Diagnostic)] -#[diag("invalid `crate_type` value")] -pub(crate) struct UnknownCrateTypes { - #[subdiagnostic] - pub sugg: Option, -} - -#[derive(Subdiagnostic)] -#[suggestion("did you mean", code = r#""{snippet}""#, applicability = "maybe-incorrect")] -pub(crate) struct UnknownCrateTypesSuggestion { - #[primary_span] - pub span: Span, - pub snippet: Symbol, -} - #[derive(Diagnostic)] #[diag("positional format arguments are not allowed here")] #[help( diff --git a/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs b/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs index 6947ff9d2c40..97df4ebc8ae1 100644 --- a/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs +++ b/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs @@ -132,7 +132,7 @@ fn check_ty(&mut self, cx: &LateContext<'tcx>, ty: &'tcx hir::Ty<'tcx, AmbigArg> let proj_ty = Ty::new_projection_from_args( cx.tcx, - proj.projection_term.def_id, + proj.projection_term.def_id(), proj.projection_term.args, ); // For every instance of the projection type in the bounds, @@ -149,7 +149,7 @@ fn check_ty(&mut self, cx: &LateContext<'tcx>, ty: &'tcx hir::Ty<'tcx, AmbigArg> // with `impl Send: OtherTrait`. for (assoc_pred, assoc_pred_span) in cx .tcx - .explicit_item_bounds(proj.projection_term.def_id) + .explicit_item_bounds(proj.projection_term.def_id()) .iter_instantiated_copied(cx.tcx, proj.projection_term.args) .map(Unnormalized::skip_norm_wip) { diff --git a/compiler/rustc_lint/src/types/improper_ctypes.rs b/compiler/rustc_lint/src/types/improper_ctypes.rs index 1674eec4a1ef..eddc3f628ae6 100644 --- a/compiler/rustc_lint/src/types/improper_ctypes.rs +++ b/compiler/rustc_lint/src/types/improper_ctypes.rs @@ -192,6 +192,7 @@ fn variant_has_complex_ctor(variant: &ty::VariantDef) -> bool { fn check_arg_for_power_alignment<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool { let tcx = cx.tcx; assert!(tcx.sess.target.os == Os::Aix); + // Structs (under repr(C)) follow the power alignment rule if: // - the first field of the struct is a floating-point type that // is greater than 4-bytes, or @@ -273,6 +274,17 @@ enum FfiResult<'tcx> { /// in the `FfiResult` is final. type PartialFfiResult<'tcx> = Option>; +/// What type indirection points to a given type. +#[derive(Clone, Copy)] +enum IndirectionKind { + /// Box (valid non-null pointer, owns pointee). + Box, + /// Ref (valid non-null pointer, borrows pointee). + Ref, + /// Raw pointer (not necessarily non-null or valid. no info on ownership). + RawPtr, +} + bitflags! { #[derive(Clone, Copy, Debug, PartialEq, Eq)] struct VisitorState: u8 { @@ -359,6 +371,35 @@ fn can_expect_ty_params(self) -> bool { } } +bitflags! { + /// Data that summarises how an "outer type" surrounds its inner type(s) + #[derive(Clone, Copy, Debug, PartialEq, Eq)] + struct OuterTyData: u8 { + /// To show that there is no outer type, the current type is directly used by a `static` + /// variable or a function/FnPtr + const NO_OUTER_TY = 0b01; + /// For NO_OUTER_TY cases, show that we are being directly used by a FnPtr specifically + /// FIXME(ctypes): this is only used for "bad behaviour" reproduced for compatibility's sake + const NO_OUTER_TY_FNPTR = 0b10; + } +} + +impl OuterTyData { + /// Get the proper data for a given outer type. + fn from_ty<'tcx>(ty: Ty<'tcx>) -> Self { + match ty.kind() { + ty::FnPtr(..) => Self::NO_OUTER_TY | Self::NO_OUTER_TY_FNPTR, + ty::RawPtr(..) + | ty::Ref(..) + | ty::Adt(..) + | ty::Tuple(..) + | ty::Array(..) + | ty::Slice(_) => Self::empty(), + k @ _ => bug!("unexpected outer type {:?} of kind {:?}", ty, k), + } + } +} + /// Visitor used to recursively traverse MIR types and evaluate FFI-safety. /// It uses ``check_*`` methods as entrypoints to be called elsewhere, /// and ``visit_*`` methods to recurse. @@ -378,21 +419,94 @@ fn new(cx: &'a LateContext<'tcx>, base_ty: Ty<'tcx>, base_fn_mode: CItemKind) -> Self { cx, base_ty, base_fn_mode, cache: FxHashSet::default() } } - /// Checks if the given `VariantDef`'s field types are "ffi-safe". - fn check_variant_for_ffi( + /// Checks if the given indirection (box,ref,pointer) is "ffi-safe". + fn visit_indirection( &mut self, state: VisitorState, ty: Ty<'tcx>, - def: ty::AdtDef<'tcx>, + inner_ty: Ty<'tcx>, + indirection_kind: IndirectionKind, + ) -> FfiResult<'tcx> { + use FfiResult::*; + let tcx = self.cx.tcx; + + match indirection_kind { + IndirectionKind::Box => { + // FIXME(ctypes): this logic is broken, but it still fits the current tests: + // - for some reason `Box<_>`es in `extern "ABI" {}` blocks + // (including within FnPtr:s) + // are not treated as pointers but as FFI-unsafe structs + // - otherwise, treat the box itself correctly, and follow pointee safety logic + // as described in the other `indirection_type` match branch. + if state.is_in_defined_function() + || (state.is_in_fnptr() && matches!(self.base_fn_mode, CItemKind::Definition)) + { + if inner_ty.is_sized(tcx, self.cx.typing_env()) { + return FfiSafe; + } else { + return FfiUnsafe { + ty, + reason: msg!("box cannot be represented as a single pointer"), + help: None, + }; + } + } else { + // (mid-retcon-commit-chain comment:) + // this is the original fallback behavior, which is wrong + if let ty::Adt(def, args) = ty.kind() { + self.visit_struct_or_union(state, ty, *def, args) + } else if cfg!(debug_assertions) { + bug!("ImproperCTypes: this retcon commit was badly written") + } else { + FfiSafe + } + } + } + IndirectionKind::Ref | IndirectionKind::RawPtr => { + // Weird behaviour for pointee safety. the big question here is + // "if you have a FFI-unsafe pointee behind a FFI-safe pointer type, is it ok?" + // The answer until now is: + // "It's OK for rust-defined functions and callbacks, we'll assume those are + // meant to be opaque types on the other side of the FFI boundary". + // + // Reasoning: + // For extern function declarations, the actual definition of the function is + // written somewhere else, meaning the declaration is free to express this + // opaqueness with an extern type (opaque caller-side) or a std::ffi::c_void + // (opaque callee-side). For extern function definitions, however, in the case + // where the type is opaque caller-side, it is not opaque callee-side, + // and having the full type information is necessary to compile the function. + // + // It might be better to rething this, or even ignore pointee safety for a first + // batch of behaviour changes. See the discussion that ends with + // https://github.com/rust-lang/rust/pull/134697#issuecomment-2692610258 + if (state.is_in_defined_function() || state.is_in_fnptr()) + && inner_ty.is_sized(self.cx.tcx, self.cx.typing_env()) + { + FfiSafe + } else { + self.visit_type(state, OuterTyData::from_ty(ty), inner_ty) + } + } + } + } + + /// Checks if the given `VariantDef`'s field types are "ffi-safe". + fn visit_variant_fields( + &mut self, + state: VisitorState, + ty: Ty<'tcx>, + def: AdtDef<'tcx>, variant: &ty::VariantDef, args: GenericArgsRef<'tcx>, ) -> FfiResult<'tcx> { use FfiResult::*; + let transparent_with_all_zst_fields = if def.repr().transparent() { if let Some(field) = super::transparent_newtype_field(self.cx.tcx, variant) { // Transparent newtypes have at most one non-ZST field which needs to be checked.. let field_ty = get_type_from_field(self.cx, field, args); - match self.visit_type(state, field_ty) { + match self.visit_type(state, OuterTyData::from_ty(ty), field_ty) { FfiUnsafe { ty, .. } if ty.is_unit() => (), r => return r, } @@ -411,7 +525,7 @@ fn check_variant_for_ffi( let mut all_phantom = !variant.fields.is_empty(); for field in &variant.fields { let field_ty = get_type_from_field(self.cx, field, args); - all_phantom &= match self.visit_type(state, field_ty) { + all_phantom &= match self.visit_type(state, OuterTyData::from_ty(ty), field_ty) { FfiSafe => false, // `()` fields are FFI-safe! FfiUnsafe { ty, .. } if ty.is_unit() => false, @@ -433,9 +547,125 @@ fn check_variant_for_ffi( } } + fn visit_struct_or_union( + &mut self, + state: VisitorState, + ty: Ty<'tcx>, + def: AdtDef<'tcx>, + args: GenericArgsRef<'tcx>, + ) -> FfiResult<'tcx> { + debug_assert!(matches!(def.adt_kind(), AdtKind::Struct | AdtKind::Union)); + use FfiResult::*; + + if !def.repr().c() && !def.repr().transparent() { + return FfiUnsafe { + ty, + reason: if def.is_struct() { + msg!("this struct has unspecified layout") + } else { + msg!("this union has unspecified layout") + }, + help: if def.is_struct() { + Some(msg!( + "consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct" + )) + } else { + // FIXME(ctypes): confirm that this makes sense for unions once #60405 / RFC2645 stabilises + Some(msg!( + "consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this union" + )) + }, + }; + } + + if def.non_enum_variant().field_list_has_applicable_non_exhaustive() { + return FfiUnsafe { + ty, + reason: if def.is_struct() { + msg!("this struct is non-exhaustive") + } else { + msg!("this union is non-exhaustive") + }, + help: None, + }; + } + + if def.non_enum_variant().fields.is_empty() { + FfiUnsafe { + ty, + reason: if def.is_struct() { + msg!("this struct has no fields") + } else { + msg!("this union has no fields") + }, + help: if def.is_struct() { + Some(msg!("consider adding a member to this struct")) + } else { + Some(msg!("consider adding a member to this union")) + }, + } + } else { + self.visit_variant_fields(state, ty, def, def.non_enum_variant(), args) + } + } + + fn visit_enum( + &mut self, + state: VisitorState, + ty: Ty<'tcx>, + def: AdtDef<'tcx>, + args: GenericArgsRef<'tcx>, + ) -> FfiResult<'tcx> { + debug_assert!(matches!(def.adt_kind(), AdtKind::Enum)); + use FfiResult::*; + + if def.variants().is_empty() { + // Empty enums are okay... although sort of useless. + return FfiSafe; + } + // Check for a repr() attribute to specify the size of the + // discriminant. + if !def.repr().c() && !def.repr().transparent() && def.repr().int.is_none() { + // Special-case types like `Option` and `Result` + if let Some(inner_ty) = repr_nullable_ptr(self.cx.tcx, self.cx.typing_env(), ty) { + return self.visit_type(state, OuterTyData::from_ty(ty), inner_ty); + } + + return FfiUnsafe { + ty, + reason: msg!("enum has no representation hint"), + help: Some(msg!( + "consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum" + )), + }; + } + + let non_exhaustive = def.variant_list_has_applicable_non_exhaustive(); + // Check the contained variants. + let ret = def.variants().iter().try_for_each(|variant| { + check_non_exhaustive_variant(non_exhaustive, variant) + .map_break(|reason| FfiUnsafe { ty, reason, help: None })?; + + match self.visit_variant_fields(state, ty, def, variant, args) { + FfiSafe => ControlFlow::Continue(()), + r => ControlFlow::Break(r), + } + }); + if let ControlFlow::Break(result) = ret { + return result; + } + + FfiSafe + } + /// Checks if the given type is "ffi-safe" (has a stable, well-defined /// representation which can be exported to C code). - fn visit_type(&mut self, state: VisitorState, ty: Ty<'tcx>) -> FfiResult<'tcx> { + fn visit_type( + &mut self, + state: VisitorState, + outer_ty: OuterTyData, + ty: Ty<'tcx>, + ) -> FfiResult<'tcx> { use FfiResult::*; let tcx = self.cx.tcx; @@ -450,23 +680,8 @@ fn visit_type(&mut self, state: VisitorState, ty: Ty<'tcx>) -> FfiResult<'tcx> { match *ty.kind() { ty::Adt(def, args) => { - if let Some(boxed) = ty.boxed_ty() - && ( - // FIXME(ctypes): this logic is broken, but it still fits the current tests - state.is_in_defined_function() - || (state.is_in_fnptr() - && matches!(self.base_fn_mode, CItemKind::Definition)) - ) - { - if boxed.is_sized(tcx, self.cx.typing_env()) { - return FfiSafe; - } else { - return FfiUnsafe { - ty, - reason: msg!("box cannot be represented as a single pointer"), - help: None, - }; - } + if let Some(inner_ty) = ty.boxed_ty() { + return self.visit_indirection(state, ty, inner_ty, IndirectionKind::Box); } if def.is_phantom_data() { return FfiPhantom(ty); @@ -485,115 +700,29 @@ fn visit_type(&mut self, state: VisitorState, ty: Ty<'tcx>) -> FfiResult<'tcx> { )), }; } - - if !def.repr().c() && !def.repr().transparent() { - return FfiUnsafe { - ty, - reason: if def.is_struct() { - msg!("this struct has unspecified layout") - } else { - msg!("this union has unspecified layout") - }, - help: if def.is_struct() { - Some(msg!( - "consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct" - )) - } else { - Some(msg!( - "consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this union" - )) - }, - }; - } - - if def.non_enum_variant().field_list_has_applicable_non_exhaustive() { - return FfiUnsafe { - ty, - reason: if def.is_struct() { - msg!("this struct is non-exhaustive") - } else { - msg!("this union is non-exhaustive") - }, - help: None, - }; - } - - if def.non_enum_variant().fields.is_empty() { - return FfiUnsafe { - ty, - reason: if def.is_struct() { - msg!("this struct has no fields") - } else { - msg!("this union has no fields") - }, - help: if def.is_struct() { - Some(msg!("consider adding a member to this struct")) - } else { - Some(msg!("consider adding a member to this union")) - }, - }; - } - - self.check_variant_for_ffi(state, ty, def, def.non_enum_variant(), args) - } - AdtKind::Enum => { - if def.variants().is_empty() { - // Empty enums are okay... although sort of useless. - return FfiSafe; - } - // Check for a repr() attribute to specify the size of the - // discriminant. - if !def.repr().c() && !def.repr().transparent() && def.repr().int.is_none() - { - // Special-case types like `Option` and `Result` - if let Some(ty) = - repr_nullable_ptr(self.cx.tcx, self.cx.typing_env(), ty) - { - return self.visit_type(state, ty); - } - - return FfiUnsafe { - ty, - reason: msg!("enum has no representation hint"), - help: Some(msg!( - "consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum" - )), - }; - } - - let non_exhaustive = def.variant_list_has_applicable_non_exhaustive(); - // Check the contained variants. - let ret = def.variants().iter().try_for_each(|variant| { - check_non_exhaustive_variant(non_exhaustive, variant) - .map_break(|reason| FfiUnsafe { ty, reason, help: None })?; - - match self.check_variant_for_ffi(state, ty, def, variant, args) { - FfiSafe => ControlFlow::Continue(()), - r => ControlFlow::Break(r), - } - }); - if let ControlFlow::Break(result) = ret { - return result; - } - - FfiSafe + self.visit_struct_or_union(state, ty, def, args) } + AdtKind::Enum => self.visit_enum(state, ty, def, args), } } - ty::Char => FfiUnsafe { + // Pattern types are just extra invariants on the type that you need to uphold, + // but only the base type is relevant for being representable in FFI. + // (note: this lint was written when pattern types could only be integers constrained to ranges) + ty::Pat(pat_ty, _) => self.visit_type(state, outer_ty, pat_ty), + + // types which likely have a stable representation, if the target architecture defines those + // note: before rust 1.77, 128-bit ints were not FFI-safe on x86_64 + ty::Int(..) | ty::Uint(..) | ty::Float(..) => FfiResult::FfiSafe, + + ty::Bool => FfiResult::FfiSafe, + + ty::Char => FfiResult::FfiUnsafe { ty, reason: msg!("the `char` type has no C equivalent"), help: Some(msg!("consider using `u32` or `libc::wchar_t` instead")), }, - // It's just extra invariants on the type that you need to uphold, - // but only the base type is relevant for being representable in FFI. - ty::Pat(base, ..) => self.visit_type(state, base), - - // Primitive types with a stable representation. - ty::Bool | ty::Int(..) | ty::Uint(..) | ty::Float(..) | ty::Never => FfiSafe, - ty::Slice(_) => FfiUnsafe { ty, reason: msg!("slices have no C equivalent"), @@ -610,19 +739,21 @@ fn visit_type(&mut self, state: VisitorState, ty: Ty<'tcx>) -> FfiResult<'tcx> { help: Some(msg!("consider using `*const u8` and a length instead")), }, - ty::Tuple(..) => FfiUnsafe { - ty, - reason: msg!("tuples have unspecified layout"), - help: Some(msg!("consider using a struct instead")), - }, + ty::Tuple(tuple) => { + // C functions can return void + let empty_and_safe = tuple.is_empty() + && outer_ty.contains(OuterTyData::NO_OUTER_TY) + && state.is_in_function_return(); - ty::RawPtr(ty, _) | ty::Ref(_, ty, _) - if { - (state.is_in_defined_function() || state.is_in_fnptr()) - && ty.is_sized(self.cx.tcx, self.cx.typing_env()) - } => - { - FfiSafe + if empty_and_safe { + FfiSafe + } else { + FfiUnsafe { + ty, + reason: msg!("tuples have unspecified layout"), + help: Some(msg!("consider using a struct instead")), + } + } } ty::RawPtr(ty, _) @@ -634,9 +765,32 @@ fn visit_type(&mut self, state: VisitorState, ty: Ty<'tcx>) -> FfiResult<'tcx> { FfiSafe } - ty::RawPtr(ty, _) | ty::Ref(_, ty, _) => self.visit_type(state, ty), + ty::RawPtr(inner_ty, _) => { + return self.visit_indirection(state, ty, inner_ty, IndirectionKind::RawPtr); + } + ty::Ref(_, inner_ty, _) => { + return self.visit_indirection(state, ty, inner_ty, IndirectionKind::Ref); + } - ty::Array(inner_ty, _) => self.visit_type(state, inner_ty), + ty::Array(inner_ty, _) => { + if state.is_in_function() + && outer_ty.contains(OuterTyData::NO_OUTER_TY) + // FIXME(ctypes): VVV-this-VVV shouldn't be the case + && !outer_ty.contains(OuterTyData::NO_OUTER_TY_FNPTR) + { + // C doesn't really support passing arrays by value - the only way to pass an array by value + // is through a struct. + FfiResult::FfiUnsafe { + ty, + reason: msg!("passing raw arrays by value is not FFI-safe"), + help: Some(msg!("consider passing a pointer to the array")), + } + } else { + // let's allow phantoms to go through, + // since an array of 1-ZSTs is also a 1-ZST + self.visit_type(state, OuterTyData::from_ty(ty), inner_ty) + } + } ty::FnPtr(sig_tys, hdr) => { let sig = sig_tys.with(hdr); @@ -652,22 +806,25 @@ fn visit_type(&mut self, state: VisitorState, ty: Ty<'tcx>) -> FfiResult<'tcx> { let sig = tcx.instantiate_bound_regions_with_erased(sig); for arg in sig.inputs() { - match self.visit_type(VisitorState::ARGUMENT_TY_IN_FNPTR, *arg) { + match self.visit_type( + VisitorState::ARGUMENT_TY_IN_FNPTR, + OuterTyData::from_ty(ty), + *arg, + ) { FfiSafe => {} r => return r, } } let ret_ty = sig.output(); - if ret_ty.is_unit() { - return FfiSafe; - } - self.visit_type(VisitorState::RETURN_TY_IN_FNPTR, ret_ty) + self.visit_type(VisitorState::RETURN_TY_IN_FNPTR, OuterTyData::from_ty(ty), ret_ty) } ty::Foreign(..) => FfiSafe, + ty::Never => FfiSafe, + // While opaque types are checked for earlier, if a projection in a struct field // normalizes to an opaque type, then it will reach this branch. ty::Alias(ty::AliasTy { kind: ty::Opaque { .. }, .. }) => { @@ -729,20 +886,6 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> Self::Result { }) } - /// Check if the type is array and emit an unsafe type lint. - fn check_for_array_ty(&mut self, ty: Ty<'tcx>) -> PartialFfiResult<'tcx> { - if let ty::Array(..) = ty.kind() { - Some(FfiResult::FfiUnsafe { - ty, - reason: msg!("passing raw arrays by value is not FFI-safe"), - help: Some(msg!("consider passing a pointer to the array")), - }) - } else { - None - } - } - - /// Determine the FFI-safety of a single (MIR) type, given the context of how it is used. fn check_type(&mut self, state: VisitorState, ty: Ty<'tcx>) -> FfiResult<'tcx> { let ty = self .cx @@ -753,23 +896,7 @@ fn check_type(&mut self, state: VisitorState, ty: Ty<'tcx>) -> FfiResult<'tcx> { return res; } - // C doesn't really support passing arrays by value - the only way to pass an array by value - // is through a struct. So, first test that the top level isn't an array, and then - // recursively check the types inside. - if state.is_in_function() { - if let Some(res) = self.check_for_array_ty(ty) { - return res; - } - } - - // Don't report FFI errors for unit return types. This check exists here, and not in - // the caller (where it would make more sense) so that normalization has definitely - // happened. - if state.is_in_function_return() && ty.is_unit() { - return FfiResult::FfiSafe; - } - - self.visit_type(state, ty) + self.visit_type(state, OuterTyData::NO_OUTER_TY, ty) } } diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index 96c7dec3d818..45ac2c59b04e 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -656,12 +656,6 @@ pub enum DeprecatedSinceKind { pub enum AttributeLintKind { UnexpectedCfgName((Symbol, Span), Option<(Symbol, Span)>), UnexpectedCfgValue((Symbol, Span), Option<(Symbol, Span)>), - DocTestTakesList, - DocTestUnknown { name: Symbol }, - DocTestLiteral, - AttrCrateLevelOnly, - DoNotRecommendDoesNotExpectArgs, - CrateTypeUnknown { span: Span, suggested: Option }, MalformedDoc, ExpectedNoArgs, ExpectedNameValue, diff --git a/compiler/rustc_middle/src/hir/map.rs b/compiler/rustc_middle/src/hir/map.rs index 68357212bebe..6a7850999831 100644 --- a/compiler/rustc_middle/src/hir/map.rs +++ b/compiler/rustc_middle/src/hir/map.rs @@ -1251,7 +1251,7 @@ fn force_delayed_owners_lowering(tcx: TyCtxt<'_>) { tcx.ensure_done().lower_delayed_owner(id); } - let (_, krate) = krate.delayed_resolver.steal(); + let (_, krate, _) = krate.delayed_resolver.steal(); let prof = tcx.sess.prof.clone(); // Drop AST to free memory. It can be expensive so try to drop it on a separate thread. diff --git a/compiler/rustc_middle/src/hir/mod.rs b/compiler/rustc_middle/src/hir/mod.rs index 7f82b9161fe6..c81b0a718255 100644 --- a/compiler/rustc_middle/src/hir/mod.rs +++ b/compiler/rustc_middle/src/hir/mod.rs @@ -16,7 +16,8 @@ use rustc_data_structures::steal::Steal; use rustc_data_structures::sync::{DynSend, DynSync, try_par_for_each_in}; use rustc_hir::def::{DefKind, Res}; -use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId}; +use rustc_hir::def_id::{DefId, LocalDefId, LocalDefIdMap, LocalModDefId}; +use rustc_hir::definitions::PerParentDisambiguatorState; use rustc_hir::*; use rustc_index::IndexVec; use rustc_macros::{Decodable, Encodable, HashStable}; @@ -39,7 +40,11 @@ pub struct Crate<'hir> { pub delayed_ids: FxIndexSet, // The resolver and AST crate which are set in the end of the `hir_crate` query // and then stolen and dropped in `force_delayed_owners_lowering`. - pub delayed_resolver: Steal<(ResolverAstLowering<'hir>, Arc)>, + pub delayed_resolver: Steal<( + ResolverAstLowering<'hir>, + Arc, + Arc>>, + )>, // Only present when incr. comp. is enabled. pub opt_hir_hash: Option, } @@ -48,7 +53,11 @@ impl<'hir> Crate<'hir> { pub fn new( owners: IndexVec>, delayed_ids: FxIndexSet, - delayed_resolver: Steal<(ResolverAstLowering<'hir>, Arc)>, + delayed_resolver: Steal<( + ResolverAstLowering<'hir>, + Arc, + Arc>>, + )>, opt_hir_hash: Option, ) -> Crate<'hir> { Crate { owners, delayed_ids, delayed_resolver, opt_hir_hash } diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 71b0077b6213..a65a5fcc6bff 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -32,7 +32,7 @@ use rustc_errors::{Applicability, Diag, DiagCtxtHandle, Diagnostic, MultiSpan}; use rustc_hir::def::DefKind; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE, LocalDefId}; -use rustc_hir::definitions::{DefPathData, Definitions, Disambiguator}; +use rustc_hir::definitions::{DefPathData, Definitions, PerParentDisambiguatorState}; use rustc_hir::intravisit::VisitorExt; use rustc_hir::lang_items::LangItem; use rustc_hir::limit::Limit; @@ -1399,7 +1399,7 @@ pub fn create_def( name: Option, def_kind: DefKind, override_def_path_data: Option, - disambiguator: &mut impl Disambiguator, + disambiguator: &mut PerParentDisambiguatorState, ) -> TyCtxtFeed<'tcx, LocalDefId> { let feed = self.tcx.create_def(parent, name, def_kind, override_def_path_data, disambiguator); @@ -1417,7 +1417,7 @@ pub fn create_def( name: Option, def_kind: DefKind, override_def_path_data: Option, - disambiguator: &mut impl Disambiguator, + disambiguator: &mut PerParentDisambiguatorState, ) -> TyCtxtFeed<'tcx, LocalDefId> { let data = override_def_path_data.unwrap_or_else(|| def_kind.def_path_data(name)); // The following call has the side effect of modifying the tables inside `definitions`. diff --git a/compiler/rustc_middle/src/ty/context/impl_interner.rs b/compiler/rustc_middle/src/ty/context/impl_interner.rs index 733985c606e2..ccda7aeb910c 100644 --- a/compiler/rustc_middle/src/ty/context/impl_interner.rs +++ b/compiler/rustc_middle/src/ty/context/impl_interner.rs @@ -166,10 +166,9 @@ fn variances_of(self, def_id: DefId) -> Self::VariancesOf { fn opt_alias_variances( self, - kind: impl Into, - def_id: DefId, + kind: impl Into>, ) -> Option<&'tcx [ty::Variance]> { - self.opt_alias_variances(kind, def_id) + self.opt_alias_variances(kind) } fn type_of(self, def_id: DefId) -> ty::EarlyBinder<'tcx, Ty<'tcx>> { @@ -205,29 +204,27 @@ fn alias_ty_kind_from_def_id(self, def_id: DefId) -> ty::AliasTyKind<'tcx> { } } - fn alias_term_kind(self, alias: ty::AliasTerm<'tcx>) -> ty::AliasTermKind { - match self.def_kind(alias.def_id) { + fn alias_term_kind_from_def_id(self, def_id: DefId) -> ty::AliasTermKind<'tcx> { + match self.def_kind(def_id) { DefKind::AssocTy => { - if let DefKind::Impl { of_trait: false } = self.def_kind(self.parent(alias.def_id)) - { - ty::AliasTermKind::InherentTy + if let DefKind::Impl { of_trait: false } = self.def_kind(self.parent(def_id)) { + ty::AliasTermKind::InherentTy { def_id } } else { - ty::AliasTermKind::ProjectionTy + ty::AliasTermKind::ProjectionTy { def_id } } } DefKind::AssocConst { .. } => { - if let DefKind::Impl { of_trait: false } = self.def_kind(self.parent(alias.def_id)) - { - ty::AliasTermKind::InherentConst + if let DefKind::Impl { of_trait: false } = self.def_kind(self.parent(def_id)) { + ty::AliasTermKind::InherentConst { def_id } } else { - ty::AliasTermKind::ProjectionConst + ty::AliasTermKind::ProjectionConst { def_id } } } - DefKind::OpaqueTy => ty::AliasTermKind::OpaqueTy, - DefKind::TyAlias => ty::AliasTermKind::FreeTy, - DefKind::Const { .. } => ty::AliasTermKind::FreeConst, + DefKind::OpaqueTy => ty::AliasTermKind::OpaqueTy { def_id }, + DefKind::TyAlias => ty::AliasTermKind::FreeTy { def_id }, + DefKind::Const { .. } => ty::AliasTermKind::FreeConst { def_id }, DefKind::AnonConst | DefKind::Ctor(_, CtorKind::Const) => { - ty::AliasTermKind::UnevaluatedConst + ty::AliasTermKind::UnevaluatedConst { def_id } } kind => bug!("unexpected DefKind in AliasTy: {kind:?}"), } diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 56a7abfac663..59cc6a601bfa 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -91,9 +91,9 @@ pub use self::opaque_types::OpaqueTypeKey; pub use self::pattern::{Pattern, PatternKind}; pub use self::predicate::{ - AliasTerm, ArgOutlivesPredicate, Clause, ClauseKind, CoercePredicate, ExistentialPredicate, - ExistentialPredicateStableCmpExt, ExistentialProjection, ExistentialTraitRef, - HostEffectPredicate, NormalizesTo, OutlivesPredicate, PolyCoercePredicate, + AliasTerm, AliasTermKind, ArgOutlivesPredicate, Clause, ClauseKind, CoercePredicate, + ExistentialPredicate, ExistentialPredicateStableCmpExt, ExistentialProjection, + ExistentialTraitRef, HostEffectPredicate, NormalizesTo, OutlivesPredicate, PolyCoercePredicate, PolyExistentialPredicate, PolyExistentialProjection, PolyExistentialTraitRef, PolyProjectionPredicate, PolyRegionOutlivesPredicate, PolySubtypePredicate, PolyTraitPredicate, PolyTraitRef, PolyTypeOutlivesPredicate, Predicate, PredicateKind, ProjectionPredicate, @@ -227,7 +227,7 @@ pub struct ResolverAstLowering<'tcx> { // Information about delegations which is used when handling recursive delegations pub delegation_infos: LocalDefIdMap, - pub per_parent_disambiguators: LocalDefIdMap>, + pub disambiguators: Steal>, } #[derive(Debug)] @@ -607,14 +607,14 @@ pub fn into_arg(self) -> GenericArg<'tcx> { } } - pub fn to_alias_term(self) -> Option> { + pub fn to_alias_term(self, tcx: TyCtxt<'tcx>) -> Option> { match self.kind() { TermKind::Ty(ty) => match *ty.kind() { ty::Alias(alias_ty) => Some(alias_ty.into()), _ => None, }, TermKind::Const(ct) => match ct.kind() { - ConstKind::Unevaluated(uv) => Some(uv.into()), + ConstKind::Unevaluated(uv) => Some(AliasTerm::from_unevaluated_const(tcx, uv)), _ => None, }, } diff --git a/compiler/rustc_middle/src/ty/predicate.rs b/compiler/rustc_middle/src/ty/predicate.rs index cb3b9fd1efac..d6aaf62c1d1a 100644 --- a/compiler/rustc_middle/src/ty/predicate.rs +++ b/compiler/rustc_middle/src/ty/predicate.rs @@ -9,6 +9,7 @@ pub type TraitRef<'tcx> = ir::TraitRef>; pub type AliasTerm<'tcx> = ir::AliasTerm>; +pub type AliasTermKind<'tcx> = ir::AliasTermKind>; pub type ProjectionPredicate<'tcx> = ir::ProjectionPredicate>; pub type ExistentialPredicate<'tcx> = ir::ExistentialPredicate>; pub type ExistentialTraitRef<'tcx> = ir::ExistentialTraitRef>; @@ -642,7 +643,7 @@ mod size_asserts { use super::*; // tidy-alphabetical-start - static_assert_size!(PredicateKind<'_>, 32); - static_assert_size!(WithCachedTypeInfo>, 56); + static_assert_size!(PredicateKind<'_>, 40); + static_assert_size!(WithCachedTypeInfo>, 64); // tidy-alphabetical-end } diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index d3132d3f6578..1b2332098665 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -1346,7 +1346,7 @@ fn pretty_print_inherent_projection( &mut self, alias_ty: ty::AliasTerm<'tcx>, ) -> Result<(), PrintError> { - let def_key = self.tcx().def_key(alias_ty.def_id); + let def_key = self.tcx().def_key(alias_ty.def_id()); self.print_path_with_generic_args( |p| { p.print_path_with_simple( @@ -3158,22 +3158,22 @@ macro_rules! define_print_and_forward_display { ty::AliasTerm<'tcx> { match self.kind(p.tcx()) { - ty::AliasTermKind::InherentTy | ty::AliasTermKind::InherentConst => p.pretty_print_inherent_projection(*self)?, - ty::AliasTermKind::ProjectionTy => { + ty::AliasTermKind::InherentTy {..} | ty::AliasTermKind::InherentConst {..} => p.pretty_print_inherent_projection(*self)?, + ty::AliasTermKind::ProjectionTy { def_id } => { if !(p.should_print_verbose() || with_reduced_queries()) - && p.tcx().is_impl_trait_in_trait(self.def_id) + && p.tcx().is_impl_trait_in_trait(def_id) { - p.pretty_print_rpitit(self.def_id, self.args)?; + p.pretty_print_rpitit(def_id, self.args)?; } else { - p.print_def_path(self.def_id, self.args)?; + p.print_def_path(def_id, self.args)?; } } - ty::AliasTermKind::FreeTy - | ty::AliasTermKind::FreeConst - | ty::AliasTermKind::OpaqueTy - | ty::AliasTermKind::UnevaluatedConst - | ty::AliasTermKind::ProjectionConst => { - p.print_def_path(self.def_id, self.args)?; + ty::AliasTermKind::FreeTy { def_id } + | ty::AliasTermKind::FreeConst { def_id } + | ty::AliasTermKind::OpaqueTy { def_id } + | ty::AliasTermKind::UnevaluatedConst { def_id } + | ty::AliasTermKind::ProjectionConst { def_id } => { + p.print_def_path(def_id, self.args)?; } } } diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs index 48d85689b188..321a48624962 100644 --- a/compiler/rustc_middle/src/ty/util.rs +++ b/compiler/rustc_middle/src/ty/util.rs @@ -939,24 +939,23 @@ pub fn peel_off_free_alias_tys(self, mut ty: Ty<'tcx>) -> Ty<'tcx> { // its (un)captured regions. pub fn opt_alias_variances( self, - kind: impl Into, - def_id: DefId, + kind: impl Into>, ) -> Option<&'tcx [ty::Variance]> { match kind.into() { - ty::AliasTermKind::ProjectionTy => { + ty::AliasTermKind::ProjectionTy { def_id } => { if self.is_impl_trait_in_trait(def_id) { Some(self.variances_of(def_id)) } else { None } } - ty::AliasTermKind::OpaqueTy => Some(self.variances_of(def_id)), - ty::AliasTermKind::InherentTy - | ty::AliasTermKind::InherentConst - | ty::AliasTermKind::FreeTy - | ty::AliasTermKind::FreeConst - | ty::AliasTermKind::UnevaluatedConst - | ty::AliasTermKind::ProjectionConst => None, + ty::AliasTermKind::OpaqueTy { def_id } => Some(self.variances_of(def_id)), + ty::AliasTermKind::InherentTy { .. } + | ty::AliasTermKind::InherentConst { .. } + | ty::AliasTermKind::FreeTy { .. } + | ty::AliasTermKind::FreeConst { .. } + | ty::AliasTermKind::UnevaluatedConst { .. } + | ty::AliasTermKind::ProjectionConst { .. } => None, } } } diff --git a/compiler/rustc_mir_transform/src/copy_prop.rs b/compiler/rustc_mir_transform/src/copy_prop.rs index 8456abc8d269..d107aa36d86e 100644 --- a/compiler/rustc_mir_transform/src/copy_prop.rs +++ b/compiler/rustc_mir_transform/src/copy_prop.rs @@ -38,12 +38,10 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { let mut any_replacement = false; // Locals that participate in copy propagation either as a source or a destination. let mut unified = DenseBitSet::new_empty(body.local_decls.len()); - let mut storage_to_remove = DenseBitSet::new_empty(body.local_decls.len()); for (local, &head) in ssa.copy_classes().iter_enumerated() { if local != head { any_replacement = true; - storage_to_remove.insert(head); unified.insert(head); unified.insert(local); } @@ -58,7 +56,7 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { // only if the head might be uninitialized at that point, or if the local is borrowed // (since we cannot easily determine when it's used). let storage_to_remove = if tcx.sess.emit_lifetime_markers() { - storage_to_remove.clear(); + let mut storage_to_remove = DenseBitSet::new_empty(body.local_decls.len()); // If the local is borrowed, we cannot easily determine if it is used, so we have to remove the storage statements. let borrowed_locals = ssa.borrowed_locals(); @@ -83,15 +81,16 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { storage_checker.visit_basic_block_data(bb, data); } - storage_checker.storage_to_remove + Some(storage_checker.storage_to_remove) } else { - // Remove the storage statements of all the head locals. - storage_to_remove + None }; + // If None, remove the storage statements of all the unified locals. + let storage_to_remove = storage_to_remove.as_ref().unwrap_or(&unified); debug!(?storage_to_remove); - Replacer { tcx, copy_classes: ssa.copy_classes(), unified, storage_to_remove } + Replacer { tcx, copy_classes: ssa.copy_classes(), unified: &unified, storage_to_remove } .visit_body_preserves_cfg(body); crate::simplify::remove_unused_definitions(body); @@ -106,8 +105,8 @@ fn is_required(&self) -> bool { /// all occurrences of the key get replaced by the value. struct Replacer<'a, 'tcx> { tcx: TyCtxt<'tcx>, - unified: DenseBitSet, - storage_to_remove: DenseBitSet, + unified: &'a DenseBitSet, + storage_to_remove: &'a DenseBitSet, copy_classes: &'a IndexSlice, } diff --git a/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs b/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs index d17d18885041..cfe07081ee21 100644 --- a/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs +++ b/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs @@ -70,10 +70,10 @@ use rustc_abi::{FieldIdx, VariantIdx}; use rustc_data_structures::steal::Steal; use rustc_data_structures::unord::UnordMap; -use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::def_id::{DefId, LocalDefId}; -use rustc_hir::definitions::DisambiguatorState; +use rustc_hir::definitions::PerParentDisambiguatorState; +use rustc_hir::{self as hir}; use rustc_middle::bug; use rustc_middle::hir::place::{Projection, ProjectionKind}; use rustc_middle::mir::visit::MutVisitor; @@ -221,7 +221,7 @@ pub(crate) fn coroutine_by_move_body_def_id<'tcx>( None, DefKind::SyntheticCoroutineBody, None, - &mut DisambiguatorState::new(), + &mut PerParentDisambiguatorState::new(parent_def_id), ); by_move_body.source = mir::MirSource::from_instance(InstanceKind::Item(body_def.def_id().to_def_id())); diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs index d9f5768e6079..5324c39e9f22 100644 --- a/compiler/rustc_mir_transform/src/gvn.rs +++ b/compiler/rustc_mir_transform/src/gvn.rs @@ -173,15 +173,16 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { storage_checker.visit_basic_block_data(bb, data); } - storage_checker.storage_to_remove + Some(storage_checker.storage_to_remove) } else { - // Remove the storage statements of all the reused locals. - state.reused_locals.clone() + None }; + // If None, remove the storage statements of all the reused locals. + let storage_to_remove = storage_to_remove.as_ref().unwrap_or(&state.reused_locals); debug!(?storage_to_remove); - StorageRemover { tcx, reused_locals: state.reused_locals, storage_to_remove } + StorageRemover { tcx, reused_locals: &state.reused_locals, storage_to_remove } .visit_body_preserves_cfg(body); } @@ -2058,13 +2059,13 @@ fn visit_terminator(&mut self, terminator: &mut Terminator<'tcx>, location: Loca } } -struct StorageRemover<'tcx> { +struct StorageRemover<'a, 'tcx> { tcx: TyCtxt<'tcx>, - reused_locals: DenseBitSet, - storage_to_remove: DenseBitSet, + reused_locals: &'a DenseBitSet, + storage_to_remove: &'a DenseBitSet, } -impl<'tcx> MutVisitor<'tcx> for StorageRemover<'tcx> { +impl<'a, 'tcx> MutVisitor<'tcx> for StorageRemover<'a, 'tcx> { fn tcx(&self) -> TyCtxt<'tcx> { self.tcx } diff --git a/compiler/rustc_monomorphize/src/partitioning.rs b/compiler/rustc_monomorphize/src/partitioning.rs index 6f9795fb3bff..05914f4199ae 100644 --- a/compiler/rustc_monomorphize/src/partitioning.rs +++ b/compiler/rustc_monomorphize/src/partitioning.rs @@ -109,6 +109,7 @@ use rustc_middle::bug; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc_middle::middle::exported_symbols::{SymbolExportInfo, SymbolExportLevel}; +use rustc_middle::mir::StatementKind; use rustc_middle::mono::{ CodegenUnit, CodegenUnitNameBuilder, InstantiationMode, MonoItem, MonoItemData, MonoItemPartitions, Visibility, @@ -1334,7 +1335,21 @@ pub(crate) fn provide(providers: &mut Providers) { | InstanceKind::DropGlue(..) | InstanceKind::AsyncDropGlueCtorShim(..) => { let mir = tcx.instance_mir(instance.def); - mir.basic_blocks.iter().map(|bb| bb.statements.len() + 1).sum() + mir.basic_blocks + .iter() + .map(|bb| { + bb.statements + .iter() + .filter_map(|stmt| match stmt.kind { + StatementKind::StorageLive(_) | StatementKind::StorageDead(_) => { + None + } + _ => Some(stmt), + }) + .count() + + 1 + }) + .sum() } // Other compiler-generated shims size estimate: 1 _ => 1, diff --git a/compiler/rustc_next_trait_solver/src/solve/alias_relate.rs b/compiler/rustc_next_trait_solver/src/solve/alias_relate.rs index f7bd46009432..7c79dba61a6d 100644 --- a/compiler/rustc_next_trait_solver/src/solve/alias_relate.rs +++ b/compiler/rustc_next_trait_solver/src/solve/alias_relate.rs @@ -41,14 +41,14 @@ pub(super) fn compute_alias_relate_goal( // `{type error}` if the alias still contains infer vars, so we also // accept alias-relate goals where one of the terms is an error. debug_assert!( - lhs.to_alias_term().is_some() - || rhs.to_alias_term().is_some() + lhs.to_alias_term(self.cx()).is_some() + || rhs.to_alias_term(self.cx()).is_some() || lhs.is_error() || rhs.is_error() ); // Structurally normalize the lhs. - let lhs = if let Some(alias) = lhs.to_alias_term() { + let lhs = if let Some(alias) = lhs.to_alias_term(self.cx()) { let term = self.next_term_infer_of_kind(lhs); self.add_goal( GoalSource::TypeRelating, @@ -60,7 +60,7 @@ pub(super) fn compute_alias_relate_goal( }; // Structurally normalize the rhs. - let rhs = if let Some(alias) = rhs.to_alias_term() { + let rhs = if let Some(alias) = rhs.to_alias_term(self.cx()) { let term = self.next_term_infer_of_kind(rhs); self.add_goal( GoalSource::TypeRelating, @@ -87,7 +87,7 @@ pub(super) fn compute_alias_relate_goal( ty::AliasRelationDirection::Equate => ty::Invariant, ty::AliasRelationDirection::Subtype => ty::Covariant, }; - match (lhs.to_alias_term(), rhs.to_alias_term()) { + match (lhs.to_alias_term(self.cx()), rhs.to_alias_term(self.cx())) { (None, None) => { self.relate(param_env, lhs, variance, rhs)?; self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) diff --git a/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs b/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs index c3bffb5475c7..0bbc6f483104 100644 --- a/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs +++ b/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs @@ -958,7 +958,7 @@ fn projection_may_match( source_projection: ty::Binder>, target_projection: ty::AliasTerm, ) -> bool { - source_projection.item_def_id() == target_projection.def_id + source_projection.item_def_id() == target_projection.def_id() && self .ecx .probe(|_| ProbeKind::ProjectionCompatibility) @@ -982,7 +982,7 @@ fn try_eagerly_replace_alias( return Ok(None); } - let Some(replacements) = self.mapping.get(&alias_term.def_id) else { + let Some(replacements) = self.mapping.get(&alias_term.def_id()) else { return Ok(None); }; diff --git a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs index 8933ac16b2b1..e224febd3c92 100644 --- a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs +++ b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs @@ -964,8 +964,8 @@ pub(super) fn relate_rigid_alias_non_alias( // // Alternatively we could modify `Equate` for this case by adding another // variant to `StructurallyRelateAliases`. - let identity_args = self.fresh_args_for_item(alias.def_id); - let rigid_ctor = ty::AliasTerm::new_from_args(cx, alias.def_id, identity_args); + let identity_args = self.fresh_args_for_item(alias.def_id()); + let rigid_ctor = alias.with_args(cx, identity_args); let ctor_term = rigid_ctor.to_term(cx); let obligations = self.delegate.eq_structurally_relating_aliases( param_env, diff --git a/compiler/rustc_next_trait_solver/src/solve/mod.rs b/compiler/rustc_next_trait_solver/src/solve/mod.rs index d37b328920ce..793d45f22d39 100644 --- a/compiler/rustc_next_trait_solver/src/solve/mod.rs +++ b/compiler/rustc_next_trait_solver/src/solve/mod.rs @@ -344,7 +344,7 @@ fn structurally_normalize_term( param_env: I::ParamEnv, term: I::Term, ) -> Result { - if let Some(_) = term.to_alias_term() { + if let Some(_) = term.to_alias_term(self.cx()) { let normalized_term = self.next_term_infer_of_kind(term); let alias_relate_goal = Goal::new( self.cx(), diff --git a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/anon_const.rs b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/anon_const.rs index 46312be5ea9a..b3703639d99e 100644 --- a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/anon_const.rs +++ b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/anon_const.rs @@ -17,7 +17,7 @@ pub(super) fn normalize_anon_const( if let Some(normalized_const) = self.evaluate_const( goal.param_env, ty::UnevaluatedConst::new( - goal.predicate.alias.def_id.try_into().unwrap(), + goal.predicate.alias.def_id().try_into().unwrap(), goal.predicate.alias.args, ), ) { diff --git a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/free_alias.rs b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/free_alias.rs index c827494dd290..f3004e4c8105 100644 --- a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/free_alias.rs +++ b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/free_alias.rs @@ -24,16 +24,16 @@ pub(super) fn normalize_free_alias( // Check where clauses self.add_goals( GoalSource::Misc, - cx.predicates_of(free_alias.def_id) + cx.predicates_of(free_alias.def_id()) .iter_instantiated(cx, free_alias.args) .map(Unnormalized::skip_norm_wip) .map(|pred| goal.with(cx, pred)), ); let actual = if free_alias.kind(cx).is_type() { - cx.type_of(free_alias.def_id).instantiate(cx, free_alias.args).skip_norm_wip().into() + cx.type_of(free_alias.def_id()).instantiate(cx, free_alias.args).skip_norm_wip().into() } else { - cx.const_of_item(free_alias.def_id) + cx.const_of_item(free_alias.def_id()) .instantiate(cx, free_alias.args) .skip_norm_wip() .into() diff --git a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/inherent.rs b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/inherent.rs index 7b228d4c7b46..4d62407fe299 100644 --- a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/inherent.rs +++ b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/inherent.rs @@ -22,7 +22,7 @@ pub(super) fn normalize_inherent_associated_term( let cx = self.cx(); let inherent = goal.predicate.alias; - let impl_def_id = cx.parent(inherent.def_id); + let impl_def_id = cx.parent(inherent.def_id()); let impl_args = self.fresh_args_for_item(impl_def_id); // Equate impl header and add impl where clauses @@ -46,16 +46,19 @@ pub(super) fn normalize_inherent_associated_term( // to be very careful when changing the impl where-clauses to be productive. self.add_goals( GoalSource::Misc, - cx.predicates_of(inherent.def_id) + cx.predicates_of(inherent.def_id()) .iter_instantiated(cx, inherent_args) .map(Unnormalized::skip_norm_wip) .map(|pred| goal.with(cx, pred)), ); let normalized = if inherent.kind(cx).is_type() { - cx.type_of(inherent.def_id).instantiate(cx, inherent_args).skip_norm_wip().into() + cx.type_of(inherent.def_id()).instantiate(cx, inherent_args).skip_norm_wip().into() } else { - cx.const_of_item(inherent.def_id).instantiate(cx, inherent_args).skip_norm_wip().into() + cx.const_of_item(inherent.def_id()) + .instantiate(cx, inherent_args) + .skip_norm_wip() + .into() }; self.instantiate_normalizes_to_term(goal, normalized); self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) diff --git a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs index bbc5739268ef..1d74f1efe913 100644 --- a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs +++ b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs @@ -34,7 +34,7 @@ pub(super) fn compute_normalizes_to_goal( debug_assert!(self.term_is_fully_unconstrained(goal)); let cx = self.cx(); match goal.predicate.alias.kind(cx) { - ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst => { + ty::AliasTermKind::ProjectionTy { .. } | ty::AliasTermKind::ProjectionConst { .. } => { let trait_ref = goal.predicate.alias.trait_ref(cx); let (_, proven_via) = self.probe(|_| ProbeKind::ShadowedEnvProbing).enter(|ecx| { @@ -85,14 +85,14 @@ pub(super) fn compute_normalizes_to_goal( }, ) } - ty::AliasTermKind::InherentTy | ty::AliasTermKind::InherentConst => { + ty::AliasTermKind::InherentTy { .. } | ty::AliasTermKind::InherentConst { .. } => { self.normalize_inherent_associated_term(goal) } - ty::AliasTermKind::OpaqueTy => self.normalize_opaque_type(goal), - ty::AliasTermKind::FreeTy | ty::AliasTermKind::FreeConst => { + ty::AliasTermKind::OpaqueTy { .. } => self.normalize_opaque_type(goal), + ty::AliasTermKind::FreeTy { .. } | ty::AliasTermKind::FreeConst { .. } => { self.normalize_free_alias(goal) } - ty::AliasTermKind::UnevaluatedConst => self.normalize_anon_const(goal), + ty::AliasTermKind::UnevaluatedConst { .. } => self.normalize_anon_const(goal), } } @@ -268,8 +268,8 @@ fn consider_impl_candidate( let error_response = |ecx: &mut EvalCtxt<'_, D>, guar| { let error_term = match goal.predicate.alias.kind(cx) { - ty::AliasTermKind::ProjectionTy => Ty::new_error(cx, guar).into(), - ty::AliasTermKind::ProjectionConst => Const::new_error(cx, guar).into(), + ty::AliasTermKind::ProjectionTy { .. } => Ty::new_error(cx, guar).into(), + ty::AliasTermKind::ProjectionConst { .. } => Const::new_error(cx, guar).into(), kind => panic!("expected projection, found {kind:?}"), }; ecx.instantiate_normalizes_to_term(goal, error_term); @@ -384,10 +384,10 @@ fn consider_impl_candidate( // Finally we construct the actual value of the associated type. let term = match goal.predicate.alias.kind(cx) { - ty::AliasTermKind::ProjectionTy => { + ty::AliasTermKind::ProjectionTy { .. } => { cx.type_of(target_item_def_id).map_bound(|ty| ty.into()) } - ty::AliasTermKind::ProjectionConst => { + ty::AliasTermKind::ProjectionConst { .. } => { cx.const_of_item(target_item_def_id).map_bound(|ct| ct.into()) } kind => panic!("expected projection, found {kind:?}"), @@ -472,7 +472,7 @@ fn consider_builtin_fn_trait_candidates( let pred = ty::ProjectionPredicate { projection_term: ty::AliasTerm::new( cx, - goal.predicate.def_id(), + cx.alias_term_kind_from_def_id(goal.predicate.def_id()), [goal.predicate.self_ty(), inputs], ), term: output.into(), @@ -526,7 +526,7 @@ fn consider_builtin_async_fn_trait_candidates( ( ty::AliasTerm::new( cx, - goal.predicate.def_id(), + cx.alias_term_kind_from_def_id(goal.predicate.def_id()), [goal.predicate.self_ty(), tupled_inputs_ty], ), output_coroutine_ty.into(), @@ -535,7 +535,7 @@ fn consider_builtin_async_fn_trait_candidates( ( ty::AliasTerm::new( cx, - goal.predicate.def_id(), + cx.alias_term_kind_from_def_id(goal.predicate.def_id()), [ I::GenericArg::from(goal.predicate.self_ty()), tupled_inputs_ty.into(), @@ -548,7 +548,7 @@ fn consider_builtin_async_fn_trait_candidates( ( ty::AliasTerm::new( cx, - goal.predicate.def_id(), + cx.alias_term_kind_from_def_id(goal.predicate.def_id()), [goal.predicate.self_ty(), tupled_inputs_ty], ), coroutine_return_ty.into(), @@ -746,7 +746,11 @@ fn consider_builtin_future_candidate( CandidateSource::BuiltinImpl(BuiltinImplSource::Misc), goal, ty::ProjectionPredicate { - projection_term: ty::AliasTerm::new(ecx.cx(), goal.predicate.def_id(), [self_ty]), + projection_term: ty::AliasTerm::new( + ecx.cx(), + cx.alias_term_kind_from_def_id(goal.predicate.def_id()), + [self_ty], + ), term, } .upcast(cx), @@ -778,7 +782,11 @@ fn consider_builtin_iterator_candidate( CandidateSource::BuiltinImpl(BuiltinImplSource::Misc), goal, ty::ProjectionPredicate { - projection_term: ty::AliasTerm::new(ecx.cx(), goal.predicate.def_id(), [self_ty]), + projection_term: ty::AliasTerm::new( + ecx.cx(), + cx.alias_term_kind_from_def_id(goal.predicate.def_id()), + [self_ty], + ), term, } .upcast(cx), @@ -863,7 +871,7 @@ fn consider_builtin_coroutine_candidate( ty::ProjectionPredicate { projection_term: ty::AliasTerm::new( ecx.cx(), - goal.predicate.def_id(), + cx.alias_term_kind_from_def_id(goal.predicate.def_id()), [self_ty, coroutine.resume_ty()], ), term, diff --git a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/opaque_types.rs b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/opaque_types.rs index 931dd293973a..6e21366955d8 100644 --- a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/opaque_types.rs +++ b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/opaque_types.rs @@ -26,7 +26,7 @@ pub(super) fn normalize_opaque_type( // An impossible opaque type bound is the only way this goal will fail // e.g. assigning `impl Copy := NotCopy` self.add_item_bounds_for_hidden_type( - opaque_ty.def_id, + opaque_ty.def_id(), opaque_ty.args, goal.param_env, expected, @@ -43,7 +43,7 @@ pub(super) fn normalize_opaque_type( } | TypingMode::Borrowck { defining_opaque_types } => { let Some(def_id) = opaque_ty - .def_id + .def_id() .as_local() .filter(|&def_id| defining_opaque_types.contains(&def_id)) else { @@ -110,7 +110,7 @@ pub(super) fn normalize_opaque_type( } TypingMode::PostBorrowckAnalysis { defined_opaque_types } => { let Some(def_id) = opaque_ty - .def_id + .def_id() .as_local() .filter(|&def_id| defined_opaque_types.contains(&def_id)) else { @@ -133,7 +133,7 @@ pub(super) fn normalize_opaque_type( TypingMode::PostAnalysis => { // FIXME: Add an assertion that opaque type storage is empty. let actual = - cx.type_of(opaque_ty.def_id).instantiate(cx, opaque_ty.args).skip_norm_wip(); + cx.type_of(opaque_ty.def_id()).instantiate(cx, opaque_ty.args).skip_norm_wip(); self.eq(goal.param_env, expected, actual)?; self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) } diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 10a805a159b0..06dd8cbc089b 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -51,31 +51,9 @@ use crate::errors; #[derive(Diagnostic)] -#[diag("`#[diagnostic::on_unimplemented]` can only be applied to trait definitions")] -struct DiagnosticOnUnimplementedOnlyForTraits; - -#[derive(Diagnostic)] -#[diag("`#[diagnostic::on_const]` can only be applied to trait impls")] -struct DiagnosticOnConstOnlyForTraitImpls { - #[label("not a trait impl")] - item_span: Span, -} - -#[derive(Diagnostic)] -#[diag("`#[diagnostic::on_const]` can only be applied to non-const trait impls")] +#[diag("`#[diagnostic::on_const]` can only be applied to non-const trait implementations")] struct DiagnosticOnConstOnlyForNonConstTraitImpls { - #[label("this is a const trait impl")] - item_span: Span, -} - -#[derive(Diagnostic)] -#[diag("`#[diagnostic::on_move]` can only be applied to enums, structs or unions")] -struct DiagnosticOnMoveOnlyForAdt; - -#[derive(Diagnostic)] -#[diag("`#[diagnostic::on_unknown]` can only be applied to `use` statements")] -struct DiagnosticOnUnknownOnlyForImports { - #[label("not an import")] + #[label("this is a const trait implementation")] item_span: Span, } @@ -221,12 +199,10 @@ fn check_attributes( Attribute::Parsed(AttributeKind::RustcMustImplementOneOf { attr_span, fn_names }) => { self.check_rustc_must_implement_one_of(*attr_span, fn_names, hir_id,target) }, - Attribute::Parsed(AttributeKind::DoNotRecommend{attr_span}) => {self.check_do_not_recommend(*attr_span, hir_id, target, item)}, - Attribute::Parsed(AttributeKind::OnUnimplemented{span, directive}) => {self.check_diagnostic_on_unimplemented(*span, hir_id, target,directive.as_deref())}, - Attribute::Parsed(AttributeKind::OnUnknown { span, .. }) => { self.check_diagnostic_on_unknown(*span, hir_id, target) }, + Attribute::Parsed(AttributeKind::OnUnimplemented{directive,..}) => {self.check_diagnostic_on_unimplemented(hir_id, directive.as_deref())}, Attribute::Parsed(AttributeKind::OnConst{span, ..}) => {self.check_diagnostic_on_const(*span, hir_id, target, item)} - Attribute::Parsed(AttributeKind::OnMove { span, directive }) => { - self.check_diagnostic_on_move(*span, hir_id, target, directive.as_deref()) + Attribute::Parsed(AttributeKind::OnMove { directive , .. }) => { + self.check_diagnostic_on_move(hir_id, directive.as_deref()) }, Attribute::Parsed( // tidy-alphabetical-start @@ -245,6 +221,7 @@ fn check_attributes( | AttributeKind::CustomMir(..) | AttributeKind::DebuggerVisualizer(..) | AttributeKind::DefaultLibAllocator + | AttributeKind::DoNotRecommend {..} // `#[doc]` is actually a lot more than just doc comments, so is checked below | AttributeKind::DocComment {..} | AttributeKind::EiiDeclaration { .. } @@ -275,6 +252,7 @@ fn check_attributes( | AttributeKind::NoMain | AttributeKind::NoMangle(..) | AttributeKind::NoStd { .. } + | AttributeKind::OnUnknown { .. } | AttributeKind::Optimize(..) | AttributeKind::PanicRuntime | AttributeKind::PatchableFunctionEntry { .. } @@ -512,47 +490,8 @@ fn check_eii_impl(&self, impls: &[EiiImpl], target: Target) { } } - /// Checks if `#[diagnostic::do_not_recommend]` is applied on a trait impl - fn check_do_not_recommend( - &self, - attr_span: Span, - hir_id: HirId, - target: Target, - item: Option>, - ) { - if !matches!(target, Target::Impl { .. }) - || matches!( - item, - Some(ItemLike::Item(hir::Item { kind: hir::ItemKind::Impl(_impl),.. })) - if _impl.of_trait.is_none() - ) - { - self.tcx.emit_node_span_lint( - MISPLACED_DIAGNOSTIC_ATTRIBUTES, - hir_id, - attr_span, - errors::IncorrectDoNotRecommendLocation, - ); - } - } - - /// Checks if `#[diagnostic::on_unimplemented]` is applied to a trait definition - fn check_diagnostic_on_unimplemented( - &self, - attr_span: Span, - hir_id: HirId, - target: Target, - directive: Option<&Directive>, - ) { - if !matches!(target, Target::Trait) { - self.tcx.emit_node_span_lint( - MISPLACED_DIAGNOSTIC_ATTRIBUTES, - hir_id, - attr_span, - DiagnosticOnUnimplementedOnlyForTraits, - ); - } - + /// Checks use of generic formatting parameters in `#[diagnostic::on_unimplemented]` + fn check_diagnostic_on_unimplemented(&self, hir_id: HirId, directive: Option<&Directive>) { if let Some(directive) = directive { if let Node::Item(Item { kind: ItemKind::Trait(_, _, _, _, trait_name, generics, _, _), @@ -587,7 +526,7 @@ fn check_diagnostic_on_unimplemented( } } - /// Checks if `#[diagnostic::on_const]` is applied to a trait impl + /// Checks if `#[diagnostic::on_const]` is applied to a on-const trait impl fn check_diagnostic_on_const( &self, attr_span: Span, @@ -595,6 +534,8 @@ fn check_diagnostic_on_const( target: Target, item: Option>, ) { + // We only check the non-constness here. A diagnostic for use + // on not-trait impl items is issued during attribute parsing. if target == (Target::Impl { of_trait: true }) { match item.unwrap() { ItemLike::Item(it) => match it.expect_impl().constness { @@ -613,35 +554,13 @@ fn check_diagnostic_on_const( ItemLike::ForeignItem => {} } } - let item_span = self.tcx.hir_span(hir_id); - self.tcx.emit_node_span_lint( - MISPLACED_DIAGNOSTIC_ATTRIBUTES, - hir_id, - attr_span, - DiagnosticOnConstOnlyForTraitImpls { item_span }, - ); - - // We don't check the validity of generic args here...whose generics would that be, anyway? - // The traits' or the impls'? + // FIXME(#155570) Can we do something with generic args here? + // regardless, we don't check the validity of generic args here + // ...whose generics would that be, anyway? The traits' or the impls'? } - /// Checks if `#[diagnostic::on_move]` is applied to an ADT definition - fn check_diagnostic_on_move( - &self, - attr_span: Span, - hir_id: HirId, - target: Target, - directive: Option<&Directive>, - ) { - if !matches!(target, Target::Enum | Target::Struct | Target::Union) { - self.tcx.emit_node_span_lint( - MISPLACED_DIAGNOSTIC_ATTRIBUTES, - hir_id, - attr_span, - DiagnosticOnMoveOnlyForAdt, - ); - } - + /// Checks use of generic formatting parameters in `#[diagnostic::on_move]` + fn check_diagnostic_on_move(&self, hir_id: HirId, directive: Option<&Directive>) { if let Some(directive) = directive { if let Node::Item(Item { kind: @@ -675,19 +594,6 @@ fn check_diagnostic_on_move( } } - /// Checks if `#[diagnostic::on_unknown]` is applied to a trait impl - fn check_diagnostic_on_unknown(&self, attr_span: Span, hir_id: HirId, target: Target) { - if !matches!(target, Target::Use) { - let item_span = self.tcx.hir_span(hir_id); - self.tcx.emit_node_span_lint( - MISPLACED_DIAGNOSTIC_ATTRIBUTES, - hir_id, - attr_span, - DiagnosticOnUnknownOnlyForImports { item_span }, - ); - } - } - /// Checks if an `#[inline]` is applied to a function or a closure. fn check_inline(&self, hir_id: HirId, attr_span: Span, kind: &InlineAttr, target: Target) { match target { diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index 0423613069fa..e229559ae9e5 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -8,7 +8,7 @@ use hir::def_id::{LocalDefIdMap, LocalDefIdSet}; use rustc_abi::FieldIdx; -use rustc_data_structures::fx::FxIndexSet; +use rustc_data_structures::fx::{FxHashSet, FxIndexSet}; use rustc_errors::{ErrorGuaranteed, MultiSpan}; use rustc_hir::def::{CtorOf, DefKind, Res}; use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId}; @@ -75,11 +75,46 @@ enum ComesFromAllowExpect { No, } +/// Carries both the propagated `allow/expect` context and the current item's +/// own `allow/expect` status. +/// +/// For example: +/// +/// ```rust +/// #[expect(dead_code)] +/// fn root() { middle() } +/// +/// fn middle() { leaf() } +/// +/// #[expect(dead_code)] +/// fn leaf() {} +/// ``` +/// +/// The seed for `root` starts as `propagated = Yes, own = Yes`. +/// +/// When `root` reaches `middle`, the propagated context stays `Yes`, but +/// `middle` itself does not have `#[allow(dead_code)]` or `#[expect(dead_code)]`, +/// so its work item becomes `propagated = Yes, own = No`. +/// +/// When `middle` reaches `leaf`, that same propagated `Yes` context is preserved, +/// and since `leaf` itself has `#[expect(dead_code)]`, its work item becomes +/// `propagated = Yes, own = Yes`. +/// +/// In general, `propagated` controls whether descendants are still explored +/// under an `allow/expect` context, while `own` controls whether the current +/// item itself should be excluded from `live_symbols`. +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +struct WorkItem { + id: LocalDefId, + propagated: ComesFromAllowExpect, + own: ComesFromAllowExpect, +} + struct MarkSymbolVisitor<'tcx> { - worklist: Vec<(LocalDefId, ComesFromAllowExpect)>, + worklist: Vec, tcx: TyCtxt<'tcx>, maybe_typeck_results: Option<&'tcx ty::TypeckResults<'tcx>>, - scanned: LocalDefIdSet, + scanned: FxHashSet<(LocalDefId, ComesFromAllowExpect)>, live_symbols: LocalDefIdSet, repr_unconditionally_treats_fields_as_live: bool, repr_has_repr_simd: bool, @@ -89,6 +124,7 @@ struct MarkSymbolVisitor<'tcx> { // and the span of their respective impl (i.e., part of the derive // macro) ignored_derived_traits: LocalDefIdMap>, + propagated_comes_from_allow_expect: ComesFromAllowExpect, } impl<'tcx> MarkSymbolVisitor<'tcx> { @@ -101,19 +137,45 @@ fn typeck_results(&self) -> &'tcx ty::TypeckResults<'tcx> { .expect("`MarkSymbolVisitor::typeck_results` called outside of body") } + /// Returns whether `def_id` itself should be treated as coming from + /// `#[allow(dead_code)]` or `#[expect(dead_code)]` in the current + /// propagated work-item context. + fn own_comes_from_allow_expect(&self, def_id: LocalDefId) -> ComesFromAllowExpect { + if self.propagated_comes_from_allow_expect == ComesFromAllowExpect::Yes + && let Some(ComesFromAllowExpect::Yes) = + has_allow_dead_code_or_lang_attr(self.tcx, def_id) + { + ComesFromAllowExpect::Yes + } else { + ComesFromAllowExpect::No + } + } + fn check_def_id(&mut self, def_id: DefId) { if let Some(def_id) = def_id.as_local() { + let own_comes_from_allow_expect = self.own_comes_from_allow_expect(def_id); + if should_explore(self.tcx, def_id) { - self.worklist.push((def_id, ComesFromAllowExpect::No)); + self.worklist.push(WorkItem { + id: def_id, + propagated: self.propagated_comes_from_allow_expect, + own: own_comes_from_allow_expect, + }); + } + + if own_comes_from_allow_expect == ComesFromAllowExpect::No { + self.live_symbols.insert(def_id); } - self.live_symbols.insert(def_id); } } fn insert_def_id(&mut self, def_id: DefId) { if let Some(def_id) = def_id.as_local() { debug_assert!(!should_explore(self.tcx, def_id)); - self.live_symbols.insert(def_id); + + if self.own_comes_from_allow_expect(def_id) == ComesFromAllowExpect::No { + self.live_symbols.insert(def_id); + } } } @@ -323,7 +385,8 @@ fn handle_offset_of(&mut self, expr: &'tcx hir::Expr<'tcx>) { fn mark_live_symbols(&mut self) -> as Visitor<'tcx>>::Result { while let Some(work) = self.worklist.pop() { - let (mut id, comes_from_allow_expect) = work; + let WorkItem { mut id, propagated, own } = work; + self.propagated_comes_from_allow_expect = propagated; // in the case of tuple struct constructors we want to check the item, // not the generated tuple struct constructor function @@ -352,14 +415,14 @@ fn mark_live_symbols(&mut self) -> as Visitor<'tcx>>::R // this "duplication" is essential as otherwise a function with `#[expect]` // called from a `pub fn` may be falsely reported as not live, falsely // triggering the `unfulfilled_lint_expectations` lint. - match comes_from_allow_expect { + match own { ComesFromAllowExpect::Yes => {} ComesFromAllowExpect::No => { self.live_symbols.insert(id); } } - if !self.scanned.insert(id) { + if !self.scanned.insert((id, propagated)) { continue; } @@ -694,7 +757,11 @@ fn visit_trait_ref(&mut self, t: &'tcx hir::TraitRef<'tcx>) -> Self::Result { ) .and_then(|item| item.def_id.as_local()) { - self.worklist.push((local_def_id, ComesFromAllowExpect::No)); + self.worklist.push(WorkItem { + id: local_def_id, + propagated: ComesFromAllowExpect::No, + own: ComesFromAllowExpect::No, + }); } } } @@ -752,23 +819,27 @@ fn has_used_like_attr(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool { fn maybe_record_as_seed<'tcx>( tcx: TyCtxt<'tcx>, owner_id: hir::OwnerId, - worklist: &mut Vec<(LocalDefId, ComesFromAllowExpect)>, + worklist: &mut Vec, unsolved_items: &mut Vec, ) { let allow_dead_code = has_allow_dead_code_or_lang_attr(tcx, owner_id.def_id); if let Some(comes_from_allow) = allow_dead_code { - worklist.push((owner_id.def_id, comes_from_allow)); + worklist.push(WorkItem { + id: owner_id.def_id, + propagated: comes_from_allow, + own: comes_from_allow, + }); } match tcx.def_kind(owner_id) { DefKind::Enum => { if let Some(comes_from_allow) = allow_dead_code { let adt = tcx.adt_def(owner_id); - worklist.extend( - adt.variants() - .iter() - .map(|variant| (variant.def_id.expect_local(), comes_from_allow)), - ); + worklist.extend(adt.variants().iter().map(|variant| WorkItem { + id: variant.def_id.expect_local(), + propagated: comes_from_allow, + own: comes_from_allow, + })); } } DefKind::AssocFn | DefKind::AssocConst { .. } | DefKind::AssocTy => { @@ -783,7 +854,11 @@ fn maybe_record_as_seed<'tcx>( && let Some(comes_from_allow) = has_allow_dead_code_or_lang_attr(tcx, trait_item_local_def_id) { - worklist.push((owner_id.def_id, comes_from_allow)); + worklist.push(WorkItem { + id: owner_id.def_id, + propagated: comes_from_allow, + own: comes_from_allow, + }); } // We only care about associated items of traits, @@ -804,7 +879,11 @@ fn maybe_record_as_seed<'tcx>( && let Some(comes_from_allow) = has_allow_dead_code_or_lang_attr(tcx, trait_def_id) { - worklist.push((owner_id.def_id, comes_from_allow)); + worklist.push(WorkItem { + id: owner_id.def_id, + propagated: comes_from_allow, + own: comes_from_allow, + }); } unsolved_items.push(owner_id.def_id); @@ -812,38 +891,48 @@ fn maybe_record_as_seed<'tcx>( } DefKind::GlobalAsm => { // global_asm! is always live. - worklist.push((owner_id.def_id, ComesFromAllowExpect::No)); + worklist.push(WorkItem { + id: owner_id.def_id, + propagated: ComesFromAllowExpect::No, + own: ComesFromAllowExpect::No, + }); } DefKind::Const { .. } => { if tcx.item_name(owner_id.def_id) == kw::Underscore { // `const _` is always live, as that syntax only exists for the side effects // of type checking and evaluating the constant expression, and marking them // as dead code would defeat that purpose. - worklist.push((owner_id.def_id, ComesFromAllowExpect::No)); + worklist.push(WorkItem { + id: owner_id.def_id, + propagated: ComesFromAllowExpect::No, + own: ComesFromAllowExpect::No, + }); } } _ => {} } } -fn create_and_seed_worklist( - tcx: TyCtxt<'_>, -) -> (Vec<(LocalDefId, ComesFromAllowExpect)>, Vec) { +fn create_and_seed_worklist(tcx: TyCtxt<'_>) -> (Vec, Vec) { let effective_visibilities = &tcx.effective_visibilities(()); let mut unsolved_impl_item = Vec::new(); let mut worklist = effective_visibilities .iter() .filter_map(|(&id, effective_vis)| { - effective_vis - .is_public_at_level(Level::Reachable) - .then_some(id) - .map(|id| (id, ComesFromAllowExpect::No)) + effective_vis.is_public_at_level(Level::Reachable).then_some(id).map(|id| WorkItem { + id, + propagated: ComesFromAllowExpect::No, + own: ComesFromAllowExpect::No, + }) }) // Seed entry point - .chain( - tcx.entry_fn(()) - .and_then(|(def_id, _)| def_id.as_local().map(|id| (id, ComesFromAllowExpect::No))), - ) + .chain(tcx.entry_fn(()).and_then(|(def_id, _)| { + def_id.as_local().map(|id| WorkItem { + id, + propagated: ComesFromAllowExpect::No, + own: ComesFromAllowExpect::No, + }) + })) .collect::>(); let crate_items = tcx.hir_crate_items(()); @@ -870,6 +959,7 @@ fn live_symbols_and_ignored_derived_traits( in_pat: false, ignore_variant_stack: vec![], ignored_derived_traits: Default::default(), + propagated_comes_from_allow_expect: ComesFromAllowExpect::No, }; if let ControlFlow::Break(guar) = symbol_visitor.mark_live_symbols() { return Err(guar); @@ -884,9 +974,11 @@ fn live_symbols_and_ignored_derived_traits( .collect(); while !items_to_check.is_empty() { - symbol_visitor - .worklist - .extend(items_to_check.drain(..).map(|id| (id, ComesFromAllowExpect::No))); + symbol_visitor.worklist.extend(items_to_check.drain(..).map(|id| WorkItem { + id, + propagated: ComesFromAllowExpect::No, + own: ComesFromAllowExpect::No, + })); if let ControlFlow::Break(guar) = symbol_visitor.mark_live_symbols() { return Err(guar); } diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs index cb56a28b8628..a916b4670fde 100644 --- a/compiler/rustc_passes/src/errors.rs +++ b/compiler/rustc_passes/src/errors.rs @@ -13,10 +13,6 @@ use crate::check_attr::ProcMacroKind; use crate::lang_items::Duplicate; -#[derive(Diagnostic)] -#[diag("`#[diagnostic::do_not_recommend]` can only be placed on trait implementations")] -pub(crate) struct IncorrectDoNotRecommendLocation; - #[derive(Diagnostic)] #[diag("`#[loop_match]` should be applied to a loop")] pub(crate) struct LoopMatchAttr { diff --git a/compiler/rustc_public/src/unstable/convert/stable/ty.rs b/compiler/rustc_public/src/unstable/convert/stable/ty.rs index 9a9576d47efd..e45cf377d2fc 100644 --- a/compiler/rustc_public/src/unstable/convert/stable/ty.rs +++ b/compiler/rustc_public/src/unstable/convert/stable/ty.rs @@ -46,8 +46,11 @@ fn stable<'cx>( tables: &mut Tables<'cx, BridgeTys>, cx: &CompilerCtxt<'cx, BridgeTys>, ) -> Self::T { - let ty::AliasTerm { args, def_id, .. } = self; - crate::ty::AliasTerm { def_id: tables.alias_def(*def_id), args: args.stable(tables, cx) } + let ty::AliasTerm { args, kind, .. } = self; + crate::ty::AliasTerm { + def_id: tables.alias_def(kind.def_id()), + args: args.stable(tables, cx), + } } } diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index bf260d823b76..a92ed9cd3ae8 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -979,23 +979,47 @@ pub(crate) fn into_struct_error( .source_map() .span_extend_to_prev_str(ident.span, current, true, false); - let ((with, with_label), without) = match sp { + let (with, with_label, without) = match sp { Some(sp) if !self.tcx.sess.source_map().is_multiline(sp) => { let sp = sp .with_lo(BytePos(sp.lo().0 - (current.len() as u32))) .until(ident.span); - ( - (Some(errs::AttemptToUseNonConstantValueInConstantWithSuggestion { - span: sp, - suggestion, - current, - type_span, - }), Some(errs::AttemptToUseNonConstantValueInConstantLabelWithSuggestion {span})), - None, - ) + + // Only suggest replacing the binding keyword if this is a simple + // binding. + // + // Note: this approach still incorrectly suggests for irrefutable + // patterns like `if let x = 1 { const { x } }`, since the text + // between `let` and the identifier is just whitespace. + // See tests/ui/consts/non-const-value-in-const-irrefutable-pat-binding.rs + let is_simple_binding = + self.tcx.sess.source_map().span_to_snippet(sp).is_ok_and(|snippet| { + let after_keyword = snippet[current.len()..].trim(); + after_keyword.is_empty() || after_keyword == "mut" + }); + + if is_simple_binding { + ( + Some(errs::AttemptToUseNonConstantValueInConstantWithSuggestion { + span: sp, + suggestion, + current, + type_span, + }), + Some(errs::AttemptToUseNonConstantValueInConstantLabelWithSuggestion { span }), + None, + ) + } else { + ( + None, + Some(errs::AttemptToUseNonConstantValueInConstantLabelWithSuggestion { span }), + None, + ) + } } _ => ( - (None, None), + None, + None, Some(errs::AttemptToUseNonConstantValueInConstantWithoutSuggestion { ident_span: ident.span, suggestion, diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs index 33e9ac1d430a..35ed1c772a32 100644 --- a/compiler/rustc_resolve/src/ident.rs +++ b/compiler/rustc_resolve/src/ident.rs @@ -1797,6 +1797,7 @@ fn record_segment_res<'r, 'ra, 'tcx>( "too many leading `super` keywords".to_string(), "there are too many leading `super` keywords".to_string(), None, + None, ) }, ); @@ -1863,7 +1864,7 @@ fn record_segment_res<'r, 'ra, 'tcx>( "can only be used in path start position".to_string(), ) }; - (message, label, None) + (message, label, None, None) }, ); } @@ -1977,10 +1978,28 @@ fn record_segment_res<'r, 'ra, 'tcx>( module_had_parse_errors, module, || { + let import_inherent_item_error_flag = + self.tcx.features().import_trait_associated_functions() + && matches!( + res, + Res::Def( + DefKind::Struct + | DefKind::Enum + | DefKind::Union + | DefKind::ForeignTy, + _ + ) + ); + // Show a different error message for items that can have associated items. let label = format!( - "`{ident}` is {} {}, not a module", + "`{ident}` is {} {}, not a module{}", res.article(), - res.descr() + res.descr(), + if import_inherent_item_error_flag { + " or a trait" + } else { + "" + } ); let scope = match &path[..segment_idx] { [.., prev] => { @@ -1995,7 +2014,14 @@ fn record_segment_res<'r, 'ra, 'tcx>( // FIXME: reword, as the reason we expected a module is because of // the following path segment. let message = format!("cannot find module `{ident}` in {scope}"); - (message, label, None) + let note = if import_inherent_item_error_flag { + Some( + "cannot import inherent associated items, only trait associated items".to_string(), + ) + } else { + None + }; + (message, label, None, note) }, ); } @@ -2020,18 +2046,20 @@ fn record_segment_res<'r, 'ra, 'tcx>( module_had_parse_errors, module, || { - this.get_mut().report_path_resolution_error( - path, - opt_ns, - parent_scope, - ribs, - ignore_decl, - ignore_import, - module, - segment_idx, - ident, - diag_metadata, - ) + let (message, label, suggestion) = + this.get_mut().report_path_resolution_error( + path, + opt_ns, + parent_scope, + ribs, + ignore_decl, + ignore_import, + module, + segment_idx, + ident, + diag_metadata, + ); + (message, label, suggestion, None) }, ); } diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 9df075561b3f..4cb9a653e010 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -1134,6 +1134,7 @@ fn finalize_import(&mut self, import: Import<'ra>) -> Option { if no_ambiguity { if !self.issue_145575_hack_applied { @@ -1159,6 +1160,7 @@ fn finalize_import(&mut self, import: Import<'ra>) -> Option { if no_ambiguity { @@ -1190,7 +1192,7 @@ fn finalize_import(&mut self, import: Import<'ra>) -> Option UnresolvedImportError { span, label: Some(label), - note: None, + note, suggestion, candidates: None, segment: Some(segment_name), @@ -1420,6 +1422,20 @@ fn finalize_import(&mut self, import: Import<'ra>) -> Option (lev_suggestion, None), }; + // If importing of trait asscoiated items is enabled, an also find an + // `Enum`, then note that inherent associated items cannot be imported. + let note = if self.tcx.features().import_trait_associated_functions() + && let PathResult::Module(ModuleOrUniformRoot::Module(m)) = path_res + && let Some(Res::Def(DefKind::Enum, _)) = m.res() + { + note.or(Some( + "cannot import inherent associated items, only trait associated items" + .to_string(), + )) + } else { + note + }; + let label = match module { ModuleOrUniformRoot::Module(module) => { let module_str = module_to_string(module); diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 87a2ba972e49..4c20fee4be4f 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -4979,6 +4979,7 @@ fn resolve_qpath( segment_name, error_implied_by_parse_error: _, message, + note: _, } => { return Err(respan( span, diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index a44a7b30b4e6..47d6988ca598 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -57,7 +57,7 @@ PerNS, }; use rustc_hir::def_id::{CRATE_DEF_ID, CrateNum, DefId, LOCAL_CRATE, LocalDefId, LocalDefIdMap}; -use rustc_hir::definitions::PerParentDisambiguatorState; +use rustc_hir::definitions::{PerParentDisambiguatorState, PerParentDisambiguatorsMap}; use rustc_hir::{PrimTy, TraitCandidate, find_attr}; use rustc_index::bit_set::DenseBitSet; use rustc_metadata::creader::CStore; @@ -481,6 +481,7 @@ enum PathResult<'ra> { segment_name: Symbol, error_implied_by_parse_error: bool, message: String, + note: Option, }, } @@ -491,13 +492,18 @@ fn failed( finalize: bool, error_implied_by_parse_error: bool, module: Option>, - label_and_suggestion: impl FnOnce() -> (String, String, Option), + label_and_suggestion_and_note: impl FnOnce() -> ( + String, + String, + Option, + Option, + ), ) -> PathResult<'ra> { - let (message, label, suggestion) = if finalize { - label_and_suggestion() + let (message, label, suggestion, note) = if finalize { + label_and_suggestion_and_note() } else { // FIXME: this output isn't actually present in the test suite. - (format!("cannot find `{ident}` in this scope"), String::new(), None) + (format!("cannot find `{ident}` in this scope"), String::new(), None, None) }; PathResult::Failed { span: ident.span, @@ -508,6 +514,7 @@ fn failed( module, error_implied_by_parse_error, message, + note, } } } @@ -1417,7 +1424,7 @@ pub struct Resolver<'ra, 'tcx> { node_id_to_def_id: NodeMap>, - per_parent_disambiguators: LocalDefIdMap, + disambiguators: LocalDefIdMap, /// Indices of unnamed struct or variant fields with unresolved attributes. placeholder_field_indices: FxHashMap = default::fx_hash_map(), @@ -1620,14 +1627,10 @@ fn create_def( self.tcx.definitions_untracked().def_key(self.node_id_to_def_id[&node_id].key()), ); + let disambiguator = self.disambiguators.get_or_create(parent); + // FIXME: remove `def_span` body, pass in the right spans here and call `tcx.at().create_def()` - let feed = self.tcx.create_def( - parent, - name, - def_kind, - None, - self.per_parent_disambiguators.entry(parent).or_default(), - ); + let feed = self.tcx.create_def(parent, name, def_kind, None, disambiguator); let def_id = feed.def_id(); // Create the definition. @@ -1811,7 +1814,7 @@ pub fn new( doc_link_resolutions: Default::default(), doc_link_traits_in_scope: Default::default(), current_crate_outer_attr_insert_span, - per_parent_disambiguators: Default::default(), + disambiguators: Default::default(), .. }; @@ -1951,11 +1954,7 @@ pub fn into_outputs(self) -> ResolverOutputs<'tcx> { lifetime_elision_allowed: self.lifetime_elision_allowed, lint_buffer: Steal::new(self.lint_buffer), delegation_infos: self.delegation_infos, - per_parent_disambiguators: self - .per_parent_disambiguators - .into_items() - .map(|(k, d)| (k, Steal::new(d))) - .collect(), + disambiguators: Steal::new(self.disambiguators), }; ResolverOutputs { global_ctxt, ast_lowering } } diff --git a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs index 6a36d6b3e1f6..8b7d906a27a1 100644 --- a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs +++ b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs @@ -245,7 +245,7 @@ fn trait_object_ty<'tcx>(tcx: TyCtxt<'tcx>, poly_trait_ref: ty::PolyTraitRef<'tc .filter(|item| !tcx.generics_require_sized_self(item.def_id)) .map(move |assoc_item| { super_poly_trait_ref.map_bound(|super_trait_ref| { - let projection_term = ty::AliasTerm::new_from_args( + let projection_term = ty::AliasTerm::new_from_def_id( tcx, assoc_item.def_id, super_trait_ref.args, diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs index 86fd705e68ae..21951cee6d5a 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs @@ -202,7 +202,7 @@ pub fn get_impl_future_output_ty(&self, ty: Ty<'tcx>) -> Option> { .kind() .map_bound(|kind| match kind { ty::ClauseKind::Projection(projection_predicate) - if projection_predicate.projection_term.def_id == item_def_id => + if projection_predicate.projection_term.def_id() == item_def_id => { projection_predicate.term.as_type() } @@ -1468,7 +1468,7 @@ enum Mismatch<'a> { } ValuePairs::TraitRefs(_) => (false, Mismatch::Fixed("trait")), ValuePairs::Aliases(ExpectedFound { expected, .. }) => { - (false, Mismatch::Fixed(self.tcx.def_descr(expected.def_id))) + (false, Mismatch::Fixed(self.tcx.def_descr(expected.def_id()))) } ValuePairs::Regions(_) => (false, Mismatch::Fixed("lifetime")), ValuePairs::ExistentialTraitRef(_) => { diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs index 78c8c824f30f..e6597a67d0ba 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs @@ -579,7 +579,7 @@ pub(super) fn maybe_report_ambiguity( if let Err(guar) = self .tcx .ensure_result() - .coherent_trait(self.tcx.parent(data.projection_term.def_id)) + .coherent_trait(self.tcx.parent(data.projection_term.def_id())) { // Avoid bogus "type annotations needed `Foo: Bar`" errors on `impl Bar for Foo` in case // other `Foo` impls are incoherent. diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs index bf4c4287c433..4a36cab36336 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs @@ -1536,8 +1536,11 @@ pub(super) fn report_projection_error( let unnormalized_term = data.projection_term.to_term(self.tcx); // FIXME(-Znext-solver): For diagnostic purposes, it would be nice // to deeply normalize this type. - let normalized_term = - ocx.normalize(&obligation.cause, obligation.param_env, Unnormalized::new_wip(unnormalized_term)); + let normalized_term = ocx.normalize( + &obligation.cause, + obligation.param_env, + Unnormalized::new_wip(unnormalized_term), + ); // constrain inference variables a bit more to nested obligations from normalize so // we can have more helpful errors. @@ -1586,8 +1589,9 @@ pub(super) fn report_projection_error( } }; - if let Some(lhs) = lhs.to_alias_term() - && let ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst = lhs.kind(self.tcx) + if let Some(lhs) = lhs.to_alias_term(self.tcx) + && let ty::AliasTermKind::ProjectionTy { .. } + | ty::AliasTermKind::ProjectionConst { .. } = lhs.kind(self.tcx) && let Some((better_type_err, expected_term)) = derive_better_type_error(lhs, rhs) { @@ -1595,8 +1599,9 @@ pub(super) fn report_projection_error( Some((lhs, self.resolve_vars_if_possible(expected_term), rhs)), better_type_err, ) - } else if let Some(rhs) = rhs.to_alias_term() - && let ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst = rhs.kind(self.tcx) + } else if let Some(rhs) = rhs.to_alias_term(self.tcx) + && let ty::AliasTermKind::ProjectionTy { .. } + | ty::AliasTermKind::ProjectionConst { .. } = rhs.kind(self.tcx) && let Some((better_type_err, expected_term)) = derive_better_type_error(rhs, lhs) { @@ -1741,7 +1746,7 @@ fn maybe_detailed_projection_msg( let self_ty = projection_term.self_ty(); with_forced_trimmed_paths! { - if self.tcx.is_lang_item(projection_term.def_id, LangItem::FnOnceOutput) { + if self.tcx.is_lang_item(projection_term.def_id(), LangItem::FnOnceOutput) { let (span, closure_span) = if let ty::Closure(def_id, _) = *self_ty.kind() { let def_span = self.tcx.def_span(def_id); if let Some(local_def_id) = def_id.as_local() diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs index 330bae4e1bc5..4c97724ec73e 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs @@ -1043,17 +1043,25 @@ pub(super) fn suggest_fn_call( && let ty::Tuple(inputs) = *sig.tupled_inputs_ty.kind() && inputs.is_empty() && self.tcx.is_lang_item(trait_pred.def_id(), LangItem::Future) + && let ObligationCauseCode::FunctionArg { arg_hir_id, .. } = obligation.cause.code() + && let hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Closure(..), .. }) = + self.tcx.hir_node(*arg_hir_id) && let Some(hir::Node::Expr(hir::Expr { - kind: - hir::ExprKind::Closure(hir::Closure { - kind: hir::ClosureKind::CoroutineClosure(CoroutineDesugaring::Async), - fn_arg_span: Some(arg_span), - .. - }), - .. + kind: hir::ExprKind::Closure(closure), .. })) = self.tcx.hir_get_if_local(def_id) - && obligation.cause.span.contains(*arg_span) + && let hir::ClosureKind::CoroutineClosure(CoroutineDesugaring::Async) = closure.kind + && let Some(arg_span) = closure.fn_arg_span + && obligation.cause.span.contains(arg_span) { + let mut body = self.tcx.hir_body(closure.body).value; + let peeled = body.peel_blocks().peel_drop_temps(); + if let hir::ExprKind::Closure(inner) = peeled.kind { + body = self.tcx.hir_body(inner.body).value; + } + if !matches!(body.peel_blocks().peel_drop_temps().kind, hir::ExprKind::Block(..)) { + return false; + } + let sm = self.tcx.sess.source_map(); let removal_span = if let Ok(snippet) = sm.span_to_snippet(arg_span.with_hi(arg_span.hi() + rustc_span::BytePos(1))) @@ -1062,7 +1070,7 @@ pub(super) fn suggest_fn_call( // There's a space after `||`, include it in the removal arg_span.with_hi(arg_span.hi() + rustc_span::BytePos(1)) } else { - *arg_span + arg_span }; err.span_suggestion_verbose( removal_span, @@ -1102,23 +1110,63 @@ pub(super) fn suggest_fn_call( .collect::>() .join(", "); - if matches!(obligation.cause.code(), ObligationCauseCode::FunctionArg { .. }) + if let ObligationCauseCode::FunctionArg { arg_hir_id, .. } = obligation.cause.code() && obligation.cause.span.can_be_used_for_suggestions() { - let (span, sugg) = if let Some(snippet) = - self.tcx.sess.source_map().span_to_snippet(obligation.cause.span).ok() - && snippet.starts_with("|") - { - (obligation.cause.span, format!("({snippet})({args})")) - } else { - (obligation.cause.span.shrink_to_hi(), format!("({args})")) + let span = obligation.cause.span; + + let arg_expr = match self.tcx.hir_node(*arg_hir_id) { + hir::Node::Expr(expr) => Some(expr), + _ => None, }; - // When the obligation error has been ensured to have been caused by - // an argument, the `obligation.cause.span` points at the expression - // of the argument, so we can provide a suggestion. Otherwise, we give - // a more general note. - err.span_suggestion_verbose(span, msg, sugg, Applicability::HasPlaceholders); + let is_closure_expr = + arg_expr.is_some_and(|expr| matches!(expr.kind, hir::ExprKind::Closure(..))); + + // If the user wrote `|| {}()`, suggesting to call the closure would produce `(|| {}())()`, + // which doesn't help and is often outright wrong. + if args.is_empty() + && let Some(expr) = arg_expr + && let hir::ExprKind::Closure(closure) = expr.kind + { + let mut body = self.tcx.hir_body(closure.body).value; + + // Async closures desugar to a closure returning a coroutine + if let hir::ClosureKind::CoroutineClosure(hir::CoroutineDesugaring::Async) = + closure.kind + { + let peeled = body.peel_blocks().peel_drop_temps(); + if let hir::ExprKind::Closure(inner) = peeled.kind { + body = self.tcx.hir_body(inner.body).value; + } + } + + let peeled_body = body.peel_blocks().peel_drop_temps(); + if let hir::ExprKind::Call(callee, call_args) = peeled_body.kind + && call_args.is_empty() + && let hir::ExprKind::Block(..) = callee.peel_blocks().peel_drop_temps().kind + { + return false; + } + } + + if is_closure_expr { + err.multipart_suggestions( + msg, + vec![vec![ + (span.shrink_to_lo(), "(".to_string()), + (span.shrink_to_hi(), format!(")({args})")), + ]], + Applicability::HasPlaceholders, + ); + } else { + err.span_suggestion_verbose( + span.shrink_to_hi(), + msg, + format!("({args})"), + Applicability::HasPlaceholders, + ); + } } else if let DefIdOrName::DefId(def_id) = def_id_or_name { let name = match self.tcx.hir_get_if_local(def_id) { Some(hir::Node::Expr(hir::Expr { @@ -1445,7 +1493,7 @@ pub fn extract_callable_info( if let ty::ClauseKind::Projection(proj) = pred.kind().skip_binder() && self .tcx - .is_lang_item(proj.projection_term.def_id, LangItem::FnOnceOutput) + .is_lang_item(proj.projection_term.def_id(), LangItem::FnOnceOutput) // args tuple will always be args[1] && let ty::Tuple(args) = proj.projection_term.args.type_at(1).kind() { @@ -1489,7 +1537,7 @@ pub fn extract_callable_info( if let ty::ClauseKind::Projection(proj) = pred.kind().skip_binder() && self .tcx - .is_lang_item(proj.projection_term.def_id, LangItem::FnOnceOutput) + .is_lang_item(proj.projection_term.def_id(), LangItem::FnOnceOutput) && proj.projection_term.self_ty() == found // args tuple will always be args[1] && let ty::Tuple(args) = proj.projection_term.args.type_at(1).kind() @@ -5256,7 +5304,7 @@ fn probe_assoc_types_at_expr( let TypeError::Sorts(expected_found) = diff else { continue; }; - let ty::Alias(ty::AliasTy { kind: ty::Projection { def_id }, .. }) = + let &ty::Alias(ty::AliasTy { kind: kind @ ty::Projection { def_id }, .. }) = expected_found.expected.kind() else { continue; @@ -5265,7 +5313,7 @@ fn probe_assoc_types_at_expr( // Make `Self` be equivalent to the type of the call chain // expression we're looking at now, so that we can tell what // for example `Iterator::Item` is at this point in the chain. - let args = GenericArgs::for_item(self.tcx, *def_id, |param, _| { + let args = GenericArgs::for_item(self.tcx, def_id, |param, _| { if param.index == 0 { debug_assert_matches!(param.kind, ty::GenericParamDefKind::Type { .. }); return prev_ty.into(); @@ -5279,7 +5327,7 @@ fn probe_assoc_types_at_expr( // This corresponds to `::Item = _`. let projection = ty::Binder::dummy(ty::PredicateKind::Clause( ty::ClauseKind::Projection(ty::ProjectionPredicate { - projection_term: ty::AliasTerm::new_from_args(self.tcx, *def_id, args), + projection_term: ty::AliasTerm::new_from_args(self.tcx, kind.into(), args), term: ty.into(), }), )); @@ -5296,7 +5344,7 @@ fn probe_assoc_types_at_expr( && let ty = self.resolve_vars_if_possible(ty) && !ty.is_ty_var() { - assocs_in_this_method.push(Some((span, (*def_id, ty)))); + assocs_in_this_method.push(Some((span, (def_id, ty)))); } else { // `` didn't select, so likely we've // reached the end of the iterator chain, like the originating @@ -6344,12 +6392,12 @@ fn point_at_assoc_type_restriction( return; }; let Some(name) = tcx - .opt_rpitit_info(proj.projection_term.def_id) + .opt_rpitit_info(proj.projection_term.def_id()) .and_then(|data| match data { ty::ImplTraitInTraitData::Trait { fn_def_id, .. } => Some(tcx.item_name(fn_def_id)), ty::ImplTraitInTraitData::Impl { .. } => None, }) - .or_else(|| tcx.opt_item_name(proj.projection_term.def_id)) + .or_else(|| tcx.opt_item_name(proj.projection_term.def_id())) else { return; }; diff --git a/compiler/rustc_trait_selection/src/solve/fulfill/derive_errors.rs b/compiler/rustc_trait_selection/src/solve/fulfill/derive_errors.rs index df410cd3fb1b..0cd374aedb6f 100644 --- a/compiler/rustc_trait_selection/src/solve/fulfill/derive_errors.rs +++ b/compiler/rustc_trait_selection/src/solve/fulfill/derive_errors.rs @@ -388,8 +388,8 @@ fn detect_error_from_empty_candidates( self.detect_error_in_self_ty_normalization(goal, pred.self_ty())?; } Some(ty::PredicateKind::NormalizesTo(pred)) - if let ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst = - pred.alias.kind(tcx) => + if let ty::AliasTermKind::ProjectionTy { .. } + | ty::AliasTermKind::ProjectionConst { .. } = pred.alias.kind(tcx) => { self.detect_error_in_self_ty_normalization(goal, pred.alias.self_ty())?; self.detect_non_well_formed_assoc_item(goal, pred.alias)?; @@ -450,7 +450,8 @@ fn visit_goal(&mut self, goal: &inspect::InspectGoal<'_, 'tcx>) -> Self::Result ty::PredicateKind::NormalizesTo(normalizes_to) if matches!( normalizes_to.alias.kind(tcx), - ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst + ty::AliasTermKind::ProjectionTy { .. } + | ty::AliasTermKind::ProjectionConst { .. } ) => { ChildMode::Trait(pred.kind().rebind(ty::TraitPredicate { diff --git a/compiler/rustc_trait_selection/src/solve/normalize.rs b/compiler/rustc_trait_selection/src/solve/normalize.rs index 21c29721037f..0d5a8ab98f26 100644 --- a/compiler/rustc_trait_selection/src/solve/normalize.rs +++ b/compiler/rustc_trait_selection/src/solve/normalize.rs @@ -107,7 +107,7 @@ fn normalize_alias_term( let tcx = infcx.tcx; let recursion_limit = tcx.recursion_limit(); if !recursion_limit.value_within_limit(self.depth) { - let term = alias_term.to_alias_term().unwrap(); + let term = alias_term.to_alias_term(tcx).unwrap(); self.at.infcx.err_ctxt().report_overflow_error( OverflowCause::DeeplyNormalize(term), diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs index 61ed05d873dd..689b96779dca 100644 --- a/compiler/rustc_trait_selection/src/traits/coherence.rs +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs @@ -753,7 +753,7 @@ fn visit_goal(&mut self, goal: &InspectGoal<'_, 'tcx>) { ty::PredicateKind::Clause(ty::ClauseKind::Trait(tr)) => tr.trait_ref, ty::PredicateKind::Clause(ty::ClauseKind::Projection(proj)) if matches!( - infcx.tcx.def_kind(proj.projection_term.def_id), + infcx.tcx.def_kind(proj.projection_term.def_id()), DefKind::AssocTy | DefKind::AssocConst { .. } ) => { diff --git a/compiler/rustc_trait_selection/src/traits/effects.rs b/compiler/rustc_trait_selection/src/traits/effects.rs index fae6acd04aec..f0587b8e4e23 100644 --- a/compiler/rustc_trait_selection/src/traits/effects.rs +++ b/compiler/rustc_trait_selection/src/traits/effects.rs @@ -556,15 +556,8 @@ fn evaluate_host_effect_for_fn_goal<'tcx>( ty::Closure(def, args) => { // For now we limit ourselves to closures without binders. The next solver can handle them. - let sig = - args.as_closure().sig().no_bound_vars().ok_or(EvaluationFailure::NoSolution)?; - ( - def, - tcx.mk_args_from_iter( - [ty::GenericArg::from(*sig.inputs().get(0).unwrap()), sig.output().into()] - .into_iter(), - ), - ) + args.as_closure().sig().no_bound_vars().ok_or(EvaluationFailure::NoSolution)?; + (def, args) } // Everything else needs explicit impls or cannot have an impl diff --git a/compiler/rustc_trait_selection/src/traits/fulfill.rs b/compiler/rustc_trait_selection/src/traits/fulfill.rs index 88cb18e5d367..11ff9911469e 100644 --- a/compiler/rustc_trait_selection/src/traits/fulfill.rs +++ b/compiler/rustc_trait_selection/src/traits/fulfill.rs @@ -699,8 +699,8 @@ fn process_obligation( // `generic_const_exprs` .eq( DefineOpaqueTypes::Yes, - ty::AliasTerm::from(a), - ty::AliasTerm::from(b), + ty::AliasTerm::from_unevaluated_const(tcx, a), + ty::AliasTerm::from_unevaluated_const(tcx, b), ) { return ProcessResult::Changed(mk_pending( diff --git a/compiler/rustc_trait_selection/src/traits/normalize.rs b/compiler/rustc_trait_selection/src/traits/normalize.rs index 6e900606edb7..55f1f861921e 100644 --- a/compiler/rustc_trait_selection/src/traits/normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/normalize.rs @@ -321,7 +321,7 @@ fn normalize_free_alias(&mut self, free: AliasTerm<'tcx>) -> Term<'tcx> { self.obligations.extend( infcx .tcx - .predicates_of(free.def_id) + .predicates_of(free.def_id()) .instantiate_own(infcx.tcx, free.args) .map(|(pred, span)| (pred.skip_norm_wip(), span)) .map(|(mut predicate, span)| { @@ -333,7 +333,8 @@ fn normalize_free_alias(&mut self, free: AliasTerm<'tcx>) -> Term<'tcx> { ); } let mut cause = self.cause.clone(); - cause.map_code(|code| ObligationCauseCode::TypeAlias(code, span, free.def_id)); + cause + .map_code(|code| ObligationCauseCode::TypeAlias(code, span, free.def_id())); Obligation::new(infcx.tcx, cause, self.param_env, predicate) }), ); @@ -341,7 +342,7 @@ fn normalize_free_alias(&mut self, free: AliasTerm<'tcx>) -> Term<'tcx> { let res = if free.kind(infcx.tcx).is_type() { infcx .tcx - .type_of(free.def_id) + .type_of(free.def_id()) .instantiate(infcx.tcx, free.args) .skip_norm_wip() .fold_with(self) @@ -349,7 +350,7 @@ fn normalize_free_alias(&mut self, free: AliasTerm<'tcx>) -> Term<'tcx> { } else { infcx .tcx - .const_of_item(free.def_id) + .const_of_item(free.def_id()) .instantiate(infcx.tcx, free.args) .skip_norm_wip() .fold_with(self) @@ -468,16 +469,20 @@ fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> { // feature gate causes a parse error. let ct = match tcx.def_kind(uv.def) { DefKind::AssocConst { .. } => match tcx.def_kind(tcx.parent(uv.def)) { - DefKind::Trait => self.normalize_trait_projection(uv.into()).expect_const(), - DefKind::Impl { of_trait: false } => { - self.normalize_inherent_projection(uv.into()).expect_const() - } + DefKind::Trait => self + .normalize_trait_projection(ty::AliasTerm::from_unevaluated_const(tcx, uv)) + .expect_const(), + DefKind::Impl { of_trait: false } => self + .normalize_inherent_projection(ty::AliasTerm::from_unevaluated_const(tcx, uv)) + .expect_const(), kind => unreachable!( "unexpected `DefKind` for const alias' resolution's parent def: {:?}", kind ), }, - DefKind::Const { .. } => self.normalize_free_alias(uv.into()).expect_const(), + DefKind::Const { .. } => self + .normalize_free_alias(ty::AliasTerm::from_unevaluated_const(tcx, uv)) + .expect_const(), DefKind::AnonConst => { let ct = ct.super_fold_with(self); super::with_replaced_escaping_bound_vars( diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 5014a59d1f0f..5423e394119c 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -463,14 +463,16 @@ fn normalize_to_error<'a, 'tcx>( ) -> NormalizedTerm<'tcx> { let trait_ref = ty::Binder::dummy(projection_term.trait_ref(selcx.tcx())); let new_value = match projection_term.kind(selcx.tcx()) { - ty::AliasTermKind::ProjectionTy - | ty::AliasTermKind::InherentTy - | ty::AliasTermKind::OpaqueTy - | ty::AliasTermKind::FreeTy => selcx.infcx.next_ty_var(cause.span).into(), - ty::AliasTermKind::FreeConst - | ty::AliasTermKind::InherentConst - | ty::AliasTermKind::UnevaluatedConst - | ty::AliasTermKind::ProjectionConst => selcx.infcx.next_const_var(cause.span).into(), + ty::AliasTermKind::ProjectionTy { .. } + | ty::AliasTermKind::InherentTy { .. } + | ty::AliasTermKind::OpaqueTy { .. } + | ty::AliasTermKind::FreeTy { .. } => selcx.infcx.next_ty_var(cause.span).into(), + ty::AliasTermKind::FreeConst { .. } + | ty::AliasTermKind::InherentConst { .. } + | ty::AliasTermKind::UnevaluatedConst { .. } + | ty::AliasTermKind::ProjectionConst { .. } => { + selcx.infcx.next_const_var(cause.span).into() + } }; let mut obligations = PredicateObligations::new(); obligations.push(Obligation { @@ -513,7 +515,7 @@ pub fn normalize_inherent_projection<'a, 'b, 'tcx>( ); // Register the obligations arising from the impl and from the associated type itself. - let predicates = tcx.predicates_of(alias_term.def_id).instantiate(tcx, args); + let predicates = tcx.predicates_of(alias_term.def_id()).instantiate(tcx, args); for (predicate, span) in predicates { let predicate = normalize_with_depth_to( selcx, @@ -531,7 +533,7 @@ pub fn normalize_inherent_projection<'a, 'b, 'tcx>( // cause code, inherent projections will be printed with identity instantiation in // diagnostics which is not ideal. // Consider creating separate cause codes for this specific situation. - ObligationCauseCode::WhereClause(alias_term.def_id, span), + ObligationCauseCode::WhereClause(alias_term.def_id(), span), ); obligations.push(Obligation::with_depth( @@ -544,9 +546,9 @@ pub fn normalize_inherent_projection<'a, 'b, 'tcx>( } let term: Term<'tcx> = if alias_term.kind(tcx).is_type() { - tcx.type_of(alias_term.def_id).instantiate(tcx, args).skip_norm_wip().into() + tcx.type_of(alias_term.def_id()).instantiate(tcx, args).skip_norm_wip().into() } else { - tcx.const_of_item(alias_term.def_id).instantiate(tcx, args).skip_norm_wip().into() + tcx.const_of_item(alias_term.def_id()).instantiate(tcx, args).skip_norm_wip().into() }; let mut term = selcx.infcx.resolve_vars_if_possible(term); @@ -569,7 +571,7 @@ pub fn compute_inherent_assoc_term_args<'a, 'b, 'tcx>( ) -> ty::GenericArgsRef<'tcx> { let tcx = selcx.tcx(); - let impl_def_id = tcx.parent(alias_term.def_id); + let impl_def_id = tcx.parent(alias_term.def_id()); let impl_args = selcx.infcx.fresh_args_for_item(cause.span, impl_def_id); let mut impl_ty = tcx.type_of(impl_def_id).instantiate(tcx, impl_args).skip_norm_wip(); @@ -747,7 +749,7 @@ fn assemble_candidates_from_trait_def<'cx, 'tcx>( let Some(clause) = clause.as_projection_clause() else { return ControlFlow::Continue(()); }; - if clause.item_def_id() != obligation.predicate.def_id { + if clause.item_def_id() != obligation.predicate.def_id() { return ControlFlow::Continue(()); } @@ -815,7 +817,7 @@ fn assemble_candidates_from_object_ty<'cx, 'tcx>( }; let env_predicates = data .projection_bounds() - .filter(|bound| bound.item_def_id() == obligation.predicate.def_id) + .filter(|bound| bound.item_def_id() == obligation.predicate.def_id()) .map(|p| p.with_self_ty(tcx, object_ty).upcast(tcx)); assemble_candidates_from_predicates( @@ -846,7 +848,7 @@ fn assemble_candidates_from_predicates<'cx, 'tcx>( let bound_predicate = predicate.kind(); if let ty::ClauseKind::Projection(data) = predicate.kind().skip_binder() { let data = bound_predicate.rebind(data); - if data.item_def_id() != obligation.predicate.def_id { + if data.item_def_id() != obligation.predicate.def_id() { continue; } @@ -937,7 +939,7 @@ fn assemble_candidates_from_impls<'cx, 'tcx>( match specialization_graph::assoc_def( selcx.tcx(), impl_data.impl_def_id, - obligation.predicate.def_id, + obligation.predicate.def_id(), ) { Ok(node_item) => { if node_item.is_final() { @@ -1143,7 +1145,7 @@ fn assemble_candidates_from_impls<'cx, 'tcx>( } _ if tcx.trait_is_auto(trait_ref.def_id) => { tcx.dcx().span_delayed_bug( - tcx.def_span(obligation.predicate.def_id), + tcx.def_span(obligation.predicate.def_id()), "associated types not allowed on auto traits", ); false @@ -1325,24 +1327,20 @@ fn confirm_coroutine_candidate<'cx, 'tcx>( coroutine_sig, ); - let ty = if tcx.is_lang_item(obligation.predicate.def_id, LangItem::CoroutineReturn) { + let ty = if tcx.is_lang_item(obligation.predicate.def_id(), LangItem::CoroutineReturn) { return_ty - } else if tcx.is_lang_item(obligation.predicate.def_id, LangItem::CoroutineYield) { + } else if tcx.is_lang_item(obligation.predicate.def_id(), LangItem::CoroutineYield) { yield_ty } else { span_bug!( - tcx.def_span(obligation.predicate.def_id), + tcx.def_span(obligation.predicate.def_id()), "unexpected associated type: `Coroutine::{}`", - tcx.item_name(obligation.predicate.def_id), + tcx.item_name(obligation.predicate.def_id()), ); }; let predicate = ty::ProjectionPredicate { - projection_term: ty::AliasTerm::new_from_args( - tcx, - obligation.predicate.def_id, - trait_ref.args, - ), + projection_term: obligation.predicate.with_args(tcx, trait_ref.args), term: ty.into(), }; @@ -1383,14 +1381,10 @@ fn confirm_future_candidate<'cx, 'tcx>( coroutine_sig, ); - debug_assert_eq!(tcx.associated_item(obligation.predicate.def_id).name(), sym::Output); + debug_assert_eq!(tcx.associated_item(obligation.predicate.def_id()).name(), sym::Output); let predicate = ty::ProjectionPredicate { - projection_term: ty::AliasTerm::new_from_args( - tcx, - obligation.predicate.def_id, - trait_ref.args, - ), + projection_term: obligation.predicate.with_args(tcx, trait_ref.args), term: return_ty.into(), }; @@ -1429,14 +1423,10 @@ fn confirm_iterator_candidate<'cx, 'tcx>( gen_sig, ); - debug_assert_eq!(tcx.associated_item(obligation.predicate.def_id).name(), sym::Item); + debug_assert_eq!(tcx.associated_item(obligation.predicate.def_id()).name(), sym::Item); let predicate = ty::ProjectionPredicate { - projection_term: ty::AliasTerm::new_from_args( - tcx, - obligation.predicate.def_id, - trait_ref.args, - ), + projection_term: obligation.predicate.with_args(tcx, trait_ref.args), term: yield_ty.into(), }; @@ -1475,7 +1465,7 @@ fn confirm_async_iterator_candidate<'cx, 'tcx>( gen_sig, ); - debug_assert_eq!(tcx.associated_item(obligation.predicate.def_id).name(), sym::Item); + debug_assert_eq!(tcx.associated_item(obligation.predicate.def_id()).name(), sym::Item); let ty::Adt(_poll_adt, args) = *yield_ty.kind() else { bug!(); @@ -1486,11 +1476,7 @@ fn confirm_async_iterator_candidate<'cx, 'tcx>( let item_ty = args.type_at(0); let predicate = ty::ProjectionPredicate { - projection_term: ty::AliasTerm::new_from_args( - tcx, - obligation.predicate.def_id, - trait_ref.args, - ), + projection_term: obligation.predicate.with_args(tcx, trait_ref.args), term: item_ty.into(), }; @@ -1506,7 +1492,7 @@ fn confirm_builtin_candidate<'cx, 'tcx>( ) -> Progress<'tcx> { let tcx = selcx.tcx(); let self_ty = obligation.predicate.self_ty(); - let item_def_id = obligation.predicate.def_id; + let item_def_id = obligation.predicate.def_id(); let trait_def_id = tcx.parent(item_def_id); let args = tcx.mk_args(&[self_ty.into()]); let (term, obligations) = if tcx.is_lang_item(trait_def_id, LangItem::DiscriminantKind) { @@ -1569,7 +1555,11 @@ fn confirm_builtin_candidate<'cx, 'tcx>( }; let predicate = ty::ProjectionPredicate { - projection_term: ty::AliasTerm::new_from_args(tcx, item_def_id, args), + projection_term: ty::AliasTerm::new_from_args( + tcx, + ty::AliasTermKind::ProjectionTy { def_id: item_def_id }, + args, + ), term, }; @@ -1702,7 +1692,11 @@ fn confirm_callable_candidate<'cx, 'tcx>( flag, ) .map_bound(|(trait_ref, ret_type)| ty::ProjectionPredicate { - projection_term: ty::AliasTerm::new_from_args(tcx, fn_once_output_def_id, trait_ref.args), + projection_term: ty::AliasTerm::new_from_args( + tcx, + ty::AliasTermKind::ProjectionTy { def_id: fn_once_output_def_id }, + trait_ref.args, + ), term: ret_type.into(), }); @@ -1723,7 +1717,7 @@ fn confirm_async_closure_candidate<'cx, 'tcx>( ty::ClosureKind::Fn | ty::ClosureKind::FnMut => obligation.predicate.args.region_at(2), ty::ClosureKind::FnOnce => tcx.lifetimes.re_static, }; - let item_name = tcx.item_name(obligation.predicate.def_id); + let item_name = tcx.item_name(obligation.predicate.def_id()); let poly_cache_entry = match *self_ty.kind() { ty::CoroutineClosure(def_id, args) => { @@ -1787,12 +1781,12 @@ fn confirm_async_closure_candidate<'cx, 'tcx>( let projection_term = match item_name { sym::CallOnceFuture | sym::Output => ty::AliasTerm::new( tcx, - obligation.predicate.def_id, + obligation.predicate.kind, [self_ty, sig.tupled_inputs_ty], ), sym::CallRefFuture => ty::AliasTerm::new( tcx, - obligation.predicate.def_id, + obligation.predicate.kind, [ty::GenericArg::from(self_ty), sig.tupled_inputs_ty.into(), env_region.into()], ), name => bug!("no such associated type: {name}"), @@ -1817,12 +1811,12 @@ fn confirm_async_closure_candidate<'cx, 'tcx>( let projection_term = match item_name { sym::CallOnceFuture | sym::Output => ty::AliasTerm::new( tcx, - obligation.predicate.def_id, + obligation.predicate.kind, [self_ty, Ty::new_tup(tcx, sig.inputs())], ), sym::CallRefFuture => ty::AliasTerm::new( tcx, - obligation.predicate.def_id, + obligation.predicate.kind, [ ty::GenericArg::from(self_ty), Ty::new_tup(tcx, sig.inputs()).into(), @@ -1850,11 +1844,11 @@ fn confirm_async_closure_candidate<'cx, 'tcx>( }; let projection_term = match item_name { sym::CallOnceFuture | sym::Output => { - ty::AliasTerm::new(tcx, obligation.predicate.def_id, [self_ty, sig.inputs()[0]]) + ty::AliasTerm::new(tcx, obligation.predicate.kind, [self_ty, sig.inputs()[0]]) } sym::CallRefFuture => ty::AliasTerm::new( tcx, - obligation.predicate.def_id, + obligation.predicate.kind, [ty::GenericArg::from(self_ty), sig.inputs()[0].into(), env_region.into()], ), name => bug!("no such associated type: {name}"), @@ -1888,11 +1882,7 @@ fn confirm_async_fn_kind_helper_candidate<'cx, 'tcx>( }; let predicate = ty::ProjectionPredicate { - projection_term: ty::AliasTerm::new_from_args( - selcx.tcx(), - obligation.predicate.def_id, - obligation.predicate.args, - ), + projection_term: obligation.predicate.with_args(selcx.tcx(), obligation.predicate.args), term: ty::CoroutineClosureSignature::tupled_upvars_by_closure_kind( selcx.tcx(), goal_kind_ty.expect_ty().to_opt_closure_kind().unwrap(), @@ -1986,7 +1976,7 @@ fn confirm_impl_candidate<'cx, 'tcx>( let ImplSourceUserDefinedData { impl_def_id, args, mut nested } = impl_impl_source; - let assoc_item_id = obligation.predicate.def_id; + let assoc_item_id = obligation.predicate.def_id(); let trait_def_id = tcx.impl_trait_id(impl_def_id); let param_env = obligation.param_env; @@ -2074,7 +2064,7 @@ fn assoc_term_own_obligations<'cx, 'tcx>( ) { let tcx = selcx.tcx(); let predicates = tcx - .predicates_of(obligation.predicate.def_id) + .predicates_of(obligation.predicate.def_id()) .instantiate_own(tcx, obligation.predicate.args); for (predicate, span) in predicates { let normalized = normalize_with_depth_to( @@ -2097,7 +2087,7 @@ fn assoc_term_own_obligations<'cx, 'tcx>( ObligationCause::new( obligation.cause.span, obligation.cause.body_id, - ObligationCauseCode::WhereClause(obligation.predicate.def_id, span), + ObligationCauseCode::WhereClause(obligation.predicate.def_id(), span), ) }; nested.push(Obligation::with_depth( diff --git a/compiler/rustc_trait_selection/src/traits/query/normalize.rs b/compiler/rustc_trait_selection/src/traits/query/normalize.rs index a3e4eb4537ca..bd9fee90d890 100644 --- a/compiler/rustc_trait_selection/src/traits/query/normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/query/normalize.rs @@ -256,8 +256,8 @@ fn try_fold_ty(&mut self, ty: Ty<'tcx>) -> Result, Self::Error> { } } - ty::Projection { def_id } | ty::Inherent { def_id } | ty::Free { def_id } => self - .try_fold_free_or_assoc(ty::AliasTerm::new(self.cx(), def_id, data.args))? + kind @ (ty::Projection { .. } | ty::Inherent { .. } | ty::Free { .. }) => self + .try_fold_free_or_assoc(ty::AliasTerm::new(self.cx(), kind.into(), data.args))? .expect_type(), }; @@ -286,7 +286,7 @@ fn try_fold_const( |constant| crate::traits::evaluate_const(&self.infcx, constant, self.param_env), ), _ => self - .try_fold_free_or_assoc(ty::AliasTerm::new(self.cx(), uv.def, uv.args))? + .try_fold_free_or_assoc(ty::AliasTerm::from_unevaluated_const(self.cx(), uv))? .expect_const(), }; debug!(?constant, ?self.param_env); @@ -329,16 +329,17 @@ fn try_fold_free_or_assoc( debug!("QueryNormalizer: c_term = {:#?}", c_term); debug!("QueryNormalizer: orig_values = {:#?}", orig_values); let result = match term.kind(tcx) { - ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst => { + ty::AliasTermKind::ProjectionTy { .. } | ty::AliasTermKind::ProjectionConst { .. } => { tcx.normalize_canonicalized_projection(c_term) } - ty::AliasTermKind::FreeTy | ty::AliasTermKind::FreeConst => { + ty::AliasTermKind::FreeTy { .. } | ty::AliasTermKind::FreeConst { .. } => { tcx.normalize_canonicalized_free_alias(c_term) } - ty::AliasTermKind::InherentTy | ty::AliasTermKind::InherentConst => { + ty::AliasTermKind::InherentTy { .. } | ty::AliasTermKind::InherentConst { .. } => { tcx.normalize_canonicalized_inherent_projection(c_term) } - kind @ (ty::AliasTermKind::OpaqueTy | ty::AliasTermKind::UnevaluatedConst) => { + kind @ (ty::AliasTermKind::OpaqueTy { .. } + | ty::AliasTermKind::UnevaluatedConst { .. }) => { unreachable!("did not expect {kind:?} due to match arm above") } }?; @@ -382,7 +383,7 @@ fn try_fold_free_or_assoc( && (res.has_type_flags(ty::TypeFlags::HAS_CT_PROJECTION) || matches!( term.kind(tcx), - ty::AliasTermKind::FreeTy | ty::AliasTermKind::FreeConst + ty::AliasTermKind::FreeTy { .. } | ty::AliasTermKind::FreeConst { .. } )) { res.try_fold_with(self) diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index 17a5f14767ee..28b9ce24178d 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -891,8 +891,8 @@ fn evaluate_predicate_recursively<'o>( // `generic_const_exprs` .eq( DefineOpaqueTypes::Yes, - ty::AliasTerm::from(a), - ty::AliasTerm::from(b), + ty::AliasTerm::from_unevaluated_const(tcx, a), + ty::AliasTerm::from_unevaluated_const(tcx, b), ) { return self.evaluate_predicates_recursively( @@ -1761,7 +1761,7 @@ pub(super) fn match_projection_projections( env_predicate: PolyProjectionPredicate<'tcx>, potentially_unnormalized_candidates: bool, ) -> ProjectionMatchesProjection { - debug_assert_eq!(obligation.predicate.def_id, env_predicate.item_def_id()); + debug_assert_eq!(obligation.predicate.def_id(), env_predicate.item_def_id()); let mut nested_obligations = PredicateObligations::new(); let infer_predicate = self.infcx.instantiate_binder_with_fresh_vars( @@ -1797,7 +1797,7 @@ pub(super) fn match_projection_projections( }); if is_match { - let generics = self.tcx().generics_of(obligation.predicate.def_id); + let generics = self.tcx().generics_of(obligation.predicate.def_id()); // FIXME(generic_associated_types): Addresses aggressive inference in #92917. // If this type is a GAT, and of the GAT args resolve to something new, // that means that we must have newly inferred something about the GAT. diff --git a/compiler/rustc_trait_selection/src/traits/structural_normalize.rs b/compiler/rustc_trait_selection/src/traits/structural_normalize.rs index 03edfeb06d8c..fe00e9b4f842 100644 --- a/compiler/rustc_trait_selection/src/traits/structural_normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/structural_normalize.rs @@ -41,7 +41,7 @@ fn structurally_normalize_term( if self.infcx.next_trait_solver() { let term = term.skip_normalization(); - if let None = term.to_alias_term() { + if let None = term.to_alias_term(self.infcx.tcx) { return Ok(term); } diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs index c9c274990eb9..66a2fcaa562d 100644 --- a/compiler/rustc_trait_selection/src/traits/wf.rs +++ b/compiler/rustc_trait_selection/src/traits/wf.rs @@ -478,7 +478,7 @@ fn add_wf_preds_for_alias_term(&mut self, data: ty::AliasTerm<'tcx>) { // `i32: Clone` // `i32: Copy` // ] - let obligations = self.nominal_obligations(data.def_id, data.args); + let obligations = self.nominal_obligations(data.def_id(), data.args); self.out.extend(obligations); self.add_wf_preds_for_projection_args(data.args); @@ -507,7 +507,7 @@ fn add_wf_preds_for_inherent_projection(&mut self, data: ty::AliasTerm<'tcx>) { self.recursion_depth, &mut self.out, ); - let obligations = self.nominal_obligations(data.def_id, args); + let obligations = self.nominal_obligations(data.def_id(), args); self.out.extend(obligations); } @@ -1001,7 +1001,7 @@ fn visit_ty(&mut self, t: Ty<'tcx>) -> Self::Result { .map_bound(|p| { p.term.as_const().map(|ct| { let assoc_const_ty = tcx - .type_of(p.projection_term.def_id) + .type_of(p.projection_term.def_id()) .instantiate(tcx, p.projection_term.args) .skip_norm_wip(); ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType( @@ -1077,7 +1077,9 @@ fn visit_const(&mut self, c: ty::Const<'tcx>) -> Self::Result { if matches!(tcx.def_kind(uv.def), DefKind::AssocConst { .. }) && tcx.def_kind(tcx.parent(uv.def)) == (DefKind::Impl { of_trait: false }) { - self.add_wf_preds_for_inherent_projection(uv.into()); + self.add_wf_preds_for_inherent_projection( + ty::AliasTerm::from_unevaluated_const(tcx, uv), + ); return; // Subtree is handled by above function } else { let obligations = self.nominal_obligations(uv.def, uv.args); diff --git a/compiler/rustc_traits/src/normalize_projection_ty.rs b/compiler/rustc_traits/src/normalize_projection_ty.rs index ebea483a77cf..16d5c20c87fe 100644 --- a/compiler/rustc_traits/src/normalize_projection_ty.rs +++ b/compiler/rustc_traits/src/normalize_projection_ty.rs @@ -75,7 +75,7 @@ fn normalize_canonicalized_free_alias<'tcx>( tcx.infer_ctxt().enter_canonical_trait_query( &goal, |ocx, ParamEnvAnd { param_env, value: goal }| { - let obligations = tcx.predicates_of(goal.def_id).instantiate_own(tcx, goal.args).map( + let obligations = tcx.predicates_of(goal.def_id()).instantiate_own(tcx, goal.args).map( |(predicate, span)| { traits::Obligation::new( tcx, @@ -87,9 +87,9 @@ fn normalize_canonicalized_free_alias<'tcx>( ); ocx.register_obligations(obligations); let normalized_term = if goal.kind(tcx).is_type() { - tcx.type_of(goal.def_id).instantiate(tcx, goal.args).skip_norm_wip().into() + tcx.type_of(goal.def_id()).instantiate(tcx, goal.args).skip_norm_wip().into() } else { - tcx.const_of_item(goal.def_id).instantiate(tcx, goal.args).skip_norm_wip().into() + tcx.const_of_item(goal.def_id()).instantiate(tcx, goal.args).skip_norm_wip().into() }; Ok(NormalizationResult { normalized_term }) }, diff --git a/compiler/rustc_ty_utils/src/assoc.rs b/compiler/rustc_ty_utils/src/assoc.rs index 497f9205eb19..1d24a207103c 100644 --- a/compiler/rustc_ty_utils/src/assoc.rs +++ b/compiler/rustc_ty_utils/src/assoc.rs @@ -1,6 +1,8 @@ use rustc_hir::def::DefKind; -use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId}; -use rustc_hir::definitions::{DefPathData, DisambiguatorState}; +use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId, LocalDefIdMap}; +use rustc_hir::definitions::{ + DefPathData, PerParentDisambiguatorState, PerParentDisambiguatorsMap, +}; use rustc_hir::intravisit::{self, Visitor}; use rustc_hir::{self as hir, ConstItemRhs, ImplItemImplKind, ItemKind}; use rustc_middle::query::Providers; @@ -129,7 +131,7 @@ struct RPITVisitor<'a, 'tcx> { tcx: TyCtxt<'tcx>, synthetics: Vec, data: DefPathData, - disambiguator: &'a mut DisambiguatorState, + disambiguators: &'a mut LocalDefIdMap, } impl<'tcx> Visitor<'tcx> for RPITVisitor<'_, 'tcx> { @@ -138,7 +140,7 @@ fn visit_opaque_ty(&mut self, opaque: &'tcx hir::OpaqueTy<'tcx>) -> Self::Result self.tcx, opaque.def_id, self.data, - &mut self.disambiguator, + &mut self.disambiguators, )); intravisit::walk_opaque_ty(self, opaque) } @@ -149,7 +151,7 @@ fn associated_types_for_impl_traits_in_trait_or_impl<'tcx>( def_id: LocalDefId, ) -> DefIdMap> { let item = tcx.hir_expect_item(def_id); - let disambiguator = &mut DisambiguatorState::new(); + let disambiguators = &mut Default::default(); match item.kind { ItemKind::Trait(.., trait_item_refs) => trait_item_refs .iter() @@ -163,7 +165,7 @@ fn associated_types_for_impl_traits_in_trait_or_impl<'tcx>( }; let def_name = tcx.item_name(fn_def_id.to_def_id()); let data = DefPathData::AnonAssocTy(def_name); - let mut visitor = RPITVisitor { tcx, synthetics: vec![], data, disambiguator }; + let mut visitor = RPITVisitor { tcx, synthetics: vec![], data, disambiguators }; visitor.visit_fn_ret_ty(output); let defs = visitor .synthetics @@ -197,7 +199,7 @@ fn associated_types_for_impl_traits_in_trait_or_impl<'tcx>( return Some((did, vec![])); }; let iter = in_trait_def[&trait_item_def_id].iter().map(|&id| { - associated_type_for_impl_trait_in_impl(tcx, id, item, disambiguator) + associated_type_for_impl_trait_in_impl(tcx, id, item, disambiguators) .to_def_id() }); Some((did, iter.collect())) @@ -221,7 +223,7 @@ fn associated_type_for_impl_trait_in_trait( tcx: TyCtxt<'_>, opaque_ty_def_id: LocalDefId, data: DefPathData, - disambiguator: &mut DisambiguatorState, + disambiguators: &mut LocalDefIdMap, ) -> LocalDefId { let (hir::OpaqueTyOrigin::FnReturn { parent: fn_def_id, .. } | hir::OpaqueTyOrigin::AsyncFn { parent: fn_def_id, .. }) = @@ -240,7 +242,7 @@ fn associated_type_for_impl_trait_in_trait( None, DefKind::AssocTy, Some(data), - disambiguator, + disambiguators.get_or_create(trait_def_id), ); let local_def_id = trait_assoc_ty.def_id(); @@ -283,7 +285,7 @@ fn associated_type_for_impl_trait_in_impl( tcx: TyCtxt<'_>, trait_assoc_def_id: DefId, impl_fn: &hir::ImplItem<'_>, - disambiguator: &mut DisambiguatorState, + disambiguators: &mut LocalDefIdMap, ) -> LocalDefId { let impl_local_def_id = tcx.local_parent(impl_fn.owner_id.def_id); @@ -306,7 +308,7 @@ fn associated_type_for_impl_trait_in_impl( None, DefKind::AssocTy, Some(data), - disambiguator, + disambiguators.get_or_create(impl_local_def_id), ); let local_def_id = impl_assoc_ty.def_id(); diff --git a/compiler/rustc_type_ir/src/inherent.rs b/compiler/rustc_type_ir/src/inherent.rs index a336313e90b8..a8757e045d17 100644 --- a/compiler/rustc_type_ir/src/inherent.rs +++ b/compiler/rustc_type_ir/src/inherent.rs @@ -432,14 +432,16 @@ fn is_error(self) -> bool { } } - fn to_alias_term(self) -> Option> { + fn to_alias_term(self, interner: I) -> Option> { match self.kind() { ty::TermKind::Ty(ty) => match ty.kind() { ty::Alias(alias_ty) => Some(alias_ty.into()), _ => None, }, ty::TermKind::Const(ct) => match ct.kind() { - ty::ConstKind::Unevaluated(uv) => Some(uv.into()), + ty::ConstKind::Unevaluated(uv) => { + Some(ty::AliasTerm::from_unevaluated_const(interner, uv)) + } _ => None, }, } diff --git a/compiler/rustc_type_ir/src/interner.rs b/compiler/rustc_type_ir/src/interner.rs index f71f7c7c1ab3..f350e5da9654 100644 --- a/compiler/rustc_type_ir/src/interner.rs +++ b/compiler/rustc_type_ir/src/interner.rs @@ -197,11 +197,9 @@ fn canonical_param_env_cache_get_or_insert( type VariancesOf: Copy + Debug + SliceLike; fn variances_of(self, def_id: Self::DefId) -> Self::VariancesOf; - // FIXME: remove `def_id` param after `AliasTermKind` contains `def_id` within fn opt_alias_variances( self, - kind: impl Into, - def_id: Self::DefId, + kind: impl Into>, ) -> Option; fn type_of(self, def_id: Self::DefId) -> ty::EarlyBinder; @@ -215,7 +213,8 @@ fn type_of_opaque_hir_typeck(self, def_id: Self::LocalDefId) fn alias_ty_kind_from_def_id(self, def_id: Self::DefId) -> ty::AliasTyKind; - fn alias_term_kind(self, alias: ty::AliasTerm) -> ty::AliasTermKind; + // FIXME: remove in favor of explicit construction + fn alias_term_kind_from_def_id(self, def_id: Self::DefId) -> ty::AliasTermKind; fn trait_ref_and_own_args_for_alias( self, diff --git a/compiler/rustc_type_ir/src/outlives.rs b/compiler/rustc_type_ir/src/outlives.rs index 5b4e44dc89eb..56f40d3f7828 100644 --- a/compiler/rustc_type_ir/src/outlives.rs +++ b/compiler/rustc_type_ir/src/outlives.rs @@ -226,7 +226,7 @@ pub fn compute_alias_components_recursive( alias_ty: ty::AliasTy, out: &mut SmallVec<[Component; 4]>, ) { - let opt_variances = cx.opt_alias_variances(alias_ty.kind, alias_ty.kind.def_id()); + let opt_variances = cx.opt_alias_variances(alias_ty.kind); let mut visitor = OutlivesCollector { cx, out, visited: Default::default() }; diff --git a/compiler/rustc_type_ir/src/predicate.rs b/compiler/rustc_type_ir/src/predicate.rs index e480b089b655..0545fbfda6e4 100644 --- a/compiler/rustc_type_ir/src/predicate.rs +++ b/compiler/rustc_type_ir/src/predicate.rs @@ -3,9 +3,7 @@ use derive_where::derive_where; #[cfg(feature = "nightly")] -use rustc_macros::{ - Decodable, Decodable_NoContext, Encodable, Encodable_NoContext, HashStable_NoContext, -}; +use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext}; use rustc_type_ir_macros::{ GenericTypeVisitable, Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic, }; @@ -532,7 +530,7 @@ pub fn with_self_ty(&self, interner: I, self_ty: I::Ty) -> ProjectionPredicate) projection_predicate.projection_term.args.type_at(0); Self { - def_id: projection_predicate.projection_term.def_id, + def_id: projection_predicate.projection_term.def_id(), args: interner.mk_args(&projection_predicate.projection_term.args.as_slice()[1..]), term: projection_predicate.term, use_existential_projection_new_instead: (), @@ -562,71 +560,104 @@ pub fn item_def_id(&self) -> I::DefId { } } -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] -#[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_NoContext))] -pub enum AliasTermKind { +#[derive_where(Clone, Copy, PartialEq, Eq, Hash, Debug; I: Interner)] +#[derive(Lift_Generic)] +#[cfg_attr( + feature = "nightly", + derive(Encodable_NoContext, Decodable_NoContext, HashStable_NoContext) +)] +pub enum AliasTermKind { /// A projection `::AssocType`. /// /// Can get normalized away if monomorphic enough. - ProjectionTy, + /// + /// The `def_id` is the `DefId` of the `TraitItem` for the associated type. + /// + /// Note that the `def_id` is not the `DefId` of the `TraitRef` containing this + /// associated type, which is in `interner.associated_item(def_id).container`, + /// aka. `interner.parent(def_id)`. + ProjectionTy { def_id: I::DefId }, + /// An associated type in an inherent `impl` - InherentTy, + /// + /// The `def_id` is the `DefId` of the `ImplItem` for the associated type. + InherentTy { def_id: I::DefId }, + /// An opaque type (usually from `impl Trait` in type aliases or function return types) /// - /// Can only be normalized away in PostAnalysis mode or its defining scope. - OpaqueTy, - /// A free type alias that actually checks its trait bounds. + /// `def_id` is the `DefId` of the `OpaqueType` item. + /// + /// Can only be normalized away in `PostAnalysis` mode or its defining scope. + /// + /// During codegen, `interner.type_of(def_id)` can be used to get the type of the + /// underlying type if the type is an opaque. + OpaqueTy { def_id: I::DefId }, + + /// A type alias that actually checks its trait bounds. /// /// Currently only used if the type alias references opaque types. /// Can always be normalized away. - FreeTy, + FreeTy { def_id: I::DefId }, /// An unevaluated anonymous constants. - UnevaluatedConst, + UnevaluatedConst { def_id: I::DefId }, /// An unevaluated const coming from an associated const. - ProjectionConst, + ProjectionConst { def_id: I::DefId }, /// A top level const item not part of a trait or impl. - FreeConst, + FreeConst { def_id: I::DefId }, /// An associated const in an inherent `impl` - InherentConst, + InherentConst { def_id: I::DefId }, } -impl AliasTermKind { +impl AliasTermKind { pub fn descr(self) -> &'static str { match self { - AliasTermKind::ProjectionTy => "associated type", - AliasTermKind::ProjectionConst => "associated const", - AliasTermKind::InherentTy => "inherent associated type", - AliasTermKind::InherentConst => "inherent associated const", - AliasTermKind::OpaqueTy => "opaque type", - AliasTermKind::FreeTy => "type alias", - AliasTermKind::FreeConst => "unevaluated constant", - AliasTermKind::UnevaluatedConst => "unevaluated constant", + AliasTermKind::ProjectionTy { .. } => "associated type", + AliasTermKind::ProjectionConst { .. } => "associated const", + AliasTermKind::InherentTy { .. } => "inherent associated type", + AliasTermKind::InherentConst { .. } => "inherent associated const", + AliasTermKind::OpaqueTy { .. } => "opaque type", + AliasTermKind::FreeTy { .. } => "type alias", + AliasTermKind::FreeConst { .. } => "unevaluated constant", + AliasTermKind::UnevaluatedConst { .. } => "unevaluated constant", } } pub fn is_type(self) -> bool { match self { - AliasTermKind::ProjectionTy - | AliasTermKind::InherentTy - | AliasTermKind::OpaqueTy - | AliasTermKind::FreeTy => true, + AliasTermKind::ProjectionTy { .. } + | AliasTermKind::InherentTy { .. } + | AliasTermKind::OpaqueTy { .. } + | AliasTermKind::FreeTy { .. } => true, - AliasTermKind::UnevaluatedConst - | AliasTermKind::ProjectionConst - | AliasTermKind::InherentConst - | AliasTermKind::FreeConst => false, + AliasTermKind::UnevaluatedConst { .. } + | AliasTermKind::ProjectionConst { .. } + | AliasTermKind::InherentConst { .. } + | AliasTermKind::FreeConst { .. } => false, } } + + // FIXME: replace with explicit matches + pub fn def_id(self) -> I::DefId { + let (AliasTermKind::ProjectionTy { def_id } + | AliasTermKind::InherentTy { def_id } + | AliasTermKind::OpaqueTy { def_id } + | AliasTermKind::FreeTy { def_id } + | AliasTermKind::UnevaluatedConst { def_id } + | AliasTermKind::ProjectionConst { def_id } + | AliasTermKind::FreeConst { def_id } + | AliasTermKind::InherentConst { def_id }) = self; + def_id + } } -impl From> for AliasTermKind { +impl From> for AliasTermKind { fn from(value: ty::AliasTyKind) -> Self { match value { - ty::Projection { .. } => AliasTermKind::ProjectionTy, - ty::Opaque { .. } => AliasTermKind::OpaqueTy, - ty::Free { .. } => AliasTermKind::FreeTy, - ty::Inherent { .. } => AliasTermKind::InherentTy, + ty::Projection { def_id } => AliasTermKind::ProjectionTy { def_id }, + ty::Opaque { def_id } => AliasTermKind::OpaqueTy { def_id }, + ty::Free { def_id } => AliasTermKind::FreeTy { def_id }, + ty::Inherent { def_id } => AliasTermKind::InherentTy { def_id }, } } } @@ -655,17 +686,9 @@ pub struct AliasTerm { /// while for TAIT it is used for the generic parameters of the alias. pub args: I::GenericArgs, - /// The `DefId` of the `TraitItem` or `ImplItem` for the associated type `N` depending on whether - /// this is a projection or an inherent projection or the `DefId` of the `OpaqueType` item if - /// this is an opaque. - /// - /// During codegen, `interner.type_of(def_id)` can be used to get the type of the - /// underlying type if the type is an opaque. - /// - /// Note that if this is an associated type, this is not the `DefId` of the - /// `TraitRef` containing this associated type, which is in `interner.associated_item(def_id).container`, - /// aka. `interner.parent(def_id)`. - pub def_id: I::DefId, + #[type_foldable(identity)] + #[type_visitable(ignore)] + pub kind: AliasTermKind, /// This field exists to prevent the creation of `AliasTerm` without using [`AliasTerm::new_from_args`]. #[derive_where(skip(Debug))] @@ -675,62 +698,86 @@ pub struct AliasTerm { impl Eq for AliasTerm {} impl AliasTerm { - pub fn new_from_args(interner: I, def_id: I::DefId, args: I::GenericArgs) -> AliasTerm { - interner.debug_assert_args_compatible(def_id, args); - AliasTerm { def_id, args, _use_alias_term_new_instead: () } + pub fn new_from_args( + interner: I, + kind: AliasTermKind, + args: I::GenericArgs, + ) -> AliasTerm { + interner.debug_assert_args_compatible(kind.def_id(), args); + AliasTerm { kind, args, _use_alias_term_new_instead: () } } pub fn new( interner: I, - def_id: I::DefId, + kind: AliasTermKind, args: impl IntoIterator>, ) -> AliasTerm { let args = interner.mk_args_from_iter(args.into_iter().map(Into::into)); - Self::new_from_args(interner, def_id, args) + Self::new_from_args(interner, kind, args) + } + + pub fn new_from_def_id(interner: I, def_id: I::DefId, args: I::GenericArgs) -> AliasTerm { + let kind = interner.alias_term_kind_from_def_id(def_id); + Self::new_from_args(interner, kind, args) + } + + pub fn from_unevaluated_const(interner: I, ct: ty::UnevaluatedConst) -> Self { + let kind = interner.alias_term_kind_from_def_id(ct.def.into()); + AliasTerm::new_from_args(interner, kind, ct.args) } pub fn expect_ty(self, interner: I) -> ty::AliasTy { let kind = match self.kind(interner) { - AliasTermKind::ProjectionTy => AliasTyKind::Projection { def_id: self.def_id }, - AliasTermKind::InherentTy => AliasTyKind::Inherent { def_id: self.def_id }, - AliasTermKind::OpaqueTy => AliasTyKind::Opaque { def_id: self.def_id }, - AliasTermKind::FreeTy => AliasTyKind::Free { def_id: self.def_id }, - AliasTermKind::InherentConst - | AliasTermKind::FreeConst - | AliasTermKind::UnevaluatedConst - | AliasTermKind::ProjectionConst => { + AliasTermKind::ProjectionTy { def_id } => AliasTyKind::Projection { def_id }, + AliasTermKind::InherentTy { def_id } => AliasTyKind::Inherent { def_id }, + AliasTermKind::OpaqueTy { def_id } => AliasTyKind::Opaque { def_id }, + AliasTermKind::FreeTy { def_id } => AliasTyKind::Free { def_id }, + AliasTermKind::InherentConst { .. } + | AliasTermKind::FreeConst { .. } + | AliasTermKind::UnevaluatedConst { .. } + | AliasTermKind::ProjectionConst { .. } => { panic!("Cannot turn `UnevaluatedConst` into `AliasTy`") } }; ty::AliasTy { kind, args: self.args, _use_alias_ty_new_instead: () } } - pub fn kind(self, interner: I) -> AliasTermKind { - interner.alias_term_kind(self) + // FIXME: remove this function (access the field instead) + pub fn kind(self, _interner: I) -> AliasTermKind { + self.kind + } + + // FIXME: replace with explicit matches + pub fn def_id(self) -> I::DefId { + self.kind.def_id() } pub fn to_term(self, interner: I) -> I::Term { let alias_ty_kind = match self.kind(interner) { - AliasTermKind::FreeConst - | AliasTermKind::InherentConst - | AliasTermKind::UnevaluatedConst - | AliasTermKind::ProjectionConst => { + AliasTermKind::FreeConst { def_id } + | AliasTermKind::InherentConst { def_id } + | AliasTermKind::UnevaluatedConst { def_id } + | AliasTermKind::ProjectionConst { def_id } => { return I::Const::new_unevaluated( interner, - ty::UnevaluatedConst::new(self.def_id.try_into().unwrap(), self.args), + ty::UnevaluatedConst::new(def_id.try_into().unwrap(), self.args), ) .into(); } - AliasTermKind::ProjectionTy => ty::Projection { def_id: self.def_id }, - AliasTermKind::InherentTy => ty::Inherent { def_id: self.def_id }, - AliasTermKind::OpaqueTy => ty::Opaque { def_id: self.def_id }, - AliasTermKind::FreeTy => ty::Free { def_id: self.def_id }, + AliasTermKind::ProjectionTy { def_id } => ty::Projection { def_id }, + AliasTermKind::InherentTy { def_id } => ty::Inherent { def_id }, + AliasTermKind::OpaqueTy { def_id } => ty::Opaque { def_id }, + AliasTermKind::FreeTy { def_id } => ty::Free { def_id }, }; Ty::new_alias(interner, ty::AliasTy::new_from_args(interner, alias_ty_kind, self.args)) .into() } + + pub fn with_args(self, interner: I, args: I::GenericArgs) -> Self { + Self::new_from_args(interner, self.kind, args) + } } /// The following methods work only with (trait) associated term projections. @@ -742,7 +789,7 @@ pub fn self_ty(self) -> I::Ty { pub fn with_replaced_self_ty(self, interner: I, self_ty: I::Ty) -> Self { AliasTerm::new( interner, - self.def_id, + self.kind, [self_ty.into()].into_iter().chain(self.args.iter().skip(1)), ) } @@ -751,11 +798,11 @@ pub fn trait_def_id(self, interner: I) -> I::TraitId { assert!( matches!( self.kind(interner), - AliasTermKind::ProjectionTy | AliasTermKind::ProjectionConst + AliasTermKind::ProjectionTy { .. } | AliasTermKind::ProjectionConst { .. } ), "expected a projection" ); - interner.parent(self.def_id).try_into().unwrap() + interner.parent(self.def_id()).try_into().unwrap() } /// Extracts the underlying trait reference and own args from this projection. @@ -763,7 +810,7 @@ pub fn trait_def_id(self, interner: I) -> I::TraitId { /// then this function would return a `T: StreamingIterator` trait reference and /// `['a]` as the own args. pub fn trait_ref_and_own_args(self, interner: I) -> (TraitRef, I::GenericArgsSlice) { - interner.trait_ref_and_own_args_for_alias(self.def_id, self.args) + interner.trait_ref_and_own_args_for_alias(self.def_id(), self.args) } /// Extracts the underlying trait reference from this projection. @@ -804,7 +851,7 @@ pub fn rebase_inherent_args_onto_impl( ) -> I::GenericArgs { debug_assert!(matches!( self.kind(interner), - AliasTermKind::InherentTy | AliasTermKind::InherentConst + AliasTermKind::InherentTy { .. } | AliasTermKind::InherentConst { .. } )); interner.mk_args_from_iter(impl_args.iter().chain(self.args.iter().skip(1))) } @@ -812,13 +859,11 @@ pub fn rebase_inherent_args_onto_impl( impl From> for AliasTerm { fn from(ty: ty::AliasTy) -> Self { - AliasTerm { args: ty.args, def_id: ty.kind.def_id(), _use_alias_term_new_instead: () } - } -} - -impl From> for AliasTerm { - fn from(ct: ty::UnevaluatedConst) -> Self { - AliasTerm { args: ct.args, def_id: ct.def.into(), _use_alias_term_new_instead: () } + AliasTerm { + args: ty.args, + kind: AliasTermKind::from(ty.kind), + _use_alias_term_new_instead: (), + } } } @@ -864,7 +909,7 @@ pub fn trait_def_id(self, interner: I) -> I::TraitId { } pub fn def_id(self) -> I::DefId { - self.projection_term.def_id + self.projection_term.def_id() } } @@ -885,7 +930,7 @@ pub fn term(&self) -> ty::Binder { /// associated type, which is in `tcx.associated_item(projection_def_id()).container`. pub fn item_def_id(&self) -> I::DefId { // Ok to skip binder since trait `DefId` does not care about regions. - self.skip_binder().projection_term.def_id + self.skip_binder().projection_term.def_id() } } @@ -924,7 +969,7 @@ pub fn trait_def_id(self, interner: I) -> I::TraitId { } pub fn def_id(self) -> I::DefId { - self.alias.def_id + self.alias.def_id() } } diff --git a/compiler/rustc_type_ir/src/relate.rs b/compiler/rustc_type_ir/src/relate.rs index 2ae8d52db6f5..425436dabafb 100644 --- a/compiler/rustc_type_ir/src/relate.rs +++ b/compiler/rustc_type_ir/src/relate.rs @@ -220,7 +220,7 @@ fn relate>( ))) } else { let cx = relation.cx(); - let args = if let Some(variances) = cx.opt_alias_variances(a.kind, a.kind.def_id()) { + let args = if let Some(variances) = cx.opt_alias_variances(a.kind) { relate_args_with_variances(relation, variances, a.args, b.args)? } else { relate_args_invariantly(relation, a.args, b.args)? @@ -236,27 +236,27 @@ fn relate>( a: ty::AliasTerm, b: ty::AliasTerm, ) -> RelateResult> { - if a.def_id != b.def_id { - Err(TypeError::ProjectionMismatched(ExpectedFound::new(a.def_id, b.def_id))) + if a.def_id() != b.def_id() { + Err(TypeError::ProjectionMismatched(ExpectedFound::new(a.def_id(), b.def_id()))) } else { let args = match a.kind(relation.cx()) { - ty::AliasTermKind::OpaqueTy => relate_args_with_variances( + ty::AliasTermKind::OpaqueTy { .. } => relate_args_with_variances( relation, - relation.cx().variances_of(a.def_id), + relation.cx().variances_of(a.def_id()), a.args, b.args, )?, - ty::AliasTermKind::ProjectionTy - | ty::AliasTermKind::FreeConst - | ty::AliasTermKind::FreeTy - | ty::AliasTermKind::InherentTy - | ty::AliasTermKind::InherentConst - | ty::AliasTermKind::UnevaluatedConst - | ty::AliasTermKind::ProjectionConst => { + ty::AliasTermKind::ProjectionTy { .. } + | ty::AliasTermKind::FreeConst { .. } + | ty::AliasTermKind::FreeTy { .. } + | ty::AliasTermKind::InherentTy { .. } + | ty::AliasTermKind::InherentConst { .. } + | ty::AliasTermKind::UnevaluatedConst { .. } + | ty::AliasTermKind::ProjectionConst { .. } => { relate_args_invariantly(relation, a.args, b.args)? } }; - Ok(ty::AliasTerm::new_from_args(relation.cx(), a.def_id, args)) + Ok(a.with_args(relation.cx(), args)) } } } diff --git a/library/Cargo.lock b/library/Cargo.lock index 834babacdb96..0d978f5dcd49 100644 --- a/library/Cargo.lock +++ b/library/Cargo.lock @@ -346,6 +346,7 @@ dependencies = [ "vex-sdk", "wasip1", "wasip2", + "wasip3", "windows-link 0.0.0", ] @@ -418,9 +419,20 @@ dependencies = [ [[package]] name = "wasip2" -version = "1.0.2+wasi-0.2.9" +version = "1.0.3+wasi-0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" +dependencies = [ + "rustc-std-workspace-alloc", + "rustc-std-workspace-core", + "wit-bindgen", +] + +[[package]] +name = "wasip3" +version = "0.6.0+wasi-0.3.0-rc-2026-03-15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed83456dd6a0b8581998c0365e4651fa2997e5093b49243b7f35391afaa7a3d9" dependencies = [ "rustc-std-workspace-alloc", "rustc-std-workspace-core", @@ -513,9 +525,9 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] name = "wit-bindgen" -version = "0.51.0" +version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" dependencies = [ "rustc-std-workspace-alloc", "rustc-std-workspace-core", diff --git a/library/core/src/ffi/c_str.rs b/library/core/src/ffi/c_str.rs index e3a3aed4a794..97831c41dc0f 100644 --- a/library/core/src/ffi/c_str.rs +++ b/library/core/src/ffi/c_str.rs @@ -176,7 +176,8 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { } #[stable(feature = "cstr_default", since = "1.10.0")] -impl Default for &CStr { +#[rustc_const_unstable(feature = "const_default", issue = "143894")] +impl const Default for &CStr { #[inline] fn default() -> Self { c"" diff --git a/library/core/src/ffi/va_list.rs b/library/core/src/ffi/va_list.rs index 034e4ad728b8..ca211fca1551 100644 --- a/library/core/src/ffi/va_list.rs +++ b/library/core/src/ffi/va_list.rs @@ -213,14 +213,15 @@ struct VaListInner { /// assert_eq!(unsafe { my_func(3, 42i32, -7i32, 20i32) }, 55); /// ``` /// -/// The [`VaList::arg`] method can be used to read an argument from the list. This method -/// automatically advances the `VaList` to the next argument. The C equivalent is `va_arg`. +/// The [`VaList::arg`] method reads the next argument from the variable argument list, +/// and is equivalent to C `va_arg`. /// /// Cloning a `VaList` performs the equivalent of C `va_copy`, producing an independent cursor /// that arguments can be read from without affecting the original. Dropping a `VaList` performs /// the equivalent of C `va_end`. /// -/// This can be used across an FFI boundary, and fully matches the platform's `va_list`. +/// A `VaList` can be used across an FFI boundary, and fully matches the platform's `va_list` in +/// terms of layout and ABI. #[repr(transparent)] #[lang = "va_list"] pub struct VaList<'a> { @@ -285,17 +286,33 @@ impl Sealed for *const T {} /// Types that are valid to read using [`VaList::arg`]. /// +/// This trait is implemented for primitive types that have a variable argument application-binary +/// interface (ABI) on the current platform. It is always implemented for: +/// +/// - [`c_int`], [`c_long`] and [`c_longlong`] +/// - [`c_uint`], [`c_ulong`] and [`c_ulonglong`] +/// - [`c_double`] +/// - `*const T` and `*mut T` +/// +/// Implementations for e.g. `i32` or `usize` shouldn't be relied upon directly, +/// because they may not be available on all platforms. +/// /// # Safety /// -/// The standard library implements this trait for primitive types that are -/// expected to have a variable argument application-binary interface (ABI) on all -/// platforms. -/// -/// When C passes variable arguments, integers smaller than [`c_int`] and floats smaller -/// than [`c_double`] are implicitly promoted to [`c_int`] and [`c_double`] respectively. -/// Implementing this trait for types that are subject to this promotion rule is invalid. +/// When C passes variable arguments, signed integers smaller than [`c_int`] are promoted +/// to [`c_int`], unsigned integers smaller than [`c_uint`] are promoted to [`c_uint`], +/// and [`c_float`] is promoted to [`c_double`]. Implementing this trait for types that are +/// subject to this promotion rule is invalid. /// /// [`c_int`]: core::ffi::c_int +/// [`c_long`]: core::ffi::c_long +/// [`c_longlong`]: core::ffi::c_longlong +/// +/// [`c_uint`]: core::ffi::c_uint +/// [`c_ulong`]: core::ffi::c_ulong +/// [`c_ulonglong`]: core::ffi::c_ulonglong +/// +/// [`c_float`]: core::ffi::c_float /// [`c_double`]: core::ffi::c_double // We may unseal this trait in the future, but currently our `va_arg` implementations don't support // types with an alignment larger than 8, or with a non-scalar layout. Inline assembly can be used @@ -352,14 +369,16 @@ const fn va_arg_safe_check() {} va_arg_safe_check::(); va_arg_safe_check::(); va_arg_safe_check::(); + va_arg_safe_check::(); va_arg_safe_check::(); va_arg_safe_check::(); + va_arg_safe_check::(); }; impl<'f> VaList<'f> { - /// Read an argument from the variable argument list, and advance to the next argument. + /// Read the next argument from the variable argument list. /// /// Only types that implement [`VaArgSafe`] can be read from a variable argument list. /// diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index d68a9493e9f3..33aa2ab14dce 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -1911,7 +1911,11 @@ pub const fn strict_pow(self, mut exp: u32) -> Self { } } - /// Returns the square root of the number, rounded down. + /// Returns the integer square root of the number, rounded down. + /// + /// This function returns the **principal (non-negative) square root**. + /// For a given number `n`, although both `x` and `-x` satisfy x2 = n, + /// this function always returns the non-negative value. /// /// Returns `None` if `self` is negative. /// @@ -3206,7 +3210,11 @@ pub const fn pow(self, mut exp: u32) -> Self { } } - /// Returns the square root of the number, rounded down. + /// Returns the integer square root of the number, rounded down. + /// + /// This function returns the **principal (non-negative) square root**. + /// For a given number `n`, although both `x` and `-x` satisfy x2 = n, + /// this function always returns the non-negative value. /// /// # Panics /// diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index 7cb022b08290..59c37a7ce963 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -1118,7 +1118,10 @@ pub const fn saturating_mul(self, other: Self) -> Self { /// assuming overflow cannot occur. /// Overflow is unchecked, and it is undefined behavior to overflow /// *even if the result would wrap to a non-zero value*. - /// The behavior is undefined as soon as + /// + /// # Safety + /// + /// This results in undefined behavior when #[doc = sign_dependent_expr!{ $signedness ? if signed { @@ -1695,7 +1698,10 @@ pub const fn saturating_add(self, other: $Int) -> Self { /// assuming overflow cannot occur. /// Overflow is unchecked, and it is undefined behavior to overflow /// *even if the result would wrap to a non-zero value*. - /// The behavior is undefined as soon as + /// + /// # Safety + /// + /// This results in undefined behavior when #[doc = concat!("`self + rhs > ", stringify!($Int), "::MAX`.")] /// /// # Examples diff --git a/library/coretests/tests/ffi/cstr.rs b/library/coretests/tests/ffi/cstr.rs index 7d669cc1c3ff..0fb98036b267 100644 --- a/library/coretests/tests/ffi/cstr.rs +++ b/library/coretests/tests/ffi/cstr.rs @@ -1,5 +1,11 @@ use core::ffi::CStr; +#[test] +fn const_default() { + const S: &CStr = <_>::default(); + assert_eq!(S, c""); +} + #[test] fn compares_as_u8s() { let a: &CStr = c"Hello!"; // Starts with ascii diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index ebd09f31e25a..623a5a34359f 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -84,12 +84,12 @@ wasip1 = { version = "1.0.0", features = [ ], default-features = false } [target.'cfg(all(target_os = "wasi", target_env = "p2"))'.dependencies] -wasip2 = { version = '1.0.2', features = [ +wasip2 = { version = '1.0.3', features = [ 'rustc-dep-of-std', ], default-features = false } [target.'cfg(all(target_os = "wasi", target_env = "p3"))'.dependencies] -wasip2 = { version = '1.0.2', features = [ +wasip3 = { version = '0.6.0', features = [ 'rustc-dep-of-std', ], default-features = false } diff --git a/library/std/src/sys/args/mod.rs b/library/std/src/sys/args/mod.rs index 5424d40a1588..fd5562a520b7 100644 --- a/library/std/src/sys/args/mod.rs +++ b/library/std/src/sys/args/mod.rs @@ -42,8 +42,8 @@ pub use wasip1::*; } all(target_os = "wasi", any(target_env = "p2", target_env = "p3")) => { - mod wasip2; - pub use wasip2::*; + mod wasi; + pub use wasi::*; } target_os = "xous" => { mod xous; diff --git a/library/std/src/sys/args/wasi.rs b/library/std/src/sys/args/wasi.rs new file mode 100644 index 000000000000..3d26a76ad6db --- /dev/null +++ b/library/std/src/sys/args/wasi.rs @@ -0,0 +1,11 @@ +#[cfg(target_env = "p2")] +use wasip2 as wasi; +#[cfg(target_env = "p3")] +use wasip3 as wasi; + +pub use super::common::Args; + +/// Returns the command line arguments +pub fn args() -> Args { + Args::new(wasi::cli::environment::get_arguments().into_iter().map(|arg| arg.into()).collect()) +} diff --git a/library/std/src/sys/args/wasip2.rs b/library/std/src/sys/args/wasip2.rs deleted file mode 100644 index a57e4b97786d..000000000000 --- a/library/std/src/sys/args/wasip2.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub use super::common::Args; - -/// Returns the command line arguments -pub fn args() -> Args { - Args::new(wasip2::cli::environment::get_arguments().into_iter().map(|arg| arg.into()).collect()) -} diff --git a/library/std/src/sys/random/mod.rs b/library/std/src/sys/random/mod.rs index 91f72d073879..12346ef5a2ed 100644 --- a/library/std/src/sys/random/mod.rs +++ b/library/std/src/sys/random/mod.rs @@ -95,8 +95,8 @@ pub use wasip1::fill_bytes; } all(target_os = "wasi", any(target_env = "p2", target_env = "p3")) => { - mod wasip2; - pub use wasip2::{fill_bytes, hashmap_random_keys}; + mod wasi; + pub use wasi::{fill_bytes, hashmap_random_keys}; } target_os = "zkvm" => { mod zkvm; diff --git a/library/std/src/sys/random/wasi.rs b/library/std/src/sys/random/wasi.rs new file mode 100644 index 000000000000..80a9153bdb92 --- /dev/null +++ b/library/std/src/sys/random/wasi.rs @@ -0,0 +1,12 @@ +#[cfg(target_env = "p2")] +use wasip2::random::{insecure_seed::insecure_seed as get_insecure_seed, random::get_random_bytes}; +#[cfg(target_env = "p3")] +use wasip3::random::{insecure_seed::get_insecure_seed, random::get_random_bytes}; + +pub fn fill_bytes(bytes: &mut [u8]) { + bytes.copy_from_slice(&get_random_bytes(u64::try_from(bytes.len()).unwrap())); +} + +pub fn hashmap_random_keys() -> (u64, u64) { + get_insecure_seed() +} diff --git a/library/std/src/sys/random/wasip2.rs b/library/std/src/sys/random/wasip2.rs deleted file mode 100644 index a67c8a6428d1..000000000000 --- a/library/std/src/sys/random/wasip2.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub fn fill_bytes(bytes: &mut [u8]) { - bytes.copy_from_slice(&wasip2::random::random::get_random_bytes( - u64::try_from(bytes.len()).unwrap(), - )); -} - -pub fn hashmap_random_keys() -> (u64, u64) { - wasip2::random::insecure_seed::insecure_seed() -} diff --git a/library/std/src/sys/sync/mutex/no_threads.rs b/library/std/src/sys/sync/mutex/no_threads.rs index 57c78f454c57..a1c2696079f8 100644 --- a/library/std/src/sys/sync/mutex/no_threads.rs +++ b/library/std/src/sys/sync/mutex/no_threads.rs @@ -26,6 +26,6 @@ pub unsafe fn unlock(&self) { #[inline] pub fn try_lock(&self) -> bool { - self.locked.replace(true) == false + !self.locked.replace(true) } } diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 684118280814..babcafb024e0 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -1184,6 +1184,12 @@ pub(crate) fn parse_inner( exit!(1); } + if matches!(flags_cmd, Subcommand::Fix) { + eprintln!( + "WARNING: `x fix` is provided on a best-effort basis and does not support all `cargo fix` options correctly." + ); + } + // CI should always run stage 2 builds, unless it specifically states otherwise #[cfg(not(test))] if flags_stage.is_none() && ci_env.is_running_in_ci() { diff --git a/src/doc/rustc-dev-guide/rust-version b/src/doc/rustc-dev-guide/rust-version index 97c3c27262f8..1175e3372ab6 100644 --- a/src/doc/rustc-dev-guide/rust-version +++ b/src/doc/rustc-dev-guide/rust-version @@ -1 +1 @@ -84c11900724736a2b9afac4822031d78a9ed8e86 +cf1817bc6ecd2d14ca492247c804bad31948dd56 diff --git a/src/doc/rustc-dev-guide/src/tests/compiletest.md b/src/doc/rustc-dev-guide/src/tests/compiletest.md index beef777ccc33..ef30869ac762 100644 --- a/src/doc/rustc-dev-guide/src/tests/compiletest.md +++ b/src/doc/rustc-dev-guide/src/tests/compiletest.md @@ -156,11 +156,12 @@ series of steps. Compiletest starts with an empty directory with the `-C incremental` flag, and then runs the compiler for each revision, reusing the incremental results from previous steps. -The revisions should start with: +Each revision name must start with one of: -* `bfail` — the test should fail to compile -* `bpass` — the test should compile successully -* `rpass` — the test should compile and run successfully +* `cpass` - the test must compile successfully (check build, no codegen) +* `bfail` — the test must fail to compile (full build, with codegen) +* `bpass` — the test must compile successully (full build, with codegen) +* `rpass` — the test must compile and run successfully To make the revisions unique, you should add a suffix like `rpass1` and `rpass2`. diff --git a/src/doc/rustc-dev-guide/src/tests/directives.md b/src/doc/rustc-dev-guide/src/tests/directives.md index 333b76262d18..76bf2cdbea66 100644 --- a/src/doc/rustc-dev-guide/src/tests/directives.md +++ b/src/doc/rustc-dev-guide/src/tests/directives.md @@ -70,11 +70,11 @@ See [Controlling pass/fail expectations](ui.md#controlling-passfail-expectations | Directive | Explanation | Supported test suites | Possible values | |-----------------------------|---------------------------------------------|-------------------------------------------|-----------------| -| `check-pass` | Building (no codegen) should pass | `ui`, `crashes`, `incremental` | N/A | +| `check-pass` | Building (no codegen) should pass | `ui`, `crashes` | N/A | | `check-fail` | Building (no codegen) should fail | `ui`, `crashes` | N/A | -| `build-pass` | Building should pass | `ui`, `crashes`, `codegen`, `incremental` | N/A | +| `build-pass` | Building should pass | `ui`, `crashes`, `codegen` | N/A | | `build-fail` | Building should fail | `ui`, `crashes` | N/A | -| `run-pass` | Program must exit with code `0` | `ui`, `crashes`, `incremental` | N/A | +| `run-pass` | Program must exit with code `0` | `ui`, `crashes` | N/A | | `run-fail` | Program must exit with code `1..=127` | `ui`, `crashes` | N/A | | `run-crash` | Program must crash | `ui` | N/A | | `run-fail-or-crash` | Program must `run-fail` or `run-crash` | `ui` | N/A | @@ -90,9 +90,9 @@ comparison](ui.md#output-comparison) and [Rustfix tests](ui.md#rustfix-tests) fo | Directive | Explanation | Supported test suites | Possible values | |-----------------------------------|--------------------------------------------------------------------------------------------------------------------------|----------------------------------------------|-----------------------------------------------------------------------------------------| -| `check-run-results` | Check run test binary `run-{pass,fail}` output snapshot | `ui`, `crashes`, `incremental` if `run-pass` | N/A | -| `error-pattern` | Check that output contains a specific string | `ui`, `crashes`, `incremental` if `run-pass` | String | -| `regex-error-pattern` | Check that output contains a regex pattern | `ui`, `crashes`, `incremental` if `run-pass` | Regex | +| `check-run-results` | Check run test binary `run-{pass,fail}` output snapshot | `ui`, `crashes`, `incremental` | N/A | +| `error-pattern` | Check that output contains a specific string | `ui`, `crashes`, `incremental` | String | +| `regex-error-pattern` | Check that output contains a regex pattern | `ui`, `crashes`, `incremental` | Regex | | `check-stdout` | Check `stdout` against `error-pattern`s from running test binary[^check_stdout] | `ui`, `crashes`, `incremental` | N/A | | `normalize-stderr-32bit` | Normalize actual stderr (for 32-bit platforms) with a rule `"" -> ""` before comparing against snapshot | `ui`, `incremental` | `"" -> ""`, ``/`` is regex capture and replace syntax | | `normalize-stderr-64bit` | Normalize actual stderr (for 64-bit platforms) with a rule `"" -> ""` before comparing against snapshot | `ui`, `incremental` | `"" -> ""`, ``/`` is regex capture and replace syntax | diff --git a/src/doc/unstable-book/src/language-features/trait-alias.md b/src/doc/unstable-book/src/language-features/trait-alias.md index f1be053ddc42..15d06edf2e0b 100644 --- a/src/doc/unstable-book/src/language-features/trait-alias.md +++ b/src/doc/unstable-book/src/language-features/trait-alias.md @@ -26,7 +26,7 @@ pub fn main() { foo(&1); // Use trait alias for trait objects. - let a: &Bar = &123; + let a: &dyn Bar = &123; println!("{:?}", a); let b = Box::new(456) as Box; println!("{:?}", b); diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 345f13dae322..f2ea85a4bf8e 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -563,7 +563,7 @@ fn projection_to_path_segment<'tcx>( proj: ty::Binder<'tcx, ty::AliasTerm<'tcx>>, cx: &mut DocContext<'tcx>, ) -> PathSegment { - let def_id = proj.skip_binder().def_id; + let def_id = proj.skip_binder().def_id(); let generics = cx.tcx.generics_of(def_id); PathSegment { name: cx.tcx.item_name(def_id), diff --git a/src/tools/cargo b/src/tools/cargo index 7ecf0285ebb4..06ac0e7c0577 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 7ecf0285ebb408d596e4a8ac76a0980d8edb7005 +Subproject commit 06ac0e7c05770a8c7bbf67bdd12fa1a1eefdc8ae diff --git a/src/tools/clippy/clippy_utils/src/ty/mod.rs b/src/tools/clippy/clippy_utils/src/ty/mod.rs index 0c261d21c1ec..5c6fecde238a 100644 --- a/src/tools/clippy/clippy_utils/src/ty/mod.rs +++ b/src/tools/clippy/clippy_utils/src/ty/mod.rs @@ -696,7 +696,7 @@ fn sig_from_bounds<'tcx>( inputs = Some(i); }, ty::ClauseKind::Projection(p) - if Some(p.projection_term.def_id) == lang_items.fn_once_output() + if Some(p.projection_term.def_id()) == lang_items.fn_once_output() && p.projection_term.self_ty() == ty => { if output.is_some() { @@ -737,7 +737,7 @@ fn sig_for_projection<'tcx>(cx: &LateContext<'tcx>, ty: AliasTy<'tcx>) -> Option } inputs = Some(i); }, - ty::ClauseKind::Projection(p) if Some(p.projection_term.def_id) == lang_items.fn_once_output() => { + ty::ClauseKind::Projection(p) if Some(p.projection_term.def_id()) == lang_items.fn_once_output() => { if output.is_some() { // Multiple different fn trait impls. Is this even allowed? return None; diff --git a/src/tools/compiletest/src/directives.rs b/src/tools/compiletest/src/directives.rs index 91e341a17f0a..44765c906c99 100644 --- a/src/tools/compiletest/src/directives.rs +++ b/src/tools/compiletest/src/directives.rs @@ -439,13 +439,6 @@ fn update_pass_mode(&mut self, ln: &DirectiveLine<'_>, config: &Config) { (TestMode::Ui, _) => (), (TestMode::Crashes, _) => (), (TestMode::Codegen, "build-pass") => (), - (TestMode::Incremental, _) => { - // FIXME(Zalathar): This only detects forbidden directives that are - // declared _after_ the incompatible `//@ revisions:` directive(s). - if self.revisions.iter().any(|r| !r.starts_with("bfail")) { - panic!("`{s}` directive is only supported in `bfail` incremental tests") - } - } (mode, _) => panic!("`{s}` directive is not supported in `{mode}` tests"), }; let pass_mode = if config.parse_name_directive(ln, "check-pass") { diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index be65aea9b47e..8a7c34d21222 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -327,12 +327,15 @@ fn should_compile_successfully(&self, pm: Option) -> bool { TestMode::Incremental => { let revision = self.revision.expect("incremental tests require a list of revisions"); - if revision.starts_with("bpass") || revision.starts_with("rpass") { + if revision.starts_with("cpass") + || revision.starts_with("bpass") + || revision.starts_with("rpass") + { true } else if revision.starts_with("bfail") { - pm.is_some() + false } else { - panic!("revision name must begin with `bfail`, `bpass`, or `rpass`"); + panic!("revision name must begin with `cpass`, `bfail`, `bpass`, or `rpass`"); } } mode => panic!("unimplemented for mode {:?}", mode), diff --git a/src/tools/compiletest/src/runtest/incremental.rs b/src/tools/compiletest/src/runtest/incremental.rs index 120c35d97307..85e0c89a8d01 100644 --- a/src/tools/compiletest/src/runtest/incremental.rs +++ b/src/tools/compiletest/src/runtest/incremental.rs @@ -1,4 +1,4 @@ -use super::{FailMode, ProcRes, TestCx, WillExecute}; +use super::{Emit, FailMode, PassMode, ProcRes, TestCx, WillExecute}; impl TestCx<'_> { pub(super) fn run_incremental_test(&self) { @@ -31,7 +31,9 @@ pub(super) fn run_incremental_test(&self) { write!(self.stdout, "revision={:?} props={:#?}", revision, self.props); } - if revision.starts_with("bpass") { + if revision.starts_with("cpass") { + self.run_cpass_test(); + } else if revision.starts_with("bpass") { self.run_bpass_test(); } else if revision.starts_with("rpass") { self.run_rpass_test(); @@ -42,6 +44,12 @@ pub(super) fn run_incremental_test(&self) { } } + fn run_cpass_test(&self) { + let proc_res = self.compile_test(WillExecute::No, Emit::Metadata); + self.check_if_test_should_compile(None, Some(PassMode::Check), &proc_res); + self.check_compiler_output_for_incr(&proc_res); + } + fn run_bpass_test(&self) { let emit_metadata = self.should_emit_metadata(self.pass_mode()); let proc_res = self.compile_test(WillExecute::No, emit_metadata); diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 11569837fbfa..1d12456d2bb2 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -541,6 +541,7 @@ pub(crate) struct WorkspaceInfo<'a> { "vex-sdk", "wasip1", "wasip2", + "wasip3", "windows-link", "windows-sys", "windows-targets", diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index 3b23fe5d8082..1f71c8251aa8 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -844,15 +844,6 @@ ui/derives/issue-43023.rs ui/derives/issue-91492.rs ui/derives/issue-91550.rs ui/derives/issue-97343.rs -ui/deriving/issue-103157.rs -ui/deriving/issue-15689-1.rs -ui/deriving/issue-15689-2.rs -ui/deriving/issue-18738.rs -ui/deriving/issue-19358.rs -ui/deriving/issue-3935.rs -ui/deriving/issue-58319.rs -ui/deriving/issue-6341.rs -ui/deriving/issue-89188-gat-hrtb.rs ui/did_you_mean/issue-103909.rs ui/did_you_mean/issue-105225-named-args.rs ui/did_you_mean/issue-105225.rs diff --git a/tests/incremental/add_private_fn_at_krate_root_cc/struct_point.rs b/tests/incremental/add_private_fn_at_krate_root_cc/struct_point.rs index 6cfc35728a0e..066dbf4ff439 100644 --- a/tests/incremental/add_private_fn_at_krate_root_cc/struct_point.rs +++ b/tests/incremental/add_private_fn_at_krate_root_cc/struct_point.rs @@ -2,21 +2,20 @@ // crate. This should not cause anything we use to be invalidated. // Regression test for #36168. -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 //@ compile-flags: -Z query-dep-graph //@ aux-build:point.rs -//@ build-pass //@ ignore-backends: gcc #![feature(rustc_attrs)] #![allow(dead_code)] #![crate_type = "rlib"] -#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_calls_free_fn", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="bfail2")] +#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_calls_free_fn", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="bpass2")] extern crate point; @@ -24,7 +23,7 @@ pub mod fn_calls_methods_in_same_impl { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn check() { let x = Point { x: 2.0, y: 2.0 }; x.distance_from_origin(); @@ -35,7 +34,7 @@ pub fn check() { pub mod fn_calls_free_fn { use point::{self, Point}; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn check() { let x = Point { x: 2.0, y: 2.0 }; point::distance_squared(&x); @@ -46,7 +45,7 @@ pub fn check() { pub mod fn_make_struct { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn make_origin() -> Point { Point { x: 2.0, y: 2.0 } } @@ -56,7 +55,7 @@ pub fn make_origin() -> Point { pub mod fn_read_field { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn get_x(p: Point) -> f32 { p.x } @@ -66,7 +65,7 @@ pub fn get_x(p: Point) -> f32 { pub mod fn_write_field { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn inc_x(p: &mut Point) { p.x += 1.0; } diff --git a/tests/incremental/change_add_field/struct_point.rs b/tests/incremental/change_add_field/struct_point.rs index 06543588ccd8..59130323b332 100644 --- a/tests/incremental/change_add_field/struct_point.rs +++ b/tests/incremental/change_add_field/struct_point.rs @@ -3,9 +3,8 @@ // Fns with that type used only in their body are also recompiled, but // their callers are not. -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 //@ compile-flags: -Z query-dep-graph -//@ build-pass //@ ignore-backends: gcc #![feature(rustc_attrs)] @@ -13,24 +12,24 @@ #![crate_type = "rlib"] // These are expected to require codegen. -#![rustc_partition_codegened(module="struct_point-point", cfg="bfail2")] -#![rustc_partition_codegened(module="struct_point-fn_with_type_in_sig", cfg="bfail2")] -#![rustc_partition_codegened(module="struct_point-call_fn_with_type_in_sig", cfg="bfail2")] -#![rustc_partition_codegened(module="struct_point-fn_with_type_in_body", cfg="bfail2")] -#![rustc_partition_codegened(module="struct_point-fn_make_struct", cfg="bfail2")] -#![rustc_partition_codegened(module="struct_point-fn_read_field", cfg="bfail2")] -#![rustc_partition_codegened(module="struct_point-fn_write_field", cfg="bfail2")] +#![rustc_partition_codegened(module="struct_point-point", cfg="bpass2")] +#![rustc_partition_codegened(module="struct_point-fn_with_type_in_sig", cfg="bpass2")] +#![rustc_partition_codegened(module="struct_point-call_fn_with_type_in_sig", cfg="bpass2")] +#![rustc_partition_codegened(module="struct_point-fn_with_type_in_body", cfg="bpass2")] +#![rustc_partition_codegened(module="struct_point-fn_make_struct", cfg="bpass2")] +#![rustc_partition_codegened(module="struct_point-fn_read_field", cfg="bpass2")] +#![rustc_partition_codegened(module="struct_point-fn_write_field", cfg="bpass2")] -#![rustc_partition_reused(module="struct_point-call_fn_with_type_in_body", cfg="bfail2")] +#![rustc_partition_reused(module="struct_point-call_fn_with_type_in_body", cfg="bpass2")] pub mod point { - #[cfg(bfail1)] + #[cfg(bpass1)] pub struct Point { pub x: f32, pub y: f32, } - #[cfg(bfail2)] + #[cfg(bpass2)] pub struct Point { pub x: f32, pub y: f32, @@ -39,18 +38,18 @@ pub struct Point { impl Point { pub fn origin() -> Point { - #[cfg(bfail1)] + #[cfg(bpass1)] return Point { x: 0.0, y: 0.0 }; - #[cfg(bfail2)] + #[cfg(bpass2)] return Point { x: 0.0, y: 0.0, z: 0.0 }; } pub fn total(&self) -> f32 { - #[cfg(bfail1)] + #[cfg(bpass1)] return self.x + self.y; - #[cfg(bfail2)] + #[cfg(bpass2)] return self.x + self.y + self.z; } @@ -70,7 +69,7 @@ pub fn x(&self) -> f32 { pub mod fn_with_type_in_sig { use point::Point; - #[rustc_clean(except="typeck_root,fn_sig,optimized_mir", cfg="bfail2")] + #[rustc_clean(except="typeck_root,fn_sig,optimized_mir", cfg="bpass2")] pub fn boop(p: Option<&Point>) -> f32 { p.map(|p| p.total()).unwrap_or(0.0) } @@ -86,7 +85,7 @@ pub fn boop(p: Option<&Point>) -> f32 { pub mod call_fn_with_type_in_sig { use fn_with_type_in_sig; - #[rustc_clean(except="typeck_root,optimized_mir", cfg="bfail2")] + #[rustc_clean(except="typeck_root,optimized_mir", cfg="bpass2")] pub fn bip() -> f32 { fn_with_type_in_sig::boop(None) } @@ -102,7 +101,7 @@ pub fn bip() -> f32 { pub mod fn_with_type_in_body { use point::Point; - #[rustc_clean(except="typeck_root,optimized_mir", cfg="bfail2")] + #[rustc_clean(except="typeck_root,optimized_mir", cfg="bpass2")] pub fn boop() -> f32 { Point::origin().total() } @@ -115,7 +114,7 @@ pub fn boop() -> f32 { pub mod call_fn_with_type_in_body { use fn_with_type_in_body; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn bip() -> f32 { fn_with_type_in_body::boop() } @@ -125,7 +124,7 @@ pub fn bip() -> f32 { pub mod fn_make_struct { use point::Point; - #[rustc_clean(except="typeck_root,fn_sig,optimized_mir", cfg="bfail2")] + #[rustc_clean(except="typeck_root,fn_sig,optimized_mir", cfg="bpass2")] pub fn make_origin(p: Point) -> Point { Point { ..p } } @@ -135,7 +134,7 @@ pub fn make_origin(p: Point) -> Point { pub mod fn_read_field { use point::Point; - #[rustc_clean(except="typeck_root,fn_sig,optimized_mir", cfg="bfail2")] + #[rustc_clean(except="typeck_root,fn_sig,optimized_mir", cfg="bpass2")] pub fn get_x(p: Point) -> f32 { p.x } @@ -145,7 +144,7 @@ pub fn get_x(p: Point) -> f32 { pub mod fn_write_field { use point::Point; - #[rustc_clean(except="typeck_root,fn_sig,optimized_mir", cfg="bfail2")] + #[rustc_clean(except="typeck_root,fn_sig,optimized_mir", cfg="bpass2")] pub fn inc_x(p: &mut Point) { p.x += 1.0; } diff --git a/tests/incremental/change_crate_dep_kind.rs b/tests/incremental/change_crate_dep_kind.rs index a10fe926bf47..3cc2b0fcb369 100644 --- a/tests/incremental/change_crate_dep_kind.rs +++ b/tests/incremental/change_crate_dep_kind.rs @@ -2,16 +2,16 @@ // detected then -Zincremental-verify-ich will trigger an assertion. //@ needs-unwind -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 //@ compile-flags: -Z query-dep-graph -Cpanic=unwind //@ needs-unwind -//@ build-pass (FIXME(62277): could be check-pass?) //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? -#![cfg_attr(bfail1, feature(panic_unwind))] +#![cfg_attr(bpass1, feature(panic_unwind))] // Turn the panic_unwind crate from an explicit into an implicit query: -#[cfg(bfail1)] +#[cfg(bpass1)] extern crate panic_unwind; fn main() {} diff --git a/tests/incremental/change_private_fn/struct_point.rs b/tests/incremental/change_private_fn/struct_point.rs index 08fafea294d8..53dffb7708c1 100644 --- a/tests/incremental/change_private_fn/struct_point.rs +++ b/tests/incremental/change_private_fn/struct_point.rs @@ -1,22 +1,22 @@ // Test where we change the body of a private method in an impl. // We then test what sort of functions must be rebuilt as a result. -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 //@ compile-flags: -Z query-dep-graph -//@ build-pass (FIXME(62277): could be check-pass?) //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![feature(rustc_attrs)] #![allow(dead_code)] #![crate_type = "rlib"] -#![rustc_partition_codegened(module="struct_point-point", cfg="bfail2")] +#![rustc_partition_codegened(module="struct_point-point", cfg="bpass2")] -#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="bfail2")] +#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="bpass2")] pub mod point { pub struct Point { @@ -25,10 +25,10 @@ pub struct Point { } fn distance_squared(this: &Point) -> f32 { - #[cfg(bfail1)] + #[cfg(bpass1)] return this.x + this.y; - #[cfg(bfail2)] + #[cfg(bpass2)] return this.x * this.x + this.y * this.y; } @@ -55,7 +55,7 @@ pub mod fn_calls_methods_in_same_impl { // (not just marked green) - for example, `DeadVisitor` // always runs during compilation as a "pass", and loads // the typeck_root results for bodies. - #[rustc_clean(cfg="bfail2", loaded_from_disk="typeck_root")] + #[rustc_clean(cfg="bpass2", loaded_from_disk="typeck_root")] pub fn check() { let x = Point { x: 2.0, y: 2.0 }; x.distance_from_origin(); @@ -66,7 +66,7 @@ pub fn check() { pub mod fn_calls_methods_in_another_impl { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn check() { let mut x = Point { x: 2.0, y: 2.0 }; x.translate(3.0, 3.0); @@ -77,7 +77,7 @@ pub fn check() { pub mod fn_make_struct { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn make_origin() -> Point { Point { x: 2.0, y: 2.0 } } @@ -87,7 +87,7 @@ pub fn make_origin() -> Point { pub mod fn_read_field { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn get_x(p: Point) -> f32 { p.x } @@ -97,7 +97,7 @@ pub fn get_x(p: Point) -> f32 { pub mod fn_write_field { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn inc_x(p: &mut Point) { p.x += 1.0; } diff --git a/tests/incremental/change_private_fn_cc/auxiliary/point.rs b/tests/incremental/change_private_fn_cc/auxiliary/point.rs index 94dfb602f432..3cf59cedaeb2 100644 --- a/tests/incremental/change_private_fn_cc/auxiliary/point.rs +++ b/tests/incremental/change_private_fn_cc/auxiliary/point.rs @@ -4,10 +4,10 @@ pub struct Point { } fn distance_squared(this: &Point) -> f32 { - #[cfg(bfail1)] + #[cfg(bpass1)] return this.x + this.y; - #[cfg(bfail2)] + #[cfg(bpass2)] return this.x * this.x + this.y * this.y; } diff --git a/tests/incremental/change_private_fn_cc/struct_point.rs b/tests/incremental/change_private_fn_cc/struct_point.rs index 84e532200649..f32eacd8d275 100644 --- a/tests/incremental/change_private_fn_cc/struct_point.rs +++ b/tests/incremental/change_private_fn_cc/struct_point.rs @@ -1,21 +1,21 @@ // Test where we change the body of a private method in an impl. // We then test what sort of functions must be rebuilt as a result. -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 //@ compile-flags: -Z query-dep-graph //@ aux-build:point.rs -//@ build-pass (FIXME(62277): could be check-pass?) //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![crate_type = "rlib"] #![feature(rustc_attrs)] #![allow(dead_code)] -#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="bfail2")] +#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="bpass2")] extern crate point; @@ -23,7 +23,7 @@ pub mod fn_calls_methods_in_same_impl { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn check() { let x = Point { x: 2.0, y: 2.0 }; x.distance_from_origin(); @@ -34,7 +34,7 @@ pub fn check() { pub mod fn_calls_methods_in_another_impl { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn check() { let mut x = Point { x: 2.0, y: 2.0 }; x.translate(3.0, 3.0); @@ -45,7 +45,7 @@ pub fn check() { pub mod fn_make_struct { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn make_origin() -> Point { Point { x: 2.0, y: 2.0 } } @@ -55,7 +55,7 @@ pub fn make_origin() -> Point { pub mod fn_read_field { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn get_x(p: Point) -> f32 { p.x } @@ -65,7 +65,7 @@ pub fn get_x(p: Point) -> f32 { pub mod fn_write_field { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn inc_x(p: &mut Point) { p.x += 1.0; } diff --git a/tests/incremental/change_private_impl_method/struct_point.rs b/tests/incremental/change_private_impl_method/struct_point.rs index f2c870141963..a5ecb784c0c9 100644 --- a/tests/incremental/change_private_impl_method/struct_point.rs +++ b/tests/incremental/change_private_impl_method/struct_point.rs @@ -1,22 +1,21 @@ // Test where we change the body of a private method in an impl. // We then test what sort of functions must be rebuilt as a result. -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 //@ compile-flags: -Z query-dep-graph -//@ build-pass //@ ignore-backends: gcc #![feature(rustc_attrs)] #![allow(dead_code)] #![crate_type = "rlib"] -#![rustc_partition_codegened(module="struct_point-point", cfg="bfail2")] +#![rustc_partition_codegened(module="struct_point-point", cfg="bpass2")] -#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="bfail2")] +#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="bpass2")] pub mod point { pub struct Point { @@ -26,10 +25,10 @@ pub struct Point { impl Point { pub fn distance_squared(&self) -> f32 { - #[cfg(bfail1)] + #[cfg(bpass1)] return self.x + self.y; - #[cfg(bfail2)] + #[cfg(bpass2)] return self.x * self.x + self.y * self.y; } @@ -51,7 +50,7 @@ pub fn translate(&mut self, x: f32, y: f32) { pub mod fn_calls_methods_in_same_impl { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn check() { let x = Point { x: 2.0, y: 2.0 }; x.distance_from_origin(); @@ -62,7 +61,7 @@ pub fn check() { pub mod fn_calls_methods_in_another_impl { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn check() { let mut x = Point { x: 2.0, y: 2.0 }; x.translate(3.0, 3.0); @@ -73,7 +72,7 @@ pub fn check() { pub mod fn_make_struct { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn make_origin() -> Point { Point { x: 2.0, y: 2.0 } } @@ -83,7 +82,7 @@ pub fn make_origin() -> Point { pub mod fn_read_field { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn get_x(p: Point) -> f32 { p.x } @@ -93,7 +92,7 @@ pub fn get_x(p: Point) -> f32 { pub mod fn_write_field { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn inc_x(p: &mut Point) { p.x += 1.0; } diff --git a/tests/incremental/change_private_impl_method_cc/auxiliary/point.rs b/tests/incremental/change_private_impl_method_cc/auxiliary/point.rs index eb1f654ab020..f046143eb3db 100644 --- a/tests/incremental/change_private_impl_method_cc/auxiliary/point.rs +++ b/tests/incremental/change_private_impl_method_cc/auxiliary/point.rs @@ -5,10 +5,10 @@ pub struct Point { impl Point { fn distance_squared(&self) -> f32 { - #[cfg(bfail1)] + #[cfg(bpass1)] return self.x + self.y; - #[cfg(bfail2)] + #[cfg(bpass2)] return self.x * self.x + self.y * self.y; } diff --git a/tests/incremental/change_private_impl_method_cc/struct_point.rs b/tests/incremental/change_private_impl_method_cc/struct_point.rs index 53bb6e90beb2..3c54ce70f803 100644 --- a/tests/incremental/change_private_impl_method_cc/struct_point.rs +++ b/tests/incremental/change_private_impl_method_cc/struct_point.rs @@ -1,22 +1,22 @@ // Test where we change the body of a private method in an impl. // We then test what sort of functions must be rebuilt as a result. -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 //@ compile-flags: -Z query-dep-graph //@ aux-build:point.rs -//@ build-pass (FIXME(62277): could be check-pass?) //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![crate_type = "rlib"] #![feature(rustc_attrs)] #![allow(dead_code)] -#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="bfail2")] +#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="bpass2")] -#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="bfail2")] +#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_same_impl", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_calls_methods_in_another_impl", cfg="bpass2")] extern crate point; @@ -24,7 +24,7 @@ pub mod fn_calls_methods_in_same_impl { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn check() { let x = Point { x: 2.0, y: 2.0 }; x.distance_from_origin(); @@ -35,7 +35,7 @@ pub fn check() { pub mod fn_calls_methods_in_another_impl { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn dirty() { let mut x = Point { x: 2.0, y: 2.0 }; x.translate(3.0, 3.0); @@ -46,7 +46,7 @@ pub fn dirty() { pub mod fn_make_struct { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn make_origin() -> Point { Point { x: 2.0, y: 2.0 } } @@ -56,7 +56,7 @@ pub fn make_origin() -> Point { pub mod fn_read_field { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn get_x(p: Point) -> f32 { p.x } @@ -66,7 +66,7 @@ pub fn get_x(p: Point) -> f32 { pub mod fn_write_field { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn inc_x(p: &mut Point) { p.x += 1.0; } diff --git a/tests/incremental/change_pub_inherent_method_body/struct_point.rs b/tests/incremental/change_pub_inherent_method_body/struct_point.rs index ef1c95a1e77f..0538dae2d4ed 100644 --- a/tests/incremental/change_pub_inherent_method_body/struct_point.rs +++ b/tests/incremental/change_pub_inherent_method_body/struct_point.rs @@ -1,21 +1,20 @@ // Test where we change the body of a public, inherent method. -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 //@ compile-flags: -Z query-dep-graph -//@ build-pass //@ ignore-backends: gcc #![crate_type = "rlib"] #![feature(rustc_attrs)] #![allow(dead_code)] -#![rustc_partition_codegened(module="struct_point-point", cfg="bfail2")] +#![rustc_partition_codegened(module="struct_point-point", cfg="bpass2")] -#![rustc_partition_reused(module="struct_point-fn_calls_changed_method", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_calls_another_method", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="bfail2")] +#![rustc_partition_reused(module="struct_point-fn_calls_changed_method", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_calls_another_method", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="bpass2")] pub mod point { pub struct Point { @@ -25,10 +24,10 @@ pub struct Point { impl Point { pub fn distance_from_origin(&self) -> f32 { - #[cfg(bfail1)] + #[cfg(bpass1)] return self.x * self.x + self.y * self.y; - #[cfg(bfail2)] + #[cfg(bpass2)] return (self.x * self.x + self.y * self.y).sqrt(); } @@ -42,7 +41,7 @@ pub fn x(&self) -> f32 { pub mod fn_calls_changed_method { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn check() { let p = Point { x: 2.0, y: 2.0 }; p.distance_from_origin(); @@ -53,7 +52,7 @@ pub fn check() { pub mod fn_calls_another_method { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn check() { let p = Point { x: 2.0, y: 2.0 }; p.x(); @@ -64,7 +63,7 @@ pub fn check() { pub mod fn_make_struct { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn make_origin() -> Point { Point { x: 2.0, y: 2.0 } } @@ -74,7 +73,7 @@ pub fn make_origin() -> Point { pub mod fn_read_field { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn get_x(p: Point) -> f32 { p.x } @@ -84,7 +83,7 @@ pub fn get_x(p: Point) -> f32 { pub mod fn_write_field { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn inc_x(p: &mut Point) { p.x += 1.0; } diff --git a/tests/incremental/change_pub_inherent_method_sig/struct_point.rs b/tests/incremental/change_pub_inherent_method_sig/struct_point.rs index 41da1f401878..5b4bb2ee4c76 100644 --- a/tests/incremental/change_pub_inherent_method_sig/struct_point.rs +++ b/tests/incremental/change_pub_inherent_method_sig/struct_point.rs @@ -1,8 +1,7 @@ // Test where we change the *signature* of a public, inherent method. -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 //@ compile-flags: -Z query-dep-graph -//@ build-pass //@ ignore-backends: gcc #![crate_type = "rlib"] @@ -10,13 +9,13 @@ #![allow(dead_code)] // These are expected to require codegen. -#![rustc_partition_codegened(module="struct_point-point", cfg="bfail2")] -#![rustc_partition_codegened(module="struct_point-fn_calls_changed_method", cfg="bfail2")] +#![rustc_partition_codegened(module="struct_point-point", cfg="bpass2")] +#![rustc_partition_codegened(module="struct_point-fn_calls_changed_method", cfg="bpass2")] -#![rustc_partition_reused(module="struct_point-fn_calls_another_method", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="bfail2")] -#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="bfail2")] +#![rustc_partition_reused(module="struct_point-fn_calls_another_method", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_make_struct", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_read_field", cfg="bpass2")] +#![rustc_partition_reused(module="struct_point-fn_write_field", cfg="bpass2")] pub mod point { pub struct Point { @@ -25,7 +24,7 @@ pub struct Point { } impl Point { - #[cfg(bfail1)] + #[cfg(bpass1)] pub fn distance_from_point(&self, p: Option) -> f32 { let p = p.unwrap_or(Point { x: 0.0, y: 0.0 }); let x_diff = self.x - p.x; @@ -33,7 +32,7 @@ pub fn distance_from_point(&self, p: Option) -> f32 { return x_diff * x_diff + y_diff * y_diff; } - #[cfg(bfail2)] + #[cfg(bpass2)] pub fn distance_from_point(&self, p: Option<&Point>) -> f32 { const ORIGIN: &Point = &Point { x: 0.0, y: 0.0 }; let p = p.unwrap_or(ORIGIN); @@ -52,7 +51,7 @@ pub fn x(&self) -> f32 { pub mod fn_calls_changed_method { use point::Point; - #[rustc_clean(except="typeck_root,optimized_mir", cfg="bfail2")] + #[rustc_clean(except="typeck_root,optimized_mir", cfg="bpass2")] pub fn check() { let p = Point { x: 2.0, y: 2.0 }; p.distance_from_point(None); @@ -63,7 +62,7 @@ pub fn check() { pub mod fn_calls_another_method { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn check() { let p = Point { x: 2.0, y: 2.0 }; p.x(); @@ -74,7 +73,7 @@ pub fn check() { pub mod fn_make_struct { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn make_origin() -> Point { Point { x: 2.0, y: 2.0 } } @@ -84,7 +83,7 @@ pub fn make_origin() -> Point { pub mod fn_read_field { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn get_x(p: Point) -> f32 { p.x } @@ -94,7 +93,7 @@ pub fn get_x(p: Point) -> f32 { pub mod fn_write_field { use point::Point; - #[rustc_clean(cfg="bfail2")] + #[rustc_clean(cfg="bpass2")] pub fn inc_x(p: &mut Point) { p.x += 1.0; } diff --git a/tests/incremental/hashes/call_expressions.rs b/tests/incremental/hashes/call_expressions.rs index 5ec238f5ce6c..1bf7fad2a993 100644 --- a/tests/incremental/hashes/call_expressions.rs +++ b/tests/incremental/hashes/call_expressions.rs @@ -5,14 +5,13 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc - +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -23,16 +22,16 @@ fn callee2(_x: u32, _y: i64) {} // Change Callee (Function) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_callee_function() { callee1(1, 2) } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_callee_function() { callee2(1, 2) } @@ -40,16 +39,16 @@ pub fn change_callee_function() { // Change Argument (Function) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_argument_function() { callee1(1, 2) } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_argument_function() { callee1(1, 3) } @@ -58,15 +57,15 @@ pub fn change_argument_function() { // Change Callee Indirectly (Function) mod change_callee_indirectly_function { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::callee1 as callee; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::callee2 as callee; - #[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] pub fn change_callee_indirectly_function() { callee(1, 2) } @@ -80,17 +79,17 @@ fn method2(&self, _x: char, _y: bool) {} } // Change Callee (Method) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_callee_method() { let s = Struct; s.method1('x', true); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_callee_method() { let s = Struct; s.method2('x', true); @@ -99,17 +98,17 @@ pub fn change_callee_method() { // Change Argument (Method) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_argument_method() { let s = Struct; s.method1('x', true); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_argument_method() { let s = Struct; s.method1('y', true); @@ -118,17 +117,17 @@ pub fn change_argument_method() { // Change Callee (Method, UFCS) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_ufcs_callee_method() { let s = Struct; Struct::method1(&s, 'x', true); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_ufcs_callee_method() { let s = Struct; Struct::method2(&s, 'x', true); @@ -137,17 +136,17 @@ pub fn change_ufcs_callee_method() { // Change Argument (Method, UFCS) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_argument_method_ufcs() { let s = Struct; Struct::method1(&s, 'x', true); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_argument_method_ufcs() { let s = Struct; Struct::method1(&s, 'x',false); @@ -156,17 +155,17 @@ pub fn change_argument_method_ufcs() { // Change To UFCS -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_to_ufcs() { let s = Struct; s.method1('x', true); // ------ } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] // One might think this would be expanded in the opt_hir_owner_nodes/Mir, but it actually // results in slightly different hir_owner/Mir. pub fn change_to_ufcs() { @@ -182,15 +181,15 @@ fn method1(&self, _x: char, _y: bool) {} // Change UFCS Callee Indirectly pub mod change_ufcs_callee_indirectly { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::Struct as Struct; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::Struct2 as Struct; - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass6")] pub fn change_ufcs_callee_indirectly() { let s = Struct; Struct::method1(&s, 'q', false) diff --git a/tests/incremental/hashes/closure_expressions.rs b/tests/incremental/hashes/closure_expressions.rs index 161ee81247a4..ca2f2104b5d9 100644 --- a/tests/incremental/hashes/closure_expressions.rs +++ b/tests/incremental/hashes/closure_expressions.rs @@ -5,13 +5,13 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -19,16 +19,16 @@ // Change closure body -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_closure_body() { let _ = || 1u32; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn change_closure_body() { let _ = || 3u32; } @@ -36,17 +36,17 @@ pub fn change_closure_body() { // Add parameter -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_parameter() { let x = 0u32; let _ = | | x + 1; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn add_parameter() { let x = 0u32; let _ = |x: u32| x + 1; @@ -55,16 +55,16 @@ pub fn add_parameter() { // Change parameter pattern -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_parameter_pattern() { let _ = | x : (u32,)| x; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_parameter_pattern() { let _ = |(x,): (u32,)| x; } @@ -72,16 +72,16 @@ pub fn change_parameter_pattern() { // Add `move` to closure -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_move() { let _ = || 1; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn add_move() { let _ = move || 1; } @@ -89,17 +89,17 @@ pub fn add_move() { // Add type ascription to parameter -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_type_ascription_to_parameter() { let closure = |x | x + 1u32; let _: u32 = closure(1); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2", except = "opt_hir_owner_nodes, typeck_root")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5", except = "opt_hir_owner_nodes, typeck_root")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2", except = "opt_hir_owner_nodes, typeck_root")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5", except = "opt_hir_owner_nodes, typeck_root")] +#[rustc_clean(cfg = "bpass6")] pub fn add_type_ascription_to_parameter() { let closure = |x: u32| x + 1u32; let _: u32 = closure(1); @@ -108,17 +108,17 @@ pub fn add_type_ascription_to_parameter() { // Change parameter type -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_parameter_type() { let closure = |x: u32| (x as u64) + 1; let _ = closure(1); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_parameter_type() { let closure = |x: u16| (x as u64) + 1; let _ = closure(1); diff --git a/tests/incremental/hashes/consts.rs b/tests/incremental/hashes/consts.rs index 3cf5f2945180..24cde08b932f 100644 --- a/tests/incremental/hashes/consts.rs +++ b/tests/incremental/hashes/consts.rs @@ -5,10 +5,10 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 +//@ revisions: bpass1 bpass2 bpass3 //@ compile-flags: -Z query-dep-graph -O //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -16,75 +16,75 @@ // Change const visibility -#[cfg(bfail1)] +#[cfg(bpass1)] const CONST_VISIBILITY: u8 = 0; -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] pub const CONST_VISIBILITY: u8 = 0; // Change type from i32 to u32 -#[cfg(bfail1)] +#[cfg(bpass1)] const CONST_CHANGE_TYPE_1: i32 = 0; -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] const CONST_CHANGE_TYPE_1: u32 = 0; // Change type from Option to Option -#[cfg(bfail1)] +#[cfg(bpass1)] const CONST_CHANGE_TYPE_2: Option = None; -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] const CONST_CHANGE_TYPE_2: Option = None; // Change value between simple literals -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] const CONST_CHANGE_VALUE_1: i16 = { - #[cfg(bfail1)] + #[cfg(bpass1)] { 1 } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] { 2 } }; // Change value between expressions -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] const CONST_CHANGE_VALUE_2: i16 = { - #[cfg(bfail1)] + #[cfg(bpass1)] { 1 + 1 } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] { 1 + 2 } }; -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] const CONST_CHANGE_VALUE_3: i16 = { - #[cfg(bfail1)] + #[cfg(bpass1)] { 2 + 3 } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] { 2 * 3 } }; -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] const CONST_CHANGE_VALUE_4: i16 = { - #[cfg(bfail1)] + #[cfg(bpass1)] { 1 + 2 * 3 } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] { 1 + 2 * 4 } }; @@ -94,17 +94,17 @@ struct ReferencedType2; mod const_change_type_indirectly { - #[cfg(bfail1)] + #[cfg(bpass1)] use super::ReferencedType1 as Type; - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] use super::ReferencedType2 as Type; - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] - #[rustc_clean(cfg="bfail3")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] + #[rustc_clean(cfg="bpass3")] const CONST_CHANGE_TYPE_INDIRECTLY_1: Type = Type; - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] - #[rustc_clean(cfg="bfail3")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] + #[rustc_clean(cfg="bpass3")] const CONST_CHANGE_TYPE_INDIRECTLY_2: Option = None; } diff --git a/tests/incremental/hashes/delayed_lints.rs b/tests/incremental/hashes/delayed_lints.rs index a487922494d9..46c7b5b33ac7 100644 --- a/tests/incremental/hashes/delayed_lints.rs +++ b/tests/incremental/hashes/delayed_lints.rs @@ -2,8 +2,7 @@ // Emitting these lints is delayed until after ast lowering. // This test tests that the delayed hints are correctly hashed for incremental. -//@ check-pass -//@ revisions: bfail1 bfail2 bfail3 +//@ revisions: cpass1 cpass2 cpass3 //@ compile-flags: -Z query-dep-graph -O -Zincremental-ignore-spans //@ ignore-backends: gcc #![feature(rustc_attrs)] @@ -15,13 +14,13 @@ // Between revision 1 and 2, the only thing we change is that we add "test = 2" // This will emit an extra delayed lint, but it will not change the HIR hash. // We check that even tho the HIR hash didn't change, the extra lint is emitted -#[cfg_attr(bfail1, doc(hidden))] -#[cfg_attr(not(bfail1), doc(hidden, test = 2))] -//[bfail2,bfail3]~^ WARN `#[doc(test(...)]` takes a list of attributes [invalid_doc_attributes] +#[cfg_attr(cpass1, doc(hidden))] +#[cfg_attr(not(cpass1), doc(hidden, test = 2))] +//[cpass2,cpass3]~^ WARN `#[doc(test(...)]` takes a list of attributes [invalid_doc_attributes] // The HIR hash should not change between revisions, for this test to be representative -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] +#[rustc_clean(cfg="cpass2")] +#[rustc_clean(cfg="cpass3")] trait Test {} fn main() {} diff --git a/tests/incremental/hashes/enum_constructors.rs b/tests/incremental/hashes/enum_constructors.rs index 9c83c983ce71..6f63284a9062 100644 --- a/tests/incremental/hashes/enum_constructors.rs +++ b/tests/incremental/hashes/enum_constructors.rs @@ -5,13 +5,13 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -28,7 +28,7 @@ pub enum Enum { } // Change field value (struct-like) ----------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_field_value_struct_like() -> Enum { Enum::Struct { x: 0, @@ -37,11 +37,11 @@ pub fn change_field_value_struct_like() -> Enum { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_field_value_struct_like() -> Enum { Enum::Struct { x: 0, @@ -53,7 +53,7 @@ pub fn change_field_value_struct_like() -> Enum { // Change field order (struct-like) ----------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_field_order_struct_like() -> Enum { Enum::Struct { x: 3, @@ -62,11 +62,11 @@ pub fn change_field_order_struct_like() -> Enum { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass6")] // FIXME(michaelwoerister):Interesting. I would have thought that that changes the MIR. And it // would if it were not all constants pub fn change_field_order_struct_like() -> Enum { @@ -94,7 +94,7 @@ pub enum Enum2 { } // Change constructor path (struct-like) ------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_constructor_path_struct_like() { let _ = Enum ::Struct { x: 0, @@ -103,11 +103,11 @@ pub fn change_constructor_path_struct_like() { }; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_constructor_path_struct_like() { let _ = Enum2::Struct { x: 0, @@ -119,7 +119,7 @@ pub fn change_constructor_path_struct_like() { // Change variant (regular struct) ------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_constructor_variant_struct_like() { let _ = Enum2::Struct { x: 0, @@ -128,11 +128,11 @@ pub fn change_constructor_variant_struct_like() { }; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn change_constructor_variant_struct_like() { let _ = Enum2::Struct2 { x: 0, @@ -144,15 +144,15 @@ pub fn change_constructor_variant_struct_like() { // Change constructor path indirectly (struct-like) ------------------------- pub mod change_constructor_path_indirectly_struct_like { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::Enum as TheEnum; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::Enum2 as TheEnum; - #[rustc_clean(cfg="bfail2", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass6")] pub fn function() -> TheEnum { TheEnum::Struct { x: 0, @@ -166,15 +166,15 @@ pub fn function() -> TheEnum { // Change constructor variant indirectly (struct-like) --------------------------- pub mod change_constructor_variant_indirectly_struct_like { use super::Enum2; - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::Enum2::Struct as Variant; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::Enum2::Struct2 as Variant; - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] + #[rustc_clean(cfg="bpass6")] pub fn function() -> Enum2 { Variant { x: 0, @@ -186,16 +186,16 @@ pub fn function() -> Enum2 { // Change field value (tuple-like) ------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_field_value_tuple_like() -> Enum { Enum::Tuple(0, 1, 2) } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_field_value_tuple_like() -> Enum { Enum::Tuple(0, 1, 3) } @@ -203,22 +203,22 @@ pub fn change_field_value_tuple_like() -> Enum { // Change constructor path (tuple-like) -------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_constructor_path_tuple_like() { let _ = Enum ::Tuple(0, 1, 2); } -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] #[rustc_clean( - cfg="bfail2", + cfg="bpass2", except="opt_hir_owner_nodes,typeck_root" )] -#[rustc_clean(cfg="bfail3")] +#[rustc_clean(cfg="bpass3")] #[rustc_clean( - cfg="bfail5", + cfg="bpass5", except="opt_hir_owner_nodes,typeck_root" )] -#[rustc_clean(cfg="bfail6")] +#[rustc_clean(cfg="bpass6")] pub fn change_constructor_path_tuple_like() { let _ = Enum2::Tuple(0, 1, 2); } @@ -226,22 +226,22 @@ pub fn change_constructor_path_tuple_like() { // Change constructor variant (tuple-like) -------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_constructor_variant_tuple_like() { let _ = Enum2::Tuple (0, 1, 2); } -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] #[rustc_clean( - cfg="bfail2", + cfg="bpass2", except="opt_hir_owner_nodes,typeck_root" )] -#[rustc_clean(cfg="bfail3")] +#[rustc_clean(cfg="bpass3")] #[rustc_clean( - cfg="bfail5", + cfg="bpass5", except="opt_hir_owner_nodes,typeck_root" )] -#[rustc_clean(cfg="bfail6")] +#[rustc_clean(cfg="bpass6")] pub fn change_constructor_variant_tuple_like() { let _ = Enum2::Tuple2(0, 1, 2); } @@ -249,15 +249,15 @@ pub fn change_constructor_variant_tuple_like() { // Change constructor path indirectly (tuple-like) --------------------------- pub mod change_constructor_path_indirectly_tuple_like { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::Enum as TheEnum; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::Enum2 as TheEnum; - #[rustc_clean(cfg="bfail2", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass6")] pub fn function() -> TheEnum { TheEnum::Tuple(0, 1, 2) } @@ -268,15 +268,15 @@ pub fn function() -> TheEnum { // Change constructor variant indirectly (tuple-like) --------------------------- pub mod change_constructor_variant_indirectly_tuple_like { use super::Enum2; - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::Enum2::Tuple as Variant; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::Enum2::Tuple2 as Variant; - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass6")] pub fn function() -> Enum2 { Variant(0, 1, 2) } @@ -296,16 +296,16 @@ pub enum Clike2 { } // Change constructor path (C-like) -------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_constructor_path_c_like() { let _x = Clike ::B; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_constructor_path_c_like() { let _x = Clike2::B; } @@ -313,16 +313,16 @@ pub fn change_constructor_path_c_like() { // Change constructor variant (C-like) -------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_constructor_variant_c_like() { let _x = Clike::A; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_constructor_variant_c_like() { let _x = Clike::C; } @@ -330,15 +330,15 @@ pub fn change_constructor_variant_c_like() { // Change constructor path indirectly (C-like) --------------------------- pub mod change_constructor_path_indirectly_c_like { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::Clike as TheEnum; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::Clike2 as TheEnum; - #[rustc_clean(cfg="bfail2", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass6")] pub fn function() -> TheEnum { TheEnum::B } @@ -349,15 +349,15 @@ pub fn function() -> TheEnum { // Change constructor variant indirectly (C-like) --------------------------- pub mod change_constructor_variant_indirectly_c_like { use super::Clike; - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::Clike::A as Variant; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::Clike::B as Variant; - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] + #[rustc_clean(cfg="bpass6")] pub fn function() -> Clike { Variant } diff --git a/tests/incremental/hashes/enum_defs.rs b/tests/incremental/hashes/enum_defs.rs index 5c7c0fed0983..e6c02ee48ce4 100644 --- a/tests/incremental/hashes/enum_defs.rs +++ b/tests/incremental/hashes/enum_defs.rs @@ -10,13 +10,13 @@ // results in a change of the ICH for the enum's metadata, and that it stays // the same between rev2 and rev3. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -26,30 +26,30 @@ // Change enum visibility ----------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumVisibility { A } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub enum EnumVisibility { A } // Change name of a c-style variant ------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumChangeNameCStyleVariant { Variant1, Variant2, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumChangeNameCStyleVariant { Variant1, Variant2Changed, @@ -58,17 +58,17 @@ enum EnumChangeNameCStyleVariant { // Change name of a tuple-style variant --------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumChangeNameTupleStyleVariant { Variant1, Variant2(u32, f32), } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumChangeNameTupleStyleVariant { Variant1, Variant2Changed(u32, f32), @@ -77,17 +77,17 @@ enum EnumChangeNameTupleStyleVariant { // Change name of a struct-style variant -------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumChangeNameStructStyleVariant { Variant1, Variant2 { a: u32, b: f32 }, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumChangeNameStructStyleVariant { Variant1, Variant2Changed { a: u32, b: f32 }, @@ -96,33 +96,33 @@ enum EnumChangeNameStructStyleVariant { // Change the value of a c-style variant -------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumChangeValueCStyleVariant0 { Variant1, Variant2 = 11, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] enum EnumChangeValueCStyleVariant0 { Variant1, Variant2 = 22, } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumChangeValueCStyleVariant1 { Variant1, Variant2, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumChangeValueCStyleVariant1 { Variant1, Variant2 = 11, @@ -131,16 +131,16 @@ enum EnumChangeValueCStyleVariant1 { // Add a c-style variant ------------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumAddCStyleVariant { Variant1, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumAddCStyleVariant { Variant1, Variant2, @@ -149,17 +149,17 @@ enum EnumAddCStyleVariant { // Remove a c-style variant --------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumRemoveCStyleVariant { Variant1, Variant2, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumRemoveCStyleVariant { Variant1, } @@ -167,16 +167,16 @@ enum EnumRemoveCStyleVariant { // Add a tuple-style variant -------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumAddTupleStyleVariant { Variant1, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumAddTupleStyleVariant { Variant1, Variant2(u32, f32), @@ -185,17 +185,17 @@ enum EnumAddTupleStyleVariant { // Remove a tuple-style variant ----------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumRemoveTupleStyleVariant { Variant1, Variant2(u32, f32), } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumRemoveTupleStyleVariant { Variant1, } @@ -203,16 +203,16 @@ enum EnumRemoveTupleStyleVariant { // Add a struct-style variant ------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumAddStructStyleVariant { Variant1, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumAddStructStyleVariant { Variant1, Variant2 { a: u32, b: f32 }, @@ -221,17 +221,17 @@ enum EnumAddStructStyleVariant { // Remove a struct-style variant ---------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumRemoveStructStyleVariant { Variant1, Variant2 { a: u32, b: f32 }, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumRemoveStructStyleVariant { Variant1, } @@ -239,16 +239,16 @@ enum EnumRemoveStructStyleVariant { // Change the type of a field in a tuple-style variant ------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumChangeFieldTypeTupleStyleVariant { Variant1(u32, u32), } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] enum EnumChangeFieldTypeTupleStyleVariant { Variant1(u32, u64), @@ -257,17 +257,17 @@ enum EnumChangeFieldTypeTupleStyleVariant { // Change the type of a field in a struct-style variant ----------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumChangeFieldTypeStructStyleVariant { Variant1, Variant2 { a: u32, b: u32 }, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] enum EnumChangeFieldTypeStructStyleVariant { Variant1, Variant2 { @@ -279,16 +279,16 @@ enum EnumChangeFieldTypeStructStyleVariant { // Change the name of a field in a struct-style variant ----------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumChangeFieldNameStructStyleVariant { Variant1 { a: u32, b: u32 }, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumChangeFieldNameStructStyleVariant { Variant1 { a: u32, c: u32 }, } @@ -296,16 +296,16 @@ enum EnumChangeFieldNameStructStyleVariant { // Change order of fields in a tuple-style variant ---------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumChangeOrderTupleStyleVariant { Variant1(u32, u64), } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] enum EnumChangeOrderTupleStyleVariant { Variant1( u64, @@ -315,16 +315,16 @@ enum EnumChangeOrderTupleStyleVariant { // Change order of fields in a struct-style variant --------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumChangeFieldOrderStructStyleVariant { Variant1 { a: u32, b: f32 }, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumChangeFieldOrderStructStyleVariant { Variant1 { b: f32, a: u32 }, } @@ -332,16 +332,16 @@ enum EnumChangeFieldOrderStructStyleVariant { // Add a field to a tuple-style variant --------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumAddFieldTupleStyleVariant { Variant1(u32, u32), } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumAddFieldTupleStyleVariant { Variant1(u32, u32, u32), } @@ -349,16 +349,16 @@ enum EnumAddFieldTupleStyleVariant { // Add a field to a struct-style variant -------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumAddFieldStructStyleVariant { Variant1 { a: u32, b: u32 }, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumAddFieldStructStyleVariant { Variant1 { a: u32, b: u32, c: u32 }, } @@ -366,17 +366,17 @@ enum EnumAddFieldStructStyleVariant { // Add #[must_use] to the enum ------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumAddMustUse { Variant1, Variant2, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] #[must_use] enum EnumAddMustUse { Variant1, @@ -386,17 +386,17 @@ enum EnumAddMustUse { // Add #[repr(C)] to the enum ------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumAddReprC { Variant1, Variant2, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="type_of")] +#[rustc_clean(cfg="bpass6")] #[repr(C)] enum EnumAddReprC { Variant1, @@ -406,16 +406,16 @@ enum EnumAddReprC { // Change the name of a type parameter ---------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumChangeNameOfTypeParameter { Variant1(S), } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumChangeNameOfTypeParameter { Variant1(T), } @@ -423,17 +423,17 @@ enum EnumChangeNameOfTypeParameter { // Add a type parameter ------------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumAddTypeParameter { Variant1(S), Variant2(S), } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumAddTypeParameter { Variant1(S), Variant2(T), @@ -442,16 +442,16 @@ enum EnumAddTypeParameter { // Change the name of a lifetime parameter ------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumChangeNameOfLifetimeParameter<'a> { Variant1(&'a u32), } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,generics_of,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,generics_of,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,generics_of,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,generics_of,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumChangeNameOfLifetimeParameter<'b> { Variant1(&'b u32), } @@ -459,17 +459,17 @@ enum EnumChangeNameOfLifetimeParameter<'b> { // Add a lifetime parameter --------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumAddLifetimeParameter<'a> { Variant1(&'a u32), Variant2(&'a u32), } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,generics_of,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,generics_of,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,generics_of,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,generics_of,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumAddLifetimeParameter<'a, 'b> { Variant1(&'a u32), Variant2(&'b u32), @@ -478,34 +478,34 @@ enum EnumAddLifetimeParameter<'a, 'b> { // Add a lifetime bound to a lifetime parameter ------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumAddLifetimeParameterBound<'a, 'b> { Variant1(&'a u32), Variant2(&'b u32), } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,predicates_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,predicates_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,predicates_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,predicates_of")] +#[rustc_clean(cfg="bpass6")] enum EnumAddLifetimeParameterBound<'a, 'b: 'a> { Variant1(&'a u32), Variant2(&'b u32), } // Add a lifetime bound to a type parameter ----------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumAddLifetimeBoundToParameter<'a, T> { Variant1(T), Variant2(&'a u32), } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,predicates_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,predicates_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,predicates_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,predicates_of")] +#[rustc_clean(cfg="bpass6")] enum EnumAddLifetimeBoundToParameter<'a, T: 'a> { Variant1(T), Variant2(&'a u32), @@ -514,16 +514,16 @@ enum EnumAddLifetimeBoundToParameter<'a, T: 'a> { // Add a trait bound to a type parameter -------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumAddTraitBound { Variant1(S), } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumAddTraitBound { Variant1(T), } @@ -531,17 +531,17 @@ enum EnumAddTraitBound { // Add a lifetime bound to a lifetime parameter in where clause --------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumAddLifetimeParameterBoundWhere<'a, 'b> { Variant1(&'a u32), Variant2(&'b u32), } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,predicates_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,predicates_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,predicates_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,predicates_of")] +#[rustc_clean(cfg="bpass6")] enum EnumAddLifetimeParameterBoundWhere<'a, 'b> where 'b: 'a { Variant1(&'a u32), Variant2(&'b u32), @@ -550,17 +550,17 @@ enum EnumAddLifetimeParameterBoundWhere<'a, 'b> where 'b: 'a { // Add a lifetime bound to a type parameter in where clause ------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumAddLifetimeBoundToParameterWhere<'a, T> { Variant1(T), Variant2(&'a u32), } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,predicates_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,predicates_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,predicates_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,predicates_of")] +#[rustc_clean(cfg="bpass6")] enum EnumAddLifetimeBoundToParameterWhere<'a, T> where T: 'a { Variant1(T), Variant2(&'a u32), @@ -569,16 +569,16 @@ enum EnumAddLifetimeBoundToParameterWhere<'a, T> where T: 'a { // Add a trait bound to a type parameter in where clause ---------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumAddTraitBoundWhere { Variant1(S), } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of")] +#[rustc_clean(cfg="bpass6")] enum EnumAddTraitBoundWhere where T: Sync { Variant1(T), } @@ -586,17 +586,17 @@ enum EnumAddTraitBoundWhere where T: Sync { // In an enum with two variants, swap usage of type parameters ---------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumSwapUsageTypeParameters { Variant1 { a: A }, Variant2 { a: B }, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] enum EnumSwapUsageTypeParameters { Variant1 { a: B @@ -609,17 +609,17 @@ enum EnumSwapUsageTypeParameters { // In an enum with two variants, swap usage of lifetime parameters ------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] enum EnumSwapUsageLifetimeParameters<'a, 'b> { Variant1 { a: &'a u32 }, Variant2 { b: &'b u32 }, } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] enum EnumSwapUsageLifetimeParameters<'a, 'b> { Variant1 { a: &'b u32 @@ -638,15 +638,15 @@ enum EnumSwapUsageLifetimeParameters<'a, 'b> { // Change field type in tuple-style variant indirectly by modifying a use statement mod change_field_type_indirectly_tuple_style { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedType1 as FieldType; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedType2 as FieldType; - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] + #[rustc_clean(cfg="bpass6")] enum TupleStyle { Variant1( FieldType @@ -658,15 +658,15 @@ enum TupleStyle { // Change field type in record-style variant indirectly by modifying a use statement mod change_field_type_indirectly_struct_style { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedType1 as FieldType; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedType2 as FieldType; - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] + #[rustc_clean(cfg="bpass6")] enum StructStyle { Variant1 { a: FieldType @@ -683,15 +683,15 @@ trait ReferencedTrait2 {} // Change trait bound of type parameter indirectly by modifying a use statement mod change_trait_bound_indirectly { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedTrait1 as Trait; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedTrait2 as Trait; - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,predicates_of")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,predicates_of")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,predicates_of")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,predicates_of")] + #[rustc_clean(cfg="bpass6")] enum Enum { Variant1(T) } @@ -701,15 +701,15 @@ enum Enum { // Change trait bound of type parameter in where clause indirectly by modifying a use statement mod change_trait_bound_indirectly_where { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedTrait1 as Trait; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedTrait2 as Trait; - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,predicates_of")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,predicates_of")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,predicates_of")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,predicates_of")] + #[rustc_clean(cfg="bpass6")] enum Enum where T: Trait { Variant1(T) } diff --git a/tests/incremental/hashes/exported_vs_not.rs b/tests/incremental/hashes/exported_vs_not.rs index 9ed09a27e344..e8e2234d4f07 100644 --- a/tests/incremental/hashes/exported_vs_not.rs +++ b/tests/incremental/hashes/exported_vs_not.rs @@ -1,10 +1,10 @@ -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -14,16 +14,16 @@ // the hash of the opt_hir_owner_nodes node should change, but not the hash of // either the hir_owner or the Metadata node. -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn body_not_exported_to_metadata() -> u32 { 1 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn body_not_exported_to_metadata() -> u32 { 2 } @@ -34,17 +34,17 @@ pub fn body_not_exported_to_metadata() -> u32 { // marked as #[inline]. Only the hash of the hir_owner depnode should be // unaffected by a change to the body. -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] #[inline] pub fn body_exported_to_metadata_because_of_inline() -> u32 { 1 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] #[inline] pub fn body_exported_to_metadata_because_of_inline() -> u32 { 2 @@ -56,17 +56,17 @@ pub fn body_exported_to_metadata_because_of_inline() -> u32 { // generic. Only the hash of the hir_owner depnode should be // unaffected by a change to the body. -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] #[inline] pub fn body_exported_to_metadata_because_of_generic() -> u32 { 1 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] #[inline] pub fn body_exported_to_metadata_because_of_generic() -> u32 { 2 diff --git a/tests/incremental/hashes/extern_mods.rs b/tests/incremental/hashes/extern_mods.rs index bfa7f8f1ce37..7c5ad564652f 100644 --- a/tests/incremental/hashes/extern_mods.rs +++ b/tests/incremental/hashes/extern_mods.rs @@ -5,13 +5,13 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -19,168 +19,168 @@ #![crate_type = "rlib"] // Change function name -------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] extern "C" { pub fn change_function_name1(c: i64) -> i32; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2", except = "opt_hir_owner_nodes")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5", except = "opt_hir_owner_nodes")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2", except = "opt_hir_owner_nodes")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5", except = "opt_hir_owner_nodes")] +#[rustc_clean(cfg = "bpass6")] extern "C" { pub fn change_function_name2(c: i64) -> i32; } // Change parameter name ------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] extern "C" { pub fn change_parameter_name(c: i64) -> i32; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5")] +#[rustc_clean(cfg = "bpass6")] extern "C" { pub fn change_parameter_name(d: i64) -> i32; } // Change parameter type ------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] extern "C" { pub fn change_parameter_type(c: i64) -> i32; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5")] +#[rustc_clean(cfg = "bpass6")] extern "C" { pub fn change_parameter_type(c: i32) -> i32; } // Change return type ---------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] extern "C" { pub fn change_return_type(c: i32) -> i32; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5")] +#[rustc_clean(cfg = "bpass6")] extern "C" { pub fn change_return_type(c: i32) -> i8 ; } // Add parameter --------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] extern "C" { pub fn add_parameter(c: i32 ) -> i32; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5")] +#[rustc_clean(cfg = "bpass6")] extern "C" { pub fn add_parameter(c: i32, d: i32) -> i32; } // Add return type ------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] extern "C" { pub fn add_return_type(c: i32) ; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5")] +#[rustc_clean(cfg = "bpass6")] extern "C" { pub fn add_return_type(c: i32) -> i32; } // Make function variadic ------------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] extern "C" { pub fn make_function_variadic(c: i32 ); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5")] +#[rustc_clean(cfg = "bpass6")] extern "C" { pub fn make_function_variadic(c: i32, ...); } // Change calling convention --------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] extern "C" { pub fn change_calling_convention(c: (i32,)); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2", except = "opt_hir_owner_nodes")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5", except = "opt_hir_owner_nodes")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2", except = "opt_hir_owner_nodes")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5", except = "opt_hir_owner_nodes")] +#[rustc_clean(cfg = "bpass6")] extern "rust-call" { pub fn change_calling_convention(c: (i32,)); } // Make function public -------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] extern "C" { fn make_function_public(c: i32); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5")] +#[rustc_clean(cfg = "bpass6")] extern "C" { pub fn make_function_public(c: i32); } // Add function ---------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] extern "C" { pub fn add_function1(c: i32); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2", except = "opt_hir_owner_nodes")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5", except = "opt_hir_owner_nodes")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2", except = "opt_hir_owner_nodes")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5", except = "opt_hir_owner_nodes")] +#[rustc_clean(cfg = "bpass6")] extern "C" { pub fn add_function1(c: i32); pub fn add_function2(); } // Change link-name ------------------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] #[link(name = "foo")] extern "C" { pub fn change_link_name(c: i32); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5")] +#[rustc_clean(cfg = "bpass6")] #[link(name = "bar")] extern "C" { pub fn change_link_name(c: i32); @@ -191,15 +191,15 @@ // Indirectly change parameter type -------------------------------------------- mod indirectly_change_parameter_type { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::c_i32 as c_int; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::c_i64 as c_int; - #[rustc_clean(cfg = "bfail2")] - #[rustc_clean(cfg = "bfail3")] - #[rustc_clean(cfg = "bfail5")] - #[rustc_clean(cfg = "bfail6")] + #[rustc_clean(cfg = "bpass2")] + #[rustc_clean(cfg = "bpass3")] + #[rustc_clean(cfg = "bpass5")] + #[rustc_clean(cfg = "bpass6")] extern "C" { pub fn indirectly_change_parameter_type(c: c_int); } @@ -207,15 +207,15 @@ mod indirectly_change_parameter_type { // Indirectly change return type -------------------------------------------- mod indirectly_change_return_type { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::c_i32 as c_int; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::c_i64 as c_int; - #[rustc_clean(cfg = "bfail2")] - #[rustc_clean(cfg = "bfail3")] - #[rustc_clean(cfg = "bfail5")] - #[rustc_clean(cfg = "bfail6")] + #[rustc_clean(cfg = "bpass2")] + #[rustc_clean(cfg = "bpass3")] + #[rustc_clean(cfg = "bpass5")] + #[rustc_clean(cfg = "bpass6")] extern "C" { pub fn indirectly_change_return_type() -> c_int; } diff --git a/tests/incremental/hashes/for_loops.rs b/tests/incremental/hashes/for_loops.rs index efea2615067a..17d67a32ff55 100644 --- a/tests/incremental/hashes/for_loops.rs +++ b/tests/incremental/hashes/for_loops.rs @@ -5,13 +5,13 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -19,7 +19,7 @@ // Change loop body ------------------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_loop_body() { let mut _x = 0; for _ in 0..1 { @@ -28,11 +28,11 @@ pub fn change_loop_body() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_loop_body() { let mut _x = 0; for _ in 0..1 { @@ -44,7 +44,7 @@ pub fn change_loop_body() { // Change iteration variable name ---------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_iteration_variable_name() { let mut _x = 0; for _i in 0..1 { @@ -53,11 +53,11 @@ pub fn change_iteration_variable_name() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_iteration_variable_name() { let mut _x = 0; for _a in 0..1 { @@ -69,7 +69,7 @@ pub fn change_iteration_variable_name() { // Change iteration variable pattern ------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_iteration_variable_pattern() { let mut _x = 0; for _i in &[0, 1, 2] { @@ -78,11 +78,11 @@ pub fn change_iteration_variable_pattern() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_iteration_variable_pattern() { let mut _x = 0; for &_i in &[0, 1, 2] { @@ -94,7 +94,7 @@ pub fn change_iteration_variable_pattern() { // Change iterable ------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_iterable() { let mut _x = 0; for _ in &[0, 1, 2] { @@ -103,11 +103,11 @@ pub fn change_iterable() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, promoted_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, promoted_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, promoted_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, promoted_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_iterable() { let mut _x = 0; for _ in &[0, 1, 3] { @@ -119,7 +119,7 @@ pub fn change_iterable() { // Add break ------------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_break() { let mut _x = 0; for _ in 0..1 { @@ -128,11 +128,11 @@ pub fn add_break() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn add_break() { let mut _x = 0; for _ in 0..1 { @@ -144,7 +144,7 @@ pub fn add_break() { // Add loop label -------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_loop_label() { let mut _x = 0; for _ in 0..1 { @@ -153,11 +153,11 @@ pub fn add_loop_label() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn add_loop_label() { let mut _x = 0; 'label: for _ in 0..1 { @@ -169,7 +169,7 @@ pub fn add_loop_label() { // Add loop label to break ----------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_loop_label_to_break() { let mut _x = 0; 'label: for _ in 0..1 { @@ -178,11 +178,11 @@ pub fn add_loop_label_to_break() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn add_loop_label_to_break() { let mut _x = 0; 'label: for _ in 0..1 { @@ -194,7 +194,7 @@ pub fn add_loop_label_to_break() { // Change break label ---------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_break_label() { let mut _x = 0; 'outer: for _ in 0..1 { @@ -205,11 +205,11 @@ pub fn change_break_label() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_break_label() { let mut _x = 0; 'outer: for _ in 0..1 { @@ -223,7 +223,7 @@ pub fn change_break_label() { // Add loop label to continue -------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_loop_label_to_continue() { let mut _x = 0; 'label: for _ in 0..1 { @@ -232,11 +232,11 @@ pub fn add_loop_label_to_continue() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn add_loop_label_to_continue() { let mut _x = 0; 'label: for _ in 0..1 { @@ -248,7 +248,7 @@ pub fn add_loop_label_to_continue() { // Change continue label ---------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_continue_label() { let mut _x = 0; 'outer: for _ in 0..1 { @@ -259,11 +259,11 @@ pub fn change_continue_label() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_continue_label() { let mut _x = 0; 'outer: for _ in 0..1 { @@ -277,7 +277,7 @@ pub fn change_continue_label() { // Change continue to break ---------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_continue_to_break() { let mut _x = 0; for _ in 0..1 { @@ -286,11 +286,11 @@ pub fn change_continue_to_break() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_continue_to_break() { let mut _x = 0; for _ in 0..1 { diff --git a/tests/incremental/hashes/function_interfaces.rs b/tests/incremental/hashes/function_interfaces.rs index ed21937fb7ef..87719f22b947 100644 --- a/tests/incremental/hashes/function_interfaces.rs +++ b/tests/incremental/hashes/function_interfaces.rs @@ -5,13 +5,13 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(linkage)] @@ -20,309 +20,309 @@ // Add Parameter --------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_parameter() {} -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] #[rustc_clean( - cfg = "bfail2", + cfg = "bpass2", except = "opt_hir_owner_nodes, optimized_mir, typeck_root, fn_sig" )] -#[rustc_clean(cfg = "bfail3")] +#[rustc_clean(cfg = "bpass3")] #[rustc_clean( - cfg = "bfail5", + cfg = "bpass5", except = "opt_hir_owner_nodes, optimized_mir, typeck_root, fn_sig" )] -#[rustc_clean(cfg = "bfail6")] +#[rustc_clean(cfg = "bpass6")] pub fn add_parameter(p: i32) {} // Add Return Type ------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_return_type() {} -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2", except = "opt_hir_owner_nodes")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5", except = "opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2", except = "opt_hir_owner_nodes")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5", except = "opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg = "bpass6")] pub fn add_return_type() -> () {} // Change Parameter Type ------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn type_of_parameter(p: i32) {} -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] #[rustc_clean( - cfg = "bfail2", + cfg = "bpass2", except = "opt_hir_owner_nodes, optimized_mir, typeck_root, fn_sig" )] -#[rustc_clean(cfg = "bfail3")] +#[rustc_clean(cfg = "bpass3")] #[rustc_clean( - cfg = "bfail5", + cfg = "bpass5", except = "opt_hir_owner_nodes, optimized_mir, typeck_root, fn_sig" )] -#[rustc_clean(cfg = "bfail6")] +#[rustc_clean(cfg = "bpass6")] pub fn type_of_parameter(p: i64) {} // Change Parameter Type Reference --------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn type_of_parameter_ref(p: &i32) {} -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] #[rustc_clean( - cfg = "bfail2", + cfg = "bpass2", except = "opt_hir_owner_nodes, optimized_mir, typeck_root, fn_sig" )] -#[rustc_clean(cfg = "bfail3")] +#[rustc_clean(cfg = "bpass3")] #[rustc_clean( - cfg = "bfail5", + cfg = "bpass5", except = "opt_hir_owner_nodes, optimized_mir, typeck_root, fn_sig" )] -#[rustc_clean(cfg = "bfail6")] +#[rustc_clean(cfg = "bpass6")] pub fn type_of_parameter_ref(p: &mut i32) {} // Change Parameter Order ------------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn order_of_parameters(p1: i32, p2: i64) {} -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] #[rustc_clean( - cfg = "bfail2", + cfg = "bpass2", except = "opt_hir_owner_nodes, optimized_mir, typeck_root, fn_sig" )] -#[rustc_clean(cfg = "bfail3")] +#[rustc_clean(cfg = "bpass3")] #[rustc_clean( - cfg = "bfail5", + cfg = "bpass5", except = "opt_hir_owner_nodes, optimized_mir, typeck_root, fn_sig" )] -#[rustc_clean(cfg = "bfail6")] +#[rustc_clean(cfg = "bpass6")] pub fn order_of_parameters(p2: i64, p1: i32) {} // Unsafe ---------------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn make_unsafe() {} -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] #[rustc_clean( - cfg = "bfail2", + cfg = "bpass2", except = "opt_hir_owner_nodes, typeck_root, fn_sig" )] -#[rustc_clean(cfg = "bfail3")] +#[rustc_clean(cfg = "bpass3")] #[rustc_clean( - cfg = "bfail5", + cfg = "bpass5", except = "opt_hir_owner_nodes, typeck_root, fn_sig" )] -#[rustc_clean(cfg = "bfail6")] +#[rustc_clean(cfg = "bpass6")] pub unsafe fn make_unsafe() {} // Extern ---------------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn make_extern() {} -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2", except = "opt_hir_owner_nodes, typeck_root, fn_sig")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5", except = "opt_hir_owner_nodes, typeck_root, fn_sig")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2", except = "opt_hir_owner_nodes, typeck_root, fn_sig")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5", except = "opt_hir_owner_nodes, typeck_root, fn_sig")] +#[rustc_clean(cfg = "bpass6")] pub extern "C" fn make_extern() {} // Type Parameter -------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn type_parameter () {} -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] #[rustc_clean( - cfg = "bfail2", + cfg = "bpass2", except = "opt_hir_owner_nodes, generics_of, type_of, predicates_of" )] -#[rustc_clean(cfg = "bfail3")] +#[rustc_clean(cfg = "bpass3")] #[rustc_clean( - cfg = "bfail5", + cfg = "bpass5", except = "opt_hir_owner_nodes, generics_of, type_of, predicates_of" )] -#[rustc_clean(cfg = "bfail6")] +#[rustc_clean(cfg = "bpass6")] pub fn type_parameter() {} // Lifetime Parameter ---------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn lifetime_parameter () {} -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2", except = "opt_hir_owner_nodes, generics_of,fn_sig")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5", except = "opt_hir_owner_nodes, generics_of,fn_sig")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2", except = "opt_hir_owner_nodes, generics_of,fn_sig")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5", except = "opt_hir_owner_nodes, generics_of,fn_sig")] +#[rustc_clean(cfg = "bpass6")] pub fn lifetime_parameter<'a>() {} // Trait Bound ----------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn trait_bound() {} -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2", except = "opt_hir_owner_nodes, predicates_of")] -#[rustc_clean(cfg = "bfail3")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2", except = "opt_hir_owner_nodes, predicates_of")] +#[rustc_clean(cfg = "bpass3")] pub fn trait_bound() {} // Builtin Bound --------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn builtin_bound() {} -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2", except = "opt_hir_owner_nodes, predicates_of")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5", except = "opt_hir_owner_nodes, predicates_of")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2", except = "opt_hir_owner_nodes, predicates_of")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5", except = "opt_hir_owner_nodes, predicates_of")] +#[rustc_clean(cfg = "bpass6")] pub fn builtin_bound() {} // Lifetime Bound -------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn lifetime_bound<'a, T>() {} -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] #[rustc_clean( - cfg = "bfail2", + cfg = "bpass2", except = "opt_hir_owner_nodes, generics_of, type_of, predicates_of,fn_sig" )] -#[rustc_clean(cfg = "bfail3")] +#[rustc_clean(cfg = "bpass3")] #[rustc_clean( - cfg = "bfail5", + cfg = "bpass5", except = "opt_hir_owner_nodes, generics_of, type_of, predicates_of,fn_sig,optimized_mir" )] -#[rustc_clean(cfg = "bfail6")] +#[rustc_clean(cfg = "bpass6")] pub fn lifetime_bound<'a, T: 'a>() {} // Second Trait Bound ---------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn second_trait_bound() {} -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2", except = "opt_hir_owner_nodes, predicates_of")] -#[rustc_clean(cfg = "bfail3")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2", except = "opt_hir_owner_nodes, predicates_of")] +#[rustc_clean(cfg = "bpass3")] pub fn second_trait_bound() {} // Second Builtin Bound -------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn second_builtin_bound() {} -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2", except = "opt_hir_owner_nodes")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5", except = "opt_hir_owner_nodes, predicates_of")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2", except = "opt_hir_owner_nodes")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5", except = "opt_hir_owner_nodes, predicates_of")] +#[rustc_clean(cfg = "bpass6")] pub fn second_builtin_bound() {} // Second Lifetime Bound ------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn second_lifetime_bound<'a, 'b, T: 'a >() {} -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] #[rustc_clean( - cfg = "bfail2", + cfg = "bpass2", except = "opt_hir_owner_nodes, generics_of, type_of, predicates_of,fn_sig" )] -#[rustc_clean(cfg = "bfail3")] +#[rustc_clean(cfg = "bpass3")] #[rustc_clean( - cfg = "bfail5", + cfg = "bpass5", except = "opt_hir_owner_nodes, generics_of, type_of, predicates_of,fn_sig" )] -#[rustc_clean(cfg = "bfail6")] +#[rustc_clean(cfg = "bpass6")] pub fn second_lifetime_bound<'a, 'b, T: 'a + 'b>() {} // Inline ---------------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn inline() {} -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5")] +#[rustc_clean(cfg = "bpass6")] #[inline] pub fn inline() {} // Inline Never ---------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] #[inline(always)] pub fn inline_never() {} -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5")] +#[rustc_clean(cfg = "bpass6")] #[inline(never)] pub fn inline_never() {} // No Mangle ------------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn no_mangle() {} -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5")] +#[rustc_clean(cfg = "bpass6")] #[unsafe(no_mangle)] pub fn no_mangle() {} // Linkage --------------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn linkage() {} -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5")] +#[rustc_clean(cfg = "bpass6")] #[linkage = "weak_odr"] pub fn linkage() {} // Return Impl Trait ----------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn return_impl_trait() -> i32 { 0 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2", except = "opt_hir_owner_nodes, typeck_root, fn_sig")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5", except = "opt_hir_owner_nodes, typeck_root, fn_sig, optimized_mir")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2", except = "opt_hir_owner_nodes, typeck_root, fn_sig")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5", except = "opt_hir_owner_nodes, typeck_root, fn_sig, optimized_mir")] +#[rustc_clean(cfg = "bpass6")] pub fn return_impl_trait() -> impl Clone { 0 } // Change Return Impl Trait ---------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_return_impl_trait() -> impl Clone { 0u32 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg = "bfail2", except = "opt_hir_owner_nodes")] -#[rustc_clean(cfg = "bfail3")] -#[rustc_clean(cfg = "bfail5", except = "opt_hir_owner_nodes, typeck_root")] -#[rustc_clean(cfg = "bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg = "bpass2", except = "opt_hir_owner_nodes")] +#[rustc_clean(cfg = "bpass3")] +#[rustc_clean(cfg = "bpass5", except = "opt_hir_owner_nodes, typeck_root")] +#[rustc_clean(cfg = "bpass6")] pub fn change_return_impl_trait() -> impl Copy { 0u32 } @@ -333,21 +333,21 @@ pub fn change_return_impl_trait() -> impl Copy { pub struct ReferencedType2; pub mod change_return_type_indirectly { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedType1 as ReturnType; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedType2 as ReturnType; #[rustc_clean( - cfg = "bfail2", + cfg = "bpass2", except = "opt_hir_owner_nodes, optimized_mir, typeck_root, fn_sig" )] - #[rustc_clean(cfg = "bfail3")] + #[rustc_clean(cfg = "bpass3")] #[rustc_clean( - cfg = "bfail5", + cfg = "bpass5", except = "opt_hir_owner_nodes, optimized_mir, typeck_root, fn_sig" )] - #[rustc_clean(cfg = "bfail6")] + #[rustc_clean(cfg = "bpass6")] pub fn indirect_return_type() -> ReturnType { ReturnType {} } @@ -356,21 +356,21 @@ pub fn indirect_return_type() -> ReturnType { // Change Parameter Type Indirectly -------------------------------------------- pub mod change_parameter_type_indirectly { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedType1 as ParameterType; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedType2 as ParameterType; #[rustc_clean( - cfg = "bfail2", + cfg = "bpass2", except = "opt_hir_owner_nodes, optimized_mir, typeck_root, fn_sig" )] - #[rustc_clean(cfg = "bfail3")] + #[rustc_clean(cfg = "bpass3")] #[rustc_clean( - cfg = "bfail5", + cfg = "bpass5", except = "opt_hir_owner_nodes, optimized_mir, typeck_root, fn_sig" )] - #[rustc_clean(cfg = "bfail6")] + #[rustc_clean(cfg = "bpass6")] pub fn indirect_parameter_type(p: ParameterType) {} } @@ -380,30 +380,30 @@ pub trait ReferencedTrait1 {} pub trait ReferencedTrait2 {} pub mod change_trait_bound_indirectly { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedTrait1 as Trait; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedTrait2 as Trait; - #[rustc_clean(cfg = "bfail2", except = "opt_hir_owner_nodes, predicates_of")] - #[rustc_clean(cfg = "bfail3")] - #[rustc_clean(cfg = "bfail5", except = "opt_hir_owner_nodes, predicates_of")] - #[rustc_clean(cfg = "bfail6")] + #[rustc_clean(cfg = "bpass2", except = "opt_hir_owner_nodes, predicates_of")] + #[rustc_clean(cfg = "bpass3")] + #[rustc_clean(cfg = "bpass5", except = "opt_hir_owner_nodes, predicates_of")] + #[rustc_clean(cfg = "bpass6")] pub fn indirect_trait_bound(p: T) {} } // Change Trait Bound Indirectly In Where Clause ------------------------------- pub mod change_trait_bound_indirectly_in_where_clause { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedTrait1 as Trait; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedTrait2 as Trait; - #[rustc_clean(cfg = "bfail2", except = "opt_hir_owner_nodes, predicates_of")] - #[rustc_clean(cfg = "bfail3")] - #[rustc_clean(cfg = "bfail5", except = "opt_hir_owner_nodes, predicates_of")] - #[rustc_clean(cfg = "bfail6")] + #[rustc_clean(cfg = "bpass2", except = "opt_hir_owner_nodes, predicates_of")] + #[rustc_clean(cfg = "bpass3")] + #[rustc_clean(cfg = "bpass5", except = "opt_hir_owner_nodes, predicates_of")] + #[rustc_clean(cfg = "bpass6")] pub fn indirect_trait_bound_where(p: T) where T: Trait, diff --git a/tests/incremental/hashes/if_expressions.rs b/tests/incremental/hashes/if_expressions.rs index 2c96a1c0a9b2..3f311d030d8d 100644 --- a/tests/incremental/hashes/if_expressions.rs +++ b/tests/incremental/hashes/if_expressions.rs @@ -5,20 +5,20 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] #![crate_type="rlib"] // Change condition (if) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_condition(x: bool) -> u32 { if x { return 1 @@ -27,11 +27,11 @@ pub fn change_condition(x: bool) -> u32 { return 0 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_condition(x: bool) -> u32 { if !x { return 1 @@ -41,7 +41,7 @@ pub fn change_condition(x: bool) -> u32 { } // Change then branch (if) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_then_branch(x: bool) -> u32 { if x { return 1 @@ -50,11 +50,11 @@ pub fn change_then_branch(x: bool) -> u32 { return 0 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_then_branch(x: bool) -> u32 { if x { return 2 @@ -66,7 +66,7 @@ pub fn change_then_branch(x: bool) -> u32 { // Change else branch (if) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_else_branch(x: bool) -> u32 { if x { 1 @@ -75,11 +75,11 @@ pub fn change_else_branch(x: bool) -> u32 { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_else_branch(x: bool) -> u32 { if x { 1 @@ -91,7 +91,7 @@ pub fn change_else_branch(x: bool) -> u32 { // Add else branch (if) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_else_branch(x: bool) -> u32 { let mut ret = 1; @@ -103,11 +103,11 @@ pub fn add_else_branch(x: bool) -> u32 { ret } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn add_else_branch(x: bool) -> u32 { let mut ret = 1; @@ -122,7 +122,7 @@ pub fn add_else_branch(x: bool) -> u32 { // Change condition (if let) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_condition_if_let(x: Option) -> u32 { if let Some(_x) = x { return 1 @@ -131,11 +131,11 @@ pub fn change_condition_if_let(x: Option) -> u32 { 0 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_condition_if_let(x: Option) -> u32 { if let Some(_ ) = x { return 1 @@ -147,7 +147,7 @@ pub fn change_condition_if_let(x: Option) -> u32 { // Change then branch (if let) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_then_branch_if_let(x: Option) -> u32 { if let Some(x) = x { return x //- @@ -156,11 +156,11 @@ pub fn change_then_branch_if_let(x: Option) -> u32 { 0 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_then_branch_if_let(x: Option) -> u32 { if let Some(x) = x { return x + 1 @@ -172,7 +172,7 @@ pub fn change_then_branch_if_let(x: Option) -> u32 { // Change else branch (if let) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_else_branch_if_let(x: Option) -> u32 { if let Some(x) = x { x @@ -181,11 +181,11 @@ pub fn change_else_branch_if_let(x: Option) -> u32 { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_else_branch_if_let(x: Option) -> u32 { if let Some(x) = x { x @@ -197,7 +197,7 @@ pub fn change_else_branch_if_let(x: Option) -> u32 { // Add else branch (if let) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_else_branch_if_let(x: Option) -> u32 { let mut ret = 1; @@ -209,11 +209,11 @@ pub fn add_else_branch_if_let(x: Option) -> u32 { ret } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn add_else_branch_if_let(x: Option) -> u32 { let mut ret = 1; diff --git a/tests/incremental/hashes/indexing_expressions.rs b/tests/incremental/hashes/indexing_expressions.rs index 17e2f58acae1..b020419775cb 100644 --- a/tests/incremental/hashes/indexing_expressions.rs +++ b/tests/incremental/hashes/indexing_expressions.rs @@ -5,29 +5,29 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] #![crate_type="rlib"] // Change simple index -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] fn change_simple_index(slice: &[u32]) -> u32 { slice[3] } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] fn change_simple_index(slice: &[u32]) -> u32 { slice[4] } @@ -35,16 +35,16 @@ fn change_simple_index(slice: &[u32]) -> u32 { // Change lower bound -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] fn change_lower_bound(slice: &[u32]) -> &[u32] { &slice[3..5] } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] fn change_lower_bound(slice: &[u32]) -> &[u32] { &slice[2..5] } @@ -52,16 +52,16 @@ fn change_lower_bound(slice: &[u32]) -> &[u32] { // Change upper bound -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] fn change_upper_bound(slice: &[u32]) -> &[u32] { &slice[3..5] } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] fn change_upper_bound(slice: &[u32]) -> &[u32] { &slice[3..7] } @@ -69,16 +69,16 @@ fn change_upper_bound(slice: &[u32]) -> &[u32] { // Add lower bound -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] fn add_lower_bound(slice: &[u32]) -> &[u32] { &slice[ ..4] } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] fn add_lower_bound(slice: &[u32]) -> &[u32] { &slice[3..4] } @@ -86,16 +86,16 @@ fn add_lower_bound(slice: &[u32]) -> &[u32] { // Add upper bound -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] fn add_upper_bound(slice: &[u32]) -> &[u32] { &slice[3.. ] } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] fn add_upper_bound(slice: &[u32]) -> &[u32] { &slice[3..7] } @@ -103,16 +103,16 @@ fn add_upper_bound(slice: &[u32]) -> &[u32] { // Change mutability -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] fn change_mutability(slice: &mut [u32]) -> u32 { (&mut slice[3..5])[0] } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] fn change_mutability(slice: &mut [u32]) -> u32 { (& slice[3..5])[0] } @@ -120,16 +120,16 @@ fn change_mutability(slice: &mut [u32]) -> u32 { // Exclusive to inclusive range -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] { &slice[3.. 7] } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] { &slice[3..=7] } diff --git a/tests/incremental/hashes/inherent_impls.rs b/tests/incremental/hashes/inherent_impls.rs index d96f1d2239aa..da3fb1b2ee5f 100644 --- a/tests/incremental/hashes/inherent_impls.rs +++ b/tests/incremental/hashes/inherent_impls.rs @@ -6,14 +6,13 @@ // rev3 and make sure that the hash has not changed. //@ edition: 2024 -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc - +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -22,26 +21,26 @@ pub struct Foo; // Change Method Name ----------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { pub fn method_name() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,associated_item_def_ids")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,associated_item_def_ids")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,associated_item_def_ids")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,associated_item_def_ids")] +#[rustc_clean(cfg="bpass6")] impl Foo { - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass6")] pub fn method_name2() { } } // Change Method Body ----------------------------------------------------------- // // This should affect the method itself, but not the impl. -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { //------------------------------------------------------------------------------------------ //-------------------------- @@ -52,16 +51,16 @@ pub fn method_body() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { - #[rustc_clean(cfg="bfail2",except="opt_hir_owner_nodes,optimized_mir,promoted_mir,typeck_root")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5",except="opt_hir_owner_nodes,optimized_mir,promoted_mir,typeck_root")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2",except="opt_hir_owner_nodes,optimized_mir,promoted_mir,typeck_root")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5",except="opt_hir_owner_nodes,optimized_mir,promoted_mir,typeck_root")] + #[rustc_clean(cfg="bpass6")] pub fn method_body() { println!("Hello, world!"); } @@ -71,7 +70,7 @@ pub fn method_body() { // Change Method Body (inlined) ------------------------------------------------ // // This should affect the method itself, but not the impl. -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { //----------------------------------------------------------------------------- //-------------------------- @@ -83,16 +82,16 @@ pub fn method_body_inlined() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass6")] #[inline] pub fn method_body_inlined() { println!("Hello, world!"); @@ -101,7 +100,7 @@ pub fn method_body_inlined() { // Change Method Privacy ------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { //-------------------------- //-------------------------- @@ -110,21 +109,21 @@ impl Foo { pub fn method_privacy() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] + #[rustc_clean(cfg="bpass6")] fn method_privacy() { } } // Change Method Selfness ----------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { //------------ //--------------- @@ -139,27 +138,27 @@ impl Foo { pub fn method_selfness() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] impl Foo { #[rustc_clean( - cfg="bfail2", + cfg="bpass2", except="opt_hir_owner_nodes,fn_sig,generics_of,typeck_root,associated_item,optimized_mir", )] - #[rustc_clean(cfg="bfail3")] + #[rustc_clean(cfg="bpass3")] #[rustc_clean( - cfg="bfail5", + cfg="bpass5", except="opt_hir_owner_nodes,fn_sig,generics_of,typeck_root,associated_item,optimized_mir", )] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass6")] pub fn method_selfness(&self) { } } // Change Method Selfmutness --------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { //------------------------------------------------------------------------------------ //-------------------------- @@ -168,48 +167,48 @@ impl Foo { pub fn method_selfmutness(& self) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir")] + #[rustc_clean(cfg="bpass6")] pub fn method_selfmutness(&mut self) { } } // Add Method To Impl ---------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { pub fn add_method_to_impl1(&self) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,associated_item_def_ids")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,associated_item_def_ids")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,associated_item_def_ids")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,associated_item_def_ids")] +#[rustc_clean(cfg="bpass6")] impl Foo { - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] pub fn add_method_to_impl1(&self) { } - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass6")] pub fn add_method_to_impl2(&self) { } } // Add Method Parameter -------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { //------------------------------------------------------------------------------------ //-------------------------- @@ -218,23 +217,23 @@ impl Foo { pub fn add_method_parameter(&self ) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir")] + #[rustc_clean(cfg="bpass6")] pub fn add_method_parameter(&self, _: i32) { } } // Change Method Parameter Name ------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { //---------------------------------------------------------------------- //-------------------------- @@ -243,23 +242,23 @@ impl Foo { pub fn change_method_parameter_name(&self, a: i64) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] + #[rustc_clean(cfg="bpass6")] pub fn change_method_parameter_name(&self, b: i64) { } } // Change Method Return Type --------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { //------------------------------------------------------------------------------------ //-------------------------- @@ -268,23 +267,23 @@ impl Foo { pub fn change_method_return_type(&self) -> u16 { 0 } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,fn_sig,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,fn_sig,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,fn_sig,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,fn_sig,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass6")] pub fn change_method_return_type(&self) -> u32 { 0 } } // Make Method #[inline] ------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { //-------------------------- //-------------------------- @@ -294,16 +293,16 @@ impl Foo { pub fn make_method_inline(&self) -> u8 { 0 } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] #[inline] pub fn make_method_inline(&self) -> u8 { 0 } } @@ -311,7 +310,7 @@ pub fn make_method_inline(&self) -> u8 { 0 } // Change order of parameters ------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { //---------------------------------------------------------------------- //-------------------------- @@ -320,23 +319,23 @@ impl Foo { pub fn change_method_parameter_order(&self, a: i64, b: i64) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] + #[rustc_clean(cfg="bpass6")] pub fn change_method_parameter_order(&self, b: i64, a: i64) { } } // Make method unsafe ---------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { //---------------------------------------------------------------------- //-------------------------- @@ -345,23 +344,23 @@ impl Foo { pub fn make_method_unsafe(&self) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,fn_sig,typeck_root")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,fn_sig,typeck_root")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,fn_sig,typeck_root")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,fn_sig,typeck_root")] + #[rustc_clean(cfg="bpass6")] pub unsafe fn make_method_unsafe(&self) { } } // Make method extern ---------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { //---------------------------------------------------------------------- //-------------------------- @@ -370,23 +369,23 @@ impl Foo { pub fn make_method_extern(&self) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,fn_sig,typeck_root")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,fn_sig,typeck_root")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,fn_sig,typeck_root")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,fn_sig,typeck_root")] + #[rustc_clean(cfg="bpass6")] pub extern "C" fn make_method_extern(&self) { } } // Change method calling convention -------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { //---------------------------------------------------------------------- //-------------------------- @@ -395,23 +394,23 @@ impl Foo { pub extern "C" fn change_method_calling_convention(&self) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,fn_sig,typeck_root")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,fn_sig,typeck_root")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,fn_sig,typeck_root")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,fn_sig,typeck_root")] + #[rustc_clean(cfg="bpass6")] pub extern "system" fn change_method_calling_convention(&self) { } } // Add Lifetime Parameter to Method -------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { // ----------------------------------------------------- // --------------------------------------------------------- @@ -429,11 +428,11 @@ impl Foo { pub fn add_lifetime_parameter_to_method (&self) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { // Warning: Note that `typeck_root` are coming up clean here. // The addition or removal of lifetime parameters that don't @@ -444,17 +443,17 @@ impl Foo { // if we lower generics before the body, then the `HirId` for // things in the body will be affected. So if you start to see // `typeck_root` appear dirty, that might be the cause. -nmatsakis - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,fn_sig")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,fn_sig,generics_of")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,fn_sig")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,fn_sig,generics_of")] + #[rustc_clean(cfg="bpass6")] pub fn add_lifetime_parameter_to_method<'a>(&self) { } } // Add Type Parameter To Method ------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { // ----------------------------------------------------- // --------------------------------------------------------------- @@ -478,11 +477,11 @@ impl Foo { pub fn add_type_parameter_to_method (&self) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { // Warning: Note that `typeck_root` are coming up clean here. // The addition or removal of type parameters that don't appear in @@ -494,22 +493,22 @@ impl Foo { // body will be affected. So if you start to see `typeck_root` // appear dirty, that might be the cause. -nmatsakis #[rustc_clean( - cfg="bfail2", + cfg="bpass2", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of", )] - #[rustc_clean(cfg="bfail3")] + #[rustc_clean(cfg="bpass3")] #[rustc_clean( - cfg="bfail5", + cfg="bpass5", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of", )] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass6")] pub fn add_type_parameter_to_method(&self) { } } // Add Lifetime Bound to Lifetime Parameter of Method -------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { //------------ //--------------- @@ -524,29 +523,29 @@ impl Foo { pub fn add_lifetime_bound_to_lifetime_param_of_method<'a, 'b >(&self) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { #[rustc_clean( - cfg="bfail2", + cfg="bpass2", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of,fn_sig" )] - #[rustc_clean(cfg="bfail3")] + #[rustc_clean(cfg="bpass3")] #[rustc_clean( - cfg="bfail5", + cfg="bpass5", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of,fn_sig" )] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass6")] pub fn add_lifetime_bound_to_lifetime_param_of_method<'a, 'b: 'a>(&self) { } } // Add Lifetime Bound to Type Parameter of Method ------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { // ----------------------------------------------------- // ---------------------------------------------------------- @@ -570,11 +569,11 @@ impl Foo { pub fn add_lifetime_bound_to_type_param_of_method<'a, T >(&self) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { // Warning: Note that `typeck_root` are coming up clean here. // The addition or removal of bounds that don't appear in the @@ -586,22 +585,22 @@ impl Foo { // body will be affected. So if you start to see `typeck_root` // appear dirty, that might be the cause. -nmatsakis #[rustc_clean( - cfg="bfail2", + cfg="bpass2", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of,fn_sig" )] - #[rustc_clean(cfg="bfail3")] + #[rustc_clean(cfg="bpass3")] #[rustc_clean( - cfg="bfail5", + cfg="bpass5", except="opt_hir_owner_nodes,generics_of,predicates_of,type_of,fn_sig" )] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass6")] pub fn add_lifetime_bound_to_type_param_of_method<'a, T: 'a>(&self) { } } // Add Trait Bound to Type Parameter of Method ------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { // ----------------------------------------------------- // ---------------------------------------------------------- @@ -619,11 +618,11 @@ impl Foo { pub fn add_trait_bound_to_type_param_of_method(&self) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { // Warning: Note that `typeck_root` are coming up clean here. // The addition or removal of bounds that don't appear in the @@ -634,17 +633,17 @@ impl Foo { // generics before the body, then the `HirId` for things in the // body will be affected. So if you start to see `typeck_root` // appear dirty, that might be the cause. -nmatsakis - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,predicates_of")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,predicates_of")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,predicates_of")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,predicates_of")] + #[rustc_clean(cfg="bpass6")] pub fn add_trait_bound_to_type_param_of_method(&self) { } } // Add #[no_mangle] to Method -------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Foo { //-------------------------- //-------------------------- @@ -654,16 +653,16 @@ impl Foo { pub fn add_no_mangle_to_method(&self) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl Foo { - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] #[unsafe(no_mangle)] pub fn add_no_mangle_to_method(&self) { } } @@ -673,90 +672,90 @@ pub fn add_no_mangle_to_method(&self) { } struct Bar(T); // Add Type Parameter To Impl -------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Bar { pub fn add_type_parameter_to_impl(&self) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,generics_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,generics_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,generics_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,generics_of")] +#[rustc_clean(cfg="bpass6")] impl Bar { #[rustc_clean( - cfg="bfail2", + cfg="bpass2", except="generics_of,fn_sig,typeck_root,type_of,optimized_mir" )] - #[rustc_clean(cfg="bfail3")] + #[rustc_clean(cfg="bpass3")] #[rustc_clean( - cfg="bfail5", + cfg="bpass5", except="generics_of,fn_sig,typeck_root,type_of,optimized_mir" )] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass6")] pub fn add_type_parameter_to_impl(&self) { } } // Change Self Type of Impl ---------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Bar { pub fn change_impl_self_type(&self) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] impl Bar { - #[rustc_clean(cfg="bfail2", except="fn_sig,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="fn_sig,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="fn_sig,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="fn_sig,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass6")] pub fn change_impl_self_type(&self) { } } // Add Lifetime Bound to Impl -------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Bar { pub fn add_lifetime_bound_to_impl_parameter(&self) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] impl Bar { - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] pub fn add_lifetime_bound_to_impl_parameter(&self) { } } // Add Trait Bound to Impl Parameter ------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl Bar { pub fn add_trait_bound_to_impl_parameter(&self) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] impl Bar { - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] pub fn add_trait_bound_to_impl_parameter(&self) { } } @@ -765,12 +764,12 @@ pub fn add_trait_bound_to_impl_parameter(&self) { } pub fn instantiation_root() { Foo::method_privacy(); - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] { Bar(0u32).change_impl_self_type(); } - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] { Bar(0u64).change_impl_self_type(); } diff --git a/tests/incremental/hashes/inline_asm.rs b/tests/incremental/hashes/inline_asm.rs index 680e93021307..cfc9bccf8eca 100644 --- a/tests/incremental/hashes/inline_asm.rs +++ b/tests/incremental/hashes/inline_asm.rs @@ -5,14 +5,14 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O //@ needs-asm-support -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -21,7 +21,7 @@ use std::arch::asm; // Change template -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_template(_a: i32) -> i32 { let c: i32; @@ -33,11 +33,11 @@ pub fn change_template(_a: i32) -> i32 { c } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_template(_a: i32) -> i32 { let c: i32; @@ -52,7 +52,7 @@ pub fn change_template(_a: i32) -> i32 { // Change output -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_output(a: i32) -> i32 { let mut _out1: i32 = 0; @@ -66,11 +66,11 @@ pub fn change_output(a: i32) -> i32 { _out1 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_output(a: i32) -> i32 { let mut _out1: i32 = 0; @@ -87,7 +87,7 @@ pub fn change_output(a: i32) -> i32 { // Change input -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_input(_a: i32, _b: i32) -> i32 { let _out; @@ -100,11 +100,11 @@ pub fn change_input(_a: i32, _b: i32) -> i32 { _out } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_input(_a: i32, _b: i32) -> i32 { let _out; @@ -120,7 +120,7 @@ pub fn change_input(_a: i32, _b: i32) -> i32 { // Change input constraint -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { let _out; @@ -133,11 +133,11 @@ pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { _out } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { let _out; @@ -152,7 +152,7 @@ pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { // Change clobber -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_clobber(_a: i32) -> i32 { let _out; @@ -166,11 +166,11 @@ pub fn change_clobber(_a: i32) -> i32 { _out } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_clobber(_a: i32) -> i32 { let _out; @@ -187,7 +187,7 @@ pub fn change_clobber(_a: i32) -> i32 { // Change options -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_options(_a: i32) -> i32 { let _out; @@ -201,11 +201,11 @@ pub fn change_options(_a: i32) -> i32 { _out } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_options(_a: i32) -> i32 { let _out; diff --git a/tests/incremental/hashes/let_expressions.rs b/tests/incremental/hashes/let_expressions.rs index 4be8676c35fe..e61eaab22414 100644 --- a/tests/incremental/hashes/let_expressions.rs +++ b/tests/incremental/hashes/let_expressions.rs @@ -5,29 +5,29 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] #![crate_type="rlib"] // Change Name ----------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_name() { let _x = 2u64; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_name() { let _y = 2u64; } @@ -35,16 +35,16 @@ pub fn change_name() { // Add Type -------------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_type() { let _x = 2u32; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn add_type() { let _x: u32 = 2u32; } @@ -52,16 +52,16 @@ pub fn add_type() { // Change Type ----------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_type() { let _x: u64 = 2; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_type() { let _x: u8 = 2; } @@ -69,16 +69,16 @@ pub fn change_type() { // Change Mutability of Reference Type ----------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_mutability_of_reference_type() { let _x: & u64; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_mutability_of_reference_type() { let _x: &mut u64; } @@ -86,16 +86,16 @@ pub fn change_mutability_of_reference_type() { // Change Mutability of Slot --------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_mutability_of_slot() { let mut _x: u64 = 0; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_mutability_of_slot() { let _x: u64 = 0; } @@ -103,16 +103,16 @@ pub fn change_mutability_of_slot() { // Change Simple Binding to Pattern -------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_simple_binding_to_pattern() { let _x = (0u8, 'x'); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_simple_binding_to_pattern() { let (_a, _b) = (0u8, 'x'); } @@ -120,16 +120,16 @@ pub fn change_simple_binding_to_pattern() { // Change Name in Pattern ------------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_name_in_pattern() { let (_a, _b) = (1u8, 'y'); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_name_in_pattern() { let (_a, _c) = (1u8, 'y'); } @@ -137,16 +137,16 @@ pub fn change_name_in_pattern() { // Add `ref` in Pattern -------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_ref_in_pattern() { let ( _a, _b) = (1u8, 'y'); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn add_ref_in_pattern() { let (ref _a, _b) = (1u8, 'y'); } @@ -154,16 +154,16 @@ pub fn add_ref_in_pattern() { // Add `&` in Pattern ---------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_amp_in_pattern() { let ( _a, _b) = (&1u8, 'y'); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn add_amp_in_pattern() { let (&_a, _b) = (&1u8, 'y'); } @@ -171,16 +171,16 @@ pub fn add_amp_in_pattern() { // Change Mutability of Binding in Pattern ------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_mutability_of_binding_in_pattern() { let ( _a, _b) = (99u8, 'q'); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_mutability_of_binding_in_pattern() { let (mut _a, _b) = (99u8, 'q'); } @@ -188,16 +188,16 @@ pub fn change_mutability_of_binding_in_pattern() { // Add Initializer ------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_initializer() { let _x: i16 ; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,typeck_root,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn add_initializer() { let _x: i16 = 3i16; } @@ -205,16 +205,16 @@ pub fn add_initializer() { // Change Initializer ---------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_initializer() { let _x = 4u16; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_initializer() { let _x = 5u16; } diff --git a/tests/incremental/hashes/loop_expressions.rs b/tests/incremental/hashes/loop_expressions.rs index 5a8ab4a4bf3e..f83a3b255831 100644 --- a/tests/incremental/hashes/loop_expressions.rs +++ b/tests/incremental/hashes/loop_expressions.rs @@ -5,13 +5,13 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -19,7 +19,7 @@ // Change loop body -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_loop_body() { let mut _x = 0; loop { @@ -28,11 +28,11 @@ pub fn change_loop_body() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_loop_body() { let mut _x = 0; loop { @@ -44,7 +44,7 @@ pub fn change_loop_body() { // Add break -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_break() { let mut _x = 0; loop { @@ -53,11 +53,11 @@ pub fn add_break() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn add_break() { let mut _x = 0; loop { @@ -69,7 +69,7 @@ pub fn add_break() { // Add loop label -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_loop_label() { let mut _x = 0; /*---*/ loop { @@ -78,11 +78,11 @@ pub fn add_loop_label() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn add_loop_label() { let mut _x = 0; 'label: loop { @@ -94,7 +94,7 @@ pub fn add_loop_label() { // Add loop label to break -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_loop_label_to_break() { let mut _x = 0; 'label: loop { @@ -103,11 +103,11 @@ pub fn add_loop_label_to_break() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn add_loop_label_to_break() { let mut _x = 0; 'label: loop { @@ -119,7 +119,7 @@ pub fn add_loop_label_to_break() { // Change break label -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_break_label() { let mut _x = 0; 'outer: loop { @@ -130,11 +130,11 @@ pub fn change_break_label() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_break_label() { let mut _x = 0; 'outer: loop { @@ -148,7 +148,7 @@ pub fn change_break_label() { // Add loop label to continue -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_loop_label_to_continue() { let mut _x = 0; 'label: loop { @@ -157,11 +157,11 @@ pub fn add_loop_label_to_continue() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn add_loop_label_to_continue() { let mut _x = 0; 'label: loop { @@ -173,7 +173,7 @@ pub fn add_loop_label_to_continue() { // Change continue label -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_continue_label() { let mut _x = 0; 'outer: loop { @@ -184,11 +184,11 @@ pub fn change_continue_label() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_continue_label() { let mut _x = 0; 'outer: loop { @@ -202,7 +202,7 @@ pub fn change_continue_label() { // Change continue to break -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_continue_to_break() { let mut _x = 0; loop { @@ -211,11 +211,11 @@ pub fn change_continue_to_break() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, typeck_root, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, typeck_root, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, typeck_root, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, typeck_root, optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_continue_to_break() { let mut _x = 0; loop { diff --git a/tests/incremental/hashes/match_expressions.rs b/tests/incremental/hashes/match_expressions.rs index 425fc08ad8f7..0c176e879641 100644 --- a/tests/incremental/hashes/match_expressions.rs +++ b/tests/incremental/hashes/match_expressions.rs @@ -5,20 +5,20 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] #![crate_type="rlib"] // Add Arm --------------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_arm(x: u32) -> u32 { match x { 0 => 0, @@ -28,11 +28,11 @@ pub fn add_arm(x: u32) -> u32 { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn add_arm(x: u32) -> u32 { match x { 0 => 0, @@ -45,7 +45,7 @@ pub fn add_arm(x: u32) -> u32 { // Change Order Of Arms -------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_order_of_arms(x: u32) -> u32 { match x { 0 => 0, @@ -54,11 +54,11 @@ pub fn change_order_of_arms(x: u32) -> u32 { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_order_of_arms(x: u32) -> u32 { match x { 1 => 1, @@ -70,7 +70,7 @@ pub fn change_order_of_arms(x: u32) -> u32 { // Add Guard Clause ------------------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_guard_clause(x: u32, y: bool) -> u32 { match x { 0 => 0, @@ -79,11 +79,11 @@ pub fn add_guard_clause(x: u32, y: bool) -> u32 { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn add_guard_clause(x: u32, y: bool) -> u32 { match x { 0 => 0, @@ -95,7 +95,7 @@ pub fn add_guard_clause(x: u32, y: bool) -> u32 { // Change Guard Clause ------------------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_guard_clause(x: u32, y: bool) -> u32 { match x { 0 => 0, @@ -104,11 +104,11 @@ pub fn change_guard_clause(x: u32, y: bool) -> u32 { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_guard_clause(x: u32, y: bool) -> u32 { match x { 0 => 0, @@ -120,7 +120,7 @@ pub fn change_guard_clause(x: u32, y: bool) -> u32 { // Add @-Binding --------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_at_binding(x: u32) -> u32 { match x { 0 => 0, @@ -129,11 +129,11 @@ pub fn add_at_binding(x: u32) -> u32 { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn add_at_binding(x: u32) -> u32 { match x { 0 => 0, @@ -145,7 +145,7 @@ pub fn add_at_binding(x: u32) -> u32 { // Change Name of @-Binding ---------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_name_of_at_binding(x: u32) -> u32 { match x { 0 => 0, @@ -154,11 +154,11 @@ pub fn change_name_of_at_binding(x: u32) -> u32 { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_name_of_at_binding(x: u32) -> u32 { match x { 0 => 0, @@ -170,7 +170,7 @@ pub fn change_name_of_at_binding(x: u32) -> u32 { // Change Simple Binding To Pattern -------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_simple_name_to_pattern(x: u32) -> u32 { match (x, x & 1) { (0, 0) => 0, @@ -178,11 +178,11 @@ pub fn change_simple_name_to_pattern(x: u32) -> u32 { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_simple_name_to_pattern(x: u32) -> u32 { match (x, x & 1) { (0, 0) => 0, @@ -193,7 +193,7 @@ pub fn change_simple_name_to_pattern(x: u32) -> u32 { // Change Name In Pattern ------------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_name_in_pattern(x: u32) -> u32 { match (x, x & 1) { (a, 0) => 0, @@ -202,11 +202,11 @@ pub fn change_name_in_pattern(x: u32) -> u32 { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_name_in_pattern(x: u32) -> u32 { match (x, x & 1) { (b, 0) => 0, @@ -218,7 +218,7 @@ pub fn change_name_in_pattern(x: u32) -> u32 { // Change Mutability Of Binding In Pattern ------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_mutability_of_binding_in_pattern(x: u32) -> u32 { match (x, x & 1) { ( a, 0) => 0, @@ -226,12 +226,12 @@ pub fn change_mutability_of_binding_in_pattern(x: u32) -> u32 { } } -// Ignore optimized_mir in bfail2, the only change to optimized MIR is a span. -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +// Ignore optimized_mir in bpass2, the only change to optimized MIR is a span. +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_mutability_of_binding_in_pattern(x: u32) -> u32 { match (x, x & 1) { (mut a, 0) => 0, @@ -242,7 +242,7 @@ pub fn change_mutability_of_binding_in_pattern(x: u32) -> u32 { // Add `ref` To Binding In Pattern ------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_ref_to_binding_in_pattern(x: u32) -> u32 { match (x, x & 1) { ( a, 0) => 0, @@ -250,11 +250,11 @@ pub fn add_ref_to_binding_in_pattern(x: u32) -> u32 { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn add_ref_to_binding_in_pattern(x: u32) -> u32 { match (x, x & 1) { (ref a, 0) => 0, @@ -265,7 +265,7 @@ pub fn add_ref_to_binding_in_pattern(x: u32) -> u32 { // Add `&` To Binding In Pattern ------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_amp_to_binding_in_pattern(x: u32) -> u32 { match (&x, x & 1) { ( a, 0) => 0, @@ -273,11 +273,11 @@ pub fn add_amp_to_binding_in_pattern(x: u32) -> u32 { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn add_amp_to_binding_in_pattern(x: u32) -> u32 { match (&x, x & 1) { (&a, 0) => 0, @@ -288,7 +288,7 @@ pub fn add_amp_to_binding_in_pattern(x: u32) -> u32 { // Change RHS Of Arm ----------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_rhs_of_arm(x: u32) -> u32 { match x { 0 => 0, @@ -297,11 +297,11 @@ pub fn change_rhs_of_arm(x: u32) -> u32 { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_rhs_of_arm(x: u32) -> u32 { match x { 0 => 0, @@ -313,7 +313,7 @@ pub fn change_rhs_of_arm(x: u32) -> u32 { // Add Alternative To Arm ------------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_alternative_to_arm(x: u32) -> u32 { match x { 0 => 0, @@ -322,11 +322,11 @@ pub fn add_alternative_to_arm(x: u32) -> u32 { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn add_alternative_to_arm(x: u32) -> u32 { match x { 0 | 7 => 0, diff --git a/tests/incremental/hashes/panic_exprs.rs b/tests/incremental/hashes/panic_exprs.rs index 992e7b352fce..5a74f5f3a744 100644 --- a/tests/incremental/hashes/panic_exprs.rs +++ b/tests/incremental/hashes/panic_exprs.rs @@ -8,10 +8,10 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 +//@ revisions: bpass1 bpass2 bpass3 //@ compile-flags: -Z query-dep-graph -C debug-assertions -O //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -19,14 +19,14 @@ // Indexing expression -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] pub fn indexing(slice: &[u8]) -> u8 { - #[cfg(bfail1)] + #[cfg(bpass1)] { slice[100] } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] { slice[100] } @@ -34,14 +34,14 @@ pub fn indexing(slice: &[u8]) -> u8 { // Arithmetic overflow plus -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] pub fn arithmetic_overflow_plus(val: i32) -> i32 { - #[cfg(bfail1)] + #[cfg(bpass1)] { val + 1 } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] { val + 1 } @@ -49,14 +49,14 @@ pub fn arithmetic_overflow_plus(val: i32) -> i32 { // Arithmetic overflow minus -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] pub fn arithmetic_overflow_minus(val: i32) -> i32 { - #[cfg(bfail1)] + #[cfg(bpass1)] { val - 1 } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] { val - 1 } @@ -64,14 +64,14 @@ pub fn arithmetic_overflow_minus(val: i32) -> i32 { // Arithmetic overflow mult -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] pub fn arithmetic_overflow_mult(val: i32) -> i32 { - #[cfg(bfail1)] + #[cfg(bpass1)] { val * 2 } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] { val * 2 } @@ -79,14 +79,14 @@ pub fn arithmetic_overflow_mult(val: i32) -> i32 { // Arithmetic overflow negation -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] pub fn arithmetic_overflow_negation(val: i32) -> i32 { - #[cfg(bfail1)] + #[cfg(bpass1)] { -val } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] { -val } @@ -94,28 +94,28 @@ pub fn arithmetic_overflow_negation(val: i32) -> i32 { // Division by zero -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] pub fn division_by_zero(val: i32) -> i32 { - #[cfg(bfail1)] + #[cfg(bpass1)] { 2 / val } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] { 2 / val } } // Division by zero -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] pub fn mod_by_zero(val: i32) -> i32 { - #[cfg(bfail1)] + #[cfg(bpass1)] { 2 % val } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] { 2 % val } @@ -123,14 +123,14 @@ pub fn mod_by_zero(val: i32) -> i32 { // shift left -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] pub fn shift_left(val: i32, shift: usize) -> i32 { - #[cfg(bfail1)] + #[cfg(bpass1)] { val << shift } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] { val << shift } @@ -138,14 +138,14 @@ pub fn shift_left(val: i32, shift: usize) -> i32 { // shift right -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] pub fn shift_right(val: i32, shift: usize) -> i32 { - #[cfg(bfail1)] + #[cfg(bpass1)] { val >> shift } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] { val >> shift } diff --git a/tests/incremental/hashes/statics.rs b/tests/incremental/hashes/statics.rs index 031bf5b5d47d..5bca02fe3aac 100644 --- a/tests/incremental/hashes/statics.rs +++ b/tests/incremental/hashes/statics.rs @@ -5,13 +5,13 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -21,140 +21,140 @@ // Change static visibility -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] static STATIC_VISIBILITY: u8 = 0; -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub static STATIC_VISIBILITY: u8 = 0; // Change static mutability -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] static STATIC_MUTABILITY: u8 = 0; -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] static mut STATIC_MUTABILITY: u8 = 0; // Add linkage attribute -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] static STATIC_LINKAGE: u8 = 0; -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] #[linkage="weak_odr"] static STATIC_LINKAGE: u8 = 0; // Add no_mangle attribute -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] static STATIC_NO_MANGLE: u8 = 0; -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] #[unsafe(no_mangle)] static STATIC_NO_MANGLE: u8 = 0; // Add thread_local attribute -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] static STATIC_THREAD_LOCAL: u8 = 0; -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] #[thread_local] static STATIC_THREAD_LOCAL: u8 = 0; // Change type from i16 to u64 -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] static STATIC_CHANGE_TYPE_1: i16 = 0; -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] static STATIC_CHANGE_TYPE_1: u64 = 0; // Change type from Option to Option -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] static STATIC_CHANGE_TYPE_2: Option = None; -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] static STATIC_CHANGE_TYPE_2: Option = None; // Change value between simple literals -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] static STATIC_CHANGE_VALUE_1: i16 = { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] { 1 } - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] { 2 } }; // Change value between expressions -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] static STATIC_CHANGE_VALUE_2: i16 = { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] { 1 + 1 } - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] { 1 + 2 } }; -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] static STATIC_CHANGE_VALUE_3: i16 = { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] { 2 + 3 } - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] { 2 * 3 } }; -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] static STATIC_CHANGE_VALUE_4: i16 = { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] { 1 + 2 * 3 } - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] { 1 + 2 * 4 } }; @@ -164,21 +164,21 @@ struct ReferencedType2; mod static_change_type_indirectly { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedType1 as Type; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedType2 as Type; - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] + #[rustc_clean(cfg="bpass6")] static STATIC_CHANGE_TYPE_INDIRECTLY_1: Type = Type; - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,type_of")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,type_of")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] + #[rustc_clean(cfg="bpass6")] static STATIC_CHANGE_TYPE_INDIRECTLY_2: Option = None; } diff --git a/tests/incremental/hashes/struct_constructors.rs b/tests/incremental/hashes/struct_constructors.rs index a4af63166903..08dd815bf6d6 100644 --- a/tests/incremental/hashes/struct_constructors.rs +++ b/tests/incremental/hashes/struct_constructors.rs @@ -5,13 +5,13 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -25,7 +25,7 @@ pub struct RegularStruct { } // Change field value (regular struct) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_field_value_regular_struct() -> RegularStruct { RegularStruct { x: 0, @@ -34,11 +34,11 @@ pub fn change_field_value_regular_struct() -> RegularStruct { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_field_value_regular_struct() -> RegularStruct { RegularStruct { x: 0, @@ -50,7 +50,7 @@ pub fn change_field_value_regular_struct() -> RegularStruct { // Change field order (regular struct) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_field_order_regular_struct() -> RegularStruct { RegularStruct { x: 3, @@ -59,11 +59,11 @@ pub fn change_field_order_regular_struct() -> RegularStruct { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_field_order_regular_struct() -> RegularStruct { RegularStruct { y: 4, @@ -75,7 +75,7 @@ pub fn change_field_order_regular_struct() -> RegularStruct { // Add field (regular struct) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_field_regular_struct() -> RegularStruct { let struct1 = RegularStruct { x: 3, @@ -90,11 +90,11 @@ pub fn add_field_regular_struct() -> RegularStruct { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn add_field_regular_struct() -> RegularStruct { let struct1 = RegularStruct { x: 3, @@ -112,7 +112,7 @@ pub fn add_field_regular_struct() -> RegularStruct { // Change field label (regular struct) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_field_label_regular_struct() -> RegularStruct { let struct1 = RegularStruct { x: 3, @@ -127,11 +127,11 @@ pub fn change_field_label_regular_struct() -> RegularStruct { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_field_label_regular_struct() -> RegularStruct { let struct1 = RegularStruct { x: 3, @@ -155,7 +155,7 @@ pub struct RegularStruct2 { } // Change constructor path (regular struct) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_constructor_path_regular_struct() { let _ = RegularStruct { x: 0, @@ -164,11 +164,11 @@ pub fn change_constructor_path_regular_struct() { }; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_constructor_path_regular_struct() { let _ = RegularStruct2 { x: 0, @@ -181,15 +181,15 @@ pub fn change_constructor_path_regular_struct() { // Change constructor path indirectly (regular struct) pub mod change_constructor_path_indirectly_regular_struct { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::RegularStruct as Struct; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::RegularStruct2 as Struct; - #[rustc_clean(cfg="bfail2", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass6")] pub fn function() -> Struct { Struct { x: 0, @@ -204,16 +204,16 @@ pub fn function() -> Struct { pub struct TupleStruct(i32, i64, i16); // Change field value (tuple struct) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_field_value_tuple_struct() -> TupleStruct { TupleStruct(0, 1, 2) } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_field_value_tuple_struct() -> TupleStruct { TupleStruct(0, 1, 3) } @@ -223,16 +223,16 @@ pub fn change_field_value_tuple_struct() -> TupleStruct { pub struct TupleStruct2(u16, u16, u16); // Change constructor path (tuple struct) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_constructor_path_tuple_struct() { let _ = TupleStruct (0, 1, 2); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn change_constructor_path_tuple_struct() { let _ = TupleStruct2(0, 1, 2); } @@ -241,15 +241,15 @@ pub fn change_constructor_path_tuple_struct() { // Change constructor path indirectly (tuple struct) pub mod change_constructor_path_indirectly_tuple_struct { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::TupleStruct as Struct; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::TupleStruct2 as Struct; - #[rustc_clean(cfg="bfail5", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail6")] - #[rustc_clean(cfg="bfail2", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] - #[rustc_clean(cfg="bfail3")] + #[rustc_clean(cfg="bpass5", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass6")] + #[rustc_clean(cfg="bpass2", except="fn_sig,opt_hir_owner_nodes,optimized_mir,typeck_root")] + #[rustc_clean(cfg="bpass3")] pub fn function() -> Struct { Struct(0, 1, 2) } diff --git a/tests/incremental/hashes/struct_defs.rs b/tests/incremental/hashes/struct_defs.rs index 52fd8bb8fcdc..00e86619338f 100644 --- a/tests/incremental/hashes/struct_defs.rs +++ b/tests/incremental/hashes/struct_defs.rs @@ -10,52 +10,52 @@ // results in a change of the ICH for the struct's metadata, and that it stays // the same between rev2 and rev3. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] #![crate_type="rlib"] // Layout ---------------------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub struct LayoutPacked; -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="type_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="type_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="type_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="type_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] #[repr(packed)] pub struct LayoutPacked; -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] struct LayoutC; -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="type_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="type_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="type_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="type_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] #[repr(C)] struct LayoutC; // Tuple Struct Change Field Type ---------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] struct TupleStructFieldType(i32); -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] // Note that changing the type of a field does not change the type of the struct or enum, but // adding/removing fields or changing a fields name or visibility does. struct TupleStructFieldType( @@ -65,14 +65,14 @@ struct TupleStructFieldType( // Tuple Struct Add Field ------------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] struct TupleStructAddField(i32); -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,type_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,type_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,type_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,type_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] struct TupleStructAddField( i32, u32 @@ -81,27 +81,27 @@ struct TupleStructAddField( // Tuple Struct Field Visibility ----------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] struct TupleStructFieldVisibility( char); -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] struct TupleStructFieldVisibility(pub char); // Record Struct Field Type ---------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] struct RecordStructFieldType { x: f32 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] // Note that changing the type of a field does not change the type of the struct or enum, but // adding/removing fields or changing a fields name or visibility does. struct RecordStructFieldType { @@ -111,27 +111,27 @@ struct RecordStructFieldType { // Record Struct Field Name ---------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] struct RecordStructFieldName { x: f32 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,type_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,type_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,type_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,type_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] struct RecordStructFieldName { y: f32 } // Record Struct Add Field ----------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] struct RecordStructAddField { x: f32 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,type_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,type_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,type_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,type_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] struct RecordStructAddField { x: f32, y: () } @@ -139,53 +139,53 @@ struct RecordStructAddField { // Record Struct Field Visibility ---------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] struct RecordStructFieldVisibility { x: f32 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="type_of")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,type_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="type_of")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,type_of")] +#[rustc_clean(cfg="bpass6")] struct RecordStructFieldVisibility { pub x: f32 } // Add Lifetime Parameter ------------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] struct AddLifetimeParameter<'a>(&'a f32, &'a f64); -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,type_of,generics_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,type_of,generics_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,type_of,generics_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,type_of,generics_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] struct AddLifetimeParameter<'a, 'b>(&'a f32, &'b f64); // Add Lifetime Parameter Bound ------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] struct AddLifetimeParameterBound<'a, 'b>(&'a f32, &'b f64); -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] struct AddLifetimeParameterBound<'a, 'b: 'a>( &'a f32, &'b f64 ); -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] struct AddLifetimeParameterBoundWhereClause<'a, 'b>(&'a f32, &'b f64); -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] struct AddLifetimeParameterBoundWhereClause<'a, 'b>( &'a f32, &'b f64) @@ -194,14 +194,14 @@ struct AddLifetimeParameterBoundWhereClause<'a, 'b>( // Add Type Parameter ---------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] struct AddTypeParameter(T1, T1); -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,type_of,generics_of,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,type_of,generics_of,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,type_of,generics_of,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,type_of,generics_of,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] struct AddTypeParameter( // The field contains the parent's Generics, so it's dirty even though its // type hasn't changed. @@ -212,27 +212,27 @@ struct AddTypeParameter( // Add Type Parameter Bound ---------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] struct AddTypeParameterBound(T); -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] struct AddTypeParameterBound( T ); -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] struct AddTypeParameterBoundWhereClause(T); -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] struct AddTypeParameterBoundWhereClause( T ) where T: Sync; @@ -243,23 +243,23 @@ struct AddTypeParameterBoundWhereClause( // fingerprint is stable (i.e., that there are no random influences like memory // addresses taken into account by the hashing algorithm). // Note: there is no #[cfg(...)], so this is ALWAYS compiled -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub struct EmptyStruct; // Visibility ------------------------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] struct Visibility; -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub struct Visibility; struct ReferencedType1; @@ -267,15 +267,15 @@ struct AddTypeParameterBoundWhereClause( // Tuple Struct Change Field Type Indirectly ----------------------------------- mod tuple_struct_change_field_type_indirectly { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedType1 as FieldType; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedType2 as FieldType; - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] struct TupleStruct( FieldType ); @@ -284,15 +284,15 @@ struct TupleStruct( // Record Struct Change Field Type Indirectly ----------------------------------- mod record_struct_change_field_type_indirectly { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedType1 as FieldType; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedType2 as FieldType; - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] struct RecordStruct { _x: FieldType } @@ -306,28 +306,28 @@ trait ReferencedTrait2 {} // Change Trait Bound Indirectly ----------------------------------------------- mod change_trait_bound_indirectly { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedTrait1 as Trait; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedTrait2 as Trait; - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] struct Struct(T); } // Change Trait Bound Indirectly In Where Clause ------------------------------- mod change_trait_bound_indirectly_in_where_clause { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedTrait1 as Trait; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedTrait2 as Trait; - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] struct Struct(T) where T : Trait; } diff --git a/tests/incremental/hashes/trait_defs.rs b/tests/incremental/hashes/trait_defs.rs index cb8df9b286b6..6fad04c9e2c6 100644 --- a/tests/incremental/hashes/trait_defs.rs +++ b/tests/incremental/hashes/trait_defs.rs @@ -10,13 +10,13 @@ // results in a change of the ICH for the trait's metadata, and that it stays // the same between rev2 and rev3. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -25,41 +25,41 @@ // Change trait visibility -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitVisibility { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,predicates_of")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,predicates_of")] +#[rustc_clean(cfg="bpass6")] pub trait TraitVisibility { } // Change trait unsafety -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitUnsafety { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] unsafe trait TraitUnsafety { } // Add method -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddMethod { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub trait TraitAddMethod { fn method(); } @@ -67,16 +67,16 @@ pub trait TraitAddMethod { // Change name of method -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitChangeMethodName { fn method(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitChangeMethodName { fn methodChanged(); } @@ -84,7 +84,7 @@ trait TraitChangeMethodName { // Add return type to method -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddReturnType { //--------------------------------------------------------------- //-------------------------- @@ -93,23 +93,23 @@ trait TraitAddReturnType { fn method() ; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddReturnType { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method() -> u32; } // Change return type of method -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitChangeReturnType { // -------------------------------------------------------------- // ------------------------- @@ -118,23 +118,23 @@ trait TraitChangeReturnType { fn method() -> u32; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitChangeReturnType { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method() -> u64; } // Add parameter to method -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddParameterToMethod { // -------------------------------------------------------------- // ------------------------- @@ -143,23 +143,23 @@ trait TraitAddParameterToMethod { fn method( ); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddParameterToMethod { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(a: u32); } // Change name of method parameter -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitChangeMethodParameterName { //------------------------------------------------------ //-------------------------------------------------------- @@ -175,30 +175,30 @@ trait TraitChangeMethodParameterName { fn with_default(x: i32) {} } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitChangeMethodParameterName { // FIXME(#38501) This should preferably always be clean. - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(b: u32); - #[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn with_default(y: i32) {} } // Change type of method parameter (i32 => i64) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitChangeMethodParameterType { // -------------------------------------------------------------- // ------------------------- @@ -207,23 +207,23 @@ trait TraitChangeMethodParameterType { fn method(a: i32); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitChangeMethodParameterType { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(a: i64); } // Change type of method parameter (&i32 => &mut i32) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitChangeMethodParameterTypeRef { // -------------------------------------------------------------- // ------------------------- @@ -232,23 +232,23 @@ trait TraitChangeMethodParameterTypeRef { fn method(a: & i32); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitChangeMethodParameterTypeRef { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(a: &mut i32); } // Change order of method parameters -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitChangeMethodParametersOrder { // -------------------------------------------------------------- // ------------------------- @@ -257,23 +257,23 @@ trait TraitChangeMethodParametersOrder { fn method(a: i32, b: i64); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitChangeMethodParametersOrder { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(b: i64, a: i32); } // Add default implementation to method -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddMethodAutoImplementation { // ------------------------------------------------------- // ------------------------- @@ -282,33 +282,33 @@ trait TraitAddMethodAutoImplementation { fn method() ; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddMethodAutoImplementation { - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method() {} } // Change order of methods -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitChangeOrderOfMethods { fn method0(); fn method1(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitChangeOrderOfMethods { fn method1(); fn method0(); @@ -317,7 +317,7 @@ trait TraitChangeOrderOfMethods { // Change mode of self parameter -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitChangeModeSelfRefToMut { // -------------------------------------------------------------- // ------------------------- @@ -326,22 +326,22 @@ trait TraitChangeModeSelfRefToMut { fn method(& self); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitChangeModeSelfRefToMut { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(&mut self); } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitChangeModeSelfOwnToMut: Sized { // ---------------------------------------------------------------------------- // ------------------------- @@ -350,22 +350,22 @@ trait TraitChangeModeSelfOwnToMut: Sized { fn method( self) {} } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitChangeModeSelfOwnToMut: Sized { - #[rustc_clean(except="opt_hir_owner_nodes,typeck_root,optimized_mir", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,typeck_root,optimized_mir", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,typeck_root,optimized_mir", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,typeck_root,optimized_mir", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(mut self) {} } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitChangeModeSelfOwnToRef { // -------------------------------------------------------------------------- // ------------------------- @@ -374,23 +374,23 @@ trait TraitChangeModeSelfOwnToRef { fn method( self); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitChangeModeSelfOwnToRef { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,generics_of", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,generics_of", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,generics_of", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,generics_of", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(&self); } // Add unsafe modifier to method -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddUnsafeModifier { // -------------------------------------------------------------- // ------------------------- @@ -399,23 +399,23 @@ trait TraitAddUnsafeModifier { fn method(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddUnsafeModifier { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] unsafe fn method(); } // Add extern modifier to method -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddExternModifier { // -------------------------------------------------------------- // ------------------------- @@ -424,23 +424,23 @@ trait TraitAddExternModifier { fn method(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddExternModifier { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] extern "C" fn method(); } // Change extern "C" to extern "stdcall" -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitChangeExternCToExternSystem { // -------------------------------------------------------------- // ------------------------- @@ -449,23 +449,23 @@ trait TraitChangeExternCToExternSystem { extern "C" fn method(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitChangeExternCToRustIntrinsic { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] extern "system" fn method(); } // Add type parameter to method -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddTypeParameterToMethod { // -------------------------------------------------------------------------- // --------------- @@ -476,25 +476,25 @@ trait TraitAddTypeParameterToMethod { fn method (); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddTypeParameterToMethod { #[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of,type_of", - cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] + cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] #[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of,type_of", - cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(); } // Add lifetime parameter to method -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddLifetimeParameterToMethod { // -------------------------------------------------------------------------- // ------------------------- @@ -503,16 +503,16 @@ trait TraitAddLifetimeParameterToMethod { fn method (); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddLifetimeParameterToMethod { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,generics_of", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,generics_of", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,generics_of", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,generics_of", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method<'a>(); } @@ -523,7 +523,7 @@ trait ReferencedTrait0 { } trait ReferencedTrait1 { } // Add trait bound to method type parameter -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddTraitBoundToMethodTypeParameter { // --------------------------------------------------------------------- // ------------------------- @@ -532,23 +532,23 @@ trait TraitAddTraitBoundToMethodTypeParameter { fn method(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddTraitBoundToMethodTypeParameter { - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(); } // Add builtin bound to method type parameter -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddBuiltinBoundToMethodTypeParameter { // --------------------------------------------------------------------- // ------------------------- @@ -557,23 +557,23 @@ trait TraitAddBuiltinBoundToMethodTypeParameter { fn method(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddBuiltinBoundToMethodTypeParameter { - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(); } // Add lifetime bound to method lifetime parameter -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddLifetimeBoundToMethodLifetimeParameter { // ----------- // ----------------------------------------------------------------------- @@ -588,29 +588,29 @@ trait TraitAddLifetimeBoundToMethodLifetimeParameter { fn method<'a, 'b >(a: &'a u32, b: &'b u32); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddLifetimeBoundToMethodLifetimeParameter { #[rustc_clean( except="opt_hir_owner_nodes,generics_of,predicates_of,fn_sig,type_of", - cfg="bfail2", + cfg="bpass2", )] - #[rustc_clean(cfg="bfail3")] + #[rustc_clean(cfg="bpass3")] #[rustc_clean( except="opt_hir_owner_nodes,generics_of,predicates_of,fn_sig,type_of", - cfg="bfail5", + cfg="bpass5", )] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass6")] fn method<'a, 'b: 'a>(a: &'a u32, b: &'b u32); } // Add second trait bound to method type parameter -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddSecondTraitBoundToMethodTypeParameter { // --------------------------------------------------------------------- // ------------------------- @@ -619,23 +619,23 @@ trait TraitAddSecondTraitBoundToMethodTypeParameter { fn method(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddSecondTraitBoundToMethodTypeParameter { - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(); } // Add second builtin bound to method type parameter -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddSecondBuiltinBoundToMethodTypeParameter { // --------------------------------------------------------------------- // ------------------------- @@ -644,23 +644,23 @@ trait TraitAddSecondBuiltinBoundToMethodTypeParameter { fn method(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddSecondBuiltinBoundToMethodTypeParameter { - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(); } // Add second lifetime bound to method lifetime parameter -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter { // ----------- // ----------------------------------------------------------------------- @@ -675,29 +675,29 @@ trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter { fn method<'a, 'b, 'c: 'a >(a: &'a u32, b: &'b u32, c: &'c u32); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter { #[rustc_clean( except="opt_hir_owner_nodes,generics_of,predicates_of,fn_sig,type_of", - cfg="bfail2", + cfg="bpass2", )] - #[rustc_clean(cfg="bfail3")] + #[rustc_clean(cfg="bpass3")] #[rustc_clean( except="opt_hir_owner_nodes,generics_of,predicates_of,fn_sig,type_of", - cfg="bfail5", + cfg="bpass5", )] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass6")] fn method<'a, 'b, 'c: 'a + 'b>(a: &'a u32, b: &'b u32, c: &'c u32); } // Add associated type -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddAssociatedType { //-------------------------- //-------------------------- @@ -710,27 +710,27 @@ trait TraitAddAssociatedType { fn method(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddAssociatedType { - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass6")] type Associated; - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(); } // Add trait bound to associated type -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddTraitBoundToAssociatedType { // ------------------------------------------------------- // ------------------------- @@ -744,16 +744,16 @@ trait TraitAddTraitBoundToAssociatedType { // Apparently the type bound contributes to the predicates of the trait, but // does not change the associated item itself. -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddTraitBoundToAssociatedType { - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] type Associated: ReferencedTrait0; fn method(); @@ -762,7 +762,7 @@ trait TraitAddTraitBoundToAssociatedType { // Add lifetime bound to associated type -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddLifetimeBoundToAssociatedType<'a> { // ------------------------------------------------------- // ------------------------- @@ -773,16 +773,16 @@ trait TraitAddLifetimeBoundToAssociatedType<'a> { fn method(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddLifetimeBoundToAssociatedType<'a> { - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] type Associated: 'a; fn method(); @@ -791,7 +791,7 @@ trait TraitAddLifetimeBoundToAssociatedType<'a> { // Add default to associated type -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddDefaultToAssociatedType { //-------------------------------------------------------- //-------------------------- @@ -802,16 +802,16 @@ trait TraitAddDefaultToAssociatedType { fn method(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddDefaultToAssociatedType { - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] type Associated = ReferenceType0; fn method(); @@ -820,16 +820,16 @@ trait TraitAddDefaultToAssociatedType { // Add associated constant -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddAssociatedConstant { fn method(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddAssociatedConstant { const Value: u32; @@ -839,7 +839,7 @@ trait TraitAddAssociatedConstant { // Add initializer to associated constant -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddInitializerToAssociatedConstant { //-------------------------------------------------------- //-------------------------- @@ -854,29 +854,29 @@ trait TraitAddInitializerToAssociatedConstant { fn method(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddInitializerToAssociatedConstant { - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] const Value: u32 = 1; - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(); } // Change type of associated constant -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitChangeTypeOfAssociatedConstant { // --------------------------------------------------------------- // ------------------------- @@ -891,287 +891,287 @@ trait TraitChangeTypeOfAssociatedConstant { fn method(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitChangeTypeOfAssociatedConstant { - #[rustc_clean(except="opt_hir_owner_nodes,type_of", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,type_of", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,type_of", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,type_of", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] const Value: f64; - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(); } // Add super trait -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddSuperTrait { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddSuperTrait : ReferencedTrait0 { } // Add builtin bound (Send or Copy) -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddBuiltiBound { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddBuiltiBound : Send { } // Add 'static lifetime bound to trait -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddStaticLifetimeBound { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddStaticLifetimeBound : 'static { } // Add super trait as second bound -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddTraitAsSecondBound : ReferencedTrait0 { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddTraitAsSecondBound : ReferencedTrait0 + ReferencedTrait1 { } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddTraitAsSecondBoundFromBuiltin : Send { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddTraitAsSecondBoundFromBuiltin : Send + ReferencedTrait0 { } // Add builtin bound as second bound -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddBuiltinBoundAsSecondBound : ReferencedTrait0 { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddBuiltinBoundAsSecondBound : ReferencedTrait0 + Send { } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin : Send { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin: Send + Copy { } // Add 'static bounds as second bound -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddStaticBoundAsSecondBound : ReferencedTrait0 { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddStaticBoundAsSecondBound : ReferencedTrait0 + 'static { } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddStaticBoundAsSecondBoundFromBuiltin : Send { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddStaticBoundAsSecondBoundFromBuiltin : Send + 'static { } // Add type parameter to trait -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddTypeParameterToTrait { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddTypeParameterToTrait { } // Add lifetime parameter to trait -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddLifetimeParameterToTrait { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddLifetimeParameterToTrait<'a> { } // Add trait bound to type parameter of trait -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddTraitBoundToTypeParameterOfTrait { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddTraitBoundToTypeParameterOfTrait { } // Add lifetime bound to type parameter of trait -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddLifetimeBoundToTypeParameterOfTrait<'a, T> { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddLifetimeBoundToTypeParameterOfTrait<'a, T: 'a> { } // Add lifetime bound to lifetime parameter of trait -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddLifetimeBoundToLifetimeParameterOfTrait<'a, 'b> { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddLifetimeBoundToLifetimeParameterOfTrait<'a: 'b, 'b> { } // Add builtin bound to type parameter of trait -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddBuiltinBoundToTypeParameterOfTrait { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddBuiltinBoundToTypeParameterOfTrait { } // Add second type parameter to trait -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddSecondTypeParameterToTrait { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddSecondTypeParameterToTrait { } // Add second lifetime parameter to trait -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddSecondLifetimeParameterToTrait<'a> { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,generics_of,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddSecondLifetimeParameterToTrait<'a, 'b> { } // Add second trait bound to type parameter of trait -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddSecondTraitBoundToTypeParameterOfTrait { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddSecondTraitBoundToTypeParameterOfTrait { } // Add second lifetime bound to type parameter of trait -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait<'a, 'b, T: 'a> { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait<'a, 'b, T: 'a + 'b> { } // Add second lifetime bound to lifetime parameter of trait -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait<'a: 'b, 'b, 'c> { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait<'a: 'b + 'c, 'b, 'c> { } // Add second builtin bound to type parameter of trait -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait { } @@ -1182,125 +1182,125 @@ struct ReferenceType1 {} // Add trait bound to type parameter of trait in where clause -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddTraitBoundToTypeParameterOfTraitWhere { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddTraitBoundToTypeParameterOfTraitWhere where T: ReferencedTrait0 { } // Add lifetime bound to type parameter of trait in where clause -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere<'a, T> { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere<'a, T> where T: 'a { } // Add lifetime bound to lifetime parameter of trait in where clause -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b> { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b> where 'a: 'b { } // Add builtin bound to type parameter of trait in where clause -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere where T: Send { } // Add second trait bound to type parameter of trait in where clause -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere where T: ReferencedTrait0 { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere where T: ReferencedTrait0 + ReferencedTrait1 { } // Add second lifetime bound to type parameter of trait in where clause -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere<'a, 'b, T> where T: 'a { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere<'a, 'b, T> where T: 'a + 'b { } // Add second lifetime bound to lifetime parameter of trait in where clause -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b, 'c> where 'a: 'b { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b, 'c> where 'a: 'b + 'c { } // Add second builtin bound to type parameter of trait in where clause -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere where T: Send { } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere where T: Send + Sync { } // Change return type of method indirectly by modifying a use statement mod change_return_type_of_method_indirectly_use { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferenceType0 as ReturnType; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferenceType1 as ReturnType; - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] trait TraitChangeReturnType { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method() -> ReturnType; } } @@ -1309,20 +1309,20 @@ trait TraitChangeReturnType { // Change type of method parameter indirectly by modifying a use statement mod change_method_parameter_type_indirectly_by_use { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferenceType0 as ArgType; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferenceType1 as ArgType; - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] trait TraitChangeArgType { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(a: ArgType); } } @@ -1331,20 +1331,20 @@ trait TraitChangeArgType { // Change trait bound of method type parameter indirectly by modifying a use statement mod change_method_parameter_type_bound_indirectly_by_use { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedTrait0 as Bound; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedTrait1 as Bound; - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] trait TraitChangeBoundOfMethodTypeParameter { - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(a: T); } } @@ -1354,20 +1354,20 @@ trait TraitChangeBoundOfMethodTypeParameter { // Change trait bound of method type parameter in where clause indirectly // by modifying a use statement mod change_method_parameter_type_bound_indirectly_by_use_where { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedTrait0 as Bound; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedTrait1 as Bound; - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] trait TraitChangeBoundOfMethodTypeParameterWhere { - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method(a: T) where T: Bound; } } @@ -1376,15 +1376,15 @@ trait TraitChangeBoundOfMethodTypeParameterWhere { // Change trait bound of trait type parameter indirectly by modifying a use statement mod change_method_type_parameter_bound_indirectly { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedTrait0 as Bound; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedTrait1 as Bound; - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] trait TraitChangeTraitBound { fn method(a: T); } @@ -1395,15 +1395,15 @@ trait TraitChangeTraitBound { // Change trait bound of trait type parameter in where clause indirectly // by modifying a use statement mod change_method_type_parameter_bound_indirectly_where { - #[cfg(any(bfail1,bfail4))] + #[cfg(any(bpass1,bpass4))] use super::ReferencedTrait0 as Bound; - #[cfg(not(any(bfail1,bfail4)))] + #[cfg(not(any(bpass1,bpass4)))] use super::ReferencedTrait1 as Bound; - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,predicates_of", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] trait TraitChangeTraitBoundWhere where T: Bound { fn method(a: T); } diff --git a/tests/incremental/hashes/trait_impls.rs b/tests/incremental/hashes/trait_impls.rs index fc3b03f6b884..4593507d281f 100644 --- a/tests/incremental/hashes/trait_impls.rs +++ b/tests/incremental/hashes/trait_impls.rs @@ -5,13 +5,13 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -22,35 +22,35 @@ // Change Method Name ----------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub trait ChangeMethodNameTrait { fn method_name(); } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl ChangeMethodNameTrait for Foo { fn method_name() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids,predicates_of", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids,predicates_of", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub trait ChangeMethodNameTrait { - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass6")] fn method_name2(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl ChangeMethodNameTrait for Foo { - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass6")] fn method_name2() { } } @@ -62,7 +62,7 @@ pub trait ChangeMethodBodyTrait { fn method_name(); } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl ChangeMethodBodyTrait for Foo { // -------------------------------------------------------------- // ------------------------- @@ -73,16 +73,16 @@ fn method_name() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl ChangeMethodBodyTrait for Foo { - #[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,typeck_root", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method_name() { () } @@ -96,7 +96,7 @@ pub trait ChangeMethodBodyTraitInlined { fn method_name(); } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl ChangeMethodBodyTraitInlined for Foo { // ---------------------------------------------------------------------------- // ------------------------- @@ -108,16 +108,16 @@ fn method_name() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl ChangeMethodBodyTraitInlined for Foo { - #[rustc_clean(except="opt_hir_owner_nodes,typeck_root,optimized_mir", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,typeck_root,optimized_mir", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,typeck_root,optimized_mir", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,typeck_root,optimized_mir", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] #[inline] fn method_name() { panic!() @@ -126,37 +126,37 @@ fn method_name() { // Change Method Selfness ------------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub trait ChangeMethodSelfnessTrait { fn method_name(); } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl ChangeMethodSelfnessTrait for Foo { fn method_name() { } } -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] pub trait ChangeMethodSelfnessTrait { fn method_name(&self); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl ChangeMethodSelfnessTrait for Foo { #[rustc_clean( except="opt_hir_owner_nodes,associated_item,generics_of,fn_sig,typeck_root,optimized_mir", - cfg="bfail2", + cfg="bpass2", )] - #[rustc_clean(cfg="bfail3")] + #[rustc_clean(cfg="bpass3")] #[rustc_clean( except="opt_hir_owner_nodes,associated_item,generics_of,fn_sig,typeck_root,optimized_mir", - cfg="bfail5", + cfg="bpass5", )] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass6")] fn method_name(&self) { () } @@ -164,48 +164,48 @@ fn method_name(&self) { // Change Method Selfness ----------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub trait RemoveMethodSelfnessTrait { fn method_name(&self); } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl RemoveMethodSelfnessTrait for Foo { fn method_name(&self) { } } -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] pub trait RemoveMethodSelfnessTrait { fn method_name(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl RemoveMethodSelfnessTrait for Foo { #[rustc_clean( except="opt_hir_owner_nodes,associated_item,generics_of,fn_sig,typeck_root,optimized_mir", - cfg="bfail2", + cfg="bpass2", )] - #[rustc_clean(cfg="bfail3")] + #[rustc_clean(cfg="bpass3")] #[rustc_clean( except="opt_hir_owner_nodes,associated_item,generics_of,fn_sig,typeck_root,optimized_mir", - cfg="bfail5", + cfg="bpass5", )] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass6")] fn method_name() {} } // Change Method Selfmutness ----------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub trait ChangeMethodSelfmutnessTrait { fn method_name(&self); } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl ChangeMethodSelfmutnessTrait for Foo { // ----------------------------------------------------------------------------------- // ------------------------- @@ -214,101 +214,101 @@ impl ChangeMethodSelfmutnessTrait for Foo { fn method_name(& self) {} } -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] pub trait ChangeMethodSelfmutnessTrait { fn method_name(&mut self); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl ChangeMethodSelfmutnessTrait for Foo { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method_name(&mut self) {} } // Change item kind ----------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub trait ChangeItemKindTrait { fn name(); } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl ChangeItemKindTrait for Foo { fn name() { } } -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] pub trait ChangeItemKindTrait { type name; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl ChangeItemKindTrait for Foo { type name = (); } // Remove item ----------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub trait RemoveItemTrait { type TypeName; fn method_name(); } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl RemoveItemTrait for Foo { type TypeName = (); fn method_name() { } } -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] pub trait RemoveItemTrait { type TypeName; } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl RemoveItemTrait for Foo { type TypeName = (); } // Add item ----------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub trait AddItemTrait { type TypeName; } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl AddItemTrait for Foo { type TypeName = (); } -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] pub trait AddItemTrait { type TypeName; fn method_name(); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,associated_item_def_ids", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl AddItemTrait for Foo { type TypeName = (); fn method_name() { } @@ -316,7 +316,7 @@ fn method_name() { } // Change has-value ----------------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub trait ChangeHasValueTrait { //-------------------------------------------------------- //-------------------------- @@ -325,29 +325,29 @@ pub trait ChangeHasValueTrait { fn method_name() ; } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl ChangeHasValueTrait for Foo { fn method_name() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub trait ChangeHasValueTrait { - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method_name() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl ChangeHasValueTrait for Foo { fn method_name() { } } @@ -358,7 +358,7 @@ pub trait AddDefaultTrait { fn method_name(); } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl AddDefaultTrait for Foo { // ------------------------------------------------------- // ------------------------- @@ -367,27 +367,27 @@ impl AddDefaultTrait for Foo { fn method_name() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl AddDefaultTrait for Foo { - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] default fn method_name() { } } // Add arguments -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub trait AddArgumentTrait { fn method_name(&self); } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl AddArgumentTrait for Foo { // ----------------------------------------------------------------------------------- // ------------------------- @@ -396,32 +396,32 @@ impl AddArgumentTrait for Foo { fn method_name(&self ) { } } -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] pub trait AddArgumentTrait { fn method_name(&self, x: u32); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl AddArgumentTrait for Foo { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method_name(&self, _x: u32) { } } // Change argument type -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub trait ChangeArgumentTypeTrait { fn method_name(&self, x: u32); } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl ChangeArgumentTypeTrait for Foo { // ----------------------------------------------------------------------------------- // ------------------------- @@ -430,21 +430,21 @@ impl ChangeArgumentTypeTrait for Foo { fn method_name(&self, _x: u32 ) { } } -#[cfg(not(any(bfail1,bfail4)))] +#[cfg(not(any(bpass1,bpass4)))] pub trait ChangeArgumentTypeTrait { fn method_name(&self, x: char); } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl ChangeArgumentTypeTrait for Foo { - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="opt_hir_owner_nodes,fn_sig,typeck_root,optimized_mir", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn method_name(&self, _x: char) { } } @@ -457,27 +457,27 @@ trait AddTypeParameterToImpl { fn id(t: T) -> T; } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl AddTypeParameterToImpl for Bar { fn id(t: u32) -> u32 { t } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,generics_of,impl_trait_header", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,generics_of,impl_trait_header", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,generics_of,impl_trait_header", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,generics_of,impl_trait_header", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl AddTypeParameterToImpl for Bar { #[rustc_clean( except="opt_hir_owner_nodes,generics_of,fn_sig,type_of,typeck_root,optimized_mir", - cfg="bfail2", + cfg="bpass2", )] - #[rustc_clean(cfg="bfail3")] + #[rustc_clean(cfg="bpass3")] #[rustc_clean( except="opt_hir_owner_nodes,generics_of,fn_sig,type_of,typeck_root,optimized_mir", - cfg="bfail5", + cfg="bpass5", )] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass6")] fn id(t: TTT) -> TTT { t } } @@ -488,21 +488,21 @@ trait ChangeSelfTypeOfImpl { fn id(self) -> Self; } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl ChangeSelfTypeOfImpl for u32 { fn id(self) -> Self { self } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,impl_trait_header", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,impl_trait_header", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,impl_trait_header", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,impl_trait_header", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl ChangeSelfTypeOfImpl for u64 { - #[rustc_clean(except="fn_sig,typeck_root,optimized_mir", cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(except="fn_sig,typeck_root,optimized_mir", cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(except="fn_sig,typeck_root,optimized_mir", cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(except="fn_sig,typeck_root,optimized_mir", cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn id(self) -> Self { self } } @@ -513,21 +513,21 @@ trait AddLifetimeBoundToImplParameter { fn id(self) -> Self; } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl AddLifetimeBoundToImplParameter for T { fn id(self) -> Self { self } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl AddLifetimeBoundToImplParameter for T { - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn id(self) -> Self { self } } @@ -538,21 +538,21 @@ trait AddTraitBoundToImplParameter { fn id(self) -> Self; } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl AddTraitBoundToImplParameter for T { fn id(self) -> Self { self } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl AddTraitBoundToImplParameter for T { - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] fn id(self) -> Self { self } } @@ -563,7 +563,7 @@ trait AddNoMangleToMethod { fn add_no_mangle_to_method(&self) { } } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl AddNoMangleToMethod for Foo { // ------------------------- // ------------------------- @@ -573,16 +573,16 @@ impl AddNoMangleToMethod for Foo { fn add_no_mangle_to_method(&self) { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl AddNoMangleToMethod for Foo { - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] #[unsafe(no_mangle)] fn add_no_mangle_to_method(&self) { } } @@ -593,7 +593,7 @@ trait MakeMethodInline { fn make_method_inline(&self) -> u8 { 0 } } -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] impl MakeMethodInline for Foo { // ------------------------- // ------------------------- @@ -603,16 +603,16 @@ impl MakeMethodInline for Foo { fn make_method_inline(&self) -> u8 { 0 } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] impl MakeMethodInline for Foo { - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] - #[rustc_clean(cfg="bfail5")] - #[rustc_clean(cfg="bfail6")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] + #[rustc_clean(cfg="bpass5")] + #[rustc_clean(cfg="bpass6")] #[inline] fn make_method_inline(&self) -> u8 { 0 } } diff --git a/tests/incremental/hashes/type_defs.rs b/tests/incremental/hashes/type_defs.rs index 7d82f3ef6cae..a4b64f8cb5ce 100644 --- a/tests/incremental/hashes/type_defs.rs +++ b/tests/incremental/hashes/type_defs.rs @@ -10,10 +10,10 @@ // results in a change of the ICH for the enum's metadata, and that it stays // the same between rev2 and rev3. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 +//@ revisions: bpass1 bpass2 bpass3 //@ compile-flags: -Z query-dep-graph -O //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -21,34 +21,34 @@ // Change type (primitive) ----------------------------------------------------- -#[cfg(bfail1)] +#[cfg(bpass1)] type ChangePrimitiveType = i32; -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] type ChangePrimitiveType = i64; // Change mutability ----------------------------------------------------------- -#[cfg(bfail1)] +#[cfg(bpass1)] type ChangeMutability = &'static i32; -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] type ChangeMutability = &'static mut i32; // Change mutability ----------------------------------------------------------- -#[cfg(bfail1)] +#[cfg(bpass1)] type ChangeLifetime<'a> = (&'static i32, &'a i32); -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] type ChangeLifetime<'a> = (&'a i32, &'a i32); @@ -57,23 +57,23 @@ struct Struct1; struct Struct2; -#[cfg(bfail1)] +#[cfg(bpass1)] type ChangeTypeStruct = Struct1; -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] type ChangeTypeStruct = Struct2; // Change type (tuple) --------------------------------------------------------- -#[cfg(bfail1)] +#[cfg(bpass1)] type ChangeTypeTuple = (u32, u64); -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] type ChangeTypeTuple = (u32, i64); @@ -88,102 +88,102 @@ enum Enum2 { Var2, } -#[cfg(bfail1)] +#[cfg(bpass1)] type ChangeTypeEnum = Enum1; -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] type ChangeTypeEnum = Enum2; // Add tuple field ------------------------------------------------------------- -#[cfg(bfail1)] +#[cfg(bpass1)] type AddTupleField = (i32, i64); -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] type AddTupleField = (i32, i64, i16); // Change nested tuple field --------------------------------------------------- -#[cfg(bfail1)] +#[cfg(bpass1)] type ChangeNestedTupleField = (i32, (i64, i16)); -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] type ChangeNestedTupleField = (i32, (i64, i8)); // Add type param -------------------------------------------------------------- -#[cfg(bfail1)] +#[cfg(bpass1)] type AddTypeParam = (T1, T1); -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] type AddTypeParam = (T1, T2); // Add type param bound -------------------------------------------------------- -#[cfg(bfail1)] +#[cfg(bpass1)] type AddTypeParamBound = (T1, u32); -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] type AddTypeParamBound = (T1, u32); // Add type param bound in where clause ---------------------------------------- -#[cfg(bfail1)] +#[cfg(bpass1)] type AddTypeParamBoundWhereClause where T1: Clone = (T1, u32); -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] type AddTypeParamBoundWhereClause where T1: Clone+Copy = (T1, u32); // Add lifetime param ---------------------------------------------------------- -#[cfg(bfail1)] +#[cfg(bpass1)] type AddLifetimeParam<'a> = (&'a u32, &'a u32); -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] type AddLifetimeParam<'a, 'b> = (&'a u32, &'b u32); // Add lifetime param bound ---------------------------------------------------- -#[cfg(bfail1)] +#[cfg(bpass1)] type AddLifetimeParamBound<'a, 'b> = (&'a u32, &'b u32); -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] type AddLifetimeParamBound<'a, 'b: 'a> = (&'a u32, &'b u32); // Add lifetime param bound in where clause ------------------------------------ -#[cfg(bfail1)] +#[cfg(bpass1)] type AddLifetimeParamBoundWhereClause<'a, 'b, 'c> where 'b: 'a = (&'a u32, &'b u32, &'c u32); -#[cfg(not(bfail1))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] +#[cfg(not(bpass1))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] type AddLifetimeParamBoundWhereClause<'a, 'b, 'c> where 'b: 'a, 'c: 'a @@ -196,13 +196,13 @@ trait ReferencedTrait1 {} trait ReferencedTrait2 {} mod change_trait_bound_indirectly { - #[cfg(bfail1)] + #[cfg(bpass1)] use super::ReferencedTrait1 as Trait; - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] use super::ReferencedTrait2 as Trait; - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] - #[rustc_clean(cfg="bfail3")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] + #[rustc_clean(cfg="bpass3")] type ChangeTraitBoundIndirectly = (T, u32); } @@ -210,12 +210,12 @@ mod change_trait_bound_indirectly { // Change Trait Bound Indirectly In Where Clause ------------------------------- mod change_trait_bound_indirectly_in_where_clause { - #[cfg(bfail1)] + #[cfg(bpass1)] use super::ReferencedTrait1 as Trait; - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] use super::ReferencedTrait2 as Trait; - #[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] - #[rustc_clean(cfg="bfail3")] + #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] + #[rustc_clean(cfg="bpass3")] type ChangeTraitBoundIndirectly where T : Trait = (T, u32); } diff --git a/tests/incremental/hashes/unary_and_binary_exprs.rs b/tests/incremental/hashes/unary_and_binary_exprs.rs index 566c5182dca0..036b5a8529a0 100644 --- a/tests/incremental/hashes/unary_and_binary_exprs.rs +++ b/tests/incremental/hashes/unary_and_binary_exprs.rs @@ -5,13 +5,13 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -19,16 +19,16 @@ // Change constant operand of negation ----------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn const_negation() -> i32 { -10 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn const_negation() -> i32 { -1 } @@ -36,16 +36,16 @@ pub fn const_negation() -> i32 { // Change constant operand of bitwise not -------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn const_bitwise_not() -> i32 { !100 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn const_bitwise_not() -> i32 { !99 } @@ -53,16 +53,16 @@ pub fn const_bitwise_not() -> i32 { // Change variable operand of negation ----------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn var_negation(x: i32, y: i32) -> i32 { -x } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn var_negation(x: i32, y: i32) -> i32 { -y } @@ -70,16 +70,16 @@ pub fn var_negation(x: i32, y: i32) -> i32 { // Change variable operand of bitwise not -------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn var_bitwise_not(x: i32, y: i32) -> i32 { !x } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn var_bitwise_not(x: i32, y: i32) -> i32 { !y } @@ -87,16 +87,16 @@ pub fn var_bitwise_not(x: i32, y: i32) -> i32 { // Change variable operand of deref -------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn var_deref(x: &i32, y: &i32) -> i32 { *x } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn var_deref(x: &i32, y: &i32) -> i32 { *y } @@ -104,16 +104,16 @@ pub fn var_deref(x: &i32, y: &i32) -> i32 { // Change first constant operand of addition ----------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn first_const_add() -> i32 { 1 + 3 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn first_const_add() -> i32 { 2 + 3 } @@ -121,16 +121,16 @@ pub fn first_const_add() -> i32 { // Change second constant operand of addition ----------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn second_const_add() -> i32 { 1 + 2 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn second_const_add() -> i32 { 1 + 3 } @@ -138,16 +138,16 @@ pub fn second_const_add() -> i32 { // Change first variable operand of addition ----------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn first_var_add(a: i32, b: i32) -> i32 { a + 2 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn first_var_add(a: i32, b: i32) -> i32 { b + 2 } @@ -155,16 +155,16 @@ pub fn first_var_add(a: i32, b: i32) -> i32 { // Change second variable operand of addition ---------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn second_var_add(a: i32, b: i32) -> i32 { 1 + a } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn second_var_add(a: i32, b: i32) -> i32 { 1 + b } @@ -172,16 +172,16 @@ pub fn second_var_add(a: i32, b: i32) -> i32 { // Change operator from + to - ------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn plus_to_minus(a: i32) -> i32 { 1 + a } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn plus_to_minus(a: i32) -> i32 { 1 - a } @@ -189,16 +189,16 @@ pub fn plus_to_minus(a: i32) -> i32 { // Change operator from + to * ------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn plus_to_mult(a: i32) -> i32 { 1 + a } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn plus_to_mult(a: i32) -> i32 { 1 * a } @@ -206,16 +206,16 @@ pub fn plus_to_mult(a: i32) -> i32 { // Change operator from + to / ------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn plus_to_div(a: i32) -> i32 { 1 + a } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn plus_to_div(a: i32) -> i32 { 1 / a } @@ -223,16 +223,16 @@ pub fn plus_to_div(a: i32) -> i32 { // Change operator from + to % ------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn plus_to_mod(a: i32) -> i32 { 1 + a } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn plus_to_mod(a: i32) -> i32 { 1 % a } @@ -240,16 +240,16 @@ pub fn plus_to_mod(a: i32) -> i32 { // Change operator from && to || ----------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn and_to_or(a: bool, b: bool) -> bool { a && b } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn and_to_or(a: bool, b: bool) -> bool { a || b } @@ -257,16 +257,16 @@ pub fn and_to_or(a: bool, b: bool) -> bool { // Change operator from & to | ------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn bitwise_and_to_bitwise_or(a: i32) -> i32 { 1 & a } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn bitwise_and_to_bitwise_or(a: i32) -> i32 { 1 | a } @@ -274,16 +274,16 @@ pub fn bitwise_and_to_bitwise_or(a: i32) -> i32 { // Change operator from & to ^ ------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn bitwise_and_to_bitwise_xor(a: i32) -> i32 { 1 & a } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn bitwise_and_to_bitwise_xor(a: i32) -> i32 { 1 ^ a } @@ -291,16 +291,16 @@ pub fn bitwise_and_to_bitwise_xor(a: i32) -> i32 { // Change operator from & to << ------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn bitwise_and_to_lshift(a: i32) -> i32 { a & 1 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn bitwise_and_to_lshift(a: i32) -> i32 { a << 1 } @@ -308,16 +308,16 @@ pub fn bitwise_and_to_lshift(a: i32) -> i32 { // Change operator from & to >> ------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn bitwise_and_to_rshift(a: i32) -> i32 { a & 1 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn bitwise_and_to_rshift(a: i32) -> i32 { a >> 1 } @@ -325,16 +325,16 @@ pub fn bitwise_and_to_rshift(a: i32) -> i32 { // Change operator from == to != ----------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn eq_to_uneq(a: i32) -> bool { a == 1 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn eq_to_uneq(a: i32) -> bool { a != 1 } @@ -342,16 +342,16 @@ pub fn eq_to_uneq(a: i32) -> bool { // Change operator from == to < ------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn eq_to_lt(a: i32) -> bool { a == 1 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn eq_to_lt(a: i32) -> bool { a < 1 } @@ -359,16 +359,16 @@ pub fn eq_to_lt(a: i32) -> bool { // Change operator from == to > ------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn eq_to_gt(a: i32) -> bool { a == 1 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn eq_to_gt(a: i32) -> bool { a > 1 } @@ -376,16 +376,16 @@ pub fn eq_to_gt(a: i32) -> bool { // Change operator from == to <= ----------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn eq_to_le(a: i32) -> bool { a == 1 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn eq_to_le(a: i32) -> bool { a <= 1 } @@ -393,16 +393,16 @@ pub fn eq_to_le(a: i32) -> bool { // Change operator from == to >= ----------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn eq_to_ge(a: i32) -> bool { a == 1 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn eq_to_ge(a: i32) -> bool { a >= 1 } @@ -410,18 +410,18 @@ pub fn eq_to_ge(a: i32) -> bool { // Change type in cast expression ---------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn type_cast(a: u8) -> u64 { let b = a as i32; let c = b as u64; c } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir,typeck_root", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir,typeck_root", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir,typeck_root", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir,typeck_root", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn type_cast(a: u8) -> u64 { let b = a as u32; let c = b as u64; @@ -431,16 +431,16 @@ pub fn type_cast(a: u8) -> u64 { // Change value in cast expression --------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn value_cast(a: u32) -> i32 { 1 as i32 } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn value_cast(a: u32) -> i32 { 2 as i32 } @@ -448,7 +448,7 @@ pub fn value_cast(a: u32) -> i32 { // Change place in assignment -------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn place() -> i32 { let mut x = 10; let mut y = 11; @@ -456,11 +456,11 @@ pub fn place() -> i32 { x } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn place() -> i32 { let mut x = 10; let mut y = 11; @@ -471,18 +471,18 @@ pub fn place() -> i32 { // Change r-value in assignment ------------------------------------------------ -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn rvalue() -> i32 { let mut x = 10; x = 9; x } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn rvalue() -> i32 { let mut x = 10; x = 8; @@ -492,16 +492,16 @@ pub fn rvalue() -> i32 { // Change index into slice ----------------------------------------------------- -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn index_to_slice(s: &[u8], i: usize, j: usize) -> u8 { s[i] } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail2")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bfail5")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass2")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(except="opt_hir_owner_nodes,optimized_mir", cfg="bpass5")] +#[rustc_clean(cfg="bpass6")] pub fn index_to_slice(s: &[u8], i: usize, j: usize) -> u8 { s[j] } diff --git a/tests/incremental/hashes/while_let_loops.rs b/tests/incremental/hashes/while_let_loops.rs index 3676eed8c501..89b37f31503f 100644 --- a/tests/incremental/hashes/while_let_loops.rs +++ b/tests/incremental/hashes/while_let_loops.rs @@ -5,13 +5,13 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -19,7 +19,7 @@ // Change loop body -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_loop_body() { let mut _x = 0; while let Some(0u32) = None { @@ -28,11 +28,11 @@ pub fn change_loop_body() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn change_loop_body() { let mut _x = 0; while let Some(0u32) = None { @@ -44,7 +44,7 @@ pub fn change_loop_body() { // Change loop body -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_loop_condition() { let mut _x = 0; while let Some(0u32) = None { @@ -53,11 +53,11 @@ pub fn change_loop_condition() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn change_loop_condition() { let mut _x = 0; while let Some(1u32) = None { @@ -69,7 +69,7 @@ pub fn change_loop_condition() { // Add break -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_break() { let mut _x = 0; while let Some(0u32) = None { @@ -78,11 +78,11 @@ pub fn add_break() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn add_break() { let mut _x = 0; while let Some(0u32) = None { @@ -94,7 +94,7 @@ pub fn add_break() { // Add loop label -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_loop_label() { let mut _x = 0; while let Some(0u32) = None { @@ -103,11 +103,11 @@ pub fn add_loop_label() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn add_loop_label() { let mut _x = 0; 'label: while let Some(0u32) = None { @@ -119,7 +119,7 @@ pub fn add_loop_label() { // Add loop label to break -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_loop_label_to_break() { let mut _x = 0; 'label: while let Some(0u32) = None { @@ -128,11 +128,11 @@ pub fn add_loop_label_to_break() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn add_loop_label_to_break() { let mut _x = 0; 'label: while let Some(0u32) = None { @@ -144,7 +144,7 @@ pub fn add_loop_label_to_break() { // Change break label -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_break_label() { let mut _x = 0; 'outer: while let Some(0u32) = None { @@ -155,11 +155,11 @@ pub fn change_break_label() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn change_break_label() { let mut _x = 0; 'outer: while let Some(0u32) = None { @@ -171,7 +171,7 @@ pub fn change_break_label() { } // Add loop label to continue -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_loop_label_to_continue() { let mut _x = 0; 'label: while let Some(0u32) = None { @@ -180,11 +180,11 @@ pub fn add_loop_label_to_continue() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn add_loop_label_to_continue() { let mut _x = 0; 'label: while let Some(0u32) = None { @@ -196,7 +196,7 @@ pub fn add_loop_label_to_continue() { // Change continue label -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_continue_label() { let mut _x = 0; 'outer: while let Some(0u32) = None { @@ -207,11 +207,11 @@ pub fn change_continue_label() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn change_continue_label() { let mut _x = 0; 'outer: while let Some(0u32) = None { @@ -225,7 +225,7 @@ pub fn change_continue_label() { // Change continue to break -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_continue_to_break() { let mut _x = 0; while let Some(0u32) = None { @@ -234,11 +234,11 @@ pub fn change_continue_to_break() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn change_continue_to_break() { let mut _x = 0; while let Some(0u32) = None { diff --git a/tests/incremental/hashes/while_loops.rs b/tests/incremental/hashes/while_loops.rs index 6d04eab8dd41..8bf930902871 100644 --- a/tests/incremental/hashes/while_loops.rs +++ b/tests/incremental/hashes/while_loops.rs @@ -5,13 +5,13 @@ // and make sure that the hash has changed, then change nothing between rev2 and // rev3 and make sure that the hash has not changed. -//@ build-pass (FIXME(62277): could be check-pass?) -//@ revisions: bfail1 bfail2 bfail3 bfail4 bfail5 bfail6 +//@ revisions: bpass1 bpass2 bpass3 bpass4 bpass5 bpass6 //@ compile-flags: -Z query-dep-graph -O -//@ [bfail1]compile-flags: -Zincremental-ignore-spans -//@ [bfail2]compile-flags: -Zincremental-ignore-spans -//@ [bfail3]compile-flags: -Zincremental-ignore-spans +//@ [bpass1]compile-flags: -Zincremental-ignore-spans +//@ [bpass2]compile-flags: -Zincremental-ignore-spans +//@ [bpass3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -19,7 +19,7 @@ // Change loop body -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_loop_body() { let mut _x = 0; while true { @@ -28,11 +28,11 @@ pub fn change_loop_body() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_loop_body() { let mut _x = 0; while true { @@ -44,7 +44,7 @@ pub fn change_loop_body() { // Change loop body -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_loop_condition() { let mut _x = 0; while true { @@ -53,11 +53,11 @@ pub fn change_loop_condition() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_loop_condition() { let mut _x = 0; while false { @@ -69,7 +69,7 @@ pub fn change_loop_condition() { // Add break -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_break() { let mut _x = 0; while true { @@ -78,11 +78,11 @@ pub fn add_break() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir, typeck_root")] +#[rustc_clean(cfg="bpass6")] pub fn add_break() { let mut _x = 0; while true { @@ -94,7 +94,7 @@ pub fn add_break() { // Add loop label -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_loop_label() { let mut _x = 0; while true { @@ -103,11 +103,11 @@ pub fn add_loop_label() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn add_loop_label() { let mut _x = 0; 'label: while true { @@ -119,7 +119,7 @@ pub fn add_loop_label() { // Add loop label to break -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_loop_label_to_break() { let mut _x = 0; 'label: while true { @@ -128,11 +128,11 @@ pub fn add_loop_label_to_break() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn add_loop_label_to_break() { let mut _x = 0; 'label: while true { @@ -144,7 +144,7 @@ pub fn add_loop_label_to_break() { // Change break label -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_break_label() { let mut _x = 0; 'outer: while true { @@ -155,11 +155,11 @@ pub fn change_break_label() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes,optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes,optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_break_label() { let mut _x = 0; 'outer: while true { @@ -173,7 +173,7 @@ pub fn change_break_label() { // Add loop label to continue -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn add_loop_label_to_continue() { let mut _x = 0; 'label: while true { @@ -182,11 +182,11 @@ pub fn add_loop_label_to_continue() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn add_loop_label_to_continue() { let mut _x = 0; 'label: while true { @@ -198,7 +198,7 @@ pub fn add_loop_label_to_continue() { // Change continue label -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_continue_label() { let mut _x = 0; 'outer: while true { @@ -209,11 +209,11 @@ pub fn change_continue_label() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes")] +#[rustc_clean(cfg="bpass6")] pub fn change_continue_label() { let mut _x = 0; 'outer: while true { @@ -227,7 +227,7 @@ pub fn change_continue_label() { // Change continue to break -#[cfg(any(bfail1,bfail4))] +#[cfg(any(bpass1,bpass4))] pub fn change_continue_to_break() { let mut _x = 0; while true { @@ -236,11 +236,11 @@ pub fn change_continue_to_break() { } } -#[cfg(not(any(bfail1,bfail4)))] -#[rustc_clean(cfg="bfail2", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail3")] -#[rustc_clean(cfg="bfail5", except="opt_hir_owner_nodes, optimized_mir")] -#[rustc_clean(cfg="bfail6")] +#[cfg(not(any(bpass1,bpass4)))] +#[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass3")] +#[rustc_clean(cfg="bpass5", except="opt_hir_owner_nodes, optimized_mir")] +#[rustc_clean(cfg="bpass6")] pub fn change_continue_to_break() { let mut _x = 0; while true { diff --git a/tests/incremental/ich_nested_items.rs b/tests/incremental/ich_nested_items.rs index bd83d90dbc38..2852b09d03bb 100644 --- a/tests/incremental/ich_nested_items.rs +++ b/tests/incremental/ich_nested_items.rs @@ -1,24 +1,24 @@ // Check that the hash of `foo` doesn't change just because we ordered // the nested items (or even added new ones). -//@ revisions: bfail1 bfail2 -//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: bpass1 bpass2 //@ compile-flags: -Z query-dep-graph //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![crate_type = "rlib"] #![feature(rustc_attrs)] #![allow(dead_code)] -#[rustc_clean(except = "opt_hir_owner_nodes", cfg = "bfail2")] +#[rustc_clean(except = "opt_hir_owner_nodes", cfg = "bpass2")] pub fn foo() { - #[cfg(bfail1)] + #[cfg(bpass1)] pub fn baz() {} // order is different... - #[rustc_clean(cfg = "bfail2")] + #[rustc_clean(cfg = "bpass2")] pub fn bar() {} // but that doesn't matter. - #[cfg(bfail2)] + #[cfg(bpass2)] pub fn baz() {} // order is different... pub fn bap() {} // neither does adding a new item diff --git a/tests/incremental/incremental_proc_macro.rs b/tests/incremental/incremental_proc_macro.rs index 5fb38d8a64dc..407a1e0484fa 100644 --- a/tests/incremental/incremental_proc_macro.rs +++ b/tests/incremental/incremental_proc_macro.rs @@ -1,7 +1,7 @@ //@ proc-macro: incremental_proc_macro_aux.rs -//@ revisions: bfail1 bfail2 -//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: bpass1 bpass2 //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? // This test makes sure that we still find the proc-macro registrar function // when we compile proc-macros incrementally (see #47292). diff --git a/tests/incremental/issue-42602.rs b/tests/incremental/issue-42602.rs index 498bff88b819..ec926368fbb2 100644 --- a/tests/incremental/issue-42602.rs +++ b/tests/incremental/issue-42602.rs @@ -6,10 +6,10 @@ // This was fixed by improving the resolution of the `FnOnce` trait // selection node. -//@ revisions: bfail1 bfail2 bfail3 +//@ revisions: bpass1 bpass2 bpass3 //@ compile-flags:-Zquery-dep-graph -//@ build-pass (FIXME(62277): could be check-pass?) //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![feature(rustc_attrs)] @@ -19,14 +19,14 @@ fn main() { } mod a { - #[cfg(bfail1)] + #[cfg(bpass1)] pub fn foo() { let x = vec![1, 2, 3]; let v = || ::std::mem::drop(x); v(); } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] pub fn foo() { let x = vec![1, 2, 3, 4]; let v = || ::std::mem::drop(x); @@ -35,8 +35,8 @@ pub fn foo() { } mod b { - #[rustc_clean(cfg="bfail2")] - #[rustc_clean(cfg="bfail3")] + #[rustc_clean(cfg="bpass2")] + #[rustc_clean(cfg="bpass3")] pub fn bar() { let x = vec![1, 2, 3]; let v = || ::std::mem::drop(x); diff --git a/tests/incremental/issue-49595/issue-49595.rs b/tests/incremental/issue-49595/issue-49595.rs index 844199ae7336..b2c4125f7890 100644 --- a/tests/incremental/issue-49595/issue-49595.rs +++ b/tests/incremental/issue-49595/issue-49595.rs @@ -1,16 +1,15 @@ -//@ revisions: bfail1 bfail2 bfail3 +//@ revisions: bpass1 bpass2 bpass3 //@ compile-flags: -Z query-dep-graph --test -//@ build-pass //@ ignore-backends: gcc #![feature(rustc_attrs)] #![crate_type = "rlib"] -#![rustc_partition_codegened(module="issue_49595-tests", cfg="bfail2")] -#![rustc_partition_codegened(module="issue_49595-lit_test", cfg="bfail3")] +#![rustc_partition_codegened(module="issue_49595-tests", cfg="bpass2")] +#![rustc_partition_codegened(module="issue_49595-lit_test", cfg="bpass3")] mod tests { - #[cfg_attr(not(bfail1), test)] + #[cfg_attr(not(bpass1), test)] fn _test() { } } @@ -20,8 +19,8 @@ fn _test() { // takes effect. // replacing a module to have a stable span -#[cfg_attr(not(bfail3), path = "auxiliary/lit_a.rs")] -#[cfg_attr(bfail3, path = "auxiliary/lit_b.rs")] +#[cfg_attr(not(bpass3), path = "auxiliary/lit_a.rs")] +#[cfg_attr(bpass3, path = "auxiliary/lit_b.rs")] mod lit; pub mod lit_test { diff --git a/tests/incremental/issue-59523-on-implemented-is-not-unused.rs b/tests/incremental/issue-59523-on-implemented-is-not-unused.rs index 61863f8a6938..dd8399acdd17 100644 --- a/tests/incremental/issue-59523-on-implemented-is-not-unused.rs +++ b/tests/incremental/issue-59523-on-implemented-is-not-unused.rs @@ -2,9 +2,9 @@ // rustc_on_unimplemented, but with this bug we are seeing it fire (on // subsequent runs) if incremental compilation is enabled. -//@ revisions: bfail1 bfail2 -//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: bpass1 bpass2 //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![feature(rustc_attrs)] #![deny(unused_attributes)] diff --git a/tests/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs b/tests/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs index 40311a45496f..3a2e6cf9f02a 100644 --- a/tests/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs +++ b/tests/incremental/issue-59524-layout-scalar-valid-range-is-not-unused.rs @@ -3,9 +3,9 @@ // seeing it fire (on subsequent runs) if incremental compilation is // enabled. -//@ revisions: bfail1 bfail2 -//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: bpass1 bpass2 //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![feature(rustc_attrs)] #![deny(unused_attributes)] diff --git a/tests/incremental/issue-84252-global-alloc.rs b/tests/incremental/issue-84252-global-alloc.rs index 21d64395c228..f035f209daa5 100644 --- a/tests/incremental/issue-84252-global-alloc.rs +++ b/tests/incremental/issue-84252-global-alloc.rs @@ -1,5 +1,4 @@ -//@ revisions: bfail1 bfail2 -//@ build-pass +//@ revisions: bpass1 bpass2 //@ needs-crate-type: cdylib #![crate_type="lib"] @@ -8,6 +7,6 @@ #[allow(unused_imports)] use std::alloc::System; -#[cfg(bfail1)] +#[cfg(bpass1)] #[global_allocator] static ALLOC: System = System; diff --git a/tests/incremental/issue-85360-eval-obligation-ice.rs b/tests/incremental/issue-85360-eval-obligation-ice.rs index 84b6e1ace7d0..0066c6ffc99a 100644 --- a/tests/incremental/issue-85360-eval-obligation-ice.rs +++ b/tests/incremental/issue-85360-eval-obligation-ice.rs @@ -1,8 +1,7 @@ -//@ revisions: bfail1 bfail2 -//@[bfail1] compile-flags: --crate-type=lib -Zassert-incr-state=not-loaded -//@[bfail2] compile-flags: --crate-type=lib -Zassert-incr-state=loaded +//@ revisions: bpass1 bpass2 +//@[bpass1] compile-flags: --crate-type=lib -Zassert-incr-state=not-loaded +//@[bpass2] compile-flags: --crate-type=lib -Zassert-incr-state=loaded //@ edition: 2021 -//@ build-pass //@ ignore-backends: gcc #![allow(dead_code)] diff --git a/tests/incremental/krate-inherent.rs b/tests/incremental/krate-inherent.rs index 122e5f5648fd..c8372d6a79a1 100644 --- a/tests/incremental/krate-inherent.rs +++ b/tests/incremental/krate-inherent.rs @@ -1,11 +1,11 @@ -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 //@ compile-flags: -Z query-dep-graph -//@ build-pass (FIXME(62277): could be check-pass?) //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] -#![rustc_partition_reused(module = "krate_inherent-x", cfg = "bfail2")] +#![rustc_partition_reused(module = "krate_inherent-x", cfg = "bpass2")] #![crate_type = "rlib"] pub mod x { @@ -20,5 +20,5 @@ pub fn method() { } } -#[cfg(bfail1)] -pub fn bar() {} // remove this unrelated fn in bfail2, which should not affect `x::method` +#[cfg(bpass1)] +pub fn bar() {} // remove this unrelated fn in bpass2, which should not affect `x::method` diff --git a/tests/incremental/lto-in-linker.rs b/tests/incremental/lto-in-linker.rs index 6fae5b8cb275..50f4e1f36a92 100644 --- a/tests/incremental/lto-in-linker.rs +++ b/tests/incremental/lto-in-linker.rs @@ -1,9 +1,8 @@ -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 //@ compile-flags: -Z query-dep-graph --crate-type rlib -C linker-plugin-lto -O //@ no-prefer-dynamic -//@ build-pass #![feature(rustc_attrs)] -#![rustc_partition_reused(module = "lto_in_linker", cfg = "bfail2")] +#![rustc_partition_reused(module = "lto_in_linker", cfg = "bpass2")] pub fn foo() {} diff --git a/tests/incremental/macro_export.rs b/tests/incremental/macro_export.rs index 386447ffa99b..eddccc0015c7 100644 --- a/tests/incremental/macro_export.rs +++ b/tests/incremental/macro_export.rs @@ -1,6 +1,6 @@ -//@ revisions: bfail1 bfail2 bfail3 -//@ build-pass (FIXME(62277): could be check-pass?) +//@ revisions: bpass1 bpass2 bpass3 //@ ignore-backends: gcc +// FIXME(#62277): could be check-pass? // This test case makes sure that we can compile with incremental compilation // enabled when there are macros exported from this crate. (See #37756) diff --git a/tests/incremental/no_mangle.rs b/tests/incremental/no_mangle.rs index 1faab3ca69df..fbb3cb1ef545 100644 --- a/tests/incremental/no_mangle.rs +++ b/tests/incremental/no_mangle.rs @@ -1,5 +1,4 @@ -//@ revisions: bfail1 bfail2 -//@ check-pass +//@ revisions: cpass1 cpass2 //@ compile-flags: --crate-type cdylib //@ needs-crate-type: cdylib diff --git a/tests/incremental/remove_source_file/main.rs b/tests/incremental/remove_source_file/main.rs index 47a982f8788e..23ddbd21e996 100644 --- a/tests/incremental/remove_source_file/main.rs +++ b/tests/incremental/remove_source_file/main.rs @@ -1,24 +1,24 @@ // This test case makes sure that the compiler doesn't crash due to a failing // table lookup when a source file is removed. -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 // Note that we specify -g so that the SourceFiles actually get referenced by the // incr. comp. cache: //@ compile-flags: -Z query-dep-graph -g -//@ build-pass (FIXME(62277): could be check-pass?) +// FIXME(#62277): could be check-pass? #![crate_type= "rlib"] -#[cfg(bfail1)] +#[cfg(bpass1)] mod auxiliary; -#[cfg(bfail1)] +#[cfg(bpass1)] pub fn foo() { auxiliary::print_hello(); } -#[cfg(bfail2)] +#[cfg(bpass2)] pub fn foo() { println!("hello"); } diff --git a/tests/incremental/rlib-lto.rs b/tests/incremental/rlib-lto.rs index 8f15f6ffc347..233c956f85da 100644 --- a/tests/incremental/rlib-lto.rs +++ b/tests/incremental/rlib-lto.rs @@ -1,8 +1,7 @@ -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 //@ compile-flags: -Z query-dep-graph --crate-type rlib -C lto -//@ build-pass #![feature(rustc_attrs)] -#![rustc_partition_reused(module = "rlib_lto", cfg = "bfail2")] +#![rustc_partition_reused(module = "rlib_lto", cfg = "bpass2")] pub fn foo() {} diff --git a/tests/incremental/string_constant.rs b/tests/incremental/string_constant.rs index ce7ef1f00d4a..d0d0a3c4a701 100644 --- a/tests/incremental/string_constant.rs +++ b/tests/incremental/string_constant.rs @@ -1,6 +1,6 @@ -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 //@ compile-flags: -Z query-dep-graph -Copt-level=0 -//@ build-pass (FIXME(62277): could be check-pass?) +// FIXME(#62277): could be check-pass? #![allow(warnings)] #![feature(rustc_attrs)] @@ -11,13 +11,13 @@ // needed even for callers of `x`. pub mod x { - #[cfg(bfail1)] + #[cfg(bpass1)] pub fn x() { println!("{}", "1"); } - #[cfg(bfail2)] - #[rustc_clean(except = "opt_hir_owner_nodes,optimized_mir", cfg = "bfail2")] + #[cfg(bpass2)] + #[rustc_clean(except = "opt_hir_owner_nodes,optimized_mir", cfg = "bpass2")] pub fn x() { println!("{}", "2"); } @@ -26,7 +26,7 @@ pub fn x() { pub mod y { use x; - #[rustc_clean(cfg = "bfail2")] + #[rustc_clean(cfg = "bpass2")] pub fn y() { x::x(); } @@ -35,7 +35,7 @@ pub fn y() { pub mod z { use y; - #[rustc_clean(cfg = "bfail2")] + #[rustc_clean(cfg = "bpass2")] pub fn z() { y::y(); } diff --git a/tests/incremental/thinlto/cgu_invalidated_via_import.rs b/tests/incremental/thinlto/cgu_invalidated_via_import.rs index a29e0a5f74f0..240f0750d0b0 100644 --- a/tests/incremental/thinlto/cgu_invalidated_via_import.rs +++ b/tests/incremental/thinlto/cgu_invalidated_via_import.rs @@ -2,37 +2,36 @@ // via ThinLTO and that imported thing changes while the definition of the CGU // stays untouched. -//@ revisions: bfail1 bfail2 bfail3 +//@ revisions: bpass1 bpass2 bpass3 //@ compile-flags: -Z query-dep-graph -O -//@ build-pass //@ ignore-backends: gcc #![feature(rustc_attrs)] #![crate_type="rlib"] #![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-foo", - cfg="bfail2", + cfg="bpass2", kind="no")] #![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-foo", - cfg="bfail3", + cfg="bpass3", kind="pre-lto")] // Should be "post-lto", see issue #119076 #![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-bar", - cfg="bfail2", + cfg="bpass2", kind="pre-lto")] #![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-bar", - cfg="bfail3", + cfg="bpass3", kind="pre-lto")] // Should be "post-lto", see issue #119076 mod foo { // Trivial functions like this one are imported very reliably by ThinLTO. - #[cfg(bfail1)] + #[cfg(bpass1)] pub fn inlined_fn() -> u32 { 1234 } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] pub fn inlined_fn() -> u32 { // See `cgu_keeps_identical_fn.rs` for why this is different // from the other version of this function. diff --git a/tests/incremental/thinlto/cgu_invalidated_when_export_added.rs b/tests/incremental/thinlto/cgu_invalidated_when_export_added.rs index 2da44eea8929..466096b81ffa 100644 --- a/tests/incremental/thinlto/cgu_invalidated_when_export_added.rs +++ b/tests/incremental/thinlto/cgu_invalidated_when_export_added.rs @@ -1,5 +1,4 @@ -//@ revisions: bfail1 bfail2 -//@ build-pass +//@ revisions: bpass1 bpass2 //@ ignore-backends: gcc // rust-lang/rust#69798: @@ -18,7 +17,7 @@ fn drop(&mut self) { pub extern "C" fn run() { thread_local! { pub static FOO : Foo = Foo { } ; } - #[cfg(bfail2)] + #[cfg(bpass2)] { FOO.with(|_f| ()) } diff --git a/tests/incremental/thinlto/cgu_invalidated_when_export_removed.rs b/tests/incremental/thinlto/cgu_invalidated_when_export_removed.rs index afe485aa0425..6c5d94515eff 100644 --- a/tests/incremental/thinlto/cgu_invalidated_when_export_removed.rs +++ b/tests/incremental/thinlto/cgu_invalidated_when_export_removed.rs @@ -1,5 +1,4 @@ -//@ revisions: bfail1 bfail2 -//@ build-pass +//@ revisions: bpass1 bpass2 //@ ignore-backends: gcc // rust-lang/rust#69798: @@ -18,7 +17,7 @@ fn drop(&mut self) { pub extern "C" fn run() { thread_local! { pub static FOO : Foo = Foo { } ; } - #[cfg(bfail1)] + #[cfg(bpass1)] { FOO.with(|_f| ()) } diff --git a/tests/incremental/thinlto/cgu_invalidated_when_import_added.rs b/tests/incremental/thinlto/cgu_invalidated_when_import_added.rs index 97a63c6765ff..9d6fe9c21253 100644 --- a/tests/incremental/thinlto/cgu_invalidated_when_import_added.rs +++ b/tests/incremental/thinlto/cgu_invalidated_when_import_added.rs @@ -1,6 +1,5 @@ -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 //@ compile-flags: -O -Zhuman-readable-cgu-names -Cllvm-args=-import-instr-limit=10 -//@ build-pass //@ ignore-backends: gcc // rust-lang/rust#59535: @@ -28,16 +27,16 @@ fn main() { mod foo { - // In bfail1, ThinLTO decides that foo() does not get inlined into main, and + // In bpass1, ThinLTO decides that foo() does not get inlined into main, and // instead bar() gets inlined into foo(). - // In bfail2, foo() gets inlined into main. + // In bpass2, foo() gets inlined into main. pub fn foo(){ bar() } // This function needs to be big so that it does not get inlined by ThinLTO // but *does* get inlined into foo() when it is declared `internal` in - // bfail1 (alone). + // bpass1 (alone). pub fn bar(){ println!("quux1"); println!("quux2"); @@ -55,7 +54,7 @@ mod bar { #[inline(never)] pub fn baz() { - #[cfg(bfail2)] + #[cfg(bpass2)] { crate::foo::bar(); } diff --git a/tests/incremental/thinlto/cgu_invalidated_when_import_removed.rs b/tests/incremental/thinlto/cgu_invalidated_when_import_removed.rs index c4943061fbe8..41745827fb8d 100644 --- a/tests/incremental/thinlto/cgu_invalidated_when_import_removed.rs +++ b/tests/incremental/thinlto/cgu_invalidated_when_import_removed.rs @@ -1,6 +1,5 @@ -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 //@ compile-flags: -O -Zhuman-readable-cgu-names -Cllvm-args=-import-instr-limit=10 -//@ build-pass //@ ignore-backends: gcc // rust-lang/rust#59535: @@ -38,8 +37,8 @@ fn main() { mod foo { - // In bfail1, foo() gets inlined into main. - // In bfail2, ThinLTO decides that foo() does not get inlined into main, and + // In bpass1, foo() gets inlined into main. + // In bpass2, ThinLTO decides that foo() does not get inlined into main, and // instead bar() gets inlined into foo(). But faulty logic in our incr. // ThinLTO implementation thought that `main()` is unchanged and thus reused // the object file still containing a call to the now non-existent bar(). @@ -49,7 +48,7 @@ pub fn foo(){ // This function needs to be big so that it does not get inlined by ThinLTO // but *does* get inlined into foo() once it is declared `internal` in - // bfail2. + // bpass2. pub fn bar(){ println!("quux1"); println!("quux2"); @@ -67,7 +66,7 @@ mod bar { #[inline(never)] pub fn baz() { - #[cfg(bfail1)] + #[cfg(bpass1)] { crate::foo::bar(); } diff --git a/tests/incremental/thinlto/cgu_keeps_identical_fn.rs b/tests/incremental/thinlto/cgu_keeps_identical_fn.rs index 9ad2c51efa8e..432fffabf546 100644 --- a/tests/incremental/thinlto/cgu_keeps_identical_fn.rs +++ b/tests/incremental/thinlto/cgu_keeps_identical_fn.rs @@ -3,43 +3,42 @@ // ends up with any spans in its LLVM bitecode, so LLVM is able to skip // re-building any modules which import 'inlined_fn' -//@ revisions: bfail1 bfail2 bfail3 +//@ revisions: bpass1 bpass2 bpass3 //@ compile-flags: -Z query-dep-graph -O -//@ build-pass //@ ignore-backends: gcc #![feature(rustc_attrs)] #![crate_type = "rlib"] #![rustc_expected_cgu_reuse( module = "cgu_keeps_identical_fn-foo", - cfg = "bfail2", + cfg = "bpass2", kind = "pre-lto" )] #![rustc_expected_cgu_reuse( module = "cgu_keeps_identical_fn-foo", - cfg = "bfail3", + cfg = "bpass3", kind = "pre-lto" // Should be "post-lto", see issue #119076 )] #![rustc_expected_cgu_reuse( module = "cgu_keeps_identical_fn-bar", - cfg = "bfail2", + cfg = "bpass2", kind = "pre-lto" // Should be "post-lto", see issue #119076 )] #![rustc_expected_cgu_reuse( module = "cgu_keeps_identical_fn-bar", - cfg = "bfail3", + cfg = "bpass3", kind = "pre-lto" // Should be "post-lto", see issue #119076 )] mod foo { // Trivial functions like this one are imported very reliably by ThinLTO. - #[cfg(bfail1)] + #[cfg(bpass1)] pub fn inlined_fn() -> u32 { 1234 } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] pub fn inlined_fn() -> u32 { 1234 } diff --git a/tests/incremental/thinlto/independent_cgus_dont_affect_each_other.rs b/tests/incremental/thinlto/independent_cgus_dont_affect_each_other.rs index 3f2ddb49f4de..637d55b089af 100644 --- a/tests/incremental/thinlto/independent_cgus_dont_affect_each_other.rs +++ b/tests/incremental/thinlto/independent_cgus_dont_affect_each_other.rs @@ -1,42 +1,41 @@ // This test checks that a change in a CGU does not invalidate an unrelated CGU // during incremental ThinLTO. -//@ revisions: bfail1 bfail2 bfail3 +//@ revisions: bpass1 bpass2 bpass3 //@ compile-flags: -Z query-dep-graph -O -//@ build-pass //@ ignore-backends: gcc #![feature(rustc_attrs)] #![crate_type="rlib"] #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-foo", - cfg="bfail2", + cfg="bpass2", kind="no")] #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-foo", - cfg="bfail3", + cfg="bpass3", kind="pre-lto")] // Should be "post-lto", see issue #119076 #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-bar", - cfg="bfail2", + cfg="bpass2", kind="pre-lto")] #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-bar", - cfg="bfail3", + cfg="bpass3", kind="pre-lto")] // Should be "post-lto", see issue #119076 #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-baz", - cfg="bfail2", + cfg="bpass2", kind="pre-lto")] // Should be "post-lto", see issue #119076 #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-baz", - cfg="bfail3", + cfg="bpass3", kind="pre-lto")] // Should be "post-lto", see issue #119076 mod foo { - #[cfg(bfail1)] + #[cfg(bpass1)] pub fn inlined_fn() -> u32 { 1234 } - #[cfg(not(bfail1))] + #[cfg(not(bpass1))] pub fn inlined_fn() -> u32 { // See `cgu_keeps_identical_fn.rs` for why this is different // from the other version of this function. diff --git a/tests/incremental/track-deps-in-new-solver.rs b/tests/incremental/track-deps-in-new-solver.rs index d224d9f4d87f..4b4d733e1d92 100644 --- a/tests/incremental/track-deps-in-new-solver.rs +++ b/tests/incremental/track-deps-in-new-solver.rs @@ -1,7 +1,5 @@ -//@ revisions: bfail1 bfail2 - +//@ revisions: cpass1 cpass2 //@ compile-flags: -Znext-solver -//@ check-pass #![allow(dead_code)] @@ -18,10 +16,10 @@ fn poll() -> Self::Error { } } -#[cfg(bfail1)] +#[cfg(cpass1)] pub struct Error(()); -#[cfg(bfail2)] +#[cfg(cpass2)] pub struct Error(); fn main() {} diff --git a/tests/incremental/unrecoverable_query.rs b/tests/incremental/unrecoverable_query.rs index 62ee415fde15..2bde47358101 100644 --- a/tests/incremental/unrecoverable_query.rs +++ b/tests/incremental/unrecoverable_query.rs @@ -4,9 +4,8 @@ // In this test prior to fixing compiler was having problems figuring out // drop impl for T inside of m -//@ revisions: bfail1 bfail2 +//@ revisions: bpass1 bpass2 //@ compile-flags: --crate-type=lib -//@ build-pass //@ ignore-backends: gcc #![allow(dead_code)] @@ -32,9 +31,9 @@ pub fn i() -> Self { } enum C { - #[cfg(bfail1)] + #[cfg(bpass1)] Up(()), - #[cfg(bfail2)] + #[cfg(bpass2)] Lorry(()), } diff --git a/tests/incremental/warnings-reemitted.rs b/tests/incremental/warnings-reemitted.rs index be60c2ba3ba5..f97fae58e9be 100644 --- a/tests/incremental/warnings-reemitted.rs +++ b/tests/incremental/warnings-reemitted.rs @@ -1,6 +1,5 @@ -//@ revisions: bfail1 bfail2 bfail3 +//@ revisions: bpass1 bpass2 bpass3 //@ compile-flags: -Coverflow-checks=on -//@ build-pass //@ ignore-backends: gcc #![warn(arithmetic_overflow)] diff --git a/tests/ui/README.md b/tests/ui/README.md index 9ef331698d2b..0af02ab39c23 100644 --- a/tests/ui/README.md +++ b/tests/ui/README.md @@ -1588,6 +1588,21 @@ Tests on various well-formedness checks, e.g. [Type-checking normal functions](h Tests on `where` clauses. See [Where clauses | Reference](https://doc.rust-lang.org/reference/items/generics.html#where-clauses). +## `tests/ui/whitespace/` + +Tests for whitespace handling in the Rust lexer. The Rust language +defines whitespace as Unicode Pattern_White_Space, which is not the +same as what the standard library gives you: + +- `is_ascii_whitespace` follows the WhatWG Infra Standard and skips + vertical tab (`\x0B`) +- `is_whitespace` matches Unicode White_Space, which is a broader set + +These tests make that gap visible and check that the lexer accepts +all 11 Pattern_White_Space characters correctly. + +See: https://github.com/rustfoundation/interop-initiative/issues/53 + ## `tests/ui/windows-subsystem/`: `#![windows_subsystem = ""]` See [the `windows_subsystem` attribute](https://doc.rust-lang.org/reference/runtime.html#the-windows_subsystem-attribute). diff --git a/tests/ui/async-await/async-closures/suggest-async-block-issue-140265.stderr b/tests/ui/async-await/async-closures/suggest-async-block-issue-140265.stderr index d81cfaac7f7d..8e9e8ce1e730 100644 --- a/tests/ui/async-await/async-closures/suggest-async-block-issue-140265.stderr +++ b/tests/ui/async-await/async-closures/suggest-async-block-issue-140265.stderr @@ -66,8 +66,11 @@ LL | fn takes_future(_fut: impl Future) {} | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future` help: use parentheses to call this closure | -LL | }(/* i32 */)); - | +++++++++++ +LL ~ takes_future((async |x: i32| { +LL | +LL | println!("{x}"); +LL ~ })(/* i32 */)); + | error: aborting due to 3 previous errors diff --git a/tests/ui/attributes/dump-preds.stderr b/tests/ui/attributes/dump-preds.stderr index dd2453342f7f..12d930843173 100644 --- a/tests/ui/attributes/dump-preds.stderr +++ b/tests/ui/attributes/dump-preds.stderr @@ -33,7 +33,7 @@ error: rustc_dump_item_bounds LL | type Assoc: std::ops::Deref | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: Binder { value: ProjectionPredicate(AliasTerm { args: [Alias(AliasTy { args: [Self/#0, T/#1, P/#2], kind: Projection { def_id: DefId(..) }, .. })], def_id: DefId(..), .. }, Term::Ty(())), bound_vars: [] } + = note: Binder { value: ProjectionPredicate(AliasTerm { args: [Alias(AliasTy { args: [Self/#0, T/#1, P/#2], kind: Projection { def_id: DefId(..) }, .. })], kind: ProjectionTy { def_id: DefId(..) }, .. }, Term::Ty(())), bound_vars: [] } = note: Binder { value: TraitPredicate(<>::Assoc

as std::ops::Deref>, polarity:Positive), bound_vars: [] } = note: Binder { value: TraitPredicate(<>::Assoc

as std::marker::Sized>, polarity:Positive), bound_vars: [] } diff --git a/tests/ui/coherence/occurs-check/associated-type.next.stderr b/tests/ui/coherence/occurs-check/associated-type.next.stderr index 4f02a91ae8ee..38fb75483f3b 100644 --- a/tests/ui/coherence/occurs-check/associated-type.next.stderr +++ b/tests/ui/coherence/occurs-check/associated-type.next.stderr @@ -1,5 +1,5 @@ - WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTerm { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1))], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. } - WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTerm { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1))], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTerm { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1))], kind: ProjectionTy { def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }, .. } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTerm { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1))], kind: ProjectionTy { def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }, .. } error[E0119]: conflicting implementations of trait `Overlap fn(&'a (), ())>` for type `for<'a> fn(&'a (), ())` --> $DIR/associated-type.rs:32:1 | diff --git a/tests/ui/coherence/occurs-check/associated-type.old.stderr b/tests/ui/coherence/occurs-check/associated-type.old.stderr index 40811a67dd18..1dac3ecea268 100644 --- a/tests/ui/coherence/occurs-check/associated-type.old.stderr +++ b/tests/ui/coherence/occurs-check/associated-type.old.stderr @@ -1,5 +1,5 @@ - WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTerm { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1))], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. } - WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTerm { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1))], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTerm { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1))], kind: ProjectionTy { def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }, .. } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTerm { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1))], kind: ProjectionTy { def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }, .. } error[E0119]: conflicting implementations of trait `Overlap fn(&'a (), ())>` for type `for<'a> fn(&'a (), ())` --> $DIR/associated-type.rs:32:1 | diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr index be63c9e5c046..0237e7bb5eea 100644 --- a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr @@ -32,9 +32,8 @@ LL | fn check(_: impl std::marker::ConstParamTy_) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check` help: use parentheses to call this closure | -LL - check(|| {}); -LL + check((|| {})()); - | +LL | check((|| {})()); + | + +++ error[E0277]: `fn()` can't be used as a const parameter type --> $DIR/const_param_ty_bad.rs:9:11 diff --git a/tests/ui/consts/non-const-value-in-const-irrefutable-pat-binding.rs b/tests/ui/consts/non-const-value-in-const-irrefutable-pat-binding.rs new file mode 100644 index 000000000000..de5a57335408 --- /dev/null +++ b/tests/ui/consts/non-const-value-in-const-irrefutable-pat-binding.rs @@ -0,0 +1,13 @@ +// Irrefutable `if let` pattern bindings still produce an incorrect suggestion +// to replace `let` with `const`. +// See https://github.com/rust-lang/rust/pull/152834#discussion_r3068766148 + +//@ known-bug: #152831 + +fn irrefutable_if_let_binding() { + if let x = 1 { + const { x } + } +} + +fn main() {} diff --git a/tests/ui/consts/non-const-value-in-const-irrefutable-pat-binding.stderr b/tests/ui/consts/non-const-value-in-const-irrefutable-pat-binding.stderr new file mode 100644 index 000000000000..1a2fa226e633 --- /dev/null +++ b/tests/ui/consts/non-const-value-in-const-irrefutable-pat-binding.stderr @@ -0,0 +1,15 @@ +error[E0435]: attempt to use a non-constant value in a constant + --> $DIR/non-const-value-in-const-irrefutable-pat-binding.rs:9:17 + | +LL | const { x } + | ^ non-constant value + | +help: consider using `const` instead of `let` + | +LL - if let x = 1 { +LL + if const x: /* Type */ = 1 { + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0435`. diff --git a/tests/ui/consts/non-const-value-in-const-pat-binding.rs b/tests/ui/consts/non-const-value-in-const-pat-binding.rs new file mode 100644 index 000000000000..8c6edfdf363c --- /dev/null +++ b/tests/ui/consts/non-const-value-in-const-pat-binding.rs @@ -0,0 +1,24 @@ +// Regression test for https://github.com/rust-lang/rust/issues/152831 + +fn if_let_binding() { + if let Some(v) = Some(1) { + const { v } + //~^ ERROR: attempt to use a non-constant value in a constant + } +} + +fn while_let_binding() { + while let Some(v) = Some(1) { + const { v } + //~^ ERROR: attempt to use a non-constant value in a constant + break; + } +} + +fn let_else_binding() { + let Some(v) = Some(1) else { return }; + const { v } + //~^ ERROR: attempt to use a non-constant value in a constant +} + +fn main() {} diff --git a/tests/ui/consts/non-const-value-in-const-pat-binding.stderr b/tests/ui/consts/non-const-value-in-const-pat-binding.stderr new file mode 100644 index 000000000000..d303189eb305 --- /dev/null +++ b/tests/ui/consts/non-const-value-in-const-pat-binding.stderr @@ -0,0 +1,21 @@ +error[E0435]: attempt to use a non-constant value in a constant + --> $DIR/non-const-value-in-const-pat-binding.rs:5:17 + | +LL | const { v } + | ^ non-constant value + +error[E0435]: attempt to use a non-constant value in a constant + --> $DIR/non-const-value-in-const-pat-binding.rs:12:17 + | +LL | const { v } + | ^ non-constant value + +error[E0435]: attempt to use a non-constant value in a constant + --> $DIR/non-const-value-in-const-pat-binding.rs:20:13 + | +LL | const { v } + | ^ non-constant value + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0435`. diff --git a/tests/ui/deriving/issue-89188-gat-hrtb.rs b/tests/ui/derives/clone-include-gat-hrtb.rs similarity index 91% rename from tests/ui/deriving/issue-89188-gat-hrtb.rs rename to tests/ui/derives/clone-include-gat-hrtb.rs index a7b43159f16f..4a5ab92ccf3e 100644 --- a/tests/ui/deriving/issue-89188-gat-hrtb.rs +++ b/tests/ui/derives/clone-include-gat-hrtb.rs @@ -1,3 +1,4 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/89188. //@ check-pass trait CallWithShim: Sized { diff --git a/tests/ui/derives/derive-clone-basic.rs b/tests/ui/derives/derive-clone-basic.rs new file mode 100644 index 000000000000..ba717c86531f --- /dev/null +++ b/tests/ui/derives/derive-clone-basic.rs @@ -0,0 +1,65 @@ +//! Make sure that `derive(Clone)` works for simple structs and enums. +//@ run-pass +#![allow(dead_code)] + +#[derive(Clone)] +enum SimpleEnum { + A, + B(()), + C, +} + +#[derive(Clone)] +enum GenericEnum { + A(T), + B(T, U), + C, +} + +#[derive(Clone)] +struct TupleStruct((), ()); + +#[derive(Clone)] +struct GenericStruct { + foo: (), + bar: (), + baz: T, +} + +#[derive(Clone)] +struct GenericTupleStruct(T, ()); + +#[derive(Clone)] +struct ManyPrimitives { + _int: isize, + _i8: i8, + _i16: i16, + _i32: i32, + _i64: i64, + + _uint: usize, + _u8: u8, + _u16: u16, + _u32: u32, + _u64: u64, + + _f32: f32, + _f64: f64, + + _bool: bool, + _char: char, + _nil: (), +} + +// Regression test for issue #30244 +#[derive(Copy, Clone)] +struct Array { + arr: [[u8; 256]; 4], +} + +pub fn main() { + let _ = SimpleEnum::A.clone(); + let _ = GenericEnum::A::(1).clone(); + let _ = GenericStruct { foo: (), bar: (), baz: 1 }.clone(); + let _ = GenericTupleStruct(1, ()).clone(); +} diff --git a/tests/ui/deriving/issue-103157.rs b/tests/ui/derives/derive-eq-check-all-variants.rs similarity index 75% rename from tests/ui/deriving/issue-103157.rs rename to tests/ui/derives/derive-eq-check-all-variants.rs index ca0698978781..3c560e51ec85 100644 --- a/tests/ui/deriving/issue-103157.rs +++ b/tests/ui/derives/derive-eq-check-all-variants.rs @@ -1,4 +1,4 @@ -//@ check-fail +//! Regression test for https://github.com/rust-lang/rust/issues/103157. #[derive(PartialEq, Eq)] pub enum Value { diff --git a/tests/ui/deriving/issue-103157.stderr b/tests/ui/derives/derive-eq-check-all-variants.stderr similarity index 93% rename from tests/ui/deriving/issue-103157.stderr rename to tests/ui/derives/derive-eq-check-all-variants.stderr index 0e4a3f75db3f..19026145c66c 100644 --- a/tests/ui/deriving/issue-103157.stderr +++ b/tests/ui/derives/derive-eq-check-all-variants.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `f64: Eq` is not satisfied - --> $DIR/issue-103157.rs:6:11 + --> $DIR/derive-eq-check-all-variants.rs:6:11 | LL | #[derive(PartialEq, Eq)] | -- in this derive macro expansion diff --git a/tests/ui/deriving/issue-6341.rs b/tests/ui/derives/derive-on-drop-type.rs similarity index 51% rename from tests/ui/deriving/issue-6341.rs rename to tests/ui/derives/derive-on-drop-type.rs index 83b0da9a3182..ae032aeb6e8e 100644 --- a/tests/ui/deriving/issue-6341.rs +++ b/tests/ui/derives/derive-on-drop-type.rs @@ -1,7 +1,10 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/6341. //@ check-pass #[derive(PartialEq)] -struct A { x: usize } +struct A { + x: usize, +} impl Drop for A { fn drop(&mut self) {} diff --git a/tests/ui/deriving/issue-18738.rs b/tests/ui/derives/derive-static-str-field.rs similarity index 73% rename from tests/ui/deriving/issue-18738.rs rename to tests/ui/derives/derive-static-str-field.rs index d3e0965e5454..3b322a195bb8 100644 --- a/tests/ui/deriving/issue-18738.rs +++ b/tests/ui/derives/derive-static-str-field.rs @@ -1,3 +1,4 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/18738. //@ check-pass #![allow(dead_code)] #[derive(Eq, PartialEq, PartialOrd, Ord)] @@ -8,7 +9,7 @@ enum Test<'a> { #[derive(Eq, PartialEq, PartialOrd, Ord)] struct Version { - vendor_info: &'static str + vendor_info: &'static str, } #[derive(Eq, PartialEq, PartialOrd, Ord)] diff --git a/tests/ui/derives/derive-type-with-reference.rs b/tests/ui/derives/derive-type-with-reference.rs new file mode 100644 index 000000000000..872a69221aa2 --- /dev/null +++ b/tests/ui/derives/derive-type-with-reference.rs @@ -0,0 +1,11 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/15689. +//@ run-pass + +#[derive(PartialEq, Debug, Clone)] +enum Test<'a> { + Slice(&'a isize), +} + +fn main() { + assert_eq!(Test::Slice(&1), Test::Slice(&1)) +} diff --git a/tests/ui/deriving/issue-19358.rs b/tests/ui/derives/derive-with-where-bounds.rs similarity index 59% rename from tests/ui/deriving/issue-19358.rs rename to tests/ui/derives/derive-with-where-bounds.rs index daa1a9457494..4cc9c2b9f846 100644 --- a/tests/ui/deriving/issue-19358.rs +++ b/tests/ui/derives/derive-with-where-bounds.rs @@ -1,8 +1,11 @@ -//@ run-pass +//! Regression test for https://github.com/rust-lang/rust/issues/19358. +//@ check-pass #![allow(dead_code)] -trait Trait { fn dummy(&self) { } } +trait Trait { + fn dummy(&self) {} +} #[derive(Debug)] struct Foo { @@ -10,7 +13,10 @@ struct Foo { } #[derive(Debug)] -struct Bar where T: Trait { +struct Bar +where + T: Trait, +{ bar: T, } diff --git a/tests/ui/derives/deriving-bounds.rs b/tests/ui/derives/no-send-sync-derives.rs similarity index 100% rename from tests/ui/derives/deriving-bounds.rs rename to tests/ui/derives/no-send-sync-derives.rs diff --git a/tests/ui/derives/deriving-bounds.stderr b/tests/ui/derives/no-send-sync-derives.stderr similarity index 76% rename from tests/ui/derives/deriving-bounds.stderr rename to tests/ui/derives/no-send-sync-derives.stderr index 4461652eb02e..d0f35ab4300c 100644 --- a/tests/ui/derives/deriving-bounds.stderr +++ b/tests/ui/derives/no-send-sync-derives.stderr @@ -1,48 +1,48 @@ error: cannot find derive macro `Sync` in this scope - --> $DIR/deriving-bounds.rs:6:10 + --> $DIR/no-send-sync-derives.rs:6:10 | LL | #[derive(Sync)] | ^^^^ | note: unsafe traits like `Sync` should be implemented explicitly - --> $DIR/deriving-bounds.rs:6:10 + --> $DIR/no-send-sync-derives.rs:6:10 | LL | #[derive(Sync)] | ^^^^ error: cannot find derive macro `Sync` in this scope - --> $DIR/deriving-bounds.rs:6:10 + --> $DIR/no-send-sync-derives.rs:6:10 | LL | #[derive(Sync)] | ^^^^ | note: unsafe traits like `Sync` should be implemented explicitly - --> $DIR/deriving-bounds.rs:6:10 + --> $DIR/no-send-sync-derives.rs:6:10 | LL | #[derive(Sync)] | ^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: cannot find derive macro `Send` in this scope - --> $DIR/deriving-bounds.rs:1:10 + --> $DIR/no-send-sync-derives.rs:1:10 | LL | #[derive(Send)] | ^^^^ | note: unsafe traits like `Send` should be implemented explicitly - --> $DIR/deriving-bounds.rs:1:10 + --> $DIR/no-send-sync-derives.rs:1:10 | LL | #[derive(Send)] | ^^^^ error: cannot find derive macro `Send` in this scope - --> $DIR/deriving-bounds.rs:1:10 + --> $DIR/no-send-sync-derives.rs:1:10 | LL | #[derive(Send)] | ^^^^ | note: unsafe traits like `Send` should be implemented explicitly - --> $DIR/deriving-bounds.rs:1:10 + --> $DIR/no-send-sync-derives.rs:1:10 | LL | #[derive(Send)] | ^^^^ diff --git a/tests/ui/deriving/issue-58319.rs b/tests/ui/derives/six-hundred-fields.rs similarity index 98% rename from tests/ui/deriving/issue-58319.rs rename to tests/ui/derives/six-hundred-fields.rs index 0e847a5b54d4..ed5653c09c5d 100644 --- a/tests/ui/deriving/issue-58319.rs +++ b/tests/ui/derives/six-hundred-fields.rs @@ -1,4 +1,5 @@ -//@ run-pass +//! Regression test for https://github.com/rust-lang/rust/issues/58319. +//@ build-pass fn main() {} #[derive(Clone)] pub struct Little; diff --git a/tests/ui/deriving/deriving-bounds.rs b/tests/ui/deriving/deriving-bounds.rs deleted file mode 100644 index 45fc14420f17..000000000000 --- a/tests/ui/deriving/deriving-bounds.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ check-pass -#[derive(Copy, Clone)] -struct Test; - -pub fn main() {} diff --git a/tests/ui/deriving/deriving-clone-array.rs b/tests/ui/deriving/deriving-clone-array.rs deleted file mode 100644 index 1ee599c8a760..000000000000 --- a/tests/ui/deriving/deriving-clone-array.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass -#![allow(dead_code)] -// test for issue #30244 - -#[derive(Copy, Clone)] -struct Array { - arr: [[u8; 256]; 4] -} - -pub fn main() {} diff --git a/tests/ui/deriving/deriving-clone-enum.rs b/tests/ui/deriving/deriving-clone-enum.rs deleted file mode 100644 index 96b9ba4f24c3..000000000000 --- a/tests/ui/deriving/deriving-clone-enum.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ run-pass -#![allow(dead_code)] - -#[derive(Clone)] -enum E { - A, - B(()), - C -} - -pub fn main() { - let _ = E::A.clone(); -} diff --git a/tests/ui/deriving/deriving-clone-generic-enum.rs b/tests/ui/deriving/deriving-clone-generic-enum.rs deleted file mode 100644 index 08c91c487baa..000000000000 --- a/tests/ui/deriving/deriving-clone-generic-enum.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ run-pass -#![allow(dead_code)] - -#[derive(Clone)] -enum E { - A(T), - B(T,U), - C -} - -pub fn main() { - let _ = E::A::(1).clone(); -} diff --git a/tests/ui/deriving/deriving-clone-generic-struct.rs b/tests/ui/deriving/deriving-clone-generic-struct.rs deleted file mode 100644 index f2fc6d5e4d78..000000000000 --- a/tests/ui/deriving/deriving-clone-generic-struct.rs +++ /dev/null @@ -1,14 +0,0 @@ -//@ run-pass - -#![allow(dead_code)] - -#[derive(Clone)] -struct S { - foo: (), - bar: (), - baz: T, -} - -pub fn main() { - let _ = S { foo: (), bar: (), baz: 1 }.clone(); -} diff --git a/tests/ui/deriving/deriving-clone-generic-tuple-struct.rs b/tests/ui/deriving/deriving-clone-generic-tuple-struct.rs deleted file mode 100644 index 178075e273d7..000000000000 --- a/tests/ui/deriving/deriving-clone-generic-tuple-struct.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ run-pass - -#[derive(Clone)] -#[allow(dead_code)] -struct S(T, ()); - -pub fn main() { - let _ = S(1, ()).clone(); -} diff --git a/tests/ui/deriving/deriving-clone-struct.rs b/tests/ui/deriving/deriving-clone-struct.rs deleted file mode 100644 index 896ce51bf3d8..000000000000 --- a/tests/ui/deriving/deriving-clone-struct.rs +++ /dev/null @@ -1,27 +0,0 @@ -//@ run-pass - -#![allow(dead_code)] - -#[derive(Clone)] -struct S { - _int: isize, - _i8: i8, - _i16: i16, - _i32: i32, - _i64: i64, - - _uint: usize, - _u8: u8, - _u16: u16, - _u32: u32, - _u64: u64, - - _f32: f32, - _f64: f64, - - _bool: bool, - _char: char, - _nil: () -} - -pub fn main() {} diff --git a/tests/ui/deriving/deriving-clone-tuple-struct.rs b/tests/ui/deriving/deriving-clone-tuple-struct.rs deleted file mode 100644 index 622ffb7b1f49..000000000000 --- a/tests/ui/deriving/deriving-clone-tuple-struct.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ run-pass - -#![allow(dead_code)] - -#[derive(Clone)] -struct S((), ()); - -pub fn main() {} diff --git a/tests/ui/deriving/issue-15689-1.rs b/tests/ui/deriving/issue-15689-1.rs deleted file mode 100644 index c81c3359dfce..000000000000 --- a/tests/ui/deriving/issue-15689-1.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass - -#[derive(PartialEq, Debug)] -enum Test<'a> { - Slice(&'a isize) -} - -fn main() { - assert_eq!(Test::Slice(&1), Test::Slice(&1)) -} diff --git a/tests/ui/deriving/issue-15689-2.rs b/tests/ui/deriving/issue-15689-2.rs deleted file mode 100644 index a1f66cc06438..000000000000 --- a/tests/ui/deriving/issue-15689-2.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ check-pass -#![allow(dead_code)] - -#[derive(Clone)] -enum Test<'a> { - Slice(&'a isize) -} - -fn main() {} diff --git a/tests/ui/deriving/issue-3935.rs b/tests/ui/deriving/issue-3935.rs deleted file mode 100644 index 64cb6597b107..000000000000 --- a/tests/ui/deriving/issue-3935.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ run-pass - -#[derive(PartialEq)] -struct Bike { - name: String, -} - -pub fn main() { - let town_bike = Bike { name: "schwinn".to_string() }; - let my_bike = Bike { name: "surly".to_string() }; - - assert!(town_bike != my_bike); -} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.current.stderr index d2ad65b3c791..b43a67a65612 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.current.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.current.stderr @@ -3,6 +3,9 @@ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implement | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | const CONST: () = (); + | --------------------- not a trait implementation | = note: `#[warn(misplaced_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default @@ -11,48 +14,72 @@ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implement | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | static STATIC: () = (); + | ----------------------- not a trait implementation warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations --> $DIR/incorrect-locations.rs:15:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | type Type = (); + | --------------- not a trait implementation warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations --> $DIR/incorrect-locations.rs:19:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | enum Enum {} + | ------------ not a trait implementation warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations --> $DIR/incorrect-locations.rs:23:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | impl Enum {} + | ------------ not a trait implementation warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations --> $DIR/incorrect-locations.rs:27:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | extern "C" {} + | ------------- not a trait implementation warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations --> $DIR/incorrect-locations.rs:31:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | fn fun() {} + | ----------- not a trait implementation warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations --> $DIR/incorrect-locations.rs:35:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | struct Struct {} + | ---------------- not a trait implementation warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations --> $DIR/incorrect-locations.rs:39:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | trait Trait {} + | -------------- not a trait implementation warning: 9 warnings emitted diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.next.stderr index d2ad65b3c791..b43a67a65612 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.next.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.next.stderr @@ -3,6 +3,9 @@ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implement | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | const CONST: () = (); + | --------------------- not a trait implementation | = note: `#[warn(misplaced_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default @@ -11,48 +14,72 @@ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implement | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | static STATIC: () = (); + | ----------------------- not a trait implementation warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations --> $DIR/incorrect-locations.rs:15:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | type Type = (); + | --------------- not a trait implementation warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations --> $DIR/incorrect-locations.rs:19:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | enum Enum {} + | ------------ not a trait implementation warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations --> $DIR/incorrect-locations.rs:23:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | impl Enum {} + | ------------ not a trait implementation warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations --> $DIR/incorrect-locations.rs:27:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | extern "C" {} + | ------------- not a trait implementation warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations --> $DIR/incorrect-locations.rs:31:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | fn fun() {} + | ----------- not a trait implementation warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations --> $DIR/incorrect-locations.rs:35:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | struct Struct {} + | ---------------- not a trait implementation warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations --> $DIR/incorrect-locations.rs:39:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | trait Trait {} + | -------------- not a trait implementation warning: 9 warnings emitted diff --git a/tests/ui/diagnostic_namespace/on_const/misplaced_attr.rs b/tests/ui/diagnostic_namespace/on_const/misplaced_attr.rs index 48654ed47ec4..a580f540a847 100644 --- a/tests/ui/diagnostic_namespace/on_const/misplaced_attr.rs +++ b/tests/ui/diagnostic_namespace/on_const/misplaced_attr.rs @@ -2,11 +2,11 @@ #![deny(misplaced_diagnostic_attributes)] #[diagnostic::on_const(message = "tadaa", note = "boing")] -//~^ ERROR: `#[diagnostic::on_const]` can only be applied to trait impls +//~^ ERROR: `#[diagnostic::on_const]` can only be applied to non-const trait implementations pub struct Foo; #[diagnostic::on_const(message = "tadaa", note = "boing")] -//~^ ERROR: `#[diagnostic::on_const]` can only be applied to non-const trait impls +//~^ ERROR: `#[diagnostic::on_const]` can only be applied to non-const trait implementations impl const PartialEq for Foo { fn eq(&self, _other: &Foo) -> bool { true @@ -14,7 +14,7 @@ fn eq(&self, _other: &Foo) -> bool { } #[diagnostic::on_const(message = "tadaa", note = "boing")] -//~^ ERROR: `#[diagnostic::on_const]` can only be applied to trait impls +//~^ ERROR: `#[diagnostic::on_const]` can only be applied to non-const trait implementations impl Foo { fn eq(&self, _other: &Foo) -> bool { true @@ -23,7 +23,7 @@ fn eq(&self, _other: &Foo) -> bool { impl PartialOrd for Foo { #[diagnostic::on_const(message = "tadaa", note = "boing")] - //~^ ERROR: `#[diagnostic::on_const]` can only be applied to trait impls + //~^ ERROR: `#[diagnostic::on_const]` can only be applied to non-const trait implementations fn partial_cmp(&self, other: &Foo) -> Option { None } diff --git a/tests/ui/diagnostic_namespace/on_const/misplaced_attr.stderr b/tests/ui/diagnostic_namespace/on_const/misplaced_attr.stderr index f92ea501696e..0efead672030 100644 --- a/tests/ui/diagnostic_namespace/on_const/misplaced_attr.stderr +++ b/tests/ui/diagnostic_namespace/on_const/misplaced_attr.stderr @@ -1,11 +1,11 @@ -error: `#[diagnostic::on_const]` can only be applied to trait impls - --> $DIR/misplaced_attr.rs:4:1 +error: `#[diagnostic::on_const]` can only be applied to non-const trait implementations + --> $DIR/misplaced_attr.rs:8:1 | LL | #[diagnostic::on_const(message = "tadaa", note = "boing")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | -LL | pub struct Foo; - | -------------- not a trait impl +LL | impl const PartialEq for Foo { + | ---------------------------- this is a const trait implementation | note: the lint level is defined here --> $DIR/misplaced_attr.rs:2:9 @@ -13,32 +13,38 @@ note: the lint level is defined here LL | #![deny(misplaced_diagnostic_attributes)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: `#[diagnostic::on_const]` can only be applied to non-const trait impls - --> $DIR/misplaced_attr.rs:8:1 +error: `#[diagnostic::on_const]` can only be applied to non-const trait implementations + --> $DIR/misplaced_attr.rs:4:1 | LL | #[diagnostic::on_const(message = "tadaa", note = "boing")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | -LL | impl const PartialEq for Foo { - | ---------------------------- this is a const trait impl +LL | pub struct Foo; + | --------------- not a trait implementation -error: `#[diagnostic::on_const]` can only be applied to trait impls +error: `#[diagnostic::on_const]` can only be applied to non-const trait implementations --> $DIR/misplaced_attr.rs:16:1 | -LL | #[diagnostic::on_const(message = "tadaa", note = "boing")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[diagnostic::on_const(message = "tadaa", note = "boing")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | -LL | impl Foo { - | -------- not a trait impl +LL | / impl Foo { +LL | | fn eq(&self, _other: &Foo) -> bool { +LL | | true +LL | | } +LL | | } + | |_- not a trait implementation -error: `#[diagnostic::on_const]` can only be applied to trait impls +error: `#[diagnostic::on_const]` can only be applied to non-const trait implementations --> $DIR/misplaced_attr.rs:25:5 | -LL | #[diagnostic::on_const(message = "tadaa", note = "boing")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[diagnostic::on_const(message = "tadaa", note = "boing")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | -LL | fn partial_cmp(&self, other: &Foo) -> Option { - | ---------------------------------------------------------------- not a trait impl +LL | / fn partial_cmp(&self, other: &Foo) -> Option { +LL | | None +LL | | } + | |_____- not a trait implementation error: aborting due to 4 previous errors diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr index 65d92e4592d0..9ed72d334b27 100644 --- a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr +++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr @@ -1,11 +1,3 @@ -warning: `#[diagnostic::on_unimplemented]` can only be applied to trait definitions - --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:22:1 - | -LL | #[diagnostic::on_unimplemented(message = "Not allowed to apply it on a impl")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(misplaced_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default - warning: there is no parameter `from_desugaring` on trait `Baz` --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:29:17 | @@ -152,6 +144,14 @@ LL | #[diagnostic::on_unimplemented = "Message"] | = help: only `message`, `note` and `label` are allowed as options +warning: `#[diagnostic::on_unimplemented]` can only be applied to trait definitions + --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:22:1 + | +LL | #[diagnostic::on_unimplemented(message = "Not allowed to apply it on a impl")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(misplaced_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default + error[E0277]: trait has `()` and `i32` as params --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:53:15 | diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr index 14d3c0db1ec9..d5c7f25efbc2 100644 --- a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr +++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr @@ -1,11 +1,3 @@ -warning: `#[diagnostic::on_unimplemented]` can only be applied to trait definitions - --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:7:1 - | -LL | #[diagnostic::on_unimplemented(message = "Baz")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(misplaced_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default - warning: there is no parameter `DoesNotExist` on trait `Test` --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:31:44 | @@ -24,6 +16,14 @@ LL | #[diagnostic::on_unimplemented(unsupported = "foo")] = help: only `message`, `note` and `label` are allowed as options = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default +warning: `#[diagnostic::on_unimplemented]` can only be applied to trait definitions + --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:7:1 + | +LL | #[diagnostic::on_unimplemented(message = "Baz")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(misplaced_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default + warning: malformed `diagnostic::on_unimplemented` attribute --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:11:50 | diff --git a/tests/ui/diagnostic_namespace/on_unknown/incorrect-locations.stderr b/tests/ui/diagnostic_namespace/on_unknown/incorrect-locations.stderr index 33636e1fcfc3..c7636217af3e 100644 --- a/tests/ui/diagnostic_namespace/on_unknown/incorrect-locations.stderr +++ b/tests/ui/diagnostic_namespace/on_unknown/incorrect-locations.stderr @@ -5,7 +5,7 @@ LL | #[diagnostic::on_unknown(message = "foo")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | extern crate std as other_std; - | ----------------------------- not an import + | ------------------------------ not an import | = note: `#[warn(misplaced_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default @@ -16,7 +16,7 @@ LL | #[diagnostic::on_unknown(message = "foo")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | const CONST: () = (); - | --------------- not an import + | --------------------- not an import warning: `#[diagnostic::on_unknown]` can only be applied to `use` statements --> $DIR/incorrect-locations.rs:13:1 @@ -25,7 +25,7 @@ LL | #[diagnostic::on_unknown(message = "foo")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | static STATIC: () = (); - | ----------------- not an import + | ----------------------- not an import warning: `#[diagnostic::on_unknown]` can only be applied to `use` statements --> $DIR/incorrect-locations.rs:17:1 @@ -34,7 +34,7 @@ LL | #[diagnostic::on_unknown(message = "foo")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | type Type = (); - | --------- not an import + | --------------- not an import warning: `#[diagnostic::on_unknown]` can only be applied to `use` statements --> $DIR/incorrect-locations.rs:21:1 @@ -43,7 +43,7 @@ LL | #[diagnostic::on_unknown(message = "foo")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | enum Enum {} - | --------- not an import + | ------------ not an import warning: `#[diagnostic::on_unknown]` can only be applied to `use` statements --> $DIR/incorrect-locations.rs:25:1 @@ -52,7 +52,7 @@ LL | #[diagnostic::on_unknown(message = "foo")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | impl Enum {} - | --------- not an import + | ------------ not an import warning: `#[diagnostic::on_unknown]` can only be applied to `use` statements --> $DIR/incorrect-locations.rs:29:1 @@ -70,7 +70,7 @@ LL | #[diagnostic::on_unknown(message = "foo")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | fn fun() {} - | -------- not an import + | ----------- not an import warning: `#[diagnostic::on_unknown]` can only be applied to `use` statements --> $DIR/incorrect-locations.rs:37:1 @@ -79,7 +79,7 @@ LL | #[diagnostic::on_unknown(message = "foo")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | struct Struct {} - | ------------- not an import + | ---------------- not an import warning: `#[diagnostic::on_unknown]` can only be applied to `use` statements --> $DIR/incorrect-locations.rs:41:1 @@ -88,7 +88,7 @@ LL | #[diagnostic::on_unknown(message = "foo")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | trait Trait {} - | ----------- not an import + | -------------- not an import warning: `#[diagnostic::on_unknown]` can only be applied to `use` statements --> $DIR/incorrect-locations.rs:45:1 @@ -97,7 +97,7 @@ LL | #[diagnostic::on_unknown(message = "foo")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | impl Trait for i32 {} - | ------------------ not an import + | --------------------- not an import warning: 11 warnings emitted diff --git a/tests/ui/higher-ranked/structually-relate-aliases.stderr b/tests/ui/higher-ranked/structually-relate-aliases.stderr index f8fcb73db447..4649aac47cdb 100644 --- a/tests/ui/higher-ranked/structually-relate-aliases.stderr +++ b/tests/ui/higher-ranked/structually-relate-aliases.stderr @@ -1,4 +1,4 @@ - WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTerm { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a))], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit), .. } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTerm { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a))], kind: ProjectionTy { def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) }, .. } error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied --> $DIR/structually-relate-aliases.rs:13:36 | diff --git a/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-impl-trait.stderr b/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-impl-trait.stderr index 6a485881bfcc..2447a5d8d4b8 100644 --- a/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-impl-trait.stderr +++ b/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-impl-trait.stderr @@ -2,8 +2,11 @@ error[E0308]: mismatched types --> $DIR/dyn-incompatible-trait-in-return-position-impl-trait.rs:36:5 | LL | fn can() -> impl DynIncompatible { - | -------------------- expected `A` because of return type -... + | -------------------- expected a single type implementing `DynIncompatible` because of return type +LL | if true { +LL | return A; + | - return type resolved to be `A` +LL | } LL | B | ^ expected `A`, found `B` @@ -11,8 +14,11 @@ error[E0308]: mismatched types --> $DIR/dyn-incompatible-trait-in-return-position-impl-trait.rs:43:5 | LL | fn cat() -> impl DynCompatible { - | ------------------ expected `A` because of return type -... + | ------------------ expected a single type implementing `DynCompatible` because of return type +LL | if true { +LL | return A; + | - return type resolved to be `A` +LL | } LL | B | ^ expected `A`, found `B` diff --git a/tests/ui/impl-trait/equality.stderr b/tests/ui/impl-trait/equality.stderr index 3c765da66bdc..a44be9605251 100644 --- a/tests/ui/impl-trait/equality.stderr +++ b/tests/ui/impl-trait/equality.stderr @@ -2,8 +2,11 @@ error[E0308]: mismatched types --> $DIR/equality.rs:17:5 | LL | fn two(x: bool) -> impl Foo { - | -------- expected `i32` because of return type -... + | -------- expected a single type implementing `Foo` because of return type +LL | if x { +LL | return 1_i32; + | ----- return type resolved to be `i32` +LL | } LL | 0_u32 | ^^^^^ expected `i32`, found `u32` | diff --git a/tests/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.stderr b/tests/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.stderr index b2aa0e592df7..2a4c5ff4a5be 100644 --- a/tests/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.stderr +++ b/tests/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.stderr @@ -64,8 +64,11 @@ error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:5:5 | LL | fn foo() -> impl std::fmt::Display { - | ---------------------- expected `i32` because of return type -... + | ---------------------- expected a single type implementing `std::fmt::Display` because of return type +LL | if false { +LL | return 0i32; + | ---- return type resolved to be `i32` +LL | } LL | 1u32 | ^^^^ expected `i32`, found `u32` | @@ -79,8 +82,11 @@ error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:12:16 | LL | fn bar() -> impl std::fmt::Display { - | ---------------------- expected `i32` because of return type -... + | ---------------------- expected a single type implementing `std::fmt::Display` because of return type +LL | if false { +LL | return 0i32; + | ---- return type resolved to be `i32` +LL | } else { LL | return 1u32; | ^^^^ expected `i32`, found `u32` | @@ -94,8 +100,11 @@ error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:20:9 | LL | fn baz() -> impl std::fmt::Display { - | ---------------------- expected `i32` because of return type -... + | ---------------------- expected a single type implementing `std::fmt::Display` because of return type +LL | if false { +LL | return 0i32; + | ---- return type resolved to be `i32` +LL | } else { LL | 1u32 | ^^^^ expected `i32`, found `u32` | @@ -137,8 +146,10 @@ error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:35:14 | LL | fn bat() -> impl std::fmt::Display { - | ---------------------- expected `i32` because of return type -... + | ---------------------- expected a single type implementing `std::fmt::Display` because of return type +LL | match 13 { +LL | 0 => return 0i32, + | ---- return type resolved to be `i32` LL | _ => 1u32, | ^^^^ expected `i32`, found `u32` | @@ -151,9 +162,10 @@ error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:40:5 | LL | fn can() -> impl std::fmt::Display { - | ---------------------- expected `i32` because of return type + | ---------------------- expected a single type implementing `std::fmt::Display` because of return type LL | / match 13 { LL | | 0 => return 0i32, + | | ---- return type resolved to be `i32` LL | | 1 => 1u32, LL | | _ => 2u32, LL | | } @@ -168,7 +180,10 @@ error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:53:13 | LL | fn cat() -> impl std::fmt::Display { - | ---------------------- expected `i32` because of return type + | ---------------------- expected a single type implementing `std::fmt::Display` because of return type +... +LL | return 0i32; + | ---- return type resolved to be `i32` ... LL | 1u32 | ^^^^ expected `i32`, found `u32` diff --git a/tests/ui/imports/import-inherent-148009.rs b/tests/ui/imports/import-inherent-148009.rs new file mode 100644 index 000000000000..81d176ca182c --- /dev/null +++ b/tests/ui/imports/import-inherent-148009.rs @@ -0,0 +1,68 @@ +//! Check that when the feature `import_trait_associated_functions` is enabled, +//! and one trys to import inherent associated items, the error message is +//! updated to reflect that only trait associated items can be imported. +//! +//! Regression test for . + +//@ check-fail + +#![feature(import_trait_associated_functions, extern_types)] + +pub struct TestStruct; + +impl TestStruct { + pub fn m1() {} + pub const C1: usize = 0; +} + +pub use self::TestStruct::{C1, m1}; +//~^ ERROR unresolved import `self::TestStruct` [E0432] +//~| NOTE `TestStruct` is a struct, not a module or a trait +//~| NOTE cannot import inherent associated items, only trait associated items + +pub union TestUnion { + pub f: f32, + pub i: i32, +} + +impl TestUnion { + pub fn m2() {} + pub const C2: usize = 0; +} + +pub use self::TestUnion::{C2, m2}; +//~^ ERROR unresolved import `self::TestUnion` [E0432] +//~| NOTE `TestUnion` is a union, not a module or a trait +//~| NOTE cannot import inherent associated items, only trait associated items + +pub enum TestEnum { + V1, + V2, +} + +impl TestEnum { + pub fn m3() {} + pub const C3: usize = 0; +} + +pub use self::TestEnum::{C3, m3}; +//~^ ERROR unresolved imports `self::TestEnum::C3`, `self::TestEnum::m3` [E0432] +//~| NOTE no `m3` in `TestEnum` +//~| NOTE no `C3` in `TestEnum` +//~| NOTE cannot import inherent associated items, only trait associated items + +extern "C" { + pub type TestForeignTy; +} + +impl TestForeignTy { + pub fn m4() {} + pub const C4: usize = 0; +} + +pub use self::TestForeignTy::{C4, m4}; +//~^ ERROR unresolved import `self::TestForeignTy` [E0432] +//~| NOTE `TestForeignTy` is a foreign type, not a module or a trait +//~| NOTE cannot import inherent associated items, only trait associated items + +fn main() {} diff --git a/tests/ui/imports/import-inherent-148009.stderr b/tests/ui/imports/import-inherent-148009.stderr new file mode 100644 index 000000000000..3265a0f54b65 --- /dev/null +++ b/tests/ui/imports/import-inherent-148009.stderr @@ -0,0 +1,37 @@ +error[E0432]: unresolved import `self::TestStruct` + --> $DIR/import-inherent-148009.rs:18:15 + | +LL | pub use self::TestStruct::{C1, m1}; + | ^^^^^^^^^^ `TestStruct` is a struct, not a module or a trait + | + = note: cannot import inherent associated items, only trait associated items + +error[E0432]: unresolved import `self::TestUnion` + --> $DIR/import-inherent-148009.rs:33:15 + | +LL | pub use self::TestUnion::{C2, m2}; + | ^^^^^^^^^ `TestUnion` is a union, not a module or a trait + | + = note: cannot import inherent associated items, only trait associated items + +error[E0432]: unresolved imports `self::TestEnum::C3`, `self::TestEnum::m3` + --> $DIR/import-inherent-148009.rs:48:26 + | +LL | pub use self::TestEnum::{C3, m3}; + | ^^ ^^ no `m3` in `TestEnum` + | | + | no `C3` in `TestEnum` + | + = note: cannot import inherent associated items, only trait associated items + +error[E0432]: unresolved import `self::TestForeignTy` + --> $DIR/import-inherent-148009.rs:63:15 + | +LL | pub use self::TestForeignTy::{C4, m4}; + | ^^^^^^^^^^^^^ `TestForeignTy` is a foreign type, not a module or a trait + | + = note: cannot import inherent associated items, only trait associated items + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0432`. diff --git a/tests/ui/lint/dead-code/expect-dead-code-152370.rs b/tests/ui/lint/dead-code/expect-dead-code-152370.rs new file mode 100644 index 000000000000..d33d9fb713b0 --- /dev/null +++ b/tests/ui/lint/dead-code/expect-dead-code-152370.rs @@ -0,0 +1,13 @@ +//@ check-pass + +#[expect(unused)] +trait UnusedTrait {} + +struct UsedStruct(u32); + +impl UnusedTrait for UsedStruct {} + +fn main() { + let x = UsedStruct(12); + println!("Hello World! {}", x.0); +} diff --git a/tests/ui/lint/dead-code/expect-dead-code-154324.rs b/tests/ui/lint/dead-code/expect-dead-code-154324.rs new file mode 100644 index 000000000000..1ee2965fc3b0 --- /dev/null +++ b/tests/ui/lint/dead-code/expect-dead-code-154324.rs @@ -0,0 +1,9 @@ +//@ check-pass + +#![deny(dead_code, unfulfilled_lint_expectations, reason = "example")] +#![expect(dead_code, reason = "example")] + +struct Foo; +impl Foo {} + +fn main() {} diff --git a/tests/ui/lint/dead-code/expect-dead-code-field-read-in-dead-fn.rs b/tests/ui/lint/dead-code/expect-dead-code-field-read-in-dead-fn.rs new file mode 100644 index 000000000000..1af0bf1645e2 --- /dev/null +++ b/tests/ui/lint/dead-code/expect-dead-code-field-read-in-dead-fn.rs @@ -0,0 +1,19 @@ +//@ check-pass + +#![deny(unfulfilled_lint_expectations)] +#![warn(dead_code)] + +struct Foo { + #[expect(dead_code)] + value: usize, +} + +#[expect(dead_code)] +fn dead_reads_field() { + let foo = Foo { value: 0 }; + let _ = foo.value; +} + +fn main() { + let _ = Foo { value: 0 }; +} diff --git a/tests/ui/lint/dead-code/expect-dead-code-through-non-expect-item.rs b/tests/ui/lint/dead-code/expect-dead-code-through-non-expect-item.rs new file mode 100644 index 000000000000..84d805647d1b --- /dev/null +++ b/tests/ui/lint/dead-code/expect-dead-code-through-non-expect-item.rs @@ -0,0 +1,18 @@ +//@ check-pass + +#![deny(unfulfilled_lint_expectations)] +#![warn(dead_code)] + +#[expect(dead_code)] +fn root() { + middle(); +} + +fn middle() { + leaf(); +} + +#[expect(dead_code)] +fn leaf() {} + +fn main() {} diff --git a/tests/ui/suggestions/suggest-create-closure-issue-150701.fixed b/tests/ui/suggestions/suggest-create-closure-issue-150701.fixed new file mode 100644 index 000000000000..f3e226c9e568 --- /dev/null +++ b/tests/ui/suggestions/suggest-create-closure-issue-150701.fixed @@ -0,0 +1,15 @@ +// Regression test for #150701 + +//@ run-rustfix +//@ edition: 2024 + +use std::future::Future; + +fn f(_c: impl Future) {} + +fn main() { + f((async || {})()); //~ ERROR: expected function, found `()` + //~^ ERROR: is not a future + f(async {}); + //~^ ERROR: is not a future +} diff --git a/tests/ui/suggestions/suggest-create-closure-issue-150701.rs b/tests/ui/suggestions/suggest-create-closure-issue-150701.rs new file mode 100644 index 000000000000..e7a5076d8f1d --- /dev/null +++ b/tests/ui/suggestions/suggest-create-closure-issue-150701.rs @@ -0,0 +1,15 @@ +// Regression test for #150701 + +//@ run-rustfix +//@ edition: 2024 + +use std::future::Future; + +fn f(_c: impl Future) {} + +fn main() { + f(async || {}()); //~ ERROR: expected function, found `()` + //~^ ERROR: is not a future + f(async || {}); + //~^ ERROR: is not a future +} diff --git a/tests/ui/suggestions/suggest-create-closure-issue-150701.stderr b/tests/ui/suggestions/suggest-create-closure-issue-150701.stderr new file mode 100644 index 000000000000..0f991169d677 --- /dev/null +++ b/tests/ui/suggestions/suggest-create-closure-issue-150701.stderr @@ -0,0 +1,52 @@ +error[E0618]: expected function, found `()` + --> $DIR/suggest-create-closure-issue-150701.rs:11:16 + | +LL | f(async || {}()); + | ^^-- + | | + | call expression requires function + | +help: if you meant to create this closure and immediately call it, surround the closure with parentheses + | +LL | f((async || {})()); + | + + + +error[E0277]: `{async closure@$DIR/suggest-create-closure-issue-150701.rs:11:7: 11:15}` is not a future + --> $DIR/suggest-create-closure-issue-150701.rs:11:7 + | +LL | f(async || {}()); + | - ^^^^^^^^^^^^^ `{async closure@$DIR/suggest-create-closure-issue-150701.rs:11:7: 11:15}` is not a future + | | + | required by a bound introduced by this call + | + = help: the trait `Future` is not implemented for `{async closure@$DIR/suggest-create-closure-issue-150701.rs:11:7: 11:15}` +note: required by a bound in `f` + --> $DIR/suggest-create-closure-issue-150701.rs:8:15 + | +LL | fn f(_c: impl Future) {} + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `f` + +error[E0277]: `{async closure@$DIR/suggest-create-closure-issue-150701.rs:13:7: 13:15}` is not a future + --> $DIR/suggest-create-closure-issue-150701.rs:13:7 + | +LL | f(async || {}); + | - ^^^^^^^^^^^ `{async closure@$DIR/suggest-create-closure-issue-150701.rs:13:7: 13:15}` is not a future + | | + | required by a bound introduced by this call + | + = help: the trait `Future` is not implemented for `{async closure@$DIR/suggest-create-closure-issue-150701.rs:13:7: 13:15}` +note: required by a bound in `f` + --> $DIR/suggest-create-closure-issue-150701.rs:8:15 + | +LL | fn f(_c: impl Future) {} + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `f` +help: use `async {}` instead of `async || {}` to introduce an async block + | +LL - f(async || {}); +LL + f(async {}); + | + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0277, E0618. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr index cb6df5af7fb1..e32b2d4a30c8 100644 --- a/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr +++ b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr @@ -14,9 +14,8 @@ LL | fn call(&self, _: impl Display) {} | ^^^^^^^ required by this bound in `S::call` help: use parentheses to call this closure | -LL - S.call(|| "hello"); -LL + S.call((|| "hello")()); - | +LL | S.call((|| "hello")()); + | + +++ error: aborting due to 1 previous error diff --git a/tests/ui/traits/const-traits/const-closure-inherited-const-condition.rs b/tests/ui/traits/const-traits/const-closure-inherited-const-condition.rs new file mode 100644 index 000000000000..b1c929bf78cd --- /dev/null +++ b/tests/ui/traits/const-traits/const-closure-inherited-const-condition.rs @@ -0,0 +1,11 @@ +//@ check-pass +//@ revisions: next old +//@[next] compile-flags: -Znext-solver + +#![feature(const_closures, const_trait_impl)] + +const trait Foo {} + +const fn qux() { (const || {})() } + +fn main() {} diff --git a/tests/ui/traits/next-solver/issue-118950-root-region.stderr b/tests/ui/traits/next-solver/issue-118950-root-region.stderr index a4c8d259406b..32adbb491bee 100644 --- a/tests/ui/traits/next-solver/issue-118950-root-region.stderr +++ b/tests/ui/traits/next-solver/issue-118950-root-region.stderr @@ -16,7 +16,7 @@ help: this trait has no implementations, consider adding one LL | trait ToUnit<'a> { | ^^^^^^^^^^^^^^^^ - WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTerm { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a)), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc), .. } + WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTerm { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a)), ?1t], kind: FreeTy { def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }, .. } error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0425. diff --git a/tests/ui/whitespace/ascii_whitespace_excludes_vertical_tab.rs b/tests/ui/whitespace/ascii_whitespace_excludes_vertical_tab.rs new file mode 100644 index 000000000000..aa4c09a9ba48 --- /dev/null +++ b/tests/ui/whitespace/ascii_whitespace_excludes_vertical_tab.rs @@ -0,0 +1,22 @@ +//@ run-pass +// This test checks that split_ascii_whitespace does NOT split on +// vertical tab (\x0B), because the standard library uses the WhatWG +// Infra Standard definition of ASCII whitespace, which excludes +// vertical tab. +// +// See: https://github.com/rust-lang/rust-project-goals/issues/53 + +fn main() { + let s = "a\x0Bb"; + + let parts: Vec<&str> = s.split_ascii_whitespace().collect(); + + assert_eq!(parts.len(), 1, + "vertical tab should not be treated as ASCII whitespace"); + + let s2 = "a b"; + let parts2: Vec<&str> = s2.split_ascii_whitespace().collect(); + assert_eq!(parts2.len(), 2, + "regular space should split correctly"); + +} diff --git a/tests/ui/whitespace/invalid_whitespace.rs b/tests/ui/whitespace/invalid_whitespace.rs new file mode 100644 index 000000000000..809c8e2af0a2 --- /dev/null +++ b/tests/ui/whitespace/invalid_whitespace.rs @@ -0,0 +1,13 @@ +// This test ensures that the Rust lexer rejects invalid whitespace +// characters such as ZERO WIDTH SPACE. + +//@ check-fail + +fn main() { + let x = 5; + let y = 10; + + let a=​x + y; + //~^ ERROR unknown start of token + //~| HELP invisible characters like +} diff --git a/tests/ui/whitespace/invalid_whitespace.stderr b/tests/ui/whitespace/invalid_whitespace.stderr new file mode 100644 index 000000000000..ebd203aa4103 --- /dev/null +++ b/tests/ui/whitespace/invalid_whitespace.stderr @@ -0,0 +1,10 @@ +error: unknown start of token: \u{200b} + --> $DIR/invalid_whitespace.rs:10:11 + | +LL | let a=​x + y; + | ^ + | + = help: invisible characters like '\u{200b}' are not usually visible in text editors + +error: aborting due to 1 previous error + diff --git a/tests/ui/whitespace/vertical_tab_lexer.rs b/tests/ui/whitespace/vertical_tab_lexer.rs new file mode 100644 index 000000000000..75f4543a1fe2 --- /dev/null +++ b/tests/ui/whitespace/vertical_tab_lexer.rs @@ -0,0 +1,58 @@ +//@ run-pass +// ignore-tidy-tab +// +// Tests that the Rust lexer accepts Unicode Pattern_White_Space characters. +// +// Worth noting: the Rust reference defines whitespace as Pattern_White_Space, +// which is not the same as what is_ascii_whitespace or is_whitespace give you. +// +// is_ascii_whitespace follows WhatWG and skips vertical tab (\x0B). +// is_whitespace uses Unicode White_Space, which is a broader set. +// +// The 11 characters that actually count as whitespace in Rust source: +// \x09 \x0A \x0B \x0C \x0D \x20 \u{85} \u{200E} \u{200F} \u{2028} \u{2029} +// +// Ref: https://github.com/rustfoundation/interop-initiative/issues/53 + +#[rustfmt::skip] +fn main() { + // tab (\x09) between let and the name + let _ws1 = 1_i32; + + // vertical tab (\x0B) between let and the name + // this is the one is_ascii_whitespace gets wrong + let _ws2 = 2_i32; + + // form feed (\x0C) between let and the name + let _ws3 = 3_i32; + + // plain space (\x20), here just so every character is represented + let _ws4 = 4_i32; + + // NEL (\u{85}) between let and the name + let…_ws5 = 5_i32; + + // left-to-right mark (\u{200E}) between let and the name + let‎_ws6 = 6_i32; + + // right-to-left mark (\u{200F}) between let and the name + let‏_ws7 = 7_i32; + + // \x0A, \x0D, \u{2028}, \u{2029} are also Pattern_White_Space but they + // act as line endings, so you can't stick them in the middle of a statement. + // The lexer still handles them correctly at line boundaries. + + // These are Unicode White_Space but NOT Pattern_White_Space: + // \u{A0} no-break space \u{1680} ogham space mark + // \u{2000} en quad \u{2001} em quad + // \u{2002} en space \u{2003} em space + // \u{2004} three-per-em space \u{2005} four-per-em space + // \u{2006} six-per-em space \u{2007} figure space + // \u{2008} punctuation space \u{2009} thin space + // \u{200A} hair space \u{202F} narrow no-break space + // \u{205F} medium math space \u{3000} ideographic space + + // add them up so the compiler doesn't complain about unused variables + let _sum = _ws1 + _ws2 + _ws3 + _ws4 + _ws5 + _ws6 + _ws7; + println!("{}", _sum); +}