1
Fork 0

Rollup merge of #91873 - estebank:mention-impls-for-unsatisfied-trait, r=davidtwco

Mention implementers of unsatisfied trait

When encountering an unsatisfied trait bound, if there are no other
suggestions, mention all the types that *do* implement that trait:

```
error[E0277]: the trait bound `f32: Foo` is not satisfied
  --> $DIR/impl_wf.rs:22:6
   |
LL | impl Baz<f32> for f32 { }
   |      ^^^^^^^^ the trait `Foo` is not implemented for `f32`
   |
   = help: the trait `Foo` is implemented for `i32`
note: required by a bound in `Baz`
  --> $DIR/impl_wf.rs:18:31
   |
LL | trait Baz<U: ?Sized> where U: Foo { }
   |                               ^^^ required by this bound in `Baz`
```
```
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`
   |
   = help: the trait `Foo` is implemented for `i32`
note: required by a bound in `f1`
  --> $DIR/associated-types-path-2.rs:13:14
   |
LL | pub fn f1<T: Foo>(a: T, x: T::A) {}
   |              ^^^ required by this bound in `f1`
```

Suggest dereferencing in more cases.

Fix #87437, fix #90970.
This commit is contained in:
Dylan DPC 2022-04-05 01:53:31 +02:00 committed by GitHub
commit a5c81695a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
136 changed files with 1242 additions and 292 deletions

View file

@ -378,6 +378,12 @@ impl Diagnostic {
self
}
/// Add a help message attached to this diagnostic with a customizable highlighted message.
pub fn highlighted_help(&mut self, msg: Vec<(String, Style)>) -> &mut Self {
self.sub_with_highlights(Level::Help, msg, MultiSpan::new(), None);
self
}
/// Prints the span with some help above it.
/// This is like [`Diagnostic::help()`], but it gets its own span.
pub fn span_help<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self {

View file

@ -41,7 +41,7 @@ use rustc_hir::Node;
use rustc_macros::HashStable;
use rustc_query_system::ich::StableHashingContext;
use rustc_session::cstore::CrateStoreDyn;
use rustc_span::symbol::{kw, Ident, Symbol};
use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::Span;
use rustc_target::abi::Align;
@ -2206,7 +2206,7 @@ impl<'tcx> TyCtxt<'tcx> {
self.impl_trait_ref(def_id).map(|tr| tr.def_id)
}
/// If the given defid describes a method belonging to an impl, returns the
/// If the given `DefId` describes a method belonging to an impl, returns the
/// `DefId` of the impl that the method belongs to; otherwise, returns `None`.
pub fn impl_of_method(self, def_id: DefId) -> Option<DefId> {
self.opt_associated_item(def_id).and_then(|trait_item| match trait_item.container {
@ -2215,6 +2215,11 @@ impl<'tcx> TyCtxt<'tcx> {
})
}
/// If the given `DefId` belongs to a trait that was automatically derived, returns `true`.
pub fn is_builtin_derive(self, def_id: DefId) -> bool {
self.has_attr(def_id, sym::automatically_derived)
}
/// Looks up the span of `impl_did` if the impl is local; otherwise returns `Err`
/// with the name of the crate containing the impl.
pub fn span_of_impl(self, impl_did: DefId) -> Result<Span, Symbol> {

View file

@ -1,10 +1,9 @@
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::def_id::LocalDefId;
use rustc_middle::mir::visit::{PlaceContext, Visitor};
use rustc_middle::mir::*;
use rustc_middle::ty::query::Providers;
use rustc_middle::ty::{self, TyCtxt};
use rustc_session::lint::builtin::UNALIGNED_REFERENCES;
use rustc_span::symbol::sym;
use crate::util;
use crate::MirLint;
@ -50,22 +49,6 @@ fn unsafe_derive_on_repr_packed(tcx: TyCtxt<'_>, def_id: LocalDefId) {
});
}
fn builtin_derive_def_id(tcx: TyCtxt<'_>, def_id: DefId) -> Option<DefId> {
debug!("builtin_derive_def_id({:?})", def_id);
if let Some(impl_def_id) = tcx.impl_of_method(def_id) {
if tcx.has_attr(impl_def_id, sym::automatically_derived) {
debug!("builtin_derive_def_id({:?}) - is {:?}", def_id, impl_def_id);
Some(impl_def_id)
} else {
debug!("builtin_derive_def_id({:?}) - not automatically derived", def_id);
None
}
} else {
debug!("builtin_derive_def_id({:?}) - not a method", def_id);
None
}
}
impl<'tcx> Visitor<'tcx> for PackedRefChecker<'_, 'tcx> {
fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location) {
// Make sure we know where in the MIR we are.
@ -83,7 +66,11 @@ impl<'tcx> Visitor<'tcx> for PackedRefChecker<'_, 'tcx> {
if context.is_borrow() {
if util::is_disaligned(self.tcx, self.body, self.param_env, *place) {
let def_id = self.body.source.instance.def_id();
if let Some(impl_def_id) = builtin_derive_def_id(self.tcx, def_id) {
if let Some(impl_def_id) = self
.tcx
.impl_of_method(def_id)
.filter(|&def_id| self.tcx.is_builtin_derive(def_id))
{
// If a method is defined in the local crate,
// the impl containing that method should also be.
self.tcx.ensure().unsafe_derive_on_repr_packed(impl_def_id.expect_local());

View file

@ -180,6 +180,9 @@ symbols! {
Error,
File,
FileType,
Fn,
FnMut,
FnOnce,
FormatSpec,
Formatter,
From,
@ -248,6 +251,7 @@ symbols! {
RustcEncodable,
Send,
SeqCst,
SliceIndex,
Some,
String,
StructuralEq,

View file

@ -2,10 +2,11 @@ pub mod on_unimplemented;
pub mod suggestions;
use super::{
EvaluationResult, FulfillmentContext, FulfillmentError, FulfillmentErrorCode,
MismatchedProjectionTypes, Obligation, ObligationCause, ObligationCauseCode,
OnUnimplementedDirective, OnUnimplementedNote, OutputTypeParameterMismatch, Overflow,
PredicateObligation, SelectionContext, SelectionError, TraitNotObjectSafe,
DerivedObligationCause, EvaluationResult, FulfillmentContext, FulfillmentError,
FulfillmentErrorCode, ImplDerivedObligationCause, MismatchedProjectionTypes, Obligation,
ObligationCause, ObligationCauseCode, OnUnimplementedDirective, OnUnimplementedNote,
OutputTypeParameterMismatch, Overflow, PredicateObligation, SelectionContext, SelectionError,
TraitNotObjectSafe,
};
use crate::infer::error_reporting::{TyCategory, TypeAnnotationNeeded as ErrorCode};
@ -14,6 +15,7 @@ use crate::infer::{self, InferCtxt, TyCtxtInferExt};
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::{
pluralize, struct_span_err, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed,
Style,
};
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
@ -28,7 +30,7 @@ use rustc_middle::traits::select::OverflowError;
use rustc_middle::ty::error::ExpectedFound;
use rustc_middle::ty::fold::TypeFolder;
use rustc_middle::ty::{
self, SubtypePredicate, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable,
self, SubtypePredicate, ToPolyTraitRef, ToPredicate, TraitRef, Ty, TyCtxt, TypeFoldable,
};
use rustc_span::symbol::{kw, sym};
use rustc_span::{ExpnKind, MultiSpan, Span, DUMMY_SP};
@ -354,7 +356,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
let have_alt_message = message.is_some() || label.is_some();
let is_try_conversion = self.is_try_conversion(span, trait_ref.def_id());
let is_unsize =
{ Some(trait_ref.def_id()) == self.tcx.lang_items().unsize_trait() };
Some(trait_ref.def_id()) == self.tcx.lang_items().unsize_trait();
let (message, note, append_const_msg) = if is_try_conversion {
(
Some(format!(
@ -363,7 +365,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
)),
Some(
"the question mark operation (`?`) implicitly performs a \
conversion on the error value using the `From` trait"
conversion on the error value using the `From` trait"
.to_owned(),
),
Some(None),
@ -525,10 +527,12 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
}
self.suggest_floating_point_literal(&obligation, &mut err, &trait_ref);
self.suggest_dereferences(&obligation, &mut err, trait_predicate);
self.suggest_fn_call(&obligation, &mut err, trait_predicate);
self.suggest_remove_reference(&obligation, &mut err, trait_predicate);
self.suggest_semicolon_removal(
let mut suggested =
self.suggest_dereferences(&obligation, &mut err, trait_predicate);
suggested |= self.suggest_fn_call(&obligation, &mut err, trait_predicate);
suggested |=
self.suggest_remove_reference(&obligation, &mut err, trait_predicate);
suggested |= self.suggest_semicolon_removal(
&obligation,
&mut err,
span,
@ -654,10 +658,80 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
trait_predicate,
obligation.cause.body_id,
);
} else if !have_alt_message {
} else if !suggested {
// Can't show anything else useful, try to find similar impls.
let impl_candidates = self.find_similar_impl_candidates(trait_ref);
self.report_similar_impl_candidates(impl_candidates, &mut err);
if !self.report_similar_impl_candidates(
impl_candidates,
trait_ref,
&mut err,
) {
// This is *almost* equivalent to
// `obligation.cause.code().peel_derives()`, but it gives us the
// trait predicate for that corresponding root obligation. This
// lets us get a derived obligation from a type parameter, like
// when calling `string.strip_suffix(p)` where `p` is *not* an
// implementer of `Pattern<'_>`.
let mut code = obligation.cause.code();
let mut trait_pred = trait_predicate;
let mut peeled = false;
loop {
match &*code {
ObligationCauseCode::FunctionArgumentObligation {
parent_code,
..
} => {
code = &parent_code;
}
ObligationCauseCode::ImplDerivedObligation(
box ImplDerivedObligationCause {
derived:
DerivedObligationCause {
parent_code,
parent_trait_pred,
},
..
},
)
| ObligationCauseCode::BuiltinDerivedObligation(
DerivedObligationCause {
parent_code,
parent_trait_pred,
},
)
| ObligationCauseCode::DerivedObligation(
DerivedObligationCause {
parent_code,
parent_trait_pred,
},
) => {
peeled = true;
code = &parent_code;
trait_pred = *parent_trait_pred;
}
_ => break,
};
}
let def_id = trait_pred.def_id();
// Mention *all* the `impl`s for the *top most* obligation, the
// user might have meant to use one of them, if any found. We skip
// auto-traits or fundamental traits that might not be exactly what
// the user might expect to be presented with. Instead this is
// useful for less general traits.
if peeled
&& !self.tcx.trait_is_auto(def_id)
&& !self.tcx.lang_items().items().contains(&Some(def_id))
{
let trait_ref = trait_pred.to_poly_trait_ref();
let impl_candidates =
self.find_similar_impl_candidates(trait_ref);
self.report_similar_impl_candidates(
impl_candidates,
trait_ref,
&mut err,
);
}
}
}
// Changing mutability doesn't make a difference to whether we have
@ -682,7 +756,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
});
let unit_obligation = obligation.with(predicate.to_predicate(tcx));
if self.predicate_may_hold(&unit_obligation) {
err.note("this trait is implemented for `()`");
err.note(
"this error might have been caused by changes to \
Rust's type-inference algorithm (see issue #48950 \
@ -1307,8 +1380,9 @@ trait InferCtxtPrivExt<'hir, 'tcx> {
fn report_similar_impl_candidates(
&self,
impl_candidates: Vec<ImplCandidate<'tcx>>,
trait_ref: ty::PolyTraitRef<'tcx>,
err: &mut Diagnostic,
);
) -> bool;
/// Gets the parent trait chain start
fn get_parent_trait_ref(
@ -1319,7 +1393,11 @@ trait InferCtxtPrivExt<'hir, 'tcx> {
/// If the `Self` type of the unsatisfied trait `trait_ref` implements a trait
/// with the same path as `trait_ref`, a help message about
/// a probable version mismatch is added to `err`
fn note_version_mismatch(&self, err: &mut Diagnostic, trait_ref: &ty::PolyTraitRef<'tcx>);
fn note_version_mismatch(
&self,
err: &mut Diagnostic,
trait_ref: &ty::PolyTraitRef<'tcx>,
) -> bool;
/// Creates a `PredicateObligation` with `new_self_ty` replacing the existing type in the
/// `trait_ref`.
@ -1681,14 +1759,82 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
fn report_similar_impl_candidates(
&self,
impl_candidates: Vec<ImplCandidate<'tcx>>,
trait_ref: ty::PolyTraitRef<'tcx>,
err: &mut Diagnostic,
) {
if impl_candidates.is_empty() {
return;
}
) -> bool {
let report = |mut candidates: Vec<TraitRef<'tcx>>, err: &mut Diagnostic| {
candidates.sort();
candidates.dedup();
let len = candidates.len();
if candidates.len() == 0 {
return false;
}
if candidates.len() == 1 {
err.highlighted_help(vec![
(
format!("the trait `{}` ", candidates[0].print_only_trait_path()),
Style::NoStyle,
),
("is".to_string(), Style::Highlight),
(" implemented for `".to_string(), Style::NoStyle),
(candidates[0].self_ty().to_string(), Style::Highlight),
("`".to_string(), Style::NoStyle),
]);
return true;
}
let trait_ref = TraitRef::identity(self.tcx, candidates[0].def_id);
// Check if the trait is the same in all cases. If so, we'll only show the type.
let mut traits: Vec<_> =
candidates.iter().map(|c| c.print_only_trait_path().to_string()).collect();
traits.sort();
traits.dedup();
let len = impl_candidates.len();
let end = if impl_candidates.len() <= 5 { impl_candidates.len() } else { 4 };
let mut candidates: Vec<String> = candidates
.into_iter()
.map(|c| {
if traits.len() == 1 {
format!("\n {}", c.self_ty())
} else {
format!("\n {}", c)
}
})
.collect();
candidates.sort();
candidates.dedup();
let end = if candidates.len() <= 9 { candidates.len() } else { 8 };
err.help(&format!(
"the following other types implement trait `{}`:{}{}",
trait_ref.print_only_trait_path(),
candidates[..end].join(""),
if len > 9 { format!("\nand {} others", len - 8) } else { String::new() }
));
true
};
let def_id = trait_ref.def_id();
if impl_candidates.is_empty() {
if self.tcx.trait_is_auto(def_id)
|| self.tcx.lang_items().items().contains(&Some(def_id))
|| self.tcx.get_diagnostic_name(def_id).is_some()
{
// Mentioning implementers of `Copy`, `Debug` and friends is not useful.
return false;
}
let normalized_impl_candidates: Vec<_> = self
.tcx
.all_impls(def_id)
// Ignore automatically derived impls and `!Trait` impls.
.filter(|&def_id| {
self.tcx.impl_polarity(def_id) != ty::ImplPolarity::Negative
|| self.tcx.is_builtin_derive(def_id)
})
.filter_map(|def_id| self.tcx.impl_trait_ref(def_id))
// Avoid mentioning type parameters.
.filter(|trait_ref| !matches!(trait_ref.self_ty().kind(), ty::Param(_)))
.collect();
return report(normalized_impl_candidates, err);
}
let normalize = |candidate| {
self.tcx.infer_ctxt().enter(|ref infcx| {
@ -1697,8 +1843,8 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
.normalize(candidate)
.ok();
match normalized {
Some(normalized) => format!("\n {}", normalized.value),
None => format!("\n {}", candidate),
Some(normalized) => normalized.value,
None => candidate,
}
})
};
@ -1717,17 +1863,14 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
})
.collect::<Vec<_>>();
normalized_impl_candidates_and_similarities.sort();
normalized_impl_candidates_and_similarities.dedup();
let normalized_impl_candidates = normalized_impl_candidates_and_similarities
.into_iter()
.map(|(_, normalized)| normalized)
.collect::<Vec<_>>();
err.help(&format!(
"the following implementations were found:{}{}",
normalized_impl_candidates[..end].join(""),
if len > 5 { format!("\nand {} others", len - 4) } else { String::new() }
));
report(normalized_impl_candidates, err)
}
/// Gets the parent trait chain start
@ -1758,7 +1901,11 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
/// If the `Self` type of the unsatisfied trait `trait_ref` implements a trait
/// with the same path as `trait_ref`, a help message about
/// a probable version mismatch is added to `err`
fn note_version_mismatch(&self, err: &mut Diagnostic, trait_ref: &ty::PolyTraitRef<'tcx>) {
fn note_version_mismatch(
&self,
err: &mut Diagnostic,
trait_ref: &ty::PolyTraitRef<'tcx>,
) -> bool {
let get_trait_impl = |trait_def_id| {
self.tcx.find_map_relevant_impl(trait_def_id, trait_ref.skip_binder().self_ty(), Some)
};
@ -1769,6 +1916,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
.filter(|trait_def_id| *trait_def_id != trait_ref.def_id())
.filter(|trait_def_id| self.tcx.def_path_str(*trait_def_id) == required_trait_path)
.collect();
let mut suggested = false;
for trait_with_same_path in traits_with_same_path {
if let Some(impl_def_id) = get_trait_impl(trait_with_same_path) {
let impl_span = self.tcx.def_span(impl_def_id);
@ -1779,8 +1927,10 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
trait_crate
);
err.note(&crate_msg);
suggested = true;
}
}
suggested
}
fn mk_trait_obligation_with_new_self_ty(

View file

@ -1,6 +1,6 @@
use super::{
EvaluationResult, Obligation, ObligationCause, ObligationCauseCode, PredicateObligation,
SelectionContext,
DerivedObligationCause, EvaluationResult, ImplDerivedObligationCause, Obligation,
ObligationCause, ObligationCauseCode, PredicateObligation, SelectionContext,
};
use crate::autoderef::Autoderef;
@ -58,7 +58,7 @@ pub trait InferCtxtExt<'tcx> {
obligation: &PredicateObligation<'tcx>,
err: &mut Diagnostic,
trait_pred: ty::PolyTraitPredicate<'tcx>,
);
) -> bool;
fn get_closure_name(&self, def_id: DefId, err: &mut Diagnostic, msg: &str) -> Option<String>;
@ -67,7 +67,7 @@ pub trait InferCtxtExt<'tcx> {
obligation: &PredicateObligation<'tcx>,
err: &mut Diagnostic,
trait_pred: ty::PolyTraitPredicate<'tcx>,
);
) -> bool;
fn suggest_add_reference_to_arg(
&self,
@ -90,7 +90,7 @@ pub trait InferCtxtExt<'tcx> {
obligation: &PredicateObligation<'tcx>,
err: &mut Diagnostic,
trait_pred: ty::PolyTraitPredicate<'tcx>,
);
) -> bool;
fn suggest_remove_await(&self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic);
@ -107,7 +107,7 @@ pub trait InferCtxtExt<'tcx> {
err: &mut Diagnostic,
span: Span,
trait_pred: ty::PolyTraitPredicate<'tcx>,
);
) -> bool;
fn return_type_span(&self, obligation: &PredicateObligation<'tcx>) -> Option<Span>;
@ -502,54 +502,87 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
obligation: &PredicateObligation<'tcx>,
err: &mut Diagnostic,
trait_pred: ty::PolyTraitPredicate<'tcx>,
) {
) -> bool {
// It only make sense when suggesting dereferences for arguments
let code = if let ObligationCauseCode::FunctionArgumentObligation { parent_code, .. } =
obligation.cause.code()
{
parent_code.clone()
} else {
return;
let ObligationCauseCode::FunctionArgumentObligation { .. } = obligation.cause.code() else {
return false;
};
let param_env = obligation.param_env;
let body_id = obligation.cause.body_id;
let span = obligation.cause.span;
let real_trait_pred = match &*code {
ObligationCauseCode::ImplDerivedObligation(cause) => cause.derived.parent_trait_pred,
ObligationCauseCode::DerivedObligation(cause)
| ObligationCauseCode::BuiltinDerivedObligation(cause) => cause.parent_trait_pred,
_ => trait_pred,
};
let Some(real_ty) = real_trait_pred.self_ty().no_bound_vars() else {
return;
};
let mut real_trait_pred = trait_pred;
let mut code = obligation.cause.code();
loop {
match &code {
ObligationCauseCode::FunctionArgumentObligation { parent_code, .. } => {
code = &parent_code;
}
ObligationCauseCode::ImplDerivedObligation(box ImplDerivedObligationCause {
derived: DerivedObligationCause { parent_code, parent_trait_pred },
..
})
| ObligationCauseCode::BuiltinDerivedObligation(DerivedObligationCause {
parent_code,
parent_trait_pred,
})
| ObligationCauseCode::DerivedObligation(DerivedObligationCause {
parent_code,
parent_trait_pred,
}) => {
code = &parent_code;
real_trait_pred = *parent_trait_pred;
}
_ => break,
};
let Some(real_ty) = real_trait_pred.self_ty().no_bound_vars() else {
continue;
};
if let ty::Ref(region, base_ty, mutbl) = *real_ty.kind() {
let mut autoderef = Autoderef::new(self, param_env, body_id, span, base_ty, span);
if let Some(steps) = autoderef.find_map(|(ty, steps)| {
// Re-add the `&`
let ty = self.tcx.mk_ref(region, TypeAndMut { ty, mutbl });
let obligation =
self.mk_trait_obligation_with_new_self_ty(param_env, real_trait_pred, ty);
Some(steps).filter(|_| self.predicate_may_hold(&obligation))
}) {
if steps > 0 {
if let Ok(src) = self.tcx.sess.source_map().span_to_snippet(span) {
// Don't care about `&mut` because `DerefMut` is used less
// often and user will not expect autoderef happens.
if src.starts_with('&') && !src.starts_with("&mut ") {
let derefs = "*".repeat(steps);
err.span_suggestion(
span,
"consider adding dereference here",
format!("&{}{}", derefs, &src[1..]),
Applicability::MachineApplicable,
);
if let ty::Ref(region, base_ty, mutbl) = *real_ty.kind() {
let mut autoderef = Autoderef::new(self, param_env, body_id, span, base_ty, span);
if let Some(steps) = autoderef.find_map(|(ty, steps)| {
// Re-add the `&`
let ty = self.tcx.mk_ref(region, TypeAndMut { ty, mutbl });
let obligation =
self.mk_trait_obligation_with_new_self_ty(param_env, real_trait_pred, ty);
Some(steps).filter(|_| self.predicate_may_hold(&obligation))
}) {
if steps > 0 {
if let Ok(src) = self.tcx.sess.source_map().span_to_snippet(span) {
// Don't care about `&mut` because `DerefMut` is used less
// often and user will not expect autoderef happens.
if src.starts_with('&') && !src.starts_with("&mut ") {
let derefs = "*".repeat(steps);
err.span_suggestion(
span,
"consider dereferencing here",
format!("&{}{}", derefs, &src[1..]),
Applicability::MachineApplicable,
);
return true;
}
}
}
} else if real_trait_pred != trait_pred {
// This branch addresses #87437.
let obligation = self.mk_trait_obligation_with_new_self_ty(
param_env,
real_trait_pred,
base_ty,
);
if self.predicate_may_hold(&obligation) {
err.span_suggestion_verbose(
span.shrink_to_lo(),
"consider dereferencing here",
"*".to_string(),
Applicability::MachineApplicable,
);
return true;
}
}
}
}
false
}
/// Given a closure's `DefId`, return the given name of the closure.
@ -592,22 +625,22 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
obligation: &PredicateObligation<'tcx>,
err: &mut Diagnostic,
trait_pred: ty::PolyTraitPredicate<'tcx>,
) {
) -> bool {
let Some(self_ty) = trait_pred.self_ty().no_bound_vars() else {
return;
return false;
};
let (def_id, output_ty, callable) = match *self_ty.kind() {
ty::Closure(def_id, substs) => (def_id, substs.as_closure().sig().output(), "closure"),
ty::FnDef(def_id, _) => (def_id, self_ty.fn_sig(self.tcx).output(), "function"),
_ => return,
_ => return false,
};
let msg = format!("use parentheses to call the {}", callable);
// `mk_trait_obligation_with_new_self_ty` only works for types with no escaping bound
// variables, so bail out if we have any.
let Some(output_ty) = output_ty.no_bound_vars() else {
return;
return false;
};
let new_obligation =
@ -619,7 +652,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
| EvaluationResult::EvaluatedToOkModuloRegions
| EvaluationResult::EvaluatedToAmbig,
) => {}
_ => return,
_ => return false,
}
let hir = self.tcx.hir();
// Get the name of the callable and the arguments to be used in the suggestion.
@ -630,7 +663,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
})) => {
err.span_label(*span, "consider calling this closure");
let Some(name) = self.get_closure_name(def_id, err, &msg) else {
return;
return false;
};
let args = decl.inputs.iter().map(|_| "_").collect::<Vec<_>>().join(", ");
let sugg = format!("({})", args);
@ -658,7 +691,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
let sugg = format!("({})", args);
(format!("{}{}", ident, sugg), sugg)
}
_ => return,
_ => return false,
};
if matches!(obligation.cause.code(), ObligationCauseCode::FunctionArgumentObligation { .. })
{
@ -675,6 +708,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
} else {
err.help(&format!("{}: `{}`", msg, snippet));
}
true
}
fn suggest_add_reference_to_arg(
@ -845,19 +879,20 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
obligation: &PredicateObligation<'tcx>,
err: &mut Diagnostic,
trait_pred: ty::PolyTraitPredicate<'tcx>,
) {
) -> bool {
let span = obligation.cause.span;
let mut suggested = false;
if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) {
let refs_number =
snippet.chars().filter(|c| !c.is_whitespace()).take_while(|c| *c == '&').count();
if let Some('\'') = snippet.chars().filter(|c| !c.is_whitespace()).nth(refs_number) {
// Do not suggest removal of borrow from type arguments.
return;
return false;
}
let Some(mut suggested_ty) = trait_pred.self_ty().no_bound_vars() else {
return;
return false;
};
for refs_remaining in 0..refs_number {
@ -893,10 +928,12 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
String::new(),
Applicability::MachineApplicable,
);
suggested = true;
break;
}
}
}
suggested
}
fn suggest_remove_await(&self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic) {
@ -1033,7 +1070,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
err: &mut Diagnostic,
span: Span,
trait_pred: ty::PolyTraitPredicate<'tcx>,
) {
) -> bool {
let hir = self.tcx.hir();
let parent_node = hir.get_parent_node(obligation.cause.body_id);
let node = hir.find(parent_node);
@ -1052,7 +1089,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
{
let sp = self.tcx.sess.source_map().end_point(stmt.span);
err.span_label(sp, "consider removing this semicolon");
return true;
}
false
}
fn return_type_span(&self, obligation: &PredicateObligation<'tcx>) -> Option<Span> {

View file

@ -53,6 +53,7 @@
/// ```
#[lang = "fn"]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "Fn"]
#[rustc_paren_sugar]
#[rustc_on_unimplemented(
on(
@ -133,6 +134,7 @@ pub trait Fn<Args>: FnMut<Args> {
/// ```
#[lang = "fn_mut"]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "FnMut"]
#[rustc_paren_sugar]
#[rustc_on_unimplemented(
on(
@ -205,6 +207,7 @@ pub trait FnMut<Args>: FnOnce<Args> {
/// ```
#[lang = "fn_once"]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "FnOnce"]
#[rustc_paren_sugar]
#[rustc_on_unimplemented(
on(

View file

@ -140,6 +140,7 @@ mod private_slice_index {
/// Implementations of this trait have to promise that if the argument
/// to `get_(mut_)unchecked` is a safe reference, then so is the result.
#[stable(feature = "slice_get_slice", since = "1.28.0")]
#[rustc_diagnostic_item = "SliceIndex"]
#[rustc_on_unimplemented(
on(T = "str", label = "string indices are ranges of `usize`",),
on(

View file

@ -1,8 +1,8 @@
#[global_allocator]
static A: usize = 0;
//~^ the trait bound `usize:
//~| the trait bound `usize:
//~| the trait bound `usize:
//~| the trait bound `usize:
//~^ ERROR E0277
//~| ERROR E0277
//~| ERROR E0277
//~| ERROR E0277
fn main() {}

View file

@ -6,6 +6,7 @@ LL | #[global_allocator]
LL | static A: usize = 0;
| ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
|
= help: the trait `GlobalAlloc` is implemented for `System`
= note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
@ -16,6 +17,7 @@ LL | #[global_allocator]
LL | static A: usize = 0;
| ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
|
= help: the trait `GlobalAlloc` is implemented for `System`
= note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
@ -26,6 +28,7 @@ LL | #[global_allocator]
LL | static A: usize = 0;
| ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
|
= help: the trait `GlobalAlloc` is implemented for `System`
= note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
@ -36,6 +39,7 @@ LL | #[global_allocator]
LL | static A: usize = 0;
| ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
|
= help: the trait `GlobalAlloc` is implemented for `System`
= note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors

View file

@ -15,8 +15,7 @@ error[E0277]: the trait bound `u32: Foo` is not satisfied
LL | f1(2u32, 4u32);
| ^^ the trait `Foo` is not implemented for `u32`
|
= help: the following implementations were found:
<i32 as Foo>
= help: the trait `Foo` is implemented for `i32`
note: required by a bound in `f1`
--> $DIR/associated-types-path-2.rs:13:14
|
@ -29,8 +28,7 @@ error[E0277]: the trait bound `u32: Foo` is not satisfied
LL | f1(2u32, 4u32);
| ^^^^ the trait `Foo` is not implemented for `u32`
|
= help: the following implementations were found:
<i32 as Foo>
= help: the trait `Foo` is implemented for `i32`
error[E0277]: the trait bound `u32: Foo` is not satisfied
--> $DIR/associated-types-path-2.rs:35:8
@ -40,8 +38,7 @@ LL | f1(2u32, 4i32);
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<i32 as Foo>
= help: the trait `Foo` is implemented for `i32`
note: required by a bound in `f1`
--> $DIR/associated-types-path-2.rs:13:14
|
@ -54,8 +51,7 @@ error[E0277]: the trait bound `u32: Foo` is not satisfied
LL | f1(2u32, 4i32);
| ^^^^ the trait `Foo` is not implemented for `u32`
|
= help: the following implementations were found:
<i32 as Foo>
= help: the trait `Foo` is implemented for `i32`
error[E0308]: mismatched types
--> $DIR/associated-types-path-2.rs:41:18

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
LL | type U = str;
| ^^^ the trait `Clone` is not implemented for `str`
|
= help: the following implementations were found:
<String as Clone>
= help: the trait `Clone` is implemented for `String`
note: required by a bound in `X`
--> $DIR/hr-associated-type-bound-1.rs:3:33
|

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
LL | type V = str;
| ^^^ the trait `Clone` is not implemented for `str`
|
= help: the following implementations were found:
<String as Clone>
= help: the trait `Clone` is implemented for `String`
note: required by a bound in `Y`
--> $DIR/hr-associated-type-bound-param-1.rs:4:36
|

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
LL | T: Z<'a, u16>,
| ^^^^^^^^^^ the trait `Clone` is not implemented for `str`
|
= help: the following implementations were found:
<String as Clone>
= help: the trait `Clone` is implemented for `String`
note: required by a bound in `Z`
--> $DIR/hr-associated-type-bound-param-2.rs:6:35
|
@ -21,8 +20,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
LL | T: Z<'a, u16>,
| ^^^^^^^^^^ the trait `Clone` is not implemented for `str`
|
= help: the following implementations were found:
<String as Clone>
= help: the trait `Clone` is implemented for `String`
note: required by a bound in `Z`
--> $DIR/hr-associated-type-bound-param-2.rs:6:35
|
@ -38,8 +36,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
LL | type W = str;
| ^^^ the trait `Clone` is not implemented for `str`
|
= help: the following implementations were found:
<String as Clone>
= help: the trait `Clone` is implemented for `String`
note: required by a bound in `Z`
--> $DIR/hr-associated-type-bound-param-2.rs:6:35
|

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
LL | type U = str;
| ^^^ the trait `Clone` is not implemented for `str`
|
= help: the following implementations were found:
<String as Clone>
= help: the trait `Clone` is implemented for `String`
note: required by a bound in `X`
--> $DIR/hr-associated-type-bound-param-3.rs:4:33
|

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
LL | type U = str;
| ^^^ the trait `Clone` is not implemented for `str`
|
= help: the following implementations were found:
<String as Clone>
= help: the trait `Clone` is implemented for `String`
note: required by a bound in `X`
--> $DIR/hr-associated-type-bound-param-4.rs:4:36
|

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
LL | type U = str;
| ^^^ the trait `Clone` is not implemented for `str`
|
= help: the following implementations were found:
<String as Clone>
= help: the trait `Clone` is implemented for `String`
note: required by a bound in `X`
--> $DIR/hr-associated-type-bound-param-5.rs:17:45
|
@ -21,8 +20,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
LL | type U = str;
| ^^^ the trait `Clone` is not implemented for `str`
|
= help: the following implementations were found:
<String as Clone>
= help: the trait `Clone` is implemented for `String`
note: required by a bound in `X`
--> $DIR/hr-associated-type-bound-param-5.rs:17:45
|

View file

@ -4,6 +4,7 @@ error[E0277]: the trait bound `T: MyDisplay` is not satisfied
LL | type MpuConfig: MyDisplay = T;
| ^ the trait `MyDisplay` is not implemented for `T`
|
= help: the trait `MyDisplay` is implemented for `&'a mut T`
note: required by a bound in `MPU::MpuConfig`
--> $DIR/issue-65774-1.rs:10:21
|
@ -16,6 +17,7 @@ error[E0277]: the trait bound `T: MyDisplay` is not satisfied
LL | let closure = |config: &mut <S as MPU>::MpuConfig| writer.my_write(&config);
| ^^^^^^^ the trait `MyDisplay` is not implemented for `T`
|
= help: the trait `MyDisplay` is implemented for `&'a mut T`
note: required because of the requirements on the impl of `MyDisplay` for `&mut T`
--> $DIR/issue-65774-1.rs:5:24
|

View file

@ -4,6 +4,7 @@ error[E0277]: the trait bound `T: MyDisplay` is not satisfied
LL | type MpuConfig: MyDisplay = T;
| ^ the trait `MyDisplay` is not implemented for `T`
|
= help: the trait `MyDisplay` is implemented for `&'a mut T`
note: required by a bound in `MPU::MpuConfig`
--> $DIR/issue-65774-2.rs:10:21
|
@ -16,6 +17,7 @@ error[E0277]: the trait bound `T: MyDisplay` is not satisfied
LL | writer.my_write(valref)
| ^^^^^^ the trait `MyDisplay` is not implemented for `T`
|
= help: the trait `MyDisplay` is implemented for `&'a mut T`
= note: required for the cast to the object type `dyn MyDisplay`
error: aborting due to 2 previous errors

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `u32: Signed` is not satisfied
LL | is_defaulted::<&'static u32>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Signed` is not implemented for `u32`
|
= help: the following implementations were found:
<i32 as Signed>
= help: the trait `Signed` is implemented for `i32`
note: required because of the requirements on the impl of `Defaulted` for `&'static u32`
--> $DIR/typeck-default-trait-impl-precedence.rs:10:19
|

View file

@ -5,6 +5,16 @@ LL | x * y
| ^ no implementation for `i32 * f32`
|
= help: the trait `Mul<f32>` is not implemented for `i32`
= help: the following other types implement trait `Mul<Rhs>`:
<&'a f32 as Mul<f32>>
<&'a f64 as Mul<f64>>
<&'a i128 as Mul<i128>>
<&'a i16 as Mul<i16>>
<&'a i32 as Mul<i32>>
<&'a i64 as Mul<i64>>
<&'a i8 as Mul<i8>>
<&'a isize as Mul<isize>>
and 49 others
error: aborting due to previous error

View file

@ -16,6 +16,16 @@ LL | assert_eq!(foo, y);
| ^^^^^^^^^^^^^^^^^^ `for<'r> fn(&'r i32) -> &'r i32 {foo}` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= help: the trait `Debug` is not implemented for `for<'r> fn(&'r i32) -> &'r i32 {foo}`
= help: the following other types implement trait `Debug`:
extern "C" fn() -> Ret
extern "C" fn(A) -> Ret
extern "C" fn(A, ...) -> Ret
extern "C" fn(A, B) -> Ret
extern "C" fn(A, B, ...) -> Ret
extern "C" fn(A, B, C) -> Ret
extern "C" fn(A, B, C, ...) -> Ret
extern "C" fn(A, B, C, D) -> Ret
and 68 others
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors

View file

@ -5,6 +5,16 @@ LL | 22 >> p.char;
| ^^ no implementation for `{integer} >> char`
|
= help: the trait `Shr<char>` is not implemented for `{integer}`
= help: the following other types implement trait `Shr<Rhs>`:
<&'a i128 as Shr<i128>>
<&'a i128 as Shr<i16>>
<&'a i128 as Shr<i32>>
<&'a i128 as Shr<i64>>
<&'a i128 as Shr<i8>>
<&'a i128 as Shr<isize>>
<&'a i128 as Shr<u128>>
<&'a i128 as Shr<u16>>
and 568 others
error[E0277]: no implementation for `{integer} >> &str`
--> $DIR/shift-various-bad-types.rs:12:8
@ -13,6 +23,16 @@ LL | 22 >> p.str;
| ^^ no implementation for `{integer} >> &str`
|
= help: the trait `Shr<&str>` is not implemented for `{integer}`
= help: the following other types implement trait `Shr<Rhs>`:
<&'a i128 as Shr<i128>>
<&'a i128 as Shr<i16>>
<&'a i128 as Shr<i32>>
<&'a i128 as Shr<i64>>
<&'a i128 as Shr<i8>>
<&'a i128 as Shr<isize>>
<&'a i128 as Shr<u128>>
<&'a i128 as Shr<u16>>
and 568 others
error[E0277]: no implementation for `{integer} >> &Panolpy`
--> $DIR/shift-various-bad-types.rs:15:8
@ -21,6 +41,16 @@ LL | 22 >> p;
| ^^ no implementation for `{integer} >> &Panolpy`
|
= help: the trait `Shr<&Panolpy>` is not implemented for `{integer}`
= help: the following other types implement trait `Shr<Rhs>`:
<&'a i128 as Shr<i128>>
<&'a i128 as Shr<i16>>
<&'a i128 as Shr<i32>>
<&'a i128 as Shr<i64>>
<&'a i128 as Shr<i8>>
<&'a i128 as Shr<isize>>
<&'a i128 as Shr<u128>>
<&'a i128 as Shr<u16>>
and 568 others
error[E0308]: mismatched types
--> $DIR/shift-various-bad-types.rs:25:18

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `{integer}: Scalar` is not satisfied
LL | b + 3
| ^ the trait `Scalar` is not implemented for `{integer}`
|
= help: the following implementations were found:
<f64 as Scalar>
= help: the trait `Scalar` is implemented for `f64`
note: required because of the requirements on the impl of `Add<{integer}>` for `Bob`
--> $DIR/issue-22645.rs:8:19
|

View file

@ -4,9 +4,9 @@ error[E0277]: the trait bound `f32: Foo` is not satisfied
LL | gimme::<f32>();
| ^^^ the trait `Foo` is not implemented for `f32`
|
= help: the following implementations were found:
<i32 as Foo>
<u32 as Foo>
= help: the following other types implement trait `Foo`:
i32
u32
note: required by a bound in `gimme`
--> $DIR/chalk_initial_program.rs:9:13
|

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `(Option<T>, f32): Foo` is not satisfied
LL | gimme::<(Option<T>, f32)>();
| ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `(Option<T>, f32)`
|
= help: the following implementations were found:
<(T, u32) as Foo>
= help: the trait `Foo` is implemented for `(T, u32)`
note: required by a bound in `gimme`
--> $DIR/generic_impls.rs:7:13
|
@ -18,8 +17,7 @@ error[E0277]: the trait bound `(i32, f32): Foo` is not satisfied
LL | gimme::<(i32, f32)>();
| ^^^^^^^^^^ the trait `Foo` is not implemented for `(i32, f32)`
|
= help: the following implementations were found:
<(T, u32) as Foo>
= help: the trait `Foo` is implemented for `(T, u32)`
note: required by a bound in `gimme`
--> $DIR/generic_impls.rs:7:13
|

View file

@ -17,8 +17,7 @@ error[E0277]: the trait bound `f32: Foo` is not satisfied
LL | impl Baz<f32> for f32 { }
| ^^^^^^^^ the trait `Foo` is not implemented for `f32`
|
= help: the following implementations were found:
<i32 as Foo>
= help: the trait `Foo` is implemented for `i32`
note: required by a bound in `Baz`
--> $DIR/impl_wf.rs:18:31
|

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `f32: Foo` is not satisfied
LL | type Item = f32;
| ^^^ the trait `Foo` is not implemented for `f32`
|
= help: the following implementations were found:
<i32 as Foo>
= help: the trait `Foo` is implemented for `i32`
note: required by a bound in `Bar::Item`
--> $DIR/impl_wf_2.rs:8:16
|

View file

@ -6,9 +6,9 @@ LL | only_bar(x);
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<i32 as Bar>
<u32 as Bar>
= help: the following other types implement trait `Bar`:
i32
u32
note: required by a bound in `only_bar`
--> $DIR/type_inference.rs:12:16
|

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `{float}: Foo` is not satisfied
LL | let s = S {
| ^ the trait `Foo` is not implemented for `{float}`
|
= help: the following implementations were found:
<i32 as Foo>
= help: the trait `Foo` is implemented for `i32`
note: required by a bound in `S`
--> $DIR/type_wf.rs:6:13
|

View file

@ -4,6 +4,16 @@ error[E0277]: the trait bound `(): std::error::Error` is not satisfied
LL | /* *mut $0 is coerced to Box<dyn Error> here */ Box::<_ /* ! */>::new(x)
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()`
|
= help: the following other types implement trait `std::error::Error`:
!
&'a T
AccessError
AddrParseError
Arc<T>
BorrowError
BorrowMutError
Box<T>
and 42 others
= note: required for the cast to the object type `dyn std::error::Error`
error[E0277]: the trait bound `(): std::error::Error` is not satisfied
@ -12,6 +22,16 @@ error[E0277]: the trait bound `(): std::error::Error` is not satisfied
LL | /* *mut $0 is coerced to *mut Error here */ raw_ptr_box::<_ /* ! */>(x)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()`
|
= help: the following other types implement trait `std::error::Error`:
!
&'a T
AccessError
AddrParseError
Arc<T>
BorrowError
BorrowMutError
Box<T>
and 42 others
= note: required for the cast to the object type `(dyn std::error::Error + 'static)`
error: aborting due to 2 previous errors

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `u16: Bar<N>` is not satisfied
LL | type Assoc = u16;
| ^^^ the trait `Bar<N>` is not implemented for `u16`
|
= help: the following implementations were found:
<u16 as Bar<3_usize>>
= help: the trait `Bar<3_usize>` is implemented for `u16`
note: required by a bound in `Foo::Assoc`
--> $DIR/associated-type-bound-fail.rs:4:17
|

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `Uwu<10_u32, 12_u32>: Trait` is not satisfied
LL | fn rawr() -> impl Trait {
| ^^^^^^^^^^ the trait `Trait` is not implemented for `Uwu<10_u32, 12_u32>`
|
= help: the following implementations were found:
<Uwu<N> as Trait>
= help: the trait `Trait` is implemented for `Uwu<N>`
error[E0277]: the trait bound `Uwu<10_u32, 12_u32>: Trait` is not satisfied
--> $DIR/rp_impl_trait_fail.rs:6:25
@ -18,8 +17,7 @@ LL | | Uwu::<10, 12>
LL | | }
| |_^ the trait `Trait` is not implemented for `Uwu<10_u32, 12_u32>`
|
= help: the following implementations were found:
<Uwu<N> as Trait>
= help: the trait `Trait` is implemented for `Uwu<N>`
error[E0277]: the trait bound `u32: Traitor<N, N>` is not satisfied
--> $DIR/rp_impl_trait_fail.rs:18:26
@ -27,7 +25,7 @@ error[E0277]: the trait bound `u32: Traitor<N, N>` is not satisfied
LL | fn uwu<const N: u8>() -> impl Traitor<N> {
| ^^^^^^^^^^^^^^^ the trait `Traitor<N, N>` is not implemented for `u32`
|
= help: the following implementations were found:
= help: the following other types implement trait `Traitor<N, M>`:
<u32 as Traitor<N, 2_u8>>
<u64 as Traitor<1_u8, 2_u8>>
@ -42,7 +40,7 @@ LL | | 1_u32
LL | | }
| |_^ the trait `Traitor<N, N>` is not implemented for `u32`
|
= help: the following implementations were found:
= help: the following other types implement trait `Traitor<N, M>`:
<u32 as Traitor<N, 2_u8>>
<u64 as Traitor<1_u8, 2_u8>>
@ -52,9 +50,9 @@ error[E0277]: the trait bound `u64: Traitor<1_u8, 1_u8>` is not satisfied
LL | fn owo() -> impl Traitor {
| ^^^^^^^^^^^^ the trait `Traitor<1_u8, 1_u8>` is not implemented for `u64`
|
= help: the following implementations were found:
<u64 as Traitor<1_u8, 2_u8>>
= help: the following other types implement trait `Traitor<N, M>`:
<u32 as Traitor<N, 2_u8>>
<u64 as Traitor<1_u8, 2_u8>>
error[E0277]: the trait bound `u64: Traitor<1_u8, 1_u8>` is not satisfied
--> $DIR/rp_impl_trait_fail.rs:24:26
@ -67,9 +65,9 @@ LL | | 1_u64
LL | | }
| |_^ the trait `Traitor<1_u8, 1_u8>` is not implemented for `u64`
|
= help: the following implementations were found:
<u64 as Traitor<1_u8, 2_u8>>
= help: the following other types implement trait `Traitor<N, M>`:
<u32 as Traitor<N, 2_u8>>
<u64 as Traitor<1_u8, 2_u8>>
error: aborting due to 6 previous errors

View file

@ -6,8 +6,7 @@ LL | foo(&10_u32);
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<u32 as Trait<2_u8>>
= help: the trait `Trait<2_u8>` is implemented for `u32`
= note: required for the cast to the object type `dyn Trait`
error[E0277]: the trait bound `bool: Traitor<{_: u8}, {_: u8}>` is not satisfied
@ -18,8 +17,7 @@ LL | bar(&true);
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<bool as Traitor<2_u8, 3_u8>>
= help: the trait `Traitor<2_u8, 3_u8>` is implemented for `bool`
= note: required for the cast to the object type `dyn Traitor<{_: u8}, {_: u8}>`
error: aborting due to 2 previous errors

View file

@ -10,8 +10,7 @@ error[E0277]: the trait bound `(): Trait<2_u8>` is not satisfied
LL | struct WhereClause<const N: u8 = 2> where (): Trait<N>;
| ^^^^^^^^ the trait `Trait<2_u8>` is not implemented for `()`
|
= help: the following implementations were found:
<() as Trait<3_u8>>
= help: the trait `Trait<3_u8>` is implemented for `()`
error[E0277]: the trait bound `(): Trait<1_u8>` is not satisfied
--> $DIR/wfness.rs:14:13
@ -19,8 +18,7 @@ error[E0277]: the trait bound `(): Trait<1_u8>` is not satisfied
LL | fn foo() -> DependentDefaultWfness {
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<1_u8>` is not implemented for `()`
|
= help: the following implementations were found:
<() as Trait<3_u8>>
= help: the trait `Trait<3_u8>` is implemented for `()`
note: required by a bound in `WhereClause`
--> $DIR/wfness.rs:6:47
|

View file

@ -4,12 +4,16 @@ error[E0277]: the trait bound `(): Foo<N>` is not satisfied
LL | <() as Foo<N>>::test()
| ^^^^^^^^^^^^^^^^^^^^ the trait `Foo<N>` is not implemented for `()`
|
= help: the following implementations were found:
= help: the following other types implement trait `Foo<N>`:
<() as Foo<0_u8>>
<() as Foo<100_u8>>
<() as Foo<101_u8>>
<() as Foo<102_u8>>
and 252 others
<() as Foo<103_u8>>
<() as Foo<104_u8>>
<() as Foo<105_u8>>
<() as Foo<106_u8>>
and 248 others
error: aborting due to previous error

View file

@ -6,6 +6,7 @@ LL | writes_to_specific_path(&cap);
| |
| required by a bound introduced by this call
|
= help: the trait `Delegates<U>` is implemented for `T`
note: required because of the requirements on the impl of `Contains<(), true>` for `&C`
--> $DIR/issue-85848.rs:21:12
|

View file

@ -4,9 +4,9 @@ error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied
LL | <u8 as Baz>::Quaks: Bar,
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `[u16; 3]`
|
= help: the following implementations were found:
<[[u16; 3]; 3] as Bar>
<[u16; 4] as Bar>
= help: the following other types implement trait `Bar`:
[[u16; 3]; 3]
[u16; 4]
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
@ -16,9 +16,9 @@ error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied
LL | [<u8 as Baz>::Quaks; 2]: Bar,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
= help: the following implementations were found:
<[[u16; 3]; 3] as Bar>
<[u16; 4] as Bar>
= help: the following other types implement trait `Bar`:
[[u16; 3]; 3]
[u16; 4]
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
@ -28,9 +28,9 @@ error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied
LL | impl Foo for FooImpl {}
| ^^^ the trait `Bar` is not implemented for `[u16; 3]`
|
= help: the following implementations were found:
<[[u16; 3]; 3] as Bar>
<[u16; 4] as Bar>
= help: the following other types implement trait `Bar`:
[[u16; 3]; 3]
[u16; 4]
note: required by a bound in `Foo`
--> $DIR/issue-67185-2.rs:15:25
|
@ -46,9 +46,9 @@ error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied
LL | impl Foo for FooImpl {}
| ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
= help: the following implementations were found:
<[[u16; 3]; 3] as Bar>
<[u16; 4] as Bar>
= help: the following other types implement trait `Bar`:
[[u16; 3]; 3]
[u16; 4]
note: required by a bound in `Foo`
--> $DIR/issue-67185-2.rs:14:30
|
@ -64,9 +64,9 @@ error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied
LL | fn f(_: impl Foo) {}
| ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
= help: the following implementations were found:
<[[u16; 3]; 3] as Bar>
<[u16; 4] as Bar>
= help: the following other types implement trait `Bar`:
[[u16; 3]; 3]
[u16; 4]
note: required by a bound in `Foo`
--> $DIR/issue-67185-2.rs:14:30
|
@ -82,9 +82,9 @@ error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied
LL | fn f(_: impl Foo) {}
| ^^^ the trait `Bar` is not implemented for `[u16; 3]`
|
= help: the following implementations were found:
<[[u16; 3]; 3] as Bar>
<[u16; 4] as Bar>
= help: the following other types implement trait `Bar`:
[[u16; 3]; 3]
[u16; 4]
note: required by a bound in `Foo`
--> $DIR/issue-67185-2.rs:15:25
|

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `A<{_: usize}>: Bar<{_: usize}>` is not satisfied
LL | let _ = A;
| ^ the trait `Bar<{_: usize}>` is not implemented for `A<{_: usize}>`
|
= help: the following implementations were found:
<A<7_usize> as Bar<N>>
= help: the trait `Bar<N>` is implemented for `A<7_usize>`
note: required by a bound in `A`
--> $DIR/unused-substs-1.rs:9:11
|

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `Option<Bar>: Copy` is not satisfied
LL | let _: [Option<Bar>; 2] = [no_copy(); 2];
| ^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Option<Bar>`
|
= help: the following implementations were found:
<Option<T> as Copy>
= help: the trait `Copy` is implemented for `Option<T>`
= note: the `Copy` trait is required because the repeated element will be copied
= help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];`
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `Option<Bar>: Copy` is not satisfied
LL | let arr: [Option<Bar>; 2] = [x; 2];
| ^^^^^^ the trait `Copy` is not implemented for `Option<Bar>`
|
= help: the following implementations were found:
<Option<T> as Copy>
= help: the trait `Copy` is implemented for `Option<T>`
= note: the `Copy` trait is required because the repeated element will be copied
error[E0277]: the trait bound `Option<Bar>: Copy` is not satisfied
@ -14,8 +13,7 @@ error[E0277]: the trait bound `Option<Bar>: Copy` is not satisfied
LL | let arr: [Option<Bar>; 2] = [x; 2];
| ^^^^^^ the trait `Copy` is not implemented for `Option<Bar>`
|
= help: the following implementations were found:
<Option<T> as Copy>
= help: the trait `Copy` is implemented for `Option<T>`
= note: the `Copy` trait is required because the repeated element will be copied
error: aborting due to 2 previous errors

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `Option<Bar>: Copy` is not satisfied
LL | let arr: [Option<Bar>; 2] = [x; 2];
| ^^^^^^ the trait `Copy` is not implemented for `Option<Bar>`
|
= help: the following implementations were found:
<Option<T> as Copy>
= help: the trait `Copy` is implemented for `Option<T>`
= note: the `Copy` trait is required because the repeated element will be copied
error[E0277]: the trait bound `Option<Bar>: Copy` is not satisfied
@ -14,8 +13,7 @@ error[E0277]: the trait bound `Option<Bar>: Copy` is not satisfied
LL | let arr: [Option<Bar>; 2] = [x; 2];
| ^^^^^^ the trait `Copy` is not implemented for `Option<Bar>`
|
= help: the following implementations were found:
<Option<T> as Copy>
= help: the trait `Copy` is implemented for `Option<T>`
= note: the `Copy` trait is required because the repeated element will be copied
error: aborting due to 2 previous errors

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `Foo<String>: Copy` is not satisfied
LL | [Foo(String::new()); 4];
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Foo<String>`
|
= help: the following implementations were found:
<Foo<T> as Copy>
= help: the trait `Copy` is implemented for `Foo<T>`
= note: the `Copy` trait is required because the repeated element will be copied
error: aborting due to previous error

View file

@ -11,6 +11,16 @@ LL | = [0; (i8::MAX + 1u8) as usize];
| ^ no implementation for `i8 + u8`
|
= help: the trait `Add<u8>` is not implemented for `i8`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error: aborting due to 2 previous errors

View file

@ -11,6 +11,16 @@ LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
| ^ no implementation for `i8 + u8`
|
= help: the trait `Add<u8>` is not implemented for `i8`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error[E0604]: only `u8` can be cast as `char`, not `i8`
--> $DIR/const-eval-overflow-4b.rs:22:13

View file

@ -21,6 +21,16 @@ LL | [5; Self::HOST_SIZE] == [6; 0]
| ^^ no implementation for `[{integer}; _] == [{integer}; 0]`
|
= help: the trait `PartialEq<[{integer}; 0]>` is not implemented for `[{integer}; _]`
= help: the following other types implement trait `PartialEq<Rhs>`:
<&[B] as PartialEq<[A; N]>>
<&[T] as PartialEq<Vec<U, A>>>
<&mut [B] as PartialEq<[A; N]>>
<&mut [T] as PartialEq<Vec<U, A>>>
<[A; N] as PartialEq<&[B]>>
<[A; N] as PartialEq<&mut [B]>>
<[A; N] as PartialEq<[B; N]>>
<[A; N] as PartialEq<[B]>>
and 3 others
error: aborting due to 3 previous errors

View file

@ -4,7 +4,7 @@ error[E0277]: the trait bound `Bar: Foo<usize>` is not satisfied
LL | f1.foo(1usize);
| ^^^ the trait `Foo<usize>` is not implemented for `Bar`
|
= help: the following implementations were found:
= help: the following other types implement trait `Foo<A>`:
<Bar as Foo<i32>>
<Bar as Foo<u8>>

View file

@ -4,12 +4,13 @@ error[E0277]: the trait bound `Bar: Foo<usize>` is not satisfied
LL | f1.foo(1usize);
| ^^^ the trait `Foo<usize>` is not implemented for `Bar`
|
= help: the following implementations were found:
= help: the following other types implement trait `Foo<A>`:
<Bar as Foo<i16>>
<Bar as Foo<i32>>
<Bar as Foo<i8>>
<Bar as Foo<u16>>
and 2 others
<Bar as Foo<u32>>
<Bar as Foo<u8>>
error: aborting due to previous error

View file

@ -6,12 +6,16 @@ LL | Foo::<i32>::bar(&1i8);
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
= help: the following other types implement trait `Foo<B>`:
<i8 as Foo<bool>>
<i8 as Foo<u16>>
<i8 as Foo<u32>>
<i8 as Foo<u64>>
and 5 others
<i8 as Foo<u8>>
<u8 as Foo<bool>>
<u8 as Foo<u16>>
<u8 as Foo<u32>>
<u8 as Foo<u64>>
error[E0277]: the trait bound `u8: Foo<i32>` is not satisfied
--> $DIR/issue-39802-show-5-trait-impls.rs:25:21
@ -21,12 +25,16 @@ LL | Foo::<i32>::bar(&1u8);
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
= help: the following other types implement trait `Foo<B>`:
<i8 as Foo<bool>>
<i8 as Foo<u16>>
<i8 as Foo<u32>>
<i8 as Foo<u64>>
<i8 as Foo<u8>>
<u8 as Foo<bool>>
<u8 as Foo<u16>>
<u8 as Foo<u32>>
<u8 as Foo<u64>>
and 5 others
error[E0277]: the trait bound `bool: Foo<i32>` is not satisfied
--> $DIR/issue-39802-show-5-trait-impls.rs:26:21
@ -36,12 +44,13 @@ LL | Foo::<i32>::bar(&true);
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
= help: the following other types implement trait `Foo<B>`:
<bool as Foo<bool>>
<bool as Foo<i8>>
<bool as Foo<u16>>
<bool as Foo<u32>>
and 2 others
<bool as Foo<u64>>
<bool as Foo<u8>>
error: aborting due to 3 previous errors

View file

@ -22,6 +22,16 @@ LL | const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e11; // m³⋅kg⁻¹
| ^ no implementation for `{float} - {integer}`
|
= help: the trait `Sub<{integer}>` is not implemented for `{float}`
= help: the following other types implement trait `Sub<Rhs>`:
<&'a f32 as Sub<f32>>
<&'a f64 as Sub<f64>>
<&'a i128 as Sub<i128>>
<&'a i16 as Sub<i16>>
<&'a i32 as Sub<i32>>
<&'a i64 as Sub<i64>>
<&'a i8 as Sub<i8>>
<&'a isize as Sub<isize>>
and 48 others
error: aborting due to 3 previous errors

View file

@ -4,6 +4,7 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied
LL | enum E where i32: Foo { V }
| ^^^^^^^^ the trait `Foo` is not implemented for `i32`
|
= help: the trait `Foo` is implemented for `()`
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
@ -13,6 +14,7 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied
LL | struct S where i32: Foo;
| ^^^^^^^^ the trait `Foo` is not implemented for `i32`
|
= help: the trait `Foo` is implemented for `()`
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
@ -22,6 +24,7 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied
LL | trait T where i32: Foo {}
| ^^^^^^^^ the trait `Foo` is not implemented for `i32`
|
= help: the trait `Foo` is implemented for `()`
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
@ -31,6 +34,7 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied
LL | union U where i32: Foo { f: i32 }
| ^^^^^^^^ the trait `Foo` is not implemented for `i32`
|
= help: the trait `Foo` is implemented for `()`
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
@ -40,6 +44,7 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied
LL | impl Foo for () where i32: Foo {
| ^^^^^^^^ the trait `Foo` is not implemented for `i32`
|
= help: the trait `Foo` is implemented for `()`
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
@ -49,6 +54,7 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied
LL | fn f() where i32: Foo
| ^^^^^^^^ the trait `Foo` is not implemented for `i32`
|
= help: the trait `Foo` is implemented for `()`
= help: see issue #48214
= help: add `#![feature(trivial_bounds)]` to the crate attributes to enable

View file

@ -4,6 +4,16 @@ error[E0277]: the trait bound `str: UpperHex` is not satisfied
LL | format!("{:X}", "3");
| ^^^ the trait `UpperHex` is not implemented for `str`
|
= help: the following other types implement trait `UpperHex`:
&T
&mut T
NonZeroI128
NonZeroI16
NonZeroI32
NonZeroI64
NonZeroI8
NonZeroIsize
and 21 others
= note: required because of the requirements on the impl of `UpperHex` for `&str`
note: required by a bound in `ArgumentV1::<'a>::new_upper_hex`
--> $SRC_DIR/core/src/fmt/mod.rs:LL:COL

View file

@ -4,6 +4,7 @@ error[E0277]: the trait bound `for<'a> <_ as Trait>::Assoc<'a>: Marker` is not s
LL | test(Foo);
| ^^^^ the trait `for<'a> Marker` is not implemented for `<_ as Trait>::Assoc<'a>`
|
= help: the trait `Marker` is implemented for `()`
note: required by a bound in `test`
--> $DIR/issue-88460.rs:17:27
|

View file

@ -7,6 +7,7 @@ LL | Err("whoops")?;
| ^ the trait `From<&str>` is not implemented for `impl Debug`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the trait `FromResidual<Result<Infallible, E>>` is implemented for `Result<T, F>`
= note: required because of the requirements on the impl of `FromResidual<Result<Infallible, &str>>` for `Result<(), impl Debug>`
error[E0277]: the trait bound `impl Debug: From<&str>` is not satisfied

View file

@ -24,6 +24,16 @@ LL | n + sum_to(n - 1)
| ^ no implementation for `u32 + impl Foo`
|
= help: the trait `Add<impl Foo>` is not implemented for `u32`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error: aborting due to 2 previous errors; 1 warning emitted

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied
LL | WrongImpl::foo(0i32);
| ^^^^^^^^^ the trait `Raw<_>` is not implemented for `RawImpl<_>`
|
= help: the following implementations were found:
<RawImpl<T> as Raw<[T]>>
= help: the trait `Raw<[T]>` is implemented for `RawImpl<T>`
note: required by a bound in `SafeImpl`
--> $DIR/issue-62742.rs:26:35
|
@ -40,8 +39,7 @@ error[E0277]: the trait bound `RawImpl<()>: Raw<()>` is not satisfied
LL | WrongImpl::<()>::foo(0i32);
| ^^^^^^^^^^^^^^^ the trait `Raw<()>` is not implemented for `RawImpl<()>`
|
= help: the following implementations were found:
<RawImpl<T> as Raw<[T]>>
= help: the trait `Raw<[T]>` is implemented for `RawImpl<T>`
note: required by a bound in `SafeImpl`
--> $DIR/issue-62742.rs:26:35
|

View file

@ -4,6 +4,7 @@ error[E0277]: the trait bound `Sendable: Duh` is not satisfied
LL | fn foo() -> impl Trait<Assoc = Sendable> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Duh` is not implemented for `Sendable`
|
= help: the trait `Duh` is implemented for `i32`
note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait.rs:28:5: 28:10]`
--> $DIR/nested-return-type2-tait.rs:14:31
|
@ -21,6 +22,7 @@ LL | | || 42
LL | | }
| |_^ the trait `Duh` is not implemented for `Sendable`
|
= help: the trait `Duh` is implemented for `i32`
note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait.rs:28:5: 28:10]`
--> $DIR/nested-return-type2-tait.rs:14:31
|

View file

@ -4,6 +4,7 @@ error[E0277]: the trait bound `Sendable: Duh` is not satisfied
LL | || 42
| ^^^^^ the trait `Duh` is not implemented for `Sendable`
|
= help: the trait `Duh` is implemented for `i32`
note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait2.rs:27:5: 27:10]`
--> $DIR/nested-return-type2-tait2.rs:14:31
|

View file

@ -4,6 +4,7 @@ error[E0277]: the trait bound `impl Send: Duh` is not satisfied
LL | || 42
| ^^^^^ the trait `Duh` is not implemented for `impl Send`
|
= help: the trait `Duh` is implemented for `i32`
note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait3.rs:26:5: 26:10]`
--> $DIR/nested-return-type2-tait3.rs:14:31
|

View file

@ -52,6 +52,7 @@ error[E0277]: the trait bound `impl Debug: From<impl Into<u32>>` is not satisfie
LL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
| ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Debug`
|
= help: the trait `Into<U>` is implemented for `T`
= note: required because of the requirements on the impl of `Into<impl Debug>` for `impl Into<u32>`
error[E0277]: the trait bound `impl Debug: From<impl Into<u32>>` is not satisfied
@ -60,6 +61,7 @@ error[E0277]: the trait bound `impl Debug: From<impl Into<u32>>` is not satisfie
LL | fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
| ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Debug`
|
= help: the trait `Into<U>` is implemented for `T`
= note: required because of the requirements on the impl of `Into<impl Debug>` for `impl Into<u32>`
error: aborting due to 8 previous errors

View file

@ -5,6 +5,7 @@ LL | Bar
| ^^^ no implementation for `Bar == (Bar, i32)`
|
= help: the trait `PartialEq<(Bar, i32)>` is not implemented for `Bar`
= help: the trait `PartialEq<(Foo, i32)>` is implemented for `Bar`
error: aborting due to previous error

View file

@ -5,6 +5,7 @@ LL | x[0i32];
| ^^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[{integer}]>` is not implemented for `i32`
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
= note: required because of the requirements on the impl of `Index<i32>` for `Vec<{integer}>`
error: aborting due to previous error

View file

@ -5,6 +5,7 @@ LL | [0][0u8];
| ^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[{integer}]>` is not implemented for `u8`
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
= note: required because of the requirements on the impl of `Index<u8>` for `[{integer}]`
error[E0308]: mismatched types

View file

@ -5,6 +5,7 @@ LL | v[3u8];
| ^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[isize]>` is not implemented for `u8`
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
= note: required because of the requirements on the impl of `Index<u8>` for `Vec<isize>`
error[E0277]: the type `[isize]` cannot be indexed by `i8`
@ -14,6 +15,7 @@ LL | v[3i8];
| ^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[isize]>` is not implemented for `i8`
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
= note: required because of the requirements on the impl of `Index<i8>` for `Vec<isize>`
error[E0277]: the type `[isize]` cannot be indexed by `u32`
@ -23,6 +25,7 @@ LL | v[3u32];
| ^^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[isize]>` is not implemented for `u32`
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
= note: required because of the requirements on the impl of `Index<u32>` for `Vec<isize>`
error[E0277]: the type `[isize]` cannot be indexed by `i32`
@ -32,6 +35,7 @@ LL | v[3i32];
| ^^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[isize]>` is not implemented for `i32`
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
= note: required because of the requirements on the impl of `Index<i32>` for `Vec<isize>`
error[E0277]: the type `[u8]` cannot be indexed by `u8`
@ -41,6 +45,7 @@ LL | s.as_bytes()[3u8];
| ^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[u8]>` is not implemented for `u8`
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
= note: required because of the requirements on the impl of `Index<u8>` for `[u8]`
error[E0277]: the type `[u8]` cannot be indexed by `i8`
@ -50,6 +55,7 @@ LL | s.as_bytes()[3i8];
| ^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[u8]>` is not implemented for `i8`
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
= note: required because of the requirements on the impl of `Index<i8>` for `[u8]`
error[E0277]: the type `[u8]` cannot be indexed by `u32`
@ -59,6 +65,7 @@ LL | s.as_bytes()[3u32];
| ^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[u8]>` is not implemented for `u32`
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
= note: required because of the requirements on the impl of `Index<u32>` for `[u8]`
error[E0277]: the type `[u8]` cannot be indexed by `i32`
@ -68,6 +75,7 @@ LL | s.as_bytes()[3i32];
| ^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[u8]>` is not implemented for `i32`
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
= note: required because of the requirements on the impl of `Index<i32>` for `[u8]`
error: aborting due to 8 previous errors

View file

@ -5,6 +5,16 @@ LL | 1 +
| ^ no implementation for `{integer} + ()`
|
= help: the trait `Add<()>` is not implemented for `{integer}`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error[E0277]: cannot add `()` to `{integer}`
--> $DIR/issue-11771.rs:8:7
@ -13,6 +23,16 @@ LL | 1 +
| ^ no implementation for `{integer} + ()`
|
= help: the trait `Add<()>` is not implemented for `{integer}`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error: aborting due to 2 previous errors

View file

@ -5,6 +5,16 @@ LL | 1.0f64 - 1
| ^ no implementation for `f64 - {integer}`
|
= help: the trait `Sub<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Sub<Rhs>`:
<&'a f32 as Sub<f32>>
<&'a f64 as Sub<f64>>
<&'a i128 as Sub<i128>>
<&'a i16 as Sub<i16>>
<&'a i32 as Sub<i32>>
<&'a i64 as Sub<i64>>
<&'a i8 as Sub<i8>>
<&'a isize as Sub<isize>>
and 48 others
help: consider using a floating-point literal by writing it with `.0`
|
LL | 1.0f64 - 1.0

View file

@ -7,6 +7,7 @@ LL | Err(5)?;
| ^ the trait `From<{integer}>` is not implemented for `()`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the trait `FromResidual<Result<Infallible, E>>` is implemented for `Result<T, F>`
= note: required because of the requirements on the impl of `FromResidual<Result<Infallible, {integer}>>` for `Result<i32, ()>`
error: aborting due to previous error

View file

@ -19,6 +19,7 @@ LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_rece
| ^^^^^^^ value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator<Item=()>`
|
= help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>`
= help: the trait `FromIterator<T>` is implemented for `Vec<T>`
note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
|

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `Params: Plugin<i32>` is not satisfied
LL | req.get_ref::<Params>();
| ^^^^^^^ the trait `Plugin<i32>` is not implemented for `Params`
|
= help: the following implementations were found:
<Params as Plugin<Foo>>
= help: the trait `Plugin<Foo>` is implemented for `Params`
error: aborting due to previous error

View file

@ -14,6 +14,16 @@ LL | Vec::<[(); 1 + for x in 0..1 {}]>::new();
| ^ no implementation for `{integer} + ()`
|
= help: the trait `Add<()>` is not implemented for `{integer}`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error: aborting due to 2 previous errors

View file

@ -94,6 +94,16 @@ LL | assert_eq!(Foo::Bar, i);
| ^^^^^^^^^^^^^^^^^^^^^^^ `fn(usize) -> Foo {Foo::Bar}` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= help: the trait `Debug` is not implemented for `fn(usize) -> Foo {Foo::Bar}`
= help: the following other types implement trait `Debug`:
extern "C" fn() -> Ret
extern "C" fn(A) -> Ret
extern "C" fn(A, ...) -> Ret
extern "C" fn(A, B) -> Ret
extern "C" fn(A, B, ...) -> Ret
extern "C" fn(A, B, C) -> Ret
extern "C" fn(A, B, C, ...) -> Ret
extern "C" fn(A, B, C, D) -> Ret
and 68 others
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 9 previous errors

View file

@ -5,6 +5,7 @@ LL | let x2: Vec<f64> = x1.into_iter().collect();
| ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
|
= help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>`
= help: the trait `FromIterator<T>` is implemented for `Vec<T>`
note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
|
@ -18,6 +19,7 @@ LL | let x3 = x1.into_iter().collect::<Vec<f64>>();
| ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>`
|
= help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>`
= help: the trait `FromIterator<T>` is implemented for `Vec<T>`
note: required by a bound in `collect`
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
|

View file

@ -4,12 +4,16 @@ error[E0277]: the trait bound `&'static mut isize: Copy` is not satisfied
LL | assert_copy::<&'static mut isize>();
| ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `&'static mut isize`
|
= help: the following implementations were found:
<isize as Copy>
<f32 as Copy>
<f64 as Copy>
<i128 as Copy>
and 10 others
= help: the following other types implement trait `Copy`:
f32
f64
i128
i16
i32
i64
i8
isize
and 6 others
note: required by a bound in `assert_copy`
--> $DIR/kindck-copy.rs:5:18
|
@ -22,12 +26,16 @@ error[E0277]: the trait bound `&'a mut isize: Copy` is not satisfied
LL | assert_copy::<&'a mut isize>();
| ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `&'a mut isize`
|
= help: the following implementations were found:
<isize as Copy>
<f32 as Copy>
<f64 as Copy>
<i128 as Copy>
and 10 others
= help: the following other types implement trait `Copy`:
f32
f64
i128
i16
i32
i64
i8
isize
and 6 others
note: required by a bound in `assert_copy`
--> $DIR/kindck-copy.rs:5:18
|

View file

@ -72,6 +72,7 @@ error[E0277]: the trait bound `String: Copy` is not satisfied
LL | let a = t as Box<dyn Gettable<String>>;
| ^ the trait `Copy` is not implemented for `String`
|
= help: the trait `Gettable<T>` is implemented for `S<T>`
note: required because of the requirements on the impl of `Gettable<String>` for `S<String>`
--> $DIR/kindck-impl-type-params.rs:14:32
|
@ -85,6 +86,7 @@ error[E0277]: the trait bound `Foo: Copy` is not satisfied
LL | let a: Box<dyn Gettable<Foo>> = t;
| ^ the trait `Copy` is not implemented for `Foo`
|
= help: the trait `Gettable<T>` is implemented for `S<T>`
note: required because of the requirements on the impl of `Gettable<Foo>` for `S<Foo>`
--> $DIR/kindck-impl-type-params.rs:14:32
|

View file

@ -80,6 +80,7 @@ error[E0277]: the trait bound `String: Copy` is not satisfied
LL | let a = t as Box<dyn Gettable<String>>;
| ^ the trait `Copy` is not implemented for `String`
|
= help: the trait `Gettable<T>` is implemented for `S<T>`
note: required because of the requirements on the impl of `Gettable<String>` for `S<String>`
--> $DIR/kindck-impl-type-params.rs:14:32
|
@ -93,6 +94,7 @@ error[E0277]: the trait bound `Foo: Copy` is not satisfied
LL | let a: Box<dyn Gettable<Foo>> = t;
| ^ the trait `Copy` is not implemented for `Foo`
|
= help: the trait `Gettable<T>` is implemented for `S<T>`
note: required because of the requirements on the impl of `Gettable<Foo>` for `S<Foo>`
--> $DIR/kindck-impl-type-params.rs:14:32
|

View file

@ -38,6 +38,16 @@ LL | if x == y {}
| ^^ no implementation for `&str == char`
|
= help: the trait `PartialEq<char>` is not implemented for `&str`
= help: the following other types implement trait `PartialEq<Rhs>`:
<&'a str as PartialEq<OsString>>
<&'a str as PartialEq<String>>
<&'b str as PartialEq<Cow<'a, str>>>
<String as PartialEq<&'a str>>
<String as PartialEq<Cow<'a, str>>>
<String as PartialEq<str>>
<String as PartialEq>
<str as PartialEq<Cow<'a, str>>>
and 4 others
error[E0308]: mismatched types
--> $DIR/lex-bad-char-literals-6.rs:15:20
@ -54,6 +64,16 @@ LL | if x == z {}
| ^^ no implementation for `&str == char`
|
= help: the trait `PartialEq<char>` is not implemented for `&str`
= help: the following other types implement trait `PartialEq<Rhs>`:
<&'a str as PartialEq<OsString>>
<&'a str as PartialEq<String>>
<&'b str as PartialEq<Cow<'a, str>>>
<String as PartialEq<&'a str>>
<String as PartialEq<Cow<'a, str>>>
<String as PartialEq<str>>
<String as PartialEq>
<str as PartialEq<Cow<'a, str>>>
and 4 others
error: aborting due to 6 previous errors

View file

@ -5,6 +5,16 @@ LL | 1 + Some(1);
| ^ no implementation for `{integer} + Option<{integer}>`
|
= help: the trait `Add<Option<{integer}>>` is not implemented for `{integer}`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error[E0277]: cannot subtract `Option<{integer}>` from `usize`
--> $DIR/binops.rs:3:16
@ -13,6 +23,16 @@ LL | 2 as usize - Some(1);
| ^ no implementation for `usize - Option<{integer}>`
|
= help: the trait `Sub<Option<{integer}>>` is not implemented for `usize`
= help: the following other types implement trait `Sub<Rhs>`:
<&'a f32 as Sub<f32>>
<&'a f64 as Sub<f64>>
<&'a i128 as Sub<i128>>
<&'a i16 as Sub<i16>>
<&'a i32 as Sub<i32>>
<&'a i64 as Sub<i64>>
<&'a i8 as Sub<i8>>
<&'a isize as Sub<isize>>
and 48 others
error[E0277]: cannot multiply `{integer}` by `()`
--> $DIR/binops.rs:4:7
@ -21,6 +41,16 @@ LL | 3 * ();
| ^ no implementation for `{integer} * ()`
|
= help: the trait `Mul<()>` is not implemented for `{integer}`
= help: the following other types implement trait `Mul<Rhs>`:
<&'a f32 as Mul<f32>>
<&'a f64 as Mul<f64>>
<&'a i128 as Mul<i128>>
<&'a i16 as Mul<i16>>
<&'a i32 as Mul<i32>>
<&'a i64 as Mul<i64>>
<&'a i8 as Mul<i8>>
<&'a isize as Mul<isize>>
and 49 others
error[E0277]: cannot divide `{integer}` by `&str`
--> $DIR/binops.rs:5:7
@ -29,6 +59,16 @@ LL | 4 / "";
| ^ no implementation for `{integer} / &str`
|
= help: the trait `Div<&str>` is not implemented for `{integer}`
= help: the following other types implement trait `Div<Rhs>`:
<&'a f32 as Div<f32>>
<&'a f64 as Div<f64>>
<&'a i128 as Div<i128>>
<&'a i16 as Div<i16>>
<&'a i32 as Div<i32>>
<&'a i64 as Div<i64>>
<&'a i8 as Div<i8>>
<&'a isize as Div<isize>>
and 54 others
error[E0277]: can't compare `{integer}` with `String`
--> $DIR/binops.rs:6:7
@ -37,6 +77,16 @@ LL | 5 < String::new();
| ^ no implementation for `{integer} < String` and `{integer} > String`
|
= help: the trait `PartialOrd<String>` is not implemented for `{integer}`
= help: the following other types implement trait `PartialOrd<Rhs>`:
f32
f64
i128
i16
i32
i64
i8
isize
and 6 others
error[E0277]: can't compare `{integer}` with `Result<{integer}, _>`
--> $DIR/binops.rs:7:7
@ -45,6 +95,16 @@ LL | 6 == Ok(1);
| ^^ no implementation for `{integer} == Result<{integer}, _>`
|
= help: the trait `PartialEq<Result<{integer}, _>>` is not implemented for `{integer}`
= help: the following other types implement trait `PartialEq<Rhs>`:
f32
f64
i128
i16
i32
i64
i8
isize
and 6 others
error: aborting due to 6 previous errors

View file

@ -4,7 +4,7 @@ error[E0277]: the trait bound `!: ImplementedForUnitButNotNever` is not satisfie
LL | foo(_x);
| ^^^ the trait `ImplementedForUnitButNotNever` is not implemented for `!`
|
= note: this trait is implemented for `()`
= help: the trait `ImplementedForUnitButNotNever` is implemented for `()`
= note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information)
= help: did you intend to use the type `()` here instead?
note: required by a bound in `foo`

View file

@ -30,7 +30,7 @@ fn smeg() {
foo(_x);
//[fallback]~^ ERROR the trait bound
//[fallback]~| NOTE the trait `ImplementedForUnitButNotNever` is not implemented
//[fallback]~| NOTE this trait is implemented for `()`
//[fallback]~| HELP trait `ImplementedForUnitButNotNever` is implemented for `()`
//[fallback]~| NOTE this error might have been caused
//[fallback]~| HELP did you intend
}

View file

@ -4,7 +4,9 @@ error[E0277]: the trait bound `!: Test` is not satisfied
LL | unconstrained_arg(return);
| ^^^^^^^^^^^^^^^^^ the trait `Test` is not implemented for `!`
|
= note: this trait is implemented for `()`
= help: the following other types implement trait `Test`:
()
i32
= note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #48950 <https://github.com/rust-lang/rust/issues/48950> for more information)
= help: did you intend to use the type `()` here instead?
note: required by a bound in `unconstrained_arg`

View file

@ -3,6 +3,8 @@ error[E0277]: the trait bound `(): T` is not satisfied
|
LL | fn should_ret_unit() -> impl T {
| ^^^^^^ the trait `T` is not implemented for `()`
|
= help: the trait `T` is implemented for `i32`
error: aborting due to previous error

View file

@ -5,6 +5,16 @@ LL | 2_usize + (loop {});
| ^ no implementation for `usize + ()`
|
= help: the trait `Add<()>` is not implemented for `usize`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error: aborting due to previous error

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `E: From<()>` is not satisfied
LL | <E as From<_>>::from(never);
| ^^^^^^^^^^^^^^^^^^^^ the trait `From<()>` is not implemented for `E`
|
= help: the following implementations were found:
<E as From<!>>
= help: the trait `From<!>` is implemented for `E`
error: aborting due to previous error

View file

@ -5,6 +5,16 @@ LL | x + 100.0
| ^ no implementation for `u8 + {float}`
|
= help: the trait `Add<{float}>` is not implemented for `u8`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error[E0277]: cannot add `&str` to `f64`
--> $DIR/not-suggest-float-literal.rs:6:7
@ -13,6 +23,16 @@ LL | x + "foo"
| ^ no implementation for `f64 + &str`
|
= help: the trait `Add<&str>` is not implemented for `f64`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error[E0277]: cannot add `{integer}` to `f64`
--> $DIR/not-suggest-float-literal.rs:11:7
@ -21,6 +41,16 @@ LL | x + y
| ^ no implementation for `f64 + {integer}`
|
= help: the trait `Add<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error[E0277]: cannot subtract `{float}` from `u8`
--> $DIR/not-suggest-float-literal.rs:15:7
@ -29,6 +59,16 @@ LL | x - 100.0
| ^ no implementation for `u8 - {float}`
|
= help: the trait `Sub<{float}>` is not implemented for `u8`
= help: the following other types implement trait `Sub<Rhs>`:
<&'a f32 as Sub<f32>>
<&'a f64 as Sub<f64>>
<&'a i128 as Sub<i128>>
<&'a i16 as Sub<i16>>
<&'a i32 as Sub<i32>>
<&'a i64 as Sub<i64>>
<&'a i8 as Sub<i8>>
<&'a isize as Sub<isize>>
and 48 others
error[E0277]: cannot subtract `&str` from `f64`
--> $DIR/not-suggest-float-literal.rs:19:7
@ -37,6 +77,16 @@ LL | x - "foo"
| ^ no implementation for `f64 - &str`
|
= help: the trait `Sub<&str>` is not implemented for `f64`
= help: the following other types implement trait `Sub<Rhs>`:
<&'a f32 as Sub<f32>>
<&'a f64 as Sub<f64>>
<&'a i128 as Sub<i128>>
<&'a i16 as Sub<i16>>
<&'a i32 as Sub<i32>>
<&'a i64 as Sub<i64>>
<&'a i8 as Sub<i8>>
<&'a isize as Sub<isize>>
and 48 others
error[E0277]: cannot subtract `{integer}` from `f64`
--> $DIR/not-suggest-float-literal.rs:24:7
@ -45,6 +95,16 @@ LL | x - y
| ^ no implementation for `f64 - {integer}`
|
= help: the trait `Sub<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Sub<Rhs>`:
<&'a f32 as Sub<f32>>
<&'a f64 as Sub<f64>>
<&'a i128 as Sub<i128>>
<&'a i16 as Sub<i16>>
<&'a i32 as Sub<i32>>
<&'a i64 as Sub<i64>>
<&'a i8 as Sub<i8>>
<&'a isize as Sub<isize>>
and 48 others
error[E0277]: cannot multiply `u8` by `{float}`
--> $DIR/not-suggest-float-literal.rs:28:7
@ -53,6 +113,16 @@ LL | x * 100.0
| ^ no implementation for `u8 * {float}`
|
= help: the trait `Mul<{float}>` is not implemented for `u8`
= help: the following other types implement trait `Mul<Rhs>`:
<&'a f32 as Mul<f32>>
<&'a f64 as Mul<f64>>
<&'a i128 as Mul<i128>>
<&'a i16 as Mul<i16>>
<&'a i32 as Mul<i32>>
<&'a i64 as Mul<i64>>
<&'a i8 as Mul<i8>>
<&'a isize as Mul<isize>>
and 49 others
error[E0277]: cannot multiply `f64` by `&str`
--> $DIR/not-suggest-float-literal.rs:32:7
@ -61,6 +131,16 @@ LL | x * "foo"
| ^ no implementation for `f64 * &str`
|
= help: the trait `Mul<&str>` is not implemented for `f64`
= help: the following other types implement trait `Mul<Rhs>`:
<&'a f32 as Mul<f32>>
<&'a f64 as Mul<f64>>
<&'a i128 as Mul<i128>>
<&'a i16 as Mul<i16>>
<&'a i32 as Mul<i32>>
<&'a i64 as Mul<i64>>
<&'a i8 as Mul<i8>>
<&'a isize as Mul<isize>>
and 49 others
error[E0277]: cannot multiply `f64` by `{integer}`
--> $DIR/not-suggest-float-literal.rs:37:7
@ -69,6 +149,16 @@ LL | x * y
| ^ no implementation for `f64 * {integer}`
|
= help: the trait `Mul<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Mul<Rhs>`:
<&'a f32 as Mul<f32>>
<&'a f64 as Mul<f64>>
<&'a i128 as Mul<i128>>
<&'a i16 as Mul<i16>>
<&'a i32 as Mul<i32>>
<&'a i64 as Mul<i64>>
<&'a i8 as Mul<i8>>
<&'a isize as Mul<isize>>
and 49 others
error[E0277]: cannot divide `u8` by `{float}`
--> $DIR/not-suggest-float-literal.rs:41:7
@ -77,6 +167,16 @@ LL | x / 100.0
| ^ no implementation for `u8 / {float}`
|
= help: the trait `Div<{float}>` is not implemented for `u8`
= help: the following other types implement trait `Div<Rhs>`:
<&'a f32 as Div<f32>>
<&'a f64 as Div<f64>>
<&'a i128 as Div<i128>>
<&'a i16 as Div<i16>>
<&'a i32 as Div<i32>>
<&'a i64 as Div<i64>>
<&'a i8 as Div<i8>>
<&'a isize as Div<isize>>
and 54 others
error[E0277]: cannot divide `f64` by `&str`
--> $DIR/not-suggest-float-literal.rs:45:7
@ -85,6 +185,16 @@ LL | x / "foo"
| ^ no implementation for `f64 / &str`
|
= help: the trait `Div<&str>` is not implemented for `f64`
= help: the following other types implement trait `Div<Rhs>`:
<&'a f32 as Div<f32>>
<&'a f64 as Div<f64>>
<&'a i128 as Div<i128>>
<&'a i16 as Div<i16>>
<&'a i32 as Div<i32>>
<&'a i64 as Div<i64>>
<&'a i8 as Div<i8>>
<&'a isize as Div<isize>>
and 54 others
error[E0277]: cannot divide `f64` by `{integer}`
--> $DIR/not-suggest-float-literal.rs:50:7
@ -93,6 +203,16 @@ LL | x / y
| ^ no implementation for `f64 / {integer}`
|
= help: the trait `Div<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Div<Rhs>`:
<&'a f32 as Div<f32>>
<&'a f64 as Div<f64>>
<&'a i128 as Div<i128>>
<&'a i16 as Div<i16>>
<&'a i32 as Div<i32>>
<&'a i64 as Div<i64>>
<&'a i8 as Div<i8>>
<&'a isize as Div<isize>>
and 54 others
error: aborting due to 12 previous errors

View file

@ -5,6 +5,16 @@ LL | x + 100
| ^ no implementation for `f32 + {integer}`
|
= help: the trait `Add<{integer}>` is not implemented for `f32`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
help: consider using a floating-point literal by writing it with `.0`
|
LL | x + 100.0
@ -17,6 +27,16 @@ LL | x + 100
| ^ no implementation for `f64 + {integer}`
|
= help: the trait `Add<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
help: consider using a floating-point literal by writing it with `.0`
|
LL | x + 100.0
@ -29,6 +49,16 @@ LL | x - 100
| ^ no implementation for `f32 - {integer}`
|
= help: the trait `Sub<{integer}>` is not implemented for `f32`
= help: the following other types implement trait `Sub<Rhs>`:
<&'a f32 as Sub<f32>>
<&'a f64 as Sub<f64>>
<&'a i128 as Sub<i128>>
<&'a i16 as Sub<i16>>
<&'a i32 as Sub<i32>>
<&'a i64 as Sub<i64>>
<&'a i8 as Sub<i8>>
<&'a isize as Sub<isize>>
and 48 others
help: consider using a floating-point literal by writing it with `.0`
|
LL | x - 100.0
@ -41,6 +71,16 @@ LL | x - 100
| ^ no implementation for `f64 - {integer}`
|
= help: the trait `Sub<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Sub<Rhs>`:
<&'a f32 as Sub<f32>>
<&'a f64 as Sub<f64>>
<&'a i128 as Sub<i128>>
<&'a i16 as Sub<i16>>
<&'a i32 as Sub<i32>>
<&'a i64 as Sub<i64>>
<&'a i8 as Sub<i8>>
<&'a isize as Sub<isize>>
and 48 others
help: consider using a floating-point literal by writing it with `.0`
|
LL | x - 100.0
@ -53,6 +93,16 @@ LL | x * 100
| ^ no implementation for `f32 * {integer}`
|
= help: the trait `Mul<{integer}>` is not implemented for `f32`
= help: the following other types implement trait `Mul<Rhs>`:
<&'a f32 as Mul<f32>>
<&'a f64 as Mul<f64>>
<&'a i128 as Mul<i128>>
<&'a i16 as Mul<i16>>
<&'a i32 as Mul<i32>>
<&'a i64 as Mul<i64>>
<&'a i8 as Mul<i8>>
<&'a isize as Mul<isize>>
and 49 others
help: consider using a floating-point literal by writing it with `.0`
|
LL | x * 100.0
@ -65,6 +115,16 @@ LL | x * 100
| ^ no implementation for `f64 * {integer}`
|
= help: the trait `Mul<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Mul<Rhs>`:
<&'a f32 as Mul<f32>>
<&'a f64 as Mul<f64>>
<&'a i128 as Mul<i128>>
<&'a i16 as Mul<i16>>
<&'a i32 as Mul<i32>>
<&'a i64 as Mul<i64>>
<&'a i8 as Mul<i8>>
<&'a isize as Mul<isize>>
and 49 others
help: consider using a floating-point literal by writing it with `.0`
|
LL | x * 100.0
@ -77,6 +137,16 @@ LL | x / 100
| ^ no implementation for `f32 / {integer}`
|
= help: the trait `Div<{integer}>` is not implemented for `f32`
= help: the following other types implement trait `Div<Rhs>`:
<&'a f32 as Div<f32>>
<&'a f64 as Div<f64>>
<&'a i128 as Div<i128>>
<&'a i16 as Div<i16>>
<&'a i32 as Div<i32>>
<&'a i64 as Div<i64>>
<&'a i8 as Div<i8>>
<&'a isize as Div<isize>>
and 54 others
help: consider using a floating-point literal by writing it with `.0`
|
LL | x / 100.0
@ -89,6 +159,16 @@ LL | x / 100
| ^ no implementation for `f64 / {integer}`
|
= help: the trait `Div<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Div<Rhs>`:
<&'a f32 as Div<f32>>
<&'a f64 as Div<f64>>
<&'a i128 as Div<i128>>
<&'a i16 as Div<i16>>
<&'a i32 as Div<i32>>
<&'a i64 as Div<i64>>
<&'a i8 as Div<i8>>
<&'a isize as Div<isize>>
and 54 others
help: consider using a floating-point literal by writing it with `.0`
|
LL | x / 100.0

View file

@ -7,6 +7,7 @@ LL | Foo::<usize>::foo((1i32, 1i32, 1i32));
| required by a bound introduced by this call
|
= help: the trait `Foo<usize>` is not implemented for `(i32, i32, i32)`
= help: the trait `Foo<A>` is implemented for `(A, B, C)`
error: aborting due to previous error

View file

@ -7,6 +7,9 @@ LL | Index::index(&[] as &[i32], 2u32);
| required by a bound introduced by this call
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
= help: the following other types implement trait `Index<Idx>`:
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>
error[E0277]: the trait bound `[i32]: Index<Foo<u32>>` is not satisfied
--> $DIR/multiple-impls.rs:36:18
@ -17,6 +20,9 @@ LL | Index::index(&[] as &[i32], Foo(2u32));
| required by a bound introduced by this call
|
= help: the trait `Index<Foo<u32>>` is not implemented for `[i32]`
= help: the following other types implement trait `Index<Idx>`:
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>
error[E0277]: the trait bound `[i32]: Index<Bar<u32>>` is not satisfied
--> $DIR/multiple-impls.rs:39:18
@ -27,6 +33,9 @@ LL | Index::index(&[] as &[i32], Bar(2u32));
| required by a bound introduced by this call
|
= help: the trait `Index<Bar<u32>>` is not implemented for `[i32]`
= help: the following other types implement trait `Index<Idx>`:
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>
error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
--> $DIR/multiple-impls.rs:33:5
@ -35,6 +44,9 @@ LL | Index::index(&[] as &[i32], 2u32);
| ^^^^^^^^^^^^ trait message
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
= help: the following other types implement trait `Index<Idx>`:
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>
error[E0277]: the trait bound `[i32]: Index<Foo<u32>>` is not satisfied
--> $DIR/multiple-impls.rs:36:5
@ -43,6 +55,9 @@ LL | Index::index(&[] as &[i32], Foo(2u32));
| ^^^^^^^^^^^^ on impl for Foo
|
= help: the trait `Index<Foo<u32>>` is not implemented for `[i32]`
= help: the following other types implement trait `Index<Idx>`:
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>
error[E0277]: the trait bound `[i32]: Index<Bar<u32>>` is not satisfied
--> $DIR/multiple-impls.rs:39:5
@ -51,6 +66,9 @@ LL | Index::index(&[] as &[i32], Bar(2u32));
| ^^^^^^^^^^^^ on impl for Bar
|
= help: the trait `Index<Bar<u32>>` is not implemented for `[i32]`
= help: the following other types implement trait `Index<Idx>`:
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>
error: aborting due to 6 previous errors

View file

@ -7,6 +7,7 @@ LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
| required by a bound introduced by this call
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
= help: the trait `Index<usize>` is implemented for `[i32]`
error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied
--> $DIR/on-impl.rs:22:5
@ -15,6 +16,7 @@ LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32);
| ^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
= help: the trait `Index<usize>` is implemented for `[i32]`
error: aborting due to 2 previous errors

View file

@ -5,6 +5,7 @@ LL | x[1i32];
| ^^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[i32]>` is not implemented for `i32`
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
= note: required because of the requirements on the impl of `Index<i32>` for `[i32]`
error[E0277]: the type `[i32]` cannot be indexed by `RangeTo<i32>`
@ -14,6 +15,9 @@ LL | x[..1i32];
| ^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[i32]>` is not implemented for `RangeTo<i32>`
= help: the following other types implement trait `SliceIndex<T>`:
<RangeTo<usize> as SliceIndex<[T]>>
<RangeTo<usize> as SliceIndex<str>>
= note: required because of the requirements on the impl of `Index<RangeTo<i32>>` for `[i32]`
error: aborting due to 2 previous errors

View file

@ -10,6 +10,16 @@ error[E0277]: the trait bound `bool: Step` is not satisfied
LL | for i in false..true {}
| ^^^^^^^^^^^ the trait `Step` is not implemented for `bool`
|
= help: the following other types implement trait `Step`:
char
i128
i16
i32
i64
i8
isize
u128
and 5 others
= note: required because of the requirements on the impl of `Iterator` for `std::ops::Range<bool>`
= note: required because of the requirements on the impl of `IntoIterator` for `std::ops::Range<bool>`

View file

@ -9,6 +9,10 @@ LL | | }
| |_^ `main` can only return types that implement `Termination`
|
= help: the trait `Termination` is not implemented for `Result<f32, ParseFloatError>`
= help: the following other types implement trait `Termination`:
Result<!, E>
Result<(), E>
Result<Infallible, E>
note: required by a bound in `assert_test_result`
--> $SRC_DIR/test/src/lib.rs:LL:COL
|

View file

@ -5,6 +5,16 @@ LL | foo(1 as u32 +
| ^ no implementation for `u32 + ()`
|
= help: the trait `Add<()>` is not implemented for `u32`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error: aborting due to previous error

View file

@ -14,8 +14,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied
LL | default type U = str;
| ^^^ the trait `Clone` is not implemented for `str`
|
= help: the following implementations were found:
<String as Clone>
= help: the trait `Clone` is implemented for `String`
note: required by a bound in `X::U`
--> $DIR/default-associated-type-bound-1.rs:8:13
|

View file

@ -7,6 +7,7 @@ LL | let _: u8 = s[4];
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
= note: required because of the requirements on the impl of `Index<{integer}>` for `str`
error[E0277]: the type `str` cannot be indexed by `{integer}`
@ -20,6 +21,7 @@ LL | let _ = s.get(4);
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
note: required by a bound in `core::str::<impl str>::get`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|
@ -37,6 +39,7 @@ LL | let _ = s.get_unchecked(4);
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
note: required by a bound in `core::str::<impl str>::get_unchecked`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|

View file

@ -31,6 +31,7 @@ LL | s[1usize] = bot();
| ^^^^^^^^^ string indices are ranges of `usize`
|
= help: the trait `SliceIndex<str>` is not implemented for `usize`
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
= note: required because of the requirements on the impl of `Index<usize>` for `str`
error[E0277]: the type `str` cannot be indexed by `{integer}`
@ -44,6 +45,7 @@ LL | s.get_mut(1);
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
note: required by a bound in `core::str::<impl str>::get_mut`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|
@ -61,6 +63,7 @@ LL | s.get_unchecked_mut(1);
= help: the trait `SliceIndex<str>` is not implemented for `{integer}`
= note: you can use `.chars().nth()` or `.bytes().nth()`
for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings>
= help: the trait `SliceIndex<[T]>` is implemented for `usize`
note: required by a bound in `core::str::<impl str>::get_unchecked_mut`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
|

View file

@ -4,8 +4,7 @@ error[E0277]: the trait bound `for<'b> &'b S: Trait` is not satisfied
LL | foo::<S>(s);
| ^^^^^^^^ the trait `for<'b> Trait` is not implemented for `&'b S`
|
= help: the following implementations were found:
<&'a mut S as Trait>
= help: the trait `Trait` is implemented for `&'a mut S`
note: required by a bound in `foo`
--> $DIR/imm-ref-trait-object-literal-bound-regions.rs:11:20
|

View file

@ -6,8 +6,7 @@ LL | foo(&s);
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<&'a mut S as Trait>
= help: the trait `Trait` is implemented for `&'a mut S`
note: required by a bound in `foo`
--> $DIR/imm-ref-trait-object-literal.rs:7:11
|

View file

@ -15,6 +15,8 @@ LL | | 5;
LL | |
LL | | }
| |_^ the trait `Bar` is not implemented for `()`
|
= help: the trait `Bar` is implemented for `u8`
error: aborting due to 2 previous errors

View file

@ -7,12 +7,13 @@ LL | foo(String::new());
| required by a bound introduced by this call
|
= note: to coerce a `String` into a `&str`, use `&*` as a prefix
= help: the following implementations were found:
= help: the following other types implement trait `From<T>`:
<String as From<&String>>
<String as From<&mut str>>
<String as From<&str>>
<String as From<Box<str>>>
and 2 others
<String as From<Cow<'a, str>>>
<String as From<char>>
= note: required because of the requirements on the impl of `Into<&str>` for `String`
note: required by a bound in `foo`
--> $DIR/into-str.rs:1:31

View file

@ -4,7 +4,7 @@ error[E0277]: the trait bound `&[i8]: From<&[u8]>` is not satisfied
LL | let _: &[i8] = data.into();
| ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]`
|
= help: the following implementations were found:
= help: the following other types implement trait `From<T>`:
<[T; LANES] as From<Simd<T, LANES>>>
<[bool; LANES] as From<Mask<T, LANES>>>
= note: required because of the requirements on the impl of `Into<&[i8]>` for `&[u8]`

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