Rework point-at-arg

This commit is contained in:
Michael Goulet 2022-08-16 06:27:22 +00:00
parent fb80d2bfe4
commit c005e760f5
155 changed files with 1276 additions and 789 deletions

View File

@ -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");
}
}
}

View File

@ -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");

View File

@ -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),

View File

@ -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:

View File

@ -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;

View File

@ -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,
},
)

View File

@ -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>),

View File

@ -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) = (

View File

@ -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,

View File

@ -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) {

View File

@ -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

View File

@ -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>,

View File

@ -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)
};

View File

@ -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)
};

View File

@ -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,
) {

View File

@ -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;
}
'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;
}
// 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 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()
}
ObligationCauseCode::ImplDerivedObligation(code) => {
code.derived.parent_trait_pred.self_ty().skip_binder().into()
}
_ => 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,
}
})
}
continue 'outer;
}
}
// 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;
}
// 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;
}
}
for error in errors {
self.adjust_fulfillment_error_for_expr_obligation(error);
}
}
/// 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 adjust_fulfillment_error_for_expr_obligation(
&self,
errors: &mut Vec<traits::FulfillmentError<'tcx>>,
call_expr: &'tcx hir::Expr<'tcx>,
error: &mut traits::FulfillmentError<'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())
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
}
})
});
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 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;
}
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)
{
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;
}
return;
}
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;
}
}
}
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;
}
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;
}
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
}
_ => {}
}
}
fn point_at_args_if_possible(
&self,
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,

View File

@ -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,
) {

View File

@ -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));

View File

@ -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())

View File

@ -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((), (), (), ()) -> _`

View File

@ -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

View File

@ -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`

View File

@ -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

View File

@ -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`

View File

@ -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

View File

@ -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

View File

@ -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`

View File

@ -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`

View File

@ -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`

View File

@ -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

View File

@ -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`

View File

@ -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) -> _`

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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<_>`

View File

@ -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`

View File

@ -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>>

View File

@ -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>>

View File

@ -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`

View File

@ -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`

View File

@ -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`.

View File

@ -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>`

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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
}

View File

@ -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`

View File

@ -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
--> $DIR/not-send-sync.rs:9:17
|
LL | assert_sync(|| {
| ^^^^^^^^^^^ generator is not `Sync`
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

View File

@ -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

View File

@ -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`

View File

@ -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
--> $DIR/generator-print-verbose-2.rs:12:17
|
LL | assert_sync(|| {
| ^^^^^^^^^^^ generator is not `Sync`
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

View File

@ -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`

View File

@ -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,)`

View File

@ -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())
| +++++

View File

@ -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;

View File

@ -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`

View File

@ -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

View File

@ -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`

View File

@ -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

View File

@ -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<()>)`

View File

@ -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
}

View File

@ -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
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 | .cloned()
| ^^^^^^ expected reference, found `u8`
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

View File

@ -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 `(&_, &_)`

View File

@ -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>`

View File

@ -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

View File

@ -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]
}

View File

@ -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`.

View File

@ -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

View File

@ -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>`

View File

@ -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

View File

@ -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`.

View File

@ -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

View File

@ -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
}

View File

@ -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`

View File

@ -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);
}

View File

@ -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]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size
--> $DIR/collect-into-slice.rs:7:38
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();
| ^^^^^^^ try explicitly collecting into a `Vec<{integer}>`
| ^^^^^^^ 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:8:30
|
LL | let some_generated_vec = (0..10).collect();
| ^^^^^^^ ------- 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`.

View File

@ -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
|
@ -27,6 +35,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
|
@ -37,6 +53,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
|
@ -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`.

View File

@ -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

View File

@ -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`

View File

@ -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`

View File

@ -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`

View File

@ -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`

View File

@ -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`

View File

@ -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`

View File

@ -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

View File

@ -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) -> _`

View File

@ -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

View File

@ -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)) -> _`

View File

@ -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) -> _`

View File

@ -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`

View File

@ -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)

View File

@ -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
}

View File

@ -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`:
()

View File

@ -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

View File

@ -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<()>`

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More