提交 e3662105 编写于 作者: B bors

Auto merge of #88719 - estebank:point-at-arg-for-obligation, r=nagisa

Point at argument instead of call for their obligations

When an obligation is introduced by a specific `fn` argument, point at
the argument instead of the `fn` call if the obligation fails to be
fulfilled.

Move the information about pointing at the call argument expression in
an unmet obligation span from the `FulfillmentError` to a new
`ObligationCauseCode`.

When giving an error about an obligation introduced by a function call
that an argument doesn't fulfill, and that argument is a block, add a
span_label pointing at the innermost tail expression.

Current output:

```
error[E0425]: cannot find value `x` in this scope
 --> f10.rs:4:14
  |
4 |         Some(x * 2)
  |              ^ not found in this scope

error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>`
 --> f10.rs:2:31
  |
2 |       let p = Some(45).and_then({
  |  ______________________--------_^
  | |                      |
  | |                      required by a bound introduced by this call
3 | |         |x| println!("doubling {}", x);
4 | |         Some(x * 2)
  | |         -----------
5 | |     });
  | |_____^ expected an `FnOnce<({integer},)>` closure, found `Option<_>`
  |
  = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>`
```

Previous output:

```
error[E0425]: cannot find value `x` in this scope
 --> f10.rs:4:14
  |
4 |         Some(x * 2)
  |              ^ not found in this scope

error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>`
 --> f10.rs:2:22
  |
2 |     let p = Some(45).and_then({
  |                      ^^^^^^^^ expected an `FnOnce<({integer},)>` closure, found `Option<_>`
  |
  = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>`
```

Partially address #27300. Will require rebasing on top of #88546.
......@@ -1998,7 +1998,6 @@ fn check_rvalue(&mut self, body: &Body<'tcx>, rvalue: &Rvalue<'tcx>, location: L
&obligation,
&traits::SelectionError::Unimplemented,
false,
false,
);
}
}
......
......@@ -29,7 +29,13 @@ pub(super) fn try_report_mismatched_static_lifetime(&self) -> Option<ErrorReport
SubregionOrigin::Subtype(box TypeTrace { ref cause, .. }) => cause,
_ => return None,
};
let (parent, impl_def_id) = match &cause.code {
// If we added a "points at argument expression" obligation, we remove it here, we care
// about the original obligation only.
let code = match &cause.code {
ObligationCauseCode::FunctionArgumentObligation { parent_code, .. } => &*parent_code,
_ => &cause.code,
};
let (parent, impl_def_id) = match code {
ObligationCauseCode::MatchImpl(parent, impl_def_id) => (parent, impl_def_id),
_ => return None,
};
......
......@@ -66,10 +66,6 @@ pub struct Obligation<'tcx, T> {
pub struct FulfillmentError<'tcx> {
pub obligation: PredicateObligation<'tcx>,
pub code: FulfillmentErrorCode<'tcx>,
/// Diagnostics only: we opportunistically change the `code.span` when we encounter an
/// obligation error caused by a call argument. When this is the case, we also signal that in
/// this field to ensure accuracy of suggestions.
pub points_at_arg_span: bool,
/// Diagnostics only: the 'root' obligation which resulted in
/// the failure to process `obligation`. This is the obligation
/// that was initially passed to `register_predicate_obligation`
......@@ -128,7 +124,7 @@ pub fn new(
code: FulfillmentErrorCode<'tcx>,
root_obligation: PredicateObligation<'tcx>,
) -> FulfillmentError<'tcx> {
FulfillmentError { obligation, code, points_at_arg_span: false, root_obligation }
FulfillmentError { obligation, code, root_obligation }
}
}
......
......@@ -253,6 +253,15 @@ pub enum ObligationCauseCode<'tcx> {
DerivedObligation(DerivedObligationCause<'tcx>),
FunctionArgumentObligation {
/// The node of the relevant argument in the function call.
arg_hir_id: hir::HirId,
/// The node of the function call.
call_hir_id: hir::HirId,
/// The obligation introduced by this argument.
parent_code: Lrc<ObligationCauseCode<'tcx>>,
},
/// Error derived when matching traits/impls; see ObligationCause for more details
CompareImplConstObligation,
......@@ -368,11 +377,12 @@ impl ObligationCauseCode<'_> {
// Return the base obligation, ignoring derived obligations.
pub fn peel_derives(&self) -> &Self {
let mut base_cause = self;
while let BuiltinDerivedObligation(cause)
| ImplDerivedObligation(cause)
| DerivedObligation(cause) = base_cause
while let BuiltinDerivedObligation(DerivedObligationCause { parent_code, .. })
| ImplDerivedObligation(DerivedObligationCause { parent_code, .. })
| DerivedObligation(DerivedObligationCause { parent_code, .. })
| FunctionArgumentObligation { parent_code, .. } = base_cause
{
base_cause = &cause.parent_code;
base_cause = &parent_code;
}
base_cause
}
......
......@@ -57,7 +57,6 @@ fn select_all_or_error(
.map(|obligation| FulfillmentError {
obligation: obligation.clone(),
code: FulfillmentErrorCode::CodeAmbiguity,
points_at_arg_span: false,
// FIXME - does Chalk have a notation of 'root obligation'?
// This is just for diagnostics, so it's okay if this is wrong
root_obligation: obligation.clone(),
......@@ -112,7 +111,6 @@ fn select_where_possible(
code: FulfillmentErrorCode::CodeSelectionError(
SelectionError::Unimplemented,
),
points_at_arg_span: false,
// FIXME - does Chalk have a notation of 'root obligation'?
// This is just for diagnostics, so it's okay if this is wrong
root_obligation: obligation,
......@@ -129,7 +127,6 @@ fn select_where_possible(
code: FulfillmentErrorCode::CodeSelectionError(
SelectionError::Unimplemented,
),
points_at_arg_span: false,
// FIXME - does Chalk have a notation of 'root obligation'?
// This is just for diagnostics, so it's okay if this is wrong
root_obligation: obligation,
......
......@@ -66,7 +66,6 @@ fn report_selection_error(
root_obligation: &PredicateObligation<'tcx>,
error: &SelectionError<'tcx>,
fallback_has_occurred: bool,
points_at_arg: bool,
);
/// Given some node representing a fn-like thing in the HIR map,
......@@ -237,7 +236,6 @@ fn report_selection_error(
root_obligation: &PredicateObligation<'tcx>,
error: &SelectionError<'tcx>,
fallback_has_occurred: bool,
points_at_arg: bool,
) {
let tcx = self.tcx;
let mut span = obligation.cause.span;
......@@ -387,7 +385,6 @@ fn report_selection_error(
&obligation,
&mut err,
&trait_ref,
points_at_arg,
have_alt_message,
) {
self.note_obligation_cause(&mut err, &obligation);
......@@ -430,8 +427,8 @@ fn report_selection_error(
err.span_label(enclosing_scope_span, s.as_str());
}
self.suggest_dereferences(&obligation, &mut err, trait_ref, points_at_arg);
self.suggest_fn_call(&obligation, &mut err, trait_ref, points_at_arg);
self.suggest_dereferences(&obligation, &mut err, trait_ref);
self.suggest_fn_call(&obligation, &mut err, trait_ref);
self.suggest_remove_reference(&obligation, &mut err, trait_ref);
self.suggest_semicolon_removal(&obligation, &mut err, span, trait_ref);
self.note_version_mismatch(&mut err, &trait_ref);
......@@ -500,12 +497,7 @@ fn report_selection_error(
// Changing mutability doesn't make a difference to whether we have
// an `Unsize` impl (Fixes ICE in #71036)
if !is_unsize {
self.suggest_change_mut(
&obligation,
&mut err,
trait_ref,
points_at_arg,
);
self.suggest_change_mut(&obligation, &mut err, trait_ref);
}
// If this error is due to `!: Trait` not implemented but `(): Trait` is
......@@ -1214,7 +1206,6 @@ fn report_fulfillment_error(
&error.root_obligation,
selection_error,
fallback_has_occurred,
error.points_at_arg_span,
);
}
FulfillmentErrorCode::CodeProjectionError(ref e) => {
......
......@@ -9,6 +9,7 @@
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_data_structures::sync::Lrc;
use rustc_errors::{error_code, struct_span_err, Applicability, DiagnosticBuilder, Style};
use rustc_hir as hir;
use rustc_hir::def::DefKind;
......@@ -54,7 +55,6 @@ fn suggest_dereferences(
obligation: &PredicateObligation<'tcx>,
err: &mut DiagnosticBuilder<'tcx>,
trait_ref: ty::PolyTraitRef<'tcx>,
points_at_arg: bool,
);
fn get_closure_name(
......@@ -69,7 +69,6 @@ fn suggest_fn_call(
obligation: &PredicateObligation<'tcx>,
err: &mut DiagnosticBuilder<'_>,
trait_ref: ty::Binder<'tcx, ty::TraitRef<'tcx>>,
points_at_arg: bool,
);
fn suggest_add_reference_to_arg(
......@@ -77,7 +76,6 @@ fn suggest_add_reference_to_arg(
obligation: &PredicateObligation<'tcx>,
err: &mut DiagnosticBuilder<'_>,
trait_ref: &ty::Binder<'tcx, ty::TraitRef<'tcx>>,
points_at_arg: bool,
has_custom_message: bool,
) -> bool;
......@@ -93,7 +91,6 @@ fn suggest_change_mut(
obligation: &PredicateObligation<'tcx>,
err: &mut DiagnosticBuilder<'_>,
trait_ref: ty::Binder<'tcx, ty::TraitRef<'tcx>>,
points_at_arg: bool,
);
fn suggest_semicolon_removal(
......@@ -490,16 +487,19 @@ fn suggest_dereferences(
obligation: &PredicateObligation<'tcx>,
err: &mut DiagnosticBuilder<'tcx>,
trait_ref: ty::PolyTraitRef<'tcx>,
points_at_arg: bool,
) {
// It only make sense when suggesting dereferences for arguments
if !points_at_arg {
let code = if let ObligationCauseCode::FunctionArgumentObligation { parent_code, .. } =
&obligation.cause.code
{
parent_code.clone()
} else {
return;
}
};
let param_env = obligation.param_env;
let body_id = obligation.cause.body_id;
let span = obligation.cause.span;
let real_trait_ref = match &obligation.cause.code {
let real_trait_ref = match &*code {
ObligationCauseCode::ImplDerivedObligation(cause)
| ObligationCauseCode::DerivedObligation(cause)
| ObligationCauseCode::BuiltinDerivedObligation(cause) => cause.parent_trait_ref,
......@@ -584,7 +584,6 @@ fn suggest_fn_call(
obligation: &PredicateObligation<'tcx>,
err: &mut DiagnosticBuilder<'_>,
trait_ref: ty::Binder<'tcx, ty::TraitRef<'tcx>>,
points_at_arg: bool,
) {
let self_ty = match trait_ref.self_ty().no_bound_vars() {
None => return,
......@@ -656,11 +655,11 @@ fn suggest_fn_call(
}
_ => return,
};
if points_at_arg {
if matches!(obligation.cause.code, ObligationCauseCode::FunctionArgumentObligation { .. }) {
// When the obligation error has been ensured to have been caused by
// an argument, the `obligation.cause.span` points at the expression
// of the argument, so we can provide a suggestion. This is signaled
// by `points_at_arg`. Otherwise, we give a more general note.
// of the argument, so we can provide a suggestion. Otherwise, we give
// a more general note.
err.span_suggestion_verbose(
obligation.cause.span.shrink_to_hi(),
&msg,
......@@ -677,18 +676,21 @@ fn suggest_add_reference_to_arg(
obligation: &PredicateObligation<'tcx>,
err: &mut DiagnosticBuilder<'_>,
trait_ref: &ty::Binder<'tcx, ty::TraitRef<'tcx>>,
points_at_arg: bool,
has_custom_message: bool,
) -> bool {
let span = obligation.cause.span;
let points_at_for_iter = matches!(
span.ctxt().outer_expn_data().kind,
ExpnKind::Desugaring(DesugaringKind::ForLoop(ForLoopLoc::IntoIter))
);
if !points_at_arg && !points_at_for_iter {
let code = if let ObligationCauseCode::FunctionArgumentObligation { parent_code, .. } =
&obligation.cause.code
{
parent_code.clone()
} else if let ExpnKind::Desugaring(DesugaringKind::ForLoop(ForLoopLoc::IntoIter)) =
span.ctxt().outer_expn_data().kind
{
Lrc::new(obligation.cause.code.clone())
} else {
return false;
}
};
// List of traits for which it would be nonsensical to suggest borrowing.
// For instance, immutable references are always Copy, so suggesting to
......@@ -787,7 +789,7 @@ fn suggest_add_reference_to_arg(
return false;
};
if let ObligationCauseCode::ImplDerivedObligation(obligation) = &obligation.cause.code {
if let ObligationCauseCode::ImplDerivedObligation(obligation) = &*code {
let expected_trait_ref = obligation.parent_trait_ref.skip_binder();
let new_imm_trait_ref =
ty::TraitRef::new(obligation.parent_trait_ref.def_id(), imm_substs);
......@@ -799,7 +801,7 @@ fn suggest_add_reference_to_arg(
return try_borrowing(new_mut_trait_ref, expected_trait_ref, true, &[]);
}
} else if let ObligationCauseCode::BindingObligation(_, _)
| ObligationCauseCode::ItemObligation(_) = &obligation.cause.code
| ObligationCauseCode::ItemObligation(_) = &*code
{
if try_borrowing(
ty::TraitRef::new(trait_ref.def_id, imm_substs),
......@@ -891,8 +893,12 @@ fn suggest_change_mut(
obligation: &PredicateObligation<'tcx>,
err: &mut DiagnosticBuilder<'_>,
trait_ref: ty::Binder<'tcx, ty::TraitRef<'tcx>>,
points_at_arg: bool,
) {
let points_at_arg = matches!(
obligation.cause.code,
ObligationCauseCode::FunctionArgumentObligation { .. },
);
let span = obligation.cause.span;
if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) {
let refs_number =
......@@ -2289,6 +2295,56 @@ fn note_obligation_cause_code<T>(
)
});
}
ObligationCauseCode::FunctionArgumentObligation {
arg_hir_id,
call_hir_id,
ref parent_code,
} => {
let hir = self.tcx.hir();
if let Some(Node::Expr(expr @ hir::Expr { kind: hir::ExprKind::Block(..), .. })) =
hir.find(arg_hir_id)
{
let in_progress_typeck_results =
self.in_progress_typeck_results.map(|t| t.borrow());
let parent_id = hir.local_def_id(hir.get_parent_item(arg_hir_id));
let typeck_results: &TypeckResults<'tcx> = match &in_progress_typeck_results {
Some(t) if t.hir_owner == parent_id => t,
_ => self.tcx.typeck(parent_id),
};
let ty = typeck_results.expr_ty_adjusted(expr);
let span = expr.peel_blocks().span;
if Some(span) != err.span.primary_span() {
err.span_label(
span,
&if ty.references_error() {
String::new()
} else {
format!("this tail expression is of type `{:?}`", ty)
},
);
}
}
if let Some(Node::Expr(hir::Expr {
kind:
hir::ExprKind::Call(hir::Expr { span, .. }, _)
| hir::ExprKind::MethodCall(_, span, ..),
..
})) = hir.find(call_hir_id)
{
if Some(*span) != err.span.primary_span() {
err.span_label(*span, "required by a bound introduced by this call");
}
}
ensure_sufficient_stack(|| {
self.note_obligation_cause_code(
err,
predicate,
&parent_code,
obligated_types,
seen_requirements,
)
});
}
ObligationCauseCode::CompareImplMethodObligation {
item_name,
trait_item_def_id,
......
......@@ -72,7 +72,16 @@ pub fn check_call(
arg_exprs: &'tcx [hir::Expr<'tcx>],
expected: Expectation<'tcx>,
) -> Ty<'tcx> {
let original_callee_ty = self.check_expr(callee_expr);
let original_callee_ty = match &callee_expr.kind {
hir::ExprKind::Path(hir::QPath::Resolved(..) | hir::QPath::TypeRelative(..)) => self
.check_expr_with_expectation_and_args(
callee_expr,
Expectation::NoExpectation,
arg_exprs,
),
_ => self.check_expr(callee_expr),
};
let expr_ty = self.structurally_resolved_type(call_expr.span, original_callee_ty);
let mut autoderef = self.autoderef(callee_expr.span, expr_ty);
......
......@@ -707,13 +707,7 @@ fn coerce_unsized(&self, mut source: Ty<'tcx>, mut target: Ty<'tcx>) -> CoerceRe
// Object safety violations or miscellaneous.
Err(err) => {
self.report_selection_error(
obligation.clone(),
&obligation,
&err,
false,
false,
);
self.report_selection_error(obligation.clone(), &obligation, &err, false);
// Treat this like an obligation and follow through
// with the unsizing - the lack of a coercion should
// be silent, as it causes a type mismatch later.
......
......@@ -161,6 +161,17 @@ pub(super) fn check_expr_with_expectation(
&self,
expr: &'tcx hir::Expr<'tcx>,
expected: Expectation<'tcx>,
) -> Ty<'tcx> {
self.check_expr_with_expectation_and_args(expr, expected, &[])
}
/// Same as `check_expr_with_expectation`, but allows us to pass in the arguments of a
/// `ExprKind::Call` when evaluating its callee when it is an `ExprKind::Path`.
pub(super) fn check_expr_with_expectation_and_args(
&self,
expr: &'tcx hir::Expr<'tcx>,
expected: Expectation<'tcx>,
args: &'tcx [hir::Expr<'tcx>],
) -> Ty<'tcx> {
if self.tcx().sess.verbose() {
// make this code only run with -Zverbose because it is probably slow
......@@ -198,7 +209,12 @@ pub(super) fn check_expr_with_expectation(
let old_diverges = self.diverges.replace(Diverges::Maybe);
let old_has_errors = self.has_errors.replace(false);
let ty = ensure_sufficient_stack(|| self.check_expr_kind(expr, expected));
let ty = ensure_sufficient_stack(|| match &expr.kind {
hir::ExprKind::Path(
qpath @ hir::QPath::Resolved(..) | qpath @ hir::QPath::TypeRelative(..),
) => self.check_expr_path(qpath, expr, args),
_ => self.check_expr_kind(expr, expected),
});
// Warn for non-block expressions with diverging children.
match expr.kind {
......@@ -261,7 +277,7 @@ fn check_expr_kind(
ExprKind::Path(QPath::LangItem(lang_item, _)) => {
self.check_lang_item_path(lang_item, expr)
}
ExprKind::Path(ref qpath) => self.check_expr_path(qpath, expr),
ExprKind::Path(ref qpath) => self.check_expr_path(qpath, expr, &[]),
ExprKind::InlineAsm(asm) => self.check_expr_asm(asm),
ExprKind::LlvmInlineAsm(asm) => {
for expr in asm.outputs_exprs.iter().chain(asm.inputs_exprs.iter()) {
......@@ -481,10 +497,11 @@ fn check_lang_item_path(
self.resolve_lang_item_path(lang_item, expr.span, expr.hir_id).1
}
fn check_expr_path(
pub(crate) fn check_expr_path(
&self,
qpath: &'tcx hir::QPath<'tcx>,
expr: &'tcx hir::Expr<'tcx>,
args: &'tcx [hir::Expr<'tcx>],
) -> Ty<'tcx> {
let tcx = self.tcx;
let (res, opt_ty, segs) =
......@@ -517,16 +534,17 @@ fn check_expr_path(
// We just want to check sizedness, so instead of introducing
// placeholder lifetimes with probing, we just replace higher lifetimes
// with fresh vars.
let span = args.get(i).map(|a| a.span).unwrap_or(expr.span);
let input = self
.replace_bound_vars_with_fresh_vars(
expr.span,
span,
infer::LateBoundRegionConversionTime::FnCall,
fn_sig.input(i),
)
.0;
self.require_type_is_sized_deferred(
input,
expr.span,
span,
traits::SizedArgumentType(None),
);
}
......
......@@ -83,7 +83,15 @@ pub(in super::super) fn warn_if_unreachable(&self, id: hir::HirId, span: Span, k
/// version (resolve_vars_if_possible), this version will
/// also select obligations if it seems useful, in an effort
/// to get more type information.
pub(in super::super) fn resolve_vars_with_obligations(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> {
pub(in super::super) fn resolve_vars_with_obligations(&self, ty: Ty<'tcx>) -> Ty<'tcx> {
self.resolve_vars_with_obligations_and_mutate_fulfillment(ty, |_| {})
}
pub(in super::super) fn resolve_vars_with_obligations_and_mutate_fulfillment(
&self,
mut ty: Ty<'tcx>,
mutate_fulfillment_errors: impl Fn(&mut Vec<traits::FulfillmentError<'tcx>>),
) -> Ty<'tcx> {
debug!("resolve_vars_with_obligations(ty={:?})", ty);
// No Infer()? Nothing needs doing.
......@@ -103,7 +111,7 @@ pub(in super::super) fn resolve_vars_with_obligations(&self, mut ty: Ty<'tcx>) -
// possible. This can help substantially when there are
// indirect dependencies that don't seem worth tracking
// precisely.
self.select_obligations_where_possible(false, |_| {});
self.select_obligations_where_possible(false, mutate_fulfillment_errors);
ty = self.resolve_vars_if_possible(ty);
debug!("resolve_vars_with_obligations: ty={:?}", ty);
......
......@@ -9,6 +9,7 @@
};
use rustc_ast as ast;
use rustc_data_structures::sync::Lrc;
use rustc_errors::{Applicability, DiagnosticBuilder, DiagnosticId};
use rustc_hir as hir;
use rustc_hir::def::{CtorOf, DefKind, Res};
......@@ -324,6 +325,7 @@ pub(in super::super) fn check_argument_types(
self.point_at_arg_instead_of_call_if_possible(
errors,
&final_arg_types[..],
expr,
sp,
&args,
);
......@@ -354,8 +356,8 @@ pub(in super::super) fn check_argument_types(
continue;
}
debug!("checking the argument");
let formal_ty = formal_tys[i];
debug!("checking argument {}: {:?} = {:?}", i, arg, formal_ty);
// The special-cased logic below has three functions:
// 1. Provide as good of an expected type as possible.
......@@ -367,6 +369,42 @@ pub(in super::super) fn check_argument_types(
// to, which is `expected_ty` if `rvalue_hint` returns an
// `ExpectHasType(expected_ty)`, or the `formal_ty` otherwise.
let coerce_ty = expected.only_has_type(self).unwrap_or(formal_ty);
// Cause selection errors caused by resolving a single argument to point at the
// argument and not the call. This is otherwise redundant with the `demand_coerce`
// call immediately after, but it lets us customize the span pointed to in the
// fulfillment error to be more accurate.
let _ = self.resolve_vars_with_obligations_and_mutate_fulfillment(
coerce_ty,
|errors| {
// This is not coming from a macro or a `derive`.
if sp.desugaring_kind().is_none()
&& !arg.span.from_expansion()
// Do not change the spans of `async fn`s.
&& !matches!(
expr.kind,
hir::ExprKind::Call(
hir::Expr {
kind: hir::ExprKind::Path(hir::QPath::LangItem(_, _)),
..
},
_
)
) {
for error in errors {
error.obligation.cause.make_mut().span = arg.span;
let code = error.obligation.cause.code.clone();
error.obligation.cause.make_mut().code =
ObligationCauseCode::FunctionArgumentObligation {
arg_hir_id: arg.hir_id,
call_hir_id: expr.hir_id,
parent_code: Lrc::new(code),
};
}
}
},
);
// We're processing function arguments so we definitely want to use
// two-phase borrows.
self.demand_coerce(&arg, checked_ty, coerce_ty, None, AllowTwoPhase::Yes);
......@@ -907,6 +945,7 @@ fn point_at_arg_instead_of_call_if_possible(
&self,
errors: &mut Vec<traits::FulfillmentError<'tcx>>,
final_arg_types: &[(usize, Ty<'tcx>, Ty<'tcx>)],
expr: &'tcx hir::Expr<'tcx>,
call_sp: Span,
args: &'tcx [hir::Expr<'tcx>],
) {
......@@ -956,7 +995,13 @@ fn point_at_arg_instead_of_call_if_possible(
// 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.make_mut().span = args[ref_in].span;
error.points_at_arg_span = true;
let code = error.obligation.cause.code.clone();
error.obligation.cause.make_mut().code =
ObligationCauseCode::FunctionArgumentObligation {
arg_hir_id: args[ref_in].hir_id,
call_hir_id: expr.hir_id,
parent_code: Lrc::new(code),
};
}
}
}
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `<G as GetToInt>::R: ToInt` is not satisfied
--> $DIR/associated-types-bound-failure.rs:19:19
|
LL | ToInt::to_int(&g.get())
| ^^^^^^^^ the trait `ToInt` is not implemented for `<G as GetToInt>::R`
| ------------- ^^^^^^^^ the trait `ToInt` is not implemented for `<G as GetToInt>::R`
| |
| required by a bound introduced by this call
|
note: required by `ToInt::to_int`
--> $DIR/associated-types-bound-failure.rs:6:5
......
......@@ -28,13 +28,11 @@ pub fn f1_int_uint() {
pub fn f1_uint_uint() {
f1(2u32, 4u32);
//~^ ERROR `u32: Foo` is not satisfied
//~| ERROR `u32: Foo` is not satisfied
}
pub fn f1_uint_int() {
f1(2u32, 4i32);
//~^ ERROR `u32: Foo` is not satisfied
//~| ERROR `u32: Foo` is not satisfied
}
pub fn f2_int() {
......
......@@ -10,10 +10,12 @@ LL | f1(2i32, 4u32);
| ~~~
error[E0277]: the trait bound `u32: Foo` is not satisfied
--> $DIR/associated-types-path-2.rs:29:5
--> $DIR/associated-types-path-2.rs:29:14
|
LL | f1(2u32, 4u32);
| ^^ the trait `Foo` is not implemented for `u32`
| -- ^^^^ the trait `Foo` is not implemented for `u32`
| |
| required by a bound introduced by this call
|
note: required by a bound in `f1`
--> $DIR/associated-types-path-2.rs:13:14
......@@ -22,16 +24,12 @@ LL | pub fn f1<T: Foo>(a: T, x: T::A) {}
| ^^^ required by this bound in `f1`
error[E0277]: the trait bound `u32: Foo` is not satisfied
--> $DIR/associated-types-path-2.rs:29:5
|
LL | f1(2u32, 4u32);
| ^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `u32`
error[E0277]: the trait bound `u32: Foo` is not satisfied
--> $DIR/associated-types-path-2.rs:35:5
--> $DIR/associated-types-path-2.rs:34:14
|
LL | f1(2u32, 4i32);
| ^^ the trait `Foo` is not implemented for `u32`
| -- ^^^^ the trait `Foo` is not implemented for `u32`
| |
| required by a bound introduced by this call
|
note: required by a bound in `f1`
--> $DIR/associated-types-path-2.rs:13:14
......@@ -39,14 +37,8 @@ note: required by a bound in `f1`
LL | pub fn f1<T: Foo>(a: T, x: T::A) {}
| ^^^ required by this bound in `f1`
error[E0277]: the trait bound `u32: Foo` is not satisfied
--> $DIR/associated-types-path-2.rs:35:5
|
LL | f1(2u32, 4i32);
| ^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `u32`
error[E0308]: mismatched types
--> $DIR/associated-types-path-2.rs:41:18
--> $DIR/associated-types-path-2.rs:39:18
|
LL | let _: i32 = f2(2i32);
| --- ^^^^^^^^ expected `i32`, found `u32`
......@@ -58,7 +50,7 @@ help: you can convert a `u32` to an `i32` and panic if the converted value doesn
LL | let _: i32 = f2(2i32).try_into().unwrap();
| ++++++++++++++++++++
error: aborting due to 6 previous errors
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/issue-27675-unchecked-bounds.rs:15:31
|
LL | copy::<dyn Setup<From=T>>(t)
| ^ the trait `Copy` is not implemented for `T`
| ------------------------- ^ the trait `Copy` is not implemented for `T`
| |
| required by a bound introduced by this call
|
note: required by a bound in `copy`
--> $DIR/issue-27675-unchecked-bounds.rs:10:12
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `Option<&str>: AsRef<Path>` is not satisfied
--> $DIR/issue-72442.rs:12:36
|
LL | let mut f = File::open(path.to_str())?;
| ^^^^^^^^^^^^^ the trait `AsRef<Path>` is not implemented for `Option<&str>`
| ---------- ^^^^^^^^^^^^^ the trait `AsRef<Path>` is not implemented for `Option<&str>`
| |
| required by a bound introduced by this call
|
note: required by a bound in `File::open`
--> $SRC_DIR/std/src/fs.rs:LL:COL
......
......@@ -2,7 +2,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
--> $DIR/into-boxed-slice-fail.rs:7:35
|
LL | let _ = Box::into_boxed_slice(boxed_slice);
| ^^^^^^^^^^^ doesn't have a size known at compile-time
| --------------------- ^^^^^^^^^^^ doesn't have a size known at compile-time
| |
| required by a bound introduced by this call
|
= help: the trait `Sized` is not implemented for `[u8]`
note: required by `Box::<T, A>::into_boxed_slice`
......@@ -24,7 +26,9 @@ error[E0277]: the size for values of type `dyn Debug` cannot be known at compila
--> $DIR/into-boxed-slice-fail.rs:11:35
|
LL | let _ = Box::into_boxed_slice(boxed_trait);
| ^^^^^^^^^^^ doesn't have a size known at compile-time
| --------------------- ^^^^^^^^^^^ doesn't have a size known at compile-time
| |
| required by a bound introduced by this call
|
= help: the trait `Sized` is not implemented for `dyn Debug`
note: required by `Box::<T, A>::into_boxed_slice`
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `{float}: Bar` is not satisfied
--> $DIR/type_inference.rs:27:14
|
LL | only_bar(x);
| ^ the trait `Bar` is not implemented for `{float}`
| -------- ^ the trait `Bar` is not implemented for `{float}`
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<i32 as Bar>
......
......@@ -2,7 +2,9 @@ error[E0277]: expected a `FnOnce<()>` closure, found `{integer}`
--> $DIR/closure-expected.rs:3:23
|
LL | let y = x.or_else(4);
| ^ expected an `FnOnce<()>` closure, found `{integer}`
| ------- ^ expected an `FnOnce<()>` closure, found `{integer}`
| |
| required by a bound introduced by this call
|
= help: the trait `FnOnce<()>` is not implemented for `{integer}`
= note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }`
......
......@@ -2,7 +2,9 @@ error[E0277]: `F` cannot be shared between threads safely
--> $DIR/closure-bounds-subtype.rs:13:22
|
LL | take_const_owned(f);
| ^ `F` cannot be shared between threads safely
| ---------------- ^ `F` cannot be shared between threads safely
| |
| required by a bound introduced by this call
|
note: required by a bound in `take_const_owned`
--> $DIR/closure-bounds-subtype.rs:4:50
......
......@@ -2,7 +2,9 @@ error[E0277]: expected a `FnOnce<(&str,)>` closure, found `unsafe extern "rust-i
--> $DIR/coerce-unsafe-to-closure.rs:2:44
|
LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute);
| ^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(&str,)>` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
| --- ^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(&str,)>` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
| |
| required by a bound introduced by this call
|
= help: the trait `FnOnce<(&str,)>` is not implemented for `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `&dyn Trait: Trait` is not satisfied
--> $DIR/coherence-unsafe-trait-object-impl.rs:15:13
|
LL | takes_t(t);
| ^ the trait `Trait` is not implemented for `&dyn Trait`
| ------- ^ the trait `Trait` is not implemented for `&dyn Trait`
| |
| required by a bound introduced by this call
|
note: required by a bound in `takes_t`
--> $DIR/coherence-unsafe-trait-object-impl.rs:10:15
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `&str: X` is not satisfied
--> $DIR/issue-86530.rs:16:7
|
LL | z(" ");
| ^^^ the trait `X` is not implemented for `&str`
| - ^^^ the trait `X` is not implemented for `&str`
| |
| required by a bound introduced by this call
|
note: required by a bound in `z`
--> $DIR/issue-86530.rs:10:8
......
......@@ -2,10 +2,11 @@ error[E0277]: the trait bound `C: Copy` is not satisfied
--> $DIR/deriving-copyclone.rs:31:13
|
LL | is_copy(B { a: 1, b: C });
| ^^^^^^^^^^^^^^^^
| |
| expected an implementor of trait `Copy`
| help: consider borrowing here: `&B { a: 1, b: C }`
| ------- ^^^^^^^^^^^^^^^^
| | |
| | expected an implementor of trait `Copy`
| | help: consider borrowing here: `&B { a: 1, b: C }`
| required by a bound introduced by this call
|
note: required because of the requirements on the impl of `Copy` for `B<C>`
--> $DIR/deriving-copyclone.rs:9:10
......@@ -23,10 +24,11 @@ error[E0277]: the trait bound `C: Clone` is not satisfied
--> $DIR/deriving-copyclone.rs:32:14
|
LL | is_clone(B { a: 1, b: C });
| ^^^^^^^^^^^^^^^^
| |
| expected an implementor of trait `Clone`
| help: consider borrowing here: `&B { a: 1, b: C }`
| -------- ^^^^^^^^^^^^^^^^
| | |
| | expected an implementor of trait `Clone`
| | help: consider borrowing here: `&B { a: 1, b: C }`
| required by a bound introduced by this call
|
note: required because of the requirements on the impl of `Clone` for `B<C>`
--> $DIR/deriving-copyclone.rs:9:16
......@@ -44,10 +46,11 @@ error[E0277]: the trait bound `D: Copy` is not satisfied
--> $DIR/deriving-copyclone.rs:35:13
|
LL | is_copy(B { a: 1, b: D });
| ^^^^^^^^^^^^^^^^
| |
| expected an implementor of trait `Copy`
| help: consider borrowing here: `&B { a: 1, b: D }`
| ------- ^^^^^^^^^^^^^^^^
| | |
| | expected an implementor of trait `Copy`
| | help: consider borrowing here: `&B { a: 1, b: D }`
| required by a bound introduced by this call
|
note: required because of the requirements on the impl of `Copy` for `B<D>`
--> $DIR/deriving-copyclone.rs:9:10
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `i8: Foo<i32>` is not satisfied
--> $DIR/issue-39802-show-5-trait-impls.rs:24:21
|
LL | Foo::<i32>::bar(&1i8);
| ^^^^ the trait `Foo<i32>` is not implemented for `i8`
| --------------- ^^^^ the trait `Foo<i32>` is not implemented for `i8`
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<i8 as Foo<bool>>
......@@ -20,7 +22,9 @@ error[E0277]: the trait bound `u8: Foo<i32>` is not satisfied
--> $DIR/issue-39802-show-5-trait-impls.rs:25:21
|
LL | Foo::<i32>::bar(&1u8);
| ^^^^ the trait `Foo<i32>` is not implemented for `u8`
| --------------- ^^^^ the trait `Foo<i32>` is not implemented for `u8`
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<u8 as Foo<bool>>
......@@ -37,7 +41,9 @@ error[E0277]: the trait bound `bool: Foo<i32>` is not satisfied
--> $DIR/issue-39802-show-5-trait-impls.rs:26:21
|
LL | Foo::<i32>::bar(&true);
| ^^^^^ the trait `Foo<i32>` is not implemented for `bool`
| --------------- ^^^^^ the trait `Foo<i32>` is not implemented for `bool`
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<bool as Foo<bool>>
......
......@@ -16,7 +16,9 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied
--> $DIR/E0277.rs:15:15
|
LL | some_func(5i32);
| ^^^^ the trait `Foo` is not implemented for `i32`
| --------- ^^^^ the trait `Foo` is not implemented for `i32`
| |
| required by a bound introduced by this call
|
note: required by a bound in `some_func`
--> $DIR/E0277.rs:7:17
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `String: Copy` is not satisfied
--> $DIR/error-should-say-copy-not-pod.rs:6:17
|
LL | check_bound("nocopy".to_string());
| ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
| ----------- ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
| |
| required by a bound introduced by this call
|
note: required by a bound in `check_bound`
--> $DIR/error-should-say-copy-not-pod.rs:3:18
......
......@@ -5,10 +5,19 @@ LL | Some(x * 2)
| ^ not found in this scope
error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>`
--> $DIR/ruby_style_closure.rs:10:22
--> $DIR/ruby_style_closure.rs:10:31
|
LL | let p = Some(45).and_then({
| ^^^^^^^^ expected an `FnOnce<({integer},)>` closure, found `Option<_>`
LL | let p = Some(45).and_then({
| ______________________--------_^
| | |
| | required by a bound introduced by this call
LL | |
LL | | |x| println!("doubling {}", x);
LL | | Some(x * 2)
| | -----------
LL | |
LL | | });
| |_____^ expected an `FnOnce<({integer},)>` closure, found `Option<_>`
|
= help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>`
......
......@@ -2,7 +2,9 @@ error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() {f}`
--> $DIR/extern-wrong-value-type.rs:9:11
|
LL | is_fn(f);
| ^ expected an `Fn<()>` closure, found `extern "C" fn() {f}`
| ----- ^ expected an `Fn<()>` closure, found `extern "C" fn() {f}`
| |
| required by a bound introduced by this call
|
= help: the trait `Fn<()>` is not implemented for `extern "C" fn() {f}`
= note: wrap the `extern "C" fn() {f}` in a closure with no arguments: `|| { /* code */ }`
......
......@@ -12,10 +12,10 @@ LL | fn foo(x: &dyn Foo) {
| +
error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known at compilation time
--> $DIR/feature-gate-unsized_fn_params.rs:24:5
--> $DIR/feature-gate-unsized_fn_params.rs:24:9
|
LL | foo(*x);
| ^^^ doesn't have a size known at compile-time
| ^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `(dyn Foo + 'static)`
= note: all function arguments must have a statically known size
......
......@@ -35,7 +35,9 @@ error[E0277]: expected a `Fn<(isize,)>` closure, found `{integer}`
--> $DIR/fn-trait-formatting.rs:19:14
|
LL | needs_fn(1);
| ^ expected an `Fn<(isize,)>` closure, found `{integer}`
| -------- ^ expected an `Fn<(isize,)>` closure, found `{integer}`
| |
| required by a bound introduced by this call
|
= help: the trait `Fn<(isize,)>` is not implemented for `{integer}`
note: required by a bound in `needs_fn`
......
......@@ -2,7 +2,9 @@ error[E0277]: `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6]` cannot b
--> $DIR/static-not-unpin.rs:14:18
|
LL | assert_unpin(generator);
| ^^^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6]`
| ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6]`
| |
| required by a bound introduced by this call
|
= note: consider using `Box::pin`
note: required by a bound in `assert_unpin`
......
error[E0631]: type mismatch in closure arguments
--> $DIR/issue-62529-1.rs:80:10
|
LL | task(annotate(
| ^^^^^^^^ expected signature of `for<'r> fn(<RefMutFamily<usize> as FamilyLt<'r>>::Out) -> _`
...
LL | |value: &mut usize| {
| ------------------- found signature of `for<'r> fn(&'r mut usize) -> _`
LL | task(annotate(
| _____----_^
| | |
| | required by a bound introduced by this call
LL | |
LL | |
LL | | Annotate::<RefMutFamily<usize>>::new(),
LL | | |value: &mut usize| {
| | ------------------- found signature of `for<'r> fn(&'r mut usize) -> _`
LL | | *value = 2;
LL | | }
LL | | ));
| |_____^ expected signature of `for<'r> fn(<RefMutFamily<usize> as FamilyLt<'r>>::Out) -> _`
|
note: required by a bound in `annotate`
--> $DIR/issue-62529-1.rs:44:8
......@@ -20,7 +28,9 @@ error[E0277]: the size for values of type `impl Execute` cannot be known at comp
--> $DIR/issue-62529-1.rs:80:10
|
LL | task(annotate(
| __________^
| _____----_^
| | |
| | required by a bound introduced by this call
LL | |
LL | |
LL | | Annotate::<RefMutFamily<usize>>::new(),
......@@ -44,7 +54,9 @@ error[E0277]: the trait bound `impl Execute: Execute` is not satisfied
--> $DIR/issue-62529-1.rs:80:10
|
LL | task(annotate(
| __________^
| _____----_^
| | |
| | required by a bound introduced by this call
LL | |
LL | |
LL | | Annotate::<RefMutFamily<usize>>::new(),
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied
--> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:47:26
|
LL | want_bar_for_any_ccx(b);
| ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B`
| -------------------- ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B`
| |
| required by a bound introduced by this call
|
note: required by a bound in `want_bar_for_any_ccx`
--> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:32:15
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `for<'tcx> F: Foo<'tcx>` is not satisfied
--> $DIR/hrtb-higher-ranker-supertraits.rs:18:26
|
LL | want_foo_for_any_tcx(f);
| ^ the trait `for<'tcx> Foo<'tcx>` is not implemented for `F`
| -------------------- ^ the trait `for<'tcx> Foo<'tcx>` is not implemented for `F`
| |
| required by a bound introduced by this call
|
note: required by a bound in `want_foo_for_any_tcx`
--> $DIR/hrtb-higher-ranker-supertraits.rs:22:15
......@@ -20,7 +22,9 @@ error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied
--> $DIR/hrtb-higher-ranker-supertraits.rs:35:26
|
LL | want_bar_for_any_ccx(b);
| ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B`
| -------------------- ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B`
| |
| required by a bound introduced by this call
|
note: required by a bound in `want_bar_for_any_ccx`
--> $DIR/hrtb-higher-ranker-supertraits.rs:39:15
......
......@@ -4,5 +4,4 @@
fn main() {
(|| Box::new(*(&[0][..])))();
//~^ ERROR the size for values of type
//~| ERROR the size for values of type
}
......@@ -2,7 +2,9 @@ error[E0277]: the size for values of type `[{integer}]` cannot be known at compi
--> $DIR/issue-17651.rs:5:18
|
LL | (|| Box::new(*(&[0][..])))();
| ^^^^^^^^^^^ doesn't have a size known at compile-time
| -------- ^^^^^^^^^^^ doesn't have a size known at compile-time
| |
| required by a bound introduced by this call
|
= help: the trait `Sized` is not implemented for `[{integer}]`
note: required by `Box::<T>::new`
......@@ -11,16 +13,6 @@ note: required by `Box::<T>::new`
LL | pub fn new(x: T) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time
--> $DIR/issue-17651.rs:5:9
|
LL | (|| Box::new(*(&[0][..])))();
| ^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[{integer}]`
= note: all function arguments must have a statically known size
= help: unsized fn params are gated as an unstable feature
error: aborting due to 2 previous errors
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.
......@@ -2,7 +2,9 @@ error[E0277]: expected a `FnMut<(_, char)>` closure, found `()`
--> $DIR/issue-23966.rs:2:32
|
LL | "".chars().fold(|_, _| (), ());
| ^^ expected an `FnMut<(_, char)>` closure, found `()`
| ---- ^^ expected an `FnMut<(_, char)>` closure, found `()`
| |
| required by a bound introduced by this call
|
= help: the trait `FnMut<(_, char)>` is not implemented for `()`
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `(): InOut<_>` is not satisfied
--> $DIR/issue-25076.rs:10:20
|
LL | do_fold(bot(), ());
| ^^ the trait `InOut<_>` is not implemented for `()`
| ------- ^^ the trait `InOut<_>` is not implemented for `()`
| |
| required by a bound introduced by this call
|
note: required by a bound in `do_fold`
--> $DIR/issue-25076.rs:5:18
......
......@@ -2,7 +2,9 @@ error[E0277]: `()` is not an iterator
--> $DIR/issue-28098.rs:2:28
|
LL | let _ = Iterator::next(&mut ());
| ^^^^^^^ `()` is not an iterator
| -------------- ^^^^^^^ `()` is not an iterator
| |
| required by a bound introduced by this call
|
= help: the trait `Iterator` is not implemented for `()`
note: required by `std::iter::Iterator::next`
......@@ -29,7 +31,9 @@ error[E0277]: `()` is not an iterator
--> $DIR/issue-28098.rs:9:28
|
LL | let _ = Iterator::next(&mut ());
| ^^^^^^^ `()` is not an iterator
| -------------- ^^^^^^^ `()` is not an iterator
| |
| required by a bound introduced by this call
|
= help: the trait `Iterator` is not implemented for `()`
note: required by `std::iter::Iterator::next`
......@@ -50,7 +54,9 @@ error[E0277]: `()` is not an iterator
--> $DIR/issue-28098.rs:18:28
|
LL | let _ = Iterator::next(&mut ());
| ^^^^^^^ `()` is not an iterator
| -------------- ^^^^^^^ `()` is not an iterator
| |
| required by a bound introduced by this call
|
= help: the trait `Iterator` is not implemented for `()`
note: required by `std::iter::Iterator::next`
......@@ -63,7 +69,9 @@ error[E0277]: `()` is not an iterator
--> $DIR/issue-28098.rs:22:28
|
LL | let _ = Iterator::next(&mut ());
| ^^^^^^^ `()` is not an iterator
| -------------- ^^^^^^^ `()` is not an iterator
| |
| required by a bound introduced by this call
|
= help: the trait `Iterator` is not implemented for `()`
note: required by `std::iter::Iterator::next`
......
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> $DIR/issue-30355.rs:5:6
--> $DIR/issue-30355.rs:5:8
|
LL | &X(*Y)
| ^ doesn't have a size known at compile-time
| ^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
= note: all function arguments must have a statically known size
......
......@@ -4,7 +4,9 @@ error[E0593]: function is expected to take a single 0-tuple as argument, but it
LL | fn f(&self, _: ()) {
| ------------------ takes 2 distinct arguments
LL | None::<()>.map(Self::f);
| ^^^^^^^ expected function that takes a single 0-tuple as argument
| --- ^^^^^^^ expected function that takes a single 0-tuple as argument
| |
| required by a bound introduced by this call
error: aborting due to previous error
......
......@@ -5,7 +5,9 @@ LL | pub fn new(foo: Option<i32>, _: ()) -> Foo {
| ------------------------------------------ takes 2 arguments
...
LL | self.foo.map(Foo::new)
| ^^^^^^^^ expected function that takes 1 argument
| --- ^^^^^^^^ expected function that takes 1 argument
| |
| required by a bound introduced by this call
error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
--> $DIR/issue-47706.rs:27:9
......@@ -14,7 +16,9 @@ LL | Bar(i32),
| -------- takes 1 argument
...
LL | foo(Qux::Bar);
| ^^^^^^^^ expected function that takes 0 arguments
| --- ^^^^^^^^ expected function that takes 0 arguments
| |
| required by a bound introduced by this call
|
note: required by a bound in `foo`
--> $DIR/issue-47706.rs:22:8
......
......@@ -2,7 +2,9 @@ error[E0277]: expected a `Fn<(_,)>` closure, found `impl Fn<(((_, _), _),)>`
--> $DIR/issue-59494.rs:21:22
|
LL | let t8 = t8n(t7, t7p(f, g));
| ^^^^^^^^^ expected an `Fn<(_,)>` closure, found `impl Fn<(((_, _), _),)>`
| --- ^^^^^^^^^ expected an `Fn<(_,)>` closure, found `impl Fn<(((_, _), _),)>`
| |
| required by a bound introduced by this call
|
= help: the trait `Fn<(_,)>` is not implemented for `impl Fn<(((_, _), _),)>`
note: required by a bound in `t8n`
......
error[E0277]: the trait bound `&u32: Foo` is not satisfied
--> $DIR/issue-60218.rs:18:5
--> $DIR/issue-60218.rs:18:27
|
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
|
note: required by a bound in `trigger_error`
--> $DIR/issue-60218.rs:13:72
......
......@@ -2,10 +2,11 @@ error[E0631]: type mismatch in function arguments
--> $DIR/issue-60283.rs:17:13
|
LL | foo((), drop)
| ^^^^
| |
| expected signature of `for<'a> fn(<() as Trait<'a>>::Item) -> _`
| found signature of `fn(()) -> _`
| --- ^^^^
| | |
| | expected signature of `for<'a> fn(<() as Trait<'a>>::Item) -> _`
| | found signature of `fn(()) -> _`
| required by a bound introduced by this call
|
note: required by a bound in `foo`
--> $DIR/issue-60283.rs:12:16
......@@ -20,7 +21,9 @@ error[E0277]: the size for values of type `<() as Trait<'_>>::Item` cannot be kn
--> $DIR/issue-60283.rs:17:13
|
LL | foo((), drop)
| ^^^^ doesn't have a size known at compile-time
| --- ^^^^ doesn't have a size known at compile-time
| |
| required by a bound introduced by this call
|
= help: the trait `Sized` is not implemented for `<() as Trait<'_>>::Item`
note: required by a bound in `std::mem::drop`
......
......@@ -8,7 +8,9 @@ error[E0277]: the trait bound `(): _Func<_>` is not satisfied
--> $DIR/issue-66353.rs:12:41
|
LL | _Func::< <() as _A>::AssocT >::func(());
| ^^ the trait `_Func<_>` is not implemented for `()`
| ----------------------------------- ^^ the trait `_Func<_>` is not implemented for `()`
| |
| required by a bound introduced by this call
|
note: required by `_Func::func`
--> $DIR/issue-66353.rs:4:5
......
......@@ -20,7 +20,9 @@ error[E0277]: the size for values of type `[i32]` cannot be known at compilation
--> $DIR/issue-87199.rs:18:22
|
LL | ref_arg::<[i32]>(&[5]);
| ^^^^ doesn't have a size known at compile-time
| ---------------- ^^^^ doesn't have a size known at compile-time
| |
| required by a bound introduced by this call
|
= help: the trait `Sized` is not implemented for `[i32]`
note: required by a bound in `ref_arg`
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied
--> $DIR/kindck-impl-type-params-2.rs:13:16
|
LL | take_param(&x);
| ^^ the trait `Copy` is not implemented for `Box<{integer}>`
| ---------- ^^ the trait `Copy` is not implemented for `Box<{integer}>`
| |
| required by a bound introduced by this call
|
note: required because of the requirements on the impl of `Foo` for `Box<{integer}>`
--> $DIR/kindck-impl-type-params-2.rs:6:14
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied
--> $DIR/kindck-inherited-copy-bound.rs:21:16
|
LL | take_param(&x);
| ^^ the trait `Copy` is not implemented for `Box<{integer}>`
| ---------- ^^ the trait `Copy` is not implemented for `Box<{integer}>`
| |
| required by a bound introduced by this call
|
note: required because of the requirements on the impl of `Foo` for `Box<{integer}>`
--> $DIR/kindck-inherited-copy-bound.rs:14:14
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied
--> $DIR/kindck-inherited-copy-bound.rs:21:16
|
LL | take_param(&x);
| ^^ the trait `Copy` is not implemented for `Box<{integer}>`
| ---------- ^^ the trait `Copy` is not implemented for `Box<{integer}>`
| |
| required by a bound introduced by this call
|
note: required because of the requirements on the impl of `Foo` for `Box<{integer}>`
--> $DIR/kindck-inherited-copy-bound.rs:14:14
......
......@@ -33,7 +33,9 @@ LL | fn f(_: u64) {}
| ------------ found signature of `fn(u64) -> _`
...
LL | foo(f);
| ^ expected signature of `fn(usize) -> _`
| --- ^ expected signature of `fn(usize) -> _`
| |
| required by a bound introduced by this call
|
note: required by a bound in `foo`
--> $DIR/E0631.rs:3:11
......@@ -48,7 +50,9 @@ LL | fn f(_: u64) {}
| ------------ found signature of `fn(u64) -> _`
...
LL | bar(f);
| ^ expected signature of `fn(usize) -> _`
| --- ^ expected signature of `fn(usize) -> _`
| |
| required by a bound introduced by this call
|
note: required by a bound in `bar`
--> $DIR/E0631.rs:4:11
......
......@@ -119,7 +119,9 @@ error[E0593]: function is expected to take a single 2-tuple as argument, but it
--> $DIR/closure-arg-count.rs:24:57
|
LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(foo);
| ^^^ expected function that takes a single 2-tuple as argument
| --- ^^^ expected function that takes a single 2-tuple as argument
| |
| required by a bound introduced by this call
...
LL | fn foo() {}
| -------- takes 0 arguments
......@@ -130,13 +132,17 @@ error[E0593]: closure is expected to take a single 2-tuple as argument, but it t
LL | let bar = |i, x, y| i;
| --------- takes 3 distinct arguments
LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(bar);
| ^^^ expected closure that takes a single 2-tuple as argument
| --- ^^^ expected closure that takes a single 2-tuple as argument
| |
| required by a bound introduced by this call
error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
--> $DIR/closure-arg-count.rs:29:57
|
LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(qux);
| ^^^ expected function that takes a single 2-tuple as argument
| --- ^^^ expected function that takes a single 2-tuple as argument
| |
| required by a bound introduced by this call
...
LL | fn qux(x: usize, y: usize) {}
| -------------------------- takes 2 distinct arguments
......@@ -145,13 +151,17 @@ error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
--> $DIR/closure-arg-count.rs:32:45
|
LL | let _it = vec![1, 2, 3].into_iter().map(usize::checked_add);
| ^^^^^^^^^^^^^^^^^^ expected function that takes 1 argument
| --- ^^^^^^^^^^^^^^^^^^ expected function that takes 1 argument
| |
| required by a bound introduced by this call
error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
--> $DIR/closure-arg-count.rs:35:10
|
LL | call(Foo);
| ^^^ expected function that takes 0 arguments
| ---- ^^^ expected function that takes 0 arguments
| |
| required by a bound introduced by this call
...
LL | struct Foo(u8);
| --------------- takes 1 argument
......
......@@ -5,7 +5,9 @@ LL | fn takes_mut(x: &mut isize) { }
| --------------------------- found signature of `for<'r> fn(&'r mut isize) -> _`
...
LL | apply(&3, takes_mut);
| ^^^^^^^^^ expected signature of `fn(&{integer}) -> _`
| ----- ^^^^^^^^^ expected signature of `fn(&{integer}) -> _`
| |
| required by a bound introduced by this call
|
note: required by a bound in `apply`
--> $DIR/fn-variance-1.rs:5:37
......@@ -20,7 +22,9 @@ LL | fn takes_imm(x: &isize) { }
| ----------------------- found signature of `for<'r> fn(&'r isize) -> _`
...
LL | apply(&mut 3, takes_imm);
| ^^^^^^^^^ expected signature of `fn(&mut {integer}) -> _`
| ----- ^^^^^^^^^ expected signature of `fn(&mut {integer}) -> _`
| |
| required by a bound introduced by this call
|
note: required by a bound in `apply`
--> $DIR/fn-variance-1.rs:5:37
......
......@@ -16,5 +16,6 @@ pub fn main() {
let z = call_it(3, f);
//~^ ERROR type mismatch
//~| NOTE expected signature of `fn(isize, isize) -> _`
//~| NOTE required by a bound introduced by this call
println!("{}", z);
}
......@@ -5,7 +5,9 @@ LL | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y });
| ----------------------------- found signature of `fn(usize, isize) -> _`
LL |
LL | let z = call_it(3, f);
| ^ expected signature of `fn(isize, isize) -> _`
| ------- ^ expected signature of `fn(isize, isize) -> _`
| |
| required by a bound introduced by this call
|
note: required by a bound in `call_it`
--> $DIR/unboxed-closures-vtable-mismatch.rs:7:14
......
......@@ -2,7 +2,9 @@ error[E0277]: `Cell<i32>` cannot be shared between threads safely
--> $DIR/mutexguard-sync.rs:11:15
|
LL | test_sync(guard);
| ^^^^^ `Cell<i32>` cannot be shared between threads safely
| --------- ^^^^^ `Cell<i32>` cannot be shared between threads safely
| |
| required by a bound introduced by this call
|
= help: the trait `Sync` is not implemented for `Cell<i32>`
= note: required because of the requirements on the impl of `Sync` for `MutexGuard<'_, Cell<i32>>`
......
......@@ -2,7 +2,9 @@ error[E0277]: `Rc<{integer}>` cannot be sent between threads safely
--> $DIR/no_send-rc.rs:7:9
|
LL | bar(x);
| ^ `Rc<{integer}>` cannot be sent between threads safely
| --- ^ `Rc<{integer}>` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
= help: the trait `Send` is not implemented for `Rc<{integer}>`
note: required by a bound in `bar`
......
......@@ -2,7 +2,9 @@ error[E0277]: `Foo` cannot be sent between threads safely
--> $DIR/no_send-struct.rs:15:9
|
LL | bar(x);
| ^ `Foo` cannot be sent between threads safely
| --- ^ `Foo` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
= help: the trait `Send` is not implemented for `Foo`
note: required by a bound in `bar`
......
......@@ -2,7 +2,9 @@ error[E0277]: `Foo` cannot be shared between threads safely
--> $DIR/no_share-struct.rs:12:9
|
LL | bar(x);
| ^ `Foo` cannot be shared between threads safely
| --- ^ `Foo` cannot be shared between threads safely
| |
| required by a bound introduced by this call
|
= help: the trait `Sync` is not implemented for `Foo`
note: required by a bound in `bar`
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `Box<dyn Foo>: Foo` is not satisfied
--> $DIR/object-does-not-impl-trait.rs:6:44
|
LL | fn take_object(f: Box<dyn Foo>) { take_foo(f); }
| ^ the trait `Foo` is not implemented for `Box<dyn Foo>`
| -------- ^ the trait `Foo` is not implemented for `Box<dyn Foo>`
| |
| required by a bound introduced by this call
|
note: required by a bound in `take_foo`
--> $DIR/object-does-not-impl-trait.rs:5:15
......
......@@ -4,7 +4,9 @@ error[E0277]: the trait bound `Foo: Trait` is not satisfied
LL | let x = || {
| _____________-
LL | | f(Foo{});
| | ^^^^^ the trait `Trait` is not implemented for `Foo`
| | - ^^^^^ the trait `Trait` is not implemented for `Foo`
| | |
| | required by a bound introduced by this call
LL | | let y = || {
LL | | f(Foo{});
LL | | };
......@@ -23,7 +25,9 @@ error[E0277]: the trait bound `Foo: Trait` is not satisfied
LL | let y = || {
| _________________-
LL | | f(Foo{});
| | ^^^^^ the trait `Trait` is not implemented for `Foo`
| | - ^^^^^ the trait `Trait` is not implemented for `Foo`
| | |
| | required by a bound introduced by this call
LL | | };
| |_________- in this scope
|
......@@ -42,7 +46,9 @@ LL | | f(Foo{});
LL | | let y = || {
... |
LL | | f(Foo{});
| | ^^^^^ the trait `Trait` is not implemented for `Foo`
| | - ^^^^^ the trait `Trait` is not implemented for `Foo`
| | |
| | required by a bound introduced by this call
... |
LL | | f(Foo{});
LL | | }
......@@ -63,7 +69,9 @@ LL | | f(Foo{});
LL | | let y = || {
... |
LL | | f(Foo{});
| | ^^^^^ the trait `Trait` is not implemented for `Foo`
| | - ^^^^^ the trait `Trait` is not implemented for `Foo`
| | |
| | required by a bound introduced by this call
LL | | }
| |_- in this scope
|
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
--> $DIR/multiple-impls.rs:33:18
|
LL | Index::index(&[] as &[i32], 2u32);
| ^^^^^^^^^^^^^ trait message
| ------------ ^^^^^^^^^^^^^ trait message
| |
| required by a bound introduced by this call
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
note: required by `Index::index`
......@@ -15,7 +17,9 @@ error[E0277]: the trait bound `[i32]: Index<Foo<u32>>` is not satisfied
--> $DIR/multiple-impls.rs:36:18
|
LL | Index::index(&[] as &[i32], Foo(2u32));
| ^^^^^^^^^^^^^ on impl for Foo
| ------------ ^^^^^^^^^^^^^ on impl for Foo
| |
| required by a bound introduced by this call
|
= help: the trait `Index<Foo<u32>>` is not implemented for `[i32]`
note: required by `Index::index`
......@@ -28,7 +32,9 @@ error[E0277]: the trait bound `[i32]: Index<Bar<u32>>` is not satisfied
--> $DIR/multiple-impls.rs:39:18
|
LL | Index::index(&[] as &[i32], Bar(2u32));
| ^^^^^^^^^^^^^ on impl for Bar
| ------------ ^^^^^^^^^^^^^ on impl for Bar
| |
| required by a bound introduced by this call
|
= help: the trait `Index<Bar<u32>>` is not implemented for `[i32]`
note: required by `Index::index`
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
--> $DIR/on-impl.rs:22:25
|
LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
| ^^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice
| ------------------- ^^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice
| |
| required by a bound introduced by this call
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
note: required by `Index::index`
......
......@@ -2,7 +2,9 @@ error[E0277]: `T` cannot be shared between threads safely
--> $DIR/phantom-auto-trait.rs:21:12
|
LL | is_zen(x)
| ^ `T` cannot be shared between threads safely
| ------ ^ `T` cannot be shared between threads safely
| |
| required by a bound introduced by this call
|
note: required because of the requirements on the impl of `Zen` for `&T`
--> $DIR/phantom-auto-trait.rs:10:24
......@@ -29,7 +31,9 @@ error[E0277]: `T` cannot be shared between threads safely
--> $DIR/phantom-auto-trait.rs:26:12
|
LL | is_zen(x)
| ^ `T` cannot be shared between threads safely
| ------ ^ `T` cannot be shared between threads safely
| |
| required by a bound introduced by this call
|
note: required because of the requirements on the impl of `Zen` for `&T`
--> $DIR/phantom-auto-trait.rs:10:24
......
......@@ -2,7 +2,9 @@ error[E0277]: can't compare `S` with `S`
--> $DIR/call-generic-method-nonconst.rs:19:34
|
LL | pub const EQ: bool = equals_self(&S);
| ^^ no implementation for `S == S`
| ----------- ^^ no implementation for `S == S`
| |
| required by a bound introduced by this call
|
= help: the trait `PartialEq` is not implemented for `S`
note: required by a bound in `equals_self`
......
......@@ -9,6 +9,9 @@ LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
error[E0277]: the trait bound `NonTrivialDrop: Drop` is not satisfied
--> $DIR/const-drop-fail.rs:45:5
|
LL | const _: () = check($exp);
| ----- required by a bound introduced by this call
...
LL | NonTrivialDrop,
| ^^^^^^^^^^^^^^ the trait `Drop` is not implemented for `NonTrivialDrop`
|
......@@ -21,6 +24,9 @@ LL | const fn check<T: ~const Drop>(_: T) {}
error[E0277]: the trait bound `ConstImplWithDropGlue: Drop` is not satisfied
--> $DIR/const-drop-fail.rs:47:5
|
LL | const _: () = check($exp);
| ----- required by a bound introduced by this call
...
LL | ConstImplWithDropGlue(NonTrivialDrop),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Drop` is not implemented for `ConstImplWithDropGlue`
|
......@@ -45,6 +51,9 @@ LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied
--> $DIR/const-drop-fail.rs:49:5
|
LL | const _: () = check($exp);
| ----- required by a bound introduced by this call
...
LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `A` is not implemented for `NonTrivialDrop`
|
......
......@@ -9,6 +9,9 @@ LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
error[E0277]: the trait bound `NonTrivialDrop: Drop` is not satisfied
--> $DIR/const-drop-fail.rs:45:5
|
LL | const _: () = check($exp);
| ----- required by a bound introduced by this call
...
LL | NonTrivialDrop,
| ^^^^^^^^^^^^^^ the trait `Drop` is not implemented for `NonTrivialDrop`
|
......@@ -21,6 +24,9 @@ LL | const fn check<T: ~const Drop>(_: T) {}
error[E0277]: the trait bound `ConstImplWithDropGlue: Drop` is not satisfied
--> $DIR/const-drop-fail.rs:47:5
|
LL | const _: () = check($exp);
| ----- required by a bound introduced by this call
...
LL | ConstImplWithDropGlue(NonTrivialDrop),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Drop` is not implemented for `ConstImplWithDropGlue`
|
......@@ -45,6 +51,9 @@ LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
error[E0277]: the trait bound `NonTrivialDrop: A` is not satisfied
--> $DIR/const-drop-fail.rs:49:5
|
LL | const _: () = check($exp);
| ----- required by a bound introduced by this call
...
LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `A` is not implemented for `NonTrivialDrop`
|
......
......@@ -2,7 +2,9 @@ error[E0277]: expected a `Fn<()>` closure, found `fn() {foo}`
--> $DIR/fn-traits.rs:24:10
|
LL | call(foo);
| ^^^ expected an `Fn<()>` closure, found `fn() {foo}`
| ---- ^^^ expected an `Fn<()>` closure, found `fn() {foo}`
| |
| required by a bound introduced by this call
|
= help: the trait `Fn<()>` is not implemented for `fn() {foo}`
= note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
......@@ -17,7 +19,9 @@ error[E0277]: expected a `FnMut<()>` closure, found `fn() {foo}`
--> $DIR/fn-traits.rs:25:14
|
LL | call_mut(foo);
| ^^^ expected an `FnMut<()>` closure, found `fn() {foo}`
| -------- ^^^ expected an `FnMut<()>` closure, found `fn() {foo}`
| |
| required by a bound introduced by this call
|
= help: the trait `FnMut<()>` is not implemented for `fn() {foo}`
= note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
......@@ -32,7 +36,9 @@ error[E0277]: expected a `FnOnce<()>` closure, found `fn() {foo}`
--> $DIR/fn-traits.rs:26:15
|
LL | call_once(foo);
| ^^^ expected an `FnOnce<()>` closure, found `fn() {foo}`
| --------- ^^^ expected an `FnOnce<()>` closure, found `fn() {foo}`
| |
| required by a bound introduced by this call
|
= help: the trait `FnOnce<()>` is not implemented for `fn() {foo}`
= note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
......@@ -47,7 +53,9 @@ error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:28:10
|
LL | call(foo_unsafe);
| ^^^^^^^^^^ expected an `Fn<()>` closure, found `unsafe fn() {foo_unsafe}`
| ---- ^^^^^^^^^^ expected an `Fn<()>` closure, found `unsafe fn() {foo_unsafe}`
| |
| required by a bound introduced by this call
|
= help: the trait `Fn<()>` is not implemented for `unsafe fn() {foo_unsafe}`
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
......@@ -62,7 +70,9 @@ error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:30:14
|
LL | call_mut(foo_unsafe);
| ^^^^^^^^^^ expected an `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
| -------- ^^^^^^^^^^ expected an `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
| |
| required by a bound introduced by this call
|
= help: the trait `FnMut<()>` is not implemented for `unsafe fn() {foo_unsafe}`
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
......@@ -77,7 +87,9 @@ error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:32:15
|
LL | call_once(foo_unsafe);
| ^^^^^^^^^^ expected an `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
| --------- ^^^^^^^^^^ expected an `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
| |
| required by a bound introduced by this call
|
= help: the trait `FnOnce<()>` is not implemented for `unsafe fn() {foo_unsafe}`
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
......
......@@ -13,7 +13,9 @@ error[E0277]: the type `str` cannot be indexed by `{integer}`
--> $DIR/str-idx.rs:4:19
|
LL | let _ = s.get(4);
| ^ string indices are ranges of `usize`
| --- ^ string indices are ranges of `usize`
| |
| required by a bound introduced by this call
|
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
......@@ -23,7 +25,9 @@ error[E0277]: the type `str` cannot be indexed by `{integer}`
--> $DIR/str-idx.rs:5:29
|
LL | let _ = s.get_unchecked(4);
| ^ string indices are ranges of `usize`
| ------------- ^ string indices are ranges of `usize`
| |
| required by a bound introduced by this call
|
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
......
......@@ -37,7 +37,9 @@ error[E0277]: the type `str` cannot be indexed by `{integer}`
--> $DIR/str-mut-idx.rs:9:15
|
LL | s.get_mut(1);
| ^ string indices are ranges of `usize`
| ------- ^ string indices are ranges of `usize`
| |
| required by a bound introduced by this call
|
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
......@@ -47,7 +49,9 @@ error[E0277]: the type `str` cannot be indexed by `{integer}`
--> $DIR/str-mut-idx.rs:11:25
|
LL | s.get_unchecked_mut(1);
| ^ string indices are ranges of `usize`
| ----------------- ^ string indices are ranges of `usize`
| |
| required by a bound introduced by this call
|
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
......
......@@ -5,7 +5,9 @@ LL | async fn foo() {}
| --- consider calling this function
...
LL | bar(foo);
| ^^^ `fn() -> impl Future {foo}` is not a future
| --- ^^^ `fn() -> impl Future {foo}` is not a future
| |
| required by a bound introduced by this call
|
= help: the trait `Future` is not implemented for `fn() -> impl Future {foo}`
note: required by a bound in `bar`
......@@ -24,7 +26,9 @@ error[E0277]: `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-be
LL | let async_closure = async || ();
| -------- consider calling this closure
LL | bar(async_closure);
| ^^^^^^^^^^^^^ `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:36]` is not a future
| --- ^^^^^^^^^^^^^ `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:36]` is not a future
| |
| required by a bound introduced by this call
|
= help: the trait `Future` is not implemented for `[closure@$DIR/async-fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:11:25: 11:36]`
note: required by a bound in `bar`
......
......@@ -5,7 +5,9 @@ LL | fn foo() -> impl T<O=()> { S }
| --- consider calling this function
...
LL | bar(foo);
| ^^^ the trait `T` is not implemented for `fn() -> impl T {foo}`
| --- ^^^ the trait `T` is not implemented for `fn() -> impl T {foo}`
| |
| required by a bound introduced by this call
|
note: required by a bound in `bar`
--> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:14:16
......@@ -23,7 +25,9 @@ error[E0277]: the trait bound `[closure@$DIR/fn-ctor-passed-as-arg-where-it-shou
LL | let closure = || S;
| -- consider calling this closure
LL | bar(closure);
| ^^^^^^^ the trait `T` is not implemented for `[closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:23]`
| --- ^^^^^^^ the trait `T` is not implemented for `[closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:23]`
| |
| required by a bound introduced by this call
|
note: required by a bound in `bar`
--> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:14:16
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `&S: Trait` is not satisfied
--> $DIR/imm-ref-trait-object-literal.rs:12:7
|
LL | foo(&s);
| ^^ the trait `Trait` is not implemented for `&S`
| --- ^^ the trait `Trait` is not implemented for `&S`
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<&'a mut S as Trait>
......@@ -20,10 +22,11 @@ error[E0277]: the trait bound `S: Trait` is not satisfied
--> $DIR/imm-ref-trait-object-literal.rs:13:7
|
LL | foo(s);
| ^
| |
| expected an implementor of trait `Trait`
| help: consider mutably borrowing here: `&mut s`
| --- ^
| | |
| | expected an implementor of trait `Trait`
| | help: consider mutably borrowing here: `&mut s`
| required by a bound introduced by this call
|
note: required by a bound in `foo`
--> $DIR/imm-ref-trait-object-literal.rs:7:11
......
......@@ -2,7 +2,9 @@ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug`
--> $DIR/impl-trait-with-missing-bounds.rs:14:13
|
LL | qux(constraint);
| ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
| --- ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
| |
| required by a bound introduced by this call
|
= help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item`
note: required by a bound in `qux`
......@@ -19,7 +21,9 @@ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug`
--> $DIR/impl-trait-with-missing-bounds.rs:22:13
|
LL | qux(constraint);
| ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
| --- ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
| |
| required by a bound introduced by this call
|
= help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item`
note: required by a bound in `qux`
......@@ -36,7 +40,9 @@ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug`
--> $DIR/impl-trait-with-missing-bounds.rs:30:13
|
LL | qux(constraint);
| ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
| --- ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
| |
| required by a bound introduced by this call
|
= help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item`
note: required by a bound in `qux`
......@@ -53,7 +59,9 @@ error[E0277]: `<impl Iterator + std::fmt::Debug as Iterator>::Item` doesn't impl
--> $DIR/impl-trait-with-missing-bounds.rs:37:13
|
LL | qux(constraint);
| ^^^^^^^^^^ `<impl Iterator + std::fmt::Debug as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
| --- ^^^^^^^^^^ `<impl Iterator + std::fmt::Debug as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
| |
| required by a bound introduced by this call
|
= help: the trait `Debug` is not implemented for `<impl Iterator + std::fmt::Debug as Iterator>::Item`
note: required by a bound in `qux`
......@@ -70,7 +78,9 @@ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug`
--> $DIR/impl-trait-with-missing-bounds.rs:6:13
|
LL | qux(constraint);
| ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
| --- ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
| |
| required by a bound introduced by this call
|
= help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item`
note: required by a bound in `qux`
......@@ -87,7 +97,9 @@ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug`
--> $DIR/impl-trait-with-missing-bounds.rs:45:13
|
LL | qux(constraint);
| ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
| --- ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
| |
| required by a bound introduced by this call
|
= help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item`
note: required by a bound in `qux`
......
......@@ -2,10 +2,11 @@ error[E0277]: expected a `FnMut<(char,)>` closure, found `String`
--> $DIR/issue-62843.rs:4:32
|
LL | println!("{:?}", line.find(pattern));
| ^^^^^^^
| |
| expected an implementor of trait `Pattern<'_>`
| help: consider borrowing here: `&pattern`
| ---- ^^^^^^^
| | |
| | expected an implementor of trait `Pattern<'_>`
| | help: consider borrowing here: `&pattern`
| required by a bound introduced by this call
|
= note: the trait bound `String: Pattern<'_>` is not satisfied
= note: required because of the requirements on the impl of `Pattern<'_>` for `String`
......
......@@ -2,7 +2,9 @@ error[E0277]: `<impl Foo as Foo>::Bar` cannot be sent between threads safely
--> $DIR/issue-79843-impl-trait-with-missing-bounds-on-async-fn.rs:14:20
|
LL | assert_is_send(&bar);
| ^^^^ `<impl Foo as Foo>::Bar` cannot be sent between threads safely
| -------------- ^^^^ `<impl Foo as Foo>::Bar` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
= help: the trait `Send` is not implemented for `<impl Foo as Foo>::Bar`
note: required by a bound in `assert_is_send`
......@@ -19,7 +21,9 @@ error[E0277]: `<impl Foo as Foo>::Bar` cannot be sent between threads safely
--> $DIR/issue-79843-impl-trait-with-missing-bounds-on-async-fn.rs:24:20
|
LL | assert_is_send(&bar);
| ^^^^ `<impl Foo as Foo>::Bar` cannot be sent between threads safely
| -------------- ^^^^ `<impl Foo as Foo>::Bar` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
= help: the trait `Send` is not implemented for `<impl Foo as Foo>::Bar`
note: required by a bound in `assert_is_send`
......
......@@ -2,10 +2,11 @@ error[E0277]: the trait bound `i32: Tr` is not satisfied
--> $DIR/issue-84973-2.rs:11:9
|
LL | foo(a);
| ^
| |
| expected an implementor of trait `Tr`
| help: consider mutably borrowing here: `&mut a`
| --- ^
| | |
| | expected an implementor of trait `Tr`
| | help: consider mutably borrowing here: `&mut a`
| required by a bound introduced by this call
|
note: required by a bound in `foo`
--> $DIR/issue-84973-2.rs:7:11
......
......@@ -21,7 +21,6 @@ fn main() {
let ref_cl: &dyn Fn() -> () = &cl;
f_sized(*ref_cl);
//~^ ERROR: the size for values of type `dyn Fn()` cannot be known at compilation time [E0277]
//~| ERROR: the size for values of type `dyn Fn()` cannot be known at compilation time [E0277]
use std::rc::Rc;
let rc = Rc::new(0);
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `String: Copy` is not satisfied
--> $DIR/issue-84973-blacklist.rs:15:12
|
LL | f_copy("".to_string());
| ^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
| ------ ^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
| |
| required by a bound introduced by this call
|
note: required by a bound in `f_copy`
--> $DIR/issue-84973-blacklist.rs:6:14
......@@ -14,7 +16,9 @@ error[E0277]: the trait bound `S: Clone` is not satisfied
--> $DIR/issue-84973-blacklist.rs:16:13
|
LL | f_clone(S);
| ^ the trait `Clone` is not implemented for `S`
| ------- ^ the trait `Clone` is not implemented for `S`
| |
| required by a bound introduced by this call
|
note: required by a bound in `f_clone`
--> $DIR/issue-84973-blacklist.rs:7:15
......@@ -39,7 +43,9 @@ error[E0277]: the size for values of type `dyn Fn()` cannot be known at compilat
--> $DIR/issue-84973-blacklist.rs:22:13
|
LL | f_sized(*ref_cl);
| ^^^^^^^ doesn't have a size known at compile-time
| ------- ^^^^^^^ doesn't have a size known at compile-time
| |
| required by a bound introduced by this call
|
= help: the trait `Sized` is not implemented for `dyn Fn()`
note: required by a bound in `f_sized`
......@@ -49,10 +55,12 @@ LL | fn f_sized<T: Sized>(t: T) {}
| ^ required by this bound in `f_sized`
error[E0277]: `Rc<{integer}>` cannot be sent between threads safely
--> $DIR/issue-84973-blacklist.rs:28:12
--> $DIR/issue-84973-blacklist.rs:27:12
|
LL | f_send(rc);
| ^^ `Rc<{integer}>` cannot be sent between threads safely
| ------ ^^ `Rc<{integer}>` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
= help: the trait `Send` is not implemented for `Rc<{integer}>`
note: required by a bound in `f_send`
......@@ -61,16 +69,6 @@ note: required by a bound in `f_send`
LL | fn f_send<T: Send>(t: T) {}
| ^^^^ required by this bound in `f_send`
error[E0277]: the size for values of type `dyn Fn()` cannot be known at compilation time
--> $DIR/issue-84973-blacklist.rs:22:5
|
LL | f_sized(*ref_cl);
| ^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `dyn Fn()`
= note: all function arguments must have a statically known size
= help: unsized fn params are gated as an unstable feature
error: aborting due to 6 previous errors
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0277`.
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `i32: Tr` is not satisfied
--> $DIR/issue-84973-negative.rs:10:9
|
LL | bar(a);
| ^ the trait `Tr` is not implemented for `i32`
| --- ^ the trait `Tr` is not implemented for `i32`
| |
| required by a bound introduced by this call
|
note: required by a bound in `bar`
--> $DIR/issue-84973-negative.rs:5:11
......@@ -14,10 +16,11 @@ error[E0277]: the trait bound `f32: Tr` is not satisfied
--> $DIR/issue-84973-negative.rs:11:9
|
LL | bar(b);
| ^
| |
| expected an implementor of trait `Tr`
| help: consider borrowing here: `&b`
| --- ^
| | |
| | expected an implementor of trait `Tr`
| | help: consider borrowing here: `&b`
| required by a bound introduced by this call
|
note: required by a bound in `bar`
--> $DIR/issue-84973-negative.rs:5:11
......
......@@ -2,10 +2,11 @@ error[E0277]: the trait bound `Fancy: SomeTrait` is not satisfied
--> $DIR/issue-84973.rs:6:24
|
LL | let o = Other::new(f);
| ^
| |
| expected an implementor of trait `SomeTrait`
| help: consider borrowing here: `&f`
| ---------- ^
| | |
| | expected an implementor of trait `SomeTrait`
| | help: consider borrowing here: `&f`
| required by a bound introduced by this call
|
note: required by `Other::<'a, G>::new`
--> $DIR/issue-84973.rs:27:5
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satis
--> $DIR/mut-borrow-needed-by-trait.rs:17:29
|
LL | let fp = BufWriter::new(fp);
| ^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
| -------------- ^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
| |
| required by a bound introduced by this call
|
= note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
note: required by `BufWriter::<W>::new`
......
......@@ -2,7 +2,9 @@ error[E0277]: `impl Sync` cannot be sent between threads safely
--> $DIR/restrict-type-argument.rs:4:13
|
LL | is_send(val);
| ^^^ `impl Sync` cannot be sent between threads safely
| ------- ^^^ `impl Sync` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
note: required by a bound in `is_send`
--> $DIR/restrict-type-argument.rs:1:15
......@@ -18,7 +20,9 @@ error[E0277]: `S` cannot be sent between threads safely
--> $DIR/restrict-type-argument.rs:8:13
|
LL | is_send(val);
| ^^^ `S` cannot be sent between threads safely
| ------- ^^^ `S` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
note: required by a bound in `is_send`
--> $DIR/restrict-type-argument.rs:1:15
......@@ -34,7 +38,9 @@ error[E0277]: `S` cannot be sent between threads safely
--> $DIR/restrict-type-argument.rs:12:13
|
LL | is_send(val);
| ^^^ `S` cannot be sent between threads safely
| ------- ^^^ `S` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
note: required by a bound in `is_send`
--> $DIR/restrict-type-argument.rs:1:15
......@@ -50,7 +56,9 @@ error[E0277]: `S` cannot be sent between threads safely
--> $DIR/restrict-type-argument.rs:20:13
|
LL | is_send(val);
| ^^^ `S` cannot be sent between threads safely
| ------- ^^^ `S` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
note: required by a bound in `is_send`
--> $DIR/restrict-type-argument.rs:1:15
......@@ -66,7 +74,9 @@ error[E0277]: `S` cannot be sent between threads safely
--> $DIR/restrict-type-argument.rs:24:13
|
LL | is_send(val);
| ^^^ `S` cannot be sent between threads safely
| ------- ^^^ `S` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
note: required by a bound in `is_send`
--> $DIR/restrict-type-argument.rs:1:15
......@@ -82,7 +92,9 @@ error[E0277]: `S` cannot be sent between threads safely
--> $DIR/restrict-type-argument.rs:28:13
|
LL | is_send(val);
| ^^^ `S` cannot be sent between threads safely
| ------- ^^^ `S` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
note: required by a bound in `is_send`
--> $DIR/restrict-type-argument.rs:1:15
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `&T: std::io::Read` is not satisfied
--> $DIR/suggest-change-mut.rs:12:48
|
LL | let mut stream_reader = BufReader::new(&stream);
| ^^^^^^^ the trait `std::io::Read` is not implemented for `&T`
| -------------- ^^^^^^^ the trait `std::io::Read` is not implemented for `&T`
| |
| required by a bound introduced by this call
|
note: required by `BufReader::<R>::new`
--> $SRC_DIR/std/src/io/buffered/bufreader.rs:LL:COL
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `Foo: main::a::Bar` is not satisfied
--> $DIR/same-crate-name.rs:31:20
|
LL | a::try_foo(foo);
| ^^^ the trait `main::a::Bar` is not implemented for `Foo`
| ---------- ^^^ the trait `main::a::Bar` is not implemented for `Foo`
| |
| required by a bound introduced by this call
|
help: trait impl with same name found
--> $DIR/auxiliary/crate_a2.rs:5:1
......@@ -20,7 +22,9 @@ error[E0277]: the trait bound `DoesNotImplementTrait: main::a::Bar` is not satis
--> $DIR/same-crate-name.rs:38:20
|
LL | a::try_foo(implements_no_traits);
| ^^^^^^^^^^^^^^^^^^^^ the trait `main::a::Bar` is not implemented for `DoesNotImplementTrait`
| ---------- ^^^^^^^^^^^^^^^^^^^^ the trait `main::a::Bar` is not implemented for `DoesNotImplementTrait`
| |
| required by a bound introduced by this call
|
note: required by a bound in `try_foo`
--> $DIR/auxiliary/crate_a1.rs:3:24
......@@ -32,7 +36,9 @@ error[E0277]: the trait bound `ImplementsWrongTraitConditionally<isize>: main::a
--> $DIR/same-crate-name.rs:45:20
|
LL | a::try_foo(other_variant_implements_mismatched_trait);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `main::a::Bar` is not implemented for `ImplementsWrongTraitConditionally<isize>`
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `main::a::Bar` is not implemented for `ImplementsWrongTraitConditionally<isize>`
| |
| required by a bound introduced by this call
|
help: trait impl with same name found
--> $DIR/auxiliary/crate_a2.rs:13:1
......@@ -50,7 +56,9 @@ error[E0277]: the trait bound `ImplementsTraitForUsize<isize>: main::a::Bar` is
--> $DIR/same-crate-name.rs:51:20
|
LL | a::try_foo(other_variant_implements_correct_trait);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `main::a::Bar` is not implemented for `ImplementsTraitForUsize<isize>`
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `main::a::Bar` is not implemented for `ImplementsTraitForUsize<isize>`
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<ImplementsTraitForUsize<usize> as main::a::Bar>
......
......@@ -10,7 +10,9 @@ error[E0277]: the trait bound `NoClone: Copy` is not satisfied
--> $DIR/supertrait-auto-trait.rs:16:23
|
LL | let (a, b) = copy(NoClone);
| ^^^^^^^ the trait `Copy` is not implemented for `NoClone`
| ---- ^^^^^^^ the trait `Copy` is not implemented for `NoClone`
| |
| required by a bound introduced by this call
|
= note: required because of the requirements on the impl of `Magic` for `NoClone`
note: required by a bound in `copy`
......
......@@ -2,7 +2,9 @@ error[E0277]: `dummy::TestType` cannot be sent between threads safely
--> $DIR/negated-auto-traits-error.rs:23:11
|
LL | Outer(TestType);
| ^^^^^^^^ `dummy::TestType` cannot be sent between threads safely
| ----- ^^^^^^^^ `dummy::TestType` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
= help: the trait `Send` is not implemented for `dummy::TestType`
note: required by `Outer`
......@@ -28,7 +30,9 @@ error[E0277]: `dummy1b::TestType` cannot be sent between threads safely
--> $DIR/negated-auto-traits-error.rs:32:13
|
LL | is_send(TestType);
| ^^^^^^^^ `dummy1b::TestType` cannot be sent between threads safely
| ------- ^^^^^^^^ `dummy1b::TestType` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
= help: the trait `Send` is not implemented for `dummy1b::TestType`
note: required by a bound in `is_send`
......@@ -41,9 +45,11 @@ error[E0277]: `dummy1c::TestType` cannot be sent between threads safely
--> $DIR/negated-auto-traits-error.rs:40:13
|
LL | is_send((8, TestType));
| ^^^^^^^^^^^^^ `dummy1c::TestType` cannot be sent between threads safely
| ------- ^^^^^^^^^^^^^ `dummy1c::TestType` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
= help: within `({integer}, dummy1c::TestType)`, the trait `Send` is not implemented for `dummy1c::TestType`
= help: the trait `Send` is not implemented for `dummy1c::TestType`
= note: required because it appears within the type `({integer}, dummy1c::TestType)`
note: required by a bound in `is_send`
--> $DIR/negated-auto-traits-error.rs:16:15
......@@ -55,10 +61,11 @@ error[E0277]: `dummy2::TestType` cannot be sent between threads safely
--> $DIR/negated-auto-traits-error.rs:48:13
|
LL | is_send(Box::new(TestType));
| ^^^^^^^^^^^^^^^^^^
| |
| expected an implementor of trait `Send`
| help: consider borrowing here: `&Box::new(TestType)`
| ------- ^^^^^^^^^^^^^^^^^^
| | |
| | expected an implementor of trait `Send`
| | help: consider borrowing here: `&Box::new(TestType)`
| required by a bound introduced by this call
|
= note: the trait bound `dummy2::TestType: Send` is not satisfied
= note: required because of the requirements on the impl of `Send` for `Unique<dummy2::TestType>`
......@@ -73,9 +80,11 @@ error[E0277]: `dummy3::TestType` cannot be sent between threads safely
--> $DIR/negated-auto-traits-error.rs:56:13
|
LL | is_send(Box::new(Outer2(TestType)));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `dummy3::TestType` cannot be sent between threads safely
| ------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ `dummy3::TestType` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
= help: within `Outer2<dummy3::TestType>`, the trait `Send` is not implemented for `dummy3::TestType`
= help: the trait `Send` is not implemented for `dummy3::TestType`
note: required because it appears within the type `Outer2<dummy3::TestType>`
--> $DIR/negated-auto-traits-error.rs:12:8
|
......@@ -93,10 +102,11 @@ error[E0277]: `main::TestType` cannot be sent between threads safely
--> $DIR/negated-auto-traits-error.rs:66:13
|
LL | is_sync(Outer2(TestType));
| ^^^^^^^^^^^^^^^^
| |
| expected an implementor of trait `Sync`
| help: consider borrowing here: `&Outer2(TestType)`
| ------- ^^^^^^^^^^^^^^^^
| | |
| | expected an implementor of trait `Sync`
| | help: consider borrowing here: `&Outer2(TestType)`
| required by a bound introduced by this call
|
= note: the trait bound `main::TestType: Sync` is not satisfied
note: required because of the requirements on the impl of `Sync` for `Outer2<main::TestType>`
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `(): MyTrait` is not satisfied
--> $DIR/no-use.rs:10:26
|
LL | <() as MyTrait>::foo(&());
| ^^^ the trait `MyTrait` is not implemented for `()`
| -------------------- ^^^ the trait `MyTrait` is not implemented for `()`
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<() as MyTrait>
......
......@@ -2,10 +2,11 @@ error[E0277]: the trait bound `NoToSocketAddrs: ToSocketAddrs` is not satisfied
--> $DIR/issue-39029.rs:16:37
|
LL | let _errors = TcpListener::bind(&bad);
| ^^^^
| |
| the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs`
| help: consider adding dereference here: `&*bad`
| ----------------- ^^^^
| | |
| | the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs`
| | help: consider adding dereference here: `&*bad`
| required by a bound introduced by this call
|
= note: required because of the requirements on the impl of `ToSocketAddrs` for `&NoToSocketAddrs`
note: required by a bound in `TcpListener::bind`
......
......@@ -2,10 +2,11 @@ error[E0277]: the trait bound `&String: SomeTrait` is not satisfied
--> $DIR/issue-62530.rs:13:26
|
LL | takes_type_parameter(&string); // Error
| ^^^^^^^
| |
| the trait `SomeTrait` is not implemented for `&String`
| help: consider adding dereference here: `&*string`
| -------------------- ^^^^^^^
| | |
| | the trait `SomeTrait` is not implemented for `&String`
| | help: consider adding dereference here: `&*string`
| required by a bound introduced by this call
|
note: required by a bound in `takes_type_parameter`
--> $DIR/issue-62530.rs:4:44
......
......@@ -2,10 +2,11 @@ error[E0277]: the trait bound `&Baz: Happy` is not satisfied
--> $DIR/multiple-0.rs:34:9
|
LL | foo(&baz);
| ^^^^
| |
| the trait `Happy` is not implemented for `&Baz`
| help: consider adding dereference here: `&***baz`
| --- ^^^^
| | |
| | the trait `Happy` is not implemented for `&Baz`
| | help: consider adding dereference here: `&***baz`
| required by a bound introduced by this call
|
note: required by a bound in `foo`
--> $DIR/multiple-0.rs:30:26
......
......@@ -2,7 +2,9 @@ error[E0277]: the trait bound `&mut Baz: Happy` is not satisfied
--> $DIR/multiple-1.rs:52:9
|
LL | foo(&mut baz);
| ^^^^^^^^ the trait `Happy` is not implemented for `&mut Baz`
| --- ^^^^^^^^ the trait `Happy` is not implemented for `&mut Baz`
| |
| required by a bound introduced by this call
|
note: required by a bound in `foo`
--> $DIR/multiple-1.rs:45:26
......
......@@ -24,7 +24,9 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied
--> $DIR/trivial-bounds-leak.rs:25:15
|
LL | Foo::test(&4i32);
| ^^^^^ the trait `Foo` is not implemented for `i32`
| --------- ^^^^^ the trait `Foo` is not implemented for `i32`
| |
| required by a bound introduced by this call
|
note: required by `Foo::test`
--> $DIR/trivial-bounds-leak.rs:5:5
......@@ -36,7 +38,9 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied
--> $DIR/trivial-bounds-leak.rs:26:22
|
LL | generic_function(5i32);
| ^^^^ the trait `Foo` is not implemented for `i32`
| ---------------- ^^^^ the trait `Foo` is not implemented for `i32`
| |
| required by a bound introduced by this call
|
note: required by a bound in `generic_function`
--> $DIR/trivial-bounds-leak.rs:29:24
......
......@@ -2,7 +2,9 @@ error[E0277]: `UnsafeCell<MySync<{integer}>>` cannot be shared between threads s
--> $DIR/typeck-unsafe-always-share.rs:19:10
|
LL | test(us);
| ^^ `UnsafeCell<MySync<{integer}>>` cannot be shared between threads safely
| ---- ^^ `UnsafeCell<MySync<{integer}>>` cannot be shared between threads safely
| |
| required by a bound introduced by this call
|
= help: the trait `Sync` is not implemented for `UnsafeCell<MySync<{integer}>>`
note: required by a bound in `test`
......@@ -15,7 +17,9 @@ error[E0277]: `UnsafeCell<NoSync>` cannot be shared between threads safely
--> $DIR/typeck-unsafe-always-share.rs:23:10
|
LL | test(uns);
| ^^^ `UnsafeCell<NoSync>` cannot be shared between threads safely
| ---- ^^^ `UnsafeCell<NoSync>` cannot be shared between threads safely
| |
| required by a bound introduced by this call
|
= help: the trait `Sync` is not implemented for `UnsafeCell<NoSync>`
note: required by a bound in `test`
......@@ -46,7 +50,9 @@ error[E0277]: `NoSync` cannot be shared between threads safely
--> $DIR/typeck-unsafe-always-share.rs:30:10
|
LL | test(NoSync);
| ^^^^^^ `NoSync` cannot be shared between threads safely
| ---- ^^^^^^ `NoSync` cannot be shared between threads safely
| |
| required by a bound introduced by this call
|
= help: the trait `Sync` is not implemented for `NoSync`
note: required by a bound in `test`
......
......@@ -2,7 +2,9 @@ error[E0277]: expected a `Fn<(isize,)>` closure, found `S`
--> $DIR/unboxed-closures-fnmut-as-fn.rs:28:21
|
LL | let x = call_it(&S, 22);
| ^^ expected an `Fn<(isize,)>` closure, found `S`
| ------- ^^ expected an `Fn<(isize,)>` closure, found `S`
| |
| required by a bound introduced by this call
|
= help: the trait `Fn<(isize,)>` is not implemented for `S`
note: required by a bound in `call_it`
......
......@@ -2,7 +2,9 @@ error[E0277]: expected a `Fn<(&isize,)>` closure, found `for<'r> unsafe fn(&'r i
--> $DIR/unboxed-closures-unsafe-extern-fn.rs:20:21
|
LL | let x = call_it(&square, 22);
| ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}`
| ------- ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}`
| |
| required by a bound introduced by this call
|
= help: the trait `for<'r> Fn<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}`
note: required by a bound in `call_it`
......@@ -15,7 +17,9 @@ error[E0277]: expected a `FnMut<(&isize,)>` closure, found `for<'r> unsafe fn(&'
--> $DIR/unboxed-closures-unsafe-extern-fn.rs:25:25
|
LL | let y = call_it_mut(&mut square, 22);
| ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}`
| ----------- ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}`
| |
| required by a bound introduced by this call
|
= help: the trait `for<'r> FnMut<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}`
note: required by a bound in `call_it_mut`
......@@ -28,7 +32,9 @@ error[E0277]: expected a `FnOnce<(&isize,)>` closure, found `for<'r> unsafe fn(&
--> $DIR/unboxed-closures-unsafe-extern-fn.rs:30:26
|
LL | let z = call_it_once(square, 22);
| ^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}`
| ------------ ^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}`
| |
| required by a bound introduced by this call
|
= help: the trait `for<'r> FnOnce<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}`
note: required by a bound in `call_it_once`
......
......@@ -2,7 +2,9 @@ error[E0277]: expected a `Fn<(&isize,)>` closure, found `for<'r> extern "C" fn(&
--> $DIR/unboxed-closures-wrong-abi.rs:20:21
|
LL | let x = call_it(&square, 22);
| ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}`
| ------- ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}`
| |
| required by a bound introduced by this call
|
= help: the trait `for<'r> Fn<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}`
note: required by a bound in `call_it`
......@@ -15,7 +17,9 @@ error[E0277]: expected a `FnMut<(&isize,)>` closure, found `for<'r> extern "C" f
--> $DIR/unboxed-closures-wrong-abi.rs:25:25
|
LL | let y = call_it_mut(&mut square, 22);
| ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}`
| ----------- ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}`
| |
| required by a bound introduced by this call
|
= help: the trait `for<'r> FnMut<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}`
note: required by a bound in `call_it_mut`
......@@ -28,7 +32,9 @@ error[E0277]: expected a `FnOnce<(&isize,)>` closure, found `for<'r> extern "C"
--> $DIR/unboxed-closures-wrong-abi.rs:30:26
|
LL | let z = call_it_once(square, 22);
| ^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}`
| ------------ ^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}`
| |
| required by a bound introduced by this call
|
= help: the trait `for<'r> FnOnce<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}`
note: required by a bound in `call_it_once`
......
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册