mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
Auto merge of #116923 - fmease:rollup-ev7q387, r=fmease
Rollup of 7 pull requests Successful merges: - #116663 (Don't ICE when encountering unresolved regions in `fully_resolve`) - #116761 (Fix podman detection in CI scripts) - #116795 (Add `#[track_caller]` to `Option::unwrap_or_else`) - #116829 (Make `#[repr(Rust)]` incompatible with other (non-modifier) representation hints like `C` and `simd`) - #116883 (Change my name in mailmap) - #116908 (Tweak wording of type errors involving type params) - #116912 (Some renaming nits for `rustc_type_ir`) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
36b61e5aa5
1
.mailmap
1
.mailmap
@ -74,6 +74,7 @@ Benoît Cortier <benoit.cortier@fried-world.eu>
|
||||
Bheesham Persaud <bheesham123@hotmail.com> Bheesham Persaud <bheesham.persaud@live.ca>
|
||||
Björn Steinbrink <bsteinbr@gmail.com> <B.Steinbrink@gmx.de>
|
||||
blake2-ppc <ulrik.sverdrup@gmail.com> <blake2-ppc>
|
||||
blyxyas <blyxyas@gmail.com> Alejandra González <blyxyas@gmail.com>
|
||||
boolean_coercion <booleancoercion@gmail.com>
|
||||
Boris Egorov <jightuse@gmail.com> <egorov@linux.com>
|
||||
bors <bors@rust-lang.org> bors[bot] <26634292+bors[bot]@users.noreply.github.com>
|
||||
|
@ -85,8 +85,13 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
{
|
||||
let p_def_id = tcx.generics_of(body_owner_def_id).type_param(p, tcx).def_id;
|
||||
let p_span = tcx.def_span(p_def_id);
|
||||
let expected = match (values.expected.kind(), values.found.kind()) {
|
||||
(ty::Param(_), _) => "expected ",
|
||||
(_, ty::Param(_)) => "found ",
|
||||
_ => "",
|
||||
};
|
||||
if !sp.contains(p_span) {
|
||||
diag.span_label(p_span, "this type parameter");
|
||||
diag.span_label(p_span, format!("{expected}this type parameter"));
|
||||
}
|
||||
let hir = tcx.hir();
|
||||
let mut note = true;
|
||||
@ -168,8 +173,13 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
| (ty::Dynamic(..) | ty::Alias(ty::Opaque, ..), ty::Param(p)) => {
|
||||
let generics = tcx.generics_of(body_owner_def_id);
|
||||
let p_span = tcx.def_span(generics.type_param(p, tcx).def_id);
|
||||
let expected = match (values.expected.kind(), values.found.kind()) {
|
||||
(ty::Param(_), _) => "expected ",
|
||||
(_, ty::Param(_)) => "found ",
|
||||
_ => "",
|
||||
};
|
||||
if !sp.contains(p_span) {
|
||||
diag.span_label(p_span, "this type parameter");
|
||||
diag.span_label(p_span, format!("{expected}this type parameter"));
|
||||
}
|
||||
diag.help("type parameters must be constrained to match other types");
|
||||
if tcx.sess.teach(&diag.get_code().unwrap()) {
|
||||
@ -209,7 +219,7 @@ impl<T> Trait<T> for X {
|
||||
let generics = tcx.generics_of(body_owner_def_id);
|
||||
let p_span = tcx.def_span(generics.type_param(p, tcx).def_id);
|
||||
if !sp.contains(p_span) {
|
||||
diag.span_label(p_span, "this type parameter");
|
||||
diag.span_label(p_span, "expected this type parameter");
|
||||
}
|
||||
diag.help(format!(
|
||||
"every closure has a distinct type and so could not always match the \
|
||||
@ -219,8 +229,13 @@ impl<T> Trait<T> for X {
|
||||
(ty::Param(p), _) | (_, ty::Param(p)) => {
|
||||
let generics = tcx.generics_of(body_owner_def_id);
|
||||
let p_span = tcx.def_span(generics.type_param(p, tcx).def_id);
|
||||
let expected = match (values.expected.kind(), values.found.kind()) {
|
||||
(ty::Param(_), _) => "expected ",
|
||||
(_, ty::Param(_)) => "found ",
|
||||
_ => "",
|
||||
};
|
||||
if !sp.contains(p_span) {
|
||||
diag.span_label(p_span, "this type parameter");
|
||||
diag.span_label(p_span, format!("{expected}this type parameter"));
|
||||
}
|
||||
}
|
||||
(ty::Alias(ty::Projection | ty::Inherent, proj_ty), _)
|
||||
|
@ -36,7 +36,7 @@ use rustc_middle::ty::{self, GenericParamDefKind, InferConst, InferTy, Ty, TyCtx
|
||||
use rustc_middle::ty::{ConstVid, EffectVid, FloatVid, IntVid, TyVid};
|
||||
use rustc_middle::ty::{GenericArg, GenericArgKind, GenericArgs, GenericArgsRef};
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::fmt;
|
||||
@ -1422,12 +1422,25 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||
/// This method is idempotent, but it not typically not invoked
|
||||
/// except during the writeback phase.
|
||||
pub fn fully_resolve<T: TypeFoldable<TyCtxt<'tcx>>>(&self, value: T) -> FixupResult<'tcx, T> {
|
||||
let value = resolve::fully_resolve(self, value);
|
||||
assert!(
|
||||
value.as_ref().map_or(true, |value| !value.has_infer()),
|
||||
"`{value:?}` is not fully resolved"
|
||||
);
|
||||
value
|
||||
match resolve::fully_resolve(self, value) {
|
||||
Ok(value) => {
|
||||
if value.has_non_region_infer() {
|
||||
bug!("`{value:?}` is not fully resolved");
|
||||
}
|
||||
if value.has_infer_regions() {
|
||||
let guar = self
|
||||
.tcx
|
||||
.sess
|
||||
.delay_span_bug(DUMMY_SP, format!("`{value:?}` is not fully resolved"));
|
||||
Ok(self.tcx.fold_regions(value, |re, _| {
|
||||
if re.is_var() { ty::Region::new_error(self.tcx, guar) } else { re }
|
||||
}))
|
||||
} else {
|
||||
Ok(value)
|
||||
}
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
|
||||
// Instantiates the bound variables in a given binder with fresh inference
|
||||
|
@ -58,7 +58,6 @@ declare_lint! {
|
||||
///
|
||||
///
|
||||
/// ```rust
|
||||
/// # #![feature(return_position_impl_trait_in_trait)]
|
||||
/// use core::future::Future;
|
||||
/// pub trait Trait {
|
||||
/// fn method(&self) -> impl Future<Output = ()> + Send { async {} }
|
||||
|
@ -80,43 +80,40 @@ use std::ops::{Bound, Deref};
|
||||
|
||||
#[allow(rustc::usage_of_ty_tykind)]
|
||||
impl<'tcx> Interner for TyCtxt<'tcx> {
|
||||
type AdtDef = ty::AdtDef<'tcx>;
|
||||
type GenericArgsRef = ty::GenericArgsRef<'tcx>;
|
||||
type GenericArg = ty::GenericArg<'tcx>;
|
||||
type DefId = DefId;
|
||||
type AdtDef = ty::AdtDef<'tcx>;
|
||||
type GenericArgs = ty::GenericArgsRef<'tcx>;
|
||||
type GenericArg = ty::GenericArg<'tcx>;
|
||||
type Binder<T> = Binder<'tcx, T>;
|
||||
type Ty = Ty<'tcx>;
|
||||
type Const = ty::Const<'tcx>;
|
||||
type Region = Region<'tcx>;
|
||||
type Predicate = Predicate<'tcx>;
|
||||
type PredicateKind = ty::PredicateKind<'tcx>;
|
||||
type TypeAndMut = TypeAndMut<'tcx>;
|
||||
type Mutability = hir::Mutability;
|
||||
type Movability = hir::Movability;
|
||||
type PolyFnSig = PolyFnSig<'tcx>;
|
||||
type ListBinderExistentialPredicate = &'tcx List<PolyExistentialPredicate<'tcx>>;
|
||||
type BinderListTy = Binder<'tcx, &'tcx List<Ty<'tcx>>>;
|
||||
type ListTy = &'tcx List<Ty<'tcx>>;
|
||||
type Ty = Ty<'tcx>;
|
||||
type Tys = &'tcx List<Ty<'tcx>>;
|
||||
type AliasTy = ty::AliasTy<'tcx>;
|
||||
type ParamTy = ParamTy;
|
||||
type BoundTy = ty::BoundTy;
|
||||
type PlaceholderType = ty::PlaceholderType;
|
||||
type PlaceholderTy = ty::PlaceholderType;
|
||||
type InferTy = InferTy;
|
||||
type ErrorGuaranteed = ErrorGuaranteed;
|
||||
type PredicateKind = ty::PredicateKind<'tcx>;
|
||||
type BoundExistentialPredicates = &'tcx List<PolyExistentialPredicate<'tcx>>;
|
||||
type PolyFnSig = PolyFnSig<'tcx>;
|
||||
type AllocId = crate::mir::interpret::AllocId;
|
||||
|
||||
type Const = ty::Const<'tcx>;
|
||||
type InferConst = ty::InferConst<'tcx>;
|
||||
type AliasConst = ty::UnevaluatedConst<'tcx>;
|
||||
type PlaceholderConst = ty::PlaceholderConst<'tcx>;
|
||||
type ParamConst = ty::ParamConst;
|
||||
type BoundConst = ty::BoundVar;
|
||||
type PlaceholderConst = ty::PlaceholderConst<'tcx>;
|
||||
type ValueConst = ty::ValTree<'tcx>;
|
||||
type ExprConst = ty::Expr<'tcx>;
|
||||
|
||||
type Region = Region<'tcx>;
|
||||
type EarlyBoundRegion = ty::EarlyBoundRegion;
|
||||
type BoundRegion = ty::BoundRegion;
|
||||
type FreeRegion = ty::FreeRegion;
|
||||
type RegionVid = ty::RegionVid;
|
||||
type InferRegion = ty::RegionVid;
|
||||
type PlaceholderRegion = ty::PlaceholderRegion;
|
||||
|
||||
fn ty_and_mut_to_parts(
|
||||
|
@ -1776,6 +1776,7 @@ impl CheckAttrVisitor<'_> {
|
||||
.collect();
|
||||
|
||||
let mut int_reprs = 0;
|
||||
let mut is_explicit_rust = false;
|
||||
let mut is_c = false;
|
||||
let mut is_simd = false;
|
||||
let mut is_transparent = false;
|
||||
@ -1787,7 +1788,9 @@ impl CheckAttrVisitor<'_> {
|
||||
}
|
||||
|
||||
match hint.name_or_empty() {
|
||||
sym::Rust => {}
|
||||
sym::Rust => {
|
||||
is_explicit_rust = true;
|
||||
}
|
||||
sym::C => {
|
||||
is_c = true;
|
||||
match target {
|
||||
@ -1897,12 +1900,16 @@ impl CheckAttrVisitor<'_> {
|
||||
|
||||
// Error on repr(transparent, <anything else>).
|
||||
if is_transparent && hints.len() > 1 {
|
||||
let hint_spans: Vec<_> = hint_spans.clone().collect();
|
||||
let hint_spans = hint_spans.clone().collect();
|
||||
self.tcx.sess.emit_err(errors::TransparentIncompatible {
|
||||
hint_spans,
|
||||
target: target.to_string(),
|
||||
});
|
||||
}
|
||||
if is_explicit_rust && (int_reprs > 0 || is_c || is_simd) {
|
||||
let hint_spans = hint_spans.clone().collect();
|
||||
self.tcx.sess.emit_err(errors::ReprConflicting { hint_spans });
|
||||
}
|
||||
// Warn on repr(u8, u16), repr(C, simd), and c-like-enum-repr(C, u8)
|
||||
if (int_reprs > 1)
|
||||
|| (is_simd && is_c)
|
||||
@ -1919,7 +1926,7 @@ impl CheckAttrVisitor<'_> {
|
||||
CONFLICTING_REPR_HINTS,
|
||||
hir_id,
|
||||
hint_spans.collect::<Vec<Span>>(),
|
||||
errors::ReprConflicting,
|
||||
errors::ReprConflictingLint,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -558,9 +558,16 @@ pub struct ReprIdent {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_repr_conflicting, code = "E0566")]
|
||||
pub struct ReprConflicting {
|
||||
#[primary_span]
|
||||
pub hint_spans: Vec<Span>,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(passes_repr_conflicting, code = "E0566")]
|
||||
pub struct ReprConflicting;
|
||||
pub struct ReprConflictingLint;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_used_static)]
|
||||
|
@ -42,35 +42,43 @@ pub use ty_info::*;
|
||||
pub trait HashStableContext {}
|
||||
|
||||
pub trait Interner: Sized {
|
||||
type DefId: Clone + Debug + Hash + Ord;
|
||||
type AdtDef: Clone + Debug + Hash + Ord;
|
||||
type GenericArgsRef: Clone
|
||||
|
||||
type GenericArgs: Clone
|
||||
+ DebugWithInfcx<Self>
|
||||
+ Hash
|
||||
+ Ord
|
||||
+ IntoIterator<Item = Self::GenericArg>;
|
||||
type GenericArg: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
type DefId: Clone + Debug + Hash + Ord;
|
||||
|
||||
type Binder<T>;
|
||||
type Ty: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
type Const: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
type Region: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
|
||||
// Predicates
|
||||
type Predicate;
|
||||
type PredicateKind: Clone + Debug + Hash + PartialEq + Eq;
|
||||
|
||||
type TypeAndMut: Clone + Debug + Hash + Ord;
|
||||
type Mutability: Clone + Debug + Hash + Ord;
|
||||
type Movability: Clone + Debug + Hash + Ord;
|
||||
type PolyFnSig: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
type ListBinderExistentialPredicate: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
type BinderListTy: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
type ListTy: Clone + Debug + Hash + Ord + IntoIterator<Item = Self::Ty>;
|
||||
|
||||
// Kinds of tys
|
||||
type Ty: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
type Tys: Clone + Debug + Hash + Ord + IntoIterator<Item = Self::Ty>;
|
||||
type AliasTy: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
type ParamTy: Clone + Debug + Hash + Ord;
|
||||
type BoundTy: Clone + Debug + Hash + Ord;
|
||||
type PlaceholderType: Clone + Debug + Hash + Ord;
|
||||
type PlaceholderTy: Clone + Debug + Hash + Ord;
|
||||
type InferTy: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
|
||||
// Things stored inside of tys
|
||||
type ErrorGuaranteed: Clone + Debug + Hash + Ord;
|
||||
type PredicateKind: Clone + Debug + Hash + PartialEq + Eq;
|
||||
type BoundExistentialPredicates: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
type PolyFnSig: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
type AllocId: Clone + Debug + Hash + Ord;
|
||||
|
||||
// Kinds of consts
|
||||
type Const: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
type InferConst: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
type AliasConst: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
type PlaceholderConst: Clone + Debug + Hash + Ord;
|
||||
@ -79,10 +87,12 @@ pub trait Interner: Sized {
|
||||
type ValueConst: Clone + Debug + Hash + Ord;
|
||||
type ExprConst: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
|
||||
// Kinds of regions
|
||||
type Region: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
type EarlyBoundRegion: Clone + Debug + Hash + Ord;
|
||||
type BoundRegion: Clone + Debug + Hash + Ord;
|
||||
type FreeRegion: Clone + Debug + Hash + Ord;
|
||||
type RegionVid: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
type InferRegion: Clone + DebugWithInfcx<Self> + Hash + Ord;
|
||||
type PlaceholderRegion: Clone + Debug + Hash + Ord;
|
||||
|
||||
fn ty_and_mut_to_parts(ty_and_mut: Self::TypeAndMut) -> (Self::Ty, Self::Mutability);
|
||||
|
@ -208,7 +208,7 @@ impl<I: Interner, T: TypeVisitable<I>, Ix: Idx> TypeVisitable<I> for IndexVec<Ix
|
||||
|
||||
pub trait InferCtxtLike<I: Interner> {
|
||||
fn universe_of_ty(&self, ty: I::InferTy) -> Option<UniverseIndex>;
|
||||
fn universe_of_lt(&self, lt: I::RegionVid) -> Option<UniverseIndex>;
|
||||
fn universe_of_lt(&self, lt: I::InferRegion) -> Option<UniverseIndex>;
|
||||
fn universe_of_ct(&self, ct: I::InferConst) -> Option<UniverseIndex>;
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ impl<I: Interner> InferCtxtLike<I> for core::convert::Infallible {
|
||||
fn universe_of_ct(&self, _ct: <I as Interner>::InferConst) -> Option<UniverseIndex> {
|
||||
match *self {}
|
||||
}
|
||||
fn universe_of_lt(&self, _lt: <I as Interner>::RegionVid) -> Option<UniverseIndex> {
|
||||
fn universe_of_lt(&self, _lt: <I as Interner>::InferRegion) -> Option<UniverseIndex> {
|
||||
match *self {}
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ pub enum TyKind<I: Interner> {
|
||||
///
|
||||
/// Note that generic parameters in fields only get lazily substituted
|
||||
/// by using something like `adt_def.all_fields().map(|field| field.ty(tcx, args))`.
|
||||
Adt(I::AdtDef, I::GenericArgsRef),
|
||||
Adt(I::AdtDef, I::GenericArgs),
|
||||
|
||||
/// An unsized FFI type that is opaque to Rust. Written as `extern type T`.
|
||||
Foreign(I::DefId),
|
||||
@ -111,7 +111,7 @@ pub enum TyKind<I: Interner> {
|
||||
/// fn foo() -> i32 { 1 }
|
||||
/// let bar = foo; // bar: fn() -> i32 {foo}
|
||||
/// ```
|
||||
FnDef(I::DefId, I::GenericArgsRef),
|
||||
FnDef(I::DefId, I::GenericArgs),
|
||||
|
||||
/// A pointer to a function. Written as `fn() -> i32`.
|
||||
///
|
||||
@ -127,21 +127,21 @@ pub enum TyKind<I: Interner> {
|
||||
FnPtr(I::PolyFnSig),
|
||||
|
||||
/// A trait object. Written as `dyn for<'b> Trait<'b, Assoc = u32> + Send + 'a`.
|
||||
Dynamic(I::ListBinderExistentialPredicate, I::Region, DynKind),
|
||||
Dynamic(I::BoundExistentialPredicates, I::Region, DynKind),
|
||||
|
||||
/// The anonymous type of a closure. Used to represent the type of `|a| a`.
|
||||
///
|
||||
/// Closure args contain both the - potentially substituted - generic parameters
|
||||
/// of its parent and some synthetic parameters. See the documentation for
|
||||
/// `ClosureArgs` for more details.
|
||||
Closure(I::DefId, I::GenericArgsRef),
|
||||
Closure(I::DefId, I::GenericArgs),
|
||||
|
||||
/// The anonymous type of a generator. Used to represent the type of
|
||||
/// `|a| yield a`.
|
||||
///
|
||||
/// For more info about generator args, visit the documentation for
|
||||
/// `GeneratorArgs`.
|
||||
Generator(I::DefId, I::GenericArgsRef, I::Movability),
|
||||
Generator(I::DefId, I::GenericArgs, I::Movability),
|
||||
|
||||
/// A type representing the types stored inside a generator.
|
||||
/// This should only appear as part of the `GeneratorArgs`.
|
||||
@ -167,13 +167,13 @@ pub enum TyKind<I: Interner> {
|
||||
/// }
|
||||
/// # ;
|
||||
/// ```
|
||||
GeneratorWitness(I::DefId, I::GenericArgsRef),
|
||||
GeneratorWitness(I::DefId, I::GenericArgs),
|
||||
|
||||
/// The never type `!`.
|
||||
Never,
|
||||
|
||||
/// A tuple type. For example, `(i32, bool)`.
|
||||
Tuple(I::ListTy),
|
||||
Tuple(I::Tys),
|
||||
|
||||
/// A projection, opaque type, weak type alias, or inherent associated type.
|
||||
/// All of these types are represented as pairs of def-id and args, and can
|
||||
@ -209,7 +209,7 @@ pub enum TyKind<I: Interner> {
|
||||
/// to the bound variable's index from the binder from which it was instantiated),
|
||||
/// and `U` is the universe index in which it is instantiated, or totally omitted
|
||||
/// if the universe index is zero.
|
||||
Placeholder(I::PlaceholderType),
|
||||
Placeholder(I::PlaceholderTy),
|
||||
|
||||
/// A type variable used during type checking.
|
||||
///
|
||||
@ -567,7 +567,7 @@ impl<I: Interner, E: TyEncoder> Encodable<E> for TyKind<I>
|
||||
where
|
||||
I::ErrorGuaranteed: Encodable<E>,
|
||||
I::AdtDef: Encodable<E>,
|
||||
I::GenericArgsRef: Encodable<E>,
|
||||
I::GenericArgs: Encodable<E>,
|
||||
I::DefId: Encodable<E>,
|
||||
I::Ty: Encodable<E>,
|
||||
I::Const: Encodable<E>,
|
||||
@ -576,13 +576,12 @@ where
|
||||
I::Mutability: Encodable<E>,
|
||||
I::Movability: Encodable<E>,
|
||||
I::PolyFnSig: Encodable<E>,
|
||||
I::ListBinderExistentialPredicate: Encodable<E>,
|
||||
I::BinderListTy: Encodable<E>,
|
||||
I::ListTy: Encodable<E>,
|
||||
I::BoundExistentialPredicates: Encodable<E>,
|
||||
I::Tys: Encodable<E>,
|
||||
I::AliasTy: Encodable<E>,
|
||||
I::ParamTy: Encodable<E>,
|
||||
I::BoundTy: Encodable<E>,
|
||||
I::PlaceholderType: Encodable<E>,
|
||||
I::PlaceholderTy: Encodable<E>,
|
||||
I::InferTy: Encodable<E>,
|
||||
I::PredicateKind: Encodable<E>,
|
||||
I::AllocId: Encodable<E>,
|
||||
@ -682,7 +681,7 @@ impl<I: Interner, D: TyDecoder<I = I>> Decodable<D> for TyKind<I>
|
||||
where
|
||||
I::ErrorGuaranteed: Decodable<D>,
|
||||
I::AdtDef: Decodable<D>,
|
||||
I::GenericArgsRef: Decodable<D>,
|
||||
I::GenericArgs: Decodable<D>,
|
||||
I::DefId: Decodable<D>,
|
||||
I::Ty: Decodable<D>,
|
||||
I::Const: Decodable<D>,
|
||||
@ -691,14 +690,13 @@ where
|
||||
I::Mutability: Decodable<D>,
|
||||
I::Movability: Decodable<D>,
|
||||
I::PolyFnSig: Decodable<D>,
|
||||
I::ListBinderExistentialPredicate: Decodable<D>,
|
||||
I::BinderListTy: Decodable<D>,
|
||||
I::ListTy: Decodable<D>,
|
||||
I::BoundExistentialPredicates: Decodable<D>,
|
||||
I::Tys: Decodable<D>,
|
||||
I::AliasTy: Decodable<D>,
|
||||
I::ParamTy: Decodable<D>,
|
||||
I::AliasTy: Decodable<D>,
|
||||
I::BoundTy: Decodable<D>,
|
||||
I::PlaceholderType: Decodable<D>,
|
||||
I::PlaceholderTy: Decodable<D>,
|
||||
I::InferTy: Decodable<D>,
|
||||
I::PredicateKind: Decodable<D>,
|
||||
I::AllocId: Decodable<D>,
|
||||
@ -748,21 +746,20 @@ impl<CTX: HashStableContext, I: Interner> HashStable<CTX> for TyKind<I>
|
||||
where
|
||||
I::AdtDef: HashStable<CTX>,
|
||||
I::DefId: HashStable<CTX>,
|
||||
I::GenericArgsRef: HashStable<CTX>,
|
||||
I::GenericArgs: HashStable<CTX>,
|
||||
I::Ty: HashStable<CTX>,
|
||||
I::Const: HashStable<CTX>,
|
||||
I::TypeAndMut: HashStable<CTX>,
|
||||
I::PolyFnSig: HashStable<CTX>,
|
||||
I::ListBinderExistentialPredicate: HashStable<CTX>,
|
||||
I::BoundExistentialPredicates: HashStable<CTX>,
|
||||
I::Region: HashStable<CTX>,
|
||||
I::Movability: HashStable<CTX>,
|
||||
I::Mutability: HashStable<CTX>,
|
||||
I::BinderListTy: HashStable<CTX>,
|
||||
I::ListTy: HashStable<CTX>,
|
||||
I::Tys: HashStable<CTX>,
|
||||
I::AliasTy: HashStable<CTX>,
|
||||
I::BoundTy: HashStable<CTX>,
|
||||
I::ParamTy: HashStable<CTX>,
|
||||
I::PlaceholderType: HashStable<CTX>,
|
||||
I::PlaceholderTy: HashStable<CTX>,
|
||||
I::InferTy: HashStable<CTX>,
|
||||
I::ErrorGuaranteed: HashStable<CTX>,
|
||||
{
|
||||
@ -1204,7 +1201,7 @@ pub enum RegionKind<I: Interner> {
|
||||
ReStatic,
|
||||
|
||||
/// A region variable. Should not exist outside of type inference.
|
||||
ReVar(I::RegionVid),
|
||||
ReVar(I::InferRegion),
|
||||
|
||||
/// A placeholder region -- basically, the higher-ranked version of `ReFree`.
|
||||
/// Should not exist outside of type inference.
|
||||
@ -1239,7 +1236,7 @@ where
|
||||
I::EarlyBoundRegion: Copy,
|
||||
I::BoundRegion: Copy,
|
||||
I::FreeRegion: Copy,
|
||||
I::RegionVid: Copy,
|
||||
I::InferRegion: Copy,
|
||||
I::PlaceholderRegion: Copy,
|
||||
I::ErrorGuaranteed: Copy,
|
||||
{
|
||||
@ -1379,7 +1376,7 @@ where
|
||||
I::EarlyBoundRegion: Encodable<E>,
|
||||
I::BoundRegion: Encodable<E>,
|
||||
I::FreeRegion: Encodable<E>,
|
||||
I::RegionVid: Encodable<E>,
|
||||
I::InferRegion: Encodable<E>,
|
||||
I::PlaceholderRegion: Encodable<E>,
|
||||
{
|
||||
fn encode(&self, e: &mut E) {
|
||||
@ -1414,7 +1411,7 @@ where
|
||||
I::EarlyBoundRegion: Decodable<D>,
|
||||
I::BoundRegion: Decodable<D>,
|
||||
I::FreeRegion: Decodable<D>,
|
||||
I::RegionVid: Decodable<D>,
|
||||
I::InferRegion: Decodable<D>,
|
||||
I::PlaceholderRegion: Decodable<D>,
|
||||
I::ErrorGuaranteed: Decodable<D>,
|
||||
{
|
||||
@ -1445,7 +1442,7 @@ where
|
||||
I::EarlyBoundRegion: HashStable<CTX>,
|
||||
I::BoundRegion: HashStable<CTX>,
|
||||
I::FreeRegion: HashStable<CTX>,
|
||||
I::RegionVid: HashStable<CTX>,
|
||||
I::InferRegion: HashStable<CTX>,
|
||||
I::PlaceholderRegion: HashStable<CTX>,
|
||||
{
|
||||
#[inline]
|
||||
|
@ -959,6 +959,7 @@ impl<T> Option<T> {
|
||||
/// assert_eq!(None.unwrap_or_else(|| 2 * k), 20);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn unwrap_or_else<F>(self, f: F) -> T
|
||||
where
|
||||
|
@ -235,7 +235,7 @@ else
|
||||
args="$args --volume /tmp/toolstate:/tmp/toolstate"
|
||||
|
||||
id=$(id -u)
|
||||
if [[ "$id" != 0 && "$(docker -v)" =~ ^podman ]]; then
|
||||
if [[ "$id" != 0 && "$(docker version)" =~ Podman ]]; then
|
||||
# Rootless podman creates a separate user namespace, where an inner
|
||||
# LOCAL_USER_ID will map to a different subuid range on the host.
|
||||
# The "keep-id" mode maps the current UID directly into the container.
|
||||
|
@ -13,7 +13,7 @@ error[E0308]: mismatched types
|
||||
LL | fn foo<u32>(a: u32) -> u32 {
|
||||
| --- --- expected `u32` because of return type
|
||||
| |
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
LL | 42
|
||||
| ^^ expected type parameter `u32`, found integer
|
||||
|
|
||||
|
@ -17,7 +17,7 @@ LL | fn f(x: &mut dyn Iterator<Item: Iterator<Item = &'_ ()>>) -> Option<&'_ ()>
|
||||
| ----------------------------- -------------- ^^^^^^^^ expected `Option<&()>`, found `Option<impl Iterator<Item = &'_ ()>>`
|
||||
| | |
|
||||
| | expected `Option<&()>` because of return type
|
||||
| this type parameter
|
||||
| found this type parameter
|
||||
|
|
||||
= note: expected enum `Option<&()>`
|
||||
found enum `Option<impl Iterator<Item = &'_ ()>>`
|
||||
|
@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `<Adapter<I> as Iterator>::Item == Option<
|
||||
--> $DIR/associated-types-issue-20346.rs:34:36
|
||||
|
|
||||
LL | fn test_adapter<T, I: Iterator<Item=Option<T>>>(it: I) {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
...
|
||||
LL | is_iterator_of::<Option<T>, _>(&adapter);
|
||||
| ------------------------------ ^^^^^^^^ type mismatch resolving `<Adapter<I> as Iterator>::Item == Option<T>`
|
||||
|
@ -2,7 +2,9 @@ error[E0271]: type mismatch resolving `<T as Deref>::Target == T`
|
||||
--> $DIR/hr-associated-type-projection-1.rs:13:33
|
||||
|
|
||||
LL | impl<T: Copy + std::ops::Deref> UnsafeCopy<'_, T> for T {
|
||||
| - this type parameter ^^^^^^^^^^^^^^^^^ expected type parameter `T`, found associated type
|
||||
| - ^^^^^^^^^^^^^^^^^ expected type parameter `T`, found associated type
|
||||
| |
|
||||
| expected this type parameter
|
||||
|
|
||||
= note: expected type parameter `T`
|
||||
found associated type `<T as Deref>::Target`
|
||||
|
19
tests/ui/async-await/in-trait/unconstrained-impl-region.rs
Normal file
19
tests/ui/async-await/in-trait/unconstrained-impl-region.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// edition: 2021
|
||||
|
||||
pub(crate) trait Inbox<M> {
|
||||
async fn next(self) -> M;
|
||||
}
|
||||
|
||||
pub(crate) trait Actor: Sized {
|
||||
type Message;
|
||||
|
||||
async fn on_mount(self, _: impl Inbox<Self::Message>);
|
||||
}
|
||||
|
||||
impl<'a> Actor for () {
|
||||
//~^ ERROR the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
|
||||
type Message = &'a ();
|
||||
async fn on_mount(self, _: impl Inbox<&'a ()>) {}
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,9 @@
|
||||
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
|
||||
--> $DIR/unconstrained-impl-region.rs:13:6
|
||||
|
|
||||
LL | impl<'a> Actor for () {
|
||||
| ^^ unconstrained lifetime parameter
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0207`.
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-67945-1.rs:10:20
|
||||
|
|
||||
LL | struct Bug<S> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | let x: S = MaybeUninit::uninit();
|
||||
| - ^^^^^^^^^^^^^^^^^^^^^ expected type parameter `S`, found `MaybeUninit<_>`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-68648-2.rs:12:17
|
||||
|
|
||||
LL | fn bug<'a, T: Fun<F<'a> = T>>(t: T) -> T::F<'a> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
LL | T::identity(())
|
||||
| ----------- ^^ expected type parameter `T`, found `()`
|
||||
| |
|
||||
|
@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `<T as Deref>::Target == T`
|
||||
--> $DIR/issue-68656-unsized-values.rs:13:21
|
||||
|
|
||||
LL | impl<T: Copy + std::ops::Deref> UnsafeCopy<T> for T {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
LL | type Item<'a> = T;
|
||||
| ^ expected type parameter `T`, found associated type
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-88360.rs:15:9
|
||||
|
|
||||
LL | trait SuperTrait<T>
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
...
|
||||
LL | fn copy(&self) -> Self::Gat<'_> where T: Copy {
|
||||
| ------------- expected `&T` because of return type
|
||||
|
@ -14,7 +14,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/missing-bounds.rs:11:11
|
||||
|
|
||||
LL | impl<B> Add for A<B> where B: Add {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | A(self.0 + rhs.0)
|
||||
| - ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
|
||||
@ -44,7 +44,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/missing-bounds.rs:21:14
|
||||
|
|
||||
LL | impl<B: Add> Add for C<B> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | Self(self.0 + rhs.0)
|
||||
| ---- ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
|
||||
@ -80,7 +80,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/missing-bounds.rs:42:14
|
||||
|
|
||||
LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | Self(self.0 + rhs.0)
|
||||
| ---- ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
|
||||
|
@ -7,7 +7,7 @@ LL | | &mut Header,
|
||||
LL | | &mut [EntryMetadata],
|
||||
LL | | &mut [Entry<C::EncodedKey, C::EncodedValue>]
|
||||
LL | | ) -> R,
|
||||
| |__________- this type parameter
|
||||
| |__________- expected this type parameter
|
||||
LL | ) {
|
||||
LL | let () = y;
|
||||
| ^^ - this expression has type `impl FnOnce(&mut Header, &mut [EntryMetadata], &mut [Entry<C::EncodedKey, C::EncodedValue>]) -> R`
|
||||
|
@ -6,7 +6,7 @@ LL | fn early<'late, T>(_: &'late ()) {}
|
||||
| | |
|
||||
| | expected type parameter `T`, found `()`
|
||||
| | help: change the parameter type to match the trait: `&T`
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
|
|
||||
note: type in trait
|
||||
--> $DIR/method-signature-matches.rs:52:28
|
||||
|
@ -2,7 +2,7 @@ error[E0053]: method `bar` has an incompatible type for trait
|
||||
--> $DIR/specialization-broken.rs:15:22
|
||||
|
|
||||
LL | default impl<U> Foo for U
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
...
|
||||
LL | fn bar(&self) -> U {
|
||||
| ^
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | fn foo(x: impl Debug) -> String {
|
||||
| ---------- ------ expected `String` because of return type
|
||||
| |
|
||||
| this type parameter
|
||||
| found this type parameter
|
||||
LL | x
|
||||
| ^ expected `String`, found type parameter `impl Debug`
|
||||
|
|
||||
|
@ -70,7 +70,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-107090.rs:22:5
|
||||
|
|
||||
LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T {
|
||||
| - this type parameter ------- expected `&'out T` because of return type
|
||||
| - expected this type parameter ------- expected `&'out T` because of return type
|
||||
LL |
|
||||
LL | sadness.cast()
|
||||
| ^^^^^^^^^^^^^^ expected `&T`, found `&Foo<'_, '_, T>`
|
||||
|
@ -2,7 +2,7 @@ error[E0053]: method `call` has an incompatible type for trait
|
||||
--> $DIR/issue-20225.rs:6:43
|
||||
|
|
||||
LL | impl<'a, T> Fn<(&'a T,)> for Foo {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
LL | extern "rust-call" fn call(&self, (_,): (T,)) {}
|
||||
| ^^^^
|
||||
| |
|
||||
@ -16,7 +16,7 @@ error[E0053]: method `call_mut` has an incompatible type for trait
|
||||
--> $DIR/issue-20225.rs:11:51
|
||||
|
|
||||
LL | impl<'a, T> FnMut<(&'a T,)> for Foo {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
|
||||
| ^^^^
|
||||
| |
|
||||
@ -30,7 +30,7 @@ error[E0053]: method `call_once` has an incompatible type for trait
|
||||
--> $DIR/issue-20225.rs:18:47
|
||||
|
|
||||
LL | impl<'a, T> FnOnce<(&'a T,)> for Foo {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
...
|
||||
LL | extern "rust-call" fn call_once(self, (_,): (T,)) {}
|
||||
| ^^^^
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-51154.rs:2:30
|
||||
|
|
||||
LL | fn foo<F: FnMut()>() {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
LL | let _: Box<F> = Box::new(|| ());
|
||||
| -------- ^^^^^ expected type parameter `F`, found closure
|
||||
| |
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-69306.rs:5:28
|
||||
|
|
||||
LL | impl<T> S0<T> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
LL | const C: S0<u8> = Self(0);
|
||||
| ---- ^ expected type parameter `T`, found integer
|
||||
| |
|
||||
@ -20,7 +20,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-69306.rs:5:23
|
||||
|
|
||||
LL | impl<T> S0<T> {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
LL | const C: S0<u8> = Self(0);
|
||||
| ^^^^^^^ expected `S0<u8>`, found `S0<T>`
|
||||
|
|
||||
@ -31,7 +31,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-69306.rs:10:14
|
||||
|
|
||||
LL | impl<T> S0<T> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | Self(0);
|
||||
| ---- ^ expected type parameter `T`, found integer
|
||||
@ -50,7 +50,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-69306.rs:27:14
|
||||
|
|
||||
LL | impl<T> Foo<T> for <S0<T> as Fun>::Out {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
LL | fn foo() {
|
||||
LL | Self(0);
|
||||
| ---- ^ expected type parameter `T`, found integer
|
||||
@ -69,7 +69,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-69306.rs:33:32
|
||||
|
|
||||
LL | impl<T> S1<T, u8> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
LL | const C: S1<u8, u8> = Self(0, 1);
|
||||
| ---- ^ expected type parameter `T`, found integer
|
||||
| |
|
||||
@ -87,7 +87,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-69306.rs:33:27
|
||||
|
|
||||
LL | impl<T> S1<T, u8> {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
LL | const C: S1<u8, u8> = Self(0, 1);
|
||||
| ^^^^^^^^^^ expected `S1<u8, u8>`, found `S1<T, u8>`
|
||||
|
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: lang item `start` function has wrong type
|
||||
LL | fn start<T>(_main: fn() -> u16, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
|
||||
| - ^^^^^^^^^^^ expected type parameter `T`, found `u16`
|
||||
| |
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
|
|
||||
= note: expected signature `fn(fn() -> T, _, _, _) -> _`
|
||||
found signature `fn(fn() -> u16, _, _, _) -> _`
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-35030.rs:9:14
|
||||
|
|
||||
LL | impl<bool> Parser<bool> for bool {
|
||||
| ---- this type parameter
|
||||
| ---- expected this type parameter
|
||||
LL | fn parse(text: &str) -> Option<bool> {
|
||||
LL | Some(true)
|
||||
| ---- ^^^^ expected type parameter `bool`, found `bool`
|
||||
|
23
tests/ui/repr/explicit-rust-repr-conflicts.rs
Normal file
23
tests/ui/repr/explicit-rust-repr-conflicts.rs
Normal file
@ -0,0 +1,23 @@
|
||||
#[repr(C, Rust)] //~ ERROR conflicting representation hints
|
||||
struct S {
|
||||
a: i32,
|
||||
}
|
||||
|
||||
|
||||
#[repr(Rust)] //~ ERROR conflicting representation hints
|
||||
#[repr(C)]
|
||||
struct T {
|
||||
a: i32,
|
||||
}
|
||||
|
||||
#[repr(Rust, u64)] //~ ERROR conflicting representation hints
|
||||
enum U {
|
||||
V,
|
||||
}
|
||||
|
||||
#[repr(Rust, simd)]
|
||||
//~^ ERROR conflicting representation hints
|
||||
//~| ERROR SIMD types are experimental and possibly buggy
|
||||
struct F32x4(f32, f32, f32, f32);
|
||||
|
||||
fn main() {}
|
39
tests/ui/repr/explicit-rust-repr-conflicts.stderr
Normal file
39
tests/ui/repr/explicit-rust-repr-conflicts.stderr
Normal file
@ -0,0 +1,39 @@
|
||||
error[E0658]: SIMD types are experimental and possibly buggy
|
||||
--> $DIR/explicit-rust-repr-conflicts.rs:18:1
|
||||
|
|
||||
LL | #[repr(Rust, simd)]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #27731 <https://github.com/rust-lang/rust/issues/27731> for more information
|
||||
= help: add `#![feature(repr_simd)]` to the crate attributes to enable
|
||||
|
||||
error[E0566]: conflicting representation hints
|
||||
--> $DIR/explicit-rust-repr-conflicts.rs:1:8
|
||||
|
|
||||
LL | #[repr(C, Rust)]
|
||||
| ^ ^^^^
|
||||
|
||||
error[E0566]: conflicting representation hints
|
||||
--> $DIR/explicit-rust-repr-conflicts.rs:7:8
|
||||
|
|
||||
LL | #[repr(Rust)]
|
||||
| ^^^^
|
||||
LL | #[repr(C)]
|
||||
| ^
|
||||
|
||||
error[E0566]: conflicting representation hints
|
||||
--> $DIR/explicit-rust-repr-conflicts.rs:13:8
|
||||
|
|
||||
LL | #[repr(Rust, u64)]
|
||||
| ^^^^ ^^^
|
||||
|
||||
error[E0566]: conflicting representation hints
|
||||
--> $DIR/explicit-rust-repr-conflicts.rs:18:8
|
||||
|
|
||||
LL | #[repr(Rust, simd)]
|
||||
| ^^^^ ^^^^
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0566, E0658.
|
||||
For more information about an error, try `rustc --explain E0566`.
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | fn bad_echo<T>(_t: T) -> T {
|
||||
| - - expected `T` because of return type
|
||||
| |
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
LL | "this should not suggest impl Trait"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
|
||||
|
|
||||
@ -17,7 +17,7 @@ error[E0308]: mismatched types
|
||||
LL | fn bad_echo_2<T: Trait>(_t: T) -> T {
|
||||
| - - expected `T` because of return type
|
||||
| |
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
LL | "this will not suggest it, because that would probably be wrong"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
|
||||
|
|
||||
@ -30,7 +30,7 @@ error[E0308]: mismatched types
|
||||
LL | fn other_bounds_bad<T>() -> T
|
||||
| - - expected `T` because of return type
|
||||
| |
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
...
|
||||
LL | "don't suggest this, because Option<T> places additional constraints"
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
|
||||
@ -46,7 +46,7 @@ LL | fn used_in_trait<T>() -> T
|
||||
| | |
|
||||
| | expected `T` because of return type
|
||||
| | help: consider using an impl return type: `impl Send`
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
...
|
||||
LL | "don't suggest this, because the generic param is used in the bound."
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
|
||||
|
@ -5,7 +5,7 @@ LL | fn bar<T: Trait + std::marker::Sync>() -> T
|
||||
| - -
|
||||
| | |
|
||||
| | expected `T` because of return type
|
||||
| this type parameter help: consider using an impl return type: `impl Trait + std::marker::Sync + Send`
|
||||
| expected this type parameter help: consider using an impl return type: `impl Trait + std::marker::Sync + Send`
|
||||
...
|
||||
LL | ()
|
||||
| ^^ expected type parameter `T`, found `()`
|
||||
@ -21,7 +21,7 @@ LL | fn other_bounds<T>() -> T
|
||||
| | |
|
||||
| | expected `T` because of return type
|
||||
| | help: consider using an impl return type: `impl Trait`
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
...
|
||||
LL | ()
|
||||
| ^^ expected type parameter `T`, found `()`
|
||||
|
@ -4,7 +4,7 @@ error[E0308]: mismatched types
|
||||
LL | fn wat<T>(t: &T) -> T {
|
||||
| - - expected `T` because of return type
|
||||
| |
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
LL | t.clone()
|
||||
| ^^^^^^^^^ expected type parameter `T`, found `&T`
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/expected-boxed-future-isnt-pinned.rs:11:5
|
||||
|
|
||||
LL | fn foo<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
|
||||
| - this type parameter ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type
|
||||
| - found this type parameter ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type
|
||||
LL | // We could instead use an `async` block, but this way we have no std spans.
|
||||
LL | x
|
||||
| ^ expected `Pin<Box<...>>`, found type parameter `F`
|
||||
@ -30,7 +30,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/expected-boxed-future-isnt-pinned.rs:19:14
|
||||
|
|
||||
LL | fn baz<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
LL | Pin::new(x)
|
||||
| -------- ^ expected `Box<dyn Future<Output = ...> + Send>`, found type parameter `F`
|
||||
| |
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/restrict-existing-type-bounds.rs:13:12
|
||||
|
|
||||
LL | impl<T: TryAdd> TryAdd for Option<T> {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
...
|
||||
LL | Ok(self)
|
||||
| -- ^^^^ expected `Option<<T as TryAdd>::Output>`, found `Option<T>`
|
||||
@ -29,7 +29,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/restrict-existing-type-bounds.rs:26:12
|
||||
|
|
||||
LL | impl<T: TryAdd<Error = X>> TryAdd for Other<T> {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
...
|
||||
LL | Ok(self)
|
||||
| -- ^^^^ expected `Other<<T as TryAdd>::Output>`, found `Other<T>`
|
||||
|
@ -124,7 +124,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/trait-with-missing-associated-type-restriction.rs:31:9
|
||||
|
|
||||
LL | fn baz<D: std::fmt::Debug, T: Trait<A = D>>(x: T) {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
LL | qux(x.func())
|
||||
| --- ^^^^^^^^ expected `usize`, found type parameter `D`
|
||||
| |
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-52893.rs:53:22
|
||||
|
|
||||
LL | impl<F, Name, P> AddClass<Name, F> for Class<P>
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | builder.push(output);
|
||||
| ---- ^^^^^^ expected type parameter `F`, found `Class<P>`
|
||||
|
@ -42,7 +42,7 @@ error[E0308]: mismatched types
|
||||
LL | pub fn copy_any<T>(t: &T) -> T {
|
||||
| - - expected `T` because of return type
|
||||
| |
|
||||
| this type parameter
|
||||
| expected this type parameter
|
||||
LL | copy::<dyn Setup<From=T>>(t)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/enum-variant-generic-args.rs:13:25
|
||||
|
|
||||
LL | impl<T> Enum<T> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
LL | fn ts_variant() {
|
||||
LL | Self::TSVariant(());
|
||||
| --------------- ^^ expected type parameter `T`, found `()`
|
||||
@ -50,7 +50,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/enum-variant-generic-args.rs:17:31
|
||||
|
|
||||
LL | impl<T> Enum<T> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | Self::<()>::TSVariant(());
|
||||
| --------------------- ^^ expected type parameter `T`, found `()`
|
||||
@ -98,7 +98,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/enum-variant-generic-args.rs:26:29
|
||||
|
|
||||
LL | impl<T> Enum<T> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | Self::SVariant { v: () };
|
||||
| ^^ expected type parameter `T`, found `()`
|
||||
@ -125,7 +125,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/enum-variant-generic-args.rs:28:35
|
||||
|
|
||||
LL | impl<T> Enum<T> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | Self::SVariant::<()> { v: () };
|
||||
| ^^ expected type parameter `T`, found `()`
|
||||
@ -158,7 +158,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/enum-variant-generic-args.rs:31:35
|
||||
|
|
||||
LL | impl<T> Enum<T> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | Self::<()>::SVariant { v: () };
|
||||
| ^^ expected type parameter `T`, found `()`
|
||||
@ -206,7 +206,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/enum-variant-generic-args.rs:34:41
|
||||
|
|
||||
LL | impl<T> Enum<T> {
|
||||
| - this type parameter
|
||||
| - expected this type parameter
|
||||
...
|
||||
LL | Self::<()>::SVariant::<()> { v: () };
|
||||
| ^^ expected type parameter `T`, found `()`
|
||||
|
@ -40,7 +40,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/bad-index-due-to-nested.rs:20:9
|
||||
|
|
||||
LL | fn index<'a, K, V>(map: &'a HashMap<K, V>, k: K) -> &'a V {
|
||||
| - this type parameter
|
||||
| - found this type parameter
|
||||
LL | map[k]
|
||||
| ^ expected `&K`, found type parameter `K`
|
||||
|
|
||||
@ -55,7 +55,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/bad-index-due-to-nested.rs:20:5
|
||||
|
|
||||
LL | fn index<'a, K, V>(map: &'a HashMap<K, V>, k: K) -> &'a V {
|
||||
| - this type parameter ----- expected `&'a V` because of return type
|
||||
| - found this type parameter ----- expected `&'a V` because of return type
|
||||
LL | map[k]
|
||||
| ^^^^^^ expected `&V`, found type parameter `V`
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-13853.rs:14:9
|
||||
|
|
||||
LL | fn nodes<'a, I: Iterator<Item=&'a N>>(&self) -> I
|
||||
| - this type parameter - expected `I` because of return type
|
||||
| - expected this type parameter - expected `I` because of return type
|
||||
...
|
||||
LL | self.iter()
|
||||
| ^^^^^^^^^^^ expected type parameter `I`, found `Iter<'_, N>`
|
||||
|
Loading…
Reference in New Issue
Block a user