1
Fork 0

Auto merge of #84373 - cjgillot:resolve-span, r=michaelwoerister,petrochenkov

Encode spans relative to the enclosing item

The aim of this PR is to avoid recomputing queries when code is moved without modification.

MCP at https://github.com/rust-lang/compiler-team/issues/443

This is achieved by :
1. storing the HIR owner LocalDefId information inside the span;
2. encoding and decoding spans relative to the enclosing item in the incremental on-disk cache;
3. marking a dependency to the `source_span(LocalDefId)` query when we translate a span from the short (`Span`) representation to its explicit (`SpanData`) representation.

Since all client code uses `Span`, step 3 ensures that all manipulations
of span byte positions actually create the dependency edge between
the caller and the `source_span(LocalDefId)`.
This query return the actual absolute span of the parent item.
As a consequence, any source code motion that changes the absolute byte position of a node will either:
- modify the distance to the parent's beginning, so change the relative span's hash;
- dirty `source_span`, and trigger the incremental recomputation of all code that
  depends on the span's absolute byte position.

With this scheme, I believe the dependency tracking to be accurate.

For the moment, the spans are marked during lowering.
I'd rather do this during def-collection,
but the AST MutVisitor is not practical enough just yet.
The only difference is that we attach macro-expanded spans
to their expansion point instead of the macro itself.
This commit is contained in:
bors 2021-09-11 23:35:28 +00:00
commit 547d9374d2
68 changed files with 2800 additions and 1170 deletions

View file

@ -367,7 +367,7 @@ impl MetaItem {
let is_first = i == 0; let is_first = i == 0;
if !is_first { if !is_first {
let mod_sep_span = let mod_sep_span =
Span::new(last_pos, segment.ident.span.lo(), segment.ident.span.ctxt()); Span::new(last_pos, segment.ident.span.lo(), segment.ident.span.ctxt(), None);
idents.push(TokenTree::token(token::ModSep, mod_sep_span).into()); idents.push(TokenTree::token(token::ModSep, mod_sep_span).into());
} }
idents.push(TokenTree::Token(Token::from_ast_ident(segment.ident)).into()); idents.push(TokenTree::Token(Token::from_ast_ident(segment.ident)).into());

View file

@ -422,7 +422,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
let if_kind = hir::ExprKind::If(new_cond, self.arena.alloc(then), Some(else_expr)); let if_kind = hir::ExprKind::If(new_cond, self.arena.alloc(then), Some(else_expr));
let if_expr = self.expr(span, if_kind, ThinVec::new()); let if_expr = self.expr(span, if_kind, ThinVec::new());
let block = self.block_expr(self.arena.alloc(if_expr)); let block = self.block_expr(self.arena.alloc(if_expr));
hir::ExprKind::Loop(block, opt_label, hir::LoopSource::While, span.with_hi(cond.span.hi())) let span = self.lower_span(span.with_hi(cond.span.hi()));
let opt_label = self.lower_label(opt_label);
hir::ExprKind::Loop(block, opt_label, hir::LoopSource::While, span)
} }
/// Desugar `try { <stmts>; <expr> }` into `{ <stmts>; ::std::ops::Try::from_output(<expr>) }`, /// Desugar `try { <stmts>; <expr> }` into `{ <stmts>; ::std::ops::Try::from_output(<expr>) }`,

View file

@ -165,6 +165,8 @@ struct LoweringContext<'a, 'hir: 'a> {
pub trait ResolverAstLowering { pub trait ResolverAstLowering {
fn def_key(&mut self, id: DefId) -> DefKey; fn def_key(&mut self, id: DefId) -> DefKey;
fn def_span(&self, id: LocalDefId) -> Span;
fn item_generics_num_lifetimes(&self, def: DefId) -> usize; fn item_generics_num_lifetimes(&self, def: DefId) -> usize;
fn legacy_const_generic_args(&mut self, expr: &Expr) -> Option<Vec<usize>>; fn legacy_const_generic_args(&mut self, expr: &Expr) -> Option<Vec<usize>>;
@ -215,6 +217,11 @@ impl<'a> rustc_span::HashStableContext for LoweringHasher<'a> {
true true
} }
#[inline]
fn def_span(&self, id: LocalDefId) -> Span {
self.resolver.def_span(id)
}
#[inline] #[inline]
fn def_path_hash(&self, def_id: DefId) -> DefPathHash { fn def_path_hash(&self, def_id: DefId) -> DefPathHash {
self.resolver.def_path_hash(def_id) self.resolver.def_path_hash(def_id)
@ -711,9 +718,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
} }
/// Intercept all spans entering HIR. /// Intercept all spans entering HIR.
/// For now we are not doing anything with the intercepted spans. /// Mark a span as relative to the current owning item.
fn lower_span(&self, span: Span) -> Span { fn lower_span(&self, span: Span) -> Span {
span if self.sess.opts.debugging_opts.incremental_relative_spans {
span.with_parent(Some(self.current_hir_id_owner.0))
} else {
// Do not make spans relative when not using incremental compilation.
span
}
} }
fn lower_ident(&self, ident: Ident) -> Ident { fn lower_ident(&self, ident: Ident) -> Ident {
@ -781,7 +793,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
node_id, node_id,
DefPathData::LifetimeNs(str_name), DefPathData::LifetimeNs(str_name),
ExpnId::root(), ExpnId::root(),
span, span.with_parent(None),
); );
hir::GenericParam { hir::GenericParam {
@ -1513,7 +1525,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
def_node_id, def_node_id,
DefPathData::LifetimeNs(name.ident().name), DefPathData::LifetimeNs(name.ident().name),
ExpnId::root(), ExpnId::root(),
span, span.with_parent(None),
); );
let (name, kind) = match name { let (name, kind) = match name {

View file

@ -15,7 +15,7 @@ use rustc_lint_defs::builtin::PROC_MACRO_BACK_COMPAT;
use rustc_lint_defs::BuiltinLintDiagnostics; use rustc_lint_defs::BuiltinLintDiagnostics;
use rustc_parse::{self, nt_to_tokenstream, parser, MACRO_ARGUMENTS}; use rustc_parse::{self, nt_to_tokenstream, parser, MACRO_ARGUMENTS};
use rustc_session::{parse::ParseSess, Limit, Session}; use rustc_session::{parse::ParseSess, Limit, Session};
use rustc_span::def_id::{CrateNum, DefId}; use rustc_span::def_id::{CrateNum, DefId, LocalDefId};
use rustc_span::edition::Edition; use rustc_span::edition::Edition;
use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId}; use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId};
use rustc_span::source_map::SourceMap; use rustc_span::source_map::SourceMap;
@ -843,6 +843,7 @@ pub type DeriveResolutions = Vec<(ast::Path, Annotatable, Option<Lrc<SyntaxExten
pub trait ResolverExpand { pub trait ResolverExpand {
fn next_node_id(&mut self) -> NodeId; fn next_node_id(&mut self) -> NodeId;
fn invocation_parent(&self, id: LocalExpnId) -> LocalDefId;
fn resolve_dollar_crates(&mut self); fn resolve_dollar_crates(&mut self);
fn visit_ast_fragment_with_placeholders( fn visit_ast_fragment_with_placeholders(

View file

@ -588,7 +588,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
// Resolve `$crate`s in the fragment for pretty-printing. // Resolve `$crate`s in the fragment for pretty-printing.
self.cx.resolver.resolve_dollar_crates(); self.cx.resolver.resolve_dollar_crates();
let invocations = { let mut invocations = {
let mut collector = InvocationCollector { let mut collector = InvocationCollector {
// Non-derive macro invocations cannot see the results of cfg expansion - they // Non-derive macro invocations cannot see the results of cfg expansion - they
// will either be removed along with the item, or invoked before the cfg/cfg_attr // will either be removed along with the item, or invoked before the cfg/cfg_attr
@ -613,6 +613,19 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
self.cx self.cx
.resolver .resolver
.visit_ast_fragment_with_placeholders(self.cx.current_expansion.id, &fragment); .visit_ast_fragment_with_placeholders(self.cx.current_expansion.id, &fragment);
if self.cx.sess.opts.debugging_opts.incremental_relative_spans {
for (invoc, _) in invocations.iter_mut() {
let expn_id = invoc.expansion_data.id;
let parent_def = self.cx.resolver.invocation_parent(expn_id);
let span = match &mut invoc.kind {
InvocationKind::Bang { ref mut span, .. } => span,
InvocationKind::Attr { attr, .. } => &mut attr.span,
InvocationKind::Derive { path, .. } => &mut path.span,
};
*span = span.with_parent(Some(parent_def));
}
}
} }
(fragment, invocations) (fragment, invocations)

View file

@ -745,7 +745,7 @@ impl server::Span for Rustc<'_> {
self.sess.source_map().lookup_char_pos(span.lo()).file self.sess.source_map().lookup_char_pos(span.lo()).file
} }
fn parent(&mut self, span: Self::Span) -> Option<Self::Span> { fn parent(&mut self, span: Self::Span) -> Option<Self::Span> {
span.parent() span.parent_callsite()
} }
fn source(&mut self, span: Self::Span) -> Self::Span { fn source(&mut self, span: Self::Span) -> Self::Span {
span.source_callsite() span.source_callsite()

View file

@ -14,6 +14,7 @@ use rustc_data_structures::unhash::UnhashMap;
use rustc_index::vec::IndexVec; use rustc_index::vec::IndexVec;
use rustc_span::hygiene::ExpnId; use rustc_span::hygiene::ExpnId;
use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::Span;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use std::hash::Hash; use std::hash::Hash;
@ -107,6 +108,8 @@ pub struct Definitions {
/// Item with a given `LocalDefId` was defined during macro expansion with ID `ExpnId`. /// Item with a given `LocalDefId` was defined during macro expansion with ID `ExpnId`.
expansions_that_defined: FxHashMap<LocalDefId, ExpnId>, expansions_that_defined: FxHashMap<LocalDefId, ExpnId>,
def_id_to_span: IndexVec<LocalDefId, Span>,
} }
/// A unique identifier that we can use to lookup a definition /// A unique identifier that we can use to lookup a definition
@ -324,7 +327,7 @@ impl Definitions {
} }
/// Adds a root definition (no parent) and a few other reserved definitions. /// Adds a root definition (no parent) and a few other reserved definitions.
pub fn new(stable_crate_id: StableCrateId) -> Definitions { pub fn new(stable_crate_id: StableCrateId, crate_span: Span) -> Definitions {
let key = DefKey { let key = DefKey {
parent: None, parent: None,
disambiguated_data: DisambiguatedDefPathData { disambiguated_data: DisambiguatedDefPathData {
@ -341,11 +344,18 @@ impl Definitions {
let root = LocalDefId { local_def_index: table.allocate(key, def_path_hash) }; let root = LocalDefId { local_def_index: table.allocate(key, def_path_hash) };
assert_eq!(root.local_def_index, CRATE_DEF_INDEX); assert_eq!(root.local_def_index, CRATE_DEF_INDEX);
let mut def_id_to_span = IndexVec::new();
// A relative span's parent must be an absolute span.
debug_assert_eq!(crate_span.data_untracked().parent, None);
let _root = def_id_to_span.push(crate_span);
debug_assert_eq!(_root, root);
Definitions { Definitions {
table, table,
def_id_to_hir_id: Default::default(), def_id_to_hir_id: Default::default(),
hir_id_to_def_id: Default::default(), hir_id_to_def_id: Default::default(),
expansions_that_defined: Default::default(), expansions_that_defined: Default::default(),
def_id_to_span,
} }
} }
@ -361,6 +371,7 @@ impl Definitions {
data: DefPathData, data: DefPathData,
expn_id: ExpnId, expn_id: ExpnId,
mut next_disambiguator: impl FnMut(LocalDefId, DefPathData) -> u32, mut next_disambiguator: impl FnMut(LocalDefId, DefPathData) -> u32,
span: Span,
) -> LocalDefId { ) -> LocalDefId {
debug!("create_def(parent={:?}, data={:?}, expn_id={:?})", parent, data, expn_id); debug!("create_def(parent={:?}, data={:?}, expn_id={:?})", parent, data, expn_id);
@ -385,6 +396,11 @@ impl Definitions {
self.expansions_that_defined.insert(def_id, expn_id); self.expansions_that_defined.insert(def_id, expn_id);
} }
// A relative span's parent must be an absolute span.
debug_assert_eq!(span.data_untracked().parent, None);
let _id = self.def_id_to_span.push(span);
debug_assert_eq!(_id, def_id);
def_id def_id
} }
@ -412,6 +428,12 @@ impl Definitions {
self.expansions_that_defined.get(&id).copied().unwrap_or_else(ExpnId::root) self.expansions_that_defined.get(&id).copied().unwrap_or_else(ExpnId::root)
} }
/// Retrieves the span of the given `DefId` if `DefId` is in the local crate.
#[inline]
pub fn def_span(&self, def_id: LocalDefId) -> Span {
self.def_id_to_span[def_id]
}
pub fn iter_local_def_id(&self) -> impl Iterator<Item = LocalDefId> + '_ { pub fn iter_local_def_id(&self) -> impl Iterator<Item = LocalDefId> + '_ {
self.def_id_to_hir_id.iter_enumerated().map(|(k, _)| k) self.def_id_to_hir_id.iter_enumerated().map(|(k, _)| k)
} }

View file

@ -25,6 +25,16 @@ fn span_debug(span: rustc_span::Span, f: &mut fmt::Formatter<'_>) -> fmt::Result
}) })
} }
fn track_span_parent(def_id: rustc_span::def_id::LocalDefId) {
tls::with_opt(|tcx| {
if let Some(tcx) = tcx {
let _span = tcx.source_span(def_id);
// Sanity check: relative span's parent must be an absolute span.
debug_assert_eq!(_span.data_untracked().parent, None);
}
})
}
/// This is a callback from `rustc_ast` as it cannot access the implicit state /// This is a callback from `rustc_ast` as it cannot access the implicit state
/// in `rustc_middle` otherwise. It is used to when diagnostic messages are /// in `rustc_middle` otherwise. It is used to when diagnostic messages are
/// emitted and stores them in the current query, if there is one. /// emitted and stores them in the current query, if there is one.
@ -56,6 +66,7 @@ fn def_id_debug(def_id: rustc_hir::def_id::DefId, f: &mut fmt::Formatter<'_>) ->
/// TyCtxt in. /// TyCtxt in.
pub fn setup_callbacks() { pub fn setup_callbacks() {
rustc_span::SPAN_DEBUG.swap(&(span_debug as fn(_, &mut fmt::Formatter<'_>) -> _)); rustc_span::SPAN_DEBUG.swap(&(span_debug as fn(_, &mut fmt::Formatter<'_>) -> _));
rustc_span::SPAN_TRACK.swap(&(track_span_parent as fn(_)));
rustc_hir::def_id::DEF_ID_DEBUG.swap(&(def_id_debug as fn(_, &mut fmt::Formatter<'_>) -> _)); rustc_hir::def_id::DEF_ID_DEBUG.swap(&(def_id_debug as fn(_, &mut fmt::Formatter<'_>) -> _));
TRACK_DIAGNOSTICS.swap(&(track_diagnostic as fn(&_))); TRACK_DIAGNOSTICS.swap(&(track_diagnostic as fn(&_)));
} }

View file

@ -536,7 +536,8 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for Span {
let hi = let hi =
(hi + source_file.translated_source_file.start_pos) - source_file.original_start_pos; (hi + source_file.translated_source_file.start_pos) - source_file.original_start_pos;
Ok(Span::new(lo, hi, ctxt)) // Do not try to decode parent for foreign spans.
Ok(Span::new(lo, hi, ctxt, None))
} }
} }

View file

@ -969,22 +969,12 @@ pub(super) fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh {
.iter_enumerated() .iter_enumerated()
.filter_map(|(def_id, hod)| { .filter_map(|(def_id, hod)| {
let def_path_hash = tcx.untracked_resolutions.definitions.def_path_hash(def_id); let def_path_hash = tcx.untracked_resolutions.definitions.def_path_hash(def_id);
let mut hasher = StableHasher::new(); let hash = hod.as_ref()?.hash;
hod.as_ref()?.hash_stable(&mut hcx, &mut hasher); Some((def_path_hash, hash, def_id))
AttributeMap { map: &tcx.untracked_crate.attrs, prefix: def_id }
.hash_stable(&mut hcx, &mut hasher);
Some((def_path_hash, hasher.finish()))
}) })
.collect(); .collect();
hir_body_nodes.sort_unstable_by_key(|bn| bn.0); hir_body_nodes.sort_unstable_by_key(|bn| bn.0);
let node_hashes = hir_body_nodes.iter().fold(
Fingerprint::ZERO,
|combined_fingerprint, &(def_path_hash, fingerprint)| {
combined_fingerprint.combine(def_path_hash.0.combine(fingerprint))
},
);
let upstream_crates = upstream_crates(tcx); let upstream_crates = upstream_crates(tcx);
// We hash the final, remapped names of all local source files so we // We hash the final, remapped names of all local source files so we
@ -1004,7 +994,17 @@ pub(super) fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh {
source_file_names.sort_unstable(); source_file_names.sort_unstable();
let mut stable_hasher = StableHasher::new(); let mut stable_hasher = StableHasher::new();
node_hashes.hash_stable(&mut hcx, &mut stable_hasher); for (def_path_hash, fingerprint, def_id) in hir_body_nodes.iter() {
def_path_hash.0.hash_stable(&mut hcx, &mut stable_hasher);
fingerprint.hash_stable(&mut hcx, &mut stable_hasher);
AttributeMap { map: &tcx.untracked_crate.attrs, prefix: *def_id }
.hash_stable(&mut hcx, &mut stable_hasher);
if tcx.sess.opts.debugging_opts.incremental_relative_spans {
let span = tcx.untracked_resolutions.definitions.def_span(*def_id);
debug_assert_eq!(span.parent(), None);
span.hash_stable(&mut hcx, &mut stable_hasher);
}
}
upstream_crates.hash_stable(&mut hcx, &mut stable_hasher); upstream_crates.hash_stable(&mut hcx, &mut stable_hasher);
source_file_names.hash_stable(&mut hcx, &mut stable_hasher); source_file_names.hash_stable(&mut hcx, &mut stable_hasher);
tcx.sess.opts.dep_tracking_hash(true).hash_stable(&mut hcx, &mut stable_hasher); tcx.sess.opts.dep_tracking_hash(true).hash_stable(&mut hcx, &mut stable_hasher);

View file

@ -153,6 +153,7 @@ pub fn provide(providers: &mut Providers) {
index.parenting.get(&id).copied().unwrap_or(CRATE_HIR_ID) index.parenting.get(&id).copied().unwrap_or(CRATE_HIR_ID)
}; };
providers.hir_attrs = |tcx, id| AttributeMap { map: &tcx.untracked_crate.attrs, prefix: id }; providers.hir_attrs = |tcx, id| AttributeMap { map: &tcx.untracked_crate.attrs, prefix: id };
providers.source_span = |tcx, def_id| tcx.resolutions(()).definitions.def_span(def_id);
providers.def_span = |tcx, def_id| tcx.hir().span_if_local(def_id).unwrap_or(DUMMY_SP); providers.def_span = |tcx, def_id| tcx.hir().span_if_local(def_id).unwrap_or(DUMMY_SP);
providers.fn_arg_names = |tcx, id| { providers.fn_arg_names = |tcx, id| {
let hir = tcx.hir(); let hir = tcx.hir();

View file

@ -12,7 +12,7 @@ use rustc_hir::definitions::{DefPathHash, Definitions};
use rustc_session::Session; use rustc_session::Session;
use rustc_span::source_map::SourceMap; use rustc_span::source_map::SourceMap;
use rustc_span::symbol::Symbol; use rustc_span::symbol::Symbol;
use rustc_span::{BytePos, CachingSourceMapView, SourceFile, SpanData}; use rustc_span::{BytePos, CachingSourceMapView, SourceFile, Span, SpanData};
use smallvec::SmallVec; use smallvec::SmallVec;
use std::cmp::Ord; use std::cmp::Ord;
@ -227,6 +227,11 @@ impl<'a> rustc_span::HashStableContext for StableHashingContext<'a> {
self.def_path_hash(def_id) self.def_path_hash(def_id)
} }
#[inline]
fn def_span(&self, def_id: LocalDefId) -> Span {
self.definitions.def_span(def_id)
}
fn span_data_to_lines_and_cols( fn span_data_to_lines_and_cols(
&mut self, &mut self,
span: &SpanData, span: &SpanData,

View file

@ -20,6 +20,14 @@ rustc_queries! {
desc { "get the resolver outputs" } desc { "get the resolver outputs" }
} }
/// Return the span for a definition.
/// Contrary to `def_span` below, this query returns the full absolute span of the definition.
/// This span is meant for dep-tracking rather than diagnostics. It should not be used outside
/// of rustc_middle::hir::source_map.
query source_span(key: LocalDefId) -> Span {
desc { "get the source span" }
}
/// Represents crate as a whole (as distinct from the top-level crate module). /// Represents crate as a whole (as distinct from the top-level crate module).
/// If you call `hir_crate` (e.g., indirectly by calling `tcx.hir().krate()`), /// If you call `hir_crate` (e.g., indirectly by calling `tcx.hir().krate()`),
/// we will have to assume that any change means that you need to be recompiled. /// we will have to assume that any change means that you need to be recompiled.

View file

@ -964,7 +964,7 @@ fn foo(&self) -> Self::T { String::new() }
{ {
let (span, sugg) = if has_params { let (span, sugg) = if has_params {
let pos = span.hi() - BytePos(1); let pos = span.hi() - BytePos(1);
let span = Span::new(pos, pos, span.ctxt()); let span = Span::new(pos, pos, span.ctxt(), span.parent());
(span, format!(", {} = {}", assoc.ident, ty)) (span, format!(", {} = {}", assoc.ident, ty))
} else { } else {
let item_args = self.format_generic_args(assoc_substs); let item_args = self.format_generic_args(assoc_substs);

View file

@ -196,7 +196,11 @@ impl CoverageSpan {
/// body_span), returns the macro name symbol. /// body_span), returns the macro name symbol.
pub fn visible_macro(&self, body_span: Span) -> Option<Symbol> { pub fn visible_macro(&self, body_span: Span) -> Option<Symbol> {
if let Some(current_macro) = self.current_macro() { if let Some(current_macro) = self.current_macro() {
if self.expn_span.parent().unwrap_or_else(|| bug!("macro must have a parent")).ctxt() if self
.expn_span
.parent_callsite()
.unwrap_or_else(|| bug!("macro must have a parent"))
.ctxt()
== body_span.ctxt() == body_span.ctxt()
{ {
return Some(current_macro); return Some(current_macro);

View file

@ -131,7 +131,7 @@ fn maybe_source_file_to_parser(
let mut parser = stream_to_parser(sess, stream, None); let mut parser = stream_to_parser(sess, stream, None);
parser.unclosed_delims = unclosed_delims; parser.unclosed_delims = unclosed_delims;
if parser.token == token::Eof { if parser.token == token::Eof {
parser.token.span = Span::new(end_pos, end_pos, parser.token.span.ctxt()); parser.token.span = Span::new(end_pos, end_pos, parser.token.span.ctxt(), None);
} }
Ok(parser) Ok(parser)

View file

@ -23,7 +23,7 @@ use rustc_span::hygiene::{
}; };
use rustc_span::source_map::{SourceMap, StableSourceFileId}; use rustc_span::source_map::{SourceMap, StableSourceFileId};
use rustc_span::CachingSourceMapView; use rustc_span::CachingSourceMapView;
use rustc_span::{BytePos, ExpnData, ExpnHash, SourceFile, Span, DUMMY_SP}; use rustc_span::{BytePos, ExpnData, ExpnHash, Pos, SourceFile, Span};
use std::collections::hash_map::Entry; use std::collections::hash_map::Entry;
use std::mem; use std::mem;
@ -33,6 +33,7 @@ const TAG_FILE_FOOTER: u128 = 0xC0FFEE_C0FFEE_C0FFEE_C0FFEE_C0FFEE;
const TAG_FULL_SPAN: u8 = 0; const TAG_FULL_SPAN: u8 = 0;
// A partial span with no location information, encoded only with a `SyntaxContext` // A partial span with no location information, encoded only with a `SyntaxContext`
const TAG_PARTIAL_SPAN: u8 = 1; const TAG_PARTIAL_SPAN: u8 = 1;
const TAG_RELATIVE_SPAN: u8 = 2;
const TAG_SYNTAX_CONTEXT: u8 = 0; const TAG_SYNTAX_CONTEXT: u8 = 0;
const TAG_EXPN_DATA: u8 = 1; const TAG_EXPN_DATA: u8 = 1;
@ -829,11 +830,26 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for ExpnId {
impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for Span { impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for Span {
fn decode(decoder: &mut CacheDecoder<'a, 'tcx>) -> Result<Self, String> { fn decode(decoder: &mut CacheDecoder<'a, 'tcx>) -> Result<Self, String> {
let ctxt = SyntaxContext::decode(decoder)?;
let parent = Option::<LocalDefId>::decode(decoder)?;
let tag: u8 = Decodable::decode(decoder)?; let tag: u8 = Decodable::decode(decoder)?;
if tag == TAG_PARTIAL_SPAN { if tag == TAG_PARTIAL_SPAN {
let ctxt = SyntaxContext::decode(decoder)?; return Ok(Span::new(BytePos(0), BytePos(0), ctxt, parent));
return Ok(DUMMY_SP.with_ctxt(ctxt)); } else if tag == TAG_RELATIVE_SPAN {
let dlo = u32::decode(decoder)?;
let dto = u32::decode(decoder)?;
let enclosing =
decoder.tcx.definitions_untracked().def_span(parent.unwrap()).data_untracked();
let span = Span::new(
enclosing.lo + BytePos::from_u32(dlo),
enclosing.lo + BytePos::from_u32(dto),
ctxt,
parent,
);
return Ok(span);
} else { } else {
debug_assert_eq!(tag, TAG_FULL_SPAN); debug_assert_eq!(tag, TAG_FULL_SPAN);
} }
@ -842,13 +858,12 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for Span {
let line_lo = usize::decode(decoder)?; let line_lo = usize::decode(decoder)?;
let col_lo = BytePos::decode(decoder)?; let col_lo = BytePos::decode(decoder)?;
let len = BytePos::decode(decoder)?; let len = BytePos::decode(decoder)?;
let ctxt = SyntaxContext::decode(decoder)?;
let file_lo = decoder.file_index_to_file(file_lo_index); let file_lo = decoder.file_index_to_file(file_lo_index);
let lo = file_lo.lines[line_lo - 1] + col_lo; let lo = file_lo.lines[line_lo - 1] + col_lo;
let hi = lo + len; let hi = lo + len;
Ok(Span::new(lo, hi, ctxt)) Ok(Span::new(lo, hi, ctxt, parent))
} }
} }
@ -1008,10 +1023,22 @@ where
E: 'a + OpaqueEncoder, E: 'a + OpaqueEncoder,
{ {
fn encode(&self, s: &mut CacheEncoder<'a, 'tcx, E>) -> Result<(), E::Error> { fn encode(&self, s: &mut CacheEncoder<'a, 'tcx, E>) -> Result<(), E::Error> {
let span_data = self.data(); let span_data = self.data_untracked();
if self.is_dummy() { span_data.ctxt.encode(s)?;
TAG_PARTIAL_SPAN.encode(s)?; span_data.parent.encode(s)?;
return span_data.ctxt.encode(s);
if span_data.is_dummy() {
return TAG_PARTIAL_SPAN.encode(s);
}
if let Some(parent) = span_data.parent {
let enclosing = s.tcx.definitions_untracked().def_span(parent).data_untracked();
if enclosing.contains(span_data) {
TAG_RELATIVE_SPAN.encode(s)?;
(span_data.lo - enclosing.lo).to_u32().encode(s)?;
(span_data.hi - enclosing.lo).to_u32().encode(s)?;
return Ok(());
}
} }
let pos = s.source_map.byte_pos_to_line_and_col(span_data.lo); let pos = s.source_map.byte_pos_to_line_and_col(span_data.lo);
@ -1021,8 +1048,7 @@ where
}; };
if partial_span { if partial_span {
TAG_PARTIAL_SPAN.encode(s)?; return TAG_PARTIAL_SPAN.encode(s);
return span_data.ctxt.encode(s);
} }
let (file_lo, line_lo, col_lo) = pos.unwrap(); let (file_lo, line_lo, col_lo) = pos.unwrap();
@ -1035,8 +1061,7 @@ where
source_file_index.encode(s)?; source_file_index.encode(s)?;
line_lo.encode(s)?; line_lo.encode(s)?;
col_lo.encode(s)?; col_lo.encode(s)?;
len.encode(s)?; len.encode(s)
span_data.ctxt.encode(s)
} }
} }

View file

@ -32,7 +32,13 @@ impl<'a, 'b> DefCollector<'a, 'b> {
fn create_def(&mut self, node_id: NodeId, data: DefPathData, span: Span) -> LocalDefId { fn create_def(&mut self, node_id: NodeId, data: DefPathData, span: Span) -> LocalDefId {
let parent_def = self.parent_def; let parent_def = self.parent_def;
debug!("create_def(node_id={:?}, data={:?}, parent_def={:?})", node_id, data, parent_def); debug!("create_def(node_id={:?}, data={:?}, parent_def={:?})", node_id, data, parent_def);
self.resolver.create_def(parent_def, node_id, data, self.expansion.to_expn_id(), span) self.resolver.create_def(
parent_def,
node_id,
data,
self.expansion.to_expn_id(),
span.with_parent(None),
)
} }
fn with_parent<F: FnOnce(&mut Self)>(&mut self, parent_def: LocalDefId, f: F) { fn with_parent<F: FnOnce(&mut Self)>(&mut self, parent_def: LocalDefId, f: F) {

View file

@ -768,6 +768,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
args[1].span.lo(), args[1].span.lo(),
args.last().unwrap().span.hi(), args.last().unwrap().span.hi(),
call_span.ctxt(), call_span.ctxt(),
None,
)) ))
} else { } else {
None None

View file

@ -1012,8 +1012,6 @@ pub struct Resolver<'a> {
next_node_id: NodeId, next_node_id: NodeId,
def_id_to_span: IndexVec<LocalDefId, Span>,
node_id_to_def_id: FxHashMap<ast::NodeId, LocalDefId>, node_id_to_def_id: FxHashMap<ast::NodeId, LocalDefId>,
def_id_to_node_id: IndexVec<LocalDefId, ast::NodeId>, def_id_to_node_id: IndexVec<LocalDefId, ast::NodeId>,
@ -1116,6 +1114,11 @@ impl ResolverAstLowering for Resolver<'_> {
} }
} }
#[inline]
fn def_span(&self, id: LocalDefId) -> Span {
self.definitions.def_span(id)
}
fn item_generics_num_lifetimes(&self, def_id: DefId) -> usize { fn item_generics_num_lifetimes(&self, def_id: DefId) -> usize {
if let Some(def_id) = def_id.as_local() { if let Some(def_id) = def_id.as_local() {
self.item_generics_num_lifetimes[&def_id] self.item_generics_num_lifetimes[&def_id]
@ -1197,9 +1200,7 @@ impl ResolverAstLowering for Resolver<'_> {
disambiguator disambiguator
}; };
let def_id = self.definitions.create_def(parent, data, expn_id, next_disambiguator); let def_id = self.definitions.create_def(parent, data, expn_id, next_disambiguator, span);
assert_eq!(self.def_id_to_span.push(span), def_id);
// Some things for which we allocate `LocalDefId`s don't correspond to // Some things for which we allocate `LocalDefId`s don't correspond to
// anything in the AST, so they don't have a `NodeId`. For these cases // anything in the AST, so they don't have a `NodeId`. For these cases
@ -1225,6 +1226,11 @@ impl<'a, 'b> rustc_span::HashStableContext for ExpandHasher<'a, 'b> {
true true
} }
#[inline]
fn def_span(&self, id: LocalDefId) -> Span {
self.resolver.def_span(id)
}
#[inline] #[inline]
fn def_path_hash(&self, def_id: DefId) -> DefPathHash { fn def_path_hash(&self, def_id: DefId) -> DefPathHash {
self.resolver.def_path_hash(def_id) self.resolver.def_path_hash(def_id)
@ -1269,14 +1275,12 @@ impl<'a> Resolver<'a> {
let mut module_map = FxHashMap::default(); let mut module_map = FxHashMap::default();
module_map.insert(root_local_def_id, graph_root); module_map.insert(root_local_def_id, graph_root);
let definitions = Definitions::new(session.local_stable_crate_id()); let definitions = Definitions::new(session.local_stable_crate_id(), krate.span);
let root = definitions.get_root_def(); let root = definitions.get_root_def();
let mut visibilities = FxHashMap::default(); let mut visibilities = FxHashMap::default();
visibilities.insert(root_local_def_id, ty::Visibility::Public); visibilities.insert(root_local_def_id, ty::Visibility::Public);
let mut def_id_to_span = IndexVec::default();
assert_eq!(def_id_to_span.push(rustc_span::DUMMY_SP), root);
let mut def_id_to_node_id = IndexVec::default(); let mut def_id_to_node_id = IndexVec::default();
assert_eq!(def_id_to_node_id.push(CRATE_NODE_ID), root); assert_eq!(def_id_to_node_id.push(CRATE_NODE_ID), root);
let mut node_id_to_def_id = FxHashMap::default(); let mut node_id_to_def_id = FxHashMap::default();
@ -1393,7 +1397,6 @@ impl<'a> Resolver<'a> {
.collect(), .collect(),
lint_buffer: LintBuffer::default(), lint_buffer: LintBuffer::default(),
next_node_id: NodeId::from_u32(1), next_node_id: NodeId::from_u32(1),
def_id_to_span,
node_id_to_def_id, node_id_to_def_id,
def_id_to_node_id, def_id_to_node_id,
placeholder_field_indices: Default::default(), placeholder_field_indices: Default::default(),
@ -3360,7 +3363,7 @@ impl<'a> Resolver<'a> {
/// Retrieves the span of the given `DefId` if `DefId` is in the local crate. /// Retrieves the span of the given `DefId` if `DefId` is in the local crate.
#[inline] #[inline]
pub fn opt_span(&self, def_id: DefId) -> Option<Span> { pub fn opt_span(&self, def_id: DefId) -> Option<Span> {
if let Some(def_id) = def_id.as_local() { Some(self.def_id_to_span[def_id]) } else { None } def_id.as_local().map(|def_id| self.definitions.def_span(def_id))
} }
/// Checks if an expression refers to a function marked with /// Checks if an expression refers to a function marked with

View file

@ -180,6 +180,10 @@ impl<'a> ResolverExpand for Resolver<'a> {
self.next_node_id() self.next_node_id()
} }
fn invocation_parent(&self, id: LocalExpnId) -> LocalDefId {
self.invocation_parents[&id].0
}
fn resolve_dollar_crates(&mut self) { fn resolve_dollar_crates(&mut self) {
hygiene::update_dollar_crate_names(|ctxt| { hygiene::update_dollar_crate_names(|ctxt| {
let ident = Ident::new(kw::DollarCrate, DUMMY_SP.with_ctxt(ctxt)); let ident = Ident::new(kw::DollarCrate, DUMMY_SP.with_ctxt(ctxt));

View file

@ -1106,6 +1106,8 @@ options! {
incremental_info: bool = (false, parse_bool, [UNTRACKED], incremental_info: bool = (false, parse_bool, [UNTRACKED],
"print high-level information about incremental reuse (or the lack thereof) \ "print high-level information about incremental reuse (or the lack thereof) \
(default: no)"), (default: no)"),
incremental_relative_spans: bool = (false, parse_bool, [TRACKED],
"hash spans relative to their parent item for incr. comp. (default: no)"),
incremental_verify_ich: bool = (false, parse_bool, [UNTRACKED], incremental_verify_ich: bool = (false, parse_bool, [UNTRACKED],
"verify incr. comp. hashes of green query instances (default: no)"), "verify incr. comp. hashes of green query instances (default: no)"),
inline_mir: Option<bool> = (None, parse_opt_bool, [TRACKED], inline_mir: Option<bool> = (None, parse_opt_bool, [TRACKED],

View file

@ -41,7 +41,7 @@ use hygiene::Transparency;
pub use hygiene::{DesugaringKind, ExpnKind, ForLoopLoc, MacroKind}; pub use hygiene::{DesugaringKind, ExpnKind, ForLoopLoc, MacroKind};
pub use hygiene::{ExpnData, ExpnHash, ExpnId, LocalExpnId, SyntaxContext}; pub use hygiene::{ExpnData, ExpnHash, ExpnId, LocalExpnId, SyntaxContext};
pub mod def_id; pub mod def_id;
use def_id::{CrateNum, DefId, DefPathHash, LOCAL_CRATE}; use def_id::{CrateNum, DefId, DefPathHash, LocalDefId, LOCAL_CRATE};
pub mod lev_distance; pub mod lev_distance;
mod span_encoding; mod span_encoding;
pub use span_encoding::{Span, DUMMY_SP}; pub use span_encoding::{Span, DUMMY_SP};
@ -434,24 +434,38 @@ pub struct SpanData {
/// Information about where the macro came from, if this piece of /// Information about where the macro came from, if this piece of
/// code was created by a macro expansion. /// code was created by a macro expansion.
pub ctxt: SyntaxContext, pub ctxt: SyntaxContext,
pub parent: Option<LocalDefId>,
} }
impl SpanData { impl SpanData {
#[inline] #[inline]
pub fn span(&self) -> Span { pub fn span(&self) -> Span {
Span::new(self.lo, self.hi, self.ctxt) Span::new(self.lo, self.hi, self.ctxt, self.parent)
} }
#[inline] #[inline]
pub fn with_lo(&self, lo: BytePos) -> Span { pub fn with_lo(&self, lo: BytePos) -> Span {
Span::new(lo, self.hi, self.ctxt) Span::new(lo, self.hi, self.ctxt, self.parent)
} }
#[inline] #[inline]
pub fn with_hi(&self, hi: BytePos) -> Span { pub fn with_hi(&self, hi: BytePos) -> Span {
Span::new(self.lo, hi, self.ctxt) Span::new(self.lo, hi, self.ctxt, self.parent)
} }
#[inline] #[inline]
pub fn with_ctxt(&self, ctxt: SyntaxContext) -> Span { pub fn with_ctxt(&self, ctxt: SyntaxContext) -> Span {
Span::new(self.lo, self.hi, ctxt) Span::new(self.lo, self.hi, ctxt, self.parent)
}
#[inline]
pub fn with_parent(&self, parent: Option<LocalDefId>) -> Span {
Span::new(self.lo, self.hi, self.ctxt, parent)
}
/// Returns `true` if this is a dummy span with any hygienic context.
#[inline]
pub fn is_dummy(self) -> bool {
self.lo.0 == 0 && self.hi.0 == 0
}
/// Returns `true` if `self` fully encloses `other`.
pub fn contains(self, other: Self) -> bool {
self.lo <= other.lo && other.hi <= self.hi
} }
} }
@ -507,18 +521,25 @@ impl Span {
} }
#[inline] #[inline]
pub fn ctxt(self) -> SyntaxContext { pub fn ctxt(self) -> SyntaxContext {
self.data().ctxt self.data_untracked().ctxt
} }
#[inline] #[inline]
pub fn with_ctxt(self, ctxt: SyntaxContext) -> Span { pub fn with_ctxt(self, ctxt: SyntaxContext) -> Span {
self.data().with_ctxt(ctxt) self.data_untracked().with_ctxt(ctxt)
}
#[inline]
pub fn parent(self) -> Option<LocalDefId> {
self.data().parent
}
#[inline]
pub fn with_parent(self, ctxt: Option<LocalDefId>) -> Span {
self.data().with_parent(ctxt)
} }
/// Returns `true` if this is a dummy span with any hygienic context. /// Returns `true` if this is a dummy span with any hygienic context.
#[inline] #[inline]
pub fn is_dummy(self) -> bool { pub fn is_dummy(self) -> bool {
let span = self.data(); self.data_untracked().is_dummy()
span.lo.0 == 0 && span.hi.0 == 0
} }
/// Returns `true` if this span comes from a macro or desugaring. /// Returns `true` if this span comes from a macro or desugaring.
@ -534,26 +555,26 @@ impl Span {
#[inline] #[inline]
pub fn with_root_ctxt(lo: BytePos, hi: BytePos) -> Span { pub fn with_root_ctxt(lo: BytePos, hi: BytePos) -> Span {
Span::new(lo, hi, SyntaxContext::root()) Span::new(lo, hi, SyntaxContext::root(), None)
} }
/// Returns a new span representing an empty span at the beginning of this span. /// Returns a new span representing an empty span at the beginning of this span.
#[inline] #[inline]
pub fn shrink_to_lo(self) -> Span { pub fn shrink_to_lo(self) -> Span {
let span = self.data(); let span = self.data_untracked();
span.with_hi(span.lo) span.with_hi(span.lo)
} }
/// Returns a new span representing an empty span at the end of this span. /// Returns a new span representing an empty span at the end of this span.
#[inline] #[inline]
pub fn shrink_to_hi(self) -> Span { pub fn shrink_to_hi(self) -> Span {
let span = self.data(); let span = self.data_untracked();
span.with_lo(span.hi) span.with_lo(span.hi)
} }
#[inline] #[inline]
/// Returns `true` if `hi == lo`. /// Returns `true` if `hi == lo`.
pub fn is_empty(&self) -> bool { pub fn is_empty(&self) -> bool {
let span = self.data(); let span = self.data_untracked();
span.hi == span.lo span.hi == span.lo
} }
@ -566,7 +587,7 @@ impl Span {
pub fn contains(self, other: Span) -> bool { pub fn contains(self, other: Span) -> bool {
let span = self.data(); let span = self.data();
let other = other.data(); let other = other.data();
span.lo <= other.lo && other.hi <= span.hi span.contains(other)
} }
/// Returns `true` if `self` touches `other`. /// Returns `true` if `self` touches `other`.
@ -602,7 +623,7 @@ impl Span {
/// The `Span` for the tokens in the previous macro expansion from which `self` was generated, /// The `Span` for the tokens in the previous macro expansion from which `self` was generated,
/// if any. /// if any.
pub fn parent(self) -> Option<Span> { pub fn parent_callsite(self) -> Option<Span> {
let expn_data = self.ctxt().outer_expn_data(); let expn_data = self.ctxt().outer_expn_data();
if !expn_data.is_root() { Some(expn_data.call_site) } else { None } if !expn_data.is_root() { Some(expn_data.call_site) } else { None }
} }
@ -610,7 +631,7 @@ impl Span {
/// Walk down the expansion ancestors to find a span that's contained within `outer`. /// Walk down the expansion ancestors to find a span that's contained within `outer`.
pub fn find_ancestor_inside(mut self, outer: Span) -> Option<Span> { pub fn find_ancestor_inside(mut self, outer: Span) -> Option<Span> {
while !outer.contains(self) { while !outer.contains(self) {
self = self.parent()?; self = self.parent_callsite()?;
} }
Some(self) Some(self)
} }
@ -731,6 +752,7 @@ impl Span {
cmp::min(span_data.lo, end_data.lo), cmp::min(span_data.lo, end_data.lo),
cmp::max(span_data.hi, end_data.hi), cmp::max(span_data.hi, end_data.hi),
if span_data.ctxt == SyntaxContext::root() { end_data.ctxt } else { span_data.ctxt }, if span_data.ctxt == SyntaxContext::root() { end_data.ctxt } else { span_data.ctxt },
if span_data.parent == end_data.parent { span_data.parent } else { None },
) )
} }
@ -748,6 +770,7 @@ impl Span {
span.hi, span.hi,
end.lo, end.lo,
if end.ctxt == SyntaxContext::root() { end.ctxt } else { span.ctxt }, if end.ctxt == SyntaxContext::root() { end.ctxt } else { span.ctxt },
if span.parent == end.parent { span.parent } else { None },
) )
} }
@ -765,6 +788,7 @@ impl Span {
span.lo, span.lo,
end.lo, end.lo,
if end.ctxt == SyntaxContext::root() { end.ctxt } else { span.ctxt }, if end.ctxt == SyntaxContext::root() { end.ctxt } else { span.ctxt },
if span.parent == end.parent { span.parent } else { None },
) )
} }
@ -774,6 +798,7 @@ impl Span {
span.lo + BytePos::from_usize(inner.start), span.lo + BytePos::from_usize(inner.start),
span.lo + BytePos::from_usize(inner.end), span.lo + BytePos::from_usize(inner.end),
span.ctxt, span.ctxt,
span.parent,
) )
} }
@ -812,7 +837,7 @@ impl Span {
pub fn remove_mark(&mut self) -> ExpnId { pub fn remove_mark(&mut self) -> ExpnId {
let mut span = self.data(); let mut span = self.data();
let mark = span.ctxt.remove_mark(); let mark = span.ctxt.remove_mark();
*self = Span::new(span.lo, span.hi, span.ctxt); *self = Span::new(span.lo, span.hi, span.ctxt, span.parent);
mark mark
} }
@ -820,7 +845,7 @@ impl Span {
pub fn adjust(&mut self, expn_id: ExpnId) -> Option<ExpnId> { pub fn adjust(&mut self, expn_id: ExpnId) -> Option<ExpnId> {
let mut span = self.data(); let mut span = self.data();
let mark = span.ctxt.adjust(expn_id); let mark = span.ctxt.adjust(expn_id);
*self = Span::new(span.lo, span.hi, span.ctxt); *self = Span::new(span.lo, span.hi, span.ctxt, span.parent);
mark mark
} }
@ -828,7 +853,7 @@ impl Span {
pub fn normalize_to_macros_2_0_and_adjust(&mut self, expn_id: ExpnId) -> Option<ExpnId> { pub fn normalize_to_macros_2_0_and_adjust(&mut self, expn_id: ExpnId) -> Option<ExpnId> {
let mut span = self.data(); let mut span = self.data();
let mark = span.ctxt.normalize_to_macros_2_0_and_adjust(expn_id); let mark = span.ctxt.normalize_to_macros_2_0_and_adjust(expn_id);
*self = Span::new(span.lo, span.hi, span.ctxt); *self = Span::new(span.lo, span.hi, span.ctxt, span.parent);
mark mark
} }
@ -836,7 +861,7 @@ impl Span {
pub fn glob_adjust(&mut self, expn_id: ExpnId, glob_span: Span) -> Option<Option<ExpnId>> { pub fn glob_adjust(&mut self, expn_id: ExpnId, glob_span: Span) -> Option<Option<ExpnId>> {
let mut span = self.data(); let mut span = self.data();
let mark = span.ctxt.glob_adjust(expn_id, glob_span); let mark = span.ctxt.glob_adjust(expn_id, glob_span);
*self = Span::new(span.lo, span.hi, span.ctxt); *self = Span::new(span.lo, span.hi, span.ctxt, span.parent);
mark mark
} }
@ -848,7 +873,7 @@ impl Span {
) -> Option<Option<ExpnId>> { ) -> Option<Option<ExpnId>> {
let mut span = self.data(); let mut span = self.data();
let mark = span.ctxt.reverse_glob_adjust(expn_id, glob_span); let mark = span.ctxt.reverse_glob_adjust(expn_id, glob_span);
*self = Span::new(span.lo, span.hi, span.ctxt); *self = Span::new(span.lo, span.hi, span.ctxt, span.parent);
mark mark
} }
@ -900,7 +925,7 @@ impl<D: Decoder> Decodable<D> for Span {
let lo = d.read_struct_field("lo", Decodable::decode)?; let lo = d.read_struct_field("lo", Decodable::decode)?;
let hi = d.read_struct_field("hi", Decodable::decode)?; let hi = d.read_struct_field("hi", Decodable::decode)?;
Ok(Span::new(lo, hi, SyntaxContext::root())) Ok(Span::new(lo, hi, SyntaxContext::root(), None))
}) })
} }
} }
@ -961,7 +986,7 @@ impl fmt::Debug for Span {
impl fmt::Debug for SpanData { impl fmt::Debug for SpanData {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
(*SPAN_DEBUG)(Span::new(self.lo, self.hi, self.ctxt), f) (*SPAN_DEBUG)(Span::new(self.lo, self.hi, self.ctxt, self.parent), f)
} }
} }
@ -1922,6 +1947,7 @@ pub struct FileLines {
pub static SPAN_DEBUG: AtomicRef<fn(Span, &mut fmt::Formatter<'_>) -> fmt::Result> = pub static SPAN_DEBUG: AtomicRef<fn(Span, &mut fmt::Formatter<'_>) -> fmt::Result> =
AtomicRef::new(&(default_span_debug as fn(_, &mut fmt::Formatter<'_>) -> _)); AtomicRef::new(&(default_span_debug as fn(_, &mut fmt::Formatter<'_>) -> _));
pub static SPAN_TRACK: AtomicRef<fn(LocalDefId)> = AtomicRef::new(&((|_| {}) as fn(_)));
// _____________________________________________________________________________ // _____________________________________________________________________________
// SpanLinesError, SpanSnippetError, DistinctSources, MalformedSourceMapPositions // SpanLinesError, SpanSnippetError, DistinctSources, MalformedSourceMapPositions
@ -1976,6 +2002,7 @@ impl InnerSpan {
pub trait HashStableContext { pub trait HashStableContext {
fn def_path_hash(&self, def_id: DefId) -> DefPathHash; fn def_path_hash(&self, def_id: DefId) -> DefPathHash;
fn hash_spans(&self) -> bool; fn hash_spans(&self) -> bool;
fn def_span(&self, def_id: LocalDefId) -> Span;
fn span_data_to_lines_and_cols( fn span_data_to_lines_and_cols(
&mut self, &mut self,
span: &SpanData, span: &SpanData,
@ -1999,22 +2026,35 @@ where
fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) { fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
const TAG_VALID_SPAN: u8 = 0; const TAG_VALID_SPAN: u8 = 0;
const TAG_INVALID_SPAN: u8 = 1; const TAG_INVALID_SPAN: u8 = 1;
const TAG_RELATIVE_SPAN: u8 = 2;
if !ctx.hash_spans() { if !ctx.hash_spans() {
return; return;
} }
self.ctxt().hash_stable(ctx, hasher); let span = self.data_untracked();
span.ctxt.hash_stable(ctx, hasher);
span.parent.hash_stable(ctx, hasher);
if self.is_dummy() { if span.is_dummy() {
Hash::hash(&TAG_INVALID_SPAN, hasher); Hash::hash(&TAG_INVALID_SPAN, hasher);
return; return;
} }
if let Some(parent) = span.parent {
let def_span = ctx.def_span(parent).data_untracked();
if def_span.contains(span) {
// This span is enclosed in a definition: only hash the relative position.
Hash::hash(&TAG_RELATIVE_SPAN, hasher);
(span.lo - def_span.lo).to_u32().hash_stable(ctx, hasher);
(span.hi - def_span.lo).to_u32().hash_stable(ctx, hasher);
return;
}
}
// If this is not an empty or invalid span, we want to hash the last // If this is not an empty or invalid span, we want to hash the last
// position that belongs to it, as opposed to hashing the first // position that belongs to it, as opposed to hashing the first
// position past it. // position past it.
let span = self.data();
let (file, line_lo, col_lo, line_hi, col_hi) = match ctx.span_data_to_lines_and_cols(&span) let (file, line_lo, col_lo, line_hi, col_hi) = match ctx.span_data_to_lines_and_cols(&span)
{ {
Some(pos) => pos, Some(pos) => pos,

View file

@ -794,7 +794,7 @@ impl SourceMap {
start_of_next_point.checked_add(width - 1).unwrap_or(start_of_next_point); start_of_next_point.checked_add(width - 1).unwrap_or(start_of_next_point);
let end_of_next_point = BytePos(cmp::max(sp.lo().0 + 1, end_of_next_point)); let end_of_next_point = BytePos(cmp::max(sp.lo().0 + 1, end_of_next_point));
Span::new(BytePos(start_of_next_point), end_of_next_point, sp.ctxt()) Span::new(BytePos(start_of_next_point), end_of_next_point, sp.ctxt(), None)
} }
/// Finds the width of the character, either before or after the end of provided span, /// Finds the width of the character, either before or after the end of provided span,

View file

@ -4,7 +4,9 @@
// The encoding format for inline spans were obtained by optimizing over crates in rustc/libstd. // The encoding format for inline spans were obtained by optimizing over crates in rustc/libstd.
// See https://internals.rust-lang.org/t/rfc-compiler-refactoring-spans/1357/28 // See https://internals.rust-lang.org/t/rfc-compiler-refactoring-spans/1357/28
use crate::def_id::LocalDefId;
use crate::hygiene::SyntaxContext; use crate::hygiene::SyntaxContext;
use crate::SPAN_TRACK;
use crate::{BytePos, SpanData}; use crate::{BytePos, SpanData};
use rustc_data_structures::fx::FxIndexSet; use rustc_data_structures::fx::FxIndexSet;
@ -54,6 +56,10 @@ use rustc_data_structures::fx::FxIndexSet;
/// the code. No crates in `rustc-perf` need more than 15 bits for `ctxt`, /// the code. No crates in `rustc-perf` need more than 15 bits for `ctxt`,
/// but larger crates might need more than 16 bits. /// but larger crates might need more than 16 bits.
/// ///
/// In order to reliably use parented spans in incremental compilation,
/// the dependency to the parent definition's span. This is performed
/// using the callback `SPAN_TRACK` to access the query engine.
///
#[derive(Clone, Copy, Eq, PartialEq, Hash)] #[derive(Clone, Copy, Eq, PartialEq, Hash)]
pub struct Span { pub struct Span {
base_or_index: u32, base_or_index: u32,
@ -70,25 +76,42 @@ pub const DUMMY_SP: Span = Span { base_or_index: 0, len_or_tag: 0, ctxt_or_zero:
impl Span { impl Span {
#[inline] #[inline]
pub fn new(mut lo: BytePos, mut hi: BytePos, ctxt: SyntaxContext) -> Self { pub fn new(
mut lo: BytePos,
mut hi: BytePos,
ctxt: SyntaxContext,
parent: Option<LocalDefId>,
) -> Self {
if lo > hi { if lo > hi {
std::mem::swap(&mut lo, &mut hi); std::mem::swap(&mut lo, &mut hi);
} }
let (base, len, ctxt2) = (lo.0, hi.0 - lo.0, ctxt.as_u32()); let (base, len, ctxt2) = (lo.0, hi.0 - lo.0, ctxt.as_u32());
if len <= MAX_LEN && ctxt2 <= MAX_CTXT { if len <= MAX_LEN && ctxt2 <= MAX_CTXT && parent.is_none() {
// Inline format. // Inline format.
Span { base_or_index: base, len_or_tag: len as u16, ctxt_or_zero: ctxt2 as u16 } Span { base_or_index: base, len_or_tag: len as u16, ctxt_or_zero: ctxt2 as u16 }
} else { } else {
// Interned format. // Interned format.
let index = with_span_interner(|interner| interner.intern(&SpanData { lo, hi, ctxt })); let index =
with_span_interner(|interner| interner.intern(&SpanData { lo, hi, ctxt, parent }));
Span { base_or_index: index, len_or_tag: LEN_TAG, ctxt_or_zero: 0 } Span { base_or_index: index, len_or_tag: LEN_TAG, ctxt_or_zero: 0 }
} }
} }
#[inline] #[inline]
pub fn data(self) -> SpanData { pub fn data(self) -> SpanData {
let data = self.data_untracked();
if let Some(parent) = data.parent {
(*SPAN_TRACK)(parent);
}
data
}
/// Internal function to translate between an encoded span and the expanded representation.
/// This function must not be used outside the incremental engine.
#[inline]
pub fn data_untracked(self) -> SpanData {
if self.len_or_tag != LEN_TAG { if self.len_or_tag != LEN_TAG {
// Inline format. // Inline format.
debug_assert!(self.len_or_tag as u32 <= MAX_LEN); debug_assert!(self.len_or_tag as u32 <= MAX_LEN);
@ -96,6 +119,7 @@ impl Span {
lo: BytePos(self.base_or_index), lo: BytePos(self.base_or_index),
hi: BytePos(self.base_or_index + self.len_or_tag as u32), hi: BytePos(self.base_or_index + self.len_or_tag as u32),
ctxt: SyntaxContext::from_u32(self.ctxt_or_zero as u32), ctxt: SyntaxContext::from_u32(self.ctxt_or_zero as u32),
parent: None,
} }
} else { } else {
// Interned format. // Interned format.

View file

@ -589,7 +589,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// E.g. for `&format!("")`, where we want the span to the // E.g. for `&format!("")`, where we want the span to the
// `format!()` invocation instead of its expansion. // `format!()` invocation instead of its expansion.
if let Some(call_span) = if let Some(call_span) =
iter::successors(Some(expr.span), |s| s.parent()).find(|&s| sp.contains(s)) iter::successors(Some(expr.span), |s| s.parent_callsite())
.find(|&s| sp.contains(s))
{ {
if sm.span_to_snippet(call_span).is_ok() { if sm.span_to_snippet(call_span).is_ok() {
return Some(( return Some((

View file

@ -1,9 +1,15 @@
// revisions: rpass1 rpass2 // revisions: rpass1 rpass2 rpass3 rpass4
// compile-flags: -Zquery-dep-graph // compile-flags: -Zquery-dep-graph
// [rpass1]compile-flags: -Zincremental-ignore-spans
// [rpass2]compile-flags: -Zincremental-ignore-spans
// [rpass3]compile-flags: -Zincremental-relative-spans
// [rpass4]compile-flags: -Zincremental-relative-spans
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![rustc_partition_codegened(module = "change_symbol_export_status-mod1", cfg = "rpass2")] #![rustc_partition_reused(module = "change_symbol_export_status-mod1", cfg = "rpass2")]
#![rustc_partition_reused(module = "change_symbol_export_status-mod2", cfg = "rpass2")] #![rustc_partition_reused(module = "change_symbol_export_status-mod2", cfg = "rpass2")]
#![rustc_partition_reused(module = "change_symbol_export_status-mod1", cfg = "rpass4")]
#![rustc_partition_reused(module = "change_symbol_export_status-mod2", cfg = "rpass4")]
// This test case makes sure that a change in symbol visibility is detected by // This test case makes sure that a change in symbol visibility is detected by
// our dependency tracking. We do this by changing a module's visibility to // our dependency tracking. We do this by changing a module's visibility to
@ -13,13 +19,13 @@
// even from an executable. Plain Rust functions are only exported from Rust // even from an executable. Plain Rust functions are only exported from Rust
// libraries, which our test infrastructure does not support. // libraries, which our test infrastructure does not support.
#[cfg(rpass1)] #[cfg(any(rpass1,rpass3))]
pub mod mod1 { pub mod mod1 {
#[no_mangle] #[no_mangle]
pub fn foo() {} pub fn foo() {}
} }
#[cfg(rpass2)] #[cfg(any(rpass2,rpass4))]
mod mod1 { mod mod1 {
#[no_mangle] #[no_mangle]
pub fn foo() {} pub fn foo() {}

View file

@ -6,8 +6,14 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
@ -19,14 +25,16 @@ fn callee2(_x: u32, _y: i64) {}
// Change Callee (Function) // Change Callee (Function)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_callee_function() { pub fn change_callee_function() {
callee1(1, 2) callee1(1, 2)
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_callee_function() { pub fn change_callee_function() {
callee2(1, 2) callee2(1, 2)
} }
@ -34,14 +42,16 @@ pub fn change_callee_function() {
// Change Argument (Function) // Change Argument (Function)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_argument_function() { pub fn change_argument_function() {
callee1(1, 2) callee1(1, 2)
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_argument_function() { pub fn change_argument_function() {
callee1(1, 3) callee1(1, 3)
} }
@ -50,13 +60,15 @@ pub fn change_argument_function() {
// Change Callee Indirectly (Function) // Change Callee Indirectly (Function)
mod change_callee_indirectly_function { mod change_callee_indirectly_function {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::callee1 as callee; use super::callee1 as callee;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::callee2 as callee; use super::callee2 as callee;
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn change_callee_indirectly_function() { pub fn change_callee_indirectly_function() {
callee(1, 2) callee(1, 2)
} }
@ -70,15 +82,17 @@ impl Struct {
} }
// Change Callee (Method) // Change Callee (Method)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_callee_method() { pub fn change_callee_method() {
let s = Struct; let s = Struct;
s.method1('x', true); s.method1('x', true);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_callee_method() { pub fn change_callee_method() {
let s = Struct; let s = Struct;
s.method2('x', true); s.method2('x', true);
@ -87,15 +101,17 @@ pub fn change_callee_method() {
// Change Argument (Method) // Change Argument (Method)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_argument_method() { pub fn change_argument_method() {
let s = Struct; let s = Struct;
s.method1('x', true); s.method1('x', true);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_argument_method() { pub fn change_argument_method() {
let s = Struct; let s = Struct;
s.method1('y', true); s.method1('y', true);
@ -104,15 +120,17 @@ pub fn change_argument_method() {
// Change Callee (Method, UFCS) // Change Callee (Method, UFCS)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_ufcs_callee_method() { pub fn change_ufcs_callee_method() {
let s = Struct; let s = Struct;
Struct::method1(&s, 'x', true); Struct::method1(&s, 'x', true);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_ufcs_callee_method() { pub fn change_ufcs_callee_method() {
let s = Struct; let s = Struct;
Struct::method2(&s, 'x', true); Struct::method2(&s, 'x', true);
@ -121,32 +139,36 @@ pub fn change_ufcs_callee_method() {
// Change Argument (Method, UFCS) // Change Argument (Method, UFCS)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_argument_method_ufcs() { pub fn change_argument_method_ufcs() {
let s = Struct; let s = Struct;
Struct::method1(&s, 'x', true); Struct::method1(&s, 'x', true);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_argument_method_ufcs() { pub fn change_argument_method_ufcs() {
let s = Struct; let s = Struct;
Struct::method1(&s, 'x', false); Struct::method1(&s, 'x',false);
} }
// Change To UFCS // Change To UFCS
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_to_ufcs() { pub fn change_to_ufcs() {
let s = Struct; let s = Struct;
s.method1('x', true); s.method1('x', true); // ------
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
// One might think this would be expanded in the hir_owner_nodes/Mir, but it actually // One might think this would be expanded in the hir_owner_nodes/Mir, but it actually
// results in slightly different hir_owner/Mir. // results in slightly different hir_owner/Mir.
pub fn change_to_ufcs() { pub fn change_to_ufcs() {
@ -162,15 +184,15 @@ impl Struct2 {
// Change UFCS Callee Indirectly // Change UFCS Callee Indirectly
pub mod change_ufcs_callee_indirectly { pub mod change_ufcs_callee_indirectly {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::Struct as Struct; use super::Struct as Struct;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::Struct2 as Struct; use super::Struct2 as Struct;
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_ufcs_callee_indirectly() { pub fn change_ufcs_callee_indirectly() {
let s = Struct; let s = Struct;
Struct::method1(&s, 'q', false) Struct::method1(&s, 'q', false)

View file

@ -6,8 +6,14 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans -Zmir-opt-level=0 // compile-flags: -Z query-dep-graph -Zmir-opt-level=0
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
@ -15,14 +21,16 @@
// Change closure body // Change closure body
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_closure_body() { pub fn change_closure_body() {
let _ = || 1u32; let _ = || 1u32;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
pub fn change_closure_body() { pub fn change_closure_body() {
let _ = || 3u32; let _ = || 3u32;
} }
@ -30,15 +38,17 @@ pub fn change_closure_body() {
// Add parameter // Add parameter
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_parameter() { pub fn add_parameter() {
let x = 0u32; let x = 0u32;
let _ = || x + 1; let _ = | | x + 1;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn add_parameter() { pub fn add_parameter() {
let x = 0u32; let x = 0u32;
let _ = |x: u32| x + 1; let _ = |x: u32| x + 1;
@ -47,14 +57,16 @@ pub fn add_parameter() {
// Change parameter pattern // Change parameter pattern
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_parameter_pattern() { pub fn change_parameter_pattern() {
let _ = |x: (u32,)| x; let _ = | x : (u32,)| x;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, typeck, optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, typeck, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, typeck, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_parameter_pattern() { pub fn change_parameter_pattern() {
let _ = |(x,): (u32,)| x; let _ = |(x,): (u32,)| x;
} }
@ -62,14 +74,16 @@ pub fn change_parameter_pattern() {
// Add `move` to closure // Add `move` to closure
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_move() { pub fn add_move() {
let _ = || 1; let _ = || 1;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn add_move() { pub fn add_move() {
let _ = move || 1; let _ = move || 1;
} }
@ -77,15 +91,17 @@ pub fn add_move() {
// Add type ascription to parameter // Add type ascription to parameter
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_type_ascription_to_parameter() { pub fn add_type_ascription_to_parameter() {
let closure = |x| x + 1u32; let closure = |x | x + 1u32;
let _: u32 = closure(1); let _: u32 = closure(1);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2", except = "hir_owner_nodes, typeck")] #[rustc_clean(cfg = "cfail2", except = "hir_owner_nodes, typeck")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5", except = "hir_owner_nodes, typeck")]
#[rustc_clean(cfg = "cfail6")]
pub fn add_type_ascription_to_parameter() { pub fn add_type_ascription_to_parameter() {
let closure = |x: u32| x + 1u32; let closure = |x: u32| x + 1u32;
let _: u32 = closure(1); let _: u32 = closure(1);
@ -94,15 +110,17 @@ pub fn add_type_ascription_to_parameter() {
// Change parameter type // Change parameter type
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_parameter_type() { pub fn change_parameter_type() {
let closure = |x: u32| (x as u64) + 1; let closure = |x: u32| (x as u64) + 1;
let _ = closure(1); let _ = closure(1);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_parameter_type() { pub fn change_parameter_type() {
let closure = |x: u16| (x as u64) + 1; let closure = |x: u16| (x as u64) + 1;
let _ = closure(1); let _ = closure(1);

View file

@ -7,7 +7,7 @@
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]

View file

@ -6,8 +6,14 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans -Zmir-opt-level=0 // compile-flags: -Z query-dep-graph -Zmir-opt-level=0
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
@ -24,7 +30,7 @@ pub enum Enum {
} }
// Change field value (struct-like) ----------------------------------------- // Change field value (struct-like) -----------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_field_value_struct_like() -> Enum { pub fn change_field_value_struct_like() -> Enum {
Enum::Struct { Enum::Struct {
x: 0, x: 0,
@ -33,9 +39,11 @@ pub fn change_field_value_struct_like() -> Enum {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_field_value_struct_like() -> Enum { pub fn change_field_value_struct_like() -> Enum {
Enum::Struct { Enum::Struct {
x: 0, x: 0,
@ -47,7 +55,7 @@ pub fn change_field_value_struct_like() -> Enum {
// Change field order (struct-like) ----------------------------------------- // Change field order (struct-like) -----------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_field_order_struct_like() -> Enum { pub fn change_field_order_struct_like() -> Enum {
Enum::Struct { Enum::Struct {
x: 3, x: 3,
@ -56,9 +64,11 @@ pub fn change_field_order_struct_like() -> Enum {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
// FIXME(michaelwoerister):Interesting. I would have thought that that changes the MIR. And it // FIXME(michaelwoerister):Interesting. I would have thought that that changes the MIR. And it
// would if it were not all constants // would if it were not all constants
pub fn change_field_order_struct_like() -> Enum { pub fn change_field_order_struct_like() -> Enum {
@ -86,18 +96,20 @@ pub enum Enum2 {
} }
// Change constructor path (struct-like) ------------------------------------ // Change constructor path (struct-like) ------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_constructor_path_struct_like() { pub fn change_constructor_path_struct_like() {
let _ = Enum::Struct { let _ = Enum ::Struct {
x: 0, x: 0,
y: 1, y: 1,
z: 2, z: 2,
}; };
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_constructor_path_struct_like() { pub fn change_constructor_path_struct_like() {
let _ = Enum2::Struct { let _ = Enum2::Struct {
x: 0, x: 0,
@ -109,18 +121,20 @@ pub fn change_constructor_path_struct_like() {
// Change variant (regular struct) ------------------------------------ // Change variant (regular struct) ------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_constructor_variant_struct_like() { pub fn change_constructor_variant_struct_like() {
let _ = Enum2::Struct { let _ = Enum2::Struct {
x: 0, x: 0,
y: 1, y: 1,
z: 2, z: 2,
}; };
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_constructor_variant_struct_like() { pub fn change_constructor_variant_struct_like() {
let _ = Enum2::Struct2 { let _ = Enum2::Struct2 {
x: 0, x: 0,
@ -132,9 +146,9 @@ pub fn change_constructor_variant_struct_like() {
// Change constructor path indirectly (struct-like) ------------------------- // Change constructor path indirectly (struct-like) -------------------------
pub mod change_constructor_path_indirectly_struct_like { pub mod change_constructor_path_indirectly_struct_like {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::Enum as TheEnum; use super::Enum as TheEnum;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::Enum2 as TheEnum; use super::Enum2 as TheEnum;
#[rustc_clean( #[rustc_clean(
@ -143,6 +157,12 @@ pub mod change_constructor_path_indirectly_struct_like {
typeck" typeck"
)] )]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(
cfg="cfail5",
except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,\
typeck"
)]
#[rustc_clean(cfg="cfail6")]
pub fn function() -> TheEnum { pub fn function() -> TheEnum {
TheEnum::Struct { TheEnum::Struct {
x: 0, x: 0,
@ -156,13 +176,15 @@ pub mod change_constructor_path_indirectly_struct_like {
// Change constructor variant indirectly (struct-like) --------------------------- // Change constructor variant indirectly (struct-like) ---------------------------
pub mod change_constructor_variant_indirectly_struct_like { pub mod change_constructor_variant_indirectly_struct_like {
use super::Enum2; use super::Enum2;
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::Enum2::Struct as Variant; use super::Enum2::Struct as Variant;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::Enum2::Struct2 as Variant; use super::Enum2::Struct2 as Variant;
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn function() -> Enum2 { pub fn function() -> Enum2 {
Variant { Variant {
x: 0, x: 0,
@ -174,14 +196,16 @@ pub mod change_constructor_variant_indirectly_struct_like {
// Change field value (tuple-like) ------------------------------------------- // Change field value (tuple-like) -------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_field_value_tuple_like() -> Enum { pub fn change_field_value_tuple_like() -> Enum {
Enum::Tuple(0, 1, 2) Enum::Tuple(0, 1, 2)
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_field_value_tuple_like() -> Enum { pub fn change_field_value_tuple_like() -> Enum {
Enum::Tuple(0, 1, 3) Enum::Tuple(0, 1, 3)
} }
@ -189,17 +213,22 @@ pub fn change_field_value_tuple_like() -> Enum {
// Change constructor path (tuple-like) -------------------------------------- // Change constructor path (tuple-like) --------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_constructor_path_tuple_like() { pub fn change_constructor_path_tuple_like() {
let _ = Enum::Tuple(0, 1, 2); let _ = Enum ::Tuple(0, 1, 2);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean( #[rustc_clean(
cfg="cfail2", cfg="cfail2",
except="hir_owner_nodes,optimized_mir,typeck" except="hir_owner_nodes,optimized_mir,typeck"
)] )]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(
cfg="cfail5",
except="hir_owner_nodes,optimized_mir,typeck"
)]
#[rustc_clean(cfg="cfail6")]
pub fn change_constructor_path_tuple_like() { pub fn change_constructor_path_tuple_like() {
let _ = Enum2::Tuple(0, 1, 2); let _ = Enum2::Tuple(0, 1, 2);
} }
@ -207,17 +236,22 @@ pub fn change_constructor_path_tuple_like() {
// Change constructor variant (tuple-like) -------------------------------------- // Change constructor variant (tuple-like) --------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_constructor_variant_tuple_like() { pub fn change_constructor_variant_tuple_like() {
let _ = Enum2::Tuple(0, 1, 2); let _ = Enum2::Tuple (0, 1, 2);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean( #[rustc_clean(
cfg="cfail2", cfg="cfail2",
except="hir_owner_nodes,optimized_mir,typeck" except="hir_owner_nodes,optimized_mir,typeck"
)] )]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(
cfg="cfail5",
except="hir_owner_nodes,optimized_mir,typeck"
)]
#[rustc_clean(cfg="cfail6")]
pub fn change_constructor_variant_tuple_like() { pub fn change_constructor_variant_tuple_like() {
let _ = Enum2::Tuple2(0, 1, 2); let _ = Enum2::Tuple2(0, 1, 2);
} }
@ -225,9 +259,9 @@ pub fn change_constructor_variant_tuple_like() {
// Change constructor path indirectly (tuple-like) --------------------------- // Change constructor path indirectly (tuple-like) ---------------------------
pub mod change_constructor_path_indirectly_tuple_like { pub mod change_constructor_path_indirectly_tuple_like {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::Enum as TheEnum; use super::Enum as TheEnum;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::Enum2 as TheEnum; use super::Enum2 as TheEnum;
#[rustc_clean( #[rustc_clean(
@ -236,6 +270,12 @@ pub mod change_constructor_path_indirectly_tuple_like {
typeck" typeck"
)] )]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(
cfg="cfail5",
except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,\
typeck"
)]
#[rustc_clean(cfg="cfail6")]
pub fn function() -> TheEnum { pub fn function() -> TheEnum {
TheEnum::Tuple(0, 1, 2) TheEnum::Tuple(0, 1, 2)
} }
@ -246,13 +286,15 @@ pub mod change_constructor_path_indirectly_tuple_like {
// Change constructor variant indirectly (tuple-like) --------------------------- // Change constructor variant indirectly (tuple-like) ---------------------------
pub mod change_constructor_variant_indirectly_tuple_like { pub mod change_constructor_variant_indirectly_tuple_like {
use super::Enum2; use super::Enum2;
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::Enum2::Tuple as Variant; use super::Enum2::Tuple as Variant;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::Enum2::Tuple2 as Variant; use super::Enum2::Tuple2 as Variant;
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn function() -> Enum2 { pub fn function() -> Enum2 {
Variant(0, 1, 2) Variant(0, 1, 2)
} }
@ -272,14 +314,16 @@ pub enum Clike2 {
} }
// Change constructor path (C-like) -------------------------------------- // Change constructor path (C-like) --------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_constructor_path_c_like() { pub fn change_constructor_path_c_like() {
let _x = Clike::B; let _x = Clike ::B;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_constructor_path_c_like() { pub fn change_constructor_path_c_like() {
let _x = Clike2::B; let _x = Clike2::B;
} }
@ -287,14 +331,16 @@ pub fn change_constructor_path_c_like() {
// Change constructor variant (C-like) -------------------------------------- // Change constructor variant (C-like) --------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_constructor_variant_c_like() { pub fn change_constructor_variant_c_like() {
let _x = Clike::A; let _x = Clike::A;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_constructor_variant_c_like() { pub fn change_constructor_variant_c_like() {
let _x = Clike::C; let _x = Clike::C;
} }
@ -302,9 +348,9 @@ pub fn change_constructor_variant_c_like() {
// Change constructor path indirectly (C-like) --------------------------- // Change constructor path indirectly (C-like) ---------------------------
pub mod change_constructor_path_indirectly_c_like { pub mod change_constructor_path_indirectly_c_like {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::Clike as TheEnum; use super::Clike as TheEnum;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::Clike2 as TheEnum; use super::Clike2 as TheEnum;
#[rustc_clean( #[rustc_clean(
@ -313,6 +359,12 @@ pub mod change_constructor_path_indirectly_c_like {
typeck" typeck"
)] )]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(
cfg="cfail5",
except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,\
typeck"
)]
#[rustc_clean(cfg="cfail6")]
pub fn function() -> TheEnum { pub fn function() -> TheEnum {
TheEnum::B TheEnum::B
} }
@ -323,13 +375,15 @@ pub mod change_constructor_path_indirectly_c_like {
// Change constructor variant indirectly (C-like) --------------------------- // Change constructor variant indirectly (C-like) ---------------------------
pub mod change_constructor_variant_indirectly_c_like { pub mod change_constructor_variant_indirectly_c_like {
use super::Clike; use super::Clike;
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::Clike::A as Variant; use super::Clike::A as Variant;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::Clike::B as Variant; use super::Clike::B as Variant;
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn function() -> Clike { pub fn function() -> Clike {
Variant Variant
} }

View file

@ -11,8 +11,14 @@
// the same between rev2 and rev3. // the same between rev2 and rev3.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
@ -22,12 +28,14 @@
// Change enum visibility ----------------------------------------------------- // Change enum visibility -----------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumVisibility { A } enum EnumVisibility { A }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
pub enum EnumVisibility { pub enum EnumVisibility {
A A
} }
@ -35,15 +43,17 @@ pub enum EnumVisibility {
// Change name of a c-style variant ------------------------------------------- // Change name of a c-style variant -------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumChangeNameCStyleVariant { enum EnumChangeNameCStyleVariant {
Variant1, Variant1,
Variant2, Variant2,
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumChangeNameCStyleVariant { enum EnumChangeNameCStyleVariant {
Variant1, Variant1,
Variant2Changed, Variant2Changed,
@ -52,15 +62,17 @@ enum EnumChangeNameCStyleVariant {
// Change name of a tuple-style variant --------------------------------------- // Change name of a tuple-style variant ---------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumChangeNameTupleStyleVariant { enum EnumChangeNameTupleStyleVariant {
Variant1, Variant1,
Variant2(u32, f32), Variant2(u32, f32),
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumChangeNameTupleStyleVariant { enum EnumChangeNameTupleStyleVariant {
Variant1, Variant1,
Variant2Changed(u32, f32), Variant2Changed(u32, f32),
@ -69,15 +81,17 @@ enum EnumChangeNameTupleStyleVariant {
// Change name of a struct-style variant -------------------------------------- // Change name of a struct-style variant --------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumChangeNameStructStyleVariant { enum EnumChangeNameStructStyleVariant {
Variant1, Variant1,
Variant2 { a: u32, b: f32 }, Variant2 { a: u32, b: f32 },
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumChangeNameStructStyleVariant { enum EnumChangeNameStructStyleVariant {
Variant1, Variant1,
Variant2Changed { a: u32, b: f32 }, Variant2Changed { a: u32, b: f32 },
@ -86,31 +100,33 @@ enum EnumChangeNameStructStyleVariant {
// Change the value of a c-style variant -------------------------------------- // Change the value of a c-style variant --------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumChangeValueCStyleVariant0 { enum EnumChangeValueCStyleVariant0 {
Variant1, Variant1,
Variant2 = 11, Variant2 = 11,
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
enum EnumChangeValueCStyleVariant0 { enum EnumChangeValueCStyleVariant0 {
Variant1, Variant1,
Variant2 = 22,
Variant2 =
22,
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumChangeValueCStyleVariant1 { enum EnumChangeValueCStyleVariant1 {
Variant1, Variant1,
Variant2, Variant2,
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumChangeValueCStyleVariant1 { enum EnumChangeValueCStyleVariant1 {
Variant1, Variant1,
Variant2 = 11, Variant2 = 11,
@ -119,14 +135,16 @@ enum EnumChangeValueCStyleVariant1 {
// Add a c-style variant ------------------------------------------------------ // Add a c-style variant ------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumAddCStyleVariant { enum EnumAddCStyleVariant {
Variant1, Variant1,
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumAddCStyleVariant { enum EnumAddCStyleVariant {
Variant1, Variant1,
Variant2, Variant2,
@ -135,15 +153,17 @@ enum EnumAddCStyleVariant {
// Remove a c-style variant --------------------------------------------------- // Remove a c-style variant ---------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumRemoveCStyleVariant { enum EnumRemoveCStyleVariant {
Variant1, Variant1,
Variant2, Variant2,
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumRemoveCStyleVariant { enum EnumRemoveCStyleVariant {
Variant1, Variant1,
} }
@ -151,14 +171,16 @@ enum EnumRemoveCStyleVariant {
// Add a tuple-style variant -------------------------------------------------- // Add a tuple-style variant --------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumAddTupleStyleVariant { enum EnumAddTupleStyleVariant {
Variant1, Variant1,
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumAddTupleStyleVariant { enum EnumAddTupleStyleVariant {
Variant1, Variant1,
Variant2(u32, f32), Variant2(u32, f32),
@ -167,15 +189,17 @@ enum EnumAddTupleStyleVariant {
// Remove a tuple-style variant ----------------------------------------------- // Remove a tuple-style variant -----------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumRemoveTupleStyleVariant { enum EnumRemoveTupleStyleVariant {
Variant1, Variant1,
Variant2(u32, f32), Variant2(u32, f32),
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumRemoveTupleStyleVariant { enum EnumRemoveTupleStyleVariant {
Variant1, Variant1,
} }
@ -183,14 +207,16 @@ enum EnumRemoveTupleStyleVariant {
// Add a struct-style variant ------------------------------------------------- // Add a struct-style variant -------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumAddStructStyleVariant { enum EnumAddStructStyleVariant {
Variant1, Variant1,
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumAddStructStyleVariant { enum EnumAddStructStyleVariant {
Variant1, Variant1,
Variant2 { a: u32, b: f32 }, Variant2 { a: u32, b: f32 },
@ -199,15 +225,17 @@ enum EnumAddStructStyleVariant {
// Remove a struct-style variant ---------------------------------------------- // Remove a struct-style variant ----------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumRemoveStructStyleVariant { enum EnumRemoveStructStyleVariant {
Variant1, Variant1,
Variant2 { a: u32, b: f32 }, Variant2 { a: u32, b: f32 },
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumRemoveStructStyleVariant { enum EnumRemoveStructStyleVariant {
Variant1, Variant1,
} }
@ -215,14 +243,16 @@ enum EnumRemoveStructStyleVariant {
// Change the type of a field in a tuple-style variant ------------------------ // Change the type of a field in a tuple-style variant ------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumChangeFieldTypeTupleStyleVariant { enum EnumChangeFieldTypeTupleStyleVariant {
Variant1(u32, u32), Variant1(u32, u32),
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
enum EnumChangeFieldTypeTupleStyleVariant { enum EnumChangeFieldTypeTupleStyleVariant {
Variant1(u32, Variant1(u32,
u64), u64),
@ -231,15 +261,17 @@ enum EnumChangeFieldTypeTupleStyleVariant {
// Change the type of a field in a struct-style variant ----------------------- // Change the type of a field in a struct-style variant -----------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumChangeFieldTypeStructStyleVariant { enum EnumChangeFieldTypeStructStyleVariant {
Variant1, Variant1,
Variant2 { a: u32, b: u32 }, Variant2 { a: u32, b: u32 },
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
enum EnumChangeFieldTypeStructStyleVariant { enum EnumChangeFieldTypeStructStyleVariant {
Variant1, Variant1,
Variant2 { Variant2 {
@ -251,14 +283,16 @@ enum EnumChangeFieldTypeStructStyleVariant {
// Change the name of a field in a struct-style variant ----------------------- // Change the name of a field in a struct-style variant -----------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumChangeFieldNameStructStyleVariant { enum EnumChangeFieldNameStructStyleVariant {
Variant1 { a: u32, b: u32 }, Variant1 { a: u32, b: u32 },
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumChangeFieldNameStructStyleVariant { enum EnumChangeFieldNameStructStyleVariant {
Variant1 { a: u32, c: u32 }, Variant1 { a: u32, c: u32 },
} }
@ -266,14 +300,16 @@ enum EnumChangeFieldNameStructStyleVariant {
// Change order of fields in a tuple-style variant ---------------------------- // Change order of fields in a tuple-style variant ----------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumChangeOrderTupleStyleVariant { enum EnumChangeOrderTupleStyleVariant {
Variant1(u32, u64), Variant1(u32, u64),
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
enum EnumChangeOrderTupleStyleVariant { enum EnumChangeOrderTupleStyleVariant {
Variant1( Variant1(
u64, u64,
@ -283,14 +319,16 @@ enum EnumChangeOrderTupleStyleVariant {
// Change order of fields in a struct-style variant --------------------------- // Change order of fields in a struct-style variant ---------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumChangeFieldOrderStructStyleVariant { enum EnumChangeFieldOrderStructStyleVariant {
Variant1 { a: u32, b: f32 }, Variant1 { a: u32, b: f32 },
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumChangeFieldOrderStructStyleVariant { enum EnumChangeFieldOrderStructStyleVariant {
Variant1 { b: f32, a: u32 }, Variant1 { b: f32, a: u32 },
} }
@ -298,14 +336,16 @@ enum EnumChangeFieldOrderStructStyleVariant {
// Add a field to a tuple-style variant --------------------------------------- // Add a field to a tuple-style variant ---------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumAddFieldTupleStyleVariant { enum EnumAddFieldTupleStyleVariant {
Variant1(u32, u32), Variant1(u32, u32),
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumAddFieldTupleStyleVariant { enum EnumAddFieldTupleStyleVariant {
Variant1(u32, u32, u32), Variant1(u32, u32, u32),
} }
@ -313,14 +353,16 @@ enum EnumAddFieldTupleStyleVariant {
// Add a field to a struct-style variant -------------------------------------- // Add a field to a struct-style variant --------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumAddFieldStructStyleVariant { enum EnumAddFieldStructStyleVariant {
Variant1 { a: u32, b: u32 }, Variant1 { a: u32, b: u32 },
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumAddFieldStructStyleVariant { enum EnumAddFieldStructStyleVariant {
Variant1 { a: u32, b: u32, c: u32 }, Variant1 { a: u32, b: u32, c: u32 },
} }
@ -328,15 +370,17 @@ enum EnumAddFieldStructStyleVariant {
// Add #[must_use] to the enum ------------------------------------------------ // Add #[must_use] to the enum ------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumAddMustUse { enum EnumAddMustUse {
Variant1, Variant1,
Variant2, Variant2,
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
#[must_use] #[must_use]
enum EnumAddMustUse { enum EnumAddMustUse {
Variant1, Variant1,
@ -346,15 +390,17 @@ enum EnumAddMustUse {
// Add #[repr(C)] to the enum ------------------------------------------------- // Add #[repr(C)] to the enum -------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumAddReprC { enum EnumAddReprC {
Variant1, Variant1,
Variant2, Variant2,
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="type_of")] #[rustc_clean(cfg="cfail2", except="type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="type_of")]
#[rustc_clean(cfg="cfail6")]
#[repr(C)] #[repr(C)]
enum EnumAddReprC { enum EnumAddReprC {
Variant1, Variant1,
@ -364,14 +410,16 @@ enum EnumAddReprC {
// Change the name of a type parameter ---------------------------------------- // Change the name of a type parameter ----------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumChangeNameOfTypeParameter<S> { enum EnumChangeNameOfTypeParameter<S> {
Variant1(S), Variant1(S),
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumChangeNameOfTypeParameter<T> { enum EnumChangeNameOfTypeParameter<T> {
Variant1(T), Variant1(T),
} }
@ -379,15 +427,17 @@ enum EnumChangeNameOfTypeParameter<T> {
// Add a type parameter ------------------------------------------------------ // Add a type parameter ------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumAddTypeParameter<S> { enum EnumAddTypeParameter<S> {
Variant1(S), Variant1(S),
Variant2(S), Variant2(S),
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumAddTypeParameter<S, T> { enum EnumAddTypeParameter<S, T> {
Variant1(S), Variant1(S),
Variant2(T), Variant2(T),
@ -396,14 +446,16 @@ enum EnumAddTypeParameter<S, T> {
// Change the name of a lifetime parameter ------------------------------------ // Change the name of a lifetime parameter ------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumChangeNameOfLifetimeParameter<'a> { enum EnumChangeNameOfLifetimeParameter<'a> {
Variant1(&'a u32), Variant1(&'a u32),
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumChangeNameOfLifetimeParameter<'b> { enum EnumChangeNameOfLifetimeParameter<'b> {
Variant1(&'b u32), Variant1(&'b u32),
} }
@ -411,15 +463,17 @@ enum EnumChangeNameOfLifetimeParameter<'b> {
// Add a lifetime parameter --------------------------------------------------- // Add a lifetime parameter ---------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumAddLifetimeParameter<'a> { enum EnumAddLifetimeParameter<'a> {
Variant1(&'a u32), Variant1(&'a u32),
Variant2(&'a u32), Variant2(&'a u32),
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumAddLifetimeParameter<'a, 'b> { enum EnumAddLifetimeParameter<'a, 'b> {
Variant1(&'a u32), Variant1(&'a u32),
Variant2(&'b u32), Variant2(&'b u32),
@ -428,30 +482,34 @@ enum EnumAddLifetimeParameter<'a, 'b> {
// Add a lifetime bound to a lifetime parameter ------------------------------- // Add a lifetime bound to a lifetime parameter -------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumAddLifetimeParameterBound<'a, 'b> { enum EnumAddLifetimeParameterBound<'a, 'b> {
Variant1(&'a u32), Variant1(&'a u32),
Variant2(&'b u32), Variant2(&'b u32),
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumAddLifetimeParameterBound<'a, 'b: 'a> { enum EnumAddLifetimeParameterBound<'a, 'b: 'a> {
Variant1(&'a u32), Variant1(&'a u32),
Variant2(&'b u32), Variant2(&'b u32),
} }
// Add a lifetime bound to a type parameter ----------------------------------- // Add a lifetime bound to a type parameter -----------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumAddLifetimeBoundToParameter<'a, T> { enum EnumAddLifetimeBoundToParameter<'a, T> {
Variant1(T), Variant1(T),
Variant2(&'a u32), Variant2(&'a u32),
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumAddLifetimeBoundToParameter<'a, T: 'a> { enum EnumAddLifetimeBoundToParameter<'a, T: 'a> {
Variant1(T), Variant1(T),
Variant2(&'a u32), Variant2(&'a u32),
@ -460,14 +518,16 @@ enum EnumAddLifetimeBoundToParameter<'a, T: 'a> {
// Add a trait bound to a type parameter -------------------------------------- // Add a trait bound to a type parameter --------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumAddTraitBound<S> { enum EnumAddTraitBound<S> {
Variant1(S), Variant1(S),
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumAddTraitBound<T: Sync> { enum EnumAddTraitBound<T: Sync> {
Variant1(T), Variant1(T),
} }
@ -475,15 +535,17 @@ enum EnumAddTraitBound<T: Sync> {
// Add a lifetime bound to a lifetime parameter in where clause --------------- // Add a lifetime bound to a lifetime parameter in where clause ---------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumAddLifetimeParameterBoundWhere<'a, 'b> { enum EnumAddLifetimeParameterBoundWhere<'a, 'b> {
Variant1(&'a u32), Variant1(&'a u32),
Variant2(&'b u32), Variant2(&'b u32),
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumAddLifetimeParameterBoundWhere<'a, 'b> where 'b: 'a { enum EnumAddLifetimeParameterBoundWhere<'a, 'b> where 'b: 'a {
Variant1(&'a u32), Variant1(&'a u32),
Variant2(&'b u32), Variant2(&'b u32),
@ -492,15 +554,17 @@ enum EnumAddLifetimeParameterBoundWhere<'a, 'b> where 'b: 'a {
// Add a lifetime bound to a type parameter in where clause ------------------- // Add a lifetime bound to a type parameter in where clause -------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumAddLifetimeBoundToParameterWhere<'a, T> { enum EnumAddLifetimeBoundToParameterWhere<'a, T> {
Variant1(T), Variant1(T),
Variant2(&'a u32), Variant2(&'a u32),
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumAddLifetimeBoundToParameterWhere<'a, T> where T: 'a { enum EnumAddLifetimeBoundToParameterWhere<'a, T> where T: 'a {
Variant1(T), Variant1(T),
Variant2(&'a u32), Variant2(&'a u32),
@ -509,14 +573,16 @@ enum EnumAddLifetimeBoundToParameterWhere<'a, T> where T: 'a {
// Add a trait bound to a type parameter in where clause ---------------------- // Add a trait bound to a type parameter in where clause ----------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumAddTraitBoundWhere<S> { enum EnumAddTraitBoundWhere<S> {
Variant1(S), Variant1(S),
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
#[rustc_clean(cfg="cfail6")]
enum EnumAddTraitBoundWhere<T> where T: Sync { enum EnumAddTraitBoundWhere<T> where T: Sync {
Variant1(T), Variant1(T),
} }
@ -524,15 +590,17 @@ enum EnumAddTraitBoundWhere<T> where T: Sync {
// In an enum with two variants, swap usage of type parameters ---------------- // In an enum with two variants, swap usage of type parameters ----------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumSwapUsageTypeParameters<A, B> { enum EnumSwapUsageTypeParameters<A, B> {
Variant1 { a: A }, Variant1 { a: A },
Variant2 { a: B }, Variant2 { a: B },
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
enum EnumSwapUsageTypeParameters<A, B> { enum EnumSwapUsageTypeParameters<A, B> {
Variant1 { Variant1 {
a: B a: B
@ -545,15 +613,17 @@ enum EnumSwapUsageTypeParameters<A, B> {
// In an enum with two variants, swap usage of lifetime parameters ------------ // In an enum with two variants, swap usage of lifetime parameters ------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
enum EnumSwapUsageLifetimeParameters<'a, 'b> { enum EnumSwapUsageLifetimeParameters<'a, 'b> {
Variant1 { a: &'a u32 }, Variant1 { a: &'a u32 },
Variant2 { b: &'b u32 }, Variant2 { b: &'b u32 },
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
enum EnumSwapUsageLifetimeParameters<'a, 'b> { enum EnumSwapUsageLifetimeParameters<'a, 'b> {
Variant1 { Variant1 {
a: &'b u32 a: &'b u32
@ -572,13 +642,15 @@ struct ReferencedType2;
// Change field type in tuple-style variant indirectly by modifying a use statement // Change field type in tuple-style variant indirectly by modifying a use statement
mod change_field_type_indirectly_tuple_style { mod change_field_type_indirectly_tuple_style {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::ReferencedType1 as FieldType; use super::ReferencedType1 as FieldType;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedType2 as FieldType; use super::ReferencedType2 as FieldType;
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
enum TupleStyle { enum TupleStyle {
Variant1( Variant1(
FieldType FieldType
@ -590,13 +662,15 @@ mod change_field_type_indirectly_tuple_style {
// Change field type in record-style variant indirectly by modifying a use statement // Change field type in record-style variant indirectly by modifying a use statement
mod change_field_type_indirectly_struct_style { mod change_field_type_indirectly_struct_style {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::ReferencedType1 as FieldType; use super::ReferencedType1 as FieldType;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedType2 as FieldType; use super::ReferencedType2 as FieldType;
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
enum StructStyle { enum StructStyle {
Variant1 { Variant1 {
a: FieldType a: FieldType
@ -613,13 +687,15 @@ trait ReferencedTrait2 {}
// Change trait bound of type parameter indirectly by modifying a use statement // Change trait bound of type parameter indirectly by modifying a use statement
mod change_trait_bound_indirectly { mod change_trait_bound_indirectly {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::ReferencedTrait1 as Trait; use super::ReferencedTrait1 as Trait;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedTrait2 as Trait; use super::ReferencedTrait2 as Trait;
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")]
#[rustc_clean(cfg="cfail6")]
enum Enum<T: Trait> { enum Enum<T: Trait> {
Variant1(T) Variant1(T)
} }
@ -629,13 +705,15 @@ mod change_trait_bound_indirectly {
// Change trait bound of type parameter in where clause indirectly by modifying a use statement // Change trait bound of type parameter in where clause indirectly by modifying a use statement
mod change_trait_bound_indirectly_where { mod change_trait_bound_indirectly_where {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::ReferencedTrait1 as Trait; use super::ReferencedTrait1 as Trait;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedTrait2 as Trait; use super::ReferencedTrait2 as Trait;
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")]
#[rustc_clean(cfg="cfail6")]
enum Enum<T> where T: Trait { enum Enum<T> where T: Trait {
Variant1(T) Variant1(T)
} }

View file

@ -1,6 +1,12 @@
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
@ -10,14 +16,16 @@
// the hash of the hir_owner_nodes node should change, but not the hash of // the hash of the hir_owner_nodes node should change, but not the hash of
// either the hir_owner or the Metadata node. // either the hir_owner or the Metadata node.
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn body_not_exported_to_metadata() -> u32 { pub fn body_not_exported_to_metadata() -> u32 {
1 1
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn body_not_exported_to_metadata() -> u32 { pub fn body_not_exported_to_metadata() -> u32 {
2 2
} }
@ -28,15 +36,17 @@ pub fn body_not_exported_to_metadata() -> u32 {
// marked as #[inline]. Only the hash of the hir_owner depnode should be // marked as #[inline]. Only the hash of the hir_owner depnode should be
// unaffected by a change to the body. // unaffected by a change to the body.
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
#[inline] #[inline]
pub fn body_exported_to_metadata_because_of_inline() -> u32 { pub fn body_exported_to_metadata_because_of_inline() -> u32 {
1 1
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
#[inline] #[inline]
pub fn body_exported_to_metadata_because_of_inline() -> u32 { pub fn body_exported_to_metadata_because_of_inline() -> u32 {
2 2
@ -48,15 +58,17 @@ pub fn body_exported_to_metadata_because_of_inline() -> u32 {
// generic. Only the hash of the hir_owner depnode should be // generic. Only the hash of the hir_owner depnode should be
// unaffected by a change to the body. // unaffected by a change to the body.
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
#[inline] #[inline]
pub fn body_exported_to_metadata_because_of_generic() -> u32 { pub fn body_exported_to_metadata_because_of_generic() -> u32 {
1 1
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
#[inline] #[inline]
pub fn body_exported_to_metadata_because_of_generic() -> u32 { pub fn body_exported_to_metadata_because_of_generic() -> u32 {
2 2

View file

@ -6,8 +6,14 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
@ -15,146 +21,168 @@
#![crate_type = "rlib"] #![crate_type = "rlib"]
// Change function name -------------------------------------------------------- // Change function name --------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
extern "C" { extern "C" {
pub fn change_function_name1(c: i64) -> i32; pub fn change_function_name1(c: i64) -> i32;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2", except = "hir_owner")] #[rustc_clean(cfg = "cfail2", except = "hir_owner")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5", except = "hir_owner")]
#[rustc_clean(cfg = "cfail6")]
extern "C" { extern "C" {
pub fn change_function_name2(c: i64) -> i32; pub fn change_function_name2(c: i64) -> i32;
} }
// Change parameter name ------------------------------------------------------- // Change parameter name -------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
extern "C" { extern "C" {
pub fn change_parameter_name(c: i64) -> i32; pub fn change_parameter_name(c: i64) -> i32;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")] #[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5")]
#[rustc_clean(cfg = "cfail6")]
extern "C" { extern "C" {
pub fn change_parameter_name(d: i64) -> i32; pub fn change_parameter_name(d: i64) -> i32;
} }
// Change parameter type ------------------------------------------------------- // Change parameter type -------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
extern "C" { extern "C" {
pub fn change_parameter_type(c: i64) -> i32; pub fn change_parameter_type(c: i64) -> i32;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")] #[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5")]
#[rustc_clean(cfg = "cfail6")]
extern "C" { extern "C" {
pub fn change_parameter_type(c: i32) -> i32; pub fn change_parameter_type(c: i32) -> i32;
} }
// Change return type ---------------------------------------------------------- // Change return type ----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
extern "C" { extern "C" {
pub fn change_return_type(c: i32) -> i32; pub fn change_return_type(c: i32) -> i32;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")] #[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5")]
#[rustc_clean(cfg = "cfail6")]
extern "C" { extern "C" {
pub fn change_return_type(c: i32) -> i8; pub fn change_return_type(c: i32) -> i8 ;
} }
// Add parameter --------------------------------------------------------------- // Add parameter ---------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
extern "C" { extern "C" {
pub fn add_parameter(c: i32) -> i32; pub fn add_parameter(c: i32 ) -> i32;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")] #[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5")]
#[rustc_clean(cfg = "cfail6")]
extern "C" { extern "C" {
pub fn add_parameter(c: i32, d: i32) -> i32; pub fn add_parameter(c: i32, d: i32) -> i32;
} }
// Add return type ------------------------------------------------------------- // Add return type -------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
extern "C" { extern "C" {
pub fn add_return_type(c: i32); pub fn add_return_type(c: i32) ;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")] #[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5")]
#[rustc_clean(cfg = "cfail6")]
extern "C" { extern "C" {
pub fn add_return_type(c: i32) -> i32; pub fn add_return_type(c: i32) -> i32;
} }
// Make function variadic ------------------------------------------------------ // Make function variadic ------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
extern "C" { extern "C" {
pub fn make_function_variadic(c: i32); pub fn make_function_variadic(c: i32 );
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")] #[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5")]
#[rustc_clean(cfg = "cfail6")]
extern "C" { extern "C" {
pub fn make_function_variadic(c: i32, ...); pub fn make_function_variadic(c: i32, ...);
} }
// Change calling convention --------------------------------------------------- // Change calling convention ---------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
extern "C" { extern "C" {
pub fn change_calling_convention(c: i32); pub fn change_calling_convention(c: i32);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2", except = "hir_owner")] #[rustc_clean(cfg = "cfail2", except = "hir_owner")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5", except = "hir_owner")]
#[rustc_clean(cfg = "cfail6")]
extern "rust-call" { extern "rust-call" {
pub fn change_calling_convention(c: i32); pub fn change_calling_convention(c: i32);
} }
// Make function public -------------------------------------------------------- // Make function public --------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
extern "C" { extern "C" {
fn make_function_public(c: i32); fn make_function_public(c: i32);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2", except = "hir_owner")] #[rustc_clean(cfg = "cfail2", except = "hir_owner")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5", except = "hir_owner")]
#[rustc_clean(cfg = "cfail6")]
extern "C" { extern "C" {
pub fn make_function_public(c: i32); pub fn make_function_public(c: i32);
} }
// Add function ---------------------------------------------------------------- // Add function ----------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
extern "C" { extern "C" {
pub fn add_function1(c: i32); pub fn add_function1(c: i32);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2", except = "hir_owner")] #[rustc_clean(cfg = "cfail2", except = "hir_owner")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5", except = "hir_owner")]
#[rustc_clean(cfg = "cfail6")]
extern "C" { extern "C" {
pub fn add_function1(c: i32); pub fn add_function1(c: i32);
pub fn add_function2(); pub fn add_function2();
} }
// Change link-name ------------------------------------------------------------ // Change link-name ------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
#[link(name = "foo")] #[link(name = "foo")]
extern "C" { extern "C" {
pub fn change_link_name(c: i32); pub fn change_link_name(c: i32);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")] #[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5")]
#[rustc_clean(cfg = "cfail6")]
#[link(name = "bar")] #[link(name = "bar")]
extern "C" { extern "C" {
pub fn change_link_name(c: i32); pub fn change_link_name(c: i32);
@ -165,13 +193,15 @@ type c_i64 = i64;
// Indirectly change parameter type -------------------------------------------- // Indirectly change parameter type --------------------------------------------
mod indirectly_change_parameter_type { mod indirectly_change_parameter_type {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::c_i32 as c_int; use super::c_i32 as c_int;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::c_i64 as c_int; use super::c_i64 as c_int;
#[rustc_clean(cfg = "cfail2")] #[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5")]
#[rustc_clean(cfg = "cfail6")]
extern "C" { extern "C" {
pub fn indirectly_change_parameter_type(c: c_int); pub fn indirectly_change_parameter_type(c: c_int);
} }
@ -179,13 +209,15 @@ mod indirectly_change_parameter_type {
// Indirectly change return type -------------------------------------------- // Indirectly change return type --------------------------------------------
mod indirectly_change_return_type { mod indirectly_change_return_type {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::c_i32 as c_int; use super::c_i32 as c_int;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::c_i64 as c_int; use super::c_i64 as c_int;
#[rustc_clean(cfg = "cfail2")] #[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5")]
#[rustc_clean(cfg = "cfail6")]
extern "C" { extern "C" {
pub fn indirectly_change_return_type() -> c_int; pub fn indirectly_change_return_type() -> c_int;
} }

View file

@ -6,8 +6,14 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
@ -15,7 +21,7 @@
// Change loop body ------------------------------------------------------------ // Change loop body ------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_loop_body() { pub fn change_loop_body() {
let mut _x = 0; let mut _x = 0;
for _ in 0..1 { for _ in 0..1 {
@ -24,9 +30,11 @@ pub fn change_loop_body() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_loop_body() { pub fn change_loop_body() {
let mut _x = 0; let mut _x = 0;
for _ in 0..1 { for _ in 0..1 {
@ -38,7 +46,7 @@ pub fn change_loop_body() {
// Change iteration variable name ---------------------------------------------- // Change iteration variable name ----------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_iteration_variable_name() { pub fn change_iteration_variable_name() {
let mut _x = 0; let mut _x = 0;
for _i in 0..1 { for _i in 0..1 {
@ -47,9 +55,11 @@ pub fn change_iteration_variable_name() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_iteration_variable_name() { pub fn change_iteration_variable_name() {
let mut _x = 0; let mut _x = 0;
for _a in 0..1 { for _a in 0..1 {
@ -61,18 +71,20 @@ pub fn change_iteration_variable_name() {
// Change iteration variable pattern ------------------------------------------- // Change iteration variable pattern -------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_iteration_variable_pattern() { pub fn change_iteration_variable_pattern() {
let mut _x = 0; let mut _x = 0;
for _i in &[0, 1, 2] { for _i in &[0, 1, 2] {
_x = 1; _x = 1;
break; break;
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck, promoted_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_iteration_variable_pattern() { pub fn change_iteration_variable_pattern() {
let mut _x = 0; let mut _x = 0;
for &_i in &[0, 1, 2] { for &_i in &[0, 1, 2] {
@ -84,7 +96,7 @@ pub fn change_iteration_variable_pattern() {
// Change iterable ------------------------------------------------------------- // Change iterable -------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_iterable() { pub fn change_iterable() {
let mut _x = 0; let mut _x = 0;
for _ in &[0, 1, 2] { for _ in &[0, 1, 2] {
@ -93,9 +105,11 @@ pub fn change_iterable() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, promoted_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, promoted_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, promoted_mir, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_iterable() { pub fn change_iterable() {
let mut _x = 0; let mut _x = 0;
for _ in &[0, 1, 3] { for _ in &[0, 1, 3] {
@ -107,17 +121,20 @@ pub fn change_iterable() {
// Add break ------------------------------------------------------------------- // Add break -------------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_break() { pub fn add_break() {
let mut _x = 0; let mut _x = 0;
for _ in 0..1 { for _ in 0..1 {
_x = 1; _x = 1;
// ---
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn add_break() { pub fn add_break() {
let mut _x = 0; let mut _x = 0;
for _ in 0..1 { for _ in 0..1 {
@ -129,18 +146,20 @@ pub fn add_break() {
// Add loop label -------------------------------------------------------------- // Add loop label --------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_loop_label() { pub fn add_loop_label() {
let mut _x = 0; let mut _x = 0;
for _ in 0..1 { for _ in 0..1 {
_x = 1; _x = 1;
break; break;
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label() { pub fn add_loop_label() {
let mut _x = 0; let mut _x = 0;
'label: for _ in 0..1 { 'label: for _ in 0..1 {
@ -152,18 +171,20 @@ pub fn add_loop_label() {
// Add loop label to break ----------------------------------------------------- // Add loop label to break -----------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_loop_label_to_break() { pub fn add_loop_label_to_break() {
let mut _x = 0; let mut _x = 0;
'label: for _ in 0..1 { 'label: for _ in 0..1 {
_x = 1; _x = 1;
break; break ;
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label_to_break() { pub fn add_loop_label_to_break() {
let mut _x = 0; let mut _x = 0;
'label: for _ in 0..1 { 'label: for _ in 0..1 {
@ -175,7 +196,7 @@ pub fn add_loop_label_to_break() {
// Change break label ---------------------------------------------------------- // Change break label ----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_break_label() { pub fn change_break_label() {
let mut _x = 0; let mut _x = 0;
'outer: for _ in 0..1 { 'outer: for _ in 0..1 {
@ -186,9 +207,11 @@ pub fn change_break_label() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_break_label() { pub fn change_break_label() {
let mut _x = 0; let mut _x = 0;
'outer: for _ in 0..1 { 'outer: for _ in 0..1 {
@ -202,18 +225,20 @@ pub fn change_break_label() {
// Add loop label to continue -------------------------------------------------- // Add loop label to continue --------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_loop_label_to_continue() { pub fn add_loop_label_to_continue() {
let mut _x = 0; let mut _x = 0;
'label: for _ in 0..1 { 'label: for _ in 0..1 {
_x = 1; _x = 1;
continue; continue ;
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label_to_continue() { pub fn add_loop_label_to_continue() {
let mut _x = 0; let mut _x = 0;
'label: for _ in 0..1 { 'label: for _ in 0..1 {
@ -225,7 +250,7 @@ pub fn add_loop_label_to_continue() {
// Change continue label ---------------------------------------------------------- // Change continue label ----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_continue_label() { pub fn change_continue_label() {
let mut _x = 0; let mut _x = 0;
'outer: for _ in 0..1 { 'outer: for _ in 0..1 {
@ -236,9 +261,11 @@ pub fn change_continue_label() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_continue_label() { pub fn change_continue_label() {
let mut _x = 0; let mut _x = 0;
'outer: for _ in 0..1 { 'outer: for _ in 0..1 {
@ -252,7 +279,7 @@ pub fn change_continue_label() {
// Change continue to break ---------------------------------------------------- // Change continue to break ----------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_continue_to_break() { pub fn change_continue_to_break() {
let mut _x = 0; let mut _x = 0;
for _ in 0..1 { for _ in 0..1 {
@ -261,13 +288,15 @@ pub fn change_continue_to_break() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_continue_to_break() { pub fn change_continue_to_break() {
let mut _x = 0; let mut _x = 0;
for _ in 0..1 { for _ in 0..1 {
_x = 1; _x = 1;
break; break ;
} }
} }

View file

@ -6,8 +6,14 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(linkage)] #![feature(linkage)]
@ -16,248 +22,310 @@
// Add Parameter --------------------------------------------------------------- // Add Parameter ---------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_parameter() {} pub fn add_parameter() {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean( #[rustc_clean(
cfg = "cfail2", cfg = "cfail2",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig" except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)] )]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(
cfg = "cfail5",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)]
#[rustc_clean(cfg = "cfail6")]
pub fn add_parameter(p: i32) {} pub fn add_parameter(p: i32) {}
// Add Return Type ------------------------------------------------------------- // Add Return Type -------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_return_type() {} pub fn add_return_type() {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes")] #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg = "cfail6")]
pub fn add_return_type() -> () {} pub fn add_return_type() -> () {}
// Change Parameter Type ------------------------------------------------------- // Change Parameter Type -------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn type_of_parameter(p: i32) {} pub fn type_of_parameter(p: i32) {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean( #[rustc_clean(
cfg = "cfail2", cfg = "cfail2",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig" except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)] )]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(
cfg = "cfail5",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)]
#[rustc_clean(cfg = "cfail6")]
pub fn type_of_parameter(p: i64) {} pub fn type_of_parameter(p: i64) {}
// Change Parameter Type Reference --------------------------------------------- // Change Parameter Type Reference ---------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn type_of_parameter_ref(p: &i32) {} pub fn type_of_parameter_ref(p: &i32) {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean( #[rustc_clean(
cfg = "cfail2", cfg = "cfail2",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig" except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)] )]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(
cfg = "cfail5",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)]
#[rustc_clean(cfg = "cfail6")]
pub fn type_of_parameter_ref(p: &mut i32) {} pub fn type_of_parameter_ref(p: &mut i32) {}
// Change Parameter Order ------------------------------------------------------ // Change Parameter Order ------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn order_of_parameters(p1: i32, p2: i64) {} pub fn order_of_parameters(p1: i32, p2: i64) {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean( #[rustc_clean(
cfg = "cfail2", cfg = "cfail2",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig" except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)] )]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(
cfg = "cfail5",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)]
#[rustc_clean(cfg = "cfail6")]
pub fn order_of_parameters(p2: i64, p1: i32) {} pub fn order_of_parameters(p2: i64, p1: i32) {}
// Unsafe ---------------------------------------------------------------------- // Unsafe ----------------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn make_unsafe() {} pub fn make_unsafe() {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean( #[rustc_clean(
cfg = "cfail2", cfg = "cfail2",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig" except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)] )]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(
cfg = "cfail5",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)]
#[rustc_clean(cfg = "cfail6")]
pub unsafe fn make_unsafe() {} pub unsafe fn make_unsafe() {}
// Extern ---------------------------------------------------------------------- // Extern ----------------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn make_extern() {} pub fn make_extern() {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, typeck, fn_sig")] #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, typeck, fn_sig")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, typeck, fn_sig")]
#[rustc_clean(cfg = "cfail6")]
pub extern "C" fn make_extern() {} pub extern "C" fn make_extern() {}
// Type Parameter -------------------------------------------------------------- // Type Parameter --------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn type_parameter() {} pub fn type_parameter () {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean( #[rustc_clean(
cfg = "cfail2", cfg = "cfail2",
except = "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of" except = "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of"
)] )]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(
cfg = "cfail5",
except = "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of"
)]
#[rustc_clean(cfg = "cfail6")]
pub fn type_parameter<T>() {} pub fn type_parameter<T>() {}
// Lifetime Parameter ---------------------------------------------------------- // Lifetime Parameter ----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn lifetime_parameter() {} pub fn lifetime_parameter () {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, generics_of,fn_sig")] #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, generics_of,fn_sig")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, generics_of,fn_sig")]
#[rustc_clean(cfg = "cfail6")]
pub fn lifetime_parameter<'a>() {} pub fn lifetime_parameter<'a>() {}
// Trait Bound ----------------------------------------------------------------- // Trait Bound -----------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn trait_bound<T>() {} pub fn trait_bound<T >() {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")] #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
pub fn trait_bound<T: Eq>() {} pub fn trait_bound<T: Eq>() {}
// Builtin Bound --------------------------------------------------------------- // Builtin Bound ---------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn builtin_bound<T>() {} pub fn builtin_bound<T >() {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")] #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, predicates_of")]
#[rustc_clean(cfg = "cfail6")]
pub fn builtin_bound<T: Send>() {} pub fn builtin_bound<T: Send>() {}
// Lifetime Bound -------------------------------------------------------------- // Lifetime Bound --------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn lifetime_bound<'a, T>() {} pub fn lifetime_bound<'a, T>() {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean( #[rustc_clean(
cfg = "cfail2", cfg = "cfail2",
except = "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of,fn_sig" except = "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of,fn_sig"
)] )]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(
cfg = "cfail5",
except = "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of,fn_sig,optimized_mir"
)]
#[rustc_clean(cfg = "cfail6")]
pub fn lifetime_bound<'a, T: 'a>() {} pub fn lifetime_bound<'a, T: 'a>() {}
// Second Trait Bound ---------------------------------------------------------- // Second Trait Bound ----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn second_trait_bound<T: Eq>() {} pub fn second_trait_bound<T: Eq >() {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")] #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
pub fn second_trait_bound<T: Eq + Clone>() {} pub fn second_trait_bound<T: Eq + Clone>() {}
// Second Builtin Bound -------------------------------------------------------- // Second Builtin Bound --------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn second_builtin_bound<T: Send>() {} pub fn second_builtin_bound<T: Send >() {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")] #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, predicates_of")]
#[rustc_clean(cfg = "cfail6")]
pub fn second_builtin_bound<T: Send + Sized>() {} pub fn second_builtin_bound<T: Send + Sized>() {}
// Second Lifetime Bound ------------------------------------------------------- // Second Lifetime Bound -------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn second_lifetime_bound<'a, 'b, T: 'a>() {} pub fn second_lifetime_bound<'a, 'b, T: 'a >() {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean( #[rustc_clean(
cfg = "cfail2", cfg = "cfail2",
except = "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of,fn_sig" except = "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of,fn_sig"
)] )]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(
cfg = "cfail5",
except = "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of,fn_sig"
)]
#[rustc_clean(cfg = "cfail6")]
pub fn second_lifetime_bound<'a, 'b, T: 'a + 'b>() {} pub fn second_lifetime_bound<'a, 'b, T: 'a + 'b>() {}
// Inline ---------------------------------------------------------------------- // Inline ----------------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn inline() {} pub fn inline() {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")] #[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5")]
#[rustc_clean(cfg = "cfail6")]
#[inline] #[inline]
pub fn inline() {} pub fn inline() {}
// Inline Never ---------------------------------------------------------------- // Inline Never ----------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
#[inline(always)] #[inline(always)]
pub fn inline_never() {} pub fn inline_never() {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")] #[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5")]
#[rustc_clean(cfg = "cfail6")]
#[inline(never)] #[inline(never)]
pub fn inline_never() {} pub fn inline_never() {}
// No Mangle ------------------------------------------------------------------- // No Mangle -------------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn no_mangle() {} pub fn no_mangle() {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")] #[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5")]
#[rustc_clean(cfg = "cfail6")]
#[no_mangle] #[no_mangle]
pub fn no_mangle() {} pub fn no_mangle() {}
// Linkage --------------------------------------------------------------------- // Linkage ---------------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn linkage() {} pub fn linkage() {}
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")] #[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5")]
#[rustc_clean(cfg = "cfail6")]
#[linkage = "weak_odr"] #[linkage = "weak_odr"]
pub fn linkage() {} pub fn linkage() {}
// Return Impl Trait ----------------------------------------------------------- // Return Impl Trait -----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn return_impl_trait() -> i32 { pub fn return_impl_trait() -> i32 {
0 0
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, typeck, fn_sig")] #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, typeck, fn_sig")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, typeck, fn_sig, optimized_mir")]
#[rustc_clean(cfg = "cfail6")]
pub fn return_impl_trait() -> impl Clone { pub fn return_impl_trait() -> impl Clone {
0 0
} }
// Change Return Impl Trait ---------------------------------------------------- // Change Return Impl Trait ----------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_return_impl_trait() -> impl Clone { pub fn change_return_impl_trait() -> impl Clone {
0u32 0u32
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")] #[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
pub fn change_return_impl_trait() -> impl Copy { #[rustc_clean(cfg = "cfail5")]
#[rustc_clean(cfg = "cfail6")]
pub fn change_return_impl_trait() -> impl Copy {
0u32 0u32
} }
@ -267,9 +335,9 @@ pub struct ReferencedType1;
pub struct ReferencedType2; pub struct ReferencedType2;
pub mod change_return_type_indirectly { pub mod change_return_type_indirectly {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::ReferencedType1 as ReturnType; use super::ReferencedType1 as ReturnType;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedType2 as ReturnType; use super::ReferencedType2 as ReturnType;
#[rustc_clean( #[rustc_clean(
@ -277,6 +345,11 @@ pub mod change_return_type_indirectly {
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig" except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)] )]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(
cfg = "cfail5",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)]
#[rustc_clean(cfg = "cfail6")]
pub fn indirect_return_type() -> ReturnType { pub fn indirect_return_type() -> ReturnType {
ReturnType {} ReturnType {}
} }
@ -285,9 +358,9 @@ pub mod change_return_type_indirectly {
// Change Parameter Type Indirectly -------------------------------------------- // Change Parameter Type Indirectly --------------------------------------------
pub mod change_parameter_type_indirectly { pub mod change_parameter_type_indirectly {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::ReferencedType1 as ParameterType; use super::ReferencedType1 as ParameterType;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedType2 as ParameterType; use super::ReferencedType2 as ParameterType;
#[rustc_clean( #[rustc_clean(
@ -295,6 +368,11 @@ pub mod change_parameter_type_indirectly {
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig" except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)] )]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(
cfg = "cfail5",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)]
#[rustc_clean(cfg = "cfail6")]
pub fn indirect_parameter_type(p: ParameterType) {} pub fn indirect_parameter_type(p: ParameterType) {}
} }
@ -304,26 +382,30 @@ pub trait ReferencedTrait1 {}
pub trait ReferencedTrait2 {} pub trait ReferencedTrait2 {}
pub mod change_trait_bound_indirectly { pub mod change_trait_bound_indirectly {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::ReferencedTrait1 as Trait; use super::ReferencedTrait1 as Trait;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedTrait2 as Trait; use super::ReferencedTrait2 as Trait;
#[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")] #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, predicates_of")]
#[rustc_clean(cfg = "cfail6")]
pub fn indirect_trait_bound<T: Trait>(p: T) {} pub fn indirect_trait_bound<T: Trait>(p: T) {}
} }
// Change Trait Bound Indirectly In Where Clause ------------------------------- // Change Trait Bound Indirectly In Where Clause -------------------------------
pub mod change_trait_bound_indirectly_in_where_clause { pub mod change_trait_bound_indirectly_in_where_clause {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::ReferencedTrait1 as Trait; use super::ReferencedTrait1 as Trait;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedTrait2 as Trait; use super::ReferencedTrait2 as Trait;
#[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")] #[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
#[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail3")]
#[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, predicates_of")]
#[rustc_clean(cfg = "cfail6")]
pub fn indirect_trait_bound_where<T>(p: T) pub fn indirect_trait_bound_where<T>(p: T)
where where
T: Trait, T: Trait,

View file

@ -6,27 +6,34 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![crate_type="rlib"] #![crate_type="rlib"]
// Change condition (if) // Change condition (if)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_condition(x: bool) -> u32 { pub fn change_condition(x: bool) -> u32 {
if x { if x {
return 1 return 1
} }
return 0 return 0
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_condition(x: bool) -> u32 { pub fn change_condition(x: bool) -> u32 {
if !x { if !x {
return 1 return 1
@ -36,7 +43,7 @@ pub fn change_condition(x: bool) -> u32 {
} }
// Change then branch (if) // Change then branch (if)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_then_branch(x: bool) -> u32 { pub fn change_then_branch(x: bool) -> u32 {
if x { if x {
return 1 return 1
@ -45,9 +52,11 @@ pub fn change_then_branch(x: bool) -> u32 {
return 0 return 0
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_then_branch(x: bool) -> u32 { pub fn change_then_branch(x: bool) -> u32 {
if x { if x {
return 2 return 2
@ -59,7 +68,7 @@ pub fn change_then_branch(x: bool) -> u32 {
// Change else branch (if) // Change else branch (if)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_else_branch(x: bool) -> u32 { pub fn change_else_branch(x: bool) -> u32 {
if x { if x {
1 1
@ -68,9 +77,11 @@ pub fn change_else_branch(x: bool) -> u32 {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_else_branch(x: bool) -> u32 { pub fn change_else_branch(x: bool) -> u32 {
if x { if x {
1 1
@ -82,20 +93,23 @@ pub fn change_else_branch(x: bool) -> u32 {
// Add else branch (if) // Add else branch (if)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_else_branch(x: bool) -> u32 { pub fn add_else_branch(x: bool) -> u32 {
let mut ret = 1; let mut ret = 1;
if x { if x {
ret = 2; ret = 2;
/*----*/
} }
ret ret
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn add_else_branch(x: bool) -> u32 { pub fn add_else_branch(x: bool) -> u32 {
let mut ret = 1; let mut ret = 1;
@ -110,7 +124,7 @@ pub fn add_else_branch(x: bool) -> u32 {
// Change condition (if let) // Change condition (if let)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_condition_if_let(x: Option<u32>) -> u32 { pub fn change_condition_if_let(x: Option<u32>) -> u32 {
if let Some(_x) = x { if let Some(_x) = x {
return 1 return 1
@ -119,11 +133,13 @@ pub fn change_condition_if_let(x: Option<u32>) -> u32 {
0 0
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_condition_if_let(x: Option<u32>) -> u32 { pub fn change_condition_if_let(x: Option<u32>) -> u32 {
if let Some(_) = x { if let Some(_ ) = x {
return 1 return 1
} }
@ -133,18 +149,20 @@ pub fn change_condition_if_let(x: Option<u32>) -> u32 {
// Change then branch (if let) // Change then branch (if let)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_then_branch_if_let(x: Option<u32>) -> u32 { pub fn change_then_branch_if_let(x: Option<u32>) -> u32 {
if let Some(x) = x { if let Some(x) = x {
return x return x //-
} }
0 0
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_then_branch_if_let(x: Option<u32>) -> u32 { pub fn change_then_branch_if_let(x: Option<u32>) -> u32 {
if let Some(x) = x { if let Some(x) = x {
return x + 1 return x + 1
@ -156,7 +174,7 @@ pub fn change_then_branch_if_let(x: Option<u32>) -> u32 {
// Change else branch (if let) // Change else branch (if let)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_else_branch_if_let(x: Option<u32>) -> u32 { pub fn change_else_branch_if_let(x: Option<u32>) -> u32 {
if let Some(x) = x { if let Some(x) = x {
x x
@ -165,9 +183,11 @@ pub fn change_else_branch_if_let(x: Option<u32>) -> u32 {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_else_branch_if_let(x: Option<u32>) -> u32 { pub fn change_else_branch_if_let(x: Option<u32>) -> u32 {
if let Some(x) = x { if let Some(x) = x {
x x
@ -179,20 +199,23 @@ pub fn change_else_branch_if_let(x: Option<u32>) -> u32 {
// Add else branch (if let) // Add else branch (if let)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_else_branch_if_let(x: Option<u32>) -> u32 { pub fn add_else_branch_if_let(x: Option<u32>) -> u32 {
let mut ret = 1; let mut ret = 1;
if let Some(x) = x { if let Some(x) = x {
ret = x; ret = x;
/*----*/
} }
ret ret
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn add_else_branch_if_let(x: Option<u32>) -> u32 { pub fn add_else_branch_if_let(x: Option<u32>) -> u32 {
let mut ret = 1; let mut ret = 1;

View file

@ -6,22 +6,30 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![crate_type="rlib"] #![crate_type="rlib"]
// Change simple index // Change simple index
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
fn change_simple_index(slice: &[u32]) -> u32 { fn change_simple_index(slice: &[u32]) -> u32 {
slice[3] slice[3]
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
fn change_simple_index(slice: &[u32]) -> u32 { fn change_simple_index(slice: &[u32]) -> u32 {
slice[4] slice[4]
} }
@ -29,14 +37,16 @@ fn change_simple_index(slice: &[u32]) -> u32 {
// Change lower bound // Change lower bound
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
fn change_lower_bound(slice: &[u32]) -> &[u32] { fn change_lower_bound(slice: &[u32]) -> &[u32] {
&slice[3..5] &slice[3..5]
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
fn change_lower_bound(slice: &[u32]) -> &[u32] { fn change_lower_bound(slice: &[u32]) -> &[u32] {
&slice[2..5] &slice[2..5]
} }
@ -44,14 +54,16 @@ fn change_lower_bound(slice: &[u32]) -> &[u32] {
// Change upper bound // Change upper bound
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
fn change_upper_bound(slice: &[u32]) -> &[u32] { fn change_upper_bound(slice: &[u32]) -> &[u32] {
&slice[3..5] &slice[3..5]
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
fn change_upper_bound(slice: &[u32]) -> &[u32] { fn change_upper_bound(slice: &[u32]) -> &[u32] {
&slice[3..7] &slice[3..7]
} }
@ -59,14 +71,16 @@ fn change_upper_bound(slice: &[u32]) -> &[u32] {
// Add lower bound // Add lower bound
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
fn add_lower_bound(slice: &[u32]) -> &[u32] { fn add_lower_bound(slice: &[u32]) -> &[u32] {
&slice[..4] &slice[ ..4]
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
fn add_lower_bound(slice: &[u32]) -> &[u32] { fn add_lower_bound(slice: &[u32]) -> &[u32] {
&slice[3..4] &slice[3..4]
} }
@ -74,14 +88,16 @@ fn add_lower_bound(slice: &[u32]) -> &[u32] {
// Add upper bound // Add upper bound
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
fn add_upper_bound(slice: &[u32]) -> &[u32] { fn add_upper_bound(slice: &[u32]) -> &[u32] {
&slice[3..] &slice[3.. ]
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
fn add_upper_bound(slice: &[u32]) -> &[u32] { fn add_upper_bound(slice: &[u32]) -> &[u32] {
&slice[3..7] &slice[3..7]
} }
@ -89,29 +105,33 @@ fn add_upper_bound(slice: &[u32]) -> &[u32] {
// Change mutability // Change mutability
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
fn change_mutability(slice: &mut [u32]) -> u32 { fn change_mutability(slice: &mut [u32]) -> u32 {
(&mut slice[3..5])[0] (&mut slice[3..5])[0]
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
fn change_mutability(slice: &mut [u32]) -> u32 { fn change_mutability(slice: &mut [u32]) -> u32 {
(&slice[3..5])[0] (& slice[3..5])[0]
} }
// Exclusive to inclusive range // Exclusive to inclusive range
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] { fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] {
&slice[3..7] &slice[3.. 7]
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] { fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] {
&slice[3..=7] &slice[3..=7]
} }

View file

@ -6,8 +6,14 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
@ -17,36 +23,46 @@
pub struct Foo; pub struct Foo;
// Change Method Name ----------------------------------------------------------- // Change Method Name -----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
pub fn method_name() { } pub fn method_name() { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,associated_item_def_ids")] #[rustc_clean(cfg="cfail2", except="hir_owner,associated_item_def_ids")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,associated_item_def_ids")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail6")]
pub fn method_name2() { } pub fn method_name2() { }
} }
// Change Method Body ----------------------------------------------------------- // Change Method Body -----------------------------------------------------------
// //
// This should affect the method itself, but not the impl. // This should affect the method itself, but not the impl.
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
pub fn method_body() { } //--------------------------------------------------------------------------------------
//--------------------------
//--------------------------------------------------------------------------------------
//--------------------------
pub fn method_body() {
// -----------------------
}
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean( #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,promoted_mir,typeck")]
cfg="cfail2",
except="hir_owner_nodes,optimized_mir,promoted_mir,typeck"
)]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,promoted_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn method_body() { pub fn method_body() {
println!("Hello, world!"); println!("Hello, world!");
} }
@ -56,21 +72,40 @@ impl Foo {
// Change Method Body (inlined) ------------------------------------------------ // Change Method Body (inlined) ------------------------------------------------
// //
// This should affect the method itself, but not the impl. // This should affect the method itself, but not the impl.
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
//------------
//---------------
//------------------------------------------------------------
//
//--------------------------
//------------
//---------------
//------------------------------------------------------------
//
//--------------------------
#[inline] #[inline]
pub fn method_body_inlined() { } pub fn method_body_inlined() {
// -----------------------
}
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean( #[rustc_clean(
cfg="cfail2", cfg="cfail2",
except="hir_owner_nodes,optimized_mir,promoted_mir,typeck" except="hir_owner_nodes,optimized_mir,promoted_mir,typeck"
)] )]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(
cfg="cfail5",
except="hir_owner_nodes,optimized_mir,promoted_mir,typeck"
)]
#[rustc_clean(cfg="cfail6")]
#[inline] #[inline]
pub fn method_body_inlined() { pub fn method_body_inlined() {
println!("Hello, world!"); println!("Hello, world!");
@ -79,146 +114,205 @@ impl Foo {
// Change Method Privacy ------------------------------------------------------- // Change Method Privacy -------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
pub fn method_privacy() { } pub fn method_privacy() { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner")] #[rustc_clean(cfg="cfail2", except="hir_owner")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean(cfg="cfail2", except="associated_item,hir_owner,hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="associated_item,hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="associated_item,hir_owner,hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
fn method_privacy() { } fn method_privacy() { }
} }
// Change Method Selfness ----------------------------------------------------------- // Change Method Selfness -----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
//------------
//---------------
//---------------------------------------------------------------------------------------------
//
//--------------------------
//------------
//---------------
//---------------------------------------------------------------------------------------------
//
//--------------------------
pub fn method_selfness() { } pub fn method_selfness() { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner")] #[rustc_clean(cfg="cfail2", except="hir_owner")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean( #[rustc_clean(
cfg="cfail2", cfg="cfail2",
except="hir_owner,hir_owner_nodes,fn_sig,generics_of,typeck,associated_item,optimized_mir", except="hir_owner,hir_owner_nodes,fn_sig,generics_of,typeck,associated_item,optimized_mir",
)] )]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(
cfg="cfail5",
except="hir_owner,hir_owner_nodes,fn_sig,generics_of,typeck,associated_item,optimized_mir",
)]
#[rustc_clean(cfg="cfail6")]
pub fn method_selfness(&self) { } pub fn method_selfness(&self) { }
} }
// Change Method Selfmutness --------------------------------------------------- // Change Method Selfmutness ---------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
pub fn method_selfmutness(&self) { } //------------------------------------------------------------------------------------------
//--------------------------
//------------------------------------------------------------------------------------------
//--------------------------
pub fn method_selfmutness(& self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean( #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
cfg="cfail2",
except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir"
)]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn method_selfmutness(&mut self) { } pub fn method_selfmutness(&mut self) { }
} }
// Add Method To Impl ---------------------------------------------------------- // Add Method To Impl ----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
pub fn add_method_to_impl1(&self) { } pub fn add_method_to_impl1(&self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,associated_item_def_ids")] #[rustc_clean(cfg="cfail2", except="hir_owner,associated_item_def_ids")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,associated_item_def_ids")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn add_method_to_impl1(&self) { } pub fn add_method_to_impl1(&self) { }
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail6")]
pub fn add_method_to_impl2(&self) { } pub fn add_method_to_impl2(&self) { }
} }
// Add Method Parameter -------------------------------------------------------- // Add Method Parameter --------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
pub fn add_method_parameter(&self) { } //------------------------------------------------------------------------------------------
//--------------------------
//------------------------------------------------------------------------------------------
//--------------------------
pub fn add_method_parameter(&self ) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean( #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
cfg="cfail2",
except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir"
)]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn add_method_parameter(&self, _: i32) { } pub fn add_method_parameter(&self, _: i32) { }
} }
// Change Method Parameter Name ------------------------------------------------ // Change Method Parameter Name ------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
//------------------------------------------------------------------
//--------------------------
//------------------------------------------------------------------
//--------------------------
pub fn change_method_parameter_name(&self, a: i64) { } pub fn change_method_parameter_name(&self, a: i64) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_method_parameter_name(&self, b: i64) { } pub fn change_method_parameter_name(&self, b: i64) { }
} }
// Change Method Return Type --------------------------------------------------- // Change Method Return Type ---------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
//------------------------------------------------------------------------------------------
//--------------------------
//------------------------------------------------------------------------------------------
//--------------------------
pub fn change_method_return_type(&self) -> u16 { 0 } pub fn change_method_return_type(&self) -> u16 { 0 }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean( #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,optimized_mir,typeck")]
cfg="cfail2",
except="hir_owner,hir_owner_nodes,fn_sig,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
pub fn change_method_return_type(&self) -> u8 { 0 } #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,fn_sig,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_method_return_type(&self) -> u32 { 0 }
} }
// Make Method #[inline] ------------------------------------------------------- // Make Method #[inline] -------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
//--------------------------
//--------------------------
//--------------------------
//--------------------------
//-------
pub fn make_method_inline(&self) -> u8 { 0 } pub fn make_method_inline(&self) -> u8 { 0 }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
#[inline] #[inline]
pub fn make_method_inline(&self) -> u8 { 0 } pub fn make_method_inline(&self) -> u8 { 0 }
} }
@ -226,85 +320,129 @@ impl Foo {
// Change order of parameters ------------------------------------------------- // Change order of parameters -------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
//------------------------------------------------------------------
//--------------------------
//------------------------------------------------------------------
//--------------------------
pub fn change_method_parameter_order(&self, a: i64, b: i64) { } pub fn change_method_parameter_order(&self, a: i64, b: i64) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_method_parameter_order(&self, b: i64, a: i64) { } pub fn change_method_parameter_order(&self, b: i64, a: i64) { }
} }
// Make method unsafe ---------------------------------------------------------- // Make method unsafe ----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
pub fn make_method_unsafe(&self) { } //------------------------------------------------------------------------------------------
//--------------------------
//------------------------------------------------------------------------------------------
//--------------------------
pub fn make_method_unsafe(&self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean( #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
cfg="cfail2",
except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir"
)]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub unsafe fn make_method_unsafe(&self) { } pub unsafe fn make_method_unsafe(&self) { }
} }
// Make method extern ---------------------------------------------------------- // Make method extern ----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
pub fn make_method_extern(&self) { } //----------------------------------------------------------------------------
//--------------------------
//----------------------------------------------------------------------------
//--------------------------
pub fn make_method_extern(&self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,fn_sig,typeck")]
#[rustc_clean(cfg="cfail6")]
pub extern "C" fn make_method_extern(&self) { } pub extern "C" fn make_method_extern(&self) { }
} }
// Change method calling convention -------------------------------------------- // Change method calling convention --------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
pub extern "C" fn change_method_calling_convention(&self) { } //----------------------------------------------------------------------------
//--------------------------
//----------------------------------------------------------------------------
//--------------------------
pub extern "C" fn change_method_calling_convention(&self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,fn_sig,typeck")]
#[rustc_clean(cfg="cfail6")]
pub extern "system" fn change_method_calling_convention(&self) { } pub extern "system" fn change_method_calling_convention(&self) { }
} }
// Add Lifetime Parameter to Method -------------------------------------------- // Add Lifetime Parameter to Method --------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
pub fn add_lifetime_parameter_to_method(&self) { } // -----------------------------------------------------
// ---------------------------------------------------------
// ----------------------------------------------------------
// -------------------------------------------------------
// -------------------------------------------------------
// --------------------------------------------------------
// ----------------------------------------------------------
// -----------------------------------------------------------
// ----------------------------------------------------------
// --------------------------------------------------------------------
// -------------------------
// --------------------------------------------------------------------------------
// -------------------------
pub fn add_lifetime_parameter_to_method (&self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
// Warning: Note that `typeck` are coming up clean here. // Warning: Note that `typeck` are coming up clean here.
// The addition or removal of lifetime parameters that don't // The addition or removal of lifetime parameters that don't
@ -317,20 +455,43 @@ impl Foo {
// `typeck` appear dirty, that might be the cause. -nmatsakis // `typeck` appear dirty, that might be the cause. -nmatsakis
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,fn_sig,generics_of")]
#[rustc_clean(cfg="cfail6")]
pub fn add_lifetime_parameter_to_method<'a>(&self) { } pub fn add_lifetime_parameter_to_method<'a>(&self) { }
} }
// Add Type Parameter To Method ------------------------------------------------ // Add Type Parameter To Method ------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
pub fn add_type_parameter_to_method(&self) { } // -----------------------------------------------------
// ---------------------------------------------------------------
// -------------------------------------------------------------
// -----------------------------------------------------
// -------------------------------------------------------------
// ---------------------------------------------------
// ------------------------------------------------------------
// ------------------------------------------------------
// -------------------------------------------------
// -----------
// --------------
// ----------------------------------------------------------------------
//
// -------------------------
// -----------
// --------------
// ----------------------------------------------------------------------
//
// -------------------------
pub fn add_type_parameter_to_method (&self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
// Warning: Note that `typeck` are coming up clean here. // Warning: Note that `typeck` are coming up clean here.
// The addition or removal of type parameters that don't appear in // The addition or removal of type parameters that don't appear in
@ -346,40 +507,83 @@ impl Foo {
except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of",
)] )]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(
cfg="cfail5",
except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of",
)]
#[rustc_clean(cfg="cfail6")]
pub fn add_type_parameter_to_method<T>(&self) { } pub fn add_type_parameter_to_method<T>(&self) { }
} }
// Add Lifetime Bound to Lifetime Parameter of Method -------------------------- // Add Lifetime Bound to Lifetime Parameter of Method --------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
pub fn add_lifetime_bound_to_lifetime_param_of_method<'a, 'b>(&self) { } //------------
//---------------
//-----------------------------------------------------------------------------
//
//--------------------------
//------------
//---------------
//-----------------------------------------------------------------------------
//
//--------------------------
pub fn add_lifetime_bound_to_lifetime_param_of_method<'a, 'b >(&self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean( #[rustc_clean(
cfg="cfail2", cfg="cfail2",
except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of,fn_sig" except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of,fn_sig"
)] )]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(
cfg="cfail5",
except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of,fn_sig"
)]
#[rustc_clean(cfg="cfail6")]
pub fn add_lifetime_bound_to_lifetime_param_of_method<'a, 'b: 'a>(&self) { } pub fn add_lifetime_bound_to_lifetime_param_of_method<'a, 'b: 'a>(&self) { }
} }
// Add Lifetime Bound to Type Parameter of Method ------------------------------ // Add Lifetime Bound to Type Parameter of Method ------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
pub fn add_lifetime_bound_to_type_param_of_method<'a, T>(&self) { } // -----------------------------------------------------
// ----------------------------------------------------------
// -------------------------------------------------------------
// -------------------------------------------------
// -------------------------------------------------------------
// ---------------------------------------------------
// ------------------------------------------------------------
// ------------------------------------------------------
// -------------------------------------------------
// -----------
// --------------
// ----------------------------------------------------------------------------
//
// -------------------------
// -----------
// --------------
// ----------------------------------------------------------------------------
//
// -------------------------
pub fn add_lifetime_bound_to_type_param_of_method<'a, T >(&self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
// Warning: Note that `typeck` are coming up clean here. // Warning: Note that `typeck` are coming up clean here.
// The addition or removal of bounds that don't appear in the // The addition or removal of bounds that don't appear in the
@ -390,23 +594,45 @@ impl Foo {
// generics before the body, then the `HirId` for things in the // generics before the body, then the `HirId` for things in the
// body will be affected. So if you start to see `typeck` // body will be affected. So if you start to see `typeck`
// appear dirty, that might be the cause. -nmatsakis // appear dirty, that might be the cause. -nmatsakis
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,\ #[rustc_clean(
type_of,fn_sig")] cfg="cfail2",
except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of,fn_sig"
)]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(
cfg="cfail5",
except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of,fn_sig"
)]
#[rustc_clean(cfg="cfail6")]
pub fn add_lifetime_bound_to_type_param_of_method<'a, T: 'a>(&self) { } pub fn add_lifetime_bound_to_type_param_of_method<'a, T: 'a>(&self) { }
} }
// Add Trait Bound to Type Parameter of Method ------------------------------ // Add Trait Bound to Type Parameter of Method ------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
pub fn add_trait_bound_to_type_param_of_method<T>(&self) { } // -----------------------------------------------------
// ----------------------------------------------------------
// -------------------------------------------------------------
// -------------------------------------------------
// -------------------------------------------------------------
// ---------------------------------------------------
// ------------------------------------------------------------
// ------------------------------------------------------
// -------------------------------------------------
// ---------------------------------------------------------------------------
// -------------------------
// ---------------------------------------------------------------------------
// -------------------------
pub fn add_trait_bound_to_type_param_of_method<T >(&self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
// Warning: Note that `typeck` are coming up clean here. // Warning: Note that `typeck` are coming up clean here.
// The addition or removal of bounds that don't appear in the // The addition or removal of bounds that don't appear in the
@ -419,23 +645,34 @@ impl Foo {
// appear dirty, that might be the cause. -nmatsakis // appear dirty, that might be the cause. -nmatsakis
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")]
#[rustc_clean(cfg="cfail6")]
pub fn add_trait_bound_to_type_param_of_method<T: Clone>(&self) { } pub fn add_trait_bound_to_type_param_of_method<T: Clone>(&self) { }
} }
// Add #[no_mangle] to Method -------------------------------------------------- // Add #[no_mangle] to Method --------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Foo { impl Foo {
//--------------------------
//--------------------------
//--------------------------
//--------------------------
//----------
pub fn add_no_mangle_to_method(&self) { } pub fn add_no_mangle_to_method(&self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl Foo { impl Foo {
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
#[no_mangle] #[no_mangle]
pub fn add_no_mangle_to_method(&self) { } pub fn add_no_mangle_to_method(&self) { }
} }
@ -445,71 +682,90 @@ impl Foo {
struct Bar<T>(T); struct Bar<T>(T);
// Add Type Parameter To Impl -------------------------------------------------- // Add Type Parameter To Impl --------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Bar<u32> { impl Bar<u32> {
pub fn add_type_parameter_to_impl(&self) { } pub fn add_type_parameter_to_impl(&self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of")]
#[rustc_clean(cfg="cfail6")]
impl<T> Bar<T> { impl<T> Bar<T> {
#[rustc_clean( #[rustc_clean(
cfg="cfail2", cfg="cfail2",
except="generics_of,fn_sig,typeck,type_of,optimized_mir" except="generics_of,fn_sig,typeck,type_of,optimized_mir"
)] )]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(
cfg="cfail5",
except="generics_of,fn_sig,typeck,type_of,optimized_mir"
)]
#[rustc_clean(cfg="cfail6")]
pub fn add_type_parameter_to_impl(&self) { } pub fn add_type_parameter_to_impl(&self) { }
} }
// Change Self Type of Impl ---------------------------------------------------- // Change Self Type of Impl ----------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl Bar<u32> { impl Bar<u32> {
pub fn change_impl_self_type(&self) { } pub fn change_impl_self_type(&self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner")] #[rustc_clean(cfg="cfail2", except="hir_owner")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner")]
#[rustc_clean(cfg="cfail6")]
impl Bar<u64> { impl Bar<u64> {
#[rustc_clean(cfg="cfail2", except="fn_sig,optimized_mir,typeck")] #[rustc_clean(cfg="cfail2", except="fn_sig,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="fn_sig,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_impl_self_type(&self) { } pub fn change_impl_self_type(&self) { }
} }
// Add Lifetime Bound to Impl -------------------------------------------------- // Add Lifetime Bound to Impl --------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl<T> Bar<T> { impl<T> Bar<T> {
pub fn add_lifetime_bound_to_impl_parameter(&self) { } pub fn add_lifetime_bound_to_impl_parameter(&self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl<T: 'static> Bar<T> { impl<T: 'static> Bar<T> {
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn add_lifetime_bound_to_impl_parameter(&self) { } pub fn add_lifetime_bound_to_impl_parameter(&self) { }
} }
// Add Trait Bound to Impl Parameter ------------------------------------------- // Add Trait Bound to Impl Parameter -------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl<T> Bar<T> { impl<T> Bar<T> {
pub fn add_trait_bound_to_impl_parameter(&self) { } pub fn add_trait_bound_to_impl_parameter(&self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
impl<T: Clone> Bar<T> { impl<T: Clone> Bar<T> {
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn add_trait_bound_to_impl_parameter(&self) { } pub fn add_trait_bound_to_impl_parameter(&self) { }
} }
@ -518,12 +774,12 @@ impl<T: Clone> Bar<T> {
pub fn instantiation_root() { pub fn instantiation_root() {
Foo::method_privacy(); Foo::method_privacy();
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
{ {
Bar(0u32).change_impl_self_type(); Bar(0u32).change_impl_self_type();
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
{ {
Bar(0u64).change_impl_self_type(); Bar(0u64).change_impl_self_type();
} }

View file

@ -6,8 +6,14 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
@ -17,7 +23,7 @@
// Change template // Change template
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_template(a: i32) -> i32 { pub fn change_template(a: i32) -> i32 {
let c: i32; let c: i32;
@ -32,9 +38,11 @@ pub fn change_template(a: i32) -> i32 {
c c
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_template(a: i32) -> i32 { pub fn change_template(a: i32) -> i32 {
let c: i32; let c: i32;
@ -52,7 +60,7 @@ pub fn change_template(a: i32) -> i32 {
// Change output // Change output
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_output(a: i32) -> i32 { pub fn change_output(a: i32) -> i32 {
let mut _out1: i32 = 0; let mut _out1: i32 = 0;
@ -68,9 +76,11 @@ pub fn change_output(a: i32) -> i32 {
_out1 _out1
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_output(a: i32) -> i32 { pub fn change_output(a: i32) -> i32 {
let mut _out1: i32 = 0; let mut _out1: i32 = 0;
@ -89,7 +99,7 @@ pub fn change_output(a: i32) -> i32 {
// Change input // Change input
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_input(_a: i32, _b: i32) -> i32 { pub fn change_input(_a: i32, _b: i32) -> i32 {
let _out; let _out;
@ -104,9 +114,11 @@ pub fn change_input(_a: i32, _b: i32) -> i32 {
_out _out
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_input(_a: i32, _b: i32) -> i32 { pub fn change_input(_a: i32, _b: i32) -> i32 {
let _out; let _out;
@ -124,7 +136,7 @@ pub fn change_input(_a: i32, _b: i32) -> i32 {
// Change input constraint // Change input constraint
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { pub fn change_input_constraint(_a: i32, _b: i32) -> i32 {
let _out; let _out;
@ -139,9 +151,11 @@ pub fn change_input_constraint(_a: i32, _b: i32) -> i32 {
_out _out
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { pub fn change_input_constraint(_a: i32, _b: i32) -> i32 {
let _out; let _out;
@ -159,7 +173,7 @@ pub fn change_input_constraint(_a: i32, _b: i32) -> i32 {
// Change clobber // Change clobber
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_clobber(_a: i32) -> i32 { pub fn change_clobber(_a: i32) -> i32 {
let _out; let _out;
@ -167,16 +181,18 @@ pub fn change_clobber(_a: i32) -> i32 {
llvm_asm!("add 1, $0" llvm_asm!("add 1, $0"
: "=r"(_out) : "=r"(_out)
: "0"(_a) : "0"(_a)
: :/*--*/
: :
); );
} }
_out _out
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_clobber(_a: i32) -> i32 { pub fn change_clobber(_a: i32) -> i32 {
let _out; let _out;
@ -194,7 +210,7 @@ pub fn change_clobber(_a: i32) -> i32 {
// Change options // Change options
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_options(_a: i32) -> i32 { pub fn change_options(_a: i32) -> i32 {
let _out; let _out;
@ -203,15 +219,17 @@ pub fn change_options(_a: i32) -> i32 {
: "=r"(_out) : "=r"(_out)
: "0"(_a) : "0"(_a)
: :
: :/*-------*/
); );
} }
_out _out
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_options(_a: i32) -> i32 { pub fn change_options(_a: i32) -> i32 {
let _out; let _out;

View file

@ -6,24 +6,30 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![crate_type="rlib"] #![crate_type="rlib"]
// Change Name ----------------------------------------------------------------- // Change Name -----------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_name() { pub fn change_name() {
let _x = 2u64; let _x = 2u64;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_name() { pub fn change_name() {
let _y = 2u64; let _y = 2u64;
} }
@ -31,15 +37,16 @@ pub fn change_name() {
// Add Type -------------------------------------------------------------------- // Add Type --------------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_type() { pub fn add_type() {
let _x = 2u32; let _x = 2u32;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn add_type() { pub fn add_type() {
let _x: u32 = 2u32; let _x: u32 = 2u32;
} }
@ -47,31 +54,33 @@ pub fn add_type() {
// Change Type ----------------------------------------------------------------- // Change Type -----------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_type() { pub fn change_type() {
let _x: u64 = 2; let _x: u64 = 2;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_type() { pub fn change_type() {
let _x: u8 = 2; let _x: u8 = 2;
} }
// Change Mutability of Reference Type ----------------------------------------- // Change Mutability of Reference Type -----------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_mutability_of_reference_type() { pub fn change_mutability_of_reference_type() {
let _x: &u64; let _x: & u64;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_mutability_of_reference_type() { pub fn change_mutability_of_reference_type() {
let _x: &mut u64; let _x: &mut u64;
} }
@ -79,31 +88,33 @@ pub fn change_mutability_of_reference_type() {
// Change Mutability of Slot --------------------------------------------------- // Change Mutability of Slot ---------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_mutability_of_slot() { pub fn change_mutability_of_slot() {
let mut _x: u64 = 0; let mut _x: u64 = 0;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_mutability_of_slot() { pub fn change_mutability_of_slot() {
let _x: u64 = 0; let _x: u64 = 0;
} }
// Change Simple Binding to Pattern -------------------------------------------- // Change Simple Binding to Pattern --------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_simple_binding_to_pattern() { pub fn change_simple_binding_to_pattern() {
let _x = (0u8, 'x'); let _x = (0u8, 'x');
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_simple_binding_to_pattern() { pub fn change_simple_binding_to_pattern() {
let (_a, _b) = (0u8, 'x'); let (_a, _b) = (0u8, 'x');
} }
@ -111,15 +122,16 @@ pub fn change_simple_binding_to_pattern() {
// Change Name in Pattern ------------------------------------------------------ // Change Name in Pattern ------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_name_in_pattern() { pub fn change_name_in_pattern() {
let (_a, _b) = (1u8, 'y'); let (_a, _b) = (1u8, 'y');
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_name_in_pattern() { pub fn change_name_in_pattern() {
let (_a, _c) = (1u8, 'y'); let (_a, _c) = (1u8, 'y');
} }
@ -127,15 +139,16 @@ pub fn change_name_in_pattern() {
// Add `ref` in Pattern -------------------------------------------------------- // Add `ref` in Pattern --------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_ref_in_pattern() { pub fn add_ref_in_pattern() {
let (_a, _b) = (1u8, 'y'); let ( _a, _b) = (1u8, 'y');
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn add_ref_in_pattern() { pub fn add_ref_in_pattern() {
let (ref _a, _b) = (1u8, 'y'); let (ref _a, _b) = (1u8, 'y');
} }
@ -143,15 +156,16 @@ pub fn add_ref_in_pattern() {
// Add `&` in Pattern ---------------------------------------------------------- // Add `&` in Pattern ----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_amp_in_pattern() { pub fn add_amp_in_pattern() {
let (_a, _b) = (&1u8, 'y'); let ( _a, _b) = (&1u8, 'y');
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn add_amp_in_pattern() { pub fn add_amp_in_pattern() {
let (&_a, _b) = (&1u8, 'y'); let (&_a, _b) = (&1u8, 'y');
} }
@ -159,15 +173,16 @@ pub fn add_amp_in_pattern() {
// Change Mutability of Binding in Pattern ------------------------------------- // Change Mutability of Binding in Pattern -------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_mutability_of_binding_in_pattern() { pub fn change_mutability_of_binding_in_pattern() {
let (_a, _b) = (99u8, 'q'); let ( _a, _b) = (99u8, 'q');
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_mutability_of_binding_in_pattern() { pub fn change_mutability_of_binding_in_pattern() {
let (mut _a, _b) = (99u8, 'q'); let (mut _a, _b) = (99u8, 'q');
} }
@ -175,15 +190,16 @@ pub fn change_mutability_of_binding_in_pattern() {
// Add Initializer ------------------------------------------------------------- // Add Initializer -------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_initializer() { pub fn add_initializer() {
let _x: i16; let _x: i16 ;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn add_initializer() { pub fn add_initializer() {
let _x: i16 = 3i16; let _x: i16 = 3i16;
} }
@ -191,15 +207,16 @@ pub fn add_initializer() {
// Change Initializer ---------------------------------------------------------- // Change Initializer ----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_initializer() { pub fn change_initializer() {
let _x = 4u16; let _x = 4u16;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_initializer() { pub fn change_initializer() {
let _x = 5u16; let _x = 5u16;
} }

View file

@ -6,8 +6,14 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
@ -15,7 +21,7 @@
// Change loop body // Change loop body
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_loop_body() { pub fn change_loop_body() {
let mut _x = 0; let mut _x = 0;
loop { loop {
@ -24,9 +30,11 @@ pub fn change_loop_body() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_loop_body() { pub fn change_loop_body() {
let mut _x = 0; let mut _x = 0;
loop { loop {
@ -38,17 +46,20 @@ pub fn change_loop_body() {
// Add break // Add break
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_break() { pub fn add_break() {
let mut _x = 0; let mut _x = 0;
loop { loop {
_x = 1; _x = 1;
//----
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn add_break() { pub fn add_break() {
let mut _x = 0; let mut _x = 0;
loop { loop {
@ -60,18 +71,20 @@ pub fn add_break() {
// Add loop label // Add loop label
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_loop_label() { pub fn add_loop_label() {
let mut _x = 0; let mut _x = 0;
loop { /*---*/ loop {
_x = 1; _x = 1;
break; break;
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label() { pub fn add_loop_label() {
let mut _x = 0; let mut _x = 0;
'label: loop { 'label: loop {
@ -83,18 +96,20 @@ pub fn add_loop_label() {
// Add loop label to break // Add loop label to break
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_loop_label_to_break() { pub fn add_loop_label_to_break() {
let mut _x = 0; let mut _x = 0;
'label: loop { 'label: loop {
_x = 1; _x = 1;
break; break ;
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label_to_break() { pub fn add_loop_label_to_break() {
let mut _x = 0; let mut _x = 0;
'label: loop { 'label: loop {
@ -106,7 +121,7 @@ pub fn add_loop_label_to_break() {
// Change break label // Change break label
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_break_label() { pub fn change_break_label() {
let mut _x = 0; let mut _x = 0;
'outer: loop { 'outer: loop {
@ -117,9 +132,11 @@ pub fn change_break_label() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_break_label() { pub fn change_break_label() {
let mut _x = 0; let mut _x = 0;
'outer: loop { 'outer: loop {
@ -133,18 +150,20 @@ pub fn change_break_label() {
// Add loop label to continue // Add loop label to continue
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_loop_label_to_continue() { pub fn add_loop_label_to_continue() {
let mut _x = 0; let mut _x = 0;
'label: loop { 'label: loop {
_x = 1; _x = 1;
continue; continue ;
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label_to_continue() { pub fn add_loop_label_to_continue() {
let mut _x = 0; let mut _x = 0;
'label: loop { 'label: loop {
@ -156,7 +175,7 @@ pub fn add_loop_label_to_continue() {
// Change continue label // Change continue label
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_continue_label() { pub fn change_continue_label() {
let mut _x = 0; let mut _x = 0;
'outer: loop { 'outer: loop {
@ -167,9 +186,11 @@ pub fn change_continue_label() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, typeck, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_continue_label() { pub fn change_continue_label() {
let mut _x = 0; let mut _x = 0;
'outer: loop { 'outer: loop {
@ -183,7 +204,7 @@ pub fn change_continue_label() {
// Change continue to break // Change continue to break
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_continue_to_break() { pub fn change_continue_to_break() {
let mut _x = 0; let mut _x = 0;
loop { loop {
@ -192,13 +213,15 @@ pub fn change_continue_to_break() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, typeck, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, typeck, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_continue_to_break() { pub fn change_continue_to_break() {
let mut _x = 0; let mut _x = 0;
loop { loop {
_x = 1; _x = 1;
break; break ;
} }
} }

View file

@ -6,28 +6,35 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![crate_type="rlib"] #![crate_type="rlib"]
// Add Arm --------------------------------------------------------------------- // Add Arm ---------------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_arm(x: u32) -> u32 { pub fn add_arm(x: u32) -> u32 {
match x { match x {
0 => 0, 0 => 0,
1 => 1, 1 => 1,
/*---*/
_ => 100, _ => 100,
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn add_arm(x: u32) -> u32 { pub fn add_arm(x: u32) -> u32 {
match x { match x {
0 => 0, 0 => 0,
@ -40,7 +47,7 @@ pub fn add_arm(x: u32) -> u32 {
// Change Order Of Arms -------------------------------------------------------- // Change Order Of Arms --------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_order_of_arms(x: u32) -> u32 { pub fn change_order_of_arms(x: u32) -> u32 {
match x { match x {
0 => 0, 0 => 0,
@ -49,10 +56,11 @@ pub fn change_order_of_arms(x: u32) -> u32 {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_order_of_arms(x: u32) -> u32 { pub fn change_order_of_arms(x: u32) -> u32 {
match x { match x {
1 => 1, 1 => 1,
@ -64,19 +72,20 @@ pub fn change_order_of_arms(x: u32) -> u32 {
// Add Guard Clause ------------------------------------------------------------ // Add Guard Clause ------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_guard_clause(x: u32, y: bool) -> u32 { pub fn add_guard_clause(x: u32, y: bool) -> u32 {
match x { match x {
0 => 0, 0 => 0,
1 => 1, 1 => 1,
_ => 100, _ => 100,
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn add_guard_clause(x: u32, y: bool) -> u32 { pub fn add_guard_clause(x: u32, y: bool) -> u32 {
match x { match x {
0 => 0, 0 => 0,
@ -88,19 +97,20 @@ pub fn add_guard_clause(x: u32, y: bool) -> u32 {
// Change Guard Clause ------------------------------------------------------------ // Change Guard Clause ------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_guard_clause(x: u32, y: bool) -> u32 { pub fn change_guard_clause(x: u32, y: bool) -> u32 {
match x { match x {
0 => 0, 0 => 0,
1 if y => 1, 1 if y => 1,
_ => 100, _ => 100,
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_guard_clause(x: u32, y: bool) -> u32 { pub fn change_guard_clause(x: u32, y: bool) -> u32 {
match x { match x {
0 => 0, 0 => 0,
@ -112,19 +122,20 @@ pub fn change_guard_clause(x: u32, y: bool) -> u32 {
// Add @-Binding --------------------------------------------------------------- // Add @-Binding ---------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_at_binding(x: u32) -> u32 { pub fn add_at_binding(x: u32) -> u32 {
match x { match x {
0 => 0, 0 => 0,
1 => 1, 1 => 1,
_ => x, _ => x,
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn add_at_binding(x: u32) -> u32 { pub fn add_at_binding(x: u32) -> u32 {
match x { match x {
0 => 0, 0 => 0,
@ -136,7 +147,7 @@ pub fn add_at_binding(x: u32) -> u32 {
// Change Name of @-Binding ---------------------------------------------------- // Change Name of @-Binding ----------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_name_of_at_binding(x: u32) -> u32 { pub fn change_name_of_at_binding(x: u32) -> u32 {
match x { match x {
0 => 0, 0 => 0,
@ -145,10 +156,11 @@ pub fn change_name_of_at_binding(x: u32) -> u32 {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_name_of_at_binding(x: u32) -> u32 { pub fn change_name_of_at_binding(x: u32) -> u32 {
match x { match x {
0 => 0, 0 => 0,
@ -160,18 +172,19 @@ pub fn change_name_of_at_binding(x: u32) -> u32 {
// Change Simple Binding To Pattern -------------------------------------------- // Change Simple Binding To Pattern --------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_simple_name_to_pattern(x: u32) -> u32 { pub fn change_simple_name_to_pattern(x: u32) -> u32 {
match (x, x & 1) { match (x, x & 1) {
(0, 0) => 0, (0, 0) => 0,
a => 1, a => 1,
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_simple_name_to_pattern(x: u32) -> u32 { pub fn change_simple_name_to_pattern(x: u32) -> u32 {
match (x, x & 1) { match (x, x & 1) {
(0, 0) => 0, (0, 0) => 0,
@ -182,7 +195,7 @@ pub fn change_simple_name_to_pattern(x: u32) -> u32 {
// Change Name In Pattern ------------------------------------------------------ // Change Name In Pattern ------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_name_in_pattern(x: u32) -> u32 { pub fn change_name_in_pattern(x: u32) -> u32 {
match (x, x & 1) { match (x, x & 1) {
(a, 0) => 0, (a, 0) => 0,
@ -191,10 +204,11 @@ pub fn change_name_in_pattern(x: u32) -> u32 {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_name_in_pattern(x: u32) -> u32 { pub fn change_name_in_pattern(x: u32) -> u32 {
match (x, x & 1) { match (x, x & 1) {
(b, 0) => 0, (b, 0) => 0,
@ -206,18 +220,19 @@ pub fn change_name_in_pattern(x: u32) -> u32 {
// Change Mutability Of Binding In Pattern ------------------------------------- // Change Mutability Of Binding In Pattern -------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_mutability_of_binding_in_pattern(x: u32) -> u32 { pub fn change_mutability_of_binding_in_pattern(x: u32) -> u32 {
match (x, x & 1) { match (x, x & 1) {
(a, 0) => 0, ( a, 0) => 0,
_ => 1, _ => 1,
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_mutability_of_binding_in_pattern(x: u32) -> u32 { pub fn change_mutability_of_binding_in_pattern(x: u32) -> u32 {
match (x, x & 1) { match (x, x & 1) {
(mut a, 0) => 0, (mut a, 0) => 0,
@ -228,18 +243,19 @@ pub fn change_mutability_of_binding_in_pattern(x: u32) -> u32 {
// Add `ref` To Binding In Pattern ------------------------------------- // Add `ref` To Binding In Pattern -------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_ref_to_binding_in_pattern(x: u32) -> u32 { pub fn add_ref_to_binding_in_pattern(x: u32) -> u32 {
match (x, x & 1) { match (x, x & 1) {
(a, 0) => 0, ( a, 0) => 0,
_ => 1, _ => 1,
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn add_ref_to_binding_in_pattern(x: u32) -> u32 { pub fn add_ref_to_binding_in_pattern(x: u32) -> u32 {
match (x, x & 1) { match (x, x & 1) {
(ref a, 0) => 0, (ref a, 0) => 0,
@ -250,18 +266,19 @@ pub fn add_ref_to_binding_in_pattern(x: u32) -> u32 {
// Add `&` To Binding In Pattern ------------------------------------- // Add `&` To Binding In Pattern -------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_amp_to_binding_in_pattern(x: u32) -> u32 { pub fn add_amp_to_binding_in_pattern(x: u32) -> u32 {
match (&x, x & 1) { match (&x, x & 1) {
(a, 0) => 0, ( a, 0) => 0,
_ => 1, _ => 1,
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn add_amp_to_binding_in_pattern(x: u32) -> u32 { pub fn add_amp_to_binding_in_pattern(x: u32) -> u32 {
match (&x, x & 1) { match (&x, x & 1) {
(&a, 0) => 0, (&a, 0) => 0,
@ -272,7 +289,7 @@ pub fn add_amp_to_binding_in_pattern(x: u32) -> u32 {
// Change RHS Of Arm ----------------------------------------------------------- // Change RHS Of Arm -----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_rhs_of_arm(x: u32) -> u32 { pub fn change_rhs_of_arm(x: u32) -> u32 {
match x { match x {
0 => 0, 0 => 0,
@ -281,10 +298,11 @@ pub fn change_rhs_of_arm(x: u32) -> u32 {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_rhs_of_arm(x: u32) -> u32 { pub fn change_rhs_of_arm(x: u32) -> u32 {
match x { match x {
0 => 0, 0 => 0,
@ -296,19 +314,20 @@ pub fn change_rhs_of_arm(x: u32) -> u32 {
// Add Alternative To Arm ------------------------------------------------------ // Add Alternative To Arm ------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_alternative_to_arm(x: u32) -> u32 { pub fn add_alternative_to_arm(x: u32) -> u32 {
match x { match x {
0 => 0, 0 => 0,
1 => 1, 1 => 1,
_ => 2, _ => 2,
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn add_alternative_to_arm(x: u32) -> u32 { pub fn add_alternative_to_arm(x: u32) -> u32 {
match x { match x {
0 | 7 => 0, 0 | 7 => 0,

View file

@ -6,8 +6,14 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
@ -17,86 +23,102 @@
// Change static visibility // Change static visibility
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
static STATIC_VISIBILITY: u8 = 0; static STATIC_VISIBILITY: u8 = 0;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
pub static STATIC_VISIBILITY: u8 = 0; pub static STATIC_VISIBILITY: u8 = 0;
// Change static mutability // Change static mutability
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
static STATIC_MUTABILITY: u8 = 0; static STATIC_MUTABILITY: u8 = 0;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
static mut STATIC_MUTABILITY: u8 = 0; static mut STATIC_MUTABILITY: u8 = 0;
// Add linkage attribute // Add linkage attribute
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
static STATIC_LINKAGE: u8 = 0; static STATIC_LINKAGE: u8 = 0;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
#[linkage="weak_odr"] #[linkage="weak_odr"]
static STATIC_LINKAGE: u8 = 0; static STATIC_LINKAGE: u8 = 0;
// Add no_mangle attribute // Add no_mangle attribute
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
static STATIC_NO_MANGLE: u8 = 0; static STATIC_NO_MANGLE: u8 = 0;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
#[no_mangle] #[no_mangle]
static STATIC_NO_MANGLE: u8 = 0; static STATIC_NO_MANGLE: u8 = 0;
// Add thread_local attribute // Add thread_local attribute
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
static STATIC_THREAD_LOCAL: u8 = 0; static STATIC_THREAD_LOCAL: u8 = 0;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
#[thread_local] #[thread_local]
static STATIC_THREAD_LOCAL: u8 = 0; static STATIC_THREAD_LOCAL: u8 = 0;
// Change type from i16 to u64 // Change type from i16 to u64
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
static STATIC_CHANGE_TYPE_1: i16 = 0; static STATIC_CHANGE_TYPE_1: i16 = 0;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
static STATIC_CHANGE_TYPE_1: u64 = 0; static STATIC_CHANGE_TYPE_1: u64 = 0;
// Change type from Option<i8> to Option<u16> // Change type from Option<i8> to Option<u16>
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
static STATIC_CHANGE_TYPE_2: Option<i8> = None; static STATIC_CHANGE_TYPE_2: Option<i8> = None;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
static STATIC_CHANGE_TYPE_2: Option<u16> = None; static STATIC_CHANGE_TYPE_2: Option<u16> = None;
// Change value between simple literals // Change value between simple literals
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
static STATIC_CHANGE_VALUE_1: i16 = { static STATIC_CHANGE_VALUE_1: i16 = {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
{ 1 } { 1 }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
{ 2 } { 2 }
}; };
@ -104,31 +126,37 @@ static STATIC_CHANGE_VALUE_1: i16 = {
// Change value between expressions // Change value between expressions
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
static STATIC_CHANGE_VALUE_2: i16 = { static STATIC_CHANGE_VALUE_2: i16 = {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
{ 1 + 1 } { 1 + 1 }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
{ 1 + 2 } { 1 + 2 }
}; };
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
static STATIC_CHANGE_VALUE_3: i16 = { static STATIC_CHANGE_VALUE_3: i16 = {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
{ 2 + 3 } { 2 + 3 }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
{ 2 * 3 } { 2 * 3 }
}; };
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
static STATIC_CHANGE_VALUE_4: i16 = { static STATIC_CHANGE_VALUE_4: i16 = {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
{ 1 + 2 * 3 } { 1 + 2 * 3 }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
{ 1 + 2 * 4 } { 1 + 2 * 4 }
}; };
@ -138,17 +166,21 @@ struct ReferencedType1;
struct ReferencedType2; struct ReferencedType2;
mod static_change_type_indirectly { mod static_change_type_indirectly {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::ReferencedType1 as Type; use super::ReferencedType1 as Type;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedType2 as Type; use super::ReferencedType2 as Type;
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
static STATIC_CHANGE_TYPE_INDIRECTLY_1: Type = Type; static STATIC_CHANGE_TYPE_INDIRECTLY_1: Type = Type;
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")] #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail6")]
static STATIC_CHANGE_TYPE_INDIRECTLY_2: Option<Type> = None; static STATIC_CHANGE_TYPE_INDIRECTLY_2: Option<Type> = None;
} }

View file

@ -6,8 +6,14 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
@ -21,7 +27,7 @@ pub struct RegularStruct {
} }
// Change field value (regular struct) // Change field value (regular struct)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_field_value_regular_struct() -> RegularStruct { pub fn change_field_value_regular_struct() -> RegularStruct {
RegularStruct { RegularStruct {
x: 0, x: 0,
@ -30,9 +36,11 @@ pub fn change_field_value_regular_struct() -> RegularStruct {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_field_value_regular_struct() -> RegularStruct { pub fn change_field_value_regular_struct() -> RegularStruct {
RegularStruct { RegularStruct {
x: 0, x: 0,
@ -44,7 +52,7 @@ pub fn change_field_value_regular_struct() -> RegularStruct {
// Change field order (regular struct) // Change field order (regular struct)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_field_order_regular_struct() -> RegularStruct { pub fn change_field_order_regular_struct() -> RegularStruct {
RegularStruct { RegularStruct {
x: 3, x: 3,
@ -53,9 +61,11 @@ pub fn change_field_order_regular_struct() -> RegularStruct {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_field_order_regular_struct() -> RegularStruct { pub fn change_field_order_regular_struct() -> RegularStruct {
RegularStruct { RegularStruct {
y: 4, y: 4,
@ -67,7 +77,7 @@ pub fn change_field_order_regular_struct() -> RegularStruct {
// Add field (regular struct) // Add field (regular struct)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_field_regular_struct() -> RegularStruct { pub fn add_field_regular_struct() -> RegularStruct {
let struct1 = RegularStruct { let struct1 = RegularStruct {
x: 3, x: 3,
@ -77,13 +87,16 @@ pub fn add_field_regular_struct() -> RegularStruct {
RegularStruct { RegularStruct {
x: 7, x: 7,
// --
.. struct1 .. struct1
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn add_field_regular_struct() -> RegularStruct { pub fn add_field_regular_struct() -> RegularStruct {
let struct1 = RegularStruct { let struct1 = RegularStruct {
x: 3, x: 3,
@ -101,7 +114,7 @@ pub fn add_field_regular_struct() -> RegularStruct {
// Change field label (regular struct) // Change field label (regular struct)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_field_label_regular_struct() -> RegularStruct { pub fn change_field_label_regular_struct() -> RegularStruct {
let struct1 = RegularStruct { let struct1 = RegularStruct {
x: 3, x: 3,
@ -116,9 +129,11 @@ pub fn change_field_label_regular_struct() -> RegularStruct {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_field_label_regular_struct() -> RegularStruct { pub fn change_field_label_regular_struct() -> RegularStruct {
let struct1 = RegularStruct { let struct1 = RegularStruct {
x: 3, x: 3,
@ -142,18 +157,20 @@ pub struct RegularStruct2 {
} }
// Change constructor path (regular struct) // Change constructor path (regular struct)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_constructor_path_regular_struct() { pub fn change_constructor_path_regular_struct() {
let _ = RegularStruct { let _ = RegularStruct {
x: 0, x: 0,
y: 1, y: 1,
z: 2, z: 2,
}; };
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_constructor_path_regular_struct() { pub fn change_constructor_path_regular_struct() {
let _ = RegularStruct2 { let _ = RegularStruct2 {
x: 0, x: 0,
@ -166,9 +183,9 @@ pub fn change_constructor_path_regular_struct() {
// Change constructor path indirectly (regular struct) // Change constructor path indirectly (regular struct)
pub mod change_constructor_path_indirectly_regular_struct { pub mod change_constructor_path_indirectly_regular_struct {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::RegularStruct as Struct; use super::RegularStruct as Struct;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::RegularStruct2 as Struct; use super::RegularStruct2 as Struct;
#[rustc_clean( #[rustc_clean(
@ -176,6 +193,11 @@ pub mod change_constructor_path_indirectly_regular_struct {
except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,typeck" except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,typeck"
)] )]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(
cfg="cfail5",
except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,typeck"
)]
#[rustc_clean(cfg="cfail6")]
pub fn function() -> Struct { pub fn function() -> Struct {
Struct { Struct {
x: 0, x: 0,
@ -190,14 +212,16 @@ pub mod change_constructor_path_indirectly_regular_struct {
pub struct TupleStruct(i32, i64, i16); pub struct TupleStruct(i32, i64, i16);
// Change field value (tuple struct) // Change field value (tuple struct)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_field_value_tuple_struct() -> TupleStruct { pub fn change_field_value_tuple_struct() -> TupleStruct {
TupleStruct(0, 1, 2) TupleStruct(0, 1, 2)
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_field_value_tuple_struct() -> TupleStruct { pub fn change_field_value_tuple_struct() -> TupleStruct {
TupleStruct(0, 1, 3) TupleStruct(0, 1, 3)
} }
@ -207,14 +231,16 @@ pub fn change_field_value_tuple_struct() -> TupleStruct {
pub struct TupleStruct2(u16, u16, u16); pub struct TupleStruct2(u16, u16, u16);
// Change constructor path (tuple struct) // Change constructor path (tuple struct)
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_constructor_path_tuple_struct() { pub fn change_constructor_path_tuple_struct() {
let _ = TupleStruct(0, 1, 2); let _ = TupleStruct (0, 1, 2);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_constructor_path_tuple_struct() { pub fn change_constructor_path_tuple_struct() {
let _ = TupleStruct2(0, 1, 2); let _ = TupleStruct2(0, 1, 2);
} }
@ -223,11 +249,16 @@ pub fn change_constructor_path_tuple_struct() {
// Change constructor path indirectly (tuple struct) // Change constructor path indirectly (tuple struct)
pub mod change_constructor_path_indirectly_tuple_struct { pub mod change_constructor_path_indirectly_tuple_struct {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::TupleStruct as Struct; use super::TupleStruct as Struct;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::TupleStruct2 as Struct; use super::TupleStruct2 as Struct;
#[rustc_clean(
cfg="cfail5",
except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,typeck"
)]
#[rustc_clean(cfg="cfail6")]
#[rustc_clean( #[rustc_clean(
cfg="cfail2", cfg="cfail2",
except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,typeck" except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,typeck"

View file

@ -11,42 +11,53 @@
// the same between rev2 and rev3. // the same between rev2 and rev3.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![crate_type="rlib"] #![crate_type="rlib"]
// Layout ---------------------------------------------------------------------- // Layout ----------------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub struct LayoutPacked; pub struct LayoutPacked;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="type_of", cfg="cfail2")] #[rustc_clean(except="type_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="type_of", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
#[repr(packed)] #[repr(packed)]
pub struct LayoutPacked; pub struct LayoutPacked;
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
struct LayoutC; struct LayoutC;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="type_of", cfg="cfail2")] #[rustc_clean(except="type_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="type_of", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
#[repr(C)] #[repr(C)]
struct LayoutC; struct LayoutC;
// Tuple Struct Change Field Type ---------------------------------------------- // Tuple Struct Change Field Type ----------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
struct TupleStructFieldType(i32); struct TupleStructFieldType(i32);
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
// Note that changing the type of a field does not change the type of the struct or enum, but // 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. // adding/removing fields or changing a fields name or visibility does.
struct TupleStructFieldType( struct TupleStructFieldType(
@ -56,12 +67,14 @@ struct TupleStructFieldType(
// Tuple Struct Add Field ------------------------------------------------------ // Tuple Struct Add Field ------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
struct TupleStructAddField(i32); struct TupleStructAddField(i32);
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
struct TupleStructAddField( struct TupleStructAddField(
i32, i32,
u32 u32
@ -70,23 +83,27 @@ struct TupleStructAddField(
// Tuple Struct Field Visibility ----------------------------------------------- // Tuple Struct Field Visibility -----------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
struct TupleStructFieldVisibility(char); struct TupleStructFieldVisibility(char);
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
struct TupleStructFieldVisibility(pub char); struct TupleStructFieldVisibility(pub char);
// Record Struct Field Type ---------------------------------------------------- // Record Struct Field Type ----------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
struct RecordStructFieldType { x: f32 } struct RecordStructFieldType { x: f32 }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
// Note that changing the type of a field does not change the type of the struct or enum, but // 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. // adding/removing fields or changing a fields name or visibility does.
struct RecordStructFieldType { struct RecordStructFieldType {
@ -96,23 +113,27 @@ struct RecordStructFieldType {
// Record Struct Field Name ---------------------------------------------------- // Record Struct Field Name ----------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
struct RecordStructFieldName { x: f32 } struct RecordStructFieldName { x: f32 }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
struct RecordStructFieldName { y: f32 } struct RecordStructFieldName { y: f32 }
// Record Struct Add Field ----------------------------------------------------- // Record Struct Add Field -----------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
struct RecordStructAddField { x: f32 } struct RecordStructAddField { x: f32 }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
struct RecordStructAddField { struct RecordStructAddField {
x: f32, x: f32,
y: () } y: () }
@ -120,12 +141,14 @@ struct RecordStructAddField {
// Record Struct Field Visibility ---------------------------------------------- // Record Struct Field Visibility ----------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
struct RecordStructFieldVisibility { x: f32 } struct RecordStructFieldVisibility { x: f32 }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
struct RecordStructFieldVisibility { struct RecordStructFieldVisibility {
pub x: f32 pub x: f32
} }
@ -133,34 +156,40 @@ struct RecordStructFieldVisibility {
// Add Lifetime Parameter ------------------------------------------------------ // Add Lifetime Parameter ------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
struct AddLifetimeParameter<'a>(&'a f32, &'a f64); struct AddLifetimeParameter<'a>(&'a f32, &'a f64);
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of,generics_of", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,type_of,generics_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of,generics_of", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
struct AddLifetimeParameter<'a, 'b>(&'a f32, &'b f64); struct AddLifetimeParameter<'a, 'b>(&'a f32, &'b f64);
// Add Lifetime Parameter Bound ------------------------------------------------ // Add Lifetime Parameter Bound ------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
struct AddLifetimeParameterBound<'a, 'b>(&'a f32, &'b f64); struct AddLifetimeParameterBound<'a, 'b>(&'a f32, &'b f64);
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
struct AddLifetimeParameterBound<'a, 'b: 'a>( struct AddLifetimeParameterBound<'a, 'b: 'a>(
&'a f32, &'a f32,
&'b f64 &'b f64
); );
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
struct AddLifetimeParameterBoundWhereClause<'a, 'b>(&'a f32, &'b f64); struct AddLifetimeParameterBoundWhereClause<'a, 'b>(&'a f32, &'b f64);
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
struct AddLifetimeParameterBoundWhereClause<'a, 'b>( struct AddLifetimeParameterBoundWhereClause<'a, 'b>(
&'a f32, &'a f32,
&'b f64) &'b f64)
@ -169,12 +198,14 @@ struct AddLifetimeParameterBoundWhereClause<'a, 'b>(
// Add Type Parameter ---------------------------------------------------------- // Add Type Parameter ----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
struct AddTypeParameter<T1>(T1, T1); struct AddTypeParameter<T1>(T1, T1);
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of,generics_of,predicates_of", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,type_of,generics_of,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of,generics_of,predicates_of", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
struct AddTypeParameter<T1, T2>( struct AddTypeParameter<T1, T2>(
// The field contains the parent's Generics, so it's dirty even though its // The field contains the parent's Generics, so it's dirty even though its
// type hasn't changed. // type hasn't changed.
@ -185,23 +216,27 @@ struct AddTypeParameter<T1, T2>(
// Add Type Parameter Bound ---------------------------------------------------- // Add Type Parameter Bound ----------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
struct AddTypeParameterBound<T>(T); struct AddTypeParameterBound<T>(T);
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
struct AddTypeParameterBound<T: Send>( struct AddTypeParameterBound<T: Send>(
T T
); );
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
struct AddTypeParameterBoundWhereClause<T>(T); struct AddTypeParameterBoundWhereClause<T>(T);
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
struct AddTypeParameterBoundWhereClause<T>( struct AddTypeParameterBoundWhereClause<T>(
T T
) where T: Sync; ) where T: Sync;
@ -214,17 +249,21 @@ struct AddTypeParameterBoundWhereClause<T>(
// Note: there is no #[cfg(...)], so this is ALWAYS compiled // Note: there is no #[cfg(...)], so this is ALWAYS compiled
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub struct EmptyStruct; pub struct EmptyStruct;
// Visibility ------------------------------------------------------------------ // Visibility ------------------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
struct Visibility; struct Visibility;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub struct Visibility; pub struct Visibility;
struct ReferencedType1; struct ReferencedType1;
@ -232,13 +271,15 @@ struct ReferencedType2;
// Tuple Struct Change Field Type Indirectly ----------------------------------- // Tuple Struct Change Field Type Indirectly -----------------------------------
mod tuple_struct_change_field_type_indirectly { mod tuple_struct_change_field_type_indirectly {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::ReferencedType1 as FieldType; use super::ReferencedType1 as FieldType;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedType2 as FieldType; use super::ReferencedType2 as FieldType;
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
struct TupleStruct( struct TupleStruct(
FieldType FieldType
); );
@ -247,13 +288,15 @@ mod tuple_struct_change_field_type_indirectly {
// Record Struct Change Field Type Indirectly ----------------------------------- // Record Struct Change Field Type Indirectly -----------------------------------
mod record_struct_change_field_type_indirectly { mod record_struct_change_field_type_indirectly {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::ReferencedType1 as FieldType; use super::ReferencedType1 as FieldType;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedType2 as FieldType; use super::ReferencedType2 as FieldType;
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
struct RecordStruct { struct RecordStruct {
_x: FieldType _x: FieldType
} }
@ -267,24 +310,28 @@ trait ReferencedTrait2 {}
// Change Trait Bound Indirectly ----------------------------------------------- // Change Trait Bound Indirectly -----------------------------------------------
mod change_trait_bound_indirectly { mod change_trait_bound_indirectly {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::ReferencedTrait1 as Trait; use super::ReferencedTrait1 as Trait;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedTrait2 as Trait; use super::ReferencedTrait2 as Trait;
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
struct Struct<T: Trait>(T); struct Struct<T: Trait>(T);
} }
// Change Trait Bound Indirectly In Where Clause ------------------------------- // Change Trait Bound Indirectly In Where Clause -------------------------------
mod change_trait_bound_indirectly_in_where_clause { mod change_trait_bound_indirectly_in_where_clause {
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
use super::ReferencedTrait1 as Trait; use super::ReferencedTrait1 as Trait;
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedTrait2 as Trait; use super::ReferencedTrait2 as Trait;
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
struct Struct<T>(T) where T : Trait; struct Struct<T>(T) where T : Trait;
} }

File diff suppressed because it is too large Load diff

View file

@ -6,9 +6,14 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
@ -19,29 +24,35 @@ struct Foo;
// Change Method Name ----------------------------------------------------------- // Change Method Name -----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub trait ChangeMethodNameTrait { pub trait ChangeMethodNameTrait {
fn method_name(); fn method_name();
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl ChangeMethodNameTrait for Foo { impl ChangeMethodNameTrait for Foo {
fn method_name() { } fn method_name() { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")] #[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub trait ChangeMethodNameTrait { pub trait ChangeMethodNameTrait {
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail6")]
fn method_name2(); fn method_name2();
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")] #[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl ChangeMethodNameTrait for Foo { impl ChangeMethodNameTrait for Foo {
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail6")]
fn method_name2() { } fn method_name2() { }
} }
@ -53,17 +64,27 @@ pub trait ChangeMethodBodyTrait {
fn method_name(); fn method_name();
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl ChangeMethodBodyTrait for Foo { impl ChangeMethodBodyTrait for Foo {
fn method_name() { } // ----------------------------------------------------------
// -------------------------
// ----------------------------------------------------------
// -------------------------
fn method_name() {
//
}
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl ChangeMethodBodyTrait for Foo { impl ChangeMethodBodyTrait for Foo {
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
fn method_name() { fn method_name() {
() ()
} }
@ -77,18 +98,28 @@ pub trait ChangeMethodBodyTraitInlined {
fn method_name(); fn method_name();
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl ChangeMethodBodyTraitInlined for Foo { impl ChangeMethodBodyTraitInlined for Foo {
// ------------------------------------------------------------------------
// -------------------------
// ------------------------------------------------------------------------
// -------------------------
#[inline] #[inline]
fn method_name() { } fn method_name() {
// -----
}
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl ChangeMethodBodyTraitInlined for Foo { impl ChangeMethodBodyTraitInlined for Foo {
#[rustc_clean(except="hir_owner_nodes,typeck,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,typeck,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,typeck,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
#[inline] #[inline]
fn method_name() { fn method_name() {
panic!() panic!()
@ -97,30 +128,37 @@ impl ChangeMethodBodyTraitInlined for Foo {
// Change Method Selfness ------------------------------------------------------ // Change Method Selfness ------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub trait ChangeMethodSelfnessTrait { pub trait ChangeMethodSelfnessTrait {
fn method_name(); fn method_name();
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl ChangeMethodSelfnessTrait for Foo { impl ChangeMethodSelfnessTrait for Foo {
fn method_name() { } fn method_name() { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
pub trait ChangeMethodSelfnessTrait { pub trait ChangeMethodSelfnessTrait {
fn method_name(&self); fn method_name(&self);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner", cfg="cfail2")] #[rustc_clean(except="hir_owner", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl ChangeMethodSelfnessTrait for Foo { impl ChangeMethodSelfnessTrait for Foo {
#[rustc_clean( #[rustc_clean(
except="hir_owner,hir_owner_nodes,associated_item,generics_of,fn_sig,typeck,optimized_mir", except="hir_owner,hir_owner_nodes,associated_item,generics_of,fn_sig,typeck,optimized_mir",
cfg="cfail2", cfg="cfail2",
)] )]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(
except="hir_owner,hir_owner_nodes,associated_item,generics_of,fn_sig,typeck,optimized_mir",
cfg="cfail5",
)]
#[rustc_clean(cfg="cfail6")]
fn method_name(&self) { fn method_name(&self) {
() ()
} }
@ -128,130 +166,151 @@ impl ChangeMethodSelfnessTrait for Foo {
// Change Method Selfness ----------------------------------------------------------- // Change Method Selfness -----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub trait RemoveMethodSelfnessTrait { pub trait RemoveMethodSelfnessTrait {
fn method_name(&self); fn method_name(&self);
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl RemoveMethodSelfnessTrait for Foo { impl RemoveMethodSelfnessTrait for Foo {
fn method_name(&self) { } fn method_name(&self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
pub trait RemoveMethodSelfnessTrait { pub trait RemoveMethodSelfnessTrait {
fn method_name(); fn method_name();
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner", cfg="cfail2")] #[rustc_clean(except="hir_owner", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl RemoveMethodSelfnessTrait for Foo { impl RemoveMethodSelfnessTrait for Foo {
#[rustc_clean( #[rustc_clean(
except="hir_owner,hir_owner_nodes,associated_item,generics_of,fn_sig,typeck,optimized_mir", except="hir_owner,hir_owner_nodes,associated_item,generics_of,fn_sig,typeck,optimized_mir",
cfg="cfail2", cfg="cfail2",
)] )]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(
except="hir_owner,hir_owner_nodes,associated_item,generics_of,fn_sig,typeck,optimized_mir",
cfg="cfail5",
)]
#[rustc_clean(cfg="cfail6")]
fn method_name() {} fn method_name() {}
} }
// Change Method Selfmutness ----------------------------------------------------------- // Change Method Selfmutness -----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub trait ChangeMethodSelfmutnessTrait { pub trait ChangeMethodSelfmutnessTrait {
fn method_name(&self); fn method_name(&self);
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl ChangeMethodSelfmutnessTrait for Foo { impl ChangeMethodSelfmutnessTrait for Foo {
fn method_name(&self) { } // -----------------------------------------------------------------------------------------
// -------------------------
// -----------------------------------------------------------------------------------------
// -------------------------
fn method_name(& self) {}
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
pub trait ChangeMethodSelfmutnessTrait { pub trait ChangeMethodSelfmutnessTrait {
fn method_name(&mut self); fn method_name(&mut self);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl ChangeMethodSelfmutnessTrait for Foo { impl ChangeMethodSelfmutnessTrait for Foo {
#[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
fn method_name(&mut self) {} fn method_name(&mut self) {}
} }
// Change item kind ----------------------------------------------------------- // Change item kind -----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub trait ChangeItemKindTrait { pub trait ChangeItemKindTrait {
fn name(); fn name();
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl ChangeItemKindTrait for Foo { impl ChangeItemKindTrait for Foo {
fn name() { } fn name() { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
pub trait ChangeItemKindTrait { pub trait ChangeItemKindTrait {
type name; type name;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")] #[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl ChangeItemKindTrait for Foo { impl ChangeItemKindTrait for Foo {
type name = (); type name = ();
} }
// Remove item ----------------------------------------------------------- // Remove item -----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub trait RemoveItemTrait { pub trait RemoveItemTrait {
type TypeName; type TypeName;
fn method_name(); fn method_name();
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl RemoveItemTrait for Foo { impl RemoveItemTrait for Foo {
type TypeName = (); type TypeName = ();
fn method_name() { } fn method_name() { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
pub trait RemoveItemTrait { pub trait RemoveItemTrait {
type TypeName; type TypeName;
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")] #[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl RemoveItemTrait for Foo { impl RemoveItemTrait for Foo {
type TypeName = (); type TypeName = ();
} }
// Add item ----------------------------------------------------------- // Add item -----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub trait AddItemTrait { pub trait AddItemTrait {
type TypeName; type TypeName;
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl AddItemTrait for Foo { impl AddItemTrait for Foo {
type TypeName = (); type TypeName = ();
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
pub trait AddItemTrait { pub trait AddItemTrait {
type TypeName; type TypeName;
fn method_name(); fn method_name();
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")] #[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl AddItemTrait for Foo { impl AddItemTrait for Foo {
type TypeName = (); type TypeName = ();
fn method_name() { } fn method_name() { }
@ -259,28 +318,34 @@ impl AddItemTrait for Foo {
// Change has-value ----------------------------------------------------------- // Change has-value -----------------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub trait ChangeHasValueTrait { pub trait ChangeHasValueTrait {
fn method_name(); fn method_name();
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl ChangeHasValueTrait for Foo { impl ChangeHasValueTrait for Foo {
fn method_name() { } fn method_name() { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner", cfg="cfail2")] #[rustc_clean(except="hir_owner", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub trait ChangeHasValueTrait { pub trait ChangeHasValueTrait {
#[rustc_clean(except="hir_owner,associated_item", cfg="cfail2")] #[rustc_clean(except="hir_owner,associated_item", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,associated_item", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
fn method_name() { } fn method_name() { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl ChangeHasValueTrait for Foo { impl ChangeHasValueTrait for Foo {
fn method_name() { } fn method_name() { }
} }
@ -291,69 +356,91 @@ pub trait AddDefaultTrait {
fn method_name(); fn method_name();
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl AddDefaultTrait for Foo { impl AddDefaultTrait for Foo {
fn method_name() { } // -------------------------------------------------------------------------------------------
// -------------------------
fn method_name() { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner", cfg="cfail2")] #[rustc_clean(except="hir_owner", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl AddDefaultTrait for Foo { impl AddDefaultTrait for Foo {
#[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
default fn method_name() { } default fn method_name() { }
} }
// Add arguments // Add arguments
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub trait AddArgumentTrait { pub trait AddArgumentTrait {
fn method_name(&self); fn method_name(&self);
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl AddArgumentTrait for Foo { impl AddArgumentTrait for Foo {
fn method_name(&self) { } // -----------------------------------------------------------------------------------------
// -------------------------
// -----------------------------------------------------------------------------------------
// -------------------------
fn method_name(&self ) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
pub trait AddArgumentTrait { pub trait AddArgumentTrait {
fn method_name(&self, x: u32); fn method_name(&self, x: u32);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl AddArgumentTrait for Foo { impl AddArgumentTrait for Foo {
#[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
fn method_name(&self, _x: u32) { } fn method_name(&self, _x: u32) { }
} }
// Change argument type // Change argument type
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub trait ChangeArgumentTypeTrait { pub trait ChangeArgumentTypeTrait {
fn method_name(&self, x: u32); fn method_name(&self, x: u32);
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl ChangeArgumentTypeTrait for Foo { impl ChangeArgumentTypeTrait for Foo {
fn method_name(&self, _x: u32) { } // -----------------------------------------------------------------------------------------
// -------------------------
// -----------------------------------------------------------------------------------------
// -------------------------
fn method_name(&self, _x: u32 ) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
pub trait ChangeArgumentTypeTrait { pub trait ChangeArgumentTypeTrait {
fn method_name(&self, x: char); fn method_name(&self, x: char);
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl ChangeArgumentTypeTrait for Foo { impl ChangeArgumentTypeTrait for Foo {
#[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
fn method_name(&self, _x: char) { } fn method_name(&self, _x: char) { }
} }
@ -366,21 +453,28 @@ trait AddTypeParameterToImpl<T> {
fn id(t: T) -> T; fn id(t: T) -> T;
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl AddTypeParameterToImpl<u32> for Bar<u32> { impl AddTypeParameterToImpl<u32> for Bar<u32> {
fn id(t: u32) -> u32 { t } fn id(t: u32) -> u32 { t }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,generics_of,impl_trait_ref", cfg="cfail2")] #[rustc_clean(except="hir_owner,generics_of,impl_trait_ref", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
impl<T> AddTypeParameterToImpl<T> for Bar<T> { #[rustc_clean(except="hir_owner,generics_of,impl_trait_ref", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl<TTT> AddTypeParameterToImpl<TTT> for Bar<TTT> {
#[rustc_clean( #[rustc_clean(
except="hir_owner,hir_owner_nodes,generics_of,fn_sig,type_of,typeck,optimized_mir", except="hir_owner,hir_owner_nodes,generics_of,fn_sig,type_of,typeck,optimized_mir",
cfg="cfail2", cfg="cfail2",
)] )]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
fn id(t: T) -> T { t } #[rustc_clean(
except="hir_owner,hir_owner_nodes,generics_of,fn_sig,type_of,typeck,optimized_mir",
cfg="cfail5",
)]
#[rustc_clean(cfg="cfail6")]
fn id(t: TTT) -> TTT { t }
} }
@ -390,17 +484,21 @@ trait ChangeSelfTypeOfImpl {
fn id(self) -> Self; fn id(self) -> Self;
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl ChangeSelfTypeOfImpl for u32 { impl ChangeSelfTypeOfImpl for u32 {
fn id(self) -> Self { self } fn id(self) -> Self { self }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,impl_trait_ref", cfg="cfail2")] #[rustc_clean(except="hir_owner,impl_trait_ref", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,impl_trait_ref", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl ChangeSelfTypeOfImpl for u64 { impl ChangeSelfTypeOfImpl for u64 {
#[rustc_clean(except="fn_sig,typeck,optimized_mir", cfg="cfail2")] #[rustc_clean(except="fn_sig,typeck,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="fn_sig,typeck,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
fn id(self) -> Self { self } fn id(self) -> Self { self }
} }
@ -411,17 +509,21 @@ trait AddLifetimeBoundToImplParameter {
fn id(self) -> Self; fn id(self) -> Self;
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl<T> AddLifetimeBoundToImplParameter for T { impl<T> AddLifetimeBoundToImplParameter for T {
fn id(self) -> Self { self } fn id(self) -> Self { self }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl<T: 'static> AddLifetimeBoundToImplParameter for T { impl<T: 'static> AddLifetimeBoundToImplParameter for T {
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
fn id(self) -> Self { self } fn id(self) -> Self { self }
} }
@ -432,17 +534,21 @@ trait AddTraitBoundToImplParameter {
fn id(self) -> Self; fn id(self) -> Self;
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl<T> AddTraitBoundToImplParameter for T { impl<T> AddTraitBoundToImplParameter for T {
fn id(self) -> Self { self } fn id(self) -> Self { self }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")] #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl<T: Clone> AddTraitBoundToImplParameter for T { impl<T: Clone> AddTraitBoundToImplParameter for T {
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
fn id(self) -> Self { self } fn id(self) -> Self { self }
} }
@ -453,17 +559,26 @@ trait AddNoMangleToMethod {
fn add_no_mangle_to_method(&self) { } fn add_no_mangle_to_method(&self) { }
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl AddNoMangleToMethod for Foo { impl AddNoMangleToMethod for Foo {
// -------------------------
// -------------------------
// -------------------------
// -------------------------
// ---------
fn add_no_mangle_to_method(&self) { } fn add_no_mangle_to_method(&self) { }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl AddNoMangleToMethod for Foo { impl AddNoMangleToMethod for Foo {
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
#[no_mangle] #[no_mangle]
fn add_no_mangle_to_method(&self) { } fn add_no_mangle_to_method(&self) { }
} }
@ -474,17 +589,26 @@ trait MakeMethodInline {
fn make_method_inline(&self) -> u8 { 0 } fn make_method_inline(&self) -> u8 { 0 }
} }
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
impl MakeMethodInline for Foo { impl MakeMethodInline for Foo {
// -------------------------
// -------------------------
// -------------------------
// -------------------------
// ------
fn make_method_inline(&self) -> u8 { 0 } fn make_method_inline(&self) -> u8 { 0 }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
impl MakeMethodInline for Foo { impl MakeMethodInline for Foo {
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
#[inline] #[inline]
fn make_method_inline(&self) -> u8 { 0 } fn make_method_inline(&self) -> u8 { 0 }
} }

View file

@ -12,7 +12,7 @@
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]

View file

@ -6,8 +6,14 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
@ -15,44 +21,50 @@
// Change constant operand of negation ----------------------------------------- // Change constant operand of negation -----------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn const_negation() -> i32 { pub fn const_negation() -> i32 {
-10 -10
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn const_negation() -> i32 { pub fn const_negation() -> i32 {
-1 -1
} }
// Change constant operand of bitwise not -------------------------------------- // Change constant operand of bitwise not --------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn const_bitwise_not() -> i32 { pub fn const_bitwise_not() -> i32 {
!100 !100
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn const_bitwise_not() -> i32 { pub fn const_bitwise_not() -> i32 {
!99 !99
} }
// Change variable operand of negation ----------------------------------------- // Change variable operand of negation -----------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn var_negation(x: i32, y: i32) -> i32 { pub fn var_negation(x: i32, y: i32) -> i32 {
-x -x
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn var_negation(x: i32, y: i32) -> i32 { pub fn var_negation(x: i32, y: i32) -> i32 {
-y -y
} }
@ -60,14 +72,16 @@ pub fn var_negation(x: i32, y: i32) -> i32 {
// Change variable operand of bitwise not -------------------------------------- // Change variable operand of bitwise not --------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn var_bitwise_not(x: i32, y: i32) -> i32 { pub fn var_bitwise_not(x: i32, y: i32) -> i32 {
!x !x
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn var_bitwise_not(x: i32, y: i32) -> i32 { pub fn var_bitwise_not(x: i32, y: i32) -> i32 {
!y !y
} }
@ -75,14 +89,16 @@ pub fn var_bitwise_not(x: i32, y: i32) -> i32 {
// Change variable operand of deref -------------------------------------------- // Change variable operand of deref --------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn var_deref(x: &i32, y: &i32) -> i32 { pub fn var_deref(x: &i32, y: &i32) -> i32 {
*x *x
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn var_deref(x: &i32, y: &i32) -> i32 { pub fn var_deref(x: &i32, y: &i32) -> i32 {
*y *y
} }
@ -90,14 +106,16 @@ pub fn var_deref(x: &i32, y: &i32) -> i32 {
// Change first constant operand of addition ----------------------------------- // Change first constant operand of addition -----------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn first_const_add() -> i32 { pub fn first_const_add() -> i32 {
1 + 3 1 + 3
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn first_const_add() -> i32 { pub fn first_const_add() -> i32 {
2 + 3 2 + 3
} }
@ -105,14 +123,16 @@ pub fn first_const_add() -> i32 {
// Change second constant operand of addition ----------------------------------- // Change second constant operand of addition -----------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn second_const_add() -> i32 { pub fn second_const_add() -> i32 {
1 + 2 1 + 2
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn second_const_add() -> i32 { pub fn second_const_add() -> i32 {
1 + 3 1 + 3
} }
@ -120,14 +140,16 @@ pub fn second_const_add() -> i32 {
// Change first variable operand of addition ----------------------------------- // Change first variable operand of addition -----------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn first_var_add(a: i32, b: i32) -> i32 { pub fn first_var_add(a: i32, b: i32) -> i32 {
a + 2 a + 2
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn first_var_add(a: i32, b: i32) -> i32 { pub fn first_var_add(a: i32, b: i32) -> i32 {
b + 2 b + 2
} }
@ -135,14 +157,16 @@ pub fn first_var_add(a: i32, b: i32) -> i32 {
// Change second variable operand of addition ---------------------------------- // Change second variable operand of addition ----------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn second_var_add(a: i32, b: i32) -> i32 { pub fn second_var_add(a: i32, b: i32) -> i32 {
1 + a 1 + a
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn second_var_add(a: i32, b: i32) -> i32 { pub fn second_var_add(a: i32, b: i32) -> i32 {
1 + b 1 + b
} }
@ -150,14 +174,16 @@ pub fn second_var_add(a: i32, b: i32) -> i32 {
// Change operator from + to - ------------------------------------------------- // Change operator from + to - -------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn plus_to_minus(a: i32) -> i32 { pub fn plus_to_minus(a: i32) -> i32 {
1 + a 1 + a
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn plus_to_minus(a: i32) -> i32 { pub fn plus_to_minus(a: i32) -> i32 {
1 - a 1 - a
} }
@ -165,14 +191,16 @@ pub fn plus_to_minus(a: i32) -> i32 {
// Change operator from + to * ------------------------------------------------- // Change operator from + to * -------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn plus_to_mult(a: i32) -> i32 { pub fn plus_to_mult(a: i32) -> i32 {
1 + a 1 + a
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn plus_to_mult(a: i32) -> i32 { pub fn plus_to_mult(a: i32) -> i32 {
1 * a 1 * a
} }
@ -180,14 +208,16 @@ pub fn plus_to_mult(a: i32) -> i32 {
// Change operator from + to / ------------------------------------------------- // Change operator from + to / -------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn plus_to_div(a: i32) -> i32 { pub fn plus_to_div(a: i32) -> i32 {
1 + a 1 + a
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn plus_to_div(a: i32) -> i32 { pub fn plus_to_div(a: i32) -> i32 {
1 / a 1 / a
} }
@ -195,14 +225,16 @@ pub fn plus_to_div(a: i32) -> i32 {
// Change operator from + to % ------------------------------------------------- // Change operator from + to % -------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn plus_to_mod(a: i32) -> i32 { pub fn plus_to_mod(a: i32) -> i32 {
1 + a 1 + a
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn plus_to_mod(a: i32) -> i32 { pub fn plus_to_mod(a: i32) -> i32 {
1 % a 1 % a
} }
@ -210,14 +242,16 @@ pub fn plus_to_mod(a: i32) -> i32 {
// Change operator from && to || ----------------------------------------------- // Change operator from && to || -----------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn and_to_or(a: bool, b: bool) -> bool { pub fn and_to_or(a: bool, b: bool) -> bool {
a && b a && b
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn and_to_or(a: bool, b: bool) -> bool { pub fn and_to_or(a: bool, b: bool) -> bool {
a || b a || b
} }
@ -225,14 +259,16 @@ pub fn and_to_or(a: bool, b: bool) -> bool {
// Change operator from & to | ------------------------------------------------- // Change operator from & to | -------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn bitwise_and_to_bitwise_or(a: i32) -> i32 { pub fn bitwise_and_to_bitwise_or(a: i32) -> i32 {
1 & a 1 & a
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn bitwise_and_to_bitwise_or(a: i32) -> i32 { pub fn bitwise_and_to_bitwise_or(a: i32) -> i32 {
1 | a 1 | a
} }
@ -240,14 +276,16 @@ pub fn bitwise_and_to_bitwise_or(a: i32) -> i32 {
// Change operator from & to ^ ------------------------------------------------- // Change operator from & to ^ -------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn bitwise_and_to_bitwise_xor(a: i32) -> i32 { pub fn bitwise_and_to_bitwise_xor(a: i32) -> i32 {
1 & a 1 & a
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn bitwise_and_to_bitwise_xor(a: i32) -> i32 { pub fn bitwise_and_to_bitwise_xor(a: i32) -> i32 {
1 ^ a 1 ^ a
} }
@ -255,14 +293,16 @@ pub fn bitwise_and_to_bitwise_xor(a: i32) -> i32 {
// Change operator from & to << ------------------------------------------------ // Change operator from & to << ------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn bitwise_and_to_lshift(a: i32) -> i32 { pub fn bitwise_and_to_lshift(a: i32) -> i32 {
a & 1 a & 1
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn bitwise_and_to_lshift(a: i32) -> i32 { pub fn bitwise_and_to_lshift(a: i32) -> i32 {
a << 1 a << 1
} }
@ -270,14 +310,16 @@ pub fn bitwise_and_to_lshift(a: i32) -> i32 {
// Change operator from & to >> ------------------------------------------------ // Change operator from & to >> ------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn bitwise_and_to_rshift(a: i32) -> i32 { pub fn bitwise_and_to_rshift(a: i32) -> i32 {
a & 1 a & 1
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn bitwise_and_to_rshift(a: i32) -> i32 { pub fn bitwise_and_to_rshift(a: i32) -> i32 {
a >> 1 a >> 1
} }
@ -285,14 +327,16 @@ pub fn bitwise_and_to_rshift(a: i32) -> i32 {
// Change operator from == to != ----------------------------------------------- // Change operator from == to != -----------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn eq_to_uneq(a: i32) -> bool { pub fn eq_to_uneq(a: i32) -> bool {
a == 1 a == 1
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn eq_to_uneq(a: i32) -> bool { pub fn eq_to_uneq(a: i32) -> bool {
a != 1 a != 1
} }
@ -300,44 +344,50 @@ pub fn eq_to_uneq(a: i32) -> bool {
// Change operator from == to < ------------------------------------------------ // Change operator from == to < ------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn eq_to_lt(a: i32) -> bool { pub fn eq_to_lt(a: i32) -> bool {
a == 1 a == 1
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn eq_to_lt(a: i32) -> bool { pub fn eq_to_lt(a: i32) -> bool {
a < 1 a < 1
} }
// Change operator from == to > ------------------------------------------------ // Change operator from == to > ------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn eq_to_gt(a: i32) -> bool { pub fn eq_to_gt(a: i32) -> bool {
a == 1 a == 1
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn eq_to_gt(a: i32) -> bool { pub fn eq_to_gt(a: i32) -> bool {
a > 1 a > 1
} }
// Change operator from == to <= ----------------------------------------------- // Change operator from == to <= -----------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn eq_to_le(a: i32) -> bool { pub fn eq_to_le(a: i32) -> bool {
a == 1 a == 1
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn eq_to_le(a: i32) -> bool { pub fn eq_to_le(a: i32) -> bool {
a <= 1 a <= 1
} }
@ -345,14 +395,16 @@ pub fn eq_to_le(a: i32) -> bool {
// Change operator from == to >= ----------------------------------------------- // Change operator from == to >= -----------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn eq_to_ge(a: i32) -> bool { pub fn eq_to_ge(a: i32) -> bool {
a == 1 a == 1
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn eq_to_ge(a: i32) -> bool { pub fn eq_to_ge(a: i32) -> bool {
a >= 1 a >= 1
} }
@ -360,16 +412,18 @@ pub fn eq_to_ge(a: i32) -> bool {
// Change type in cast expression ---------------------------------------------- // Change type in cast expression ----------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn type_cast(a: u8) -> u64 { pub fn type_cast(a: u8) -> u64 {
let b = a as i32; let b = a as i32;
let c = b as u64; let c = b as u64;
c c
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir,typeck", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir,typeck", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir,typeck", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn type_cast(a: u8) -> u64 { pub fn type_cast(a: u8) -> u64 {
let b = a as u32; let b = a as u32;
let c = b as u64; let c = b as u64;
@ -379,14 +433,16 @@ pub fn type_cast(a: u8) -> u64 {
// Change value in cast expression --------------------------------------------- // Change value in cast expression ---------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn value_cast(a: u32) -> i32 { pub fn value_cast(a: u32) -> i32 {
1 as i32 1 as i32
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn value_cast(a: u32) -> i32 { pub fn value_cast(a: u32) -> i32 {
2 as i32 2 as i32
} }
@ -394,7 +450,7 @@ pub fn value_cast(a: u32) -> i32 {
// Change place in assignment -------------------------------------------------- // Change place in assignment --------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn place() -> i32 { pub fn place() -> i32 {
let mut x = 10; let mut x = 10;
let mut y = 11; let mut y = 11;
@ -402,9 +458,11 @@ pub fn place() -> i32 {
x x
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn place() -> i32 { pub fn place() -> i32 {
let mut x = 10; let mut x = 10;
let mut y = 11; let mut y = 11;
@ -415,16 +473,18 @@ pub fn place() -> i32 {
// Change r-value in assignment ------------------------------------------------ // Change r-value in assignment ------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn rvalue() -> i32 { pub fn rvalue() -> i32 {
let mut x = 10; let mut x = 10;
x = 9; x = 9;
x x
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn rvalue() -> i32 { pub fn rvalue() -> i32 {
let mut x = 10; let mut x = 10;
x = 8; x = 8;
@ -434,14 +494,16 @@ pub fn rvalue() -> i32 {
// Change index into slice ----------------------------------------------------- // Change index into slice -----------------------------------------------------
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn index_to_slice(s: &[u8], i: usize, j: usize) -> u8 { pub fn index_to_slice(s: &[u8], i: usize, j: usize) -> u8 {
s[i] s[i]
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")] #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
pub fn index_to_slice(s: &[u8], i: usize, j: usize) -> u8 { pub fn index_to_slice(s: &[u8], i: usize, j: usize) -> u8 {
s[j] s[j]
} }

View file

@ -6,8 +6,14 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
@ -15,7 +21,7 @@
// Change loop body // Change loop body
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_loop_body() { pub fn change_loop_body() {
let mut _x = 0; let mut _x = 0;
while let Some(0u32) = None { while let Some(0u32) = None {
@ -24,9 +30,11 @@ pub fn change_loop_body() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
pub fn change_loop_body() { pub fn change_loop_body() {
let mut _x = 0; let mut _x = 0;
while let Some(0u32) = None { while let Some(0u32) = None {
@ -38,7 +46,7 @@ pub fn change_loop_body() {
// Change loop body // Change loop body
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_loop_condition() { pub fn change_loop_condition() {
let mut _x = 0; let mut _x = 0;
while let Some(0u32) = None { while let Some(0u32) = None {
@ -47,9 +55,11 @@ pub fn change_loop_condition() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
pub fn change_loop_condition() { pub fn change_loop_condition() {
let mut _x = 0; let mut _x = 0;
while let Some(1u32) = None { while let Some(1u32) = None {
@ -61,17 +71,20 @@ pub fn change_loop_condition() {
// Add break // Add break
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_break() { pub fn add_break() {
let mut _x = 0; let mut _x = 0;
while let Some(0u32) = None { while let Some(0u32) = None {
_x = 1; _x = 1;
// ---
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn add_break() { pub fn add_break() {
let mut _x = 0; let mut _x = 0;
while let Some(0u32) = None { while let Some(0u32) = None {
@ -83,18 +96,20 @@ pub fn add_break() {
// Add loop label // Add loop label
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_loop_label() { pub fn add_loop_label() {
let mut _x = 0; let mut _x = 0;
while let Some(0u32) = None { while let Some(0u32) = None {
_x = 1; _x = 1;
break; break;
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label() { pub fn add_loop_label() {
let mut _x = 0; let mut _x = 0;
'label: while let Some(0u32) = None { 'label: while let Some(0u32) = None {
@ -106,18 +121,20 @@ pub fn add_loop_label() {
// Add loop label to break // Add loop label to break
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_loop_label_to_break() { pub fn add_loop_label_to_break() {
let mut _x = 0; let mut _x = 0;
'label: while let Some(0u32) = None { 'label: while let Some(0u32) = None {
_x = 1; _x = 1;
break; break ;
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label_to_break() { pub fn add_loop_label_to_break() {
let mut _x = 0; let mut _x = 0;
'label: while let Some(0u32) = None { 'label: while let Some(0u32) = None {
@ -129,7 +146,7 @@ pub fn add_loop_label_to_break() {
// Change break label // Change break label
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_break_label() { pub fn change_break_label() {
let mut _x = 0; let mut _x = 0;
'outer: while let Some(0u32) = None { 'outer: while let Some(0u32) = None {
@ -140,9 +157,11 @@ pub fn change_break_label() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_break_label() { pub fn change_break_label() {
let mut _x = 0; let mut _x = 0;
'outer: while let Some(0u32) = None { 'outer: while let Some(0u32) = None {
@ -154,18 +173,20 @@ pub fn change_break_label() {
} }
// Add loop label to continue // Add loop label to continue
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_loop_label_to_continue() { pub fn add_loop_label_to_continue() {
let mut _x = 0; let mut _x = 0;
'label: while let Some(0u32) = None { 'label: while let Some(0u32) = None {
_x = 1; _x = 1;
continue; continue ;
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label_to_continue() { pub fn add_loop_label_to_continue() {
let mut _x = 0; let mut _x = 0;
'label: while let Some(0u32) = None { 'label: while let Some(0u32) = None {
@ -177,7 +198,7 @@ pub fn add_loop_label_to_continue() {
// Change continue label // Change continue label
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_continue_label() { pub fn change_continue_label() {
let mut _x = 0; let mut _x = 0;
'outer: while let Some(0u32) = None { 'outer: while let Some(0u32) = None {
@ -188,9 +209,11 @@ pub fn change_continue_label() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_continue_label() { pub fn change_continue_label() {
let mut _x = 0; let mut _x = 0;
'outer: while let Some(0u32) = None { 'outer: while let Some(0u32) = None {
@ -204,7 +227,7 @@ pub fn change_continue_label() {
// Change continue to break // Change continue to break
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_continue_to_break() { pub fn change_continue_to_break() {
let mut _x = 0; let mut _x = 0;
while let Some(0u32) = None { while let Some(0u32) = None {
@ -213,13 +236,15 @@ pub fn change_continue_to_break() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
pub fn change_continue_to_break() { pub fn change_continue_to_break() {
let mut _x = 0; let mut _x = 0;
while let Some(0u32) = None { while let Some(0u32) = None {
_x = 1; _x = 1;
break; break ;
} }
} }

View file

@ -6,8 +6,14 @@
// rev3 and make sure that the hash has not changed. // rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans // compile-flags: -Z query-dep-graph
// [cfail1]compile-flags: -Zincremental-ignore-spans
// [cfail2]compile-flags: -Zincremental-ignore-spans
// [cfail3]compile-flags: -Zincremental-ignore-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
#![allow(warnings)] #![allow(warnings)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
@ -15,7 +21,7 @@
// Change loop body // Change loop body
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_loop_body() { pub fn change_loop_body() {
let mut _x = 0; let mut _x = 0;
while true { while true {
@ -24,9 +30,11 @@ pub fn change_loop_body() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_loop_body() { pub fn change_loop_body() {
let mut _x = 0; let mut _x = 0;
while true { while true {
@ -38,18 +46,20 @@ pub fn change_loop_body() {
// Change loop body // Change loop body
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_loop_condition() { pub fn change_loop_condition() {
let mut _x = 0; let mut _x = 0;
while true { while true {
_x = 1; _x = 1;
break; break;
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_loop_condition() { pub fn change_loop_condition() {
let mut _x = 0; let mut _x = 0;
while false { while false {
@ -61,17 +71,20 @@ pub fn change_loop_condition() {
// Add break // Add break
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_break() { pub fn add_break() {
let mut _x = 0; let mut _x = 0;
while true { while true {
_x = 1; _x = 1;
// ---
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn add_break() { pub fn add_break() {
let mut _x = 0; let mut _x = 0;
while true { while true {
@ -83,18 +96,20 @@ pub fn add_break() {
// Add loop label // Add loop label
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_loop_label() { pub fn add_loop_label() {
let mut _x = 0; let mut _x = 0;
while true { while true {
_x = 1; _x = 1;
break; break;
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label() { pub fn add_loop_label() {
let mut _x = 0; let mut _x = 0;
'label: while true { 'label: while true {
@ -106,18 +121,20 @@ pub fn add_loop_label() {
// Add loop label to break // Add loop label to break
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_loop_label_to_break() { pub fn add_loop_label_to_break() {
let mut _x = 0; let mut _x = 0;
'label: while true { 'label: while true {
_x = 1; _x = 1;
break; break ;
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label_to_break() { pub fn add_loop_label_to_break() {
let mut _x = 0; let mut _x = 0;
'label: while true { 'label: while true {
@ -129,7 +146,7 @@ pub fn add_loop_label_to_break() {
// Change break label // Change break label
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_break_label() { pub fn change_break_label() {
let mut _x = 0; let mut _x = 0;
'outer: while true { 'outer: while true {
@ -140,9 +157,11 @@ pub fn change_break_label() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail6")]
pub fn change_break_label() { pub fn change_break_label() {
let mut _x = 0; let mut _x = 0;
'outer: while true { 'outer: while true {
@ -156,18 +175,20 @@ pub fn change_break_label() {
// Add loop label to continue // Add loop label to continue
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn add_loop_label_to_continue() { pub fn add_loop_label_to_continue() {
let mut _x = 0; let mut _x = 0;
'label: while true { 'label: while true {
_x = 1; _x = 1;
continue; continue ;
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label_to_continue() { pub fn add_loop_label_to_continue() {
let mut _x = 0; let mut _x = 0;
'label: while true { 'label: while true {
@ -179,7 +200,7 @@ pub fn add_loop_label_to_continue() {
// Change continue label // Change continue label
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_continue_label() { pub fn change_continue_label() {
let mut _x = 0; let mut _x = 0;
'outer: while true { 'outer: while true {
@ -190,9 +211,11 @@ pub fn change_continue_label() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_continue_label() { pub fn change_continue_label() {
let mut _x = 0; let mut _x = 0;
'outer: while true { 'outer: while true {
@ -206,7 +229,7 @@ pub fn change_continue_label() {
// Change continue to break // Change continue to break
#[cfg(cfail1)] #[cfg(any(cfail1,cfail4))]
pub fn change_continue_to_break() { pub fn change_continue_to_break() {
let mut _x = 0; let mut _x = 0;
while true { while true {
@ -215,13 +238,15 @@ pub fn change_continue_to_break() {
} }
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail6")]
pub fn change_continue_to_break() { pub fn change_continue_to_break() {
let mut _x = 0; let mut _x = 0;
while true { while true {
_x = 1; _x = 1;
break; break ;
} }
} }

View file

@ -1,16 +1,21 @@
// This test makes sure that just changing a definition's location in the // This test makes sure that just changing a definition's location in the
// source file also changes its incr. comp. hash, if debuginfo is enabled. // source file also changes its incr. comp. hash, if debuginfo is enabled.
// revisions:rpass1 rpass2 // revisions:rpass1 rpass2 rpass3 rpass4
// ignore-asmjs wasm2js does not support source maps yet // ignore-asmjs wasm2js does not support source maps yet
// compile-flags: -g -Z query-dep-graph // compile-flags: -g -Z query-dep-graph
// [rpass3]compile-flags: -Zincremental-relative-spans
// [rpass4]compile-flags: -Zincremental-relative-spans
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![rustc_partition_codegened(module = "spans_significant_w_debuginfo", cfg = "rpass2")]
#![rustc_partition_codegened(module = "spans_significant_w_debuginfo", cfg = "rpass4")]
#[cfg(rpass1)] #[cfg(any(rpass1, rpass3))]
pub fn main() {} pub fn main() {}
#[cfg(rpass2)] #[cfg(any(rpass2, rpass4))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,optimized_mir", cfg="rpass2")] #[rustc_clean(except = "hir_owner,hir_owner_nodes,optimized_mir", cfg = "rpass2")]
#[rustc_clean(cfg = "rpass4")]
pub fn main() {} pub fn main() {}

View file

@ -1,19 +1,29 @@
// This test makes sure that just changing a definition's location in the // This test makes sure that just changing a definition's location in the
// source file also changes its incr. comp. hash, if debuginfo is enabled. // source file also changes its incr. comp. hash, if debuginfo is enabled.
// revisions:rpass1 rpass2 // revisions:rpass1 rpass2 rpass3 rpass4
// [rpass3]compile-flags: -Zincremental-relative-spans
// [rpass4]compile-flags: -Zincremental-relative-spans
// compile-flags: -C overflow-checks=on -Z query-dep-graph // compile-flags: -C overflow-checks=on -Z query-dep-graph
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![feature(bench_black_box)]
#![rustc_partition_codegened(module = "spans_significant_w_panic", cfg = "rpass2")]
#![rustc_partition_codegened(module = "spans_significant_w_panic", cfg = "rpass4")]
#[cfg(rpass1)] #[cfg(any(rpass1, rpass3))]
pub fn main() { pub fn main() {
let _ = 0u8 + 1; if std::hint::black_box(false) {
panic!()
}
} }
#[cfg(rpass2)] #[cfg(any(rpass2, rpass4))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,optimized_mir", cfg="rpass2")] #[rustc_clean(except = "hir_owner,hir_owner_nodes,optimized_mir", cfg = "rpass2")]
#[rustc_clean(cfg = "rpass4")]
pub fn main() { pub fn main() {
let _ = 0u8 + 1; if std::hint::black_box(false) {
panic!()
}
} }

View file

@ -1,5 +1,7 @@
// revisions: cfail1 cfail2 // revisions: cfail1 cfail2 cfail3 cfail4
// compile-flags: -Z query-dep-graph // compile-flags: -Z query-dep-graph
// [cfail3]compile-flags: -Zincremental-relative-spans
// [cfail4]compile-flags: -Zincremental-relative-spans
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
#![allow(warnings)] #![allow(warnings)]
@ -10,15 +12,15 @@
// Therefore, the compiler deduces (correctly) that typeck is not // Therefore, the compiler deduces (correctly) that typeck is not
// needed even for callers of `x`. // needed even for callers of `x`.
pub mod x { pub mod x {
#[cfg(cfail1)] #[cfg(any(cfail1, cfail3))]
pub fn x() { pub fn x() {
println!("{}", "1"); println!("{}", "1");
} }
#[cfg(cfail2)] #[cfg(any(cfail2, cfail4))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,optimized_mir,promoted_mir", cfg="cfail2")] #[rustc_clean(except = "hir_owner,hir_owner_nodes,optimized_mir,promoted_mir", cfg = "cfail2")]
#[rustc_clean(except = "hir_owner_nodes,promoted_mir", cfg = "cfail4")]
pub fn x() { pub fn x() {
println!("{}", "2"); println!("{}", "2");
} }
@ -27,7 +29,8 @@ pub mod x {
pub mod y { pub mod y {
use x; use x;
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail4")]
pub fn y() { pub fn y() {
x::x(); x::x();
} }
@ -36,7 +39,8 @@ pub mod y {
pub mod z { pub mod z {
use y; use y;
#[rustc_clean(cfg="cfail2")] #[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail4")]
pub fn z() { pub fn z() {
y::y(); y::y();
} }

View file

@ -3,36 +3,61 @@
// ends up with any spans in its LLVM bitecode, so LLVM is able to skip // ends up with any spans in its LLVM bitecode, so LLVM is able to skip
// re-building any modules which import 'inlined_fn' // re-building any modules which import 'inlined_fn'
// revisions: cfail1 cfail2 cfail3 // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
// [cfail4]compile-flags: -Zincremental-relative-spans
// [cfail5]compile-flags: -Zincremental-relative-spans
// [cfail6]compile-flags: -Zincremental-relative-spans
// compile-flags: -Z query-dep-graph -O // compile-flags: -Z query-dep-graph -O
// build-pass (FIXME(62277): could be check-pass?) // build-pass (FIXME(62277): could be check-pass?)
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![crate_type="rlib"] #![crate_type = "rlib"]
#![rustc_expected_cgu_reuse(module = "cgu_keeps_identical_fn-foo", cfg = "cfail2", kind = "no")]
#![rustc_expected_cgu_reuse(module="cgu_keeps_identical_fn-foo", #![rustc_expected_cgu_reuse(
cfg="cfail2", module = "cgu_keeps_identical_fn-foo",
kind="no")] cfg = "cfail3",
#![rustc_expected_cgu_reuse(module="cgu_keeps_identical_fn-foo", kind = "post-lto"
cfg="cfail3", )]
kind="post-lto")] #![rustc_expected_cgu_reuse(
module = "cgu_keeps_identical_fn-foo",
#![rustc_expected_cgu_reuse(module="cgu_keeps_identical_fn-bar", cfg = "cfail5",
cfg="cfail2", kind = "post-lto"
kind="post-lto")] )]
#![rustc_expected_cgu_reuse(module="cgu_keeps_identical_fn-bar", #![rustc_expected_cgu_reuse(
cfg="cfail3", module = "cgu_keeps_identical_fn-foo",
kind="post-lto")] cfg = "cfail6",
kind = "post-lto"
)]
#![rustc_expected_cgu_reuse(
module = "cgu_keeps_identical_fn-bar",
cfg = "cfail2",
kind = "post-lto"
)]
#![rustc_expected_cgu_reuse(
module = "cgu_keeps_identical_fn-bar",
cfg = "cfail3",
kind = "post-lto"
)]
#![rustc_expected_cgu_reuse(
module = "cgu_keeps_identical_fn-bar",
cfg = "cfail5",
kind = "post-lto"
)]
#![rustc_expected_cgu_reuse(
module = "cgu_keeps_identical_fn-bar",
cfg = "cfail6",
kind = "post-lto"
)]
mod foo { mod foo {
// Trivial functions like this one are imported very reliably by ThinLTO. // Trivial functions like this one are imported very reliably by ThinLTO.
#[cfg(cfail1)] #[cfg(any(cfail1, cfail4))]
pub fn inlined_fn() -> u32 { pub fn inlined_fn() -> u32 {
1234 1234
} }
#[cfg(not(cfail1))] #[cfg(not(any(cfail1, cfail4)))]
pub fn inlined_fn() -> u32 { pub fn inlined_fn() -> u32 {
1234 1234
} }

View file

@ -527,8 +527,8 @@ fn check_empty_line_after_outer_attr(cx: &EarlyContext<'_>, item: &rustc_ast::It
return; return;
} }
let begin_of_attr_to_item = Span::new(attr.span.lo(), item.span.lo(), item.span.ctxt()); let begin_of_attr_to_item = Span::new(attr.span.lo(), item.span.lo(), item.span.ctxt(), item.span.parent());
let end_of_attr_to_item = Span::new(attr.span.hi(), item.span.lo(), item.span.ctxt()); let end_of_attr_to_item = Span::new(attr.span.hi(), item.span.lo(), item.span.ctxt(), item.span.parent());
if let Some(snippet) = snippet_opt(cx, end_of_attr_to_item) { if let Some(snippet) = snippet_opt(cx, end_of_attr_to_item) {
let lines = snippet.split('\n').collect::<Vec<_>>(); let lines = snippet.split('\n').collect::<Vec<_>>();

View file

@ -95,7 +95,7 @@ impl CognitiveComplexity {
}); });
if let Some((low, high)) = pos { if let Some((low, high)) = pos {
Span::new(low, high, header_span.ctxt()) Span::new(low, high, header_span.ctxt(), header_span.parent())
} else { } else {
return; return;
} }

View file

@ -472,7 +472,7 @@ fn emit_branches_sharing_code_lint(
let mut span = moved_start.to(span_end); let mut span = moved_start.to(span_end);
// Improve formatting if the inner block has indention (i.e. normal Rust formatting) // Improve formatting if the inner block has indention (i.e. normal Rust formatting)
let test_span = Span::new(span.lo() - BytePos(4), span.lo(), span.ctxt()); let test_span = Span::new(span.lo() - BytePos(4), span.lo(), span.ctxt(), span.parent());
if snippet_opt(cx, test_span) if snippet_opt(cx, test_span)
.map(|snip| snip == " ") .map(|snip| snip == " ")
.unwrap_or_default() .unwrap_or_default()

View file

@ -665,6 +665,7 @@ fn check_text(cx: &LateContext<'_>, valid_idents: &FxHashSet<String>, text: &str
span.lo() + BytePos::from_usize(offset), span.lo() + BytePos::from_usize(offset),
span.lo() + BytePos::from_usize(offset + word.len()), span.lo() + BytePos::from_usize(offset + word.len()),
span.ctxt(), span.ctxt(),
span.parent(),
); );
check_word(cx, word, span); check_word(cx, word, span);

View file

@ -130,7 +130,7 @@ impl<'tcx> LateLintPass<'tcx> for ImplicitHasher {
let pos = snippet_opt(cx, item.span.until(target.span())) let pos = snippet_opt(cx, item.span.until(target.span()))
.and_then(|snip| Some(item.span.lo() + BytePos(snip.find("impl")? as u32 + 4))); .and_then(|snip| Some(item.span.lo() + BytePos(snip.find("impl")? as u32 + 4)));
if let Some(pos) = pos { if let Some(pos) = pos {
Span::new(pos, pos, item.span.data().ctxt) Span::new(pos, pos, item.span.ctxt(), item.span.parent())
} else { } else {
return; return;
} }
@ -173,7 +173,7 @@ impl<'tcx> LateLintPass<'tcx> for ImplicitHasher {
Some(item.span.lo() + BytePos((i + (&snip[i..]).find('(')?) as u32)) Some(item.span.lo() + BytePos((i + (&snip[i..]).find('(')?) as u32))
}) })
.expect("failed to create span for type parameters"); .expect("failed to create span for type parameters");
Span::new(pos, pos, item.span.data().ctxt) Span::new(pos, pos, item.span.ctxt(), item.span.parent())
}); });
let mut ctr_vis = ImplicitHasherConstructorVisitor::new(cx, target); let mut ctr_vis = ImplicitHasherConstructorVisitor::new(cx, target);

View file

@ -63,6 +63,7 @@ impl<'tcx> LateLintPass<'tcx> for LargeConstArrays {
hi_pos - BytePos::from_usize("const".len()), hi_pos - BytePos::from_usize("const".len()),
hi_pos, hi_pos,
item.span.ctxt(), item.span.ctxt(),
item.span.parent(),
); );
span_lint_and_then( span_lint_and_then(
cx, cx,

View file

@ -182,7 +182,7 @@ fn parse_iter_usage(
}, },
_, _,
) => { ) => {
let parent_span = e.span.parent().unwrap(); let parent_span = e.span.parent_callsite().unwrap();
if parent_span.ctxt() == ctxt { if parent_span.ctxt() == ctxt {
(Some(UnwrapKind::QuestionMark), parent_span) (Some(UnwrapKind::QuestionMark), parent_span)
} else { } else {

View file

@ -120,7 +120,7 @@ impl EarlyLintPass for ModStyle {
correct.push("mod.rs"); correct.push("mod.rs");
cx.struct_span_lint( cx.struct_span_lint(
SELF_NAMED_MODULE_FILES, SELF_NAMED_MODULE_FILES,
Span::new(file.start_pos, file.start_pos, SyntaxContext::root()), Span::new(file.start_pos, file.start_pos, SyntaxContext::root(), None),
|build| { |build| {
let mut lint = let mut lint =
build.build(&format!("`mod.rs` files are required, found `{}`", path.display())); build.build(&format!("`mod.rs` files are required, found `{}`", path.display()));
@ -167,7 +167,7 @@ fn check_self_named_mod_exists(cx: &EarlyContext<'_>, path: &Path, file: &Source
cx.struct_span_lint( cx.struct_span_lint(
MOD_MODULE_FILES, MOD_MODULE_FILES,
Span::new(file.start_pos, file.start_pos, SyntaxContext::root()), Span::new(file.start_pos, file.start_pos, SyntaxContext::root(), None),
|build| { |build| {
let mut lint = build.build(&format!("`mod.rs` files are not allowed, found `{}`", path.display())); let mut lint = build.build(&format!("`mod.rs` files are not allowed, found `{}`", path.display()));
lint.help(&format!("move `{}` to `{}`", path.display(), mod_file.display(),)); lint.help(&format!("move `{}` to `{}`", path.display(), mod_file.display(),));

View file

@ -87,7 +87,7 @@ fn str_span(base: Span, c: regex_syntax::ast::Span, offset: u16) -> Span {
let end = base.lo() + BytePos(u32::try_from(c.end.offset).expect("offset too large") + offset); let end = base.lo() + BytePos(u32::try_from(c.end.offset).expect("offset too large") + offset);
let start = base.lo() + BytePos(u32::try_from(c.start.offset).expect("offset too large") + offset); let start = base.lo() + BytePos(u32::try_from(c.start.offset).expect("offset too large") + offset);
assert!(start <= end); assert!(start <= end);
Span::new(start, end, base.ctxt()) Span::new(start, end, base.ctxt(), base.parent())
} }
fn const_str<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) -> Option<String> { fn const_str<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) -> Option<String> {

View file

@ -69,6 +69,7 @@ impl TabsInDocComments {
attr.span.lo() + BytePos(3 + lo), attr.span.lo() + BytePos(3 + lo),
attr.span.lo() + BytePos(3 + hi), attr.span.lo() + BytePos(3 + hi),
attr.span.ctxt(), attr.span.ctxt(),
attr.span.parent(),
); );
span_lint_and_sugg( span_lint_and_sugg(
cx, cx,

View file

@ -1247,7 +1247,12 @@ impl MacroParser {
let data = delimited_span.entire().data(); let data = delimited_span.entire().data();
( (
data.hi, data.hi,
Span::new(data.lo + BytePos(1), data.hi - BytePos(1), data.ctxt), Span::new(
data.lo + BytePos(1),
data.hi - BytePos(1),
data.ctxt,
data.parent,
),
delimited_span.entire(), delimited_span.entire(),
) )
} }

View file

@ -356,11 +356,11 @@ macro_rules! source {
} }
pub(crate) fn mk_sp(lo: BytePos, hi: BytePos) -> Span { pub(crate) fn mk_sp(lo: BytePos, hi: BytePos) -> Span {
Span::new(lo, hi, SyntaxContext::root()) Span::new(lo, hi, SyntaxContext::root(), None)
} }
pub(crate) fn mk_sp_lo_plus_one(lo: BytePos) -> Span { pub(crate) fn mk_sp_lo_plus_one(lo: BytePos) -> Span {
Span::new(lo, lo + BytePos(1), SyntaxContext::root()) Span::new(lo, lo + BytePos(1), SyntaxContext::root(), None)
} }
// Returns `true` if the given span does not intersect with file lines. // Returns `true` if the given span does not intersect with file lines.