diff options
429 files changed, 3653 insertions, 2263 deletions
diff --git a/.editorconfig b/.editorconfig index d065fa46469..eadd72e4993 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,6 +11,8 @@ trim_trailing_whitespace = true insert_final_newline = true indent_style = space indent_size = 4 + +[*.rs] max_line_length = 100 [*.md] diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 19078c1b842..8040cb22855 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -16,3 +16,5 @@ cf2dff2b1e3fa55fa5415d524200070d0d7aacfe b39a1d6f1a30ba29f25d7141038b9a5bf0126e36 # reorder fluent message files f97fddab91fbf290ea5b691fe355d6f915220b6e +# format let-else +cc907f80b95c6ec530c5ee1b05b044a468f07eca diff --git a/Cargo.lock b/Cargo.lock index fcd58d8a866..9f1561b503d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1529,9 +1529,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" dependencies = [ "compiler_builtins", "rustc-std-workspace-alloc", @@ -1864,7 +1864,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi 0.3.2", "libc", "windows-sys 0.48.0", ] @@ -1881,7 +1881,7 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi 0.3.2", "rustix 0.38.2", "windows-sys 0.48.0", ] @@ -2396,7 +2396,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi 0.3.2", "libc", ] @@ -4819,7 +4819,7 @@ dependencies = [ "dlmalloc", "fortanix-sgx-abi", "hashbrown 0.14.0", - "hermit-abi 0.3.1", + "hermit-abi 0.3.2", "libc", "miniz_oxide", "object", diff --git a/compiler/rustc_ast/src/token.rs b/compiler/rustc_ast/src/token.rs index 6646fa9446f..303bdd3a307 100644 --- a/compiler/rustc_ast/src/token.rs +++ b/compiler/rustc_ast/src/token.rs @@ -11,7 +11,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::Lrc; use rustc_macros::HashStable_Generic; use rustc_span::symbol::{kw, sym}; -#[cfg_attr(not(bootstrap), allow(hidden_glob_reexports))] +#[allow(hidden_glob_reexports)] use rustc_span::symbol::{Ident, Symbol}; use rustc_span::{self, edition::Edition, Span, DUMMY_SP}; use std::borrow::Cow; diff --git a/compiler/rustc_ast_lowering/src/asm.rs b/compiler/rustc_ast_lowering/src/asm.rs index d350498bc96..ab55c09465b 100644 --- a/compiler/rustc_ast_lowering/src/asm.rs +++ b/compiler/rustc_ast_lowering/src/asm.rs @@ -352,7 +352,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { let idx2 = *o.get(); let (ref op2, op_sp2) = operands[idx2]; - let Some(asm::InlineAsmRegOrRegClass::Reg(reg2)) = op2.reg() else { + let Some(asm::InlineAsmRegOrRegClass::Reg(reg2)) = op2.reg() + else { unreachable!(); }; @@ -368,7 +369,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { assert!(!*late); let out_op_sp = if input { op_sp2 } else { op_sp }; Some(out_op_sp) - }, + } _ => None, }; @@ -377,7 +378,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { op_span2: op_sp2, reg1_name: reg.name(), reg2_name: reg2.name(), - in_out + in_out, }); } Entry::Vacant(v) => { diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index c8c8b72b389..6e7b0c2e11f 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -714,7 +714,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { _ => None, }; - let Some(borrow_level) = borrow_level else { return false; }; + let Some(borrow_level) = borrow_level else { + return false; + }; let sugg = move_sites .iter() .map(|move_site| { @@ -763,7 +765,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { .typeck_root_def_id(self.mir_def_id().to_def_id()) .as_local() .and_then(|def_id| tcx.hir().get_generics(def_id)) - else { return; }; + else { + return; + }; // Try to find predicates on *generic params* that would allow copying `ty` let ocx = ObligationCtxt::new(&self.infcx); let copy_did = tcx.require_lang_item(LangItem::Copy, Some(span)); @@ -1220,18 +1224,20 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { return; }; let inner_param_uses = find_all_local_uses::find(self.body, inner_param.local); - let Some((inner_call_loc, inner_call_term)) = inner_param_uses.into_iter().find_map(|loc| { - let Either::Right(term) = self.body.stmt_at(loc) else { - debug!("{:?} is a statement, so it can't be a call", loc); - return None; - }; - let TerminatorKind::Call { args, .. } = &term.kind else { - debug!("not a call: {:?}", term); - return None; - }; - debug!("checking call args for uses of inner_param: {:?}", args); - args.contains(&Operand::Move(inner_param)).then_some((loc, term)) - }) else { + let Some((inner_call_loc, inner_call_term)) = + inner_param_uses.into_iter().find_map(|loc| { + let Either::Right(term) = self.body.stmt_at(loc) else { + debug!("{:?} is a statement, so it can't be a call", loc); + return None; + }; + let TerminatorKind::Call { args, .. } = &term.kind else { + debug!("not a call: {:?}", term); + return None; + }; + debug!("checking call args for uses of inner_param: {:?}", args); + args.contains(&Operand::Move(inner_param)).then_some((loc, term)) + }) + else { debug!("no uses of inner_param found as a by-move call arg"); return; }; @@ -1442,21 +1448,24 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } // Get closure's arguments - let ty::Closure(_, substs) = typeck_results.expr_ty(closure_expr).kind() else { /* hir::Closure can be a generator too */ return }; + let ty::Closure(_, substs) = typeck_results.expr_ty(closure_expr).kind() else { + /* hir::Closure can be a generator too */ + return; + }; let sig = substs.as_closure().sig(); let tupled_params = tcx.erase_late_bound_regions(sig.inputs().iter().next().unwrap().map_bound(|&b| b)); let ty::Tuple(params) = tupled_params.kind() else { return }; // Find the first argument with a matching type, get its name - let Some((_, this_name)) = params - .iter() - .zip(hir.body_param_names(closure.body)) - .find(|(param_ty, name)|{ + let Some((_, this_name)) = + params.iter().zip(hir.body_param_names(closure.body)).find(|(param_ty, name)| { // FIXME: also support deref for stuff like `Rc` arguments param_ty.peel_refs() == local_ty && name != &Ident::empty() }) - else { return }; + else { + return; + }; let spans; if let Some((_path_expr, qpath)) = finder.error_path @@ -2899,7 +2908,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { { let def_id = def_id.expect_local(); for operand in operands { - let (Operand::Copy(assigned_from) | Operand::Move(assigned_from)) = operand else { + let (Operand::Copy(assigned_from) | Operand::Move(assigned_from)) = + operand + else { continue; }; debug!( @@ -2908,7 +2919,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { ); // Find the local from the operand. - let Some(assigned_from_local) = assigned_from.local_or_deref_local() else { + let Some(assigned_from_local) = + assigned_from.local_or_deref_local() + else { continue; }; @@ -2961,7 +2974,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { ); // Find the local from the rvalue. - let Some(assigned_from_local) = assigned_from.local_or_deref_local() else { continue }; + let Some(assigned_from_local) = assigned_from.local_or_deref_local() else { + continue; + }; debug!( "annotate_argument_and_return_for_borrow: \ assigned_from_local={:?}", @@ -3009,7 +3024,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { assigned_to, args ); for operand in args { - let (Operand::Copy(assigned_from) | Operand::Move(assigned_from)) = operand else { + let (Operand::Copy(assigned_from) | Operand::Move(assigned_from)) = operand + else { continue; }; debug!( diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index d292611e6a2..e51da961add 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -847,14 +847,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { kind: TerminatorKind::Call { fn_span, call_source, .. }, .. }) = &self.body[location.block].terminator { - let Some((method_did, method_substs)) = - rustc_middle::util::find_self_call( - self.infcx.tcx, - &self.body, - target_temp, - location.block, - ) - else { + let Some((method_did, method_substs)) = rustc_middle::util::find_self_call( + self.infcx.tcx, + &self.body, + target_temp, + location.block, + ) else { return normal_ret; }; @@ -1121,7 +1119,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { err.eager_subdiagnostic( &self.infcx.tcx.sess.parse_sess.span_diagnostic, CaptureReasonSuggest::FreshReborrow { - span: fn_call_span.shrink_to_lo(), + span: move_span.shrink_to_hi(), }); } if let Some(clone_trait) = tcx.lang_items().clone_trait() @@ -1135,10 +1133,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { && self.infcx.predicate_must_hold_modulo_regions(&o) { err.span_suggestion_verbose( - fn_call_span.shrink_to_lo(), + move_span.shrink_to_hi(), "you can `clone` the value and consume it, but this might not be \ your desired behavior", - "clone().".to_string(), + ".clone()".to_string(), Applicability::MaybeIncorrect, ); } diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs index 8b77477a31a..3d4ca320ac3 100644 --- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs @@ -184,7 +184,9 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { } // Error with the pattern LookupResult::Exact(_) => { - let LookupResult::Parent(Some(mpi)) = self.move_data.rev_lookup.find(move_from.as_ref()) else { + let LookupResult::Parent(Some(mpi)) = + self.move_data.rev_lookup.find(move_from.as_ref()) + else { // move_from should be a projection from match_place. unreachable!("Probably not unreachable..."); }; @@ -494,8 +496,10 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { if let LocalInfo::User(BindingForm::Var(VarBindingForm { pat_span, .. })) = *bind_to.local_info() { - let Ok(pat_snippet) = - self.infcx.tcx.sess.source_map().span_to_snippet(pat_span) else { continue; }; + let Ok(pat_snippet) = self.infcx.tcx.sess.source_map().span_to_snippet(pat_span) + else { + continue; + }; let Some(stripped) = pat_snippet.strip_prefix('&') else { suggestions.push(( bind_to.source_info.span.shrink_to_lo(), diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index 1f2fefadf65..a0a145ef70a 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -648,8 +648,12 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { let def_id = self.body.source.def_id(); let hir_id = hir_map.local_def_id_to_hir_id(def_id.as_local().unwrap()); let node = hir_map.find(hir_id); - let Some(hir::Node::Item(item)) = node else { return; }; - let hir::ItemKind::Fn(.., body_id) = item.kind else { return; }; + let Some(hir::Node::Item(item)) = node else { + return; + }; + let hir::ItemKind::Fn(.., body_id) = item.kind else { + return; + }; let body = self.infcx.tcx.hir().body(body_id); let mut v = V { assign_span: span, err, ty, suggested: false }; diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index 617c85174cb..415ff5aea03 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -224,12 +224,10 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { let mut hrtb_bounds = vec![]; gat_id_and_generics.iter().flatten().for_each(|(gat_hir_id, generics)| { for pred in generics.predicates { - let BoundPredicate( - WhereBoundPredicate { - bound_generic_params, - bounds, - .. - }) = pred else { continue; }; + let BoundPredicate(WhereBoundPredicate { bound_generic_params, bounds, .. }) = pred + else { + continue; + }; if bound_generic_params .iter() .rfind(|bgp| hir.local_def_id_to_hir_id(bgp.def_id) == *gat_hir_id) @@ -813,7 +811,9 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { return; } let suitable_region = self.infcx.tcx.is_suitable_region(f); - let Some(suitable_region) = suitable_region else { return; }; + let Some(suitable_region) = suitable_region else { + return; + }; let fn_returns = self.infcx.tcx.return_type_impl_or_dyn_traits(suitable_region.def_id); @@ -848,7 +848,10 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { let Some((alias_tys, alias_span, lt_addition_span)) = self .infcx .tcx - .return_type_impl_or_dyn_traits_with_type_alias(suitable_region.def_id) else { return; }; + .return_type_impl_or_dyn_traits_with_type_alias(suitable_region.def_id) + else { + return; + }; // in case the return type of the method is a type alias let mut spans_suggs: Vec<_> = Vec::new(); @@ -932,8 +935,13 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { let mut visitor = TraitObjectVisitor(FxIndexSet::default()); visitor.visit_ty(param.param_ty); - let Some((ident, self_ty)) = - NiceRegionError::get_impl_ident_and_self_ty_from_trait(tcx, instance.def_id(), &visitor.0) else { return; }; + let Some((ident, self_ty)) = NiceRegionError::get_impl_ident_and_self_ty_from_trait( + tcx, + instance.def_id(), + &visitor.0, + ) else { + return; + }; self.suggest_constrain_dyn_trait_in_impl(diag, &visitor.0, ident, self_ty); } @@ -981,23 +989,25 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { sup: RegionVid, ) { let (Some(sub), Some(sup)) = (self.to_error_region(sub), self.to_error_region(sup)) else { - return + return; }; let Some((ty_sub, _)) = self .infcx .tcx .is_suitable_region(sub) - .and_then(|anon_reg| find_anon_type(self.infcx.tcx, sub, &anon_reg.boundregion)) else { - return + .and_then(|anon_reg| find_anon_type(self.infcx.tcx, sub, &anon_reg.boundregion)) + else { + return; }; let Some((ty_sup, _)) = self .infcx .tcx .is_suitable_region(sup) - .and_then(|anon_reg| find_anon_type(self.infcx.tcx, sup, &anon_reg.boundregion)) else { - return + .and_then(|anon_reg| find_anon_type(self.infcx.tcx, sup, &anon_reg.boundregion)) + else { + return; }; suggest_adding_lifetime_params(self.infcx.tcx, sub, ty_sup, ty_sub, diag); diff --git a/compiler/rustc_borrowck/src/diagnostics/region_name.rs b/compiler/rustc_borrowck/src/diagnostics/region_name.rs index 074f37bed13..963adc01894 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_name.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_name.rs @@ -325,8 +325,8 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> { // Can't have BrEnv in functions, constants or generators. bug!("BrEnv outside of closure."); }; - let hir::ExprKind::Closure(&hir::Closure { fn_decl_span, .. }) - = tcx.hir().expect_expr(self.mir_hir_id()).kind + let hir::ExprKind::Closure(&hir::Closure { fn_decl_span, .. }) = + tcx.hir().expect_expr(self.mir_hir_id()).kind else { bug!("Closure is not defined by a closure expr"); }; diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs index e45d3a2c882..9202d0b06ff 100644 --- a/compiler/rustc_borrowck/src/region_infer/mod.rs +++ b/compiler/rustc_borrowck/src/region_infer/mod.rs @@ -2058,10 +2058,17 @@ impl<'tcx> RegionInferenceContext<'tcx> { let mut extra_info = vec![]; for constraint in path.iter() { let outlived = constraint.sub; - let Some(origin) = self.var_infos.get(outlived) else { continue; }; - let RegionVariableOrigin::Nll(NllRegionVariableOrigin::Placeholder(p)) = origin.origin else { continue; }; + let Some(origin) = self.var_infos.get(outlived) else { + continue; + }; + let RegionVariableOrigin::Nll(NllRegionVariableOrigin::Placeholder(p)) = origin.origin + else { + continue; + }; debug!(?constraint, ?p); - let ConstraintCategory::Predicate(span) = constraint.category else { continue; }; + let ConstraintCategory::Predicate(span) = constraint.category else { + continue; + }; extra_info.push(ExtraConstraintInfo::PlaceholderFromPredicate(span)); // We only want to point to one break; diff --git a/compiler/rustc_borrowck/src/session_diagnostics.rs b/compiler/rustc_borrowck/src/session_diagnostics.rs index fceae5bb3ff..d1d8cfa74aa 100644 --- a/compiler/rustc_borrowck/src/session_diagnostics.rs +++ b/compiler/rustc_borrowck/src/session_diagnostics.rs @@ -398,7 +398,7 @@ pub(crate) enum CaptureReasonSuggest<'tcx> { #[suggestion( borrowck_suggest_create_freash_reborrow, applicability = "maybe-incorrect", - code = "as_mut().", + code = ".as_mut()", style = "verbose" )] FreshReborrow { diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index a15e1065c81..638cede6aaa 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -2039,28 +2039,16 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { } CastKind::PointerCoercion(PointerCoercion::MutToConstPointer) => { - let ty::RawPtr(ty::TypeAndMut { - ty: ty_from, - mutbl: hir::Mutability::Mut, - }) = op.ty(body, tcx).kind() else { - span_mirbug!( - self, - rvalue, - "unexpected base type for cast {:?}", - ty, - ); + let ty::RawPtr(ty::TypeAndMut { ty: ty_from, mutbl: hir::Mutability::Mut }) = + op.ty(body, tcx).kind() + else { + span_mirbug!(self, rvalue, "unexpected base type for cast {:?}", ty,); return; }; - let ty::RawPtr(ty::TypeAndMut { - ty: ty_to, - mutbl: hir::Mutability::Not, - }) = ty.kind() else { - span_mirbug!( - self, - rvalue, - "unexpected target type for cast {:?}", - ty, - ); + let ty::RawPtr(ty::TypeAndMut { ty: ty_to, mutbl: hir::Mutability::Not }) = + ty.kind() + else { + span_mirbug!(self, rvalue, "unexpected target type for cast {:?}", ty,); return; }; if let Err(terr) = self.sub_types( diff --git a/compiler/rustc_borrowck/src/universal_regions.rs b/compiler/rustc_borrowck/src/universal_regions.rs index 7821b82bf2b..4d9c4b178dc 100644 --- a/compiler/rustc_borrowck/src/universal_regions.rs +++ b/compiler/rustc_borrowck/src/universal_regions.rs @@ -929,7 +929,9 @@ fn for_each_late_bound_region_in_item<'tcx>( } for bound_var in tcx.late_bound_vars(tcx.hir().local_def_id_to_hir_id(mir_def_id)) { - let ty::BoundVariableKind::Region(bound_region) = bound_var else { continue; }; + let ty::BoundVariableKind::Region(bound_region) = bound_var else { + continue; + }; let liberated_region = ty::Region::new_free(tcx, mir_def_id.to_def_id(), bound_region); f(liberated_region); } diff --git a/compiler/rustc_builtin_macros/src/asm.rs b/compiler/rustc_builtin_macros/src/asm.rs index 6187e4f513b..19acefc38e3 100644 --- a/compiler/rustc_builtin_macros/src/asm.rs +++ b/compiler/rustc_builtin_macros/src/asm.rs @@ -157,8 +157,7 @@ pub fn parse_asm_args<'a>( } else if p.eat_keyword(sym::sym) { let expr = p.parse_expr()?; let ast::ExprKind::Path(qself, path) = &expr.kind else { - let err = diag - .create_err(errors::AsmSymNoPath { span: expr.span }); + let err = diag.create_err(errors::AsmSymNoPath { span: expr.span }); return Err(err); }; let sym = ast::InlineAsmSym { diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs index 4401cf8a9c5..ea81cee78b7 100644 --- a/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs +++ b/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs @@ -61,8 +61,8 @@ pub fn cs_cmp(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> Bl |cx, fold| match fold { CsFold::Single(field) => { let [other_expr] = &field.other_selflike_exprs[..] else { - cx.span_bug(field.span, "not exactly 2 arguments in `derive(Ord)`"); - }; + cx.span_bug(field.span, "not exactly 2 arguments in `derive(Ord)`"); + }; let args = thin_vec![field.self_expr.clone(), other_expr.clone()]; cx.expr_call_global(field.span, cmp_path.clone(), args) } diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs index 54b6cb7d713..a5b3a504e38 100644 --- a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs +++ b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs @@ -94,8 +94,8 @@ fn cs_partial_cmp( |cx, fold| match fold { CsFold::Single(field) => { let [other_expr] = &field.other_selflike_exprs[..] else { - cx.span_bug(field.span, "not exactly 2 arguments in `derive(Ord)`"); - }; + cx.span_bug(field.span, "not exactly 2 arguments in `derive(Ord)`"); + }; let args = thin_vec![field.self_expr.clone(), other_expr.clone()]; cx.expr_call_global(field.span, partial_cmp_path.clone(), args) } diff --git a/compiler/rustc_builtin_macros/src/env.rs b/compiler/rustc_builtin_macros/src/env.rs index 8f64e332861..bcff475f626 100644 --- a/compiler/rustc_builtin_macros/src/env.rs +++ b/compiler/rustc_builtin_macros/src/env.rs @@ -83,7 +83,12 @@ pub fn expand_env<'cx>( None => { // Use the string literal in the code in the diagnostic to avoid confusing diagnostics, // e.g. when the literal contains escape sequences. - let ast::ExprKind::Lit(ast::token::Lit { kind: ast::token::LitKind::Str, symbol: original_var, ..}) = &var_expr.kind else { + let ast::ExprKind::Lit(ast::token::Lit { + kind: ast::token::LitKind::Str, + symbol: original_var, + .. + }) = &var_expr.kind + else { unreachable!("`expr_to_string` ensures this is a string lit") }; cx.emit_err(errors::EnvNotDefined { diff --git a/compiler/rustc_builtin_macros/src/proc_macro_harness.rs b/compiler/rustc_builtin_macros/src/proc_macro_harness.rs index b35a2e2a292..a7908373b6d 100644 --- a/compiler/rustc_builtin_macros/src/proc_macro_harness.rs +++ b/compiler/rustc_builtin_macros/src/proc_macro_harness.rs @@ -89,7 +89,9 @@ impl<'a> CollectProcMacros<'a> { } fn collect_custom_derive(&mut self, item: &'a ast::Item, attr: &'a ast::Attribute) { - let Some((trait_name, proc_attrs)) = parse_macro_name_and_helper_attrs(self.handler, attr, "derive") else { + let Some((trait_name, proc_attrs)) = + parse_macro_name_and_helper_attrs(self.handler, attr, "derive") + else { return; }; diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs index d61400d3fa3..a56faf735f1 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs @@ -739,7 +739,10 @@ fn build_foreign_type_di_node<'ll, 'tcx>( debug!("build_foreign_type_di_node: {:?}", t); let &ty::Foreign(def_id) = unique_type_id.expect_ty().kind() else { - bug!("build_foreign_type_di_node() called with unexpected type: {:?}", unique_type_id.expect_ty()); + bug!( + "build_foreign_type_di_node() called with unexpected type: {:?}", + unique_type_id.expect_ty() + ); }; build_type_with_children( diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs index b2765ffc934..45698407e83 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs @@ -199,7 +199,7 @@ pub(super) fn build_enum_type_di_node<'ll, 'tcx>( let enum_type = unique_type_id.expect_ty(); let &ty::Adt(enum_adt_def, _) = enum_type.kind() else { bug!("build_enum_type_di_node() called with non-enum type: `{:?}`", enum_type) - }; + }; let enum_type_and_layout = cx.layout_of(enum_type); let enum_type_name = compute_debuginfo_type_name(cx.tcx, enum_type, false); @@ -667,7 +667,9 @@ fn build_union_fields_for_direct_tag_generator<'ll, 'tcx>( generator_type_and_layout: TyAndLayout<'tcx>, generator_type_di_node: &'ll DIType, ) -> SmallVec<&'ll DIType> { - let Variants::Multiple { tag_encoding: TagEncoding::Direct, tag_field, .. } = generator_type_and_layout.variants else { + let Variants::Multiple { tag_encoding: TagEncoding::Direct, tag_field, .. } = + generator_type_and_layout.variants + else { bug!("This function only supports layouts with directly encoded tags.") }; diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs index 8746ce0c5b1..008f21ae3f5 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs @@ -51,7 +51,7 @@ pub(super) fn build_enum_type_di_node<'ll, 'tcx>( let enum_type = unique_type_id.expect_ty(); let &ty::Adt(enum_adt_def, _) = enum_type.kind() else { bug!("build_enum_type_di_node() called with non-enum type: `{:?}`", enum_type) - }; + }; let enum_type_and_layout = cx.layout_of(enum_type); diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs index 4d1cd64865f..3799b69ee10 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs @@ -57,7 +57,7 @@ pub(super) fn build_enum_type_di_node<'ll, 'tcx>( let enum_type = unique_type_id.expect_ty(); let &ty::Adt(enum_adt_def, _) = enum_type.kind() else { bug!("build_enum_type_di_node() called with non-enum type: `{:?}`", enum_type) - }; + }; let containing_scope = get_namespace_for_item(cx, enum_adt_def.did()); let enum_type_and_layout = cx.layout_of(enum_type); @@ -132,9 +132,9 @@ pub(super) fn build_generator_di_node<'ll, 'tcx>( unique_type_id: UniqueTypeId<'tcx>, ) -> DINodeCreationResult<'ll> { let generator_type = unique_type_id.expect_ty(); - let &ty::Generator(generator_def_id, _, _ ) = generator_type.kind() else { + let &ty::Generator(generator_def_id, _, _) = generator_type.kind() else { bug!("build_generator_di_node() called with non-generator type: `{:?}`", generator_type) - }; + }; let containing_scope = get_namespace_for_item(cx, generator_def_id); let generator_type_and_layout = cx.layout_of(generator_type); @@ -158,7 +158,9 @@ pub(super) fn build_generator_di_node<'ll, 'tcx>( let generator_layout = cx.tcx.optimized_mir(generator_def_id).generator_layout().unwrap(); - let Variants::Multiple { tag_encoding: TagEncoding::Direct, ref variants, .. } = generator_type_and_layout.variants else { + let Variants::Multiple { tag_encoding: TagEncoding::Direct, ref variants, .. } = + generator_type_and_layout.variants + else { bug!( "Encountered generator with non-direct-tag layout: {:?}", generator_type_and_layout diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index c7925be0d7d..b603a878746 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -2970,10 +2970,25 @@ fn add_lld_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) { return; } + let self_contained_linker = sess.opts.cg.link_self_contained.linker(); + + // FIXME: some targets default to using `lld`, but users can only override the linker on the CLI + // and cannot yet select the precise linker flavor to opt out of that. See for example issue + // #113597 for the `thumbv6m-none-eabi` target: a driver is used, and its default linker + // conflicts with the target's flavor, causing unexpected arguments being passed. + // + // Until the new `LinkerFlavor`-like CLI options are stabilized, we only adopt MCP510's behavior + // if its dedicated unstable CLI flags are used, to keep the current sub-optimal stable + // behavior. + let using_mcp510 = + self_contained_linker || sess.opts.cg.linker_flavor.is_some_and(|f| f.is_unstable()); + if !using_mcp510 && !unstable_use_lld { + return; + } + // 1. Implement the "self-contained" part of this feature by adding rustc distribution // directories to the tool's search path. - let self_contained_linker = sess.opts.cg.link_self_contained.linker() || unstable_use_lld; - if self_contained_linker { + if self_contained_linker || unstable_use_lld { for path in sess.get_tools_search_paths(false) { cmd.arg({ let mut arg = OsString::from("-B"); diff --git a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs index 4b27b64962d..34b8d8b5a6f 100644 --- a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs +++ b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs @@ -186,7 +186,11 @@ fn calculate_debuginfo_offset< } => { let offset = indirect_offsets.last_mut().unwrap_or(&mut direct_offset); let FieldsShape::Array { stride, count: _ } = place.layout().fields else { - span_bug!(var.source_info.span, "ConstantIndex on non-array type {:?}", place.layout()) + span_bug!( + var.source_info.span, + "ConstantIndex on non-array type {:?}", + place.layout() + ) }; *offset += stride * index; place = place.project_constant_index(bx, index); diff --git a/compiler/rustc_codegen_ssa/src/target_features.rs b/compiler/rustc_codegen_ssa/src/target_features.rs index 9e06fec550d..7b5d83c612a 100644 --- a/compiler/rustc_codegen_ssa/src/target_features.rs +++ b/compiler/rustc_codegen_ssa/src/target_features.rs @@ -369,13 +369,9 @@ pub fn from_target_feature( // We allow comma separation to enable multiple features. target_features.extend(value.as_str().split(',').filter_map(|feature| { let Some(feature_gate) = supported_target_features.get(feature) else { - let msg = - format!("the feature named `{}` is not valid for this target", feature); + let msg = format!("the feature named `{}` is not valid for this target", feature); let mut err = tcx.sess.struct_span_err(item.span(), msg); - err.span_label( - item.span(), - format!("`{}` is not valid for this target", feature), - ); + err.span_label(item.span(), format!("`{}` is not valid for this target", feature)); if let Some(stripped) = feature.strip_prefix('+') { let valid = supported_target_features.contains_key(stripped); if valid { diff --git a/compiler/rustc_const_eval/src/const_eval/error.rs b/compiler/rustc_const_eval/src/const_eval/error.rs index 7890d878d08..ffeff8d079a 100644 --- a/compiler/rustc_const_eval/src/const_eval/error.rs +++ b/compiler/rustc_const_eval/src/const_eval/error.rs @@ -150,8 +150,8 @@ where tcx.sess.create_err(Spanned { span, node: layout_error.into_diagnostic() }); err.code(rustc_errors::error_code!(E0080)); let Some((mut err, handler)) = err.into_diagnostic() else { - panic!("did not emit diag"); - }; + panic!("did not emit diag"); + }; for frame in frames { err.eager_subdiagnostic(handler, frame); } diff --git a/compiler/rustc_const_eval/src/const_eval/machine.rs b/compiler/rustc_const_eval/src/const_eval/machine.rs index f9f645af41f..a20f0276b3e 100644 --- a/compiler/rustc_const_eval/src/const_eval/machine.rs +++ b/compiler/rustc_const_eval/src/const_eval/machine.rs @@ -22,7 +22,7 @@ use rustc_target::spec::abi::Abi as CallAbi; use crate::errors::{LongRunning, LongRunningWarn}; use crate::interpret::{ - self, compile_time_machine, AllocId, ConstAllocation, FnVal, Frame, ImmTy, InterpCx, + self, compile_time_machine, AllocId, ConstAllocation, FnArg, FnVal, Frame, ImmTy, InterpCx, InterpResult, OpTy, PlaceTy, Pointer, Scalar, }; use crate::{errors, fluent_generated as fluent}; @@ -201,7 +201,7 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> { fn hook_special_const_fn( &mut self, instance: ty::Instance<'tcx>, - args: &[OpTy<'tcx>], + args: &[FnArg<'tcx>], dest: &PlaceTy<'tcx>, ret: Option<mir::BasicBlock>, ) -> InterpResult<'tcx, Option<ty::Instance<'tcx>>> { @@ -210,6 +210,7 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> { if Some(def_id) == self.tcx.lang_items().panic_display() || Some(def_id) == self.tcx.lang_items().begin_panic_fn() { + let args = self.copy_fn_args(args)?; // &str or &&str assert!(args.len() == 1); @@ -236,8 +237,9 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> { return Ok(Some(new_instance)); } else if Some(def_id) == self.tcx.lang_items().align_offset_fn() { + let args = self.copy_fn_args(args)?; // For align_offset, we replace the function call if the pointer has no address. - match self.align_offset(instance, args, dest, ret)? { + match self.align_offset(instance, &args, dest, ret)? { ControlFlow::Continue(()) => return Ok(Some(instance)), ControlFlow::Break(()) => return Ok(None), } @@ -293,7 +295,7 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> { self.eval_fn_call( FnVal::Instance(instance), (CallAbi::Rust, fn_abi), - &[addr, align], + &[FnArg::Copy(addr), FnArg::Copy(align)], /* with_caller_location = */ false, dest, ret, @@ -427,7 +429,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir, ecx: &mut InterpCx<'mir, 'tcx, Self>, instance: ty::Instance<'tcx>, _abi: CallAbi, - args: &[OpTy<'tcx>], + args: &[FnArg<'tcx>], dest: &PlaceTy<'tcx>, ret: Option<mir::BasicBlock>, _unwind: mir::UnwindAction, // unwinding is not supported in consts diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs index 36606ff69a6..568618908e3 100644 --- a/compiler/rustc_const_eval/src/interpret/eval_context.rs +++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs @@ -604,7 +604,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // the last field). Can't have foreign types here, how would we // adjust alignment and size for them? let field = layout.field(self, layout.fields.count() - 1); - let Some((unsized_size, mut unsized_align)) = self.size_and_align_of(metadata, &field)? else { + let Some((unsized_size, mut unsized_align)) = + self.size_and_align_of(metadata, &field)? + else { // A field with an extern type. We don't know the actual dynamic size // or the alignment. return Ok(None); @@ -682,11 +684,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { return_to_block: StackPopCleanup, ) -> InterpResult<'tcx> { trace!("body: {:#?}", body); - // Clobber previous return place contents, nobody is supposed to be able to see them any more - // This also checks dereferenceable, but not align. We rely on all constructed places being - // sufficiently aligned (in particular we rely on `deref_operand` checking alignment). - self.write_uninit(return_place)?; - // first push a stack frame so we have access to the local substs + // First push a stack frame so we have access to the local substs let pre_frame = Frame { body, loc: Right(body.span), // Span used for errors caused during preamble. @@ -805,6 +803,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { throw_ub_custom!(fluent::const_eval_unwind_past_top); } + M::before_stack_pop(self, self.frame())?; + // Copy return value. Must of course happen *before* we deallocate the locals. let copy_ret_result = if !unwinding { let op = self diff --git a/compiler/rustc_const_eval/src/interpret/intern.rs b/compiler/rustc_const_eval/src/interpret/intern.rs index 7b11ad33091..107e5bec614 100644 --- a/compiler/rustc_const_eval/src/interpret/intern.rs +++ b/compiler/rustc_const_eval/src/interpret/intern.rs @@ -30,7 +30,7 @@ use super::{ use crate::const_eval; use crate::errors::{DanglingPtrInFinal, UnsupportedUntypedPointer}; -pub trait CompileTimeMachine<'mir, 'tcx, T> = Machine< +pub trait CompileTimeMachine<'mir, 'tcx: 'mir, T> = Machine< 'mir, 'tcx, MemoryKind = T, diff --git a/compiler/rustc_const_eval/src/interpret/machine.rs b/compiler/rustc_const_eval/src/interpret/machine.rs index b448e3a24c6..e101785b6e2 100644 --- a/compiler/rustc_const_eval/src/interpret/machine.rs +++ b/compiler/rustc_const_eval/src/interpret/machine.rs @@ -17,7 +17,7 @@ use rustc_target::spec::abi::Abi as CallAbi; use crate::const_eval::CheckAlignment; use super::{ - AllocBytes, AllocId, AllocRange, Allocation, ConstAllocation, Frame, ImmTy, InterpCx, + AllocBytes, AllocId, AllocRange, Allocation, ConstAllocation, FnArg, Frame, ImmTy, InterpCx, InterpResult, MemoryKind, OpTy, Operand, PlaceTy, Pointer, Provenance, Scalar, }; @@ -84,7 +84,7 @@ pub trait AllocMap<K: Hash + Eq, V> { /// Methods of this trait signifies a point where CTFE evaluation would fail /// and some use case dependent behaviour can instead be applied. -pub trait Machine<'mir, 'tcx>: Sized { +pub trait Machine<'mir, 'tcx: 'mir>: Sized { /// Additional memory kinds a machine wishes to distinguish from the builtin ones type MemoryKind: Debug + std::fmt::Display + MayLeak + Eq + 'static; @@ -182,7 +182,7 @@ pub trait Machine<'mir, 'tcx>: Sized { ecx: &mut InterpCx<'mir, 'tcx, Self>, instance: ty::Instance<'tcx>, abi: CallAbi, - args: &[OpTy<'tcx, Self::Provenance>], + args: &[FnArg<'tcx, Self::Provenance>], destination: &PlaceTy<'tcx, Self::Provenance>, target: Option<mir::BasicBlock>, unwind: mir::UnwindAction, @@ -194,7 +194,7 @@ pub trait Machine<'mir, 'tcx>: Sized { ecx: &mut InterpCx<'mir, 'tcx, Self>, fn_val: Self::ExtraFnVal, abi: CallAbi, - args: &[OpTy<'tcx, Self::Provenance>], + args: &[FnArg<'tcx, Self::Provenance>], destination: &PlaceTy<'tcx, Self::Provenance>, target: Option<mir::BasicBlock>, unwind: mir::UnwindAction, @@ -418,6 +418,18 @@ pub trait Machine<'mir, 'tcx>: Sized { Ok(()) } + /// Called on places used for in-place function argument and return value handling. + /// + /// These places need to be protected to make sure the program cannot tell whether the + /// argument/return value was actually copied or passed in-place.. + fn protect_in_place_function_argument( + ecx: &mut InterpCx<'mir, 'tcx, Self>, + place: &PlaceTy<'tcx, Self::Provenance>, + ) -> InterpResult<'tcx> { + // Without an aliasing model, all we can do is put `Uninit` into the place. + ecx.write_uninit(place) + } + /// Called immediately before a new stack frame gets pushed. fn init_frame_extra( ecx: &mut InterpCx<'mir, 'tcx, Self>, @@ -439,6 +451,14 @@ pub trait Machine<'mir, 'tcx>: Sized { Ok(()) } + /// Called just before the return value is copied to the caller-provided return place. + fn before_stack_pop( + _ecx: &InterpCx<'mir, 'tcx, Self>, + _frame: &Frame<'mir, 'tcx, Self::Provenance, Self::FrameExtra>, + ) -> InterpResult<'tcx> { + Ok(()) + } + /// Called immediately after a stack frame got popped, but before jumping back to the caller. /// The `locals` have already been destroyed! fn after_stack_pop( @@ -484,7 +504,7 @@ pub macro compile_time_machine(<$mir: lifetime, $tcx: lifetime>) { _ecx: &mut InterpCx<$mir, $tcx, Self>, fn_val: !, _abi: CallAbi, - _args: &[OpTy<$tcx>], + _args: &[FnArg<$tcx>], _destination: &PlaceTy<$tcx, Self::Provenance>, _target: Option<mir::BasicBlock>, _unwind: mir::UnwindAction, diff --git a/compiler/rustc_const_eval/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs index 1125d8d1f0e..7b44a20ef03 100644 --- a/compiler/rustc_const_eval/src/interpret/memory.rs +++ b/compiler/rustc_const_eval/src/interpret/memory.rs @@ -1060,11 +1060,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { let size = Size::from_bytes(len); let Some(alloc_ref) = self.get_ptr_alloc_mut(ptr, size, Align::ONE)? else { // zero-sized access - assert_matches!( - src.next(), - None, - "iterator said it was empty but returned an element" - ); + assert_matches!(src.next(), None, "iterator said it was empty but returned an element"); return Ok(()); }; diff --git a/compiler/rustc_const_eval/src/interpret/mod.rs b/compiler/rustc_const_eval/src/interpret/mod.rs index 898d62361ab..f657f954f9c 100644 --- a/compiler/rustc_const_eval/src/interpret/mod.rs +++ b/compiler/rustc_const_eval/src/interpret/mod.rs @@ -26,6 +26,7 @@ pub use self::machine::{compile_time_machine, AllocMap, Machine, MayLeak, StackP pub use self::memory::{AllocKind, AllocRef, AllocRefMut, FnVal, Memory, MemoryKind}; pub use self::operand::{ImmTy, Immediate, OpTy, Operand}; pub use self::place::{MPlaceTy, MemPlace, MemPlaceMeta, Place, PlaceTy}; +pub use self::terminator::FnArg; pub use self::validity::{CtfeValidationMode, RefTracking}; pub use self::visitor::{MutValueVisitor, Value, ValueVisitor}; diff --git a/compiler/rustc_const_eval/src/interpret/operand.rs b/compiler/rustc_const_eval/src/interpret/operand.rs index 5f89d652fab..6727937363e 100644 --- a/compiler/rustc_const_eval/src/interpret/operand.rs +++ b/compiler/rustc_const_eval/src/interpret/operand.rs @@ -575,14 +575,6 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { Ok(op) } - /// Evaluate a bunch of operands at once - pub(super) fn eval_operands( - &self, - ops: &[mir::Operand<'tcx>], - ) -> InterpResult<'tcx, Vec<OpTy<'tcx, M::Provenance>>> { - ops.iter().map(|op| self.eval_operand(op, None)).collect() - } - fn eval_ty_constant( &self, val: ty::Const<'tcx>, diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs index ca1106384fd..a9b2b43f1e6 100644 --- a/compiler/rustc_const_eval/src/interpret/place.rs +++ b/compiler/rustc_const_eval/src/interpret/place.rs @@ -328,7 +328,8 @@ where }; let mplace = MemPlace { ptr: ptr.to_pointer(self)?, meta }; - // When deref'ing a pointer, the *static* alignment given by the type is what matters. + // `ref_to_mplace` is called on raw pointers even if they don't actually get dereferenced; + // we hence can't call `size_and_align_of` since that asserts more validity than we want. let align = layout.align.abi; Ok(MPlaceTy { mplace, layout, align }) } @@ -354,34 +355,37 @@ where #[inline] pub(super) fn get_place_alloc( &self, - place: &MPlaceTy<'tcx, M::Provenance>, + mplace: &MPlaceTy<'tcx, M::Provenance>, ) -> InterpResult<'tcx, Option<AllocRef<'_, 'tcx, M::Provenance, M::AllocExtra, M::Bytes>>> { - assert!(place.layout.is_sized()); - assert!(!place.meta.has_meta()); - let size = place.layout.size; - self.get_ptr_alloc(place.ptr, size, place.align) + let (size, _align) = self + .size_and_align_of_mplace(&mplace)? + .unwrap_or((mplace.layout.size, mplace.layout.align.abi)); + // Due to packed places, only `mplace.align` matters. + self.get_ptr_alloc(mplace.ptr, size, mplace.align) } #[inline] pub(super) fn get_place_alloc_mut( &mut self, - place: &MPlaceTy<'tcx, M::Provenance>, + mplace: &MPlaceTy<'tcx, M::Provenance>, ) -> InterpResult<'tcx, Option<AllocRefMut<'_, 'tcx, M::Provenance, M::AllocExtra, M::Bytes>>> { - assert!(place.layout.is_sized()); - assert!(!place.meta.has_meta()); - let size = place.layout.size; - self.get_ptr_alloc_mut(place.ptr, size, place.align) + let (size, _align) = self + .size_and_align_of_mplace(&mplace)? + .unwrap_or((mplace.layout.size, mplace.layout.align.abi)); + // Due to packed places, only `mplace.align` matters. + self.get_ptr_alloc_mut(mplace.ptr, size, mplace.align) } /// Check if this mplace is dereferenceable and sufficiently aligned. pub fn check_mplace(&self, mplace: MPlaceTy<'tcx, M::Provenance>) -> InterpResult<'tcx> { - let (size, align) = self + let (size, _align) = self .size_and_align_of_mplace(&mplace)? .unwrap_or((mplace.layout.size, mplace.layout.align.abi)); - assert!(mplace.align <= align, "dynamic alignment less strict than static one?"); - let align = if M::enforce_alignment(self).should_check() { align } else { Align::ONE }; + // Due to packed places, only `mplace.align` matters. + let align = + if M::enforce_alignment(self).should_check() { mplace.align } else { Align::ONE }; self.check_ptr_access_align(mplace.ptr, size, align, CheckInAllocMsg::DerefTest)?; Ok(()) } @@ -541,14 +545,17 @@ where // wrong type. let tcx = *self.tcx; - let Some(mut alloc) = self.get_place_alloc_mut(&MPlaceTy { mplace: dest, layout, align })? else { + let Some(mut alloc) = + self.get_place_alloc_mut(&MPlaceTy { mplace: dest, layout, align })? + else { // zero-sized access return Ok(()); }; match value { Immediate::Scalar(scalar) => { - let Abi::Scalar(s) = layout.abi else { span_bug!( + let Abi::Scalar(s) = layout.abi else { + span_bug!( self.cur_span(), "write_immediate_to_mplace: invalid Scalar layout: {layout:#?}", ) @@ -561,7 +568,8 @@ where // 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 Abi::ScalarPair(a, b) = layout.abi else { span_bug!( + let Abi::ScalarPair(a, b) = layout.abi else { + span_bug!( self.cur_span(), "write_immediate_to_mplace: invalid ScalarPair layout: {:#?}", layout diff --git a/compiler/rustc_const_eval/src/interpret/terminator.rs b/compiler/rustc_const_eval/src/interpret/terminator.rs index 15823a5975e..9c500790ce6 100644 --- a/compiler/rustc_const_eval/src/interpret/terminator.rs +++ b/compiler/rustc_const_eval/src/interpret/terminator.rs @@ -1,7 +1,8 @@ use std::borrow::Cow; +use either::Either; use rustc_ast::ast::InlineAsmOptions; -use rustc_middle::ty::layout::{FnAbiOf, LayoutOf}; +use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, TyAndLayout}; use rustc_middle::ty::Instance; use rustc_middle::{ mir, @@ -12,12 +13,63 @@ use rustc_target::abi::call::{ArgAbi, ArgAttribute, ArgAttributes, FnAbi, PassMo use rustc_target::spec::abi::Abi; use super::{ - FnVal, ImmTy, Immediate, InterpCx, InterpResult, MPlaceTy, Machine, MemoryKind, OpTy, Operand, - PlaceTy, Scalar, StackPopCleanup, + AllocId, FnVal, ImmTy, Immediate, InterpCx, InterpResult, MPlaceTy, Machine, MemoryKind, OpTy, + Operand, PlaceTy, Provenance, Scalar, StackPopCleanup, }; use crate::fluent_generated as fluent; +/// An argment passed to a function. +#[derive(Clone, Debug)] +pub enum FnArg<'tcx, Prov: Provenance = AllocId> { + /// Pass a copy of the given operand. + Copy(OpTy<'tcx, Prov>), + /// Allow for the argument to be passed in-place: destroy the value originally stored at that place and + /// make the place inaccessible for the duration of the function call. + InPlace(PlaceTy<'tcx, Prov>), +} + +impl<'tcx, Prov: Provenance> FnArg<'tcx, Prov> { + pub fn layout(&self) -> &TyAndLayout<'tcx> { + match self { + FnArg::Copy(op) => &op.layout, + FnArg::InPlace(place) => &place.layout, + } + } +} + impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { + /// Make a copy of the given fn_arg. Any `InPlace` are degenerated to copies, no protection of the + /// original memory occurs. + pub fn copy_fn_arg( + &self, + arg: &FnArg<'tcx, M::Provenance>, + ) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>> { + match arg { + FnArg::Copy(op) => Ok(op.clone()), + FnArg::InPlace(place) => self.place_to_op(&place), + } + } + + /// Make a copy of the given fn_args. Any `InPlace` are degenerated to copies, no protection of the + /// original memory occurs. + pub fn copy_fn_args( + &self, + args: &[FnArg<'tcx, M::Provenance>], + ) -> InterpResult<'tcx, Vec<OpTy<'tcx, M::Provenance>>> { + args.iter().map(|fn_arg| self.copy_fn_arg(fn_arg)).collect() + } + + pub fn fn_arg_field( + &mut self, + arg: &FnArg<'tcx, M::Provenance>, + field: usize, + ) -> InterpResult<'tcx, FnArg<'tcx, M::Provenance>> { + Ok(match arg { + FnArg::Copy(op) => FnArg::Copy(self.operand_field(op, field)?), + FnArg::InPlace(place) => FnArg::InPlace(self.place_field(place, field)?), + }) + } + pub(super) fn eval_terminator( &mut self, terminator: &mir::Terminator<'tcx>, @@ -68,14 +120,14 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { let old_stack = self.frame_idx(); let old_loc = self.frame().loc; let func = self.eval_operand(func, None)?; - let args = self.eval_operands(args)?; + let args = self.eval_fn_call_arguments(args)?; let fn_sig_binder = func.layout.ty.fn_sig(*self.tcx); let fn_sig = self.tcx.normalize_erasing_late_bound_regions(self.param_env, fn_sig_binder); let extra_args = &args[fn_sig.inputs().len()..]; let extra_args = - self.tcx.mk_type_list_from_iter(extra_args.iter().map(|arg| arg.layout.ty)); + self.tcx.mk_type_list_from_iter(extra_args.iter().map(|arg| arg.layout().ty)); let (fn_val, fn_abi, with_caller_location) = match *func.layout.ty.kind() { ty::FnPtr(_sig) => { @@ -185,6 +237,21 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { Ok(()) } + /// Evaluate the arguments of a function call + pub(super) fn eval_fn_call_arguments( + &mut self, + ops: &[mir::Operand<'tcx>], + ) -> InterpResult<'tcx, Vec<FnArg<'tcx, M::Provenance>>> { + ops.iter() + .map(|op| { + Ok(match op { + mir::Operand::Move(place) => FnArg::InPlace(self.eval_place(*place)?), + _ => FnArg::Copy(self.eval_operand(op, None)?), + }) + }) + .collect() + } + fn check_argument_compat( caller_abi: &ArgAbi<'tcx, Ty<'tcx>>, callee_abi: &ArgAbi<'tcx, Ty<'tcx>>, @@ -275,7 +342,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { fn pass_argument<'x, 'y>( &mut self, caller_args: &mut impl Iterator< - Item = (&'x OpTy<'tcx, M::Provenance>, &'y ArgAbi<'tcx, Ty<'tcx>>), + Item = (&'x FnArg<'tcx, M::Provenance>, &'y ArgAbi<'tcx, Ty<'tcx>>), >, callee_abi: &ArgAbi<'tcx, Ty<'tcx>>, callee_arg: &PlaceTy<'tcx, M::Provenance>, @@ -295,21 +362,25 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // Now, check if !Self::check_argument_compat(caller_abi, callee_abi) { let callee_ty = format!("{}", callee_arg.layout.ty); - let caller_ty = format!("{}", caller_arg.layout.ty); + let caller_ty = format!("{}", caller_arg.layout().ty); throw_ub_custom!( fluent::const_eval_incompatible_types, callee_ty = callee_ty, caller_ty = caller_ty, ) } + // We work with a copy of the argument for now; if this is in-place argument passing, we + // will later protect the source it comes from. This means the callee cannot observe if we + // did in-place of by-copy argument passing, except for pointer equality tests. + let caller_arg_copy = self.copy_fn_arg(&caller_arg)?; // Special handling for unsized parameters. - if caller_arg.layout.is_unsized() { + if caller_arg_copy.layout.is_unsized() { // `check_argument_compat` ensures that both have the same type, so we know they will use the metadata the same way. - assert_eq!(caller_arg.layout.ty, callee_arg.layout.ty); + assert_eq!(caller_arg_copy.layout.ty, callee_arg.layout.ty); // We have to properly pre-allocate the memory for the callee. - // So let's tear down some wrappers. + // So let's tear down some abstractions. // This all has to be in memory, there are no immediate unsized values. - let src = caller_arg.assert_mem_place(); + let src = caller_arg_copy.assert_mem_place(); // The destination cannot be one of these "spread args". let (dest_frame, dest_local) = callee_arg.assert_local(); // We are just initializing things, so there can't be anything here yet. @@ -319,7 +390,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { )); // Allocate enough memory to hold `src`. let Some((size, align)) = self.size_and_align_of_mplace(&src)? else { - span_bug!(self.cur_span(), "unsized fn arg with `extern` type tail should not be allowed") + span_bug!( + self.cur_span(), + "unsized fn arg with `extern` type tail should not be allowed" + ) }; let ptr = self.allocate_ptr(size, align, MemoryKind::Stack)?; let dest_place = @@ -331,7 +405,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // FIXME: Depending on the PassMode, this should reset some padding to uninitialized. (This // is true for all `copy_op`, but there are a lot of special cases for argument passing // specifically.) - self.copy_op(&caller_arg, callee_arg, /*allow_transmute*/ true) + self.copy_op(&caller_arg_copy, callee_arg, /*allow_transmute*/ true)?; + // If this was an in-place pass, protect the place it comes from for the duration of the call. + if let FnArg::InPlace(place) = caller_arg { + M::protect_in_place_function_argument(self, place)?; + } + Ok(()) } /// Call this function -- pushing the stack frame and initializing the arguments. @@ -346,7 +425,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { &mut self, fn_val: FnVal<'tcx, M::ExtraFnVal>, (caller_abi, caller_fn_abi): (Abi, &FnAbi<'tcx, Ty<'tcx>>), - args: &[OpTy<'tcx, M::Provenance>], + args: &[FnArg<'tcx, M::Provenance>], with_caller_location: bool, destination: &PlaceTy<'tcx, M::Provenance>, target: Option<mir::BasicBlock>, @@ -372,8 +451,15 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { match instance.def { ty::InstanceDef::Intrinsic(def_id) => { assert!(self.tcx.is_intrinsic(def_id)); - // caller_fn_abi is not relevant here, we interpret the arguments directly for each intrinsic. - M::call_intrinsic(self, instance, args, destination, target, unwind) + // FIXME: Should `InPlace` arguments be reset to uninit? + M::call_intrinsic( + self, + instance, + &self.copy_fn_args(args)?, + destination, + target, + unwind, + ) } ty::InstanceDef::VTableShim(..) | ty::InstanceDef::ReifyShim(..) @@ -385,10 +471,18 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { | ty::InstanceDef::ThreadLocalShim(..) | ty::InstanceDef::Item(_) => { // We need MIR for this fn - let Some((body, instance)) = - M::find_mir_or_eval_fn(self, instance, caller_abi, args, destination, target, unwind)? else { - return Ok(()); - }; + let Some((body, instance)) = M::find_mir_or_eval_fn( + self, + instance, + caller_abi, + args, + destination, + target, + unwind, + )? + else { + return Ok(()); + }; // Compute callee information using the `instance` returned by // `find_mir_or_eval_fn`. @@ -428,7 +522,13 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { "caller ABI: {:?}, args: {:#?}", caller_abi, args.iter() - .map(|arg| (arg.layout.ty, format!("{:?}", **arg))) + .map(|arg| ( + arg.layout().ty, + match arg { + FnArg::Copy(op) => format!("copy({:?})", *op), + FnArg::InPlace(place) => format!("in-place({:?})", *place), + } + )) .collect::<Vec<_>>() ); trace!( @@ -449,7 +549,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // last incoming argument. These two iterators do not have the same type, // so to keep the code paths uniform we accept an allocation // (for RustCall ABI only). - let caller_args: Cow<'_, [OpTy<'tcx, M::Provenance>]> = + let caller_args: Cow<'_, [FnArg<'tcx, M::Provenance>]> = if caller_abi == Abi::RustCall && !args.is_empty() { // Untuple let (untuple_arg, args) = args.split_last().unwrap(); @@ -458,11 +558,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { args.iter() .map(|a| Ok(a.clone())) .chain( - (0..untuple_arg.layout.fields.count()) - .map(|i| self.operand_field(untuple_arg, i)), + (0..untuple_arg.layout().fields.count()) + .map(|i| self.fn_arg_field(untuple_arg, i)), ) - .collect::<InterpResult<'_, Vec<OpTy<'tcx, M::Provenance>>>>( - )?, + .collect::<InterpResult<'_, Vec<_>>>()?, ) } else { // Plain arg passing @@ -523,6 +622,14 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { caller_ty = caller_ty, ) } + // Ensure the return place is aligned and dereferenceable, and protect it for + // in-place return value passing. + if let Either::Left(mplace) = destination.as_mplace_or_local() { + self.check_mplace(mplace)?; + } else { + // Nothing to do for locals, they are always properly allocated and aligned. + } + M::protect_in_place_function_argument(self, destination)?; }; match res { Err(err) => { @@ -538,7 +645,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // We have to implement all "object safe receivers". So we have to go search for a // pointer or `dyn Trait` type, but it could be wrapped in newtypes. So recursively // unwrap those newtypes until we are there. - let mut receiver = args[0].clone(); + // An `InPlace` does nothing here, we keep the original receiver intact. We can't + // really pass the argument in-place anyway, and we are constructing a new + // `Immediate` receiver. + let mut receiver = self.copy_fn_arg(&args[0])?; let receiver_place = loop { match receiver.layout.ty.kind() { ty::Ref(..) | ty::RawPtr(..) => { @@ -603,8 +713,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { .tcx .struct_tail_erasing_lifetimes(receiver_place.layout.ty, self.param_env); let ty::Dynamic(data, _, ty::Dyn) = receiver_tail.kind() else { - span_bug!(self.cur_span(), "dynamic call on non-`dyn` type {}", receiver_tail) - }; + span_bug!( + self.cur_span(), + "dynamic call on non-`dyn` type {}", + receiver_tail + ) + }; assert!(receiver_place.layout.is_unsized()); // Get the required information from the vtable. @@ -622,7 +736,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // Now determine the actual method to call. We can do that in two different ways and // compare them to ensure everything fits. - let Some(ty::VtblEntry::Method(fn_inst)) = self.get_vtable_entries(vptr)?.get(idx).copied() else { + let Some(ty::VtblEntry::Method(fn_inst)) = + self.get_vtable_entries(vptr)?.get(idx).copied() + else { // FIXME(fee1-dead) these could be variants of the UB info enum instead of this throw_ub_custom!(fluent::const_eval_dyn_call_not_a_method); }; @@ -648,11 +764,13 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { } // Adjust receiver argument. Layout can be any (thin) ptr. - args[0] = ImmTy::from_immediate( - Scalar::from_maybe_pointer(adjusted_receiver, self).into(), - self.layout_of(Ty::new_mut_ptr(self.tcx.tcx, dyn_ty))?, - ) - .into(); + args[0] = FnArg::Copy( + ImmTy::from_immediate( + Scalar::from_maybe_pointer(adjusted_receiver, self).into(), + self.layout_of(Ty::new_mut_ptr(self.tcx.tcx, dyn_ty))?, + ) + .into(), + ); trace!("Patched receiver operand to {:#?}", args[0]); // recurse with concrete function self.eval_fn_call( @@ -710,7 +828,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { self.eval_fn_call( FnVal::Instance(instance), (Abi::Rust, fn_abi), - &[arg.into()], + &[FnArg::Copy(arg.into())], false, &ret.into(), Some(target), diff --git a/compiler/rustc_const_eval/src/interpret/visitor.rs b/compiler/rustc_const_eval/src/interpret/visitor.rs index 7a14459399c..879ae198f7e 100644 --- a/compiler/rustc_const_eval/src/interpret/visitor.rs +++ b/compiler/rustc_const_eval/src/interpret/visitor.rs @@ -13,7 +13,7 @@ use super::{InterpCx, MPlaceTy, Machine, OpTy, PlaceTy}; /// A thing that we can project into, and that has a layout. /// This wouldn't have to depend on `Machine` but with the current type inference, /// that's just more convenient to work with (avoids repeating all the `Machine` bounds). -pub trait Value<'mir, 'tcx, M: Machine<'mir, 'tcx>>: Sized { +pub trait Value<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>>: Sized { /// Gets this value's layout. fn layout(&self) -> TyAndLayout<'tcx>; @@ -54,7 +54,7 @@ pub trait Value<'mir, 'tcx, M: Machine<'mir, 'tcx>>: Sized { /// A thing that we can project into given *mutable* access to `ecx`, and that has a layout. /// This wouldn't have to depend on `Machine` but with the current type inference, /// that's just more convenient to work with (avoids repeating all the `Machine` bounds). -pub trait ValueMut<'mir, 'tcx, M: Machine<'mir, 'tcx>>: Sized { +pub trait ValueMut<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>>: Sized { /// Gets this value's layout. fn layout(&self) -> TyAndLayout<'tcx>; diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs index 14540e8dfe7..fa71606eeb2 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs @@ -778,8 +778,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { if trait_ref.self_ty().is_closure() && tcx.fn_trait_kind_from_def_id(trait_id).is_some() => { - let ty::Closure(closure_def_id, substs) = - *trait_ref.self_ty().kind() + let ty::Closure(closure_def_id, substs) = *trait_ref.self_ty().kind() else { unreachable!() }; diff --git a/compiler/rustc_const_eval/src/transform/promote_consts.rs b/compiler/rustc_const_eval/src/transform/promote_consts.rs index 1b39a76e460..0df110f8fbe 100644 --- a/compiler/rustc_const_eval/src/transform/promote_consts.rs +++ b/compiler/rustc_const_eval/src/transform/promote_consts.rs @@ -759,11 +759,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { let (mut rvalue, source_info) = { let statement = &mut self.source[loc.block].statements[loc.statement_index]; let StatementKind::Assign(box (_, rhs)) = &mut statement.kind else { - span_bug!( - statement.source_info.span, - "{:?} is not an assignment", - statement - ); + span_bug!(statement.source_info.span, "{:?} is not an assignment", statement); }; ( @@ -859,7 +855,9 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { let local_decls = &mut self.source.local_decls; let loc = candidate.location; let statement = &mut blocks[loc.block].statements[loc.statement_index]; - let StatementKind::Assign(box (_, Rvalue::Ref(region, borrow_kind, place))) = &mut statement.kind else { + let StatementKind::Assign(box (_, Rvalue::Ref(region, borrow_kind, place))) = + &mut statement.kind + else { bug!() }; diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs index 4cc923cd935..e516145894b 100644 --- a/compiler/rustc_const_eval/src/transform/validate.rs +++ b/compiler/rustc_const_eval/src/transform/validate.rs @@ -214,9 +214,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { stack.clear(); stack.insert(bb); loop { - let Some(parent)= parent[bb].take() else { - break - }; + let Some(parent) = parent[bb].take() else { break }; let no_cycle = stack.insert(parent); if !no_cycle { self.fail( @@ -399,7 +397,10 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { }; let Some(layout) = gen_body.generator_layout() else { - self.fail(location, format!("No generator layout for {:?}", parent_ty)); + self.fail( + location, + format!("No generator layout for {:?}", parent_ty), + ); return; }; @@ -409,13 +410,17 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { }; let Some(f_ty) = layout.field_tys.get(local) else { - self.fail(location, format!("Out of bounds local {:?} for {:?}", local, parent_ty)); + self.fail( + location, + format!("Out of bounds local {:?} for {:?}", local, parent_ty), + ); return; }; f_ty.ty } else { - let Some(f_ty) = substs.as_generator().prefix_tys().nth(f.index()) else { + let Some(f_ty) = substs.as_generator().prefix_tys().nth(f.index()) + else { fail_out_of_bounds(self, location); return; }; diff --git a/compiler/rustc_data_structures/src/graph/dominators/mod.rs b/compiler/rustc_data_structures/src/graph/dominators/mod.rs index a5db14d9102..85ef2de9b5e 100644 --- a/compiler/rustc_data_structures/src/graph/dominators/mod.rs +++ b/compiler/rustc_data_structures/src/graph/dominators/mod.rs @@ -176,9 +176,7 @@ pub fn dominators<G: ControlFlowGraph>(graph: &G) -> Dominators<G::Node> { // // ...this may be the case if a MirPass modifies the CFG to remove // or rearrange certain blocks/edges. - let Some(v) = real_to_pre_order[v] else { - continue - }; + let Some(v) = real_to_pre_order[v] else { continue }; // eval returns a vertex x from which semi[x] is minimum among // vertices semi[v] +> x *> v. diff --git a/compiler/rustc_errors/src/markdown/parse.rs b/compiler/rustc_errors/src/markdown/parse.rs index 362a451fde6..d3a08da6283 100644 --- a/compiler/rustc_errors/src/markdown/parse.rs +++ b/compiler/rustc_errors/src/markdown/parse.rs @@ -272,7 +272,7 @@ fn parse_ordered_li(buf: &[u8]) -> Parsed<'_> { fn get_indented_section(buf: &[u8]) -> (&[u8], &[u8]) { let mut end = buf.len(); for (idx, window) in buf.windows(2).enumerate() { - let &[ch, next_ch] = window else {unreachable!("always 2 elements")}; + let &[ch, next_ch] = window else { unreachable!("always 2 elements") }; if idx >= buf.len().saturating_sub(2) && next_ch == b'\n' { // End of stream end = buf.len().saturating_sub(1); diff --git a/compiler/rustc_errors/src/markdown/term.rs b/compiler/rustc_errors/src/markdown/term.rs index e45ba6d2cda..88c3c8b9ff2 100644 --- a/compiler/rustc_errors/src/markdown/term.rs +++ b/compiler/rustc_errors/src/markdown/term.rs @@ -149,7 +149,7 @@ fn write_wrapping<B: io::Write>( let Some((end_idx, _ch)) = iter.nth(ch_count) else { // Write entire line buf.write_all(to_write.as_bytes())?; - cur.set(cur.get()+to_write.chars().count()); + cur.set(cur.get() + to_write.chars().count()); break; }; diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs index 8a251ea29d7..4b0907cf15a 100644 --- a/compiler/rustc_expand/src/base.rs +++ b/compiler/rustc_expand/src/base.rs @@ -1366,7 +1366,7 @@ pub fn parse_macro_name_and_helper_attrs( return None; } let Some(trait_attr) = list[0].meta_item() else { - diag.emit_err(errors::NotAMetaItem {span: list[0].span()}); + diag.emit_err(errors::NotAMetaItem { span: list[0].span() }); return None; }; let trait_ident = match trait_attr.ident() { diff --git a/compiler/rustc_expand/src/config.rs b/compiler/rustc_expand/src/config.rs index 3e43eae006f..4ec5ac22e90 100644 --- a/compiler/rustc_expand/src/config.rs +++ b/compiler/rustc_expand/src/config.rs @@ -313,9 +313,10 @@ impl<'a> StripUnconfigured<'a> { /// the attribute is incorrect. pub(crate) fn expand_cfg_attr(&self, attr: &Attribute, recursive: bool) -> Vec<Attribute> { let Some((cfg_predicate, expanded_attrs)) = - rustc_parse::parse_cfg_attr(attr, &self.sess.parse_sess) else { - return vec![]; - }; + rustc_parse::parse_cfg_attr(attr, &self.sess.parse_sess) + else { + return vec![]; + }; // Lint on zero attributes in source. if expanded_attrs.is_empty() { @@ -365,7 +366,9 @@ impl<'a> StripUnconfigured<'a> { // Use the `#` in `#[cfg_attr(pred, attr)]` as the `#` token // for `attr` when we expand it to `#[attr]` let mut orig_trees = orig_tokens.into_trees(); - let TokenTree::Token(pound_token @ Token { kind: TokenKind::Pound, .. }, _) = orig_trees.next().unwrap() else { + let TokenTree::Token(pound_token @ Token { kind: TokenKind::Pound, .. }, _) = + orig_trees.next().unwrap() + else { panic!("Bad tokens for attribute {:?}", attr); }; let pound_span = pound_token.span; @@ -373,7 +376,9 @@ impl<'a> StripUnconfigured<'a> { let mut trees = vec![AttrTokenTree::Token(pound_token, Spacing::Alone)]; if attr.style == AttrStyle::Inner { // For inner attributes, we do the same thing for the `!` in `#![some_attr]` - let TokenTree::Token(bang_token @ Token { kind: TokenKind::Not, .. }, _) = orig_trees.next().unwrap() else { + let TokenTree::Token(bang_token @ Token { kind: TokenKind::Not, .. }, _) = + orig_trees.next().unwrap() + else { panic!("Bad tokens for attribute {:?}", attr); }; trees.push(AttrTokenTree::Token(bang_token, Spacing::Alone)); diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs index 9850723a857..3b6db9fd39c 100644 --- a/compiler/rustc_expand/src/expand.rs +++ b/compiler/rustc_expand/src/expand.rs @@ -651,7 +651,8 @@ impl<'a, 'b> MacroExpander<'a, 'b> { ExpandResult::Ready(match invoc.kind { InvocationKind::Bang { mac, .. } => match ext { SyntaxExtensionKind::Bang(expander) => { - let Ok(tok_result) = expander.expand(self.cx, span, mac.args.tokens.clone()) else { + let Ok(tok_result) = expander.expand(self.cx, span, mac.args.tokens.clone()) + else { return ExpandResult::Ready(fragment_kind.dummy(span)); }; self.parse_ast_fragment(tok_result, fragment_kind, &mac.path, span) @@ -704,7 +705,8 @@ impl<'a, 'b> MacroExpander<'a, 'b> { self.cx.emit_err(UnsupportedKeyValue { span }); } let inner_tokens = attr_item.args.inner_tokens(); - let Ok(tok_result) = expander.expand(self.cx, span, inner_tokens, tokens) else { + let Ok(tok_result) = expander.expand(self.cx, span, inner_tokens, tokens) + else { return ExpandResult::Ready(fragment_kind.dummy(span)); }; self.parse_ast_fragment(tok_result, fragment_kind, &attr_item.path, span) @@ -1087,9 +1089,7 @@ impl InvocationCollectorNode for P<ast::Item> { // Work around borrow checker not seeing through `P`'s deref. let (ident, span, mut attrs) = (node.ident, node.span, mem::take(&mut node.attrs)); - let ItemKind::Mod(_, mod_kind) = &mut node.kind else { - unreachable!() - }; + let ItemKind::Mod(_, mod_kind) = &mut node.kind else { unreachable!() }; let ecx = &mut collector.cx; let (file_path, dir_path, dir_ownership) = match mod_kind { diff --git a/compiler/rustc_expand/src/mbe/diagnostics.rs b/compiler/rustc_expand/src/mbe/diagnostics.rs index 3593bed2d02..03de33dc854 100644 --- a/compiler/rustc_expand/src/mbe/diagnostics.rs +++ b/compiler/rustc_expand/src/mbe/diagnostics.rs @@ -42,7 +42,8 @@ pub(super) fn failed_to_match_macro<'cx>( return result; } - let Some(BestFailure { token, msg: label, remaining_matcher, .. }) = tracker.best_failure else { + let Some(BestFailure { token, msg: label, remaining_matcher, .. }) = tracker.best_failure + else { return DummyResult::any(sp); }; diff --git a/compiler/rustc_expand/src/mbe/metavar_expr.rs b/compiler/rustc_expand/src/mbe/metavar_expr.rs index 6e919615019..b6382dcb894 100644 --- a/compiler/rustc_expand/src/mbe/metavar_expr.rs +++ b/compiler/rustc_expand/src/mbe/metavar_expr.rs @@ -104,13 +104,10 @@ fn parse_depth<'sess>( span: Span, ) -> PResult<'sess, usize> { let Some(tt) = iter.next() else { return Ok(0) }; - let TokenTree::Token(token::Token { - kind: token::TokenKind::Literal(lit), .. - }, _) = tt else { - return Err(sess.span_diagnostic.struct_span_err( - span, - "meta-variable expression depth must be a literal" - )); + let TokenTree::Token(token::Token { kind: token::TokenKind::Literal(lit), .. }, _) = tt else { + return Err(sess + .span_diagnostic + .struct_span_err(span, "meta-variable expression depth must be a literal")); }; if let Ok(lit_kind) = LitKind::from_token_lit(*lit) && let LitKind::Int(n_u128, LitIntType::Unsuffixed) = lit_kind diff --git a/compiler/rustc_expand/src/mbe/transcribe.rs b/compiler/rustc_expand/src/mbe/transcribe.rs index d523d3eacbe..a5f83b88f7e 100644 --- a/compiler/rustc_expand/src/mbe/transcribe.rs +++ b/compiler/rustc_expand/src/mbe/transcribe.rs @@ -182,9 +182,7 @@ pub(super) fn transcribe<'a>( LockstepIterSize::Constraint(len, _) => { // We do this to avoid an extra clone above. We know that this is a // sequence already. - let mbe::TokenTree::Sequence(sp, seq) = seq else { - unreachable!() - }; + let mbe::TokenTree::Sequence(sp, seq) = seq else { unreachable!() }; // Is the repetition empty? if len == 0 { @@ -399,7 +397,9 @@ fn lockstep_iter_size( } TokenTree::MetaVarExpr(_, expr) => { let default_rslt = LockstepIterSize::Unconstrained; - let Some(ident) = expr.ident() else { return default_rslt; }; + let Some(ident) = expr.ident() else { + return default_rslt; + }; let name = MacroRulesNormalizedIdent::new(ident); match lookup_cur_matched(name, interpolations, repeats) { Some(MatchedSeq(ads)) => { diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index 5185820a727..56a2c5eff3d 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -392,13 +392,13 @@ declare_features! ( /// Allows `dyn* Trait` objects. (incomplete, dyn_star, "1.65.0", Some(102425), None), // Uses generic effect parameters for ~const bounds - (active, effects, "CURRENT_RUSTC_VERSION", Some(102090), None), + (active, effects, "1.72.0", Some(102090), None), /// Allows `X..Y` patterns. (active, exclusive_range_pattern, "1.11.0", Some(37854), None), /// Allows exhaustive pattern matching on types that contain uninhabited types. (active, exhaustive_patterns, "1.13.0", Some(51085), None), /// Allows explicit tail calls via `become` expression. - (incomplete, explicit_tail_calls, "CURRENT_RUSTC_VERSION", Some(112788), None), + (incomplete, explicit_tail_calls, "1.72.0", Some(112788), None), /// Allows using `efiapi`, `sysv64` and `win64` as calling convention /// for functions with varargs. (active, extended_varargs_abi_support, "1.65.0", Some(100189), None), @@ -445,7 +445,7 @@ declare_features! ( // Allows setting the threshold for the `large_assignments` lint. (active, large_assignments, "1.52.0", Some(83518), None), /// Allow to have type alias types for inter-crate use. - (active, lazy_type_alias, "CURRENT_RUSTC_VERSION", Some(112792), None), + (active, lazy_type_alias, "1.72.0", Some(112792), None), /// Allows `if/while p && let q = r && ...` chains. (active, let_chains, "1.37.0", Some(53667), None), /// Allows using `reason` in lint attributes and the `#[expect(lint)]` lint check. @@ -546,7 +546,7 @@ declare_features! ( /// not changed from prior instances of the same struct (RFC #2528) (active, type_changing_struct_update, "1.58.0", Some(86555), None), /// Allows using type privacy lints (`private_interfaces`, `private_bounds`, `unnameable_types`). - (active, type_privacy_lints, "CURRENT_RUSTC_VERSION", Some(48054), None), + (active, type_privacy_lints, "1.72.0", Some(48054), None), /// Enables rustc to generate code that instructs libstd to NOT ignore SIGPIPE. (active, unix_sigpipe, "1.65.0", Some(97889), None), /// Allows unsized fn parameters. diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 6c419471de1..35ef30114b7 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -3150,7 +3150,9 @@ impl<'hir> Item<'hir> { /// Expect an [`ItemKind::ForeignMod`] or panic. #[track_caller] pub fn expect_foreign_mod(&self) -> (Abi, &'hir [ForeignItemRef]) { - let ItemKind::ForeignMod { abi, items } = self.kind else { self.expect_failed("a foreign module") }; + let ItemKind::ForeignMod { abi, items } = self.kind else { + self.expect_failed("a foreign module") + }; (abi, items) } @@ -3201,14 +3203,18 @@ impl<'hir> Item<'hir> { pub fn expect_trait( self, ) -> (IsAuto, Unsafety, &'hir Generics<'hir>, GenericBounds<'hir>, &'hir [TraitItemRef]) { - let ItemKind::Trait(is_auto, unsafety, gen, bounds, items) = self.kind else { self.expect_failed("a trait") }; + let ItemKind::Trait(is_auto, unsafety, gen, bounds, items) = self.kind else { + self.expect_failed("a trait") + }; (is_auto, unsafety, gen, bounds, items) } /// Expect an [`ItemKind::TraitAlias`] or panic. #[track_caller] pub fn expect_trait_alias(&self) -> (&'hir Generics<'hir>, GenericBounds<'hir>) { - let ItemKind::TraitAlias(gen, bounds) = self.kind else { self.expect_failed("a trait alias") }; + let ItemKind::TraitAlias(gen, bounds) = self.kind else { + self.expect_failed("a trait alias") + }; (gen, bounds) } diff --git a/compiler/rustc_hir_analysis/src/astconv/mod.rs b/compiler/rustc_hir_analysis/src/astconv/mod.rs index db3d41ed247..e9c9151ca23 100644 --- a/compiler/rustc_hir_analysis/src/astconv/mod.rs +++ b/compiler/rustc_hir_analysis/src/astconv/mod.rs @@ -1267,9 +1267,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { "you might have meant to specify type parameters on enum \ `{type_name}`" ); - let Some(args) = assoc_segment.args else { return; }; + let Some(args) = assoc_segment.args else { + return; + }; // Get the span of the generics args *including* the leading `::`. - let args_span = assoc_segment.ident.span.shrink_to_hi().to(args.span_ext); + let args_span = + assoc_segment.ident.span.shrink_to_hi().to(args.span_ext); if tcx.generics_of(adt_def.did()).count() == 0 { // FIXME(estebank): we could also verify that the arguments being // work for the `enum`, instead of just looking if it takes *any*. @@ -1281,49 +1284,56 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { ); return; } - let Ok(snippet) = tcx.sess.source_map().span_to_snippet(args_span) else { + let Ok(snippet) = tcx.sess.source_map().span_to_snippet(args_span) + else { err.note(msg); return; }; - let (qself_sugg_span, is_self) = if let hir::TyKind::Path( - hir::QPath::Resolved(_, path) - ) = &qself.kind { - // If the path segment already has type params, we want to overwrite - // them. - match &path.segments { - // `segment` is the previous to last element on the path, - // which would normally be the `enum` itself, while the last - // `_` `PathSegment` corresponds to the variant. - [.., hir::PathSegment { - ident, - args, - res: Res::Def(DefKind::Enum, _), - .. - }, _] => ( - // We need to include the `::` in `Type::Variant::<Args>` - // to point the span to `::<Args>`, not just `<Args>`. - ident.span.shrink_to_hi().to(args.map_or( - ident.span.shrink_to_hi(), - |a| a.span_ext)), - false, - ), - [segment] => ( - // We need to include the `::` in `Type::Variant::<Args>` - // to point the span to `::<Args>`, not just `<Args>`. - segment.ident.span.shrink_to_hi().to(segment.args.map_or( - segment.ident.span.shrink_to_hi(), - |a| a.span_ext)), - kw::SelfUpper == segment.ident.name, - ), - _ => { - err.note(msg); - return; + let (qself_sugg_span, is_self) = + if let hir::TyKind::Path(hir::QPath::Resolved(_, path)) = + &qself.kind + { + // If the path segment already has type params, we want to overwrite + // them. + match &path.segments { + // `segment` is the previous to last element on the path, + // which would normally be the `enum` itself, while the last + // `_` `PathSegment` corresponds to the variant. + [ + .., + hir::PathSegment { + ident, + args, + res: Res::Def(DefKind::Enum, _), + .. + }, + _, + ] => ( + // We need to include the `::` in `Type::Variant::<Args>` + // to point the span to `::<Args>`, not just `<Args>`. + ident.span.shrink_to_hi().to(args + .map_or(ident.span.shrink_to_hi(), |a| a.span_ext)), + false, + ), + [segment] => ( + // We need to include the `::` in `Type::Variant::<Args>` + // to point the span to `::<Args>`, not just `<Args>`. + segment.ident.span.shrink_to_hi().to(segment + .args + .map_or(segment.ident.span.shrink_to_hi(), |a| { + a.span_ext + })), + kw::SelfUpper == segment.ident.name, + ), + _ => { + err.note(msg); + return; + } } - } - } else { - err.note(msg); - return; - }; + } else { + err.note(msg); + return; + }; let suggestion = vec![ if is_self { // Account for people writing `Self::Variant::<Args>`, where @@ -1455,7 +1465,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { }; let trait_did = bound.def_id(); - let Some(assoc_ty_did) = self.lookup_assoc_ty(assoc_ident, hir_ref_id, span, trait_did) else { + let Some(assoc_ty_did) = self.lookup_assoc_ty(assoc_ident, hir_ref_id, span, trait_did) + else { // Assume that if it's not matched, there must be a const defined with the same name // but it was used in a type position. let msg = format!("found associated const `{assoc_ident}` when type was expected"); @@ -1814,7 +1825,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { debug!("qpath_to_ty: self.item_def_id()={:?}", def_id); - let parent_def_id = def_id.as_local().map(|def_id| tcx.hir().local_def_id_to_hir_id(def_id)) + let parent_def_id = def_id + .as_local() + .map(|def_id| tcx.hir().local_def_id_to_hir_id(def_id)) .map(|hir_id| tcx.hir().get_parent_item(hir_id).to_def_id()); debug!("qpath_to_ty: parent_def_id={:?}", parent_def_id); @@ -1850,7 +1863,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { &[path_str], item_segment.ident.name, ); - return Ty::new_error(tcx,reported) + return Ty::new_error(tcx, reported); }; debug!("qpath_to_ty: self_type={:?}", self_ty); @@ -2688,7 +2701,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let hir = tcx.hir(); let hir::Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Fn(..), ident, .. }) = - hir.get(fn_hir_id) else { return None }; + hir.get(fn_hir_id) + else { + return None; + }; let i = hir.get_parent(fn_hir_id).expect_item().expect_impl(); let trait_ref = self.instantiate_mono_trait_ref( diff --git a/compiler/rustc_hir_analysis/src/check/dropck.rs b/compiler/rustc_hir_analysis/src/check/dropck.rs index 13d1abe2a65..2bb4cc39f92 100644 --- a/compiler/rustc_hir_analysis/src/check/dropck.rs +++ b/compiler/rustc_hir_analysis/src/check/dropck.rs @@ -81,8 +81,9 @@ fn ensure_drop_params_and_item_params_correspond<'tcx>( self_type_did: DefId, adt_to_impl_substs: SubstsRef<'tcx>, ) -> Result<(), ErrorGuaranteed> { - let Err(arg) = tcx.uses_unique_generic_params(adt_to_impl_substs, CheckRegions::OnlyEarlyBound) else { - return Ok(()) + let Err(arg) = tcx.uses_unique_generic_params(adt_to_impl_substs, CheckRegions::OnlyEarlyBound) + else { + return Ok(()); }; let drop_impl_span = tcx.def_span(drop_impl_did); diff --git a/compiler/rustc_hir_analysis/src/check/intrinsicck.rs b/compiler/rustc_hir_analysis/src/check/intrinsicck.rs index 0bb1467ef31..15be441e947 100644 --- a/compiler/rustc_hir_analysis/src/check/intrinsicck.rs +++ b/compiler/rustc_hir_analysis/src/check/intrinsicck.rs @@ -186,18 +186,14 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { let Some((_, feature)) = supported_tys.iter().find(|&&(t, _)| t == asm_ty) else { let msg = format!("type `{ty}` cannot be used with this register class"); let mut err = self.tcx.sess.struct_span_err(expr.span, msg); - let supported_tys: Vec<_> = - supported_tys.iter().map(|(t, _)| t.to_string()).collect(); + let supported_tys: Vec<_> = supported_tys.iter().map(|(t, _)| t.to_string()).collect(); err.note(format!( "register class `{}` supports these types: {}", reg_class.name(), supported_tys.join(", "), )); if let Some(suggest) = reg_class.suggest_class(asm_arch, asm_ty) { - err.help(format!( - "consider using the `{}` register class instead", - suggest.name() - )); + err.help(format!("consider using the `{}` register class instead", suggest.name())); } err.emit(); return Some(asm_ty); diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index f47df4f215b..d724dce89f4 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -1282,7 +1282,9 @@ fn suggest_impl_trait<'tcx>( item_ty: Ty<'tcx>| { let trait_name = tcx.item_name(trait_def_id); let args_tuple = substs.type_at(1); - let ty::Tuple(types) = *args_tuple.kind() else { return None; }; + let ty::Tuple(types) = *args_tuple.kind() else { + return None; + }; let types = types.make_suggestable(tcx, false)?; let maybe_ret = if item_ty.is_unit() { String::new() } else { format!(" -> {item_ty}") }; @@ -1315,8 +1317,12 @@ fn suggest_impl_trait<'tcx>( format_as_parenthesized, ), ] { - let Some(trait_def_id) = trait_def_id else { continue; }; - let Some(assoc_item_def_id) = assoc_item_def_id else { continue; }; + let Some(trait_def_id) = trait_def_id else { + continue; + }; + let Some(assoc_item_def_id) = assoc_item_def_id else { + continue; + }; if tcx.def_kind(assoc_item_def_id) != DefKind::AssocTy { continue; } diff --git a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs index 12936664130..81e4aa25427 100644 --- a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs @@ -66,7 +66,11 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen Some(ImplTraitInTraitData::Trait { opaque_def_id, fn_def_id }) => { let opaque_ty_id = tcx.hir().local_def_id_to_hir_id(opaque_def_id.expect_local()); let opaque_ty_node = tcx.hir().get(opaque_ty_id); - let Node::Item(&Item { kind: ItemKind::OpaqueTy(OpaqueTy { lifetime_mapping, .. }), .. }) = opaque_ty_node else { + let Node::Item(&Item { + kind: ItemKind::OpaqueTy(OpaqueTy { lifetime_mapping, .. }), + .. + }) = opaque_ty_node + else { bug!("unexpected {opaque_ty_node:?}") }; @@ -397,7 +401,9 @@ fn compute_bidirectional_outlives_predicates<'tcx>( continue; } - let Some(dup_index) = generics.param_def_id_to_index(icx.tcx, dup_def.to_def_id()) else { bug!() }; + let Some(dup_index) = generics.param_def_id_to_index(icx.tcx, dup_def.to_def_id()) else { + bug!() + }; let dup_region = ty::Region::new_early_bound( tcx, diff --git a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs index acd0bcd8e5c..c0eba18f838 100644 --- a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs +++ b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs @@ -749,9 +749,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> { // `fn foo<'a>() -> MyAnonTy<'a> { ... }` // ^ ^this gets resolved in the current scope for lifetime in lifetimes { - let hir::GenericArg::Lifetime(lifetime) = lifetime else { - continue - }; + let hir::GenericArg::Lifetime(lifetime) = lifetime else { continue }; self.visit_lifetime(lifetime); // Check for predicates like `impl for<'a> Trait<impl OtherTrait<'a>>` @@ -759,12 +757,8 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> { // well-supported at the moment, so this doesn't work. // In the future, this should be fixed and this error should be removed. let def = self.map.defs.get(&lifetime.hir_id).cloned(); - let Some(ResolvedArg::LateBound(_, _, def_id)) = def else { - continue - }; - let Some(def_id) = def_id.as_local() else { - continue - }; + let Some(ResolvedArg::LateBound(_, _, def_id)) = def else { continue }; + let Some(def_id) = def_id.as_local() else { continue }; let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id); // Ensure that the parent of the def is an item, not HRTB let parent_id = self.tcx.hir().parent_id(hir_id); diff --git a/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs b/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs index ee3457282d3..0828fe9e0f2 100644 --- a/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs +++ b/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs @@ -360,9 +360,11 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { &[] }; ret.extend(params.iter().filter_map(|p| { - let hir::GenericParamKind::Lifetime { kind: hir::LifetimeParamKind::Explicit } - = p.kind - else { return None }; + let hir::GenericParamKind::Lifetime { kind: hir::LifetimeParamKind::Explicit } = + p.kind + else { + return None; + }; let hir::ParamName::Plain(name) = p.name else { return None }; Some(name.to_string()) })); @@ -793,29 +795,36 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { num_trait_generics_except_self: usize, ) { let sm = self.tcx.sess.source_map(); - let hir::ExprKind::MethodCall(_, rcvr, args, _) = expr.kind else { return; }; + let hir::ExprKind::MethodCall(_, rcvr, args, _) = expr.kind else { + return; + }; if num_assoc_fn_excess_args != num_trait_generics_except_self { return; } - let Some(gen_args) = self.gen_args.span_ext() else { return; }; - let Ok(generics) = sm.span_to_snippet(gen_args) else { return; }; - let Ok(rcvr) = sm.span_to_snippet( - rcvr.span.find_ancestor_inside(expr.span).unwrap_or(rcvr.span) - ) else { return; }; - let Ok(rest) = - (match args { - [] => Ok(String::new()), - [arg] => sm.span_to_snippet( - arg.span.find_ancestor_inside(expr.span).unwrap_or(arg.span), - ), - [first, .., last] => { - let first_span = - first.span.find_ancestor_inside(expr.span).unwrap_or(first.span); - let last_span = - last.span.find_ancestor_inside(expr.span).unwrap_or(last.span); - sm.span_to_snippet(first_span.to(last_span)) - } - }) else { return; }; + let Some(gen_args) = self.gen_args.span_ext() else { + return; + }; + let Ok(generics) = sm.span_to_snippet(gen_args) else { + return; + }; + let Ok(rcvr) = + sm.span_to_snippet(rcvr.span.find_ancestor_inside(expr.span).unwrap_or(rcvr.span)) + else { + return; + }; + let Ok(rest) = (match args { + [] => Ok(String::new()), + [arg] => { + sm.span_to_snippet(arg.span.find_ancestor_inside(expr.span).unwrap_or(arg.span)) + } + [first, .., last] => { + let first_span = first.span.find_ancestor_inside(expr.span).unwrap_or(first.span); + let last_span = last.span.find_ancestor_inside(expr.span).unwrap_or(last.span); + sm.span_to_snippet(first_span.to(last_span)) + } + }) else { + return; + }; let comma = if args.len() > 0 { ", " } else { "" }; let trait_path = self.tcx.def_path_str(trait_def_id); let method_name = self.tcx.item_name(self.def_id); diff --git a/compiler/rustc_hir_typeck/src/_match.rs b/compiler/rustc_hir_typeck/src/_match.rs index e8720a5da02..6a27e78c594 100644 --- a/compiler/rustc_hir_typeck/src/_match.rs +++ b/compiler/rustc_hir_typeck/src/_match.rs @@ -188,11 +188,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let hir = self.tcx.hir(); // First, check that we're actually in the tail of a function. - let Some(body_id) = hir.maybe_body_owned_by(self.body_id) else { return; }; + let Some(body_id) = hir.maybe_body_owned_by(self.body_id) else { + return; + }; let body = hir.body(body_id); - let hir::ExprKind::Block(block, _) = body.value.kind else { return; }; - let Some(hir::Stmt { kind: hir::StmtKind::Semi(last_expr), .. }) - = block.innermost_block().stmts.last() else { return; }; + let hir::ExprKind::Block(block, _) = body.value.kind else { + return; + }; + let Some(hir::Stmt { kind: hir::StmtKind::Semi(last_expr), .. }) = + block.innermost_block().stmts.last() + else { + return; + }; if last_expr.hir_id != expr.hir_id { return; } @@ -201,7 +208,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let Some(ret) = hir .find_by_def_id(self.body_id) .and_then(|owner| owner.fn_decl()) - .map(|decl| decl.output.span()) else { return; }; + .map(|decl| decl.output.span()) + else { + return; + }; let Expectation::IsLast(stmt) = expectation else { return; }; @@ -508,9 +518,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { span, kind: TypeVariableOriginKind::OpaqueTypeInference(rpit_def_id), .. - } = self.type_var_origin(expected)? else { return None; }; + } = self.type_var_origin(expected)? + else { + return None; + }; - let Some(rpit_local_def_id) = rpit_def_id.as_local() else { return None; }; + let Some(rpit_local_def_id) = rpit_def_id.as_local() else { + return None; + }; if !matches!( self.tcx.hir().expect_item(rpit_local_def_id).expect_opaque_ty().origin, hir::OpaqueTyOrigin::FnReturn(..) diff --git a/compiler/rustc_hir_typeck/src/callee.rs b/compiler/rustc_hir_typeck/src/callee.rs index f306653c1ab..eb695d6b859 100644 --- a/compiler/rustc_hir_typeck/src/callee.rs +++ b/compiler/rustc_hir_typeck/src/callee.rs @@ -499,15 +499,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { expected: Expectation<'tcx>, ) { if let [callee_expr, rest @ ..] = arg_exprs { - let Some(callee_ty) = self.typeck_results.borrow().expr_ty_adjusted_opt(callee_expr) else { + let Some(callee_ty) = self.typeck_results.borrow().expr_ty_adjusted_opt(callee_expr) + else { return; }; // First, do a probe with `IsSuggestion(true)` to avoid emitting // any strange errors. If it's successful, then we'll do a true // method lookup. - let Ok(pick) = self - .lookup_probe_for_diagnostic( + let Ok(pick) = self.lookup_probe_for_diagnostic( segment.ident, callee_ty, call_expr, diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs index dc58d99ed9d..9ef01e37ac1 100644 --- a/compiler/rustc_hir_typeck/src/coercion.rs +++ b/compiler/rustc_hir_typeck/src/coercion.rs @@ -636,6 +636,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { Some(ty::PredicateKind::Clause(ty::ClauseKind::Trait(trait_pred))) if traits.contains(&trait_pred.def_id()) => { + let trait_pred = self.resolve_vars_if_possible(trait_pred); if unsize_did == trait_pred.def_id() { let self_ty = trait_pred.self_ty(); let unsize_ty = trait_pred.trait_ref.substs[1].expect_ty(); @@ -662,7 +663,6 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { // Uncertain or unimplemented. Ok(None) => { if trait_pred.def_id() == unsize_did { - let trait_pred = self.resolve_vars_if_possible(trait_pred); let self_ty = trait_pred.self_ty(); let unsize_ty = trait_pred.trait_ref.substs[1].expect_ty(); debug!("coerce_unsized: ambiguous unsize case for {:?}", trait_pred); @@ -1670,7 +1670,9 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> { expr: &hir::Expr<'tcx>, ret_exprs: &Vec<&'tcx hir::Expr<'tcx>>, ) { - let hir::ExprKind::Loop(_, _, _, loop_span) = expr.kind else { return;}; + let hir::ExprKind::Loop(_, _, _, loop_span) = expr.kind else { + return; + }; let mut span: MultiSpan = vec![loop_span].into(); span.push_span_label(loop_span, "this might have zero elements to iterate on"); const MAXITER: usize = 3; diff --git a/compiler/rustc_hir_typeck/src/demand.rs b/compiler/rustc_hir_typeck/src/demand.rs index cc8198aab25..80db01e08db 100644 --- a/compiler/rustc_hir_typeck/src/demand.rs +++ b/compiler/rustc_hir_typeck/src/demand.rs @@ -102,7 +102,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { found_expr: &mut &'tcx hir::Expr<'tcx>, expected_expr: &mut Option<&'tcx hir::Expr<'tcx>>, ) { - let Some(expected_expr) = expected_expr else { return; }; + let Some(expected_expr) = expected_expr else { + return; + }; if !found_expr.span.eq_ctxt(expected_expr.span) { return; @@ -121,11 +123,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let hir::ExprKind::Unary( hir::UnOp::Deref, hir::Expr { kind: hir::ExprKind::Path(found_path), .. }, - ) = found_expr.kind else { return; }; + ) = found_expr.kind + else { + return; + }; let hir::ExprKind::Unary( hir::UnOp::Deref, hir::Expr { kind: hir::ExprKind::Path(expected_path), .. }, - ) = expected_expr.kind else { return; }; + ) = expected_expr.kind + else { + return; + }; for (path, name, idx, var) in [ (expected_path, "left_val", 0, expected_expr), @@ -285,16 +293,26 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ) -> bool { let hir = self.tcx.hir(); - let hir::ExprKind::Path(hir::QPath::Resolved(None, p)) = expr.kind else { return false; }; - let [hir::PathSegment { ident, args: None, .. }] = p.segments else { return false; }; - let hir::def::Res::Local(local_hir_id) = p.res else { return false; }; - let hir::Node::Pat(pat) = hir.get(local_hir_id) else { return false; }; + let hir::ExprKind::Path(hir::QPath::Resolved(None, p)) = expr.kind else { + return false; + }; + let [hir::PathSegment { ident, args: None, .. }] = p.segments else { + return false; + }; + let hir::def::Res::Local(local_hir_id) = p.res else { + return false; + }; + let hir::Node::Pat(pat) = hir.get(local_hir_id) else { + return false; + }; let (init_ty_hir_id, init) = match hir.get_parent(pat.hir_id) { hir::Node::Local(hir::Local { ty: Some(ty), init, .. }) => (ty.hir_id, *init), hir::Node::Local(hir::Local { init: Some(init), .. }) => (init.hir_id, Some(*init)), _ => return false, }; - let Some(init_ty) = self.node_ty_opt(init_ty_hir_id) else { return false; }; + let Some(init_ty) = self.node_ty_opt(init_ty_hir_id) else { + return false; + }; // Locate all the usages of the relevant binding. struct FindExprs<'tcx> { @@ -413,14 +431,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Bindings always update their recorded type after the fact, so we // need to look at the *following* usage's type to see when the // binding became incompatible. - let [binding, next_usage] = *window else { continue; }; + let [binding, next_usage] = *window else { + continue; + }; // Don't go past the binding (always gonna be a nonsense label if so) if binding.hir_id == expr.hir_id { break; } - let Some(next_use_ty) = self.node_ty_opt(next_usage.hir_id) else { continue; }; + let Some(next_use_ty) = self.node_ty_opt(next_usage.hir_id) else { + continue; + }; // If the type is not constrained in a way making it not possible to // equate with `expected_ty` by this point, skip. @@ -634,27 +656,36 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { error: Option<TypeError<'tcx>>, ) { let parent = self.tcx.hir().parent_id(expr.hir_id); - let Some(TypeError::Sorts(ExpectedFound { expected, .. })) = error else {return;}; - let Some(hir::Node::Expr(hir::Expr { - kind: hir::ExprKind::Assign(lhs, rhs, _), .. - })) = self.tcx.hir().find(parent) else {return; }; + let Some(TypeError::Sorts(ExpectedFound { expected, .. })) = error else { + return; + }; + let Some(hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Assign(lhs, rhs, _), .. })) = + self.tcx.hir().find(parent) + else { + return; + }; if rhs.hir_id != expr.hir_id || expected.is_closure() { return; } - let hir::ExprKind::Unary(hir::UnOp::Deref, deref) = lhs.kind else { return; }; - let hir::ExprKind::MethodCall(path, base, args, _) = deref.kind else { return; }; - let Some(self_ty) = self.typeck_results.borrow().expr_ty_adjusted_opt(base) else { return; }; + let hir::ExprKind::Unary(hir::UnOp::Deref, deref) = lhs.kind else { + return; + }; + let hir::ExprKind::MethodCall(path, base, args, _) = deref.kind else { + return; + }; + let Some(self_ty) = self.typeck_results.borrow().expr_ty_adjusted_opt(base) else { + return; + }; - let Ok(pick) = self - .lookup_probe_for_diagnostic( - path.ident, - self_ty, - deref, - probe::ProbeScope::TraitsInScope, - None, - ) else { - return; - }; + let Ok(pick) = self.lookup_probe_for_diagnostic( + path.ident, + self_ty, + deref, + probe::ProbeScope::TraitsInScope, + None, + ) else { + return; + }; let in_scope_methods = self.probe_for_name_many( probe::Mode::MethodCall, path.ident, @@ -793,8 +824,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { expected: Ty<'tcx>, found: Ty<'tcx>, ) -> bool { - let ty::Adt(e, substs_e) = expected.kind() else { return false; }; - let ty::Adt(f, substs_f) = found.kind() else { return false; }; + let ty::Adt(e, substs_e) = expected.kind() else { + return false; + }; + let ty::Adt(f, substs_f) = found.kind() else { + return false; + }; if e.did() != f.did() { return false; } @@ -1039,7 +1074,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // In case Option<NonZero*> is wanted, but * is provided, suggest calling new ty::Adt(adt, substs) if tcx.is_diagnostic_item(sym::Option, adt.did()) => { // Unwrap option - let ty::Adt(adt, _) = substs.type_at(0).kind() else { return false; }; + let ty::Adt(adt, _) = substs.type_at(0).kind() else { + return false; + }; (adt, "") } @@ -1061,10 +1098,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { (sym::NonZeroI128, tcx.types.i128), ]; - let Some((s, _)) = map - .iter() - .find(|&&(s, t)| self.tcx.is_diagnostic_item(s, adt.did()) && self.can_coerce(expr_ty, t)) - else { return false; }; + let Some((s, _)) = map.iter().find(|&&(s, t)| { + self.tcx.is_diagnostic_item(s, adt.did()) && self.can_coerce(expr_ty, t) + }) else { + return false; + }; let path = self.tcx.def_path_str(adt.non_enum_variant().def_id); @@ -1152,7 +1190,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }; let local_parent = self.tcx.hir().parent_id(local_id); - let Some(Node::Param(hir::Param { hir_id: param_hir_id, .. })) = self.tcx.hir().find(local_parent) else { + let Some(Node::Param(hir::Param { hir_id: param_hir_id, .. })) = + self.tcx.hir().find(local_parent) + else { return None; }; @@ -1161,7 +1201,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { hir_id: expr_hir_id, kind: hir::ExprKind::Closure(hir::Closure { fn_decl: closure_fn_decl, .. }), .. - })) = self.tcx.hir().find(param_parent) else { + })) = self.tcx.hir().find(param_parent) + else { return None; }; @@ -1174,7 +1215,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .. })), 1, - ) = (hir, closure_params_len) else { + ) = (hir, closure_params_len) + else { return None; }; @@ -2028,11 +2070,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if !hir::is_range_literal(expr) { return; } - let hir::ExprKind::Struct( - hir::QPath::LangItem(LangItem::Range, ..), - [start, end], - _, - ) = expr.kind else { return; }; + let hir::ExprKind::Struct(hir::QPath::LangItem(LangItem::Range, ..), [start, end], _) = + expr.kind + else { + return; + }; let parent = self.tcx.hir().parent_id(expr.hir_id); if let Some(hir::Node::ExprField(_)) = self.tcx.hir().find(parent) { // Ignore `Foo { field: a..Default::default() }` @@ -2048,8 +2090,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // cannot guide the method probe. expectation = None; } - let hir::ExprKind::Call(method_name, _) = expr.kind else { return; }; - let ty::Adt(adt, _) = checked_ty.kind() else { return; }; + let hir::ExprKind::Call(method_name, _) = expr.kind else { + return; + }; + let ty::Adt(adt, _) = checked_ty.kind() else { + return; + }; if self.tcx.lang_items().range_struct() != Some(adt.did()) { return; } @@ -2059,8 +2105,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { return; } // Check if start has method named end. - let hir::ExprKind::Path(hir::QPath::Resolved(None, p)) = method_name.kind else { return; }; - let [hir::PathSegment { ident, .. }] = p.segments else { return; }; + let hir::ExprKind::Path(hir::QPath::Resolved(None, p)) = method_name.kind else { + return; + }; + let [hir::PathSegment { ident, .. }] = p.segments else { + return; + }; let self_ty = self.typeck_results.borrow().expr_ty(start.expr); let Ok(_pick) = self.lookup_probe_for_diagnostic( *ident, @@ -2068,7 +2118,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { expr, probe::ProbeScope::AllTraits, expectation, - ) else { return; }; + ) else { + return; + }; let mut sugg = "."; let mut span = start.expr.span.between(end.expr.span); if span.lo() + BytePos(2) == span.hi() { @@ -2097,17 +2149,23 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if !checked_ty.is_unit() { return; } - let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = expr.kind else { return; }; - let hir::def::Res::Local(hir_id) = path.res else { return; }; + let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = expr.kind else { + return; + }; + let hir::def::Res::Local(hir_id) = path.res else { + return; + }; let Some(hir::Node::Pat(pat)) = self.tcx.hir().find(hir_id) else { return; }; - let Some(hir::Node::Local(hir::Local { - ty: None, - init: Some(init), - .. - })) = self.tcx.hir().find_parent(pat.hir_id) else { return; }; - let hir::ExprKind::Block(block, None) = init.kind else { return; }; + let Some(hir::Node::Local(hir::Local { ty: None, init: Some(init), .. })) = + self.tcx.hir().find_parent(pat.hir_id) + else { + return; + }; + let hir::ExprKind::Block(block, None) = init.kind else { + return; + }; if block.expr.is_some() { return; } @@ -2115,8 +2173,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_label(block.span, "this empty block is missing a tail expression"); return; }; - let hir::StmtKind::Semi(tail_expr) = stmt.kind else { return; }; - let Some(ty) = self.node_ty_opt(tail_expr.hir_id) else { return; }; + let hir::StmtKind::Semi(tail_expr) = stmt.kind else { + return; + }; + let Some(ty) = self.node_ty_opt(tail_expr.hir_id) else { + return; + }; if self.can_eq(self.param_env, expected_ty, ty) { err.span_suggestion_short( stmt.span.with_lo(tail_expr.span.hi()), @@ -2135,7 +2197,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { expr: &hir::Expr<'_>, checked_ty: Ty<'tcx>, ) { - let Some(hir::Node::Expr(parent_expr)) = self.tcx.hir().find_parent(expr.hir_id) else { return; }; + let Some(hir::Node::Expr(parent_expr)) = self.tcx.hir().find_parent(expr.hir_id) else { + return; + }; enum CallableKind { Function, Method, @@ -2151,7 +2215,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { return; } let fn_sig = fn_ty.fn_sig(self.tcx).skip_binder(); - let Some(&arg) = fn_sig.inputs().get(arg_idx + if matches!(kind, CallableKind::Method) { 1 } else { 0 }) else { return; }; + let Some(&arg) = fn_sig + .inputs() + .get(arg_idx + if matches!(kind, CallableKind::Method) { 1 } else { 0 }) + else { + return; + }; if matches!(arg.kind(), ty::Param(_)) && fn_sig.output().contains(arg) && self.node_ty(args[arg_idx].hir_id) == checked_ty @@ -2185,8 +2254,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }; match parent_expr.kind { hir::ExprKind::Call(fun, args) => { - let hir::ExprKind::Path(hir::QPath::Resolved(_, path)) = fun.kind else { return; }; - let hir::def::Res::Def(kind, def_id) = path.res else { return; }; + let hir::ExprKind::Path(hir::QPath::Resolved(_, path)) = fun.kind else { + return; + }; + let hir::def::Res::Def(kind, def_id) = path.res else { + return; + }; let callable_kind = if matches!(kind, hir::def::DefKind::Ctor(_, _)) { CallableKind::Constructor } else { @@ -2195,7 +2268,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { maybe_emit_help(def_id, path.segments[0].ident, args, callable_kind); } hir::ExprKind::MethodCall(method, _receiver, args, _span) => { - let Some(def_id) = self.typeck_results.borrow().type_dependent_def_id(parent_expr.hir_id) else { return; }; + let Some(def_id) = + self.typeck_results.borrow().type_dependent_def_id(parent_expr.hir_id) + else { + return; + }; maybe_emit_help(def_id, method.ident, args, CallableKind::Method) } _ => return, diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 72b29f7b6e9..6e3c117dd9e 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -650,7 +650,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let mut enclosing_breakables = self.enclosing_breakables.borrow_mut(); let Some(ctxt) = enclosing_breakables.opt_find_breakable(target_id) else { // Avoid ICE when `break` is inside a closure (#65383). - return Ty::new_error_with_message(tcx, + return Ty::new_error_with_message( + tcx, expr.span, "break was outside loop, but no error was emitted", ); @@ -1390,11 +1391,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let parent_node = self.tcx.hir().parent_iter(expr.hir_id).find(|(_, node)| { !matches!(node, hir::Node::Expr(hir::Expr { kind: hir::ExprKind::AddrOf(..), .. })) }); - let Some((_, + let Some(( + _, hir::Node::Local(hir::Local { ty: Some(ty), .. }) - | hir::Node::Item(hir::Item { kind: hir::ItemKind::Const(ty, _), .. })) - ) = parent_node else { - return + | hir::Node::Item(hir::Item { kind: hir::ItemKind::Const(ty, _), .. }), + )) = parent_node + else { + return; }; if let hir::TyKind::Array(_, length) = ty.peel_refs().kind && let hir::ArrayLen::Body(hir::AnonConst { hir_id, .. }) = length @@ -2416,7 +2419,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { base: &'tcx hir::Expr<'tcx>, ty: Ty<'tcx>, ) { - let Some(output_ty) = self.get_impl_future_output_ty(ty) else { return; }; + let Some(output_ty) = self.get_impl_future_output_ty(ty) else { + return; + }; let mut add_label = true; if let ty::Adt(def, _) = output_ty.kind() { // no field access on enum type diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs index ed9bb4945af..b3ee284d8d7 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs @@ -14,14 +14,27 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { &self, error: &mut traits::FulfillmentError<'tcx>, ) -> bool { - let (traits::ExprItemObligation(def_id, hir_id, idx) | traits::ExprBindingObligation(def_id, _, hir_id, idx)) - = *error.obligation.cause.code().peel_derives() else { return false; }; + let (traits::ExprItemObligation(def_id, hir_id, idx) + | traits::ExprBindingObligation(def_id, _, hir_id, idx)) = + *error.obligation.cause.code().peel_derives() + else { + return false; + }; let hir = self.tcx.hir(); - let hir::Node::Expr(expr) = hir.get(hir_id) else { return false; }; + let hir::Node::Expr(expr) = hir.get(hir_id) else { + return false; + }; - let Some(unsubstituted_pred) = - self.tcx.predicates_of(def_id).instantiate_identity(self.tcx).predicates.into_iter().nth(idx) - else { return false; }; + let Some(unsubstituted_pred) = self + .tcx + .predicates_of(def_id) + .instantiate_identity(self.tcx) + .predicates + .into_iter() + .nth(idx) + else { + return false; + }; let generics = self.tcx.generics_of(def_id); let predicate_substs = match unsubstituted_pred.kind().skip_binder() { @@ -229,14 +242,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .tcx .generics_of(def_id) .own_substs(ty::InternalSubsts::identity_for_item(self.tcx, def_id)); - let Some((index, _)) = own_substs - .iter() - .enumerate() - .find(|(_, arg)| **arg == param_to_point_at) else { return false }; - let Some(arg) = segment - .args() - .args - .get(index) else { return false; }; + let Some((index, _)) = + own_substs.iter().enumerate().find(|(_, arg)| **arg == param_to_point_at) + else { + return false; + }; + let Some(arg) = segment.args().args.get(index) else { + return false; + }; error.obligation.cause.span = arg .span() .find_ancestor_in_same_ctxt(error.obligation.cause.span) @@ -573,9 +586,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Find out which of `in_ty_elements` refer to `param`. // FIXME: It may be better to take the first if there are multiple, // just so that the error points to a smaller expression. - let Some((drill_expr, drill_ty)) = is_iterator_singleton(expr_elements.iter().zip( in_ty_elements.iter()).filter(|(_expr_elem, in_ty_elem)| { - find_param_in_ty((*in_ty_elem).into(), param) - })) else { + let Some((drill_expr, drill_ty)) = + is_iterator_singleton(expr_elements.iter().zip(in_ty_elements.iter()).filter( + |(_expr_elem, in_ty_elem)| find_param_in_ty((*in_ty_elem).into(), param), + )) + else { // The param is not mentioned, or it is mentioned in multiple indexes. return Err(expr); }; @@ -594,7 +609,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { { // First, confirm that this struct is the same one as in the types, and if so, // find the right variant. - let Res::Def(expr_struct_def_kind, expr_struct_def_id) = self.typeck_results.borrow().qpath_res(expr_struct_path, expr.hir_id) else { + let Res::Def(expr_struct_def_kind, expr_struct_def_id) = + self.typeck_results.borrow().qpath_res(expr_struct_path, expr.hir_id) + else { return Err(expr); }; @@ -621,16 +638,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // We need to know which of the generic parameters mentions our target param. // We expect that at least one of them does, since it is expected to be mentioned. - let Some((drill_generic_index, generic_argument_type)) = - is_iterator_singleton( - in_ty_adt_generic_args.iter().enumerate().filter( - |(_index, in_ty_generic)| { - find_param_in_ty(*in_ty_generic, param) - }, - ), - ) else { - return Err(expr); - }; + let Some((drill_generic_index, generic_argument_type)) = is_iterator_singleton( + in_ty_adt_generic_args + .iter() + .enumerate() + .filter(|(_index, in_ty_generic)| find_param_in_ty(*in_ty_generic, param)), + ) else { + return Err(expr); + }; let struct_generic_parameters: &ty::Generics = self.tcx.generics_of(in_ty_adt.did()); if drill_generic_index >= struct_generic_parameters.params.len() { @@ -703,7 +718,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }; // This is (possibly) a constructor call, like `Some(...)` or `MyStruct(a, b, c)`. - let Res::Def(expr_struct_def_kind, expr_ctor_def_id) = self.typeck_results.borrow().qpath_res(expr_callee_path, expr_callee.hir_id) else { + let Res::Def(expr_struct_def_kind, expr_ctor_def_id) = + self.typeck_results.borrow().qpath_res(expr_callee_path, expr_callee.hir_id) + else { return Err(expr); }; @@ -744,16 +761,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // We need to know which of the generic parameters mentions our target param. // We expect that at least one of them does, since it is expected to be mentioned. - let Some((drill_generic_index, generic_argument_type)) = - is_iterator_singleton( - in_ty_adt_generic_args.iter().enumerate().filter( - |(_index, in_ty_generic)| { - find_param_in_ty(*in_ty_generic, param) - }, - ), - ) else { - return Err(expr); - }; + let Some((drill_generic_index, generic_argument_type)) = is_iterator_singleton( + in_ty_adt_generic_args + .iter() + .enumerate() + .filter(|(_index, in_ty_generic)| find_param_in_ty(*in_ty_generic, param)), + ) else { + return Err(expr); + }; let struct_generic_parameters: &ty::Generics = self.tcx.generics_of(in_ty_adt.did()); if drill_generic_index >= struct_generic_parameters.params.len() { @@ -794,7 +809,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .iter() .map(|field| field.ty(self.tcx, *in_ty_adt_generic_args)) .enumerate() - .filter(|(_index, field_type)| find_param_in_ty((*field_type).into(), param)) + .filter(|(_index, field_type)| find_param_in_ty((*field_type).into(), param)), ) else { return Err(expr); }; diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index 41f5fafe72f..5c5aef33413 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -753,11 +753,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } errors.retain(|error| { - let Error::Invalid( - provided_idx, - expected_idx, - Compatibility::Incompatible(Some(e)), - ) = error else { return true }; + let Error::Invalid(provided_idx, expected_idx, Compatibility::Incompatible(Some(e))) = + error + else { + return true; + }; let (provided_ty, provided_span) = provided_arg_tys[*provided_idx]; let trace = mk_trace(provided_span, formal_and_expected_inputs[*expected_idx], provided_ty); diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs index 79a7c016185..5d80137f212 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs @@ -97,8 +97,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { found: Ty<'tcx>, can_satisfy: impl FnOnce(Ty<'tcx>) -> bool, ) -> bool { - let Some((def_id_or_name, output, inputs)) = self.extract_callable_info(found) - else { return false; }; + let Some((def_id_or_name, output, inputs)) = self.extract_callable_info(found) else { + return false; + }; if can_satisfy(output) { let (sugg_call, mut applicability) = match inputs.len() { 0 => ("".to_string(), Applicability::MachineApplicable), @@ -180,10 +181,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { rhs_ty: Ty<'tcx>, can_satisfy: impl FnOnce(Ty<'tcx>, Ty<'tcx>) -> bool, ) -> bool { - let Some((_, lhs_output_ty, lhs_inputs)) = self.extract_callable_info(lhs_ty) - else { return false; }; - let Some((_, rhs_output_ty, rhs_inputs)) = self.extract_callable_info(rhs_ty) - else { return false; }; + let Some((_, lhs_output_ty, lhs_inputs)) = self.extract_callable_info(lhs_ty) else { + return false; + }; + let Some((_, rhs_output_ty, rhs_inputs)) = self.extract_callable_info(rhs_ty) else { + return false; + }; if can_satisfy(lhs_output_ty, rhs_output_ty) { let mut sugg = vec![]; @@ -635,7 +638,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // is and we were expecting a Box, ergo Pin<Box<expected>>, we // can suggest Box::pin. let parent = self.tcx.hir().parent_id(expr.hir_id); - let Some(Node::Expr(Expr { kind: ExprKind::Call(fn_name, _), .. })) = self.tcx.hir().find(parent) else { + let Some(Node::Expr(Expr { kind: ExprKind::Call(fn_name, _), .. })) = + self.tcx.hir().find(parent) + else { return false; }; match fn_name.kind { @@ -850,12 +855,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn( - hir::FnSig { decl: hir::FnDecl { inputs: fn_parameters, output: fn_return, .. }, .. }, + hir::FnSig { + decl: hir::FnDecl { inputs: fn_parameters, output: fn_return, .. }, + .. + }, hir::Generics { params, predicates, .. }, _body_id, ), .. - })) = fn_node else { return }; + })) = fn_node + else { + return; + }; if params.get(expected_ty_as_param.index as usize).is_none() { return; @@ -1081,8 +1092,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { expr_ty: Ty<'tcx>, expected_ty: Ty<'tcx>, ) -> bool { - let ty::Adt(adt_def, substs) = expr_ty.kind() else { return false; }; - let ty::Adt(expected_adt_def, expected_substs) = expected_ty.kind() else { return false; }; + let ty::Adt(adt_def, substs) = expr_ty.kind() else { + return false; + }; + let ty::Adt(expected_adt_def, expected_substs) = expected_ty.kind() else { + return false; + }; if adt_def != expected_adt_def { return false; } @@ -1205,7 +1220,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { return false; } - let ty::Adt(def, _) = expr_ty.peel_refs().kind() else { return false; }; + let ty::Adt(def, _) = expr_ty.peel_refs().kind() else { + return false; + }; if !self.tcx.is_diagnostic_item(sym::Option, def.did()) { return false; } @@ -1327,7 +1344,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { node: rustc_ast::LitKind::Int(lit, rustc_ast::LitIntType::Unsuffixed), span, }) => { - let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(*span) else { return false; }; + let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(*span) else { + return false; + }; if !(snippet.starts_with("0x") || snippet.starts_with("0X")) { return false; } @@ -1367,10 +1386,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }; // Provided expression needs to be a literal `0`. - let ExprKind::Lit(Spanned { - node: rustc_ast::LitKind::Int(0, _), - span, - }) = expr.kind else { + let ExprKind::Lit(Spanned { node: rustc_ast::LitKind::Int(0, _), span }) = expr.kind else { return false; }; @@ -1401,7 +1417,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { expr: &hir::Expr<'_>, expected_ty: Ty<'tcx>, ) -> bool { - let Some((DefKind::AssocFn, old_def_id)) = self.typeck_results.borrow().type_dependent_def(expr.hir_id) else { + let Some((DefKind::AssocFn, old_def_id)) = + self.typeck_results.borrow().type_dependent_def(expr.hir_id) + else { return false; }; let old_item_name = self.tcx.item_name(old_def_id); @@ -1494,8 +1512,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { found_ty: Ty<'tcx>, expr: &hir::Expr<'_>, ) { - let hir::ExprKind::MethodCall(segment, callee_expr, &[], _) = expr.kind else { return; }; - let Some(clone_trait_did) = self.tcx.lang_items().clone_trait() else { return; }; + let hir::ExprKind::MethodCall(segment, callee_expr, &[], _) = expr.kind else { + return; + }; + let Some(clone_trait_did) = self.tcx.lang_items().clone_trait() else { + return; + }; let ty::Ref(_, pointee_ty, _) = found_ty.kind() else { return }; let results = self.typeck_results.borrow(); // First, look for a `Clone::clone` call diff --git a/compiler/rustc_hir_typeck/src/method/confirm.rs b/compiler/rustc_hir_typeck/src/method/confirm.rs index 87edb803148..168eb3a6cdc 100644 --- a/compiler/rustc_hir_typeck/src/method/confirm.rs +++ b/compiler/rustc_hir_typeck/src/method/confirm.rs @@ -171,7 +171,8 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { // time writing the results into the various typeck results. let mut autoderef = self.autoderef(self.call_expr.span, unadjusted_self_ty); let Some((ty, n)) = autoderef.nth(pick.autoderefs) else { - return Ty::new_error_with_message(self.tcx, + return Ty::new_error_with_message( + self.tcx, rustc_span::DUMMY_SP, format!("failed autoderef {}", pick.autoderefs), ); diff --git a/compiler/rustc_hir_typeck/src/method/probe.rs b/compiler/rustc_hir_typeck/src/method/probe.rs index 03a3eebbdf5..45c9f15c0d5 100644 --- a/compiler/rustc_hir_typeck/src/method/probe.rs +++ b/compiler/rustc_hir_typeck/src/method/probe.rs @@ -1938,13 +1938,21 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { /// Determine if the associated item withe the given DefId matches /// the desired name via a doc alias. fn matches_by_doc_alias(&self, def_id: DefId) -> bool { - let Some(name) = self.method_name else { return false; }; - let Some(local_def_id) = def_id.as_local() else { return false; }; + let Some(name) = self.method_name else { + return false; + }; + let Some(local_def_id) = def_id.as_local() else { + return false; + }; let hir_id = self.fcx.tcx.hir().local_def_id_to_hir_id(local_def_id); let attrs = self.fcx.tcx.hir().attrs(hir_id); for attr in attrs { - let sym::doc = attr.name_or_empty() else { continue; }; - let Some(values) = attr.meta_item_list() else { continue; }; + let sym::doc = attr.name_or_empty() else { + continue; + }; + let Some(values) = attr.meta_item_list() else { + continue; + }; for v in values { if v.name_or_empty() != sym::alias { continue; diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index 5f924f30936..7bdbcc56da4 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -1699,10 +1699,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// we try to suggest `rect.area()` pub(crate) fn suggest_assoc_method_call(&self, segs: &[PathSegment<'_>]) { debug!("suggest_assoc_method_call segs: {:?}", segs); - let [seg1, seg2] = segs else { return; }; + let [seg1, seg2] = segs else { + return; + }; let Some(mut diag) = - self.tcx.sess.diagnostic().steal_diagnostic(seg1.ident.span, StashKey::CallAssocMethod) - else { return }; + self.tcx.sess.diagnostic().steal_diagnostic(seg1.ident.span, StashKey::CallAssocMethod) + else { + return; + }; let map = self.infcx.tcx.hir(); let body_id = self.tcx.hir().body_owned_by(self.body_id); @@ -1839,17 +1843,23 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { item_name: Ident, ) { let tcx = self.tcx; - let SelfSource::MethodCall(expr) = source else { return; }; + let SelfSource::MethodCall(expr) = source else { + return; + }; let call_expr = tcx.hir().expect_expr(tcx.hir().parent_id(expr.hir_id)); - let ty::Adt(kind, substs) = actual.kind() else { return; }; + let ty::Adt(kind, substs) = actual.kind() else { + return; + }; match kind.adt_kind() { ty::AdtKind::Enum => { let matching_variants: Vec<_> = kind .variants() .iter() .flat_map(|variant| { - let [field] = &variant.fields.raw[..] else { return None; }; + let [field] = &variant.fields.raw[..] else { + return None; + }; let field_ty = field.ty(tcx, substs); // Skip `_`, since that'll just lead to ambiguity. @@ -1927,15 +1937,21 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Target wrapper types - types that wrap or pretend to wrap another type, // perhaps this inner type is meant to be called? ty::AdtKind::Struct | ty::AdtKind::Union => { - let [first] = ***substs else { return; }; - let ty::GenericArgKind::Type(ty) = first.unpack() else { return; }; + let [first] = ***substs else { + return; + }; + let ty::GenericArgKind::Type(ty) = first.unpack() else { + return; + }; let Ok(pick) = self.lookup_probe_for_diagnostic( item_name, ty, call_expr, ProbeScope::TraitsInScope, None, - ) else { return; }; + ) else { + return; + }; let name = self.ty_to_value_string(actual); let inner_id = kind.did(); @@ -2100,7 +2116,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let Some(ty::PredicateKind::Clause(ty::ClauseKind::Trait(trait_pred))) = pred.kind().no_bound_vars() else { - continue + continue; }; let adt = match trait_pred.self_ty().ty_adt_def() { Some(adt) if adt.did().is_local() => adt, @@ -2197,7 +2213,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { item_name: Ident, expected: Expectation<'tcx>, ) { - let SelfSource::QPath(ty) = self_source else { return; }; + let SelfSource::QPath(ty) = self_source else { + return; + }; for (deref_ty, _) in self.autoderef(rustc_span::DUMMY_SP, rcvr_ty).skip(1) { if let Ok(pick) = self.probe_for_name( Mode::Path, @@ -2834,9 +2852,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { found: Ty<'tcx>, expected: Ty<'tcx>, ) -> bool { - let Some((_def_id_or_name, output, _inputs)) = - self.extract_callable_info(found) else { - return false; + let Some((_def_id_or_name, output, _inputs)) = self.extract_callable_info(found) else { + return false; }; if !self.can_coerce(output, expected) { diff --git a/compiler/rustc_hir_typeck/src/rvalue_scopes.rs b/compiler/rustc_hir_typeck/src/rvalue_scopes.rs index 22c9e796107..091e88abe97 100644 --- a/compiler/rustc_hir_typeck/src/rvalue_scopes.rs +++ b/compiler/rustc_hir_typeck/src/rvalue_scopes.rs @@ -74,9 +74,7 @@ pub fn resolve_rvalue_scopes<'a, 'tcx>( debug!("start resolving rvalue scopes, def_id={def_id:?}"); debug!("rvalue_scope: rvalue_candidates={:?}", scope_tree.rvalue_candidates); for (&hir_id, candidate) in &scope_tree.rvalue_candidates { - let Some(Node::Expr(expr)) = hir_map.find(hir_id) else { - bug!("hir node does not exist") - }; + let Some(Node::Expr(expr)) = hir_map.find(hir_id) else { bug!("hir node does not exist") }; record_rvalue_scope(&mut rvalue_scopes, expr, candidate); } rvalue_scopes diff --git a/compiler/rustc_hir_typeck/src/upvar.rs b/compiler/rustc_hir_typeck/src/upvar.rs index 208c40a3932..93ef0d6ff53 100644 --- a/compiler/rustc_hir_typeck/src/upvar.rs +++ b/compiler/rustc_hir_typeck/src/upvar.rs @@ -644,7 +644,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { for capture in captures { match capture.info.capture_kind { ty::UpvarCapture::ByRef(_) => { - let PlaceBase::Upvar(upvar_id) = capture.place.base else { bug!("expected upvar") }; + let PlaceBase::Upvar(upvar_id) = capture.place.base else { + bug!("expected upvar") + }; let origin = UpvarRegion(upvar_id, closure_span); let upvar_region = self.next_region_var(origin); capture.region = Some(upvar_region); @@ -1064,14 +1066,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // ``` debug!("no path starting from it is used"); - match closure_clause { // Only migrate if closure is a move closure hir::CaptureBy::Value => { let mut diagnostics_info = FxHashSet::default(); - let upvars = self.tcx.upvars_mentioned(closure_def_id).expect("must be an upvar"); + let upvars = + self.tcx.upvars_mentioned(closure_def_id).expect("must be an upvar"); let upvar = upvars[&var_hir_id]; - diagnostics_info.insert(UpvarMigrationInfo::CapturingNothing { use_span: upvar.span }); + diagnostics_info + .insert(UpvarMigrationInfo::CapturingNothing { use_span: upvar.span }); return Some(diagnostics_info); } hir::CaptureBy::Ref => {} diff --git a/compiler/rustc_incremental/src/persist/fs.rs b/compiler/rustc_incremental/src/persist/fs.rs index 7708deecec7..929a1e149b6 100644 --- a/compiler/rustc_incremental/src/persist/fs.rs +++ b/compiler/rustc_incremental/src/persist/fs.rs @@ -730,13 +730,13 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> { debug!("garbage_collect_session_directories() - inspecting: {}", directory_name); let Ok(timestamp) = extract_timestamp_from_session_dir(directory_name) else { - debug!( - "found session-dir with malformed timestamp: {}", - crate_directory.join(directory_name).display() - ); - // Ignore it - return None; - }; + debug!( + "found session-dir with malformed timestamp: {}", + crate_directory.join(directory_name).display() + ); + // Ignore it + return None; + }; if is_finalized(directory_name) { let lock_file_path = crate_directory.join(lock_file_name); diff --git a/compiler/rustc_index/src/bit_set.rs b/compiler/rustc_index/src/bit_set.rs index 15bc3b4e388..12a7ecf8133 100644 --- a/compiler/rustc_index/src/bit_set.rs +++ b/compiler/rustc_index/src/bit_set.rs @@ -804,9 +804,7 @@ impl<'a, T: Idx> Iterator for ChunkedBitIter<'a, T> { // advance the iterator to the start of the next chunk, before proceeding in chunk sized // steps. while self.index % CHUNK_BITS != 0 { - let Some(item) = self.next() else { - return init - }; + let Some(item) = self.next() else { return init }; init = f(init, item); } let start_chunk = self.index / CHUNK_BITS; diff --git a/compiler/rustc_infer/src/errors/mod.rs b/compiler/rustc_infer/src/errors/mod.rs index 7e1fa08f23a..1ffa8633afd 100644 --- a/compiler/rustc_infer/src/errors/mod.rs +++ b/compiler/rustc_infer/src/errors/mod.rs @@ -363,7 +363,8 @@ impl AddToDiagnostic for AddLifetimeParamsSuggestion<'_> { let ( hir::Ty { kind: hir::TyKind::Ref(lifetime_sub, _), .. }, hir::Ty { kind: hir::TyKind::Ref(lifetime_sup, _), .. }, - ) = (self.ty_sub, self.ty_sup) else { + ) = (self.ty_sub, self.ty_sup) + else { return false; }; diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index b826ced0453..37249b62e8b 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -2109,14 +2109,13 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { found: Ty<'tcx>, expected_fields: &List<Ty<'tcx>>, ) -> Option<TypeErrorAdditionalDiags> { - let [expected_tup_elem] = expected_fields[..] else { return None}; + let [expected_tup_elem] = expected_fields[..] else { return None }; if !self.same_type_modulo_infer(expected_tup_elem, found) { return None; } - let Ok(code) = self.tcx.sess().source_map().span_to_snippet(span) - else { return None }; + let Ok(code) = self.tcx.sess().source_map().span_to_snippet(span) else { return None }; let sugg = if code.starts_with('(') && code.ends_with(')') { let before_close = span.hi() - BytePos::from_u32(1); diff --git a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs index a90a41f5d70..d192624b17e 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs @@ -419,7 +419,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { } let Some(InferSource { span, kind }) = local_visitor.infer_source else { - return self.bad_inference_failure_err(failure_span, arg_data, error_code) + return self.bad_inference_failure_err(failure_span, arg_data, error_code); }; let (source_kind, name) = kind.ty_localized_msg(self); @@ -1157,9 +1157,7 @@ impl<'a, 'tcx> Visitor<'tcx> for FindInferSourceVisitor<'a, 'tcx> { continue; } - let Some(param_ty) = self.opt_node_type(param.hir_id) else { - continue - }; + let Some(param_ty) = self.opt_node_type(param.hir_id) else { continue }; if self.generic_arg_contains_target(param_ty.into()) { self.update_infer_source(InferSource { diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mismatched_static_lifetime.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mismatched_static_lifetime.rs index 2c63a390410..d46dd8f3268 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mismatched_static_lifetime.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mismatched_static_lifetime.rs @@ -38,8 +38,9 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { let ObligationCauseCode::MatchImpl(parent, impl_def_id) = code else { return None; }; - let (ObligationCauseCode::BindingObligation(_, binding_span) | ObligationCauseCode::ExprBindingObligation(_, binding_span, ..)) - = *parent.code() else { + let (ObligationCauseCode::BindingObligation(_, binding_span) + | ObligationCauseCode::ExprBindingObligation(_, binding_span, ..)) = *parent.code() + else { return None; }; @@ -67,7 +68,8 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { let hir::Node::Item(hir::Item { kind: hir::ItemKind::Impl(hir::Impl { self_ty: impl_self_ty, .. }), .. - }) = impl_node else { + }) = impl_node + else { bug!("Node not an impl."); }; diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs index a9b485a6f7e..d70fea20cf4 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -503,7 +503,9 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { // Get the `Ident` of the method being called and the corresponding `impl` (to point at // `Bar` in `impl Foo for dyn Bar {}` and the definition of the method being called). - let Some((ident, self_ty)) = NiceRegionError::get_impl_ident_and_self_ty_from_trait(tcx, instance.def_id(), &v.0) else { + let Some((ident, self_ty)) = + NiceRegionError::get_impl_ident_and_self_ty_from_trait(tcx, instance.def_id(), &v.0) + else { return false; }; diff --git a/compiler/rustc_infer/src/infer/error_reporting/note.rs b/compiler/rustc_infer/src/infer/error_reporting/note.rs index e55e9e75fb6..6517b904404 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/note.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/note.rs @@ -295,12 +295,13 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { // but right now it's not really very smart when it comes to implicit `Sized` // predicates and bounds on the trait itself. - let Some(impl_def_id) = - self.tcx.associated_item(impl_item_def_id).impl_container(self.tcx) else { return; }; - let Some(trait_ref) = self - .tcx - .impl_trait_ref(impl_def_id) - else { return; }; + let Some(impl_def_id) = self.tcx.associated_item(impl_item_def_id).impl_container(self.tcx) + else { + return; + }; + let Some(trait_ref) = self.tcx.impl_trait_ref(impl_def_id) else { + return; + }; let trait_substs = trait_ref .subst_identity() // Replace the explicit self type with `Self` for better suggestion rendering @@ -309,20 +310,25 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { let trait_item_substs = ty::InternalSubsts::identity_for_item(self.tcx, impl_item_def_id) .rebase_onto(self.tcx, impl_def_id, trait_substs); - let Ok(trait_predicates) = self - .tcx - .explicit_predicates_of(trait_item_def_id) - .instantiate_own(self.tcx, trait_item_substs) - .map(|(pred, _)| { - if pred.is_suggestable(self.tcx, false) { - Ok(pred.to_string()) - } else { - Err(()) - } - }) - .collect::<Result<Vec<_>, ()>>() else { return; }; + let Ok(trait_predicates) = + self.tcx + .explicit_predicates_of(trait_item_def_id) + .instantiate_own(self.tcx, trait_item_substs) + .map(|(pred, _)| { + if pred.is_suggestable(self.tcx, false) { + Ok(pred.to_string()) + } else { + Err(()) + } + }) + .collect::<Result<Vec<_>, ()>>() + else { + return; + }; - let Some(generics) = self.tcx.hir().get_generics(impl_item_def_id) else { return; }; + let Some(generics) = self.tcx.hir().get_generics(impl_item_def_id) else { + return; + }; let suggestion = if trait_predicates.is_empty() { WhereClauseSuggestions::Remove { span: generics.where_clause_span } diff --git a/compiler/rustc_infer/src/infer/error_reporting/suggest.rs b/compiler/rustc_infer/src/infer/error_reporting/suggest.rs index b0e7cf23cae..aac2a43648b 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/suggest.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/suggest.rs @@ -526,13 +526,23 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { diag: &mut Diagnostic, ) { // 0. Extract fn_decl from hir - let hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Closure(hir::Closure { body, fn_decl, .. }), .. }) = hir else { return; }; + let hir::Node::Expr(hir::Expr { + kind: hir::ExprKind::Closure(hir::Closure { body, fn_decl, .. }), + .. + }) = hir + else { + return; + }; let hir::Body { params, .. } = self.tcx.hir().body(*body); // 1. Get the substs of the closure. // 2. Assume exp_found is FnOnce / FnMut / Fn, we can extract function parameters from [1]. - let Some(expected) = exp_found.expected.skip_binder().substs.get(1) else { return; }; - let Some(found) = exp_found.found.skip_binder().substs.get(1) else { return; }; + let Some(expected) = exp_found.expected.skip_binder().substs.get(1) else { + return; + }; + let Some(found) = exp_found.found.skip_binder().substs.get(1) else { + return; + }; let expected = expected.unpack(); let found = found.unpack(); // 3. Extract the tuple type from Fn trait and suggest the change. @@ -711,7 +721,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { let hir = self.tcx.hir(); for stmt in blk.stmts.iter().rev() { - let hir::StmtKind::Local(local) = &stmt.kind else { continue; }; + let hir::StmtKind::Local(local) = &stmt.kind else { + continue; + }; local.pat.walk(&mut find_compatible_candidates); } match hir.find_parent(blk.hir_id) { diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index 953c2e4b8f8..6471dce88c2 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -190,7 +190,8 @@ pub fn parse_check_cfg(handler: &EarlyErrorHandler, specs: Vec<String>) -> Check ExpectedValues::Some(FxHashSet::default()) }); - let ExpectedValues::Some(expected_values) = expected_values else { + let ExpectedValues::Some(expected_values) = expected_values + else { bug!("`expected_values` should be a list a values") }; diff --git a/compiler/rustc_lint/src/array_into_iter.rs b/compiler/rustc_lint/src/array_into_iter.rs index bccb0a94e98..d0967ba5644 100644 --- a/compiler/rustc_lint/src/array_into_iter.rs +++ b/compiler/rustc_lint/src/array_into_iter.rs @@ -81,7 +81,7 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter { let adjustments = cx.typeck_results().expr_adjustments(receiver_arg); let Some(Adjustment { kind: Adjust::Borrow(_), target }) = adjustments.last() else { - return + return; }; let types = diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index b821933e908..03835f8151c 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -793,9 +793,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDebugImplementations { _ => return, } - let Some(debug) = cx.tcx.get_diagnostic_item(sym::Debug) else { - return - }; + let Some(debug) = cx.tcx.get_diagnostic_item(sym::Debug) else { return }; if self.impling_types.is_none() { let mut impls = LocalDefIdSet::default(); @@ -1458,9 +1456,7 @@ impl TypeAliasBounds { impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds { fn check_item(&mut self, cx: &LateContext<'_>, item: &hir::Item<'_>) { - let hir::ItemKind::TyAlias(ty, type_alias_generics) = &item.kind else { - return - }; + let hir::ItemKind::TyAlias(ty, type_alias_generics) = &item.kind else { return }; if cx.tcx.type_of(item.owner_id.def_id).skip_binder().has_opaque_types() { // Bounds are respected for `type X = impl Trait` and `type X = (impl Trait, Y);` return; @@ -2147,8 +2143,8 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitOutlivesRequirements { match predicate.bounded_ty.kind { hir::TyKind::Path(hir::QPath::Resolved(None, path)) => { let Res::Def(DefKind::TyParam, def_id) = path.res else { - continue; - }; + continue; + }; let index = ty_generics.param_def_id_to_index[&def_id]; ( Self::lifetimes_outliving_type(inferred_outlives, index), @@ -2570,7 +2566,10 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue { Some((variant, definitely_inhabited)) }); let Some(first_variant) = potential_variants.next() else { - return Some(InitError::from("enums with no inhabited variants have no valid value").spanned(span)); + return Some( + InitError::from("enums with no inhabited variants have no valid value") + .spanned(span), + ); }; // So we have at least one potentially inhabited variant. Might we have two? let Some(second_variant) = potential_variants.next() else { @@ -3181,7 +3180,7 @@ impl<'tcx> LateLintPass<'tcx> for NamedAsmLabels { let mut chars = possible_label.chars(); let Some(c) = chars.next() else { // Empty string means a leading ':' in this section, which is not a label - break + break; }; // A label starts with an alphabetic character or . or _ and continues with alphanumeric characters, _, or $ if (c.is_alphabetic() || matches!(c, '.' | '_')) diff --git a/compiler/rustc_lint/src/cast_ref_to_mut.rs b/compiler/rustc_lint/src/cast_ref_to_mut.rs index 84308d48c10..82bb70bc9e7 100644 --- a/compiler/rustc_lint/src/cast_ref_to_mut.rs +++ b/compiler/rustc_lint/src/cast_ref_to_mut.rs @@ -37,7 +37,9 @@ declare_lint_pass!(CastRefToMut => [CAST_REF_TO_MUT]); impl<'tcx> LateLintPass<'tcx> for CastRefToMut { fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { - let ExprKind::Unary(UnOp::Deref, e) = &expr.kind else { return; }; + let ExprKind::Unary(UnOp::Deref, e) = &expr.kind else { + return; + }; let e = e.peel_blocks(); let e = if let ExprKind::Cast(e, t) = e.kind diff --git a/compiler/rustc_lint/src/context.rs b/compiler/rustc_lint/src/context.rs index 3761754f3ae..4770ed66393 100644 --- a/compiler/rustc_lint/src/context.rs +++ b/compiler/rustc_lint/src/context.rs @@ -956,6 +956,14 @@ pub trait LintContext: Sized { db.span_note(glob_reexport_span, format!("the name `{}` in the {} namespace is supposed to be publicly re-exported here", name, namespace)); db.span_note(private_item_span, "but the private item here shadows it".to_owned()); } + BuiltinLintDiagnostics::UnusedQualifications { path_span, unqualified_path } => { + db.span_suggestion_verbose( + path_span, + "replace it with the unqualified path", + unqualified_path, + Applicability::MachineApplicable + ); + } } // Rewrap `db`, and pass control to the user. decorate(db) diff --git a/compiler/rustc_lint/src/for_loops_over_fallibles.rs b/compiler/rustc_lint/src/for_loops_over_fallibles.rs index 7b58bf03bbe..71832c1b7af 100644 --- a/compiler/rustc_lint/src/for_loops_over_fallibles.rs +++ b/compiler/rustc_lint/src/for_loops_over_fallibles.rs @@ -119,7 +119,9 @@ fn suggest_question_mark<'tcx>( span: Span, ) -> bool { let Some(body_id) = cx.enclosing_body else { return false }; - let Some(into_iterator_did) = cx.tcx.get_diagnostic_item(sym::IntoIterator) else { return false }; + let Some(into_iterator_did) = cx.tcx.get_diagnostic_item(sym::IntoIterator) else { + return false; + }; if !cx.tcx.is_diagnostic_item(sym::Result, adt.did()) { return false; diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 8376835f52c..c9ee2da6fdf 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -265,7 +265,10 @@ impl LintLevelsProvider for QueryMapExpectationsWrapper<'_> { self.specs.lint_level_id_at_node(self.tcx, LintId::of(lint), self.cur) } fn push_expectation(&mut self, id: LintExpectationId, expectation: LintExpectation) { - let LintExpectationId::Stable { attr_id: Some(attr_id), hir_id, attr_index, .. } = id else { bug!("unstable expectation id should already be mapped") }; + let LintExpectationId::Stable { attr_id: Some(attr_id), hir_id, attr_index, .. } = id + else { + bug!("unstable expectation id should already be mapped") + }; let key = LintExpectationId::Unstable { attr_id, lint_index: None }; self.unstable_to_stable_ids.entry(key).or_insert(LintExpectationId::Stable { @@ -542,7 +545,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { let Ok(ids) = self.store.find_lints(&lint_name) else { // errors handled in check_lint_name_cmdline above - continue + continue; }; for id in ids { // ForceWarn and Forbid cannot be overridden @@ -685,9 +688,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { Some(lvl) => lvl, }; - let Some(mut metas) = attr.meta_item_list() else { - continue - }; + let Some(mut metas) = attr.meta_item_list() else { continue }; if metas.is_empty() { // This emits the unused_attributes lint for `#[level()]` @@ -956,8 +957,9 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { continue; } - let LintLevelSource::Node { name: lint_attr_name, span: lint_attr_span, .. } = *src else { - continue + let LintLevelSource::Node { name: lint_attr_name, span: lint_attr_span, .. } = *src + else { + continue; }; self.emit_spanned_lint( diff --git a/compiler/rustc_lint/src/noop_method_call.rs b/compiler/rustc_lint/src/noop_method_call.rs index d56c35bb677..79430393a64 100644 --- a/compiler/rustc_lint/src/noop_method_call.rs +++ b/compiler/rustc_lint/src/noop_method_call.rs @@ -79,8 +79,7 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall { // We only care about method calls corresponding to the `Clone`, `Deref` and `Borrow` // traits and ignore any other method call. - let Some((DefKind::AssocFn, did)) = - cx.typeck_results().type_dependent_def(expr.hir_id) + let Some((DefKind::AssocFn, did)) = cx.typeck_results().type_dependent_def(expr.hir_id) else { return; }; @@ -98,9 +97,7 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall { .tcx .normalize_erasing_regions(cx.param_env, cx.typeck_results().node_substs(expr.hir_id)); // Resolve the trait method instance. - let Ok(Some(i)) = ty::Instance::resolve(cx.tcx, cx.param_env, did, substs) else { - return - }; + let Ok(Some(i)) = ty::Instance::resolve(cx.tcx, cx.param_env, did, substs) else { return }; // (Re)check that it implements the noop diagnostic. let Some(name) = cx.tcx.get_diagnostic_name(i.def_id()) else { return }; diff --git a/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs b/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs index 09a1651c2f5..5fd42942e30 100644 --- a/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs +++ b/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs @@ -68,7 +68,9 @@ declare_lint_pass!(OpaqueHiddenInferredBound => [OPAQUE_HIDDEN_INFERRED_BOUND]); impl<'tcx> LateLintPass<'tcx> for OpaqueHiddenInferredBound { fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) { - let hir::ItemKind::OpaqueTy(opaque) = &item.kind else { return; }; + let hir::ItemKind::OpaqueTy(opaque) = &item.kind else { + return; + }; let def_id = item.owner_id.def_id.to_def_id(); let infcx = &cx.tcx.infer_ctxt().build(); // For every projection predicate in the opaque type's explicit bounds, @@ -116,7 +118,12 @@ impl<'tcx> LateLintPass<'tcx> for OpaqueHiddenInferredBound { .subst_iter_copied(cx.tcx, &proj.projection_ty.substs) { let assoc_pred = assoc_pred.fold_with(proj_replacer); - let Ok(assoc_pred) = traits::fully_normalize(infcx, traits::ObligationCause::dummy(), cx.param_env, assoc_pred) else { + let Ok(assoc_pred) = traits::fully_normalize( + infcx, + traits::ObligationCause::dummy(), + cx.param_env, + assoc_pred, + ) else { continue; }; // If that predicate doesn't hold modulo regions (but passed during type-check), diff --git a/compiler/rustc_lint/src/traits.rs b/compiler/rustc_lint/src/traits.rs index de11208062d..56508a2a6cc 100644 --- a/compiler/rustc_lint/src/traits.rs +++ b/compiler/rustc_lint/src/traits.rs @@ -92,7 +92,7 @@ impl<'tcx> LateLintPass<'tcx> for DropTraitConstraints { let predicates = cx.tcx.explicit_predicates_of(item.owner_id); for &(predicate, span) in predicates.predicates { let ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder() else { - continue + continue; }; let def_id = trait_predicate.trait_ref.def_id; if cx.tcx.lang_items().drop_trait() == Some(def_id) { @@ -100,9 +100,7 @@ impl<'tcx> LateLintPass<'tcx> for DropTraitConstraints { if trait_predicate.trait_ref.self_ty().is_impl_trait() { continue; } - let Some(def_id) = cx.tcx.get_diagnostic_item(sym::needs_drop) else { - return - }; + let Some(def_id) = cx.tcx.get_diagnostic_item(sym::needs_drop) else { return }; cx.emit_spanned_lint( DROP_BOUNDS, span, @@ -113,15 +111,11 @@ impl<'tcx> LateLintPass<'tcx> for DropTraitConstraints { } fn check_ty(&mut self, cx: &LateContext<'_>, ty: &'tcx hir::Ty<'tcx>) { - let hir::TyKind::TraitObject(bounds, _lifetime, _syntax) = &ty.kind else { - return - }; + let hir::TyKind::TraitObject(bounds, _lifetime, _syntax) = &ty.kind else { return }; for bound in &bounds[..] { let def_id = bound.trait_ref.trait_def_id(); if cx.tcx.lang_items().drop_trait() == def_id { - let Some(def_id) = cx.tcx.get_diagnostic_item(sym::needs_drop) else { - return - }; + let Some(def_id) = cx.tcx.get_diagnostic_item(sym::needs_drop) else { return }; cx.emit_spanned_lint(DYN_DROP, bound.span, DropGlue { tcx: cx.tcx, def_id }); } } diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 2509d493a4c..0e30d9c8604 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -560,7 +560,10 @@ fn lint_nan<'tcx>( let expr = expr.peel_blocks().peel_borrows(); match expr.kind { ExprKind::Path(qpath) => { - let Some(def_id) = cx.typeck_results().qpath_res(&qpath, expr.hir_id).opt_def_id() else { return false; }; + let Some(def_id) = cx.typeck_results().qpath_res(&qpath, expr.hir_id).opt_def_id() + else { + return false; + }; matches!(cx.tcx.get_diagnostic_name(def_id), Some(sym::f32_nan | sym::f64_nan)) } @@ -1584,10 +1587,10 @@ impl<'tcx> LateLintPass<'tcx> for VariantSizeDifferences { let t = cx.tcx.type_of(it.owner_id).subst_identity(); let ty = cx.tcx.erase_regions(t); let Ok(layout) = cx.layout_of(ty) else { return }; - let Variants::Multiple { - tag_encoding: TagEncoding::Direct, tag, ref variants, .. - } = &layout.variants else { - return + let Variants::Multiple { tag_encoding: TagEncoding::Direct, tag, ref variants, .. } = + &layout.variants + else { + return; }; let tag_size = tag.size(&cx.tcx).bytes(); @@ -1760,8 +1763,13 @@ impl InvalidAtomicOrdering { } fn check_atomic_compare_exchange(cx: &LateContext<'_>, expr: &Expr<'_>) { - let Some((method, args)) = Self::inherent_atomic_method_call(cx, expr, &[sym::fetch_update, sym::compare_exchange, sym::compare_exchange_weak]) - else {return }; + let Some((method, args)) = Self::inherent_atomic_method_call( + cx, + expr, + &[sym::fetch_update, sym::compare_exchange, sym::compare_exchange_weak], + ) else { + return; + }; let fail_order_arg = match method { sym::fetch_update => &args[1], diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index 5015b751eee..e35cc8de66f 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -94,7 +94,9 @@ declare_lint_pass!(UnusedResults => [UNUSED_MUST_USE, UNUSED_RESULTS]); impl<'tcx> LateLintPass<'tcx> for UnusedResults { fn check_stmt(&mut self, cx: &LateContext<'_>, s: &hir::Stmt<'_>) { - let hir::StmtKind::Semi(mut expr) = s.kind else { return; }; + let hir::StmtKind::Semi(mut expr) = s.kind else { + return; + }; let mut expr_is_from_block = false; while let hir::ExprKind::Block(blk, ..) = expr.kind diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index 5a5031b7919..f6ffd46b1fe 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -550,6 +550,12 @@ pub enum BuiltinLintDiagnostics { /// The local binding that shadows the glob reexport. private_item_span: Span, }, + UnusedQualifications { + /// The span of the unnecessarily-qualified path. + path_span: Span, + /// The replacement unqualified path. + unqualified_path: Ident, + }, } /// Lints that are buffered up early on in the `Session` before the diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index c43a0272477..eb3d67e720f 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -667,6 +667,7 @@ LLVMRustOptimize( assert(!PGOUsePath && !PGOSampleUsePath); PGOOpt = PGOOptions(PGOGenPath, "", "", #if LLVM_VERSION_GE(17, 0) + "", FS, #endif PGOOptions::IRInstr, PGOOptions::NoCSAction, @@ -675,6 +676,7 @@ LLVMRustOptimize( assert(!PGOSampleUsePath); PGOOpt = PGOOptions(PGOUsePath, "", "", #if LLVM_VERSION_GE(17, 0) + "", FS, #endif PGOOptions::IRUse, PGOOptions::NoCSAction, @@ -682,6 +684,7 @@ LLVMRustOptimize( } else if (PGOSampleUsePath) { PGOOpt = PGOOptions(PGOSampleUsePath, "", "", #if LLVM_VERSION_GE(17, 0) + "", FS, #endif PGOOptions::SampleUse, PGOOptions::NoCSAction, @@ -689,6 +692,7 @@ LLVMRustOptimize( } else if (DebugInfoForProfiling) { PGOOpt = PGOOptions("", "", "", #if LLVM_VERSION_GE(17, 0) + "", FS, #endif PGOOptions::NoAction, PGOOptions::NoCSAction, diff --git a/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs b/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs index 2e6e84ad80e..e9a5cd9de97 100644 --- a/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs +++ b/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs @@ -203,14 +203,18 @@ impl<'a> DiagnosticDeriveVariantBuilder<'a> { if first && (nested.input.is_empty() || nested.input.peek(Token![,])) { self.slug.set_once(path.clone(), path.span().unwrap()); first = false; - return Ok(()) + return Ok(()); } first = false; let Ok(nested) = nested.value() else { - span_err(nested.input.span().unwrap(), "diagnostic slug must be the first argument").emit(); - return Ok(()) + span_err( + nested.input.span().unwrap(), + "diagnostic slug must be the first argument", + ) + .emit(); + return Ok(()); }; if path.is_ident("code") { @@ -221,7 +225,9 @@ impl<'a> DiagnosticDeriveVariantBuilder<'a> { #diag.code(rustc_errors::DiagnosticId::Error(#code.to_string())); }); } else { - span_err(path.span().unwrap(), "unknown argument").note("only the `code` parameter is valid after the slug").emit(); + span_err(path.span().unwrap(), "unknown argument") + .note("only the `code` parameter is valid after the slug") + .emit(); // consume the buffer so we don't have syntax errors from syn let _ = nested.parse::<TokenStream>(); diff --git a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs index e8dc986914e..877e9745054 100644 --- a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs +++ b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs @@ -188,7 +188,9 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> { let mut kind_slugs = vec![]; for attr in self.variant.ast().attrs { - let Some(SubdiagnosticVariant { kind, slug, no_span }) = SubdiagnosticVariant::from_attr(attr, self)? else { + let Some(SubdiagnosticVariant { kind, slug, no_span }) = + SubdiagnosticVariant::from_attr(attr, self)? + else { // Some attributes aren't errors - like documentation comments - but also aren't // subdiagnostics. continue; diff --git a/compiler/rustc_macros/src/newtype.rs b/compiler/rustc_macros/src/newtype.rs index 415a89b0f92..72b47de1abc 100644 --- a/compiler/rustc_macros/src/newtype.rs +++ b/compiler/rustc_macros/src/newtype.rs @@ -36,7 +36,8 @@ impl Parse for Newtype { false } "max" => { - let Meta::NameValue(MetaNameValue { value: Expr::Lit(lit), .. }) = &attr.meta else { + let Meta::NameValue(MetaNameValue { value: Expr::Lit(lit), .. }) = &attr.meta + else { panic!("#[max = NUMBER] attribute requires max value"); }; @@ -47,7 +48,8 @@ impl Parse for Newtype { false } "debug_format" => { - let Meta::NameValue(MetaNameValue { value: Expr::Lit(lit), .. }) = &attr.meta else { + let Meta::NameValue(MetaNameValue { value: Expr::Lit(lit), .. }) = &attr.meta + else { panic!("#[debug_format = FMT] attribute requires a format"); }; diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index b3976d756eb..571af82d13a 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -741,7 +741,9 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> { }; info!("panic runtime not found -- loading {}", name); - let Some(cnum) = self.resolve_crate(name, DUMMY_SP, CrateDepKind::Implicit) else { return; }; + let Some(cnum) = self.resolve_crate(name, DUMMY_SP, CrateDepKind::Implicit) else { + return; + }; let data = self.cstore.get_crate_data(cnum); // Sanity check the loaded crate to ensure it is indeed a panic runtime @@ -774,7 +776,9 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> { self.sess.emit_err(errors::ProfilerBuiltinsNeedsCore); } - let Some(cnum) = self.resolve_crate(name, DUMMY_SP, CrateDepKind::Implicit) else { return; }; + let Some(cnum) = self.resolve_crate(name, DUMMY_SP, CrateDepKind::Implicit) else { + return; + }; let data = self.cstore.get_crate_data(cnum); // Sanity check the loaded crate to ensure it is indeed a profiler runtime diff --git a/compiler/rustc_metadata/src/locator.rs b/compiler/rustc_metadata/src/locator.rs index a89d7b464e2..a1511c4b570 100644 --- a/compiler/rustc_metadata/src/locator.rs +++ b/compiler/rustc_metadata/src/locator.rs @@ -804,8 +804,12 @@ fn get_metadata_section<'p>( } // Length of the compressed stream - this allows linkers to pad the section if they want - let Ok(len_bytes) = <[u8; 4]>::try_from(&buf[header_len..cmp::min(data_start, buf.len())]) else { - return Err(MetadataError::LoadFailure("invalid metadata length found".to_string())); + let Ok(len_bytes) = + <[u8; 4]>::try_from(&buf[header_len..cmp::min(data_start, buf.len())]) + else { + return Err(MetadataError::LoadFailure( + "invalid metadata length found".to_string(), + )); }; let compressed_len = u32::from_be_bytes(len_bytes) as usize; diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index b9318aee581..8fa1d365728 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -311,8 +311,10 @@ impl<'a, 'tcx> DecodeContext<'a, 'tcx> { #[inline] fn tcx(&self) -> TyCtxt<'tcx> { let Some(tcx) = self.tcx else { - bug!("No TyCtxt found for decoding. \ - You need to explicitly pass `(crate_metadata_ref, tcx)` to `decode` instead of just `crate_metadata_ref`."); + bug!( + "No TyCtxt found for decoding. \ + You need to explicitly pass `(crate_metadata_ref, tcx)` to `decode` instead of just `crate_metadata_ref`." + ); }; tcx } @@ -448,8 +450,10 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for SyntaxContext { let cdata = decoder.cdata(); let Some(sess) = decoder.sess else { - bug!("Cannot decode SyntaxContext without Session.\ - You need to explicitly pass `(crate_metadata_ref, tcx)` to `decode` instead of just `crate_metadata_ref`."); + bug!( + "Cannot decode SyntaxContext without Session.\ + You need to explicitly pass `(crate_metadata_ref, tcx)` to `decode` instead of just `crate_metadata_ref`." + ); }; let cname = cdata.root.name(); @@ -470,8 +474,10 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for ExpnId { let local_cdata = decoder.cdata(); let Some(sess) = decoder.sess else { - bug!("Cannot decode ExpnId without Session. \ - You need to explicitly pass `(crate_metadata_ref, tcx)` to `decode` instead of just `crate_metadata_ref`."); + bug!( + "Cannot decode ExpnId without Session. \ + You need to explicitly pass `(crate_metadata_ref, tcx)` to `decode` instead of just `crate_metadata_ref`." + ); }; let cnum = CrateNum::decode(decoder); @@ -521,8 +527,10 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for Span { let hi = lo + len; let Some(sess) = decoder.sess else { - bug!("Cannot decode Span without Session. \ - You need to explicitly pass `(crate_metadata_ref, tcx)` to `decode` instead of just `crate_metadata_ref`.") + bug!( + "Cannot decode Span without Session. \ + You need to explicitly pass `(crate_metadata_ref, tcx)` to `decode` instead of just `crate_metadata_ref`." + ) }; // Index of the file in the corresponding crate's list of encoded files. diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index 01dd35b0e5b..fc1062a48b4 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -1671,7 +1671,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { fn encode_info_for_macro(&mut self, def_id: LocalDefId) { let tcx = self.tcx; - let hir::ItemKind::Macro(ref macro_def, _) = tcx.hir().expect_item(def_id).kind else { bug!() }; + let hir::ItemKind::Macro(ref macro_def, _) = tcx.hir().expect_item(def_id).kind else { + bug!() + }; self.tables.is_macro_rules.set(def_id.local_def_index, macro_def.macro_rules); record!(self.tables.macro_definition[def_id.to_def_id()] <- &*macro_def.body); } @@ -1911,7 +1913,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { FxHashMap::default(); for id in tcx.hir().items() { - let DefKind::Impl { of_trait } = tcx.def_kind(id.owner_id) else { continue; }; + let DefKind::Impl { of_trait } = tcx.def_kind(id.owner_id) else { + continue; + }; let def_id = id.owner_id.to_def_id(); self.tables.defaultness.set_some(def_id.index, tcx.defaultness(def_id)); diff --git a/compiler/rustc_metadata/src/rmeta/table.rs b/compiler/rustc_metadata/src/rmeta/table.rs index a4313d79ab1..4287799a8e6 100644 --- a/compiler/rustc_metadata/src/rmeta/table.rs +++ b/compiler/rustc_metadata/src/rmeta/table.rs @@ -323,7 +323,7 @@ impl<T> FixedSizeEncoding for Option<LazyValue<T>> { impl<T> LazyArray<T> { #[inline] fn write_to_bytes_impl(self, b: &mut [u8; 8]) { - let ([position_bytes, meta_bytes],[])= b.as_chunks_mut::<4>() else { panic!() }; + let ([position_bytes, meta_bytes], []) = b.as_chunks_mut::<4>() else { panic!() }; let position = self.position.get(); let position: u32 = position.try_into().unwrap(); @@ -346,7 +346,7 @@ impl<T> FixedSizeEncoding for LazyArray<T> { #[inline] fn from_bytes(b: &[u8; 8]) -> Self { - let ([position_bytes, meta_bytes],[])= b.as_chunks::<4>() else { panic!() }; + let ([position_bytes, meta_bytes], []) = b.as_chunks::<4>() else { panic!() }; if *meta_bytes == [0; 4] { return Default::default(); } @@ -365,7 +365,7 @@ impl<T> FixedSizeEncoding for Option<LazyArray<T>> { #[inline] fn from_bytes(b: &[u8; 8]) -> Self { - let ([position_bytes, meta_bytes],[])= b.as_chunks::<4>() else { panic!() }; + let ([position_bytes, meta_bytes], []) = b.as_chunks::<4>() else { panic!() }; LazyArray::from_bytes_impl(position_bytes, meta_bytes) } diff --git a/compiler/rustc_middle/src/mir/syntax.rs b/compiler/rustc_middle/src/mir/syntax.rs index 7f1d3820341..8c8efc36a2f 100644 --- a/compiler/rustc_middle/src/mir/syntax.rs +++ b/compiler/rustc_middle/src/mir/syntax.rs @@ -1050,10 +1050,6 @@ pub type PlaceElem<'tcx> = ProjectionElem<Local, Ty<'tcx>>; /// there may be other effects: if the type has a validity constraint loading the place might be UB /// if the validity constraint is not met. /// -/// **Needs clarification:** Ralf proposes that loading a place not have side-effects. -/// This is what is implemented in miri today. Are these the semantics we want for MIR? Is this -/// something we can even decide without knowing more about Rust's memory model? -/// /// **Needs clarification:** Is loading a place that has its variant index set well-formed? Miri /// currently implements it, but it seems like this may be something to check against in the /// validator. @@ -1071,6 +1067,16 @@ pub enum Operand<'tcx> { /// in [UCG#188]. You should not emit MIR that may attempt a subsequent second load of this /// place without first re-initializing it. /// + /// **Needs clarification:** The operational impact of `Move` is unclear. Currently (both in + /// Miri and codegen) it has no effect at all unless it appears in an argument to `Call`; for + /// `Call` it allows the argument to be passed to the callee "in-place", i.e. the callee might + /// just get a reference to this place instead of a full copy. Miri implements this with a + /// combination of aliasing model "protectors" and putting `uninit` into the place. Ralf + /// proposes that we don't want these semantics for `Move` in regular assignments, because + /// loading a place should not have side-effects, and the aliasing model "protectors" are + /// inherently tied to a function call. Are these the semantics we want for MIR? Is this + /// something we can even decide without knowing more about Rust's memory model? + /// /// [UCG#188]: https://github.com/rust-lang/unsafe-code-guidelines/issues/188 Move(Place<'tcx>), diff --git a/compiler/rustc_middle/src/traits/solve/inspect.rs b/compiler/rustc_middle/src/traits/solve/inspect.rs index 527afa005b9..8698cf86022 100644 --- a/compiler/rustc_middle/src/traits/solve/inspect.rs +++ b/compiler/rustc_middle/src/traits/solve/inspect.rs @@ -32,7 +32,7 @@ pub enum GoalEvaluationKind<'tcx> { } impl Debug for GoalEvaluation<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - ProofTreeFormatter { f, on_newline: true }.format_goal_evaluation(self) + ProofTreeFormatter::new(f).format_goal_evaluation(self) } } @@ -43,7 +43,7 @@ pub struct AddedGoalsEvaluation<'tcx> { } impl Debug for AddedGoalsEvaluation<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - ProofTreeFormatter { f, on_newline: true }.format_nested_goal_evaluation(self) + ProofTreeFormatter::new(f).format_nested_goal_evaluation(self) } } @@ -58,7 +58,7 @@ pub struct GoalEvaluationStep<'tcx> { } impl Debug for GoalEvaluationStep<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - ProofTreeFormatter { f, on_newline: true }.format_evaluation_step(self) + ProofTreeFormatter::new(f).format_evaluation_step(self) } } @@ -78,6 +78,6 @@ pub enum CandidateKind<'tcx> { } impl Debug for GoalCandidate<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - ProofTreeFormatter { f, on_newline: true }.format_candidate(self) + ProofTreeFormatter::new(f).format_candidate(self) } } diff --git a/compiler/rustc_middle/src/traits/solve/inspect/format.rs b/compiler/rustc_middle/src/traits/solve/inspect/format.rs index 2ee625674fa..f19f1189e44 100644 --- a/compiler/rustc_middle/src/traits/solve/inspect/format.rs +++ b/compiler/rustc_middle/src/traits/solve/inspect/format.rs @@ -1,11 +1,19 @@ use super::*; pub(super) struct ProofTreeFormatter<'a, 'b> { - pub(super) f: &'a mut (dyn Write + 'b), - pub(super) on_newline: bool, + f: &'a mut (dyn Write + 'b), } -impl Write for ProofTreeFormatter<'_, '_> { +/// A formatter which adds 4 spaces of indentation to its input before +/// passing it on to its nested formatter. +/// +/// We can use this for arbitrary levels of indentation by nesting it. +struct Indentor<'a, 'b> { + f: &'a mut (dyn Write + 'b), + on_newline: bool, +} + +impl Write for Indentor<'_, '_> { fn write_str(&mut self, s: &str) -> std::fmt::Result { for line in s.split_inclusive("\n") { if self.on_newline { @@ -19,49 +27,52 @@ impl Write for ProofTreeFormatter<'_, '_> { } } -impl ProofTreeFormatter<'_, '_> { - fn nested(&mut self) -> ProofTreeFormatter<'_, '_> { - ProofTreeFormatter { f: self, on_newline: true } +impl<'a, 'b> ProofTreeFormatter<'a, 'b> { + pub(super) fn new(f: &'a mut (dyn Write + 'b)) -> Self { + ProofTreeFormatter { f } } - pub(super) fn format_goal_evaluation(&mut self, goal: &GoalEvaluation<'_>) -> std::fmt::Result { - let f = &mut *self.f; + fn nested<F, R>(&mut self, func: F) -> R + where + F: FnOnce(&mut ProofTreeFormatter<'_, '_>) -> R, + { + func(&mut ProofTreeFormatter { f: &mut Indentor { f: self.f, on_newline: true } }) + } + pub(super) fn format_goal_evaluation(&mut self, goal: &GoalEvaluation<'_>) -> std::fmt::Result { let goal_text = match goal.is_normalizes_to_hack { IsNormalizesToHack::Yes => "NORMALIZES-TO HACK GOAL", IsNormalizesToHack::No => "GOAL", }; - writeln!(f, "{}: {:?}", goal_text, goal.uncanonicalized_goal,)?; - writeln!(f, "CANONICALIZED: {:?}", goal.canonicalized_goal)?; + writeln!(self.f, "{}: {:?}", goal_text, goal.uncanonicalized_goal)?; + writeln!(self.f, "CANONICALIZED: {:?}", goal.canonicalized_goal)?; match &goal.kind { GoalEvaluationKind::CacheHit(CacheHit::Global) => { - writeln!(f, "GLOBAL CACHE HIT: {:?}", goal.result) + writeln!(self.f, "GLOBAL CACHE HIT: {:?}", goal.result) } GoalEvaluationKind::CacheHit(CacheHit::Provisional) => { - writeln!(f, "PROVISIONAL CACHE HIT: {:?}", goal.result) + writeln!(self.f, "PROVISIONAL CACHE HIT: {:?}", goal.result) } GoalEvaluationKind::Uncached { revisions } => { for (n, step) in revisions.iter().enumerate() { - let f = &mut *self.f; - writeln!(f, "REVISION {n}: {:?}", step.result)?; - let mut f = self.nested(); - f.format_evaluation_step(step)?; + writeln!(self.f, "REVISION {n}: {:?}", step.result)?; + self.nested(|this| this.format_evaluation_step(step))?; } - - let f = &mut *self.f; - writeln!(f, "RESULT: {:?}", goal.result) + writeln!(self.f, "RESULT: {:?}", goal.result) } }?; if goal.returned_goals.len() > 0 { - let f = &mut *self.f; - writeln!(f, "NESTED GOALS ADDED TO CALLER: [")?; - let mut f = self.nested(); - for goal in goal.returned_goals.iter() { - writeln!(f, "ADDED GOAL: {:?},", goal)?; - } + writeln!(self.f, "NESTED GOALS ADDED TO CALLER: [")?; + self.nested(|this| { + for goal in goal.returned_goals.iter() { + writeln!(this.f, "ADDED GOAL: {:?},", goal)?; + } + Ok(()) + })?; + writeln!(self.f, "]")?; } @@ -72,58 +83,53 @@ impl ProofTreeFormatter<'_, '_> { &mut self, evaluation_step: &GoalEvaluationStep<'_>, ) -> std::fmt::Result { - let f = &mut *self.f; - writeln!(f, "INSTANTIATED: {:?}", evaluation_step.instantiated_goal)?; + writeln!(self.f, "INSTANTIATED: {:?}", evaluation_step.instantiated_goal)?; for candidate in &evaluation_step.candidates { - let mut f = self.nested(); - f.format_candidate(candidate)?; + self.nested(|this| this.format_candidate(candidate))?; } - for nested_goal_evaluation in &evaluation_step.nested_goal_evaluations { - let mut f = self.nested(); - f.format_nested_goal_evaluation(nested_goal_evaluation)?; + for nested in &evaluation_step.nested_goal_evaluations { + self.nested(|this| this.format_nested_goal_evaluation(nested))?; } Ok(()) } pub(super) fn format_candidate(&mut self, candidate: &GoalCandidate<'_>) -> std::fmt::Result { - let f = &mut *self.f; - match &candidate.kind { CandidateKind::NormalizedSelfTyAssembly => { - writeln!(f, "NORMALIZING SELF TY FOR ASSEMBLY:") + writeln!(self.f, "NORMALIZING SELF TY FOR ASSEMBLY:") } CandidateKind::Candidate { name, result } => { - writeln!(f, "CANDIDATE {}: {:?}", name, result) + writeln!(self.f, "CANDIDATE {}: {:?}", name, result) } }?; - let mut f = self.nested(); - for candidate in &candidate.candidates { - f.format_candidate(candidate)?; - } - for nested_evaluations in &candidate.nested_goal_evaluations { - f.format_nested_goal_evaluation(nested_evaluations)?; - } - - Ok(()) + self.nested(|this| { + for candidate in &candidate.candidates { + this.format_candidate(candidate)?; + } + for nested in &candidate.nested_goal_evaluations { + this.format_nested_goal_evaluation(nested)?; + } + Ok(()) + }) } pub(super) fn format_nested_goal_evaluation( &mut self, nested_goal_evaluation: &AddedGoalsEvaluation<'_>, ) -> std::fmt::Result { - let f = &mut *self.f; - writeln!(f, "TRY_EVALUATE_ADDED_GOALS: {:?}", nested_goal_evaluation.result)?; + writeln!(self.f, "TRY_EVALUATE_ADDED_GOALS: {:?}", nested_goal_evaluation.result)?; for (n, revision) in nested_goal_evaluation.evaluations.iter().enumerate() { - let f = &mut *self.f; - writeln!(f, "REVISION {n}")?; - let mut f = self.nested(); - for goal_evaluation in revision { - f.format_goal_evaluation(goal_evaluation)?; - } + writeln!(self.f, "REVISION {n}")?; + self.nested(|this| { + for goal_evaluation in revision { + this.format_goal_evaluation(goal_evaluation)?; + } + Ok(()) + })?; } Ok(()) diff --git a/compiler/rustc_middle/src/ty/consts/int.rs b/compiler/rustc_middle/src/ty/consts/int.rs index 1e43fab457e..624195cfb28 100644 --- a/compiler/rustc_middle/src/ty/consts/int.rs +++ b/compiler/rustc_middle/src/ty/consts/int.rs @@ -418,7 +418,7 @@ impl TryFrom<ScalarInt> for char { #[inline] fn try_from(int: ScalarInt) -> Result<Self, Self::Error> { - let Ok(bits) = int.to_bits(Size::from_bytes(std::mem::size_of::<char>())) else { + let Ok(bits) = int.to_bits(Size::from_bytes(std::mem::size_of::<char>())) else { return Err(CharTryFromScalarInt); }; match char::from_u32(bits.try_into().unwrap()) { diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 519bdb01623..c8ad9bd1830 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -149,7 +149,7 @@ mod opaque_types; mod parameterized; mod rvalue_scopes; mod structural_impls; -#[cfg_attr(not(bootstrap), allow(hidden_glob_reexports))] +#[allow(hidden_glob_reexports)] mod sty; mod typeck_results; @@ -2713,12 +2713,16 @@ impl<'tcx> TyCtxt<'tcx> { return false; } - let Some(item) = self.opt_associated_item(def_id) else { return false; }; + let Some(item) = self.opt_associated_item(def_id) else { + return false; + }; if item.container != ty::AssocItemContainer::ImplContainer { return false; } - let Some(trait_item_def_id) = item.trait_item_def_id else { return false; }; + let Some(trait_item_def_id) = item.trait_item_def_id else { + return false; + }; return !self .associated_types_for_impl_traits_in_associated_fn(trait_item_def_id) diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs index e2e4a2dbdc8..8a83214edc7 100644 --- a/compiler/rustc_middle/src/ty/util.rs +++ b/compiler/rustc_middle/src/ty/util.rs @@ -358,7 +358,8 @@ impl<'tcx> TyCtxt<'tcx> { } let Some(item_id) = self.associated_item_def_ids(impl_did).first() else { - self.sess.delay_span_bug(self.def_span(impl_did), "Drop impl without drop function"); + self.sess + .delay_span_bug(self.def_span(impl_did), "Drop impl without drop function"); return; }; diff --git a/compiler/rustc_mir_build/src/build/custom/parse.rs b/compiler/rustc_mir_build/src/build/custom/parse.rs index 803207d9dc6..c494929cbff 100644 --- a/compiler/rustc_mir_build/src/build/custom/parse.rs +++ b/compiler/rustc_mir_build/src/build/custom/parse.rs @@ -241,9 +241,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> { }); } - let Some(trailing) = block.expr else { - return Err(self.expr_error(expr_id, "terminator")) - }; + let Some(trailing) = block.expr else { return Err(self.expr_error(expr_id, "terminator")) }; let span = self.thir[trailing].span; let terminator = self.parse_terminator(trailing)?; data.terminator = Some(Terminator { diff --git a/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs b/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs index 4cb9d7babe1..8a841759900 100644 --- a/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs +++ b/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs @@ -78,7 +78,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> { span, item_description: "no arms".to_string(), expected: "at least one arm".to_string(), - }) + }); }; let otherwise = &self.thir[*otherwise]; @@ -87,7 +87,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> { span: otherwise.span, item_description: format!("{:?}", otherwise.pattern.kind), expected: "wildcard pattern".to_string(), - }) + }); }; let otherwise = self.parse_block(otherwise.body)?; @@ -100,7 +100,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> { span: arm.pattern.span, item_description: format!("{:?}", arm.pattern.kind), expected: "constant pattern".to_string(), - }) + }); }; values.push(value.eval_bits(self.tcx, self.param_env, arm.pattern.ty)); targets.push(self.parse_block(arm.body)?); diff --git a/compiler/rustc_mir_build/src/build/expr/as_place.rs b/compiler/rustc_mir_build/src/build/expr/as_place.rs index 60acd279f9e..c122230b841 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_place.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_place.rs @@ -175,11 +175,8 @@ fn to_upvars_resolved_place_builder<'tcx>( projection: &[PlaceElem<'tcx>], ) -> Option<PlaceBuilder<'tcx>> { let Some((capture_index, capture)) = - find_capture_matching_projections( - &cx.upvars, - var_hir_id, - &projection, - ) else { + find_capture_matching_projections(&cx.upvars, var_hir_id, &projection) + else { let closure_span = cx.tcx.def_span(closure_def_id); if !enable_precise_capture(closure_span) { bug!( @@ -189,10 +186,7 @@ fn to_upvars_resolved_place_builder<'tcx>( projection ) } else { - debug!( - "No associated capture found for {:?}[{:#?}]", - var_hir_id, projection, - ); + debug!("No associated capture found for {:?}[{:#?}]", var_hir_id, projection,); } return None; }; diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index 10770213c9a..34e0e572a1b 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -607,9 +607,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { // }; // ``` if let Some(place) = initializer.try_to_place(self) { - let LocalInfo::User(BindingForm::Var( - VarBindingForm { opt_match_place: Some((ref mut match_place, _)), .. }, - )) = **self.local_decls[local].local_info.as_mut().assert_crate_local() else { + let LocalInfo::User(BindingForm::Var(VarBindingForm { + opt_match_place: Some((ref mut match_place, _)), + .. + })) = **self.local_decls[local].local_info.as_mut().assert_crate_local() + else { bug!("Let binding to non-user variable.") }; *match_place = Some(place); diff --git a/compiler/rustc_mir_build/src/build/matches/test.rs b/compiler/rustc_mir_build/src/build/matches/test.rs index e6806177dec..9ac5f00ee46 100644 --- a/compiler/rustc_mir_build/src/build/matches/test.rs +++ b/compiler/rustc_mir_build/src/build/matches/test.rs @@ -88,7 +88,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { switch_ty: Ty<'tcx>, options: &mut FxIndexMap<ConstantKind<'tcx>, u128>, ) -> bool { - let Some(match_pair) = candidate.match_pairs.iter().find(|mp| mp.place == *test_place) else { + let Some(match_pair) = candidate.match_pairs.iter().find(|mp| mp.place == *test_place) + else { return false; }; @@ -126,7 +127,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { candidate: &Candidate<'pat, 'tcx>, variants: &mut BitSet<VariantIdx>, ) -> bool { - let Some(match_pair) = candidate.match_pairs.iter().find(|mp| mp.place == *test_place) else { + let Some(match_pair) = candidate.match_pairs.iter().find(|mp| mp.place == *test_place) + else { return false; }; diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs index 6b2b140fa25..6e9df1c2daa 100644 --- a/compiler/rustc_mir_build/src/check_unsafety.rs +++ b/compiler/rustc_mir_build/src/check_unsafety.rs @@ -712,9 +712,7 @@ pub fn thir_check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) { return; } - let Ok((thir, expr)) = tcx.thir_body(def) else { - return - }; + let Ok((thir, expr)) = tcx.thir_body(def) else { return }; let thir = &thir.borrow(); // If `thir` is empty, a type error occurred, skip this body. if thir.exprs.is_empty() { diff --git a/compiler/rustc_mir_build/src/thir/cx/expr.rs b/compiler/rustc_mir_build/src/thir/cx/expr.rs index 37537683f0d..accc02b5987 100644 --- a/compiler/rustc_mir_build/src/thir/cx/expr.rs +++ b/compiler/rustc_mir_build/src/thir/cx/expr.rs @@ -41,11 +41,6 @@ impl<'tcx> Cx<'tcx> { let mut expr = self.make_mirror_unadjusted(hir_expr); - let adjustment_span = match self.adjustment_span { - Some((hir_id, span)) if hir_id == hir_expr.hir_id => Some(span), - _ => None, - }; - trace!(?expr.ty); // Now apply adjustments, if any. @@ -53,12 +48,7 @@ impl<'tcx> Cx<'tcx> { for adjustment in self.typeck_results.expr_adjustments(hir_expr) { trace!(?expr, ?adjustment); let span = expr.span; - expr = self.apply_adjustment( - hir_expr, - expr, - adjustment, - adjustment_span.unwrap_or(span), - ); + expr = self.apply_adjustment(hir_expr, expr, adjustment, span); } } @@ -274,7 +264,6 @@ impl<'tcx> Cx<'tcx> { fn make_mirror_unadjusted(&mut self, expr: &'tcx hir::Expr<'tcx>) -> Expr<'tcx> { let tcx = self.tcx; let expr_ty = self.typeck_results().expr_ty(expr); - let expr_span = expr.span; let temp_lifetime = self.rvalue_scopes.temporary_scope(self.region_scope_tree, expr.hir_id.local_id); @@ -283,17 +272,11 @@ impl<'tcx> Cx<'tcx> { hir::ExprKind::MethodCall(segment, receiver, ref args, fn_span) => { // Rewrite a.b(c) into UFCS form like Trait::b(a, c) let expr = self.method_callee(expr, segment.ident.span, None); - // When we apply adjustments to the receiver, use the span of - // the overall method call for better diagnostics. args[0] - // is guaranteed to exist, since a method call always has a receiver. - let old_adjustment_span = - self.adjustment_span.replace((receiver.hir_id, expr_span)); info!("Using method span: {:?}", expr.span); let args = std::iter::once(receiver) .chain(args.iter()) .map(|expr| self.mirror_expr(expr)) .collect(); - self.adjustment_span = old_adjustment_span; ExprKind::Call { ty: expr.ty, fun: self.thir.exprs.push(expr), diff --git a/compiler/rustc_mir_build/src/thir/cx/mod.rs b/compiler/rustc_mir_build/src/thir/cx/mod.rs index e6a98d1aab0..e09e22af761 100644 --- a/compiler/rustc_mir_build/src/thir/cx/mod.rs +++ b/compiler/rustc_mir_build/src/thir/cx/mod.rs @@ -16,7 +16,6 @@ use rustc_hir::Node; use rustc_middle::middle::region; use rustc_middle::thir::*; use rustc_middle::ty::{self, RvalueScopes, Ty, TyCtxt}; -use rustc_span::Span; pub(crate) fn thir_body( tcx: TyCtxt<'_>, @@ -62,14 +61,6 @@ struct Cx<'tcx> { typeck_results: &'tcx ty::TypeckResults<'tcx>, rvalue_scopes: &'tcx RvalueScopes, - /// When applying adjustments to the expression - /// with the given `HirId`, use the given `Span`, - /// instead of the usual span. This is used to - /// assign the span of an overall method call - /// (e.g. `my_val.foo()`) to the adjustment expressions - /// for the receiver. - adjustment_span: Option<(HirId, Span)>, - /// False to indicate that adjustments should not be applied. Only used for `custom_mir` apply_adjustments: bool, @@ -110,7 +101,6 @@ impl<'tcx> Cx<'tcx> { typeck_results, rvalue_scopes: &typeck_results.rvalue_scopes, body_owner: def.to_def_id(), - adjustment_span: None, apply_adjustments: hir .attrs(hir_id) .iter() diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index ef60f08bf02..0eaaa411415 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -942,7 +942,9 @@ fn maybe_point_at_variant<'a, 'p: 'a, 'tcx: 'a>( /// This analysis is *not* subsumed by NLL. fn check_borrow_conflicts_in_at_patterns<'tcx>(cx: &MatchVisitor<'_, '_, 'tcx>, pat: &Pat<'tcx>) { // Extract `sub` in `binding @ sub`. - let PatKind::Binding { name, mode, ty, subpattern: Some(box ref sub), .. } = pat.kind else { return }; + let PatKind::Binding { name, mode, ty, subpattern: Some(box ref sub), .. } = pat.kind else { + return; + }; let is_binding_by_move = |ty: Ty<'tcx>| !ty.is_copy_modulo_regions(cx.tcx, cx.param_env); diff --git a/compiler/rustc_mir_dataflow/src/impls/mod.rs b/compiler/rustc_mir_dataflow/src/impls/mod.rs index cb74bea724a..633b99a332b 100644 --- a/compiler/rustc_mir_dataflow/src/impls/mod.rs +++ b/compiler/rustc_mir_dataflow/src/impls/mod.rs @@ -321,7 +321,9 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, 'tcx> { // Mark all places as "maybe init" if they are mutably borrowed. See #90752. for_each_mut_borrow(statement, location, |place| { - let LookupResult::Exact(mpi) = self.move_data().rev_lookup.find(place.as_ref()) else { return }; + let LookupResult::Exact(mpi) = self.move_data().rev_lookup.find(place.as_ref()) else { + return; + }; on_all_children_bits(self.tcx, self.body, self.move_data(), mpi, |child| { trans.gen(child); }) @@ -343,7 +345,9 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, 'tcx> { } for_each_mut_borrow(terminator, location, |place| { - let LookupResult::Exact(mpi) = self.move_data().rev_lookup.find(place.as_ref()) else { return }; + let LookupResult::Exact(mpi) = self.move_data().rev_lookup.find(place.as_ref()) else { + return; + }; on_all_children_bits(self.tcx, self.body, self.move_data(), mpi, |child| { trans.gen(child); }) diff --git a/compiler/rustc_mir_transform/src/const_prop.rs b/compiler/rustc_mir_transform/src/const_prop.rs index 2f2c7357b00..f3ac679f97b 100644 --- a/compiler/rustc_mir_transform/src/const_prop.rs +++ b/compiler/rustc_mir_transform/src/const_prop.rs @@ -22,8 +22,8 @@ use rustc_target::spec::abi::Abi as CallAbi; use crate::MirPass; use rustc_const_eval::interpret::{ - self, compile_time_machine, AllocId, ConstAllocation, ConstValue, Frame, ImmTy, Immediate, - InterpCx, InterpResult, LocalValue, MemoryKind, OpTy, PlaceTy, Pointer, Scalar, + self, compile_time_machine, AllocId, ConstAllocation, ConstValue, FnArg, Frame, ImmTy, + Immediate, InterpCx, InterpResult, LocalValue, MemoryKind, OpTy, PlaceTy, Pointer, Scalar, StackPopCleanup, }; @@ -185,7 +185,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for ConstPropMachine<'mir, 'tcx> _ecx: &mut InterpCx<'mir, 'tcx, Self>, _instance: ty::Instance<'tcx>, _abi: CallAbi, - _args: &[OpTy<'tcx>], + _args: &[FnArg<'tcx>], _destination: &PlaceTy<'tcx>, _target: Option<BasicBlock>, _unwind: UnwindAction, diff --git a/compiler/rustc_mir_transform/src/copy_prop.rs b/compiler/rustc_mir_transform/src/copy_prop.rs index 3df459dfa79..47d9f52bfb5 100644 --- a/compiler/rustc_mir_transform/src/copy_prop.rs +++ b/compiler/rustc_mir_transform/src/copy_prop.rs @@ -76,9 +76,11 @@ fn fully_moved_locals(ssa: &SsaLocals, body: &Body<'_>) -> BitSet<Local> { let mut fully_moved = BitSet::new_filled(body.local_decls.len()); for (_, rvalue, _) in ssa.assignments(body) { - let (Rvalue::Use(Operand::Copy(place) | Operand::Move(place)) | Rvalue::CopyForDeref(place)) - = rvalue - else { continue }; + let (Rvalue::Use(Operand::Copy(place) | Operand::Move(place)) + | Rvalue::CopyForDeref(place)) = rvalue + else { + continue; + }; let Some(rhs) = place.as_local() else { continue }; if !ssa.is_ssa(rhs) { diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs index 78fb196358f..7d7588fcaec 100644 --- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs +++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs @@ -281,7 +281,7 @@ impl<'tcx> ValueAnalysis<'tcx> for ConstAnalysis<'_, 'tcx> { let FlatSet::Elem(choice) = discr_value else { // Do nothing if we don't know which branch will be taken. - return + return; }; if target.value.map(|n| n == choice).unwrap_or(!handled) { @@ -532,7 +532,7 @@ impl<'tcx, 'map, 'a> Visitor<'tcx> for OperandCollector<'tcx, 'map, 'a> { struct DummyMachine; -impl<'mir, 'tcx> rustc_const_eval::interpret::Machine<'mir, 'tcx> for DummyMachine { +impl<'mir, 'tcx: 'mir> rustc_const_eval::interpret::Machine<'mir, 'tcx> for DummyMachine { rustc_const_eval::interpret::compile_time_machine!(<'mir, 'tcx>); type MemoryKind = !; const PANIC_ON_ALLOC_FAIL: bool = true; @@ -557,7 +557,7 @@ impl<'mir, 'tcx> rustc_const_eval::interpret::Machine<'mir, 'tcx> for DummyMachi _ecx: &mut InterpCx<'mir, 'tcx, Self>, _instance: ty::Instance<'tcx>, _abi: rustc_target::spec::abi::Abi, - _args: &[rustc_const_eval::interpret::OpTy<'tcx, Self::Provenance>], + _args: &[rustc_const_eval::interpret::FnArg<'tcx, Self::Provenance>], _destination: &rustc_const_eval::interpret::PlaceTy<'tcx, Self::Provenance>, _target: Option<BasicBlock>, _unwind: UnwindAction, diff --git a/compiler/rustc_mir_transform/src/dest_prop.rs b/compiler/rustc_mir_transform/src/dest_prop.rs index a31551cf619..b73b72c3192 100644 --- a/compiler/rustc_mir_transform/src/dest_prop.rs +++ b/compiler/rustc_mir_transform/src/dest_prop.rs @@ -218,9 +218,9 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation { if merged_locals.contains(*src) { continue; } - let Some(dest) = - candidates.iter().find(|dest| !merged_locals.contains(**dest)) else { - continue; + let Some(dest) = candidates.iter().find(|dest| !merged_locals.contains(**dest)) + else { + continue; }; if !tcx.consider_optimizing(|| { format!("{} round {}", tcx.def_path_str(def_id), round_count) @@ -601,9 +601,7 @@ impl WriteInfo { rhs: &Operand<'tcx>, body: &Body<'tcx>, ) { - let Some(rhs) = rhs.place() else { - return - }; + let Some(rhs) = rhs.place() else { return }; if let Some(pair) = places_to_candidate_pair(lhs, rhs, body) { self.skip_pair = Some(pair); } diff --git a/compiler/rustc_mir_transform/src/early_otherwise_branch.rs b/compiler/rustc_mir_transform/src/early_otherwise_branch.rs index 8a7b027ddda..319fb4eaf3e 100644 --- a/compiler/rustc_mir_transform/src/early_otherwise_branch.rs +++ b/compiler/rustc_mir_transform/src/early_otherwise_branch.rs @@ -107,9 +107,7 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch { for i in 0..body.basic_blocks.len() { let bbs = &*body.basic_blocks; let parent = BasicBlock::from_usize(i); - let Some(opt_data) = evaluate_candidate(tcx, body, parent) else { - continue - }; + let Some(opt_data) = evaluate_candidate(tcx, body, parent) else { continue }; if !tcx.consider_optimizing(|| format!("EarlyOtherwiseBranch {:?}", &opt_data)) { break; @@ -119,10 +117,9 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch { should_cleanup = true; - let TerminatorKind::SwitchInt { - discr: parent_op, - targets: parent_targets - } = &bbs[parent].terminator().kind else { + let TerminatorKind::SwitchInt { discr: parent_op, targets: parent_targets } = + &bbs[parent].terminator().kind + else { unreachable!() }; // Always correct since we can only switch on `Copy` types @@ -168,7 +165,8 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch { ); let eq_new_targets = parent_targets.iter().map(|(value, child)| { - let TerminatorKind::SwitchInt{ targets, .. } = &bbs[child].terminator().kind else { + let TerminatorKind::SwitchInt { targets, .. } = &bbs[child].terminator().kind + else { unreachable!() }; (value, targets.target_for_value(value)) @@ -311,11 +309,9 @@ fn evaluate_candidate<'tcx>( parent: BasicBlock, ) -> Option<OptimizationData<'tcx>> { let bbs = &body.basic_blocks; - let TerminatorKind::SwitchInt { - targets, - discr: parent_discr, - } = &bbs[parent].terminator().kind else { - return None + let TerminatorKind::SwitchInt { targets, discr: parent_discr } = &bbs[parent].terminator().kind + else { + return None; }; let parent_ty = parent_discr.ty(body.local_decls(), tcx); let parent_dest = { @@ -332,18 +328,16 @@ fn evaluate_candidate<'tcx>( }; let (_, child) = targets.iter().next()?; let child_terminator = &bbs[child].terminator(); - let TerminatorKind::SwitchInt { - targets: child_targets, - discr: child_discr, - } = &child_terminator.kind else { - return None + let TerminatorKind::SwitchInt { targets: child_targets, discr: child_discr } = + &child_terminator.kind + else { + return None; }; let child_ty = child_discr.ty(body.local_decls(), tcx); if child_ty != parent_ty { return None; } - let Some(StatementKind::Assign(boxed)) - = &bbs[child].statements.first().map(|x| &x.kind) else { + let Some(StatementKind::Assign(boxed)) = &bbs[child].statements.first().map(|x| &x.kind) else { return None; }; let (_, Rvalue::Discriminant(child_place)) = &**boxed else { @@ -383,12 +377,8 @@ fn verify_candidate_branch<'tcx>( return false; } // ...assign the discriminant of `place` in that statement - let StatementKind::Assign(boxed) = &branch.statements[0].kind else { - return false - }; - let (discr_place, Rvalue::Discriminant(from_place)) = &**boxed else { - return false - }; + let StatementKind::Assign(boxed) = &branch.statements[0].kind else { return false }; + let (discr_place, Rvalue::Discriminant(from_place)) = &**boxed else { return false }; if *from_place != place { return false; } @@ -397,8 +387,9 @@ fn verify_candidate_branch<'tcx>( return false; } // ...terminate on a `SwitchInt` that invalidates that local - let TerminatorKind::SwitchInt{ discr: switch_op, targets, .. } = &branch.terminator().kind else { - return false + let TerminatorKind::SwitchInt { discr: switch_op, targets, .. } = &branch.terminator().kind + else { + return false; }; if *switch_op != Operand::Move(*discr_place) { return false; diff --git a/compiler/rustc_mir_transform/src/generator.rs b/compiler/rustc_mir_transform/src/generator.rs index 264bc61f1b3..1154086d9b0 100644 --- a/compiler/rustc_mir_transform/src/generator.rs +++ b/compiler/rustc_mir_transform/src/generator.rs @@ -1763,7 +1763,9 @@ fn check_suspend_tys<'tcx>(tcx: TyCtxt<'tcx>, layout: &GeneratorLayout<'tcx>, bo debug!(?decl); if !decl.ignore_for_traits && linted_tys.insert(decl.ty) { - let Some(hir_id) = decl.source_info.scope.lint_root(&body.source_scopes) else { continue }; + let Some(hir_id) = decl.source_info.scope.lint_root(&body.source_scopes) else { + continue; + }; check_must_not_suspend_ty( tcx, diff --git a/compiler/rustc_mir_transform/src/instsimplify.rs b/compiler/rustc_mir_transform/src/instsimplify.rs index e4dc617620e..a6af2eabda1 100644 --- a/compiler/rustc_mir_transform/src/instsimplify.rs +++ b/compiler/rustc_mir_transform/src/instsimplify.rs @@ -189,19 +189,19 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> { statements: &mut Vec<Statement<'tcx>>, ) { let TerminatorKind::Call { func, args, destination, target, .. } = &mut terminator.kind - else { return }; + else { + return; + }; // It's definitely not a clone if there are multiple arguments if args.len() != 1 { return; } - let Some(destination_block) = *target - else { return }; + let Some(destination_block) = *target else { return }; // Only bother looking more if it's easy to know what we're calling - let Some((fn_def_id, fn_substs)) = func.const_fn_def() - else { return }; + let Some((fn_def_id, fn_substs)) = func.const_fn_def() else { return }; // Clone needs one subst, so we can cheaply rule out other stuff if fn_substs.len() != 1 { @@ -212,8 +212,7 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> { // doing DefId lookups to figure out what we're actually calling. let arg_ty = args[0].ty(self.local_decls, self.tcx); - let ty::Ref(_region, inner_ty, Mutability::Not) = *arg_ty.kind() - else { return }; + let ty::Ref(_region, inner_ty, Mutability::Not) = *arg_ty.kind() else { return }; if !inner_ty.is_trivially_pure_clone_copy() { return; @@ -234,8 +233,7 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> { return; } - let Some(arg_place) = args.pop().unwrap().place() - else { return }; + let Some(arg_place) = args.pop().unwrap().place() else { return }; statements.push(Statement { source_info: terminator.source_info, @@ -254,8 +252,12 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> { terminator: &mut Terminator<'tcx>, _statements: &mut Vec<Statement<'tcx>>, ) { - let TerminatorKind::Call { func, target, .. } = &mut terminator.kind else { return; }; - let Some(target_block) = target else { return; }; + let TerminatorKind::Call { func, target, .. } = &mut terminator.kind else { + return; + }; + let Some(target_block) = target else { + return; + }; let func_ty = func.ty(self.local_decls, self.tcx); let Some((intrinsic_name, substs)) = resolve_rust_intrinsic(self.tcx, func_ty) else { return; diff --git a/compiler/rustc_mir_transform/src/lower_intrinsics.rs b/compiler/rustc_mir_transform/src/lower_intrinsics.rs index ce98e9b0c84..eccc59f923d 100644 --- a/compiler/rustc_mir_transform/src/lower_intrinsics.rs +++ b/compiler/rustc_mir_transform/src/lower_intrinsics.rs @@ -251,7 +251,9 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics { if let (Some(target), Some(arg)) = (*target, args[0].place()) { let ty::RawPtr(ty::TypeAndMut { ty: dest_ty, .. }) = destination.ty(local_decls, tcx).ty.kind() - else { bug!(); }; + else { + bug!(); + }; block.statements.push(Statement { source_info: terminator.source_info, diff --git a/compiler/rustc_mir_transform/src/remove_uninit_drops.rs b/compiler/rustc_mir_transform/src/remove_uninit_drops.rs index 283931de043..d46690cc8b9 100644 --- a/compiler/rustc_mir_transform/src/remove_uninit_drops.rs +++ b/compiler/rustc_mir_transform/src/remove_uninit_drops.rs @@ -38,8 +38,7 @@ impl<'tcx> MirPass<'tcx> for RemoveUninitDrops { let mut to_remove = vec![]; for (bb, block) in body.basic_blocks.iter_enumerated() { let terminator = block.terminator(); - let TerminatorKind::Drop { place, .. } = &terminator.kind - else { continue }; + let TerminatorKind::Drop { place, .. } = &terminator.kind else { continue }; maybe_inits.seek_before_primary_effect(body.terminator_loc(bb)); @@ -64,9 +63,9 @@ impl<'tcx> MirPass<'tcx> for RemoveUninitDrops { for bb in to_remove { let block = &mut body.basic_blocks_mut()[bb]; - let TerminatorKind::Drop { target, .. } - = &block.terminator().kind - else { unreachable!() }; + let TerminatorKind::Drop { target, .. } = &block.terminator().kind else { + unreachable!() + }; // Replace block terminator with `Goto`. block.terminator_mut().kind = TerminatorKind::Goto { target: *target }; diff --git a/compiler/rustc_mir_transform/src/simplify.rs b/compiler/rustc_mir_transform/src/simplify.rs index e59219321b7..b7a51cfd619 100644 --- a/compiler/rustc_mir_transform/src/simplify.rs +++ b/compiler/rustc_mir_transform/src/simplify.rs @@ -199,7 +199,8 @@ impl<'a, 'tcx> CfgSimplifier<'a, 'tcx> { let last = current; *start = last; while let Some((current, mut terminator)) = terminators.pop() { - let Terminator { kind: TerminatorKind::Goto { ref mut target }, .. } = terminator else { + let Terminator { kind: TerminatorKind::Goto { ref mut target }, .. } = terminator + else { unreachable!(); }; *changed |= *target != last; diff --git a/compiler/rustc_mir_transform/src/sroa.rs b/compiler/rustc_mir_transform/src/sroa.rs index 881a1547c52..c8fa7fc4b2a 100644 --- a/compiler/rustc_mir_transform/src/sroa.rs +++ b/compiler/rustc_mir_transform/src/sroa.rs @@ -161,7 +161,9 @@ struct ReplacementMap<'tcx> { impl<'tcx> ReplacementMap<'tcx> { fn replace_place(&self, tcx: TyCtxt<'tcx>, place: PlaceRef<'tcx>) -> Option<Place<'tcx>> { - let &[PlaceElem::Field(f, _), ref rest @ ..] = place.projection else { return None; }; + let &[PlaceElem::Field(f, _), ref rest @ ..] = place.projection else { + return None; + }; let fields = self.fragments[place.local].as_ref()?; let (_, new_local) = fields[f]?; Some(Place { local: new_local, projection: tcx.mk_place_elems(&rest) }) diff --git a/compiler/rustc_mir_transform/src/ssa.rs b/compiler/rustc_mir_transform/src/ssa.rs index 8dc2dfe13bd..04bc461c815 100644 --- a/compiler/rustc_mir_transform/src/ssa.rs +++ b/compiler/rustc_mir_transform/src/ssa.rs @@ -266,9 +266,11 @@ fn compute_copy_classes(ssa: &mut SsaLocals, body: &Body<'_>) { let mut copies = IndexVec::from_fn_n(|l| l, body.local_decls.len()); for (local, rvalue, _) in ssa.assignments(body) { - let (Rvalue::Use(Operand::Copy(place) | Operand::Move(place)) | Rvalue::CopyForDeref(place)) - = rvalue - else { continue }; + let (Rvalue::Use(Operand::Copy(place) | Operand::Move(place)) + | Rvalue::CopyForDeref(place)) = rvalue + else { + continue; + }; let Some(rhs) = place.as_local() else { continue }; let local_ty = body.local_decls()[local].ty; diff --git a/compiler/rustc_mir_transform/src/uninhabited_enum_branching.rs b/compiler/rustc_mir_transform/src/uninhabited_enum_branching.rs index 5389b9f52eb..092bcb5c979 100644 --- a/compiler/rustc_mir_transform/src/uninhabited_enum_branching.rs +++ b/compiler/rustc_mir_transform/src/uninhabited_enum_branching.rs @@ -105,7 +105,8 @@ impl<'tcx> MirPass<'tcx> for UninhabitedEnumBranching { for bb in body.basic_blocks.indices() { trace!("processing block {:?}", bb); - let Some(discriminant_ty) = get_switched_on_type(&body.basic_blocks[bb], tcx, body) else { + let Some(discriminant_ty) = get_switched_on_type(&body.basic_blocks[bb], tcx, body) + else { continue; }; diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 0ce6a570d25..8455803ad0c 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -1434,8 +1434,9 @@ impl<'a> Parser<'a> { self.inc_dec_standalone_suggest(kind, spans).emit_verbose(&mut err) } IsStandalone::Subexpr => { - let Ok(base_src) = self.span_to_snippet(base.span) - else { return help_base_case(err, base) }; + let Ok(base_src) = self.span_to_snippet(base.span) else { + return help_base_case(err, base); + }; match kind.fixity { UnaryFixity::Pre => { self.prefix_inc_dec_suggest(base_src, kind, spans).emit(&mut err) diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index c23420661fa..e4d843b7c8b 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -1289,7 +1289,9 @@ impl<'a> Parser<'a> { delimited.then(|| { // We've confirmed above that there is a delimiter so unwrapping is OK. - let TokenTree::Delimited(dspan, delim, tokens) = self.parse_token_tree() else { unreachable!() }; + let TokenTree::Delimited(dspan, delim, tokens) = self.parse_token_tree() else { + unreachable!() + }; DelimArgs { dspan, delim: MacDelimiter::from_token(delim).unwrap(), tokens } }) diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index f48900c3c52..c93d65b02f9 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -1432,9 +1432,9 @@ impl CheckAttrVisitor<'_> { }; let Some(ItemLike::Item(Item { - kind: ItemKind::Fn(FnSig { decl, .. }, generics, _), - .. - })) = item else { + kind: ItemKind::Fn(FnSig { decl, .. }, generics, _), .. + })) = item + else { bug!("should be a function item"); }; @@ -2106,8 +2106,12 @@ impl CheckAttrVisitor<'_> { } let tcx = self.tcx; - let Some(token_stream_def_id) = tcx.get_diagnostic_item(sym::TokenStream) else { return; }; - let Some(token_stream) = tcx.type_of(token_stream_def_id).no_bound_vars() else { return; }; + let Some(token_stream_def_id) = tcx.get_diagnostic_item(sym::TokenStream) else { + return; + }; + let Some(token_stream) = tcx.type_of(token_stream_def_id).no_bound_vars() else { + return; + }; let def_id = hir_id.expect_owner().def_id; let param_env = ty::ParamEnv::empty(); diff --git a/compiler/rustc_passes/src/liveness.rs b/compiler/rustc_passes/src/liveness.rs index 803ca05b202..3ebba7056e9 100644 --- a/compiler/rustc_passes/src/liveness.rs +++ b/compiler/rustc_passes/src/liveness.rs @@ -1683,12 +1683,16 @@ impl<'tcx> Liveness<'_, 'tcx> { opt_body: Option<&hir::Body<'_>>, ) -> Vec<errors::UnusedVariableStringInterp> { let mut suggs = Vec::new(); - let Some(opt_body) = opt_body else { return suggs; }; + let Some(opt_body) = opt_body else { + return suggs; + }; let mut visitor = CollectLitsVisitor { lit_exprs: vec![] }; intravisit::walk_body(&mut visitor, opt_body); for lit_expr in visitor.lit_exprs { let hir::ExprKind::Lit(litx) = &lit_expr.kind else { continue }; - let rustc_ast::LitKind::Str(syb, _) = litx.node else{ continue; }; + let rustc_ast::LitKind::Str(syb, _) = litx.node else { + continue; + }; let name_str: &str = syb.as_str(); let name_pa = format!("{{{name}}}"); if name_str.contains(&name_pa) { diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index b81b7ad6013..25a3d38c144 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -856,7 +856,9 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> { /// See issue #94972 for details on why this is a special case fn is_unstable_reexport(tcx: TyCtxt<'_>, id: hir::HirId) -> bool { // Get the LocalDefId so we can lookup the item to check the kind. - let Some(owner) = id.as_owner() else { return false; }; + let Some(owner) = id.as_owner() else { + return false; + }; let def_id = owner.def_id; let Some(stab) = tcx.stability().local_stability(def_id) else { diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index d37fe783bba..526fc9c3aa5 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -1300,9 +1300,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { let ImportKind::Glob { id, is_prelude, .. } = import.kind else { unreachable!() }; let ModuleOrUniformRoot::Module(module) = import.imported_module.get().unwrap() else { - self.tcx.sess.create_err(CannotGlobImportAllCrates { - span: import.span, - }).emit(); + self.tcx.sess.create_err(CannotGlobImportAllCrates { span: import.span }).emit(); return; }; diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index f6c7aecf8b0..f36b01c1a1f 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -2460,8 +2460,11 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { F: FnOnce(&mut Self), { debug!("with_generic_param_rib"); - let LifetimeRibKind::Generics { binder, span: generics_span, kind: generics_kind, .. } - = lifetime_kind else { panic!() }; + let LifetimeRibKind::Generics { binder, span: generics_span, kind: generics_kind, .. } = + lifetime_kind + else { + panic!() + }; let mut function_type_rib = Rib::new(kind); let mut function_value_rib = Rib::new(kind); @@ -2972,7 +2975,9 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { F: FnOnce(Ident, String, Option<Symbol>) -> ResolutionError<'a>, { // If there is a TraitRef in scope for an impl, then the method must be in the trait. - let Some((module, _)) = self.current_trait_ref else { return; }; + let Some((module, _)) = self.current_trait_ref else { + return; + }; ident.span.normalize_to_macros_2_0_and_adjust(module.expansion); let key = BindingKey::new(ident, ns); let mut binding = self.r.resolution(module, key).try_borrow().ok().and_then(|r| r.binding); @@ -3917,11 +3922,15 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { }; if res == unqualified_result { let lint = lint::builtin::UNUSED_QUALIFICATIONS; - self.r.lint_buffer.buffer_lint( + self.r.lint_buffer.buffer_lint_with_diagnostic( lint, finalize.node_id, finalize.path_span, "unnecessary qualification", + lint::BuiltinLintDiagnostics::UnusedQualifications { + path_span: finalize.path_span, + unqualified_path: path.last().unwrap().ident + } ) } } diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 78ef72a7e34..753a1adc66d 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -446,20 +446,29 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { err: &mut Diagnostic, base_error: &BaseError, ) { - let Some(ty) = self.diagnostic_metadata.current_type_path else { return; }; - let TyKind::Path(_, path) = &ty.kind else { return; }; + let Some(ty) = self.diagnostic_metadata.current_type_path else { + return; + }; + let TyKind::Path(_, path) = &ty.kind else { + return; + }; for segment in &path.segments { - let Some(params) = &segment.args else { continue; }; - let ast::GenericArgs::AngleBracketed(ref params) = params.deref() else { continue; }; + let Some(params) = &segment.args else { + continue; + }; + let ast::GenericArgs::AngleBracketed(ref params) = params.deref() else { + continue; + }; for param in ¶ms.args { - let ast::AngleBracketedArg::Constraint(constraint) = param else { continue; }; + let ast::AngleBracketedArg::Constraint(constraint) = param else { + continue; + }; let ast::AssocConstraintKind::Bound { bounds } = &constraint.kind else { continue; }; for bound in bounds { - let ast::GenericBound::Trait(trait_ref, ast::TraitBoundModifier::None) - = bound else - { + let ast::GenericBound::Trait(trait_ref, ast::TraitBoundModifier::None) = bound + else { continue; }; if base_error.span == trait_ref.span { @@ -1148,7 +1157,11 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { &poly_trait_ref.trait_ref.path.segments[..] { if ident.span == span { - let Some(new_where_bound_predicate) = mk_where_bound_predicate(path, poly_trait_ref, ty) else { return false; }; + let Some(new_where_bound_predicate) = + mk_where_bound_predicate(path, poly_trait_ref, ty) + else { + return false; + }; err.span_suggestion_verbose( *where_span, format!("constrain the associated type to `{}`", ident), @@ -1831,7 +1844,8 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { None, ) { Some(found) => { - let Some(sugg) = names.into_iter().find(|suggestion| suggestion.candidate == found) else { + let Some(sugg) = names.into_iter().find(|suggestion| suggestion.candidate == found) + else { return TypoCandidate::None; }; if found == name { @@ -2677,7 +2691,9 @@ fn mk_where_bound_predicate( use rustc_span::DUMMY_SP; let modified_segments = { let mut segments = path.segments.clone(); - let [preceding @ .., second_last, last] = segments.as_mut_slice() else { return None; }; + let [preceding @ .., second_last, last] = segments.as_mut_slice() else { + return None; + }; let mut segments = ThinVec::from(preceding); let added_constraint = ast::AngleBracketedArg::Constraint(ast::AssocConstraint { diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index da3d86a4718..faa672db59c 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -1871,7 +1871,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } else { let crate_id = if finalize { let Some(crate_id) = - self.crate_loader(|c| c.process_path_extern(ident.name, ident.span)) else { return Some(self.dummy_binding); }; + self.crate_loader(|c| c.process_path_extern(ident.name, ident.span)) + else { + return Some(self.dummy_binding); + }; crate_id } else { self.crate_loader(|c| c.maybe_process_path_extern(ident.name))? diff --git a/compiler/rustc_smir/src/rustc_internal/mod.rs b/compiler/rustc_smir/src/rustc_internal/mod.rs index 87e0b211556..527d5220564 100644 --- a/compiler/rustc_smir/src/rustc_internal/mod.rs +++ b/compiler/rustc_smir/src/rustc_internal/mod.rs @@ -27,21 +27,33 @@ pub fn crate_item(did: DefId) -> stable_mir::CrateItem { with_tables(|t| t.crate_item(did)) } +pub fn adt_def(did: DefId) -> stable_mir::ty::AdtDef { + with_tables(|t| t.adt_def(did)) +} + impl<'tcx> Tables<'tcx> { pub fn item_def_id(&self, item: &stable_mir::CrateItem) -> DefId { self.def_ids[item.0] } pub fn crate_item(&mut self, did: DefId) -> stable_mir::CrateItem { + stable_mir::CrateItem(self.create_def_id(did)) + } + + pub fn adt_def(&mut self, did: DefId) -> stable_mir::ty::AdtDef { + stable_mir::ty::AdtDef(self.create_def_id(did)) + } + + fn create_def_id(&mut self, did: DefId) -> stable_mir::DefId { // FIXME: this becomes inefficient when we have too many ids for (i, &d) in self.def_ids.iter().enumerate() { if d == did { - return stable_mir::CrateItem(i); + return i; } } let id = self.def_ids.len(); self.def_ids.push(did); - stable_mir::CrateItem(id) + id } } diff --git a/compiler/rustc_smir/src/rustc_smir/mod.rs b/compiler/rustc_smir/src/rustc_smir/mod.rs index f22c620021e..df682cd8f3a 100644 --- a/compiler/rustc_smir/src/rustc_smir/mod.rs +++ b/compiler/rustc_smir/src/rustc_smir/mod.rs @@ -8,7 +8,7 @@ //! For now, we are developing everything inside `rustc`, thus, we keep this module private. use crate::rustc_internal::{self, opaque}; -use crate::stable_mir::ty::{FloatTy, IntTy, RigidTy, TyKind, UintTy}; +use crate::stable_mir::ty::{AdtSubsts, FloatTy, GenericArgKind, IntTy, RigidTy, TyKind, UintTy}; use crate::stable_mir::{self, Context}; use rustc_middle::mir; use rustc_middle::ty::{self, Ty, TyCtxt}; @@ -94,7 +94,25 @@ impl<'tcx> Tables<'tcx> { ty::FloatTy::F32 => TyKind::RigidTy(RigidTy::Float(FloatTy::F32)), ty::FloatTy::F64 => TyKind::RigidTy(RigidTy::Float(FloatTy::F64)), }, - ty::Adt(_, _) => todo!(), + ty::Adt(adt_def, substs) => TyKind::RigidTy(RigidTy::Adt( + rustc_internal::adt_def(adt_def.did()), + AdtSubsts( + substs + .iter() + .map(|arg| match arg.unpack() { + ty::GenericArgKind::Lifetime(region) => { + GenericArgKind::Lifetime(opaque(®ion)) + } + ty::GenericArgKind::Type(ty) => { + GenericArgKind::Type(self.intern_ty(ty)) + } + ty::GenericArgKind::Const(const_) => { + GenericArgKind::Const(opaque(&const_)) + } + }) + .collect(), + ), + )), ty::Foreign(_) => todo!(), ty::Str => todo!(), ty::Array(_, _) => todo!(), @@ -103,12 +121,9 @@ impl<'tcx> Tables<'tcx> { ty::Ref(_, _, _) => todo!(), ty::FnDef(_, _) => todo!(), ty::FnPtr(_) => todo!(), - ty::Placeholder(..) => todo!(), ty::Dynamic(_, _, _) => todo!(), ty::Closure(_, _) => todo!(), ty::Generator(_, _, _) => todo!(), - ty::GeneratorWitness(_) => todo!(), - ty::GeneratorWitnessMIR(_, _) => todo!(), ty::Never => todo!(), ty::Tuple(fields) => TyKind::RigidTy(RigidTy::Tuple( fields.iter().map(|ty| self.intern_ty(ty)).collect(), @@ -116,8 +131,13 @@ impl<'tcx> Tables<'tcx> { ty::Alias(_, _) => todo!(), ty::Param(_) => todo!(), ty::Bound(_, _) => todo!(), - ty::Infer(_) => todo!(), - ty::Error(_) => todo!(), + ty::Placeholder(..) + | ty::GeneratorWitness(_) + | ty::GeneratorWitnessMIR(_, _) + | ty::Infer(_) + | ty::Error(_) => { + unreachable!(); + } } } @@ -147,13 +167,6 @@ pub(crate) trait Stable { fn stable(&self) -> Self::T; } -impl Stable for DefId { - type T = stable_mir::CrateItem; - fn stable(&self) -> Self::T { - rustc_internal::crate_item(*self) - } -} - impl<'tcx> Stable for mir::Statement<'tcx> { type T = stable_mir::mir::Statement; fn stable(&self) -> Self::T { @@ -188,7 +201,9 @@ impl<'tcx> Stable for mir::Rvalue<'tcx> { Ref(region, kind, place) => { stable_mir::mir::Rvalue::Ref(opaque(region), kind.stable(), place.stable()) } - ThreadLocalRef(def_id) => stable_mir::mir::Rvalue::ThreadLocalRef(def_id.stable()), + ThreadLocalRef(def_id) => { + stable_mir::mir::Rvalue::ThreadLocalRef(rustc_internal::crate_item(*def_id)) + } AddressOf(mutability, place) => { stable_mir::mir::Rvalue::AddressOf(mutability.stable(), place.stable()) } diff --git a/compiler/rustc_smir/src/stable_mir/ty.rs b/compiler/rustc_smir/src/stable_mir/ty.rs index 3181af46e9c..389e3364117 100644 --- a/compiler/rustc_smir/src/stable_mir/ty.rs +++ b/compiler/rustc_smir/src/stable_mir/ty.rs @@ -1,4 +1,5 @@ -use super::with; +use super::{with, DefId}; +use crate::rustc_internal::Opaque; #[derive(Copy, Clone, Debug)] pub struct Ty(pub usize); @@ -9,6 +10,9 @@ impl Ty { } } +type Const = Opaque; +type Region = Opaque; + #[derive(Clone, Debug)] pub enum TyKind { RigidTy(RigidTy), @@ -21,6 +25,7 @@ pub enum RigidTy { Int(IntTy), Uint(UintTy), Float(FloatTy), + Adt(AdtDef, AdtSubsts), Tuple(Vec<Ty>), } @@ -49,3 +54,18 @@ pub enum FloatTy { F32, F64, } + +#[derive(Clone, PartialEq, Eq, Debug)] +pub struct AdtDef(pub(crate) DefId); + +#[derive(Clone, Debug)] +pub struct AdtSubsts(pub Vec<GenericArgKind>); + +#[derive(Clone, Debug)] +pub enum GenericArgKind { + // FIXME add proper region + Lifetime(Region), + Type(Ty), + // FIXME add proper const + Const(Const), +} diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index 3bb9c4920c4..5c56337d1e0 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -2159,7 +2159,8 @@ where // 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 Some((file, line_lo, col_lo, line_hi, col_hi)) = ctx.span_data_to_lines_and_cols(&span) else { + let Some((file, line_lo, col_lo, line_hi, col_hi)) = ctx.span_data_to_lines_and_cols(&span) + else { Hash::hash(&TAG_INVALID_SPAN, hasher); return; }; diff --git a/compiler/rustc_trait_selection/src/solve/assembly/mod.rs b/compiler/rustc_trait_selection/src/solve/assembly/mod.rs index 28138054ae5..a93845d3331 100644 --- a/compiler/rustc_trait_selection/src/solve/assembly/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/assembly/mod.rs @@ -160,8 +160,8 @@ pub(super) trait GoalKind<'tcx>: Self::probe_and_match_goal_against_assumption(ecx, goal, assumption, |ecx| { let tcx = ecx.tcx(); let ty::Dynamic(bounds, _, _) = *goal.predicate.self_ty().kind() else { - bug!("expected object type in `consider_object_bound_candidate`"); - }; + bug!("expected object type in `consider_object_bound_candidate`"); + }; ecx.add_goals( structural_traits::predicates_for_object_candidate( &ecx, @@ -352,9 +352,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> { candidates: &mut Vec<Candidate<'tcx>>, ) { let tcx = self.tcx(); - let &ty::Alias(_, projection_ty) = goal.predicate.self_ty().kind() else { - return - }; + let &ty::Alias(_, projection_ty) = goal.predicate.self_ty().kind() else { return }; let normalized_self_candidates: Result<_, NoSolution> = self.probe(|_| CandidateKind::NormalizedSelfTyAssembly).enter(|ecx| { diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs index 74dfbdddbab..7b41e975474 100644 --- a/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs +++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs @@ -116,7 +116,8 @@ impl NestedGoals<'_> { #[derive(PartialEq, Eq, Debug, Hash, HashStable, Clone, Copy)] pub enum GenerateProofTree { Yes(UseGlobalCache), - No, + IfEnabled, + Never, } #[derive(PartialEq, Eq, Debug, Hash, HashStable, Clone, Copy)] @@ -202,7 +203,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> { (&tree, infcx.tcx.sess.opts.unstable_opts.dump_solver_proof_tree) { let mut lock = std::io::stdout().lock(); - let _ = lock.write_fmt(format_args!("{tree:?}")); + let _ = lock.write_fmt(format_args!("{tree:?}\n")); let _ = lock.flush(); } diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/select.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/select.rs index bf6cbef8c3b..141369b0337 100644 --- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/select.rs +++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/select.rs @@ -1,5 +1,6 @@ use std::ops::ControlFlow; +use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_infer::infer::{DefineOpaqueTypes, InferCtxt, InferOk}; use rustc_infer::traits::util::supertraits; @@ -11,7 +12,7 @@ use rustc_middle::traits::{ ImplSource, ImplSourceObjectData, ImplSourceTraitUpcastingData, ImplSourceUserDefinedData, ObligationCause, SelectionError, }; -use rustc_middle::ty::{self, TyCtxt}; +use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_span::DUMMY_SP; use crate::solve::assembly::{BuiltinImplSource, Candidate, CandidateSource}; @@ -40,7 +41,7 @@ impl<'tcx> InferCtxtSelectExt<'tcx> for InferCtxt<'tcx> { self.instantiate_binder_with_placeholders(obligation.predicate), ); - let (result, _) = EvalCtxt::enter_root(self, GenerateProofTree::No, |ecx| { + let (result, _) = EvalCtxt::enter_root(self, GenerateProofTree::Never, |ecx| { let goal = Goal::new(ecx.tcx(), trait_goal.param_env, trait_goal.predicate); let (orig_values, canonical_goal) = ecx.canonicalize_goal(goal); let mut candidates = ecx.compute_canonical_trait_candidates(canonical_goal); @@ -113,6 +114,12 @@ impl<'tcx> InferCtxtSelectExt<'tcx> for InferCtxt<'tcx> { ), ) => rematch_object(self, goal, nested_obligations), + (Certainty::Maybe(_), CandidateSource::BuiltinImpl(BuiltinImplSource::Misc)) + if self.tcx.lang_items().unsize_trait() == Some(goal.predicate.def_id()) => + { + rematch_unsize(self, goal, nested_obligations) + } + // Technically some builtin impls have nested obligations, but if // `Certainty::Yes`, then they should've all been verified and don't // need re-checking. @@ -221,10 +228,7 @@ fn rematch_object<'tcx>( mut nested: Vec<PredicateObligation<'tcx>>, ) -> SelectionResult<'tcx, Selection<'tcx>> { let self_ty = goal.predicate.self_ty(); - let ty::Dynamic(data, _, source_kind) = *self_ty.kind() - else { - bug!() - }; + let ty::Dynamic(data, _, source_kind) = *self_ty.kind() else { bug!() }; let source_trait_ref = data.principal().unwrap().with_self_ty(infcx.tcx, self_ty); let (is_upcasting, target_trait_ref_unnormalized) = if Some(goal.predicate.def_id()) @@ -232,6 +236,9 @@ fn rematch_object<'tcx>( { assert_eq!(source_kind, ty::Dyn, "cannot upcast dyn*"); if let ty::Dynamic(data, _, ty::Dyn) = goal.predicate.trait_ref.substs.type_at(1).kind() { + // FIXME: We also need to ensure that the source lifetime outlives the + // target lifetime. This doesn't matter for codegen, though, and only + // *really* matters if the goal's certainty is ambiguous. (true, data.principal().unwrap().with_self_ty(infcx.tcx, self_ty)) } else { bug!() @@ -305,3 +312,136 @@ fn rematch_object<'tcx>( ImplSource::Object(ImplSourceObjectData { vtable_base, nested }) })) } + +/// The `Unsize` trait is particularly important to coercion, so we try rematch it. +/// NOTE: This must stay in sync with `consider_builtin_unsize_candidate` in trait +/// goal assembly in the solver, both for soundness and in order to avoid ICEs. +fn rematch_unsize<'tcx>( + infcx: &InferCtxt<'tcx>, + goal: Goal<'tcx, ty::TraitPredicate<'tcx>>, + mut nested: Vec<PredicateObligation<'tcx>>, +) -> SelectionResult<'tcx, Selection<'tcx>> { + let tcx = infcx.tcx; + let a_ty = goal.predicate.self_ty(); + let b_ty = goal.predicate.trait_ref.substs.type_at(1); + + match (a_ty.kind(), b_ty.kind()) { + (_, &ty::Dynamic(data, region, ty::Dyn)) => { + // Check that the type implements all of the predicates of the def-id. + // (i.e. the principal, all of the associated types match, and any auto traits) + nested.extend(data.iter().map(|pred| { + Obligation::new( + infcx.tcx, + ObligationCause::dummy(), + goal.param_env, + pred.with_self_ty(tcx, a_ty), + ) + })); + // The type must be Sized to be unsized. + let sized_def_id = tcx.require_lang_item(hir::LangItem::Sized, None); + nested.push(Obligation::new( + infcx.tcx, + ObligationCause::dummy(), + goal.param_env, + ty::TraitRef::new(tcx, sized_def_id, [a_ty]), + )); + // The type must outlive the lifetime of the `dyn` we're unsizing into. + nested.push(Obligation::new( + infcx.tcx, + ObligationCause::dummy(), + goal.param_env, + ty::Binder::dummy(ty::OutlivesPredicate(a_ty, region)), + )); + } + // `[T; n]` -> `[T]` unsizing + (&ty::Array(a_elem_ty, ..), &ty::Slice(b_elem_ty)) => { + nested.extend( + infcx + .at(&ObligationCause::dummy(), goal.param_env) + .eq(DefineOpaqueTypes::No, a_elem_ty, b_elem_ty) + .expect("expected rematch to succeed") + .into_obligations(), + ); + } + // Struct unsizing `Struct<T>` -> `Struct<U>` where `T: Unsize<U>` + (&ty::Adt(a_def, a_substs), &ty::Adt(b_def, b_substs)) + if a_def.is_struct() && a_def.did() == b_def.did() => + { + let unsizing_params = tcx.unsizing_params_for_adt(a_def.did()); + // We must be unsizing some type parameters. This also implies + // that the struct has a tail field. + if unsizing_params.is_empty() { + bug!("expected rematch to succeed") + } + + let tail_field = a_def + .non_enum_variant() + .fields + .raw + .last() + .expect("expected unsized ADT to have a tail field"); + let tail_field_ty = tcx.type_of(tail_field.did); + + let a_tail_ty = tail_field_ty.subst(tcx, a_substs); + let b_tail_ty = tail_field_ty.subst(tcx, b_substs); + + // Substitute just the unsizing params from B into A. The type after + // this substitution must be equal to B. This is so we don't unsize + // unrelated type parameters. + let new_a_substs = + tcx.mk_substs_from_iter(a_substs.iter().enumerate().map(|(i, a)| { + if unsizing_params.contains(i as u32) { b_substs[i] } else { a } + })); + let unsized_a_ty = Ty::new_adt(tcx, a_def, new_a_substs); + + nested.extend( + infcx + .at(&ObligationCause::dummy(), goal.param_env) + .eq(DefineOpaqueTypes::No, unsized_a_ty, b_ty) + .expect("expected rematch to succeed") + .into_obligations(), + ); + + // Finally, we require that `TailA: Unsize<TailB>` for the tail field + // types. + nested.push(Obligation::new( + tcx, + ObligationCause::dummy(), + goal.param_env, + ty::TraitRef::new(tcx, goal.predicate.def_id(), [a_tail_ty, b_tail_ty]), + )); + } + // Tuple unsizing `(.., T)` -> `(.., U)` where `T: Unsize<U>` + (&ty::Tuple(a_tys), &ty::Tuple(b_tys)) + if a_tys.len() == b_tys.len() && !a_tys.is_empty() => + { + let (a_last_ty, a_rest_tys) = a_tys.split_last().unwrap(); + let b_last_ty = b_tys.last().unwrap(); + + // Substitute just the tail field of B., and require that they're equal. + let unsized_a_ty = + Ty::new_tup_from_iter(tcx, a_rest_tys.iter().chain([b_last_ty]).copied()); + nested.extend( + infcx + .at(&ObligationCause::dummy(), goal.param_env) + .eq(DefineOpaqueTypes::No, unsized_a_ty, b_ty) + .expect("expected rematch to succeed") + .into_obligations(), + ); + + // Similar to ADTs, require that the rest of the fields are equal. + nested.push(Obligation::new( + tcx, + ObligationCause::dummy(), + goal.param_env, + ty::TraitRef::new(tcx, goal.predicate.def_id(), [*a_last_ty, *b_last_ty]), + )); + } + // FIXME: We *could* ICE here if either: + // 1. the certainty is `Certainty::Yes`, + // 2. we're in codegen (which should mean `Certainty::Yes`). + _ => return Ok(None), + } + + Ok(Some(ImplSource::Builtin(nested))) +} diff --git a/compiler/rustc_trait_selection/src/solve/fulfill.rs b/compiler/rustc_trait_selection/src/solve/fulfill.rs index 88ee14c4db5..f1d3091225c 100644 --- a/compiler/rustc_trait_selection/src/solve/fulfill.rs +++ b/compiler/rustc_trait_selection/src/solve/fulfill.rs @@ -57,7 +57,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> { .map(|obligation| { let code = infcx.probe(|_| { match infcx - .evaluate_root_goal(obligation.clone().into(), GenerateProofTree::No) + .evaluate_root_goal(obligation.clone().into(), GenerateProofTree::IfEnabled) .0 { Ok((_, Certainty::Maybe(MaybeCause::Ambiguity), _)) => { @@ -96,7 +96,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> { for obligation in mem::take(&mut self.obligations) { let goal = obligation.clone().into(); let (changed, certainty, nested_goals) = - match infcx.evaluate_root_goal(goal, GenerateProofTree::No).0 { + match infcx.evaluate_root_goal(goal, GenerateProofTree::IfEnabled).0 { Ok(result) => result, Err(NoSolution) => { errors.push(FulfillmentError { diff --git a/compiler/rustc_trait_selection/src/solve/inspect.rs b/compiler/rustc_trait_selection/src/solve/inspect.rs index 2d6717fdad9..cda68396321 100644 --- a/compiler/rustc_trait_selection/src/solve/inspect.rs +++ b/compiler/rustc_trait_selection/src/solve/inspect.rs @@ -200,30 +200,23 @@ impl<'tcx> ProofTreeBuilder<'tcx> { tcx: TyCtxt<'tcx>, generate_proof_tree: GenerateProofTree, ) -> ProofTreeBuilder<'tcx> { - let generate_proof_tree = match ( - tcx.sess.opts.unstable_opts.dump_solver_proof_tree, - tcx.sess.opts.unstable_opts.dump_solver_proof_tree_use_cache, - generate_proof_tree, - ) { - (_, Some(use_cache), GenerateProofTree::Yes(_)) => { - GenerateProofTree::Yes(UseGlobalCache::from_bool(use_cache)) - } - - (DumpSolverProofTree::Always, use_cache, GenerateProofTree::No) => { - let use_cache = use_cache.unwrap_or(true); - GenerateProofTree::Yes(UseGlobalCache::from_bool(use_cache)) - } - - (_, None, GenerateProofTree::Yes(_)) => generate_proof_tree, - (DumpSolverProofTree::Never, _, _) => generate_proof_tree, - (DumpSolverProofTree::OnError, _, _) => generate_proof_tree, - }; - match generate_proof_tree { - GenerateProofTree::No => ProofTreeBuilder::new_noop(), - GenerateProofTree::Yes(global_cache_disabled) => { - ProofTreeBuilder::new_root(global_cache_disabled) + GenerateProofTree::Never => ProofTreeBuilder::new_noop(), + GenerateProofTree::IfEnabled => { + let opts = &tcx.sess.opts.unstable_opts; + match opts.dump_solver_proof_tree { + DumpSolverProofTree::Always => { + let use_cache = opts.dump_solver_proof_tree_use_cache.unwrap_or(true); + ProofTreeBuilder::new_root(UseGlobalCache::from_bool(use_cache)) + } + // `OnError` is handled by reevaluating goals in error + // reporting with `GenerateProofTree::Yes`. + DumpSolverProofTree::OnError | DumpSolverProofTree::Never => { + ProofTreeBuilder::new_noop() + } + } } + GenerateProofTree::Yes(use_cache) => ProofTreeBuilder::new_root(use_cache), } } diff --git a/compiler/rustc_trait_selection/src/solve/mod.rs b/compiler/rustc_trait_selection/src/solve/mod.rs index 77809d8d2ba..9dfb793d0a4 100644 --- a/compiler/rustc_trait_selection/src/solve/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/mod.rs @@ -266,12 +266,11 @@ impl<'tcx> EvalCtxt<'_, 'tcx> { return Err(NoSolution); } - let Certainty::Maybe(maybe_cause) = responses.iter().fold( - Certainty::AMBIGUOUS, - |certainty, response| { + let Certainty::Maybe(maybe_cause) = + responses.iter().fold(Certainty::AMBIGUOUS, |certainty, response| { certainty.unify_with(response.value.certainty) - }, - ) else { + }) + else { bug!("expected flounder response to be ambiguous") }; diff --git a/compiler/rustc_trait_selection/src/solve/project_goals.rs b/compiler/rustc_trait_selection/src/solve/project_goals.rs index e53b784a756..9b701ca2023 100644 --- a/compiler/rustc_trait_selection/src/solve/project_goals.rs +++ b/compiler/rustc_trait_selection/src/solve/project_goals.rs @@ -146,89 +146,88 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> { return Err(NoSolution); } - ecx.probe( - |r| CandidateKind::Candidate { name: "impl".into(), result: *r }).enter( - |ecx| { - let impl_substs = ecx.fresh_substs_for_item(impl_def_id); - let impl_trait_ref = impl_trait_ref.subst(tcx, impl_substs); - - ecx.eq(goal.param_env, goal_trait_ref, impl_trait_ref)?; - - let where_clause_bounds = tcx - .predicates_of(impl_def_id) - .instantiate(tcx, impl_substs) - .predicates - .into_iter() - .map(|pred| goal.with(tcx, pred)); - ecx.add_goals(where_clause_bounds); - - // In case the associated item is hidden due to specialization, we have to - // return ambiguity this would otherwise be incomplete, resulting in - // unsoundness during coherence (#105782). - let Some(assoc_def) = fetch_eligible_assoc_item_def( - ecx, - goal.param_env, - goal_trait_ref, - goal.predicate.def_id(), - impl_def_id - )? else { - return ecx.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS); - }; - - if !assoc_def.item.defaultness(tcx).has_value() { - let guar = tcx.sess.delay_span_bug( - tcx.def_span(assoc_def.item.def_id), - "missing value for assoc item in impl", - ); - let error_term = match assoc_def.item.kind { - ty::AssocKind::Const => ty::Const::new_error(tcx, - guar, - tcx.type_of(goal.predicate.def_id()) - .subst(tcx, goal.predicate.projection_ty.substs), - ) - .into(), - ty::AssocKind::Type => Ty::new_error(tcx,guar).into(), - ty::AssocKind::Fn => unreachable!(), - }; - ecx.eq(goal.param_env, goal.predicate.term, error_term) - .expect("expected goal term to be fully unconstrained"); - return ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes); - } + ecx.probe(|r| CandidateKind::Candidate { name: "impl".into(), result: *r }).enter(|ecx| { + let impl_substs = ecx.fresh_substs_for_item(impl_def_id); + let impl_trait_ref = impl_trait_ref.subst(tcx, impl_substs); + + ecx.eq(goal.param_env, goal_trait_ref, impl_trait_ref)?; + + let where_clause_bounds = tcx + .predicates_of(impl_def_id) + .instantiate(tcx, impl_substs) + .predicates + .into_iter() + .map(|pred| goal.with(tcx, pred)); + ecx.add_goals(where_clause_bounds); + + // In case the associated item is hidden due to specialization, we have to + // return ambiguity this would otherwise be incomplete, resulting in + // unsoundness during coherence (#105782). + let Some(assoc_def) = fetch_eligible_assoc_item_def( + ecx, + goal.param_env, + goal_trait_ref, + goal.predicate.def_id(), + impl_def_id, + )? + else { + return ecx.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS); + }; - // Getting the right substitutions here is complex, e.g. given: - // - a goal `<Vec<u32> as Trait<i32>>::Assoc<u64>` - // - the applicable impl `impl<T> Trait<i32> for Vec<T>` - // - and the impl which defines `Assoc` being `impl<T, U> Trait<U> for Vec<T>` - // - // We first rebase the goal substs onto the impl, going from `[Vec<u32>, i32, u64]` - // to `[u32, u64]`. - // - // And then map these substs to the substs of the defining impl of `Assoc`, going - // from `[u32, u64]` to `[u32, i32, u64]`. - let impl_substs_with_gat = goal.predicate.projection_ty.substs.rebase_onto( - tcx, - goal_trait_ref.def_id, - impl_substs, - ); - let substs = ecx.translate_substs( - goal.param_env, - impl_def_id, - impl_substs_with_gat, - assoc_def.defining_node, + if !assoc_def.item.defaultness(tcx).has_value() { + let guar = tcx.sess.delay_span_bug( + tcx.def_span(assoc_def.item.def_id), + "missing value for assoc item in impl", ); - - // Finally we construct the actual value of the associated type. - let term = match assoc_def.item.kind { - ty::AssocKind::Type => tcx.type_of(assoc_def.item.def_id).map_bound(|ty| ty.into()), - ty::AssocKind::Const => bug!("associated const projection is not supported yet"), - ty::AssocKind::Fn => unreachable!("we should never project to a fn"), + let error_term = match assoc_def.item.kind { + ty::AssocKind::Const => ty::Const::new_error( + tcx, + guar, + tcx.type_of(goal.predicate.def_id()) + .subst(tcx, goal.predicate.projection_ty.substs), + ) + .into(), + ty::AssocKind::Type => Ty::new_error(tcx, guar).into(), + ty::AssocKind::Fn => unreachable!(), }; - - ecx.eq(goal.param_env, goal.predicate.term, term.subst(tcx, substs)) + ecx.eq(goal.param_env, goal.predicate.term, error_term) .expect("expected goal term to be fully unconstrained"); - ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) - }, - ) + return ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes); + } + + // Getting the right substitutions here is complex, e.g. given: + // - a goal `<Vec<u32> as Trait<i32>>::Assoc<u64>` + // - the applicable impl `impl<T> Trait<i32> for Vec<T>` + // - and the impl which defines `Assoc` being `impl<T, U> Trait<U> for Vec<T>` + // + // We first rebase the goal substs onto the impl, going from `[Vec<u32>, i32, u64]` + // to `[u32, u64]`. + // + // And then map these substs to the substs of the defining impl of `Assoc`, going + // from `[u32, u64]` to `[u32, i32, u64]`. + let impl_substs_with_gat = goal.predicate.projection_ty.substs.rebase_onto( + tcx, + goal_trait_ref.def_id, + impl_substs, + ); + let substs = ecx.translate_substs( + goal.param_env, + impl_def_id, + impl_substs_with_gat, + assoc_def.defining_node, + ); + + // Finally we construct the actual value of the associated type. + let term = match assoc_def.item.kind { + ty::AssocKind::Type => tcx.type_of(assoc_def.item.def_id).map_bound(|ty| ty.into()), + ty::AssocKind::Const => bug!("associated const projection is not supported yet"), + ty::AssocKind::Fn => unreachable!("we should never project to a fn"), + }; + + ecx.eq(goal.param_env, goal.predicate.term, term.subst(tcx, substs)) + .expect("expected goal term to be fully unconstrained"); + ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) + }) } fn consider_auto_trait_candidate( diff --git a/compiler/rustc_trait_selection/src/solve/trait_goals.rs b/compiler/rustc_trait_selection/src/solve/trait_goals.rs index ef5f25b1f7f..40668145096 100644 --- a/compiler/rustc_trait_selection/src/solve/trait_goals.rs +++ b/compiler/rustc_trait_selection/src/solve/trait_goals.rs @@ -600,11 +600,9 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { // which will ICE for region vars. let substs = ecx.tcx().erase_regions(goal.predicate.trait_ref.substs); - let Some(assume) = rustc_transmute::Assume::from_const( - ecx.tcx(), - goal.param_env, - substs.const_at(3), - ) else { + let Some(assume) = + rustc_transmute::Assume::from_const(ecx.tcx(), goal.param_env, substs.const_at(3)) + else { return Err(NoSolution); }; diff --git a/compiler/rustc_trait_selection/src/traits/auto_trait.rs b/compiler/rustc_trait_selection/src/traits/auto_trait.rs index cb38d0ac847..67e7e5bfa53 100644 --- a/compiler/rustc_trait_selection/src/traits/auto_trait.rs +++ b/compiler/rustc_trait_selection/src/traits/auto_trait.rs @@ -152,14 +152,9 @@ impl<'tcx> AutoTraitFinder<'tcx> { // traits::project will see that 'T: SomeTrait' is in our ParamEnv, allowing // SelectionContext to return it back to us. - let Some((new_env, user_env)) = self.evaluate_predicates( - &infcx, - trait_did, - ty, - orig_env, - orig_env, - &mut fresh_preds, - ) else { + let Some((new_env, user_env)) = + self.evaluate_predicates(&infcx, trait_did, ty, orig_env, orig_env, &mut fresh_preds) + else { return AutoTraitResult::NegativeImpl; }; diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs index 1b1285e1b46..dc72cd6517a 100644 --- a/compiler/rustc_trait_selection/src/traits/coherence.rs +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs @@ -376,7 +376,7 @@ fn impl_intersection_has_negative_obligation( // do the impls unify? If not, then it's not currently possible to prove any // obligations about their intersection. let Ok(InferOk { obligations: equate_obligations, .. }) = - infcx.at(&ObligationCause::dummy(), impl_env).eq(DefineOpaqueTypes::No,subject1, subject2) + infcx.at(&ObligationCause::dummy(), impl_env).eq(DefineOpaqueTypes::No, subject1, subject2) else { debug!("explicit_disjoint: {:?} does not unify with {:?}", subject1, subject2); return false; @@ -437,8 +437,7 @@ fn prove_negated_obligation<'tcx>( let body_def_id = body_def_id.as_local().unwrap_or(CRATE_DEF_ID); let ocx = ObligationCtxt::new(&infcx); - let Ok(wf_tys) = ocx.assumed_wf_types(param_env, body_def_id) - else { + let Ok(wf_tys) = ocx.assumed_wf_types(param_env, body_def_id) else { return false; }; diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index 4dc06d2bfac..18d48b3b95f 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -2708,10 +2708,17 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { err: &mut Diagnostic, obligation: &PredicateObligation<'tcx>, ) { - let ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) = obligation.predicate.kind().skip_binder() else { return; }; + let ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) = + obligation.predicate.kind().skip_binder() + else { + return; + }; let (ObligationCauseCode::BindingObligation(item_def_id, span) - | ObligationCauseCode::ExprBindingObligation(item_def_id, span, ..)) - = *obligation.cause.code().peel_derives() else { return; }; + | ObligationCauseCode::ExprBindingObligation(item_def_id, span, ..)) = + *obligation.cause.code().peel_derives() + else { + return; + }; debug!(?pred, ?item_def_id, ?span); let (Some(node), true) = ( @@ -2880,10 +2887,16 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { src: trait_ref.substs.type_at(1), }; let scope = trait_ref.substs.type_at(2); - let Some(assume) = - rustc_transmute::Assume::from_const(self.infcx.tcx, obligation.param_env, trait_ref.substs.const_at(3)) else { - span_bug!(span, "Unable to construct rustc_transmute::Assume where it was previously possible"); - }; + let Some(assume) = rustc_transmute::Assume::from_const( + self.infcx.tcx, + obligation.param_env, + trait_ref.substs.const_at(3), + ) else { + span_bug!( + span, + "Unable to construct rustc_transmute::Assume where it was previously possible" + ); + }; match rustc_transmute::TransmuteTypeEnv::new(self.infcx).is_transmutable( obligation.cause, @@ -3556,7 +3569,7 @@ pub fn dump_proof_tree<'tcx>(o: &Obligation<'tcx, ty::Predicate<'tcx>>, infcx: & .1 .expect("proof tree should have been generated"); let mut lock = std::io::stdout().lock(); - let _ = lock.write_fmt(format_args!("{tree:?}")); + let _ = lock.write_fmt(format_args!("{tree:?}\n")); let _ = lock.flush(); }); } diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 9ac1ba0275c..1a9e21c2bea 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -752,14 +752,20 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { trait_pred: ty::PolyTraitPredicate<'tcx>, ) -> bool { // It only make sense when suggesting dereferences for arguments - let ObligationCauseCode::FunctionArgumentObligation { arg_hir_id, call_hir_id, .. } = obligation.cause.code() - else { return false; }; - let Some(typeck_results) = &self.typeck_results - else { return false; }; - let hir::Node::Expr(expr) = self.tcx.hir().get(*arg_hir_id) - else { return false; }; - let Some(arg_ty) = typeck_results.expr_ty_adjusted_opt(expr) - else { return false; }; + let ObligationCauseCode::FunctionArgumentObligation { arg_hir_id, call_hir_id, .. } = + obligation.cause.code() + else { + return false; + }; + let Some(typeck_results) = &self.typeck_results else { + return false; + }; + let hir::Node::Expr(expr) = self.tcx.hir().get(*arg_hir_id) else { + return false; + }; + let Some(arg_ty) = typeck_results.expr_ty_adjusted_opt(expr) else { + return false; + }; let span = obligation.cause.span; let mut real_trait_pred = trait_pred; @@ -933,11 +939,11 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { trait_pred.self_ty(), ); - let Some((def_id_or_name, output, inputs)) = self.extract_callable_info( - obligation.cause.body_id, - obligation.param_env, - self_ty, - ) else { return false; }; + let Some((def_id_or_name, output, inputs)) = + self.extract_callable_info(obligation.cause.body_id, obligation.param_env, self_ty) + else { + return false; + }; // Remapping bound vars here let trait_pred_and_self = trait_pred.map_bound(|trait_pred| (trait_pred, output)); @@ -1035,26 +1041,40 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { span.remove_mark(); } let mut expr_finder = FindExprBySpan::new(span); - let Some(body_id) = self.tcx.hir().maybe_body_owned_by(obligation.cause.body_id) else { return; }; + let Some(body_id) = self.tcx.hir().maybe_body_owned_by(obligation.cause.body_id) else { + return; + }; let body = self.tcx.hir().body(body_id); expr_finder.visit_expr(body.value); - let Some(expr) = expr_finder.result else { return; }; - let Some(typeck) = &self.typeck_results else { return; }; - let Some(ty) = typeck.expr_ty_adjusted_opt(expr) else { return; }; + let Some(expr) = expr_finder.result else { + return; + }; + let Some(typeck) = &self.typeck_results else { + return; + }; + let Some(ty) = typeck.expr_ty_adjusted_opt(expr) else { + return; + }; if !ty.is_unit() { return; }; - let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = expr.kind else { return; }; - let hir::def::Res::Local(hir_id) = path.res else { return; }; + let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = expr.kind else { + return; + }; + let hir::def::Res::Local(hir_id) = path.res else { + return; + }; let Some(hir::Node::Pat(pat)) = self.tcx.hir().find(hir_id) else { return; }; - let Some(hir::Node::Local(hir::Local { - ty: None, - init: Some(init), - .. - })) = self.tcx.hir().find_parent(pat.hir_id) else { return; }; - let hir::ExprKind::Block(block, None) = init.kind else { return; }; + let Some(hir::Node::Local(hir::Local { ty: None, init: Some(init), .. })) = + self.tcx.hir().find_parent(pat.hir_id) + else { + return; + }; + let hir::ExprKind::Block(block, None) = init.kind else { + return; + }; if block.expr.is_some() { return; } @@ -1062,7 +1082,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { err.span_label(block.span, "this empty block is missing a tail expression"); return; }; - let hir::StmtKind::Semi(tail_expr) = stmt.kind else { return; }; + let hir::StmtKind::Semi(tail_expr) = stmt.kind else { + return; + }; let Some(ty) = typeck.expr_ty_opt(tail_expr) else { err.span_label(block.span, "this block is missing a tail expression"); return; @@ -1092,12 +1114,18 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { ) -> bool { let self_ty = self.resolve_vars_if_possible(trait_pred.self_ty()); let ty = self.instantiate_binder_with_placeholders(self_ty); - let Some(generics) = self.tcx.hir().get_generics(obligation.cause.body_id) else { return false }; + let Some(generics) = self.tcx.hir().get_generics(obligation.cause.body_id) else { + return false; + }; let ty::Ref(_, inner_ty, hir::Mutability::Not) = ty.kind() else { return false }; let ty::Param(param) = inner_ty.kind() else { return false }; - let ObligationCauseCode::FunctionArgumentObligation { arg_hir_id, .. } = obligation.cause.code() else { return false }; + let ObligationCauseCode::FunctionArgumentObligation { arg_hir_id, .. } = + obligation.cause.code() + else { + return false; + }; let arg_node = self.tcx.hir().get(*arg_hir_id); - let Node::Expr(Expr { kind: hir::ExprKind::Path(_), ..}) = arg_node else { return false }; + let Node::Expr(Expr { kind: hir::ExprKind::Path(_), .. }) = arg_node else { return false }; let clone_trait = self.tcx.require_lang_item(LangItem::Clone, None); let has_clone = |ty| { @@ -1143,21 +1171,30 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { found: Ty<'tcx>, ) -> Option<(DefIdOrName, Ty<'tcx>, Vec<Ty<'tcx>>)> { // Autoderef is useful here because sometimes we box callables, etc. - let Some((def_id_or_name, output, inputs)) = (self.autoderef_steps)(found).into_iter().find_map(|(found, _)| { - match *found.kind() { - ty::FnPtr(fn_sig) => - Some((DefIdOrName::Name("function pointer"), fn_sig.output(), fn_sig.inputs())), - ty::FnDef(def_id, _) => { - let fn_sig = found.fn_sig(self.tcx); - Some((DefIdOrName::DefId(def_id), fn_sig.output(), fn_sig.inputs())) - } - ty::Closure(def_id, substs) => { - let fn_sig = substs.as_closure().sig(); - Some((DefIdOrName::DefId(def_id), fn_sig.output(), fn_sig.inputs().map_bound(|inputs| &inputs[1..]))) - } - ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs, .. }) => { - self.tcx.item_bounds(def_id).subst(self.tcx, substs).iter().find_map(|pred| { - if let ty::ClauseKind::Projection(proj) = pred.kind().skip_binder() + let Some((def_id_or_name, output, inputs)) = + (self.autoderef_steps)(found).into_iter().find_map(|(found, _)| { + match *found.kind() { + ty::FnPtr(fn_sig) => Some(( + DefIdOrName::Name("function pointer"), + fn_sig.output(), + fn_sig.inputs(), + )), + ty::FnDef(def_id, _) => { + let fn_sig = found.fn_sig(self.tcx); + Some((DefIdOrName::DefId(def_id), fn_sig.output(), fn_sig.inputs())) + } + ty::Closure(def_id, substs) => { + let fn_sig = substs.as_closure().sig(); + Some(( + DefIdOrName::DefId(def_id), + fn_sig.output(), + fn_sig.inputs().map_bound(|inputs| &inputs[1..]), + )) + } + ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs, .. }) => { + self.tcx.item_bounds(def_id).subst(self.tcx, substs).iter().find_map( + |pred| { + if let ty::ClauseKind::Projection(proj) = pred.kind().skip_binder() && Some(proj.projection_ty.def_id) == self.tcx.lang_items().fn_once_output() // args tuple will always be substs[1] && let ty::Tuple(args) = proj.projection_ty.substs.type_at(1).kind() @@ -1170,11 +1207,12 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { } else { None } - }) - } - ty::Dynamic(data, _, ty::Dyn) => { - data.iter().find_map(|pred| { - if let ty::ExistentialPredicate::Projection(proj) = pred.skip_binder() + }, + ) + } + ty::Dynamic(data, _, ty::Dyn) => { + data.iter().find_map(|pred| { + if let ty::ExistentialPredicate::Projection(proj) = pred.skip_binder() && Some(proj.def_id) == self.tcx.lang_items().fn_once_output() // for existential projection, substs are shifted over by 1 && let ty::Tuple(args) = proj.substs.type_at(0).kind() @@ -1187,11 +1225,11 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { } else { None } - }) - } - ty::Param(param) => { - let generics = self.tcx.generics_of(body_id); - let name = if generics.count() > param.index as usize + }) + } + ty::Param(param) => { + let generics = self.tcx.generics_of(body_id); + let name = if generics.count() > param.index as usize && let def = generics.param_at(param.index as usize, self.tcx) && matches!(def.kind, ty::GenericParamDefKind::Type { .. }) && def.name == param.name @@ -1200,8 +1238,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { } else { DefIdOrName::Name("type parameter") }; - param_env.caller_bounds().iter().find_map(|pred| { - if let ty::ClauseKind::Projection(proj) = pred.kind().skip_binder() + param_env.caller_bounds().iter().find_map(|pred| { + if let ty::ClauseKind::Projection(proj) = pred.kind().skip_binder() && Some(proj.projection_ty.def_id) == self.tcx.lang_items().fn_once_output() && proj.projection_ty.self_ty() == found // args tuple will always be substs[1] @@ -1215,11 +1253,14 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { } else { None } - }) + }) + } + _ => None, } - _ => None, - } - }) else { return None; }; + }) + else { + return None; + }; let output = self.instantiate_binder_with_fresh_vars( DUMMY_SP, @@ -1408,11 +1449,17 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { // Issue #104961, we need to add parentheses properly for compound expressions // for example, `x.starts_with("hi".to_string() + "you")` // should be `x.starts_with(&("hi".to_string() + "you"))` - let Some(body_id) = self.tcx.hir().maybe_body_owned_by(obligation.cause.body_id) else { return false; }; + let Some(body_id) = + self.tcx.hir().maybe_body_owned_by(obligation.cause.body_id) + else { + return false; + }; let body = self.tcx.hir().body(body_id); let mut expr_finder = FindExprBySpan::new(span); expr_finder.visit_expr(body.value); - let Some(expr) = expr_finder.result else { return false; }; + let Some(expr) = expr_finder.result else { + return false; + }; let needs_parens = match expr.kind { // parenthesize if needed (Issue #46756) hir::ExprKind::Cast(_, _) | hir::ExprKind::Binary(_, _, _) => true, @@ -1463,8 +1510,12 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { self_ty: Ty<'tcx>, target_ty: Ty<'tcx>, ) { - let ty::Ref(_, object_ty, hir::Mutability::Not) = target_ty.kind() else { return; }; - let ty::Dynamic(predicates, _, ty::Dyn) = object_ty.kind() else { return; }; + let ty::Ref(_, object_ty, hir::Mutability::Not) = target_ty.kind() else { + return; + }; + let ty::Dynamic(predicates, _, ty::Dyn) = object_ty.kind() else { + return; + }; let self_ref_ty = Ty::new_imm_ref(self.tcx, self.tcx.lifetimes.re_erased, self_ty); for predicate in predicates.iter() { @@ -1566,7 +1617,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { } // Maybe suggest removal of borrows from expressions, like in `for i in &&&foo {}`. - let Some(mut expr) = expr_finder.result else { return false; }; + let Some(mut expr) = expr_finder.result else { + return false; + }; let mut count = 0; let mut suggestions = vec![]; // Skipping binder here, remapping below @@ -1798,7 +1851,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { fn return_type_span(&self, obligation: &PredicateObligation<'tcx>) -> Option<Span> { let hir = self.tcx.hir(); - let Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(sig, ..), .. })) = hir.find_by_def_id(obligation.cause.body_id) else { + let Some(hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(sig, ..), .. })) = + hir.find_by_def_id(obligation.cause.body_id) + else { return None; }; @@ -2222,7 +2277,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { // Only continue if a generator was found. debug!(?generator, ?trait_ref, ?target_ty); - let (Some(generator_did), Some(trait_ref), Some(target_ty)) = (generator, trait_ref, target_ty) else { + let (Some(generator_did), Some(trait_ref), Some(target_ty)) = + (generator, trait_ref, target_ty) + else { return false; }; @@ -3617,7 +3674,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { let Some(typeck_results) = self.typeck_results.as_ref() else { return }; // Make sure we're dealing with the `Option` type. - let Some(option_ty_adt) = typeck_results.expr_ty_adjusted(expr).ty_adt_def() else { return }; + let Some(option_ty_adt) = typeck_results.expr_ty_adjusted(expr).ty_adt_def() else { + return; + }; if !tcx.is_diagnostic_item(sym::Option, option_ty_adt.did()) { return; } @@ -3749,11 +3808,17 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { while let Some(assocs_in_method) = assocs.next() { let Some(prev_assoc_in_method) = assocs.peek() else { for entry in assocs_in_method { - let Some((span, (assoc, ty))) = entry else { continue; }; - if primary_spans.is_empty() || type_diffs.iter().any(|diff| { - let Sorts(expected_found) = diff else { return false; }; - self.can_eq(param_env, expected_found.found, ty) - }) { + let Some((span, (assoc, ty))) = entry else { + continue; + }; + if primary_spans.is_empty() + || type_diffs.iter().any(|diff| { + let Sorts(expected_found) = diff else { + return false; + }; + self.can_eq(param_env, expected_found.found, ty) + }) + { // FIXME: this doesn't quite work for `Iterator::collect` // because we have `Vec<i32>` and `()`, but we'd want `i32` // to point at the `.into_iter()` call, but as long as we @@ -3781,7 +3846,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { let assoc = with_forced_trimmed_paths!(self.tcx.def_path_str(assoc)); if !self.can_eq(param_env, ty, *prev_ty) { if type_diffs.iter().any(|diff| { - let Sorts(expected_found) = diff else { return false; }; + let Sorts(expected_found) = diff else { + return false; + }; self.can_eq(param_env, expected_found.found, ty) }) { primary_spans.push(span); @@ -3829,8 +3896,12 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { let ocx = ObligationCtxt::new(self.infcx); let mut assocs_in_this_method = Vec::with_capacity(type_diffs.len()); for diff in type_diffs { - let Sorts(expected_found) = diff else { continue; }; - let ty::Alias(ty::Projection, proj) = expected_found.expected.kind() else { continue; }; + let Sorts(expected_found) = diff else { + continue; + }; + let ty::Alias(ty::Projection, proj) = expected_found.expected.kind() else { + continue; + }; let origin = TypeVariableOrigin { kind: TypeVariableOriginKind::TypeInference, span }; let trait_def_id = proj.trait_def_id(self.tcx); @@ -3974,7 +4045,9 @@ fn hint_missing_borrow<'tcx>( }; // This could be a variant constructor, for example. - let Some(fn_decl) = found_node.fn_decl() else { return; }; + let Some(fn_decl) = found_node.fn_decl() else { + return; + }; let args = fn_decl.inputs.iter(); diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index 1af8323b6e9..f092e821751 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -13,12 +13,12 @@ mod object_safety; pub mod outlives_bounds; pub mod project; pub mod query; -#[cfg_attr(not(bootstrap), allow(hidden_glob_reexports))] +#[allow(hidden_glob_reexports)] mod select; mod specialize; mod structural_match; mod structural_normalize; -#[cfg_attr(not(bootstrap), allow(hidden_glob_reexports))] +#[allow(hidden_glob_reexports)] mod util; pub mod vtable; pub mod wf; @@ -362,12 +362,9 @@ pub fn normalize_param_env_or_error<'tcx>( "normalize_param_env_or_error: predicates=(non-outlives={:?}, outlives={:?})", predicates, outlives_predicates ); - let Ok(non_outlives_predicates) = do_normalize_predicates( - tcx, - cause.clone(), - elaborated_env, - predicates, - ) else { + let Ok(non_outlives_predicates) = + do_normalize_predicates(tcx, cause.clone(), elaborated_env, predicates) + else { // An unnormalized env is better than nothing. debug!("normalize_param_env_or_error: errored resolving non-outlives predicates"); return elaborated_env; @@ -384,12 +381,9 @@ pub fn normalize_param_env_or_error<'tcx>( unnormalized_env.reveal(), unnormalized_env.constness(), ); - let Ok(outlives_predicates) = do_normalize_predicates( - tcx, - cause, - outlives_env, - outlives_predicates, - ) else { + let Ok(outlives_predicates) = + do_normalize_predicates(tcx, cause, outlives_env, outlives_predicates) + else { // An unnormalized env is better than nothing. debug!("normalize_param_env_or_error: errored resolving outlives predicates"); return elaborated_env; diff --git a/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs b/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs index ff55eaf13ad..339baf611f3 100644 --- a/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs +++ b/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs @@ -83,7 +83,8 @@ impl<'a, 'tcx: 'a> InferCtxtExt<'a, 'tcx> for InferCtxt<'tcx> { &canonical_var_values, canonical_result, &mut constraints, - ) else { + ) + else { return vec![]; }; assert_eq!(&obligations, &[]); diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index d5f6aaa7fe9..eb603cf3737 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -402,8 +402,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { }; for &(predicate, _) in self.tcx().predicates_of(impl_def_id).predicates { - let ty::ClauseKind::Trait(pred) - = predicate.kind().skip_binder() else { continue }; + let ty::ClauseKind::Trait(pred) = predicate.kind().skip_binder() else { continue }; if fn_ptr_trait != pred.trait_ref.def_id { continue; } diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs index 7adc29bbba4..01452986f5a 100644 --- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs +++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs @@ -342,7 +342,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { let Some(assume) = rustc_transmute::Assume::from_const( self.infcx.tcx, obligation.param_env, - predicate.trait_ref.substs.const_at(3) + predicate.trait_ref.substs.const_at(3), ) else { return Err(Unimplemented); }; @@ -662,10 +662,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { let tcx = self.tcx(); - let Some(self_ty) = self - .infcx - .shallow_resolve(obligation.self_ty().no_bound_vars()) else - { + let Some(self_ty) = self.infcx.shallow_resolve(obligation.self_ty().no_bound_vars()) else { // FIXME: Ideally we'd support `for<'a> fn(&'a ()): Fn(&'a ())`, // but we do not currently. Luckily, such a bound is not // particularly useful, so we don't expect users to write diff --git a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs index 96f1287416f..6d001467b44 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs @@ -226,13 +226,11 @@ fn fulfill_implication<'tcx>( util::impl_subject_and_oblig(selcx, param_env, target_impl, target_substs, error_cause); // do the impls unify? If not, no specialization. - let Ok(InferOk { obligations: more_obligations, .. }) = - infcx.at(&ObligationCause::dummy(), param_env).eq(DefineOpaqueTypes::No, source_trait, target_trait) + let Ok(InferOk { obligations: more_obligations, .. }) = infcx + .at(&ObligationCause::dummy(), param_env) + .eq(DefineOpaqueTypes::No, source_trait, target_trait) else { - debug!( - "fulfill_implication: {:?} does not unify with {:?}", - source_trait, target_trait - ); + debug!("fulfill_implication: {:?} does not unify with {:?}", source_trait, target_trait); return Err(()); }; diff --git a/compiler/rustc_ty_utils/src/assoc.rs b/compiler/rustc_ty_utils/src/assoc.rs index 7e22ef89ed3..ed4f6d972c2 100644 --- a/compiler/rustc_ty_utils/src/assoc.rs +++ b/compiler/rustc_ty_utils/src/assoc.rs @@ -215,7 +215,9 @@ fn associated_types_for_impl_traits_in_associated_fn( } DefKind::Impl { .. } => { - let Some(trait_fn_def_id) = tcx.associated_item(fn_def_id).trait_item_def_id else { return &[] }; + let Some(trait_fn_def_id) = tcx.associated_item(fn_def_id).trait_item_def_id else { + return &[]; + }; tcx.arena.alloc_from_iter( tcx.associated_types_for_impl_traits_in_associated_fn(trait_fn_def_id).iter().map( diff --git a/compiler/rustc_ty_utils/src/instance.rs b/compiler/rustc_ty_utils/src/instance.rs index 1d93a79e591..b5e85e6d65f 100644 --- a/compiler/rustc_ty_utils/src/instance.rs +++ b/compiler/rustc_ty_utils/src/instance.rs @@ -230,7 +230,8 @@ fn resolve_associated_item<'tcx>( }) } } else if Some(trait_ref.def_id) == lang_items.future_trait() { - let ty::Generator(generator_def_id, substs, _) = *rcvr_substs.type_at(0).kind() else { + let ty::Generator(generator_def_id, substs, _) = *rcvr_substs.type_at(0).kind() + else { bug!() }; if Some(trait_item_id) == tcx.lang_items().future_poll_fn() { @@ -243,7 +244,8 @@ fn resolve_associated_item<'tcx>( Some(Instance::new(trait_item_id, rcvr_substs)) } } else if Some(trait_ref.def_id) == lang_items.gen_trait() { - let ty::Generator(generator_def_id, substs, _) = *rcvr_substs.type_at(0).kind() else { + let ty::Generator(generator_def_id, substs, _) = *rcvr_substs.type_at(0).kind() + else { bug!() }; if cfg!(debug_assertions) && tcx.item_name(trait_item_id) != sym::resume { diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs index b67cd96a734..1cbbdedde97 100644 --- a/compiler/rustc_ty_utils/src/layout.rs +++ b/compiler/rustc_ty_utils/src/layout.rs @@ -525,8 +525,13 @@ fn layout_of_uncached<'tcx>( let FieldsShape::Arbitrary { offsets: sized_offsets, .. } = &layout.fields else { bug!("unexpected FieldsShape for sized layout of {ty:?}: {:?}", layout.fields); }; - let FieldsShape::Arbitrary { offsets: unsized_offsets, .. } = &unsized_layout.fields else { - bug!("unexpected FieldsShape for unsized layout of {ty:?}: {:?}", unsized_layout.fields); + let FieldsShape::Arbitrary { offsets: unsized_offsets, .. } = + &unsized_layout.fields + else { + bug!( + "unexpected FieldsShape for unsized layout of {ty:?}: {:?}", + unsized_layout.fields + ); }; let (sized_tail, sized_fields) = sized_offsets.raw.split_last().unwrap(); diff --git a/compiler/rustc_ty_utils/src/layout_sanity_check.rs b/compiler/rustc_ty_utils/src/layout_sanity_check.rs index c4a4cda6801..8633334381a 100644 --- a/compiler/rustc_ty_utils/src/layout_sanity_check.rs +++ b/compiler/rustc_ty_utils/src/layout_sanity_check.rs @@ -52,7 +52,7 @@ pub(super) fn sanity_check_layout<'tcx>( let mut fields = non_zst_fields(cx, layout); let Some(first) = fields.next() else { // No fields here, so this could be a primitive or enum -- either way it's not a newtype around a thing - return *layout + return *layout; }; if fields.next().is_none() { let (offset, first) = first; @@ -77,7 +77,7 @@ pub(super) fn sanity_check_layout<'tcx>( Abi::Uninhabited | Abi::Aggregate { .. }, "ABI unexpectedly missing alignment and/or size in {layout:#?}" ); - return + return; }; assert_eq!( layout.layout.align().abi, diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs index e24a0fe51bd..c8751ba4911 100644 --- a/library/alloc/src/alloc.rs +++ b/library/alloc/src/alloc.rs @@ -4,11 +4,7 @@ #[cfg(not(test))] use core::intrinsics; -#[cfg(all(bootstrap, not(test)))] -use core::intrinsics::{min_align_of_val, size_of_val}; -#[cfg(all(bootstrap, not(test)))] -use core::ptr::Unique; #[cfg(not(test))] use core::ptr::{self, NonNull}; @@ -337,23 +333,6 @@ unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 { } } -#[cfg(all(bootstrap, not(test)))] -#[lang = "box_free"] -#[inline] -// This signature has to be the same as `Box`, otherwise an ICE will happen. -// When an additional parameter to `Box` is added (like `A: Allocator`), this has to be added here as -// well. -// For example if `Box` is changed to `struct Box<T: ?Sized, A: Allocator>(Unique<T>, A)`, -// this function has to be changed to `fn box_free<T: ?Sized, A: Allocator>(Unique<T>, A)` as well. -unsafe fn box_free<T: ?Sized, A: Allocator>(ptr: Unique<T>, alloc: A) { - unsafe { - let size = size_of_val(ptr.as_ref()); - let align = min_align_of_val(ptr.as_ref()); - let layout = Layout::from_size_align_unchecked(size, align); - alloc.deallocate(From::from(ptr.cast()), layout) - } -} - // # Allocation error handler #[cfg(not(no_global_oom_handling))] diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index 1c6815fa941..ad7b77f5497 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -1873,7 +1873,7 @@ impl String { /// let static_ref: &'static mut str = x.leak(); /// assert_eq!(static_ref, "bucket"); /// ``` - #[stable(feature = "string_leak", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "string_leak", since = "1.72.0")] #[inline] pub fn leak<'a>(self) -> &'a mut str { let slice = self.vec.leak(); diff --git a/library/alloc/tests/str.rs b/library/alloc/tests/str.rs index 0ba5d088f61..82c1a9f9ad7 100644 --- a/library/alloc/tests/str.rs +++ b/library/alloc/tests/str.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(bootstrap), allow(invalid_from_utf8))] +#![allow(invalid_from_utf8)] use std::assert_matches::assert_matches; use std::borrow::Cow; diff --git a/library/core/src/any.rs b/library/core/src/any.rs index 09f52d692d0..277c2f76a08 100644 --- a/library/core/src/any.rs +++ b/library/core/src/any.rs @@ -697,9 +697,6 @@ impl TypeId { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_type_id", issue = "77125")] pub const fn of<T: ?Sized + 'static>() -> TypeId { - #[cfg(bootstrap)] - let t = intrinsics::type_id::<T>() as u128; - #[cfg(not(bootstrap))] let t: u128 = intrinsics::type_id::<T>(); TypeId { t } } diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index 76b3589b9e4..ebd4a8c05fe 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -925,7 +925,7 @@ fn iter_next_chunk_erased<T>( // so we need to defuse the guard instead of using `?`. let initialized = guard.initialized; mem::forget(guard); - return Err(initialized) + return Err(initialized); }; // SAFETY: The loop condition ensures we have space to push the item diff --git a/library/core/src/ffi/c_str.rs b/library/core/src/ffi/c_str.rs index 3de9188baf6..39f795c1f13 100644 --- a/library/core/src/ffi/c_str.rs +++ b/library/core/src/ffi/c_str.rs @@ -377,7 +377,7 @@ impl CStr { /// assert!(cstr.is_err()); /// ``` #[stable(feature = "cstr_from_bytes", since = "1.10.0")] - #[rustc_const_stable(feature = "const_cstr_methods", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_cstr_methods", since = "1.72.0")] pub const fn from_bytes_with_nul(bytes: &[u8]) -> Result<&Self, FromBytesWithNulError> { let nul_pos = memchr::memchr(0, bytes); match nul_pos { @@ -561,7 +561,7 @@ impl CStr { #[must_use = "this returns the result of the operation, \ without modifying the original"] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_stable(feature = "const_cstr_methods", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_cstr_methods", since = "1.72.0")] pub const fn to_bytes(&self) -> &[u8] { let bytes = self.to_bytes_with_nul(); // FIXME(const-hack) replace with range index @@ -590,7 +590,7 @@ impl CStr { #[must_use = "this returns the result of the operation, \ without modifying the original"] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_stable(feature = "const_cstr_methods", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_cstr_methods", since = "1.72.0")] pub const fn to_bytes_with_nul(&self) -> &[u8] { // SAFETY: Transmuting a slice of `c_char`s to a slice of `u8`s // is safe on all supported targets. @@ -614,7 +614,7 @@ impl CStr { /// assert_eq!(cstr.to_str(), Ok("foo")); /// ``` #[stable(feature = "cstr_to_str", since = "1.4.0")] - #[rustc_const_stable(feature = "const_cstr_methods", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_cstr_methods", since = "1.72.0")] pub const fn to_str(&self) -> Result<&str, str::Utf8Error> { // N.B., when `CStr` is changed to perform the length check in `.to_bytes()` // instead of in `from_ptr()`, it may be worth considering if this should diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index 5a9a7013a19..deef68e4699 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -1057,23 +1057,6 @@ extern "rust-intrinsic" { #[rustc_const_unstable(feature = "const_type_id", issue = "77125")] #[rustc_safe_intrinsic] #[rustc_nounwind] - #[cfg(bootstrap)] - pub fn type_id<T: ?Sized + 'static>() -> u64; - - /// Gets an identifier which is globally unique to the specified type. This - /// function will return the same value for a type regardless of whichever - /// crate it is invoked in. - /// - /// Note that, unlike most intrinsics, this is safe to call; - /// it does not require an `unsafe` block. - /// Therefore, implementations must not require the user to uphold - /// any safety invariants. - /// - /// The stabilized version of this intrinsic is [`core::any::TypeId::of`]. - #[rustc_const_unstable(feature = "const_type_id", issue = "77125")] - #[rustc_safe_intrinsic] - #[rustc_nounwind] - #[cfg(not(bootstrap))] pub fn type_id<T: ?Sized + 'static>() -> u128; /// A guard for unsafe functions that cannot ever be executed if `T` is uninhabited: diff --git a/library/core/src/iter/adapters/flatten.rs b/library/core/src/iter/adapters/flatten.rs index d3e45456351..eee6e5bccec 100644 --- a/library/core/src/iter/adapters/flatten.rs +++ b/library/core/src/iter/adapters/flatten.rs @@ -310,7 +310,7 @@ where /// Real logic of both `Flatten` and `FlatMap` which simply delegate to /// this type. #[derive(Clone, Debug)] -#[cfg_attr(bootstrap, unstable(feature = "trusted_len", issue = "37572"))] +#[unstable(feature = "trusted_len", issue = "37572")] struct FlattenCompat<I, U> { iter: Fuse<I>, frontiter: Option<U>, @@ -464,7 +464,6 @@ where } } -#[cfg_attr(bootstrap, unstable(feature = "trusted_len", issue = "37572"))] impl<I, U> Iterator for FlattenCompat<I, U> where I: Iterator<Item: IntoIterator<IntoIter = U, Item = U::Item>>, @@ -579,7 +578,6 @@ where } } -#[cfg_attr(bootstrap, unstable(feature = "trusted_len", issue = "37572"))] impl<I, U> DoubleEndedIterator for FlattenCompat<I, U> where I: DoubleEndedIterator<Item: IntoIterator<IntoIter = U, Item = U::Item>>, @@ -649,7 +647,6 @@ where } } -#[cfg_attr(bootstrap, unstable(feature = "trusted_len", issue = "37572"))] unsafe impl<const N: usize, I, T> TrustedLen for FlattenCompat<I, <[T; N] as IntoIterator>::IntoIter> where @@ -657,7 +654,6 @@ where { } -#[cfg_attr(bootstrap, unstable(feature = "trusted_len", issue = "37572"))] unsafe impl<'a, const N: usize, I, T> TrustedLen for FlattenCompat<I, <&'a [T; N] as IntoIterator>::IntoIter> where @@ -665,7 +661,6 @@ where { } -#[cfg_attr(bootstrap, unstable(feature = "trusted_len", issue = "37572"))] unsafe impl<'a, const N: usize, I, T> TrustedLen for FlattenCompat<I, <&'a mut [T; N] as IntoIterator>::IntoIter> where diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index e251015dd86..5ec751e5168 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -140,8 +140,7 @@ unsafe impl<T: Sync + ?Sized> Send for &T {} )] #[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable #[rustc_specialization_trait] -#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl(implement_via_object = false))] -#[cfg_attr(bootstrap, rustc_deny_explicit_impl)] +#[rustc_deny_explicit_impl(implement_via_object = false)] #[rustc_coinductive] pub trait Sized { // Empty. @@ -174,8 +173,7 @@ pub trait Sized { /// [nomicon-coerce]: ../../nomicon/coercions.html #[unstable(feature = "unsize", issue = "18598")] #[lang = "unsize"] -#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl(implement_via_object = false))] -#[cfg_attr(bootstrap, rustc_deny_explicit_impl)] +#[rustc_deny_explicit_impl(implement_via_object = false)] pub trait Unsize<T: ?Sized> { // Empty. } @@ -856,8 +854,7 @@ impl<T: ?Sized> StructuralEq for PhantomData<T> {} reason = "this trait is unlikely to ever be stabilized, use `mem::discriminant` instead" )] #[lang = "discriminant_kind"] -#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl(implement_via_object = false))] -#[cfg_attr(bootstrap, rustc_deny_explicit_impl)] +#[rustc_deny_explicit_impl(implement_via_object = false)] pub trait DiscriminantKind { /// The type of the discriminant, which must satisfy the trait /// bounds required by `mem::Discriminant`. @@ -962,8 +959,7 @@ marker_impls! { #[unstable(feature = "const_trait_impl", issue = "67792")] #[lang = "destruct"] #[rustc_on_unimplemented(message = "can't drop `{Self}`", append_const_msg)] -#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl(implement_via_object = false))] -#[cfg_attr(bootstrap, rustc_deny_explicit_impl)] +#[rustc_deny_explicit_impl(implement_via_object = false)] #[const_trait] pub trait Destruct {} @@ -974,8 +970,7 @@ pub trait Destruct {} #[unstable(feature = "tuple_trait", issue = "none")] #[lang = "tuple_trait"] #[rustc_on_unimplemented(message = "`{Self}` is not a tuple")] -#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl(implement_via_object = false))] -#[cfg_attr(bootstrap, rustc_deny_explicit_impl)] +#[rustc_deny_explicit_impl(implement_via_object = false)] pub trait Tuple {} /// A marker for pointer-like types. @@ -1020,7 +1015,6 @@ marker_impls! { // FIXME(adt_const_params): Add to marker_impls call above once not in bootstrap #[unstable(feature = "adt_const_params", issue = "95174")] -#[cfg(not(bootstrap))] impl ConstParamTy for () {} /// A common trait implemented by all function pointers. @@ -1030,8 +1024,7 @@ impl ConstParamTy for () {} reason = "internal trait for implementing various traits for all function pointers" )] #[lang = "fn_ptr_trait"] -#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl(implement_via_object = false))] -#[cfg_attr(bootstrap, rustc_deny_explicit_impl)] +#[rustc_deny_explicit_impl(implement_via_object = false)] pub trait FnPtr: Copy + Clone { /// Returns the address of the function pointer. #[lang = "fn_ptr_addr"] diff --git a/library/core/src/mem/transmutability.rs b/library/core/src/mem/transmutability.rs index aed23119fd2..f5cc86e7767 100644 --- a/library/core/src/mem/transmutability.rs +++ b/library/core/src/mem/transmutability.rs @@ -7,8 +7,7 @@ use crate::marker::ConstParamTy; /// notwithstanding whatever safety checks you have asked the compiler to [`Assume`] are satisfied. #[unstable(feature = "transmutability", issue = "99571")] #[lang = "transmute_trait"] -#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl(implement_via_object = false))] -#[cfg_attr(bootstrap, rustc_deny_explicit_impl)] +#[rustc_deny_explicit_impl(implement_via_object = false)] #[rustc_coinductive] pub unsafe trait BikeshedIntrinsicFrom<Src, Context, const ASSUME: Assume = { Assume::NOTHING }> where diff --git a/library/core/src/ptr/metadata.rs b/library/core/src/ptr/metadata.rs index daaa44b1d9a..040aa069787 100644 --- a/library/core/src/ptr/metadata.rs +++ b/library/core/src/ptr/metadata.rs @@ -50,8 +50,7 @@ use crate::hash::{Hash, Hasher}; /// /// [`to_raw_parts`]: *const::to_raw_parts #[lang = "pointee_trait"] -#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl(implement_via_object = false))] -#[cfg_attr(bootstrap, rustc_deny_explicit_impl)] +#[rustc_deny_explicit_impl(implement_via_object = false)] pub trait Pointee { /// The type for metadata in pointers and references to `Self`. #[lang = "metadata_type"] diff --git a/library/core/src/ptr/unique.rs b/library/core/src/ptr/unique.rs index ff7e91d3ec3..bf8b86677d5 100644 --- a/library/core/src/ptr/unique.rs +++ b/library/core/src/ptr/unique.rs @@ -33,7 +33,7 @@ use crate::ptr::NonNull; #[doc(hidden)] #[repr(transparent)] // Lang item used experimentally by Miri to define the semantics of `Unique`. -#[cfg_attr(not(bootstrap), lang = "ptr_unique")] +#[lang = "ptr_unique"] pub struct Unique<T: ?Sized> { pointer: NonNull<T>, // NOTE: this marker has no consequences for variance, but is necessary diff --git a/library/core/src/str/pattern.rs b/library/core/src/str/pattern.rs index 91ee2903aab..d5d6d60acf6 100644 --- a/library/core/src/str/pattern.rs +++ b/library/core/src/str/pattern.rs @@ -1750,7 +1750,9 @@ fn simd_contains(needle: &str, haystack: &str) -> Option<bool> { 1 } else { // try a few bytes in case first and last byte of the needle are the same - let Some(second_probe_offset) = (needle.len().saturating_sub(4)..needle.len()).rfind(|&idx| needle[idx] != first_probe) else { + let Some(second_probe_offset) = + (needle.len().saturating_sub(4)..needle.len()).rfind(|&idx| needle[idx] != first_probe) + else { // fall back to other search methods if we can't find any different bytes // since we could otherwise hit some degenerate cases return None; diff --git a/library/core/src/tuple.rs b/library/core/src/tuple.rs index ac8d04a8286..7782ace69c1 100644 --- a/library/core/src/tuple.rs +++ b/library/core/src/tuple.rs @@ -1,7 +1,6 @@ // See src/libstd/primitive_docs.rs for documentation. use crate::cmp::Ordering::{self, *}; -#[cfg(not(bootstrap))] use crate::marker::ConstParamTy; use crate::marker::{StructuralEq, StructuralPartialEq}; @@ -51,7 +50,6 @@ macro_rules! tuple_impls { maybe_tuple_doc! { $($T)+ @ #[unstable(feature = "structural_match", issue = "31434")] - #[cfg(not(bootstrap))] impl<$($T: ConstParamTy),+> ConstParamTy for ($($T,)+) {} } diff --git a/library/core/tests/manually_drop.rs b/library/core/tests/manually_drop.rs index 22d72d219a7..bbf444471ad 100644 --- a/library/core/tests/manually_drop.rs +++ b/library/core/tests/manually_drop.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(bootstrap), allow(undropped_manually_drops))] +#![allow(undropped_manually_drops)] use core::mem::ManuallyDrop; diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index eb4815d0cdf..c129a753912 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -45,7 +45,7 @@ dlmalloc = { version = "0.2.3", features = ['rustc-dep-of-std'] } fortanix-sgx-abi = { version = "0.5.0", features = ['rustc-dep-of-std'], public = true } [target.'cfg(target_os = "hermit")'.dependencies] -hermit-abi = { version = "0.3.0", features = ['rustc-dep-of-std'] } +hermit-abi = { version = "0.3.2", features = ['rustc-dep-of-std'], public = true } [target.wasm32-wasi.dependencies] wasi = { version = "0.11.0", features = ['rustc-dep-of-std'], default-features = false } diff --git a/library/std/src/ffi/os_str.rs b/library/std/src/ffi/os_str.rs index fbdf7f5ecac..e7bad9d542c 100644 --- a/library/std/src/ffi/os_str.rs +++ b/library/std/src/ffi/os_str.rs @@ -1165,7 +1165,7 @@ impl<'a> From<Cow<'a, OsStr>> for OsString { } } -#[stable(feature = "str_tryfrom_osstr_impl", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "str_tryfrom_osstr_impl", since = "1.72.0")] impl<'a> TryFrom<&'a OsStr> for &'a str { type Error = crate::str::Utf8Error; diff --git a/library/std/src/sync/mpsc/mod.rs b/library/std/src/sync/mpsc/mod.rs index 71ff4237d00..c00134c8b95 100644 --- a/library/std/src/sync/mpsc/mod.rs +++ b/library/std/src/sync/mpsc/mod.rs @@ -347,7 +347,7 @@ pub struct Sender<T> { #[stable(feature = "rust1", since = "1.0.0")] unsafe impl<T: Send> Send for Sender<T> {} -#[stable(feature = "mpsc_sender_sync", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "mpsc_sender_sync", since = "1.72.0")] unsafe impl<T: Send> Sync for Sender<T> {} /// The sending-half of Rust's synchronous [`sync_channel`] type. diff --git a/library/std/src/sys/hermit/thread.rs b/library/std/src/sys/hermit/thread.rs index 2507f706951..332151e40d0 100644 --- a/library/std/src/sys/hermit/thread.rs +++ b/library/std/src/sys/hermit/thread.rs @@ -1,6 +1,5 @@ #![allow(dead_code)] -use super::unsupported; use crate::ffi::CStr; use crate::io; use crate::mem; @@ -99,7 +98,7 @@ impl Thread { } pub fn available_parallelism() -> io::Result<NonZeroUsize> { - unsupported() + unsafe { Ok(NonZeroUsize::new_unchecked(abi::get_processor_count())) } } pub mod guard { diff --git a/library/std/src/sys/hermit/time.rs b/library/std/src/sys/hermit/time.rs index 5440d85df4a..7d91460aba3 100644 --- a/library/std/src/sys/hermit/time.rs +++ b/library/std/src/sys/hermit/time.rs @@ -40,7 +40,7 @@ impl Timespec { } fn checked_add_duration(&self, other: &Duration) -> Option<Timespec> { - let mut secs = self.tv_sec.checked_add_unsigned(other.as_secs())?; + let mut secs = self.t.tv_sec.checked_add_unsigned(other.as_secs())?; // Nano calculations can't overflow because nanos are <1B which fit // in a u32. @@ -53,7 +53,7 @@ impl Timespec { } fn checked_sub_duration(&self, other: &Duration) -> Option<Timespec> { - let mut secs = self.tv_sec.checked_sub_unsigned(other.as_secs())?; + let mut secs = self.t.tv_sec.checked_sub_unsigned(other.as_secs())?; // Similar to above, nanos can't overflow. let mut nsec = self.t.tv_nsec as i32 - other.subsec_nanos() as i32; diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 149350e62a0..e5a710c0a96 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -256,7 +256,7 @@ def default_build_triple(verbose): if uname is None: return 'x86_64-pc-windows-msvc' - kernel, cputype, processor = uname.decode(default_encoding).split() + kernel, cputype, processor = uname.decode(default_encoding).split(maxsplit=2) # The goal here is to come up with the same triple as LLVM would, # at least for the subset of platforms we're willing to target. diff --git a/src/bootstrap/clean.rs b/src/bootstrap/clean.rs index c1d867a0bd1..ea8334eaeb6 100644 --- a/src/bootstrap/clean.rs +++ b/src/bootstrap/clean.rs @@ -26,7 +26,9 @@ impl Step for CleanAll { } fn run(self, builder: &Builder<'_>) -> Self::Output { - let Subcommand::Clean { all, .. } = builder.config.cmd else { unreachable!("wrong subcommand?") }; + let Subcommand::Clean { all, .. } = builder.config.cmd else { + unreachable!("wrong subcommand?") + }; clean_default(builder.build, all) } diff --git a/src/bootstrap/download.rs b/src/bootstrap/download.rs index a081f6189d7..eb1941cd889 100644 --- a/src/bootstrap/download.rs +++ b/src/bootstrap/download.rs @@ -188,7 +188,7 @@ impl Config { patchelf.args(&["--set-interpreter", dynamic_linker.trim_end()]); } - self.try_run(patchelf.arg(fname)).unwrap(); + let _ = self.try_run(patchelf.arg(fname)); } fn download_file(&self, url: &str, dest_path: &Path, help_on_error: &str) { diff --git a/src/bootstrap/format.rs b/src/bootstrap/format.rs index ebf068b2cb1..4330e126398 100644 --- a/src/bootstrap/format.rs +++ b/src/bootstrap/format.rs @@ -66,13 +66,17 @@ fn get_rustfmt_version(build: &Builder<'_>) -> Option<(String, PathBuf)> { /// Return whether the format cache can be reused. fn verify_rustfmt_version(build: &Builder<'_>) -> bool { - let Some((version, stamp_file)) = get_rustfmt_version(build) else {return false;}; + let Some((version, stamp_file)) = get_rustfmt_version(build) else { + return false; + }; !program_out_of_date(&stamp_file, &version) } /// Updates the last rustfmt version used fn update_rustfmt_version(build: &Builder<'_>) { - let Some((version, stamp_file)) = get_rustfmt_version(build) else {return;}; + let Some((version, stamp_file)) = get_rustfmt_version(build) else { + return; + }; t!(std::fs::write(stamp_file, version)) } diff --git a/src/bootstrap/run.rs b/src/bootstrap/run.rs index c97b7592737..70b91700043 100644 --- a/src/bootstrap/run.rs +++ b/src/bootstrap/run.rs @@ -27,8 +27,7 @@ impl Step for ExpandYamlAnchors { try_run( builder, &mut builder.tool_cmd(Tool::ExpandYamlAnchors).arg("generate").arg(&builder.src), - ) - .unwrap(); + ); } fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -40,17 +39,17 @@ impl Step for ExpandYamlAnchors { } } -fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> Result<(), ()> { +fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> bool { if !builder.fail_fast { - if let Err(e) = builder.try_run(cmd) { + if builder.try_run(cmd).is_err() { let mut failures = builder.delayed_failures.borrow_mut(); failures.push(format!("{:?}", cmd)); - return Err(e); + return false; } } else { builder.run(cmd); } - Ok(()) + true } #[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)] diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index a34465ebffb..d7303427c3b 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -48,17 +48,17 @@ const MIR_OPT_BLESS_TARGET_MAPPING: &[(&str, &str)] = &[ // build for, so there is no entry for "aarch64-apple-darwin" here. ]; -fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> Result<(), ()> { +fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> bool { if !builder.fail_fast { - if let Err(e) = builder.try_run(cmd) { + if builder.try_run(cmd).is_err() { let mut failures = builder.delayed_failures.borrow_mut(); failures.push(format!("{:?}", cmd)); - return Err(e); + return false; } } else { builder.run(cmd); } - Ok(()) + true } fn try_run_quiet(builder: &Builder<'_>, cmd: &mut Command) -> bool { @@ -187,8 +187,7 @@ You can skip linkcheck with --exclude src/tools/linkchecker" try_run( builder, builder.tool_cmd(Tool::Linkchecker).arg(builder.out.join(host.triple).join("doc")), - ) - .unwrap(); + ); } fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -241,8 +240,7 @@ impl Step for HtmlCheck { builder.default_doc(&[]); builder.ensure(crate::doc::Rustc::new(builder.top_stage, self.target, builder)); - try_run(builder, builder.tool_cmd(Tool::HtmlChecker).arg(builder.doc_out(self.target))) - .unwrap(); + try_run(builder, builder.tool_cmd(Tool::HtmlChecker).arg(builder.doc_out(self.target))); } } @@ -288,8 +286,7 @@ impl Step for Cargotest { .args(builder.config.test_args()) .env("RUSTC", builder.rustc(compiler)) .env("RUSTDOC", builder.rustdoc(compiler)), - ) - .unwrap(); + ); } } @@ -855,7 +852,7 @@ impl Step for RustdocTheme { util::lld_flag_no_threads(self.compiler.host.contains("windows")), ); } - try_run(builder, &mut cmd).unwrap(); + try_run(builder, &mut cmd); } } @@ -1106,7 +1103,7 @@ help: to skip test's attempt to check tidiness, pass `--exclude src/tools/tidy` } builder.info("tidy check"); - try_run(builder, &mut cmd).unwrap(); + try_run(builder, &mut cmd); builder.ensure(ExpandYamlAnchors); @@ -1154,8 +1151,7 @@ impl Step for ExpandYamlAnchors { try_run( builder, &mut builder.tool_cmd(Tool::ExpandYamlAnchors).arg("check").arg(&builder.src), - ) - .unwrap(); + ); } fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { @@ -1948,7 +1944,7 @@ impl BookTest { compiler.host, ); let _time = util::timeit(&builder); - let toolstate = if try_run(builder, &mut rustbook_cmd).is_ok() { + let toolstate = if try_run(builder, &mut rustbook_cmd) { ToolState::TestPass } else { ToolState::TestFail @@ -2106,7 +2102,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) -> cmd.arg("--test-args").arg(test_args); if builder.config.verbose_tests { - try_run(builder, &mut cmd).is_ok() + try_run(builder, &mut cmd) } else { try_run_quiet(builder, &mut cmd) } @@ -2134,7 +2130,7 @@ impl Step for RustcGuide { let src = builder.src.join(relative_path); let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook); - let toolstate = if try_run(builder, rustbook_cmd.arg("linkcheck").arg(&src)).is_ok() { + let toolstate = if try_run(builder, rustbook_cmd.arg("linkcheck").arg(&src)) { ToolState::TestPass } else { ToolState::TestFail @@ -2684,7 +2680,7 @@ impl Step for Bootstrap { .current_dir(builder.src.join("src/bootstrap/")); // NOTE: we intentionally don't pass test_args here because the args for unittest and cargo test are mutually incompatible. // Use `python -m unittest` manually if you want to pass arguments. - try_run(builder, &mut check_bootstrap).unwrap(); + try_run(builder, &mut check_bootstrap); let host = builder.config.build; let compiler = builder.compiler(0, host); @@ -2756,7 +2752,7 @@ impl Step for TierCheck { } builder.info("platform support check"); - try_run(builder, &mut cargo.into()).unwrap(); + try_run(builder, &mut cargo.into()); } } @@ -2836,7 +2832,7 @@ impl Step for RustInstaller { cmd.env("CARGO", &builder.initial_cargo); cmd.env("RUSTC", &builder.initial_rustc); cmd.env("TMP_DIR", &tmpdir); - try_run(builder, &mut cmd).unwrap(); + try_run(builder, &mut cmd); } fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index a3604158851..c4ac5466164 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -47,9 +47,13 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> { // Require the type the impl is implemented on to match // our type, and ignore the impl if there was a mismatch. - let Ok(eq_result) = infcx.at(&traits::ObligationCause::dummy(), param_env).eq(DefineOpaqueTypes::No, impl_trait_ref.self_ty(), impl_ty) else { - continue - }; + let Ok(eq_result) = infcx.at(&traits::ObligationCause::dummy(), param_env).eq( + DefineOpaqueTypes::No, + impl_trait_ref.self_ty(), + impl_ty, + ) else { + continue; + }; let InferOk { value: (), obligations } = eq_result; // FIXME(eddyb) ignoring `obligations` might cause false positives. drop(obligations); diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 0182d50773d..d26de77a78d 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -167,8 +167,7 @@ fn clean_generic_bound<'tcx>( let trait_ref = ty::Binder::dummy(ty::TraitRef::identity(cx.tcx, def_id)); let generic_args = clean_generic_args(generic_args, cx); - let GenericArgs::AngleBracketed { bindings, .. } = generic_args - else { + let GenericArgs::AngleBracketed { bindings, .. } = generic_args else { bug!("clean: parenthesized `GenericBound::LangItemTrait`"); }; diff --git a/src/librustdoc/clean/simplify.rs b/src/librustdoc/clean/simplify.rs index 65b1b72adc1..d53b038019b 100644 --- a/src/librustdoc/clean/simplify.rs +++ b/src/librustdoc/clean/simplify.rs @@ -47,7 +47,9 @@ pub(crate) fn where_clauses(cx: &DocContext<'_>, clauses: Vec<WP>) -> ThinVec<WP // Look for equality predicates on associated types that can be merged into // general bound predicates. equalities.retain(|(lhs, rhs, bound_params)| { - let Some((ty, trait_did, name)) = lhs.projection() else { return true; }; + let Some((ty, trait_did, name)) = lhs.projection() else { + return true; + }; let Some((bounds, _)) = tybounds.get_mut(ty) else { return true }; merge_bounds(cx, bounds, bound_params.clone(), trait_did, name, rhs) }); diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 26139d52769..eccc881d6b1 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -451,11 +451,7 @@ impl Item { pub(crate) fn links(&self, cx: &Context<'_>) -> Vec<RenderedLink> { use crate::html::format::{href, link_tooltip}; - let Some(links) = cx.cache() - .intra_doc_links - .get(&self.item_id) else { - return vec![] - }; + let Some(links) = cx.cache().intra_doc_links.get(&self.item_id) else { return vec![] }; links .iter() .filter_map(|ItemLink { link: s, link_text, page_id: id, ref fragment }| { @@ -484,11 +480,9 @@ impl Item { /// the link text, but does need to know which `[]`-bracketed names /// are actually links. pub(crate) fn link_names(&self, cache: &Cache) -> Vec<RenderedLink> { - let Some(links) = cache - .intra_doc_links - .get(&self.item_id) else { - return vec![]; - }; + let Some(links) = cache.intra_doc_links.get(&self.item_id) else { + return vec![]; + }; links .iter() .map(|ItemLink { link: s, link_text, .. }| RenderedLink { diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index f375f0efbd1..d6a970fba39 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -54,8 +54,7 @@ pub(crate) fn krate(cx: &mut DocContext<'_>) -> Crate { let primitives = local_crate.primitives(cx.tcx); let keywords = local_crate.keywords(cx.tcx); { - let ItemKind::ModuleItem(ref mut m) = *module.kind - else { unreachable!() }; + let ItemKind::ModuleItem(ref mut m) = *module.kind else { unreachable!() }; m.items.extend(primitives.iter().map(|&(def_id, prim)| { Item::from_def_id_and_parts( def_id, diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 217257316c8..6047cf23350 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -653,8 +653,7 @@ pub(crate) fn make_test( (found_main, found_extern_crate, found_macro) }) }); - let Ok((already_has_main, already_has_extern_crate, found_macro)) = result - else { + let Ok((already_has_main, already_has_extern_crate, found_macro)) = result else { // If the parser panicked due to a fatal error, pass the test code through unchanged. // The error will be reported during compilation. return (s.to_owned(), 0, false); diff --git a/src/librustdoc/formats/renderer.rs b/src/librustdoc/formats/renderer.rs index 6f9cc026675..c49f1a4d37e 100644 --- a/src/librustdoc/formats/renderer.rs +++ b/src/librustdoc/formats/renderer.rs @@ -77,8 +77,11 @@ pub(crate) fn run_format<'tcx, T: FormatRenderer<'tcx>>( prof.generic_activity_with_arg("render_mod_item", item.name.unwrap().to_string()); cx.mod_item_in(&item)?; - let (clean::StrippedItem(box clean::ModuleItem(module)) | clean::ModuleItem(module)) = *item.kind - else { unreachable!() }; + let (clean::StrippedItem(box clean::ModuleItem(module)) | clean::ModuleItem(module)) = + *item.kind + else { + unreachable!() + }; for it in module.items { debug!("Adding {:?} to worklist", it.name); work.push((cx.make_child_renderer(), it)); diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 54c0cd2ef7f..1099c68b004 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -771,9 +771,10 @@ pub(crate) fn href_relative_parts<'fqp>( pub(crate) fn link_tooltip(did: DefId, fragment: &Option<UrlFragment>, cx: &Context<'_>) -> String { let cache = cx.cache(); - let Some((fqp, shortty)) = cache.paths.get(&did) - .or_else(|| cache.external_paths.get(&did)) - else { return String::new() }; + let Some((fqp, shortty)) = cache.paths.get(&did).or_else(|| cache.external_paths.get(&did)) + else { + return String::new(); + }; let mut buf = Buffer::new(); let fqp = if *shortty == ItemType::Primitive { // primitives are documented in a crate, but not actually part of it diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index c94968b4817..a99ac0f4e05 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -928,13 +928,11 @@ fn string_without_closing_tag<T: Display>( href_context: &Option<HrefContext<'_, '_>>, open_tag: bool, ) -> Option<&'static str> { - let Some(klass) = klass - else { + let Some(klass) = klass else { write!(out, "{}", text).unwrap(); return None; }; - let Some(def_span) = klass.get_span() - else { + let Some(def_span) = klass.get_span() else { if !open_tag { write!(out, "{}", text).unwrap(); return None; @@ -988,6 +986,11 @@ fn string_without_closing_tag<T: Display>( ) .ok() .map(|(url, _, _)| url), + LinkFromSrc::Doc(def_id) => { + format::href_with_root_path(*def_id, context, Some(&href_context.root_path)) + .ok() + .map(|(doc_link, _, _)| doc_link) + } } }) { diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs index 4c476263635..d0a1e223eb8 100644 --- a/src/librustdoc/html/render/context.rs +++ b/src/librustdoc/html/render/context.rs @@ -349,7 +349,12 @@ impl<'tcx> Context<'tcx> { let e = ExternalCrate { crate_num: cnum }; (e.name(self.tcx()), e.src_root(self.tcx())) } - ExternalLocation::Unknown => return None, + ExternalLocation::Unknown => { + let e = ExternalCrate { crate_num: cnum }; + let name = e.name(self.tcx()); + root = name.to_string(); + (name, e.src_root(self.tcx())) + } }; let href = RefCell::new(PathBuf::new()); @@ -805,8 +810,11 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { // Render sidebar-items.js used throughout this module. if !self.render_redirect_pages { - let (clean::StrippedItem(box clean::ModuleItem(ref module)) | clean::ModuleItem(ref module)) = *item.kind - else { unreachable!() }; + let (clean::StrippedItem(box clean::ModuleItem(ref module)) + | clean::ModuleItem(ref module)) = *item.kind + else { + unreachable!() + }; let items = self.build_sidebar_items(module); let js_dst = self.dst.join(&format!("sidebar-items{}.js", self.shared.resource_suffix)); let v = format!("window.SIDEBAR_ITEMS = {};", serde_json::to_string(&items).unwrap()); diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index f923f905451..8a1ce9fb135 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1988,7 +1988,9 @@ pub(crate) fn get_filtered_impls_for_reference<'a>( ) -> (Vec<&'a Impl>, Vec<&'a Impl>, Vec<&'a Impl>) { let def_id = it.item_id.expect_def_id(); // If the reference primitive is somehow not defined, exit early. - let Some(v) = shared.cache.impls.get(&def_id) else { return (Vec::new(), Vec::new(), Vec::new()) }; + let Some(v) = shared.cache.impls.get(&def_id) else { + return (Vec::new(), Vec::new(), Vec::new()); + }; // Since there is no "direct implementation" on the reference primitive type, we filter out // every implementation which isn't a trait implementation. let traits = v.iter().filter(|i| i.inner_impl().trait_.is_some()); diff --git a/src/librustdoc/html/render/span_map.rs b/src/librustdoc/html/render/span_map.rs index eb9262f472b..ac587bf6008 100644 --- a/src/librustdoc/html/render/span_map.rs +++ b/src/librustdoc/html/render/span_map.rs @@ -1,11 +1,11 @@ -use crate::clean::{self, PrimitiveType}; +use crate::clean::{self, rustc_span, PrimitiveType}; use crate::html::sources; use rustc_data_structures::fx::FxHashMap; use rustc_hir::def::{DefKind, Res}; -use rustc_hir::def_id::DefId; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_hir::intravisit::{self, Visitor}; -use rustc_hir::{ExprKind, HirId, Mod, Node}; +use rustc_hir::{ExprKind, HirId, Item, ItemKind, Mod, Node}; use rustc_middle::hir::nested_filter; use rustc_middle::ty::TyCtxt; use rustc_span::hygiene::MacroKind; @@ -25,6 +25,7 @@ pub(crate) enum LinkFromSrc { Local(clean::Span), External(DefId), Primitive(PrimitiveType), + Doc(DefId), } /// This function will do at most two things: @@ -65,24 +66,43 @@ struct SpanMapVisitor<'tcx> { impl<'tcx> SpanMapVisitor<'tcx> { /// This function is where we handle `hir::Path` elements and add them into the "span map". fn handle_path(&mut self, path: &rustc_hir::Path<'_>) { - let info = match path.res { + match path.res { // FIXME: For now, we handle `DefKind` if it's not a `DefKind::TyParam`. // Would be nice to support them too alongside the other `DefKind` // (such as primitive types!). - Res::Def(kind, def_id) if kind != DefKind::TyParam => Some(def_id), - Res::Local(_) => None, + Res::Def(kind, def_id) if kind != DefKind::TyParam => { + let link = if def_id.as_local().is_some() { + LinkFromSrc::Local(rustc_span(def_id, self.tcx)) + } else { + LinkFromSrc::External(def_id) + }; + self.matches.insert(path.span, link); + } + Res::Local(_) => { + if let Some(span) = self.tcx.hir().res_span(path.res) { + self.matches.insert(path.span, LinkFromSrc::Local(clean::Span::new(span))); + } + } Res::PrimTy(p) => { // FIXME: Doesn't handle "path-like" primitives like arrays or tuples. self.matches.insert(path.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, LinkFromSrc::Local(clean::Span::new(span))); - } else if let Some(def_id) = info { - self.matches.insert(path.span, LinkFromSrc::External(def_id)); + Res::Err => {} + _ => {} + } + } + + /// Used to generate links on items' definition to go to their documentation page. + pub(crate) fn extract_info_from_hir_id(&mut self, hir_id: HirId) { + if let Some(Node::Item(item)) = self.tcx.hir().find(hir_id) { + if let Some(span) = self.tcx.def_ident_span(item.owner_id) { + let cspan = clean::Span::new(span); + // If the span isn't from the current crate, we ignore it. + if cspan.inner().is_dummy() || cspan.cnum(self.tcx.sess) != LOCAL_CRATE { + return; + } + self.matches.insert(span, LinkFromSrc::Doc(item.owner_id.to_def_id())); + } } } @@ -117,10 +137,13 @@ impl<'tcx> SpanMapVisitor<'tcx> { _ => return true, }; let link_from_src = match data.macro_def_id { - Some(macro_def_id) if macro_def_id.is_local() => { - LinkFromSrc::Local(clean::Span::new(data.def_site)) + Some(macro_def_id) => { + if macro_def_id.is_local() { + LinkFromSrc::Local(clean::Span::new(data.def_site)) + } else { + LinkFromSrc::External(macro_def_id) + } } - Some(macro_def_id) => LinkFromSrc::External(macro_def_id), None => return true, }; let new_span = data.call_site; @@ -160,6 +183,9 @@ impl<'tcx> Visitor<'tcx> for SpanMapVisitor<'tcx> { LinkFromSrc::Local(clean::Span::new(m.spans.inner_span)), ); } + } else { + // If it's a "mod foo {}", we want to look to its documentation page. + self.extract_info_from_hir_id(id); } intravisit::walk_mod(self, m, id); } @@ -176,13 +202,12 @@ impl<'tcx> Visitor<'tcx> for SpanMapVisitor<'tcx> { .tcx .typeck_body(hir.maybe_body_owned_by(body_id).expect("a body which isn't a body")); if let Some(def_id) = typeck_results.type_dependent_def_id(expr.hir_id) { - self.matches.insert( - segment.ident.span, - match hir.span_if_local(def_id) { - Some(span) => LinkFromSrc::Local(clean::Span::new(span)), - None => LinkFromSrc::External(def_id), - }, - ); + let link = if def_id.as_local().is_some() { + LinkFromSrc::Local(rustc_span(def_id, self.tcx)) + } else { + LinkFromSrc::External(def_id) + }; + self.matches.insert(segment.ident.span, link); } } else if self.handle_macro(expr.span) { // We don't want to go deeper into the macro. @@ -190,4 +215,28 @@ impl<'tcx> Visitor<'tcx> for SpanMapVisitor<'tcx> { } intravisit::walk_expr(self, expr); } + + fn visit_item(&mut self, item: &'tcx Item<'tcx>) { + match item.kind { + ItemKind::Static(_, _, _) + | ItemKind::Const(_, _) + | ItemKind::Fn(_, _, _) + | ItemKind::Macro(_, _) + | ItemKind::TyAlias(_, _) + | ItemKind::Enum(_, _) + | ItemKind::Struct(_, _) + | ItemKind::Union(_, _) + | ItemKind::Trait(_, _, _, _, _) + | ItemKind::TraitAlias(_, _) => self.extract_info_from_hir_id(item.hir_id()), + ItemKind::Impl(_) + | ItemKind::Use(_, _) + | ItemKind::ExternCrate(_) + | ItemKind::ForeignMod { .. } + | ItemKind::GlobalAsm(_) + | ItemKind::OpaqueTy(_) + // We already have "visit_mod" above so no need to check it here. + | ItemKind::Mod(_) => {} + } + intravisit::walk_item(self, item); + } } diff --git a/src/librustdoc/passes/check_doc_test_visibility.rs b/src/librustdoc/passes/check_doc_test_visibility.rs index b6cd897d317..1aa12e3ced2 100644 --- a/src/librustdoc/passes/check_doc_test_visibility.rs +++ b/src/librustdoc/passes/check_doc_test_visibility.rs @@ -106,8 +106,7 @@ pub(crate) fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) - } pub(crate) fn look_for_tests<'tcx>(cx: &DocContext<'tcx>, dox: &str, item: &Item) { - let Some(hir_id) = DocContext::as_local_hir_id(cx.tcx, item.item_id) - else { + let Some(hir_id) = DocContext::as_local_hir_id(cx.tcx, item.item_id) else { // If non-local, no need to check anything. return; }; diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index ca511d956b9..6df2b973551 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -1610,8 +1610,7 @@ fn report_diagnostic( DiagnosticInfo { item, ori_link: _, dox, link_range }: &DiagnosticInfo<'_>, decorate: impl FnOnce(&mut Diagnostic, Option<rustc_span::Span>, MarkdownLinkRange), ) { - let Some(hir_id) = DocContext::as_local_hir_id(tcx, item.item_id) - else { + let Some(hir_id) = DocContext::as_local_hir_id(tcx, item.item_id) else { // If non-local, no need to check anything. info!("ignoring warning from parent crate: {}", msg); return; diff --git a/src/librustdoc/passes/lint/bare_urls.rs b/src/librustdoc/passes/lint/bare_urls.rs index e9cee92d22b..5658b31d9bb 100644 --- a/src/librustdoc/passes/lint/bare_urls.rs +++ b/src/librustdoc/passes/lint/bare_urls.rs @@ -13,11 +13,10 @@ use std::mem; use std::sync::LazyLock; pub(super) fn visit_item(cx: &DocContext<'_>, item: &Item) { - let Some(hir_id) = DocContext::as_local_hir_id(cx.tcx, item.item_id) - else { - // If non-local, no need to check anything. - return; - }; + let Some(hir_id) = DocContext::as_local_hir_id(cx.tcx, item.item_id) else { + // If non-local, no need to check anything. + return; + }; let dox = item.doc_value(); if !dox.is_empty() { let report_diag = diff --git a/src/librustdoc/passes/lint/check_code_block_syntax.rs b/src/librustdoc/passes/lint/check_code_block_syntax.rs index f489f5081da..369a8069593 100644 --- a/src/librustdoc/passes/lint/check_code_block_syntax.rs +++ b/src/librustdoc/passes/lint/check_code_block_syntax.rs @@ -67,12 +67,11 @@ fn check_rust_syntax( return; } - let Some(local_id) = item.item_id.as_def_id().and_then(|x| x.as_local()) - else { - // We don't need to check the syntax for other crates so returning - // without doing anything should not be a problem. - return; - }; + let Some(local_id) = item.item_id.as_def_id().and_then(|x| x.as_local()) else { + // We don't need to check the syntax for other crates so returning + // without doing anything should not be a problem. + return; + }; let empty_block = code_block.lang_string == Default::default() && code_block.is_fenced; let is_ignore = code_block.lang_string.ignore != markdown::Ignore::None; diff --git a/src/librustdoc/passes/lint/html_tags.rs b/src/librustdoc/passes/lint/html_tags.rs index 5273f52bc6f..24f452b216c 100644 --- a/src/librustdoc/passes/lint/html_tags.rs +++ b/src/librustdoc/passes/lint/html_tags.rs @@ -14,7 +14,9 @@ pub(crate) fn visit_item(cx: &DocContext<'_>, item: &Item) { let tcx = cx.tcx; let Some(hir_id) = DocContext::as_local_hir_id(tcx, item.item_id) // If non-local, no need to check anything. - else { return }; + else { + return; + }; let dox = item.doc_value(); if !dox.is_empty() { let report_diag = |msg: String, range: &Range<usize>, is_open_tag: bool| { diff --git a/src/librustdoc/passes/propagate_doc_cfg.rs b/src/librustdoc/passes/propagate_doc_cfg.rs index 8a33e51b3be..95273a225a9 100644 --- a/src/librustdoc/passes/propagate_doc_cfg.rs +++ b/src/librustdoc/passes/propagate_doc_cfg.rs @@ -38,8 +38,9 @@ impl<'a, 'tcx> CfgPropagator<'a, 'tcx> { _ => return, }; - let Some(def_id) = item.item_id.as_def_id().and_then(|def_id| def_id.as_local()) - else { return }; + let Some(def_id) = item.item_id.as_def_id().and_then(|def_id| def_id.as_local()) else { + return; + }; if check_parent { let expected_parent = self.cx.tcx.opt_local_parent(def_id); diff --git a/src/stage0.json b/src/stage0.json index 89ad4e0a649..5f54504b8ea 100644 --- a/src/stage0.json +++ b/src/stage0.json @@ -17,419 +17,379 @@ "tool is executed." ], "compiler": { - "date": "2023-05-30", + "date": "2023-07-12", "version": "beta" }, "rustfmt": { - "date": "2023-05-30", + "date": "2023-07-13", "version": "nightly" }, "checksums_sha256": { - "dist/2023-05-30/cargo-beta-aarch64-apple-darwin.tar.gz": "ec0ef9ab4514f493675cf7c6c8539d29d4d9035813f3c2fe11df9f41cacb254f", - "dist/2023-05-30/cargo-beta-aarch64-apple-darwin.tar.xz": "1a9aa0848d79f7e8d13ed96e9df068a95c98056eaf569e1f5baa8ed02b1bd610", - "dist/2023-05-30/cargo-beta-aarch64-pc-windows-msvc.tar.gz": "4617ed30df22b2fc97b02d70bffd2f08e6bffacffee5f6f7bf73799372320802", - "dist/2023-05-30/cargo-beta-aarch64-pc-windows-msvc.tar.xz": "a7ea7ded3eceae4a3ffd21ab3b2af0e7e63e686e1d696508f05b764af5d071b0", - "dist/2023-05-30/cargo-beta-aarch64-unknown-linux-gnu.tar.gz": "05cd8f23b86bf8bf755d9300a344bcc6332398c81ec490a1afea8a3cfa489138", - "dist/2023-05-30/cargo-beta-aarch64-unknown-linux-gnu.tar.xz": "fc260df9c4fc721cf55edb2d10626b51232a566ccdf0fff76859542937aa8e3a", - "dist/2023-05-30/cargo-beta-aarch64-unknown-linux-musl.tar.gz": "be257b324db5f97e58d56c51c1da184689aeb53052731992454101abba5e69ba", - "dist/2023-05-30/cargo-beta-aarch64-unknown-linux-musl.tar.xz": "d12a3399e8a59121cd70620c735a2c3b33ca12d88db8b20f7f150f640ca2c3d6", - "dist/2023-05-30/cargo-beta-arm-unknown-linux-gnueabi.tar.gz": "f917a6722192bdac52994306033db82afa7aed3f7f0659bd3edfa125aad26286", - "dist/2023-05-30/cargo-beta-arm-unknown-linux-gnueabi.tar.xz": "d19e74b6dcca36100f667f752a3e61c0f4c0376f065d925dac1a04f35a2e2df7", - "dist/2023-05-30/cargo-beta-arm-unknown-linux-gnueabihf.tar.gz": "4ee94ac076f491a725cfb0bd1fd562e76ba0c877f1ab3964289a93cf4d50e907", - "dist/2023-05-30/cargo-beta-arm-unknown-linux-gnueabihf.tar.xz": "c054bece6c071b1c2633e59f7193e25ed3e29ab1b6cad5e62d9ec71304f92cc3", - "dist/2023-05-30/cargo-beta-armv7-unknown-linux-gnueabihf.tar.gz": "15ed708ecbf86769a5d3e64e2263f0c534db30f793ede9f4ea6e04fa6b462d5f", - "dist/2023-05-30/cargo-beta-armv7-unknown-linux-gnueabihf.tar.xz": "b11e35f7ccf65d9ee224d4695e0f769f52ed1e87f32221ab62a79d1e818dab88", - "dist/2023-05-30/cargo-beta-i686-pc-windows-gnu.tar.gz": "62509f8a6c096ea442ddfbc46c16942e905cfb5017b1cf85dc94f812da243bd2", - "dist/2023-05-30/cargo-beta-i686-pc-windows-gnu.tar.xz": "cfb63865159c01bfa1b4db6368219f255aacc9bbd94c2d04633cd705d53c6fbe", - "dist/2023-05-30/cargo-beta-i686-pc-windows-msvc.tar.gz": "81c5f9e12449ce7c7dca6a32ba18fa232df19085acf5650bfbed65e228c06b57", - "dist/2023-05-30/cargo-beta-i686-pc-windows-msvc.tar.xz": "acbac0d53c7ab771f3ae91c8461304ba811f8a067575c148e207311f425d694f", - "dist/2023-05-30/cargo-beta-i686-unknown-linux-gnu.tar.gz": "0bb73bb2d3abf4065cb559e022332c6ce9d6b2223c074b974fbc39450e46e345", - "dist/2023-05-30/cargo-beta-i686-unknown-linux-gnu.tar.xz": "11622821b4b11a02c9262daf4aa35aa2b71407362079557be604c72962175bf7", - "dist/2023-05-30/cargo-beta-loongarch64-unknown-linux-gnu.tar.gz": "1f7c1a3d0879d6a04396cc31ca2e41dde5f9ca8cef360c9c44b32b909f4e8d4c", - "dist/2023-05-30/cargo-beta-loongarch64-unknown-linux-gnu.tar.xz": "8952d2e179a80ee8257d89cfd417a6df50edc07c22c0d6e3ae55a7838cf51ba9", - "dist/2023-05-30/cargo-beta-mips-unknown-linux-gnu.tar.gz": "931a2f303b97bd21498e51370392e9ebc66d6cdbfaf537035245988781173b45", - "dist/2023-05-30/cargo-beta-mips-unknown-linux-gnu.tar.xz": "ce71db299106759857ba00ab57bc275bdb4817576a51333b8bfd6a9f1d7b8010", - "dist/2023-05-30/cargo-beta-mips64-unknown-linux-gnuabi64.tar.gz": "3f32c9a97da50ee98a2b60e8e3f5140941d12d3374a9926f169081d3b6ab6a51", - "dist/2023-05-30/cargo-beta-mips64-unknown-linux-gnuabi64.tar.xz": "568732ec25848560ed886d0742fcc5c84f6aef8dba16d530853aaddc3196553c", - "dist/2023-05-30/cargo-beta-mips64el-unknown-linux-gnuabi64.tar.gz": "b9dafe965f6ee947b57b70ceb7317d9996ed35c11c761be45194e0415d41fd05", - "dist/2023-05-30/cargo-beta-mips64el-unknown-linux-gnuabi64.tar.xz": "32226b19d7d6d46a99c7ca1b4d20e4228071ea9062bea564083633a2723c495e", - "dist/2023-05-30/cargo-beta-mipsel-unknown-linux-gnu.tar.gz": "69f8b8dccd7bce10f5c753b0e41f46ba6f29b32499a7b1e16ddcdfd9a592b5fa", - "dist/2023-05-30/cargo-beta-mipsel-unknown-linux-gnu.tar.xz": "95e7e39eef157e060dda4ed8613a78d1eba5065a1a8189d887a81a12ab432d27", - "dist/2023-05-30/cargo-beta-powerpc-unknown-linux-gnu.tar.gz": "613a81e9fec3814e4e5467dbcff0bb83e29b450733c4b36d8442fd2e8c5dc24a", - "dist/2023-05-30/cargo-beta-powerpc-unknown-linux-gnu.tar.xz": "2983b7fb28441408b53a49aeb3a7089c555460c31bb91b0a11d17f448c677de8", - "dist/2023-05-30/cargo-beta-powerpc64-unknown-linux-gnu.tar.gz": "e63195ba700e4ab778e772ca935c4d3e42ce18474f3180226d254b0874cb65f9", - "dist/2023-05-30/cargo-beta-powerpc64-unknown-linux-gnu.tar.xz": "eaaba4a4c35cdf30ba6225f652415312cf8d8a1d7edd2e4216f2379099b6d8c8", - "dist/2023-05-30/cargo-beta-powerpc64le-unknown-linux-gnu.tar.gz": "22c14003af58c489f07e52419edd2cfd50d8e2ed147a25f648855629d9f56478", - "dist/2023-05-30/cargo-beta-powerpc64le-unknown-linux-gnu.tar.xz": "2e513a599b7779dc37367e8ee28943b1568c296ba2b2e697f22b6cfabbb062c8", - "dist/2023-05-30/cargo-beta-riscv64gc-unknown-linux-gnu.tar.gz": "eb75f2008324c4956cc14989692904c20f412a30311a82f2a085516706f9e2a3", - "dist/2023-05-30/cargo-beta-riscv64gc-unknown-linux-gnu.tar.xz": "5cfe6a533005c70aaf14f86cdba51245272b0cb2c04a74a03da69744b18d40b8", - "dist/2023-05-30/cargo-beta-s390x-unknown-linux-gnu.tar.gz": "b37acb2fca2ec79e72f9ed5b87eba157a629ca1e3fa044d0caf6fd665451d09b", - "dist/2023-05-30/cargo-beta-s390x-unknown-linux-gnu.tar.xz": "cd590ac88ea46e6f347c1d433a3ffd661c4766504eae7197d06de69f3303ff07", - "dist/2023-05-30/cargo-beta-x86_64-apple-darwin.tar.gz": "a8db5d95e0d8ab4cfe323165abd423d17e1545d1b99bb2e8bf4b197ca2471e84", - "dist/2023-05-30/cargo-beta-x86_64-apple-darwin.tar.xz": "95ceb8066879807752f9f7a70aeb2e9d08991659f49d64249b04c2b1ea545ac6", - "dist/2023-05-30/cargo-beta-x86_64-pc-windows-gnu.tar.gz": "2971558e43ee1e6a8c6ce5277b902a537d7f6d31ce714702e89efc468cf8dfde", - "dist/2023-05-30/cargo-beta-x86_64-pc-windows-gnu.tar.xz": "6ad42cca05e6c752424c3725516e24e9b1051e201b3ef0c2e1d8ec2e44973717", - "dist/2023-05-30/cargo-beta-x86_64-pc-windows-msvc.tar.gz": "c5f0cf8ebd206dfc39c0c889ae8670a6b6b2fb55cdbfeee3ba8b2ec72daf6135", - "dist/2023-05-30/cargo-beta-x86_64-pc-windows-msvc.tar.xz": "90d13c515e737193858f48901d8f150c5528a09e2a1c8a08987140f2ad8fbc03", - "dist/2023-05-30/cargo-beta-x86_64-unknown-freebsd.tar.gz": "a183226ff05ac8d16baf03c81a9281f42e1de5a0b270b1592ba785397e4d32da", - "dist/2023-05-30/cargo-beta-x86_64-unknown-freebsd.tar.xz": "96984a716ac37b2888181b00939c975a544cdf21a0dc1db5bcd5b4468e28eeab", - "dist/2023-05-30/cargo-beta-x86_64-unknown-illumos.tar.gz": "997cc3167983b80bbd8d323a61d718022ff0fd9827299379166e7240b0fbb2ff", - "dist/2023-05-30/cargo-beta-x86_64-unknown-illumos.tar.xz": "6f1c276cfc53f17cae1e1fdf372275a39c60a3d4c543dbed553222557707c6e9", - "dist/2023-05-30/cargo-beta-x86_64-unknown-linux-gnu.tar.gz": "a5075bdb4ca1b4a5b5cc734a131277967a5a34c9915afa52e3275da60e87993b", - "dist/2023-05-30/cargo-beta-x86_64-unknown-linux-gnu.tar.xz": "417b88bae9f028c94ee0563baf421abf8a18ceffe35d731ad9736f71d6a1b34b", - "dist/2023-05-30/cargo-beta-x86_64-unknown-linux-musl.tar.gz": "495b66a5e9dd3987c02f004eb8e3515b84dc132b274e726df36359cc9974f4a9", - "dist/2023-05-30/cargo-beta-x86_64-unknown-linux-musl.tar.xz": "faeb090c8e1d15b20c256eb7b326de2375812ffc7984e8c11e28a0add3fddec5", - "dist/2023-05-30/cargo-beta-x86_64-unknown-netbsd.tar.gz": "adc9720e065861ff8aeeec8ffdc231161755e603301521982f6ef405d2d12c95", - "dist/2023-05-30/cargo-beta-x86_64-unknown-netbsd.tar.xz": "2def53546856b6cce7ddfce00329fe05be0f649f0b8421168fbab85d9c23715d", - "dist/2023-05-30/rust-std-beta-aarch64-apple-darwin.tar.gz": "ebd92098d173efea06a3e2d2edec299483fc77925427417e182800567ff6d642", - "dist/2023-05-30/rust-std-beta-aarch64-apple-darwin.tar.xz": "028c6269d40f8adf897b5e6b61387ce49cb1c2c82244965d48efa68ca71d74e1", - "dist/2023-05-30/rust-std-beta-aarch64-apple-ios-sim.tar.gz": "ea5654c6a23488e56c0b1c8c8c655c449bcadc9c3676db9ff37ef3fe742c4f9e", - "dist/2023-05-30/rust-std-beta-aarch64-apple-ios-sim.tar.xz": "9b0542cd5aa8ab4df51e41800e99563a8a3d6a202d32008a9166ba29d40c7ce5", - "dist/2023-05-30/rust-std-beta-aarch64-apple-ios.tar.gz": "ff1bd99fa25176ccb5fe5ef9dca6bf902094c6b6f2ba1985481c1a0fb58cbc7d", - "dist/2023-05-30/rust-std-beta-aarch64-apple-ios.tar.xz": "3009eb898a50aebf7fda060b5abf1098271061431f732542e2d1e2bd98e17f60", - "dist/2023-05-30/rust-std-beta-aarch64-linux-android.tar.gz": "15ee7baf5a04c9651abc176b3d6679104a395c128724256aadaaf1174d76dbab", - "dist/2023-05-30/rust-std-beta-aarch64-linux-android.tar.xz": "93ffc5e6252ba061966338ebae85c1addea410cb1c6cc34936c86376a4ae264b", - "dist/2023-05-30/rust-std-beta-aarch64-pc-windows-msvc.tar.gz": "c13e9ef9c5c2088f7b7d111861bc1c6e11b2e2e26e5e43f44fcdb1629f1a5183", - "dist/2023-05-30/rust-std-beta-aarch64-pc-windows-msvc.tar.xz": "e19e125a06f6c1cfe719cc2c1e1925609c315c368e95fd32d75ace3f1dfdad32", - "dist/2023-05-30/rust-std-beta-aarch64-unknown-fuchsia.tar.gz": "2d8e20471633b28d5fac2f443ddfce59f84c49e87065f6538924c4484054aa85", - "dist/2023-05-30/rust-std-beta-aarch64-unknown-fuchsia.tar.xz": "bec968d53659373451860525922b6833204e0e61efa192739d59fe64fc8fd8e1", - "dist/2023-05-30/rust-std-beta-aarch64-unknown-linux-gnu.tar.gz": "4092203bfab27e32bd3fe2254cb91cd70d332a613a1d2286fbe985036c6f96ea", - "dist/2023-05-30/rust-std-beta-aarch64-unknown-linux-gnu.tar.xz": "a288efac80a2692858669537daa6b2657470dc4124541654a22d9ff415ad0389", - "dist/2023-05-30/rust-std-beta-aarch64-unknown-linux-musl.tar.gz": "d4e1d2ccec8e8ff63f77ea678864d2ec569da5c8a7ae625b820827fd5b4bc193", - "dist/2023-05-30/rust-std-beta-aarch64-unknown-linux-musl.tar.xz": "a14a29b6d213a1e744d7e9273c674cc97de9266764ecdb62ec1b9ab7dc2c81be", - "dist/2023-05-30/rust-std-beta-aarch64-unknown-none-softfloat.tar.gz": "cc8facb1c53ee1cf734933fb997c3eee57a6a0ac2fec8af571e01ad01c09e023", - "dist/2023-05-30/rust-std-beta-aarch64-unknown-none-softfloat.tar.xz": "d84cac6b97e396bcb64f2c794f0b2ebe73217a07a46e2a85a8b6ce73ebf279ce", - "dist/2023-05-30/rust-std-beta-aarch64-unknown-none.tar.gz": "e119575ce29c103ca82134e216ae3a77b01252ca7348212bab36ccb5d785e6b0", - "dist/2023-05-30/rust-std-beta-aarch64-unknown-none.tar.xz": "21472aa2b47a16e479f8759bbd206090169586fb29ab0f976b47fc7bc62c81b8", - "dist/2023-05-30/rust-std-beta-aarch64-unknown-uefi.tar.gz": "699727b60d15a4386659c8679aa612455b4a57fbd0901172d7daa7fc5ca253a7", - "dist/2023-05-30/rust-std-beta-aarch64-unknown-uefi.tar.xz": "95949ba372aa947c1bac030805af76644a99d6098442054bada9278b5c8f0722", - "dist/2023-05-30/rust-std-beta-arm-linux-androideabi.tar.gz": "765a7f836bff1ed7b10816a0ace2cdeb0b9aa383fbaa90fd0fba203093b4255c", - "dist/2023-05-30/rust-std-beta-arm-linux-androideabi.tar.xz": "66b909b5a4e6a19f4b45ca5396353437da76a350c994696d25e5b617b54e7df6", - "dist/2023-05-30/rust-std-beta-arm-unknown-linux-gnueabi.tar.gz": "43f2e2230c405809115bac27ff1b344ec7da7e410728c88092e021688819aa61", - "dist/2023-05-30/rust-std-beta-arm-unknown-linux-gnueabi.tar.xz": "8eb6821edf96ad1ead828a95513e8ed8deafe1f1697cc965e6e9830175ce41a3", - "dist/2023-05-30/rust-std-beta-arm-unknown-linux-gnueabihf.tar.gz": "7fcc7ccc6d705636bbd37096707358eaeb192179409983a6c3681a2664446ef9", - "dist/2023-05-30/rust-std-beta-arm-unknown-linux-gnueabihf.tar.xz": "506f392a315b45d458111b30bc3d13b266a43ed1890418e8c85e02e9eb0cd284", - "dist/2023-05-30/rust-std-beta-arm-unknown-linux-musleabi.tar.gz": "6b42b38873821320ec597ec44767ec03d87068389a61360aa566347506ad2a8e", - "dist/2023-05-30/rust-std-beta-arm-unknown-linux-musleabi.tar.xz": "33324c183092e505b77a76a0ea6d0e169838dd76e96a8ad94b142843449ec9e3", - "dist/2023-05-30/rust-std-beta-arm-unknown-linux-musleabihf.tar.gz": "414e4834f232862cc6b371716f014a7384e23fa4d4997b25ca77ba03ce4acda3", - "dist/2023-05-30/rust-std-beta-arm-unknown-linux-musleabihf.tar.xz": "bf60815516d3dd2d4452de0985dd95a615b905789669dcfe225eb2fa6b26c3d8", - "dist/2023-05-30/rust-std-beta-armebv7r-none-eabi.tar.gz": "132fa87ff6c7d9a94871edbc2a9634f96bf16ea46b04978680ea25855530b9ab", - "dist/2023-05-30/rust-std-beta-armebv7r-none-eabi.tar.xz": "1c2d6404ac467cff3ffb2f440a807b35532d03469730131b53b4ddd9e7f43f57", - "dist/2023-05-30/rust-std-beta-armebv7r-none-eabihf.tar.gz": "92c3b59c2cd7324d27edb928292017f27a9e88d12a5e5cc66a851be35481a29a", - "dist/2023-05-30/rust-std-beta-armebv7r-none-eabihf.tar.xz": "b545ba9763df61d95faa14e59124fab46d09ae95707e9686f325459140abb950", - "dist/2023-05-30/rust-std-beta-armv5te-unknown-linux-gnueabi.tar.gz": "2accb0f63c0ffb0aa0db99c05e5eedee369348d2a571df1b87689225cdb61d44", - "dist/2023-05-30/rust-std-beta-armv5te-unknown-linux-gnueabi.tar.xz": "fae4c7f7549789f51c1ee7037fa6142ec8ace96d8438ed964bf15f9241948fab", - "dist/2023-05-30/rust-std-beta-armv5te-unknown-linux-musleabi.tar.gz": "414978972ee622cfaf64dfd4fbe3cb5ec5e2d8436f129a75283d98fadf17f595", - "dist/2023-05-30/rust-std-beta-armv5te-unknown-linux-musleabi.tar.xz": "abc1719b2b29ad091a11d9515e633dadb98a665fb209a47e291a490d4e79f6c9", - "dist/2023-05-30/rust-std-beta-armv7-linux-androideabi.tar.gz": "c1159cab2a4bbb24e2ab7135d449583dd0e2f1fb329b7420aea69b005c9556a9", - "dist/2023-05-30/rust-std-beta-armv7-linux-androideabi.tar.xz": "b37e60b73d802535e2832351a344c3180bfe931cd14a03df5ea8bee8bd2f3f3e", - "dist/2023-05-30/rust-std-beta-armv7-unknown-linux-gnueabi.tar.gz": "65b9809fcda771576c1586c239d5dfaf960c2968e4ba09473f4d304b2684eeb1", - "dist/2023-05-30/rust-std-beta-armv7-unknown-linux-gnueabi.tar.xz": "331788bfc44fdeb49d85ef84591c400b95f7939661a722aaf36728617b86ce6d", - "dist/2023-05-30/rust-std-beta-armv7-unknown-linux-gnueabihf.tar.gz": "b932fd571a95f97e9a5dac39c99cfe488f2d29f9e86e9e2821b16df33cabc6a3", - "dist/2023-05-30/rust-std-beta-armv7-unknown-linux-gnueabihf.tar.xz": "7427c8103ecb0d0cf3f211f8700f0cf2bf6969e982ff599c20de87027224a814", - "dist/2023-05-30/rust-std-beta-armv7-unknown-linux-musleabi.tar.gz": "1206cf83b0bdf96bb1fb2c074c4078f99242d6eb273321e8090ed2cedb760c14", - "dist/2023-05-30/rust-std-beta-armv7-unknown-linux-musleabi.tar.xz": "5f1ac81a4508e6f2fb9b931cb556cb2d45ebe88e90eeeb7c25690a0f9448a0e1", - "dist/2023-05-30/rust-std-beta-armv7-unknown-linux-musleabihf.tar.gz": "a833ab5f38416ee1d94565db936dd0f351ff4313456f6faecf581e07508080e5", - "dist/2023-05-30/rust-std-beta-armv7-unknown-linux-musleabihf.tar.xz": "ba7c2dc66a19a960bf4e914cc30f8c40cde435d4da11e4dc44208cb950c67892", - "dist/2023-05-30/rust-std-beta-armv7a-none-eabi.tar.gz": "34ca46fc29871e03490d17df73e55f250699204cfb1ea0d72427434212c4f7e6", - "dist/2023-05-30/rust-std-beta-armv7a-none-eabi.tar.xz": "d6b58d542f3219e5075794588c2183a7849530b6ea174dd8cdcf1cc289c4c13e", - "dist/2023-05-30/rust-std-beta-armv7r-none-eabi.tar.gz": "ff262f5ac8cb94feaccfac8715f6a97a1edbf59e8778add720ec356203e2f9b7", - "dist/2023-05-30/rust-std-beta-armv7r-none-eabi.tar.xz": "ae386368da77e529eeb40c1d123bca34b07d65cc359d790949f257a541abdf91", - "dist/2023-05-30/rust-std-beta-armv7r-none-eabihf.tar.gz": "26e123410afb4c0aa7c110c12d31ad00b99f6ffc042745de2bca34b86e04c685", - "dist/2023-05-30/rust-std-beta-armv7r-none-eabihf.tar.xz": "ce3400eba477600cc4675b7d91366ca80e82ce656b62f83cea532b60248ad7d8", - "dist/2023-05-30/rust-std-beta-asmjs-unknown-emscripten.tar.gz": "6874686cdc7e9d1842cf59c1d55570379cd0f3933da55683435b7b36178ca106", - "dist/2023-05-30/rust-std-beta-asmjs-unknown-emscripten.tar.xz": "1a8cf6d6d86101c84e456667d9bb9866039b81e833e6b7bdbc227e6af540fccf", - "dist/2023-05-30/rust-std-beta-i586-pc-windows-msvc.tar.gz": "7f121cf6edf07b54e731e863d5c3ec92da88e39e88057e96b07f31a1cc16cb8b", - "dist/2023-05-30/rust-std-beta-i586-pc-windows-msvc.tar.xz": "a3c8dd03a35b272045fffd57d773064556637241ecd83218c78d9f20c5200b12", - "dist/2023-05-30/rust-std-beta-i586-unknown-linux-gnu.tar.gz": "5a3475ae3f6974ff33e7372867e1cfd6c944dab4af52e4daabdd471d270effd0", - "dist/2023-05-30/rust-std-beta-i586-unknown-linux-gnu.tar.xz": "4f2c386aa8f2689f88069ac96a88eb72bd56c6f3d3f002e7dd095fba3d0cd8ca", - "dist/2023-05-30/rust-std-beta-i586-unknown-linux-musl.tar.gz": "2659f824119c5abff708e1e282915a291989a98eb7710676a24adfe52c851f93", - "dist/2023-05-30/rust-std-beta-i586-unknown-linux-musl.tar.xz": "07960cf2f28f52eaf8351573da0e3964481f0cfa5502ab5b5e3ea4ad535dcd6e", - "dist/2023-05-30/rust-std-beta-i686-linux-android.tar.gz": "ef4eea9c214eea6a4d1425fcee382f0553a66d6d17ce33c3949d7df24e76d1d8", - "dist/2023-05-30/rust-std-beta-i686-linux-android.tar.xz": "3e54d56aab895defcab4c31d7fa0ed731387fae0a5df4ed56511173a20f4ab9b", - "dist/2023-05-30/rust-std-beta-i686-pc-windows-gnu.tar.gz": "92b09c74bc552e01f68d0090316287026340c92bd8804cffd5d2bbbe44124822", - "dist/2023-05-30/rust-std-beta-i686-pc-windows-gnu.tar.xz": "2f96ceb5fed911b830553e354bcc47cc6f1983e22a4b1227e61983308e184457", - "dist/2023-05-30/rust-std-beta-i686-pc-windows-msvc.tar.gz": "2251b6cdd4d9d7cd2990efa1641e93ca8fb51e7228eb95305a468e61c4a53d3e", - "dist/2023-05-30/rust-std-beta-i686-pc-windows-msvc.tar.xz": "e4c00779bea04c7e5a2f859900325355d64e9ef6cfbc452a3a8e5fd20b440518", - "dist/2023-05-30/rust-std-beta-i686-unknown-freebsd.tar.gz": "b731321a1a2beddb2d64009e77b883d97e679bcca8ae454e9e5b33a72461c220", - "dist/2023-05-30/rust-std-beta-i686-unknown-freebsd.tar.xz": "2d99b9633fb37ad1f017539f65dbea5644b6d85a44e657a48f71766b306cc172", - "dist/2023-05-30/rust-std-beta-i686-unknown-linux-gnu.tar.gz": "1782c79086dff3dc53d15894a6c3bec8dd87f457fab73c472c302eded6258d10", - "dist/2023-05-30/rust-std-beta-i686-unknown-linux-gnu.tar.xz": "8eb6afcc2fe17a383212f24e09db66ce37e0662925039f87a47bb50f44d4b671", - "dist/2023-05-30/rust-std-beta-i686-unknown-linux-musl.tar.gz": "4890d5adbee68aaac44e23b84487a4db6a602438d14b046bca23193273130485", - "dist/2023-05-30/rust-std-beta-i686-unknown-linux-musl.tar.xz": "9b00cdfc7890ca8a169556b2af8b690f59a17b49f44669a64fb0a27e42ba45a2", - "dist/2023-05-30/rust-std-beta-i686-unknown-uefi.tar.gz": "f672aa10394ec1f4998a29fd4e871d5da4057de5a67ef1e88e99fbf044485572", - "dist/2023-05-30/rust-std-beta-i686-unknown-uefi.tar.xz": "5da375bff19cbd2b6c550514b5452005cb1cb19c29f41e3efbe1652b367ee9ee", - "dist/2023-05-30/rust-std-beta-loongarch64-unknown-linux-gnu.tar.gz": "e52febf6ff0bead6c72efdf5afbda8951a8a52ec87980fe42179d624b21b51fc", - "dist/2023-05-30/rust-std-beta-loongarch64-unknown-linux-gnu.tar.xz": "a1b218f627223d60c231441752ae1696612471e90a3367a471ffe367309ec4e3", - "dist/2023-05-30/rust-std-beta-mips-unknown-linux-gnu.tar.gz": "1cade6c46209e8cf605794d18c6c8a2d0cdfd81b154802f0e916f5b59688f77e", - "dist/2023-05-30/rust-std-beta-mips-unknown-linux-gnu.tar.xz": "98cbb0c41f140acea077cae5145a28153f0d5f06e6009cad73064365d3bc373b", - "dist/2023-05-30/rust-std-beta-mips-unknown-linux-musl.tar.gz": "cfaedf4168ab803720bccf508ff04fef073d5b73ab6d9a27aaa5473edfe85b2a", - "dist/2023-05-30/rust-std-beta-mips-unknown-linux-musl.tar.xz": "7a9b2ab5dd58f61c1656081d0606ab60fade1e3f7c2d91d40b6dbb8255359df1", - "dist/2023-05-30/rust-std-beta-mips64-unknown-linux-gnuabi64.tar.gz": "670990fab0d668344d8b0b67a7613415c1fe596f73b2bc800e2f8acefed5a447", - "dist/2023-05-30/rust-std-beta-mips64-unknown-linux-gnuabi64.tar.xz": "3fd409a760598d6b830f4469c474a2d50e0332886f5e90bd6d80960cb593f948", - "dist/2023-05-30/rust-std-beta-mips64-unknown-linux-muslabi64.tar.gz": "2d583489021ea04e11a1c19743c29f77622cb95102122d16cbc77d24d6e6de8c", - "dist/2023-05-30/rust-std-beta-mips64-unknown-linux-muslabi64.tar.xz": "4a340a6d2292256b2f370931b74490afc07570c58f95a5a97be6840c6a426e3e", - "dist/2023-05-30/rust-std-beta-mips64el-unknown-linux-gnuabi64.tar.gz": "7a19789581b82f31c90a83d604a2894e82ce309b26598b0acb028f8ba749aa39", - "dist/2023-05-30/rust-std-beta-mips64el-unknown-linux-gnuabi64.tar.xz": "2507a916346c53dd44dc590334630eacd5b4c5a57a240a936203a73b4e96d507", - "dist/2023-05-30/rust-std-beta-mips64el-unknown-linux-muslabi64.tar.gz": "4b676b406389acc80c61fe89dbf4f8439436c8ef5f2e4a7f36202a9a48ddd487", - "dist/2023-05-30/rust-std-beta-mips64el-unknown-linux-muslabi64.tar.xz": "83ad872a06bd1cace948d542e1a69210f550abe536d74b0dbf036cc02d7c05a1", - "dist/2023-05-30/rust-std-beta-mipsel-unknown-linux-gnu.tar.gz": "31bc6097eec7ac51e5e923199aec47fb129f34dc472b3ba3d2398c4481aaf12b", - "dist/2023-05-30/rust-std-beta-mipsel-unknown-linux-gnu.tar.xz": "68bffca2afe433a435e8712174efbd61b628e5dacdbf151713f7b43c67804e57", - "dist/2023-05-30/rust-std-beta-mipsel-unknown-linux-musl.tar.gz": "34520ba878f3ab24d86f965d7470292df65deed971d1a3f1b078c3e4b353ead3", - "dist/2023-05-30/rust-std-beta-mipsel-unknown-linux-musl.tar.xz": "8ef5dffe7ed584ea59a8d1114f15d1eeb2bd598239fb3d2bc3efbbbe3da36c44", - "dist/2023-05-30/rust-std-beta-nvptx64-nvidia-cuda.tar.gz": "2297e2cb62b5d1085318d19334f55277e547b0d7bed86a29f60859f5e029d259", - "dist/2023-05-30/rust-std-beta-nvptx64-nvidia-cuda.tar.xz": "3f012c0cc6c7adad8e08f40c697c0248938103e5a1949c07d1139ef3d5a8cf9d", - "dist/2023-05-30/rust-std-beta-powerpc-unknown-linux-gnu.tar.gz": "8438185ba380e24cdae232aad740e9cc580e2bc4eb4b4aacc006a66e3b846ea0", - "dist/2023-05-30/rust-std-beta-powerpc-unknown-linux-gnu.tar.xz": "c751381d33ada7720f3aa10a242a26055806e56cfbc2348c2f21fb2b767f46df", - "dist/2023-05-30/rust-std-beta-powerpc64-unknown-linux-gnu.tar.gz": "1923978ae0a1130fea64fa35ef3aa9c5808b8d8a4af89cd78e0a3edf448404b9", - "dist/2023-05-30/rust-std-beta-powerpc64-unknown-linux-gnu.tar.xz": "36481e7b876977c357c1171d2bf4641f55ca7df70288c5aae0e94bd37380928d", - "dist/2023-05-30/rust-std-beta-powerpc64le-unknown-linux-gnu.tar.gz": "965b9ee397d3ae5fe783c89e9b587dfbef1d3a572ad1503dfa997cb0016444ec", - "dist/2023-05-30/rust-std-beta-powerpc64le-unknown-linux-gnu.tar.xz": "5963b85d5e8e41d86fd6447ad99ba0a3b36d07657c935fbd810c259d1bb6ccc1", - "dist/2023-05-30/rust-std-beta-riscv32i-unknown-none-elf.tar.gz": "c38b5bce61132789809aaed43151739ccde285186d42882f411610170ab3bded", - "dist/2023-05-30/rust-std-beta-riscv32i-unknown-none-elf.tar.xz": "973389204e68468825084d29934c6d89ef3215563402cad62d0630764e0f7adf", - "dist/2023-05-30/rust-std-beta-riscv32imac-unknown-none-elf.tar.gz": "39153c0171d86611ebfe77f0cd2d26ae9a432910778b86163fcd29ef633ce8a3", - "dist/2023-05-30/rust-std-beta-riscv32imac-unknown-none-elf.tar.xz": "1f90107007322dd3167c0a11bf50ab3c939f52fee06ac8cf737891cef7be030e", - "dist/2023-05-30/rust-std-beta-riscv32imc-unknown-none-elf.tar.gz": "ea75cc8c20192334d3f22719fcd67343d64c04a64cb1750f2182548b34643368", - "dist/2023-05-30/rust-std-beta-riscv32imc-unknown-none-elf.tar.xz": "2c48229fa6c41d68535590f8993c0dc45325d890fadad0c6ebcc7a0afa1c77a4", - "dist/2023-05-30/rust-std-beta-riscv64gc-unknown-linux-gnu.tar.gz": "041dd4a64a699968a487c22893c11ef0944b6e920cdd23f2c904e3cfd847700b", - "dist/2023-05-30/rust-std-beta-riscv64gc-unknown-linux-gnu.tar.xz": "6a5558581221b88a4e99ba3231bb0c35445537b1e0f1f0b6e02345297df9f1ee", - "dist/2023-05-30/rust-std-beta-riscv64gc-unknown-none-elf.tar.gz": "08830dfee466dd7e295489c2ab2b954e4d88001f851a5c96ed19de158c594490", - "dist/2023-05-30/rust-std-beta-riscv64gc-unknown-none-elf.tar.xz": "2a0bd37a0250ecaebe522df54201dd0b70fadcac9df01dfd70f681fa27385627", - "dist/2023-05-30/rust-std-beta-riscv64imac-unknown-none-elf.tar.gz": "b7c82cdf881d8d5052e365cbeb1966bc4c59627692619642617d4cf9fc8dd02d", - "dist/2023-05-30/rust-std-beta-riscv64imac-unknown-none-elf.tar.xz": "da29b033566bb1f97a98851fba1b41818d4a3a41d65713e4f1644e0ff43e0ef0", - "dist/2023-05-30/rust-std-beta-s390x-unknown-linux-gnu.tar.gz": "731fdf689c118040eb79917fe194a7691f82b5c68246d99496f21fc8d095c6f2", - "dist/2023-05-30/rust-std-beta-s390x-unknown-linux-gnu.tar.xz": "a7dfdbc15fcf1311b813b0ca8fe07270b28d1b0e7a87bb64663aa3999367430b", - "dist/2023-05-30/rust-std-beta-sparc64-unknown-linux-gnu.tar.gz": "445d91c3240b79d86d48e47f3553a14375932c9751fe4c917357e34890b86830", - "dist/2023-05-30/rust-std-beta-sparc64-unknown-linux-gnu.tar.xz": "6fbcf8e4e09a93216053781c20d2879660cac129d078ed610cb1e6db72d9d59c", - "dist/2023-05-30/rust-std-beta-sparcv9-sun-solaris.tar.gz": "e45cece10a961fc046adf7721f920e592bc7c0c5c276bb55bfc6b6c8fb95486e", - "dist/2023-05-30/rust-std-beta-sparcv9-sun-solaris.tar.xz": "b3778ff0a994f38133e49a448c091e51fbfe90a3fcf4ddcf209a3b49bd9c1c8f", - "dist/2023-05-30/rust-std-beta-thumbv6m-none-eabi.tar.gz": "5625a51ff41dd444d32d653c329139c906edf26e20782765feaf0168b4fce643", - "dist/2023-05-30/rust-std-beta-thumbv6m-none-eabi.tar.xz": "4a2ca2f8f99f297fa2b17c423b8c850476fb80a2bd19e6fd914f2efa813e13c1", - "dist/2023-05-30/rust-std-beta-thumbv7em-none-eabi.tar.gz": "26189595572717cf9721394f4f604a7c81cc9066813bda81e0eb8508075d4510", - "dist/2023-05-30/rust-std-beta-thumbv7em-none-eabi.tar.xz": "f4f88f6a85761207a3c1496ce3cbd87608de99febc74e01ac0851577c33ec248", - "dist/2023-05-30/rust-std-beta-thumbv7em-none-eabihf.tar.gz": "246b7f137c982e32d3f80e34c8e26a4ff64072b8f01d012fede280a1c356ec0b", - "dist/2023-05-30/rust-std-beta-thumbv7em-none-eabihf.tar.xz": "14904ce77090bacee8727529a2cbefc14ec2ba21a94e90e15b04841e562c7100", - "dist/2023-05-30/rust-std-beta-thumbv7m-none-eabi.tar.gz": "d02b075118d4aa29e7a842c95b7f5fb7f438f8d11c8c6ef3059a812993862811", - "dist/2023-05-30/rust-std-beta-thumbv7m-none-eabi.tar.xz": "564352083d92236466aaa6742b0df362f6dca5ea30696ab0b7c68da7b2c1ea05", - "dist/2023-05-30/rust-std-beta-thumbv7neon-linux-androideabi.tar.gz": "6f339f2a9491ac5cfee317fbb6539a14b0f1d6cf6cc8ccf1091f3493bd5d3e06", - "dist/2023-05-30/rust-std-beta-thumbv7neon-linux-androideabi.tar.xz": "475593fcb658f7e01610c2aa9cbf76f3db7b1306c6697ea40626ae51dfab3b28", - "dist/2023-05-30/rust-std-beta-thumbv7neon-unknown-linux-gnueabihf.tar.gz": "fdb20a3f739747105e72718b2a2e79a23b2dc603153ad8feca51a4f6791edb22", - "dist/2023-05-30/rust-std-beta-thumbv7neon-unknown-linux-gnueabihf.tar.xz": "ed9fae43e824c70ecf1efde92a45a3c85781b2913597ed0d60e75c7410145968", - "dist/2023-05-30/rust-std-beta-thumbv8m.base-none-eabi.tar.gz": "68f91796bdc580170716ec00be393c939359657b6f5aeba7c3e88ca0d068f8b9", - "dist/2023-05-30/rust-std-beta-thumbv8m.base-none-eabi.tar.xz": "2c014f52137862b2e7355812aee142ace2b4770c25dadac8f8e99239d82d7ca3", - "dist/2023-05-30/rust-std-beta-thumbv8m.main-none-eabi.tar.gz": "d2b691c5a6b11b5489898673e3d69aaaeccd2b97b0856421b1aa5c91fd48c5af", - "dist/2023-05-30/rust-std-beta-thumbv8m.main-none-eabi.tar.xz": "ff61566f1d84d80c0263d58cb4016201e2694278bcd9233ca2cafd19c47fc61c", - "dist/2023-05-30/rust-std-beta-thumbv8m.main-none-eabihf.tar.gz": "04c29db24b00c9e377f22266ad0bdb3126febfb39a35f83143ec7e2e052cf7c2", - "dist/2023-05-30/rust-std-beta-thumbv8m.main-none-eabihf.tar.xz": "651a8fb666a1412bffe84d39e92e01ba3fea6687d92f90ba0e3a4bdfbcea8dc0", - "dist/2023-05-30/rust-std-beta-wasm32-unknown-emscripten.tar.gz": "f4ea3e81bbaa7e6569c18e0f111aeca8a5cbf565403f7c0fa9c2da0858ee9548", - "dist/2023-05-30/rust-std-beta-wasm32-unknown-emscripten.tar.xz": "14ac309023a66949fbd3110eb7f53035abb54f79711e848f382e2953a702eb5b", - "dist/2023-05-30/rust-std-beta-wasm32-unknown-unknown.tar.gz": "4bc81b56c91e6771154d30cdae66c8f09d5c1e47ead91e59a1d98c9c7f2eefa8", - "dist/2023-05-30/rust-std-beta-wasm32-unknown-unknown.tar.xz": "b32619fbbdd47c901c41f385b3a6c1766f5439d8f6fef36409e1a8ba4ad5d847", - "dist/2023-05-30/rust-std-beta-wasm32-wasi.tar.gz": "c505c26f333208c5b38229b4fcf60621748303ff23193254e321386348328afb", - "dist/2023-05-30/rust-std-beta-wasm32-wasi.tar.xz": "f2b675fc1f95c5c3cfc78e10ad9b1322d920d429ae98b47580b7a1a7536dbba1", - "dist/2023-05-30/rust-std-beta-x86_64-apple-darwin.tar.gz": "e58d900bf9a1fde7867470c2c87b41c8ba8cdcef6b9653899c53d21f7b16d43a", - "dist/2023-05-30/rust-std-beta-x86_64-apple-darwin.tar.xz": "4cf95d2f670c00906e89ed8539bc90a45f0398bae84916409a26ceedfbd5b9ad", - "dist/2023-05-30/rust-std-beta-x86_64-apple-ios.tar.gz": "a5f8ab9c9d2d4a71aacf2221e06494bbc0ff9076d3c7dadbd0d4473f6e900c79", - "dist/2023-05-30/rust-std-beta-x86_64-apple-ios.tar.xz": "b3d6b2795c0d50aa8f1665579f1e3a1e056071cd50f4a464863608739c8fa62b", - "dist/2023-05-30/rust-std-beta-x86_64-fortanix-unknown-sgx.tar.gz": "08157017fa1d7a64078a7b2a3e7662b0f76174de3bbd1ca80bed40ec5dcb7407", - "dist/2023-05-30/rust-std-beta-x86_64-fortanix-unknown-sgx.tar.xz": "0588ec9de11c46a0cb705690e2182fe5acfd0d33e71f29dde9798f9025c137e0", - "dist/2023-05-30/rust-std-beta-x86_64-linux-android.tar.gz": "9aa164600f3adfdcf369b23e69f9f5c81757f21b9fef1419bc06d2b9474e4120", - "dist/2023-05-30/rust-std-beta-x86_64-linux-android.tar.xz": "635c8d4edf68790079eacac7d5754fe7ab431787dd01ebec7184c03e65e78c4a", - "dist/2023-05-30/rust-std-beta-x86_64-pc-solaris.tar.gz": "622e359c4178cf626fe63f95164915ec4289c5898851a9282da9780b847e8414", - "dist/2023-05-30/rust-std-beta-x86_64-pc-solaris.tar.xz": "ab2b95f4104691d44d455f4e5391b187b712b632cd0ec11baf1d29291814d770", - "dist/2023-05-30/rust-std-beta-x86_64-pc-windows-gnu.tar.gz": "08f28724ee08b13705911c5c9be7773f8ac935329fa37548b8d46118fc5e244b", - "dist/2023-05-30/rust-std-beta-x86_64-pc-windows-gnu.tar.xz": "fa3fcd87e50aae6f1893b65b027ae6f705f7c42cba63cebfca1e49dd3c2af966", - "dist/2023-05-30/rust-std-beta-x86_64-pc-windows-msvc.tar.gz": "c208ad4e8ea70e45b6d76b7a88491a33f30f1415043a26ad96908faefdb37eb7", - "dist/2023-05-30/rust-std-beta-x86_64-pc-windows-msvc.tar.xz": "afa64e5bccb5138d86349f8564f82dcdcf009e7bd07121d193ead9864f2ca1f5", - "dist/2023-05-30/rust-std-beta-x86_64-sun-solaris.tar.gz": "e2d8fa74156623a3cdc944b1e0eb5683b661dbbecd779b5621777413d4918fb4", - "dist/2023-05-30/rust-std-beta-x86_64-sun-solaris.tar.xz": "2a75d1d8918febceaaaf8ea4c89827798099ab69063878a71afaef5ae17691bf", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-freebsd.tar.gz": "24cf8f9bad86110308215d52aa9ac3b0dffb8640508e718d14ee9928fc68f59c", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-freebsd.tar.xz": "0babdccec106b4cd20574c9722b36e407a1d028856989ff5e390172876ab3e28", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-fuchsia.tar.gz": "0a983d8fe5aa649452f93cf4566d59b091d79da1e325f2da6b0844ef842f7a7c", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-fuchsia.tar.xz": "7bf8fa91b5ecce8744e29a47740f52a57c8faf1fa4e125736103890189cc23b9", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-illumos.tar.gz": "f90b0c2fb060f84b53052852478b474d587f8c51ff1750df5922f2ea8b66fe2f", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-illumos.tar.xz": "6075598069ed92e26615e49bdc6f8c571d7f194462588b941f5479b0ab137994", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-linux-gnu.tar.gz": "8c9a48ec0db55f07200bc73b292a5ee7a603b6b924eb4a1044609d854e820554", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz": "0bcda45a340128c3e69ec0d10b08ea11edd764870e5a8fcd741a42949a025325", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-linux-gnux32.tar.gz": "0f8b6583c8dc192253c480aee8c743013758b7ddfacb08e957c57d1feabd5824", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-linux-gnux32.tar.xz": "a8086bb72e9ce9b9013dac6ea159fc15147a4d1658b5e11d9910f1486828796e", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-linux-musl.tar.gz": "f801f8382e5439a98115c0ce8a1ead8acc983f01a09bb4c6ec3add9324f16334", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-linux-musl.tar.xz": "69cb7620f271d64db234166fc9db37f4b5d60b6f4b9da43d02d21baa31c5da67", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-netbsd.tar.gz": "2cf6c1f646286ecf2fe0a0e8f7eb079e7402dddb556273bc2d12be61b5ee6341", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-netbsd.tar.xz": "0a4845f220640f00b3e0a1d0957050e0c7258867f6f8d6e174277d3659214d46", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-none.tar.gz": "9a1fb11c9a5264232ba1ad2d3c89d1dfb9c135d000b812135932521932ba1b86", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-none.tar.xz": "5598a18d71f1c82e796c136ba4d09b38e24e201ca199752959f0eb094cc49c30", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-redox.tar.gz": "6ec43ffac6b70a67e08308d4869334131025c9acb0e2036a072e9e594ec46acd", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-redox.tar.xz": "eb801580d8ea50d2f7a9a9d78d9a3c10bd3596c84740b3c8b610a86157942b50", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-uefi.tar.gz": "051700f1977665f3b8119af984ece787ed84838d0ae0443bfd475d91d76f1202", - "dist/2023-05-30/rust-std-beta-x86_64-unknown-uefi.tar.xz": "1db1d6eff963a7d1667d1f5542de5484105d39436c0c502044222d7f749299ea", - "dist/2023-05-30/rustc-beta-aarch64-apple-darwin.tar.gz": "63ec87aa7b1d457171503247004d7d046dd951992ae175423986c55f7f44aaeb", - "dist/2023-05-30/rustc-beta-aarch64-apple-darwin.tar.xz": "aea483c5546a038aa6381cd458f9c43d5e2e5365f3d3a296ccd3e96f90bd3fdd", - "dist/2023-05-30/rustc-beta-aarch64-pc-windows-msvc.tar.gz": "35e4e8c6099820f63e46ae916d9c8aa3178164856a3cde479634f0837860bf3d", - "dist/2023-05-30/rustc-beta-aarch64-pc-windows-msvc.tar.xz": "7232af5edf68a4d93ba7a065f2cef5b36f43d6dae76c8141c4624dd25ac17230", - "dist/2023-05-30/rustc-beta-aarch64-unknown-linux-gnu.tar.gz": "c08cd6ee05e23bf777c47f8eb4a66feeb85b88175360720737d96789a82906d5", - "dist/2023-05-30/rustc-beta-aarch64-unknown-linux-gnu.tar.xz": "025108e1db08c5f908e36f7cc5965175a008561cefbddf313501fed7bf583a44", - "dist/2023-05-30/rustc-beta-aarch64-unknown-linux-musl.tar.gz": "d41cec2d6001c6dc8079f4cae54c720a10288c86f6cd8e1cd362df9688ddd975", - "dist/2023-05-30/rustc-beta-aarch64-unknown-linux-musl.tar.xz": "81ca14bd6bd18958c9c9dc27e32dabd2a2076120d860721663fbc7339d096986", - "dist/2023-05-30/rustc-beta-arm-unknown-linux-gnueabi.tar.gz": "260fc42ec007adac4e885feb978f32e2624f30a87f4d91c929c3932be0dbe53c", - "dist/2023-05-30/rustc-beta-arm-unknown-linux-gnueabi.tar.xz": "f4b3455e84d6174a3950410cb25e753d82332ce696f9be606e6b454c279034e1", - "dist/2023-05-30/rustc-beta-arm-unknown-linux-gnueabihf.tar.gz": "9f9447025db2233c4d97d92b35eae50b02db262c6b41898fa73599c245fef3e8", - "dist/2023-05-30/rustc-beta-arm-unknown-linux-gnueabihf.tar.xz": "0db7a3acc6c06a41ebe93b35c62f55dc8f2526fb41e1fe546fea7746505c37a1", - "dist/2023-05-30/rustc-beta-armv7-unknown-linux-gnueabihf.tar.gz": "843cbc007c36850a40f4e5f0b186b2b8bf84f74385272cc2dd3e748ecfd92181", - "dist/2023-05-30/rustc-beta-armv7-unknown-linux-gnueabihf.tar.xz": "d56d7f0be082fe314eb85640779600fb3b74bc0f3d412a4d2c26d40671d0b116", - "dist/2023-05-30/rustc-beta-i686-pc-windows-gnu.tar.gz": "e2f140b4f0682fd4725862daefde019e58b3033ce1d967ec2d75a578871a36ec", - "dist/2023-05-30/rustc-beta-i686-pc-windows-gnu.tar.xz": "2424c4a395970e4570bd9c76396986ab68b3b81de91abc9ebe9c723b6c076d8f", - "dist/2023-05-30/rustc-beta-i686-pc-windows-msvc.tar.gz": "401c558d7866ad3583ab2e193bf804cff46e465d8584e6b857748edb4ef6e9e3", - "dist/2023-05-30/rustc-beta-i686-pc-windows-msvc.tar.xz": "ff328d754f1219ce9cdc2208d4f0feeaf88a2f1eb10cb65217ad26132ecfa67a", - "dist/2023-05-30/rustc-beta-i686-unknown-linux-gnu.tar.gz": "04daee6f6de28ba19ad4a0bfb83e13833e436ef381f322b4442776df885c320c", - "dist/2023-05-30/rustc-beta-i686-unknown-linux-gnu.tar.xz": "9ea5210272aba4d012cf195e9b36756987962700cc16911de6b17455f4fec37b", - "dist/2023-05-30/rustc-beta-loongarch64-unknown-linux-gnu.tar.gz": "fb3a38a21abc89987606fcf970a748ec007b4eac2a780c9bfc78a24855dd5068", - "dist/2023-05-30/rustc-beta-loongarch64-unknown-linux-gnu.tar.xz": "be03d9685ef05f5f0a5c4d2f5d1abbb4168703641c47bf449b8cead28c660b36", - "dist/2023-05-30/rustc-beta-mips-unknown-linux-gnu.tar.gz": "51f8f6efcfc6c09e41fb1c7bf49316650aa6fc4fba6765e9eb0f0da218a327ae", - "dist/2023-05-30/rustc-beta-mips-unknown-linux-gnu.tar.xz": "724ac99cebbc5dfa8e5ca2d9f32c0611f0df035b9dcd79861d9c8b6151f36d17", - "dist/2023-05-30/rustc-beta-mips64-unknown-linux-gnuabi64.tar.gz": "897e21ad58b01784523a18eb3e96286b956c3d62c3f8876f9831dc22543fa0f1", - "dist/2023-05-30/rustc-beta-mips64-unknown-linux-gnuabi64.tar.xz": "fc72123993f195910034bbc99c8099b473f77ed15345b2a2cc45669680a157b1", - "dist/2023-05-30/rustc-beta-mips64el-unknown-linux-gnuabi64.tar.gz": "be642818250e94732c1f989568ea96a35befdf3be8ef5a8136de40880b9a86bf", - "dist/2023-05-30/rustc-beta-mips64el-unknown-linux-gnuabi64.tar.xz": "fdb42ce19f669f5a38021abb3d88edacf0d6220dd18521aa0427f683ec1ef003", - "dist/2023-05-30/rustc-beta-mipsel-unknown-linux-gnu.tar.gz": "47540dea37ba2885dcf8ab3456ac0e0bd193f3b40f81ea425e6acf2559a573a5", - "dist/2023-05-30/rustc-beta-mipsel-unknown-linux-gnu.tar.xz": "dacbb89acdf4fc587e2cccde96b14c113637f6691c1f5857322dd98b148b442f", - "dist/2023-05-30/rustc-beta-powerpc-unknown-linux-gnu.tar.gz": "7cf4ab6c270bea85e065b26883350173f703e266ae865e753ea45ec53775e042", - "dist/2023-05-30/rustc-beta-powerpc-unknown-linux-gnu.tar.xz": "4e06df0b3820503d92a4ef4782cdea2ed95b60ac4efa75e1736b8dcf360e865e", - "dist/2023-05-30/rustc-beta-powerpc64-unknown-linux-gnu.tar.gz": "50e5879a296bd61545d0ed2558a28e328ad9eef6df906ec8a6ab17e98c4fc053", - "dist/2023-05-30/rustc-beta-powerpc64-unknown-linux-gnu.tar.xz": "76e3e8028b6c03ece804984d3df4baf995cd09e50bebacf038fe389133f77f25", - "dist/2023-05-30/rustc-beta-powerpc64le-unknown-linux-gnu.tar.gz": "45070a86b9efe5a885c67dbb089a219aa7adb5b9ae7a37d115a37f75833ee598", - "dist/2023-05-30/rustc-beta-powerpc64le-unknown-linux-gnu.tar.xz": "02e957f9078c32d0504e15a688cefd50850428b0dad4f748a55ccba2a738c826", - "dist/2023-05-30/rustc-beta-riscv64gc-unknown-linux-gnu.tar.gz": "2ee8579fc0acd71b7a0ec40efecd7bd298e24c0453821c85d502e7eff4820ea1", - "dist/2023-05-30/rustc-beta-riscv64gc-unknown-linux-gnu.tar.xz": "758e35e9a4f1fcda8cd110cae717542768acf9f7cfef38bf8d75480b2b2e25db", - "dist/2023-05-30/rustc-beta-s390x-unknown-linux-gnu.tar.gz": "d3c0fbd03833f28500403d8f7f196989fa83a0c493c7c74d435c1c201912ecea", - "dist/2023-05-30/rustc-beta-s390x-unknown-linux-gnu.tar.xz": "d2a8e1690a1420dc3f55d43d7b190cda605f46a82882990e74157b98793e4fed", - "dist/2023-05-30/rustc-beta-x86_64-apple-darwin.tar.gz": "6f3d3069dc85d3d7e533904f79ebfa00e2276896ba469b75461c833aa3a1ac7a", - "dist/2023-05-30/rustc-beta-x86_64-apple-darwin.tar.xz": "b6e3b9eb821f861eb3c9f5687595fb9a8007f09b230f8eb38223903783658632", - "dist/2023-05-30/rustc-beta-x86_64-pc-windows-gnu.tar.gz": "cad6269683cc3b08ae9c0dff61ea9cee963d0654aaf60caaa4294fd8592a08a8", - "dist/2023-05-30/rustc-beta-x86_64-pc-windows-gnu.tar.xz": "b4cc887327b822c0dc5efb5c14e7f0d4539860f75f2af5f24755479db84b436b", - "dist/2023-05-30/rustc-beta-x86_64-pc-windows-msvc.tar.gz": "f6c7cb74987f13219e62389f99a409e998a340ffdd37e59b990fa5a2209d0fd5", - "dist/2023-05-30/rustc-beta-x86_64-pc-windows-msvc.tar.xz": "06b3fc13a7a0b938026bddbd08babb5c005f6ece5384aadf265710983243d561", - "dist/2023-05-30/rustc-beta-x86_64-unknown-freebsd.tar.gz": "635dfded9a7f4637af3ba390906f48f01ae1b426658bd7a7e8276db38c77fb3a", - "dist/2023-05-30/rustc-beta-x86_64-unknown-freebsd.tar.xz": "f385fe29efd16b08d8f0a7c71450a7880d640992d762f941468ecf57d6d6cd35", - "dist/2023-05-30/rustc-beta-x86_64-unknown-illumos.tar.gz": "832780952af4ff0b23b52e0654a68e314354b3a7ad6594aede927956172857d2", - "dist/2023-05-30/rustc-beta-x86_64-unknown-illumos.tar.xz": "262c369de160013c9a226fbeb3f2f351355ac76c7aec3dc9c4e3b85bdee7259f", - "dist/2023-05-30/rustc-beta-x86_64-unknown-linux-gnu.tar.gz": "08ec1e016baa2772f97dc4f51bad2fba9a31f4e78435ae62d0dc19751a1d79e3", - "dist/2023-05-30/rustc-beta-x86_64-unknown-linux-gnu.tar.xz": "6708643e5941765593ab043de8ebde6488473ea870ba863a3192e1a738b17ae2", - "dist/2023-05-30/rustc-beta-x86_64-unknown-linux-musl.tar.gz": "64cadba75ace2843303aba0c71dc1dfe27a7fe5bcf6dcbd0ba852b6b4b09eac8", - "dist/2023-05-30/rustc-beta-x86_64-unknown-linux-musl.tar.xz": "8357a30ac45ad29724adb68db201f05b9257de0712ffef2562ae9bbc7e2376e5", - "dist/2023-05-30/rustc-beta-x86_64-unknown-netbsd.tar.gz": "fb7e20647326cd2a9672d58c37f3e140c0072877f3d0a7fdfa3f728c0e1763e4", - "dist/2023-05-30/rustc-beta-x86_64-unknown-netbsd.tar.xz": "6eafb794492243f1a5698f3516f5c5813a9b4014693e46d2fcc6a20de7d3a58e", - "dist/2023-05-30/rustc-nightly-aarch64-apple-darwin.tar.gz": "237b8472a6b69ad9a3d07f28a4c8db5558774777d5f049e73f3ee47daf0ba8ff", - "dist/2023-05-30/rustc-nightly-aarch64-apple-darwin.tar.xz": "2bdb744db0e37fe83763742b4fdc8d8892a46a25620485cf3ef0241278aca7cc", - "dist/2023-05-30/rustc-nightly-aarch64-pc-windows-msvc.tar.gz": "ed67050963449f6f2ef9e64de33281cf689511aee424f345941793fcccbd9197", - "dist/2023-05-30/rustc-nightly-aarch64-pc-windows-msvc.tar.xz": "b90717f1d715a4488cfb95036521f21fbcf5b9f0b1c488ef44ac7854acfc9210", - "dist/2023-05-30/rustc-nightly-aarch64-unknown-linux-gnu.tar.gz": "cc459d7779d32fcf51f24fc365806446bf4f3c2b4614e59181dd0696eab48f01", - "dist/2023-05-30/rustc-nightly-aarch64-unknown-linux-gnu.tar.xz": "e2420872b825bd3930c426b9fd876ef1660aa7558e661175c03f5b07c1f91208", - "dist/2023-05-30/rustc-nightly-aarch64-unknown-linux-musl.tar.gz": "e1f1b869afa2554b2ae4981eaccf35329314161c8f427484dfb45852e6dd7e66", - "dist/2023-05-30/rustc-nightly-aarch64-unknown-linux-musl.tar.xz": "9f0813f8fa69d2422f234fe78c3672cf229dcaeebbd8aad83cc1242b2033c012", - "dist/2023-05-30/rustc-nightly-arm-unknown-linux-gnueabi.tar.gz": "91a0bec37e3660f14be05799c4ff5241e7b0baee6d38bcc6aba446209b984d37", - "dist/2023-05-30/rustc-nightly-arm-unknown-linux-gnueabi.tar.xz": "fe2798b1d67928cb05525faa420241fddacf828a6ecd07ef6374605bbb6eb07a", - "dist/2023-05-30/rustc-nightly-arm-unknown-linux-gnueabihf.tar.gz": "3906c8a388e57687d1bf13dcc6e22a51bc1af46bcc6731215477b80a446129fe", - "dist/2023-05-30/rustc-nightly-arm-unknown-linux-gnueabihf.tar.xz": "b1f20ad4a1ea551e5e34aeb6a159e66da03bfb6a2814e0a1f44c1676b579361c", - "dist/2023-05-30/rustc-nightly-armv7-unknown-linux-gnueabihf.tar.gz": "69c08682db15fd941c843950811b0f367854a5f6bfeff17a810f5b2536063e2b", - "dist/2023-05-30/rustc-nightly-armv7-unknown-linux-gnueabihf.tar.xz": "3fa01eb5238dcde32a33183d2022f8f81eb8bdfc29af837e581ccac796add69f", - "dist/2023-05-30/rustc-nightly-i686-pc-windows-gnu.tar.gz": "71af89dd66588905acc5491f837da118570180176a6f6d485e3f5585cfa308b6", - "dist/2023-05-30/rustc-nightly-i686-pc-windows-gnu.tar.xz": "790ba712d9b4adcc6ae5d3735386909e942ea570152a10ab4b460de5df04a7d8", - "dist/2023-05-30/rustc-nightly-i686-pc-windows-msvc.tar.gz": "211744f84b1e1f184b3c868c971967d0af434135dbf5445826c4a291b67ba890", - "dist/2023-05-30/rustc-nightly-i686-pc-windows-msvc.tar.xz": "bf3699f00cdfa130563e524513bf5b227ebf67f5807c1206bc642e69b6acd515", - "dist/2023-05-30/rustc-nightly-i686-unknown-linux-gnu.tar.gz": "0a16de5d417bd0c2d548e9389615137dbca6ec0c9f77c48e57af5cecc446fd6e", - "dist/2023-05-30/rustc-nightly-i686-unknown-linux-gnu.tar.xz": "a621cec29e1199050f533c671949164fe608ce1a2639645dec09f7c3a662afa0", - "dist/2023-05-30/rustc-nightly-loongarch64-unknown-linux-gnu.tar.gz": "4e9dd9734ebf981cbbc116b0dc29ab69957e8ee746aa25f71abc33553db2dc6b", - "dist/2023-05-30/rustc-nightly-loongarch64-unknown-linux-gnu.tar.xz": "78b5580e81ee5b5f327be718fd09bd0711271a8bba52efff1cd4ce68c4f5cd4f", - "dist/2023-05-30/rustc-nightly-mips-unknown-linux-gnu.tar.gz": "889308ffa2f866dc34327c0f20195e33a3c1e8124a19635918b0a8e5220ea56d", - "dist/2023-05-30/rustc-nightly-mips-unknown-linux-gnu.tar.xz": "74da26ff0692a4cb1c84f3cd42c9a8c756cb588eaa40cfbfc6dbc9cbc5f018e9", - "dist/2023-05-30/rustc-nightly-mips64-unknown-linux-gnuabi64.tar.gz": "1aec9abde4a1e9e042191b06848d262848c54b448ddba00c9c736207953140b3", - "dist/2023-05-30/rustc-nightly-mips64-unknown-linux-gnuabi64.tar.xz": "a046b49cb6ec60ecaa8ed60f6c77b60b3d0cfa76cfd7e48b6b2a808e4d8a8e51", - "dist/2023-05-30/rustc-nightly-mips64el-unknown-linux-gnuabi64.tar.gz": "e6dfbe2df31c26d0df8ae413f41705039bc41f567dc8f4e81b9e908a61157d08", - "dist/2023-05-30/rustc-nightly-mips64el-unknown-linux-gnuabi64.tar.xz": "b4285b27d8ee3325ce4cc3755182d159376fbe93aa14d3adfeb06b5fb20ebdce", - "dist/2023-05-30/rustc-nightly-mipsel-unknown-linux-gnu.tar.gz": "62de5f6093791c80744267f492a0ba58f998f3e826933a396e21efba7e88ea1d", - "dist/2023-05-30/rustc-nightly-mipsel-unknown-linux-gnu.tar.xz": "3240f8ffa7bef40dfb2a19a1029a4b5733403c9cc94bcf7f0a66e0134e2b93fe", - "dist/2023-05-30/rustc-nightly-powerpc-unknown-linux-gnu.tar.gz": "49f9fa5a9d3c07365a29d0dd0ac94df9ef8c7f9713724a39ade6040bb1a4a627", - "dist/2023-05-30/rustc-nightly-powerpc-unknown-linux-gnu.tar.xz": "285b2c228c4a37dc6f5ced5c585631e2166b43c0b76bb794139f0aa690013a13", - "dist/2023-05-30/rustc-nightly-powerpc64-unknown-linux-gnu.tar.gz": "bcd1c9b4d1efd109bf29b2005f35931b92f9675ced5b71a6dcfb10bac1ed87af", - "dist/2023-05-30/rustc-nightly-powerpc64-unknown-linux-gnu.tar.xz": "7f61eef3681bb1bcc285910e596c4e11c62aca0ed1d7eb9de75fa0822ca89ecb", - "dist/2023-05-30/rustc-nightly-powerpc64le-unknown-linux-gnu.tar.gz": "278473fbd38e2d395257f90bc84010e44ade32cb35a249fa0d32e92c174e9776", - "dist/2023-05-30/rustc-nightly-powerpc64le-unknown-linux-gnu.tar.xz": "215a805efcfc898e3ae7cfeda427e10d252434175d8eb70613664ac84c1e38ff", - "dist/2023-05-30/rustc-nightly-riscv64gc-unknown-linux-gnu.tar.gz": "3ba38b376d5c58324221466dddc95ce0917f7bcf6a7cca8c187ff999abd8f74d", - "dist/2023-05-30/rustc-nightly-riscv64gc-unknown-linux-gnu.tar.xz": "d52cba02774a256db1cd40ef3c9fee10431f8ef9a738553373474bb629d8c108", - "dist/2023-05-30/rustc-nightly-s390x-unknown-linux-gnu.tar.gz": "4dca59e9d10f07e60bb8f522f4b97c2a8de8e186679bdc8e85a105bfba80c38d", - "dist/2023-05-30/rustc-nightly-s390x-unknown-linux-gnu.tar.xz": "e0d07c8f2605600d88d901dc2837c01266d28064f57e1ba7a3946a59a249b37d", - "dist/2023-05-30/rustc-nightly-x86_64-apple-darwin.tar.gz": "aef9c49ef3496a23567eef639f54131fd54fdedc092d39d89c7da8e41f97b100", - "dist/2023-05-30/rustc-nightly-x86_64-apple-darwin.tar.xz": "c78201af204ed99ae67c5f8747a1495b58e6a2b2c92a9290e703553c0fc4820a", - "dist/2023-05-30/rustc-nightly-x86_64-pc-windows-gnu.tar.gz": "70ff64b7f28be159fec7e518d3787e836c1a7f5a88177742215e46269a29b4aa", - "dist/2023-05-30/rustc-nightly-x86_64-pc-windows-gnu.tar.xz": "939bf932d60e2d343d4e00bbc48e10eb57755de14729795bd6965cf23eed74f5", - "dist/2023-05-30/rustc-nightly-x86_64-pc-windows-msvc.tar.gz": "e20748dcca42a84031bf2eae7a61d3b0619c383dca274287824a15c982b42bf3", - "dist/2023-05-30/rustc-nightly-x86_64-pc-windows-msvc.tar.xz": "4687e53fcbe7487647b876b36efca97f9b83389f35d317a76b601d43edd54c00", - "dist/2023-05-30/rustc-nightly-x86_64-unknown-freebsd.tar.gz": "c662f8f489ec8be2ed2066140a7b40ef92ac393103e2de43a683918ec81c3ab1", - "dist/2023-05-30/rustc-nightly-x86_64-unknown-freebsd.tar.xz": "b350dd8bd95563cf9a422bac6fd4ac44d21186324a9cda4998e5b676c9646b7e", - "dist/2023-05-30/rustc-nightly-x86_64-unknown-illumos.tar.gz": "18396eaa0c44555bfd550018671a4ca07a2c890e08ab8a6e71e224256f01bc61", - "dist/2023-05-30/rustc-nightly-x86_64-unknown-illumos.tar.xz": "97af9014bdd6b758b7dfaacc868f91c62729ddc70f6b766f78926d46098dc610", - "dist/2023-05-30/rustc-nightly-x86_64-unknown-linux-gnu.tar.gz": "9bb5775dce7c5659ba983c1581290f3d29cab54e2e28fbeb0a89b076bce24969", - "dist/2023-05-30/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz": "9a2bf45136801dbb04b2cb6f7db45b731ff38d9f285c55270a2399184a422e5e", - "dist/2023-05-30/rustc-nightly-x86_64-unknown-linux-musl.tar.gz": "355e65949a17cb71b582e3a3a51a4a68c25fa1f07c5d02604869d0e1a3e83274", - "dist/2023-05-30/rustc-nightly-x86_64-unknown-linux-musl.tar.xz": "afbd2923484621716ff241998b6c4c6c3d7023e00c1f1bf94ac15e3072c15c91", - "dist/2023-05-30/rustc-nightly-x86_64-unknown-netbsd.tar.gz": "d9d79bff98b3a5bd95aab8735a3656c494d2d275afbe313f1d1adececb82f1e0", - "dist/2023-05-30/rustc-nightly-x86_64-unknown-netbsd.tar.xz": "a92f1dea5d4f811bd81a297e6b45c5253948956fa835efcbfb3174ca45cbc812", - "dist/2023-05-30/rustfmt-nightly-aarch64-apple-darwin.tar.gz": "59b1ecc2a0cc0dd289f58e14ec8d812cba3906a486b53d991e9d61fb1aace497", - "dist/2023-05-30/rustfmt-nightly-aarch64-apple-darwin.tar.xz": "89c70ea18ce719c8171190cca97b3f5c641999ef54952b4f0f426c05c63af698", - "dist/2023-05-30/rustfmt-nightly-aarch64-pc-windows-msvc.tar.gz": "164378266ab65a8d6464e914ff2dca848d6f044362bc81c38b260e52e1856147", - "dist/2023-05-30/rustfmt-nightly-aarch64-pc-windows-msvc.tar.xz": "b44fdc2708def8e02cf7f39e228c6698c2e0eee217cc02d60ee731859826b544", - "dist/2023-05-30/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.gz": "0d34a3f499eb7d2819090c4b923df26462d12f6261327a03a3df61af3346467f", - "dist/2023-05-30/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.xz": "add3cde0b9771e78c35f9eae1d91fe1aec94e5b255e3d741c80916dabf23d214", - "dist/2023-05-30/rustfmt-nightly-aarch64-unknown-linux-musl.tar.gz": "95f05d6549a3618e49b1607a04f9814aa55cb393b8c662a67dbd0909b65d9e45", - "dist/2023-05-30/rustfmt-nightly-aarch64-unknown-linux-musl.tar.xz": "e4e8ab74aa90355142d16d677452a6b17b99fe2c26c3e7d19541c00d316a9a1c", - "dist/2023-05-30/rustfmt-nightly-arm-unknown-linux-gnueabi.tar.gz": "891fcd1496565388160c70030f098eae9725423a726d25cb95f81c8a5e9a7fd0", - "dist/2023-05-30/rustfmt-nightly-arm-unknown-linux-gnueabi.tar.xz": "330afd31d6ef259a73f365bd57c2c8cc27f972f475519b880065ef9bbbef4417", - "dist/2023-05-30/rustfmt-nightly-arm-unknown-linux-gnueabihf.tar.gz": "32087f3a53706c8daeea8ee80afb16e60968cd653404e7ed98322d998b83582d", - "dist/2023-05-30/rustfmt-nightly-arm-unknown-linux-gnueabihf.tar.xz": "e2fe133066904154fa773a4731efbf77d46631413b77beea6ecb8f3617b0dedb", - "dist/2023-05-30/rustfmt-nightly-armv7-unknown-linux-gnueabihf.tar.gz": "df28a8a4b90c71b9542f1327d3138d9b13caddd5bd7a3738b09aafa75480f20f", - "dist/2023-05-30/rustfmt-nightly-armv7-unknown-linux-gnueabihf.tar.xz": "c9dabd1e26f6c94e3a2162c02bd83cc6c80cf41f075d970480fd8fa6c94f170d", - "dist/2023-05-30/rustfmt-nightly-i686-pc-windows-gnu.tar.gz": "b3eaa34bc2441a227de9646a1f90480cb934592e919944e2feae31be0d048f1e", - "dist/2023-05-30/rustfmt-nightly-i686-pc-windows-gnu.tar.xz": "dd3efd26ddf45d4366fa6c6f024e0223329c378887b636be70d89951feeb223d", - "dist/2023-05-30/rustfmt-nightly-i686-pc-windows-msvc.tar.gz": "50c1f997d3b7b47f0eea36397252646fe97c484345afe3c08938915bf46b1286", - "dist/2023-05-30/rustfmt-nightly-i686-pc-windows-msvc.tar.xz": "8da362db734f58f99d3616b3a6d0e2e0976f634bc457143fd627993a2a43cd41", - "dist/2023-05-30/rustfmt-nightly-i686-unknown-linux-gnu.tar.gz": "bb6b790c57de3157370ec6dfb3d5c6a3e47d4a7f483d716c04ddeb6a1d370470", - "dist/2023-05-30/rustfmt-nightly-i686-unknown-linux-gnu.tar.xz": "e83bea6b615680a2d1aff31a0302fceefe970d4d801d61c76bb59d61e16235ba", - "dist/2023-05-30/rustfmt-nightly-loongarch64-unknown-linux-gnu.tar.gz": "3c45423d2fee0fb2218e80760910f0f3344f67cb867e746e2bc825f74a4dad35", - "dist/2023-05-30/rustfmt-nightly-loongarch64-unknown-linux-gnu.tar.xz": "c3fbb683e848927b800933799d93ce9f47e3712a650e0b2462830e91fd62ec2d", - "dist/2023-05-30/rustfmt-nightly-mips-unknown-linux-gnu.tar.gz": "f795bf82973e3d6ae90d5bfd17c3a2326dd91c787d5638fd5e0d3091fc2bd738", - "dist/2023-05-30/rustfmt-nightly-mips-unknown-linux-gnu.tar.xz": "404217de3ead2226ba192fc2ee3a9928653272dd1b05774ae735bdf2db9596e0", - "dist/2023-05-30/rustfmt-nightly-mips64-unknown-linux-gnuabi64.tar.gz": "f62319f4429680866c6c55c9928f864fcd478dd71b16909186aa9a14d6d4b4e6", - "dist/2023-05-30/rustfmt-nightly-mips64-unknown-linux-gnuabi64.tar.xz": "caf648cf2d71b67393ef068715f974f43aa6d80eb6a6040b31d496d64d31b12e", - "dist/2023-05-30/rustfmt-nightly-mips64el-unknown-linux-gnuabi64.tar.gz": "e11962a76505c523d210bafa0a87e10f09bf28350149a11091222678acef9b2b", - "dist/2023-05-30/rustfmt-nightly-mips64el-unknown-linux-gnuabi64.tar.xz": "daadb0973b1acded5fbc32ba2aa4974ff25ca2cd90afa5eaecdea51ef55bf154", - "dist/2023-05-30/rustfmt-nightly-mipsel-unknown-linux-gnu.tar.gz": "c501a1fd769e826eac68ba1bb14feb384236f7d87f5d3fe1d6f2373b0fb3f966", - "dist/2023-05-30/rustfmt-nightly-mipsel-unknown-linux-gnu.tar.xz": "c1af630b9367b3c93d5bec0a5b4d7c3befa0d3036ca3fdd5d453b04bb74e239c", - "dist/2023-05-30/rustfmt-nightly-powerpc-unknown-linux-gnu.tar.gz": "cbda874bd604c078fe023a3c4dd480cc537a3dfdf0bc5eb8f55a1e5a21691915", - "dist/2023-05-30/rustfmt-nightly-powerpc-unknown-linux-gnu.tar.xz": "d795e96e1303d1a0057aabc079b0258a54361bdcf2359b2c096966098e950e57", - "dist/2023-05-30/rustfmt-nightly-powerpc64-unknown-linux-gnu.tar.gz": "5b699b2d9c77548d4ada3847996e0f4cf94446cb553ad9447aca2673e99c4948", - "dist/2023-05-30/rustfmt-nightly-powerpc64-unknown-linux-gnu.tar.xz": "39d7f7df56f1c5a92b41ad2e40ab570bee861006cdf9b93aa11b967906c60828", - "dist/2023-05-30/rustfmt-nightly-powerpc64le-unknown-linux-gnu.tar.gz": "c745fd0580669e901d56e81050b6447e4cf7743da32e6ea95607511d9c3201d1", - "dist/2023-05-30/rustfmt-nightly-powerpc64le-unknown-linux-gnu.tar.xz": "b360a343cb0f9e36ca9fe03d77047d600a16907416fa1e5c0cb7a4611fc5c3f2", - "dist/2023-05-30/rustfmt-nightly-riscv64gc-unknown-linux-gnu.tar.gz": "5a98c28cc95008522ace67fd15a9e5d71b1b969f0ec2410aaadfeda618aed1be", - "dist/2023-05-30/rustfmt-nightly-riscv64gc-unknown-linux-gnu.tar.xz": "5197422b4ef7ce51777c020f74a5fb7edc01339fcb9b31bbf9781195639794fa", - "dist/2023-05-30/rustfmt-nightly-s390x-unknown-linux-gnu.tar.gz": "6f6acce9edb006b355770f3934eba4c15b10f205164e49c587b6f9e60924ed99", - "dist/2023-05-30/rustfmt-nightly-s390x-unknown-linux-gnu.tar.xz": "1e1ebec2d56706f37afaaa23ed940e8953b5207280e83bfd0acce4a149416911", - "dist/2023-05-30/rustfmt-nightly-x86_64-apple-darwin.tar.gz": "c1ea49dac64b7872dd194db925cda89efa596808d993dedacc8be042d529c2de", - "dist/2023-05-30/rustfmt-nightly-x86_64-apple-darwin.tar.xz": "ddf1cd4e32ce497187f79f34edf346f6db31e9d50d2cf1870fc1f2edfbadbcdd", - "dist/2023-05-30/rustfmt-nightly-x86_64-pc-windows-gnu.tar.gz": "cb5d566d5b6dc6f94cd7015ad1d8074edc0fdff67e4099df7adaf0251f729d8d", - "dist/2023-05-30/rustfmt-nightly-x86_64-pc-windows-gnu.tar.xz": "086ef160c92e5c3eaf887b2f28d54562e7916be4758b7b9798019f5aa23f02b1", - "dist/2023-05-30/rustfmt-nightly-x86_64-pc-windows-msvc.tar.gz": "5447f33f134487147df663680741f94e2d58c45495dee33e16052bacf74975de", - "dist/2023-05-30/rustfmt-nightly-x86_64-pc-windows-msvc.tar.xz": "78104f5ecb2ac790c3958a5331316580991c7a03f1258a72b7c43f660f955461", - "dist/2023-05-30/rustfmt-nightly-x86_64-unknown-freebsd.tar.gz": "e3da153242be44fd656f4bfe33371cf7b874e220698cedac207f14ce790c7a66", - "dist/2023-05-30/rustfmt-nightly-x86_64-unknown-freebsd.tar.xz": "cc9c83b6dade84d6dcf390701d7cbd2613915d9af68b08e68b9ff1d72e742248", - "dist/2023-05-30/rustfmt-nightly-x86_64-unknown-illumos.tar.gz": "e0d3aeb40a6139c56000d5b8a8693aafad105d05ccb8cebb026e383da59baae6", - "dist/2023-05-30/rustfmt-nightly-x86_64-unknown-illumos.tar.xz": "96981188f60cf8dc05a6b39788f0348b57d3972961b0a2d0b5759dbfc4c7d345", - "dist/2023-05-30/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.gz": "dfed96134506c80e8c503719c7502310b17bee6d3c963764af9dc70c5721795f", - "dist/2023-05-30/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz": "36fb2a16bba51b765be6c82b57fccc6664699d3e476d7cd3d56c71b80c6f2c78", - "dist/2023-05-30/rustfmt-nightly-x86_64-unknown-linux-musl.tar.gz": "b0ea71d0f3fb18f95fe0801261ff28e9b25ff9078d8cf1c2122ac515841af2ee", - "dist/2023-05-30/rustfmt-nightly-x86_64-unknown-linux-musl.tar.xz": "9f03b6aab46560698e507796541d0c0347c5bffb4fb984ea6c7dc73f479c8d81", - "dist/2023-05-30/rustfmt-nightly-x86_64-unknown-netbsd.tar.gz": "0c473e1e4cd1b8096e03f10d13f8e640e88a002ec798790c7423074ff49168c8", - "dist/2023-05-30/rustfmt-nightly-x86_64-unknown-netbsd.tar.xz": "6da959be0b1c6d1fb6e56ad88672ee817b8827b8210cefd897e5aca085b2c32d" + "dist/2023-07-12/cargo-beta-aarch64-apple-darwin.tar.gz": "2abd085e1805419ca8ae0227f7f974790beac8f4f0dcfaa6e57857f6b79a96b3", + "dist/2023-07-12/cargo-beta-aarch64-apple-darwin.tar.xz": "f28bfa89ae8b20a06a90fcb2a34840a8473c504986742ff111e4c0722507ce35", + "dist/2023-07-12/cargo-beta-aarch64-pc-windows-msvc.tar.gz": "50206cd7b01c9f978f433660c30de8b3f8799eb19ef371e88236065719732322", + "dist/2023-07-12/cargo-beta-aarch64-pc-windows-msvc.tar.xz": "6359961e60f32569af03bdddc0e6e996f0b22d124a3c21272a44c0e1cd5ce414", + "dist/2023-07-12/cargo-beta-aarch64-unknown-linux-gnu.tar.gz": "be5e354a88c9ca8cb696d7383670279d8933f1bf4bf1599a5c4f17d884b05707", + "dist/2023-07-12/cargo-beta-aarch64-unknown-linux-gnu.tar.xz": "6180ee4c1087044ba9e1c7b8ddc289b75824e34ed88dd153b63ee8674d8b3405", + "dist/2023-07-12/cargo-beta-aarch64-unknown-linux-musl.tar.gz": "9632cff665c36d62eeae355e9322c3bea2bc09efd6fadf49dca603bd54545c6f", + "dist/2023-07-12/cargo-beta-aarch64-unknown-linux-musl.tar.xz": "b91560ef397310ffd96179201b696b8eeb4713787174b37517aa043690740dbc", + "dist/2023-07-12/cargo-beta-arm-unknown-linux-gnueabi.tar.gz": "d0654b7f734262cd7d6bb8924a063f9f48f2510f8a5a58d050efba90fde40204", + "dist/2023-07-12/cargo-beta-arm-unknown-linux-gnueabi.tar.xz": "6271ded5e5e50697626d67f0d6faa54f0d0daa6aa61a3e98354c62a74f1bb87e", + "dist/2023-07-12/cargo-beta-arm-unknown-linux-gnueabihf.tar.gz": "6a9b804c6217f8a76d72fc10a7b9566d00c36dff5eb9df238c56bc7d26b4f0d0", + "dist/2023-07-12/cargo-beta-arm-unknown-linux-gnueabihf.tar.xz": "f2b67e0a7bd0b304f89e4b938c46c7551f34f40d87f0909a07363fcd903ab3b9", + "dist/2023-07-12/cargo-beta-armv7-unknown-linux-gnueabihf.tar.gz": "c0fbf9d4d7638dc4ae6cc5d136a69cbce0ec5c3c31bd8103a6e2783c27690b0d", + "dist/2023-07-12/cargo-beta-armv7-unknown-linux-gnueabihf.tar.xz": "cb67aea7aa1295d5bdfbfde784300b779a7bc350af864bc2ee8d7b268648c6e5", + "dist/2023-07-12/cargo-beta-i686-pc-windows-gnu.tar.gz": "4a4bfb185e226d1b6c310fc25ff5b13bab088fa4d98425b90878aa0446ee22bf", + "dist/2023-07-12/cargo-beta-i686-pc-windows-gnu.tar.xz": "d265ad80a372223d9c99a1d3232d379287d847ea1c3afde29f320d3950198e9b", + "dist/2023-07-12/cargo-beta-i686-pc-windows-msvc.tar.gz": "6c566bdb668e6ac7b068c285b7fe2e3cf7d0f4f065663165f2a9e4256b78e4cf", + "dist/2023-07-12/cargo-beta-i686-pc-windows-msvc.tar.xz": "c70d668d38fe9946a887ab18bb08ca74d2a8e36f6ead9d78deae55b532abef34", + "dist/2023-07-12/cargo-beta-i686-unknown-linux-gnu.tar.gz": "82d996b76d6ce55d64c82a33d3278c609bcbbef854c94d98cd4c5290958d542f", + "dist/2023-07-12/cargo-beta-i686-unknown-linux-gnu.tar.xz": "cf06a97a9e60e8936482da06a659f3eb4133d0ea3b5498e45b160fbd513e3d2e", + "dist/2023-07-12/cargo-beta-loongarch64-unknown-linux-gnu.tar.gz": "816c8112da3efdc27e8930944a6560ae8e8597755af22d8af4b2bbe910f08a93", + "dist/2023-07-12/cargo-beta-loongarch64-unknown-linux-gnu.tar.xz": "c59fc50e68d9d2afbc725ea420db701593bfa074abd7b97e3c7dfc676e0647b0", + "dist/2023-07-12/cargo-beta-powerpc-unknown-linux-gnu.tar.gz": "d7327116f5fc8ab665fdb086fda93af287de6ff91c2762e1867b0e40acda231a", + "dist/2023-07-12/cargo-beta-powerpc-unknown-linux-gnu.tar.xz": "24ec8fd09995c20e216b071c86405b0e3a1cd038c66700b47321188d09cb83a0", + "dist/2023-07-12/cargo-beta-powerpc64-unknown-linux-gnu.tar.gz": "f937ff68855c59bafb3412761cf8f6a0c0d91c9729000a4ea58eed53569803b3", + "dist/2023-07-12/cargo-beta-powerpc64-unknown-linux-gnu.tar.xz": "b51d94d00ce0af91a8abe2ea152b2331689fc1799d212c11ac4ca0fc4dca652c", + "dist/2023-07-12/cargo-beta-powerpc64le-unknown-linux-gnu.tar.gz": "5ed88bc49511d1e2496eab00ef4ea5677868113e83aac6e1e61fdb5b9f56f1b5", + "dist/2023-07-12/cargo-beta-powerpc64le-unknown-linux-gnu.tar.xz": "a5b9594e97947abba39877fb0e99bf329d5447e7a7d557dab994c24e381ced12", + "dist/2023-07-12/cargo-beta-riscv64gc-unknown-linux-gnu.tar.gz": "c269533aeec8a1cdc25e3a3057ea8c9da571d7f3617cba9f1fe0c4193ab38f70", + "dist/2023-07-12/cargo-beta-riscv64gc-unknown-linux-gnu.tar.xz": "7094f76b4f7d1d1d34a5214b531ccecca4b2ad09fb23b534d334bece2718c78c", + "dist/2023-07-12/cargo-beta-s390x-unknown-linux-gnu.tar.gz": "012a515e3acab001cd72ef38144edd0372a6d813912990dc5409f340bd4856e8", + "dist/2023-07-12/cargo-beta-s390x-unknown-linux-gnu.tar.xz": "fceb8dc2356b8dfa4009e60d8a0742c940553beed385a0b6ba1526fc329f36cc", + "dist/2023-07-12/cargo-beta-x86_64-apple-darwin.tar.gz": "5dd74b549dd46809b8f56d8ed5052303bd64b14f5583bc89379624f6a22836b4", + "dist/2023-07-12/cargo-beta-x86_64-apple-darwin.tar.xz": "f0b33f85cd5585e272a90736e3d188d7f53886a97a75aaae5f4d6dda85867baa", + "dist/2023-07-12/cargo-beta-x86_64-pc-windows-gnu.tar.gz": "be049bb6fc3f7b079b425ecd8fcbeae3cae29c8a32a290f70d5f2a7522d67b87", + "dist/2023-07-12/cargo-beta-x86_64-pc-windows-gnu.tar.xz": "b04f7c83691abcefb5fb985013ec8d98fe4ce773d0b3291127efb1b00a7ab08e", + "dist/2023-07-12/cargo-beta-x86_64-pc-windows-msvc.tar.gz": "c1b853dec72570534a64c7f94e0008057a2365b0f060d17b84bdef19080b6bbb", + "dist/2023-07-12/cargo-beta-x86_64-pc-windows-msvc.tar.xz": "146d305a0fc14a1b7bb6586dd3130d09b72d2497ddbc10c3e739444bded037ca", + "dist/2023-07-12/cargo-beta-x86_64-unknown-freebsd.tar.gz": "235948cf05dcfef80e21e66f5b08ddab18eb8f14b2ea8fcbeed22cdad8611868", + "dist/2023-07-12/cargo-beta-x86_64-unknown-freebsd.tar.xz": "28008794b923bb103f46a0a24bf66ce5f43a647ed5b4fefc649b8734a2f80ffb", + "dist/2023-07-12/cargo-beta-x86_64-unknown-illumos.tar.gz": "7d6a9f53a0e5758e7155c7cba0385c6ab7e0cee7f98a62172c108dca909a2188", + "dist/2023-07-12/cargo-beta-x86_64-unknown-illumos.tar.xz": "3314f50099b488cd027074241bde9fa0a12a6ca6f14afa9f0db5dd62080c318c", + "dist/2023-07-12/cargo-beta-x86_64-unknown-linux-gnu.tar.gz": "2632324d31641f783528bbfa98b6b16738d4ba59933a7919360bde5279092c5a", + "dist/2023-07-12/cargo-beta-x86_64-unknown-linux-gnu.tar.xz": "0057a55a30c38002b03c032a0f742dd326236f25b67b3c3d791661ef6f653c1b", + "dist/2023-07-12/cargo-beta-x86_64-unknown-linux-musl.tar.gz": "03b787105749e431e1c043fe7e019984a602a6a7ec382f78e1b960a5fe7466d9", + "dist/2023-07-12/cargo-beta-x86_64-unknown-linux-musl.tar.xz": "5ccf1875d484d41a8e6828f4c96d1915c644e99369dae73a161fd10a97937ff6", + "dist/2023-07-12/cargo-beta-x86_64-unknown-netbsd.tar.gz": "2df957be57157dc20ee4ec1434c5c8ef57b2f61d9ca681510f9cac397cd31f8d", + "dist/2023-07-12/cargo-beta-x86_64-unknown-netbsd.tar.xz": "5cecc38b971653fc6ae1f393080723350dde6e17597f2da6bb76788f23402bf4", + "dist/2023-07-12/rust-std-beta-aarch64-apple-darwin.tar.gz": "e6008a3c5b826be78f6dbde565c0b148339d7e37bec0adde575e91a065903955", + "dist/2023-07-12/rust-std-beta-aarch64-apple-darwin.tar.xz": "735118e8d1ab40d504e345e0b5d844b90d0b04689ff4f5dda9c6f141944eb9af", + "dist/2023-07-12/rust-std-beta-aarch64-apple-ios-sim.tar.gz": "7b930f3a915d98be424d7ccde639f0350cdfb97422367b8a336f5688704ecf35", + "dist/2023-07-12/rust-std-beta-aarch64-apple-ios-sim.tar.xz": "4dd1e2ff92a85a76108d2f90b37245f7851c214454386aed053b528a31d0f46b", + "dist/2023-07-12/rust-std-beta-aarch64-apple-ios.tar.gz": "8415958461754cb3f9e86e9f47f2bbd26395e89a9bbbc21dbc54572a59c72b24", + "dist/2023-07-12/rust-std-beta-aarch64-apple-ios.tar.xz": "e88fd506a62568b49a5be056e9aeb4a9db6833216cf68adafc24769b0942eb4a", + "dist/2023-07-12/rust-std-beta-aarch64-linux-android.tar.gz": "41489a5701378265ace4a15b7ea9107fc5579c0bc3967e075e4c8769d3b0ac61", + "dist/2023-07-12/rust-std-beta-aarch64-linux-android.tar.xz": "86bb3088f26f3fd9c83220ea6d39135fc002d36696dc15c56d754065b13105c3", + "dist/2023-07-12/rust-std-beta-aarch64-pc-windows-msvc.tar.gz": "621bfd6e6253f35fe78321f3f8f45cd2fb0e290502f4b659d75b9e401a5b06da", + "dist/2023-07-12/rust-std-beta-aarch64-pc-windows-msvc.tar.xz": "2fb251d461489dfa8721ef12ff212aa77fc9a0a6e6952c22cdb8ff36eee39fe2", + "dist/2023-07-12/rust-std-beta-aarch64-unknown-fuchsia.tar.gz": "879f1ab511497baeb614d263e6bcb105bd084c8aa190ffbdd565fd14c87c7a48", + "dist/2023-07-12/rust-std-beta-aarch64-unknown-fuchsia.tar.xz": "c40816547ad6ecac58c13c21540239c7ba87b4970a2bbc2f3d9c64aef1f22f82", + "dist/2023-07-12/rust-std-beta-aarch64-unknown-linux-gnu.tar.gz": "d53b23527d184087adb14574b4a1f2a4e1fa387a271c080af2c7aa96c0ef2033", + "dist/2023-07-12/rust-std-beta-aarch64-unknown-linux-gnu.tar.xz": "7122261bd5a72b8426d2325a88fda0983e24cf58882c24eea85ab9f8861fecf7", + "dist/2023-07-12/rust-std-beta-aarch64-unknown-linux-musl.tar.gz": "6b5326823ce3564f9f67db5d9193349df8001adec9849b7bdf01ea06b342f5b3", + "dist/2023-07-12/rust-std-beta-aarch64-unknown-linux-musl.tar.xz": "10a89967e1600ac7e857715c9d61991710b88dfa3da8b117fc5be2c2fac26859", + "dist/2023-07-12/rust-std-beta-aarch64-unknown-none-softfloat.tar.gz": "ddd5ed0c6aa3499f40e9ce18a43627f8e1f33be3ac056d109045d2df65128cca", + "dist/2023-07-12/rust-std-beta-aarch64-unknown-none-softfloat.tar.xz": "c6c61e5e2fe43ade33fb21683d382d4f101071e14dd18f4dec5b16b792b35850", + "dist/2023-07-12/rust-std-beta-aarch64-unknown-none.tar.gz": "1cff4acc6b0889450c00a67dec433f274c6f141bd047ff530f573d46a3bcaaff", + "dist/2023-07-12/rust-std-beta-aarch64-unknown-none.tar.xz": "1528aada81564d7359bc80f6c15e98e29d1685057ba83e57ef59952e870a1042", + "dist/2023-07-12/rust-std-beta-aarch64-unknown-uefi.tar.gz": "e2e2fc8f4b037fda67a80024b6fe73f5b616376b4def317ccd6e78e2b4776859", + "dist/2023-07-12/rust-std-beta-aarch64-unknown-uefi.tar.xz": "3ecfd0f3ecbd2bb5e4bbed886d127fa33893360f898041a384afef4629693dbd", + "dist/2023-07-12/rust-std-beta-arm-linux-androideabi.tar.gz": "0be665812e347a20cc097918e362904088afcc8b45c741b1da29f9e991d9c3d0", + "dist/2023-07-12/rust-std-beta-arm-linux-androideabi.tar.xz": "9a65ff8ec3a03afd1cf5bba933eaa602e3e9f29a003be9f8835b21c2e5b8d26a", + "dist/2023-07-12/rust-std-beta-arm-unknown-linux-gnueabi.tar.gz": "5e1387faf662f7c227b075cc5b860f064864a1ebd1ce85ab5840fb136f38ff69", + "dist/2023-07-12/rust-std-beta-arm-unknown-linux-gnueabi.tar.xz": "4bb9dc22d45b34620120ab5f4aacd2799181f4bb006f40a83cead84b582ed669", + "dist/2023-07-12/rust-std-beta-arm-unknown-linux-gnueabihf.tar.gz": "d7996b74fe236e453bff636361389f6183194784f4b997d144fd456d4b55257e", + "dist/2023-07-12/rust-std-beta-arm-unknown-linux-gnueabihf.tar.xz": "578a99158925d329a57b74d82524d3c97fef1d9a801c39f5b03366aa60d217a6", + "dist/2023-07-12/rust-std-beta-arm-unknown-linux-musleabi.tar.gz": "a02bbe42972483d2ff5b26e1948f9d5d3c9512019f5cba0514b57a248847afc3", + "dist/2023-07-12/rust-std-beta-arm-unknown-linux-musleabi.tar.xz": "37fcc7982aabbd77c76f1886feaac1fc87fc4a1ad35edb80a5be381c88f65125", + "dist/2023-07-12/rust-std-beta-arm-unknown-linux-musleabihf.tar.gz": "52622b53c8fa0d16090d59543432e7d531f7eb6812730b79aeb96a8d1c993290", + "dist/2023-07-12/rust-std-beta-arm-unknown-linux-musleabihf.tar.xz": "a5af3735e6337c79c45a1b0d538c3627cd89ddd4d5d40d75e711d86004dbfe8b", + "dist/2023-07-12/rust-std-beta-armebv7r-none-eabi.tar.gz": "8fd0e463083548198255142e617a726f2b6a055665e534755e8b879e420041fc", + "dist/2023-07-12/rust-std-beta-armebv7r-none-eabi.tar.xz": "2b407208e51a8f3f82ede1a98ec33d12345f3c7f2ae1ddf25232dcd30aca915e", + "dist/2023-07-12/rust-std-beta-armebv7r-none-eabihf.tar.gz": "57ea6af7f77135d9f5d8541139caa562d8901a167e77e3de0a75b427090a60ce", + "dist/2023-07-12/rust-std-beta-armebv7r-none-eabihf.tar.xz": "7a14e34060161073191d858c2450b5dd69d827261c6fc5f56a003753232bec32", + "dist/2023-07-12/rust-std-beta-armv5te-unknown-linux-gnueabi.tar.gz": "03d0ba0d24e07788aa7fb9c85515f82a697fb224a52a904f96970f8f329849e1", + "dist/2023-07-12/rust-std-beta-armv5te-unknown-linux-gnueabi.tar.xz": "fb55245b1c7e6f074d8120d7b28e25a6882a3ef8c8afe4c7601078f385644eda", + "dist/2023-07-12/rust-std-beta-armv5te-unknown-linux-musleabi.tar.gz": "d1fb9a2001db3060ceb6d6deb0e0f35db7da5d47b0d174c2f4d5ba9a82ad22f1", + "dist/2023-07-12/rust-std-beta-armv5te-unknown-linux-musleabi.tar.xz": "8e0ec621b890b455988a931bc8eabc96840faf2fc7b311776aa06a1b55a4f554", + "dist/2023-07-12/rust-std-beta-armv7-linux-androideabi.tar.gz": "96d01a8dc88041d804e33fcca5d64ca10503a855a394606533aacc1e142289e1", + "dist/2023-07-12/rust-std-beta-armv7-linux-androideabi.tar.xz": "75c42686a8f379f19971235855e24ae7ce0b5d91768c00532857d304f45e5cef", + "dist/2023-07-12/rust-std-beta-armv7-unknown-linux-gnueabi.tar.gz": "a097e5fdd835551e969c4e1d6cf767633d79101709362a9a26d3056bf8ecd32c", + "dist/2023-07-12/rust-std-beta-armv7-unknown-linux-gnueabi.tar.xz": "f056e2c6cbb40ba34598a60901c959b828d086a84ceba03f9eaa3d7f48b7c6c6", + "dist/2023-07-12/rust-std-beta-armv7-unknown-linux-gnueabihf.tar.gz": "1995003b8ef8ee5dbee66d46a1233d6fe0182ccb6b9c14c976cc40e5099324ef", + "dist/2023-07-12/rust-std-beta-armv7-unknown-linux-gnueabihf.tar.xz": "08d9e6293cd3a89d6e42b0939c668a58ac010603fd4eee9775dde468a33bd0dd", + "dist/2023-07-12/rust-std-beta-armv7-unknown-linux-musleabi.tar.gz": "092d13520760e9540663ffc08e17be223a815e2dd7c0899033fe6676edb74264", + "dist/2023-07-12/rust-std-beta-armv7-unknown-linux-musleabi.tar.xz": "9e7d6923f8c90c779767eb40a55ef958420737679a5065e2a5ca49a6e34dacc5", + "dist/2023-07-12/rust-std-beta-armv7-unknown-linux-musleabihf.tar.gz": "c232cde2921c0c2d1a0f8fab64ddcae2b7dd7ed5cbf180370ece302949826a88", + "dist/2023-07-12/rust-std-beta-armv7-unknown-linux-musleabihf.tar.xz": "7681e242675bb765a1aacd3c8ebc6894eeb709ce7d85e5ff94cd63e52eb4e989", + "dist/2023-07-12/rust-std-beta-armv7a-none-eabi.tar.gz": "4a777b4a7e8b157d78aaab73ae4e9185821a7887dbad68612db3b5bd7428729b", + "dist/2023-07-12/rust-std-beta-armv7a-none-eabi.tar.xz": "d823b49c8d4b2615223b68cf6b6ac22836551aa5c1df0f68e1336c2be7ffe7ec", + "dist/2023-07-12/rust-std-beta-armv7r-none-eabi.tar.gz": "12e8242d480dc45108e615cb5625a07b77054a88fff72dce51c313e57a3ec8ef", + "dist/2023-07-12/rust-std-beta-armv7r-none-eabi.tar.xz": "0cef6562f5ee0850fdfbf0be00e18a5643a951d169df00b4e068c932fe04b048", + "dist/2023-07-12/rust-std-beta-armv7r-none-eabihf.tar.gz": "71818e3855455bf6cc3fc2f04b7ebbf95e32f28f636d08d9513ab1be88aece49", + "dist/2023-07-12/rust-std-beta-armv7r-none-eabihf.tar.xz": "b4bcb177e8fb157e50b93e07144889127b218804ede359d542ccdb0a0fc8a4a0", + "dist/2023-07-12/rust-std-beta-asmjs-unknown-emscripten.tar.gz": "d16b2accc56ee37e2e527e0371a689530d30a6ff316bbb85664710419a5effca", + "dist/2023-07-12/rust-std-beta-asmjs-unknown-emscripten.tar.xz": "6b828e1b7941d6a9ed085051c378227c99ebc5b4899dfd222c368b2edaa6f7fd", + "dist/2023-07-12/rust-std-beta-i586-pc-windows-msvc.tar.gz": "d35e870fb7cda230cebf82d6e4241f0535e534c861fed1a5158f47f8a18bb33b", + "dist/2023-07-12/rust-std-beta-i586-pc-windows-msvc.tar.xz": "36404cc649e16efbdf0fb6afdf2130af1ab46618ee8130c431370be618d7e182", + "dist/2023-07-12/rust-std-beta-i586-unknown-linux-gnu.tar.gz": "682e74d110324cf0f53121f7b8ef0bd6e5bc355b2fd1d2eb183bee85d26a3bf0", + "dist/2023-07-12/rust-std-beta-i586-unknown-linux-gnu.tar.xz": "1ea30b0d14e7a5a82aee09b8e4ba87856158b31ec6b83e77929e2e9784698d43", + "dist/2023-07-12/rust-std-beta-i586-unknown-linux-musl.tar.gz": "b83d3652bd440b91ab2b145cd0ea3108203ccaa9beeea099220cd76d92a7f64f", + "dist/2023-07-12/rust-std-beta-i586-unknown-linux-musl.tar.xz": "ab78b6ca9136606d48afe42ce32e5a96cc07d4ea61856a500a9c7dd837983288", + "dist/2023-07-12/rust-std-beta-i686-linux-android.tar.gz": "5522933a886774ef4c490a8d928834d35c5a31b9066a8ec3b9b80de7d121dc37", + "dist/2023-07-12/rust-std-beta-i686-linux-android.tar.xz": "896cf7f6b611b676d40c9c20aafed11d7746a349a55658d03a8c6d197595006d", + "dist/2023-07-12/rust-std-beta-i686-pc-windows-gnu.tar.gz": "bcf7eca5717e3643a4f6a1ca4412bbf0466c0ffe0075eda441a0ed9060b0aacc", + "dist/2023-07-12/rust-std-beta-i686-pc-windows-gnu.tar.xz": "89fe6ed9068cb187eeb8c372dc04b7a10d6c9289d2374f0c59eaf6234fbd438b", + "dist/2023-07-12/rust-std-beta-i686-pc-windows-msvc.tar.gz": "8d381d2b4370a454793e66828e75a006093277e890d38e7e94582f094c390539", + "dist/2023-07-12/rust-std-beta-i686-pc-windows-msvc.tar.xz": "25f0bb9b88de1d2f54d1b42a23569dbcab7b37885f2b8a78665739352af9fbf7", + "dist/2023-07-12/rust-std-beta-i686-unknown-freebsd.tar.gz": "435e26724e1799d2330e4d5262ba2995c46d601917fa3d1e0afefe989903eebe", + "dist/2023-07-12/rust-std-beta-i686-unknown-freebsd.tar.xz": "87afb9db4d7f02e23ab7531fa57c574fedbf2b6232260006b59ef40bca15e06b", + "dist/2023-07-12/rust-std-beta-i686-unknown-linux-gnu.tar.gz": "ceb59a15be998cb908f1a59460475b569e02bedab180396713e0d8418d55c909", + "dist/2023-07-12/rust-std-beta-i686-unknown-linux-gnu.tar.xz": "3fcb9e8f60eeeba76558976ff06cdfd5ecbf2294c603af2398e044d2e04429e8", + "dist/2023-07-12/rust-std-beta-i686-unknown-linux-musl.tar.gz": "c6a77d8f3c9eb6ce6e91a7e8fad8fba84c8b13f4bce9e565a65b01f307c005ac", + "dist/2023-07-12/rust-std-beta-i686-unknown-linux-musl.tar.xz": "b01833d247e906c8b1e4c0c9ca5b4c37dd4166824693cc6d4a85ab881e482854", + "dist/2023-07-12/rust-std-beta-i686-unknown-uefi.tar.gz": "1ffc65c298d91782a9f2b772f82e411d8e164e0a245b1eb0e2f81382f378076d", + "dist/2023-07-12/rust-std-beta-i686-unknown-uefi.tar.xz": "68b511d1a3685ea45644a0d40f5b456cef34ba48719947789f7330984a027699", + "dist/2023-07-12/rust-std-beta-loongarch64-unknown-linux-gnu.tar.gz": "0cd83da690cb1870b77c918f029273cced0d03f204fa42c4eec8930e6fcea8ba", + "dist/2023-07-12/rust-std-beta-loongarch64-unknown-linux-gnu.tar.xz": "9e215a989ed9e2f1c4581c1f38c475564b46f6b90dde91b63b88290cb7866a48", + "dist/2023-07-12/rust-std-beta-mips-unknown-linux-musl.tar.gz": "e66d3f598c38536f2db2e42b8b231acddc04c3edbb017d37adfd77a3378bf6c3", + "dist/2023-07-12/rust-std-beta-mips-unknown-linux-musl.tar.xz": "f030f5412e912004239febcb88c8fc489a7d35b95c02b750ba582a7ff895b79a", + "dist/2023-07-12/rust-std-beta-mips64-unknown-linux-muslabi64.tar.gz": "903649d2da11a054ffbeb440beb5c0f668bbc4a3c8f931a47b559659aba0eacd", + "dist/2023-07-12/rust-std-beta-mips64-unknown-linux-muslabi64.tar.xz": "ef1656bf4bd5b1fb90fdd1348808b81fb4b6da470966864ba823979890a1bb31", + "dist/2023-07-12/rust-std-beta-mips64el-unknown-linux-muslabi64.tar.gz": "e2f37ad36fb7ec9d15a85c467ffb1af69a14f8a073a105e0341c5bf7f2feaa13", + "dist/2023-07-12/rust-std-beta-mips64el-unknown-linux-muslabi64.tar.xz": "fcd15fe90bfb887fef0a83d1371283a965edfef029924d060ea4775be83669ce", + "dist/2023-07-12/rust-std-beta-mipsel-unknown-linux-musl.tar.gz": "8025e30f46c2f350a028c32be6b07472b40ce0dce8b4339753eeee391ff1639e", + "dist/2023-07-12/rust-std-beta-mipsel-unknown-linux-musl.tar.xz": "430eba57898d01285ae9b4351e5fca4179d638501b8004a559b2aec9daeaac20", + "dist/2023-07-12/rust-std-beta-nvptx64-nvidia-cuda.tar.gz": "f87733ff046a233cb9e68793dc3fbdf04cf8f639d1ec8e80f78d495dd168ab9f", + "dist/2023-07-12/rust-std-beta-nvptx64-nvidia-cuda.tar.xz": "d5756b6d7852bfe305283ac59cff20985e94f85f03bbb1c220d8e1b28b93392f", + "dist/2023-07-12/rust-std-beta-powerpc-unknown-linux-gnu.tar.gz": "e193958bfd05581adc4e08599940f8dd77c565724c188bb331c61a1d2a030379", + "dist/2023-07-12/rust-std-beta-powerpc-unknown-linux-gnu.tar.xz": "497b919f34d29412406202724fb20500d22cbc838df05128bc259826b4698f6a", + "dist/2023-07-12/rust-std-beta-powerpc64-unknown-linux-gnu.tar.gz": "499a17483bc7fbfdb3bd234c683eda4cb8e5270deb43c66253ad265cb72df0a3", + "dist/2023-07-12/rust-std-beta-powerpc64-unknown-linux-gnu.tar.xz": "8d209a47b988c987c93c32066d2f80bfa522e23f172bf8ac7a9c166408e98136", + "dist/2023-07-12/rust-std-beta-powerpc64le-unknown-linux-gnu.tar.gz": "1795b4a2621f718915267eda5184d417406390490946f9295f3096322d4136cd", + "dist/2023-07-12/rust-std-beta-powerpc64le-unknown-linux-gnu.tar.xz": "facdc96f065df0dfe2396445b44ed640a4e9922220dfe5c79df93b650bb8c982", + "dist/2023-07-12/rust-std-beta-riscv32i-unknown-none-elf.tar.gz": "fe297caa7916f58c7483103ee88641f02c75955e652b262e35b0f53efe3163d0", + "dist/2023-07-12/rust-std-beta-riscv32i-unknown-none-elf.tar.xz": "f0c06945c158f4613e336420c869c1b4f35d1a867c11dd227f9fee2f1b5dfaf3", + "dist/2023-07-12/rust-std-beta-riscv32imac-unknown-none-elf.tar.gz": "ef8c7b0bd6055cfbeafdf36e3569804d4513cf0bf9e49f0a621860c0f203160b", + "dist/2023-07-12/rust-std-beta-riscv32imac-unknown-none-elf.tar.xz": "96c16adbaddc9711e51ed1d626d4cc4c41f58b7e498987697b8f5177c577c2c6", + "dist/2023-07-12/rust-std-beta-riscv32imc-unknown-none-elf.tar.gz": "5835365c7ebf66026d5ca60aff4c161991f49b0bf7ac626d95a8bd28b04fe759", + "dist/2023-07-12/rust-std-beta-riscv32imc-unknown-none-elf.tar.xz": "07cf34b72aba65becbed5a0465f5b0a2154427100a8520af99d9b64af2ad8483", + "dist/2023-07-12/rust-std-beta-riscv64gc-unknown-linux-gnu.tar.gz": "8241523fbcfee63cd6c62c19b7198f0a6fe8038dd886eed410b05903739105c3", + "dist/2023-07-12/rust-std-beta-riscv64gc-unknown-linux-gnu.tar.xz": "78006dd24bf206104c0c2b1c54e8281234f6758ceff28fdbd5a39f280bd09bd4", + "dist/2023-07-12/rust-std-beta-riscv64gc-unknown-none-elf.tar.gz": "be35239b3c6f35d9616055f92c0cdd014d1b55d62424d4aaf8e42930b0ce9e25", + "dist/2023-07-12/rust-std-beta-riscv64gc-unknown-none-elf.tar.xz": "8f4bad99a3eefb9e46453425a48e47e6669e8ed1e3de3de07769e6faaca5af34", + "dist/2023-07-12/rust-std-beta-riscv64imac-unknown-none-elf.tar.gz": "2523a411d75ba8bd18aa41438039f5c27dc7eb62a0cfa8f3e625d2f50a2258ec", + "dist/2023-07-12/rust-std-beta-riscv64imac-unknown-none-elf.tar.xz": "6fbfc96c33502a4cc6484ed8899a9c9de011cb41f4656773f2a3b19b342ba6ac", + "dist/2023-07-12/rust-std-beta-s390x-unknown-linux-gnu.tar.gz": "c653216ff5ad0ffd50e7dfe5682c1ca51bbfa5d3bc8194cb8144ae80e617ead7", + "dist/2023-07-12/rust-std-beta-s390x-unknown-linux-gnu.tar.xz": "306f4a01fe16a5cf72fdc687bcb520b14e60b1b3b3bacb4a2073a2bda0714a1c", + "dist/2023-07-12/rust-std-beta-sparc64-unknown-linux-gnu.tar.gz": "ed071c2f96c5ef162aa7865ff4c45432c0a30bcf09311202b9a96d29102d98c7", + "dist/2023-07-12/rust-std-beta-sparc64-unknown-linux-gnu.tar.xz": "63a2579ef0aa3342f7998803705a6e574891e135090c85c9894f767dd60b780a", + "dist/2023-07-12/rust-std-beta-sparcv9-sun-solaris.tar.gz": "1dbf5fac46eff7e390e2577041c3c8f462e36eb0bf71f97e5273a934d4f99d08", + "dist/2023-07-12/rust-std-beta-sparcv9-sun-solaris.tar.xz": "81d66825005b0a501dddd22db16d7d783a7d1114a735c6734c447b469f67f1b3", + "dist/2023-07-12/rust-std-beta-thumbv6m-none-eabi.tar.gz": "e8a6fcd3fd68770ac582531ed12e9b11e4aac808c9ffd6eef2e15e01737717f8", + "dist/2023-07-12/rust-std-beta-thumbv6m-none-eabi.tar.xz": "08d11f9af0acbb3f01e8d36cd209f4164e1e7c0b1896add89e96d09895eb81f2", + "dist/2023-07-12/rust-std-beta-thumbv7em-none-eabi.tar.gz": "904f54943102586198c83d779102d5d913f35b743fc5258d7a435eb8a414faaa", + "dist/2023-07-12/rust-std-beta-thumbv7em-none-eabi.tar.xz": "80d4be9cee0123fdecf5f92a550323e4864b00800df5be48e7a5992330b09a9d", + "dist/2023-07-12/rust-std-beta-thumbv7em-none-eabihf.tar.gz": "9c887c04608167e70ac66c7ca28f2adcb5b3111cd308203cb91c1e3d54910d60", + "dist/2023-07-12/rust-std-beta-thumbv7em-none-eabihf.tar.xz": "0ae9f88cca6bafbb4fd6fcfa6c17550f0f478b38c8d061b276e10e5c8dc41510", + "dist/2023-07-12/rust-std-beta-thumbv7m-none-eabi.tar.gz": "9a6d40873beb20ea62a5a211cbec6df52dbb886b3c30d8b46086711c9d46f9ce", + "dist/2023-07-12/rust-std-beta-thumbv7m-none-eabi.tar.xz": "cdea56ba84ffdb31dde025073149e79a58f245f281a8cd2584c3032b649b8489", + "dist/2023-07-12/rust-std-beta-thumbv7neon-linux-androideabi.tar.gz": "dc7b75d01d002b0e373737b0cccd7be2d396dee45f3da5174bf7bf94ae492949", + "dist/2023-07-12/rust-std-beta-thumbv7neon-linux-androideabi.tar.xz": "c602afb2b5d6c4b6319f90297102c9d8c192e53e1b55a047c37b1d8280ce7100", + "dist/2023-07-12/rust-std-beta-thumbv7neon-unknown-linux-gnueabihf.tar.gz": "0af441e446e4f7b1dad0593eb91d0bff30698fe66b0355928f95d08044aab4f1", + "dist/2023-07-12/rust-std-beta-thumbv7neon-unknown-linux-gnueabihf.tar.xz": "3119430271c51189b66b2f033db32c6969f767985165270a9012a7535a89840e", + "dist/2023-07-12/rust-std-beta-thumbv8m.base-none-eabi.tar.gz": "87599a0c69951178be32f649f86a14c466771657d3d065e15749372daecc255b", + "dist/2023-07-12/rust-std-beta-thumbv8m.base-none-eabi.tar.xz": "a3dc1e688fa5bf81a5563831bf7a50b699392566da5dcdd35f773965c63d3c76", + "dist/2023-07-12/rust-std-beta-thumbv8m.main-none-eabi.tar.gz": "93056ded57a786931d0727c3c22a0e18c3939591848d1781b60d4235cb9a909d", + "dist/2023-07-12/rust-std-beta-thumbv8m.main-none-eabi.tar.xz": "a20c785842f9edcc85f7ded87c5c15de1ff96f9e268055ed4b9bcfa79034df93", + "dist/2023-07-12/rust-std-beta-thumbv8m.main-none-eabihf.tar.gz": "a2382c5801287d9657ef1bb1ed8032b3f43fe4d0541529ed31aba967ec93a1b9", + "dist/2023-07-12/rust-std-beta-thumbv8m.main-none-eabihf.tar.xz": "eaf0252d5ff159b8fd6788e63077ae1b87d7d529509d4c137452771477b8ff87", + "dist/2023-07-12/rust-std-beta-wasm32-unknown-emscripten.tar.gz": "d6f4ecbcfcdc8f67a2bd0fadb955d716cfc030f7d1af1d05d71a2fcc16a8fd6e", + "dist/2023-07-12/rust-std-beta-wasm32-unknown-emscripten.tar.xz": "1c7a720a53ef38055b23f078212d6fbfce39d715d4f12c2254d4ebd1c1cd1f4d", + "dist/2023-07-12/rust-std-beta-wasm32-unknown-unknown.tar.gz": "aa3c539b1ba267233b0310e5d8f8a97ed8a75ea6db96ff93fdcb4e7416be6609", + "dist/2023-07-12/rust-std-beta-wasm32-unknown-unknown.tar.xz": "dc3cbf54d1d46945e192d0f8b8d88cb77211d0d64d3f11a0d85b280d46dec35d", + "dist/2023-07-12/rust-std-beta-wasm32-wasi.tar.gz": "5731012231903dcf24ac529dcb3b08c598dc32857e3daefb636fdfd9c8e8cb83", + "dist/2023-07-12/rust-std-beta-wasm32-wasi.tar.xz": "5afac33b9009665436b2f522f6b26543f1287fd1972d6d3c3c74e2de8b1ef791", + "dist/2023-07-12/rust-std-beta-x86_64-apple-darwin.tar.gz": "30f925d5e75433e29e9448568bf4182902c02deb8eea53cc2645e1d530b8c327", + "dist/2023-07-12/rust-std-beta-x86_64-apple-darwin.tar.xz": "627d5378da2c26482f7461f82ec792987e67affafea079565b57bd86792058e7", + "dist/2023-07-12/rust-std-beta-x86_64-apple-ios.tar.gz": "db07a73405b8cc49c95c7d19c6a51e3aa88a1d7fda722e82e883efb12a763230", + "dist/2023-07-12/rust-std-beta-x86_64-apple-ios.tar.xz": "6ff23b2d7d8b0df0ea8475ca26775c094857166df94688595b6f0a5d58f8bdfa", + "dist/2023-07-12/rust-std-beta-x86_64-fortanix-unknown-sgx.tar.gz": "103628b332971a4ac1998ebb9dd8e258f78de85510e12b78e4d9e7c0e61e8747", + "dist/2023-07-12/rust-std-beta-x86_64-fortanix-unknown-sgx.tar.xz": "ce708d121273e40785975a5bca01fc1f51caf713ca1b5144e9aadd053f153ae7", + "dist/2023-07-12/rust-std-beta-x86_64-linux-android.tar.gz": "f949c2945a7458d2196d59b6f7fb15236182cfb0df20b7a07b3db63cd882915e", + "dist/2023-07-12/rust-std-beta-x86_64-linux-android.tar.xz": "d8106d2042e18ac1401e8735229adeaf24b276a3cfd2f9e8f9b67a14c2f64dd9", + "dist/2023-07-12/rust-std-beta-x86_64-pc-solaris.tar.gz": "b9e46bfa7576b0af27ce97106d8d243a5536de4e195c70a49c7df959c3c51f6d", + "dist/2023-07-12/rust-std-beta-x86_64-pc-solaris.tar.xz": "07489a82384a92becfc5ddfa1c2154613d32bed30409e64f520b06b52219a620", + "dist/2023-07-12/rust-std-beta-x86_64-pc-windows-gnu.tar.gz": "44c447c64aea3a471bcde4e2908c812e4f7cac949f29273037e42b1d19deef8a", + "dist/2023-07-12/rust-std-beta-x86_64-pc-windows-gnu.tar.xz": "c12b7a419935c6a6fc8fff4133e6abbc51ac579085e9ac503899ca0b65918d56", + "dist/2023-07-12/rust-std-beta-x86_64-pc-windows-msvc.tar.gz": "ae163e45e5470117db8c363badf7bafcb54755c016d7f83d04d969f63ba219a8", + "dist/2023-07-12/rust-std-beta-x86_64-pc-windows-msvc.tar.xz": "b64d506318824b764a0b5cf75768d4c1ca43773863c70aa73fb2d0df654d2690", + "dist/2023-07-12/rust-std-beta-x86_64-sun-solaris.tar.gz": "12bed740d7c0a3a5b2e85a8ae377ca97341e7eed5eb7d0b347a5d2ad362e5d21", + "dist/2023-07-12/rust-std-beta-x86_64-sun-solaris.tar.xz": "887930cc08da83c766ccdcc59bc6e983fff512dffedd911eaead1d4c5611dfab", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-freebsd.tar.gz": "778967f9f2e2802970e9b24a8edefc815746a200eddca4c400c5c615b8eb98e9", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-freebsd.tar.xz": "3b24a6ec9d65b2838d9985a210e6f9d39cd880830e03a90c472f6b2b9ff18e30", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-fuchsia.tar.gz": "402b86e5b082e07c214023d412773c27733ac1493e5f559c52bbce7dc56c895b", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-fuchsia.tar.xz": "571cee5f07dd3b4f053ef5f4e830bbae0ce2f95004e2ff13e029d27a7956b338", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-illumos.tar.gz": "5bac95d69f03e59390023ed50084f20ee5ec2757a2890fc2486fe71cf7028d47", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-illumos.tar.xz": "0a9a8fa23076619ec7e7ec60a293a46989cd0c7e4d3ef8ac76f5521747702ef2", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-linux-gnu.tar.gz": "227fd782a16425da1d63b4475351764298859ddcc50a2786b4ab0126a63fe559", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz": "2a7a6b36b2138daf5b97e307bd7f440d1b962f5c51a6bbec61f56b0bb909365d", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-linux-gnux32.tar.gz": "a909474b87ff6abd09f4be16deb3210eec24cb1668eeddf1ffe683a542aa64e0", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-linux-gnux32.tar.xz": "3ec154062ae28ecdb79cb2adb06db0acb9bc2633906318f9457b9e349a249237", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-linux-musl.tar.gz": "108f9407bf5f7d2360d4d007a63792f1b5c2f03bf492cb553bcd36110d4f9ac6", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-linux-musl.tar.xz": "8764f19bd2ee50000789433c9d1ba4771c3ed8f5f93d478998bb329013d4c1d0", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-netbsd.tar.gz": "0c95d624aede0298da1e08e4ce65f358f34eabccc47903dda65298f70b3d08c1", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-netbsd.tar.xz": "982bb81104b7ecfe0ef5a29e2e8047ba22691fea55449651b8cb2592798b34b1", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-none.tar.gz": "023f68b3c2f26e2fe9d3bd8a176853c1ab7b82158d3c68181411bf9a3dbc02bf", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-none.tar.xz": "b5203c4036b38d9bd41d87e662212b4a0dd2098f42ce016146ef781d864d5d16", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-redox.tar.gz": "79c54bdd460dfce0be833185e27b698a18a50bc63706eed5ad6a55fd43f00cc3", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-redox.tar.xz": "994752c9b73fa13fdda515296329e1b687dc98197401a5db4e93bdd00ef1a3a6", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-uefi.tar.gz": "254008e9f38d1420d9f6c68563c0475ed26128cf7918749aae19054b658f5eea", + "dist/2023-07-12/rust-std-beta-x86_64-unknown-uefi.tar.xz": "63eb6b43d7c526413907af2ae261135ab6cd30ba6d82ba92fbca8c9df7dbfbb9", + "dist/2023-07-12/rustc-beta-aarch64-apple-darwin.tar.gz": "361629903acc59fd7b9e23381ba10adcbac9b2ac1f9fa8ac995a6b7b34c73a72", + "dist/2023-07-12/rustc-beta-aarch64-apple-darwin.tar.xz": "74d498d2cc984cd1dbef636b3feecb81adea0e7ba581b4b27364ec4f26a81f76", + "dist/2023-07-12/rustc-beta-aarch64-pc-windows-msvc.tar.gz": "be27c9217645d381c43014133e6654cd699bc3695310fcf3669d254d03c855c1", + "dist/2023-07-12/rustc-beta-aarch64-pc-windows-msvc.tar.xz": "54850fa60693e3b353ac186695eca1714d96bf4a26528bc221754a4ef41dcd13", + "dist/2023-07-12/rustc-beta-aarch64-unknown-linux-gnu.tar.gz": "ff73babf1ca49c0d7bc61691ebead9d88fe60475e0daa99be57fc63d80c54db1", + "dist/2023-07-12/rustc-beta-aarch64-unknown-linux-gnu.tar.xz": "006bc3e8ad7e08112b9bd1b217f78795f251ff5c40845263eafaa24cda564fb7", + "dist/2023-07-12/rustc-beta-aarch64-unknown-linux-musl.tar.gz": "e0d2afd64d312b174f877503dec692effa0f828a14801363bc639308e964815d", + "dist/2023-07-12/rustc-beta-aarch64-unknown-linux-musl.tar.xz": "2100939e2080fad8040434e0d5afb38238a583deb9d2d87983ce3509d1f34fd5", + "dist/2023-07-12/rustc-beta-arm-unknown-linux-gnueabi.tar.gz": "b34aebfdafa0d27ceb2bf1494de0894dff09ceee7f924f805f55bee64c9144e3", + "dist/2023-07-12/rustc-beta-arm-unknown-linux-gnueabi.tar.xz": "b79fdc2786057e5267b3b00b4903786f16a522aadc2f3dd8bb8456e42400862c", + "dist/2023-07-12/rustc-beta-arm-unknown-linux-gnueabihf.tar.gz": "e2e86e88c21e02fd16e5cc78a8de023af33a52d9b5006dd6884de5d97459ca1c", + "dist/2023-07-12/rustc-beta-arm-unknown-linux-gnueabihf.tar.xz": "9e3d480fbd3387aca0acd8c63a45d91e2148117fd5dc532885328ab39cbc9d11", + "dist/2023-07-12/rustc-beta-armv7-unknown-linux-gnueabihf.tar.gz": "b08a6627dc24f348cc6eb9c89a63099ffdc1e71d562ccce0a7906ef279b4cccf", + "dist/2023-07-12/rustc-beta-armv7-unknown-linux-gnueabihf.tar.xz": "57d4513f8dfe30a2a62886d931ac317d956fa723b4d72c458f77c4be28144ec2", + "dist/2023-07-12/rustc-beta-i686-pc-windows-gnu.tar.gz": "6950bca30824403a94c1a272d4bf7a5771dfe608c20a3045ea6a48a5ad789851", + "dist/2023-07-12/rustc-beta-i686-pc-windows-gnu.tar.xz": "7891a4ca20a622138c5008824c01c6de7b5b4306381375d95b3063518eb7883b", + "dist/2023-07-12/rustc-beta-i686-pc-windows-msvc.tar.gz": "cbf66d5ed4dbae45e1738c4ea3879886ec59062bc59be93b2b526c49634fabe5", + "dist/2023-07-12/rustc-beta-i686-pc-windows-msvc.tar.xz": "01d52825cd5d184028f6fa2b47d061254e500324c43db0c7ee4cfede9f801791", + "dist/2023-07-12/rustc-beta-i686-unknown-linux-gnu.tar.gz": "04f9d64cde2749214fbfa849c72df4bece1c0c9bd485933acf41e4b38bb90976", + "dist/2023-07-12/rustc-beta-i686-unknown-linux-gnu.tar.xz": "387b72fec91c8afbf088819248b8333198a1588ff2ef3fced9dc75a0d28152ac", + "dist/2023-07-12/rustc-beta-loongarch64-unknown-linux-gnu.tar.gz": "d6d6d499f388395cf0234ecbc250ad8c17201388502cc0b1d4dcd145938edf59", + "dist/2023-07-12/rustc-beta-loongarch64-unknown-linux-gnu.tar.xz": "2f83df3cd76a236ed170b9b9eece1be1297f2159226d6ca13826ed345ebc25ba", + "dist/2023-07-12/rustc-beta-powerpc-unknown-linux-gnu.tar.gz": "fde554a543eba35030ff0b4c3402b5c24c372a7071d1e489797106b51392caeb", + "dist/2023-07-12/rustc-beta-powerpc-unknown-linux-gnu.tar.xz": "7d8dae3414126ed8d34dffa577d59b236d1b04dd9aaeee8e83bf50ef3269cceb", + "dist/2023-07-12/rustc-beta-powerpc64-unknown-linux-gnu.tar.gz": "558622fcbf845cc05114680d20edb596f243304b5d540f8df3c575d0c2c681ce", + "dist/2023-07-12/rustc-beta-powerpc64-unknown-linux-gnu.tar.xz": "4716b40dfa7ad351e9c476742d119167b30c5c4c2b2316808d6587ff0de69c7c", + "dist/2023-07-12/rustc-beta-powerpc64le-unknown-linux-gnu.tar.gz": "c97ad88f524cda10fc59e083f543b603a84e47c4cff2af51bd6294b0c04fa52b", + "dist/2023-07-12/rustc-beta-powerpc64le-unknown-linux-gnu.tar.xz": "0cba6173edc10993176e466b2f0c353551b7f544d499eca90e143c40bd855288", + "dist/2023-07-12/rustc-beta-riscv64gc-unknown-linux-gnu.tar.gz": "0d0a9cf77521a372271e6c37b7ca9b1ea879e1f8ccbad07e88a047268fbffb02", + "dist/2023-07-12/rustc-beta-riscv64gc-unknown-linux-gnu.tar.xz": "8f5e09fb6febc5965ec762d88ab812385ec133a732f006c6a61aedd3be6a7ce1", + "dist/2023-07-12/rustc-beta-s390x-unknown-linux-gnu.tar.gz": "35fdc9549f2ae6545458ca9a899a2e6ecca33864709f28c3479bf547b86bd843", + "dist/2023-07-12/rustc-beta-s390x-unknown-linux-gnu.tar.xz": "4f3ef47d674787313ce445ae453661302df3cd5c36e4f135b4cbf1ebd60a1e3d", + "dist/2023-07-12/rustc-beta-x86_64-apple-darwin.tar.gz": "ac623b79329ffae330e76d79a9ca741962725a072e045b8b7d9b2d6fee5a57b3", + "dist/2023-07-12/rustc-beta-x86_64-apple-darwin.tar.xz": "439cce8c9f3d614a8eefa45bc42723a15e9dfdefa83cb48f1751ba8aaf1fccb6", + "dist/2023-07-12/rustc-beta-x86_64-pc-windows-gnu.tar.gz": "4f91add8c303b2c82ff9d2c5bb0723b298e0e1f5ddca524af9c1fde490d0d346", + "dist/2023-07-12/rustc-beta-x86_64-pc-windows-gnu.tar.xz": "cda1396c2eddf49e42cab04fe152b4edea0d9ef61ebe987307962a1c5dd1e55b", + "dist/2023-07-12/rustc-beta-x86_64-pc-windows-msvc.tar.gz": "993f06513b965731fdd678208985a85b0edb94887df4f4518b8190f1bb9c9faa", + "dist/2023-07-12/rustc-beta-x86_64-pc-windows-msvc.tar.xz": "7a41f05c27619407a4a4ae6acf5ad567f2504d4b8e7462e0fc409513b3086dc3", + "dist/2023-07-12/rustc-beta-x86_64-unknown-freebsd.tar.gz": "19ab69319c2c52580e447cc22471fb18a25b06849c1fe79783eb067e0f75f1c7", + "dist/2023-07-12/rustc-beta-x86_64-unknown-freebsd.tar.xz": "684cbc8205f08c9e7aa6de7fc72422dbc87d5e842367f0c3e40f2206f3bd1045", + "dist/2023-07-12/rustc-beta-x86_64-unknown-illumos.tar.gz": "af31123f89adca1858eea5e5f00e42913aeeda1dbc7572d557a7ae132928f3f7", + "dist/2023-07-12/rustc-beta-x86_64-unknown-illumos.tar.xz": "e4f711e5b81663ddc2d5b5f85b74488bcbd0535c8e170fb99e3fbe7d6931e937", + "dist/2023-07-12/rustc-beta-x86_64-unknown-linux-gnu.tar.gz": "6f781b40006f6552a0f4642808950ac570d6b4a17e15bcb373a385ac5f822bb3", + "dist/2023-07-12/rustc-beta-x86_64-unknown-linux-gnu.tar.xz": "af7d049238fdf1d538059b918d5ab0e3751ada2f3a339a7479a295d08b5aa963", + "dist/2023-07-12/rustc-beta-x86_64-unknown-linux-musl.tar.gz": "bbcfa001617d591fb663b55f1c072c5bd1c5ae57a245a00d6fcbe02ab52ef4e7", + "dist/2023-07-12/rustc-beta-x86_64-unknown-linux-musl.tar.xz": "56ecccd46000dcfda0996da364509b7b2a739132693f776d63f9b1d74fb8c546", + "dist/2023-07-12/rustc-beta-x86_64-unknown-netbsd.tar.gz": "181b946f424be9a5430f79d56c80324e2a72ed638e571fbfc7d1af370d4aaf11", + "dist/2023-07-12/rustc-beta-x86_64-unknown-netbsd.tar.xz": "2bc9406b45f14e2efb47c9475ae89a3ec9ce780c402d27f11c4a6217a5845258", + "dist/2023-07-13/rustc-nightly-aarch64-apple-darwin.tar.gz": "4298aa816d4a6c1004e4a480f77e0d321a47c4b5e2048ed705a5a7d632a43bcc", + "dist/2023-07-13/rustc-nightly-aarch64-apple-darwin.tar.xz": "0758cf22ed98bba897ad3bff5c3fc49367d3fea25185e1b39cea417941c7ce42", + "dist/2023-07-13/rustc-nightly-aarch64-pc-windows-msvc.tar.gz": "0db596a386aac8d2d35293e8466a710498102ca6d68a16d60ebbfffa2cc67950", + "dist/2023-07-13/rustc-nightly-aarch64-pc-windows-msvc.tar.xz": "6a51533a6bdf3ec705fb7d09f076e67393b4090159ce6bfc8ab9a4abbda1b421", + "dist/2023-07-13/rustc-nightly-aarch64-unknown-linux-gnu.tar.gz": "c6dd529410c4ceb5ef851380e1f12581fe0d2240b9224bf4727f4ef0dd93f7ab", + "dist/2023-07-13/rustc-nightly-aarch64-unknown-linux-gnu.tar.xz": "7b3d71fd596292c3989c2e8982fe2d488f90449e68114be331f7589b296b9b1d", + "dist/2023-07-13/rustc-nightly-aarch64-unknown-linux-musl.tar.gz": "8551f98fb1030ff712a68b97cc1c67bbb19ec51748f92ac7d149b0d1e2f08ada", + "dist/2023-07-13/rustc-nightly-aarch64-unknown-linux-musl.tar.xz": "853b80262a5e58dd8c831a42f0efb229e5eb8516c6d4ddafc02152e2e55b6706", + "dist/2023-07-13/rustc-nightly-arm-unknown-linux-gnueabi.tar.gz": "d04649a98a7410594bd4ac776a638d7312838e0b15cdf53236b953406a1bcf87", + "dist/2023-07-13/rustc-nightly-arm-unknown-linux-gnueabi.tar.xz": "6319a00b08efdac3a379d587d8c11507a79446e9ef2421f6539af9a734ec2ce5", + "dist/2023-07-13/rustc-nightly-arm-unknown-linux-gnueabihf.tar.gz": "9739f7d186d5a92d9e775bda150ad1893fa14720f2e3662d61220d125a68868e", + "dist/2023-07-13/rustc-nightly-arm-unknown-linux-gnueabihf.tar.xz": "818fc51517ad026bda8c3eefa3065d3d6d9e465f600398404987e9c8420ba933", + "dist/2023-07-13/rustc-nightly-armv7-unknown-linux-gnueabihf.tar.gz": "557e197ddd49d62e271108c8c0f17618d58c6b77841aee75cf190a260de8b522", + "dist/2023-07-13/rustc-nightly-armv7-unknown-linux-gnueabihf.tar.xz": "a60b73f673e80f02ff1c1151e63d883b8e390ec447cb3154b1fd4ac4b4b9af78", + "dist/2023-07-13/rustc-nightly-i686-pc-windows-gnu.tar.gz": "31fe306c7b547d1e595d82b7195d972a3e8dbcace6bf786557d0ff14b7f3a243", + "dist/2023-07-13/rustc-nightly-i686-pc-windows-gnu.tar.xz": "32dcb5830ae51effd7f8bc6c2dc8c61863952c1eb34a3f6a5e5a7ca1e632660c", + "dist/2023-07-13/rustc-nightly-i686-pc-windows-msvc.tar.gz": "4ecb180c07b1f1f15f51508e0d2290204052ce98be2203c8d2257f620b0a3c32", + "dist/2023-07-13/rustc-nightly-i686-pc-windows-msvc.tar.xz": "e9a6e85dc43561d644988e862db6d3af53b14397e8aff1b162fe6f29c65062ed", + "dist/2023-07-13/rustc-nightly-i686-unknown-linux-gnu.tar.gz": "4fdb462e10993e386f03396f98379bdfe45d60c38bce2102243d566d4eb0178d", + "dist/2023-07-13/rustc-nightly-i686-unknown-linux-gnu.tar.xz": "759d1c97a06baa0f7d56705a0d4b4bd954057d140b1a28e34db1d2a59c85307a", + "dist/2023-07-13/rustc-nightly-loongarch64-unknown-linux-gnu.tar.gz": "5f0ebf7b582bb3e8112e8287a33966670f33c46db6fc4569963a7aa0c1b6daf7", + "dist/2023-07-13/rustc-nightly-loongarch64-unknown-linux-gnu.tar.xz": "044f6d651b03b1c74bd5ed86139119ed0cfd4643576860770a784557c864388d", + "dist/2023-07-13/rustc-nightly-powerpc-unknown-linux-gnu.tar.gz": "9fef5ebfd5b50d256d85e24ecfe3953da80bce799c83eb8f453e70b20424274e", + "dist/2023-07-13/rustc-nightly-powerpc-unknown-linux-gnu.tar.xz": "8d3c75ae12ef9273279c5c715680e0ec5035bbc642ac3e6e9d5e31f718b4d625", + "dist/2023-07-13/rustc-nightly-powerpc64-unknown-linux-gnu.tar.gz": "acb5e2e805023eaf2403385d26f1bf6fa91dc505f2a030bb3ef1b1c415cd2251", + "dist/2023-07-13/rustc-nightly-powerpc64-unknown-linux-gnu.tar.xz": "7bbb565705d19c01404e519c3b15db717678995f5ec5fbb572937ae7ee2efded", + "dist/2023-07-13/rustc-nightly-powerpc64le-unknown-linux-gnu.tar.gz": "9af44902fc657866446dfa52a8e5f561e69e555c49c0e6f32d739b4a6af98a59", + "dist/2023-07-13/rustc-nightly-powerpc64le-unknown-linux-gnu.tar.xz": "f9e877a64286b78876f33f7506086118653d01674333c59907e8cdf71c4e95a2", + "dist/2023-07-13/rustc-nightly-riscv64gc-unknown-linux-gnu.tar.gz": "c5a1fb8c5f3a69adadac4a7c0f8734cc14b8ce1e383530419a095c4db6645b11", + "dist/2023-07-13/rustc-nightly-riscv64gc-unknown-linux-gnu.tar.xz": "521e7be385877a0f4069435efa9308fc5d33e4f90294270a7f8df9327ce222c1", + "dist/2023-07-13/rustc-nightly-s390x-unknown-linux-gnu.tar.gz": "55d9efc83614e5fcc4a7ccd0581a95a66ada4577198b25b0f4e7067ee72cdbd9", + "dist/2023-07-13/rustc-nightly-s390x-unknown-linux-gnu.tar.xz": "6c88031cd1d59fb6c2f971b3ca9aea2e029f8481cd41824ffdb67a085feab5f1", + "dist/2023-07-13/rustc-nightly-x86_64-apple-darwin.tar.gz": "b75c6defcd94b930ced62a7ee18000a68cf6bf255479ead60395ca3158f2f198", + "dist/2023-07-13/rustc-nightly-x86_64-apple-darwin.tar.xz": "ea1dc2985f708823719589fb029de961b179cf19bb228a4745cc26a47415a5de", + "dist/2023-07-13/rustc-nightly-x86_64-pc-windows-gnu.tar.gz": "c1602297eab6a276aa367b2f85d004d236d26cd4b4133e4cffb941ef3c858c74", + "dist/2023-07-13/rustc-nightly-x86_64-pc-windows-gnu.tar.xz": "06965d8332f0fc167886f6e9a3ff9a558aa3513711ea309bab5f30185a9afee7", + "dist/2023-07-13/rustc-nightly-x86_64-pc-windows-msvc.tar.gz": "80c3d27142473a89beb1969cbfdba7281ca237ec8f2a5b20c75eeb14c5e2e771", + "dist/2023-07-13/rustc-nightly-x86_64-pc-windows-msvc.tar.xz": "52fe4134ef2ab35ffa251669a30ca6c9aa94a3ca97238f46f9aad0b2b9dac70f", + "dist/2023-07-13/rustc-nightly-x86_64-unknown-freebsd.tar.gz": "837f628f7775d13b661c1e7dd7a1de649264abca247aeeb6cbab05faaf7e83c2", + "dist/2023-07-13/rustc-nightly-x86_64-unknown-freebsd.tar.xz": "732a597647702c2672f559c83a8e829c36dcb8fe92bf8abdcc1cf2526ba2d8af", + "dist/2023-07-13/rustc-nightly-x86_64-unknown-illumos.tar.gz": "07eed9287f36cc6650838e27b7148c26d588b96b522e1b72f58ceebec4b0dd87", + "dist/2023-07-13/rustc-nightly-x86_64-unknown-illumos.tar.xz": "70cb988d67159941502900f803e29bdb53f81057d68393965ebd63fe42e2cba4", + "dist/2023-07-13/rustc-nightly-x86_64-unknown-linux-gnu.tar.gz": "adbe0dd7ba4df92f199118943bc25d3a467d6c1d3249817b74e05c7d59a76846", + "dist/2023-07-13/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz": "c999ab64cbbed8bc2853b717190d6d4aac871363c7182e06c5144e50d34621b5", + "dist/2023-07-13/rustc-nightly-x86_64-unknown-linux-musl.tar.gz": "1bc5368592390eee2478d48f75fbeb5e9f3f8e4fc2f6e3e6952fa08e7c8f46f6", + "dist/2023-07-13/rustc-nightly-x86_64-unknown-linux-musl.tar.xz": "15559729aefc45dcc1b28333e6166a2fe5b1e0d30521b9a1ecd80134c859ed85", + "dist/2023-07-13/rustc-nightly-x86_64-unknown-netbsd.tar.gz": "f918703cc31c800e35d739ef146733de486a6fbb2a0c78f993352a1242352f0b", + "dist/2023-07-13/rustc-nightly-x86_64-unknown-netbsd.tar.xz": "777d69d7190825ea83dc44712d0372b1a225b3e4fde66d1b9ac4ea981d54a031", + "dist/2023-07-13/rustfmt-nightly-aarch64-apple-darwin.tar.gz": "998a5c80bfb2450869e6975aeb178104f3424df6b88fccb9c549ff95fb0a62e7", + "dist/2023-07-13/rustfmt-nightly-aarch64-apple-darwin.tar.xz": "84f8e77132b4ce46086907bbaa3bbfbe151400d8110f075cbaa31e80616d9891", + "dist/2023-07-13/rustfmt-nightly-aarch64-pc-windows-msvc.tar.gz": "63a8b8302007b9052a0016200332e85b24f758960eca25ba7ffb7f8d5c6ed409", + "dist/2023-07-13/rustfmt-nightly-aarch64-pc-windows-msvc.tar.xz": "291d17a39390b1259d47e8b1c9495d80817e12854cb3ede2a91b50a8c7a998f4", + "dist/2023-07-13/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.gz": "c5c5d47c25fecaed410f1c0004e30abbc436b5dc85110f657f1ddc87b10933da", + "dist/2023-07-13/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.xz": "c7da897bf78cc051fa0028b93253348ad4b89c3dec9782d093db98b1814cd828", + "dist/2023-07-13/rustfmt-nightly-aarch64-unknown-linux-musl.tar.gz": "2be878ea50ad540b17658dd29bec4124c43654f4668c62e7a4b2c7b5ad07155b", + "dist/2023-07-13/rustfmt-nightly-aarch64-unknown-linux-musl.tar.xz": "b355c1bd4140205c613c539021e0194535fb3c94b3eba2a2dd6ae314a7bca891", + "dist/2023-07-13/rustfmt-nightly-arm-unknown-linux-gnueabi.tar.gz": "84e711b5e26487bad148d9968ac7236fddddd050761a3069ce10a8e222a860a1", + "dist/2023-07-13/rustfmt-nightly-arm-unknown-linux-gnueabi.tar.xz": "fff567ecf3c426558c8cd84776870d833511049dbc531ed5e71733694afe5f70", + "dist/2023-07-13/rustfmt-nightly-arm-unknown-linux-gnueabihf.tar.gz": "61b48838a1f0097a8060f4a01e3b5ee2acdf409ca681ee7c78c120ee59a82e1a", + "dist/2023-07-13/rustfmt-nightly-arm-unknown-linux-gnueabihf.tar.xz": "687576f050b1266236e986557eea10fe4354d6be3ab930c5874aac9accc19a7f", + "dist/2023-07-13/rustfmt-nightly-armv7-unknown-linux-gnueabihf.tar.gz": "003e572ef26cc1f39449fc7c488be6ba4fc180a432512036c2035c5249b5a7ae", + "dist/2023-07-13/rustfmt-nightly-armv7-unknown-linux-gnueabihf.tar.xz": "dad6a37c9054bad090e3fc69679ef61cf95f16063623aba72f8002a95d548020", + "dist/2023-07-13/rustfmt-nightly-i686-pc-windows-gnu.tar.gz": "707a6ea9565d9c65b0aa3eac205659c41c70da0f6301d04caa4291716e70aa18", + "dist/2023-07-13/rustfmt-nightly-i686-pc-windows-gnu.tar.xz": "0546e09197a129dbf27b93ff6e0d84d0dc1a4b40e49ec131e29cd2c3636a950c", + "dist/2023-07-13/rustfmt-nightly-i686-pc-windows-msvc.tar.gz": "d7a15e31b67f1897a2968d58b0578fd6489e55709cea5747b9b49f5aa2e4d62b", + "dist/2023-07-13/rustfmt-nightly-i686-pc-windows-msvc.tar.xz": "5b1bfa464636528d7245b7524fe471fdafc2bd088efc5d99823a5d3b31afd48f", + "dist/2023-07-13/rustfmt-nightly-i686-unknown-linux-gnu.tar.gz": "ab7d0ac3cbf01cdfd0aba52d869208469d49193a81ba59502d08a377cea883f1", + "dist/2023-07-13/rustfmt-nightly-i686-unknown-linux-gnu.tar.xz": "f18f262a288c55b72b434abbb0d304eb6bae7db27fccfb2bdca6eef9078c0f68", + "dist/2023-07-13/rustfmt-nightly-loongarch64-unknown-linux-gnu.tar.gz": "6e95d58a682e0f924b71d40827f156e3a52b5c90bf3347b4b67c275f1e372537", + "dist/2023-07-13/rustfmt-nightly-loongarch64-unknown-linux-gnu.tar.xz": "c68cf075f8eba37e424a1ad79c87963070b20fb38c0e140bbf9733368e45077d", + "dist/2023-07-13/rustfmt-nightly-powerpc-unknown-linux-gnu.tar.gz": "f41f9f8f383b12ab0d93b63647aef8e57431475ccb41675d69071a69fdebb6fc", + "dist/2023-07-13/rustfmt-nightly-powerpc-unknown-linux-gnu.tar.xz": "ce097e23de16a0f0208fd669c71c372dcc99ab3114af573cc38b1b58ed5b10d0", + "dist/2023-07-13/rustfmt-nightly-powerpc64-unknown-linux-gnu.tar.gz": "6fd13a4f75c4d3ce82a7d7e54051c308d7a18be89c829ab0fe313c6735c74a8d", + "dist/2023-07-13/rustfmt-nightly-powerpc64-unknown-linux-gnu.tar.xz": "66c363a6804f279ea8ac52db85b6ad37b3075f59a6cf2f9be213f2849a76880f", + "dist/2023-07-13/rustfmt-nightly-powerpc64le-unknown-linux-gnu.tar.gz": "480fef935283819bfa03c8d4ccc9300bc1c6669371c4ba41af2e8e3bd547e8cb", + "dist/2023-07-13/rustfmt-nightly-powerpc64le-unknown-linux-gnu.tar.xz": "a3eb16f78498a99dda46398befbb0d4a876e62b9db9b344e472ba072c8583846", + "dist/2023-07-13/rustfmt-nightly-riscv64gc-unknown-linux-gnu.tar.gz": "607a0582cd382a04c8131cb03cfc48092eac953953aeafa06dbe84889553eea5", + "dist/2023-07-13/rustfmt-nightly-riscv64gc-unknown-linux-gnu.tar.xz": "0bf682b38cef792c1514b2277c8a933c27d87197895b83c3a67684ebed134ea4", + "dist/2023-07-13/rustfmt-nightly-s390x-unknown-linux-gnu.tar.gz": "1579084ae15cfc842f587e1e208693cdf7fcfe76dd818efb3b98d01a39b1f93b", + "dist/2023-07-13/rustfmt-nightly-s390x-unknown-linux-gnu.tar.xz": "361ad2ecb131f2c0ed773c864c02f59d960264fd86cf3397e81b58bb9d0237a3", + "dist/2023-07-13/rustfmt-nightly-x86_64-apple-darwin.tar.gz": "429150699fc23b90bb034b2b06dbc27f74f0fcd467225afc012ac7dd639228c6", + "dist/2023-07-13/rustfmt-nightly-x86_64-apple-darwin.tar.xz": "31468dbf051c1edcd69873264c28e046d5d6e1867ba9255b8a0e97905b536fcf", + "dist/2023-07-13/rustfmt-nightly-x86_64-pc-windows-gnu.tar.gz": "38e8742bb196216409e474e07deaac2d2a842d1372f3b7e1ad24c039cc0fb609", + "dist/2023-07-13/rustfmt-nightly-x86_64-pc-windows-gnu.tar.xz": "8287a9058332bc41f7b83788d5c3af2bfdca6986301e3d97cdb583b619967c2e", + "dist/2023-07-13/rustfmt-nightly-x86_64-pc-windows-msvc.tar.gz": "db584715b7df3be2d97878cc45102474b551e13604e71485dd14e68dfe3706f0", + "dist/2023-07-13/rustfmt-nightly-x86_64-pc-windows-msvc.tar.xz": "6fd6ee9dca05b8560536c738cb0b4020aa37397acc4a1888f4fed5a89e461d8f", + "dist/2023-07-13/rustfmt-nightly-x86_64-unknown-freebsd.tar.gz": "8bccffaf50ff3d3ea7197f0a5b2fa075996afe9de602821a5638ee5d7c56e610", + "dist/2023-07-13/rustfmt-nightly-x86_64-unknown-freebsd.tar.xz": "0ee2812579304231d29c32d32e5b908751e369ce7776b9773a3cf89d5fdb00d0", + "dist/2023-07-13/rustfmt-nightly-x86_64-unknown-illumos.tar.gz": "9f26ef23056f20f722f3616632cad8d03428248f126c83ed682ab4f67268e7df", + "dist/2023-07-13/rustfmt-nightly-x86_64-unknown-illumos.tar.xz": "1265d7f28cf332db9f467d02f0a77ffdfa926bbf7ad5d148cb04ec888abcfc49", + "dist/2023-07-13/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.gz": "74a5d268d82c39eb2b23b5324ce978647e59591e586f7c52d9187d7843990e1e", + "dist/2023-07-13/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz": "4b16832cd24285705a29e3e9aaec554675852200763bffc6124005211c38f37e", + "dist/2023-07-13/rustfmt-nightly-x86_64-unknown-linux-musl.tar.gz": "0cd34367c1ee4a61cf7bf26591aa65de6651c0a0912afdd1f08cea60da35ea91", + "dist/2023-07-13/rustfmt-nightly-x86_64-unknown-linux-musl.tar.xz": "5321648a640b3ab57d329a1ec5e83f30825c2a8ca73a4135c1c003726d86b28b", + "dist/2023-07-13/rustfmt-nightly-x86_64-unknown-netbsd.tar.gz": "298c887d59f8f1a7a4d02335224fa1b9b3ccdf540fe5bbf00417d083352c4149", + "dist/2023-07-13/rustfmt-nightly-x86_64-unknown-netbsd.tar.xz": "f0e6bc108a89407273790d228d51351046183a4eefd64631879cba6fa72c60d4" } } diff --git a/src/tools/build_helper/src/git.rs b/src/tools/build_helper/src/git.rs index 168633c8f63..66876e02c19 100644 --- a/src/tools/build_helper/src/git.rs +++ b/src/tools/build_helper/src/git.rs @@ -94,7 +94,9 @@ pub fn get_git_modified_files( git_dir: Option<&Path>, extensions: &Vec<&str>, ) -> Result<Option<Vec<String>>, String> { - let Ok(updated_master) = updated_master_branch(git_dir) else { return Ok(None); }; + let Ok(updated_master) = updated_master_branch(git_dir) else { + return Ok(None); + }; let git = || { let mut git = Command::new("git"); @@ -119,7 +121,9 @@ pub fn get_git_modified_files( /// Returns the files that haven't been added to git yet. pub fn get_git_untracked_files(git_dir: Option<&Path>) -> Result<Option<Vec<String>>, String> { - let Ok(_updated_master) = updated_master_branch(git_dir) else { return Ok(None); }; + let Ok(_updated_master) = updated_master_branch(git_dir) else { + return Ok(None); + }; let mut git = Command::new("git"); if let Some(git_dir) = git_dir { git.current_dir(git_dir); diff --git a/src/tools/cargo b/src/tools/cargo -Subproject 45782b6b8afd1da042d45c2daeec9c0744f72cc +Subproject 694a579566a9a1482b20aff8a68f0e4edd99bd2 diff --git a/src/tools/clippy/tests/ui/empty_line_after_doc_comments.rs b/src/tools/clippy/tests/ui/empty_line_after_doc_comments.rs index 83db2a07d33..cc36ce5f487 100644 --- a/src/tools/clippy/tests/ui/empty_line_after_doc_comments.rs +++ b/src/tools/clippy/tests/ui/empty_line_after_doc_comments.rs @@ -1,4 +1,7 @@ //@aux-build:proc_macro_attr.rs:proc-macro +// Flaky test, see https://github.com/rust-lang/rust/issues/113585. +//@ignore-32bit +//@ignore-64bit #![warn(clippy::empty_line_after_doc_comments)] #![allow(clippy::assertions_on_constants)] #![feature(custom_inner_attributes)] diff --git a/src/tools/clippy/tests/ui/empty_line_after_outer_attribute.rs b/src/tools/clippy/tests/ui/empty_line_after_outer_attribute.rs index b2d7ddae427..bc54e0fd2de 100644 --- a/src/tools/clippy/tests/ui/empty_line_after_outer_attribute.rs +++ b/src/tools/clippy/tests/ui/empty_line_after_outer_attribute.rs @@ -1,4 +1,7 @@ //@aux-build:proc_macro_attr.rs:proc-macro +// Flaky test, see https://github.com/rust-lang/rust/issues/113585. +//@ignore-32bit +//@ignore-64bit #![warn(clippy::empty_line_after_outer_attr)] #![allow(clippy::assertions_on_constants)] #![feature(custom_inner_attributes)] diff --git a/src/tools/clippy/tests/ui/needless_arbitrary_self_type_unfixable.rs b/src/tools/clippy/tests/ui/needless_arbitrary_self_type_unfixable.rs index 876f16a3854..321aa69a1a5 100644 --- a/src/tools/clippy/tests/ui/needless_arbitrary_self_type_unfixable.rs +++ b/src/tools/clippy/tests/ui/needless_arbitrary_self_type_unfixable.rs @@ -1,4 +1,7 @@ //@aux-build:proc_macro_attr.rs:proc-macro +// Flaky test, see https://github.com/rust-lang/rust/issues/113585. +//@ignore-32bit +//@ignore-64bit #![warn(clippy::needless_arbitrary_self_type)] diff --git a/src/tools/collect-license-metadata/src/path_tree.rs b/src/tools/collect-license-metadata/src/path_tree.rs index 68b6cef6432..709d91897e6 100644 --- a/src/tools/collect-license-metadata/src/path_tree.rs +++ b/src/tools/collect-license-metadata/src/path_tree.rs @@ -155,7 +155,10 @@ impl Node<LicenseId> { name: child_name, children: child_children, license: child_license, - } = child else { continue }; + } = child + else { + continue; + }; if child_license != license { continue; diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index ad10c3e07ce..d67e9aaaa6e 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -541,16 +541,15 @@ impl TestProps { } fn update_pass_mode(&mut self, ln: &str, revision: Option<&str>, config: &Config) { - let check_no_run = |s| { - if config.mode != Mode::Ui && config.mode != Mode::Incremental { - panic!("`{}` header is only supported in UI and incremental tests", s); - } - if config.mode == Mode::Incremental - && !revision.map_or(false, |r| r.starts_with("cfail")) - && !self.revisions.iter().all(|r| r.starts_with("cfail")) - { - panic!("`{}` header is only supported in `cfail` incremental tests", s); + let check_no_run = |s| match (config.mode, s) { + (Mode::Ui, _) => (), + (Mode::Codegen, "build-pass") => (), + (Mode::Incremental, _) => { + if revision.is_some() && !self.revisions.iter().all(|r| r.starts_with("cfail")) { + panic!("`{s}` header is only supported in `cfail` incremental tests") + } } + (mode, _) => panic!("`{s}` header is not supported in `{mode}` tests"), }; let pass_mode = if config.parse_name_directive(ln, "check-pass") { check_no_run("check-pass"); @@ -559,9 +558,7 @@ impl TestProps { check_no_run("build-pass"); Some(PassMode::Build) } else if config.parse_name_directive(ln, "run-pass") { - if config.mode != Mode::Ui { - panic!("`run-pass` header is only supported in UI tests") - } + check_no_run("run-pass"); Some(PassMode::Run) } else { None @@ -599,7 +596,10 @@ pub fn line_directive<'line>( if ln.starts_with('[') { // A comment like `//[foo]` is specific to revision `foo` let Some(close_brace) = ln.find(']') else { - panic!("malformed condition directive: expected `{}[foo]`, found `{}`", comment, ln); + panic!( + "malformed condition directive: expected `{}[foo]`, found `{}`", + comment, ln + ); }; let lncfg = &ln[1..close_brace]; diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index ac19fe078f0..b91e1b09330 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2752,6 +2752,10 @@ impl<'test> TestCx<'test> { self.fatal_proc_rec("compilation failed!", &proc_res); } + if let Some(PassMode::Build) = self.pass_mode() { + return; + } + let output_path = self.output_base_name().with_extension("ll"); let proc_res = self.verify_with_filecheck(&output_path); if !proc_res.status.success() { diff --git a/src/tools/jsondocck/src/cache.rs b/src/tools/jsondocck/src/cache.rs index f9e54232750..50697d46b8c 100644 --- a/src/tools/jsondocck/src/cache.rs +++ b/src/tools/jsondocck/src/cache.rs @@ -15,8 +15,10 @@ impl Cache { /// Create a new cache, used to read files only once and otherwise store their contents. pub fn new(config: &Config) -> Cache { let root = Path::new(&config.doc_dir); - let filename = Path::new(&config.template).file_stem().unwrap(); - let file_path = root.join(&Path::with_extension(Path::new(filename), "json")); + // `filename` needs to replace `-` with `_` to be sure the JSON path will always be valid. + let filename = + Path::new(&config.template).file_stem().unwrap().to_str().unwrap().replace('-', "_"); + let file_path = root.join(&Path::with_extension(Path::new(&filename), "json")); let content = fs::read_to_string(&file_path).expect("failed to read JSON file"); Cache { diff --git a/src/tools/jsondoclint/src/main.rs b/src/tools/jsondoclint/src/main.rs index ee163ddfdd9..aaaba78cb46 100644 --- a/src/tools/jsondoclint/src/main.rs +++ b/src/tools/jsondoclint/src/main.rs @@ -1,4 +1,5 @@ use std::io::{BufWriter, Write}; +use std::path::{Path, PathBuf}; use anyhow::{bail, Result}; use clap::Parser; @@ -25,7 +26,7 @@ enum ErrorKind { #[derive(Debug, Serialize)] struct JsonOutput { - path: String, + path: PathBuf, errors: Vec<Error>, } @@ -45,6 +46,12 @@ struct Cli { fn main() -> Result<()> { let Cli { path, verbose, json_output } = Cli::parse(); + // We convert `-` into `_` for the file name to be sure the JSON path will always be correct. + let path = Path::new(&path); + let filename = path.file_name().unwrap().to_str().unwrap().replace('-', "_"); + let parent = path.parent().unwrap(); + let path = parent.join(&filename); + let contents = fs::read_to_string(&path)?; let krate: Crate = serde_json::from_str(&contents)?; assert_eq!(krate.format_version, FORMAT_VERSION); @@ -101,7 +108,7 @@ fn main() -> Result<()> { ErrorKind::Custom(msg) => eprintln!("{}: {}", err.id.0, msg), } } - bail!("Errors validating json {path}"); + bail!("Errors validating json {}", path.display()); } Ok(()) diff --git a/src/tools/miri/rust-version b/src/tools/miri/rust-version index 02b0dd16f91..17b1d2b1120 100644 --- a/src/tools/miri/rust-version +++ b/src/tools/miri/rust-version @@ -1 +1 @@ -d4096e0412ac5de785d739a0aa2b1c1c7b9d3b7d +743333f3dd90721461c09387ec73d09c080d5f5f diff --git a/src/tools/miri/src/borrow_tracker/mod.rs b/src/tools/miri/src/borrow_tracker/mod.rs index faa23fd2620..a2cf7c80950 100644 --- a/src/tools/miri/src/borrow_tracker/mod.rs +++ b/src/tools/miri/src/borrow_tracker/mod.rs @@ -302,12 +302,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { } } - fn retag_return_place(&mut self) -> InterpResult<'tcx> { + fn protect_place(&mut self, place: &MPlaceTy<'tcx, Provenance>) -> InterpResult<'tcx> { let this = self.eval_context_mut(); let method = this.machine.borrow_tracker.as_ref().unwrap().borrow().borrow_tracker_method; match method { - BorrowTrackerMethod::StackedBorrows => this.sb_retag_return_place(), - BorrowTrackerMethod::TreeBorrows => this.tb_retag_return_place(), + BorrowTrackerMethod::StackedBorrows => this.sb_protect_place(place), + BorrowTrackerMethod::TreeBorrows => this.tb_protect_place(place), } } diff --git a/src/tools/miri/src/borrow_tracker/stacked_borrows/diagnostics.rs b/src/tools/miri/src/borrow_tracker/stacked_borrows/diagnostics.rs index de307a3c5f5..5ec8d80fb32 100644 --- a/src/tools/miri/src/borrow_tracker/stacked_borrows/diagnostics.rs +++ b/src/tools/miri/src/borrow_tracker/stacked_borrows/diagnostics.rs @@ -189,7 +189,7 @@ struct RetagOp { #[derive(Debug, Clone, Copy, PartialEq)] pub enum RetagCause { Normal, - FnReturnPlace, + InPlaceFnPassing, FnEntry, TwoPhase, } @@ -501,7 +501,7 @@ impl RetagCause { match self { RetagCause::Normal => "retag", RetagCause::FnEntry => "function-entry retag", - RetagCause::FnReturnPlace => "return-place retag", + RetagCause::InPlaceFnPassing => "in-place function argument/return passing protection", RetagCause::TwoPhase => "two-phase retag", } .to_string() diff --git a/src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs b/src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs index ca0f69450c9..e22b352e740 100644 --- a/src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs +++ b/src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs @@ -994,35 +994,25 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { } } - /// After a stack frame got pushed, retag the return place so that we are sure - /// it does not alias with anything. - /// - /// This is a HACK because there is nothing in MIR that would make the retag - /// explicit. Also see <https://github.com/rust-lang/rust/issues/71117>. - fn sb_retag_return_place(&mut self) -> InterpResult<'tcx> { + /// Protect a place so that it cannot be used any more for the duration of the current function + /// call. + /// + /// This is used to ensure soundness of in-place function argument/return passing. + fn sb_protect_place(&mut self, place: &MPlaceTy<'tcx, Provenance>) -> InterpResult<'tcx> { let this = self.eval_context_mut(); - let return_place = &this.frame().return_place; - if return_place.layout.is_zst() { - // There may not be any memory here, nothing to do. - return Ok(()); - } - // We need this to be in-memory to use tagged pointers. - let return_place = this.force_allocation(&return_place.clone())?; - // We have to turn the place into a pointer to use the existing code. + // We have to turn the place into a pointer to use the usual retagging logic. // (The pointer type does not matter, so we use a raw pointer.) - let ptr_layout = this.layout_of(Ty::new_mut_ptr(this.tcx.tcx, return_place.layout.ty))?; - let val = ImmTy::from_immediate(return_place.to_ref(this), ptr_layout); - // Reborrow it. With protection! That is part of the point. + let ptr_layout = this.layout_of(Ty::new_mut_ptr(this.tcx.tcx, place.layout.ty))?; + let ptr = ImmTy::from_immediate(place.to_ref(this), ptr_layout); + // Reborrow it. With protection! That is the entire point. let new_perm = NewPermission::Uniform { perm: Permission::Unique, access: Some(AccessKind::Write), protector: Some(ProtectorKind::StrongProtector), }; - let val = this.sb_retag_reference(&val, new_perm, RetagCause::FnReturnPlace)?; - // And use reborrowed pointer for return place. - let return_place = this.ref_to_mplace(&val)?; - this.frame_mut().return_place = return_place.into(); + let _new_ptr = this.sb_retag_reference(&ptr, new_perm, RetagCause::InPlaceFnPassing)?; + // We just throw away `new_ptr`, so nobody can access this memory while it is protected. Ok(()) } diff --git a/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs b/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs index e134b739888..274a4a0aaba 100644 --- a/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs +++ b/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs @@ -178,7 +178,7 @@ trait EvalContextPrivExt<'mir: 'ecx, 'tcx: 'mir, 'ecx>: crate::MiriInterpCxExt<' &mut self, place: &MPlaceTy<'tcx, Provenance>, // parent tag extracted from here ptr_size: Size, - new_perm: Option<NewPermission>, + new_perm: NewPermission, new_tag: BorTag, ) -> InterpResult<'tcx, Option<(AllocId, BorTag)>> { let this = self.eval_context_mut(); @@ -256,10 +256,6 @@ trait EvalContextPrivExt<'mir: 'ecx, 'tcx: 'mir, 'ecx>: crate::MiriInterpCxExt<' ptr_size.bytes() ); - let Some(new_perm) = new_perm else { - return Ok(Some((alloc_id, orig_tag))); - }; - if let Some(protect) = new_perm.protector { // We register the protection in two different places. // This makes creating a protector slower, but checking whether a tag @@ -305,7 +301,7 @@ trait EvalContextPrivExt<'mir: 'ecx, 'tcx: 'mir, 'ecx>: crate::MiriInterpCxExt<' fn tb_retag_reference( &mut self, val: &ImmTy<'tcx, Provenance>, - new_perm: Option<NewPermission>, + new_perm: NewPermission, ) -> InterpResult<'tcx, ImmTy<'tcx, Provenance>> { let this = self.eval_context_mut(); // We want a place for where the ptr *points to*, so we get one. @@ -317,7 +313,7 @@ trait EvalContextPrivExt<'mir: 'ecx, 'tcx: 'mir, 'ecx>: crate::MiriInterpCxExt<' // - if the pointer is not reborrowed (raw pointer) or if `zero_size` is set // then we override the size to do a zero-length reborrow. let reborrow_size = match new_perm { - Some(NewPermission { zero_size: false, .. }) => + NewPermission { zero_size: false, .. } => this.size_and_align_of_mplace(&place)? .map(|(size, _)| size) .unwrap_or(place.layout.size), @@ -374,7 +370,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { NewPermission::from_ref_ty(pointee, mutability, kind, this), _ => None, }; - this.tb_retag_reference(val, new_perm) + if let Some(new_perm) = new_perm { + this.tb_retag_reference(val, new_perm) + } else { + Ok(val.clone()) + } } /// Retag all pointers that are stored in this place. @@ -405,9 +405,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { place: &PlaceTy<'tcx, Provenance>, new_perm: Option<NewPermission>, ) -> InterpResult<'tcx> { - let val = self.ecx.read_immediate(&self.ecx.place_to_op(place)?)?; - let val = self.ecx.tb_retag_reference(&val, new_perm)?; - self.ecx.write_immediate(*val, place)?; + if let Some(new_perm) = new_perm { + let val = self.ecx.read_immediate(&self.ecx.place_to_op(place)?)?; + let val = self.ecx.tb_retag_reference(&val, new_perm)?; + self.ecx.write_immediate(*val, place)?; + } Ok(()) } } @@ -493,37 +495,25 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { } } - /// After a stack frame got pushed, retag the return place so that we are sure - /// it does not alias with anything. - /// - /// This is a HACK because there is nothing in MIR that would make the retag - /// explicit. Also see <https://github.com/rust-lang/rust/issues/71117>. - fn tb_retag_return_place(&mut self) -> InterpResult<'tcx> { + /// Protect a place so that it cannot be used any more for the duration of the current function + /// call. + /// + /// This is used to ensure soundness of in-place function argument/return passing. + fn tb_protect_place(&mut self, place: &MPlaceTy<'tcx, Provenance>) -> InterpResult<'tcx> { let this = self.eval_context_mut(); - //this.debug_hint_location(); - let return_place = &this.frame().return_place; - if return_place.layout.is_zst() { - // There may not be any memory here, nothing to do. - return Ok(()); - } - // We need this to be in-memory to use tagged pointers. - let return_place = this.force_allocation(&return_place.clone())?; - // We have to turn the place into a pointer to use the existing code. + // We have to turn the place into a pointer to use the usual retagging logic. // (The pointer type does not matter, so we use a raw pointer.) - let ptr_layout = this.layout_of(Ty::new_mut_ptr(this.tcx.tcx, return_place.layout.ty))?; - let val = ImmTy::from_immediate(return_place.to_ref(this), ptr_layout); - // Reborrow it. With protection! That is part of the point. - // FIXME: do we truly want a 2phase borrow here? - let new_perm = Some(NewPermission { - initial_state: Permission::new_unique_2phase(/*freeze*/ false), + let ptr_layout = this.layout_of(Ty::new_mut_ptr(this.tcx.tcx, place.layout.ty))?; + let ptr = ImmTy::from_immediate(place.to_ref(this), ptr_layout); + // Reborrow it. With protection! That is the entire point. + let new_perm = NewPermission { + initial_state: Permission::new_active(), zero_size: false, protector: Some(ProtectorKind::StrongProtector), - }); - let val = this.tb_retag_reference(&val, new_perm)?; - // And use reborrowed pointer for return place. - let return_place = this.ref_to_mplace(&val)?; - this.frame_mut().return_place = return_place.into(); + }; + let _new_ptr = this.tb_retag_reference(&ptr, new_perm)?; + // We just throw away `new_ptr`, so nobody can access this memory while it is protected. Ok(()) } diff --git a/src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs b/src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs index 6b1e722b65e..362070f1857 100644 --- a/src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs +++ b/src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs @@ -138,6 +138,11 @@ impl Permission { Self { inner: Reserved { ty_is_freeze } } } + /// Default initial permission for return place. + pub fn new_active() -> Self { + Self { inner: Active } + } + /// Default initial permission of a reborrowed shared reference pub fn new_frozen() -> Self { Self { inner: Frozen } diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs index 7e92dc7a0c7..4a093d7bcc6 100644 --- a/src/tools/miri/src/lib.rs +++ b/src/tools/miri/src/lib.rs @@ -55,6 +55,7 @@ extern crate rustc_index; extern crate rustc_session; extern crate rustc_span; extern crate rustc_target; +extern crate either; // the one from rustc // Necessary to pull in object code as the rest of the rustc crates are shipped only as rmeta // files. diff --git a/src/tools/miri/src/machine.rs b/src/tools/miri/src/machine.rs index ac2bad22119..5510e3f94b7 100644 --- a/src/tools/miri/src/machine.rs +++ b/src/tools/miri/src/machine.rs @@ -7,6 +7,7 @@ use std::fmt; use std::path::Path; use std::process; +use either::Either; use rand::rngs::StdRng; use rand::SeedableRng; @@ -533,7 +534,7 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> { let target = &tcx.sess.target; match target.arch.as_ref() { "wasm32" | "wasm64" => 64 * 1024, // https://webassembly.github.io/spec/core/exec/runtime.html#memory-instances - "aarch64" => + "aarch64" => { if target.options.vendor.as_ref() == "apple" { // No "definitive" source, but see: // https://www.wwdcnotes.com/notes/wwdc20/10214/ @@ -541,7 +542,8 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> { 16 * 1024 } else { 4 * 1024 - }, + } + } _ => 4 * 1024, } }; @@ -892,7 +894,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> { ecx: &mut MiriInterpCx<'mir, 'tcx>, instance: ty::Instance<'tcx>, abi: Abi, - args: &[OpTy<'tcx, Provenance>], + args: &[FnArg<'tcx, Provenance>], dest: &PlaceTy<'tcx, Provenance>, ret: Option<mir::BasicBlock>, unwind: mir::UnwindAction, @@ -905,12 +907,13 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> { ecx: &mut MiriInterpCx<'mir, 'tcx>, fn_val: Dlsym, abi: Abi, - args: &[OpTy<'tcx, Provenance>], + args: &[FnArg<'tcx, Provenance>], dest: &PlaceTy<'tcx, Provenance>, ret: Option<mir::BasicBlock>, _unwind: mir::UnwindAction, ) -> InterpResult<'tcx> { - ecx.call_dlsym(fn_val, abi, args, dest, ret) + let args = ecx.copy_fn_args(args)?; // FIXME: Should `InPlace` arguments be reset to uninit? + ecx.call_dlsym(fn_val, abi, &args, dest, ret) } #[inline(always)] @@ -1094,8 +1097,9 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> { ptr: Pointer<Self::Provenance>, ) -> InterpResult<'tcx> { match ptr.provenance { - Provenance::Concrete { alloc_id, tag } => - intptrcast::GlobalStateInner::expose_ptr(ecx, alloc_id, tag), + Provenance::Concrete { alloc_id, tag } => { + intptrcast::GlobalStateInner::expose_ptr(ecx, alloc_id, tag) + } Provenance::Wildcard => { // No need to do anything for wildcard pointers as // their provenances have already been previously exposed. @@ -1206,6 +1210,25 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> { Ok(()) } + fn protect_in_place_function_argument( + ecx: &mut InterpCx<'mir, 'tcx, Self>, + place: &PlaceTy<'tcx, Provenance>, + ) -> InterpResult<'tcx> { + // We do need to write `uninit` so that even after the call ends, the former contents of + // this place cannot be observed any more. + ecx.write_uninit(place)?; + // If we have a borrow tracker, we also have it set up protection so that all reads *and + // writes* during this call are insta-UB. + if ecx.machine.borrow_tracker.is_some() { + if let Either::Left(place) = place.as_mplace_or_local() { + ecx.protect_place(&place)?; + } else { + // Locals that don't have their address taken are as protected as they can ever be. + } + } + Ok(()) + } + #[inline(always)] fn init_frame_extra( ecx: &mut InterpCx<'mir, 'tcx, Self>, @@ -1288,8 +1311,17 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> { let stack_len = ecx.active_thread_stack().len(); ecx.active_thread_mut().set_top_user_relevant_frame(stack_len - 1); } - if ecx.machine.borrow_tracker.is_some() { - ecx.retag_return_place()?; + Ok(()) + } + + fn before_stack_pop( + ecx: &InterpCx<'mir, 'tcx, Self>, + frame: &Frame<'mir, 'tcx, Self::Provenance, Self::FrameExtra>, + ) -> InterpResult<'tcx> { + // We want this *before* the return value copy, because the return place itself is protected + // until we do `end_call` here. + if let Some(borrow_tracker) = &ecx.machine.borrow_tracker { + borrow_tracker.borrow_mut().end_call(&frame.extra); } Ok(()) } @@ -1308,9 +1340,6 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> { ecx.active_thread_mut().recompute_top_user_relevant_frame(); } let timing = frame.extra.timing.take(); - if let Some(borrow_tracker) = &ecx.machine.borrow_tracker { - borrow_tracker.borrow_mut().end_call(&frame.extra); - } let res = ecx.handle_stack_pop_unwind(frame.extra, unwinding); if let Some(profiler) = ecx.machine.profiler.as_ref() { profiler.finish_recording_interval_event(timing.unwrap()); diff --git a/src/tools/miri/src/shims/mod.rs b/src/tools/miri/src/shims/mod.rs index a423a0786b7..1027b24e301 100644 --- a/src/tools/miri/src/shims/mod.rs +++ b/src/tools/miri/src/shims/mod.rs @@ -31,7 +31,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { &mut self, instance: ty::Instance<'tcx>, abi: Abi, - args: &[OpTy<'tcx, Provenance>], + args: &[FnArg<'tcx, Provenance>], dest: &PlaceTy<'tcx, Provenance>, ret: Option<mir::BasicBlock>, unwind: mir::UnwindAction, @@ -41,7 +41,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { // There are some more lang items we want to hook that CTFE does not hook (yet). if this.tcx.lang_items().align_offset_fn() == Some(instance.def.def_id()) { - let [ptr, align] = check_arg_count(args)?; + let args = this.copy_fn_args(args)?; + let [ptr, align] = check_arg_count(&args)?; if this.align_offset(ptr, align, dest, ret, unwind)? { return Ok(None); } @@ -55,7 +56,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { // to run extra MIR), and Ok(Some(body)) if we found MIR to run for the // foreign function // Any needed call to `goto_block` will be performed by `emulate_foreign_item`. - return this.emulate_foreign_item(instance.def_id(), abi, args, dest, ret, unwind); + let args = this.copy_fn_args(args)?; // FIXME: Should `InPlace` arguments be reset to uninit? + return this.emulate_foreign_item(instance.def_id(), abi, &args, dest, ret, unwind); } // Otherwise, load the MIR. diff --git a/src/tools/miri/tests/fail/box-cell-alias.stderr b/src/tools/miri/tests/fail/box-cell-alias.stderr index fc946d6d39b..8c68261aaf7 100644 --- a/src/tools/miri/tests/fail/box-cell-alias.stderr +++ b/src/tools/miri/tests/fail/box-cell-alias.stderr @@ -2,7 +2,7 @@ error: Undefined Behavior: trying to retag from <TAG> for SharedReadWrite permis --> $DIR/box-cell-alias.rs:LL:CC | LL | unsafe { (*ptr).set(20) }; - | ^^^^^^^^^^^^^^ + | ^^^^^^ | | | trying to retag from <TAG> for SharedReadWrite permission at ALLOC[0x0], but that tag does not exist in the borrow stack for this location | this error occurs as part of retag at ALLOC[0x0..0x1] diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.rs b/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.rs new file mode 100644 index 00000000000..625a8bda8af --- /dev/null +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.rs @@ -0,0 +1,34 @@ +//@revisions: stack tree +//@[tree]compile-flags: -Zmiri-tree-borrows +#![feature(custom_mir, core_intrinsics)] +use std::intrinsics::mir::*; + +pub struct S(i32); + +#[custom_mir(dialect = "runtime", phase = "optimized")] +fn main() { + mir! { + let unit: (); + { + let non_copy = S(42); + let ptr = std::ptr::addr_of_mut!(non_copy); + // Inside `callee`, the first argument and `*ptr` are basically + // aliasing places! + Call(unit, after_call, callee(Move(*ptr), ptr)) + } + after_call = { + Return() + } + + } +} + +pub fn callee(x: S, ptr: *mut S) { + // With the setup above, if `x` is indeed moved in + // (i.e. we actually just get a pointer to the underlying storage), + // then writing to `ptr` will change the value stored in `x`! + unsafe { ptr.write(S(0)) }; + //~[stack]^ ERROR: not granting access + //~[tree]| ERROR: /write access .* forbidden/ + assert_eq!(x.0, 42); +} diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.stack.stderr b/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.stack.stderr new file mode 100644 index 00000000000..471dc1dd6dd --- /dev/null +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.stack.stderr @@ -0,0 +1,37 @@ +error: Undefined Behavior: not granting access to tag <TAG> because that would remove [Unique for <TAG>] which is strongly protected because it is an argument of call ID + --> $DIR/arg_inplace_mutate.rs:LL:CC + | +LL | unsafe { ptr.write(S(0)) }; + | ^^^^^^^^^^^^^^^ not granting access to tag <TAG> because that would remove [Unique for <TAG>] which is strongly protected because it is an argument of call ID + | + = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental + = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information +help: <TAG> was created by a SharedReadWrite retag at offsets [0x0..0x4] + --> $DIR/arg_inplace_mutate.rs:LL:CC + | +LL | / mir! { +LL | | let unit: (); +LL | | { +LL | | let non_copy = S(42); +... | +LL | | +LL | | } + | |_____^ +help: <TAG> is this argument + --> $DIR/arg_inplace_mutate.rs:LL:CC + | +LL | unsafe { ptr.write(S(0)) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: BACKTRACE (of the first span): + = note: inside `callee` at $DIR/arg_inplace_mutate.rs:LL:CC +note: inside `main` + --> $DIR/arg_inplace_mutate.rs:LL:CC + | +LL | Call(unit, after_call, callee(Move(*ptr), ptr)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `::core::intrinsics::mir::__internal_remove_let` which comes from the expansion of the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace + +error: aborting due to previous error + diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.tree.stderr b/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.tree.stderr new file mode 100644 index 00000000000..35c02cc2ebd --- /dev/null +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.tree.stderr @@ -0,0 +1,39 @@ +error: Undefined Behavior: write access through <TAG> (root of the allocation) is forbidden + --> $DIR/arg_inplace_mutate.rs:LL:CC + | +LL | unsafe { ptr.write(S(0)) }; + | ^^^^^^^^^^^^^^^ write access through <TAG> (root of the allocation) is forbidden + | + = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental + = help: the accessed tag <TAG> (root of the allocation) is foreign to the protected tag <TAG> (i.e., it is not a child) + = help: this foreign write access would cause the protected tag <TAG> to transition from Active to Disabled + = help: this transition would be a loss of read and write permissions, which is not allowed for protected tags +help: the accessed tag <TAG> was created here + --> $DIR/arg_inplace_mutate.rs:LL:CC + | +LL | / mir! { +LL | | let unit: (); +LL | | { +LL | | let non_copy = S(42); +... | +LL | | +LL | | } + | |_____^ +help: the protected tag <TAG> was created here, in the initial state Active + --> $DIR/arg_inplace_mutate.rs:LL:CC + | +LL | unsafe { ptr.write(S(0)) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: BACKTRACE (of the first span): + = note: inside `callee` at $DIR/arg_inplace_mutate.rs:LL:CC +note: inside `main` + --> $DIR/arg_inplace_mutate.rs:LL:CC + | +LL | Call(unit, after_call, callee(Move(*ptr), ptr)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `::core::intrinsics::mir::__internal_remove_let` which comes from the expansion of the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace + +error: aborting due to previous error + diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.rs b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.rs new file mode 100644 index 00000000000..8eda913feb4 --- /dev/null +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.rs @@ -0,0 +1,27 @@ +#![feature(custom_mir, core_intrinsics)] +use std::intrinsics::mir::*; + +pub struct S(i32); + +#[custom_mir(dialect = "runtime", phase = "optimized")] +fn main() { + // FIXME: the span is not great (probably caused by custom MIR) + mir! { //~ERROR: uninitialized + let unit: (); + { + let non_copy = S(42); + // This could change `non_copy` in-place + Call(unit, after_call, change_arg(Move(non_copy))) + } + after_call = { + // So now we must not be allowed to observe non-copy again. + let _observe = non_copy.0; + Return() + } + + } +} + +pub fn change_arg(mut x: S) { + x.0 = 0; +} diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.stderr b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.stderr new file mode 100644 index 00000000000..3ff7976c70b --- /dev/null +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_after.stderr @@ -0,0 +1,22 @@ +error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory + --> $DIR/arg_inplace_observe_after.rs:LL:CC + | +LL | / mir! { +LL | | let unit: (); +LL | | { +LL | | let non_copy = S(42); +... | +LL | | +LL | | } + | |_____^ using uninitialized data, but this operation requires initialized memory + | + = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior + = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information + = note: BACKTRACE: + = note: inside `main` at RUSTLIB/core/src/intrinsics/mir.rs:LL:CC + = note: this error originates in the macro `::core::intrinsics::mir::__internal_remove_let` which comes from the expansion of the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace + +error: aborting due to previous error + diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.none.stderr b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.none.stderr new file mode 100644 index 00000000000..baa91484793 --- /dev/null +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.none.stderr @@ -0,0 +1,20 @@ +error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory + --> $DIR/arg_inplace_observe_during.rs:LL:CC + | +LL | unsafe { ptr.read() }; + | ^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory + | + = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior + = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information + = note: BACKTRACE: + = note: inside `change_arg` at $DIR/arg_inplace_observe_during.rs:LL:CC +note: inside `main` + --> $DIR/arg_inplace_observe_during.rs:LL:CC + | +LL | Call(unit, after_call, change_arg(Move(*ptr), ptr)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace + +error: aborting due to previous error + diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.rs b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.rs new file mode 100644 index 00000000000..2e57872db96 --- /dev/null +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.rs @@ -0,0 +1,34 @@ +//@revisions: stack tree none +//@[tree]compile-flags: -Zmiri-tree-borrows +//@[none]compile-flags: -Zmiri-disable-stacked-borrows +#![feature(custom_mir, core_intrinsics)] +use std::intrinsics::mir::*; + +pub struct S(i32); + +#[custom_mir(dialect = "runtime", phase = "optimized")] +fn main() { + mir! { + let unit: (); + { + let non_copy = S(42); + let ptr = std::ptr::addr_of_mut!(non_copy); + // This could change `non_copy` in-place + Call(unit, after_call, change_arg(Move(*ptr), ptr)) + } + after_call = { + Return() + } + + } +} + +pub fn change_arg(mut x: S, ptr: *mut S) { + x.0 = 0; + // If `x` got passed in-place, we'd see the write through `ptr`! + // Make sure we are not allowed to do that read. + unsafe { ptr.read() }; + //~[stack]^ ERROR: not granting access + //~[tree]| ERROR: /read access .* forbidden/ + //~[none]| ERROR: uninitialized +} diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.stack.stderr b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.stack.stderr new file mode 100644 index 00000000000..a842d3a8044 --- /dev/null +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.stack.stderr @@ -0,0 +1,37 @@ +error: Undefined Behavior: not granting access to tag <TAG> because that would remove [Unique for <TAG>] which is strongly protected because it is an argument of call ID + --> $DIR/arg_inplace_observe_during.rs:LL:CC + | +LL | unsafe { ptr.read() }; + | ^^^^^^^^^^ not granting access to tag <TAG> because that would remove [Unique for <TAG>] which is strongly protected because it is an argument of call ID + | + = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental + = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information +help: <TAG> was created by a SharedReadWrite retag at offsets [0x0..0x4] + --> $DIR/arg_inplace_observe_during.rs:LL:CC + | +LL | / mir! { +LL | | let unit: (); +LL | | { +LL | | let non_copy = S(42); +... | +LL | | +LL | | } + | |_____^ +help: <TAG> is this argument + --> $DIR/arg_inplace_observe_during.rs:LL:CC + | +LL | x.0 = 0; + | ^^^^^^^ + = note: BACKTRACE (of the first span): + = note: inside `change_arg` at $DIR/arg_inplace_observe_during.rs:LL:CC +note: inside `main` + --> $DIR/arg_inplace_observe_during.rs:LL:CC + | +LL | Call(unit, after_call, change_arg(Move(*ptr), ptr)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `::core::intrinsics::mir::__internal_remove_let` which comes from the expansion of the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace + +error: aborting due to previous error + diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.tree.stderr b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.tree.stderr new file mode 100644 index 00000000000..cbd76c38f62 --- /dev/null +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.tree.stderr @@ -0,0 +1,39 @@ +error: Undefined Behavior: read access through <TAG> (root of the allocation) is forbidden + --> $DIR/arg_inplace_observe_during.rs:LL:CC + | +LL | unsafe { ptr.read() }; + | ^^^^^^^^^^ read access through <TAG> (root of the allocation) is forbidden + | + = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental + = help: the accessed tag <TAG> (root of the allocation) is foreign to the protected tag <TAG> (i.e., it is not a child) + = help: this foreign read access would cause the protected tag <TAG> to transition from Active to Frozen + = help: this transition would be a loss of write permissions, which is not allowed for protected tags +help: the accessed tag <TAG> was created here + --> $DIR/arg_inplace_observe_during.rs:LL:CC + | +LL | / mir! { +LL | | let unit: (); +LL | | { +LL | | let non_copy = S(42); +... | +LL | | +LL | | } + | |_____^ +help: the protected tag <TAG> was created here, in the initial state Active + --> $DIR/arg_inplace_observe_during.rs:LL:CC + | +LL | x.0 = 0; + | ^^^^^^^ + = note: BACKTRACE (of the first span): + = note: inside `change_arg` at $DIR/arg_inplace_observe_during.rs:LL:CC +note: inside `main` + --> $DIR/arg_inplace_observe_during.rs:LL:CC + | +LL | Call(unit, after_call, change_arg(Move(*ptr), ptr)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `::core::intrinsics::mir::__internal_remove_let` which comes from the expansion of the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace + +error: aborting due to previous error + diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.none.stderr b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.none.stderr new file mode 100644 index 00000000000..9d9dfc89f89 --- /dev/null +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.none.stderr @@ -0,0 +1,20 @@ +error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory + --> $DIR/return_pointer_aliasing.rs:LL:CC + | +LL | unsafe { ptr.read() }; + | ^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory + | + = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior + = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information + = note: BACKTRACE: + = note: inside `myfun` at $DIR/return_pointer_aliasing.rs:LL:CC +note: inside `main` + --> $DIR/return_pointer_aliasing.rs:LL:CC + | +LL | Call(*ptr, after_call, myfun(ptr)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace + +error: aborting due to previous error + diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.rs b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.rs new file mode 100644 index 00000000000..829809102fa --- /dev/null +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.rs @@ -0,0 +1,34 @@ +//@revisions: stack tree none +//@[tree]compile-flags: -Zmiri-tree-borrows +//@[none]compile-flags: -Zmiri-disable-stacked-borrows +#![feature(raw_ref_op)] +#![feature(core_intrinsics)] +#![feature(custom_mir)] + +use std::intrinsics::mir::*; + +#[custom_mir(dialect = "runtime", phase = "optimized")] +pub fn main() { + mir! { + { + let x = 0; + let ptr = &raw mut x; + // We arrange for `myfun` to have a pointer that aliases + // its return place. Even just reading from that pointer is UB. + Call(*ptr, after_call, myfun(ptr)) + } + + after_call = { + Return() + } + } +} + +fn myfun(ptr: *mut i32) -> i32 { + unsafe { ptr.read() }; + //~[stack]^ ERROR: not granting access + //~[tree]| ERROR: /read access .* forbidden/ + //~[none]| ERROR: uninitialized + // Without an aliasing model, reads are "fine" but at least they return uninit data. + 13 +} diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.stack.stderr b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.stack.stderr new file mode 100644 index 00000000000..d486dcb95df --- /dev/null +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.stack.stderr @@ -0,0 +1,37 @@ +error: Undefined Behavior: not granting access to tag <TAG> because that would remove [Unique for <TAG>] which is strongly protected because it is an argument of call ID + --> $DIR/return_pointer_aliasing.rs:LL:CC + | +LL | unsafe { ptr.read() }; + | ^^^^^^^^^^ not granting access to tag <TAG> because that would remove [Unique for <TAG>] which is strongly protected because it is an argument of call ID + | + = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental + = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information +help: <TAG> was created by a SharedReadWrite retag at offsets [0x0..0x4] + --> $DIR/return_pointer_aliasing.rs:LL:CC + | +LL | / mir! { +LL | | { +LL | | let x = 0; +LL | | let ptr = &raw mut x; +... | +LL | | } +LL | | } + | |_____^ +help: <TAG> is this argument + --> $DIR/return_pointer_aliasing.rs:LL:CC + | +LL | unsafe { ptr.read() }; + | ^^^^^^^^^^^^^^^^^^^^^ + = note: BACKTRACE (of the first span): + = note: inside `myfun` at $DIR/return_pointer_aliasing.rs:LL:CC +note: inside `main` + --> $DIR/return_pointer_aliasing.rs:LL:CC + | +LL | Call(*ptr, after_call, myfun(ptr)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `::core::intrinsics::mir::__internal_remove_let` which comes from the expansion of the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace + +error: aborting due to previous error + diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.tree.stderr b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.tree.stderr new file mode 100644 index 00000000000..c2c9de3f4ee --- /dev/null +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.tree.stderr @@ -0,0 +1,39 @@ +error: Undefined Behavior: read access through <TAG> (root of the allocation) is forbidden + --> $DIR/return_pointer_aliasing.rs:LL:CC + | +LL | unsafe { ptr.read() }; + | ^^^^^^^^^^ read access through <TAG> (root of the allocation) is forbidden + | + = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental + = help: the accessed tag <TAG> (root of the allocation) is foreign to the protected tag <TAG> (i.e., it is not a child) + = help: this foreign read access would cause the protected tag <TAG> to transition from Active to Frozen + = help: this transition would be a loss of write permissions, which is not allowed for protected tags +help: the accessed tag <TAG> was created here + --> $DIR/return_pointer_aliasing.rs:LL:CC + | +LL | / mir! { +LL | | { +LL | | let x = 0; +LL | | let ptr = &raw mut x; +... | +LL | | } +LL | | } + | |_____^ +help: the protected tag <TAG> was created here, in the initial state Active + --> $DIR/return_pointer_aliasing.rs:LL:CC + | +LL | unsafe { ptr.read() }; + | ^^^^^^^^^^^^^^^^^^^^^ + = note: BACKTRACE (of the first span): + = note: inside `myfun` at $DIR/return_pointer_aliasing.rs:LL:CC +note: inside `main` + --> $DIR/return_pointer_aliasing.rs:LL:CC + | +LL | Call(*ptr, after_call, myfun(ptr)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `::core::intrinsics::mir::__internal_remove_let` which comes from the expansion of the macro `mir` (in Nightly builds, run with -Z macro-backtrace for more info) + +note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace + +error: aborting due to previous error + diff --git a/src/tools/miri/tests/fail/stacked_borrows/illegal_read7.stderr b/src/tools/miri/tests/fail/stacked_borrows/illegal_read7.stderr index b76446d60f6..1a9d551431c 100644 --- a/src/tools/miri/tests/fail/stacked_borrows/illegal_read7.stderr +++ b/src/tools/miri/tests/fail/stacked_borrows/illegal_read7.stderr @@ -2,7 +2,7 @@ error: Undefined Behavior: trying to retag from <TAG> for SharedReadWrite permis --> $DIR/illegal_read7.rs:LL:CC | LL | let _val = *x.get_mut(); - | ^^^^^^^^^^^ + | ^ | | | trying to retag from <TAG> for SharedReadWrite permission at ALLOC[0x0], but that tag does not exist in the borrow stack for this location | this error occurs as part of two-phase retag at ALLOC[0x0..0x4] diff --git a/src/tools/miri/tests/fail/stacked_borrows/interior_mut1.stderr b/src/tools/miri/tests/fail/stacked_borrows/interior_mut1.stderr index da55e724fd8..ba8977c5674 100644 --- a/src/tools/miri/tests/fail/stacked_borrows/interior_mut1.stderr +++ b/src/tools/miri/tests/fail/stacked_borrows/interior_mut1.stderr @@ -2,7 +2,7 @@ error: Undefined Behavior: trying to retag from <TAG> for SharedReadWrite permis --> $DIR/interior_mut1.rs:LL:CC | LL | let _val = *inner_shr.get(); - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^ | | | trying to retag from <TAG> for SharedReadWrite permission at ALLOC[0x0], but that tag does not exist in the borrow stack for this location | this error occurs as part of retag at ALLOC[0x0..0x4] diff --git a/src/tools/miri/tests/fail/stacked_borrows/interior_mut2.stderr b/src/tools/miri/tests/fail/stacked_borrows/interior_mut2.stderr index 8c8a96cbbbd..97ebe72bf29 100644 --- a/src/tools/miri/tests/fail/stacked_borrows/interior_mut2.stderr +++ b/src/tools/miri/tests/fail/stacked_borrows/interior_mut2.stderr @@ -2,7 +2,7 @@ error: Undefined Behavior: trying to retag from <TAG> for SharedReadWrite permis --> $DIR/interior_mut2.rs:LL:CC | LL | let _val = *inner_shr.get(); - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^ | | | trying to retag from <TAG> for SharedReadWrite permission at ALLOC[0x0], but that tag does not exist in the borrow stack for this location | this error occurs as part of retag at ALLOC[0x0..0x4] diff --git a/src/tools/miri/tests/fail/stacked_borrows/shared_rw_borrows_are_weak1.stderr b/src/tools/miri/tests/fail/stacked_borrows/shared_rw_borrows_are_weak1.stderr index 589e1291ba7..10f97180b75 100644 --- a/src/tools/miri/tests/fail/stacked_borrows/shared_rw_borrows_are_weak1.stderr +++ b/src/tools/miri/tests/fail/stacked_borrows/shared_rw_borrows_are_weak1.stderr @@ -2,7 +2,7 @@ error: Undefined Behavior: trying to retag from <TAG> for SharedReadWrite permis --> $DIR/shared_rw_borrows_are_weak1.rs:LL:CC | LL | y.get_mut(); - | ^^^^^^^^^^^ + | ^ | | | trying to retag from <TAG> for SharedReadWrite permission at ALLOC[0x0], but that tag does not exist in the borrow stack for this location | this error occurs as part of two-phase retag at ALLOC[0x0..0x4] diff --git a/src/tools/miri/tests/fail/tree_borrows/fnentry_invalidation.stderr b/src/tools/miri/tests/fail/tree_borrows/fnentry_invalidation.stderr index 227c465b8f0..0f1e7735a0e 100644 --- a/src/tools/miri/tests/fail/tree_borrows/fnentry_invalidation.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/fnentry_invalidation.stderr @@ -21,7 +21,7 @@ help: the accessed tag <TAG> later transitioned to Frozen due to a reborrow (act --> $DIR/fnentry_invalidation.rs:LL:CC | LL | x.do_bad(); - | ^^^^^^^^^^ + | ^ = help: this transition corresponds to a loss of write permissions = note: BACKTRACE (of the first span): = note: inside `main` at $DIR/fnentry_invalidation.rs:LL:CC diff --git a/src/tools/miri/tests/fail/tree_borrows/write-during-2phase.stderr b/src/tools/miri/tests/fail/tree_borrows/write-during-2phase.stderr index ce71468425f..3a82d028704 100644 --- a/src/tools/miri/tests/fail/tree_borrows/write-during-2phase.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/write-during-2phase.stderr @@ -9,15 +9,8 @@ LL | fn add(&mut self, n: u64) -> u64 { help: the accessed tag <TAG> was created here, in the initial state Reserved --> $DIR/write-during-2phase.rs:LL:CC | -LL | let _res = f.add(unsafe { - | ________________^ -LL | | let n = f.0; -LL | | // This is the access at fault, but it's not immediately apparent because -LL | | // the reference that got invalidated is not under a Protector. -LL | | *inner = 42; -LL | | n -LL | | }); - | |______^ +LL | let _res = f.add(unsafe { + | ^ help: the accessed tag <TAG> later transitioned to Disabled due to a foreign write access at offsets [0x0..0x8] --> $DIR/write-during-2phase.rs:LL:CC | diff --git a/src/tools/miri/tests/fail/unaligned_pointers/dyn_alignment.rs b/src/tools/miri/tests/fail/unaligned_pointers/dyn_alignment.rs index 6d31ded75c6..555aa57de30 100644 --- a/src/tools/miri/tests/fail/unaligned_pointers/dyn_alignment.rs +++ b/src/tools/miri/tests/fail/unaligned_pointers/dyn_alignment.rs @@ -1,5 +1,6 @@ -// should find the bug even without validation and stacked borrows, but gets masked by optimizations -//@compile-flags: -Zmiri-disable-validation -Zmiri-disable-stacked-borrows -Zmir-opt-level=0 -Cdebug-assertions=no +// should find the bug even without, but gets masked by optimizations +//@compile-flags: -Zmiri-disable-stacked-borrows -Zmir-opt-level=0 -Cdebug-assertions=no +//@normalize-stderr-test: "but found [0-9]+" -> "but found $$ALIGN" #[repr(align(256))] #[derive(Debug)] @@ -19,6 +20,6 @@ fn main() { (&mut ptr as *mut _ as *mut *const u8).write(&buf as *const _ as *const u8); } // Re-borrow that. This should be UB. - let _ptr = &*ptr; //~ERROR: alignment 256 is required + let _ptr = &*ptr; //~ERROR: required 256 byte alignment } } diff --git a/src/tools/miri/tests/fail/unaligned_pointers/dyn_alignment.stderr b/src/tools/miri/tests/fail/unaligned_pointers/dyn_alignment.stderr index a900b46612b..503721b9551 100644 --- a/src/tools/miri/tests/fail/unaligned_pointers/dyn_alignment.stderr +++ b/src/tools/miri/tests/fail/unaligned_pointers/dyn_alignment.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: accessing memory with alignment ALIGN, but alignment ALIGN is required +error: Undefined Behavior: constructing invalid value: encountered an unaligned reference (required 256 byte alignment but found $ALIGN) --> $DIR/dyn_alignment.rs:LL:CC | LL | let _ptr = &*ptr; - | ^^^^^ accessing memory with alignment ALIGN, but alignment ALIGN is required + | ^^^^^ constructing invalid value: encountered an unaligned reference (required 256 byte alignment but found $ALIGN) | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information diff --git a/src/tools/miri/tests/pass/function_calls/return_place_on_heap.rs b/src/tools/miri/tests/pass/function_calls/return_place_on_heap.rs new file mode 100644 index 00000000000..dcfebd0f82b --- /dev/null +++ b/src/tools/miri/tests/pass/function_calls/return_place_on_heap.rs @@ -0,0 +1,25 @@ +#![feature(raw_ref_op)] +#![feature(core_intrinsics)] +#![feature(custom_mir)] + +use std::intrinsics::mir::*; + +// Make sure calls with the return place "on the heap" work. +#[custom_mir(dialect = "runtime", phase = "optimized")] +pub fn main() { + mir! { + { + let x = 0; + let ptr = &raw mut x; + Call(*ptr, after_call, myfun()) + } + + after_call = { + Return() + } + } +} + +fn myfun() -> i32 { + 13 +} diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 2c237c418b1..9f0f0d86c8b 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -56,6 +56,9 @@ const EXCEPTIONS_CARGO: &[(&str, &str)] = &[ // tidy-alphabetical-start ("bitmaps", "MPL-2.0+"), ("bytesize", "Apache-2.0"), + ("ciborium", "Apache-2.0"), + ("ciborium-io", "Apache-2.0"), + ("ciborium-ll", "Apache-2.0"), ("dunce", "CC0-1.0 OR MIT-0 OR Apache-2.0"), ("fiat-crypto", "MIT OR Apache-2.0 OR BSD-1-Clause"), ("im-rc", "MPL-2.0+"), diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 55bf38110a6..c3a63952841 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -10,7 +10,7 @@ use std::path::{Path, PathBuf}; const ENTRY_LIMIT: usize = 900; // FIXME: The following limits should be reduced eventually. -const ISSUES_ENTRY_LIMIT: usize = 1896; +const ISSUES_ENTRY_LIMIT: usize = 1894; const ROOT_ENTRY_LIMIT: usize = 870; const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[ diff --git a/tests/codegen/simd-wide-sum.rs b/tests/codegen/simd-wide-sum.rs index db2aa20bde7..3116f9597bc 100644 --- a/tests/codegen/simd-wide-sum.rs +++ b/tests/codegen/simd-wide-sum.rs @@ -1,6 +1,11 @@ +// revisions: llvm mir-opt3 // compile-flags: -C opt-level=3 -Z merge-functions=disabled --edition=2021 // only-x86_64 // ignore-debug: the debug assertions get in the way +// [mir-opt3]compile-flags: -Zmir-opt-level=3 +// [mir-opt3]build-pass + +// mir-opt3 is a regression test for https://github.com/rust-lang/rust/issues/98016 #![crate_type = "lib"] #![feature(portable_simd)] @@ -47,9 +52,8 @@ pub fn wider_reduce_iter(x: Simd<u8, N>) -> u16 { #[no_mangle] // CHECK-LABEL: @wider_reduce_into_iter pub fn wider_reduce_into_iter(x: Simd<u8, N>) -> u16 { - // FIXME MIR inlining messes up LLVM optimizations. - // WOULD-CHECK: zext <8 x i8> - // WOULD-CHECK-SAME: to <8 x i16> - // WOULD-CHECK: call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> + // CHECK: zext <8 x i8> + // CHECK-SAME: to <8 x i16> + // CHECK: call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> x.to_array().into_iter().map(u16::from).sum() } diff --git a/tests/rustdoc-gui/source-anchor-scroll.goml b/tests/rustdoc-gui/source-anchor-scroll.goml index 67f1497e70c..0e4913cafb2 100644 --- a/tests/rustdoc-gui/source-anchor-scroll.goml +++ b/tests/rustdoc-gui/source-anchor-scroll.goml @@ -7,11 +7,11 @@ set-window-size: (600, 800) // We check that the scroll is at the top first. assert-property: ("html", {"scrollTop": "0"}) -click: '//a[text() = "barbar"]' +click: '//a[text() = "barbar" and @href="#5-7"]' assert-property: ("html", {"scrollTop": "149"}) -click: '//a[text() = "bar"]' +click: '//a[text() = "bar" and @href="#28-36"]' assert-property: ("html", {"scrollTop": "180"}) -click: '//a[text() = "sub_fn"]' +click: '//a[text() = "sub_fn" and @href="#2-4"]' assert-property: ("html", {"scrollTop": "77"}) // We now check that clicking on lines doesn't change the scroll diff --git a/tests/rustdoc/check-source-code-urls-to-def.rs b/tests/rustdoc/check-source-code-urls-to-def.rs index 41b9d41fa44..b803c7e9e86 100644 --- a/tests/rustdoc/check-source-code-urls-to-def.rs +++ b/tests/rustdoc/check-source-code-urls-to-def.rs @@ -14,10 +14,10 @@ extern crate source_code; #[path = "auxiliary/source-code-bar.rs"] pub mod bar; -// @count - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#5"]' 4 +// @count - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#5-7"]' 4 use bar::Bar; -// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#13"]' 'self' -// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14"]' 'Trait' +// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#13-17"]' 'self' +// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14-16"]' 'Trait' use bar::sub::{self, Trait}; pub struct Foo; @@ -32,7 +32,8 @@ fn babar() {} // @has - '//pre[@class="rust"]//a/@href' '/primitive.u32.html' // @has - '//pre[@class="rust"]//a/@href' '/primitive.str.html' // @count - '//pre[@class="rust"]//a[@href="#23"]' 5 -// @has - '//pre[@class="rust"]//a[@href="../../source_code/struct.SourceCode.html"]' 'source_code::SourceCode' +// @has - '//pre[@class="rust"]//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) { let x = 12; let y: Foo = Foo; @@ -42,15 +43,15 @@ pub fn foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar, f: source_code::Sour y.hello(); } -// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14"]' 'bar::sub::Trait' -// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14"]' 'Trait' +// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14-16"]' 'bar::sub::Trait' +// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14-16"]' 'Trait' pub fn foo2<T: bar::sub::Trait, V: Trait>(t: &T, v: &V, b: bool) {} pub trait AnotherTrait {} pub trait WhyNot {} -// @has - '//pre[@class="rust"]//a[@href="#49"]' 'AnotherTrait' -// @has - '//pre[@class="rust"]//a[@href="#50"]' 'WhyNot' +// @has - '//pre[@class="rust"]//a[@href="#50"]' 'AnotherTrait' +// @has - '//pre[@class="rust"]//a[@href="#51"]' 'WhyNot' pub fn foo3<T, V>(t: &T, v: &V) where T: AnotherTrait, @@ -59,7 +60,7 @@ where pub trait AnotherTrait2 {} -// @has - '//pre[@class="rust"]//a[@href="#60"]' 'AnotherTrait2' +// @has - '//pre[@class="rust"]//a[@href="#61"]' 'AnotherTrait2' pub fn foo4() { let x: Vec<AnotherTrait2> = Vec::new(); } diff --git a/tests/rustdoc/jump-to-def-doc-links.rs b/tests/rustdoc/jump-to-def-doc-links.rs new file mode 100644 index 00000000000..014d5803299 --- /dev/null +++ b/tests/rustdoc/jump-to-def-doc-links.rs @@ -0,0 +1,51 @@ +// compile-flags: -Zunstable-options --generate-link-to-definition + +#![crate_name = "foo"] + +// @has 'src/foo/jump-to-def-doc-links.rs.html' + +// @has - '//a[@href="../../foo/struct.Bar.html"]' 'Bar' +// @has - '//a[@href="../../foo/struct.Foo.html"]' 'Foo' +pub struct Bar; pub struct Foo; + +// @has - '//a[@href="../../foo/enum.Enum.html"]' 'Enum' +pub enum Enum { + Variant1(String), + Variant2(u8), +} + +// @has - '//a[@href="../../foo/struct.Struct.html"]' 'Struct' +pub struct Struct { + pub a: u8, + b: Foo, +} + +impl Struct { + pub fn foo() {} + pub fn foo2(&self) {} + fn bar() {} + fn bar(&self) {} +} + +// @has - '//a[@href="../../foo/trait.Trait.html"]' 'Trait' +pub trait Trait { + fn foo(); +} + +impl Trait for Struct { + fn foo() {} +} + +// @has - '//a[@href="../../foo/union.Union.html"]' 'Union' +pub union Union { + pub a: u16, + pub f: u32, +} + +// @has - '//a[@href="../../foo/fn.bar.html"]' 'bar' +pub fn bar(b: Bar) { + let x = Foo; +} + +// @has - '//a[@href="../../foo/bar/index.html"]' 'bar' +pub mod bar {} diff --git a/tests/ui/array-slice-vec/vec-mut-iter-borrow.stderr b/tests/ui/array-slice-vec/vec-mut-iter-borrow.stderr index 0ec263c850e..679fd899773 100644 --- a/tests/ui/array-slice-vec/vec-mut-iter-borrow.stderr +++ b/tests/ui/array-slice-vec/vec-mut-iter-borrow.stderr @@ -7,7 +7,7 @@ LL | for x in &mut xs { | first mutable borrow occurs here | first borrow later used here LL | xs.push(1) - | ^^^^^^^^^^ second mutable borrow occurs here + | ^^ second mutable borrow occurs here error: aborting due to previous error diff --git a/tests/ui/async-await/clone-suggestion.stderr b/tests/ui/async-await/clone-suggestion.stderr index c02206f6f9b..b5c8ef6993d 100644 --- a/tests/ui/async-await/clone-suggestion.stderr +++ b/tests/ui/async-await/clone-suggestion.stderr @@ -13,7 +13,7 @@ note: `into_future` takes ownership of the receiver `self`, which moves `f` help: you can `clone` the value and consume it, but this might not be your desired behavior | LL | f.clone().await; - | ++++++++ + | ++++++++ error: aborting due to previous error diff --git a/tests/ui/async-await/issue-61452.stderr b/tests/ui/async-await/issue-61452.stderr index bf504432880..3f623ba8ad2 100644 --- a/tests/ui/async-await/issue-61452.stderr +++ b/tests/ui/async-await/issue-61452.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable --> $DIR/issue-61452.rs:4:5 | LL | x.take(); - | ^^^^^^^^ cannot borrow as mutable + | ^ cannot borrow as mutable | help: consider changing this to be mutable | diff --git a/tests/ui/async-await/issues/issue-61187.stderr b/tests/ui/async-await/issues/issue-61187.stderr index e58f7454689..203b17550a0 100644 --- a/tests/ui/async-await/issues/issue-61187.stderr +++ b/tests/ui/async-await/issues/issue-61187.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `data` as mutable, as it is not declared as mutable --> $DIR/issue-61187.rs:6:5 | LL | data.reverse(); - | ^^^^^^^^^^^^^^ cannot borrow as mutable + | ^^^^ cannot borrow as mutable | help: consider changing this to be mutable | diff --git a/tests/ui/binop/binop-move-semantics.stderr b/tests/ui/binop/binop-move-semantics.stderr index 8645169b98a..1dd8c9a87d4 100644 --- a/tests/ui/binop/binop-move-semantics.stderr +++ b/tests/ui/binop/binop-move-semantics.stderr @@ -27,7 +27,7 @@ LL | x | - value moved here LL | + LL | x.clone(); - | ^^^^^^^^^ value borrowed here after move + | ^ value borrowed here after move | help: consider cloning the value if the performance cost is acceptable | diff --git a/tests/ui/borrowck/borrow-tuple-fields.stderr b/tests/ui/borrowck/borrow-tuple-fields.stderr index d7d3efe492c..e324ebfb50f 100644 --- a/tests/ui/borrowck/borrow-tuple-fields.stderr +++ b/tests/ui/borrowck/borrow-tuple-fields.stderr @@ -9,7 +9,7 @@ LL | let y = x; | ^ move out of `x` occurs here LL | LL | r.use_ref(); - | ----------- borrow later used here + | - borrow later used here error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable --> $DIR/borrow-tuple-fields.rs:18:13 @@ -19,7 +19,7 @@ LL | let a = &x.0; LL | let b = &mut x.0; | ^^^^^^^^ mutable borrow occurs here LL | a.use_ref(); - | ----------- immutable borrow later used here + | - immutable borrow later used here error[E0499]: cannot borrow `x.0` as mutable more than once at a time --> $DIR/borrow-tuple-fields.rs:23:13 @@ -29,7 +29,7 @@ LL | let a = &mut x.0; LL | let b = &mut x.0; | ^^^^^^^^ second mutable borrow occurs here LL | a.use_ref(); - | ----------- first borrow later used here + | - first borrow later used here error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/borrow-tuple-fields.rs:28:13 @@ -41,7 +41,7 @@ LL | let r = &x.0; LL | let y = x; | ^ move out of `x` occurs here LL | r.use_ref(); - | ----------- borrow later used here + | - borrow later used here error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable --> $DIR/borrow-tuple-fields.rs:33:13 @@ -51,7 +51,7 @@ LL | let a = &x.0; LL | let b = &mut x.0; | ^^^^^^^^ mutable borrow occurs here LL | a.use_ref(); - | ----------- immutable borrow later used here + | - immutable borrow later used here error[E0499]: cannot borrow `x.0` as mutable more than once at a time --> $DIR/borrow-tuple-fields.rs:38:13 @@ -61,7 +61,7 @@ LL | let a = &mut x.0; LL | let b = &mut x.0; | ^^^^^^^^ second mutable borrow occurs here LL | a.use_mut(); - | ----------- first borrow later used here + | - first borrow later used here error: aborting due to 6 previous errors diff --git a/tests/ui/borrowck/borrowck-argument.stderr b/tests/ui/borrowck/borrowck-argument.stderr index 1c992dfcceb..8ad5623c8b8 100644 --- a/tests/ui/borrowck/borrowck-argument.stderr +++ b/tests/ui/borrowck/borrowck-argument.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable --> $DIR/borrowck-argument.rs:10:5 | LL | arg.mutate(); - | ^^^^^^^^^^^^ cannot borrow as mutable + | ^^^ cannot borrow as mutable | help: consider changing this to be mutable | @@ -13,7 +13,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable --> $DIR/borrowck-argument.rs:15:9 | LL | arg.mutate(); - | ^^^^^^^^^^^^ cannot borrow as mutable + | ^^^ cannot borrow as mutable | help: consider changing this to be mutable | @@ -24,7 +24,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable --> $DIR/borrowck-argument.rs:21:9 | LL | arg.mutate(); - | ^^^^^^^^^^^^ cannot borrow as mutable + | ^^^ cannot borrow as mutable | help: consider changing this to be mutable | @@ -35,7 +35,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable --> $DIR/borrowck-argument.rs:32:17 | LL | (|arg: S| { arg.mutate() })(s); - | ^^^^^^^^^^^^ cannot borrow as mutable + | ^^^ cannot borrow as mutable | help: consider changing this to be mutable | diff --git a/tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr b/tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr index 19ef0301a2d..25d642c30dd 100644 --- a/tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr +++ b/tests/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable --> $DIR/borrowck-auto-mut-ref-to-immut-var.rs:15:5 | LL | x.printme(); - | ^^^^^^^^^^^ cannot borrow as mutable + | ^ cannot borrow as mutable | help: consider changing this to be mutable | diff --git a/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr b/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr index 3c28ff56e41..a61fdbf6c8f 100644 --- a/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr +++ b/tests/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*a` as mutable, as `a` is not declared as mutable --> $DIR/borrowck-borrow-immut-deref-of-box-as-mut.rs:12:5 | LL | a.foo(); - | ^^^^^^^ cannot borrow as mutable + | ^ cannot borrow as mutable | help: consider changing this to be mutable | diff --git a/tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr b/tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr index 42b6c34cd2f..fa0ae318e72 100644 --- a/tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr +++ b/tests/ui/borrowck/borrowck-borrow-mut-object-twice.stderr @@ -2,11 +2,11 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time --> $DIR/borrowck-borrow-mut-object-twice.rs:13:5 | LL | let y = x.f1(); - | ------ first mutable borrow occurs here + | - first mutable borrow occurs here LL | x.f2(); - | ^^^^^^ second mutable borrow occurs here + | ^ second mutable borrow occurs here LL | y.use_ref(); - | ----------- first borrow later used here + | - first borrow later used here error: aborting due to previous error diff --git a/tests/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr b/tests/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr index fdf6568d839..426d5bc4726 100644 --- a/tests/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr +++ b/tests/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr @@ -58,7 +58,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:72:5 | LL | x.set(0, 0); - | ^^^^^^^^^^^ cannot borrow as mutable + | ^ cannot borrow as mutable | = help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>` @@ -66,7 +66,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:76:5 | LL | x.set(0, 0); - | ^^^^^^^^^^^ cannot borrow as mutable + | ^ cannot borrow as mutable | = help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>` @@ -74,7 +74,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:84:5 | LL | x.y_mut() - | ^^^^^^^^^ cannot borrow as mutable + | ^ cannot borrow as mutable | = help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>` @@ -82,7 +82,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:88:5 | LL | x.y_mut() - | ^^^^^^^^^ cannot borrow as mutable + | ^ cannot borrow as mutable | = help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>` @@ -90,7 +90,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:92:6 | LL | *x.y_mut() = 3; - | ^^^^^^^^^ cannot borrow as mutable + | ^ cannot borrow as mutable | = help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>` @@ -98,7 +98,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:96:6 | LL | *x.y_mut() = 3; - | ^^^^^^^^^ cannot borrow as mutable + | ^ cannot borrow as mutable | = help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>` @@ -106,7 +106,7 @@ error[E0596]: cannot borrow data in an `Rc` as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:100:6 | LL | *x.y_mut() = 3; - | ^^^^^^^^^ cannot borrow as mutable + | ^ cannot borrow as mutable | = help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Point>` diff --git a/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr b/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr index c62d5f903c8..7ee840b34c5 100644 --- a/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr +++ b/tests/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr @@ -7,7 +7,7 @@ LL | buggy_map.insert(42, &*Box::new(1)); | creates a temporary value which is freed while still in use ... LL | buggy_map.insert(43, &*tmp); - | --------------------------- borrow later used here + | --------- borrow later used here | help: consider using a `let` binding to create a longer lived value | diff --git a/tests/ui/borrowck/borrowck-closures-unique-imm.stderr b/tests/ui/borrowck/borrowck-closures-unique-imm.stderr index 0c5fd39b718..b8bbb31a355 100644 --- a/tests/ui/borrowck/borrowck-closures-unique-imm.stderr +++ b/tests/ui/borrowck/borrowck-closures-unique-imm.stderr @@ -6,7 +6,7 @@ LL | let p = &this.x; LL | &mut this.x; | ^^^^^^^^^^^ mutable borrow occurs here LL | p.use_ref(); - | ----------- immutable borrow later used here + | - immutable borrow later used here error: aborting due to previous error diff --git a/tests/ui/borrowck/borrowck-describe-lvalue.stderr b/tests/ui/borrowck/borrowck-describe-lvalue.stderr index cb29c9fdac3..11f2e42d42b 100644 --- a/tests/ui/borrowck/borrowck-describe-lvalue.stderr +++ b/tests/ui/borrowck/borrowck-describe-lvalue.stderr @@ -45,7 +45,7 @@ error[E0503]: cannot use `f.x` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:37:9 | LL | let x = f.x(); - | ----- `f` is borrowed here + | - `f` is borrowed here LL | f.x; | ^^^ use of borrowed `f` LL | drop(x); @@ -55,7 +55,7 @@ error[E0503]: cannot use `g.0` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:44:9 | LL | let x = g.x(); - | ----- `g` is borrowed here + | - `g` is borrowed here LL | g.0; | ^^^ use of borrowed `g` LL | drop(x); @@ -75,7 +75,7 @@ error[E0503]: cannot use `e.0` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:59:20 | LL | let x = e.x(); - | ----- `e` is borrowed here + | - `e` is borrowed here LL | match e { LL | Baz::X(value) => value | ^^^^^ use of borrowed `e` @@ -97,7 +97,7 @@ error[E0503]: cannot use `f.x` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:74:9 | LL | let x = f.x(); - | ----- `*f` is borrowed here + | - `*f` is borrowed here LL | f.x; | ^^^ use of borrowed `*f` LL | drop(x); @@ -107,7 +107,7 @@ error[E0503]: cannot use `g.0` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:81:9 | LL | let x = g.x(); - | ----- `*g` is borrowed here + | - `*g` is borrowed here LL | g.0; | ^^^ use of borrowed `*g` LL | drop(x); @@ -127,7 +127,7 @@ error[E0503]: cannot use `e.0` because it was mutably borrowed --> $DIR/borrowck-describe-lvalue.rs:96:20 | LL | let x = e.x(); - | ----- `*e` is borrowed here + | - `*e` is borrowed here LL | match *e { LL | Baz::X(value) => value | ^^^^^ use of borrowed `*e` diff --git a/tests/ui/borrowck/borrowck-insert-during-each.stderr b/tests/ui/borrowck/borrowck-insert-during-each.stderr index 99d08e905d5..a1ac45795fa 100644 --- a/tests/ui/borrowck/borrowck-insert-during-each.stderr +++ b/tests/ui/borrowck/borrowck-insert-during-each.stderr @@ -16,17 +16,15 @@ LL | | }) error[E0500]: closure requires unique access to `f` but it is already borrowed --> $DIR/borrowck-insert-during-each.rs:18:9 | -LL | f.foo( - | - --- first borrow later used by call - | _____| - | | -LL | | -LL | | |a| { - | | ^^^ closure construction occurs here -LL | | f.n.insert(*a); - | | --- second borrow occurs due to use of `f` in closure -LL | | }) - | |__________- borrow occurs here +LL | f.foo( + | - --- first borrow later used by call + | | + | borrow occurs here +LL | +LL | |a| { + | ^^^ closure construction occurs here +LL | f.n.insert(*a); + | --- second borrow occurs due to use of `f` in closure error: aborting due to 2 previous errors diff --git a/tests/ui/borrowck/borrowck-issue-2657-1.stderr b/tests/ui/borrowck/borrowck-issue-2657-1.stderr index 390bb9384f8..4ea4eb8f007 100644 --- a/tests/ui/borrowck/borrowck-issue-2657-1.stderr +++ b/tests/ui/borrowck/borrowck-issue-2657-1.stderr @@ -6,7 +6,7 @@ LL | Some(ref _y) => { LL | let _a = x; | ^ move out of `x` occurs here LL | _y.use_ref(); - | ------------ borrow later used here + | -- borrow later used here error: aborting due to previous error diff --git a/tests/ui/borrowck/borrowck-lend-flow-if.stderr b/tests/ui/borrowck/borrowck-lend-flow-if.stderr index e47efc0e0b3..68a82bdb57c 100644 --- a/tests/ui/borrowck/borrowck-lend-flow-if.stderr +++ b/tests/ui/borrowck/borrowck-lend-flow-if.stderr @@ -7,7 +7,7 @@ LL | } LL | borrow_mut(&mut *v); | ^^^^^^^ mutable borrow occurs here LL | _w.use_ref(); - | ------------ immutable borrow later used here + | -- immutable borrow later used here error: aborting due to previous error diff --git a/tests/ui/borrowck/borrowck-lend-flow.stderr b/tests/ui/borrowck/borrowck-lend-flow.stderr index 40c14f54cb8..07b11b3e728 100644 --- a/tests/ui/borrowck/borrowck-lend-flow.stderr +++ b/tests/ui/borrowck/borrowck-lend-flow.stderr @@ -6,7 +6,7 @@ LL | let _w = &v; LL | borrow_mut(&mut *v); | ^^^^^^^ mutable borrow occurs here LL | _w.use_ref(); - | ------------ immutable borrow later used here + | -- immutable borrow later used here error: aborting due to previous error diff --git a/tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr b/tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr index 6eabfff9054..86479043a06 100644 --- a/tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr +++ b/tests/ui/borrowck/borrowck-loan-blocks-move-cc.stderr @@ -12,7 +12,7 @@ LL | println!("v={}", *v); | -- move occurs due to use in closure LL | }); LL | w.use_ref(); - | ----------- borrow later used here + | - borrow later used here error[E0505]: cannot move out of `v` because it is borrowed --> $DIR/borrowck-loan-blocks-move-cc.rs:24:19 @@ -28,7 +28,7 @@ LL | println!("v={}", *v); | -- move occurs due to use in closure LL | }); LL | w.use_ref(); - | ----------- borrow later used here + | - borrow later used here error: aborting due to 2 previous errors diff --git a/tests/ui/borrowck/borrowck-loan-blocks-move.stderr b/tests/ui/borrowck/borrowck-loan-blocks-move.stderr index 38e06fa0187..de8da490c2e 100644 --- a/tests/ui/borrowck/borrowck-loan-blocks-move.stderr +++ b/tests/ui/borrowck/borrowck-loan-blocks-move.stderr @@ -8,7 +8,7 @@ LL | let w = &v; LL | take(v); | ^ move out of `v` occurs here LL | w.use_ref(); - | ----------- borrow later used here + | - borrow later used here error: aborting due to previous error diff --git a/tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr b/tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr index e1b99162088..93622a0c5f6 100644 --- a/tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr +++ b/tests/ui/borrowck/borrowck-loan-in-overloaded-op.stderr @@ -4,7 +4,7 @@ error[E0382]: borrow of moved value: `x` LL | let x = Foo(Box::new(3)); | - move occurs because `x` has type `Foo`, which does not implement the `Copy` trait LL | let _y = {x} + x.clone(); // the `{x}` forces a move to occur - | - ^^^^^^^^^ value borrowed here after move + | - ^ value borrowed here after move | | | value moved here | diff --git a/tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr b/tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr index f1640d3b777..bb90b2d15df 100644 --- a/tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr +++ b/tests/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr @@ -17,7 +17,7 @@ LL | let q = &mut p; | ------ mutable borrow occurs here ... LL | p.times(3); - | ^^^^^^^^^^ immutable borrow occurs here + | ^ immutable borrow occurs here LL | LL | *q + 3; // OK to use the new alias `q` | -- mutable borrow later used here diff --git a/tests/ui/borrowck/borrowck-loan-rcvr.stderr b/tests/ui/borrowck/borrowck-loan-rcvr.stderr index 1d6bd4e2ec8..317423ecf61 100644 --- a/tests/ui/borrowck/borrowck-loan-rcvr.stderr +++ b/tests/ui/borrowck/borrowck-loan-rcvr.stderr @@ -1,15 +1,13 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable --> $DIR/borrowck-loan-rcvr.rs:23:14 | -LL | p.blockm(|| { - | - ------ ^^ mutable borrow occurs here - | | | - | _____| immutable borrow later used by call - | | -LL | | p.x = 10; - | | --- second borrow occurs due to use of `p` in closure -LL | | }) - | |______- immutable borrow occurs here +LL | p.blockm(|| { + | - ------ ^^ mutable borrow occurs here + | | | + | | immutable borrow later used by call + | immutable borrow occurs here +LL | p.x = 10; + | --- second borrow occurs due to use of `p` in closure error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable --> $DIR/borrowck-loan-rcvr.rs:34:5 @@ -17,7 +15,7 @@ error[E0502]: cannot borrow `p` as immutable because it is also borrowed as muta LL | let l = &mut p; | ------ mutable borrow occurs here LL | p.impurem(); - | ^^^^^^^^^^^ immutable borrow occurs here + | ^ immutable borrow occurs here LL | LL | l.x += 1; | -------- mutable borrow later used here diff --git a/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr b/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr index bd94f1a4299..4f0202f3832 100644 --- a/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr +++ b/tests/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr @@ -9,7 +9,7 @@ LL | LL | let z = *a; | ^^ move out of `*a` occurs here LL | b.use_ref(); - | ----------- borrow later used here + | - borrow later used here error: aborting due to previous error diff --git a/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr b/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr index cdad20c52bf..e1e3c7f8aaa 100644 --- a/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr +++ b/tests/ui/borrowck/borrowck-move-mut-base-ptr.stderr @@ -9,7 +9,7 @@ LL | let t1 = t0; | ^^ move out of `t0` occurs here LL | *t1 = 22; LL | p.use_ref(); - | ----------- borrow later used here + | - borrow later used here error: aborting due to previous error diff --git a/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr b/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr index 87135f0bb43..934dd8df1d2 100644 --- a/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr +++ b/tests/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr @@ -2,9 +2,8 @@ error[E0507]: cannot move out of an `Rc` --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:4:14 | LL | let _x = Rc::new(vec![1, 2]).into_iter(); - | ^^^^^^^^^^^^^^^^^^^^----------- - | | | - | | value moved due to this method call + | ^^^^^^^^^^^^^^^^^^^ ----------- value moved due to this method call + | | | move occurs because value has type `Vec<i32>`, which does not implement the `Copy` trait | note: `into_iter` takes ownership of the receiver `self`, which moves value @@ -12,7 +11,7 @@ note: `into_iter` takes ownership of the receiver `self`, which moves value help: you can `clone` the value and consume it, but this might not be your desired behavior | LL | let _x = Rc::new(vec![1, 2]).clone().into_iter(); - | ++++++++ + | ++++++++ error: aborting due to previous error diff --git a/tests/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr b/tests/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr index d2b845619c7..3653de0e8ab 100644 --- a/tests/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr +++ b/tests/ui/borrowck/borrowck-mut-borrow-linear-errors.stderr @@ -5,9 +5,8 @@ LL | 1 => { addr.push(&mut x); } | ^^^^^^ second mutable borrow occurs here LL | 2 => { addr.push(&mut x); } LL | _ => { addr.push(&mut x); } - | ----------------- - | | | - | | first mutable borrow occurs here + | ---- ------ first mutable borrow occurs here + | | | first borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time @@ -16,18 +15,16 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time LL | 2 => { addr.push(&mut x); } | ^^^^^^ second mutable borrow occurs here LL | _ => { addr.push(&mut x); } - | ----------------- - | | | - | | first mutable borrow occurs here + | ---- ------ first mutable borrow occurs here + | | | first borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time --> $DIR/borrowck-mut-borrow-linear-errors.rs:12:30 | LL | _ => { addr.push(&mut x); } - | ----------^^^^^^- - | | | - | | `x` was mutably borrowed here in the previous iteration of the loop + | ---- ^^^^^^ `x` was mutably borrowed here in the previous iteration of the loop + | | | first borrow used here, in later iteration of loop error: aborting due to 3 previous errors diff --git a/tests/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr b/tests/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr index ef811b84905..f2baee09376 100644 --- a/tests/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr +++ b/tests/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr @@ -7,7 +7,7 @@ LL | let mut t2 = &mut t0; | ^^^^^^^ mutable borrow occurs here LL | **t2 += 1; // Mutates `*t0` LL | p.use_ref(); - | ----------- immutable borrow later used here + | - immutable borrow later used here error[E0499]: cannot borrow `t0` as mutable more than once at a time --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:19:18 @@ -18,7 +18,7 @@ LL | let mut t2 = &mut t0; | ^^^^^^^ second mutable borrow occurs here LL | **t2 += 1; // Mutates `*t0` but not through `*p` LL | p.use_mut(); - | ----------- first borrow later used here + | - first borrow later used here error: aborting due to 2 previous errors diff --git a/tests/ui/borrowck/borrowck-object-lifetime.stderr b/tests/ui/borrowck/borrowck-object-lifetime.stderr index 215ed760ae1..cf94c74dec2 100644 --- a/tests/ui/borrowck/borrowck-object-lifetime.stderr +++ b/tests/ui/borrowck/borrowck-object-lifetime.stderr @@ -2,21 +2,21 @@ error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immut --> $DIR/borrowck-object-lifetime.rs:20:13 | LL | let y = x.borrowed(); - | ------------ immutable borrow occurs here + | - immutable borrow occurs here LL | let z = x.mut_borrowed(); | ^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | y.use_ref(); - | ----------- immutable borrow later used here + | - immutable borrow later used here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable --> $DIR/borrowck-object-lifetime.rs:26:13 | LL | let y = x.borrowed(); - | ------------ immutable borrow occurs here + | - immutable borrow occurs here LL | let z = &mut x; | ^^^^^^ mutable borrow occurs here LL | y.use_ref(); - | ----------- immutable borrow later used here + | - immutable borrow later used here error: aborting due to 2 previous errors diff --git a/tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr b/tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr index fb7af50bcb5..2e7a6778dbc 100644 --- a/tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr +++ b/tests/ui/borrowck/borrowck-overloaded-index-autoderef.stderr @@ -6,7 +6,7 @@ LL | let p = &mut f[&s]; LL | let q = &f[&s]; | ^ immutable borrow occurs here LL | p.use_mut(); - | ----------- mutable borrow later used here + | - mutable borrow later used here error[E0499]: cannot borrow `*f` as mutable more than once at a time --> $DIR/borrowck-overloaded-index-autoderef.rs:43:18 @@ -16,7 +16,7 @@ LL | let p = &mut f[&s]; LL | let q = &mut f[&s]; | ^ second mutable borrow occurs here LL | p.use_mut(); - | ----------- first borrow later used here + | - first borrow later used here error[E0499]: cannot borrow `f.foo` as mutable more than once at a time --> $DIR/borrowck-overloaded-index-autoderef.rs:53:18 @@ -26,7 +26,7 @@ LL | let p = &mut f.foo[&s]; LL | let q = &mut f.foo[&s]; | ^^^^^ second mutable borrow occurs here LL | p.use_mut(); - | ----------- first borrow later used here + | - first borrow later used here error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as immutable --> $DIR/borrowck-overloaded-index-autoderef.rs:65:18 @@ -36,7 +36,7 @@ LL | let p = &f.foo[&s]; LL | let q = &mut f.foo[&s]; | ^^^^^ mutable borrow occurs here LL | p.use_ref(); - | ----------- immutable borrow later used here + | - immutable borrow later used here error[E0506]: cannot assign to `f.foo` because it is borrowed --> $DIR/borrowck-overloaded-index-autoderef.rs:71:5 @@ -46,7 +46,7 @@ LL | let p = &f.foo[&s]; LL | f.foo = g; | ^^^^^^^^^ `f.foo` is assigned to here but it was already borrowed LL | p.use_ref(); - | ----------- borrow later used here + | - borrow later used here error[E0506]: cannot assign to `*f` because it is borrowed --> $DIR/borrowck-overloaded-index-autoderef.rs:77:5 @@ -56,7 +56,7 @@ LL | let p = &f.foo[&s]; LL | *f = g; | ^^^^^^ `*f` is assigned to here but it was already borrowed LL | p.use_ref(); - | ----------- borrow later used here + | - borrow later used here error[E0506]: cannot assign to `f.foo` because it is borrowed --> $DIR/borrowck-overloaded-index-autoderef.rs:83:5 @@ -66,7 +66,7 @@ LL | let p = &mut f.foo[&s]; LL | f.foo = g; | ^^^^^^^^^ `f.foo` is assigned to here but it was already borrowed LL | p.use_mut(); - | ----------- borrow later used here + | - borrow later used here error[E0506]: cannot assign to `*f` because it is borrowed --> $DIR/borrowck-overloaded-index-autoderef.rs:89:5 @@ -76,7 +76,7 @@ LL | let p = &mut f.foo[&s]; LL | *f = g; | ^^^^^^ `*f` is assigned to here but it was already borrowed LL | p.use_mut(); - | ----------- borrow later used here + | - borrow later used here error: aborting due to 8 previous errors diff --git a/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr b/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr index d05996413dd..db73d4c04ac 100644 --- a/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr +++ b/tests/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr @@ -8,7 +8,7 @@ LL | let z = &x; | ^^ immutable borrow occurs here ... LL | y.use_mut(); - | ----------- mutable borrow later used here + | - mutable borrow later used here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable --> $DIR/borrowck-report-with-custom-diagnostic.rs:21:21 @@ -20,7 +20,7 @@ LL | let z = &mut x; | ^^^^^^ mutable borrow occurs here ... LL | y.use_ref(); - | ----------- immutable borrow later used here + | - immutable borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time --> $DIR/borrowck-report-with-custom-diagnostic.rs:36:17 @@ -32,7 +32,7 @@ LL | let z = &mut x; | ^^^^^^ second mutable borrow occurs here ... LL | y.use_mut(); - | ----------- first borrow later used here + | - first borrow later used here error: aborting due to 3 previous errors diff --git a/tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr b/tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr index b39215b9aab..1c55953c91f 100644 --- a/tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr +++ b/tests/ui/borrowck/borrowck-swap-mut-base-ptr.stderr @@ -7,7 +7,7 @@ LL | swap(&mut t0, &mut t1); | ^^^^^^^ mutable borrow occurs here LL | *t1 = 22; LL | p.use_ref(); - | ----------- immutable borrow later used here + | - immutable borrow later used here error: aborting due to previous error diff --git a/tests/ui/borrowck/borrowck-union-borrow-nested.stderr b/tests/ui/borrowck/borrowck-union-borrow-nested.stderr index a87a14e7cab..f2e549cd88c 100644 --- a/tests/ui/borrowck/borrowck-union-borrow-nested.stderr +++ b/tests/ui/borrowck/borrowck-union-borrow-nested.stderr @@ -6,7 +6,7 @@ LL | let ra = &mut u.s.a; LL | let b = u.c; | ^^^ use of borrowed `u.s.a` LL | ra.use_mut(); - | ------------ borrow later used here + | -- borrow later used here error: aborting due to previous error diff --git a/tests/ui/borrowck/borrowck-uniq-via-lend.stderr b/tests/ui/borrowck/borrowck-uniq-via-lend.stderr index 6dbe4c74b58..923edc8edae 100644 --- a/tests/ui/borrowck/borrowck-uniq-via-lend.stderr +++ b/tests/ui/borrowck/borrowck-uniq-via-lend.stderr @@ -6,7 +6,7 @@ LL | let w = &mut v; LL | borrow(&*v); | ^^^ immutable borrow occurs here LL | w.use_mut(); - | ----------- mutable borrow later used here + | - mutable borrow later used here error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable --> $DIR/borrowck-uniq-via-lend.rs:53:12 @@ -16,7 +16,7 @@ LL | x = &mut v; LL | borrow(&*v); | ^^^ immutable borrow occurs here LL | x.use_mut(); - | ----------- mutable borrow later used here + | - mutable borrow later used here error: aborting due to 2 previous errors diff --git a/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr b/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr index eb0f24b9b7a..5141fcc1bb2 100644 --- a/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr +++ b/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr @@ -5,9 +5,8 @@ LL | let vb: &mut [isize] = &mut v; | ------ first mutable borrow occurs here ... LL | v.push(tail[0] + tail[1]); - | ^^^^^^^-------^^^^^^^^^^^ - | | | - | | first borrow later used here + | ^ ------- first borrow later used here + | | | second mutable borrow occurs here error: aborting due to previous error diff --git a/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr index 70b9e4f4433..024cb006c26 100644 --- a/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr +++ b/tests/ui/borrowck/borrowck-vec-pattern-nesting.stderr @@ -8,7 +8,7 @@ LL | vec[0] = Box::new(4); | ^^^^^^ `vec[_]` is assigned to here but it was already borrowed LL | LL | _a.use_ref(); - | ------------ borrow later used here + | -- borrow later used here error[E0506]: cannot assign to `vec[_]` because it is borrowed --> $DIR/borrowck-vec-pattern-nesting.rs:23:13 @@ -20,7 +20,7 @@ LL | vec[0] = Box::new(4); | ^^^^^^ `vec[_]` is assigned to here but it was already borrowed LL | LL | _b.use_ref(); - | ------------ borrow later used here + | -- borrow later used here error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:34:11 diff --git a/tests/ui/borrowck/clone-span-on-try-operator.fixed b/tests/ui/borrowck/clone-span-on-try-operator.fixed new file mode 100644 index 00000000000..52f66e43a93 --- /dev/null +++ b/tests/ui/borrowck/clone-span-on-try-operator.fixed @@ -0,0 +1,11 @@ +// run-rustfix + +#[derive(Clone)] +struct Foo; +impl Foo { + fn foo(self) {} +} +fn main() { + let foo = &Foo; + (*foo).clone().foo(); //~ ERROR cannot move out +} diff --git a/tests/ui/borrowck/clone-span-on-try-operator.rs b/tests/ui/borrowck/clone-span-on-try-operator.rs new file mode 100644 index 00000000000..031a35e2026 --- /dev/null +++ b/tests/ui/borrowck/clone-span-on-try-operator.rs @@ -0,0 +1,11 @@ +// run-rustfix + +#[derive(Clone)] +struct Foo; +impl Foo { + fn foo(self) {} +} +fn main() { + let foo = &Foo; + (*foo).foo(); //~ ERROR cannot move out +} diff --git a/tests/ui/borrowck/clone-span-on-try-operator.stderr b/tests/ui/borrowck/clone-span-on-try-operator.stderr new file mode 100644 index 00000000000..85785e67072 --- /dev/null +++ b/tests/ui/borrowck/clone-span-on-try-operator.stderr @@ -0,0 +1,21 @@ +error[E0507]: cannot move out of `*foo` which is behind a shared reference + --> $DIR/clone-span-on-try-operator.rs:10:5 + | +LL | (*foo).foo(); + | ^^^^^^ ----- `*foo` moved due to this method call + | | + | move occurs because `*foo` has type `Foo`, which does not implement the `Copy` trait + | +note: `Foo::foo` takes ownership of the receiver `self`, which moves `*foo` + --> $DIR/clone-span-on-try-operator.rs:6:12 + | +LL | fn foo(self) {} + | ^^^^ +help: you can `clone` the value and consume it, but this might not be your desired behavior + | +LL | (*foo).clone().foo(); + | ++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/borrowck/copy-suggestion-region-vid.stderr b/tests/ui/borrowck/copy-suggestion-region-vid.stderr index 1685acf8718..40b8ab182f3 100644 --- a/tests/ui/borrowck/copy-suggestion-region-vid.stderr +++ b/tests/ui/borrowck/copy-suggestion-region-vid.stderr @@ -5,7 +5,7 @@ LL | let helpers = [vec![], vec![]]; | ------- move occurs because `helpers` has type `[Vec<&i64>; 2]`, which does not implement the `Copy` trait LL | LL | HelperStruct { helpers, is_empty: helpers[0].is_empty() } - | ------- ^^^^^^^^^^^^^^^^^^^^^ value borrowed here after move + | ------- ^^^^^^^^^^ value borrowed here after move | | | value moved here diff --git a/tests/ui/borrowck/index-mut-help-with-impl.stderr b/tests/ui/borrowck/index-mut-help-with-impl.stderr index 69dca7e7b56..89391f4099a 100644 --- a/tests/ui/borrowck/index-mut-help-with-impl.stderr +++ b/tests/ui/borrowck/index-mut-help-with-impl.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/index-mut-help-with-impl.rs:9:5 | LL | Index::index(&v, 1..2).make_ascii_uppercase(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable + | ^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/tests/ui/borrowck/index-mut-help.stderr b/tests/ui/borrowck/index-mut-help.stderr index f42d7e01554..fde2b5dc076 100644 --- a/tests/ui/borrowck/index-mut-help.stderr +++ b/tests/ui/borrowck/index-mut-help.stderr @@ -2,13 +2,10 @@ error[E0596]: cannot borrow data in an index of `HashMap<&str, String>` as mutab --> $DIR/index-mut-help.rs:10:5 | LL | map["peter"].clear(); - | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable + | ^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<&str, String>` -help: to modify a `HashMap<&str, String>` use `.get_mut()` - | -LL | map.get_mut("peter").map(|val| val.clear()); - | ~~~~~~~~~ ~~~~~~~~~~~~~~~ + + = help: to modify a `HashMap<&str, String>`, use `.get_mut()`, `.insert()` or the entry API error[E0594]: cannot assign to data in an index of `HashMap<&str, String>` --> $DIR/index-mut-help.rs:11:5 diff --git a/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr b/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr index 25974e0d008..4e3bf1d7042 100644 --- a/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr +++ b/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr @@ -26,9 +26,8 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time --> $DIR/issue-109271-pass-self-into-closure.rs:21:12 | LL | v.call(|(), this: &mut S| v.set()); - | -------^^^^^^^^^^^^^^^^^^--------- - | | | | | - | | | | second borrow occurs due to use of `v` in closure + | - ---- ^^^^^^^^^^^^^^^^^^ - second borrow occurs due to use of `v` in closure + | | | | | | | second mutable borrow occurs here | | first borrow later used by call | first mutable borrow occurs here @@ -63,21 +62,14 @@ LL ~ S::get(&this); error[E0499]: cannot borrow `v` as mutable more than once at a time --> $DIR/issue-109271-pass-self-into-closure.rs:25:12 | -LL | v.call(|(), this: &mut S| { - | - ---- ^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here - | | | - | _____| first borrow later used by call - | | -LL | | -LL | | -LL | | -LL | | _ = v; -LL | | v.set(); - | | - second borrow occurs due to use of `v` in closure -... | -LL | | _ = v.add(3); -LL | | }); - | |______- first mutable borrow occurs here +LL | v.call(|(), this: &mut S| { + | - ---- ^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here + | | | + | | first borrow later used by call + | first mutable borrow occurs here +... +LL | v.set(); + | - second borrow occurs due to use of `v` in closure error: aborting due to 5 previous errors diff --git a/tests/ui/borrowck/issue-42344.stderr b/tests/ui/borrowck/issue-42344.stderr index 29b4c8c38d7..5cffa1b5121 100644 --- a/tests/ui/borrowck/issue-42344.stderr +++ b/tests/ui/borrowck/issue-42344.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*TAB[_]` as mutable, as `TAB` is an immutable stati --> $DIR/issue-42344.rs:4:5 | LL | TAB[0].iter_mut(); - | ^^^^^^^^^^^^^^^^^ cannot borrow as mutable + | ^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/tests/ui/borrowck/issue-47646.stderr b/tests/ui/borrowck/issue-47646.stderr index 84cf9237a56..d82e1f908cb 100644 --- a/tests/ui/borrowck/issue-47646.stderr +++ b/tests/ui/borrowck/issue-47646.stderr @@ -2,7 +2,7 @@ error[E0502]: cannot borrow `heap` as immutable because it is also borrowed as m --> $DIR/issue-47646.rs:9:30 | LL | let borrow = heap.peek_mut(); - | --------------- mutable borrow occurs here + | ---- mutable borrow occurs here LL | LL | match (borrow, ()) { | ------------ a temporary with access to the mutable borrow is created here ... diff --git a/tests/ui/borrowck/issue-51117.stderr b/tests/ui/borrowck/issue-51117.stderr index ef1a16ea953..f8a9608ad37 100644 --- a/tests/ui/borrowck/issue-51117.stderr +++ b/tests/ui/borrowck/issue-51117.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `*bar` as mutable more than once at a time LL | Some(baz) => { | --- first mutable borrow occurs here LL | bar.take(); - | ^^^^^^^^^^ second mutable borrow occurs here + | ^^^ second mutable borrow occurs here LL | drop(baz); | --- first borrow later used here diff --git a/tests/ui/borrowck/issue-81365-10.stderr b/tests/ui/borrowck/issue-81365-10.stderr index d0986e9f922..2bbde82fafd 100644 --- a/tests/ui/borrowck/issue-81365-10.stderr +++ b/tests/ui/borrowck/issue-81365-10.stderr @@ -2,7 +2,7 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed --> $DIR/issue-81365-10.rs:21:9 | LL | let first = &self.deref().target_field; - | ------------ `self.container_field` is borrowed here + | ---- `self.container_field` is borrowed here LL | self.container_field = true; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed LL | first; diff --git a/tests/ui/borrowck/issue-81365-5.stderr b/tests/ui/borrowck/issue-81365-5.stderr index c00e48288ba..094cec021e4 100644 --- a/tests/ui/borrowck/issue-81365-5.stderr +++ b/tests/ui/borrowck/issue-81365-5.stderr @@ -2,7 +2,7 @@ error[E0506]: cannot assign to `self.container_field` because it is borrowed --> $DIR/issue-81365-5.rs:28:9 | LL | let first = self.get(); - | ---------- `self.container_field` is borrowed here + | ---- `self.container_field` is borrowed here LL | self.container_field = true; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self.container_field` is assigned to here but it was already borrowed LL | first; diff --git a/tests/ui/borrowck/issue-82032.stderr b/tests/ui/borrowck/issue-82032.stderr index 25f343117a3..f272477a9f5 100644 --- a/tests/ui/borrowck/issue-82032.stderr +++ b/tests/ui/borrowck/issue-82032.stderr @@ -7,7 +7,7 @@ LL | for v in self.0.values() { | | help: use mutable method: `values_mut()` | this iterator yields `&` references LL | v.flush(); - | ^^^^^^^^^ `v` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | ^ `v` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/tests/ui/borrowck/issue-85581.stderr b/tests/ui/borrowck/issue-85581.stderr index 59ca4867fd7..29c0429f2a0 100644 --- a/tests/ui/borrowck/issue-85581.stderr +++ b/tests/ui/borrowck/issue-85581.stderr @@ -7,7 +7,7 @@ LL | match heap.peek_mut() { | first mutable borrow occurs here | a temporary with access to the first borrow is created here ... LL | Some(_) => { heap.pop(); }, - | ^^^^^^^^^^ second mutable borrow occurs here + | ^^^^ second mutable borrow occurs here ... LL | } | - ... and the first borrow might be used here, when that temporary is dropped and runs the destructor for type `Option<PeekMut<'_, i32>>` diff --git a/tests/ui/borrowck/issue-85765.stderr b/tests/ui/borrowck/issue-85765.stderr index 2985a658fdd..57900bfb612 100644 --- a/tests/ui/borrowck/issue-85765.stderr +++ b/tests/ui/borrowck/issue-85765.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*rofl` as mutable, as it is behind a `&` reference --> $DIR/issue-85765.rs:5:5 | LL | rofl.push(Vec::new()); - | ^^^^^^^^^^^^^^^^^^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | ^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this binding's type | diff --git a/tests/ui/borrowck/issue-91206.stderr b/tests/ui/borrowck/issue-91206.stderr index 6653d497873..30f83656518 100644 --- a/tests/ui/borrowck/issue-91206.stderr +++ b/tests/ui/borrowck/issue-91206.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*inner` as mutable, as it is behind a `&` reference --> $DIR/issue-91206.rs:13:5 | LL | inner.clear(); - | ^^^^^^^^^^^^^ `inner` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | ^^^^^ `inner` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider specifying this binding's type | diff --git a/tests/ui/borrowck/issue-93078.stderr b/tests/ui/borrowck/issue-93078.stderr index 771a652a173..bcbcbe72412 100644 --- a/tests/ui/borrowck/issue-93078.stderr +++ b/tests/ui/borrowck/issue-93078.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable --> $DIR/issue-93078.rs:11:9 | LL | self.modify(); - | ^^^^^^^^^^^^^ cannot borrow as mutable + | ^^^^ cannot borrow as mutable | = note: as `Self` may be unsized, this call attempts to take `&mut &mut self` = note: however, `&mut self` expands to `self: &mut Self`, therefore `self` cannot be borrowed mutably diff --git a/tests/ui/borrowck/many-mutable-borrows.stderr b/tests/ui/borrowck/many-mutable-borrows.stderr index aa0cbcffd95..0f808ac9276 100644 --- a/tests/ui/borrowck/many-mutable-borrows.stderr +++ b/tests/ui/borrowck/many-mutable-borrows.stderr @@ -4,23 +4,23 @@ error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable LL | let v = Vec::new(); | ^ not mutable LL | v.push(0); - | --------- cannot borrow as mutable + | - cannot borrow as mutable LL | v.push(0); - | --------- cannot borrow as mutable + | - cannot borrow as mutable LL | v.push(0); - | --------- cannot borrow as mutable + | - cannot borrow as mutable LL | v.push(0); - | --------- cannot borrow as mutable + | - cannot borrow as mutable LL | v.push(0); - | --------- cannot borrow as mutable + | - cannot borrow as mutable LL | v.push(0); - | --------- cannot borrow as mutable + | - cannot borrow as mutable LL | v.push(0); - | --------- cannot borrow as mutable + | - cannot borrow as mutable LL | v.push(0); - | --------- cannot borrow as mutable + | - cannot borrow as mutable LL | v.push(0); - | --------- cannot borrow as mutable + | - cannot borrow as mutable | = note: ...and 5 other attempted mutable borrows help: consider changing this to be mutable diff --git a/tests/ui/borrowck/mut-borrow-of-mut-ref.stderr b/tests/ui/borrowck/mut-borrow-of-mut-ref.stderr index c6f75b1c0d0..f448e009b0e 100644 --- a/tests/ui/borrowck/mut-borrow-of-mut-ref.stderr +++ b/tests/ui/borrowck/mut-borrow-of-mut-ref.stderr @@ -47,7 +47,7 @@ error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable --> $DIR/mut-borrow-of-mut-ref.rs:34:5 | LL | f.bar(); - | ^^^^^^^ cannot borrow as mutable + | ^ cannot borrow as mutable | help: consider making the binding mutable | diff --git a/tests/ui/borrowck/mut-borrow-outside-loop.stderr b/tests/ui/borrowck/mut-borrow-outside-loop.stderr index e6895b27f35..4fcb693f1bf 100644 --- a/tests/ui/borrowck/mut-borrow-outside-loop.stderr +++ b/tests/ui/borrowck/mut-borrow-outside-loop.stderr @@ -6,7 +6,7 @@ LL | let first = &mut void; LL | let second = &mut void; | ^^^^^^^^^ second mutable borrow occurs here LL | first.use_mut(); - | --------------- first borrow later used here + | ----- first borrow later used here error[E0499]: cannot borrow `inner_void` as mutable more than once at a time --> $DIR/mut-borrow-outside-loop.rs:15:28 @@ -17,7 +17,7 @@ LL | let inner_second = &mut inner_void; | ^^^^^^^^^^^^^^^ second mutable borrow occurs here LL | inner_second.use_mut(); LL | inner_first.use_mut(); - | --------------------- first borrow later used here + | ----------- first borrow later used here error: aborting due to 2 previous errors diff --git a/tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr b/tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr index 4621d879351..bada08368fc 100644 --- a/tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr +++ b/tests/ui/borrowck/suggest-as-ref-on-mut-closure.stderr @@ -2,9 +2,8 @@ error[E0507]: cannot move out of `*cb` which is behind a mutable reference --> $DIR/suggest-as-ref-on-mut-closure.rs:7:5 | LL | cb.map(|cb| cb()); - | ^^^-------------- - | | | - | | `*cb` moved due to this method call + | ^^ -------------- `*cb` moved due to this method call + | | | help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents | move occurs because `*cb` has type `Option<&mut dyn FnMut()>`, which does not implement the `Copy` trait | diff --git a/tests/ui/borrowck/suggest-local-var-double-mut.stderr b/tests/ui/borrowck/suggest-local-var-double-mut.stderr index 3a43c18a7ed..8bec0788f02 100644 --- a/tests/ui/borrowck/suggest-local-var-double-mut.stderr +++ b/tests/ui/borrowck/suggest-local-var-double-mut.stderr @@ -2,9 +2,8 @@ error[E0499]: cannot borrow `*self` as mutable more than once at a time --> $DIR/suggest-local-var-double-mut.rs:12:22 | LL | self.foo(self.bar()); - | ---------^^^^^^^^^^- - | | | | - | | | second mutable borrow occurs here + | ---- --- ^^^^ second mutable borrow occurs here + | | | | | first borrow later used by call | first mutable borrow occurs here | diff --git a/tests/ui/borrowck/suggest-local-var-for-vector.stderr b/tests/ui/borrowck/suggest-local-var-for-vector.stderr index 615fffcd578..ea92d76b4ec 100644 --- a/tests/ui/borrowck/suggest-local-var-for-vector.stderr +++ b/tests/ui/borrowck/suggest-local-var-for-vector.stderr @@ -2,7 +2,7 @@ error[E0502]: cannot borrow `vec` as immutable because it is also borrowed as mu --> $DIR/suggest-local-var-for-vector.rs:3:9 | LL | vec[vec.len() - 1] = 123; - | ----^^^^^^^^^----- + | ----^^^----------- | | | | | immutable borrow occurs here | mutable borrow occurs here diff --git a/tests/ui/borrowck/suggest-local-var-imm-and-mut.stderr b/tests/ui/borrowck/suggest-local-var-imm-and-mut.stderr index eb934e7b72b..1ef643e2142 100644 --- a/tests/ui/borrowck/suggest-local-var-imm-and-mut.stderr +++ b/tests/ui/borrowck/suggest-local-var-imm-and-mut.stderr @@ -2,9 +2,8 @@ error[E0502]: cannot borrow `*self` as mutable because it is also borrowed as im --> $DIR/suggest-local-var-imm-and-mut.rs:12:22 | LL | self.foo(self.bar()); - | ---------^^^^^^^^^^- - | | | | - | | | mutable borrow occurs here + | ---- --- ^^^^^^^^^^ mutable borrow occurs here + | | | | | immutable borrow later used by call | immutable borrow occurs here diff --git a/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr b/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr index e3a16eddfd5..6007beb7753 100644 --- a/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr +++ b/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr @@ -2,7 +2,7 @@ error[E0502]: cannot borrow `vec` as immutable because it is also borrowed as mu --> $DIR/suggest-storing-local-var-for-vector.rs:3:9 | LL | vec[vec.len() - 1] = 123; - | ----^^^^^^^^^----- + | ----^^^----------- | | | | | immutable borrow occurs here | mutable borrow occurs here diff --git a/tests/ui/borrowck/two-phase-across-loop.stderr b/tests/ui/borrowck/two-phase-across-loop.stderr index 22f9b39dfee..d7c0210cc77 100644 --- a/tests/ui/borrowck/two-phase-across-loop.stderr +++ b/tests/ui/borrowck/two-phase-across-loop.stderr @@ -2,9 +2,8 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time --> $DIR/two-phase-across-loop.rs:17:22 | LL | strings.push(foo.get_string()); - | -------------^^^^^^^^^^^^^^^^- - | | | - | | `foo` was mutably borrowed here in the previous iteration of the loop + | ------- ^^^ `foo` was mutably borrowed here in the previous iteration of the loop + | | | first borrow used here, in later iteration of loop error: aborting due to previous error diff --git a/tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr b/tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr index 21b0eddb902..2c3f1c18a08 100644 --- a/tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr +++ b/tests/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr @@ -1,18 +1,13 @@ error[E0502]: cannot borrow `vec` as mutable because it is also borrowed as immutable --> $DIR/two-phase-cannot-nest-mut-self-calls.rs:14:9 | -LL | vec.get({ - | - --- immutable borrow later used by call - | _____| - | | -LL | | -LL | | vec.push(2); - | | ^^^^^^^^^^^ mutable borrow occurs here -LL | | -LL | | -LL | | 0 -LL | | }); - | |______- immutable borrow occurs here +LL | vec.get({ + | --- --- immutable borrow later used by call + | | + | immutable borrow occurs here +LL | +LL | vec.push(2); + | ^^^^^^^^^^^ mutable borrow occurs here error: aborting due to previous error diff --git a/tests/ui/borrowck/two-phase-multi-mut.stderr b/tests/ui/borrowck/two-phase-multi-mut.stderr index 2e53e17a31b..33fa4a3a150 100644 --- a/tests/ui/borrowck/two-phase-multi-mut.stderr +++ b/tests/ui/borrowck/two-phase-multi-mut.stderr @@ -12,9 +12,8 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time --> $DIR/two-phase-multi-mut.rs:11:16 | LL | foo.method(&mut foo); - | -----------^^^^^^^^- - | | | | - | | | second mutable borrow occurs here + | --- ------ ^^^^^^^^ second mutable borrow occurs here + | | | | | first borrow later used by call | first mutable borrow occurs here diff --git a/tests/ui/borrowck/two-phase-sneaky.stderr b/tests/ui/borrowck/two-phase-sneaky.stderr index 117d7ceaeef..4db970c1da0 100644 --- a/tests/ui/borrowck/two-phase-sneaky.stderr +++ b/tests/ui/borrowck/two-phase-sneaky.stderr @@ -7,7 +7,7 @@ LL | v[0].push_str({ | first mutable borrow occurs here LL | LL | v.push(format!("foo")); - | ^^^^^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here + | ^ second mutable borrow occurs here error: aborting due to previous error diff --git a/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr b/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr index e75094d4f13..9f9d4bd8d6c 100644 --- a/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr +++ b/tests/ui/borrowck/two-phase-surprise-no-conflict.stderr @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `*self` as mutable because it is also borrowed as im --> $DIR/two-phase-surprise-no-conflict.rs:57:17 | LL | self.hash_expr(&self.cx_mut.body(eid).value); - | ^^^^^---------^^---------------------^^^^^^^ + | ^^^^^---------^^-----------^^^^^^^^^^^^^^^^^ | | | | | | | immutable borrow occurs here | | immutable borrow later used by call @@ -23,9 +23,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time --> $DIR/two-phase-surprise-no-conflict.rs:119:51 | LL | reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut))); - | ----------------------------------------------^^^^^^^^^^^^^^^^^--- - | | | | - | | | second mutable borrow occurs here + | --- --------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here + | | | | | first borrow later used by call | first mutable borrow occurs here @@ -33,9 +32,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time --> $DIR/two-phase-surprise-no-conflict.rs:122:54 | LL | reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut))); - | -------------------------------------------------^^^^^^^^^^^^^^^^^--- - | | | | - | | | second mutable borrow occurs here + | --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here + | | | | | first borrow later used by call | first mutable borrow occurs here @@ -43,9 +41,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time --> $DIR/two-phase-surprise-no-conflict.rs:125:53 | LL | reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut))); - | ------------------------------------------------^^^^^^^^^^^^^^^^^--- - | | | | - | | | second mutable borrow occurs here + | --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here + | | | | | first borrow later used by call | first mutable borrow occurs here @@ -53,9 +50,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time --> $DIR/two-phase-surprise-no-conflict.rs:128:44 | LL | reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut)); - | ---------------------------------------^^^^^^^^^^^^^^^^^-- - | | | | - | | | second mutable borrow occurs here + | --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here + | | | | | first borrow later used by call | first mutable borrow occurs here @@ -106,9 +102,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time --> $DIR/two-phase-surprise-no-conflict.rs:154:54 | LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); - | -------------------------------------------------^^^^^^^^^^^^^^^^^--- - | | | | - | | | second mutable borrow occurs here + | --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here + | | | | | first borrow later used by call | first mutable borrow occurs here @@ -129,9 +124,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time --> $DIR/two-phase-surprise-no-conflict.rs:158:53 | LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); - | ------------------------------------------------^^^^^^^^^^^^^^^^^--- - | | | | - | | | second mutable borrow occurs here + | --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here + | | | | | first borrow later used by call | first mutable borrow occurs here @@ -149,9 +143,8 @@ error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time --> $DIR/two-phase-surprise-no-conflict.rs:162:44 | LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut)); - | ---------------------------------------^^^^^^^^^^^^^^^^^-- - | | | | - | | | second mutable borrow occurs here + | --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here + | | | | | first borrow later used by call | first mutable borrow occurs here diff --git a/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr b/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr index f033d53bf8e..a2f6365b74e 100644 --- a/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr +++ b/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr @@ -15,7 +15,7 @@ note: `into_iter` takes ownership of the receiver `self`, which moves `y` help: you can `clone` the value and consume it, but this might not be your desired behavior | LL | y.clone().into_iter(); - | ++++++++ + | ++++++++ error: aborting due to previous error diff --git a/tests/ui/box/leak-alloc.stderr b/tests/ui/box/leak-alloc.stderr index 5140b58934a..feda8841fc8 100644 --- a/tests/ui/box/leak-alloc.stderr +++ b/tests/ui/box/leak-alloc.stderr @@ -4,7 +4,7 @@ error[E0505]: cannot move out of `alloc` because it is borrowed LL | let alloc = Alloc {}; | ----- binding `alloc` declared here LL | let boxed = Box::new_in(10, alloc.by_ref()); - | -------------- borrow of `alloc` occurs here + | ----- borrow of `alloc` occurs here LL | let theref = Box::leak(boxed); LL | drop(alloc); | ^^^^^ move out of `alloc` occurs here diff --git a/tests/ui/cannot-mutate-captured-non-mut-var.stderr b/tests/ui/cannot-mutate-captured-non-mut-var.stderr index 06b5ca407db..2d6e83c9e82 100644 --- a/tests/ui/cannot-mutate-captured-non-mut-var.stderr +++ b/tests/ui/cannot-mutate-captured-non-mut-var.stderr @@ -12,7 +12,7 @@ error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable LL | let s = std::io::stdin(); | - help: consider changing this to be mutable: `mut s` LL | to_fn_once(move|| { s.read_to_end(&mut Vec::new()); }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable + | ^ cannot borrow as mutable error: aborting due to 2 previous errors diff --git a/tests/ui/codemap_tests/issue-11715.stderr b/tests/ui/codemap_tests/issue-11715.stderr index a6b2b2e50a3..d0c29c768eb 100644 --- a/tests/ui/codemap_tests/issue-11715.stderr +++ b/tests/ui/codemap_tests/issue-11715.stderr @@ -7,7 +7,7 @@ LL | let z = &mut x; | ^^^^^^ second mutable borrow occurs here LL | z.use_mut(); LL | y.use_mut(); - | ----------- first borrow later used here + | - first borrow later used here error: aborting due to previous error diff --git a/tests/ui/codemap_tests/one_line.stderr b/tests/ui/codemap_tests/one_line.stderr index 6fe6e26135b..75fbbada72c 100644 --- a/tests/ui/codemap_tests/one_line.stderr +++ b/tests/ui/codemap_tests/one_line.stderr @@ -2,9 +2,8 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time --> $DIR/one_line.rs:3:12 | LL | v.push(v.pop().unwrap()); - | -------^^^^^^^---------- - | | | | - | | | second mutable borrow occurs here + | - ---- ^ second mutable borrow occurs here + | | | | | first borrow later used by call | first mutable borrow occurs here | diff --git a/tests/ui/codemap_tests/tab_3.stderr b/tests/ui/codemap_tests/tab_3.stderr index 17bea2f366f..b17159be6e0 100644 --- a/tests/ui/codemap_tests/tab_3.stderr +++ b/tests/ui/codemap_tests/tab_3.stderr @@ -15,7 +15,7 @@ note: `into_iter` takes ownership of the receiver `self`, which moves `some_vec` help: you can `clone` the value and consume it, but this might not be your desired behavior | LL | some_vec.clone().into_iter(); - | ++++++++ + | ++++++++ error: aborting due to previous error diff --git a/tests/ui/const-generics/const-generic-default-wont-borrowck.stderr b/tests/ui/const-generics/const-generic-default-wont-borrowck.stderr index 0ed370b83c5..a345c48b088 100644 --- a/tests/ui/const-generics/const-generic-default-wont-borrowck.stderr +++ b/tests/ui/const-generics/const-generic-default-wont-borrowck.stderr @@ -2,7 +2,7 @@ error[E0381]: used binding `s` isn't initialized --> $DIR/const-generic-default-wont-borrowck.rs:2:26 | LL | let s: &'static str; s.len() - | - ^^^^^^^ `*s` used here but it isn't initialized + | - ^ `*s` used here but it isn't initialized | | | binding declared here but left uninitialized | diff --git a/tests/ui/const-generics/generic_const_exprs/issue-109141.stderr b/tests/ui/const-generics/generic_const_exprs/issue-109141.stderr index f61edd60e3b..8b8489ac2bc 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-109141.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-109141.stderr @@ -13,7 +13,7 @@ error[E0596]: cannot borrow `*self.0` as mutable, as it is behind a `&` referenc --> $DIR/issue-109141.rs:6:9 | LL | self.0.iter_mut() - | ^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | ^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | diff --git a/tests/ui/const-generics/issues/issue-67375.full.stderr b/tests/ui/const-generics/issues/issue-67375.full.stderr index 0cf69879a5c..13cb8d1cd68 100644 --- a/tests/ui/const-generics/issues/issue-67375.full.stderr +++ b/tests/ui/const-generics/issues/issue-67375.full.stderr @@ -2,7 +2,7 @@ error: overly complex generic constant --> $DIR/issue-67375.rs:7:17 | LL | inner: [(); { [|_: &T| {}; 0].len() }], - | ^^---------------------^^ + | ^^---------------^^^^^^^^ | | | pointer casts are not allowed in generic constants | diff --git a/tests/ui/consts/const_let_assign3.stderr b/tests/ui/consts/const_let_assign3.stderr index b550ac54573..89073f975e8 100644 --- a/tests/ui/consts/const_let_assign3.stderr +++ b/tests/ui/consts/const_let_assign3.stderr @@ -11,7 +11,7 @@ error[E0658]: mutable references are not allowed in constants --> $DIR/const_let_assign3.rs:14:5 | LL | s.foo(3); - | ^^^^^^^^ + | ^ | = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable diff --git a/tests/ui/did_you_mean/issue-34126.stderr b/tests/ui/did_you_mean/issue-34126.stderr index 5343acea4ad..9f792070628 100644 --- a/tests/ui/did_you_mean/issue-34126.stderr +++ b/tests/ui/did_you_mean/issue-34126.stderr @@ -19,9 +19,8 @@ error[E0502]: cannot borrow `self` as mutable because it is also borrowed as imm --> $DIR/issue-34126.rs:6:18 | LL | self.run(&mut self); - | ---------^^^^^^^^^- - | | | | - | | | mutable borrow occurs here + | ---- --- ^^^^^^^^^ mutable borrow occurs here + | | | | | immutable borrow later used by call | immutable borrow occurs here diff --git a/tests/ui/did_you_mean/issue-35937.stderr b/tests/ui/did_you_mean/issue-35937.stderr index 1670da55957..3081f2cec90 100644 --- a/tests/ui/did_you_mean/issue-35937.stderr +++ b/tests/ui/did_you_mean/issue-35937.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `f.v` as mutable, as `f` is not declared as mutable --> $DIR/issue-35937.rs:7:5 | LL | f.v.push("cat".to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable + | ^^^ cannot borrow as mutable | help: consider changing this to be mutable | diff --git a/tests/ui/did_you_mean/issue-38147-1.stderr b/tests/ui/did_you_mean/issue-38147-1.stderr index 74fb1c2eca3..790ad54a547 100644 --- a/tests/ui/did_you_mean/issue-38147-1.stderr +++ b/tests/ui/did_you_mean/issue-38147-1.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` referenc --> $DIR/issue-38147-1.rs:17:9 | LL | self.s.push('x'); - | ^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | ^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | diff --git a/tests/ui/did_you_mean/issue-38147-2.stderr b/tests/ui/did_you_mean/issue-38147-2.stderr index 7c287a7dbfa..d708be3d32f 100644 --- a/tests/ui/did_you_mean/issue-38147-2.stderr +++ b/tests/ui/did_you_mean/issue-38147-2.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` referenc --> $DIR/issue-38147-2.rs:9:9 | LL | self.s.push('x'); - | ^^^^^^^^^^^^^^^^ cannot borrow as mutable + | ^^^^^^ cannot borrow as mutable | help: consider changing this to be mutable | @@ -13,7 +13,7 @@ error[E0596]: cannot borrow `*self.longer_name` as mutable, as it is behind a `& --> $DIR/issue-38147-2.rs:12:9 | LL | self.longer_name.push(13); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable + | ^^^^^^^^^^^^^^^^ cannot borrow as mutable | help: consider changing this to be mutable | diff --git a/tests/ui/did_you_mean/issue-38147-3.stderr b/tests/ui/did_you_mean/issue-38147-3.stderr index 94ffe17f101..5b32b5a782c 100644 --- a/tests/ui/did_you_mean/issue-38147-3.stderr +++ b/tests/ui/did_you_mean/issue-38147-3.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` referenc --> $DIR/issue-38147-3.rs:7:9 | LL | self.s.push('x'); - | ^^^^^^^^^^^^^^^^ cannot borrow as mutable + | ^^^^^^ cannot borrow as mutable | help: consider changing this to be mutable | diff --git a/tests/ui/did_you_mean/issue-38147-4.stderr b/tests/ui/did_you_mean/issue-38147-4.stderr index 43647fa562b..38ab3c54d01 100644 --- a/tests/ui/did_you_mean/issue-38147-4.stderr +++ b/tests/ui/did_you_mean/issue-38147-4.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*f.s` as mutable, as it is behind a `&` reference --> $DIR/issue-38147-4.rs:6:5 | LL | f.s.push('x'); - | ^^^^^^^^^^^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | ^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | diff --git a/tests/ui/did_you_mean/issue-40823.stderr b/tests/ui/did_you_mean/issue-40823.stderr index ba94a570256..6f1ed355438 100644 --- a/tests/ui/did_you_mean/issue-40823.stderr +++ b/tests/ui/did_you_mean/issue-40823.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*buf` as mutable, as it is behind a `&` reference --> $DIR/issue-40823.rs:3:5 | LL | buf.iter_mut(); - | ^^^^^^^^^^^^^^ `buf` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | ^^^ `buf` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | diff --git a/tests/ui/dropck/drop-with-active-borrows-1.stderr b/tests/ui/dropck/drop-with-active-borrows-1.stderr index 4585b22974c..0409ffa02b1 100644 --- a/tests/ui/dropck/drop-with-active-borrows-1.stderr +++ b/tests/ui/dropck/drop-with-active-borrows-1.stderr @@ -4,7 +4,7 @@ error[E0505]: cannot move out of `a` because it is borrowed LL | let a = "".to_string(); | - binding `a` declared here LL | let b: Vec<&str> = a.lines().collect(); - | --------- borrow of `a` occurs here + | - borrow of `a` occurs here LL | drop(a); | ^ move out of `a` occurs here LL | for s in &b { diff --git a/tests/ui/dropck/drop-with-active-borrows-2.stderr b/tests/ui/dropck/drop-with-active-borrows-2.stderr index 24650dfac02..ffec9306b77 100644 --- a/tests/ui/dropck/drop-with-active-borrows-2.stderr +++ b/tests/ui/dropck/drop-with-active-borrows-2.stderr @@ -2,7 +2,7 @@ error[E0515]: cannot return value referencing local variable `raw_lines` --> $DIR/drop-with-active-borrows-2.rs:3:5 | LL | raw_lines.iter().map(|l| l.trim()).collect() - | ----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ---------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | returns a value referencing data owned by the current function | `raw_lines` is borrowed here diff --git a/tests/ui/error-codes/E0161.base.stderr b/tests/ui/error-codes/E0161.base.stderr index 15d98b657a2..ae82e6702e6 100644 --- a/tests/ui/error-codes/E0161.base.stderr +++ b/tests/ui/error-codes/E0161.base.stderr @@ -2,7 +2,7 @@ error[E0161]: cannot move a value of type `dyn Bar` --> $DIR/E0161.rs:16:5 | LL | x.f(); - | ^^^^^ the size of `dyn Bar` cannot be statically determined + | ^ the size of `dyn Bar` cannot be statically determined error: aborting due to previous error diff --git a/tests/ui/error-codes/E0499.stderr b/tests/ui/error-codes/E0499.stderr index af5a1e18633..d56baf72272 100644 --- a/tests/ui/error-codes/E0499.stderr +++ b/tests/ui/error-codes/E0499.stderr @@ -7,7 +7,7 @@ LL | let mut a = &mut i; | ^^^^^^ second mutable borrow occurs here LL | a.use_mut(); LL | x.use_mut(); - | ----------- first borrow later used here + | - first borrow later used here error: aborting due to previous error diff --git a/tests/ui/error-codes/E0502.stderr b/tests/ui/error-codes/E0502.stderr index 94cc89754db..cade6d71852 100644 --- a/tests/ui/error-codes/E0502.stderr +++ b/tests/ui/error-codes/E0502.stderr @@ -6,7 +6,7 @@ LL | let ref y = a; LL | bar(a); | ^^^^^^ mutable borrow occurs here LL | y.use_ref(); - | ----------- immutable borrow later used here + | - immutable borrow later used here error: aborting due to previous error diff --git a/tests/ui/error-codes/E0503.stderr b/tests/ui/error-codes/E0503.stderr index 2f02e3b1a61..275abb23f53 100644 --- a/tests/ui/error-codes/E0503.stderr +++ b/tests/ui/error-codes/E0503.stderr @@ -6,7 +6,7 @@ LL | let _borrow = &mut value; LL | let _sum = value + 1; | ^^^^^ use of borrowed `value` LL | _borrow.use_mut(); - | ----------------- borrow later used here + | ------- borrow later used here error: aborting due to previous error diff --git a/tests/ui/error-codes/E0505.stderr b/tests/ui/error-codes/E0505.stderr index 2ecb4a75c43..1a85e031705 100644 --- a/tests/ui/error-codes/E0505.stderr +++ b/tests/ui/error-codes/E0505.stderr @@ -9,7 +9,7 @@ LL | let _ref_to_val: &Value = &x; LL | eat(x); | ^ move out of `x` occurs here LL | _ref_to_val.use_ref(); - | --------------------- borrow later used here + | ----------- borrow later used here error: aborting due to previous error diff --git a/tests/ui/error-codes/E0507.stderr b/tests/ui/error-codes/E0507.stderr index 03630f38987..08993951622 100644 --- a/tests/ui/error-codes/E0507.stderr +++ b/tests/ui/error-codes/E0507.stderr @@ -2,9 +2,8 @@ error[E0507]: cannot move out of dereference of `Ref<'_, TheDarkKnight>` --> $DIR/E0507.rs:12:5 | LL | x.borrow().nothing_is_true(); - | ^^^^^^^^^^^----------------- - | | | - | | value moved due to this method call + | ^^^^^^^^^^ ----------------- value moved due to this method call + | | | move occurs because value has type `TheDarkKnight`, which does not implement the `Copy` trait | note: `TheDarkKnight::nothing_is_true` takes ownership of the receiver `self`, which moves value diff --git a/tests/ui/generator/dropck-resume.stderr b/tests/ui/generator/dropck-resume.stderr index b0756eb5589..ecf92e7e3ae 100644 --- a/tests/ui/generator/dropck-resume.stderr +++ b/tests/ui/generator/dropck-resume.stderr @@ -5,7 +5,7 @@ LL | let z = &mut y; | ------ mutable borrow occurs here ... LL | r = y.as_ref().unwrap(); - | ^^^^^^^^^^ immutable borrow occurs here + | ^ immutable borrow occurs here LL | LL | } | - mutable borrow might be used here, when `g` is dropped and runs the destructor for generator diff --git a/tests/ui/generator/dropck.stderr b/tests/ui/generator/dropck.stderr index b9a3a124acb..246ac99f83f 100644 --- a/tests/ui/generator/dropck.stderr +++ b/tests/ui/generator/dropck.stderr @@ -5,7 +5,7 @@ LL | let (mut gen, cell); | ---- binding `cell` declared here LL | cell = Box::new(RefCell::new(0)); LL | let ref_ = Box::leak(Box::new(Some(cell.borrow_mut()))); - | ^^^^^^^^^^^^^^^^^ borrowed value does not live long enough + | ^^^^ borrowed value does not live long enough ... LL | } | - diff --git a/tests/ui/hashmap/hashmap-iter-value-lifetime.stderr b/tests/ui/hashmap/hashmap-iter-value-lifetime.stderr index d6e7a1d45f0..de2591329c8 100644 --- a/tests/ui/hashmap/hashmap-iter-value-lifetime.stderr +++ b/tests/ui/hashmap/hashmap-iter-value-lifetime.stderr @@ -2,7 +2,7 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as --> $DIR/hashmap-iter-value-lifetime.rs:7:5 | LL | let (_, thing) = my_stuff.iter().next().unwrap(); - | --------------- immutable borrow occurs here + | -------- immutable borrow occurs here LL | LL | my_stuff.clear(); | ^^^^^^^^^^^^^^^^ mutable borrow occurs here diff --git a/tests/ui/hashmap/hashmap-lifetimes.stderr b/tests/ui/hashmap/hashmap-lifetimes.stderr index d1bcd53ae3b..497c7d1216c 100644 --- a/tests/ui/hashmap/hashmap-lifetimes.stderr +++ b/tests/ui/hashmap/hashmap-lifetimes.stderr @@ -2,7 +2,7 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as --> $DIR/hashmap-lifetimes.rs:6:5 | LL | let mut it = my_stuff.iter(); - | --------------- immutable borrow occurs here + | -------- immutable borrow occurs here LL | my_stuff.insert(1, 43); | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | it; diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-debruijn-in-receiver.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-debruijn-in-receiver.stderr index fa391ecba8a..70d5b3c2ec5 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-debruijn-in-receiver.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-debruijn-in-receiver.stderr @@ -2,9 +2,9 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time --> $DIR/hrtb-debruijn-in-receiver.rs:17:5 | LL | foo.insert(); - | ------------ first mutable borrow occurs here + | --- first mutable borrow occurs here LL | foo.insert(); - | ^^^^^^^^^^^^ + | ^^^ | | | second mutable borrow occurs here | first borrow later used here diff --git a/tests/ui/hygiene/fields-numeric-borrowck.stderr b/tests/ui/hygiene/fields-numeric-borrowck.stderr index bc13aa62f4d..fb90825c0d9 100644 --- a/tests/ui/hygiene/fields-numeric-borrowck.stderr +++ b/tests/ui/hygiene/fields-numeric-borrowck.stderr @@ -7,7 +7,7 @@ LL | let S { 0: ref mut borrow2 } = s; | ^^^^^^^^^^^^^^^ second mutable borrow occurs here ... LL | borrow1.use_mut(); - | ----------------- first borrow later used here + | ------- first borrow later used here error: aborting due to previous error diff --git a/tests/ui/issues/issue-13497-2.stderr b/tests/ui/issues/issue-13497-2.stderr index a365e24e27e..8ad921027e2 100644 --- a/tests/ui/issues/issue-13497-2.stderr +++ b/tests/ui/issues/issue-13497-2.stderr @@ -1,11 +1,13 @@ error[E0515]: cannot return value referencing local variable `rawLines` --> $DIR/issue-13497-2.rs:3:5 | -LL | // rawLines -LL | || .iter().map(|l| l.trim()).collect() - | ||_______________-___________________________^ returns a value referencing data owned by the current function - | |_______________| - | `rawLines` is borrowed here +LL | rawLines + | ^------- + | | + | _____`rawLines` is borrowed here + | | +LL | | .iter().map(|l| l.trim()).collect() + | |___________________________________________^ returns a value referencing data owned by the current function error: aborting due to previous error diff --git a/tests/ui/issues/issue-21600.stderr b/tests/ui/issues/issue-21600.stderr index ea304f9367b..f7905934424 100644 --- a/tests/ui/issues/issue-21600.stderr +++ b/tests/ui/issues/issue-21600.stderr @@ -5,7 +5,7 @@ LL | fn call_it<F>(f: F) where F: Fn() { f(); } | - change this to accept `FnMut` instead of `Fn` ... LL | call_it(|| x.gen_mut()); - | ------- -- ^^^^^^^^^^^ cannot borrow as mutable + | ------- -- ^ cannot borrow as mutable | | | | | in this closure | expects `Fn` instead of `FnMut` diff --git a/tests/ui/issues/issue-41726.stderr b/tests/ui/issues/issue-41726.stderr index b05c1fb14ef..7c87fde540d 100644 --- a/tests/ui/issues/issue-41726.stderr +++ b/tests/ui/issues/issue-41726.stderr @@ -2,13 +2,10 @@ error[E0596]: cannot borrow data in an index of `HashMap<String, Vec<String>>` a --> $DIR/issue-41726.rs:5:9 | LL | things[src.as_str()].sort(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable + | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<String, Vec<String>>` -help: to modify a `HashMap<String, Vec<String>>` use `.get_mut()` - | -LL | things.get_mut(src.as_str()).map(|val| val.sort()); - | ~~~~~~~~~ ~~~~~~~~~~~~~~~ + + = help: to modify a `HashMap<String, Vec<String>>`, use `.get_mut()`, `.insert()` or the entry API error: aborting due to previous error diff --git a/tests/ui/issues/issue-42106.stderr b/tests/ui/issues/issue-42106.stderr index 73cf8652f6d..d5a9d233bc9 100644 --- a/tests/ui/issues/issue-42106.stderr +++ b/tests/ui/issues/issue-42106.stderr @@ -4,9 +4,9 @@ error[E0502]: cannot borrow `*collection` as mutable because it is also borrowed LL | let _a = &collection; | ----------- immutable borrow occurs here LL | collection.swap(1, 2); - | ^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here + | ^^^^^^^^^^ mutable borrow occurs here LL | _a.use_ref(); - | ------------ immutable borrow later used here + | -- immutable borrow later used here error: aborting due to previous error diff --git a/tests/ui/issues/issue-44405.stderr b/tests/ui/issues/issue-44405.stderr index 626cb2999e1..1fd69f6e777 100644 --- a/tests/ui/issues/issue-44405.stderr +++ b/tests/ui/issues/issue-44405.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow data in an index of `Container` as mutable --> $DIR/issue-44405.rs:21:5 | LL | container[&mut val].test(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable + | ^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `Container` diff --git a/tests/ui/issues/issue-52126-assign-op-invariance.stderr b/tests/ui/issues/issue-52126-assign-op-invariance.stderr index 2d3b48832c5..316e755f42a 100644 --- a/tests/ui/issues/issue-52126-assign-op-invariance.stderr +++ b/tests/ui/issues/issue-52126-assign-op-invariance.stderr @@ -4,7 +4,7 @@ error[E0597]: `line` does not live long enough LL | for line in vec!["123456789".to_string(), "12345678".to_string()] { | ---- binding `line` declared here LL | let v: Vec<&str> = line.split_whitespace().collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough + | ^^^^ borrowed value does not live long enough ... LL | acc += cnt2; | --- borrow later used here diff --git a/tests/ui/issues/issue-61108.stderr b/tests/ui/issues/issue-61108.stderr index 3aaf5fb3f3e..dd87b62664b 100644 --- a/tests/ui/issues/issue-61108.stderr +++ b/tests/ui/issues/issue-61108.stderr @@ -7,7 +7,7 @@ LL | for l in bad_letters { | ----------- `bad_letters` moved due to this implicit call to `.into_iter()` ... LL | bad_letters.push('s'); - | ^^^^^^^^^^^^^^^^^^^^^ value borrowed here after move + | ^^^^^^^^^^^ value borrowed here after move | note: `into_iter` takes ownership of the receiver `self`, which moves `bad_letters` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL diff --git a/tests/ui/issues/issue-81584.stderr b/tests/ui/issues/issue-81584.stderr index 54973cfa34e..d57f1b778df 100644 --- a/tests/ui/issues/issue-81584.stderr +++ b/tests/ui/issues/issue-81584.stderr @@ -2,7 +2,7 @@ error[E0515]: cannot return value referencing function parameter `y` --> $DIR/issue-81584.rs:5:22 | LL | .map(|y| y.iter().map(|x| x + 1)) - | --------^^^^^^^^^^^^^^^ + | -^^^^^^^^^^^^^^^^^^^^^^ | | | returns a value referencing data owned by the current function | `y` is borrowed here diff --git a/tests/ui/lifetimes/borrowck-let-suggestion.stderr b/tests/ui/lifetimes/borrowck-let-suggestion.stderr index 987b051b111..38fd92d7619 100644 --- a/tests/ui/lifetimes/borrowck-let-suggestion.stderr +++ b/tests/ui/lifetimes/borrowck-let-suggestion.stderr @@ -7,7 +7,7 @@ LL | let mut x = vec![1].iter(); | creates a temporary value which is freed while still in use LL | LL | x.use_mut(); - | ----------- borrow later used here + | - borrow later used here | = note: consider using a `let` binding to create a longer lived value = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr index cc2447b1877..cb629d2e3d3 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr @@ -1,3 +1,14 @@ +error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable + --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3 + | +LL | y.push(z); + | ^ cannot borrow as mutable + | +help: consider changing this to be mutable + | +LL | fn foo(x:fn(&u8, &u8), mut y: Vec<&u8>, z: &u8) { + | +++ + error: lifetime may not live long enough --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3 | @@ -13,17 +24,6 @@ help: consider introducing a named lifetime parameter LL | fn foo<'a>(x:fn(&u8, &u8), y: Vec<&'a u8>, z: &'a u8) { | ++++ ++ ++ -error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable - --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:3 - | -LL | y.push(z); - | ^^^^^^^^^ cannot borrow as mutable - | -help: consider changing this to be mutable - | -LL | fn foo(x:fn(&u8, &u8), mut y: Vec<&u8>, z: &u8) { - | +++ - error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr index 2ba5afa808d..05f9308124b 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr @@ -1,3 +1,14 @@ +error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable + --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3 + | +LL | y.push(z); + | ^ cannot borrow as mutable + | +help: consider changing this to be mutable + | +LL | fn foo(x:Box<dyn Fn(&u8, &u8)> , mut y: Vec<&u8>, z: &u8) { + | +++ + error: lifetime may not live long enough --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3 | @@ -13,17 +24,6 @@ help: consider introducing a named lifetime parameter LL | fn foo<'a>(x:Box<dyn Fn(&u8, &u8)> , y: Vec<&'a u8>, z: &'a u8) { | ++++ ++ ++ -error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable - --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:3 - | -LL | y.push(z); - | ^^^^^^^^^ cannot borrow as mutable - | -help: consider changing this to be mutable - | -LL | fn foo(x:Box<dyn Fn(&u8, &u8)> , mut y: Vec<&u8>, z: &u8) { - | +++ - error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/lint/lint-qualification.stderr b/tests/ui/lint/lint-qualification.stderr index 149a782d97c..d09cb78c4f0 100644 --- a/tests/ui/lint/lint-qualification.stderr +++ b/tests/ui/lint/lint-qualification.stderr @@ -9,6 +9,10 @@ note: the lint level is defined here | LL | #![deny(unused_qualifications)] | ^^^^^^^^^^^^^^^^^^^^^ +help: replace it with the unqualified path + | +LL | bar(); + | ~~~ error: aborting due to previous error diff --git a/tests/ui/lint/unaligned_references.stderr b/tests/ui/lint/unaligned_references.stderr index 5f9cecadbff..d3abc37669f 100644 --- a/tests/ui/lint/unaligned_references.stderr +++ b/tests/ui/lint/unaligned_references.stderr @@ -52,7 +52,7 @@ error[E0793]: reference to packed field is unaligned --> $DIR/unaligned_references.rs:40:17 | LL | let _ = good.data.clone(); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^ | = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) diff --git a/tests/ui/macros/format-args-temporaries-in-write.stderr b/tests/ui/macros/format-args-temporaries-in-write.stderr index 520b2ce5052..e05246cfbe3 100644 --- a/tests/ui/macros/format-args-temporaries-in-write.stderr +++ b/tests/ui/macros/format-args-temporaries-in-write.stderr @@ -4,7 +4,7 @@ error[E0597]: `mutex` does not live long enough LL | let mutex = Mutex; | ----- binding `mutex` declared here LL | write!(Out, "{}", mutex.lock()) /* no semicolon */ - | ^^^^^^^^^^^^ + | ^^^^^------- | | | borrowed value does not live long enough | a temporary with access to the borrow is created here ... @@ -21,7 +21,7 @@ error[E0597]: `mutex` does not live long enough LL | let mutex = Mutex; | ----- binding `mutex` declared here LL | writeln!(Out, "{}", mutex.lock()) /* no semicolon */ - | ^^^^^^^^^^^^ + | ^^^^^------- | | | borrowed value does not live long enough | a temporary with access to the borrow is created here ... diff --git a/tests/ui/macros/issue-19163.stderr b/tests/ui/macros/issue-19163.stderr index ae1ae14266f..af509aa59d4 100644 --- a/tests/ui/macros/issue-19163.stderr +++ b/tests/ui/macros/issue-19163.stderr @@ -1,10 +1,8 @@ error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/issue-19163.rs:9:5 + --> $DIR/issue-19163.rs:9:14 | LL | mywrite!(&v, "Hello world"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable - | - = note: this error originates in the macro `mywrite` (in Nightly builds, run with -Z macro-backtrace for more info) + | ^^ cannot borrow as mutable error: aborting due to previous error diff --git a/tests/ui/match/issue-74050-end-span.stderr b/tests/ui/match/issue-74050-end-span.stderr index 0b3425f2b1a..0dafeae870e 100644 --- a/tests/ui/match/issue-74050-end-span.stderr +++ b/tests/ui/match/issue-74050-end-span.stderr @@ -6,7 +6,7 @@ LL | let _arg = match args.next() { LL | Some(arg) => { | --- binding `arg` declared here LL | match arg.to_str() { - | ^^^^^^^^^^^^ borrowed value does not live long enough + | ^^^ borrowed value does not live long enough ... LL | } | - `arg` dropped here while still borrowed diff --git a/tests/ui/methods/method-self-arg-2.stderr b/tests/ui/methods/method-self-arg-2.stderr index b98f7a78661..946e71ee5b9 100644 --- a/tests/ui/methods/method-self-arg-2.stderr +++ b/tests/ui/methods/method-self-arg-2.stderr @@ -6,7 +6,7 @@ LL | let y = &mut x; LL | Foo::bar(&x); | ^^ immutable borrow occurs here LL | y.use_mut(); - | ----------- mutable borrow later used here + | - mutable borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time --> $DIR/method-self-arg-2.rs:20:14 @@ -16,7 +16,7 @@ LL | let y = &mut x; LL | Foo::baz(&mut x); | ^^^^^^ second mutable borrow occurs here LL | y.use_mut(); - | ----------- first borrow later used here + | - first borrow later used here error: aborting due to 2 previous errors diff --git a/tests/ui/moves/move-fn-self-receiver.stderr b/tests/ui/moves/move-fn-self-receiver.stderr index 91d237b1d1a..c91a8b5efac 100644 --- a/tests/ui/moves/move-fn-self-receiver.stderr +++ b/tests/ui/moves/move-fn-self-receiver.stderr @@ -12,7 +12,7 @@ note: `into_iter` takes ownership of the receiver `self`, which moves `val.0` help: you can `clone` the value and consume it, but this might not be your desired behavior | LL | val.0.clone().into_iter().next(); - | ++++++++ + | ++++++++ error[E0382]: use of moved value: `foo` --> $DIR/move-fn-self-receiver.rs:34:5 @@ -78,7 +78,7 @@ error[E0505]: cannot move out of `mut_foo` because it is borrowed LL | let mut mut_foo = Foo; | ----------- binding `mut_foo` declared here LL | let ret = mut_foo.use_mut_self(); - | ---------------------- borrow of `mut_foo` occurs here + | ------- borrow of `mut_foo` occurs here LL | mut_foo; | ^^^^^^^ move out of `mut_foo` occurs here LL | ret; @@ -102,7 +102,7 @@ LL | fn use_rc_self(self: Rc<Self>) {} help: you can `clone` the value and consume it, but this might not be your desired behavior | LL | rc_foo.clone().use_rc_self(); - | ++++++++ + | ++++++++ error[E0382]: use of moved value: `foo_add` --> $DIR/move-fn-self-receiver.rs:59:5 @@ -145,7 +145,7 @@ LL | explicit_into_iter; help: you can `clone` the value and consume it, but this might not be your desired behavior | LL | for _val in explicit_into_iter.clone().into_iter() {} - | ++++++++ + | ++++++++ error[E0382]: use of moved value: `container` --> $DIR/move-fn-self-receiver.rs:71:5 diff --git a/tests/ui/moves/moves-based-on-type-access-to-field.stderr b/tests/ui/moves/moves-based-on-type-access-to-field.stderr index a28f324aafa..73901866396 100644 --- a/tests/ui/moves/moves-based-on-type-access-to-field.stderr +++ b/tests/ui/moves/moves-based-on-type-access-to-field.stderr @@ -13,7 +13,7 @@ note: `into_iter` takes ownership of the receiver `self`, which moves `x` help: you can `clone` the value and consume it, but this might not be your desired behavior | LL | consume(x.clone().into_iter().next().unwrap()); - | ++++++++ + | ++++++++ error: aborting due to previous error diff --git a/tests/ui/moves/moves-based-on-type-exprs.stderr b/tests/ui/moves/moves-based-on-type-exprs.stderr index ab7c2745688..45f7d4063a5 100644 --- a/tests/ui/moves/moves-based-on-type-exprs.stderr +++ b/tests/ui/moves/moves-based-on-type-exprs.stderr @@ -165,7 +165,7 @@ note: `into_iter` takes ownership of the receiver `self`, which moves `x` help: you can `clone` the value and consume it, but this might not be your desired behavior | LL | let _y = x.clone().into_iter().next().unwrap(); - | ++++++++ + | ++++++++ error[E0382]: borrow of moved value: `x` --> $DIR/moves-based-on-type-exprs.rs:83:11 @@ -182,7 +182,7 @@ note: `into_iter` takes ownership of the receiver `self`, which moves `x` help: you can `clone` the value and consume it, but this might not be your desired behavior | LL | let _y = [x.clone().into_iter().next().unwrap(); 1]; - | ++++++++ + | ++++++++ error: aborting due to 11 previous errors diff --git a/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr index 7e513b73c21..a184482a446 100644 --- a/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr +++ b/tests/ui/moves/pin-mut-reborrow-infer-var-issue-107419.stderr @@ -13,7 +13,7 @@ note: `Pin::<&'a mut T>::get_mut` takes ownership of the receiver `self`, which help: consider reborrowing the `Pin` instead of moving it | LL | foo(r.as_mut().get_mut()); - | +++++++++ + | +++++++++ error: aborting due to previous error diff --git a/tests/ui/moves/pin-mut-reborrow.stderr b/tests/ui/moves/pin-mut-reborrow.stderr index 16fa4bacc2d..4bf207e7e98 100644 --- a/tests/ui/moves/pin-mut-reborrow.stderr +++ b/tests/ui/moves/pin-mut-reborrow.stderr @@ -16,7 +16,7 @@ LL | fn foo(self: Pin<&mut Self>) {} help: consider reborrowing the `Pin` instead of moving it | LL | foo.as_mut().foo(); - | +++++++++ + | +++++++++ error: aborting due to previous error diff --git a/tests/ui/moves/suggest-clone.stderr b/tests/ui/moves/suggest-clone.stderr index cbb3dfea3ba..065acf904a4 100644 --- a/tests/ui/moves/suggest-clone.stderr +++ b/tests/ui/moves/suggest-clone.stderr @@ -2,9 +2,8 @@ error[E0507]: cannot move out of `*foo` which is behind a shared reference --> $DIR/suggest-clone.rs:10:5 | LL | foo.foo(); - | ^^^^----- - | | | - | | `*foo` moved due to this method call + | ^^^ ----- `*foo` moved due to this method call + | | | move occurs because `*foo` has type `Foo`, which does not implement the `Copy` trait | note: `Foo::foo` takes ownership of the receiver `self`, which moves `*foo` @@ -15,7 +14,7 @@ LL | fn foo(self) {} help: you can `clone` the value and consume it, but this might not be your desired behavior | LL | foo.clone().foo(); - | ++++++++ + | ++++++++ error: aborting due to previous error diff --git a/tests/ui/mut/mut-cant-alias.stderr b/tests/ui/mut/mut-cant-alias.stderr index 6046c076f2e..d56e45db13d 100644 --- a/tests/ui/mut/mut-cant-alias.stderr +++ b/tests/ui/mut/mut-cant-alias.stderr @@ -6,7 +6,7 @@ LL | let b1 = &mut *b; LL | let b2 = &mut *b; | ^ second mutable borrow occurs here LL | b1.use_mut(); - | ------------ first borrow later used here + | -- first borrow later used here error: aborting due to previous error diff --git a/tests/ui/mut/mut-suggestion.stderr b/tests/ui/mut/mut-suggestion.stderr index d89c8b41304..1521ae4c5ea 100644 --- a/tests/ui/mut/mut-suggestion.stderr +++ b/tests/ui/mut/mut-suggestion.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable --> $DIR/mut-suggestion.rs:12:5 | LL | arg.mutate(); - | ^^^^^^^^^^^^ cannot borrow as mutable + | ^^^ cannot borrow as mutable | help: consider changing this to be mutable | @@ -13,7 +13,7 @@ error[E0596]: cannot borrow `local` as mutable, as it is not declared as mutable --> $DIR/mut-suggestion.rs:20:5 | LL | local.mutate(); - | ^^^^^^^^^^^^^^ cannot borrow as mutable + | ^^^^^ cannot borrow as mutable | help: consider changing this to be mutable | diff --git a/tests/ui/nll/closure-access-spans.stderr b/tests/ui/nll/closure-access-spans.stderr index 035dd5a5610..3e98fbd5e1d 100644 --- a/tests/ui/nll/closure-access-spans.stderr +++ b/tests/ui/nll/closure-access-spans.stderr @@ -8,7 +8,7 @@ LL | || x; | | | immutable borrow occurs here LL | r.use_mut(); - | ----------- mutable borrow later used here + | - mutable borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time --> $DIR/closure-access-spans.rs:11:5 @@ -20,7 +20,7 @@ LL | || x = 2; | | | second mutable borrow occurs here LL | r.use_mut(); - | ----------- first borrow later used here + | - first borrow later used here error[E0500]: closure requires unique access to `x` but it is already borrowed --> $DIR/closure-access-spans.rs:17:5 @@ -32,7 +32,7 @@ LL | || *x = 2; | | | closure construction occurs here LL | r.use_mut(); - | ----------- first borrow later used here + | - first borrow later used here error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/closure-access-spans.rs:23:13 @@ -42,7 +42,7 @@ LL | let r = &mut x; LL | move || x; | ^ use of borrowed `x` LL | r.use_ref(); - | ----------- borrow later used here + | - borrow later used here error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/closure-access-spans.rs:29:5 @@ -56,7 +56,7 @@ LL | || x; | | | move out of `x` occurs here LL | r.use_ref(); - | ----------- borrow later used here + | - borrow later used here error[E0382]: borrow of moved value: `x` --> $DIR/closure-access-spans.rs:35:5 diff --git a/tests/ui/nll/closure-borrow-spans.stderr b/tests/ui/nll/closure-borrow-spans.stderr index cf0df5834cc..cac22c2ecda 100644 --- a/tests/ui/nll/closure-borrow-spans.stderr +++ b/tests/ui/nll/closure-borrow-spans.stderr @@ -8,7 +8,7 @@ LL | let f = || x.len(); LL | let y = x; | ^ move out of `x` occurs here LL | f.use_ref(); - | ----------- borrow later used here + | - borrow later used here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable --> $DIR/closure-borrow-spans.rs:11:13 @@ -20,7 +20,7 @@ LL | let f = || x; LL | let y = &mut x; | ^^^^^^ mutable borrow occurs here LL | f.use_ref(); - | ----------- immutable borrow later used here + | - immutable borrow later used here error[E0597]: `x` does not live long enough --> $DIR/closure-borrow-spans.rs:19:16 @@ -32,7 +32,7 @@ LL | f = || x; LL | } | - `x` dropped here while still borrowed LL | f.use_ref(); - | ----------- borrow later used here + | - borrow later used here error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/closure-borrow-spans.rs:26:5 @@ -44,7 +44,7 @@ LL | let f = || x; LL | x = 1; | ^^^^^ `x` is assigned to here but it was already borrowed LL | f.use_ref(); - | ----------- borrow later used here + | - borrow later used here error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/closure-borrow-spans.rs:32:13 @@ -56,7 +56,7 @@ LL | let f = || x = 0; LL | let y = x; | ^ use of borrowed `x` LL | f.use_ref(); - | ----------- borrow later used here + | - borrow later used here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable --> $DIR/closure-borrow-spans.rs:38:13 @@ -68,7 +68,7 @@ LL | let f = || x = 0; LL | let y = &x; | ^^ immutable borrow occurs here LL | f.use_ref(); - | ----------- mutable borrow later used here + | - mutable borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time --> $DIR/closure-borrow-spans.rs:44:13 @@ -80,7 +80,7 @@ LL | let f = || x = 0; LL | let y = &mut x; | ^^^^^^ second mutable borrow occurs here LL | f.use_ref(); - | ----------- first borrow later used here + | - first borrow later used here error[E0597]: `x` does not live long enough --> $DIR/closure-borrow-spans.rs:52:16 @@ -92,7 +92,7 @@ LL | f = || x = 0; LL | } | - `x` dropped here while still borrowed LL | f.use_ref(); - | ----------- borrow later used here + | - borrow later used here error[E0506]: cannot assign to `x` because it is borrowed --> $DIR/closure-borrow-spans.rs:59:5 @@ -104,7 +104,7 @@ LL | let f = || x = 0; LL | x = 1; | ^^^^^ `x` is assigned to here but it was already borrowed LL | f.use_ref(); - | ----------- borrow later used here + | - borrow later used here error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/closure-borrow-spans.rs:65:13 @@ -116,7 +116,7 @@ LL | let f = || *x = 0; LL | let y = x; | ^ move out of `x` occurs here LL | f.use_ref(); - | ----------- borrow later used here + | - borrow later used here error[E0501]: cannot borrow `x` as immutable because previous closure requires unique access --> $DIR/closure-borrow-spans.rs:71:13 @@ -128,7 +128,7 @@ LL | let f = || *x = 0; LL | let y = &x; | ^^ second borrow occurs here LL | f.use_ref(); - | ----------- first borrow later used here + | - first borrow later used here error[E0501]: cannot borrow `x` as mutable because previous closure requires unique access --> $DIR/closure-borrow-spans.rs:77:13 @@ -140,7 +140,7 @@ LL | let f = || *x = 0; LL | let y = &mut x; | ^^^^^^ second borrow occurs here LL | f.use_ref(); - | ----------- first borrow later used here + | - first borrow later used here error[E0597]: `x` does not live long enough --> $DIR/closure-borrow-spans.rs:86:16 @@ -152,7 +152,7 @@ LL | f = || *x = 0; LL | } | - `x` dropped here while still borrowed LL | f.use_ref(); - | ----------- borrow later used here + | - borrow later used here error[E0506]: cannot assign to `*x` because it is borrowed --> $DIR/closure-borrow-spans.rs:93:5 @@ -164,7 +164,7 @@ LL | let f = || *x = 0; LL | *x = 1; | ^^^^^^ `*x` is assigned to here but it was already borrowed LL | f.use_ref(); - | ----------- borrow later used here + | - borrow later used here error: aborting due to 14 previous errors diff --git a/tests/ui/nll/closures-in-loops.stderr b/tests/ui/nll/closures-in-loops.stderr index 1c1a31d356d..2c1008c516c 100644 --- a/tests/ui/nll/closures-in-loops.stderr +++ b/tests/ui/nll/closures-in-loops.stderr @@ -13,9 +13,8 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time --> $DIR/closures-in-loops.rs:13:16 | LL | v.push(|| x = String::new()); - | -------^^------------------- - | | | | - | | | borrows occur due to use of `x` in closure + | - ^^ - borrows occur due to use of `x` in closure + | | | | | `x` was mutably borrowed here in the previous iteration of the loop | first borrow used here, in later iteration of loop @@ -23,9 +22,8 @@ error[E0524]: two closures require unique access to `x` at the same time --> $DIR/closures-in-loops.rs:20:16 | LL | v.push(|| *x = String::new()); - | -------^^-------------------- - | | | | - | | | borrows occur due to use of `x` in closure + | - ^^ -- borrows occur due to use of `x` in closure + | | | | | closures are constructed here in different iterations of loop | first borrow used here, in later iteration of loop diff --git a/tests/ui/nll/get_default.stderr b/tests/ui/nll/get_default.stderr index 6998c04336e..af79771e7e1 100644 --- a/tests/ui/nll/get_default.stderr +++ b/tests/ui/nll/get_default.stderr @@ -5,7 +5,7 @@ LL | fn ok(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` LL | loop { LL | match map.get() { - | --------- immutable borrow occurs here + | --- immutable borrow occurs here LL | Some(v) => { LL | return v; | - returning this value requires that `*map` is borrowed for `'1` @@ -20,7 +20,7 @@ LL | fn err(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` LL | loop { LL | match map.get() { - | --------- immutable borrow occurs here + | --- immutable borrow occurs here LL | Some(v) => { LL | map.set(String::new()); // Both AST and MIR error here | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here @@ -35,7 +35,7 @@ LL | fn err(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` LL | loop { LL | match map.get() { - | --------- immutable borrow occurs here + | --- immutable borrow occurs here ... LL | return v; | - returning this value requires that `*map` is borrowed for `'1` diff --git a/tests/ui/nll/issue-46589.stderr b/tests/ui/nll/issue-46589.stderr index 60ef3f7b85e..82cd364eeff 100644 --- a/tests/ui/nll/issue-46589.stderr +++ b/tests/ui/nll/issue-46589.stderr @@ -2,10 +2,10 @@ error[E0499]: cannot borrow `**other` as mutable more than once at a time --> $DIR/issue-46589.rs:23:21 | LL | *other = match (*other).get_self() { - | ------------------- first mutable borrow occurs here + | -------- first mutable borrow occurs here LL | Some(s) => s, LL | None => (*other).new_self() - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^ | | | second mutable borrow occurs here | first borrow later used here diff --git a/tests/ui/nll/issue-51191.stderr b/tests/ui/nll/issue-51191.stderr index 27b1f8705ff..c14056c3a83 100644 --- a/tests/ui/nll/issue-51191.stderr +++ b/tests/ui/nll/issue-51191.stderr @@ -48,7 +48,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/issue-51191.rs:22:9 | LL | (&mut self).bar(); - | ^^^^^^^^^^^^^^^^^ cannot borrow as mutable + | ^^^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable --> $DIR/issue-51191.rs:28:9 diff --git a/tests/ui/nll/issue-52669.stderr b/tests/ui/nll/issue-52669.stderr index 807b95f7e13..db53e444b9e 100644 --- a/tests/ui/nll/issue-52669.stderr +++ b/tests/ui/nll/issue-52669.stderr @@ -7,7 +7,7 @@ LL | a.b = B; LL | foo(a); | - value moved here LL | a.b.clone() - | ^^^^^^^^^^^ value borrowed here after move + | ^^^ value borrowed here after move error: aborting due to previous error diff --git a/tests/ui/nll/issue-53773.stderr b/tests/ui/nll/issue-53773.stderr index 90cba2a145f..fc185d42d5f 100644 --- a/tests/ui/nll/issue-53773.stderr +++ b/tests/ui/nll/issue-53773.stderr @@ -2,7 +2,9 @@ error[E0713]: borrow may still be in use when destructor runs --> $DIR/issue-53773.rs:41:22 | LL | members.push(child.raw); - | -------------^^^^^^^^^- borrow later used here + | ------- ^^^^^^^^^ + | | + | borrow later used here LL | LL | } | - here, drop of `child` needs exclusive access to `*child.raw`, because the type `C<'_>` implements the `Drop` trait diff --git a/tests/ui/nll/issue-54556-niconii.stderr b/tests/ui/nll/issue-54556-niconii.stderr index d41d462f2bc..ad0a2d1e324 100644 --- a/tests/ui/nll/issue-54556-niconii.stderr +++ b/tests/ui/nll/issue-54556-niconii.stderr @@ -5,7 +5,7 @@ LL | let counter = Mutex; | ------- binding `counter` declared here LL | LL | if let Ok(_) = counter.lock() { } - | ^^^^^^^^^^^^^^ + | ^^^^^^^------- | | | borrowed value does not live long enough | a temporary with access to the borrow is created here ... diff --git a/tests/ui/nll/issue-62007-assign-const-index.stderr b/tests/ui/nll/issue-62007-assign-const-index.stderr index 12e28aa3fba..0db9fe62c38 100644 --- a/tests/ui/nll/issue-62007-assign-const-index.stderr +++ b/tests/ui/nll/issue-62007-assign-const-index.stderr @@ -17,7 +17,7 @@ LL | fn to_refs<T>(mut list: [&mut List<T>; 2]) -> Vec<&mut T> { | - let's call the lifetime of this reference `'1` ... LL | if let Some(n) = list[0].next.as_mut() { - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^--------- | | | `list[_].next` was mutably borrowed here in the previous iteration of the loop | argument requires that `list[_].next` is borrowed for `'1` diff --git a/tests/ui/nll/issue-62007-assign-differing-fields.stderr b/tests/ui/nll/issue-62007-assign-differing-fields.stderr index 4488431fc57..f1af2e855af 100644 --- a/tests/ui/nll/issue-62007-assign-differing-fields.stderr +++ b/tests/ui/nll/issue-62007-assign-differing-fields.stderr @@ -17,7 +17,7 @@ LL | fn to_refs<'a, T>(mut list: (&'a mut List<T>, &'a mut List<T>)) -> Vec<&'a | -- lifetime `'a` defined here ... LL | if let Some(n) = (list.0).next.as_mut() { - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^--------- | | | `list.0.next` was mutably borrowed here in the previous iteration of the loop | argument requires that `list.0.next` is borrowed for `'a` diff --git a/tests/ui/nll/loan_ends_mid_block_vec.stderr b/tests/ui/nll/loan_ends_mid_block_vec.stderr index 22c72af61d6..c0b97bea348 100644 --- a/tests/ui/nll/loan_ends_mid_block_vec.stderr +++ b/tests/ui/nll/loan_ends_mid_block_vec.stderr @@ -5,7 +5,7 @@ LL | let slice = &mut data; | --------- first mutable borrow occurs here LL | capitalize(slice); LL | data.push('d'); - | ^^^^^^^^^^^^^^ second mutable borrow occurs here + | ^^^^ second mutable borrow occurs here ... LL | capitalize(slice); | ----- first borrow later used here @@ -17,7 +17,7 @@ LL | let slice = &mut data; | --------- first mutable borrow occurs here ... LL | data.push('e'); - | ^^^^^^^^^^^^^^ second mutable borrow occurs here + | ^^^^ second mutable borrow occurs here ... LL | capitalize(slice); | ----- first borrow later used here @@ -29,7 +29,7 @@ LL | let slice = &mut data; | --------- first mutable borrow occurs here ... LL | data.push('f'); - | ^^^^^^^^^^^^^^ second mutable borrow occurs here + | ^^^^ second mutable borrow occurs here LL | LL | capitalize(slice); | ----- first borrow later used here diff --git a/tests/ui/nll/polonius/assignment-to-differing-field.stderr b/tests/ui/nll/polonius/assignment-to-differing-field.stderr index afa1b934439..acac47eac4f 100644 --- a/tests/ui/nll/polonius/assignment-to-differing-field.stderr +++ b/tests/ui/nll/polonius/assignment-to-differing-field.stderr @@ -17,7 +17,7 @@ LL | fn assignment_to_field_projection<'a, T>( | -- lifetime `'a` defined here ... LL | if let Some(n) = (list.0).next.as_mut() { - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^--------- | | | `list.0.next` was mutably borrowed here in the previous iteration of the loop | argument requires that `list.0.next` is borrowed for `'a` @@ -41,7 +41,7 @@ LL | fn assignment_through_projection_chain<'a, T>( | -- lifetime `'a` defined here ... LL | if let Some(n) = ((((list.0).0).0).0).0.next.as_mut() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^--------- | | | `list.0.0.0.0.0.next` was mutably borrowed here in the previous iteration of the loop | argument requires that `list.0.0.0.0.0.next` is borrowed for `'a` diff --git a/tests/ui/nll/return_from_loop.stderr b/tests/ui/nll/return_from_loop.stderr index bd2b8b15859..efd56ea2dd5 100644 --- a/tests/ui/nll/return_from_loop.stderr +++ b/tests/ui/nll/return_from_loop.stderr @@ -5,10 +5,10 @@ LL | let value = &mut my_struct.field; | -------------------- first mutable borrow occurs here LL | loop { LL | my_struct.field.push_str("Hello, world!"); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here + | ^^^^^^^^^^^^^^^ second mutable borrow occurs here LL | LL | value.len(); - | ----------- first borrow later used here + | ----- first borrow later used here error: aborting due to previous error diff --git a/tests/ui/object-safety/object-safety-by-value-self-use.stderr b/tests/ui/object-safety/object-safety-by-value-self-use.stderr index 94fdcdf263a..17f4cb4d4a8 100644 --- a/tests/ui/object-safety/object-safety-by-value-self-use.stderr +++ b/tests/ui/object-safety/object-safety-by-value-self-use.stderr @@ -2,7 +2,7 @@ error[E0161]: cannot move a value of type `dyn Bar` --> $DIR/object-safety-by-value-self-use.rs:15:5 | LL | t.bar() - | ^^^^^^^ the size of `dyn Bar` cannot be statically determined + | ^ the size of `dyn Bar` cannot be statically determined error: aborting due to previous error diff --git a/tests/ui/regions/region-object-lifetime-5.rs b/tests/ui/regions/region-object-lifetime-5.rs index ad359367168..307bbcbd58d 100644 --- a/tests/ui/regions/region-object-lifetime-5.rs +++ b/tests/ui/regions/region-object-lifetime-5.rs @@ -8,7 +8,7 @@ trait Foo { // Here, the object is bounded by an anonymous lifetime and returned // as `&'static`, so you get an error. fn owned_receiver(x: Box<dyn Foo>) -> &'static () { - x.borrowed() //~ ERROR cannot return reference to local data `*x` + x.borrowed() //~ ERROR cannot return value referencing local data `*x` } fn main() {} diff --git a/tests/ui/regions/region-object-lifetime-5.stderr b/tests/ui/regions/region-object-lifetime-5.stderr index b82b58c7a8e..b86f6e3a2a1 100644 --- a/tests/ui/regions/region-object-lifetime-5.stderr +++ b/tests/ui/regions/region-object-lifetime-5.stderr @@ -1,8 +1,11 @@ -error[E0515]: cannot return reference to local data `*x` +error[E0515]: cannot return value referencing local data `*x` --> $DIR/region-object-lifetime-5.rs:11:5 | LL | x.borrowed() - | ^^^^^^^^^^^^ returns a reference to data owned by the current function + | -^^^^^^^^^^^ + | | + | returns a value referencing data owned by the current function + | `*x` is borrowed here error: aborting due to previous error diff --git a/tests/ui/resolve/unused-qualifications-suggestion.fixed b/tests/ui/resolve/unused-qualifications-suggestion.fixed new file mode 100644 index 00000000000..0d4b9007c7b --- /dev/null +++ b/tests/ui/resolve/unused-qualifications-suggestion.fixed @@ -0,0 +1,23 @@ +// run-rustfix + +#![deny(unused_qualifications)] + +mod foo { + pub fn bar() {} +} + +mod baz { + pub mod qux { + pub fn quux() {} + } +} + +fn main() { + use foo::bar; + bar(); + //~^ ERROR unnecessary qualification + + use baz::qux::quux; + quux(); + //~^ ERROR unnecessary qualification +} diff --git a/tests/ui/resolve/unused-qualifications-suggestion.rs b/tests/ui/resolve/unused-qualifications-suggestion.rs new file mode 100644 index 00000000000..f6722e96537 --- /dev/null +++ b/tests/ui/resolve/unused-qualifications-suggestion.rs @@ -0,0 +1,23 @@ +// run-rustfix + +#![deny(unused_qualifications)] + +mod foo { + pub fn bar() {} +} + +mod baz { + pub mod qux { + pub fn quux() {} + } +} + +fn main() { + use foo::bar; + foo::bar(); + //~^ ERROR unnecessary qualification + + use baz::qux::quux; + baz::qux::quux(); + //~^ ERROR unnecessary qualification +} diff --git a/tests/ui/resolve/unused-qualifications-suggestion.stderr b/tests/ui/resolve/unused-qualifications-suggestion.stderr new file mode 100644 index 00000000000..c8e91e07295 --- /dev/null +++ b/tests/ui/resolve/unused-qualifications-suggestion.stderr @@ -0,0 +1,29 @@ +error: unnecessary qualification + --> $DIR/unused-qualifications-suggestion.rs:17:5 + | +LL | foo::bar(); + | ^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/unused-qualifications-suggestion.rs:3:9 + | +LL | #![deny(unused_qualifications)] + | ^^^^^^^^^^^^^^^^^^^^^ +help: replace it with the unqualified path + | +LL | bar(); + | ~~~ + +error: unnecessary qualification + --> $DIR/unused-qualifications-suggestion.rs:21:5 + | +LL | baz::qux::quux(); + | ^^^^^^^^^^^^^^ + | +help: replace it with the unqualified path + | +LL | quux(); + | ~~~~ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/rfcs/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr b/tests/ui/rfcs/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr index b7c0b0bb6b9..04572920ee4 100644 --- a/tests/ui/rfcs/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr +++ b/tests/ui/rfcs/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr @@ -2,7 +2,7 @@ error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immu --> $DIR/borrowck-issue-49631.rs:20:9 | LL | while let Some(Ok(string)) = foo.get() { - | --------- immutable borrow occurs here + | --- immutable borrow occurs here LL | foo.mutate(); | ^^^^^^^^^^^^ mutable borrow occurs here LL | diff --git a/tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr b/tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr index 80c5f9da40c..4aad8843759 100644 --- a/tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr +++ b/tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr @@ -66,7 +66,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:109:5 | LL | x.set(0, 0); - | ^^^^^^^^^^^ cannot borrow as mutable + | ^ cannot borrow as mutable | help: consider changing this to be mutable | @@ -77,7 +77,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:121:5 | LL | x.y_mut() - | ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | @@ -88,7 +88,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:129:6 | LL | *x.y_mut() = 3; - | ^^^^^^^^^ cannot borrow as mutable + | ^ cannot borrow as mutable | help: consider changing this to be mutable | @@ -99,7 +99,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:133:6 | LL | *x.y_mut() = 3; - | ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | diff --git a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr index 99c8fa1f932..ba8da2e7560 100644 --- a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr +++ b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr @@ -25,7 +25,7 @@ error[E0596]: cannot borrow `f.f` as mutable, as it is behind a `&` reference --> $DIR/borrowck-call-is-borrow-issue-12224.rs:34:5 | LL | f.f.call_mut(()) - | ^^^^^^^^^^^^^^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | ^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | diff --git a/tests/ui/span/borrowck-call-method-from-mut-aliasable.stderr b/tests/ui/span/borrowck-call-method-from-mut-aliasable.stderr index 328197ae9f4..3f033f5e47b 100644 --- a/tests/ui/span/borrowck-call-method-from-mut-aliasable.stderr +++ b/tests/ui/span/borrowck-call-method-from-mut-aliasable.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference --> $DIR/borrowck-call-method-from-mut-aliasable.rs:17:5 | LL | x.h(); - | ^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | diff --git a/tests/ui/span/borrowck-fn-in-const-b.stderr b/tests/ui/span/borrowck-fn-in-const-b.stderr index 17fdcc622f7..92987802629 100644 --- a/tests/ui/span/borrowck-fn-in-const-b.stderr +++ b/tests/ui/span/borrowck-fn-in-const-b.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference --> $DIR/borrowck-fn-in-const-b.rs:7:9 | LL | x.push(format!("this is broken")); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | diff --git a/tests/ui/span/borrowck-let-suggestion-suffixes.stderr b/tests/ui/span/borrowck-let-suggestion-suffixes.stderr index 545b235a552..78cadc8c694 100644 --- a/tests/ui/span/borrowck-let-suggestion-suffixes.stderr +++ b/tests/ui/span/borrowck-let-suggestion-suffixes.stderr @@ -39,7 +39,7 @@ LL | v4.push(&id('y')); | creates a temporary value which is freed while still in use ... LL | v4.use_ref(); - | ------------ borrow later used here + | -- borrow later used here | = note: consider using a `let` binding to create a longer lived value diff --git a/tests/ui/span/borrowck-object-mutability.stderr b/tests/ui/span/borrowck-object-mutability.stderr index 805a8034c18..e4b5c8ce71f 100644 --- a/tests/ui/span/borrowck-object-mutability.stderr +++ b/tests/ui/span/borrowck-object-mutability.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference --> $DIR/borrowck-object-mutability.rs:8:5 | LL | x.borrowed_mut(); - | ^^^^^^^^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | @@ -13,7 +13,7 @@ error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable --> $DIR/borrowck-object-mutability.rs:18:5 | LL | x.borrowed_mut(); - | ^^^^^^^^^^^^^^^^ cannot borrow as mutable + | ^ cannot borrow as mutable | help: consider changing this to be mutable | diff --git a/tests/ui/span/destructor-restrictions.stderr b/tests/ui/span/destructor-restrictions.stderr index 281248626c8..b923cee5f0e 100644 --- a/tests/ui/span/destructor-restrictions.stderr +++ b/tests/ui/span/destructor-restrictions.stderr @@ -4,7 +4,7 @@ error[E0597]: `*a` does not live long enough LL | let a = Box::new(RefCell::new(4)); | - binding `a` declared here LL | *a.borrow() + 1 - | ^^^^^^^^^^ + | ^--------- | | | borrowed value does not live long enough | a temporary with access to the borrow is created here ... diff --git a/tests/ui/span/issue-23338-locals-die-before-temps-of-body.stderr b/tests/ui/span/issue-23338-locals-die-before-temps-of-body.stderr index e1a377203e2..421c2256699 100644 --- a/tests/ui/span/issue-23338-locals-die-before-temps-of-body.stderr +++ b/tests/ui/span/issue-23338-locals-die-before-temps-of-body.stderr @@ -4,7 +4,7 @@ error[E0597]: `y` does not live long enough LL | let y = x; | - binding `y` declared here LL | y.borrow().clone() - | ^^^^^^^^^^ + | ^--------- | | | borrowed value does not live long enough | a temporary with access to the borrow is created here ... @@ -27,7 +27,7 @@ error[E0597]: `y` does not live long enough LL | let y = x; | - binding `y` declared here LL | y.borrow().clone() - | ^^^^^^^^^^ + | ^--------- | | | borrowed value does not live long enough | a temporary with access to the borrow is created here ... diff --git a/tests/ui/span/issue-36537.stderr b/tests/ui/span/issue-36537.stderr index 6c330c1a094..8dfee8d644b 100644 --- a/tests/ui/span/issue-36537.stderr +++ b/tests/ui/span/issue-36537.stderr @@ -9,7 +9,7 @@ LL | p = &a; LL | } | - `a` dropped here while still borrowed LL | p.use_ref(); - | ----------- borrow later used here + | - borrow later used here error: aborting due to previous error diff --git a/tests/ui/span/issue-40157.stderr b/tests/ui/span/issue-40157.stderr index a0afd33f7c7..2168767178d 100644 --- a/tests/ui/span/issue-40157.stderr +++ b/tests/ui/span/issue-40157.stderr @@ -2,7 +2,7 @@ error[E0597]: `foo` does not live long enough --> $DIR/issue-40157.rs:2:53 | LL | {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });} - | --- ^^^^^^^^^^ - `foo` dropped here while still borrowed + | --- ^^^ - `foo` dropped here while still borrowed | | | | | borrowed value does not live long enough | binding `foo` declared here diff --git a/tests/ui/span/mut-arg-hint.stderr b/tests/ui/span/mut-arg-hint.stderr index 06011eac674..df782280b8a 100644 --- a/tests/ui/span/mut-arg-hint.stderr +++ b/tests/ui/span/mut-arg-hint.stderr @@ -2,7 +2,7 @@ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference --> $DIR/mut-arg-hint.rs:3:9 | LL | a.push_str("bar"); - | ^^^^^^^^^^^^^^^^^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | @@ -13,7 +13,7 @@ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference --> $DIR/mut-arg-hint.rs:8:5 | LL | a.push_str("foo"); - | ^^^^^^^^^^^^^^^^^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | @@ -24,7 +24,7 @@ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference --> $DIR/mut-arg-hint.rs:15:9 | LL | a.push_str("foo"); - | ^^^^^^^^^^^^^^^^^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | diff --git a/tests/ui/span/mut-ptr-cant-outlive-ref.stderr b/tests/ui/span/mut-ptr-cant-outlive-ref.stderr index be56f9489c7..395b6ec6791 100644 --- a/tests/ui/span/mut-ptr-cant-outlive-ref.stderr +++ b/tests/ui/span/mut-ptr-cant-outlive-ref.stderr @@ -9,7 +9,7 @@ LL | } | - `b` dropped here while still borrowed LL | LL | p.use_ref(); - | ----------- borrow later used here + | - borrow later used here error: aborting due to previous error diff --git a/tests/ui/span/regionck-unboxed-closure-lifetimes.stderr b/tests/ui/span/regionck-unboxed-closure-lifetimes.stderr index fb3fad6ae90..9b5ec84614c 100644 --- a/tests/ui/span/regionck-unboxed-closure-lifetimes.stderr +++ b/tests/ui/span/regionck-unboxed-closure-lifetimes.stderr @@ -9,7 +9,7 @@ LL | let c_ref = &c; LL | } | - `c` dropped here while still borrowed LL | f.use_mut(); - | ----------- borrow later used here + | - borrow later used here error: aborting due to previous error diff --git a/tests/ui/span/regions-escape-loop-via-vec.stderr b/tests/ui/span/regions-escape-loop-via-vec.stderr index 532ac3606c5..18c6cd48093 100644 --- a/tests/ui/span/regions-escape-loop-via-vec.stderr +++ b/tests/ui/span/regions-escape-loop-via-vec.stderr @@ -7,7 +7,7 @@ LL | while x < 10 { | ^ use of borrowed `x` LL | let mut z = x; LL | _y.push(&mut z); - | --------------- borrow later used here + | -- borrow later used here error[E0503]: cannot use `x` because it was mutably borrowed --> $DIR/regions-escape-loop-via-vec.rs:6:21 @@ -18,7 +18,7 @@ LL | while x < 10 { LL | let mut z = x; | ^ use of borrowed `x` LL | _y.push(&mut z); - | --------------- borrow later used here + | -- borrow later used here error[E0597]: `z` does not live long enough --> $DIR/regions-escape-loop-via-vec.rs:7:17 @@ -26,7 +26,9 @@ error[E0597]: `z` does not live long enough LL | let mut z = x; | ----- binding `z` declared here LL | _y.push(&mut z); - | ^^^^^^ borrowed value does not live long enough + | -- ^^^^^^ borrowed value does not live long enough + | | + | borrow later used here ... LL | } | - `z` dropped here while still borrowed @@ -38,7 +40,7 @@ LL | let mut _y = vec![&mut x]; | ------ `x` is borrowed here ... LL | _y.push(&mut z); - | --------------- borrow later used here + | -- borrow later used here LL | LL | x += 1; | ^^^^^^ use of borrowed `x` diff --git a/tests/ui/span/send-is-not-static-std-sync.stderr b/tests/ui/span/send-is-not-static-std-sync.stderr index 7dfe94bca60..eaba415adaa 100644 --- a/tests/ui/span/send-is-not-static-std-sync.stderr +++ b/tests/ui/span/send-is-not-static-std-sync.stderr @@ -10,7 +10,7 @@ LL | drop(y); | ^ move out of `y` occurs here ... LL | *lock.lock().unwrap() = &z; - | ----------- borrow later used here + | ---- borrow later used here error[E0597]: `z` does not live long enough --> $DIR/send-is-not-static-std-sync.rs:16:33 @@ -23,7 +23,7 @@ LL | } | - `z` dropped here while still borrowed LL | LL | lock.use_ref(); // (Mutex is #[may_dangle] so its dtor does not use `z` => needs explicit use) - | -------------- borrow later used here + | ---- borrow later used here error[E0505]: cannot move out of `y` because it is borrowed --> $DIR/send-is-not-static-std-sync.rs:27:10 @@ -37,7 +37,7 @@ LL | drop(y); | ^ move out of `y` occurs here ... LL | *lock.write().unwrap() = &z; - | ------------ borrow later used here + | ---- borrow later used here error[E0597]: `z` does not live long enough --> $DIR/send-is-not-static-std-sync.rs:30:34 @@ -50,7 +50,7 @@ LL | } | - `z` dropped here while still borrowed LL | LL | lock.use_ref(); // (RwLock is #[may_dangle] so its dtor does not use `z` => needs explicit use) - | -------------- borrow later used here + | ---- borrow later used here error[E0505]: cannot move out of `y` because it is borrowed --> $DIR/send-is-not-static-std-sync.rs:43:10 @@ -64,7 +64,7 @@ LL | drop(y); | ^ move out of `y` occurs here ... LL | tx.send(&z).unwrap(); - | ----------- borrow later used here + | -- borrow later used here error[E0597]: `z` does not live long enough --> $DIR/send-is-not-static-std-sync.rs:46:17 diff --git a/tests/ui/span/slice-borrow.stderr b/tests/ui/span/slice-borrow.stderr index b70bf69d688..b271c9ae6f6 100644 --- a/tests/ui/span/slice-borrow.stderr +++ b/tests/ui/span/slice-borrow.stderr @@ -7,7 +7,7 @@ LL | let x: &[isize] = &vec![1, 2, 3, 4, 5]; LL | } | - temporary value is freed at the end of this statement LL | y.use_ref(); - | ----------- borrow later used here + | - borrow later used here | = note: consider using a `let` binding to create a longer lived value = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs b/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs index 711cbbd381a..255cab06070 100644 --- a/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs +++ b/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs @@ -18,7 +18,7 @@ mod bav { impl Bar for i32 {} fn use_it<'a>(val: Box<dyn ObjectTrait<Assoc = i32>>) -> impl OtherTrait<'a> { - val.use_self() //~ ERROR cannot return reference to function parameter + val.use_self() //~ ERROR cannot return value referencing function parameter } } diff --git a/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.stderr b/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.stderr index 2dc300ac76f..a7e03f491b9 100644 --- a/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.stderr +++ b/tests/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.stderr @@ -1,20 +1,29 @@ -error[E0515]: cannot return reference to function parameter `val` +error[E0515]: cannot return value referencing function parameter `val` --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:21:9 | LL | val.use_self() - | ^^^^^^^^^^^^^^ returns a reference to data owned by the current function + | ---^^^^^^^^^^^ + | | + | returns a value referencing data owned by the current function + | `val` is borrowed here -error[E0515]: cannot return reference to function parameter `val` +error[E0515]: cannot return value referencing function parameter `val` --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:43:9 | LL | val.use_self() - | ^^^^^^^^^^^^^^ returns a reference to data owned by the current function + | ---^^^^^^^^^^^ + | | + | returns a value referencing data owned by the current function + | `val` is borrowed here -error[E0515]: cannot return reference to function parameter `val` +error[E0515]: cannot return value referencing function parameter `val` --> $DIR/impl-on-dyn-trait-with-implicit-static-bound-needing-more-suggestions.rs:109:9 | LL | val.use_self() - | ^^^^^^^^^^^^^^ returns a reference to data owned by the current function + | ---^^^^^^^^^^^ + | | + | returns a value referencing data owned by the current function + | `val` is borrowed here error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/issue-102972.stderr b/tests/ui/suggestions/issue-102972.stderr index 03f9dbb6c89..3303d6bbc3f 100644 --- a/tests/ui/suggestions/issue-102972.stderr +++ b/tests/ui/suggestions/issue-102972.stderr @@ -7,10 +7,7 @@ LL | for _c in chars.by_ref() { | first mutable borrow occurs here | first borrow later used here LL | chars.next(); - | ^^^^^^^^^^^^ second mutable borrow occurs here - | - = note: a for loop advances the iterator for you, the result is stored in `_c`. - = help: if you want to call `next` on a iterator within the loop, consider using `while let`. + | ^^^^^ second mutable borrow occurs here error[E0382]: borrow of moved value: `iter` --> $DIR/issue-102972.rs:12:9 @@ -20,10 +17,8 @@ LL | let mut iter = v.iter(); LL | for _i in iter { | ---- `iter` moved due to this implicit call to `.into_iter()` LL | iter.next(); - | ^^^^^^^^^^^ value borrowed here after move + | ^^^^ value borrowed here after move | - = note: a for loop advances the iterator for you, the result is stored in `_i`. - = help: if you want to call `next` on a iterator within the loop, consider using `while let`. note: `into_iter` takes ownership of the receiver `self`, which moves `iter` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL diff --git a/tests/ui/suggestions/option-content-move.stderr b/tests/ui/suggestions/option-content-move.stderr index 474a72093c6..5060606d842 100644 --- a/tests/ui/suggestions/option-content-move.stderr +++ b/tests/ui/suggestions/option-content-move.stderr @@ -12,7 +12,7 @@ note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves help: you can `clone` the value and consume it, but this might not be your desired behavior | LL | if selection.1.clone().unwrap().contains(selection.0) { - | ++++++++ + | ++++++++ error[E0507]: cannot move out of `selection.1` which is behind a shared reference --> $DIR/option-content-move.rs:27:20 @@ -28,7 +28,7 @@ note: `Result::<T, E>::unwrap` takes ownership of the receiver `self`, which mov help: you can `clone` the value and consume it, but this might not be your desired behavior | LL | if selection.1.clone().unwrap().contains(selection.0) { - | ++++++++ + | ++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/traits/issue-24010.rs b/tests/ui/traits/issue-24010.rs index f1818533487..fd7d6751d5c 100644 --- a/tests/ui/traits/issue-24010.rs +++ b/tests/ui/traits/issue-24010.rs @@ -1,4 +1,6 @@ // run-pass +// revisions: classic next +//[next] compile-flags: -Ztrait-solver=next trait Foo: Fn(i32) -> i32 + Send {} diff --git a/tests/ui/traits/new-solver/unsize-although-ambiguous.rs b/tests/ui/traits/new-solver/unsize-although-ambiguous.rs new file mode 100644 index 00000000000..431988a5fff --- /dev/null +++ b/tests/ui/traits/new-solver/unsize-although-ambiguous.rs @@ -0,0 +1,13 @@ +// check-pass +// compile-flags: -Ztrait-solver=next + +use std::fmt::Display; + +fn box_dyn_display(_: Box<dyn Display>) {} + +fn main() { + // During coercion, we don't necessarily know whether `{integer}` implements + // `Display`. Before, that would cause us to bail out in the coercion loop when + // checking `{integer}: Unsize<dyn Display>`. + box_dyn_display(Box::new(1)); +} diff --git a/tests/ui/issues/issue-11515.stderr b/tests/ui/traits/trait-upcasting/issue-11515.current.stderr index accd47f0f5f..97d66cccb25 100644 --- a/tests/ui/issues/issue-11515.stderr +++ b/tests/ui/traits/trait-upcasting/issue-11515.current.stderr @@ -1,5 +1,5 @@ error[E0658]: cannot cast `dyn Fn()` to `dyn FnMut()`, trait upcasting coercion is experimental - --> $DIR/issue-11515.rs:9:38 + --> $DIR/issue-11515.rs:10:38 | LL | let test = Box::new(Test { func: closure }); | ^^^^^^^ diff --git a/tests/ui/traits/trait-upcasting/issue-11515.next.stderr b/tests/ui/traits/trait-upcasting/issue-11515.next.stderr new file mode 100644 index 00000000000..97d66cccb25 --- /dev/null +++ b/tests/ui/traits/trait-upcasting/issue-11515.next.stderr @@ -0,0 +1,13 @@ +error[E0658]: cannot cast `dyn Fn()` to `dyn FnMut()`, trait upcasting coercion is experimental + --> $DIR/issue-11515.rs:10:38 + | +LL | let test = Box::new(Test { func: closure }); + | ^^^^^^^ + | + = note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information + = help: add `#![feature(trait_upcasting)]` to the crate attributes to enable + = note: required when coercing `Box<(dyn Fn() + 'static)>` into `Box<(dyn FnMut() + 'static)>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/issues/issue-11515.rs b/tests/ui/traits/trait-upcasting/issue-11515.rs index b5c942f96a7..723f3a24fd4 100644 --- a/tests/ui/issues/issue-11515.rs +++ b/tests/ui/traits/trait-upcasting/issue-11515.rs @@ -1,9 +1,10 @@ +// revisions: current next +//[next] compile-flags: -Ztrait-solver=next + struct Test { func: Box<dyn FnMut() + 'static>, } - - fn main() { let closure: Box<dyn Fn() + 'static> = Box::new(|| ()); let test = Box::new(Test { func: closure }); //~ ERROR trait upcasting coercion is experimental [E0658] diff --git a/tests/ui/unop-move-semantics.stderr b/tests/ui/unop-move-semantics.stderr index e47785c465a..b6de7976ac9 100644 --- a/tests/ui/unop-move-semantics.stderr +++ b/tests/ui/unop-move-semantics.stderr @@ -7,7 +7,7 @@ LL | !x; | -- `x` moved due to usage in operator LL | LL | x.clone(); - | ^^^^^^^^^ value borrowed here after move + | ^ value borrowed here after move | note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL diff --git a/tests/ui/use/use-after-move-implicity-coerced-object.stderr b/tests/ui/use/use-after-move-implicity-coerced-object.stderr index dfa0c04836e..84487a8d0dc 100644 --- a/tests/ui/use/use-after-move-implicity-coerced-object.stderr +++ b/tests/ui/use/use-after-move-implicity-coerced-object.stderr @@ -8,7 +8,7 @@ LL | l.push(n); | - value moved here LL | LL | let x = n.to_string(); - | ^^^^^^^^^^^^^ value borrowed here after move + | ^ value borrowed here after move | note: consider changing this parameter type in method `push` to borrow instead if owning the value isn't necessary --> $DIR/use-after-move-implicity-coerced-object.rs:17:27 |
