diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index 725238f1d1a85..70ea856498de4 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -241,8 +241,8 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> { // Make sure that the DepNode of some node coincides with the HirId // owner of that node. if cfg!(debug_assertions) { - let node_id = self.definitions.hir_to_node_id(hir_id); - assert_eq!(self.definitions.node_to_hir_id(node_id), hir_id); + let node_id = self.definitions.hir_id_to_node_id(hir_id); + assert_eq!(self.definitions.node_id_to_hir_id(node_id), hir_id); if hir_id.owner != self.current_dep_node_owner { let node_str = match self.definitions.opt_local_def_id(node_id) { @@ -342,7 +342,9 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { debug!("visit_item: {:?}", i); debug_assert_eq!( i.hir_id.owner, - self.definitions.opt_local_def_id(self.definitions.hir_to_node_id(i.hir_id)).unwrap() + self.definitions + .opt_local_def_id(self.definitions.hir_id_to_node_id(i.hir_id)) + .unwrap() ); self.with_dep_node_owner(i.hir_id.owner, i, |this, hash| { this.insert_with_hash(i.span, i.hir_id, Node::Item(i), hash); @@ -374,7 +376,9 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { fn visit_trait_item(&mut self, ti: &'hir TraitItem<'hir>) { debug_assert_eq!( ti.hir_id.owner, - self.definitions.opt_local_def_id(self.definitions.hir_to_node_id(ti.hir_id)).unwrap() + self.definitions + .opt_local_def_id(self.definitions.hir_id_to_node_id(ti.hir_id)) + .unwrap() ); self.with_dep_node_owner(ti.hir_id.owner, ti, |this, hash| { this.insert_with_hash(ti.span, ti.hir_id, Node::TraitItem(ti), hash); @@ -388,7 +392,9 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { fn visit_impl_item(&mut self, ii: &'hir ImplItem<'hir>) { debug_assert_eq!( ii.hir_id.owner, - self.definitions.opt_local_def_id(self.definitions.hir_to_node_id(ii.hir_id)).unwrap() + self.definitions + .opt_local_def_id(self.definitions.hir_id_to_node_id(ii.hir_id)) + .unwrap() ); self.with_dep_node_owner(ii.hir_id.owner, ii, |this, hash| { this.insert_with_hash(ii.span, ii.hir_id, Node::ImplItem(ii), hash); diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index bc42ac1f0d7aa..e8ce13e06e9f5 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -161,7 +161,7 @@ impl<'hir> Map<'hir> { #[inline] pub fn local_def_id_from_node_id(&self, node: NodeId) -> DefId { self.opt_local_def_id_from_node_id(node).unwrap_or_else(|| { - let hir_id = self.node_to_hir_id(node); + let hir_id = self.node_id_to_hir_id(node); bug!( "local_def_id_from_node_id: no entry for `{}`, which has a map of `{:?}`", node, @@ -184,7 +184,7 @@ impl<'hir> Map<'hir> { #[inline] pub fn opt_local_def_id(&self, hir_id: HirId) -> Option { - let node_id = self.hir_to_node_id(hir_id); + let node_id = self.hir_id_to_node_id(hir_id); self.opt_local_def_id_from_node_id(node_id) } @@ -204,13 +204,13 @@ impl<'hir> Map<'hir> { } #[inline] - pub fn hir_to_node_id(&self, hir_id: HirId) -> NodeId { - self.tcx.definitions.hir_to_node_id(hir_id) + pub fn hir_id_to_node_id(&self, hir_id: HirId) -> NodeId { + self.tcx.definitions.hir_id_to_node_id(hir_id) } #[inline] - pub fn node_to_hir_id(&self, node_id: NodeId) -> HirId { - self.tcx.definitions.node_to_hir_id(node_id) + pub fn node_id_to_hir_id(&self, node_id: NodeId) -> HirId { + self.tcx.definitions.node_id_to_hir_id(node_id) } #[inline] diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index a9466e8252de7..971472a642222 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -137,7 +137,7 @@ impl<'a> StableHashingContext<'a> { #[inline] pub fn node_to_hir_id(&self, node_id: ast::NodeId) -> hir::HirId { - self.definitions.node_to_hir_id(node_id) + self.definitions.node_id_to_hir_id(node_id) } #[inline] diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index c1d13b0353ebb..ce3b76278016e 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1126,11 +1126,11 @@ impl<'tcx> TyCtxt<'tcx> { let mut trait_map: FxHashMap<_, FxHashMap<_, _>> = FxHashMap::default(); for (k, v) in resolutions.trait_map { - let hir_id = definitions.node_to_hir_id(k); + let hir_id = definitions.node_id_to_hir_id(k); let map = trait_map.entry(hir_id.owner).or_default(); let v = v .into_iter() - .map(|tc| tc.map_import_ids(|id| definitions.node_to_hir_id(id))) + .map(|tc| tc.map_import_ids(|id| definitions.node_id_to_hir_id(id))) .collect(); map.insert(hir_id.local_id, StableVec::new(v)); } @@ -1154,7 +1154,7 @@ impl<'tcx> TyCtxt<'tcx> { .map(|(k, v)| { let exports: Vec<_> = v .into_iter() - .map(|e| e.map_id(|id| definitions.node_to_hir_id(id))) + .map(|e| e.map_id(|id| definitions.node_id_to_hir_id(id))) .collect(); (k, exports) }) diff --git a/src/librustc_expand/mbe/macro_rules.rs b/src/librustc_expand/mbe/macro_rules.rs index b9477be57ddda..0e70fdbd9c146 100644 --- a/src/librustc_expand/mbe/macro_rules.rs +++ b/src/librustc_expand/mbe/macro_rules.rs @@ -86,6 +86,7 @@ fn suggest_slice_pat(e: &mut DiagnosticBuilder<'_>, site_span: Span, parser: &Pa fn emit_frag_parse_err( mut e: DiagnosticBuilder<'_>, parser: &Parser<'_>, + orig_parser: &mut Parser<'_>, site_span: Span, macro_ident: ast::Ident, arm_span: Span, @@ -118,6 +119,21 @@ fn emit_frag_parse_err( AstFragmentKind::Pat if macro_ident.name == sym::vec => { suggest_slice_pat(&mut e, site_span, parser); } + // Try a statement if an expression is wanted but failed and suggest adding `;` to call. + AstFragmentKind::Expr => match parse_ast_fragment(orig_parser, AstFragmentKind::Stmts) { + Err(mut err) => err.cancel(), + Ok(_) => { + e.note( + "the macro call doesn't expand to an expression, but it can expand to a statement", + ); + e.span_suggestion_verbose( + site_span.shrink_to_hi(), + "add `;` to interpret the expansion as a statement", + ";".to_string(), + Applicability::MaybeIncorrect, + ); + } + }, _ => annotate_err_with_kind(&mut e, kind, site_span), }; e.emit(); @@ -126,10 +142,11 @@ fn emit_frag_parse_err( impl<'a> ParserAnyMacro<'a> { crate fn make(mut self: Box>, kind: AstFragmentKind) -> AstFragment { let ParserAnyMacro { site_span, macro_ident, ref mut parser, arm_span } = *self; + let snapshot = &mut parser.clone(); let fragment = match parse_ast_fragment(parser, kind) { Ok(f) => f, Err(err) => { - emit_frag_parse_err(err, parser, site_span, macro_ident, arm_span, kind); + emit_frag_parse_err(err, parser, snapshot, site_span, macro_ident, arm_span, kind); return kind.dummy(site_span); } }; diff --git a/src/librustc_hir/definitions.rs b/src/librustc_hir/definitions.rs index 3b86dd42a68b9..314af77f2ca16 100644 --- a/src/librustc_hir/definitions.rs +++ b/src/librustc_hir/definitions.rs @@ -353,15 +353,13 @@ impl Definitions { } } - // FIXME(eddyb) rename to `hir_id_to_node_id`. #[inline] - pub fn hir_to_node_id(&self, hir_id: hir::HirId) -> ast::NodeId { + pub fn hir_id_to_node_id(&self, hir_id: hir::HirId) -> ast::NodeId { self.hir_id_to_node_id[&hir_id] } - // FIXME(eddyb) rename to `node_id_to_hir_id`. #[inline] - pub fn node_to_hir_id(&self, node_id: ast::NodeId) -> hir::HirId { + pub fn node_id_to_hir_id(&self, node_id: ast::NodeId) -> hir::HirId { self.node_id_to_hir_id[node_id] } diff --git a/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs index 8f18fb4a30ed3..4ab7c4506fe62 100644 --- a/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs +++ b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs @@ -222,8 +222,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { &mut err, ¶m.name.as_str(), "Copy", - tcx.sess.source_map(), - span, None, ); } diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 7d5f286072869..d241cc5d8a333 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -644,7 +644,7 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: DefId) { } let mut unsafe_blocks: Vec<_> = unsafe_blocks.iter().collect(); - unsafe_blocks.sort_by_cached_key(|(hir_id, _)| tcx.hir().hir_to_node_id(*hir_id)); + unsafe_blocks.sort_by_cached_key(|(hir_id, _)| tcx.hir().hir_id_to_node_id(*hir_id)); let used_unsafe: FxHashSet<_> = unsafe_blocks.iter().flat_map(|&&(id, used)| used.then_some(id)).collect(); for &(block_id, is_used) in unsafe_blocks { diff --git a/src/librustc_mir_build/hair/pattern/check_match.rs b/src/librustc_mir_build/hair/pattern/check_match.rs index c2eeac60b8b3b..e29bbf8fa6eb1 100644 --- a/src/librustc_mir_build/hair/pattern/check_match.rs +++ b/src/librustc_mir_build/hair/pattern/check_match.rs @@ -241,6 +241,7 @@ impl<'tcx> MatchVisitor<'_, 'tcx> { } adt_defined_here(cx, &mut err, pattern_ty, &witnesses); + err.note(&format!("the matched value is of type `{}`", pattern_ty)); err.emit(); }); } @@ -483,6 +484,7 @@ fn check_exhaustive<'p, 'tcx>( "ensure that all possible cases are being handled, \ possibly by adding wildcards or more match arms", ); + err.note(&format!("the matched value is of type `{}`", scrut_ty)); err.emit(); } diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index a80c3b72044ef..c0ac9e7f6b61f 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -225,7 +225,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { collector.visit_pat(&arg.pat); for (id, ident, ..) in collector.collected_idents { - let hir_id = self.tcx.hir().node_to_hir_id(id); + let hir_id = self.tcx.hir().node_id_to_hir_id(id); let typ = match self.save_ctxt.tables.node_type_opt(hir_id) { Some(s) => s.to_string(), None => continue, @@ -268,7 +268,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { ) { debug!("process_method: {}:{}", id, ident); - let hir_id = self.tcx.hir().node_to_hir_id(id); + let hir_id = self.tcx.hir().node_id_to_hir_id(id); self.nest_tables(id, |v| { if let Some(mut method_data) = v.save_ctxt.get_method_data(id, ident, span) { v.process_formals(&sig.decl.inputs, &method_data.qualname); @@ -308,7 +308,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { fn process_struct_field_def(&mut self, field: &ast::StructField, parent_id: NodeId) { let field_data = self.save_ctxt.get_field_data(field, parent_id); if let Some(field_data) = field_data { - let hir_id = self.tcx.hir().node_to_hir_id(field.id); + let hir_id = self.tcx.hir().node_id_to_hir_id(field.id); self.dumper.dump_def(&access_from!(self.save_ctxt, field, hir_id), field_data); } } @@ -360,7 +360,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { ty_params: &'l ast::Generics, body: Option<&'l ast::Block>, ) { - let hir_id = self.tcx.hir().node_to_hir_id(item.id); + let hir_id = self.tcx.hir().node_id_to_hir_id(item.id); self.nest_tables(item.id, |v| { if let Some(fn_data) = v.save_ctxt.get_item_data(item) { down_cast_data!(fn_data, DefData, item.span); @@ -402,7 +402,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { typ: &'l ast::Ty, expr: Option<&'l ast::Expr>, ) { - let hir_id = self.tcx.hir().node_to_hir_id(item.id); + let hir_id = self.tcx.hir().node_id_to_hir_id(item.id); self.nest_tables(item.id, |v| { if let Some(var_data) = v.save_ctxt.get_item_data(item) { down_cast_data!(var_data, DefData, item.span); @@ -429,7 +429,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { if !self.span.filter_generated(ident.span) { let sig = sig::assoc_const_signature(id, ident.name, typ, expr, &self.save_ctxt); let span = self.span_from_span(ident.span); - let hir_id = self.tcx.hir().node_to_hir_id(id); + let hir_id = self.tcx.hir().node_id_to_hir_id(id); self.dumper.dump_def( &access_from_vis!(self.save_ctxt, vis, hir_id), @@ -503,7 +503,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { if !self.span.filter_generated(item.ident.span) { let span = self.span_from_span(item.ident.span); - let hir_id = self.tcx.hir().node_to_hir_id(item.id); + let hir_id = self.tcx.hir().node_id_to_hir_id(item.id); self.dumper.dump_def( &access_from!(self.save_ctxt, item, hir_id), Def { @@ -546,7 +546,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { }; down_cast_data!(enum_data, DefData, item.span); - let hir_id = self.tcx.hir().node_to_hir_id(item.id); + let hir_id = self.tcx.hir().node_id_to_hir_id(item.id); let access = access_from!(self.save_ctxt, item, hir_id); for variant in &enum_definition.variants { @@ -699,7 +699,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { let id = id_from_node_id(item.id, &self.save_ctxt); let span = self.span_from_span(item.ident.span); let children = methods.iter().map(|i| id_from_node_id(i.id, &self.save_ctxt)).collect(); - let hir_id = self.tcx.hir().node_to_hir_id(item.id); + let hir_id = self.tcx.hir().node_id_to_hir_id(item.id); self.dumper.dump_def( &access_from!(self.save_ctxt, item, hir_id), Def { @@ -759,7 +759,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { fn process_mod(&mut self, item: &ast::Item) { if let Some(mod_data) = self.save_ctxt.get_item_data(item) { down_cast_data!(mod_data, DefData, item.span); - let hir_id = self.tcx.hir().node_to_hir_id(item.id); + let hir_id = self.tcx.hir().node_id_to_hir_id(item.id); self.dumper.dump_def(&access_from!(self.save_ctxt, item, hir_id), mod_data); } } @@ -864,7 +864,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { match p.kind { PatKind::Struct(ref _path, ref fields, _) => { // FIXME do something with _path? - let hir_id = self.tcx.hir().node_to_hir_id(p.id); + let hir_id = self.tcx.hir().node_id_to_hir_id(p.id); let adt = match self.save_ctxt.tables.node_type_opt(hir_id) { Some(ty) if ty.ty_adt_def().is_some() => ty.ty_adt_def().unwrap(), _ => { @@ -903,7 +903,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { for (id, ident, _) in collector.collected_idents { match self.save_ctxt.get_path_res(id) { Res::Local(hir_id) => { - let id = self.tcx.hir().hir_to_node_id(hir_id); + let id = self.tcx.hir().hir_id_to_node_id(hir_id); let typ = self .save_ctxt .tables @@ -1126,7 +1126,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { // The access is calculated using the current tree ID, but with the root tree's visibility // (since nested trees don't have their own visibility). - let hir_id = self.tcx.hir().node_to_hir_id(id); + let hir_id = self.tcx.hir().node_id_to_hir_id(id); let access = access_from!(self.save_ctxt, root_item, hir_id); // The parent `DefId` of a given use tree is always the enclosing item. @@ -1321,7 +1321,7 @@ impl<'l, 'tcx> Visitor<'l> for DumpVisitor<'l, 'tcx> { if !self.span.filter_generated(item.ident.span) { let span = self.span_from_span(item.ident.span); let id = id_from_node_id(item.id, &self.save_ctxt); - let hir_id = self.tcx.hir().node_to_hir_id(item.id); + let hir_id = self.tcx.hir().node_id_to_hir_id(item.id); self.dumper.dump_def( &access_from!(self.save_ctxt, item, hir_id), @@ -1420,7 +1420,7 @@ impl<'l, 'tcx> Visitor<'l> for DumpVisitor<'l, 'tcx> { self.process_macro_use(ex.span); match ex.kind { ast::ExprKind::Struct(ref path, ref fields, ref base) => { - let expr_hir_id = self.save_ctxt.tcx.hir().node_to_hir_id(ex.id); + let expr_hir_id = self.save_ctxt.tcx.hir().node_id_to_hir_id(ex.id); let hir_expr = self.save_ctxt.tcx.hir().expect_expr(expr_hir_id); let adt = match self.save_ctxt.tables.expr_ty_opt(&hir_expr) { Some(ty) if ty.ty_adt_def().is_some() => ty.ty_adt_def().unwrap(), @@ -1429,7 +1429,7 @@ impl<'l, 'tcx> Visitor<'l> for DumpVisitor<'l, 'tcx> { return; } }; - let node_id = self.save_ctxt.tcx.hir().hir_to_node_id(hir_expr.hir_id); + let node_id = self.save_ctxt.tcx.hir().hir_id_to_node_id(hir_expr.hir_id); let res = self.save_ctxt.get_path_res(node_id); self.process_struct_lit(ex, path, fields, adt.variant_of_res(res), base) } @@ -1514,7 +1514,7 @@ impl<'l, 'tcx> Visitor<'l> for DumpVisitor<'l, 'tcx> { } fn visit_foreign_item(&mut self, item: &'l ast::ForeignItem) { - let hir_id = self.tcx.hir().node_to_hir_id(item.id); + let hir_id = self.tcx.hir().node_id_to_hir_id(item.id); let access = access_from!(self.save_ctxt, item, hir_id); match item.kind { diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 21551eeddb927..c737c6257a2ec 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -412,7 +412,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { let trait_id = self.tcx.trait_id_of_impl(impl_id); let mut docs = String::new(); let mut attrs = vec![]; - if let Some(Node::ImplItem(item)) = hir.find(hir.node_to_hir_id(id)) { + if let Some(Node::ImplItem(item)) = hir.find(hir.node_id_to_hir_id(id)) { docs = self.docs_for_attrs(&item.attrs); attrs = item.attrs.to_vec(); } @@ -452,7 +452,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { Some(def_id) => { let mut docs = String::new(); let mut attrs = vec![]; - let hir_id = self.tcx.hir().node_to_hir_id(id); + let hir_id = self.tcx.hir().node_id_to_hir_id(id); if let Some(Node::TraitItem(item)) = self.tcx.hir().find(hir_id) { docs = self.docs_for_attrs(&item.attrs); @@ -511,7 +511,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { } pub fn get_expr_data(&self, expr: &ast::Expr) -> Option { - let expr_hir_id = self.tcx.hir().node_to_hir_id(expr.id); + let expr_hir_id = self.tcx.hir().node_id_to_hir_id(expr.id); let hir_node = self.tcx.hir().expect_expr(expr_hir_id); let ty = self.tables.expr_ty_adjusted_opt(&hir_node); if ty.is_none() || ty.unwrap().kind == ty::Error { @@ -519,7 +519,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { } match expr.kind { ast::ExprKind::Field(ref sub_ex, ident) => { - let sub_ex_hir_id = self.tcx.hir().node_to_hir_id(sub_ex.id); + let sub_ex_hir_id = self.tcx.hir().node_id_to_hir_id(sub_ex.id); let hir_node = match self.tcx.hir().find(sub_ex_hir_id) { Some(Node::Expr(expr)) => expr, _ => { @@ -573,7 +573,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { } } ast::ExprKind::MethodCall(ref seg, ..) => { - let expr_hir_id = self.tcx.hir().definitions().node_to_hir_id(expr.id); + let expr_hir_id = self.tcx.hir().definitions().node_id_to_hir_id(expr.id); let method_id = match self.tables.type_dependent_def_id(expr_hir_id) { Some(id) => id, None => { @@ -605,7 +605,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { } pub fn get_path_res(&self, id: NodeId) -> Res { - let hir_id = self.tcx.hir().node_to_hir_id(id); + let hir_id = self.tcx.hir().node_id_to_hir_id(id); match self.tcx.hir().get(hir_id) { Node::TraitRef(tr) => tr.path.res, @@ -619,7 +619,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { Some(res) if res != Res::Err => res, _ => { let parent_node = self.tcx.hir().get_parent_node(hir_id); - self.get_path_res(self.tcx.hir().hir_to_node_id(parent_node)) + self.get_path_res(self.tcx.hir().hir_id_to_node_id(parent_node)) } }, @@ -681,7 +681,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { Res::Local(id) => Some(Ref { kind: RefKind::Variable, span, - ref_id: id_from_node_id(self.tcx.hir().hir_to_node_id(id), self), + ref_id: id_from_node_id(self.tcx.hir().hir_id_to_node_id(id), self), }), Res::Def(HirDefKind::Trait, def_id) if fn_type(path_seg) => { Some(Ref { kind: RefKind::Type, span, ref_id: id_from_def_id(def_id) }) diff --git a/src/librustc_trait_selection/lib.rs b/src/librustc_trait_selection/lib.rs index 739aff4fb94c9..98a623e38860c 100644 --- a/src/librustc_trait_selection/lib.rs +++ b/src/librustc_trait_selection/lib.rs @@ -15,6 +15,7 @@ #![feature(drain_filter)] #![feature(in_band_lifetimes)] #![feature(crate_visibility_modifier)] +#![feature(or_patterns)] #![recursion_limit = "512"] // For rustdoc #[macro_use] diff --git a/src/librustc_trait_selection/traits/error_reporting/mod.rs b/src/librustc_trait_selection/traits/error_reporting/mod.rs index 8cbed43cac01d..d0cfa5489589d 100644 --- a/src/librustc_trait_selection/traits/error_reporting/mod.rs +++ b/src/librustc_trait_selection/traits/error_reporting/mod.rs @@ -25,8 +25,7 @@ use rustc_hir as hir; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_hir::{Node, QPath, TyKind, WhereBoundPredicate, WherePredicate}; use rustc_session::DiagnosticMessageId; -use rustc_span::source_map::SourceMap; -use rustc_span::{ExpnKind, Span, DUMMY_SP}; +use rustc_span::{BytePos, ExpnKind, Span, DUMMY_SP}; use std::fmt; use crate::traits::query::evaluate_obligation::InferCtxtExt as _; @@ -1679,14 +1678,8 @@ pub fn suggest_constraining_type_param( err: &mut DiagnosticBuilder<'_>, param_name: &str, constraint: &str, - source_map: &SourceMap, - span: Span, def_id: Option, ) -> bool { - const MSG_RESTRICT_BOUND_FURTHER: &str = "consider further restricting this bound with"; - const MSG_RESTRICT_TYPE: &str = "consider restricting this type parameter with"; - const MSG_RESTRICT_TYPE_FURTHER: &str = "consider further restricting this type parameter with"; - let param = generics.params.iter().find(|p| p.name.ident().as_str() == param_name); let param = if let Some(param) = param { @@ -1695,11 +1688,24 @@ pub fn suggest_constraining_type_param( return false; }; + const MSG_RESTRICT_BOUND_FURTHER: &str = "consider further restricting this bound"; + let msg_restrict_type = format!("consider restricting type parameter `{}`", param_name); + let msg_restrict_type_further = + format!("consider further restricting type parameter `{}`", param_name); + if def_id == tcx.lang_items().sized_trait() { // Type parameters are already `Sized` by default. err.span_label(param.span, &format!("this type parameter needs to be `{}`", constraint)); return true; } + let mut suggest_restrict = |span| { + err.span_suggestion_verbose( + span, + MSG_RESTRICT_BOUND_FURTHER, + format!(" + {}", constraint), + Applicability::MachineApplicable, + ); + }; if param_name.starts_with("impl ") { // If there's an `impl Trait` used in argument position, suggest @@ -1717,19 +1723,15 @@ pub fn suggest_constraining_type_param( // | // replace with: `impl Foo + Bar` - err.span_help(param.span, &format!("{} `+ {}`", MSG_RESTRICT_BOUND_FURTHER, constraint)); - - err.tool_only_span_suggestion( - param.span, - MSG_RESTRICT_BOUND_FURTHER, - format!("{} + {}", param_name, constraint), - Applicability::MachineApplicable, - ); - + suggest_restrict(param.span.shrink_to_hi()); return true; } - if generics.where_clause.predicates.is_empty() { + if generics.where_clause.predicates.is_empty() + // Given `trait Base: Super` where `T: Copy`, suggest restricting in the + // `where` clause instead of `trait Base: Super`. + && !matches!(param.kind, hir::GenericParamKind::Type { default: Some(_), .. }) + { if let Some(bounds_span) = param.bounds_span() { // If user has provided some bounds, suggest restricting them: // @@ -1744,38 +1746,16 @@ pub fn suggest_constraining_type_param( // -- // | // replace with: `T: Bar +` - - err.span_help( - bounds_span, - &format!("{} `+ {}`", MSG_RESTRICT_BOUND_FURTHER, constraint), - ); - - let span_hi = param.span.with_hi(span.hi()); - let span_with_colon = source_map.span_through_char(span_hi, ':'); - - if span_hi != param.span && span_with_colon != span_hi { - err.tool_only_span_suggestion( - span_with_colon, - MSG_RESTRICT_BOUND_FURTHER, - format!("{}: {} + ", param_name, constraint), - Applicability::MachineApplicable, - ); - } + suggest_restrict(bounds_span.shrink_to_hi()); } else { // If user hasn't provided any bounds, suggest adding a new one: // // fn foo(t: T) { ... } // - help: consider restricting this type parameter with `T: Foo` - - err.span_help( - param.span, - &format!("{} `{}: {}`", MSG_RESTRICT_TYPE, param_name, constraint), - ); - - err.tool_only_span_suggestion( - param.span, - MSG_RESTRICT_TYPE, - format!("{}: {}", param_name, constraint), + err.span_suggestion_verbose( + param.span.shrink_to_hi(), + &msg_restrict_type, + format!(": {}", constraint), Applicability::MachineApplicable, ); } @@ -1839,55 +1819,25 @@ pub fn suggest_constraining_type_param( } } - let where_clause_span = - generics.where_clause.span_for_predicates_or_empty_place().shrink_to_hi(); + let where_clause_span = generics.where_clause.span_for_predicates_or_empty_place(); + // Account for `fn foo(t: T) where T: Foo,` so we don't suggest two trailing commas. + let mut trailing_comma = false; + if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(where_clause_span) { + trailing_comma = snippet.ends_with(","); + } + let where_clause_span = if trailing_comma { + let hi = where_clause_span.hi(); + Span::new(hi - BytePos(1), hi, where_clause_span.ctxt()) + } else { + where_clause_span.shrink_to_hi() + }; match ¶m_spans[..] { - &[] => { - err.span_help( - param.span, - &format!("{} `where {}: {}`", MSG_RESTRICT_TYPE, param_name, constraint), - ); - - err.tool_only_span_suggestion( - where_clause_span, - MSG_RESTRICT_TYPE, - format!(", {}: {}", param_name, constraint), - Applicability::MachineApplicable, - ); - } - - &[¶m_span] => { - err.span_help( - param_span, - &format!("{} `+ {}`", MSG_RESTRICT_BOUND_FURTHER, constraint), - ); - - let span_hi = param_span.with_hi(span.hi()); - let span_with_colon = source_map.span_through_char(span_hi, ':'); - - if span_hi != param_span && span_with_colon != span_hi { - err.tool_only_span_suggestion( - span_with_colon, - MSG_RESTRICT_BOUND_FURTHER, - format!("{}: {} +", param_name, constraint), - Applicability::MachineApplicable, - ); - } - } - + &[¶m_span] => suggest_restrict(param_span.shrink_to_hi()), _ => { - err.span_help( - param.span, - &format!( - "{} `where {}: {}`", - MSG_RESTRICT_TYPE_FURTHER, param_name, constraint, - ), - ); - - err.tool_only_span_suggestion( + err.span_suggestion_verbose( where_clause_span, - MSG_RESTRICT_BOUND_FURTHER, + &msg_restrict_type_further, format!(", {}: {}", param_name, constraint), Applicability::MachineApplicable, ); diff --git a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs index a4be70df122d7..3ac2117ec697e 100644 --- a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs +++ b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs @@ -195,8 +195,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { return; } - hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(_, generics, _), .. }) - | hir::Node::TraitItem(hir::TraitItem { + hir::Node::TraitItem(hir::TraitItem { generics, kind: hir::TraitItemKind::Fn(..), .. @@ -206,63 +205,31 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { kind: hir::ImplItemKind::Fn(..), .. }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::Trait(_, _, generics, _, _), - .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::Impl { generics, .. }, .. - }) if projection.is_some() => { + | hir::Node::Item( + hir::Item { kind: hir::ItemKind::Fn(_, generics, _), .. } + | hir::Item { kind: hir::ItemKind::Trait(_, _, generics, _, _), .. } + | hir::Item { kind: hir::ItemKind::Impl { generics, .. }, .. }, + ) if projection.is_some() => { // Missing associated type bound. suggest_restriction(&generics, "the associated type", err); return; } - hir::Node::Item(hir::Item { - kind: hir::ItemKind::Struct(_, generics), - span, - .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::Enum(_, generics), span, .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::Union(_, generics), - span, - .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::Trait(_, _, generics, ..), - span, - .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::Impl { generics, .. }, - span, - .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::Fn(_, generics, _), - span, - .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::TyAlias(_, generics), - span, - .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::TraitAlias(generics, _), - span, - .. - }) - | hir::Node::Item(hir::Item { - kind: hir::ItemKind::OpaqueTy(hir::OpaqueTy { generics, .. }), - span, - .. - }) - | hir::Node::TraitItem(hir::TraitItem { generics, span, .. }) - | hir::Node::ImplItem(hir::ImplItem { generics, span, .. }) + hir::Node::Item( + hir::Item { kind: hir::ItemKind::Struct(_, generics), .. } + | hir::Item { kind: hir::ItemKind::Enum(_, generics), .. } + | hir::Item { kind: hir::ItemKind::Union(_, generics), .. } + | hir::Item { kind: hir::ItemKind::Trait(_, _, generics, ..), .. } + | hir::Item { kind: hir::ItemKind::Impl { generics, .. }, .. } + | hir::Item { kind: hir::ItemKind::Fn(_, generics, _), .. } + | hir::Item { kind: hir::ItemKind::TyAlias(_, generics), .. } + | hir::Item { kind: hir::ItemKind::TraitAlias(generics, _), .. } + | hir::Item { + kind: hir::ItemKind::OpaqueTy(hir::OpaqueTy { generics, .. }), .. + }, + ) + | hir::Node::TraitItem(hir::TraitItem { generics, .. }) + | hir::Node::ImplItem(hir::ImplItem { generics, .. }) if param_ty => { // Missing generic type parameter bound. @@ -274,8 +241,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { &mut err, ¶m_name, &constraint, - self.tcx.sess.source_map(), - *span, Some(trait_ref.def_id()), ) { return; diff --git a/src/librustc_typeck/collect/type_of.rs b/src/librustc_typeck/collect/type_of.rs index 30741ed53b58b..23613caa99322 100644 --- a/src/librustc_typeck/collect/type_of.rs +++ b/src/librustc_typeck/collect/type_of.rs @@ -216,93 +216,87 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> { | Node::Expr(&Expr { kind: ExprKind::Path(_), .. }) | Node::TraitRef(..) => { let path = match parent_node { - Node::Ty(&Ty { - kind: TyKind::Path(QPath::Resolved(_, ref path)), .. - }) + Node::Ty(&Ty { kind: TyKind::Path(QPath::Resolved(_, path)), .. }) | Node::Expr(&Expr { - kind: ExprKind::Path(QPath::Resolved(_, ref path)), + kind: + ExprKind::Path(QPath::Resolved(_, path)) + | ExprKind::Struct(&QPath::Resolved(_, path), ..), .. - }) => Some(&**path), - Node::Expr(&Expr { kind: ExprKind::Struct(ref path, ..), .. }) => { - if let QPath::Resolved(_, ref path) = **path { - Some(&**path) - } else { - None - } + }) + | Node::TraitRef(&TraitRef { path, .. }) => &*path, + _ => { + tcx.sess.delay_span_bug( + DUMMY_SP, + &format!("unexpected const parent path {:?}", parent_node), + ); + return tcx.types.err; } - Node::TraitRef(&TraitRef { ref path, .. }) => Some(&**path), - _ => None, }; - if let Some(path) = path { - // We've encountered an `AnonConst` in some path, so we need to - // figure out which generic parameter it corresponds to and return - // the relevant type. - - let (arg_index, segment) = path - .segments - .iter() - .filter_map(|seg| seg.args.as_ref().map(|args| (args.args, seg))) - .find_map(|(args, seg)| { - args.iter() - .filter(|arg| arg.is_const()) - .enumerate() - .filter(|(_, arg)| arg.id() == hir_id) - .map(|(index, _)| (index, seg)) - .next() - }) - .unwrap_or_else(|| { - bug!("no arg matching AnonConst in path"); - }); - - // Try to use the segment resolution if it is valid, otherwise we - // default to the path resolution. - let res = segment.res.filter(|&r| r != Res::Err).unwrap_or(path.res); - let generics = match res { - Res::Def(DefKind::Ctor(..), def_id) => { - tcx.generics_of(tcx.parent(def_id).unwrap()) - } - Res::Def(_, def_id) => tcx.generics_of(def_id), - res => { - tcx.sess.delay_span_bug( - DUMMY_SP, - &format!( - "unexpected anon const res {:?} in path: {:?}", - res, path, - ), - ); - return tcx.types.err; + // We've encountered an `AnonConst` in some path, so we need to + // figure out which generic parameter it corresponds to and return + // the relevant type. + + let (arg_index, segment) = path + .segments + .iter() + .filter_map(|seg| seg.args.as_ref().map(|args| (args.args, seg))) + .find_map(|(args, seg)| { + args.iter() + .filter(|arg| arg.is_const()) + .enumerate() + .filter(|(_, arg)| arg.id() == hir_id) + .map(|(index, _)| (index, seg)) + .next() + }) + .unwrap_or_else(|| { + bug!("no arg matching AnonConst in path"); + }); + + // Try to use the segment resolution if it is valid, otherwise we + // default to the path resolution. + let res = segment.res.filter(|&r| r != Res::Err).unwrap_or(path.res); + let generics = match res { + Res::Def(DefKind::Ctor(..), def_id) => { + tcx.generics_of(tcx.parent(def_id).unwrap()) + } + Res::Def(_, def_id) => tcx.generics_of(def_id), + res => { + tcx.sess.delay_span_bug( + DUMMY_SP, + &format!( + "unexpected anon const res {:?} in path: {:?}", + res, path, + ), + ); + return tcx.types.err; + } + }; + + let ty = generics + .params + .iter() + .filter(|param| { + if let ty::GenericParamDefKind::Const = param.kind { + true + } else { + false } - }; + }) + .nth(arg_index) + .map(|param| tcx.type_of(param.def_id)); - generics - .params - .iter() - .filter(|param| { - if let ty::GenericParamDefKind::Const = param.kind { - true - } else { - false - } - }) - .nth(arg_index) - .map(|param| tcx.type_of(param.def_id)) - // This is no generic parameter associated with the arg. This is - // probably from an extra arg where one is not needed. - .unwrap_or_else(|| { - tcx.sess.delay_span_bug( - DUMMY_SP, - &format!( - "missing generic parameter for `AnonConst`, parent: {:?}, res: {:?}", - parent_node, res - ), - ); - tcx.types.err - }) + if let Some(ty) = ty { + ty } else { + // This is no generic parameter associated with the arg. This is + // probably from an extra arg where one is not needed. tcx.sess.delay_span_bug( DUMMY_SP, - &format!("unexpected const parent path {:?}", parent_node,), + &format!( + "missing generic parameter for `AnonConst`, parent: {:?}, res: {:?}", + parent_node, res + ), ); tcx.types.err } diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 113c781e33205..2525773f0ed71 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -135,7 +135,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> { // In case we're in a module, try to resolve the relative path. if let Some(module_id) = parent_id.or(self.mod_ids.last().cloned()) { - let module_id = cx.tcx.hir().hir_to_node_id(module_id); + let module_id = cx.tcx.hir().hir_id_to_node_id(module_id); let result = cx.enter_resolver(|resolver| { resolver.resolve_str_path_error(DUMMY_SP, &path_str, ns, module_id) }); diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr b/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr index ec60db47f4429..946a1f1a07abd 100644 --- a/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr +++ b/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr @@ -7,11 +7,10 @@ LL | const Y: usize; LL | let _array = [4; ::Y]; | ^^^^^^^^^^^^^ the trait `Foo` is not implemented for `A` | -help: consider further restricting this bound with `+ Foo` - --> $DIR/associated-const-type-parameter-arrays-2.rs:15:16 +help: consider further restricting this bound | -LL | pub fn test() { - | ^^^ +LL | pub fn test() { + | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr b/src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr index 3d38deb5a8763..ac40e390cfbbd 100644 --- a/src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr +++ b/src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr @@ -7,11 +7,10 @@ LL | const Y: usize; LL | let _array: [u32; ::Y]; | ^^^^^^^^^^^^^ the trait `Foo` is not implemented for `A` | -help: consider further restricting this bound with `+ Foo` - --> $DIR/associated-const-type-parameter-arrays.rs:15:16 +help: consider further restricting this bound | -LL | pub fn test() { - | ^^^ +LL | pub fn test() { + | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr b/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr index bac663dfea2b3..1df127873538d 100644 --- a/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr +++ b/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr @@ -4,11 +4,10 @@ error[E0277]: the trait bound `T: Foo` is not satisfied LL | let u: >::Bar = t.get_bar(); | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T` | -help: consider further restricting this bound with `+ Foo` - --> $DIR/associated-types-invalid-trait-ref-issue-18865.rs:9:8 +help: consider further restricting this bound | -LL | fn f>(t: &T) { - | ^^^^^^^^^^ +LL | fn f + Foo>(t: &T) { + | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr b/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr index 770845167cf9c..0b5dee611e489 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr @@ -4,11 +4,10 @@ error[E0277]: the trait bound `T: Get` is not satisfied LL | fn uhoh(foo: ::Value) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `T` | -help: consider restricting this type parameter with `T: Get` - --> $DIR/associated-types-no-suitable-bound.rs:11:13 +help: consider restricting type parameter `T` | -LL | fn uhoh(foo: ::Value) {} - | ^ +LL | fn uhoh(foo: ::Value) {} + | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/associated-types/defaults-suitability.stderr b/src/test/ui/associated-types/defaults-suitability.stderr index 60e1821b300d2..54e39c4367d10 100644 --- a/src/test/ui/associated-types/defaults-suitability.stderr +++ b/src/test/ui/associated-types/defaults-suitability.stderr @@ -23,12 +23,11 @@ LL | trait Foo { LL | type Bar: Clone = Vec; | ^^^^^ the trait `std::clone::Clone` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::clone::Clone` - --> $DIR/defaults-suitability.rs:32:11 - | -LL | trait Foo { - | ^ = note: required because of the requirements on the impl of `std::clone::Clone` for `std::vec::Vec` +help: consider restricting type parameter `T` + | +LL | trait Foo { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `(): Foo` is not satisfied --> $DIR/defaults-suitability.rs:39:17 @@ -119,11 +118,10 @@ LL | | type Baz = T; LL | | } | |_- required by `Foo3` | -help: consider restricting this type parameter with `where T: std::clone::Clone` - --> $DIR/defaults-suitability.rs:88:12 +help: consider further restricting type parameter `T` | -LL | trait Foo3 where - | ^ +LL | Self::Baz: Clone, T: std::clone::Clone + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/defaults-suitability.rs:27:5 diff --git a/src/test/ui/associated-types/defaults-unsound-62211-1.stderr b/src/test/ui/associated-types/defaults-unsound-62211-1.stderr index 9c4a126013942..cfca7cc101107 100644 --- a/src/test/ui/associated-types/defaults-unsound-62211-1.stderr +++ b/src/test/ui/associated-types/defaults-unsound-62211-1.stderr @@ -47,11 +47,10 @@ LL | impl UncheckedCopy for T {} | = help: the trait `std::fmt::Display` is not implemented for `T` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -help: consider restricting this type parameter with `T: std::fmt::Display` - --> $DIR/defaults-unsound-62211-1.rs:41:6 +help: consider restricting type parameter `T` | -LL | impl UncheckedCopy for T {} - | ^ +LL | impl UncheckedCopy for T {} + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::ops::Deref` is not satisfied --> $DIR/defaults-unsound-62211-1.rs:41:9 @@ -59,11 +58,10 @@ error[E0277]: the trait bound `T: std::ops::Deref` is not satisfied LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::ops::Deref` - --> $DIR/defaults-unsound-62211-1.rs:41:6 +help: consider restricting type parameter `T` | -LL | impl UncheckedCopy for T {} - | ^ +LL | impl UncheckedCopy for T {} + | ^^^^^^^^^^^^^^^^^ error[E0277]: cannot add-assign `&'static str` to `T` --> $DIR/defaults-unsound-62211-1.rs:41:9 @@ -72,11 +70,10 @@ LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ no implementation for `T += &'static str` | = help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `T` -help: consider restricting this type parameter with `T: std::ops::AddAssign<&'static str>` - --> $DIR/defaults-unsound-62211-1.rs:41:6 +help: consider restricting type parameter `T` | -LL | impl UncheckedCopy for T {} - | ^ +LL | impl> UncheckedCopy for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/defaults-unsound-62211-1.rs:41:9 @@ -84,11 +81,10 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/defaults-unsound-62211-1.rs:41:6 +help: consider restricting type parameter `T` | -LL | impl UncheckedCopy for T {} - | ^ +LL | impl UncheckedCopy for T {} + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/associated-types/defaults-unsound-62211-2.stderr b/src/test/ui/associated-types/defaults-unsound-62211-2.stderr index 4602fbc99fa62..1dcfbf538e4c7 100644 --- a/src/test/ui/associated-types/defaults-unsound-62211-2.stderr +++ b/src/test/ui/associated-types/defaults-unsound-62211-2.stderr @@ -47,11 +47,10 @@ LL | impl UncheckedCopy for T {} | = help: the trait `std::fmt::Display` is not implemented for `T` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -help: consider restricting this type parameter with `T: std::fmt::Display` - --> $DIR/defaults-unsound-62211-2.rs:41:6 +help: consider restricting type parameter `T` | -LL | impl UncheckedCopy for T {} - | ^ +LL | impl UncheckedCopy for T {} + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::ops::Deref` is not satisfied --> $DIR/defaults-unsound-62211-2.rs:41:9 @@ -59,11 +58,10 @@ error[E0277]: the trait bound `T: std::ops::Deref` is not satisfied LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::ops::Deref` - --> $DIR/defaults-unsound-62211-2.rs:41:6 +help: consider restricting type parameter `T` | -LL | impl UncheckedCopy for T {} - | ^ +LL | impl UncheckedCopy for T {} + | ^^^^^^^^^^^^^^^^^ error[E0277]: cannot add-assign `&'static str` to `T` --> $DIR/defaults-unsound-62211-2.rs:41:9 @@ -72,11 +70,10 @@ LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ no implementation for `T += &'static str` | = help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `T` -help: consider restricting this type parameter with `T: std::ops::AddAssign<&'static str>` - --> $DIR/defaults-unsound-62211-2.rs:41:6 +help: consider restricting type parameter `T` | -LL | impl UncheckedCopy for T {} - | ^ +LL | impl> UncheckedCopy for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/defaults-unsound-62211-2.rs:41:9 @@ -84,11 +81,10 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/defaults-unsound-62211-2.rs:41:6 +help: consider restricting type parameter `T` | -LL | impl UncheckedCopy for T {} - | ^ +LL | impl UncheckedCopy for T {} + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/bad/bad-method-typaram-kind.stderr b/src/test/ui/bad/bad-method-typaram-kind.stderr index 9732363221286..81fc961e3dea0 100644 --- a/src/test/ui/bad/bad-method-typaram-kind.stderr +++ b/src/test/ui/bad/bad-method-typaram-kind.stderr @@ -5,11 +5,10 @@ LL | 1.bar::(); | ^^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/bad-method-typaram-kind.rs:1:10 +help: consider further restricting this bound | -LL | fn foo() { - | ^^^^^^^ +LL | fn foo() { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/binop/binop-consume-args.stderr b/src/test/ui/binop/binop-consume-args.stderr index 3fe7c9cbff420..acdc03e372638 100644 --- a/src/test/ui/binop/binop-consume-args.stderr +++ b/src/test/ui/binop/binop-consume-args.stderr @@ -8,11 +8,10 @@ LL | lhs + rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:5:11 +help: consider further restricting this bound | -LL | fn add, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^ +LL | fn add + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:8:10 @@ -25,11 +24,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:5:30 +help: consider restricting type parameter `B` | -LL | fn add, B>(lhs: A, rhs: B) { - | ^ +LL | fn add, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:13:10 @@ -41,11 +39,10 @@ LL | lhs - rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:11:11 +help: consider further restricting this bound | -LL | fn sub, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^ +LL | fn sub + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:14:10 @@ -58,11 +55,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:11:30 +help: consider restricting type parameter `B` | -LL | fn sub, B>(lhs: A, rhs: B) { - | ^ +LL | fn sub, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:19:10 @@ -74,11 +70,10 @@ LL | lhs * rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:17:11 +help: consider further restricting this bound | -LL | fn mul, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^ +LL | fn mul + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:20:10 @@ -91,11 +86,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:17:30 +help: consider restricting type parameter `B` | -LL | fn mul, B>(lhs: A, rhs: B) { - | ^ +LL | fn mul, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:25:10 @@ -107,11 +101,10 @@ LL | lhs / rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:23:11 +help: consider further restricting this bound | -LL | fn div, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^ +LL | fn div + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:26:10 @@ -124,11 +117,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:23:30 +help: consider restricting type parameter `B` | -LL | fn div, B>(lhs: A, rhs: B) { - | ^ +LL | fn div, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:31:10 @@ -140,11 +132,10 @@ LL | lhs % rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:29:11 +help: consider further restricting this bound | -LL | fn rem, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^ +LL | fn rem + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:32:10 @@ -157,11 +148,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:29:30 +help: consider restricting type parameter `B` | -LL | fn rem, B>(lhs: A, rhs: B) { - | ^ +LL | fn rem, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:37:10 @@ -173,11 +163,10 @@ LL | lhs & rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:35:14 +help: consider further restricting this bound | -LL | fn bitand, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^^^^ +LL | fn bitand + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:38:10 @@ -190,11 +179,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:35:36 +help: consider restricting type parameter `B` | -LL | fn bitand, B>(lhs: A, rhs: B) { - | ^ +LL | fn bitand, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:43:10 @@ -206,11 +194,10 @@ LL | lhs | rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:41:13 +help: consider further restricting this bound | -LL | fn bitor, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^^^ +LL | fn bitor + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:44:10 @@ -223,11 +210,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:41:34 +help: consider restricting type parameter `B` | -LL | fn bitor, B>(lhs: A, rhs: B) { - | ^ +LL | fn bitor, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:49:10 @@ -239,11 +225,10 @@ LL | lhs ^ rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:47:14 +help: consider further restricting this bound | -LL | fn bitxor, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^^^^ +LL | fn bitxor + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:50:10 @@ -256,11 +241,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:47:36 +help: consider restricting type parameter `B` | -LL | fn bitxor, B>(lhs: A, rhs: B) { - | ^ +LL | fn bitxor, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:55:10 @@ -272,11 +256,10 @@ LL | lhs << rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:53:11 +help: consider further restricting this bound | -LL | fn shl, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^ +LL | fn shl + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:56:10 @@ -289,11 +272,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:53:30 +help: consider restricting type parameter `B` | -LL | fn shl, B>(lhs: A, rhs: B) { - | ^ +LL | fn shl, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `lhs` --> $DIR/binop-consume-args.rs:61:10 @@ -305,11 +287,10 @@ LL | lhs >> rhs; LL | drop(lhs); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-consume-args.rs:59:11 +help: consider further restricting this bound | -LL | fn shr, B>(lhs: A, rhs: B) { - | ^^^^^^^^^^^^^^^^^ +LL | fn shr + Copy, B>(lhs: A, rhs: B) { + | ^^^^^^ error[E0382]: use of moved value: `rhs` --> $DIR/binop-consume-args.rs:62:10 @@ -322,11 +303,10 @@ LL | drop(lhs); LL | drop(rhs); | ^^^ value used here after move | -help: consider restricting this type parameter with `B: Copy` - --> $DIR/binop-consume-args.rs:59:30 +help: consider restricting type parameter `B` | -LL | fn shr, B>(lhs: A, rhs: B) { - | ^ +LL | fn shr, B: Copy>(lhs: A, rhs: B) { + | ^^^^^^ error: aborting due to 20 previous errors diff --git a/src/test/ui/binop/binop-move-semantics.stderr b/src/test/ui/binop/binop-move-semantics.stderr index 31b594eeab4bf..6d5ac9cab30c0 100644 --- a/src/test/ui/binop/binop-move-semantics.stderr +++ b/src/test/ui/binop/binop-move-semantics.stderr @@ -9,11 +9,10 @@ LL | + LL | x; | ^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-move-semantics.rs:5:19 +help: consider further restricting this bound | -LL | fn double_move>(x: T) { - | ^^^^^^^^^^^^^^ +LL | fn double_move + Copy>(x: T) { + | ^^^^^^ error[E0382]: borrow of moved value: `x` --> $DIR/binop-move-semantics.rs:14:5 @@ -26,11 +25,10 @@ LL | + LL | x.clone(); | ^ value borrowed here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/binop-move-semantics.rs:11:24 +help: consider further restricting this bound | -LL | fn move_then_borrow + Clone>(x: T) { - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | fn move_then_borrow + Clone + Copy>(x: T) { + | ^^^^^^ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/binop-move-semantics.rs:21:5 diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr index 33a0b0286dfe9..a51cda548efd7 100644 --- a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr +++ b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr @@ -26,11 +26,10 @@ LL | f(1, 2); LL | f(1, 2); | ^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/borrowck-unboxed-closures.rs:10:8 +help: consider further restricting this bound | -LL | fn c isize>(f: F) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn c isize + Copy>(f: F) { + | ^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/bound-suggestions.fixed b/src/test/ui/bound-suggestions.fixed index c77421c97e7c0..9c98200db5134 100644 --- a/src/test/ui/bound-suggestions.fixed +++ b/src/test/ui/bound-suggestions.fixed @@ -13,7 +13,7 @@ fn test_no_bounds(t: T) { } #[allow(dead_code)] -fn test_one_bound(t: T) { +fn test_one_bound(t: T) { println!("{:?}", t); //~^ ERROR doesn't implement } @@ -25,7 +25,7 @@ fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt: } #[allow(dead_code)] -fn test_one_bound_where(x: X) where X: std::fmt::Debug + Sized { +fn test_one_bound_where(x: X) where X: Sized + std::fmt::Debug { println!("{:?}", x); //~^ ERROR doesn't implement } diff --git a/src/test/ui/bound-suggestions.stderr b/src/test/ui/bound-suggestions.stderr index 1e85c2bf36e46..b9bc503f5301a 100644 --- a/src/test/ui/bound-suggestions.stderr +++ b/src/test/ui/bound-suggestions.stderr @@ -5,13 +5,12 @@ LL | println!("{:?}", t); | ^ `impl Sized` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | = help: the trait `std::fmt::Debug` is not implemented for `impl Sized` -help: consider further restricting this bound with `+ std::fmt::Debug` - --> $DIR/bound-suggestions.rs:4:17 - | -LL | fn test_impl(t: impl Sized) { - | ^^^^^^^^^^ = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting this bound + | +LL | fn test_impl(t: impl Sized + std::fmt::Debug) { + | ^^^^^^^^^^^^^^^^^ error[E0277]: `T` doesn't implement `std::fmt::Debug` --> $DIR/bound-suggestions.rs:11:22 @@ -20,13 +19,12 @@ LL | println!("{:?}", t); | ^ `T` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | = help: the trait `std::fmt::Debug` is not implemented for `T` -help: consider restricting this type parameter with `T: std::fmt::Debug` - --> $DIR/bound-suggestions.rs:10:19 - | -LL | fn test_no_bounds(t: T) { - | ^ = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider restricting type parameter `T` + | +LL | fn test_no_bounds(t: T) { + | ^^^^^^^^^^^^^^^^^ error[E0277]: `T` doesn't implement `std::fmt::Debug` --> $DIR/bound-suggestions.rs:17:22 @@ -35,13 +33,12 @@ LL | println!("{:?}", t); | ^ `T` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | = help: the trait `std::fmt::Debug` is not implemented for `T` -help: consider further restricting this bound with `+ std::fmt::Debug` - --> $DIR/bound-suggestions.rs:16:22 - | -LL | fn test_one_bound(t: T) { - | ^^^^^ = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting this bound + | +LL | fn test_one_bound(t: T) { + | ^^^^^^^^^^^^^^^^^ error[E0277]: `Y` doesn't implement `std::fmt::Debug` --> $DIR/bound-suggestions.rs:23:30 @@ -50,13 +47,12 @@ LL | println!("{:?} {:?}", x, y); | ^ `Y` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | = help: the trait `std::fmt::Debug` is not implemented for `Y` -help: consider restricting this type parameter with `where Y: std::fmt::Debug` - --> $DIR/bound-suggestions.rs:22:28 - | -LL | fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug { - | ^ = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting type parameter `Y` + | +LL | fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { + | ^^^^^^^^^^^^^^^^^^^^ error[E0277]: `X` doesn't implement `std::fmt::Debug` --> $DIR/bound-suggestions.rs:29:22 @@ -65,13 +61,12 @@ LL | println!("{:?}", x); | ^ `X` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | = help: the trait `std::fmt::Debug` is not implemented for `X` -help: consider further restricting this bound with `+ std::fmt::Debug` - --> $DIR/bound-suggestions.rs:28:40 - | -LL | fn test_one_bound_where(x: X) where X: Sized { - | ^^^^^^^^ = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting this bound + | +LL | fn test_one_bound_where(x: X) where X: Sized + std::fmt::Debug { + | ^^^^^^^^^^^^^^^^^ error[E0277]: `X` doesn't implement `std::fmt::Debug` --> $DIR/bound-suggestions.rs:35:22 @@ -80,13 +75,12 @@ LL | println!("{:?}", x); | ^ `X` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | = help: the trait `std::fmt::Debug` is not implemented for `X` -help: consider further restricting this type parameter with `where X: std::fmt::Debug` - --> $DIR/bound-suggestions.rs:34:27 - | -LL | fn test_many_bounds_where(x: X) where X: Sized, X: Sized { - | ^ = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting type parameter `X` + | +LL | fn test_many_bounds_where(x: X) where X: Sized, X: Sized, X: std::fmt::Debug { + | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr index a38705c834a37..ea5215e458d65 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr @@ -5,12 +5,11 @@ LL | impl Foo for (T,) { } | ^^^ `T` cannot be sent between threads safely | = help: within `(T,)`, the trait `std::marker::Send` is not implemented for `T` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/builtin-superkinds-double-superkind.rs:6:10 - | -LL | impl Foo for (T,) { } - | ^^^^^^^^^^^^ = note: required because it appears within the type `(T,)` +help: consider further restricting this bound + | +LL | impl Foo for (T,) { } + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `T` cannot be shared between threads safely --> $DIR/builtin-superkinds-double-superkind.rs:9:16 @@ -19,12 +18,11 @@ LL | impl Foo for (T,T) { } | ^^^ `T` cannot be shared between threads safely | = help: within `(T, T)`, the trait `std::marker::Sync` is not implemented for `T` -help: consider further restricting this bound with `+ std::marker::Sync` - --> $DIR/builtin-superkinds-double-superkind.rs:9:10 - | -LL | impl Foo for (T,T) { } - | ^^^^ = note: required because it appears within the type `(T, T)` +help: consider further restricting this bound + | +LL | impl Foo for (T,T) { } + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr index f379d97bd76c8..ba6595f68d5cc 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr @@ -5,12 +5,11 @@ LL | impl RequiresRequiresShareAndSend for X { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `T` cannot be sent between threads safely | = help: within `X`, the trait `std::marker::Send` is not implemented for `T` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/builtin-superkinds-in-metadata.rs:13:9 - | -LL | impl RequiresRequiresShareAndSend for X { } - | ^^^^^^^^^^^^ = note: required because it appears within the type `X` +help: consider further restricting this bound + | +LL | impl RequiresRequiresShareAndSend for X { } + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr index 996f39bfb665c..bef33d1fd05d3 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr @@ -5,11 +5,10 @@ LL | impl Foo for T { } | ^^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/builtin-superkinds-typaram-not-send.rs:5:10 +help: consider further restricting this bound | -LL | impl Foo for T { } - | ^^^^^^^^^^^^ +LL | impl Foo for T { } + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr index b4135af7d7755..f565948f479c3 100644 --- a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr +++ b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr @@ -8,11 +8,10 @@ LL | fn foo(blk: F) -> X where F: FnOnce() + 'static { | ^^^^ `F` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `F` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:5:33 +help: consider further restricting this bound | -LL | fn foo(blk: F) -> X where F: FnOnce() + 'static { - | ^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(blk: F) -> X where F: FnOnce() + 'static + std::marker::Send { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/closures/closure-bounds-subtype.stderr b/src/test/ui/closures/closure-bounds-subtype.stderr index 47504de814dbe..f746f8502b8c2 100644 --- a/src/test/ui/closures/closure-bounds-subtype.stderr +++ b/src/test/ui/closures/closure-bounds-subtype.stderr @@ -8,11 +8,10 @@ LL | take_const_owned(f); | ^ `F` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `F` -help: consider further restricting this bound with `+ std::marker::Sync` - --> $DIR/closure-bounds-subtype.rs:11:30 +help: consider further restricting this bound | -LL | fn give_owned(f: F) where F: FnOnce() + Send { - | ^^^^^^^^^^^^^^^^^^ +LL | fn give_owned(f: F) where F: FnOnce() + Send + std::marker::Sync { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/closures/issue-67123.stderr b/src/test/ui/closures/issue-67123.stderr index f14478d7278cd..5a6dfb2fdf946 100644 --- a/src/test/ui/closures/issue-67123.stderr +++ b/src/test/ui/closures/issue-67123.stderr @@ -6,12 +6,11 @@ LL | || { t; t; }; | | | value moved here | -help: consider restricting this type parameter with `T: Copy` - --> $DIR/issue-67123.rs:1:8 - | -LL | fn foo(t: T) { - | ^ = note: move occurs because `t` has type `T`, which does not implement the `Copy` trait +help: consider restricting type parameter `T` + | +LL | fn foo(t: T) { + | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-61336-2.stderr b/src/test/ui/const-generics/issues/issue-61336-2.stderr index 9ced427b93c65..ef9e3b86694a8 100644 --- a/src/test/ui/const-generics/issues/issue-61336-2.stderr +++ b/src/test/ui/const-generics/issues/issue-61336-2.stderr @@ -12,12 +12,11 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | [x; { N }] | ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/issue-61336-2.rs:8:6 - | -LL | fn g(x: T) -> [T; N] { - | ^ = note: the `Copy` trait is required because the repeated element will be copied +help: consider restricting type parameter `T` + | +LL | fn g(x: T) -> [T; N] { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-61336.stderr b/src/test/ui/const-generics/issues/issue-61336.stderr index ace7955fbdd77..88d81c66d1ffe 100644 --- a/src/test/ui/const-generics/issues/issue-61336.stderr +++ b/src/test/ui/const-generics/issues/issue-61336.stderr @@ -12,12 +12,11 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | [x; N] | ^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/issue-61336.rs:8:6 - | -LL | fn g(x: T) -> [T; N] { - | ^ = note: the `Copy` trait is required because the repeated element will be copied +help: consider restricting type parameter `T` + | +LL | fn g(x: T) -> [T; N] { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/const-match-check.eval1.stderr b/src/test/ui/consts/const-match-check.eval1.stderr index 087cc3c86a68d..3850b1d82bf5b 100644 --- a/src/test/ui/consts/const-match-check.eval1.stderr +++ b/src/test/ui/consts/const-match-check.eval1.stderr @@ -6,6 +6,7 @@ LL | A = { let 0 = 0; 0 }, | = 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 `i32` help: you might want to use `if let` to ignore the variant that isn't matched | LL | A = { if let 0 = 0 { /* */ } 0 }, diff --git a/src/test/ui/consts/const-match-check.eval2.stderr b/src/test/ui/consts/const-match-check.eval2.stderr index 80d9f794bc1d5..4e1d50f42d461 100644 --- a/src/test/ui/consts/const-match-check.eval2.stderr +++ b/src/test/ui/consts/const-match-check.eval2.stderr @@ -6,6 +6,7 @@ LL | let x: [i32; { let 0 = 0; 0 }] = []; | = 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 `i32` help: you might want to use `if let` to ignore the variant that isn't matched | LL | let x: [i32; { if let 0 = 0 { /* */ } 0 }] = []; diff --git a/src/test/ui/consts/const-match-check.matchck.stderr b/src/test/ui/consts/const-match-check.matchck.stderr index e6b2f212bb430..2aabc0ca494cb 100644 --- a/src/test/ui/consts/const-match-check.matchck.stderr +++ b/src/test/ui/consts/const-match-check.matchck.stderr @@ -6,6 +6,7 @@ LL | const X: i32 = { let 0 = 0; 0 }; | = 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 `i32` help: you might want to use `if let` to ignore the variant that isn't matched | LL | const X: i32 = { if let 0 = 0 { /* */ } 0 }; @@ -19,6 +20,7 @@ LL | static Y: i32 = { let 0 = 0; 0 }; | = 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 `i32` help: you might want to use `if let` to ignore the variant that isn't matched | LL | static Y: i32 = { if let 0 = 0 { /* */ } 0 }; @@ -32,6 +34,7 @@ LL | const X: i32 = { let 0 = 0; 0 }; | = 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 `i32` help: you might want to use `if let` to ignore the variant that isn't matched | LL | const X: i32 = { if let 0 = 0 { /* */ } 0 }; @@ -45,6 +48,7 @@ LL | const X: i32 = { let 0 = 0; 0 }; | = 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 `i32` help: you might want to use `if let` to ignore the variant that isn't matched | LL | const X: i32 = { if let 0 = 0 { /* */ } 0 }; diff --git a/src/test/ui/consts/const-pattern-irrefutable.stderr b/src/test/ui/consts/const-pattern-irrefutable.stderr index 4814aa9a5b2ca..863e1372a9b8a 100644 --- a/src/test/ui/consts/const-pattern-irrefutable.stderr +++ b/src/test/ui/consts/const-pattern-irrefutable.stderr @@ -9,6 +9,8 @@ LL | let a = 4; | | | interpreted as a constant pattern, not a new variable | help: introduce a variable instead: `a_var` + | + = note: the matched value is of type `u8` error[E0005]: refutable pattern in local binding: `0u8..=1u8` and `3u8..=std::u8::MAX` not covered --> $DIR/const-pattern-irrefutable.rs:13:9 @@ -21,6 +23,8 @@ LL | let c = 4; | | | interpreted as a constant pattern, not a new variable | help: introduce a variable instead: `c_var` + | + = note: the matched value is of type `u8` error[E0005]: refutable pattern in local binding: `0u8..=1u8` and `3u8..=std::u8::MAX` not covered --> $DIR/const-pattern-irrefutable.rs:14:9 @@ -33,6 +37,8 @@ LL | let d = 4; | | | interpreted as a constant pattern, not a new variable | help: introduce a variable instead: `d_var` + | + = note: the matched value is of type `u8` error: aborting due to 3 previous errors diff --git a/src/test/ui/consts/const_let_refutable.stderr b/src/test/ui/consts/const_let_refutable.stderr index 0ba79e5f71a2e..02296e6de75fc 100644 --- a/src/test/ui/consts/const_let_refutable.stderr +++ b/src/test/ui/consts/const_let_refutable.stderr @@ -3,6 +3,8 @@ error[E0005]: refutable pattern in function argument: `&[]`, `&[_]` and `&[_, _, | LL | const fn slice(&[a, b]: &[i32]) -> i32 { | ^^^^^^^ patterns `&[]`, `&[_]` and `&[_, _, _, ..]` not covered + | + = note: the matched value is of type `&[i32]` error[E0723]: loops and conditional expressions are not stable in const fn --> $DIR/const_let_refutable.rs:3:17 diff --git a/src/test/ui/consts/match_ice.stderr b/src/test/ui/consts/match_ice.stderr index b25ac09ab1211..5477170fb1e41 100644 --- a/src/test/ui/consts/match_ice.stderr +++ b/src/test/ui/consts/match_ice.stderr @@ -14,6 +14,7 @@ LL | match K { | ^ pattern `&T` 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 `&T` error: to use a constant of type `S` in a pattern, `S` must be annotated with `#[derive(PartialEq, Eq)]` --> $DIR/match_ice.rs:11:9 diff --git a/src/test/ui/empty/empty-never-array.stderr b/src/test/ui/empty/empty-never-array.stderr index a4ffceea4c97f..64d640c0e9dbc 100644 --- a/src/test/ui/empty/empty-never-array.stderr +++ b/src/test/ui/empty/empty-never-array.stderr @@ -14,6 +14,7 @@ LL | let Helper::U(u) = Helper::T(t, []); | = 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 `Helper` help: you might want to use `if let` to ignore the variant that isn't matched | LL | if let Helper::U(u) = Helper::T(t, []) { /* */ } diff --git a/src/test/ui/error-codes/E0004-2.stderr b/src/test/ui/error-codes/E0004-2.stderr index e47a4fa755cac..fcc44b7635c1a 100644 --- a/src/test/ui/error-codes/E0004-2.stderr +++ b/src/test/ui/error-codes/E0004-2.stderr @@ -13,6 +13,7 @@ LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), | ---- 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::option::Option` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0004.stderr b/src/test/ui/error-codes/E0004.stderr index 2940ad4bb1e2d..5bf375a64843a 100644 --- a/src/test/ui/error-codes/E0004.stderr +++ b/src/test/ui/error-codes/E0004.stderr @@ -12,6 +12,7 @@ LL | match x { | ^ pattern `HastaLaVistaBaby` 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 `Terminator` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0005.stderr b/src/test/ui/error-codes/E0005.stderr index 192b994403191..d43dc6fd6494e 100644 --- a/src/test/ui/error-codes/E0005.stderr +++ b/src/test/ui/error-codes/E0005.stderr @@ -11,6 +11,7 @@ LL | None, | = 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::option::Option` help: you might want to use `if let` to ignore the variant that isn't matched | LL | if let Some(y) = x { /* */ } diff --git a/src/test/ui/error-codes/E0297.stderr b/src/test/ui/error-codes/E0297.stderr index 4a75e9d1771f3..3ad841875e691 100644 --- a/src/test/ui/error-codes/E0297.stderr +++ b/src/test/ui/error-codes/E0297.stderr @@ -8,6 +8,8 @@ LL | for Some(x) in xs {} | LL | None, | ---- not covered + | + = note: the matched value is of type `std::option::Option` error: aborting due to previous error 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 c2dd90b91e700..06c2e6e519235 100644 --- a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr +++ b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr @@ -11,6 +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` 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/feature-gates/feature-gate-precise_pointer_size_matching.stderr b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr index 12b796d2e60a1..6c5d0091c5add 100644 --- a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr +++ b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr @@ -5,6 +5,7 @@ LL | match 0usize { | ^^^^^^ pattern `_` 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 `usize` error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/feature-gate-precise_pointer_size_matching.rs:10:11 @@ -13,6 +14,7 @@ LL | match 0isize { | ^^^^^^ pattern `_` 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 `isize` error: aborting due to 2 previous errors diff --git a/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr b/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr index 14aea2dc27eea..ce12b7853b6c1 100644 --- a/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr +++ b/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr @@ -3,6 +3,8 @@ error[E0005]: refutable pattern in `for` loop binding: `&std::i32::MIN..=0i32` a | LL | for &1 in [1].iter() {} | ^^ patterns `&std::i32::MIN..=0i32` and `&2i32..=std::i32::MAX` not covered + | + = note: the matched value is of type `&i32` error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/impl_bounds.stderr b/src/test/ui/generic-associated-types/impl_bounds.stderr index 486b538045e49..d5560c8133773 100644 --- a/src/test/ui/generic-associated-types/impl_bounds.stderr +++ b/src/test/ui/generic-associated-types/impl_bounds.stderr @@ -34,13 +34,12 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | type C where Self: Copy = String; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/impl_bounds.rs:14:6 - | -LL | impl Foo for Fooy { - | ^ = note: required because of the requirements on the impl of `std::marker::Copy` for `Fooy` = note: the requirement `Fooy: std::marker::Copy` appears on the associated impl type but not on the corresponding associated trait type +help: consider restricting type parameter `T` + | +LL | impl Foo for Fooy { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr b/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr index 26d0cf9e9ecba..6c7a0cdb77adf 100644 --- a/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr +++ b/src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr @@ -5,6 +5,7 @@ LL | m!(0f32, core::f32::NEG_INFINITY..); | ^^^^ pattern `_` 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 `f32` error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:17:8 @@ -13,6 +14,7 @@ LL | m!(0f32, ..core::f32::INFINITY); | ^^^^ pattern `_` 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 `f32` error[E0004]: non-exhaustive patterns: `'\u{10ffff}'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:26:8 @@ -21,6 +23,7 @@ LL | m!('a', ..core::char::MAX); | ^^^ pattern `'\u{10ffff}'` 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 `char` error[E0004]: non-exhaustive patterns: `'\u{10fffe}'..='\u{10ffff}'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:27:8 @@ -29,6 +32,7 @@ LL | m!('a', ..ALMOST_MAX); | ^^^ pattern `'\u{10fffe}'..='\u{10ffff}'` 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 `char` error[E0004]: non-exhaustive patterns: `'\u{0}'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:28:8 @@ -37,6 +41,7 @@ LL | m!('a', ALMOST_MIN..); | ^^^ pattern `'\u{0}'` 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 `char` error[E0004]: non-exhaustive patterns: `'\u{10ffff}'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:29:8 @@ -45,6 +50,7 @@ LL | m!('a', ..=ALMOST_MAX); | ^^^ pattern `'\u{10ffff}'` 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 `char` error[E0004]: non-exhaustive patterns: `'b'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:30:8 @@ -53,6 +59,7 @@ LL | m!('a', ..=VAL | VAL_2..); | ^^^ pattern `'b'` 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 `char` error[E0004]: non-exhaustive patterns: `'b'` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:31:8 @@ -61,6 +68,7 @@ LL | m!('a', ..VAL_1 | VAL_2..); | ^^^ pattern `'b'` 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 `char` error[E0004]: non-exhaustive patterns: `std::u8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:41:12 @@ -69,6 +77,7 @@ LL | m!(0, ..core::u8::MAX); | ^ pattern `std::u8::MAX` 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 `u8` error[E0004]: non-exhaustive patterns: `254u8..=std::u8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:42:12 @@ -77,6 +86,7 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `254u8..=std::u8::MAX` 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 `u8` error[E0004]: non-exhaustive patterns: `0u8` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:43:12 @@ -85,6 +95,7 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `0u8` 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 `u8` error[E0004]: non-exhaustive patterns: `std::u8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:44:12 @@ -93,6 +104,7 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `std::u8::MAX` 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 `u8` error[E0004]: non-exhaustive patterns: `43u8` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:45:12 @@ -101,6 +113,7 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43u8` 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 `u8` error[E0004]: non-exhaustive patterns: `43u8` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:46:12 @@ -109,6 +122,7 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43u8` 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 `u8` error[E0004]: non-exhaustive patterns: `std::u16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:54:12 @@ -117,6 +131,7 @@ LL | m!(0, ..core::u16::MAX); | ^ pattern `std::u16::MAX` 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 `u16` error[E0004]: non-exhaustive patterns: `65534u16..=std::u16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:55:12 @@ -125,6 +140,7 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `65534u16..=std::u16::MAX` 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 `u16` error[E0004]: non-exhaustive patterns: `0u16` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:56:12 @@ -133,6 +149,7 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `0u16` 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 `u16` error[E0004]: non-exhaustive patterns: `std::u16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:57:12 @@ -141,6 +158,7 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `std::u16::MAX` 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 `u16` error[E0004]: non-exhaustive patterns: `43u16` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:58:12 @@ -149,6 +167,7 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43u16` 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 `u16` error[E0004]: non-exhaustive patterns: `43u16` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:59:12 @@ -157,6 +176,7 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43u16` 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 `u16` error[E0004]: non-exhaustive patterns: `std::u32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:67:12 @@ -165,6 +185,7 @@ LL | m!(0, ..core::u32::MAX); | ^ pattern `std::u32::MAX` 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 `u32` error[E0004]: non-exhaustive patterns: `4294967294u32..=std::u32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:68:12 @@ -173,6 +194,7 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `4294967294u32..=std::u32::MAX` 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 `u32` error[E0004]: non-exhaustive patterns: `0u32` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:69:12 @@ -181,6 +203,7 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `0u32` 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 `u32` error[E0004]: non-exhaustive patterns: `std::u32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:70:12 @@ -189,6 +212,7 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `std::u32::MAX` 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 `u32` error[E0004]: non-exhaustive patterns: `43u32` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:71:12 @@ -197,6 +221,7 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43u32` 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 `u32` error[E0004]: non-exhaustive patterns: `43u32` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:72:12 @@ -205,6 +230,7 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43u32` 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 `u32` error[E0004]: non-exhaustive patterns: `std::u64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:80:12 @@ -213,6 +239,7 @@ LL | m!(0, ..core::u64::MAX); | ^ pattern `std::u64::MAX` 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 `u64` error[E0004]: non-exhaustive patterns: `18446744073709551614u64..=std::u64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:81:12 @@ -221,6 +248,7 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `18446744073709551614u64..=std::u64::MAX` 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 `u64` error[E0004]: non-exhaustive patterns: `0u64` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:82:12 @@ -229,6 +257,7 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `0u64` 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 `u64` error[E0004]: non-exhaustive patterns: `std::u64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:83:12 @@ -237,6 +266,7 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `std::u64::MAX` 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 `u64` error[E0004]: non-exhaustive patterns: `43u64` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:84:12 @@ -245,6 +275,7 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43u64` 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 `u64` error[E0004]: non-exhaustive patterns: `43u64` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:85:12 @@ -253,6 +284,7 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43u64` 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 `u64` error[E0004]: non-exhaustive patterns: `std::u128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:93:12 @@ -261,6 +293,7 @@ LL | m!(0, ..core::u128::MAX); | ^ pattern `std::u128::MAX` 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 `u128` error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211454u128..=std::u128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:94:12 @@ -269,6 +302,7 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `340282366920938463463374607431768211454u128..=std::u128::MAX` 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 `u128` error[E0004]: non-exhaustive patterns: `0u128` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:95:12 @@ -277,6 +311,7 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `0u128` 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 `u128` error[E0004]: non-exhaustive patterns: `std::u128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:96:12 @@ -285,6 +320,7 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `std::u128::MAX` 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 `u128` error[E0004]: non-exhaustive patterns: `43u128` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:97:12 @@ -293,6 +329,7 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43u128` 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 `u128` error[E0004]: non-exhaustive patterns: `43u128` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:98:12 @@ -301,6 +338,7 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43u128` 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 `u128` error[E0004]: non-exhaustive patterns: `std::i8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:109:12 @@ -309,6 +347,7 @@ LL | m!(0, ..core::i8::MAX); | ^ pattern `std::i8::MAX` 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 `i8` error[E0004]: non-exhaustive patterns: `126i8..=std::i8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:110:12 @@ -317,6 +356,7 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `126i8..=std::i8::MAX` 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 `i8` error[E0004]: non-exhaustive patterns: `std::i8::MIN` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:111:12 @@ -325,6 +365,7 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `std::i8::MIN` 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 `i8` error[E0004]: non-exhaustive patterns: `std::i8::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:112:12 @@ -333,6 +374,7 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `std::i8::MAX` 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 `i8` error[E0004]: non-exhaustive patterns: `43i8` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:113:12 @@ -341,6 +383,7 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43i8` 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 `i8` error[E0004]: non-exhaustive patterns: `43i8` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:114:12 @@ -349,6 +392,7 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43i8` 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 `i8` error[E0004]: non-exhaustive patterns: `std::i16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:122:12 @@ -357,6 +401,7 @@ LL | m!(0, ..core::i16::MAX); | ^ pattern `std::i16::MAX` 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 `i16` error[E0004]: non-exhaustive patterns: `32766i16..=std::i16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:123:12 @@ -365,6 +410,7 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `32766i16..=std::i16::MAX` 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 `i16` error[E0004]: non-exhaustive patterns: `std::i16::MIN` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:124:12 @@ -373,6 +419,7 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `std::i16::MIN` 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 `i16` error[E0004]: non-exhaustive patterns: `std::i16::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:125:12 @@ -381,6 +428,7 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `std::i16::MAX` 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 `i16` error[E0004]: non-exhaustive patterns: `43i16` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:126:12 @@ -389,6 +437,7 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43i16` 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 `i16` error[E0004]: non-exhaustive patterns: `43i16` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:127:12 @@ -397,6 +446,7 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43i16` 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 `i16` error[E0004]: non-exhaustive patterns: `std::i32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:135:12 @@ -405,6 +455,7 @@ LL | m!(0, ..core::i32::MAX); | ^ pattern `std::i32::MAX` 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 `i32` error[E0004]: non-exhaustive patterns: `2147483646i32..=std::i32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:136:12 @@ -413,6 +464,7 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `2147483646i32..=std::i32::MAX` 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 `i32` error[E0004]: non-exhaustive patterns: `std::i32::MIN` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:137:12 @@ -421,6 +473,7 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `std::i32::MIN` 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 `i32` error[E0004]: non-exhaustive patterns: `std::i32::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:138:12 @@ -429,6 +482,7 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `std::i32::MAX` 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 `i32` error[E0004]: non-exhaustive patterns: `43i32` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:139:12 @@ -437,6 +491,7 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43i32` 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 `i32` error[E0004]: non-exhaustive patterns: `43i32` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:140:12 @@ -445,6 +500,7 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43i32` 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 `i32` error[E0004]: non-exhaustive patterns: `std::i64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:148:12 @@ -453,6 +509,7 @@ LL | m!(0, ..core::i64::MAX); | ^ pattern `std::i64::MAX` 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 `i64` error[E0004]: non-exhaustive patterns: `9223372036854775806i64..=std::i64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:149:12 @@ -461,6 +518,7 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `9223372036854775806i64..=std::i64::MAX` 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 `i64` error[E0004]: non-exhaustive patterns: `std::i64::MIN` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:150:12 @@ -469,6 +527,7 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `std::i64::MIN` 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 `i64` error[E0004]: non-exhaustive patterns: `std::i64::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:151:12 @@ -477,6 +536,7 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `std::i64::MAX` 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 `i64` error[E0004]: non-exhaustive patterns: `43i64` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:152:12 @@ -485,6 +545,7 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43i64` 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 `i64` error[E0004]: non-exhaustive patterns: `43i64` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:153:12 @@ -493,6 +554,7 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43i64` 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 `i64` error[E0004]: non-exhaustive patterns: `std::i128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:161:12 @@ -501,6 +563,7 @@ LL | m!(0, ..core::i128::MAX); | ^ pattern `std::i128::MAX` 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 `i128` error[E0004]: non-exhaustive patterns: `170141183460469231731687303715884105726i128..=std::i128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:162:12 @@ -509,6 +572,7 @@ LL | m!(0, ..ALMOST_MAX); | ^ pattern `170141183460469231731687303715884105726i128..=std::i128::MAX` 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 `i128` error[E0004]: non-exhaustive patterns: `std::i128::MIN` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:163:12 @@ -517,6 +581,7 @@ LL | m!(0, ALMOST_MIN..); | ^ pattern `std::i128::MIN` 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 `i128` error[E0004]: non-exhaustive patterns: `std::i128::MAX` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:164:12 @@ -525,6 +590,7 @@ LL | m!(0, ..=ALMOST_MAX); | ^ pattern `std::i128::MAX` 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 `i128` error[E0004]: non-exhaustive patterns: `43i128` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:165:12 @@ -533,6 +599,7 @@ LL | m!(0, ..=VAL | VAL_2..); | ^ pattern `43i128` 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 `i128` error[E0004]: non-exhaustive patterns: `43i128` not covered --> $DIR/half-open-range-pats-exhaustive-fail.rs:166:12 @@ -541,6 +608,7 @@ LL | m!(0, ..VAL_1 | VAL_2..); | ^ pattern `43i128` 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 `i128` error: aborting due to 68 previous errors diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr index 6307a9b380ebf..268ff057421fe 100644 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr +++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr @@ -9,11 +9,10 @@ LL | where B : for<'ccx> Bar<'ccx> LL | want_bar_for_any_ccx(b); | ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` | -help: consider further restricting this bound with `+ for<'ccx> Bar<'ccx>` - --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:44:11 +help: consider further restricting this bound | -LL | where B : Qux - | ^^^^^^^ +LL | where B : Qux + for<'ccx> Bar<'ccx> + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr index 762c7c05f7ae8..2e20d2fe6dda3 100644 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr +++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr @@ -9,11 +9,10 @@ LL | fn want_foo_for_any_tcx(f: &F) LL | where F : for<'tcx> Foo<'tcx> | ------------------- required by this bound in `want_foo_for_any_tcx` | -help: consider further restricting this bound with `+ for<'tcx> Foo<'tcx>` - --> $DIR/hrtb-higher-ranker-supertraits.rs:15:11 +help: consider further restricting this bound | -LL | where F : Foo<'x> - | ^^^^^^^^^^^ +LL | where F : Foo<'x> + for<'tcx> Foo<'tcx> + | ^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied --> $DIR/hrtb-higher-ranker-supertraits.rs:35:26 @@ -26,11 +25,10 @@ LL | fn want_bar_for_any_ccx(b: &B) LL | where B : for<'ccx> Bar<'ccx> | ------------------- required by this bound in `want_bar_for_any_ccx` | -help: consider further restricting this bound with `+ for<'ccx> Bar<'ccx>` - --> $DIR/hrtb-higher-ranker-supertraits.rs:29:11 +help: consider further restricting this bound | -LL | where B : Bar<'x> - | ^^^^^^^^^^^ +LL | where B : Bar<'x> + for<'ccx> Bar<'ccx> + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/impl-trait/issue-55872-1.stderr b/src/test/ui/impl-trait/issue-55872-1.stderr index d62b8b1c253ea..6cb2c9fb892f3 100644 --- a/src/test/ui/impl-trait/issue-55872-1.stderr +++ b/src/test/ui/impl-trait/issue-55872-1.stderr @@ -4,13 +4,12 @@ error[E0277]: the trait bound `S: std::marker::Copy` is not satisfied in `(S, T) LL | type E = impl Copy; | ^^^^^^^^^^^^^^^^^^^ within `(S, T)`, the trait `std::marker::Copy` is not implemented for `S` | -help: consider further restricting this bound with `+ std::marker::Copy` - --> $DIR/issue-55872-1.rs:11:9 - | -LL | impl Bar for S { - | ^^^^^^^ = note: required because it appears within the type `(S, T)` = note: the return type of a function must have a statically known size +help: consider further restricting this bound + | +LL | impl Bar for S { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied in `(S, T)` --> $DIR/issue-55872-1.rs:12:5 @@ -18,13 +17,12 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied in `(S, T) LL | type E = impl Copy; | ^^^^^^^^^^^^^^^^^^^ within `(S, T)`, the trait `std::marker::Copy` is not implemented for `T` | -help: consider further restricting this bound with `+ std::marker::Copy` - --> $DIR/issue-55872-1.rs:16:15 - | -LL | fn foo() -> Self::E { - | ^^^^^^^ = note: required because it appears within the type `(S, T)` = note: the return type of a function must have a statically known size +help: consider further restricting this bound + | +LL | fn foo() -> Self::E { + | ^^^^^^^^^^^^^^^^^^^ error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias --> $DIR/issue-55872-1.rs:16:37 diff --git a/src/test/ui/issues/issue-15129.stderr b/src/test/ui/issues/issue-15129.stderr index b93fa14db0387..aa4434e72b5c7 100644 --- a/src/test/ui/issues/issue-15129.stderr +++ b/src/test/ui/issues/issue-15129.stderr @@ -5,6 +5,7 @@ LL | match (T::T1(()), V::V2(true)) { | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `(T1(()), V2(_))` 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 `(T, V)` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-15381.stderr b/src/test/ui/issues/issue-15381.stderr index 35f46ab57279c..c4667ce1c8ba1 100644 --- a/src/test/ui/issues/issue-15381.stderr +++ b/src/test/ui/issues/issue-15381.stderr @@ -3,6 +3,8 @@ error[E0005]: refutable pattern in `for` loop binding: `&[]`, `&[_]`, `&[_, _]` | LL | for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) { | ^^^^^^^^ patterns `&[]`, `&[_]`, `&[_, _]` and 1 more not covered + | + = note: the matched value is of type `&[u8]` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2111.stderr b/src/test/ui/issues/issue-2111.stderr index 90fdb48ea625d..aab2559a155ae 100644 --- a/src/test/ui/issues/issue-2111.stderr +++ b/src/test/ui/issues/issue-2111.stderr @@ -5,6 +5,7 @@ LL | match (a,b) { | ^^^^^ pattern `(None, None)` 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::option::Option, std::option::Option)` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-21837.stderr b/src/test/ui/issues/issue-21837.stderr index cfc294b5fa2d7..ff0c1ca64e2cc 100644 --- a/src/test/ui/issues/issue-21837.stderr +++ b/src/test/ui/issues/issue-21837.stderr @@ -7,11 +7,10 @@ LL | pub struct Foo(T); LL | impl Trait2 for Foo {} | ^^^^^^ the trait `Bound` is not implemented for `T` | -help: consider restricting this type parameter with `T: Bound` - --> $DIR/issue-21837.rs:8:6 +help: consider restricting type parameter `T` | -LL | impl Trait2 for Foo {} - | ^ +LL | impl Trait2 for Foo {} + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-30240.stderr b/src/test/ui/issues/issue-30240.stderr index 8b683b4af65cd..a2c58d6e051b5 100644 --- a/src/test/ui/issues/issue-30240.stderr +++ b/src/test/ui/issues/issue-30240.stderr @@ -5,6 +5,7 @@ LL | match "world" { | ^^^^^^^ pattern `&_` 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 `&str` error[E0004]: non-exhaustive patterns: `&_` not covered --> $DIR/issue-30240.rs:6:11 @@ -13,6 +14,7 @@ LL | match "world" { | ^^^^^^^ pattern `&_` 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 `&str` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-3096-1.stderr b/src/test/ui/issues/issue-3096-1.stderr index c5a7fa7e0eb83..97c34755189de 100644 --- a/src/test/ui/issues/issue-3096-1.stderr +++ b/src/test/ui/issues/issue-3096-1.stderr @@ -5,6 +5,7 @@ LL | match () { } | ^^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `()` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3096-2.stderr b/src/test/ui/issues/issue-3096-2.stderr index 6f2e0e760d7f6..472d1a91e6a15 100644 --- a/src/test/ui/issues/issue-3096-2.stderr +++ b/src/test/ui/issues/issue-3096-2.stderr @@ -5,6 +5,7 @@ LL | match x { } | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `*const Bottom` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-31561.stderr b/src/test/ui/issues/issue-31561.stderr index d3c8e876b8a88..2f562b23692de 100644 --- a/src/test/ui/issues/issue-31561.stderr +++ b/src/test/ui/issues/issue-31561.stderr @@ -15,6 +15,7 @@ LL | let Thing::Foo(y) = Thing::Foo(1); | = 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 `Thing` help: you might want to use `if let` to ignore the variant that isn't matched | LL | if let Thing::Foo(y) = Thing::Foo(1) { /* */ } diff --git a/src/test/ui/issues/issue-34721.fixed b/src/test/ui/issues/issue-34721.fixed index ba2810ee3d725..f135ad3836ea1 100644 --- a/src/test/ui/issues/issue-34721.fixed +++ b/src/test/ui/issues/issue-34721.fixed @@ -18,7 +18,7 @@ pub mod bar { mod baz { use bar; use Foo; - pub fn baz(x: T) -> T { + pub fn baz(x: T) -> T { if 0 == 1 { bar::bar(x.zero()) } else { diff --git a/src/test/ui/issues/issue-34721.stderr b/src/test/ui/issues/issue-34721.stderr index 5c51d0444461a..6cfed20f43a04 100644 --- a/src/test/ui/issues/issue-34721.stderr +++ b/src/test/ui/issues/issue-34721.stderr @@ -13,11 +13,10 @@ LL | }; LL | x.zero() | ^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/issue-34721.rs:21:19 +help: consider further restricting this bound | -LL | pub fn baz(x: T) -> T { - | ^^^ +LL | pub fn baz(x: T) -> T { + | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3601.stderr b/src/test/ui/issues/issue-3601.stderr index 445eb4107d1df..6b2a5d76243d8 100644 --- a/src/test/ui/issues/issue-3601.stderr +++ b/src/test/ui/issues/issue-3601.stderr @@ -5,6 +5,7 @@ LL | box NodeKind::Element(ed) => match ed.kind { | ^^^^^^^ pattern `Box(_)` 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::boxed::Box` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-39362.stderr b/src/test/ui/issues/issue-39362.stderr index 55cd14a5c1e08..8c162e55619e0 100644 --- a/src/test/ui/issues/issue-39362.stderr +++ b/src/test/ui/issues/issue-39362.stderr @@ -10,6 +10,7 @@ LL | match f { | ^ patterns `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more 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 `Foo` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-4321.stderr b/src/test/ui/issues/issue-4321.stderr index afb4fe775d58c..1e8852556b161 100644 --- a/src/test/ui/issues/issue-4321.stderr +++ b/src/test/ui/issues/issue-4321.stderr @@ -5,6 +5,7 @@ LL | println!("foo {:}", match tup { | ^^^ pattern `(true, false)` 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 `(bool, bool)` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-43784-associated-type.stderr b/src/test/ui/issues/issue-43784-associated-type.stderr index 2f50a53f26c77..21cd39d01fa25 100644 --- a/src/test/ui/issues/issue-43784-associated-type.stderr +++ b/src/test/ui/issues/issue-43784-associated-type.stderr @@ -9,11 +9,10 @@ LL | impl Complete for T { LL | type Assoc = T; | ^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/issue-43784-associated-type.rs:13:6 +help: consider restricting type parameter `T` | -LL | impl Complete for T { - | ^ +LL | impl Complete for T { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-43784-supertrait.stderr b/src/test/ui/issues/issue-43784-supertrait.stderr index 1795db32a57bd..2fb0583ee7d59 100644 --- a/src/test/ui/issues/issue-43784-supertrait.stderr +++ b/src/test/ui/issues/issue-43784-supertrait.stderr @@ -4,11 +4,10 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | impl Complete for T {} | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/issue-43784-supertrait.rs:8:6 +help: consider restricting type parameter `T` | -LL | impl Complete for T {} - | ^ +LL | impl Complete for T {} + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/kindck/kindck-impl-type-params.stderr b/src/test/ui/kindck/kindck-impl-type-params.stderr index 42318623b4d24..cc98f1d9f34b8 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params.stderr @@ -5,13 +5,12 @@ LL | let a = &t as &dyn Gettable; | ^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` -help: consider restricting this type parameter with `T: std::marker::Send` - --> $DIR/kindck-impl-type-params.rs:16:6 - | -LL | fn f(val: T) { - | ^ = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` +help: consider restricting type parameter `T` + | +LL | fn f(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:18:13 @@ -19,13 +18,12 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | let a = &t as &dyn Gettable; | ^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/kindck-impl-type-params.rs:16:6 - | -LL | fn f(val: T) { - | ^ = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` +help: consider restricting type parameter `T` + | +LL | fn f(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `T` cannot be sent between threads safely --> $DIR/kindck-impl-type-params.rs:25:31 @@ -34,13 +32,12 @@ LL | let a: &dyn Gettable = &t; | ^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` -help: consider restricting this type parameter with `T: std::marker::Send` - --> $DIR/kindck-impl-type-params.rs:23:6 - | -LL | fn g(val: T) { - | ^ = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` +help: consider restricting type parameter `T` + | +LL | fn g(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:25:31 @@ -48,13 +45,12 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied LL | let a: &dyn Gettable = &t; | ^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/kindck-impl-type-params.rs:23:6 - | -LL | fn g(val: T) { - | ^ = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` +help: consider restricting type parameter `T` + | +LL | fn g(val: T) { + | ^^^^^^^^^^^^^^^^^^^ error[E0477]: the type `&'a isize` does not fulfill the required lifetime --> $DIR/kindck-impl-type-params.rs:32:13 diff --git a/src/test/ui/macros/issue-34421-mac-expr-bad-stmt-good-add-semi.rs b/src/test/ui/macros/issue-34421-mac-expr-bad-stmt-good-add-semi.rs new file mode 100644 index 0000000000000..d78139365549a --- /dev/null +++ b/src/test/ui/macros/issue-34421-mac-expr-bad-stmt-good-add-semi.rs @@ -0,0 +1,15 @@ +macro_rules! make_item { + ($a:ident) => { + struct $a; + }; //~^ ERROR expected expression + //~| ERROR expected expression +} + +fn a() { + make_item!(A) +} +fn b() { + make_item!(B) +} + +fn main() {} diff --git a/src/test/ui/macros/issue-34421-mac-expr-bad-stmt-good-add-semi.stderr b/src/test/ui/macros/issue-34421-mac-expr-bad-stmt-good-add-semi.stderr new file mode 100644 index 0000000000000..c8d69640071c6 --- /dev/null +++ b/src/test/ui/macros/issue-34421-mac-expr-bad-stmt-good-add-semi.stderr @@ -0,0 +1,34 @@ +error: expected expression, found keyword `struct` + --> $DIR/issue-34421-mac-expr-bad-stmt-good-add-semi.rs:3:9 + | +LL | struct $a; + | ^^^^^^ expected expression +... +LL | make_item!(A) + | ------------- in this macro invocation + | + = note: the macro call doesn't expand to an expression, but it can expand to a statement + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: add `;` to interpret the expansion as a statement + | +LL | make_item!(A); + | ^ + +error: expected expression, found keyword `struct` + --> $DIR/issue-34421-mac-expr-bad-stmt-good-add-semi.rs:3:9 + | +LL | struct $a; + | ^^^^^^ expected expression +... +LL | make_item!(B) + | ------------- in this macro invocation + | + = note: the macro call doesn't expand to an expression, but it can expand to a statement + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: add `;` to interpret the expansion as a statement + | +LL | make_item!(B); + | ^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/macros/macro-in-expression-context-2.stderr b/src/test/ui/macros/macro-in-expression-context-2.stderr index 672871c49ca5a..8f9660963937f 100644 --- a/src/test/ui/macros/macro-in-expression-context-2.stderr +++ b/src/test/ui/macros/macro-in-expression-context-2.stderr @@ -6,6 +6,12 @@ LL | macro_rules! empty { () => () } ... LL | _ => { empty!() } | ^^^^^^^^ expected expression + | + = note: the macro call doesn't expand to an expression, but it can expand to a statement +help: add `;` to interpret the expansion as a statement + | +LL | _ => { empty!(); } + | ^ error: aborting due to previous error diff --git a/src/test/ui/match/issue-50900.stderr b/src/test/ui/match/issue-50900.stderr index 7192f11a5e8f0..d378b6e8efe37 100644 --- a/src/test/ui/match/issue-50900.stderr +++ b/src/test/ui/match/issue-50900.stderr @@ -8,6 +8,7 @@ LL | match Tag::ExifIFDPointer { | ^^^^^^^^^^^^^^^^^^^ pattern `Tag(Exif, _)` 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 `Tag` error: aborting due to previous error diff --git a/src/test/ui/missing/missing-items/issue-40221.stderr b/src/test/ui/missing/missing-items/issue-40221.stderr index 8e5286f210013..98efe805a0b34 100644 --- a/src/test/ui/missing/missing-items/issue-40221.stderr +++ b/src/test/ui/missing/missing-items/issue-40221.stderr @@ -11,6 +11,7 @@ LL | match proto { | ^^^^^ pattern `C(QA)` 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 `P` error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr index 552273b8ba927..a30bfa66c5a9c 100644 --- a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr +++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr @@ -17,11 +17,10 @@ LL | let mut r = R {c: Box::new(f)}; LL | f(&mut r, false) | ^ value borrowed here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:30:35 +help: consider further restricting this bound | -LL | fn conspirator(mut f: F) where F: FnMut(&mut R, bool) { - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | fn conspirator(mut f: F) where F: FnMut(&mut R, bool) + Copy { + | ^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/once-cant-call-twice-on-heap.stderr b/src/test/ui/once-cant-call-twice-on-heap.stderr index d4884469ce4d2..7133a32431a67 100644 --- a/src/test/ui/once-cant-call-twice-on-heap.stderr +++ b/src/test/ui/once-cant-call-twice-on-heap.stderr @@ -8,11 +8,10 @@ LL | blk(); LL | blk(); | ^^^ value used here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/once-cant-call-twice-on-heap.rs:7:10 +help: consider further restricting this bound | -LL | fn foo(blk: F) { - | ^^^^^^^^ +LL | fn foo(blk: F) { + | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr index 3ba26de10d3d5..b45e947f3ea37 100644 --- a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr +++ b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr @@ -5,6 +5,7 @@ LL | match (0u8, 0u8) { | ^^^^^^^^^^ pattern `(2u8..=std::u8::MAX, _)` 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 `(u8, u8)` error[E0004]: non-exhaustive patterns: `((4u8..=std::u8::MAX))` not covered --> $DIR/exhaustiveness-non-exhaustive.rs:10:11 @@ -13,6 +14,7 @@ LL | match ((0u8,),) { | ^^^^^^^^^ pattern `((4u8..=std::u8::MAX))` 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 `((u8,),)` error[E0004]: non-exhaustive patterns: `(Some(2u8..=std::u8::MAX))` not covered --> $DIR/exhaustiveness-non-exhaustive.rs:14:11 @@ -21,6 +23,7 @@ LL | match (Some(0u8),) { | ^^^^^^^^^^^^ pattern `(Some(2u8..=std::u8::MAX))` 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::option::Option,)` error: aborting due to 3 previous errors diff --git a/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr b/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr index 58286e87869a4..351700a6aa529 100644 --- a/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr +++ b/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr @@ -6,6 +6,7 @@ LL | let 0 | (1 | 2) = 0; | = 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 `i32` help: you might want to use `if let` to ignore the variant that isn't matched | LL | if let 0 | (1 | 2) = 0 { /* */ } @@ -18,6 +19,7 @@ LL | match 0 { | ^ patterns `std::i32::MIN..=-1i32` and `3i32..=std::i32::MAX` 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 `i32` error: aborting due to 2 previous errors diff --git a/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr b/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr index e1079f912d076..0fa77fb73da1f 100644 --- a/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr +++ b/src/test/ui/pattern/usefulness/always-inhabited-union-ref.stderr @@ -5,6 +5,7 @@ LL | match uninhab_ref() { | ^^^^^^^^^^^^^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `&!` error[E0004]: non-exhaustive patterns: type `Foo` is non-empty --> $DIR/always-inhabited-union-ref.rs:27:11 @@ -18,6 +19,7 @@ LL | match uninhab_union() { | ^^^^^^^^^^^^^^^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `Foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/pattern/usefulness/exhaustive_integer_patterns.stderr b/src/test/ui/pattern/usefulness/exhaustive_integer_patterns.stderr index 5866df5cb1db8..edc5ece558a70 100644 --- a/src/test/ui/pattern/usefulness/exhaustive_integer_patterns.stderr +++ b/src/test/ui/pattern/usefulness/exhaustive_integer_patterns.stderr @@ -17,6 +17,7 @@ LL | match x { | ^ pattern `128u8..=std::u8::MAX` 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 `u8` error[E0004]: non-exhaustive patterns: `11u8..=19u8`, `31u8..=34u8`, `36u8..=69u8` and 1 more not covered --> $DIR/exhaustive_integer_patterns.rs:33:11 @@ -25,6 +26,7 @@ LL | match x { | ^ patterns `11u8..=19u8`, `31u8..=34u8`, `36u8..=69u8` and 1 more 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 `u8` error: unreachable pattern --> $DIR/exhaustive_integer_patterns.rs:44:9 @@ -39,6 +41,7 @@ LL | match x { | ^ patterns `std::i8::MIN..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more 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 `i8` error[E0004]: non-exhaustive patterns: `std::i8::MIN` not covered --> $DIR/exhaustive_integer_patterns.rs:83:11 @@ -47,6 +50,7 @@ LL | match 0i8 { | ^^^ pattern `std::i8::MIN` 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 `i8` error[E0004]: non-exhaustive patterns: `0i16` not covered --> $DIR/exhaustive_integer_patterns.rs:91:11 @@ -55,6 +59,7 @@ LL | match 0i16 { | ^^^^ pattern `0i16` 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 `i16` error[E0004]: non-exhaustive patterns: `128u8..=std::u8::MAX` not covered --> $DIR/exhaustive_integer_patterns.rs:109:11 @@ -63,6 +68,7 @@ LL | match 0u8 { | ^^^ pattern `128u8..=std::u8::MAX` 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 `u8` error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=std::u8::MAX, Some(_))` not covered --> $DIR/exhaustive_integer_patterns.rs:121:11 @@ -71,6 +77,7 @@ LL | match (0u8, Some(())) { | ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=std::u8::MAX, Some(_))` 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 `(u8, std::option::Option<()>)` error[E0004]: non-exhaustive patterns: `(126u8..=127u8, false)` not covered --> $DIR/exhaustive_integer_patterns.rs:126:11 @@ -79,6 +86,7 @@ LL | match (0u8, true) { | ^^^^^^^^^^^ pattern `(126u8..=127u8, false)` 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 `(u8, bool)` error: multiple patterns covering the same range --> $DIR/exhaustive_integer_patterns.rs:141:9 @@ -101,6 +109,7 @@ LL | match 0u128 { | ^^^^^ pattern `std::u128::MAX` 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 `u128` error[E0004]: non-exhaustive patterns: `5u128..=std::u128::MAX` not covered --> $DIR/exhaustive_integer_patterns.rs:150:11 @@ -109,6 +118,7 @@ LL | match 0u128 { | ^^^^^ pattern `5u128..=std::u128::MAX` 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 `u128` error[E0004]: non-exhaustive patterns: `0u128..=3u128` not covered --> $DIR/exhaustive_integer_patterns.rs:154:11 @@ -117,6 +127,7 @@ LL | match 0u128 { | ^^^^^ pattern `0u128..=3u128` 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 `u128` error: unreachable pattern --> $DIR/exhaustive_integer_patterns.rs:162:9 diff --git a/src/test/ui/pattern/usefulness/issue-35609.stderr b/src/test/ui/pattern/usefulness/issue-35609.stderr index af22535c55e5a..66f904aced11b 100644 --- a/src/test/ui/pattern/usefulness/issue-35609.stderr +++ b/src/test/ui/pattern/usefulness/issue-35609.stderr @@ -5,6 +5,7 @@ LL | match (A, ()) { | ^^^^^^^ patterns `(B, _)`, `(C, _)`, `(D, _)` and 2 more 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 `(Enum, ())` error[E0004]: non-exhaustive patterns: `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered --> $DIR/issue-35609.rs:14:11 @@ -13,6 +14,7 @@ LL | match (A, A) { | ^^^^^^ patterns `(_, B)`, `(_, C)`, `(_, D)` and 2 more 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 `(Enum, Enum)` error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:18:11 @@ -21,6 +23,7 @@ LL | match ((A, ()), ()) { | ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more 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 `((Enum, ()), ())` error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:22:11 @@ -29,6 +32,7 @@ LL | match ((A, ()), A) { | ^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more 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 `((Enum, ()), Enum)` error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:26:11 @@ -37,6 +41,7 @@ LL | match ((A, ()), ()) { | ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more 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 `((Enum, ()), ())` error[E0004]: non-exhaustive patterns: `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered --> $DIR/issue-35609.rs:31:11 @@ -48,6 +53,7 @@ LL | match S(A, ()) { | ^^^^^^^^ patterns `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more 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 `S` error[E0004]: non-exhaustive patterns: `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered --> $DIR/issue-35609.rs:35:11 @@ -59,6 +65,7 @@ LL | match (Sd { x: A, y: () }) { | ^^^^^^^^^^^^^^^^^^^^ patterns `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more 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 `Sd` error[E0004]: non-exhaustive patterns: `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered --> $DIR/issue-35609.rs:39:11 @@ -67,6 +74,7 @@ LL | match Some(A) { | ^^^^^^^ patterns `Some(B)`, `Some(C)`, `Some(D)` and 2 more 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::option::Option` error: aborting due to 8 previous errors diff --git a/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr b/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr index 7bb6a700a3717..09b92fc92f32a 100644 --- a/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr +++ b/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr @@ -5,6 +5,7 @@ LL | match (true, false) { | ^^^^^^^^^^^^^ pattern `(true, false)` 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 `(bool, bool)` error[E0004]: non-exhaustive patterns: `Some(Some(West))` not covered --> $DIR/match-arm-statics-2.rs:34:11 @@ -21,6 +22,7 @@ LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), | 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::option::Option>` error[E0004]: non-exhaustive patterns: `Foo { bar: Some(North), baz: NewBool(true) }` not covered --> $DIR/match-arm-statics-2.rs:53:11 @@ -35,6 +37,7 @@ LL | match (Foo { bar: Some(North), baz: NewBool(true) }) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { bar: Some(North), baz: NewBool(true) }` 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 `Foo` error: aborting due to 3 previous errors diff --git a/src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr b/src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr index 539aa854f9e6b..323449eebc540 100644 --- a/src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr +++ b/src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr @@ -5,6 +5,7 @@ LL | match buf { | ^^^ patterns `&[0u8..=64u8, _, _, _]` and `&[66u8..=std::u8::MAX, _, _, _]` 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 `&[u8; 4]` error[E0004]: non-exhaustive patterns: `&[]`, `&[_]`, `&[_, _]` and 2 more not covered --> $DIR/match-byte-array-patterns-2.rs:10:11 @@ -13,6 +14,7 @@ LL | match buf { | ^^^ patterns `&[]`, `&[_]`, `&[_, _]` and 2 more 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 `&[u8]` error: aborting due to 2 previous errors diff --git a/src/test/ui/pattern/usefulness/match-empty-exhaustive_patterns.stderr b/src/test/ui/pattern/usefulness/match-empty-exhaustive_patterns.stderr index 49c38d2a9d3d7..1f6503e3e9c71 100644 --- a/src/test/ui/pattern/usefulness/match-empty-exhaustive_patterns.stderr +++ b/src/test/ui/pattern/usefulness/match-empty-exhaustive_patterns.stderr @@ -35,6 +35,7 @@ LL | match_empty!(0u8); | ^^^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `u8` error[E0004]: non-exhaustive patterns: type `NonEmptyStruct` is non-empty --> $DIR/match-empty-exhaustive_patterns.rs:66:18 @@ -46,6 +47,7 @@ LL | match_empty!(NonEmptyStruct(true)); | ^^^^^^^^^^^^^^^^^^^^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `NonEmptyStruct` error[E0004]: non-exhaustive patterns: type `NonEmptyUnion1` is non-empty --> $DIR/match-empty-exhaustive_patterns.rs:68:18 @@ -59,6 +61,7 @@ LL | match_empty!((NonEmptyUnion1 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `NonEmptyUnion1` error[E0004]: non-exhaustive patterns: type `NonEmptyUnion2` is non-empty --> $DIR/match-empty-exhaustive_patterns.rs:70:18 @@ -73,6 +76,7 @@ LL | match_empty!((NonEmptyUnion2 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `NonEmptyUnion2` error[E0004]: non-exhaustive patterns: `Foo(_)` not covered --> $DIR/match-empty-exhaustive_patterns.rs:72:18 @@ -89,6 +93,7 @@ LL | match_empty!(NonEmptyEnum1::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` 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 `NonEmptyEnum1` error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered --> $DIR/match-empty-exhaustive_patterns.rs:74:18 @@ -109,6 +114,7 @@ LL | match_empty!(NonEmptyEnum2::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` 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 `NonEmptyEnum2` error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered --> $DIR/match-empty-exhaustive_patterns.rs:76:18 @@ -122,6 +128,7 @@ LL | match_empty!(NonEmptyEnum5::V1); | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more 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 `NonEmptyEnum5` error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/match-empty-exhaustive_patterns.rs:79:18 @@ -130,6 +137,7 @@ LL | match_false!(0u8); | ^^^ pattern `_` 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 `u8` error[E0004]: non-exhaustive patterns: `NonEmptyStruct(_)` not covered --> $DIR/match-empty-exhaustive_patterns.rs:81:18 @@ -141,6 +149,7 @@ LL | match_false!(NonEmptyStruct(true)); | ^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct(_)` 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 `NonEmptyStruct` error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered --> $DIR/match-empty-exhaustive_patterns.rs:83:18 @@ -154,6 +163,7 @@ LL | match_false!((NonEmptyUnion1 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` 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 `NonEmptyUnion1` error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered --> $DIR/match-empty-exhaustive_patterns.rs:85:18 @@ -168,6 +178,7 @@ LL | match_false!((NonEmptyUnion2 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` 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 `NonEmptyUnion2` error[E0004]: non-exhaustive patterns: `Foo(_)` not covered --> $DIR/match-empty-exhaustive_patterns.rs:87:18 @@ -184,6 +195,7 @@ LL | match_false!(NonEmptyEnum1::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` 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 `NonEmptyEnum1` error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered --> $DIR/match-empty-exhaustive_patterns.rs:89:18 @@ -204,6 +216,7 @@ LL | match_false!(NonEmptyEnum2::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` 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 `NonEmptyEnum2` error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered --> $DIR/match-empty-exhaustive_patterns.rs:91:18 @@ -217,6 +230,7 @@ LL | match_false!(NonEmptyEnum5::V1); | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more 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 `NonEmptyEnum5` error: aborting due to 18 previous errors diff --git a/src/test/ui/pattern/usefulness/match-empty.stderr b/src/test/ui/pattern/usefulness/match-empty.stderr index 72e3fc0a16744..08095f6e7fb12 100644 --- a/src/test/ui/pattern/usefulness/match-empty.stderr +++ b/src/test/ui/pattern/usefulness/match-empty.stderr @@ -8,6 +8,7 @@ LL | match_false!(x); // Not detected as unreachable nor exhaustive. | ^ pattern `_` 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 `Foo` error[E0004]: non-exhaustive patterns: type `u8` is non-empty --> $DIR/match-empty.rs:63:18 @@ -16,6 +17,7 @@ LL | match_empty!(0u8); | ^^^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `u8` error[E0004]: non-exhaustive patterns: type `NonEmptyStruct` is non-empty --> $DIR/match-empty.rs:65:18 @@ -27,6 +29,7 @@ LL | match_empty!(NonEmptyStruct(true)); | ^^^^^^^^^^^^^^^^^^^^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `NonEmptyStruct` error[E0004]: non-exhaustive patterns: type `NonEmptyUnion1` is non-empty --> $DIR/match-empty.rs:67:18 @@ -40,6 +43,7 @@ LL | match_empty!((NonEmptyUnion1 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `NonEmptyUnion1` error[E0004]: non-exhaustive patterns: type `NonEmptyUnion2` is non-empty --> $DIR/match-empty.rs:69:18 @@ -54,6 +58,7 @@ LL | match_empty!((NonEmptyUnion2 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `NonEmptyUnion2` error[E0004]: non-exhaustive patterns: `Foo(_)` not covered --> $DIR/match-empty.rs:71:18 @@ -70,6 +75,7 @@ LL | match_empty!(NonEmptyEnum1::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` 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 `NonEmptyEnum1` error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered --> $DIR/match-empty.rs:73:18 @@ -90,6 +96,7 @@ LL | match_empty!(NonEmptyEnum2::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` 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 `NonEmptyEnum2` error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered --> $DIR/match-empty.rs:75:18 @@ -103,6 +110,7 @@ LL | match_empty!(NonEmptyEnum5::V1); | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more 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 `NonEmptyEnum5` error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/match-empty.rs:78:18 @@ -111,6 +119,7 @@ LL | match_false!(0u8); | ^^^ pattern `_` 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 `u8` error[E0004]: non-exhaustive patterns: `NonEmptyStruct(_)` not covered --> $DIR/match-empty.rs:80:18 @@ -122,6 +131,7 @@ LL | match_false!(NonEmptyStruct(true)); | ^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct(_)` 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 `NonEmptyStruct` error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered --> $DIR/match-empty.rs:82:18 @@ -135,6 +145,7 @@ LL | match_false!((NonEmptyUnion1 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` 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 `NonEmptyUnion1` error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered --> $DIR/match-empty.rs:84:18 @@ -149,6 +160,7 @@ LL | match_false!((NonEmptyUnion2 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` 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 `NonEmptyUnion2` error[E0004]: non-exhaustive patterns: `Foo(_)` not covered --> $DIR/match-empty.rs:86:18 @@ -165,6 +177,7 @@ LL | match_false!(NonEmptyEnum1::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo(_)` 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 `NonEmptyEnum1` error[E0004]: non-exhaustive patterns: `Foo(_)` and `Bar` not covered --> $DIR/match-empty.rs:88:18 @@ -185,6 +198,7 @@ LL | match_false!(NonEmptyEnum2::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `Foo(_)` and `Bar` 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 `NonEmptyEnum2` error[E0004]: non-exhaustive patterns: `V1`, `V2`, `V3` and 2 more not covered --> $DIR/match-empty.rs:90:18 @@ -198,6 +212,7 @@ LL | match_false!(NonEmptyEnum5::V1); | ^^^^^^^^^^^^^^^^^ patterns `V1`, `V2`, `V3` and 2 more 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 `NonEmptyEnum5` error: aborting due to 15 previous errors diff --git a/src/test/ui/pattern/usefulness/match-non-exhaustive.stderr b/src/test/ui/pattern/usefulness/match-non-exhaustive.stderr index 211f333882b10..84cfe1da315da 100644 --- a/src/test/ui/pattern/usefulness/match-non-exhaustive.stderr +++ b/src/test/ui/pattern/usefulness/match-non-exhaustive.stderr @@ -5,6 +5,7 @@ LL | match 0 { 1 => () } | ^ patterns `std::i32::MIN..=0i32` and `2i32..=std::i32::MAX` 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 `i32` error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/match-non-exhaustive.rs:3:11 @@ -13,6 +14,7 @@ LL | match 0 { 0 if false => () } | ^ pattern `_` 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 `i32` error: aborting due to 2 previous errors diff --git a/src/test/ui/pattern/usefulness/match-privately-empty.stderr b/src/test/ui/pattern/usefulness/match-privately-empty.stderr index 4dcbf05ecce2b..62e6e662fa7fa 100644 --- a/src/test/ui/pattern/usefulness/match-privately-empty.stderr +++ b/src/test/ui/pattern/usefulness/match-privately-empty.stderr @@ -10,6 +10,7 @@ LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), | ---- 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::option::Option` error: aborting due to previous error diff --git a/src/test/ui/pattern/usefulness/match-slice-patterns.stderr b/src/test/ui/pattern/usefulness/match-slice-patterns.stderr index 977a112808190..ba5312d213590 100644 --- a/src/test/ui/pattern/usefulness/match-slice-patterns.stderr +++ b/src/test/ui/pattern/usefulness/match-slice-patterns.stderr @@ -5,6 +5,7 @@ LL | match list { | ^^^^ pattern `&[_, Some(_), .., None, _]` 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::option::Option<()>]` error: aborting due to previous error diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr index e5f01174ac1bf..29aa0c1c92670 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-defined-here.stderr @@ -20,6 +20,7 @@ LL | match e1 { | ^^ patterns `B` and `C` 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 `E` error[E0005]: refutable pattern in local binding: `B` and `C` not covered --> $DIR/non-exhaustive-defined-here.rs:36:9 @@ -44,6 +45,7 @@ LL | let E::A = 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 `E` help: you might want to use `if let` to ignore the variant that isn't matched | LL | if let E::A = e { /* */ } @@ -71,6 +73,7 @@ LL | match e { | ^ patterns `&B` and `&C` 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 `&E` error[E0005]: refutable pattern in local binding: `&B` and `&C` not covered --> $DIR/non-exhaustive-defined-here.rs:44:9 @@ -95,6 +98,7 @@ LL | let E::A = 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 `&E` help: you might want to use `if let` to ignore the variant that isn't matched | LL | if let E::A = e { /* */ } @@ -122,6 +126,7 @@ LL | match e { | ^ patterns `&&mut &B` and `&&mut &C` 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 `&&mut &E` error[E0005]: refutable pattern in local binding: `&&mut &B` and `&&mut &C` not covered --> $DIR/non-exhaustive-defined-here.rs:52:9 @@ -146,6 +151,7 @@ LL | let E::A = 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 `&&mut &E` help: you might want to use `if let` to ignore the variant that isn't matched | LL | if let E::A = e { /* */ } @@ -168,6 +174,7 @@ LL | match e { | ^ pattern `None` 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 `Opt` error[E0005]: refutable pattern in local binding: `None` not covered --> $DIR/non-exhaustive-defined-here.rs:69:9 @@ -187,6 +194,7 @@ LL | let Opt::Some(ref _x) = 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 `Opt` help: you might want to use `if let` to ignore the variant that isn't matched | LL | if let Opt::Some(ref _x) = e { /* */ } diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-float-range-match.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-float-range-match.stderr index 6de615c3de4fd..4835fa86cc0ee 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-float-range-match.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-float-range-match.stderr @@ -5,6 +5,7 @@ LL | match 0.0 { | ^^^ pattern `_` 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 `f64` error: aborting due to previous error 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 72b4b522198e0..c9f26db6f1f8d 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match-nested.stderr @@ -5,6 +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 `(std::option::Option<&[T]>, std::result::Result<&[T], ()>)` error[E0004]: non-exhaustive patterns: `A(C)` not covered --> $DIR/non-exhaustive-match-nested.rs:15:11 @@ -19,6 +20,7 @@ LL | match x { | ^ pattern `A(C)` 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 `T` error: aborting due to 2 previous errors diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr index dff2c8d9424c3..358ecf2f2d093 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr @@ -11,6 +11,7 @@ LL | match x { T::B => { } } | ^ pattern `A` 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 `T` error[E0004]: non-exhaustive patterns: `false` not covered --> $DIR/non-exhaustive-match.rs:13:11 @@ -19,6 +20,7 @@ LL | match true { | ^^^^ pattern `false` 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 `bool` error[E0004]: non-exhaustive patterns: `Some(_)` not covered --> $DIR/non-exhaustive-match.rs:16:11 @@ -32,6 +34,7 @@ LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), | ---- 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::option::Option` error[E0004]: non-exhaustive patterns: `(_, _, std::i32::MIN..=3i32)` and `(_, _, 5i32..=std::i32::MAX)` not covered --> $DIR/non-exhaustive-match.rs:19:11 @@ -40,6 +43,7 @@ LL | match (2, 3, 4) { | ^^^^^^^^^ patterns `(_, _, std::i32::MIN..=3i32)` and `(_, _, 5i32..=std::i32::MAX)` 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 `(i32, i32, i32)` error[E0004]: non-exhaustive patterns: `(A, A)` not covered --> $DIR/non-exhaustive-match.rs:23:11 @@ -48,6 +52,7 @@ LL | match (T::A, T::A) { | ^^^^^^^^^^^^ pattern `(A, A)` 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 `(T, T)` error[E0004]: non-exhaustive patterns: `B` not covered --> $DIR/non-exhaustive-match.rs:27:11 @@ -62,6 +67,7 @@ LL | match T::A { | ^^^^ pattern `B` 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 `T` error[E0004]: non-exhaustive patterns: `[]` not covered --> $DIR/non-exhaustive-match.rs:38:11 @@ -70,6 +76,7 @@ LL | match *vec { | ^^^^ pattern `[]` 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::option::Option]` error[E0004]: non-exhaustive patterns: `[_, _, _, _, ..]` not covered --> $DIR/non-exhaustive-match.rs:51:11 @@ -78,6 +85,7 @@ LL | match *vec { | ^^^^ pattern `[_, _, _, _, ..]` 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 `[f32]` error: aborting due to 8 previous errors diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr index 2a9fa07d22fe7..c9ed12aae5fbc 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-pattern-witness.stderr @@ -11,6 +11,7 @@ LL | match (Foo { first: true, second: None }) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { first: false, second: Some([_, _, _, _]) }` 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 `Foo` error[E0004]: non-exhaustive patterns: `Red` not covered --> $DIR/non-exhaustive-pattern-witness.rs:23:11 @@ -27,6 +28,7 @@ LL | match Color::Red { | ^^^^^^^^^^ pattern `Red` 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 `Color` error[E0004]: non-exhaustive patterns: `East`, `South` and `West` not covered --> $DIR/non-exhaustive-pattern-witness.rs:35:11 @@ -44,6 +46,7 @@ LL | match Direction::North { | ^^^^^^^^^^^^^^^^ patterns `East`, `South` and `West` 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 `Direction` error[E0004]: non-exhaustive patterns: `Second`, `Third`, `Fourth` and 8 more not covered --> $DIR/non-exhaustive-pattern-witness.rs:46:11 @@ -57,6 +60,7 @@ LL | match ExcessiveEnum::First { | ^^^^^^^^^^^^^^^^^^^^ patterns `Second`, `Third`, `Fourth` and 8 more 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 `ExcessiveEnum` error[E0004]: non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered --> $DIR/non-exhaustive-pattern-witness.rs:54:11 @@ -73,6 +77,7 @@ LL | match Color::Red { | ^^^^^^^^^^ pattern `CustomRGBA { a: true, .. }` 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 `Color` error[E0004]: non-exhaustive patterns: `[Second(true), Second(false)]` not covered --> $DIR/non-exhaustive-pattern-witness.rs:70:11 @@ -81,6 +86,7 @@ LL | match *x { | ^^ pattern `[Second(true), Second(false)]` 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 `[Enum]` error[E0004]: non-exhaustive patterns: `((), false)` not covered --> $DIR/non-exhaustive-pattern-witness.rs:83:11 @@ -89,6 +95,7 @@ LL | match ((), false) { | ^^^^^^^^^^^ pattern `((), false)` 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 `((), bool)` error: aborting due to 7 previous errors diff --git a/src/test/ui/pattern/usefulness/refutable-pattern-errors.stderr b/src/test/ui/pattern/usefulness/refutable-pattern-errors.stderr index 0cf5d9cd5f12a..f5895c01599d7 100644 --- a/src/test/ui/pattern/usefulness/refutable-pattern-errors.stderr +++ b/src/test/ui/pattern/usefulness/refutable-pattern-errors.stderr @@ -3,6 +3,8 @@ error[E0005]: refutable pattern in function argument: `(_, _)` not covered | LL | fn func((1, (Some(1), 2..=3)): (isize, (Option, isize))) { } | ^^^^^^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered + | + = note: the matched value is of type `(isize, (std::option::Option, isize))` error[E0005]: refutable pattern in local binding: `(std::i32::MIN..=0i32, _)` and `(2i32..=std::i32::MAX, _)` not covered --> $DIR/refutable-pattern-errors.rs:7:9 @@ -12,6 +14,7 @@ LL | let (1, (Some(1), 2..=3)) = (1, (None, 2)); | = 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 `(i32, (std::option::Option, i32))` help: you might want to use `if let` to ignore the variant that isn't matched | LL | if let (1, (Some(1), 2..=3)) = (1, (None, 2)) { /* */ } diff --git a/src/test/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr b/src/test/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr index 8666e6bb73ebf..c9d8cf43f95fd 100644 --- a/src/test/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr +++ b/src/test/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr @@ -3,6 +3,8 @@ error[E0005]: refutable pattern in function argument: `_` not covered | LL | let f = |3: isize| println!("hello"); | ^ pattern `_` not covered + | + = note: the matched value is of type `isize` error: aborting due to previous error diff --git a/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr b/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr index b3701efef3de2..8b85eaeda0acf 100644 --- a/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr +++ b/src/test/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr @@ -5,6 +5,7 @@ LL | match s2 { | ^^ pattern `&[false, _]` 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 `&[bool; 2]` error[E0004]: non-exhaustive patterns: `&[false, ..]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:12:11 @@ -13,6 +14,7 @@ LL | match s3 { | ^^ pattern `&[false, ..]` 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 `&[bool; 3]` error[E0004]: non-exhaustive patterns: `&[false, ..]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:16:11 @@ -21,6 +23,7 @@ LL | match s10 { | ^^^ pattern `&[false, ..]` 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 `&[bool; 10]` error[E0004]: non-exhaustive patterns: `&[false, true]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:25:11 @@ -29,6 +32,7 @@ LL | match s2 { | ^^ pattern `&[false, true]` 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 `&[bool; 2]` error[E0004]: non-exhaustive patterns: `&[false, .., true]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:30:11 @@ -37,6 +41,7 @@ LL | match s3 { | ^^ pattern `&[false, .., true]` 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 `&[bool; 3]` error[E0004]: non-exhaustive patterns: `&[false, .., true]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:35:11 @@ -45,6 +50,7 @@ LL | match s { | ^ pattern `&[false, .., true]` 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 `&[bool]` error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:42:11 @@ -53,6 +59,7 @@ LL | match s { | ^ pattern `&[_, ..]` 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 `&[bool]` error[E0004]: non-exhaustive patterns: `&[_, _, ..]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:46:11 @@ -61,6 +68,7 @@ LL | match s { | ^ pattern `&[_, _, ..]` 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 `&[bool]` error[E0004]: non-exhaustive patterns: `&[false, ..]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:51:11 @@ -69,6 +77,7 @@ LL | match s { | ^ pattern `&[false, ..]` 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 `&[bool]` error[E0004]: non-exhaustive patterns: `&[false, _, ..]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:56:11 @@ -77,6 +86,7 @@ LL | match s { | ^ pattern `&[false, _, ..]` 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 `&[bool]` error[E0004]: non-exhaustive patterns: `&[_, .., false]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:62:11 @@ -85,6 +95,7 @@ LL | match s { | ^ pattern `&[_, .., false]` 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 `&[bool]` error[E0004]: non-exhaustive patterns: `&[_, _, .., true]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:69:11 @@ -93,6 +104,7 @@ LL | match s { | ^ pattern `&[_, _, .., true]` 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 `&[bool]` error[E0004]: non-exhaustive patterns: `&[true, _, .., _]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:76:11 @@ -101,6 +113,7 @@ LL | match s { | ^ pattern `&[true, _, .., _]` 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 `&[bool]` error[E0004]: non-exhaustive patterns: `&[..]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:85:11 @@ -109,6 +122,7 @@ LL | match s { | ^ pattern `&[..]` 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 `&[bool]` error[E0004]: non-exhaustive patterns: `&[true]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:89:11 @@ -117,6 +131,7 @@ LL | match s { | ^ pattern `&[true]` 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 `&[bool]` error[E0004]: non-exhaustive patterns: `&[false]` not covered --> $DIR/slice-patterns-exhaustiveness.rs:97:11 @@ -125,6 +140,7 @@ LL | match s1 { | ^^ pattern `&[false]` 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 `&[bool; 1]` error: aborting due to 16 previous errors diff --git a/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr b/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr index d6b5af1796403..23ff6c626f759 100644 --- a/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr +++ b/src/test/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr @@ -12,6 +12,7 @@ LL | match x { | ^ pattern `B { x: Some(_) }` 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 `A` error: aborting due to previous error diff --git a/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr b/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr index bbdf9ceed23a2..ca8f67f3c8df2 100644 --- a/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr +++ b/src/test/ui/pattern/usefulness/tuple-struct-nonexhaustive.stderr @@ -8,6 +8,7 @@ LL | match x { | ^ pattern `Foo(_, _)` 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 `Foo` error: aborting due to previous error diff --git a/src/test/ui/phantom-oibit.stderr b/src/test/ui/phantom-oibit.stderr index 7b6b105eb032b..f8fe6947852fb 100644 --- a/src/test/ui/phantom-oibit.stderr +++ b/src/test/ui/phantom-oibit.stderr @@ -8,14 +8,13 @@ LL | is_zen(x) | ^ `T` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `T` -help: consider restricting this type parameter with `T: std::marker::Sync` - --> $DIR/phantom-oibit.rs:20:13 - | -LL | fn not_sync(x: Guard) { - | ^ = note: required because of the requirements on the impl of `Zen` for `&T` = note: required because it appears within the type `std::marker::PhantomData<&T>` = note: required because it appears within the type `Guard<'_, T>` +help: consider restricting type parameter `T` + | +LL | fn not_sync(x: Guard) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `T` cannot be shared between threads safely --> $DIR/phantom-oibit.rs:26:12 @@ -27,15 +26,14 @@ LL | is_zen(x) | ^ `T` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `T` -help: consider restricting this type parameter with `T: std::marker::Sync` - --> $DIR/phantom-oibit.rs:25:20 - | -LL | fn nested_not_sync(x: Nested>) { - | ^ = note: required because of the requirements on the impl of `Zen` for `&T` = note: required because it appears within the type `std::marker::PhantomData<&T>` = note: required because it appears within the type `Guard<'_, T>` = note: required because it appears within the type `Nested>` +help: consider restricting type parameter `T` + | +LL | fn nested_not_sync(x: Nested>) { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/precise_pointer_size_matching.stderr b/src/test/ui/precise_pointer_size_matching.stderr index 2c2c2aa04c233..91ea323f07bb2 100644 --- a/src/test/ui/precise_pointer_size_matching.stderr +++ b/src/test/ui/precise_pointer_size_matching.stderr @@ -5,6 +5,7 @@ LL | match 0isize { | ^^^^^^ patterns `std::isize::MIN..=-6isize` and `21isize..=std::isize::MAX` 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 `isize` error[E0004]: non-exhaustive patterns: `0usize` and `21usize..=std::usize::MAX` not covered --> $DIR/precise_pointer_size_matching.rs:29:11 @@ -13,6 +14,7 @@ LL | match 0usize { | ^^^^^^ patterns `0usize` and `21usize..=std::usize::MAX` 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 `usize` error: aborting due to 2 previous errors 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 f371d460cf733..d3e05498a4a01 100644 --- a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr +++ b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr @@ -11,6 +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` 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-2005-default-binding-mode/slice.stderr b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr index c234fdf46ed2d..18d8f5481c9fb 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/slice.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr @@ -5,6 +5,7 @@ LL | match sl { | ^^ pattern `&[]` 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 `&[u8]` error: aborting due to previous error diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum.stderr b/src/test/ui/rfc-2008-non-exhaustive/enum.stderr index a2bdcbaa4478d..28e450336f58d 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/enum.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/enum.stderr @@ -5,6 +5,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `enums::EmptyNonExhaustiveEnum` error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/enum.rs:16:11 @@ -13,6 +14,7 @@ LL | match enum_unit { | ^^^^^^^^^ pattern `_` 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 `enums::NonExhaustiveEnum` error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/enum.rs:23:11 @@ -21,6 +23,7 @@ LL | match enum_unit {}; | ^^^^^^^^^ pattern `_` 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 `enums::NonExhaustiveEnum` error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr b/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr index a99a690bc9e5a..752b08b2b65f1 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr @@ -18,6 +18,7 @@ LL | match NonExhaustiveEnum::Unit {} | ^^^^^^^^^^^^^^^^^^^^^^^ patterns `Unit`, `Tuple(_)` and `Struct { .. }` 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 `NonExhaustiveEnum` error[E0004]: non-exhaustive patterns: `Unit`, `Tuple(_)` and `Struct { .. }` not covered --> $DIR/enum_same_crate_empty_match.rs:35:11 @@ -39,6 +40,7 @@ LL | match NormalEnum::Unit {} | ^^^^^^^^^^^^^^^^ patterns `Unit`, `Tuple(_)` and `Struct { .. }` 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 `NormalEnum` error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr index abca542373f3a..bd136333b761d 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr @@ -5,6 +5,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `uninhabited::IndirectUninhabitedEnum` error[E0004]: non-exhaustive patterns: type `uninhabited::IndirectUninhabitedStruct` is non-empty --> $DIR/indirect_match.rs:23:11 @@ -13,6 +14,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `uninhabited::IndirectUninhabitedStruct` error[E0004]: non-exhaustive patterns: type `uninhabited::IndirectUninhabitedTupleStruct` is non-empty --> $DIR/indirect_match.rs:27:11 @@ -21,6 +23,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `uninhabited::IndirectUninhabitedTupleStruct` error[E0004]: non-exhaustive patterns: type `uninhabited::IndirectUninhabitedVariants` is non-empty --> $DIR/indirect_match.rs:33:11 @@ -29,6 +32,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `uninhabited::IndirectUninhabitedVariants` error: aborting due to 4 previous errors diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.stderr index 989cb791a417c..42bf67c0a45df 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.stderr @@ -8,6 +8,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `IndirectUninhabitedEnum` error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedStruct` is non-empty --> $DIR/indirect_match_same_crate.rs:38:11 @@ -19,6 +20,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `IndirectUninhabitedStruct` error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedTupleStruct` is non-empty --> $DIR/indirect_match_same_crate.rs:42:11 @@ -30,6 +32,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `IndirectUninhabitedTupleStruct` error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedVariants` is non-empty --> $DIR/indirect_match_same_crate.rs:48:11 @@ -41,6 +44,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `IndirectUninhabitedVariants` error: aborting due to 4 previous errors diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr index 17a8d01007205..5211b57726428 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr @@ -5,6 +5,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `uninhabited::IndirectUninhabitedEnum` error[E0004]: non-exhaustive patterns: type `uninhabited::IndirectUninhabitedStruct` is non-empty --> $DIR/indirect_match_with_exhaustive_patterns.rs:27:11 @@ -13,6 +14,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `uninhabited::IndirectUninhabitedStruct` error[E0004]: non-exhaustive patterns: type `uninhabited::IndirectUninhabitedTupleStruct` is non-empty --> $DIR/indirect_match_with_exhaustive_patterns.rs:31:11 @@ -21,6 +23,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `uninhabited::IndirectUninhabitedTupleStruct` error[E0004]: non-exhaustive patterns: type `uninhabited::IndirectUninhabitedVariants` is non-empty --> $DIR/indirect_match_with_exhaustive_patterns.rs:37:11 @@ -29,6 +32,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `uninhabited::IndirectUninhabitedVariants` error: aborting due to 4 previous errors diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr index a214a652a387f..961b3e567325f 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match.stderr @@ -5,6 +5,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `uninhabited::UninhabitedEnum` error[E0004]: non-exhaustive patterns: type `uninhabited::UninhabitedStruct` is non-empty --> $DIR/match.rs:23:11 @@ -13,6 +14,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `uninhabited::UninhabitedStruct` error[E0004]: non-exhaustive patterns: type `uninhabited::UninhabitedTupleStruct` is non-empty --> $DIR/match.rs:27:11 @@ -21,6 +23,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `uninhabited::UninhabitedTupleStruct` error[E0004]: non-exhaustive patterns: `Tuple(_)` and `Struct { .. }` not covered --> $DIR/match.rs:31:11 @@ -36,6 +39,7 @@ LL | #[non_exhaustive] Struct { x: ! } | ------ 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 `uninhabited::UninhabitedVariants` error: aborting due to 4 previous errors diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr index 858aae585765f..e4d0c7022f3b4 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr @@ -10,6 +10,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `UninhabitedStruct` error[E0004]: non-exhaustive patterns: type `UninhabitedTupleStruct` is non-empty --> $DIR/match_same_crate.rs:34:11 @@ -21,6 +22,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `UninhabitedTupleStruct` error[E0004]: non-exhaustive patterns: `Tuple(_)` and `Struct { .. }` not covered --> $DIR/match_same_crate.rs:38:11 @@ -37,6 +39,7 @@ LL | match x {} | ^ patterns `Tuple(_)` and `Struct { .. }` 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 `UninhabitedVariants` error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr index 63564e9c3cc8c..c489edeb699d8 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr @@ -5,6 +5,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `uninhabited::UninhabitedEnum` error[E0004]: non-exhaustive patterns: type `uninhabited::UninhabitedStruct` is non-empty --> $DIR/match_with_exhaustive_patterns.rs:26:11 @@ -13,6 +14,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `uninhabited::UninhabitedStruct` error[E0004]: non-exhaustive patterns: type `uninhabited::UninhabitedTupleStruct` is non-empty --> $DIR/match_with_exhaustive_patterns.rs:30:11 @@ -21,6 +23,7 @@ LL | match x {} | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `uninhabited::UninhabitedTupleStruct` error[E0004]: non-exhaustive patterns: `Tuple(_)` and `Struct { .. }` not covered --> $DIR/match_with_exhaustive_patterns.rs:34:11 @@ -36,6 +39,7 @@ LL | #[non_exhaustive] Struct { x: ! } | ------ 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 `uninhabited::UninhabitedVariants` error: aborting due to 4 previous errors diff --git a/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr index ee7c002b16db1..4e4cad624754e 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr @@ -4,11 +4,10 @@ error[E0277]: the trait bound `U: std::cmp::Eq` is not satisfied LL | default impl Foo<'static, U> for () {} | ^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `U` | -help: consider restricting this type parameter with `U: std::cmp::Eq` - --> $DIR/specialization-wfcheck.rs:7:14 +help: consider restricting type parameter `U` | -LL | default impl Foo<'static, U> for () {} - | ^ +LL | default impl Foo<'static, U> for () {} + | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr b/src/test/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr index fc17199bf91d4..1512eac76670d 100644 --- a/src/test/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr +++ b/src/test/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr @@ -9,6 +9,8 @@ LL | let A = 3; ... LL | const A: i32 = 2; | ----------------- constant defined here + | + = note: the matched value is of type `i32` error: aborting due to previous error diff --git a/src/test/ui/suggestions/restrict-type-argument.stderr b/src/test/ui/suggestions/restrict-type-argument.stderr index 4d5cb8907e887..a98cb76a68326 100644 --- a/src/test/ui/suggestions/restrict-type-argument.stderr +++ b/src/test/ui/suggestions/restrict-type-argument.stderr @@ -8,11 +8,10 @@ LL | is_send(val); | ^^^ `impl Sync` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `impl Sync` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/restrict-type-argument.rs:3:23 +help: consider further restricting this bound | -LL | fn use_impl_sync(val: impl Sync) { - | ^^^^^^^^^ +LL | fn use_impl_sync(val: impl Sync + std::marker::Send) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:8:13 @@ -24,11 +23,10 @@ LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `S` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/restrict-type-argument.rs:7:31 +help: consider further restricting this bound | -LL | fn use_where(val: S) where S: Sync { - | ^^^^^^^ +LL | fn use_where(val: S) where S: Sync + std::marker::Send { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:12:13 @@ -40,11 +38,10 @@ LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `S` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/restrict-type-argument.rs:11:17 +help: consider further restricting this bound | -LL | fn use_bound(val: S) { - | ^^^^ +LL | fn use_bound(val: S) { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:20:13 @@ -56,11 +53,10 @@ LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `S` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/restrict-type-argument.rs:18:5 +help: consider further restricting this bound | -LL | Sync - | ^^^^ +LL | Sync + std::marker::Send + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:24:13 @@ -72,11 +68,10 @@ LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `S` -help: consider further restricting this bound with `+ std::marker::Send` - --> $DIR/restrict-type-argument.rs:23:47 +help: consider further restricting this bound | -LL | fn use_bound_and_where(val: S) where S: std::fmt::Debug { - | ^^^^^^^^^^^^^^^^^^ +LL | fn use_bound_and_where(val: S) where S: std::fmt::Debug + std::marker::Send { + | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `S` cannot be sent between threads safely --> $DIR/restrict-type-argument.rs:28:13 @@ -88,11 +83,10 @@ LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `S` -help: consider restricting this type parameter with `S: std::marker::Send` - --> $DIR/restrict-type-argument.rs:27:16 +help: consider restricting type parameter `S` | -LL | fn use_unbound(val: S) { - | ^ +LL | fn use_unbound(val: S) { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/traits/trait-alias/trait-alias-wf.stderr b/src/test/ui/traits/trait-alias/trait-alias-wf.stderr index e7ed16a02a3f0..ca4980ca30529 100644 --- a/src/test/ui/traits/trait-alias/trait-alias-wf.stderr +++ b/src/test/ui/traits/trait-alias/trait-alias-wf.stderr @@ -6,11 +6,10 @@ LL | trait A {} LL | trait B = A; | ^^^^ the trait `Foo` is not implemented for `T` | -help: consider restricting this type parameter with `T: Foo` - --> $DIR/trait-alias-wf.rs:5:9 +help: consider restricting type parameter `T` | -LL | trait B = A; - | ^ +LL | trait B = A; + | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr index 56a9e3ff54ec2..9e8e5e0814502 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr @@ -7,11 +7,10 @@ LL | struct Foo { LL | impl Foo { | ^^^^^^ the trait `Trait` is not implemented for `T` | -help: consider restricting this type parameter with `T: Trait` - --> $DIR/trait-bounds-on-structs-and-enums.rs:13:6 +help: consider restricting type parameter `T` | -LL | impl Foo { - | ^ +LL | impl Foo { + | ^^^^^^^ error[E0277]: the trait bound `isize: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:19:5 @@ -40,11 +39,10 @@ LL | struct Foo { LL | b: Foo, | ^^^^^^^^^ the trait `Trait` is not implemented for `U` | -help: consider restricting this type parameter with `U: Trait` - --> $DIR/trait-bounds-on-structs-and-enums.rs:26:16 +help: consider restricting type parameter `U` | -LL | struct Badness { - | ^ +LL | struct Badness { + | ^^^^^^^ error[E0277]: the trait bound `V: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:31:21 @@ -55,11 +53,10 @@ LL | enum Bar { LL | EvenMoreBadness(Bar), | ^^^^^^ the trait `Trait` is not implemented for `V` | -help: consider restricting this type parameter with `V: Trait` - --> $DIR/trait-bounds-on-structs-and-enums.rs:30:18 +help: consider restricting type parameter `V` | -LL | enum MoreBadness { - | ^ +LL | enum MoreBadness { + | ^^^^^^^ error[E0277]: the trait bound `i32: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:35:5 diff --git a/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr b/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr index 5b7f32ba1e0f0..4107c49bd80ce 100644 --- a/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr +++ b/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr @@ -10,11 +10,10 @@ error[E0277]: the trait bound `C: CompareTo` is not satisfied LL | c.same_as(22) | ^^^^^^^ the trait `CompareTo` is not implemented for `C` | -help: consider further restricting this bound with `+ CompareTo` - --> $DIR/traits-repeated-supertrait-ambig.rs:29:17 +help: consider further restricting this bound | -LL | fn with_trait(c: &C) -> bool { - | ^^^^^^^^^^^^^ +LL | fn with_trait>(c: &C) -> bool { + | ^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfied --> $DIR/traits-repeated-supertrait-ambig.rs:34:5 @@ -34,11 +33,10 @@ LL | fn same_as(&self, t: T) -> bool; LL | CompareTo::same_as(c, 22) | ^^^^^^^^^^^^^^^^^^ the trait `CompareTo` is not implemented for `C` | -help: consider further restricting this bound with `+ CompareTo` - --> $DIR/traits-repeated-supertrait-ambig.rs:37:17 +help: consider further restricting this bound | -LL | fn with_ufcs2(c: &C) -> bool { - | ^^^^^^^^^^^^^ +LL | fn with_ufcs2>(c: &C) -> bool { + | ^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `i64: CompareTo` is not satisfied --> $DIR/traits-repeated-supertrait-ambig.rs:42:23 diff --git a/src/test/ui/type-alias-impl-trait/bound_reduction2.stderr b/src/test/ui/type-alias-impl-trait/bound_reduction2.stderr index 74b858105b92f..aff558569eaca 100644 --- a/src/test/ui/type-alias-impl-trait/bound_reduction2.stderr +++ b/src/test/ui/type-alias-impl-trait/bound_reduction2.stderr @@ -4,11 +4,10 @@ error[E0277]: the trait bound `T: TraitWithAssoc` is not satisfied LL | type Foo = impl Trait; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TraitWithAssoc` is not implemented for `T` | -help: consider further restricting this bound with `+ TraitWithAssoc` - --> $DIR/bound_reduction2.rs:18:21 +help: consider further restricting this bound | -LL | fn foo_desugared(_: T) -> Foo { - | ^^^^^^^^^^^^^^ +LL | fn foo_desugared(_: T) -> Foo { + | ^^^^^^^^^^^^^^^^ error: defining opaque type use does not fully define opaque type: generic parameter `V` is specified as concrete type `::Assoc` --> $DIR/bound_reduction2.rs:18:1 diff --git a/src/test/ui/type-alias-impl-trait/generic_underconstrained.stderr b/src/test/ui/type-alias-impl-trait/generic_underconstrained.stderr index 299c7eae8d3a8..f7a04263259f6 100644 --- a/src/test/ui/type-alias-impl-trait/generic_underconstrained.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_underconstrained.stderr @@ -10,12 +10,11 @@ error[E0277]: the trait bound `T: Trait` is not satisfied LL | type Underconstrained = impl 'static; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T` | -help: consider restricting this type parameter with `T: Trait` - --> $DIR/generic_underconstrained.rs:10:19 - | -LL | fn underconstrain(_: T) -> Underconstrained { - | ^ = note: the return type of a function must have a statically known size +help: consider restricting type parameter `T` + | +LL | fn underconstrain(_: T) -> Underconstrained { + | ^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr b/src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr index 56966a32b43b2..ad160abcbd573 100644 --- a/src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr @@ -20,12 +20,11 @@ LL | 5u32 | ---- this returned value is of type `u32` | = help: the trait `std::fmt::Debug` is not implemented for `U` -help: consider restricting this type parameter with `U: std::fmt::Debug` - --> $DIR/generic_underconstrained2.rs:10:21 - | -LL | fn underconstrained(_: U) -> Underconstrained { - | ^ = note: the return type of a function must have a statically known size +help: consider restricting type parameter `U` + | +LL | fn underconstrained(_: U) -> Underconstrained { + | ^^^^^^^^^^^^^^^^^ error[E0277]: `V` doesn't implement `std::fmt::Debug` --> $DIR/generic_underconstrained2.rs:14:1 @@ -37,12 +36,11 @@ LL | 5u32 | ---- this returned value is of type `u32` | = help: the trait `std::fmt::Debug` is not implemented for `V` -help: consider restricting this type parameter with `V: std::fmt::Debug` - --> $DIR/generic_underconstrained2.rs:19:25 - | -LL | fn underconstrained2(_: U, _: V) -> Underconstrained2 { - | ^ = note: the return type of a function must have a statically known size +help: consider restricting type parameter `V` + | +LL | fn underconstrained2(_: U, _: V) -> Underconstrained2 { + | ^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr index 31ee15e0745db..ca9b85bacba39 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -54,11 +54,10 @@ LL | trait Super { } LL | trait Base: Super { } | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/type-check-defaults.rs:21:12 +help: consider further restricting type parameter `T` | -LL | trait Base: Super { } - | ^ +LL | trait Base: Super, T: std::marker::Copy { } + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: cannot add `u8` to `i32` --> $DIR/type-check-defaults.rs:24:66 diff --git a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr index 45c9d8be85ee9..c8411017b3c8d 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr @@ -8,11 +8,10 @@ LL | fn is_send() { | ------- ---- required by this bound in `is_send` | = help: the trait `std::marker::Send` is not implemented for `T` -help: consider restricting this type parameter with `T: std::marker::Send` - --> $DIR/typeck-default-trait-impl-send-param.rs:4:8 +help: consider restricting type parameter `T` | -LL | fn foo() { - | ^ +LL | fn foo() { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/uninhabited/uninhabited-irrefutable.stderr b/src/test/ui/uninhabited/uninhabited-irrefutable.stderr index 26e1be34ea75d..e1ff38f3057f1 100644 --- a/src/test/ui/uninhabited/uninhabited-irrefutable.stderr +++ b/src/test/ui/uninhabited/uninhabited-irrefutable.stderr @@ -15,6 +15,7 @@ LL | let Foo::D(_y) = x; | = 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 `Foo` help: you might want to use `if let` to ignore the variant that isn't matched | LL | if let Foo::D(_y) = x { /* */ } diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr index 9245e293caa85..bfe37b5029c6e 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -10,6 +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` error[E0004]: non-exhaustive patterns: type `&Void` is non-empty --> $DIR/uninhabited-matches-feature-gated.rs:20:19 @@ -21,6 +22,7 @@ LL | let _ = match x {}; | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `&Void` error[E0004]: non-exhaustive patterns: type `(Void,)` is non-empty --> $DIR/uninhabited-matches-feature-gated.rs:23:19 @@ -29,6 +31,7 @@ LL | let _ = match x {}; | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `(Void,)` error[E0004]: non-exhaustive patterns: type `[Void; 1]` is non-empty --> $DIR/uninhabited-matches-feature-gated.rs:26:19 @@ -37,6 +40,7 @@ LL | let _ = match x {}; | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + = note: the matched value is of type `[Void; 1]` error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered --> $DIR/uninhabited-matches-feature-gated.rs:29:19 @@ -45,6 +49,7 @@ LL | let _ = match x { | ^ pattern `&[_, ..]` 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 `&[Void]` error[E0004]: non-exhaustive patterns: `Err(_)` not covered --> $DIR/uninhabited-matches-feature-gated.rs:37:19 @@ -58,6 +63,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` error[E0005]: refutable pattern in local binding: `Err(_)` not covered --> $DIR/uninhabited-matches-feature-gated.rs:42:9 @@ -72,6 +78,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` help: you might want to use `if let` to ignore the variant that isn't matched | LL | if let Ok(x) = x { /* */ } diff --git a/src/test/ui/unop-move-semantics.stderr b/src/test/ui/unop-move-semantics.stderr index ab641c40dfe44..e0499cfe95ce9 100644 --- a/src/test/ui/unop-move-semantics.stderr +++ b/src/test/ui/unop-move-semantics.stderr @@ -9,11 +9,10 @@ LL | LL | x.clone(); | ^ value borrowed here after move | -help: consider further restricting this bound with `+ Copy` - --> $DIR/unop-move-semantics.rs:5:24 +help: consider further restricting this bound | -LL | fn move_then_borrow + Clone>(x: T) { - | ^^^^^^^^^^^^^^^^^^^^^ +LL | fn move_then_borrow + Clone + Copy>(x: T) { + | ^^^^^^ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/unop-move-semantics.rs:15:6 diff --git a/src/test/ui/wf/wf-enum-bound.stderr b/src/test/ui/wf/wf-enum-bound.stderr index be64ddb975994..f70f67d414fc3 100644 --- a/src/test/ui/wf/wf-enum-bound.stderr +++ b/src/test/ui/wf/wf-enum-bound.stderr @@ -7,11 +7,10 @@ LL | trait ExtraCopy { } LL | where T: ExtraCopy | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U` | -help: consider restricting this type parameter with `where U: std::marker::Copy` - --> $DIR/wf-enum-bound.rs:9:17 +help: consider further restricting type parameter `U` | -LL | enum SomeEnum - | ^ +LL | where T: ExtraCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr index 40454b33b7b76..8634b7dba5c36 100644 --- a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr +++ b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr @@ -7,11 +7,10 @@ LL | struct IsCopy { LL | f: IsCopy | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A` | -help: consider restricting this type parameter with `A: std::marker::Copy` - --> $DIR/wf-enum-fields-struct-variant.rs:11:18 +help: consider restricting type parameter `A` | -LL | enum AnotherEnum { - | ^ +LL | enum AnotherEnum { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-enum-fields.stderr b/src/test/ui/wf/wf-enum-fields.stderr index e2612add776d4..a22b2d11a91cb 100644 --- a/src/test/ui/wf/wf-enum-fields.stderr +++ b/src/test/ui/wf/wf-enum-fields.stderr @@ -7,11 +7,10 @@ LL | struct IsCopy { LL | SomeVariant(IsCopy) | ^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A` | -help: consider restricting this type parameter with `A: std::marker::Copy` - --> $DIR/wf-enum-fields.rs:11:15 +help: consider restricting type parameter `A` | -LL | enum SomeEnum { - | ^ +LL | enum SomeEnum { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-fn-where-clause.stderr b/src/test/ui/wf/wf-fn-where-clause.stderr index 2a4f2df5a8986..cf1aeac7e3e41 100644 --- a/src/test/ui/wf/wf-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-fn-where-clause.stderr @@ -7,11 +7,10 @@ LL | LL | fn foo() where T: ExtraCopy | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U` | -help: consider restricting this type parameter with `where U: std::marker::Copy` - --> $DIR/wf-fn-where-clause.rs:8:10 +help: consider further restricting type parameter `U` | -LL | fn foo() where T: ExtraCopy - | ^ +LL | fn foo() where T: ExtraCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `(dyn std::marker::Copy + 'static)` cannot be known at compilation time --> $DIR/wf-fn-where-clause.rs:12:16 diff --git a/src/test/ui/wf/wf-impl-associated-type-trait.stderr b/src/test/ui/wf/wf-impl-associated-type-trait.stderr index 7774299b39357..d44a6f01a47f6 100644 --- a/src/test/ui/wf/wf-impl-associated-type-trait.stderr +++ b/src/test/ui/wf/wf-impl-associated-type-trait.stderr @@ -7,11 +7,10 @@ LL | pub struct MySet { LL | type Bar = MySet; | ^^^^^^^^^^^^^^^^^^^^ the trait `MyHash` is not implemented for `T` | -help: consider restricting this type parameter with `T: MyHash` - --> $DIR/wf-impl-associated-type-trait.rs:16:6 +help: consider restricting type parameter `T` | -LL | impl Foo for T { - | ^ +LL | impl Foo for T { + | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-arg.stderr b/src/test/ui/wf/wf-in-fn-arg.stderr index c1a6657e63be7..907701440aad5 100644 --- a/src/test/ui/wf/wf-in-fn-arg.stderr +++ b/src/test/ui/wf/wf-in-fn-arg.stderr @@ -7,11 +7,10 @@ LL | struct MustBeCopy { LL | fn bar(_: &MustBeCopy) | ^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/wf-in-fn-arg.rs:10:8 +help: consider restricting type parameter `T` | -LL | fn bar(_: &MustBeCopy) - | ^ +LL | fn bar(_: &MustBeCopy) + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-ret.stderr b/src/test/ui/wf/wf-in-fn-ret.stderr index 754d64df0194b..2ed4eecefe135 100644 --- a/src/test/ui/wf/wf-in-fn-ret.stderr +++ b/src/test/ui/wf/wf-in-fn-ret.stderr @@ -7,11 +7,10 @@ LL | struct MustBeCopy { LL | fn bar() -> MustBeCopy | ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/wf-in-fn-ret.rs:10:8 +help: consider restricting type parameter `T` | -LL | fn bar() -> MustBeCopy - | ^ +LL | fn bar() -> MustBeCopy + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-type-arg.stderr b/src/test/ui/wf/wf-in-fn-type-arg.stderr index 97a5c0fd913a4..0c699838abd2a 100644 --- a/src/test/ui/wf/wf-in-fn-type-arg.stderr +++ b/src/test/ui/wf/wf-in-fn-type-arg.stderr @@ -7,11 +7,10 @@ LL | struct MustBeCopy { LL | x: fn(MustBeCopy) | ^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/wf-in-fn-type-arg.rs:7:12 +help: consider restricting type parameter `T` | -LL | struct Bar { - | ^ +LL | struct Bar { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-type-ret.stderr b/src/test/ui/wf/wf-in-fn-type-ret.stderr index 527b000edf883..3429ab89ffbac 100644 --- a/src/test/ui/wf/wf-in-fn-type-ret.stderr +++ b/src/test/ui/wf/wf-in-fn-type-ret.stderr @@ -7,11 +7,10 @@ LL | struct MustBeCopy { LL | x: fn() -> MustBeCopy | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/wf-in-fn-type-ret.rs:7:12 +help: consider restricting type parameter `T` | -LL | struct Foo { - | ^ +LL | struct Foo { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-where-clause.stderr b/src/test/ui/wf/wf-in-fn-where-clause.stderr index 62c672a21e86e..d33749d795c59 100644 --- a/src/test/ui/wf/wf-in-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-in-fn-where-clause.stderr @@ -7,11 +7,10 @@ LL | trait MustBeCopy { LL | where T: MustBeCopy | ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U` | -help: consider restricting this type parameter with `where U: std::marker::Copy` - --> $DIR/wf-in-fn-where-clause.rs:9:10 +help: consider further restricting type parameter `U` | -LL | fn bar() - | ^ +LL | where T: MustBeCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-obj-type-trait.stderr b/src/test/ui/wf/wf-in-obj-type-trait.stderr index 1b6438cdc2477..605dc49784954 100644 --- a/src/test/ui/wf/wf-in-obj-type-trait.stderr +++ b/src/test/ui/wf/wf-in-obj-type-trait.stderr @@ -7,11 +7,10 @@ LL | struct MustBeCopy { LL | x: dyn Object> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/wf-in-obj-type-trait.rs:9:12 +help: consider restricting type parameter `T` | -LL | struct Bar { - | ^ +LL | struct Bar { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr index 70337ee40eacf..da2f8085a8a9e 100644 --- a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr +++ b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr @@ -7,11 +7,10 @@ LL | trait ExtraCopy { } LL | fn foo(self) where T: ExtraCopy | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U` | -help: consider restricting this type parameter with `U: std::marker::Copy` - --> $DIR/wf-inherent-impl-method-where-clause.rs:11:8 +help: consider restricting type parameter `U` | -LL | impl Foo { - | ^ +LL | impl Foo { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr index c26d0ef787195..28d5bc62556ab 100644 --- a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr +++ b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr @@ -7,11 +7,10 @@ LL | trait ExtraCopy { } LL | impl Foo where T: ExtraCopy | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U` | -help: consider restricting this type parameter with `where U: std::marker::Copy` - --> $DIR/wf-inherent-impl-where-clause.rs:11:8 +help: consider further restricting type parameter `U` | -LL | impl Foo where T: ExtraCopy - | ^ +LL | impl Foo where T: ExtraCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-struct-bound.stderr b/src/test/ui/wf/wf-struct-bound.stderr index 545e4f870954c..07e569ddac11d 100644 --- a/src/test/ui/wf/wf-struct-bound.stderr +++ b/src/test/ui/wf/wf-struct-bound.stderr @@ -7,11 +7,10 @@ LL | trait ExtraCopy { } LL | where T: ExtraCopy | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U` | -help: consider restricting this type parameter with `where U: std::marker::Copy` - --> $DIR/wf-struct-bound.rs:9:21 +help: consider further restricting type parameter `U` | -LL | struct SomeStruct - | ^ +LL | where T: ExtraCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-struct-field.stderr b/src/test/ui/wf/wf-struct-field.stderr index f0ebdfba2ffc6..f3bce24eace07 100644 --- a/src/test/ui/wf/wf-struct-field.stderr +++ b/src/test/ui/wf/wf-struct-field.stderr @@ -7,11 +7,10 @@ LL | struct IsCopy { LL | data: IsCopy | ^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A` | -help: consider restricting this type parameter with `A: std::marker::Copy` - --> $DIR/wf-struct-field.rs:11:19 +help: consider restricting type parameter `A` | -LL | struct SomeStruct { - | ^ +LL | struct SomeStruct { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-trait-associated-type-bound.stderr b/src/test/ui/wf/wf-trait-associated-type-bound.stderr index dfccd4865686e..6cf7f2069b6b7 100644 --- a/src/test/ui/wf/wf-trait-associated-type-bound.stderr +++ b/src/test/ui/wf/wf-trait-associated-type-bound.stderr @@ -7,11 +7,10 @@ LL | trait ExtraCopy { } LL | type Type1: ExtraCopy; | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/wf-trait-associated-type-bound.rs:9:17 +help: consider restricting type parameter `T` | -LL | trait SomeTrait { - | ^ +LL | trait SomeTrait { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-trait-bound.stderr b/src/test/ui/wf/wf-trait-bound.stderr index 31faa14426a1f..b8ffad6d1802b 100644 --- a/src/test/ui/wf/wf-trait-bound.stderr +++ b/src/test/ui/wf/wf-trait-bound.stderr @@ -7,11 +7,10 @@ LL | trait ExtraCopy { } LL | where T: ExtraCopy | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U` | -help: consider restricting this type parameter with `where U: std::marker::Copy` - --> $DIR/wf-trait-bound.rs:9:19 +help: consider further restricting type parameter `U` | -LL | trait SomeTrait - | ^ +LL | where T: ExtraCopy, U: std::marker::Copy + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-trait-superbound.stderr b/src/test/ui/wf/wf-trait-superbound.stderr index 372a5f8ba5db7..88b4bec045179 100644 --- a/src/test/ui/wf/wf-trait-superbound.stderr +++ b/src/test/ui/wf/wf-trait-superbound.stderr @@ -7,11 +7,10 @@ LL | LL | trait SomeTrait: ExtraCopy { | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/wf-trait-superbound.rs:9:17 +help: consider restricting type parameter `T` | -LL | trait SomeTrait: ExtraCopy { - | ^ +LL | trait SomeTrait: ExtraCopy { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr index c6f12e7753c82..fb1471e95bbd9 100644 --- a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr +++ b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr @@ -7,11 +7,10 @@ LL | fn require_copy(x: T) {} LL | require_copy(self.x); | ^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/where-clause-constraints-are-local-for-inherent-impl.rs:6:6 +help: consider restricting type parameter `T` | -LL | impl Foo { - | ^ +LL | impl Foo { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr index 95688d6f2e485..6c1516d8ac9e7 100644 --- a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr +++ b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr @@ -7,11 +7,10 @@ LL | fn require_copy(x: T) {} LL | require_copy(self.x); | ^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | -help: consider restricting this type parameter with `T: std::marker::Copy` - --> $DIR/where-clause-constraints-are-local-for-trait-impl.rs:11:6 +help: consider restricting type parameter `T` | -LL | impl Foo for Bar { - | ^ +LL | impl Foo for Bar { + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error