diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 6d95da02151a8..5ebd323ffd705 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -507,7 +507,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { let count = generics .params .iter() - .filter(|param| matches!(param.kind, ast::GenericParamKind::Lifetime { .. })) + .filter(|param| { + matches!(param.kind, ast::GenericParamKind::Lifetime { .. }) + }) .count(); self.lctx.type_def_lifetime_params.insert(def_id.to_def_id(), count); } diff --git a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs index e78d1368b357e..fa3c958c9fe78 100644 --- a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs @@ -598,7 +598,7 @@ impl<'a> TraitDef<'a> { let mut ty_params = params .iter() - .filter(|param| matches!(param.kind, ast::GenericParamKind::Type{..})) + .filter(|param| matches!(param.kind, ast::GenericParamKind::Type { .. })) .peekable(); if ty_params.peek().is_some() { diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs index 37902dddff46d..c09cce21bf24c 100644 --- a/compiler/rustc_errors/src/diagnostic_builder.rs +++ b/compiler/rustc_errors/src/diagnostic_builder.rs @@ -36,7 +36,7 @@ macro_rules! forward_inner_docs { ($e:expr => $i:item) => { #[doc = $e] $i - } + }; } /// In general, the `DiagnosticBuilder` uses deref to allow access to diff --git a/compiler/rustc_errors/src/snippet.rs b/compiler/rustc_errors/src/snippet.rs index dbb2523f28691..acb88e57db5ee 100644 --- a/compiler/rustc_errors/src/snippet.rs +++ b/compiler/rustc_errors/src/snippet.rs @@ -122,11 +122,13 @@ impl Annotation { } pub fn is_multiline(&self) -> bool { - matches!(self.annotation_type, + matches!( + self.annotation_type, AnnotationType::Multiline(_) - | AnnotationType::MultilineStart(_) - | AnnotationType::MultilineLine(_) - | AnnotationType::MultilineEnd(_)) + | AnnotationType::MultilineStart(_) + | AnnotationType::MultilineLine(_) + | AnnotationType::MultilineEnd(_) + ) } pub fn len(&self) -> usize { @@ -158,7 +160,10 @@ impl Annotation { pub fn takes_space(&self) -> bool { // Multiline annotations always have to keep vertical space. - matches!(self.annotation_type, AnnotationType::MultilineStart(_) | AnnotationType::MultilineEnd(_)) + matches!( + self.annotation_type, + AnnotationType::MultilineStart(_) | AnnotationType::MultilineEnd(_) + ) } } diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 35170fa7c1d02..1c16dc026670b 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -1543,10 +1543,10 @@ pub fn is_range_literal(expr: &Expr<'_>) -> bool { **qpath, QPath::LangItem( LangItem::Range - | LangItem::RangeTo - | LangItem::RangeFrom - | LangItem::RangeFull - | LangItem::RangeToInclusive, + | LangItem::RangeTo + | LangItem::RangeFrom + | LangItem::RangeFull + | LangItem::RangeToInclusive, _, ) ), diff --git a/compiler/rustc_infer/src/infer/combine.rs b/compiler/rustc_infer/src/infer/combine.rs index e034ac5e8fd70..e6fc31f0e4fd4 100644 --- a/compiler/rustc_infer/src/infer/combine.rs +++ b/compiler/rustc_infer/src/infer/combine.rs @@ -542,10 +542,6 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> { true } - fn visit_ct_substs(&self) -> bool { - true - } - fn binders( &mut self, a: ty::Binder, @@ -736,6 +732,16 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> { } } } + ty::ConstKind::Unevaluated(def, substs, promoted) + if self.tcx().lazy_normalization() => + { + assert_eq!(promoted, None); + let substs = self.relate_with_variance(ty::Variance::Invariant, substs, substs)?; + Ok(self.tcx().mk_const(ty::Const { + ty: c.ty, + val: ty::ConstKind::Unevaluated(def, substs, promoted), + })) + } _ => relate::super_relate_consts(self, c, c), } } @@ -821,10 +827,6 @@ impl TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> { true } - fn visit_ct_substs(&self) -> bool { - true - } - fn relate_with_variance>( &mut self, _variance: ty::Variance, @@ -958,6 +960,16 @@ impl TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> { } } } + ty::ConstKind::Unevaluated(def, substs, promoted) + if self.tcx().lazy_normalization() => + { + assert_eq!(promoted, None); + let substs = self.relate_with_variance(ty::Variance::Invariant, substs, substs)?; + Ok(self.tcx().mk_const(ty::Const { + ty: c.ty, + val: ty::ConstKind::Unevaluated(def, substs, promoted), + })) + } _ => relate::super_relate_consts(self, c, c), } } diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs index 0958afa03082a..61c8113d05287 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs @@ -132,7 +132,12 @@ impl Visitor<'tcx> for TypeParamSpanVisitor<'tcx> { [segment] if segment .res - .map(|res| matches!(res, Res::SelfTy(_, _) | Res::Def(hir::def::DefKind::TyParam, _))) + .map(|res| { + matches!( + res, + Res::SelfTy(_, _) | Res::Def(hir::def::DefKind::TyParam, _) + ) + }) .unwrap_or(false) => { self.types.push(path.span); diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs index 26b35e87ac491..2ae4b7c021a8c 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map/mod.rs @@ -559,9 +559,9 @@ impl<'hir> Map<'hir> { self.find(self.get_parent_node(id)), Some( Node::Item(_) - | Node::TraitItem(_) - | Node::ImplItem(_) - | Node::Expr(Expr { kind: ExprKind::Closure(..), .. }), + | Node::TraitItem(_) + | Node::ImplItem(_) + | Node::Expr(Expr { kind: ExprKind::Closure(..), .. }), ) ) } diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index cd2bea86ea1a7..718e81c84eddd 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -962,8 +962,7 @@ impl<'tcx> LocalDecl<'tcx> { opt_ty_info: _, opt_match_place: _, pat_span: _, - }) - | BindingForm::ImplicitSelf(ImplicitSelfKind::Imm), + }) | BindingForm::ImplicitSelf(ImplicitSelfKind::Imm), ))) ) } @@ -980,8 +979,7 @@ impl<'tcx> LocalDecl<'tcx> { opt_ty_info: _, opt_match_place: _, pat_span: _, - }) - | BindingForm::ImplicitSelf(_), + }) | BindingForm::ImplicitSelf(_), ))) ) } diff --git a/compiler/rustc_middle/src/ty/diagnostics.rs b/compiler/rustc_middle/src/ty/diagnostics.rs index e386d973ee447..4a131a4ec0581 100644 --- a/compiler/rustc_middle/src/ty/diagnostics.rs +++ b/compiler/rustc_middle/src/ty/diagnostics.rs @@ -12,13 +12,17 @@ impl<'tcx> TyS<'tcx> { pub fn is_primitive_ty(&self) -> bool { matches!( self.kind(), - Bool | Char | Str | Int(_) | Uint(_) | Float(_) - | Infer( - InferTy::IntVar(_) - | InferTy::FloatVar(_) - | InferTy::FreshIntTy(_) - | InferTy::FreshFloatTy(_) - ) + Bool | Char + | Str + | Int(_) + | Uint(_) + | Float(_) + | Infer( + InferTy::IntVar(_) + | InferTy::FloatVar(_) + | InferTy::FreshIntTy(_) + | InferTy::FreshFloatTy(_) + ) ) } diff --git a/compiler/rustc_middle/src/ty/error.rs b/compiler/rustc_middle/src/ty/error.rs index c211f07bed8c2..1669c59d7f1b9 100644 --- a/compiler/rustc_middle/src/ty/error.rs +++ b/compiler/rustc_middle/src/ty/error.rs @@ -646,11 +646,14 @@ impl Trait for X { let current_method_ident = body_owner.and_then(|n| n.ident()).map(|i| i.name); // We don't want to suggest calling an assoc fn in a scope where that isn't feasible. - let callable_scope = matches!(body_owner, Some( + let callable_scope = matches!( + body_owner, + Some( hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(..), .. }) - | hir::Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Fn(..), .. }) - | hir::Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Fn(..), .. }), - )); + | hir::Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Fn(..), .. }) + | hir::Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Fn(..), .. }), + ) + ); let impl_comparison = matches!( cause_code, ObligationCauseCode::CompareImplMethodObligation { .. } diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 4937fdd73144d..a8d9995bd0b2f 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -2143,6 +2143,7 @@ fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, N match child.res { def::Res::Def(DefKind::AssocTy, _) => {} + def::Res::Def(DefKind::TyAlias, _) => {} def::Res::Def(defkind, def_id) => { if let Some(ns) = defkind.ns() { collect_fn(&child.ident, ns, def_id); diff --git a/compiler/rustc_middle/src/ty/relate.rs b/compiler/rustc_middle/src/ty/relate.rs index 293b3c6b0470a..af7fc42971954 100644 --- a/compiler/rustc_middle/src/ty/relate.rs +++ b/compiler/rustc_middle/src/ty/relate.rs @@ -33,15 +33,6 @@ pub trait TypeRelation<'tcx>: Sized { /// relation. Just affects error messages. fn a_is_expected(&self) -> bool; - /// Whether we should look into the substs of unevaluated constants - /// even if `feature(const_evaluatable_checked)` is active. - /// - /// This is needed in `combine` to prevent accidentially creating - /// infinite types as we abuse `TypeRelation` to walk a type there. - fn visit_ct_substs(&self) -> bool { - false - } - fn with_cause(&mut self, _cause: Cause, f: F) -> R where F: FnOnce(&mut Self) -> R, @@ -588,7 +579,7 @@ pub fn super_relate_consts>( ( ty::ConstKind::Unevaluated(a_def, a_substs, None), ty::ConstKind::Unevaluated(b_def, b_substs, None), - ) if tcx.features().const_evaluatable_checked && !relation.visit_ct_substs() => { + ) if tcx.features().const_evaluatable_checked => { if tcx.try_unify_abstract_consts(((a_def, a_substs), (b_def, b_substs))) { Ok(a.val) } else { diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index 9cec0eb5be3c5..6b4f08d9f9335 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -1871,8 +1871,14 @@ impl<'tcx> TyS<'tcx> { pub fn is_scalar(&self) -> bool { matches!( self.kind(), - Bool | Char | Int(_) | Float(_) | Uint(_) | FnDef(..) | FnPtr(_) | RawPtr(_) - | Infer(IntVar(_) | FloatVar(_)) + Bool | Char + | Int(_) + | Float(_) + | Uint(_) + | FnDef(..) + | FnPtr(_) + | RawPtr(_) + | Infer(IntVar(_) | FloatVar(_)) ) } 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 c11b8f7459389..3308a243a3afb 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_place.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_place.rs @@ -6,8 +6,8 @@ use crate::build::{BlockAnd, BlockAndExtension, Builder}; use crate::thir::*; use rustc_hir::def_id::DefId; use rustc_hir::HirId; -use rustc_middle::middle::region; use rustc_middle::hir::place::ProjectionKind as HirProjectionKind; +use rustc_middle::middle::region; use rustc_middle::mir::AssertKind::BoundsCheck; use rustc_middle::mir::*; use rustc_middle::ty::{self, CanonicalUserTypeAnnotation, Ty, TyCtxt, Variance}; @@ -57,7 +57,8 @@ crate enum PlaceBase { /// DefId of the closure closure_def_id: DefId, /// The trait closure implements, `Fn`, `FnMut`, `FnOnce` - closure_kind: ty::ClosureKind }, + closure_kind: ty::ClosureKind, + }, } /// `PlaceBuilder` is used to create places during MIR construction. It allows you to "build up" a @@ -81,8 +82,7 @@ crate struct PlaceBuilder<'tcx> { fn convert_to_hir_projections_and_truncate_for_capture<'tcx>( mir_projections: &[PlaceElem<'tcx>], ) -> Vec { - - let mut hir_projections = Vec::new(); + let mut hir_projections = Vec::new(); for mir_projection in mir_projections { let hir_projection = match mir_projection { @@ -91,20 +91,20 @@ fn convert_to_hir_projections_and_truncate_for_capture<'tcx>( // We will never encouter this for multivariant enums, // read the comment for `Downcast`. HirProjectionKind::Field(field.index() as u32, VariantIdx::new(0)) - }, + } ProjectionElem::Downcast(..) => { // This projections exist only for enums that have // multiple variants. Since such enums that are captured // completely, we can stop here. - break - }, + break; + } ProjectionElem::Index(..) | ProjectionElem::ConstantIndex { .. } | ProjectionElem::Subslice { .. } => { // We don't capture array-access projections. // We can stop here as arrays are captured completely. - break - }, + break; + } }; hir_projections.push(hir_projection); @@ -181,9 +181,9 @@ fn find_capture_matching_projections<'a, 'tcx>( // If an ancestor is found, `idx` is the index within the list of captured places // for root variable `var_hir_id` and `capture` is the `ty::CapturedPlace` itself. let (idx, capture) = root_variable_min_captures.iter().enumerate().find(|(_, capture)| { - let possible_ancestor_proj_kinds = - capture.place.projections.iter().map(|proj| proj.kind).collect(); - is_ancestor_or_same_capture(&possible_ancestor_proj_kinds, &hir_projections) + let possible_ancestor_proj_kinds = + capture.place.projections.iter().map(|proj| proj.kind).collect(); + is_ancestor_or_same_capture(&possible_ancestor_proj_kinds, &hir_projections) })?; // Convert index to be from the presepective of the entire closure_min_captures map @@ -213,35 +213,34 @@ fn to_upvars_resolved_place_builder<'a, 'tcx>( ty::ClosureKind::FnOnce => {} } - let (capture_index, capture) = - if let Some(capture_details) = find_capture_matching_projections( + let (capture_index, capture) = if let Some(capture_details) = + find_capture_matching_projections( typeck_results, var_hir_id, closure_def_id, &from_builder.projection, ) { - capture_details - } else { - if !tcx.features().capture_disjoint_fields { - bug!( - "No associated capture found for {:?}[{:#?}] even though \ + capture_details + } else { + if !tcx.features().capture_disjoint_fields { + bug!( + "No associated capture found for {:?}[{:#?}] even though \ capture_disjoint_fields isn't enabled", - var_hir_id, - from_builder.projection - ) - } else { - // FIXME(project-rfc-2229#24): Handle this case properly - debug!( - "No associated capture found for {:?}[{:#?}]", - var_hir_id, - from_builder.projection, - ); - } - return Err(var_hir_id); - }; + var_hir_id, + from_builder.projection + ) + } else { + // FIXME(project-rfc-2229#24): Handle this case properly + debug!( + "No associated capture found for {:?}[{:#?}]", + var_hir_id, from_builder.projection, + ); + } + return Err(var_hir_id); + }; - let closure_ty = - typeck_results.node_type(tcx.hir().local_def_id_to_hir_id(closure_def_id.expect_local())); + let closure_ty = typeck_results + .node_type(tcx.hir().local_def_id_to_hir_id(closure_def_id.expect_local())); let substs = match closure_ty.kind() { ty::Closure(_, substs) => ty::UpvarSubsts::Closure(substs), @@ -256,7 +255,8 @@ fn to_upvars_resolved_place_builder<'a, 'tcx>( // we know that the capture exists and is the `capture_index`-th capture. let var_ty = substs.tupled_upvars_ty().tuple_element_ty(capture_index).unwrap(); - upvar_resolved_place_builder = upvar_resolved_place_builder.field(Field::new(capture_index), var_ty); + upvar_resolved_place_builder = + upvar_resolved_place_builder.field(Field::new(capture_index), var_ty); // If the variable is captured via ByRef(Immutable/Mutable) Borrow, // we need to deref it @@ -270,8 +270,9 @@ fn to_upvars_resolved_place_builder<'a, 'tcx>( // We used some of the projections to build the capture itself, // now we apply the remaining to the upvar resolved place. - upvar_resolved_place_builder.projection.extend( - curr_projections.drain(next_projection..)); + upvar_resolved_place_builder + .projection + .extend(curr_projections.drain(next_projection..)); Ok(upvar_resolved_place_builder) } @@ -303,7 +304,7 @@ impl<'tcx> PlaceBuilder<'tcx> { self.base } - fn field(self, f: Field, ty: Ty<'tcx>) -> Self { + crate fn field(self, f: Field, ty: Ty<'tcx>) -> Self { self.project(PlaceElem::Field(f, ty)) } @@ -356,7 +357,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { /// This is used when constructing a compound `Place`, so that we can avoid creating /// intermediate `Place` values until we know the full set of projections. - crate fn as_place_builder(&mut self, block: BasicBlock, expr: M) -> BlockAnd> + crate fn as_place_builder( + &mut self, + block: BasicBlock, + expr: M, + ) -> BlockAnd> where M: Mirror<'tcx, Output = Expr<'tcx>>, { @@ -627,7 +632,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { if is_outermost_index { self.read_fake_borrows(block, fake_borrow_temps, source_info) } else { - base_place = base_place.expect_upvars_resolved(self.hir.tcx(), self.hir.typeck_results()); + base_place = + base_place.expect_upvars_resolved(self.hir.tcx(), self.hir.typeck_results()); self.add_fake_borrows_of_base( &base_place, block, @@ -679,7 +685,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let tcx = self.hir.tcx(); let local = match base_place.base { PlaceBase::Local(local) => local, - PlaceBase::Upvar { .. } => bug!("Expected PlacseBase::Local found Upvar") + PlaceBase::Upvar { .. } => bug!("Expected PlacseBase::Local found Upvar"), }; let place_ty = Place::ty_from(local, &base_place.projection, &self.local_decls, tcx); diff --git a/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs b/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs index 55bdbcfc5b916..c95fc969797b4 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs @@ -2,9 +2,9 @@ use rustc_index::vec::Idx; +use crate::build::expr::as_place::PlaceBase; use crate::build::expr::category::{Category, RvalueFunc}; use crate::build::{BlockAnd, BlockAndExtension, Builder}; -use crate::build::expr::as_place::PlaceBase; use crate::thir::*; use rustc_middle::middle::region; use rustc_middle::mir::AssertKind; @@ -274,7 +274,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { | ExprKind::ValueTypeAscription { .. } => { // these do not have corresponding `Rvalue` variants, // so make an operand and then return that - debug_assert!(!matches!(Category::of(&expr.kind), Some(Category::Rvalue(RvalueFunc::AsRvalue)))); + debug_assert!(!matches!( + Category::of(&expr.kind), + Some(Category::Rvalue(RvalueFunc::AsRvalue)) + )); let operand = unpack!(block = this.as_operand(block, scope, expr)); block.and(Rvalue::Use(operand)) } @@ -401,34 +404,39 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { // We are capturing a path that starts off a local variable in the parent. // The mutability of the current capture is same as the mutability // of the local declaration in the parent. - PlaceBase::Local(local) => this.local_decls[local].mutability, + PlaceBase::Local(local) => this.local_decls[local].mutability, // Parent is a closure and we are capturing a path that is captured // by the parent itself. The mutability of the current capture // is same as that of the capture in the parent closure. PlaceBase::Upvar { .. } => { - let enclosing_upvars_resolved = arg_place_builder.clone().into_place( - this.hir.tcx(), - this.hir.typeck_results()); + let enclosing_upvars_resolved = + arg_place_builder.clone().into_place(this.hir.tcx(), this.hir.typeck_results()); match enclosing_upvars_resolved.as_ref() { - PlaceRef { local, projection: &[ProjectionElem::Field(upvar_index, _), ..] } + PlaceRef { + local, + projection: &[ProjectionElem::Field(upvar_index, _), ..], + } | PlaceRef { local, - projection: &[ProjectionElem::Deref, ProjectionElem::Field(upvar_index, _), ..] } => { - // Not in a closure - debug_assert!( - local == Local::new(1), - "Expected local to be Local(1), found {:?}", - local - ); - // Not in a closure - debug_assert!( - this.upvar_mutbls.len() > upvar_index.index(), - "Unexpected capture place, upvar_mutbls={:#?}, upvar_index={:?}", - this.upvar_mutbls, upvar_index - ); - this.upvar_mutbls[upvar_index.index()] - } + projection: + &[ProjectionElem::Deref, ProjectionElem::Field(upvar_index, _), ..], + } => { + // Not in a closure + debug_assert!( + local == Local::new(1), + "Expected local to be Local(1), found {:?}", + local + ); + // Not in a closure + debug_assert!( + this.upvar_mutbls.len() > upvar_index.index(), + "Unexpected capture place, upvar_mutbls={:#?}, upvar_index={:?}", + this.upvar_mutbls, + upvar_index + ); + this.upvar_mutbls[upvar_index.index()] + } _ => bug!("Unexpected capture place"), } } @@ -439,9 +447,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { Mutability::Mut => BorrowKind::Mut { allow_two_phase_borrow: false }, }; - let arg_place = arg_place_builder.into_place( - this.hir.tcx(), - this.hir.typeck_results()); + let arg_place = arg_place_builder.into_place(this.hir.tcx(), this.hir.typeck_results()); this.cfg.push_assign( block, diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs index 639f2bbc6e05f..54e7bb248eb61 100644 --- a/compiler/rustc_mir_build/src/build/expr/into.rs +++ b/compiler/rustc_mir_build/src/build/expr/into.rs @@ -10,7 +10,7 @@ use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_hir as hir; use rustc_middle::middle::region; use rustc_middle::mir::*; -use rustc_middle::ty::{CanonicalUserTypeAnnotation}; +use rustc_middle::ty::CanonicalUserTypeAnnotation; use std::slice; @@ -38,7 +38,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let expr_span = expr.span; let source_info = this.source_info(expr_span); - let expr_is_block_or_scope = matches!(expr.kind, ExprKind::Block { .. } | ExprKind::Scope { .. }); + let expr_is_block_or_scope = + matches!(expr.kind, ExprKind::Block { .. } | ExprKind::Scope { .. }); let schedule_drop = move |this: &mut Self| { if let Some(drop_scope) = scope { @@ -68,7 +69,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { this.match_expr(destination, scope, expr_span, block, scrutinee, arms) } ExprKind::If { cond, then, else_opt } => { - let place = unpack!(block = this.as_temp(block, Some(this.local_scope()), cond, Mutability::Mut)); + let place = unpack!( + block = this.as_temp(block, Some(this.local_scope()), cond, Mutability::Mut) + ); let operand = Operand::Move(Place::from(place)); let mut then_block = this.cfg.start_new_block(); @@ -100,14 +103,17 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { ); join_block.unit() - }, + } ExprKind::NeverToAny { source } => { let source = this.hir.mirror(source); - let is_call = matches!(source.kind, ExprKind::Call { .. } | ExprKind::InlineAsm { .. }); + let is_call = + matches!(source.kind, ExprKind::Call { .. } | ExprKind::InlineAsm { .. }); // (#66975) Source could be a const of type `!`, so has to // exist in the generated MIR. - unpack!(block = this.as_temp(block, Some(this.local_scope()), source, Mutability::Mut,)); + unpack!( + block = this.as_temp(block, Some(this.local_scope()), source, Mutability::Mut,) + ); // This is an optimization. If the expression was a call then we already have an // unreachable block. Don't bother to terminate it and create a new one. @@ -296,7 +302,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let field_names = this.hir.all_fields(adt_def, variant_index); let fields: Vec<_> = if let Some(FruInfo { base, field_types }) = base { - let base = unpack!(block = this.as_place(block, base)); + let place_builder = unpack!(block = this.as_place_builder(block, base)); // MIR does not natively support FRU, so for each // base-supplied field, generate an operand that @@ -306,9 +312,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { .zip(field_types.into_iter()) .map(|(n, ty)| match fields_map.get(&n) { Some(v) => v.clone(), - None => this.consume_by_copy_or_move( - this.hir.tcx().mk_place_field(base, n, ty), - ), + None => { + let place_builder = place_builder.clone(); + this.consume_by_copy_or_move( + place_builder + .field(n, ty) + .into_place(this.hir.tcx(), this.hir.typeck_results()), + ) + }, }) .collect() } else { diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index 2e108d480932a..9fb361e7b2abc 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -1673,15 +1673,21 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let e = self.hir.mirror(e.clone()); let source_info = self.source_info(e.span); (e.span, self.test_bool(block, e, source_info)) - }, + } Guard::IfLet(pat, scrutinee) => { let scrutinee_span = scrutinee.span(); - let scrutinee_place = unpack!(block = self.lower_scrutinee(block, scrutinee.clone(), scrutinee_span)); + let scrutinee_place = unpack!( + block = self.lower_scrutinee(block, scrutinee.clone(), scrutinee_span) + ); let mut guard_candidate = Candidate::new(scrutinee_place, &pat, false); let wildcard = Pat::wildcard_from_ty(pat.ty); let mut otherwise_candidate = Candidate::new(scrutinee_place, &wildcard, false); - let fake_borrow_temps = - self.lower_match_tree(block, pat.span, false, &mut [&mut guard_candidate, &mut otherwise_candidate]); + let fake_borrow_temps = self.lower_match_tree( + block, + pat.span, + false, + &mut [&mut guard_candidate, &mut otherwise_candidate], + ); self.declare_bindings( None, pat.span.to(arm_span.unwrap()), diff --git a/compiler/rustc_mir_build/src/build/matches/util.rs b/compiler/rustc_mir_build/src/build/matches/util.rs index 4ef88c25cadf3..db1f678a5c68d 100644 --- a/compiler/rustc_mir_build/src/build/matches/util.rs +++ b/compiler/rustc_mir_build/src/build/matches/util.rs @@ -32,9 +32,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { ) { let tcx = self.hir.tcx(); let (min_length, exact_size) = match place.ty(&self.local_decls, tcx).ty.kind() { - ty::Array(_, length) => { - (length.eval_usize(tcx, self.hir.param_env), true) - } + ty::Array(_, length) => (length.eval_usize(tcx, self.hir.param_env), true), _ => ((prefix.len() + suffix.len()).try_into().unwrap(), false), }; diff --git a/compiler/rustc_mir_build/src/build/mod.rs b/compiler/rustc_mir_build/src/build/mod.rs index 996615995259d..cb0fb8bf143a3 100644 --- a/compiler/rustc_mir_build/src/build/mod.rs +++ b/compiler/rustc_mir_build/src/build/mod.rs @@ -838,9 +838,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { _ => span_bug!(self.fn_span, "upvars with non-closure env ty {:?}", closure_ty), }; let capture_tys = upvar_substs.upvar_tys(); - let captures_with_tys = hir_typeck_results - .closure_min_captures_flattened(fn_def_id) - .zip(capture_tys); + let captures_with_tys = + hir_typeck_results.closure_min_captures_flattened(fn_def_id).zip(capture_tys); self.upvar_mutbls = captures_with_tys .enumerate() @@ -848,7 +847,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let capture = captured_place.info.capture_kind; let var_id = match captured_place.place.base { HirPlaceBase::Upvar(upvar_id) => upvar_id.var_path.hir_id, - _ => bug!("Expected an upvar") + _ => bug!("Expected an upvar"), }; let mut mutability = Mutability::Not; diff --git a/compiler/rustc_mir_build/src/build/scope.rs b/compiler/rustc_mir_build/src/build/scope.rs index 62d2212d10962..cbc20c6153a56 100644 --- a/compiler/rustc_mir_build/src/build/scope.rs +++ b/compiler/rustc_mir_build/src/build/scope.rs @@ -931,10 +931,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let local_scope = self.local_scope(); let scope = self.scopes.scopes.last_mut().unwrap(); - assert_eq!( - scope.region_scope, local_scope, - "local scope is not the topmost scope!", - ); + assert_eq!(scope.region_scope, local_scope, "local scope is not the topmost scope!",); // look for moves of a local variable, like `MOVE(_X)` let locals_moved = operands @@ -1046,9 +1043,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { matches!( self.cfg.block_data(start).terminator().kind, TerminatorKind::Assert { .. } - | TerminatorKind::Call {..} - | TerminatorKind::DropAndReplace { .. } - | TerminatorKind::FalseUnwind { .. } + | TerminatorKind::Call { .. } + | TerminatorKind::DropAndReplace { .. } + | TerminatorKind::FalseUnwind { .. } ), "diverge_from called on block with terminator that cannot unwind." ); diff --git a/compiler/rustc_parse/src/parser/nonterminal.rs b/compiler/rustc_parse/src/parser/nonterminal.rs index 012b76d3d1887..6e25209f0905e 100644 --- a/compiler/rustc_parse/src/parser/nonterminal.rs +++ b/compiler/rustc_parse/src/parser/nonterminal.rs @@ -41,13 +41,16 @@ impl<'a> Parser<'a> { }, NonterminalKind::Block => match token.kind { token::OpenDelim(token::Brace) => true, - token::Interpolated(ref nt) => !matches!(**nt, token::NtItem(_) - | token::NtPat(_) - | token::NtTy(_) - | token::NtIdent(..) - | token::NtMeta(_) - | token::NtPath(_) - | token::NtVis(_)), + token::Interpolated(ref nt) => !matches!( + **nt, + token::NtItem(_) + | token::NtPat(_) + | token::NtTy(_) + | token::NtIdent(..) + | token::NtMeta(_) + | token::NtPath(_) + | token::NtVis(_) + ), _ => false, }, NonterminalKind::Path | NonterminalKind::Meta => match token.kind { diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index b70cec25dfb5a..e1d03e3504800 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -553,7 +553,8 @@ impl<'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'tcx> { // optional. They inherit stability from their parents when unannotated. if !matches!( i.kind, - hir::ItemKind::Impl(hir::Impl { of_trait: None, .. }) | hir::ItemKind::ForeignMod { .. } + hir::ItemKind::Impl(hir::Impl { of_trait: None, .. }) + | hir::ItemKind::ForeignMod { .. } ) { self.check_missing_stability(i.hir_id, i.span); } diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index bed7a350ea86d..9c90388d24aaa 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -1659,12 +1659,15 @@ impl<'tcx> LifetimeContext<'_, 'tcx> { match missing { MissingLifetimeSpot::Generics(generics) => { let (span, sugg) = if let Some(param) = generics.params.iter().find(|p| { - !matches!(p.kind, hir::GenericParamKind::Type { - synthetic: Some(hir::SyntheticTyParamKind::ImplTrait), - .. - } | hir::GenericParamKind::Lifetime { - kind: hir::LifetimeParamKind::Elided, - }) + !matches!( + p.kind, + hir::GenericParamKind::Type { + synthetic: Some(hir::SyntheticTyParamKind::ImplTrait), + .. + } | hir::GenericParamKind::Lifetime { + kind: hir::LifetimeParamKind::Elided, + } + ) }) { (param.span.shrink_to_lo(), format!("{}, ", lifetime_ref)) } else { @@ -1844,10 +1847,13 @@ impl<'tcx> LifetimeContext<'_, 'tcx> { msg = "consider introducing a named lifetime parameter".to_string(); should_break = true; if let Some(param) = generics.params.iter().find(|p| { - !matches!(p.kind, hir::GenericParamKind::Type { - synthetic: Some(hir::SyntheticTyParamKind::ImplTrait), - .. - }) + !matches!( + p.kind, + hir::GenericParamKind::Type { + synthetic: Some(hir::SyntheticTyParamKind::ImplTrait), + .. + } + ) }) { (param.span.shrink_to_lo(), "'a, ".to_string()) } else { diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs index aa1c31bda54df..66d0964170a69 100644 --- a/compiler/rustc_target/src/abi/call/mod.rs +++ b/compiler/rustc_target/src/abi/call/mod.rs @@ -521,7 +521,7 @@ impl<'a, Ty> ArgAbi<'a, Ty> { } pub fn is_indirect(&self) -> bool { - matches!(self.mode, PassMode::Indirect {..}) + matches!(self.mode, PassMode::Indirect { .. }) } pub fn is_sized_indirect(&self) -> bool { diff --git a/compiler/rustc_target/src/spec/wasm32_base.rs b/compiler/rustc_target/src/spec/wasm32_base.rs index a7957d84cbeef..bfef3d37228f0 100644 --- a/compiler/rustc_target/src/spec/wasm32_base.rs +++ b/compiler/rustc_target/src/spec/wasm32_base.rs @@ -55,15 +55,6 @@ pub fn options() -> TargetOptions { // to do so. arg("--no-demangle"); - // The symbol visibility story is a bit in flux right now with LLD. - // It's... not entirely clear to me what's going on, but this looks to - // make everything work when `export_symbols` isn't otherwise called for - // things like executables. - // - // This is really only here to get things working. If it can be removed and - // basic tests still work, then sounds like it should be removed! - arg("--export-dynamic"); - let mut pre_link_args = BTreeMap::new(); pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Wasm), lld_args); pre_link_args.insert(LinkerFlavor::Gcc, clang_args); diff --git a/compiler/rustc_target/src/spec/wasm32_unknown_emscripten.rs b/compiler/rustc_target/src/spec/wasm32_unknown_emscripten.rs index c12757b8f9812..9f69ce16c215d 100644 --- a/compiler/rustc_target/src/spec/wasm32_unknown_emscripten.rs +++ b/compiler/rustc_target/src/spec/wasm32_unknown_emscripten.rs @@ -2,6 +2,17 @@ use super::wasm32_base; use super::{LinkArgs, LinkerFlavor, PanicStrategy, Target, TargetOptions}; pub fn target() -> Target { + let mut options = wasm32_base::options(); + + let clang_args = options.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap(); + + // Rust really needs a way for users to specify exports and imports in + // the source code. --export-dynamic isn't the right tool for this job, + // however it does have the side effect of automatically exporting a lot + // of symbols, which approximates what people want when compiling for + // wasm32-unknown-unknown expect, so use it for now. + clang_args.push("--export-dynamic".to_string()); + let mut post_link_args = LinkArgs::new(); post_link_args.insert( LinkerFlavor::Em, @@ -28,7 +39,7 @@ pub fn target() -> Target { panic_strategy: PanicStrategy::Unwind, post_link_args, os_family: Some("unix".to_string()), - ..wasm32_base::options() + ..options }; Target { llvm_target: "wasm32-unknown-emscripten".to_string(), diff --git a/compiler/rustc_target/src/spec/wasm32_unknown_unknown.rs b/compiler/rustc_target/src/spec/wasm32_unknown_unknown.rs index 6037aa5b4306e..5e89ba2520bdd 100644 --- a/compiler/rustc_target/src/spec/wasm32_unknown_unknown.rs +++ b/compiler/rustc_target/src/spec/wasm32_unknown_unknown.rs @@ -26,11 +26,18 @@ pub fn target() -> Target { // For now this target just never has an entry symbol no matter the output // type, so unconditionally pass this. clang_args.push("-Wl,--no-entry".to_string()); - options - .pre_link_args - .get_mut(&LinkerFlavor::Lld(LldFlavor::Wasm)) - .unwrap() - .push("--no-entry".to_string()); + + // Rust really needs a way for users to specify exports and imports in + // the source code. --export-dynamic isn't the right tool for this job, + // however it does have the side effect of automatically exporting a lot + // of symbols, which approximates what people want when compiling for + // wasm32-unknown-unknown expect, so use it for now. + clang_args.push("-Wl,--export-dynamic".to_string()); + + // Add the flags to wasm-ld's args too. + let lld_args = options.pre_link_args.get_mut(&LinkerFlavor::Lld(LldFlavor::Wasm)).unwrap(); + lld_args.push("--no-entry".to_string()); + lld_args.push("--export-dynamic".to_string()); Target { llvm_target: "wasm32-unknown-unknown".to_string(), 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 a42a05c5f0284..d3b3403ac3e73 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -1190,9 +1190,12 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> { normalized_ty, data.ty ); - let is_normalized_ty_expected = !matches!(obligation.cause.code, ObligationCauseCode::ItemObligation(_) - | ObligationCauseCode::BindingObligation(_, _) - | ObligationCauseCode::ObjectCastObligation(_)); + let is_normalized_ty_expected = !matches!( + obligation.cause.code, + ObligationCauseCode::ItemObligation(_) + | ObligationCauseCode::BindingObligation(_, _) + | ObligationCauseCode::ObjectCastObligation(_) + ); if let Err(error) = self.at(&obligation.cause, obligation.param_env).eq_exp( is_normalized_ty_expected, 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 0724a9290e91c..f1f214026343b 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -290,9 +290,9 @@ fn suggest_restriction( generics .params .iter() - .filter( - |p| !matches!(p.kind, hir::GenericParamKind::Type { synthetic: Some(_), ..}), - ) + .filter(|p| { + !matches!(p.kind, hir::GenericParamKind::Type { synthetic: Some(_), .. }) + }) .next(), super_traits, ) { diff --git a/compiler/rustc_typeck/src/astconv/generics.rs b/compiler/rustc_typeck/src/astconv/generics.rs index 0797c95636260..67e37ca8d8e49 100644 --- a/compiler/rustc_typeck/src/astconv/generics.rs +++ b/compiler/rustc_typeck/src/astconv/generics.rs @@ -496,14 +496,15 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { ) -> bool { let explicit = !seg.infer_args; let impl_trait = generics.params.iter().any(|param| { - matches!(param.kind, ty::GenericParamDefKind::Type { - synthetic: - Some( - hir::SyntheticTyParamKind::ImplTrait - | hir::SyntheticTyParamKind::FromAttr, + matches!( + param.kind, + ty::GenericParamDefKind::Type { + synthetic: Some( + hir::SyntheticTyParamKind::ImplTrait | hir::SyntheticTyParamKind::FromAttr, ), - .. - }) + .. + } + ) }); if explicit && impl_trait { diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs index ed48a0bc801cf..bc1a07801ae87 100644 --- a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs +++ b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs @@ -274,10 +274,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } let autoborrow_mut = adj.iter().any(|adj| { - matches!(adj, &Adjustment { - kind: Adjust::Borrow(AutoBorrow::Ref(_, AutoBorrowMutability::Mut { .. })), - .. - }) + matches!( + adj, + &Adjustment { + kind: Adjust::Borrow(AutoBorrow::Ref(_, AutoBorrowMutability::Mut { .. })), + .. + } + ) }); match self.typeck_results.borrow_mut().adjustments_mut().entry(expr.hir_id) { diff --git a/library/alloc/benches/btree/map.rs b/library/alloc/benches/btree/map.rs index 7c2e5694a62fc..ccb04d09180d3 100644 --- a/library/alloc/benches/btree/map.rs +++ b/library/alloc/benches/btree/map.rs @@ -283,6 +283,8 @@ pub fn iter_1m(b: &mut Bencher) { bench_iter(b, 1_000, 1_000_000); } +// On Windows, this is a factor 11 away from causing stack overflow, +// where node size grows to roughly `node::CAPACITY * FAT * 8` = 300 KB. const FAT: usize = 256; // The returned map has small keys and values. @@ -296,11 +298,6 @@ fn fat_val_map(n: usize) -> BTreeMap { (0..n).map(|i| (i, [i; FAT])).collect::>() } -// The returned map has large keys and values. -fn fat_map(n: usize) -> BTreeMap<[usize; FAT], [usize; FAT]> { - (0..n).map(|i| ([i; FAT], [i; FAT])).collect::>() -} - #[bench] pub fn clone_slim_100(b: &mut Bencher) { let src = slim_map(100); @@ -513,74 +510,3 @@ pub fn clone_fat_val_100_and_remove_half(b: &mut Bencher) { map }) } - -#[bench] -pub fn clone_fat_100(b: &mut Bencher) { - let src = fat_map(100); - b.iter(|| src.clone()) -} - -#[bench] -pub fn clone_fat_100_and_clear(b: &mut Bencher) { - let src = fat_map(100); - b.iter(|| src.clone().clear()) -} - -#[bench] -pub fn clone_fat_100_and_drain_all(b: &mut Bencher) { - let src = fat_map(100); - b.iter(|| src.clone().drain_filter(|_, _| true).count()) -} - -#[bench] -pub fn clone_fat_100_and_drain_half(b: &mut Bencher) { - let src = fat_map(100); - b.iter(|| { - let mut map = src.clone(); - assert_eq!(map.drain_filter(|i, _| i[0] % 2 == 0).count(), 100 / 2); - assert_eq!(map.len(), 100 / 2); - }) -} - -#[bench] -pub fn clone_fat_100_and_into_iter(b: &mut Bencher) { - let src = fat_map(100); - b.iter(|| src.clone().into_iter().count()) -} - -#[bench] -pub fn clone_fat_100_and_pop_all(b: &mut Bencher) { - let src = fat_map(100); - b.iter(|| { - let mut map = src.clone(); - while map.pop_first().is_some() {} - map - }); -} - -#[bench] -pub fn clone_fat_100_and_remove_all(b: &mut Bencher) { - let src = fat_map(100); - b.iter(|| { - let mut map = src.clone(); - while let Some(elt) = map.iter().map(|(&i, _)| i).next() { - let v = map.remove(&elt); - debug_assert!(v.is_some()); - } - map - }); -} - -#[bench] -pub fn clone_fat_100_and_remove_half(b: &mut Bencher) { - let src = fat_map(100); - b.iter(|| { - let mut map = src.clone(); - for i in (0..100).step_by(2) { - let v = map.remove(&[i; FAT]); - debug_assert!(v.is_some()); - } - assert_eq!(map.len(), 100 / 2); - map - }) -} diff --git a/library/alloc/src/collections/btree/map/tests.rs b/library/alloc/src/collections/btree/map/tests.rs index ba5a4442f56e6..1f41d77875dc0 100644 --- a/library/alloc/src/collections/btree/map/tests.rs +++ b/library/alloc/src/collections/btree/map/tests.rs @@ -137,8 +137,9 @@ impl<'a, K: 'a, V: 'a> NodeRef, K, V, marker::LeafOrInternal> } } -// Tests our value of MIN_INSERTS_HEIGHT_2. It may change according to the -// implementation of insertion, but it's best to be aware of when it does. +// Tests our value of MIN_INSERTS_HEIGHT_2. Failure may mean you just need to +// adapt that value to match a change in node::CAPACITY or the choices made +// during insertion, otherwise other test cases may fail or be less useful. #[test] fn test_levels() { let mut map = BTreeMap::new(); diff --git a/library/alloc/src/collections/btree/node/tests.rs b/library/alloc/src/collections/btree/node/tests.rs index acb7210ca7c8b..6da93b19a8d80 100644 --- a/library/alloc/src/collections/btree/node/tests.rs +++ b/library/alloc/src/collections/btree/node/tests.rs @@ -103,7 +103,7 @@ fn test_partial_cmp_eq() { #[cfg(target_arch = "x86_64")] fn test_sizes() { assert_eq!(core::mem::size_of::>(), 16); - assert_eq!(core::mem::size_of::>(), 16 + CAPACITY * 8 * 2); - assert_eq!(core::mem::size_of::>(), 112); - assert_eq!(core::mem::size_of::>(), 112 + CAPACITY * 8 * 2); + assert_eq!(core::mem::size_of::>(), 16 + CAPACITY * 2 * 8); + assert_eq!(core::mem::size_of::>(), 16 + (CAPACITY + 1) * 8); + assert_eq!(core::mem::size_of::>(), 16 + (CAPACITY * 3 + 1) * 8); } diff --git a/library/core/src/default.rs b/library/core/src/default.rs index 9a8d65cd4e06b..28ec3279459ab 100644 --- a/library/core/src/default.rs +++ b/library/core/src/default.rs @@ -173,9 +173,11 @@ macro_rules! default_impl { impl Default for $t { #[inline] #[doc = $doc] - fn default() -> $t { $v } + fn default() -> $t { + $v + } } - } + }; } default_impl! { (), (), "Returns the default value of `()`" } diff --git a/library/core/src/iter/adapters/zip.rs b/library/core/src/iter/adapters/zip.rs index 98b8dca961407..fcc55cbb4f940 100644 --- a/library/core/src/iter/adapters/zip.rs +++ b/library/core/src/iter/adapters/zip.rs @@ -17,93 +17,33 @@ pub struct Zip { index: usize, len: usize, } -impl Zip { - pub(in crate::iter) fn new(a: A, b: B) -> Zip { - ZipImpl::new(a, b) - } - fn super_nth(&mut self, mut n: usize) -> Option<(A::Item, B::Item)> { - while let Some(x) = Iterator::next(self) { - if n == 0 { - return Some(x); - } - n -= 1; - } - None - } -} -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for Zip +impl Zip where A: Iterator, B: Iterator, { - type Item = (A::Item, B::Item); - - #[inline] - fn next(&mut self) -> Option { - ZipImpl::next(self) - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - ZipImpl::size_hint(self) - } - - #[inline] - fn nth(&mut self, n: usize) -> Option { - ZipImpl::nth(self, n) - } - - #[inline] - unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item - where - Self: TrustedRandomAccess, - { - // SAFETY: `ZipImpl::__iterator_get_unchecked` has same safety - // requirements as `Iterator::__iterator_get_unchecked`. - unsafe { ZipImpl::get_unchecked(self, idx) } + pub(in crate::iter) fn new(a: A, b: B) -> Zip { + ZipNew::new(a, b) } -} -#[stable(feature = "rust1", since = "1.0.0")] -impl DoubleEndedIterator for Zip -where - A: DoubleEndedIterator + ExactSizeIterator, - B: DoubleEndedIterator + ExactSizeIterator, -{ - #[inline] - fn next_back(&mut self) -> Option<(A::Item, B::Item)> { - ZipImpl::next_back(self) + fn super_nth(&mut self, n: usize) -> Option<(A::Item, B::Item)> { + self.advance_by(n).ok()?; + self.next() } } -// Zip specialization trait #[doc(hidden)] -trait ZipImpl { - type Item; +trait ZipNew { fn new(a: A, b: B) -> Self; - fn next(&mut self) -> Option; - fn size_hint(&self) -> (usize, Option); - fn nth(&mut self, n: usize) -> Option; - fn next_back(&mut self) -> Option - where - A: DoubleEndedIterator + ExactSizeIterator, - B: DoubleEndedIterator + ExactSizeIterator; - // This has the same safety requirements as `Iterator::__iterator_get_unchecked` - unsafe fn get_unchecked(&mut self, idx: usize) -> ::Item - where - Self: Iterator + TrustedRandomAccess; } -// General Zip impl #[doc(hidden)] -impl ZipImpl for Zip +impl ZipNew for Zip where A: Iterator, B: Iterator, { - type Item = (A::Item, B::Item); default fn new(a: A, b: B) -> Self { Zip { a, @@ -112,25 +52,28 @@ where len: 0, // unused } } +} - #[inline] - default fn next(&mut self) -> Option<(A::Item, B::Item)> { - let x = self.a.next()?; - let y = self.b.next()?; - Some((x, y)) - } - - #[inline] - default fn nth(&mut self, n: usize) -> Option { - self.super_nth(n) +#[doc(hidden)] +impl ZipNew for Zip +where + A: TrustedRandomAccess + Iterator, + B: TrustedRandomAccess + Iterator, +{ + fn new(a: A, b: B) -> Self { + let len = cmp::min(a.size(), b.size()); + Zip { a, b, index: 0, len } } +} +#[stable(feature = "rust1", since = "1.0.0")] +impl DoubleEndedIterator for Zip +where + A: DoubleEndedIterator + ExactSizeIterator, + B: DoubleEndedIterator + ExactSizeIterator, +{ #[inline] - default fn next_back(&mut self) -> Option<(A::Item, B::Item)> - where - A: DoubleEndedIterator + ExactSizeIterator, - B: DoubleEndedIterator + ExactSizeIterator, - { + default fn next_back(&mut self) -> Option<(A::Item, B::Item)> { let a_sz = self.a.len(); let b_sz = self.b.len(); if a_sz != b_sz { @@ -151,6 +94,71 @@ where _ => unreachable!(), } } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl DoubleEndedIterator for Zip +where + A: TrustedRandomAccess + DoubleEndedIterator + ExactSizeIterator, + B: TrustedRandomAccess + DoubleEndedIterator + ExactSizeIterator, +{ + #[inline] + fn next_back(&mut self) -> Option<(A::Item, B::Item)> { + let a_side_effect = A::may_have_side_effect(); + let b_side_effect = B::may_have_side_effect(); + if a_side_effect || b_side_effect { + let sz_a = self.a.size(); + let sz_b = self.b.size(); + // Adjust a, b to equal length, make sure that only the first call + // of `next_back` does this, otherwise we will break the restriction + // on calls to `self.next_back()` after calling `get_unchecked()`. + if sz_a != sz_b { + if a_side_effect && sz_a > self.len { + for _ in 0..sz_a - cmp::max(self.len, self.index) { + self.a.next_back(); + } + } + + if b_side_effect && sz_b > self.len { + for _ in 0..sz_b - self.len { + self.b.next_back(); + } + } + } + } + if self.index < self.len { + self.len -= 1; + let i = self.len; + // SAFETY: `i` is smaller than the previous value of `self.len`, + // which is also smaller than or equal to `self.a.len()` and `self.b.len()` + unsafe { + Some((self.a.__iterator_get_unchecked(i), self.b.__iterator_get_unchecked(i))) + } + } else { + None + } + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for Zip +where + A: Iterator, + B: Iterator, +{ + type Item = (A::Item, B::Item); + + #[inline] + default fn next(&mut self) -> Option<(A::Item, B::Item)> { + let x = self.a.next()?; + let y = self.b.next()?; + Some((x, y)) + } + + #[inline] + default fn nth(&mut self, n: usize) -> Option { + self.super_nth(n) + } #[inline] default fn size_hint(&self) -> (usize, Option) { @@ -169,7 +177,7 @@ where (lower, upper) } - default unsafe fn get_unchecked(&mut self, _idx: usize) -> ::Item + default unsafe fn __iterator_get_unchecked(&mut self, _idx: usize) -> ::Item where Self: TrustedRandomAccess, { @@ -177,17 +185,12 @@ where } } -#[doc(hidden)] -impl ZipImpl for Zip +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for Zip where A: TrustedRandomAccess + Iterator, B: TrustedRandomAccess + Iterator, { - fn new(a: A, b: B) -> Self { - let len = cmp::min(a.size(), b.size()); - Zip { a, b, index: 0, len } - } - #[inline] fn next(&mut self) -> Option<(A::Item, B::Item)> { if self.index < self.len { @@ -243,49 +246,7 @@ where } #[inline] - fn next_back(&mut self) -> Option<(A::Item, B::Item)> - where - A: DoubleEndedIterator + ExactSizeIterator, - B: DoubleEndedIterator + ExactSizeIterator, - { - let a_side_effect = A::may_have_side_effect(); - let b_side_effect = B::may_have_side_effect(); - if a_side_effect || b_side_effect { - let sz_a = self.a.size(); - let sz_b = self.b.size(); - // Adjust a, b to equal length, make sure that only the first call - // of `next_back` does this, otherwise we will break the restriction - // on calls to `self.next_back()` after calling `get_unchecked()`. - if sz_a != sz_b { - let sz_a = self.a.size(); - if a_side_effect && sz_a > self.len { - for _ in 0..sz_a - cmp::max(self.len, self.index) { - self.a.next_back(); - } - } - let sz_b = self.b.size(); - if b_side_effect && sz_b > self.len { - for _ in 0..sz_b - self.len { - self.b.next_back(); - } - } - } - } - if self.index < self.len { - self.len -= 1; - let i = self.len; - // SAFETY: `i` is smaller than the previous value of `self.len`, - // which is also smaller than or equal to `self.a.len()` and `self.b.len()` - unsafe { - Some((self.a.__iterator_get_unchecked(i), self.b.__iterator_get_unchecked(i))) - } - } else { - None - } - } - - #[inline] - unsafe fn get_unchecked(&mut self, idx: usize) -> ::Item { + unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> ::Item { let idx = self.index + idx; // SAFETY: the caller must uphold the contract for // `Iterator::__iterator_get_unchecked`. diff --git a/library/core/src/str/iter.rs b/library/core/src/str/iter.rs index 8b952eab2946d..83f484dc570c4 100644 --- a/library/core/src/str/iter.rs +++ b/library/core/src/str/iter.rs @@ -47,12 +47,7 @@ impl<'a> Iterator for Chars<'a> { #[inline] fn count(self) -> usize { // length in `char` is equal to the number of non-continuation bytes - let bytes_len = self.iter.len(); - let mut cont_bytes = 0; - for &byte in self.iter { - cont_bytes += utf8_is_cont_byte(byte) as usize; - } - bytes_len - cont_bytes + self.iter.filter(|&&byte| !utf8_is_cont_byte(byte)).count() } #[inline] diff --git a/rustfmt.toml b/rustfmt.toml index 45cce186c0996..af807aa6f739e 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -6,7 +6,7 @@ merge_derives = false # by default we ignore everything in the repository # tidy only checks files which are not ignored, each entry follows gitignore style ignore = [ - "build", + "/build/", "/vendor/", # tests for now are not formatted, as they are sometimes pretty-printing constrained diff --git a/src/bootstrap/bin/main.rs b/src/bootstrap/bin/main.rs index 07e582d4d2941..a32a4a7fe56c2 100644 --- a/src/bootstrap/bin/main.rs +++ b/src/bootstrap/bin/main.rs @@ -15,7 +15,7 @@ fn main() { // check_version warnings are not printed during setup let changelog_suggestion = - if matches!(config.cmd, Subcommand::Setup {..}) { None } else { check_version(&config) }; + if matches!(config.cmd, Subcommand::Setup { .. }) { None } else { check_version(&config) }; // NOTE: Since `./configure` generates a `config.toml`, distro maintainers will see the // changelog warning, not the `x.py setup` message. diff --git a/src/stage0.txt b/src/stage0.txt index e853b9b4e4191..d3c76eb282a7e 100644 --- a/src/stage0.txt +++ b/src/stage0.txt @@ -19,7 +19,7 @@ rustc: beta # bootstrapping issues with use of new syntax in this repo. If you're looking at # the beta/stable branch, this key should be omitted, as we don't want to depend # on rustfmt from nightly there. -rustfmt: nightly-2020-11-19 +rustfmt: nightly-2021-01-28 # When making a stable release the process currently looks like: # diff --git a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyBranches-final.after.diff b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyBranches-final.after.diff index f51a08ed73068..1b292cdd796e5 100644 --- a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyBranches-final.after.diff +++ b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyBranches-final.after.diff @@ -1,7 +1,7 @@ - // MIR for `try_sum` before EarlyOtherwiseBranch + // MIR for `try_sum` after SimplifyBranches-final - fn try_sum(_1: &ViewportPercentageLength, _2: &ViewportPercentageLength) -> std::result::Result { + fn try_sum(_1: &ViewportPercentageLength, _2: &ViewportPercentageLength) -> Result { debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:18:5: 18:6 debug other => _2; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:19:5: 19:10 let mut _0: std::result::Result; // return place in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:6: 20:42 diff --git a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff index 05ef6721e6535..d20ee78459103 100644 --- a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff @@ -1,7 +1,7 @@ - // MIR for `try_sum` before EarlyOtherwiseBranch + // MIR for `try_sum` after EarlyOtherwiseBranch - fn try_sum(_1: &ViewportPercentageLength, _2: &ViewportPercentageLength) -> std::result::Result { + fn try_sum(_1: &ViewportPercentageLength, _2: &ViewportPercentageLength) -> Result { debug x => _1; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:18:5: 18:6 debug other => _2; // in scope 0 at $DIR/early_otherwise_branch_68867.rs:19:5: 19:10 let mut _0: std::result::Result; // return place in scope 0 at $DIR/early_otherwise_branch_68867.rs:20:6: 20:42 diff --git a/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff b/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff index bb79cd80e51b6..caa02abf01936 100644 --- a/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff +++ b/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff @@ -1,7 +1,7 @@ - // MIR for `float_to_exponential_common` before ConstProp + // MIR for `float_to_exponential_common` after ConstProp - fn float_to_exponential_common(_1: &mut Formatter, _2: &T, _3: bool) -> std::result::Result<(), std::fmt::Error> { + fn float_to_exponential_common(_1: &mut Formatter, _2: &T, _3: bool) -> Result<(), std::fmt::Error> { debug fmt => _1; // in scope 0 at $DIR/funky_arms.rs:11:35: 11:38 debug num => _2; // in scope 0 at $DIR/funky_arms.rs:11:60: 11:63 debug upper => _3; // in scope 0 at $DIR/funky_arms.rs:11:69: 11:74 diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff index 435b2a1360a6b..aa4cff9d9d1b3 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff @@ -128,7 +128,7 @@ // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } StorageLive(_22); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _22 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _23) -> bb3; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>>(move _23) -> bb3; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } @@ -158,7 +158,7 @@ // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } StorageLive(_25); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _25 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _26) -> bb5; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>>(move _26) -> bb5; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff index 435b2a1360a6b..aa4cff9d9d1b3 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff @@ -128,7 +128,7 @@ // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } StorageLive(_22); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _22 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _23) -> bb3; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>>(move _23) -> bb3; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } @@ -158,7 +158,7 @@ // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } StorageLive(_25); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _25 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _26) -> bb5; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>>(move _26) -> bb5; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff index d87cb2af8baac..ad60b2c4edfa9 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff @@ -203,7 +203,7 @@ StorageLive(_44); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_45); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _45 = _38; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _44 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _45) -> bb5; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _44 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>>(move _45) -> bb5; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } @@ -252,7 +252,7 @@ StorageLive(_48); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_49); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _49 = _41; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _48 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _49) -> bb7; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _48 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>>(move _49) -> bb7; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff index d87cb2af8baac..ad60b2c4edfa9 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff @@ -203,7 +203,7 @@ StorageLive(_44); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_45); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _45 = _38; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _44 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _45) -> bb5; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _44 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>>(move _45) -> bb5; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } @@ -252,7 +252,7 @@ StorageLive(_48); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_49); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _49 = _41; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _48 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _49) -> bb7; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _48 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> Result<(), std::fmt::Error>>(move _49) -> bb7; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/simplify_arm.id_result.SimplifyArmIdentity.diff b/src/test/mir-opt/simplify_arm.id_result.SimplifyArmIdentity.diff index 253e3236ff7d1..40c18fb7282ec 100644 --- a/src/test/mir-opt/simplify_arm.id_result.SimplifyArmIdentity.diff +++ b/src/test/mir-opt/simplify_arm.id_result.SimplifyArmIdentity.diff @@ -1,7 +1,7 @@ - // MIR for `id_result` before SimplifyArmIdentity + // MIR for `id_result` after SimplifyArmIdentity - fn id_result(_1: std::result::Result) -> std::result::Result { + fn id_result(_1: Result) -> Result { debug r => _1; // in scope 0 at $DIR/simplify-arm.rs:16:14: 16:15 let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify-arm.rs:16:37: 16:52 let mut _2: isize; // in scope 0 at $DIR/simplify-arm.rs:18:9: 18:14 diff --git a/src/test/mir-opt/simplify_arm.id_result.SimplifyBranchSame.diff b/src/test/mir-opt/simplify_arm.id_result.SimplifyBranchSame.diff index 23cf43c531973..596dbabead0bf 100644 --- a/src/test/mir-opt/simplify_arm.id_result.SimplifyBranchSame.diff +++ b/src/test/mir-opt/simplify_arm.id_result.SimplifyBranchSame.diff @@ -1,7 +1,7 @@ - // MIR for `id_result` before SimplifyBranchSame + // MIR for `id_result` after SimplifyBranchSame - fn id_result(_1: std::result::Result) -> std::result::Result { + fn id_result(_1: Result) -> Result { debug r => _1; // in scope 0 at $DIR/simplify-arm.rs:16:14: 16:15 let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify-arm.rs:16:37: 16:52 let mut _2: isize; // in scope 0 at $DIR/simplify-arm.rs:18:9: 18:14 diff --git a/src/test/mir-opt/simplify_arm.id_try.SimplifyArmIdentity.diff b/src/test/mir-opt/simplify_arm.id_try.SimplifyArmIdentity.diff index 84d8214122ae1..ccb3b71817ff6 100644 --- a/src/test/mir-opt/simplify_arm.id_try.SimplifyArmIdentity.diff +++ b/src/test/mir-opt/simplify_arm.id_try.SimplifyArmIdentity.diff @@ -1,7 +1,7 @@ - // MIR for `id_try` before SimplifyArmIdentity + // MIR for `id_try` after SimplifyArmIdentity - fn id_try(_1: std::result::Result) -> std::result::Result { + fn id_try(_1: Result) -> Result { debug r => _1; // in scope 0 at $DIR/simplify-arm.rs:23:11: 23:12 let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify-arm.rs:23:34: 23:49 let _2: u8; // in scope 0 at $DIR/simplify-arm.rs:24:9: 24:10 @@ -26,7 +26,7 @@ - debug t => _9; // in scope 7 at $DIR/simplify-arm.rs:24:14: 24:15 + debug t => ((_0 as Err).0: i32); // in scope 7 at $DIR/simplify-arm.rs:24:14: 24:15 } - scope 8 (inlined as Try>::from_error) { // at $DIR/simplify-arm.rs:24:13: 24:15 + scope 8 (inlined as Try>::from_error) { // at $DIR/simplify-arm.rs:24:13: 24:15 - debug v => _8; // in scope 8 at $DIR/simplify-arm.rs:24:13: 24:15 + debug v => ((_0 as Err).0: i32); // in scope 8 at $DIR/simplify-arm.rs:24:13: 24:15 let mut _12: i32; // in scope 8 at $DIR/simplify-arm.rs:24:13: 24:15 @@ -39,7 +39,7 @@ scope 5 { } } - scope 6 (inlined as Try>::into_result) { // at $DIR/simplify-arm.rs:24:13: 24:15 + scope 6 (inlined as Try>::into_result) { // at $DIR/simplify-arm.rs:24:13: 24:15 debug self => _4; // in scope 6 at $DIR/simplify-arm.rs:24:13: 24:15 } diff --git a/src/test/mir-opt/simplify_arm.id_try.SimplifyBranchSame.diff b/src/test/mir-opt/simplify_arm.id_try.SimplifyBranchSame.diff index aa050655cdaa5..ec8ac30228e59 100644 --- a/src/test/mir-opt/simplify_arm.id_try.SimplifyBranchSame.diff +++ b/src/test/mir-opt/simplify_arm.id_try.SimplifyBranchSame.diff @@ -1,7 +1,7 @@ - // MIR for `id_try` before SimplifyBranchSame + // MIR for `id_try` after SimplifyBranchSame - fn id_try(_1: std::result::Result) -> std::result::Result { + fn id_try(_1: Result) -> Result { debug r => _1; // in scope 0 at $DIR/simplify-arm.rs:23:11: 23:12 let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify-arm.rs:23:34: 23:49 let _2: u8; // in scope 0 at $DIR/simplify-arm.rs:24:9: 24:10 @@ -23,7 +23,7 @@ scope 7 (inlined >::from) { // at $DIR/simplify-arm.rs:24:14: 24:15 debug t => ((_0 as Err).0: i32); // in scope 7 at $DIR/simplify-arm.rs:24:14: 24:15 } - scope 8 (inlined as Try>::from_error) { // at $DIR/simplify-arm.rs:24:13: 24:15 + scope 8 (inlined as Try>::from_error) { // at $DIR/simplify-arm.rs:24:13: 24:15 debug v => ((_0 as Err).0: i32); // in scope 8 at $DIR/simplify-arm.rs:24:13: 24:15 let mut _12: i32; // in scope 8 at $DIR/simplify-arm.rs:24:13: 24:15 } @@ -34,7 +34,7 @@ scope 5 { } } - scope 6 (inlined as Try>::into_result) { // at $DIR/simplify-arm.rs:24:13: 24:15 + scope 6 (inlined as Try>::into_result) { // at $DIR/simplify-arm.rs:24:13: 24:15 debug self => _4; // in scope 6 at $DIR/simplify-arm.rs:24:13: 24:15 } diff --git a/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff b/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff index 3ba0af991f63b..b1bae447f9c65 100644 --- a/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff +++ b/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff @@ -1,7 +1,7 @@ - // MIR for `try_identity` before DestinationPropagation + // MIR for `try_identity` after DestinationPropagation - fn try_identity(_1: std::result::Result) -> std::result::Result { + fn try_identity(_1: Result) -> Result { debug x => _1; // in scope 0 at $DIR/simplify_try.rs:7:17: 7:18 let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:7:41: 7:57 let _2: u32; // in scope 0 at $DIR/simplify_try.rs:8:9: 8:10 @@ -23,7 +23,7 @@ scope 7 (inlined >::from) { // at $DIR/simplify_try.rs:8:14: 8:15 debug t => ((_0 as Err).0: i32); // in scope 7 at $DIR/simplify_try.rs:8:14: 8:15 } - scope 8 (inlined as Try>::from_error) { // at $DIR/simplify_try.rs:8:13: 8:15 + scope 8 (inlined as Try>::from_error) { // at $DIR/simplify_try.rs:8:13: 8:15 debug v => ((_0 as Err).0: i32); // in scope 8 at $DIR/simplify_try.rs:8:13: 8:15 let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:8:13: 8:15 } @@ -34,7 +34,7 @@ scope 5 { } } - scope 6 (inlined as Try>::into_result) { // at $DIR/simplify_try.rs:8:13: 8:15 + scope 6 (inlined as Try>::into_result) { // at $DIR/simplify_try.rs:8:13: 8:15 - debug self => _4; // in scope 6 at $DIR/simplify_try.rs:8:13: 8:15 + debug self => _0; // in scope 6 at $DIR/simplify_try.rs:8:13: 8:15 } diff --git a/src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff b/src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff index 9c91762eb4e15..df274852f6820 100644 --- a/src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff +++ b/src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff @@ -1,7 +1,7 @@ - // MIR for `try_identity` before SimplifyArmIdentity + // MIR for `try_identity` after SimplifyArmIdentity - fn try_identity(_1: std::result::Result) -> std::result::Result { + fn try_identity(_1: Result) -> Result { debug x => _1; // in scope 0 at $DIR/simplify_try.rs:7:17: 7:18 let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:7:41: 7:57 let _2: u32; // in scope 0 at $DIR/simplify_try.rs:8:9: 8:10 @@ -26,7 +26,7 @@ - debug t => _9; // in scope 7 at $DIR/simplify_try.rs:8:14: 8:15 + debug t => ((_0 as Err).0: i32); // in scope 7 at $DIR/simplify_try.rs:8:14: 8:15 } - scope 8 (inlined as Try>::from_error) { // at $DIR/simplify_try.rs:8:13: 8:15 + scope 8 (inlined as Try>::from_error) { // at $DIR/simplify_try.rs:8:13: 8:15 - debug v => _8; // in scope 8 at $DIR/simplify_try.rs:8:13: 8:15 + debug v => ((_0 as Err).0: i32); // in scope 8 at $DIR/simplify_try.rs:8:13: 8:15 let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:8:13: 8:15 @@ -39,7 +39,7 @@ scope 5 { } } - scope 6 (inlined as Try>::into_result) { // at $DIR/simplify_try.rs:8:13: 8:15 + scope 6 (inlined as Try>::into_result) { // at $DIR/simplify_try.rs:8:13: 8:15 debug self => _4; // in scope 6 at $DIR/simplify_try.rs:8:13: 8:15 } diff --git a/src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir b/src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir index cd8436a971ee8..37274691fb476 100644 --- a/src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir +++ b/src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir @@ -1,6 +1,6 @@ // MIR for `try_identity` after SimplifyBranchSame -fn try_identity(_1: std::result::Result) -> std::result::Result { +fn try_identity(_1: Result) -> Result { debug x => _1; // in scope 0 at $DIR/simplify_try.rs:7:17: 7:18 let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:7:41: 7:57 let _2: u32; // in scope 0 at $DIR/simplify_try.rs:8:9: 8:10 @@ -22,7 +22,7 @@ fn try_identity(_1: std::result::Result) -> std::result::Result>::from) { // at $DIR/simplify_try.rs:8:14: 8:15 debug t => ((_0 as Err).0: i32); // in scope 7 at $DIR/simplify_try.rs:8:14: 8:15 } - scope 8 (inlined as Try>::from_error) { // at $DIR/simplify_try.rs:8:13: 8:15 + scope 8 (inlined as Try>::from_error) { // at $DIR/simplify_try.rs:8:13: 8:15 debug v => ((_0 as Err).0: i32); // in scope 8 at $DIR/simplify_try.rs:8:13: 8:15 let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:8:13: 8:15 } @@ -33,7 +33,7 @@ fn try_identity(_1: std::result::Result) -> std::result::Result as Try>::into_result) { // at $DIR/simplify_try.rs:8:13: 8:15 + scope 6 (inlined as Try>::into_result) { // at $DIR/simplify_try.rs:8:13: 8:15 debug self => _4; // in scope 6 at $DIR/simplify_try.rs:8:13: 8:15 } diff --git a/src/test/mir-opt/simplify_try.try_identity.SimplifyLocals.after.mir b/src/test/mir-opt/simplify_try.try_identity.SimplifyLocals.after.mir index 73f77f35a2b92..f8adcced4b306 100644 --- a/src/test/mir-opt/simplify_try.try_identity.SimplifyLocals.after.mir +++ b/src/test/mir-opt/simplify_try.try_identity.SimplifyLocals.after.mir @@ -1,6 +1,6 @@ // MIR for `try_identity` after SimplifyLocals -fn try_identity(_1: std::result::Result) -> std::result::Result { +fn try_identity(_1: Result) -> Result { debug x => _1; // in scope 0 at $DIR/simplify_try.rs:7:17: 7:18 let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:7:41: 7:57 scope 1 { @@ -12,7 +12,7 @@ fn try_identity(_1: std::result::Result) -> std::result::Result>::from) { // at $DIR/simplify_try.rs:8:14: 8:15 debug t => ((_0 as Err).0: i32); // in scope 7 at $DIR/simplify_try.rs:8:14: 8:15 } - scope 8 (inlined as Try>::from_error) { // at $DIR/simplify_try.rs:8:13: 8:15 + scope 8 (inlined as Try>::from_error) { // at $DIR/simplify_try.rs:8:13: 8:15 debug v => ((_0 as Err).0: i32); // in scope 8 at $DIR/simplify_try.rs:8:13: 8:15 } } @@ -22,7 +22,7 @@ fn try_identity(_1: std::result::Result) -> std::result::Result as Try>::into_result) { // at $DIR/simplify_try.rs:8:13: 8:15 + scope 6 (inlined as Try>::into_result) { // at $DIR/simplify_try.rs:8:13: 8:15 debug self => _0; // in scope 6 at $DIR/simplify_try.rs:8:13: 8:15 } diff --git a/src/test/run-make-fulldeps/coverage-spanview/Makefile b/src/test/run-make-fulldeps/coverage-spanview/Makefile index 84b5d0e522f8c..26cf09e0270e5 100644 --- a/src/test/run-make-fulldeps/coverage-spanview/Makefile +++ b/src/test/run-make-fulldeps/coverage-spanview/Makefile @@ -46,6 +46,7 @@ endif echo "--edition=2018" \ ) \ --crate-type rlib \ + -Ztrim-diagnostic-paths=no \ -Zinstrument-coverage \ -Zdump-mir=InstrumentCoverage \ -Zdump-mir-spanview \ @@ -77,6 +78,7 @@ endif echo "--edition=2018" \ ) \ -L "$(TMPDIR)" \ + -Ztrim-diagnostic-paths=no \ -Zinstrument-coverage \ -Zdump-mir=InstrumentCoverage \ -Zdump-mir-spanview \ diff --git a/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr b/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr index dbdfb2e71e0cd..919904ce3b6a2 100644 --- a/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr +++ b/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr @@ -59,22 +59,22 @@ error[E0308]: mismatched types --> $DIR/async-block-control-flow-static-semantics.rs:47:44 | LL | fn rethrow_targets_async_block_not_fn() -> Result { - | ---------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found `()` + | ---------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression | - = note: expected enum `std::result::Result` + = note: expected enum `Result` found unit type `()` error[E0308]: mismatched types --> $DIR/async-block-control-flow-static-semantics.rs:56:50 | LL | fn rethrow_targets_async_block_not_async_fn() -> Result { - | ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found `()` + | ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression | - = note: expected enum `std::result::Result` + = note: expected enum `Result` found unit type `()` error: aborting due to 8 previous errors diff --git a/src/test/ui/async-await/issues/issue-67893.stderr b/src/test/ui/async-await/issues/issue-67893.stderr index af09f0a27bf21..aee2ae0e2e4a8 100644 --- a/src/test/ui/async-await/issues/issue-67893.stderr +++ b/src/test/ui/async-await/issues/issue-67893.stderr @@ -13,9 +13,9 @@ LL | pub async fn run() { | - within this `impl Future` | = help: within `impl Future`, the trait `Send` is not implemented for `MutexGuard<'_, ()>` - = note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3> {ResumeTy, Arc>, &'r Mutex<()>, std::result::Result, PoisonError>>, &'t1 MutexGuard<'t2, ()>, MutexGuard<'t3, ()>, (), impl Future}` - = note: required because it appears within the type `[static generator@run::{closure#0} for<'r, 's, 't0, 't1, 't2, 't3> {ResumeTy, Arc>, &'r Mutex<()>, std::result::Result, PoisonError>>, &'t1 MutexGuard<'t2, ()>, MutexGuard<'t3, ()>, (), impl Future}]` - = note: required because it appears within the type `from_generator::GenFuture<[static generator@run::{closure#0} for<'r, 's, 't0, 't1, 't2, 't3> {ResumeTy, Arc>, &'r Mutex<()>, std::result::Result, PoisonError>>, &'t1 MutexGuard<'t2, ()>, MutexGuard<'t3, ()>, (), impl Future}]>` + = note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3> {ResumeTy, Arc>, &'r Mutex<()>, Result, PoisonError>>, &'t1 MutexGuard<'t2, ()>, MutexGuard<'t3, ()>, (), impl Future}` + = note: required because it appears within the type `[static generator@run::{closure#0} for<'r, 's, 't0, 't1, 't2, 't3> {ResumeTy, Arc>, &'r Mutex<()>, Result, PoisonError>>, &'t1 MutexGuard<'t2, ()>, MutexGuard<'t3, ()>, (), impl Future}]` + = note: required because it appears within the type `from_generator::GenFuture<[static generator@run::{closure#0} for<'r, 's, 't0, 't1, 't2, 't3> {ResumeTy, Arc>, &'r Mutex<()>, Result, PoisonError>>, &'t1 MutexGuard<'t2, ()>, MutexGuard<'t3, ()>, (), impl Future}]>` = note: required because it appears within the type `impl Future` = note: required because it appears within the type `impl Future` diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/fru_syntax.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/fru_syntax.rs new file mode 100644 index 0000000000000..e89cf4550c154 --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/fru_syntax.rs @@ -0,0 +1,46 @@ +// run-pass + +// Test that functional record update/struct update syntax works inside +// a closure when the feature `capture_disjoint_fields` is enabled. + +#![feature(capture_disjoint_fields)] +//~^ WARNING: the feature `capture_disjoint_fields` is incomplete +//~| NOTE: `#[warn(incomplete_features)]` on by default +//~| NOTE: see issue #53488 + +#[derive(Clone)] +struct S { + a: String, + b: String, +} + +struct T { + a: String, + s: S, +} + +fn main() { + let a = String::new(); + let b = String::new(); + let c = String::new(); + let s = S {a, b}; + let t = T { + a: c, + s: s.clone() + }; + + let c = || { + let s2 = S { + a: format!("New s2"), + ..s + }; + let s3 = S { + a: format!("New s3"), + ..t.s + }; + println!("{} {}", s2.a, s2.b); + println!("{} {} {}", s3.a, s3.b, t.a); + }; + + c(); +} diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/fru_syntax.stderr b/src/test/ui/closures/2229_closure_analysis/run_pass/fru_syntax.stderr new file mode 100644 index 0000000000000..7ed73abba8608 --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/fru_syntax.stderr @@ -0,0 +1,11 @@ +warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/fru_syntax.rs:6:12 + | +LL | #![feature(capture_disjoint_fields)] + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + = note: see issue #53488 for more information + +warning: 1 warning emitted + diff --git a/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr b/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr index da8db4331dffb..df1fb58e25a02 100644 --- a/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr +++ b/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr @@ -12,13 +12,13 @@ error[E0308]: mismatched types --> $DIR/coercion-missing-tail-expected-type.rs:8:13 | LL | fn foo() -> Result { - | --- ^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found `()` + | --- ^^^^^^^^^^^^^^^ expected enum `Result`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression LL | Ok(1); | - help: consider removing this semicolon | - = note: expected enum `std::result::Result` + = note: expected enum `Result` found unit type `()` error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/issues/issue-69654-run-pass.rs b/src/test/ui/const-generics/issues/issue-69654-run-pass.rs index bbfd2183b06e3..8c0398e8a13ea 100644 --- a/src/test/ui/const-generics/issues/issue-69654-run-pass.rs +++ b/src/test/ui/const-generics/issues/issue-69654-run-pass.rs @@ -1,4 +1,3 @@ -// run-pass #![feature(const_generics)] #![allow(incomplete_features, unused_braces)] @@ -15,4 +14,5 @@ where fn main() { Foo::foo(); + //~^ ERROR no function or associated item } diff --git a/src/test/ui/const-generics/issues/issue-69654-run-pass.stderr b/src/test/ui/const-generics/issues/issue-69654-run-pass.stderr new file mode 100644 index 0000000000000..a95cc0f2a1c32 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-69654-run-pass.stderr @@ -0,0 +1,15 @@ +error[E0599]: no function or associated item named `foo` found for struct `Foo<{_: usize}>` in the current scope + --> $DIR/issue-69654-run-pass.rs:16:10 + | +LL | struct Foo {} + | -------------------------- function or associated item `foo` not found for this +... +LL | Foo::foo(); + | ^^^ function or associated item not found in `Foo<{_: usize}>` + | + = note: the method `foo` exists but the following trait bounds were not satisfied: + `[u8; _]: Bar<[(); _]>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/const-generics/issues/issue-69654.rs b/src/test/ui/const-generics/issues/issue-69654.rs index 7e775999ebd10..38fca98ad4f06 100644 --- a/src/test/ui/const-generics/issues/issue-69654.rs +++ b/src/test/ui/const-generics/issues/issue-69654.rs @@ -15,4 +15,5 @@ where fn main() { Foo::foo(); + //~^ ERROR no function or associated item } diff --git a/src/test/ui/const-generics/issues/issue-69654.stderr b/src/test/ui/const-generics/issues/issue-69654.stderr index 70af7bf25d849..69cd0806fcd42 100644 --- a/src/test/ui/const-generics/issues/issue-69654.stderr +++ b/src/test/ui/const-generics/issues/issue-69654.stderr @@ -4,6 +4,19 @@ error[E0423]: expected value, found type parameter `T` LL | impl Bar for [u8; T] {} | ^ not a value -error: aborting due to previous error +error[E0599]: no function or associated item named `foo` found for struct `Foo<{_: usize}>` in the current scope + --> $DIR/issue-69654.rs:17:10 + | +LL | struct Foo {} + | -------------------------- function or associated item `foo` not found for this +... +LL | Foo::foo(); + | ^^^ function or associated item not found in `Foo<{_: usize}>` + | + = note: the method `foo` exists but the following trait bounds were not satisfied: + `[u8; _]: Bar<[(); _]>` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0423`. +Some errors have detailed explanations: E0423, E0599. +For more information about an error, try `rustc --explain E0423`. diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-1.rs b/src/test/ui/const-generics/occurs-check/unused-substs-1.rs index f56687ecd9329..6ded9f13bc4fa 100644 --- a/src/test/ui/const-generics/occurs-check/unused-substs-1.rs +++ b/src/test/ui/const-generics/occurs-check/unused-substs-1.rs @@ -1,4 +1,3 @@ -// build-pass #![feature(const_generics)] #![allow(incomplete_features)] @@ -10,5 +9,5 @@ where A: Bar; fn main() { - let _ = A; + let _ = A; //~ERROR the trait bound } diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr b/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr new file mode 100644 index 0000000000000..6830288acc0ad --- /dev/null +++ b/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr @@ -0,0 +1,17 @@ +error[E0277]: the trait bound `A<{_: usize}>: Bar<{_: usize}>` is not satisfied + --> $DIR/unused-substs-1.rs:12:13 + | +LL | / struct A +LL | | where +LL | | A: Bar; + | |_________________- required by `A` +... +LL | let _ = A; + | ^ the trait `Bar<{_: usize}>` is not implemented for `A<{_: usize}>` + | + = help: the following implementations were found: + as Bar> + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-2.rs b/src/test/ui/const-generics/occurs-check/unused-substs-2.rs index 12444ec5312d9..2d00141fbf70b 100644 --- a/src/test/ui/const-generics/occurs-check/unused-substs-2.rs +++ b/src/test/ui/const-generics/occurs-check/unused-substs-2.rs @@ -1,4 +1,3 @@ -// check-pass #![feature(const_generics)] #![allow(incomplete_features)] @@ -24,4 +23,6 @@ fn main() { // `t` is `ty::Infer(TyVar(_#1t))` // `foo` contains `ty::Infer(TyVar(_#1t))` in its substs t = foo; + //~^ ERROR mismatched types + //~| NOTE cyclic type } diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-2.stderr b/src/test/ui/const-generics/occurs-check/unused-substs-2.stderr new file mode 100644 index 0000000000000..9532fc21a31b7 --- /dev/null +++ b/src/test/ui/const-generics/occurs-check/unused-substs-2.stderr @@ -0,0 +1,9 @@ +error[E0308]: mismatched types + --> $DIR/unused-substs-2.rs:25:9 + | +LL | t = foo; + | ^^^ cyclic type of infinite size + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-3.rs b/src/test/ui/const-generics/occurs-check/unused-substs-3.rs index 187e27382fcf2..2e306f8c4c88f 100644 --- a/src/test/ui/const-generics/occurs-check/unused-substs-3.rs +++ b/src/test/ui/const-generics/occurs-check/unused-substs-3.rs @@ -1,4 +1,3 @@ -// check-pass #![feature(const_generics)] #![allow(incomplete_features)] @@ -15,4 +14,6 @@ fn main() { // `t` is `ty::Infer(TyVar(_#1t))` // `foo` contains `ty::Infer(TyVar(_#1t))` in its substs t = foo; + //~^ ERROR mismatched types + //~| NOTE cyclic type } diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-3.stderr b/src/test/ui/const-generics/occurs-check/unused-substs-3.stderr new file mode 100644 index 0000000000000..2551d68f97474 --- /dev/null +++ b/src/test/ui/const-generics/occurs-check/unused-substs-3.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/unused-substs-3.rs:16:9 + | +LL | t = foo; + | ^^^ + | | + | cyclic type of infinite size + | help: try using a conversion method: `foo.to_vec()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-4.rs b/src/test/ui/const-generics/occurs-check/unused-substs-4.rs index 8e42ceb6d70e9..9c7f5ab91edb1 100644 --- a/src/test/ui/const-generics/occurs-check/unused-substs-4.rs +++ b/src/test/ui/const-generics/occurs-check/unused-substs-4.rs @@ -1,4 +1,3 @@ -// build-pass #![feature(const_generics)] #![allow(incomplete_features)] @@ -8,5 +7,5 @@ fn bind(value: [u8; N]) -> [u8; 3 + 4] { fn main() { let mut arr = Default::default(); - arr = bind(arr); + arr = bind(arr); //~ ERROR mismatched type } diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-4.stderr b/src/test/ui/const-generics/occurs-check/unused-substs-4.stderr new file mode 100644 index 0000000000000..5685eedbdeca8 --- /dev/null +++ b/src/test/ui/const-generics/occurs-check/unused-substs-4.stderr @@ -0,0 +1,9 @@ +error[E0308]: mismatched types + --> $DIR/unused-substs-4.rs:10:11 + | +LL | arr = bind(arr); + | ^^^^^^^^^ encountered a self-referencing constant + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr index 055475952340e..e079c2ddcee26 100644 --- a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr +++ b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr @@ -11,7 +11,7 @@ LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html - = note: the matched value is of type `std::result::Result` + = note: the matched value is of type `Result` help: you might want to use `if let` to ignore the variant that isn't matched | LL | if let Ok(_x) = foo() { /* */ } diff --git a/src/test/ui/generator/type-mismatch-signature-deduction.stderr b/src/test/ui/generator/type-mismatch-signature-deduction.stderr index 4abc0542c5142..30e23ea8f650c 100644 --- a/src/test/ui/generator/type-mismatch-signature-deduction.stderr +++ b/src/test/ui/generator/type-mismatch-signature-deduction.stderr @@ -2,11 +2,11 @@ error[E0308]: mismatched types --> $DIR/type-mismatch-signature-deduction.rs:13:9 | LL | 5 - | ^ expected enum `std::result::Result`, found integer + | ^ expected enum `Result`, found integer | - = note: expected type `std::result::Result<{integer}, _>` + = note: expected type `Result<{integer}, _>` found type `{integer}` -note: return type inferred to be `std::result::Result<{integer}, _>` here +note: return type inferred to be `Result<{integer}, _>` here --> $DIR/type-mismatch-signature-deduction.rs:8:20 | LL | return Ok(6); @@ -16,9 +16,9 @@ error[E0271]: type mismatch resolving `<[generator@$DIR/type-mismatch-signature- --> $DIR/type-mismatch-signature-deduction.rs:5:13 | LL | fn foo() -> impl Generator { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found `i32` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Result`, found `i32` | - = note: expected enum `std::result::Result<{integer}, _>` + = note: expected enum `Result<{integer}, _>` found type `i32` error: aborting due to 2 previous errors diff --git a/src/test/ui/generics/wrong-number-of-args.rs b/src/test/ui/generics/wrong-number-of-args.rs index 6b99865202e54..2994ca3c7595c 100644 --- a/src/test/ui/generics/wrong-number-of-args.rs +++ b/src/test/ui/generics/wrong-number-of-args.rs @@ -139,7 +139,7 @@ mod stdlib { mod result { type A = Result; - //~^ ERROR missing generics for enum `std::result::Result` + //~^ ERROR missing generics for enum `Result` //~| HELP use angle brackets type B = Result; diff --git a/src/test/ui/generics/wrong-number-of-args.stderr b/src/test/ui/generics/wrong-number-of-args.stderr index 2a34fba2c4875..73bd76aa5fad0 100644 --- a/src/test/ui/generics/wrong-number-of-args.stderr +++ b/src/test/ui/generics/wrong-number-of-args.stderr @@ -365,7 +365,7 @@ note: struct defined here, with at most 3 type parameters: `K`, `V`, `S` LL | pub struct HashMap { | ^^^^^^^ - - - -error[E0107]: missing generics for enum `std::result::Result` +error[E0107]: missing generics for enum `Result` --> $DIR/wrong-number-of-args.rs:141:18 | LL | type A = Result; diff --git a/src/test/ui/impl-trait/trait_type.stderr b/src/test/ui/impl-trait/trait_type.stderr index e94f2c702150a..961bb7351181e 100644 --- a/src/test/ui/impl-trait/trait_type.stderr +++ b/src/test/ui/impl-trait/trait_type.stderr @@ -4,7 +4,7 @@ error[E0053]: method `fmt` has an incompatible type for trait LL | fn fmt(&self, x: &str) -> () { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability | - = note: expected fn pointer `fn(&MyType, &mut Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` + = note: expected fn pointer `fn(&MyType, &mut Formatter<'_>) -> Result<(), std::fmt::Error>` found fn pointer `fn(&MyType, &str)` error[E0050]: method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2 @@ -13,7 +13,7 @@ error[E0050]: method `fmt` has 1 parameter but the declaration in trait `std::fm LL | fn fmt(&self) -> () { } | ^^^^^ expected 2 parameters, found 1 | - = note: `fmt` from trait: `fn(&Self, &mut Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` + = note: `fmt` from trait: `fn(&Self, &mut Formatter<'_>) -> Result<(), std::fmt::Error>` error[E0186]: method `fmt` has a `&self` declaration in the trait, but not in the impl --> $DIR/trait_type.rs:17:4 @@ -21,7 +21,7 @@ error[E0186]: method `fmt` has a `&self` declaration in the trait, but not in th LL | fn fmt() -> () { } | ^^^^^^^^^^^^^^ expected `&self` in impl | - = note: `fmt` from trait: `fn(&Self, &mut Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` + = note: `fmt` from trait: `fn(&Self, &mut Formatter<'_>) -> Result<(), std::fmt::Error>` error[E0046]: not all trait items implemented, missing: `fmt` --> $DIR/trait_type.rs:21:1 @@ -29,7 +29,7 @@ error[E0046]: not all trait items implemented, missing: `fmt` LL | impl std::fmt::Display for MyType4 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation | - = help: implement the missing item: `fn fmt(&self, _: &mut Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { todo!() }` + = help: implement the missing item: `fn fmt(&self, _: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { todo!() }` error: aborting due to 4 previous errors diff --git a/src/test/ui/inference/cannot-infer-closure-circular.stderr b/src/test/ui/inference/cannot-infer-closure-circular.stderr index 5efb400a4c7a5..211ae13e46df1 100644 --- a/src/test/ui/inference/cannot-infer-closure-circular.stderr +++ b/src/test/ui/inference/cannot-infer-closure-circular.stderr @@ -1,8 +1,8 @@ -error[E0282]: type annotations needed for `std::result::Result<(), E>` +error[E0282]: type annotations needed for `Result<(), E>` --> $DIR/cannot-infer-closure-circular.rs:7:14 | LL | let x = |r| { - | ^ consider giving this closure parameter the explicit type `std::result::Result<(), E>`, with the type parameters specified + | ^ consider giving this closure parameter the explicit type `Result<(), E>`, with the type parameters specified error: aborting due to previous error diff --git a/src/test/ui/inference/cannot-infer-closure.stderr b/src/test/ui/inference/cannot-infer-closure.stderr index 475ed00d10752..0dcce9e990b53 100644 --- a/src/test/ui/inference/cannot-infer-closure.stderr +++ b/src/test/ui/inference/cannot-infer-closure.stderr @@ -1,4 +1,4 @@ -error[E0282]: type annotations needed for the closure `fn((), ()) -> std::result::Result<(), _>` +error[E0282]: type annotations needed for the closure `fn((), ()) -> Result<(), _>` --> $DIR/cannot-infer-closure.rs:3:15 | LL | Err(a)?; @@ -7,8 +7,8 @@ LL | Err(a)?; = note: `?` implicitly converts the error value into a type implementing `From<()>` help: give this closure an explicit return type without `_` placeholders | -LL | let x = |a: (), b: ()| -> std::result::Result<(), _> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let x = |a: (), b: ()| -> Result<(), _> { + | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/inference/cannot-infer-partial-try-return.stderr b/src/test/ui/inference/cannot-infer-partial-try-return.stderr index a64503fa667c7..86e2126e1ae7b 100644 --- a/src/test/ui/inference/cannot-infer-partial-try-return.stderr +++ b/src/test/ui/inference/cannot-infer-partial-try-return.stderr @@ -1,4 +1,4 @@ -error[E0282]: type annotations needed for the closure `fn() -> std::result::Result<(), QualifiedError<_>>` +error[E0282]: type annotations needed for the closure `fn() -> Result<(), QualifiedError<_>>` --> $DIR/cannot-infer-partial-try-return.rs:19:9 | LL | infallible()?; @@ -7,8 +7,8 @@ LL | infallible()?; = note: `?` implicitly converts the error value into `QualifiedError<_>` using its implementation of `From` help: give this closure an explicit return type without `_` placeholders | -LL | let x = || -> std::result::Result<(), QualifiedError<_>> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let x = || -> Result<(), QualifiedError<_>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/inference/issue-72616.stderr b/src/test/ui/inference/issue-72616.stderr index d811988c9c1d0..3c9d864c42639 100644 --- a/src/test/ui/inference/issue-72616.stderr +++ b/src/test/ui/inference/issue-72616.stderr @@ -2,7 +2,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72616.rs:20:30 | LL | if String::from("a") == "a".try_into().unwrap() {} - | ^^ -------------- this method call resolves to `std::result::Result>::Error>` + | ^^ -------------- this method call resolves to `Result>::Error>` | | | cannot infer type | diff --git a/src/test/ui/issue-74047.stderr b/src/test/ui/issue-74047.stderr index 8f7c91a78d8c0..28174825d8bce 100644 --- a/src/test/ui/issue-74047.stderr +++ b/src/test/ui/issue-74047.stderr @@ -5,7 +5,7 @@ LL | impl TryFrom for MyStream {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Error`, `try_from` in implementation | = help: implement the missing item: `type Error = Type;` - = help: implement the missing item: `fn try_from(_: T) -> std::result::Result>::Error> { todo!() }` + = help: implement the missing item: `fn try_from(_: T) -> Result>::Error> { todo!() }` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-11844.stderr b/src/test/ui/issues/issue-11844.stderr index 00eecbc9a98b6..9d7470e7af9aa 100644 --- a/src/test/ui/issues/issue-11844.stderr +++ b/src/test/ui/issues/issue-11844.stderr @@ -4,10 +4,10 @@ error[E0308]: mismatched types LL | match a { | - this expression has type `Option>` LL | Ok(a) => - | ^^^^^ expected enum `Option`, found enum `std::result::Result` + | ^^^^^ expected enum `Option`, found enum `Result` | = note: expected enum `Option>` - found enum `std::result::Result<_, _>` + found enum `Result<_, _>` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-12552.stderr b/src/test/ui/issues/issue-12552.stderr index 1594c9f503a18..3d8852ca748af 100644 --- a/src/test/ui/issues/issue-12552.stderr +++ b/src/test/ui/issues/issue-12552.stderr @@ -2,23 +2,23 @@ error[E0308]: mismatched types --> $DIR/issue-12552.rs:6:5 | LL | match t { - | - this expression has type `std::result::Result<_, {integer}>` + | - this expression has type `Result<_, {integer}>` LL | Some(k) => match k { - | ^^^^^^^ expected enum `std::result::Result`, found enum `Option` + | ^^^^^^^ expected enum `Result`, found enum `Option` | - = note: expected enum `std::result::Result<_, {integer}>` + = note: expected enum `Result<_, {integer}>` found enum `Option<_>` error[E0308]: mismatched types --> $DIR/issue-12552.rs:9:5 | LL | match t { - | - this expression has type `std::result::Result<_, {integer}>` + | - this expression has type `Result<_, {integer}>` ... LL | None => () - | ^^^^ expected enum `std::result::Result`, found enum `Option` + | ^^^^ expected enum `Result`, found enum `Option` | - = note: expected enum `std::result::Result<_, {integer}>` + = note: expected enum `Result<_, {integer}>` found enum `Option<_>` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-13466.rs b/src/test/ui/issues/issue-13466.rs index 8048dae123994..a420c7704af51 100644 --- a/src/test/ui/issues/issue-13466.rs +++ b/src/test/ui/issues/issue-13466.rs @@ -8,13 +8,13 @@ pub fn main() { Ok(u) => u, //~^ ERROR mismatched types //~| expected enum `Option<{integer}>` - //~| found enum `std::result::Result<_, _>` - //~| expected enum `Option`, found enum `std::result::Result` + //~| found enum `Result<_, _>` + //~| expected enum `Option`, found enum `Result` Err(e) => panic!(e) //~^ ERROR mismatched types //~| expected enum `Option<{integer}>` - //~| found enum `std::result::Result<_, _>` - //~| expected enum `Option`, found enum `std::result::Result` + //~| found enum `Result<_, _>` + //~| expected enum `Option`, found enum `Result` }; } diff --git a/src/test/ui/issues/issue-13466.stderr b/src/test/ui/issues/issue-13466.stderr index 792cc398bb86b..c78466f4e8ce1 100644 --- a/src/test/ui/issues/issue-13466.stderr +++ b/src/test/ui/issues/issue-13466.stderr @@ -4,10 +4,10 @@ error[E0308]: mismatched types LL | let _x: usize = match Some(1) { | ------- this expression has type `Option<{integer}>` LL | Ok(u) => u, - | ^^^^^ expected enum `Option`, found enum `std::result::Result` + | ^^^^^ expected enum `Option`, found enum `Result` | = note: expected enum `Option<{integer}>` - found enum `std::result::Result<_, _>` + found enum `Result<_, _>` error[E0308]: mismatched types --> $DIR/issue-13466.rs:14:9 @@ -16,10 +16,10 @@ LL | let _x: usize = match Some(1) { | ------- this expression has type `Option<{integer}>` ... LL | Err(e) => panic!(e) - | ^^^^^^ expected enum `Option`, found enum `std::result::Result` + | ^^^^^^ expected enum `Option`, found enum `Result` | = note: expected enum `Option<{integer}>` - found enum `std::result::Result<_, _>` + found enum `Result<_, _>` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-21332.rs b/src/test/ui/issues/issue-21332.rs index 1b13f000b8c8c..6547f3a9b19ae 100644 --- a/src/test/ui/issues/issue-21332.rs +++ b/src/test/ui/issues/issue-21332.rs @@ -4,7 +4,7 @@ impl Iterator for S { type Item = i32; fn next(&mut self) -> Result { Ok(7) } //~^ ERROR method `next` has an incompatible type for trait - //~| expected enum `Option`, found enum `std::result::Result` + //~| expected enum `Option`, found enum `Result` } fn main() {} diff --git a/src/test/ui/issues/issue-21332.stderr b/src/test/ui/issues/issue-21332.stderr index 1d6ddd2660ec2..35863fbebe315 100644 --- a/src/test/ui/issues/issue-21332.stderr +++ b/src/test/ui/issues/issue-21332.stderr @@ -2,10 +2,10 @@ error[E0053]: method `next` has an incompatible type for trait --> $DIR/issue-21332.rs:5:5 | LL | fn next(&mut self) -> Result { Ok(7) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Option`, found enum `std::result::Result` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Option`, found enum `Result` | = note: expected fn pointer `fn(&mut S) -> Option` - found fn pointer `fn(&mut S) -> std::result::Result` + found fn pointer `fn(&mut S) -> Result` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3680.rs b/src/test/ui/issues/issue-3680.rs index 8912e7a18ac3b..37c9000c043da 100644 --- a/src/test/ui/issues/issue-3680.rs +++ b/src/test/ui/issues/issue-3680.rs @@ -3,7 +3,7 @@ fn main() { Err(_) => () //~^ ERROR mismatched types //~| expected enum `Option<_>` - //~| found enum `std::result::Result<_, _>` - //~| expected enum `Option`, found enum `std::result::Result` + //~| found enum `Result<_, _>` + //~| expected enum `Option`, found enum `Result` } } diff --git a/src/test/ui/issues/issue-3680.stderr b/src/test/ui/issues/issue-3680.stderr index 479942b8e2c5f..e8fafa76b919b 100644 --- a/src/test/ui/issues/issue-3680.stderr +++ b/src/test/ui/issues/issue-3680.stderr @@ -4,10 +4,10 @@ error[E0308]: mismatched types LL | match None { | ---- this expression has type `Option<_>` LL | Err(_) => () - | ^^^^^^ expected enum `Option`, found enum `std::result::Result` + | ^^^^^^ expected enum `Option`, found enum `Result` | = note: expected enum `Option<_>` - found enum `std::result::Result<_, _>` + found enum `Result<_, _>` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr index e41c04ee89e0f..9711e27d8a8a3 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr @@ -1,4 +1,4 @@ -error[E0599]: the method `as_deref` exists for enum `std::result::Result<{integer}, _>`, but its trait bounds were not satisfied +error[E0599]: the method `as_deref` exists for enum `Result<{integer}, _>`, but its trait bounds were not satisfied --> $DIR/result-as_deref.rs:2:27 | LL | let _result = &Ok(42).as_deref(); diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr index 372d056fc1908..ee7ea1e6a0229 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr @@ -1,8 +1,8 @@ -error[E0599]: the method `as_deref_mut` exists for enum `std::result::Result<{integer}, _>`, but its trait bounds were not satisfied +error[E0599]: the method `as_deref_mut` exists for enum `Result<{integer}, _>`, but its trait bounds were not satisfied --> $DIR/result-as_deref_mut.rs:2:31 | LL | let _result = &mut Ok(42).as_deref_mut(); - | ^^^^^^^^^^^^ method cannot be called on `std::result::Result<{integer}, _>` due to unsatisfied trait bounds + | ^^^^^^^^^^^^ method cannot be called on `Result<{integer}, _>` due to unsatisfied trait bounds | = note: the following trait bounds were not satisfied: `{integer}: DerefMut` diff --git a/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr index 9ca983df30af5..554ac7e7c75fc 100644 --- a/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr +++ b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr @@ -2,9 +2,9 @@ error[E0308]: try expression alternatives have incompatible types --> $DIR/issue-51632-try-desugar-incompatible-types.rs:8:5 | LL | missing_discourses()? - | ^^^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found `isize` + | ^^^^^^^^^^^^^^^^^^^^^ expected enum `Result`, found `isize` | - = note: expected enum `std::result::Result` + = note: expected enum `Result` found type `isize` help: try removing this `?` | diff --git a/src/test/ui/issues/issue-6458-4.stderr b/src/test/ui/issues/issue-6458-4.stderr index 00ebff9007ded..0cf82d37d5d0b 100644 --- a/src/test/ui/issues/issue-6458-4.stderr +++ b/src/test/ui/issues/issue-6458-4.stderr @@ -2,13 +2,13 @@ error[E0308]: mismatched types --> $DIR/issue-6458-4.rs:1:20 | LL | fn foo(b: bool) -> Result { - | --- ^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found `()` + | --- ^^^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression LL | Err("bar".to_string()); | - help: consider removing this semicolon | - = note: expected enum `std::result::Result` + = note: expected enum `Result` found unit type `()` error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr index c3d597bec2e40..ef1127c59ac4c 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `std::result::Result<(), _>: Future` is not satisfied +error[E0277]: the trait bound `Result<(), _>: Future` is not satisfied --> $DIR/lifetime-elision-return-type-trait.rs:8:13 | LL | fn foo() -> impl Future> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Future` is not implemented for `std::result::Result<(), _>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Future` is not implemented for `Result<(), _>` error: aborting due to previous error diff --git a/src/test/ui/lint/lint-ctypes-enum.stderr b/src/test/ui/lint/lint-ctypes-enum.stderr index 8917d309e6087..f3991ab417752 100644 --- a/src/test/ui/lint/lint-ctypes-enum.stderr +++ b/src/test/ui/lint/lint-ctypes-enum.stderr @@ -97,7 +97,7 @@ LL | fn repr_rust(x: Option>); = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint -error: `extern` block uses type `std::result::Result<(), NonZeroI32>`, which is not FFI-safe +error: `extern` block uses type `Result<(), NonZeroI32>`, which is not FFI-safe --> $DIR/lint-ctypes-enum.rs:90:20 | LL | fn no_result(x: Result<(), num::NonZeroI32>); diff --git a/src/test/ui/lint/must_use-tuple.rs b/src/test/ui/lint/must_use-tuple.rs index f6b579a7f35cf..0f0aa20253c96 100644 --- a/src/test/ui/lint/must_use-tuple.rs +++ b/src/test/ui/lint/must_use-tuple.rs @@ -5,13 +5,13 @@ fn foo() -> (Result<(), ()>, ()) { } fn main() { - (Ok::<(), ()>(()),); //~ ERROR unused `std::result::Result` + (Ok::<(), ()>(()),); //~ ERROR unused `Result` (Ok::<(), ()>(()), 0, Ok::<(), ()>(()), 5); - //~^ ERROR unused `std::result::Result` - //~^^ ERROR unused `std::result::Result` + //~^ ERROR unused `Result` + //~^^ ERROR unused `Result` - foo(); //~ ERROR unused `std::result::Result` + foo(); //~ ERROR unused `Result` - ((Err::<(), ()>(()), ()), ()); //~ ERROR unused `std::result::Result` + ((Err::<(), ()>(()), ()), ()); //~ ERROR unused `Result` } diff --git a/src/test/ui/lint/must_use-tuple.stderr b/src/test/ui/lint/must_use-tuple.stderr index de3c6f46c6867..0532d89e039eb 100644 --- a/src/test/ui/lint/must_use-tuple.stderr +++ b/src/test/ui/lint/must_use-tuple.stderr @@ -1,4 +1,4 @@ -error: unused `std::result::Result` in tuple element 0 that must be used +error: unused `Result` in tuple element 0 that must be used --> $DIR/must_use-tuple.rs:8:6 | LL | (Ok::<(), ()>(()),); @@ -11,7 +11,7 @@ LL | #![deny(unused_must_use)] | ^^^^^^^^^^^^^^^ = note: this `Result` may be an `Err` variant, which should be handled -error: unused `std::result::Result` in tuple element 0 that must be used +error: unused `Result` in tuple element 0 that must be used --> $DIR/must_use-tuple.rs:10:6 | LL | (Ok::<(), ()>(()), 0, Ok::<(), ()>(()), 5); @@ -19,7 +19,7 @@ LL | (Ok::<(), ()>(()), 0, Ok::<(), ()>(()), 5); | = note: this `Result` may be an `Err` variant, which should be handled -error: unused `std::result::Result` in tuple element 2 that must be used +error: unused `Result` in tuple element 2 that must be used --> $DIR/must_use-tuple.rs:10:27 | LL | (Ok::<(), ()>(()), 0, Ok::<(), ()>(()), 5); @@ -27,7 +27,7 @@ LL | (Ok::<(), ()>(()), 0, Ok::<(), ()>(()), 5); | = note: this `Result` may be an `Err` variant, which should be handled -error: unused `std::result::Result` in tuple element 0 that must be used +error: unused `Result` in tuple element 0 that must be used --> $DIR/must_use-tuple.rs:14:5 | LL | foo(); @@ -35,7 +35,7 @@ LL | foo(); | = note: this `Result` may be an `Err` variant, which should be handled -error: unused `std::result::Result` in tuple element 0 that must be used +error: unused `Result` in tuple element 0 that must be used --> $DIR/must_use-tuple.rs:16:6 | LL | ((Err::<(), ()>(()), ()), ()); diff --git a/src/test/ui/macros/must-use-in-macro-55516.stderr b/src/test/ui/macros/must-use-in-macro-55516.stderr index a694c887085f0..b4072a1ad7e57 100644 --- a/src/test/ui/macros/must-use-in-macro-55516.stderr +++ b/src/test/ui/macros/must-use-in-macro-55516.stderr @@ -1,4 +1,4 @@ -warning: unused `std::result::Result` that must be used +warning: unused `Result` that must be used --> $DIR/must-use-in-macro-55516.rs:9:5 | LL | write!(&mut example, "{}", 42); diff --git a/src/test/ui/mismatched_types/abridged.stderr b/src/test/ui/mismatched_types/abridged.stderr index b7564686cd52e..61994e5bfee2e 100644 --- a/src/test/ui/mismatched_types/abridged.stderr +++ b/src/test/ui/mismatched_types/abridged.stderr @@ -15,10 +15,10 @@ error[E0308]: mismatched types LL | fn a2() -> Foo { | --- expected `Foo` because of return type LL | Ok(Foo { bar: 1}) - | ^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `std::result::Result` + | ^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `Result` | = note: expected struct `Foo` - found enum `std::result::Result` + found enum `Result` error[E0308]: mismatched types --> $DIR/abridged.rs:24:5 @@ -38,14 +38,14 @@ error[E0308]: mismatched types --> $DIR/abridged.rs:28:5 | LL | fn c() -> Result { - | ---------------- expected `std::result::Result` because of return type + | ---------------- expected `Result` because of return type LL | Foo { bar: 1 } | ^^^^^^^^^^^^^^ | | - | expected enum `std::result::Result`, found struct `Foo` + | expected enum `Result`, found struct `Foo` | help: try using a variant of the expected enum: `Ok(Foo { bar: 1 })` | - = note: expected enum `std::result::Result` + = note: expected enum `Result` found struct `Foo` error[E0308]: mismatched types diff --git a/src/test/ui/mismatched_types/binops.rs b/src/test/ui/mismatched_types/binops.rs index 4be7420e33c17..f359451dfb8f9 100644 --- a/src/test/ui/mismatched_types/binops.rs +++ b/src/test/ui/mismatched_types/binops.rs @@ -4,5 +4,5 @@ fn main() { 3 * (); //~ ERROR cannot multiply `{integer}` by `()` 4 / ""; //~ ERROR cannot divide `{integer}` by `&str` 5 < String::new(); //~ ERROR can't compare `{integer}` with `String` - 6 == Ok(1); //~ ERROR can't compare `{integer}` with `std::result::Result<{integer}, _>` + 6 == Ok(1); //~ ERROR can't compare `{integer}` with `Result<{integer}, _>` } diff --git a/src/test/ui/mismatched_types/binops.stderr b/src/test/ui/mismatched_types/binops.stderr index f2bfb12ee9c80..19e921dd04d73 100644 --- a/src/test/ui/mismatched_types/binops.stderr +++ b/src/test/ui/mismatched_types/binops.stderr @@ -38,13 +38,13 @@ LL | 5 < String::new(); | = help: the trait `PartialOrd` is not implemented for `{integer}` -error[E0277]: can't compare `{integer}` with `std::result::Result<{integer}, _>` +error[E0277]: can't compare `{integer}` with `Result<{integer}, _>` --> $DIR/binops.rs:7:7 | LL | 6 == Ok(1); - | ^^ no implementation for `{integer} == std::result::Result<{integer}, _>` + | ^^ no implementation for `{integer} == Result<{integer}, _>` | - = help: the trait `PartialEq>` is not implemented for `{integer}` + = help: the trait `PartialEq>` is not implemented for `{integer}` error: aborting due to 6 previous errors diff --git a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr index 92a88cbdb34a3..1030061b2d1fe 100644 --- a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr +++ b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr @@ -1,11 +1,11 @@ -error[E0599]: the method `unwrap` exists for enum `std::result::Result<(), Foo>`, but its trait bounds were not satisfied +error[E0599]: the method `unwrap` exists for enum `Result<(), Foo>`, but its trait bounds were not satisfied --> $DIR/method-help-unsatisfied-bound.rs:5:7 | LL | struct Foo; | ----------- doesn't satisfy `Foo: Debug` ... LL | a.unwrap(); - | ^^^^^^ method cannot be called on `std::result::Result<(), Foo>` due to unsatisfied trait bounds + | ^^^^^^ method cannot be called on `Result<(), Foo>` due to unsatisfied trait bounds | = note: the following trait bounds were not satisfied: `Foo: Debug` diff --git a/src/test/ui/nll/issue-54556-niconii.stderr b/src/test/ui/nll/issue-54556-niconii.stderr index b4791fd22b4ad..1bfebd755b4fc 100644 --- a/src/test/ui/nll/issue-54556-niconii.stderr +++ b/src/test/ui/nll/issue-54556-niconii.stderr @@ -11,7 +11,7 @@ LL | } | - | | | `counter` dropped here while still borrowed - | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::result::Result, ()>` + | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `Result, ()>` | help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped | diff --git a/src/test/ui/or-patterns/inconsistent-modes.stderr b/src/test/ui/or-patterns/inconsistent-modes.stderr index c5dcef36e0580..15790771043df 100644 --- a/src/test/ui/or-patterns/inconsistent-modes.stderr +++ b/src/test/ui/or-patterns/inconsistent-modes.stderr @@ -65,7 +65,7 @@ error[E0308]: mismatched types --> $DIR/inconsistent-modes.rs:14:31 | LL | let Ok((ref a, b)) | Err((ref mut a, ref b)) = Ok((0, &0)); - | ----- ^^^^^^^^^ ----------- this expression has type `std::result::Result<({integer}, &{integer}), (_, _)>` + | ----- ^^^^^^^^^ ----------- this expression has type `Result<({integer}, &{integer}), (_, _)>` | | | | | types differ in mutability | first introduced with type `&{integer}` here diff --git a/src/test/ui/parser/unclosed-delimiter-in-dep.stderr b/src/test/ui/parser/unclosed-delimiter-in-dep.stderr index d63a50034c58d..00861a5a3d49a 100644 --- a/src/test/ui/parser/unclosed-delimiter-in-dep.stderr +++ b/src/test/ui/parser/unclosed-delimiter-in-dep.stderr @@ -13,12 +13,12 @@ error[E0308]: mismatched types --> $DIR/unclosed-delimiter-in-dep.rs:4:20 | LL | let _: usize = unclosed_delim_mod::new(); - | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found enum `std::result::Result` + | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found enum `Result` | | | expected due to this | = note: expected type `usize` - found enum `std::result::Result` + found enum `Result` error: aborting due to 2 previous errors diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.stderr index bfb7b479731a6..ff8183e87635f 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.stderr @@ -33,7 +33,7 @@ error[E0382]: use of moved value --> $DIR/borrowck-move-and-move.rs:20:16 | LL | match Ok(U) { - | ----- move occurs because value has type `std::result::Result`, which does not implement the `Copy` trait + | ----- move occurs because value has type `Result`, which does not implement the `Copy` trait LL | a @ Ok(b) | a @ Err(b) => {} | -------^- | | | @@ -44,7 +44,7 @@ error[E0382]: use of moved value --> $DIR/borrowck-move-and-move.rs:20:29 | LL | match Ok(U) { - | ----- move occurs because value has type `std::result::Result`, which does not implement the `Copy` trait + | ----- move occurs because value has type `Result`, which does not implement the `Copy` trait LL | a @ Ok(b) | a @ Err(b) => {} | --------^- | | | diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr index 00136c2576423..13032c3838a92 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr @@ -390,7 +390,7 @@ error[E0507]: cannot move out of `a` in pattern guard --> $DIR/borrowck-pat-ref-mut-and-ref.rs:111:66 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} - | ^ move occurs because `a` has type `&mut std::result::Result`, which does not implement the `Copy` trait + | ^ move occurs because `a` has type `&mut Result`, which does not implement the `Copy` trait | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard @@ -398,7 +398,7 @@ error[E0507]: cannot move out of `a` in pattern guard --> $DIR/borrowck-pat-ref-mut-and-ref.rs:111:66 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} - | ^ move occurs because `a` has type `&mut std::result::Result`, which does not implement the `Copy` trait + | ^ move occurs because `a` has type `&mut Result`, which does not implement the `Copy` trait | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard diff --git a/src/test/ui/pattern/pat-struct-field-expr-has-type.stderr b/src/test/ui/pattern/pat-struct-field-expr-has-type.stderr index d57a8a0dbc181..3a61d4293b01d 100644 --- a/src/test/ui/pattern/pat-struct-field-expr-has-type.stderr +++ b/src/test/ui/pattern/pat-struct-field-expr-has-type.stderr @@ -4,10 +4,10 @@ error[E0308]: mismatched types LL | match (S { f: 42 }) { | ------------- this expression has type `S` LL | S { f: Ok(_) } => {} - | ^^^^^ expected `u8`, found enum `std::result::Result` + | ^^^^^ expected `u8`, found enum `Result` | = note: expected type `u8` - found enum `std::result::Result<_, _>` + found enum `Result<_, _>` error: aborting due to previous error diff --git a/src/test/ui/pattern/pat-type-err-let-stmt.stderr b/src/test/ui/pattern/pat-type-err-let-stmt.stderr index 42258cfc1aef5..4b4fb08928327 100644 --- a/src/test/ui/pattern/pat-type-err-let-stmt.stderr +++ b/src/test/ui/pattern/pat-type-err-let-stmt.stderr @@ -17,10 +17,10 @@ error[E0308]: mismatched types LL | let Ok(0): Option = 42u8; | ^^^^^ ---------- expected due to this | | - | expected enum `Option`, found enum `std::result::Result` + | expected enum `Option`, found enum `Result` | = note: expected enum `Option` - found enum `std::result::Result<_, _>` + found enum `Result<_, _>` error[E0308]: mismatched types --> $DIR/pat-type-err-let-stmt.rs:11:9 @@ -28,10 +28,10 @@ error[E0308]: mismatched types LL | let Ok(0): Option; | ^^^^^ ---------- expected due to this | | - | expected enum `Option`, found enum `std::result::Result` + | expected enum `Option`, found enum `Result` | = note: expected enum `Option` - found enum `std::result::Result<_, _>` + found enum `Result<_, _>` error[E0308]: mismatched types --> $DIR/pat-type-err-let-stmt.rs:15:9 @@ -39,10 +39,10 @@ error[E0308]: mismatched types LL | let Ok(0) = 42u8; | ^^^^^ ---- this expression has type `u8` | | - | expected `u8`, found enum `std::result::Result` + | expected `u8`, found enum `Result` | = note: expected type `u8` - found enum `std::result::Result<_, _>` + found enum `Result<_, _>` error: aborting due to 4 previous errors diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr index d1cab75210296..928e9068266cd 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr @@ -5,7 +5,7 @@ LL | match (l1, l2) { | ^^^^^^^^ pattern `(Some(&[]), Err(_))` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - = note: the matched value is of type `(Option<&[T]>, std::result::Result<&[T], ()>)` + = note: the matched value is of type `(Option<&[T]>, Result<&[T], ()>)` error[E0004]: non-exhaustive patterns: `A(C)` not covered --> $DIR/non-exhaustive-match-nested.rs:15:11 diff --git a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr index c6f500ec8cc78..dfb69a3cc1b42 100644 --- a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr +++ b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr @@ -11,7 +11,7 @@ LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html - = note: the matched value is of type `std::result::Result` + = note: the matched value is of type `Result` help: you might want to use `if let` to ignore the variant that isn't matched | LL | if let Ok(x) = res { /* */ } diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr index d015b72c5cffe..4580620186197 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr @@ -1,4 +1,4 @@ -error[E0277]: `main` has invalid return type `std::result::Result` +error[E0277]: `main` has invalid return type `Result` --> $DIR/termination-trait-test-wrong-type.rs:6:1 | LL | / fn can_parse_zero_as_f32() -> Result { @@ -11,7 +11,7 @@ LL | | } LL | pub fn assert_test_result(result: T) { | ----------- required by this bound in `assert_test_result` | - = help: the trait `Termination` is not implemented for `std::result::Result` + = help: the trait `Termination` is not implemented for `Result` = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/rfc-2294-if-let-guard/typeck.stderr b/src/test/ui/rfc-2294-if-let-guard/typeck.stderr index 7ce93fe7348fd..6407128d8d877 100644 --- a/src/test/ui/rfc-2294-if-let-guard/typeck.stderr +++ b/src/test/ui/rfc-2294-if-let-guard/typeck.stderr @@ -2,10 +2,10 @@ error[E0308]: mismatched types --> $DIR/typeck.rs:10:22 | LL | Ok(x) if let Err(_) = x => {}, - | ^^^^^^ expected enum `Option`, found enum `std::result::Result` + | ^^^^^^ expected enum `Option`, found enum `Result` | = note: expected enum `Option` - found enum `std::result::Result<_, _>` + found enum `Result<_, _>` error[E0308]: mismatched types --> $DIR/typeck.rs:12:22 diff --git a/src/test/ui/span/impl-wrong-item-for-trait.stderr b/src/test/ui/span/impl-wrong-item-for-trait.stderr index 9b0aad28b0a33..de200ca0721ca 100644 --- a/src/test/ui/span/impl-wrong-item-for-trait.stderr +++ b/src/test/ui/span/impl-wrong-item-for-trait.stderr @@ -64,7 +64,7 @@ error[E0046]: not all trait items implemented, missing: `fmt` LL | impl Debug for FooTypeForMethod { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation | - = help: implement the missing item: `fn fmt(&self, _: &mut Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { todo!() }` + = help: implement the missing item: `fn fmt(&self, _: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { todo!() }` error: aborting due to 8 previous errors diff --git a/src/test/ui/suggestions/as-ref.stderr b/src/test/ui/suggestions/as-ref.stderr index 4b5a9be7e5b4d..7e4d7fb3933d3 100644 --- a/src/test/ui/suggestions/as-ref.stderr +++ b/src/test/ui/suggestions/as-ref.stderr @@ -47,12 +47,12 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:19:35 | LL | let y: Result<&usize, &usize> = x; - | ---------------------- ^ expected enum `std::result::Result`, found reference + | ---------------------- ^ expected enum `Result`, found reference | | | expected due to this | - = note: expected enum `std::result::Result<&usize, &usize>` - found reference `&std::result::Result` + = note: expected enum `Result<&usize, &usize>` + found reference `&Result` help: you can convert from `&Result` to `Result<&T, &E>` using `.as_ref()` | LL | let y: Result<&usize, &usize> = x.as_ref(); @@ -62,12 +62,12 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:23:34 | LL | let y: Result<&usize, usize> = x; - | --------------------- ^ expected enum `std::result::Result`, found reference + | --------------------- ^ expected enum `Result`, found reference | | | expected due to this | - = note: expected enum `std::result::Result<&usize, usize>` - found reference `&std::result::Result` + = note: expected enum `Result<&usize, usize>` + found reference `&Result` error: aborting due to 7 previous errors diff --git a/src/test/ui/suggestions/mut-ref-reassignment.stderr b/src/test/ui/suggestions/mut-ref-reassignment.stderr index e31c4dc66c805..327bbee1968bf 100644 --- a/src/test/ui/suggestions/mut-ref-reassignment.stderr +++ b/src/test/ui/suggestions/mut-ref-reassignment.stderr @@ -17,7 +17,7 @@ error[E0308]: mismatched types LL | opt = None | ^^^^ expected mutable reference, found enum `Option` | - = note: expected mutable reference `&mut std::result::Result` + = note: expected mutable reference `&mut Result` found enum `Option<_>` error[E0308]: mismatched types diff --git a/src/test/ui/suggestions/option-content-move.stderr b/src/test/ui/suggestions/option-content-move.stderr index 0f3dd346e856a..c00a0f1700bb4 100644 --- a/src/test/ui/suggestions/option-content-move.stderr +++ b/src/test/ui/suggestions/option-content-move.stderr @@ -13,7 +13,7 @@ error[E0507]: cannot move out of `selection.1` which is behind a shared referenc LL | if selection.1.unwrap().contains(selection.0) { | ^^^^^^^^^^^ | | - | move occurs because `selection.1` has type `std::result::Result`, which does not implement the `Copy` trait + | move occurs because `selection.1` has type `Result`, which does not implement the `Copy` trait | help: consider borrowing the `Result`'s content: `selection.1.as_ref()` error: aborting due to 2 previous errors diff --git a/src/test/ui/suggestions/suggest-box.stderr b/src/test/ui/suggestions/suggest-box.stderr index 57c83baf4f831..8107fd862122a 100644 --- a/src/test/ui/suggestions/suggest-box.stderr +++ b/src/test/ui/suggestions/suggest-box.stderr @@ -10,7 +10,7 @@ LL | | Ok(()) LL | | }; | |_____^ expected struct `Box`, found closure | - = note: expected struct `Box std::result::Result<(), ()>>` + = note: expected struct `Box Result<(), ()>>` found closure `[closure@$DIR/suggest-box.rs:4:47: 7:6]` = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html help: store this in the heap by calling `Box::new` diff --git a/src/test/ui/traits/self-without-lifetime-constraint.stderr b/src/test/ui/traits/self-without-lifetime-constraint.stderr index 6c7abe753e2bf..73b5aec022c60 100644 --- a/src/test/ui/traits/self-without-lifetime-constraint.stderr +++ b/src/test/ui/traits/self-without-lifetime-constraint.stderr @@ -2,13 +2,13 @@ error: `impl` item signature doesn't match `trait` item signature --> $DIR/self-without-lifetime-constraint.rs:45:5 | LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult; - | -------------------------------------------------------------------- expected `fn(ValueRef<'_>) -> std::result::Result<(&str, &&str), FromSqlError>` + | -------------------------------------------------------------------- expected `fn(ValueRef<'_>) -> Result<(&str, &&str), FromSqlError>` ... LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<&str, &&str> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(ValueRef<'_>) -> std::result::Result<(&str, &&str), FromSqlError>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(ValueRef<'_>) -> Result<(&str, &&str), FromSqlError>` | - = note: expected `fn(ValueRef<'_>) -> std::result::Result<(&str, &&str), _>` - found `fn(ValueRef<'_>) -> std::result::Result<(&str, &&str), _>` + = note: expected `fn(ValueRef<'_>) -> Result<(&str, &&str), _>` + found `fn(ValueRef<'_>) -> Result<(&str, &&str), _>` help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` --> $DIR/self-without-lifetime-constraint.rs:41:60 | diff --git a/src/test/ui/try-block/try-block-bad-type.stderr b/src/test/ui/try-block/try-block-bad-type.stderr index cadf3a841c961..2d1313d7d0e31 100644 --- a/src/test/ui/try-block/try-block-bad-type.stderr +++ b/src/test/ui/try-block/try-block-bad-type.stderr @@ -13,13 +13,13 @@ LL | Err("")?; and 2 others = note: required by `from` -error[E0271]: type mismatch resolving ` as Try>::Ok == &str` +error[E0271]: type mismatch resolving ` as Try>::Ok == &str` --> $DIR/try-block-bad-type.rs:12:9 | LL | "" | ^^ expected `i32`, found `&str` -error[E0271]: type mismatch resolving ` as Try>::Ok == ()` +error[E0271]: type mismatch resolving ` as Try>::Ok == ()` --> $DIR/try-block-bad-type.rs:15:39 | LL | let res: Result = try { }; diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr index 7b999f507739b..4f2f9e070fe52 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -10,7 +10,7 @@ LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), | --- not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - = note: the matched value is of type `std::result::Result` + = note: the matched value is of type `Result` error[E0004]: non-exhaustive patterns: type `&Void` is non-empty --> $DIR/uninhabited-matches-feature-gated.rs:15:19 @@ -64,7 +64,7 @@ LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), | --- not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - = note: the matched value is of type `std::result::Result` + = note: the matched value is of type `Result` error[E0005]: refutable pattern in local binding: `Err(_)` not covered --> $DIR/uninhabited-matches-feature-gated.rs:37:9 @@ -79,7 +79,7 @@ LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html - = note: the matched value is of type `std::result::Result` + = note: the matched value is of type `Result` help: you might want to use `if let` to ignore the variant that isn't matched | LL | if let Ok(x) = x { /* */ }