Auto merge of #122832 - oli-obk:no_ord_def_id3, r=michaelwoerister

Remove `DefId`'s `Partial/Ord` impls

work towards https://github.com/rust-lang/rust/issues/90317

based on https://github.com/rust-lang/rust/pull/122824 and https://github.com/rust-lang/rust/pull/122820

r? `@michaelwoerister`
This commit is contained in:
bors 2024-03-28 05:25:28 +00:00
commit 2781687fe5
85 changed files with 451 additions and 533 deletions

View File

@ -1,14 +1,14 @@
use rustc_data_structures::fx::FxIndexMap;
use rustc_infer::infer::outlives::components::{push_outlives_components, Component};
use rustc_middle::ty::{self, Region, Ty, TyCtxt};
use rustc_middle::ty::{GenericArg, GenericArgKind};
use rustc_span::Span;
use smallvec::smallvec;
use std::collections::BTreeMap;
/// Tracks the `T: 'a` or `'a: 'a` predicates that we have inferred
/// must be added to the struct header.
pub(crate) type RequiredPredicates<'tcx> =
BTreeMap<ty::OutlivesPredicate<GenericArg<'tcx>, ty::Region<'tcx>>, Span>;
FxIndexMap<ty::OutlivesPredicate<GenericArg<'tcx>, ty::Region<'tcx>>, Span>;
/// Given a requirement `T: 'a` or `'b: 'a`, deduce the
/// outlives_component and add it to `required_predicates`

View File

@ -81,7 +81,7 @@ pub struct NoMatchData<'tcx> {
// A pared down enum describing just the places from which a method
// candidate can arise. Used for error reporting only.
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum CandidateSource {
Impl(DefId),
Trait(DefId /* trait id */),

View File

@ -49,7 +49,6 @@ use std::borrow::Cow;
use super::probe::{AutorefOrPtrAdjustment, IsSuggestion, Mode, ProbeScope};
use super::{CandidateSource, MethodError, NoMatchData};
use rustc_hir::intravisit::Visitor;
use std::cmp::{self, Ordering};
use std::iter;
impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
@ -1186,7 +1185,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
})
.collect::<Vec<_>>();
if !inherent_impls_candidate.is_empty() {
inherent_impls_candidate.sort();
inherent_impls_candidate.sort_by_key(|id| self.tcx.def_path_str(id));
inherent_impls_candidate.dedup();
// number of types to show at most
@ -1567,7 +1566,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
sources: &mut Vec<CandidateSource>,
sugg_span: Option<Span>,
) {
sources.sort();
sources.sort_by_key(|source| match source {
CandidateSource::Trait(id) => (0, self.tcx.def_path_str(id)),
CandidateSource::Impl(id) => (1, self.tcx.def_path_str(id)),
});
sources.dedup();
// Dynamic limit to avoid hiding just one candidate, which is silly.
let limit = if sources.len() == 5 { 5 } else { 4 };
@ -2549,7 +2551,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
_ => None,
})
.collect();
preds.sort_by_key(|pred| (pred.def_id(), pred.self_ty()));
preds.sort_by_key(|pred| pred.trait_ref.to_string());
let def_ids = preds
.iter()
.filter_map(|pred| match pred.self_ty().kind() {
@ -2663,7 +2665,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
traits.push(trait_pred.def_id());
}
}
traits.sort();
traits.sort_by_key(|id| self.tcx.def_path_str(id));
traits.dedup();
let len = traits.len();
@ -2886,7 +2888,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
) -> bool {
if !valid_out_of_scope_traits.is_empty() {
let mut candidates = valid_out_of_scope_traits;
candidates.sort();
candidates.sort_by_key(|id| self.tcx.def_path_str(id));
candidates.dedup();
// `TryFrom` and `FromIterator` have no methods
@ -3212,8 +3214,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
if !candidates.is_empty() {
// Sort from most relevant to least relevant.
candidates.sort_by_key(|&info| cmp::Reverse(info));
// Sort local crate results before others
candidates
.sort_by_key(|&info| (!info.def_id.is_local(), self.tcx.def_path_str(info.def_id)));
candidates.dedup();
let param_type = match rcvr_ty.kind() {
@ -3561,33 +3564,11 @@ pub enum SelfSource<'a> {
MethodCall(&'a hir::Expr<'a> /* rcvr */),
}
#[derive(Copy, Clone)]
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct TraitInfo {
pub def_id: DefId,
}
impl PartialEq for TraitInfo {
fn eq(&self, other: &TraitInfo) -> bool {
self.cmp(other) == Ordering::Equal
}
}
impl Eq for TraitInfo {}
impl PartialOrd for TraitInfo {
fn partial_cmp(&self, other: &TraitInfo) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for TraitInfo {
fn cmp(&self, other: &TraitInfo) -> Ordering {
// Local crates are more important than remote ones (local:
// `cnum == 0`), and otherwise we throw in the defid for totality.
let lhs = (other.def_id.krate, other.def_id);
let rhs = (self.def_id.krate, self.def_id);
lhs.cmp(&rhs)
}
}
/// Retrieves all traits in this crate and any dependent crates,
/// and wraps them into `TraitInfo` for custom sorting.
pub fn all_traits(tcx: TyCtxt<'_>) -> Vec<TraitInfo> {

View File

@ -1038,7 +1038,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
let (sig, reg) = ty::print::FmtPrinter::new(self.tcx, Namespace::TypeNS)
.name_all_regions(sig)
.unwrap();
let lts: Vec<String> = reg.into_values().map(|kind| kind.to_string()).collect();
let lts: Vec<String> =
reg.into_items().map(|(_, kind)| kind.to_string()).into_sorted_stable_ord();
(if lts.is_empty() { String::new() } else { format!("for<{}> ", lts.join(", ")) }, sig)
};

View File

@ -1018,7 +1018,7 @@ impl<'tcx> PatRangeBoundary<'tcx> {
(Finite(mir::Const::Ty(a)), Finite(mir::Const::Ty(b)))
if matches!(ty.kind(), ty::Uint(_) | ty::Char) =>
{
return Some(a.kind().cmp(&b.kind()));
return Some(a.to_valtree().cmp(&b.to_valtree()));
}
(
Finite(mir::Const::Val(mir::ConstValue::Scalar(Scalar::Int(a)), _)),

View File

@ -18,7 +18,6 @@ use rustc_span::symbol::sym;
use rustc_target::abi::{ReprOptions, VariantIdx, FIRST_VARIANT};
use std::cell::RefCell;
use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
use std::ops::Range;
use std::str;
@ -102,20 +101,6 @@ pub struct AdtDefData {
repr: ReprOptions,
}
impl PartialOrd for AdtDefData {
fn partial_cmp(&self, other: &AdtDefData) -> Option<Ordering> {
Some(self.cmp(other))
}
}
/// There should be only one AdtDef for each `did`, therefore
/// it is fine to implement `Ord` only based on `did`.
impl Ord for AdtDefData {
fn cmp(&self, other: &AdtDefData) -> Ordering {
self.did.cmp(&other.did)
}
}
impl PartialEq for AdtDefData {
#[inline]
fn eq(&self, other: &Self) -> bool {
@ -180,7 +165,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for AdtDefData {
}
}
#[derive(Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, HashStable)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable)]
#[rustc_pass_by_value]
pub struct AdtDef<'tcx>(pub Interned<'tcx, AdtDefData>);

View File

@ -23,7 +23,7 @@ pub use valtree::*;
pub type ConstKind<'tcx> = IrConstKind<TyCtxt<'tcx>>;
/// Use this rather than `ConstData`, whenever possible.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable)]
#[rustc_pass_by_value]
pub struct Const<'tcx>(pub(super) Interned<'tcx, WithCachedTypeInfo<ConstData<'tcx>>>);
@ -52,7 +52,7 @@ impl<'tcx> ConstTy<TyCtxt<'tcx>> for Const<'tcx> {
}
/// Typed constant value.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
#[derive(HashStable, TyEncodable, TyDecodable)]
pub struct ConstData<'tcx> {
pub ty: Ty<'tcx>,

View File

@ -7,7 +7,7 @@ use rustc_hir::def_id::DefId;
use rustc_macros::HashStable;
/// An unevaluated (potentially generic) constant used in the type-system.
#[derive(Copy, Clone, Eq, PartialEq, PartialOrd, Ord, TyEncodable, TyDecodable)]
#[derive(Copy, Clone, Eq, PartialEq, TyEncodable, TyDecodable)]
#[derive(Hash, HashStable, TypeFoldable, TypeVisitable)]
pub struct UnevaluatedConst<'tcx> {
pub def: DefId,
@ -62,7 +62,7 @@ impl<'tcx> UnevaluatedConst<'tcx> {
}
}
#[derive(Copy, Clone, Eq, PartialEq, PartialOrd, Ord, Hash)]
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
#[derive(HashStable, TyEncodable, TyDecodable, TypeVisitable, TypeFoldable)]
pub enum Expr<'tcx> {
Binop(mir::BinOp, Const<'tcx>, Const<'tcx>),

View File

@ -2,8 +2,6 @@ use crate::ty::{self, Binder, BoundTy, Ty, TyCtxt, TypeVisitableExt};
use rustc_data_structures::fx::FxIndexMap;
use rustc_hir::def_id::DefId;
use std::collections::BTreeMap;
pub use rustc_type_ir::fold::{FallibleTypeFolder, TypeFoldable, TypeFolder, TypeSuperFoldable};
///////////////////////////////////////////////////////////////////////////
@ -254,12 +252,12 @@ impl<'tcx> TyCtxt<'tcx> {
self,
value: Binder<'tcx, T>,
mut fld_r: F,
) -> (T, BTreeMap<ty::BoundRegion, ty::Region<'tcx>>)
) -> (T, FxIndexMap<ty::BoundRegion, ty::Region<'tcx>>)
where
F: FnMut(ty::BoundRegion) -> ty::Region<'tcx>,
T: TypeFoldable<TyCtxt<'tcx>>,
{
let mut region_map = BTreeMap::new();
let mut region_map = FxIndexMap::default();
let real_fld_r = |br: ty::BoundRegion| *region_map.entry(br).or_insert_with(|| fld_r(br));
let value = self.instantiate_bound_regions_uncached(value, real_fld_r);
(value, region_map)

View File

@ -17,7 +17,6 @@ use rustc_type_ir::WithCachedTypeInfo;
use smallvec::SmallVec;
use core::intrinsics;
use std::cmp::Ordering;
use std::marker::PhantomData;
use std::mem;
use std::num::NonZero;
@ -68,7 +67,7 @@ const TYPE_TAG: usize = 0b00;
const REGION_TAG: usize = 0b01;
const CONST_TAG: usize = 0b10;
#[derive(Debug, TyEncodable, TyDecodable, PartialEq, Eq, PartialOrd, Ord, HashStable)]
#[derive(Debug, TyEncodable, TyDecodable, PartialEq, Eq, HashStable)]
pub enum GenericArgKind<'tcx> {
Lifetime(ty::Region<'tcx>),
Type(Ty<'tcx>),
@ -100,18 +99,6 @@ impl<'tcx> GenericArgKind<'tcx> {
}
}
impl<'tcx> Ord for GenericArg<'tcx> {
fn cmp(&self, other: &GenericArg<'tcx>) -> Ordering {
self.unpack().cmp(&other.unpack())
}
}
impl<'tcx> PartialOrd for GenericArg<'tcx> {
fn partial_cmp(&self, other: &GenericArg<'tcx>) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl<'tcx> From<ty::Region<'tcx>> for GenericArg<'tcx> {
#[inline]
fn from(r: ty::Region<'tcx>) -> GenericArg<'tcx> {

View File

@ -517,7 +517,7 @@ pub struct CReaderCacheKey {
}
/// Use this rather than `TyKind`, whenever possible.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable)]
#[rustc_diagnostic_item = "Ty"]
#[rustc_pass_by_value]
pub struct Ty<'tcx>(Interned<'tcx, WithCachedTypeInfo<TyKind<'tcx>>>);
@ -702,7 +702,7 @@ const TAG_MASK: usize = 0b11;
const TYPE_TAG: usize = 0b00;
const CONST_TAG: usize = 0b01;
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, TyEncodable, TyDecodable)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
#[derive(HashStable, TypeFoldable, TypeVisitable)]
pub enum TermKind<'tcx> {
Ty(Ty<'tcx>),
@ -980,7 +980,7 @@ impl PlaceholderLike for PlaceholderType {
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable)]
#[derive(TyEncodable, TyDecodable, PartialOrd, Ord)]
#[derive(TyEncodable, TyDecodable)]
pub struct BoundConst<'tcx> {
pub var: BoundVar,
pub ty: Ty<'tcx>,

View File

@ -192,7 +192,7 @@ impl<'tcx> Clause<'tcx> {
}
}
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Ord, Eq, Hash, TyEncodable, TyDecodable)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
pub enum ExistentialPredicate<'tcx> {
/// E.g., `Iterator`.
@ -336,7 +336,7 @@ impl<'tcx> ty::List<ty::PolyExistentialPredicate<'tcx>> {
///
/// Trait references also appear in object types like `Foo<U>`, but in
/// that case the `Self` parameter is absent from the generic parameters.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
pub struct TraitRef<'tcx> {
pub def_id: DefId,
@ -420,7 +420,7 @@ impl<'tcx> IntoDiagArg for TraitRef<'tcx> {
/// ```
/// The generic parameters don't include the erased `Self`, only trait
/// type and lifetime parameters (`[X, Y]` and `['a, 'b]` above).
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
pub struct ExistentialTraitRef<'tcx> {
pub def_id: DefId,
@ -476,7 +476,7 @@ impl<'tcx> PolyExistentialTraitRef<'tcx> {
}
/// A `ProjectionPredicate` for an `ExistentialTraitRef`.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, TyEncodable, TyDecodable)]
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
pub struct ExistentialProjection<'tcx> {
pub def_id: DefId,

View File

@ -10,6 +10,7 @@ use crate::ty::{
use rustc_apfloat::ieee::{Double, Single};
use rustc_apfloat::Float;
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
use rustc_data_structures::unord::UnordMap;
use rustc_hir as hir;
use rustc_hir::def::{self, CtorKind, DefKind, Namespace};
use rustc_hir::def_id::{DefIdMap, DefIdSet, ModDefId, CRATE_DEF_ID, LOCAL_CRATE};
@ -24,7 +25,6 @@ use rustc_target::spec::abi::Abi;
use smallvec::SmallVec;
use std::cell::Cell;
use std::collections::BTreeMap;
use std::fmt::{self, Write as _};
use std::iter;
use std::ops::{Deref, DerefMut};
@ -2537,7 +2537,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
struct RegionFolder<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
current_index: ty::DebruijnIndex,
region_map: BTreeMap<ty::BoundRegion, ty::Region<'tcx>>,
region_map: UnordMap<ty::BoundRegion, ty::Region<'tcx>>,
name: &'a mut (
dyn FnMut(
Option<ty::DebruijnIndex>, // Debruijn index of the folded late-bound region
@ -2614,7 +2614,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
pub fn name_all_regions<T>(
&mut self,
value: &ty::Binder<'tcx, T>,
) -> Result<(T, BTreeMap<ty::BoundRegion, ty::Region<'tcx>>), fmt::Error>
) -> Result<(T, UnordMap<ty::BoundRegion, ty::Region<'tcx>>), fmt::Error>
where
T: Print<'tcx, Self> + TypeFoldable<TyCtxt<'tcx>>,
{
@ -2691,7 +2691,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
write!(self, "{var:?}")?;
}
start_or_continue(self, "", "> ");
(value.clone().skip_binder(), BTreeMap::default())
(value.clone().skip_binder(), UnordMap::default())
} else {
let tcx = self.tcx;
@ -2763,7 +2763,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
tcx,
current_index: ty::INNERMOST,
name: &mut name,
region_map: BTreeMap::new(),
region_map: UnordMap::default(),
};
let new_value = value.clone().skip_binder().fold_with(&mut folder);
let region_map = folder.region_map;

View File

@ -14,7 +14,7 @@ use crate::ty::{self, BoundVar, TyCtxt, TypeFlags};
pub type RegionKind<'tcx> = IrRegionKind<TyCtxt<'tcx>>;
/// Use this rather than `RegionKind`, whenever possible.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable)]
#[rustc_pass_by_value]
pub struct Region<'tcx>(pub Interned<'tcx, RegionKind<'tcx>>);
@ -327,7 +327,7 @@ impl<'tcx> Deref for Region<'tcx> {
}
}
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, PartialOrd, Ord)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
#[derive(HashStable)]
pub struct EarlyParamRegion {
pub def_id: DefId,
@ -358,7 +358,7 @@ impl Atom for RegionVid {
}
}
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, TyEncodable, TyDecodable, Copy)]
#[derive(Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, Copy)]
#[derive(HashStable)]
/// The parameter representation of late-bound function parameters, "some region
/// at least as big as the scope `fr.scope`".
@ -367,7 +367,7 @@ pub struct LateParamRegion {
pub bound_region: BoundRegionKind,
}
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, TyEncodable, TyDecodable, Copy)]
#[derive(Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, Copy)]
#[derive(HashStable)]
pub enum BoundRegionKind {
/// An anonymous region parameter for a given fn (&T)
@ -384,7 +384,7 @@ pub enum BoundRegionKind {
BrEnv,
}
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, PartialOrd, Ord)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
#[derive(HashStable)]
pub struct BoundRegion {
pub var: BoundVar,

View File

@ -868,7 +868,7 @@ impl<'tcx> InlineConstArgs<'tcx> {
}
}
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, TyEncodable, TyDecodable)]
#[derive(HashStable)]
pub enum BoundVariableKind {
Ty(BoundTyKind),
@ -908,7 +908,7 @@ impl BoundVariableKind {
/// e.g., `liberate_late_bound_regions`).
///
/// `Decodable` and `Encodable` are implemented for `Binder<T>` using the `impl_binder_encode_decode!` macro.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
#[derive(HashStable, Lift)]
pub struct Binder<'tcx, T> {
value: T,
@ -1109,7 +1109,7 @@ where
/// * For a projection, this would be `<Ty as Trait<...>>::N<...>`.
/// * For an inherent projection, this would be `Ty::N<...>`.
/// * For an opaque type, there is no explicit syntax.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
pub struct AliasTy<'tcx> {
/// The parameters of the associated or opaque item.
@ -1278,7 +1278,7 @@ pub struct GenSig<'tcx> {
/// - `inputs`: is the list of arguments and their modes.
/// - `output`: is the return type.
/// - `c_variadic`: indicates whether this is a C-variadic function.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
pub struct FnSig<'tcx> {
pub inputs_and_output: &'tcx List<Ty<'tcx>>,
@ -1403,14 +1403,14 @@ impl ParamConst {
}
}
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
#[derive(HashStable)]
pub struct BoundTy {
pub var: BoundVar,
pub kind: BoundTyKind,
}
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, TyEncodable, TyDecodable)]
#[derive(HashStable)]
pub enum BoundTyKind {
Anon,
@ -2661,7 +2661,7 @@ impl<'tcx> Ty<'tcx> {
/// a miscompilation or unsoundness.
///
/// When in doubt, use `VarianceDiagInfo::default()`
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
pub enum VarianceDiagInfo<'tcx> {
/// No additional information - this is the default.
/// We will not add any additional information to error messages.

View File

@ -2730,7 +2730,7 @@ pub(crate) fn import_candidates(
);
}
type PathString<'a> = (String, &'a str, Option<DefId>, &'a Option<String>, bool);
type PathString<'a> = (String, &'a str, Option<Span>, &'a Option<String>, bool);
/// When an entity with a given name is not available in scope, we search for
/// entities with that name in all crates. This method allows outputting the
@ -2762,7 +2762,7 @@ fn show_candidates(
accessible_path_strings.push((
pprust::path_to_string(&c.path),
c.descr,
c.did,
c.did.and_then(|did| Some(tcx.source_span(did.as_local()?))),
&c.note,
c.via_import,
))
@ -2771,7 +2771,7 @@ fn show_candidates(
inaccessible_path_strings.push((
pprust::path_to_string(&c.path),
c.descr,
c.did,
c.did.and_then(|did| Some(tcx.source_span(did.as_local()?))),
&c.note,
c.via_import,
))
@ -2889,15 +2889,14 @@ fn show_candidates(
} else if !(inaccessible_path_strings.is_empty() || matches!(mode, DiagMode::Import { .. })) {
let prefix =
if let DiagMode::Pattern = mode { "you might have meant to match on " } else { "" };
if let [(name, descr, def_id, note, _)] = &inaccessible_path_strings[..] {
if let [(name, descr, source_span, note, _)] = &inaccessible_path_strings[..] {
let msg = format!(
"{prefix}{descr} `{name}`{} exists but is inaccessible",
if let DiagMode::Pattern = mode { ", which" } else { "" }
);
if let Some(local_def_id) = def_id.and_then(|did| did.as_local()) {
let span = tcx.source_span(local_def_id);
let span = tcx.sess.source_map().guess_head_span(span);
if let Some(source_span) = source_span {
let span = tcx.sess.source_map().guess_head_span(*source_span);
let mut multi_span = MultiSpan::from_span(span);
multi_span.push_span_label(span, "not accessible");
err.span_note(multi_span, msg);
@ -2925,10 +2924,9 @@ fn show_candidates(
let mut has_colon = false;
let mut spans = Vec::new();
for (name, _, def_id, _, _) in &inaccessible_path_strings {
if let Some(local_def_id) = def_id.and_then(|did| did.as_local()) {
let span = tcx.source_span(local_def_id);
let span = tcx.sess.source_map().guess_head_span(span);
for (name, _, source_span, _, _) in &inaccessible_path_strings {
if let Some(source_span) = source_span {
let span = tcx.sess.source_map().guess_head_span(*source_span);
spans.push((name, span));
} else {
if !has_colon {

View File

@ -218,8 +218,6 @@ rustc_index::newtype_index! {
///
/// You can create a `DefId` from a `LocalDefId` using `local_def_id.to_def_id()`.
#[derive(Clone, PartialEq, Eq, Copy)]
// Don't derive order on 64-bit big-endian, so we can be consistent regardless of field order.
#[cfg_attr(not(all(target_pointer_width = "64", target_endian = "big")), derive(PartialOrd, Ord))]
// On below-64 bit systems we can simply use the derived `Hash` impl
#[cfg_attr(not(target_pointer_width = "64"), derive(Hash))]
#[repr(C)]
@ -236,6 +234,12 @@ pub struct DefId {
pub index: DefIndex,
}
// To ensure correctness of incremental compilation,
// `DefId` must not implement `Ord` or `PartialOrd`.
// See https://github.com/rust-lang/rust/issues/90317.
impl !Ord for DefId {}
impl !PartialOrd for DefId {}
// On 64-bit systems, we can hash the whole `DefId` as one `u64` instead of two `u32`s. This
// improves performance without impairing `FxHash` quality. So the below code gets compiled to a
// noop on little endian systems because the memory layout of `DefId` is as follows:
@ -261,22 +265,6 @@ impl Hash for DefId {
}
}
// Implement the same comparison as derived with the other field order.
#[cfg(all(target_pointer_width = "64", target_endian = "big"))]
impl Ord for DefId {
#[inline]
fn cmp(&self, other: &DefId) -> std::cmp::Ordering {
Ord::cmp(&(self.index, self.krate), &(other.index, other.krate))
}
}
#[cfg(all(target_pointer_width = "64", target_endian = "big"))]
impl PartialOrd for DefId {
#[inline]
fn partial_cmp(&self, other: &DefId) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
impl DefId {
/// Makes a local `DefId` from the given `DefIndex`.
#[inline]

View File

@ -21,6 +21,7 @@ use crate::traits::{
};
use core::ops::ControlFlow;
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
use rustc_data_structures::unord::UnordSet;
use rustc_errors::codes::*;
use rustc_errors::{pluralize, struct_span_code_err, Applicability, MultiSpan, StringPart};
use rustc_errors::{Diag, EmissionGuarantee, ErrorGuaranteed, FatalError, StashKey};
@ -2117,7 +2118,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
})
.collect();
impl_candidates.sort();
impl_candidates.sort_by_key(|tr| tr.to_string());
impl_candidates.dedup();
return report(impl_candidates, err);
}
@ -2143,7 +2144,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
cand
})
.collect();
impl_candidates.sort_by_key(|cand| (cand.similarity, cand.trait_ref));
impl_candidates.sort_by_key(|cand| (cand.similarity, cand.trait_ref.to_string()));
let mut impl_candidates: Vec<_> =
impl_candidates.into_iter().map(|cand| cand.trait_ref).collect();
impl_candidates.dedup();
@ -2243,14 +2244,18 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
};
let required_trait_path = self.tcx.def_path_str(trait_ref.def_id());
let traits_with_same_path: std::collections::BTreeSet<_> = self
let traits_with_same_path: UnordSet<_> = self
.tcx
.all_traits()
.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)
.map(|trait_def_id| (self.tcx.def_path_str(trait_def_id), trait_def_id))
.filter(|(p, _)| *p == required_trait_path)
.collect();
let traits_with_same_path =
traits_with_same_path.into_items().into_sorted_stable_ord_by_key(|(p, _)| p);
let mut suggested = false;
for trait_with_same_path in traits_with_same_path {
for (_, trait_with_same_path) in traits_with_same_path {
let trait_impls = get_trait_impls(trait_with_same_path);
if trait_impls.is_empty() {
continue;

View File

@ -2,7 +2,7 @@ use std::collections::BTreeMap;
use super::NormalizeExt;
use super::{ObligationCause, PredicateObligation, SelectionContext};
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
use rustc_errors::Diag;
use rustc_hir::def_id::DefId;
use rustc_infer::infer::{InferCtxt, InferOk};
@ -431,8 +431,8 @@ pub struct BoundVarReplacer<'me, 'tcx> {
// These three maps track the bound variable that were replaced by placeholders. It might be
// nice to remove these since we already have the `kind` in the placeholder; we really just need
// the `var` (but we *could* bring that into scope if we were to track them as we pass them).
mapped_regions: BTreeMap<ty::PlaceholderRegion, ty::BoundRegion>,
mapped_types: BTreeMap<ty::PlaceholderType, ty::BoundTy>,
mapped_regions: FxIndexMap<ty::PlaceholderRegion, ty::BoundRegion>,
mapped_types: FxIndexMap<ty::PlaceholderType, ty::BoundTy>,
mapped_consts: BTreeMap<ty::PlaceholderConst, ty::BoundVar>,
// The current depth relative to *this* folding, *not* the entire normalization. In other words,
// the depth of binders we've passed here.
@ -451,12 +451,13 @@ impl<'me, 'tcx> BoundVarReplacer<'me, 'tcx> {
value: T,
) -> (
T,
BTreeMap<ty::PlaceholderRegion, ty::BoundRegion>,
BTreeMap<ty::PlaceholderType, ty::BoundTy>,
FxIndexMap<ty::PlaceholderRegion, ty::BoundRegion>,
FxIndexMap<ty::PlaceholderType, ty::BoundTy>,
BTreeMap<ty::PlaceholderConst, ty::BoundVar>,
) {
let mapped_regions: BTreeMap<ty::PlaceholderRegion, ty::BoundRegion> = BTreeMap::new();
let mapped_types: BTreeMap<ty::PlaceholderType, ty::BoundTy> = BTreeMap::new();
let mapped_regions: FxIndexMap<ty::PlaceholderRegion, ty::BoundRegion> =
FxIndexMap::default();
let mapped_types: FxIndexMap<ty::PlaceholderType, ty::BoundTy> = FxIndexMap::default();
let mapped_consts: BTreeMap<ty::PlaceholderConst, ty::BoundVar> = BTreeMap::new();
let mut replacer = BoundVarReplacer {
@ -574,8 +575,8 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'_, 'tcx> {
/// The inverse of [`BoundVarReplacer`]: replaces placeholders with the bound vars from which they came.
pub struct PlaceholderReplacer<'me, 'tcx> {
infcx: &'me InferCtxt<'tcx>,
mapped_regions: BTreeMap<ty::PlaceholderRegion, ty::BoundRegion>,
mapped_types: BTreeMap<ty::PlaceholderType, ty::BoundTy>,
mapped_regions: FxIndexMap<ty::PlaceholderRegion, ty::BoundRegion>,
mapped_types: FxIndexMap<ty::PlaceholderType, ty::BoundTy>,
mapped_consts: BTreeMap<ty::PlaceholderConst, ty::BoundVar>,
universe_indices: &'me [Option<ty::UniverseIndex>],
current_index: ty::DebruijnIndex,
@ -584,8 +585,8 @@ pub struct PlaceholderReplacer<'me, 'tcx> {
impl<'me, 'tcx> PlaceholderReplacer<'me, 'tcx> {
pub fn replace_placeholders<T: TypeFoldable<TyCtxt<'tcx>>>(
infcx: &'me InferCtxt<'tcx>,
mapped_regions: BTreeMap<ty::PlaceholderRegion, ty::BoundRegion>,
mapped_types: BTreeMap<ty::PlaceholderType, ty::BoundTy>,
mapped_regions: FxIndexMap<ty::PlaceholderRegion, ty::BoundRegion>,
mapped_types: FxIndexMap<ty::PlaceholderType, ty::BoundTy>,
mapped_consts: BTreeMap<ty::PlaceholderConst, ty::BoundVar>,
universe_indices: &'me [Option<ty::UniverseIndex>],
value: T,

View File

@ -65,7 +65,7 @@ pub mod rustc {
use std::fmt::{self, Write};
/// A reference in the layout.
#[derive(Debug, Hash, Eq, PartialEq, PartialOrd, Ord, Clone, Copy)]
#[derive(Debug, Hash, Eq, PartialEq, Clone, Copy)]
pub struct Ref<'tcx> {
pub lifetime: ty::Region<'tcx>,
pub ty: Ty<'tcx>,

View File

@ -8,15 +8,7 @@ use self::ConstKind::*;
/// Represents a constant in Rust.
#[derive(derivative::Derivative)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
PartialOrd(bound = ""),
PartialOrd = "feature_allow_slow_enum",
Ord(bound = ""),
Ord = "feature_allow_slow_enum",
Hash(bound = "")
)]
#[derivative(Clone(bound = ""), Copy(bound = ""), Hash(bound = ""))]
#[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))]
pub enum ConstKind<I: Interner> {
/// A const generic parameter.

View File

@ -9,16 +9,16 @@ use crate::{
};
pub trait Interner: Sized {
type DefId: Copy + Debug + Hash + Ord;
type AdtDef: Copy + Debug + Hash + Ord;
type DefId: Copy + Debug + Hash + Eq;
type AdtDef: Copy + Debug + Hash + Eq;
type GenericArgs: Copy
+ DebugWithInfcx<Self>
+ Hash
+ Ord
+ Eq
+ IntoIterator<Item = Self::GenericArg>;
type GenericArg: Copy + DebugWithInfcx<Self> + Hash + Ord;
type Term: Copy + Debug + Hash + Ord;
type GenericArg: Copy + DebugWithInfcx<Self> + Hash + Eq;
type Term: Copy + Debug + Hash + Eq;
type Binder<T: TypeVisitable<Self>>: BoundVars<Self> + TypeSuperVisitable<Self>;
type BoundVars: IntoIterator<Item = Self::BoundVar>;
@ -30,56 +30,56 @@ pub trait Interner: Sized {
type Ty: Copy
+ DebugWithInfcx<Self>
+ Hash
+ Ord
+ Eq
+ Into<Self::GenericArg>
+ IntoKind<Kind = TyKind<Self>>
+ TypeSuperVisitable<Self>
+ Flags
+ new::Ty<Self>;
type Tys: Copy + Debug + Hash + Ord + IntoIterator<Item = Self::Ty>;
type AliasTy: Copy + DebugWithInfcx<Self> + Hash + Ord;
type ParamTy: Copy + Debug + Hash + Ord;
type BoundTy: Copy + Debug + Hash + Ord;
type PlaceholderTy: Copy + Debug + Hash + Ord + PlaceholderLike;
type Tys: Copy + Debug + Hash + Eq + IntoIterator<Item = Self::Ty>;
type AliasTy: Copy + DebugWithInfcx<Self> + Hash + Eq;
type ParamTy: Copy + Debug + Hash + Eq;
type BoundTy: Copy + Debug + Hash + Eq;
type PlaceholderTy: Copy + Debug + Hash + Eq + PlaceholderLike;
// Things stored inside of tys
type ErrorGuaranteed: Copy + Debug + Hash + Ord;
type BoundExistentialPredicates: Copy + DebugWithInfcx<Self> + Hash + Ord;
type PolyFnSig: Copy + DebugWithInfcx<Self> + Hash + Ord;
type AllocId: Copy + Debug + Hash + Ord;
type ErrorGuaranteed: Copy + Debug + Hash + Eq;
type BoundExistentialPredicates: Copy + DebugWithInfcx<Self> + Hash + Eq;
type PolyFnSig: Copy + DebugWithInfcx<Self> + Hash + Eq;
type AllocId: Copy + Debug + Hash + Eq;
// Kinds of consts
type Const: Copy
+ DebugWithInfcx<Self>
+ Hash
+ Ord
+ Eq
+ Into<Self::GenericArg>
+ IntoKind<Kind = ConstKind<Self>>
+ ConstTy<Self>
+ TypeSuperVisitable<Self>
+ Flags
+ new::Const<Self>;
type AliasConst: Copy + DebugWithInfcx<Self> + Hash + Ord;
type PlaceholderConst: Copy + Debug + Hash + Ord + PlaceholderLike;
type ParamConst: Copy + Debug + Hash + Ord;
type BoundConst: Copy + Debug + Hash + Ord;
type ValueConst: Copy + Debug + Hash + Ord;
type ExprConst: Copy + DebugWithInfcx<Self> + Hash + Ord;
type AliasConst: Copy + DebugWithInfcx<Self> + Hash + Eq;
type PlaceholderConst: Copy + Debug + Hash + Eq + PlaceholderLike;
type ParamConst: Copy + Debug + Hash + Eq;
type BoundConst: Copy + Debug + Hash + Eq;
type ValueConst: Copy + Debug + Hash + Eq;
type ExprConst: Copy + DebugWithInfcx<Self> + Hash + Eq;
// Kinds of regions
type Region: Copy
+ DebugWithInfcx<Self>
+ Hash
+ Ord
+ Eq
+ Into<Self::GenericArg>
+ IntoKind<Kind = RegionKind<Self>>
+ Flags
+ new::Region<Self>;
type EarlyParamRegion: Copy + Debug + Hash + Ord;
type LateParamRegion: Copy + Debug + Hash + Ord;
type BoundRegion: Copy + Debug + Hash + Ord;
type InferRegion: Copy + DebugWithInfcx<Self> + Hash + Ord;
type PlaceholderRegion: Copy + Debug + Hash + Ord + PlaceholderLike;
type EarlyParamRegion: Copy + Debug + Hash + Eq;
type LateParamRegion: Copy + Debug + Hash + Eq;
type BoundRegion: Copy + Debug + Hash + Eq;
type InferRegion: Copy + DebugWithInfcx<Self> + Hash + Eq;
type PlaceholderRegion: Copy + Debug + Hash + Eq + PlaceholderLike;
// Predicates
type Predicate: Copy + Debug + Hash + Eq + TypeSuperVisitable<Self> + Flags;

View File

@ -113,15 +113,7 @@ use self::RegionKind::*;
/// [2]: https://smallcultfollowing.com/babysteps/blog/2013/11/04/intermingled-parameter-lists/
/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/traits/hrtb.html
#[derive(derivative::Derivative)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
PartialOrd(bound = ""),
PartialOrd = "feature_allow_slow_enum",
Ord(bound = ""),
Ord = "feature_allow_slow_enum",
Hash(bound = "")
)]
#[derivative(Clone(bound = ""), Copy(bound = ""), Hash(bound = ""))]
#[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable))]
pub enum RegionKind<I: Interner> {
/// A region parameter; for example `'a` in `impl<'a> Trait for &'a ()`.

View File

@ -63,15 +63,7 @@ impl AliasKind {
/// converted to this representation using `<dyn HirTyLowerer>::lower_ty`.
#[cfg_attr(feature = "nightly", rustc_diagnostic_item = "IrTyKind")]
#[derive(derivative::Derivative)]
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
PartialOrd(bound = ""),
PartialOrd = "feature_allow_slow_enum",
Ord(bound = ""),
Ord = "feature_allow_slow_enum",
Hash(bound = "")
)]
#[derivative(Clone(bound = ""), Copy(bound = ""), Hash(bound = ""))]
#[cfg_attr(feature = "nightly", derive(TyEncodable, TyDecodable, HashStable_NoContext))]
pub enum TyKind<I: Interner> {
/// The primitive boolean type. Written as `bool`.
@ -803,8 +795,6 @@ impl<I: Interner> DebugWithInfcx<I> for InferTy {
#[derivative(
Clone(bound = ""),
Copy(bound = ""),
PartialOrd(bound = ""),
Ord(bound = ""),
PartialEq(bound = ""),
Eq(bound = ""),
Hash(bound = ""),

View File

@ -41,7 +41,7 @@ use std::hash::Hash;
use std::mem;
use thin_vec::ThinVec;
use crate::core::{self, DocContext, ImplTraitParam};
use crate::core::{self, DocContext};
use crate::formats::item_type::ItemType;
use crate::visit_ast::Module as DocModule;
@ -761,7 +761,7 @@ fn clean_ty_generics<'tcx>(
) -> Generics {
// Don't populate `cx.impl_trait_bounds` before `clean`ning `where` clauses,
// since `Clean for ty::Predicate` would consume them.
let mut impl_trait = BTreeMap::<ImplTraitParam, Vec<GenericBound>>::default();
let mut impl_trait = BTreeMap::<u32, Vec<GenericBound>>::default();
// Bounds in the type_params and lifetimes fields are repeated in the
// predicates field (see rustc_hir_analysis::collect::ty_generics), so remove
@ -778,7 +778,7 @@ fn clean_ty_generics<'tcx>(
return None;
}
if synthetic {
impl_trait.insert(param.index.into(), vec![]);
impl_trait.insert(param.index, vec![]);
return None;
}
Some(clean_generic_param_def(param, cx))
@ -823,7 +823,7 @@ fn clean_ty_generics<'tcx>(
})();
if let Some(param_idx) = param_idx
&& let Some(bounds) = impl_trait.get_mut(&param_idx.into())
&& let Some(bounds) = impl_trait.get_mut(&param_idx)
{
let pred = clean_predicate(*pred, cx)?;
@ -847,7 +847,7 @@ fn clean_ty_generics<'tcx>(
})
.collect::<Vec<_>>();
for (param, mut bounds) in impl_trait {
for (idx, mut bounds) in impl_trait {
let mut has_sized = false;
bounds.retain(|b| {
if b.is_sized_bound(cx) {
@ -870,7 +870,6 @@ fn clean_ty_generics<'tcx>(
bounds.insert(0, GenericBound::sized(cx));
}
let crate::core::ImplTraitParam::ParamIndex(idx) = param else { unreachable!() };
if let Some(proj) = impl_trait_proj.remove(&idx) {
for (trait_did, name, rhs) in proj {
let rhs = clean_middle_term(rhs, cx);
@ -878,7 +877,7 @@ fn clean_ty_generics<'tcx>(
}
}
cx.impl_trait_bounds.insert(param, bounds);
cx.impl_trait_bounds.insert(idx.into(), bounds);
}
// Now that `cx.impl_trait_bounds` is populated, we can process

View File

@ -509,7 +509,7 @@ impl<'tcx> Visitor<'tcx> for EmitIgnoredResolutionErrors<'tcx> {
/// `DefId` or parameter index (`ty::ParamTy.index`) of a synthetic type parameter
/// for `impl Trait` in argument position.
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub(crate) enum ImplTraitParam {
DefId(DefId),
ParamIndex(u32),

View File

@ -65,8 +65,9 @@ pub(crate) fn build_index<'tcx>(
// Sort search index items. This improves the compressibility of the search index.
cache.search_index.sort_unstable_by(|k1, k2| {
// `sort_unstable_by_key` produces lifetime errors
let k1 = (&k1.path, k1.name.as_str(), &k1.ty, &k1.parent);
let k2 = (&k2.path, k2.name.as_str(), &k2.ty, &k2.parent);
// HACK(rustdoc): should not be sorting `CrateNum` or `DefIndex`, this will soon go away, too
let k1 = (&k1.path, k1.name.as_str(), &k1.ty, k1.parent.map(|id| (id.index, id.krate)));
let k2 = (&k2.path, k2.name.as_str(), &k2.ty, k2.parent.map(|id| (id.index, id.krate)));
Ord::cmp(&k1, &k2)
});

View File

@ -70,7 +70,7 @@ LL | f4(|_: (), _: ()| {});
| | found signature defined here
| expected due to this
|
= note: expected closure signature `for<'r, 'a> fn(&'a (), &'r ()) -> _`
= note: expected closure signature `for<'a, 'r> fn(&'a (), &'r ()) -> _`
found closure signature `fn((), ()) -> _`
note: required by a bound in `f4`
--> $DIR/anonymous-higher-ranked-lifetime.rs:19:25
@ -217,7 +217,7 @@ LL | h2(|_: (), _: (), _: (), _: ()| {});
| | found signature defined here
| expected due to this
|
= note: expected closure signature `for<'t0, 'a> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ())) -> _`
= note: expected closure signature `for<'a, 't0> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ())) -> _`
found closure signature `fn((), (), (), ()) -> _`
note: required by a bound in `h2`
--> $DIR/anonymous-higher-ranked-lifetime.rs:30:25

View File

@ -4,16 +4,16 @@ error[E0034]: multiple applicable items in scope
LL | const X: i32 = <i32>::ID;
| ^^ multiple `ID` found
|
note: candidate #1 is defined in an impl of the trait `Foo` for the type `i32`
--> $DIR/associated-const-ambiguity-report.rs:10:5
|
LL | const ID: i32 = 1;
| ^^^^^^^^^^^^^
note: candidate #2 is defined in an impl of the trait `Bar` for the type `i32`
note: candidate #1 is defined in an impl of the trait `Bar` for the type `i32`
--> $DIR/associated-const-ambiguity-report.rs:14:5
|
LL | const ID: i32 = 3;
| ^^^^^^^^^^^^^
note: candidate #2 is defined in an impl of the trait `Foo` for the type `i32`
--> $DIR/associated-const-ambiguity-report.rs:10:5
|
LL | const ID: i32 = 1;
| ^^^^^^^^^^^^^
help: use fully-qualified syntax to disambiguate
|
LL | const X: i32 = <i32 as Bar>::ID;

View File

@ -247,14 +247,14 @@ LL | _ = &&0 == Foo;
|
= help: the trait `PartialEq<Foo>` is not implemented for `&&{integer}`
= help: the following other types implement trait `PartialEq<Rhs>`:
isize
i8
f32
f64
i128
i16
i32
i64
i128
usize
u8
i8
isize
and 6 others
error[E0369]: binary operation `==` cannot be applied to type `Foo`
@ -303,10 +303,10 @@ LL | let _ = FOO & (*"Sized".to_string().into_boxed_str());
|
= help: the trait `BitAnd<str>` is not implemented for `i32`
= help: the following other types implement trait `BitAnd<Rhs>`:
<i32 as BitAnd>
<i32 as BitAnd<&i32>>
<&'a i32 as BitAnd<i32>>
<&i32 as BitAnd<&i32>>
<i32 as BitAnd<&i32>>
<i32 as BitAnd>
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/binary-op-suggest-deref.rs:78:17

View File

@ -6,10 +6,10 @@ LL | x * y
|
= help: the trait `Mul<f32>` is not implemented for `i32`
= help: the following other types implement trait `Mul<Rhs>`:
<i32 as Mul>
<i32 as Mul<&i32>>
<&'a i32 as Mul<i32>>
<&i32 as Mul<&i32>>
<i32 as Mul<&i32>>
<i32 as Mul>
error: aborting due to 1 previous error

View File

@ -6,14 +6,14 @@ LL | 22 >> p.char;
|
= help: the trait `Shr<char>` is not implemented for `{integer}`
= help: the following other types implement trait `Shr<Rhs>`:
<isize as Shr>
<isize as Shr<i8>>
<isize as Shr<i16>>
<isize as Shr<i32>>
<isize as Shr<i64>>
<isize as Shr<i128>>
<isize as Shr<usize>>
<isize as Shr<u8>>
<&'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`
@ -24,14 +24,14 @@ LL | 22 >> p.str;
|
= help: the trait `Shr<&str>` is not implemented for `{integer}`
= help: the following other types implement trait `Shr<Rhs>`:
<isize as Shr>
<isize as Shr<i8>>
<isize as Shr<i16>>
<isize as Shr<i32>>
<isize as Shr<i64>>
<isize as Shr<i128>>
<isize as Shr<usize>>
<isize as Shr<u8>>
<&'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`
@ -42,14 +42,14 @@ LL | 22 >> p;
|
= help: the trait `Shr<&Panolpy>` is not implemented for `{integer}`
= help: the following other types implement trait `Shr<Rhs>`:
<isize as Shr>
<isize as Shr<i8>>
<isize as Shr<i16>>
<isize as Shr<i32>>
<isize as Shr<i64>>
<isize as Shr<i128>>
<isize as Shr<usize>>
<isize as Shr<u8>>
<&'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

View File

@ -6,13 +6,13 @@ LL | <() as Foo<N>>::test()
|
= help: the following other types implement trait `Foo<N>`:
<() as Foo<0>>
<() as Foo<1>>
<() as Foo<2>>
<() as Foo<3>>
<() as Foo<4>>
<() as Foo<5>>
<() as Foo<6>>
<() as Foo<7>>
<() as Foo<100>>
<() as Foo<101>>
<() as Foo<102>>
<() as Foo<103>>
<() as Foo<104>>
<() as Foo<105>>
<() as Foo<106>>
and 248 others
error: aborting due to 1 previous error

View File

@ -6,11 +6,11 @@ LL | let y = Mask::<_, _>::splat(false);
|
= note: cannot satisfy `_: MaskElement`
= help: the following types implement trait `MaskElement`:
isize
i8
i16
i32
i64
i8
isize
note: required by a bound in `Mask::<T, N>::splat`
--> $SRC_DIR/core/src/../../portable-simd/crates/core_simd/src/masks.rs:LL:COL
help: consider giving `y` an explicit type, where the type for type parameter `T` is specified

View File

@ -5,8 +5,8 @@ LL | <u8 as Baz>::Quaks: Bar,
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `[u16; 3]`
|
= help: the following other types implement trait `Bar`:
[u16; 4]
[[u16; 3]; 3]
[u16; 4]
= help: see issue #48214
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
@ -20,8 +20,8 @@ LL | [<u8 as Baz>::Quaks; 2]: Bar,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
= help: the following other types implement trait `Bar`:
[u16; 4]
[[u16; 3]; 3]
[u16; 4]
= help: see issue #48214
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
@ -35,8 +35,8 @@ LL | impl Foo for FooImpl {}
| ^^^ the trait `Bar` is not implemented for `[u16; 3]`, which is required by `<u8 as Baz>::Quaks: Bar`
|
= help: the following other types implement trait `Bar`:
[u16; 4]
[[u16; 3]; 3]
[u16; 4]
note: required by a bound in `Foo`
--> $DIR/issue-67185-2.rs:15:25
|
@ -53,8 +53,8 @@ LL | impl Foo for FooImpl {}
| ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`, which is required by `[<u8 as Baz>::Quaks; 2]: Bar`
|
= help: the following other types implement trait `Bar`:
[u16; 4]
[[u16; 3]; 3]
[u16; 4]
note: required by a bound in `Foo`
--> $DIR/issue-67185-2.rs:14:30
|
@ -71,8 +71,8 @@ LL | fn f(_: impl Foo) {}
| ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`
|
= help: the following other types implement trait `Bar`:
[u16; 4]
[[u16; 3]; 3]
[u16; 4]
note: required by a bound in `Foo`
--> $DIR/issue-67185-2.rs:14:30
|
@ -89,8 +89,8 @@ LL | fn f(_: impl Foo) {}
| ^^^ the trait `Bar` is not implemented for `[u16; 3]`
|
= help: the following other types implement trait `Bar`:
[u16; 4]
[[u16; 3]; 3]
[u16; 4]
note: required by a bound in `Foo`
--> $DIR/issue-67185-2.rs:15:25
|

View File

@ -12,10 +12,10 @@ LL | = [0; (i8::MAX + 1u8) as usize];
|
= help: the trait `Add<u8>` is not implemented for `i8`
= help: the following other types implement trait `Add<Rhs>`:
<i8 as Add>
<i8 as Add<&i8>>
<&'a i8 as Add<i8>>
<&i8 as Add<&i8>>
<i8 as Add<&i8>>
<i8 as Add>
error: aborting due to 2 previous errors

View File

@ -12,10 +12,10 @@ LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
|
= help: the trait `Add<u8>` is not implemented for `i8`
= help: the following other types implement trait `Add<Rhs>`:
<i8 as Add>
<i8 as Add<&i8>>
<&'a i8 as Add<i8>>
<&i8 as Add<&i8>>
<i8 as Add<&i8>>
<i8 as Add>
error[E0604]: only `u8` can be cast as `char`, not `i8`
--> $DIR/const-eval-overflow-4b.rs:22:13

View File

@ -5,14 +5,14 @@ LL | <[X; 35] as Default>::default();
| ^^^^^^^ the trait `Default` is not implemented for `[X; 35]`
|
= help: the following other types implement trait `Default`:
&[T]
&mut [T]
[T; 0]
[T; 1]
[T; 2]
[T; 3]
[T; 4]
[T; 5]
[T; 6]
[T; 7]
[T; 10]
[T; 11]
[T; 12]
[T; 13]
[T; 14]
and 27 others
error: aborting due to 1 previous error

View File

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

View File

@ -8,14 +8,14 @@ LL | Float(Option<f64>),
| ^^^^^^^^^^^ the trait `Eq` is not implemented for `f64`, which is required by `Option<f64>: Eq`
|
= help: the following other types implement trait `Eq`:
isize
i8
i128
i16
i32
i64
i128
usize
u8
i8
isize
u128
u16
and 4 others
= note: required for `Option<f64>` to implement `Eq`
note: required by a bound in `AssertParamIsEq`

View File

@ -7,12 +7,12 @@ LL | f1.foo(1usize);
| required by a bound introduced by this call
|
= help: the following other types implement trait `Foo<A>`:
<Bar as Foo<i8>>
<Bar as Foo<i16>>
<Bar as Foo<i32>>
<Bar as Foo<u8>>
<Bar as Foo<i8>>
<Bar as Foo<u16>>
<Bar as Foo<u32>>
<Bar as Foo<u8>>
error: aborting due to 1 previous error

View File

@ -8,10 +8,10 @@ LL | Foo::<i32>::bar(&1i8);
|
= help: the following other types implement trait `Foo<B>`:
<i8 as Foo<bool>>
<i8 as Foo<u8>>
<i8 as Foo<u16>>
<i8 as Foo<u32>>
<i8 as Foo<u64>>
<i8 as Foo<u8>>
error[E0277]: the trait bound `u8: Foo<i32>` is not satisfied
--> $DIR/issue-39802-show-5-trait-impls.rs:25:21
@ -38,10 +38,10 @@ LL | Foo::<i32>::bar(&true);
= help: the following other types implement trait `Foo<B>`:
<bool as Foo<bool>>
<bool as Foo<i8>>
<bool as Foo<u8>>
<bool as Foo<u16>>
<bool as Foo<u32>>
<bool as Foo<u64>>
<bool as Foo<u8>>
error: aborting due to 3 previous errors

View File

@ -7,14 +7,14 @@ LL | format!("{:X}", "3");
| required by a bound introduced by this call
|
= help: the following other types implement trait `UpperHex`:
isize
i8
&T
&mut T
NonZero<T>
Saturating<T>
Wrapping<T>
i128
i16
i32
i64
i128
usize
u8
and 9 others
= note: required for `&str` to implement `UpperHex`
note: required by a bound in `core::fmt::rt::Argument::<'a>::new_upper_hex`

View File

@ -30,10 +30,10 @@ LL | n + sum_to(n - 1)
|
= help: the trait `Add<impl Foo>` is not implemented for `u32`
= help: the following other types implement trait `Add<Rhs>`:
<u32 as Add>
<u32 as Add<&u32>>
<&'a u32 as Add<u32>>
<&u32 as Add<&u32>>
<u32 as Add<&u32>>
<u32 as Add>
error: aborting due to 2 previous errors; 1 warning emitted

View File

@ -35,14 +35,14 @@ LL | -> <::std::ops::Range<impl Debug> as Iterator>::Item
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Step` is not implemented for `impl Debug`, which is required by `std::ops::Range<impl Debug>: Iterator`
|
= help: the following other types implement trait `Step`:
Char
Ipv4Addr
Ipv6Addr
char
isize
i8
i128
i16
i32
i64
i128
usize
and 8 others
= note: required for `std::ops::Range<impl Debug>` to implement `Iterator`
@ -56,14 +56,14 @@ LL | | }
| |_^ the trait `Step` is not implemented for `impl Debug`, which is required by `std::ops::Range<impl Debug>: Iterator`
|
= help: the following other types implement trait `Step`:
Char
Ipv4Addr
Ipv6Addr
char
isize
i8
i128
i16
i32
i64
i128
usize
and 8 others
= note: required for `std::ops::Range<impl Debug>` to implement `Iterator`

View File

@ -127,8 +127,8 @@ LL | Foo.method();
= note: the following traits define an item `method`, perhaps you need to implement one of them:
candidate #1: `foo::Bar`
candidate #2: `PubPub`
candidate #3: `no_method_suggested_traits::qux::PrivPub`
candidate #4: `Reexported`
candidate #3: `Reexported`
candidate #4: `no_method_suggested_traits::qux::PrivPub`
error[E0599]: no method named `method` found for struct `Rc<&mut Box<&Foo>>` in the current scope
--> $DIR/no-method-suggested-traits.rs:42:43
@ -140,8 +140,8 @@ LL | std::rc::Rc::new(&mut Box::new(&Foo)).method();
= note: the following traits define an item `method`, perhaps you need to implement one of them:
candidate #1: `foo::Bar`
candidate #2: `PubPub`
candidate #3: `no_method_suggested_traits::qux::PrivPub`
candidate #4: `Reexported`
candidate #3: `Reexported`
candidate #4: `no_method_suggested_traits::qux::PrivPub`
error[E0599]: no method named `method2` found for type `u64` in the current scope
--> $DIR/no-method-suggested-traits.rs:45:10

View File

@ -6,14 +6,14 @@ LL | 1 +
|
= help: the trait `Add<()>` is not implemented for `{integer}`
= help: the following other types implement trait `Add<Rhs>`:
<isize as Add>
<isize as Add<&isize>>
<i8 as Add>
<i8 as Add<&i8>>
<i16 as Add>
<i16 as Add<&i16>>
<i32 as Add>
<i32 as Add<&i32>>
<&'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}`
@ -24,14 +24,14 @@ LL | 1 +
|
= help: the trait `Add<()>` is not implemented for `{integer}`
= help: the following other types implement trait `Add<Rhs>`:
<isize as Add>
<isize as Add<&isize>>
<i8 as Add>
<i8 as Add<&i8>>
<i16 as Add>
<i16 as Add<&i16>>
<i32 as Add>
<i32 as Add<&i32>>
<&'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

@ -4,17 +4,17 @@ error[E0034]: multiple applicable items in scope
LL | x.foo();
| ^^^ multiple `foo` found
|
note: candidate #1 is defined in an impl for the type `(dyn T + 'a)`
--> $DIR/issue-18446.rs:9:5
|
LL | fn foo(&self) {}
| ^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `T`
note: candidate #1 is defined in the trait `T`
--> $DIR/issue-18446.rs:5:5
|
LL | fn foo(&self);
| ^^^^^^^^^^^^^^
help: disambiguate the method for candidate #2
note: candidate #2 is defined in an impl for the type `(dyn T + 'a)`
--> $DIR/issue-18446.rs:9:5
|
LL | fn foo(&self) {}
| ^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
|
LL | T::foo(&x);
| ~~~~~~~~~~

View File

@ -6,10 +6,10 @@ LL | 1.0f64 - 1
|
= help: the trait `Sub<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Sub<Rhs>`:
<f64 as Sub>
<f64 as Sub<&f64>>
<&'a f64 as Sub<f64>>
<&f64 as Sub<&f64>>
<f64 as Sub<&f64>>
<f64 as Sub>
help: consider using a floating-point literal by writing it with `.0`
|
LL | 1.0f64 - 1.0

View File

@ -4,24 +4,24 @@ error[E0034]: multiple applicable items in scope
LL | self.to_int() + other.to_int()
| ^^^^^^ multiple `to_int` found
|
note: candidate #1 is defined in an impl of the trait `ToPrimitive` for the type `isize`
--> $DIR/issue-3702-2.rs:2:5
|
LL | fn to_int(&self) -> isize { 0 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl of the trait `Add` for the type `isize`
note: candidate #1 is defined in an impl of the trait `Add` for the type `isize`
--> $DIR/issue-3702-2.rs:14:5
|
LL | fn to_int(&self) -> isize { *self }
| ^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
note: candidate #2 is defined in an impl of the trait `ToPrimitive` for the type `isize`
--> $DIR/issue-3702-2.rs:2:5
|
LL | ToPrimitive::to_int(&self) + other.to_int()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #2
LL | fn to_int(&self) -> isize { 0 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
|
LL | Add::to_int(&self) + other.to_int()
| ~~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #2
|
LL | ToPrimitive::to_int(&self) + other.to_int()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 1 previous error

View File

@ -16,14 +16,14 @@ LL | Vec::<[(); 1 + for x in 0..1 {}]>::new();
|
= help: the trait `Add<()>` is not implemented for `{integer}`
= help: the following other types implement trait `Add<Rhs>`:
<isize as Add>
<isize as Add<&isize>>
<i8 as Add>
<i8 as Add<&i8>>
<i16 as Add>
<i16 as Add<&i16>>
<i32 as Add>
<i32 as Add<&i32>>
<&'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

@ -33,8 +33,8 @@ LL | println!("{}", scores.sum::<i32>());
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
<i32 as Sum>
<i32 as Sum<&'a i32>>
<i32 as Sum>
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain-fixable.rs:14:10
|
@ -66,8 +66,8 @@ LL | .sum::<i32>(),
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
<i32 as Sum>
<i32 as Sum<&'a i32>>
<i32 as Sum>
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain-fixable.rs:23:14
|
@ -99,8 +99,8 @@ LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
<i32 as Sum>
<i32 as Sum<&'a i32>>
<i32 as Sum>
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain-fixable.rs:27:38
|

View File

@ -8,8 +8,8 @@ LL | let x = Some(()).iter().map(|()| 1).sum::<f32>();
|
= help: the trait `Sum<{integer}>` is not implemented for `f32`
= help: the following other types implement trait `Sum<A>`:
<f32 as Sum>
<f32 as Sum<&'a f32>>
<f32 as Sum>
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain-with-int-infer.rs:2:29
|

View File

@ -33,8 +33,8 @@ LL | println!("{}", scores.sum::<i32>());
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
<i32 as Sum>
<i32 as Sum<&'a i32>>
<i32 as Sum>
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain.rs:12:10
|
@ -65,8 +65,8 @@ LL | .sum::<i32>(),
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
<i32 as Sum>
<i32 as Sum<&'a i32>>
<i32 as Sum>
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain.rs:25:14
|
@ -104,8 +104,8 @@ LL | .sum::<i32>(),
|
= help: the trait `Sum<f64>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
<i32 as Sum>
<i32 as Sum<&'a i32>>
<i32 as Sum>
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain.rs:33:14
|
@ -134,8 +134,8 @@ LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
|
= help: the trait `Sum<()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
<i32 as Sum>
<i32 as Sum<&'a i32>>
<i32 as Sum>
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain.rs:38:38
|
@ -162,8 +162,8 @@ LL | println!("{}", vec![(), ()].iter().sum::<i32>());
|
= help: the trait `Sum<&()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
<i32 as Sum>
<i32 as Sum<&'a i32>>
<i32 as Sum>
note: the method call chain might not have had the expected associated types
--> $DIR/invalid-iterator-chain.rs:39:33
|

View File

@ -5,12 +5,12 @@ LL | let _: Alias<()>;
| ^^ the trait `From<()>` is not implemented for `String`
|
= help: the following other types implement trait `From<T>`:
<String as From<char>>
<String as From<&String>>
<String as From<&mut str>>
<String as From<&str>>
<String as From<Box<str>>>
<String as From<Cow<'a, str>>>
<String as From<&str>>
<String as From<&mut str>>
<String as From<&String>>
<String as From<char>>
note: required by a bound in `Alias`
--> $DIR/trailing-where-clause.rs:8:13
|

View File

@ -4,20 +4,20 @@ error[E0034]: multiple applicable items in scope
LL | fn main() { 1_usize.me(); }
| ^^ multiple `me` found
|
= note: candidate #1 is defined in an impl of the trait `Me` for the type `usize`
note: candidate #2 is defined in an impl of the trait `Me2` for the type `usize`
note: candidate #1 is defined in an impl of the trait `Me2` for the type `usize`
--> $DIR/method-ambig-two-traits-cross-crate.rs:10:22
|
LL | impl Me2 for usize { fn me(&self) -> usize { *self } }
| ^^^^^^^^^^^^^^^^^^^^^
= note: candidate #2 is defined in an impl of the trait `Me` for the type `usize`
help: disambiguate the method for candidate #1
|
LL | fn main() { Me::me(&1_usize); }
| ~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #2
|
LL | fn main() { Me2::me(&1_usize); }
| ~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #2
|
LL | fn main() { Me::me(&1_usize); }
| ~~~~~~~~~~~~~~~~
error: aborting due to 1 previous error

View File

@ -4,23 +4,23 @@ error[E0034]: multiple applicable items in scope
LL | 1_usize.method();
| ^^^^^^ multiple `method` found
|
note: candidate #1 is defined in an impl of the trait `Foo` for the type `usize`
--> $DIR/method-ambig-two-traits-with-default-method.rs:5:13
|
LL | trait Foo { fn method(&self) {} }
| ^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl of the trait `Bar` for the type `usize`
note: candidate #1 is defined in an impl of the trait `Bar` for the type `usize`
--> $DIR/method-ambig-two-traits-with-default-method.rs:6:13
|
LL | trait Bar { fn method(&self) {} }
| ^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl of the trait `Foo` for the type `usize`
--> $DIR/method-ambig-two-traits-with-default-method.rs:5:13
|
LL | trait Foo { fn method(&self) {} }
| ^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
|
LL | Foo::method(&1_usize);
LL | Bar::method(&1_usize);
| ~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #2
|
LL | Bar::method(&1_usize);
LL | Foo::method(&1_usize);
| ~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 1 previous error

View File

@ -64,8 +64,8 @@ note: the trait `Iterator` must be implemented
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following traits define an item `take`, perhaps you need to implement one of them:
candidate #1: `std::io::Read`
candidate #2: `Iterator`
candidate #1: `Iterator`
candidate #2: `std::io::Read`
error[E0061]: this method takes 3 arguments but 0 arguments were supplied
--> $DIR/method-call-err-msg.rs:21:7

View File

@ -29,33 +29,33 @@ error[E0034]: multiple applicable items in scope
LL | let z = x.foo();
| ^^^ multiple `foo` found
|
note: candidate #1 is defined in an impl of the trait `X` for the type `T`
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:45:9
note: candidate #1 is defined in the trait `FinalFoo`
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:59:5
|
LL | fn foo(self: Smaht<Self, u64>) -> u64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn foo(&self) -> u8;
| ^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl of the trait `NuisanceFoo` for the type `T`
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:72:9
|
LL | fn foo(self) {}
| ^^^^^^^^^^^^
note: candidate #3 is defined in the trait `FinalFoo`
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:59:5
note: candidate #3 is defined in an impl of the trait `X` for the type `T`
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:45:9
|
LL | fn foo(&self) -> u8;
| ^^^^^^^^^^^^^^^^^^^^
LL | fn foo(self: Smaht<Self, u64>) -> u64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the method for candidate #1
|
LL | let z = X::foo(x);
| ~~~~~~~~~
LL | let z = FinalFoo::foo(&x);
| ~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #2
|
LL | let z = NuisanceFoo::foo(x);
| ~~~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #3
|
LL | let z = FinalFoo::foo(&x);
| ~~~~~~~~~~~~~~~~~
LL | let z = X::foo(x);
| ~~~~~~~~~
error[E0308]: mismatched types
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:139:24

View File

@ -35,10 +35,10 @@ LL | wrapper.method();
| ^^^^^^ method not found in `Wrapper<bool>`
|
= note: the method was found for
- `Wrapper<i8>`
- `Wrapper<i16>`
- `Wrapper<i32>`
- `Wrapper<i64>`
- `Wrapper<i8>`
and 2 more types
error[E0599]: no method named `other` found for struct `Wrapper` in the current scope
@ -60,9 +60,9 @@ LL | wrapper.method();
| ^^^^^^ method not found in `Wrapper2<'_, bool, 3>`
|
= note: the method was found for
- `Wrapper2<'a, i8, C>`
- `Wrapper2<'a, i16, C>`
- `Wrapper2<'a, i32, C>`
- `Wrapper2<'a, i8, C>`
error[E0599]: no method named `other` found for struct `Wrapper2` in the current scope
--> $DIR/method-not-found-generic-arg-elision.rs:98:13

View File

@ -6,14 +6,14 @@ LL | 1 + Some(1);
|
= help: the trait `Add<Option<{integer}>>` is not implemented for `{integer}`
= help: the following other types implement trait `Add<Rhs>`:
<isize as Add>
<isize as Add<&isize>>
<i8 as Add>
<i8 as Add<&i8>>
<i16 as Add>
<i16 as Add<&i16>>
<i32 as Add>
<i32 as Add<&i32>>
<&'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`
@ -24,10 +24,10 @@ LL | 2 as usize - Some(1);
|
= help: the trait `Sub<Option<{integer}>>` is not implemented for `usize`
= help: the following other types implement trait `Sub<Rhs>`:
<usize as Sub>
<usize as Sub<&usize>>
<&'a usize as Sub<usize>>
<&usize as Sub<&usize>>
<usize as Sub<&usize>>
<usize as Sub>
error[E0277]: cannot multiply `{integer}` by `()`
--> $DIR/binops.rs:4:7
@ -37,14 +37,14 @@ LL | 3 * ();
|
= help: the trait `Mul<()>` is not implemented for `{integer}`
= help: the following other types implement trait `Mul<Rhs>`:
<isize as Mul>
<isize as Mul<&isize>>
<i8 as Mul>
<i8 as Mul<&i8>>
<i16 as Mul>
<i16 as Mul<&i16>>
<i32 as Mul>
<i32 as Mul<&i32>>
<&'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`
@ -55,14 +55,14 @@ LL | 4 / "";
|
= help: the trait `Div<&str>` is not implemented for `{integer}`
= help: the following other types implement trait `Div<Rhs>`:
<isize as Div>
<isize as Div<&isize>>
<i8 as Div>
<i8 as Div<&i8>>
<i16 as Div>
<i16 as Div<&i16>>
<i32 as Div>
<i32 as Div<&i32>>
<&'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`
@ -73,14 +73,14 @@ LL | 5 < String::new();
|
= help: the trait `PartialOrd<String>` is not implemented for `{integer}`
= help: the following other types implement trait `PartialOrd<Rhs>`:
isize
i8
f32
f64
i128
i16
i32
i64
i128
usize
u8
i8
isize
and 6 others
error[E0277]: can't compare `{integer}` with `Result<{integer}, _>`
@ -91,14 +91,14 @@ LL | 6 == Ok(1);
|
= help: the trait `PartialEq<Result<{integer}, _>>` is not implemented for `{integer}`
= help: the following other types implement trait `PartialEq<Rhs>`:
isize
i8
f32
f64
i128
i16
i32
i64
i128
usize
u8
i8
isize
and 6 others
error: aborting due to 6 previous errors

View File

@ -7,8 +7,8 @@ LL | unconstrained_arg(return);
| required by a bound introduced by this call
|
= help: the following other types implement trait `Test`:
i32
()
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

@ -6,10 +6,10 @@ LL | 2_usize + (loop {});
|
= help: the trait `Add<()>` is not implemented for `usize`
= help: the following other types implement trait `Add<Rhs>`:
<usize as Add>
<usize as Add<&usize>>
<&'a usize as Add<usize>>
<&usize as Add<&usize>>
<usize as Add<&usize>>
<usize as Add>
error: aborting due to 1 previous error

View File

@ -6,10 +6,10 @@ LL | x + 100.0
|
= help: the trait `Add<{float}>` is not implemented for `u8`
= help: the following other types implement trait `Add<Rhs>`:
<u8 as Add>
<u8 as Add<&u8>>
<&'a u8 as Add<u8>>
<&u8 as Add<&u8>>
<u8 as Add<&u8>>
<u8 as Add>
error[E0277]: cannot add `&str` to `f64`
--> $DIR/not-suggest-float-literal.rs:6:7
@ -19,10 +19,10 @@ LL | x + "foo"
|
= help: the trait `Add<&str>` is not implemented for `f64`
= help: the following other types implement trait `Add<Rhs>`:
<f64 as Add>
<f64 as Add<&f64>>
<&'a f64 as Add<f64>>
<&f64 as Add<&f64>>
<f64 as Add<&f64>>
<f64 as Add>
error[E0277]: cannot add `{integer}` to `f64`
--> $DIR/not-suggest-float-literal.rs:11:7
@ -32,10 +32,10 @@ LL | x + y
|
= help: the trait `Add<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Add<Rhs>`:
<f64 as Add>
<f64 as Add<&f64>>
<&'a f64 as Add<f64>>
<&f64 as Add<&f64>>
<f64 as Add<&f64>>
<f64 as Add>
error[E0277]: cannot subtract `{float}` from `u8`
--> $DIR/not-suggest-float-literal.rs:15:7
@ -45,10 +45,10 @@ LL | x - 100.0
|
= help: the trait `Sub<{float}>` is not implemented for `u8`
= help: the following other types implement trait `Sub<Rhs>`:
<u8 as Sub>
<u8 as Sub<&u8>>
<&'a u8 as Sub<u8>>
<&u8 as Sub<&u8>>
<u8 as Sub<&u8>>
<u8 as Sub>
error[E0277]: cannot subtract `&str` from `f64`
--> $DIR/not-suggest-float-literal.rs:19:7
@ -58,10 +58,10 @@ LL | x - "foo"
|
= help: the trait `Sub<&str>` is not implemented for `f64`
= help: the following other types implement trait `Sub<Rhs>`:
<f64 as Sub>
<f64 as Sub<&f64>>
<&'a f64 as Sub<f64>>
<&f64 as Sub<&f64>>
<f64 as Sub<&f64>>
<f64 as Sub>
error[E0277]: cannot subtract `{integer}` from `f64`
--> $DIR/not-suggest-float-literal.rs:24:7
@ -71,10 +71,10 @@ LL | x - y
|
= help: the trait `Sub<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Sub<Rhs>`:
<f64 as Sub>
<f64 as Sub<&f64>>
<&'a f64 as Sub<f64>>
<&f64 as Sub<&f64>>
<f64 as Sub<&f64>>
<f64 as Sub>
error[E0277]: cannot multiply `u8` by `{float}`
--> $DIR/not-suggest-float-literal.rs:28:7
@ -84,10 +84,10 @@ LL | x * 100.0
|
= help: the trait `Mul<{float}>` is not implemented for `u8`
= help: the following other types implement trait `Mul<Rhs>`:
<u8 as Mul>
<u8 as Mul<&u8>>
<&'a u8 as Mul<u8>>
<&u8 as Mul<&u8>>
<u8 as Mul<&u8>>
<u8 as Mul>
error[E0277]: cannot multiply `f64` by `&str`
--> $DIR/not-suggest-float-literal.rs:32:7
@ -97,10 +97,10 @@ LL | x * "foo"
|
= help: the trait `Mul<&str>` is not implemented for `f64`
= help: the following other types implement trait `Mul<Rhs>`:
<f64 as Mul>
<f64 as Mul<&f64>>
<&'a f64 as Mul<f64>>
<&f64 as Mul<&f64>>
<f64 as Mul<&f64>>
<f64 as Mul>
error[E0277]: cannot multiply `f64` by `{integer}`
--> $DIR/not-suggest-float-literal.rs:37:7
@ -110,10 +110,10 @@ LL | x * y
|
= help: the trait `Mul<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Mul<Rhs>`:
<f64 as Mul>
<f64 as Mul<&f64>>
<&'a f64 as Mul<f64>>
<&f64 as Mul<&f64>>
<f64 as Mul<&f64>>
<f64 as Mul>
error[E0277]: cannot divide `u8` by `{float}`
--> $DIR/not-suggest-float-literal.rs:41:7
@ -123,11 +123,11 @@ LL | x / 100.0
|
= help: the trait `Div<{float}>` is not implemented for `u8`
= help: the following other types implement trait `Div<Rhs>`:
<u8 as Div>
<u8 as Div<NonZero<u8>>>
<u8 as Div<&u8>>
<&'a u8 as Div<u8>>
<&u8 as Div<&u8>>
<u8 as Div<&u8>>
<u8 as Div<NonZero<u8>>>
<u8 as Div>
error[E0277]: cannot divide `f64` by `&str`
--> $DIR/not-suggest-float-literal.rs:45:7
@ -137,10 +137,10 @@ LL | x / "foo"
|
= help: the trait `Div<&str>` is not implemented for `f64`
= help: the following other types implement trait `Div<Rhs>`:
<f64 as Div>
<f64 as Div<&f64>>
<&'a f64 as Div<f64>>
<&f64 as Div<&f64>>
<f64 as Div<&f64>>
<f64 as Div>
error[E0277]: cannot divide `f64` by `{integer}`
--> $DIR/not-suggest-float-literal.rs:50:7
@ -150,10 +150,10 @@ LL | x / y
|
= help: the trait `Div<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Div<Rhs>`:
<f64 as Div>
<f64 as Div<&f64>>
<&'a f64 as Div<f64>>
<&f64 as Div<&f64>>
<f64 as Div<&f64>>
<f64 as Div>
error: aborting due to 12 previous errors

View File

@ -6,10 +6,10 @@ LL | x + 100
|
= help: the trait `Add<{integer}>` is not implemented for `f32`
= help: the following other types implement trait `Add<Rhs>`:
<f32 as Add>
<f32 as Add<&f32>>
<&'a f32 as Add<f32>>
<&f32 as Add<&f32>>
<f32 as Add<&f32>>
<f32 as Add>
help: consider using a floating-point literal by writing it with `.0`
|
LL | x + 100.0
@ -23,10 +23,10 @@ LL | x + 100
|
= help: the trait `Add<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Add<Rhs>`:
<f64 as Add>
<f64 as Add<&f64>>
<&'a f64 as Add<f64>>
<&f64 as Add<&f64>>
<f64 as Add<&f64>>
<f64 as Add>
help: consider using a floating-point literal by writing it with `.0`
|
LL | x + 100.0
@ -40,10 +40,10 @@ LL | x - 100
|
= help: the trait `Sub<{integer}>` is not implemented for `f32`
= help: the following other types implement trait `Sub<Rhs>`:
<f32 as Sub>
<f32 as Sub<&f32>>
<&'a f32 as Sub<f32>>
<&f32 as Sub<&f32>>
<f32 as Sub<&f32>>
<f32 as Sub>
help: consider using a floating-point literal by writing it with `.0`
|
LL | x - 100.0
@ -57,10 +57,10 @@ LL | x - 100
|
= help: the trait `Sub<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Sub<Rhs>`:
<f64 as Sub>
<f64 as Sub<&f64>>
<&'a f64 as Sub<f64>>
<&f64 as Sub<&f64>>
<f64 as Sub<&f64>>
<f64 as Sub>
help: consider using a floating-point literal by writing it with `.0`
|
LL | x - 100.0
@ -74,10 +74,10 @@ LL | x * 100
|
= help: the trait `Mul<{integer}>` is not implemented for `f32`
= help: the following other types implement trait `Mul<Rhs>`:
<f32 as Mul>
<f32 as Mul<&f32>>
<&'a f32 as Mul<f32>>
<&f32 as Mul<&f32>>
<f32 as Mul<&f32>>
<f32 as Mul>
help: consider using a floating-point literal by writing it with `.0`
|
LL | x * 100.0
@ -91,10 +91,10 @@ LL | x * 100
|
= help: the trait `Mul<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Mul<Rhs>`:
<f64 as Mul>
<f64 as Mul<&f64>>
<&'a f64 as Mul<f64>>
<&f64 as Mul<&f64>>
<f64 as Mul<&f64>>
<f64 as Mul>
help: consider using a floating-point literal by writing it with `.0`
|
LL | x * 100.0
@ -108,10 +108,10 @@ LL | x / 100
|
= help: the trait `Div<{integer}>` is not implemented for `f32`
= help: the following other types implement trait `Div<Rhs>`:
<f32 as Div>
<f32 as Div<&f32>>
<&'a f32 as Div<f32>>
<&f32 as Div<&f32>>
<f32 as Div<&f32>>
<f32 as Div>
help: consider using a floating-point literal by writing it with `.0`
|
LL | x / 100.0
@ -125,10 +125,10 @@ LL | x / 100
|
= help: the trait `Div<{integer}>` is not implemented for `f64`
= help: the following other types implement trait `Div<Rhs>`:
<f64 as Div>
<f64 as Div<&f64>>
<&'a f64 as Div<f64>>
<&f64 as Div<&f64>>
<f64 as Div<&f64>>
<f64 as Div>
help: consider using a floating-point literal by writing it with `.0`
|
LL | x / 100.0

View File

@ -8,8 +8,8 @@ LL | Index::index(&[] as &[i32], 2u32);
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
= help: the following other types implement trait `Index<Idx>`:
<[i32] as Index<Foo<usize>>>
<[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:33
@ -21,8 +21,8 @@ LL | Index::index(&[] as &[i32], Foo(2u32));
|
= help: the trait `Index<Foo<u32>>` is not implemented for `[i32]`
= help: the following other types implement trait `Index<Idx>`:
<[i32] as Index<Foo<usize>>>
<[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:33
@ -34,8 +34,8 @@ LL | Index::index(&[] as &[i32], Bar(2u32));
|
= help: the trait `Index<Bar<u32>>` is not implemented for `[i32]`
= help: the following other types implement trait `Index<Idx>`:
<[i32] as Index<Foo<usize>>>
<[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
@ -45,8 +45,8 @@ LL | Index::index(&[] as &[i32], 2u32);
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
= help: the following other types implement trait `Index<Idx>`:
<[i32] as Index<Foo<usize>>>
<[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
@ -56,8 +56,8 @@ LL | Index::index(&[] as &[i32], Foo(2u32));
|
= help: the trait `Index<Foo<u32>>` is not implemented for `[i32]`
= help: the following other types implement trait `Index<Idx>`:
<[i32] as Index<Foo<usize>>>
<[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
@ -67,8 +67,8 @@ LL | Index::index(&[] as &[i32], Bar(2u32));
|
= help: the trait `Index<Bar<u32>>` is not implemented for `[i32]`
= help: the following other types implement trait `Index<Idx>`:
<[i32] as Index<Foo<usize>>>
<[i32] as Index<Bar<usize>>>
<[i32] as Index<Foo<usize>>>
error: aborting due to 6 previous errors

View File

@ -17,8 +17,8 @@ LL | x[..1i32];
|
= help: the trait `SliceIndex<[i32]>` is not implemented for `RangeTo<i32>`, which is required by `[i32]: Index<_>`
= help: the following other types implement trait `SliceIndex<T>`:
<RangeTo<usize> as SliceIndex<str>>
<RangeTo<usize> as SliceIndex<[T]>>
<RangeTo<usize> as SliceIndex<str>>
= note: required for `[i32]` to implement `Index<RangeTo<i32>>`
error: aborting due to 2 previous errors

View File

@ -8,8 +8,8 @@ LL | vec![(), ()].iter().sum::<i32>();
|
= help: the trait `Sum<&()>` is not implemented for `i32`
= help: the following other types implement trait `Sum<A>`:
<i32 as Sum>
<i32 as Sum<&'a i32>>
<i32 as Sum>
note: the method call chain might not have had the expected associated types
--> $DIR/sum.rs:4:18
|
@ -30,8 +30,8 @@ LL | vec![(), ()].iter().product::<i32>();
|
= help: the trait `Product<&()>` is not implemented for `i32`
= help: the following other types implement trait `Product<A>`:
<i32 as Product>
<i32 as Product<&'a i32>>
<i32 as Product>
note: the method call chain might not have had the expected associated types
--> $DIR/sum.rs:7:18
|

View File

@ -11,14 +11,14 @@ LL | for i in false..true {}
| ^^^^^^^^^^^ the trait `Step` is not implemented for `bool`, which is required by `std::ops::Range<bool>: IntoIterator`
|
= help: the following other types implement trait `Step`:
Char
Ipv4Addr
Ipv6Addr
char
isize
i8
i128
i16
i32
i64
i128
usize
and 8 others
= note: required for `std::ops::Range<bool>` to implement `Iterator`
= note: required for `std::ops::Range<bool>` to implement `IntoIterator`

View File

@ -6,10 +6,10 @@ LL | foo(1 as u32 +
|
= help: the trait `Add<()>` is not implemented for `u32`
= help: the following other types implement trait `Add<Rhs>`:
<u32 as Add>
<u32 as Add<&u32>>
<&'a u32 as Add<u32>>
<&u32 as Add<&u32>>
<u32 as Add<&u32>>
<u32 as Add>
error: aborting due to 1 previous error

View File

@ -16,8 +16,8 @@ LL | fn bar() -> impl Bar {
| ^^^^^^^^ the trait `Bar` is not implemented for `()`
|
= help: the following other types implement trait `Bar`:
i32
Qux
i32
error: aborting due to 2 previous errors

View File

@ -8,12 +8,12 @@ LL | foo(String::new());
|
= note: to coerce a `String` into a `&str`, use `&*` as a prefix
= help: the following other types implement trait `From<T>`:
<String as From<char>>
<String as From<&String>>
<String as From<&mut str>>
<String as From<&str>>
<String as From<Box<str>>>
<String as From<Cow<'a, str>>>
<String as From<&str>>
<String as From<&mut str>>
<String as From<&String>>
<String as From<char>>
= note: required for `String` to implement `Into<&str>`
note: required by a bound in `foo`
--> $DIR/into-str.rs:1:31

View File

@ -5,14 +5,14 @@ LL | let _: &[i8] = data.into();
| ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]`, which is required by `&[u8]: Into<_>`
|
= help: the following other types implement trait `From<T>`:
<[bool; N] as From<Mask<T, N>>>
<[T; N] as From<Simd<T, N>>>
<[T; 10] as From<(T, T, T, T, T, T, T, T, T, T)>>
<[T; 11] as From<(T, T, T, T, T, T, T, T, T, T, T)>>
<[T; 12] as From<(T, T, T, T, T, T, T, T, T, T, T, T)>>
<[T; 1] as From<(T,)>>
<[T; 2] as From<(T, T)>>
<[T; 3] as From<(T, T, T)>>
<[T; 4] as From<(T, T, T, T)>>
<[T; 5] as From<(T, T, T, T, T)>>
<[T; 6] as From<(T, T, T, T, T, T)>>
and 6 others
= note: required for `&[u8]` to implement `Into<&[i8]>`

View File

@ -6,13 +6,13 @@ LL | s.strip_suffix(b'\n').unwrap_or(s)
|
= help: the trait `FnMut<(char,)>` is not implemented for `u8`, which is required by `u8: Pattern<'_>`
= help: the following other types implement trait `Pattern<'a>`:
char
[char; N]
&'b String
&'b [char; N]
&'b [char]
&'c &'b str
&'b str
&'c &'b str
[char; N]
char
= note: required for `u8` to implement `Pattern<'_>`
error: aborting due to 1 previous error

View File

@ -9,10 +9,10 @@ LL | a.cmp(&b)
= help: items from traits can only be used if the type parameter is bounded by the trait
help: the following traits define an item `cmp`, perhaps you need to restrict type parameter `T` with one of them:
|
LL | fn f<T: Ord>(a: T, b: T) -> std::cmp::Ordering {
| +++++
LL | fn f<T: Iterator>(a: T, b: T) -> std::cmp::Ordering {
| ++++++++++
LL | fn f<T: Ord>(a: T, b: T) -> std::cmp::Ordering {
| +++++
error[E0599]: the method `cmp` exists for reference `&T`, but its trait bounds were not satisfied
--> $DIR/method-on-unbounded-type-param.rs:5:10
@ -30,10 +30,10 @@ LL | (&a).cmp(&b)
= help: items from traits can only be used if the type parameter is bounded by the trait
help: the following traits define an item `cmp`, perhaps you need to restrict type parameter `T` with one of them:
|
LL | fn g<T: Ord>(a: T, b: T) -> std::cmp::Ordering {
| +++++
LL | fn g<T: Iterator>(a: T, b: T) -> std::cmp::Ordering {
| ++++++++++
LL | fn g<T: Ord>(a: T, b: T) -> std::cmp::Ordering {
| +++++
error[E0599]: the method `cmp` exists for reference `&T`, but its trait bounds were not satisfied
--> $DIR/method-on-unbounded-type-param.rs:8:7
@ -51,10 +51,10 @@ LL | a.cmp(&b)
= help: items from traits can only be used if the type parameter is bounded by the trait
help: the following traits define an item `cmp`, perhaps you need to restrict type parameter `T` with one of them:
|
LL | fn h<T: Ord>(a: &T, b: T) -> std::cmp::Ordering {
| +++++
LL | fn h<T: Iterator>(a: &T, b: T) -> std::cmp::Ordering {
| ++++++++++
LL | fn h<T: Ord>(a: &T, b: T) -> std::cmp::Ordering {
| +++++
error[E0599]: the method `cmp` exists for struct `Box<dyn T>`, but its trait bounds were not satisfied
--> $DIR/method-on-unbounded-type-param.rs:14:7
@ -76,8 +76,8 @@ LL | x.cmp(&x);
which is required by `&mut dyn T: Iterator`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following traits define an item `cmp`, perhaps you need to implement one of them:
candidate #1: `Ord`
candidate #2: `Iterator`
candidate #1: `Iterator`
candidate #2: `Ord`
error: aborting due to 4 previous errors

View File

@ -31,12 +31,12 @@ LL | .map_err(|_| ())?;
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `From<T>`:
<String as From<char>>
<String as From<&String>>
<String as From<&mut str>>
<String as From<&str>>
<String as From<Box<str>>>
<String as From<Cow<'a, str>>>
<String as From<&str>>
<String as From<&mut str>>
<String as From<&String>>
<String as From<char>>
= note: required for `Result<(), String>` to implement `FromResidual<Result<Infallible, ()>>`
error[E0277]: `?` couldn't convert the error to `String`

View File

@ -10,8 +10,8 @@ LL | Ok(Err(123_i32)?)
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `From<T>`:
<u8 as From<bool>>
<u8 as From<Char>>
<u8 as From<bool>>
= note: required for `Result<u64, u8>` to implement `FromResidual<Result<Infallible, i32>>`
error[E0277]: the `?` operator can only be used on `Result`s, not `Option`s, in a function that returns `Result`
@ -24,8 +24,8 @@ LL | Some(3)?;
|
= help: the trait `FromResidual<Option<Infallible>>` is not implemented for `Result<u64, String>`
= help: the following other types implement trait `FromResidual<R>`:
<Result<T, F> as FromResidual<Yeet<E>>>
<Result<T, F> as FromResidual<Result<Infallible, E>>>
<Result<T, F> as FromResidual<Yeet<E>>>
error[E0277]: the `?` operator can only be used on `Result`s in a function that returns `Result`
--> $DIR/bad-interconversion.rs:17:31
@ -37,8 +37,8 @@ LL | Ok(ControlFlow::Break(123)?)
|
= help: the trait `FromResidual<ControlFlow<{integer}, Infallible>>` is not implemented for `Result<u64, String>`
= help: the following other types implement trait `FromResidual<R>`:
<Result<T, F> as FromResidual<Yeet<E>>>
<Result<T, F> as FromResidual<Result<Infallible, E>>>
<Result<T, F> as FromResidual<Yeet<E>>>
error[E0277]: the `?` operator can only be used on `Option`s, not `Result`s, in a function that returns `Option`
--> $DIR/bad-interconversion.rs:22:22

View File

@ -10,7 +10,6 @@ LL | Err(5)?;
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `From<T>`:
<(T,) as From<[T; 1]>>
<(T, T) as From<[T; 2]>>
<(T, T, T) as From<[T; 3]>>
<(T, T, T, T) as From<[T; 4]>>
@ -18,6 +17,7 @@ LL | Err(5)?;
<(T, T, T, T, T, T) as From<[T; 6]>>
<(T, T, T, T, T, T, T) as From<[T; 7]>>
<(T, T, T, T, T, T, T, T) as From<[T; 8]>>
<(T, T, T, T, T, T, T, T, T) as From<[T; 9]>>
and 4 others
= note: required for `Result<i32, ()>` to implement `FromResidual<Result<Infallible, {integer}>>`

View File

@ -9,8 +9,8 @@ LL | a?;
|
= help: the trait `FromResidual<Option<Infallible>>` is not implemented for `Result<(), ()>`
= help: the following other types implement trait `FromResidual<R>`:
<Result<T, F> as FromResidual<Yeet<E>>>
<Result<T, F> as FromResidual<Result<Infallible, E>>>
<Result<T, F> as FromResidual<Yeet<E>>>
error[E0277]: the `?` operator can only be used on `Option`s, not `Result`s, in a function that returns `Option`
--> $DIR/option-to-result.rs:11:6

View File

@ -9,8 +9,8 @@ LL | x?;
|
= help: the trait `FromResidual<Option<Infallible>>` is not implemented for `Result<u32, ()>`
= help: the following other types implement trait `FromResidual<R>`:
<Result<T, F> as FromResidual<Yeet<E>>>
<Result<T, F> as FromResidual<Result<Infallible, E>>>
<Result<T, F> as FromResidual<Yeet<E>>>
error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
--> $DIR/try-on-option.rs:11:6

View File

@ -8,8 +8,8 @@ LL | ()
| -- return type was inferred to be `()` here
|
= help: the following other types implement trait `Foo<A>`:
<() as Foo<u32>>
<() as Foo<()>>
<() as Foo<u32>>
error: aborting due to 1 previous error

View File

@ -66,10 +66,10 @@ LL | trait ProjectionPred<T:Iterator = IntoIter<i32>> where T::Item : Add<u8> {}
|
= help: the trait `Add<u8>` is not implemented for `i32`
= help: the following other types implement trait `Add<Rhs>`:
<i32 as Add>
<i32 as Add<&i32>>
<&'a i32 as Add<i32>>
<&i32 as Add<&i32>>
<i32 as Add<&i32>>
<i32 as Add>
error: aborting due to 7 previous errors

View File

@ -21,10 +21,10 @@ LL | a = c + b * 5;
|
= help: the trait `Add<u16>` is not implemented for `usize`
= help: the following other types implement trait `Add<Rhs>`:
<usize as Add>
<usize as Add<&usize>>
<&'a usize as Add<usize>>
<&usize as Add<&usize>>
<usize as Add<&usize>>
<usize as Add>
error: aborting due to 3 previous errors

View File

@ -7,11 +7,11 @@ LL | func(Path::new("hello").to_path_buf().to_string_lossy(), "world")
| required by a bound introduced by this call
|
= help: the following other types implement trait `From<T>`:
<PathBuf as From<&T>>
<PathBuf as From<Box<Path>>>
<PathBuf as From<Cow<'a, Path>>>
<PathBuf as From<OsString>>
<PathBuf as From<String>>
<PathBuf as From<&T>>
= note: required for `Cow<'_, str>` to implement `Into<PathBuf>`
note: required by a bound in `func`
--> $DIR/issue-90101.rs:3:20

View File

@ -6,10 +6,10 @@ LL | <i32 as Add<u32>>::add(1, 2);
|
= help: the trait `Add<u32>` is not implemented for `i32`
= help: the following other types implement trait `Add<Rhs>`:
<i32 as Add>
<i32 as Add<&i32>>
<&'a i32 as Add<i32>>
<&i32 as Add<&i32>>
<i32 as Add<&i32>>
<i32 as Add>
error[E0277]: cannot add `u32` to `i32`
--> $DIR/ufcs-qpath-self-mismatch.rs:4:5
@ -19,10 +19,10 @@ LL | <i32 as Add<u32>>::add(1, 2);
|
= help: the trait `Add<u32>` is not implemented for `i32`
= help: the following other types implement trait `Add<Rhs>`:
<i32 as Add>
<i32 as Add<&i32>>
<&'a i32 as Add<i32>>
<&i32 as Add<&i32>>
<i32 as Add<&i32>>
<i32 as Add>
error[E0308]: mismatched types
--> $DIR/ufcs-qpath-self-mismatch.rs:7:28