diff options
| author | Michael Goulet <michael@errs.io> | 2022-08-16 06:27:22 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-08-21 02:34:52 +0000 |
| commit | c005e760f518254af6c47b36ddb16b8fe8aecb6a (patch) | |
| tree | 0a4af4548e859e4cae781a98915c92c41207f364 | |
| parent | fb80d2bfe4413b2e3228dc76a792744dbc1892be (diff) | |
| download | rust-c005e760f518254af6c47b36ddb16b8fe8aecb6a.tar.gz rust-c005e760f518254af6c47b36ddb16b8fe8aecb6a.zip | |
Rework point-at-arg
155 files changed, 1269 insertions, 782 deletions
diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index 8fb5f159136..59ea1f3f9de 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -740,12 +740,12 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { err.help("...or use `match` instead of `let...else`"); } _ => { - if let ObligationCauseCode::BindingObligation(_, binding_span) = - cause.code().peel_derives() + if let ObligationCauseCode::BindingObligation(_, span) + | ObligationCauseCode::ExprBindingObligation(_, span, ..) + = cause.code().peel_derives() + && let TypeError::RegionsPlaceholderMismatch = terr { - if matches!(terr, TypeError::RegionsPlaceholderMismatch) { - err.span_note(*binding_span, "the lifetime requirement is introduced here"); - } + err.span_note(*span, "the lifetime requirement is introduced here"); } } } diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mismatched_static_lifetime.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mismatched_static_lifetime.rs index 893ca3cf79d..c20b96cae2e 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mismatched_static_lifetime.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mismatched_static_lifetime.rs @@ -35,7 +35,8 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { let ObligationCauseCode::MatchImpl(parent, impl_def_id) = code else { return None; }; - let ObligationCauseCode::BindingObligation(_def_id, binding_span) = *parent.code() else { + let (ObligationCauseCode::BindingObligation(_, binding_span) | ObligationCauseCode::ExprBindingObligation(_, binding_span, ..)) + = *parent.code() else { return None; }; let mut err = self.tcx().sess.struct_span_err(cause.span, "incompatible lifetime on type"); diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs index 998699158ff..d4db0751212 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs @@ -211,7 +211,10 @@ impl<'tcx> NiceRegionError<'_, 'tcx> { ); let mut err = self.tcx().sess.struct_span_err(span, &msg); - let leading_ellipsis = if let ObligationCauseCode::ItemObligation(def_id) = *cause.code() { + let leading_ellipsis = if let ObligationCauseCode::ItemObligation(def_id) + | ObligationCauseCode::ExprItemObligation(def_id, ..) = + *cause.code() + { err.span_label(span, "doesn't satisfy where-clause"); err.span_label( self.tcx().def_span(def_id), diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs index 9886c572a8a..f804569b074 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -232,7 +232,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { ObligationCauseCode::MatchImpl(parent, ..) => parent.code(), _ => cause.code(), } - && let (&ObligationCauseCode::ItemObligation(item_def_id), None) = (code, override_error_code) + && let (&ObligationCauseCode::ItemObligation(item_def_id) | &ObligationCauseCode::ExprItemObligation(item_def_id, ..), None) = (code, override_error_code) { // Same case of `impl Foo for dyn Bar { fn qux(&self) {} }` introducing a `'static` // lifetime as above, but called using a fully-qualified path to the method: diff --git a/compiler/rustc_infer/src/infer/error_reporting/note.rs b/compiler/rustc_infer/src/infer/error_reporting/note.rs index 8dabdfd55c7..8c465b08760 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/note.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/note.rs @@ -390,10 +390,12 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { if matches!( &trace.cause.code().peel_derives(), ObligationCauseCode::BindingObligation(..) + | ObligationCauseCode::ExprBindingObligation(..) ) => { // Hack to get around the borrow checker because trace.cause has an `Rc`. - if let ObligationCauseCode::BindingObligation(_, span) = + if let ObligationCauseCode::BindingObligation(_, span) + | ObligationCauseCode::ExprBindingObligation(_, span, ..) = &trace.cause.code().peel_derives() { let span = *span; diff --git a/compiler/rustc_infer/src/infer/outlives/obligations.rs b/compiler/rustc_infer/src/infer/outlives/obligations.rs index ad052f58ca8..dded0a0a6b1 100644 --- a/compiler/rustc_infer/src/infer/outlives/obligations.rs +++ b/compiler/rustc_infer/src/infer/outlives/obligations.rs @@ -97,7 +97,8 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> { cause.span, sup_type, match cause.code().peel_derives() { - ObligationCauseCode::BindingObligation(_, span) => Some(*span), + ObligationCauseCode::BindingObligation(_, span) + | ObligationCauseCode::ExprBindingObligation(_, span, ..) => Some(*span), _ => None, }, ) diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs index 72b848c3ee2..e91878c62fd 100644 --- a/compiler/rustc_middle/src/traits/mod.rs +++ b/compiler/rustc_middle/src/traits/mod.rs @@ -238,9 +238,13 @@ pub enum ObligationCauseCode<'tcx> { /// also implement all supertraits of `X`. ItemObligation(DefId), + ExprItemObligation(DefId, rustc_hir::HirId, usize), + /// Like `ItemObligation`, but with extra detail on the source of the obligation. BindingObligation(DefId, Span), + ExprBindingObligation(DefId, Span, rustc_hir::HirId, usize), + /// A type like `&'a T` is WF only if `T: 'a`. ReferenceOutlivesReferent(Ty<'tcx>), diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index 1a39a168038..ab445afe6d6 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -1564,6 +1564,8 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { obligation.cause.code().peel_derives(), ObligationCauseCode::ItemObligation(_) | ObligationCauseCode::BindingObligation(_, _) + | ObligationCauseCode::ExprItemObligation(..) + | ObligationCauseCode::ExprBindingObligation(..) | ObligationCauseCode::ObjectCastObligation(..) | ObligationCauseCode::OpaqueType ); @@ -2091,13 +2093,11 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { } } - if let ObligationCauseCode::ItemObligation(def_id) = *obligation.cause.code() { + if let ObligationCauseCode::ItemObligation(def_id) | ObligationCauseCode::ExprItemObligation(def_id, ..) = *obligation.cause.code() { self.suggest_fully_qualified_path(&mut err, def_id, span, trait_ref.def_id()); - } else if let ( - Ok(ref snippet), - &ObligationCauseCode::BindingObligation(def_id, _), - ) = - (self.tcx.sess.source_map().span_to_snippet(span), obligation.cause.code()) + } else if let Ok(snippet) = &self.tcx.sess.source_map().span_to_snippet(span) + && let ObligationCauseCode::BindingObligation(def_id, _) | ObligationCauseCode::ExprBindingObligation(def_id, ..) + = *obligation.cause.code() { let generics = self.tcx.generics_of(def_id); if generics.params.iter().any(|p| p.name != kw::SelfUpper) @@ -2520,15 +2520,10 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { err: &mut Diagnostic, obligation: &PredicateObligation<'tcx>, ) { - let ( - ty::PredicateKind::Trait(pred), - &ObligationCauseCode::BindingObligation(item_def_id, span), - ) = ( - obligation.predicate.kind().skip_binder(), - obligation.cause.code().peel_derives(), - ) else { - return; - }; + let ty::PredicateKind::Trait(pred) = obligation.predicate.kind().skip_binder() else { return; }; + let (ObligationCauseCode::BindingObligation(item_def_id, span) + | ObligationCauseCode::ExprBindingObligation(item_def_id, span, ..)) + = *obligation.cause.code().peel_derives() else { return; }; debug!(?pred, ?item_def_id, ?span); let (Some(node), true) = ( diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs index e6907637c57..6b03555bc69 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs @@ -143,7 +143,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { } if let ObligationCauseCode::ItemObligation(item) - | ObligationCauseCode::BindingObligation(item, _) = *obligation.cause.code() + | ObligationCauseCode::BindingObligation(item, _) + | ObligationCauseCode::ExprItemObligation(item, ..) + | ObligationCauseCode::ExprBindingObligation(item, ..) = *obligation.cause.code() { // FIXME: maybe also have some way of handling methods // from other traits? That would require name resolution, diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 0d279069694..418eae9b0e8 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -1022,7 +1022,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { if let ObligationCauseCode::ImplDerivedObligation(cause) = &*code { try_borrowing(cause.derived.parent_trait_pred, &[]) } else if let ObligationCauseCode::BindingObligation(_, _) - | ObligationCauseCode::ItemObligation(..) = code + | ObligationCauseCode::ItemObligation(_) + | ObligationCauseCode::ExprItemObligation(..) + | ObligationCauseCode::ExprBindingObligation(..) = code { try_borrowing(poly_trait_pred, &never_suggest_borrow) } else { @@ -2244,11 +2246,13 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { region, object_ty, )); } - ObligationCauseCode::ItemObligation(_item_def_id) => { + ObligationCauseCode::ItemObligation(_) + | ObligationCauseCode::ExprItemObligation(..) => { // We hold the `DefId` of the item introducing the obligation, but displaying it // doesn't add user usable information. It always point at an associated item. } - ObligationCauseCode::BindingObligation(item_def_id, span) => { + ObligationCauseCode::BindingObligation(item_def_id, span) + | ObligationCauseCode::ExprBindingObligation(item_def_id, span, ..) => { let item_name = tcx.def_path_str(item_def_id); let mut multispan = MultiSpan::from(span); if let Some(ident) = tcx.opt_item_ident(item_def_id) { diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index b6d6df1eec6..85ff6e23711 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -117,11 +117,21 @@ pub enum TraitQueryMode { /// Creates predicate obligations from the generic bounds. pub fn predicates_for_generics<'tcx>( - cause: ObligationCause<'tcx>, + cause: impl Fn(usize, Span) -> ObligationCause<'tcx>, param_env: ty::ParamEnv<'tcx>, generic_bounds: ty::InstantiatedPredicates<'tcx>, ) -> impl Iterator<Item = PredicateObligation<'tcx>> { - util::predicates_for_generics(cause, 0, param_env, generic_bounds) + let generic_bounds = generic_bounds; + debug!("predicates_for_generics(generic_bounds={:?})", generic_bounds); + + std::iter::zip(generic_bounds.predicates, generic_bounds.spans).enumerate().map( + move |(idx, (predicate, span))| Obligation { + cause: cause(idx, span), + recursion_depth: 0, + param_env: param_env, + predicate, + }, + ) } /// Determines whether the type `ty` is known to meet `bound` and diff --git a/compiler/rustc_trait_selection/src/traits/util.rs b/compiler/rustc_trait_selection/src/traits/util.rs index d2500601662..0f5dff01c66 100644 --- a/compiler/rustc_trait_selection/src/traits/util.rs +++ b/compiler/rustc_trait_selection/src/traits/util.rs @@ -11,8 +11,6 @@ use rustc_middle::ty::{self, ImplSubject, ToPredicate, Ty, TyCtxt, TypeVisitable use super::{Normalized, Obligation, ObligationCause, PredicateObligation, SelectionContext}; pub use rustc_infer::traits::{self, util::*}; -use std::iter; - /////////////////////////////////////////////////////////////////////////// // `TraitAliasExpander` iterator /////////////////////////////////////////////////////////////////////////// @@ -210,7 +208,7 @@ pub fn impl_subject_and_oblig<'a, 'tcx>( let Normalized { value: predicates, obligations: normalization_obligations2 } = super::normalize(selcx, param_env, ObligationCause::dummy(), predicates); let impl_obligations = - predicates_for_generics(ObligationCause::dummy(), 0, param_env, predicates); + super::predicates_for_generics(|_, _| ObligationCause::dummy(), param_env, predicates); let impl_obligations = impl_obligations .chain(normalization_obligations1.into_iter()) @@ -219,27 +217,6 @@ pub fn impl_subject_and_oblig<'a, 'tcx>( (subject, impl_obligations) } -pub fn predicates_for_generics<'tcx>( - cause: ObligationCause<'tcx>, - recursion_depth: usize, - param_env: ty::ParamEnv<'tcx>, - generic_bounds: ty::InstantiatedPredicates<'tcx>, -) -> impl Iterator<Item = PredicateObligation<'tcx>> { - debug!("predicates_for_generics(generic_bounds={:?})", generic_bounds); - - iter::zip(generic_bounds.predicates, generic_bounds.spans).map(move |(predicate, span)| { - let cause = match *cause.code() { - traits::ItemObligation(def_id) if !span.is_dummy() => traits::ObligationCause::new( - cause.span, - cause.body_id, - traits::BindingObligation(def_id, span), - ), - _ => cause.clone(), - }; - Obligation { cause, recursion_depth, param_env, predicate } - }) -} - pub fn predicate_for_trait_ref<'tcx>( tcx: TyCtxt<'tcx>, cause: ObligationCause<'tcx>, diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs index 7a5e67ff74b..4bd179d2391 100644 --- a/compiler/rustc_trait_selection/src/traits/wf.rs +++ b/compiler/rustc_trait_selection/src/traits/wf.rs @@ -711,7 +711,7 @@ impl<'tcx> WfPredicates<'tcx> { iter::zip(iter::zip(predicates.predicates, predicates.spans), origins.into_iter().rev()) .map(|((mut pred, span), origin_def_id)| { let code = if span.is_dummy() { - traits::MiscObligation + traits::ItemObligation(origin_def_id) } else { traits::BindingObligation(origin_def_id, span) }; diff --git a/compiler/rustc_typeck/src/check/compare_method.rs b/compiler/rustc_typeck/src/check/compare_method.rs index ec8d22e81d1..64846953aac 100644 --- a/compiler/rustc_typeck/src/check/compare_method.rs +++ b/compiler/rustc_typeck/src/check/compare_method.rs @@ -1463,7 +1463,7 @@ pub fn check_type_bounds<'tcx>( ); let mk_cause = |span: Span| { let code = if span.is_dummy() { - traits::MiscObligation + traits::ItemObligation(trait_ty.def_id) } else { traits::BindingObligation(trait_ty.def_id, span) }; diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs index 1d9d04ceec0..20d25d508d2 100644 --- a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs +++ b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs @@ -607,9 +607,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { #[instrument(skip(self), level = "debug")] pub(in super::super) fn select_all_obligations_or_error(&self) { - let errors = self.fulfillment_cx.borrow_mut().select_all_or_error(&self); + let mut errors = self.fulfillment_cx.borrow_mut().select_all_or_error(&self); if !errors.is_empty() { + self.adjust_fulfillment_errors_for_expr_obligation(&mut errors); self.report_fulfillment_errors(&errors, self.inh.body_id, false); } } @@ -623,6 +624,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let mut result = self.fulfillment_cx.borrow_mut().select_where_possible(self); if !result.is_empty() { mutate_fulfillment_errors(&mut result); + self.adjust_fulfillment_errors_for_expr_obligation(&mut result); self.report_fulfillment_errors(&result, self.inh.body_id, fallback_has_occurred); } } @@ -820,23 +822,25 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let ty = item_ty.subst(self.tcx, substs); self.write_resolution(hir_id, Ok((def_kind, def_id))); - self.add_required_obligations_with_code( - span, - def_id, - &substs, - match lang_item { - hir::LangItem::IntoFutureIntoFuture => { - ObligationCauseCode::AwaitableExpr(expr_hir_id) - } - hir::LangItem::IteratorNext | hir::LangItem::IntoIterIntoIter => { - ObligationCauseCode::ForLoopIterator - } - hir::LangItem::TryTraitFromOutput - | hir::LangItem::TryTraitFromResidual - | hir::LangItem::TryTraitBranch => ObligationCauseCode::QuestionMark, - _ => traits::ItemObligation(def_id), - }, - ); + + let code = match lang_item { + hir::LangItem::IntoFutureIntoFuture => { + Some(ObligationCauseCode::AwaitableExpr(expr_hir_id)) + } + hir::LangItem::IteratorNext | hir::LangItem::IntoIterIntoIter => { + Some(ObligationCauseCode::ForLoopIterator) + } + hir::LangItem::TryTraitFromOutput + | hir::LangItem::TryTraitFromResidual + | hir::LangItem::TryTraitBranch => Some(ObligationCauseCode::QuestionMark), + _ => None, + }; + if let Some(code) = code { + self.add_required_obligations_with_code(span, def_id, substs, move |_, _| code.clone()); + } else { + self.add_required_obligations_for_hir(span, def_id, substs, hir_id); + } + (Res::Def(def_kind, def_id), ty) } @@ -1348,7 +1352,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // First, store the "user substs" for later. self.write_user_type_annotation_from_substs(hir_id, def_id, substs, user_self_ty); - self.add_required_obligations(span, def_id, &substs); + self.add_required_obligations_for_hir(span, def_id, &substs, hir_id); // Substitute the values for the type parameters into the type of // the referenced item. @@ -1385,32 +1389,36 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } /// Add all the obligations that are required, substituting and normalized appropriately. - pub(crate) fn add_required_obligations( + pub(crate) fn add_required_obligations_for_hir( &self, span: Span, def_id: DefId, - substs: &SubstsRef<'tcx>, + substs: SubstsRef<'tcx>, + hir_id: hir::HirId, ) { - self.add_required_obligations_with_code( - span, - def_id, - substs, - traits::ItemObligation(def_id), - ) + self.add_required_obligations_with_code(span, def_id, substs, |idx, span| { + if span.is_dummy() { + ObligationCauseCode::ExprItemObligation(def_id, hir_id, idx) + } else { + ObligationCauseCode::ExprBindingObligation(def_id, span, hir_id, idx) + } + }) } - #[tracing::instrument(level = "debug", skip(self, span, def_id, substs))] + #[tracing::instrument(level = "debug", skip(self, code, span, def_id, substs))] fn add_required_obligations_with_code( &self, span: Span, def_id: DefId, - substs: &SubstsRef<'tcx>, - code: ObligationCauseCode<'tcx>, + substs: SubstsRef<'tcx>, + code: impl Fn(usize, Span) -> ObligationCauseCode<'tcx>, ) { let (bounds, _) = self.instantiate_bounds(span, def_id, &substs); for obligation in traits::predicates_for_generics( - traits::ObligationCause::new(span, self.body_id, code), + |idx, predicate_span| { + traits::ObligationCause::new(span, self.body_id, code(idx, predicate_span)) + }, self.param_env, bounds, ) { diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs b/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs index aab60de80ef..1d59840bf0a 100644 --- a/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs +++ b/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs @@ -247,17 +247,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Cause selection errors caused by resolving a single argument to point at the // argument and not the call. This lets us customize the span pointed to in the // fulfillment error to be more accurate. - let coerced_ty = - self.resolve_vars_with_obligations_and_mutate_fulfillment(coerced_ty, |errors| { - self.point_at_type_arg_instead_of_call_if_possible(errors, call_expr); - self.point_at_arg_instead_of_call_if_possible( - errors, - call_expr, - call_span, - provided_args, - &expected_input_tys, - ); - }); + let coerced_ty = self.resolve_vars_with_obligations(coerced_ty); let coerce_error = self .try_coerce(provided_arg, checked_ty, coerced_ty, AllowTwoPhase::Yes, None) @@ -312,16 +302,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // an "opportunistic" trait resolution of any trait bounds on // the call. This helps coercions. if check_closures { - self.select_obligations_where_possible(false, |errors| { - self.point_at_type_arg_instead_of_call_if_possible(errors, call_expr); - self.point_at_arg_instead_of_call_if_possible( - errors, - call_expr, - call_span, - &provided_args, - &expected_input_tys, - ); - }) + self.select_obligations_where_possible(false, |_| {}) } // Check each argument, to satisfy the input it was provided for @@ -1183,7 +1164,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.write_user_type_annotation_from_substs(hir_id, did, substs, None); // Check bounds on type arguments used in the path. - self.add_required_obligations(path_span, did, substs); + self.add_required_obligations_for_hir(path_span, did, substs, hir_id); Some((variant, ty)) } else { @@ -1626,179 +1607,174 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// can be not easily comparable with predicate type (because of coercion). If the types match /// for either checked or coerced type, and there's only *one* argument that does, we point at /// the corresponding argument's expression span instead of the `fn` call path span. - fn point_at_arg_instead_of_call_if_possible( + pub(super) fn adjust_fulfillment_errors_for_expr_obligation( &self, errors: &mut Vec<traits::FulfillmentError<'tcx>>, - expr: &'tcx hir::Expr<'tcx>, - call_sp: Span, - args: &'tcx [hir::Expr<'tcx>], - expected_tys: &[Ty<'tcx>], ) { - // We *do not* do this for desugared call spans to keep good diagnostics when involving - // the `?` operator. - if call_sp.desugaring_kind().is_some() { - return; + for error in errors { + self.adjust_fulfillment_error_for_expr_obligation(error); } + } - 'outer: for error in errors { - // Only if the cause is somewhere inside the expression we want try to point at arg. - // Otherwise, it means that the cause is somewhere else and we should not change - // anything because we can break the correct span. - if !call_sp.contains(error.obligation.cause.span) { - continue; - } + fn adjust_fulfillment_error_for_expr_obligation( + &self, + error: &mut traits::FulfillmentError<'tcx>, + ) { + let (traits::ExprItemObligation(def_id, hir_id, idx) | traits::ExprBindingObligation(def_id, _, hir_id, idx)) + = *error.obligation.cause.code().peel_derives() else { return; }; + let Some(unsubstituted_pred) = + self.tcx.predicates_of(def_id).instantiate_identity(self.tcx).predicates.into_iter().nth(idx) else { return; }; + + let generics = self.tcx.generics_of(def_id); + let predicate_substs = match unsubstituted_pred.kind().skip_binder() { + ty::PredicateKind::Trait(pred) => pred.trait_ref.substs, + ty::PredicateKind::Projection(pred) => pred.projection_ty.substs, + _ => ty::List::empty(), + }; + let param_to_point_at = predicate_substs.types().find_map(|ty| { + ty.walk().find_map(|arg| { + if let ty::GenericArgKind::Type(ty) = arg.unpack() + && let ty::Param(param_ty) = ty.kind() + // Look for a param ty that is local to this method/fn + // and not inherited from an impl, for example. + && self.tcx.parent(generics.type_param(param_ty, self.tcx).def_id) == def_id + { + Some(arg) + } else { + None + } + }) + }); - // Peel derived obligation, because it's the type that originally - // started this inference chain that matters, not the one we wound - // up with at the end. - fn unpeel_to_top<'a, 'tcx>( - mut code: &'a ObligationCauseCode<'tcx>, - ) -> &'a ObligationCauseCode<'tcx> { - let mut result_code = code; - loop { - let parent = match code { - ObligationCauseCode::ImplDerivedObligation(c) => &c.derived.parent_code, - ObligationCauseCode::BuiltinDerivedObligation(c) - | ObligationCauseCode::DerivedObligation(c) => &c.parent_code, - _ => break result_code, - }; - (result_code, code) = (code, parent); + let fallback_param_to_point_at = predicate_substs.types().find_map(|ty| { + ty.walk().find_map(|arg| { + if let ty::GenericArgKind::Type(ty) = arg.unpack() + && let ty::Param(param_ty) = ty.kind() + && self.tcx.parent(generics.type_param(param_ty, self.tcx).def_id) != def_id + { + Some(arg) + } else { + None } - } - let self_: ty::subst::GenericArg<'_> = - match unpeel_to_top(error.obligation.cause.code()) { - ObligationCauseCode::BuiltinDerivedObligation(code) - | ObligationCauseCode::DerivedObligation(code) => { - code.parent_trait_pred.self_ty().skip_binder().into() + }) + }); + + let hir = self.tcx.hir(); + match hir.get(hir_id) { + hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Path(hir::QPath::Resolved(_, path)), hir_id, .. }) => { + if let hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Call(callee, args), hir_id: call_hir_id, .. }) + = hir.get(hir.get_parent_node(*hir_id)) + && callee.hir_id == *hir_id + { + if let Some(param_to_point_at) = param_to_point_at + && self.point_at_args_if_possible(error, def_id, param_to_point_at, *call_hir_id, callee.span, args) { + return; } - ObligationCauseCode::ImplDerivedObligation(code) => { - code.derived.parent_trait_pred.self_ty().skip_binder().into() + + if let Some(fallback_param_to_point_at) = fallback_param_to_point_at + && self.point_at_args_if_possible(error, def_id, fallback_param_to_point_at, *call_hir_id, callee.span, args) + { + return; } - _ => match error.obligation.predicate.kind().skip_binder() { - ty::PredicateKind::Trait(predicate) => predicate.self_ty().into(), - ty::PredicateKind::Projection(predicate) => { - predicate.projection_ty.self_ty().into() - } - _ => continue, - }, - }; - let self_ = self.resolve_vars_if_possible(self_); - let ty_matches_self = |ty: Ty<'tcx>| ty.walk().any(|arg| arg == self_); - - let typeck_results = self.typeck_results.borrow(); - - for (idx, arg) in args.iter().enumerate() { - // Don't adjust the span if we already have a more precise span - // within one of the args. - if arg.span.contains(error.obligation.cause.span) { - let references_arg = - typeck_results.expr_ty_opt(arg).map_or(false, &ty_matches_self) - || expected_tys.get(idx).copied().map_or(false, &ty_matches_self); - if references_arg && !arg.span.from_expansion() { - error.obligation.cause.map_code(|parent_code| { - ObligationCauseCode::FunctionArgumentObligation { - arg_hir_id: args[idx].hir_id, - call_hir_id: expr.hir_id, - parent_code, - } - }) + + if let Some(param_to_point_at) = param_to_point_at + && let Some(segment) = path.segments.last() + && self.point_at_generics_if_possible(error, def_id, param_to_point_at, segment) + { + return; } - continue 'outer; } } + hir::Node::Expr(hir::Expr { kind: hir::ExprKind::MethodCall(segment, args, ..), .. }) => { + if let Some(param_to_point_at) = param_to_point_at + && self.point_at_args_if_possible(error, def_id, param_to_point_at, hir_id, segment.ident.span, args) + { + return; + } - // Collect the argument position for all arguments that could have caused this - // `FulfillmentError`. - let mut referenced_in: Vec<_> = std::iter::zip(expected_tys, args) - .enumerate() - .flat_map(|(idx, (expected_ty, arg))| { - if let Some(arg_ty) = typeck_results.expr_ty_opt(arg) { - vec![(idx, arg_ty), (idx, *expected_ty)] - } else { - vec![] - } - }) - .filter_map(|(i, ty)| { - let ty = self.resolve_vars_if_possible(ty); - // We walk the argument type because the argument's type could have - // been `Option<T>`, but the `FulfillmentError` references `T`. - if ty_matches_self(ty) { Some(i) } else { None } - }) - .collect(); - - // Both checked and coerced types could have matched, thus we need to remove - // duplicates. - - // We sort primitive type usize here and can use unstable sort - referenced_in.sort_unstable(); - referenced_in.dedup(); - - if let &[idx] = &referenced_in[..] { - // Do not point at the inside of a macro. - // That would often result in poor error messages. - if args[idx].span.from_expansion() { - continue; + if let Some(fallback_param_to_point_at) = fallback_param_to_point_at + && self.point_at_args_if_possible(error, def_id, fallback_param_to_point_at, hir_id, segment.ident.span, args) + { + return; } - // We make sure that only *one* argument matches the obligation failure - // and we assign the obligation's span to its expression's. - error.obligation.cause.span = args[idx].span; - error.obligation.cause.map_code(|parent_code| { - ObligationCauseCode::FunctionArgumentObligation { - arg_hir_id: args[idx].hir_id, - call_hir_id: expr.hir_id, - parent_code, - } - }); - } else if error.obligation.cause.span == call_sp { - // Make function calls point at the callee, not the whole thing. - if let hir::ExprKind::Call(callee, _) = expr.kind { - error.obligation.cause.span = callee.span; + + if let Some(param_to_point_at) = param_to_point_at + && self.point_at_generics_if_possible(error, def_id, param_to_point_at, segment) + { + return; } } + hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Struct(..), .. }) => { + // fixme + } + _ => {} } } - /// Given a vec of evaluated `FulfillmentError`s and an `fn` call expression, we walk the - /// `PathSegment`s and resolve their type parameters to see if any of the `FulfillmentError`s - /// were caused by them. If they were, we point at the corresponding type argument's span - /// instead of the `fn` call path span. - fn point_at_type_arg_instead_of_call_if_possible( + fn point_at_args_if_possible( &self, - errors: &mut Vec<traits::FulfillmentError<'tcx>>, - call_expr: &'tcx hir::Expr<'tcx>, - ) { - if let hir::ExprKind::Call(path, _) = &call_expr.kind { - if let hir::ExprKind::Path(hir::QPath::Resolved(_, path)) = &path.kind { - for error in errors { - let self_ty = match error.obligation.predicate.kind().skip_binder() { - ty::PredicateKind::Trait(predicate) => predicate.self_ty(), - ty::PredicateKind::Projection(predicate) => { - predicate.projection_ty.self_ty() - } - _ => continue, - }; - // If any of the type arguments in this path segment caused the - // `FulfillmentError`, point at its span (#61860). - for arg in path - .segments - .iter() - .filter_map(|seg| seg.args.as_ref()) - .flat_map(|a| a.args.iter()) - { - if let hir::GenericArg::Type(hir_ty) = &arg - && let Some(ty) = - self.typeck_results.borrow().node_type_opt(hir_ty.hir_id) - && self.resolve_vars_if_possible(ty) == self_ty - { - error.obligation.cause.span = hir_ty.span; - break; - } - } + error: &mut traits::FulfillmentError<'tcx>, + def_id: DefId, + param_to_point_at: ty::GenericArg<'tcx>, + call_hir_id: hir::HirId, + callee_span: Span, + args: &[hir::Expr<'tcx>], + ) -> bool { + let sig = self.tcx.fn_sig(def_id).skip_binder(); + let args_referencing_param: Vec<_> = sig + .inputs() + .iter() + .enumerate() + .filter(|(_, ty)| ty.walk().any(|arg| arg == param_to_point_at)) + .collect(); + if let [(idx, _)] = args_referencing_param.as_slice() + && let Some(arg) = args.get(*idx) + { + error.obligation.cause.span = arg.span; + error.obligation.cause.map_code(|parent_code| { + ObligationCauseCode::FunctionArgumentObligation { + arg_hir_id: arg.hir_id, + call_hir_id, + parent_code, } - } + }); + true + } else if args_referencing_param.len() > 0 { + // If more than one argument applies, then point to the callee + // We have chance to fix this up further in `point_at_generics_if_possible` + error.obligation.cause.span = callee_span; + false + } else { + false } } + fn point_at_generics_if_possible( + &self, + error: &mut traits::FulfillmentError<'tcx>, + def_id: DefId, + param_to_point_at: ty::GenericArg<'tcx>, + segment: &hir::PathSegment<'tcx>, + ) -> bool { + let own_substs = self + .tcx + .generics_of(def_id) + .own_substs(ty::InternalSubsts::identity_for_item(self.tcx, def_id)); + let Some((index, _)) = own_substs + .iter() + .filter(|arg| matches!(arg.unpack(), ty::GenericArgKind::Type(_))) + .enumerate() + .find(|(_, arg)| **arg == param_to_point_at) else { return false }; + let Some(arg) = segment + .args() + .args + .iter() + .filter(|arg| matches!(arg, hir::GenericArg::Type(_))) + .nth(index) else { return false; }; + error.obligation.cause.span = arg.span(); + true + } + fn label_fn_like( &self, err: &mut Diagnostic, diff --git a/compiler/rustc_typeck/src/check/method/confirm.rs b/compiler/rustc_typeck/src/check/method/confirm.rs index 2c89b63ae84..59fd5c315ae 100644 --- a/compiler/rustc_typeck/src/check/method/confirm.rs +++ b/compiler/rustc_typeck/src/check/method/confirm.rs @@ -491,7 +491,19 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { // so we just call `predicates_for_generics` directly to avoid redoing work. // `self.add_required_obligations(self.span, def_id, &all_substs);` for obligation in traits::predicates_for_generics( - traits::ObligationCause::new(self.span, self.body_id, traits::ItemObligation(def_id)), + |idx, span| { + let code = if span.is_dummy() { + ObligationCauseCode::ExprItemObligation(def_id, self.call_expr.hir_id, idx) + } else { + ObligationCauseCode::ExprBindingObligation( + def_id, + span, + self.call_expr.hir_id, + idx, + ) + }; + traits::ObligationCause::new(self.span, self.body_id, code) + }, self.param_env, method_predicates, ) { diff --git a/compiler/rustc_typeck/src/check/method/mod.rs b/compiler/rustc_typeck/src/check/method/mod.rs index 0e678c41f8b..de26a9e56e2 100644 --- a/compiler/rustc_typeck/src/check/method/mod.rs +++ b/compiler/rustc_typeck/src/check/method/mod.rs @@ -534,7 +534,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { traits::ObligationCause::misc(span, self.body_id) }; - obligations.extend(traits::predicates_for_generics(cause.clone(), self.param_env, bounds)); + let predicates_cause = cause.clone(); + obligations.extend(traits::predicates_for_generics( + move |_, _| predicates_cause.clone(), + self.param_env, + bounds, + )); // Also add an obligation for the method type being well-formed. let method_ty = tcx.mk_fn_ptr(ty::Binder::dummy(fn_sig)); diff --git a/compiler/rustc_typeck/src/check/method/probe.rs b/compiler/rustc_typeck/src/check/method/probe.rs index efe15fec7cb..d9870060a40 100644 --- a/compiler/rustc_typeck/src/check/method/probe.rs +++ b/compiler/rustc_typeck/src/check/method/probe.rs @@ -1514,8 +1514,11 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { traits::normalize(selcx, self.param_env, cause.clone(), impl_bounds); // Convert the bounds into obligations. - let impl_obligations = - traits::predicates_for_generics(cause, self.param_env, impl_bounds); + let impl_obligations = traits::predicates_for_generics( + move |_, _| cause.clone(), + self.param_env, + impl_bounds, + ); let candidate_obligations = impl_obligations .chain(norm_obligations.into_iter()) diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.stderr b/src/test/ui/anonymous-higher-ranked-lifetime.stderr index 1a0a5fdf4eb..d6deefe693f 100644 --- a/src/test/ui/anonymous-higher-ranked-lifetime.stderr +++ b/src/test/ui/anonymous-higher-ranked-lifetime.stderr @@ -1,10 +1,12 @@ error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:2:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:2:8 | LL | f1(|_: (), _: ()| {}); - | ^^ -------------- found signature defined here - | | - | expected due to this + | -- --------------^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `for<'r, 's> fn(&'r (), &'s ()) -> _` found closure signature `fn((), ()) -> _` @@ -15,12 +17,14 @@ LL | fn f1<F>(_: F) where F: Fn(&(), &()) {} | ^^^^^^^^^^^^ required by this bound in `f1` error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:3:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:3:8 | LL | f2(|_: (), _: ()| {}); - | ^^ -------------- found signature defined here - | | - | expected due to this + | -- --------------^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `for<'a, 'r> fn(&'a (), &'r ()) -> _` found closure signature `fn((), ()) -> _` @@ -31,12 +35,14 @@ LL | fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {} | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f2` error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:4:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:4:8 | LL | f3(|_: (), _: ()| {}); - | ^^ -------------- found signature defined here - | | - | expected due to this + | -- --------------^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `for<'r> fn(&(), &'r ()) -> _` found closure signature `fn((), ()) -> _` @@ -47,12 +53,14 @@ LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {} | ^^^^^^^^^^^^^^^ required by this bound in `f3` error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:5:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:5:8 | LL | f4(|_: (), _: ()| {}); - | ^^ -------------- found signature defined here - | | - | expected due to this + | -- --------------^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `for<'r, 's> fn(&'s (), &'r ()) -> _` found closure signature `fn((), ()) -> _` @@ -63,12 +71,14 @@ LL | fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f4` error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:6:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:6:8 | LL | f5(|_: (), _: ()| {}); - | ^^ -------------- found signature defined here - | | - | expected due to this + | -- --------------^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `for<'r> fn(&'r (), &'r ()) -> _` found closure signature `fn((), ()) -> _` @@ -79,12 +89,14 @@ LL | fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f5` error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:7:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:7:8 | LL | g1(|_: (), _: ()| {}); - | ^^ -------------- found signature defined here - | | - | expected due to this + | -- --------------^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `for<'r> fn(&'r (), Box<(dyn for<'r> Fn(&'r ()) + 'static)>) -> _` found closure signature `fn((), ()) -> _` @@ -95,12 +107,14 @@ LL | fn g1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g1` error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:8:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:8:8 | LL | g2(|_: (), _: ()| {}); - | ^^ -------------- found signature defined here - | | - | expected due to this + | -- --------------^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `for<'r> fn(&'r (), for<'r> fn(&'r ())) -> _` found closure signature `fn((), ()) -> _` @@ -111,12 +125,14 @@ LL | fn g2<F>(_: F) where F: Fn(&(), fn(&())) {} | ^^^^^^^^^^^^^^^^ required by this bound in `g2` error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:9:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:9:8 | LL | g3(|_: (), _: ()| {}); - | ^^ -------------- found signature defined here - | | - | expected due to this + | -- --------------^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `for<'s> fn(&'s (), Box<(dyn for<'r> Fn(&'r ()) + 'static)>) -> _` found closure signature `fn((), ()) -> _` @@ -127,12 +143,14 @@ LL | fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<dyn Fn(&())>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g3` error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:10:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:10:8 | LL | g4(|_: (), _: ()| {}); - | ^^ -------------- found signature defined here - | | - | expected due to this + | -- --------------^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `for<'s> fn(&'s (), for<'r> fn(&'r ())) -> _` found closure signature `fn((), ()) -> _` @@ -143,12 +161,14 @@ LL | fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g4` error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:11:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:11:8 | LL | h1(|_: (), _: (), _: (), _: ()| {}); - | ^^ ---------------------------- found signature defined here - | | - | expected due to this + | -- ----------------------------^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `for<'r, 's> fn(&'r (), Box<(dyn for<'r> Fn(&'r ()) + 'static)>, &'s (), for<'r, 's> fn(&'r (), &'s ())) -> _` found closure signature `fn((), (), (), ()) -> _` @@ -159,12 +179,14 @@ LL | fn h1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>, &(), fn(&(), &())) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h1` error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:12:8 | LL | h2(|_: (), _: (), _: (), _: ()| {}); - | ^^ ---------------------------- found signature defined here - | | - | expected due to this + | -- ----------------------------^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `for<'t0, 'r> fn(&'r (), Box<(dyn for<'r> Fn(&'r ()) + 'static)>, &'t0 (), for<'r, 's> fn(&'r (), &'s ())) -> _` found closure signature `fn((), (), (), ()) -> _` diff --git a/src/test/ui/associated-types/associated-types-eq-3.stderr b/src/test/ui/associated-types/associated-types-eq-3.stderr index 19750fe1f33..fbe1a1ee8bc 100644 --- a/src/test/ui/associated-types/associated-types-eq-3.stderr +++ b/src/test/ui/associated-types/associated-types-eq-3.stderr @@ -36,9 +36,7 @@ error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar` --> $DIR/associated-types-eq-3.rs:40:9 | LL | baz(&a); - | --- ^^ type mismatch resolving `<isize as Foo>::A == Bar` - | | - | required by a bound introduced by this call + | ^^ type mismatch resolving `<isize as Foo>::A == Bar` | note: expected this to be `Bar` --> $DIR/associated-types-eq-3.rs:12:14 diff --git a/src/test/ui/associated-types/associated-types-path-2.stderr b/src/test/ui/associated-types/associated-types-path-2.stderr index 66f1ab72692..7e3cccae3ea 100644 --- a/src/test/ui/associated-types/associated-types-path-2.stderr +++ b/src/test/ui/associated-types/associated-types-path-2.stderr @@ -33,19 +33,15 @@ error[E0277]: the trait bound `u32: Foo` is not satisfied --> $DIR/associated-types-path-2.rs:29:14 | LL | f1(2u32, 4u32); - | -- ^^^^ the trait `Foo` is not implemented for `u32` - | | - | required by a bound introduced by this call + | ^^^^ the trait `Foo` is not implemented for `u32` | = help: the trait `Foo` is implemented for `i32` error[E0277]: the trait bound `u32: Foo` is not satisfied - --> $DIR/associated-types-path-2.rs:35:8 + --> $DIR/associated-types-path-2.rs:35:5 | LL | f1(2u32, 4i32); - | -- ^^^^ the trait `Foo` is not implemented for `u32` - | | - | required by a bound introduced by this call + | ^^ the trait `Foo` is not implemented for `u32` | = help: the trait `Foo` is implemented for `i32` note: required by a bound in `f1` diff --git a/src/test/ui/async-await/issue-67252-unnamed-future.stderr b/src/test/ui/async-await/issue-67252-unnamed-future.stderr index 01c0d3225ba..af99b608ca1 100644 --- a/src/test/ui/async-await/issue-67252-unnamed-future.stderr +++ b/src/test/ui/async-await/issue-67252-unnamed-future.stderr @@ -1,8 +1,12 @@ error: future cannot be sent between threads safely - --> $DIR/issue-67252-unnamed-future.rs:18:5 + --> $DIR/issue-67252-unnamed-future.rs:18:11 | -LL | spawn(async { - | ^^^^^ future created by async block is not `Send` +LL | spawn(async { + | ___________^ +LL | | let _a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send` +LL | | AFuture.await; +LL | | }); + | |_____^ future created by async block is not `Send` | = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*mut ()` note: future is not `Send` as this value is used across an await diff --git a/src/test/ui/async-await/issue-68112.stderr b/src/test/ui/async-await/issue-68112.stderr index 9c85eb87684..c3553e3e0c1 100644 --- a/src/test/ui/async-await/issue-68112.stderr +++ b/src/test/ui/async-await/issue-68112.stderr @@ -1,8 +1,8 @@ error: future cannot be sent between threads safely - --> $DIR/issue-68112.rs:34:5 + --> $DIR/issue-68112.rs:34:18 | LL | require_send(send_fut); - | ^^^^^^^^^^^^ future created by async block is not `Send` + | ^^^^^^^^ future created by async block is not `Send` | = help: the trait `Sync` is not implemented for `RefCell<i32>` note: future is not `Send` as it awaits another future which is not `Send` @@ -17,10 +17,10 @@ LL | fn require_send(_: impl Send) {} | ^^^^ required by this bound in `require_send` error: future cannot be sent between threads safely - --> $DIR/issue-68112.rs:43:5 + --> $DIR/issue-68112.rs:43:18 | LL | require_send(send_fut); - | ^^^^^^^^^^^^ future created by async block is not `Send` + | ^^^^^^^^ future created by async block is not `Send` | = help: the trait `Sync` is not implemented for `RefCell<i32>` note: future is not `Send` as it awaits another future which is not `Send` @@ -35,10 +35,12 @@ LL | fn require_send(_: impl Send) {} | ^^^^ required by this bound in `require_send` error[E0277]: `RefCell<i32>` cannot be shared between threads safely - --> $DIR/issue-68112.rs:60:5 + --> $DIR/issue-68112.rs:60:18 | LL | require_send(send_fut); - | ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely + | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely + | | + | required by a bound introduced by this call | = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: required for `Arc<RefCell<i32>>` to implement `Send` diff --git a/src/test/ui/async-await/issue-72442.stderr b/src/test/ui/async-await/issue-72442.stderr index 919abf64603..49fc81d3bab 100644 --- a/src/test/ui/async-await/issue-72442.stderr +++ b/src/test/ui/async-await/issue-72442.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `Option<&str>: AsRef<Path>` is not satisfied - --> $DIR/issue-72442.rs:12:36 + --> $DIR/issue-72442.rs:12:25 | LL | let mut f = File::open(path.to_str())?; - | ---------- ^^^^^^^^^^^^^ the trait `AsRef<Path>` is not implemented for `Option<&str>` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^ the trait `AsRef<Path>` is not implemented for `Option<&str>` | note: required by a bound in `File::open` --> $SRC_DIR/std/src/fs.rs:LL:COL diff --git a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr index b2309300129..99e960f5d0f 100644 --- a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr +++ b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.stderr @@ -1,8 +1,12 @@ error: future cannot be sent between threads safely - --> $DIR/issue-65436-raw-ptr-not-send.rs:12:5 + --> $DIR/issue-65436-raw-ptr-not-send.rs:12:17 | -LL | assert_send(async { - | ^^^^^^^^^^^ future created by async block is not `Send` +LL | assert_send(async { + | _________________^ +LL | | +LL | | bar(Foo(std::ptr::null())).await; +LL | | }) + | |_____^ future created by async block is not `Send` | = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*const u8` note: future is not `Send` as this value is used across an await diff --git a/src/test/ui/async-await/pin-needed-to-poll-2.stderr b/src/test/ui/async-await/pin-needed-to-poll-2.stderr index 83d1a02c876..3aea93a60ff 100644 --- a/src/test/ui/async-await/pin-needed-to-poll-2.stderr +++ b/src/test/ui/async-await/pin-needed-to-poll-2.stderr @@ -1,10 +1,8 @@ error[E0277]: `PhantomPinned` cannot be unpinned - --> $DIR/pin-needed-to-poll-2.rs:43:18 + --> $DIR/pin-needed-to-poll-2.rs:43:9 | LL | Pin::new(&mut self.sleep).poll(cx) - | -------- ^^^^^^^^^^^^^^^ within `Sleep`, the trait `Unpin` is not implemented for `PhantomPinned` - | | - | required by a bound introduced by this call + | ^^^^^^^^ within `Sleep`, the trait `Unpin` is not implemented for `PhantomPinned` | = note: consider using `Box::pin` note: required because it appears within the type `Sleep` diff --git a/src/test/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr b/src/test/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr index 7d6bf58f516..0c4970a7259 100644 --- a/src/test/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr +++ b/src/test/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `MyS2: MyTrait` is not satisfied in `(MyS2, MyS)` - --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:17:5 + --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:17:18 | LL | is_mytrait::<(MyS2, MyS)>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ within `(MyS2, MyS)`, the trait `MyTrait` is not implemented for `MyS2` + | ^^^^^^^^^^^ within `(MyS2, MyS)`, the trait `MyTrait` is not implemented for `MyS2` | = note: required because it appears within the type `(MyS2, MyS)` note: required by a bound in `is_mytrait` diff --git a/src/test/ui/auto-traits/typeck-default-trait-impl-precedence.stderr b/src/test/ui/auto-traits/typeck-default-trait-impl-precedence.stderr index 5645e158502..ce7095664c1 100644 --- a/src/test/ui/auto-traits/typeck-default-trait-impl-precedence.stderr +++ b/src/test/ui/auto-traits/typeck-default-trait-impl-precedence.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `u32: Signed` is not satisfied - --> $DIR/typeck-default-trait-impl-precedence.rs:19:5 + --> $DIR/typeck-default-trait-impl-precedence.rs:19:20 | LL | is_defaulted::<&'static u32>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Signed` is not implemented for `u32` + | ^^^^^^^^^^^^ the trait `Signed` is not implemented for `u32` | = help: the trait `Signed` is implemented for `i32` note: required for `&'static u32` to implement `Defaulted` diff --git a/src/test/ui/binop/issue-77910-1.stderr b/src/test/ui/binop/issue-77910-1.stderr index 68303b84208..7ff5752fc35 100644 --- a/src/test/ui/binop/issue-77910-1.stderr +++ b/src/test/ui/binop/issue-77910-1.stderr @@ -19,8 +19,12 @@ LL | assert_eq!(foo, y); | ^^^^^^^^^^^^^^^^^^ `for<'r> fn(&'r i32) -> &'r i32 {foo}` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = help: the trait `Debug` is not implemented for `for<'r> fn(&'r i32) -> &'r i32 {foo}` - = help: use parentheses to call the function: `foo(s)` = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use parentheses to call the function + --> $SRC_DIR/core/src/macros/mod.rs:LL:COL + | +LL | $crate::panicking::assert_failed(kind, &*left_val(s), &*right_val, $crate::option::Option::None); + | +++ error: aborting due to 2 previous errors diff --git a/src/test/ui/box/into-boxed-slice-fail.stderr b/src/test/ui/box/into-boxed-slice-fail.stderr index de654fdc1a4..5e73d8737ea 100644 --- a/src/test/ui/box/into-boxed-slice-fail.stderr +++ b/src/test/ui/box/into-boxed-slice-fail.stderr @@ -1,10 +1,8 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/into-boxed-slice-fail.rs:7:35 + --> $DIR/into-boxed-slice-fail.rs:7:13 | LL | let _ = Box::into_boxed_slice(boxed_slice); - | --------------------- ^^^^^^^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` note: required by a bound in `Box::<T, A>::into_boxed_slice` @@ -23,12 +21,10 @@ LL | let _ = Box::into_boxed_slice(boxed_slice); = note: slice and array elements must have `Sized` type error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time - --> $DIR/into-boxed-slice-fail.rs:11:35 + --> $DIR/into-boxed-slice-fail.rs:11:13 | LL | let _ = Box::into_boxed_slice(boxed_trait); - | --------------------- ^^^^^^^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `dyn Debug` note: required by a bound in `Box::<T, A>::into_boxed_slice` diff --git a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr index 8dccf929b2b..b013798c824 100644 --- a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr +++ b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr @@ -1,10 +1,15 @@ error[E0631]: type mismatch in closure arguments - --> $DIR/expect-infer-var-appearing-twice.rs:14:5 + --> $DIR/expect-infer-var-appearing-twice.rs:14:18 | -LL | with_closure(|x: u32, y: i32| { - | ^^^^^^^^^^^^ ---------------- found signature defined here - | | - | expected due to this +LL | with_closure(|x: u32, y: i32| { + | ------------ ^--------------- + | | | + | _____|____________found signature defined here + | | | + | | required by a bound introduced by this call +LL | | +LL | | }); + | |_____^ expected due to this | = note: expected closure signature `fn(_, _) -> _` found closure signature `fn(u32, i32) -> _` diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr index bcde35983fc..b5f06e38f6d 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr @@ -7,7 +7,7 @@ LL | let [_, _s] = s; | - closure is `FnOnce` because it moves the variable `s` out of its environment LL | }; LL | expect_fn(c); - | --------- the requirement to implement `Fn` derives from here + | - the requirement to implement `Fn` derives from here error: aborting due to previous error diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr index df33c4f1fd6..66cd847db50 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr @@ -7,7 +7,7 @@ LL | let s = s.1; | --- closure is `FnOnce` because it moves the variable `s.1` out of its environment LL | }; LL | expect_fn(c); - | --------- the requirement to implement `Fn` derives from here + | - the requirement to implement `Fn` derives from here error: aborting due to previous error diff --git a/src/test/ui/closures/closure-move-sync.stderr b/src/test/ui/closures/closure-move-sync.stderr index 3e9b1c292dc..7b9f59fcc67 100644 --- a/src/test/ui/closures/closure-move-sync.stderr +++ b/src/test/ui/closures/closure-move-sync.stderr @@ -1,8 +1,14 @@ error[E0277]: `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely - --> $DIR/closure-move-sync.rs:6:13 + --> $DIR/closure-move-sync.rs:6:27 | -LL | let t = thread::spawn(|| { - | ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely +LL | let t = thread::spawn(|| { + | _____________-------------_^ + | | | + | | required by a bound introduced by this call +LL | | recv.recv().unwrap(); +LL | | +LL | | }); + | |_____^ `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `std::sync::mpsc::Receiver<()>` = note: required for `&std::sync::mpsc::Receiver<()>` to implement `Send` @@ -16,12 +22,18 @@ note: required by a bound in `spawn` | LL | F: Send + 'static, | ^^^^ required by this bound in `spawn` +help: consider dereferencing here + | +LL | let t = thread::spawn(*|| { + | + error[E0277]: `Sender<()>` cannot be shared between threads safely - --> $DIR/closure-move-sync.rs:18:5 + --> $DIR/closure-move-sync.rs:18:19 | LL | thread::spawn(|| tx.send(()).unwrap()); - | ^^^^^^^^^^^^^ `Sender<()>` cannot be shared between threads safely + | ------------- ^^^^^^^^^^^^^^^^^^^^^^^ `Sender<()>` cannot be shared between threads safely + | | + | required by a bound introduced by this call | = help: the trait `Sync` is not implemented for `Sender<()>` = note: required for `&Sender<()>` to implement `Send` @@ -35,6 +47,10 @@ note: required by a bound in `spawn` | LL | F: Send + 'static, | ^^^^ required by this bound in `spawn` +help: consider dereferencing here + | +LL | thread::spawn(*|| tx.send(()).unwrap()); + | + error: aborting due to 2 previous errors diff --git a/src/test/ui/closures/closure-wrong-kind.stderr b/src/test/ui/closures/closure-wrong-kind.stderr index 35caf71a5e8..421be56d917 100644 --- a/src/test/ui/closures/closure-wrong-kind.stderr +++ b/src/test/ui/closures/closure-wrong-kind.stderr @@ -6,7 +6,7 @@ LL | let closure = |_| foo(x); | | | this closure implements `FnOnce`, not `Fn` LL | bar(closure); - | --- the requirement to implement `Fn` derives from here + | ------- the requirement to implement `Fn` derives from here error: aborting due to previous error diff --git a/src/test/ui/const-generics/defaults/trait_objects_fail.stderr b/src/test/ui/const-generics/defaults/trait_objects_fail.stderr index a9c185e5fcb..0e8334d0338 100644 --- a/src/test/ui/const-generics/defaults/trait_objects_fail.stderr +++ b/src/test/ui/const-generics/defaults/trait_objects_fail.stderr @@ -2,9 +2,7 @@ error[E0277]: the trait bound `u32: Trait` is not satisfied --> $DIR/trait_objects_fail.rs:26:9 | LL | foo(&10_u32); - | --- ^^^^^^^ the trait `Trait` is not implemented for `u32` - | | - | required by a bound introduced by this call + | ^^^^^^^ the trait `Trait` is not implemented for `u32` | = help: the trait `Trait<2>` is implemented for `u32` = note: required for the cast from `u32` to the object type `dyn Trait` @@ -13,9 +11,7 @@ error[E0277]: the trait bound `bool: Traitor<_>` is not satisfied --> $DIR/trait_objects_fail.rs:28:9 | LL | bar(&true); - | --- ^^^^^ the trait `Traitor<_>` is not implemented for `bool` - | | - | required by a bound introduced by this call + | ^^^^^ the trait `Traitor<_>` is not implemented for `bool` | = help: the trait `Traitor<2, 3>` is implemented for `bool` = note: required for the cast from `bool` to the object type `dyn Traitor<_>` diff --git a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr b/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr index a5f7bc0b26c..615dc875f67 100644 --- a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr @@ -1,8 +1,8 @@ error: unconstrained generic constant - --> $DIR/abstract-const-as-cast-3.rs:17:5 + --> $DIR/abstract-const-as-cast-3.rs:17:19 | LL | assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as u128 }>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: try adding a `where` bound using this expression: `where [(); { O as u128 }]:` note: required for `HasCastInTraitImpl<{ N + 1 }, { N as u128 }>` to implement `Trait` @@ -26,10 +26,10 @@ LL | assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as u128 }>>(); found type `{ O as u128 }` error: unconstrained generic constant - --> $DIR/abstract-const-as-cast-3.rs:20:5 + --> $DIR/abstract-const-as-cast-3.rs:20:19 | LL | assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as _ }>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: try adding a `where` bound using this expression: `where [(); { O as u128 }]:` note: required for `HasCastInTraitImpl<{ N + 1 }, { N as _ }>` to implement `Trait` @@ -71,10 +71,10 @@ LL | assert_impl::<HasCastInTraitImpl<14, 13>>(); found type `14` error: unconstrained generic constant - --> $DIR/abstract-const-as-cast-3.rs:35:5 + --> $DIR/abstract-const-as-cast-3.rs:35:19 | LL | assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as u128 }>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: try adding a `where` bound using this expression: `where [(); { O as u128 }]:` note: required for `HasCastInTraitImpl<{ N + 1 }, { N as u128 }>` to implement `Trait` @@ -98,10 +98,10 @@ LL | assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as u128 }>>(); found type `{ O as u128 }` error: unconstrained generic constant - --> $DIR/abstract-const-as-cast-3.rs:38:5 + --> $DIR/abstract-const-as-cast-3.rs:38:19 | LL | assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as _ }>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: try adding a `where` bound using this expression: `where [(); { O as u128 }]:` note: required for `HasCastInTraitImpl<{ N + 1 }, { N as _ }>` to implement `Trait` diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr index 26764bc0ee5..f2f8d84ad3b 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `Bar: Foo<usize>` is not satisfied - --> $DIR/issue-21659-show-relevant-trait-impls-1.rs:24:8 + --> $DIR/issue-21659-show-relevant-trait-impls-1.rs:24:5 | LL | f1.foo(1usize); - | ^^^ the trait `Foo<usize>` is not implemented for `Bar` + | ^^ --- required by a bound introduced by this call + | | + | the trait `Foo<usize>` is not implemented for `Bar` | = help: the following other types implement trait `Foo<A>`: <Bar as Foo<i32>> diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr index bb175367e1f..b0c41e2fae1 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `Bar: Foo<usize>` is not satisfied - --> $DIR/issue-21659-show-relevant-trait-impls-2.rs:28:8 + --> $DIR/issue-21659-show-relevant-trait-impls-2.rs:28:5 | LL | f1.foo(1usize); - | ^^^ the trait `Foo<usize>` is not implemented for `Bar` + | ^^ --- required by a bound introduced by this call + | | + | the trait `Foo<usize>` is not implemented for `Bar` | = help: the following other types implement trait `Foo<A>`: <Bar as Foo<i16>> diff --git a/src/test/ui/dst/dst-rvalue.stderr b/src/test/ui/dst/dst-rvalue.stderr index 727f4d84303..5fafdb06203 100644 --- a/src/test/ui/dst/dst-rvalue.stderr +++ b/src/test/ui/dst/dst-rvalue.stderr @@ -1,10 +1,8 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/dst-rvalue.rs:4:33 + --> $DIR/dst-rvalue.rs:4:24 | LL | let _x: Box<str> = Box::new(*"hello world"); - | -------- ^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` note: required by a bound in `Box::<T>::new` @@ -14,12 +12,10 @@ LL | impl<T> Box<T> { | ^ required by this bound in `Box::<T>::new` error[E0277]: the size for values of type `[isize]` cannot be known at compilation time - --> $DIR/dst-rvalue.rs:8:37 + --> $DIR/dst-rvalue.rs:8:28 | LL | let _x: Box<[isize]> = Box::new(*array); - | -------- ^^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[isize]` note: required by a bound in `Box::<T>::new` diff --git a/src/test/ui/error-codes/E0277-2.stderr b/src/test/ui/error-codes/E0277-2.stderr index ca2cb884240..a2abf37931a 100644 --- a/src/test/ui/error-codes/E0277-2.stderr +++ b/src/test/ui/error-codes/E0277-2.stderr @@ -1,8 +1,8 @@ error[E0277]: `*const u8` cannot be sent between threads safely - --> $DIR/E0277-2.rs:16:5 + --> $DIR/E0277-2.rs:16:15 | LL | is_send::<Foo>(); - | ^^^^^^^^^^^^^^ `*const u8` cannot be sent between threads safely + | ^^^ `*const u8` cannot be sent between threads safely | = help: within `Foo`, the trait `Send` is not implemented for `*const u8` note: required because it appears within the type `Baz` diff --git a/src/test/ui/error-codes/E0283.stderr b/src/test/ui/error-codes/E0283.stderr index 90a28874ead..162d4922d00 100644 --- a/src/test/ui/error-codes/E0283.stderr +++ b/src/test/ui/error-codes/E0283.stderr @@ -12,12 +12,25 @@ help: use a fully-qualified path to a specific available implementation (2 found LL | let cont: u32 = <::Impl as Generator>::create(); | ++++++++++ + -error[E0283]: type annotations needed +error[E0282]: type annotations needed --> $DIR/E0283.rs:35:24 | LL | let bar = foo_impl.into() * 1u32; | ^^^^ | +help: try using a fully qualified path to specify the expected types + | +LL | let bar = <Impl as Into<T>>::into(foo_impl) * 1u32; + | ++++++++++++++++++++++++ ~ + +error[E0283]: type annotations needed + --> $DIR/E0283.rs:35:24 + | +LL | let bar = foo_impl.into() * 1u32; + | -------- ^^^^ + | | + | type must be known at this point + | note: multiple `impl`s satisfying `Impl: Into<_>` found --> $DIR/E0283.rs:17:1 | @@ -31,7 +44,7 @@ help: try using a fully qualified path to specify the expected types LL | let bar = <Impl as Into<T>>::into(foo_impl) * 1u32; | ++++++++++++++++++++++++ ~ -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0283, E0790. -For more information about an error, try `rustc --explain E0283`. +Some errors have detailed explanations: E0282, E0283, E0790. +For more information about an error, try `rustc --explain E0282`. diff --git a/src/test/ui/extern/extern-types-unsized.stderr b/src/test/ui/extern/extern-types-unsized.stderr index 8d6713261d5..a79caced111 100644 --- a/src/test/ui/extern/extern-types-unsized.stderr +++ b/src/test/ui/extern/extern-types-unsized.stderr @@ -16,10 +16,10 @@ LL | fn assert_sized<T: ?Sized>() {} | ++++++++ error[E0277]: the size for values of type `A` cannot be known at compilation time - --> $DIR/extern-types-unsized.rs:25:5 + --> $DIR/extern-types-unsized.rs:25:20 | LL | assert_sized::<Foo>(); - | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^ doesn't have a size known at compile-time | = help: within `Foo`, the trait `Sized` is not implemented for `A` note: required because it appears within the type `Foo` @@ -38,10 +38,10 @@ LL | fn assert_sized<T: ?Sized>() {} | ++++++++ error[E0277]: the size for values of type `A` cannot be known at compilation time - --> $DIR/extern-types-unsized.rs:28:5 + --> $DIR/extern-types-unsized.rs:28:20 | LL | assert_sized::<Bar<A>>(); - | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^^^^ doesn't have a size known at compile-time | = help: within `Bar<A>`, the trait `Sized` is not implemented for `A` note: required because it appears within the type `Bar<A>` @@ -60,10 +60,10 @@ LL | fn assert_sized<T: ?Sized>() {} | ++++++++ error[E0277]: the size for values of type `A` cannot be known at compilation time - --> $DIR/extern-types-unsized.rs:31:5 + --> $DIR/extern-types-unsized.rs:31:20 | LL | assert_sized::<Bar<Bar<A>>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `Bar<Bar<A>>`, the trait `Sized` is not implemented for `A` note: required because it appears within the type `Bar<A>` diff --git a/src/test/ui/feature-gates/feature-gate-unsized_fn_params.stderr b/src/test/ui/feature-gates/feature-gate-unsized_fn_params.stderr index 0557340f792..b7757740d9e 100644 --- a/src/test/ui/feature-gates/feature-gate-unsized_fn_params.stderr +++ b/src/test/ui/feature-gates/feature-gate-unsized_fn_params.stderr @@ -15,9 +15,7 @@ error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known --> $DIR/feature-gate-unsized_fn_params.rs:24:9 | LL | foo(*x); - | --- ^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `(dyn Foo + 'static)` = help: unsized fn params are gated as an unstable feature diff --git a/src/test/ui/fmt/send-sync.stderr b/src/test/ui/fmt/send-sync.stderr index 726d3e35b10..62bcf3175e2 100644 --- a/src/test/ui/fmt/send-sync.stderr +++ b/src/test/ui/fmt/send-sync.stderr @@ -1,8 +1,10 @@ error[E0277]: `core::fmt::Opaque` cannot be shared between threads safely - --> $DIR/send-sync.rs:8:5 + --> $DIR/send-sync.rs:8:10 | LL | send(format_args!("{:?}", c)); - | ^^^^ `core::fmt::Opaque` cannot be shared between threads safely + | ---- ^^^^^^^^^^^^^^^^^^^^^^^ `core::fmt::Opaque` cannot be shared between threads safely + | | + | required by a bound introduced by this call | = help: within `[ArgumentV1<'_>]`, the trait `Sync` is not implemented for `core::fmt::Opaque` = note: required because it appears within the type `&core::fmt::Opaque` @@ -15,12 +17,15 @@ note: required by a bound in `send` | LL | fn send<T: Send>(_: T) {} | ^^^^ required by this bound in `send` + = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: `core::fmt::Opaque` cannot be shared between threads safely - --> $DIR/send-sync.rs:9:5 + --> $DIR/send-sync.rs:9:10 | LL | sync(format_args!("{:?}", c)); - | ^^^^ `core::fmt::Opaque` cannot be shared between threads safely + | ---- ^^^^^^^^^^^^^^^^^^^^^^^ `core::fmt::Opaque` cannot be shared between threads safely + | | + | required by a bound introduced by this call | = help: within `Arguments<'_>`, the trait `Sync` is not implemented for `core::fmt::Opaque` = note: required because it appears within the type `&core::fmt::Opaque` @@ -33,6 +38,7 @@ note: required by a bound in `sync` | LL | fn sync<T: Sync>(_: T) {} | ^^^^ required by this bound in `sync` + = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/src/test/ui/generator/drop-tracking-parent-expression.stderr b/src/test/ui/generator/drop-tracking-parent-expression.stderr index 522a300b3ed..fbf5d6e0725 100644 --- a/src/test/ui/generator/drop-tracking-parent-expression.stderr +++ b/src/test/ui/generator/drop-tracking-parent-expression.stderr @@ -1,8 +1,8 @@ error: generator cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:24:13 + --> $DIR/drop-tracking-parent-expression.rs:24:25 | LL | assert_send(g); - | ^^^^^^^^^^^ generator is not `Send` + | ^ generator is not `Send` ... LL | / type_combinations!( LL | | // OK @@ -41,10 +41,10 @@ LL | fn assert_send<T: Send>(_thing: T) {} = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) error: generator cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:24:13 + --> $DIR/drop-tracking-parent-expression.rs:24:25 | LL | assert_send(g); - | ^^^^^^^^^^^ generator is not `Send` + | ^ generator is not `Send` ... LL | / type_combinations!( LL | | // OK @@ -83,10 +83,10 @@ LL | fn assert_send<T: Send>(_thing: T) {} = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) error: generator cannot be sent between threads safely - --> $DIR/drop-tracking-parent-expression.rs:24:13 + --> $DIR/drop-tracking-parent-expression.rs:24:25 | LL | assert_send(g); - | ^^^^^^^^^^^ generator is not `Send` + | ^ generator is not `Send` ... LL | / type_combinations!( LL | | // OK diff --git a/src/test/ui/generator/drop-yield-twice.stderr b/src/test/ui/generator/drop-yield-twice.stderr index 5bc6ea5600f..0808a2c85ee 100644 --- a/src/test/ui/generator/drop-yield-twice.stderr +++ b/src/test/ui/generator/drop-yield-twice.stderr @@ -1,8 +1,14 @@ error: generator cannot be sent between threads safely - --> $DIR/drop-yield-twice.rs:7:5 + --> $DIR/drop-yield-twice.rs:7:17 | -LL | assert_send(|| { - | ^^^^^^^^^^^ generator is not `Send` +LL | assert_send(|| { + | _________________^ +LL | | let guard = Foo(42); +LL | | yield; +LL | | drop(guard); +LL | | yield; +LL | | }) + | |_____^ generator is not `Send` | = help: within `[generator@$DIR/drop-yield-twice.rs:7:17: 7:19]`, the trait `Send` is not implemented for `Foo` note: generator is not `Send` as this value is used across a yield diff --git a/src/test/ui/generator/generator-yielding-or-returning-itself.stderr b/src/test/ui/generator/generator-yielding-or-returning-itself.stderr index 2a39a08ee39..8f5d2429a28 100644 --- a/src/test/ui/generator/generator-yielding-or-returning-itself.stderr +++ b/src/test/ui/generator/generator-yielding-or-returning-itself.stderr @@ -1,8 +1,15 @@ error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36] as Generator>::Return == [generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36]` - --> $DIR/generator-yielding-or-returning-itself.rs:15:5 + --> $DIR/generator-yielding-or-returning-itself.rs:15:34 | -LL | want_cyclic_generator_return(|| { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size +LL | want_cyclic_generator_return(|| { + | _____----------------------------_^ + | | | + | | required by a bound introduced by this call +LL | | +LL | | if false { yield None.unwrap(); } +LL | | None.unwrap() +LL | | }) + | |_____^ cyclic type of infinite size | = note: closures cannot capture themselves or take themselves as argument; this error may be the result of a recent compiler bug-fix, @@ -17,10 +24,17 @@ LL | where T: Generator<Yield = (), Return = T> | ^^^^^^^^^^ required by this bound in `want_cyclic_generator_return` error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35] as Generator>::Yield == [generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35]` - --> $DIR/generator-yielding-or-returning-itself.rs:28:5 + --> $DIR/generator-yielding-or-returning-itself.rs:28:33 | -LL | want_cyclic_generator_yield(|| { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size +LL | want_cyclic_generator_yield(|| { + | _____---------------------------_^ + | | | + | | required by a bound introduced by this call +LL | | +LL | | if false { yield None.unwrap(); } +LL | | None.unwrap() +LL | | }) + | |_____^ cyclic type of infinite size | = note: closures cannot capture themselves or take themselves as argument; this error may be the result of a recent compiler bug-fix, diff --git a/src/test/ui/generator/issue-68112.rs b/src/test/ui/generator/issue-68112.rs index 03b21c5ebd3..21026f45cb8 100644 --- a/src/test/ui/generator/issue-68112.rs +++ b/src/test/ui/generator/issue-68112.rs @@ -64,6 +64,7 @@ fn test2() { //~^ ERROR `RefCell<i32>` cannot be shared between threads safely //~| NOTE `RefCell<i32>` cannot be shared between threads safely //~| NOTE required for + //~| NOTE required by a bound introduced by this call //~| NOTE captures the following types } diff --git a/src/test/ui/generator/issue-68112.stderr b/src/test/ui/generator/issue-68112.stderr index b56f445872b..eb99d42c920 100644 --- a/src/test/ui/generator/issue-68112.stderr +++ b/src/test/ui/generator/issue-68112.stderr @@ -1,8 +1,8 @@ error: generator cannot be sent between threads safely - --> $DIR/issue-68112.rs:40:5 + --> $DIR/issue-68112.rs:40:18 | LL | require_send(send_gen); - | ^^^^^^^^^^^^ generator is not `Send` + | ^^^^^^^^ generator is not `Send` | = help: the trait `Sync` is not implemented for `RefCell<i32>` note: generator is not `Send` as this value is used across a yield @@ -23,10 +23,12 @@ LL | fn require_send(_: impl Send) {} | ^^^^ required by this bound in `require_send` error[E0277]: `RefCell<i32>` cannot be shared between threads safely - --> $DIR/issue-68112.rs:63:5 + --> $DIR/issue-68112.rs:63:18 | LL | require_send(send_gen); - | ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely + | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely + | | + | required by a bound introduced by this call | = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: required for `Arc<RefCell<i32>>` to implement `Send` diff --git a/src/test/ui/generator/not-send-sync.stderr b/src/test/ui/generator/not-send-sync.stderr index b54b0f570c9..97dbaf73ade 100644 --- a/src/test/ui/generator/not-send-sync.stderr +++ b/src/test/ui/generator/not-send-sync.stderr @@ -1,8 +1,15 @@ error[E0277]: `Cell<i32>` cannot be shared between threads safely - --> $DIR/not-send-sync.rs:16:5 + --> $DIR/not-send-sync.rs:16:17 | -LL | assert_send(|| { - | ^^^^^^^^^^^ `Cell<i32>` cannot be shared between threads safely +LL | assert_send(|| { + | _____-----------_^ + | | | + | | required by a bound introduced by this call +LL | | +LL | | drop(&a); +LL | | yield; +LL | | }); + | |_____^ `Cell<i32>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Cell<i32>` = note: required for `&Cell<i32>` to implement `Send` @@ -16,12 +23,21 @@ note: required by a bound in `assert_send` | LL | fn assert_send<T: Send>(_: T) {} | ^^^^ required by this bound in `assert_send` +help: consider dereferencing here + | +LL | assert_send(*|| { + | + error: generator cannot be shared between threads safely - --> $DIR/not-send-sync.rs:9:5 - | -LL | assert_sync(|| { - | ^^^^^^^^^^^ generator is not `Sync` + --> $DIR/not-send-sync.rs:9:17 + | +LL | assert_sync(|| { + | _________________^ +LL | | +LL | | let a = Cell::new(2); +LL | | yield; +LL | | }); + | |_____^ generator is not `Sync` | = help: within `[generator@$DIR/not-send-sync.rs:9:17: 9:19]`, the trait `Sync` is not implemented for `Cell<i32>` note: generator is not `Sync` as this value is used across a yield diff --git a/src/test/ui/generator/partial-drop.stderr b/src/test/ui/generator/partial-drop.stderr index 1004fc64da9..9baafe54e84 100644 --- a/src/test/ui/generator/partial-drop.stderr +++ b/src/test/ui/generator/partial-drop.stderr @@ -1,8 +1,15 @@ error: generator cannot be sent between threads safely - --> $DIR/partial-drop.rs:14:5 + --> $DIR/partial-drop.rs:14:17 | -LL | assert_send(|| { - | ^^^^^^^^^^^ generator is not `Send` +LL | assert_send(|| { + | _________________^ +LL | | +LL | | // FIXME: it would be nice to make this work. +LL | | let guard = Bar { foo: Foo, x: 42 }; +LL | | drop(guard.foo); +LL | | yield; +LL | | }); + | |_____^ generator is not `Send` | = help: within `[generator@$DIR/partial-drop.rs:14:17: 14:19]`, the trait `Send` is not implemented for `Foo` note: generator is not `Send` as this value is used across a yield @@ -22,10 +29,17 @@ LL | fn assert_send<T: Send>(_: T) {} | ^^^^ required by this bound in `assert_send` error: generator cannot be sent between threads safely - --> $DIR/partial-drop.rs:22:5 + --> $DIR/partial-drop.rs:22:17 | -LL | assert_send(|| { - | ^^^^^^^^^^^ generator is not `Send` +LL | assert_send(|| { + | _________________^ +LL | | +LL | | // FIXME: it would be nice to make this work. +LL | | let guard = Bar { foo: Foo, x: 42 }; +... | +LL | | yield; +LL | | }); + | |_____^ generator is not `Send` | = help: within `[generator@$DIR/partial-drop.rs:22:17: 22:19]`, the trait `Send` is not implemented for `Foo` note: generator is not `Send` as this value is used across a yield @@ -45,10 +59,17 @@ LL | fn assert_send<T: Send>(_: T) {} | ^^^^ required by this bound in `assert_send` error: generator cannot be sent between threads safely - --> $DIR/partial-drop.rs:32:5 + --> $DIR/partial-drop.rs:32:17 | -LL | assert_send(|| { - | ^^^^^^^^^^^ generator is not `Send` +LL | assert_send(|| { + | _________________^ +LL | | +LL | | // FIXME: it would be nice to make this work. +LL | | let guard = Bar { foo: Foo, x: 42 }; +... | +LL | | yield; +LL | | }); + | |_____^ generator is not `Send` | = help: within `[generator@$DIR/partial-drop.rs:32:17: 32:19]`, the trait `Send` is not implemented for `Foo` note: generator is not `Send` as this value is used across a yield diff --git a/src/test/ui/generator/print/generator-print-verbose-1.stderr b/src/test/ui/generator/print/generator-print-verbose-1.stderr index bbde8ea7892..3a83021dd99 100644 --- a/src/test/ui/generator/print/generator-print-verbose-1.stderr +++ b/src/test/ui/generator/print/generator-print-verbose-1.stderr @@ -1,8 +1,8 @@ error: generator cannot be sent between threads safely - --> $DIR/generator-print-verbose-1.rs:37:5 + --> $DIR/generator-print-verbose-1.rs:37:18 | LL | require_send(send_gen); - | ^^^^^^^^^^^^ generator is not `Send` + | ^^^^^^^^ generator is not `Send` | = help: the trait `Sync` is not implemented for `RefCell<i32>` note: generator is not `Send` as this value is used across a yield @@ -21,10 +21,12 @@ LL | fn require_send(_: impl Send) {} | ^^^^ required by this bound in `require_send` error[E0277]: `RefCell<i32>` cannot be shared between threads safely - --> $DIR/generator-print-verbose-1.rs:56:5 + --> $DIR/generator-print-verbose-1.rs:56:18 | LL | require_send(send_gen); - | ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely + | ------------ ^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely + | | + | required by a bound introduced by this call | = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: required for `Arc<RefCell<i32>>` to implement `Send` diff --git a/src/test/ui/generator/print/generator-print-verbose-2.stderr b/src/test/ui/generator/print/generator-print-verbose-2.stderr index 92ca51b4e72..14e05818978 100644 --- a/src/test/ui/generator/print/generator-print-verbose-2.stderr +++ b/src/test/ui/generator/print/generator-print-verbose-2.stderr @@ -1,8 +1,15 @@ error[E0277]: `Cell<i32>` cannot be shared between threads safely - --> $DIR/generator-print-verbose-2.rs:19:5 + --> $DIR/generator-print-verbose-2.rs:19:17 | -LL | assert_send(|| { - | ^^^^^^^^^^^ `Cell<i32>` cannot be shared between threads safely +LL | assert_send(|| { + | _____-----------_^ + | | | + | | required by a bound introduced by this call +LL | | +LL | | drop(&a); +LL | | yield; +LL | | }); + | |_____^ `Cell<i32>` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Cell<i32>` = note: required for `&'_#4r Cell<i32>` to implement `Send` @@ -16,12 +23,21 @@ note: required by a bound in `assert_send` | LL | fn assert_send<T: Send>(_: T) {} | ^^^^ required by this bound in `assert_send` +help: consider dereferencing here + | +LL | assert_send(*|| { + | + error: generator cannot be shared between threads safely - --> $DIR/generator-print-verbose-2.rs:12:5 - | -LL | assert_sync(|| { - | ^^^^^^^^^^^ generator is not `Sync` + --> $DIR/generator-print-verbose-2.rs:12:17 + | +LL | assert_sync(|| { + | _________________^ +LL | | +LL | | let a = Cell::new(2); +LL | | yield; +LL | | }); + | |_____^ generator is not `Sync` | = help: within `[main::{closure#0} upvar_tys=() {Cell<i32>, ()}]`, the trait `Sync` is not implemented for `Cell<i32>` note: generator is not `Sync` as this value is used across a yield diff --git a/src/test/ui/generic-associated-types/bugs/issue-88460.stderr b/src/test/ui/generic-associated-types/bugs/issue-88460.stderr index 98c304cc90b..8193f491e69 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-88460.stderr +++ b/src/test/ui/generic-associated-types/bugs/issue-88460.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `for<'a> <_ as Trait>::Assoc<'a>: Marker` is not satisfied - --> $DIR/issue-88460.rs:30:5 + --> $DIR/issue-88460.rs:30:10 | LL | test(Foo); - | ^^^^ the trait `for<'a> Marker` is not implemented for `<_ as Trait>::Assoc<'a>` + | ---- ^^^ the trait `for<'a> Marker` is not implemented for `<_ as Trait>::Assoc<'a>` + | | + | required by a bound introduced by this call | = help: the trait `Marker` is implemented for `()` note: required by a bound in `test` diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-3.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-3.stderr index 066bf431a83..b30dd36d2ad 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-3.stderr +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-3.stderr @@ -1,8 +1,10 @@ error[E0277]: expected a `Fn<(<_ as ATC<'a>>::Type,)>` closure, found `F` - --> $DIR/issue-62529-3.rs:25:9 + --> $DIR/issue-62529-3.rs:25:14 | LL | call(f, ()); - | ^^^^ expected an `Fn<(<_ as ATC<'a>>::Type,)>` closure, found `F` + | ---- ^ expected an `Fn<(<_ as ATC<'a>>::Type,)>` closure, found `F` + | | + | required by a bound introduced by this call | = note: expected a closure with arguments `((),)` found a closure with arguments `(<_ as ATC<'a>>::Type,)` diff --git a/src/test/ui/inference/issue-71732.stderr b/src/test/ui/inference/issue-71732.stderr index 04673a375cf..79bee33280d 100644 --- a/src/test/ui/inference/issue-71732.stderr +++ b/src/test/ui/inference/issue-71732.stderr @@ -2,7 +2,9 @@ error[E0283]: type annotations needed --> $DIR/issue-71732.rs:18:10 | LL | .get(&"key".into()) - | ^^^ cannot infer type of the type parameter `Q` declared on the associated function `get` + | ^^^ ------------- type must be known at this point + | | + | cannot infer type of the type parameter `Q` declared on the associated function `get` | = note: multiple `impl`s satisfying `String: Borrow<_>` found in the following crates: `alloc`, `core`: - impl Borrow<str> for String; @@ -13,7 +15,7 @@ note: required by a bound in `HashMap::<K, V, S>::get` | LL | K: Borrow<Q>, | ^^^^^^^^^ required by this bound in `HashMap::<K, V, S>::get` -help: consider specifying the type argument in the function call +help: consider specifying the generic argument | LL | .get::<Q>(&"key".into()) | +++++ diff --git a/src/test/ui/inference/issue-72690.stderr b/src/test/ui/inference/issue-72690.stderr index d4eeda07366..3504b294ab2 100644 --- a/src/test/ui/inference/issue-72690.stderr +++ b/src/test/ui/inference/issue-72690.stderr @@ -12,7 +12,9 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:7:22 | LL | String::from("x".as_ref()); - | ^^^^^^ + | --- ^^^^^^ + | | + | type must be known at this point | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; @@ -39,7 +41,9 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:12:26 | LL | |x| String::from("x".as_ref()); - | ^^^^^^ + | --- ^^^^^^ + | | + | type must be known at this point | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; @@ -55,7 +59,9 @@ error[E0283]: type annotations needed for `&T` --> $DIR/issue-72690.rs:17:9 | LL | let _ = "x".as_ref(); - | ^ ------ type must be known at this point + | ^ --- ------ required by a bound introduced by this call + | | + | type must be known at this point | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; @@ -81,7 +87,9 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:21:22 | LL | String::from("x".as_ref()); - | ^^^^^^ + | --- ^^^^^^ + | | + | type must be known at this point | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; @@ -107,7 +115,9 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:28:22 | LL | String::from("x".as_ref()); - | ^^^^^^ + | --- ^^^^^^ + | | + | type must be known at this point | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; @@ -133,7 +143,9 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:37:22 | LL | String::from("x".as_ref()); - | ^^^^^^ + | --- ^^^^^^ + | | + | type must be known at this point | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; @@ -159,7 +171,9 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:46:22 | LL | String::from("x".as_ref()); - | ^^^^^^ + | --- ^^^^^^ + | | + | type must be known at this point | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; @@ -185,7 +199,9 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:53:22 | LL | String::from("x".as_ref()); - | ^^^^^^ + | --- ^^^^^^ + | | + | type must be known at this point | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; @@ -211,7 +227,9 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:62:22 | LL | String::from("x".as_ref()); - | ^^^^^^ + | --- ^^^^^^ + | | + | type must be known at this point | = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - impl AsRef<OsStr> for str; diff --git a/src/test/ui/inference/issue-86162-1.stderr b/src/test/ui/inference/issue-86162-1.stderr index e395e65fad0..4f621b82dc5 100644 --- a/src/test/ui/inference/issue-86162-1.stderr +++ b/src/test/ui/inference/issue-86162-1.stderr @@ -4,7 +4,7 @@ error[E0283]: type annotations needed LL | foo(gen()); //<- Do not suggest `foo::<impl Clone>()`! | --- ^^^ cannot infer type of the type parameter `T` declared on the function `gen` | | - | type must be known at this point + | required by a bound introduced by this call | = note: cannot satisfy `_: Clone` note: required by a bound in `foo` diff --git a/src/test/ui/interior-mutability/interior-mutability.stderr b/src/test/ui/interior-mutability/interior-mutability.stderr index 7955fecda06..ee476e7aa38 100644 --- a/src/test/ui/interior-mutability/interior-mutability.stderr +++ b/src/test/ui/interior-mutability/interior-mutability.stderr @@ -1,8 +1,10 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/interior-mutability.rs:5:5 + --> $DIR/interior-mutability.rs:5:18 | LL | catch_unwind(|| { x.set(23); }); - | ^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ------------ ^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | | + | required by a bound introduced by this call | = help: within `Cell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` = note: required because it appears within the type `Cell<i32>` @@ -17,6 +19,10 @@ note: required by a bound in `catch_unwind` | LL | pub fn catch_unwind<F: FnOnce() -> R + UnwindSafe, R>(f: F) -> Result<R> { | ^^^^^^^^^^ required by this bound in `catch_unwind` +help: consider dereferencing here + | +LL | catch_unwind(*|| { x.set(23); }); + | + error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17651.stderr b/src/test/ui/issues/issue-17651.stderr index efaaeeda2fa..792b8294b44 100644 --- a/src/test/ui/issues/issue-17651.stderr +++ b/src/test/ui/issues/issue-17651.stderr @@ -1,10 +1,8 @@ error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time - --> $DIR/issue-17651.rs:5:18 + --> $DIR/issue-17651.rs:5:9 | LL | (|| Box::new(*(&[0][..])))(); - | -------- ^^^^^^^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[{integer}]` note: required by a bound in `Box::<T>::new` diff --git a/src/test/ui/issues/issue-20162.stderr b/src/test/ui/issues/issue-20162.stderr index d70bf6e1d92..3f9b3be9851 100644 --- a/src/test/ui/issues/issue-20162.stderr +++ b/src/test/ui/issues/issue-20162.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `X: Ord` is not satisfied - --> $DIR/issue-20162.rs:5:7 + --> $DIR/issue-20162.rs:5:5 | LL | b.sort(); - | ^^^^ the trait `Ord` is not implemented for `X` + | ^ ---- required by a bound introduced by this call + | | + | the trait `Ord` is not implemented for `X` | note: required by a bound in `slice::<impl [T]>::sort` --> $SRC_DIR/alloc/src/slice.rs:LL:COL diff --git a/src/test/ui/issues/issue-21763.stderr b/src/test/ui/issues/issue-21763.stderr index 79068158924..72c65029746 100644 --- a/src/test/ui/issues/issue-21763.stderr +++ b/src/test/ui/issues/issue-21763.stderr @@ -1,8 +1,8 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely - --> $DIR/issue-21763.rs:9:5 + --> $DIR/issue-21763.rs:9:11 | LL | foo::<HashMap<Rc<()>, Rc<()>>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely + | ^^^^^^^^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely | = help: within `(Rc<()>, Rc<()>)`, the trait `Send` is not implemented for `Rc<()>` = note: required because it appears within the type `(Rc<()>, Rc<()>)` diff --git a/src/test/ui/issues/issue-31173.rs b/src/test/ui/issues/issue-31173.rs index 472a95d4636..04efa27189b 100644 --- a/src/test/ui/issues/issue-31173.rs +++ b/src/test/ui/issues/issue-31173.rs @@ -4,12 +4,12 @@ pub fn get_tok(it: &mut IntoIter<u8>) { let mut found_e = false; let temp: Vec<u8> = it + //~^ ERROR to be an iterator that yields `&_`, but it yields `u8` .take_while(|&x| { found_e = true; false }) .cloned() - //~^ ERROR to be an iterator that yields `&_`, but it yields `u8` .collect(); //~ ERROR the method } diff --git a/src/test/ui/issues/issue-31173.stderr b/src/test/ui/issues/issue-31173.stderr index 0b8222088b8..e3334eef3ad 100644 --- a/src/test/ui/issues/issue-31173.stderr +++ b/src/test/ui/issues/issue-31173.stderr @@ -1,8 +1,16 @@ -error[E0271]: expected `TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>` to be an iterator that yields `&_`, but it yields `u8` - --> $DIR/issue-31173.rs:11:10 - | -LL | .cloned() - | ^^^^^^ expected reference, found `u8` +error[E0271]: expected `TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>` to be an iterator that yields `&_`, but it yields `u8` + --> $DIR/issue-31173.rs:6:25 + | +LL | let temp: Vec<u8> = it + | _________________________^ +LL | | +LL | | .take_while(|&x| { +LL | | found_e = true; +LL | | false +LL | | }) + | |__________^ expected reference, found `u8` +LL | .cloned() + | ------ required by a bound introduced by this call | = note: expected reference `&_` found type `u8` @@ -12,11 +20,11 @@ note: required by a bound in `cloned` LL | Self: Sized + Iterator<Item = &'a T>, | ^^^^^^^^^^^^ required by this bound in `cloned` -error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>`, but its trait bounds were not satisfied +error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>`, but its trait bounds were not satisfied --> $DIR/issue-31173.rs:13:10 | LL | .collect(); - | ^^^^^^^ method cannot be called on `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>` due to unsatisfied trait bounds + | ^^^^^^^ method cannot be called on `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>` due to unsatisfied trait bounds | ::: $SRC_DIR/core/src/iter/adapters/take_while.rs:LL:COL | @@ -29,10 +37,10 @@ LL | pub struct Cloned<I> { | -------------------- doesn't satisfy `_: Iterator` | = note: the following trait bounds were not satisfied: - `<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]> as Iterator>::Item = &_` - which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator` - `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator` - which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator` + `<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]> as Iterator>::Item = &_` + which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>: Iterator` + `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>: Iterator` + which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>: Iterator` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-33941.stderr b/src/test/ui/issues/issue-33941.stderr index caba0ad5268..691b8f88f4e 100644 --- a/src/test/ui/issues/issue-33941.stderr +++ b/src/test/ui/issues/issue-33941.stderr @@ -1,8 +1,10 @@ error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)` - --> $DIR/issue-33941.rs:6:36 + --> $DIR/issue-33941.rs:6:14 | LL | for _ in HashMap::new().iter().cloned() {} - | ^^^^^^ expected reference, found tuple + | ^^^^^^^^^^^^^^^^^^^^^ ------ required by a bound introduced by this call + | | + | expected reference, found tuple | = note: expected reference `&_` found tuple `(&_, &_)` diff --git a/src/test/ui/issues/issue-34334.stderr b/src/test/ui/issues/issue-34334.stderr index 48ae2df691c..72082f0cd17 100644 --- a/src/test/ui/issues/issue-34334.stderr +++ b/src/test/ui/issues/issue-34334.stderr @@ -13,10 +13,12 @@ LL | let sr: Vec<(u32, _, _)> = vec![]; | + error[E0277]: a value of type `Vec<(u32, _, _)>` cannot be built from an iterator over elements of type `()` - --> $DIR/issue-34334.rs:5:87 + --> $DIR/issue-34334.rs:5:33 | LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect(); - | ^^^^^^^ value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator<Item=()>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call + | | + | value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator<Item=()>` | = help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>` = help: the trait `FromIterator<T>` is implemented for `Vec<T>` diff --git a/src/test/ui/issues/issue-34349.stderr b/src/test/ui/issues/issue-34349.stderr index d0b51961b44..272feb1e379 100644 --- a/src/test/ui/issues/issue-34349.stderr +++ b/src/test/ui/issues/issue-34349.stderr @@ -7,7 +7,7 @@ LL | farewell.push_str("!!!"); | -------- closure is `FnMut` because it mutates the variable `farewell` here ... LL | apply(diary); - | ----- the requirement to implement `Fn` derives from here + | ----- the requirement to implement `Fn` derives from here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-59488.rs b/src/test/ui/issues/issue-59488.rs index 922b593935a..384501e3e5d 100644 --- a/src/test/ui/issues/issue-59488.rs +++ b/src/test/ui/issues/issue-59488.rs @@ -30,4 +30,5 @@ fn main() { assert_eq!(Foo::Bar, i); //~^ ERROR binary operation `==` cannot be applied to type `fn(usize) -> Foo {Foo::Bar}` [E0369] //~| ERROR `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` [E0277] + //~| ERROR `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` [E0277] } diff --git a/src/test/ui/issues/issue-59488.stderr b/src/test/ui/issues/issue-59488.stderr index 7ce3dedaa88..bb6843a1958 100644 --- a/src/test/ui/issues/issue-59488.stderr +++ b/src/test/ui/issues/issue-59488.stderr @@ -106,7 +106,26 @@ LL | assert_eq!(Foo::Bar, i); and 68 others = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 9 previous errors +error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug` + --> $DIR/issue-59488.rs:30:5 + | +LL | assert_eq!(Foo::Bar, i); + | ^^^^^^^^^^^^^^^^^^^^^^^ `fn(usize) -> Foo {Foo::Bar}` cannot be formatted using `{:?}` because it doesn't implement `Debug` + | + = help: the trait `Debug` is not implemented for `fn(usize) -> Foo {Foo::Bar}` + = help: the following other types implement trait `Debug`: + extern "C" fn() -> Ret + extern "C" fn(A, B) -> Ret + extern "C" fn(A, B, ...) -> Ret + extern "C" fn(A, B, C) -> Ret + extern "C" fn(A, B, C, ...) -> Ret + extern "C" fn(A, B, C, D) -> Ret + extern "C" fn(A, B, C, D, ...) -> Ret + extern "C" fn(A, B, C, D, E) -> Ret + and 68 others + = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 10 previous errors Some errors have detailed explanations: E0277, E0308, E0369. For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-60218.stderr b/src/test/ui/issues/issue-60218.stderr index 870b2501447..9105492c9ad 100644 --- a/src/test/ui/issues/issue-60218.stderr +++ b/src/test/ui/issues/issue-60218.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `&u32: Foo` is not satisfied - --> $DIR/issue-60218.rs:18:27 + --> $DIR/issue-60218.rs:18:19 | LL | trigger_error(vec![], |x: &u32| x) - | ------------- ^^^^^^^^^^^ the trait `Foo` is not implemented for `&u32` + | ------------- ^^^^^^ the trait `Foo` is not implemented for `&u32` | | | required by a bound introduced by this call | @@ -14,6 +14,7 @@ LL | pub fn trigger_error<I, F>(iterable: I, functor: F) ... LL | for<'t> <Map<<&'t I as IntoIterator>::IntoIter, F> as Iterator>::Item: Foo, | ^^^ required by this bound in `trigger_error` + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr index d6e39251632..2de15037650 100644 --- a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr +++ b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr @@ -1,8 +1,10 @@ error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over elements of type `&f64` - --> $DIR/issue-66923-show-error-for-correct-call.rs:8:39 + --> $DIR/issue-66923-show-error-for-correct-call.rs:8:24 | LL | let x2: Vec<f64> = x1.into_iter().collect(); - | ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>` + | ^^^^^^^^^^^^^^ ------- required by a bound introduced by this call + | | + | value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>` | = help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>` = help: the trait `FromIterator<T>` is implemented for `Vec<T>` @@ -13,10 +15,12 @@ LL | fn collect<B: FromIterator<Self::Item>>(self) -> B | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over elements of type `&f64` - --> $DIR/issue-66923-show-error-for-correct-call.rs:12:29 + --> $DIR/issue-66923-show-error-for-correct-call.rs:12:14 | LL | let x3 = x1.into_iter().collect::<Vec<f64>>(); - | ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>` + | ^^^^^^^^^^^^^^ ------- required by a bound introduced by this call + | | + | value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>` | = help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>` = help: the trait `FromIterator<T>` is implemented for `Vec<T>` diff --git a/src/test/ui/issues/issue-69455.stderr b/src/test/ui/issues/issue-69455.stderr index b732df764e5..3e40777c8d0 100644 --- a/src/test/ui/issues/issue-69455.stderr +++ b/src/test/ui/issues/issue-69455.stderr @@ -14,9 +14,10 @@ error[E0283]: type annotations needed --> $DIR/issue-69455.rs:29:41 | LL | println!("{}", 23u64.test(xs.iter().sum())); - | ---- ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` - | | - | type must be known at this point + | ----- ---- ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum` + | | | + | | required by a bound introduced by this call + | type must be known at this point | note: multiple `impl`s satisfying `u64: Test<_>` found --> $DIR/issue-69455.rs:11:1 diff --git a/src/test/ui/issues/issue-69683.stderr b/src/test/ui/issues/issue-69683.stderr index 193de1a35cf..6d9a1c6fbf9 100644 --- a/src/test/ui/issues/issue-69683.stderr +++ b/src/test/ui/issues/issue-69683.stderr @@ -14,7 +14,7 @@ error[E0283]: type annotations needed --> $DIR/issue-69683.rs:30:10 | LL | 0u16.foo(b); - | ^^^ + | ^^^ - type must be known at this point | note: multiple `impl`s satisfying `u8: Element<_>` found --> $DIR/issue-69683.rs:5:1 @@ -37,7 +37,33 @@ help: try using a fully qualified path to specify the expected types LL | <u16 as Foo<I>>::foo(0u16, b); | +++++++++++++++++++++ ~ -error: aborting due to 2 previous errors +error[E0283]: type annotations needed + --> $DIR/issue-69683.rs:30:10 + | +LL | 0u16.foo(b); + | ---- ^^^ + | | + | type must be known at this point + | +note: multiple `impl`s satisfying `u8: Element<_>` found + --> $DIR/issue-69683.rs:5:1 + | +LL | impl<T> Element<()> for T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | impl<T: Element<S>, S> Element<[S; 3]> for T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: required for `u16` to implement `Foo<_>` + --> $DIR/issue-69683.rs:20:9 + | +LL | impl<I> Foo<I> for u16 + | ^^^^^^ ^^^ +help: try using a fully qualified path to specify the expected types + | +LL | <u16 as Foo<I>>::foo(0u16, b); + | +++++++++++++++++++++ ~ + +error: aborting due to 3 previous errors Some errors have detailed explanations: E0283, E0284. For more information about an error, try `rustc --explain E0283`. diff --git a/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr b/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr index c6e6ea1e096..b834920b0d0 100644 --- a/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr +++ b/src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr @@ -34,8 +34,12 @@ LL | assert_eq!(a, 0); | ^^^^^^^^^^^^^^^^ `fn() -> i32 {a}` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = help: the trait `Debug` is not implemented for `fn() -> i32 {a}` - = help: use parentheses to call the function: `a()` = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use parentheses to call the function + --> $SRC_DIR/core/src/macros/mod.rs:LL:COL + | +LL | $crate::panicking::assert_failed(kind, &*left_val(), &*right_val, $crate::option::Option::None); + | ++ error: aborting due to 3 previous errors diff --git a/src/test/ui/iterators/collect-into-array.rs b/src/test/ui/iterators/collect-into-array.rs index a1144c8cb8c..7d35da82532 100644 --- a/src/test/ui/iterators/collect-into-array.rs +++ b/src/test/ui/iterators/collect-into-array.rs @@ -4,4 +4,5 @@ fn main() { //~^ ERROR an array of type `[u32; 10]` cannot be built directly from an iterator //~| NOTE try collecting into a `Vec<{integer}>`, then using `.try_into()` //~| NOTE required by a bound in `collect` + //~| NOTE required by a bound introduced by this call } diff --git a/src/test/ui/iterators/collect-into-array.stderr b/src/test/ui/iterators/collect-into-array.stderr index 7be53a4873b..7fe9707e6d2 100644 --- a/src/test/ui/iterators/collect-into-array.stderr +++ b/src/test/ui/iterators/collect-into-array.stderr @@ -1,8 +1,10 @@ error[E0277]: an array of type `[u32; 10]` cannot be built directly from an iterator - --> $DIR/collect-into-array.rs:3:39 + --> $DIR/collect-into-array.rs:3:31 | LL | let whatever: [u32; 10] = (0..10).collect(); - | ^^^^^^^ try collecting into a `Vec<{integer}>`, then using `.try_into()` + | ^^^^^^^ ------- required by a bound introduced by this call + | | + | try collecting into a `Vec<{integer}>`, then using `.try_into()` | = help: the trait `FromIterator<{integer}>` is not implemented for `[u32; 10]` note: required by a bound in `collect` diff --git a/src/test/ui/iterators/collect-into-slice.rs b/src/test/ui/iterators/collect-into-slice.rs index aafa6bc8b95..5eade075613 100644 --- a/src/test/ui/iterators/collect-into-slice.rs +++ b/src/test/ui/iterators/collect-into-slice.rs @@ -1,15 +1,20 @@ fn process_slice(data: &[i32]) { //~^ NOTE required by a bound in this + //~| NOTE required by a bound in this todo!() } fn main() { let some_generated_vec = (0..10).collect(); //~^ ERROR the size for values of type `[i32]` cannot be known at compilation time + //~| ERROR the size for values of type `[i32]` cannot be known at compilation time //~| ERROR a slice of type `[i32]` cannot be built since `[i32]` has no definite size //~| NOTE try explicitly collecting into a `Vec<{integer}>` //~| NOTE required by a bound in `collect` + //~| NOTE required by a bound in `collect` //~| NOTE all local variables must have a statically known size //~| NOTE doesn't have a size known at compile-time + //~| NOTE doesn't have a size known at compile-time + //~| NOTE required by a bound introduced by this call process_slice(&some_generated_vec); } diff --git a/src/test/ui/iterators/collect-into-slice.stderr b/src/test/ui/iterators/collect-into-slice.stderr index 4842e65fe97..bce40118bdf 100644 --- a/src/test/ui/iterators/collect-into-slice.stderr +++ b/src/test/ui/iterators/collect-into-slice.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `[i32]` cannot be known at compilation time - --> $DIR/collect-into-slice.rs:7:9 + --> $DIR/collect-into-slice.rs:8:9 | LL | let some_generated_vec = (0..10).collect(); | ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -8,11 +8,26 @@ LL | let some_generated_vec = (0..10).collect(); = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature +error[E0277]: the size for values of type `[i32]` cannot be known at compilation time + --> $DIR/collect-into-slice.rs:8:38 + | +LL | let some_generated_vec = (0..10).collect(); + | ^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[i32]` +note: required by a bound in `collect` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + | +LL | fn collect<B: FromIterator<Self::Item>>(self) -> B + | ^ required by this bound in `collect` + error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size - --> $DIR/collect-into-slice.rs:7:38 + --> $DIR/collect-into-slice.rs:8:30 | LL | let some_generated_vec = (0..10).collect(); - | ^^^^^^^ try explicitly collecting into a `Vec<{integer}>` + | ^^^^^^^ ------- required by a bound introduced by this call + | | + | try explicitly collecting into a `Vec<{integer}>` | = help: the trait `FromIterator<{integer}>` is not implemented for `[i32]` note: required by a bound in `collect` @@ -21,6 +36,6 @@ note: required by a bound in `collect` LL | fn collect<B: FromIterator<Self::Item>>(self) -> B | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/iterators/issue-28098.stderr b/src/test/ui/iterators/issue-28098.stderr index 53b610c1723..542807fb91c 100644 --- a/src/test/ui/iterators/issue-28098.stderr +++ b/src/test/ui/iterators/issue-28098.stderr @@ -8,6 +8,14 @@ LL | let _ = Iterator::next(&mut ()); | = help: the trait `Iterator` is not implemented for `()` +error[E0277]: `()` is not an iterator + --> $DIR/issue-28098.rs:2:13 + | +LL | let _ = Iterator::next(&mut ()); + | ^^^^^^^^^^^^^^ `()` is not an iterator + | + = help: the trait `Iterator` is not implemented for `()` + error[E0277]: `bool` is not an iterator --> $DIR/issue-28098.rs:5:14 | @@ -28,6 +36,14 @@ LL | let _ = Iterator::next(&mut ()); = help: the trait `Iterator` is not implemented for `()` error[E0277]: `()` is not an iterator + --> $DIR/issue-28098.rs:8:13 + | +LL | let _ = Iterator::next(&mut ()); + | ^^^^^^^^^^^^^^ `()` is not an iterator + | + = help: the trait `Iterator` is not implemented for `()` + +error[E0277]: `()` is not an iterator --> $DIR/issue-28098.rs:17:28 | LL | let _ = Iterator::next(&mut ()); @@ -38,6 +54,14 @@ LL | let _ = Iterator::next(&mut ()); = help: the trait `Iterator` is not implemented for `()` error[E0277]: `()` is not an iterator + --> $DIR/issue-28098.rs:17:13 + | +LL | let _ = Iterator::next(&mut ()); + | ^^^^^^^^^^^^^^ `()` is not an iterator + | + = help: the trait `Iterator` is not implemented for `()` + +error[E0277]: `()` is not an iterator --> $DIR/issue-28098.rs:20:28 | LL | let _ = Iterator::next(&mut ()); @@ -47,6 +71,14 @@ LL | let _ = Iterator::next(&mut ()); | = help: the trait `Iterator` is not implemented for `()` +error[E0277]: `()` is not an iterator + --> $DIR/issue-28098.rs:20:13 + | +LL | let _ = Iterator::next(&mut ()); + | ^^^^^^^^^^^^^^ `()` is not an iterator + | + = help: the trait `Iterator` is not implemented for `()` + error[E0277]: `bool` is not an iterator --> $DIR/issue-28098.rs:23:14 | @@ -56,6 +88,6 @@ LL | for _ in false {} = help: the trait `Iterator` is not implemented for `bool` = note: required for `bool` to implement `IntoIterator` -error: aborting due to 6 previous errors +error: aborting due to 10 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/kindck/kindck-nonsendable-1.stderr b/src/test/ui/kindck/kindck-nonsendable-1.stderr index eab003a1107..cc6e1f59c77 100644 --- a/src/test/ui/kindck/kindck-nonsendable-1.stderr +++ b/src/test/ui/kindck/kindck-nonsendable-1.stderr @@ -1,10 +1,12 @@ error[E0277]: `Rc<usize>` cannot be sent between threads safely - --> $DIR/kindck-nonsendable-1.rs:9:5 + --> $DIR/kindck-nonsendable-1.rs:9:9 | LL | bar(move|| foo(x)); - | ^^^ ------ within this `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15]` - | | - | `Rc<usize>` cannot be sent between threads safely + | --- ------^^^^^^^ + | | | + | | `Rc<usize>` cannot be sent between threads safely + | | within this `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15]` + | required by a bound introduced by this call | = help: within `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15]`, the trait `Send` is not implemented for `Rc<usize>` note: required because it's used within this closure diff --git a/src/test/ui/kindck/kindck-send-object.stderr b/src/test/ui/kindck/kindck-send-object.stderr index 47b7462a6a1..e9bbeeacd70 100644 --- a/src/test/ui/kindck/kindck-send-object.stderr +++ b/src/test/ui/kindck/kindck-send-object.stderr @@ -1,8 +1,8 @@ error[E0277]: `(dyn Dummy + 'static)` cannot be shared between threads safely - --> $DIR/kindck-send-object.rs:12:5 + --> $DIR/kindck-send-object.rs:12:19 | LL | assert_send::<&'static (dyn Dummy + 'static)>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `(dyn Dummy + 'static)` = note: required for `&'static (dyn Dummy + 'static)` to implement `Send` @@ -13,10 +13,10 @@ LL | fn assert_send<T:Send>() { } | ^^^^ required by this bound in `assert_send` error[E0277]: `dyn Dummy` cannot be sent between threads safely - --> $DIR/kindck-send-object.rs:17:5 + --> $DIR/kindck-send-object.rs:17:19 | LL | assert_send::<Box<dyn Dummy>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely + | ^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `dyn Dummy` = note: required for `Unique<dyn Dummy>` to implement `Send` diff --git a/src/test/ui/kindck/kindck-send-object1.stderr b/src/test/ui/kindck/kindck-send-object1.stderr index 24428266cc7..11f597fee91 100644 --- a/src/test/ui/kindck/kindck-send-object1.stderr +++ b/src/test/ui/kindck/kindck-send-object1.stderr @@ -1,8 +1,8 @@ error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely - --> $DIR/kindck-send-object1.rs:10:5 + --> $DIR/kindck-send-object1.rs:10:19 | LL | assert_send::<&'a dyn Dummy>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely + | ^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `(dyn Dummy + 'a)` = note: required for `&'a (dyn Dummy + 'a)` to implement `Send` @@ -13,10 +13,10 @@ LL | fn assert_send<T:Send+'static>() { } | ^^^^ required by this bound in `assert_send` error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely - --> $DIR/kindck-send-object1.rs:28:5 + --> $DIR/kindck-send-object1.rs:28:19 | LL | assert_send::<Box<dyn Dummy + 'a>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely + | ^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `(dyn Dummy + 'a)` = note: required for `Unique<(dyn Dummy + 'a)>` to implement `Send` diff --git a/src/test/ui/kindck/kindck-send-object2.stderr b/src/test/ui/kindck/kindck-send-object2.stderr index 81ec65950d8..b8af33d0dc1 100644 --- a/src/test/ui/kindck/kindck-send-object2.stderr +++ b/src/test/ui/kindck/kindck-send-object2.stderr @@ -1,8 +1,8 @@ error[E0277]: `(dyn Dummy + 'static)` cannot be shared between threads safely - --> $DIR/kindck-send-object2.rs:7:5 + --> $DIR/kindck-send-object2.rs:7:19 | LL | assert_send::<&'static dyn Dummy>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely + | ^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `(dyn Dummy + 'static)` = note: required for `&'static (dyn Dummy + 'static)` to implement `Send` @@ -13,10 +13,10 @@ LL | fn assert_send<T:Send>() { } | ^^^^ required by this bound in `assert_send` error[E0277]: `dyn Dummy` cannot be sent between threads safely - --> $DIR/kindck-send-object2.rs:12:5 + --> $DIR/kindck-send-object2.rs:12:19 | LL | assert_send::<Box<dyn Dummy>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely + | ^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `dyn Dummy` = note: required for `Unique<dyn Dummy>` to implement `Send` diff --git a/src/test/ui/kindck/kindck-send-owned.stderr b/src/test/ui/kindck/kindck-send-owned.stderr index 076c4295982..b03f56465ce 100644 --- a/src/test/ui/kindck/kindck-send-owned.stderr +++ b/src/test/ui/kindck/kindck-send-owned.stderr @@ -1,8 +1,8 @@ error[E0277]: `*mut u8` cannot be sent between threads safely - --> $DIR/kindck-send-owned.rs:12:5 + --> $DIR/kindck-send-owned.rs:12:19 | LL | assert_send::<Box<*mut u8>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*mut u8` cannot be sent between threads safely + | ^^^^^^^^^^^^ `*mut u8` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `*mut u8` = note: required for `Unique<*mut u8>` to implement `Send` diff --git a/src/test/ui/lazy-type-alias-impl-trait/branches.stderr b/src/test/ui/lazy-type-alias-impl-trait/branches.stderr index 6b87da0c040..33f82448dd2 100644 --- a/src/test/ui/lazy-type-alias-impl-trait/branches.stderr +++ b/src/test/ui/lazy-type-alias-impl-trait/branches.stderr @@ -1,8 +1,10 @@ error[E0277]: a value of type `Bar` cannot be built from an iterator over elements of type `_` - --> $DIR/branches.rs:19:28 + --> $DIR/branches.rs:19:9 | LL | std::iter::empty().collect() - | ^^^^^^^ value of type `Bar` cannot be built from `std::iter::Iterator<Item=_>` + | ^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call + | | + | value of type `Bar` cannot be built from `std::iter::Iterator<Item=_>` | = help: the trait `FromIterator<_>` is not implemented for `Bar` note: required by a bound in `collect` diff --git a/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr b/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr index 42a1f782d29..57978edf2bf 100644 --- a/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr +++ b/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr @@ -1,8 +1,10 @@ error[E0277]: a value of type `Foo` cannot be built from an iterator over elements of type `_` - --> $DIR/recursion4.rs:10:28 + --> $DIR/recursion4.rs:10:9 | LL | x = std::iter::empty().collect(); - | ^^^^^^^ value of type `Foo` cannot be built from `std::iter::Iterator<Item=_>` + | ^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call + | | + | value of type `Foo` cannot be built from `std::iter::Iterator<Item=_>` | = help: the trait `FromIterator<_>` is not implemented for `Foo` note: required by a bound in `collect` @@ -12,10 +14,12 @@ LL | fn collect<B: FromIterator<Self::Item>>(self) -> B | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error[E0277]: a value of type `impl Debug` cannot be built from an iterator over elements of type `_` - --> $DIR/recursion4.rs:19:28 + --> $DIR/recursion4.rs:19:9 | LL | x = std::iter::empty().collect(); - | ^^^^^^^ value of type `impl Debug` cannot be built from `std::iter::Iterator<Item=_>` + | ^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call + | | + | value of type `impl Debug` cannot be built from `std::iter::Iterator<Item=_>` | = help: the trait `FromIterator<_>` is not implemented for `impl Debug` note: required by a bound in `collect` diff --git a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr index e0f8a5447b0..754735988e4 100644 --- a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr +++ b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr @@ -13,7 +13,9 @@ error[E0283]: type annotations needed --> $DIR/method-ambig-one-trait-unknown-int-type.rs:26:7 | LL | x.foo(); - | ^^^ + | - ^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `Vec<_>: Foo` found --> $DIR/method-ambig-one-trait-unknown-int-type.rs:9:1 diff --git a/src/test/ui/mismatched_types/E0631.stderr b/src/test/ui/mismatched_types/E0631.stderr index 410ea4b0b34..32ec9ecc474 100644 --- a/src/test/ui/mismatched_types/E0631.stderr +++ b/src/test/ui/mismatched_types/E0631.stderr @@ -1,10 +1,12 @@ error[E0631]: type mismatch in closure arguments - --> $DIR/E0631.rs:7:5 + --> $DIR/E0631.rs:7:9 | LL | foo(|_: isize| {}); - | ^^^ ---------- found signature defined here - | | - | expected due to this + | --- ----------^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `fn(usize) -> _` found closure signature `fn(isize) -> _` @@ -15,12 +17,14 @@ LL | fn foo<F: Fn(usize)>(_: F) {} | ^^^^^^^^^ required by this bound in `foo` error[E0631]: type mismatch in closure arguments - --> $DIR/E0631.rs:8:5 + --> $DIR/E0631.rs:8:9 | LL | bar(|_: isize| {}); - | ^^^ ---------- found signature defined here - | | - | expected due to this + | --- ----------^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `fn(usize) -> _` found closure signature `fn(isize) -> _` diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr index a02ec819838..c194e1dbc9a 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count.stderr @@ -46,12 +46,14 @@ LL | [1, 2, 3].sort_by(|tuple, tuple2| panic!()); | ~~~~~~~~~~~~~~~ error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments - --> $DIR/closure-arg-count.rs:13:5 + --> $DIR/closure-arg-count.rs:13:7 | LL | f(|| panic!()); - | ^ -- takes 0 arguments - | | - | expected closure that takes 1 argument + | - --^^^^^^^^^ + | | | + | | expected closure that takes 1 argument + | | takes 0 arguments + | required by a bound introduced by this call | note: required by a bound in `f` --> $DIR/closure-arg-count.rs:3:9 @@ -64,12 +66,14 @@ LL | f(|_| panic!()); | ~~~ error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments - --> $DIR/closure-arg-count.rs:15:5 + --> $DIR/closure-arg-count.rs:15:9 | LL | f( move || panic!()); - | ^ ---------- takes 0 arguments - | | - | expected closure that takes 1 argument + | - ----------^^^^^^^^^ + | | | + | | expected closure that takes 1 argument + | | takes 0 arguments + | required by a bound introduced by this call | note: required by a bound in `f` --> $DIR/closure-arg-count.rs:3:9 diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr index 71469bfec2d..0df71af3e70 100644 --- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -1,10 +1,12 @@ error[E0631]: type mismatch in closure arguments - --> $DIR/closure-arg-type-mismatch.rs:3:14 + --> $DIR/closure-arg-type-mismatch.rs:3:18 | LL | a.iter().map(|_: (u32, u32)| 45); - | ^^^ --------------- found signature defined here - | | - | expected due to this + | --- ---------------^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `fn(&(u32, u32)) -> _` found closure signature `fn((u32, u32)) -> _` @@ -15,12 +17,14 @@ LL | F: FnMut(Self::Item) -> B, | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0631]: type mismatch in closure arguments - --> $DIR/closure-arg-type-mismatch.rs:4:14 + --> $DIR/closure-arg-type-mismatch.rs:4:18 | LL | a.iter().map(|_: &(u16, u16)| 45); - | ^^^ ---------------- found signature defined here - | | - | expected due to this + | --- ----------------^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `fn(&(u32, u32)) -> _` found closure signature `for<'r> fn(&'r (u16, u16)) -> _` @@ -31,12 +35,14 @@ LL | F: FnMut(Self::Item) -> B, | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0631]: type mismatch in closure arguments - --> $DIR/closure-arg-type-mismatch.rs:5:14 + --> $DIR/closure-arg-type-mismatch.rs:5:18 | LL | a.iter().map(|_: (u16, u16)| 45); - | ^^^ --------------- found signature defined here - | | - | expected due to this + | --- ---------------^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `fn(&(u32, u32)) -> _` found closure signature `fn((u16, u16)) -> _` diff --git a/src/test/ui/mismatched_types/issue-36053-2.stderr b/src/test/ui/mismatched_types/issue-36053-2.stderr index b11ea97d160..86348b50475 100644 --- a/src/test/ui/mismatched_types/issue-36053-2.stderr +++ b/src/test/ui/mismatched_types/issue-36053-2.stderr @@ -1,10 +1,12 @@ error[E0631]: type mismatch in closure arguments - --> $DIR/issue-36053-2.rs:7:32 + --> $DIR/issue-36053-2.rs:7:39 | LL | once::<&str>("str").fuse().filter(|a: &str| true).count(); - | ^^^^^^ --------- found signature defined here - | | - | expected due to this + | ------ ---------^^^^^ + | | | + | | expected due to this + | | found signature defined here + | required by a bound introduced by this call | = note: expected closure signature `for<'r> fn(&'r &str) -> _` found closure signature `for<'r> fn(&'r str) -> _` diff --git a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr index c2515c40b1d..36748fae13c 100644 --- a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr +++ b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr @@ -1,8 +1,10 @@ error[E0277]: `Foo` doesn't implement `Debug` - --> $DIR/method-help-unsatisfied-bound.rs:5:7 + --> $DIR/method-help-unsatisfied-bound.rs:5:5 | LL | a.unwrap(); - | ^^^^^^ `Foo` cannot be formatted using `{:?}` + | ^ ------ required by a bound introduced by this call + | | + | `Foo` cannot be formatted using `{:?}` | = help: the trait `Debug` is not implemented for `Foo` = note: add `#[derive(Debug)]` to `Foo` or manually `impl Debug for Foo` diff --git a/src/test/ui/never_type/defaulted-never-note.fallback.stderr b/src/test/ui/never_type/defaulted-never-note.fallback.stderr index 4c8b4922473..283aca1b084 100644 --- a/src/test/ui/never_type/defaulted-never-note.fallback.stderr +++ b/src/test/ui/never_type/defaulted-never-note.fallback.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `!: ImplementedForUnitButNotNever` is not satisfied - --> $DIR/defaulted-never-note.rs:30:5 + --> $DIR/defaulted-never-note.rs:30:9 | LL | foo(_x); - | ^^^ the trait `ImplementedForUnitButNotNever` is not implemented for `!` + | --- ^^ the trait `ImplementedForUnitButNotNever` is not implemented for `!` + | | + | required by a bound introduced by this call | = help: the trait `ImplementedForUnitButNotNever` is implemented for `()` = note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information) diff --git a/src/test/ui/never_type/defaulted-never-note.rs b/src/test/ui/never_type/defaulted-never-note.rs index aefc739a0a0..d30ffcd3846 100644 --- a/src/test/ui/never_type/defaulted-never-note.rs +++ b/src/test/ui/never_type/defaulted-never-note.rs @@ -32,6 +32,7 @@ fn smeg() { //[fallback]~| NOTE the trait `ImplementedForUnitButNotNever` is not implemented //[fallback]~| HELP trait `ImplementedForUnitButNotNever` is implemented for `()` //[fallback]~| NOTE this error might have been caused + //[fallback]~| NOTE required by a bound introduced by this call //[fallback]~| HELP did you intend } diff --git a/src/test/ui/never_type/diverging-fallback-no-leak.fallback.stderr b/src/test/ui/never_type/diverging-fallback-no-leak.fallback.stderr index dee2b1d704b..3215c4669d5 100644 --- a/src/test/ui/never_type/diverging-fallback-no-leak.fallback.stderr +++ b/src/test/ui/never_type/diverging-fallback-no-leak.fallback.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `!: Test` is not satisfied - --> $DIR/diverging-fallback-no-leak.rs:17:5 + --> $DIR/diverging-fallback-no-leak.rs:17:23 | LL | unconstrained_arg(return); - | ^^^^^^^^^^^^^^^^^ the trait `Test` is not implemented for `!` + | ----------------- ^^^^^^ the trait `Test` is not implemented for `!` + | | + | required by a bound introduced by this call | = help: the following other types implement trait `Test`: () diff --git a/src/test/ui/never_type/feature-gate-never_type_fallback.stderr b/src/test/ui/never_type/feature-gate-never_type_fallback.stderr index 54abed38300..6a4726a8cc9 100644 --- a/src/test/ui/never_type/feature-gate-never_type_fallback.stderr +++ b/src/test/ui/never_type/feature-gate-never_type_fallback.stderr @@ -1,14 +1,19 @@ error[E0277]: the trait bound `(): T` is not satisfied - --> $DIR/feature-gate-never_type_fallback.rs:10:5 + --> $DIR/feature-gate-never_type_fallback.rs:10:9 | LL | foo(panic!()) - | ^^^ the trait `T` is not implemented for `()` + | --- ^^^^^^^^ + | | | + | | the trait `T` is not implemented for `()` + | | this tail expression is of type `_` + | required by a bound introduced by this call | note: required by a bound in `foo` --> $DIR/feature-gate-never_type_fallback.rs:13:16 | LL | fn foo(_: impl T) {} | ^ required by this bound in `foo` + = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/no-send-res-ports.stderr b/src/test/ui/no-send-res-ports.stderr index 249c2fe2fa7..c864b93dbbb 100644 --- a/src/test/ui/no-send-res-ports.stderr +++ b/src/test/ui/no-send-res-ports.stderr @@ -1,10 +1,17 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely - --> $DIR/no-send-res-ports.rs:25:5 + --> $DIR/no-send-res-ports.rs:25:19 | -LL | thread::spawn(move|| { - | ^^^^^^^^^^^^^ ------ within this `[closure@$DIR/no-send-res-ports.rs:25:19: 25:25]` - | | - | `Rc<()>` cannot be sent between threads safely +LL | thread::spawn(move|| { + | ------------- ^----- + | | | + | _____|_____________within this `[closure@$DIR/no-send-res-ports.rs:25:19: 25:25]` + | | | + | | required by a bound introduced by this call +LL | | +LL | | let y = x; +LL | | println!("{:?}", y); +LL | | }); + | |_____^ `Rc<()>` cannot be sent between threads safely | = help: within `[closure@$DIR/no-send-res-ports.rs:25:19: 25:25]`, the trait `Send` is not implemented for `Rc<()>` note: required because it appears within the type `Port<()>` diff --git a/src/test/ui/not-clone-closure.stderr b/src/test/ui/not-clone-closure.stderr index 37d94cf0ebd..f61ee661bb7 100644 --- a/src/test/ui/not-clone-closure.stderr +++ b/src/test/ui/not-clone-closure.stderr @@ -1,11 +1,13 @@ error[E0277]: the trait bound `S: Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]` - --> $DIR/not-clone-closure.rs:11:23 + --> $DIR/not-clone-closure.rs:11:17 | LL | let hello = move || { | ------- within this `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]` ... LL | let hello = hello.clone(); - | ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`, the trait `Clone` is not implemented for `S` + | ^^^^^ ----- required by a bound introduced by this call + | | + | within `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`, the trait `Clone` is not implemented for `S` | note: required because it's used within this closure --> $DIR/not-clone-closure.rs:7:17 diff --git a/src/test/ui/not-panic/not-panic-safe-2.stderr b/src/test/ui/not-panic/not-panic-safe-2.stderr index 43bb31afa6f..3b0f83b3b9a 100644 --- a/src/test/ui/not-panic/not-panic-safe-2.stderr +++ b/src/test/ui/not-panic/not-panic-safe-2.stderr @@ -1,8 +1,8 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-2.rs:10:5 + --> $DIR/not-panic-safe-2.rs:10:14 | LL | assert::<Rc<RefCell<i32>>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` = note: required because it appears within the type `RefCell<i32>` @@ -14,10 +14,10 @@ LL | fn assert<T: UnwindSafe + ?Sized>() {} | ^^^^^^^^^^ required by this bound in `assert` error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-2.rs:10:5 + --> $DIR/not-panic-safe-2.rs:10:14 | LL | assert::<Rc<RefCell<i32>>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>` = note: required because it appears within the type `Cell<isize>` diff --git a/src/test/ui/not-panic/not-panic-safe-3.stderr b/src/test/ui/not-panic/not-panic-safe-3.stderr index ef1d1baf58b..9e9a12764a4 100644 --- a/src/test/ui/not-panic/not-panic-safe-3.stderr +++ b/src/test/ui/not-panic/not-panic-safe-3.stderr @@ -1,8 +1,8 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-3.rs:10:5 + --> $DIR/not-panic-safe-3.rs:10:14 | LL | assert::<Arc<RefCell<i32>>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` = note: required because it appears within the type `RefCell<i32>` @@ -14,10 +14,10 @@ LL | fn assert<T: UnwindSafe + ?Sized>() {} | ^^^^^^^^^^ required by this bound in `assert` error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-3.rs:10:5 + --> $DIR/not-panic-safe-3.rs:10:14 | LL | assert::<Arc<RefCell<i32>>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>` = note: required because it appears within the type `Cell<isize>` diff --git a/src/test/ui/not-panic/not-panic-safe-4.stderr b/src/test/ui/not-panic/not-panic-safe-4.stderr index a398b44d339..fc1c594d0d4 100644 --- a/src/test/ui/not-panic/not-panic-safe-4.stderr +++ b/src/test/ui/not-panic/not-panic-safe-4.stderr @@ -1,8 +1,8 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-4.rs:9:5 + --> $DIR/not-panic-safe-4.rs:9:14 | LL | assert::<&RefCell<i32>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` = note: required because it appears within the type `RefCell<i32>` @@ -14,10 +14,10 @@ LL | fn assert<T: UnwindSafe + ?Sized>() {} | ^^^^^^^^^^ required by this bound in `assert` error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-4.rs:9:5 + --> $DIR/not-panic-safe-4.rs:9:14 | LL | assert::<&RefCell<i32>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>` = note: required because it appears within the type `Cell<isize>` diff --git a/src/test/ui/not-panic/not-panic-safe-5.stderr b/src/test/ui/not-panic/not-panic-safe-5.stderr index 9617d5dfde4..cb78370b48a 100644 --- a/src/test/ui/not-panic/not-panic-safe-5.stderr +++ b/src/test/ui/not-panic/not-panic-safe-5.stderr @@ -1,8 +1,8 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-5.rs:9:5 + --> $DIR/not-panic-safe-5.rs:9:14 | LL | assert::<*const UnsafeCell<i32>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` = note: required for `*const UnsafeCell<i32>` to implement `UnwindSafe` diff --git a/src/test/ui/not-panic/not-panic-safe-6.stderr b/src/test/ui/not-panic/not-panic-safe-6.stderr index 09204d942d2..7986e341eb0 100644 --- a/src/test/ui/not-panic/not-panic-safe-6.stderr +++ b/src/test/ui/not-panic/not-panic-safe-6.stderr @@ -1,8 +1,8 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-6.rs:9:5 + --> $DIR/not-panic-safe-6.rs:9:14 | LL | assert::<*mut RefCell<i32>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` = note: required because it appears within the type `RefCell<i32>` @@ -14,10 +14,10 @@ LL | fn assert<T: UnwindSafe + ?Sized>() {} | ^^^^^^^^^^ required by this bound in `assert` error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-6.rs:9:5 + --> $DIR/not-panic-safe-6.rs:9:14 | LL | assert::<*mut RefCell<i32>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary + | ^^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>` = note: required because it appears within the type `Cell<isize>` diff --git a/src/test/ui/on-unimplemented/multiple-impls.stderr b/src/test/ui/on-unimplemented/multiple-impls.stderr index 6e3601d7bf4..ad0cebb3736 100644 --- a/src/test/ui/on-unimplemented/multiple-impls.stderr +++ b/src/test/ui/on-unimplemented/multiple-impls.stderr @@ -11,6 +11,17 @@ LL | Index::index(&[] as &[i32], 2u32); <[i32] as Index<Bar<usize>>> <[i32] as Index<Foo<usize>>> +error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied + --> $DIR/multiple-impls.rs:33:5 + | +LL | Index::index(&[] as &[i32], 2u32); + | ^^^^^^^^^^^^ trait message + | + = help: the trait `Index<u32>` is not implemented for `[i32]` + = help: the following other types implement trait `Index<Idx>`: + <[i32] as Index<Bar<usize>>> + <[i32] as Index<Foo<usize>>> + error[E0277]: the trait bound `[i32]: Index<Foo<u32>>` is not satisfied --> $DIR/multiple-impls.rs:35:18 | @@ -24,6 +35,17 @@ LL | Index::index(&[] as &[i32], Foo(2u32)); <[i32] as Index<Bar<usize>>> <[i32] as Index<Foo<usize>>> +error[E0277]: the trait bound `[i32]: Index<Foo<u32>>` is not satisfied + --> $DIR/multiple-impls.rs:35:5 + | +LL | Index::index(&[] as &[i32], Foo(2u32)); + | ^^^^^^^^^^^^ on impl for Foo + | + = help: the trait `Index<Foo<u32>>` is not implemented for `[i32]` + = help: the following other types implement trait `Index<Idx>`: + <[i32] as Index<Bar<usize>>> + <[i32] as Index<Foo<usize>>> + error[E0277]: the trait bound `[i32]: Index<Bar<u32>>` is not satisfied --> $DIR/multiple-impls.rs:37:18 | @@ -37,6 +59,17 @@ LL | Index::index(&[] as &[i32], Bar(2u32)); <[i32] as Index<Bar<usize>>> <[i32] as Index<Foo<usize>>> -error: aborting due to 3 previous errors +error[E0277]: the trait bound `[i32]: Index<Bar<u32>>` is not satisfied + --> $DIR/multiple-impls.rs:37:5 + | +LL | Index::index(&[] as &[i32], Bar(2u32)); + | ^^^^^^^^^^^^ on impl for Bar + | + = help: the trait `Index<Bar<u32>>` is not implemented for `[i32]` + = help: the following other types implement trait `Index<Idx>`: + <[i32] as Index<Bar<usize>>> + <[i32] as Index<Foo<usize>>> + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/on-unimplemented/on-impl.stderr b/src/test/ui/on-unimplemented/on-impl.stderr index 396c062cfe2..769a3d77a57 100644 --- a/src/test/ui/on-unimplemented/on-impl.stderr +++ b/src/test/ui/on-unimplemented/on-impl.stderr @@ -9,6 +9,15 @@ LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32); = help: the trait `Index<u32>` is not implemented for `[i32]` = help: the trait `Index<usize>` is implemented for `[i32]` -error: aborting due to previous error +error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied + --> $DIR/on-impl.rs:22:5 + | +LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32); + | ^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice + | + = help: the trait `Index<u32>` is not implemented for `[i32]` + = help: the trait `Index<usize>` is implemented for `[i32]` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr b/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr index 85c9fe409db..a00f37ed606 100644 --- a/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr +++ b/src/test/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr @@ -107,10 +107,10 @@ LL | V = [Vec::new; { [0].len() ].len() as isize, | closing delimiter possibly meant for this error[E0282]: type annotations needed - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:29 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:26 | LL | V = [Vec::new; { [].len() ].len() as isize, - | ^^^ cannot infer type for type parameter `T` + | ^^ cannot infer type for type parameter `T` error[E0282]: type annotations needed --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:14 diff --git a/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr b/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr index d96e863939c..683162a5dae 100644 --- a/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr +++ b/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr @@ -8,7 +8,7 @@ LL | drop::<U>(_x1); | --- closure is `FnOnce` because it moves the variable `_x1` out of its environment ... LL | accept_fn_mut(&c1); - | ------------- the requirement to implement `FnMut` derives from here + | --- the requirement to implement `FnMut` derives from here error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` --> $DIR/move-ref-patterns-closure-captures.rs:9:14 @@ -20,7 +20,7 @@ LL | drop::<U>(_x1); | --- closure is `FnOnce` because it moves the variable `_x1` out of its environment ... LL | accept_fn(&c1); - | --------- the requirement to implement `Fn` derives from here + | --- the requirement to implement `Fn` derives from here error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut` --> $DIR/move-ref-patterns-closure-captures.rs:20:14 @@ -32,7 +32,7 @@ LL | drop::<&mut U>(_x2); | --- closure is `FnMut` because it mutates the variable `_x2` here ... LL | accept_fn(&c2); - | --------- the requirement to implement `Fn` derives from here + | --- the requirement to implement `Fn` derives from here error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.stderr index ec724cc9675..fddc8d37f2f 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.stderr @@ -1,14 +1,16 @@ error[E0277]: the trait bound `NonConstImpl: ~const ConstDefaultFn` is not satisfied - --> $DIR/const-default-method-bodies.rs:24:18 + --> $DIR/const-default-method-bodies.rs:24:5 | LL | NonConstImpl.a(); - | ^ the trait `~const ConstDefaultFn` is not implemented for `NonConstImpl` + | ^^^^^^^^^^^^ - required by a bound introduced by this call + | | + | the trait `~const ConstDefaultFn` is not implemented for `NonConstImpl` | note: the trait `ConstDefaultFn` is implemented for `NonConstImpl`, but that implementation is not `const` - --> $DIR/const-default-method-bodies.rs:24:18 + --> $DIR/const-default-method-bodies.rs:24:5 | LL | NonConstImpl.a(); - | ^ + | ^^^^^^^^^^^^ help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | const fn test() where NonConstImpl: ~const ConstDefaultFn { diff --git a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr index 174c62912fc..d4fa44b4bfc 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr @@ -1,14 +1,16 @@ error[E0277]: the trait bound `cross_crate::NonConst: ~const cross_crate::MyTrait` is not satisfied - --> $DIR/cross-crate.rs:17:14 + --> $DIR/cross-crate.rs:17:5 | LL | NonConst.func(); - | ^^^^ the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst` + | ^^^^^^^^ ---- required by a bound introduced by this call + | | + | the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst` | note: the trait `cross_crate::MyTrait` is implemented for `cross_crate::NonConst`, but that implementation is not `const` - --> $DIR/cross-crate.rs:17:14 + --> $DIR/cross-crate.rs:17:5 | LL | NonConst.func(); - | ^^^^ + | ^^^^^^^^ help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | const fn const_context() where cross_crate::NonConst: ~const cross_crate::MyTrait { diff --git a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr index 4619dd1138e..71ecd9b0694 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr @@ -1,14 +1,16 @@ error[E0277]: the trait bound `cross_crate::NonConst: cross_crate::MyTrait` is not satisfied - --> $DIR/cross-crate.rs:17:14 + --> $DIR/cross-crate.rs:17:5 | LL | NonConst.func(); - | ^^^^ the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst` + | ^^^^^^^^ ---- required by a bound introduced by this call + | | + | the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst` | note: the trait `cross_crate::MyTrait` is implemented for `cross_crate::NonConst`, but that implementation is not `const` - --> $DIR/cross-crate.rs:17:14 + --> $DIR/cross-crate.rs:17:5 | LL | NonConst.func(); - | ^^^^ + | ^^^^^^^^ help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | const fn const_context() where cross_crate::NonConst: ~const cross_crate::MyTrait { diff --git a/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr b/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr index b229053eb50..85285ba8497 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr @@ -1,14 +1,16 @@ error[E0277]: the trait bound `(): ~const Tr` is not satisfied - --> $DIR/default-method-body-is-const-same-trait-ck.rs:8:12 + --> $DIR/default-method-body-is-const-same-trait-ck.rs:8:9 | LL | ().a() - | ^ the trait `~const Tr` is not implemented for `()` + | ^^ - required by a bound introduced by this call + | | + | the trait `~const Tr` is not implemented for `()` | note: the trait `Tr` is implemented for `()`, but that implementation is not `const` - --> $DIR/default-method-body-is-const-same-trait-ck.rs:8:12 + --> $DIR/default-method-body-is-const-same-trait-ck.rs:8:9 | LL | ().a() - | ^ + | ^^ help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | pub trait Tr where (): ~const Tr { diff --git a/src/test/ui/str/str-idx.stderr b/src/test/ui/str/str-idx.stderr index 019305def29..6daa74657bd 100644 --- a/src/test/ui/str/str-idx.stderr +++ b/src/test/ui/str/str-idx.stderr @@ -29,6 +29,17 @@ LL | pub const fn get<I: ~const SliceIndex<str>>(&self, i: I) -> Option<&I:: | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get` error[E0277]: the type `str` cannot be indexed by `{integer}` + --> $DIR/str-idx.rs:4:15 + | +LL | let _ = s.get(4); + | ^^^ string indices are ranges of `usize` + | + = help: the trait `SliceIndex<str>` is not implemented for `{integer}` + = note: you can use `.chars().nth()` or `.bytes().nth()` + for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings> + = help: the trait `SliceIndex<[T]>` is implemented for `usize` + +error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-idx.rs:5:29 | LL | let _ = s.get_unchecked(4); @@ -46,6 +57,17 @@ note: required by a bound in `core::str::<impl str>::get_unchecked` LL | pub const unsafe fn get_unchecked<I: ~const SliceIndex<str>>(&self, i: I) -> &I::Output { | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_unchecked` +error[E0277]: the type `str` cannot be indexed by `{integer}` + --> $DIR/str-idx.rs:5:15 + | +LL | let _ = s.get_unchecked(4); + | ^^^^^^^^^^^^^ string indices are ranges of `usize` + | + = help: the trait `SliceIndex<str>` is not implemented for `{integer}` + = note: you can use `.chars().nth()` or `.bytes().nth()` + for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings> + = help: the trait `SliceIndex<[T]>` is implemented for `usize` + error[E0277]: the type `str` cannot be indexed by `char` --> $DIR/str-idx.rs:6:19 | @@ -55,6 +77,6 @@ LL | let _: u8 = s['c']; = help: the trait `SliceIndex<str>` is not implemented for `char` = note: required for `str` to implement `Index<char>` -error: aborting due to 4 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/str/str-mut-idx.stderr b/src/test/ui/str/str-mut-idx.stderr index b165c482590..d063088aded 100644 --- a/src/test/ui/str/str-mut-idx.stderr +++ b/src/test/ui/str/str-mut-idx.stderr @@ -53,6 +53,17 @@ LL | pub const fn get_mut<I: ~const SliceIndex<str>>(&mut self, i: I) -> Opt | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_mut` error[E0277]: the type `str` cannot be indexed by `{integer}` + --> $DIR/str-mut-idx.rs:9:7 + | +LL | s.get_mut(1); + | ^^^^^^^ string indices are ranges of `usize` + | + = help: the trait `SliceIndex<str>` is not implemented for `{integer}` + = note: you can use `.chars().nth()` or `.bytes().nth()` + for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings> + = help: the trait `SliceIndex<[T]>` is implemented for `usize` + +error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-mut-idx.rs:11:25 | LL | s.get_unchecked_mut(1); @@ -70,6 +81,17 @@ note: required by a bound in `core::str::<impl str>::get_unchecked_mut` LL | pub const unsafe fn get_unchecked_mut<I: ~const SliceIndex<str>>( | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_unchecked_mut` +error[E0277]: the type `str` cannot be indexed by `{integer}` + --> $DIR/str-mut-idx.rs:11:7 + | +LL | s.get_unchecked_mut(1); + | ^^^^^^^^^^^^^^^^^ string indices are ranges of `usize` + | + = help: the trait `SliceIndex<str>` is not implemented for `{integer}` + = note: you can use `.chars().nth()` or `.bytes().nth()` + for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings> + = help: the trait `SliceIndex<[T]>` is implemented for `usize` + error[E0277]: the type `str` cannot be indexed by `char` --> $DIR/str-mut-idx.rs:13:7 | @@ -79,6 +101,6 @@ LL | s['c']; = help: the trait `SliceIndex<str>` is not implemented for `char` = note: required for `str` to implement `Index<char>` -error: aborting due to 6 previous errors +error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr b/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr index ba6af8f15fa..864ab053520 100644 --- a/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr +++ b/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `for<'b> &'b S: Trait` is not satisfied - --> $DIR/imm-ref-trait-object-literal-bound-regions.rs:17:5 + --> $DIR/imm-ref-trait-object-literal-bound-regions.rs:17:14 | LL | foo::<S>(s); - | ^^^^^^^^ the trait `for<'b> Trait` is not implemented for `&'b S` + | -------- ^ the trait `for<'b> Trait` is not implemented for `&'b S` + | | + | required by a bound introduced by this call | = help: the trait `Trait` is implemented for `&'a mut S` = note: `for<'b> Trait` is implemented for `&'b mut S`, but not for `&'b S` diff --git a/src/test/ui/suggestions/issue-71394-no-from-impl.stderr b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr index a5e6f5b5ffc..684db23e135 100644 --- a/src/test/ui/suggestions/issue-71394-no-from-impl.stderr +++ b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `&[i8]: From<&[u8]>` is not satisfied - --> $DIR/issue-71394-no-from-impl.rs:3:25 + --> $DIR/issue-71394-no-from-impl.rs:3:20 | LL | let _: &[i8] = data.into(); - | ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]` + | ^^^^ ---- required by a bound introduced by this call + | | + | the trait `From<&[u8]>` is not implemented for `&[i8]` | = help: the following other types implement trait `From<T>`: <[T; LANES] as From<Simd<T, LANES>>> diff --git a/src/test/ui/suggestions/issue-84973-blacklist.stderr b/src/test/ui/suggestions/issue-84973-blacklist.stderr index ae0d3efca47..c20cc816484 100644 --- a/src/test/ui/suggestions/issue-84973-blacklist.stderr +++ b/src/test/ui/suggestions/issue-84973-blacklist.stderr @@ -31,10 +31,12 @@ LL | #[derive(Clone)] | error[E0277]: `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22]` cannot be unpinned - --> $DIR/issue-84973-blacklist.rs:17:5 + --> $DIR/issue-84973-blacklist.rs:17:13 | LL | f_unpin(static || { yield; }); - | ^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22]` + | ------- ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22]` + | | + | required by a bound introduced by this call | = note: consider using `Box::pin` note: required by a bound in `f_unpin` diff --git a/src/test/ui/suggestions/issue-84973.stderr b/src/test/ui/suggestions/issue-84973.stderr index 24c989ec3e8..ad855859908 100644 --- a/src/test/ui/suggestions/issue-84973.stderr +++ b/src/test/ui/suggestions/issue-84973.stderr @@ -1,11 +1,10 @@ error[E0277]: the trait bound `Fancy: SomeTrait` is not satisfied - --> $DIR/issue-84973.rs:6:24 + --> $DIR/issue-84973.rs:6:13 | LL | let o = Other::new(f); - | ---------- ^ expected an implementor of trait `SomeTrait` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^ the trait `SomeTrait` is not implemented for `Fancy` | + = help: the trait `SomeTrait` is implemented for `&'a Fancy` note: required by a bound in `Other::<'a, G>::new` --> $DIR/issue-84973.rs:25:8 | @@ -14,10 +13,6 @@ LL | G: SomeTrait, LL | { LL | pub fn new(g: G) -> Self { | --- required by a bound in this -help: consider borrowing here - | -LL | let o = Other::new(&f); - | + error: aborting due to previous error diff --git a/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr b/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr index d121932c842..420be973b72 100644 --- a/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr +++ b/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied - --> $DIR/mut-borrow-needed-by-trait.rs:17:29 + --> $DIR/mut-borrow-needed-by-trait.rs:17:14 | LL | let fp = BufWriter::new(fp); - | -------------- ^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write` | = note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write` note: required by a bound in `BufWriter::<W>::new` @@ -17,6 +15,19 @@ error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satis --> $DIR/mut-borrow-needed-by-trait.rs:17:14 | LL | let fp = BufWriter::new(fp); + | ^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write` + | + = note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write` +note: required by a bound in `BufWriter` + --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL + | +LL | pub struct BufWriter<W: Write> { + | ^^^^^ required by this bound in `BufWriter` + +error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied + --> $DIR/mut-borrow-needed-by-trait.rs:17:14 + | +LL | let fp = BufWriter::new(fp); | ^^^^^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write` | = note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write` @@ -42,7 +53,7 @@ LL | pub struct BufWriter<W: Write> { which is required by `BufWriter<&dyn std::io::Write>: std::io::Write` = note: this error originates in the macro `writeln` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors Some errors have detailed explanations: E0277, E0599. For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/suggestions/suggest-borrow-to-dyn-object.stderr b/src/test/ui/suggestions/suggest-borrow-to-dyn-object.stderr index 6b6e406130e..6ce9bfd9dca 100644 --- a/src/test/ui/suggestions/suggest-borrow-to-dyn-object.stderr +++ b/src/test/ui/suggestions/suggest-borrow-to-dyn-object.stderr @@ -2,9 +2,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation --> $DIR/suggest-borrow-to-dyn-object.rs:12:11 | LL | check(s); - | ----- ^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^ doesn't have a size known at compile-time | = help: within `OsStr`, the trait `Sized` is not implemented for `[u8]` = note: required because it appears within the type `OsStr` diff --git a/src/test/ui/suggestions/suggest-change-mut.stderr b/src/test/ui/suggestions/suggest-change-mut.stderr index 889b11a7410..671596fe455 100644 --- a/src/test/ui/suggestions/suggest-change-mut.stderr +++ b/src/test/ui/suggestions/suggest-change-mut.stderr @@ -1,29 +1,19 @@ error[E0277]: the trait bound `&T: std::io::Read` is not satisfied - --> $DIR/suggest-change-mut.rs:12:48 + --> $DIR/suggest-change-mut.rs:12:33 | LL | let mut stream_reader = BufReader::new(&stream); - | -------------- ^^^^^^^ the trait `std::io::Read` is not implemented for `&T` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^ the trait `std::io::Read` is not implemented for `&T` | + = note: `std::io::Read` is implemented for `&mut T`, but not for `&T` note: required by a bound in `BufReader::<R>::new` --> $SRC_DIR/std/src/io/buffered/bufreader.rs:LL:COL | LL | impl<R: Read> BufReader<R> { | ^^^^ required by this bound in `BufReader::<R>::new` -help: consider removing the leading `&`-reference - | -LL - let mut stream_reader = BufReader::new(&stream); -LL + let mut stream_reader = BufReader::new(stream); - | help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | fn issue_81421<T: Read + Write>(mut stream: T) where &T: std::io::Read { | +++++++++++++++++++++++ -help: consider changing this borrow's mutability - | -LL | let mut stream_reader = BufReader::new(&mut stream); - | ~~~~ error[E0599]: the method `read_until` exists for struct `BufReader<&T>`, but its trait bounds were not satisfied --> $DIR/suggest-change-mut.rs:16:23 diff --git a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-1.stderr b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-1.stderr index bfbbe7fd257..fa7a8a2a093 100644 --- a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-1.stderr +++ b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-1.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `str: Clone` is not satisfied - --> $DIR/check-trait-object-bounds-1.rs:12:5 + --> $DIR/check-trait-object-bounds-1.rs:12:9 | LL | f::<dyn X<Y = str>>(); - | ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` + | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` | = help: the trait `Clone` is implemented for `String` note: required by a bound in `f` diff --git a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr index 46e8ce78874..4084f69a6f0 100644 --- a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr +++ b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr @@ -1,8 +1,8 @@ error[E0277]: expected a `FnOnce<(&i32,)>` closure, found `i32` - --> $DIR/check-trait-object-bounds-2.rs:13:5 + --> $DIR/check-trait-object-bounds-2.rs:13:9 | LL | f::<dyn for<'x> X<'x, F = i32>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(&i32,)>` closure, found `i32` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(&i32,)>` closure, found `i32` | = help: the trait `for<'r> FnOnce<(&'r i32,)>` is not implemented for `i32` note: required by a bound in `f` diff --git a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-4.stderr b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-4.stderr index 3ca36d5d2ff..4891ee9c29f 100644 --- a/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-4.stderr +++ b/src/test/ui/traits/associated_type_bound/check-trait-object-bounds-4.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `str: Clone` is not satisfied - --> $DIR/check-trait-object-bounds-4.rs:15:5 + --> $DIR/check-trait-object-bounds-4.rs:15:9 | LL | f::<dyn X<Y = str>>(); - | ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` + | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` | = help: the trait `Clone` is implemented for `String` note: required by a bound in `f` diff --git a/src/test/ui/traits/bad-method-typaram-kind.stderr b/src/test/ui/traits/bad-method-typaram-kind.stderr index 8befa4c5f73..56acfbe80d0 100644 --- a/src/test/ui/traits/bad-method-typaram-kind.stderr +++ b/src/test/ui/traits/bad-method-typaram-kind.stderr @@ -1,8 +1,8 @@ error[E0277]: `T` cannot be sent between threads safely - --> $DIR/bad-method-typaram-kind.rs:2:7 + --> $DIR/bad-method-typaram-kind.rs:2:13 | LL | 1.bar::<T>(); - | ^^^ `T` cannot be sent between threads safely + | ^ `T` cannot be sent between threads safely | note: required by a bound in `Bar::bar` --> $DIR/bad-method-typaram-kind.rs:6:14 diff --git a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs index 5ba189aa82a..f9a93476411 100644 --- a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs +++ b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs @@ -2,7 +2,6 @@ fn strip_lf(s: &str) -> &str { s.strip_suffix(b'\n').unwrap_or(s) //~^ ERROR expected a `FnMut<(char,)>` closure, found `u8` //~| NOTE expected an `FnMut<(char,)>` closure, found `u8` - //~| NOTE required by a bound introduced by this call //~| HELP the trait `FnMut<(char,)>` is not implemented for `u8` //~| HELP the following other types implement trait `Pattern<'a>`: //~| NOTE required for `u8` to implement `Pattern<'_>` diff --git a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr index 41120c09fb1..ce9ab2d811a 100644 --- a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr +++ b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr @@ -1,10 +1,8 @@ error[E0277]: expected a `FnMut<(char,)>` closure, found `u8` - --> $DIR/assoc-fn-bound-root-obligation.rs:2:20 + --> $DIR/assoc-fn-bound-root-obligation.rs:2:7 | LL | s.strip_suffix(b'\n').unwrap_or(s) - | ------------ ^^^^^ expected an `FnMut<(char,)>` closure, found `u8` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^ expected an `FnMut<(char,)>` closure, found `u8` | = help: the trait `FnMut<(char,)>` is not implemented for `u8` = help: the following other types implement trait `Pattern<'a>`: diff --git a/src/test/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr b/src/test/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr index 57b2587ae5c..e8d90fb336e 100644 --- a/src/test/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr +++ b/src/test/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr @@ -13,7 +13,9 @@ error[E0283]: type annotations needed --> $DIR/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs:17:11 | LL | thing.method(42); - | ^^^^^^ + | ----- ^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `Thing<bool>: Method<_>` found --> $DIR/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs:7:1 diff --git a/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr b/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr index cab0ccdf710..28c7c85d484 100644 --- a/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr +++ b/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr @@ -1,18 +1,22 @@ error[E0277]: the trait bound `dyn CompareToInts: CompareTo<i32>` is not satisfied - --> $DIR/repeated-supertrait-ambig.rs:26:7 + --> $DIR/repeated-supertrait-ambig.rs:26:5 | LL | c.same_as(22) - | ^^^^^^^ the trait `CompareTo<i32>` is not implemented for `dyn CompareToInts` + | ^ ------- required by a bound introduced by this call + | | + | the trait `CompareTo<i32>` is not implemented for `dyn CompareToInts` | = help: the following other types implement trait `CompareTo<T>`: <i64 as CompareTo<i64>> <i64 as CompareTo<u64>> error[E0277]: the trait bound `C: CompareTo<i32>` is not satisfied - --> $DIR/repeated-supertrait-ambig.rs:30:7 + --> $DIR/repeated-supertrait-ambig.rs:30:5 | LL | c.same_as(22) - | ^^^^^^^ the trait `CompareTo<i32>` is not implemented for `C` + | ^ ------- required by a bound introduced by this call + | | + | the trait `CompareTo<i32>` is not implemented for `C` | help: consider further restricting this bound | @@ -30,10 +34,12 @@ LL | <dyn CompareToInts>::same_as(c, 22) <i64 as CompareTo<u64>> error[E0277]: the trait bound `C: CompareTo<i32>` is not satisfied - --> $DIR/repeated-supertrait-ambig.rs:38:5 + --> $DIR/repeated-supertrait-ambig.rs:38:24 | LL | CompareTo::same_as(c, 22) - | ^^^^^^^^^^^^^^^^^^ the trait `CompareTo<i32>` is not implemented for `C` + | ------------------ ^ the trait `CompareTo<i32>` is not implemented for `C` + | | + | required by a bound introduced by this call | help: consider further restricting this bound | @@ -41,10 +47,12 @@ LL | fn with_ufcs2<C:CompareToInts + CompareTo<i32>>(c: &C) -> bool { | ++++++++++++++++ error[E0277]: the trait bound `i64: CompareTo<i32>` is not satisfied - --> $DIR/repeated-supertrait-ambig.rs:42:23 + --> $DIR/repeated-supertrait-ambig.rs:42:16 | LL | assert_eq!(22_i64.same_as(22), true); - | ^^^^^^^ the trait `CompareTo<i32>` is not implemented for `i64` + | ^^^^^^ ------- required by a bound introduced by this call + | | + | the trait `CompareTo<i32>` is not implemented for `i64` | = help: the following other types implement trait `CompareTo<T>`: <i64 as CompareTo<i64>> diff --git a/src/test/ui/traits/issue-71136.stderr b/src/test/ui/traits/issue-71136.stderr index f541733929d..a8a46ec11c8 100644 --- a/src/test/ui/traits/issue-71136.stderr +++ b/src/test/ui/traits/issue-71136.stderr @@ -1,18 +1,14 @@ -error[E0277]: the trait bound `Foo: Clone` is not satisfied +error[E0277]: the trait bound `Vec<Foo>: Clone` is not satisfied --> $DIR/issue-71136.rs:5:5 | LL | #[derive(Clone)] | ----- in this derive macro expansion LL | struct FooHolster { LL | the_foos: Vec<Foo>, - | ^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `Foo` + | ^^^^^^^^^^^^^^^^^^ expected an implementor of trait `~const Clone` | = note: required for `Vec<Foo>` to implement `Clone` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider annotating `Foo` with `#[derive(Clone)]` - | -LL | #[derive(Clone)] - | error: aborting due to previous error diff --git a/src/test/ui/traits/issue-77982.stderr b/src/test/ui/traits/issue-77982.stderr index 2b832e27c52..b990cef318b 100644 --- a/src/test/ui/traits/issue-77982.stderr +++ b/src/test/ui/traits/issue-77982.stderr @@ -2,7 +2,9 @@ error[E0283]: type annotations needed --> $DIR/issue-77982.rs:8:10 | LL | opts.get(opt.as_ref()); - | ^^^ cannot infer type of the type parameter `Q` declared on the associated function `get` + | ^^^ ------------ type must be known at this point + | | + | cannot infer type of the type parameter `Q` declared on the associated function `get` | = note: multiple `impl`s satisfying `String: Borrow<_>` found in the following crates: `alloc`, `core`: - impl Borrow<str> for String; @@ -13,7 +15,7 @@ note: required by a bound in `HashMap::<K, V, S>::get` | LL | K: Borrow<Q>, | ^^^^^^^^^ required by this bound in `HashMap::<K, V, S>::get` -help: consider specifying the type argument in the function call +help: consider specifying the generic argument | LL | opts.get::<Q>(opt.as_ref()); | +++++ @@ -22,8 +24,9 @@ error[E0283]: type annotations needed --> $DIR/issue-77982.rs:8:10 | LL | opts.get(opt.as_ref()); - | ^^^ ------ type must be known at this point - | | + | ^^^ --- ------ required by a bound introduced by this call + | | | + | | type must be known at this point | cannot infer type of the type parameter `Q` declared on the associated function `get` | = note: multiple `impl`s satisfying `String: AsRef<_>` found in the following crates: `alloc`, `std`: @@ -59,7 +62,9 @@ error[E0283]: type annotations needed for `Box<T>` --> $DIR/issue-77982.rs:36:9 | LL | let _ = ().foo(); - | ^ --- type must be known at this point + | ^ -- --- required by a bound introduced by this call + | | + | type must be known at this point | note: multiple `impl`s satisfying `(): Foo<'_, _>` found --> $DIR/issue-77982.rs:29:1 @@ -77,7 +82,9 @@ error[E0283]: type annotations needed for `Box<T>` --> $DIR/issue-77982.rs:40:9 | LL | let _ = (&()).bar(); - | ^ --- type must be known at this point + | ^ ----- --- required by a bound introduced by this call + | | + | type must be known at this point | note: multiple `impl`s satisfying `&(): Bar<'_, _>` found --> $DIR/issue-77982.rs:32:1 diff --git a/src/test/ui/traits/issue-97576.stderr b/src/test/ui/traits/issue-97576.stderr index 9062a0fab63..146d38d076a 100644 --- a/src/test/ui/traits/issue-97576.stderr +++ b/src/test/ui/traits/issue-97576.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `String: From<impl ToString>` is not satisfied - --> $DIR/issue-97576.rs:8:22 + --> $DIR/issue-97576.rs:8:18 | LL | bar: bar.into(), - | ^^^^ the trait `From<impl ToString>` is not implemented for `String` + | ^^^ ---- required by a bound introduced by this call + | | + | the trait `From<impl ToString>` is not implemented for `String` | = note: required for `impl ToString` to implement `Into<String>` diff --git a/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr b/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr index cbec3593421..83fb04646c5 100644 --- a/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr +++ b/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr @@ -13,7 +13,9 @@ error[E0283]: type annotations needed --> $DIR/multidispatch-convert-ambig-dest.rs:26:5 | LL | test(22, std::default::Default::default()); - | ^^^^ cannot infer type of the type parameter `U` declared on the function `test` + | ^^^^ -- type must be known at this point + | | + | cannot infer type of the type parameter `U` declared on the function `test` | note: multiple `impl`s satisfying `i32: Convert<_>` found --> $DIR/multidispatch-convert-ambig-dest.rs:8:1 @@ -30,10 +32,10 @@ LL | fn test<T,U>(_: T, _: U) | ---- required by a bound in this LL | where T : Convert<U> | ^^^^^^^^^^ required by this bound in `test` -help: consider specifying the type arguments in the function call +help: consider specifying the generic arguments | -LL | test::<T, U>(22, std::default::Default::default()); - | ++++++++ +LL | test::<i32, U>(22, std::default::Default::default()); + | ++++++++++ error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr b/src/test/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr index 53178328c56..294af653475 100644 --- a/src/test/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr +++ b/src/test/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr @@ -13,7 +13,9 @@ error[E0283]: type annotations needed --> $DIR/not-suggest-non-existing-fully-qualified-path.rs:21:7 | LL | a.method(); - | ^^^^^^ + | - ^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `B: I<_>` found --> $DIR/not-suggest-non-existing-fully-qualified-path.rs:5:1 diff --git a/src/test/ui/traits/object/enforce-supertrait-projection.stderr b/src/test/ui/traits/object/enforce-supertrait-projection.stderr index cbf09386654..9e221daabe5 100644 --- a/src/test/ui/traits/object/enforce-supertrait-projection.stderr +++ b/src/test/ui/traits/object/enforce-supertrait-projection.stderr @@ -1,12 +1,14 @@ error[E0271]: type mismatch resolving `<dyn Trait<B = B, A = A> as SuperTrait>::A == B` - --> $DIR/enforce-supertrait-projection.rs:9:17 + --> $DIR/enforce-supertrait-projection.rs:9:42 | LL | fn transmute<A, B>(x: A) -> B { | - - expected type parameter | | | found type parameter LL | foo::<A, B, dyn Trait<A = A, B = B>>(x) - | ^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `B`, found type parameter `A` + | ------------------------------------ ^ expected type parameter `B`, found type parameter `A` + | | + | required by a bound introduced by this call | = note: expected type parameter `B` found type parameter `A` diff --git a/src/test/ui/traits/suggest-deferences/issue-39029.fixed b/src/test/ui/traits/suggest-deferences/issue-39029.fixed index a1abf668b8b..90d097105ed 100644 --- a/src/test/ui/traits/suggest-deferences/issue-39029.fixed +++ b/src/test/ui/traits/suggest-deferences/issue-39029.fixed @@ -13,6 +13,6 @@ impl std::ops::Deref for NoToSocketAddrs { fn main() { let _works = TcpListener::bind("some string"); let bad = NoToSocketAddrs("bad".to_owned()); - let _errors = TcpListener::bind(&*bad); + let _errors = TcpListener::bind(&bad); //~^ ERROR the trait bound `NoToSocketAddrs: ToSocketAddrs` is not satisfied } diff --git a/src/test/ui/traits/suggest-deferences/issue-39029.stderr b/src/test/ui/traits/suggest-deferences/issue-39029.stderr index eb2b88059d4..1317a8445f5 100644 --- a/src/test/ui/traits/suggest-deferences/issue-39029.stderr +++ b/src/test/ui/traits/suggest-deferences/issue-39029.stderr @@ -1,11 +1,21 @@ error[E0277]: the trait bound `NoToSocketAddrs: ToSocketAddrs` is not satisfied - --> $DIR/issue-39029.rs:16:37 + --> $DIR/issue-39029.rs:16:19 | LL | let _errors = TcpListener::bind(&bad); | ----------------- ^^^^ the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs` | | | required by a bound introduced by this call | + = help: the following other types implement trait `ToSocketAddrs`: + &'a [std::net::SocketAddr] + &T + (&str, u16) + (IpAddr, u16) + (Ipv4Addr, u16) + (Ipv6Addr, u16) + (String, u16) + SocketAddrV4 + and 4 others = note: required for `&NoToSocketAddrs` to implement `ToSocketAddrs` note: required by a bound in `TcpListener::bind` --> $SRC_DIR/std/src/net/tcp.rs:LL:COL diff --git a/src/test/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr b/src/test/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr index 68b31a1ca34..07f7bfb7cb4 100644 --- a/src/test/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr +++ b/src/test/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr @@ -13,7 +13,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:45:11 | LL | thing.method(); - | ^^^^^^ + | ----- ^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:10:1 @@ -32,7 +34,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:48:11 | LL | thing.mut_method(); - | ^^^^^^^^^^ + | ----- ^^^^^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:10:1 @@ -51,7 +55,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:49:11 | LL | thing.by_self(); - | ^^^^^^^ + | ----- ^^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `&Thing: MethodRef<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:22:1 @@ -70,7 +76,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:52:14 | LL | deref_to.method(); - | ^^^^^^ + | -------- ^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:10:1 @@ -89,7 +97,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:53:14 | LL | deref_to.mut_method(); - | ^^^^^^^^^^ + | -------- ^^^^^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:10:1 @@ -108,7 +118,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:54:14 | LL | deref_to.by_self(); - | ^^^^^^^ + | -------- ^^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `&Thing: MethodRef<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:22:1 @@ -127,7 +139,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:57:20 | LL | deref_deref_to.method(); - | ^^^^^^ + | -------------- ^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:10:1 @@ -146,7 +160,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:58:20 | LL | deref_deref_to.mut_method(); - | ^^^^^^^^^^ + | -------------- ^^^^^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:10:1 @@ -165,7 +181,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:59:20 | LL | deref_deref_to.by_self(); - | ^^^^^^^ + | -------------- ^^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `&Thing: MethodRef<_>` found --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:22:1 diff --git a/src/test/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr b/src/test/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr index 27518a54e75..bcc25e103b1 100644 --- a/src/test/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr +++ b/src/test/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr @@ -13,7 +13,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:45:15 | LL | ref_thing.method(); - | ^^^^^^ + | --------- ^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:10:1 @@ -32,7 +34,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:48:15 | LL | ref_thing.by_self(); - | ^^^^^^^ + | --------- ^^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `&Thing: MethodRef<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:23:1 @@ -51,7 +55,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:51:15 | LL | mut_thing.method(); - | ^^^^^^ + | --------- ^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:10:1 @@ -70,7 +76,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:52:15 | LL | mut_thing.mut_method(); - | ^^^^^^^^^^ + | --------- ^^^^^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:10:1 @@ -89,7 +97,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:53:15 | LL | mut_thing.by_self(); - | ^^^^^^^ + | --------- ^^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `&Thing: MethodRef<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:23:1 @@ -108,7 +118,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:56:14 | LL | deref_to.method(); - | ^^^^^^ + | -------- ^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:10:1 @@ -127,7 +139,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:57:14 | LL | deref_to.mut_method(); - | ^^^^^^^^^^ + | -------- ^^^^^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:10:1 @@ -146,7 +160,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:58:14 | LL | deref_to.by_self(); - | ^^^^^^^ + | -------- ^^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `&Thing: MethodRef<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:23:1 @@ -165,7 +181,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:61:20 | LL | deref_deref_to.method(); - | ^^^^^^ + | -------------- ^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:10:1 @@ -184,7 +202,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:62:20 | LL | deref_deref_to.mut_method(); - | ^^^^^^^^^^ + | -------------- ^^^^^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `Thing: Method<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:10:1 @@ -203,7 +223,9 @@ error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:63:20 | LL | deref_deref_to.by_self(); - | ^^^^^^^ + | -------------- ^^^^^^^ + | | + | type must be known at this point | note: multiple `impl`s satisfying `&Thing: MethodRef<_>` found --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:23:1 diff --git a/src/test/ui/traits/suggest-where-clause.stderr b/src/test/ui/traits/suggest-where-clause.stderr index d4d9b496747..747e2477b9c 100644 --- a/src/test/ui/traits/suggest-where-clause.stderr +++ b/src/test/ui/traits/suggest-where-clause.stderr @@ -19,13 +19,13 @@ LL + fn check<T: Iterator, U>() { | error[E0277]: the size for values of type `U` cannot be known at compilation time - --> $DIR/suggest-where-clause.rs:10:5 + --> $DIR/suggest-where-clause.rs:10:20 | LL | fn check<T: Iterator, U: ?Sized>() { | - this type parameter needs to be `std::marker::Sized` ... LL | mem::size_of::<Misc<U>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^^^^^ doesn't have a size known at compile-time | note: required because it appears within the type `Misc<U>` --> $DIR/suggest-where-clause.rs:3:8 diff --git a/src/test/ui/transmutability/references.stderr b/src/test/ui/transmutability/references.stderr index b1359ea5865..17ffcf64177 100644 --- a/src/test/ui/transmutability/references.stderr +++ b/src/test/ui/transmutability/references.stderr @@ -1,8 +1,8 @@ error[E0277]: `&'static Unit` cannot be safely transmuted into `&'static Unit` in the defining scope of `assert::Context`. - --> $DIR/references.rs:19:37 + --> $DIR/references.rs:19:52 | LL | assert::is_maybe_transmutable::<&'static Unit, &'static Unit>(); - | ^^^^^^^^^^^^^ `&'static Unit` cannot be safely transmuted into `&'static Unit` in the defining scope of `assert::Context`. + | ^^^^^^^^^^^^^ `&'static Unit` cannot be safely transmuted into `&'static Unit` in the defining scope of `assert::Context`. | = help: the trait `BikeshedIntrinsicFrom<&'static Unit, assert::Context, true, true, true, true>` is not implemented for `&'static Unit` note: required by a bound in `is_maybe_transmutable` diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr index 6bb5e1f5427..b9fca1a1b54 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr @@ -12,10 +12,10 @@ LL | fn is_sync<T: Sync>() {} | ^^^^ required by this bound in `is_sync` error[E0277]: `UnsafeCell<u8>` cannot be shared between threads safely - --> $DIR/typeck-default-trait-impl-negation-sync.rs:36:5 + --> $DIR/typeck-default-trait-impl-negation-sync.rs:36:15 | LL | is_sync::<MyTypeWUnsafe>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<u8>` cannot be shared between threads safely + | ^^^^^^^^^^^^^ `UnsafeCell<u8>` cannot be shared between threads safely | = help: within `MyTypeWUnsafe`, the trait `Sync` is not implemented for `UnsafeCell<u8>` note: required because it appears within the type `MyTypeWUnsafe` @@ -30,10 +30,10 @@ LL | fn is_sync<T: Sync>() {} | ^^^^ required by this bound in `is_sync` error[E0277]: `Managed` cannot be shared between threads safely - --> $DIR/typeck-default-trait-impl-negation-sync.rs:39:5 + --> $DIR/typeck-default-trait-impl-negation-sync.rs:39:15 | LL | is_sync::<MyTypeManaged>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ `Managed` cannot be shared between threads safely + | ^^^^^^^^^^^^^ `Managed` cannot be shared between threads safely | = help: within `MyTypeManaged`, the trait `Sync` is not implemented for `Managed` note: required because it appears within the type `MyTypeManaged` diff --git a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr index c6f9b3661a2..4f721f987ae 100644 --- a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -1,8 +1,10 @@ error[E0277]: cannot add `u32` to `i32` - --> $DIR/ufcs-qpath-self-mismatch.rs:4:5 + --> $DIR/ufcs-qpath-self-mismatch.rs:4:28 | LL | <i32 as Add<u32>>::add(1, 2); - | ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32` + | ---------------------- ^ no implementation for `i32 + u32` + | | + | required by a bound introduced by this call | = help: the trait `Add<u32>` is not implemented for `i32` = help: the following other types implement trait `Add<Rhs>`: diff --git a/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.stderr b/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.stderr index 9a24fb8c2be..d8e9776bb00 100644 --- a/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.stderr +++ b/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.stderr @@ -1,8 +1,10 @@ error[E0308]: mismatched types - --> $DIR/non-tupled-arg-mismatch.rs:6:5 + --> $DIR/non-tupled-arg-mismatch.rs:6:7 | LL | a(|_: usize| {}); - | ^ types differ + | - ^^^^^^^^^^^^^ types differ + | | + | required by a bound introduced by this call | = note: expected trait `Fn<usize>` found trait `Fn<(usize,)>` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr index 85ff49d61a3..4ea1ee3c37a 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr @@ -6,7 +6,7 @@ LL | let c = || drop(y.0); | | | this closure implements `FnOnce`, not `Fn` LL | foo(c); - | --- the requirement to implement `Fn` derives from here + | - the requirement to implement `Fn` derives from here error: aborting due to previous error diff --git a/src/test/ui/unsized-locals/unsized-exprs.stderr b/src/test/ui/unsized-locals/unsized-exprs.stderr index 6960255d987..a7f57e3fd15 100644 --- a/src/test/ui/unsized-locals/unsized-exprs.stderr +++ b/src/test/ui/unsized-locals/unsized-exprs.stderr @@ -12,9 +12,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation --> $DIR/unsized-exprs.rs:24:22 | LL | udrop::<A<[u8]>>(A { 0: *foo() }); - | ---------------- ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `A<[u8]>`, the trait `Sized` is not implemented for `[u8]` note: required because it appears within the type `A<[u8]>` diff --git a/src/test/ui/unsized/issue-30355.stderr b/src/test/ui/unsized/issue-30355.stderr index d7af558eef4..f5491552a45 100644 --- a/src/test/ui/unsized/issue-30355.stderr +++ b/src/test/ui/unsized/issue-30355.stderr @@ -2,9 +2,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation --> $DIR/issue-30355.rs:5:8 | LL | &X(*Y) - | - ^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` = help: unsized fn params are gated as an unstable feature diff --git a/src/test/ui/unsized/issue-71659.stderr b/src/test/ui/unsized/issue-71659.stderr index d7b95f55769..50060e53a49 100644 --- a/src/test/ui/unsized/issue-71659.stderr +++ b/src/test/ui/unsized/issue-71659.stderr @@ -1,8 +1,10 @@ error[E0277]: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied - --> $DIR/issue-71659.rs:30:15 + --> $DIR/issue-71659.rs:30:13 | LL | let x = x.cast::<[i32]>(); - | ^^^^ the trait `CastTo<[i32]>` is not implemented for `dyn Foo` + | ^ ---- required by a bound introduced by this call + | | + | the trait `CastTo<[i32]>` is not implemented for `dyn Foo` | note: required by a bound in `Cast::cast` --> $DIR/issue-71659.rs:19:15 diff --git a/src/test/ui/unsized/issue-75707.stderr b/src/test/ui/unsized/issue-75707.stderr index 7d0a2cb85b6..97618ed05ed 100644 --- a/src/test/ui/unsized/issue-75707.stderr +++ b/src/test/ui/unsized/issue-75707.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `MyCall: Callback` is not satisfied - --> $DIR/issue-75707.rs:15:5 + --> $DIR/issue-75707.rs:15:9 | LL | f::<dyn Processing<Call = MyCall>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Callback` is not implemented for `MyCall` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Callback` is not implemented for `MyCall` | note: required by a bound in `f` --> $DIR/issue-75707.rs:9:9 diff --git a/src/test/ui/unsized/unsized-fn-param.stderr b/src/test/ui/unsized/unsized-fn-param.stderr index 0221ef16b49..b4772605432 100644 --- a/src/test/ui/unsized/unsized-fn-param.stderr +++ b/src/test/ui/unsized/unsized-fn-param.stderr @@ -2,9 +2,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t --> $DIR/unsized-fn-param.rs:11:11 | LL | foo11("bar", &"baz"); - | ----- ^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` = note: required for the cast from `str` to the object type `dyn AsRef<Path>` @@ -17,9 +15,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t --> $DIR/unsized-fn-param.rs:13:19 | LL | foo12(&"bar", "baz"); - | ----- ^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` = note: required for the cast from `str` to the object type `dyn AsRef<Path>` @@ -32,9 +28,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t --> $DIR/unsized-fn-param.rs:16:11 | LL | foo21("bar", &"baz"); - | ----- ^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` = note: required for the cast from `str` to the object type `dyn AsRef<str>` @@ -47,9 +41,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t --> $DIR/unsized-fn-param.rs:18:19 | LL | foo22(&"bar", "baz"); - | ----- ^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` = note: required for the cast from `str` to the object type `dyn AsRef<str>` diff --git a/src/test/ui/unsized/unsized-struct.stderr b/src/test/ui/unsized/unsized-struct.stderr index c9510e92fec..dff1b0a5112 100644 --- a/src/test/ui/unsized/unsized-struct.stderr +++ b/src/test/ui/unsized/unsized-struct.stderr @@ -25,10 +25,10 @@ LL + fn foo2<T>() { not_sized::<Foo<T>>() } | error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/unsized-struct.rs:13:24 + --> $DIR/unsized-struct.rs:13:35 | LL | fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() } - | - ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | - ^^^^^^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` | diff --git a/src/test/ui/unsized/unsized3.stderr b/src/test/ui/unsized/unsized3.stderr index d64091b15eb..9ad1ac6b4df 100644 --- a/src/test/ui/unsized/unsized3.stderr +++ b/src/test/ui/unsized/unsized3.stderr @@ -79,14 +79,12 @@ LL | fn f5<Y: ?Sized>(x: &Y) {} | ++++++++ error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized3.rs:40:8 + --> $DIR/unsized3.rs:40:5 | LL | fn f9<X: ?Sized>(x1: Box<S<X>>) { | - this type parameter needs to be `std::marker::Sized` LL | f5(&(*x1, 34)); - | -- ^^^^^^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^ doesn't have a size known at compile-time | note: required because it appears within the type `S<X>` --> $DIR/unsized3.rs:28:8 @@ -106,9 +104,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim LL | fn f10<X: ?Sized>(x1: Box<S<X>>) { | - this type parameter needs to be `std::marker::Sized` LL | f5(&(32, *x1)); - | -- ^^^^^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call + | ^^^^^^^^^ doesn't have a size known at compile-time | note: required because it appears within the type `S<X>` --> $DIR/unsized3.rs:28:8 diff --git a/src/test/ui/where-clauses/where-clause-method-substituion.stderr b/src/test/ui/where-clauses/where-clause-method-substituion.stderr index f431deee73f..8c47ed6d431 100644 --- a/src/test/ui/where-clauses/where-clause-method-substituion.stderr +++ b/src/test/ui/where-clauses/where-clause-method-substituion.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `X: Foo<X>` is not satisfied - --> $DIR/where-clause-method-substituion.rs:20:7 + --> $DIR/where-clause-method-substituion.rs:20:16 | LL | 1.method::<X>(); - | ^^^^^^ the trait `Foo<X>` is not implemented for `X` + | ^ the trait `Foo<X>` is not implemented for `X` | note: required by a bound in `Bar::method` --> $DIR/where-clause-method-substituion.rs:6:34 diff --git a/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr index c13552bc26e..e90502977ff 100644 --- a/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr +++ b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `Bar: Eq` is not satisfied - --> $DIR/where-clauses-method-unsatisfied.rs:18:14 + --> $DIR/where-clauses-method-unsatisfied.rs:18:7 | LL | x.equals(&x); - | ------ ^^ the trait `Eq` is not implemented for `Bar` - | | - | required by a bound introduced by this call + | ^^^^^^ the trait `Eq` is not implemented for `Bar` | note: required by a bound in `Foo::<T>::equals` --> $DIR/where-clauses-method-unsatisfied.rs:11:52 |
