RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --host=aarch64-pc-windows-msvc --enable-full-tools --enable-profiler"
SCRIPT: python x.py dist
DIST_REQUIRE_ALL_TOOLS: 0
+ WINDOWS_SDK_20348_HACK: 1
os: windows-latest-xl
- name: dist-i686-mingw
env:
[[package]]
name = "aho-corasick"
-version = "0.7.13"
+version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86"
+checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
dependencies = [
"memchr",
]
"cargo_metadata 0.12.0",
"clippy_lints",
"clippy_utils",
- "compiletest_rs 0.6.0",
+ "compiletest_rs",
"derive-new",
"filetime",
"if_chain",
dependencies = [
"bytecount",
"clap",
- "itertools 0.9.0",
+ "itertools 0.10.1",
"opener",
"regex",
"shell-escape",
"cargo_metadata 0.12.0",
"clippy_utils",
"if_chain",
- "itertools 0.9.0",
+ "itertools 0.10.1",
"pulldown-cmark 0.8.0",
"quine-mc_cluskey",
"regex-syntax",
"winapi",
]
-[[package]]
-name = "compiletest_rs"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0086d6ad78cf409c3061618cd98e2789d5c9ce598fc9651611cf62eae0a599cb"
-dependencies = [
- "diff",
- "filetime",
- "getopts",
- "lazy_static",
- "libc",
- "log",
- "miow",
- "regex",
- "rustfix 0.5.1",
- "serde",
- "serde_derive",
- "serde_json",
- "tempfile",
- "tester",
- "winapi",
-]
-
[[package]]
name = "compiletest_rs"
version = "0.7.0"
version = "0.1.0"
dependencies = [
"colored",
- "compiletest_rs 0.7.0",
+ "compiletest_rs",
"env_logger 0.8.1",
"getrandom 0.2.0",
"hex 0.4.2",
[[package]]
name = "regex"
-version = "1.4.6"
+version = "1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759"
+checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
dependencies = [
"aho-corasick",
"memchr",
let is_first = i == 0;
if !is_first {
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::from_ast_ident(segment.ident)).into());
test(attr(deny(warnings)))
)]
#![feature(box_patterns)]
-#![cfg_attr(bootstrap, feature(const_fn_transmute))]
#![feature(crate_visibility_modifier)]
#![feature(if_let_guard)]
#![feature(iter_zip)]
#![feature(label_break_value)]
#![feature(nll)]
#![feature(min_specialization)]
-#![cfg_attr(bootstrap, allow(incomplete_features))] // if_let_guard
#![recursion_limit = "256"]
#[macro_use]
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 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>) }`,
)
};
+ // #82462: to correctly diagnose borrow errors, the block that contains
+ // the iter expr needs to have a span that covers the loop body.
+ let desugared_full_span =
+ self.mark_span_with_reason(DesugaringKind::ForLoop(ForLoopLoc::Head), e.span, None);
+
let match_expr = self.arena.alloc(self.expr_match(
- desugared_span,
+ desugared_full_span,
into_iter_expr,
arena_vec![self; iter_arm],
hir::MatchSource::ForLoopDesugar,
// surrounding scope of the `match` since the `match` is not a terminating scope.
//
// Also, add the attributes to the outer returned expr node.
- self.expr_drop_temps_mut(desugared_span, match_expr, attrs.into())
+ self.expr_drop_temps_mut(desugared_full_span, match_expr, attrs.into())
}
/// Desugar `ExprKind::Try` from: `<expr>?` into:
pub trait ResolverAstLowering {
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 legacy_const_generic_args(&mut self, expr: &Expr) -> Option<Vec<usize>>;
true
}
+ #[inline]
+ fn def_span(&self, id: LocalDefId) -> Span {
+ self.resolver.def_span(id)
+ }
+
#[inline]
fn def_path_hash(&self, def_id: DefId) -> DefPathHash {
self.resolver.def_path_hash(def_id)
}
/// 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 {
- 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 {
node_id,
DefPathData::LifetimeNs(str_name),
ExpnId::root(),
- span,
+ span.with_parent(None),
);
hir::GenericParam {
def_node_id,
DefPathData::LifetimeNs(name.ident().name),
ExpnId::root(),
- span,
+ span.with_parent(None),
);
let (name, kind) = match name {
}
fn check_fn_decl(&self, fn_decl: &FnDecl, self_semantic: SelfSemantic) {
+ self.check_decl_num_args(fn_decl);
self.check_decl_cvaradic_pos(fn_decl);
self.check_decl_attrs(fn_decl);
self.check_decl_self_param(fn_decl, self_semantic);
}
+ /// Emits fatal error if function declaration has more than `u16::MAX` arguments
+ /// Error is fatal to prevent errors during typechecking
+ fn check_decl_num_args(&self, fn_decl: &FnDecl) {
+ let max_num_args: usize = u16::MAX.into();
+ if fn_decl.inputs.len() > max_num_args {
+ let Param { span, .. } = fn_decl.inputs[0];
+ self.err_handler().span_fatal(
+ span,
+ &format!("function can not have more than {} arguments", max_num_args),
+ );
+ }
+ }
+
fn check_decl_cvaradic_pos(&self, fn_decl: &FnDecl) {
match &*fn_decl.inputs {
[Param { ty, span, .. }] => {
//!
//! The crate also contains other misc AST visitors, e.g. `node_count` and `show_span`.
-#![cfg_attr(bootstrap, feature(bindings_after_at))]
#![feature(iter_is_partitioned)]
#![feature(box_patterns)]
#![recursion_limit = "256"]
);
if self.fn_self_span_reported.insert(fn_span) {
err.span_note(
- self_arg.span,
+ // Check whether the source is accessible
+ if self
+ .infcx
+ .tcx
+ .sess
+ .source_map()
+ .span_to_snippet(self_arg.span)
+ .is_ok()
+ {
+ self_arg.span
+ } else {
+ fn_call_span
+ },
"calling this operator moves the left-hand side",
);
}
deref_target_ty
));
- err.span_note(deref_target, "deref defined here");
+ // Check first whether the source is accessible (issue #87060)
+ if self.infcx.tcx.sess.source_map().span_to_snippet(deref_target).is_ok() {
+ err.span_note(deref_target, "deref defined here");
+ }
}
if let Some((_, mut old_err)) =
FxHashMap<Location, FxHashMap<(RegionVid, RegionVid), (ConstraintCategory, Span)>>,
/// Map universe indexes to information on why we created it.
- universe_causes: IndexVec<ty::UniverseIndex, UniverseInfo<'tcx>>,
+ universe_causes: FxHashMap<ty::UniverseIndex, UniverseInfo<'tcx>>,
/// Contains the minimum universe of any variable within the same
/// SCC. We will ensure that no SCC contains values that are not
Location,
FxHashMap<(RegionVid, RegionVid), (ConstraintCategory, Span)>,
>,
- universe_causes: IndexVec<ty::UniverseIndex, UniverseInfo<'tcx>>,
+ universe_causes: FxHashMap<ty::UniverseIndex, UniverseInfo<'tcx>>,
type_tests: Vec<TypeTest<'tcx>>,
liveness_constraints: LivenessValues<RegionVid>,
elements: &Rc<RegionValueElements>,
category: constraint.category,
from_closure: false,
span,
- variance_info: constraint.variance_info.clone(),
+ variance_info: constraint.variance_info,
};
}
Locations::Single(loc) => loc,
category,
from_closure: true,
span: span,
- variance_info: constraint.variance_info.clone(),
+ variance_info: constraint.variance_info,
})
.unwrap_or(BlameConstraint {
category: constraint.category,
from_closure: false,
span: body.source_info(loc).span,
- variance_info: constraint.variance_info.clone(),
+ variance_info: constraint.variance_info,
})
}
category: constraint.category,
from_closure: false,
span: constraint.locations.span(body),
- variance_info: constraint.variance_info.clone(),
+ variance_info: constraint.variance_info,
}
}
})
}
crate fn universe_info(&self, universe: ty::UniverseIndex) -> UniverseInfo<'tcx> {
- self.universe_causes[universe].clone()
+ self.universe_causes[&universe].clone()
}
}
None => UniverseInfo::other(),
};
for u in old_universe..universe {
- let info_universe =
- self.borrowck_context.constraints.universe_causes.push(universe_info.clone());
- assert_eq!(u.as_u32() + 1, info_universe.as_u32());
+ self.borrowck_context
+ .constraints
+ .universe_causes
+ .insert(u + 1, universe_info.clone());
}
}
let (instantiated, _) =
self.infcx.instantiate_canonical_with_fresh_inference_vars(span, canonical);
- for _ in 0..canonical.max_universe.as_u32() {
+ for u in 0..canonical.max_universe.as_u32() {
let info = UniverseInfo::other();
- self.borrowck_context.constraints.universe_causes.push(info);
+ self.borrowck_context
+ .constraints
+ .universe_causes
+ .insert(ty::UniverseIndex::from_u32(u), info);
}
instantiated
// We add implied bounds from both the unnormalized and normalized ty
// See issue #87748
let constraints_implied_1 = self.add_implied_bounds(ty);
- let TypeOpOutput { output: ty, constraints: constraints1, .. } = self
+ let TypeOpOutput { output: norm_ty, constraints: constraints1, .. } = self
.param_env
.and(type_op::normalize::Normalize::new(ty))
.fully_perform(self.infcx)
// }
// ```
// Both &Self::Bar and &() are WF
- let constraints_implied_2 = self.add_implied_bounds(ty);
- normalized_inputs_and_output.push(ty);
+ let constraints_implied_2 =
+ if ty != norm_ty { self.add_implied_bounds(norm_ty) } else { None };
+ normalized_inputs_and_output.push(norm_ty);
constraints1.into_iter().chain(constraints_implied_1).chain(constraints_implied_2)
})
.collect();
b
}
};
+ // Note: if we have to introduce new placeholders during normalization above, then we won't have
+ // added those universes to the universe info, which we would want in `relate_tys`.
if let Err(terr) =
self.eq_types(a, b, Locations::All(span), ConstraintCategory::BoringNoLocation)
{
upvars: &[Upvar<'tcx>],
) -> MirTypeckResults<'tcx> {
let implicit_region_bound = infcx.tcx.mk_region(ty::ReVar(universal_regions.fr_fn_body));
+ let mut universe_causes = FxHashMap::default();
+ universe_causes.insert(ty::UniverseIndex::from_u32(0), UniverseInfo::other());
let mut constraints = MirTypeckRegionConstraints {
placeholder_indices: PlaceholderIndices::default(),
placeholder_index_to_region: IndexVec::default(),
member_constraints: MemberConstraintSet::default(),
closure_bounds_mapping: Default::default(),
type_tests: Vec::default(),
- universe_causes: IndexVec::from_elem_n(UniverseInfo::other(), 1),
+ universe_causes,
};
let CreateResult {
&mut constraints,
);
- for _ in ty::UniverseIndex::ROOT..infcx.universe() {
+ for u in ty::UniverseIndex::ROOT..infcx.universe() {
let info = UniverseInfo::other();
- constraints.universe_causes.push(info);
+ constraints.universe_causes.insert(u, info);
}
let mut borrowck_context = BorrowCheckContext {
crate closure_bounds_mapping:
FxHashMap<Location, FxHashMap<(RegionVid, RegionVid), (ConstraintCategory, Span)>>,
- crate universe_causes: IndexVec<ty::UniverseIndex, UniverseInfo<'tcx>>,
+ crate universe_causes: FxHashMap<ty::UniverseIndex, UniverseInfo<'tcx>>,
crate type_tests: Vec<TypeTest<'tcx>>,
}
}
fn create_next_universe(&mut self) -> ty::UniverseIndex {
- let info_universe =
- self.borrowck_context.constraints.universe_causes.push(self.universe_info.clone());
let universe = self.infcx.create_next_universe();
- assert_eq!(info_universe, universe);
+ self.borrowck_context
+ .constraints
+ .universe_causes
+ .insert(universe, self.universe_info.clone());
universe
}
let mut explicit_reg = false;
let op = if !is_global_asm && p.eat_keyword(kw::In) {
let reg = parse_reg(&mut p, &mut explicit_reg)?;
+ if p.eat_keyword(kw::Underscore) {
+ let err = ecx.struct_span_err(p.token.span, "_ cannot be used for input operands");
+ return Err(err);
+ }
let expr = p.parse_expr()?;
ast::InlineAsmOperand::In { reg, expr }
} else if !is_global_asm && p.eat_keyword(sym::out) {
ast::InlineAsmOperand::Out { reg, expr, late: true }
} else if !is_global_asm && p.eat_keyword(sym::inout) {
let reg = parse_reg(&mut p, &mut explicit_reg)?;
+ if p.eat_keyword(kw::Underscore) {
+ let err = ecx.struct_span_err(p.token.span, "_ cannot be used for input operands");
+ return Err(err);
+ }
let expr = p.parse_expr()?;
if p.eat(&token::FatArrow) {
let out_expr =
}
} else if !is_global_asm && p.eat_keyword(sym::inlateout) {
let reg = parse_reg(&mut p, &mut explicit_reg)?;
+ if p.eat_keyword(kw::Underscore) {
+ let err = ecx.struct_span_err(p.token.span, "_ cannot be used for input operands");
+ return Err(err);
+ }
let expr = p.parse_expr()?;
if p.eat(&token::FatArrow) {
let out_expr =
match expr_to_spanned_string(ecx, template_expr, msg) {
Ok(template_part) => template_part,
Err(err) => {
- if let Some(mut err) = err {
+ if let Some((mut err, _)) = err {
err.emit();
}
return None;
}
Ok(fmt) => fmt,
Err(err) => {
- if let Some(mut err) = err {
+ if let Some((mut err, suggested)) = err {
let sugg_fmt = match args.len() {
0 => "{}".to_string(),
_ => format!("{}{{}}", "{} ".repeat(args.len())),
};
- err.span_suggestion(
- fmt_sp.shrink_to_lo(),
- "you might be missing a string literal to format with",
- format!("\"{}\", ", sugg_fmt),
- Applicability::MaybeIncorrect,
- );
+ if !suggested {
+ err.span_suggestion(
+ fmt_sp.shrink_to_lo(),
+ "you might be missing a string literal to format with",
+ format!("\"{}\", ", sugg_fmt),
+ Applicability::MaybeIncorrect,
+ );
+ }
err.emit();
}
return DummyResult::raw_expr(sp, true);
fn get_abi_param(&self, tcx: TyCtxt<'tcx>) -> SmallVec<[AbiParam; 2]> {
match self.mode {
PassMode::Ignore => smallvec![],
- PassMode::Direct(attrs) => match &self.layout.abi {
+ PassMode::Direct(attrs) => match self.layout.abi {
Abi::Scalar(scalar) => smallvec![apply_arg_attrs_to_abi_param(
- AbiParam::new(scalar_to_clif_type(tcx, scalar.clone())),
+ AbiParam::new(scalar_to_clif_type(tcx, scalar)),
attrs
)],
Abi::Vector { .. } => {
}
_ => unreachable!("{:?}", self.layout.abi),
},
- PassMode::Pair(attrs_a, attrs_b) => match &self.layout.abi {
+ PassMode::Pair(attrs_a, attrs_b) => match self.layout.abi {
Abi::ScalarPair(a, b) => {
- let a = scalar_to_clif_type(tcx, a.clone());
- let b = scalar_to_clif_type(tcx, b.clone());
+ let a = scalar_to_clif_type(tcx, a);
+ let b = scalar_to_clif_type(tcx, b);
smallvec![
apply_arg_attrs_to_abi_param(AbiParam::new(a), attrs_a),
apply_arg_attrs_to_abi_param(AbiParam::new(b), attrs_b),
fn get_abi_return(&self, tcx: TyCtxt<'tcx>) -> (Option<AbiParam>, Vec<AbiParam>) {
match self.mode {
PassMode::Ignore => (None, vec![]),
- PassMode::Direct(_) => match &self.layout.abi {
+ PassMode::Direct(_) => match self.layout.abi {
Abi::Scalar(scalar) => {
- (None, vec![AbiParam::new(scalar_to_clif_type(tcx, scalar.clone()))])
+ (None, vec![AbiParam::new(scalar_to_clif_type(tcx, scalar))])
}
Abi::Vector { .. } => {
let vector_ty = crate::intrinsics::clif_vector_type(tcx, self.layout).unwrap();
}
_ => unreachable!("{:?}", self.layout.abi),
},
- PassMode::Pair(_, _) => match &self.layout.abi {
+ PassMode::Pair(_, _) => match self.layout.abi {
Abi::ScalarPair(a, b) => {
- let a = scalar_to_clif_type(tcx, a.clone());
- let b = scalar_to_clif_type(tcx, b.clone());
+ let a = scalar_to_clif_type(tcx, a);
+ let b = scalar_to_clif_type(tcx, b);
(None, vec![AbiParam::new(a), AbiParam::new(b)])
}
_ => unreachable!("{:?}", self.layout.abi),
let ptr = fx.bcx.inst_results(call)[0];
lval.write_cvalue(fx, CValue::by_val(ptr, box_layout));
}
- Rvalue::NullaryOp(NullOp::SizeOf, ty) => {
+ Rvalue::NullaryOp(null_op, ty) => {
assert!(
lval.layout()
.ty
.is_sized(fx.tcx.at(stmt.source_info.span), ParamEnv::reveal_all())
);
- let ty_size = fx.layout_of(fx.monomorphize(ty)).size.bytes();
+ let layout = fx.layout_of(fx.monomorphize(ty));
+ let val = match null_op {
+ NullOp::SizeOf => layout.size.bytes(),
+ NullOp::AlignOf => layout.align.abi.bytes(),
+ NullOp::Box => unreachable!(),
+ };
let val =
- CValue::const_val(fx, fx.layout_of(fx.tcx.types.usize), ty_size.into());
+ CValue::const_val(fx, fx.layout_of(fx.tcx.types.usize), val.into());
lval.write_cvalue(fx, val);
}
Rvalue::Aggregate(ref kind, ref operands) => match kind.as_ref() {
}
pub(crate) fn clif_vector_type<'tcx>(tcx: TyCtxt<'tcx>, layout: TyAndLayout<'tcx>) -> Option<Type> {
- let (element, count) = match &layout.abi {
- Abi::Vector { element, count } => (element.clone(), *count),
+ let (element, count) = match layout.abi {
+ Abi::Vector { element, count } => (element, count),
_ => unreachable!(),
};
dest.write_cvalue(fx, val);
};
- pref_align_of | min_align_of | needs_drop | type_id | type_name | variant_count, () {
+ pref_align_of | needs_drop | type_id | type_name | variant_count, () {
let const_val =
fx.tcx.const_eval_instance(ParamEnv::reveal_all(), instance, None).unwrap();
let val = crate::constant::codegen_const_value(
}
}
-fn scalar_pair_calculate_b_offset(
- tcx: TyCtxt<'_>,
- a_scalar: &Scalar,
- b_scalar: &Scalar,
-) -> Offset32 {
+fn scalar_pair_calculate_b_offset(tcx: TyCtxt<'_>, a_scalar: Scalar, b_scalar: Scalar) -> Offset32 {
let b_offset = a_scalar.value.size(&tcx).align_to(b_scalar.value.align(&tcx).abi);
Offset32::new(b_offset.bytes().try_into().unwrap())
}
match self.0 {
CValueInner::ByRef(ptr, None) => {
let clif_ty = match layout.abi {
- Abi::Scalar(ref scalar) => scalar_to_clif_type(fx.tcx, scalar.clone()),
- Abi::Vector { ref element, count } => {
- scalar_to_clif_type(fx.tcx, element.clone())
- .by(u16::try_from(count).unwrap())
- .unwrap()
- }
+ Abi::Scalar(scalar) => scalar_to_clif_type(fx.tcx, scalar),
+ Abi::Vector { element, count } => scalar_to_clif_type(fx.tcx, element)
+ .by(u16::try_from(count).unwrap())
+ .unwrap(),
_ => unreachable!("{:?}", layout.ty),
};
let mut flags = MemFlags::new();
let layout = self.1;
match self.0 {
CValueInner::ByRef(ptr, None) => {
- let (a_scalar, b_scalar) = match &layout.abi {
+ let (a_scalar, b_scalar) = match layout.abi {
Abi::ScalarPair(a, b) => (a, b),
_ => unreachable!("load_scalar_pair({:?})", self),
};
let b_offset = scalar_pair_calculate_b_offset(fx.tcx, a_scalar, b_scalar);
- let clif_ty1 = scalar_to_clif_type(fx.tcx, a_scalar.clone());
- let clif_ty2 = scalar_to_clif_type(fx.tcx, b_scalar.clone());
+ let clif_ty1 = scalar_to_clif_type(fx.tcx, a_scalar);
+ let clif_ty2 = scalar_to_clif_type(fx.tcx, b_scalar);
let mut flags = MemFlags::new();
flags.set_notrap();
let val1 = ptr.load(fx, clif_ty1, flags);
to_ptr.store(fx, val, flags);
return;
}
- Abi::ScalarPair(ref a_scalar, ref b_scalar) => {
+ Abi::ScalarPair(a_scalar, b_scalar) => {
let (value, extra) = from.load_scalar_pair(fx);
let b_offset = scalar_pair_calculate_b_offset(fx.tcx, a_scalar, b_scalar);
to_ptr.store(fx, value, flags);
}
fn apply_attrs_callsite(&self, bx: &mut Builder<'a, 'll, 'tcx>, callsite: &'ll Value) {
- // FIXME(wesleywiser, eddyb): We should apply `nounwind` and `noreturn` as appropriate to this callsite.
+ if self.ret.layout.abi.is_uninhabited() {
+ llvm::Attribute::NoReturn.apply_callsite(llvm::AttributePlace::Function, callsite);
+ }
+ if !self.can_unwind {
+ llvm::Attribute::NoUnwind.apply_callsite(llvm::AttributePlace::Function, callsite);
+ }
let mut i = 0;
let mut apply = |cx: &CodegenCx<'_, '_>, attrs: &ArgAttributes| {
}
_ => {}
}
- if let abi::Abi::Scalar(ref scalar) = self.ret.layout.abi {
+ if let abi::Abi::Scalar(scalar) = self.ret.layout.abi {
// If the value is a boolean, the range is 0..2 and that ultimately
// become 0..0 when the type becomes i1, which would be rejected
// by the LLVM verifier.
if let Int(..) = scalar.value {
- if !scalar.is_bool() {
- let range = scalar.valid_range_exclusive(bx);
- if range.start != range.end {
- bx.range_metadata(callsite, range);
- }
+ if !scalar.is_bool() && !scalar.is_always_valid(bx) {
+ bx.range_metadata(callsite, scalar.valid_range);
}
}
}
/// Helper function to get the LLVM type for a Scalar. Pointers are returned as
/// the equivalent integer type.
-fn llvm_asm_scalar_type(cx: &CodegenCx<'ll, 'tcx>, scalar: &Scalar) -> &'ll Type {
+fn llvm_asm_scalar_type(cx: &CodegenCx<'ll, 'tcx>, scalar: Scalar) -> &'ll Type {
match scalar.value {
Primitive::Int(Integer::I8, _) => cx.type_i8(),
Primitive::Int(Integer::I16, _) => cx.type_i16(),
reg: InlineAsmRegClass,
layout: &TyAndLayout<'tcx>,
) -> &'ll Value {
- match (reg, &layout.abi) {
+ match (reg, layout.abi) {
(InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg), Abi::Scalar(s)) => {
if let Primitive::Int(Integer::I8, _) = s.value {
let vec_ty = bx.cx.type_vector(bx.cx.type_i8(), 8);
Abi::Vector { element, count },
) if layout.size.bytes() == 8 => {
let elem_ty = llvm_asm_scalar_type(bx.cx, element);
- let vec_ty = bx.cx.type_vector(elem_ty, *count);
+ let vec_ty = bx.cx.type_vector(elem_ty, count);
let indices: Vec<_> = (0..count * 2).map(|x| bx.const_i32(x as i32)).collect();
bx.shuffle_vector(value, bx.const_undef(vec_ty), bx.const_vector(&indices))
}
reg: InlineAsmRegClass,
layout: &TyAndLayout<'tcx>,
) -> &'ll Value {
- match (reg, &layout.abi) {
+ match (reg, layout.abi) {
(InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg), Abi::Scalar(s)) => {
if let Primitive::Int(Integer::I8, _) = s.value {
bx.extract_element(value, bx.const_i32(0))
Abi::Vector { element, count },
) if layout.size.bytes() == 8 => {
let elem_ty = llvm_asm_scalar_type(bx.cx, element);
- let vec_ty = bx.cx.type_vector(elem_ty, *count * 2);
- let indices: Vec<_> = (0..*count).map(|x| bx.const_i32(x as i32)).collect();
+ let vec_ty = bx.cx.type_vector(elem_ty, count * 2);
+ let indices: Vec<_> = (0..count).map(|x| bx.const_i32(x as i32)).collect();
bx.shuffle_vector(value, bx.const_undef(vec_ty), bx.const_vector(&indices))
}
(InlineAsmRegClass::X86(X86InlineAsmRegClass::reg_abcd), Abi::Scalar(s))
reg: InlineAsmRegClass,
layout: &TyAndLayout<'tcx>,
) -> &'ll Type {
- match (reg, &layout.abi) {
+ match (reg, layout.abi) {
(InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg), Abi::Scalar(s)) => {
if let Primitive::Int(Integer::I8, _) = s.value {
cx.type_vector(cx.type_i8(), 8)
use rustc_middle::ty::layout::{LayoutError, LayoutOfHelpers, TyAndLayout};
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_span::Span;
-use rustc_target::abi::{self, Align, Size};
+use rustc_target::abi::{self, Align, Size, WrappingRange};
use rustc_target::spec::{HasTargetSpec, Target};
use std::borrow::Cow;
use std::ffi::CStr;
use std::iter;
-use std::ops::{Deref, Range};
+use std::ops::Deref;
use std::ptr;
use tracing::debug;
val
}
}
- fn to_immediate_scalar(&mut self, val: Self::Value, scalar: &abi::Scalar) -> Self::Value {
+ fn to_immediate_scalar(&mut self, val: Self::Value, scalar: abi::Scalar) -> Self::Value {
if scalar.is_bool() {
return self.trunc(val, self.cx().type_i1());
}
fn scalar_load_metadata<'a, 'll, 'tcx>(
bx: &mut Builder<'a, 'll, 'tcx>,
load: &'ll Value,
- scalar: &abi::Scalar,
+ scalar: abi::Scalar,
) {
match scalar.value {
abi::Int(..) => {
- let range = scalar.valid_range_exclusive(bx);
- if range.start != range.end {
- bx.range_metadata(load, range);
+ if !scalar.is_always_valid(bx) {
+ bx.range_metadata(load, scalar.valid_range);
}
}
- abi::Pointer if !scalar.valid_range.contains_zero() => {
+ abi::Pointer if !scalar.valid_range.contains(0) => {
bx.nonnull_metadata(load);
}
_ => {}
}
let llval = const_llval.unwrap_or_else(|| {
let load = self.load(place.layout.llvm_type(self), place.llval, place.align);
- if let abi::Abi::Scalar(ref scalar) = place.layout.abi {
+ if let abi::Abi::Scalar(scalar) = place.layout.abi {
scalar_load_metadata(self, load, scalar);
}
load
});
OperandValue::Immediate(self.to_immediate(llval, place.layout))
- } else if let abi::Abi::ScalarPair(ref a, ref b) = place.layout.abi {
+ } else if let abi::Abi::ScalarPair(a, b) = place.layout.abi {
let b_offset = a.value.size(self).align_to(b.value.align(self).abi);
let pair_ty = place.layout.llvm_type(self);
- let mut load = |i, scalar: &abi::Scalar, align| {
+ let mut load = |i, scalar: abi::Scalar, align| {
let llptr = self.struct_gep(pair_ty, place.llval, i as u64);
let llty = place.layout.scalar_pair_element_llvm_type(self, i, false);
let load = self.load(llty, llptr, align);
next_bx
}
- fn range_metadata(&mut self, load: &'ll Value, range: Range<u128>) {
+ fn range_metadata(&mut self, load: &'ll Value, range: WrappingRange) {
if self.sess().target.arch == "amdgpu" {
// amdgpu/LLVM does something weird and thinks an i64 value is
// split into a v2i32, halving the bitwidth LLVM expects,
let llty = self.cx.val_ty(load);
let v = [
self.cx.const_uint_big(llty, range.start),
- self.cx.const_uint_big(llty, range.end),
+ self.cx.const_uint_big(llty, range.end.wrapping_add(1)),
];
llvm::LLVMSetMetadata(
})
}
- fn scalar_to_backend(&self, cv: Scalar, layout: &abi::Scalar, llty: &'ll Type) -> &'ll Value {
+ fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, llty: &'ll Type) -> &'ll Value {
let bitsize = if layout.is_bool() { 1 } else { layout.value.size(self).bits() };
match cv {
Scalar::Int(ScalarInt::ZST) => {
Pointer::new(alloc_id, Size::from_bytes(ptr_offset)),
&cx.tcx,
),
- &Scalar { value: Primitive::Pointer, valid_range: WrappingRange { start: 0, end: !0 } },
+ Scalar { value: Primitive::Pointer, valid_range: WrappingRange { start: 0, end: !0 } },
cx.type_i8p_ext(address_space),
));
next_offset = offset + pointer_size;
Variants::Multiple {
tag_encoding:
TagEncoding::Niche { ref niche_variants, niche_start, dataful_variant },
- ref tag,
+ tag,
ref variants,
tag_field,
} => {
let layout = cx.layout_of(enum_type);
- if let (
- &Abi::Scalar(_),
- &Variants::Multiple { tag_encoding: TagEncoding::Direct, ref tag, .. },
- ) = (&layout.abi, &layout.variants)
+ if let (Abi::Scalar(_), Variants::Multiple { tag_encoding: TagEncoding::Direct, tag, .. }) =
+ (layout.abi, &layout.variants)
{
return FinalMetadata(discriminant_type_metadata(tag.value));
}
if use_enum_fallback(cx) {
let discriminant_type_metadata = match layout.variants {
Variants::Single { .. } => None,
- Variants::Multiple { tag_encoding: TagEncoding::Niche { .. }, ref tag, .. }
- | Variants::Multiple { tag_encoding: TagEncoding::Direct, ref tag, .. } => {
+ Variants::Multiple { tag_encoding: TagEncoding::Niche { .. }, tag, .. }
+ | Variants::Multiple { tag_encoding: TagEncoding::Direct, tag, .. } => {
Some(discriminant_type_metadata(tag.value))
}
};
// A single-variant enum has no discriminant.
Variants::Single { .. } => None,
- Variants::Multiple {
- tag_encoding: TagEncoding::Niche { .. }, ref tag, tag_field, ..
- } => {
+ Variants::Multiple { tag_encoding: TagEncoding::Niche { .. }, tag, tag_field, .. } => {
// Find the integer type of the correct size.
let size = tag.value.size(cx);
let align = tag.value.align(cx);
}
}
- Variants::Multiple { tag_encoding: TagEncoding::Direct, ref tag, tag_field, .. } => {
+ Variants::Multiple { tag_encoding: TagEncoding::Direct, tag, tag_field, .. } => {
let discr_type = tag.value.to_ty(cx.tcx);
let (size, align) = cx.size_and_align_of(discr_type);
}
sym::va_arg => {
match fn_abi.ret.layout.abi {
- abi::Abi::Scalar(ref scalar) => {
+ abi::Abi::Scalar(scalar) => {
match scalar.value {
Primitive::Int(..) => {
if self.cx().size_of(ret_ty).bytes() < 4 {
) -> &'a Type {
match layout.abi {
Abi::Scalar(_) => bug!("handled elsewhere"),
- Abi::Vector { ref element, count } => {
+ Abi::Vector { element, count } => {
let element = layout.scalar_llvm_type_at(cx, element, Size::ZERO);
return cx.type_vector(element, count);
}
fn scalar_llvm_type_at<'a>(
&self,
cx: &CodegenCx<'a, 'tcx>,
- scalar: &Scalar,
+ scalar: Scalar,
offset: Size,
) -> &'a Type;
fn scalar_pair_element_llvm_type<'a>(
/// of that field's type - this is useful for taking the address of
/// that field and ensuring the struct has the right alignment.
fn llvm_type<'a>(&self, cx: &CodegenCx<'a, 'tcx>) -> &'a Type {
- if let Abi::Scalar(ref scalar) = self.abi {
+ if let Abi::Scalar(scalar) = self.abi {
// Use a different cache for scalars because pointers to DSTs
// can be either fat or thin (data pointers of fat pointers).
if let Some(&llty) = cx.scalar_lltypes.borrow().get(&self.ty) {
}
fn immediate_llvm_type<'a>(&self, cx: &CodegenCx<'a, 'tcx>) -> &'a Type {
- if let Abi::Scalar(ref scalar) = self.abi {
+ if let Abi::Scalar(scalar) = self.abi {
if scalar.is_bool() {
return cx.type_i1();
}
fn scalar_llvm_type_at<'a>(
&self,
cx: &CodegenCx<'a, 'tcx>,
- scalar: &Scalar,
+ scalar: Scalar,
offset: Size,
) -> &'a Type {
match scalar.value {
}
let (a, b) = match self.abi {
- Abi::ScalarPair(ref a, ref b) => (a, b),
+ Abi::ScalarPair(a, b) => (a, b),
_ => bug!("TyAndLayout::scalar_pair_element_llty({:?}): not applicable", self),
};
let scalar = [a, b][index];
// calculate the range of values for the dataful variant
let dataful_discriminant_range =
- &dataful_variant_layout.largest_niche.as_ref().unwrap().scalar.valid_range;
+ dataful_variant_layout.largest_niche.unwrap().scalar.valid_range;
let min = dataful_discriminant_range.start;
let min = tag.value.size(&tcx).truncate(min);
use rustc_span::source_map::Span;
use rustc_span::{sym, Symbol};
use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode};
-use rustc_target::abi::{self, HasDataLayout};
+use rustc_target::abi::{self, HasDataLayout, WrappingRange};
use rustc_target::spec::abi::Abi;
/// Used by `FunctionCx::codegen_terminator` for emitting common patterns
// the load would just produce `OperandValue::Ref` instead
// of the `OperandValue::Immediate` we need for the call.
llval = bx.load(bx.backend_type(arg.layout), llval, align);
- if let abi::Abi::Scalar(ref scalar) = arg.layout.abi {
+ if let abi::Abi::Scalar(scalar) = arg.layout.abi {
if scalar.is_bool() {
- bx.range_metadata(llval, 0..2);
+ bx.range_metadata(llval, WrappingRange { start: 0, end: 1 });
}
}
// We store bools as `i8` so we need to truncate to `i1`.
let src = self.codegen_operand(bx, src);
// Special-case transmutes between scalars as simple bitcasts.
- match (&src.layout.abi, &dst.layout.abi) {
+ match (src.layout.abi, dst.layout.abi) {
(abi::Abi::Scalar(src_scalar), abi::Abi::Scalar(dst_scalar)) => {
// HACK(eddyb) LLVM doesn't like `bitcast`s between pointers and non-pointers.
if (src_scalar.value == abi::Pointer) == (dst_scalar.value == abi::Pointer) {
if let Some(prim) = field.val.try_to_scalar() {
let layout = bx.layout_of(field_ty);
let scalar = match layout.abi {
- Abi::Scalar(ref x) => x,
+ Abi::Scalar(x) => x,
_ => bug!("from_const: invalid ByVal layout: {:#?}", layout),
};
bx.scalar_to_backend(prim, scalar, bx.immediate_backend_type(layout))
}
}
sym::pref_align_of
- | sym::min_align_of
| sym::needs_drop
| sym::type_id
| sym::type_name
let val = match val {
ConstValue::Scalar(x) => {
let scalar = match layout.abi {
- Abi::Scalar(ref x) => x,
+ Abi::Scalar(x) => x,
_ => bug!("from_const: invalid ByVal layout: {:#?}", layout),
};
let llval = bx.scalar_to_backend(x, scalar, bx.immediate_backend_type(layout));
}
ConstValue::Slice { data, start, end } => {
let a_scalar = match layout.abi {
- Abi::ScalarPair(ref a, _) => a,
+ Abi::ScalarPair(a, _) => a,
_ => bug!("from_const: invalid ScalarPair layout: {:#?}", layout),
};
let a = Scalar::from_pointer(
llval: V,
layout: TyAndLayout<'tcx>,
) -> Self {
- let val = if let Abi::ScalarPair(ref a, ref b) = layout.abi {
+ let val = if let Abi::ScalarPair(a, b) = layout.abi {
debug!("Operand::from_immediate_or_packed_pair: unpacking {:?} @ {:?}", llval, layout);
// Deconstruct the immediate aggregate.
let field = self.layout.field(bx.cx(), i);
let offset = self.layout.fields.offset(i);
- let mut val = match (self.val, &self.layout.abi) {
+ let mut val = match (self.val, self.layout.abi) {
// If the field is ZST, it has no data.
_ if field.is_zst() => {
return OperandRef::new_zst(bx, field);
}
// Extract a scalar component from a pair.
- (OperandValue::Pair(a_llval, b_llval), &Abi::ScalarPair(ref a, ref b)) => {
+ (OperandValue::Pair(a_llval, b_llval), Abi::ScalarPair(a, b)) => {
if offset.bytes() == 0 {
assert_eq!(field.size, a.value.size(bx.cx()));
OperandValue::Immediate(a_llval)
}
// `#[repr(simd)]` types are also immediate.
- (OperandValue::Immediate(llval), &Abi::Vector { .. }) => {
+ (OperandValue::Immediate(llval), Abi::Vector { .. }) => {
OperandValue::Immediate(bx.extract_element(llval, bx.cx().const_usize(i as u64)))
}
_ => bug!("OperandRef::extract_field({:?}): not applicable", self),
};
- match (&mut val, &field.abi) {
+ match (&mut val, field.abi) {
(OperandValue::Immediate(llval), _) => {
// Bools in union fields needs to be truncated.
*llval = bx.to_immediate(*llval, field);
}
OperandValue::Pair(a, b) => {
let (a_scalar, b_scalar) = match dest.layout.abi {
- Abi::ScalarPair(ref a, ref b) => (a, b),
+ Abi::ScalarPair(a, b) => (a, b),
_ => bug!("store_with_flags: invalid ScalarPair layout: {:#?}", dest.layout),
};
let ty = bx.backend_type(dest.layout);
// Also handles the first field of Scalar, ScalarPair, and Vector layouts.
self.llval
}
- Abi::ScalarPair(ref a, ref b)
+ Abi::ScalarPair(a, b)
if offset == a.value.size(bx.cx()).align_to(b.value.align(bx.cx()).abi) =>
{
// Offset matches second field.
.map_or(index.as_u32() as u128, |discr| discr.val);
return bx.cx().const_uint_big(cast_to, discr_val);
}
- Variants::Multiple { ref tag, ref tag_encoding, tag_field, .. } => {
+ Variants::Multiple { tag, ref tag_encoding, tag_field, .. } => {
(tag, tag_encoding, tag_field)
}
};
let llval = operand.immediate();
let mut signed = false;
- if let Abi::Scalar(ref scalar) = operand.layout.abi {
+ if let Abi::Scalar(scalar) = operand.layout.abi {
if let Int(_, s) = scalar.value {
// We use `i1` for bytes that are always `0` or `1`,
// e.g., `#[repr(i8)] enum E { A, B }`, but we can't
// then `i1 1` (i.e., E::B) is effectively `i8 -1`.
signed = !scalar.is_bool() && s;
- let er = scalar.valid_range_exclusive(bx.cx());
- if er.end != er.start
+ if !scalar.is_always_valid(bx.cx())
&& scalar.valid_range.end >= scalar.valid_range.start
{
// We want `table[e as usize ± k]` to not
)
}
- mir::Rvalue::NullaryOp(mir::NullOp::SizeOf, ty) => {
- let ty = self.monomorphize(ty);
- assert!(bx.cx().type_is_sized(ty));
- let val = bx.cx().const_usize(bx.cx().layout_of(ty).size.bytes());
- let tcx = self.cx.tcx();
- (
- bx,
- OperandRef {
- val: OperandValue::Immediate(val),
- layout: self.cx.layout_of(tcx.types.usize),
- },
- )
- }
-
mir::Rvalue::NullaryOp(mir::NullOp::Box, content_ty) => {
let content_ty = self.monomorphize(content_ty);
let content_layout = bx.cx().layout_of(content_ty);
let operand = OperandRef { val: OperandValue::Immediate(val), layout: box_layout };
(bx, operand)
}
+
+ mir::Rvalue::NullaryOp(null_op, ty) => {
+ let ty = self.monomorphize(ty);
+ assert!(bx.cx().type_is_sized(ty));
+ let layout = bx.cx().layout_of(ty);
+ let val = match null_op {
+ mir::NullOp::SizeOf => layout.size.bytes(),
+ mir::NullOp::AlignOf => layout.align.abi.bytes(),
+ mir::NullOp::Box => unreachable!(),
+ };
+ let val = bx.cx().const_usize(val);
+ let tcx = self.cx.tcx();
+ (
+ bx,
+ OperandRef {
+ val: OperandValue::Immediate(val),
+ layout: self.cx.layout_of(tcx.types.usize),
+ },
+ )
+ }
+
mir::Rvalue::ThreadLocalRef(def_id) => {
assert!(bx.cx().tcx().is_static(def_id));
let static_ = bx.get_static(def_id);
use rustc_middle::ty::layout::{HasParamEnv, TyAndLayout};
use rustc_middle::ty::Ty;
use rustc_span::Span;
-use rustc_target::abi::{Abi, Align, Scalar, Size};
+use rustc_target::abi::{Abi, Align, Scalar, Size, WrappingRange};
use rustc_target::spec::HasTargetSpec;
-use std::ops::Range;
-
#[derive(Copy, Clone)]
pub enum OverflowOp {
Add,
fn from_immediate(&mut self, val: Self::Value) -> Self::Value;
fn to_immediate(&mut self, val: Self::Value, layout: TyAndLayout<'_>) -> Self::Value {
- if let Abi::Scalar(ref scalar) = layout.abi {
+ if let Abi::Scalar(scalar) = layout.abi {
self.to_immediate_scalar(val, scalar)
} else {
val
}
}
- fn to_immediate_scalar(&mut self, val: Self::Value, scalar: &Scalar) -> Self::Value;
+ fn to_immediate_scalar(&mut self, val: Self::Value, scalar: Scalar) -> Self::Value;
fn alloca(&mut self, ty: Self::Type, align: Align) -> Self::Value;
fn dynamic_alloca(&mut self, ty: Self::Type, align: Align) -> Self::Value;
dest: PlaceRef<'tcx, Self::Value>,
) -> Self;
- fn range_metadata(&mut self, load: Self::Value, range: Range<u128>);
+ fn range_metadata(&mut self, load: Self::Value, range: WrappingRange);
fn nonnull_metadata(&mut self, load: Self::Value);
fn store(&mut self, val: Self::Value, ptr: Self::Value, align: Align) -> Self::Value;
fn const_data_from_alloc(&self, alloc: &Allocation) -> Self::Value;
- fn scalar_to_backend(&self, cv: Scalar, layout: &abi::Scalar, llty: Self::Type) -> Self::Value;
+ fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, llty: Self::Type) -> Self::Value;
fn from_const_alloc(
&self,
layout: TyAndLayout<'tcx>,
self.write_scalar(Scalar::from_machine_usize(result, self), dest)?;
}
- sym::min_align_of
- | sym::pref_align_of
+ sym::pref_align_of
| sym::needs_drop
| sym::type_id
| sym::type_name
| sym::variant_count => {
let gid = GlobalId { instance, promoted: None };
let ty = match intrinsic_name {
- sym::min_align_of | sym::pref_align_of | sym::variant_count => {
- self.tcx.types.usize
- }
+ sym::pref_align_of | sym::variant_count => self.tcx.types.usize,
sym::needs_drop => self.tcx.types.bool,
sym::type_id => self.tcx.types.u64,
sym::type_name => self.tcx.mk_static_str(),
let val = self.read_scalar(&args[0])?.check_init()?;
let bits = val.to_bits(layout_of.size)?;
let kind = match layout_of.abi {
- Abi::Scalar(ref scalar) => scalar.value,
+ Abi::Scalar(scalar) => scalar.value,
_ => span_bug!(
self.cur_span(),
"{} called on invalid type {:?}",
&r,
)?;
let val = if overflowed {
- let num_bits = l.layout.size.bits();
+ let size = l.layout.size;
+ let num_bits = size.bits();
if l.layout.abi.is_signed() {
// For signed ints the saturated value depends on the sign of the first
// term since the sign of the second term can be inferred from this and
// unsigned
if is_add {
// max unsigned
- Scalar::from_uint(
- u128::MAX >> (128 - num_bits),
- Size::from_bits(num_bits),
- )
+ Scalar::from_uint(size.unsigned_int_max(), Size::from_bits(num_bits))
} else {
// underflow to 0
Scalar::from_uint(0u128, Size::from_bits(num_bits))
let scalar = alloc.read_scalar(alloc_range(Size::ZERO, mplace.layout.size))?;
Ok(Some(ImmTy { imm: scalar.into(), layout: mplace.layout }))
}
- Abi::ScalarPair(ref a, ref b) => {
+ Abi::ScalarPair(a, b) => {
// We checked `ptr_align` above, so all fields will have the alignment they need.
// We would anyway check against `ptr_align.restrict_for_offset(b_offset)`,
// which `ptr.offset(b_offset)` cannot possibly fail to satisfy.
- let (a, b) = (&a.value, &b.value);
+ let (a, b) = (a.value, b.value);
let (a_size, b_size) = (a.size(self), b.size(self));
let b_offset = a_size.align_to(b.align(self).abi);
assert!(b_offset.bytes() > 0); // we later use the offset to tell apart the fields
};
return Ok((discr, index));
}
- Variants::Multiple { ref tag, ref tag_encoding, tag_field, .. } => {
+ Variants::Multiple { tag, ref tag_encoding, tag_field, .. } => {
(tag, tag_encoding, tag_field)
}
};
// We would anyway check against `ptr_align.restrict_for_offset(b_offset)`,
// which `ptr.offset(b_offset)` cannot possibly fail to satisfy.
let (a, b) = match dest.layout.abi {
- Abi::ScalarPair(ref a, ref b) => (&a.value, &b.value),
+ Abi::ScalarPair(a, b) => (a.value, b.value),
_ => span_bug!(
self.cur_span(),
"write_immediate_to_mplace: invalid ScalarPair layout: {:#?}",
}
Variants::Multiple {
tag_encoding: TagEncoding::Direct,
- tag: ref tag_layout,
+ tag: tag_layout,
tag_field,
..
} => {
Variants::Multiple {
tag_encoding:
TagEncoding::Niche { dataful_variant, ref niche_variants, niche_start },
- tag: ref tag_layout,
+ tag: tag_layout,
tag_field,
..
} => {
M::box_alloc(self, &dest)?;
}
- NullaryOp(mir::NullOp::SizeOf, ty) => {
+ NullaryOp(null_op, ty) => {
let ty = self.subst_from_current_frame_and_normalize_erasing_regions(ty);
let layout = self.layout_of(ty)?;
if layout.is_unsized() {
// FIXME: This should be a span_bug (#80742)
self.tcx.sess.delay_span_bug(
self.frame().current_span(),
- &format!("SizeOf nullary MIR operator called for unsized type {}", ty),
+ &format!("Nullary MIR operator called for unsized type {}", ty),
);
throw_inval!(SizeOfUnsizedType(ty));
}
- self.write_scalar(Scalar::from_machine_usize(layout.size.bytes(), self), &dest)?;
+ let val = match null_op {
+ mir::NullOp::SizeOf => layout.size.bytes(),
+ mir::NullOp::AlignOf => layout.align.abi.bytes(),
+ mir::NullOp::Box => unreachable!(),
+ };
+ self.write_scalar(Scalar::from_machine_usize(val, self), &dest)?;
}
Cast(cast_kind, ref operand, cast_ty) => {
return false;
}
// Compare layout
- match (&caller.abi, &callee.abi) {
+ match (caller.abi, callee.abi) {
// Different valid ranges are okay (once we enforce validity,
// that will take care to make it UB to leave the range, just
// like for transmute).
- (abi::Abi::Scalar(ref caller), abi::Abi::Scalar(ref callee)) => {
- caller.value == callee.value
+ (abi::Abi::Scalar(caller), abi::Abi::Scalar(callee)) => caller.value == callee.value,
+ (abi::Abi::ScalarPair(caller1, caller2), abi::Abi::ScalarPair(callee1, callee2)) => {
+ caller1.value == callee1.value && caller2.value == callee2.value
}
- (
- abi::Abi::ScalarPair(ref caller1, ref caller2),
- abi::Abi::ScalarPair(ref callee1, ref callee2),
- ) => caller1.value == callee1.value && caller2.value == callee2.value,
// Be conservative
_ => false,
}
fn visit_scalar(
&mut self,
op: &OpTy<'tcx, M::PointerTag>,
- scalar_layout: &ScalarAbi,
+ scalar_layout: ScalarAbi,
) -> InterpResult<'tcx> {
- let value = self.read_scalar(op)?;
- let valid_range = scalar_layout.valid_range.clone();
- let WrappingRange { start: lo, end: hi } = valid_range;
- // Determine the allowed range
- // `max_hi` is as big as the size fits
- let max_hi = u128::MAX >> (128 - op.layout.size.bits());
- assert!(hi <= max_hi);
- // We could also write `(hi + 1) % (max_hi + 1) == lo` but `max_hi + 1` overflows for `u128`
- if (lo == 0 && hi == max_hi) || (hi + 1 == lo) {
+ if scalar_layout.valid_range.is_full_for(op.layout.size) {
// Nothing to check
return Ok(());
}
- // At least one value is excluded. Get the bits.
+ // At least one value is excluded.
+ let valid_range = scalar_layout.valid_range;
+ let WrappingRange { start, end } = valid_range;
+ let max_value = op.layout.size.unsigned_int_max();
+ assert!(end <= max_value);
+ // Determine the allowed range
+ let value = self.read_scalar(op)?;
let value = try_validation!(
value.check_init(),
self.path,
err_ub!(InvalidUninitBytes(None)) => { "{}", value }
- expected { "something {}", wrapping_range_format(valid_range, max_hi) },
+ expected { "something {}", wrapping_range_format(valid_range, max_value) },
);
let bits = match value.try_to_int() {
Err(_) => {
// So this is a pointer then, and casting to an int failed.
// Can only happen during CTFE.
let ptr = self.ecx.scalar_to_ptr(value);
- if lo == 1 && hi == max_hi {
+ if start == 1 && end == max_value {
// Only null is the niche. So make sure the ptr is NOT null.
if self.ecx.memory.ptr_may_be_null(ptr) {
throw_validation_failure!(self.path,
{ "a potentially null pointer" }
expected {
"something that cannot possibly fail to be {}",
- wrapping_range_format(valid_range, max_hi)
+ wrapping_range_format(valid_range, max_value)
}
)
}
{ "a pointer" }
expected {
"something that cannot possibly fail to be {}",
- wrapping_range_format(valid_range, max_hi)
+ wrapping_range_format(valid_range, max_value)
}
)
}
} else {
throw_validation_failure!(self.path,
{ "{}", bits }
- expected { "something {}", wrapping_range_format(valid_range, max_hi) }
+ expected { "something {}", wrapping_range_format(valid_range, max_value) }
)
}
}
{ "a value of uninhabited type {:?}", op.layout.ty }
);
}
- Abi::Scalar(ref scalar_layout) => {
+ Abi::Scalar(scalar_layout) => {
self.visit_scalar(op, scalar_layout)?;
}
Abi::ScalarPair { .. } | Abi::Vector { .. } => {
*/
#![feature(assert_matches)]
-#![cfg_attr(bootstrap, feature(bindings_after_at))]
#![feature(bool_to_option)]
#![feature(box_patterns)]
#![feature(control_flow_enum)]
}
}
- Rvalue::NullaryOp(NullOp::SizeOf, _) => {}
+ Rvalue::NullaryOp(NullOp::SizeOf | NullOp::AlignOf, _) => {}
Rvalue::NullaryOp(NullOp::Box, _) => self.check_op(ops::HeapAllocation),
Rvalue::UnaryOp(_, ref operand) => {
Rvalue::NullaryOp(op, _) => match op {
NullOp::Box => return Err(Unpromotable),
NullOp::SizeOf => {}
+ NullOp::AlignOf => {}
},
Rvalue::UnaryOp(op, operand) => {
where
G: ?Sized + DirectedGraph + WithNumNodes + WithSuccessors,
{
- pub fn new(graph: &'graph G, start_node: G::Node) -> Self {
- Self { graph, stack: vec![start_node], visited: BitSet::new_empty(graph.num_nodes()) }
+ pub fn new(graph: &'graph G) -> Self {
+ Self { graph, stack: vec![], visited: BitSet::new_empty(graph.num_nodes()) }
+ }
+
+ /// Version of `push_start_node` that is convenient for chained
+ /// use.
+ pub fn with_start_node(mut self, start_node: G::Node) -> Self {
+ self.push_start_node(start_node);
+ self
+ }
+
+ /// Pushes another start node onto the stack. If the node
+ /// has not already been visited, then you will be able to
+ /// walk its successors (and so forth) after the current
+ /// contents of the stack are drained. If multiple start nodes
+ /// are added into the walk, then their mutual successors
+ /// will all be walked. You can use this method once the
+ /// iterator has been completely drained to add additional
+ /// start nodes.
+ pub fn push_start_node(&mut self, start_node: G::Node) {
+ if self.visited.insert(start_node) {
+ self.stack.push(start_node);
+ }
+ }
+
+ /// Searches all nodes reachable from the current start nodes.
+ /// This is equivalent to just invoke `next` repeatedly until
+ /// you get a `None` result.
+ pub fn complete_search(&mut self) {
+ while let Some(_) = self.next() {}
+ }
+
+ /// Returns true if node has been visited thus far.
+ /// A node is considered "visited" once it is pushed
+ /// onto the internal stack; it may not yet have been yielded
+ /// from the iterator. This method is best used after
+ /// the iterator is completely drained.
+ pub fn visited(&self, node: G::Node) -> bool {
+ self.visited.contains(node)
+ }
+}
+
+impl<G> std::fmt::Debug for DepthFirstSearch<'_, G>
+where
+ G: ?Sized + DirectedGraph + WithNumNodes + WithSuccessors,
+{
+ fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ let mut f = fmt.debug_set();
+ for n in self.visited.iter() {
+ f.entry(&n);
+ }
+ f.finish()
}
}
assert!(!is_cyclic(&diamond_acyclic));
assert!(is_cyclic(&diamond_cyclic));
}
+
+#[test]
+fn dfs() {
+ let graph = TestGraph::new(0, &[(0, 1), (0, 2), (1, 3), (2, 3), (3, 0)]);
+
+ let result: Vec<usize> = DepthFirstSearch::new(&graph).with_start_node(0).collect();
+ assert_eq!(result, vec![0, 2, 3, 1]);
+}
+
+#[test]
+fn dfs_debug() {
+ let graph = TestGraph::new(0, &[(0, 1), (0, 2), (1, 3), (2, 3), (3, 0)]);
+ let mut dfs = DepthFirstSearch::new(&graph).with_start_node(0);
+ dfs.complete_search();
+ assert_eq!(format!("{{0, 1, 2, 3}}"), format!("{:?}", dfs));
+}
where
Self: WithNumNodes,
{
- iterate::DepthFirstSearch::new(self, from)
+ iterate::DepthFirstSearch::new(self).with_start_node(from)
}
}
#![feature(iter_map_while)]
#![feature(maybe_uninit_uninit_array)]
#![feature(min_specialization)]
-#![cfg_attr(bootstrap, feature(min_type_alias_impl_trait))]
-#![cfg_attr(not(bootstrap), feature(type_alias_impl_trait))]
+#![feature(never_type)]
+#![feature(type_alias_impl_trait)]
#![feature(new_uninit)]
#![feature(nll)]
#![feature(once_cell)]
impl_stable_hash_via_hash!(char);
impl_stable_hash_via_hash!(());
+impl<CTX> HashStable<CTX> for ! {
+ fn hash_stable(&self, _ctx: &mut CTX, _hasher: &mut StableHasher) {
+ unreachable!()
+ }
+}
+
impl<CTX> HashStable<CTX> for ::std::num::NonZeroU32 {
fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
self.get().hash_stable(ctx, hasher)
)
}
+ /// Show a suggestion that has multiple parts to it, always as it's own subdiagnostic.
+ /// In other words, multiple changes need to be applied as part of this suggestion.
+ pub fn multipart_suggestion_verbose(
+ &mut self,
+ msg: &str,
+ suggestion: Vec<(Span, String)>,
+ applicability: Applicability,
+ ) -> &mut Self {
+ self.multipart_suggestion_with_style(
+ msg,
+ suggestion,
+ applicability,
+ SuggestionStyle::ShowAlways,
+ )
+ }
/// [`Diagnostic::multipart_suggestion()`] but you can set the [`SuggestionStyle`].
pub fn multipart_suggestion_with_style(
&mut self,
self
}
+ /// See [`Diagnostic::multipart_suggestion()`].
+ pub fn multipart_suggestion_verbose(
+ &mut self,
+ msg: &str,
+ suggestion: Vec<(Span, String)>,
+ applicability: Applicability,
+ ) -> &mut Self {
+ if !self.0.allow_suggestions {
+ return self;
+ }
+ self.0.diagnostic.multipart_suggestion_verbose(msg, suggestion, applicability);
+ self
+ }
+
/// See [`Diagnostic::tool_only_multipart_suggestion()`].
pub fn tool_only_multipart_suggestion(
&mut self,
#![feature(format_args_capture)]
#![feature(iter_zip)]
#![feature(nll)]
-#![cfg_attr(bootstrap, allow(incomplete_features))] // if_let_guard
#[macro_use]
extern crate rustc_macros;
use rustc_attr::{self as attr, Deprecation, Stability};
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sync::{self, Lrc};
-use rustc_errors::{DiagnosticBuilder, ErrorReported};
+use rustc_errors::{Applicability, DiagnosticBuilder, ErrorReported};
use rustc_lint_defs::builtin::PROC_MACRO_BACK_COMPAT;
use rustc_lint_defs::BuiltinLintDiagnostics;
use rustc_parse::{self, nt_to_tokenstream, parser, MACRO_ARGUMENTS};
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::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId};
use rustc_span::source_map::SourceMap;
pub trait ResolverExpand {
fn next_node_id(&mut self) -> NodeId;
+ fn invocation_parent(&self, id: LocalExpnId) -> LocalDefId;
fn resolve_dollar_crates(&mut self);
fn visit_ast_fragment_with_placeholders(
}
/// Extracts a string literal from the macro expanded version of `expr`,
-/// emitting `err_msg` if `expr` is not a string literal. This does not stop
-/// compilation on error, merely emits a non-fatal error and returns `None`.
+/// returning a diagnostic error of `err_msg` if `expr` is not a string literal.
+/// The returned bool indicates whether an applicable suggestion has already been
+/// added to the diagnostic to avoid emitting multiple suggestions. `Err(None)`
+/// indicates that an ast error was encountered.
pub fn expr_to_spanned_string<'a>(
cx: &'a mut ExtCtxt<'_>,
expr: P<ast::Expr>,
err_msg: &str,
-) -> Result<(Symbol, ast::StrStyle, Span), Option<DiagnosticBuilder<'a>>> {
+) -> Result<(Symbol, ast::StrStyle, Span), Option<(DiagnosticBuilder<'a>, bool)>> {
// Perform eager expansion on the expression.
// We want to be able to handle e.g., `concat!("foo", "bar")`.
let expr = cx.expander().fully_expand_fragment(AstFragment::Expr(expr)).make_expr();
Err(match expr.kind {
ast::ExprKind::Lit(ref l) => match l.kind {
ast::LitKind::Str(s, style) => return Ok((s, style, expr.span)),
+ ast::LitKind::ByteStr(_) => {
+ let mut err = cx.struct_span_err(l.span, err_msg);
+ err.span_suggestion(
+ expr.span.shrink_to_lo(),
+ "consider removing the leading `b`",
+ String::new(),
+ Applicability::MaybeIncorrect,
+ );
+ Some((err, true))
+ }
ast::LitKind::Err(_) => None,
- _ => Some(cx.struct_span_err(l.span, err_msg)),
+ _ => Some((cx.struct_span_err(l.span, err_msg), false)),
},
ast::ExprKind::Err => None,
- _ => Some(cx.struct_span_err(expr.span, err_msg)),
+ _ => Some((cx.struct_span_err(expr.span, err_msg), false)),
})
}
+/// Extracts a string literal from the macro expanded version of `expr`,
+/// emitting `err_msg` if `expr` is not a string literal. This does not stop
+/// compilation on error, merely emits a non-fatal error and returns `None`.
pub fn expr_to_string(
cx: &mut ExtCtxt<'_>,
expr: P<ast::Expr>,
) -> Option<(Symbol, ast::StrStyle)> {
expr_to_spanned_string(cx, expr, err_msg)
.map_err(|err| {
- err.map(|mut err| {
+ err.map(|(mut err, _)| {
err.emit();
})
})
// Resolve `$crate`s in the fragment for pretty-printing.
self.cx.resolver.resolve_dollar_crates();
- let invocations = {
+ let mut invocations = {
let mut collector = InvocationCollector {
// 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
self.cx
.resolver
.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)
-#![cfg_attr(bootstrap, feature(bindings_after_at))]
#![feature(crate_visibility_modifier)]
#![feature(decl_macro)]
#![feature(destructuring_assignment)]
#![feature(proc_macro_internals)]
#![feature(proc_macro_span)]
#![feature(try_blocks)]
-#![cfg_attr(bootstrap, allow(incomplete_features))] // if_let_guard
#![recursion_limit = "256"]
#[macro_use]
self.sess.source_map().lookup_char_pos(span.lo()).file
}
fn parent(&mut self, span: Self::Span) -> Option<Self::Span> {
- span.parent()
+ span.parent_callsite()
}
fn source(&mut self, span: Self::Span) -> Self::Span {
span.source_callsite()
let loc = self.sess.source_map().lookup_char_pos(span.hi());
LineColumn { line: loc.line, column: loc.col.to_usize() }
}
+ fn before(&mut self, span: Self::Span) -> Self::Span {
+ span.shrink_to_lo()
+ }
+ fn after(&mut self, span: Self::Span) -> Self::Span {
+ span.shrink_to_hi()
+ }
fn join(&mut self, first: Self::Span, second: Self::Span) -> Option<Self::Span> {
let self_loc = self.sess.source_map().lookup_char_pos(first.lo());
let other_loc = self.sess.source_map().lookup_char_pos(second.lo());
since: $ver,
issue: to_nonzero($issue),
edition: None,
- description: concat!($($doc,)*),
}
),+
];
since: $ver,
issue: to_nonzero($issue),
edition: $edition,
- description: concat!($($doc,)*),
}
),+];
),
// Enumerates "identity-like" conversion methods to suggest on type mismatch.
rustc_attr!(rustc_conversion_suggestion, Normal, template!(Word), INTERNAL_UNSTABLE),
+ // Prevents field reads in the marked trait or method to be considered
+ // during dead code analysis.
+ rustc_attr!(rustc_trivial_field_reads, Normal, template!(Word), INTERNAL_UNSTABLE),
// ==========================================================================
// Internal attributes, Const related:
pub since: &'static str,
issue: Option<NonZeroU32>,
pub edition: Option<Edition>,
- description: &'static str,
}
#[derive(Copy, Clone, Debug)]
since: $ver,
issue: to_nonzero($issue),
edition: None,
- description: concat!($($doc,)*),
}
),+
];
since: $ver,
issue: to_nonzero($issue),
edition: None,
- description: concat!($($doc,)*),
}
),+
];
}
}
+ #[track_caller]
+ pub fn expect_non_local<OtherId>(self) -> Res<OtherId> {
+ self.map_id(|_| panic!("unexpected `Res::Local`"))
+ }
+
pub fn macro_kind(self) -> Option<MacroKind> {
match self {
Res::Def(DefKind::Macro(kind), _) => Some(kind),
use rustc_index::vec::IndexVec;
use rustc_span::hygiene::ExpnId;
use rustc_span::symbol::{kw, sym, Symbol};
+use rustc_span::Span;
use std::fmt::{self, Write};
use std::hash::Hash;
/// Item with a given `LocalDefId` was defined during macro expansion with ID `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
}
/// 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 {
parent: None,
disambiguated_data: DisambiguatedDefPathData {
let root = LocalDefId { local_def_index: table.allocate(key, def_path_hash) };
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 {
table,
def_id_to_hir_id: Default::default(),
hir_id_to_def_id: Default::default(),
expansions_that_defined: Default::default(),
+ def_id_to_span,
}
}
data: DefPathData,
expn_id: ExpnId,
mut next_disambiguator: impl FnMut(LocalDefId, DefPathData) -> u32,
+ span: Span,
) -> LocalDefId {
debug!("create_def(parent={:?}, data={:?}, expn_id={:?})", parent, data, 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
}
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> + '_ {
self.def_id_to_hir_id.iter_enumerated().map(|(k, _)| k)
}
self.maybe_print_comment(st.span.lo());
match st.kind {
hir::StmtKind::Local(ref loc) => {
- self.print_local(loc.init.as_deref(), |this| this.print_local_decl(&loc));
+ self.print_local(loc.init, |this| this.print_local_decl(&loc));
}
hir::StmtKind::Item(item) => self.ann.nested(self, Nested::Item(item)),
hir::StmtKind::Expr(ref expr) => {
);
err.span_suggestion(
generics.where_clause.tail_span_for_suggestion(),
- "consider adding a where clause".into(),
+ "consider adding a where clause",
suggestion,
Applicability::MaybeIncorrect,
);
use crate::infer::error_reporting::nice_region_error::NiceRegionError;
use crate::infer::lexical_region_resolve::RegionResolutionError;
-use crate::infer::{Subtype, ValuePairs};
+use crate::infer::{SubregionOrigin, Subtype, ValuePairs};
use crate::traits::ObligationCauseCode::CompareImplMethodObligation;
use rustc_errors::ErrorReported;
use rustc_hir as hir;
use rustc_hir::intravisit::Visitor;
use rustc_middle::ty::error::ExpectedFound;
use rustc_middle::ty::{self, Ty, TyCtxt};
-use rustc_span::{MultiSpan, Span};
+use rustc_span::{MultiSpan, Span, Symbol};
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
/// Print the error message for lifetime errors when the `impl` doesn't conform to the `trait`.
pub(super) fn try_report_impl_not_conforming_to_trait(&self) -> Option<ErrorReported> {
- if let Some(ref error) = self.error {
- debug!("try_report_impl_not_conforming_to_trait {:?}", error);
- if let RegionResolutionError::SubSupConflict(
- _,
- var_origin,
- sub_origin,
- _sub,
- sup_origin,
- _sup,
- ) = error.clone()
- {
- if let (&Subtype(ref sup_trace), &Subtype(ref sub_trace)) =
- (&sup_origin, &sub_origin)
+ let error = self.error.as_ref()?;
+ debug!("try_report_impl_not_conforming_to_trait {:?}", error);
+ if let RegionResolutionError::SubSupConflict(
+ _,
+ var_origin,
+ sub_origin,
+ _sub,
+ sup_origin,
+ _sup,
+ ) = error.clone()
+ {
+ if let (&Subtype(ref sup_trace), &Subtype(ref sub_trace)) = (&sup_origin, &sub_origin) {
+ if let (
+ ValuePairs::Types(sub_expected_found),
+ ValuePairs::Types(sup_expected_found),
+ CompareImplMethodObligation { trait_item_def_id, .. },
+ ) = (&sub_trace.values, &sup_trace.values, &sub_trace.cause.code)
{
- if let (
- ValuePairs::Types(sub_expected_found),
- ValuePairs::Types(sup_expected_found),
- CompareImplMethodObligation { trait_item_def_id, .. },
- ) = (&sub_trace.values, &sup_trace.values, &sub_trace.cause.code)
- {
- if sup_expected_found == sub_expected_found {
- self.emit_err(
- var_origin.span(),
- sub_expected_found.expected,
- sub_expected_found.found,
- *trait_item_def_id,
- );
- return Some(ErrorReported);
- }
+ if sup_expected_found == sub_expected_found {
+ self.emit_err(
+ var_origin.span(),
+ sub_expected_found.expected,
+ sub_expected_found.found,
+ *trait_item_def_id,
+ );
+ return Some(ErrorReported);
}
}
}
}
+ if let RegionResolutionError::ConcreteFailure(origin, _, _) = error.clone() {
+ if let SubregionOrigin::CompareImplTypeObligation {
+ span,
+ item_name,
+ impl_item_def_id,
+ trait_item_def_id,
+ } = origin
+ {
+ self.emit_associated_type_err(span, item_name, impl_item_def_id, trait_item_def_id);
+ return Some(ErrorReported);
+ }
+ }
None
}
}
err.emit();
}
+
+ fn emit_associated_type_err(
+ &self,
+ span: Span,
+ item_name: Symbol,
+ impl_item_def_id: DefId,
+ trait_item_def_id: DefId,
+ ) {
+ let impl_sp = self.tcx().def_span(impl_item_def_id);
+ let trait_sp = self.tcx().def_span(trait_item_def_id);
+ let mut err = self
+ .tcx()
+ .sess
+ .struct_span_err(span, &format!("`impl` associated type signature for `{}` doesn't match `trait` associated type signature", item_name));
+ err.span_label(impl_sp, &format!("found"));
+ err.span_label(trait_sp, &format!("expected"));
+
+ err.emit();
+ }
}
struct TypeParamSpanVisitor<'tcx> {
"...so that the definition in impl matches the definition from the trait",
);
}
+ infer::CompareImplTypeObligation { span, .. } => {
+ label_or_note(
+ span,
+ "...so that the definition in impl matches the definition from the trait",
+ );
+ }
}
}
trait_item_def_id,
&format!("`{}: {}`", sup, sub),
),
+ infer::CompareImplTypeObligation {
+ span,
+ item_name,
+ impl_item_def_id,
+ trait_item_def_id,
+ } => self.report_extra_impl_obligation(
+ span,
+ item_name,
+ impl_item_def_id,
+ trait_item_def_id,
+ &format!("`{}: {}`", sup, sub),
+ ),
}
}
impl_item_def_id: DefId,
trait_item_def_id: DefId,
},
+
+ /// Comparing the signature and requirements of an impl associated type
+ /// against the containing trait
+ CompareImplTypeObligation {
+ span: Span,
+ item_name: Symbol,
+ impl_item_def_id: DefId,
+ trait_item_def_id: DefId,
+ },
}
// `SubregionOrigin` is used a lot. Make sure it doesn't unintentionally get bigger.
ReferenceOutlivesReferent(_, a) => a,
CallReturn(a) => a,
CompareImplMethodObligation { span, .. } => span,
+ CompareImplTypeObligation { span, .. } => span,
}
}
trait_item_def_id,
},
+ traits::ObligationCauseCode::CompareImplTypeObligation {
+ item_name,
+ impl_item_def_id,
+ trait_item_def_id,
+ } => SubregionOrigin::CompareImplTypeObligation {
+ span: cause.span,
+ item_name,
+ impl_item_def_id,
+ trait_item_def_id,
+ },
+
_ => default(),
}
}
let old_ambient_variance = self.ambient_variance;
self.ambient_variance = self.ambient_variance.xform(variance);
- self.ambient_variance_info = self.ambient_variance_info.clone().xform(info);
+ self.ambient_variance_info = self.ambient_variance_info.xform(info);
debug!("relate_with_variance: ambient_variance = {:?}", self.ambient_variance);
if self.ambient_covariance() {
// Covariance: a <= b. Hence, `b: a`.
- self.push_outlives(v_b, v_a, self.ambient_variance_info.clone());
+ self.push_outlives(v_b, v_a, self.ambient_variance_info);
}
if self.ambient_contravariance() {
// Contravariant: b <= a. Hence, `a: b`.
- self.push_outlives(v_a, v_b, self.ambient_variance_info.clone());
+ self.push_outlives(v_a, v_b, self.ambient_variance_info);
}
Ok(a)
})
}
+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
/// in `rustc_middle` otherwise. It is used to when diagnostic messages are
/// emitted and stores them in the current query, if there is one.
/// TyCtxt in.
pub fn setup_callbacks() {
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<'_>) -> _));
TRACK_DIAGNOSTICS.swap(&(track_diagnostic as fn(&_)));
}
tracked!(no_profiler_runtime, true);
tracked!(osx_rpath_install_name, true);
tracked!(panic_abort_tests, true);
+ tracked!(panic_in_drop, PanicStrategy::Abort);
tracked!(partially_uninit_const_threshold, Some(123));
tracked!(plt, Some(true));
tracked!(polonius, true);
};
let (variants, tag) = match layout.variants {
Variants::Multiple {
- tag_encoding: TagEncoding::Direct,
- ref tag,
- ref variants,
- ..
+ tag_encoding: TagEncoding::Direct, tag, ref variants, ..
} => (variants, tag),
_ => return,
};
use rustc_ast as ast;
use rustc_ast::util::{classify, parser};
use rustc_ast::{ExprKind, StmtKind};
-use rustc_ast_pretty::pprust;
use rustc_errors::{pluralize, Applicability};
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res};
use rustc_middle::ty::{self, Ty};
use rustc_span::symbol::Symbol;
use rustc_span::symbol::{kw, sym};
-use rustc_span::{BytePos, Span, DUMMY_SP};
+use rustc_span::{BytePos, MultiSpan, Span, DUMMY_SP};
declare_lint! {
/// The `unused_must_use` lint detects unused result of a type flagged as
left_pos: Option<BytePos>,
right_pos: Option<BytePos>,
) {
- let expr_text = if let Ok(snippet) = cx.sess().source_map().span_to_snippet(value.span) {
- snippet
- } else {
- pprust::expr_to_string(value)
+ let spans = match value.kind {
+ ast::ExprKind::Block(ref block, None) if block.stmts.len() > 0 => {
+ let start = block.stmts[0].span;
+ let end = block.stmts[block.stmts.len() - 1].span;
+ if value.span.from_expansion() || start.from_expansion() || end.from_expansion() {
+ (
+ value.span.with_hi(value.span.lo() + BytePos(1)),
+ value.span.with_lo(value.span.hi() - BytePos(1)),
+ )
+ } else {
+ (value.span.with_hi(start.lo()), value.span.with_lo(end.hi()))
+ }
+ }
+ ast::ExprKind::Paren(ref expr) => {
+ if value.span.from_expansion() || expr.span.from_expansion() {
+ (
+ value.span.with_hi(value.span.lo() + BytePos(1)),
+ value.span.with_lo(value.span.hi() - BytePos(1)),
+ )
+ } else {
+ (value.span.with_hi(expr.span.lo()), value.span.with_lo(expr.span.hi()))
+ }
+ }
+ _ => return,
};
let keep_space = (
left_pos.map_or(false, |s| s >= value.span.lo()),
right_pos.map_or(false, |s| s <= value.span.hi()),
);
- self.emit_unused_delims(cx, value.span, &expr_text, ctx.into(), keep_space);
+ self.emit_unused_delims(cx, spans, ctx.into(), keep_space);
}
fn emit_unused_delims(
&self,
cx: &EarlyContext<'_>,
- span: Span,
- pattern: &str,
+ spans: (Span, Span),
msg: &str,
keep_space: (bool, bool),
) {
// FIXME(flip1995): Quick and dirty fix for #70814. This should be fixed in rustdoc
// properly.
- if span == DUMMY_SP {
+ if spans.0 == DUMMY_SP || spans.1 == DUMMY_SP {
return;
}
- cx.struct_span_lint(self.lint(), span, |lint| {
+ cx.struct_span_lint(self.lint(), MultiSpan::from(vec![spans.0, spans.1]), |lint| {
let span_msg = format!("unnecessary {} around {}", Self::DELIM_STR, msg);
let mut err = lint.build(&span_msg);
- let mut ate_left_paren = false;
- let mut ate_right_paren = false;
- let parens_removed = pattern
- .trim_matches(|c| match c {
- '(' | '{' => {
- if ate_left_paren {
- false
- } else {
- ate_left_paren = true;
- true
- }
- }
- ')' | '}' => {
- if ate_right_paren {
- false
- } else {
- ate_right_paren = true;
- true
- }
- }
- _ => false,
- })
- .trim();
-
- let replace = {
- let mut replace = if keep_space.0 {
- let mut s = String::from(" ");
- s.push_str(parens_removed);
- s
- } else {
- String::from(parens_removed)
- };
-
- if keep_space.1 {
- replace.push(' ');
- }
- replace
- };
-
+ let replacement = vec![
+ (spans.0, if keep_space.0 { " ".into() } else { "".into() }),
+ (spans.1, if keep_space.1 { " ".into() } else { "".into() }),
+ ];
let suggestion = format!("remove these {}", Self::DELIM_STR);
-
- err.span_suggestion_short(span, &suggestion, replace, Applicability::MachineApplicable);
+ err.multipart_suggestion(&suggestion, replacement, Applicability::MachineApplicable);
err.emit();
});
}
// Otherwise proceed with linting.
_ => {}
}
-
- let pattern_text =
- if let Ok(snippet) = cx.sess().source_map().span_to_snippet(value.span) {
- snippet
- } else {
- pprust::pat_to_string(value)
- };
- self.emit_unused_delims(cx, value.span, &pattern_text, "pattern", (false, false));
+ let spans = if value.span.from_expansion() || inner.span.from_expansion() {
+ (
+ value.span.with_hi(value.span.lo() + BytePos(1)),
+ value.span.with_lo(value.span.hi() - BytePos(1)),
+ )
+ } else {
+ (value.span.with_hi(inner.span.lo()), value.span.with_lo(inner.span.hi()))
+ };
+ self.emit_unused_delims(cx, spans, "pattern", (false, false));
}
}
}
);
}
_ => {
- let pattern_text =
- if let Ok(snippet) = cx.sess().source_map().span_to_snippet(ty.span) {
- snippet
- } else {
- pprust::ty_to_string(ty)
- };
-
- self.emit_unused_delims(cx, ty.span, &pattern_text, "type", (false, false));
+ let spans = if ty.span.from_expansion() || r.span.from_expansion() {
+ (
+ ty.span.with_hi(ty.span.lo() + BytePos(1)),
+ ty.span.with_lo(ty.span.hi() - BytePos(1)),
+ )
+ } else {
+ (ty.span.with_hi(r.span.lo()), ty.span.with_lo(r.span.hi()))
+ };
+ self.emit_unused_delims(cx, spans, "type", (false, false));
}
}
}
report_fatal_error("bad AttributeKind");
}
+template<typename T> static inline void AddAttribute(T *t, unsigned Index, Attribute Attr) {
+#if LLVM_VERSION_LT(14, 0)
+ t->addAttribute(Index, Attr);
+#else
+ t->addAttributeAtIndex(Index, Attr);
+#endif
+}
+
extern "C" void LLVMRustAddCallSiteAttribute(LLVMValueRef Instr, unsigned Index,
LLVMRustAttribute RustAttr) {
CallBase *Call = unwrap<CallBase>(Instr);
Attribute Attr = Attribute::get(Call->getContext(), fromRust(RustAttr));
- Call->addAttribute(Index, Attr);
+ AddAttribute(Call, Index, Attr);
}
extern "C" void LLVMRustAddCallSiteAttrString(LLVMValueRef Instr, unsigned Index,
const char *Name) {
CallBase *Call = unwrap<CallBase>(Instr);
Attribute Attr = Attribute::get(Call->getContext(), Name);
- Call->addAttribute(Index, Attr);
+ AddAttribute(Call, Index, Attr);
}
-
extern "C" void LLVMRustAddAlignmentCallSiteAttr(LLVMValueRef Instr,
unsigned Index,
uint32_t Bytes) {
CallBase *Call = unwrap<CallBase>(Instr);
- AttrBuilder B;
- B.addAlignmentAttr(Bytes);
- Call->setAttributes(Call->getAttributes().addAttributes(
- Call->getContext(), Index, B));
+ Attribute Attr = Attribute::getWithAlignment(Call->getContext(), Align(Bytes));
+ AddAttribute(Call, Index, Attr);
}
extern "C" void LLVMRustAddDereferenceableCallSiteAttr(LLVMValueRef Instr,
unsigned Index,
uint64_t Bytes) {
CallBase *Call = unwrap<CallBase>(Instr);
- AttrBuilder B;
- B.addDereferenceableAttr(Bytes);
- Call->setAttributes(Call->getAttributes().addAttributes(
- Call->getContext(), Index, B));
+ Attribute Attr = Attribute::getWithDereferenceableBytes(Call->getContext(), Bytes);
+ AddAttribute(Call, Index, Attr);
}
extern "C" void LLVMRustAddDereferenceableOrNullCallSiteAttr(LLVMValueRef Instr,
unsigned Index,
uint64_t Bytes) {
CallBase *Call = unwrap<CallBase>(Instr);
- AttrBuilder B;
- B.addDereferenceableOrNullAttr(Bytes);
- Call->setAttributes(Call->getAttributes().addAttributes(
- Call->getContext(), Index, B));
+ Attribute Attr = Attribute::getWithDereferenceableOrNullBytes(Call->getContext(), Bytes);
+ AddAttribute(Call, Index, Attr);
}
extern "C" void LLVMRustAddByValCallSiteAttr(LLVMValueRef Instr, unsigned Index,
LLVMTypeRef Ty) {
CallBase *Call = unwrap<CallBase>(Instr);
Attribute Attr = Attribute::getWithByValType(Call->getContext(), unwrap(Ty));
- Call->addAttribute(Index, Attr);
+ AddAttribute(Call, Index, Attr);
}
extern "C" void LLVMRustAddStructRetCallSiteAttr(LLVMValueRef Instr, unsigned Index,
#else
Attribute Attr = Attribute::get(Call->getContext(), Attribute::StructRet);
#endif
- Call->addAttribute(Index, Attr);
+ AddAttribute(Call, Index, Attr);
}
extern "C" void LLVMRustAddFunctionAttribute(LLVMValueRef Fn, unsigned Index,
LLVMRustAttribute RustAttr) {
Function *A = unwrap<Function>(Fn);
Attribute Attr = Attribute::get(A->getContext(), fromRust(RustAttr));
- A->addAttribute(Index, Attr);
+ AddAttribute(A, Index, Attr);
}
extern "C" void LLVMRustAddAlignmentAttr(LLVMValueRef Fn,
unsigned Index,
uint32_t Bytes) {
Function *A = unwrap<Function>(Fn);
- A->addAttribute(Index, Attribute::getWithAlignment(
+ AddAttribute(A, Index, Attribute::getWithAlignment(
A->getContext(), llvm::Align(Bytes)));
}
extern "C" void LLVMRustAddDereferenceableAttr(LLVMValueRef Fn, unsigned Index,
uint64_t Bytes) {
Function *A = unwrap<Function>(Fn);
- A->addAttribute(Index, Attribute::getWithDereferenceableBytes(A->getContext(),
+ AddAttribute(A, Index, Attribute::getWithDereferenceableBytes(A->getContext(),
Bytes));
}
unsigned Index,
uint64_t Bytes) {
Function *A = unwrap<Function>(Fn);
- A->addAttribute(Index, Attribute::getWithDereferenceableOrNullBytes(
+ AddAttribute(A, Index, Attribute::getWithDereferenceableOrNullBytes(
A->getContext(), Bytes));
}
LLVMTypeRef Ty) {
Function *F = unwrap<Function>(Fn);
Attribute Attr = Attribute::getWithByValType(F->getContext(), unwrap(Ty));
- F->addAttribute(Index, Attr);
+ AddAttribute(F, Index, Attr);
}
extern "C" void LLVMRustAddStructRetAttr(LLVMValueRef Fn, unsigned Index,
#else
Attribute Attr = Attribute::get(F->getContext(), Attribute::StructRet);
#endif
- F->addAttribute(Index, Attr);
+ AddAttribute(F, Index, Attr);
}
extern "C" void LLVMRustAddFunctionAttrStringValue(LLVMValueRef Fn,
const char *Name,
const char *Value) {
Function *F = unwrap<Function>(Fn);
- F->addAttribute(Index, Attribute::get(
+ AddAttribute(F, Index, Attribute::get(
F->getContext(), StringRef(Name), StringRef(Value)));
}
Attribute Attr = Attribute::get(F->getContext(), fromRust(RustAttr));
AttrBuilder B(Attr);
auto PAL = F->getAttributes();
- auto PALNew = PAL.removeAttributes(F->getContext(), Index, B);
+ AttributeList PALNew;
+#if LLVM_VERSION_LT(14, 0)
+ PALNew = PAL.removeAttributes(F->getContext(), Index, B);
+#else
+ PALNew = PAL.removeAttributesAtIndex(F->getContext(), Index, B);
+#endif
F->setAttributes(PALNew);
}
span_idx = Some(syn::Index::from(idx));
} else {
throw_span_err!(
- info.span.clone().unwrap(),
+ info.span.unwrap(),
"type of field annotated with `#[suggestion(...)]` contains more than one Span"
);
}
applicability_idx = Some(syn::Index::from(idx));
} else {
throw_span_err!(
- info.span.clone().unwrap(),
+ info.span.unwrap(),
"type of field annotated with `#[suggestion(...)]` contains more than one Applicability"
);
}
return Ok((span, applicability));
}
throw_span_err!(
- info.span.clone().unwrap(),
+ info.span.unwrap(),
"wrong types for suggestion",
|diag| {
diag.help("#[suggestion(...)] on a tuple field must be applied to fields of type (Span, Applicability)")
);
}
_ => throw_span_err!(
- info.span.clone().unwrap(),
+ info.span.unwrap(),
"wrong field type for suggestion",
|diag| {
diag.help("#[suggestion(...)] should be applied to fields of type Span or (Span, Applicability)")
continue;
}
let cnum = CrateNum::new(i + 1);
- let found_strategy = tcx.panic_strategy(cnum);
- let is_compiler_builtins = tcx.is_compiler_builtins(cnum);
- if is_compiler_builtins || desired_strategy == found_strategy {
+ if tcx.is_compiler_builtins(cnum) {
continue;
}
- sess.err(&format!(
- "the crate `{}` is compiled with the \
+ let found_strategy = tcx.panic_strategy(cnum);
+ if desired_strategy != found_strategy {
+ sess.err(&format!(
+ "the crate `{}` is compiled with the \
panic strategy `{}` which is \
incompatible with this crate's \
strategy of `{}`",
- tcx.crate_name(cnum),
- found_strategy.desc(),
- desired_strategy.desc()
- ));
+ tcx.crate_name(cnum),
+ found_strategy.desc(),
+ desired_strategy.desc()
+ ));
+ }
+
+ let found_drop_strategy = tcx.panic_in_drop_strategy(cnum);
+ if tcx.sess.opts.debugging_opts.panic_in_drop != found_drop_strategy {
+ sess.err(&format!(
+ "the crate `{}` is compiled with the \
+ panic-in-drop strategy `{}` which is \
+ incompatible with this crate's \
+ strategy of `{}`",
+ tcx.crate_name(cnum),
+ found_drop_strategy.desc(),
+ tcx.sess.opts.debugging_opts.panic_in_drop.desc()
+ ));
+ }
}
}
}
== Symbol::intern(&sess.opts.debugging_opts.profiler_runtime)
{
err.note(&"the compiler may have been built without the profiler runtime");
+ } else if crate_name.as_str().starts_with("rustc_") {
+ err.help(
+ "maybe you need to install the missing components with: \
+ `rustup component add rust-src rustc-dev llvm-tools-preview`",
+ );
}
err.span_label(span, "can't find crate");
err
use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
use rustc_middle::mir::interpret::{AllocDecodingSession, AllocDecodingState};
use rustc_middle::mir::{self, Body, Promoted};
+use rustc_middle::thir;
use rustc_middle::ty::codec::TyDecoder;
use rustc_middle::ty::{self, Ty, TyCtxt, Visibility};
use rustc_serialize::{opaque, Decodable, Decoder};
let hi =
(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))
}
}
-impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for &'tcx [mir::abstract_const::Node<'tcx>] {
+impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for &'tcx [thir::abstract_const::Node<'tcx>] {
fn decode(d: &mut DecodeContext<'a, 'tcx>) -> Result<Self, String> {
ty::codec::RefDecodable::decode(d)
}
}
/// Iterates over each child of the given item.
- fn each_child_of_item<F>(&self, id: DefIndex, mut callback: F, sess: &Session)
- where
- F: FnMut(Export<hir::HirId>),
- {
+ fn each_child_of_item(&self, id: DefIndex, mut callback: impl FnMut(Export), sess: &Session) {
if let Some(data) = &self.root.proc_macro_data {
/* If we are loading as a proc macro, we want to return the view of this crate
* as a proc macro crate.
.decode((self, tcx))
}
- fn get_mir_abstract_const(
+ fn get_thir_abstract_const(
&self,
tcx: TyCtxt<'tcx>,
id: DefIndex,
- ) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
+ ) -> Result<Option<&'tcx [thir::abstract_const::Node<'tcx>]>, ErrorReported> {
self.root
.tables
- .mir_abstract_consts
+ .thir_abstract_consts
.get(self, id)
.map_or(Ok(None), |v| Ok(Some(v.decode((self, tcx)))))
}
use rustc_ast as ast;
use rustc_data_structures::stable_map::FxHashMap;
-use rustc_hir as hir;
use rustc_hir::def::{CtorKind, DefKind};
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc_hir::definitions::{DefKey, DefPath, DefPathHash};
optimized_mir => { tcx.arena.alloc(cdata.get_optimized_mir(tcx, def_id.index)) }
mir_for_ctfe => { tcx.arena.alloc(cdata.get_mir_for_ctfe(tcx, def_id.index)) }
promoted_mir => { tcx.arena.alloc(cdata.get_promoted_mir(tcx, def_id.index)) }
- mir_abstract_const => { cdata.get_mir_abstract_const(tcx, def_id.index) }
+ thir_abstract_const => { cdata.get_thir_abstract_const(tcx, def_id.index) }
unused_generic_params => { cdata.get_unused_generic_params(def_id.index) }
const_param_default => { tcx.mk_const(cdata.get_const_param_default(tcx, def_id.index)) }
mir_const_qualif => { cdata.mir_const_qualif(def_id.index) }
has_panic_handler => { cdata.root.has_panic_handler }
is_profiler_runtime => { cdata.root.profiler_runtime }
panic_strategy => { cdata.root.panic_strategy }
+ panic_in_drop_strategy => { cdata.root.panic_in_drop_strategy }
extern_crate => {
let r = *cdata.extern_crate.lock();
r.map(|c| &*tcx.arena.alloc(c))
// (restrict scope of mutable-borrow of `visible_parent_map`)
{
let visible_parent_map = &mut visible_parent_map;
- let mut add_child =
- |bfs_queue: &mut VecDeque<_>, child: &Export<hir::HirId>, parent: DefId| {
- if child.vis != ty::Visibility::Public {
- return;
- }
+ let mut add_child = |bfs_queue: &mut VecDeque<_>, child: &Export, parent: DefId| {
+ if child.vis != ty::Visibility::Public {
+ return;
+ }
- if let Some(child) = child.res.opt_def_id() {
- match visible_parent_map.entry(child) {
- Entry::Occupied(mut entry) => {
- // If `child` is defined in crate `cnum`, ensure
- // that it is mapped to a parent in `cnum`.
- if child.is_local() && entry.get().is_local() {
- entry.insert(parent);
- }
- }
- Entry::Vacant(entry) => {
+ if let Some(child) = child.res.opt_def_id() {
+ match visible_parent_map.entry(child) {
+ Entry::Occupied(mut entry) => {
+ // If `child` is defined in crate `cnum`, ensure
+ // that it is mapped to a parent in `cnum`.
+ if child.is_local() && entry.get().is_local() {
entry.insert(parent);
- bfs_queue.push_back(child);
}
}
+ Entry::Vacant(entry) => {
+ entry.insert(parent);
+ bfs_queue.push_back(child);
+ }
}
- };
+ }
+ };
while let Some(def) = bfs_queue.pop_front() {
for child in tcx.item_children(def).iter() {
self.get_crate_data(def.krate).get_visibility(def.index)
}
- pub fn item_children_untracked(
- &self,
- def_id: DefId,
- sess: &Session,
- ) -> Vec<Export<hir::HirId>> {
+ pub fn item_children_untracked(&self, def_id: DefId, sess: &Session) -> Vec<Export> {
let mut result = vec![];
self.get_crate_data(def_id.krate).each_child_of_item(
def_id.index,
metadata_symbol_name, ExportedSymbol, SymbolExportLevel,
};
use rustc_middle::mir::interpret;
+use rustc_middle::thir;
use rustc_middle::traits::specialization_graph;
use rustc_middle::ty::codec::TyEncoder;
use rustc_middle::ty::{self, SymbolName, Ty, TyCtxt};
}
}
-impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for &'tcx [mir::abstract_const::Node<'tcx>] {
+impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for &'tcx [thir::abstract_const::Node<'tcx>] {
fn encode(&self, s: &mut EncodeContext<'a, 'tcx>) -> opaque::EncodeResult {
(**self).encode(s)
}
hash: tcx.crate_hash(LOCAL_CRATE),
stable_crate_id: tcx.def_path_hash(LOCAL_CRATE.as_def_id()).stable_crate_id(),
panic_strategy: tcx.sess.panic_strategy(),
+ panic_in_drop_strategy: tcx.sess.opts.debugging_opts.panic_in_drop,
edition: tcx.sess.edition(),
has_global_allocator: tcx.has_global_allocator(LOCAL_CRATE),
has_panic_handler: tcx.has_panic_handler(LOCAL_CRATE),
// items - we encode information about proc-macros later on.
let reexports = if !self.is_proc_macro {
match tcx.module_exports(local_def_id) {
- Some(exports) => {
- let hir = self.tcx.hir();
- self.lazy(
- exports
- .iter()
- .map(|export| export.map_id(|id| hir.local_def_id_to_hir_id(id))),
- )
- }
+ Some(exports) => self.lazy(exports),
_ => Lazy::empty(),
}
} else {
if encode_const {
record!(self.tables.mir_for_ctfe[def_id.to_def_id()] <- self.tcx.mir_for_ctfe(def_id));
- let abstract_const = self.tcx.mir_abstract_const(def_id);
+ // FIXME(generic_const_exprs): this feels wrong to have in `encode_mir`
+ let abstract_const = self.tcx.thir_abstract_const(def_id);
if let Ok(Some(abstract_const)) = abstract_const {
- record!(self.tables.mir_abstract_consts[def_id.to_def_id()] <- abstract_const);
+ record!(self.tables.thir_abstract_consts[def_id.to_def_id()] <- abstract_const);
}
}
record!(self.tables.promoted_mir[def_id.to_def_id()] <- self.tcx.promoted_mir(def_id));
use rustc_middle::middle::cstore::{CrateDepKind, ForeignModule, LinkagePreference, NativeLib};
use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
use rustc_middle::mir;
+use rustc_middle::thir;
use rustc_middle::ty::{self, ReprOptions, Ty};
use rustc_serialize::opaque::Encoder;
use rustc_session::config::SymbolManglingVersion;
hash: Svh,
stable_crate_id: StableCrateId,
panic_strategy: PanicStrategy,
+ panic_in_drop_strategy: PanicStrategy,
edition: Edition,
has_global_allocator: bool,
has_panic_handler: bool,
mir: Table<DefIndex, Lazy!(mir::Body<'tcx>)>,
mir_for_ctfe: Table<DefIndex, Lazy!(mir::Body<'tcx>)>,
promoted_mir: Table<DefIndex, Lazy!(IndexVec<mir::Promoted, mir::Body<'tcx>>)>,
- mir_abstract_consts: Table<DefIndex, Lazy!(&'tcx [mir::abstract_const::Node<'tcx>])>,
+ thir_abstract_consts: Table<DefIndex, Lazy!(&'tcx [thir::abstract_const::Node<'tcx>])>,
const_defaults: Table<DefIndex, Lazy<rustc_middle::ty::Const<'tcx>>>,
unused_generic_params: Table<DefIndex, Lazy<FiniteBitSet<u32>>>,
// `def_keys` and `def_path_hashes` represent a lazy version of a
#[derive(MetadataEncodable, MetadataDecodable)]
struct ModData {
- reexports: Lazy<[Export<hir::HirId>]>,
+ reexports: Lazy<[Export]>,
expansion: ExpnId,
}
/// This is the replacement export map. It maps a module to all of the exports
/// within.
-pub type ExportMap<Id> = FxHashMap<LocalDefId, Vec<Export<Id>>>;
+pub type ExportMap = FxHashMap<LocalDefId, Vec<Export>>;
#[derive(Copy, Clone, Debug, TyEncodable, TyDecodable, HashStable)]
-pub struct Export<Id> {
+pub struct Export {
/// The name of the target.
pub ident: Ident,
/// The resolution of the target.
- pub res: Res<Id>,
+ /// Local variables cannot be exported, so this `Res` doesn't need the ID parameter.
+ pub res: Res<!>,
/// The span of the target.
pub span: Span,
/// The visibility of the export.
/// We include non-`pub` exports for hygienic macros that get used from extern crates.
pub vis: ty::Visibility,
}
-
-impl<Id> Export<Id> {
- pub fn map_id<R>(self, map: impl FnMut(Id) -> R) -> Export<R> {
- Export { ident: self.ident, res: self.res.map_id(map), span: self.span, vis: self.vis }
- }
-}
stable_hasher.finish()
}
-/// Represents an entry and its parent `HirId`.
-#[derive(Copy, Clone, Debug)]
-pub struct Entry<'hir> {
- parent: HirId,
- node: Node<'hir>,
-}
-
impl<'a, 'hir> NodeCollector<'a, 'hir> {
pub(super) fn root(
sess: &'a Session,
.iter_enumerated()
.filter_map(|(def_id, hod)| {
let def_path_hash = tcx.untracked_resolutions.definitions.def_path_hash(def_id);
- let mut hasher = StableHasher::new();
- hod.as_ref()?.hash_stable(&mut hcx, &mut hasher);
- AttributeMap { map: &tcx.untracked_crate.attrs, prefix: def_id }
- .hash_stable(&mut hcx, &mut hasher);
- Some((def_path_hash, hasher.finish()))
+ let hash = hod.as_ref()?.hash;
+ Some((def_path_hash, hash, def_id))
})
.collect();
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);
// We hash the final, remapped names of all local source files so we
source_file_names.sort_unstable();
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);
source_file_names.hash_stable(&mut hcx, &mut stable_hasher);
tcx.sess.opts.dep_tracking_hash(true).hash_stable(&mut hcx, &mut stable_hasher);
index.parenting.get(&id).copied().unwrap_or(CRATE_HIR_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.fn_arg_names = |tcx, id| {
let hir = tcx.hir();
use rustc_session::Session;
use rustc_span::source_map::SourceMap;
use rustc_span::symbol::Symbol;
-use rustc_span::{BytePos, CachingSourceMapView, SourceFile, SpanData};
+use rustc_span::{BytePos, CachingSourceMapView, SourceFile, Span, SpanData};
use smallvec::SmallVec;
use std::cmp::Ord;
/// things (e.g., each `DefId`/`DefPath` is only hashed once).
#[derive(Clone)]
pub struct StableHashingContext<'a> {
- sess: &'a Session,
definitions: &'a Definitions,
cstore: &'a dyn CrateStore,
pub(super) body_resolver: BodyResolver<'a>,
!always_ignore_spans && !sess.opts.debugging_opts.incremental_ignore_spans;
StableHashingContext {
- sess,
body_resolver: BodyResolver(krate),
definitions,
cstore,
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(
&mut self,
span: &SpanData,
#![feature(try_reserve)]
#![feature(try_reserve_kind)]
#![feature(nonzero_ops)]
-#![cfg_attr(bootstrap, allow(incomplete_features))] // if_let_guard
#![recursion_limit = "512"]
#[macro_use]
+++ /dev/null
-//! A subset of a mir body used for const evaluatability checking.
-use crate::mir::{self, CastKind};
-use crate::ty::{self, Ty};
-
-rustc_index::newtype_index! {
- /// An index into an `AbstractConst`.
- pub struct NodeId {
- derive [HashStable]
- DEBUG_FORMAT = "n{}",
- }
-}
-
-/// A node of an `AbstractConst`.
-#[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)]
-pub enum Node<'tcx> {
- Leaf(&'tcx ty::Const<'tcx>),
- Binop(mir::BinOp, NodeId, NodeId),
- UnaryOp(mir::UnOp, NodeId),
- FunctionCall(NodeId, &'tcx [NodeId]),
- Cast(CastKind, NodeId, Ty<'tcx>),
-}
-
-#[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)]
-pub enum NotConstEvaluatable {
- Error(rustc_errors::ErrorReported),
- MentionsInfer,
- MentionsParam,
-}
-
-impl From<rustc_errors::ErrorReported> for NotConstEvaluatable {
- fn from(e: rustc_errors::ErrorReported) -> NotConstEvaluatable {
- NotConstEvaluatable::Error(e)
- }
-}
-
-TrivialTypeFoldableAndLiftImpls! {
- NotConstEvaluatable,
-}
use rustc_macros::HashStable;
use rustc_target::abi::{HasDataLayout, Size};
-use std::convert::TryFrom;
+use std::convert::{TryFrom, TryInto};
use std::fmt;
////////////////////////////////////////////////////////////////////////////////
#[inline]
fn machine_usize_max(&self) -> u64 {
- let max_usize_plus_1 = 1u128 << self.pointer_size().bits();
- u64::try_from(max_usize_plus_1 - 1).unwrap()
+ self.pointer_size().unsigned_int_max().try_into().unwrap()
}
#[inline]
fn machine_isize_min(&self) -> i64 {
- let max_isize_plus_1 = 1i128 << (self.pointer_size().bits() - 1);
- i64::try_from(-max_isize_plus_1).unwrap()
+ self.pointer_size().signed_int_min().try_into().unwrap()
}
#[inline]
fn machine_isize_max(&self) -> i64 {
- let max_isize_plus_1 = 1u128 << (self.pointer_size().bits() - 1);
- i64::try_from(max_isize_plus_1 - 1).unwrap()
+ self.pointer_size().signed_int_max().try_into().unwrap()
}
#[inline]
fn machine_usize_to_isize(&self, val: u64) -> i64 {
let val = val as i64;
- // Now clamp into the machine_isize range.
+ // Now wrap-around into the machine_isize range.
if val > self.machine_isize_max() {
// This can only happen the the ptr size is < 64, so we know max_usize_plus_1 fits into
// i64.
+ debug_assert!(self.pointer_size().bits() < 64);
let max_usize_plus_1 = 1u128 << self.pointer_size().bits();
val - i64::try_from(max_usize_plus_1).unwrap()
} else {
use self::predecessors::{PredecessorCache, Predecessors};
pub use self::query::*;
-pub mod abstract_const;
pub mod coverage;
mod generic_graph;
pub mod generic_graphviz;
pub projection: &'tcx List<PlaceElem<'tcx>>,
}
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
static_assert_size!(Place<'_>, 16);
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
Constant(Box<Constant<'tcx>>),
}
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
static_assert_size!(Operand<'_>, 24);
impl<'tcx> Debug for Operand<'tcx> {
Aggregate(Box<AggregateKind<'tcx>>, Vec<Operand<'tcx>>),
}
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
static_assert_size!(Rvalue<'_>, 40);
#[derive(Clone, Copy, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
Generator(DefId, SubstsRef<'tcx>, hir::Movability),
}
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
static_assert_size!(AggregateKind<'_>, 48);
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
pub enum NullOp {
/// Returns the size of a value of that type
SizeOf,
+ /// Returns the minimum alignment of a type
+ AlignOf,
/// Creates a new uninitialized box for a value of that type
Box,
}
//! Values computed by queries that use MIR.
-use crate::mir::{abstract_const, Body, Promoted};
+use crate::mir::{Body, Promoted};
use crate::ty::{self, Ty, TyCtxt};
use rustc_data_structures::sync::Lrc;
use rustc_data_structures::vec_map::VecMap;
self.mir_for_ctfe(def.did)
}
}
-
- #[inline]
- pub fn mir_abstract_const_opt_const_arg(
- self,
- def: ty::WithOptConstParam<DefId>,
- ) -> Result<Option<&'tcx [abstract_const::Node<'tcx>]>, ErrorReported> {
- if let Some((did, param_did)) = def.as_const_arg() {
- self.mir_abstract_const_of_const_arg((did, param_did))
- } else {
- self.mir_abstract_const(def.did)
- }
- }
}
Rvalue::UnaryOp(UnOp::Not | UnOp::Neg, ref operand) => operand.ty(local_decls, tcx),
Rvalue::Discriminant(ref place) => place.ty(local_decls, tcx).ty.discriminant_ty(tcx),
Rvalue::NullaryOp(NullOp::Box, t) => tcx.mk_box(t),
- Rvalue::NullaryOp(NullOp::SizeOf, _) => tcx.types.usize,
+ Rvalue::NullaryOp(NullOp::SizeOf | NullOp::AlignOf, _) => tcx.types.usize,
Rvalue::Aggregate(ref ak, ref ops) => match **ak {
AggregateKind::Array(ty) => tcx.mk_array(ty, ops.len() as u64),
AggregateKind::Tuple => tcx.mk_tup(ops.iter().map(|op| op.ty(local_decls, tcx))),
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).
/// 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.
}
/// Try to build an abstract representation of the given constant.
- query mir_abstract_const(
+ query thir_abstract_const(
key: DefId
- ) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
+ ) -> Result<Option<&'tcx [thir::abstract_const::Node<'tcx>]>, ErrorReported> {
desc {
|tcx| "building an abstract representation for {}", tcx.def_path_str(key),
}
}
/// Try to build an abstract representation of the given constant.
- query mir_abstract_const_of_const_arg(
+ query thir_abstract_const_of_const_arg(
key: (LocalDefId, DefId)
- ) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
+ ) -> Result<Option<&'tcx [thir::abstract_const::Node<'tcx>]>, ErrorReported> {
desc {
|tcx|
"building an abstract representation for the const argument {}",
fatal_cycle
desc { "query a crate's configured panic strategy" }
}
+ query panic_in_drop_strategy(_: CrateNum) -> PanicStrategy {
+ fatal_cycle
+ desc { "query a crate's configured panic-in-drop strategy" }
+ }
query is_no_builtins(_: CrateNum) -> bool {
fatal_cycle
desc { "test whether a crate has `#![no_builtins]`" }
desc { "traits in scope at a block" }
}
- query module_exports(def_id: LocalDefId) -> Option<&'tcx [Export<LocalDefId>]> {
+ query module_exports(def_id: LocalDefId) -> Option<&'tcx [Export]> {
desc { |tcx| "looking up items exported by `{}`", tcx.def_path_str(def_id.to_def_id()) }
}
eval_always
desc { "fetching what a crate is named" }
}
- query item_children(def_id: DefId) -> &'tcx [Export<hir::HirId>] {
+ query item_children(def_id: DefId) -> &'tcx [Export] {
desc { |tcx| "collecting child items of `{}`", tcx.def_path_str(def_id) }
}
query extern_mod_stmt_cnum(def_id: LocalDefId) -> Option<CrateNum> {
use std::fmt;
use std::ops::Index;
+pub mod abstract_const;
+pub mod visit;
+
newtype_index! {
/// An index to an [`Arm`] stored in [`Thir::arms`]
#[derive(HashStable)]
--- /dev/null
+//! A subset of a mir body used for const evaluatability checking.
+use crate::mir;
+use crate::ty::{self, Ty, TyCtxt};
+use rustc_errors::ErrorReported;
+
+rustc_index::newtype_index! {
+ /// An index into an `AbstractConst`.
+ pub struct NodeId {
+ derive [HashStable]
+ DEBUG_FORMAT = "n{}",
+ }
+}
+
+#[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)]
+pub enum CastKind {
+ /// thir::ExprKind::As
+ As,
+ /// thir::ExprKind::Use
+ Use,
+}
+
+/// A node of an `AbstractConst`.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)]
+pub enum Node<'tcx> {
+ Leaf(&'tcx ty::Const<'tcx>),
+ Binop(mir::BinOp, NodeId, NodeId),
+ UnaryOp(mir::UnOp, NodeId),
+ FunctionCall(NodeId, &'tcx [NodeId]),
+ Cast(CastKind, NodeId, Ty<'tcx>),
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)]
+pub enum NotConstEvaluatable {
+ Error(ErrorReported),
+ MentionsInfer,
+ MentionsParam,
+}
+
+impl From<ErrorReported> for NotConstEvaluatable {
+ fn from(e: ErrorReported) -> NotConstEvaluatable {
+ NotConstEvaluatable::Error(e)
+ }
+}
+
+TrivialTypeFoldableAndLiftImpls! {
+ NotConstEvaluatable,
+}
+
+impl<'tcx> TyCtxt<'tcx> {
+ #[inline]
+ pub fn thir_abstract_const_opt_const_arg(
+ self,
+ def: ty::WithOptConstParam<rustc_hir::def_id::DefId>,
+ ) -> Result<Option<&'tcx [Node<'tcx>]>, ErrorReported> {
+ if let Some((did, param_did)) = def.as_const_arg() {
+ self.thir_abstract_const_of_const_arg((did, param_did))
+ } else {
+ self.thir_abstract_const(def.did)
+ }
+ }
+}
--- /dev/null
+use super::{
+ Arm, Block, Expr, ExprKind, Guard, InlineAsmOperand, Pat, PatKind, Stmt, StmtKind, Thir,
+};
+use rustc_middle::ty::Const;
+
+pub trait Visitor<'a, 'tcx: 'a>: Sized {
+ fn thir(&self) -> &'a Thir<'tcx>;
+
+ fn visit_expr(&mut self, expr: &Expr<'tcx>) {
+ walk_expr(self, expr);
+ }
+
+ fn visit_stmt(&mut self, stmt: &Stmt<'tcx>) {
+ walk_stmt(self, stmt);
+ }
+
+ fn visit_block(&mut self, block: &Block) {
+ walk_block(self, block);
+ }
+
+ fn visit_arm(&mut self, arm: &Arm<'tcx>) {
+ walk_arm(self, arm);
+ }
+
+ fn visit_pat(&mut self, pat: &Pat<'tcx>) {
+ walk_pat(self, pat);
+ }
+
+ fn visit_const(&mut self, _cnst: &'tcx Const<'tcx>) {}
+}
+
+pub fn walk_expr<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, expr: &Expr<'tcx>) {
+ use ExprKind::*;
+ match expr.kind {
+ Scope { value, region_scope: _, lint_level: _ } => {
+ visitor.visit_expr(&visitor.thir()[value])
+ }
+ Box { value } => visitor.visit_expr(&visitor.thir()[value]),
+ If { cond, then, else_opt, if_then_scope: _ } => {
+ visitor.visit_expr(&visitor.thir()[cond]);
+ visitor.visit_expr(&visitor.thir()[then]);
+ if let Some(else_expr) = else_opt {
+ visitor.visit_expr(&visitor.thir()[else_expr]);
+ }
+ }
+ Call { fun, ref args, ty: _, from_hir_call: _, fn_span: _ } => {
+ visitor.visit_expr(&visitor.thir()[fun]);
+ for &arg in &**args {
+ visitor.visit_expr(&visitor.thir()[arg]);
+ }
+ }
+ Deref { arg } => visitor.visit_expr(&visitor.thir()[arg]),
+ Binary { lhs, rhs, op: _ } | LogicalOp { lhs, rhs, op: _ } => {
+ visitor.visit_expr(&visitor.thir()[lhs]);
+ visitor.visit_expr(&visitor.thir()[rhs]);
+ }
+ Unary { arg, op: _ } => visitor.visit_expr(&visitor.thir()[arg]),
+ Cast { source } => visitor.visit_expr(&visitor.thir()[source]),
+ Use { source } => visitor.visit_expr(&visitor.thir()[source]),
+ NeverToAny { source } => visitor.visit_expr(&visitor.thir()[source]),
+ Pointer { source, cast: _ } => visitor.visit_expr(&visitor.thir()[source]),
+ Let { expr, .. } => {
+ visitor.visit_expr(&visitor.thir()[expr]);
+ }
+ Loop { body } => visitor.visit_expr(&visitor.thir()[body]),
+ Match { scrutinee, ref arms } => {
+ visitor.visit_expr(&visitor.thir()[scrutinee]);
+ for &arm in &**arms {
+ visitor.visit_arm(&visitor.thir()[arm]);
+ }
+ }
+ Block { ref body } => visitor.visit_block(body),
+ Assign { lhs, rhs } | AssignOp { lhs, rhs, op: _ } => {
+ visitor.visit_expr(&visitor.thir()[lhs]);
+ visitor.visit_expr(&visitor.thir()[rhs]);
+ }
+ Field { lhs, name: _ } => visitor.visit_expr(&visitor.thir()[lhs]),
+ Index { lhs, index } => {
+ visitor.visit_expr(&visitor.thir()[lhs]);
+ visitor.visit_expr(&visitor.thir()[index]);
+ }
+ VarRef { id: _ } | UpvarRef { closure_def_id: _, var_hir_id: _ } => {}
+ Borrow { arg, borrow_kind: _ } => visitor.visit_expr(&visitor.thir()[arg]),
+ AddressOf { arg, mutability: _ } => visitor.visit_expr(&visitor.thir()[arg]),
+ Break { value, label: _ } => {
+ if let Some(value) = value {
+ visitor.visit_expr(&visitor.thir()[value])
+ }
+ }
+ Continue { label: _ } => {}
+ Return { value } => {
+ if let Some(value) = value {
+ visitor.visit_expr(&visitor.thir()[value])
+ }
+ }
+ ConstBlock { value } => visitor.visit_const(value),
+ Repeat { value, count } => {
+ visitor.visit_expr(&visitor.thir()[value]);
+ visitor.visit_const(count);
+ }
+ Array { ref fields } | Tuple { ref fields } => {
+ for &field in &**fields {
+ visitor.visit_expr(&visitor.thir()[field]);
+ }
+ }
+ Adt(box crate::thir::Adt {
+ ref fields,
+ ref base,
+ adt_def: _,
+ variant_index: _,
+ substs: _,
+ user_ty: _,
+ }) => {
+ for field in &**fields {
+ visitor.visit_expr(&visitor.thir()[field.expr]);
+ }
+ if let Some(base) = base {
+ visitor.visit_expr(&visitor.thir()[base.base]);
+ }
+ }
+ PlaceTypeAscription { source, user_ty: _ } | ValueTypeAscription { source, user_ty: _ } => {
+ visitor.visit_expr(&visitor.thir()[source])
+ }
+ Closure { closure_id: _, substs: _, upvars: _, movability: _, fake_reads: _ } => {}
+ Literal { literal, user_ty: _, const_id: _ } => visitor.visit_const(literal),
+ StaticRef { literal, def_id: _ } => visitor.visit_const(literal),
+ InlineAsm { ref operands, template: _, options: _, line_spans: _ } => {
+ for op in &**operands {
+ use InlineAsmOperand::*;
+ match op {
+ In { expr, reg: _ }
+ | Out { expr: Some(expr), reg: _, late: _ }
+ | InOut { expr, reg: _, late: _ }
+ | SymFn { expr } => visitor.visit_expr(&visitor.thir()[*expr]),
+ SplitInOut { in_expr, out_expr, reg: _, late: _ } => {
+ visitor.visit_expr(&visitor.thir()[*in_expr]);
+ if let Some(out_expr) = out_expr {
+ visitor.visit_expr(&visitor.thir()[*out_expr]);
+ }
+ }
+ Out { expr: None, reg: _, late: _ }
+ | Const { value: _, span: _ }
+ | SymStatic { def_id: _ } => {}
+ }
+ }
+ }
+ ThreadLocalRef(_) => {}
+ LlvmInlineAsm { ref outputs, ref inputs, asm: _ } => {
+ for &out_expr in &**outputs {
+ visitor.visit_expr(&visitor.thir()[out_expr]);
+ }
+ for &in_expr in &**inputs {
+ visitor.visit_expr(&visitor.thir()[in_expr]);
+ }
+ }
+ Yield { value } => visitor.visit_expr(&visitor.thir()[value]),
+ }
+}
+
+pub fn walk_stmt<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, stmt: &Stmt<'tcx>) {
+ match &stmt.kind {
+ StmtKind::Expr { expr, scope: _ } => visitor.visit_expr(&visitor.thir()[*expr]),
+ StmtKind::Let {
+ initializer,
+ remainder_scope: _,
+ init_scope: _,
+ ref pattern,
+ lint_level: _,
+ } => {
+ if let Some(init) = initializer {
+ visitor.visit_expr(&visitor.thir()[*init]);
+ }
+ visitor.visit_pat(pattern);
+ }
+ }
+}
+
+pub fn walk_block<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, block: &Block) {
+ for &stmt in &*block.stmts {
+ visitor.visit_stmt(&visitor.thir()[stmt]);
+ }
+ if let Some(expr) = block.expr {
+ visitor.visit_expr(&visitor.thir()[expr]);
+ }
+}
+
+pub fn walk_arm<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, arm: &Arm<'tcx>) {
+ match arm.guard {
+ Some(Guard::If(expr)) => visitor.visit_expr(&visitor.thir()[expr]),
+ Some(Guard::IfLet(ref pat, expr)) => {
+ visitor.visit_pat(pat);
+ visitor.visit_expr(&visitor.thir()[expr]);
+ }
+ None => {}
+ }
+ visitor.visit_pat(&arm.pattern);
+ visitor.visit_expr(&visitor.thir()[arm.body]);
+}
+
+pub fn walk_pat<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, pat: &Pat<'tcx>) {
+ use PatKind::*;
+ match pat.kind.as_ref() {
+ AscribeUserType { subpattern, ascription: _ }
+ | Deref { subpattern }
+ | Binding {
+ subpattern: Some(subpattern),
+ mutability: _,
+ mode: _,
+ var: _,
+ ty: _,
+ is_primary: _,
+ name: _,
+ } => visitor.visit_pat(&subpattern),
+ Binding { .. } | Wild => {}
+ Variant { subpatterns, adt_def: _, substs: _, variant_index: _ } | Leaf { subpatterns } => {
+ for subpattern in subpatterns {
+ visitor.visit_pat(&subpattern.pattern);
+ }
+ }
+ Constant { value } => visitor.visit_const(value),
+ Range(range) => {
+ visitor.visit_const(range.lo);
+ visitor.visit_const(range.hi);
+ }
+ Slice { prefix, slice, suffix } | Array { prefix, slice, suffix } => {
+ for subpattern in prefix {
+ visitor.visit_pat(&subpattern);
+ }
+ if let Some(pat) = slice {
+ visitor.visit_pat(pat);
+ }
+ for subpattern in suffix {
+ visitor.visit_pat(&subpattern);
+ }
+ }
+ Or { pats } => {
+ for pat in pats {
+ visitor.visit_pat(&pat);
+ }
+ }
+ };
+}
mod structural_impls;
use crate::infer::canonical::Canonical;
-use crate::mir::abstract_const::NotConstEvaluatable;
+use crate::thir::abstract_const::NotConstEvaluatable;
use crate::ty::subst::SubstsRef;
use crate::ty::{self, AdtKind, Ty, TyCtxt};
self,
interpret::{AllocId, Allocation},
};
+use crate::thir;
use crate::ty::subst::SubstsRef;
use crate::ty::{self, List, Ty, TyCtxt};
use rustc_data_structures::fx::FxHashMap;
}
}
-impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for [mir::abstract_const::Node<'tcx>] {
+impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for [thir::abstract_const::Node<'tcx>] {
fn decode(decoder: &mut D) -> Result<&'tcx Self, D::Error> {
Ok(decoder.tcx().arena.alloc_from_iter(
(0..decoder.read_usize()?)
}
}
-impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for [mir::abstract_const::NodeId] {
+impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for [thir::abstract_const::NodeId] {
fn decode(decoder: &mut D) -> Result<&'tcx Self, D::Error> {
Ok(decoder.tcx().arena.alloc_from_iter(
(0..decoder.read_usize()?)
{
let (span, sugg) = if has_params {
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))
} else {
let item_args = self.format_generic_args(assoc_substs);
// HACK(nox): We iter on `b` and then `a` because `max_by_key`
// returns the last maximum.
- let largest_niche = Niche::from_scalar(dl, b_offset, b.clone())
+ let largest_niche = Niche::from_scalar(dl, b_offset, b)
.into_iter()
- .chain(Niche::from_scalar(dl, Size::ZERO, a.clone()))
+ .chain(Niche::from_scalar(dl, Size::ZERO, a))
.max_by_key(|niche| niche.available(dl));
Layout {
offsets[i as usize] = offset;
if !repr.hide_niche() {
- if let Some(mut niche) = field.largest_niche.clone() {
+ if let Some(mut niche) = field.largest_niche {
let available = niche.available(dl);
if available > largest_niche_available {
largest_niche_available = available;
// For plain scalars, or vectors of them, we can't unpack
// newtypes for `#[repr(C)]`, as that affects C ABIs.
Abi::Scalar(_) | Abi::Vector { .. } if optimize => {
- abi = field.abi.clone();
+ abi = field.abi;
}
// But scalar pairs are Rust-specific and get
// treated as aggregates by C ABIs anyway.
Abi::ScalarPair(..) => {
- abi = field.abi.clone();
+ abi = field.abi;
}
_ => {}
}
// Two non-ZST fields, and they're both scalars.
(
- Some((i, &TyAndLayout { layout: &Layout { abi: Abi::Scalar(ref a), .. }, .. })),
- Some((j, &TyAndLayout { layout: &Layout { abi: Abi::Scalar(ref b), .. }, .. })),
+ Some((i, &TyAndLayout { layout: &Layout { abi: Abi::Scalar(a), .. }, .. })),
+ Some((j, &TyAndLayout { layout: &Layout { abi: Abi::Scalar(b), .. }, .. })),
None,
) => {
// Order by the memory placement, not source order.
let ((i, a), (j, b)) =
if offsets[i] < offsets[j] { ((i, a), (j, b)) } else { ((j, b), (i, a)) };
- let pair = self.scalar_pair(a.clone(), b.clone());
+ let pair = self.scalar_pair(a, b);
let pair_offsets = match pair.fields {
FieldsShape::Arbitrary { ref offsets, ref memory_index } => {
assert_eq!(memory_index, &[0, 1]);
let param_env = self.param_env;
let dl = self.data_layout();
let scalar_unit = |value: Primitive| {
- let bits = value.size(dl).bits();
- assert!(bits <= 128);
- Scalar { value, valid_range: WrappingRange { start: 0, end: (!0 >> (128 - bits)) } }
+ let size = value.size(dl);
+ assert!(size.bits() <= 128);
+ Scalar { value, valid_range: WrappingRange { start: 0, end: size.unsigned_int_max() } }
};
let scalar = |value: Primitive| tcx.intern_layout(Layout::scalar(self, scalar_unit(value)));
Abi::Aggregate { sized: true }
};
- let largest_niche = if count != 0 { element.largest_niche.clone() } else { None };
+ let largest_niche = if count != 0 { element.largest_niche } else { None };
tcx.intern_layout(Layout {
variants: Variants::Single { index: VariantIdx::new(0) },
// Compute the ABI of the element type:
let e_ly = self.layout_of(e_ty)?;
- let e_abi = if let Abi::Scalar(ref scalar) = e_ly.abi {
- scalar.clone()
+ let e_abi = if let Abi::Scalar(scalar) = e_ly.abi {
+ scalar
} else {
// This error isn't caught in typeck, e.g., if
// the element type of the vector is generic.
variants: Variants::Single { index: VariantIdx::new(0) },
fields,
abi: Abi::Vector { element: e_abi, count: e_len },
- largest_niche: e_ly.largest_niche.clone(),
+ largest_niche: e_ly.largest_niche,
size,
align,
})
// If all non-ZST fields have the same ABI, forward this ABI
if optimize && !field.is_zst() {
// Normalize scalar_unit to the maximal valid range
- let field_abi = match &field.abi {
+ let field_abi = match field.abi {
Abi::Scalar(x) => Abi::Scalar(scalar_unit(x.value)),
Abi::ScalarPair(x, y) => {
Abi::ScalarPair(scalar_unit(x.value), scalar_unit(y.value))
}
Abi::Vector { element: x, count } => {
- Abi::Vector { element: scalar_unit(x.value), count: *count }
+ Abi::Vector { element: scalar_unit(x.value), count }
}
Abi::Uninhabited | Abi::Aggregate { .. } => {
Abi::Aggregate { sized: true }
Niche::from_scalar(dl, Size::ZERO, scalar.clone())
};
if let Some(niche) = niche {
- match &st.largest_niche {
+ match st.largest_niche {
Some(largest_niche) => {
// Replace the existing niche even if they're equal,
// because this one is at a lower offset.
let niche_candidate = variants[i]
.iter()
.enumerate()
- .filter_map(|(j, &field)| Some((j, field.largest_niche.as_ref()?)))
+ .filter_map(|(j, field)| Some((j, field.largest_niche?)))
.max_by_key(|(_, niche)| niche.available(dl));
if let Some((field_index, niche, (niche_start, niche_scalar))) =
Abi::Uninhabited
} else {
match st[i].abi {
- Abi::Scalar(_) => Abi::Scalar(niche_scalar.clone()),
- Abi::ScalarPair(ref first, ref second) => {
+ Abi::Scalar(_) => Abi::Scalar(niche_scalar),
+ Abi::ScalarPair(first, second) => {
// We need to use scalar_unit to reset the
// valid range to the maximal one for that
// primitive, because only the niche is
// guaranteed to be initialised, not the
// other primitive.
if offset.bytes() == 0 {
- Abi::ScalarPair(
- niche_scalar.clone(),
- scalar_unit(second.value),
- )
+ Abi::ScalarPair(niche_scalar, scalar_unit(second.value))
} else {
- Abi::ScalarPair(
- scalar_unit(first.value),
- niche_scalar.clone(),
- )
+ Abi::ScalarPair(scalar_unit(first.value), niche_scalar)
}
}
_ => Abi::Aggregate { sized: true },
}
};
- let largest_niche =
- Niche::from_scalar(dl, offset, niche_scalar.clone());
+ let largest_niche = Niche::from_scalar(dl, offset, niche_scalar);
niche_filling_layout = Some(Layout {
variants: Variants::Multiple {
}
}
- let tag_mask = !0u128 >> (128 - ity.size().bits());
+ let tag_mask = ity.size().unsigned_int_max();
let tag = Scalar {
value: Int(ity, signed),
valid_range: WrappingRange {
};
let mut abi = Abi::Aggregate { sized: true };
if tag.value.size(dl) == size {
- abi = Abi::Scalar(tag.clone());
+ abi = Abi::Scalar(tag);
} else {
// Try to use a ScalarPair for all tagged enums.
let mut common_prim = None;
}
};
let prim = match field.abi {
- Abi::Scalar(ref scalar) => scalar.value,
+ Abi::Scalar(scalar) => scalar.value,
_ => {
common_prim = None;
break;
}
}
if let Some((prim, offset)) = common_prim {
- let pair = self.scalar_pair(tag.clone(), scalar_unit(prim));
+ let pair = self.scalar_pair(tag, scalar_unit(prim));
let pair_offsets = match pair.fields {
FieldsShape::Arbitrary { ref offsets, ref memory_index } => {
assert_eq!(memory_index, &[0, 1]);
abi = Abi::Uninhabited;
}
- let largest_niche = Niche::from_scalar(dl, Size::ZERO, tag.clone());
+ let largest_niche = Niche::from_scalar(dl, Size::ZERO, tag);
let tagged_layout = Layout {
variants: Variants::Multiple {
// pick the layout with the larger niche; otherwise,
// pick tagged as it has simpler codegen.
cmp::min_by_key(tagged_layout, niche_filling_layout, |layout| {
- let niche_size =
- layout.largest_niche.as_ref().map_or(0, |n| n.available(dl));
+ let niche_size = layout.largest_niche.map_or(0, |n| n.available(dl));
(layout.size, cmp::Reverse(niche_size))
})
}
value: Primitive::Int(discr_int, false),
valid_range: WrappingRange { start: 0, end: max_discr },
};
- let tag_layout = self.tcx.intern_layout(Layout::scalar(self, tag.clone()));
+ let tag_layout = self.tcx.intern_layout(Layout::scalar(self, tag));
let tag_layout = TyAndLayout { ty: discr_int_ty, layout: tag_layout };
let promoted_layouts = ineligible_locals
}
}
- Variants::Multiple { ref tag, ref tag_encoding, .. } => {
+ Variants::Multiple { tag, ref tag_encoding, .. } => {
debug!(
"print-type-size `{:#?}` adt general variants def {}",
layout.ty,
i: usize,
) -> TyMaybeWithLayout<'tcx> {
let tcx = cx.tcx();
- let tag_layout = |tag: &Scalar| -> TyAndLayout<'tcx> {
+ let tag_layout = |tag: Scalar| -> TyAndLayout<'tcx> {
let layout = Layout::scalar(cx, tag.clone());
TyAndLayout { layout: tcx.intern_layout(layout), ty: tag.value.to_ty(tcx) }
};
.nth(i)
.unwrap(),
),
- Variants::Multiple { ref tag, tag_field, .. } => {
+ Variants::Multiple { tag, tag_field, .. } => {
if i == tag_field {
return TyMaybeWithLayout::TyAndLayout(tag_layout(tag));
}
}
// Discriminant field for enums (where applicable).
- Variants::Multiple { ref tag, .. } => {
+ Variants::Multiple { tag, .. } => {
assert_eq!(i, 0);
return TyMaybeWithLayout::TyAndLayout(tag_layout(tag));
}
// Handle safe Rust thin and fat pointers.
let adjust_for_rust_scalar = |attrs: &mut ArgAttributes,
- scalar: &Scalar,
+ scalar: Scalar,
layout: TyAndLayout<'tcx>,
offset: Size,
is_return: bool| {
return;
}
- if !scalar.valid_range.contains_zero() {
+ if !scalar.valid_range.contains(0) {
attrs.set(ArgAttribute::NonNull);
}
pub extern_crate_map: FxHashMap<LocalDefId, CrateNum>,
pub maybe_unused_trait_imports: FxHashSet<LocalDefId>,
pub maybe_unused_extern_crates: Vec<(LocalDefId, Span)>,
- pub export_map: ExportMap<LocalDefId>,
+ pub export_map: ExportMap,
pub glob_map: FxHashMap<LocalDefId, FxHashSet<Symbol>>,
/// Extern prelude entries. The value is `true` if the entry was introduced
/// via `extern crate` item and not `--extern` option or compiler built-in.
}
}
-fn signed_min(size: Size) -> i128 {
- size.sign_extend(1_u128 << (size.bits() - 1)) as i128
-}
-
-fn signed_max(size: Size) -> i128 {
- i128::MAX >> (128 - size.bits())
-}
-
-fn unsigned_max(size: Size) -> u128 {
- u128::MAX >> (128 - size.bits())
-}
-
fn int_size_and_signed<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> (Size, bool) {
let (int, signed) = match *ty.kind() {
Int(ity) => (Integer::from_int_ty(&tcx, ity), true),
pub fn checked_add(self, tcx: TyCtxt<'tcx>, n: u128) -> (Self, bool) {
let (size, signed) = int_size_and_signed(tcx, self.ty);
let (val, oflo) = if signed {
- let min = signed_min(size);
- let max = signed_max(size);
+ let min = size.signed_int_min();
+ let max = size.signed_int_max();
let val = size.sign_extend(self.val) as i128;
assert!(n < (i128::MAX as u128));
let n = n as i128;
let val = size.truncate(val);
(val, oflo)
} else {
- let max = unsigned_max(size);
+ let max = size.unsigned_int_max();
let val = self.val;
let oflo = val > max - n;
let val = if oflo { n - (max - val) - 1 } else { val + n };
let val = match self.kind() {
ty::Int(_) | ty::Uint(_) => {
let (size, signed) = int_size_and_signed(tcx, self);
- let val = if signed { signed_max(size) as u128 } else { unsigned_max(size) };
+ let val =
+ if signed { size.signed_int_max() as u128 } else { size.unsigned_int_max() };
Some(val)
}
ty::Char => Some(std::char::MAX as u128),
let val = match self.kind() {
ty::Int(_) | ty::Uint(_) => {
let (size, signed) = int_size_and_signed(tcx, self);
- let val = if signed { size.truncate(signed_min(size) as u128) } else { 0 };
+ let val = if signed { size.truncate(size.signed_int_min() as u128) } else { 0 };
Some(val)
}
ty::Char => Some(0),
// Helper to get a `-1` value of the appropriate type
fn neg_1_literal(&mut self, span: Span, ty: Ty<'tcx>) -> Operand<'tcx> {
let param_ty = ty::ParamEnv::empty().and(ty);
- let bits = self.tcx.layout_of(param_ty).unwrap().size.bits();
- let n = (!0u128) >> (128 - bits);
- let literal = ty::Const::from_bits(self.tcx, n, param_ty);
+ let size = self.tcx.layout_of(param_ty).unwrap().size;
+ let literal = ty::Const::from_bits(self.tcx, size.unsigned_int_max(), param_ty);
self.literal_operand(span, literal)
}
struct Binding<'tcx> {
span: Span,
source: Place<'tcx>,
- name: Symbol,
var_id: HirId,
- var_ty: Ty<'tcx>,
- mutability: Mutability,
binding_mode: BindingMode,
}
source_info.span, ascription.source, ascription.user_ty,
);
- let user_ty = ascription.user_ty.clone().user_ty(
+ let user_ty = ascription.user_ty.user_ty(
&mut self.canonical_user_type_annotations,
ascription.source.ty(&self.local_decls, self.tcx).ty,
source_info.span,
Ok(())
}
- PatKind::Binding { name, mutability, mode, var, ty, ref subpattern, is_primary: _ } => {
+ PatKind::Binding {
+ name: _,
+ mutability: _,
+ mode,
+ var,
+ ty: _,
+ ref subpattern,
+ is_primary: _,
+ } => {
if let Ok(place_resolved) =
match_pair.place.clone().try_upvars_resolved(self.tcx, self.typeck_results)
{
candidate.bindings.push(Binding {
- name,
- mutability,
span: match_pair.pattern.span,
source: place_resolved.into_place(self.tcx, self.typeck_results),
var_id: var,
- var_ty: ty,
binding_mode: mode,
});
}
// Ensure unsafeck is ran before we steal the THIR.
match def {
ty::WithOptConstParam { did, const_param_did: Some(const_param_did) } => {
- tcx.ensure().thir_check_unsafety_for_const_arg((did, const_param_did))
+ tcx.ensure().thir_check_unsafety_for_const_arg((did, const_param_did));
+ tcx.ensure().thir_abstract_const_of_const_arg((did, const_param_did));
}
ty::WithOptConstParam { did, const_param_did: None } => {
- tcx.ensure().thir_check_unsafety(did)
+ tcx.ensure().thir_check_unsafety(did);
+ tcx.ensure().thir_abstract_const(did);
}
}
/// the region span of this scope within source code.
region_scope: region::Scope,
- /// the span of that region_scope
- region_scope_span: Span,
-
/// set of places to drop when exiting this scope. This starts
/// out empty but grows as variables are declared during the
/// building process. This is a stack, so we always drop from the
self.scopes.push(Scope {
source_scope: vis_scope,
region_scope: region_scope.0,
- region_scope_span: region_scope.1.span,
drops: vec![],
moved_locals: vec![],
cached_unwind_block: None,
use crate::build::ExprCategory;
-use crate::thir::visit::{self, Visitor};
+use rustc_middle::thir::visit::{self, Visitor};
use rustc_errors::struct_span_err;
use rustc_hir as hir;
crate mod pattern;
mod util;
-pub mod visit;
+++ /dev/null
-use rustc_middle::thir::{self, *};
-use rustc_middle::ty::Const;
-
-pub trait Visitor<'a, 'tcx: 'a>: Sized {
- fn thir(&self) -> &'a Thir<'tcx>;
-
- fn visit_expr(&mut self, expr: &Expr<'tcx>) {
- walk_expr(self, expr);
- }
-
- fn visit_stmt(&mut self, stmt: &Stmt<'tcx>) {
- walk_stmt(self, stmt);
- }
-
- fn visit_block(&mut self, block: &Block) {
- walk_block(self, block);
- }
-
- fn visit_arm(&mut self, arm: &Arm<'tcx>) {
- walk_arm(self, arm);
- }
-
- fn visit_pat(&mut self, pat: &Pat<'tcx>) {
- walk_pat(self, pat);
- }
-
- fn visit_const(&mut self, _cnst: &'tcx Const<'tcx>) {}
-}
-
-pub fn walk_expr<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, expr: &Expr<'tcx>) {
- use ExprKind::*;
- match expr.kind {
- Scope { value, region_scope: _, lint_level: _ } => {
- visitor.visit_expr(&visitor.thir()[value])
- }
- Box { value } => visitor.visit_expr(&visitor.thir()[value]),
- If { cond, then, else_opt, if_then_scope: _ } => {
- visitor.visit_expr(&visitor.thir()[cond]);
- visitor.visit_expr(&visitor.thir()[then]);
- if let Some(else_expr) = else_opt {
- visitor.visit_expr(&visitor.thir()[else_expr]);
- }
- }
- Call { fun, ref args, ty: _, from_hir_call: _, fn_span: _ } => {
- visitor.visit_expr(&visitor.thir()[fun]);
- for &arg in &**args {
- visitor.visit_expr(&visitor.thir()[arg]);
- }
- }
- Deref { arg } => visitor.visit_expr(&visitor.thir()[arg]),
- Binary { lhs, rhs, op: _ } | LogicalOp { lhs, rhs, op: _ } => {
- visitor.visit_expr(&visitor.thir()[lhs]);
- visitor.visit_expr(&visitor.thir()[rhs]);
- }
- Unary { arg, op: _ } => visitor.visit_expr(&visitor.thir()[arg]),
- Cast { source } => visitor.visit_expr(&visitor.thir()[source]),
- Use { source } => visitor.visit_expr(&visitor.thir()[source]),
- NeverToAny { source } => visitor.visit_expr(&visitor.thir()[source]),
- Pointer { source, cast: _ } => visitor.visit_expr(&visitor.thir()[source]),
- Let { expr, .. } => {
- visitor.visit_expr(&visitor.thir()[expr]);
- }
- Loop { body } => visitor.visit_expr(&visitor.thir()[body]),
- Match { scrutinee, ref arms } => {
- visitor.visit_expr(&visitor.thir()[scrutinee]);
- for &arm in &**arms {
- visitor.visit_arm(&visitor.thir()[arm]);
- }
- }
- Block { ref body } => visitor.visit_block(body),
- Assign { lhs, rhs } | AssignOp { lhs, rhs, op: _ } => {
- visitor.visit_expr(&visitor.thir()[lhs]);
- visitor.visit_expr(&visitor.thir()[rhs]);
- }
- Field { lhs, name: _ } => visitor.visit_expr(&visitor.thir()[lhs]),
- Index { lhs, index } => {
- visitor.visit_expr(&visitor.thir()[lhs]);
- visitor.visit_expr(&visitor.thir()[index]);
- }
- VarRef { id: _ } | UpvarRef { closure_def_id: _, var_hir_id: _ } => {}
- Borrow { arg, borrow_kind: _ } => visitor.visit_expr(&visitor.thir()[arg]),
- AddressOf { arg, mutability: _ } => visitor.visit_expr(&visitor.thir()[arg]),
- Break { value, label: _ } => {
- if let Some(value) = value {
- visitor.visit_expr(&visitor.thir()[value])
- }
- }
- Continue { label: _ } => {}
- Return { value } => {
- if let Some(value) = value {
- visitor.visit_expr(&visitor.thir()[value])
- }
- }
- ConstBlock { value } => visitor.visit_const(value),
- Repeat { value, count } => {
- visitor.visit_expr(&visitor.thir()[value]);
- visitor.visit_const(count);
- }
- Array { ref fields } | Tuple { ref fields } => {
- for &field in &**fields {
- visitor.visit_expr(&visitor.thir()[field]);
- }
- }
- Adt(box thir::Adt {
- ref fields,
- ref base,
- adt_def: _,
- variant_index: _,
- substs: _,
- user_ty: _,
- }) => {
- for field in &**fields {
- visitor.visit_expr(&visitor.thir()[field.expr]);
- }
- if let Some(base) = base {
- visitor.visit_expr(&visitor.thir()[base.base]);
- }
- }
- PlaceTypeAscription { source, user_ty: _ } | ValueTypeAscription { source, user_ty: _ } => {
- visitor.visit_expr(&visitor.thir()[source])
- }
- Closure { closure_id: _, substs: _, upvars: _, movability: _, fake_reads: _ } => {}
- Literal { literal, user_ty: _, const_id: _ } => visitor.visit_const(literal),
- StaticRef { literal, def_id: _ } => visitor.visit_const(literal),
- InlineAsm { ref operands, template: _, options: _, line_spans: _ } => {
- for op in &**operands {
- use InlineAsmOperand::*;
- match op {
- In { expr, reg: _ }
- | Out { expr: Some(expr), reg: _, late: _ }
- | InOut { expr, reg: _, late: _ }
- | SymFn { expr } => visitor.visit_expr(&visitor.thir()[*expr]),
- SplitInOut { in_expr, out_expr, reg: _, late: _ } => {
- visitor.visit_expr(&visitor.thir()[*in_expr]);
- if let Some(out_expr) = out_expr {
- visitor.visit_expr(&visitor.thir()[*out_expr]);
- }
- }
- Out { expr: None, reg: _, late: _ }
- | Const { value: _, span: _ }
- | SymStatic { def_id: _ } => {}
- }
- }
- }
- ThreadLocalRef(_) => {}
- LlvmInlineAsm { ref outputs, ref inputs, asm: _ } => {
- for &out_expr in &**outputs {
- visitor.visit_expr(&visitor.thir()[out_expr]);
- }
- for &in_expr in &**inputs {
- visitor.visit_expr(&visitor.thir()[in_expr]);
- }
- }
- Yield { value } => visitor.visit_expr(&visitor.thir()[value]),
- }
-}
-
-pub fn walk_stmt<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, stmt: &Stmt<'tcx>) {
- match &stmt.kind {
- StmtKind::Expr { expr, scope: _ } => visitor.visit_expr(&visitor.thir()[*expr]),
- StmtKind::Let {
- initializer,
- remainder_scope: _,
- init_scope: _,
- ref pattern,
- lint_level: _,
- } => {
- if let Some(init) = initializer {
- visitor.visit_expr(&visitor.thir()[*init]);
- }
- visitor.visit_pat(pattern);
- }
- }
-}
-
-pub fn walk_block<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, block: &Block) {
- for &stmt in &*block.stmts {
- visitor.visit_stmt(&visitor.thir()[stmt]);
- }
- if let Some(expr) = block.expr {
- visitor.visit_expr(&visitor.thir()[expr]);
- }
-}
-
-pub fn walk_arm<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, arm: &Arm<'tcx>) {
- match arm.guard {
- Some(Guard::If(expr)) => visitor.visit_expr(&visitor.thir()[expr]),
- Some(Guard::IfLet(ref pat, expr)) => {
- visitor.visit_pat(pat);
- visitor.visit_expr(&visitor.thir()[expr]);
- }
- None => {}
- }
- visitor.visit_pat(&arm.pattern);
- visitor.visit_expr(&visitor.thir()[arm.body]);
-}
-
-pub fn walk_pat<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, pat: &Pat<'tcx>) {
- use PatKind::*;
- match pat.kind.as_ref() {
- AscribeUserType { subpattern, ascription: _ }
- | Deref { subpattern }
- | Binding {
- subpattern: Some(subpattern),
- mutability: _,
- mode: _,
- var: _,
- ty: _,
- is_primary: _,
- name: _,
- } => visitor.visit_pat(&subpattern),
- Binding { .. } | Wild => {}
- Variant { subpatterns, adt_def: _, substs: _, variant_index: _ } | Leaf { subpatterns } => {
- for subpattern in subpatterns {
- visitor.visit_pat(&subpattern.pattern);
- }
- }
- Constant { value } => visitor.visit_const(value),
- Range(range) => {
- visitor.visit_const(range.lo);
- visitor.visit_const(range.hi);
- }
- Slice { prefix, slice, suffix } | Array { prefix, slice, suffix } => {
- for subpattern in prefix {
- visitor.visit_pat(&subpattern);
- }
- if let Some(pat) = slice {
- visitor.visit_pat(pat);
- }
- for subpattern in suffix {
- visitor.visit_pat(&subpattern);
- }
- }
- Or { pats } => {
- for pat in pats {
- visitor.visit_pat(&pat);
- }
- }
- };
-}
| Rvalue::AddressOf(..)
| Rvalue::Discriminant(..)
| Rvalue::Len(..)
- | Rvalue::NullaryOp(NullOp::SizeOf, _)
+ | Rvalue::NullaryOp(NullOp::SizeOf | NullOp::AlignOf, _)
| Rvalue::NullaryOp(NullOp::Box, _) => {
// This returns an rvalue with uninitialized contents. We can't
// move out of it here because it is an rvalue - assignments always
use rustc_middle::ty::layout;
use rustc_middle::ty::{self, TyCtxt};
use rustc_target::spec::abi::Abi;
+use rustc_target::spec::PanicStrategy;
/// A pass that runs which is targeted at ensuring that codegen guarantees about
/// unwinding are upheld for compilations of panic=abort programs.
};
layout::fn_can_unwind(tcx, flags, sig.abi())
}
- TerminatorKind::Drop { .. }
- | TerminatorKind::DropAndReplace { .. }
- | TerminatorKind::Assert { .. }
- | TerminatorKind::FalseUnwind { .. } => {
+ TerminatorKind::Drop { .. } | TerminatorKind::DropAndReplace { .. } => {
+ tcx.sess.opts.debugging_opts.panic_in_drop == PanicStrategy::Unwind
+ && layout::fn_can_unwind(tcx, CodegenFnAttrFlags::empty(), Abi::Rust)
+ }
+ TerminatorKind::Assert { .. } | TerminatorKind::FalseUnwind { .. } => {
layout::fn_can_unwind(tcx, CodegenFnAttrFlags::empty(), Abi::Rust)
}
_ => continue,
}
if let Err(e) = result {
- bug!("Error processing: {:?}: {:?}", self.mir_body.source.def_id(), e)
+ bug!("Error processing: {:?}: {:?}", self.mir_body.source.def_id(), e.message)
};
// Depending on current `debug_options()`, `alert_on_unused_expressions()` could panic, so
/// body_span), returns the macro name symbol.
pub fn visible_macro(&self, body_span: Span) -> Option<Symbol> {
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()
{
return Some(current_macro);
-#![cfg_attr(bootstrap, feature(bindings_after_at))]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(crate_visibility_modifier)]
// this point, before we steal the mir-const result.
// Also this means promotion can rely on all const checks having been done.
let _ = tcx.mir_const_qualif_opt_const_arg(def);
- let _ = tcx.mir_abstract_const_opt_const_arg(def.to_global());
let mut body = tcx.mir_const(def).steal();
let mut required_consts = Vec::new();
// since their semantics depend on the value of overflow-checks flag used
// during codegen. Issue #35310.
}
- sym::size_of => {
+ sym::size_of | sym::min_align_of => {
if let Some((destination, target)) = *destination {
let tp_ty = substs.type_at(0);
+ let null_op = match intrinsic_name {
+ sym::size_of => NullOp::SizeOf,
+ sym::min_align_of => NullOp::AlignOf,
+ _ => bug!("unexpected intrinsic"),
+ };
block.statements.push(Statement {
source_info: terminator.source_info,
kind: StatementKind::Assign(Box::new((
destination,
- Rvalue::NullaryOp(NullOp::SizeOf, tp_ty),
+ Rvalue::NullaryOp(null_op, tp_ty),
))),
});
terminator.kind = TerminatorKind::Goto { target };
let deref_arg = tcx.mk_place_deref(arg);
let r_value = Rvalue::Len(deref_arg);
let len_statement_kind = StatementKind::Assign(Box::new((*dest, r_value)));
- let add_statement = Statement {
- kind: len_statement_kind,
- source_info: terminator.source_info.clone(),
- };
+ let add_statement =
+ Statement { kind: len_statement_kind, source_info: terminator.source_info };
// modify terminator into simple Goto
- let new_terminator_kind = TerminatorKind::Goto { target: bb.clone() };
+ let new_terminator_kind = TerminatorKind::Goto { target: *bb };
let patch = SliceLenPatchInformation { add_statement, new_terminator_kind };
#![feature(array_windows)]
#![feature(crate_visibility_modifier)]
#![feature(if_let_guard)]
-#![cfg_attr(bootstrap, feature(bindings_after_at))]
#![feature(box_patterns)]
-#![cfg_attr(bootstrap, allow(incomplete_features))] // if_let_guard
#![recursion_limit = "256"]
use rustc_ast as ast;
let mut parser = stream_to_parser(sess, stream, None);
parser.unclosed_delims = unclosed_delims;
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)
// This struct is passed around very frequently,
// so make sure it doesn't accidentally get larger
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
rustc_data_structures::static_assert_size!(AttrWrapper, 16);
impl AttrWrapper {
{
let rfc_note = "anonymous parameters are removed in the 2018 edition (see RFC 1685)";
- let (ident, self_sugg, param_sugg, type_sugg) = match pat.kind {
- PatKind::Ident(_, ident, _) => (
- ident,
- format!("self: {}", ident),
- format!("{}: TypeName", ident),
- format!("_: {}", ident),
- ),
- // Also catches `fn foo(&a)`.
- PatKind::Ref(ref pat, mutab)
- if matches!(pat.clone().into_inner().kind, PatKind::Ident(..)) =>
- {
- match pat.clone().into_inner().kind {
- PatKind::Ident(_, ident, _) => {
- let mutab = mutab.prefix_str();
- (
- ident,
- format!("self: &{}{}", mutab, ident),
- format!("{}: &{}TypeName", ident, mutab),
- format!("_: &{}{}", mutab, ident),
- )
+ let (ident, self_sugg, param_sugg, type_sugg, self_span, param_span, type_span) =
+ match pat.kind {
+ PatKind::Ident(_, ident, _) => (
+ ident,
+ "self: ".to_string(),
+ ": TypeName".to_string(),
+ "_: ".to_string(),
+ pat.span.shrink_to_lo(),
+ pat.span.shrink_to_hi(),
+ pat.span.shrink_to_lo(),
+ ),
+ // Also catches `fn foo(&a)`.
+ PatKind::Ref(ref inner_pat, mutab)
+ if matches!(inner_pat.clone().into_inner().kind, PatKind::Ident(..)) =>
+ {
+ match inner_pat.clone().into_inner().kind {
+ PatKind::Ident(_, ident, _) => {
+ let mutab = mutab.prefix_str();
+ (
+ ident,
+ "self: ".to_string(),
+ format!("{}: &{}TypeName", ident, mutab),
+ "_: ".to_string(),
+ pat.span.shrink_to_lo(),
+ pat.span,
+ pat.span.shrink_to_lo(),
+ )
+ }
+ _ => unreachable!(),
}
- _ => unreachable!(),
- }
- }
- _ => {
- // Otherwise, try to get a type and emit a suggestion.
- if let Some(ty) = pat.to_ty() {
- err.span_suggestion_verbose(
- pat.span,
- "explicitly ignore the parameter name",
- format!("_: {}", pprust::ty_to_string(&ty)),
- Applicability::MachineApplicable,
- );
- err.note(rfc_note);
}
+ _ => {
+ // Otherwise, try to get a type and emit a suggestion.
+ if let Some(ty) = pat.to_ty() {
+ err.span_suggestion_verbose(
+ pat.span,
+ "explicitly ignore the parameter name",
+ format!("_: {}", pprust::ty_to_string(&ty)),
+ Applicability::MachineApplicable,
+ );
+ err.note(rfc_note);
+ }
- return None;
- }
- };
+ return None;
+ }
+ };
// `fn foo(a, b) {}`, `fn foo(a<x>, b<y>) {}` or `fn foo(usize, usize) {}`
if first_param {
err.span_suggestion(
- pat.span,
+ self_span,
"if this is a `self` type, give it a parameter name",
self_sugg,
Applicability::MaybeIncorrect,
// `fn foo(HashMap: TypeName<u32>)`.
if self.token != token::Lt {
err.span_suggestion(
- pat.span,
+ param_span,
"if this is a parameter name, give it a type",
param_sugg,
Applicability::HasPlaceholders,
);
}
err.span_suggestion(
- pat.span,
+ type_span,
"if this is a type, explicitly ignore the parameter name",
type_sugg,
Applicability::MachineApplicable,
use super::pat::{RecoverColon, RecoverComma, PARAM_EXPECTED};
use super::ty::{AllowPlus, RecoverQPath, RecoverReturnSign};
-use super::{AttrWrapper, BlockMode, ForceCollect, Parser, PathStyle, Restrictions, TokenType};
+use super::{
+ AttrWrapper, BlockMode, ClosureSpans, ForceCollect, Parser, PathStyle, Restrictions, TokenType,
+};
use super::{SemiColonMode, SeqSep, TokenExpectType, TrailingToken};
use crate::maybe_recover_from_interpolated_ty_qpath;
+use ast::token::DelimToken;
use rustc_ast::ptr::P;
use rustc_ast::token::{self, Token, TokenKind};
use rustc_ast::tokenstream::Spacing;
/// Parses an expression.
#[inline]
pub fn parse_expr(&mut self) -> PResult<'a, P<Expr>> {
+ self.current_closure.take();
+
self.parse_expr_res(Restrictions::empty(), None)
}
let capture_clause = self.parse_capture_clause()?;
let decl = self.parse_fn_block_decl()?;
let decl_hi = self.prev_token.span;
- let body = match decl.output {
+ let mut body = match decl.output {
FnRetTy::Default(_) => {
let restrictions = self.restrictions - Restrictions::STMT_EXPR;
self.parse_expr_res(restrictions, None)?
self.sess.gated_spans.gate(sym::async_closure, span);
}
- Ok(self.mk_expr(
+ if self.token.kind == TokenKind::Semi && self.token_cursor.frame.delim == DelimToken::Paren
+ {
+ // It is likely that the closure body is a block but where the
+ // braces have been removed. We will recover and eat the next
+ // statements later in the parsing process.
+ body = self.mk_expr_err(body.span);
+ }
+
+ let body_span = body.span;
+
+ let closure = self.mk_expr(
lo.to(body.span),
ExprKind::Closure(capture_clause, asyncness, movability, decl, body, lo.to(decl_hi)),
attrs,
- ))
+ );
+
+ // Disable recovery for closure body
+ let spans =
+ ClosureSpans { whole_closure: closure.span, closing_pipe: decl_hi, body: body_span };
+ self.current_closure = Some(spans);
+
+ Ok(closure)
}
/// Parses an optional `move` prefix to a closure-like construct.
let ty_first = if self.token.is_keyword(kw::For) && self.look_ahead(1, |t| t != &token::Lt)
{
let span = self.prev_token.span.between(self.token.span);
- self.struct_span_err(span, "missing trait in a trait impl").emit();
+ self.struct_span_err(span, "missing trait in a trait impl")
+ .span_suggestion(
+ span,
+ "add a trait here",
+ " Trait ".into(),
+ Applicability::HasPlaceholders,
+ )
+ .span_suggestion(
+ span.to(self.token.span),
+ "for an inherent impl, drop this `for`",
+ "".into(),
+ Applicability::MaybeIncorrect,
+ )
+ .emit();
P(Ty {
kind: TyKind::Path(None, err_path(span)),
span,
/// If present, this `Parser` is not parsing Rust code but rather a macro call.
subparser_name: Option<&'static str>,
capture_state: CaptureState,
+ /// This allows us to recover when the user forget to add braces around
+ /// multiple statements in the closure body.
+ pub current_closure: Option<ClosureSpans>,
+}
+
+/// Stores span informations about a closure.
+#[derive(Clone)]
+pub struct ClosureSpans {
+ pub whole_closure: Span,
+ pub closing_pipe: Span,
+ pub body: Span,
}
/// Indicates a range of tokens that should be replaced by
replace_ranges: Vec::new(),
inner_attr_ranges: Default::default(),
},
+ current_closure: None,
};
// Make parser point to the first token.
first = false;
} else {
match self.expect(t) {
- Ok(false) => {}
+ Ok(false) => {
+ self.current_closure.take();
+ }
Ok(true) => {
+ self.current_closure.take();
recovered = true;
break;
}
let sp = self.prev_token.span.shrink_to_hi();
let token_str = pprust::token_kind_to_string(t);
- // Attempt to keep parsing if it was a similar separator.
- if let Some(ref tokens) = t.similar_tokens() {
- if tokens.contains(&self.token.kind) && !unclosed_delims {
- self.bump();
+ match self.current_closure.take() {
+ Some(closure_spans) if self.token.kind == TokenKind::Semi => {
+ // Finding a semicolon instead of a comma
+ // after a closure body indicates that the
+ // closure body may be a block but the user
+ // forgot to put braces around its
+ // statements.
+
+ self.recover_missing_braces_around_closure_body(
+ closure_spans,
+ expect_err,
+ )?;
+
+ continue;
+ }
+
+ _ => {
+ // Attempt to keep parsing if it was a similar separator.
+ if let Some(ref tokens) = t.similar_tokens() {
+ if tokens.contains(&self.token.kind) && !unclosed_delims {
+ self.bump();
+ }
+ }
}
}
Ok((v, trailing, recovered))
}
+ fn recover_missing_braces_around_closure_body(
+ &mut self,
+ closure_spans: ClosureSpans,
+ mut expect_err: DiagnosticBuilder<'_>,
+ ) -> PResult<'a, ()> {
+ let initial_semicolon = self.token.span;
+
+ while self.eat(&TokenKind::Semi) {
+ let _ = self.parse_stmt(ForceCollect::Yes)?;
+ }
+
+ expect_err.set_primary_message(
+ "closure bodies that contain statements must be surrounded by braces",
+ );
+
+ let preceding_pipe_span = closure_spans.closing_pipe;
+ let following_token_span = self.token.span;
+
+ let mut first_note = MultiSpan::from(vec![initial_semicolon]);
+ first_note.push_span_label(
+ initial_semicolon,
+ "this `;` turns the preceding closure into a statement".to_string(),
+ );
+ first_note.push_span_label(
+ closure_spans.body,
+ "this expression is a statement because of the trailing semicolon".to_string(),
+ );
+ expect_err.span_note(first_note, "statement found outside of a block");
+
+ let mut second_note = MultiSpan::from(vec![closure_spans.whole_closure]);
+ second_note.push_span_label(
+ closure_spans.whole_closure,
+ "this is the parsed closure...".to_string(),
+ );
+ second_note.push_span_label(
+ following_token_span,
+ "...but likely you meant the closure to end here".to_string(),
+ );
+ expect_err.span_note(second_note, "the closure body may be incorrectly delimited");
+
+ expect_err.set_span(vec![preceding_pipe_span, following_token_span]);
+
+ let opening_suggestion_str = " {".to_string();
+ let closing_suggestion_str = "}".to_string();
+
+ expect_err.multipart_suggestion(
+ "try adding braces",
+ vec![
+ (preceding_pipe_span.shrink_to_hi(), opening_suggestion_str),
+ (following_token_span.shrink_to_lo(), closing_suggestion_str),
+ ],
+ Applicability::MaybeIncorrect,
+ );
+
+ expect_err.emit();
+
+ Ok(())
+ }
+
/// Parses a sequence, not including the closing delimiter. The function
/// `f` must consume tokens until reaching the next separator or
/// closing bracket.
}
}
+ /// Automatically generated items marked with `rustc_trivial_field_reads`
+ /// will be ignored for the purposes of dead code analysis (see PR #85200
+ /// for discussion).
+ fn should_ignore_item(&self, def_id: DefId) -> bool {
+ if !self.tcx.has_attr(def_id, sym::automatically_derived)
+ && !self
+ .tcx
+ .impl_of_method(def_id)
+ .map_or(false, |impl_id| self.tcx.has_attr(impl_id, sym::automatically_derived))
+ {
+ return false;
+ }
+
+ let has_attr = |def_id| self.tcx.has_attr(def_id, sym::rustc_trivial_field_reads);
+
+ if has_attr(def_id) {
+ return true;
+ }
+
+ if let Some(impl_of) = self.tcx.impl_of_method(def_id) {
+ if has_attr(impl_of) {
+ return true;
+ }
+
+ if let Some(trait_of) = self.tcx.trait_id_of_impl(impl_of) {
+ if has_attr(trait_of) {
+ return true;
+ }
+
+ if let Some(method_ident) = self.tcx.opt_item_name(def_id) {
+ if let Some(trait_method) = self
+ .tcx
+ .associated_items(trait_of)
+ .find_by_name_and_kind(self.tcx, method_ident, ty::AssocKind::Fn, trait_of)
+ {
+ if has_attr(trait_method.def_id) {
+ return true;
+ }
+ }
+ }
+ }
+ } else if let Some(trait_of) = self.tcx.trait_of_item(def_id) {
+ if has_attr(trait_of) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
fn visit_node(&mut self, node: Node<'tcx>) {
+ if let Some(item_def_id) = match node {
+ Node::Item(hir::Item { def_id, .. })
+ | Node::ForeignItem(hir::ForeignItem { def_id, .. })
+ | Node::TraitItem(hir::TraitItem { def_id, .. })
+ | Node::ImplItem(hir::ImplItem { def_id, .. }) => Some(def_id.to_def_id()),
+ _ => None,
+ } {
+ if self.should_ignore_item(item_def_id) {
+ return;
+ }
+ }
+
let had_repr_c = self.repr_has_repr_c;
let had_inherited_pub_visibility = self.inherited_pub_visibility;
let had_pub_visibility = self.pub_visibility;
if blk.targeted_by_break {
self.break_ln.insert(blk.hir_id, succ);
}
- let succ = self.propagate_through_opt_expr(blk.expr.as_deref(), succ);
+ let succ = self.propagate_through_opt_expr(blk.expr, succ);
blk.stmts.iter().rev().fold(succ, |succ, stmt| self.propagate_through_stmt(stmt, succ))
}
// initialization, which is mildly more complex than checking
// once at the func header but otherwise equivalent.
- let succ = self.propagate_through_opt_expr(local.init.as_deref(), succ);
+ let succ = self.propagate_through_opt_expr(local.init, succ);
self.define_bindings_in_pat(&local.pat, succ)
}
hir::StmtKind::Item(..) => succ,
resolve_expr(self, ex);
}
fn visit_local(&mut self, l: &'tcx Local<'tcx>) {
- resolve_local(self, Some(&l.pat), l.init.as_deref());
+ resolve_local(self, Some(&l.pat), l.init);
}
}
use rustc_middle::bug;
use rustc_middle::hir::map::Map;
use rustc_middle::middle::privacy::{AccessLevel, AccessLevels};
-use rustc_middle::mir::abstract_const::Node as ACNode;
use rustc_middle::span_bug;
+use rustc_middle::thir::abstract_const::Node as ACNode;
use rustc_middle::ty::fold::TypeVisitor;
use rustc_middle::ty::query::Providers;
use rustc_middle::ty::subst::{InternalSubsts, Subst};
use rustc_middle::dep_graph::{DepNode, DepNodeIndex, SerializedDepNodeIndex};
use rustc_middle::mir::interpret::{AllocDecodingSession, AllocDecodingState};
use rustc_middle::mir::{self, interpret};
+use rustc_middle::thir;
use rustc_middle::ty::codec::{RefDecodable, TyDecoder, TyEncoder};
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_query_system::dep_graph::DepContext;
};
use rustc_span::source_map::{SourceMap, StableSourceFileId};
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::mem;
const TAG_FULL_SPAN: u8 = 0;
// A partial span with no location information, encoded only with a `SyntaxContext`
const TAG_PARTIAL_SPAN: u8 = 1;
+const TAG_RELATIVE_SPAN: u8 = 2;
const TAG_SYNTAX_CONTEXT: u8 = 0;
const TAG_EXPN_DATA: u8 = 1;
impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for Span {
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)?;
if tag == TAG_PARTIAL_SPAN {
- let ctxt = SyntaxContext::decode(decoder)?;
- return Ok(DUMMY_SP.with_ctxt(ctxt));
+ return Ok(Span::new(BytePos(0), BytePos(0), ctxt, parent));
+ } 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 {
debug_assert_eq!(tag, TAG_FULL_SPAN);
}
let line_lo = usize::decode(decoder)?;
let col_lo = 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 lo = file_lo.lines[line_lo - 1] + col_lo;
let hi = lo + len;
- Ok(Span::new(lo, hi, ctxt))
+ Ok(Span::new(lo, hi, ctxt, parent))
}
}
}
}
-impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for &'tcx [mir::abstract_const::Node<'tcx>] {
+impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for &'tcx [thir::abstract_const::Node<'tcx>] {
fn decode(d: &mut CacheDecoder<'a, 'tcx>) -> Result<Self, String> {
RefDecodable::decode(d)
}
E: 'a + OpaqueEncoder,
{
fn encode(&self, s: &mut CacheEncoder<'a, 'tcx, E>) -> Result<(), E::Error> {
- let span_data = self.data();
- if self.is_dummy() {
- TAG_PARTIAL_SPAN.encode(s)?;
- return span_data.ctxt.encode(s);
+ let span_data = self.data_untracked();
+ span_data.ctxt.encode(s)?;
+ span_data.parent.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);
};
if partial_span {
- TAG_PARTIAL_SPAN.encode(s)?;
- return span_data.ctxt.encode(s);
+ return TAG_PARTIAL_SPAN.encode(s);
}
let (file_lo, line_lo, col_lo) = pos.unwrap();
source_file_index.encode(s)?;
line_lo.encode(s)?;
col_lo.encode(s)?;
- len.encode(s)?;
- span_data.ctxt.encode(s)
+ len.encode(s)
}
}
use parking_lot::Mutex;
use smallvec::{smallvec, SmallVec};
use std::collections::hash_map::Entry;
+use std::fmt::Debug;
use std::hash::Hash;
use std::marker::PhantomData;
use std::sync::atomic::Ordering::Relaxed;
/// `arg` parameter.
///
/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/incremental-compilation.html
- pub fn with_task<Ctxt: HasDepContext<DepKind = K>, A, R>(
+ pub fn with_task<Ctxt: HasDepContext<DepKind = K>, A: Debug, R>(
&self,
key: DepNode<K>,
cx: Ctxt,
arg: A,
task: fn(Ctxt, A) -> R,
- hash_result: impl FnOnce(&mut Ctxt::StableHashingContext, &R) -> Option<Fingerprint>,
+ hash_result: fn(&mut Ctxt::StableHashingContext, &R) -> Option<Fingerprint>,
) -> (R, DepNodeIndex) {
- self.with_task_impl(
- key,
- cx,
- arg,
- task,
- |_key| {
- Some(TaskDeps {
- #[cfg(debug_assertions)]
- node: Some(_key),
- reads: SmallVec::new(),
- read_set: Default::default(),
- phantom_data: PhantomData,
- })
- },
- hash_result,
- )
+ if self.is_fully_enabled() {
+ self.with_task_impl(key, cx, arg, task, hash_result)
+ } else {
+ // Incremental compilation is turned off. We just execute the task
+ // without tracking. We still provide a dep-node index that uniquely
+ // identifies the task so that we have a cheap way of referring to
+ // the query for self-profiling.
+ (task(cx, arg), self.next_virtual_depnode_index())
+ }
}
- fn with_task_impl<Ctxt: HasDepContext<DepKind = K>, A, R>(
+ fn with_task_impl<Ctxt: HasDepContext<DepKind = K>, A: Debug, R>(
&self,
key: DepNode<K>,
cx: Ctxt,
arg: A,
task: fn(Ctxt, A) -> R,
- create_task: fn(DepNode<K>) -> Option<TaskDeps<K>>,
- hash_result: impl FnOnce(&mut Ctxt::StableHashingContext, &R) -> Option<Fingerprint>,
+ hash_result: fn(&mut Ctxt::StableHashingContext, &R) -> Option<Fingerprint>,
) -> (R, DepNodeIndex) {
- if let Some(ref data) = self.data {
- let dcx = cx.dep_context();
- let task_deps = create_task(key).map(Lock::new);
- let result = K::with_deps(task_deps.as_ref(), || task(cx, arg));
- let edges = task_deps.map_or_else(|| smallvec![], |lock| lock.into_inner().reads);
-
- let mut hcx = dcx.create_stable_hashing_context();
- let hashing_timer = dcx.profiler().incr_result_hashing();
- let current_fingerprint = hash_result(&mut hcx, &result);
-
- let print_status = cfg!(debug_assertions) && dcx.sess().opts.debugging_opts.dep_tasks;
-
- // Get timer for profiling `DepNode` interning
- let node_intern_timer = self
- .node_intern_event_id
- .map(|eid| dcx.profiler().generic_activity_with_event_id(eid));
- // Intern the new `DepNode`.
- let (dep_node_index, prev_and_color) = data.current.intern_node(
- dcx.profiler(),
- &data.previous,
- key,
- edges,
- current_fingerprint,
- print_status,
- );
- drop(node_intern_timer);
+ // This function is only called when the graph is enabled.
+ let data = self.data.as_ref().unwrap();
- hashing_timer.finish_with_query_invocation_id(dep_node_index.into());
+ // If the following assertion triggers, it can have two reasons:
+ // 1. Something is wrong with DepNode creation, either here or
+ // in `DepGraph::try_mark_green()`.
+ // 2. Two distinct query keys get mapped to the same `DepNode`
+ // (see for example #48923).
+ assert!(
+ !self.dep_node_exists(&key),
+ "forcing query with already existing `DepNode`\n\
+ - query-key: {:?}\n\
+ - dep-node: {:?}",
+ arg,
+ key
+ );
- if let Some((prev_index, color)) = prev_and_color {
- debug_assert!(
- data.colors.get(prev_index).is_none(),
- "DepGraph::with_task() - Duplicate DepNodeColor \
- insertion for {:?}",
- key
- );
+ let task_deps = if key.kind.is_eval_always() {
+ None
+ } else {
+ Some(Lock::new(TaskDeps {
+ #[cfg(debug_assertions)]
+ node: Some(key),
+ reads: SmallVec::new(),
+ read_set: Default::default(),
+ phantom_data: PhantomData,
+ }))
+ };
+ let result = K::with_deps(task_deps.as_ref(), || task(cx, arg));
+ let edges = task_deps.map_or_else(|| smallvec![], |lock| lock.into_inner().reads);
+
+ let dcx = cx.dep_context();
+ let mut hcx = dcx.create_stable_hashing_context();
+ let hashing_timer = dcx.profiler().incr_result_hashing();
+ let current_fingerprint = hash_result(&mut hcx, &result);
+
+ let print_status = cfg!(debug_assertions) && dcx.sess().opts.debugging_opts.dep_tasks;
+
+ // Get timer for profiling `DepNode` interning
+ let node_intern_timer =
+ self.node_intern_event_id.map(|eid| dcx.profiler().generic_activity_with_event_id(eid));
+ // Intern the new `DepNode`.
+ let (dep_node_index, prev_and_color) = data.current.intern_node(
+ dcx.profiler(),
+ &data.previous,
+ key,
+ edges,
+ current_fingerprint,
+ print_status,
+ );
+ drop(node_intern_timer);
- data.colors.insert(prev_index, color);
- }
+ hashing_timer.finish_with_query_invocation_id(dep_node_index.into());
- (result, dep_node_index)
- } else {
- // Incremental compilation is turned off. We just execute the task
- // without tracking. We still provide a dep-node index that uniquely
- // identifies the task so that we have a cheap way of referring to
- // the query for self-profiling.
- (task(cx, arg), self.next_virtual_depnode_index())
+ if let Some((prev_index, color)) = prev_and_color {
+ debug_assert!(
+ data.colors.get(prev_index).is_none(),
+ "DepGraph::with_task() - Duplicate DepNodeColor \
+ insertion for {:?}",
+ key
+ );
+
+ data.colors.insert(prev_index, color);
}
+
+ (result, dep_node_index)
}
/// Executes something within an "anonymous" task, that is, a task the
}
}
- /// Executes something within an "eval-always" task which is a task
- /// that runs whenever anything changes.
- pub fn with_eval_always_task<Ctxt: HasDepContext<DepKind = K>, A, R>(
- &self,
- key: DepNode<K>,
- cx: Ctxt,
- arg: A,
- task: fn(Ctxt, A) -> R,
- hash_result: impl FnOnce(&mut Ctxt::StableHashingContext, &R) -> Option<Fingerprint>,
- ) -> (R, DepNodeIndex) {
- self.with_task_impl(key, cx, arg, task, |_| None, hash_result)
- }
-
#[inline]
pub fn read_index(&self, dep_node_index: DepNodeIndex) {
if let Some(ref data) = self.data {
None
}
- /// Try to read a node index for the node dep_node.
+ /// Try to mark a node index for the node dep_node.
+ ///
/// A node will have an index, when it's already been marked green, or when we can mark it
/// green. This function will mark the current task as a reader of the specified node, when
/// a node index can be found for that node.
- pub fn try_mark_green_and_read<Ctxt: QueryContext<DepKind = K>>(
- &self,
- tcx: Ctxt,
- dep_node: &DepNode<K>,
- ) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> {
- self.try_mark_green(tcx, dep_node).map(|(prev_index, dep_node_index)| {
- debug_assert!(self.is_green(&dep_node));
- self.read_index(dep_node_index);
- (prev_index, dep_node_index)
- })
- }
-
pub fn try_mark_green<Ctxt: QueryContext<DepKind = K>>(
&self,
tcx: Ctxt,
where
D: Copy + Clone + Eq + Hash,
{
+ #[cold]
+ #[inline(never)]
pub(super) fn find_cycle_in_stack(
&self,
query_map: QueryMap<D>,
//! generate the actual methods on tcx which find and execute the provider,
//! manage the caches, and so forth.
-use crate::dep_graph::{DepContext, DepKind, DepNode, DepNodeParams};
-use crate::dep_graph::{DepNodeIndex, SerializedDepNodeIndex};
+use crate::dep_graph::{DepContext, DepKind, DepNode, DepNodeIndex, DepNodeParams};
use crate::query::caches::QueryCache;
use crate::query::config::{QueryDescription, QueryVtable, QueryVtableExt};
use crate::query::job::{
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::{FxHashMap, FxHasher};
+#[cfg(parallel_compiler)]
+use rustc_data_structures::profiling::TimingGuard;
use rustc_data_structures::sharded::{get_shard_index_by_hash, Sharded};
use rustc_data_structures::sync::{Lock, LockGuard};
use rustc_data_structures::thin_vec::ThinVec;
-#[cfg(not(parallel_compiler))]
-use rustc_errors::DiagnosticBuilder;
-use rustc_errors::{Diagnostic, FatalError};
+use rustc_errors::{DiagnosticBuilder, FatalError};
use rustc_span::{Span, DUMMY_SP};
use std::cell::Cell;
use std::collections::hash_map::Entry;
/// A type representing the responsibility to execute the job in the `job` field.
/// This will poison the relevant query if dropped.
-struct JobOwner<'tcx, D, C>
+struct JobOwner<'tcx, D, K>
where
D: Copy + Clone + Eq + Hash,
- C: QueryCache,
+ K: Eq + Hash + Clone,
{
- state: &'tcx QueryState<D, C::Key>,
- cache: &'tcx QueryCacheStore<C>,
- key: C::Key,
+ state: &'tcx QueryState<D, K>,
+ key: K,
id: QueryJobId<D>,
}
#[cold]
#[inline(never)]
-#[cfg(not(parallel_compiler))]
fn mk_cycle<CTX, V, R>(
tcx: CTX,
- root: QueryJobId<CTX::DepKind>,
- span: Span,
+ error: CycleError,
handle_cycle_error: fn(CTX, DiagnosticBuilder<'_>) -> V,
cache: &dyn crate::query::QueryStorage<Value = V, Stored = R>,
) -> R
V: std::fmt::Debug,
R: Clone,
{
- let error: CycleError = root.find_cycle_in_stack(
- tcx.try_collect_active_jobs().unwrap(),
- &tcx.current_query_job(),
- span,
- );
let error = report_cycle(tcx.dep_context().sess(), error);
let value = handle_cycle_error(tcx, error);
cache.store_nocache(value)
}
-impl<'tcx, D, C> JobOwner<'tcx, D, C>
+impl<'tcx, D, K> JobOwner<'tcx, D, K>
where
D: Copy + Clone + Eq + Hash,
- C: QueryCache,
+ K: Eq + Hash + Clone,
{
/// Either gets a `JobOwner` corresponding the query, allowing us to
/// start executing the query, or returns with the result of the query.
/// for some compile-time benchmarks.
#[inline(always)]
fn try_start<'b, CTX>(
- tcx: CTX,
- state: &'b QueryState<CTX::DepKind, C::Key>,
- cache: &'b QueryCacheStore<C>,
+ tcx: &'b CTX,
+ state: &'b QueryState<CTX::DepKind, K>,
span: Span,
- key: C::Key,
+ key: K,
lookup: QueryLookup,
- query: &QueryVtable<CTX, C::Key, C::Value>,
- ) -> TryGetJob<'b, CTX::DepKind, C>
+ dep_kind: CTX::DepKind,
+ ) -> TryGetJob<'b, CTX::DepKind, K>
where
CTX: QueryContext,
{
let key = entry.key().clone();
entry.insert(QueryResult::Started(job));
- let global_id = QueryJobId::new(id, shard, query.dep_kind);
- let owner = JobOwner { state, cache, id: global_id, key };
+ let global_id = QueryJobId::new(id, shard, dep_kind);
+ let owner = JobOwner { state, id: global_id, key };
return TryGetJob::NotYetStarted(owner);
}
Entry::Occupied(mut entry) => {
match entry.get_mut() {
#[cfg(not(parallel_compiler))]
QueryResult::Started(job) => {
- let id = QueryJobId::new(job.id, shard, query.dep_kind);
+ let id = QueryJobId::new(job.id, shard, dep_kind);
drop(state_lock);
// If we are single-threaded we know that we have cycle error,
// so we just return the error.
- return TryGetJob::Cycle(mk_cycle(
- tcx,
- id,
+ return TryGetJob::Cycle(id.find_cycle_in_stack(
+ tcx.try_collect_active_jobs().unwrap(),
+ &tcx.current_query_job(),
span,
- query.handle_cycle_error,
- &cache.cache,
));
}
#[cfg(parallel_compiler)]
// Get the latch out
let latch = job.latch();
- let key = entry.key().clone();
drop(state_lock);
// thread.
let result = latch.wait_on(tcx.current_query_job(), span);
- if let Err(cycle) = result {
- let cycle = report_cycle(tcx.dep_context().sess(), cycle);
- let value = (query.handle_cycle_error)(tcx, cycle);
- let value = cache.cache.store_nocache(value);
- return TryGetJob::Cycle(value);
+ match result {
+ Ok(()) => TryGetJob::JobCompleted(query_blocked_prof_timer),
+ Err(cycle) => TryGetJob::Cycle(cycle),
}
-
- let cached = cache
- .cache
- .lookup(cache, &key, |value, index| {
- if unlikely!(tcx.dep_context().profiler().enabled()) {
- tcx.dep_context().profiler().query_cache_hit(index.into());
- }
- #[cfg(debug_assertions)]
- {
- cache.cache_hits.fetch_add(1, Ordering::Relaxed);
- }
- (value.clone(), index)
- })
- .unwrap_or_else(|_| panic!("value must be in cache after waiting"));
-
- query_blocked_prof_timer.finish_with_query_invocation_id(cached.1.into());
-
- return TryGetJob::JobCompleted(cached);
}
QueryResult::Poisoned => FatalError.raise(),
}
/// Completes the query by updating the query cache with the `result`,
/// signals the waiter and forgets the JobOwner, so it won't poison the query
- fn complete(self, result: C::Value, dep_node_index: DepNodeIndex) -> C::Stored {
+ fn complete<C>(
+ self,
+ cache: &QueryCacheStore<C>,
+ result: C::Value,
+ dep_node_index: DepNodeIndex,
+ ) -> C::Stored
+ where
+ C: QueryCache<Key = K>,
+ {
// We can move out of `self` here because we `mem::forget` it below
let key = unsafe { ptr::read(&self.key) };
let state = self.state;
- let cache = self.cache;
// Forget ourself so our destructor won't poison the query
mem::forget(self);
}
}
-fn with_diagnostics<F, R>(f: F) -> (R, ThinVec<Diagnostic>)
-where
- F: FnOnce(Option<&Lock<ThinVec<Diagnostic>>>) -> R,
-{
- let diagnostics = Lock::new(ThinVec::new());
- let result = f(Some(&diagnostics));
- (result, diagnostics.into_inner())
-}
-
-impl<'tcx, D, C> Drop for JobOwner<'tcx, D, C>
+impl<'tcx, D, K> Drop for JobOwner<'tcx, D, K>
where
D: Copy + Clone + Eq + Hash,
- C: QueryCache,
+ K: Eq + Hash + Clone,
{
#[inline(never)]
#[cold]
}
/// The result of `try_start`.
-enum TryGetJob<'tcx, D, C>
+enum TryGetJob<'tcx, D, K>
where
D: Copy + Clone + Eq + Hash,
- C: QueryCache,
+ K: Eq + Hash + Clone,
{
/// The query is not yet started. Contains a guard to the cache eventually used to start it.
- NotYetStarted(JobOwner<'tcx, D, C>),
+ NotYetStarted(JobOwner<'tcx, D, K>),
/// The query was already completed.
/// Returns the result of the query and its dep-node index
/// if it succeeded or a cycle error if it failed.
#[cfg(parallel_compiler)]
- JobCompleted((C::Stored, DepNodeIndex)),
+ JobCompleted(TimingGuard<'tcx>),
/// Trying to execute the query resulted in a cycle.
- Cycle(C::Stored),
+ Cycle(CycleError),
}
/// Checks if the query is already computed and in the cache.
span: Span,
key: C::Key,
lookup: QueryLookup,
+ dep_node: Option<DepNode<CTX::DepKind>>,
query: &QueryVtable<CTX, C::Key, C::Value>,
compute: fn(CTX::DepContext, C::Key) -> C::Value,
-) -> C::Stored
+) -> (C::Stored, Option<DepNodeIndex>)
where
C: QueryCache,
- C::Key: DepNodeParams<CTX::DepContext>,
+ C::Key: Clone + DepNodeParams<CTX::DepContext>,
CTX: QueryContext,
{
- let job = match JobOwner::<'_, CTX::DepKind, C>::try_start(
- tcx,
+ match JobOwner::<'_, CTX::DepKind, C::Key>::try_start(
+ &tcx,
state,
- cache,
span,
key.clone(),
lookup,
- query,
+ query.dep_kind,
) {
- TryGetJob::NotYetStarted(job) => job,
- TryGetJob::Cycle(result) => return result,
+ TryGetJob::NotYetStarted(job) => {
+ let (result, dep_node_index) = execute_job(tcx, key, dep_node, query, job.id, compute);
+ let result = job.complete(cache, result, dep_node_index);
+ (result, Some(dep_node_index))
+ }
+ TryGetJob::Cycle(error) => {
+ let result = mk_cycle(tcx, error, query.handle_cycle_error, &cache.cache);
+ (result, None)
+ }
#[cfg(parallel_compiler)]
- TryGetJob::JobCompleted((v, index)) => {
- tcx.dep_context().dep_graph().read_index(index);
- return v;
+ TryGetJob::JobCompleted(query_blocked_prof_timer) => {
+ let (v, index) = cache
+ .cache
+ .lookup(cache, &key, |value, index| (value.clone(), index))
+ .unwrap_or_else(|_| panic!("value must be in cache after waiting"));
+
+ if unlikely!(tcx.dep_context().profiler().enabled()) {
+ tcx.dep_context().profiler().query_cache_hit(index.into());
+ }
+ #[cfg(debug_assertions)]
+ {
+ cache.cache_hits.fetch_add(1, Ordering::Relaxed);
+ }
+ query_blocked_prof_timer.finish_with_query_invocation_id(index.into());
+
+ (v, Some(index))
}
- };
+ }
+}
+fn execute_job<CTX, K, V>(
+ tcx: CTX,
+ key: K,
+ mut dep_node_opt: Option<DepNode<CTX::DepKind>>,
+ query: &QueryVtable<CTX, K, V>,
+ job_id: QueryJobId<CTX::DepKind>,
+ compute: fn(CTX::DepContext, K) -> V,
+) -> (V, DepNodeIndex)
+where
+ K: Clone + DepNodeParams<CTX::DepContext>,
+ V: Debug,
+ CTX: QueryContext,
+{
let dep_graph = tcx.dep_context().dep_graph();
// Fast path for when incr. comp. is off.
if !dep_graph.is_fully_enabled() {
let prof_timer = tcx.dep_context().profiler().query_provider();
- let result = tcx.start_query(job.id, None, || compute(*tcx.dep_context(), key));
+ let result = tcx.start_query(job_id, None, || compute(*tcx.dep_context(), key));
let dep_node_index = dep_graph.next_virtual_depnode_index();
prof_timer.finish_with_query_invocation_id(dep_node_index.into());
- return job.complete(result, dep_node_index);
+ return (result, dep_node_index);
}
- if query.anon {
- let prof_timer = tcx.dep_context().profiler().query_provider();
+ if !query.anon && !query.eval_always {
+ // `to_dep_node` is expensive for some `DepKind`s.
+ let dep_node =
+ dep_node_opt.get_or_insert_with(|| query.to_dep_node(*tcx.dep_context(), &key));
- let ((result, dep_node_index), diagnostics) = with_diagnostics(|diagnostics| {
- tcx.start_query(job.id, diagnostics, || {
- dep_graph.with_anon_task(*tcx.dep_context(), query.dep_kind, || {
- compute(*tcx.dep_context(), key)
- })
- })
- });
+ // The diagnostics for this query will be promoted to the current session during
+ // `try_mark_green()`, so we can ignore them here.
+ if let Some(ret) = tcx.start_query(job_id, None, || {
+ try_load_from_disk_and_cache_in_memory(tcx, &key, &dep_node, query, compute)
+ }) {
+ return ret;
+ }
+ }
- prof_timer.finish_with_query_invocation_id(dep_node_index.into());
+ let prof_timer = tcx.dep_context().profiler().query_provider();
+ let diagnostics = Lock::new(ThinVec::new());
- dep_graph.read_index(dep_node_index);
+ let (result, dep_node_index) = tcx.start_query(job_id, Some(&diagnostics), || {
+ if query.anon {
+ return dep_graph.with_anon_task(*tcx.dep_context(), query.dep_kind, || {
+ compute(*tcx.dep_context(), key)
+ });
+ }
- let side_effects = QuerySideEffects { diagnostics };
+ // `to_dep_node` is expensive for some `DepKind`s.
+ let dep_node = dep_node_opt.unwrap_or_else(|| query.to_dep_node(*tcx.dep_context(), &key));
- if unlikely!(!side_effects.is_empty()) {
- tcx.store_side_effects_for_anon_node(dep_node_index, side_effects);
- }
+ dep_graph.with_task(dep_node, *tcx.dep_context(), key, compute, query.hash_result)
+ });
- return job.complete(result, dep_node_index);
- }
+ prof_timer.finish_with_query_invocation_id(dep_node_index.into());
- let dep_node = query.to_dep_node(*tcx.dep_context(), &key);
+ let diagnostics = diagnostics.into_inner();
+ let side_effects = QuerySideEffects { diagnostics };
- if !query.eval_always {
- // The diagnostics for this query will be
- // promoted to the current session during
- // `try_mark_green()`, so we can ignore them here.
- let loaded = tcx.start_query(job.id, None, || {
- let marked = dep_graph.try_mark_green_and_read(tcx, &dep_node);
- marked.map(|(prev_dep_node_index, dep_node_index)| {
- (
- load_from_disk_and_cache_in_memory(
- tcx,
- key.clone(),
- prev_dep_node_index,
- dep_node_index,
- &dep_node,
- query,
- compute,
- ),
- dep_node_index,
- )
- })
- });
- if let Some((result, dep_node_index)) = loaded {
- return job.complete(result, dep_node_index);
+ if unlikely!(!side_effects.is_empty()) {
+ if query.anon {
+ tcx.store_side_effects_for_anon_node(dep_node_index, side_effects);
+ } else {
+ tcx.store_side_effects(dep_node_index, side_effects);
}
}
- let (result, dep_node_index) = force_query_with_job(tcx, key, job, dep_node, query, compute);
- dep_graph.read_index(dep_node_index);
- result
+ (result, dep_node_index)
}
-fn load_from_disk_and_cache_in_memory<CTX, K, V: Debug>(
+fn try_load_from_disk_and_cache_in_memory<CTX, K, V>(
tcx: CTX,
- key: K,
- prev_dep_node_index: SerializedDepNodeIndex,
- dep_node_index: DepNodeIndex,
+ key: &K,
dep_node: &DepNode<CTX::DepKind>,
query: &QueryVtable<CTX, K, V>,
compute: fn(CTX::DepContext, K) -> V,
-) -> V
+) -> Option<(V, DepNodeIndex)>
where
+ K: Clone,
CTX: QueryContext,
+ V: Debug,
{
// Note this function can be called concurrently from the same query
// We must ensure that this is handled correctly.
- debug_assert!(tcx.dep_context().dep_graph().is_green(dep_node));
+ let dep_graph = tcx.dep_context().dep_graph();
+ let (prev_dep_node_index, dep_node_index) = dep_graph.try_mark_green(tcx, &dep_node)?;
+
+ debug_assert!(dep_graph.is_green(dep_node));
// First we try to load the result from the on-disk cache.
- let result = if query.cache_on_disk(tcx, &key, None) {
+ // Some things are never cached on disk.
+ if query.cache_on_disk(tcx, key, None) {
let prof_timer = tcx.dep_context().profiler().incr_cache_loading();
let result = query.try_load_from_disk(tcx, prev_dep_node_index);
prof_timer.finish_with_query_invocation_id(dep_node_index.into());
"missing on-disk cache entry for {:?}",
dep_node
);
- result
- } else {
- // Some things are never cached on disk.
- None
- };
- if let Some(result) = result {
- // If `-Zincremental-verify-ich` is specified, re-hash results from
- // the cache and make sure that they have the expected fingerprint.
- if unlikely!(tcx.dep_context().sess().opts.debugging_opts.incremental_verify_ich) {
- incremental_verify_ich(*tcx.dep_context(), &result, dep_node, query);
+ if let Some(result) = result {
+ // If `-Zincremental-verify-ich` is specified, re-hash results from
+ // the cache and make sure that they have the expected fingerprint.
+ if unlikely!(tcx.dep_context().sess().opts.debugging_opts.incremental_verify_ich) {
+ incremental_verify_ich(*tcx.dep_context(), &result, dep_node, query);
+ }
+
+ return Some((result, dep_node_index));
}
+ }
- result
- } else {
- // We could not load a result from the on-disk cache, so
- // recompute.
- let prof_timer = tcx.dep_context().profiler().query_provider();
+ // We could not load a result from the on-disk cache, so
+ // recompute.
+ let prof_timer = tcx.dep_context().profiler().query_provider();
- // The dep-graph for this computation is already in-place.
- let result = tcx.dep_context().dep_graph().with_ignore(|| compute(*tcx.dep_context(), key));
+ // The dep-graph for this computation is already in-place.
+ let result = dep_graph.with_ignore(|| compute(*tcx.dep_context(), key.clone()));
- prof_timer.finish_with_query_invocation_id(dep_node_index.into());
-
- // Verify that re-running the query produced a result with the expected hash
- // This catches bugs in query implementations, turning them into ICEs.
- // For example, a query might sort its result by `DefId` - since `DefId`s are
- // not stable across compilation sessions, the result could get up getting sorted
- // in a different order when the query is re-run, even though all of the inputs
- // (e.g. `DefPathHash` values) were green.
- //
- // See issue #82920 for an example of a miscompilation that would get turned into
- // an ICE by this check
- incremental_verify_ich(*tcx.dep_context(), &result, dep_node, query);
+ prof_timer.finish_with_query_invocation_id(dep_node_index.into());
- result
- }
+ // Verify that re-running the query produced a result with the expected hash
+ // This catches bugs in query implementations, turning them into ICEs.
+ // For example, a query might sort its result by `DefId` - since `DefId`s are
+ // not stable across compilation sessions, the result could get up getting sorted
+ // in a different order when the query is re-run, even though all of the inputs
+ // (e.g. `DefPathHash` values) were green.
+ //
+ // See issue #82920 for an example of a miscompilation that would get turned into
+ // an ICE by this check
+ incremental_verify_ich(*tcx.dep_context(), &result, dep_node, query);
+
+ Some((result, dep_node_index))
}
fn incremental_verify_ich<CTX, K, V: Debug>(
}
}
-fn force_query_with_job<C, CTX>(
- tcx: CTX,
- key: C::Key,
- job: JobOwner<'_, CTX::DepKind, C>,
- dep_node: DepNode<CTX::DepKind>,
- query: &QueryVtable<CTX, C::Key, C::Value>,
- compute: fn(CTX::DepContext, C::Key) -> C::Value,
-) -> (C::Stored, DepNodeIndex)
-where
- C: QueryCache,
- CTX: QueryContext,
-{
- // If the following assertion triggers, it can have two reasons:
- // 1. Something is wrong with DepNode creation, either here or
- // in `DepGraph::try_mark_green()`.
- // 2. Two distinct query keys get mapped to the same `DepNode`
- // (see for example #48923).
- assert!(
- !tcx.dep_context().dep_graph().dep_node_exists(&dep_node),
- "forcing query with already existing `DepNode`\n\
- - query-key: {:?}\n\
- - dep-node: {:?}",
- key,
- dep_node
- );
-
- let prof_timer = tcx.dep_context().profiler().query_provider();
-
- let ((result, dep_node_index), diagnostics) = with_diagnostics(|diagnostics| {
- tcx.start_query(job.id, diagnostics, || {
- if query.eval_always {
- tcx.dep_context().dep_graph().with_eval_always_task(
- dep_node,
- *tcx.dep_context(),
- key,
- compute,
- query.hash_result,
- )
- } else {
- tcx.dep_context().dep_graph().with_task(
- dep_node,
- *tcx.dep_context(),
- key,
- compute,
- query.hash_result,
- )
- }
- })
- });
-
- prof_timer.finish_with_query_invocation_id(dep_node_index.into());
-
- let side_effects = QuerySideEffects { diagnostics };
-
- if unlikely!(!side_effects.is_empty()) && dep_node.kind != DepKind::NULL {
- tcx.store_side_effects(dep_node_index, side_effects);
- }
-
- let result = job.complete(result, dep_node_index);
-
- (result, dep_node_index)
-}
-
-#[inline(never)]
-fn get_query_impl<CTX, C>(
- tcx: CTX,
- state: &QueryState<CTX::DepKind, C::Key>,
- cache: &QueryCacheStore<C>,
- span: Span,
- key: C::Key,
- lookup: QueryLookup,
- query: &QueryVtable<CTX, C::Key, C::Value>,
- compute: fn(CTX::DepContext, C::Key) -> C::Value,
-) -> C::Stored
-where
- CTX: QueryContext,
- C: QueryCache,
- C::Key: DepNodeParams<CTX::DepContext>,
-{
- try_execute_query(tcx, state, cache, span, key, lookup, query, compute)
-}
-
/// Ensure that either this query has all green inputs or been executed.
/// Executing `query::ensure(D)` is considered a read of the dep-node `D`.
/// Returns true if the query should still run.
///
/// Note: The optimization is only available during incr. comp.
#[inline(never)]
-fn ensure_must_run<CTX, K, V>(tcx: CTX, key: &K, query: &QueryVtable<CTX, K, V>) -> bool
+fn ensure_must_run<CTX, K, V>(
+ tcx: CTX,
+ key: &K,
+ query: &QueryVtable<CTX, K, V>,
+) -> (bool, Option<DepNode<CTX::DepKind>>)
where
K: crate::dep_graph::DepNodeParams<CTX::DepContext>,
CTX: QueryContext,
{
if query.eval_always {
- return true;
+ return (true, None);
}
// Ensuring an anonymous query makes no sense
let dep_node = query.to_dep_node(*tcx.dep_context(), key);
- match tcx.dep_context().dep_graph().try_mark_green_and_read(tcx, &dep_node) {
+ let dep_graph = tcx.dep_context().dep_graph();
+ match dep_graph.try_mark_green(tcx, &dep_node) {
None => {
- // A None return from `try_mark_green_and_read` means that this is either
+ // A None return from `try_mark_green` means that this is either
// a new dep node or that the dep node has already been marked red.
// Either way, we can't call `dep_graph.read()` as we don't have the
// DepNodeIndex. We must invoke the query itself. The performance cost
// this introduces should be negligible as we'll immediately hit the
// in-memory cache, or another query down the line will.
- true
+ (true, Some(dep_node))
}
Some((_, dep_node_index)) => {
+ dep_graph.read_index(dep_node_index);
tcx.dep_context().profiler().query_cache_hit(dep_node_index.into());
- false
+ (false, None)
}
}
}
Err(lookup) => lookup,
};
- let job = match JobOwner::<'_, CTX::DepKind, C>::try_start(
- tcx,
- state,
- cache,
- DUMMY_SP,
- key.clone(),
- lookup,
- query,
- ) {
- TryGetJob::NotYetStarted(job) => job,
- TryGetJob::Cycle(_) => return true,
- #[cfg(parallel_compiler)]
- TryGetJob::JobCompleted(_) => return true,
- };
-
- force_query_with_job(tcx, key, job, dep_node, query, compute);
-
+ let _ =
+ try_execute_query(tcx, state, cache, DUMMY_SP, key, lookup, Some(dep_node), query, compute);
true
}
CTX: QueryContext,
{
let query = &Q::VTABLE;
- if let QueryMode::Ensure = mode {
- if !ensure_must_run(tcx, &key, query) {
+ let dep_node = if let QueryMode::Ensure = mode {
+ let (must_run, dep_node) = ensure_must_run(tcx, &key, query);
+ if !must_run {
return None;
}
- }
+ dep_node
+ } else {
+ None
+ };
debug!("ty::query::get_query<{}>(key={:?}, span={:?})", Q::NAME, key, span);
let compute = Q::compute_fn(tcx, &key);
- let value = get_query_impl(
+ let (result, dep_node_index) = try_execute_query(
tcx,
Q::query_state(tcx),
Q::query_cache(tcx),
span,
key,
lookup,
+ dep_node,
query,
compute,
);
- Some(value)
+ if let Some(dep_node_index) = dep_node_index {
+ tcx.dep_context().dep_graph().read_index(dep_node_index)
+ }
+ Some(result)
}
pub fn force_query<Q, CTX>(tcx: CTX, dep_node: &DepNode<CTX::DepKind>) -> bool
crate fn build_reduced_graph_external(&mut self, module: Module<'a>) {
let def_id = module.def_id().expect("unpopulated module without a def-id");
for child in self.cstore().item_children_untracked(def_id, self.session) {
- let child = child.map_id(|_| panic!("unexpected id"));
let parent_scope = ParentScope::module(module, self);
BuildReducedGraphVisitor { r: self, parent_scope }
.build_reduced_graph_for_external_crate_res(child);
}
/// Builds the reduced graph for a single item in an external crate.
- fn build_reduced_graph_for_external_crate_res(&mut self, child: Export<NodeId>) {
+ fn build_reduced_graph_for_external_crate_res(&mut self, child: Export) {
let parent = self.parent_scope.module;
let Export { ident, res, vis, span } = child;
+ let res = res.expect_non_local();
let expansion = self.parent_scope.expansion;
// Record primary definitions.
match res {
fn create_def(&mut self, node_id: NodeId, data: DefPathData, span: Span) -> LocalDefId {
let parent_def = self.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) {
use rustc_ast::unwrap_or;
use rustc_ast::NodeId;
-use rustc_ast_lowering::ResolverAstLowering;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::ptr_key::PtrKey;
use rustc_errors::{pluralize, struct_span_err, Applicability};
let mut reexports = Vec::new();
- module.for_each_child(self.r, |this, ident, _, binding| {
+ module.for_each_child(self.r, |_, ident, _, binding| {
// Filter away ambiguous imports and anything that has def-site hygiene.
// FIXME: Implement actual cross-crate hygiene.
let is_good_import =
binding.is_import() && !binding.is_ambiguity() && !ident.span.from_expansion();
if is_good_import || binding.is_macro_def() {
- let res = binding.res().map_id(|id| this.local_def_id(id));
+ let res = binding.res().expect_non_local();
if res != def::Res::Err {
reexports.push(Export { ident, res, span: binding.span, vis: binding.vis });
}
};
use rustc_ast_pretty::pprust::path_segment_to_string;
use rustc_data_structures::fx::FxHashSet;
-use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticBuilder, SuggestionStyle};
+use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticBuilder};
use rustc_hir as hir;
use rustc_hir::def::Namespace::{self, *};
use rustc_hir::def::{self, CtorKind, CtorOf, DefKind};
args[1].span.lo(),
args.last().unwrap().span.hi(),
call_span.ctxt(),
+ None,
))
} else {
None
introduce_suggestion.push((*span, formatter(<_name)));
}
}
- err.multipart_suggestion_with_style(
+ err.multipart_suggestion_verbose(
&msg,
introduce_suggestion,
Applicability::MaybeIncorrect,
- SuggestionStyle::ShowAlways,
);
}
})
.map(|(formatter, span)| (*span, formatter(name)))
.collect();
- err.multipart_suggestion_with_style(
+ err.multipart_suggestion_verbose(
&format!(
"consider using the `{}` lifetime",
lifetime_names.iter().next().unwrap()
),
spans_suggs,
Applicability::MaybeIncorrect,
- SuggestionStyle::ShowAlways,
);
};
let suggest_new = |err: &mut DiagnosticBuilder<'_>, suggs: Vec<Option<String>>| {
};
spans_suggs.push((span, sugg.to_string()));
}
- err.multipart_suggestion_with_style(
+ err.multipart_suggestion_verbose(
"consider using the `'static` lifetime",
spans_suggs,
Applicability::MaybeIncorrect,
- SuggestionStyle::ShowAlways,
);
continue;
}
.unwrap_or((span, sugg));
introduce_suggestion.push((span, sugg.to_string()));
}
- err.multipart_suggestion_with_style(
+ err.multipart_suggestion_verbose(
&msg,
introduce_suggestion,
Applicability::MaybeIncorrect,
- SuggestionStyle::ShowAlways,
);
if should_break {
break;
if spans_suggs.len() > 0 {
// This happens when we have `Foo<T>` where we point at the space before `T`,
// but this can be confusing so we give a suggestion with placeholders.
- err.multipart_suggestion_with_style(
+ err.multipart_suggestion_verbose(
"consider using one of the available lifetimes here",
spans_suggs,
Applicability::HasPlaceholders,
- SuggestionStyle::ShowAlways,
);
}
}
#![feature(crate_visibility_modifier)]
#![feature(format_args_capture)]
#![feature(iter_zip)]
+#![feature(never_type)]
#![feature(nll)]
#![recursion_limit = "256"]
#![allow(rustdoc::private_intra_doc_links)]
/// `CrateNum` resolutions of `extern crate` items.
extern_crate_map: FxHashMap<LocalDefId, CrateNum>,
- export_map: ExportMap<LocalDefId>,
+ export_map: ExportMap,
trait_map: Option<NodeMap<Vec<TraitCandidate>>>,
/// A map from nodes to anonymous modules.
next_node_id: NodeId,
- def_id_to_span: IndexVec<LocalDefId, Span>,
-
node_id_to_def_id: FxHashMap<ast::NodeId, LocalDefId>,
def_id_to_node_id: IndexVec<LocalDefId, ast::NodeId>,
}
}
+ #[inline]
+ fn def_span(&self, id: LocalDefId) -> Span {
+ self.definitions.def_span(id)
+ }
+
fn item_generics_num_lifetimes(&self, def_id: DefId) -> usize {
if let Some(def_id) = def_id.as_local() {
self.item_generics_num_lifetimes[&def_id]
disambiguator
};
- let def_id = self.definitions.create_def(parent, data, expn_id, next_disambiguator);
-
- assert_eq!(self.def_id_to_span.push(span), def_id);
+ let def_id = self.definitions.create_def(parent, data, expn_id, next_disambiguator, span);
// 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
true
}
+ #[inline]
+ fn def_span(&self, id: LocalDefId) -> Span {
+ self.resolver.def_span(id)
+ }
+
#[inline]
fn def_path_hash(&self, def_id: DefId) -> DefPathHash {
self.resolver.def_path_hash(def_id)
let mut module_map = FxHashMap::default();
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 mut visibilities = FxHashMap::default();
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();
assert_eq!(def_id_to_node_id.push(CRATE_NODE_ID), root);
let mut node_id_to_def_id = FxHashMap::default();
.collect(),
lint_buffer: LintBuffer::default(),
next_node_id: NodeId::from_u32(1),
- def_id_to_span,
node_id_to_def_id,
def_id_to_node_id,
placeholder_field_indices: Default::default(),
.iter()
.map(|(ident, entry)| (ident.name, entry.introduced_by_item))
.collect(),
- main_def: self.main_def.clone(),
+ main_def: self.main_def,
trait_impls: self.trait_impls.clone(),
proc_macros,
confused_type_with_std_module: self.confused_type_with_std_module.clone(),
/// Retrieves the span of the given `DefId` if `DefId` is in the local crate.
#[inline]
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
self.next_node_id()
}
+ fn invocation_parent(&self, id: LocalExpnId) -> LocalDefId {
+ self.invocation_parents[&id].0
+ }
+
fn resolve_dollar_crates(&mut self) {
hygiene::update_dollar_crate_names(|ctxt| {
let ident = Ident::new(kw::DollarCrate, DUMMY_SP.with_ctxt(ctxt));
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(if_let_guard)]
#![feature(nll)]
-#![cfg_attr(bootstrap, allow(incomplete_features))] // if_let_guard
#![recursion_limit = "256"]
mod dump_visitor;
char emit_char read_char
}
+impl<S: Encoder> Encodable<S> for ! {
+ fn encode(&self, _s: &mut S) -> Result<(), S::Error> {
+ unreachable!()
+ }
+}
+
+impl<D: Decoder> Decodable<D> for ! {
+ fn decode(_d: &mut D) -> Result<!, D::Error> {
+ unreachable!()
+ }
+}
+
impl<S: Encoder> Encodable<S> for ::std::num::NonZeroU32 {
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
s.emit_u32(self.get())
pub const parse_threads: &str = parse_number;
pub const parse_passes: &str = "a space-separated list of passes, or `all`";
pub const parse_panic_strategy: &str = "either `unwind` or `abort`";
+ pub const parse_opt_panic_strategy: &str = parse_panic_strategy;
pub const parse_relro_level: &str = "one of: `full`, `partial`, or `off`";
pub const parse_sanitizers: &str =
"comma separated list of sanitizers: `address`, `hwaddress`, `leak`, `memory` or `thread`";
}
}
- crate fn parse_panic_strategy(slot: &mut Option<PanicStrategy>, v: Option<&str>) -> bool {
+ crate fn parse_opt_panic_strategy(slot: &mut Option<PanicStrategy>, v: Option<&str>) -> bool {
match v {
Some("unwind") => *slot = Some(PanicStrategy::Unwind),
Some("abort") => *slot = Some(PanicStrategy::Abort),
true
}
+ crate fn parse_panic_strategy(slot: &mut PanicStrategy, v: Option<&str>) -> bool {
+ match v {
+ Some("unwind") => *slot = PanicStrategy::Unwind,
+ Some("abort") => *slot = PanicStrategy::Abort,
+ _ => return false,
+ }
+ true
+ }
+
crate fn parse_relro_level(slot: &mut Option<RelroLevel>, v: Option<&str>) -> bool {
match v {
Some(s) => match s.parse::<RelroLevel>() {
"optimization level (0-3, s, or z; default: 0)"),
overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED],
"use overflow checks for integer arithmetic"),
- panic: Option<PanicStrategy> = (None, parse_panic_strategy, [TRACKED],
+ panic: Option<PanicStrategy> = (None, parse_opt_panic_strategy, [TRACKED],
"panic strategy to compile crate with"),
passes: Vec<String> = (Vec::new(), parse_list, [TRACKED],
"a list of extra LLVM passes to run (space separated)"),
incremental_info: bool = (false, parse_bool, [UNTRACKED],
"print high-level information about incremental reuse (or the lack thereof) \
(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],
"verify incr. comp. hashes of green query instances (default: no)"),
inline_mir: Option<bool> = (None, parse_opt_bool, [TRACKED],
"pass `-install_name @rpath/...` to the macOS linker (default: no)"),
panic_abort_tests: bool = (false, parse_bool, [TRACKED],
"support compiling tests with panic=abort (default: no)"),
+ panic_in_drop: PanicStrategy = (PanicStrategy::Unwind, parse_panic_strategy, [TRACKED],
+ "panic strategy for panics in drops"),
parse_only: bool = (false, parse_bool, [UNTRACKED],
"parse only; do not compile, assemble, or link (default: no)"),
partially_uninit_const_threshold: Option<usize> = (None, parse_opt_number, [TRACKED],
/// Data about code being compiled, gathered during compilation.
pub code_stats: CodeStats,
+ /// If `-zfuel=crate=n` is specified, `Some(crate)`.
+ optimization_fuel_crate: Option<String>,
+
/// Tracks fuel info if `-zfuel=crate=n` is specified.
optimization_fuel: Lock<OptimizationFuel>,
/// This expends fuel if applicable, and records fuel if applicable.
pub fn consider_optimizing<T: Fn() -> String>(&self, crate_name: &str, msg: T) -> bool {
let mut ret = true;
- if let Some(c) = self.opts.debugging_opts.fuel.as_ref().map(|i| &i.0) {
+ if let Some(ref c) = self.optimization_fuel_crate {
if c == crate_name {
assert_eq!(self.threads(), 1);
let mut fuel = self.optimization_fuel.lock();
let local_crate_source_file =
local_crate_source_file.map(|path| file_path_mapping.map_prefix(path).0);
+ let optimization_fuel_crate = sopts.debugging_opts.fuel.as_ref().map(|i| i.0.clone());
let optimization_fuel = Lock::new(OptimizationFuel {
remaining: sopts.debugging_opts.fuel.as_ref().map_or(0, |i| i.1),
out_of_fuel: false,
normalize_projection_ty: AtomicUsize::new(0),
},
code_stats: Default::default(),
+ optimization_fuel_crate,
optimization_fuel,
print_fuel,
jobserver: jobserver::client(),
mut f: impl FnMut(ExpnId, &ExpnData, ExpnHash) -> Result<(), E>,
) -> Result<(), E> {
let all_data: Vec<_> = HygieneData::with(|data| {
- expns
- .map(|expn| (expn, data.expn_data(expn).clone(), data.expn_hash(expn).clone()))
- .collect()
+ expns.map(|expn| (expn, data.expn_data(expn).clone(), data.expn_hash(expn))).collect()
});
for (expn, data, hash) in all_data.into_iter() {
f(expn, &data, hash)?;
#![feature(nll)]
#![feature(min_specialization)]
#![feature(thread_local_const_init)]
-#![cfg_attr(bootstrap, allow(incomplete_features))] // if_let_guard
#[macro_use]
extern crate rustc_macros;
pub use hygiene::{DesugaringKind, ExpnKind, ForLoopLoc, MacroKind};
pub use hygiene::{ExpnData, ExpnHash, ExpnId, LocalExpnId, SyntaxContext};
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;
mod span_encoding;
pub use span_encoding::{Span, DUMMY_SP};
/// Information about where the macro came from, if this piece of
/// code was created by a macro expansion.
pub ctxt: SyntaxContext,
+ pub parent: Option<LocalDefId>,
}
impl SpanData {
#[inline]
pub fn span(&self) -> Span {
- Span::new(self.lo, self.hi, self.ctxt)
+ Span::new(self.lo, self.hi, self.ctxt, self.parent)
}
#[inline]
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]
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]
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
}
}
}
#[inline]
pub fn ctxt(self) -> SyntaxContext {
- self.data().ctxt
+ self.data_untracked().ctxt
}
#[inline]
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.
#[inline]
pub fn is_dummy(self) -> bool {
- let span = self.data();
- span.lo.0 == 0 && span.hi.0 == 0
+ self.data_untracked().is_dummy()
}
/// Returns `true` if this span comes from a macro or desugaring.
#[inline]
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.
#[inline]
pub fn shrink_to_lo(self) -> Span {
- let span = self.data();
+ let span = self.data_untracked();
span.with_hi(span.lo)
}
/// Returns a new span representing an empty span at the end of this span.
#[inline]
pub fn shrink_to_hi(self) -> Span {
- let span = self.data();
+ let span = self.data_untracked();
span.with_lo(span.hi)
}
#[inline]
/// Returns `true` if `hi == lo`.
pub fn is_empty(&self) -> bool {
- let span = self.data();
+ let span = self.data_untracked();
span.hi == span.lo
}
pub fn contains(self, other: Span) -> bool {
let span = self.data();
let other = other.data();
- span.lo <= other.lo && other.hi <= span.hi
+ span.contains(other)
}
/// Returns `true` if `self` touches `other`.
/// The `Span` for the tokens in the previous macro expansion from which `self` was generated,
/// if any.
- pub fn parent(self) -> Option<Span> {
+ pub fn parent_callsite(self) -> Option<Span> {
let expn_data = self.ctxt().outer_expn_data();
if !expn_data.is_root() { Some(expn_data.call_site) } else { None }
}
/// 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> {
while !outer.contains(self) {
- self = self.parent()?;
+ self = self.parent_callsite()?;
}
Some(self)
}
cmp::min(span_data.lo, end_data.lo),
cmp::max(span_data.hi, end_data.hi),
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 },
)
}
span.hi,
end.lo,
if end.ctxt == SyntaxContext::root() { end.ctxt } else { span.ctxt },
+ if span.parent == end.parent { span.parent } else { None },
)
}
span.lo,
end.lo,
if end.ctxt == SyntaxContext::root() { end.ctxt } else { span.ctxt },
+ if span.parent == end.parent { span.parent } else { None },
)
}
span.lo + BytePos::from_usize(inner.start),
span.lo + BytePos::from_usize(inner.end),
span.ctxt,
+ span.parent,
)
}
pub fn remove_mark(&mut self) -> ExpnId {
let mut span = self.data();
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
}
pub fn adjust(&mut self, expn_id: ExpnId) -> Option<ExpnId> {
let mut span = self.data();
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
}
pub fn normalize_to_macros_2_0_and_adjust(&mut self, expn_id: ExpnId) -> Option<ExpnId> {
let mut span = self.data();
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
}
pub fn glob_adjust(&mut self, expn_id: ExpnId, glob_span: Span) -> Option<Option<ExpnId>> {
let mut span = self.data();
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
}
) -> Option<Option<ExpnId>> {
let mut span = self.data();
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
}
let lo = d.read_struct_field("lo", 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))
})
}
}
impl fmt::Debug for SpanData {
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)
}
}
pub static SPAN_DEBUG: AtomicRef<fn(Span, &mut fmt::Formatter<'_>) -> fmt::Result> =
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
pub trait HashStableContext {
fn def_path_hash(&self, def_id: DefId) -> DefPathHash;
fn hash_spans(&self) -> bool;
+ fn def_span(&self, def_id: LocalDefId) -> Span;
fn span_data_to_lines_and_cols(
&mut self,
span: &SpanData,
fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
const TAG_VALID_SPAN: u8 = 0;
const TAG_INVALID_SPAN: u8 = 1;
+ const TAG_RELATIVE_SPAN: u8 = 2;
if !ctx.hash_spans() {
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);
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
// position that belongs to it, as opposed to hashing the first
// 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)
{
Some(pos) => pos,
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));
- 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,
// 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
+use crate::def_id::LocalDefId;
use crate::hygiene::SyntaxContext;
+use crate::SPAN_TRACK;
use crate::{BytePos, SpanData};
use rustc_data_structures::fx::FxIndexSet;
/// the code. No crates in `rustc-perf` need more than 15 bits for `ctxt`,
/// 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)]
pub struct Span {
base_or_index: u32,
impl Span {
#[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 {
std::mem::swap(&mut lo, &mut hi);
}
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.
Span { base_or_index: base, len_or_tag: len as u16, ctxt_or_zero: ctxt2 as u16 }
} else {
// 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 }
}
}
#[inline]
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 {
// Inline format.
debug_assert!(self.len_or_tag as u32 <= MAX_LEN);
lo: BytePos(self.base_or_index),
hi: BytePos(self.base_or_index + self.len_or_tag as u32),
ctxt: SyntaxContext::from_u32(self.ctxt_or_zero as u32),
+ parent: None,
}
} else {
// Interned format.
rustc_synthetic,
rustc_test_marker,
rustc_then_this_would_need,
+ rustc_trivial_field_reads,
rustc_unsafe_specialization_marker,
rustc_variance,
rustdoc,
fn extend_integer_width_mips<Ty>(arg: &mut ArgAbi<'_, Ty>, bits: u64) {
// Always sign extend u32 values on 64-bit mips
- if let abi::Abi::Scalar(ref scalar) = arg.layout.abi {
+ if let abi::Abi::Scalar(scalar) = arg.layout.abi {
if let abi::Int(i, signed) = scalar.value {
if !signed && i.size().bits() == 32 {
if let PassMode::Direct(ref mut attrs) = arg.mode {
C: HasDataLayout,
{
match ret.layout.field(cx, i).abi {
- abi::Abi::Scalar(ref scalar) => match scalar.value {
+ abi::Abi::Scalar(scalar) => match scalar.value {
abi::F32 => Some(Reg::f32()),
abi::F64 => Some(Reg::f64()),
_ => None,
let offset = arg.layout.fields.offset(i);
// We only care about aligned doubles
- if let abi::Abi::Scalar(ref scalar) = field.abi {
+ if let abi::Abi::Scalar(scalar) = field.abi {
if let abi::F64 = scalar.value {
if offset.is_aligned(dl.f64_align.abi) {
// Insert enough integers to cover [last_offset, offset)
Abi::Uninhabited => Err(Heterogeneous),
// The primitive for this algorithm.
- Abi::Scalar(ref scalar) => {
+ Abi::Scalar(scalar) => {
let kind = match scalar.value {
abi::Int(..) | abi::Pointer => RegKind::Integer,
abi::F32 | abi::F64 => RegKind::Float,
pub fn new(
cx: &impl HasDataLayout,
layout: TyAndLayout<'a, Ty>,
- scalar_attrs: impl Fn(&TyAndLayout<'a, Ty>, &abi::Scalar, Size) -> ArgAttributes,
+ scalar_attrs: impl Fn(&TyAndLayout<'a, Ty>, abi::Scalar, Size) -> ArgAttributes,
) -> Self {
- let mode = match &layout.abi {
+ let mode = match layout.abi {
Abi::Uninhabited => PassMode::Ignore,
Abi::Scalar(scalar) => PassMode::Direct(scalar_attrs(&layout, scalar, Size::ZERO)),
Abi::ScalarPair(a, b) => PassMode::Pair(
pub fn extend_integer_width_to(&mut self, bits: u64) {
// Only integers have signedness
- if let Abi::Scalar(ref scalar) = self.layout.abi {
+ if let Abi::Scalar(scalar) = self.layout.abi {
if let abi::Int(i, signed) = scalar.value {
if i.size().bits() < bits {
if let PassMode::Direct(ref mut attrs) = self.mode {
Ty: TyAbiInterface<'a, C> + Copy,
{
match arg_layout.abi {
- Abi::Scalar(ref scalar) => match scalar.value {
+ Abi::Scalar(scalar) => match scalar.value {
abi::Int(..) | abi::Pointer => {
if arg_layout.size.bits() > xlen {
return Err(CannotUseFpConv);
}
fn extend_integer_width<'a, Ty>(arg: &mut ArgAbi<'a, Ty>, xlen: u64) {
- if let Abi::Scalar(ref scalar) = arg.layout.abi {
+ if let Abi::Scalar(scalar) = arg.layout.abi {
if let abi::Int(i, _) = scalar.value {
// 32-bit integers are always sign-extended
if i.size().bits() == 32 && xlen > 32 {
C: HasDataLayout,
{
match layout.abi {
- abi::Abi::Scalar(ref scalar) => scalar.value.is_float(),
+ abi::Abi::Scalar(scalar) => scalar.value.is_float(),
abi::Abi::Aggregate { .. } => {
if layout.fields.count() == 1 && layout.fields.offset(0).bytes() == 0 {
is_single_fp_element(cx, layout.field(cx, 0))
C: HasDataLayout,
{
match layout.abi {
- abi::Abi::Scalar(ref scalar) => scalar.value.is_float(),
+ abi::Abi::Scalar(scalar) => scalar.value.is_float(),
abi::Abi::Aggregate { .. } => {
if layout.fields.count() == 1 && layout.fields.offset(0).bytes() == 0 {
is_single_fp_element(cx, layout.field(cx, 0))
let mut c = match layout.abi {
Abi::Uninhabited => return Ok(()),
- Abi::Scalar(ref scalar) => match scalar.value {
+ Abi::Scalar(scalar) => match scalar.value {
abi::Int(..) | abi::Pointer => Class::Int,
abi::F32 | abi::F64 => Class::Sse,
},
use std::fmt;
use std::iter::Step;
use std::num::NonZeroUsize;
-use std::ops::{Add, AddAssign, Deref, Mul, Range, RangeInclusive, Sub};
+use std::ops::{Add, AddAssign, Deref, Mul, RangeInclusive, Sub};
use std::str::FromStr;
use rustc_index::vec::{Idx, IndexVec};
// Truncate (shift left to drop out leftover values, shift right to fill with zeroes).
(value << shift) >> shift
}
+
+ #[inline]
+ pub fn signed_int_min(&self) -> i128 {
+ self.sign_extend(1_u128 << (self.bits() - 1)) as i128
+ }
+
+ #[inline]
+ pub fn signed_int_max(&self) -> i128 {
+ i128::MAX >> (128 - self.bits())
+ }
+
+ #[inline]
+ pub fn unsigned_int_max(&self) -> u128 {
+ u128::MAX >> (128 - self.bits())
+ }
}
// Panicking addition, subtraction and multiplication for convenience.
///
/// 254 (-2), 255 (-1), 0, 1, 2
///
-/// This is intended specifically to mirror LLVM’s `!range` metadata,
-/// semantics.
-#[derive(Clone, PartialEq, Eq, Hash)]
+/// This is intended specifically to mirror LLVM’s `!range` metadata semantics.
+#[derive(Clone, Copy, PartialEq, Eq, Hash)]
#[derive(HashStable_Generic)]
pub struct WrappingRange {
pub start: u128,
}
}
- /// Returns `true` if zero is contained in the range.
- /// Equal to `range.contains(0)` but should be faster.
- #[inline(always)]
- pub fn contains_zero(&self) -> bool {
- self.start > self.end || self.start == 0
- }
-
/// Returns `self` with replaced `start`
#[inline(always)]
pub fn with_start(mut self, start: u128) -> Self {
self.end = end;
self
}
+
+ /// Returns `true` if `size` completely fills the range.
+ #[inline]
+ pub fn is_full_for(&self, size: Size) -> bool {
+ let max_value = size.unsigned_int_max();
+ debug_assert!(self.start <= max_value && self.end <= max_value);
+ self.start == (self.end.wrapping_add(1) & max_value)
+ }
}
impl fmt::Debug for WrappingRange {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
- write!(fmt, "{}..={}", self.start, self.end)?;
+ if self.start > self.end {
+ write!(fmt, "(..={}) | ({}..)", self.end, self.start)?;
+ } else {
+ write!(fmt, "{}..={}", self.start, self.end)?;
+ }
Ok(())
}
}
/// Information about one scalar component of a Rust type.
-#[derive(Clone, PartialEq, Eq, Hash, Debug)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[derive(HashStable_Generic)]
pub struct Scalar {
pub value: Primitive,
impl Scalar {
#[inline]
pub fn is_bool(&self) -> bool {
- matches!(self.value, Int(I8, false))
- && matches!(self.valid_range, WrappingRange { start: 0, end: 1 })
+ matches!(
+ self,
+ Scalar { value: Int(I8, false), valid_range: WrappingRange { start: 0, end: 1 } }
+ )
}
- /// Returns the valid range as a `x..y` range.
- ///
- /// If `x` and `y` are equal, the range is full, not empty.
- pub fn valid_range_exclusive<C: HasDataLayout>(&self, cx: &C) -> Range<u128> {
- // For a (max) value of -1, max will be `-1 as usize`, which overflows.
- // However, that is fine here (it would still represent the full range),
- // i.e., if the range is everything.
- let bits = self.value.size(cx).bits();
- assert!(bits <= 128);
- let mask = !0u128 >> (128 - bits);
- let start = self.valid_range.start;
- let end = self.valid_range.end;
- assert_eq!(start, start & mask);
- assert_eq!(end, end & mask);
- start..(end.wrapping_add(1) & mask)
+ /// Returns `true` if all possible numbers are valid, i.e `valid_range` covers the whole layout
+ #[inline]
+ pub fn is_always_valid<C: HasDataLayout>(&self, cx: &C) -> bool {
+ self.valid_range.is_full_for(self.value.size(cx))
}
}
/// Describes how values of the type are passed by target ABIs,
/// in terms of categories of C types there are ABI rules for.
-#[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
pub enum Abi {
Uninhabited,
Scalar(Scalar),
/// Returns `true` if this is a single signed integer scalar
#[inline]
pub fn is_signed(&self) -> bool {
- match *self {
- Abi::Scalar(ref scal) => match scal.value {
+ match self {
+ Abi::Scalar(scal) => match scal.value {
Primitive::Int(_, signed) => signed,
_ => false,
},
},
}
-#[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
pub struct Niche {
pub offset: Size,
pub scalar: Scalar,
}
pub fn available<C: HasDataLayout>(&self, cx: &C) -> u128 {
- let Scalar { value, valid_range: ref v } = self.scalar;
- let bits = value.size(cx).bits();
- assert!(bits <= 128);
- let max_value = !0u128 >> (128 - bits);
+ let Scalar { value, valid_range: v } = self.scalar;
+ let size = value.size(cx);
+ assert!(size.bits() <= 128);
+ let max_value = size.unsigned_int_max();
// Find out how many values are outside the valid range.
let niche = v.end.wrapping_add(1)..v.start;
pub fn reserve<C: HasDataLayout>(&self, cx: &C, count: u128) -> Option<(u128, Scalar)> {
assert!(count > 0);
- let Scalar { value, valid_range: v } = self.scalar.clone();
- let bits = value.size(cx).bits();
- assert!(bits <= 128);
- let max_value = !0u128 >> (128 - bits);
+ let Scalar { value, valid_range: v } = self.scalar;
+ let size = value.size(cx);
+ assert!(size.bits() <= 128);
+ let max_value = size.unsigned_int_max();
- if count > max_value {
+ let niche = v.end.wrapping_add(1)..v.start;
+ let available = niche.end.wrapping_sub(niche.start) & max_value;
+ if count > available {
return None;
}
- // Compute the range of invalid values being reserved.
- let start = v.end.wrapping_add(1) & max_value;
- let end = v.end.wrapping_add(count) & max_value;
-
- if v.contains(end) {
- return None;
+ // Extend the range of valid values being reserved by moving either `v.start` or `v.end` bound.
+ // Given an eventual `Option<T>`, we try to maximize the chance for `None` to occupy the niche of zero.
+ // This is accomplished by prefering enums with 2 variants(`count==1`) and always taking the shortest path to niche zero.
+ // Having `None` in niche zero can enable some special optimizations.
+ //
+ // Bound selection criteria:
+ // 1. Select closest to zero given wrapping semantics.
+ // 2. Avoid moving past zero if possible.
+ //
+ // In practice this means that enums with `count > 1` are unlikely to claim niche zero, since they have to fit perfectly.
+ // If niche zero is already reserved, the selection of bounds are of little interest.
+ let move_start = |v: WrappingRange| {
+ let start = v.start.wrapping_sub(1) & max_value;
+ Some((start, Scalar { value, valid_range: v.with_start(start) }))
+ };
+ let move_end = |v: WrappingRange| {
+ let start = v.end.wrapping_add(1) & max_value;
+ let end = v.end.wrapping_add(count) & max_value;
+ Some((start, Scalar { value, valid_range: v.with_end(end) }))
+ };
+ let distance_end_zero = max_value - v.end;
+ if v.start > v.end {
+ // zero is unavailable because wrapping occurs
+ move_end(v)
+ } else if v.start <= distance_end_zero {
+ if count <= v.start {
+ move_start(v)
+ } else {
+ // moved past zero, use other bound
+ move_end(v)
+ }
+ } else {
+ let end = v.end.wrapping_add(count) & max_value;
+ let overshot_zero = (1..=v.end).contains(&end);
+ if overshot_zero {
+ // moved past zero, use other bound
+ move_start(v)
+ } else {
+ move_end(v)
+ }
}
-
- Some((start, Scalar { value, valid_range: v.with_end(end) }))
}
}
impl Layout {
pub fn scalar<C: HasDataLayout>(cx: &C, scalar: Scalar) -> Self {
- let largest_niche = Niche::from_scalar(cx, Size::ZERO, scalar.clone());
+ let largest_niche = Niche::from_scalar(cx, Size::ZERO, scalar);
let size = scalar.value.size(cx);
let align = scalar.value.align(cx);
Layout {
Ty: TyAbiInterface<'a, C>,
C: HasDataLayout,
{
- let scalar_allows_raw_init = move |s: &Scalar| -> bool {
+ let scalar_allows_raw_init = move |s: Scalar| -> bool {
if zero {
// The range must contain 0.
- s.valid_range.contains_zero()
+ s.valid_range.contains(0)
} else {
- // The range must include all values. `valid_range_exclusive` handles
- // the wrap-around using target arithmetic; with wrap-around then the full
- // range is one where `start == end`.
- let range = s.valid_range_exclusive(cx);
- range.start == range.end
+ // The range must include all values.
+ s.is_always_valid(cx)
}
};
// Check the ABI.
- let valid = match &self.abi {
+ let valid = match self.abi {
Abi::Uninhabited => false, // definitely UB
Abi::Scalar(s) => scalar_allows_raw_init(s),
Abi::ScalarPair(s1, s2) => scalar_allows_raw_init(s1) && scalar_allows_raw_init(s2),
- Abi::Vector { element: s, count } => *count == 0 || scalar_allows_raw_init(s),
+ Abi::Vector { element: s, count } => count == 0 || scalar_allows_raw_init(s),
Abi::Aggregate { .. } => true, // Fields are checked below.
};
if !valid {
--- /dev/null
+use crate::spec::{LinkArgs, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions};
+
+/// A base target for Nintendo 3DS devices using the devkitARM toolchain.
+///
+/// Requires the devkitARM toolchain for 3DS targets on the host system.
+
+pub fn target() -> Target {
+ let mut pre_link_args = LinkArgs::new();
+ pre_link_args.insert(
+ LinkerFlavor::Gcc,
+ vec![
+ "-specs=3dsx.specs".to_string(),
+ "-mtune=mpcore".to_string(),
+ "-mfloat-abi=hard".to_string(),
+ "-mtp=soft".to_string(),
+ ],
+ );
+
+ Target {
+ llvm_target: "armv6k-none-eabihf".to_string(),
+ pointer_width: 32,
+ data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
+ arch: "arm".to_string(),
+
+ options: TargetOptions {
+ os: "horizon".to_string(),
+ env: "newlib".to_string(),
+ vendor: "nintendo".to_string(),
+ abi: "eabihf".to_string(),
+ linker_flavor: LinkerFlavor::Gcc,
+ cpu: "mpcore".to_string(),
+ executables: true,
+ families: vec!["unix".to_string()],
+ linker: Some("arm-none-eabi-gcc".to_string()),
+ relocation_model: RelocModel::Static,
+ features: "+vfp2".to_string(),
+ pre_link_args,
+ exe_suffix: ".elf".to_string(),
+ panic_strategy: PanicStrategy::Abort,
+ ..Default::default()
+ },
+ }
+}
("bpfeb-unknown-none", bpfeb_unknown_none),
("bpfel-unknown-none", bpfel_unknown_none),
+
+ ("armv6k-nintendo-3ds", armv6k_nintendo_3ds),
}
/// Warnings encountered when parsing the target `json`.
use crate::traits::query::outlives_bounds::InferCtxtExt as _;
use crate::traits::{self, TraitEngine, TraitEngineExt};
+use rustc_data_structures::stable_set::FxHashSet;
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_hir::lang_items::LangItem;
fn add_implied_bounds(
&mut self,
infcx: &InferCtxt<'a, 'tcx>,
- fn_sig_tys: &[Ty<'tcx>],
+ fn_sig_tys: FxHashSet<Ty<'tcx>>,
body_id: hir::HirId,
span: Span,
);
fn add_implied_bounds(
&mut self,
infcx: &InferCtxt<'a, 'tcx>,
- fn_sig_tys: &[Ty<'tcx>],
+ fn_sig_tys: FxHashSet<Ty<'tcx>>,
body_id: hir::HirId,
span: Span,
) {
debug!("add_implied_bounds()");
- for &ty in fn_sig_tys {
+ for ty in fn_sig_tys {
let ty = infcx.resolve_vars_if_possible(ty);
debug!("add_implied_bounds: ty = {}", ty);
let implied_bounds = infcx.implied_outlives_bounds(self.param_env, body_id, ty, span);
//! this is not as easy.
//!
//! In this case we try to build an abstract representation of this constant using
-//! `mir_abstract_const` which can then be checked for structural equality with other
+//! `thir_abstract_const` which can then be checked for structural equality with other
//! generic constants mentioned in the `caller_bounds` of the current environment.
use rustc_errors::ErrorReported;
use rustc_hir::def::DefKind;
-use rustc_index::bit_set::BitSet;
use rustc_index::vec::IndexVec;
use rustc_infer::infer::InferCtxt;
-use rustc_middle::mir::abstract_const::{Node, NodeId, NotConstEvaluatable};
+use rustc_middle::mir;
use rustc_middle::mir::interpret::ErrorHandled;
-use rustc_middle::mir::{self, Rvalue, StatementKind, TerminatorKind};
+use rustc_middle::thir;
+use rustc_middle::thir::abstract_const::{self, Node, NodeId, NotConstEvaluatable};
use rustc_middle::ty::subst::{Subst, SubstsRef};
use rustc_middle::ty::{self, TyCtxt, TypeFoldable};
use rustc_session::lint;
tcx: TyCtxt<'tcx>,
uv: ty::Unevaluated<'tcx, ()>,
) -> Result<Option<AbstractConst<'tcx>>, ErrorReported> {
- let inner = tcx.mir_abstract_const_opt_const_arg(uv.def)?;
+ let inner = tcx.thir_abstract_const_opt_const_arg(uv.def)?;
debug!("AbstractConst::new({:?}) = {:?}", uv, inner);
Ok(inner.map(|inner| AbstractConst { inner, substs: uv.substs(tcx) }))
}
}
}
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-struct WorkNode<'tcx> {
- node: Node<'tcx>,
- span: Span,
- used: bool,
-}
-
struct AbstractConstBuilder<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
- body: &'a mir::Body<'tcx>,
+ body_id: thir::ExprId,
+ body: &'a thir::Thir<'tcx>,
/// The current WIP node tree.
- ///
- /// We require all nodes to be used in the final abstract const,
- /// so we store this here. Note that we also consider nodes as used
- /// if they are mentioned in an assert, so some used nodes are never
- /// actually reachable by walking the [`AbstractConst`].
- nodes: IndexVec<NodeId, WorkNode<'tcx>>,
- locals: IndexVec<mir::Local, NodeId>,
- /// We only allow field accesses if they access
- /// the result of a checked operation.
- checked_op_locals: BitSet<mir::Local>,
+ nodes: IndexVec<NodeId, Node<'tcx>>,
}
impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
+ fn root_span(&self) -> Span {
+ self.body.exprs[self.body_id].span
+ }
+
fn error(&mut self, span: Option<Span>, msg: &str) -> Result<!, ErrorReported> {
self.tcx
.sess
- .struct_span_err(self.body.span, "overly complex generic constant")
- .span_label(span.unwrap_or(self.body.span), msg)
+ .struct_span_err(self.root_span(), "overly complex generic constant")
+ .span_label(span.unwrap_or(self.root_span()), msg)
.help("consider moving this anonymous constant into a `const` function")
.emit();
fn new(
tcx: TyCtxt<'tcx>,
- body: &'a mir::Body<'tcx>,
+ (body, body_id): (&'a thir::Thir<'tcx>, thir::ExprId),
) -> Result<Option<AbstractConstBuilder<'a, 'tcx>>, ErrorReported> {
- let mut builder = AbstractConstBuilder {
- tcx,
- body,
- nodes: IndexVec::new(),
- locals: IndexVec::from_elem(NodeId::MAX, &body.local_decls),
- checked_op_locals: BitSet::new_empty(body.local_decls.len()),
- };
-
- // We don't have to look at concrete constants, as we
- // can just evaluate them.
- if !body.is_polymorphic {
- return Ok(None);
- }
+ let builder = AbstractConstBuilder { tcx, body_id, body, nodes: IndexVec::new() };
- // We only allow consts without control flow, so
- // we check for cycles here which simplifies the
- // rest of this implementation.
- if body.is_cfg_cyclic() {
- builder.error(None, "cyclic anonymous constants are forbidden")?;
+ struct IsThirPolymorphic<'a, 'tcx> {
+ is_poly: bool,
+ thir: &'a thir::Thir<'tcx>,
+ tcx: TyCtxt<'tcx>,
}
- Ok(Some(builder))
- }
-
- fn add_node(&mut self, node: Node<'tcx>, span: Span) -> NodeId {
- // Mark used nodes.
- match node {
- Node::Leaf(_) => (),
- Node::Binop(_, lhs, rhs) => {
- self.nodes[lhs].used = true;
- self.nodes[rhs].used = true;
- }
- Node::UnaryOp(_, input) => {
- self.nodes[input].used = true;
- }
- Node::FunctionCall(func, nodes) => {
- self.nodes[func].used = true;
- nodes.iter().for_each(|&n| self.nodes[n].used = true);
+ use thir::visit;
+ impl<'a, 'tcx: 'a> visit::Visitor<'a, 'tcx> for IsThirPolymorphic<'a, 'tcx> {
+ fn thir(&self) -> &'a thir::Thir<'tcx> {
+ &self.thir
}
- Node::Cast(_, operand, _) => {
- self.nodes[operand].used = true;
+
+ fn visit_expr(&mut self, expr: &thir::Expr<'tcx>) {
+ self.is_poly |= expr.ty.definitely_has_param_types_or_consts(self.tcx);
+ if self.is_poly == false {
+ visit::walk_expr(self, expr)
+ }
}
- }
- // Nodes start as unused.
- self.nodes.push(WorkNode { node, span, used: false })
- }
+ fn visit_pat(&mut self, pat: &thir::Pat<'tcx>) {
+ self.is_poly |= pat.ty.definitely_has_param_types_or_consts(self.tcx);
+ if self.is_poly == false {
+ visit::walk_pat(self, pat);
+ }
+ }
- fn place_to_local(
- &mut self,
- span: Span,
- p: &mir::Place<'tcx>,
- ) -> Result<mir::Local, ErrorReported> {
- const ZERO_FIELD: mir::Field = mir::Field::from_usize(0);
- // Do not allow any projections.
- //
- // One exception are field accesses on the result of checked operations,
- // which are required to support things like `1 + 2`.
- if let Some(p) = p.as_local() {
- debug_assert!(!self.checked_op_locals.contains(p));
- Ok(p)
- } else if let &[mir::ProjectionElem::Field(ZERO_FIELD, _)] = p.projection.as_ref() {
- // Only allow field accesses if the given local
- // contains the result of a checked operation.
- if self.checked_op_locals.contains(p.local) {
- Ok(p.local)
- } else {
- self.error(Some(span), "unsupported projection")?;
+ fn visit_const(&mut self, ct: &'tcx ty::Const<'tcx>) {
+ self.is_poly |= ct.definitely_has_param_types_or_consts(self.tcx);
}
- } else {
- self.error(Some(span), "unsupported projection")?;
}
- }
- fn operand_to_node(
- &mut self,
- span: Span,
- op: &mir::Operand<'tcx>,
- ) -> Result<NodeId, ErrorReported> {
- debug!("operand_to_node: op={:?}", op);
- match op {
- mir::Operand::Copy(p) | mir::Operand::Move(p) => {
- let local = self.place_to_local(span, p)?;
- Ok(self.locals[local])
- }
- mir::Operand::Constant(ct) => match ct.literal {
- mir::ConstantKind::Ty(ct) => Ok(self.add_node(Node::Leaf(ct), span)),
- mir::ConstantKind::Val(..) => self.error(Some(span), "unsupported constant")?,
- },
+ let mut is_poly_vis = IsThirPolymorphic { is_poly: false, thir: body, tcx };
+ visit::walk_expr(&mut is_poly_vis, &body[body_id]);
+ debug!("AbstractConstBuilder: is_poly={}", is_poly_vis.is_poly);
+ if is_poly_vis.is_poly == false {
+ return Ok(None);
}
+
+ Ok(Some(builder))
}
/// We do not allow all binary operations in abstract consts, so filter disallowed ones.
}
}
- fn build_statement(&mut self, stmt: &mir::Statement<'tcx>) -> Result<(), ErrorReported> {
- debug!("AbstractConstBuilder: stmt={:?}", stmt);
- let span = stmt.source_info.span;
- match stmt.kind {
- StatementKind::Assign(box (ref place, ref rvalue)) => {
- let local = self.place_to_local(span, place)?;
- match *rvalue {
- Rvalue::Use(ref operand) => {
- self.locals[local] = self.operand_to_node(span, operand)?;
- Ok(())
- }
- Rvalue::BinaryOp(op, box (ref lhs, ref rhs)) if Self::check_binop(op) => {
- let lhs = self.operand_to_node(span, lhs)?;
- let rhs = self.operand_to_node(span, rhs)?;
- self.locals[local] = self.add_node(Node::Binop(op, lhs, rhs), span);
- if op.is_checkable() {
- bug!("unexpected unchecked checkable binary operation");
- } else {
- Ok(())
- }
- }
- Rvalue::CheckedBinaryOp(op, box (ref lhs, ref rhs))
- if Self::check_binop(op) =>
- {
- let lhs = self.operand_to_node(span, lhs)?;
- let rhs = self.operand_to_node(span, rhs)?;
- self.locals[local] = self.add_node(Node::Binop(op, lhs, rhs), span);
- self.checked_op_locals.insert(local);
- Ok(())
- }
- Rvalue::UnaryOp(op, ref operand) if Self::check_unop(op) => {
- let operand = self.operand_to_node(span, operand)?;
- self.locals[local] = self.add_node(Node::UnaryOp(op, operand), span);
- Ok(())
- }
- Rvalue::Cast(cast_kind, ref operand, ty) => {
- let operand = self.operand_to_node(span, operand)?;
- self.locals[local] =
- self.add_node(Node::Cast(cast_kind, operand, ty), span);
- Ok(())
- }
- _ => self.error(Some(span), "unsupported rvalue")?,
- }
- }
- // These are not actually relevant for us here, so we can ignore them.
- StatementKind::AscribeUserType(..)
- | StatementKind::StorageLive(_)
- | StatementKind::StorageDead(_) => Ok(()),
- _ => self.error(Some(stmt.source_info.span), "unsupported statement")?,
- }
- }
-
- /// Possible return values:
- ///
- /// - `None`: unsupported terminator, stop building
- /// - `Some(None)`: supported terminator, finish building
- /// - `Some(Some(block))`: support terminator, build `block` next
- fn build_terminator(
- &mut self,
- terminator: &mir::Terminator<'tcx>,
- ) -> Result<Option<mir::BasicBlock>, ErrorReported> {
- debug!("AbstractConstBuilder: terminator={:?}", terminator);
- match terminator.kind {
- TerminatorKind::Goto { target } => Ok(Some(target)),
- TerminatorKind::Return => Ok(None),
- TerminatorKind::Call {
- ref func,
- ref args,
- destination: Some((ref place, target)),
- // We do not care about `cleanup` here. Any branch which
- // uses `cleanup` will fail const-eval and they therefore
- // do not matter when checking for const evaluatability.
- //
- // Do note that even if `panic::catch_unwind` is made const,
- // we still do not have to care about this, as we do not look
- // into functions.
- cleanup: _,
- // Do not allow overloaded operators for now,
- // we probably do want to allow this in the future.
- //
- // This is currently fairly irrelevant as it requires `const Trait`s.
- from_hir_call: true,
- fn_span,
- } => {
- let local = self.place_to_local(fn_span, place)?;
- let func = self.operand_to_node(fn_span, func)?;
- let args = self.tcx.arena.alloc_from_iter(
- args.iter()
- .map(|arg| self.operand_to_node(terminator.source_info.span, arg))
- .collect::<Result<Vec<NodeId>, _>>()?,
- );
- self.locals[local] = self.add_node(Node::FunctionCall(func, args), fn_span);
- Ok(Some(target))
- }
- TerminatorKind::Assert { ref cond, expected: false, target, .. } => {
- let p = match cond {
- mir::Operand::Copy(p) | mir::Operand::Move(p) => p,
- mir::Operand::Constant(_) => bug!("unexpected assert"),
- };
-
- const ONE_FIELD: mir::Field = mir::Field::from_usize(1);
- debug!("proj: {:?}", p.projection);
- if let Some(p) = p.as_local() {
- debug_assert!(!self.checked_op_locals.contains(p));
- // Mark locals directly used in asserts as used.
- //
- // This is needed because division does not use `CheckedBinop` but instead
- // adds an explicit assert for `divisor != 0`.
- self.nodes[self.locals[p]].used = true;
- return Ok(Some(target));
- } else if let &[mir::ProjectionElem::Field(ONE_FIELD, _)] = p.projection.as_ref() {
- // Only allow asserts checking the result of a checked operation.
- if self.checked_op_locals.contains(p.local) {
- return Ok(Some(target));
- }
- }
-
- self.error(Some(terminator.source_info.span), "unsupported assertion")?;
- }
- _ => self.error(Some(terminator.source_info.span), "unsupported terminator")?,
- }
- }
-
- /// Builds the abstract const by walking the mir from start to finish
- /// and bailing out when encountering an unsupported operation.
+ /// Builds the abstract const by walking the thir and bailing out when
+ /// encountering an unspported operation.
fn build(mut self) -> Result<&'tcx [Node<'tcx>], ErrorReported> {
- let mut block = &self.body.basic_blocks()[mir::START_BLOCK];
- // We checked for a cyclic cfg above, so this should terminate.
- loop {
- debug!("AbstractConstBuilder: block={:?}", block);
- for stmt in block.statements.iter() {
- self.build_statement(stmt)?;
- }
+ debug!("Abstractconstbuilder::build: body={:?}", &*self.body);
+ self.recurse_build(self.body_id)?;
- if let Some(next) = self.build_terminator(block.terminator())? {
- block = &self.body.basic_blocks()[next];
- } else {
- break;
- }
- }
-
- assert_eq!(self.locals[mir::RETURN_PLACE], self.nodes.last().unwrap());
for n in self.nodes.iter() {
- if let Node::Leaf(ty::Const { val: ty::ConstKind::Unevaluated(ct), ty: _ }) = n.node {
+ if let Node::Leaf(ty::Const { val: ty::ConstKind::Unevaluated(ct), ty: _ }) = n {
// `AbstractConst`s should not contain any promoteds as they require references which
// are not allowed.
assert_eq!(ct.promoted, None);
}
}
- self.nodes[self.locals[mir::RETURN_PLACE]].used = true;
- if let Some(&unused) = self.nodes.iter().find(|n| !n.used) {
- self.error(Some(unused.span), "dead code")?;
- }
+ Ok(self.tcx.arena.alloc_from_iter(self.nodes.into_iter()))
+ }
- Ok(self.tcx.arena.alloc_from_iter(self.nodes.into_iter().map(|n| n.node)))
+ fn recurse_build(&mut self, node: thir::ExprId) -> Result<NodeId, ErrorReported> {
+ use thir::ExprKind;
+ let node = &self.body.exprs[node];
+ debug!("recurse_build: node={:?}", node);
+ Ok(match &node.kind {
+ // I dont know if handling of these 3 is correct
+ &ExprKind::Scope { value, .. } => self.recurse_build(value)?,
+ &ExprKind::PlaceTypeAscription { source, .. } |
+ &ExprKind::ValueTypeAscription { source, .. } => self.recurse_build(source)?,
+
+ // subtle: associated consts are literals this arm handles
+ // `<T as Trait>::ASSOC` as well as `12`
+ &ExprKind::Literal { literal, .. } => self.nodes.push(Node::Leaf(literal)),
+
+ ExprKind::Call { fun, args, .. } => {
+ let fun = self.recurse_build(*fun)?;
+
+ let mut new_args = Vec::<NodeId>::with_capacity(args.len());
+ for &id in args.iter() {
+ new_args.push(self.recurse_build(id)?);
+ }
+ let new_args = self.tcx.arena.alloc_slice(&new_args);
+ self.nodes.push(Node::FunctionCall(fun, new_args))
+ },
+ &ExprKind::Binary { op, lhs, rhs } if Self::check_binop(op) => {
+ let lhs = self.recurse_build(lhs)?;
+ let rhs = self.recurse_build(rhs)?;
+ self.nodes.push(Node::Binop(op, lhs, rhs))
+ }
+ &ExprKind::Unary { op, arg } if Self::check_unop(op) => {
+ let arg = self.recurse_build(arg)?;
+ self.nodes.push(Node::UnaryOp(op, arg))
+ },
+ // This is necessary so that the following compiles:
+ //
+ // ```
+ // fn foo<const N: usize>(a: [(); N + 1]) {
+ // bar::<{ N + 1 }>();
+ // }
+ // ```
+ ExprKind::Block { body: thir::Block { stmts: box [], expr: Some(e), .. }} => self.recurse_build(*e)?,
+ // `ExprKind::Use` happens when a `hir::ExprKind::Cast` is a
+ // "coercion cast" i.e. using a coercion or is a no-op.
+ // This is important so that `N as usize as usize` doesnt unify with `N as usize`. (untested)
+ &ExprKind::Use { source } => {
+ let arg = self.recurse_build(source)?;
+ self.nodes.push(Node::Cast(abstract_const::CastKind::Use, arg, node.ty))
+ },
+ &ExprKind::Cast { source } => {
+ let arg = self.recurse_build(source)?;
+ self.nodes.push(Node::Cast(abstract_const::CastKind::As, arg, node.ty))
+ },
+
+ // FIXME(generic_const_exprs): We may want to support these.
+ ExprKind::AddressOf { .. }
+ | ExprKind::Borrow { .. }
+ | ExprKind::Deref { .. }
+ | ExprKind::Repeat { .. }
+ | ExprKind::Array { .. }
+ | ExprKind::Block { .. }
+ | ExprKind::NeverToAny { .. }
+ | ExprKind::Tuple { .. }
+ | ExprKind::Index { .. }
+ | ExprKind::Field { .. }
+ | ExprKind::ConstBlock { .. }
+ | ExprKind::Adt(_) => self.error(
+ Some(node.span),
+ "unsupported operation in generic constant, this may be supported in the future",
+ )?,
+
+ ExprKind::Match { .. }
+ // we dont permit let stmts so `VarRef` and `UpvarRef` cant happen
+ | ExprKind::VarRef { .. }
+ | ExprKind::UpvarRef { .. }
+ | ExprKind::Closure { .. }
+ | ExprKind::Let { .. } // let expressions imply control flow
+ | ExprKind::Loop { .. }
+ | ExprKind::Assign { .. }
+ | ExprKind::StaticRef { .. }
+ | ExprKind::LogicalOp { .. }
+ // we handle valid unary/binary ops above
+ | ExprKind::Unary { .. }
+ | ExprKind::Binary { .. }
+ | ExprKind::Break { .. }
+ | ExprKind::Continue { .. }
+ | ExprKind::If { .. }
+ | ExprKind::Pointer { .. } // dont know if this is correct
+ | ExprKind::ThreadLocalRef(_)
+ | ExprKind::LlvmInlineAsm { .. }
+ | ExprKind::Return { .. }
+ | ExprKind::Box { .. } // allocations not allowed in constants
+ | ExprKind::AssignOp { .. }
+ | ExprKind::InlineAsm { .. }
+ | ExprKind::Yield { .. } => self.error(Some(node.span), "unsupported operation in generic constant")?,
+ })
}
}
/// Builds an abstract const, do not use this directly, but use `AbstractConst::new` instead.
-pub(super) fn mir_abstract_const<'tcx>(
+pub(super) fn thir_abstract_const<'tcx>(
tcx: TyCtxt<'tcx>,
def: ty::WithOptConstParam<LocalDefId>,
-) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
+) -> Result<Option<&'tcx [thir::abstract_const::Node<'tcx>]>, ErrorReported> {
if tcx.features().generic_const_exprs {
match tcx.def_kind(def.did) {
// FIXME(generic_const_exprs): We currently only do this for anonymous constants,
DefKind::AnonConst => (),
_ => return Ok(None),
}
- let body = tcx.mir_const(def).borrow();
- AbstractConstBuilder::new(tcx, &body)?.map(AbstractConstBuilder::build).transpose()
+
+ let body = tcx.thir_body(def);
+ if body.0.borrow().exprs.is_empty() {
+ // type error in constant, there is no thir
+ return Err(ErrorReported);
+ }
+
+ AbstractConstBuilder::new(tcx, (&*body.0.borrow(), body.1))?
+ .map(AbstractConstBuilder::build)
+ .transpose()
} else {
Ok(None)
}
&& iter::zip(a_args, b_args)
.all(|(&an, &bn)| try_unify(tcx, a.subtree(an), b.subtree(bn)))
}
- (Node::Cast(a_cast_kind, a_operand, a_ty), Node::Cast(b_cast_kind, b_operand, b_ty))
- if (a_ty == b_ty) && (a_cast_kind == b_cast_kind) =>
+ (Node::Cast(a_kind, a_operand, a_ty), Node::Cast(b_kind, b_operand, b_ty))
+ if (a_ty == b_ty) && (a_kind == b_kind) =>
{
try_unify(tcx, a.subtree(a_operand), b.subtree(b_operand))
}
- _ => false,
+ // use this over `_ => false` to make adding variants to `Node` less error prone
+ (Node::Cast(..), _)
+ | (Node::FunctionCall(..), _)
+ | (Node::UnaryOp(..), _)
+ | (Node::Binop(..), _)
+ | (Node::Leaf(..), _) => false,
}
}
use rustc_hir::GenericParam;
use rustc_hir::Item;
use rustc_hir::Node;
-use rustc_middle::mir::abstract_const::NotConstEvaluatable;
+use rustc_middle::thir::abstract_const::NotConstEvaluatable;
use rustc_middle::ty::error::ExpectedFound;
use rustc_middle::ty::fold::TypeFolder;
use rustc_middle::ty::{
if let ObligationCauseCode::WellFormed(Some(wf_loc)) =
root_obligation.cause.code.peel_derives()
{
- if let Some(cause) = self.tcx.diagnostic_hir_wf_check((
- tcx.erase_regions(obligation.predicate),
- wf_loc.clone(),
- )) {
+ if let Some(cause) = self
+ .tcx
+ .diagnostic_hir_wf_check((tcx.erase_regions(obligation.predicate), *wf_loc))
+ {
obligation.cause = cause;
span = obligation.cause.span;
}
use rustc_middle::ty::{TypeAndMut, TypeckResults};
use rustc_span::def_id::LOCAL_CRATE;
use rustc_span::symbol::{kw, sym, Ident, Symbol};
-use rustc_span::{BytePos, MultiSpan, Span, DUMMY_SP};
+use rustc_span::{BytePos, DesugaringKind, ExpnKind, ForLoopLoc, MultiSpan, Span, DUMMY_SP};
use rustc_target::spec::abi;
use std::fmt;
points_at_arg: bool,
has_custom_message: bool,
) -> bool {
- if !points_at_arg {
+ let span = obligation.cause.span;
+ let points_at_for_iter = matches!(
+ span.ctxt().outer_expn_data().kind,
+ ExpnKind::Desugaring(DesugaringKind::ForLoop(ForLoopLoc::IntoIter))
+ );
+
+ if !points_at_arg && !points_at_for_iter {
return false;
}
never_suggest_borrow.push(self.tcx.get_diagnostic_item(sym::send_trait).unwrap());
- let span = obligation.cause.span;
let param_env = obligation.param_env;
let trait_ref = trait_ref.skip_binder();
);
// This if is to prevent a special edge-case
- if !span.from_expansion() {
+ if matches!(
+ span.ctxt().outer_expn_data().kind,
+ ExpnKind::Root
+ | ExpnKind::Desugaring(DesugaringKind::ForLoop(ForLoopLoc::IntoIter))
+ ) {
// We don't want a borrowing suggestion on the fields in structs,
// ```
// struct Foo {
use rustc_errors::ErrorReported;
use rustc_hir as hir;
use rustc_infer::traits::{SelectionError, TraitEngine, TraitEngineExt as _, TraitObligation};
-use rustc_middle::mir::abstract_const::NotConstEvaluatable;
use rustc_middle::mir::interpret::ErrorHandled;
+use rustc_middle::thir::abstract_const::NotConstEvaluatable;
use rustc_middle::ty::error::{ExpectedFound, TypeError};
use rustc_middle::ty::subst::SubstsRef;
use rustc_middle::ty::ToPredicate;
vtable_entries,
vtable_trait_upcasting_coercion_new_vptr_slot,
subst_and_check_impossible_predicates,
- mir_abstract_const: |tcx, def_id| {
+ thir_abstract_const: |tcx, def_id| {
let def_id = def_id.expect_local();
if let Some(def) = ty::WithOptConstParam::try_lookup(def_id, tcx) {
- tcx.mir_abstract_const_of_const_arg(def)
+ tcx.thir_abstract_const_of_const_arg(def)
} else {
- const_evaluatable::mir_abstract_const(tcx, ty::WithOptConstParam::unknown(def_id))
+ const_evaluatable::thir_abstract_const(tcx, ty::WithOptConstParam::unknown(def_id))
}
},
- mir_abstract_const_of_const_arg: |tcx, (did, param_did)| {
- const_evaluatable::mir_abstract_const(
+ thir_abstract_const_of_const_arg: |tcx, (did, param_did)| {
+ const_evaluatable::thir_abstract_const(
tcx,
ty::WithOptConstParam { did, const_param_did: Some(param_did) },
)
let param_env = tcx.param_env(method.def_id);
- let abi_of_ty = |ty: Ty<'tcx>| -> Option<&Abi> {
+ let abi_of_ty = |ty: Ty<'tcx>| -> Option<Abi> {
match tcx.layout_of(param_env.and(ty)) {
- Ok(layout) => Some(&layout.abi),
+ Ok(layout) => Some(layout.abi),
Err(err) => {
// #78372
tcx.sess.delay_span_bug(
//
// This shouldn't really matter though as we can't really use any
// constants which are not considered const evaluatable.
- use rustc_middle::mir::abstract_const::Node;
+ use rustc_middle::thir::abstract_const::Node;
if let Ok(Some(ct)) = AbstractConst::new(self.tcx, uv.shrink()) {
const_evaluatable::walk_abstract_const(self.tcx, ct, |node| match node.root() {
Node::Leaf(leaf) => {
ty::ReLateBound(debruijn, br) if debruijn >= self.current_index => {
let universe = self.universe_for(debruijn);
let p = ty::PlaceholderRegion { universe, name: br.kind };
- self.mapped_regions.insert(p.clone(), br);
+ self.mapped_regions.insert(p, br);
self.infcx.tcx.mk_region(ty::RePlaceholder(p))
}
_ => r,
ty::Bound(debruijn, bound_ty) if debruijn >= self.current_index => {
let universe = self.universe_for(debruijn);
let p = ty::PlaceholderType { universe, name: bound_ty.var };
- self.mapped_types.insert(p.clone(), bound_ty);
+ self.mapped_types.insert(p, bound_ty);
self.infcx.tcx.mk_ty(ty::Placeholder(p))
}
_ if t.has_vars_bound_at_or_above(self.current_index) => t.super_fold_with(self),
universe,
name: ty::BoundConst { var: bound_const, ty },
};
- self.mapped_consts.insert(p.clone(), bound_const);
+ self.mapped_consts.insert(p, bound_const);
self.infcx.tcx.mk_const(ty::Const { val: ty::ConstKind::Placeholder(p), ty })
}
_ if ct.has_vars_bound_at_or_above(self.current_index) => ct.super_fold_with(self),
use rustc_hir::def_id::DefId;
use rustc_infer::infer::LateBoundRegionConversionTime;
use rustc_middle::dep_graph::{DepKind, DepNodeIndex};
-use rustc_middle::mir::abstract_const::NotConstEvaluatable;
use rustc_middle::mir::interpret::ErrorHandled;
+use rustc_middle::thir::abstract_const::NotConstEvaluatable;
use rustc_middle::ty::fast_reject;
use rustc_middle::ty::print::with_no_trimmed_paths;
use rustc_middle::ty::relate::TypeRelation;
) => false,
(ParamCandidate(other), ParamCandidate(victim)) => {
- let value_same_except_bound_vars = other.value.skip_binder()
+ let same_except_bound_vars = other.value.skip_binder()
== victim.value.skip_binder()
+ && other.constness == victim.constness
&& !other.value.skip_binder().has_escaping_bound_vars();
- if value_same_except_bound_vars {
+ if same_except_bound_vars {
// See issue #84398. In short, we can generate multiple ParamCandidates which are
// the same except for unused bound vars. Just pick the one with the fewest bound vars
// or the current one if tied (they should both evaluate to the same answer). This is
"get_provisional = {:#?}",
self.map.borrow().get(&fresh_trait_ref),
);
- Some(self.map.borrow().get(&fresh_trait_ref)?.clone())
+ Some(*self.map.borrow().get(&fresh_trait_ref)?)
}
/// Insert a provisional result into the cache. The result came
constraint=constraint,
));
} else {
- err.span_suggestion(
- span,
+ err.span_suggestion_verbose(
+ span.with_hi(assoc_name.span.lo()),
"use fully qualified syntax to disambiguate",
format!(
- "<{} as {}>::{}",
+ "<{} as {}>::",
ty_param_name(),
bound.print_only_trait_path(),
- assoc_name,
),
Applicability::MaybeIncorrect,
);
// Finally, resolve all regions. This catches wily misuses of
// lifetime parameters.
let fcx = FnCtxt::new(&inh, param_env, hir_id);
- fcx.regionck_item(hir_id, span, &[]);
+ fcx.regionck_item(hir_id, span, FxHashSet::default());
});
}
exprs.len()
);
+ // The following check fixes #88097, where the compiler erroneously
+ // attempted to coerce a closure type to itself via a function pointer.
+ if prev_ty == new_ty {
+ return Ok(prev_ty);
+ }
+
// Special-case that coercion alone cannot handle:
// Function items or non-capturing closures of differing IDs or InternalSubsts.
let (a_sig, b_sig) = {
use crate::errors::LifetimesOrBoundsMismatchOnTrait;
+use rustc_data_structures::stable_set::FxHashSet;
use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticId, ErrorReported};
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res};
// Compute placeholder form of impl and trait method tys.
let tcx = infcx.tcx;
- let mut wf_tys = vec![];
+ let mut wf_tys = FxHashSet::default();
let (impl_sig, _) = infcx.replace_bound_vars_with_fresh_vars(
impl_m_span,
// Finally, resolve all regions. This catches wily misuses of
// lifetime parameters.
let fcx = FnCtxt::new(&inh, param_env, impl_m_hir_id);
- fcx.regionck_item(impl_m_hir_id, impl_m_span, &wf_tys);
+ fcx.regionck_item(impl_m_hir_id, impl_m_span, wf_tys);
Ok(())
})
}
let fcx = FnCtxt::new(&inh, param_env, impl_c_hir_id);
- fcx.regionck_item(impl_c_hir_id, impl_c_span, &[]);
+ fcx.regionck_item(impl_c_hir_id, impl_c_span, FxHashSet::default());
});
}
// Finally, resolve all regions. This catches wily misuses of
// lifetime parameters.
let fcx = FnCtxt::new(&inh, param_env, impl_ty_hir_id);
- fcx.regionck_item(impl_ty_hir_id, impl_ty_span, &[]);
+ fcx.regionck_item(impl_ty_hir_id, impl_ty_span, FxHashSet::default());
Ok(())
})
// lifetime parameters.
let fcx = FnCtxt::new(&inh, param_env, impl_ty_hir_id);
let implied_bounds = match impl_ty.container {
- ty::TraitContainer(_) => vec![],
+ ty::TraitContainer(_) => FxHashSet::default(),
ty::ImplContainer(def_id) => fcx.impl_implied_bounds(def_id, impl_ty_span),
};
- fcx.regionck_item(impl_ty_hir_id, impl_ty_span, &implied_bounds);
+ fcx.regionck_item(impl_ty_hir_id, impl_ty_span, implied_bounds);
Ok(())
})
use super::method::probe;
-use std::fmt;
use std::iter;
impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// E.g. for `&format!("")`, where we want the span to the
// `format!()` invocation instead of its expansion.
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() {
return Some((
// For now, don't suggest casting with `as`.
let can_cast = false;
- let prefix = if let Some(hir::Node::Expr(hir::Expr {
- kind: hir::ExprKind::Struct(_, fields, _),
- ..
+ let mut sugg = vec![];
+
+ if let Some(hir::Node::Expr(hir::Expr {
+ kind: hir::ExprKind::Struct(_, fields, _), ..
})) = self.tcx.hir().find(self.tcx.hir().get_parent_node(expr.hir_id))
{
// `expr` is a literal field for a struct, only suggest if appropriate
.find(|field| field.expr.hir_id == expr.hir_id && field.is_shorthand)
{
// This is a field literal
- Some(field) => format!("{}: ", field.ident),
+ Some(field) => {
+ sugg.push((field.ident.span.shrink_to_lo(), format!("{}: ", field.ident)));
+ }
// Likely a field was meant, but this field wasn't found. Do not suggest anything.
None => return false,
}
- } else {
- String::new()
};
if let hir::ExprKind::Call(path, args) = &expr.kind {
checked_ty, expected_ty,
);
- let with_opt_paren: fn(&dyn fmt::Display) -> String =
- if expr.precedence().order() < PREC_POSTFIX {
- |s| format!("({})", s)
- } else {
- |s| s.to_string()
- };
+ let close_paren = if expr.precedence().order() < PREC_POSTFIX {
+ sugg.push((expr.span.shrink_to_lo(), "(".to_string()));
+ ")"
+ } else {
+ ""
+ };
- let cast_suggestion = format!("{}{} as {}", prefix, with_opt_paren(&src), expected_ty);
- let into_suggestion = format!("{}{}.into()", prefix, with_opt_paren(&src));
- let suffix_suggestion = with_opt_paren(&format_args!(
- "{}{}",
+ let mut cast_suggestion = sugg.clone();
+ cast_suggestion
+ .push((expr.span.shrink_to_hi(), format!("{} as {}", close_paren, expected_ty)));
+ let mut into_suggestion = sugg.clone();
+ into_suggestion.push((expr.span.shrink_to_hi(), format!("{}.into()", close_paren)));
+ let mut suffix_suggestion = sugg.clone();
+ suffix_suggestion.push((
if matches!(
(&expected_ty.kind(), &checked_ty.kind()),
(ty::Int(_) | ty::Uint(_), ty::Float(_))
) {
// Remove fractional part from literal, for example `42.0f32` into `42`
let src = src.trim_end_matches(&checked_ty.to_string());
- src.split('.').next().unwrap()
+ let len = src.split('.').next().unwrap().len();
+ expr.span.with_lo(expr.span.lo() + BytePos(len as u32))
} else {
- src.trim_end_matches(&checked_ty.to_string())
+ let len = src.trim_end_matches(&checked_ty.to_string()).len();
+ expr.span.with_lo(expr.span.lo() + BytePos(len as u32))
+ },
+ if expr.precedence().order() < PREC_POSTFIX {
+ // Readd `)`
+ format!("{})", expected_ty)
+ } else {
+ expected_ty.to_string()
},
- expected_ty,
));
let literal_is_ty_suffixed = |expr: &hir::Expr<'_>| {
if let hir::ExprKind::Lit(lit) = &expr.kind { lit.node.is_suffixed() } else { false }
.ok()
.map(|src| (expr, src))
});
- let (span, msg, suggestion) = if let (Some((lhs_expr, lhs_src)), false) =
+ let (msg, suggestion) = if let (Some((lhs_expr, lhs_src)), false) =
(lhs_expr_and_src, exp_to_found_is_fallible)
{
let msg = format!(
"you can convert `{}` from `{}` to `{}`, matching the type of `{}`",
lhs_src, expected_ty, checked_ty, src
);
- let suggestion = format!("{}::from({})", checked_ty, lhs_src);
- (lhs_expr.span, msg, suggestion)
+ let suggestion = vec![
+ (lhs_expr.span.shrink_to_lo(), format!("{}::from(", checked_ty)),
+ (lhs_expr.span.shrink_to_hi(), ")".to_string()),
+ ];
+ (msg, suggestion)
} else {
let msg = format!("{} and panic if the converted value doesn't fit", msg);
- let suggestion =
- format!("{}{}.try_into().unwrap()", prefix, with_opt_paren(&src));
- (expr.span, msg, suggestion)
+ let mut suggestion = sugg.clone();
+ suggestion.push((
+ expr.span.shrink_to_hi(),
+ format!("{}.try_into().unwrap()", close_paren),
+ ));
+ (msg, suggestion)
};
- err.span_suggestion(span, &msg, suggestion, Applicability::MachineApplicable);
+ err.multipart_suggestion_verbose(
+ &msg,
+ suggestion,
+ Applicability::MachineApplicable,
+ );
};
let suggest_to_change_suffix_or_into =
} else {
into_suggestion.clone()
};
- err.span_suggestion(expr.span, msg, suggestion, Applicability::MachineApplicable);
+ err.multipart_suggestion_verbose(msg, suggestion, Applicability::MachineApplicable);
};
match (&expected_ty.kind(), &checked_ty.kind()) {
if found.bit_width() < exp.bit_width() {
suggest_to_change_suffix_or_into(err, false, true);
} else if literal_is_ty_suffixed(expr) {
- err.span_suggestion(
- expr.span,
+ err.multipart_suggestion_verbose(
&lit_msg,
suffix_suggestion,
Applicability::MachineApplicable,
);
} else if can_cast {
// Missing try_into implementation for `f64` to `f32`
- err.span_suggestion(
- expr.span,
+ err.multipart_suggestion_verbose(
&format!("{}, producing the closest possible value", cast_msg),
cast_suggestion,
Applicability::MaybeIncorrect, // lossy conversion
}
(&ty::Uint(_) | &ty::Int(_), &ty::Float(_)) => {
if literal_is_ty_suffixed(expr) {
- err.span_suggestion(
- expr.span,
+ err.multipart_suggestion_verbose(
&lit_msg,
suffix_suggestion,
Applicability::MachineApplicable,
);
} else if can_cast {
// Missing try_into implementation for `{float}` to `{integer}`
- err.span_suggestion(
- expr.span,
+ err.multipart_suggestion_verbose(
&format!("{}, rounding the float towards zero", msg),
cast_suggestion,
Applicability::MaybeIncorrect, // lossy conversion
(&ty::Float(ref exp), &ty::Uint(ref found)) => {
// if `found` is `None` (meaning found is `usize`), don't suggest `.into()`
if exp.bit_width() > found.bit_width().unwrap_or(256) {
- err.span_suggestion(
- expr.span,
+ err.multipart_suggestion_verbose(
&format!(
"{}, producing the floating point representation of the integer",
msg,
Applicability::MachineApplicable,
);
} else if literal_is_ty_suffixed(expr) {
- err.span_suggestion(
- expr.span,
+ err.multipart_suggestion_verbose(
&lit_msg,
suffix_suggestion,
Applicability::MachineApplicable,
);
} else {
// Missing try_into implementation for `{integer}` to `{float}`
- err.span_suggestion(
- expr.span,
+ err.multipart_suggestion_verbose(
&format!(
"{}, producing the floating point representation of the integer,
rounded if necessary",
(&ty::Float(ref exp), &ty::Int(ref found)) => {
// if `found` is `None` (meaning found is `isize`), don't suggest `.into()`
if exp.bit_width() > found.bit_width().unwrap_or(256) {
- err.span_suggestion(
- expr.span,
+ err.multipart_suggestion_verbose(
&format!(
"{}, producing the floating point representation of the integer",
&msg,
Applicability::MachineApplicable,
);
} else if literal_is_ty_suffixed(expr) {
- err.span_suggestion(
- expr.span,
+ err.multipart_suggestion_verbose(
&lit_msg,
suffix_suggestion,
Applicability::MachineApplicable,
);
} else {
// Missing try_into implementation for `{integer}` to `{float}`
- err.span_suggestion(
- expr.span,
+ err.multipart_suggestion_verbose(
&format!(
"{}, producing the floating point representation of the integer, \
rounded if necessary",
impl<'tcx> AutorefOrPtrAdjustment<'tcx> {
fn get_unsize(&self) -> Option<Ty<'tcx>> {
match self {
- AutorefOrPtrAdjustment::Autoref { mutbl: _, unsize } => unsize.clone(),
+ AutorefOrPtrAdjustment::Autoref { mutbl: _, unsize } => *unsize,
AutorefOrPtrAdjustment::ToConstPtr => None,
}
}
tcx: TyCtxt<'_>,
traits: &mut Vec<DefId>,
external_mods: &mut FxHashSet<DefId>,
- res: Res,
+ res: Res<!>,
) {
match res {
Res::Def(DefKind::Trait | DefKind::TraitAlias, def_id) => {
// from normalization. We could just discard these, but to align with
// compare_method and elsewhere, we just add implied bounds for
// these types.
- let mut wf_tys = vec![];
+ let mut wf_tys = FxHashSet::default();
// Compute the fty from point of view of inside the fn.
let fn_sig = tcx.liberate_late_bound_regions(def_id.to_def_id(), fn_sig);
wf_tys.extend(fn_sig.inputs_and_output.iter());
fcx.write_ty(id, expected_type);
- (fcx, vec![])
+ (fcx, FxHashSet::default())
};
let fallback_has_occurred = fcx.type_inference_fallback();
fcx.select_all_obligations_or_error();
if fn_sig.is_some() {
- fcx.regionck_fn(id, body, span, &wf_tys);
+ fcx.regionck_fn(id, body, span, wf_tys);
} else {
fcx.regionck_expr(body);
}
ex.span,
format!("cannot apply unary operator `{}`", op.as_str()),
);
- match actual.kind() {
- Uint(_) if op == hir::UnOp::Neg => {
- err.note("unsigned values cannot be negated");
-
- if let hir::ExprKind::Unary(
- _,
- hir::Expr {
- kind:
- hir::ExprKind::Lit(Spanned {
- node: ast::LitKind::Int(1, _),
- ..
- }),
- ..
- },
- ) = ex.kind
- {
- err.span_suggestion(
- ex.span,
- &format!(
- "you may have meant the maximum value of `{}`",
- actual
- ),
- format!("{}::MAX", actual),
- Applicability::MaybeIncorrect,
- );
+
+ let sp = self.tcx.sess.source_map().start_point(ex.span);
+ if let Some(sp) =
+ self.tcx.sess.parse_sess.ambiguous_block_expr_parse.borrow().get(&sp)
+ {
+ // If the previous expression was a block expression, suggest parentheses
+ // (turning this into a binary subtraction operation instead.)
+ // for example, `{2} - 2` -> `({2}) - 2` (see src\test\ui\parser\expr-as-stmt.rs)
+ self.tcx.sess.parse_sess.expr_parentheses_needed(&mut err, *sp);
+ } else {
+ match actual.kind() {
+ Uint(_) if op == hir::UnOp::Neg => {
+ err.note("unsigned values cannot be negated");
+
+ if let hir::ExprKind::Unary(
+ _,
+ hir::Expr {
+ kind:
+ hir::ExprKind::Lit(Spanned {
+ node: ast::LitKind::Int(1, _),
+ ..
+ }),
+ ..
+ },
+ ) = ex.kind
+ {
+ err.span_suggestion(
+ ex.span,
+ &format!(
+ "you may have meant the maximum value of `{}`",
+ actual
+ ),
+ format!("{}::MAX", actual),
+ Applicability::MaybeIncorrect,
+ );
+ }
+ }
+ Str | Never | Char | Tuple(_) | Array(_, _) => {}
+ Ref(_, ref lty, _) if *lty.kind() == Str => {}
+ _ => {
+ let missing_trait = match op {
+ hir::UnOp::Neg => "std::ops::Neg",
+ hir::UnOp::Not => "std::ops::Not",
+ hir::UnOp::Deref => "std::ops::UnDerf",
+ };
+ suggest_impl_missing(&mut err, operand_ty, &missing_trait);
}
- }
- Str | Never | Char | Tuple(_) | Array(_, _) => {}
- Ref(_, ref lty, _) if *lty.kind() == Str => {}
- _ => {
- let missing_trait = match op {
- hir::UnOp::Neg => "std::ops::Neg",
- hir::UnOp::Not => "std::ops::Not",
- hir::UnOp::Deref => "std::ops::UnDerf",
- };
- suggest_impl_missing(&mut err, operand_ty, &missing_trait);
}
}
err.emit();
use crate::check::FnCtxt;
use crate::mem_categorization as mc;
use crate::middle::region;
+use rustc_data_structures::stable_set::FxHashSet;
use rustc_hir as hir;
use rustc_hir::def_id::LocalDefId;
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
/// Region checking during the WF phase for items. `wf_tys` are the
/// types from which we should derive implied bounds, if any.
- pub fn regionck_item(&self, item_id: hir::HirId, span: Span, wf_tys: &[Ty<'tcx>]) {
+ pub fn regionck_item(&self, item_id: hir::HirId, span: Span, wf_tys: FxHashSet<Ty<'tcx>>) {
debug!("regionck_item(item.id={:?}, wf_tys={:?})", item_id, wf_tys);
let subject = self.tcx.hir().local_def_id(item_id);
let mut rcx = RegionCtxt::new(self, item_id, Subject(subject), self.param_env);
fn_id: hir::HirId,
body: &'tcx hir::Body<'tcx>,
span: Span,
- wf_tys: &[Ty<'tcx>],
+ wf_tys: FxHashSet<Ty<'tcx>>,
) {
debug!("regionck_fn(id={})", fn_id);
let subject = self.tcx.hir().body_owner_def_id(body.id());
// because it will have no effect.
//
// FIXME(#27579) return types should not be implied bounds
- let fn_sig_tys: Vec<_> =
+ let fn_sig_tys: FxHashSet<_> =
fn_sig.inputs().iter().cloned().chain(Some(fn_sig.output())).collect();
- self.outlives_environment.add_implied_bounds(
- self.fcx,
- &fn_sig_tys[..],
- body_id.hir_id,
- span,
- );
+ self.outlives_environment.add_implied_bounds(self.fcx, fn_sig_tys, body_id.hir_id, span);
self.outlives_environment.save_implied_bounds(body_id.hir_id);
self.link_fn_params(&body.params);
self.visit_body(body);
impl<'tcx> CheckWfFcxBuilder<'tcx> {
fn with_fcx<F>(&mut self, f: F)
where
- F: for<'b> FnOnce(&FnCtxt<'b, 'tcx>) -> Vec<Ty<'tcx>>,
+ F: for<'b> FnOnce(&FnCtxt<'b, 'tcx>) -> FxHashSet<Ty<'tcx>>,
{
let id = self.id;
let span = self.span;
}
let wf_tys = f(&fcx);
fcx.select_all_obligations_or_error();
- fcx.regionck_item(id, span, &wf_tys);
+ fcx.regionck_item(id, span, wf_tys);
});
}
}
let item = fcx.tcx.associated_item(fcx.tcx.hir().local_def_id(item_id));
let (mut implied_bounds, self_ty) = match item.container {
- ty::TraitContainer(_) => (vec![], fcx.tcx.types.self_param),
+ ty::TraitContainer(_) => (FxHashSet::default(), fcx.tcx.types.self_param),
ty::ImplContainer(def_id) => {
(fcx.impl_implied_bounds(def_id, span), fcx.tcx.type_of(def_id))
}
check_where_clauses(fcx, item.span, item.def_id.to_def_id(), None);
// No implied bounds in a struct definition.
- vec![]
+ FxHashSet::default()
});
}
for_item(tcx, item).with_fcx(|fcx| {
check_where_clauses(fcx, item.span, item.def_id.to_def_id(), None);
- vec![]
+ FxHashSet::default()
});
}
for_id(tcx, item_id, span).with_fcx(|fcx| {
let def_id = tcx.hir().local_def_id(item_id);
let sig = tcx.fn_sig(def_id);
- let mut implied_bounds = vec![];
+ let mut implied_bounds = FxHashSet::default();
check_fn_or_method(fcx, ident.span, sig, decl, def_id.to_def_id(), &mut implied_bounds);
implied_bounds
})
}
// No implied bounds in a const, etc.
- vec![]
+ FxHashSet::default()
});
}
sig: ty::PolyFnSig<'tcx>,
hir_decl: &hir::FnDecl<'_>,
def_id: DefId,
- implied_bounds: &mut Vec<Ty<'tcx>>,
+ implied_bounds: &mut FxHashSet<Ty<'tcx>>,
) {
let sig = fcx.tcx.liberate_late_bound_regions(def_id, sig);
// Unnormalized types in signature are WF too
implied_bounds.extend(sig.inputs());
// FIXME(#27579) return types should not be implied bounds
- implied_bounds.push(sig.output());
+ implied_bounds.insert(sig.output());
// Normalize the input and output types one at a time, using a different
// `WellFormedLoc` for each. We cannot call `normalize_associated_types`
);
// FIXME(#27579) return types should not be implied bounds
- implied_bounds.push(sig.output());
+ implied_bounds.insert(sig.output());
debug!(?implied_bounds);
.collect()
}
- pub(super) fn impl_implied_bounds(&self, impl_def_id: DefId, span: Span) -> Vec<Ty<'tcx>> {
+ pub(super) fn impl_implied_bounds(
+ &self,
+ impl_def_id: DefId,
+ span: Span,
+ ) -> FxHashSet<Ty<'tcx>> {
match self.tcx.impl_trait_ref(impl_def_id) {
Some(trait_ref) => {
// Trait impl: take implied bounds from all types that
// Inherent impl: take implied bounds from the `self` type.
let self_ty = self.tcx.type_of(impl_def_id);
let self_ty = self.normalize_associated_types_in(span, self_ty);
- vec![self_ty]
+ std::array::IntoIter::new([self_ty]).collect()
}
}
}
use rustc_session::parse::feature_err;
use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::{Span, DUMMY_SP};
-use rustc_target::spec::{abi, SanitizerSet};
+use rustc_target::spec::{abi, PanicStrategy, SanitizerSet};
use rustc_trait_selection::traits::error_reporting::suggestions::NextTypeParamName;
use std::iter;
let suggestions = vec![
(lt_sp, sugg),
(
- span,
+ span.with_hi(item_segment.ident.span.lo()),
format!(
- "{}::{}",
+ "{}::",
// Replace the existing lifetimes with a new named lifetime.
self.tcx
.replace_late_bound_regions(poly_trait_ref, |_| {
))
})
.0,
- item_segment.ident
),
),
];
| hir::Node::ForeignItem(_)
| hir::Node::TraitItem(_)
| hir::Node::ImplItem(_) => {
- err.span_suggestion(
- span,
+ err.span_suggestion_verbose(
+ span.with_hi(item_segment.ident.span.lo()),
"use a fully qualified path with inferred lifetimes",
format!(
- "{}::{}",
+ "{}::",
// Erase named lt, we want `<A as B<'_>::C`, not `<A as B<'a>::C`.
self.tcx.anonymize_late_bound_regions(poly_trait_ref).skip_binder(),
- item_segment.ident
),
Applicability::MaybeIncorrect,
);
codegen_fn_attrs.flags |= CodegenFnAttrFlags::TRACK_CALLER;
}
+ // With -Z panic-in-drop=abort, drop_in_place never unwinds.
+ if tcx.sess.opts.debugging_opts.panic_in_drop == PanicStrategy::Abort {
+ if Some(id) == tcx.lang_items().drop_in_place_fn() {
+ codegen_fn_attrs.flags |= CodegenFnAttrFlags::NEVER_UNWIND;
+ }
+ }
+
let supported_target_features = tcx.supported_target_features(LOCAL_CRATE);
let mut inline_span = None;
*/
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
-#![cfg_attr(bootstrap, feature(bindings_after_at))]
#![feature(bool_to_option)]
#![feature(crate_visibility_modifier)]
#![feature(format_args_capture)]
#![feature(never_type)]
#![feature(slice_partition_dedup)]
#![feature(control_flow_enum)]
-#![cfg_attr(bootstrap, allow(incomplete_features))] // if_let_guard
#![recursion_limit = "256"]
#[macro_use]
#![feature(allow_internal_unstable)]
#![feature(arbitrary_self_types)]
#![feature(async_stream)]
-#![cfg_attr(bootstrap, feature(bindings_after_at))]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(cfg_sanitize)]
#![feature(alloc_layout_extra)]
#![feature(trusted_random_access)]
#![feature(try_trait_v2)]
-#![cfg_attr(bootstrap, feature(min_type_alias_impl_trait))]
-#![cfg_attr(not(bootstrap), feature(type_alias_impl_trait))]
#![feature(associated_type_bounds)]
#![feature(slice_group_by)]
#![feature(decl_macro)]
--- /dev/null
+../std/boxed/struct.Box.html#method.into_raw
--- /dev/null
+../std/fs/struct.File.html
--- /dev/null
+../std/io/trait.BufRead.html
--- /dev/null
+../std/io/trait.Read.html
--- /dev/null
+../std/io/trait.Seek.html
--- /dev/null
+../std/io/trait.Write.html
--- /dev/null
+../std/net/trait.ToSocketAddrs.html
--- /dev/null
+../std/process/fn.exit.html
--- /dev/null
+../std/string/struct.String.html
#[lang = "bool"]
impl bool {
- /// Returns `Some(t)` if the `bool` is [`true`](keyword.true.html), or `None` otherwise.
+ /// Returns `Some(t)` if the `bool` is [`true`](../std/keyword.true.html),
+ /// or `None` otherwise.
///
/// # Examples
///
if self { Some(t) } else { None }
}
- /// Returns `Some(f())` if the `bool` is [`true`](keyword.true.html), or `None` otherwise.
+ /// Returns `Some(f())` if the `bool` is [`true`](../std/keyword.true.html),
+ /// or `None` otherwise.
///
/// # Examples
///
/// ```
#[inline(always)]
#[stable(feature = "unsafe_cell_get_mut", since = "1.50.0")]
- pub fn get_mut(&mut self) -> &mut T {
+ #[rustc_const_unstable(feature = "const_unsafecell_get_mut", issue = "88836")]
+ pub const fn get_mut(&mut self) -> &mut T {
&mut self.value
}
/// decoding error.
///
/// It can occur, for example, when giving ill-formed UTF-8 bytes to
- /// [`String::from_utf8_lossy`](string/struct.String.html#method.from_utf8_lossy).
+ /// [`String::from_utf8_lossy`](../std/string/struct.String.html#method.from_utf8_lossy).
#[stable(feature = "assoc_char_consts", since = "1.52.0")]
pub const REPLACEMENT_CHARACTER: char = '\u{FFFD}';
/// Converts a `u32` to a `char`.
///
/// Note that all `char`s are valid [`u32`]s, and can be cast to one with
- /// [`as`](keyword.as.html):
+ /// [`as`](../std/keyword.as.html):
///
/// ```
/// let c = '💯';
/// println!("\\u{{2764}}");
/// ```
///
- /// Using [`to_string`](string/trait.ToString.html#tymethod.to_string):
+ /// Using [`to_string`](../std/string/trait.ToString.html#tymethod.to_string):
///
/// ```
/// assert_eq!('❤'.escape_unicode().to_string(), "\\u{2764}");
/// println!("\\n");
/// ```
///
- /// Using [`to_string`](string/trait.ToString.html#tymethod.to_string):
+ /// Using [`to_string`](../std/string/trait.ToString.html#tymethod.to_string):
///
/// ```
/// assert_eq!('\n'.escape_debug().to_string(), "\\n");
/// println!("\\\"");
/// ```
///
- /// Using [`to_string`](string/trait.ToString.html#tymethod.to_string):
+ /// Using [`to_string`](../std/string/trait.ToString.html#tymethod.to_string):
///
/// ```
/// assert_eq!('"'.escape_default().to_string(), "\\\"");
/// println!("i\u{307}");
/// ```
///
- /// Using [`to_string`](string/trait.ToString.html#tymethod.to_string):
+ /// Using [`to_string`](../std/string/trait.ToString.html#tymethod.to_string):
///
/// ```
/// assert_eq!('C'.to_lowercase().to_string(), "c");
/// println!("SS");
/// ```
///
- /// Using [`to_string`](string/trait.ToString.html#tymethod.to_string):
+ /// Using [`to_string`](../std/string/trait.ToString.html#tymethod.to_string):
///
/// ```
/// assert_eq!('c'.to_uppercase().to_string(), "C");
#[stable(feature = "rust1", since = "1.0.0")]
#[lang = "clone"]
#[rustc_diagnostic_item = "Clone"]
+#[cfg_attr(not(bootstrap), rustc_trivial_field_reads)]
pub trait Clone: Sized {
/// Returns a copy of the value.
///
impl<'a> Arguments<'a> {
/// When using the format_args!() macro, this function is used to generate the
/// Arguments structure.
- #[cfg(not(bootstrap))]
#[doc(hidden)]
#[inline]
#[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
}
Arguments { pieces, fmt: None, args }
}
- #[cfg(bootstrap)]
- #[doc(hidden)]
- #[inline]
- #[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
- #[rustc_const_unstable(feature = "const_fmt_arguments_new", issue = "none")]
- pub const fn new_v1(pieces: &'a [&'static str], args: &'a [ArgumentV1<'a>]) -> Arguments<'a> {
- if pieces.len() < args.len() || pieces.len() > args.len() + 1 {
- panic!("invalid args");
- }
- Arguments { pieces, fmt: None, args }
- }
/// This function is used to specify nonstandard formatting parameters.
/// The `pieces` array must be at least as long as `fmt` to construct
/// `CountIsParam` or `CountIsNextParam` has to point to an argument
/// created with `argumentusize`. However, failing to do so doesn't cause
/// unsafety, but will ignore invalid .
- #[cfg(not(bootstrap))]
#[doc(hidden)]
#[inline]
#[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
) -> Arguments<'a> {
Arguments { pieces, fmt: Some(fmt), args }
}
- #[cfg(bootstrap)]
- #[doc(hidden)]
- #[inline]
- #[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "none")]
- #[rustc_const_unstable(feature = "const_fmt_arguments_new", issue = "none")]
- pub const fn new_v1_formatted(
- pieces: &'a [&'static str],
- args: &'a [ArgumentV1<'a>],
- fmt: &'a [rt::v1::Argument],
- ) -> Arguments<'a> {
- Arguments { pieces, fmt: Some(fmt), args }
- }
/// Estimates the length of the formatted text.
///
)]
#[doc(alias = "{:?}")]
#[rustc_diagnostic_item = "debug_trait"]
+#[cfg_attr(not(bootstrap), rustc_trivial_field_reads)]
pub trait Debug {
/// Formats the value using the given formatter.
///
/// [`std::convert::identity`]: crate::convert::identity
#[inline]
#[unstable(feature = "bench_black_box", issue = "64102")]
-#[cfg_attr(not(bootstrap), allow(unused_mut))]
-#[cfg_attr(bootstrap, allow(deprecated))]
-pub fn black_box<T>(mut dummy: T) -> T {
- #[cfg(bootstrap)]
- // SAFETY: the inline assembly is a no-op.
- unsafe {
- llvm_asm!("" : : "r"(&mut dummy) : "memory" : "volatile");
- dummy
- }
-
- #[cfg(not(bootstrap))]
- {
- crate::intrinsics::black_box(dummy)
- }
+pub fn black_box<T>(dummy: T) -> T {
+ crate::intrinsics::black_box(dummy)
}
/// See documentation of [`std::hint::black_box`] for details.
///
/// [`std::hint::black_box`]: crate::hint::black_box
- #[cfg(not(bootstrap))]
pub fn black_box<T>(dummy: T) -> T;
}
#![warn(missing_debug_implementations)]
#![warn(missing_docs)]
#![allow(explicit_outlives_requirements)]
-#![cfg_attr(bootstrap, allow(incomplete_features))] // if_let_guard
//
// Library features for const fns:
#![feature(const_align_of_val)]
#![feature(const_fn_floating_point_arithmetic)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(const_fn_trait_bound)]
-#![cfg_attr(bootstrap, feature(const_fn_transmute))]
-#![cfg_attr(bootstrap, feature(const_fn_union))]
#![feature(const_impl_trait)]
#![feature(const_mut_refs)]
#![feature(const_panic)]
#![feature(decl_macro)]
#![feature(doc_cfg)]
#![feature(doc_notable_trait)]
+#![feature(doc_primitive)]
#![feature(exhaustive_patterns)]
#![feature(extern_types)]
#![feature(fundamental)]
/* compiler built-in */
}
}
+
+include!("primitive_docs.rs");
/// This macro is used by the panic macros for the `const_panic` feature.
///
/// This macro will be removed once `format_args` is allowed in const contexts.
- #[cfg(not(bootstrap))]
#[unstable(feature = "const_format_args", issue = "none")]
#[allow_internal_unstable(fmt_internals, const_fmt_arguments_new)]
#[rustc_builtin_macro]
($fmt:expr, $($args:tt)*) => {{ /* compiler built-in */ }};
}
- /// Same as `format_args`, but can be used in some const contexts.
- #[cfg(bootstrap)]
- #[unstable(feature = "const_format_args", issue = "none")]
- #[macro_export]
- macro_rules! const_format_args {
- ($($t:tt)*) => {
- $crate::format_args!($($t)*)
- }
- }
-
/// Same as `format_args`, but adds a newline in the end.
#[unstable(
feature = "format_args_nl",
/// `Unsize<dyn fmt::Debug>`.
///
/// All implementations of `Unsize` are provided automatically by the compiler.
-///
-/// `Unsize` is implemented for:
-///
-/// - `[T; N]` is `Unsize<[T]>`
-/// - `T` is `Unsize<dyn Trait>` when `T: Trait`
-/// - `Foo<..., T, ...>` is `Unsize<Foo<..., U, ...>>` if:
-/// - `T: Unsize<U>`
-/// - Foo is a struct
-/// - Only the last field of `Foo` has a type involving `T`
-/// - `T` is not part of the type of any other fields
-/// - `Bar<T>: Unsize<Bar<U>>`, if the last field of `Foo` has type `Bar<T>`
+/// Those implementations are:
+///
+/// - Arrays `[T; N]` implement `Unsize<[T]>`.
+/// - Types implementing a trait `Trait` also implement `Unsize<dyn Trait>`.
+/// - Structs `Foo<..., T, ...>` implement `Unsize<Foo<..., U, ...>>` if all of these conditions
+/// are met:
+/// - `T: Unsize<U>`.
+/// - Only the last field of `Foo` has a type involving `T`.
+/// - `Bar<T>: Unsize<Bar<U>>`, where `Bar<T>` stands for the actual type of that last field.
///
/// `Unsize` is used along with [`ops::CoerceUnsized`] to allow
/// "user-defined" containers such as [`Rc`] to contain dynamically-sized
#[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")]
// SAFETY: const sound because integers are plain old datatypes so we can always
// transmute them to arrays of bytes
- #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_transmute))]
#[inline]
pub const fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
// SAFETY: integers are plain old datatypes so we can always transmute them to
#[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")]
// SAFETY: const sound because integers are plain old datatypes so we can always
// transmute to them
- #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_transmute))]
#[inline]
pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
// SAFETY: integers are plain old datatypes so we can always transmute to them
#[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")]
// SAFETY: const sound because integers are plain old datatypes so we can always
// transmute them to arrays of bytes
- #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_transmute))]
#[inline]
pub const fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
// SAFETY: integers are plain old datatypes so we can always transmute them to
#[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")]
// SAFETY: const sound because integers are plain old datatypes so we can always
// transmute to them
- #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_transmute))]
#[inline]
pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
// SAFETY: integers are plain old datatypes so we can always transmute to them
// Arguments::new_v1 may allow the compiler to omit Formatter::pad from the
// output binary, saving up to a few kilobytes.
panic_fmt(
- #[cfg(bootstrap)]
- fmt::Arguments::new_v1(&[expr], &[]),
- #[cfg(not(bootstrap))]
// SAFETY: Arguments::new_v1 is safe with exactly one str and zero args
- unsafe {
- fmt::Arguments::new_v1(&[expr], &[])
- },
+ unsafe { fmt::Arguments::new_v1(&[expr], &[]) },
);
}
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))]
#[cfg_attr(feature = "panic_immediate_abort", inline)]
#[track_caller]
-#[cfg_attr(not(bootstrap), lang = "panic_fmt")] // needed for const-evaluated panics
+#[lang = "panic_fmt"] // needed for const-evaluated panics
pub fn panic_fmt(fmt: fmt::Arguments<'_>) -> ! {
if cfg!(feature = "panic_immediate_abort") {
super::intrinsics::abort()
}
/// This function is used instead of panic_fmt in const eval.
-#[cfg(not(bootstrap))]
#[lang = "const_panic_fmt"]
pub const fn const_panic_fmt(fmt: fmt::Arguments<'_>) -> ! {
if let Some(msg) = fmt.as_str() {
--- /dev/null
+// `library/{std,core}/src/primitive_docs.rs` should have the same contents.
+// These are different files so that relative links work properly without
+// having to have `CARGO_PKG_NAME` set, but conceptually they should always be the same.
+#[doc(primitive = "bool")]
+#[doc(alias = "true")]
+#[doc(alias = "false")]
+/// The boolean type.
+///
+/// The `bool` represents a value, which could only be either [`true`] or [`false`]. If you cast
+/// a `bool` into an integer, [`true`] will be 1 and [`false`] will be 0.
+///
+/// # Basic usage
+///
+/// `bool` implements various traits, such as [`BitAnd`], [`BitOr`], [`Not`], etc.,
+/// which allow us to perform boolean operations using `&`, `|` and `!`.
+///
+/// [`if`] requires a `bool` value as its conditional. [`assert!`], which is an
+/// important macro in testing, checks whether an expression is [`true`] and panics
+/// if it isn't.
+///
+/// ```
+/// let bool_val = true & false | false;
+/// assert!(!bool_val);
+/// ```
+///
+/// [`true`]: ../std/keyword.true.html
+/// [`false`]: ../std/keyword.false.html
+/// [`BitAnd`]: ops::BitAnd
+/// [`BitOr`]: ops::BitOr
+/// [`Not`]: ops::Not
+/// [`if`]: ../std/keyword.if.html
+///
+/// # Examples
+///
+/// A trivial example of the usage of `bool`:
+///
+/// ```
+/// let praise_the_borrow_checker = true;
+///
+/// // using the `if` conditional
+/// if praise_the_borrow_checker {
+/// println!("oh, yeah!");
+/// } else {
+/// println!("what?!!");
+/// }
+///
+/// // ... or, a match pattern
+/// match praise_the_borrow_checker {
+/// true => println!("keep praising!"),
+/// false => println!("you should praise!"),
+/// }
+/// ```
+///
+/// Also, since `bool` implements the [`Copy`] trait, we don't
+/// have to worry about the move semantics (just like the integer and float primitives).
+///
+/// Now an example of `bool` cast to integer type:
+///
+/// ```
+/// assert_eq!(true as i32, 1);
+/// assert_eq!(false as i32, 0);
+/// ```
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_bool {}
+
+#[doc(primitive = "never")]
+#[doc(alias = "!")]
+//
+/// The `!` type, also called "never".
+///
+/// `!` represents the type of computations which never resolve to any value at all. For example,
+/// the [`exit`] function `fn exit(code: i32) -> !` exits the process without ever returning, and
+/// so returns `!`.
+///
+/// `break`, `continue` and `return` expressions also have type `!`. For example we are allowed to
+/// write:
+///
+/// ```
+/// #![feature(never_type)]
+/// # fn foo() -> u32 {
+/// let x: ! = {
+/// return 123
+/// };
+/// # }
+/// ```
+///
+/// Although the `let` is pointless here, it illustrates the meaning of `!`. Since `x` is never
+/// assigned a value (because `return` returns from the entire function), `x` can be given type
+/// `!`. We could also replace `return 123` with a `panic!` or a never-ending `loop` and this code
+/// would still be valid.
+///
+/// A more realistic usage of `!` is in this code:
+///
+/// ```
+/// # fn get_a_number() -> Option<u32> { None }
+/// # loop {
+/// let num: u32 = match get_a_number() {
+/// Some(num) => num,
+/// None => break,
+/// };
+/// # }
+/// ```
+///
+/// Both match arms must produce values of type [`u32`], but since `break` never produces a value
+/// at all we know it can never produce a value which isn't a [`u32`]. This illustrates another
+/// behaviour of the `!` type - expressions with type `!` will coerce into any other type.
+///
+/// [`u32`]: prim@u32
+#[doc = concat!("[`exit`]: ", include_str!("../primitive_docs/process_exit.md"))]
+///
+/// # `!` and generics
+///
+/// ## Infallible errors
+///
+/// The main place you'll see `!` used explicitly is in generic code. Consider the [`FromStr`]
+/// trait:
+///
+/// ```
+/// trait FromStr: Sized {
+/// type Err;
+/// fn from_str(s: &str) -> Result<Self, Self::Err>;
+/// }
+/// ```
+///
+/// When implementing this trait for [`String`] we need to pick a type for [`Err`]. And since
+/// converting a string into a string will never result in an error, the appropriate type is `!`.
+/// (Currently the type actually used is an enum with no variants, though this is only because `!`
+/// was added to Rust at a later date and it may change in the future.) With an [`Err`] type of
+/// `!`, if we have to call [`String::from_str`] for some reason the result will be a
+/// [`Result<String, !>`] which we can unpack like this:
+///
+/// ```
+/// #![feature(exhaustive_patterns)]
+/// use std::str::FromStr;
+/// let Ok(s) = String::from_str("hello");
+/// ```
+///
+/// Since the [`Err`] variant contains a `!`, it can never occur. If the `exhaustive_patterns`
+/// feature is present this means we can exhaustively match on [`Result<T, !>`] by just taking the
+/// [`Ok`] variant. This illustrates another behaviour of `!` - it can be used to "delete" certain
+/// enum variants from generic types like `Result`.
+///
+/// ## Infinite loops
+///
+/// While [`Result<T, !>`] is very useful for removing errors, `!` can also be used to remove
+/// successes as well. If we think of [`Result<T, !>`] as "if this function returns, it has not
+/// errored," we get a very intuitive idea of [`Result<!, E>`] as well: if the function returns, it
+/// *has* errored.
+///
+/// For example, consider the case of a simple web server, which can be simplified to:
+///
+/// ```ignore (hypothetical-example)
+/// loop {
+/// let (client, request) = get_request().expect("disconnected");
+/// let response = request.process();
+/// response.send(client);
+/// }
+/// ```
+///
+/// Currently, this isn't ideal, because we simply panic whenever we fail to get a new connection.
+/// Instead, we'd like to keep track of this error, like this:
+///
+/// ```ignore (hypothetical-example)
+/// loop {
+/// match get_request() {
+/// Err(err) => break err,
+/// Ok((client, request)) => {
+/// let response = request.process();
+/// response.send(client);
+/// },
+/// }
+/// }
+/// ```
+///
+/// Now, when the server disconnects, we exit the loop with an error instead of panicking. While it
+/// might be intuitive to simply return the error, we might want to wrap it in a [`Result<!, E>`]
+/// instead:
+///
+/// ```ignore (hypothetical-example)
+/// fn server_loop() -> Result<!, ConnectionError> {
+/// loop {
+/// let (client, request) = get_request()?;
+/// let response = request.process();
+/// response.send(client);
+/// }
+/// }
+/// ```
+///
+/// Now, we can use `?` instead of `match`, and the return type makes a lot more sense: if the loop
+/// ever stops, it means that an error occurred. We don't even have to wrap the loop in an `Ok`
+/// because `!` coerces to `Result<!, ConnectionError>` automatically.
+///
+/// [`String::from_str`]: str::FromStr::from_str
+#[doc = concat!("[`String`]: ", include_str!("../primitive_docs/string_string.md"))]
+/// [`FromStr`]: str::FromStr
+///
+/// # `!` and traits
+///
+/// When writing your own traits, `!` should have an `impl` whenever there is an obvious `impl`
+/// which doesn't `panic!`. The reason is that functions returning an `impl Trait` where `!`
+/// does not have an `impl` of `Trait` cannot diverge as their only possible code path. In other
+/// words, they can't return `!` from every code path. As an example, this code doesn't compile:
+///
+/// ```compile_fail
+/// use std::ops::Add;
+///
+/// fn foo() -> impl Add<u32> {
+/// unimplemented!()
+/// }
+/// ```
+///
+/// But this code does:
+///
+/// ```
+/// use std::ops::Add;
+///
+/// fn foo() -> impl Add<u32> {
+/// if true {
+/// unimplemented!()
+/// } else {
+/// 0
+/// }
+/// }
+/// ```
+///
+/// The reason is that, in the first example, there are many possible types that `!` could coerce
+/// to, because many types implement `Add<u32>`. However, in the second example,
+/// the `else` branch returns a `0`, which the compiler infers from the return type to be of type
+/// `u32`. Since `u32` is a concrete type, `!` can and will be coerced to it. See issue [#36375]
+/// for more information on this quirk of `!`.
+///
+/// [#36375]: https://github.com/rust-lang/rust/issues/36375
+///
+/// As it turns out, though, most traits can have an `impl` for `!`. Take [`Debug`]
+/// for example:
+///
+/// ```
+/// #![feature(never_type)]
+/// # use std::fmt;
+/// # trait Debug {
+/// # fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result;
+/// # }
+/// impl Debug for ! {
+/// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
+/// *self
+/// }
+/// }
+/// ```
+///
+/// Once again we're using `!`'s ability to coerce into any other type, in this case
+/// [`fmt::Result`]. Since this method takes a `&!` as an argument we know that it can never be
+/// called (because there is no value of type `!` for it to be called with). Writing `*self`
+/// essentially tells the compiler "We know that this code can never be run, so just treat the
+/// entire function body as having type [`fmt::Result`]". This pattern can be used a lot when
+/// implementing traits for `!`. Generally, any trait which only has methods which take a `self`
+/// parameter should have such an impl.
+///
+/// On the other hand, one trait which would not be appropriate to implement is [`Default`]:
+///
+/// ```
+/// trait Default {
+/// fn default() -> Self;
+/// }
+/// ```
+///
+/// Since `!` has no values, it has no default value either. It's true that we could write an
+/// `impl` for this which simply panics, but the same is true for any type (we could `impl
+/// Default` for (eg.) [`File`] by just making [`default()`] panic.)
+///
+#[doc = concat!("[`File`]: ", include_str!("../primitive_docs/fs_file.md"))]
+/// [`Debug`]: fmt::Debug
+/// [`default()`]: Default::default
+///
+#[unstable(feature = "never_type", issue = "35121")]
+mod prim_never {}
+
+#[doc(primitive = "char")]
+/// A character type.
+///
+/// The `char` type represents a single character. More specifically, since
+/// 'character' isn't a well-defined concept in Unicode, `char` is a '[Unicode
+/// scalar value]', which is similar to, but not the same as, a '[Unicode code
+/// point]'.
+///
+/// [Unicode scalar value]: https://www.unicode.org/glossary/#unicode_scalar_value
+/// [Unicode code point]: https://www.unicode.org/glossary/#code_point
+///
+/// This documentation describes a number of methods and trait implementations on the
+/// `char` type. For technical reasons, there is additional, separate
+/// documentation in [the `std::char` module](char/index.html) as well.
+///
+/// # Representation
+///
+/// `char` is always four bytes in size. This is a different representation than
+/// a given character would have as part of a [`String`]. For example:
+///
+/// ```
+/// let v = vec!['h', 'e', 'l', 'l', 'o'];
+///
+/// // five elements times four bytes for each element
+/// assert_eq!(20, v.len() * std::mem::size_of::<char>());
+///
+/// let s = String::from("hello");
+///
+/// // five elements times one byte per element
+/// assert_eq!(5, s.len() * std::mem::size_of::<u8>());
+/// ```
+///
+#[doc = concat!("[`String`]: ", include_str!("../primitive_docs/string_string.md"))]
+///
+/// As always, remember that a human intuition for 'character' might not map to
+/// Unicode's definitions. For example, despite looking similar, the 'é'
+/// character is one Unicode code point while 'é' is two Unicode code points:
+///
+/// ```
+/// let mut chars = "é".chars();
+/// // U+00e9: 'latin small letter e with acute'
+/// assert_eq!(Some('\u{00e9}'), chars.next());
+/// assert_eq!(None, chars.next());
+///
+/// let mut chars = "é".chars();
+/// // U+0065: 'latin small letter e'
+/// assert_eq!(Some('\u{0065}'), chars.next());
+/// // U+0301: 'combining acute accent'
+/// assert_eq!(Some('\u{0301}'), chars.next());
+/// assert_eq!(None, chars.next());
+/// ```
+///
+/// This means that the contents of the first string above _will_ fit into a
+/// `char` while the contents of the second string _will not_. Trying to create
+/// a `char` literal with the contents of the second string gives an error:
+///
+/// ```text
+/// error: character literal may only contain one codepoint: 'é'
+/// let c = 'é';
+/// ^^^
+/// ```
+///
+/// Another implication of the 4-byte fixed size of a `char` is that
+/// per-`char` processing can end up using a lot more memory:
+///
+/// ```
+/// let s = String::from("love: ❤️");
+/// let v: Vec<char> = s.chars().collect();
+///
+/// assert_eq!(12, std::mem::size_of_val(&s[..]));
+/// assert_eq!(32, std::mem::size_of_val(&v[..]));
+/// ```
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_char {}
+
+#[doc(primitive = "unit")]
+#[doc(alias = "(")]
+#[doc(alias = ")")]
+#[doc(alias = "()")]
+//
+/// The `()` type, also called "unit".
+///
+/// The `()` type has exactly one value `()`, and is used when there
+/// is no other meaningful value that could be returned. `()` is most
+/// commonly seen implicitly: functions without a `-> ...` implicitly
+/// have return type `()`, that is, these are equivalent:
+///
+/// ```rust
+/// fn long() -> () {}
+///
+/// fn short() {}
+/// ```
+///
+/// The semicolon `;` can be used to discard the result of an
+/// expression at the end of a block, making the expression (and thus
+/// the block) evaluate to `()`. For example,
+///
+/// ```rust
+/// fn returns_i64() -> i64 {
+/// 1i64
+/// }
+/// fn returns_unit() {
+/// 1i64;
+/// }
+///
+/// let is_i64 = {
+/// returns_i64()
+/// };
+/// let is_unit = {
+/// returns_i64();
+/// };
+/// ```
+///
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_unit {}
+
+#[doc(primitive = "pointer")]
+#[doc(alias = "ptr")]
+#[doc(alias = "*")]
+#[doc(alias = "*const")]
+#[doc(alias = "*mut")]
+//
+/// Raw, unsafe pointers, `*const T`, and `*mut T`.
+///
+/// *[See also the `std::ptr` module](ptr).*
+///
+/// Working with raw pointers in Rust is uncommon, typically limited to a few patterns.
+/// Raw pointers can be unaligned or [`null`]. However, when a raw pointer is
+/// dereferenced (using the `*` operator), it must be non-null and aligned.
+///
+/// Storing through a raw pointer using `*ptr = data` calls `drop` on the old value, so
+/// [`write`] must be used if the type has drop glue and memory is not already
+/// initialized - otherwise `drop` would be called on the uninitialized memory.
+///
+/// Use the [`null`] and [`null_mut`] functions to create null pointers, and the
+/// [`is_null`] method of the `*const T` and `*mut T` types to check for null.
+/// The `*const T` and `*mut T` types also define the [`offset`] method, for
+/// pointer math.
+///
+/// # Common ways to create raw pointers
+///
+/// ## 1. Coerce a reference (`&T`) or mutable reference (`&mut T`).
+///
+/// ```
+/// let my_num: i32 = 10;
+/// let my_num_ptr: *const i32 = &my_num;
+/// let mut my_speed: i32 = 88;
+/// let my_speed_ptr: *mut i32 = &mut my_speed;
+/// ```
+///
+/// To get a pointer to a boxed value, dereference the box:
+///
+/// ```
+/// let my_num: Box<i32> = Box::new(10);
+/// let my_num_ptr: *const i32 = &*my_num;
+/// let mut my_speed: Box<i32> = Box::new(88);
+/// let my_speed_ptr: *mut i32 = &mut *my_speed;
+/// ```
+///
+/// This does not take ownership of the original allocation
+/// and requires no resource management later,
+/// but you must not use the pointer after its lifetime.
+///
+/// ## 2. Consume a box (`Box<T>`).
+///
+/// The [`into_raw`] function consumes a box and returns
+/// the raw pointer. It doesn't destroy `T` or deallocate any memory.
+///
+/// ```
+/// let my_speed: Box<i32> = Box::new(88);
+/// let my_speed: *mut i32 = Box::into_raw(my_speed);
+///
+/// // By taking ownership of the original `Box<T>` though
+/// // we are obligated to put it together later to be destroyed.
+/// unsafe {
+/// drop(Box::from_raw(my_speed));
+/// }
+/// ```
+///
+/// Note that here the call to [`drop`] is for clarity - it indicates
+/// that we are done with the given value and it should be destroyed.
+///
+/// ## 3. Create it using `ptr::addr_of!`
+///
+/// Instead of coercing a reference to a raw pointer, you can use the macros
+/// [`ptr::addr_of!`] (for `*const T`) and [`ptr::addr_of_mut!`] (for `*mut T`).
+/// These macros allow you to create raw pointers to fields to which you cannot
+/// create a reference (without causing undefined behaviour), such as an
+/// unaligned field. This might be necessary if packed structs or uninitialized
+/// memory is involved.
+///
+/// ```
+/// #[derive(Debug, Default, Copy, Clone)]
+/// #[repr(C, packed)]
+/// struct S {
+/// aligned: u8,
+/// unaligned: u32,
+/// }
+/// let s = S::default();
+/// let p = std::ptr::addr_of!(s.unaligned); // not allowed with coercion
+/// ```
+///
+/// ## 4. Get it from C.
+///
+/// ```
+/// # #![feature(rustc_private)]
+/// extern crate libc;
+///
+/// use std::mem;
+///
+/// unsafe {
+/// let my_num: *mut i32 = libc::malloc(mem::size_of::<i32>()) as *mut i32;
+/// if my_num.is_null() {
+/// panic!("failed to allocate memory");
+/// }
+/// libc::free(my_num as *mut libc::c_void);
+/// }
+/// ```
+///
+/// Usually you wouldn't literally use `malloc` and `free` from Rust,
+/// but C APIs hand out a lot of pointers generally, so are a common source
+/// of raw pointers in Rust.
+///
+/// [`null`]: ptr::null
+/// [`null_mut`]: ptr::null_mut
+/// [`is_null`]: pointer::is_null
+/// [`offset`]: pointer::offset
+#[doc = concat!("[`into_raw`]: ", include_str!("../primitive_docs/box_into_raw.md"))]
+/// [`drop`]: mem::drop
+/// [`write`]: ptr::write
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_pointer {}
+
+#[doc(primitive = "array")]
+#[doc(alias = "[]")]
+#[doc(alias = "[T;N]")] // unfortunately, rustdoc doesn't have fuzzy search for aliases
+#[doc(alias = "[T; N]")]
+/// A fixed-size array, denoted `[T; N]`, for the element type, `T`, and the
+/// non-negative compile-time constant size, `N`.
+///
+/// There are two syntactic forms for creating an array:
+///
+/// * A list with each element, i.e., `[x, y, z]`.
+/// * A repeat expression `[x; N]`, which produces an array with `N` copies of `x`.
+/// The type of `x` must be [`Copy`].
+///
+/// Note that `[expr; 0]` is allowed, and produces an empty array.
+/// This will still evaluate `expr`, however, and immediately drop the resulting value, so
+/// be mindful of side effects.
+///
+/// Arrays of *any* size implement the following traits if the element type allows it:
+///
+/// - [`Copy`]
+/// - [`Clone`]
+/// - [`Debug`]
+/// - [`IntoIterator`] (implemented for `[T; N]`, `&[T; N]` and `&mut [T; N]`)
+/// - [`PartialEq`], [`PartialOrd`], [`Eq`], [`Ord`]
+/// - [`Hash`]
+/// - [`AsRef`], [`AsMut`]
+/// - [`Borrow`], [`BorrowMut`]
+///
+/// Arrays of sizes from 0 to 32 (inclusive) implement the [`Default`] trait
+/// if the element type allows it. As a stopgap, trait implementations are
+/// statically generated up to size 32.
+///
+/// Arrays coerce to [slices (`[T]`)][slice], so a slice method may be called on
+/// an array. Indeed, this provides most of the API for working with arrays.
+/// Slices have a dynamic size and do not coerce to arrays.
+///
+/// You can move elements out of an array with a [slice pattern]. If you want
+/// one element, see [`mem::replace`].
+///
+/// # Examples
+///
+/// ```
+/// let mut array: [i32; 3] = [0; 3];
+///
+/// array[1] = 1;
+/// array[2] = 2;
+///
+/// assert_eq!([1, 2], &array[1..]);
+///
+/// // This loop prints: 0 1 2
+/// for x in array {
+/// print!("{} ", x);
+/// }
+/// ```
+///
+/// You can also iterate over reference to the array's elements:
+///
+/// ```
+/// let array: [i32; 3] = [0; 3];
+///
+/// for x in &array { }
+/// ```
+///
+/// You can use a [slice pattern] to move elements out of an array:
+///
+/// ```
+/// fn move_away(_: String) { /* Do interesting things. */ }
+///
+/// let [john, roa] = ["John".to_string(), "Roa".to_string()];
+/// move_away(john);
+/// move_away(roa);
+/// ```
+///
+/// # Editions
+///
+/// Prior to Rust 1.53, arrays did not implement [`IntoIterator`] by value, so the method call
+/// `array.into_iter()` auto-referenced into a [slice iterator](slice::iter). Right now, the old
+/// behavior is preserved in the 2015 and 2018 editions of Rust for compatibility, ignoring
+/// [`IntoIterator`] by value. In the future, the behavior on the 2015 and 2018 edition
+/// might be made consistent to the behavior of later editions.
+///
+/// ```rust,edition2018
+/// // Rust 2015 and 2018:
+///
+/// # #![allow(array_into_iter)] // override our `deny(warnings)`
+/// let array: [i32; 3] = [0; 3];
+///
+/// // This creates a slice iterator, producing references to each value.
+/// for item in array.into_iter().enumerate() {
+/// let (i, x): (usize, &i32) = item;
+/// println!("array[{}] = {}", i, x);
+/// }
+///
+/// // The `array_into_iter` lint suggests this change for future compatibility:
+/// for item in array.iter().enumerate() {
+/// let (i, x): (usize, &i32) = item;
+/// println!("array[{}] = {}", i, x);
+/// }
+///
+/// // You can explicitly iterate an array by value using
+/// // `IntoIterator::into_iter` or `std::array::IntoIter::new`:
+/// for item in IntoIterator::into_iter(array).enumerate() {
+/// let (i, x): (usize, i32) = item;
+/// println!("array[{}] = {}", i, x);
+/// }
+/// ```
+///
+/// Starting in the 2021 edition, `array.into_iter()` uses `IntoIterator` normally to iterate
+/// by value, and `iter()` should be used to iterate by reference like previous editions.
+///
+/// ```rust,edition2021
+/// // Rust 2021:
+///
+/// let array: [i32; 3] = [0; 3];
+///
+/// // This iterates by reference:
+/// for item in array.iter().enumerate() {
+/// let (i, x): (usize, &i32) = item;
+/// println!("array[{}] = {}", i, x);
+/// }
+///
+/// // This iterates by value:
+/// for item in array.into_iter().enumerate() {
+/// let (i, x): (usize, i32) = item;
+/// println!("array[{}] = {}", i, x);
+/// }
+/// ```
+///
+/// Future language versions might start treating the `array.into_iter()`
+/// syntax on editions 2015 and 2018 the same as on edition 2021. So code using
+/// those older editions should still be written with this change in mind, to
+/// prevent breakage in the future. The safest way to accomplish this is to
+/// avoid the `into_iter` syntax on those editions. If an edition update is not
+/// viable/desired, there are multiple alternatives:
+/// * use `iter`, equivalent to the old behavior, creating references
+/// * use [`IntoIterator::into_iter`], equivalent to the post-2021 behavior (Rust 1.53+)
+/// * replace `for ... in array.into_iter() {` with `for ... in array {`,
+/// equivalent to the post-2021 behavior (Rust 1.53+)
+///
+/// ```rust,edition2018
+/// // Rust 2015 and 2018:
+///
+/// let array: [i32; 3] = [0; 3];
+///
+/// // This iterates by reference:
+/// for item in array.iter() {
+/// let x: &i32 = item;
+/// println!("{}", x);
+/// }
+///
+/// // This iterates by value:
+/// for item in IntoIterator::into_iter(array) {
+/// let x: i32 = item;
+/// println!("{}", x);
+/// }
+///
+/// // This iterates by value:
+/// for item in array {
+/// let x: i32 = item;
+/// println!("{}", x);
+/// }
+///
+/// // IntoIter can also start a chain.
+/// // This iterates by value:
+/// for item in IntoIterator::into_iter(array).enumerate() {
+/// let (i, x): (usize, i32) = item;
+/// println!("array[{}] = {}", i, x);
+/// }
+/// ```
+///
+/// [slice]: prim@slice
+/// [`Debug`]: fmt::Debug
+/// [`Hash`]: hash::Hash
+/// [`Borrow`]: borrow::Borrow
+/// [`BorrowMut`]: borrow::BorrowMut
+/// [slice pattern]: ../reference/patterns.html#slice-patterns
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_array {}
+
+#[doc(primitive = "slice")]
+#[doc(alias = "[")]
+#[doc(alias = "]")]
+#[doc(alias = "[]")]
+/// A dynamically-sized view into a contiguous sequence, `[T]`. Contiguous here
+/// means that elements are laid out so that every element is the same
+/// distance from its neighbors.
+///
+/// *[See also the `std::slice` module](crate::slice).*
+///
+/// Slices are a view into a block of memory represented as a pointer and a
+/// length.
+///
+/// ```
+/// // slicing a Vec
+/// let vec = vec![1, 2, 3];
+/// let int_slice = &vec[..];
+/// // coercing an array to a slice
+/// let str_slice: &[&str] = &["one", "two", "three"];
+/// ```
+///
+/// Slices are either mutable or shared. The shared slice type is `&[T]`,
+/// while the mutable slice type is `&mut [T]`, where `T` represents the element
+/// type. For example, you can mutate the block of memory that a mutable slice
+/// points to:
+///
+/// ```
+/// let mut x = [1, 2, 3];
+/// let x = &mut x[..]; // Take a full slice of `x`.
+/// x[1] = 7;
+/// assert_eq!(x, &[1, 7, 3]);
+/// ```
+///
+/// As slices store the length of the sequence they refer to, they have twice
+/// the size of pointers to [`Sized`](marker/trait.Sized.html) types.
+/// Also see the reference on
+/// [dynamically sized types](../reference/dynamically-sized-types.html).
+///
+/// ```
+/// # use std::rc::Rc;
+/// let pointer_size = std::mem::size_of::<&u8>();
+/// assert_eq!(2 * pointer_size, std::mem::size_of::<&[u8]>());
+/// assert_eq!(2 * pointer_size, std::mem::size_of::<*const [u8]>());
+/// assert_eq!(2 * pointer_size, std::mem::size_of::<Box<[u8]>>());
+/// assert_eq!(2 * pointer_size, std::mem::size_of::<Rc<[u8]>>());
+/// ```
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_slice {}
+
+#[doc(primitive = "str")]
+//
+/// String slices.
+///
+/// *[See also the `std::str` module](crate::str).*
+///
+/// The `str` type, also called a 'string slice', is the most primitive string
+/// type. It is usually seen in its borrowed form, `&str`. It is also the type
+/// of string literals, `&'static str`.
+///
+/// String slices are always valid UTF-8.
+///
+/// # Examples
+///
+/// String literals are string slices:
+///
+/// ```
+/// let hello = "Hello, world!";
+///
+/// // with an explicit type annotation
+/// let hello: &'static str = "Hello, world!";
+/// ```
+///
+/// They are `'static` because they're stored directly in the final binary, and
+/// so will be valid for the `'static` duration.
+///
+/// # Representation
+///
+/// A `&str` is made up of two components: a pointer to some bytes, and a
+/// length. You can look at these with the [`as_ptr`] and [`len`] methods:
+///
+/// ```
+/// use std::slice;
+/// use std::str;
+///
+/// let story = "Once upon a time...";
+///
+/// let ptr = story.as_ptr();
+/// let len = story.len();
+///
+/// // story has nineteen bytes
+/// assert_eq!(19, len);
+///
+/// // We can re-build a str out of ptr and len. This is all unsafe because
+/// // we are responsible for making sure the two components are valid:
+/// let s = unsafe {
+/// // First, we build a &[u8]...
+/// let slice = slice::from_raw_parts(ptr, len);
+///
+/// // ... and then convert that slice into a string slice
+/// str::from_utf8(slice)
+/// };
+///
+/// assert_eq!(s, Ok(story));
+/// ```
+///
+/// [`as_ptr`]: str::as_ptr
+/// [`len`]: str::len
+///
+/// Note: This example shows the internals of `&str`. `unsafe` should not be
+/// used to get a string slice under normal circumstances. Use `as_str`
+/// instead.
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_str {}
+
+#[doc(primitive = "tuple")]
+#[doc(alias = "(")]
+#[doc(alias = ")")]
+#[doc(alias = "()")]
+//
+/// A finite heterogeneous sequence, `(T, U, ..)`.
+///
+/// Let's cover each of those in turn:
+///
+/// Tuples are *finite*. In other words, a tuple has a length. Here's a tuple
+/// of length `3`:
+///
+/// ```
+/// ("hello", 5, 'c');
+/// ```
+///
+/// 'Length' is also sometimes called 'arity' here; each tuple of a different
+/// length is a different, distinct type.
+///
+/// Tuples are *heterogeneous*. This means that each element of the tuple can
+/// have a different type. In that tuple above, it has the type:
+///
+/// ```
+/// # let _:
+/// (&'static str, i32, char)
+/// # = ("hello", 5, 'c');
+/// ```
+///
+/// Tuples are a *sequence*. This means that they can be accessed by position;
+/// this is called 'tuple indexing', and it looks like this:
+///
+/// ```rust
+/// let tuple = ("hello", 5, 'c');
+///
+/// assert_eq!(tuple.0, "hello");
+/// assert_eq!(tuple.1, 5);
+/// assert_eq!(tuple.2, 'c');
+/// ```
+///
+/// The sequential nature of the tuple applies to its implementations of various
+/// traits. For example, in [`PartialOrd`] and [`Ord`], the elements are compared
+/// sequentially until the first non-equal set is found.
+///
+/// For more about tuples, see [the book](../book/ch03-02-data-types.html#the-tuple-type).
+///
+/// # Trait implementations
+///
+/// If every type inside a tuple implements one of the following traits, then a
+/// tuple itself also implements it.
+///
+/// * [`Clone`]
+/// * [`Copy`]
+/// * [`PartialEq`]
+/// * [`Eq`]
+/// * [`PartialOrd`]
+/// * [`Ord`]
+/// * [`Debug`]
+/// * [`Default`]
+/// * [`Hash`]
+///
+/// [`Debug`]: fmt::Debug
+/// [`Hash`]: hash::Hash
+///
+/// Due to a temporary restriction in Rust's type system, these traits are only
+/// implemented on tuples of arity 12 or less. In the future, this may change.
+///
+/// # Examples
+///
+/// Basic usage:
+///
+/// ```
+/// let tuple = ("hello", 5, 'c');
+///
+/// assert_eq!(tuple.0, "hello");
+/// ```
+///
+/// Tuples are often used as a return type when you want to return more than
+/// one value:
+///
+/// ```
+/// fn calculate_point() -> (i32, i32) {
+/// // Don't do a calculation, that's not the point of the example
+/// (4, 5)
+/// }
+///
+/// let point = calculate_point();
+///
+/// assert_eq!(point.0, 4);
+/// assert_eq!(point.1, 5);
+///
+/// // Combining this with patterns can be nicer.
+///
+/// let (x, y) = calculate_point();
+///
+/// assert_eq!(x, 4);
+/// assert_eq!(y, 5);
+/// ```
+///
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_tuple {}
+
+#[doc(primitive = "f32")]
+/// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008).
+///
+/// This type can represent a wide range of decimal numbers, like `3.5`, `27`,
+/// `-113.75`, `0.0078125`, `34359738368`, `0`, `-1`. So unlike integer types
+/// (such as `i32`), floating point types can represent non-integer numbers,
+/// too.
+///
+/// However, being able to represent this wide range of numbers comes at the
+/// cost of precision: floats can only represent some of the real numbers and
+/// calculation with floats round to a nearby representable number. For example,
+/// `5.0` and `1.0` can be exactly represented as `f32`, but `1.0 / 5.0` results
+/// in `0.20000000298023223876953125` since `0.2` cannot be exactly represented
+/// as `f32`. Note, however, that printing floats with `println` and friends will
+/// often discard insignificant digits: `println!("{}", 1.0f32 / 5.0f32)` will
+/// print `0.2`.
+///
+/// Additionally, `f32` can represent some special values:
+///
+/// - −0.0: IEEE 754 floating point numbers have a bit that indicates their sign, so −0.0 is a
+/// possible value. For comparison −0.0 = +0.0, but floating point operations can carry
+/// the sign bit through arithmetic operations. This means −0.0 × +0.0 produces −0.0 and
+/// a negative number rounded to a value smaller than a float can represent also produces −0.0.
+/// - [∞](#associatedconstant.INFINITY) and
+/// [−∞](#associatedconstant.NEG_INFINITY): these result from calculations
+/// like `1.0 / 0.0`.
+/// - [NaN (not a number)](#associatedconstant.NAN): this value results from
+/// calculations like `(-1.0).sqrt()`. NaN has some potentially unexpected
+/// behavior: it is unequal to any float, including itself! It is also neither
+/// smaller nor greater than any float, making it impossible to sort. Lastly,
+/// it is considered infectious as almost all calculations where one of the
+/// operands is NaN will also result in NaN.
+///
+/// For more information on floating point numbers, see [Wikipedia][wikipedia].
+///
+/// *[See also the `std::f32::consts` module](crate::f32::consts).*
+///
+/// [wikipedia]: https://en.wikipedia.org/wiki/Single-precision_floating-point_format
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_f32 {}
+
+#[doc(primitive = "f64")]
+/// A 64-bit floating point type (specifically, the "binary64" type defined in IEEE 754-2008).
+///
+/// This type is very similar to [`f32`], but has increased
+/// precision by using twice as many bits. Please see [the documentation for
+/// `f32`][`f32`] or [Wikipedia on double precision
+/// values][wikipedia] for more information.
+///
+/// *[See also the `std::f64::consts` module](crate::f64::consts).*
+///
+/// [`f32`]: prim@f32
+/// [wikipedia]: https://en.wikipedia.org/wiki/Double-precision_floating-point_format
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_f64 {}
+
+#[doc(primitive = "i8")]
+//
+/// The 8-bit signed integer type.
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_i8 {}
+
+#[doc(primitive = "i16")]
+//
+/// The 16-bit signed integer type.
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_i16 {}
+
+#[doc(primitive = "i32")]
+//
+/// The 32-bit signed integer type.
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_i32 {}
+
+#[doc(primitive = "i64")]
+//
+/// The 64-bit signed integer type.
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_i64 {}
+
+#[doc(primitive = "i128")]
+//
+/// The 128-bit signed integer type.
+#[stable(feature = "i128", since = "1.26.0")]
+mod prim_i128 {}
+
+#[doc(primitive = "u8")]
+//
+/// The 8-bit unsigned integer type.
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_u8 {}
+
+#[doc(primitive = "u16")]
+//
+/// The 16-bit unsigned integer type.
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_u16 {}
+
+#[doc(primitive = "u32")]
+//
+/// The 32-bit unsigned integer type.
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_u32 {}
+
+#[doc(primitive = "u64")]
+//
+/// The 64-bit unsigned integer type.
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_u64 {}
+
+#[doc(primitive = "u128")]
+//
+/// The 128-bit unsigned integer type.
+#[stable(feature = "i128", since = "1.26.0")]
+mod prim_u128 {}
+
+#[doc(primitive = "isize")]
+//
+/// The pointer-sized signed integer type.
+///
+/// The size of this primitive is how many bytes it takes to reference any
+/// location in memory. For example, on a 32 bit target, this is 4 bytes
+/// and on a 64 bit target, this is 8 bytes.
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_isize {}
+
+#[doc(primitive = "usize")]
+//
+/// The pointer-sized unsigned integer type.
+///
+/// The size of this primitive is how many bytes it takes to reference any
+/// location in memory. For example, on a 32 bit target, this is 4 bytes
+/// and on a 64 bit target, this is 8 bytes.
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_usize {}
+
+#[doc(primitive = "reference")]
+#[doc(alias = "&")]
+#[doc(alias = "&mut")]
+//
+/// References, both shared and mutable.
+///
+/// A reference represents a borrow of some owned value. You can get one by using the `&` or `&mut`
+/// operators on a value, or by using a [`ref`](../std/keyword.ref.html) or
+/// <code>[ref](../std/keyword.ref.html) [mut](../std/keyword.mut.html)</code> pattern.
+///
+/// For those familiar with pointers, a reference is just a pointer that is assumed to be
+/// aligned, not null, and pointing to memory containing a valid value of `T` - for example,
+/// <code>&[bool]</code> can only point to an allocation containing the integer values `1`
+/// ([`true`](../std/keyword.true.html)) or `0` ([`false`](../std/keyword.false.html)), but
+/// creating a <code>&[bool]</code> that points to an allocation containing
+/// the value `3` causes undefined behaviour.
+/// In fact, <code>[Option]\<&T></code> has the same memory representation as a
+/// nullable but aligned pointer, and can be passed across FFI boundaries as such.
+///
+/// In most cases, references can be used much like the original value. Field access, method
+/// calling, and indexing work the same (save for mutability rules, of course). In addition, the
+/// comparison operators transparently defer to the referent's implementation, allowing references
+/// to be compared the same as owned values.
+///
+/// References have a lifetime attached to them, which represents the scope for which the borrow is
+/// valid. A lifetime is said to "outlive" another one if its representative scope is as long or
+/// longer than the other. The `'static` lifetime is the longest lifetime, which represents the
+/// total life of the program. For example, string literals have a `'static` lifetime because the
+/// text data is embedded into the binary of the program, rather than in an allocation that needs
+/// to be dynamically managed.
+///
+/// `&mut T` references can be freely coerced into `&T` references with the same referent type, and
+/// references with longer lifetimes can be freely coerced into references with shorter ones.
+///
+/// Reference equality by address, instead of comparing the values pointed to, is accomplished via
+/// implicit reference-pointer coercion and raw pointer equality via [`ptr::eq`], while
+/// [`PartialEq`] compares values.
+///
+/// ```
+/// use std::ptr;
+///
+/// let five = 5;
+/// let other_five = 5;
+/// let five_ref = &five;
+/// let same_five_ref = &five;
+/// let other_five_ref = &other_five;
+///
+/// assert!(five_ref == same_five_ref);
+/// assert!(five_ref == other_five_ref);
+///
+/// assert!(ptr::eq(five_ref, same_five_ref));
+/// assert!(!ptr::eq(five_ref, other_five_ref));
+/// ```
+///
+/// For more information on how to use references, see [the book's section on "References and
+/// Borrowing"][book-refs].
+///
+/// [book-refs]: ../book/ch04-02-references-and-borrowing.html
+///
+/// # Trait implementations
+///
+/// The following traits are implemented for all `&T`, regardless of the type of its referent:
+///
+/// * [`Copy`]
+/// * [`Clone`] \(Note that this will not defer to `T`'s `Clone` implementation if it exists!)
+/// * [`Deref`]
+/// * [`Borrow`]
+/// * [`Pointer`]
+///
+/// [`Deref`]: ops::Deref
+/// [`Borrow`]: borrow::Borrow
+/// [`Pointer`]: fmt::Pointer
+///
+/// `&mut T` references get all of the above except `Copy` and `Clone` (to prevent creating
+/// multiple simultaneous mutable borrows), plus the following, regardless of the type of its
+/// referent:
+///
+/// * [`DerefMut`]
+/// * [`BorrowMut`]
+///
+/// [`DerefMut`]: ops::DerefMut
+/// [`BorrowMut`]: borrow::BorrowMut
+/// [bool]: prim@bool
+///
+/// The following traits are implemented on `&T` references if the underlying `T` also implements
+/// that trait:
+///
+/// * All the traits in [`std::fmt`] except [`Pointer`] and [`fmt::Write`]
+/// * [`PartialOrd`]
+/// * [`Ord`]
+/// * [`PartialEq`]
+/// * [`Eq`]
+/// * [`AsRef`]
+/// * [`Fn`] \(in addition, `&T` references get [`FnMut`] and [`FnOnce`] if `T: Fn`)
+/// * [`Hash`]
+/// * [`ToSocketAddrs`]
+///
+/// [`std::fmt`]: fmt
+/// ['Pointer`]: fmt::Pointer
+/// [`Hash`]: hash::Hash
+#[doc = concat!("[`ToSocketAddrs`]: ", include_str!("../primitive_docs/net_tosocketaddrs.md"))]
+///
+/// `&mut T` references get all of the above except `ToSocketAddrs`, plus the following, if `T`
+/// implements that trait:
+///
+/// * [`AsMut`]
+/// * [`FnMut`] \(in addition, `&mut T` references get [`FnOnce`] if `T: FnMut`)
+/// * [`fmt::Write`]
+/// * [`Iterator`]
+/// * [`DoubleEndedIterator`]
+/// * [`ExactSizeIterator`]
+/// * [`FusedIterator`]
+/// * [`TrustedLen`]
+/// * [`Send`] \(note that `&T` references only get `Send` if <code>T: [Sync]</code>)
+/// * [`io::Write`]
+/// * [`Read`]
+/// * [`Seek`]
+/// * [`BufRead`]
+///
+/// [`FusedIterator`]: iter::FusedIterator
+/// [`TrustedLen`]: iter::TrustedLen
+#[doc = concat!("[`Seek`]: ", include_str!("../primitive_docs/io_seek.md"))]
+#[doc = concat!("[`BufRead`]: ", include_str!("../primitive_docs/io_bufread.md"))]
+#[doc = concat!("[`Read`]: ", include_str!("../primitive_docs/io_read.md"))]
+#[doc = concat!("[`io::Write`]: ", include_str!("../primitive_docs/io_write.md"))]
+///
+/// Note that due to method call deref coercion, simply calling a trait method will act like they
+/// work on references as well as they do on owned values! The implementations described here are
+/// meant for generic contexts, where the final type `T` is a type parameter or otherwise not
+/// locally known.
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_ref {}
+
+#[doc(primitive = "fn")]
+//
+/// Function pointers, like `fn(usize) -> bool`.
+///
+/// *See also the traits [`Fn`], [`FnMut`], and [`FnOnce`].*
+///
+/// [`Fn`]: ops::Fn
+/// [`FnMut`]: ops::FnMut
+/// [`FnOnce`]: ops::FnOnce
+///
+/// Function pointers are pointers that point to *code*, not data. They can be called
+/// just like functions. Like references, function pointers are, among other things, assumed to
+/// not be null, so if you want to pass a function pointer over FFI and be able to accommodate null
+/// pointers, make your type [`Option<fn()>`](core::option#options-and-pointers-nullable-pointers)
+/// with your required signature.
+///
+/// ### Safety
+///
+/// Plain function pointers are obtained by casting either plain functions, or closures that don't
+/// capture an environment:
+///
+/// ```
+/// fn add_one(x: usize) -> usize {
+/// x + 1
+/// }
+///
+/// let ptr: fn(usize) -> usize = add_one;
+/// assert_eq!(ptr(5), 6);
+///
+/// let clos: fn(usize) -> usize = |x| x + 5;
+/// assert_eq!(clos(5), 10);
+/// ```
+///
+/// In addition to varying based on their signature, function pointers come in two flavors: safe
+/// and unsafe. Plain `fn()` function pointers can only point to safe functions,
+/// while `unsafe fn()` function pointers can point to safe or unsafe functions.
+///
+/// ```
+/// fn add_one(x: usize) -> usize {
+/// x + 1
+/// }
+///
+/// unsafe fn add_one_unsafely(x: usize) -> usize {
+/// x + 1
+/// }
+///
+/// let safe_ptr: fn(usize) -> usize = add_one;
+///
+/// //ERROR: mismatched types: expected normal fn, found unsafe fn
+/// //let bad_ptr: fn(usize) -> usize = add_one_unsafely;
+///
+/// let unsafe_ptr: unsafe fn(usize) -> usize = add_one_unsafely;
+/// let really_safe_ptr: unsafe fn(usize) -> usize = add_one;
+/// ```
+///
+/// ### ABI
+///
+/// On top of that, function pointers can vary based on what ABI they use. This
+/// is achieved by adding the `extern` keyword before the type, followed by the
+/// ABI in question. The default ABI is "Rust", i.e., `fn()` is the exact same
+/// type as `extern "Rust" fn()`. A pointer to a function with C ABI would have
+/// type `extern "C" fn()`.
+///
+/// `extern "ABI" { ... }` blocks declare functions with ABI "ABI". The default
+/// here is "C", i.e., functions declared in an `extern {...}` block have "C"
+/// ABI.
+///
+/// For more information and a list of supported ABIs, see [the nomicon's
+/// section on foreign calling conventions][nomicon-abi].
+///
+/// [nomicon-abi]: ../nomicon/ffi.html#foreign-calling-conventions
+///
+/// ### Variadic functions
+///
+/// Extern function declarations with the "C" or "cdecl" ABIs can also be *variadic*, allowing them
+/// to be called with a variable number of arguments. Normal Rust functions, even those with an
+/// `extern "ABI"`, cannot be variadic. For more information, see [the nomicon's section on
+/// variadic functions][nomicon-variadic].
+///
+/// [nomicon-variadic]: ../nomicon/ffi.html#variadic-functions
+///
+/// ### Creating function pointers
+///
+/// When `bar` is the name of a function, then the expression `bar` is *not* a
+/// function pointer. Rather, it denotes a value of an unnameable type that
+/// uniquely identifies the function `bar`. The value is zero-sized because the
+/// type already identifies the function. This has the advantage that "calling"
+/// the value (it implements the `Fn*` traits) does not require dynamic
+/// dispatch.
+///
+/// This zero-sized type *coerces* to a regular function pointer. For example:
+///
+/// ```rust
+/// use std::mem;
+///
+/// fn bar(x: i32) {}
+///
+/// let not_bar_ptr = bar; // `not_bar_ptr` is zero-sized, uniquely identifying `bar`
+/// assert_eq!(mem::size_of_val(¬_bar_ptr), 0);
+///
+/// let bar_ptr: fn(i32) = not_bar_ptr; // force coercion to function pointer
+/// assert_eq!(mem::size_of_val(&bar_ptr), mem::size_of::<usize>());
+///
+/// let footgun = &bar; // this is a shared reference to the zero-sized type identifying `bar`
+/// ```
+///
+/// The last line shows that `&bar` is not a function pointer either. Rather, it
+/// is a reference to the function-specific ZST. `&bar` is basically never what you
+/// want when `bar` is a function.
+///
+/// ### Traits
+///
+/// Function pointers implement the following traits:
+///
+/// * [`Clone`]
+/// * [`PartialEq`]
+/// * [`Eq`]
+/// * [`PartialOrd`]
+/// * [`Ord`]
+/// * [`Hash`]
+/// * [`Pointer`]
+/// * [`Debug`]
+///
+/// [`Hash`]: hash::Hash
+/// [`Pointer`]: fmt::Pointer
+///
+/// Due to a temporary restriction in Rust's type system, these traits are only implemented on
+/// functions that take 12 arguments or less, with the `"Rust"` and `"C"` ABIs. In the future, this
+/// may change.
+///
+/// In addition, function pointers of *any* signature, ABI, or safety are [`Copy`], and all *safe*
+/// function pointers implement [`Fn`], [`FnMut`], and [`FnOnce`]. This works because these traits
+/// are specially known to the compiler.
+#[stable(feature = "rust1", since = "1.0.0")]
+mod prim_fn {}
#[rustc_const_stable(feature = "const_slice_len", since = "1.39.0")]
#[inline]
// SAFETY: const sound because we transmute out the length field as a usize (which it must be)
- #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_union))]
pub const fn len(&self) -> usize {
// FIXME: Replace with `crate::ptr::metadata(self)` when that is const-stable.
// As of this writing this causes a "Const-stable functions can only call other
/// assert!(match r { Ok(1..=4) => true, _ => false, });
/// ```
// Lint rustdoc::broken_intra_doc_links is allowed as `slice::sort_by_key` is
- // in crate `alloc`, and as such doesn't exists yet when building `core`.
- // links to downstream crate: #74481. Since primitives are only documented in
- // libstd (#73423), this never leads to broken links in practice.
+ // in crate `alloc`, and as such doesn't exists yet when building `core`: #74481.
+ // This breaks links when slice is displayed in core, but changing it to use relative links
+ // would break when the item is re-exported. So allow the core links to be broken for now.
#[allow(rustdoc::broken_intra_doc_links)]
#[stable(feature = "slice_binary_search_by_key", since = "1.10.0")]
#[inline]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_str_from_utf8_unchecked", since = "1.55.0")]
-#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_transmute))]
pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
// SAFETY: the caller must guarantee that the bytes `v` are valid UTF-8.
// Also relies on `&str` and `&[u8]` having the same layout.
#[rustc_const_stable(feature = "str_as_bytes", since = "1.39.0")]
#[inline(always)]
#[allow(unused_attributes)]
- #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_transmute))]
pub const fn as_bytes(&self) -> &[u8] {
// SAFETY: const sound because we transmute two types with the same layout
unsafe { mem::transmute(self) }
fn test_formatting_parameters_are_forwarded() {
use std::collections::{BTreeMap, BTreeSet};
#[derive(Debug)]
+ #[allow(dead_code)]
struct Foo {
bar: u32,
baz: u32,
fn source($self: $S::Span) -> $S::Span;
fn start($self: $S::Span) -> LineColumn;
fn end($self: $S::Span) -> LineColumn;
+ fn before($self: $S::Span) -> $S::Span;
+ fn after($self: $S::Span) -> $S::Span;
fn join($self: $S::Span, other: $S::Span) -> Option<$S::Span>;
fn resolved_at($self: $S::Span, at: $S::Span) -> $S::Span;
fn source_text($self: $S::Span) -> Option<String>;
self.0.end().add_1_to_column()
}
+ /// Creates an empty span pointing to directly before this span.
+ #[unstable(feature = "proc_macro_span_shrink", issue = "87552")]
+ pub fn before(&self) -> Span {
+ Span(self.0.before())
+ }
+
+ /// Creates an empty span pointing to directly after this span.
+ #[unstable(feature = "proc_macro_span_shrink", issue = "87552")]
+ pub fn after(&self) -> Span {
+ Span(self.0.after())
+ }
+
/// Creates a new span encompassing `self` and `other`.
///
/// Returns `None` if `self` and `other` are from different files.
--- /dev/null
+Box::into_raw
--- /dev/null
+io::BufRead
--- /dev/null
+net::ToSocketAddrs
--- /dev/null
+process::exit
--- /dev/null
+string::String
//! Iterators also provide a series of *adapter* methods for performing common
//! threads to sequences. Among the adapters are functional favorites like `map`,
//! `fold`, `skip` and `take`. Of particular interest to collections is the
-//! `rev` adapter, that reverses any iterator that supports this operation. Most
+//! `rev` adapter, which reverses any iterator that supports this operation. Most
//! collections provide reversible iterators as the way to iterate over them in
//! reverse order.
//!
// Writes append to this slice
pub buffer: Vec<u8>,
- // Flush sets this flag
- pub flushed: bool,
-
// If true, writes will always be an error
pub always_write_error: bool,
if self.always_flush_error {
Err(io::Error::new(io::ErrorKind::Other, "test - always_flush_error"))
} else {
- self.flushed = true;
Ok(())
}
}
/// encountered.
///
/// This method is primarily used to interface with the
- /// [`format_args!()`] macro, but it is rare that this should
+ /// [`format_args!()`] macro, and it is rare that this should
/// explicitly be called. The [`write!()`] macro should be favored to
/// invoke this method instead.
///
#![feature(const_cstr_unchecked)]
#![feature(const_fn_floating_point_arithmetic)]
#![feature(const_fn_fn_ptr_basics)]
-#![cfg_attr(bootstrap, feature(const_fn_transmute))]
#![feature(const_format_args)]
#![feature(const_io_structs)]
#![feature(const_ip)]
#![feature(doc_keyword)]
#![feature(doc_masked)]
#![feature(doc_notable_trait)]
-#![cfg_attr(not(bootstrap), feature(doc_primitive))]
+#![feature(doc_primitive)]
#![feature(dropck_eyepatch)]
#![feature(duration_checked_float)]
#![feature(duration_constants)]
///
/// let addr = Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff);
/// ```
- #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_transmute))]
#[rustc_const_stable(feature = "const_ipv6", since = "1.32.0")]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).segments(),
/// [0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff]);
/// ```
- #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_transmute))]
#[rustc_const_stable(feature = "const_ipv6", since = "1.50.0")]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
#[cfg_attr(not(feature = "panic_immediate_abort"), track_caller)]
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))]
#[cfg_attr(feature = "panic_immediate_abort", inline)]
-#[cfg_attr(all(not(bootstrap), not(test)), lang = "begin_panic_fmt")]
+#[cfg_attr(not(test), lang = "begin_panic_fmt")]
pub fn begin_panic_fmt(msg: &fmt::Arguments<'_>) -> ! {
if cfg!(feature = "panic_immediate_abort") {
intrinsics::abort()
+// `library/{std,core}/src/primitive_docs.rs` should have the same contents.
+// These are different files so that relative links work properly without
+// having to have `CARGO_PKG_NAME` set, but conceptually they should always be the same.
#[doc(primitive = "bool")]
#[doc(alias = "true")]
#[doc(alias = "false")]
/// assert!(!bool_val);
/// ```
///
-/// [`true`]: keyword.true.html
-/// [`false`]: keyword.false.html
+/// [`true`]: ../std/keyword.true.html
+/// [`false`]: ../std/keyword.false.html
/// [`BitAnd`]: ops::BitAnd
/// [`BitOr`]: ops::BitOr
/// [`Not`]: ops::Not
-/// [`if`]: keyword.if.html
+/// [`if`]: ../std/keyword.if.html
///
/// # Examples
///
/// behaviour of the `!` type - expressions with type `!` will coerce into any other type.
///
/// [`u32`]: prim@u32
-/// [`exit`]: process::exit
+#[doc = concat!("[`exit`]: ", include_str!("../primitive_docs/process_exit.md"))]
///
/// # `!` and generics
///
/// because `!` coerces to `Result<!, ConnectionError>` automatically.
///
/// [`String::from_str`]: str::FromStr::from_str
-/// [`String`]: string::String
+#[doc = concat!("[`String`]: ", include_str!("../primitive_docs/string_string.md"))]
/// [`FromStr`]: str::FromStr
///
/// # `!` and traits
/// `impl` for this which simply panics, but the same is true for any type (we could `impl
/// Default` for (eg.) [`File`] by just making [`default()`] panic.)
///
-/// [`File`]: fs::File
+#[doc = concat!("[`File`]: ", include_str!("../primitive_docs/fs_file.md"))]
/// [`Debug`]: fmt::Debug
/// [`default()`]: Default::default
///
mod prim_never {}
#[doc(primitive = "char")]
-//
/// A character type.
///
/// The `char` type represents a single character. More specifically, since
/// assert_eq!(5, s.len() * std::mem::size_of::<u8>());
/// ```
///
-/// [`String`]: string/struct.String.html
+#[doc = concat!("[`String`]: ", include_str!("../primitive_docs/string_string.md"))]
///
/// As always, remember that a human intuition for 'character' might not map to
/// Unicode's definitions. For example, despite looking similar, the 'é'
/// [`null_mut`]: ptr::null_mut
/// [`is_null`]: pointer::is_null
/// [`offset`]: pointer::offset
-/// [`into_raw`]: Box::into_raw
+#[doc = concat!("[`into_raw`]: ", include_str!("../primitive_docs/box_into_raw.md"))]
/// [`drop`]: mem::drop
/// [`write`]: ptr::write
#[stable(feature = "rust1", since = "1.0.0")]
/// # Editions
///
/// Prior to Rust 1.53, arrays did not implement [`IntoIterator`] by value, so the method call
-/// `array.into_iter()` auto-referenced into a [slice iterator](slice::iter). Right now, the old behavior
-/// is preserved in the 2015 and 2018 editions of Rust for compatibility, ignoring
-/// `IntoIterator` by value. In the future, the behavior on the 2015 and 2018 edition
+/// `array.into_iter()` auto-referenced into a [slice iterator](slice::iter). Right now, the old
+/// behavior is preserved in the 2015 and 2018 editions of Rust for compatibility, ignoring
+/// [`IntoIterator`] by value. In the future, the behavior on the 2015 and 2018 edition
/// might be made consistent to the behavior of later editions.
///
/// ```rust,edition2018
/// Starting in the 2021 edition, `array.into_iter()` uses `IntoIterator` normally to iterate
/// by value, and `iter()` should be used to iterate by reference like previous editions.
///
-#[cfg_attr(bootstrap, doc = "```rust,edition2021,ignore")]
-#[cfg_attr(not(bootstrap), doc = "```rust,edition2021")]
+/// ```rust,edition2021
/// // Rust 2021:
///
/// let array: [i32; 3] = [0; 3];
/// References, both shared and mutable.
///
/// A reference represents a borrow of some owned value. You can get one by using the `&` or `&mut`
-/// operators on a value, or by using a [`ref`](keyword.ref.html) or
-/// <code>[ref](keyword.ref.html) [mut](keyword.mut.html)</code> pattern.
+/// operators on a value, or by using a [`ref`](../std/keyword.ref.html) or
+/// <code>[ref](../std/keyword.ref.html) [mut](../std/keyword.mut.html)</code> pattern.
///
/// For those familiar with pointers, a reference is just a pointer that is assumed to be
/// aligned, not null, and pointing to memory containing a valid value of `T` - for example,
/// <code>&[bool]</code> can only point to an allocation containing the integer values `1`
-/// ([`true`](keyword.true.html)) or `0` ([`false`](keyword.false.html)), but creating a
-/// <code>&[bool]</code> that points to an allocation containing the value `3` causes
-/// undefined behaviour.
+/// ([`true`](../std/keyword.true.html)) or `0` ([`false`](../std/keyword.false.html)), but
+/// creating a <code>&[bool]</code> that points to an allocation containing
+/// the value `3` causes undefined behaviour.
/// In fact, <code>[Option]\<&T></code> has the same memory representation as a
/// nullable but aligned pointer, and can be passed across FFI boundaries as such.
///
///
/// [`DerefMut`]: ops::DerefMut
/// [`BorrowMut`]: borrow::BorrowMut
+/// [bool]: prim@bool
///
/// The following traits are implemented on `&T` references if the underlying `T` also implements
/// that trait:
/// [`std::fmt`]: fmt
/// ['Pointer`]: fmt::Pointer
/// [`Hash`]: hash::Hash
-/// [`ToSocketAddrs`]: net::ToSocketAddrs
+#[doc = concat!("[`ToSocketAddrs`]: ", include_str!("../primitive_docs/net_tosocketaddrs.md"))]
///
/// `&mut T` references get all of the above except `ToSocketAddrs`, plus the following, if `T`
/// implements that trait:
///
/// [`FusedIterator`]: iter::FusedIterator
/// [`TrustedLen`]: iter::TrustedLen
-/// [`Seek`]: io::Seek
-/// [`BufRead`]: io::BufRead
-/// [`Read`]: io::Read
+#[doc = concat!("[`Seek`]: ", include_str!("../primitive_docs/io_seek.md"))]
+#[doc = concat!("[`BufRead`]: ", include_str!("../primitive_docs/io_bufread.md"))]
+#[doc = concat!("[`Read`]: ", include_str!("../primitive_docs/io_read.md"))]
+#[doc = concat!("[`io::Write`]: ", include_str!("../primitive_docs/io_write.md"))]
///
/// Note that due to method call deref coercion, simply calling a trait method will act like they
/// work on references as well as they do on owned values! The implementations described here are
// Because the testsuit node holds some of the information as attributes, we can't write it
// until all of the tests has ran. Instead of writting every result as they come in, we add
// them to a Vec and write them all at once when run is complete.
- let duration = exec_time.map(|t| t.0.clone()).unwrap_or_default();
+ let duration = exec_time.map(|t| t.0).unwrap_or_default();
self.results.push((desc.clone(), result.clone(), duration));
Ok(())
}
use searcher::get_dbpath_for_term;
/// A parsed terminfo database entry.
+#[allow(unused)]
#[derive(Debug)]
pub(crate) struct TermInfo {
/// Names for the terminal
cargo.rustdocflag("-Znormalize-docs");
cargo.rustdocflag("--show-type-layout");
compile::rustc_cargo(builder, &mut cargo, target);
+ cargo.arg("-Zunstable-options");
cargo.arg("-Zskip-rustdoc-fingerprint");
// Only include compiler crates, no dependencies of those, such as `libc`.
+ // Do link to dependencies on `docs.rs` however using `rustdoc-map`.
cargo.arg("--no-deps");
+ cargo.arg("-Zrustdoc-map");
+
+ // FIXME: `-Zrustdoc-map` does not yet correctly work for transitive dependencies,
+ // once this is no longer an issue the special case for `ena` can be removed.
+ cargo.rustdocflag("--extern-html-root-url");
+ cargo.rustdocflag("ena=https://docs.rs/ena/latest/");
// Find dependencies for top level crates.
let mut compiler_crates = HashSet::new();
.env("RUSTDOC", builder.rustdoc(self.compiler))
.env("RUSTC", builder.rustc(self.compiler))
.current_dir(path);
+ // FIXME: implement a `// compile-flags` command or similar
+ // instead of hard-coding this test
+ if entry.file_name() == "link_to_definition" {
+ cargo.env("RUSTDOCFLAGS", "-Zunstable-options --generate-link-to-definition");
+ }
builder.run(&mut cargo);
}
}
for lib in c cxxrt gcc_s m thr util; do
files_to_extract=("${files_to_extract[@]}" "./lib/lib${lib}.*" "./usr/lib/lib${lib}.*")
done
-for lib in c++ c_nonshared compiler_rt execinfo gcc pthread rt ssp_nonshared; do
+for lib in c++ c_nonshared compiler_rt execinfo gcc pthread rt ssp_nonshared procstat; do
files_to_extract=("${files_to_extract[@]}" "./usr/lib/lib${lib}.*")
done
SCRIPT: python x.py dist
# RLS does not build for aarch64-pc-windows-msvc. See rust-lang/rls#1693
DIST_REQUIRE_ALL_TOOLS: 0
+ # Hack around this SDK version, because it doesn't work with clang.
+ # See https://github.com/rust-lang/rust/issues/88796
+ WINDOWS_SDK_20348_HACK: 1
<<: *job-windows-xl
- name: dist-i686-mingw
# `clang-ar` by accident.
ciCommandSetEnv AR "ar"
elif isWindows && [[ ${CUSTOM_MINGW-0} -ne 1 ]]; then
+
+ if [[ ${WINDOWS_SDK_20348_HACK-0} -eq 1 ]]; then
+ rm -rf '/c/Program Files (x86)/Windows Kits/10/include/10.0.20348.0'
+ mv '/c/Program Files (x86)/Windows Kits/10/include/'10.0.{19041,20348}.0
+ fi
+
# If we're compiling for MSVC then we, like most other distribution builders,
# switch to clang as the compiler. This'll allow us eventually to enable LTO
# amongst LLVM and rustc. Note that we only do this on MSVC as I don't think
exit 0
fi
- echo 'git: unshallowing the repository so we can check commits'
- git fetch \
- --no-tags \
- --no-recurse-submodules \
- --progress \
- --prune \
- --unshallow
-
if [[ $ci_base_branch == "beta" ]]; then
verify_cherries master "$BETA_LIMIT" \
|| exit 1
`armv5te-unknown-linux-uclibceabi` | ? | | ARMv5TE Linux with uClibc
`armv6-unknown-freebsd` | ✓ | ✓ | ARMv6 FreeBSD
`armv6-unknown-netbsd-eabihf` | ? | |
+`armv6k-nintendo-3ds` | * | | ARMv6K Nintendo 3DS, Horizon (Requires devkitARM toolchain)
`armv7-apple-ios` | ✓ | | ARMv7 iOS, Cortex-a8
`armv7-unknown-freebsd` | ✓ | ✓ | ARMv7 FreeBSD
`armv7-unknown-netbsd-eabihf` | ✓ | ✓ |
specially cache them. This flag will rename all these files in the output to include the suffix in
the filename. For example, `light.css` would become `light-suf.css` with the above command.
-### `--display-warnings`: display warnings when documenting or running documentation tests
+### `--display-doctest-warnings`: display warnings when documenting or running documentation tests
Using this flag looks like this:
```bash
-$ rustdoc src/lib.rs -Z unstable-options --display-warnings
-$ rustdoc --test src/lib.rs -Z unstable-options --display-warnings
+$ rustdoc src/lib.rs -Z unstable-options --display-doctest-warnings
+$ rustdoc --test src/lib.rs -Z unstable-options --display-doctest-warnings
```
The intent behind this flag is to allow the user to see warnings that occur within their library or
As a consequence, you should only use GNU assembler **numeric** [local labels] inside inline assembly code. Defining symbols in assembly code may lead to assembler and/or linker errors due to duplicate symbol definitions.
-Moreover, on x86 when using the default intel syntax, due to [an llvm bug], you shouldn't use labels exclusively made of `0` and `1` digits, e.g. `0`, `11` or `101010`, as they may end up being interpreted as binary values. Using `option(att_syntax)` will avoid any ambiguity, but that affects the syntax of the _entire_ `asm!` block.
+Moreover, on x86 when using the default intel syntax, due to [an llvm bug], you shouldn't use labels exclusively made of `0` and `1` digits, e.g. `0`, `11` or `101010`, as they may end up being interpreted as binary values. Using `options(att_syntax)` will avoid any ambiguity, but that affects the syntax of the _entire_ `asm!` block.
```rust,allow_fail
#![feature(asm)]
let param_env = self.cx.tcx.param_env(item_def_id);
let ty = self.cx.tcx.type_of(item_def_id);
- debug!("get_blanket_impls({:?})", ty);
+ trace!("get_blanket_impls({:?})", ty);
let mut impls = Vec::new();
for &trait_def_id in self.cx.tcx.all_traits(()).iter() {
if !self.cx.cache.access_levels.is_public(trait_def_id)
// NOTE: doesn't use `for_each_relevant_impl` to avoid looking at anything besides blanket impls
let trait_impls = self.cx.tcx.trait_impls_of(trait_def_id);
for &impl_def_id in trait_impls.blanket_impls() {
- debug!(
+ trace!(
"get_blanket_impls: Considering impl for trait '{:?}' {:?}",
- trait_def_id, impl_def_id
+ trait_def_id,
+ impl_def_id
);
let trait_ref = self.cx.tcx.impl_trait_ref(impl_def_id).unwrap();
let is_param = matches!(trait_ref.self_ty().kind(), ty::Param(_));
// FIXME(eddyb) ignoring `obligations` might cause false positives.
drop(obligations);
- debug!(
+ trace!(
"invoking predicate_may_hold: param_env={:?}, trait_ref={:?}, ty={:?}",
- param_env, trait_ref, ty
+ param_env,
+ trait_ref,
+ ty
);
let predicates = self
.cx
}
let (merged_attrs, cfg) = merge_attrs(cx, parent_module.into(), load_attrs(cx, did), attrs);
- debug!("merged_attrs={:?}", merged_attrs);
+ trace!("merged_attrs={:?}", merged_attrs);
- debug!("build_impl: impl {:?} for {:?}", trait_.def_id(), for_.def_id());
+ trace!("build_impl: impl {:?} for {:?}", trait_.def_id(), for_.def_id());
ret.push(clean::Item::from_def_id_and_attrs_and_parts(
did,
None,
// visit each node at most once.
for &item in cx.tcx.item_children(did).iter() {
if item.vis == ty::Visibility::Public {
- if let Some(def_id) = item.res.mod_def_id() {
+ let res = item.res.expect_non_local();
+ if let Some(def_id) = res.mod_def_id() {
if did == def_id || !visited.insert(def_id) {
continue;
}
}
- if let Res::PrimTy(p) = item.res {
+ if let Res::PrimTy(p) = res {
// Primitive types can't be inlined so generate an import instead.
let prim_ty = clean::PrimitiveType::from(p);
items.push(clean::Item {
clean::ImportSource {
path: clean::Path {
global: false,
- res: item.res,
+ res,
segments: vec![clean::PathSegment {
name: prim_ty.as_sym(),
args: clean::GenericArgs::AngleBracketed {
))),
cfg: None,
});
- } else if let Some(i) =
- try_inline(cx, did, None, item.res, item.ident.name, None, visited)
- {
+ } else if let Some(i) = try_inline(cx, did, None, res, item.ident.name, None, visited) {
items.extend(i)
}
}
name: Symbol,
import_def_id: Option<DefId>,
) -> clean::ItemKind {
- let imported_from = cx.tcx.crate_name(def_id.krate);
match CStore::from_tcx(cx.tcx).load_macro_untracked(def_id, cx.sess()) {
LoadedMacro::MacroDef(item_def, _) => {
if let ast::ItemKind::MacroDef(ref def) = item_def.kind {
def_id,
cx.tcx.visibility(import_def_id.unwrap_or(def_id)),
),
- imported_from: Some(imported_from),
})
} else {
unreachable!()
);
}
inline::record_extern_fqn(cx, trait_ref.def_id, kind);
- let path = external_path(
- cx,
- cx.tcx.item_name(trait_ref.def_id),
- Some(trait_ref.def_id),
- true,
- bounds.to_vec(),
- trait_ref.substs,
- );
+ let path = external_path(cx, trait_ref.def_id, true, bounds.to_vec(), trait_ref.substs);
debug!("ty::TraitRef\n subst: {:?}\n", trait_ref.substs);
impl Clean<Type> for hir::TraitRef<'_> {
fn clean(&self, cx: &mut DocContext<'_>) -> Type {
let path = self.path.clean(cx);
- resolve_type(cx, path, self.hir_ref_id)
+ resolve_type(cx, path)
}
}
fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
use rustc_hir::GenericParamCount;
- let hir::Ty { hir_id, span, ref kind } = *hir_ty;
+ let hir::Ty { hir_id: _, span, ref kind } = *hir_ty;
let qpath = match kind {
hir::TyKind::Path(qpath) => qpath,
_ => unreachable!(),
return cx.enter_alias(ty_substs, lt_substs, ct_substs, |cx| ty.clean(cx));
}
let path = path.clean(cx);
- resolve_type(cx, path, hir_id)
+ resolve_type(cx, path)
}
hir::QPath::Resolved(Some(ref qself), ref p) => {
// Try to normalize `<X as Y>::T` to a type
name: p.segments.last().expect("segments were empty").ident.name,
self_def_id: Some(DefId::local(qself.hir_id.owner.local_def_index)),
self_type: Box::new(qself.clean(cx)),
- trait_: Box::new(resolve_type(cx, trait_path, hir_id)),
+ trait_: Box::new(resolve_type(cx, trait_path)),
}
}
hir::QPath::TypeRelative(ref qself, ref segment) => {
name: segment.ident.name,
self_def_id: res.opt_def_id(),
self_type: Box::new(qself.clean(cx)),
- trait_: Box::new(resolve_type(cx, trait_path, hir_id)),
+ trait_: Box::new(resolve_type(cx, trait_path)),
}
}
hir::QPath::LangItem(..) => bug!("clean: requiring documentation of lang item"),
impl<'tcx> Clean<Type> for Ty<'tcx> {
fn clean(&self, cx: &mut DocContext<'_>) -> Type {
- debug!("cleaning type: {:?}", self);
+ trace!("cleaning type: {:?}", self);
let ty = normalize(cx, self).unwrap_or(self);
match *ty.kind() {
ty::Never => Never,
AdtKind::Enum => ItemType::Enum,
};
inline::record_extern_fqn(cx, did, kind);
- let path = external_path(cx, cx.tcx.item_name(did), None, false, vec![], substs);
+ let path = external_path(cx, did, false, vec![], substs);
ResolvedPath { path, did, is_generic: false }
}
ty::Foreign(did) => {
inline::record_extern_fqn(cx, did, ItemType::ForeignType);
- let path = external_path(
- cx,
- cx.tcx.item_name(did),
- None,
- false,
- vec![],
- InternalSubsts::empty(),
- );
+ let path = external_path(cx, did, false, vec![], InternalSubsts::empty());
ResolvedPath { path, did, is_generic: false }
}
ty::Dynamic(ref obj, ref reg) => {
for did in dids {
let empty = cx.tcx.intern_substs(&[]);
- let path =
- external_path(cx, cx.tcx.item_name(did), Some(did), false, vec![], empty);
+ let path = external_path(cx, did, false, vec![], empty);
inline::record_extern_fqn(cx, did, ItemType::Trait);
let bound = PolyTrait {
trait_: ResolvedPath { path, did, is_generic: false },
});
}
- let path =
- external_path(cx, cx.tcx.item_name(did), Some(did), false, bindings, substs);
+ let path = external_path(cx, did, false, bindings, substs);
bounds.insert(
0,
PolyTrait {
}
ItemKind::Macro(ref macro_def) => MacroItem(Macro {
source: display_macro_source(cx, name, ¯o_def, def_id, &item.vis),
- imported_from: None,
}),
ItemKind::Trait(is_auto, unsafety, ref generics, ref bounds, ref item_ids) => {
let items = item_ids
crate fn keywords(&self, tcx: TyCtxt<'_>) -> ThinVec<(DefId, Symbol)> {
let root = self.def_id();
- let as_keyword = |res: Res| {
+ let as_keyword = |res: Res<!>| {
if let Res::Def(DefKind::Mod, def_id) = res {
let attrs = tcx.get_attrs(def_id);
let mut keyword = None;
hir::ItemKind::Use(ref path, hir::UseKind::Single)
if item.vis.node.is_pub() =>
{
- as_keyword(path.res).map(|(_, prim)| (id.def_id.to_def_id(), prim))
+ as_keyword(path.res.expect_non_local())
+ .map(|(_, prim)| (id.def_id.to_def_id(), prim))
}
_ => None,
}
// Also note that this does not attempt to deal with modules tagged
// duplicately for the same primitive. This is handled later on when
// rendering by delegating everything to a hash map.
- let as_primitive = |res: Res| {
+ let as_primitive = |res: Res<!>| {
if let Res::Def(DefKind::Mod, def_id) = res {
let attrs = tcx.get_attrs(def_id);
let mut prim = None;
hir::ItemKind::Use(ref path, hir::UseKind::Single)
if item.vis.node.is_pub() =>
{
- as_primitive(path.res).map(|(_, prim)| {
+ as_primitive(path.res.expect_non_local()).map(|(_, prim)| {
// Pretend the primitive is local.
(id.def_id.to_def_id(), prim)
})
.map_or(&[][..], |v| v.as_slice())
.iter()
.filter_map(|ItemLink { link: s, link_text, did, ref fragment }| {
- match did {
- Some(did) => {
- if let Ok((mut href, ..)) = href(did.clone(), cx) {
- if let Some(ref fragment) = *fragment {
- href.push('#');
- href.push_str(fragment);
- }
- Some(RenderedLink {
- original_text: s.clone(),
- new_text: link_text.clone(),
- href,
- })
- } else {
- None
- }
- }
- // FIXME(83083): using fragments as a side-channel for
- // primitive names is very unfortunate
- None => {
- let relative_to = &cx.current;
- if let Some(ref fragment) = *fragment {
- let url = match cx.cache().extern_locations.get(&self.def_id.krate()) {
- Some(&ExternalLocation::Local) => {
- if relative_to[0] == "std" {
- let depth = relative_to.len() - 1;
- "../".repeat(depth)
- } else {
- let depth = relative_to.len();
- format!("{}std/", "../".repeat(depth))
- }
- }
- Some(ExternalLocation::Remote(ref s)) => {
- format!("{}/std/", s.trim_end_matches('/'))
- }
- Some(ExternalLocation::Unknown) | None => {
- format!("{}/std/", crate::DOC_RUST_LANG_ORG_CHANNEL)
- }
- };
- // This is a primitive so the url is done "by hand".
- let tail = fragment.find('#').unwrap_or_else(|| fragment.len());
- Some(RenderedLink {
- original_text: s.clone(),
- new_text: link_text.clone(),
- href: format!(
- "{}primitive.{}.html{}",
- url,
- &fragment[..tail],
- &fragment[tail..]
- ),
- })
- } else {
- panic!("This isn't a primitive?!");
- }
+ debug!(?did);
+ if let Ok((mut href, ..)) = href(*did, cx) {
+ debug!(?href);
+ if let Some(ref fragment) = *fragment {
+ href.push('#');
+ href.push_str(fragment);
}
+ Some(RenderedLink {
+ original_text: s.clone(),
+ new_text: link_text.clone(),
+ href,
+ })
+ } else {
+ None
}
})
.collect()
.get(&self.def_id)
.map_or(&[][..], |v| v.as_slice())
.iter()
- .filter_map(|ItemLink { link: s, link_text, did, fragment }| {
- // FIXME(83083): using fragments as a side-channel for
- // primitive names is very unfortunate
- if did.is_some() || fragment.is_some() {
- Some(RenderedLink {
- original_text: s.clone(),
- new_text: link_text.clone(),
- href: String::new(),
- })
- } else {
- None
- }
+ .map(|ItemLink { link: s, link_text, .. }| RenderedLink {
+ original_text: s.clone(),
+ new_text: link_text.clone(),
+ href: String::new(),
})
.collect()
}
crate other_attrs: Vec<ast::Attribute>,
}
-#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
+#[derive(Clone, Debug, PartialEq, Eq, Hash)]
/// A link that has not yet been rendered.
///
/// This link will be turned into a rendered link by [`Item::links`].
/// This may not be the same as `link` if there was a disambiguator
/// in an intra-doc link (e.g. \[`fn@f`\])
pub(crate) link_text: String,
- pub(crate) did: Option<DefId>,
+ pub(crate) did: DefId,
/// The url fragment to append to the link
pub(crate) fragment: Option<String>,
}
crate fn maybe_sized(cx: &mut DocContext<'_>) -> GenericBound {
let did = cx.tcx.require_lang_item(LangItem::Sized, None);
let empty = cx.tcx.intern_substs(&[]);
- let path = external_path(cx, cx.tcx.item_name(did), Some(did), false, vec![], empty);
+ let path = external_path(cx, did, false, vec![], empty);
inline::record_extern_fqn(cx, did, ItemType::Trait);
GenericBound::TraitBound(
PolyTrait {
Never => sym::never,
}
}
+
+ /// Returns the DefId of the module with `doc(primitive)` for this primitive type.
+ /// Panics if there is no such module.
+ ///
+ /// This gives precedence to primitives defined in the current crate, and deprioritizes primitives defined in `core`,
+ /// but otherwise, if multiple crates define the same primitive, there is no guarantee of which will be picked.
+ /// In particular, if a crate depends on both `std` and another crate that also defines `doc(primitive)`, then
+ /// it's entirely random whether `std` or the other crate is picked. (no_std crates are usually fine unless multiple dependencies define a primitive.)
+ crate fn primitive_locations(tcx: TyCtxt<'_>) -> &FxHashMap<PrimitiveType, DefId> {
+ static PRIMITIVE_LOCATIONS: OnceCell<FxHashMap<PrimitiveType, DefId>> = OnceCell::new();
+ PRIMITIVE_LOCATIONS.get_or_init(|| {
+ let mut primitive_locations = FxHashMap::default();
+ // NOTE: technically this misses crates that are only passed with `--extern` and not loaded when checking the crate.
+ // This is a degenerate case that I don't plan to support.
+ for &crate_num in tcx.crates(()) {
+ let e = ExternalCrate { crate_num };
+ let crate_name = e.name(tcx);
+ debug!(?crate_num, ?crate_name);
+ for &(def_id, prim) in &e.primitives(tcx) {
+ // HACK: try to link to std instead where possible
+ if crate_name == sym::core && primitive_locations.contains_key(&prim) {
+ continue;
+ }
+ primitive_locations.insert(prim, def_id);
+ }
+ }
+ let local_primitives = ExternalCrate { crate_num: LOCAL_CRATE }.primitives(tcx);
+ for (def_id, prim) in local_primitives {
+ primitive_locations.insert(prim, def_id);
+ }
+ primitive_locations
+ })
+ }
}
impl From<ast::IntTy> for PrimitiveType {
#[derive(Clone, Debug)]
crate struct Macro {
crate source: String,
- crate imported_from: Option<Symbol>,
}
#[derive(Clone, Debug)]
let krate = cx.tcx.hir().krate();
let module = crate::visit_ast::RustdocVisitor::new(cx).visit(krate);
- cx.cache.deref_trait_did = cx.tcx.lang_items().deref_trait();
- cx.cache.deref_mut_trait_did = cx.tcx.lang_items().deref_mut_trait();
- cx.cache.owned_box_did = cx.tcx.lang_items().owned_box();
-
let mut externs = Vec::new();
for &cnum in cx.tcx.crates(()).iter() {
externs.push(ExternalCrate { crate_num: cnum });
fn external_generic_args(
cx: &mut DocContext<'_>,
- trait_did: Option<DefId>,
+ did: DefId,
has_self: bool,
bindings: Vec<TypeBinding>,
substs: SubstsRef<'_>,
})
.collect();
- match trait_did {
- // Attempt to sugar an external path like Fn<(A, B,), C> to Fn(A, B) -> C
- Some(did) if cx.tcx.fn_trait_kind_from_lang_item(did).is_some() => {
- assert!(ty_kind.is_some());
- let inputs = match ty_kind {
- Some(ty::Tuple(ref tys)) => tys.iter().map(|t| t.expect_ty().clean(cx)).collect(),
- _ => return GenericArgs::AngleBracketed { args, bindings },
- };
- let output = None;
- // FIXME(#20299) return type comes from a projection now
- // match types[1].kind {
- // ty::Tuple(ref v) if v.is_empty() => None, // -> ()
- // _ => Some(types[1].clean(cx))
- // };
- GenericArgs::Parenthesized { inputs, output }
- }
- _ => GenericArgs::AngleBracketed { args, bindings },
+ if cx.tcx.fn_trait_kind_from_lang_item(did).is_some() {
+ let inputs = match ty_kind.unwrap() {
+ ty::Tuple(tys) => tys.iter().map(|t| t.expect_ty().clean(cx)).collect(),
+ _ => return GenericArgs::AngleBracketed { args, bindings },
+ };
+ let output = None;
+ // FIXME(#20299) return type comes from a projection now
+ // match types[1].kind {
+ // ty::Tuple(ref v) if v.is_empty() => None, // -> ()
+ // _ => Some(types[1].clean(cx))
+ // };
+ GenericArgs::Parenthesized { inputs, output }
+ } else {
+ GenericArgs::AngleBracketed { args, bindings }
}
}
-// trait_did should be set to a trait's DefId if called on a TraitRef, in order to sugar
-// from Fn<(A, B,), C> to Fn(A, B) -> C
pub(super) fn external_path(
cx: &mut DocContext<'_>,
- name: Symbol,
- trait_did: Option<DefId>,
+ did: DefId,
has_self: bool,
bindings: Vec<TypeBinding>,
substs: SubstsRef<'_>,
) -> Path {
+ let def_kind = cx.tcx.def_kind(did);
+ let name = cx.tcx.item_name(did);
Path {
global: false,
- res: Res::Err,
+ res: Res::Def(def_kind, did),
segments: vec![PathSegment {
name,
- args: external_generic_args(cx, trait_did, has_self, bindings, substs),
+ args: external_generic_args(cx, did, has_self, bindings, substs),
}],
}
}
}
/// Given a type Path, resolve it to a Type using the TyCtxt
-crate fn resolve_type(cx: &mut DocContext<'_>, path: Path, id: hir::HirId) -> Type {
- debug!("resolve_type({:?},{:?})", path, id);
+crate fn resolve_type(cx: &mut DocContext<'_>, path: Path) -> Type {
+ debug!("resolve_type({:?})", path);
let is_generic = match path.res {
Res::PrimTy(p) => return Primitive(PrimitiveType::from(p)),
return Generic(kw::SelfUpper);
}
Res::Def(DefKind::TyParam, _) if path.segments.len() == 1 => {
- return Generic(Symbol::intern(&path.whole_name()));
+ return Generic(path.segments[0].name);
}
Res::SelfTy(..) | Res::Def(DefKind::TyParam | DefKind::AssocTy, _) => true,
_ => false,
crate manual_passes: Vec<String>,
/// Whether to display warnings during doc generation or while gathering doctests. By default,
/// all non-rustdoc-specific lints are allowed when generating docs.
- crate display_warnings: bool,
+ crate display_doctest_warnings: bool,
/// Whether to run the `calculate-doc-coverage` pass, which counts the number of public items
/// with and without documentation.
crate show_coverage: bool,
.field("persist_doctests", &self.persist_doctests)
.field("default_passes", &self.default_passes)
.field("manual_passes", &self.manual_passes)
- .field("display_warnings", &self.display_warnings)
+ .field("display_doctest_warnings", &self.display_doctest_warnings)
.field("show_coverage", &self.show_coverage)
.field("crate_version", &self.crate_version)
.field("render_options", &self.render_options)
let proc_macro_crate = crate_types.contains(&CrateType::ProcMacro);
let playground_url = matches.opt_str("playground-url");
let maybe_sysroot = matches.opt_str("sysroot").map(PathBuf::from);
- let display_warnings = matches.opt_present("display-warnings");
+ let display_doctest_warnings = matches.opt_present("display-doctest-warnings");
let sort_modules_alphabetically = !matches.opt_present("sort-modules-by-appearance");
let resource_suffix = matches.opt_str("resource-suffix").unwrap_or_default();
let enable_minification = !matches.opt_present("disable-minification");
test_args,
default_passes,
manual_passes,
- display_warnings,
+ display_doctest_warnings,
show_coverage,
crate_version,
test_run_directory,
lint_opts,
describe_lints,
lint_cap,
- display_warnings,
..
}: RustdocOptions,
) -> rustc_interface::Config {
maybe_sysroot,
search_paths: libs,
crate_types,
- lint_opts: if !display_warnings { lint_opts } else { vec![] },
+ lint_opts,
lint_cap,
cg: codegen_options,
externs,
crate no_crate_inject: bool,
/// Whether to emit compilation warnings when compiling doctests. Setting this will suppress
/// the default `#![allow(unused)]`.
- crate display_warnings: bool,
+ crate display_doctest_warnings: bool,
/// Additional crate-level attributes to add to doctests.
crate attrs: Vec<String>,
}
maybe_sysroot: options.maybe_sysroot.clone(),
search_paths: options.libs.clone(),
crate_types,
- lint_opts: if !options.display_warnings { lint_opts } else { vec![] },
- lint_cap: Some(options.lint_cap.clone().unwrap_or_else(|| lint::Forbid)),
+ lint_opts: if !options.display_doctest_warnings { lint_opts } else { vec![] },
+ lint_cap: Some(options.lint_cap.unwrap_or_else(|| lint::Forbid)),
cg: options.codegen_options.clone(),
externs: options.externs.clone(),
unstable_features: options.render_options.unstable_features,
};
let test_args = options.test_args.clone();
- let display_warnings = options.display_warnings;
+ let display_doctest_warnings = options.display_doctest_warnings;
let nocapture = options.nocapture;
let externs = options.externs.clone();
let json_unused_externs = options.json_unused_externs;
let crate_attrs = tcx.hir().attrs(CRATE_HIR_ID);
let mut opts = scrape_test_config(crate_attrs);
- opts.display_warnings |= options.display_warnings;
+ opts.display_doctest_warnings |= options.display_doctest_warnings;
let enable_per_target_ignores = options.enable_per_target_ignores;
let mut collector = Collector::new(
tcx.crate_name(LOCAL_CRATE),
Err(ErrorReported) => return Err(ErrorReported),
};
- run_tests(test_args, nocapture, display_warnings, tests);
+ run_tests(test_args, nocapture, display_doctest_warnings, tests);
// Collect and warn about unused externs, but only if we've gotten
// reports for each doctest
crate fn run_tests(
mut test_args: Vec<String>,
nocapture: bool,
- display_warnings: bool,
+ display_doctest_warnings: bool,
tests: Vec<test::TestDescAndFn>,
) {
test_args.insert(0, "rustdoctest".to_string());
if nocapture {
test_args.push("--nocapture".to_string());
}
- test::test_main(&test_args, tests, Some(test::Options::new().display_output(display_warnings)));
+ test::test_main(
+ &test_args,
+ tests,
+ Some(test::Options::new().display_output(display_doctest_warnings)),
+ );
}
// Look for `#![doc(test(no_crate_inject))]`, used by crates in the std facade.
use rustc_ast_pretty::pprust;
let mut opts =
- TestOptions { no_crate_inject: false, display_warnings: false, attrs: Vec::new() };
+ TestOptions { no_crate_inject: false, display_doctest_warnings: false, attrs: Vec::new() };
let test_attrs: Vec<_> = attrs
.iter()
let mut prog = String::new();
let mut supports_color = false;
- if opts.attrs.is_empty() && !opts.display_warnings {
+ if opts.attrs.is_empty() && !opts.display_doctest_warnings {
// If there aren't any attributes supplied by #![doc(test(attr(...)))], then allow some
// lints that are commonly triggered in doctests. The crate-level test attributes are
// commonly used to make tests fail in case they trigger warnings, so having this there in
fn make_test_no_crate_inject() {
// Even if you do use the crate within the test, setting `opts.no_crate_inject` will skip
// adding it anyway.
- let opts = TestOptions { no_crate_inject: true, display_warnings: false, attrs: vec![] };
+ let opts =
+ TestOptions { no_crate_inject: true, display_doctest_warnings: false, attrs: vec![] };
let input = "use asdf::qwop;
assert_eq!(2+2, 4);";
let expected = "#![allow(unused)]
}
#[test]
-fn make_test_display_warnings() {
+fn make_test_display_doctest_warnings() {
// If the user is asking to display doctest warnings, suppress the default `allow(unused)`.
let mut opts = TestOptions::default();
- opts.display_warnings = true;
+ opts.display_doctest_warnings = true;
let input = "assert_eq!(2+2, 4);";
let expected = "fn main() {
assert_eq!(2+2, 4);
use rustc_middle::ty::TyCtxt;
use rustc_span::symbol::sym;
-use crate::clean::{self, GetDefId, ItemId};
+use crate::clean::{self, GetDefId, ItemId, PrimitiveType};
use crate::config::RenderOptions;
use crate::fold::DocFolder;
use crate::formats::item_type::ItemType;
stripped_mod: bool,
crate search_index: Vec<IndexItem>,
- crate deref_trait_did: Option<DefId>,
- crate deref_mut_trait_did: Option<DefId>,
- crate owned_box_did: Option<DefId>,
// In rare case where a structure is defined in one module but implemented
// in another, if the implementing module is parsed before defining module,
self.external_paths.insert(e.def_id(), (vec![name.to_string()], ItemType::Module));
}
- // Cache where all known primitives have their documentation located.
- //
- // Favor linking to as local extern as possible, so iterate all crates in
- // reverse topological order.
- for &e in krate.externs.iter().rev() {
- for &(def_id, prim) in &e.primitives(tcx) {
- self.primitive_locations.insert(prim, def_id);
- }
- }
- for &(def_id, prim) in &krate.primitives {
- self.primitive_locations.insert(prim, def_id);
+ // FIXME: avoid this clone (requires implementing Default manually)
+ self.primitive_locations = PrimitiveType::primitive_locations(tcx).clone();
+ for (prim, &def_id) in &self.primitive_locations {
+ let crate_name = tcx.crate_name(def_id.krate);
+ // Recall that we only allow primitive modules to be at the root-level of the crate.
+ // If that restriction is ever lifted, this will have to include the relative paths instead.
+ self.external_paths.insert(
+ def_id,
+ (vec![crate_name.to_string(), prim.as_sym().to_string()], ItemType::Primitive),
+ );
}
krate = CacheBuilder { tcx, cache: self }.fold_crate(krate);
if shortty == ItemType::Module { fqp } else { &fqp[..fqp.len() - 1] }
}
- if !did.is_local() && !cache.access_levels.is_public(did) && !cache.document_private {
+ if !did.is_local()
+ && !cache.access_levels.is_public(did)
+ && !cache.document_private
+ && !cache.primitive_locations.values().any(|&id| id == did)
+ {
return Err(HrefError::Private);
}
let (fqp, shortty, mut url_parts) = match cache.paths.get(&did) {
Some(&(ref fqp, shortty)) => (fqp, shortty, {
let module_fqp = to_module_fqp(shortty, fqp);
+ debug!(?fqp, ?shortty, ?module_fqp);
href_relative_parts(module_fqp, relative_to)
}),
None => {
url_parts.insert(0, root);
}
}
+ debug!(?url_parts);
let last = &fqp.last().unwrap()[..];
let filename;
match shortty {
use_absolute: bool,
cx: &'cx Context<'_>,
) -> fmt::Result {
- debug!("fmt_type(t = {:?})", t);
+ trace!("fmt_type(t = {:?})", t);
match *t {
clean::Generic(name) => write!(f, "{}", name),
//!
//! Use the `render_with_highlighting` to highlight some rust code.
+use crate::clean::PrimitiveType;
use crate::html::escape::Escape;
use crate::html::render::Context;
.ok()
.map(|(url, _, _)| url)
}
+ LinkFromSrc::Primitive(prim) => format::href_with_root_path(
+ PrimitiveType::primitive_locations(context.tcx())[&prim],
+ context,
+ Some(context_info.root_path),
+ )
+ .ok()
+ .map(|(url, _, _)| url),
}
})
{
mod tests;
/// Options for rendering Markdown in the main body of documentation.
-pub(crate) fn opts() -> Options {
+pub(crate) fn main_body_opts() -> Options {
Options::ENABLE_TABLES
| Options::ENABLE_FOOTNOTES
| Options::ENABLE_STRIKETHROUGH
| Options::ENABLE_SMART_PUNCTUATION
}
-/// A subset of [`opts()`] used for rendering summaries.
+/// Options for rendering Markdown in summaries (e.g., in search results).
pub(crate) fn summary_opts() -> Options {
- Options::ENABLE_STRIKETHROUGH | Options::ENABLE_SMART_PUNCTUATION | Options::ENABLE_TABLES
+ Options::ENABLE_TABLES
+ | Options::ENABLE_FOOTNOTES
+ | Options::ENABLE_STRIKETHROUGH
+ | Options::ENABLE_TASKLISTS
+ | Options::ENABLE_SMART_PUNCTUATION
}
/// When `to_string` is called, this struct will emit the HTML corresponding to
}
}
+/// Wrap HTML tables into `<div>` to prevent having the doc blocks width being too big.
+struct TableWrapper<'a, I: Iterator<Item = Event<'a>>> {
+ inner: I,
+ stored_events: VecDeque<Event<'a>>,
+}
+
+impl<'a, I: Iterator<Item = Event<'a>>> TableWrapper<'a, I> {
+ fn new(iter: I) -> Self {
+ Self { inner: iter, stored_events: VecDeque::new() }
+ }
+}
+
+impl<'a, I: Iterator<Item = Event<'a>>> Iterator for TableWrapper<'a, I> {
+ type Item = Event<'a>;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ if let Some(first) = self.stored_events.pop_front() {
+ return Some(first);
+ }
+
+ let event = self.inner.next()?;
+
+ Some(match event {
+ Event::Start(Tag::Table(t)) => {
+ self.stored_events.push_back(Event::Start(Tag::Table(t)));
+ Event::Html(CowStr::Borrowed("<div>"))
+ }
+ Event::End(Tag::Table(t)) => {
+ self.stored_events.push_back(Event::Html(CowStr::Borrowed("</div>")));
+ Event::End(Tag::Table(t))
+ }
+ e => e,
+ })
+ }
+}
+
type SpannedEvent<'a> = (Event<'a>, Range<usize>);
/// Make headings links with anchor IDs and build up TOC.
}
};
- let p = Parser::new_with_broken_link_callback(md, opts(), Some(&mut replacer));
+ let p = Parser::new_with_broken_link_callback(md, main_body_opts(), Some(&mut replacer));
let p = p.into_offset_iter();
let mut s = String::with_capacity(md.len() * 3 / 2);
let p = HeadingLinks::new(p, None, &mut ids);
let p = Footnotes::new(p);
let p = LinkReplacer::new(p.map(|(ev, _)| ev), links);
+ let p = TableWrapper::new(p);
let p = CodeBlocks::new(p, codes, edition, playground);
html::push_html(&mut s, p);
crate fn into_string(self) -> String {
let MarkdownWithToc(md, mut ids, codes, edition, playground) = self;
- let p = Parser::new_ext(md, opts()).into_offset_iter();
+ let p = Parser::new_ext(md, main_body_opts()).into_offset_iter();
let mut s = String::with_capacity(md.len() * 3 / 2);
{
let p = HeadingLinks::new(p, Some(&mut toc), &mut ids);
let p = Footnotes::new(p);
- let p = CodeBlocks::new(p.map(|(ev, _)| ev), codes, edition, playground);
+ let p = TableWrapper::new(p.map(|(ev, _)| ev));
+ let p = CodeBlocks::new(p, codes, edition, playground);
html::push_html(&mut s, p);
}
if md.is_empty() {
return String::new();
}
- let p = Parser::new_ext(md, opts()).into_offset_iter();
+ let p = Parser::new_ext(md, main_body_opts()).into_offset_iter();
// Treat inline HTML as plain text.
let p = p.map(|event| match event.0 {
let p = HeadingLinks::new(p, None, &mut ids);
let p = Footnotes::new(p);
- let p = CodeBlocks::new(p.map(|(ev, _)| ev), codes, edition, playground);
+ let p = TableWrapper::new(p.map(|(ev, _)| ev));
+ let p = CodeBlocks::new(p, codes, edition, playground);
html::push_html(&mut s, p);
s
}
};
- let p = Parser::new_with_broken_link_callback(md, opts(), Some(&mut replacer));
+ let p = Parser::new_with_broken_link_callback(md, summary_opts(), Some(&mut replacer));
let mut p = LinkReplacer::new(p, link_names);
let mut buf = HtmlWithLimit::new(length_limit);
});
None
};
- let p = Parser::new_with_broken_link_callback(md, opts(), Some(&mut push)).into_offset_iter();
+ let p = Parser::new_with_broken_link_callback(md, main_body_opts(), Some(&mut push))
+ .into_offset_iter();
// There's no need to thread an IdMap through to here because
// the IDs generated aren't going to be emitted anywhere.
return code_blocks;
}
- let mut p = Parser::new_ext(md, opts()).into_offset_iter();
+ let mut p = Parser::new_ext(md, main_body_opts()).into_offset_iter();
while let Some((event, offset)) = p.next() {
if let Event::Start(Tag::CodeBlock(syntax)) = event {
}
// `Context` is cloned a lot, so we don't want the size to grow unexpectedly.
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
rustc_data_structures::static_assert_size!(Context<'_>, 104);
/// Shared mutable state used in [`Context`] and elsewhere.
use rustc_hir::def_id::DefId;
use rustc_hir::Mutability;
use rustc_middle::middle::stability;
+use rustc_middle::ty::TyCtxt;
use rustc_span::symbol::{kw, sym, Symbol};
use serde::ser::SerializeSeq;
use serde::{Serialize, Serializer};
opaque_tys: FxHashSet<ItemEntry>,
statics: FxHashSet<ItemEntry>,
constants: FxHashSet<ItemEntry>,
- keywords: FxHashSet<ItemEntry>,
attributes: FxHashSet<ItemEntry>,
derives: FxHashSet<ItemEntry>,
trait_aliases: FxHashSet<ItemEntry>,
opaque_tys: new_set(100),
statics: new_set(100),
constants: new_set(100),
- keywords: new_set(100),
attributes: new_set(100),
derives: new_set(100),
trait_aliases: new_set(100),
return;
}
if !traits.is_empty() {
- let deref_impl = traits
- .iter()
- .find(|t| t.inner_impl().trait_.def_id_full(cache) == cache.deref_trait_did);
+ let deref_impl = traits.iter().find(|t| {
+ t.inner_impl().trait_.def_id_full(cache) == cx.tcx().lang_items().deref_trait()
+ });
if let Some(impl_) = deref_impl {
- let has_deref_mut = traits
- .iter()
- .any(|t| t.inner_impl().trait_.def_id_full(cache) == cache.deref_mut_trait_did);
+ let has_deref_mut = traits.iter().any(|t| {
+ t.inner_impl().trait_.def_id_full(cache) == cx.tcx().lang_items().deref_mut_trait()
+ });
render_deref_methods(w, cx, impl_, containing_item, has_deref_mut);
}
let (synthetic, concrete): (Vec<&&Impl>, Vec<&&Impl>) =
}
}
-fn should_render_item(item: &clean::Item, deref_mut_: bool, cache: &Cache) -> bool {
+fn should_render_item(item: &clean::Item, deref_mut_: bool, tcx: TyCtxt<'_>) -> bool {
let self_type_opt = match *item.kind {
clean::MethodItem(ref method, _) => method.decl.self_type(),
clean::TyMethodItem(ref method) => method.decl.self_type(),
(mutability == Mutability::Mut, false, false)
}
SelfTy::SelfExplicit(clean::ResolvedPath { did, .. }) => {
- (false, Some(did) == cache.owned_box_did, false)
+ (false, Some(did) == tcx.lang_items().owned_box(), false)
}
SelfTy::SelfValue => (false, false, true),
_ => (false, false, false),
&& match render_mode {
RenderMode::Normal => true,
RenderMode::ForDeref { mut_: deref_mut_ } => {
- should_render_item(&item, deref_mut_, cx.cache())
+ should_render_item(&item, deref_mut_, cx.tcx())
}
};
for_deref: bool,
used_links: &mut FxHashSet<String>,
deref_mut: bool,
- cache: &Cache,
+ tcx: TyCtxt<'_>,
) -> Vec<String> {
i.items
.iter()
.filter_map(|item| match item.name {
Some(ref name) if !name.is_empty() && item.is_method() => {
- if !for_deref || should_render_item(item, deref_mut, cache) {
+ if !for_deref || should_render_item(item, deref_mut, tcx) {
Some(format!(
"<a href=\"#{}\">{}</a>",
get_next_url(used_links, format!("method.{}", name)),
let mut ret = v
.iter()
.filter(|i| i.inner_impl().trait_.is_none())
- .flat_map(move |i| get_methods(i.inner_impl(), false, used_links_bor, false, cache))
+ .flat_map(move |i| {
+ get_methods(i.inner_impl(), false, used_links_bor, false, cx.tcx())
+ })
.collect::<Vec<_>>();
if !ret.is_empty() {
// We want links' order to be reproducible so we don't use unstable sort.
}
if v.iter().any(|i| i.inner_impl().trait_.is_some()) {
- if let Some(impl_) = v
- .iter()
- .filter(|i| i.inner_impl().trait_.is_some())
- .find(|i| i.inner_impl().trait_.def_id_full(cache) == cache.deref_trait_did)
- {
+ if let Some(impl_) = v.iter().filter(|i| i.inner_impl().trait_.is_some()).find(|i| {
+ i.inner_impl().trait_.def_id_full(cache) == cx.tcx().lang_items().deref_trait()
+ }) {
sidebar_deref_methods(cx, out, impl_, v);
}
}
}
}
- let deref_mut = v
- .iter()
- .filter(|i| i.inner_impl().trait_.is_some())
- .any(|i| i.inner_impl().trait_.def_id_full(c) == c.deref_mut_trait_did);
+ let deref_mut = v.iter().filter(|i| i.inner_impl().trait_.is_some()).any(|i| {
+ i.inner_impl().trait_.def_id_full(c) == cx.tcx().lang_items().deref_mut_trait()
+ });
let inner_impl = target
.def_id_full(c)
.or_else(|| {
let mut ret = impls
.iter()
.filter(|i| i.inner_impl().trait_.is_none())
- .flat_map(|i| get_methods(i.inner_impl(), true, &mut used_links, deref_mut, c))
+ .flat_map(|i| {
+ get_methods(i.inner_impl(), true, &mut used_links, deref_mut, cx.tcx())
+ })
.collect::<Vec<_>>();
if !ret.is_empty() {
write!(
debug!("{:?}", indices);
let mut curty = None;
+ // See: https://github.com/rust-lang/rust/issues/88545
+ let item_table_block_size = 900usize;
+ let mut item_table_nth_element = 0usize;
+
for &idx in &indices {
let myitem = &items[idx];
if myitem.is_stripped() {
write!(
w,
"<h2 id=\"{id}\" class=\"section-header\">\
- <a href=\"#{id}\">{name}</a></h2>\n{}",
+ <a href=\"#{id}\">{name}</a>\
+ </h2>\n{}",
ITEM_TABLE_OPEN,
id = cx.derive_id(short.to_owned()),
name = name
);
+ item_table_nth_element = 0;
}
match *myitem.kind {
);
}
}
+
+ item_table_nth_element += 1;
+ if item_table_nth_element > item_table_block_size {
+ w.write_str(ITEM_TABLE_CLOSE);
+ w.write_str(ITEM_TABLE_OPEN);
+ item_table_nth_element = 0;
+ }
}
if curty.is_some() {
}
fn print_tuple_struct_fields(w: &mut Buffer, cx: &Context<'_>, s: &[clean::Item]) {
- for (i, ty) in s
- .iter()
- .map(|f| if let clean::StructFieldItem(ref ty) = *f.kind { ty } else { unreachable!() })
- .enumerate()
- {
+ for (i, ty) in s.iter().enumerate() {
if i > 0 {
w.write_str(", ");
}
- write!(w, "{}", ty.print(cx));
+ match *ty.kind {
+ clean::StrippedItem(box clean::StructFieldItem(_)) => w.write_str("_"),
+ clean::StructFieldItem(ref ty) => write!(w, "{}", ty.print(cx)),
+ _ => unreachable!(),
+ }
}
}
name = variant.name.as_ref().unwrap(),
);
for field in fields {
- use crate::clean::StructFieldItem;
- if let StructFieldItem(ref ty) = *field.kind {
- let id = cx.derive_id(format!(
- "variant.{}.field.{}",
- variant.name.as_ref().unwrap(),
- field.name.as_ref().unwrap()
- ));
- write!(
- w,
- "<span id=\"{id}\" class=\"variant small-section-header\">\
- <a href=\"#{id}\" class=\"anchor field\"></a>\
- <code>{f}: {t}</code>\
- </span>",
- id = id,
- f = field.name.as_ref().unwrap(),
- t = ty.print(cx)
- );
- document(w, cx, field, Some(variant));
+ match *field.kind {
+ clean::StrippedItem(box clean::StructFieldItem(_)) => {}
+ clean::StructFieldItem(ref ty) => {
+ let id = cx.derive_id(format!(
+ "variant.{}.field.{}",
+ variant.name.as_ref().unwrap(),
+ field.name.as_ref().unwrap()
+ ));
+ write!(
+ w,
+ "<span id=\"{id}\" class=\"variant small-section-header\">\
+ <a href=\"#{id}\" class=\"anchor field\"></a>\
+ <code>{f}: {t}</code>\
+ </span>",
+ id = id,
+ f = field.name.as_ref().unwrap(),
+ t = ty.print(cx)
+ );
+ document(w, cx, field, Some(variant));
+ }
+ _ => unreachable!(),
}
}
w.write_str("</div></div>");
-use crate::clean;
+use crate::clean::{self, PrimitiveType};
use crate::html::sources;
use rustc_data_structures::fx::FxHashMap;
crate enum LinkFromSrc {
Local(clean::Span),
External(DefId),
+ Primitive(PrimitiveType),
}
/// This function will do at most two things:
Some(def_id)
}
Res::Local(_) => None,
+ Res::PrimTy(p) => {
+ // FIXME: Doesn't handle "path-like" primitives like arrays or tuples.
+ let span = path_span.unwrap_or(path.span);
+ self.matches.insert(span, LinkFromSrc::Primitive(PrimitiveType::from(p)));
+ return;
+ }
Res::Err => return,
_ => return,
};
if let Some(span) = self.tcx.hir().res_span(path.res) {
- self.matches.insert(
- path_span.unwrap_or_else(|| path.span),
- LinkFromSrc::Local(clean::Span::new(span)),
- );
- } else if let Some(def_id) = info {
self.matches
- .insert(path_span.unwrap_or_else(|| path.span), LinkFromSrc::External(def_id));
+ .insert(path_span.unwrap_or(path.span), LinkFromSrc::Local(clean::Span::new(span)));
+ } else if let Some(def_id) = info {
+ self.matches.insert(path_span.unwrap_or(path.span), LinkFromSrc::External(def_id));
}
}
}
position: relative;
}
+.docblock > * {
+ max-width: 100%;
+ overflow-x: auto;
+}
+
.content .out-of-band {
flex-grow: 0;
text-align: right;
color: #c5c5c5;
}
body.source .example-wrap pre.rust a {
- background: #c5c5c5;
+ background: #333;
}
.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
.get(&item.def_id)
.into_iter()
.flatten()
- .filter_map(|clean::ItemLink { link, did, .. }| {
- did.map(|did| (link.clone(), from_item_id(did.into())))
- })
+ .map(|clean::ItemLink { link, did, .. }| (link.clone(), from_item_id((*did).into())))
.collect();
let docs = item.attrs.collapsed_doc_value();
let attrs = item
"URL",
)
}),
- unstable("display-warnings", |o| {
- o.optflagmulti("", "display-warnings", "to print code warnings when testing doc")
+ unstable("display-doctest-warnings", |o| {
+ o.optflagmulti(
+ "",
+ "display-doctest-warnings",
+ "show warnings that originate in doctests",
+ )
}),
stable("crate-version", |o| {
o.optopt("", "crate-version", "crate version to print into documentation", "VERSION")
.map_err(|err| format!("{}: {}", options.input.display(), err))?;
let mut opts = TestOptions::default();
opts.no_crate_inject = true;
- opts.display_warnings = options.display_warnings;
+ opts.display_doctest_warnings = options.display_doctest_warnings;
let mut collector = Collector::new(
Symbol::intern(&options.input.display().to_string()),
options.clone(),
crate::doctest::run_tests(
options.test_args,
options.nocapture,
- options.display_warnings,
+ options.display_doctest_warnings,
collector.tests,
);
Ok(())
use crate::clean::*;
use crate::core::DocContext;
use crate::fold::DocFolder;
-use crate::html::markdown::opts;
+use crate::html::markdown::main_body_opts;
use core::ops::Range;
use pulldown_cmark::{Event, Parser, Tag};
use regex::Regex;
});
};
- let mut p = Parser::new_ext(&dox, opts()).into_offset_iter();
+ let mut p = Parser::new_ext(&dox, main_body_opts()).into_offset_iter();
while let Some((event, range)) = p.next() {
match event {
use crate::html::markdown::{find_testable_code, ErrorCodes};
use crate::passes::doc_test_lints::{should_have_doc_example, Tests};
use crate::passes::Pass;
+use rustc_hir as hir;
use rustc_lint::builtin::MISSING_DOCS;
use rustc_middle::lint::LintLevelSource;
+use rustc_middle::ty::DefIdTree;
use rustc_session::lint;
use rustc_span::FileName;
use serde::Serialize;
.hir()
.local_def_id_to_hir_id(i.def_id.expect_def_id().expect_local());
let (level, source) = self.ctx.tcx.lint_level_at_node(MISSING_DOCS, hir_id);
+
+ // In case we have:
+ //
+ // ```
+ // enum Foo { Bar(u32) }
+ // // or:
+ // struct Bar(u32);
+ // ```
+ //
+ // there is no need to require documentation on the fields of tuple variants and
+ // tuple structs.
+ let should_be_ignored = i
+ .def_id
+ .as_def_id()
+ .and_then(|def_id| self.ctx.tcx.parent(def_id))
+ .and_then(|def_id| self.ctx.tcx.hir().get_if_local(def_id))
+ .map(|node| {
+ matches!(
+ node,
+ hir::Node::Variant(hir::Variant {
+ data: hir::VariantData::Tuple(_, _),
+ ..
+ }) | hir::Node::Item(hir::Item {
+ kind: hir::ItemKind::Struct(hir::VariantData::Tuple(_, _), _),
+ ..
+ })
+ )
+ })
+ .unwrap_or(false);
+
// `missing_docs` is allow-by-default, so don't treat this as ignoring the item
- // unless the user had an explicit `allow`
- let should_have_docs =
- level != lint::Level::Allow || matches!(source, LintLevelSource::Default);
+ // unless the user had an explicit `allow`.
+ //
+ let should_have_docs = !should_be_ignored
+ && (level != lint::Level::Allow || matches!(source, LintLevelSource::Default));
+
debug!("counting {:?} {:?} in {:?}", i.type_(), i.name, filename);
self.items.entry(filename).or_default().count_item(
has_docs,
);
} else if empty_block {
diag.span_suggestion(
- sp.from_inner(InnerSpan::new(0, 3)),
+ sp.from_inner(InnerSpan::new(0, 3)).shrink_to_hi(),
explanation,
- String::from("```text"),
+ String::from("text"),
Applicability::MachineApplicable,
);
}
};
use rustc_hir::def_id::{CrateNum, DefId};
use rustc_middle::ty::TyCtxt;
-use rustc_middle::{bug, ty};
+use rustc_middle::{bug, span_bug, ty};
use rustc_resolve::ParentScope;
use rustc_session::lint::Lint;
use rustc_span::hygiene::{MacroKind, SyntaxContext};
}
}
- fn def_id(self) -> DefId {
- self.opt_def_id().expect("called def_id() on a primitive")
- }
-
- fn opt_def_id(self) -> Option<DefId> {
+ fn def_id(self, tcx: TyCtxt<'_>) -> DefId {
match self {
- Res::Def(_, id) => Some(id),
- Res::Primitive(_) => None,
+ Res::Def(_, id) => id,
+ Res::Primitive(prim) => *PrimitiveType::primitive_locations(tcx).get(&prim).unwrap(),
}
}
/// link, Rustdoc disallows having a user-specified anchor.
///
/// Most of the time this is fine, because you can just link to the page of
- /// the item if you want to provide your own anchor. For primitives, though,
- /// rustdoc uses the anchor as a side channel to know which page to link to;
- /// it doesn't show up in the generated link. Ideally, rustdoc would remove
- /// this limitation, allowing you to link to subheaders on primitives.
+ /// the item if you want to provide your own anchor.
RustdocAnchorConflict(Res),
}
ty::AssocKind::Const => "associatedconstant",
ty::AssocKind::Type => "associatedtype",
};
- let fragment = format!("{}#{}.{}", prim_ty.as_sym(), out, item_name);
+ let fragment = format!("{}.{}", out, item_name);
(Res::Primitive(prim_ty), fragment, Some((kind.as_def_kind(), item.def_id)))
})
})
return handle_variant(self.cx, res, extra_fragment);
}
// Not a trait item; just return what we found.
- Res::Primitive(ty) => {
- if extra_fragment.is_some() {
- return Err(ErrorKind::AnchorFailure(
- AnchorFailure::RustdocAnchorConflict(res),
- ));
- }
- return Ok((res, Some(ty.as_sym().to_string())));
- }
_ => return Ok((res, extra_fragment.clone())),
}
}
let (res, fragment, side_channel) =
self.resolve_associated_item(ty_res, item_name, ns, module_id)?;
let result = if extra_fragment.is_some() {
+ // NOTE: can never be a primitive since `side_channel.is_none()` only when `res`
+ // is a trait (and the side channel DefId is always an associated item).
let diag_res = side_channel.map_or(res, |(k, r)| Res::Def(k, r));
Err(ErrorKind::AnchorFailure(AnchorFailure::RustdocAnchorConflict(diag_res)))
} else {
module_id = DefId { krate, index: CRATE_DEF_INDEX };
}
- let (mut res, mut fragment) = self.resolve_with_disambiguator_cached(
+ let (mut res, fragment) = self.resolve_with_disambiguator_cached(
ResolutionInfo {
module_id,
dis: disambiguator,
if let Some(prim) = resolve_primitive(path_str, TypeNS) {
// `prim@char`
if matches!(disambiguator, Some(Disambiguator::Primitive)) {
- if fragment.is_some() {
- anchor_failure(
- self.cx,
- diag_info,
- AnchorFailure::RustdocAnchorConflict(prim),
- );
- return None;
- }
res = prim;
- fragment = Some(prim.name(self.cx.tcx).to_string());
} else {
// `[char]` when a `char` module is in scope
let candidates = vec![res, prim];
}
}
- Some(ItemLink { link: ori_link.link, link_text, did: None, fragment })
+ Some(ItemLink {
+ link: ori_link.link,
+ link_text,
+ did: res.def_id(self.cx.tcx),
+ fragment,
+ })
}
Res::Def(kind, id) => {
verify(kind, id)?;
let id = clean::register_res(self.cx, rustc_hir::def::Res::Def(kind, id));
- Some(ItemLink { link: ori_link.link, link_text, did: Some(id), fragment })
+ Some(ItemLink { link: ori_link.link, link_text, did: id, fragment })
}
}
}
if let Some(ref cached) = self.visited_links.get(&key) {
match cached {
Some(cached) => {
- self.kind_side_channel.set(cached.side_channel.clone());
+ self.kind_side_channel.set(cached.side_channel);
return Some(cached.res.clone());
}
None if cache_resolution_failure => return None,
diag.span_label(sp, "invalid anchor");
}
if let AnchorFailure::RustdocAnchorConflict(Res::Primitive(_)) = failure {
- diag.note("this restriction may be lifted in a future release");
- diag.note("see https://github.com/rust-lang/rust/issues/83083 for more information");
+ if let Some(sp) = sp {
+ span_bug!(sp, "anchors should be allowed now");
+ } else {
+ bug!("anchors should be allowed now");
+ }
}
});
}
use rustc_middle::ty::DefIdTree;
if extra_fragment.is_some() {
+ // NOTE: `res` can never be a primitive since this function is only called when `tcx.def_kind(res) == DefKind::Variant`.
return Err(ErrorKind::AnchorFailure(AnchorFailure::RustdocAnchorConflict(res)));
}
cx.tcx
- .parent(res.def_id())
+ .parent(res.def_id(cx.tcx))
.map(|parent| {
let parent_def = Res::Def(DefKind::Enum, parent);
let variant = cx.tcx.expect_variant_res(res.as_hir_res().unwrap());
use crate::fold::DocFolder;
use crate::html::markdown::{find_testable_code, ErrorCodes, Ignore, LangString};
use crate::visit_ast::inherits_doc_hidden;
+use rustc_hir as hir;
use rustc_middle::lint::LintLevelSource;
use rustc_session::lint;
use rustc_span::symbol::sym;
| clean::ImportItem(_)
| clean::PrimitiveItem(_)
| clean::KeywordItem(_)
+ // check for trait impl
+ | clean::ImplItem(clean::Impl { trait_: Some(_), .. })
)
{
return false;
}
+
// The `expect_def_id()` should be okay because `local_def_id_to_hir_id`
// would presumably panic if a fake `DefIndex` were passed.
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(item.def_id.expect_def_id().expect_local());
+
+ // check if parent is trait impl
+ if let Some(parent_hir_id) = cx.tcx.hir().find_parent_node(hir_id) {
+ if let Some(parent_node) = cx.tcx.hir().find(parent_hir_id) {
+ if matches!(
+ parent_node,
+ hir::Node::Item(hir::Item {
+ kind: hir::ItemKind::Impl(hir::Impl { of_trait: Some(_), .. }),
+ ..
+ })
+ ) {
+ return false;
+ }
+ }
+ }
+
if cx.tcx.hir().attrs(hir_id).lists(sym::doc).has_word(sym::hidden)
|| inherits_doc_hidden(cx.tcx, hir_id)
{
use crate::clean::*;
use crate::core::DocContext;
use crate::fold::DocFolder;
-use crate::html::markdown::opts;
+use crate::html::markdown::main_body_opts;
use core::ops::Range;
use pulldown_cmark::{Event, Parser, Tag};
use std::iter::Peekable;
let mut is_in_comment = None;
let mut in_code_block = false;
- let p = Parser::new_ext(&dox, opts()).into_offset_iter();
+ let p = Parser::new_ext(&dox, main_body_opts()).into_offset_iter();
for (event, range) in p {
match event {
}
}
- fn visit_item(&mut self, res: Res) {
+ fn visit_item(&mut self, res: Res<!>) {
let def_id = res.def_id();
let vis = self.tcx.visibility(def_id);
let inherited_item_level = if vis == Visibility::Public { self.prev_level } else { None };
-Subproject commit ec995b75d71c5f3b9a82fe084259477eb22f74da
+Subproject commit 86c7daa627aefda1371568b948eba21edf720747
"__comment": "Generated by `./x.py run src/tools/bump-stage0`. Run that command again to update the bootstrap compiler.",
"dist_server": "https://static.rust-lang.org",
"compiler": {
- "date": "2021-08-22",
+ "date": "2021-09-08",
"version": "beta"
},
"rustfmt": {
- "date": "2021-08-26",
+ "date": "2021-09-08",
"version": "nightly"
},
"checksums_sha256": {
- "dist/2021-08-22/cargo-beta-aarch64-apple-darwin.tar.gz": "1aae6206b6ee057a53c6863d1aa9246a913bd8cc87945221ffe25a0763198ec9",
- "dist/2021-08-22/cargo-beta-aarch64-apple-darwin.tar.xz": "9bb4026714d46f99077c4ec2ac1f818a059252996077569339a72704a1044cc5",
- "dist/2021-08-22/cargo-beta-aarch64-pc-windows-msvc.tar.gz": "127a066958fe2f67154ae5e5ffdf67e216cd9da5c8ca7f6f5818017ef647eb57",
- "dist/2021-08-22/cargo-beta-aarch64-pc-windows-msvc.tar.xz": "f62459d78c012d129a38f9f05975f784ca59f613cb77f273ac1be992320968ca",
- "dist/2021-08-22/cargo-beta-aarch64-unknown-linux-gnu.tar.gz": "eb0e5765d0d37129a1e70680cb701fc7968baf98a183a25fbe495d5e1818a67c",
- "dist/2021-08-22/cargo-beta-aarch64-unknown-linux-gnu.tar.xz": "8168902da36e32c2b2946ec18d41c4877191e3b5ec95276d85a1453541be8adf",
- "dist/2021-08-22/cargo-beta-aarch64-unknown-linux-musl.tar.gz": "e8a774fd383d0a7a3a1216ebd3a005fe01560002c8a28b89ce7f9a0ac522a07f",
- "dist/2021-08-22/cargo-beta-aarch64-unknown-linux-musl.tar.xz": "da7e246ca883ace9f9006257dd52756395307613f2bc10d86bacfe9b24f861c8",
- "dist/2021-08-22/cargo-beta-arm-unknown-linux-gnueabi.tar.gz": "bc20e1ffe92aeca2a01bab6b1e383dfd7cecde01780bb2369ef5e10ef6e88bc7",
- "dist/2021-08-22/cargo-beta-arm-unknown-linux-gnueabi.tar.xz": "5020ad70b694f18fa19be09d86983a7f396b38d71a65cf061438870d9264de45",
- "dist/2021-08-22/cargo-beta-arm-unknown-linux-gnueabihf.tar.gz": "53792dbfd932874bc7be8cf6683e5fa318afe9e59a3069f1c82279d9b66edcfd",
- "dist/2021-08-22/cargo-beta-arm-unknown-linux-gnueabihf.tar.xz": "cb393c4f0c0b6ef9c921733267192c01935fec55944c770765e3dcc37d9c20a8",
- "dist/2021-08-22/cargo-beta-armv7-unknown-linux-gnueabihf.tar.gz": "96f017458f94370758b2cfa30f787707f548aeb9ca2dd9a52a43b27c73040b82",
- "dist/2021-08-22/cargo-beta-armv7-unknown-linux-gnueabihf.tar.xz": "aa0b966b0ae33dc01714f16b3e511ae1f60da0a1a0e4de32e09cbe7a5e6a67b3",
- "dist/2021-08-22/cargo-beta-i686-pc-windows-gnu.tar.gz": "38f9b818c71bbf607cd0db8e73b539506f42c529fb8a5053860e844914e0ade3",
- "dist/2021-08-22/cargo-beta-i686-pc-windows-gnu.tar.xz": "ddfe1cee4f7d8a451ff5d1eb880c3e9ffa3fa1e59a8c12322e46562e379101de",
- "dist/2021-08-22/cargo-beta-i686-pc-windows-msvc.tar.gz": "33d5d918ae8d35ecc760bf876573a51d62c98a46eb6c60c2e3ba8acba4ce6488",
- "dist/2021-08-22/cargo-beta-i686-pc-windows-msvc.tar.xz": "0424f863ecf6e6d870325539637899720806a4130ffe815c724cdc34d8eb444f",
- "dist/2021-08-22/cargo-beta-i686-unknown-linux-gnu.tar.gz": "d5e71781a82b424b28b90fe08d2ac4d86b37acd476bc36c106222128202a9476",
- "dist/2021-08-22/cargo-beta-i686-unknown-linux-gnu.tar.xz": "65f860c74140318eb5c034a04c85e3eabfb31dfa8d70791d701f15d979d50361",
- "dist/2021-08-22/cargo-beta-mips-unknown-linux-gnu.tar.gz": "034e491668d0f55b1fba9d606c2acb2d7d1d00db528f141207202ec6e5ca4410",
- "dist/2021-08-22/cargo-beta-mips-unknown-linux-gnu.tar.xz": "f320d08c2116bcf1646f141426785e2b27488e48cf7e0ab97dab39efa4668efd",
- "dist/2021-08-22/cargo-beta-mips64-unknown-linux-gnuabi64.tar.gz": "8bcb363d7dd7656bdeb5525df048dea384b34d564c98e3374c8c82f037e5074d",
- "dist/2021-08-22/cargo-beta-mips64-unknown-linux-gnuabi64.tar.xz": "bbb924b505c82fef0d8912deb95b312d6547f96d15ff7cb06c5d77ee56c6fbbb",
- "dist/2021-08-22/cargo-beta-mips64el-unknown-linux-gnuabi64.tar.gz": "056e1662756321e884b84e662b9e465d58187f1fd9227ae4d7a9fce0110ddfb8",
- "dist/2021-08-22/cargo-beta-mips64el-unknown-linux-gnuabi64.tar.xz": "c01a661eee4e2ab0c93cc6575f8ae56c16b79bd0d5479d9f918004cf8a8abc2b",
- "dist/2021-08-22/cargo-beta-mipsel-unknown-linux-gnu.tar.gz": "b74739855529627407a72244de3efd706ed99c347061513a677ebc7fd3b4e7c1",
- "dist/2021-08-22/cargo-beta-mipsel-unknown-linux-gnu.tar.xz": "a275d7e95312e868636aa1539de0b2f490973119ffb4863f5534eed395c4113e",
- "dist/2021-08-22/cargo-beta-powerpc-unknown-linux-gnu.tar.gz": "4f6326173b50952d933b02cc477156d5aad067798b347ce502889e607e98c84c",
- "dist/2021-08-22/cargo-beta-powerpc-unknown-linux-gnu.tar.xz": "86ffca7848946079b62f083a92e47440a431b5c451aca3600efc0a5f3939ba2f",
- "dist/2021-08-22/cargo-beta-powerpc64-unknown-linux-gnu.tar.gz": "9c9406fcb15e88f93a23d0a275e44559e33b4a2eeab4403cbb2184bdca36318e",
- "dist/2021-08-22/cargo-beta-powerpc64-unknown-linux-gnu.tar.xz": "99ca6df78a1dfcb0c9a919f0eec47783f95399bae39271a6367c07b8ef346a5a",
- "dist/2021-08-22/cargo-beta-powerpc64le-unknown-linux-gnu.tar.gz": "c24493b3e919ec268aa4b98da0a66332fa4e104210ed15b8f6c3b8c240ebeffe",
- "dist/2021-08-22/cargo-beta-powerpc64le-unknown-linux-gnu.tar.xz": "7cfec0a0bae8471a32385a7c19d1ec17dba25ab1d6211cd062df73a9a1c030a2",
- "dist/2021-08-22/cargo-beta-riscv64gc-unknown-linux-gnu.tar.gz": "8a8d81661cc1789185be6d4c13ac2ee602194a5526467ab34e4f23243cb9f474",
- "dist/2021-08-22/cargo-beta-riscv64gc-unknown-linux-gnu.tar.xz": "b8ada6046b5351a627ae1fb4ee8ba059fa551f1de4444aba1d1915a27371d339",
- "dist/2021-08-22/cargo-beta-s390x-unknown-linux-gnu.tar.gz": "946d2d77ec784019f18372610ff438321e22f7e0d2e0045cc71180f3b2f6d376",
- "dist/2021-08-22/cargo-beta-s390x-unknown-linux-gnu.tar.xz": "2f3756d68b354341f98a3cfa4c89d78bf6e8c631dfb6477fceec5e6b00833d30",
- "dist/2021-08-22/cargo-beta-x86_64-apple-darwin.tar.gz": "bccb3002b5cc3556555bb05208b7d64b9aee3a7dc3b482c03090ad0102c22570",
- "dist/2021-08-22/cargo-beta-x86_64-apple-darwin.tar.xz": "a0f7dbfb008cb12bc7a8c9f464715e5aedfae175fdf5bb7bdf3d971072cd9b54",
- "dist/2021-08-22/cargo-beta-x86_64-pc-windows-gnu.tar.gz": "26fcc16d533e427eeded47f8c088aaa180602f68043f5dcd84755ac2166f16af",
- "dist/2021-08-22/cargo-beta-x86_64-pc-windows-gnu.tar.xz": "d5bc7bc9f2d5d2bbe7167f810b1334a86ddd694d111e145223474f8d6dee00af",
- "dist/2021-08-22/cargo-beta-x86_64-pc-windows-msvc.tar.gz": "6f3fe7f685324ff07995e5fb453462a1c4b5dac9208cd23935f6435af9146692",
- "dist/2021-08-22/cargo-beta-x86_64-pc-windows-msvc.tar.xz": "86e37578645f4436b7889c3b9c110888a2aff7af2833a7f5f38fa345a6f36e76",
- "dist/2021-08-22/cargo-beta-x86_64-unknown-freebsd.tar.gz": "f0964def1f80732c1a67f0e4258a301ae2ee27d7ea474f70ab44816907a95ec3",
- "dist/2021-08-22/cargo-beta-x86_64-unknown-freebsd.tar.xz": "6a4655c9b902b904b3dd2ca00dd656d0ef99c77e632f6d6ffc615486b4bfa543",
- "dist/2021-08-22/cargo-beta-x86_64-unknown-illumos.tar.gz": "5aeb8db8c2e5afd80378a0aa1572c57ff021fb5dccb1bd914b994f0ca8764667",
- "dist/2021-08-22/cargo-beta-x86_64-unknown-illumos.tar.xz": "0892a93f462e70aee33117de90caaa7b7ef363a27e573602c1d606c0309ae2d9",
- "dist/2021-08-22/cargo-beta-x86_64-unknown-linux-gnu.tar.gz": "e4be5cd72bb220514c73d7da14ff2962dcd74b8602c1724d71538ab11da94132",
- "dist/2021-08-22/cargo-beta-x86_64-unknown-linux-gnu.tar.xz": "0b643ba40ce6dbb270f85f45b2dd4d727051a896099493166cfad05c9be96b1f",
- "dist/2021-08-22/cargo-beta-x86_64-unknown-linux-musl.tar.gz": "998df5339f738815ab7c38b32df00eef09ff0e415a85d2ae2ab1c0836a380906",
- "dist/2021-08-22/cargo-beta-x86_64-unknown-linux-musl.tar.xz": "4ca058f973e2d439e812f839e57920dd9e73a0da9f9bf37889c06f3b1755b07e",
- "dist/2021-08-22/cargo-beta-x86_64-unknown-netbsd.tar.gz": "6511df143067a3c3f6f741540f890f3bca46b11c01cda1c92e1708d0be30ebeb",
- "dist/2021-08-22/cargo-beta-x86_64-unknown-netbsd.tar.xz": "4ebef9830e25fb28e12ea538e17a46cfe0748e6a14cf976048df056ae708b1ea",
- "dist/2021-08-22/rust-std-beta-aarch64-apple-darwin.tar.gz": "6af3a7f720d5a7100683636c387865b3d4e9b5148ca04c1238662b81c8bbde9c",
- "dist/2021-08-22/rust-std-beta-aarch64-apple-darwin.tar.xz": "459e63b66eb8e53e106896c3003183c5ef3803a8dd3d501d50e6d4e03343ad66",
- "dist/2021-08-22/rust-std-beta-aarch64-apple-ios.tar.gz": "95c816378d57b5d7336373f7f53b603dd8a4efcf17634d4e008b6bd896947cac",
- "dist/2021-08-22/rust-std-beta-aarch64-apple-ios.tar.xz": "209caeea6df90996d5239d0900767135bde716387317a10dc348b96aa818a93a",
- "dist/2021-08-22/rust-std-beta-aarch64-fuchsia.tar.gz": "54ec6a313cc523fc568c4879cf36ab90bade8a1ae9c2ee89bafd57c2c9f3f754",
- "dist/2021-08-22/rust-std-beta-aarch64-fuchsia.tar.xz": "82de1d66bf9cf226b80fea722d2828f368cbe75bc5d99a524193b50db6003636",
- "dist/2021-08-22/rust-std-beta-aarch64-linux-android.tar.gz": "1a08cd54ff716d6ef3e53177e31787e8aa00f948054b42f94d791d3d59aa3169",
- "dist/2021-08-22/rust-std-beta-aarch64-linux-android.tar.xz": "32c1b56cc223bab3e7f15de719488c874011dd6be622038ce5b1f7ff03b05c59",
- "dist/2021-08-22/rust-std-beta-aarch64-pc-windows-msvc.tar.gz": "62a85f52db02e9afc659e84ea8bc3c8828f6a9fe4c1b58eecc3cefeb99e2d8ac",
- "dist/2021-08-22/rust-std-beta-aarch64-pc-windows-msvc.tar.xz": "1e6126312252956f5ad887ca5e8271be3cf31ac8d793071f6af8c2adcdd57f00",
- "dist/2021-08-22/rust-std-beta-aarch64-unknown-linux-gnu.tar.gz": "5542b7e2ee1611f0410e2e962796cd7067e483b37730061a4f788f853f31c7c1",
- "dist/2021-08-22/rust-std-beta-aarch64-unknown-linux-gnu.tar.xz": "97f149839149fcff4004260eb119c1213f10a455b37a8256aec977bc04c9e2c0",
- "dist/2021-08-22/rust-std-beta-aarch64-unknown-linux-musl.tar.gz": "48dada900d144fc9a17ff273ab44d9c4c5fb0cfbaae986d6396aaa6c9c5c22d5",
- "dist/2021-08-22/rust-std-beta-aarch64-unknown-linux-musl.tar.xz": "c93b5da1e22138da0a97be32b9498a3ede270253a22a9d9275f610e349438bfb",
- "dist/2021-08-22/rust-std-beta-aarch64-unknown-none-softfloat.tar.gz": "904b39e24f5fe72393f943a5ecb3bfa6e07f3623a0cde911b161558660ee27d9",
- "dist/2021-08-22/rust-std-beta-aarch64-unknown-none-softfloat.tar.xz": "013646fe9e3f640ae820bfccce656c1bc94d0c3856613dbdea8b06574e072ad4",
- "dist/2021-08-22/rust-std-beta-aarch64-unknown-none.tar.gz": "59de57b6902c755a2d92d5aa154452e84c747bc414605cebb367a4a17cf16ae7",
- "dist/2021-08-22/rust-std-beta-aarch64-unknown-none.tar.xz": "9822fd8d21f863018ead909155ed7d931c5a9bb9ac6461c1f19609ad1a206a48",
- "dist/2021-08-22/rust-std-beta-arm-linux-androideabi.tar.gz": "235bc683a244a69b1f36a875a418efb56af6e1f8411dbace6f9cef3ce1191f7d",
- "dist/2021-08-22/rust-std-beta-arm-linux-androideabi.tar.xz": "a2d267e75d64e0bb96c9a8b78bb67db4ba46576edc51955108595c17ff285083",
- "dist/2021-08-22/rust-std-beta-arm-unknown-linux-gnueabi.tar.gz": "cc5d42c65ebc2733017a463c5a4903c681fd923dfa820ed6e420950f6c599ba5",
- "dist/2021-08-22/rust-std-beta-arm-unknown-linux-gnueabi.tar.xz": "1e9b3e5c0025c15f485eee6a39dc20ea62bfa777a820bd524817eeab07878e67",
- "dist/2021-08-22/rust-std-beta-arm-unknown-linux-gnueabihf.tar.gz": "5f298d431d03d56112d2527c889d94296c03fb4187bbe26bd0e2be50bc9207ed",
- "dist/2021-08-22/rust-std-beta-arm-unknown-linux-gnueabihf.tar.xz": "8be37b928562c4f08342b0661077dca25484d9e12e1e48b375fef02f6699fe87",
- "dist/2021-08-22/rust-std-beta-arm-unknown-linux-musleabi.tar.gz": "db7d25058f4f39007495e864a20a398d307f9505721c9f5991db6d7065db50ee",
- "dist/2021-08-22/rust-std-beta-arm-unknown-linux-musleabi.tar.xz": "fc858a2f2b7fe83cd148ee133b952ef8d63a6f39600fb101c7b98d37734484df",
- "dist/2021-08-22/rust-std-beta-arm-unknown-linux-musleabihf.tar.gz": "bc1ab01b0d7783c8cde71c1d4507fbf68330933e86d5b0280426eb9e9103ba38",
- "dist/2021-08-22/rust-std-beta-arm-unknown-linux-musleabihf.tar.xz": "18a1ca7fb88d56832ee5a331c3f3fa38ff2c72ecded3e093f4d6aef5e67e886d",
- "dist/2021-08-22/rust-std-beta-armebv7r-none-eabi.tar.gz": "3eef0c676173ae40e3b1f900627c953955fdea5b3a24401bf69e9d433c9b0996",
- "dist/2021-08-22/rust-std-beta-armebv7r-none-eabi.tar.xz": "58cdd696c46434bc0aea39b562aab818da1644da08bb385047b7b83cfedf9334",
- "dist/2021-08-22/rust-std-beta-armebv7r-none-eabihf.tar.gz": "0035c38e059eac51cf8786bfde6162bb27ee8c642260af40646665902f9e4cc8",
- "dist/2021-08-22/rust-std-beta-armebv7r-none-eabihf.tar.xz": "893d2d56614198da58327881684b1edab0a7d849eb8e3d6ba1705c192c98718e",
- "dist/2021-08-22/rust-std-beta-armv5te-unknown-linux-gnueabi.tar.gz": "489d6080bf6ab3dddfd490cc2c6cd956473389678eafe4b85b88e0ba06dfd73a",
- "dist/2021-08-22/rust-std-beta-armv5te-unknown-linux-gnueabi.tar.xz": "10ed28b9ce5b2d94492034e707a78d18540b096d1439faf5c7370d29c50ea105",
- "dist/2021-08-22/rust-std-beta-armv5te-unknown-linux-musleabi.tar.gz": "febbed115d82f51d8c19b49f89a6fb9f1062826d6283e5877b8327b4b0572671",
- "dist/2021-08-22/rust-std-beta-armv5te-unknown-linux-musleabi.tar.xz": "0f96c9b4bc3464cef4deeec087da38fc39d2cefb1cff7b413aedb8a79f412dc8",
- "dist/2021-08-22/rust-std-beta-armv7-linux-androideabi.tar.gz": "8d407d9ddbe27ac708efb40d12b2292857c49f306afa018fd7df44116ccade3c",
- "dist/2021-08-22/rust-std-beta-armv7-linux-androideabi.tar.xz": "253b5f4613369b4431296b1151b7c4228594889ac69674a0e3ef75438120868a",
- "dist/2021-08-22/rust-std-beta-armv7-unknown-linux-gnueabi.tar.gz": "11e715bf0082733d94a796ed4e123f7ec77aa5fe0e8d037dd513dd69bc230a2e",
- "dist/2021-08-22/rust-std-beta-armv7-unknown-linux-gnueabi.tar.xz": "a2d8a16c08721a406f8132f5deb960b65e38d3235a76b72d5f267b2bddb9ad91",
- "dist/2021-08-22/rust-std-beta-armv7-unknown-linux-gnueabihf.tar.gz": "2351b24b205851ff51e79a228416bb6ea801551050cb791464a0364a56a0133b",
- "dist/2021-08-22/rust-std-beta-armv7-unknown-linux-gnueabihf.tar.xz": "12da6b0947eebc24ae2a279bad6f1a50d26d57c956cb66840b5db6ef266975e4",
- "dist/2021-08-22/rust-std-beta-armv7-unknown-linux-musleabi.tar.gz": "96d333f046236bbfe809a5526e798197e8416442ddaec5e692aa642dd58f3397",
- "dist/2021-08-22/rust-std-beta-armv7-unknown-linux-musleabi.tar.xz": "f2d5832790120cceda3c07cb2dadb4d4e8e30228ffedbf4988a52573382689c1",
- "dist/2021-08-22/rust-std-beta-armv7-unknown-linux-musleabihf.tar.gz": "d71cf49d01b781c55a64b174d4b91906771aeb90e885310576b5d77a068a8961",
- "dist/2021-08-22/rust-std-beta-armv7-unknown-linux-musleabihf.tar.xz": "3e9b5c730f855b690103d44929384738748bdbc312fe5f8bdb9cb3fe1d8dc701",
- "dist/2021-08-22/rust-std-beta-armv7a-none-eabi.tar.gz": "b0464837c6303c85d67ebcf45752ad9c859ea4ff013310c4ae64a2ff318db56b",
- "dist/2021-08-22/rust-std-beta-armv7a-none-eabi.tar.xz": "13aec30cbdfb84483669a5d5a5d2f465f60692e997a6073d5f749c2950fe6a45",
- "dist/2021-08-22/rust-std-beta-armv7r-none-eabi.tar.gz": "4c54b72683f8800f77b60889a8e91fe293a21916f756ab6fbe5f1e39884a11b2",
- "dist/2021-08-22/rust-std-beta-armv7r-none-eabi.tar.xz": "5b917d543bd41f47ac8983cc5f3dfb19515b940eff644c5421f23575d8958e35",
- "dist/2021-08-22/rust-std-beta-armv7r-none-eabihf.tar.gz": "305fce68a56206cffb34b4735fbff367b8d1f3131a043f5cf03de1ede9402323",
- "dist/2021-08-22/rust-std-beta-armv7r-none-eabihf.tar.xz": "511fe782be16d7402519546af50427fc953f599773466668c0133e3d252874ce",
- "dist/2021-08-22/rust-std-beta-asmjs-unknown-emscripten.tar.gz": "31223e26db1d00219cf78e70c096aaec45a5ba2f2835dcb55edcc1e2e83e28b8",
- "dist/2021-08-22/rust-std-beta-asmjs-unknown-emscripten.tar.xz": "2453e08515943e38def4d65c8278f2d25c5b7dfa7883040346c0824abaab9cb0",
- "dist/2021-08-22/rust-std-beta-i586-pc-windows-msvc.tar.gz": "1f22b735b50f2ccbb3ba99a27e4901b2da9d408361ad8ce2710ab61dbb6a8c46",
- "dist/2021-08-22/rust-std-beta-i586-pc-windows-msvc.tar.xz": "e2f31b9933df67a5fdae28f26b38f907fb2607ccfc2a1f2e6b6fd9853eb6eb6a",
- "dist/2021-08-22/rust-std-beta-i586-unknown-linux-gnu.tar.gz": "a3d2d4184376f6d398a3b1bfbab881659408340287d61d7f29d70bb167824427",
- "dist/2021-08-22/rust-std-beta-i586-unknown-linux-gnu.tar.xz": "3803e83360d67e1866d2dada4f62fbf2a04ac3cbc7c347ba4ce97b2e6adf9ced",
- "dist/2021-08-22/rust-std-beta-i586-unknown-linux-musl.tar.gz": "c2890c8ae6c3bb71811867ab953e774161415d454009d9f36a116c86994a9056",
- "dist/2021-08-22/rust-std-beta-i586-unknown-linux-musl.tar.xz": "671191cab9795d52a7ed9762951de46a89988bb22233b6a0b09e85bdc5e5d904",
- "dist/2021-08-22/rust-std-beta-i686-linux-android.tar.gz": "3e83c96f73f5b526e3f20939338e0b51a94898ffcfa3c7d08ef72966e9161f71",
- "dist/2021-08-22/rust-std-beta-i686-linux-android.tar.xz": "8c96f60b63bdcec60ea52cbb3880f2d684b2b96a37b37946a24d893eafb4dc77",
- "dist/2021-08-22/rust-std-beta-i686-pc-windows-gnu.tar.gz": "760e6deb8aec1185b8127bc012794463eefa87dd48a1fb69e6f79ccad45422e5",
- "dist/2021-08-22/rust-std-beta-i686-pc-windows-gnu.tar.xz": "82809e4bf5b89cfad4d8c8770deb5c2bab4ed1f17463a09c728c25684b7d2d72",
- "dist/2021-08-22/rust-std-beta-i686-pc-windows-msvc.tar.gz": "288086c4caf64a38b441937f9d3335b0ef419bb6a2693216b48aefe31c34f7ea",
- "dist/2021-08-22/rust-std-beta-i686-pc-windows-msvc.tar.xz": "06bb31b48abfbfdf4c627d87717987cb0e721100f952e77435c156bd45eb02a3",
- "dist/2021-08-22/rust-std-beta-i686-unknown-freebsd.tar.gz": "589d7aeabc268fb06f3fd7ff37dfff434924fe87fb778ffa366a27ebf815a26c",
- "dist/2021-08-22/rust-std-beta-i686-unknown-freebsd.tar.xz": "b5b7bf0752034c4e79827e2155afbc7b2fd59a5220e8acf9b244023a725f9483",
- "dist/2021-08-22/rust-std-beta-i686-unknown-linux-gnu.tar.gz": "94c9450ad3915dd6367833b59e07b66083d653eaa72b3b486676c3475fcca86e",
- "dist/2021-08-22/rust-std-beta-i686-unknown-linux-gnu.tar.xz": "014e3abef9cbea6008653ba3e85c7cf074add0bbfa71afa90a9f577f014de19c",
- "dist/2021-08-22/rust-std-beta-i686-unknown-linux-musl.tar.gz": "9897bea4ada2d49e055210699a757f59620d8092e9b40c3eba2dd9fde0205309",
- "dist/2021-08-22/rust-std-beta-i686-unknown-linux-musl.tar.xz": "7c53fbd4643e4f9f5e441a79bdbbf8044b3d35d113ca2ce670462433c9299ce4",
- "dist/2021-08-22/rust-std-beta-mips-unknown-linux-gnu.tar.gz": "2d4af2bd5c632de7de1abf556acda7c4897f5475221a7e72d36d70236c90a332",
- "dist/2021-08-22/rust-std-beta-mips-unknown-linux-gnu.tar.xz": "f388bb0bbfa4d505101b6f087205cef9593b29d55d04dc0f08629d23df6f4dd5",
- "dist/2021-08-22/rust-std-beta-mips-unknown-linux-musl.tar.gz": "7a35ebffe2858e68c8585c54d980edfb7fd84b3a78856110871d062f58e4c4d9",
- "dist/2021-08-22/rust-std-beta-mips-unknown-linux-musl.tar.xz": "40ca86dbff7248854b86ae2a4c05efa5e240ae40d88a887a2681aa0c4995fad3",
- "dist/2021-08-22/rust-std-beta-mips64-unknown-linux-gnuabi64.tar.gz": "3d380de1f425c4e022037805b4687567870d84bd06375c26528e5a9529b1f0df",
- "dist/2021-08-22/rust-std-beta-mips64-unknown-linux-gnuabi64.tar.xz": "15f951100779f6535a25f91b58630951376d9191dabb3405b34a78246bd07d6b",
- "dist/2021-08-22/rust-std-beta-mips64-unknown-linux-muslabi64.tar.gz": "d1d2f014a7d0c5b6140d282bf38d5fc4c7a93df0e484d9f893fe3ed25c5cf384",
- "dist/2021-08-22/rust-std-beta-mips64-unknown-linux-muslabi64.tar.xz": "7f96e0ebaa820cf927962b0c0c584b4b96d3fd34e90e281162138937f145fde5",
- "dist/2021-08-22/rust-std-beta-mips64el-unknown-linux-gnuabi64.tar.gz": "e6d8a5e5de7328d045ccc4c6457e82282c7b0a23bc35443f402672d94df088ef",
- "dist/2021-08-22/rust-std-beta-mips64el-unknown-linux-gnuabi64.tar.xz": "d015d566ae58d854de39337ddfc31f29cdbb4e87320e20b0fbcc83912415d11f",
- "dist/2021-08-22/rust-std-beta-mips64el-unknown-linux-muslabi64.tar.gz": "cbbcf7edb5f785d89bc20c287a6dcab69eabbdfff0ed8d9283ea0766d98ccfee",
- "dist/2021-08-22/rust-std-beta-mips64el-unknown-linux-muslabi64.tar.xz": "4b988afc44729564783300cfd47b1ace974bd8eacb52cc553365fdd07b8b38e7",
- "dist/2021-08-22/rust-std-beta-mipsel-unknown-linux-gnu.tar.gz": "674d244f0d536ff053be6384ee9ba9b80db2cc6d9bd840434d26fabdb259d7be",
- "dist/2021-08-22/rust-std-beta-mipsel-unknown-linux-gnu.tar.xz": "07aa043aac39364935f6758e1d2200d6334b719e4b13ad7bcc9e693cfef90e3c",
- "dist/2021-08-22/rust-std-beta-mipsel-unknown-linux-musl.tar.gz": "19aa1bc698c24eb1136de2a8ace0b872a472e9fb5b1c1fbd48d03fa8e3dab00b",
- "dist/2021-08-22/rust-std-beta-mipsel-unknown-linux-musl.tar.xz": "a9db5dfaca379bcb6a2c3bb5c6d6eafe4dace2e814c7edb5fdf6a26595be2538",
- "dist/2021-08-22/rust-std-beta-nvptx64-nvidia-cuda.tar.gz": "ebe482fecfce4ff0ee9dd514b984b9c04565470ecd7a24d94778d51e31107915",
- "dist/2021-08-22/rust-std-beta-nvptx64-nvidia-cuda.tar.xz": "b663ce48f79cf4634d35e8c35f10c2c51d775c906b9c7a46ae6e67d7070e1b21",
- "dist/2021-08-22/rust-std-beta-powerpc-unknown-linux-gnu.tar.gz": "aeb314e2de96b9d7623a8b58d34fb1d290039b1ad63ad91da5052bbcb8569d66",
- "dist/2021-08-22/rust-std-beta-powerpc-unknown-linux-gnu.tar.xz": "87731e0ea78d1478f87c50d770618b7feb6d404ae257704a1a622bbfc4a079cc",
- "dist/2021-08-22/rust-std-beta-powerpc64-unknown-linux-gnu.tar.gz": "5eeea41e13e8941e1a7e29dc649cc34fafad8ef01fdeffb133cf0dad6cc57997",
- "dist/2021-08-22/rust-std-beta-powerpc64-unknown-linux-gnu.tar.xz": "3435ba7a88ad51266a32fdba648f1d4a60a918ad396261a03593a409db028f1b",
- "dist/2021-08-22/rust-std-beta-powerpc64le-unknown-linux-gnu.tar.gz": "d453444ef726401c683042f2d33c70fc078ef79d95d4cbd0f007d41bb8894e2b",
- "dist/2021-08-22/rust-std-beta-powerpc64le-unknown-linux-gnu.tar.xz": "ab83c5f5477bb3a800e2054d345ed48bba162c871788f7b187f875652f9e8163",
- "dist/2021-08-22/rust-std-beta-riscv32i-unknown-none-elf.tar.gz": "d007269d819f76c53e211c8a2871db177c6f910de463f87ae1cc3d3e3f0d42b8",
- "dist/2021-08-22/rust-std-beta-riscv32i-unknown-none-elf.tar.xz": "3bc82447155b9a453abe1788705b61ea41f017048a017d973a41a587b81b4bab",
- "dist/2021-08-22/rust-std-beta-riscv32imac-unknown-none-elf.tar.gz": "5c6b7fb54fa4effd3140848b9f7779b4139971f0666758bff43c8bc93877d962",
- "dist/2021-08-22/rust-std-beta-riscv32imac-unknown-none-elf.tar.xz": "4043a4dca70b44ff5471a3457fbc85218850ab0dd52bbeef87bc629170f07bc3",
- "dist/2021-08-22/rust-std-beta-riscv32imc-unknown-none-elf.tar.gz": "aaa6eee8c67c6c666cca044c75e0049fc982442647528263ac87bfd17bddd0e5",
- "dist/2021-08-22/rust-std-beta-riscv32imc-unknown-none-elf.tar.xz": "ce8633daef8fab199318c26cac981de0a7db1e93a066c05187f4f3165826da6a",
- "dist/2021-08-22/rust-std-beta-riscv64gc-unknown-linux-gnu.tar.gz": "d5323d5b0a8a9c4f7f688449ac4b39b1b0e30ae26fbdb355ab3477c033e86f74",
- "dist/2021-08-22/rust-std-beta-riscv64gc-unknown-linux-gnu.tar.xz": "e4dd4e3b3fef2434ad5b96d7c966576f9d27cca146bb1df3ec0dea92e65d1234",
- "dist/2021-08-22/rust-std-beta-riscv64gc-unknown-none-elf.tar.gz": "ca1e486ed9b37d64c4c1ff4ade719bd4d75ea42d862a53e7ce5106045498618e",
- "dist/2021-08-22/rust-std-beta-riscv64gc-unknown-none-elf.tar.xz": "b07b65d1df2b7147cfcda1aa8c43b64cb0f29290fe9518569969550fd176399e",
- "dist/2021-08-22/rust-std-beta-riscv64imac-unknown-none-elf.tar.gz": "3225c1a028dbff77a73c8209417261689dcffff8c9019bfb81d7c2ddf440999d",
- "dist/2021-08-22/rust-std-beta-riscv64imac-unknown-none-elf.tar.xz": "d219a81bc543d000200f0a11de6db87f5f0b135122150f37782d0e1132669ffc",
- "dist/2021-08-22/rust-std-beta-s390x-unknown-linux-gnu.tar.gz": "92a70667972c1fa0e5963ef189a450f65861d779f2251e10884bc9dac3751e2a",
- "dist/2021-08-22/rust-std-beta-s390x-unknown-linux-gnu.tar.xz": "31405140b78366c182ebcb02632983017409c3c282a2eac6716d410fc2f6d1a4",
- "dist/2021-08-22/rust-std-beta-sparc64-unknown-linux-gnu.tar.gz": "3f6dfab8290bdd2e12f7a4a8ba0e2b58006e0a0096357077cdd1392e94a81bd7",
- "dist/2021-08-22/rust-std-beta-sparc64-unknown-linux-gnu.tar.xz": "327a86e0e83ccaac9ebb5458e48906a5e83ec928fc01939758a50ce46c114334",
- "dist/2021-08-22/rust-std-beta-sparcv9-sun-solaris.tar.gz": "c798402360747dac456746c4fb68de30e702ba6a3a1cea0bd5884546d1c2f714",
- "dist/2021-08-22/rust-std-beta-sparcv9-sun-solaris.tar.xz": "63a9ebcbb4e97cd80c0c97ba6323614cc69a4ff15904e6120aae970a803b3402",
- "dist/2021-08-22/rust-std-beta-thumbv6m-none-eabi.tar.gz": "bf1ae6e7ceeee0b9631d638aa33b29fc064699eebf1da192aed0b7c0a98f6866",
- "dist/2021-08-22/rust-std-beta-thumbv6m-none-eabi.tar.xz": "da183dbff702ab18cf02d34c395c6dc70344b525c0d09bc26a8670b75e6e900a",
- "dist/2021-08-22/rust-std-beta-thumbv7em-none-eabi.tar.gz": "f6c66612b1f500218927504a23eb3df1bd8ff5a6171d576ebb681bb0f426d5c6",
- "dist/2021-08-22/rust-std-beta-thumbv7em-none-eabi.tar.xz": "8364308682a2c6e91b2c7bfacb09dd9a7487c106ae95c489286d13e641ecaaa0",
- "dist/2021-08-22/rust-std-beta-thumbv7em-none-eabihf.tar.gz": "711e05b89ab2cf2cc17aa7beeb5bc2aafcd851606a8dd535230e64bc5d232dea",
- "dist/2021-08-22/rust-std-beta-thumbv7em-none-eabihf.tar.xz": "f444669bde93eae4599db7624f830b031f4d4d116d0344829be3177558a5dfd1",
- "dist/2021-08-22/rust-std-beta-thumbv7m-none-eabi.tar.gz": "9b4699b67763b7c2691a95c69827f6c8ce8847c64e0806b0c3f36f48848a7e4e",
- "dist/2021-08-22/rust-std-beta-thumbv7m-none-eabi.tar.xz": "2c038bc6607b115f817859aae07c495d6d2a1bd4cfe9007f36494b9229a68d86",
- "dist/2021-08-22/rust-std-beta-thumbv7neon-linux-androideabi.tar.gz": "7634d01dfdb18a43bc8a230df711e8254f3bbc214b89844475bfba9eb920a5cf",
- "dist/2021-08-22/rust-std-beta-thumbv7neon-linux-androideabi.tar.xz": "ba0815d8b0d5600cd09148343bcbfa25004b3092bee1ed0e0673fdf8937ebf62",
- "dist/2021-08-22/rust-std-beta-thumbv7neon-unknown-linux-gnueabihf.tar.gz": "823ee6535da426700b0aed6a33201873d8b6611248506e436cdddae92a074a06",
- "dist/2021-08-22/rust-std-beta-thumbv7neon-unknown-linux-gnueabihf.tar.xz": "c4b21b5300959794c811653aa907fd259970b08c41d4ce303384b34783b142cf",
- "dist/2021-08-22/rust-std-beta-thumbv8m.base-none-eabi.tar.gz": "d71ce2ec3eb040244c017dc7bb40342da106d097a579ab69312f1879d5c446c7",
- "dist/2021-08-22/rust-std-beta-thumbv8m.base-none-eabi.tar.xz": "05375174c0d6f9480c5b504ee16823a28d2994bea0eee52242cef25f9d7b766d",
- "dist/2021-08-22/rust-std-beta-thumbv8m.main-none-eabi.tar.gz": "9e9efb15d1718421b5537aca94dbc078d8cf4f1651b0b2e790af5fb0d8592ea4",
- "dist/2021-08-22/rust-std-beta-thumbv8m.main-none-eabi.tar.xz": "d7ffe70ed73bf689c3edcccc1bfc23ba75737f2d0841d471720d23a67b2cd63e",
- "dist/2021-08-22/rust-std-beta-thumbv8m.main-none-eabihf.tar.gz": "704a086e751b96f1249bd295a9dc45f9aeee0d93bf96d2d6fe00ffaf33af3062",
- "dist/2021-08-22/rust-std-beta-thumbv8m.main-none-eabihf.tar.xz": "c7ea8e97a90c4e27f910f8ef1e64885540179dc55ef09e4f5a844bb7ab3d0c9b",
- "dist/2021-08-22/rust-std-beta-wasm32-unknown-emscripten.tar.gz": "2165a0868d21ce1cf10e6360f8384866a985358475cae1bfa74d33d3516db565",
- "dist/2021-08-22/rust-std-beta-wasm32-unknown-emscripten.tar.xz": "6909a1ace7b22fa66b175cbf3de0cc54708f0aa73baa3e2168f3e758698c26c8",
- "dist/2021-08-22/rust-std-beta-wasm32-unknown-unknown.tar.gz": "dd2eb7f4fb9285c11cdbeddaee20a75179a1588486ccbcb7b6e32971790acaf6",
- "dist/2021-08-22/rust-std-beta-wasm32-unknown-unknown.tar.xz": "9e51dc30f624af1410a77b4f77f01868ec141d6288b09827f7e3a313b276f78a",
- "dist/2021-08-22/rust-std-beta-wasm32-wasi.tar.gz": "b29b2748928aaf72aa30117cfd8bd9c6c13a6c7255efe1bcbd6bf535aefb1294",
- "dist/2021-08-22/rust-std-beta-wasm32-wasi.tar.xz": "90f58b108a9538e190fd3ecec97581b95c85ed27ebcbf1f4ef85b4e3248db0f5",
- "dist/2021-08-22/rust-std-beta-x86_64-apple-darwin.tar.gz": "b6549bfeb4ad3de444ff7afce6baaa34ee7468d41480a86072cd3a26e1191de0",
- "dist/2021-08-22/rust-std-beta-x86_64-apple-darwin.tar.xz": "44d77279c9997ebc5f4952fde208de6747f6b95e1887c1ac637f3f5170cda003",
- "dist/2021-08-22/rust-std-beta-x86_64-apple-ios.tar.gz": "3a69d284711c0eab25a73b6d22a3fd92e6741e22a454d0210694c73c2775e6db",
- "dist/2021-08-22/rust-std-beta-x86_64-apple-ios.tar.xz": "08b97affa6264d739eb31925f3d4a2fb0feb32e6b3eff770c580782bea216ca0",
- "dist/2021-08-22/rust-std-beta-x86_64-fortanix-unknown-sgx.tar.gz": "15334ea58e51d1d5f35f15c75a0f941b3648d9bc2acbb57a6c07b788c78aa6d2",
- "dist/2021-08-22/rust-std-beta-x86_64-fortanix-unknown-sgx.tar.xz": "7aad1c1dc41f5713fb9a3414b0cd64b78f3b8cd6bd12a9fe14318cbab5c804aa",
- "dist/2021-08-22/rust-std-beta-x86_64-fuchsia.tar.gz": "48e706203750b335276140b8156c5c74ed48cd36aa7a6f732f7febe3d517da76",
- "dist/2021-08-22/rust-std-beta-x86_64-fuchsia.tar.xz": "d0a14f312a2f91961f955352f6e508cdf5e5ac82be10837843ec7c87ed9d3ff9",
- "dist/2021-08-22/rust-std-beta-x86_64-linux-android.tar.gz": "12a29451878739ba28838a8bf0eda9ab4826457a6ef249644bbe11e3afbde650",
- "dist/2021-08-22/rust-std-beta-x86_64-linux-android.tar.xz": "f2fe871094a8dbd11bf15d9139ca0d630b9fc2c03d1bfed295d1ee01a8484910",
- "dist/2021-08-22/rust-std-beta-x86_64-pc-solaris.tar.gz": "42237c674c4c5f6181da0eaeffc755a08087b87350770fca6a3d707158cd66f4",
- "dist/2021-08-22/rust-std-beta-x86_64-pc-solaris.tar.xz": "167aa8827682e3a6c140a7607ede1c0ca90014634940c228dc538263b6e1ea8d",
- "dist/2021-08-22/rust-std-beta-x86_64-pc-windows-gnu.tar.gz": "7517896917e38d12d3265b0202ea8bd839d8cfd08b9c6b2c6033b5f70d24f049",
- "dist/2021-08-22/rust-std-beta-x86_64-pc-windows-gnu.tar.xz": "902b1a27c034206fd03457a52eb495c2bed5d3f4355e4d94d1dea05746e10df1",
- "dist/2021-08-22/rust-std-beta-x86_64-pc-windows-msvc.tar.gz": "3b2143072753553cc05d40e0684fdbabe6eb8c436588ce2f29ca393f3c5a8609",
- "dist/2021-08-22/rust-std-beta-x86_64-pc-windows-msvc.tar.xz": "47d03efe92f8fcfbdb192565dcf4db4e4c1c301ff4bd8cb15e0ae74c5ee00122",
- "dist/2021-08-22/rust-std-beta-x86_64-sun-solaris.tar.gz": "7394b58442de5d444c1fdaef7d91da57f6bd64a50ccd8be518e2e620e0829036",
- "dist/2021-08-22/rust-std-beta-x86_64-sun-solaris.tar.xz": "4839a52f87ec51bdf0438dfaeb57f3757b481ad47a7e86db9740d3e86e2c261f",
- "dist/2021-08-22/rust-std-beta-x86_64-unknown-freebsd.tar.gz": "a44012100040021f42335ba35be08570c86d72c371783e203fd1a6144d46a6fe",
- "dist/2021-08-22/rust-std-beta-x86_64-unknown-freebsd.tar.xz": "7279b03775bd896709700727d9db6030a05a4cad3842c1b225404bd1545a0ba9",
- "dist/2021-08-22/rust-std-beta-x86_64-unknown-illumos.tar.gz": "ee719a8fc9a6a5ba1d47fc5d95ebdc8f692b473ed22202d3315de1aebcbae374",
- "dist/2021-08-22/rust-std-beta-x86_64-unknown-illumos.tar.xz": "a85f334cf580035472b054383365c6da4509aa85a3901e6d30649c3e6f1af4f9",
- "dist/2021-08-22/rust-std-beta-x86_64-unknown-linux-gnu.tar.gz": "96884f6544e2d51034cac32618e4e35ee0c84467d8a80f635d8073980fed0ce6",
- "dist/2021-08-22/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz": "98f745588c290a0319216d067a60ba3665506111bdcc4a773b5b850f9ac8107a",
- "dist/2021-08-22/rust-std-beta-x86_64-unknown-linux-gnux32.tar.gz": "cb3249e99fd60a57cdab4a529c14eae3d76fc85768ec9cb9186eeafc32f45214",
- "dist/2021-08-22/rust-std-beta-x86_64-unknown-linux-gnux32.tar.xz": "614acd645f9c79eda648236e6f3c028d9bb5482297059bfc93dab9f2e90d1478",
- "dist/2021-08-22/rust-std-beta-x86_64-unknown-linux-musl.tar.gz": "c7988d678d330d31c3e88df27b9c2b482854d0b7f277f8126e2996a9f4180387",
- "dist/2021-08-22/rust-std-beta-x86_64-unknown-linux-musl.tar.xz": "11d16c7f5b64e3d4bcfcad489c2710ca7e3cad12c82221848c51ed839688e02b",
- "dist/2021-08-22/rust-std-beta-x86_64-unknown-netbsd.tar.gz": "45f880920e746f53810fc70526e18ef807e6d4089ef147bed8c53c536624f646",
- "dist/2021-08-22/rust-std-beta-x86_64-unknown-netbsd.tar.xz": "0910b51938eed74ad4af9e07f74ea5648a143fbd142a9cb4fe1bc7f7b7bd6159",
- "dist/2021-08-22/rust-std-beta-x86_64-unknown-redox.tar.gz": "c14fd257005a11026cc3ebf23fb9f2d35a6d99f9136471574d8c0d18fc66e3b7",
- "dist/2021-08-22/rust-std-beta-x86_64-unknown-redox.tar.xz": "9c3438ecac2dfaf827039b506c114bdc06c05a69b81761abfb63f8a227950da7",
- "dist/2021-08-22/rustc-beta-aarch64-apple-darwin.tar.gz": "357bb650d7377610e61a9ff2167a7fd480ca844322849e5dcc80a91edc5fffa5",
- "dist/2021-08-22/rustc-beta-aarch64-apple-darwin.tar.xz": "3f0883cd2c1d1bc31dd89a72711ba6a22a1c455f28dc2d5644e70898614a637a",
- "dist/2021-08-22/rustc-beta-aarch64-pc-windows-msvc.tar.gz": "6366923332e491d21b5f448500fd56673fd21738e6edcbdb21c11fafb00723de",
- "dist/2021-08-22/rustc-beta-aarch64-pc-windows-msvc.tar.xz": "b0e7462540e6c96b373f6aebf6ab58ca4c2cc62627c5c5ec8b135516ce9098f9",
- "dist/2021-08-22/rustc-beta-aarch64-unknown-linux-gnu.tar.gz": "21bdf608d2bc3799206065225410ccbb015a379cbcf79a901e4e9420d1a4feb4",
- "dist/2021-08-22/rustc-beta-aarch64-unknown-linux-gnu.tar.xz": "4b1520615af8f2baad919740716c482cd5ac421bd87e44cde21788e79c996a4c",
- "dist/2021-08-22/rustc-beta-aarch64-unknown-linux-musl.tar.gz": "4aece49879bb274f0170b98941fa220d1ae4f1c4cb33c3fa7ae4146679675d1d",
- "dist/2021-08-22/rustc-beta-aarch64-unknown-linux-musl.tar.xz": "d3c565f7a2a1bcf21849122c1c6fbbf81ce1e8dbaf103e8f5c406b2f35aadde1",
- "dist/2021-08-22/rustc-beta-arm-unknown-linux-gnueabi.tar.gz": "311df5769ba9a2889c1e9a97df6c1bd369224832a80789bae339121138e40513",
- "dist/2021-08-22/rustc-beta-arm-unknown-linux-gnueabi.tar.xz": "e2818874f3f3d873e858e78585e60804971d57e206c023e8a1c82d03cc9ee5b3",
- "dist/2021-08-22/rustc-beta-arm-unknown-linux-gnueabihf.tar.gz": "9bb1e02517abfe3e626812cea2d389b26451db341bd1c56f5c06f90a71936cde",
- "dist/2021-08-22/rustc-beta-arm-unknown-linux-gnueabihf.tar.xz": "fe02b9b389297a781bbdac812ac3526973a221edc2cd7b2be4fcb197e817b148",
- "dist/2021-08-22/rustc-beta-armv7-unknown-linux-gnueabihf.tar.gz": "c6733d130bda448d7801caa215d3f58abd6576119eb764a55c326344fcbbdede",
- "dist/2021-08-22/rustc-beta-armv7-unknown-linux-gnueabihf.tar.xz": "0a553a9821eb076873976bf523c8b1278de367854d6fbca0728bde97768c4ec9",
- "dist/2021-08-22/rustc-beta-i686-pc-windows-gnu.tar.gz": "c5a724275014bf1c244ff6ab878271747097b3f216e5753e3ca65c1714a2456a",
- "dist/2021-08-22/rustc-beta-i686-pc-windows-gnu.tar.xz": "0a6ff560eb1a7d02e48661939bbb940cdb5d988ccacbcbdc0f7fa24890b0d9b2",
- "dist/2021-08-22/rustc-beta-i686-pc-windows-msvc.tar.gz": "da487112240ab21c3b3f9d9816e7b4738022f58ba0e93c0772a8fcbb17ba0573",
- "dist/2021-08-22/rustc-beta-i686-pc-windows-msvc.tar.xz": "944bd6f24ff92a748c804e3deac1994fe03cda4b897be3eb12f21d069add4cdd",
- "dist/2021-08-22/rustc-beta-i686-unknown-linux-gnu.tar.gz": "e986624d0a97155a588c9b95c7470c1b322bbae11f9582ad62d2c914642400d9",
- "dist/2021-08-22/rustc-beta-i686-unknown-linux-gnu.tar.xz": "dbaf95a9b3f6fccab5d59533be35f59b7901b31e61488f85032bd15bfb67eb34",
- "dist/2021-08-22/rustc-beta-mips-unknown-linux-gnu.tar.gz": "374bd970d5cba1b9af4a36250dfea2eaacafd9e6b4b0d4d9165abdd11841d4c3",
- "dist/2021-08-22/rustc-beta-mips-unknown-linux-gnu.tar.xz": "2ddec9e30d15f2e1f05e9a59c739f1be51fc8d836acda395aacfb933826a5637",
- "dist/2021-08-22/rustc-beta-mips64-unknown-linux-gnuabi64.tar.gz": "a21a1c099324517b6da6dfd8f2154b4d32bfe69d3a1f386e1bc5be2c3743b938",
- "dist/2021-08-22/rustc-beta-mips64-unknown-linux-gnuabi64.tar.xz": "b81fa8c2d534386ceb0bb0767c260e340cda7122e23c834afb17097976ff682d",
- "dist/2021-08-22/rustc-beta-mips64el-unknown-linux-gnuabi64.tar.gz": "2822fdb98095c292a4e0b0e6ee3be4e1cc5ffda42dae101b2c6a6c4bb7a1ec4e",
- "dist/2021-08-22/rustc-beta-mips64el-unknown-linux-gnuabi64.tar.xz": "7d40bef08d3f0d097755eae0b26057f579fd40f4968dd9e5cc82c2b9b67d9c0e",
- "dist/2021-08-22/rustc-beta-mipsel-unknown-linux-gnu.tar.gz": "f64962ca9b60013ce98e634ebb5207dac14c7b39aca5de37db8a6b3debad7250",
- "dist/2021-08-22/rustc-beta-mipsel-unknown-linux-gnu.tar.xz": "a3f8dfb574b3af0ac48011cc7ec69d9f3e89a1994a475c3c6920b0a110db141c",
- "dist/2021-08-22/rustc-beta-powerpc-unknown-linux-gnu.tar.gz": "6dcce24fa93e66b69495df2d8e9aee15bbba263945fa3dea5cdb1d2c499c9744",
- "dist/2021-08-22/rustc-beta-powerpc-unknown-linux-gnu.tar.xz": "038d888fea4ff185329b4ac93066167ec7cfd05a3f23be0a2fae5b8eab51d0ac",
- "dist/2021-08-22/rustc-beta-powerpc64-unknown-linux-gnu.tar.gz": "6a83680ff659d7b9717639d56eb18c230162ee4983ce5ac4aef78b8d9d0829ef",
- "dist/2021-08-22/rustc-beta-powerpc64-unknown-linux-gnu.tar.xz": "43313c88c1950ec36549f023d8e7b6c6cccb9749159115dad5255451c65f98c8",
- "dist/2021-08-22/rustc-beta-powerpc64le-unknown-linux-gnu.tar.gz": "635544e9035d213ac7e3a82d08b445b2a446119511c219c0ad870f185133f76d",
- "dist/2021-08-22/rustc-beta-powerpc64le-unknown-linux-gnu.tar.xz": "e2fca8f43e37ed2d4896df1429e9b806f02b0e8bdd0f136cf16f606eb1ac15e2",
- "dist/2021-08-22/rustc-beta-riscv64gc-unknown-linux-gnu.tar.gz": "ae8bafeb6423cb270b3a2538db07946d35f2514d5d5116ea085a78e4b80596aa",
- "dist/2021-08-22/rustc-beta-riscv64gc-unknown-linux-gnu.tar.xz": "c8abe082666ea792414943eab46d00727acafa97760e799a4d22ec9ff27a810f",
- "dist/2021-08-22/rustc-beta-s390x-unknown-linux-gnu.tar.gz": "b680196dea6eb4bf49afa002e6115645a67c2f7ed6de8ffcc0ace6ed2c193c76",
- "dist/2021-08-22/rustc-beta-s390x-unknown-linux-gnu.tar.xz": "1d3cca881398f45c8ef9db64820cd2afb542b55517c9ea66b71955a31fb7fad1",
- "dist/2021-08-22/rustc-beta-x86_64-apple-darwin.tar.gz": "493431cd41fae24883877615ca83c1a4e94cafa7e6d6f587dfcce9782c36edaa",
- "dist/2021-08-22/rustc-beta-x86_64-apple-darwin.tar.xz": "08b5610cc53cfe64914866b115ca15d184df83cf0c8bb65106380bd875bf62cb",
- "dist/2021-08-22/rustc-beta-x86_64-pc-windows-gnu.tar.gz": "17c0e93976b2a83df5f6baabd67412389550f3694268e5478440c8579efbbd18",
- "dist/2021-08-22/rustc-beta-x86_64-pc-windows-gnu.tar.xz": "0e736cf5ac25a78e611ea89589a8f6f0eda9891646579fe0a0b8853ab210ee19",
- "dist/2021-08-22/rustc-beta-x86_64-pc-windows-msvc.tar.gz": "33f17eb3e95e4b00895c234f5d2d2c9ce19d1d36811bebc3f92bcfeed770a6bf",
- "dist/2021-08-22/rustc-beta-x86_64-pc-windows-msvc.tar.xz": "b26e0adcfeb9b95dce5d39c7d34126a405d9705cf58a6ee560b10eeb274b6ef0",
- "dist/2021-08-22/rustc-beta-x86_64-unknown-freebsd.tar.gz": "27d6e27acb2d060b59e35789b81779f48a520670ad1590cb46b9862a6be74a63",
- "dist/2021-08-22/rustc-beta-x86_64-unknown-freebsd.tar.xz": "39670b9f1865ab74458dded5a9e9f181045c8eb7e7bc82ffc308fcbc5bc26267",
- "dist/2021-08-22/rustc-beta-x86_64-unknown-illumos.tar.gz": "d970bcce7178cc0ddb96de50450da71b236ab56861efd399da03f916ce059685",
- "dist/2021-08-22/rustc-beta-x86_64-unknown-illumos.tar.xz": "6d6bda8752a6b205ca8e155624f671e716e80c78256f052c22dc2e53c379b589",
- "dist/2021-08-22/rustc-beta-x86_64-unknown-linux-gnu.tar.gz": "e667282411745dfa982922d139a26058097250c33e83ca955e75b65c6098f651",
- "dist/2021-08-22/rustc-beta-x86_64-unknown-linux-gnu.tar.xz": "7ed509f918aed5d259479663911427564c066b41487d4550050a9c07096344d9",
- "dist/2021-08-22/rustc-beta-x86_64-unknown-linux-musl.tar.gz": "59b3aac5504deea4daf79d5ee90951c3df5247568419a3605c8895698e7a460c",
- "dist/2021-08-22/rustc-beta-x86_64-unknown-linux-musl.tar.xz": "941f93fd0a542b9aa6b35fe26a5145085cf758c10b185e9892acf52796efe944",
- "dist/2021-08-22/rustc-beta-x86_64-unknown-netbsd.tar.gz": "755987f90f50bbcf9881f62849bfc5749e41d95e5d6b2a35c7fce4218ba3dc60",
- "dist/2021-08-22/rustc-beta-x86_64-unknown-netbsd.tar.xz": "09cead4864a49e750d91438149b74fa4c0d4b923efda40ba638b2ca0d3ad97c6",
- "dist/2021-08-26/rustfmt-nightly-aarch64-apple-darwin.tar.gz": "17e7cb26d7c13cc14d826966a4b93e9c152b46f2d7081038e8d3385ed5d3ba43",
- "dist/2021-08-26/rustfmt-nightly-aarch64-apple-darwin.tar.xz": "85f896275ecef1d491bb8beab54ab13d612d49fb8386b6b61d9121f52fb15e44",
- "dist/2021-08-26/rustfmt-nightly-aarch64-pc-windows-msvc.tar.gz": "e948e456f51a9fb983d36d15352d8e7782051e1fb62a4adad2ae973725aa6091",
- "dist/2021-08-26/rustfmt-nightly-aarch64-pc-windows-msvc.tar.xz": "d21b59cc2c1706e9c14bf1464b17ed5bd51e2d225e1b3ea53c13d90ae34d4a2d",
- "dist/2021-08-26/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.gz": "a51b04fa8b159ac5c80ec1db0518cf589a8530820863870173347941a5d3e0e0",
- "dist/2021-08-26/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.xz": "bbb801bd4ddaeb4d2494039943e8ac746fd41fb625d3c544af2a79587f9e327e",
- "dist/2021-08-26/rustfmt-nightly-aarch64-unknown-linux-musl.tar.gz": "8d94c74ac727b381433ff010d6a5b6576d326c88418afb1ee8a67de5731c1bd9",
- "dist/2021-08-26/rustfmt-nightly-aarch64-unknown-linux-musl.tar.xz": "da44eae518dc561f89c810d4a5f50da38b938e22542193595be615c147973ee9",
- "dist/2021-08-26/rustfmt-nightly-arm-unknown-linux-gnueabi.tar.gz": "11e8422a4b4ab386015c54cf488c40297e6b63006989c40b1e4321a325333433",
- "dist/2021-08-26/rustfmt-nightly-arm-unknown-linux-gnueabi.tar.xz": "b8e835cfd7f32a823ed00d174c4158220b8572c2d76486c60a20cbdad11bb216",
- "dist/2021-08-26/rustfmt-nightly-arm-unknown-linux-gnueabihf.tar.gz": "ff7a412a7923a24cb118979cc772863e6d9844ab6bcc619d9adca6d36b89daf8",
- "dist/2021-08-26/rustfmt-nightly-arm-unknown-linux-gnueabihf.tar.xz": "4fcf56bfbae46ff5cf7c28d787992d5d108231659e447cecbd25035009e0c783",
- "dist/2021-08-26/rustfmt-nightly-armv7-unknown-linux-gnueabihf.tar.gz": "4ae574d1aab0e0c191327fa5ad79a4e9367702ef3fd1655661a8c253bf55b7e3",
- "dist/2021-08-26/rustfmt-nightly-armv7-unknown-linux-gnueabihf.tar.xz": "8786f646813f5ab71f5786efa6cc14e567a9dd1b2532b34d9d85ee900dafe68c",
- "dist/2021-08-26/rustfmt-nightly-i686-pc-windows-gnu.tar.gz": "752fdf667b1f4713b6ad3378a15835902fd7fea200c8d37f28a444dc3616b89d",
- "dist/2021-08-26/rustfmt-nightly-i686-pc-windows-gnu.tar.xz": "43e401e2112120970c4a7e3dacbc5ea631c1816f27db33a28f5b9cc49e4dd5da",
- "dist/2021-08-26/rustfmt-nightly-i686-pc-windows-msvc.tar.gz": "6935d612513b61092b36bae3a2cb11c29e05cd8773c65aa61b4451dab8cb9f43",
- "dist/2021-08-26/rustfmt-nightly-i686-pc-windows-msvc.tar.xz": "326177f9fda4923b010fdbefbb9703aee727b4d2871ffb1cc97321c09fc3ff51",
- "dist/2021-08-26/rustfmt-nightly-i686-unknown-linux-gnu.tar.gz": "875d3d7fc0e1cfda7b029656b27436f2b9d332b3f46988dba1cfbfd8d244cd7e",
- "dist/2021-08-26/rustfmt-nightly-i686-unknown-linux-gnu.tar.xz": "4b3e9d27d256cbbe65c0330d557dbcdd6b6144222936680705f9e74deabe80f0",
- "dist/2021-08-26/rustfmt-nightly-mips-unknown-linux-gnu.tar.gz": "d26a73c2ccaee81d92980a3cca0508abfce7a02f56f25f3bf9c06e6fcf3aa537",
- "dist/2021-08-26/rustfmt-nightly-mips-unknown-linux-gnu.tar.xz": "3f69c9a1161aeb25f03681e43d35388bf75a0e20e086d6e353911aa839fcd294",
- "dist/2021-08-26/rustfmt-nightly-mips64-unknown-linux-gnuabi64.tar.gz": "401fbf935e3b06e185f4426a655f2d38e058409921486758f60363f92bbc8117",
- "dist/2021-08-26/rustfmt-nightly-mips64-unknown-linux-gnuabi64.tar.xz": "325d89dc02f7aea4803539211c45d8044986d55f7d1331a231b5d0c0ecfe5238",
- "dist/2021-08-26/rustfmt-nightly-mips64el-unknown-linux-gnuabi64.tar.gz": "3da7ef60aff98439a1c58d504bc62aac1d2cfa29879a28968c5a61b72e9fa33f",
- "dist/2021-08-26/rustfmt-nightly-mips64el-unknown-linux-gnuabi64.tar.xz": "3aa2757120df94d2660b7e909e4a7d66aa73ca9f9b700231d1f21bdea2b0b5db",
- "dist/2021-08-26/rustfmt-nightly-mipsel-unknown-linux-gnu.tar.gz": "74a28139895365cdffdece9920ba6fd31a982cd5620342fbdd653084621b7726",
- "dist/2021-08-26/rustfmt-nightly-mipsel-unknown-linux-gnu.tar.xz": "7915f9e15b274e938d5e318544322d233434b6554a25ff063181e7f9cc8a8ef9",
- "dist/2021-08-26/rustfmt-nightly-powerpc-unknown-linux-gnu.tar.gz": "3b56ab5ce09e8f90ee80ccfcfdbc30f52309547b5123ef474a78cbbd6ca64dad",
- "dist/2021-08-26/rustfmt-nightly-powerpc-unknown-linux-gnu.tar.xz": "dcb27f9d9f425b81d7ac21025eae60b2e5bbb4cb1e2c21e6970f28e5a574cbb6",
- "dist/2021-08-26/rustfmt-nightly-powerpc64-unknown-linux-gnu.tar.gz": "cb5627d2075b726c4a30b36cdf234371d02f1fe0b545fd50e02b65588b7bbe5f",
- "dist/2021-08-26/rustfmt-nightly-powerpc64-unknown-linux-gnu.tar.xz": "d7d075dc678d545fedfdff220dd6b9b9c91cbf5b58fd9cb486777c596c20c20f",
- "dist/2021-08-26/rustfmt-nightly-powerpc64le-unknown-linux-gnu.tar.gz": "fe6af0046c2a6cc8c66d0d51590c7a725115fe785b06bed555c9c68dfaf9819f",
- "dist/2021-08-26/rustfmt-nightly-powerpc64le-unknown-linux-gnu.tar.xz": "559b98d646138414c3e0878bdc8245db35c17f9e804ccc0935c4f397672debcd",
- "dist/2021-08-26/rustfmt-nightly-riscv64gc-unknown-linux-gnu.tar.gz": "cda6141eff957bf7f7580b093d261d690fd660961722c37b19c390cb4ce85ecf",
- "dist/2021-08-26/rustfmt-nightly-riscv64gc-unknown-linux-gnu.tar.xz": "7c4eaccfd5704b0d6e7dfeb6cd70922625df90391f1e27e48bc75f0e79b3832a",
- "dist/2021-08-26/rustfmt-nightly-s390x-unknown-linux-gnu.tar.gz": "1d16189f4fe2c5d6fb572e279eab121408c1d85d5fecb6a3f25b00ed748b8b14",
- "dist/2021-08-26/rustfmt-nightly-s390x-unknown-linux-gnu.tar.xz": "99be46da8f40418b48261e61a645acd4755c132baf9e2f3a2ca64e853daab9ec",
- "dist/2021-08-26/rustfmt-nightly-x86_64-apple-darwin.tar.gz": "82daf2631178e46d94ce2a2718327c5e17da755397cfcddaff4b9d695aa88f3a",
- "dist/2021-08-26/rustfmt-nightly-x86_64-apple-darwin.tar.xz": "6288c9cbf5e33c59597d990bf99c9536414bb73aa0bcedf1175dab4c6dd9d188",
- "dist/2021-08-26/rustfmt-nightly-x86_64-pc-windows-gnu.tar.gz": "29e13fd9d3eb61ea609bbb55bc5f36df094623f1f1a154d9554212bf4021b8cb",
- "dist/2021-08-26/rustfmt-nightly-x86_64-pc-windows-gnu.tar.xz": "c287a80d6388527213d820c22d723fb9e17018425795f499521e7580ed9f6aed",
- "dist/2021-08-26/rustfmt-nightly-x86_64-pc-windows-msvc.tar.gz": "2eefa9ae776a7760b3111b39e2c732d2303c4aab2e124cfbef2f7dddc32bdc30",
- "dist/2021-08-26/rustfmt-nightly-x86_64-pc-windows-msvc.tar.xz": "a5544207cad0be04393f3a17f8f743340bf468d20a60aa44bbf3b1ea476e54d4",
- "dist/2021-08-26/rustfmt-nightly-x86_64-unknown-freebsd.tar.gz": "b4dfbc422e7b51db45555e6d1b775b214bf633ec6c93303fb7c52e4e25db69e4",
- "dist/2021-08-26/rustfmt-nightly-x86_64-unknown-freebsd.tar.xz": "158c6366adaaaf17d0d40f64a9c8887fc20f1c7600fb31b102fcc3bcbd388221",
- "dist/2021-08-26/rustfmt-nightly-x86_64-unknown-illumos.tar.gz": "6fda2931d41c4c42b5f59df4a789ff3c2082ff65892e1318439aec555834a34e",
- "dist/2021-08-26/rustfmt-nightly-x86_64-unknown-illumos.tar.xz": "25a2823ba3668506fe9bb85c1f51d2406b8654c4197d1dc7d88ee19f35e77756",
- "dist/2021-08-26/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.gz": "2a79c57d33aca5bb6c0cc2497d6853a4df259537ba55acc66460be03c82cc9c0",
- "dist/2021-08-26/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz": "065d95fc9b2d741ba1e8d20b90820a6ad72ce0cb802fd24842aacf01c3a7a589",
- "dist/2021-08-26/rustfmt-nightly-x86_64-unknown-linux-musl.tar.gz": "313ea554f824d0176f44406ed70854736eefe94911182396c896ed454a07e6b8",
- "dist/2021-08-26/rustfmt-nightly-x86_64-unknown-linux-musl.tar.xz": "23cce7c791cc4f49d5240898803b47f393b5f2f064a3273ffd290a8cf97b7591",
- "dist/2021-08-26/rustfmt-nightly-x86_64-unknown-netbsd.tar.gz": "0416a1a4ad3b9c9e1bf7bd67e49f16e7a4011ebd784966f439ac04a87cb4042f",
- "dist/2021-08-26/rustfmt-nightly-x86_64-unknown-netbsd.tar.xz": "64b29ff6dabc46d124ccf08e8fe351a2d46ed527efe98de36d38c0ec59b226cc"
+ "dist/2021-09-08/cargo-beta-aarch64-apple-darwin.tar.gz": "5bc2e21b10c153fd070c1a9b9af8ff68ada71f10953d8261bd8aa5f599878db3",
+ "dist/2021-09-08/cargo-beta-aarch64-apple-darwin.tar.xz": "95082b292ccf8e0fdd637f591dd3180297c48ec13ccbcb3e1a2c115feb17463f",
+ "dist/2021-09-08/cargo-beta-aarch64-pc-windows-msvc.tar.gz": "7de49c4e1db688089dd566647c23233fb4ff21dbb4025a4be37d18b11cc82e2f",
+ "dist/2021-09-08/cargo-beta-aarch64-pc-windows-msvc.tar.xz": "35394e3c08a3dd392958187b091b3bdc576a6bf0d2d139556df21cd3ff1d21cc",
+ "dist/2021-09-08/cargo-beta-aarch64-unknown-linux-gnu.tar.gz": "a71153dde967a7816636dce62ba4334baadad4b926b25dc54c068c5cb293df9a",
+ "dist/2021-09-08/cargo-beta-aarch64-unknown-linux-gnu.tar.xz": "d4e33616af35dd7564a73e702eb6eab7eae5da7a980f518bd3d34f4cf0d05440",
+ "dist/2021-09-08/cargo-beta-aarch64-unknown-linux-musl.tar.gz": "f76545e48977d2ebad75d3cf745d81ca709d59ca02a6c66ee3d049d8ca145463",
+ "dist/2021-09-08/cargo-beta-aarch64-unknown-linux-musl.tar.xz": "79cf346367022c3a1ba58fd134f8189fa7781e702871d56f60dc1fff9d318570",
+ "dist/2021-09-08/cargo-beta-arm-unknown-linux-gnueabi.tar.gz": "7884e6a177a2469f21dee177564e03490fc541e877f0a1858e17162a9037298c",
+ "dist/2021-09-08/cargo-beta-arm-unknown-linux-gnueabi.tar.xz": "6fb307038c827d4e915224bc17709929628bdc5eda625644eaa4df992de75718",
+ "dist/2021-09-08/cargo-beta-arm-unknown-linux-gnueabihf.tar.gz": "a367fc19f65b07cfec4732d3bd13aa662581d9aca886d56c93bad171948c9593",
+ "dist/2021-09-08/cargo-beta-arm-unknown-linux-gnueabihf.tar.xz": "161eabe9fc1a0031f9fb044da4cc4c2cf376c6a018695f9fa1f5d7ce96c742d1",
+ "dist/2021-09-08/cargo-beta-armv7-unknown-linux-gnueabihf.tar.gz": "35587eeb680443f759c6cc9526186d51e35b08683f9c8a112d692324b62afae4",
+ "dist/2021-09-08/cargo-beta-armv7-unknown-linux-gnueabihf.tar.xz": "8fea8765c22e9751379585d381ad14aa0faab811cfaf40dbb55a60c82146b91e",
+ "dist/2021-09-08/cargo-beta-i686-pc-windows-gnu.tar.gz": "9e7e075e79cfca74b1185067962e3b37118ed32c8258d6746f05891f742226cb",
+ "dist/2021-09-08/cargo-beta-i686-pc-windows-gnu.tar.xz": "50f34954765c542076e7a6d9dbaf3a8e8dbfbabfa95bbc76e95eb1fb52e1227a",
+ "dist/2021-09-08/cargo-beta-i686-pc-windows-msvc.tar.gz": "eb93a58581ff485b44013d3623d0f4afb0fc2e3a3c7ff1898b74faad6f7bf48d",
+ "dist/2021-09-08/cargo-beta-i686-pc-windows-msvc.tar.xz": "1913dd2d4b0c56a6e5ec3686fa03eafc716006cc1fcdcfd81cf1b7984b9532b1",
+ "dist/2021-09-08/cargo-beta-i686-unknown-linux-gnu.tar.gz": "04b3f5ca4f4a24a2555c186600f683730a59f807d3525248c1d8f2f674cd00a6",
+ "dist/2021-09-08/cargo-beta-i686-unknown-linux-gnu.tar.xz": "c730e3f619d69d221277f3b44a188746980eb7a0c79dab9a252cea6bc4a1e54b",
+ "dist/2021-09-08/cargo-beta-mips-unknown-linux-gnu.tar.gz": "94fc426e50671c39d7a272b9636ce43bc3242f1b6a302555914127ab73ce6c65",
+ "dist/2021-09-08/cargo-beta-mips-unknown-linux-gnu.tar.xz": "c44957519099e19edfeceed53b99674d9b98731b20ca7494621fb0dcc6488ed5",
+ "dist/2021-09-08/cargo-beta-mips64-unknown-linux-gnuabi64.tar.gz": "377a998bba44a16bb401bf56c4be2e38f1c40e37f71335f93ba8e54d20d7a3c3",
+ "dist/2021-09-08/cargo-beta-mips64-unknown-linux-gnuabi64.tar.xz": "2406c2ac61d9b494b3a6327d991a6846a18c867fc581892874a2e3e83f4d49fe",
+ "dist/2021-09-08/cargo-beta-mips64el-unknown-linux-gnuabi64.tar.gz": "52c7d8009a6ca8701912c9e02c1278dacd2b6c2bdb218416d1e3db2c750b7536",
+ "dist/2021-09-08/cargo-beta-mips64el-unknown-linux-gnuabi64.tar.xz": "764820946adfd6594c7c9c4f97cb06d1c639ae2621ded3059d234a0cef97b1dd",
+ "dist/2021-09-08/cargo-beta-mipsel-unknown-linux-gnu.tar.gz": "d351cbcd87d10d54bde4311d6fc902a655e8c74ffb16b2a85cfb8e5ad30faeda",
+ "dist/2021-09-08/cargo-beta-mipsel-unknown-linux-gnu.tar.xz": "ec7235af6ae25ce30c61d06f94bd398018878b741d8d94edad8e3dbaaad0cc2e",
+ "dist/2021-09-08/cargo-beta-powerpc-unknown-linux-gnu.tar.gz": "11d983f439f46a1b49d72b0e8ec1dd5f78c72c23f305476ce3b56ec20167ccc9",
+ "dist/2021-09-08/cargo-beta-powerpc-unknown-linux-gnu.tar.xz": "327fcdfcc7679178e734293e23e752d44bf1a4c44a88e5b2d89bfa7f95b7876c",
+ "dist/2021-09-08/cargo-beta-powerpc64-unknown-linux-gnu.tar.gz": "52f827f09376c0f21419cbff1e56d30337d140c1c097d5a38d4541f65545d3d2",
+ "dist/2021-09-08/cargo-beta-powerpc64-unknown-linux-gnu.tar.xz": "e9f956aaa4f8428b813d27c43a8602671a27f567d206f769da7b14e5029f5a1f",
+ "dist/2021-09-08/cargo-beta-powerpc64le-unknown-linux-gnu.tar.gz": "b59d4814b99031a9e418fd423833500a3436b65b0696974d1d6a2f7598ecce2d",
+ "dist/2021-09-08/cargo-beta-powerpc64le-unknown-linux-gnu.tar.xz": "5751e2453329e1fe2378cf9e7ade93c75df7a31d4dbeb0f14fde9c3cfbc5d5b1",
+ "dist/2021-09-08/cargo-beta-riscv64gc-unknown-linux-gnu.tar.gz": "a3d97d9efad02108166878a9a30d3485a9f6db0768bbef5c98e86540c6f4901c",
+ "dist/2021-09-08/cargo-beta-riscv64gc-unknown-linux-gnu.tar.xz": "e8c3bf169cdcf9192363c9ace37457a94720d36ff1b607e178796dac933f652f",
+ "dist/2021-09-08/cargo-beta-s390x-unknown-linux-gnu.tar.gz": "51fc38135a45870bd01bbcee4b69f5e7055424b1cfa36d4c0272613baf3185c2",
+ "dist/2021-09-08/cargo-beta-s390x-unknown-linux-gnu.tar.xz": "bc392d660368c856ab1bc96b603699d492f03b226a0d60812a1bb19ca6c05ff3",
+ "dist/2021-09-08/cargo-beta-x86_64-apple-darwin.tar.gz": "ea1804dfe7b806368f278adcb887e4aa023ff7f533bee84541415cb0862ed836",
+ "dist/2021-09-08/cargo-beta-x86_64-apple-darwin.tar.xz": "69fa3524d2bb2bbbf0c0a4e18ecbec3eeae791f9b60547d6adf0fa20123c4a41",
+ "dist/2021-09-08/cargo-beta-x86_64-pc-windows-gnu.tar.gz": "611c3653a03ca05effb06b5857b77cb24fd87ae5f1d294df980c96a57b8a9a74",
+ "dist/2021-09-08/cargo-beta-x86_64-pc-windows-gnu.tar.xz": "cca04b2298bea6b447daa806af2313da4797072d27ecc3202bd0633b5a1d5fb4",
+ "dist/2021-09-08/cargo-beta-x86_64-pc-windows-msvc.tar.gz": "763d4ec911a374d348468a38d07caa8d559330c6179f5cd40b5a54ccdb355580",
+ "dist/2021-09-08/cargo-beta-x86_64-pc-windows-msvc.tar.xz": "37d24786e764c3af201cba07ef88a27fac97d150d7711cfdbb625e957b9f0139",
+ "dist/2021-09-08/cargo-beta-x86_64-unknown-freebsd.tar.gz": "f39494da3f92c39be50579f26d7f09d8e5f985e3566f8742aacc1446ab9f92c1",
+ "dist/2021-09-08/cargo-beta-x86_64-unknown-freebsd.tar.xz": "b65f8024b47d4784ab59e4722e522e54442852bbe16906760f2708e2b0d0fe65",
+ "dist/2021-09-08/cargo-beta-x86_64-unknown-illumos.tar.gz": "072bb564f73a97bdc6d58970735191d8da0831926dcd155a946f0fde1f382a02",
+ "dist/2021-09-08/cargo-beta-x86_64-unknown-illumos.tar.xz": "fc6a9c6d4cceeac868b37e200ed193981b8d70e8408d8e4b4765e149a9075c3a",
+ "dist/2021-09-08/cargo-beta-x86_64-unknown-linux-gnu.tar.gz": "8074fc6912e4bdbae269a334f21d0ead7bb0f28344ad67d71f65487baf21cc35",
+ "dist/2021-09-08/cargo-beta-x86_64-unknown-linux-gnu.tar.xz": "32a8471b2fb91b62aeda637bdb1368c67d1b17daaeea2592517666393857af16",
+ "dist/2021-09-08/cargo-beta-x86_64-unknown-linux-musl.tar.gz": "19dbfab31784d0615d0e84c526e98d9f47332492744bd1ab4fc7434c0762c5ad",
+ "dist/2021-09-08/cargo-beta-x86_64-unknown-linux-musl.tar.xz": "510734acf369b92a3f1eb30921a96f393ae207af7dffe6a83df66c350bd1a510",
+ "dist/2021-09-08/cargo-beta-x86_64-unknown-netbsd.tar.gz": "85e2fb4ab2ca3eff3ce98ab1c74c996a6b9cd2c20ff3f47c8624e261ac254195",
+ "dist/2021-09-08/cargo-beta-x86_64-unknown-netbsd.tar.xz": "2b1cff0bfa9bcece19e61f4be680ebaa05663e918fc9f3a20516efd91244e1c6",
+ "dist/2021-09-08/rust-std-beta-aarch64-apple-darwin.tar.gz": "54386650675047126f2b418485a5b2ca8bf3b568231fe54914512ae09809276e",
+ "dist/2021-09-08/rust-std-beta-aarch64-apple-darwin.tar.xz": "c7613b2089562353502560a6521139dfd7fd58a96c772877cf2ea7bfd62920d4",
+ "dist/2021-09-08/rust-std-beta-aarch64-apple-ios-sim.tar.gz": "a80e59fa3885f73973d9c3eb50628718eda015b1e62f328152ee95971acb10c2",
+ "dist/2021-09-08/rust-std-beta-aarch64-apple-ios-sim.tar.xz": "b0b65575680186ae6c032fabad5dd4352d17ec2d29ecc22771ab9f86a54b90e8",
+ "dist/2021-09-08/rust-std-beta-aarch64-apple-ios.tar.gz": "22fdfea8abb345a32ca47ce658c601c36d7838cf22383a34470db643a14e89b3",
+ "dist/2021-09-08/rust-std-beta-aarch64-apple-ios.tar.xz": "3a145167eb7bd82e59df7bd009f69f4951efb1487cf002c584625c24be35f4c0",
+ "dist/2021-09-08/rust-std-beta-aarch64-fuchsia.tar.gz": "97d1614ad18e71a09326d65ec4bb631c9974f4d3c63c9438b180646579227f7d",
+ "dist/2021-09-08/rust-std-beta-aarch64-fuchsia.tar.xz": "aabd6f6c8548b6576986f6fa2632ced035f0ad504da05d3dfd92ab0202104ff9",
+ "dist/2021-09-08/rust-std-beta-aarch64-linux-android.tar.gz": "5e67121330fd7e095f86c5dc71bd5180ec1669ad819ccf0bb4b38b46f35bcf94",
+ "dist/2021-09-08/rust-std-beta-aarch64-linux-android.tar.xz": "b3d72ba51cca485d742117c70915a5e57404d3f8c80356c8df388eba913e136d",
+ "dist/2021-09-08/rust-std-beta-aarch64-pc-windows-msvc.tar.gz": "f3eaf16070eb770d464a844e72257cca4ccce4ee2c380f276e82d259d8781326",
+ "dist/2021-09-08/rust-std-beta-aarch64-pc-windows-msvc.tar.xz": "846480e3eaf8d21fb4d99659a68e71259da613e54cfd098470c139e38ea5a447",
+ "dist/2021-09-08/rust-std-beta-aarch64-unknown-linux-gnu.tar.gz": "198be5989e4d2d479582ef2002ec3041105555cbb86488ba563fce35ae1c5c18",
+ "dist/2021-09-08/rust-std-beta-aarch64-unknown-linux-gnu.tar.xz": "706148bf9e562cf61d6f882a330e0fd150eb0593136a370cf559c54b6723f4c1",
+ "dist/2021-09-08/rust-std-beta-aarch64-unknown-linux-musl.tar.gz": "8e2718c2509c3db0696599dbd93f7a9c846228374ec0e24bf9f7b876a7714d71",
+ "dist/2021-09-08/rust-std-beta-aarch64-unknown-linux-musl.tar.xz": "e44e11ca1ac94d2335c19891fc8b85394b3935a86fa51c8a2c558faf8606c7bc",
+ "dist/2021-09-08/rust-std-beta-aarch64-unknown-none-softfloat.tar.gz": "9439bb56b5c11e9fab00e02e7f931c4582a6dbb3aeb7b20e5ad0fe5420dd27d0",
+ "dist/2021-09-08/rust-std-beta-aarch64-unknown-none-softfloat.tar.xz": "5e3187685291d52c500aba70de657478e08b5a69ecbf381f2ae41cb78cfd82d3",
+ "dist/2021-09-08/rust-std-beta-aarch64-unknown-none.tar.gz": "69c5da7ba93aeb93f8f7a6b581f1895b427c377c8f624274cf2691cacf845acc",
+ "dist/2021-09-08/rust-std-beta-aarch64-unknown-none.tar.xz": "8d66841c5e9e20d35b3791bbd10fb97e73b7abf602fee52a939a7096e0040eb0",
+ "dist/2021-09-08/rust-std-beta-arm-linux-androideabi.tar.gz": "4901f22f057d78331d298c23b66a39b2caa39580b19adc007fa8a4780483b27c",
+ "dist/2021-09-08/rust-std-beta-arm-linux-androideabi.tar.xz": "ba5d5016a625f433dc2fdacb3a1c462a08cdf9cdfcd202a966f16386e58362cb",
+ "dist/2021-09-08/rust-std-beta-arm-unknown-linux-gnueabi.tar.gz": "0ea2986826d17ea1baeecda1c73af27e41830d22aa10722ac18e1427a3c11295",
+ "dist/2021-09-08/rust-std-beta-arm-unknown-linux-gnueabi.tar.xz": "11e8397c3b6cc2f0ce7c8d725e8bc8dd0a7b7c800174ca3f4da6ee4c32e338e9",
+ "dist/2021-09-08/rust-std-beta-arm-unknown-linux-gnueabihf.tar.gz": "019fb984e383342a3ec4069f7f62bbc33c9b9609202b571ae32fe6b0ddd2dd60",
+ "dist/2021-09-08/rust-std-beta-arm-unknown-linux-gnueabihf.tar.xz": "e86d5310c9181ccfd432bc93e6715d109f26608bea97fee0d9f0d2efaaa7126a",
+ "dist/2021-09-08/rust-std-beta-arm-unknown-linux-musleabi.tar.gz": "1a7c7bf25c54c9a394a671d7f23e5cb08d6501b25bbb687159a208dfa16b0d33",
+ "dist/2021-09-08/rust-std-beta-arm-unknown-linux-musleabi.tar.xz": "e8deaf7cf0031d73e93ac1f61713836a0413f644639f8f602d234bd583c660c2",
+ "dist/2021-09-08/rust-std-beta-arm-unknown-linux-musleabihf.tar.gz": "0d72ae75cc1b59146dd799cb85a8c60ea9c4169f53f17b8eeb74da644bad0e21",
+ "dist/2021-09-08/rust-std-beta-arm-unknown-linux-musleabihf.tar.xz": "1dd8c951a7e13e68686e9a9a3eb0ecdae83fb178454a0ace9c649b5b47fc9a50",
+ "dist/2021-09-08/rust-std-beta-armebv7r-none-eabi.tar.gz": "8b4b4163b746618c2dde450a7151ccdbfaf9732311fb959d11336bd78bfa8d25",
+ "dist/2021-09-08/rust-std-beta-armebv7r-none-eabi.tar.xz": "fa6ef79c9a3ac07c0cebe908eebab2a32f578f0838c0f939bf8f4136aed7a499",
+ "dist/2021-09-08/rust-std-beta-armebv7r-none-eabihf.tar.gz": "487c64e8251564373437f94b5e94d81bec50b61e77c39c691ce912cf95236d0d",
+ "dist/2021-09-08/rust-std-beta-armebv7r-none-eabihf.tar.xz": "2bae0e0b2383ee6182ce8df4dd26993aaa56aa4dd89e6cac1982a48414ca5d5c",
+ "dist/2021-09-08/rust-std-beta-armv5te-unknown-linux-gnueabi.tar.gz": "bb5ca2b48383b27d181d90e4802cd387cacab9c00fca853c0deeb317270851b0",
+ "dist/2021-09-08/rust-std-beta-armv5te-unknown-linux-gnueabi.tar.xz": "f7bf769be48434faddf3dbed8264b1ab5dbbb3657f5b71640ad9330b3340ca29",
+ "dist/2021-09-08/rust-std-beta-armv5te-unknown-linux-musleabi.tar.gz": "c88db813417a1263408cc3bffeaf03b45db7b2c0a89c8441b3f4e7514473a0c3",
+ "dist/2021-09-08/rust-std-beta-armv5te-unknown-linux-musleabi.tar.xz": "3c5a3ea4ce9a6826dd3fc1eaae8615701bf3b5c53d56fe6948432229f027ac1c",
+ "dist/2021-09-08/rust-std-beta-armv7-linux-androideabi.tar.gz": "3d45d64267149d222337421be4cd5207812125f9b2df253f507f0cc2cba37219",
+ "dist/2021-09-08/rust-std-beta-armv7-linux-androideabi.tar.xz": "ee71e74b369b42a9c2258bf5d9c8c7119ee65b8951d4655c477a4593ec2cf3fa",
+ "dist/2021-09-08/rust-std-beta-armv7-unknown-linux-gnueabi.tar.gz": "949bce55fc6047a37f8ea26e21cc69557ad66a45c688442f2be06a8cab503358",
+ "dist/2021-09-08/rust-std-beta-armv7-unknown-linux-gnueabi.tar.xz": "28ec52f486459b436c0097db2b400a202ad1280591f2612cadf4daec1ef4e4a8",
+ "dist/2021-09-08/rust-std-beta-armv7-unknown-linux-gnueabihf.tar.gz": "0f7782f0b6874c858de7171d255f12fe309e9255ad55a6406577feae3702fbc0",
+ "dist/2021-09-08/rust-std-beta-armv7-unknown-linux-gnueabihf.tar.xz": "cf3bc863ecd6da3fb45c3d2f5b6741d57ff778b1bb2e4f0d05480c9aab480bbf",
+ "dist/2021-09-08/rust-std-beta-armv7-unknown-linux-musleabi.tar.gz": "35e3647a940d2e2e37ed3a5b7c1a789f94b7f1a256f0bd339630bb7b0342c2e0",
+ "dist/2021-09-08/rust-std-beta-armv7-unknown-linux-musleabi.tar.xz": "ed1ec913fd3e821501e52be1d3cdac3fbe5a6c00acd17204b1891aa5fa3e6f93",
+ "dist/2021-09-08/rust-std-beta-armv7-unknown-linux-musleabihf.tar.gz": "2fc9f5791717cc876d155f4cbb672dabf9fa308ac67636e50a75a5b5ea11369f",
+ "dist/2021-09-08/rust-std-beta-armv7-unknown-linux-musleabihf.tar.xz": "91ac6c321d172cfb62e6772c2c7340110fb9801a8d44814b69b477f611f09c58",
+ "dist/2021-09-08/rust-std-beta-armv7a-none-eabi.tar.gz": "69661706ec6749f851d6a967f69fc8e4de8e5a58da2a771129b22202918f6ce8",
+ "dist/2021-09-08/rust-std-beta-armv7a-none-eabi.tar.xz": "45275aea14a3f4547e0e2f11ce2cf364ac2c749cf0df467a54e27b39b65a5fe2",
+ "dist/2021-09-08/rust-std-beta-armv7r-none-eabi.tar.gz": "63ea71e69e36d916baca6eb42b4b4b6f2f69870063526533a2699f66fc0cb317",
+ "dist/2021-09-08/rust-std-beta-armv7r-none-eabi.tar.xz": "2d6f4ca658991a7b426d50330371922888706944eb3c1603288d4be2fa4f5457",
+ "dist/2021-09-08/rust-std-beta-armv7r-none-eabihf.tar.gz": "3d27ea42bd3a419ccf7f28b9ff040e077f3e963948924f996aaf718abeeb1709",
+ "dist/2021-09-08/rust-std-beta-armv7r-none-eabihf.tar.xz": "8f6bc34715629354b4d9f71d7a8693171b667604d237b433f7444df1228d2a36",
+ "dist/2021-09-08/rust-std-beta-asmjs-unknown-emscripten.tar.gz": "f83bdc7e73590beab7ec915bb7a3a7531e485d7f73cf9c65150102748207d874",
+ "dist/2021-09-08/rust-std-beta-asmjs-unknown-emscripten.tar.xz": "1068750fb0b4a7ec35b5674a6c7fb0368b043bee6df0fbe360f521c7c2f08b94",
+ "dist/2021-09-08/rust-std-beta-i586-pc-windows-msvc.tar.gz": "506bd86d803953bb086e057c6b2ee1fd9ffa0e08a0d7162189119cd21668cc0f",
+ "dist/2021-09-08/rust-std-beta-i586-pc-windows-msvc.tar.xz": "b608aff18260165b51acbc06d551c5eb003928f2c7551f83a1ac1782442826ac",
+ "dist/2021-09-08/rust-std-beta-i586-unknown-linux-gnu.tar.gz": "c90eca1f2326cfa916e225199e2526719fc9b6f18e2b789366a9668a52eba339",
+ "dist/2021-09-08/rust-std-beta-i586-unknown-linux-gnu.tar.xz": "ab382cc6c67bceaf76555a2c71c5f26e46802fe7c2713e173744b14371b742a5",
+ "dist/2021-09-08/rust-std-beta-i586-unknown-linux-musl.tar.gz": "dd52e44df6cd8bbac61d484e574d363125662fef270695e962900995a05818b3",
+ "dist/2021-09-08/rust-std-beta-i586-unknown-linux-musl.tar.xz": "e9c4bba480b748625898dc047b950a142ccda9e9fe1e329365741f09f640e843",
+ "dist/2021-09-08/rust-std-beta-i686-linux-android.tar.gz": "bb2e1dea2aae2f726420d8a5cd112f1bed6e06e95053f10c6497b1be878b180e",
+ "dist/2021-09-08/rust-std-beta-i686-linux-android.tar.xz": "df15194a40cce8c574b219164b75590ad9c55c03ab811682ebe89db004c651f4",
+ "dist/2021-09-08/rust-std-beta-i686-pc-windows-gnu.tar.gz": "c7b38618dda1cd13d52c59bb9a4632458aa7b20d90b01478fb506801c3fb41eb",
+ "dist/2021-09-08/rust-std-beta-i686-pc-windows-gnu.tar.xz": "83390b595e3273f0b02e05878064429a1815f18bceb7e0d77a63c5caecaebfeb",
+ "dist/2021-09-08/rust-std-beta-i686-pc-windows-msvc.tar.gz": "e7c6c8e5ae9d02e9f3c33b174862d1d6e0caf357c7c3cd510e63cc3472db816b",
+ "dist/2021-09-08/rust-std-beta-i686-pc-windows-msvc.tar.xz": "feb49ed3fdf25d7703134afefc3c04b0ed23d87adc02945bccac4b30c425fa16",
+ "dist/2021-09-08/rust-std-beta-i686-unknown-freebsd.tar.gz": "f633cb1bd2636eceaa87d98a214aa73907502aa92d4cb1a1869870c9bc6ad23a",
+ "dist/2021-09-08/rust-std-beta-i686-unknown-freebsd.tar.xz": "cd61b7dfe7ead85a79469008717bc52cb76572fc9688f82a50f07b0c7e0fafb2",
+ "dist/2021-09-08/rust-std-beta-i686-unknown-linux-gnu.tar.gz": "b22f1285e8d179a372060916bc2a6d609499231f805b5cec2ef8d1e5d0c70d71",
+ "dist/2021-09-08/rust-std-beta-i686-unknown-linux-gnu.tar.xz": "24fd3c052bdec08615e54438fbccd9e43c9956d25b1bfce6f3640eb164aa6f5d",
+ "dist/2021-09-08/rust-std-beta-i686-unknown-linux-musl.tar.gz": "df63f460486eeb9a11ed53c35814495e931492aed5abe44a841cd7a43a9e3719",
+ "dist/2021-09-08/rust-std-beta-i686-unknown-linux-musl.tar.xz": "3ba2d402c01b099b89518acded3734a552f64a330a7d21732ce641cf25cd5c8d",
+ "dist/2021-09-08/rust-std-beta-mips-unknown-linux-gnu.tar.gz": "4cc5b2cfa6747155a0e0c6a7a835abd464bc9610fd071197af1ac50ab8f2fa1c",
+ "dist/2021-09-08/rust-std-beta-mips-unknown-linux-gnu.tar.xz": "28f70f287f4cceba042b9574b16ce0403d73785bc6261c9a6739d770d5f354f9",
+ "dist/2021-09-08/rust-std-beta-mips-unknown-linux-musl.tar.gz": "04a8dc4e8144330f326dba5182928cf91c50c4b3513df0b67d55d601d3524a7e",
+ "dist/2021-09-08/rust-std-beta-mips-unknown-linux-musl.tar.xz": "06a91efa4f8ab42c3a0f9c2ae9279da87bb2a239f1032d1faa3583febace37cc",
+ "dist/2021-09-08/rust-std-beta-mips64-unknown-linux-gnuabi64.tar.gz": "887728123ccd4bb75f4d42bffc1d2b7f46d8bdc4554a77b12578507cb44e7fd5",
+ "dist/2021-09-08/rust-std-beta-mips64-unknown-linux-gnuabi64.tar.xz": "987598a67a36f428fa8fb21e0239aa345e952a1e6c64fefcc2fe2feda56bb864",
+ "dist/2021-09-08/rust-std-beta-mips64-unknown-linux-muslabi64.tar.gz": "2110b1b7456366668e093d27013d7002e302c6ecccff63c147c0346cd9a452b7",
+ "dist/2021-09-08/rust-std-beta-mips64-unknown-linux-muslabi64.tar.xz": "d6f16eca6526aeeef3ec7d0a9948ff5da3b7eff6e4bb9203a9546037df1f8d55",
+ "dist/2021-09-08/rust-std-beta-mips64el-unknown-linux-gnuabi64.tar.gz": "36a510c2a8fbc751416183b88680685c232646289504d2e2422e5208cd11670b",
+ "dist/2021-09-08/rust-std-beta-mips64el-unknown-linux-gnuabi64.tar.xz": "2f2a7a533d30cdb437bf31d18fb547680d646ec1765ca6c5fe16e449dbf3b613",
+ "dist/2021-09-08/rust-std-beta-mips64el-unknown-linux-muslabi64.tar.gz": "09472066c8403c059e9d34ac2f7a4387e61726c45dd5ff2bc03b85543d8376c0",
+ "dist/2021-09-08/rust-std-beta-mips64el-unknown-linux-muslabi64.tar.xz": "83c4a0f9ed4fa2884d1d193b79693c3af4e9c8603b9a1f3bd6eb827ba09a5466",
+ "dist/2021-09-08/rust-std-beta-mipsel-unknown-linux-gnu.tar.gz": "739998734f48c9591b7aed3452d8425e2c916d202341ff63931fa473e3eb9a25",
+ "dist/2021-09-08/rust-std-beta-mipsel-unknown-linux-gnu.tar.xz": "83be5e72fc8597f51c6b2cc216d90c8dba6be509b44fa25f3d7d285e1c54c7c0",
+ "dist/2021-09-08/rust-std-beta-mipsel-unknown-linux-musl.tar.gz": "0a02455697ac62af66b359d5b73436ce7b18274abd18ffa13b7f0f9c1df72f82",
+ "dist/2021-09-08/rust-std-beta-mipsel-unknown-linux-musl.tar.xz": "1cc6fe6ecfe4c10c2957806e56c1a0aa256ef5bb3ad4ca47f24aae42cf0fc0e3",
+ "dist/2021-09-08/rust-std-beta-nvptx64-nvidia-cuda.tar.gz": "f90d70acfa78388fe8e54a62f4fd9e773bd1455b036f6af13a5feec072de11e8",
+ "dist/2021-09-08/rust-std-beta-nvptx64-nvidia-cuda.tar.xz": "d2c491b6fb62bc5279447e7f5d96fbb679a225ec13d6c96c8f80cad859b0f5f8",
+ "dist/2021-09-08/rust-std-beta-powerpc-unknown-linux-gnu.tar.gz": "17e9bca285df96b3bcd48297c89c096aab6b545d783e261103f7b364c214c09d",
+ "dist/2021-09-08/rust-std-beta-powerpc-unknown-linux-gnu.tar.xz": "d4a8679af46449daa4db0acc23bda23aa5c8f35fb2ca9d0e065b35e30d6fc649",
+ "dist/2021-09-08/rust-std-beta-powerpc64-unknown-linux-gnu.tar.gz": "845cab4436d36b6eb2a914ab7c48bd49626a04053eee918fbbb78aba1d1e0a4a",
+ "dist/2021-09-08/rust-std-beta-powerpc64-unknown-linux-gnu.tar.xz": "b399647f0d9e8458570e8a9ab11b30d7258fa396ab019037b5bb391dbe65ead7",
+ "dist/2021-09-08/rust-std-beta-powerpc64le-unknown-linux-gnu.tar.gz": "6c84662ba3c210b9d7c3332473cdc95dcf3e238d9c9010581accfafa37cdf4f8",
+ "dist/2021-09-08/rust-std-beta-powerpc64le-unknown-linux-gnu.tar.xz": "594aba2abb126a615c93bb5c7927eb5a2ccdbe4c54c22bfdfa9cacf99e268889",
+ "dist/2021-09-08/rust-std-beta-riscv32i-unknown-none-elf.tar.gz": "439f5d5f1d2ee9db18c6e3b0bb831b037234852067a91f1a15bca38ca38b7a0b",
+ "dist/2021-09-08/rust-std-beta-riscv32i-unknown-none-elf.tar.xz": "227fa2ff323d20a2a8c29e0167fac78c7b88b8db3368b009b75d4a1cd49b7b29",
+ "dist/2021-09-08/rust-std-beta-riscv32imac-unknown-none-elf.tar.gz": "5055560e4dc3df90bf127bb5133c8d2d0ba662c1b1b20d63453cd60ee3e04947",
+ "dist/2021-09-08/rust-std-beta-riscv32imac-unknown-none-elf.tar.xz": "df1267905fe5a23c2ddc47fc0ade249bd663e6d3e8982193cb2a2a638e747e5c",
+ "dist/2021-09-08/rust-std-beta-riscv32imc-unknown-none-elf.tar.gz": "2a702d0d0a0e2cf17a42eac549bd751eadc4398182f42590e3322cc7420b4cd1",
+ "dist/2021-09-08/rust-std-beta-riscv32imc-unknown-none-elf.tar.xz": "98e5d336ee07556ff0fe01f89f9059cb977fa36d5f87ee8633aebb5fa6c8762b",
+ "dist/2021-09-08/rust-std-beta-riscv64gc-unknown-linux-gnu.tar.gz": "de64e6d171a2c11e16142b1e964c0f0e0d6e4bab2e9e9d5d8121ee77fbdb60de",
+ "dist/2021-09-08/rust-std-beta-riscv64gc-unknown-linux-gnu.tar.xz": "1dbb24b1ed6510f098f63933a596f1f58907c22320eb79394dce341af7d7b59a",
+ "dist/2021-09-08/rust-std-beta-riscv64gc-unknown-none-elf.tar.gz": "66af911664286500164db018c0aad12a85da035fc1e2d6cffbe7603ff0145624",
+ "dist/2021-09-08/rust-std-beta-riscv64gc-unknown-none-elf.tar.xz": "e8abd1f9f7344842af5f6a85d75404c1589fd17efbe5a8008ab52f082b7b3772",
+ "dist/2021-09-08/rust-std-beta-riscv64imac-unknown-none-elf.tar.gz": "a9f06d8862f9bb805f438b1c01464dd7a9cd07ecd04b1246727ac290891da54f",
+ "dist/2021-09-08/rust-std-beta-riscv64imac-unknown-none-elf.tar.xz": "6143b4b36bbdd1c56b978e9a2afc012163610fac7b8fb9bd9f24abb4e970b21d",
+ "dist/2021-09-08/rust-std-beta-s390x-unknown-linux-gnu.tar.gz": "5cb4c0616056f36c7cfe446fa97e146fd5c525be1de8bbdb5017ad0d07a9561d",
+ "dist/2021-09-08/rust-std-beta-s390x-unknown-linux-gnu.tar.xz": "9d2397f9d70956ddd50b37f8a7dba71d3cea9df5fa128e35d92cb162d7f938d4",
+ "dist/2021-09-08/rust-std-beta-sparc64-unknown-linux-gnu.tar.gz": "b7e0fe340919a37cf8daeb1a747392c53fce4dafc84331f998479c3c12572973",
+ "dist/2021-09-08/rust-std-beta-sparc64-unknown-linux-gnu.tar.xz": "464b2601346e014b2f5a9cc64dd32897be915742a5c75eeacf82691277c4f8de",
+ "dist/2021-09-08/rust-std-beta-sparcv9-sun-solaris.tar.gz": "40c61118e3e85343f6ea3059e41e3d2e3108f540331d8114948447307eea9b5f",
+ "dist/2021-09-08/rust-std-beta-sparcv9-sun-solaris.tar.xz": "3dfb77e1315a8367b4a5665ae9419843a8cb953ce4726b35307e7c7199514616",
+ "dist/2021-09-08/rust-std-beta-thumbv6m-none-eabi.tar.gz": "66632c7fad29f275ccfed907e395db12e621b17909e5e026d192f0b552fd4be1",
+ "dist/2021-09-08/rust-std-beta-thumbv6m-none-eabi.tar.xz": "a308cdebc35d65d8208fe2b2dc7b45dfb1a64405478d86b82bfb28115174a129",
+ "dist/2021-09-08/rust-std-beta-thumbv7em-none-eabi.tar.gz": "c342b21b5f61dcddea74b89f60f1d0d0622c5aedc79550d316b8744b522bda6f",
+ "dist/2021-09-08/rust-std-beta-thumbv7em-none-eabi.tar.xz": "a3b00a6b9b3fb8942700f91d32077520185a7c21d25620193cbe2e730a021f64",
+ "dist/2021-09-08/rust-std-beta-thumbv7em-none-eabihf.tar.gz": "18f15f7e2ffe97f7be99e246144e6b9ad7445b1b66382112e71e08137a36b840",
+ "dist/2021-09-08/rust-std-beta-thumbv7em-none-eabihf.tar.xz": "16eb54bf02813d45c6ff328ec7db8f16daf0e57dedfad7247249af2ec5133d4b",
+ "dist/2021-09-08/rust-std-beta-thumbv7m-none-eabi.tar.gz": "14bdada81be2379b2ead0212cc34add3ace87bd222532ada2a00b603180db946",
+ "dist/2021-09-08/rust-std-beta-thumbv7m-none-eabi.tar.xz": "f6cfa6bdcee91a6cab748fced0d2be7642b83cbe7d5fdcdf638fc3e86277d17e",
+ "dist/2021-09-08/rust-std-beta-thumbv7neon-linux-androideabi.tar.gz": "e11e35a643c0a9983fb1f1e8f60ac073a4ee48c4a9f3e757f4fb55ea8364046d",
+ "dist/2021-09-08/rust-std-beta-thumbv7neon-linux-androideabi.tar.xz": "2ee5fc11fb01f84e2346a17745c935f75d400a2448ec49d9e3535c98c3d67a73",
+ "dist/2021-09-08/rust-std-beta-thumbv7neon-unknown-linux-gnueabihf.tar.gz": "61b26681fdb6957c3acd9aa32b011605786bed196cd71334d966ad9289efbb2f",
+ "dist/2021-09-08/rust-std-beta-thumbv7neon-unknown-linux-gnueabihf.tar.xz": "bfd3391ebdc20690ede1a8a606f59df9009a473962deb04d3a89b266d0a89949",
+ "dist/2021-09-08/rust-std-beta-thumbv8m.base-none-eabi.tar.gz": "ae8d90bdd3d2faa2623ec30935e3e93bf3af6ad036eaae72bc8a3d086f7cd054",
+ "dist/2021-09-08/rust-std-beta-thumbv8m.base-none-eabi.tar.xz": "66ce451e2a0830808aa996b4643fa6ca6d89a072467d9df659ad4e202b73d561",
+ "dist/2021-09-08/rust-std-beta-thumbv8m.main-none-eabi.tar.gz": "1afbb6a4ee9ec38b7ad1c67c3df3371d188b831ffdb58ae96227e5c9a017f5d9",
+ "dist/2021-09-08/rust-std-beta-thumbv8m.main-none-eabi.tar.xz": "8c1e0000926fb4ff370763396e69aef70ed7871c33f01bc2d429abf31ee8d211",
+ "dist/2021-09-08/rust-std-beta-thumbv8m.main-none-eabihf.tar.gz": "169852e1ae03792a8f492954258d08bc1483615e7121d587476ac4fc065c79a1",
+ "dist/2021-09-08/rust-std-beta-thumbv8m.main-none-eabihf.tar.xz": "1da32effe4416f0cd5448a9061d57dd2f4b541f737a7036d20d78fd44f715ddb",
+ "dist/2021-09-08/rust-std-beta-wasm32-unknown-emscripten.tar.gz": "39d22c8ff2620d4e6569eb75c86d4135a288bba00dcc479f4371a1e7e52fee4b",
+ "dist/2021-09-08/rust-std-beta-wasm32-unknown-emscripten.tar.xz": "c34b1abdb8e3f3f913564a472b18dc52b239d7e327a4bd89d9bd0290d0b31635",
+ "dist/2021-09-08/rust-std-beta-wasm32-unknown-unknown.tar.gz": "ae284aa5819407e8daf022fbbf1f5d279366077faf25a6653d9c518ab3fe710e",
+ "dist/2021-09-08/rust-std-beta-wasm32-unknown-unknown.tar.xz": "be7a5b763db13ab1582a5f98fe7fb9ab1facdd645a7fe4544e0cbec9d1c58e76",
+ "dist/2021-09-08/rust-std-beta-wasm32-wasi.tar.gz": "ac9f39cb7924f48fc29d666dfda3c6001b6880d6efd956acfa734389ef7b5dbe",
+ "dist/2021-09-08/rust-std-beta-wasm32-wasi.tar.xz": "04d20256cea7b2394f72f6c0895a9d249fbd641fcaf616a628ad703e79c950a2",
+ "dist/2021-09-08/rust-std-beta-x86_64-apple-darwin.tar.gz": "c304a11e2361b42f80fb9c6f239cbfbd2b7ffdcf00fe49ac94e3a6d4a9d2d2b3",
+ "dist/2021-09-08/rust-std-beta-x86_64-apple-darwin.tar.xz": "35d51256fc42481b8265a02d756bb9bd84a23240156ed1fdf84ee3adaa77b8c2",
+ "dist/2021-09-08/rust-std-beta-x86_64-apple-ios.tar.gz": "6eec11897fe08b43fece4a1cf0ecec1ca247b3d01656b4a2a159815fbe13c626",
+ "dist/2021-09-08/rust-std-beta-x86_64-apple-ios.tar.xz": "faddd6de72f17f669e38dc2e9ef5cdd4b729cdbccaae6a7711c54b173d86bfd2",
+ "dist/2021-09-08/rust-std-beta-x86_64-fortanix-unknown-sgx.tar.gz": "6741696a588c4e723d279e388d446271b773c6029a823c5e2135a08a018c6083",
+ "dist/2021-09-08/rust-std-beta-x86_64-fortanix-unknown-sgx.tar.xz": "a62d276ad6a4832cadd3ef4c587cc77f588774b93b2807dc1ab9e0acff037838",
+ "dist/2021-09-08/rust-std-beta-x86_64-fuchsia.tar.gz": "38a61746734681a97e84419709bd3ebc722207db656737e7be75479e0d991f9f",
+ "dist/2021-09-08/rust-std-beta-x86_64-fuchsia.tar.xz": "b85bbcd1353315e5c4eef82707912566f6a1f94f706350ae0474a29ff33b603e",
+ "dist/2021-09-08/rust-std-beta-x86_64-linux-android.tar.gz": "de32ea66a8228857a34f39d8d47e6cb32a4db9efd73100e97afe12bf58f6d520",
+ "dist/2021-09-08/rust-std-beta-x86_64-linux-android.tar.xz": "e2f89e63a379ba8182acf1b4fba33f790e0cdf4675bc46239840ecde613b1835",
+ "dist/2021-09-08/rust-std-beta-x86_64-pc-solaris.tar.gz": "6136d0607905fe49617a8171896bfada258eb84cb00e8042fd67bef29732a714",
+ "dist/2021-09-08/rust-std-beta-x86_64-pc-solaris.tar.xz": "00a98839ab7d2302feeaa0fdbedc169bfb2bd7229c27aa274954efc73b52c4f3",
+ "dist/2021-09-08/rust-std-beta-x86_64-pc-windows-gnu.tar.gz": "2f711c4a26ed3b876e64e256bf1b4040552e80a06bec352a9d3479ed8ed6aca9",
+ "dist/2021-09-08/rust-std-beta-x86_64-pc-windows-gnu.tar.xz": "e479e495292512d67414d3056c322ea368559a0d95d827f944bae7382bea4e4a",
+ "dist/2021-09-08/rust-std-beta-x86_64-pc-windows-msvc.tar.gz": "ce43642d886784242a3914b799b1a77b60df642af2a41f75eac186b7f1b6104e",
+ "dist/2021-09-08/rust-std-beta-x86_64-pc-windows-msvc.tar.xz": "a83d236d59f04f3a51a6a34ccf7b79b4b2f269dc50e147d61e1e9c4a57925835",
+ "dist/2021-09-08/rust-std-beta-x86_64-sun-solaris.tar.gz": "a8e7f979fc8ad5bdaa4ea2965c305a3296dfe88ffa235cdb7aea8234e4a46138",
+ "dist/2021-09-08/rust-std-beta-x86_64-sun-solaris.tar.xz": "72ed0fb32e53b283c6a0e1752d231915b98504164965f7e2b5f06d8550e4c338",
+ "dist/2021-09-08/rust-std-beta-x86_64-unknown-freebsd.tar.gz": "1f5535f9d44afdacf059681587239bf4d21985f1dfbd3ace94c864c2d7616a42",
+ "dist/2021-09-08/rust-std-beta-x86_64-unknown-freebsd.tar.xz": "5faf349a9cc231c144c52de40f2a487a935c6f6146614547e64cabb26f037a23",
+ "dist/2021-09-08/rust-std-beta-x86_64-unknown-illumos.tar.gz": "0ae64780c9a944a32bc51b5efef9f0818025a423819ef60fdc799945d52bfd73",
+ "dist/2021-09-08/rust-std-beta-x86_64-unknown-illumos.tar.xz": "b3308afe75af668878959db95b039c6e1c4416badf67ee650b07f5cf07f14ab2",
+ "dist/2021-09-08/rust-std-beta-x86_64-unknown-linux-gnu.tar.gz": "f8078421bde37f74dd0ffe0ea44704778baca779e502cb760371340a6bfa15a5",
+ "dist/2021-09-08/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz": "cc26d8fd139b35e13cf75c2942727bba7899a874d95f865c127b0c3af15707cd",
+ "dist/2021-09-08/rust-std-beta-x86_64-unknown-linux-gnux32.tar.gz": "6e0ef50cb8c4ce19d7de517ad51581c4d80043fa489278c0ba984a5d408269db",
+ "dist/2021-09-08/rust-std-beta-x86_64-unknown-linux-gnux32.tar.xz": "5c9380fb472de93ebfe59b21f2a74b5f19a632ef6eccf77a89cf0b26ce2054a7",
+ "dist/2021-09-08/rust-std-beta-x86_64-unknown-linux-musl.tar.gz": "264c78d59e71d4fa232f6f10713ee61d94c270e493eabad7318877afa46b7327",
+ "dist/2021-09-08/rust-std-beta-x86_64-unknown-linux-musl.tar.xz": "af3e5b1883e8fa7d49e64ce8754d656d2992eba33b8ec5f92245f2a82793abf4",
+ "dist/2021-09-08/rust-std-beta-x86_64-unknown-netbsd.tar.gz": "0797448414c3421577705e725814dbf833a44b0930875fe418aa1eed9ebf6121",
+ "dist/2021-09-08/rust-std-beta-x86_64-unknown-netbsd.tar.xz": "bd3ec2d0fde1e11a75bfc3b684c2d564bd5068519d1c5a382ae09379337236c9",
+ "dist/2021-09-08/rust-std-beta-x86_64-unknown-redox.tar.gz": "449ea2e6ed2e1b4d656f8da8390f2e22cbbe40713e5f91cbc85971f36488402d",
+ "dist/2021-09-08/rust-std-beta-x86_64-unknown-redox.tar.xz": "5424c5b4aa5588de73734dcd43cd1ff9bf0e0ba244749a1519afc94c8f2057e2",
+ "dist/2021-09-08/rustc-beta-aarch64-apple-darwin.tar.gz": "b14f7853a9353b71d7babeeb136fbb595b5c23144ac1bd72e70b74227a1685ca",
+ "dist/2021-09-08/rustc-beta-aarch64-apple-darwin.tar.xz": "af2ab319357b3b4a2810a52c824f8f308d2c3f41ea1ed30ba9ef9ff6a4769dde",
+ "dist/2021-09-08/rustc-beta-aarch64-pc-windows-msvc.tar.gz": "c09a6bdbe6dccbdcd366a695d54be4e0a472fa1ca5bf30bf7eaf389534e2f70c",
+ "dist/2021-09-08/rustc-beta-aarch64-pc-windows-msvc.tar.xz": "9fad7bc10840340081cd29166aa788843a9950e293d6ced71a26e36bf0eafe9e",
+ "dist/2021-09-08/rustc-beta-aarch64-unknown-linux-gnu.tar.gz": "d20cdcc681b0506e73ccd0b484a7b7394a08615d2d195318d0f2c5af3063581b",
+ "dist/2021-09-08/rustc-beta-aarch64-unknown-linux-gnu.tar.xz": "07d0b4393149f854dca2d622a6ac8d6cb9fc62d2d24977bcf50cdc1824fe6a32",
+ "dist/2021-09-08/rustc-beta-aarch64-unknown-linux-musl.tar.gz": "dbe81393d5253521adceda8027b103edef45a031120e92f2e9e89564e85863c2",
+ "dist/2021-09-08/rustc-beta-aarch64-unknown-linux-musl.tar.xz": "40edabc1e00f228815c88798543f55081e3dfe352f88753f5592479de9236b4b",
+ "dist/2021-09-08/rustc-beta-arm-unknown-linux-gnueabi.tar.gz": "114dce61c5bf25be9f3cb33cd0c7500b1a60f5cbebef27547458312b8ddb8f4d",
+ "dist/2021-09-08/rustc-beta-arm-unknown-linux-gnueabi.tar.xz": "abc9130f7116badf9949f5a3ecd6820787e40bb590ebbd5c867b05cedfbdce5f",
+ "dist/2021-09-08/rustc-beta-arm-unknown-linux-gnueabihf.tar.gz": "cbebd112f0dd96258ed19b25762af60c9bac30669ae229d6b8456049779c890f",
+ "dist/2021-09-08/rustc-beta-arm-unknown-linux-gnueabihf.tar.xz": "cff6cbf35aba285cfb5f5d2f8a9dee5edefc7c22843ae0198e693993d556fcae",
+ "dist/2021-09-08/rustc-beta-armv7-unknown-linux-gnueabihf.tar.gz": "c20cf9a2e72f712f02ed867e9c4babe02d7ff22d62eb96cb127054010b6731b6",
+ "dist/2021-09-08/rustc-beta-armv7-unknown-linux-gnueabihf.tar.xz": "aa1b6cd4f9153fba338eb5c8a90ace06d742c97e659c3ffbca75125e5477b828",
+ "dist/2021-09-08/rustc-beta-i686-pc-windows-gnu.tar.gz": "3308d1e3ee0ae40f8db301601c73bf6eace168b570e9ab952760e28bd970a240",
+ "dist/2021-09-08/rustc-beta-i686-pc-windows-gnu.tar.xz": "0a019f66979c2542bf9fb268bad143cd55deac6f1502a4393464bb26a1e21c76",
+ "dist/2021-09-08/rustc-beta-i686-pc-windows-msvc.tar.gz": "31016537cedf38ef83e29a6125445946834a06ec2fda51ef799566baeb47211d",
+ "dist/2021-09-08/rustc-beta-i686-pc-windows-msvc.tar.xz": "a997b98b7a28358bd4ed394ddd3af62e5b19d7a33a61f55bf973b06fb9b95fe5",
+ "dist/2021-09-08/rustc-beta-i686-unknown-linux-gnu.tar.gz": "ddfba3dfb711db2ebb4cd7149172a738200b8e38a98f7ec5e5bbc81515be5453",
+ "dist/2021-09-08/rustc-beta-i686-unknown-linux-gnu.tar.xz": "5b0435f652dc749216735fc06599a3c6916a867ab82dc126d0cde872855dac83",
+ "dist/2021-09-08/rustc-beta-mips-unknown-linux-gnu.tar.gz": "6408766f8c58c13ba51347375dc5ed0fb7c247c8aee9b8a89e3369c70541c397",
+ "dist/2021-09-08/rustc-beta-mips-unknown-linux-gnu.tar.xz": "18a41553893aa8ff4c80fef252e8ba80c383d2809a57123fe89e89172a5839c5",
+ "dist/2021-09-08/rustc-beta-mips64-unknown-linux-gnuabi64.tar.gz": "28078984a80c4cb0e65391ae213390059a9eebff028209861d23c82b4db0a11c",
+ "dist/2021-09-08/rustc-beta-mips64-unknown-linux-gnuabi64.tar.xz": "277cfaafab145858ee5102a657c597abbdfa33ed2d6f1c8806f218bad91b2d8f",
+ "dist/2021-09-08/rustc-beta-mips64el-unknown-linux-gnuabi64.tar.gz": "8c8c92719f3d299047089031cb29ce209e2954466415449d37d474e88a732d8e",
+ "dist/2021-09-08/rustc-beta-mips64el-unknown-linux-gnuabi64.tar.xz": "d055a61cd0ec951edbc703180c190ef4dbed3391d1b2472668340642e205fecb",
+ "dist/2021-09-08/rustc-beta-mipsel-unknown-linux-gnu.tar.gz": "95433c7dc0437f61a024276c10a0654128bd0e873597932297140f82e34ad201",
+ "dist/2021-09-08/rustc-beta-mipsel-unknown-linux-gnu.tar.xz": "a3660c9909e3821537a275e37121950d6adbc87b85959e80fd7b72c6e3b7b944",
+ "dist/2021-09-08/rustc-beta-powerpc-unknown-linux-gnu.tar.gz": "07384f5fba55ad572753fc85ad6b2d231d94b31f009defb694c8632b38eeeb62",
+ "dist/2021-09-08/rustc-beta-powerpc-unknown-linux-gnu.tar.xz": "f0985ea483fbad75a9cff021db6c230c5c322eff942da667a0dd6cb3e37bb2c6",
+ "dist/2021-09-08/rustc-beta-powerpc64-unknown-linux-gnu.tar.gz": "81a7ddf94bf62f45dde9199df8b28ac9971d23b1817906e119ca4ea32000b08d",
+ "dist/2021-09-08/rustc-beta-powerpc64-unknown-linux-gnu.tar.xz": "7ce055fd68b1c5e3c48c9f03289cd4eb3af619cc30a7103056b20fe842a92db8",
+ "dist/2021-09-08/rustc-beta-powerpc64le-unknown-linux-gnu.tar.gz": "6b853d5c2fd2dc61d89c26bf5b365f48a9c535dd30aa672f28f254af8fbcc9e3",
+ "dist/2021-09-08/rustc-beta-powerpc64le-unknown-linux-gnu.tar.xz": "32c659ea9578759020f291099f16b1d12eebae30e07d35568e69cd0721576c24",
+ "dist/2021-09-08/rustc-beta-riscv64gc-unknown-linux-gnu.tar.gz": "a73a918ec89b759f19b605df527471acbbcfd2e3debcd0601d7a3956f645bcf0",
+ "dist/2021-09-08/rustc-beta-riscv64gc-unknown-linux-gnu.tar.xz": "eabdfdac435195844bdfaaa5f8bf6b57cf045742c6180c3ff0822bd85fac40f5",
+ "dist/2021-09-08/rustc-beta-s390x-unknown-linux-gnu.tar.gz": "a626ed9d5ce779e7fd8ab17d4dc83130a57200669730851bc68eb01d88bade7d",
+ "dist/2021-09-08/rustc-beta-s390x-unknown-linux-gnu.tar.xz": "67f195e60d88b3e0f1a702f7ba0cefded2dca6ffc03ede1f9b6e4fd38592eb6d",
+ "dist/2021-09-08/rustc-beta-x86_64-apple-darwin.tar.gz": "01e5b6d7153866ada9d3c1caee5c95da58296acd7007aa93338171cc349af304",
+ "dist/2021-09-08/rustc-beta-x86_64-apple-darwin.tar.xz": "a0b87b79f87e97a746ad311f2bf36ee9d5784f504f844427415e4a983ea4a0ac",
+ "dist/2021-09-08/rustc-beta-x86_64-pc-windows-gnu.tar.gz": "54ff5dfa917a5ebbaf77185d4efff9700d248dd66746dcb3942e29917495dd3b",
+ "dist/2021-09-08/rustc-beta-x86_64-pc-windows-gnu.tar.xz": "2d9dddd6b9a3ef6c5bb0758dbee171f08882292ba17e1f98445a9cf196f9c02c",
+ "dist/2021-09-08/rustc-beta-x86_64-pc-windows-msvc.tar.gz": "359690df63e15260f028d6838f4f5007f828c4a977cc657513b8ab6900f1d126",
+ "dist/2021-09-08/rustc-beta-x86_64-pc-windows-msvc.tar.xz": "6d8d2b9d5964fe690d4f6fd7ee643bce5f049d19e33c7f3b580502ba83ce5ea5",
+ "dist/2021-09-08/rustc-beta-x86_64-unknown-freebsd.tar.gz": "5e47aa933805000f806984b09222808636eddcb58ea0b95913eae6c4f0ce913c",
+ "dist/2021-09-08/rustc-beta-x86_64-unknown-freebsd.tar.xz": "4e01128800f479a96597ce7eee9d2e76a5128ae1c13a4e0e2eb52e36d43cf559",
+ "dist/2021-09-08/rustc-beta-x86_64-unknown-illumos.tar.gz": "51cdd463ec6402dac5a4b0ab3b0e303ad97ba49c2a63e1cfa2d8036d060fd67a",
+ "dist/2021-09-08/rustc-beta-x86_64-unknown-illumos.tar.xz": "498cca6f9826a9180759a0446627e2e6dba50b6bf1051044e6e09dc714d7b3e7",
+ "dist/2021-09-08/rustc-beta-x86_64-unknown-linux-gnu.tar.gz": "59314c4c868e57a76f7cb4dd80cd9a7e6230b87080784db44349420c950efddc",
+ "dist/2021-09-08/rustc-beta-x86_64-unknown-linux-gnu.tar.xz": "8b3e2cdba3ff86144029f7c7446825dff79937ed8a30df15a33a779e9f694227",
+ "dist/2021-09-08/rustc-beta-x86_64-unknown-linux-musl.tar.gz": "56dc8f8914bbe5beaa1e369fdc22d99ef98c9d864e24f5b7d64cf6188c400b1c",
+ "dist/2021-09-08/rustc-beta-x86_64-unknown-linux-musl.tar.xz": "66cf18df72034540d756b29d69a4148123029ff512fc831a786fe15a9641382b",
+ "dist/2021-09-08/rustc-beta-x86_64-unknown-netbsd.tar.gz": "2315fd067e858501b4df44f2a4d042cef3f70b7314ee6cfe24749849b8d386ae",
+ "dist/2021-09-08/rustc-beta-x86_64-unknown-netbsd.tar.xz": "62b429e67f24365963b0744e9b4807ae2cb7aa280a5e425882e4894a2d3225fb",
+ "dist/2021-09-08/rustfmt-nightly-aarch64-apple-darwin.tar.gz": "691922fb32f3da37532bb9be974ad1717af521ec2b71bca4bbb5e57f3c4cc3fa",
+ "dist/2021-09-08/rustfmt-nightly-aarch64-apple-darwin.tar.xz": "2c9667209094b7a603d50d3dc684c505b2ab855c64dcd8b23fe09248a6e13cee",
+ "dist/2021-09-08/rustfmt-nightly-aarch64-pc-windows-msvc.tar.gz": "daee571bf222bb7addf0d495991acf3f5001b69bb97d31bb43f0466b4e43c600",
+ "dist/2021-09-08/rustfmt-nightly-aarch64-pc-windows-msvc.tar.xz": "f6d31e21f798427c5483256d54b25b6dca1d61ff8c601384c62648959ebbce25",
+ "dist/2021-09-08/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.gz": "98b2eaf259a1bfdc70e40a52e891920dec7fc6132ad8d2420f91655c793ea340",
+ "dist/2021-09-08/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.xz": "a97c1c2646f9628fcc92818d21f4925568681976727686701116d0e6a71693a7",
+ "dist/2021-09-08/rustfmt-nightly-aarch64-unknown-linux-musl.tar.gz": "a4df0726fba466a5180471d3e63735c2b5ee9794e9f42026b1e8ae404dd43ab6",
+ "dist/2021-09-08/rustfmt-nightly-aarch64-unknown-linux-musl.tar.xz": "92846ab58a75bddc0270c9f42234a6585edc9a382e2018baa776aa74bb13e444",
+ "dist/2021-09-08/rustfmt-nightly-arm-unknown-linux-gnueabi.tar.gz": "a8dbc2a00d359c95f05b0b3cf08a12b6df9f888157ba57fa9ba4a134cf271075",
+ "dist/2021-09-08/rustfmt-nightly-arm-unknown-linux-gnueabi.tar.xz": "44b17a06b015f9701291cec7e60b0932c5ebc29244f4a6e35736e9f5ccf47c41",
+ "dist/2021-09-08/rustfmt-nightly-arm-unknown-linux-gnueabihf.tar.gz": "ee54b0a25f061c29ea22977c7d36d6fa6bf85abee3b108135b53bcb37028af0b",
+ "dist/2021-09-08/rustfmt-nightly-arm-unknown-linux-gnueabihf.tar.xz": "0a721d2526a78f7e70f9a6c49d156b1c18cd627c066bc8f09b084910864ec252",
+ "dist/2021-09-08/rustfmt-nightly-armv7-unknown-linux-gnueabihf.tar.gz": "584ba68113add6e113cffb5c93a8000cfea16d621ba337dc68cd4d106f5e2759",
+ "dist/2021-09-08/rustfmt-nightly-armv7-unknown-linux-gnueabihf.tar.xz": "e450429fcd37f15b6e200f62d9cb4790b39b7227e0246b667c82fa3b9ecf1b75",
+ "dist/2021-09-08/rustfmt-nightly-i686-pc-windows-gnu.tar.gz": "e0aa68b96699402e7cc09329055826f63ac9899cf22828d56cf393476a70405a",
+ "dist/2021-09-08/rustfmt-nightly-i686-pc-windows-gnu.tar.xz": "6f10f279f81c35c718446e837f5f22fb61841c45f5172abb2d0d4a035065edcd",
+ "dist/2021-09-08/rustfmt-nightly-i686-pc-windows-msvc.tar.gz": "aeb05fcb66830d395bf9a819a05a44f179cad3f35016f76fa60a4959f9e3c69e",
+ "dist/2021-09-08/rustfmt-nightly-i686-pc-windows-msvc.tar.xz": "351ee1490533ac9fa00a21c6db6087cb498b0034cb21358d29a8b944bf0f77e3",
+ "dist/2021-09-08/rustfmt-nightly-i686-unknown-linux-gnu.tar.gz": "418b0481fd2b074e9a0f195b9e07f888652642aced34136044bad997f7500802",
+ "dist/2021-09-08/rustfmt-nightly-i686-unknown-linux-gnu.tar.xz": "90d04308cbfc845462687206bf13182d907afebd02bdf88cca9a27eb8f1e7e28",
+ "dist/2021-09-08/rustfmt-nightly-mips-unknown-linux-gnu.tar.gz": "0d2f54c9927ac9de3c00f8f703d52d8310d1b36baa84dbcddf1159759b4bff06",
+ "dist/2021-09-08/rustfmt-nightly-mips-unknown-linux-gnu.tar.xz": "7f2b33077267e6ae064b12c7d0082115ea7f011f168f0d0e3ad9dc7ac9d39705",
+ "dist/2021-09-08/rustfmt-nightly-mips64-unknown-linux-gnuabi64.tar.gz": "bdc9fa2cdb295e453460f1bf7b12efaa673955c27b01f22df626de989c3e1a28",
+ "dist/2021-09-08/rustfmt-nightly-mips64-unknown-linux-gnuabi64.tar.xz": "bacd376fe18068010ada3e52c531de5a07dcc8232f988feb9e90be59986efb3b",
+ "dist/2021-09-08/rustfmt-nightly-mips64el-unknown-linux-gnuabi64.tar.gz": "fdc93a8295c563be29793d36b6b1e25f579d187b7e234ced6f17b1fe3c1fac02",
+ "dist/2021-09-08/rustfmt-nightly-mips64el-unknown-linux-gnuabi64.tar.xz": "289fd400d4959968c0ffccd787d613943c8534527913d0dbed69e8a7251ca32c",
+ "dist/2021-09-08/rustfmt-nightly-mipsel-unknown-linux-gnu.tar.gz": "2e655b764843cea5f0e70e2a5b2a0f13dd5fa65c4055f42c547e36372af08296",
+ "dist/2021-09-08/rustfmt-nightly-mipsel-unknown-linux-gnu.tar.xz": "07f6657648d1d7033030e9e2d05bfb9ea0022e63ae72320074a3d09ac9639d09",
+ "dist/2021-09-08/rustfmt-nightly-powerpc-unknown-linux-gnu.tar.gz": "b78878ec58d6b932d3d1f8e1fefdb7871b1404c701ab0d2f8645246b458ba650",
+ "dist/2021-09-08/rustfmt-nightly-powerpc-unknown-linux-gnu.tar.xz": "dfa79cb51708794d2c814bff6a60a63ca5358df3670179f9a9ae828811e72ad8",
+ "dist/2021-09-08/rustfmt-nightly-powerpc64-unknown-linux-gnu.tar.gz": "017de1a82a0e3988d1216771082b5d0e3e083dc51d4a0f0266f1e610bac166da",
+ "dist/2021-09-08/rustfmt-nightly-powerpc64-unknown-linux-gnu.tar.xz": "a0a46a62b9af14d2147939967e545ad812d9acebe3d1ed861321a6dfd8d554ca",
+ "dist/2021-09-08/rustfmt-nightly-powerpc64le-unknown-linux-gnu.tar.gz": "54dff0daec5dd2a2ab23cf4e92bf9b2d71839c37144b52e5b5aa899ddf027bda",
+ "dist/2021-09-08/rustfmt-nightly-powerpc64le-unknown-linux-gnu.tar.xz": "e743e45dc695e0bd9a1ce5fdd183f89951a329ec433bb510d37c47b435152a7b",
+ "dist/2021-09-08/rustfmt-nightly-riscv64gc-unknown-linux-gnu.tar.gz": "0e04ae69e03d9e7e8d1d60a265c7ed3c3608a19aaef6ad4aa7ae2b280d3552b8",
+ "dist/2021-09-08/rustfmt-nightly-riscv64gc-unknown-linux-gnu.tar.xz": "6ec865bd38b0fde2c9c823f4cb110b96c2aac4f7976cc2a6be48ffa214aa4bc7",
+ "dist/2021-09-08/rustfmt-nightly-s390x-unknown-linux-gnu.tar.gz": "3b833517415dee73b1e0d381df441a96856e3bac77f101545624c382aad7902c",
+ "dist/2021-09-08/rustfmt-nightly-s390x-unknown-linux-gnu.tar.xz": "7a8a447cc2167d0a998ad3858dfec88beb8658043655087d208affbc94aa3e62",
+ "dist/2021-09-08/rustfmt-nightly-x86_64-apple-darwin.tar.gz": "20de8ad3aa7507dd9657c4a4b959c38cc7f732a87bb757183033f78a96288e45",
+ "dist/2021-09-08/rustfmt-nightly-x86_64-apple-darwin.tar.xz": "99561b207ba61b455d1522d95143ca4ccc6474187be2f38f1ebff2ed63d0092e",
+ "dist/2021-09-08/rustfmt-nightly-x86_64-pc-windows-gnu.tar.gz": "145eb25cc3b295060c5f5a354ea2321cd39df17ea4e3a5c73c3eea105f7454a4",
+ "dist/2021-09-08/rustfmt-nightly-x86_64-pc-windows-gnu.tar.xz": "356ede5cd8a7d51f9e25a54c329b1be1da7d6fe418cbe86fdae9c8bcd9970ac4",
+ "dist/2021-09-08/rustfmt-nightly-x86_64-pc-windows-msvc.tar.gz": "0cc0f10763b73c5e4c8bdcd15a563d7e9d705b192ed6e8edc50dd6a71b874761",
+ "dist/2021-09-08/rustfmt-nightly-x86_64-pc-windows-msvc.tar.xz": "d734aefabe95fa03710dc75e9851c8f2e654f19cec1381ecb18281837d19db38",
+ "dist/2021-09-08/rustfmt-nightly-x86_64-unknown-freebsd.tar.gz": "e1c28472a81312560ca36719f0b61b7212a07d63e85d745f97cd8e3b9ea8f191",
+ "dist/2021-09-08/rustfmt-nightly-x86_64-unknown-freebsd.tar.xz": "4d6a62738f842e54666c608a466c64f896097ffa65d10d30361704e4b8496eed",
+ "dist/2021-09-08/rustfmt-nightly-x86_64-unknown-illumos.tar.gz": "75b21690480f6214ed174ca86297d9a41f37731560adf5782ccd7116b0df583a",
+ "dist/2021-09-08/rustfmt-nightly-x86_64-unknown-illumos.tar.xz": "5c08f45f557da789d39bf203dfbcf2667f4196dedad327a19dc3ad5bb783079d",
+ "dist/2021-09-08/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.gz": "a7d579672b94978e8427584f7e9d2b6534f320719252db46fc6ee85082d646ff",
+ "dist/2021-09-08/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz": "6ffbdb558b9d25e9d923534413b25dc99bb5b9cc92b4774d5255cf70ec20b20d",
+ "dist/2021-09-08/rustfmt-nightly-x86_64-unknown-linux-musl.tar.gz": "fba0e7bc1401b830223b5207b63808e28403f48d1591c7d47c1681519c1883f7",
+ "dist/2021-09-08/rustfmt-nightly-x86_64-unknown-linux-musl.tar.xz": "644b3acc47cd7bbbb5405683ce94e7f32a8313ad265da753026bdb6c3687b608",
+ "dist/2021-09-08/rustfmt-nightly-x86_64-unknown-netbsd.tar.gz": "3f152caa88299ab8aca2c6d39a5e36af995b95e3394c7d514ed94e87f7c61fa3",
+ "dist/2021-09-08/rustfmt-nightly-x86_64-unknown-netbsd.tar.xz": "5f92b4d12a9eaa50b29b81a3dff1959e59966f362b67c346b74403138fdb320d"
}
}
--- /dev/null
+// Check that niche selection prefers zero and that jumps are optimized away.
+// See https://github.com/rust-lang/rust/pull/87794
+// assembly-output: emit-asm
+// only-x86
+// compile-flags: -Copt-level=3
+
+#![crate_type = "lib"]
+
+#[repr(u8)]
+pub enum Size {
+ One = 1,
+ Two = 2,
+ Three = 3,
+}
+
+#[no_mangle]
+pub fn handle(x: Option<Size>) -> u8 {
+ match x {
+ None => 0,
+ Some(size) => size as u8,
+ }
+}
+
+// There should be no jumps in output
+// CHECK-NOT: j
--- /dev/null
+// compile-flags: -Z panic-in-drop=abort -O
+
+// Ensure that unwinding code paths are eliminated from the output after
+// optimization.
+
+#![crate_type = "lib"]
+use std::any::Any;
+use std::mem::forget;
+
+pub struct ExternDrop;
+impl Drop for ExternDrop {
+ #[inline(always)]
+ fn drop(&mut self) {
+ // This call may potentially unwind.
+ extern "Rust" {
+ fn extern_drop();
+ }
+ unsafe {
+ extern_drop();
+ }
+ }
+}
+
+struct AssertNeverDrop;
+impl Drop for AssertNeverDrop {
+ #[inline(always)]
+ fn drop(&mut self) {
+ // This call should be optimized away as unreachable.
+ extern "C" {
+ fn should_not_appear_in_output();
+ }
+ unsafe {
+ should_not_appear_in_output();
+ }
+ }
+}
+
+// CHECK-LABEL: normal_drop
+// CHECK-NOT: should_not_appear_in_output
+#[no_mangle]
+pub fn normal_drop(x: ExternDrop) {
+ let guard = AssertNeverDrop;
+ drop(x);
+ forget(guard);
+}
+
+// CHECK-LABEL: indirect_drop
+// CHECK-NOT: should_not_appear_in_output
+#[no_mangle]
+pub fn indirect_drop(x: Box<dyn Any>) {
+ let guard = AssertNeverDrop;
+ drop(x);
+ forget(guard);
+}
// This fails on lldb 6.0.1 on x86-64 Fedora 28; so ignore Linux for now.
// ignore-linux
+// This started failing in windows too. See https://github.com/rust-lang/rust/issues/88796
+// FIXME: fix and unignore this on windows
+// ignore-windows
+
// compile-flags:-g
// === GDB TESTS ===================================================================================
// ignore-tidy-linelength
// compile-flags:-g
+// This started failing recently. See https://github.com/rust-lang/rust/issues/88796
+// FIXME: fix and unignore this
+// ignore-windows
+
// cdb-command: g
// Note: The natvis used to visualize niche-layout enums don't work correctly in cdb
// min-lldb-version: 310
// min-cdb-version: 10.0.18317.1001
+// This started failing recently. See https://github.com/rust-lang/rust/issues/88796
+// FIXME: fix and unignore this
+// ignore-windows
+
// === GDB TESTS ===================================================================================
// gdb-command: run
-// revisions: rpass1 rpass2
+// revisions: rpass1 rpass2 rpass3 rpass4
// 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)]
-#![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-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
// our dependency tracking. We do this by changing a module's visibility to
// even from an executable. Plain Rust functions are only exported from Rust
// libraries, which our test infrastructure does not support.
-#[cfg(rpass1)]
+#[cfg(any(rpass1,rpass3))]
pub mod mod1 {
#[no_mangle]
pub fn foo() {}
}
-#[cfg(rpass2)]
+#[cfg(any(rpass2,rpass4))]
mod mod1 {
#[no_mangle]
pub fn foo() {}
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
// Change Callee (Function)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_callee_function() {
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_callee_function() {
callee2(1, 2)
}
// Change Argument (Function)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_argument_function() {
callee1(1, 2)
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_argument_function() {
callee1(1, 3)
}
// Change Callee Indirectly (Function)
mod change_callee_indirectly_function {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::callee1 as callee;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::callee2 as callee;
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
pub fn change_callee_indirectly_function() {
callee(1, 2)
}
}
// Change Callee (Method)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_callee_method() {
let s = Struct;
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_callee_method() {
let s = Struct;
s.method2('x', true);
// Change Argument (Method)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_argument_method() {
let s = Struct;
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_argument_method() {
let s = Struct;
s.method1('y', true);
// Change Callee (Method, UFCS)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_ufcs_callee_method() {
let s = Struct;
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_ufcs_callee_method() {
let s = Struct;
Struct::method2(&s, 'x', true);
// Change Argument (Method, UFCS)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_argument_method_ufcs() {
let s = Struct;
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_argument_method_ufcs() {
let s = Struct;
- Struct::method1(&s, 'x', false);
+ Struct::method1(&s, 'x',false);
}
// Change To UFCS
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_to_ufcs() {
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="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
// results in slightly different hir_owner/Mir.
pub fn change_to_ufcs() {
// Change UFCS Callee Indirectly
pub mod change_ufcs_callee_indirectly {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::Struct as Struct;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::Struct2 as Struct;
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[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() {
let s = Struct;
Struct::method1(&s, 'q', false)
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans -Zmir-opt-level=0
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
// Change closure body
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_closure_body() {
let _ = || 1u32;
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_closure_body() {
let _ = || 3u32;
}
// Add parameter
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_parameter() {
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_parameter() {
let x = 0u32;
let _ = |x: u32| x + 1;
// Change parameter pattern
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, typeck, optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_parameter_pattern() {
let _ = |(x,): (u32,)| x;
}
// Add `move` to closure
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_move() {
let _ = move || 1;
}
// Add type ascription to parameter
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_type_ascription_to_parameter() {
- let closure = |x| x + 1u32;
+ let closure = |x | x + 1u32;
let _: u32 = closure(1);
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2", except = "hir_owner_nodes, typeck")]
#[rustc_clean(cfg = "cfail3")]
+#[rustc_clean(cfg = "cfail5", except = "hir_owner_nodes, typeck")]
+#[rustc_clean(cfg = "cfail6")]
pub fn add_type_ascription_to_parameter() {
let closure = |x: u32| x + 1u32;
let _: u32 = closure(1);
// Change parameter type
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_parameter_type() {
let closure = |x: u32| (x as u64) + 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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_parameter_type() {
let closure = |x: u16| (x as u64) + 1;
let _ = closure(1);
// build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// compile-flags: -Z query-dep-graph
#![allow(warnings)]
#![feature(rustc_attrs)]
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans -Zmir-opt-level=0
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
}
// Change field value (struct-like) -----------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_field_value_struct_like() -> Enum {
Enum::Struct {
x: 0,
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[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 {
Enum::Struct {
x: 0,
// Change field order (struct-like) -----------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_field_order_struct_like() -> Enum {
Enum::Struct {
x: 3,
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[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
// would if it were not all constants
pub fn change_field_order_struct_like() -> Enum {
}
// Change constructor path (struct-like) ------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_constructor_path_struct_like() {
- let _ = Enum::Struct {
+ let _ = Enum ::Struct {
x: 0,
y: 1,
z: 2,
};
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[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() {
let _ = Enum2::Struct {
x: 0,
// Change variant (regular struct) ------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_constructor_variant_struct_like() {
- let _ = Enum2::Struct {
+ let _ = Enum2::Struct {
x: 0,
y: 1,
z: 2,
};
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[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() {
let _ = Enum2::Struct2 {
x: 0,
// 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;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::Enum2 as TheEnum;
#[rustc_clean(
typeck"
)]
#[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 {
TheEnum::Struct {
x: 0,
// Change constructor variant indirectly (struct-like) ---------------------------
pub mod change_constructor_variant_indirectly_struct_like {
use super::Enum2;
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::Enum2::Struct as Variant;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::Enum2::Struct2 as Variant;
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
+ #[rustc_clean(cfg="cfail6")]
pub fn function() -> Enum2 {
Variant {
x: 0,
// Change field value (tuple-like) -------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_field_value_tuple_like() -> Enum {
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_field_value_tuple_like() -> Enum {
Enum::Tuple(0, 1, 3)
}
// Change constructor path (tuple-like) --------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(
cfg="cfail2",
except="hir_owner_nodes,optimized_mir,typeck"
)]
#[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() {
let _ = Enum2::Tuple(0, 1, 2);
}
// Change constructor variant (tuple-like) --------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(
cfg="cfail2",
except="hir_owner_nodes,optimized_mir,typeck"
)]
#[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() {
let _ = Enum2::Tuple2(0, 1, 2);
}
// 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;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::Enum2 as TheEnum;
#[rustc_clean(
typeck"
)]
#[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 {
TheEnum::Tuple(0, 1, 2)
}
// Change constructor variant indirectly (tuple-like) ---------------------------
pub mod change_constructor_variant_indirectly_tuple_like {
use super::Enum2;
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::Enum2::Tuple as Variant;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::Enum2::Tuple2 as Variant;
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
+ #[rustc_clean(cfg="cfail6")]
pub fn function() -> Enum2 {
Variant(0, 1, 2)
}
}
// Change constructor path (C-like) --------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_constructor_path_c_like() {
let _x = Clike2::B;
}
// Change constructor variant (C-like) --------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_constructor_variant_c_like() {
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_constructor_variant_c_like() {
let _x = Clike::C;
}
// 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;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::Clike2 as TheEnum;
#[rustc_clean(
typeck"
)]
#[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 {
TheEnum::B
}
// Change constructor variant indirectly (C-like) ---------------------------
pub mod change_constructor_variant_indirectly_c_like {
use super::Clike;
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::Clike::A as Variant;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::Clike::B as Variant;
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
+ #[rustc_clean(cfg="cfail6")]
pub fn function() -> Clike {
Variant
}
// the same between rev2 and rev3.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
// Change enum visibility -----------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumVisibility { A }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
pub enum EnumVisibility {
A
}
// Change name of a c-style variant -------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumChangeNameCStyleVariant {
Variant1,
Variant2,
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumChangeNameCStyleVariant {
Variant1,
Variant2Changed,
// Change name of a tuple-style variant ---------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumChangeNameTupleStyleVariant {
Variant1,
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumChangeNameTupleStyleVariant {
Variant1,
Variant2Changed(u32, f32),
// Change name of a struct-style variant --------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumChangeNameStructStyleVariant {
Variant1,
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumChangeNameStructStyleVariant {
Variant1,
Variant2Changed { a: u32, b: f32 },
// Change the value of a c-style variant --------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumChangeValueCStyleVariant0 {
Variant1,
Variant2 = 11,
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
enum EnumChangeValueCStyleVariant0 {
Variant1,
-
- Variant2 =
- 22,
+ Variant2 = 22,
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumChangeValueCStyleVariant1 {
Variant1,
Variant2,
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumChangeValueCStyleVariant1 {
Variant1,
Variant2 = 11,
// Add a c-style variant ------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumAddCStyleVariant {
Variant1,
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumAddCStyleVariant {
Variant1,
Variant2,
// Remove a c-style variant ---------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumRemoveCStyleVariant {
Variant1,
Variant2,
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumRemoveCStyleVariant {
Variant1,
}
// Add a tuple-style variant --------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumAddTupleStyleVariant {
Variant1,
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumAddTupleStyleVariant {
Variant1,
Variant2(u32, f32),
// Remove a tuple-style variant -----------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumRemoveTupleStyleVariant {
Variant1,
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumRemoveTupleStyleVariant {
Variant1,
}
// Add a struct-style variant -------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumAddStructStyleVariant {
Variant1,
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumAddStructStyleVariant {
Variant1,
Variant2 { a: u32, b: f32 },
// Remove a struct-style variant ----------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumRemoveStructStyleVariant {
Variant1,
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumRemoveStructStyleVariant {
Variant1,
}
// Change the type of a field in a tuple-style variant ------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumChangeFieldTypeTupleStyleVariant {
Variant1(u32, u32),
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
enum EnumChangeFieldTypeTupleStyleVariant {
Variant1(u32,
u64),
// Change the type of a field in a struct-style variant -----------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumChangeFieldTypeStructStyleVariant {
Variant1,
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
enum EnumChangeFieldTypeStructStyleVariant {
Variant1,
Variant2 {
// Change the name of a field in a struct-style variant -----------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumChangeFieldNameStructStyleVariant {
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumChangeFieldNameStructStyleVariant {
Variant1 { a: u32, c: u32 },
}
// Change order of fields in a tuple-style variant ----------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumChangeOrderTupleStyleVariant {
Variant1(u32, u64),
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
enum EnumChangeOrderTupleStyleVariant {
Variant1(
u64,
// Change order of fields in a struct-style variant ---------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumChangeFieldOrderStructStyleVariant {
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumChangeFieldOrderStructStyleVariant {
Variant1 { b: f32, a: u32 },
}
// Add a field to a tuple-style variant ---------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumAddFieldTupleStyleVariant {
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumAddFieldTupleStyleVariant {
Variant1(u32, u32, u32),
}
// Add a field to a struct-style variant --------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumAddFieldStructStyleVariant {
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumAddFieldStructStyleVariant {
Variant1 { a: u32, b: u32, c: u32 },
}
// Add #[must_use] to the enum ------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumAddMustUse {
Variant1,
Variant2,
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
#[must_use]
enum EnumAddMustUse {
Variant1,
// Add #[repr(C)] to the enum -------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumAddReprC {
Variant1,
Variant2,
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="type_of")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="type_of")]
+#[rustc_clean(cfg="cfail6")]
#[repr(C)]
enum EnumAddReprC {
Variant1,
// Change the name of a type parameter ----------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumChangeNameOfTypeParameter<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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumChangeNameOfTypeParameter<T> {
Variant1(T),
}
// Add a type parameter ------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumAddTypeParameter<S> {
Variant1(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="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> {
Variant1(S),
Variant2(T),
// Change the name of a lifetime parameter ------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumChangeNameOfLifetimeParameter<'a> {
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumChangeNameOfLifetimeParameter<'b> {
Variant1(&'b u32),
}
// Add a lifetime parameter ---------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumAddLifetimeParameter<'a> {
Variant1(&'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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,type_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumAddLifetimeParameter<'a, 'b> {
Variant1(&'a u32),
Variant2(&'b u32),
// Add a lifetime bound to a lifetime parameter -------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumAddLifetimeParameterBound<'a, 'b> {
Variant1(&'a 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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumAddLifetimeParameterBound<'a, 'b: 'a> {
Variant1(&'a u32),
Variant2(&'b u32),
}
// Add a lifetime bound to a type parameter -----------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumAddLifetimeBoundToParameter<'a, T> {
Variant1(T),
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of,predicates_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumAddLifetimeBoundToParameter<'a, T: 'a> {
Variant1(T),
Variant2(&'a u32),
// Add a trait bound to a type parameter --------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumAddTraitBound<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="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> {
Variant1(T),
}
// Add a lifetime bound to a lifetime parameter in where clause ---------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumAddLifetimeParameterBoundWhere<'a, 'b> {
Variant1(&'a 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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")]
+#[rustc_clean(cfg="cfail6")]
enum EnumAddLifetimeParameterBoundWhere<'a, 'b> where 'b: 'a {
Variant1(&'a u32),
Variant2(&'b u32),
// Add a lifetime bound to a type parameter in where clause -------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumAddLifetimeBoundToParameterWhere<'a, T> {
Variant1(T),
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="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 {
Variant1(T),
Variant2(&'a u32),
// Add a trait bound to a type parameter in where clause ----------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumAddTraitBoundWhere<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="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 {
Variant1(T),
}
// In an enum with two variants, swap usage of type parameters ----------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumSwapUsageTypeParameters<A, B> {
Variant1 { a: A },
Variant2 { a: B },
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
enum EnumSwapUsageTypeParameters<A, B> {
Variant1 {
a: B
// In an enum with two variants, swap usage of lifetime parameters ------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
enum EnumSwapUsageLifetimeParameters<'a, 'b> {
Variant1 { a: &'a 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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
enum EnumSwapUsageLifetimeParameters<'a, 'b> {
Variant1 {
a: &'b u32
// Change field type in tuple-style variant indirectly by modifying a use statement
mod change_field_type_indirectly_tuple_style {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferencedType1 as FieldType;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedType2 as FieldType;
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
+ #[rustc_clean(cfg="cfail6")]
enum TupleStyle {
Variant1(
FieldType
// Change field type in record-style variant indirectly by modifying a use statement
mod change_field_type_indirectly_struct_style {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferencedType1 as FieldType;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedType2 as FieldType;
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
+ #[rustc_clean(cfg="cfail6")]
enum StructStyle {
Variant1 {
a: FieldType
// Change trait bound of type parameter indirectly by modifying a use statement
mod change_trait_bound_indirectly {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferencedTrait1 as Trait;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedTrait2 as Trait;
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,predicates_of")]
+ #[rustc_clean(cfg="cfail6")]
enum Enum<T: Trait> {
Variant1(T)
}
// Change trait bound of type parameter in where clause indirectly by modifying a use statement
mod change_trait_bound_indirectly_where {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferencedTrait1 as Trait;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedTrait2 as Trait;
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")]
#[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 {
Variant1(T)
}
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
// the hash of the hir_owner_nodes node should change, but not the hash of
// either the hir_owner or the Metadata node.
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn body_not_exported_to_metadata() -> u32 {
1
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[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 {
2
}
// marked as #[inline]. Only the hash of the hir_owner depnode should be
// unaffected by a change to the body.
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
#[inline]
pub fn body_exported_to_metadata_because_of_inline() -> u32 {
1
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
#[inline]
pub fn body_exported_to_metadata_because_of_inline() -> u32 {
2
// generic. Only the hash of the hir_owner depnode should be
// unaffected by a change to the body.
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
#[inline]
pub fn body_exported_to_metadata_because_of_generic() -> u32 {
1
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
#[inline]
pub fn body_exported_to_metadata_because_of_generic() -> u32 {
2
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
#![crate_type = "rlib"]
// Change function name --------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
extern "C" {
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 = "cfail3")]
+#[rustc_clean(cfg = "cfail5", except = "hir_owner")]
+#[rustc_clean(cfg = "cfail6")]
extern "C" {
pub fn change_function_name2(c: i64) -> i32;
}
// Change parameter name -------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
extern "C" {
pub fn change_parameter_name(c: i64) -> i32;
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")]
+#[rustc_clean(cfg = "cfail5")]
+#[rustc_clean(cfg = "cfail6")]
extern "C" {
pub fn change_parameter_name(d: i64) -> i32;
}
// Change parameter type -------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
extern "C" {
pub fn change_parameter_type(c: i64) -> i32;
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")]
+#[rustc_clean(cfg = "cfail5")]
+#[rustc_clean(cfg = "cfail6")]
extern "C" {
pub fn change_parameter_type(c: i32) -> i32;
}
// Change return type ----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
extern "C" {
pub fn change_return_type(c: i32) -> i32;
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")]
+#[rustc_clean(cfg = "cfail5")]
+#[rustc_clean(cfg = "cfail6")]
extern "C" {
- pub fn change_return_type(c: i32) -> i8;
+ pub fn change_return_type(c: i32) -> i8 ;
}
// Add parameter ---------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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 = "cfail3")]
+#[rustc_clean(cfg = "cfail5")]
+#[rustc_clean(cfg = "cfail6")]
extern "C" {
pub fn add_parameter(c: i32, d: i32) -> i32;
}
// Add return type -------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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 = "cfail3")]
+#[rustc_clean(cfg = "cfail5")]
+#[rustc_clean(cfg = "cfail6")]
extern "C" {
pub fn add_return_type(c: i32) -> i32;
}
// Make function variadic ------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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 = "cfail3")]
+#[rustc_clean(cfg = "cfail5")]
+#[rustc_clean(cfg = "cfail6")]
extern "C" {
pub fn make_function_variadic(c: i32, ...);
}
// Change calling convention ---------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
extern "C" {
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 = "cfail3")]
+#[rustc_clean(cfg = "cfail5", except = "hir_owner")]
+#[rustc_clean(cfg = "cfail6")]
extern "rust-call" {
pub fn change_calling_convention(c: i32);
}
// Make function public --------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
extern "C" {
fn make_function_public(c: i32);
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2", except = "hir_owner")]
#[rustc_clean(cfg = "cfail3")]
+#[rustc_clean(cfg = "cfail5", except = "hir_owner")]
+#[rustc_clean(cfg = "cfail6")]
extern "C" {
pub fn make_function_public(c: i32);
}
// Add function ----------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
extern "C" {
pub fn add_function1(c: i32);
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2", except = "hir_owner")]
#[rustc_clean(cfg = "cfail3")]
+#[rustc_clean(cfg = "cfail5", except = "hir_owner")]
+#[rustc_clean(cfg = "cfail6")]
extern "C" {
pub fn add_function1(c: i32);
pub fn add_function2();
}
// Change link-name ------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
#[link(name = "foo")]
extern "C" {
pub fn change_link_name(c: i32);
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")]
+#[rustc_clean(cfg = "cfail5")]
+#[rustc_clean(cfg = "cfail6")]
#[link(name = "bar")]
extern "C" {
pub fn change_link_name(c: i32);
// Indirectly change parameter type --------------------------------------------
mod indirectly_change_parameter_type {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::c_i32 as c_int;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::c_i64 as c_int;
#[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")]
+ #[rustc_clean(cfg = "cfail5")]
+ #[rustc_clean(cfg = "cfail6")]
extern "C" {
pub fn indirectly_change_parameter_type(c: c_int);
}
// Indirectly change return type --------------------------------------------
mod indirectly_change_return_type {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::c_i32 as c_int;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::c_i64 as c_int;
#[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")]
+ #[rustc_clean(cfg = "cfail5")]
+ #[rustc_clean(cfg = "cfail6")]
extern "C" {
pub fn indirectly_change_return_type() -> c_int;
}
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
// Change loop body ------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_loop_body() {
let mut _x = 0;
for _ in 0..1 {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_loop_body() {
let mut _x = 0;
for _ in 0..1 {
// Change iteration variable name ----------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_iteration_variable_name() {
let mut _x = 0;
for _i in 0..1 {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_iteration_variable_name() {
let mut _x = 0;
for _a in 0..1 {
// Change iteration variable pattern -------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_iteration_variable_pattern() {
let mut _x = 0;
- for _i in &[0, 1, 2] {
+ for _i in &[0, 1, 2] {
_x = 1;
break;
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")]
#[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() {
let mut _x = 0;
for &_i in &[0, 1, 2] {
// Change iterable -------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_iterable() {
let mut _x = 0;
for _ in &[0, 1, 2] {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, promoted_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, promoted_mir, optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_iterable() {
let mut _x = 0;
for _ in &[0, 1, 3] {
// Add break -------------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_break() {
let mut _x = 0;
for _ in 0..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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_break() {
let mut _x = 0;
for _ in 0..1 {
// Add loop label --------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_loop_label() {
let mut _x = 0;
- for _ in 0..1 {
+ for _ in 0..1 {
_x = 1;
break;
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label() {
let mut _x = 0;
'label: for _ in 0..1 {
// Add loop label to break -----------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_loop_label_to_break() {
let mut _x = 0;
'label: for _ in 0..1 {
_x = 1;
- break;
+ break ;
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[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() {
let mut _x = 0;
'label: for _ in 0..1 {
// Change break label ----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_break_label() {
let mut _x = 0;
'outer: for _ in 0..1 {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_break_label() {
let mut _x = 0;
'outer: for _ in 0..1 {
// Add loop label to continue --------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_loop_label_to_continue() {
let mut _x = 0;
'label: for _ in 0..1 {
_x = 1;
- continue;
+ continue ;
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[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() {
let mut _x = 0;
'label: for _ in 0..1 {
// Change continue label ----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_continue_label() {
let mut _x = 0;
'outer: for _ in 0..1 {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_continue_label() {
let mut _x = 0;
'outer: for _ in 0..1 {
// Change continue to break ----------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_continue_to_break() {
let mut _x = 0;
for _ in 0..1 {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_continue_to_break() {
let mut _x = 0;
for _ in 0..1 {
_x = 1;
- break;
+ break ;
}
}
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(linkage)]
// Add Parameter ---------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_parameter() {}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(
cfg = "cfail2",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)]
#[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) {}
// Add Return Type -------------------------------------------------------------
-#[cfg(cfail1)]
-pub fn add_return_type() {}
+#[cfg(any(cfail1,cfail4))]
+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 = "cfail3")]
+#[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, optimized_mir")]
+#[rustc_clean(cfg = "cfail6")]
pub fn add_return_type() -> () {}
// Change Parameter Type -------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn type_of_parameter(p: i32) {}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(
cfg = "cfail2",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)]
#[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) {}
// Change Parameter Type Reference ---------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn type_of_parameter_ref(p: &i32) {}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(
cfg = "cfail2",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)]
#[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) {}
// Change Parameter Order ------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn order_of_parameters(p1: i32, p2: i64) {}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(
cfg = "cfail2",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)]
#[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) {}
// Unsafe ----------------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn make_unsafe() {}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(
cfg = "cfail2",
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)]
#[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() {}
// Extern ----------------------------------------------------------------------
-#[cfg(cfail1)]
-pub fn make_extern() {}
+#[cfg(any(cfail1,cfail4))]
+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 = "cfail3")]
+#[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, typeck, fn_sig")]
+#[rustc_clean(cfg = "cfail6")]
pub extern "C" fn make_extern() {}
// Type Parameter --------------------------------------------------------------
-#[cfg(cfail1)]
-pub fn type_parameter() {}
+#[cfg(any(cfail1,cfail4))]
+pub fn type_parameter () {}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(
cfg = "cfail2",
except = "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of"
)]
#[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>() {}
// Lifetime Parameter ----------------------------------------------------------
-#[cfg(cfail1)]
-pub fn lifetime_parameter() {}
+#[cfg(any(cfail1,cfail4))]
+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 = "cfail3")]
+#[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, generics_of,fn_sig")]
+#[rustc_clean(cfg = "cfail6")]
pub fn lifetime_parameter<'a>() {}
// Trait Bound -----------------------------------------------------------------
-#[cfg(cfail1)]
-pub fn trait_bound<T>() {}
+#[cfg(any(cfail1,cfail4))]
+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 = "cfail3")]
pub fn trait_bound<T: Eq>() {}
// Builtin Bound ---------------------------------------------------------------
-#[cfg(cfail1)]
-pub fn builtin_bound<T>() {}
+#[cfg(any(cfail1,cfail4))]
+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 = "cfail3")]
+#[rustc_clean(cfg = "cfail5", except = "hir_owner, hir_owner_nodes, predicates_of")]
+#[rustc_clean(cfg = "cfail6")]
pub fn builtin_bound<T: Send>() {}
// Lifetime Bound --------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn lifetime_bound<'a, T>() {}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(
cfg = "cfail2",
except = "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of,fn_sig"
)]
#[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>() {}
// Second Trait Bound ----------------------------------------------------------
-#[cfg(cfail1)]
-pub fn second_trait_bound<T: Eq>() {}
+#[cfg(any(cfail1,cfail4))]
+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 = "cfail3")]
pub fn second_trait_bound<T: Eq + Clone>() {}
// Second Builtin Bound --------------------------------------------------------
-#[cfg(cfail1)]
-pub fn second_builtin_bound<T: Send>() {}
+#[cfg(any(cfail1,cfail4))]
+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 = "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>() {}
// Second Lifetime Bound -------------------------------------------------------
-#[cfg(cfail1)]
-pub fn second_lifetime_bound<'a, 'b, T: 'a>() {}
+#[cfg(any(cfail1,cfail4))]
+pub fn second_lifetime_bound<'a, 'b, T: 'a >() {}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(
cfg = "cfail2",
except = "hir_owner, hir_owner_nodes, generics_of, type_of, predicates_of,fn_sig"
)]
#[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>() {}
// Inline ----------------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn inline() {}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")]
+#[rustc_clean(cfg = "cfail5")]
+#[rustc_clean(cfg = "cfail6")]
#[inline]
pub fn inline() {}
// Inline Never ----------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
#[inline(always)]
pub fn inline_never() {}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")]
+#[rustc_clean(cfg = "cfail5")]
+#[rustc_clean(cfg = "cfail6")]
#[inline(never)]
pub fn inline_never() {}
// No Mangle -------------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn no_mangle() {}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")]
+#[rustc_clean(cfg = "cfail5")]
+#[rustc_clean(cfg = "cfail6")]
#[no_mangle]
pub fn no_mangle() {}
// Linkage ---------------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn linkage() {}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")]
#[rustc_clean(cfg = "cfail3")]
+#[rustc_clean(cfg = "cfail5")]
+#[rustc_clean(cfg = "cfail6")]
#[linkage = "weak_odr"]
pub fn linkage() {}
// Return Impl Trait -----------------------------------------------------------
-#[cfg(cfail1)]
-pub fn return_impl_trait() -> i32 {
+#[cfg(any(cfail1,cfail4))]
+pub fn return_impl_trait() -> i32 {
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 = "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 {
0
}
// Change Return Impl Trait ----------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_return_impl_trait() -> impl Clone {
0u32
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg = "cfail2")]
#[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
}
pub struct ReferencedType2;
pub mod change_return_type_indirectly {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferencedType1 as ReturnType;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedType2 as ReturnType;
#[rustc_clean(
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)]
#[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 {
ReturnType {}
}
// Change Parameter Type Indirectly --------------------------------------------
pub mod change_parameter_type_indirectly {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferencedType1 as ParameterType;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedType2 as ParameterType;
#[rustc_clean(
except = "hir_owner, hir_owner_nodes, optimized_mir, typeck, fn_sig"
)]
#[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 trait ReferencedTrait2 {}
pub mod change_trait_bound_indirectly {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferencedTrait1 as Trait;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedTrait2 as Trait;
#[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
#[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) {}
}
// 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;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedTrait2 as Trait;
#[rustc_clean(cfg = "cfail2", except = "hir_owner, hir_owner_nodes, predicates_of")]
#[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)
where
T: Trait,
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
-
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
#![crate_type="rlib"]
// Change condition (if)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_condition(x: bool) -> u32 {
- if x {
+ if x {
return 1
}
return 0
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[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 {
if !x {
return 1
}
// Change then branch (if)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_then_branch(x: bool) -> u32 {
if x {
return 1
return 0
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[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 {
if x {
return 2
// Change else branch (if)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_else_branch(x: bool) -> u32 {
if x {
1
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[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 {
if x {
1
// Add else branch (if)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_else_branch(x: bool) -> u32 {
let mut ret = 1;
if x {
ret = 2;
+ /*----*/
}
ret
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[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 {
let mut ret = 1;
// Change condition (if let)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_condition_if_let(x: Option<u32>) -> u32 {
if let Some(_x) = x {
return 1
0
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[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 {
- if let Some(_) = x {
+ if let Some(_ ) = x {
return 1
}
// Change then branch (if let)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_then_branch_if_let(x: Option<u32>) -> u32 {
if let Some(x) = x {
- return x
+ return x //-
}
0
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[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 {
if let Some(x) = x {
return x + 1
// Change else branch (if let)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_else_branch_if_let(x: Option<u32>) -> u32 {
if let Some(x) = x {
x
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[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 {
if let Some(x) = x {
x
// Add else branch (if let)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_else_branch_if_let(x: Option<u32>) -> u32 {
let mut ret = 1;
if let Some(x) = x {
ret = x;
+ /*----*/
}
ret
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[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 {
let mut ret = 1;
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
#![crate_type="rlib"]
// Change simple index
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
fn change_simple_index(slice: &[u32]) -> u32 {
slice[3]
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner_nodes", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
fn change_simple_index(slice: &[u32]) -> u32 {
slice[4]
}
// Change lower bound
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
fn change_lower_bound(slice: &[u32]) -> &[u32] {
&slice[3..5]
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner_nodes", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
fn change_lower_bound(slice: &[u32]) -> &[u32] {
&slice[2..5]
}
// Change upper bound
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
fn change_upper_bound(slice: &[u32]) -> &[u32] {
&slice[3..5]
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner_nodes", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
fn change_upper_bound(slice: &[u32]) -> &[u32] {
&slice[3..7]
}
// Add lower bound
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(cfg="cfail3")]
+#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
fn add_lower_bound(slice: &[u32]) -> &[u32] {
&slice[3..4]
}
// Add upper bound
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(cfg="cfail3")]
+#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
fn add_upper_bound(slice: &[u32]) -> &[u32] {
&slice[3..7]
}
// Change mutability
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
fn change_mutability(slice: &mut [u32]) -> u32 {
(&mut slice[3..5])[0]
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
fn change_mutability(slice: &mut [u32]) -> u32 {
- (&slice[3..5])[0]
+ (& slice[3..5])[0]
}
// Exclusive to inclusive range
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(cfg="cfail3")]
+#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
fn exclusive_to_inclusive_range(slice: &[u32]) -> &[u32] {
&slice[3..=7]
}
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
pub struct Foo;
// Change Method Name -----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl Foo {
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,associated_item_def_ids")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail6")]
pub fn method_name2() { }
}
// Change Method Body -----------------------------------------------------------
//
// This should affect the method itself, but not the impl.
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl Foo {
- pub fn method_body() { }
+ //--------------------------------------------------------------------------------------
+ //--------------------------
+ //--------------------------------------------------------------------------------------
+ //--------------------------
+ pub fn method_body() {
+ // -----------------------
+ }
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
- #[rustc_clean(
- cfg="cfail2",
- except="hir_owner_nodes,optimized_mir,promoted_mir,typeck"
- )]
+ #[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,promoted_mir,typeck")]
#[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() {
println!("Hello, world!");
}
// Change Method Body (inlined) ------------------------------------------------
//
// This should affect the method itself, but not the impl.
-#[cfg(cfail1)]
-impl Foo {
+#[cfg(any(cfail1,cfail4))]
+impl Foo {
+ //------------
+ //---------------
+ //------------------------------------------------------------
+ //
+ //--------------------------
+ //------------
+ //---------------
+ //------------------------------------------------------------
+ //
+ //--------------------------
#[inline]
- pub fn method_body_inlined() { }
+ pub fn method_body_inlined() {
+ // -----------------------
+ }
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
#[rustc_clean(
cfg="cfail2",
except="hir_owner_nodes,optimized_mir,promoted_mir,typeck"
)]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(
+ cfg="cfail5",
+ except="hir_owner_nodes,optimized_mir,promoted_mir,typeck"
+ )]
+ #[rustc_clean(cfg="cfail6")]
#[inline]
pub fn method_body_inlined() {
println!("Hello, world!");
// Change Method Privacy -------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl Foo {
pub fn method_privacy() { }
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
#[rustc_clean(cfg="cfail2", except="associated_item,hir_owner,hir_owner_nodes")]
#[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() { }
}
// Change Method Selfness -----------------------------------------------------------
-#[cfg(cfail1)]
-impl Foo {
+#[cfg(any(cfail1,cfail4))]
+impl Foo {
+ //------------
+ //---------------
+ //---------------------------------------------------------------------------------------------
+ //
+ //--------------------------
+ //------------
+ //---------------
+ //---------------------------------------------------------------------------------------------
+ //
+ //--------------------------
pub fn method_selfness() { }
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
#[rustc_clean(
cfg="cfail2",
except="hir_owner,hir_owner_nodes,fn_sig,generics_of,typeck,associated_item,optimized_mir",
)]
#[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) { }
}
// Change Method Selfmutness ---------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl Foo {
- pub fn method_selfmutness(&self) { }
+ //------------------------------------------------------------------------------------------
+ //--------------------------
+ //------------------------------------------------------------------------------------------
+ //--------------------------
+ pub fn method_selfmutness(& self) { }
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
- #[rustc_clean(
- cfg="cfail2",
- except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir"
- )]
+ #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
#[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) { }
}
// Add Method To Impl ----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl Foo {
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,associated_item_def_ids")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
pub fn add_method_to_impl1(&self) { }
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail6")]
pub fn add_method_to_impl2(&self) { }
}
// Add Method Parameter --------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl Foo {
- pub fn add_method_parameter(&self) { }
+ //------------------------------------------------------------------------------------------
+ //--------------------------
+ //------------------------------------------------------------------------------------------
+ //--------------------------
+ pub fn add_method_parameter(&self ) { }
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
- #[rustc_clean(
- cfg="cfail2",
- except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir"
- )]
+ #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
#[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) { }
}
// Change Method Parameter Name ------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl Foo {
+ //------------------------------------------------------------------
+ //--------------------------
+ //------------------------------------------------------------------
+ //--------------------------
pub fn change_method_parameter_name(&self, a: i64) { }
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[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) { }
}
// Change Method Return Type ---------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl Foo {
+ //------------------------------------------------------------------------------------------
+ //--------------------------
+ //------------------------------------------------------------------------------------------
+ //--------------------------
pub fn change_method_return_type(&self) -> u16 { 0 }
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
- #[rustc_clean(
- cfg="cfail2",
- except="hir_owner,hir_owner_nodes,fn_sig,optimized_mir,typeck")]
+ #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,optimized_mir,typeck")]
#[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] -------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl Foo {
+ //--------------------------
+ //--------------------------
+ //--------------------------
+ //--------------------------
+ //-------
pub fn make_method_inline(&self) -> u8 { 0 }
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
#[inline]
pub fn make_method_inline(&self) -> u8 { 0 }
}
// Change order of parameters -------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl Foo {
+ //------------------------------------------------------------------
+ //--------------------------
+ //------------------------------------------------------------------
+ //--------------------------
pub fn change_method_parameter_order(&self, a: i64, b: i64) { }
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[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) { }
}
// Make method unsafe ----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl Foo {
- pub fn make_method_unsafe(&self) { }
+ //------------------------------------------------------------------------------------------
+ //--------------------------
+ //------------------------------------------------------------------------------------------
+ //--------------------------
+ pub fn make_method_unsafe(&self) { }
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
- #[rustc_clean(
- cfg="cfail2",
- except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir"
- )]
+ #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir")]
#[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) { }
}
// Make method extern ----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl Foo {
- pub fn make_method_extern(&self) { }
+ //----------------------------------------------------------------------------
+ //--------------------------
+ //----------------------------------------------------------------------------
+ //--------------------------
+ pub fn make_method_extern(&self) { }
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck")]
#[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) { }
}
// Change method calling convention --------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl Foo {
- pub extern "C" fn change_method_calling_convention(&self) { }
+ //----------------------------------------------------------------------------
+ //--------------------------
+ //----------------------------------------------------------------------------
+ //--------------------------
+ pub extern "C" fn change_method_calling_convention(&self) { }
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck")]
#[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) { }
}
// Add Lifetime Parameter to Method --------------------------------------------
-#[cfg(cfail1)]
-impl Foo {
- pub fn add_lifetime_parameter_to_method(&self) { }
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(any(cfail1,cfail4))]
+impl Foo {
+ // -----------------------------------------------------
+ // ---------------------------------------------------------
+ // ----------------------------------------------------------
+ // -------------------------------------------------------
+ // -------------------------------------------------------
+ // --------------------------------------------------------
+ // ----------------------------------------------------------
+ // -----------------------------------------------------------
+ // ----------------------------------------------------------
+ // --------------------------------------------------------------------
+ // -------------------------
+ // --------------------------------------------------------------------------------
+ // -------------------------
+ pub fn add_lifetime_parameter_to_method (&self) { }
+}
+
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
// Warning: Note that `typeck` are coming up clean here.
// The addition or removal of lifetime parameters that don't
// `typeck` appear dirty, that might be the cause. -nmatsakis
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig")]
#[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) { }
}
// Add Type Parameter To Method ------------------------------------------------
-#[cfg(cfail1)]
-impl Foo {
- pub fn add_type_parameter_to_method(&self) { }
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(any(cfail1,cfail4))]
+impl Foo {
+ // -----------------------------------------------------
+ // ---------------------------------------------------------------
+ // -------------------------------------------------------------
+ // -----------------------------------------------------
+ // -------------------------------------------------------------
+ // ---------------------------------------------------
+ // ------------------------------------------------------------
+ // ------------------------------------------------------
+ // -------------------------------------------------
+ // -----------
+ // --------------
+ // ----------------------------------------------------------------------
+ //
+ // -------------------------
+ // -----------
+ // --------------
+ // ----------------------------------------------------------------------
+ //
+ // -------------------------
+ pub fn add_type_parameter_to_method (&self) { }
+}
+
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
// Warning: Note that `typeck` are coming up clean here.
// The addition or removal of type parameters that don't appear in
except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of",
)]
#[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) { }
}
// Add Lifetime Bound to Lifetime Parameter of Method --------------------------
-#[cfg(cfail1)]
-impl Foo {
- pub fn add_lifetime_bound_to_lifetime_param_of_method<'a, 'b>(&self) { }
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(any(cfail1,cfail4))]
+impl Foo {
+ //------------
+ //---------------
+ //-----------------------------------------------------------------------------
+ //
+ //--------------------------
+ //------------
+ //---------------
+ //-----------------------------------------------------------------------------
+ //
+ //--------------------------
+ pub fn add_lifetime_bound_to_lifetime_param_of_method<'a, 'b >(&self) { }
+}
+
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
#[rustc_clean(
cfg="cfail2",
except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of,fn_sig"
)]
#[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) { }
}
// Add Lifetime Bound to Type Parameter of Method ------------------------------
-#[cfg(cfail1)]
-impl Foo {
- pub fn add_lifetime_bound_to_type_param_of_method<'a, T>(&self) { }
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(any(cfail1,cfail4))]
+impl Foo {
+ // -----------------------------------------------------
+ // ----------------------------------------------------------
+ // -------------------------------------------------------------
+ // -------------------------------------------------
+ // -------------------------------------------------------------
+ // ---------------------------------------------------
+ // ------------------------------------------------------------
+ // ------------------------------------------------------
+ // -------------------------------------------------
+ // -----------
+ // --------------
+ // ----------------------------------------------------------------------------
+ //
+ // -------------------------
+ // -----------
+ // --------------
+ // ----------------------------------------------------------------------------
+ //
+ // -------------------------
+ pub fn add_lifetime_bound_to_type_param_of_method<'a, T >(&self) { }
+}
+
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
// Warning: Note that `typeck` are coming up clean here.
// The addition or removal of bounds that don't appear in the
// generics before the body, then the `HirId` for things in the
// body will be affected. So if you start to see `typeck`
// appear dirty, that might be the cause. -nmatsakis
- #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,generics_of,predicates_of,\
- type_of,fn_sig")]
+ #[rustc_clean(
+ cfg="cfail2",
+ except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of,fn_sig"
+ )]
#[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) { }
}
// Add Trait Bound to Type Parameter of Method ------------------------------
-#[cfg(cfail1)]
-impl Foo {
- pub fn add_trait_bound_to_type_param_of_method<T>(&self) { }
-}
-
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(any(cfail1,cfail4))]
+impl Foo {
+ // -----------------------------------------------------
+ // ----------------------------------------------------------
+ // -------------------------------------------------------------
+ // -------------------------------------------------
+ // -------------------------------------------------------------
+ // ---------------------------------------------------
+ // ------------------------------------------------------------
+ // ------------------------------------------------------
+ // -------------------------------------------------
+ // ---------------------------------------------------------------------------
+ // -------------------------
+ // ---------------------------------------------------------------------------
+ // -------------------------
+ pub fn add_trait_bound_to_type_param_of_method<T >(&self) { }
+}
+
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
// Warning: Note that `typeck` are coming up clean here.
// The addition or removal of bounds that don't appear in the
// appear dirty, that might be the cause. -nmatsakis
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,predicates_of")]
#[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) { }
}
// Add #[no_mangle] to Method --------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl Foo {
+ //--------------------------
+ //--------------------------
+ //--------------------------
+ //--------------------------
+ //----------
pub fn add_no_mangle_to_method(&self) { }
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl Foo {
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
#[no_mangle]
pub fn add_no_mangle_to_method(&self) { }
}
struct Bar<T>(T);
// Add Type Parameter To Impl --------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl Bar<u32> {
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,generics_of")]
+#[rustc_clean(cfg="cfail6")]
impl<T> Bar<T> {
#[rustc_clean(
cfg="cfail2",
except="generics_of,fn_sig,typeck,type_of,optimized_mir"
)]
#[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) { }
}
// Change Self Type of Impl ----------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl Bar<u32> {
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner")]
+#[rustc_clean(cfg="cfail6")]
impl Bar<u64> {
#[rustc_clean(cfg="cfail2", except="fn_sig,optimized_mir,typeck")]
#[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) { }
}
// Add Lifetime Bound to Impl --------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl<T> Bar<T> {
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl<T: 'static> Bar<T> {
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
pub fn add_lifetime_bound_to_impl_parameter(&self) { }
}
// Add Trait Bound to Impl Parameter -------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl<T> Bar<T> {
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
impl<T: Clone> Bar<T> {
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
pub fn add_trait_bound_to_impl_parameter(&self) { }
}
pub fn instantiation_root() {
Foo::method_privacy();
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
{
Bar(0u32).change_impl_self_type();
}
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
{
Bar(0u64).change_impl_self_type();
}
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
// Change template
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_template(a: i32) -> i32 {
let c: i32;
c
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[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"))]
pub fn change_template(a: i32) -> i32 {
let c: i32;
// Change output
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_output(a: i32) -> i32 {
let mut _out1: i32 = 0;
_out1
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[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"))]
pub fn change_output(a: i32) -> i32 {
let mut _out1: i32 = 0;
// Change input
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_input(_a: i32, _b: i32) -> i32 {
let _out;
_out
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[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"))]
pub fn change_input(_a: i32, _b: i32) -> i32 {
let _out;
// Change input constraint
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_input_constraint(_a: i32, _b: i32) -> i32 {
let _out;
_out
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[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"))]
pub fn change_input_constraint(_a: i32, _b: i32) -> i32 {
let _out;
// Change clobber
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_clobber(_a: i32) -> i32 {
let _out;
llvm_asm!("add 1, $0"
: "=r"(_out)
: "0"(_a)
- :
+ :/*--*/
:
);
}
_out
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[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"))]
pub fn change_clobber(_a: i32) -> i32 {
let _out;
// Change options
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub fn change_options(_a: i32) -> i32 {
let _out;
: "=r"(_out)
: "0"(_a)
:
- :
+ :/*-------*/
);
}
_out
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[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"))]
pub fn change_options(_a: i32) -> i32 {
let _out;
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
-
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
#![crate_type="rlib"]
// Change Name -----------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_name() {
let _x = 2u64;
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,optimized_mir")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_name() {
let _y = 2u64;
}
// Add Type --------------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_type() {
- let _x = 2u32;
+ let _x = 2u32;
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,typeck")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_type() {
let _x: u32 = 2u32;
}
// Change Type -----------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_type() {
let _x: u64 = 2;
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,typeck,optimized_mir")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_type() {
- let _x: u8 = 2;
+ let _x: u8 = 2;
}
// Change Mutability of Reference Type -----------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_mutability_of_reference_type() {
- let _x: &u64;
+ let _x: & u64;
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,typeck,optimized_mir")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
#[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() {
let _x: &mut u64;
}
// Change Mutability of Slot ---------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_mutability_of_slot() {
let mut _x: u64 = 0;
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,typeck,optimized_mir")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
#[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() {
- let _x: u64 = 0;
+ let _x: u64 = 0;
}
// Change Simple Binding to Pattern --------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_simple_binding_to_pattern() {
- let _x = (0u8, 'x');
+ let _x = (0u8, 'x');
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,typeck,optimized_mir")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
#[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() {
let (_a, _b) = (0u8, 'x');
}
// Change Name in Pattern ------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_name_in_pattern() {
let (_a, _b) = (1u8, 'y');
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,optimized_mir")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_name_in_pattern() {
let (_a, _c) = (1u8, 'y');
}
// Add `ref` in Pattern --------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_ref_in_pattern() {
- let (_a, _b) = (1u8, 'y');
+ let ( _a, _b) = (1u8, 'y');
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,typeck,optimized_mir")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
#[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() {
let (ref _a, _b) = (1u8, 'y');
}
// Add `&` in Pattern ----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_amp_in_pattern() {
- let (_a, _b) = (&1u8, 'y');
+ let ( _a, _b) = (&1u8, 'y');
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,typeck,optimized_mir")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
#[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() {
let (&_a, _b) = (&1u8, 'y');
}
// Change Mutability of Binding in Pattern -------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_mutability_of_binding_in_pattern() {
- let (_a, _b) = (99u8, 'q');
+ let ( _a, _b) = (99u8, 'q');
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,typeck,optimized_mir")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
#[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() {
let (mut _a, _b) = (99u8, 'q');
}
// Add Initializer -------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_initializer() {
- let _x: i16;
+ let _x: i16 ;
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,typeck,optimized_mir")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_initializer() {
let _x: i16 = 3i16;
}
// Change Initializer ----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_initializer() {
let _x = 4u16;
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,optimized_mir")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_initializer() {
let _x = 5u16;
}
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
// Change loop body
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_loop_body() {
let mut _x = 0;
loop {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_loop_body() {
let mut _x = 0;
loop {
// Add break
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_break() {
let mut _x = 0;
loop {
_x = 1;
+ //----
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_break() {
let mut _x = 0;
loop {
// Add loop label
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_loop_label() {
let mut _x = 0;
- loop {
+ /*---*/ loop {
_x = 1;
break;
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label() {
let mut _x = 0;
'label: loop {
// Add loop label to break
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_loop_label_to_break() {
let mut _x = 0;
'label: loop {
_x = 1;
- break;
+ break ;
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label_to_break() {
let mut _x = 0;
'label: loop {
// Change break label
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_break_label() {
let mut _x = 0;
'outer: loop {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_break_label() {
let mut _x = 0;
'outer: loop {
// Add loop label to continue
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_loop_label_to_continue() {
let mut _x = 0;
'label: loop {
_x = 1;
- continue;
+ continue ;
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[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() {
let mut _x = 0;
'label: loop {
// Change continue label
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_continue_label() {
let mut _x = 0;
'outer: loop {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, typeck")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, typeck, optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_continue_label() {
let mut _x = 0;
'outer: loop {
// Change continue to break
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_continue_to_break() {
let mut _x = 0;
loop {
}
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, typeck, optimized_mir")]
#[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() {
let mut _x = 0;
loop {
_x = 1;
- break;
+ break ;
}
}
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
-
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
#![crate_type="rlib"]
// Add Arm ---------------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_arm(x: u32) -> u32 {
match x {
0 => 0,
1 => 1,
+ /*---*/
_ => 100,
}
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,optimized_mir,typeck")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[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 {
match x {
0 => 0,
// Change Order Of Arms --------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_order_of_arms(x: u32) -> u32 {
match x {
0 => 0,
}
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,optimized_mir")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[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 {
match x {
1 => 1,
// Add Guard Clause ------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_guard_clause(x: u32, y: bool) -> u32 {
match x {
0 => 0,
- 1 => 1,
+ 1 => 1,
_ => 100,
}
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,optimized_mir,typeck")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[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 {
match x {
0 => 0,
// Change Guard Clause ------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_guard_clause(x: u32, y: bool) -> u32 {
match x {
0 => 0,
- 1 if y => 1,
+ 1 if y => 1,
_ => 100,
}
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,optimized_mir,typeck")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[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 {
match x {
0 => 0,
// Add @-Binding ---------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_at_binding(x: u32) -> u32 {
match x {
0 => 0,
1 => 1,
- _ => x,
+ _ => x,
}
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,optimized_mir,typeck")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[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 {
match x {
0 => 0,
// Change Name of @-Binding ----------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_name_of_at_binding(x: u32) -> u32 {
match x {
0 => 0,
}
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,optimized_mir")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[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 {
match x {
0 => 0,
// Change Simple Binding To Pattern --------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_simple_name_to_pattern(x: u32) -> u32 {
match (x, x & 1) {
(0, 0) => 0,
- a => 1,
+ a => 1,
}
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,optimized_mir,typeck")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[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 {
match (x, x & 1) {
(0, 0) => 0,
// Change Name In Pattern ------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_name_in_pattern(x: u32) -> u32 {
match (x, x & 1) {
(a, 0) => 0,
}
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,optimized_mir")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[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 {
match (x, x & 1) {
(b, 0) => 0,
// Change Mutability Of Binding In Pattern -------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_mutability_of_binding_in_pattern(x: u32) -> u32 {
match (x, x & 1) {
- (a, 0) => 0,
+ ( a, 0) => 0,
_ => 1,
}
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,optimized_mir,typeck")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[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 {
match (x, x & 1) {
(mut a, 0) => 0,
// Add `ref` To Binding In Pattern -------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_ref_to_binding_in_pattern(x: u32) -> u32 {
match (x, x & 1) {
- (a, 0) => 0,
+ ( a, 0) => 0,
_ => 1,
}
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,optimized_mir,typeck")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[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 {
match (x, x & 1) {
(ref a, 0) => 0,
// Add `&` To Binding In Pattern -------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_amp_to_binding_in_pattern(x: u32) -> u32 {
match (&x, x & 1) {
- (a, 0) => 0,
+ ( a, 0) => 0,
_ => 1,
}
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
-except="hir_owner_nodes,optimized_mir,typeck")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[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 {
match (&x, x & 1) {
(&a, 0) => 0,
// Change RHS Of Arm -----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_rhs_of_arm(x: u32) -> u32 {
match x {
0 => 0,
}
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,optimized_mir")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[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 {
match x {
0 => 0,
// Add Alternative To Arm ------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_alternative_to_arm(x: u32) -> u32 {
match x {
- 0 => 0,
+ 0 => 0,
1 => 1,
_ => 2,
}
}
-#[cfg(not(cfail1))]
-#[rustc_clean(cfg="cfail2",
- except="hir_owner_nodes,optimized_mir,typeck")]
+#[cfg(not(any(cfail1,cfail4)))]
+#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[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 {
match x {
0 | 7 => 0,
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
// Change static visibility
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
pub static STATIC_VISIBILITY: u8 = 0;
// Change static mutability
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
static mut STATIC_MUTABILITY: u8 = 0;
// Add linkage attribute
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
static STATIC_LINKAGE: u8 = 0;
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
#[linkage="weak_odr"]
static STATIC_LINKAGE: u8 = 0;
// Add no_mangle attribute
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
static STATIC_NO_MANGLE: u8 = 0;
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
#[no_mangle]
static STATIC_NO_MANGLE: u8 = 0;
// Add thread_local attribute
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
static STATIC_THREAD_LOCAL: u8 = 0;
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
#[thread_local]
static STATIC_THREAD_LOCAL: u8 = 0;
// Change type from i16 to u64
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes,type_of")]
+#[rustc_clean(cfg="cfail6")]
static STATIC_CHANGE_TYPE_1: u64 = 0;
// Change type from Option<i8> to Option<u16>
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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="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;
// Change value between simple literals
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
static STATIC_CHANGE_VALUE_1: i16 = {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
{ 1 }
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
{ 2 }
};
// Change value between expressions
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
static STATIC_CHANGE_VALUE_2: i16 = {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
{ 1 + 1 }
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
{ 1 + 2 }
};
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
static STATIC_CHANGE_VALUE_3: i16 = {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
{ 2 + 3 }
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
{ 2 * 3 }
};
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
static STATIC_CHANGE_VALUE_4: i16 = {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
{ 1 + 2 * 3 }
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
{ 1 + 2 * 4 }
};
struct ReferencedType2;
mod static_change_type_indirectly {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferencedType1 as Type;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedType2 as Type;
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[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;
#[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,type_of")]
#[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;
}
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
}
// Change field value (regular struct)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_field_value_regular_struct() -> RegularStruct {
RegularStruct {
x: 0,
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")]
#[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 {
RegularStruct {
x: 0,
// Change field order (regular struct)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_field_order_regular_struct() -> RegularStruct {
RegularStruct {
x: 3,
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[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 {
RegularStruct {
y: 4,
// Add field (regular struct)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_field_regular_struct() -> RegularStruct {
let struct1 = RegularStruct {
x: 3,
RegularStruct {
x: 7,
+ // --
.. struct1
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[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 {
let struct1 = RegularStruct {
x: 3,
// Change field label (regular struct)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_field_label_regular_struct() -> RegularStruct {
let struct1 = RegularStruct {
x: 3,
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[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 {
let struct1 = RegularStruct {
x: 3,
}
// Change constructor path (regular struct)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_constructor_path_regular_struct() {
- let _ = RegularStruct {
+ let _ = RegularStruct {
x: 0,
y: 1,
z: 2,
};
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_constructor_path_regular_struct() {
let _ = RegularStruct2 {
x: 0,
// 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;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::RegularStruct2 as Struct;
#[rustc_clean(
except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,typeck"
)]
#[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 {
Struct {
x: 0,
pub struct TupleStruct(i32, i64, i16);
// Change field value (tuple struct)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_field_value_tuple_struct() -> TupleStruct {
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_field_value_tuple_struct() -> TupleStruct {
TupleStruct(0, 1, 3)
}
pub struct TupleStruct2(u16, u16, u16);
// Change constructor path (tuple struct)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_constructor_path_tuple_struct() {
let _ = TupleStruct2(0, 1, 2);
}
// 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;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
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(
cfg="cfail2",
except="fn_sig,hir_owner,hir_owner_nodes,optimized_mir,typeck"
// the same between rev2 and rev3.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
-
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
#![crate_type="rlib"]
// Layout ----------------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub struct LayoutPacked;
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="type_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="type_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
#[repr(packed)]
pub struct LayoutPacked;
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
struct LayoutC;
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="type_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="type_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
#[repr(C)]
struct LayoutC;
// Tuple Struct Change Field Type ----------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
struct TupleStructFieldType(i32);
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
#[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
// adding/removing fields or changing a fields name or visibility does.
struct TupleStructFieldType(
// Tuple Struct Add Field ------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
struct TupleStructAddField(
i32,
u32
// Tuple Struct Field Visibility -----------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
struct TupleStructFieldVisibility(pub char);
// Record Struct Field Type ----------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
struct RecordStructFieldType { x: f32 }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
#[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
// adding/removing fields or changing a fields name or visibility does.
struct RecordStructFieldType {
// Record Struct Field Name ----------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
struct RecordStructFieldName { y: f32 }
// Record Struct Add Field -----------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
struct RecordStructAddField {
x: f32,
y: () }
// Record Struct Field Visibility ----------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
struct RecordStructFieldVisibility {
pub x: f32
}
// Add Lifetime Parameter ------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(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);
// Add Lifetime Parameter Bound ------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
struct AddLifetimeParameterBound<'a, 'b: 'a>(
&'a f32,
&'b f64
);
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
struct AddLifetimeParameterBoundWhereClause<'a, 'b>(
&'a f32,
&'b f64)
// Add Type Parameter ----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(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>(
// The field contains the parent's Generics, so it's dirty even though its
// type hasn't changed.
// Add Type Parameter Bound ----------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
struct AddTypeParameterBound<T: Send>(
T
);
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
struct AddTypeParameterBoundWhereClause<T>(
T
) where T: Sync;
// Note: there is no #[cfg(...)], so this is ALWAYS compiled
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
pub struct EmptyStruct;
// Visibility ------------------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
struct Visibility;
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
pub struct Visibility;
struct ReferencedType1;
// Tuple Struct Change Field Type Indirectly -----------------------------------
mod tuple_struct_change_field_type_indirectly {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferencedType1 as FieldType;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedType2 as FieldType;
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
struct TupleStruct(
FieldType
);
// Record Struct Change Field Type Indirectly -----------------------------------
mod record_struct_change_field_type_indirectly {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferencedType1 as FieldType;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedType2 as FieldType;
#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
struct RecordStruct {
_x: FieldType
}
// Change Trait Bound Indirectly -----------------------------------------------
mod change_trait_bound_indirectly {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferencedTrait1 as Trait;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedTrait2 as Trait;
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[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);
}
// 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;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedTrait2 as Trait;
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[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;
}
// the same between rev2 and rev3.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
// Change trait visibility
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitVisibility { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
pub trait TraitVisibility { }
// Change trait unsafety
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitUnsafety { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
unsafe trait TraitUnsafety { }
// Add method
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddMethod {
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,associated_item_def_ids,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
pub trait TraitAddMethod {
fn method();
}
// Change name of method
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitChangeMethodName {
fn method();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitChangeMethodName {
fn methodChanged();
}
// Add return type to method
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddReturnType {
- fn method();
+ //-----------------------------------------------------
+ //--------------------------
+ //-----------------------------------------------------
+ //--------------------------
+ fn method() ;
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddReturnType {
#[rustc_clean(except="hir_owner,fn_sig", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,fn_sig", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method() -> u32;
}
// Change return type of method
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitChangeReturnType {
+ // --------------------------------------------------------------------
+ // -------------------------
+ // --------------------------------------------------------------------
+ // -------------------------
fn method() -> u32;
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitChangeReturnType {
#[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method() -> u64;
}
// Add parameter to method
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddParameterToMethod {
- fn method();
+ // ----------------------------------------------------
+ // -------------------------
+ // ----------------------------------------------------
+ // -------------------------
+ fn method( );
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddParameterToMethod {
#[rustc_clean(except="hir_owner,fn_sig", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,fn_sig", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method(a: u32);
}
// Change name of method parameter
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitChangeMethodParameterName {
+ //------------------------------------------------------
+ //----------------------------------------------
+ //--------------------------
+ //----------------------------------------------
+ //--------------------------
fn method(a: u32);
+
+ //------------------------------------------------------------------
+ //--------------------------
+ //------------------------------------------------------------------
+ //--------------------------
fn with_default(x: i32) {}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitChangeMethodParameterName {
// FIXME(#38501) This should preferably always be clean.
#[rustc_clean(except="hir_owner", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method(b: u32);
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn with_default(y: i32) {}
}
// Change type of method parameter (i32 => i64)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitChangeMethodParameterType {
+ // ----------------------------------------------------
+ // -------------------------
+ // ----------------------------------------------------
+ // -------------------------
fn method(a: i32);
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitChangeMethodParameterType {
#[rustc_clean(except="hir_owner,fn_sig", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,fn_sig", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method(a: i64);
}
// Change type of method parameter (&i32 => &mut i32)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitChangeMethodParameterTypeRef {
- fn method(a: &i32);
+ // ----------------------------------------------------
+ // -------------------------
+ // ----------------------------------------------------
+ // -------------------------
+ fn method(a: & i32);
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitChangeMethodParameterTypeRef {
#[rustc_clean(except="hir_owner,fn_sig", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,fn_sig", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method(a: &mut i32);
}
// Change order of method parameters
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitChangeMethodParametersOrder {
+ // ----------------------------------------------------
+ // -------------------------
+ // ----------------------------------------------------
+ // -------------------------
fn method(a: i32, b: i64);
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitChangeMethodParametersOrder {
#[rustc_clean(except="hir_owner,fn_sig", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,fn_sig", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method(b: i64, a: i32);
}
// Add default implementation to method
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddMethodAutoImplementation {
fn method();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddMethodAutoImplementation {
#[rustc_clean(except="hir_owner,associated_item", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,associated_item", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method() { }
}
// Change order of methods
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitChangeOrderOfMethods {
fn method0();
fn method1();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitChangeOrderOfMethods {
fn method1();
fn method0();
// Change mode of self parameter
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitChangeModeSelfRefToMut {
- fn method(&self);
+ // ----------------------------------------------------
+ // -------------------------
+ // ----------------------------------------------------
+ // -------------------------
+ fn method(& self);
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitChangeModeSelfRefToMut {
#[rustc_clean(except="hir_owner,fn_sig", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,fn_sig", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method(&mut self);
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitChangeModeSelfOwnToMut: Sized {
- fn method(self) {}
+ // ----------------------------------------------------------------------------------
+ // -------------------------
+ // ----------------------------------------------------------------------------------
+ // -------------------------
+ fn method( self) {}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitChangeModeSelfOwnToMut: Sized {
#[rustc_clean(except="hir_owner,hir_owner_nodes,typeck,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,hir_owner_nodes,typeck,optimized_mir", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method(mut self) {}
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitChangeModeSelfOwnToRef {
- fn method(self);
+ // ----------------------------------------------------------------
+ // -------------------------
+ // ----------------------------------------------------------------
+ // -------------------------
+ fn method( self);
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitChangeModeSelfOwnToRef {
#[rustc_clean(except="hir_owner,fn_sig,generics_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,fn_sig,generics_of", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method(&self);
}
// Add unsafe modifier to method
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddUnsafeModifier {
- fn method();
+ // ----------------------------------------------------
+ // -------------------------
+ // ----------------------------------------------------
+ // -------------------------
+ fn method() ;
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddUnsafeModifier {
#[rustc_clean(except="hir_owner,fn_sig", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,fn_sig", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
unsafe fn method();
}
// Add extern modifier to method
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddExternModifier {
- fn method();
+ // ----------------------------------------------------
+ // -------------------------
+ // ----------------------------------------------------
+ // -------------------------
+ fn method() ;
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddExternModifier {
#[rustc_clean(except="hir_owner,fn_sig", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,fn_sig", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
extern "C" fn method();
}
// Change extern "C" to extern "stdcall"
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitChangeExternCToRustIntrinsic {
- extern "C" fn method();
+ // ----------------------------------------------------
+ // -------------------------
+ // ----------------------------------------------------
+ // -------------------------
+ extern "C" fn method();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitChangeExternCToRustIntrinsic {
#[rustc_clean(except="hir_owner,fn_sig", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,fn_sig", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
extern "stdcall" fn method();
}
// Add type parameter to method
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddTypeParameterToMethod {
- fn method();
+ // -------------------------------------------------------------------------------
+ // -------------------------
+ // -------------------------------------------------------------------------------
+ // -------------------------
+ fn method ();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddTypeParameterToMethod {
#[rustc_clean(except="hir_owner,generics_of,predicates_of,type_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,generics_of,predicates_of,type_of", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method<T>();
}
// Add lifetime parameter to method
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddLifetimeParameterToMethod {
- fn method();
+ // ----------------------------------------------------------------
+ // -------------------------
+ // ----------------------------------------------------------------
+ // -------------------------
+ fn method ();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddLifetimeParameterToMethod {
#[rustc_clean(except="hir_owner,fn_sig,generics_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,fn_sig,generics_of", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method<'a>();
}
trait ReferencedTrait1 { }
// Add trait bound to method type parameter
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddTraitBoundToMethodTypeParameter {
- fn method<T>();
+ // ---------------------------------------------------------------------------
+ // -------------------------
+ // ---------------------------------------------------------------------------
+ // -------------------------
+ fn method<T >();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddTraitBoundToMethodTypeParameter {
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method<T: ReferencedTrait0>();
}
// Add builtin bound to method type parameter
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddBuiltinBoundToMethodTypeParameter {
- fn method<T>();
+ // ---------------------------------------------------------------------------
+ // -------------------------
+ // ---------------------------------------------------------------------------
+ // -------------------------
+ fn method<T >();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddBuiltinBoundToMethodTypeParameter {
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method<T: Sized>();
}
// Add lifetime bound to method lifetime parameter
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddLifetimeBoundToMethodLifetimeParameter {
- fn method<'a, 'b>(a: &'a u32, b: &'b u32);
-}
-
-#[cfg(not(cfail1))]
+ // -----------
+ // -----------------------------------------------------------------------------
+ // --------------
+ //
+ // -------------------------
+ // -----------
+ // -----------------------------------------------------------------------------
+ // --------------
+ //
+ // -------------------------
+ fn method<'a, 'b >(a: &'a u32, b: &'b u32);
+}
+
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddLifetimeBoundToMethodLifetimeParameter {
#[rustc_clean(
except="hir_owner,hir_owner_nodes,generics_of,predicates_of,fn_sig,type_of",
cfg="cfail2",
)]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(
+ except="hir_owner,hir_owner_nodes,generics_of,predicates_of,fn_sig,type_of",
+ cfg="cfail5",
+ )]
+ #[rustc_clean(cfg="cfail6")]
fn method<'a, 'b: 'a>(a: &'a u32, b: &'b u32);
}
// Add second trait bound to method type parameter
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddSecondTraitBoundToMethodTypeParameter {
- fn method<T: ReferencedTrait0>();
+ // ---------------------------------------------------------------------------
+ // -------------------------
+ // ---------------------------------------------------------------------------
+ // -------------------------
+ fn method<T: ReferencedTrait0 >();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddSecondTraitBoundToMethodTypeParameter {
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method<T: ReferencedTrait0 + ReferencedTrait1>();
}
// Add second builtin bound to method type parameter
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddSecondBuiltinBoundToMethodTypeParameter {
- fn method<T: Sized>();
+ // ---------------------------------------------------------------------------
+ // -------------------------
+ // ---------------------------------------------------------------------------
+ // -------------------------
+ fn method<T: Sized >();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddSecondBuiltinBoundToMethodTypeParameter {
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method<T: Sized + Sync>();
}
// Add second lifetime bound to method lifetime parameter
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter {
- fn method<'a, 'b, 'c: 'a>(a: &'a u32, b: &'b u32, c: &'c u32);
-}
-
-#[cfg(not(cfail1))]
+ // -----------
+ // -----------------------------------------------------------------------------
+ // --------------
+ //
+ // -------------------------
+ // -----------
+ // -----------------------------------------------------------------------------
+ // --------------
+ //
+ // -------------------------
+ fn method<'a, 'b, 'c: 'a >(a: &'a u32, b: &'b u32, c: &'c u32);
+}
+
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter {
#[rustc_clean(
except="hir_owner,hir_owner_nodes,generics_of,predicates_of,fn_sig,type_of",
cfg="cfail2",
)]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(
+ except="hir_owner,hir_owner_nodes,generics_of,predicates_of,fn_sig,type_of",
+ cfg="cfail5",
+ )]
+ #[rustc_clean(cfg="cfail6")]
fn method<'a, 'b, 'c: 'a + 'b>(a: &'a u32, b: &'b u32, c: &'c u32);
}
// Add associated type
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddAssociatedType {
-
- #[rustc_clean(except="hir_owner", cfg="cfail2")]
- #[rustc_clean(cfg="cfail3")]
+ //--------------------------
+ //--------------------------
+ // -------------
+
+ //--------------------------
+ //--------------------------
+ //--------------------------
+ //--------------------------
fn method();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddAssociatedType {
+ #[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail6")]
type Associated;
+ #[rustc_clean(cfg="cfail2")]
+ #[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method();
}
// Add trait bound to associated type
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddTraitBoundToAssociatedType {
- type Associated;
+ // ---------------------------------------------
+ // -------------------------
+ // ---------------------------------------------
+ // -------------------------
+ type Associated ;
fn method();
}
// Apparently the type bound contributes to the predicates of the trait, but
// does not change the associated item itself.
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddTraitBoundToAssociatedType {
#[rustc_clean(except="hir_owner", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
type Associated: ReferencedTrait0;
fn method();
// Add lifetime bound to associated type
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddLifetimeBoundToAssociatedType<'a> {
- type Associated;
+ // ---------------------------------------------
+ // -------------------------
+ // ---------------------------------------------
+ // -------------------------
+ type Associated ;
fn method();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddLifetimeBoundToAssociatedType<'a> {
#[rustc_clean(except="hir_owner", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
type Associated: 'a;
fn method();
// Add default to associated type
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddDefaultToAssociatedType {
type Associated;
fn method();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddDefaultToAssociatedType {
#[rustc_clean(except="hir_owner,associated_item", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,associated_item", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
type Associated = ReferenceType0;
fn method();
// Add associated constant
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddAssociatedConstant {
fn method();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddAssociatedConstant {
const Value: u32;
// Add initializer to associated constant
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddInitializerToAssociatedConstant {
const Value: u32;
fn method();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddInitializerToAssociatedConstant {
#[rustc_clean(except="hir_owner,associated_item", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,associated_item", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
const Value: u32 = 1;
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method();
}
// Change type of associated constant
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitChangeTypeOfAssociatedConstant {
+ // -----------------------------------------------------
+ // -------------------------
+ // -----------------------------------------------------
+ // -------------------------
const Value: u32;
+ // -------------------------
+ // -------------------------
+ // -------------------------
+ // -------------------------
fn method();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitChangeTypeOfAssociatedConstant {
#[rustc_clean(except="hir_owner,type_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,type_of", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
const Value: f64;
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method();
}
// Add super trait
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddSuperTrait { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddSuperTrait : ReferencedTrait0 { }
// Add builtin bound (Send or Copy)
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddBuiltiBound { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddBuiltiBound : Send { }
// Add 'static lifetime bound to trait
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddStaticLifetimeBound { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddStaticLifetimeBound : 'static { }
// Add super trait as second bound
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddTraitAsSecondBound : ReferencedTrait0 { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddTraitAsSecondBound : ReferencedTrait0 + ReferencedTrait1 { }
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddTraitAsSecondBoundFromBuiltin : Send { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddTraitAsSecondBoundFromBuiltin : Send + ReferencedTrait0 { }
// Add builtin bound as second bound
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddBuiltinBoundAsSecondBound : ReferencedTrait0 { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddBuiltinBoundAsSecondBound : ReferencedTrait0 + Send { }
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin : Send { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin: Send + Copy { }
// Add 'static bounds as second bound
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddStaticBoundAsSecondBound : ReferencedTrait0 { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddStaticBoundAsSecondBound : ReferencedTrait0 + 'static { }
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddStaticBoundAsSecondBoundFromBuiltin : Send { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddStaticBoundAsSecondBoundFromBuiltin : Send + 'static { }
// Add type parameter to trait
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddTypeParameterToTrait { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,generics_of,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,generics_of,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddTypeParameterToTrait<T> { }
// Add lifetime parameter to trait
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddLifetimeParameterToTrait { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,generics_of,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,generics_of,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddLifetimeParameterToTrait<'a> { }
// Add trait bound to type parameter of trait
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddTraitBoundToTypeParameterOfTrait<T> { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddTraitBoundToTypeParameterOfTrait<T: ReferencedTrait0> { }
// Add lifetime bound to type parameter of trait
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddLifetimeBoundToTypeParameterOfTrait<'a, T> { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddLifetimeBoundToTypeParameterOfTrait<'a, T: 'a> { }
// Add lifetime bound to lifetime parameter of trait
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddLifetimeBoundToLifetimeParameterOfTrait<'a, 'b> { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddLifetimeBoundToLifetimeParameterOfTrait<'a: 'b, 'b> { }
// Add builtin bound to type parameter of trait
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddBuiltinBoundToTypeParameterOfTrait<T> { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddBuiltinBoundToTypeParameterOfTrait<T: Send> { }
// Add second type parameter to trait
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddSecondTypeParameterToTrait<T> { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddSecondTypeParameterToTrait<T, S> { }
// Add second lifetime parameter to trait
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddSecondLifetimeParameterToTrait<'a> { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddSecondLifetimeParameterToTrait<'a, 'b> { }
// Add second trait bound to type parameter of trait
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddSecondTraitBoundToTypeParameterOfTrait<T: ReferencedTrait0> { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddSecondTraitBoundToTypeParameterOfTrait<T: ReferencedTrait0 + ReferencedTrait1> { }
// Add second lifetime bound to type parameter of trait
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait<'a, 'b, T: 'a> { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait<'a, 'b, T: 'a + 'b> { }
// Add second lifetime bound to lifetime parameter of trait
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait<'a: 'b, 'b, 'c> { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait<'a: 'b + 'c, 'b, 'c> { }
// Add second builtin bound to type parameter of trait
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait<T: Send> { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait<T: Send + Sync> { }
// Add trait bound to type parameter of trait in where clause
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddTraitBoundToTypeParameterOfTraitWhere<T> { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddTraitBoundToTypeParameterOfTraitWhere<T> where T: ReferencedTrait0 { }
// Add lifetime bound to type parameter of trait in where clause
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere<'a, T> { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere<'a, T> where T: 'a { }
// Add lifetime bound to lifetime parameter of trait in where clause
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b> { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b> where 'a: 'b { }
// Add builtin bound to type parameter of trait in where clause
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere<T> { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere<T> where T: Send { }
// Add second trait bound to type parameter of trait in where clause
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere<T> where T: ReferencedTrait0 { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere<T>
where T: ReferencedTrait0 + ReferencedTrait1 { }
// Add second lifetime bound to type parameter of trait in where clause
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere<'a, 'b, T> where T: 'a { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere<'a, 'b, T> where T: 'a + 'b { }
// Add second lifetime bound to lifetime parameter of trait in where clause
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b, 'c> where 'a: 'b { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b, 'c> where 'a: 'b + 'c { }
// Add second builtin bound to type parameter of trait in where clause
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere<T> where T: Send { }
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere<T> where T: Send + Sync { }
// Change return type of method indirectly by modifying a use statement
mod change_return_type_of_method_indirectly_use {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferenceType0 as ReturnType;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferenceType1 as ReturnType;
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
trait TraitChangeReturnType {
#[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method() -> ReturnType;
}
}
// Change type of method parameter indirectly by modifying a use statement
mod change_method_parameter_type_indirectly_by_use {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferenceType0 as ArgType;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferenceType1 as ArgType;
#[rustc_clean(cfg="cfail2")]
// Change trait bound of method type parameter indirectly by modifying a use statement
mod change_method_parameter_type_bound_indirectly_by_use {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferencedTrait0 as Bound;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedTrait1 as Bound;
#[rustc_clean(cfg="cfail2")]
// Change trait bound of method type parameter in where clause indirectly
// by modifying a use statement
mod change_method_parameter_type_bound_indirectly_by_use_where {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferencedTrait0 as Bound;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedTrait1 as Bound;
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
trait TraitChangeBoundOfMethodTypeParameterWhere {
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method<T>(a: T) where T: Bound;
}
}
// Change trait bound of trait type parameter indirectly by modifying a use statement
mod change_method_type_parameter_bound_indirectly {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferencedTrait0 as Bound;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedTrait1 as Bound;
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
// Change trait bound of trait type parameter in where clause indirectly
// by modifying a use statement
mod change_method_type_parameter_bound_indirectly_where {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1,cfail4))]
use super::ReferencedTrait0 as Bound;
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1,cfail4)))]
use super::ReferencedTrait1 as Bound;
#[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
trait TraitChangeTraitBoundWhere<T> where T: Bound {
fn method(a: T);
}
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
-
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
// Change Method Name -----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub trait ChangeMethodNameTrait {
fn method_name();
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl ChangeMethodNameTrait for Foo {
fn method_name() { }
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
pub trait ChangeMethodNameTrait {
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail6")]
fn method_name2();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl ChangeMethodNameTrait for Foo {
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail6")]
fn method_name2() { }
}
fn method_name();
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl ChangeMethodBodyTrait for Foo {
#[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner_nodes,typeck", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method_name() {
()
}
fn method_name();
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl ChangeMethodBodyTraitInlined for Foo {
+ // ------------------------------------------------------------------------
+ // -------------------------
+ // ------------------------------------------------------------------------
+ // -------------------------
#[inline]
- fn method_name() { }
+ fn method_name() {
+ // -----
+ }
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl ChangeMethodBodyTraitInlined for Foo {
#[rustc_clean(except="hir_owner_nodes,typeck,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner_nodes,typeck,optimized_mir", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
#[inline]
fn method_name() {
panic!()
// Change Method Selfness ------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub trait ChangeMethodSelfnessTrait {
fn method_name();
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl ChangeMethodSelfnessTrait for Foo {
fn method_name() { }
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
pub trait ChangeMethodSelfnessTrait {
fn method_name(&self);
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl ChangeMethodSelfnessTrait for Foo {
#[rustc_clean(
except="hir_owner,hir_owner_nodes,associated_item,generics_of,fn_sig,typeck,optimized_mir",
cfg="cfail2",
)]
#[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) {
()
}
// Change Method Selfness -----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub trait RemoveMethodSelfnessTrait {
fn method_name(&self);
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl RemoveMethodSelfnessTrait for Foo {
fn method_name(&self) { }
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
pub trait RemoveMethodSelfnessTrait {
fn method_name();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl RemoveMethodSelfnessTrait for Foo {
#[rustc_clean(
except="hir_owner,hir_owner_nodes,associated_item,generics_of,fn_sig,typeck,optimized_mir",
cfg="cfail2",
)]
#[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() {}
}
// Change Method Selfmutness -----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub trait ChangeMethodSelfmutnessTrait {
fn method_name(&self);
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl ChangeMethodSelfmutnessTrait for Foo {
- fn method_name(&self) { }
+ // -----------------------------------------------------------------------------------------
+ // -------------------------
+ // -----------------------------------------------------------------------------------------
+ // -------------------------
+ fn method_name(& self) {}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
pub trait ChangeMethodSelfmutnessTrait {
fn method_name(&mut self);
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl ChangeMethodSelfmutnessTrait for Foo {
#[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir", cfg="cfail2")]
#[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) {}
}
// Change item kind -----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub trait ChangeItemKindTrait {
fn name();
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl ChangeItemKindTrait for Foo {
fn name() { }
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
pub trait ChangeItemKindTrait {
type name;
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl ChangeItemKindTrait for Foo {
type name = ();
}
// Remove item -----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub trait RemoveItemTrait {
type TypeName;
fn method_name();
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl RemoveItemTrait for Foo {
type TypeName = ();
fn method_name() { }
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
pub trait RemoveItemTrait {
type TypeName;
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl RemoveItemTrait for Foo {
type TypeName = ();
}
// Add item -----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub trait AddItemTrait {
type TypeName;
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl AddItemTrait for Foo {
type TypeName = ();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
pub trait AddItemTrait {
type TypeName;
fn method_name();
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,associated_item_def_ids", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl AddItemTrait for Foo {
type TypeName = ();
fn method_name() { }
// Change has-value -----------------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub trait ChangeHasValueTrait {
fn method_name();
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl ChangeHasValueTrait for Foo {
fn method_name() { }
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
pub trait ChangeHasValueTrait {
#[rustc_clean(except="hir_owner,associated_item", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(except="hir_owner,associated_item", cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn method_name() { }
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl ChangeHasValueTrait for Foo {
fn method_name() { }
}
fn method_name();
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(cfg="cfail3")]
+#[rustc_clean(except="hir_owner", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl AddDefaultTrait for Foo {
#[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item", cfg="cfail2")]
#[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() { }
}
// Add arguments
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub trait AddArgumentTrait {
fn method_name(&self);
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl AddArgumentTrait for Foo {
- fn method_name(&self) { }
+ // -----------------------------------------------------------------------------------------
+ // -------------------------
+ // -----------------------------------------------------------------------------------------
+ // -------------------------
+ fn method_name(&self ) { }
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
pub trait AddArgumentTrait {
fn method_name(&self, x: u32);
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl AddArgumentTrait for Foo {
#[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir", cfg="cfail2")]
#[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) { }
}
// Change argument type
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub trait ChangeArgumentTypeTrait {
fn method_name(&self, x: u32);
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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 {
fn method_name(&self, x: char);
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl ChangeArgumentTypeTrait for Foo {
#[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig,typeck,optimized_mir", cfg="cfail2")]
#[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 id(t: T) -> T;
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl AddTypeParameterToImpl<u32> for Bar<u32> {
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(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(
except="hir_owner,hir_owner_nodes,generics_of,fn_sig,type_of,typeck,optimized_mir",
cfg="cfail2",
)]
#[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 }
}
fn id(self) -> Self;
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl ChangeSelfTypeOfImpl for u32 {
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(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,impl_trait_ref", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl ChangeSelfTypeOfImpl for u64 {
#[rustc_clean(except="fn_sig,typeck,optimized_mir", cfg="cfail2")]
#[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;
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl<T> AddLifetimeBoundToImplParameter for T {
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(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl<T: 'static> AddLifetimeBoundToImplParameter for T {
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn id(self) -> Self { self }
}
fn id(self) -> Self;
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl<T> AddTraitBoundToImplParameter for T {
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(cfg="cfail3")]
+#[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl<T: Clone> AddTraitBoundToImplParameter for T {
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
fn id(self) -> Self { self }
}
fn add_no_mangle_to_method(&self) { }
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl AddNoMangleToMethod for Foo {
+ // -------------------------
+ // -------------------------
+ // -------------------------
+ // -------------------------
+ // ---------
fn add_no_mangle_to_method(&self) { }
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl AddNoMangleToMethod for Foo {
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
#[no_mangle]
fn add_no_mangle_to_method(&self) { }
}
fn make_method_inline(&self) -> u8 { 0 }
}
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
impl MakeMethodInline for Foo {
+ // -------------------------
+ // -------------------------
+ // -------------------------
+ // -------------------------
+ // ------
fn make_method_inline(&self) -> u8 { 0 }
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
impl MakeMethodInline for Foo {
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+ #[rustc_clean(cfg="cfail5")]
+ #[rustc_clean(cfg="cfail6")]
#[inline]
fn make_method_inline(&self) -> u8 { 0 }
}
// build-pass (FIXME(62277): could be check-pass?)
// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// compile-flags: -Z query-dep-graph
#![allow(warnings)]
#![feature(rustc_attrs)]
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
// Change constant operand of negation -----------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn const_negation() -> i32 {
-10
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
pub fn const_negation() -> i32 {
- -1
+ -1
}
// Change constant operand of bitwise not --------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn const_bitwise_not() -> i32 {
!100
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
pub fn const_bitwise_not() -> i32 {
- !99
+ !99
}
// Change variable operand of negation -----------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn var_negation(x: i32, y: i32) -> i32 {
-x
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
-y
}
// Change variable operand of bitwise not --------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn var_bitwise_not(x: i32, y: i32) -> i32 {
!x
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
!y
}
// Change variable operand of deref --------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn var_deref(x: &i32, y: &i32) -> i32 {
*x
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
*y
}
// Change first constant operand of addition -----------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn first_const_add() -> i32 {
1 + 3
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
pub fn first_const_add() -> i32 {
2 + 3
}
// Change second constant operand of addition -----------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn second_const_add() -> i32 {
1 + 2
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
pub fn second_const_add() -> i32 {
1 + 3
}
// Change first variable operand of addition -----------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn first_var_add(a: i32, b: i32) -> i32 {
a + 2
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
b + 2
}
// Change second variable operand of addition ----------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn second_var_add(a: i32, b: i32) -> i32 {
1 + a
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
1 + b
}
// Change operator from + to - -------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn plus_to_minus(a: i32) -> i32 {
1 + a
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
1 - a
}
// Change operator from + to * -------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn plus_to_mult(a: i32) -> i32 {
1 + a
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
1 * a
}
// Change operator from + to / -------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn plus_to_div(a: i32) -> i32 {
1 + a
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
1 / a
}
// Change operator from + to % -------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn plus_to_mod(a: i32) -> i32 {
1 + a
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
1 % a
}
// Change operator from && to || -----------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn and_to_or(a: bool, b: bool) -> bool {
a && b
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
a || b
}
// Change operator from & to | -------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn bitwise_and_to_bitwise_or(a: i32) -> i32 {
1 & a
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
1 | a
}
// Change operator from & to ^ -------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn bitwise_and_to_bitwise_xor(a: i32) -> i32 {
1 & a
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
1 ^ a
}
// Change operator from & to << ------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(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 {
a << 1
}
// Change operator from & to >> ------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
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(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 {
a >> 1
}
// Change operator from == to != -----------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn eq_to_uneq(a: i32) -> bool {
a == 1
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
a != 1
}
// Change operator from == to < ------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn eq_to_lt(a: i32) -> bool {
a == 1
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
- a < 1
+ a < 1
}
// Change operator from == to > ------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn eq_to_gt(a: i32) -> bool {
a == 1
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
- a > 1
+ a > 1
}
// Change operator from == to <= -----------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn eq_to_le(a: i32) -> bool {
a == 1
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
a <= 1
}
// Change operator from == to >= -----------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn eq_to_ge(a: i32) -> bool {
a == 1
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
a >= 1
}
// Change type in cast expression ----------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn type_cast(a: u8) -> u64 {
let b = a as i32;
let c = b as u64;
c
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir,typeck", cfg="cfail2")]
#[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 {
let b = a as u32;
let c = b as u64;
// Change value in cast expression ---------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn value_cast(a: u32) -> i32 {
1 as i32
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
2 as i32
}
// Change place in assignment --------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn place() -> i32 {
let mut x = 10;
let mut y = 11;
x
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
pub fn place() -> i32 {
let mut x = 10;
let mut y = 11;
// Change r-value in assignment ------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn rvalue() -> i32 {
let mut x = 10;
x = 9;
x
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
+#[rustc_clean(cfg="cfail6")]
pub fn rvalue() -> i32 {
let mut x = 10;
x = 8;
// Change index into slice -----------------------------------------------------
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn index_to_slice(s: &[u8], i: usize, j: usize) -> u8 {
s[i]
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
#[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 {
s[j]
}
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
// Change loop body
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_loop_body() {
let mut _x = 0;
while let Some(0u32) = None {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_loop_body() {
let mut _x = 0;
while let Some(0u32) = None {
// Change loop body
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_loop_condition() {
let mut _x = 0;
while let Some(0u32) = None {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_loop_condition() {
let mut _x = 0;
while let Some(1u32) = None {
// Add break
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_break() {
let mut _x = 0;
while let Some(0u32) = None {
_x = 1;
+ // ---
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, typeck")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_break() {
let mut _x = 0;
while let Some(0u32) = None {
// Add loop label
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_loop_label() {
let mut _x = 0;
- while let Some(0u32) = None {
+ while let Some(0u32) = None {
_x = 1;
break;
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label() {
let mut _x = 0;
'label: while let Some(0u32) = None {
// Add loop label to break
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_loop_label_to_break() {
let mut _x = 0;
'label: while let Some(0u32) = None {
_x = 1;
- break;
+ break ;
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label_to_break() {
let mut _x = 0;
'label: while let Some(0u32) = None {
// Change break label
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_break_label() {
let mut _x = 0;
'outer: while let Some(0u32) = None {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_break_label() {
let mut _x = 0;
'outer: while let Some(0u32) = None {
}
// Add loop label to continue
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_loop_label_to_continue() {
let mut _x = 0;
'label: while let Some(0u32) = None {
_x = 1;
- continue;
+ continue ;
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label_to_continue() {
let mut _x = 0;
'label: while let Some(0u32) = None {
// Change continue label
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_continue_label() {
let mut _x = 0;
'outer: while let Some(0u32) = None {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_continue_label() {
let mut _x = 0;
'outer: while let Some(0u32) = None {
// Change continue to break
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_continue_to_break() {
let mut _x = 0;
while let Some(0u32) = None {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_continue_to_break() {
let mut _x = 0;
while let Some(0u32) = None {
_x = 1;
- break;
+ break ;
}
}
// rev3 and make sure that the hash has not changed.
// build-pass (FIXME(62277): could be check-pass?)
-// revisions: cfail1 cfail2 cfail3
-// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
+// revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
+// 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)]
#![feature(rustc_attrs)]
// Change loop body
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_loop_body() {
let mut _x = 0;
while true {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_loop_body() {
let mut _x = 0;
while true {
// Change loop body
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_loop_condition() {
let mut _x = 0;
- while true {
+ while true {
_x = 1;
break;
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_loop_condition() {
let mut _x = 0;
while false {
// Add break
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_break() {
let mut _x = 0;
while true {
_x = 1;
+ // ---
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir, typeck")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir, typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_break() {
let mut _x = 0;
while true {
// Add loop label
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_loop_label() {
let mut _x = 0;
- while true {
+ while true {
_x = 1;
break;
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label() {
let mut _x = 0;
'label: while true {
// Add loop label to break
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_loop_label_to_break() {
let mut _x = 0;
'label: while true {
_x = 1;
- break;
+ break ;
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label_to_break() {
let mut _x = 0;
'label: while true {
// Change break label
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_break_label() {
let mut _x = 0;
'outer: while true {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_break_label() {
let mut _x = 0;
'outer: while true {
// Add loop label to continue
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn add_loop_label_to_continue() {
let mut _x = 0;
'label: while true {
_x = 1;
- continue;
+ continue ;
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")]
+#[rustc_clean(cfg="cfail6")]
pub fn add_loop_label_to_continue() {
let mut _x = 0;
'label: while true {
// Change continue label
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_continue_label() {
let mut _x = 0;
'outer: while true {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_continue_label() {
let mut _x = 0;
'outer: while true {
// Change continue to break
-#[cfg(cfail1)]
+#[cfg(any(cfail1,cfail4))]
pub fn change_continue_to_break() {
let mut _x = 0;
while true {
}
}
-#[cfg(not(cfail1))]
+#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")]
#[rustc_clean(cfg="cfail3")]
+#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")]
+#[rustc_clean(cfg="cfail6")]
pub fn change_continue_to_break() {
let mut _x = 0;
while true {
_x = 1;
- break;
+ break ;
}
}
// 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.
-// revisions:rpass1 rpass2
+// revisions:rpass1 rpass2 rpass3 rpass4
// ignore-asmjs wasm2js does not support source maps yet
// compile-flags: -g -Z query-dep-graph
+// [rpass3]compile-flags: -Zincremental-relative-spans
+// [rpass4]compile-flags: -Zincremental-relative-spans
#![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() {}
-#[cfg(rpass2)]
-#[rustc_clean(except="hir_owner,hir_owner_nodes,optimized_mir", cfg="rpass2")]
+#[cfg(any(rpass2, rpass4))]
+#[rustc_clean(except = "hir_owner,hir_owner_nodes,optimized_mir", cfg = "rpass2")]
+#[rustc_clean(cfg = "rpass4")]
pub fn main() {}
// 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.
-// 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
#![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() {
- let _ = 0u8 + 1;
+ if std::hint::black_box(false) {
+ panic!()
+ }
}
-#[cfg(rpass2)]
-#[rustc_clean(except="hir_owner,hir_owner_nodes,optimized_mir", cfg="rpass2")]
+#[cfg(any(rpass2, rpass4))]
+#[rustc_clean(except = "hir_owner,hir_owner_nodes,optimized_mir", cfg = "rpass2")]
+#[rustc_clean(cfg = "rpass4")]
pub fn main() {
- let _ = 0u8 + 1;
+ if std::hint::black_box(false) {
+ panic!()
+ }
}
-// revisions: cfail1 cfail2
+// revisions: cfail1 cfail2 cfail3 cfail4
// 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?)
#![allow(warnings)]
// Therefore, the compiler deduces (correctly) that typeck is not
// needed even for callers of `x`.
-
pub mod x {
- #[cfg(cfail1)]
+ #[cfg(any(cfail1, cfail3))]
pub fn x() {
println!("{}", "1");
}
- #[cfg(cfail2)]
- #[rustc_clean(except="hir_owner,hir_owner_nodes,optimized_mir,promoted_mir", 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_nodes,promoted_mir", cfg = "cfail4")]
pub fn x() {
println!("{}", "2");
}
pub mod y {
use x;
- #[rustc_clean(cfg="cfail2")]
+ #[rustc_clean(cfg = "cfail2")]
+ #[rustc_clean(cfg = "cfail4")]
pub fn y() {
x::x();
}
pub mod z {
use y;
- #[rustc_clean(cfg="cfail2")]
+ #[rustc_clean(cfg = "cfail2")]
+ #[rustc_clean(cfg = "cfail4")]
pub fn z() {
y::y();
}
// ends up with any spans in its LLVM bitecode, so LLVM is able to skip
// 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
// build-pass (FIXME(62277): could be check-pass?)
#![feature(rustc_attrs)]
-#![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",
- cfg="cfail3",
- 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")]
+#![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",
+ cfg = "cfail3",
+ kind = "post-lto"
+)]
+#![rustc_expected_cgu_reuse(
+ module = "cgu_keeps_identical_fn-foo",
+ cfg = "cfail5",
+ kind = "post-lto"
+)]
+#![rustc_expected_cgu_reuse(
+ module = "cgu_keeps_identical_fn-foo",
+ 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 {
// Trivial functions like this one are imported very reliably by ThinLTO.
- #[cfg(cfail1)]
+ #[cfg(any(cfail1, cfail4))]
pub fn inlined_fn() -> u32 {
1234
}
- #[cfg(not(cfail1))]
+ #[cfg(not(any(cfail1, cfail4)))]
pub fn inlined_fn() -> u32 {
1234
}
--- /dev/null
+- // MIR for `align_of` before LowerIntrinsics
++ // MIR for `align_of` after LowerIntrinsics
+
+ fn align_of() -> usize {
+ let mut _0: usize; // return place in scope 0 at $DIR/lower_intrinsics.rs:18:25: 18:30
+
+ bb0: {
+- _0 = std::intrinsics::min_align_of::<T>() -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:19:5: 19:42
+- // mir::Constant
+- // + span: $DIR/lower_intrinsics.rs:19:5: 19:40
+- // + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::min_align_of::<T>}, val: Value(Scalar(<ZST>)) }
++ _0 = AlignOf(T); // scope 0 at $DIR/lower_intrinsics.rs:19:5: 19:42
++ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:19:5: 19:42
+ }
+
+ bb1: {
+ return; // scope 0 at $DIR/lower_intrinsics.rs:20:2: 20:2
+ }
+
+ bb2 (cleanup): {
+ resume; // scope 0 at $DIR/lower_intrinsics.rs:18:1: 20:2
+ }
+ }
+
+ // MIR for `discriminant` after LowerIntrinsics
fn discriminant(_1: T) -> () {
- debug t => _1; // in scope 0 at $DIR/lower_intrinsics.rs:68:24: 68:25
- let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:68:30: 68:30
- let _2: <T as std::marker::DiscriminantKind>::Discriminant; // in scope 0 at $DIR/lower_intrinsics.rs:69:5: 69:45
- let mut _3: &T; // in scope 0 at $DIR/lower_intrinsics.rs:69:42: 69:44
- let _4: &T; // in scope 0 at $DIR/lower_intrinsics.rs:69:42: 69:44
- let _5: u8; // in scope 0 at $DIR/lower_intrinsics.rs:70:5: 70:45
- let mut _6: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44
- let _7: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44
- let _8: i32; // in scope 0 at $DIR/lower_intrinsics.rs:70:43: 70:44
- let _9: u8; // in scope 0 at $DIR/lower_intrinsics.rs:71:5: 71:46
- let mut _10: &(); // in scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45
- let _11: &(); // in scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45
- let _12: (); // in scope 0 at $DIR/lower_intrinsics.rs:71:43: 71:45
- let _13: isize; // in scope 0 at $DIR/lower_intrinsics.rs:72:5: 72:48
- let mut _14: &E; // in scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47
- let _15: &E; // in scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47
- let _16: E; // in scope 0 at $DIR/lower_intrinsics.rs:72:43: 72:47
- let mut _17: &E; // in scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47
- let mut _18: &(); // in scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45
- let mut _19: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44
+ debug t => _1; // in scope 0 at $DIR/lower_intrinsics.rs:73:24: 73:25
+ let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:73:30: 73:30
+ let _2: <T as std::marker::DiscriminantKind>::Discriminant; // in scope 0 at $DIR/lower_intrinsics.rs:74:5: 74:45
+ let mut _3: &T; // in scope 0 at $DIR/lower_intrinsics.rs:74:42: 74:44
+ let _4: &T; // in scope 0 at $DIR/lower_intrinsics.rs:74:42: 74:44
+ let _5: u8; // in scope 0 at $DIR/lower_intrinsics.rs:75:5: 75:45
+ let mut _6: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44
+ let _7: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44
+ let _8: i32; // in scope 0 at $DIR/lower_intrinsics.rs:75:43: 75:44
+ let _9: u8; // in scope 0 at $DIR/lower_intrinsics.rs:76:5: 76:46
+ let mut _10: &(); // in scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45
+ let _11: &(); // in scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45
+ let _12: (); // in scope 0 at $DIR/lower_intrinsics.rs:76:43: 76:45
+ let _13: isize; // in scope 0 at $DIR/lower_intrinsics.rs:77:5: 77:48
+ let mut _14: &E; // in scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47
+ let _15: &E; // in scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47
+ let _16: E; // in scope 0 at $DIR/lower_intrinsics.rs:77:43: 77:47
+ let mut _17: &E; // in scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47
+ let mut _18: &(); // in scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45
+ let mut _19: &i32; // in scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44
bb0: {
- StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:69:5: 69:45
- StorageLive(_3); // scope 0 at $DIR/lower_intrinsics.rs:69:42: 69:44
- StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:69:42: 69:44
- _4 = &_1; // scope 0 at $DIR/lower_intrinsics.rs:69:42: 69:44
- _3 = &(*_4); // scope 0 at $DIR/lower_intrinsics.rs:69:42: 69:44
-- _2 = discriminant_value::<T>(move _3) -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:69:5: 69:45
+ StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:74:5: 74:45
+ StorageLive(_3); // scope 0 at $DIR/lower_intrinsics.rs:74:42: 74:44
+ StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:74:42: 74:44
+ _4 = &_1; // scope 0 at $DIR/lower_intrinsics.rs:74:42: 74:44
+ _3 = &(*_4); // scope 0 at $DIR/lower_intrinsics.rs:74:42: 74:44
+- _2 = discriminant_value::<T>(move _3) -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:74:5: 74:45
- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:69:5: 69:41
+- // + span: $DIR/lower_intrinsics.rs:74:5: 74:41
- // + literal: Const { ty: for<'r> extern "rust-intrinsic" fn(&'r T) -> <T as std::marker::DiscriminantKind>::Discriminant {std::intrinsics::discriminant_value::<T>}, val: Value(Scalar(<ZST>)) }
-+ _2 = discriminant((*_3)); // scope 0 at $DIR/lower_intrinsics.rs:69:5: 69:45
-+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:69:5: 69:45
++ _2 = discriminant((*_3)); // scope 0 at $DIR/lower_intrinsics.rs:74:5: 74:45
++ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:74:5: 74:45
}
bb1: {
- StorageDead(_3); // scope 0 at $DIR/lower_intrinsics.rs:69:44: 69:45
- StorageDead(_4); // scope 0 at $DIR/lower_intrinsics.rs:69:45: 69:46
- StorageDead(_2); // scope 0 at $DIR/lower_intrinsics.rs:69:45: 69:46
- StorageLive(_5); // scope 0 at $DIR/lower_intrinsics.rs:70:5: 70:45
- StorageLive(_6); // scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44
- StorageLive(_7); // scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44
- _19 = const discriminant::<T>::promoted[2]; // scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44
+ StorageDead(_3); // scope 0 at $DIR/lower_intrinsics.rs:74:44: 74:45
+ StorageDead(_4); // scope 0 at $DIR/lower_intrinsics.rs:74:45: 74:46
+ StorageDead(_2); // scope 0 at $DIR/lower_intrinsics.rs:74:45: 74:46
+ StorageLive(_5); // scope 0 at $DIR/lower_intrinsics.rs:75:5: 75:45
+ StorageLive(_6); // scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44
+ StorageLive(_7); // scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44
+ _19 = const discriminant::<T>::promoted[2]; // scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44
// ty::Const
// + ty: &i32
// + val: Unevaluated(discriminant, [T], Some(promoted[2]))
// mir::Constant
- // + span: $DIR/lower_intrinsics.rs:70:42: 70:44
- // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[2872]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[2]) }) }
- _7 = &(*_19); // scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44
- _6 = &(*_7); // scope 0 at $DIR/lower_intrinsics.rs:70:42: 70:44
-- _5 = discriminant_value::<i32>(move _6) -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:70:5: 70:45
+ // + span: $DIR/lower_intrinsics.rs:75:42: 75:44
+ // + literal: Const { ty: &i32, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:29 ~ lower_intrinsics[2872]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[2]) }) }
+ _7 = &(*_19); // scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44
+ _6 = &(*_7); // scope 0 at $DIR/lower_intrinsics.rs:75:42: 75:44
+- _5 = discriminant_value::<i32>(move _6) -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:75:5: 75:45
- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:70:5: 70:41
+- // + span: $DIR/lower_intrinsics.rs:75:5: 75:41
- // + literal: Const { ty: for<'r> extern "rust-intrinsic" fn(&'r i32) -> <i32 as std::marker::DiscriminantKind>::Discriminant {std::intrinsics::discriminant_value::<i32>}, val: Value(Scalar(<ZST>)) }
-+ _5 = discriminant((*_6)); // scope 0 at $DIR/lower_intrinsics.rs:70:5: 70:45
-+ goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:70:5: 70:45
++ _5 = discriminant((*_6)); // scope 0 at $DIR/lower_intrinsics.rs:75:5: 75:45
++ goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:75:5: 75:45
}
bb2: {
- StorageDead(_6); // scope 0 at $DIR/lower_intrinsics.rs:70:44: 70:45
- StorageDead(_7); // scope 0 at $DIR/lower_intrinsics.rs:70:45: 70:46
- StorageDead(_5); // scope 0 at $DIR/lower_intrinsics.rs:70:45: 70:46
- StorageLive(_9); // scope 0 at $DIR/lower_intrinsics.rs:71:5: 71:46
- StorageLive(_10); // scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45
- StorageLive(_11); // scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45
- _18 = const discriminant::<T>::promoted[1]; // scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45
+ StorageDead(_6); // scope 0 at $DIR/lower_intrinsics.rs:75:44: 75:45
+ StorageDead(_7); // scope 0 at $DIR/lower_intrinsics.rs:75:45: 75:46
+ StorageDead(_5); // scope 0 at $DIR/lower_intrinsics.rs:75:45: 75:46
+ StorageLive(_9); // scope 0 at $DIR/lower_intrinsics.rs:76:5: 76:46
+ StorageLive(_10); // scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45
+ StorageLive(_11); // scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45
+ _18 = const discriminant::<T>::promoted[1]; // scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45
// ty::Const
// + ty: &()
// + val: Unevaluated(discriminant, [T], Some(promoted[1]))
// mir::Constant
- // + span: $DIR/lower_intrinsics.rs:71:42: 71:45
- // + literal: Const { ty: &(), val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[2872]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[1]) }) }
- _11 = &(*_18); // scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45
- _10 = &(*_11); // scope 0 at $DIR/lower_intrinsics.rs:71:42: 71:45
-- _9 = discriminant_value::<()>(move _10) -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:71:5: 71:46
+ // + span: $DIR/lower_intrinsics.rs:76:42: 76:45
+ // + literal: Const { ty: &(), val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:29 ~ lower_intrinsics[2872]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[1]) }) }
+ _11 = &(*_18); // scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45
+ _10 = &(*_11); // scope 0 at $DIR/lower_intrinsics.rs:76:42: 76:45
+- _9 = discriminant_value::<()>(move _10) -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:76:5: 76:46
- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:71:5: 71:41
+- // + span: $DIR/lower_intrinsics.rs:76:5: 76:41
- // + literal: Const { ty: for<'r> extern "rust-intrinsic" fn(&'r ()) -> <() as std::marker::DiscriminantKind>::Discriminant {std::intrinsics::discriminant_value::<()>}, val: Value(Scalar(<ZST>)) }
-+ _9 = discriminant((*_10)); // scope 0 at $DIR/lower_intrinsics.rs:71:5: 71:46
-+ goto -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:71:5: 71:46
++ _9 = discriminant((*_10)); // scope 0 at $DIR/lower_intrinsics.rs:76:5: 76:46
++ goto -> bb3; // scope 0 at $DIR/lower_intrinsics.rs:76:5: 76:46
}
bb3: {
- StorageDead(_10); // scope 0 at $DIR/lower_intrinsics.rs:71:45: 71:46
- StorageDead(_11); // scope 0 at $DIR/lower_intrinsics.rs:71:46: 71:47
- StorageDead(_9); // scope 0 at $DIR/lower_intrinsics.rs:71:46: 71:47
- StorageLive(_13); // scope 0 at $DIR/lower_intrinsics.rs:72:5: 72:48
- StorageLive(_14); // scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47
- StorageLive(_15); // scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47
- _17 = const discriminant::<T>::promoted[0]; // scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47
+ StorageDead(_10); // scope 0 at $DIR/lower_intrinsics.rs:76:45: 76:46
+ StorageDead(_11); // scope 0 at $DIR/lower_intrinsics.rs:76:46: 76:47
+ StorageDead(_9); // scope 0 at $DIR/lower_intrinsics.rs:76:46: 76:47
+ StorageLive(_13); // scope 0 at $DIR/lower_intrinsics.rs:77:5: 77:48
+ StorageLive(_14); // scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47
+ StorageLive(_15); // scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47
+ _17 = const discriminant::<T>::promoted[0]; // scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47
// ty::Const
// + ty: &E
// + val: Unevaluated(discriminant, [T], Some(promoted[0]))
// mir::Constant
- // + span: $DIR/lower_intrinsics.rs:72:42: 72:47
- // + literal: Const { ty: &E, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:27 ~ lower_intrinsics[2872]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[0]) }) }
- _15 = &(*_17); // scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47
- _14 = &(*_15); // scope 0 at $DIR/lower_intrinsics.rs:72:42: 72:47
-- _13 = discriminant_value::<E>(move _14) -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:72:5: 72:48
+ // + span: $DIR/lower_intrinsics.rs:77:42: 77:47
+ // + literal: Const { ty: &E, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:29 ~ lower_intrinsics[2872]::discriminant), const_param_did: None }, substs_: Some([T]), promoted: Some(promoted[0]) }) }
+ _15 = &(*_17); // scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47
+ _14 = &(*_15); // scope 0 at $DIR/lower_intrinsics.rs:77:42: 77:47
+- _13 = discriminant_value::<E>(move _14) -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:77:5: 77:48
- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:72:5: 72:41
+- // + span: $DIR/lower_intrinsics.rs:77:5: 77:41
- // + literal: Const { ty: for<'r> extern "rust-intrinsic" fn(&'r E) -> <E as std::marker::DiscriminantKind>::Discriminant {std::intrinsics::discriminant_value::<E>}, val: Value(Scalar(<ZST>)) }
-+ _13 = discriminant((*_14)); // scope 0 at $DIR/lower_intrinsics.rs:72:5: 72:48
-+ goto -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:72:5: 72:48
++ _13 = discriminant((*_14)); // scope 0 at $DIR/lower_intrinsics.rs:77:5: 77:48
++ goto -> bb4; // scope 0 at $DIR/lower_intrinsics.rs:77:5: 77:48
}
bb4: {
- StorageDead(_14); // scope 0 at $DIR/lower_intrinsics.rs:72:47: 72:48
- StorageDead(_15); // scope 0 at $DIR/lower_intrinsics.rs:72:48: 72:49
- StorageDead(_13); // scope 0 at $DIR/lower_intrinsics.rs:72:48: 72:49
- _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:68:30: 73:2
- drop(_1) -> bb5; // scope 0 at $DIR/lower_intrinsics.rs:73:1: 73:2
+ StorageDead(_14); // scope 0 at $DIR/lower_intrinsics.rs:77:47: 77:48
+ StorageDead(_15); // scope 0 at $DIR/lower_intrinsics.rs:77:48: 77:49
+ StorageDead(_13); // scope 0 at $DIR/lower_intrinsics.rs:77:48: 77:49
+ _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:73:30: 78:2
+ drop(_1) -> bb5; // scope 0 at $DIR/lower_intrinsics.rs:78:1: 78:2
}
bb5: {
- return; // scope 0 at $DIR/lower_intrinsics.rs:73:2: 73:2
+ return; // scope 0 at $DIR/lower_intrinsics.rs:78:2: 78:2
}
bb6 (cleanup): {
- resume; // scope 0 at $DIR/lower_intrinsics.rs:68:1: 73:2
+ resume; // scope 0 at $DIR/lower_intrinsics.rs:73:1: 78:2
}
}
// MIR for `f_u64` before PreCodegen
fn f_u64() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:34:16: 34:16
- let mut _1: u64; // in scope 0 at $DIR/lower_intrinsics.rs:35:5: 35:21
- scope 1 (inlined f_dispatch::<u64>) { // at $DIR/lower_intrinsics.rs:35:5: 35:21
- debug t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
- let _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
- let mut _3: u64; // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
- scope 2 (inlined std::mem::size_of::<u64>) { // at $DIR/lower_intrinsics.rs:35:5: 35:21
+ let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:39:16: 39:16
+ let mut _1: u64; // in scope 0 at $DIR/lower_intrinsics.rs:40:5: 40:21
+ scope 1 (inlined f_dispatch::<u64>) { // at $DIR/lower_intrinsics.rs:40:5: 40:21
+ debug t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
+ let _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
+ let mut _3: u64; // in scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
+ scope 2 (inlined std::mem::size_of::<u64>) { // at $DIR/lower_intrinsics.rs:40:5: 40:21
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:35:5: 35:21
- _1 = const 0_u64; // scope 0 at $DIR/lower_intrinsics.rs:35:5: 35:21
- StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
- StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
- _3 = move _1; // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
- _2 = f_non_zst::<u64>(move _3) -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
+ StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:40:5: 40:21
+ _1 = const 0_u64; // scope 0 at $DIR/lower_intrinsics.rs:40:5: 40:21
+ StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
+ StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
+ _3 = move _1; // scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
+ _2 = f_non_zst::<u64>(move _3) -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
// mir::Constant
- // + span: $DIR/lower_intrinsics.rs:35:5: 35:21
+ // + span: $DIR/lower_intrinsics.rs:40:5: 40:21
// + literal: Const { ty: fn(u64) {f_non_zst::<u64>}, val: Value(Scalar(<ZST>)) }
}
bb1: {
- StorageDead(_3); // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
- StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
- StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:35:5: 35:21
- return; // scope 0 at $DIR/lower_intrinsics.rs:36:2: 36:2
+ StorageDead(_3); // scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
+ StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:40:5: 40:21
+ StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:40:5: 40:21
+ return; // scope 0 at $DIR/lower_intrinsics.rs:41:2: 41:2
}
}
// MIR for `f_unit` before PreCodegen
fn f_unit() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:28:17: 28:17
- let mut _1: (); // in scope 0 at $DIR/lower_intrinsics.rs:29:16: 29:18
- scope 1 (inlined f_dispatch::<()>) { // at $DIR/lower_intrinsics.rs:29:5: 29:19
- debug t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:29:5: 29:19
- let _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:29:5: 29:19
- scope 2 (inlined std::mem::size_of::<()>) { // at $DIR/lower_intrinsics.rs:29:5: 29:19
+ let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:33:17: 33:17
+ let mut _1: (); // in scope 0 at $DIR/lower_intrinsics.rs:34:16: 34:18
+ scope 1 (inlined f_dispatch::<()>) { // at $DIR/lower_intrinsics.rs:34:5: 34:19
+ debug t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:34:5: 34:19
+ let _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:34:5: 34:19
+ scope 2 (inlined std::mem::size_of::<()>) { // at $DIR/lower_intrinsics.rs:34:5: 34:19
}
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:29:16: 29:18
- StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:29:5: 29:19
- _2 = f_zst::<()>(const ()) -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:29:5: 29:19
+ StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:34:16: 34:18
+ StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:34:5: 34:19
+ _2 = f_zst::<()>(const ()) -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:34:5: 34:19
// mir::Constant
- // + span: $DIR/lower_intrinsics.rs:29:5: 29:19
+ // + span: $DIR/lower_intrinsics.rs:34:5: 34:19
// + literal: Const { ty: fn(()) {f_zst::<()>}, val: Value(Scalar(<ZST>)) }
}
bb1: {
- StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:29:5: 29:19
- StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:29:18: 29:19
- return; // scope 0 at $DIR/lower_intrinsics.rs:30:2: 30:2
+ StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:34:5: 34:19
+ StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:34:18: 34:19
+ return; // scope 0 at $DIR/lower_intrinsics.rs:35:2: 35:2
}
}
+ // MIR for `forget` after LowerIntrinsics
fn forget(_1: T) -> () {
- debug t => _1; // in scope 0 at $DIR/lower_intrinsics.rs:18:18: 18:19
- let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:18:24: 18:24
- let mut _2: T; // in scope 0 at $DIR/lower_intrinsics.rs:19:30: 19:31
+ debug t => _1; // in scope 0 at $DIR/lower_intrinsics.rs:23:18: 23:19
+ let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:23:24: 23:24
+ let mut _2: T; // in scope 0 at $DIR/lower_intrinsics.rs:24:30: 24:31
bb0: {
- StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:19:30: 19:31
- _2 = move _1; // scope 0 at $DIR/lower_intrinsics.rs:19:30: 19:31
-- _0 = std::intrinsics::forget::<T>(move _2) -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:19:5: 19:32
+ StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:24:30: 24:31
+ _2 = move _1; // scope 0 at $DIR/lower_intrinsics.rs:24:30: 24:31
+- _0 = std::intrinsics::forget::<T>(move _2) -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:24:5: 24:32
- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:19:5: 19:29
+- // + span: $DIR/lower_intrinsics.rs:24:5: 24:29
- // + literal: Const { ty: extern "rust-intrinsic" fn(T) {std::intrinsics::forget::<T>}, val: Value(Scalar(<ZST>)) }
-+ _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:19:5: 19:32
-+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:19:5: 19:32
++ _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:24:5: 24:32
++ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:24:5: 24:32
}
bb1: {
- StorageDead(_2); // scope 0 at $DIR/lower_intrinsics.rs:19:31: 19:32
- goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:20:1: 20:2
+ StorageDead(_2); // scope 0 at $DIR/lower_intrinsics.rs:24:31: 24:32
+ goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:25:1: 25:2
}
bb2: {
- return; // scope 0 at $DIR/lower_intrinsics.rs:20:2: 20:2
+ return; // scope 0 at $DIR/lower_intrinsics.rs:25:2: 25:2
}
bb3 (cleanup): {
- resume; // scope 0 at $DIR/lower_intrinsics.rs:18:1: 20:2
+ resume; // scope 0 at $DIR/lower_intrinsics.rs:23:1: 25:2
}
}
+ // MIR for `non_const` after LowerIntrinsics
fn non_const() -> usize {
- let mut _0: usize; // return place in scope 0 at $DIR/lower_intrinsics.rs:55:26: 55:31
- let _1: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}; // in scope 0 at $DIR/lower_intrinsics.rs:57:9: 57:18
- let mut _2: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}; // in scope 0 at $DIR/lower_intrinsics.rs:58:5: 58:14
+ let mut _0: usize; // return place in scope 0 at $DIR/lower_intrinsics.rs:60:26: 60:31
+ let _1: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}; // in scope 0 at $DIR/lower_intrinsics.rs:62:9: 62:18
+ let mut _2: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}; // in scope 0 at $DIR/lower_intrinsics.rs:63:5: 63:14
scope 1 {
- debug size_of_t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:57:9: 57:18
+ debug size_of_t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:62:9: 62:18
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:57:9: 57:18
- _1 = std::intrinsics::size_of::<T>; // scope 0 at $DIR/lower_intrinsics.rs:57:21: 57:51
+ StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:62:9: 62:18
+ _1 = std::intrinsics::size_of::<T>; // scope 0 at $DIR/lower_intrinsics.rs:62:21: 62:51
// mir::Constant
- // + span: $DIR/lower_intrinsics.rs:57:21: 57:51
+ // + span: $DIR/lower_intrinsics.rs:62:21: 62:51
// + literal: Const { ty: extern "rust-intrinsic" fn() -> usize {std::intrinsics::size_of::<T>}, val: Value(Scalar(<ZST>)) }
- StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:58:5: 58:14
- _2 = _1; // scope 1 at $DIR/lower_intrinsics.rs:58:5: 58:14
-- _0 = move _2() -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:58:5: 58:16
-+ _0 = SizeOf(T); // scope 1 at $DIR/lower_intrinsics.rs:58:5: 58:16
-+ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:58:5: 58:16
+ StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:63:5: 63:14
+ _2 = _1; // scope 1 at $DIR/lower_intrinsics.rs:63:5: 63:14
+- _0 = move _2() -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:63:5: 63:16
++ _0 = SizeOf(T); // scope 1 at $DIR/lower_intrinsics.rs:63:5: 63:16
++ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:63:5: 63:16
}
bb1: {
- StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:58:15: 58:16
- StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:59:1: 59:2
- return; // scope 0 at $DIR/lower_intrinsics.rs:59:2: 59:2
+ StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:63:15: 63:16
+ StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:64:1: 64:2
+ return; // scope 0 at $DIR/lower_intrinsics.rs:64:2: 64:2
}
bb2 (cleanup): {
- resume; // scope 0 at $DIR/lower_intrinsics.rs:55:1: 59:2
+ resume; // scope 0 at $DIR/lower_intrinsics.rs:60:1: 64:2
}
}
core::intrinsics::size_of::<T>()
}
+// EMIT_MIR lower_intrinsics.align_of.LowerIntrinsics.diff
+pub fn align_of<T>() -> usize {
+ core::intrinsics::min_align_of::<T>()
+}
+
// EMIT_MIR lower_intrinsics.forget.LowerIntrinsics.diff
pub fn forget<T>(t: T) {
core::intrinsics::forget(t)
+ // MIR for `unreachable` after LowerIntrinsics
fn unreachable() -> ! {
- let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:23:25: 23:26
- let mut _1: !; // in scope 0 at $DIR/lower_intrinsics.rs:23:27: 25:2
- let _2: (); // in scope 0 at $DIR/lower_intrinsics.rs:24:14: 24:45
- let mut _3: !; // in scope 0 at $DIR/lower_intrinsics.rs:24:14: 24:45
+ let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:28:25: 28:26
+ let mut _1: !; // in scope 0 at $DIR/lower_intrinsics.rs:28:27: 30:2
+ let _2: (); // in scope 0 at $DIR/lower_intrinsics.rs:29:14: 29:45
+ let mut _3: !; // in scope 0 at $DIR/lower_intrinsics.rs:29:14: 29:45
scope 1 {
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:24:5: 24:47
- StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:24:14: 24:45
-- std::intrinsics::unreachable(); // scope 1 at $DIR/lower_intrinsics.rs:24:14: 24:45
+ StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:29:5: 29:47
+ StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:29:14: 29:45
+- std::intrinsics::unreachable(); // scope 1 at $DIR/lower_intrinsics.rs:29:14: 29:45
- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:24:14: 24:43
+- // + span: $DIR/lower_intrinsics.rs:29:14: 29:43
- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn() -> ! {std::intrinsics::unreachable}, val: Value(Scalar(<ZST>)) }
-+ unreachable; // scope 1 at $DIR/lower_intrinsics.rs:24:14: 24:45
++ unreachable; // scope 1 at $DIR/lower_intrinsics.rs:29:14: 29:45
}
bb1 (cleanup): {
- resume; // scope 0 at $DIR/lower_intrinsics.rs:23:1: 25:2
+ resume; // scope 0 at $DIR/lower_intrinsics.rs:28:1: 30:2
}
}
- StorageDead(_7); // scope 3 at $DIR/remove_storage_markers.rs:8:18: 8:19
- StorageDead(_6); // scope 2 at $DIR/remove_storage_markers.rs:10:5: 10:6
- StorageDead(_4); // scope 1 at $DIR/remove_storage_markers.rs:10:5: 10:6
-- StorageDead(_2); // scope 1 at $DIR/remove_storage_markers.rs:8:18: 8:19
+- StorageDead(_2); // scope 1 at $DIR/remove_storage_markers.rs:10:5: 10:6
- StorageDead(_1); // scope 0 at $DIR/remove_storage_markers.rs:11:1: 11:2
return; // scope 0 at $DIR/remove_storage_markers.rs:11:2: 11:2
}
goto: file://|DOC_PATH|/test_docs/index.html
click: ".srclink"
+wait-for: "#sidebar-toggle"
click: "#sidebar-toggle"
wait-for: 500
fail: true
assert-property: (".top-doc .docblock", {"scrollWidth": "816"})
// However, since there is overflow in the <table>, its scroll width is bigger.
assert-property: (".top-doc .docblock table", {"scrollWidth": "1573"})
+
+// Checking it works on other doc blocks as well...
+
+// Logically, the ".docblock" and the "<p>" should have the same scroll width.
+compare-elements-property: ("#implementations + details .docblock", "#implementations + details .docblock > p", ["scrollWidth"])
+assert-property: ("#implementations + details .docblock", {"scrollWidth": "816"})
+// However, since there is overflow in the <table>, its scroll width is bigger.
+assert-property: ("#implementations + details .docblock table", {"scrollWidth": "1573"})
--- /dev/null
+// We check the background color on the jump to definition links in the source code page.
+goto: file://|DOC_PATH|/src/link_to_definition/lib.rs.html
+
+// Set the theme to dark.
+local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
+// We reload the page so the local storage settings are being used.
+reload:
+
+assert-css: ("body.source .example-wrap pre.rust a", {"background-color": "rgb(51, 51, 51)"}, ALL)
+
+// Set the theme to ayu.
+local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"}
+// We reload the page so the local storage settings are being used.
+reload:
+
+assert-css: ("body.source .example-wrap pre.rust a", {"background-color": "rgb(51, 51, 51)"}, ALL)
+
+// Set the theme to light.
+local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
+// We reload the page so the local storage settings are being used.
+reload:
+
+assert-css: ("body.source .example-wrap pre.rust a", {"background-color": "rgb(238, 238, 238)"}, ALL)
///
/// I wanna sqdkfnqds f dsqf qds f dsqf dsq f dsq f qds f qds f qds f dsqq f dsf sqdf dsq fds f dsq f dq f ds fq sd fqds f dsq f sqd fsq df sd fdsqfqsd fdsq f dsq f dsqfd s dfq
pub struct Foo;
+
+ /// | This::is::a::kinda::very::long::header::number::one | This::is::a::kinda::very::long::header::number::two | This::is::a::kinda::very::long::header::number::one | This::is::a::kinda::very::long::header::number::two |
+ /// | ----------- | ----------- | ----------- | ----------- |
+ /// | This::is::a::kinda::long::content::number::one | This::is::a::kinda::very::long::content::number::two | This::is::a::kinda::long::content::number::one | This::is::a::kinda::very::long::content::number::two |
+ ///
+ /// I wanna sqdkfnqds f dsqf qds f dsqf dsq f dsq f qds f qds f qds f dsqq f dsf sqdf dsq fds f dsq f dq f ds fq sd fqds f dsq f sqd fsq df sd fdsqfqsd fdsq f dsq f dsqfd s dfq
+ impl Foo {
+ pub fn foo(&self) {}
+ }
}
pub mod summary_table {
--- /dev/null
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "link_to_definition"
+version = "0.1.0"
--- /dev/null
+[package]
+name = "link_to_definition"
+version = "0.1.0"
+edition = "2018"
+
+[lib]
+path = "lib.rs"
--- /dev/null
+pub struct Bar {
+ pub a: String,
+ pub b: u32,
+}
+
+pub fn foo(_b: &Bar) {}
const EXPECTED = {
'others': [
- { 'path': 'std', 'name': 'str' },
- { 'path': 'std', 'name': 'u8' },
- { 'path': 'std::ffi', 'name': 'CStr' },
+ { 'path': 'std', 'name': 'str', 'href': '../std/primitive.str.html' },
+ { 'path': 'std', 'name': 'u8', 'href': '../std/primitive.u8.html' },
+ { 'path': 'std', 'name': 'str', 'href': '../std/str/index.html' },
+ { 'path': 'std', 'name': 'u8', 'href': '../std/u8/index.html' },
],
};
--- /dev/null
+// compile-flags:-Z unstable-options --show-coverage
+// check-pass
+
+// The point of this test is to ensure that the number of "documented" items
+// is higher than in `enum-tuple.rs`.
+
+//! (remember the crate root is still a module)
+
+/// so check out this enum here
+pub enum ThisEnum {
+ /// VarOne.
+ VarOne(
+ /// hello!
+ String,
+ ),
+ /// Var Two.
+ VarTwo(
+ /// Hello
+ String,
+ /// Bis repetita.
+ String,
+ ),
+}
+
+/// Struct.
+pub struct ThisStruct(
+ /// hello
+ u32,
+);
+
+/// Struct.
+pub struct ThisStruct2(
+ /// hello
+ u32,
+ /// Bis repetita.
+ u8,
+);
--- /dev/null
++-------------------------------------+------------+------------+------------+------------+
+| File | Documented | Percentage | Examples | Percentage |
++-------------------------------------+------------+------------+------------+------------+
+| ...overage/enum-tuple-documented.rs | 9 | 100.0% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
+| Total | 9 | 100.0% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
--- /dev/null
+// compile-flags:-Z unstable-options --show-coverage
+// check-pass
+
+//! (remember the crate root is still a module)
+
+/// so check out this enum here
+pub enum ThisEnum {
+ /// No need to document the field if there is only one in a tuple variant!
+ VarOne(String),
+ /// But if there is more than one... still fine!
+ VarTwo(String, String),
+}
+
+/// Struct.
+pub struct ThisStruct(u32);
+
+/// Struct.
+pub struct ThisStruct2(u32, u8);
--- /dev/null
++-------------------------------------+------------+------------+------------+------------+
+| File | Documented | Percentage | Examples | Percentage |
++-------------------------------------+------------+------------+------------+------------+
+| ...ustdoc-ui/coverage/enum-tuple.rs | 6 | 100.0% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
+| Total | 6 | 100.0% | 0 | 0.0% |
++-------------------------------------+------------+------------+------------+------------+
+-------------------------------------+------------+------------+------------+------------+
| File | Documented | Percentage | Examples | Percentage |
+-------------------------------------+------------+------------+------------+------------+
-| ...est/rustdoc-ui/coverage/enums.rs | 6 | 66.7% | 0 | 0.0% |
+| ...est/rustdoc-ui/coverage/enums.rs | 6 | 75.0% | 0 | 0.0% |
+-------------------------------------+------------+------------+------------+------------+
-| Total | 6 | 66.7% | 0 | 0.0% |
+| Total | 6 | 75.0% | 0 | 0.0% |
+-------------------------------------+------------+------------+------------+------------+
--- /dev/null
+// check-pass
+// compile-flags:-Zunstable-options --display-doctest-warnings --test
+// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
+
+/// ```
+/// let x = 12;
+/// ```
+pub fn foo() {}
--- /dev/null
+
+running 1 test
+test $DIR/display-output.rs - foo (line 6) ... ok
+
+successes:
+
+---- $DIR/display-output.rs - foo (line 6) stdout ----
+warning: unused variable: `x`
+ --> $DIR/display-output.rs:7:5
+ |
+LL | let x = 12;
+ | ^ help: if this is intentional, prefix it with an underscore: `_x`
+ |
+ = note: `#[warn(unused_variables)]` on by default
+
+warning: 1 warning emitted
+
+
+
+successes:
+ $DIR/display-output.rs - foo (line 6)
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
/// Damn enum's variants: [Enum::A#whatever].
//~^ ERROR `Enum::A#whatever` contains an anchor
pub fn enum_link() {}
-
-/// Primitives?
-///
-/// [u32#hello]
-//~^ ERROR `u32#hello` contains an anchor
-pub fn x() {}
-
-/// [prim@usize#x]
-//~^ ERROR `prim@usize#x` contains an anchor
-pub mod usize {}
-error: `prim@usize#x` contains an anchor, but links to builtin types are already anchored
- --> $DIR/anchors.rs:47:6
- |
-LL | /// [prim@usize#x]
- | ^^^^^^^^^^--
- | |
- | invalid anchor
- |
-note: the lint level is defined here
- --> $DIR/anchors.rs:1:9
- |
-LL | #![deny(rustdoc::broken_intra_doc_links)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: this restriction may be lifted in a future release
- = note: see https://github.com/rust-lang/rust/issues/83083 for more information
-
error: `Foo::f#hola` contains an anchor, but links to fields are already anchored
--> $DIR/anchors.rs:25:15
|
| ^^^^^^-----
| |
| invalid anchor
+ |
+note: the lint level is defined here
+ --> $DIR/anchors.rs:1:9
+ |
+LL | #![deny(rustdoc::broken_intra_doc_links)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `hello#people#!` contains multiple anchors
--> $DIR/anchors.rs:31:28
| |
| invalid anchor
-error: `u32#hello` contains an anchor, but links to builtin types are already anchored
- --> $DIR/anchors.rs:43:6
- |
-LL | /// [u32#hello]
- | ^^^------
- | |
- | invalid anchor
- |
- = note: this restriction may be lifted in a future release
- = note: see https://github.com/rust-lang/rust/issues/83083 for more information
-
-error: aborting due to 5 previous errors
+error: aborting due to 3 previous errors
help: mark blocks that do not contain Rust code as text
|
LL | /// ```text
- | ~~~~~~~
+ | ++++
warning: could not parse code block as Rust code
--> $DIR/invalid-syntax.rs:9:5
help: mark blocks that do not contain Rust code as text
|
LL | /// ```text
- | ~~~~~~~
+ | ++++
warning: could not parse code block as Rust code
--> $DIR/invalid-syntax.rs:21:5
help: mark blocks that do not contain Rust code as text
|
LL | /// ```text
- | ~~~~~~~
+ | ++++
warning: could not parse code block as Rust code
--> $DIR/invalid-syntax.rs:35:5
help: mark blocks that do not contain Rust code as text
|
LL | /// ```text
- | ~~~~~~~
+ | ++++
warning: could not parse code block as Rust code
--> $DIR/invalid-syntax.rs:92:9
help: mark blocks that do not contain Rust code as text
|
LL | /// ```text
- | ~~~~~~~
+ | ++++
warning: 12 warnings emitted
b: f32,
}
+// no code example and it's fine!
+impl Clone for Struct {
+ fn clone(&self) -> Self {
+ Self { field: self.field }
+ }
+}
+
#[doc(hidden)]
pub mod foo {
+// no-prefer-dynamic
// compile-flags: -Cmetadata=aux
-
+#![crate_type = "rlib"]
#![doc(html_root_url = "http://example.com/")]
+#![feature(lang_items)]
+#![no_std]
+
+#[lang = "eh_personality"]
+fn foo() {}
+
+#[panic_handler]
+fn bar(_: &core::panic::PanicInfo) -> ! { loop {} }
/// dox
#[doc(primitive = "pointer")]
// compile-flags: --crate-type lib --edition 2018
+#![feature(no_core)]
+#![no_core]
+
#[doc(primitive = "usize")]
/// This is the built-in type `usize`.
mod usize {
--- /dev/null
+// compile-flags: -Zunstable-options --generate-link-to-definition
+
+#![crate_name = "foo"]
+
+// @has 'src/foo/check-source-code-urls-to-def-std.rs.html'
+
+fn babar() {}
+
+// @has - '//a[@href="{{channel}}/std/primitive.u32.html"]' 'u32'
+// @has - '//a[@href="{{channel}}/std/primitive.str.html"]' 'str'
+// @has - '//a[@href="{{channel}}/std/primitive.bool.html"]' 'bool'
+// @has - '//a[@href="../../src/foo/check-source-code-urls-to-def-std.rs.html#7"]' 'babar'
+pub fn foo(a: u32, b: &str, c: String) {
+ let x = 12;
+ let y: bool = true;
+ babar();
+}
fn babar() {}
// @has - '//a/@href' '/struct.String.html'
+// @has - '//a/@href' '/primitive.u32.html'
+// @has - '//a/@href' '/primitive.str.html'
// @count - '//a[@href="../../src/foo/check-source-code-urls-to-def.rs.html#21"]' 5
// @has - '//a[@href="../../source_code/struct.SourceCode.html"]' 'source_code::SourceCode'
pub fn foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar, f: source_code::SourceCode) {
// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'bar::sub::Trait'
// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'Trait'
-pub fn foo2<T: bar::sub::Trait, V: Trait>(t: &T, v: &V) {
+pub fn foo2<T: bar::sub::Trait, V: Trait>(t: &T, v: &V, b: bool) {
}
+
+// @has - '//a[@href="../../foo/primitive.bool.html"]' 'bool'
+#[doc(primitive = "bool")]
+mod whatever {}
// aux-build:primitive-doc.rs
// compile-flags: --extern-html-root-url=primitive_doc=../ -Z unstable-options
+// ignore-windows
-#![no_std]
+#![feature(no_core)]
+#![no_core]
extern crate primitive_doc;
// @has 'cross_crate_primitive_doc/fn.foo.html' '//a[@href="../primitive_doc/primitive.usize.html"]' 'usize'
+// @has 'cross_crate_primitive_doc/fn.foo.html' '//a[@href="../primitive_doc/primitive.usize.html"]' 'link'
+/// [link](usize)
pub fn foo() -> usize { 0 }
///
/// To link to [Something#Anchor!]
pub struct SomeOtherType;
+
+/// Primitives?
+///
+/// [u32#hello]
+// @has anchors/fn.x.html
+// @has - '//a/@href' '{{channel}}/std/primitive.u32.html#hello'
+pub fn x() {}
+
+/// [prim@usize#x]
+// @has anchors/usize/index.html
+// @has - '//a/@href' '{{channel}}/std/primitive.usize.html#x'
+pub mod usize {}
#![no_core]
#![crate_type="rlib"]
+#[doc(primitive = "char")]
+/// Some char docs
+mod char {}
+
#[lang = "char"]
impl char {
pub fn len_utf8(self) -> usize {
#![crate_type = "rlib"]
// @has prim_methods_external_core/index.html
-// @has - '//*[@id="main"]//a[@href="{{channel}}/std/primitive.char.html"]' 'char'
-// @has - '//*[@id="main"]//a[@href="{{channel}}/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8'
+// @has - '//*[@id="main"]//a[@href="../my_core/primitive.char.html"]' 'char'
+// @has - '//*[@id="main"]//a[@href="../my_core/primitive.char.html#method.len_utf8"]' 'char::len_utf8'
//! A [`char`] and its [`char::len_utf8`].
// @has prim_methods_local/index.html
-// @has - '//*[@id="main"]//a[@href="{{channel}}/std/primitive.char.html"]' 'char'
-// @has - '//*[@id="main"]//a[@href="{{channel}}/std/primitive.char.html#method.len_utf8"]' 'char::len_utf8'
+// @has - '//*[@id="main"]//a[@href="primitive.char.html"]' 'char'
+// @has - '//*[@id="main"]//a[@href="primitive.char.html#method.len_utf8"]' 'char::len_utf8'
-//! A [`char`] and its [`char::len_utf8`].
+//! A [prim@`char`] and its [`char::len_utf8`].
+
+#[doc(primitive = "char")]
+mod char {}
#[lang = "char"]
impl char {
/// [Self::f]
/// [Self::MAX]
// @has intra_link_prim_self/primitive.usize.html
-// @has - '//a[@href="{{channel}}/std/primitive.usize.html#method.f"]' 'Self::f'
-// @has - '//a[@href="{{channel}}/std/primitive.usize.html#associatedconstant.MAX"]' 'Self::MAX'
+// @has - '//a[@href="primitive.usize.html#method.f"]' 'Self::f'
+// @has - '//a[@href="primitive.usize.html#associatedconstant.MAX"]' 'Self::MAX'
impl usize {
/// Some docs
pub fn f() {}
// aux-build:issue-15318.rs
// ignore-cross-compile
+#![no_std]
extern crate issue_15318;
--- /dev/null
+// This test ensure that #[doc(hidden)] is applied correctly in enum variant fields.
+
+// Denotes a field which should be hidden.
+pub struct H;
+
+// Denotes a field which should not be hidden (shown).
+pub struct S;
+
+// @has issue_88600/enum.FooEnum.html
+pub enum FooEnum {
+ // @has - '//*[@id="variant.HiddenTupleItem"]//code' 'HiddenTupleItem(_)'
+ // @count - '//*[@id="variant.HiddenTupleItem.field.0"]' 0
+ HiddenTupleItem(#[doc(hidden)] H),
+ // @has - '//*[@id="variant.MultipleHidden"]//code' 'MultipleHidden(_, _)'
+ // @count - '//*[@id="variant.MultipleHidden.field.0"]' 0
+ // @count - '//*[@id="variant.MultipleHidden.field.1"]' 0
+ MultipleHidden(#[doc(hidden)] H, #[doc(hidden)] H),
+ // @has - '//*[@id="variant.MixedHiddenFirst"]//code' 'MixedHiddenFirst(_, S)'
+ // @count - '//*[@id="variant.MixedHiddenFirst.field.0"]' 0
+ // @has - '//*[@id="variant.MixedHiddenFirst.field.1"]' '1: S'
+ MixedHiddenFirst(#[doc(hidden)] H, S),
+ // @has - '//*[@id="variant.MixedHiddenLast"]//code' 'MixedHiddenLast(S, _)'
+ // @has - '//*[@id="variant.MixedHiddenLast.field.0"]' '0: S'
+ // @count - '//*[@id="variant.MixedHiddenLast.field.1"]' 0
+ MixedHiddenLast(S, #[doc(hidden)] H),
+ // @has - '//*[@id="variant.HiddenStruct"]//code' 'HiddenStruct'
+ // @count - '//*[@id="variant.HiddenStruct.field.h"]' 0
+ // @has - '//*[@id="variant.HiddenStruct.field.s"]' 's: S'
+ HiddenStruct {
+ #[doc(hidden)]
+ h: H,
+ s: S,
+ },
+}
--- /dev/null
+#![no_std]
+
+/// Link to [intra-doc link][u8]
+// @has 'no_std_primitive/fn.foo.html' '//a[@href="{{channel}}/core/primitive.u8.html"]' 'intra-doc link'
+// @has - '//a[@href="{{channel}}/core/primitive.u8.html"]' 'u8'
+pub fn foo() -> u8 {}
--- /dev/null
+#![no_std]
+#![deny(warnings)]
+#![deny(rustdoc::broken_intra_doc_links)]
+
+// @has no_std/fn.foo.html '//a/[@href="{{channel}}/core/primitive.u8.html"]' 'u8'
+// @has no_std/fn.foo.html '//a/[@href="{{channel}}/core/primitive.u8.html"]' 'primitive link'
+/// Link to [primitive link][u8]
+pub fn foo() -> u8 {}
+
+// Test that all primitives can be linked to.
+/// [isize] [i8] [i16] [i32] [i64] [i128]
+/// [usize] [u8] [u16] [u32] [u64] [u128]
+/// [f32] [f64]
+/// [char] [bool] [str] [slice] [array] [tuple] [unit]
+/// [pointer] [reference] [fn] [never]
+pub fn bar() {}
// @has no_redundancy/struct.Outer.html
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
-// "impl<T> Send for Outer<T> where T: Copy + Send"
+// "impl<T> Send for Outer<T> where T: Send + Copy"
pub struct Outer<T> {
inner_field: Inner<T>,
}
--- /dev/null
+#![crate_name = "foo"]
+
+// @has foo/struct.Foo.html
+// @count - '//*[@class="docblock"]/div/table' 2
+// @!has - '//*[@class="docblock"]/table'
+/// | hello | hello2 |
+/// | ----- | ------ |
+/// | data | data2 |
+pub struct Foo;
+
+impl Foo {
+ /// | hello | hello2 |
+ /// | ----- | ------ |
+ /// | data | data2 |
+ pub fn foo(&self) {}
+}
help: if this is a `self` type, give it a parameter name
|
LL | fn foo(self: i32);
- | ~~~~~~~~~
+ | +++++
help: if this is a parameter name, give it a type
|
LL | fn foo(i32: TypeName);
- | ~~~~~~~~~~~~~
+ | ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn foo(_: i32);
- | ~~~~~~
+ | ++
error: expected one of `:`, `@`, or `|`, found `)`
--> $DIR/anon-params-denied-2018.rs:9:29
help: if this is a `self` type, give it a parameter name
|
LL | fn foo_with_ref(self: &mut i32);
- | ~~~~~~~~~~~~~~
+ | +++++
help: if this is a parameter name, give it a type
|
LL | fn foo_with_ref(i32: &mut TypeName);
help: if this is a type, explicitly ignore the parameter name
|
LL | fn foo_with_ref(_: &mut i32);
- | ~~~~~~~~~~~
+ | ++
error: expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `)`
--> $DIR/anon-params-denied-2018.rs:12:47
help: if this is a `self` type, give it a parameter name
|
LL | fn bar_with_default_impl(self: String, String) {}
- | ~~~~~~~~~~~~
+ | +++++
help: if this is a parameter name, give it a type
|
LL | fn bar_with_default_impl(String: TypeName, String) {}
- | ~~~~~~~~~~~~~~~~
+ | ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn bar_with_default_impl(_: String, String) {}
- | ~~~~~~~~~
+ | ++
error: expected one of `:`, `@`, or `|`, found `)`
--> $DIR/anon-params-denied-2018.rs:22:44
help: if this is a parameter name, give it a type
|
LL | fn bar_with_default_impl(String, String: TypeName) {}
- | ~~~~~~~~~~~~~~~~
+ | ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn bar_with_default_impl(String, _: String) {}
- | ~~~~~~~~~
+ | ++
error: expected one of `:`, `@`, or `|`, found `,`
--> $DIR/anon-params-denied-2018.rs:27:22
help: if this is a parameter name, give it a type
|
LL | fn baz(a:usize, b: TypeName, c: usize) -> usize {
- | ~~~~~~~~~~~
+ | ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn baz(a:usize, _: b, c: usize) -> usize {
- | ~~~~
+ | ++
error: aborting due to 9 previous errors
// Test binary_search_by_key lifetime. Issue #34683
+#[allow(dead_code)]
#[derive(Debug)]
struct Assignment {
topic: String,
//~^ ERROR asm template must be a string literal
asm!("{1}", format!("{{{}}}", 0), in(reg) foo, out(reg) bar);
//~^ ERROR asm template must be a string literal
+ asm!("{}", in(reg) _);
+ //~^ ERROR _ cannot be used for input operands
+ asm!("{}", inout(reg) _);
+ //~^ ERROR _ cannot be used for input operands
+ asm!("{}", inlateout(reg) _);
+ //~^ ERROR _ cannot be used for input operands
}
}
|
= note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
+error: _ cannot be used for input operands
+ --> $DIR/parse-error.rs:79:28
+ |
+LL | asm!("{}", in(reg) _);
+ | ^
+
+error: _ cannot be used for input operands
+ --> $DIR/parse-error.rs:81:31
+ |
+LL | asm!("{}", inout(reg) _);
+ | ^
+
+error: _ cannot be used for input operands
+ --> $DIR/parse-error.rs:83:35
+ |
+LL | asm!("{}", inlateout(reg) _);
+ | ^
+
error: requires at least a template string argument
- --> $DIR/parse-error.rs:84:1
+ --> $DIR/parse-error.rs:90:1
|
LL | global_asm!();
| ^^^^^^^^^^^^^^
error: asm template must be a string literal
- --> $DIR/parse-error.rs:86:13
+ --> $DIR/parse-error.rs:92:13
|
LL | global_asm!(FOO);
| ^^^
error: expected token: `,`
- --> $DIR/parse-error.rs:88:18
+ --> $DIR/parse-error.rs:94:18
|
LL | global_asm!("{}" FOO);
| ^^^ expected `,`
error: expected operand, options, or additional template string
- --> $DIR/parse-error.rs:90:19
+ --> $DIR/parse-error.rs:96:19
|
LL | global_asm!("{}", FOO);
| ^^^ expected operand, options, or additional template string
error: expected expression, found end of macro arguments
- --> $DIR/parse-error.rs:92:24
+ --> $DIR/parse-error.rs:98:24
|
LL | global_asm!("{}", const);
| ^ expected expression
error: expected one of `,`, `.`, `?`, or an operator, found `FOO`
- --> $DIR/parse-error.rs:94:30
+ --> $DIR/parse-error.rs:100:30
|
LL | global_asm!("{}", const(reg) FOO);
| ^^^ expected one of `,`, `.`, `?`, or an operator
error: expected one of `)`, `att_syntax`, or `raw`, found `FOO`
- --> $DIR/parse-error.rs:96:25
+ --> $DIR/parse-error.rs:102:25
|
LL | global_asm!("", options(FOO));
| ^^^ expected one of `)`, `att_syntax`, or `raw`
error: expected one of `)`, `att_syntax`, or `raw`, found `nomem`
- --> $DIR/parse-error.rs:98:25
+ --> $DIR/parse-error.rs:104:25
|
LL | global_asm!("", options(nomem FOO));
| ^^^^^ expected one of `)`, `att_syntax`, or `raw`
error: expected one of `)`, `att_syntax`, or `raw`, found `nomem`
- --> $DIR/parse-error.rs:100:25
+ --> $DIR/parse-error.rs:106:25
|
LL | global_asm!("", options(nomem, FOO));
| ^^^^^ expected one of `)`, `att_syntax`, or `raw`
error: arguments are not allowed after options
- --> $DIR/parse-error.rs:102:30
+ --> $DIR/parse-error.rs:108:30
|
LL | global_asm!("{}", options(), const FOO);
| --------- ^^^^^^^^^ argument
| previous options
error: expected string literal
- --> $DIR/parse-error.rs:104:29
+ --> $DIR/parse-error.rs:110:29
|
LL | global_asm!("", clobber_abi(FOO));
| ^^^ not a string literal
error: expected `)`, found `FOO`
- --> $DIR/parse-error.rs:106:33
+ --> $DIR/parse-error.rs:112:33
|
LL | global_asm!("", clobber_abi("C" FOO));
| ^^^ expected `)`
error: expected `)`, found `,`
- --> $DIR/parse-error.rs:108:32
+ --> $DIR/parse-error.rs:114:32
|
LL | global_asm!("", clobber_abi("C", FOO));
| ^ expected `)`
error: arguments are not allowed after clobber_abi
- --> $DIR/parse-error.rs:110:37
+ --> $DIR/parse-error.rs:116:37
|
LL | global_asm!("{}", clobber_abi("C"), const FOO);
| ---------------- ^^^^^^^^^ argument
| clobber_abi
error: `clobber_abi` cannot be used with `global_asm!`
- --> $DIR/parse-error.rs:110:19
+ --> $DIR/parse-error.rs:116:19
|
LL | global_asm!("{}", clobber_abi("C"), const FOO);
| ^^^^^^^^^^^^^^^^
error: clobber_abi is not allowed after options
- --> $DIR/parse-error.rs:113:28
+ --> $DIR/parse-error.rs:119:28
|
LL | global_asm!("", options(), clobber_abi("C"));
| --------- ^^^^^^^^^^^^^^^^
| options
error: clobber_abi is not allowed after options
- --> $DIR/parse-error.rs:115:30
+ --> $DIR/parse-error.rs:121:30
|
LL | global_asm!("{}", options(), clobber_abi("C"), const FOO);
| --------- ^^^^^^^^^^^^^^^^
| options
error: clobber_abi specified multiple times
- --> $DIR/parse-error.rs:117:35
+ --> $DIR/parse-error.rs:123:35
|
LL | global_asm!("", clobber_abi("C"), clobber_abi("C"));
| ---------------- ^^^^^^^^^^^^^^^^
| clobber_abi previously specified here
error: duplicate argument named `a`
- --> $DIR/parse-error.rs:119:35
+ --> $DIR/parse-error.rs:125:35
|
LL | global_asm!("{a}", a = const FOO, a = const BAR);
| ------------- ^^^^^^^^^^^^^ duplicate argument
| previously here
error: argument never used
- --> $DIR/parse-error.rs:119:35
+ --> $DIR/parse-error.rs:125:35
|
LL | global_asm!("{a}", a = const FOO, a = const BAR);
| ^^^^^^^^^^^^^ argument never used
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {1} */"`
error: expected one of `clobber_abi`, `const`, or `options`, found `""`
- --> $DIR/parse-error.rs:122:28
+ --> $DIR/parse-error.rs:128:28
|
LL | global_asm!("", options(), "");
| ^^ expected one of `clobber_abi`, `const`, or `options`
error: expected one of `clobber_abi`, `const`, or `options`, found `"{}"`
- --> $DIR/parse-error.rs:124:30
+ --> $DIR/parse-error.rs:130:30
|
LL | global_asm!("{}", const FOO, "{}", const FOO);
| ^^^^ expected one of `clobber_abi`, `const`, or `options`
error: asm template must be a string literal
- --> $DIR/parse-error.rs:126:13
+ --> $DIR/parse-error.rs:132:13
|
LL | global_asm!(format!("{{{}}}", 0), const FOO);
| ^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
error: asm template must be a string literal
- --> $DIR/parse-error.rs:128:20
+ --> $DIR/parse-error.rs:134:20
|
LL | global_asm!("{1}", format!("{{{}}}", 0), const FOO, const BAR);
| ^^^^^^^^^^^^^^^^^^^^
LL | asm!("{1}", in("eax") foo, const bar);
| ^^^ non-constant value
-error: aborting due to 63 previous errors
+error: aborting due to 66 previous errors
For more information about this error, try `rustc --explain E0435`.
help: use fully qualified syntax to disambiguate
|
LL | fn a<C:Vehicle+Box>(_: <C as Box>::Color) {
- | ~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | fn a<C:Vehicle+Box>(_: <C as Vehicle>::Color) {
- | ~~~~~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~~~~~
error[E0221]: ambiguous associated type `Color` in bounds of `C`
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:20:12
help: use fully qualified syntax to disambiguate
|
LL | fn b<C>(_: <C as Box>::Color) where C : Vehicle+Box {
- | ~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | fn b<C>(_: <C as Vehicle>::Color) where C : Vehicle+Box {
- | ~~~~~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~~~~~
error[E0221]: ambiguous associated type `Color` in bounds of `C`
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:24:12
help: use fully qualified syntax to disambiguate
|
LL | fn c<C>(_: <C as Box>::Color) where C : Vehicle, C : Box {
- | ~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | fn c<C>(_: <C as Vehicle>::Color) where C : Vehicle, C : Box {
- | ~~~~~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~~~~~
error[E0221]: ambiguous associated type `Color` in bounds of `X`
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:35:20
help: use fully qualified syntax to disambiguate
|
LL | fn e(&self, _: <X as Box>::Color) where X : Box;
- | ~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | fn e(&self, _: <X as Vehicle>::Color) where X : Box;
- | ~~~~~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~~~~~
error[E0221]: ambiguous associated type `Color` in bounds of `X`
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:38:20
help: use fully qualified syntax to disambiguate
|
LL | fn f(&self, _: <X as Box>::Color) where X : Box { }
- | ~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | fn f(&self, _: <X as Vehicle>::Color) where X : Box { }
- | ~~~~~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~~~~~
error[E0221]: ambiguous associated type `Color` in bounds of `X`
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:30:20
help: use fully qualified syntax to disambiguate
|
LL | fn d(&self, _: <X as Box>::Color) where X : Box { }
- | ~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | fn d(&self, _: <X as Vehicle>::Color) where X : Box { }
- | ~~~~~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~~~~~
error: aborting due to 6 previous errors
help: use fully qualified syntax to disambiguate
|
LL | fn dent<C:BoxCar>(c: C, color: <C as Vehicle>::Color) {
- | ~~~~~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | fn dent<C:BoxCar>(c: C, color: <C as Box>::Color) {
- | ~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~
error[E0222]: ambiguous associated type `Color` in bounds of `BoxCar`
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:37
help: use fully qualified syntax to disambiguate
|
LL | fn paint<C:BoxCar>(c: C, d: <C as Vehicle>::Color) {
- | ~~~~~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | fn paint<C:BoxCar>(c: C, d: <C as Box>::Color) {
- | ~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~
error[E0191]: the value of the associated types `Color` (from trait `Box`), `Color` (from trait `Vehicle`) must be specified
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:32
help: use fully qualified syntax to disambiguate
|
LL | pub fn f2<T: Foo + Bar>(a: T, x: <T as Bar>::A) {}
- | ~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | pub fn f2<T: Foo + Bar>(a: T, x: <T as Foo>::A) {}
- | ~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~
error: aborting due to 2 previous errors
help: change the type of the numeric literal from `i32` to `u32`
|
LL | f1(2i32, 4u32);
- | ~~~~
+ | ~~~
error[E0277]: the trait bound `u32: Foo` is not satisfied
--> $DIR/associated-types-path-2.rs:29:5
help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
|
LL | let _: i32 = f2(2i32).try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error: aborting due to 6 previous errors
--> $DIR/associated-types-project-from-hrtb-in-fn.rs:13:8
|
LL | x: I::A)
- | ^^^^ help: use a fully qualified path with inferred lifetimes: `<I as Foo<&isize>>::A`
+ | ^^^^
+ |
+help: use a fully qualified path with inferred lifetimes
+ |
+LL | x: <I as Foo<&isize>>::A)
+ | ~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
--> $DIR/associated-types-project-from-hrtb-in-trait-method.rs:13:32
|
LL | fn some_method(&self, arg: I::A);
- | ^^^^ help: use a fully qualified path with inferred lifetimes: `<I as Foo<&isize>>::A`
+ | ^^^^
+ |
+help: use a fully qualified path with inferred lifetimes
+ |
+LL | fn some_method(&self, arg: <I as Foo<&isize>>::A);
+ | ~~~~~~~~~~~~~~~~~~~~
error[E0212]: cannot use the associated type of a trait with uninferred generic parameters
--> $DIR/associated-types-project-from-hrtb-in-trait-method.rs:32:24
|
LL | fn mango(&self) -> X::Assoc {
- | ^^^^^^^^ help: use a fully qualified path with inferred lifetimes: `<X as Banana<'_>>::Assoc`
+ | ^^^^^^^^
+ |
+help: use a fully qualified path with inferred lifetimes
+ |
+LL | fn mango(&self) -> <X as Banana<'_>>::Assoc {
+ | ~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
--> $DIR/issue-54752-async-block.rs:6:22
|
LL | fn main() { let _a = (async { }); }
- | ^^^^^^^^^^^^ help: remove these parentheses
+ | ^ ^
|
= note: `#[warn(unused_parens)]` on by default
+help: remove these parentheses
+ |
+LL - fn main() { let _a = (async { }); }
+LL + fn main() { let _a = async { }; }
+ |
warning: 1 warning emitted
// run-pass
+#![allow(dead_code)]
#![deny(unused_mut)]
#[derive(Debug)]
--- /dev/null
+error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
+ --> $DIR/issue-82462.rs:18:9
+ |
+LL | for x in DroppingSlice(&*v).iter() {
+ | ------------------
+ | | |
+ | | immutable borrow occurs here
+ | a temporary with access to the immutable borrow is created here ...
+LL | v.push(*x);
+ | ^ mutable borrow occurs here
+LL | break;
+LL | }
+ | - ... and the immutable borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DroppingSlice`
+ |
+help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
+ |
+LL | };
+ | +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
--- /dev/null
+struct DroppingSlice<'a>(&'a [i32]);
+
+impl Drop for DroppingSlice<'_> {
+ fn drop(&mut self) {
+ println!("hi from slice");
+ }
+}
+
+impl DroppingSlice<'_> {
+ fn iter(&self) -> std::slice::Iter<'_, i32> {
+ self.0.iter()
+ }
+}
+
+fn main() {
+ let mut v = vec![1, 2, 3, 4];
+ for x in DroppingSlice(&*v).iter() {
+ v.push(*x); //~ERROR
+ break;
+ }
+}
--- /dev/null
+error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
+ --> $DIR/issue-82462.rs:18:9
+ |
+LL | for x in DroppingSlice(&*v).iter() {
+ | ------------------
+ | | |
+ | | immutable borrow occurs here
+ | a temporary with access to the immutable borrow is created here ...
+LL | v.push(*x);
+ | ^^^^^^^^^^ mutable borrow occurs here
+LL | break;
+LL | }
+ | - ... and the immutable borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DroppingSlice`
+ |
+help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
+ |
+LL | };
+ | +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
// check-pass
#![allow(unreachable_code)]
#![warn(unused)]
+#![allow(dead_code)]
#[derive(Debug)]
struct Point {
warning: value captured by `a` is never read
- --> $DIR/liveness.rs:23:9
+ --> $DIR/liveness.rs:24:9
|
LL | a = 1;
| ^
= help: did you mean to capture by reference instead?
warning: unused variable: `a`
- --> $DIR/liveness.rs:32:9
+ --> $DIR/liveness.rs:33:9
|
LL | a += 1;
| ^
= help: did you mean to capture by reference instead?
warning: value assigned to `a` is never read
- --> $DIR/liveness.rs:52:9
+ --> $DIR/liveness.rs:53:9
|
LL | a += 1;
| ^
= help: maybe it is overwritten before being read?
warning: value assigned to `a` is never read
- --> $DIR/liveness.rs:76:13
+ --> $DIR/liveness.rs:77:13
|
LL | a = Some("d1");
| ^
= help: maybe it is overwritten before being read?
warning: value assigned to `b` is never read
- --> $DIR/liveness.rs:84:13
+ --> $DIR/liveness.rs:85:13
|
LL | b = Some("e1");
| ^
= help: maybe it is overwritten before being read?
warning: value assigned to `b` is never read
- --> $DIR/liveness.rs:86:13
+ --> $DIR/liveness.rs:87:13
|
LL | b = Some("e2");
| ^
= help: maybe it is overwritten before being read?
warning: unused variable: `b`
- --> $DIR/liveness.rs:84:13
+ --> $DIR/liveness.rs:85:13
|
LL | b = Some("e1");
| ^
// check-pass
#![warn(unused)]
+#![allow(dead_code)]
#[derive(Debug)]
struct MyStruct {
warning: value assigned to `a` is never read
- --> $DIR/liveness_unintentional_copy.rs:19:9
+ --> $DIR/liveness_unintentional_copy.rs:20:9
|
LL | a = s;
| ^
= help: maybe it is overwritten before being read?
warning: unused variable: `a`
- --> $DIR/liveness_unintentional_copy.rs:19:9
+ --> $DIR/liveness_unintentional_copy.rs:20:9
|
LL | a = s;
| ^
= help: did you mean to capture by reference instead?
warning: unused variable: `a`
- --> $DIR/liveness_unintentional_copy.rs:35:9
+ --> $DIR/liveness_unintentional_copy.rs:36:9
|
LL | a += x;
| ^
// edition:2021
//check-pass
#![warn(unused)]
+#![allow(dead_code)]
#![feature(rustc_attrs)]
#[derive(Debug, Clone, Copy)]
// Test that we can use raw ptrs when using `capture_disjoint_fields`.
+#![allow(dead_code)]
+
#[derive(Debug)]
struct S {
s: String,
--- /dev/null
+// In #88097, the compiler attempted to coerce a closure type to itself via
+// a function pointer, which caused an unnecessary error. Check that this
+// behavior has been fixed.
+
+// check-pass
+
+fn peculiar() -> impl Fn(u8) -> u8 {
+ return |x| x + 1
+}
+
+fn peculiar2() -> impl Fn(u8) -> u8 {
+ return |x| x + 1;
+}
+
+fn peculiar3() -> impl Fn(u8) -> u8 {
+ let f = |x| x + 1;
+ return f
+}
+
+fn peculiar4() -> impl Fn(u8) -> u8 {
+ let f = |x| x + 1;
+ f
+}
+
+fn peculiar5() -> impl Fn(u8) -> u8 {
+ let f = |x| x + 1;
+ let g = |x| x + 2;
+ return if true { f } else { g }
+}
+
+fn main() {}
// run-pass
+
+#![allow(dead_code)]
+
use std::fmt::Debug;
#[derive(Debug)]
--- /dev/null
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+
+fn foo<const N: u8>(a: [(); N as usize]) {
+ bar::<{ N as usize as usize }>();
+ //~^ error: unconstrained generic constant
+}
+
+fn bar<const N: usize>() {}
+
+fn main() {}
--- /dev/null
+error: unconstrained generic constant
+ --> $DIR/abstract-consts-as-cast-5.rs:5:11
+ |
+LL | bar::<{ N as usize as usize }>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: try adding a `where` bound using this expression: `where [(); { N as usize as usize }]:`
+
+error: aborting due to previous error
+
--> $DIR/array-size-in-generic-struct-param.rs:19:15
|
LL | arr: [u8; CFG.arr_size],
- | ^^^^^^^^^^^^ unsupported projection
+ | ^^^^^^^^^^^^ unsupported operation in generic constant, this may be supported in the future
|
= help: consider moving this anonymous constant into a `const` function
LL | fn test<const N: usize>() -> [u8; N + (|| 42)()] {}
| ^^^^-------^^
| |
- | unsupported rvalue
+ | unsupported operation in generic constant, this may be supported in the future
|
= help: consider moving this anonymous constant into a `const` function
--> $DIR/let-bindings.rs:6:68
|
LL | fn test<const N: usize>() -> [u8; { let x = N; N + 1 }] where [u8; { let x = N; N + 1 }]: Default {
- | ^^^^^^-^^^^^^^^^^^^^
- | |
- | unsupported statement
+ | ^^^^^^^^^^^^^^^^^^^^ unsupported operation in generic constant, this may be supported in the future
|
= help: consider moving this anonymous constant into a `const` function
--> $DIR/let-bindings.rs:6:35
|
LL | fn test<const N: usize>() -> [u8; { let x = N; N + 1 }] where [u8; { let x = N; N + 1 }]: Default {
- | ^^^^^^-^^^^^^^^^^^^^
- | |
- | unsupported statement
+ | ^^^^^^^^^^^^^^^^^^^^ unsupported operation in generic constant, this may be supported in the future
|
= help: consider moving this anonymous constant into a `const` function
--- /dev/null
+#![feature(generic_const_exprs, adt_const_params, const_trait_impl)]
+#![allow(incomplete_features)]
+
+// test `N + N` unifies with explicit function calls for non-builtin-types
+#[derive(PartialEq, Eq)]
+struct Foo(u8);
+
+impl const std::ops::Add for Foo {
+ type Output = Self;
+
+ fn add(self, rhs: Self) -> Self::Output {
+ self
+ }
+}
+
+struct Evaluatable<const N: Foo>;
+
+fn foo<const N: Foo>(a: Evaluatable<{ N + N }>) {
+ bar::<{ std::ops::Add::add(N, N) }>();
+}
+
+fn bar<const N: Foo>() {}
+
+// test that `N + N` unifies with explicit function calls for builin-types
+struct Evaluatable2<const N: usize>;
+
+fn foo2<const N: usize>(a: Evaluatable2<{ N + N }>) {
+ bar2::<{ std::ops::Add::add(N, N) }>();
+ //~^ error: unconstrained generic constant
+ // FIXME(generic_const_exprs) make this not an error
+}
+
+fn bar2<const N: usize>() {}
+
+fn main() {}
--- /dev/null
+error: unconstrained generic constant
+ --> $DIR/unify-op-with-fn-call.rs:28:12
+ |
+LL | bar2::<{ std::ops::Add::add(N, N) }>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: try adding a `where` bound using this expression: `where [(); { std::ops::Add::add(N, N) }]:`
+
+error: aborting due to previous error
+
--> $DIR/unused_expr.rs:4:34
|
LL | fn add<const N: usize>() -> [u8; { N + 1; 5 }] {
- | ^^-----^^^^^
- | |
- | dead code
+ | ^^^^^^^^^^^^ unsupported operation in generic constant, this may be supported in the future
|
= help: consider moving this anonymous constant into a `const` function
--> $DIR/unused_expr.rs:9:34
|
LL | fn div<const N: usize>() -> [u8; { N / 1; 5 }] {
- | ^^-----^^^^^
- | |
- | dead code
+ | ^^^^^^^^^^^^ unsupported operation in generic constant, this may be supported in the future
|
= help: consider moving this anonymous constant into a `const` function
--> $DIR/unused_expr.rs:16:38
|
LL | fn fn_call<const N: usize>() -> [u8; { foo(N); 5 }] {
- | ^^------^^^^^
- | |
- | dead code
+ | ^^^^^^^^^^^^^ unsupported operation in generic constant, this may be supported in the future
|
= help: consider moving this anonymous constant into a `const` function
--> $DIR/issue-67375.rs:7:17
|
LL | inner: [(); { [|_: &T| {}; 0].len() }],
- | ^^^----------^^^^^^^^^^^^
- | |
- | unsupported rvalue
+ | ^^---------------^^^^^^^^
+ | |
+ | unsupported operation in generic constant
|
= help: consider moving this anonymous constant into a `const` function
| _____________^
LL | |
LL | | let x: Option<Box<Self>> = None;
- | | ---- unsupported rvalue
LL | |
LL | | 0
LL | | }],
- | |_____^
+ | |_____^ unsupported operation in generic constant, this may be supported in the future
|
= help: consider moving this anonymous constant into a `const` function
help: change the type of the numeric literal from `u16` to `u8`
|
LL | assert_eq!(R.method::<1u8>(), 1);
- | ~~~
+ | ~~
error: aborting due to previous error
help: change the type of the numeric literal from `u16` to `u8`
|
LL | assert_eq!(R.method::<1u8>(), 1);
- | ~~~
+ | ~~
error: aborting due to previous error
--> $DIR/unused_braces.rs:9:14
|
LL | let _: A<{ 7 }>;
- | ^^^^^ help: remove these braces
+ | ^^ ^^
|
note: the lint level is defined here
--> $DIR/unused_braces.rs:3:9
|
LL | #![warn(unused_braces)]
| ^^^^^^^^^^^^^
+help: remove these braces
+ |
+LL - let _: A<{ 7 }>;
+LL + let _: A<7>;
+ |
warning: 1 warning emitted
--- /dev/null
+// Checks that derived implementations of Clone and Debug do not
+// contribute to dead code analysis (issue #84647).
+
+#![forbid(dead_code)]
+
+struct A { f: () }
+//~^ ERROR: field is never read: `f`
+
+#[derive(Clone)]
+struct B { f: () }
+//~^ ERROR: field is never read: `f`
+
+#[derive(Debug)]
+struct C { f: () }
+//~^ ERROR: field is never read: `f`
+
+#[derive(Debug,Clone)]
+struct D { f: () }
+//~^ ERROR: field is never read: `f`
+
+struct E { f: () }
+//~^ ERROR: field is never read: `f`
+// Custom impl, still doesn't read f
+impl Clone for E {
+ fn clone(&self) -> Self {
+ Self { f: () }
+ }
+}
+
+struct F { f: () }
+// Custom impl that actually reads f
+impl Clone for F {
+ fn clone(&self) -> Self {
+ Self { f: self.f }
+ }
+}
+
+fn main() {
+ let _ = A { f: () };
+ let _ = B { f: () };
+ let _ = C { f: () };
+ let _ = D { f: () };
+ let _ = E { f: () };
+ let _ = F { f: () };
+}
--- /dev/null
+error: field is never read: `f`
+ --> $DIR/clone-debug-dead-code.rs:6:12
+ |
+LL | struct A { f: () }
+ | ^^^^^
+ |
+note: the lint level is defined here
+ --> $DIR/clone-debug-dead-code.rs:4:11
+ |
+LL | #![forbid(dead_code)]
+ | ^^^^^^^^^
+
+error: field is never read: `f`
+ --> $DIR/clone-debug-dead-code.rs:10:12
+ |
+LL | struct B { f: () }
+ | ^^^^^
+
+error: field is never read: `f`
+ --> $DIR/clone-debug-dead-code.rs:14:12
+ |
+LL | struct C { f: () }
+ | ^^^^^
+
+error: field is never read: `f`
+ --> $DIR/clone-debug-dead-code.rs:18:12
+ |
+LL | struct D { f: () }
+ | ^^^^^
+
+error: field is never read: `f`
+ --> $DIR/clone-debug-dead-code.rs:21:12
+ |
+LL | struct E { f: () }
+ | ^^^^^
+
+error: aborting due to 5 previous errors
+
// run-pass
// pretty-expanded FIXME #23616
+#![allow(dead_code)]
+
#[derive(Clone)]
struct S<T> {
foo: (),
// run-pass
// pretty-expanded FIXME #23616
+#![allow(dead_code)]
+
#[derive(Clone)]
struct S {
_int: isize,
// run-pass
// pretty-expanded FIXME #23616
+#![allow(dead_code)]
+
#[derive(Clone)]
struct S((), ());
// run-pass
+
+#![allow(dead_code)]
+
pub fn main() {
#[derive(Debug)]
struct Foo {
help: change the type of the numeric literal from `u8` to `i8`
|
LL | OhNo = 0_i8,
- | ~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:28:16
help: change the type of the numeric literal from `i8` to `u8`
|
LL | OhNo = 0_u8,
- | ~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:41:16
help: change the type of the numeric literal from `u16` to `i16`
|
LL | OhNo = 0_i16,
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:54:16
help: change the type of the numeric literal from `i16` to `u16`
|
LL | OhNo = 0_u16,
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:67:16
help: change the type of the numeric literal from `u32` to `i32`
|
LL | OhNo = 0_i32,
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:80:16
help: change the type of the numeric literal from `i32` to `u32`
|
LL | OhNo = 0_u32,
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:93:16
help: change the type of the numeric literal from `u64` to `i64`
|
LL | OhNo = 0_i64,
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/discrim-ill-typed.rs:106:16
help: change the type of the numeric literal from `i64` to `u64`
|
LL | OhNo = 0_u64,
- | ~~~~~
+ | ~~~
error: aborting due to 8 previous errors
--- /dev/null
+// Check that niche selection prefers zero.
+// See https://github.com/rust-lang/rust/pull/87794
+// run-pass
+#[repr(u8)]
+pub enum Size {
+ One = 1,
+ Two = 2,
+ Three = 3,
+}
+
+fn main() {
+ // check that `None` is zero
+ assert_eq!(0, unsafe { std::mem::transmute::<Option<Size>, u8>(None) });
+}
help: use fully qualified syntax to disambiguate
|
LL | let _: <Self as Foo>::A;
- | ~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~~~~
help: use fully qualified syntax to disambiguate
|
LL | let _: <Self as Bar>::A;
- | ~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~~~~
error[E0221]: ambiguous associated type `Err` in bounds of `Self`
--> $DIR/E0221.rs:21:16
| ------------- ambiguous `Err` from `My`
LL | fn test() {
LL | let _: Self::Err;
- | ^^^^^^^^^
- | |
- | ambiguous associated type `Err`
- | help: use fully qualified syntax to disambiguate: `<Self as My>::Err`
+ | ^^^^^^^^^ ambiguous associated type `Err`
|
= note: associated type `Self` could derive from `FromStr`
+help: use fully qualified syntax to disambiguate
+ |
+LL | let _: <Self as My>::Err;
+ | ~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
--- /dev/null
+// This snippet ensures that no attempt to recover on a semicolon instead of
+// comma is made next to a closure body.
+//
+// If this recovery happens, then plenty of errors are emitted. Here, we expect
+// only one error.
+//
+// This is part of issue #88065:
+// https://github.com/rust-lang/rust/issues/88065
+
+// run-rustfix
+
+fn main() {
+ let num = 5;
+ (1..num).reduce(|a, b| {
+ //~^ ERROR: closure bodies that contain statements must be surrounded by braces
+ println!("{}", a);
+ a * b
+ }).unwrap();
+}
--- /dev/null
+// This snippet ensures that no attempt to recover on a semicolon instead of
+// comma is made next to a closure body.
+//
+// If this recovery happens, then plenty of errors are emitted. Here, we expect
+// only one error.
+//
+// This is part of issue #88065:
+// https://github.com/rust-lang/rust/issues/88065
+
+// run-rustfix
+
+fn main() {
+ let num = 5;
+ (1..num).reduce(|a, b|
+ //~^ ERROR: closure bodies that contain statements must be surrounded by braces
+ println!("{}", a);
+ a * b
+ ).unwrap();
+}
--- /dev/null
+error: closure bodies that contain statements must be surrounded by braces
+ --> $DIR/missing_braces_around_block.rs:14:26
+ |
+LL | (1..num).reduce(|a, b|
+ | ^
+...
+LL | ).unwrap();
+ | ^
+ |
+note: statement found outside of a block
+ --> $DIR/missing_braces_around_block.rs:16:26
+ |
+LL | println!("{}", a);
+ | -----------------^ this `;` turns the preceding closure into a statement
+ | |
+ | this expression is a statement because of the trailing semicolon
+note: the closure body may be incorrectly delimited
+ --> $DIR/missing_braces_around_block.rs:14:21
+ |
+LL | (1..num).reduce(|a, b|
+ | _____________________^
+LL | |
+LL | | println!("{}", a);
+ | |_________________________^ this is the parsed closure...
+LL | a * b
+LL | ).unwrap();
+ | - ...but likely you meant the closure to end here
+help: try adding braces
+ |
+LL ~ (1..num).reduce(|a, b| {
+LL |
+LL | println!("{}", a);
+LL | a * b
+LL ~ }).unwrap();
+ |
+
+error: aborting due to previous error
+
--- /dev/null
+// Part of issue #27300.
+// The problem here is that ruby-style closures are parsed as blocks whose
+// first statement is a closure. See the issue for more details:
+// https://github.com/rust-lang/rust/issues/27300
+
+// Note: this test represents what the compiler currently emits. The error
+// message will be improved later.
+
+fn main() {
+ let p = Some(45).and_then({
+ //~^ expected a `FnOnce<({integer},)>` closure, found `Option<_>`
+ |x| println!("doubling {}", x);
+ Some(x * 2)
+ //~^ ERROR: cannot find value `x` in this scope
+ });
+}
--- /dev/null
+error[E0425]: cannot find value `x` in this scope
+ --> $DIR/ruby_style_closure.rs:13:14
+ |
+LL | Some(x * 2)
+ | ^ not found in this scope
+
+error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>`
+ --> $DIR/ruby_style_closure.rs:10:22
+ |
+LL | let p = Some(45).and_then({
+ | ^^^^^^^^ expected an `FnOnce<({integer},)>` closure, found `Option<_>`
+ |
+ = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0277, E0425.
+For more information about an error, try `rustc --explain E0277`.
help: change the type of the numeric literal from `f64` to `f32`
|
LL | let y: f32 = 1f32;
- | ~~~~
+ | ~~~
error: aborting due to 2 previous errors
type A<'a> where Self: 'static = (&'a ());
//~^ ERROR the parameter type `T` may not live long enough
type B<'a, 'b> where 'b: 'a = (&'a(), &'b ());
- //~^ ERROR lifetime bound not satisfied
+ //~^ ERROR `impl` associated type
//~| ERROR lifetime bound not satisfied
type C where Self: Copy = String;
//~^ ERROR the trait bound `T: Copy` is not satisfied
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `T: 'static`...
- = note: ...so that the type `Fooy<T>` will meet its required lifetime bounds
+ = note: ...so that the definition in impl matches the definition from the trait
-error[E0478]: lifetime bound not satisfied
+error: `impl` associated type signature for `B` doesn't match `trait` associated type signature
--> $DIR/impl_bounds.rs:17:5
|
+LL | type B<'a, 'b> where 'a: 'b;
+ | ---------------------------- expected
+...
LL | type B<'a, 'b> where 'b: 'a = (&'a(), &'b ());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: lifetime parameter instantiated with the lifetime `'b` as defined on the associated item at 17:16
- --> $DIR/impl_bounds.rs:17:16
- |
-LL | type B<'a, 'b> where 'b: 'a = (&'a(), &'b ());
- | ^^
-note: but lifetime parameter must outlive the lifetime `'a` as defined on the associated item at 17:12
- --> $DIR/impl_bounds.rs:17:12
- |
-LL | type B<'a, 'b> where 'b: 'a = (&'a(), &'b ());
- | ^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found
error[E0478]: lifetime bound not satisfied
--> $DIR/impl_bounds.rs:17:5
LL | | <Right as HasChildrenOf>::T: 'a
| | - help: consider adding a where clause: `, <Left as HasChildrenOf>::T: 'a`
LL | | = Either<&'a Left::T, &'a Right::T>;
- | |________________________________________^ ...so that the type `<Left as HasChildrenOf>::T` will meet its required lifetime bounds
+ | |________________________________________^ ...so that the definition in impl matches the definition from the trait
error[E0309]: the associated type `<Right as HasChildrenOf>::T` may not live long enough
--> $DIR/issue-86787.rs:23:5
LL | | <Right as HasChildrenOf>::T: 'a
| | - help: consider adding a where clause: `, <Right as HasChildrenOf>::T: 'a`
LL | | = Either<&'a Left::T, &'a Right::T>;
- | |________________________________________^ ...so that the type `<Right as HasChildrenOf>::T` will meet its required lifetime bounds
+ | |________________________________________^ ...so that the definition in impl matches the definition from the trait
error: aborting due to 2 previous errors
--- /dev/null
+// check-fail
+
+#![feature(generic_associated_types)]
+
+trait Foo {
+ type Assoc<'a, 'b>;
+}
+impl Foo for () {
+ type Assoc<'a, 'b> where 'a: 'b = ();
+ //~^ `impl` associated type
+}
+
+fn main() {}
--- /dev/null
+error: `impl` associated type signature for `Assoc` doesn't match `trait` associated type signature
+ --> $DIR/missing-where-clause-on-trait.rs:9:5
+ |
+LL | type Assoc<'a, 'b>;
+ | ------------------- expected
+...
+LL | type Assoc<'a, 'b> where 'a: 'b = ();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found
+
+error: aborting due to previous error
+
--- /dev/null
+// check-pass
+
+trait Yokeable<'a> {
+ type Output: 'a;
+}
+impl<'a> Yokeable<'a> for () {
+ type Output = ();
+}
+
+trait DataMarker<'data> {
+ type Yokeable: for<'a> Yokeable<'a>;
+}
+impl<'data> DataMarker<'data> for () {
+ type Yokeable = ();
+}
+
+struct DataPayload<'data, M>(&'data M);
+
+impl DataPayload<'static, ()> {
+ pub fn map_project_with_capture<M2, T>(
+ _: for<'a> fn(
+ capture: T,
+ std::marker::PhantomData<&'a ()>,
+ ) -> <M2::Yokeable as Yokeable<'a>>::Output,
+ ) -> DataPayload<'static, M2>
+ where
+ M2: DataMarker<'static>,
+ {
+ todo!()
+ }
+}
+
+fn main() {
+ let _: DataPayload<()> = DataPayload::<()>::map_project_with_capture::<_, &()>(|_, _| todo!());
+}
help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
|
LL | bar::<isize>(i.try_into().unwrap()); // i should not be re-coerced back to an isize
- | ~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error: aborting due to 2 previous errors
help: you can convert an `i16` to an `i8` and panic if the converted value doesn't fit
|
LL | id_i8(a16.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:41:11
help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
|
LL | id_i8(a32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:44:11
help: you can convert an `i64` to an `i8` and panic if the converted value doesn't fit
|
LL | id_i8(a64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:47:11
help: you can convert an `isize` to an `i8` and panic if the converted value doesn't fit
|
LL | id_i8(asize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:51:12
|
LL | id_i16(a8);
- | ^^
- | |
- | expected `i16`, found `i8`
- | help: you can convert an `i8` to an `i16`: `a8.into()`
+ | ^^ expected `i16`, found `i8`
+ |
+help: you can convert an `i8` to an `i16`
+ |
+LL | id_i16(a8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:55:12
help: you can convert an `i32` to an `i16` and panic if the converted value doesn't fit
|
LL | id_i16(a32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:58:12
help: you can convert an `i64` to an `i16` and panic if the converted value doesn't fit
|
LL | id_i16(a64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:61:12
help: you can convert an `isize` to an `i16` and panic if the converted value doesn't fit
|
LL | id_i16(asize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:65:12
|
LL | id_i32(a8);
- | ^^
- | |
- | expected `i32`, found `i8`
- | help: you can convert an `i8` to an `i32`: `a8.into()`
+ | ^^ expected `i32`, found `i8`
+ |
+help: you can convert an `i8` to an `i32`
+ |
+LL | id_i32(a8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:68:12
|
LL | id_i32(a16);
- | ^^^
- | |
- | expected `i32`, found `i16`
- | help: you can convert an `i16` to an `i32`: `a16.into()`
+ | ^^^ expected `i32`, found `i16`
+ |
+help: you can convert an `i16` to an `i32`
+ |
+LL | id_i32(a16.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:72:12
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
LL | id_i32(a64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:75:12
help: you can convert an `isize` to an `i32` and panic if the converted value doesn't fit
|
LL | id_i32(asize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:79:12
|
LL | id_i64(a8);
- | ^^
- | |
- | expected `i64`, found `i8`
- | help: you can convert an `i8` to an `i64`: `a8.into()`
+ | ^^ expected `i64`, found `i8`
+ |
+help: you can convert an `i8` to an `i64`
+ |
+LL | id_i64(a8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:82:12
|
LL | id_i64(a16);
- | ^^^
- | |
- | expected `i64`, found `i16`
- | help: you can convert an `i16` to an `i64`: `a16.into()`
+ | ^^^ expected `i64`, found `i16`
+ |
+help: you can convert an `i16` to an `i64`
+ |
+LL | id_i64(a16.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:85:12
|
LL | id_i64(a32);
- | ^^^
- | |
- | expected `i64`, found `i32`
- | help: you can convert an `i32` to an `i64`: `a32.into()`
+ | ^^^ expected `i64`, found `i32`
+ |
+help: you can convert an `i32` to an `i64`
+ |
+LL | id_i64(a32.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:89:12
help: you can convert an `isize` to an `i64` and panic if the converted value doesn't fit
|
LL | id_i64(asize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:93:14
|
LL | id_isize(a8);
- | ^^
- | |
- | expected `isize`, found `i8`
- | help: you can convert an `i8` to an `isize`: `a8.into()`
+ | ^^ expected `isize`, found `i8`
+ |
+help: you can convert an `i8` to an `isize`
+ |
+LL | id_isize(a8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:96:14
|
LL | id_isize(a16);
- | ^^^
- | |
- | expected `isize`, found `i16`
- | help: you can convert an `i16` to an `isize`: `a16.into()`
+ | ^^^ expected `isize`, found `i16`
+ |
+help: you can convert an `i16` to an `isize`
+ |
+LL | id_isize(a16.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:99:14
help: you can convert an `i32` to an `isize` and panic if the converted value doesn't fit
|
LL | id_isize(a32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:102:14
help: you can convert an `i64` to an `isize` and panic if the converted value doesn't fit
|
LL | id_isize(a64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:108:11
help: you can convert an `i16` to an `i8` and panic if the converted value doesn't fit
|
LL | id_i8(c16.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:111:11
help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
|
LL | id_i8(c32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:114:11
help: you can convert an `i64` to an `i8` and panic if the converted value doesn't fit
|
LL | id_i8(c64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:118:12
|
LL | id_i16(c8);
- | ^^
- | |
- | expected `i16`, found `i8`
- | help: you can convert an `i8` to an `i16`: `c8.into()`
+ | ^^ expected `i16`, found `i8`
+ |
+help: you can convert an `i8` to an `i16`
+ |
+LL | id_i16(c8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:122:12
help: you can convert an `i32` to an `i16` and panic if the converted value doesn't fit
|
LL | id_i16(c32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:125:12
help: you can convert an `i64` to an `i16` and panic if the converted value doesn't fit
|
LL | id_i16(c64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:129:12
|
LL | id_i32(c8);
- | ^^
- | |
- | expected `i32`, found `i8`
- | help: you can convert an `i8` to an `i32`: `c8.into()`
+ | ^^ expected `i32`, found `i8`
+ |
+help: you can convert an `i8` to an `i32`
+ |
+LL | id_i32(c8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:132:12
|
LL | id_i32(c16);
- | ^^^
- | |
- | expected `i32`, found `i16`
- | help: you can convert an `i16` to an `i32`: `c16.into()`
+ | ^^^ expected `i32`, found `i16`
+ |
+help: you can convert an `i16` to an `i32`
+ |
+LL | id_i32(c16.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:136:12
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
LL | id_i32(c64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:140:12
|
LL | id_i64(a8);
- | ^^
- | |
- | expected `i64`, found `i8`
- | help: you can convert an `i8` to an `i64`: `a8.into()`
+ | ^^ expected `i64`, found `i8`
+ |
+help: you can convert an `i8` to an `i64`
+ |
+LL | id_i64(a8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:143:12
|
LL | id_i64(a16);
- | ^^^
- | |
- | expected `i64`, found `i16`
- | help: you can convert an `i16` to an `i64`: `a16.into()`
+ | ^^^ expected `i64`, found `i16`
+ |
+help: you can convert an `i16` to an `i64`
+ |
+LL | id_i64(a16.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:146:12
|
LL | id_i64(a32);
- | ^^^
- | |
- | expected `i64`, found `i32`
- | help: you can convert an `i32` to an `i64`: `a32.into()`
+ | ^^^ expected `i64`, found `i32`
+ |
+help: you can convert an `i32` to an `i64`
+ |
+LL | id_i64(a32.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:152:11
help: you can convert a `u16` to a `u8` and panic if the converted value doesn't fit
|
LL | id_u8(b16.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:155:11
help: you can convert a `u32` to a `u8` and panic if the converted value doesn't fit
|
LL | id_u8(b32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:158:11
help: you can convert a `u64` to a `u8` and panic if the converted value doesn't fit
|
LL | id_u8(b64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:161:11
help: you can convert a `usize` to a `u8` and panic if the converted value doesn't fit
|
LL | id_u8(bsize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:165:12
|
LL | id_u16(b8);
- | ^^
- | |
- | expected `u16`, found `u8`
- | help: you can convert a `u8` to a `u16`: `b8.into()`
+ | ^^ expected `u16`, found `u8`
+ |
+help: you can convert a `u8` to a `u16`
+ |
+LL | id_u16(b8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:169:12
help: you can convert a `u32` to a `u16` and panic if the converted value doesn't fit
|
LL | id_u16(b32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:172:12
help: you can convert a `u64` to a `u16` and panic if the converted value doesn't fit
|
LL | id_u16(b64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:175:12
help: you can convert a `usize` to a `u16` and panic if the converted value doesn't fit
|
LL | id_u16(bsize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:179:12
|
LL | id_u32(b8);
- | ^^
- | |
- | expected `u32`, found `u8`
- | help: you can convert a `u8` to a `u32`: `b8.into()`
+ | ^^ expected `u32`, found `u8`
+ |
+help: you can convert a `u8` to a `u32`
+ |
+LL | id_u32(b8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:182:12
|
LL | id_u32(b16);
- | ^^^
- | |
- | expected `u32`, found `u16`
- | help: you can convert a `u16` to a `u32`: `b16.into()`
+ | ^^^ expected `u32`, found `u16`
+ |
+help: you can convert a `u16` to a `u32`
+ |
+LL | id_u32(b16.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:186:12
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
|
LL | id_u32(b64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:189:12
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
|
LL | id_u32(bsize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:193:12
|
LL | id_u64(b8);
- | ^^
- | |
- | expected `u64`, found `u8`
- | help: you can convert a `u8` to a `u64`: `b8.into()`
+ | ^^ expected `u64`, found `u8`
+ |
+help: you can convert a `u8` to a `u64`
+ |
+LL | id_u64(b8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:196:12
|
LL | id_u64(b16);
- | ^^^
- | |
- | expected `u64`, found `u16`
- | help: you can convert a `u16` to a `u64`: `b16.into()`
+ | ^^^ expected `u64`, found `u16`
+ |
+help: you can convert a `u16` to a `u64`
+ |
+LL | id_u64(b16.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:199:12
|
LL | id_u64(b32);
- | ^^^
- | |
- | expected `u64`, found `u32`
- | help: you can convert a `u32` to a `u64`: `b32.into()`
+ | ^^^ expected `u64`, found `u32`
+ |
+help: you can convert a `u32` to a `u64`
+ |
+LL | id_u64(b32.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:203:12
help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
|
LL | id_u64(bsize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:207:14
|
LL | id_usize(b8);
- | ^^
- | |
- | expected `usize`, found `u8`
- | help: you can convert a `u8` to a `usize`: `b8.into()`
+ | ^^ expected `usize`, found `u8`
+ |
+help: you can convert a `u8` to a `usize`
+ |
+LL | id_usize(b8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:210:14
|
LL | id_usize(b16);
- | ^^^
- | |
- | expected `usize`, found `u16`
- | help: you can convert a `u16` to a `usize`: `b16.into()`
+ | ^^^ expected `usize`, found `u16`
+ |
+help: you can convert a `u16` to a `usize`
+ |
+LL | id_usize(b16.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:213:14
help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
|
LL | id_usize(b32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/integer-literal-suffix-inference.rs:216:14
help: you can convert a `u64` to a `usize` and panic if the converted value doesn't fit
|
LL | id_usize(b64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error: aborting due to 52 previous errors
help: you can convert an `isize` to an `i16` and panic if the converted value doesn't fit
|
LL | foo((1*(1 as isize)).try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | + +++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/issue-13359.rs:10:9
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
|
LL | bar((1*(1 as usize)).try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | + +++++++++++++++++++++
error: aborting due to 2 previous errors
help: change the type of the numeric literal from `i32` to `u32`
|
LL | let x: u32 = 20u32;
- | ~~~~~
+ | ~~~
error: aborting due to previous error
help: change the type of the numeric literal from `i32` to `u32`
|
LL | println!("{}", foo(10u32));
- | ~~~~~
+ | ~~~
error: aborting due to previous error
// run-pass
+
+#![allow(dead_code)]
+
trait Trait { fn dummy(&self) { } }
#[derive(Debug)]
--> $DIR/issue-20605.rs:2:17
|
LL | for item in *things { *item = 0 }
- | ^^^^^^^ doesn't have a size known at compile-time
+ | ^^^^^^^
+ | |
+ | expected an implementor of trait `IntoIterator`
+ | help: consider mutably borrowing here: `&mut *things`
|
- = help: the trait `Sized` is not implemented for `dyn Iterator<Item = &'a mut u8>`
+ = note: the trait bound `dyn Iterator<Item = &'a mut u8>: IntoIterator` is not satisfied
= note: required because of the requirements on the impl of `IntoIterator` for `dyn Iterator<Item = &'a mut u8>`
note: required by `into_iter`
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
// run-pass
#![feature(box_syntax)]
+#![allow(dead_code)]
trait T {
fn print(&self);
|
LL | impl for T {}
| ^
+ |
+help: add a trait here
+ |
+LL | impl Trait for T {}
+ | +++++
+help: for an inherent impl, drop this `for`
+ |
+LL - impl for T {}
+LL + impl T {}
+ |
error: aborting due to previous error
--- /dev/null
+use std::fmt::Write;
+
+fn main() {
+ println!(b"foo");
+ //~^ ERROR format argument must be a string literal
+ //~| HELP consider removing the leading `b`
+ let mut s = String::new();
+ write!(s, b"foo{}", "bar");
+ //~^ ERROR format argument must be a string literal
+ //~| HELP consider removing the leading `b`
+}
--- /dev/null
+error: format argument must be a string literal
+ --> $DIR/issue-86865.rs:4:14
+ |
+LL | println!(b"foo");
+ | -^^^^^
+ | |
+ | help: consider removing the leading `b`
+
+error: format argument must be a string literal
+ --> $DIR/issue-86865.rs:8:15
+ |
+LL | write!(s, b"foo{}", "bar");
+ | -^^^^^^^
+ | |
+ | help: consider removing the leading `b`
+
+error: aborting due to 2 previous errors
+
help: change the type of the numeric literal from `i64` to `isize`
|
LL | A = 1isize,
- | ~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/issue-8761.rs:5:9
help: change the type of the numeric literal from `u8` to `isize`
|
LL | B = 2isize
- | ~~~~~~
+ | ~~~~~
error: aborting due to 2 previous errors
--> $DIR/lint-unnecessary-parens.rs:13:12
|
LL | return (1);
- | ^^^ help: remove these parentheses
+ | ^ ^
|
note: the lint level is defined here
--> $DIR/lint-unnecessary-parens.rs:3:9
|
LL | #![deny(unused_parens)]
| ^^^^^^^^^^^^^
+help: remove these parentheses
+ |
+LL - return (1);
+LL + return 1;
+ |
error: unnecessary parentheses around `return` value
--> $DIR/lint-unnecessary-parens.rs:16:12
|
LL | return (X { y });
- | ^^^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - return (X { y });
+LL + return X { y };
+ |
error: unnecessary parentheses around type
--> $DIR/lint-unnecessary-parens.rs:19:46
|
LL | pub fn unused_parens_around_return_type() -> (u32) {
- | ^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - pub fn unused_parens_around_return_type() -> (u32) {
+LL + pub fn unused_parens_around_return_type() -> u32 {
+ |
error: unnecessary parentheses around block return value
--> $DIR/lint-unnecessary-parens.rs:25:9
|
LL | (5)
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - (5)
+LL + 5
+ |
error: unnecessary parentheses around block return value
--> $DIR/lint-unnecessary-parens.rs:27:5
|
LL | (5)
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - (5)
+LL + 5
+ |
error: unnecessary parentheses around assigned value
--> $DIR/lint-unnecessary-parens.rs:44:31
|
LL | pub const CONST_ITEM: usize = (10);
- | ^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - pub const CONST_ITEM: usize = (10);
+LL + pub const CONST_ITEM: usize = 10;
+ |
error: unnecessary parentheses around assigned value
--> $DIR/lint-unnecessary-parens.rs:45:33
|
LL | pub static STATIC_ITEM: usize = (10);
- | ^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - pub static STATIC_ITEM: usize = (10);
+LL + pub static STATIC_ITEM: usize = 10;
+ |
error: unnecessary parentheses around function argument
--> $DIR/lint-unnecessary-parens.rs:49:9
|
LL | bar((true));
- | ^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - bar((true));
+LL + bar(true);
+ |
error: unnecessary parentheses around `if` condition
--> $DIR/lint-unnecessary-parens.rs:51:8
|
LL | if (true) {}
- | ^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - if (true) {}
+LL + if true {}
+ |
error: unnecessary parentheses around `while` condition
--> $DIR/lint-unnecessary-parens.rs:52:11
|
LL | while (true) {}
- | ^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - while (true) {}
+LL + while true {}
+ |
error: unnecessary parentheses around `match` scrutinee expression
--> $DIR/lint-unnecessary-parens.rs:53:11
|
LL | match (true) {
- | ^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - match (true) {
+LL + match true {
+ |
error: unnecessary parentheses around `let` scrutinee expression
--> $DIR/lint-unnecessary-parens.rs:56:16
|
LL | if let 1 = (1) {}
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - if let 1 = (1) {}
+LL + if let 1 = 1 {}
+ |
error: unnecessary parentheses around `let` scrutinee expression
--> $DIR/lint-unnecessary-parens.rs:57:19
|
LL | while let 1 = (2) {}
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - while let 1 = (2) {}
+LL + while let 1 = 2 {}
+ |
error: unnecessary parentheses around method argument
--> $DIR/lint-unnecessary-parens.rs:73:24
|
LL | X { y: false }.foo((true));
- | ^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - X { y: false }.foo((true));
+LL + X { y: false }.foo(true);
+ |
error: unnecessary parentheses around assigned value
--> $DIR/lint-unnecessary-parens.rs:75:18
|
LL | let mut _a = (0);
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let mut _a = (0);
+LL + let mut _a = 0;
+ |
error: unnecessary parentheses around assigned value
--> $DIR/lint-unnecessary-parens.rs:76:10
|
LL | _a = (0);
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - _a = (0);
+LL + _a = 0;
+ |
error: unnecessary parentheses around assigned value
--> $DIR/lint-unnecessary-parens.rs:77:11
|
LL | _a += (1);
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - _a += (1);
+LL + _a += 1;
+ |
error: aborting due to 17 previous errors
--> $DIR/suggestions.rs:48:31
|
LL | let mut registry_no = (format!("NX-{}", 74205));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
+ | ^ ^
|
note: the lint level is defined here
--> $DIR/suggestions.rs:4:21
|
LL | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896
| ^^^^^^^^^^^^^
+help: remove these parentheses
+ |
+LL - let mut registry_no = (format!("NX-{}", 74205));
+LL + let mut registry_no = format!("NX-{}", 74205);
+ |
warning: variable does not need to be mutable
--> $DIR/suggestions.rs:48:13
--> $DIR/issue-54538-unused-parens-lint.rs:16:9
|
LL | let (a) = 0;
- | ^^^ help: remove these parentheses
+ | ^ ^
|
note: the lint level is defined here
--> $DIR/issue-54538-unused-parens-lint.rs:13:9
|
LL | #![deny(unused_parens)]
| ^^^^^^^^^^^^^
+help: remove these parentheses
+ |
+LL - let (a) = 0;
+LL + let a = 0;
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:17:9
|
LL | for (a) in 0..1 {}
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - for (a) in 0..1 {}
+LL + for a in 0..1 {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:18:12
|
LL | if let (a) = 0 {}
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - if let (a) = 0 {}
+LL + if let a = 0 {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:19:15
|
LL | while let (a) = 0 {}
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - while let (a) = 0 {}
+LL + while let a = 0 {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:20:12
|
LL | fn foo((a): u8) {}
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - fn foo((a): u8) {}
+LL + fn foo(a: u8) {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:21:14
|
LL | let _ = |(a): u8| 0;
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - let _ = |(a): u8| 0;
+LL + let _ = |a: u8| 0;
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:49:12
|
LL | if let (0 | 1) = 0 {}
- | ^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - if let (0 | 1) = 0 {}
+LL + if let 0 | 1 = 0 {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:50:13
|
LL | if let ((0 | 1),) = (0,) {}
- | ^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - if let ((0 | 1),) = (0,) {}
+LL + if let (0 | 1,) = (0,) {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:51:13
|
LL | if let [(0 | 1)] = [0] {}
- | ^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - if let [(0 | 1)] = [0] {}
+LL + if let [0 | 1] = [0] {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:52:16
|
LL | if let 0 | (1 | 2) = 0 {}
- | ^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - if let 0 | (1 | 2) = 0 {}
+LL + if let 0 | 1 | 2 = 0 {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:54:15
|
LL | if let TS((0 | 1)) = TS(0) {}
- | ^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - if let TS((0 | 1)) = TS(0) {}
+LL + if let TS(0 | 1) = TS(0) {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:56:20
|
LL | if let NS { f: (0 | 1) } = (NS { f: 0 }) {}
- | ^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - if let NS { f: (0 | 1) } = (NS { f: 0 }) {}
+LL + if let NS { f: 0 | 1 } = (NS { f: 0 }) {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:66:9
|
LL | (_) => {}
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - (_) => {}
+LL + _ => {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:67:9
|
LL | (y) => {}
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - (y) => {}
+LL + y => {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:68:9
|
LL | (ref r) => {}
- | ^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - (ref r) => {}
+LL + ref r => {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:69:9
|
LL | (e @ 1...2) => {}
- | ^^^^^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - (e @ 1...2) => {}
+LL + e @ 1...2 => {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:75:9
|
LL | (e @ &(1...2)) => {}
- | ^^^^^^^^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - (e @ &(1...2)) => {}
+LL + e @ &(1...2) => {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:76:10
|
LL | &(_) => {}
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - &(_) => {}
+LL + &_ => {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:87:9
|
LL | (_) => {}
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - (_) => {}
+LL + _ => {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:88:9
|
LL | (y) => {}
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - (y) => {}
+LL + y => {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:89:9
|
LL | (ref r) => {}
- | ^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - (ref r) => {}
+LL + ref r => {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:90:9
|
LL | (e @ 1..=2) => {}
- | ^^^^^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - (e @ 1..=2) => {}
+LL + e @ 1..=2 => {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:96:9
|
LL | (e @ &(1..=2)) => {}
- | ^^^^^^^^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - (e @ &(1..=2)) => {}
+LL + e @ &(1..=2) => {}
+ |
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:97:10
|
LL | &(_) => {}
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - &(_) => {}
+LL + &_ => {}
+ |
error: aborting due to 24 previous errors
--> $DIR/issue-74883-unused-paren-baren-yield.rs:14:29
|
LL | while let Some(_) = ({yield}) {}
- | ^^^^^^^^^ help: remove these parentheses
+ | ^ ^
|
note: the lint level is defined here
--> $DIR/issue-74883-unused-paren-baren-yield.rs:3:24
|
LL | #![deny(unused_braces, unused_parens)]
| ^^^^^^^^^^^^^
+help: remove these parentheses
+ |
+LL - while let Some(_) = ({yield}) {}
+LL + while let Some(_) = {yield} {}
+ |
error: unnecessary parentheses around `let` scrutinee expression
--> $DIR/issue-74883-unused-paren-baren-yield.rs:15:29
|
LL | while let Some(_) = ((yield)) {}
- | ^^^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - while let Some(_) = ((yield)) {}
+LL + while let Some(_) = (yield) {}
+ |
error: unnecessary braces around block return value
--> $DIR/issue-74883-unused-paren-baren-yield.rs:16:10
|
LL | {{yield}};
- | ^^^^^^^ help: remove these braces
+ | ^ ^
|
note: the lint level is defined here
--> $DIR/issue-74883-unused-paren-baren-yield.rs:3:9
|
LL | #![deny(unused_braces, unused_parens)]
| ^^^^^^^^^^^^^
+help: remove these braces
+ |
+LL - {{yield}};
+LL + {yield};
+ |
error: unnecessary parentheses around block return value
--> $DIR/issue-74883-unused-paren-baren-yield.rs:17:10
|
LL | {( yield )};
- | ^^^^^^^^^ help: remove these parentheses
+ | ^^ ^^
+ |
+help: remove these parentheses
+ |
+LL - {( yield )};
+LL + {yield};
+ |
error: unnecessary parentheses around block return value
--> $DIR/issue-74883-unused-paren-baren-yield.rs:18:30
|
LL | while let Some(_) = {(yield)} {}
- | ^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - while let Some(_) = {(yield)} {}
+LL + while let Some(_) = {yield} {}
+ |
error: unnecessary braces around block return value
--> $DIR/issue-74883-unused-paren-baren-yield.rs:19:30
|
LL | while let Some(_) = {{yield}} {}
- | ^^^^^^^ help: remove these braces
+ | ^ ^
+ |
+help: remove these braces
+ |
+LL - while let Some(_) = {{yield}} {}
+LL + while let Some(_) = {yield} {}
+ |
error: aborting due to 6 previous errors
--> $DIR/unused_braces.rs:10:13
|
LL | let _ = (7);
- | ^^^ help: remove these parentheses
+ | ^ ^
|
note: the lint level is defined here
--> $DIR/unused_braces.rs:4:24
|
LL | #![warn(unused_braces, unused_parens)]
| ^^^^^^^^^^^^^
+help: remove these parentheses
+ |
+LL - let _ = (7);
+LL + let _ = 7;
+ |
warning: unnecessary braces around `if` condition
--> $DIR/unused_braces.rs:26:8
|
LL | if { true } {
- | ^^^^^^^^ help: remove these braces
+ | ^^ ^^
|
note: the lint level is defined here
--> $DIR/unused_braces.rs:4:9
|
LL | #![warn(unused_braces, unused_parens)]
| ^^^^^^^^^^^^^
+help: remove these braces
+ |
+LL - if { true } {
+LL + if true {
+ |
warning: unnecessary braces around `while` condition
--> $DIR/unused_braces.rs:30:11
|
LL | while { false } {
- | ^^^^^^^^^ help: remove these braces
+ | ^^ ^^
+ |
+help: remove these braces
+ |
+LL - while { false } {
+LL + while false {
+ |
warning: unnecessary braces around const expression
--> $DIR/unused_braces.rs:34:17
|
LL | let _: [u8; { 3 }];
- | ^^^^^ help: remove these braces
+ | ^^ ^^
+ |
+help: remove these braces
+ |
+LL - let _: [u8; { 3 }];
+LL + let _: [u8; 3];
+ |
warning: unnecessary braces around function argument
--> $DIR/unused_braces.rs:37:13
|
LL | consume({ 7 });
- | ^^^^^ help: remove these braces
+ | ^^ ^^
+ |
+help: remove these braces
+ |
+LL - consume({ 7 });
+LL + consume(7);
+ |
warning: 5 warnings emitted
--> $DIR/unused_braces_borrow.rs:24:13
|
LL | consume({ a.b });
- | ^^^^^^^ help: remove these braces
+ | ^^ ^^
|
note: the lint level is defined here
--> $DIR/unused_braces_borrow.rs:4:9
|
LL | #![warn(unused_braces)]
| ^^^^^^^^^^^^^
+help: remove these braces
+ |
+LL - consume({ a.b });
+LL + consume(a.b);
+ |
warning: 1 warning emitted
-{"message":"unnecessary parentheses around assigned value","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":596,"byte_end":609,"line_start":16,"line_end":16,"column_start":14,"column_end":27,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));
+{"message":"unnecessary parentheses around assigned value","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":596,"byte_end":597,"line_start":16,"line_end":16,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));
--> $DIR/unused_parens_json_suggestion.rs:16:14
|
LL | let _a = (1 / (2 + 3));
- | ^^^^^^^^^^^^^ help: remove these parentheses
+ | ^ ^
|
note: the lint level is defined here
--> $DIR/unused_parens_json_suggestion.rs:10:9
|
LL | #![deny(unused_parens)]
| ^^^^^^^^^^^^^
+help: remove these parentheses
+ |
+LL - let _a = (1 / (2 + 3));
+LL + let _a = 1 / (2 + 3);
+ |
"}
{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error
-{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":500,"byte_end":504,"line_start":17,"line_end":17,"column_start":8,"column_end":12,"is_primary":true,"text":[{"text":" if (_b) {
+{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":500,"byte_end":501,"line_start":17,"line_end":17,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (_b) {
--> $DIR/unused_parens_remove_json_suggestion.rs:17:8
|
LL | if (_b) {
- | ^^^^ help: remove these parentheses
+ | ^ ^
|
note: the lint level is defined here
--> $DIR/unused_parens_remove_json_suggestion.rs:10:9
|
LL | #![deny(unused_parens)]
| ^^^^^^^^^^^^^
+help: remove these parentheses
+ |
+LL - if (_b) {
+LL + if _b {
+ |
"}
-{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":631,"byte_end":634,"line_start":28,"line_end":28,"column_start":7,"column_end":10,"is_primary":true,"text":[{"text":" if(c) {
+{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":631,"byte_end":632,"line_start":28,"line_end":28,"column_start":7,"column_end":8,"is_primary":true,"text":[{"text":" if(c) {
--> $DIR/unused_parens_remove_json_suggestion.rs:28:7
|
LL | if(c) {
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - if(c) {
+LL + if c {
+ |
"}
-{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":711,"byte_end":714,"line_start":32,"line_end":32,"column_start":8,"column_end":11,"is_primary":true,"text":[{"text":" if (c){
+{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":711,"byte_end":712,"line_start":32,"line_end":32,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (c){
--> $DIR/unused_parens_remove_json_suggestion.rs:32:8
|
LL | if (c){
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - if (c){
+LL + if c {
+ |
"}
-{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":793,"byte_end":808,"line_start":36,"line_end":36,"column_start":11,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":793,"byte_end":808,"line_start":36,"line_end":36,"column_start":11,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":26}],"label":null,"suggested_replacement":"false && true ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition
+{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":793,"byte_end":794,"line_start":36,"line_end":36,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":807,"byte_end":808,"line_start":36,"line_end":36,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":793,"byte_end":794,"line_start":36,"line_end":36,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":807,"byte_end":808,"line_start":36,"line_end":36,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition
--> $DIR/unused_parens_remove_json_suggestion.rs:36:11
|
LL | while (false && true){
- | ^^^^^^^^^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - while (false && true){
+LL + while false && true {
+ |
"}
-{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":821,"byte_end":824,"line_start":37,"line_end":37,"column_start":12,"column_end":15,"is_primary":true,"text":[{"text":" if (c) {
+{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":821,"byte_end":822,"line_start":37,"line_end":37,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":" if (c) {
--> $DIR/unused_parens_remove_json_suggestion.rs:37:12
|
LL | if (c) {
- | ^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - if (c) {
+LL + if c {
+ |
"}
-{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":918,"byte_end":933,"line_start":43,"line_end":43,"column_start":10,"column_end":25,"is_primary":true,"text":[{"text":" while(true && false) {
+{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":918,"byte_end":919,"line_start":43,"line_end":43,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":" while(true && false) {
--> $DIR/unused_parens_remove_json_suggestion.rs:43:10
|
LL | while(true && false) {
- | ^^^^^^^^^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - while(true && false) {
+LL + while true && false {
+ |
"}
-{"message":"unnecessary parentheses around `for` iterator expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":987,"byte_end":995,"line_start":44,"line_end":44,"column_start":18,"column_end":26,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){
+{"message":"unnecessary parentheses around `for` iterator expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":987,"byte_end":988,"line_start":44,"line_end":44,"column_start":18,"column_end":19,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){
--> $DIR/unused_parens_remove_json_suggestion.rs:44:18
|
LL | for _ in (0 .. 3){
- | ^^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - for _ in (0 .. 3){
+LL + for _ in 0 .. 3 {
+ |
"}
-{"message":"unnecessary parentheses around `for` iterator expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1088,"byte_end":1096,"line_start":49,"line_end":49,"column_start":14,"column_end":22,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) {
+{"message":"unnecessary parentheses around `for` iterator expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1088,"byte_end":1089,"line_start":49,"line_end":49,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) {
--> $DIR/unused_parens_remove_json_suggestion.rs:49:14
|
LL | for _ in (0 .. 3) {
- | ^^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - for _ in (0 .. 3) {
+LL + for _ in 0 .. 3 {
+ |
"}
-{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1147,"byte_end":1162,"line_start":50,"line_end":50,"column_start":15,"column_end":30,"is_primary":true,"text":[{"text":" while (true && false) {
+{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1147,"byte_end":1148,"line_start":50,"line_end":50,"column_start":15,"column_end":16,"is_primary":true,"text":[{"text":" while (true && false) {
--> $DIR/unused_parens_remove_json_suggestion.rs:50:15
|
LL | while (true && false) {
- | ^^^^^^^^^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - while (true && false) {
+LL + while true && false {
+ |
"}
{"message":"aborting due to 9 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 9 previous errors
help: change the type of the numeric literal from `usize` to `u32`
|
LL | let x: u32 = 22_u32;
- | ~~~~~~
+ | ~~~
error: aborting due to previous error
help: change the type of the numeric literal from `usize` to `u32`
|
LL | let x: u32 = 22_u32;
- | ~~~~~~
+ | ~~~
error: aborting due to previous error
help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
|
LL | let y: usize = x.foo().try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error: aborting due to 2 previous errors
help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
|
LL | ($arr.len() * size_of($arr[0])).try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | + +++++++++++++++++++++
error[E0605]: non-primitive cast: `{integer}` as `()`
--> $DIR/issue-26480.rs:22:19
help: change the type of the numeric literal from `u8` to `u16`
|
LL | foo(1u16);
- | ~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-literal-cast.rs:8:10
help: change the type of the numeric literal from `f32` to `f64`
|
LL | foo1(2f64);
- | ~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-literal-cast.rs:10:10
help: change the type of the numeric literal from `i16` to `i32`
|
LL | foo2(3i32);
- | ~~~~
+ | ~~~
error: aborting due to 3 previous errors
// run-pass
#![allow(non_upper_case_globals)]
+#![allow(dead_code)]
/*!
* On x86_64-linux-gnu and possibly other platforms, structs get 8-byte "preferred" alignment,
* but their "ABI" alignment (i.e., what actually matters for data layout) is the largest alignment
// run-pass
#![allow(unused_mut)]
+#![allow(dead_code)]
#![feature(box_syntax)]
#[derive(Clone)]
// run-pass
#![allow(unused_mut)]
+#![allow(dead_code)]
#![feature(box_syntax)]
#[derive(Clone)]
help: change the type of the numeric literal from `i8` to `i32`
|
LL | const C: i32 = 1i32;
- | ~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/const-scope.rs:2:15
help: change the type of the numeric literal from `i8` to `i32`
|
LL | let c: i32 = 1i32;
- | ~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/const-scope.rs:6:17
help: change the type of the numeric literal from `i8` to `i32`
|
LL | let c: i32 = 1i32;
- | ~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/const-scope.rs:11:17
help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
|
LL | let d: i8 = c.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error: aborting due to 6 previous errors
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
|
LL | test(array.len().try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error: aborting due to previous error
help: you can convert an `i32` to a `u16` and panic if the converted value doesn't fit
|
LL | let x: u16 = foo().try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-2.rs:7:18
|
LL | let y: i64 = x + x;
- | --- ^^^^^
- | | |
- | | expected `i64`, found `u16`
- | | help: you can convert a `u16` to an `i64`: `(x + x).into()`
+ | --- ^^^^^ expected `i64`, found `u16`
+ | |
| expected due to this
+ |
+help: you can convert a `u16` to an `i64`
+ |
+LL | let y: i64 = (x + x).into();
+ | + ++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-2.rs:9:18
|
LL | let z: i32 = x + x;
- | --- ^^^^^
- | | |
- | | expected `i32`, found `u16`
- | | help: you can convert a `u16` to an `i32`: `(x + x).into()`
+ | --- ^^^^^ expected `i32`, found `u16`
+ | |
| expected due to this
+ |
+help: you can convert a `u16` to an `i32`
+ |
+LL | let z: i32 = (x + x).into();
+ | + ++++++++
error: aborting due to 3 previous errors
help: you can convert `x_u8` from `u8` to `u16`, matching the type of `x_u16`
|
LL | u16::from(x_u8) > x_u16;
- | ~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:25:16
help: you can convert `x_u8` from `u8` to `u32`, matching the type of `x_u32`
|
LL | u32::from(x_u8) > x_u32;
- | ~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:27:16
help: you can convert `x_u8` from `u8` to `u64`, matching the type of `x_u64`
|
LL | u64::from(x_u8) > x_u64;
- | ~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:29:16
help: you can convert `x_u8` from `u8` to `u128`, matching the type of `x_u128`
|
LL | u128::from(x_u8) > x_u128;
- | ~~~~~~~~~~~~~~~~
+ | +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:31:16
help: you can convert `x_u8` from `u8` to `usize`, matching the type of `x_usize`
|
LL | usize::from(x_u8) > x_usize;
- | ~~~~~~~~~~~~~~~~~
+ | ++++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:34:17
|
LL | x_u16 > x_u8;
- | ^^^^
- | |
- | expected `u16`, found `u8`
- | help: you can convert a `u8` to a `u16`: `x_u8.into()`
+ | ^^^^ expected `u16`, found `u8`
+ |
+help: you can convert a `u8` to a `u16`
+ |
+LL | x_u16 > x_u8.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:36:17
help: you can convert `x_u16` from `u16` to `u32`, matching the type of `x_u32`
|
LL | u32::from(x_u16) > x_u32;
- | ~~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:38:17
help: you can convert `x_u16` from `u16` to `u64`, matching the type of `x_u64`
|
LL | u64::from(x_u16) > x_u64;
- | ~~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:40:17
help: you can convert `x_u16` from `u16` to `u128`, matching the type of `x_u128`
|
LL | u128::from(x_u16) > x_u128;
- | ~~~~~~~~~~~~~~~~~
+ | +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:42:17
help: you can convert `x_u16` from `u16` to `usize`, matching the type of `x_usize`
|
LL | usize::from(x_u16) > x_usize;
- | ~~~~~~~~~~~~~~~~~~
+ | ++++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:45:17
|
LL | x_u32 > x_u8;
- | ^^^^
- | |
- | expected `u32`, found `u8`
- | help: you can convert a `u8` to a `u32`: `x_u8.into()`
+ | ^^^^ expected `u32`, found `u8`
+ |
+help: you can convert a `u8` to a `u32`
+ |
+LL | x_u32 > x_u8.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:47:17
|
LL | x_u32 > x_u16;
- | ^^^^^
- | |
- | expected `u32`, found `u16`
- | help: you can convert a `u16` to a `u32`: `x_u16.into()`
+ | ^^^^^ expected `u32`, found `u16`
+ |
+help: you can convert a `u16` to a `u32`
+ |
+LL | x_u32 > x_u16.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:49:17
help: you can convert `x_u32` from `u32` to `u64`, matching the type of `x_u64`
|
LL | u64::from(x_u32) > x_u64;
- | ~~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:51:17
help: you can convert `x_u32` from `u32` to `u128`, matching the type of `x_u128`
|
LL | u128::from(x_u32) > x_u128;
- | ~~~~~~~~~~~~~~~~~
+ | +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:53:17
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
|
LL | x_u32 > x_usize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:56:17
|
LL | x_u64 > x_u8;
- | ^^^^
- | |
- | expected `u64`, found `u8`
- | help: you can convert a `u8` to a `u64`: `x_u8.into()`
+ | ^^^^ expected `u64`, found `u8`
+ |
+help: you can convert a `u8` to a `u64`
+ |
+LL | x_u64 > x_u8.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:58:17
|
LL | x_u64 > x_u16;
- | ^^^^^
- | |
- | expected `u64`, found `u16`
- | help: you can convert a `u16` to a `u64`: `x_u16.into()`
+ | ^^^^^ expected `u64`, found `u16`
+ |
+help: you can convert a `u16` to a `u64`
+ |
+LL | x_u64 > x_u16.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:60:17
|
LL | x_u64 > x_u32;
- | ^^^^^
- | |
- | expected `u64`, found `u32`
- | help: you can convert a `u32` to a `u64`: `x_u32.into()`
+ | ^^^^^ expected `u64`, found `u32`
+ |
+help: you can convert a `u32` to a `u64`
+ |
+LL | x_u64 > x_u32.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:62:17
help: you can convert `x_u64` from `u64` to `u128`, matching the type of `x_u128`
|
LL | u128::from(x_u64) > x_u128;
- | ~~~~~~~~~~~~~~~~~
+ | +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:64:17
help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
|
LL | x_u64 > x_usize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:67:18
|
LL | x_u128 > x_u8;
- | ^^^^
- | |
- | expected `u128`, found `u8`
- | help: you can convert a `u8` to a `u128`: `x_u8.into()`
+ | ^^^^ expected `u128`, found `u8`
+ |
+help: you can convert a `u8` to a `u128`
+ |
+LL | x_u128 > x_u8.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:69:18
|
LL | x_u128 > x_u16;
- | ^^^^^
- | |
- | expected `u128`, found `u16`
- | help: you can convert a `u16` to a `u128`: `x_u16.into()`
+ | ^^^^^ expected `u128`, found `u16`
+ |
+help: you can convert a `u16` to a `u128`
+ |
+LL | x_u128 > x_u16.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:71:18
|
LL | x_u128 > x_u32;
- | ^^^^^
- | |
- | expected `u128`, found `u32`
- | help: you can convert a `u32` to a `u128`: `x_u32.into()`
+ | ^^^^^ expected `u128`, found `u32`
+ |
+help: you can convert a `u32` to a `u128`
+ |
+LL | x_u128 > x_u32.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:73:18
|
LL | x_u128 > x_u64;
- | ^^^^^
- | |
- | expected `u128`, found `u64`
- | help: you can convert a `u64` to a `u128`: `x_u64.into()`
+ | ^^^^^ expected `u128`, found `u64`
+ |
+help: you can convert a `u64` to a `u128`
+ |
+LL | x_u128 > x_u64.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:75:18
help: you can convert a `usize` to a `u128` and panic if the converted value doesn't fit
|
LL | x_u128 > x_usize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:78:19
|
LL | x_usize > x_u8;
- | ^^^^
- | |
- | expected `usize`, found `u8`
- | help: you can convert a `u8` to a `usize`: `x_u8.into()`
+ | ^^^^ expected `usize`, found `u8`
+ |
+help: you can convert a `u8` to a `usize`
+ |
+LL | x_usize > x_u8.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:80:19
|
LL | x_usize > x_u16;
- | ^^^^^
- | |
- | expected `usize`, found `u16`
- | help: you can convert a `u16` to a `usize`: `x_u16.into()`
+ | ^^^^^ expected `usize`, found `u16`
+ |
+help: you can convert a `u16` to a `usize`
+ |
+LL | x_usize > x_u16.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:82:19
help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
|
LL | x_usize > x_u32.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:84:19
help: you can convert a `u64` to a `usize` and panic if the converted value doesn't fit
|
LL | x_usize > x_u64.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:86:19
help: you can convert a `u128` to a `usize` and panic if the converted value doesn't fit
|
LL | x_usize > x_u128.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:92:16
help: you can convert `x_i8` from `i8` to `i16`, matching the type of `x_i16`
|
LL | i16::from(x_i8) > x_i16;
- | ~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:94:16
help: you can convert `x_i8` from `i8` to `i32`, matching the type of `x_i32`
|
LL | i32::from(x_i8) > x_i32;
- | ~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:96:16
help: you can convert `x_i8` from `i8` to `i64`, matching the type of `x_i64`
|
LL | i64::from(x_i8) > x_i64;
- | ~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:98:16
help: you can convert `x_i8` from `i8` to `i128`, matching the type of `x_i128`
|
LL | i128::from(x_i8) > x_i128;
- | ~~~~~~~~~~~~~~~~
+ | +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:100:16
help: you can convert `x_i8` from `i8` to `isize`, matching the type of `x_isize`
|
LL | isize::from(x_i8) > x_isize;
- | ~~~~~~~~~~~~~~~~~
+ | ++++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:103:17
|
LL | x_i16 > x_i8;
- | ^^^^
- | |
- | expected `i16`, found `i8`
- | help: you can convert an `i8` to an `i16`: `x_i8.into()`
+ | ^^^^ expected `i16`, found `i8`
+ |
+help: you can convert an `i8` to an `i16`
+ |
+LL | x_i16 > x_i8.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:105:17
help: you can convert `x_i16` from `i16` to `i32`, matching the type of `x_i32`
|
LL | i32::from(x_i16) > x_i32;
- | ~~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:107:17
help: you can convert `x_i16` from `i16` to `i64`, matching the type of `x_i64`
|
LL | i64::from(x_i16) > x_i64;
- | ~~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:109:17
help: you can convert `x_i16` from `i16` to `i128`, matching the type of `x_i128`
|
LL | i128::from(x_i16) > x_i128;
- | ~~~~~~~~~~~~~~~~~
+ | +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:111:17
help: you can convert `x_i16` from `i16` to `isize`, matching the type of `x_isize`
|
LL | isize::from(x_i16) > x_isize;
- | ~~~~~~~~~~~~~~~~~~
+ | ++++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:114:17
|
LL | x_i32 > x_i8;
- | ^^^^
- | |
- | expected `i32`, found `i8`
- | help: you can convert an `i8` to an `i32`: `x_i8.into()`
+ | ^^^^ expected `i32`, found `i8`
+ |
+help: you can convert an `i8` to an `i32`
+ |
+LL | x_i32 > x_i8.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:116:17
|
LL | x_i32 > x_i16;
- | ^^^^^
- | |
- | expected `i32`, found `i16`
- | help: you can convert an `i16` to an `i32`: `x_i16.into()`
+ | ^^^^^ expected `i32`, found `i16`
+ |
+help: you can convert an `i16` to an `i32`
+ |
+LL | x_i32 > x_i16.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:118:17
help: you can convert `x_i32` from `i32` to `i64`, matching the type of `x_i64`
|
LL | i64::from(x_i32) > x_i64;
- | ~~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:120:17
help: you can convert `x_i32` from `i32` to `i128`, matching the type of `x_i128`
|
LL | i128::from(x_i32) > x_i128;
- | ~~~~~~~~~~~~~~~~~
+ | +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:122:17
help: you can convert an `isize` to an `i32` and panic if the converted value doesn't fit
|
LL | x_i32 > x_isize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:125:17
|
LL | x_i64 > x_i8;
- | ^^^^
- | |
- | expected `i64`, found `i8`
- | help: you can convert an `i8` to an `i64`: `x_i8.into()`
+ | ^^^^ expected `i64`, found `i8`
+ |
+help: you can convert an `i8` to an `i64`
+ |
+LL | x_i64 > x_i8.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:127:17
|
LL | x_i64 > x_i16;
- | ^^^^^
- | |
- | expected `i64`, found `i16`
- | help: you can convert an `i16` to an `i64`: `x_i16.into()`
+ | ^^^^^ expected `i64`, found `i16`
+ |
+help: you can convert an `i16` to an `i64`
+ |
+LL | x_i64 > x_i16.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:129:17
|
LL | x_i64 > x_i32;
- | ^^^^^
- | |
- | expected `i64`, found `i32`
- | help: you can convert an `i32` to an `i64`: `x_i32.into()`
+ | ^^^^^ expected `i64`, found `i32`
+ |
+help: you can convert an `i32` to an `i64`
+ |
+LL | x_i64 > x_i32.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:131:17
help: you can convert `x_i64` from `i64` to `i128`, matching the type of `x_i128`
|
LL | i128::from(x_i64) > x_i128;
- | ~~~~~~~~~~~~~~~~~
+ | +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:133:17
help: you can convert an `isize` to an `i64` and panic if the converted value doesn't fit
|
LL | x_i64 > x_isize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:136:18
|
LL | x_i128 > x_i8;
- | ^^^^
- | |
- | expected `i128`, found `i8`
- | help: you can convert an `i8` to an `i128`: `x_i8.into()`
+ | ^^^^ expected `i128`, found `i8`
+ |
+help: you can convert an `i8` to an `i128`
+ |
+LL | x_i128 > x_i8.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:138:18
|
LL | x_i128 > x_i16;
- | ^^^^^
- | |
- | expected `i128`, found `i16`
- | help: you can convert an `i16` to an `i128`: `x_i16.into()`
+ | ^^^^^ expected `i128`, found `i16`
+ |
+help: you can convert an `i16` to an `i128`
+ |
+LL | x_i128 > x_i16.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:140:18
|
LL | x_i128 > x_i32;
- | ^^^^^
- | |
- | expected `i128`, found `i32`
- | help: you can convert an `i32` to an `i128`: `x_i32.into()`
+ | ^^^^^ expected `i128`, found `i32`
+ |
+help: you can convert an `i32` to an `i128`
+ |
+LL | x_i128 > x_i32.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:142:18
|
LL | x_i128 > x_i64;
- | ^^^^^
- | |
- | expected `i128`, found `i64`
- | help: you can convert an `i64` to an `i128`: `x_i64.into()`
+ | ^^^^^ expected `i128`, found `i64`
+ |
+help: you can convert an `i64` to an `i128`
+ |
+LL | x_i128 > x_i64.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:144:18
help: you can convert an `isize` to an `i128` and panic if the converted value doesn't fit
|
LL | x_i128 > x_isize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:147:19
|
LL | x_isize > x_i8;
- | ^^^^
- | |
- | expected `isize`, found `i8`
- | help: you can convert an `i8` to an `isize`: `x_i8.into()`
+ | ^^^^ expected `isize`, found `i8`
+ |
+help: you can convert an `i8` to an `isize`
+ |
+LL | x_isize > x_i8.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:149:19
|
LL | x_isize > x_i16;
- | ^^^^^
- | |
- | expected `isize`, found `i16`
- | help: you can convert an `i16` to an `isize`: `x_i16.into()`
+ | ^^^^^ expected `isize`, found `i16`
+ |
+help: you can convert an `i16` to an `isize`
+ |
+LL | x_isize > x_i16.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:151:19
help: you can convert an `i32` to an `isize` and panic if the converted value doesn't fit
|
LL | x_isize > x_i32.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:153:19
help: you can convert an `i64` to an `isize` and panic if the converted value doesn't fit
|
LL | x_isize > x_i64.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:155:19
help: you can convert an `i128` to an `isize` and panic if the converted value doesn't fit
|
LL | x_isize > x_i128.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:161:16
help: you can convert an `i8` to a `u8` and panic if the converted value doesn't fit
|
LL | x_u8 > x_i8.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:163:16
help: you can convert `x_u8` from `u8` to `i16`, matching the type of `x_i16`
|
LL | i16::from(x_u8) > x_i16;
- | ~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:165:16
help: you can convert `x_u8` from `u8` to `i32`, matching the type of `x_i32`
|
LL | i32::from(x_u8) > x_i32;
- | ~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:167:16
help: you can convert `x_u8` from `u8` to `i64`, matching the type of `x_i64`
|
LL | i64::from(x_u8) > x_i64;
- | ~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:169:16
help: you can convert `x_u8` from `u8` to `i128`, matching the type of `x_i128`
|
LL | i128::from(x_u8) > x_i128;
- | ~~~~~~~~~~~~~~~~
+ | +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:171:16
help: you can convert `x_u8` from `u8` to `isize`, matching the type of `x_isize`
|
LL | isize::from(x_u8) > x_isize;
- | ~~~~~~~~~~~~~~~~~
+ | ++++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:174:17
help: you can convert an `i8` to a `u16` and panic if the converted value doesn't fit
|
LL | x_u16 > x_i8.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:176:17
help: you can convert an `i16` to a `u16` and panic if the converted value doesn't fit
|
LL | x_u16 > x_i16.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:178:17
help: you can convert `x_u16` from `u16` to `i32`, matching the type of `x_i32`
|
LL | i32::from(x_u16) > x_i32;
- | ~~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:180:17
help: you can convert `x_u16` from `u16` to `i64`, matching the type of `x_i64`
|
LL | i64::from(x_u16) > x_i64;
- | ~~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:182:17
help: you can convert `x_u16` from `u16` to `i128`, matching the type of `x_i128`
|
LL | i128::from(x_u16) > x_i128;
- | ~~~~~~~~~~~~~~~~~
+ | +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:184:17
help: you can convert an `isize` to a `u16` and panic if the converted value doesn't fit
|
LL | x_u16 > x_isize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:187:17
help: you can convert an `i8` to a `u32` and panic if the converted value doesn't fit
|
LL | x_u32 > x_i8.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:189:17
help: you can convert an `i16` to a `u32` and panic if the converted value doesn't fit
|
LL | x_u32 > x_i16.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:191:17
help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit
|
LL | x_u32 > x_i32.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:193:17
help: you can convert `x_u32` from `u32` to `i64`, matching the type of `x_i64`
|
LL | i64::from(x_u32) > x_i64;
- | ~~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:195:17
help: you can convert `x_u32` from `u32` to `i128`, matching the type of `x_i128`
|
LL | i128::from(x_u32) > x_i128;
- | ~~~~~~~~~~~~~~~~~
+ | +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:197:17
help: you can convert an `isize` to a `u32` and panic if the converted value doesn't fit
|
LL | x_u32 > x_isize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:200:17
help: you can convert an `i8` to a `u64` and panic if the converted value doesn't fit
|
LL | x_u64 > x_i8.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:202:17
help: you can convert an `i16` to a `u64` and panic if the converted value doesn't fit
|
LL | x_u64 > x_i16.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:204:17
help: you can convert an `i32` to a `u64` and panic if the converted value doesn't fit
|
LL | x_u64 > x_i32.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:206:17
help: you can convert an `i64` to a `u64` and panic if the converted value doesn't fit
|
LL | x_u64 > x_i64.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:208:17
help: you can convert `x_u64` from `u64` to `i128`, matching the type of `x_i128`
|
LL | i128::from(x_u64) > x_i128;
- | ~~~~~~~~~~~~~~~~~
+ | +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:210:17
help: you can convert an `isize` to a `u64` and panic if the converted value doesn't fit
|
LL | x_u64 > x_isize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:213:18
help: you can convert an `i8` to a `u128` and panic if the converted value doesn't fit
|
LL | x_u128 > x_i8.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:215:18
help: you can convert an `i16` to a `u128` and panic if the converted value doesn't fit
|
LL | x_u128 > x_i16.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:217:18
help: you can convert an `i32` to a `u128` and panic if the converted value doesn't fit
|
LL | x_u128 > x_i32.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:219:18
help: you can convert an `i64` to a `u128` and panic if the converted value doesn't fit
|
LL | x_u128 > x_i64.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:221:18
help: you can convert an `i128` to a `u128` and panic if the converted value doesn't fit
|
LL | x_u128 > x_i128.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:223:18
help: you can convert an `isize` to a `u128` and panic if the converted value doesn't fit
|
LL | x_u128 > x_isize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:226:19
help: you can convert an `i8` to a `usize` and panic if the converted value doesn't fit
|
LL | x_usize > x_i8.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:228:19
help: you can convert an `i16` to a `usize` and panic if the converted value doesn't fit
|
LL | x_usize > x_i16.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:230:19
help: you can convert an `i32` to a `usize` and panic if the converted value doesn't fit
|
LL | x_usize > x_i32.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:232:19
help: you can convert an `i64` to a `usize` and panic if the converted value doesn't fit
|
LL | x_usize > x_i64.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:234:19
help: you can convert an `i128` to a `usize` and panic if the converted value doesn't fit
|
LL | x_usize > x_i128.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:236:19
help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
|
LL | x_usize > x_isize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:242:16
help: you can convert a `u8` to an `i8` and panic if the converted value doesn't fit
|
LL | x_i8 > x_u8.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:244:16
help: you can convert a `u16` to an `i8` and panic if the converted value doesn't fit
|
LL | x_i8 > x_u16.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:246:16
help: you can convert a `u32` to an `i8` and panic if the converted value doesn't fit
|
LL | x_i8 > x_u32.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:248:16
help: you can convert a `u64` to an `i8` and panic if the converted value doesn't fit
|
LL | x_i8 > x_u64.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:250:16
help: you can convert a `u128` to an `i8` and panic if the converted value doesn't fit
|
LL | x_i8 > x_u128.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:252:16
help: you can convert a `usize` to an `i8` and panic if the converted value doesn't fit
|
LL | x_i8 > x_usize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:255:17
|
LL | x_i16 > x_u8;
- | ^^^^
- | |
- | expected `i16`, found `u8`
- | help: you can convert a `u8` to an `i16`: `x_u8.into()`
+ | ^^^^ expected `i16`, found `u8`
+ |
+help: you can convert a `u8` to an `i16`
+ |
+LL | x_i16 > x_u8.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:257:17
help: you can convert a `u16` to an `i16` and panic if the converted value doesn't fit
|
LL | x_i16 > x_u16.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:259:17
help: you can convert a `u32` to an `i16` and panic if the converted value doesn't fit
|
LL | x_i16 > x_u32.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:261:17
help: you can convert a `u64` to an `i16` and panic if the converted value doesn't fit
|
LL | x_i16 > x_u64.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:263:17
help: you can convert a `u128` to an `i16` and panic if the converted value doesn't fit
|
LL | x_i16 > x_u128.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:265:17
help: you can convert a `usize` to an `i16` and panic if the converted value doesn't fit
|
LL | x_i16 > x_usize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:268:17
|
LL | x_i32 > x_u8;
- | ^^^^
- | |
- | expected `i32`, found `u8`
- | help: you can convert a `u8` to an `i32`: `x_u8.into()`
+ | ^^^^ expected `i32`, found `u8`
+ |
+help: you can convert a `u8` to an `i32`
+ |
+LL | x_i32 > x_u8.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:270:17
|
LL | x_i32 > x_u16;
- | ^^^^^
- | |
- | expected `i32`, found `u16`
- | help: you can convert a `u16` to an `i32`: `x_u16.into()`
+ | ^^^^^ expected `i32`, found `u16`
+ |
+help: you can convert a `u16` to an `i32`
+ |
+LL | x_i32 > x_u16.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:272:17
help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
|
LL | x_i32 > x_u32.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:274:17
help: you can convert a `u64` to an `i32` and panic if the converted value doesn't fit
|
LL | x_i32 > x_u64.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:276:17
help: you can convert a `u128` to an `i32` and panic if the converted value doesn't fit
|
LL | x_i32 > x_u128.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:278:17
help: you can convert a `usize` to an `i32` and panic if the converted value doesn't fit
|
LL | x_i32 > x_usize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:281:17
|
LL | x_i64 > x_u8;
- | ^^^^
- | |
- | expected `i64`, found `u8`
- | help: you can convert a `u8` to an `i64`: `x_u8.into()`
+ | ^^^^ expected `i64`, found `u8`
+ |
+help: you can convert a `u8` to an `i64`
+ |
+LL | x_i64 > x_u8.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:283:17
|
LL | x_i64 > x_u16;
- | ^^^^^
- | |
- | expected `i64`, found `u16`
- | help: you can convert a `u16` to an `i64`: `x_u16.into()`
+ | ^^^^^ expected `i64`, found `u16`
+ |
+help: you can convert a `u16` to an `i64`
+ |
+LL | x_i64 > x_u16.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:285:17
|
LL | x_i64 > x_u32;
- | ^^^^^
- | |
- | expected `i64`, found `u32`
- | help: you can convert a `u32` to an `i64`: `x_u32.into()`
+ | ^^^^^ expected `i64`, found `u32`
+ |
+help: you can convert a `u32` to an `i64`
+ |
+LL | x_i64 > x_u32.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:287:17
help: you can convert a `u64` to an `i64` and panic if the converted value doesn't fit
|
LL | x_i64 > x_u64.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:289:17
help: you can convert a `u128` to an `i64` and panic if the converted value doesn't fit
|
LL | x_i64 > x_u128.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:291:17
help: you can convert a `usize` to an `i64` and panic if the converted value doesn't fit
|
LL | x_i64 > x_usize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:294:18
|
LL | x_i128 > x_u8;
- | ^^^^
- | |
- | expected `i128`, found `u8`
- | help: you can convert a `u8` to an `i128`: `x_u8.into()`
+ | ^^^^ expected `i128`, found `u8`
+ |
+help: you can convert a `u8` to an `i128`
+ |
+LL | x_i128 > x_u8.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:296:18
|
LL | x_i128 > x_u16;
- | ^^^^^
- | |
- | expected `i128`, found `u16`
- | help: you can convert a `u16` to an `i128`: `x_u16.into()`
+ | ^^^^^ expected `i128`, found `u16`
+ |
+help: you can convert a `u16` to an `i128`
+ |
+LL | x_i128 > x_u16.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:298:18
|
LL | x_i128 > x_u32;
- | ^^^^^
- | |
- | expected `i128`, found `u32`
- | help: you can convert a `u32` to an `i128`: `x_u32.into()`
+ | ^^^^^ expected `i128`, found `u32`
+ |
+help: you can convert a `u32` to an `i128`
+ |
+LL | x_i128 > x_u32.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:300:18
|
LL | x_i128 > x_u64;
- | ^^^^^
- | |
- | expected `i128`, found `u64`
- | help: you can convert a `u64` to an `i128`: `x_u64.into()`
+ | ^^^^^ expected `i128`, found `u64`
+ |
+help: you can convert a `u64` to an `i128`
+ |
+LL | x_i128 > x_u64.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:302:18
help: you can convert a `u128` to an `i128` and panic if the converted value doesn't fit
|
LL | x_i128 > x_u128.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:304:18
help: you can convert a `usize` to an `i128` and panic if the converted value doesn't fit
|
LL | x_i128 > x_usize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:307:19
|
LL | x_isize > x_u8;
- | ^^^^
- | |
- | expected `isize`, found `u8`
- | help: you can convert a `u8` to an `isize`: `x_u8.into()`
+ | ^^^^ expected `isize`, found `u8`
+ |
+help: you can convert a `u8` to an `isize`
+ |
+LL | x_isize > x_u8.into();
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:309:19
help: you can convert a `u16` to an `isize` and panic if the converted value doesn't fit
|
LL | x_isize > x_u16.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:311:19
help: you can convert a `u32` to an `isize` and panic if the converted value doesn't fit
|
LL | x_isize > x_u32.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:313:19
help: you can convert a `u64` to an `isize` and panic if the converted value doesn't fit
|
LL | x_isize > x_u64.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:315:19
help: you can convert a `u128` to an `isize` and panic if the converted value doesn't fit
|
LL | x_isize > x_u128.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast-binop.rs:317:19
help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
|
LL | x_isize > x_usize.try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error: aborting due to 132 previous errors
help: you can convert `x_u8` from `u8` to `isize`, matching the type of `-1_isize`
|
LL | isize::from(x_u8) > -1_isize;
- | ~~~~~~~~~~~~~~~~~
+ | ++++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:23:15
help: you can convert `x_u64` from `u64` to `i128`, matching the type of `-1_i128`
|
LL | i128::from(x_u64) > -1_i128;
- | ~~~~~~~~~~~~~~~~~
+ | +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:29:13
help: you can convert `x_u32` from `u32` to `i128`, matching the type of `-1_i128`
|
LL | i128::from(x_u32) > -1_i128;
- | ~~~~~~~~~~~~~~~~~
+ | +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:31:13
help: you can convert `x_u16` from `u16` to `i128`, matching the type of `-1_i128`
|
LL | i128::from(x_u16) > -1_i128;
- | ~~~~~~~~~~~~~~~~~
+ | +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:33:12
help: you can convert `x_u8` from `u8` to `i128`, matching the type of `-1_i128`
|
LL | i128::from(x_u8) > -1_i128;
- | ~~~~~~~~~~~~~~~~
+ | +++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:36:15
help: you can convert `x_u32` from `u32` to `i64`, matching the type of `-1_i64`
|
LL | i64::from(x_u32) > -1_i64;
- | ~~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:44:13
help: you can convert `x_u16` from `u16` to `i64`, matching the type of `-1_i64`
|
LL | i64::from(x_u16) > -1_i64;
- | ~~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:46:12
help: you can convert `x_u8` from `u8` to `i64`, matching the type of `-1_i64`
|
LL | i64::from(x_u8) > -1_i64;
- | ~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:49:15
help: you can convert `x_u16` from `u16` to `i32`, matching the type of `-1_i32`
|
LL | i32::from(x_u16) > -1_i32;
- | ~~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:59:12
help: you can convert `x_u8` from `u8` to `i32`, matching the type of `-1_i32`
|
LL | i32::from(x_u8) > -1_i32;
- | ~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:62:15
help: you can convert `x_u8` from `u8` to `i16`, matching the type of `-1_i16`
|
LL | i16::from(x_u8) > -1_i16;
- | ~~~~~~~~~~~~~~~
+ | ++++++++++ +
error[E0308]: mismatched types
--> $DIR/numeric-cast-no-fix.rs:75:15
help: you can convert a `u64` to a `usize` and panic if the converted value doesn't fit
|
LL | foo::<usize>(x_u64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:25:18
help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
|
LL | foo::<usize>(x_u32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:27:18
|
LL | foo::<usize>(x_u16);
- | ^^^^^
- | |
- | expected `usize`, found `u16`
- | help: you can convert a `u16` to a `usize`: `x_u16.into()`
+ | ^^^^^ expected `usize`, found `u16`
+ |
+help: you can convert a `u16` to a `usize`
+ |
+LL | foo::<usize>(x_u16.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:29:18
|
LL | foo::<usize>(x_u8);
- | ^^^^
- | |
- | expected `usize`, found `u8`
- | help: you can convert a `u8` to a `usize`: `x_u8.into()`
+ | ^^^^ expected `usize`, found `u8`
+ |
+help: you can convert a `u8` to a `usize`
+ |
+LL | foo::<usize>(x_u8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:31:18
help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
|
LL | foo::<usize>(x_isize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:33:18
help: you can convert an `i64` to a `usize` and panic if the converted value doesn't fit
|
LL | foo::<usize>(x_i64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:35:18
help: you can convert an `i32` to a `usize` and panic if the converted value doesn't fit
|
LL | foo::<usize>(x_i32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:37:18
help: you can convert an `i16` to a `usize` and panic if the converted value doesn't fit
|
LL | foo::<usize>(x_i16.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:39:18
help: you can convert an `i8` to a `usize` and panic if the converted value doesn't fit
|
LL | foo::<usize>(x_i8.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:44:18
help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
|
LL | foo::<isize>(x_usize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:46:18
help: you can convert a `u64` to an `isize` and panic if the converted value doesn't fit
|
LL | foo::<isize>(x_u64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:48:18
help: you can convert a `u32` to an `isize` and panic if the converted value doesn't fit
|
LL | foo::<isize>(x_u32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:50:18
help: you can convert a `u16` to an `isize` and panic if the converted value doesn't fit
|
LL | foo::<isize>(x_u16.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:52:18
|
LL | foo::<isize>(x_u8);
- | ^^^^
- | |
- | expected `isize`, found `u8`
- | help: you can convert a `u8` to an `isize`: `x_u8.into()`
+ | ^^^^ expected `isize`, found `u8`
+ |
+help: you can convert a `u8` to an `isize`
+ |
+LL | foo::<isize>(x_u8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:55:18
help: you can convert an `i64` to an `isize` and panic if the converted value doesn't fit
|
LL | foo::<isize>(x_i64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:57:18
help: you can convert an `i32` to an `isize` and panic if the converted value doesn't fit
|
LL | foo::<isize>(x_i32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:59:18
|
LL | foo::<isize>(x_i16);
- | ^^^^^
- | |
- | expected `isize`, found `i16`
- | help: you can convert an `i16` to an `isize`: `x_i16.into()`
+ | ^^^^^ expected `isize`, found `i16`
+ |
+help: you can convert an `i16` to an `isize`
+ |
+LL | foo::<isize>(x_i16.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:61:18
|
LL | foo::<isize>(x_i8);
- | ^^^^
- | |
- | expected `isize`, found `i8`
- | help: you can convert an `i8` to an `isize`: `x_i8.into()`
+ | ^^^^ expected `isize`, found `i8`
+ |
+help: you can convert an `i8` to an `isize`
+ |
+LL | foo::<isize>(x_i8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:66:16
help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
|
LL | foo::<u64>(x_usize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:69:16
|
LL | foo::<u64>(x_u32);
- | ^^^^^
- | |
- | expected `u64`, found `u32`
- | help: you can convert a `u32` to a `u64`: `x_u32.into()`
+ | ^^^^^ expected `u64`, found `u32`
+ |
+help: you can convert a `u32` to a `u64`
+ |
+LL | foo::<u64>(x_u32.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:71:16
|
LL | foo::<u64>(x_u16);
- | ^^^^^
- | |
- | expected `u64`, found `u16`
- | help: you can convert a `u16` to a `u64`: `x_u16.into()`
+ | ^^^^^ expected `u64`, found `u16`
+ |
+help: you can convert a `u16` to a `u64`
+ |
+LL | foo::<u64>(x_u16.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:73:16
|
LL | foo::<u64>(x_u8);
- | ^^^^
- | |
- | expected `u64`, found `u8`
- | help: you can convert a `u8` to a `u64`: `x_u8.into()`
+ | ^^^^ expected `u64`, found `u8`
+ |
+help: you can convert a `u8` to a `u64`
+ |
+LL | foo::<u64>(x_u8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:75:16
help: you can convert an `isize` to a `u64` and panic if the converted value doesn't fit
|
LL | foo::<u64>(x_isize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:77:16
help: you can convert an `i64` to a `u64` and panic if the converted value doesn't fit
|
LL | foo::<u64>(x_i64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:79:16
help: you can convert an `i32` to a `u64` and panic if the converted value doesn't fit
|
LL | foo::<u64>(x_i32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:81:16
help: you can convert an `i16` to a `u64` and panic if the converted value doesn't fit
|
LL | foo::<u64>(x_i16.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:83:16
help: you can convert an `i8` to a `u64` and panic if the converted value doesn't fit
|
LL | foo::<u64>(x_i8.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:88:16
help: you can convert a `usize` to an `i64` and panic if the converted value doesn't fit
|
LL | foo::<i64>(x_usize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:90:16
help: you can convert a `u64` to an `i64` and panic if the converted value doesn't fit
|
LL | foo::<i64>(x_u64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:92:16
|
LL | foo::<i64>(x_u32);
- | ^^^^^
- | |
- | expected `i64`, found `u32`
- | help: you can convert a `u32` to an `i64`: `x_u32.into()`
+ | ^^^^^ expected `i64`, found `u32`
+ |
+help: you can convert a `u32` to an `i64`
+ |
+LL | foo::<i64>(x_u32.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:94:16
|
LL | foo::<i64>(x_u16);
- | ^^^^^
- | |
- | expected `i64`, found `u16`
- | help: you can convert a `u16` to an `i64`: `x_u16.into()`
+ | ^^^^^ expected `i64`, found `u16`
+ |
+help: you can convert a `u16` to an `i64`
+ |
+LL | foo::<i64>(x_u16.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:96:16
|
LL | foo::<i64>(x_u8);
- | ^^^^
- | |
- | expected `i64`, found `u8`
- | help: you can convert a `u8` to an `i64`: `x_u8.into()`
+ | ^^^^ expected `i64`, found `u8`
+ |
+help: you can convert a `u8` to an `i64`
+ |
+LL | foo::<i64>(x_u8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:98:16
help: you can convert an `isize` to an `i64` and panic if the converted value doesn't fit
|
LL | foo::<i64>(x_isize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:101:16
|
LL | foo::<i64>(x_i32);
- | ^^^^^
- | |
- | expected `i64`, found `i32`
- | help: you can convert an `i32` to an `i64`: `x_i32.into()`
+ | ^^^^^ expected `i64`, found `i32`
+ |
+help: you can convert an `i32` to an `i64`
+ |
+LL | foo::<i64>(x_i32.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:103:16
|
LL | foo::<i64>(x_i16);
- | ^^^^^
- | |
- | expected `i64`, found `i16`
- | help: you can convert an `i16` to an `i64`: `x_i16.into()`
+ | ^^^^^ expected `i64`, found `i16`
+ |
+help: you can convert an `i16` to an `i64`
+ |
+LL | foo::<i64>(x_i16.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:105:16
|
LL | foo::<i64>(x_i8);
- | ^^^^
- | |
- | expected `i64`, found `i8`
- | help: you can convert an `i8` to an `i64`: `x_i8.into()`
+ | ^^^^ expected `i64`, found `i8`
+ |
+help: you can convert an `i8` to an `i64`
+ |
+LL | foo::<i64>(x_i8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:110:16
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
|
LL | foo::<u32>(x_usize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:112:16
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
|
LL | foo::<u32>(x_u64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:115:16
|
LL | foo::<u32>(x_u16);
- | ^^^^^
- | |
- | expected `u32`, found `u16`
- | help: you can convert a `u16` to a `u32`: `x_u16.into()`
+ | ^^^^^ expected `u32`, found `u16`
+ |
+help: you can convert a `u16` to a `u32`
+ |
+LL | foo::<u32>(x_u16.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:117:16
|
LL | foo::<u32>(x_u8);
- | ^^^^
- | |
- | expected `u32`, found `u8`
- | help: you can convert a `u8` to a `u32`: `x_u8.into()`
+ | ^^^^ expected `u32`, found `u8`
+ |
+help: you can convert a `u8` to a `u32`
+ |
+LL | foo::<u32>(x_u8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:119:16
help: you can convert an `isize` to a `u32` and panic if the converted value doesn't fit
|
LL | foo::<u32>(x_isize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:121:16
help: you can convert an `i64` to a `u32` and panic if the converted value doesn't fit
|
LL | foo::<u32>(x_i64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:123:16
help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit
|
LL | foo::<u32>(x_i32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:125:16
help: you can convert an `i16` to a `u32` and panic if the converted value doesn't fit
|
LL | foo::<u32>(x_i16.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:127:16
help: you can convert an `i8` to a `u32` and panic if the converted value doesn't fit
|
LL | foo::<u32>(x_i8.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:132:16
help: you can convert a `usize` to an `i32` and panic if the converted value doesn't fit
|
LL | foo::<i32>(x_usize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:134:16
help: you can convert a `u64` to an `i32` and panic if the converted value doesn't fit
|
LL | foo::<i32>(x_u64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:136:16
help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
|
LL | foo::<i32>(x_u32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:138:16
|
LL | foo::<i32>(x_u16);
- | ^^^^^
- | |
- | expected `i32`, found `u16`
- | help: you can convert a `u16` to an `i32`: `x_u16.into()`
+ | ^^^^^ expected `i32`, found `u16`
+ |
+help: you can convert a `u16` to an `i32`
+ |
+LL | foo::<i32>(x_u16.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:140:16
|
LL | foo::<i32>(x_u8);
- | ^^^^
- | |
- | expected `i32`, found `u8`
- | help: you can convert a `u8` to an `i32`: `x_u8.into()`
+ | ^^^^ expected `i32`, found `u8`
+ |
+help: you can convert a `u8` to an `i32`
+ |
+LL | foo::<i32>(x_u8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:142:16
help: you can convert an `isize` to an `i32` and panic if the converted value doesn't fit
|
LL | foo::<i32>(x_isize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:144:16
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
LL | foo::<i32>(x_i64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:147:16
|
LL | foo::<i32>(x_i16);
- | ^^^^^
- | |
- | expected `i32`, found `i16`
- | help: you can convert an `i16` to an `i32`: `x_i16.into()`
+ | ^^^^^ expected `i32`, found `i16`
+ |
+help: you can convert an `i16` to an `i32`
+ |
+LL | foo::<i32>(x_i16.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:149:16
|
LL | foo::<i32>(x_i8);
- | ^^^^
- | |
- | expected `i32`, found `i8`
- | help: you can convert an `i8` to an `i32`: `x_i8.into()`
+ | ^^^^ expected `i32`, found `i8`
+ |
+help: you can convert an `i8` to an `i32`
+ |
+LL | foo::<i32>(x_i8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:154:16
help: you can convert a `usize` to a `u16` and panic if the converted value doesn't fit
|
LL | foo::<u16>(x_usize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:156:16
help: you can convert a `u64` to a `u16` and panic if the converted value doesn't fit
|
LL | foo::<u16>(x_u64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:158:16
help: you can convert a `u32` to a `u16` and panic if the converted value doesn't fit
|
LL | foo::<u16>(x_u32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:161:16
|
LL | foo::<u16>(x_u8);
- | ^^^^
- | |
- | expected `u16`, found `u8`
- | help: you can convert a `u8` to a `u16`: `x_u8.into()`
+ | ^^^^ expected `u16`, found `u8`
+ |
+help: you can convert a `u8` to a `u16`
+ |
+LL | foo::<u16>(x_u8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:163:16
help: you can convert an `isize` to a `u16` and panic if the converted value doesn't fit
|
LL | foo::<u16>(x_isize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:165:16
help: you can convert an `i64` to a `u16` and panic if the converted value doesn't fit
|
LL | foo::<u16>(x_i64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:167:16
help: you can convert an `i32` to a `u16` and panic if the converted value doesn't fit
|
LL | foo::<u16>(x_i32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:169:16
help: you can convert an `i16` to a `u16` and panic if the converted value doesn't fit
|
LL | foo::<u16>(x_i16.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:171:16
help: you can convert an `i8` to a `u16` and panic if the converted value doesn't fit
|
LL | foo::<u16>(x_i8.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:176:16
help: you can convert a `usize` to an `i16` and panic if the converted value doesn't fit
|
LL | foo::<i16>(x_usize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:178:16
help: you can convert a `u64` to an `i16` and panic if the converted value doesn't fit
|
LL | foo::<i16>(x_u64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:180:16
help: you can convert a `u32` to an `i16` and panic if the converted value doesn't fit
|
LL | foo::<i16>(x_u32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:182:16
help: you can convert a `u16` to an `i16` and panic if the converted value doesn't fit
|
LL | foo::<i16>(x_u16.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:184:16
|
LL | foo::<i16>(x_u8);
- | ^^^^
- | |
- | expected `i16`, found `u8`
- | help: you can convert a `u8` to an `i16`: `x_u8.into()`
+ | ^^^^ expected `i16`, found `u8`
+ |
+help: you can convert a `u8` to an `i16`
+ |
+LL | foo::<i16>(x_u8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:186:16
help: you can convert an `isize` to an `i16` and panic if the converted value doesn't fit
|
LL | foo::<i16>(x_isize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:188:16
help: you can convert an `i64` to an `i16` and panic if the converted value doesn't fit
|
LL | foo::<i16>(x_i64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:190:16
help: you can convert an `i32` to an `i16` and panic if the converted value doesn't fit
|
LL | foo::<i16>(x_i32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:193:16
|
LL | foo::<i16>(x_i8);
- | ^^^^
- | |
- | expected `i16`, found `i8`
- | help: you can convert an `i8` to an `i16`: `x_i8.into()`
+ | ^^^^ expected `i16`, found `i8`
+ |
+help: you can convert an `i8` to an `i16`
+ |
+LL | foo::<i16>(x_i8.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:198:15
help: you can convert a `usize` to a `u8` and panic if the converted value doesn't fit
|
LL | foo::<u8>(x_usize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:200:15
help: you can convert a `u64` to a `u8` and panic if the converted value doesn't fit
|
LL | foo::<u8>(x_u64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:202:15
help: you can convert a `u32` to a `u8` and panic if the converted value doesn't fit
|
LL | foo::<u8>(x_u32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:204:15
help: you can convert a `u16` to a `u8` and panic if the converted value doesn't fit
|
LL | foo::<u8>(x_u16.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:207:15
help: you can convert an `isize` to a `u8` and panic if the converted value doesn't fit
|
LL | foo::<u8>(x_isize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:209:15
help: you can convert an `i64` to a `u8` and panic if the converted value doesn't fit
|
LL | foo::<u8>(x_i64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:211:15
help: you can convert an `i32` to a `u8` and panic if the converted value doesn't fit
|
LL | foo::<u8>(x_i32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:213:15
help: you can convert an `i16` to a `u8` and panic if the converted value doesn't fit
|
LL | foo::<u8>(x_i16.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:215:15
help: you can convert an `i8` to a `u8` and panic if the converted value doesn't fit
|
LL | foo::<u8>(x_i8.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:220:15
help: you can convert a `usize` to an `i8` and panic if the converted value doesn't fit
|
LL | foo::<i8>(x_usize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:222:15
help: you can convert a `u64` to an `i8` and panic if the converted value doesn't fit
|
LL | foo::<i8>(x_u64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:224:15
help: you can convert a `u32` to an `i8` and panic if the converted value doesn't fit
|
LL | foo::<i8>(x_u32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:226:15
help: you can convert a `u16` to an `i8` and panic if the converted value doesn't fit
|
LL | foo::<i8>(x_u16.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:228:15
help: you can convert a `u8` to an `i8` and panic if the converted value doesn't fit
|
LL | foo::<i8>(x_u8.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:230:15
help: you can convert an `isize` to an `i8` and panic if the converted value doesn't fit
|
LL | foo::<i8>(x_isize.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:232:15
help: you can convert an `i64` to an `i8` and panic if the converted value doesn't fit
|
LL | foo::<i8>(x_i64.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:234:15
help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
|
LL | foo::<i8>(x_i32.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:236:15
help: you can convert an `i16` to an `i8` and panic if the converted value doesn't fit
|
LL | foo::<i8>(x_i16.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:242:16
help: you can cast a `usize` to an `f64`, producing the floating point representation of the integer,
| rounded if necessary
LL | foo::<f64>(x_usize as f64);
- | ~~~~~~~~~~~~~~
+ | ++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:244:16
help: you can cast a `u64` to an `f64`, producing the floating point representation of the integer,
| rounded if necessary
LL | foo::<f64>(x_u64 as f64);
- | ~~~~~~~~~~~~
+ | ++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:246:16
help: you can convert a `u32` to an `f64`, producing the floating point representation of the integer
|
LL | foo::<f64>(x_u32.into());
- | ~~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:248:16
help: you can convert a `u16` to an `f64`, producing the floating point representation of the integer
|
LL | foo::<f64>(x_u16.into());
- | ~~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:250:16
help: you can convert a `u8` to an `f64`, producing the floating point representation of the integer
|
LL | foo::<f64>(x_u8.into());
- | ~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:252:16
help: you can convert an `isize` to an `f64`, producing the floating point representation of the integer, rounded if necessary
|
LL | foo::<f64>(x_isize as f64);
- | ~~~~~~~~~~~~~~
+ | ++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:254:16
help: you can convert an `i64` to an `f64`, producing the floating point representation of the integer, rounded if necessary
|
LL | foo::<f64>(x_i64 as f64);
- | ~~~~~~~~~~~~
+ | ++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:256:16
help: you can convert an `i32` to an `f64`, producing the floating point representation of the integer
|
LL | foo::<f64>(x_i32.into());
- | ~~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:258:16
help: you can convert an `i16` to an `f64`, producing the floating point representation of the integer
|
LL | foo::<f64>(x_i16.into());
- | ~~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:260:16
help: you can convert an `i8` to an `f64`, producing the floating point representation of the integer
|
LL | foo::<f64>(x_i8.into());
- | ~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:263:16
|
LL | foo::<f64>(x_f32);
- | ^^^^^
- | |
- | expected `f64`, found `f32`
- | help: you can convert an `f32` to an `f64`: `x_f32.into()`
+ | ^^^^^ expected `f64`, found `f32`
+ |
+help: you can convert an `f32` to an `f64`
+ |
+LL | foo::<f64>(x_f32.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:266:16
help: you can cast a `usize` to an `f32`, producing the floating point representation of the integer,
| rounded if necessary
LL | foo::<f32>(x_usize as f32);
- | ~~~~~~~~~~~~~~
+ | ++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:268:16
help: you can cast a `u64` to an `f32`, producing the floating point representation of the integer,
| rounded if necessary
LL | foo::<f32>(x_u64 as f32);
- | ~~~~~~~~~~~~
+ | ++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:270:16
help: you can cast a `u32` to an `f32`, producing the floating point representation of the integer,
| rounded if necessary
LL | foo::<f32>(x_u32 as f32);
- | ~~~~~~~~~~~~
+ | ++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:272:16
help: you can convert a `u16` to an `f32`, producing the floating point representation of the integer
|
LL | foo::<f32>(x_u16.into());
- | ~~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:274:16
help: you can convert a `u8` to an `f32`, producing the floating point representation of the integer
|
LL | foo::<f32>(x_u8.into());
- | ~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:276:16
help: you can convert an `isize` to an `f32`, producing the floating point representation of the integer, rounded if necessary
|
LL | foo::<f32>(x_isize as f32);
- | ~~~~~~~~~~~~~~
+ | ++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:278:16
help: you can convert an `i64` to an `f32`, producing the floating point representation of the integer, rounded if necessary
|
LL | foo::<f32>(x_i64 as f32);
- | ~~~~~~~~~~~~
+ | ++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:280:16
help: you can convert an `i32` to an `f32`, producing the floating point representation of the integer, rounded if necessary
|
LL | foo::<f32>(x_i32 as f32);
- | ~~~~~~~~~~~~
+ | ++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:282:16
help: you can convert an `i16` to an `f32`, producing the floating point representation of the integer
|
LL | foo::<f32>(x_i16.into());
- | ~~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:284:16
help: you can convert an `i8` to an `f32`, producing the floating point representation of the integer
|
LL | foo::<f32>(x_i8.into());
- | ~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:289:16
|
LL | foo::<u32>(x_u8 as u16);
- | ^^^^^^^^^^^
- | |
- | expected `u32`, found `u16`
- | help: you can convert a `u16` to a `u32`: `(x_u8 as u16).into()`
+ | ^^^^^^^^^^^ expected `u32`, found `u16`
+ |
+help: you can convert a `u16` to a `u32`
+ |
+LL | foo::<u32>((x_u8 as u16).into());
+ | + ++++++++
error[E0308]: mismatched types
--> $DIR/numeric-cast.rs:291:16
|
LL | foo::<i32>(-x_i8);
- | ^^^^^
- | |
- | expected `i32`, found `i8`
- | help: you can convert an `i8` to an `i32`: `(-x_i8).into()`
+ | ^^^^^ expected `i32`, found `i8`
+ |
+help: you can convert an `i8` to an `i32`
+ |
+LL | foo::<i32>((-x_i8).into());
+ | + ++++++++
error: aborting due to 113 previous errors
help: change the type of the numeric literal from `u64` to `usize`
|
LL | foo::<usize>(42_usize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:9:18
help: change the type of the numeric literal from `u32` to `usize`
|
LL | foo::<usize>(42_usize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:11:18
help: change the type of the numeric literal from `u16` to `usize`
|
LL | foo::<usize>(42_usize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:13:18
help: change the type of the numeric literal from `u8` to `usize`
|
LL | foo::<usize>(42_usize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:15:18
help: change the type of the numeric literal from `isize` to `usize`
|
LL | foo::<usize>(42_usize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:17:18
help: change the type of the numeric literal from `i64` to `usize`
|
LL | foo::<usize>(42_usize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:19:18
help: change the type of the numeric literal from `i32` to `usize`
|
LL | foo::<usize>(42_usize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:21:18
help: change the type of the numeric literal from `i16` to `usize`
|
LL | foo::<usize>(42_usize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:23:18
help: change the type of the numeric literal from `i8` to `usize`
|
LL | foo::<usize>(42_usize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:25:18
help: change the type of the numeric literal from `f64` to `usize`
|
LL | foo::<usize>(42usize);
- | ~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:27:18
help: change the type of the numeric literal from `f32` to `usize`
|
LL | foo::<usize>(42usize);
- | ~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:30:18
help: change the type of the numeric literal from `usize` to `isize`
|
LL | foo::<isize>(42_isize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:32:18
help: change the type of the numeric literal from `u64` to `isize`
|
LL | foo::<isize>(42_isize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:34:18
help: change the type of the numeric literal from `u32` to `isize`
|
LL | foo::<isize>(42_isize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:36:18
help: change the type of the numeric literal from `u16` to `isize`
|
LL | foo::<isize>(42_isize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:38:18
help: change the type of the numeric literal from `u8` to `isize`
|
LL | foo::<isize>(42_isize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:41:18
help: change the type of the numeric literal from `i64` to `isize`
|
LL | foo::<isize>(42_isize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:43:18
help: change the type of the numeric literal from `i32` to `isize`
|
LL | foo::<isize>(42_isize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:45:18
help: change the type of the numeric literal from `i16` to `isize`
|
LL | foo::<isize>(42_isize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:47:18
help: change the type of the numeric literal from `i8` to `isize`
|
LL | foo::<isize>(42_isize);
- | ~~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:49:18
help: change the type of the numeric literal from `f64` to `isize`
|
LL | foo::<isize>(42isize);
- | ~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:51:18
help: change the type of the numeric literal from `f32` to `isize`
|
LL | foo::<isize>(42isize);
- | ~~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:54:16
help: change the type of the numeric literal from `usize` to `u64`
|
LL | foo::<u64>(42_u64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:57:16
help: change the type of the numeric literal from `u32` to `u64`
|
LL | foo::<u64>(42_u64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:59:16
help: change the type of the numeric literal from `u16` to `u64`
|
LL | foo::<u64>(42_u64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:61:16
help: change the type of the numeric literal from `u8` to `u64`
|
LL | foo::<u64>(42_u64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:63:16
help: change the type of the numeric literal from `isize` to `u64`
|
LL | foo::<u64>(42_u64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:65:16
help: change the type of the numeric literal from `i64` to `u64`
|
LL | foo::<u64>(42_u64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:67:16
help: change the type of the numeric literal from `i32` to `u64`
|
LL | foo::<u64>(42_u64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:69:16
help: change the type of the numeric literal from `i16` to `u64`
|
LL | foo::<u64>(42_u64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:71:16
help: change the type of the numeric literal from `i8` to `u64`
|
LL | foo::<u64>(42_u64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:73:16
help: change the type of the numeric literal from `f64` to `u64`
|
LL | foo::<u64>(42u64);
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:75:16
help: change the type of the numeric literal from `f32` to `u64`
|
LL | foo::<u64>(42u64);
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:78:16
help: change the type of the numeric literal from `usize` to `i64`
|
LL | foo::<i64>(42_i64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:80:16
help: change the type of the numeric literal from `u64` to `i64`
|
LL | foo::<i64>(42_i64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:82:16
help: change the type of the numeric literal from `u32` to `i64`
|
LL | foo::<i64>(42_i64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:84:16
help: change the type of the numeric literal from `u16` to `i64`
|
LL | foo::<i64>(42_i64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:86:16
help: change the type of the numeric literal from `u8` to `i64`
|
LL | foo::<i64>(42_i64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:88:16
help: change the type of the numeric literal from `isize` to `i64`
|
LL | foo::<i64>(42_i64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:91:16
help: change the type of the numeric literal from `i32` to `i64`
|
LL | foo::<i64>(42_i64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:93:16
help: change the type of the numeric literal from `i16` to `i64`
|
LL | foo::<i64>(42_i64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:95:16
help: change the type of the numeric literal from `i8` to `i64`
|
LL | foo::<i64>(42_i64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:97:16
help: change the type of the numeric literal from `f64` to `i64`
|
LL | foo::<i64>(42i64);
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:99:16
help: change the type of the numeric literal from `f32` to `i64`
|
LL | foo::<i64>(42i64);
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:102:16
help: change the type of the numeric literal from `usize` to `u32`
|
LL | foo::<u32>(42_u32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:104:16
help: change the type of the numeric literal from `u64` to `u32`
|
LL | foo::<u32>(42_u32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:107:16
help: change the type of the numeric literal from `u16` to `u32`
|
LL | foo::<u32>(42_u32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:109:16
help: change the type of the numeric literal from `u8` to `u32`
|
LL | foo::<u32>(42_u32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:111:16
help: change the type of the numeric literal from `isize` to `u32`
|
LL | foo::<u32>(42_u32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:113:16
help: change the type of the numeric literal from `i64` to `u32`
|
LL | foo::<u32>(42_u32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:115:16
help: change the type of the numeric literal from `i32` to `u32`
|
LL | foo::<u32>(42_u32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:117:16
help: change the type of the numeric literal from `i16` to `u32`
|
LL | foo::<u32>(42_u32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:119:16
help: change the type of the numeric literal from `i8` to `u32`
|
LL | foo::<u32>(42_u32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:121:16
help: change the type of the numeric literal from `f64` to `u32`
|
LL | foo::<u32>(42u32);
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:123:16
help: change the type of the numeric literal from `f32` to `u32`
|
LL | foo::<u32>(42u32);
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:126:16
help: change the type of the numeric literal from `usize` to `i32`
|
LL | foo::<i32>(42_i32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:128:16
help: change the type of the numeric literal from `u64` to `i32`
|
LL | foo::<i32>(42_i32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:130:16
help: change the type of the numeric literal from `u32` to `i32`
|
LL | foo::<i32>(42_i32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:132:16
help: change the type of the numeric literal from `u16` to `i32`
|
LL | foo::<i32>(42_i32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:134:16
help: change the type of the numeric literal from `u8` to `i32`
|
LL | foo::<i32>(42_i32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:136:16
help: change the type of the numeric literal from `isize` to `i32`
|
LL | foo::<i32>(42_i32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:138:16
help: change the type of the numeric literal from `i64` to `i32`
|
LL | foo::<i32>(42_i32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:141:16
help: change the type of the numeric literal from `i16` to `i32`
|
LL | foo::<i32>(42_i32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:143:16
help: change the type of the numeric literal from `i8` to `i32`
|
LL | foo::<i32>(42_i32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:145:16
help: change the type of the numeric literal from `f64` to `i32`
|
LL | foo::<i32>(42i32);
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:147:16
help: change the type of the numeric literal from `f32` to `i32`
|
LL | foo::<i32>(42i32);
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:150:16
help: change the type of the numeric literal from `usize` to `u16`
|
LL | foo::<u16>(42_u16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:152:16
help: change the type of the numeric literal from `u64` to `u16`
|
LL | foo::<u16>(42_u16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:154:16
help: change the type of the numeric literal from `u32` to `u16`
|
LL | foo::<u16>(42_u16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:157:16
help: change the type of the numeric literal from `u8` to `u16`
|
LL | foo::<u16>(42_u16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:159:16
help: change the type of the numeric literal from `isize` to `u16`
|
LL | foo::<u16>(42_u16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:161:16
help: change the type of the numeric literal from `i64` to `u16`
|
LL | foo::<u16>(42_u16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:163:16
help: change the type of the numeric literal from `i32` to `u16`
|
LL | foo::<u16>(42_u16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:165:16
help: change the type of the numeric literal from `i16` to `u16`
|
LL | foo::<u16>(42_u16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:167:16
help: change the type of the numeric literal from `i8` to `u16`
|
LL | foo::<u16>(42_u16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:169:16
help: change the type of the numeric literal from `f64` to `u16`
|
LL | foo::<u16>(42u16);
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:171:16
help: change the type of the numeric literal from `f32` to `u16`
|
LL | foo::<u16>(42u16);
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:174:16
help: change the type of the numeric literal from `usize` to `i16`
|
LL | foo::<i16>(42_i16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:176:16
help: change the type of the numeric literal from `u64` to `i16`
|
LL | foo::<i16>(42_i16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:178:16
help: change the type of the numeric literal from `u32` to `i16`
|
LL | foo::<i16>(42_i16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:180:16
help: change the type of the numeric literal from `u16` to `i16`
|
LL | foo::<i16>(42_i16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:182:16
help: change the type of the numeric literal from `u8` to `i16`
|
LL | foo::<i16>(42_i16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:184:16
help: change the type of the numeric literal from `isize` to `i16`
|
LL | foo::<i16>(42_i16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:186:16
help: change the type of the numeric literal from `i64` to `i16`
|
LL | foo::<i16>(42_i16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:188:16
help: change the type of the numeric literal from `i32` to `i16`
|
LL | foo::<i16>(42_i16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:191:16
help: change the type of the numeric literal from `i8` to `i16`
|
LL | foo::<i16>(42_i16);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:193:16
help: change the type of the numeric literal from `f64` to `i16`
|
LL | foo::<i16>(42i16);
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:195:16
help: change the type of the numeric literal from `f32` to `i16`
|
LL | foo::<i16>(42i16);
- | ~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:198:15
help: change the type of the numeric literal from `usize` to `u8`
|
LL | foo::<u8>(42_u8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:200:15
help: change the type of the numeric literal from `u64` to `u8`
|
LL | foo::<u8>(42_u8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:202:15
help: change the type of the numeric literal from `u32` to `u8`
|
LL | foo::<u8>(42_u8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:204:15
help: change the type of the numeric literal from `u16` to `u8`
|
LL | foo::<u8>(42_u8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:207:15
help: change the type of the numeric literal from `isize` to `u8`
|
LL | foo::<u8>(42_u8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:209:15
help: change the type of the numeric literal from `i64` to `u8`
|
LL | foo::<u8>(42_u8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:211:15
help: change the type of the numeric literal from `i32` to `u8`
|
LL | foo::<u8>(42_u8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:213:15
help: change the type of the numeric literal from `i16` to `u8`
|
LL | foo::<u8>(42_u8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:215:15
help: change the type of the numeric literal from `i8` to `u8`
|
LL | foo::<u8>(42_u8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:217:15
help: change the type of the numeric literal from `f64` to `u8`
|
LL | foo::<u8>(42u8);
- | ~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:219:15
help: change the type of the numeric literal from `f32` to `u8`
|
LL | foo::<u8>(42u8);
- | ~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:222:15
help: change the type of the numeric literal from `usize` to `i8`
|
LL | foo::<i8>(42_i8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:224:15
help: change the type of the numeric literal from `u64` to `i8`
|
LL | foo::<i8>(42_i8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:226:15
help: change the type of the numeric literal from `u32` to `i8`
|
LL | foo::<i8>(42_i8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:228:15
help: change the type of the numeric literal from `u16` to `i8`
|
LL | foo::<i8>(42_i8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:230:15
help: change the type of the numeric literal from `u8` to `i8`
|
LL | foo::<i8>(42_i8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:232:15
help: change the type of the numeric literal from `isize` to `i8`
|
LL | foo::<i8>(42_i8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:234:15
help: change the type of the numeric literal from `i64` to `i8`
|
LL | foo::<i8>(42_i8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:236:15
help: change the type of the numeric literal from `i32` to `i8`
|
LL | foo::<i8>(42_i8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:238:15
help: change the type of the numeric literal from `i16` to `i8`
|
LL | foo::<i8>(42_i8);
- | ~~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:241:15
help: change the type of the numeric literal from `f64` to `i8`
|
LL | foo::<i8>(42i8);
- | ~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:243:15
help: change the type of the numeric literal from `f32` to `i8`
|
LL | foo::<i8>(42i8);
- | ~~~~
+ | ~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:246:16
help: change the type of the numeric literal from `usize` to `f64`
|
LL | foo::<f64>(42_f64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:248:16
help: change the type of the numeric literal from `u64` to `f64`
|
LL | foo::<f64>(42_f64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:250:16
help: you can convert a `u32` to an `f64`, producing the floating point representation of the integer
|
LL | foo::<f64>(42_u32.into());
- | ~~~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:252:16
help: you can convert a `u16` to an `f64`, producing the floating point representation of the integer
|
LL | foo::<f64>(42_u16.into());
- | ~~~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:254:16
help: you can convert a `u8` to an `f64`, producing the floating point representation of the integer
|
LL | foo::<f64>(42_u8.into());
- | ~~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:256:16
help: change the type of the numeric literal from `isize` to `f64`
|
LL | foo::<f64>(42_f64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:258:16
help: change the type of the numeric literal from `i64` to `f64`
|
LL | foo::<f64>(42_f64);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:260:16
help: you can convert an `i32` to an `f64`, producing the floating point representation of the integer
|
LL | foo::<f64>(42_i32.into());
- | ~~~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:262:16
help: you can convert an `i16` to an `f64`, producing the floating point representation of the integer
|
LL | foo::<f64>(42_i16.into());
- | ~~~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:264:16
help: you can convert an `i8` to an `f64`, producing the floating point representation of the integer
|
LL | foo::<f64>(42_i8.into());
- | ~~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:267:16
help: change the type of the numeric literal from `f32` to `f64`
|
LL | foo::<f64>(42.0_f64);
- | ~~~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:270:16
help: change the type of the numeric literal from `usize` to `f32`
|
LL | foo::<f32>(42_f32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:272:16
help: change the type of the numeric literal from `u64` to `f32`
|
LL | foo::<f32>(42_f32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:274:16
help: change the type of the numeric literal from `u32` to `f32`
|
LL | foo::<f32>(42_f32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:276:16
help: you can convert a `u16` to an `f32`, producing the floating point representation of the integer
|
LL | foo::<f32>(42_u16.into());
- | ~~~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:278:16
help: you can convert a `u8` to an `f32`, producing the floating point representation of the integer
|
LL | foo::<f32>(42_u8.into());
- | ~~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:280:16
help: change the type of the numeric literal from `isize` to `f32`
|
LL | foo::<f32>(42_f32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:282:16
help: change the type of the numeric literal from `i64` to `f32`
|
LL | foo::<f32>(42_f32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:284:16
help: change the type of the numeric literal from `i32` to `f32`
|
LL | foo::<f32>(42_f32);
- | ~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:286:16
help: you can convert an `i16` to an `f32`, producing the floating point representation of the integer
|
LL | foo::<f32>(42_i16.into());
- | ~~~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:288:16
help: you can convert an `i8` to an `f32`, producing the floating point representation of the integer
|
LL | foo::<f32>(42_i8.into());
- | ~~~~~~~~~~~~
+ | +++++++
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:290:16
help: change the type of the numeric literal from `f64` to `f32`
|
LL | foo::<f32>(42.0_f32);
- | ~~~~~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:294:16
|
LL | foo::<u32>(42_u8 as u16);
- | ^^^^^^^^^^^^
- | |
- | expected `u32`, found `u16`
- | help: you can convert a `u16` to a `u32`: `(42_u8 as u16).into()`
+ | ^^^^^^^^^^^^ expected `u32`, found `u16`
+ |
+help: you can convert a `u16` to a `u32`
+ |
+LL | foo::<u32>((42_u8 as u16).into());
+ | + ++++++++
error[E0308]: mismatched types
--> $DIR/numeric-suffix.rs:296:16
|
LL | foo::<i32>(-42_i8);
- | ^^^^^^
- | |
- | expected `i32`, found `i8`
- | help: you can convert an `i8` to an `i32`: `(-42_i8).into()`
+ | ^^^^^^ expected `i32`, found `i8`
+ |
+help: you can convert an `i8` to an `i32`
+ |
+LL | foo::<i32>((-42_i8).into());
+ | + ++++++++
error: aborting due to 134 previous errors
// run-pass
+#![allow(dead_code)]
+
use std::rc::Rc;
use std::ops::Deref;
}) > 0 //~ ERROR expected expression
}
+fn qux() -> u32 {
+ ({2}) - 2 //~ ERROR cannot apply unary operator `-` to type `u32`
+ //~^ ERROR mismatched types
+}
+
fn main() {}
} > 0 //~ ERROR expected expression
}
+fn qux() -> u32 {
+ {2} - 2 //~ ERROR cannot apply unary operator `-` to type `u32`
+ //~^ ERROR mismatched types
+}
+
fn main() {}
LL | ({ 3 }) * 3
| + +
-error: aborting due to 9 previous errors
+error[E0308]: mismatched types
+ --> $DIR/expr-as-stmt.rs:36:6
+ |
+LL | {2} - 2
+ | ^ expected `()`, found integer
+ |
+help: you might have meant to return this value
+ |
+LL | {return 2;} - 2
+ | ++++++ +
+
+error[E0600]: cannot apply unary operator `-` to type `u32`
+ --> $DIR/expr-as-stmt.rs:36:9
+ |
+LL | {2} - 2
+ | ^^^ cannot apply unary operator `-`
+ |
+help: parentheses are required to parse this as an expression
+ |
+LL | ({2}) - 2
+ | + +
+
+error: aborting due to 11 previous errors
-Some errors have detailed explanations: E0308, E0614.
+Some errors have detailed explanations: E0308, E0600, E0614.
For more information about an error, try `rustc --explain E0308`.
help: if this is a `self` type, give it a parameter name
|
LL | fn fizz(self: i32) {}
- | ~~~~~~~~~
+ | +++++
help: if this is a parameter name, give it a type
|
LL | fn fizz(i32: TypeName) {}
- | ~~~~~~~~~~~~~
+ | ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn fizz(_: i32) {}
- | ~~~~~~
+ | ++
error: expected one of `:`, `@`, or `|`, found `S`
--> $DIR/inverted-parameters.rs:27:23
--- /dev/null
+// Regression test for #88818 (improve error message for missing trait
+// in `impl for X`).
+
+struct S { }
+impl for S { }
+//~^ ERROR: missing trait in a trait impl
+//~| HELP: add a trait here
+//~| HELP: for an inherent impl, drop this `for`
+
+fn main() {}
--- /dev/null
+error: missing trait in a trait impl
+ --> $DIR/issue-88818.rs:5:5
+ |
+LL | impl for S { }
+ | ^
+ |
+help: add a trait here
+ |
+LL | impl Trait for S { }
+ | +++++
+help: for an inherent impl, drop this `for`
+ |
+LL - impl for S { }
+LL + impl S { }
+ |
+
+error: aborting due to previous error
+
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
help: if this is a `self` type, give it a parameter name
|
-LL | fn test(self: &str) {
- | ~~~~~~~~~~
+LL | fn test(self: &'a str) {
+ | +++++
help: if this is a parameter name, give it a type
|
LL | fn test(str: &TypeName) {
| ~~~~~~~~~~~~~~
help: if this is a type, explicitly ignore the parameter name
|
-LL | fn test(_: &str) {
- | ~~~~~~~
+LL | fn test(_: &'a str) {
+ | ++
error: aborting due to 2 previous errors
help: if this is a `self` type, give it a parameter name
|
LL | fn foo(self: x) {
- | ~~~~~~~
+ | +++++
help: if this is a parameter name, give it a type
|
LL | fn foo(x: TypeName) {
- | ~~~~~~~~~~~
+ | ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn foo(_: x) {
- | ~~~~
+ | ++
error: aborting due to previous error
help: if this is a `self` type, give it a parameter name
|
LL | fn a(self: B<) {}
- | ~~~~~~~
+ | +++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn a(_: B<) {}
- | ~~~~
+ | ++
error: aborting due to previous error
--> $DIR/path-lookahead.rs:10:12
|
LL | return (<T as ToString>::to_string(&arg));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
+ | ^ ^
|
note: the lint level is defined here
--> $DIR/path-lookahead.rs:5:9
|
LL | #![warn(unused_parens)]
| ^^^^^^^^^^^^^
+help: remove these parentheses
+ |
+LL - return (<T as ToString>::to_string(&arg));
+LL + return <T as ToString>::to_string(&arg);
+ |
warning: 1 warning emitted
help: change the type of the numeric literal from `i32` to `u32`
|
LL | let_in(3u32, |i| { assert!(i == 3u32); });
- | ~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/pptypedef.rs:8:37
help: change the type of the numeric literal from `u32` to `i32`
|
LL | let_in(3i32, |i| { assert!(i == 3i32); });
- | ~~~~
+ | ~~~
error: aborting due to 2 previous errors
help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
|
LL | Some(x) => { return x.try_into().unwrap() },
- | ~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/span-preservation.rs:33:22
help: change the type of the numeric literal from `u8` to `usize`
|
LL | let f = [0; 4usize];
- | ~~~~~~
+ | ~~~~~
error[E0308]: mismatched types
--> $DIR/repeat_count.rs:31:17
help: if this is a `self` type, give it a parameter name
|
LL | trait Trait2015 { fn foo(#[allow(C)] self: i32); }
- | ~~~~~~~~~
+ | +++++
help: if this is a parameter name, give it a type
|
LL | trait Trait2015 { fn foo(#[allow(C)] i32: TypeName); }
- | ~~~~~~~~~~~~~
+ | ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | trait Trait2015 { fn foo(#[allow(C)] _: i32); }
- | ~~~~~~
+ | ++
error: aborting due to previous error
// This duplicate bound should not result in ambiguities. It should be equivalent to a single ~const
// bound.
-// const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
-// FIXME(fee1-dead)^ why should the order matter here?
-const fn equals_self<T: ~const PartialEq + PartialEq>(t: &T) -> bool {
+const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
*t == *t
}
-pub const EQ: bool = equals_self(&S);
+trait A: PartialEq {}
+impl<T: PartialEq> A for T {}
+
+const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
+ *t == *t
+}
+
+pub const EQ: bool = equals_self(&S) && equals_self2(&S);
fn main() {}
// run-pass
#![feature(box_syntax)]
+#![allow(dead_code)]
#[derive(Copy, Clone)]
struct Foo {
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
LL | let _: i32 = (22_i64 >> 1_i32).try_into().unwrap();
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | + +++++++++++++++++++++
error: aborting due to 4 previous errors
help: if this is a `self` type, give it a parameter name
|
LL | fn foo(self: Option<i32>, String) {}
- | ~~~~~~~~~~~~
+ | +++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn foo(_: Option<i32>, String) {}
- | ~~~~~~~~~
+ | ++
error: expected one of `:`, `@`, or `|`, found `)`
--> $DIR/issue-34264.rs:1:27
help: if this is a parameter name, give it a type
|
LL | fn foo(Option<i32>, String: TypeName) {}
- | ~~~~~~~~~~~~~~~~
+ | ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn foo(Option<i32>, _: String) {}
- | ~~~~~~~~~
+ | ++
error: expected one of `:`, `@`, or `|`, found `,`
--> $DIR/issue-34264.rs:3:9
help: if this is a `self` type, give it a parameter name
|
LL | fn bar(self: x, y: usize) {}
- | ~~~~~~~
+ | +++++
help: if this is a parameter name, give it a type
|
LL | fn bar(x: TypeName, y: usize) {}
- | ~~~~~~~~~~~
+ | ++++++++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn bar(_: x, y: usize) {}
- | ~~~~
+ | ++
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/issue-34264.rs:7:5
// run-pass
#![allow(non_camel_case_types)]
+#![allow(dead_code)]
trait noisy {
fn speak(&mut self) -> isize;
// run-pass
#![allow(non_camel_case_types)]
+#![allow(dead_code)]
trait noisy {
fn speak(&mut self);
// run-pass
+
+#![allow(dead_code)]
+
#[derive(Debug)]
struct Foo {
x: isize,
// run-pass
#![allow(non_camel_case_types)]
+#![allow(dead_code)]
#[derive(Debug)]
enum a_tag {
help: if this is a `self` type, give it a parameter name
|
LL | pub fn foo(self: Box<Self>) { }
- | ~~~~~~~~~
+ | +++++
help: if this is a type, explicitly ignore the parameter name
|
LL | pub fn foo(_: Box<Self>) { }
- | ~~~~~~
+ | ++
error: expected one of `:`, `@`, or `|`, found `<`
--> $DIR/issue-64252-self-type.rs:10:15
help: if this is a `self` type, give it a parameter name
|
LL | fn bar(self: Box<Self>) { }
- | ~~~~~~~~~
+ | +++++
help: if this is a type, explicitly ignore the parameter name
|
LL | fn bar(_: Box<Self>) { }
- | ~~~~~~
+ | ++
error: aborting due to 2 previous errors
--- /dev/null
+fn main() {
+ let v = vec![1i32, 2, 3];
+ for _ in v[1..] {
+ //~^ ERROR [i32]` is not an iterator [E0277]
+ //~^^ ERROR known at compilation time
+ }
+ struct K {
+ n: i32,
+ }
+ let mut v2 = vec![K { n: 1 }, K { n: 1 }, K { n: 1 }];
+ for i2 in v2[1..] {
+ //~^ ERROR [K]` is not an iterator [E0277]
+ //~^^ ERROR known at compilation time
+ i2.n = 2;
+ }
+}
--- /dev/null
+error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
+ --> $DIR/slice-issue-87994.rs:3:12
+ |
+LL | for _ in v[1..] {
+ | ^^^^^^
+ | |
+ | expected an implementor of trait `IntoIterator`
+ | help: consider borrowing here: `&v[1..]`
+ |
+ = note: the trait bound `[i32]: IntoIterator` is not satisfied
+ = note: required because of the requirements on the impl of `IntoIterator` for `[i32]`
+note: required by `into_iter`
+ --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+ |
+LL | fn into_iter(self) -> Self::IntoIter;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `[i32]` is not an iterator
+ --> $DIR/slice-issue-87994.rs:3:12
+ |
+LL | for _ in v[1..] {
+ | ^^^^^^
+ | |
+ | expected an implementor of trait `IntoIterator`
+ | help: consider borrowing here: `&v[1..]`
+ |
+ = note: the trait bound `[i32]: IntoIterator` is not satisfied
+ = note: required because of the requirements on the impl of `IntoIterator` for `[i32]`
+note: required by `into_iter`
+ --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+ |
+LL | fn into_iter(self) -> Self::IntoIter;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the size for values of type `[K]` cannot be known at compilation time
+ --> $DIR/slice-issue-87994.rs:11:13
+ |
+LL | for i2 in v2[1..] {
+ | ^^^^^^^
+ | |
+ | expected an implementor of trait `IntoIterator`
+ | help: consider borrowing here: `&v2[1..]`
+ |
+ = note: the trait bound `[K]: IntoIterator` is not satisfied
+ = note: required because of the requirements on the impl of `IntoIterator` for `[K]`
+note: required by `into_iter`
+ --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+ |
+LL | fn into_iter(self) -> Self::IntoIter;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `[K]` is not an iterator
+ --> $DIR/slice-issue-87994.rs:11:13
+ |
+LL | for i2 in v2[1..] {
+ | ^^^^^^^
+ | |
+ | expected an implementor of trait `IntoIterator`
+ | help: consider borrowing here: `&v2[1..]`
+ |
+ = note: the trait bound `[K]: IntoIterator` is not satisfied
+ = note: required because of the requirements on the impl of `IntoIterator` for `[K]`
+note: required by `into_iter`
+ --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+ |
+LL | fn into_iter(self) -> Self::IntoIter;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
--> $DIR/type-mismatch-struct-field-shorthand-2.rs:5:19
|
LL | let _ = RGB { r, g, c };
- | ^
- | |
- | expected `f64`, found `f32`
- | help: you can convert an `f32` to an `f64`: `r: r.into()`
+ | ^ expected `f64`, found `f32`
+ |
+help: you can convert an `f32` to an `f64`
+ |
+LL | let _ = RGB { r: r.into(), g, c };
+ | ++ +++++++
error[E0308]: mismatched types
--> $DIR/type-mismatch-struct-field-shorthand-2.rs:5:22
|
LL | let _ = RGB { r, g, c };
- | ^
- | |
- | expected `f64`, found `f32`
- | help: you can convert an `f32` to an `f64`: `g: g.into()`
+ | ^ expected `f64`, found `f32`
+ |
+help: you can convert an `f32` to an `f64`
+ |
+LL | let _ = RGB { r, g: g.into(), c };
+ | ++ +++++++
error[E0560]: struct `RGB` has no field named `c`
--> $DIR/type-mismatch-struct-field-shorthand-2.rs:5:25
--> $DIR/type-mismatch-struct-field-shorthand.rs:8:19
|
LL | let _ = RGB { r, g, b };
- | ^
- | |
- | expected `f64`, found `f32`
- | help: you can convert an `f32` to an `f64`: `r: r.into()`
+ | ^ expected `f64`, found `f32`
+ |
+help: you can convert an `f32` to an `f64`
+ |
+LL | let _ = RGB { r: r.into(), g, b };
+ | ++ +++++++
error[E0308]: mismatched types
--> $DIR/type-mismatch-struct-field-shorthand.rs:8:22
|
LL | let _ = RGB { r, g, b };
- | ^
- | |
- | expected `f64`, found `f32`
- | help: you can convert an `f32` to an `f64`: `g: g.into()`
+ | ^ expected `f64`, found `f32`
+ |
+help: you can convert an `f32` to an `f64`
+ |
+LL | let _ = RGB { r, g: g.into(), b };
+ | ++ +++++++
error[E0308]: mismatched types
--> $DIR/type-mismatch-struct-field-shorthand.rs:8:25
|
LL | let _ = RGB { r, g, b };
- | ^
- | |
- | expected `f64`, found `f32`
- | help: you can convert an `f32` to an `f64`: `b: b.into()`
+ | ^ expected `f64`, found `f32`
+ |
+help: you can convert an `f32` to an `f64`
+ |
+LL | let _ = RGB { r, g, b: b.into() };
+ | ++ +++++++
error: aborting due to 3 previous errors
help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
|
LL | fn f() -> isize { return g().try_into().unwrap(); }
- | ~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error: aborting due to previous error
help: change the type of the numeric literal from `i32` to `u32`
|
LL | test(22i32, 44u32);
- | ~~~~~
+ | ~~~
error: aborting due to previous error
help: you can convert an `i32` to a `u8` and panic if the converted value doesn't fit
|
LL | B::get_x().try_into().unwrap()
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error: aborting due to previous error
--> $DIR/try-block-unused-delims.rs:11:13
|
LL | consume((try {}));
- | ^^^^^^^^ help: remove these parentheses
+ | ^ ^
|
note: the lint level is defined here
--> $DIR/try-block-unused-delims.rs:6:9
|
LL | #![warn(unused_parens, unused_braces)]
| ^^^^^^^^^^^^^
+help: remove these parentheses
+ |
+LL - consume((try {}));
+LL + consume(try {});
+ |
warning: unnecessary braces around function argument
--> $DIR/try-block-unused-delims.rs:14:13
|
LL | consume({ try {} });
- | ^^^^^^^^^^ help: remove these braces
+ | ^^ ^^
|
note: the lint level is defined here
--> $DIR/try-block-unused-delims.rs:6:24
|
LL | #![warn(unused_parens, unused_braces)]
| ^^^^^^^^^^^^^
+help: remove these braces
+ |
+LL - consume({ try {} });
+LL + consume(try {});
+ |
warning: unnecessary parentheses around `match` scrutinee expression
--> $DIR/try-block-unused-delims.rs:17:11
|
LL | match (try {}) {
- | ^^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - match (try {}) {
+LL + match try {} {
+ |
warning: unnecessary parentheses around `let` scrutinee expression
--> $DIR/try-block-unused-delims.rs:22:22
|
LL | if let Err(()) = (try {}) {}
- | ^^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - if let Err(()) = (try {}) {}
+LL + if let Err(()) = try {} {}
+ |
warning: unnecessary parentheses around `match` scrutinee expression
--> $DIR/try-block-unused-delims.rs:25:11
|
LL | match (try {}) {
- | ^^^^^^^^ help: remove these parentheses
+ | ^ ^
+ |
+help: remove these parentheses
+ |
+LL - match (try {}) {
+LL + match try {} {
+ |
warning: 5 warnings emitted
--> $DIR/tutorial-suffix-inference-test.rs:9:18
|
LL | identity_u16(x);
- | ^
- | |
- | expected `u16`, found `u8`
- | help: you can convert a `u8` to a `u16`: `x.into()`
+ | ^ expected `u16`, found `u8`
+ |
+help: you can convert a `u8` to a `u16`
+ |
+LL | identity_u16(x.into());
+ | +++++++
error[E0308]: mismatched types
--> $DIR/tutorial-suffix-inference-test.rs:12:18
help: you can convert an `i32` to a `u16` and panic if the converted value doesn't fit
|
LL | identity_u16(y.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/tutorial-suffix-inference-test.rs:21:18
help: you can convert an `isize` to a `u16` and panic if the converted value doesn't fit
|
LL | identity_u16(a.try_into().unwrap());
- | ~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error: aborting due to 3 previous errors
--- /dev/null
+macro_rules! many_args {
+ ([$($t:tt)*]#$($h:tt)*) => {
+ many_args!{[$($t)*$($t)*]$($h)*}
+ };
+ ([$($t:tt)*]) => {
+ fn _f($($t: ()),*) {} //~ ERROR function can not have more than 65535 arguments
+ }
+}
+
+many_args!{[_]########## ######}
+
+fn main() {}
--- /dev/null
+error: function can not have more than 65535 arguments
+ --> $DIR/issue-88577-check-fn-with-more-than-65535-arguments.rs:6:24
+ |
+LL | fn _f($($t: ()),*) {}
+ | ________________________^
+LL | | }
+LL | | }
+LL | |
+LL | | many_args!{[_]########## ######}
+ | |____________^
+
+error: aborting due to previous error
+
help: change the type of the numeric literal from `i8` to `u8`
|
LL | let b: typeof(a) = 1u8;
- | ~~~
+ | ~~
error: aborting due to 2 previous errors
help: change the type of the numeric literal from `u32` to `i32`
|
LL | <i32 as Add<i32>>::add(1i32, 2);
- | ~~~~
+ | ~~~
error[E0308]: mismatched types
--> $DIR/ufcs-qpath-self-mismatch.rs:8:31
help: change the type of the numeric literal from `u32` to `i32`
|
LL | <i32 as Add<i32>>::add(1, 2i32);
- | ~~~~
+ | ~~~
error: aborting due to 3 previous errors
help: change the type of the numeric literal from `usize` to `isize`
|
LL | let z = f(1_isize, 2);
- | ~~~~~~~
+ | ~~~~~
error: aborting due to previous error
help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
|
LL | fn mk_int() -> usize { let i: isize = 3; return i.try_into().unwrap(); }
- | ~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++
error: aborting due to previous error
-Subproject commit 18751dd3f238d94d384a7fe967abfac06cbfe0b9
+Subproject commit e515c3277bf0681bfc79a9e763861bfe26bb05db
path = "src/driver.rs"
[dependencies]
-# begin automatic update
-clippy_lints = { version = "0.1.50", path = "clippy_lints" }
-# end automatic update
+clippy_lints = { version = "0.1", path = "clippy_lints" }
semver = "0.11"
-rustc_tools_util = { version = "0.2.0", path = "rustc_tools_util" }
-tempfile = { version = "3.1.0", optional = true }
+rustc_tools_util = { version = "0.2", path = "rustc_tools_util" }
+tempfile = { version = "3.2", optional = true }
[dev-dependencies]
cargo_metadata = "0.12"
-compiletest_rs = { version = "0.6.0", features = ["tmp"] }
+compiletest_rs = { version = "0.7", features = ["tmp"] }
tester = "0.9"
-regex = "1.4"
+regex = "1.5"
# This is used by the `collect-metadata` alias.
filetime = "0.2"
# A noop dependency that changes in the Rust repository, it's a bit of a hack.
# See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust`
# for more information.
-rustc-workspace-hack = "1.0.0"
+rustc-workspace-hack = "1.0"
# UI test dependencies
clippy_utils = { path = "clippy_utils" }
derive-new = "0.5"
if_chain = "1.0"
-itertools = "0.10.1"
-quote = "1"
+itertools = "0.10"
+quote = "1.0"
serde = { version = "1.0", features = ["derive"] }
-syn = { version = "1", features = ["full"] }
+syn = { version = "1.0", features = ["full"] }
[build-dependencies]
-rustc_tools_util = { version = "0.2.0", path = "rustc_tools_util" }
+rustc_tools_util = { version = "0.2", path = "rustc_tools_util" }
[features]
deny-warnings = ["clippy_lints/deny-warnings"]
[dependencies]
bytecount = "0.6"
clap = "2.33"
-itertools = "0.9"
+itertools = "0.10"
opener = "0.5"
-regex = "1"
+regex = "1.5"
shell-escape = "0.1"
-walkdir = "2"
+walkdir = "2.3"
[features]
deny-warnings = []
categories = ["development-tools", "development-tools::cargo-plugins"]
[build-dependencies]
-term = "0.6"
+term = "0.7"
[dependencies]
cargo_metadata = "0.12"
clippy_utils = { path = "../clippy_utils" }
-if_chain = "1.0.0"
-itertools = "0.9"
+if_chain = "1.0"
+itertools = "0.10"
pulldown-cmark = { version = "0.8", default-features = false }
-quine-mc_cluskey = "0.2.2"
+quine-mc_cluskey = "0.2"
regex-syntax = "0.6"
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", optional = true }
-toml = "0.5.3"
+toml = "0.5"
unicode-normalization = "0.1"
-unicode-script = { version = "0.5.3", default-features = false }
+unicode-script = { version = "0.5", default-features = false }
semver = "0.11"
-rustc-semver = "1.1.0"
+rustc-semver = "1.1"
# NOTE: cargo requires serde feat in its url dep
# see <https://github.com/rust-lang/rust/pull/63587#issuecomment-522343864>
-url = { version = "2.1.0", features = ["serde"] }
+url = { version = "2.2", features = ["serde"] }
[features]
deny-warnings = ["clippy_utils/deny-warnings"]
return;
}
- let begin_of_attr_to_item = Span::new(attr.span.lo(), item.span.lo(), item.span.ctxt());
- let end_of_attr_to_item = Span::new(attr.span.hi(), 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(), item.span.parent());
if let Some(snippet) = snippet_opt(cx, end_of_attr_to_item) {
let lines = snippet.split('\n').collect::<Vec<_>>();
//! lint on missing cargo common metadata
-use std::path::PathBuf;
-
use clippy_utils::{diagnostics::span_lint, is_lint_allowed};
use rustc_hir::{hir_id::CRATE_HIR_ID, Crate};
use rustc_lint::{LateContext, LateLintPass};
span_lint(cx, CARGO_COMMON_METADATA, DUMMY_SP, &message);
}
-fn is_empty_str(value: &Option<String>) -> bool {
- value.as_ref().map_or(true, String::is_empty)
-}
-
-fn is_empty_path(value: &Option<PathBuf>) -> bool {
- value.as_ref().and_then(|x| x.to_str()).map_or(true, str::is_empty)
+fn is_empty_str<T: AsRef<std::ffi::OsStr>>(value: &Option<T>) -> bool {
+ value.as_ref().map_or(true, |s| s.as_ref().is_empty())
}
fn is_empty_vec(value: &[String]) -> bool {
missing_warning(cx, &package, "package.description");
}
- if is_empty_str(&package.license) && is_empty_path(&package.license_file) {
+ if is_empty_str(&package.license) && is_empty_str(&package.license_file) {
missing_warning(cx, &package, "either package.license or package.license_file");
}
missing_warning(cx, &package, "package.repository");
}
- if is_empty_path(&package.readme) {
+ if is_empty_str(&package.readme) {
missing_warning(cx, &package, "package.readme");
}
});
if let Some((low, high)) = pos {
- Span::new(low, high, header_span.ctxt())
+ Span::new(low, high, header_span.ctxt(), header_span.parent())
} else {
return;
}
let mut span = moved_start.to(span_end);
// 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)
.map(|snip| snip == " ")
.unwrap_or_default()
span.lo() + BytePos::from_usize(offset),
span.lo() + BytePos::from_usize(offset + word.len()),
span.ctxt(),
+ span.parent(),
);
check_word(cx, word, 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)));
if let Some(pos) = pos {
- Span::new(pos, pos, item.span.data().ctxt)
+ Span::new(pos, pos, item.span.ctxt(), item.span.parent())
} else {
return;
}
Some(item.span.lo() + BytePos((i + (&snip[i..]).find('(')?) as u32))
})
.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);
hi_pos - BytePos::from_usize("const".len()),
hi_pos,
item.span.ctxt(),
+ item.span.parent(),
);
span_lint_and_then(
cx,
pat: &'tcx Pat<'_>,
arg: &'tcx Expr<'_>,
body: &'tcx Expr<'_>,
- expr: &'tcx Expr<'_>,
) {
let pat_span = pat.span;
span_lint_and_then(
cx,
FOR_KV_MAP,
- expr.span,
+ arg_span,
&format!("you seem to want to iterate on a map's {}s", kind),
|diag| {
let map = sugg::Sugg::hir(cx, arg, "map");
use rustc_lint::LateContext;
use rustc_span::sym;
-pub(super) fn check(cx: &LateContext<'_>, arg: &Expr<'_>, expr: &Expr<'_>) -> bool {
+pub(super) fn check(cx: &LateContext<'_>, arg: &Expr<'_>) -> bool {
if is_trait_method(cx, arg, sym::Iterator) {
span_lint(
cx,
ITER_NEXT_LOOP,
- expr.span,
+ arg.span,
"you are iterating over `Iterator::next()` which is an Option; this will compile but is \
probably not what you want",
);
needless_range_loop::check(cx, pat, arg, body, expr);
explicit_counter_loop::check(cx, pat, arg, body, expr);
}
- check_for_loop_arg(cx, pat, arg, expr);
- for_kv_map::check(cx, pat, arg, body, expr);
+ check_for_loop_arg(cx, pat, arg);
+ for_kv_map::check(cx, pat, arg, body);
mut_range_bound::check(cx, arg, body);
single_element_loop::check(cx, pat, arg, body, expr);
same_item_push::check(cx, pat, arg, body, expr);
manual_flatten::check(cx, pat, arg, body, span);
}
-fn check_for_loop_arg(cx: &LateContext<'_>, pat: &Pat<'_>, arg: &Expr<'_>, expr: &Expr<'_>) {
+fn check_for_loop_arg(cx: &LateContext<'_>, pat: &Pat<'_>, arg: &Expr<'_>) {
let mut next_loop_linted = false; // whether or not ITER_NEXT_LOOP lint was used
if let ExprKind::MethodCall(method, _, [self_arg], _) = arg.kind {
explicit_into_iter_loop::check(cx, self_arg, arg);
},
"next" => {
- next_loop_linted = iter_next_loop::check(cx, arg, expr);
+ next_loop_linted = iter_next_loop::check(cx, arg);
},
_ => {},
}
span_lint_and_then(
cx,
NEEDLESS_RANGE_LOOP,
- expr.span,
+ arg.span,
&format!("the loop variable `{}` is used to index `{}`", ident.name, indexed),
|diag| {
multispan_sugg(
span_lint_and_then(
cx,
NEEDLESS_RANGE_LOOP,
- expr.span,
+ arg.span,
&format!("the loop variable `{}` is only used to index `{}`", ident.name, indexed),
|diag| {
multispan_sugg(
"#[macro_use] is no longer needed"
}
-const BRACKETS: &[char] = &['<', '>'];
-
#[derive(Clone, Debug, PartialEq, Eq)]
struct PathAndSpan {
path: String,
span: Span,
}
-/// `MacroRefData` includes the name of the macro
-/// and the path from `SourceMap::span_to_filename`.
+/// `MacroRefData` includes the name of the macro.
#[derive(Debug, Clone)]
pub struct MacroRefData {
name: String,
- path: String,
}
impl MacroRefData {
- pub fn new(name: String, callee: Span, cx: &LateContext<'_>) -> Self {
- let sm = cx.sess().source_map();
- let mut path = sm.filename_for_diagnostics(&sm.span_to_filename(callee)).to_string();
-
- // std lib paths are <::std::module::file type>
- // so remove brackets, space and type.
- if path.contains('<') {
- path = path.replace(BRACKETS, "");
- }
- if path.contains(' ') {
- path = path.split(' ').next().unwrap().to_string();
- }
- Self { name, path }
+ pub fn new(name: String) -> Self {
+ Self { name }
}
}
fn push_unique_macro(&mut self, cx: &LateContext<'_>, span: Span) {
let call_site = span.source_callsite();
let name = snippet(cx, cx.sess().source_map().span_until_char(call_site, '!'), "_");
- if let Some(callee) = span.source_callee() {
+ if let Some(_callee) = span.source_callee() {
if !self.collected.contains(&call_site) {
let name = if name.contains("::") {
name.split("::").last().unwrap().to_string()
name.to_string()
};
- self.mac_refs.push(MacroRefData::new(name, callee.def_site, cx));
+ self.mac_refs.push(MacroRefData::new(name));
self.collected.insert(call_site);
}
}
fn push_unique_macro_pat_ty(&mut self, cx: &LateContext<'_>, span: Span) {
let call_site = span.source_callsite();
let name = snippet(cx, cx.sess().source_map().span_until_char(call_site, '!'), "_");
- if let Some(callee) = span.source_callee() {
+ if let Some(_callee) = span.source_callee() {
if !self.collected.contains(&call_site) {
self.mac_refs
- .push(MacroRefData::new(name.to_string(), callee.def_site, cx));
+ .push(MacroRefData::new(name.to_string()));
self.collected.insert(call_site);
}
}
},
_,
) => {
- let parent_span = e.span.parent().unwrap();
+ let parent_span = e.span.parent_callsite().unwrap();
if parent_span.ctxt() == ctxt {
(Some(UnwrapKind::QuestionMark), parent_span)
} else {
correct.push("mod.rs");
cx.struct_span_lint(
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| {
let mut lint =
build.build(&format!("`mod.rs` files are required, found `{}`", path.display()));
cx.struct_span_lint(
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| {
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(),));
use clippy_utils::{match_def_path, paths};
use if_chain::if_chain;
use rustc_ast::ast::{LitKind, StrStyle};
-use rustc_data_structures::fx::FxHashSet;
-use rustc_hir::{BorrowKind, Expr, ExprKind, HirId};
+use rustc_hir::{BorrowKind, Expr, ExprKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::source_map::{BytePos, Span};
}
#[derive(Clone, Default)]
-pub struct Regex {
- spans: FxHashSet<Span>,
- last: Option<HirId>,
-}
+pub struct Regex {}
impl_lint_pass!(Regex => [INVALID_REGEX, TRIVIAL_REGEX]);
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);
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> {
attr.span.lo() + BytePos(3 + lo),
attr.span.lo() + BytePos(3 + hi),
attr.span.ctxt(),
+ attr.span.parent(),
);
span_lint_and_sugg(
cx,
publish = false
[dependencies]
-if_chain = "1.0.0"
-rustc-semver="1.1.0"
+if_chain = "1.0"
+rustc-semver = "1.1"
[features]
deny-warnings = []
}
};
}
- fn item_child_by_name<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, name: &str) -> Option<&'tcx Export<HirId>> {
+ fn item_child_by_name<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, name: &str) -> Option<&'tcx Export> {
tcx.item_children(def_id)
.iter()
.find(|item| item.ident.name.as_str() == name)
None
}
});
- try_res!(last).res
+ try_res!(last).res.expect_non_local()
}
/// Convenience function to get the `DefId` of a trait by path.
))
}
},
- Rvalue::NullaryOp(NullOp::SizeOf, _) => Ok(()),
+ Rvalue::NullaryOp(NullOp::SizeOf | NullOp::AlignOf, _) => Ok(()),
Rvalue::NullaryOp(NullOp::Box, _) => Err((span, "heap allocations are not allowed in const fn".into())),
Rvalue::UnaryOp(_, operand) => {
let ty = operand.ty(body, tcx);
[dependencies]
clap = "2.33"
-flate2 = {version = "1.0.19"}
-fs_extra = {version = "1.2.0"}
-rayon = {version = "1.5.0"}
-serde = {version = "1.0", features = ["derive"]}
-serde_json = {version = "1.0"}
-tar = {version = "0.4.30"}
-toml = {version = "0.5"}
-ureq = {version = "2.0.0-rc3"}
-walkdir = {version = "2.3.2"}
+flate2 = "1.0"
+fs_extra = "1.2"
+rayon = "1.5"
+serde = { version = "1.0", features = ["derive"] }
+serde_json = "1.0"
+tar = "0.4"
+toml = "0.5"
+ureq = "2.2"
+walkdir = "2.3"
[features]
deny-warnings = []
// run-rustfix
-#![allow(unused_imports)]
+#![allow(unused_imports,dead_code)]
#![deny(clippy::default_trait_access)]
use std::default;
// run-rustfix
-#![allow(unused_imports)]
+#![allow(unused_imports,dead_code)]
#![deny(clippy::default_trait_access)]
use std::default;
// If at all possible you should use intra-doc links to avoid linkcheck issues. These
// are cases where that does not work
// [(generated_documentation_page, &[broken_links])]
+#[rustfmt::skip]
const LINKCHECK_EXCEPTIONS: &[(&str, &[&str])] = &[
// These try to link to std::collections, but are defined in alloc
// https://github.com/rust-lang/rust/issues/74481
("std/collections/btree_set/struct.BTreeSet.html", &["#insert-and-complex-keys"]),
("alloc/collections/btree_map/struct.BTreeMap.html", &["#insert-and-complex-keys"]),
("alloc/collections/btree_set/struct.BTreeSet.html", &["#insert-and-complex-keys"]),
+
+ // These try to link to various things in std, but are defined in core.
+ // The docs in std::primitive use proper intra-doc links, so these seem fine to special-case.
+ // Most these are broken because liballoc uses `#[lang_item]` magic to define things on
+ // primitives that aren't available in core.
+ ("alloc/slice/trait.Join.html", &["#method.join"]),
+ ("alloc/slice/trait.Concat.html", &["#method.concat"]),
+ ("alloc/slice/index.html", &["#method.concat", "#method.join"]),
+ ("alloc/vec/struct.Vec.html", &["#method.sort_by_key", "#method.sort_by_cached_key"]),
+ ("core/primitive.str.html", &["#method.to_ascii_uppercase", "#method.to_ascii_lowercase"]),
+ ("core/primitive.slice.html", &["#method.to_ascii_uppercase", "#method.to_ascii_lowercase",
+ "core/slice::sort_by_key", "core\\slice::sort_by_key",
+ "#method.sort_by_cached_key"]),
];
#[rustfmt::skip]
/// Load a file from disk, or from the cache if available.
fn load_file(&mut self, file: &Path, report: &mut Report) -> (String, &FileEntry) {
+ // https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-
+ #[cfg(windows)]
+ const ERROR_INVALID_NAME: i32 = 123;
+
let pretty_path =
file.strip_prefix(&self.root).unwrap_or(&file).to_str().unwrap().to_string();
}
Err(e) if e.kind() == ErrorKind::NotFound => FileEntry::Missing,
Err(e) => {
+ // If a broken intra-doc link contains `::`, on windows, it will cause `ERROR_INVALID_NAME` rather than `NotFound`.
+ // Explicitly check for that so that the broken link can be allowed in `LINKCHECK_EXCEPTIONS`.
+ #[cfg(windows)]
+ if e.raw_os_error() == Some(ERROR_INVALID_NAME)
+ && file.as_os_str().to_str().map_or(false, |s| s.contains("::"))
+ {
+ return FileEntry::Missing;
+ }
panic!("unexpected read error for {}: {}", file.display(), e);
}
});
-Subproject commit 7a2f1cadcd5120c44eda3596053de767cd8173a2
+Subproject commit 035933186957cf81c488261fb48a98bf523e8006
#[derive(Debug, Clone)]
struct ParsedMacroArg {
kind: MacroArgKind,
- span: Span,
}
impl ParsedMacroArg {
struct MacroArgParser {
/// Either a name of the next metavariable, a separator, or junk.
buf: String,
- /// The start position on the current buffer.
- lo: BytePos,
/// The first token of the current buffer.
start_tok: Token,
/// `true` if we are parsing a metavariable or a repeat.
is_meta_var: bool,
- /// The position of the last token.
- hi: BytePos,
/// The last token parsed.
last_tok: Token,
/// Holds the parsed arguments.
impl MacroArgParser {
fn new() -> MacroArgParser {
MacroArgParser {
- lo: BytePos(0),
- hi: BytePos(0),
buf: String::new(),
is_meta_var: false,
last_tok: Token {
}
fn set_last_tok(&mut self, tok: &TokenTree) {
- self.hi = tok.span().hi();
self.last_tok = last_tok(tok);
}
};
self.result.push(ParsedMacroArg {
kind: MacroArgKind::Separator(self.buf.clone(), prefix),
- span: mk_sp(self.lo, self.hi),
});
self.buf.clear();
}
};
self.result.push(ParsedMacroArg {
kind: MacroArgKind::Other(self.buf.clone(), prefix),
- span: mk_sp(self.lo, self.hi),
});
self.buf.clear();
}
match iter.next() {
Some(TokenTree::Token(Token {
kind: TokenKind::Ident(name, _),
- span,
+ ..
})) => {
self.result.push(ParsedMacroArg {
kind: MacroArgKind::MetaVariable(name, self.buf.clone()),
- span: mk_sp(self.lo, span.hi()),
});
self.buf.clear();
}
}
- fn add_delimited(&mut self, inner: Vec<ParsedMacroArg>, delim: DelimToken, span: Span) {
+ fn add_delimited(&mut self, inner: Vec<ParsedMacroArg>, delim: DelimToken) {
self.result.push(ParsedMacroArg {
kind: MacroArgKind::Delimited(delim, inner),
- span,
});
}
inner: Vec<ParsedMacroArg>,
delim: DelimToken,
iter: &mut Cursor,
- span: Span,
) -> Option<()> {
let mut buffer = String::new();
let mut first = true;
- let mut lo = span.lo();
- let mut hi = span.hi();
// Parse '*', '+' or '?.
for tok in iter {
self.set_last_tok(&tok);
if first {
first = false;
- lo = tok.span().lo();
}
match tok {
}
TokenTree::Token(ref t) => {
buffer.push_str(&pprust::token_to_string(&t));
- hi = t.span.hi();
}
_ => return None,
}
} else {
Some(Box::new(ParsedMacroArg {
kind: MacroArgKind::Other(buffer, "".to_owned()),
- span: mk_sp(lo, hi),
}))
};
self.result.push(ParsedMacroArg {
kind: MacroArgKind::Repeat(delim, inner, another, self.last_tok.clone()),
- span: mk_sp(self.lo, self.hi),
});
Some(())
}
fn update_buffer(&mut self, t: &Token) {
if self.buf.is_empty() {
- self.lo = t.span.lo();
self.start_tok = t.clone();
} else {
let needs_space = match next_space(&self.last_tok.kind) {
// Start keeping the name of this metavariable in the buffer.
self.is_meta_var = true;
- self.lo = span.lo();
self.start_tok = Token {
kind: TokenKind::Dollar,
span,
self.add_meta_variable(&mut iter)?;
}
TokenTree::Token(ref t) => self.update_buffer(t),
- TokenTree::Delimited(delimited_span, delimited, ref tts) => {
+ TokenTree::Delimited(_delimited_span, delimited, ref tts) => {
if !self.buf.is_empty() {
if next_space(&self.last_tok.kind) == SpaceState::Always {
self.add_separator();
}
// Parse the stuff inside delimiters.
- let mut parser = MacroArgParser::new();
- parser.lo = delimited_span.open.lo();
+ let parser = MacroArgParser::new();
let delimited_arg = parser.parse(tts.clone())?;
- let span = delimited_span.entire();
if self.is_meta_var {
- self.add_repeat(delimited_arg, delimited, &mut iter, span)?;
+ self.add_repeat(delimited_arg, delimited, &mut iter)?;
self.is_meta_var = false;
} else {
- self.add_delimited(delimited_arg, delimited, span);
+ self.add_delimited(delimited_arg, delimited);
}
}
}
let data = delimited_span.entire().data();
(
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(),
)
}
pub(crate) struct Module<'a> {
ast_mod_kind: Option<Cow<'a, ast::ModKind>>,
pub(crate) items: Cow<'a, Vec<rustc_ast::ptr::P<ast::Item>>>,
- attrs: Cow<'a, Vec<ast::Attribute>>,
inner_attr: Vec<ast::Attribute>,
pub(crate) span: Span,
}
.collect();
Module {
items: mod_items,
- attrs: mod_attrs,
inner_attr,
span: mod_span,
ast_mod_kind,
}
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 {
- 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.
pub mod extdeps;
pub mod features;
pub mod pal;
+pub mod primitive_docs;
pub mod style;
pub mod target_specific_tests;
pub mod ui_tests;
// Checks that only make sense for the std libs.
check!(pal, &library_path);
+ check!(primitive_docs, &library_path);
// Checks that need to be done for both the compiler and std libraries.
check!(unit_tests, &src_path);
--- /dev/null
+//! Tidy check to make sure `library/{std,core}/src/primitive_docs.rs` are the same file. These are
+//! different files so that relative links work properly without having to have `CARGO_PKG_NAME`
+//! set, but conceptually they should always be the same.
+
+use std::path::Path;
+
+pub fn check(library_path: &Path, bad: &mut bool) {
+ let std_name = "std/src/primitive_docs.rs";
+ let core_name = "core/src/primitive_docs.rs";
+ let std_contents = std::fs::read_to_string(library_path.join(std_name))
+ .unwrap_or_else(|e| panic!("failed to read library/{}: {}", std_name, e));
+ let core_contents = std::fs::read_to_string(library_path.join(core_name))
+ .unwrap_or_else(|e| panic!("failed to read library/{}: {}", core_name, e));
+ if std_contents != core_contents {
+ tidy_error!(bad, "library/{} and library/{} have different contents", core_name, std_name);
+ }
+}