improve diagnosts for GATs
This commit is contained in:
parent
fe62c6e295
commit
e4d9bc66f6
113 changed files with 1625 additions and 890 deletions
|
@ -24,6 +24,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||||
param_mode: ParamMode,
|
param_mode: ParamMode,
|
||||||
mut itctx: ImplTraitContext<'_, 'hir>,
|
mut itctx: ImplTraitContext<'_, 'hir>,
|
||||||
) -> hir::QPath<'hir> {
|
) -> hir::QPath<'hir> {
|
||||||
|
debug!("lower_qpath(id: {:?}, qself: {:?}, p: {:?})", id, qself, p);
|
||||||
let qself_position = qself.as_ref().map(|q| q.position);
|
let qself_position = qself.as_ref().map(|q| q.position);
|
||||||
let qself = qself.as_ref().map(|q| self.lower_ty(&q.ty, itctx.reborrow()));
|
let qself = qself.as_ref().map(|q| self.lower_ty(&q.ty, itctx.reborrow()));
|
||||||
|
|
||||||
|
@ -222,6 +223,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||||
itctx: ImplTraitContext<'_, 'hir>,
|
itctx: ImplTraitContext<'_, 'hir>,
|
||||||
explicit_owner: Option<NodeId>,
|
explicit_owner: Option<NodeId>,
|
||||||
) -> hir::PathSegment<'hir> {
|
) -> hir::PathSegment<'hir> {
|
||||||
|
debug!(
|
||||||
|
"path_span: {:?}, lower_path_segment(segment: {:?}, expected_lifetimes: {:?})",
|
||||||
|
path_span, segment, expected_lifetimes
|
||||||
|
);
|
||||||
let (mut generic_args, infer_args) = if let Some(ref generic_args) = segment.args {
|
let (mut generic_args, infer_args) = if let Some(ref generic_args) = segment.args {
|
||||||
let msg = "parenthesized type parameters may only be used with a `Fn` trait";
|
let msg = "parenthesized type parameters may only be used with a `Fn` trait";
|
||||||
match **generic_args {
|
match **generic_args {
|
||||||
|
|
|
@ -49,6 +49,20 @@ pub enum Region {
|
||||||
Free(DefId, /* lifetime decl */ DefId),
|
Free(DefId, /* lifetime decl */ DefId),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// This is used in diagnostics to improve suggestions for missing generic arguments.
|
||||||
|
/// It gives information on the type of lifetimes that are in scope for a particular `PathSegment`,
|
||||||
|
/// so that we can e.g. suggest elided-lifetimes-in-paths of the form <'_, '_> e.g.
|
||||||
|
#[derive(Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, Debug, HashStable)]
|
||||||
|
pub enum LifetimeScopeForPath {
|
||||||
|
// Contains all lifetime names that are in scope and could possibly be used in generics
|
||||||
|
// arguments of path.
|
||||||
|
NonElided(Vec<String>),
|
||||||
|
|
||||||
|
// Information that allows us to suggest args of the form `<'_>` in case
|
||||||
|
// no generic arguments were provided for a path.
|
||||||
|
Elided,
|
||||||
|
}
|
||||||
|
|
||||||
/// A set containing, at most, one known element.
|
/// A set containing, at most, one known element.
|
||||||
/// If two distinct values are inserted into a set, then it
|
/// If two distinct values are inserted into a set, then it
|
||||||
/// becomes `Many`, which can be used to detect ambiguities.
|
/// becomes `Many`, which can be used to detect ambiguities.
|
||||||
|
|
|
@ -1301,6 +1301,10 @@ rustc_queries! {
|
||||||
desc { "looking up late bound vars" }
|
desc { "looking up late bound vars" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
query lifetime_scope_map(_: LocalDefId) -> Option<FxHashMap<ItemLocalId, LifetimeScopeForPath>> {
|
||||||
|
desc { "finds the lifetime scope for an HirId of a PathSegment" }
|
||||||
|
}
|
||||||
|
|
||||||
query visibility(def_id: DefId) -> ty::Visibility {
|
query visibility(def_id: DefId) -> ty::Visibility {
|
||||||
eval_always
|
eval_always
|
||||||
desc { |tcx| "computing visibility of `{}`", tcx.def_path_str(def_id) }
|
desc { |tcx| "computing visibility of `{}`", tcx.def_path_str(def_id) }
|
||||||
|
|
|
@ -9,7 +9,7 @@ use crate::infer::canonical::{Canonical, CanonicalVarInfo, CanonicalVarInfos};
|
||||||
use crate::lint::{struct_lint_level, LintDiagnosticBuilder, LintLevelSource};
|
use crate::lint::{struct_lint_level, LintDiagnosticBuilder, LintLevelSource};
|
||||||
use crate::middle;
|
use crate::middle;
|
||||||
use crate::middle::cstore::{CrateStoreDyn, EncodedMetadata};
|
use crate::middle::cstore::{CrateStoreDyn, EncodedMetadata};
|
||||||
use crate::middle::resolve_lifetime::{self, ObjectLifetimeDefault};
|
use crate::middle::resolve_lifetime::{self, LifetimeScopeForPath, ObjectLifetimeDefault};
|
||||||
use crate::middle::stability;
|
use crate::middle::stability;
|
||||||
use crate::mir::interpret::{self, Allocation, ConstValue, Scalar};
|
use crate::mir::interpret::{self, Allocation, ConstValue, Scalar};
|
||||||
use crate::mir::{Body, Field, Local, Place, PlaceElem, ProjectionKind, Promoted};
|
use crate::mir::{Body, Field, Local, Place, PlaceElem, ProjectionKind, Promoted};
|
||||||
|
@ -2686,6 +2686,10 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
.iter(),
|
.iter(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn lifetime_scope(self, id: HirId) -> Option<LifetimeScopeForPath> {
|
||||||
|
self.lifetime_scope_map(id.owner).and_then(|mut map| map.remove(&id.local_id))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TyCtxtAt<'tcx> {
|
impl TyCtxtAt<'tcx> {
|
||||||
|
|
|
@ -9,7 +9,9 @@ use crate::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
|
||||||
use crate::middle::lib_features::LibFeatures;
|
use crate::middle::lib_features::LibFeatures;
|
||||||
use crate::middle::privacy::AccessLevels;
|
use crate::middle::privacy::AccessLevels;
|
||||||
use crate::middle::region;
|
use crate::middle::region;
|
||||||
use crate::middle::resolve_lifetime::{ObjectLifetimeDefault, Region, ResolveLifetimes};
|
use crate::middle::resolve_lifetime::{
|
||||||
|
LifetimeScopeForPath, ObjectLifetimeDefault, Region, ResolveLifetimes,
|
||||||
|
};
|
||||||
use crate::middle::stability::{self, DeprecationEntry};
|
use crate::middle::stability::{self, DeprecationEntry};
|
||||||
use crate::mir;
|
use crate::mir;
|
||||||
use crate::mir::interpret::GlobalId;
|
use crate::mir::interpret::GlobalId;
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
|
|
||||||
use crate::late::diagnostics::{ForLifetimeSpanType, MissingLifetimeSpot};
|
use crate::late::diagnostics::{ForLifetimeSpanType, MissingLifetimeSpot};
|
||||||
use rustc_ast::walk_list;
|
use rustc_ast::walk_list;
|
||||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
|
||||||
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder};
|
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def::{DefKind, Res};
|
use rustc_hir::def::{DefKind, Res};
|
||||||
use rustc_hir::def_id::DefIdMap;
|
use rustc_hir::def_id::{DefIdMap, LocalDefId};
|
||||||
use rustc_hir::hir_id::ItemLocalId;
|
use rustc_hir::hir_id::ItemLocalId;
|
||||||
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
|
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||||
use rustc_hir::{GenericArg, GenericParam, LifetimeName, Node, ParamName, QPath};
|
use rustc_hir::{GenericArg, GenericParam, LifetimeName, Node, ParamName, QPath};
|
||||||
|
@ -22,7 +22,7 @@ use rustc_middle::middle::resolve_lifetime::*;
|
||||||
use rustc_middle::ty::{self, DefIdTree, GenericParamDefKind, TyCtxt};
|
use rustc_middle::ty::{self, DefIdTree, GenericParamDefKind, TyCtxt};
|
||||||
use rustc_middle::{bug, span_bug};
|
use rustc_middle::{bug, span_bug};
|
||||||
use rustc_session::lint;
|
use rustc_session::lint;
|
||||||
use rustc_span::def_id::{DefId, LocalDefId};
|
use rustc_span::def_id::DefId;
|
||||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -158,6 +158,9 @@ struct NamedRegionMap {
|
||||||
// - trait refs
|
// - trait refs
|
||||||
// - bound types (like `T` in `for<'a> T<'a>: Foo`)
|
// - bound types (like `T` in `for<'a> T<'a>: Foo`)
|
||||||
late_bound_vars: HirIdMap<Vec<ty::BoundVariableKind>>,
|
late_bound_vars: HirIdMap<Vec<ty::BoundVariableKind>>,
|
||||||
|
|
||||||
|
// maps `PathSegment` `HirId`s to lifetime scopes.
|
||||||
|
scope_for_path: Option<FxHashMap<LocalDefId, FxHashMap<ItemLocalId, LifetimeScopeForPath>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
crate struct LifetimeContext<'a, 'tcx> {
|
crate struct LifetimeContext<'a, 'tcx> {
|
||||||
|
@ -195,7 +198,9 @@ enum Scope<'a> {
|
||||||
/// it should be shifted by the number of `Binder`s in between the
|
/// it should be shifted by the number of `Binder`s in between the
|
||||||
/// declaration `Binder` and the location it's referenced from.
|
/// declaration `Binder` and the location it's referenced from.
|
||||||
Binder {
|
Binder {
|
||||||
lifetimes: FxHashMap<hir::ParamName, Region>,
|
/// We use an IndexMap here because we want these lifetimes in order
|
||||||
|
/// for diagnostics.
|
||||||
|
lifetimes: FxIndexMap<hir::ParamName, Region>,
|
||||||
|
|
||||||
/// if we extend this scope with another scope, what is the next index
|
/// if we extend this scope with another scope, what is the next index
|
||||||
/// we should use for an early-bound region?
|
/// we should use for an early-bound region?
|
||||||
|
@ -379,6 +384,10 @@ pub fn provide(providers: &mut ty::query::Providers) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
late_bound_vars_map: |tcx, id| resolve_lifetimes_for(tcx, id).late_bound_vars.get(&id),
|
late_bound_vars_map: |tcx, id| resolve_lifetimes_for(tcx, id).late_bound_vars.get(&id),
|
||||||
|
lifetime_scope_map: |tcx, id| {
|
||||||
|
let item_id = item_for(tcx, id);
|
||||||
|
do_resolve(tcx, item_id, false, true).scope_for_path.unwrap().remove(&id)
|
||||||
|
},
|
||||||
|
|
||||||
..*providers
|
..*providers
|
||||||
};
|
};
|
||||||
|
@ -419,7 +428,7 @@ fn resolve_lifetimes_trait_definition(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
local_def_id: LocalDefId,
|
local_def_id: LocalDefId,
|
||||||
) -> ResolveLifetimes {
|
) -> ResolveLifetimes {
|
||||||
do_resolve(tcx, local_def_id, true)
|
convert_named_region_map(do_resolve(tcx, local_def_id, true, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Computes the `ResolveLifetimes` map that contains data for an entire `Item`.
|
/// Computes the `ResolveLifetimes` map that contains data for an entire `Item`.
|
||||||
|
@ -427,19 +436,21 @@ fn resolve_lifetimes_trait_definition(
|
||||||
/// `named_region_map`, `is_late_bound_map`, etc.
|
/// `named_region_map`, `is_late_bound_map`, etc.
|
||||||
#[tracing::instrument(level = "debug", skip(tcx))]
|
#[tracing::instrument(level = "debug", skip(tcx))]
|
||||||
fn resolve_lifetimes(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> ResolveLifetimes {
|
fn resolve_lifetimes(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> ResolveLifetimes {
|
||||||
do_resolve(tcx, local_def_id, false)
|
convert_named_region_map(do_resolve(tcx, local_def_id, false, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn do_resolve(
|
fn do_resolve(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
local_def_id: LocalDefId,
|
local_def_id: LocalDefId,
|
||||||
trait_definition_only: bool,
|
trait_definition_only: bool,
|
||||||
) -> ResolveLifetimes {
|
with_scope_for_path: bool,
|
||||||
|
) -> NamedRegionMap {
|
||||||
let item = tcx.hir().expect_item(tcx.hir().local_def_id_to_hir_id(local_def_id));
|
let item = tcx.hir().expect_item(tcx.hir().local_def_id_to_hir_id(local_def_id));
|
||||||
let mut named_region_map = NamedRegionMap {
|
let mut named_region_map = NamedRegionMap {
|
||||||
defs: Default::default(),
|
defs: Default::default(),
|
||||||
late_bound: Default::default(),
|
late_bound: Default::default(),
|
||||||
late_bound_vars: Default::default(),
|
late_bound_vars: Default::default(),
|
||||||
|
scope_for_path: with_scope_for_path.then(|| Default::default()),
|
||||||
};
|
};
|
||||||
let mut visitor = LifetimeContext {
|
let mut visitor = LifetimeContext {
|
||||||
tcx,
|
tcx,
|
||||||
|
@ -455,6 +466,10 @@ fn do_resolve(
|
||||||
};
|
};
|
||||||
visitor.visit_item(item);
|
visitor.visit_item(item);
|
||||||
|
|
||||||
|
named_region_map
|
||||||
|
}
|
||||||
|
|
||||||
|
fn convert_named_region_map(named_region_map: NamedRegionMap) -> ResolveLifetimes {
|
||||||
let mut rl = ResolveLifetimes::default();
|
let mut rl = ResolveLifetimes::default();
|
||||||
|
|
||||||
for (hir_id, v) in named_region_map.defs {
|
for (hir_id, v) in named_region_map.defs {
|
||||||
|
@ -567,6 +582,41 @@ fn late_region_as_bound_region<'tcx>(tcx: TyCtxt<'tcx>, region: &Region) -> ty::
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(level = "debug")]
|
||||||
|
fn get_lifetime_scopes_for_path(mut scope: &Scope<'_>) -> LifetimeScopeForPath {
|
||||||
|
let mut available_lifetimes = vec![];
|
||||||
|
loop {
|
||||||
|
match scope {
|
||||||
|
Scope::Binder { lifetimes, s, .. } => {
|
||||||
|
available_lifetimes.extend(lifetimes.keys().filter_map(|p| match p {
|
||||||
|
hir::ParamName::Plain(ident) => Some(ident.name.to_string()),
|
||||||
|
_ => None,
|
||||||
|
}));
|
||||||
|
scope = s;
|
||||||
|
}
|
||||||
|
Scope::Body { s, .. } => {
|
||||||
|
scope = s;
|
||||||
|
}
|
||||||
|
Scope::Elision { elide, s } => {
|
||||||
|
if let Elide::Exact(_) = elide {
|
||||||
|
return LifetimeScopeForPath::Elided;
|
||||||
|
} else {
|
||||||
|
scope = s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Scope::ObjectLifetimeDefault { s, .. } => {
|
||||||
|
scope = s;
|
||||||
|
}
|
||||||
|
Scope::Root => {
|
||||||
|
return LifetimeScopeForPath::NonElided(available_lifetimes);
|
||||||
|
}
|
||||||
|
Scope::Supertrait { s, .. } | Scope::TraitRefBoundary { s, .. } => {
|
||||||
|
scope = s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||||
/// Returns the binders in scope and the type of `Binder` that should be created for a poly trait ref.
|
/// Returns the binders in scope and the type of `Binder` that should be created for a poly trait ref.
|
||||||
fn poly_trait_ref_binder_info(&mut self) -> (Vec<ty::BoundVariableKind>, BinderScopeType) {
|
fn poly_trait_ref_binder_info(&mut self) -> (Vec<ty::BoundVariableKind>, BinderScopeType) {
|
||||||
|
@ -656,7 +706,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||||
self.map.late_bound_vars.insert(hir_id, vec![]);
|
self.map.late_bound_vars.insert(hir_id, vec![]);
|
||||||
let scope = Scope::Binder {
|
let scope = Scope::Binder {
|
||||||
hir_id,
|
hir_id,
|
||||||
lifetimes: FxHashMap::default(),
|
lifetimes: FxIndexMap::default(),
|
||||||
next_early_index: self.next_early_index(),
|
next_early_index: self.next_early_index(),
|
||||||
s: self.scope,
|
s: self.scope,
|
||||||
track_lifetime_uses: true,
|
track_lifetime_uses: true,
|
||||||
|
@ -720,9 +770,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||||
// We need to add *all* deps, since opaque tys may want them from *us*
|
// We need to add *all* deps, since opaque tys may want them from *us*
|
||||||
for (&owner, defs) in resolved_lifetimes.defs.iter() {
|
for (&owner, defs) in resolved_lifetimes.defs.iter() {
|
||||||
defs.iter().for_each(|(&local_id, region)| {
|
defs.iter().for_each(|(&local_id, region)| {
|
||||||
self.map
|
self.map.defs.insert(hir::HirId { owner, local_id }, *region);
|
||||||
.defs
|
|
||||||
.insert(hir::HirId { owner, local_id }, region.clone());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (&owner, late_bound) in resolved_lifetimes.late_bound.iter() {
|
for (&owner, late_bound) in resolved_lifetimes.late_bound.iter() {
|
||||||
|
@ -836,7 +884,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||||
};
|
};
|
||||||
self.missing_named_lifetime_spots
|
self.missing_named_lifetime_spots
|
||||||
.push(MissingLifetimeSpot::HigherRanked { span, span_type });
|
.push(MissingLifetimeSpot::HigherRanked { span, span_type });
|
||||||
let (lifetimes, binders): (FxHashMap<hir::ParamName, Region>, Vec<_>) = c
|
let (lifetimes, binders): (FxIndexMap<hir::ParamName, Region>, Vec<_>) = c
|
||||||
.generic_params
|
.generic_params
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|param| match param.kind {
|
.filter_map(|param| match param.kind {
|
||||||
|
@ -1010,7 +1058,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||||
debug!(?index);
|
debug!(?index);
|
||||||
|
|
||||||
let mut elision = None;
|
let mut elision = None;
|
||||||
let mut lifetimes = FxHashMap::default();
|
let mut lifetimes = FxIndexMap::default();
|
||||||
let mut non_lifetime_count = 0;
|
let mut non_lifetime_count = 0;
|
||||||
for param in generics.params {
|
for param in generics.params {
|
||||||
match param.kind {
|
match param.kind {
|
||||||
|
@ -1181,7 +1229,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||||
let mut index = self.next_early_index();
|
let mut index = self.next_early_index();
|
||||||
let mut non_lifetime_count = 0;
|
let mut non_lifetime_count = 0;
|
||||||
debug!("visit_ty: index = {}", index);
|
debug!("visit_ty: index = {}", index);
|
||||||
let lifetimes: FxHashMap<hir::ParamName, Region> = generics
|
let lifetimes: FxIndexMap<hir::ParamName, Region> = generics
|
||||||
.params
|
.params
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|param| match param.kind {
|
.filter_map(|param| match param.kind {
|
||||||
|
@ -1241,14 +1289,52 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||||
self.resolve_lifetime_ref(lifetime_ref);
|
self.resolve_lifetime_ref(lifetime_ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn visit_assoc_type_binding(&mut self, type_binding: &'tcx hir::TypeBinding<'_>) {
|
||||||
|
let scope = self.scope;
|
||||||
|
if let Some(scope_for_path) = self.map.scope_for_path.as_mut() {
|
||||||
|
// We add lifetime scope information for `Ident`s in associated type bindings and use
|
||||||
|
// the `HirId` of the type binding as the key in `LifetimeMap`
|
||||||
|
let lifetime_scope = get_lifetime_scopes_for_path(scope);
|
||||||
|
let map = scope_for_path.entry(type_binding.hir_id.owner).or_default();
|
||||||
|
map.insert(type_binding.hir_id.local_id, lifetime_scope);
|
||||||
|
}
|
||||||
|
hir::intravisit::walk_assoc_type_binding(self, type_binding);
|
||||||
|
}
|
||||||
|
|
||||||
fn visit_path(&mut self, path: &'tcx hir::Path<'tcx>, _: hir::HirId) {
|
fn visit_path(&mut self, path: &'tcx hir::Path<'tcx>, _: hir::HirId) {
|
||||||
for (i, segment) in path.segments.iter().enumerate() {
|
for (i, segment) in path.segments.iter().enumerate() {
|
||||||
let depth = path.segments.len() - i - 1;
|
let depth = path.segments.len() - i - 1;
|
||||||
if let Some(ref args) = segment.args {
|
if let Some(ref args) = segment.args {
|
||||||
self.visit_segment_args(path.res, depth, args);
|
self.visit_segment_args(path.res, depth, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let scope = self.scope;
|
||||||
|
if let Some(scope_for_path) = self.map.scope_for_path.as_mut() {
|
||||||
|
// Add lifetime scope information to path segment. Note we cannot call `visit_path_segment`
|
||||||
|
// here because that call would yield to resolution problems due to `walk_path_segment`
|
||||||
|
// being called, which processes the path segments generic args, which we have already
|
||||||
|
// processed using `visit_segment_args`.
|
||||||
|
let lifetime_scope = get_lifetime_scopes_for_path(scope);
|
||||||
|
if let Some(hir_id) = segment.hir_id {
|
||||||
|
let map = scope_for_path.entry(hir_id.owner).or_default();
|
||||||
|
map.insert(hir_id.local_id, lifetime_scope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_path_segment(&mut self, path_span: Span, path_segment: &'tcx hir::PathSegment<'tcx>) {
|
||||||
|
let scope = self.scope;
|
||||||
|
if let Some(scope_for_path) = self.map.scope_for_path.as_mut() {
|
||||||
|
let lifetime_scope = get_lifetime_scopes_for_path(scope);
|
||||||
|
if let Some(hir_id) = path_segment.hir_id {
|
||||||
|
let map = scope_for_path.entry(hir_id.owner).or_default();
|
||||||
|
map.insert(hir_id.local_id, lifetime_scope);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
intravisit::walk_path_segment(self, path_span, path_segment);
|
||||||
|
}
|
||||||
|
|
||||||
fn visit_fn_decl(&mut self, fd: &'tcx hir::FnDecl<'tcx>) {
|
fn visit_fn_decl(&mut self, fd: &'tcx hir::FnDecl<'tcx>) {
|
||||||
let output = match fd.output {
|
let output = match fd.output {
|
||||||
|
@ -1290,7 +1376,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||||
ref bound_generic_params,
|
ref bound_generic_params,
|
||||||
..
|
..
|
||||||
}) => {
|
}) => {
|
||||||
let (lifetimes, binders): (FxHashMap<hir::ParamName, Region>, Vec<_>) =
|
let (lifetimes, binders): (FxIndexMap<hir::ParamName, Region>, Vec<_>) =
|
||||||
bound_generic_params
|
bound_generic_params
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|param| match param.kind {
|
.filter_map(|param| match param.kind {
|
||||||
|
@ -1360,7 +1446,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||||
self.map.late_bound_vars.insert(*hir_id, binders);
|
self.map.late_bound_vars.insert(*hir_id, binders);
|
||||||
let scope = Scope::Binder {
|
let scope = Scope::Binder {
|
||||||
hir_id: *hir_id,
|
hir_id: *hir_id,
|
||||||
lifetimes: FxHashMap::default(),
|
lifetimes: FxIndexMap::default(),
|
||||||
s: self.scope,
|
s: self.scope,
|
||||||
next_early_index: self.next_early_index(),
|
next_early_index: self.next_early_index(),
|
||||||
track_lifetime_uses: true,
|
track_lifetime_uses: true,
|
||||||
|
@ -1388,7 +1474,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||||
let (mut binders, scope_type) = self.poly_trait_ref_binder_info();
|
let (mut binders, scope_type) = self.poly_trait_ref_binder_info();
|
||||||
|
|
||||||
let initial_bound_vars = binders.len() as u32;
|
let initial_bound_vars = binders.len() as u32;
|
||||||
let mut lifetimes: FxHashMap<hir::ParamName, Region> = FxHashMap::default();
|
let mut lifetimes: FxIndexMap<hir::ParamName, Region> = FxIndexMap::default();
|
||||||
let binders_iter = trait_ref
|
let binders_iter = trait_ref
|
||||||
.bound_generic_params
|
.bound_generic_params
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -2115,7 +2201,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||||
|
|
||||||
let mut non_lifetime_count = 0;
|
let mut non_lifetime_count = 0;
|
||||||
let mut named_late_bound_vars = 0;
|
let mut named_late_bound_vars = 0;
|
||||||
let lifetimes: FxHashMap<hir::ParamName, Region> = generics
|
let lifetimes: FxIndexMap<hir::ParamName, Region> = generics
|
||||||
.params
|
.params
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|param| match param.kind {
|
.filter_map(|param| match param.kind {
|
||||||
|
@ -3034,6 +3120,16 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// If we specifically need the `scope_for_path` map, then we're in the
|
||||||
|
// diagnostic pass and we don't want to emit more errors.
|
||||||
|
if self.map.scope_for_path.is_some() {
|
||||||
|
self.tcx.sess.delay_span_bug(
|
||||||
|
rustc_span::DUMMY_SP,
|
||||||
|
"Encountered unexpected errors during diagnostics related part",
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let mut spans: Vec<_> = lifetime_refs.iter().map(|lt| lt.span).collect();
|
let mut spans: Vec<_> = lifetime_refs.iter().map(|lt| lt.span).collect();
|
||||||
spans.sort();
|
spans.sort();
|
||||||
let mut spans_dedup = spans.clone();
|
let mut spans_dedup = spans.clone();
|
||||||
|
|
|
@ -4,7 +4,7 @@ use crate::astconv::{
|
||||||
GenericArgCountResult, GenericArgPosition,
|
GenericArgCountResult, GenericArgPosition,
|
||||||
};
|
};
|
||||||
use crate::errors::AssocTypeBindingNotAllowed;
|
use crate::errors::AssocTypeBindingNotAllowed;
|
||||||
use crate::structured_errors::{StructuredDiagnostic, WrongNumberOfGenericArgs};
|
use crate::structured_errors::{GenericArgsInfo, StructuredDiagnostic, WrongNumberOfGenericArgs};
|
||||||
use rustc_ast::ast::ParamKindOrd;
|
use rustc_ast::ast::ParamKindOrd;
|
||||||
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorReported};
|
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorReported};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
|
@ -438,6 +438,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
has_self: bool,
|
has_self: bool,
|
||||||
infer_args: bool,
|
infer_args: bool,
|
||||||
) -> GenericArgCountResult {
|
) -> GenericArgCountResult {
|
||||||
|
debug!(
|
||||||
|
"check_generic_arg_count(span: {:?}, def_id: {:?}, seg: {:?}, gen_params: {:?}, gen_args: {:?})",
|
||||||
|
span, def_id, seg, gen_params, gen_args
|
||||||
|
);
|
||||||
|
|
||||||
let default_counts = gen_params.own_defaults();
|
let default_counts = gen_params.own_defaults();
|
||||||
let param_counts = gen_params.own_counts();
|
let param_counts = gen_params.own_counts();
|
||||||
let named_type_param_count = param_counts.types - has_self as usize;
|
let named_type_param_count = param_counts.types - has_self as usize;
|
||||||
|
@ -453,63 +458,116 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
|
|
||||||
let mut invalid_args = vec![];
|
let mut invalid_args = vec![];
|
||||||
|
|
||||||
let mut check_generics =
|
let mut check_lifetime_args = |min_expected_args: usize,
|
||||||
|kind, expected_min, expected_max, provided, params_offset, args_offset, silent| {
|
max_expected_args: usize,
|
||||||
if (expected_min..=expected_max).contains(&provided) {
|
provided_args: usize,
|
||||||
|
late_bounds_ignore: bool|
|
||||||
|
-> bool {
|
||||||
|
if (min_expected_args..=max_expected_args).contains(&provided_args) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if silent {
|
if late_bounds_ignore {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if provided > expected_max {
|
if provided_args > max_expected_args {
|
||||||
invalid_args.extend(
|
invalid_args.extend(
|
||||||
gen_args.args[args_offset + expected_max..args_offset + provided]
|
gen_args.args[max_expected_args..provided_args].iter().map(|arg| arg.span()),
|
||||||
.iter()
|
|
||||||
.map(|arg| arg.span()),
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
WrongNumberOfGenericArgs {
|
let gen_args_info = if provided_args > min_expected_args {
|
||||||
|
invalid_args.extend(
|
||||||
|
gen_args.args[min_expected_args..provided_args].iter().map(|arg| arg.span()),
|
||||||
|
);
|
||||||
|
let num_redundant_args = provided_args - min_expected_args;
|
||||||
|
GenericArgsInfo::ExcessLifetimes { num_redundant_args }
|
||||||
|
} else {
|
||||||
|
let num_missing_args = min_expected_args - provided_args;
|
||||||
|
GenericArgsInfo::MissingLifetimes { num_missing_args }
|
||||||
|
};
|
||||||
|
|
||||||
|
WrongNumberOfGenericArgs::new(
|
||||||
tcx,
|
tcx,
|
||||||
kind,
|
gen_args_info,
|
||||||
expected_min,
|
seg,
|
||||||
expected_max,
|
|
||||||
provided,
|
|
||||||
params_offset,
|
|
||||||
args_offset,
|
|
||||||
path_segment: seg,
|
|
||||||
gen_params,
|
gen_params,
|
||||||
|
has_self as usize,
|
||||||
gen_args,
|
gen_args,
|
||||||
def_id,
|
def_id,
|
||||||
span,
|
)
|
||||||
}
|
|
||||||
.diagnostic()
|
.diagnostic()
|
||||||
.emit();
|
.emit();
|
||||||
|
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
|
||||||
let lifetimes_correct = check_generics(
|
let min_expected_lifetime_args = if infer_lifetimes { 0 } else { param_counts.lifetimes };
|
||||||
"lifetime",
|
let max_expected_lifetime_args = param_counts.lifetimes;
|
||||||
if infer_lifetimes { 0 } else { param_counts.lifetimes },
|
let num_provided_lifetime_args = arg_counts.lifetimes;
|
||||||
param_counts.lifetimes,
|
|
||||||
arg_counts.lifetimes,
|
let lifetimes_correct = check_lifetime_args(
|
||||||
has_self as usize,
|
min_expected_lifetime_args,
|
||||||
0,
|
max_expected_lifetime_args,
|
||||||
|
num_provided_lifetime_args,
|
||||||
explicit_late_bound == ExplicitLateBound::Yes,
|
explicit_late_bound == ExplicitLateBound::Yes,
|
||||||
);
|
);
|
||||||
|
|
||||||
let args_correct = {
|
let mut check_types_and_consts =
|
||||||
let kind = if param_counts.consts + arg_counts.consts == 0 {
|
|expected_min, expected_max, provided, params_offset, args_offset| {
|
||||||
"type"
|
debug!(
|
||||||
} else if named_type_param_count + arg_counts.types == 0 {
|
"check_types_and_consts(expected_min: {:?}, expected_max: {:?}, \
|
||||||
"const"
|
provided: {:?}, params_offset: {:?}, args_offset: {:?}",
|
||||||
|
expected_min, expected_max, provided, params_offset, args_offset
|
||||||
|
);
|
||||||
|
if (expected_min..=expected_max).contains(&provided) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
let num_default_params = expected_max - expected_min;
|
||||||
|
|
||||||
|
let gen_args_info = if provided > expected_max {
|
||||||
|
invalid_args.extend(
|
||||||
|
gen_args.args[args_offset + expected_max..args_offset + provided]
|
||||||
|
.iter()
|
||||||
|
.map(|arg| arg.span()),
|
||||||
|
);
|
||||||
|
let num_redundant_args = provided - expected_max;
|
||||||
|
|
||||||
|
GenericArgsInfo::ExcessTypesOrConsts {
|
||||||
|
num_redundant_args,
|
||||||
|
num_default_params,
|
||||||
|
args_offset,
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
"generic"
|
let num_missing_args = expected_max - provided;
|
||||||
|
|
||||||
|
GenericArgsInfo::MissingTypesOrConsts {
|
||||||
|
num_missing_args,
|
||||||
|
num_default_params,
|
||||||
|
args_offset,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
debug!("gen_args_info: {:?}", gen_args_info);
|
||||||
|
|
||||||
|
WrongNumberOfGenericArgs::new(
|
||||||
|
tcx,
|
||||||
|
gen_args_info,
|
||||||
|
seg,
|
||||||
|
gen_params,
|
||||||
|
params_offset,
|
||||||
|
gen_args,
|
||||||
|
def_id,
|
||||||
|
)
|
||||||
|
.diagnostic()
|
||||||
|
.emit();
|
||||||
|
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
|
let args_correct = {
|
||||||
let expected_min = if infer_args {
|
let expected_min = if infer_args {
|
||||||
0
|
0
|
||||||
} else {
|
} else {
|
||||||
|
@ -517,15 +575,15 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
- default_counts.types
|
- default_counts.types
|
||||||
- default_counts.consts
|
- default_counts.consts
|
||||||
};
|
};
|
||||||
|
debug!("expected_min: {:?}", expected_min);
|
||||||
|
debug!("arg_counts.lifetimes: {:?}", arg_counts.lifetimes);
|
||||||
|
|
||||||
check_generics(
|
check_types_and_consts(
|
||||||
kind,
|
|
||||||
expected_min,
|
expected_min,
|
||||||
param_counts.consts + named_type_param_count,
|
param_counts.consts + named_type_param_count,
|
||||||
arg_counts.consts + arg_counts.types,
|
arg_counts.consts + arg_counts.types,
|
||||||
param_counts.lifetimes + has_self as usize,
|
param_counts.lifetimes + has_self as usize,
|
||||||
arg_counts.lifetimes,
|
arg_counts.lifetimes,
|
||||||
false,
|
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,7 @@ pub enum SizedByDefault {
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct ConvertedBinding<'a, 'tcx> {
|
struct ConvertedBinding<'a, 'tcx> {
|
||||||
|
hir_id: hir::HirId,
|
||||||
item_name: Ident,
|
item_name: Ident,
|
||||||
kind: ConvertedBindingKind<'a, 'tcx>,
|
kind: ConvertedBindingKind<'a, 'tcx>,
|
||||||
gen_args: &'a GenericArgs<'a>,
|
gen_args: &'a GenericArgs<'a>,
|
||||||
|
@ -590,6 +591,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ConvertedBinding {
|
ConvertedBinding {
|
||||||
|
hir_id: binding.hir_id,
|
||||||
item_name: binding.ident,
|
item_name: binding.ident,
|
||||||
kind,
|
kind,
|
||||||
gen_args: binding.gen_args,
|
gen_args: binding.gen_args,
|
||||||
|
@ -609,6 +611,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
item_segment: &hir::PathSegment<'_>,
|
item_segment: &hir::PathSegment<'_>,
|
||||||
parent_substs: SubstsRef<'tcx>,
|
parent_substs: SubstsRef<'tcx>,
|
||||||
) -> SubstsRef<'tcx> {
|
) -> SubstsRef<'tcx> {
|
||||||
|
debug!(
|
||||||
|
"create_substs_for_associated_item(span: {:?}, item_def_id: {:?}, item_segment: {:?}",
|
||||||
|
span, item_def_id, item_segment
|
||||||
|
);
|
||||||
if tcx.generics_of(item_def_id).params.is_empty() {
|
if tcx.generics_of(item_def_id).params.is_empty() {
|
||||||
self.prohibit_generics(slice::from_ref(item_segment));
|
self.prohibit_generics(slice::from_ref(item_segment));
|
||||||
|
|
||||||
|
@ -1071,9 +1077,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
|
|
||||||
// Include substitutions for generic parameters of associated types
|
// Include substitutions for generic parameters of associated types
|
||||||
let projection_ty = candidate.map_bound(|trait_ref| {
|
let projection_ty = candidate.map_bound(|trait_ref| {
|
||||||
|
let ident = Ident::new(assoc_ty.ident.name, binding.item_name.span);
|
||||||
let item_segment = hir::PathSegment {
|
let item_segment = hir::PathSegment {
|
||||||
ident: assoc_ty.ident,
|
ident,
|
||||||
hir_id: None,
|
hir_id: Some(binding.hir_id),
|
||||||
res: None,
|
res: None,
|
||||||
args: Some(binding.gen_args),
|
args: Some(binding.gen_args),
|
||||||
infer_args: false,
|
infer_args: false,
|
||||||
|
|
|
@ -1,34 +1,20 @@
|
||||||
use crate::structured_errors::StructuredDiagnostic;
|
use crate::structured_errors::StructuredDiagnostic;
|
||||||
use hir::def::DefKind;
|
|
||||||
use rustc_errors::{pluralize, Applicability, DiagnosticBuilder, DiagnosticId};
|
use rustc_errors::{pluralize, Applicability, DiagnosticBuilder, DiagnosticId};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
|
use rustc_middle::middle::resolve_lifetime::LifetimeScopeForPath;
|
||||||
use rustc_middle::ty::{self as ty, TyCtxt};
|
use rustc_middle::ty::{self as ty, TyCtxt};
|
||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
use rustc_span::Span;
|
|
||||||
use rustc_span::{def_id::DefId, MultiSpan};
|
use rustc_span::{def_id::DefId, MultiSpan};
|
||||||
|
|
||||||
|
use GenericArgsInfo::*;
|
||||||
|
|
||||||
/// Handles the `wrong number of type / lifetime / ... arguments` family of error messages.
|
/// Handles the `wrong number of type / lifetime / ... arguments` family of error messages.
|
||||||
pub struct WrongNumberOfGenericArgs<'a, 'tcx> {
|
pub struct WrongNumberOfGenericArgs<'a, 'tcx> {
|
||||||
crate tcx: TyCtxt<'tcx>,
|
crate tcx: TyCtxt<'tcx>,
|
||||||
|
|
||||||
/// "type", "lifetime" etc., put verbatim into the message
|
crate angle_brackets: AngleBrackets,
|
||||||
crate kind: &'static str,
|
|
||||||
|
|
||||||
/// Minimum number of expected generic arguments (e.g. `2` for `HashMap`)
|
crate gen_args_info: GenericArgsInfo,
|
||||||
crate expected_min: usize,
|
|
||||||
|
|
||||||
/// Maximum number of expected generic arguments (e.g. `3` for `HashMap`)
|
|
||||||
crate expected_max: usize,
|
|
||||||
|
|
||||||
/// Number of generic arguments provided by the user
|
|
||||||
crate provided: usize,
|
|
||||||
|
|
||||||
/// Offset into `gen_params` - depends on the `kind`; might be different than `args_offset` when
|
|
||||||
/// user passed e.g. more arguments than was actually expected
|
|
||||||
crate params_offset: usize,
|
|
||||||
|
|
||||||
/// Offset into `gen_args` - depends on the `kind`
|
|
||||||
crate args_offset: usize,
|
|
||||||
|
|
||||||
/// Offending path segment
|
/// Offending path segment
|
||||||
crate path_segment: &'a hir::PathSegment<'a>,
|
crate path_segment: &'a hir::PathSegment<'a>,
|
||||||
|
@ -36,64 +22,348 @@ pub struct WrongNumberOfGenericArgs<'a, 'tcx> {
|
||||||
/// Generic parameters as expected by type or trait
|
/// Generic parameters as expected by type or trait
|
||||||
crate gen_params: &'a ty::Generics,
|
crate gen_params: &'a ty::Generics,
|
||||||
|
|
||||||
|
/// Index offset into parameters. Depends on whether `Self` is included and on
|
||||||
|
/// number of lifetime parameters in case we're processing missing or redundant
|
||||||
|
/// type or constant arguments.
|
||||||
|
crate params_offset: usize,
|
||||||
|
|
||||||
/// Generic arguments as provided by user
|
/// Generic arguments as provided by user
|
||||||
crate gen_args: &'a hir::GenericArgs<'a>,
|
crate gen_args: &'a hir::GenericArgs<'a>,
|
||||||
|
|
||||||
/// DefId of the generic type
|
/// DefId of the generic type
|
||||||
crate def_id: DefId,
|
crate def_id: DefId,
|
||||||
|
|
||||||
/// Offending place where the generic type has been misused
|
|
||||||
crate span: Span,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> WrongNumberOfGenericArgs<'_, 'tcx> {
|
// Provides information about the kind of arguments that were provided for
|
||||||
fn quantifier_and_bound(&self) -> (&'static str, usize) {
|
// the PathSegment, for which missing generic arguments were detected
|
||||||
if self.expected_min == self.expected_max {
|
#[derive(Debug)]
|
||||||
("", self.expected_min)
|
pub(crate) enum AngleBrackets {
|
||||||
} else if self.provided < self.expected_min {
|
// No angle brackets were provided, but generic arguments exist in elided form
|
||||||
("at least ", self.expected_min)
|
Implied,
|
||||||
|
|
||||||
|
// No angle brackets were provided
|
||||||
|
Missing,
|
||||||
|
|
||||||
|
// Angle brackets are available, but missing some generic arguments
|
||||||
|
Available,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Information about the kind of arguments that are either missing or are unexpected
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum GenericArgsInfo {
|
||||||
|
MissingLifetimes {
|
||||||
|
num_missing_args: usize,
|
||||||
|
},
|
||||||
|
ExcessLifetimes {
|
||||||
|
num_redundant_args: usize,
|
||||||
|
},
|
||||||
|
MissingTypesOrConsts {
|
||||||
|
num_missing_args: usize,
|
||||||
|
|
||||||
|
// type or const generic arguments can have default values
|
||||||
|
num_default_params: usize,
|
||||||
|
|
||||||
|
// lifetime arguments precede type and const parameters, this
|
||||||
|
// field gives the number of generic lifetime arguments to let
|
||||||
|
// us infer the position of type and const generic arguments
|
||||||
|
// in the angle brackets
|
||||||
|
args_offset: usize,
|
||||||
|
},
|
||||||
|
|
||||||
|
ExcessTypesOrConsts {
|
||||||
|
num_redundant_args: usize,
|
||||||
|
|
||||||
|
// type or const generic arguments can have default values
|
||||||
|
num_default_params: usize,
|
||||||
|
|
||||||
|
// lifetime arguments precede type and const parameters, this
|
||||||
|
// field gives the number of generic lifetime arguments to let
|
||||||
|
// us infer the position of type and const generic arguments
|
||||||
|
// in the angle brackets
|
||||||
|
args_offset: usize,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
||||||
|
pub fn new(
|
||||||
|
tcx: TyCtxt<'tcx>,
|
||||||
|
gen_args_info: GenericArgsInfo,
|
||||||
|
path_segment: &'a hir::PathSegment<'_>,
|
||||||
|
gen_params: &'a ty::Generics,
|
||||||
|
params_offset: usize,
|
||||||
|
gen_args: &'a hir::GenericArgs<'a>,
|
||||||
|
def_id: DefId,
|
||||||
|
) -> Self {
|
||||||
|
let angle_brackets = if gen_args.is_empty() {
|
||||||
|
AngleBrackets::Missing
|
||||||
} else {
|
} else {
|
||||||
("at most ", self.expected_max)
|
if gen_args.span().is_none() {
|
||||||
|
AngleBrackets::Implied
|
||||||
|
} else {
|
||||||
|
AngleBrackets::Available
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Self {
|
||||||
|
tcx,
|
||||||
|
angle_brackets,
|
||||||
|
gen_args_info,
|
||||||
|
path_segment,
|
||||||
|
gen_params,
|
||||||
|
params_offset,
|
||||||
|
gen_args,
|
||||||
|
def_id,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn missing_lifetimes(&self) -> bool {
|
||||||
|
match self.gen_args_info {
|
||||||
|
MissingLifetimes { .. } | ExcessLifetimes { .. } => true,
|
||||||
|
MissingTypesOrConsts { .. } | ExcessTypesOrConsts { .. } => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn kind(&self) -> String {
|
||||||
|
if self.missing_lifetimes() { "lifetime".to_string() } else { "generic".to_string() }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn num_provided_args(&self) -> usize {
|
||||||
|
if self.missing_lifetimes() {
|
||||||
|
self.num_provided_lifetime_args()
|
||||||
|
} else {
|
||||||
|
self.num_provided_type_or_const_args()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn num_provided_lifetime_args(&self) -> usize {
|
||||||
|
match self.angle_brackets {
|
||||||
|
AngleBrackets::Missing => 0,
|
||||||
|
// Only lifetime arguments can be implied
|
||||||
|
AngleBrackets::Implied => self.gen_args.args.len(),
|
||||||
|
AngleBrackets::Available => self.gen_args.args.iter().fold(0, |acc, arg| match arg {
|
||||||
|
hir::GenericArg::Lifetime(_) => acc + 1,
|
||||||
|
_ => acc,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn num_provided_type_or_const_args(&self) -> usize {
|
||||||
|
match self.angle_brackets {
|
||||||
|
AngleBrackets::Missing => 0,
|
||||||
|
// Only lifetime arguments can be implied
|
||||||
|
AngleBrackets::Implied => 0,
|
||||||
|
AngleBrackets::Available => self.gen_args.args.iter().fold(0, |acc, arg| match arg {
|
||||||
|
hir::GenericArg::Type(_) | hir::GenericArg::Const(_) => acc + 1,
|
||||||
|
_ => acc,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn num_expected_lifetime_args(&self) -> usize {
|
||||||
|
let num_provided_args = self.num_provided_lifetime_args();
|
||||||
|
match self.gen_args_info {
|
||||||
|
MissingLifetimes { num_missing_args } => num_provided_args + num_missing_args,
|
||||||
|
ExcessLifetimes { num_redundant_args } => num_provided_args - num_redundant_args,
|
||||||
|
_ => 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn num_expected_type_or_const_args(&self) -> usize {
|
||||||
|
let num_provided_args = self.num_provided_type_or_const_args();
|
||||||
|
match self.gen_args_info {
|
||||||
|
MissingTypesOrConsts { num_missing_args, .. } => num_provided_args + num_missing_args,
|
||||||
|
ExcessTypesOrConsts { num_redundant_args, .. } => {
|
||||||
|
num_provided_args - num_redundant_args
|
||||||
|
}
|
||||||
|
_ => 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gives the number of expected arguments taking into account default arguments
|
||||||
|
fn num_expected_type_or_const_args_including_defaults(&self) -> usize {
|
||||||
|
let provided_args = self.num_provided_type_or_const_args();
|
||||||
|
match self.gen_args_info {
|
||||||
|
MissingTypesOrConsts { num_missing_args, num_default_params, .. } => {
|
||||||
|
provided_args + num_missing_args - num_default_params
|
||||||
|
}
|
||||||
|
ExcessTypesOrConsts { num_redundant_args, num_default_params, .. } => {
|
||||||
|
provided_args - num_redundant_args - num_default_params
|
||||||
|
}
|
||||||
|
_ => 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn num_missing_lifetime_args(&self) -> usize {
|
||||||
|
let missing_args = self.num_expected_lifetime_args() - self.num_provided_lifetime_args();
|
||||||
|
assert!(missing_args > 0);
|
||||||
|
missing_args
|
||||||
|
}
|
||||||
|
|
||||||
|
fn num_missing_type_or_const_args(&self) -> usize {
|
||||||
|
let missing_args = self.num_expected_type_or_const_args_including_defaults()
|
||||||
|
- self.num_provided_type_or_const_args();
|
||||||
|
assert!(missing_args > 0);
|
||||||
|
missing_args
|
||||||
|
}
|
||||||
|
|
||||||
|
fn num_excess_lifetime_args(&self) -> usize {
|
||||||
|
match self.gen_args_info {
|
||||||
|
ExcessLifetimes { num_redundant_args } => num_redundant_args,
|
||||||
|
_ => 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn num_excess_type_or_const_args(&self) -> usize {
|
||||||
|
match self.gen_args_info {
|
||||||
|
ExcessTypesOrConsts { num_redundant_args, .. } => num_redundant_args,
|
||||||
|
_ => 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn too_many_args_provided(&self) -> bool {
|
||||||
|
match self.gen_args_info {
|
||||||
|
MissingLifetimes { .. } | MissingTypesOrConsts { .. } => false,
|
||||||
|
ExcessLifetimes { num_redundant_args }
|
||||||
|
| ExcessTypesOrConsts { num_redundant_args, .. } => {
|
||||||
|
assert!(num_redundant_args > 0);
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn not_enough_args_provided(&self) -> bool {
|
||||||
|
match self.gen_args_info {
|
||||||
|
MissingLifetimes { num_missing_args }
|
||||||
|
| MissingTypesOrConsts { num_missing_args, .. } => {
|
||||||
|
assert!(num_missing_args > 0);
|
||||||
|
true
|
||||||
|
}
|
||||||
|
ExcessLifetimes { .. } | ExcessTypesOrConsts { .. } => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper method to get the index offset in angle brackets, at which type or const arguments
|
||||||
|
// start appearing
|
||||||
|
fn get_lifetime_args_offset(&self) -> usize {
|
||||||
|
match self.gen_args_info {
|
||||||
|
MissingLifetimes { .. } | ExcessLifetimes { .. } => 0,
|
||||||
|
MissingTypesOrConsts { args_offset, .. } | ExcessTypesOrConsts { args_offset, .. } => {
|
||||||
|
args_offset
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_num_default_params(&self) -> usize {
|
||||||
|
match self.gen_args_info {
|
||||||
|
MissingTypesOrConsts { num_default_params, .. }
|
||||||
|
| ExcessTypesOrConsts { num_default_params, .. } => num_default_params,
|
||||||
|
_ => 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper function to choose a quantifier word for the number of expected arguments
|
||||||
|
// and to give a bound for the number of expected arguments
|
||||||
|
fn get_quantifier_and_bound(&self) -> (&'static str, usize) {
|
||||||
|
if self.get_num_default_params() == 0 {
|
||||||
|
match self.gen_args_info {
|
||||||
|
MissingLifetimes { .. } | ExcessLifetimes { .. } => {
|
||||||
|
("", self.num_expected_lifetime_args())
|
||||||
|
}
|
||||||
|
MissingTypesOrConsts { .. } | ExcessTypesOrConsts { .. } => {
|
||||||
|
("", self.num_expected_type_or_const_args())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
match self.gen_args_info {
|
||||||
|
MissingLifetimes { .. } => ("at least ", self.num_expected_lifetime_args()),
|
||||||
|
MissingTypesOrConsts { .. } => {
|
||||||
|
("at least ", self.num_expected_type_or_const_args_including_defaults())
|
||||||
|
}
|
||||||
|
ExcessLifetimes { .. } => ("at most ", self.num_expected_lifetime_args()),
|
||||||
|
ExcessTypesOrConsts { .. } => ("at most ", self.num_expected_type_or_const_args()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creates lifetime name suggestions from the lifetime parameter names
|
||||||
|
fn get_lifetime_args_suggestions_from_param_names(&self, num_params_to_take: usize) -> String {
|
||||||
|
self.gen_params
|
||||||
|
.params
|
||||||
|
.iter()
|
||||||
|
.skip(self.params_offset + self.num_provided_lifetime_args())
|
||||||
|
.take(num_params_to_take)
|
||||||
|
.map(|param| param.name.to_string())
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join(", ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creates type or constant name suggestions from the provided parameter names
|
||||||
|
fn get_type_or_const_args_suggestions_from_param_names(
|
||||||
|
&self,
|
||||||
|
num_params_to_take: usize,
|
||||||
|
) -> String {
|
||||||
|
self.gen_params
|
||||||
|
.params
|
||||||
|
.iter()
|
||||||
|
.skip(self.params_offset + self.num_provided_type_or_const_args())
|
||||||
|
.take(num_params_to_take)
|
||||||
|
.map(|param| param.name.to_string())
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join(", ")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn create_error_message(&self) -> String {
|
||||||
|
let def_path = self.tcx.def_path_str(self.def_id);
|
||||||
|
let def_kind = self.tcx.def_kind(self.def_id).descr(self.def_id);
|
||||||
|
let (quantifier, bound) = self.get_quantifier_and_bound();
|
||||||
|
let kind = self.kind();
|
||||||
|
let provided_lt_args = self.num_provided_lifetime_args();
|
||||||
|
let provided_type_or_const_args = self.num_provided_type_or_const_args();
|
||||||
|
|
||||||
|
let get_verb = |num_args| if num_args == 1 { "was" } else { "were" };
|
||||||
|
|
||||||
|
let (provided_args_str, verb) = match self.gen_args_info {
|
||||||
|
MissingLifetimes { .. } | ExcessLifetimes { .. } => (
|
||||||
|
format!("{} lifetime argument{}", provided_lt_args, pluralize!(provided_lt_args)),
|
||||||
|
get_verb(provided_lt_args),
|
||||||
|
),
|
||||||
|
MissingTypesOrConsts { .. } | ExcessTypesOrConsts { .. } => (
|
||||||
|
format!(
|
||||||
|
"{} generic argument{}",
|
||||||
|
provided_type_or_const_args,
|
||||||
|
pluralize!(provided_type_or_const_args)
|
||||||
|
),
|
||||||
|
get_verb(provided_type_or_const_args),
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
|
if self.gen_args.span().is_some() {
|
||||||
|
format!(
|
||||||
|
"this {} takes {}{} {} argument{} but {} {} supplied",
|
||||||
|
def_kind,
|
||||||
|
quantifier,
|
||||||
|
bound,
|
||||||
|
kind,
|
||||||
|
pluralize!(bound),
|
||||||
|
provided_args_str.as_str(),
|
||||||
|
verb
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
format!("missing generics for {} `{}`", def_kind, def_path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start_diagnostics(&self) -> DiagnosticBuilder<'tcx> {
|
fn start_diagnostics(&self) -> DiagnosticBuilder<'tcx> {
|
||||||
let span = self.path_segment.ident.span;
|
let span = self.path_segment.ident.span;
|
||||||
|
let msg = self.create_error_message();
|
||||||
let msg = {
|
|
||||||
let def_path = self.tcx.def_path_str(self.def_id);
|
|
||||||
let def_kind = self.tcx.def_kind(self.def_id).descr(self.def_id);
|
|
||||||
let (quantifier, bound) = self.quantifier_and_bound();
|
|
||||||
|
|
||||||
if self.gen_args.span().is_some() {
|
|
||||||
format!(
|
|
||||||
"this {} takes {}{} {} argument{} but {}{} {} argument{} {} supplied",
|
|
||||||
def_kind,
|
|
||||||
quantifier,
|
|
||||||
bound,
|
|
||||||
self.kind,
|
|
||||||
pluralize!(bound),
|
|
||||||
if self.provided > 0 && self.provided < self.expected_min {
|
|
||||||
"only "
|
|
||||||
} else {
|
|
||||||
""
|
|
||||||
},
|
|
||||||
self.provided,
|
|
||||||
self.kind,
|
|
||||||
pluralize!(self.provided),
|
|
||||||
if self.provided == 1 { "was" } else { "were" },
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
format!("missing generics for {} `{}`", def_kind, def_path)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
self.tcx.sess.struct_span_err_with_code(span, &msg, self.code())
|
self.tcx.sess.struct_span_err_with_code(span, &msg, self.code())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builds the `expected 1 type argument / supplied 2 type arguments` message.
|
/// Builds the `expected 1 type argument / supplied 2 type arguments` message.
|
||||||
fn notify(&self, err: &mut DiagnosticBuilder<'_>) {
|
fn notify(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||||
let (quantifier, bound) = self.quantifier_and_bound();
|
let (quantifier, bound) = self.get_quantifier_and_bound();
|
||||||
|
let provided_args = self.num_provided_args();
|
||||||
|
|
||||||
err.span_label(
|
err.span_label(
|
||||||
self.path_segment.ident.span,
|
self.path_segment.ident.span,
|
||||||
|
@ -101,12 +371,12 @@ impl<'tcx> WrongNumberOfGenericArgs<'_, 'tcx> {
|
||||||
"expected {}{} {} argument{}",
|
"expected {}{} {} argument{}",
|
||||||
quantifier,
|
quantifier,
|
||||||
bound,
|
bound,
|
||||||
self.kind,
|
self.kind(),
|
||||||
pluralize!(bound),
|
pluralize!(bound),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
// When user's provided too many arguments, we don't highlight each of them, because it
|
// When too many arguments were provided, we don't highlight each of them, because it
|
||||||
// would overlap with the suggestion to remove them:
|
// would overlap with the suggestion to remove them:
|
||||||
//
|
//
|
||||||
// ```
|
// ```
|
||||||
|
@ -114,21 +384,27 @@ impl<'tcx> WrongNumberOfGenericArgs<'_, 'tcx> {
|
||||||
// ----- ----- supplied 2 type arguments
|
// ----- ----- supplied 2 type arguments
|
||||||
// ^^^^^^^ remove this type argument
|
// ^^^^^^^ remove this type argument
|
||||||
// ```
|
// ```
|
||||||
if self.provided > self.expected_max {
|
if self.too_many_args_provided() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let args = self.gen_args.args.iter().skip(self.args_offset).take(self.provided).enumerate();
|
let args = self
|
||||||
|
.gen_args
|
||||||
|
.args
|
||||||
|
.iter()
|
||||||
|
.skip(self.get_lifetime_args_offset())
|
||||||
|
.take(provided_args)
|
||||||
|
.enumerate();
|
||||||
|
|
||||||
for (i, arg) in args {
|
for (i, arg) in args {
|
||||||
err.span_label(
|
err.span_label(
|
||||||
arg.span(),
|
arg.span(),
|
||||||
if i + 1 == self.provided {
|
if i + 1 == provided_args {
|
||||||
format!(
|
format!(
|
||||||
"supplied {} {} argument{}",
|
"supplied {} {} argument{}",
|
||||||
self.provided,
|
provided_args,
|
||||||
self.kind,
|
self.kind(),
|
||||||
pluralize!(self.provided)
|
pluralize!(provided_args)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
String::new()
|
String::new()
|
||||||
|
@ -138,56 +414,24 @@ impl<'tcx> WrongNumberOfGenericArgs<'_, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn suggest(&self, err: &mut DiagnosticBuilder<'_>) {
|
fn suggest(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||||
if self.provided == 0 {
|
debug!(
|
||||||
if self.gen_args.span().is_some() {
|
"suggest(self.provided {:?}, self.gen_args.span(): {:?})",
|
||||||
|
self.num_provided_args(),
|
||||||
|
self.gen_args.span(),
|
||||||
|
);
|
||||||
|
|
||||||
|
match self.angle_brackets {
|
||||||
|
AngleBrackets::Missing | AngleBrackets::Implied => self.suggest_adding_args(err),
|
||||||
|
AngleBrackets::Available => {
|
||||||
|
if self.not_enough_args_provided() {
|
||||||
self.suggest_adding_args(err);
|
self.suggest_adding_args(err);
|
||||||
} else {
|
} else if self.too_many_args_provided() {
|
||||||
self.suggest_creating_generics(err);
|
|
||||||
}
|
|
||||||
} else if self.provided < self.expected_min {
|
|
||||||
self.suggest_adding_args(err);
|
|
||||||
} else {
|
|
||||||
self.suggest_removing_args_or_generics(err);
|
self.suggest_removing_args_or_generics(err);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Suggests to create generics (`<...>`) when current invocation site contains no generics at
|
|
||||||
/// all:
|
|
||||||
///
|
|
||||||
/// ```text
|
|
||||||
/// type Map = HashMap;
|
|
||||||
/// ```
|
|
||||||
fn suggest_creating_generics(&self, err: &mut DiagnosticBuilder<'_>) {
|
|
||||||
let params = self
|
|
||||||
.gen_params
|
|
||||||
.params
|
|
||||||
.iter()
|
|
||||||
.skip(self.params_offset)
|
|
||||||
.take(self.expected_min)
|
|
||||||
.map(|param| param.name.to_string())
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
.join(", ");
|
|
||||||
|
|
||||||
let def_kind = self.tcx.def_kind(self.def_id);
|
|
||||||
|
|
||||||
let sugg = if matches!(def_kind, DefKind::Fn | DefKind::AssocFn) {
|
|
||||||
format!("::<{}>", params)
|
|
||||||
} else {
|
} else {
|
||||||
format!("<{}>", params)
|
unreachable!();
|
||||||
};
|
}
|
||||||
|
}
|
||||||
let msg = format!(
|
}
|
||||||
"use angle brackets to add missing {} argument{}",
|
|
||||||
self.kind,
|
|
||||||
pluralize!(self.expected_min),
|
|
||||||
);
|
|
||||||
|
|
||||||
err.span_suggestion_verbose(
|
|
||||||
self.path_segment.ident.span.shrink_to_hi(),
|
|
||||||
&msg,
|
|
||||||
sugg,
|
|
||||||
Applicability::HasPlaceholders,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Suggests to add missing argument(s) when current invocation site already contains some
|
/// Suggests to add missing argument(s) when current invocation site already contains some
|
||||||
|
@ -197,52 +441,260 @@ impl<'tcx> WrongNumberOfGenericArgs<'_, 'tcx> {
|
||||||
/// type Map = HashMap<String>;
|
/// type Map = HashMap<String>;
|
||||||
/// ```
|
/// ```
|
||||||
fn suggest_adding_args(&self, err: &mut DiagnosticBuilder<'_>) {
|
fn suggest_adding_args(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||||
assert!(!self.gen_args.is_empty());
|
|
||||||
|
|
||||||
if self.gen_args.parenthesized {
|
if self.gen_args.parenthesized {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let missing_arg_count = self.expected_min - self.provided;
|
match self.gen_args_info {
|
||||||
|
MissingLifetimes { .. } => {
|
||||||
|
self.suggest_adding_lifetime_args(err);
|
||||||
|
}
|
||||||
|
MissingTypesOrConsts { .. } => {
|
||||||
|
self.suggest_adding_type_and_const_args(err);
|
||||||
|
}
|
||||||
|
_ => unreachable!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let (span, sugg_prefix) = if self.args_offset + self.provided == 0 {
|
fn suggest_adding_lifetime_args(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||||
let span = self.gen_args.args[0].span().shrink_to_lo();
|
debug!("suggest_adding_lifetime_args(path_segment: {:?})", self.path_segment);
|
||||||
(span, "")
|
let num_missing_args = self.num_missing_lifetime_args();
|
||||||
|
let num_params_to_take = num_missing_args;
|
||||||
|
let msg = format!("add missing {} argument{}", self.kind(), pluralize!(num_missing_args));
|
||||||
|
|
||||||
|
// we first try to get lifetime name suggestions from scope or elision information. If none is
|
||||||
|
// available we use the parameter defintions
|
||||||
|
let suggested_args = if let Some(hir_id) = self.path_segment.hir_id {
|
||||||
|
if let Some(lifetimes_in_scope) = self.tcx.lifetime_scope(hir_id) {
|
||||||
|
match lifetimes_in_scope {
|
||||||
|
LifetimeScopeForPath::NonElided(param_names) => {
|
||||||
|
debug!("NonElided(param_names: {:?})", param_names);
|
||||||
|
|
||||||
|
if param_names.len() >= num_params_to_take {
|
||||||
|
// use lifetime parameters in scope for suggestions
|
||||||
|
param_names
|
||||||
|
.iter()
|
||||||
|
.take(num_params_to_take)
|
||||||
|
.map(|p| (*p).clone())
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join(", ")
|
||||||
} else {
|
} else {
|
||||||
let span =
|
// Not enough lifetime arguments in scope -> create suggestions from
|
||||||
self.gen_args.args[self.args_offset + self.provided - 1].span().shrink_to_hi();
|
// lifetime parameter names in definition. An error for the incorrect
|
||||||
(span, ", ")
|
// lifetime scope will be output later.
|
||||||
|
self.get_lifetime_args_suggestions_from_param_names(num_params_to_take)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LifetimeScopeForPath::Elided => {
|
||||||
|
debug!("Elided");
|
||||||
|
// use suggestions of the form `<'_, '_>` in case lifetime can be elided
|
||||||
|
["'_"].repeat(num_params_to_take).join(",")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self.get_lifetime_args_suggestions_from_param_names(num_params_to_take)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self.get_lifetime_args_suggestions_from_param_names(num_params_to_take)
|
||||||
};
|
};
|
||||||
|
|
||||||
let msg = format!("add missing {} argument{}", self.kind, pluralize!(missing_arg_count));
|
debug!("suggested_args: {:?}", &suggested_args);
|
||||||
|
|
||||||
let sugg = self
|
match self.angle_brackets {
|
||||||
.gen_params
|
AngleBrackets::Missing => {
|
||||||
.params
|
let span = self.path_segment.ident.span;
|
||||||
.iter()
|
|
||||||
.skip(self.params_offset + self.provided)
|
|
||||||
.take(missing_arg_count)
|
|
||||||
.map(|param| param.name.to_string())
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
.join(", ");
|
|
||||||
|
|
||||||
let sugg = format!("{}{}", sugg_prefix, sugg);
|
// insert a suggestion of the form "Y<'a, 'b>"
|
||||||
|
let ident = self.path_segment.ident.name.to_ident_string();
|
||||||
|
let sugg = format!("{}<{}>", ident, suggested_args);
|
||||||
|
debug!("sugg: {:?}", sugg);
|
||||||
|
|
||||||
err.span_suggestion_verbose(span, &msg, sugg, Applicability::HasPlaceholders);
|
err.span_suggestion_verbose(span, &msg, sugg, Applicability::HasPlaceholders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AngleBrackets::Available => {
|
||||||
|
// angle brackets exist, so we insert missing arguments after the existing args
|
||||||
|
|
||||||
|
assert!(!self.gen_args.args.is_empty());
|
||||||
|
|
||||||
|
if self.num_provided_lifetime_args() > 0 {
|
||||||
|
let last_lt_arg_span = self.gen_args.args
|
||||||
|
[self.num_provided_lifetime_args() - 1]
|
||||||
|
.span()
|
||||||
|
.shrink_to_hi();
|
||||||
|
let source_map = self.tcx.sess.source_map();
|
||||||
|
|
||||||
|
if let Ok(last_gen_arg) = source_map.span_to_snippet(last_lt_arg_span) {
|
||||||
|
let sugg = format!("{}, {}", last_gen_arg, suggested_args);
|
||||||
|
|
||||||
|
err.span_suggestion_verbose(
|
||||||
|
last_lt_arg_span,
|
||||||
|
&msg,
|
||||||
|
sugg,
|
||||||
|
Applicability::HasPlaceholders,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Non-lifetime arguments included in `gen_args` -> insert missing lifetimes before
|
||||||
|
// existing arguments
|
||||||
|
let first_arg_span = self.gen_args.args[0].span().shrink_to_lo();
|
||||||
|
let source_map = self.tcx.sess.source_map();
|
||||||
|
|
||||||
|
if let Ok(first_gen_arg) = source_map.span_to_snippet(first_arg_span) {
|
||||||
|
let sugg = format!("{}, {}", suggested_args, first_gen_arg);
|
||||||
|
|
||||||
|
err.span_suggestion_verbose(
|
||||||
|
first_arg_span,
|
||||||
|
&msg,
|
||||||
|
sugg,
|
||||||
|
Applicability::HasPlaceholders,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AngleBrackets::Implied => {
|
||||||
|
// We never encounter missing lifetimes in situations in which lifetimes are elided
|
||||||
|
unreachable!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn suggest_adding_type_and_const_args(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||||
|
let num_missing_args = self.num_missing_type_or_const_args();
|
||||||
|
let msg = format!("add missing {} argument{}", self.kind(), pluralize!(num_missing_args));
|
||||||
|
|
||||||
|
let suggested_args =
|
||||||
|
self.get_type_or_const_args_suggestions_from_param_names(num_missing_args);
|
||||||
|
debug!("suggested_args: {:?}", suggested_args);
|
||||||
|
|
||||||
|
match self.angle_brackets {
|
||||||
|
AngleBrackets::Missing | AngleBrackets::Implied => {
|
||||||
|
let span = self.path_segment.ident.span;
|
||||||
|
|
||||||
|
// insert a suggestion of the form "Y<T, U>"
|
||||||
|
let ident = self.path_segment.ident.name.to_ident_string();
|
||||||
|
let sugg = format!("{}<{}>", ident, suggested_args);
|
||||||
|
debug!("sugg: {:?}", sugg);
|
||||||
|
|
||||||
|
err.span_suggestion_verbose(span, &msg, sugg, Applicability::HasPlaceholders);
|
||||||
|
}
|
||||||
|
AngleBrackets::Available => {
|
||||||
|
// angle brackets exist, so we just insert missing arguments after the existing
|
||||||
|
// type or const args
|
||||||
|
|
||||||
|
let index_last_provided_arg =
|
||||||
|
self.get_lifetime_args_offset() + self.num_provided_type_or_const_args() - 1;
|
||||||
|
if index_last_provided_arg < self.gen_args.args.len() {
|
||||||
|
let first_arg_span =
|
||||||
|
self.gen_args.args[index_last_provided_arg].span().shrink_to_hi();
|
||||||
|
let source_map = self.tcx.sess.source_map();
|
||||||
|
if let Ok(first_gen_arg) = source_map.span_to_snippet(first_arg_span) {
|
||||||
|
let sugg = format!("{}, {}", first_gen_arg, suggested_args);
|
||||||
|
debug!("sugg: {:?}", sugg);
|
||||||
|
|
||||||
|
err.span_suggestion_verbose(
|
||||||
|
first_arg_span,
|
||||||
|
&msg,
|
||||||
|
sugg,
|
||||||
|
Applicability::HasPlaceholders,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Suggests to remove redundant argument(s):
|
/// Suggests to remove redundant argument(s):
|
||||||
///
|
///
|
||||||
/// ```text
|
/// ```text
|
||||||
/// type Map = HashMap<String, String, String, String>;
|
/// type Map = HashMap<String, String, String, String>;
|
||||||
/// ```
|
/// ```
|
||||||
fn suggest_removing_args_or_generics(&self, err: &mut DiagnosticBuilder<'_>) {
|
fn suggest_removing_args_or_generics(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||||
assert!(self.provided > 0);
|
let num_provided_lt_args = self.num_provided_lifetime_args();
|
||||||
|
let num_provided_type_const_args = self.num_provided_type_or_const_args();
|
||||||
|
let num_provided_args = num_provided_lt_args + num_provided_type_const_args;
|
||||||
|
assert!(num_provided_args > 0);
|
||||||
|
|
||||||
let redundant_args_count = self.provided - self.expected_max;
|
let num_redundant_lt_args = self.num_excess_lifetime_args();
|
||||||
let remove_entire_generics = redundant_args_count >= self.gen_args.args.len();
|
let num_redundant_type_or_const_args = self.num_excess_type_or_const_args();
|
||||||
|
let num_redundant_args = num_redundant_lt_args + num_redundant_type_or_const_args;
|
||||||
|
|
||||||
let (span, msg) = if remove_entire_generics {
|
let redundant_lifetime_args = num_redundant_lt_args > 0;
|
||||||
|
let redundant_type_or_const_args = num_redundant_type_or_const_args > 0;
|
||||||
|
|
||||||
|
let remove_entire_generics = num_redundant_args >= self.gen_args.args.len();
|
||||||
|
|
||||||
|
let remove_lifetime_args = |err: &mut DiagnosticBuilder<'_>| {
|
||||||
|
let idx_first_redundant_lt_args = self.num_expected_lifetime_args();
|
||||||
|
let span_lo_redundant_lt_args =
|
||||||
|
self.gen_args.args[idx_first_redundant_lt_args].span().shrink_to_lo();
|
||||||
|
let span_hi_redundant_lt_args = self.gen_args.args
|
||||||
|
[idx_first_redundant_lt_args + num_redundant_lt_args - 1]
|
||||||
|
.span()
|
||||||
|
.shrink_to_hi();
|
||||||
|
let eat_comma =
|
||||||
|
idx_first_redundant_lt_args + num_redundant_lt_args - 1 != self.gen_args.args.len();
|
||||||
|
|
||||||
|
let span_redundant_lt_args = if eat_comma {
|
||||||
|
let span_hi = self.gen_args.args
|
||||||
|
[idx_first_redundant_lt_args + num_redundant_lt_args - 1]
|
||||||
|
.span()
|
||||||
|
.shrink_to_hi();
|
||||||
|
span_lo_redundant_lt_args.to(span_hi)
|
||||||
|
} else {
|
||||||
|
span_lo_redundant_lt_args.to(span_hi_redundant_lt_args)
|
||||||
|
};
|
||||||
|
debug!("span_redundant_lt_args: {:?}", span_redundant_lt_args);
|
||||||
|
|
||||||
|
let msg_lifetimes = format!(
|
||||||
|
"remove {} {} argument{}",
|
||||||
|
if num_redundant_args == 1 { "this" } else { "these" },
|
||||||
|
"lifetime",
|
||||||
|
pluralize!(num_redundant_lt_args),
|
||||||
|
);
|
||||||
|
|
||||||
|
err.span_suggestion(
|
||||||
|
span_redundant_lt_args,
|
||||||
|
&msg_lifetimes,
|
||||||
|
String::new(),
|
||||||
|
Applicability::MaybeIncorrect,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
let remove_type_or_const_args = |err: &mut DiagnosticBuilder<'_>| {
|
||||||
|
let idx_first_redundant_type_or_const_args = self.get_lifetime_args_offset()
|
||||||
|
+ num_redundant_lt_args
|
||||||
|
+ self.num_expected_type_or_const_args();
|
||||||
|
|
||||||
|
let span_lo_redundant_type_or_const_args =
|
||||||
|
self.gen_args.args[idx_first_redundant_type_or_const_args].span().shrink_to_lo();
|
||||||
|
|
||||||
|
let span_hi_redundant_type_or_const_args = self.gen_args.args
|
||||||
|
[idx_first_redundant_type_or_const_args + num_redundant_type_or_const_args - 1]
|
||||||
|
.span()
|
||||||
|
.shrink_to_hi();
|
||||||
|
|
||||||
|
let span_redundant_type_or_const_args =
|
||||||
|
span_lo_redundant_type_or_const_args.to(span_hi_redundant_type_or_const_args);
|
||||||
|
|
||||||
|
debug!("span_redundant_type_or_const_args: {:?}", span_redundant_type_or_const_args);
|
||||||
|
|
||||||
|
let msg_types_or_consts = format!(
|
||||||
|
"remove {} {} argument{}",
|
||||||
|
if num_redundant_args == 1 { "this" } else { "these" },
|
||||||
|
"generic",
|
||||||
|
pluralize!(num_redundant_type_or_const_args),
|
||||||
|
);
|
||||||
|
|
||||||
|
err.span_suggestion(
|
||||||
|
span_redundant_type_or_const_args,
|
||||||
|
&msg_types_or_consts,
|
||||||
|
String::new(),
|
||||||
|
Applicability::MaybeIncorrect,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
if remove_entire_generics {
|
||||||
let sm = self.tcx.sess.source_map();
|
let sm = self.tcx.sess.source_map();
|
||||||
|
|
||||||
let span = self
|
let span = self
|
||||||
|
@ -258,70 +710,16 @@ impl<'tcx> WrongNumberOfGenericArgs<'_, 'tcx> {
|
||||||
if self.gen_args.parenthesized { "parenthetical " } else { "" },
|
if self.gen_args.parenthesized { "parenthetical " } else { "" },
|
||||||
);
|
);
|
||||||
|
|
||||||
(span, msg)
|
|
||||||
} else {
|
|
||||||
// When it comes to removing particular argument(s) from the generics, there are two
|
|
||||||
// edge cases we have to consider:
|
|
||||||
//
|
|
||||||
// When the first redundant argument is at the beginning or in the middle of the
|
|
||||||
// generics, like so:
|
|
||||||
//
|
|
||||||
// ```
|
|
||||||
// type Map = HashMap<String, String, String, String>;
|
|
||||||
// ^^^^^^^^^^^^^^^^
|
|
||||||
// | span must start with the argument
|
|
||||||
// ```
|
|
||||||
//
|
|
||||||
// When the last redundant argument is at the ending of the generics, like so:
|
|
||||||
//
|
|
||||||
// ```
|
|
||||||
// type Map = HashMap<String, String, String, String>;
|
|
||||||
// ^^^^^^^^^^^^^^^^
|
|
||||||
// | span must start with the comma
|
|
||||||
// ```
|
|
||||||
|
|
||||||
// Index of the first redundant argument
|
|
||||||
let from_idx = self.args_offset + self.expected_max;
|
|
||||||
|
|
||||||
// Index of the last redundant argument
|
|
||||||
let to_idx = self.args_offset + self.provided - 1;
|
|
||||||
|
|
||||||
assert!(from_idx <= to_idx);
|
|
||||||
|
|
||||||
let (from, comma_eaten) = {
|
|
||||||
let first_argument_starts_generics = from_idx == 0;
|
|
||||||
let last_argument_ends_generics = to_idx + 1 == self.gen_args.args.len();
|
|
||||||
|
|
||||||
if !first_argument_starts_generics && last_argument_ends_generics {
|
|
||||||
(self.gen_args.args[from_idx - 1].span().hi(), true)
|
|
||||||
} else {
|
|
||||||
(self.gen_args.args[from_idx].span().lo(), false)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let to = {
|
|
||||||
let hi = self.gen_args.args[to_idx].span().hi();
|
|
||||||
|
|
||||||
if comma_eaten {
|
|
||||||
hi
|
|
||||||
} else {
|
|
||||||
self.gen_args.args.get(to_idx + 1).map(|arg| arg.span().lo()).unwrap_or(hi)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let span = Span::new(from, to, self.span.ctxt());
|
|
||||||
|
|
||||||
let msg = format!(
|
|
||||||
"remove {} {} argument{}",
|
|
||||||
if redundant_args_count == 1 { "this" } else { "these" },
|
|
||||||
self.kind,
|
|
||||||
pluralize!(redundant_args_count),
|
|
||||||
);
|
|
||||||
|
|
||||||
(span, msg)
|
|
||||||
};
|
|
||||||
|
|
||||||
err.span_suggestion(span, &msg, String::new(), Applicability::MaybeIncorrect);
|
err.span_suggestion(span, &msg, String::new(), Applicability::MaybeIncorrect);
|
||||||
|
} else if redundant_lifetime_args && redundant_type_or_const_args {
|
||||||
|
remove_lifetime_args(err);
|
||||||
|
remove_type_or_const_args(err);
|
||||||
|
} else if redundant_lifetime_args {
|
||||||
|
remove_lifetime_args(err);
|
||||||
|
} else {
|
||||||
|
assert!(redundant_type_or_const_args);
|
||||||
|
remove_type_or_const_args(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builds the `type defined here` message.
|
/// Builds the `type defined here` message.
|
||||||
|
@ -334,7 +732,7 @@ impl<'tcx> WrongNumberOfGenericArgs<'_, 'tcx> {
|
||||||
|
|
||||||
let msg = {
|
let msg = {
|
||||||
let def_kind = self.tcx.def_kind(self.def_id).descr(self.def_id);
|
let def_kind = self.tcx.def_kind(self.def_id).descr(self.def_id);
|
||||||
let (quantifier, bound) = self.quantifier_and_bound();
|
let (quantifier, bound) = self.get_quantifier_and_bound();
|
||||||
|
|
||||||
let params = if bound == 0 {
|
let params = if bound == 0 {
|
||||||
String::new()
|
String::new()
|
||||||
|
@ -362,7 +760,7 @@ impl<'tcx> WrongNumberOfGenericArgs<'_, 'tcx> {
|
||||||
def_kind,
|
def_kind,
|
||||||
quantifier,
|
quantifier,
|
||||||
bound,
|
bound,
|
||||||
self.kind,
|
self.kind(),
|
||||||
pluralize!(bound),
|
pluralize!(bound),
|
||||||
params,
|
params,
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// edition:2018
|
// edition:2018
|
||||||
|
|
||||||
async fn copy() -> Result<()>
|
async fn copy() -> Result<()>
|
||||||
//~^ ERROR this enum takes 2 type arguments but only 1 type argument was supplied
|
//~^ ERROR this enum takes 2 generic arguments
|
||||||
{
|
{
|
||||||
Ok(())
|
Ok(())
|
||||||
//~^ ERROR type annotations needed
|
//~^ ERROR type annotations needed
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
error[E0107]: this enum takes 2 type arguments but only 1 type argument was supplied
|
error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/issue-65159.rs:5:20
|
--> $DIR/issue-65159.rs:5:20
|
||||||
|
|
|
|
||||||
LL | async fn copy() -> Result<()>
|
LL | async fn copy() -> Result<()>
|
||||||
| ^^^^^^ -- supplied 1 type argument
|
| ^^^^^^ -- supplied 1 generic argument
|
||||||
| |
|
| |
|
||||||
| expected 2 type arguments
|
| expected 2 generic arguments
|
||||||
|
|
|
|
||||||
note: enum defined here, with 2 type parameters: `T`, `E`
|
note: enum defined here, with 2 generic parameters: `T`, `E`
|
||||||
--> $SRC_DIR/core/src/result.rs:LL:COL
|
--> $SRC_DIR/core/src/result.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub enum Result<T, E> {
|
LL | pub enum Result<T, E> {
|
||||||
| ^^^^^^ - -
|
| ^^^^^^ - -
|
||||||
help: add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | async fn copy() -> Result<(), E>
|
LL | async fn copy() -> Result<(), E>
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
@ -15,7 +15,7 @@ impl MarketMultiplier {
|
||||||
|
|
||||||
async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
|
async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
|
||||||
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
|
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
|
||||||
//~^^ ERROR this struct takes 1 type argument but 0 type arguments were supplied
|
//~^^ ERROR this struct takes 1 generic argument but 0 generic arguments were supplied
|
||||||
LockedMarket(generator.lock().unwrap().buy())
|
LockedMarket(generator.lock().unwrap().buy())
|
||||||
//~^ ERROR cannot return value referencing temporary value
|
//~^ ERROR cannot return value referencing temporary value
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,18 +12,18 @@ note: struct defined here, with 0 lifetime parameters
|
||||||
LL | struct LockedMarket<T>(T);
|
LL | struct LockedMarket<T>(T);
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0107]: this struct takes 1 type argument but 0 type arguments were supplied
|
error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied
|
||||||
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
|
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
|
||||||
|
|
|
|
||||||
LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
|
LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
|
||||||
| ^^^^^^^^^^^^ expected 1 type argument
|
| ^^^^^^^^^^^^ expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: struct defined here, with 1 type parameter: `T`
|
note: struct defined here, with 1 generic parameter: `T`
|
||||||
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:23:8
|
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:23:8
|
||||||
|
|
|
|
||||||
LL | struct LockedMarket<T>(T);
|
LL | struct LockedMarket<T>(T);
|
||||||
| ^^^^^^^^^^^^ -
|
| ^^^^^^^^^^^^ -
|
||||||
help: add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_, T> {
|
LL | async fn buy_lock(generator: &Mutex<MarketMultiplier>) -> LockedMarket<'_, T> {
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
error[E0107]: this function takes 2 const arguments but only 1 const argument was supplied
|
error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/incorrect-number-of-const-args.rs:11:5
|
--> $DIR/incorrect-number-of-const-args.rs:11:5
|
||||||
|
|
|
|
||||||
LL | foo::<0>();
|
LL | foo::<0>();
|
||||||
| ^^^ - supplied 1 const argument
|
| ^^^ - supplied 1 generic argument
|
||||||
| |
|
| |
|
||||||
| expected 2 const arguments
|
| expected 2 generic arguments
|
||||||
|
|
|
|
||||||
note: function defined here, with 2 const parameters: `X`, `Y`
|
note: function defined here, with 2 generic parameters: `X`, `Y`
|
||||||
--> $DIR/incorrect-number-of-const-args.rs:6:4
|
--> $DIR/incorrect-number-of-const-args.rs:6:4
|
||||||
|
|
|
|
||||||
LL | fn foo<const X: usize, const Y: usize>() -> usize {
|
LL | fn foo<const X: usize, const Y: usize>() -> usize {
|
||||||
| ^^^ - -
|
| ^^^ - -
|
||||||
help: add missing const argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | foo::<0, Y>();
|
LL | foo::<0, Y>();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error[E0107]: this function takes 2 const arguments but 3 const arguments were supplied
|
error[E0107]: this function takes 2 generic arguments but 3 generic arguments were supplied
|
||||||
--> $DIR/incorrect-number-of-const-args.rs:14:5
|
--> $DIR/incorrect-number-of-const-args.rs:14:5
|
||||||
|
|
|
|
||||||
LL | foo::<0, 0, 0>();
|
LL | foo::<0, 0, 0>();
|
||||||
| ^^^ --- help: remove this const argument
|
| ^^^ - help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected 2 const arguments
|
| expected 2 generic arguments
|
||||||
|
|
|
|
||||||
note: function defined here, with 2 const parameters: `X`, `Y`
|
note: function defined here, with 2 generic parameters: `X`, `Y`
|
||||||
--> $DIR/incorrect-number-of-const-args.rs:6:4
|
--> $DIR/incorrect-number-of-const-args.rs:6:4
|
||||||
|
|
|
|
||||||
LL | fn foo<const X: usize, const Y: usize>() -> usize {
|
LL | fn foo<const X: usize, const Y: usize>() -> usize {
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
error[E0107]: this function takes 2 const arguments but only 1 const argument was supplied
|
error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/incorrect-number-of-const-args.rs:11:5
|
--> $DIR/incorrect-number-of-const-args.rs:11:5
|
||||||
|
|
|
|
||||||
LL | foo::<0>();
|
LL | foo::<0>();
|
||||||
| ^^^ - supplied 1 const argument
|
| ^^^ - supplied 1 generic argument
|
||||||
| |
|
| |
|
||||||
| expected 2 const arguments
|
| expected 2 generic arguments
|
||||||
|
|
|
|
||||||
note: function defined here, with 2 const parameters: `X`, `Y`
|
note: function defined here, with 2 generic parameters: `X`, `Y`
|
||||||
--> $DIR/incorrect-number-of-const-args.rs:6:4
|
--> $DIR/incorrect-number-of-const-args.rs:6:4
|
||||||
|
|
|
|
||||||
LL | fn foo<const X: usize, const Y: usize>() -> usize {
|
LL | fn foo<const X: usize, const Y: usize>() -> usize {
|
||||||
| ^^^ - -
|
| ^^^ - -
|
||||||
help: add missing const argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | foo::<0, Y>();
|
LL | foo::<0, Y>();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error[E0107]: this function takes 2 const arguments but 3 const arguments were supplied
|
error[E0107]: this function takes 2 generic arguments but 3 generic arguments were supplied
|
||||||
--> $DIR/incorrect-number-of-const-args.rs:14:5
|
--> $DIR/incorrect-number-of-const-args.rs:14:5
|
||||||
|
|
|
|
||||||
LL | foo::<0, 0, 0>();
|
LL | foo::<0, 0, 0>();
|
||||||
| ^^^ --- help: remove this const argument
|
| ^^^ - help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected 2 const arguments
|
| expected 2 generic arguments
|
||||||
|
|
|
|
||||||
note: function defined here, with 2 const parameters: `X`, `Y`
|
note: function defined here, with 2 generic parameters: `X`, `Y`
|
||||||
--> $DIR/incorrect-number-of-const-args.rs:6:4
|
--> $DIR/incorrect-number-of-const-args.rs:6:4
|
||||||
|
|
|
|
||||||
LL | fn foo<const X: usize, const Y: usize>() -> usize {
|
LL | fn foo<const X: usize, const Y: usize>() -> usize {
|
||||||
|
|
|
@ -9,8 +9,8 @@ fn foo<const X: usize, const Y: usize>() -> usize {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
foo::<0>();
|
foo::<0>();
|
||||||
//~^ ERROR this function takes 2 const arguments but only 1 const argument was supplied
|
//~^ ERROR this function takes 2
|
||||||
|
|
||||||
foo::<0, 0, 0>();
|
foo::<0, 0, 0>();
|
||||||
//~^ ERROR this function takes 2 const arguments but 3 const arguments were supplied
|
//~^ ERROR this function takes 2
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,11 @@ struct S;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _: u32 = 5i32.try_into::<32>().unwrap();
|
let _: u32 = 5i32.try_into::<32>().unwrap();
|
||||||
//~^ ERROR this associated function takes 0 const arguments but 1 const argument was supplied
|
//~^ ERROR this associated function takes
|
||||||
|
|
||||||
S.f::<0>();
|
S.f::<0>();
|
||||||
//~^ ERROR no method named `f`
|
//~^ ERROR no method named `f`
|
||||||
|
|
||||||
S::<0>;
|
S::<0>;
|
||||||
//~^ ERROR this struct takes 0 const arguments but 1 const argument was supplied
|
//~^ ERROR this struct takes 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
error[E0107]: this associated function takes 0 const arguments but 1 const argument was supplied
|
error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/invalid-const-arg-for-type-param.rs:6:23
|
--> $DIR/invalid-const-arg-for-type-param.rs:6:23
|
||||||
|
|
|
|
||||||
LL | let _: u32 = 5i32.try_into::<32>().unwrap();
|
LL | let _: u32 = 5i32.try_into::<32>().unwrap();
|
||||||
| ^^^^^^^^------ help: remove these generics
|
| ^^^^^^^^------ help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 const arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: associated function defined here, with 0 const parameters
|
note: associated function defined here, with 0 generic parameters
|
||||||
--> $SRC_DIR/core/src/convert/mod.rs:LL:COL
|
--> $SRC_DIR/core/src/convert/mod.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | fn try_into(self) -> Result<T, Self::Error>;
|
LL | fn try_into(self) -> Result<T, Self::Error>;
|
||||||
|
@ -21,15 +21,15 @@ LL | struct S;
|
||||||
LL | S.f::<0>();
|
LL | S.f::<0>();
|
||||||
| ^ method not found in `S`
|
| ^ method not found in `S`
|
||||||
|
|
||||||
error[E0107]: this struct takes 0 const arguments but 1 const argument was supplied
|
error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/invalid-const-arg-for-type-param.rs:12:5
|
--> $DIR/invalid-const-arg-for-type-param.rs:12:5
|
||||||
|
|
|
|
||||||
LL | S::<0>;
|
LL | S::<0>;
|
||||||
| ^----- help: remove these generics
|
| ^----- help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 const arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with 0 const parameters
|
note: struct defined here, with 0 generic parameters
|
||||||
--> $DIR/invalid-const-arg-for-type-param.rs:3:8
|
--> $DIR/invalid-const-arg-for-type-param.rs:3:8
|
||||||
|
|
|
|
||||||
LL | struct S;
|
LL | struct S;
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0107]: this struct takes 1 generic argument but 2 generic arguments were
|
||||||
--> $DIR/invalid-constant-in-args.rs:4:12
|
--> $DIR/invalid-constant-in-args.rs:4:12
|
||||||
|
|
|
|
||||||
LL | let _: Cell<&str, "a"> = Cell::new("");
|
LL | let _: Cell<&str, "a"> = Cell::new("");
|
||||||
| ^^^^ ----- help: remove this generic argument
|
| ^^^^ --- help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected 1 generic argument
|
| expected 1 generic argument
|
||||||
|
|
|
|
||||||
|
|
|
@ -13,5 +13,5 @@ fn test<T, const P: usize>() where Bool<{core::mem::size_of::<T>() > 4}>: True {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
test::<2>();
|
test::<2>();
|
||||||
//~^ ERROR this function takes 2 generic arguments but only 1 generic argument was supplied
|
//~^ ERROR this function takes 2 generic arguments
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0107]: this function takes 2 generic arguments but only 1 generic argument was supplied
|
error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/issue-76595.rs:15:5
|
--> $DIR/issue-76595.rs:15:5
|
||||||
|
|
|
|
||||||
LL | test::<2>();
|
LL | test::<2>();
|
||||||
|
|
|
@ -15,12 +15,12 @@ enum E<'a, 'b> {
|
||||||
fn main() {
|
fn main() {
|
||||||
S(&0, &0); // OK
|
S(&0, &0); // OK
|
||||||
S::<'static>(&0, &0);
|
S::<'static>(&0, &0);
|
||||||
//~^ ERROR this struct takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
//~^ ERROR this struct takes 2 lifetime arguments
|
||||||
S::<'static, 'static, 'static>(&0, &0);
|
S::<'static, 'static, 'static>(&0, &0);
|
||||||
//~^ ERROR this struct takes 2 lifetime arguments but 3 lifetime arguments were supplied
|
//~^ ERROR this struct takes 2 lifetime arguments
|
||||||
E::V(&0); // OK
|
E::V(&0); // OK
|
||||||
E::V::<'static>(&0);
|
E::V::<'static>(&0);
|
||||||
//~^ ERROR this enum takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
//~^ ERROR this enum takes 2 lifetime arguments
|
||||||
E::V::<'static, 'static, 'static>(&0);
|
E::V::<'static, 'static, 'static>(&0);
|
||||||
//~^ ERROR this enum takes 2 lifetime arguments but 3 lifetime arguments were supplied
|
//~^ ERROR this enum takes 2 lifetime arguments
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0107]: this struct takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
error[E0107]: this struct takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
--> $DIR/constructor-lifetime-args.rs:17:5
|
--> $DIR/constructor-lifetime-args.rs:17:5
|
||||||
|
|
|
|
||||||
LL | S::<'static>(&0, &0);
|
LL | S::<'static>(&0, &0);
|
||||||
|
@ -20,7 +20,7 @@ error[E0107]: this struct takes 2 lifetime arguments but 3 lifetime arguments we
|
||||||
--> $DIR/constructor-lifetime-args.rs:19:5
|
--> $DIR/constructor-lifetime-args.rs:19:5
|
||||||
|
|
|
|
||||||
LL | S::<'static, 'static, 'static>(&0, &0);
|
LL | S::<'static, 'static, 'static>(&0, &0);
|
||||||
| ^ --------- help: remove this lifetime argument
|
| ^ ------- help: remove this lifetime argument
|
||||||
| |
|
| |
|
||||||
| expected 2 lifetime arguments
|
| expected 2 lifetime arguments
|
||||||
|
|
|
|
||||||
|
@ -30,7 +30,7 @@ note: struct defined here, with 2 lifetime parameters: `'a`, `'b`
|
||||||
LL | struct S<'a, 'b>(&'a u8, &'b u8);
|
LL | struct S<'a, 'b>(&'a u8, &'b u8);
|
||||||
| ^ -- --
|
| ^ -- --
|
||||||
|
|
||||||
error[E0107]: this enum takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
error[E0107]: this enum takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
--> $DIR/constructor-lifetime-args.rs:22:8
|
--> $DIR/constructor-lifetime-args.rs:22:8
|
||||||
|
|
|
|
||||||
LL | E::V::<'static>(&0);
|
LL | E::V::<'static>(&0);
|
||||||
|
@ -52,7 +52,7 @@ error[E0107]: this enum takes 2 lifetime arguments but 3 lifetime arguments were
|
||||||
--> $DIR/constructor-lifetime-args.rs:24:8
|
--> $DIR/constructor-lifetime-args.rs:24:8
|
||||||
|
|
|
|
||||||
LL | E::V::<'static, 'static, 'static>(&0);
|
LL | E::V::<'static, 'static, 'static>(&0);
|
||||||
| ^ --------- help: remove this lifetime argument
|
| ^ ------- help: remove this lifetime argument
|
||||||
| |
|
| |
|
||||||
| expected 2 lifetime arguments
|
| expected 2 lifetime arguments
|
||||||
|
|
|
|
||||||
|
|
|
@ -9,15 +9,15 @@ enum Bar {
|
||||||
|
|
||||||
struct Baz<'a, 'b, 'c> {
|
struct Baz<'a, 'b, 'c> {
|
||||||
buzz: Buzz<'a>,
|
buzz: Buzz<'a>,
|
||||||
//~^ ERROR this struct takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
//~^ ERROR this struct takes 2 lifetime arguments
|
||||||
//~| HELP add missing lifetime argument
|
//~| HELP add missing lifetime argument
|
||||||
|
|
||||||
bar: Bar<'a>,
|
bar: Bar<'a>,
|
||||||
//~^ ERROR this enum takes 0 lifetime arguments but 1 lifetime argument was supplied
|
//~^ ERROR this enum takes 0 lifetime arguments
|
||||||
//~| HELP remove these generics
|
//~| HELP remove these generics
|
||||||
|
|
||||||
foo2: Foo<'a, 'b, 'c>,
|
foo2: Foo<'a, 'b, 'c>,
|
||||||
//~^ ERROR this struct takes 1 lifetime argument but 3 lifetime arguments were supplied
|
//~^ ERROR this struct takes 1 lifetime argument
|
||||||
//~| HELP remove these lifetime arguments
|
//~| HELP remove these lifetime arguments
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0107]: this struct takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
error[E0107]: this struct takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
--> $DIR/E0107.rs:11:11
|
--> $DIR/E0107.rs:11:11
|
||||||
|
|
|
|
||||||
LL | buzz: Buzz<'a>,
|
LL | buzz: Buzz<'a>,
|
||||||
|
@ -13,7 +13,7 @@ LL | struct Buzz<'a, 'b>(&'a str, &'b str);
|
||||||
| ^^^^ -- --
|
| ^^^^ -- --
|
||||||
help: add missing lifetime argument
|
help: add missing lifetime argument
|
||||||
|
|
|
|
||||||
LL | buzz: Buzz<'a, 'b>,
|
LL | buzz: Buzz<'a, 'a>,
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
||||||
error[E0107]: this enum takes 0 lifetime arguments but 1 lifetime argument was supplied
|
error[E0107]: this enum takes 0 lifetime arguments but 1 lifetime argument was supplied
|
||||||
|
@ -34,7 +34,7 @@ error[E0107]: this struct takes 1 lifetime argument but 3 lifetime arguments wer
|
||||||
--> $DIR/E0107.rs:19:11
|
--> $DIR/E0107.rs:19:11
|
||||||
|
|
|
|
||||||
LL | foo2: Foo<'a, 'b, 'c>,
|
LL | foo2: Foo<'a, 'b, 'c>,
|
||||||
| ^^^ -------- help: remove these lifetime arguments
|
| ^^^ ------ help: remove these lifetime arguments
|
||||||
| |
|
| |
|
||||||
| expected 1 lifetime argument
|
| expected 1 lifetime argument
|
||||||
|
|
|
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
|
|
||||||
trait X {
|
trait X {
|
||||||
type Y<'a>;
|
type Y<'a>;
|
||||||
//~^ ERROR missing generics for
|
|
||||||
//~| ERROR missing generics for
|
|
||||||
|
|
||||||
fn foo<'a>(t : Self::Y<'a>) -> Self::Y<'a> { t }
|
fn foo<'a>(t : Self::Y<'a>) -> Self::Y<'a> { t }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> X for T {
|
impl<T> X for T {
|
||||||
fn foo<'a, T1: X<Y = T1>>(t : T1) -> T1::Y<'a> {
|
fn foo<'a, T1: X<Y = T1>>(t : T1) -> T1::Y<'a> {
|
||||||
|
//~^ ERROR missing generics for associated type
|
||||||
|
//~^^ ERROR missing generics for associated type
|
||||||
t
|
t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@ LL | #![feature(generic_associated_types)]
|
||||||
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
|
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
|
||||||
|
|
||||||
error[E0107]: missing generics for associated type `X::Y`
|
error[E0107]: missing generics for associated type `X::Y`
|
||||||
--> $DIR/gat-trait-path-missing-lifetime.rs:5:8
|
--> $DIR/gat-trait-path-missing-lifetime.rs:11:20
|
||||||
|
|
|
|
||||||
LL | type Y<'a>;
|
LL | fn foo<'a, T1: X<Y = T1>>(t : T1) -> T1::Y<'a> {
|
||||||
| ^ expected 1 lifetime argument
|
| ^ expected 1 lifetime argument
|
||||||
|
|
|
|
||||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
@ -18,15 +18,15 @@ note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
|
|
|
||||||
LL | type Y<'a>;
|
LL | type Y<'a>;
|
||||||
| ^ --
|
| ^ --
|
||||||
help: use angle brackets to add missing lifetime argument
|
help: add missing lifetime argument
|
||||||
|
|
|
|
||||||
LL | type Y<'a><'a>;
|
LL | fn foo<'a, T1: X<Y<'a> = T1>>(t : T1) -> T1::Y<'a> {
|
||||||
| ^^^^
|
| ^^^^^
|
||||||
|
|
||||||
error[E0107]: missing generics for associated type `X::Y`
|
error[E0107]: missing generics for associated type `X::Y`
|
||||||
--> $DIR/gat-trait-path-missing-lifetime.rs:5:8
|
--> $DIR/gat-trait-path-missing-lifetime.rs:11:20
|
||||||
|
|
|
|
||||||
LL | type Y<'a>;
|
LL | fn foo<'a, T1: X<Y = T1>>(t : T1) -> T1::Y<'a> {
|
||||||
| ^ expected 1 lifetime argument
|
| ^ expected 1 lifetime argument
|
||||||
|
|
|
|
||||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
@ -34,10 +34,10 @@ note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
|
|
|
||||||
LL | type Y<'a>;
|
LL | type Y<'a>;
|
||||||
| ^ --
|
| ^ --
|
||||||
help: use angle brackets to add missing lifetime argument
|
help: add missing lifetime argument
|
||||||
|
|
|
|
||||||
LL | type Y<'a><'a>;
|
LL | fn foo<'a, T1: X<Y<'a> = T1>>(t : T1) -> T1::Y<'a> {
|
||||||
| ^^^^
|
| ^^^^^
|
||||||
|
|
||||||
error: aborting due to 2 previous errors; 1 warning emitted
|
error: aborting due to 2 previous errors; 1 warning emitted
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
|
|
||||||
trait X {
|
trait X {
|
||||||
type Y<'a>;
|
type Y<'a>;
|
||||||
//~^ ERROR this associated type
|
|
||||||
//~| ERROR this associated type
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
|
fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
|
||||||
//~^ ERROR: lifetime in trait object type must be followed by `+`
|
//~^ ERROR: lifetime in trait object type must be followed by `+`
|
||||||
//~| ERROR: parenthesized generic arguments cannot be used
|
//~| ERROR: parenthesized generic arguments cannot be used
|
||||||
|
//~| ERROR this associated type takes 0 generic arguments but 1 generic argument
|
||||||
|
//~| ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments
|
||||||
//~| WARNING: trait objects without an explicit `dyn` are deprecated
|
//~| WARNING: trait objects without an explicit `dyn` are deprecated
|
||||||
//~| WARNING: this was previously accepted by the compiler
|
//~| WARNING: this was previously accepted by the compiler
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error: lifetime in trait object type must be followed by `+`
|
error: lifetime in trait object type must be followed by `+`
|
||||||
--> $DIR/gat-trait-path-parenthesised-args.rs:10:29
|
--> $DIR/gat-trait-path-parenthesised-args.rs:8:29
|
||||||
|
|
|
|
||||||
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
|
||||||
| ^^
|
| ^^
|
||||||
|
|
||||||
error: parenthesized generic arguments cannot be used in associated type constraints
|
error: parenthesized generic arguments cannot be used in associated type constraints
|
||||||
--> $DIR/gat-trait-path-parenthesised-args.rs:10:27
|
--> $DIR/gat-trait-path-parenthesised-args.rs:8:27
|
||||||
|
|
|
|
||||||
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
@ -20,7 +20,7 @@ LL | #![feature(generic_associated_types)]
|
||||||
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
|
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
|
||||||
|
|
||||||
warning: trait objects without an explicit `dyn` are deprecated
|
warning: trait objects without an explicit `dyn` are deprecated
|
||||||
--> $DIR/gat-trait-path-parenthesised-args.rs:10:29
|
--> $DIR/gat-trait-path-parenthesised-args.rs:8:29
|
||||||
|
|
|
|
||||||
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
|
||||||
| ^^ help: use `dyn`: `dyn 'a`
|
| ^^ help: use `dyn`: `dyn 'a`
|
||||||
|
@ -30,9 +30,9 @@ LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
|
||||||
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
|
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
|
||||||
|
|
||||||
error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
|
error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
|
||||||
--> $DIR/gat-trait-path-parenthesised-args.rs:5:8
|
--> $DIR/gat-trait-path-parenthesised-args.rs:8:27
|
||||||
|
|
|
|
||||||
LL | type Y<'a>;
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
|
||||||
| ^ expected 1 lifetime argument
|
| ^ expected 1 lifetime argument
|
||||||
|
|
|
|
||||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
@ -42,24 +42,18 @@ LL | type Y<'a>;
|
||||||
| ^ --
|
| ^ --
|
||||||
help: add missing lifetime argument
|
help: add missing lifetime argument
|
||||||
|
|
|
|
||||||
LL | fn foo<'a>(arg: Box<dyn X<Y('a'a) = &'a ()>>) {}
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a, 'a) = &'a ()>>) {}
|
||||||
| ^^
|
| ^^^
|
||||||
|
|
||||||
error[E0107]: this associated type takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/gat-trait-path-parenthesised-args.rs:5:8
|
--> $DIR/gat-trait-path-parenthesised-args.rs:8:27
|
||||||
|
|
|
|
||||||
LL | type Y<'a>;
|
LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
|
||||||
| ________^-
|
| ^-------------- help: remove these generics
|
||||||
| | |
|
| |
|
||||||
| | expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
LL | |
|
|
||||||
LL | |
|
|
||||||
LL | | }
|
|
||||||
LL | |
|
|
||||||
LL | | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {}
|
|
||||||
| |_________________________________________- help: remove these generics
|
|
||||||
|
|
|
|
||||||
note: associated type defined here, with 0 type parameters
|
note: associated type defined here, with 0 generic parameters
|
||||||
--> $DIR/gat-trait-path-parenthesised-args.rs:5:8
|
--> $DIR/gat-trait-path-parenthesised-args.rs:5:8
|
||||||
|
|
|
|
||||||
LL | type Y<'a>;
|
LL | type Y<'a>;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
trait Provider {
|
trait Provider {
|
||||||
type A<'a>;
|
type A<'a>;
|
||||||
//~^ ERROR: missing generics for associated type
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Provider for () {
|
impl Provider for () {
|
||||||
|
@ -12,6 +11,7 @@ impl Provider for () {
|
||||||
|
|
||||||
struct Holder<B> {
|
struct Holder<B> {
|
||||||
inner: Box<dyn Provider<A = B>>,
|
inner: Box<dyn Provider<A = B>>,
|
||||||
|
//~^ ERROR: missing generics for associated type
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
error[E0107]: missing generics for associated type `Provider::A`
|
error[E0107]: missing generics for associated type `Provider::A`
|
||||||
--> $DIR/issue-71176.rs:5:10
|
--> $DIR/issue-71176.rs:13:27
|
||||||
|
|
|
|
||||||
LL | type A<'a>;
|
LL | inner: Box<dyn Provider<A = B>>,
|
||||||
| ^ expected 1 lifetime argument
|
| ^ expected 1 lifetime argument
|
||||||
|
|
|
|
||||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
@ -9,10 +9,10 @@ note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
|
|
|
||||||
LL | type A<'a>;
|
LL | type A<'a>;
|
||||||
| ^ --
|
| ^ --
|
||||||
help: use angle brackets to add missing lifetime argument
|
help: add missing lifetime argument
|
||||||
|
|
|
|
||||||
LL | type A<'a><'a>;
|
LL | inner: Box<dyn Provider<A<'a> = B>>,
|
||||||
| ^^^^
|
| ^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ pub trait SubTrait {}
|
||||||
|
|
||||||
pub trait SuperTrait {
|
pub trait SuperTrait {
|
||||||
type SubType<'a>: SubTrait;
|
type SubType<'a>: SubTrait;
|
||||||
//~^ ERROR missing generics for associated
|
|
||||||
|
|
||||||
fn get_sub<'a>(&'a mut self) -> Self::SubType<'a>;
|
fn get_sub<'a>(&'a mut self) -> Self::SubType<'a>;
|
||||||
}
|
}
|
||||||
|
@ -36,6 +35,7 @@ impl SuperTrait for SuperStruct {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
|
let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
|
||||||
//~^ ERROR the trait `SuperTrait` cannot be made into an object
|
//~^ ERROR missing generics for associated type
|
||||||
//~^^ ERROR the trait `SuperTrait` cannot be made into an object
|
//~^^ ERROR the trait
|
||||||
|
//~| ERROR the trait
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@ LL | #![feature(generic_associated_types)]
|
||||||
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
|
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
|
||||||
|
|
||||||
error[E0107]: missing generics for associated type `SuperTrait::SubType`
|
error[E0107]: missing generics for associated type `SuperTrait::SubType`
|
||||||
--> $DIR/issue-76535.rs:7:10
|
--> $DIR/issue-76535.rs:37:33
|
||||||
|
|
|
|
||||||
LL | type SubType<'a>: SubTrait;
|
LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
|
||||||
| ^^^^^^^ expected 1 lifetime argument
|
| ^^^^^^^ expected 1 lifetime argument
|
||||||
|
|
|
|
||||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
@ -18,13 +18,13 @@ note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
|
|
|
||||||
LL | type SubType<'a>: SubTrait;
|
LL | type SubType<'a>: SubTrait;
|
||||||
| ^^^^^^^ --
|
| ^^^^^^^ --
|
||||||
help: use angle brackets to add missing lifetime argument
|
help: add missing lifetime argument
|
||||||
|
|
|
|
||||||
LL | type SubType<'a><'a>: SubTrait;
|
LL | let sub: Box<dyn SuperTrait<SubType<'a> = SubStruct>> = Box::new(SuperStruct::new(0));
|
||||||
| ^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0038]: the trait `SuperTrait` cannot be made into an object
|
error[E0038]: the trait `SuperTrait` cannot be made into an object
|
||||||
--> $DIR/issue-76535.rs:38:14
|
--> $DIR/issue-76535.rs:37:14
|
||||||
|
|
|
|
||||||
LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
|
LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` cannot be made into an object
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` cannot be made into an object
|
||||||
|
@ -39,7 +39,7 @@ LL | type SubType<'a>: SubTrait;
|
||||||
| ^^^^^^^ ...because it contains the generic associated type `SubType`
|
| ^^^^^^^ ...because it contains the generic associated type `SubType`
|
||||||
|
|
||||||
error[E0038]: the trait `SuperTrait` cannot be made into an object
|
error[E0038]: the trait `SuperTrait` cannot be made into an object
|
||||||
--> $DIR/issue-76535.rs:38:57
|
--> $DIR/issue-76535.rs:37:57
|
||||||
|
|
|
|
||||||
LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
|
LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` cannot be made into an object
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` cannot be made into an object
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
|
|
||||||
trait CollectionFamily {
|
trait CollectionFamily {
|
||||||
type Member<T>;
|
type Member<T>;
|
||||||
//~^ ERROR: missing generics for associated type
|
|
||||||
}
|
}
|
||||||
fn floatify() {
|
fn floatify() {
|
||||||
Box::new(Family) as &dyn CollectionFamily<Member=usize>
|
Box::new(Family) as &dyn CollectionFamily<Member=usize>
|
||||||
//~^ the trait `CollectionFamily` cannot be made into an object
|
//~^ ERROR: missing generics for associated type
|
||||||
|
//~| ERROR: the trait `CollectionFamily` cannot be made into an object
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Family;
|
struct Family;
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
error[E0107]: missing generics for associated type `CollectionFamily::Member`
|
error[E0107]: missing generics for associated type `CollectionFamily::Member`
|
||||||
--> $DIR/issue-78671.rs:5:10
|
--> $DIR/issue-78671.rs:8:47
|
||||||
|
|
|
|
||||||
LL | type Member<T>;
|
LL | Box::new(Family) as &dyn CollectionFamily<Member=usize>
|
||||||
| ^^^^^^ expected 1 type argument
|
| ^^^^^^ expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: associated type defined here, with 1 type parameter: `T`
|
note: associated type defined here, with 1 generic parameter: `T`
|
||||||
--> $DIR/issue-78671.rs:5:10
|
--> $DIR/issue-78671.rs:5:10
|
||||||
|
|
|
|
||||||
LL | type Member<T>;
|
LL | type Member<T>;
|
||||||
| ^^^^^^ -
|
| ^^^^^^ -
|
||||||
help: use angle brackets to add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | type Member<T><T>;
|
LL | Box::new(Family) as &dyn CollectionFamily<Member<T>=usize>
|
||||||
| ^^^
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error[E0038]: the trait `CollectionFamily` cannot be made into an object
|
error[E0038]: the trait `CollectionFamily` cannot be made into an object
|
||||||
--> $DIR/issue-78671.rs:9:25
|
--> $DIR/issue-78671.rs:8:25
|
||||||
|
|
|
|
||||||
LL | Box::new(Family) as &dyn CollectionFamily<Member=usize>
|
LL | Box::new(Family) as &dyn CollectionFamily<Member=usize>
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `CollectionFamily` cannot be made into an object
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `CollectionFamily` cannot be made into an object
|
||||||
|
|
|
@ -19,7 +19,6 @@ impl<'a, T> RefCont<'a, T> for Box<T> {
|
||||||
|
|
||||||
trait MapLike<K, V> {
|
trait MapLike<K, V> {
|
||||||
type VRefCont<'a>: RefCont<'a, V>;
|
type VRefCont<'a>: RefCont<'a, V>;
|
||||||
//~^ ERROR missing generics
|
|
||||||
fn get<'a>(&'a self, key: &K) -> Option<Self::VRefCont<'a>>;
|
fn get<'a>(&'a self, key: &K) -> Option<Self::VRefCont<'a>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +41,7 @@ impl<K, V: Default> MapLike<K, V> for Source {
|
||||||
fn main() {
|
fn main() {
|
||||||
let m = Box::new(std::collections::BTreeMap::<u8, u8>::new())
|
let m = Box::new(std::collections::BTreeMap::<u8, u8>::new())
|
||||||
as Box<dyn MapLike<u8, u8, VRefCont = dyn RefCont<'_, u8>>>;
|
as Box<dyn MapLike<u8, u8, VRefCont = dyn RefCont<'_, u8>>>;
|
||||||
//~^^ the trait `MapLike` cannot be made into an object
|
//~^ ERROR missing generics for associated type
|
||||||
//~^^ the trait `MapLike` cannot be made into an object
|
//~^^ ERROR the trait
|
||||||
|
//~^^^^ ERROR the trait
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
error[E0107]: missing generics for associated type `MapLike::VRefCont`
|
error[E0107]: missing generics for associated type `MapLike::VRefCont`
|
||||||
--> $DIR/issue-79422.rs:21:10
|
--> $DIR/issue-79422.rs:43:36
|
||||||
|
|
|
|
||||||
LL | type VRefCont<'a>: RefCont<'a, V>;
|
LL | as Box<dyn MapLike<u8, u8, VRefCont = dyn RefCont<'_, u8>>>;
|
||||||
| ^^^^^^^^ expected 1 lifetime argument
|
| ^^^^^^^^ expected 1 lifetime argument
|
||||||
|
|
|
|
||||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
@ -9,13 +9,13 @@ note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
|
|
|
||||||
LL | type VRefCont<'a>: RefCont<'a, V>;
|
LL | type VRefCont<'a>: RefCont<'a, V>;
|
||||||
| ^^^^^^^^ --
|
| ^^^^^^^^ --
|
||||||
help: use angle brackets to add missing lifetime argument
|
help: add missing lifetime argument
|
||||||
|
|
|
|
||||||
LL | type VRefCont<'a><'a>: RefCont<'a, V>;
|
LL | as Box<dyn MapLike<u8, u8, VRefCont<'a> = dyn RefCont<'_, u8>>>;
|
||||||
| ^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0038]: the trait `MapLike` cannot be made into an object
|
error[E0038]: the trait `MapLike` cannot be made into an object
|
||||||
--> $DIR/issue-79422.rs:44:12
|
--> $DIR/issue-79422.rs:43:12
|
||||||
|
|
|
|
||||||
LL | as Box<dyn MapLike<u8, u8, VRefCont = dyn RefCont<'_, u8>>>;
|
LL | as Box<dyn MapLike<u8, u8, VRefCont = dyn RefCont<'_, u8>>>;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` cannot be made into an object
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` cannot be made into an object
|
||||||
|
@ -30,7 +30,7 @@ LL | type VRefCont<'a>: RefCont<'a, V>;
|
||||||
| ^^^^^^^^ ...because it contains the generic associated type `VRefCont`
|
| ^^^^^^^^ ...because it contains the generic associated type `VRefCont`
|
||||||
|
|
||||||
error[E0038]: the trait `MapLike` cannot be made into an object
|
error[E0038]: the trait `MapLike` cannot be made into an object
|
||||||
--> $DIR/issue-79422.rs:43:13
|
--> $DIR/issue-79422.rs:42:13
|
||||||
|
|
|
|
||||||
LL | let m = Box::new(std::collections::BTreeMap::<u8, u8>::new())
|
LL | let m = Box::new(std::collections::BTreeMap::<u8, u8>::new())
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` cannot be made into an object
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` cannot be made into an object
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
trait Monad {
|
trait Monad {
|
||||||
type Unwrapped;
|
type Unwrapped;
|
||||||
type Wrapped<B>;
|
type Wrapped<B>;
|
||||||
//~^ ERROR: missing generics for associated type `Monad::Wrapped`
|
|
||||||
|
|
||||||
fn bind<B, F>(self, f: F) -> Self::Wrapped<B> {
|
fn bind<B, F>(self, f: F) -> Self::Wrapped<B> {
|
||||||
todo!()
|
todo!()
|
||||||
|
@ -15,6 +14,7 @@ fn join<MOuter, MInner, A>(outer: MOuter) -> MOuter::Wrapped<A>
|
||||||
where
|
where
|
||||||
MOuter: Monad<Unwrapped = MInner>,
|
MOuter: Monad<Unwrapped = MInner>,
|
||||||
MInner: Monad<Unwrapped = A, Wrapped = MOuter::Wrapped<A>>,
|
MInner: Monad<Unwrapped = A, Wrapped = MOuter::Wrapped<A>>,
|
||||||
|
//~^ ERROR: missing generics for associated type `Monad::Wrapped`
|
||||||
{
|
{
|
||||||
outer.bind(|inner| inner)
|
outer.bind(|inner| inner)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
error[E0107]: missing generics for associated type `Monad::Wrapped`
|
error[E0107]: missing generics for associated type `Monad::Wrapped`
|
||||||
--> $DIR/issue-79636-1.rs:6:10
|
--> $DIR/issue-79636-1.rs:16:34
|
||||||
|
|
|
|
||||||
LL | type Wrapped<B>;
|
LL | MInner: Monad<Unwrapped = A, Wrapped = MOuter::Wrapped<A>>,
|
||||||
| ^^^^^^^ expected 1 type argument
|
| ^^^^^^^ expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: associated type defined here, with 1 type parameter: `B`
|
note: associated type defined here, with 1 generic parameter: `B`
|
||||||
--> $DIR/issue-79636-1.rs:6:10
|
--> $DIR/issue-79636-1.rs:6:10
|
||||||
|
|
|
|
||||||
LL | type Wrapped<B>;
|
LL | type Wrapped<B>;
|
||||||
| ^^^^^^^ -
|
| ^^^^^^^ -
|
||||||
help: use angle brackets to add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | type Wrapped<B><B>;
|
LL | MInner: Monad<Unwrapped = A, Wrapped<B> = MOuter::Wrapped<A>>,
|
||||||
| ^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
trait SomeTrait {
|
trait SomeTrait {
|
||||||
type Wrapped<A>: SomeTrait;
|
type Wrapped<A>: SomeTrait;
|
||||||
//~^ ERROR: missing generics for associated type `SomeTrait::Wrapped`
|
|
||||||
|
|
||||||
fn f() -> ();
|
fn f() -> ();
|
||||||
}
|
}
|
||||||
|
@ -11,6 +10,7 @@ trait SomeTrait {
|
||||||
fn program<W>() -> ()
|
fn program<W>() -> ()
|
||||||
where
|
where
|
||||||
W: SomeTrait<Wrapped = W>,
|
W: SomeTrait<Wrapped = W>,
|
||||||
|
//~^ ERROR: missing generics for associated type `SomeTrait::Wrapped`
|
||||||
{
|
{
|
||||||
return W::f();
|
return W::f();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
error[E0107]: missing generics for associated type `SomeTrait::Wrapped`
|
error[E0107]: missing generics for associated type `SomeTrait::Wrapped`
|
||||||
--> $DIR/issue-79636-2.rs:5:10
|
--> $DIR/issue-79636-2.rs:12:18
|
||||||
|
|
|
|
||||||
LL | type Wrapped<A>: SomeTrait;
|
LL | W: SomeTrait<Wrapped = W>,
|
||||||
| ^^^^^^^ expected 1 type argument
|
| ^^^^^^^ expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: associated type defined here, with 1 type parameter: `A`
|
note: associated type defined here, with 1 generic parameter: `A`
|
||||||
--> $DIR/issue-79636-2.rs:5:10
|
--> $DIR/issue-79636-2.rs:5:10
|
||||||
|
|
|
|
||||||
LL | type Wrapped<A>: SomeTrait;
|
LL | type Wrapped<A>: SomeTrait;
|
||||||
| ^^^^^^^ -
|
| ^^^^^^^ -
|
||||||
help: use angle brackets to add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | type Wrapped<A><A>: SomeTrait;
|
LL | W: SomeTrait<Wrapped<A> = W>,
|
||||||
| ^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ struct E<T> {
|
||||||
|
|
||||||
trait TestMut {
|
trait TestMut {
|
||||||
type Output<'a>;
|
type Output<'a>;
|
||||||
//~^ ERROR missing generics
|
|
||||||
fn test_mut<'a>(&'a mut self) -> Self::Output<'a>;
|
fn test_mut<'a>(&'a mut self) -> Self::Output<'a>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +22,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_simpler<'a>(dst: &'a mut impl TestMut<Output = &'a mut f32>)
|
fn test_simpler<'a>(dst: &'a mut impl TestMut<Output = &'a mut f32>)
|
||||||
|
//~^ ERROR missing generics for associated type
|
||||||
{
|
{
|
||||||
for n in 0i16..100 {
|
for n in 0i16..100 {
|
||||||
*dst.test_mut() = n.into();
|
*dst.test_mut() = n.into();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
error[E0107]: missing generics for associated type `TestMut::Output`
|
error[E0107]: missing generics for associated type `TestMut::Output`
|
||||||
--> $DIR/issue-80433.rs:10:10
|
--> $DIR/issue-80433.rs:24:47
|
||||||
|
|
|
|
||||||
LL | type Output<'a>;
|
LL | fn test_simpler<'a>(dst: &'a mut impl TestMut<Output = &'a mut f32>)
|
||||||
| ^^^^^^ expected 1 lifetime argument
|
| ^^^^^^ expected 1 lifetime argument
|
||||||
|
|
|
|
||||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
@ -9,10 +9,10 @@ note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
|
|
|
||||||
LL | type Output<'a>;
|
LL | type Output<'a>;
|
||||||
| ^^^^^^ --
|
| ^^^^^^ --
|
||||||
help: use angle brackets to add missing lifetime argument
|
help: add missing lifetime argument
|
||||||
|
|
|
|
||||||
LL | type Output<'a><'a>;
|
LL | fn test_simpler<'a>(dst: &'a mut impl TestMut<Output<'a> = &'a mut f32>)
|
||||||
| ^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,10 @@ trait B {
|
||||||
}
|
}
|
||||||
trait C {
|
trait C {
|
||||||
type DType<T>: D<T, CType = Self>;
|
type DType<T>: D<T, CType = Self>;
|
||||||
//~^ ERROR: missing generics for associated type `C::DType` [E0107]
|
|
||||||
}
|
}
|
||||||
trait D<T> {
|
trait D<T> {
|
||||||
type CType: C<DType = Self>;
|
type CType: C<DType = Self>;
|
||||||
|
//~^ ERROR missing generics for associated type
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
error[E0107]: missing generics for associated type `C::DType`
|
error[E0107]: missing generics for associated type `C::DType`
|
||||||
--> $DIR/issue-81712-cyclic-traits.rs:14:10
|
--> $DIR/issue-81712-cyclic-traits.rs:17:19
|
||||||
|
|
|
|
||||||
LL | type DType<T>: D<T, CType = Self>;
|
LL | type CType: C<DType = Self>;
|
||||||
| ^^^^^ expected 1 type argument
|
| ^^^^^ expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: associated type defined here, with 1 type parameter: `T`
|
note: associated type defined here, with 1 generic parameter: `T`
|
||||||
--> $DIR/issue-81712-cyclic-traits.rs:14:10
|
--> $DIR/issue-81712-cyclic-traits.rs:14:10
|
||||||
|
|
|
|
||||||
LL | type DType<T>: D<T, CType = Self>;
|
LL | type DType<T>: D<T, CType = Self>;
|
||||||
| ^^^^^ -
|
| ^^^^^ -
|
||||||
help: use angle brackets to add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | type DType<T><T>: D<T, CType = Self>;
|
LL | type CType: C<DType<T> = Self>;
|
||||||
| ^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
13
src/test/ui/generic-associated-types/issue-81862.rs
Normal file
13
src/test/ui/generic-associated-types/issue-81862.rs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#![allow(incomplete_features)]
|
||||||
|
#![feature(generic_associated_types)]
|
||||||
|
|
||||||
|
trait StreamingIterator {
|
||||||
|
type Item<'a>;
|
||||||
|
fn next(&mut self) -> Option<Self::Item>;
|
||||||
|
//~^ ERROR missing generics for associated type
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
|
|
||||||
|
// call stack from back to front:
|
||||||
|
// create_substs_for_assoc_ty -> qpath_to_ty -> res_to_ty -> ast_ty_to_ty -> ty_of_fn
|
19
src/test/ui/generic-associated-types/issue-81862.stderr
Normal file
19
src/test/ui/generic-associated-types/issue-81862.stderr
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
error[E0107]: missing generics for associated type `StreamingIterator::Item`
|
||||||
|
--> $DIR/issue-81862.rs:6:40
|
||||||
|
|
|
||||||
|
LL | fn next(&mut self) -> Option<Self::Item>;
|
||||||
|
| ^^^^ expected 1 lifetime argument
|
||||||
|
|
|
||||||
|
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
--> $DIR/issue-81862.rs:5:10
|
||||||
|
|
|
||||||
|
LL | type Item<'a>;
|
||||||
|
| ^^^^ --
|
||||||
|
help: add missing lifetime argument
|
||||||
|
|
|
||||||
|
LL | fn next(&mut self) -> Option<Self::Item<'_>>;
|
||||||
|
| ^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0107`.
|
|
@ -0,0 +1,23 @@
|
||||||
|
#![feature(generic_associated_types)]
|
||||||
|
//~^ WARNING the feature `generic_associated_types`
|
||||||
|
|
||||||
|
trait X {
|
||||||
|
type Y<'a, 'b>;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Foo<'a, 'b, 'c> {
|
||||||
|
a: &'a u32,
|
||||||
|
b: &'b str,
|
||||||
|
c: &'c str,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn foo<'c, 'd>(_arg: Box<dyn X<Y = (&'c u32, &'d u32)>>) {}
|
||||||
|
//~^ ERROR missing generics for associated type
|
||||||
|
|
||||||
|
fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {}
|
||||||
|
//~^ ERROR this struct takes 3 lifetime arguments but 2 lifetime
|
||||||
|
|
||||||
|
fn f<'a>(_arg: Foo<'a>) {}
|
||||||
|
//~^ ERROR this struct takes 3 lifetime arguments but 1 lifetime
|
||||||
|
|
||||||
|
fn main() {}
|
|
@ -0,0 +1,64 @@
|
||||||
|
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||||
|
--> $DIR/missing_lifetime_args.rs:1:12
|
||||||
|
|
|
||||||
|
LL | #![feature(generic_associated_types)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: `#[warn(incomplete_features)]` on by default
|
||||||
|
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
|
||||||
|
|
||||||
|
error[E0107]: missing generics for associated type `X::Y`
|
||||||
|
--> $DIR/missing_lifetime_args.rs:14:32
|
||||||
|
|
|
||||||
|
LL | fn foo<'c, 'd>(_arg: Box<dyn X<Y = (&'c u32, &'d u32)>>) {}
|
||||||
|
| ^ expected 2 lifetime arguments
|
||||||
|
|
|
||||||
|
note: associated type defined here, with 2 lifetime parameters: `'a`, `'b`
|
||||||
|
--> $DIR/missing_lifetime_args.rs:5:10
|
||||||
|
|
|
||||||
|
LL | type Y<'a, 'b>;
|
||||||
|
| ^ -- --
|
||||||
|
help: add missing lifetime arguments
|
||||||
|
|
|
||||||
|
LL | fn foo<'c, 'd>(_arg: Box<dyn X<Y<'c, 'd> = (&'c u32, &'d u32)>>) {}
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
|
error[E0107]: this struct takes 3 lifetime arguments but 2 lifetime arguments were supplied
|
||||||
|
--> $DIR/missing_lifetime_args.rs:17:26
|
||||||
|
|
|
||||||
|
LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {}
|
||||||
|
| ^^^ -- -- supplied 2 lifetime arguments
|
||||||
|
| |
|
||||||
|
| expected 3 lifetime arguments
|
||||||
|
|
|
||||||
|
note: struct defined here, with 3 lifetime parameters: `'a`, `'b`, `'c`
|
||||||
|
--> $DIR/missing_lifetime_args.rs:8:8
|
||||||
|
|
|
||||||
|
LL | struct Foo<'a, 'b, 'c> {
|
||||||
|
| ^^^ -- -- --
|
||||||
|
help: add missing lifetime argument
|
||||||
|
|
|
||||||
|
LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b, 'a>) {}
|
||||||
|
| ^^^^
|
||||||
|
|
||||||
|
error[E0107]: this struct takes 3 lifetime arguments but 1 lifetime argument was supplied
|
||||||
|
--> $DIR/missing_lifetime_args.rs:20:16
|
||||||
|
|
|
||||||
|
LL | fn f<'a>(_arg: Foo<'a>) {}
|
||||||
|
| ^^^ -- supplied 1 lifetime argument
|
||||||
|
| |
|
||||||
|
| expected 3 lifetime arguments
|
||||||
|
|
|
||||||
|
note: struct defined here, with 3 lifetime parameters: `'a`, `'b`, `'c`
|
||||||
|
--> $DIR/missing_lifetime_args.rs:8:8
|
||||||
|
|
|
||||||
|
LL | struct Foo<'a, 'b, 'c> {
|
||||||
|
| ^^^ -- -- --
|
||||||
|
help: add missing lifetime arguments
|
||||||
|
|
|
||||||
|
LL | fn f<'a>(_arg: Foo<'a, 'b, 'c>) {}
|
||||||
|
| ^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors; 1 warning emitted
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0107`.
|
|
@ -0,0 +1,13 @@
|
||||||
|
#![feature(generic_associated_types)]
|
||||||
|
//~^ WARNING the feature
|
||||||
|
|
||||||
|
trait Foo {
|
||||||
|
type Assoc<'a, const N: usize>;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn foo<T: Foo>() {
|
||||||
|
let _: <T as Foo>::Assoc<3>;
|
||||||
|
//~^ ERROR this associated type
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
|
@ -0,0 +1,28 @@
|
||||||
|
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||||
|
--> $DIR/missing_lifetime_const.rs:1:12
|
||||||
|
|
|
||||||
|
LL | #![feature(generic_associated_types)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: `#[warn(incomplete_features)]` on by default
|
||||||
|
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
|
||||||
|
|
||||||
|
error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
|
||||||
|
--> $DIR/missing_lifetime_const.rs:9:24
|
||||||
|
|
|
||||||
|
LL | let _: <T as Foo>::Assoc<3>;
|
||||||
|
| ^^^^^ expected 1 lifetime argument
|
||||||
|
|
|
||||||
|
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
--> $DIR/missing_lifetime_const.rs:5:10
|
||||||
|
|
|
||||||
|
LL | type Assoc<'a, const N: usize>;
|
||||||
|
| ^^^^^ --
|
||||||
|
help: add missing lifetime argument
|
||||||
|
|
|
||||||
|
LL | let _: <T as Foo>::Assoc<'a, 3>;
|
||||||
|
| ^^^
|
||||||
|
|
||||||
|
error: aborting due to previous error; 1 warning emitted
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0107`.
|
|
@ -12,9 +12,9 @@ trait Foo {
|
||||||
type FOk<T> = Self::E<'static, T>;
|
type FOk<T> = Self::E<'static, T>;
|
||||||
type FErr1 = Self::E<'static, 'static>;
|
type FErr1 = Self::E<'static, 'static>;
|
||||||
//~^ ERROR this associated type takes 1 lifetime argument but 2 lifetime arguments were supplied
|
//~^ ERROR this associated type takes 1 lifetime argument but 2 lifetime arguments were supplied
|
||||||
//~| ERROR this associated type takes 1 type argument but 0 type arguments were supplied
|
//~| ERROR this associated type takes 1
|
||||||
type FErr2<T> = Self::E<'static, T, u32>;
|
type FErr2<T> = Self::E<'static, T, u32>;
|
||||||
//~^ ERROR this associated type takes 1 type argument but 2 type arguments were supplied
|
//~^ ERROR this associated type takes 1
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0107]: this associated type takes 1 lifetime argument but 2 lifetime argu
|
||||||
--> $DIR/parameter_number_and_kind.rs:13:24
|
--> $DIR/parameter_number_and_kind.rs:13:24
|
||||||
|
|
|
|
||||||
LL | type FErr1 = Self::E<'static, 'static>;
|
LL | type FErr1 = Self::E<'static, 'static>;
|
||||||
| ^ --------- help: remove this lifetime argument
|
| ^ ------- help: remove this lifetime argument
|
||||||
| |
|
| |
|
||||||
| expected 1 lifetime argument
|
| expected 1 lifetime argument
|
||||||
|
|
|
|
||||||
|
@ -12,31 +12,31 @@ note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
LL | type E<'a, T>;
|
LL | type E<'a, T>;
|
||||||
| ^ --
|
| ^ --
|
||||||
|
|
||||||
error[E0107]: this associated type takes 1 type argument but 0 type arguments were supplied
|
error[E0107]: this associated type takes 1 generic argument but 0 generic arguments were supplied
|
||||||
--> $DIR/parameter_number_and_kind.rs:13:24
|
--> $DIR/parameter_number_and_kind.rs:13:24
|
||||||
|
|
|
|
||||||
LL | type FErr1 = Self::E<'static, 'static>;
|
LL | type FErr1 = Self::E<'static, 'static>;
|
||||||
| ^ expected 1 type argument
|
| ^ expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: associated type defined here, with 1 type parameter: `T`
|
note: associated type defined here, with 1 generic parameter: `T`
|
||||||
--> $DIR/parameter_number_and_kind.rs:10:10
|
--> $DIR/parameter_number_and_kind.rs:10:10
|
||||||
|
|
|
|
||||||
LL | type E<'a, T>;
|
LL | type E<'a, T>;
|
||||||
| ^ -
|
| ^ -
|
||||||
help: add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | type FErr1 = Self::E<'static, 'static, T>;
|
LL | type FErr1 = Self::E<'static, 'static, T>;
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error[E0107]: this associated type takes 1 type argument but 2 type arguments were supplied
|
error[E0107]: this associated type takes 1 generic argument but 2 generic arguments were supplied
|
||||||
--> $DIR/parameter_number_and_kind.rs:16:27
|
--> $DIR/parameter_number_and_kind.rs:16:27
|
||||||
|
|
|
|
||||||
LL | type FErr2<T> = Self::E<'static, T, u32>;
|
LL | type FErr2<T> = Self::E<'static, T, u32>;
|
||||||
| ^ ----- help: remove this type argument
|
| ^ --- help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected 1 type argument
|
| expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: associated type defined here, with 1 type parameter: `T`
|
note: associated type defined here, with 1 generic parameter: `T`
|
||||||
--> $DIR/parameter_number_and_kind.rs:10:10
|
--> $DIR/parameter_number_and_kind.rs:10:10
|
||||||
|
|
|
|
||||||
LL | type E<'a, T>;
|
LL | type E<'a, T>;
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
|
|
||||||
trait X {
|
trait X {
|
||||||
type Y<'a>;
|
type Y<'a>;
|
||||||
//~^ ERROR this associated type
|
|
||||||
//~| ERROR this associated type
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const _: () = {
|
const _: () = {
|
||||||
fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
|
fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
|
||||||
|
//~^ ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments
|
||||||
|
//~| ERROR this associated type takes 0 generic arguments but 1 generic argument
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -8,9 +8,9 @@ LL | #![feature(generic_associated_types)]
|
||||||
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
|
= note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
|
||||||
|
|
||||||
error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
|
error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied
|
||||||
--> $DIR/trait-path-type-error-once-implemented.rs:5:10
|
--> $DIR/trait-path-type-error-once-implemented.rs:9:29
|
||||||
|
|
|
|
||||||
LL | type Y<'a>;
|
LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
|
||||||
| ^ expected 1 lifetime argument
|
| ^ expected 1 lifetime argument
|
||||||
|
|
|
|
||||||
note: associated type defined here, with 1 lifetime parameter: `'a`
|
note: associated type defined here, with 1 lifetime parameter: `'a`
|
||||||
|
@ -20,25 +20,18 @@ LL | type Y<'a>;
|
||||||
| ^ --
|
| ^ --
|
||||||
help: add missing lifetime argument
|
help: add missing lifetime argument
|
||||||
|
|
|
|
||||||
LL | fn f2<'a>(arg : Box<dyn X<Y<'a1> = &'a ()>>) {}
|
LL | fn f2<'a>(arg : Box<dyn X<Y<'a, 1> = &'a ()>>) {}
|
||||||
| ^^
|
| ^^^
|
||||||
|
|
||||||
error[E0107]: this associated type takes 0 const arguments but 1 const argument was supplied
|
error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/trait-path-type-error-once-implemented.rs:5:10
|
--> $DIR/trait-path-type-error-once-implemented.rs:9:29
|
||||||
|
|
|
|
||||||
LL | type Y<'a>;
|
LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
|
||||||
| __________^-
|
| ^--- help: remove these generics
|
||||||
| | |
|
| |
|
||||||
| | expected 0 const arguments
|
| expected 0 generic arguments
|
||||||
LL | |
|
|
||||||
LL | |
|
|
||||||
LL | | }
|
|
||||||
LL | |
|
|
||||||
LL | | const _: () = {
|
|
||||||
LL | | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
|
|
||||||
| |________________________________- help: remove these generics
|
|
||||||
|
|
|
|
||||||
note: associated type defined here, with 0 const parameters
|
note: associated type defined here, with 0 generic parameters
|
||||||
--> $DIR/trait-path-type-error-once-implemented.rs:5:10
|
--> $DIR/trait-path-type-error-once-implemented.rs:5:10
|
||||||
|
|
|
|
||||||
LL | type Y<'a>;
|
LL | type Y<'a>;
|
||||||
|
|
|
@ -28,17 +28,17 @@ impl Trait<isize> for S2 {
|
||||||
|
|
||||||
fn foo<'a>() {
|
fn foo<'a>() {
|
||||||
let _ = S::new::<isize,f64>(1, 1.0);
|
let _ = S::new::<isize,f64>(1, 1.0);
|
||||||
//~^ ERROR this associated function takes 1 type argument but 2 type arguments were supplied
|
//~^ ERROR this associated function takes 1
|
||||||
|
|
||||||
let _ = S::<'a,isize>::new::<f64>(1, 1.0);
|
let _ = S::<'a,isize>::new::<f64>(1, 1.0);
|
||||||
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
|
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
|
||||||
|
|
||||||
let _: S2 = Trait::new::<isize,f64>(1, 1.0);
|
let _: S2 = Trait::new::<isize,f64>(1, 1.0);
|
||||||
//~^ ERROR this associated function takes 1 type argument but 2 type arguments were supplied
|
//~^ ERROR this associated function takes 1
|
||||||
|
|
||||||
let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0);
|
let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0);
|
||||||
//~^ ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
|
//~^ ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
|
||||||
//~| ERROR this associated function takes 1 type argument but 2 type arguments were supplied
|
//~| ERROR this associated function takes 1
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
error[E0107]: this associated function takes 1 type argument but 2 type arguments were supplied
|
error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied
|
||||||
--> $DIR/bad-mid-path-type-params.rs:30:16
|
--> $DIR/bad-mid-path-type-params.rs:30:16
|
||||||
|
|
|
|
||||||
LL | let _ = S::new::<isize,f64>(1, 1.0);
|
LL | let _ = S::new::<isize,f64>(1, 1.0);
|
||||||
| ^^^ ---- help: remove this type argument
|
| ^^^ --- help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected 1 type argument
|
| expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: associated function defined here, with 1 type parameter: `U`
|
note: associated function defined here, with 1 generic parameter: `U`
|
||||||
--> $DIR/bad-mid-path-type-params.rs:6:8
|
--> $DIR/bad-mid-path-type-params.rs:6:8
|
||||||
|
|
|
|
||||||
LL | fn new<U>(x: T, _: U) -> S<T> {
|
LL | fn new<U>(x: T, _: U) -> S<T> {
|
||||||
|
@ -16,7 +16,7 @@ error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was
|
||||||
--> $DIR/bad-mid-path-type-params.rs:33:13
|
--> $DIR/bad-mid-path-type-params.rs:33:13
|
||||||
|
|
|
|
||||||
LL | let _ = S::<'a,isize>::new::<f64>(1, 1.0);
|
LL | let _ = S::<'a,isize>::new::<f64>(1, 1.0);
|
||||||
| ^ --- help: remove this lifetime argument
|
| ^ -- help: remove this lifetime argument
|
||||||
| |
|
| |
|
||||||
| expected 0 lifetime arguments
|
| expected 0 lifetime arguments
|
||||||
|
|
|
|
||||||
|
@ -26,15 +26,15 @@ note: struct defined here, with 0 lifetime parameters
|
||||||
LL | struct S<T> {
|
LL | struct S<T> {
|
||||||
| ^
|
| ^
|
||||||
|
|
||||||
error[E0107]: this associated function takes 1 type argument but 2 type arguments were supplied
|
error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied
|
||||||
--> $DIR/bad-mid-path-type-params.rs:36:24
|
--> $DIR/bad-mid-path-type-params.rs:36:24
|
||||||
|
|
|
|
||||||
LL | let _: S2 = Trait::new::<isize,f64>(1, 1.0);
|
LL | let _: S2 = Trait::new::<isize,f64>(1, 1.0);
|
||||||
| ^^^ ---- help: remove this type argument
|
| ^^^ --- help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected 1 type argument
|
| expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: associated function defined here, with 1 type parameter: `U`
|
note: associated function defined here, with 1 generic parameter: `U`
|
||||||
--> $DIR/bad-mid-path-type-params.rs:14:8
|
--> $DIR/bad-mid-path-type-params.rs:14:8
|
||||||
|
|
|
|
||||||
LL | fn new<U>(x: T, y: U) -> Self;
|
LL | fn new<U>(x: T, y: U) -> Self;
|
||||||
|
@ -44,7 +44,7 @@ error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was
|
||||||
--> $DIR/bad-mid-path-type-params.rs:39:17
|
--> $DIR/bad-mid-path-type-params.rs:39:17
|
||||||
|
|
|
|
||||||
LL | let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0);
|
LL | let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0);
|
||||||
| ^^^^^ --- help: remove this lifetime argument
|
| ^^^^^ -- help: remove this lifetime argument
|
||||||
| |
|
| |
|
||||||
| expected 0 lifetime arguments
|
| expected 0 lifetime arguments
|
||||||
|
|
|
|
||||||
|
@ -54,15 +54,15 @@ note: trait defined here, with 0 lifetime parameters
|
||||||
LL | trait Trait<T> {
|
LL | trait Trait<T> {
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
||||||
error[E0107]: this associated function takes 1 type argument but 2 type arguments were supplied
|
error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied
|
||||||
--> $DIR/bad-mid-path-type-params.rs:39:36
|
--> $DIR/bad-mid-path-type-params.rs:39:36
|
||||||
|
|
|
|
||||||
LL | let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0);
|
LL | let _: S2 = Trait::<'a,isize>::new::<f64,f64>(1, 1.0);
|
||||||
| ^^^ ---- help: remove this type argument
|
| ^^^ --- help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected 1 type argument
|
| expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: associated function defined here, with 1 type parameter: `U`
|
note: associated function defined here, with 1 generic parameter: `U`
|
||||||
--> $DIR/bad-mid-path-type-params.rs:14:8
|
--> $DIR/bad-mid-path-type-params.rs:14:8
|
||||||
|
|
|
|
||||||
LL | fn new<U>(x: T, y: U) -> Self;
|
LL | fn new<U>(x: T, y: U) -> Self;
|
||||||
|
|
|
@ -8,5 +8,5 @@ fn main() {
|
||||||
|
|
||||||
Bar::<'static, 'static, ()>(&());
|
Bar::<'static, 'static, ()>(&());
|
||||||
//~^ ERROR this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
|
//~^ ERROR this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
|
||||||
//~| ERROR this struct takes 0 type arguments but 1 type argument was supplied
|
//~| ERROR this struct takes 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments wer
|
||||||
--> $DIR/generic-arg-mismatch-recover.rs:6:5
|
--> $DIR/generic-arg-mismatch-recover.rs:6:5
|
||||||
|
|
|
|
||||||
LL | Foo::<'static, 'static, ()>(&0);
|
LL | Foo::<'static, 'static, ()>(&0);
|
||||||
| ^^^ --------- help: remove this lifetime argument
|
| ^^^ ------- help: remove this lifetime argument
|
||||||
| |
|
| |
|
||||||
| expected 1 lifetime argument
|
| expected 1 lifetime argument
|
||||||
|
|
|
|
||||||
|
@ -16,7 +16,7 @@ error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments wer
|
||||||
--> $DIR/generic-arg-mismatch-recover.rs:9:5
|
--> $DIR/generic-arg-mismatch-recover.rs:9:5
|
||||||
|
|
|
|
||||||
LL | Bar::<'static, 'static, ()>(&());
|
LL | Bar::<'static, 'static, ()>(&());
|
||||||
| ^^^ --------- help: remove this lifetime argument
|
| ^^^ ------- help: remove this lifetime argument
|
||||||
| |
|
| |
|
||||||
| expected 1 lifetime argument
|
| expected 1 lifetime argument
|
||||||
|
|
|
|
||||||
|
@ -26,15 +26,15 @@ note: struct defined here, with 1 lifetime parameter: `'a`
|
||||||
LL | struct Bar<'a>(&'a ());
|
LL | struct Bar<'a>(&'a ());
|
||||||
| ^^^ --
|
| ^^^ --
|
||||||
|
|
||||||
error[E0107]: this struct takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/generic-arg-mismatch-recover.rs:9:5
|
--> $DIR/generic-arg-mismatch-recover.rs:9:5
|
||||||
|
|
|
|
||||||
LL | Bar::<'static, 'static, ()>(&());
|
LL | Bar::<'static, 'static, ()>(&());
|
||||||
| ^^^ ---- help: remove this type argument
|
| ^^^ -- help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with 0 type parameters
|
note: struct defined here, with 0 generic parameters
|
||||||
--> $DIR/generic-arg-mismatch-recover.rs:3:8
|
--> $DIR/generic-arg-mismatch-recover.rs:3:8
|
||||||
|
|
|
|
||||||
LL | struct Bar<'a>(&'a ());
|
LL | struct Bar<'a>(&'a ());
|
||||||
|
|
|
@ -9,5 +9,5 @@ impl<A, B, C> Foo<A, B, C> {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
Foo::<isize>::new();
|
Foo::<isize>::new();
|
||||||
//~^ ERROR this struct takes at least 2 type arguments but only 1 type argument was supplied
|
//~^ ERROR this struct takes at least 2 generic arguments but 1 generic argument
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
error[E0107]: this struct takes at least 2 type arguments but only 1 type argument was supplied
|
error[E0107]: this struct takes at least 2 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/generic-impl-less-params-with-defaults.rs:11:5
|
--> $DIR/generic-impl-less-params-with-defaults.rs:11:5
|
||||||
|
|
|
|
||||||
LL | Foo::<isize>::new();
|
LL | Foo::<isize>::new();
|
||||||
| ^^^ ----- supplied 1 type argument
|
| ^^^ ----- supplied 1 generic argument
|
||||||
| |
|
| |
|
||||||
| expected at least 2 type arguments
|
| expected at least 2 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with at least 2 type parameters: `A`, `B`
|
note: struct defined here, with at least 2 generic parameters: `A`, `B`
|
||||||
--> $DIR/generic-impl-less-params-with-defaults.rs:3:8
|
--> $DIR/generic-impl-less-params-with-defaults.rs:3:8
|
||||||
|
|
|
|
||||||
LL | struct Foo<A, B, C = (A, B)>(
|
LL | struct Foo<A, B, C = (A, B)>(
|
||||||
| ^^^ - -
|
| ^^^ - -
|
||||||
help: add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | Foo::<isize, B>::new();
|
LL | Foo::<isize, B>::new();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
@ -11,5 +11,5 @@ impl<T, A> Vec<T, A> {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
Vec::<isize, Heap, bool>::new();
|
Vec::<isize, Heap, bool>::new();
|
||||||
//~^ ERROR this struct takes at most 2 type arguments but 3 type arguments were supplied
|
//~^ ERROR this struct takes at most 2 generic arguments but 3 generic arguments were supplied
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
error[E0107]: this struct takes at most 2 type arguments but 3 type arguments were supplied
|
error[E0107]: this struct takes at most 2 generic arguments but 3 generic arguments were supplied
|
||||||
--> $DIR/generic-impl-more-params-with-defaults.rs:13:5
|
--> $DIR/generic-impl-more-params-with-defaults.rs:13:5
|
||||||
|
|
|
|
||||||
LL | Vec::<isize, Heap, bool>::new();
|
LL | Vec::<isize, Heap, bool>::new();
|
||||||
| ^^^ ------ help: remove this type argument
|
| ^^^ ---- help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected at most 2 type arguments
|
| expected at most 2 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with at most 2 type parameters: `T`, `A`
|
note: struct defined here, with at most 2 generic parameters: `T`, `A`
|
||||||
--> $DIR/generic-impl-more-params-with-defaults.rs:5:8
|
--> $DIR/generic-impl-more-params-with-defaults.rs:5:8
|
||||||
|
|
|
|
||||||
LL | struct Vec<T, A = Heap>(
|
LL | struct Vec<T, A = Heap>(
|
||||||
|
|
|
@ -2,17 +2,17 @@ error[E0107]: missing generics for struct `Vec`
|
||||||
--> $DIR/generic-type-less-params-with-defaults.rs:9:12
|
--> $DIR/generic-type-less-params-with-defaults.rs:9:12
|
||||||
|
|
|
|
||||||
LL | let _: Vec;
|
LL | let _: Vec;
|
||||||
| ^^^ expected at least 1 type argument
|
| ^^^ expected at least 1 generic argument
|
||||||
|
|
|
|
||||||
note: struct defined here, with at least 1 type parameter: `T`
|
note: struct defined here, with at least 1 generic parameter: `T`
|
||||||
--> $DIR/generic-type-less-params-with-defaults.rs:5:8
|
--> $DIR/generic-type-less-params-with-defaults.rs:5:8
|
||||||
|
|
|
|
||||||
LL | struct Vec<T, A = Heap>(
|
LL | struct Vec<T, A = Heap>(
|
||||||
| ^^^ -
|
| ^^^ -
|
||||||
help: use angle brackets to add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | let _: Vec<T>;
|
LL | let _: Vec<T>;
|
||||||
| ^^^
|
| ^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -7,5 +7,5 @@ struct Vec<T, A = Heap>(
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _: Vec<isize, Heap, bool>;
|
let _: Vec<isize, Heap, bool>;
|
||||||
//~^ ERROR this struct takes at most 2 type arguments but 3 type arguments were supplied
|
//~^ ERROR this struct takes at most 2 generic arguments but 3 generic arguments
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
error[E0107]: this struct takes at most 2 type arguments but 3 type arguments were supplied
|
error[E0107]: this struct takes at most 2 generic arguments but 3 generic arguments were supplied
|
||||||
--> $DIR/generic-type-more-params-with-defaults.rs:9:12
|
--> $DIR/generic-type-more-params-with-defaults.rs:9:12
|
||||||
|
|
|
|
||||||
LL | let _: Vec<isize, Heap, bool>;
|
LL | let _: Vec<isize, Heap, bool>;
|
||||||
| ^^^ ------ help: remove this type argument
|
| ^^^ ---- help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected at most 2 type arguments
|
| expected at most 2 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with at most 2 type parameters: `T`, `A`
|
note: struct defined here, with at most 2 generic parameters: `T`, `A`
|
||||||
--> $DIR/generic-type-more-params-with-defaults.rs:5:8
|
--> $DIR/generic-type-more-params-with-defaults.rs:5:8
|
||||||
|
|
|
|
||||||
LL | struct Vec<T, A = Heap>(
|
LL | struct Vec<T, A = Heap>(
|
||||||
|
|
|
@ -4,18 +4,18 @@ mod no_generics {
|
||||||
type A = Ty;
|
type A = Ty;
|
||||||
|
|
||||||
type B = Ty<'static>;
|
type B = Ty<'static>;
|
||||||
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
|
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument
|
||||||
//~| HELP remove these generics
|
//~| HELP remove these generics
|
||||||
|
|
||||||
type C = Ty<'static, usize>;
|
type C = Ty<'static, usize>;
|
||||||
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
|
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument
|
||||||
//~| ERROR this struct takes 0 type arguments but 1 type argument was supplied
|
//~| ERROR this struct takes 0 generic arguments but 1 generic argument
|
||||||
//~| HELP remove this lifetime argument
|
//~| HELP remove this lifetime argument
|
||||||
//~| HELP remove this type argument
|
//~| HELP remove this generic argument
|
||||||
|
|
||||||
type D = Ty<'static, usize, { 0 }>;
|
type D = Ty<'static, usize, { 0 }>;
|
||||||
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
|
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument
|
||||||
//~| ERROR this struct takes 0 generic arguments but 2 generic arguments were supplied
|
//~| ERROR this struct takes 0 generic arguments but 2 generic arguments
|
||||||
//~| HELP remove this lifetime argument
|
//~| HELP remove this lifetime argument
|
||||||
//~| HELP remove these generic arguments
|
//~| HELP remove these generic arguments
|
||||||
}
|
}
|
||||||
|
@ -25,31 +25,31 @@ mod type_and_type {
|
||||||
|
|
||||||
type A = Ty;
|
type A = Ty;
|
||||||
//~^ ERROR missing generics for struct `type_and_type::Ty`
|
//~^ ERROR missing generics for struct `type_and_type::Ty`
|
||||||
//~| HELP use angle brackets
|
//~| HELP add missing
|
||||||
|
|
||||||
type B = Ty<usize>;
|
type B = Ty<usize>;
|
||||||
//~^ ERROR this struct takes 2 type arguments but only 1 type argument was supplied
|
//~^ ERROR this struct takes 2 generic arguments but 1 generic argument
|
||||||
//~| HELP add missing type argument
|
//~| HELP add missing
|
||||||
|
|
||||||
type C = Ty<usize, String>;
|
type C = Ty<usize, String>;
|
||||||
|
|
||||||
type D = Ty<usize, String, char>;
|
type D = Ty<usize, String, char>;
|
||||||
//~^ ERROR this struct takes 2 type arguments but 3 type arguments were supplied
|
//~^ ERROR this struct takes 2 generic arguments but 3 generic arguments
|
||||||
//~| HELP remove this type argument
|
//~| HELP remove this
|
||||||
}
|
}
|
||||||
|
|
||||||
mod lifetime_and_type {
|
mod lifetime_and_type {
|
||||||
struct Ty<'a, T>;
|
struct Ty<'a, T>;
|
||||||
|
|
||||||
type A = Ty;
|
type A = Ty;
|
||||||
//~^ ERROR missing generics for struct `lifetime_and_type::Ty`
|
//~^ ERROR missing generics for struct
|
||||||
//~| ERROR missing lifetime specifier
|
//~| ERROR missing lifetime specifier
|
||||||
|
//~| HELP add missing
|
||||||
//~| HELP consider introducing
|
//~| HELP consider introducing
|
||||||
//~| HELP use angle brackets
|
|
||||||
|
|
||||||
type B = Ty<'static>;
|
type B = Ty<'static>;
|
||||||
//~^ ERROR this struct takes 1 type argument but 0 type arguments were supplied
|
//~^ ERROR this struct takes 1 generic argument but 0 generic arguments
|
||||||
//~| HELP add missing type argument
|
//~| HELP add missing
|
||||||
|
|
||||||
type C = Ty<usize>;
|
type C = Ty<usize>;
|
||||||
//~^ ERROR missing lifetime specifier
|
//~^ ERROR missing lifetime specifier
|
||||||
|
@ -63,18 +63,18 @@ mod type_and_type_and_type {
|
||||||
|
|
||||||
type A = Ty;
|
type A = Ty;
|
||||||
//~^ ERROR missing generics for struct `type_and_type_and_type::Ty`
|
//~^ ERROR missing generics for struct `type_and_type_and_type::Ty`
|
||||||
//~| HELP use angle brackets
|
//~| HELP add missing
|
||||||
|
|
||||||
type B = Ty<usize>;
|
type B = Ty<usize>;
|
||||||
//~^ ERROR this struct takes at least 2 type arguments but only 1 type argument was supplied
|
//~^ ERROR this struct takes at least 2
|
||||||
//~| HELP add missing type argument
|
//~| HELP add missing
|
||||||
|
|
||||||
type C = Ty<usize, String>;
|
type C = Ty<usize, String>;
|
||||||
|
|
||||||
type D = Ty<usize, String, char>;
|
type D = Ty<usize, String, char>;
|
||||||
|
|
||||||
type E = Ty<usize, String, char, f64>;
|
type E = Ty<usize, String, char, f64>;
|
||||||
//~^ ERROR this struct takes at most 3 type arguments but 4 type arguments were supplied
|
//~^ ERROR this struct takes at most 3
|
||||||
//~| HELP remove
|
//~| HELP remove
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ mod r#trait {
|
||||||
}
|
}
|
||||||
|
|
||||||
type A = Box<dyn NonGeneric<usize>>;
|
type A = Box<dyn NonGeneric<usize>>;
|
||||||
//~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied
|
//~^ ERROR this trait takes 0 generic arguments but 1 generic argument
|
||||||
//~| HELP remove
|
//~| HELP remove
|
||||||
|
|
||||||
type B = Box<dyn GenericLifetime>;
|
type B = Box<dyn GenericLifetime>;
|
||||||
|
@ -107,10 +107,10 @@ mod r#trait {
|
||||||
|
|
||||||
type D = Box<dyn GenericType>;
|
type D = Box<dyn GenericType>;
|
||||||
//~^ ERROR missing generics for trait `GenericType`
|
//~^ ERROR missing generics for trait `GenericType`
|
||||||
//~| HELP use angle brackets
|
//~| HELP add missing
|
||||||
|
|
||||||
type E = Box<dyn GenericType<String, usize>>;
|
type E = Box<dyn GenericType<String, usize>>;
|
||||||
//~^ ERROR this trait takes 1 type argument but 2 type arguments were supplied
|
//~^ ERROR this trait takes 1 generic argument but 2 generic arguments
|
||||||
//~| HELP remove
|
//~| HELP remove
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,40 +120,40 @@ mod stdlib {
|
||||||
|
|
||||||
type A = HashMap;
|
type A = HashMap;
|
||||||
//~^ ERROR missing generics for struct `HashMap`
|
//~^ ERROR missing generics for struct `HashMap`
|
||||||
//~| HELP use angle brackets
|
//~| HELP add missing
|
||||||
|
|
||||||
type B = HashMap<String>;
|
type B = HashMap<String>;
|
||||||
//~^ ERROR this struct takes at least 2 type arguments but only 1 type argument was supplied
|
//~^ ERROR this struct takes at least
|
||||||
//~| HELP add missing type argument
|
//~| HELP add missing
|
||||||
|
|
||||||
type C = HashMap<'static>;
|
type C = HashMap<'static>;
|
||||||
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
|
//~^ ERROR this struct takes 0 lifetime arguments but 1 lifetime argument
|
||||||
//~| HELP remove these generics
|
//~| HELP remove these generics
|
||||||
//~| ERROR this struct takes at least 2 type arguments but 0 type arguments were supplied
|
//~| ERROR this struct takes at least 2
|
||||||
//~| HELP add missing type arguments
|
//~| HELP add missing
|
||||||
|
|
||||||
type D = HashMap<usize, String, char, f64>;
|
type D = HashMap<usize, String, char, f64>;
|
||||||
//~^ ERROR this struct takes at most 3 type arguments but 4 type arguments were supplied
|
//~^ ERROR this struct takes at most 3
|
||||||
//~| HELP remove this type argument
|
//~| HELP remove this
|
||||||
}
|
}
|
||||||
|
|
||||||
mod result {
|
mod result {
|
||||||
type A = Result;
|
type A = Result;
|
||||||
//~^ ERROR missing generics for enum `Result`
|
//~^ ERROR missing generics for enum `Result`
|
||||||
//~| HELP use angle brackets
|
//~| HELP add missing
|
||||||
|
|
||||||
type B = Result<String>;
|
type B = Result<String>;
|
||||||
//~^ ERROR this enum takes 2 type arguments but only 1 type argument was supplied
|
//~^ ERROR this enum takes 2 generic arguments but 1 generic argument
|
||||||
//~| HELP add missing type argument
|
//~| HELP add missing
|
||||||
|
|
||||||
type C = Result<'static>;
|
type C = Result<'static>;
|
||||||
//~^ ERROR this enum takes 0 lifetime arguments but 1 lifetime argument was supplied
|
//~^ ERROR this enum takes 0 lifetime arguments but 1 lifetime argument
|
||||||
//~| HELP remove these generics
|
//~| HELP remove these generics
|
||||||
//~| ERROR this enum takes 2 type arguments but 0 type arguments were supplied
|
//~| ERROR this enum takes 2 generic arguments but 0 generic arguments
|
||||||
//~| HELP add missing type arguments
|
//~| HELP add missing
|
||||||
|
|
||||||
type D = Result<usize, String, char>;
|
type D = Result<usize, String, char>;
|
||||||
//~^ ERROR this enum takes 2 type arguments but 3 type arguments were supplied
|
//~^ ERROR this enum takes 2 generic arguments but 3 generic arguments
|
||||||
//~| HELP remove
|
//~| HELP remove
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was
|
||||||
--> $DIR/wrong-number-of-args.rs:10:14
|
--> $DIR/wrong-number-of-args.rs:10:14
|
||||||
|
|
|
|
||||||
LL | type C = Ty<'static, usize>;
|
LL | type C = Ty<'static, usize>;
|
||||||
| ^^ --------- help: remove this lifetime argument
|
| ^^ ------- help: remove this lifetime argument
|
||||||
| |
|
| |
|
||||||
| expected 0 lifetime arguments
|
| expected 0 lifetime arguments
|
||||||
|
|
|
|
||||||
|
@ -26,15 +26,15 @@ note: struct defined here, with 0 lifetime parameters
|
||||||
LL | struct Ty;
|
LL | struct Ty;
|
||||||
| ^^
|
| ^^
|
||||||
|
|
||||||
error[E0107]: this struct takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/wrong-number-of-args.rs:10:14
|
--> $DIR/wrong-number-of-args.rs:10:14
|
||||||
|
|
|
|
||||||
LL | type C = Ty<'static, usize>;
|
LL | type C = Ty<'static, usize>;
|
||||||
| ^^ ------- help: remove this type argument
|
| ^^ ----- help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with 0 type parameters
|
note: struct defined here, with 0 generic parameters
|
||||||
--> $DIR/wrong-number-of-args.rs:2:12
|
--> $DIR/wrong-number-of-args.rs:2:12
|
||||||
|
|
|
|
||||||
LL | struct Ty;
|
LL | struct Ty;
|
||||||
|
@ -44,7 +44,7 @@ error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was
|
||||||
--> $DIR/wrong-number-of-args.rs:16:14
|
--> $DIR/wrong-number-of-args.rs:16:14
|
||||||
|
|
|
|
||||||
LL | type D = Ty<'static, usize, { 0 }>;
|
LL | type D = Ty<'static, usize, { 0 }>;
|
||||||
| ^^ --------- help: remove this lifetime argument
|
| ^^ ------- help: remove this lifetime argument
|
||||||
| |
|
| |
|
||||||
| expected 0 lifetime arguments
|
| expected 0 lifetime arguments
|
||||||
|
|
|
|
||||||
|
@ -58,7 +58,7 @@ error[E0107]: this struct takes 0 generic arguments but 2 generic arguments were
|
||||||
--> $DIR/wrong-number-of-args.rs:16:14
|
--> $DIR/wrong-number-of-args.rs:16:14
|
||||||
|
|
|
|
||||||
LL | type D = Ty<'static, usize, { 0 }>;
|
LL | type D = Ty<'static, usize, { 0 }>;
|
||||||
| ^^ -------------- help: remove these generic arguments
|
| ^^ ------------ help: remove these generic arguments
|
||||||
| |
|
| |
|
||||||
| expected 0 generic arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
|
@ -72,45 +72,45 @@ error[E0107]: missing generics for struct `type_and_type::Ty`
|
||||||
--> $DIR/wrong-number-of-args.rs:26:14
|
--> $DIR/wrong-number-of-args.rs:26:14
|
||||||
|
|
|
|
||||||
LL | type A = Ty;
|
LL | type A = Ty;
|
||||||
| ^^ expected 2 type arguments
|
| ^^ expected 2 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with 2 type parameters: `A`, `B`
|
note: struct defined here, with 2 generic parameters: `A`, `B`
|
||||||
--> $DIR/wrong-number-of-args.rs:24:12
|
--> $DIR/wrong-number-of-args.rs:24:12
|
||||||
|
|
|
|
||||||
LL | struct Ty<A, B>;
|
LL | struct Ty<A, B>;
|
||||||
| ^^ - -
|
| ^^ - -
|
||||||
help: use angle brackets to add missing type arguments
|
help: add missing generic arguments
|
||||||
|
|
|
|
||||||
LL | type A = Ty<A, B>;
|
LL | type A = Ty<A, B>;
|
||||||
| ^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error[E0107]: this struct takes 2 type arguments but only 1 type argument was supplied
|
error[E0107]: this struct takes 2 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/wrong-number-of-args.rs:30:14
|
--> $DIR/wrong-number-of-args.rs:30:14
|
||||||
|
|
|
|
||||||
LL | type B = Ty<usize>;
|
LL | type B = Ty<usize>;
|
||||||
| ^^ ----- supplied 1 type argument
|
| ^^ ----- supplied 1 generic argument
|
||||||
| |
|
| |
|
||||||
| expected 2 type arguments
|
| expected 2 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with 2 type parameters: `A`, `B`
|
note: struct defined here, with 2 generic parameters: `A`, `B`
|
||||||
--> $DIR/wrong-number-of-args.rs:24:12
|
--> $DIR/wrong-number-of-args.rs:24:12
|
||||||
|
|
|
|
||||||
LL | struct Ty<A, B>;
|
LL | struct Ty<A, B>;
|
||||||
| ^^ - -
|
| ^^ - -
|
||||||
help: add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | type B = Ty<usize, B>;
|
LL | type B = Ty<usize, B>;
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error[E0107]: this struct takes 2 type arguments but 3 type arguments were supplied
|
error[E0107]: this struct takes 2 generic arguments but 3 generic arguments were supplied
|
||||||
--> $DIR/wrong-number-of-args.rs:36:14
|
--> $DIR/wrong-number-of-args.rs:36:14
|
||||||
|
|
|
|
||||||
LL | type D = Ty<usize, String, char>;
|
LL | type D = Ty<usize, String, char>;
|
||||||
| ^^ ------ help: remove this type argument
|
| ^^ ---- help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected 2 type arguments
|
| expected 2 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with 2 type parameters: `A`, `B`
|
note: struct defined here, with 2 generic parameters: `A`, `B`
|
||||||
--> $DIR/wrong-number-of-args.rs:24:12
|
--> $DIR/wrong-number-of-args.rs:24:12
|
||||||
|
|
|
|
||||||
LL | struct Ty<A, B>;
|
LL | struct Ty<A, B>;
|
||||||
|
@ -120,17 +120,17 @@ error[E0107]: missing generics for struct `lifetime_and_type::Ty`
|
||||||
--> $DIR/wrong-number-of-args.rs:44:14
|
--> $DIR/wrong-number-of-args.rs:44:14
|
||||||
|
|
|
|
||||||
LL | type A = Ty;
|
LL | type A = Ty;
|
||||||
| ^^ expected 1 type argument
|
| ^^ expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: struct defined here, with 1 type parameter: `T`
|
note: struct defined here, with 1 generic parameter: `T`
|
||||||
--> $DIR/wrong-number-of-args.rs:42:12
|
--> $DIR/wrong-number-of-args.rs:42:12
|
||||||
|
|
|
|
||||||
LL | struct Ty<'a, T>;
|
LL | struct Ty<'a, T>;
|
||||||
| ^^ -
|
| ^^ -
|
||||||
help: use angle brackets to add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | type A = Ty<T>;
|
LL | type A = Ty<T>;
|
||||||
| ^^^
|
| ^^^^^
|
||||||
|
|
||||||
error[E0106]: missing lifetime specifier
|
error[E0106]: missing lifetime specifier
|
||||||
--> $DIR/wrong-number-of-args.rs:44:14
|
--> $DIR/wrong-number-of-args.rs:44:14
|
||||||
|
@ -143,18 +143,18 @@ help: consider introducing a named lifetime parameter
|
||||||
LL | type A<'a> = Ty<'a>;
|
LL | type A<'a> = Ty<'a>;
|
||||||
| ^^^^ ^^^^^^
|
| ^^^^ ^^^^^^
|
||||||
|
|
||||||
error[E0107]: this struct takes 1 type argument but 0 type arguments were supplied
|
error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied
|
||||||
--> $DIR/wrong-number-of-args.rs:50:14
|
--> $DIR/wrong-number-of-args.rs:50:14
|
||||||
|
|
|
|
||||||
LL | type B = Ty<'static>;
|
LL | type B = Ty<'static>;
|
||||||
| ^^ expected 1 type argument
|
| ^^ expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: struct defined here, with 1 type parameter: `T`
|
note: struct defined here, with 1 generic parameter: `T`
|
||||||
--> $DIR/wrong-number-of-args.rs:42:12
|
--> $DIR/wrong-number-of-args.rs:42:12
|
||||||
|
|
|
|
||||||
LL | struct Ty<'a, T>;
|
LL | struct Ty<'a, T>;
|
||||||
| ^^ -
|
| ^^ -
|
||||||
help: add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | type B = Ty<'static, T>;
|
LL | type B = Ty<'static, T>;
|
||||||
| ^^^
|
| ^^^
|
||||||
|
@ -174,59 +174,59 @@ error[E0107]: missing generics for struct `type_and_type_and_type::Ty`
|
||||||
--> $DIR/wrong-number-of-args.rs:64:14
|
--> $DIR/wrong-number-of-args.rs:64:14
|
||||||
|
|
|
|
||||||
LL | type A = Ty;
|
LL | type A = Ty;
|
||||||
| ^^ expected at least 2 type arguments
|
| ^^ expected at least 2 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with at least 2 type parameters: `A`, `B`
|
note: struct defined here, with at least 2 generic parameters: `A`, `B`
|
||||||
--> $DIR/wrong-number-of-args.rs:62:12
|
--> $DIR/wrong-number-of-args.rs:62:12
|
||||||
|
|
|
|
||||||
LL | struct Ty<A, B, C = &'static str>;
|
LL | struct Ty<A, B, C = &'static str>;
|
||||||
| ^^ - -
|
| ^^ - -
|
||||||
help: use angle brackets to add missing type arguments
|
help: add missing generic arguments
|
||||||
|
|
|
|
||||||
LL | type A = Ty<A, B>;
|
LL | type A = Ty<A, B>;
|
||||||
| ^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error[E0107]: this struct takes at least 2 type arguments but only 1 type argument was supplied
|
error[E0107]: this struct takes at least 2 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/wrong-number-of-args.rs:68:14
|
--> $DIR/wrong-number-of-args.rs:68:14
|
||||||
|
|
|
|
||||||
LL | type B = Ty<usize>;
|
LL | type B = Ty<usize>;
|
||||||
| ^^ ----- supplied 1 type argument
|
| ^^ ----- supplied 1 generic argument
|
||||||
| |
|
| |
|
||||||
| expected at least 2 type arguments
|
| expected at least 2 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with at least 2 type parameters: `A`, `B`
|
note: struct defined here, with at least 2 generic parameters: `A`, `B`
|
||||||
--> $DIR/wrong-number-of-args.rs:62:12
|
--> $DIR/wrong-number-of-args.rs:62:12
|
||||||
|
|
|
|
||||||
LL | struct Ty<A, B, C = &'static str>;
|
LL | struct Ty<A, B, C = &'static str>;
|
||||||
| ^^ - -
|
| ^^ - -
|
||||||
help: add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | type B = Ty<usize, B>;
|
LL | type B = Ty<usize, B>;
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error[E0107]: this struct takes at most 3 type arguments but 4 type arguments were supplied
|
error[E0107]: this struct takes at most 3 generic arguments but 4 generic arguments were supplied
|
||||||
--> $DIR/wrong-number-of-args.rs:76:14
|
--> $DIR/wrong-number-of-args.rs:76:14
|
||||||
|
|
|
|
||||||
LL | type E = Ty<usize, String, char, f64>;
|
LL | type E = Ty<usize, String, char, f64>;
|
||||||
| ^^ ----- help: remove this type argument
|
| ^^ --- help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected at most 3 type arguments
|
| expected at most 3 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with at most 3 type parameters: `A`, `B`, `C`
|
note: struct defined here, with at most 3 generic parameters: `A`, `B`, `C`
|
||||||
--> $DIR/wrong-number-of-args.rs:62:12
|
--> $DIR/wrong-number-of-args.rs:62:12
|
||||||
|
|
|
|
||||||
LL | struct Ty<A, B, C = &'static str>;
|
LL | struct Ty<A, B, C = &'static str>;
|
||||||
| ^^ - - -
|
| ^^ - - -
|
||||||
|
|
||||||
error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/wrong-number-of-args.rs:96:22
|
--> $DIR/wrong-number-of-args.rs:96:22
|
||||||
|
|
|
|
||||||
LL | type A = Box<dyn NonGeneric<usize>>;
|
LL | type A = Box<dyn NonGeneric<usize>>;
|
||||||
| ^^^^^^^^^^------- help: remove these generics
|
| ^^^^^^^^^^------- help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: trait defined here, with 0 type parameters
|
note: trait defined here, with 0 generic parameters
|
||||||
--> $DIR/wrong-number-of-args.rs:84:11
|
--> $DIR/wrong-number-of-args.rs:84:11
|
||||||
|
|
|
|
||||||
LL | trait NonGeneric {
|
LL | trait NonGeneric {
|
||||||
|
@ -247,7 +247,7 @@ error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were
|
||||||
--> $DIR/wrong-number-of-args.rs:104:22
|
--> $DIR/wrong-number-of-args.rs:104:22
|
||||||
|
|
|
|
||||||
LL | type C = Box<dyn GenericLifetime<'static, 'static>>;
|
LL | type C = Box<dyn GenericLifetime<'static, 'static>>;
|
||||||
| ^^^^^^^^^^^^^^^ --------- help: remove this lifetime argument
|
| ^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument
|
||||||
| |
|
| |
|
||||||
| expected 1 lifetime argument
|
| expected 1 lifetime argument
|
||||||
|
|
|
|
||||||
|
@ -261,27 +261,27 @@ error[E0107]: missing generics for trait `GenericType`
|
||||||
--> $DIR/wrong-number-of-args.rs:108:22
|
--> $DIR/wrong-number-of-args.rs:108:22
|
||||||
|
|
|
|
||||||
LL | type D = Box<dyn GenericType>;
|
LL | type D = Box<dyn GenericType>;
|
||||||
| ^^^^^^^^^^^ expected 1 type argument
|
| ^^^^^^^^^^^ expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: trait defined here, with 1 type parameter: `A`
|
note: trait defined here, with 1 generic parameter: `A`
|
||||||
--> $DIR/wrong-number-of-args.rs:92:11
|
--> $DIR/wrong-number-of-args.rs:92:11
|
||||||
|
|
|
|
||||||
LL | trait GenericType<A> {
|
LL | trait GenericType<A> {
|
||||||
| ^^^^^^^^^^^ -
|
| ^^^^^^^^^^^ -
|
||||||
help: use angle brackets to add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | type D = Box<dyn GenericType<A>>;
|
LL | type D = Box<dyn GenericType<A>>;
|
||||||
| ^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0107]: this trait takes 1 type argument but 2 type arguments were supplied
|
error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied
|
||||||
--> $DIR/wrong-number-of-args.rs:112:22
|
--> $DIR/wrong-number-of-args.rs:112:22
|
||||||
|
|
|
|
||||||
LL | type E = Box<dyn GenericType<String, usize>>;
|
LL | type E = Box<dyn GenericType<String, usize>>;
|
||||||
| ^^^^^^^^^^^ ------- help: remove this type argument
|
| ^^^^^^^^^^^ ----- help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected 1 type argument
|
| expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: trait defined here, with 1 type parameter: `A`
|
note: trait defined here, with 1 generic parameter: `A`
|
||||||
--> $DIR/wrong-number-of-args.rs:92:11
|
--> $DIR/wrong-number-of-args.rs:92:11
|
||||||
|
|
|
|
||||||
LL | trait GenericType<A> {
|
LL | trait GenericType<A> {
|
||||||
|
@ -291,32 +291,32 @@ error[E0107]: missing generics for struct `HashMap`
|
||||||
--> $DIR/wrong-number-of-args.rs:121:18
|
--> $DIR/wrong-number-of-args.rs:121:18
|
||||||
|
|
|
|
||||||
LL | type A = HashMap;
|
LL | type A = HashMap;
|
||||||
| ^^^^^^^ expected at least 2 type arguments
|
| ^^^^^^^ expected at least 2 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with at least 2 type parameters: `K`, `V`
|
note: struct defined here, with at least 2 generic parameters: `K`, `V`
|
||||||
--> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
|
--> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub struct HashMap<K, V, S = RandomState> {
|
LL | pub struct HashMap<K, V, S = RandomState> {
|
||||||
| ^^^^^^^ - -
|
| ^^^^^^^ - -
|
||||||
help: use angle brackets to add missing type arguments
|
help: add missing generic arguments
|
||||||
|
|
|
|
||||||
LL | type A = HashMap<K, V>;
|
LL | type A = HashMap<K, V>;
|
||||||
| ^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0107]: this struct takes at least 2 type arguments but only 1 type argument was supplied
|
error[E0107]: this struct takes at least 2 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/wrong-number-of-args.rs:125:18
|
--> $DIR/wrong-number-of-args.rs:125:18
|
||||||
|
|
|
|
||||||
LL | type B = HashMap<String>;
|
LL | type B = HashMap<String>;
|
||||||
| ^^^^^^^ ------ supplied 1 type argument
|
| ^^^^^^^ ------ supplied 1 generic argument
|
||||||
| |
|
| |
|
||||||
| expected at least 2 type arguments
|
| expected at least 2 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with at least 2 type parameters: `K`, `V`
|
note: struct defined here, with at least 2 generic parameters: `K`, `V`
|
||||||
--> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
|
--> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub struct HashMap<K, V, S = RandomState> {
|
LL | pub struct HashMap<K, V, S = RandomState> {
|
||||||
| ^^^^^^^ - -
|
| ^^^^^^^ - -
|
||||||
help: add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | type B = HashMap<String, V>;
|
LL | type B = HashMap<String, V>;
|
||||||
| ^^^
|
| ^^^
|
||||||
|
@ -335,31 +335,31 @@ note: struct defined here, with 0 lifetime parameters
|
||||||
LL | pub struct HashMap<K, V, S = RandomState> {
|
LL | pub struct HashMap<K, V, S = RandomState> {
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
||||||
error[E0107]: this struct takes at least 2 type arguments but 0 type arguments were supplied
|
error[E0107]: this struct takes at least 2 generic arguments but 0 generic arguments were supplied
|
||||||
--> $DIR/wrong-number-of-args.rs:129:18
|
--> $DIR/wrong-number-of-args.rs:129:18
|
||||||
|
|
|
|
||||||
LL | type C = HashMap<'static>;
|
LL | type C = HashMap<'static>;
|
||||||
| ^^^^^^^ expected at least 2 type arguments
|
| ^^^^^^^ expected at least 2 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with at least 2 type parameters: `K`, `V`
|
note: struct defined here, with at least 2 generic parameters: `K`, `V`
|
||||||
--> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
|
--> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub struct HashMap<K, V, S = RandomState> {
|
LL | pub struct HashMap<K, V, S = RandomState> {
|
||||||
| ^^^^^^^ - -
|
| ^^^^^^^ - -
|
||||||
help: add missing type arguments
|
help: add missing generic arguments
|
||||||
|
|
|
|
||||||
LL | type C = HashMap<'static, K, V>;
|
LL | type C = HashMap<'static, K, V>;
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
||||||
error[E0107]: this struct takes at most 3 type arguments but 4 type arguments were supplied
|
error[E0107]: this struct takes at most 3 generic arguments but 4 generic arguments were supplied
|
||||||
--> $DIR/wrong-number-of-args.rs:135:18
|
--> $DIR/wrong-number-of-args.rs:135:18
|
||||||
|
|
|
|
||||||
LL | type D = HashMap<usize, String, char, f64>;
|
LL | type D = HashMap<usize, String, char, f64>;
|
||||||
| ^^^^^^^ ----- help: remove this type argument
|
| ^^^^^^^ --- help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected at most 3 type arguments
|
| expected at most 3 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with at most 3 type parameters: `K`, `V`, `S`
|
note: struct defined here, with at most 3 generic parameters: `K`, `V`, `S`
|
||||||
--> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
|
--> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub struct HashMap<K, V, S = RandomState> {
|
LL | pub struct HashMap<K, V, S = RandomState> {
|
||||||
|
@ -369,32 +369,32 @@ error[E0107]: missing generics for enum `Result`
|
||||||
--> $DIR/wrong-number-of-args.rs:141:18
|
--> $DIR/wrong-number-of-args.rs:141:18
|
||||||
|
|
|
|
||||||
LL | type A = Result;
|
LL | type A = Result;
|
||||||
| ^^^^^^ expected 2 type arguments
|
| ^^^^^^ expected 2 generic arguments
|
||||||
|
|
|
|
||||||
note: enum defined here, with 2 type parameters: `T`, `E`
|
note: enum defined here, with 2 generic parameters: `T`, `E`
|
||||||
--> $SRC_DIR/core/src/result.rs:LL:COL
|
--> $SRC_DIR/core/src/result.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub enum Result<T, E> {
|
LL | pub enum Result<T, E> {
|
||||||
| ^^^^^^ - -
|
| ^^^^^^ - -
|
||||||
help: use angle brackets to add missing type arguments
|
help: add missing generic arguments
|
||||||
|
|
|
|
||||||
LL | type A = Result<T, E>;
|
LL | type A = Result<T, E>;
|
||||||
| ^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0107]: this enum takes 2 type arguments but only 1 type argument was supplied
|
error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/wrong-number-of-args.rs:145:18
|
--> $DIR/wrong-number-of-args.rs:145:18
|
||||||
|
|
|
|
||||||
LL | type B = Result<String>;
|
LL | type B = Result<String>;
|
||||||
| ^^^^^^ ------ supplied 1 type argument
|
| ^^^^^^ ------ supplied 1 generic argument
|
||||||
| |
|
| |
|
||||||
| expected 2 type arguments
|
| expected 2 generic arguments
|
||||||
|
|
|
|
||||||
note: enum defined here, with 2 type parameters: `T`, `E`
|
note: enum defined here, with 2 generic parameters: `T`, `E`
|
||||||
--> $SRC_DIR/core/src/result.rs:LL:COL
|
--> $SRC_DIR/core/src/result.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub enum Result<T, E> {
|
LL | pub enum Result<T, E> {
|
||||||
| ^^^^^^ - -
|
| ^^^^^^ - -
|
||||||
help: add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | type B = Result<String, E>;
|
LL | type B = Result<String, E>;
|
||||||
| ^^^
|
| ^^^
|
||||||
|
@ -413,31 +413,31 @@ note: enum defined here, with 0 lifetime parameters
|
||||||
LL | pub enum Result<T, E> {
|
LL | pub enum Result<T, E> {
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
||||||
error[E0107]: this enum takes 2 type arguments but 0 type arguments were supplied
|
error[E0107]: this enum takes 2 generic arguments but 0 generic arguments were supplied
|
||||||
--> $DIR/wrong-number-of-args.rs:149:18
|
--> $DIR/wrong-number-of-args.rs:149:18
|
||||||
|
|
|
|
||||||
LL | type C = Result<'static>;
|
LL | type C = Result<'static>;
|
||||||
| ^^^^^^ expected 2 type arguments
|
| ^^^^^^ expected 2 generic arguments
|
||||||
|
|
|
|
||||||
note: enum defined here, with 2 type parameters: `T`, `E`
|
note: enum defined here, with 2 generic parameters: `T`, `E`
|
||||||
--> $SRC_DIR/core/src/result.rs:LL:COL
|
--> $SRC_DIR/core/src/result.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub enum Result<T, E> {
|
LL | pub enum Result<T, E> {
|
||||||
| ^^^^^^ - -
|
| ^^^^^^ - -
|
||||||
help: add missing type arguments
|
help: add missing generic arguments
|
||||||
|
|
|
|
||||||
LL | type C = Result<'static, T, E>;
|
LL | type C = Result<'static, T, E>;
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
||||||
error[E0107]: this enum takes 2 type arguments but 3 type arguments were supplied
|
error[E0107]: this enum takes 2 generic arguments but 3 generic arguments were supplied
|
||||||
--> $DIR/wrong-number-of-args.rs:155:18
|
--> $DIR/wrong-number-of-args.rs:155:18
|
||||||
|
|
|
|
||||||
LL | type D = Result<usize, String, char>;
|
LL | type D = Result<usize, String, char>;
|
||||||
| ^^^^^^ ------ help: remove this type argument
|
| ^^^^^^ ---- help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected 2 type arguments
|
| expected 2 generic arguments
|
||||||
|
|
|
|
||||||
note: enum defined here, with 2 type parameters: `T`, `E`
|
note: enum defined here, with 2 generic parameters: `T`, `E`
|
||||||
--> $SRC_DIR/core/src/result.rs:LL:COL
|
--> $SRC_DIR/core/src/result.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub enum Result<T, E> {
|
LL | pub enum Result<T, E> {
|
||||||
|
|
|
@ -2,19 +2,19 @@ error[E0107]: missing generics for struct `Box`
|
||||||
--> $DIR/issue-14092.rs:1:11
|
--> $DIR/issue-14092.rs:1:11
|
||||||
|
|
|
|
||||||
LL | fn fn1(0: Box) {}
|
LL | fn fn1(0: Box) {}
|
||||||
| ^^^ expected at least 1 type argument
|
| ^^^ expected at least 1 generic argument
|
||||||
|
|
|
|
||||||
note: struct defined here, with at least 1 type parameter: `T`
|
note: struct defined here, with at least 1 generic parameter: `T`
|
||||||
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub struct Box<
|
LL | pub struct Box<
|
||||||
| ^^^
|
| ^^^
|
||||||
LL | T: ?Sized,
|
LL | T: ?Sized,
|
||||||
| -
|
| -
|
||||||
help: use angle brackets to add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | fn fn1(0: Box<T>) {}
|
LL | fn fn1(0: Box<T>) {}
|
||||||
| ^^^
|
| ^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was
|
||||||
--> $DIR/issue-18423.rs:4:8
|
--> $DIR/issue-18423.rs:4:8
|
||||||
|
|
|
|
||||||
LL | x: Box<'a, isize>
|
LL | x: Box<'a, isize>
|
||||||
| ^^^ ---- help: remove this lifetime argument
|
| ^^^ -- help: remove this lifetime argument
|
||||||
| |
|
| |
|
||||||
| expected 0 lifetime arguments
|
| expected 0 lifetime arguments
|
||||||
|
|
|
|
||||||
|
|
|
@ -11,17 +11,17 @@ error[E0107]: missing generics for trait `Fn`
|
||||||
--> $DIR/issue-23024.rs:9:39
|
--> $DIR/issue-23024.rs:9:39
|
||||||
|
|
|
|
||||||
LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3));
|
LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3));
|
||||||
| ^^ expected 1 type argument
|
| ^^ expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: trait defined here, with 1 type parameter: `Args`
|
note: trait defined here, with 1 generic parameter: `Args`
|
||||||
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
|
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub trait Fn<Args>: FnMut<Args> {
|
LL | pub trait Fn<Args>: FnMut<Args> {
|
||||||
| ^^ ----
|
| ^^ ----
|
||||||
help: use angle brackets to add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | println!("{:?}",(vfnfer[0] as dyn Fn<Args>)(3));
|
LL | println!("{:?}",(vfnfer[0] as dyn Fn<Args>)(3));
|
||||||
| ^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error[E0191]: the value of the associated type `Output` (from trait `FnOnce`) must be specified
|
error[E0191]: the value of the associated type `Output` (from trait `FnOnce`) must be specified
|
||||||
--> $DIR/issue-23024.rs:9:39
|
--> $DIR/issue-23024.rs:9:39
|
||||||
|
|
|
@ -4,7 +4,7 @@ fn foo<T>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Drop for Foo<T> {
|
impl<T> Drop for Foo<T> {
|
||||||
//~^ ERROR this struct takes 0 type arguments but 1 type argument was supplied
|
//~^ ERROR this struct takes 0 generic arguments but 1 generic argument
|
||||||
//~| ERROR the type parameter `T` is not constrained by the impl trait, self type, or predicates
|
//~| ERROR the type parameter `T` is not constrained by the impl trait, self type, or predicates
|
||||||
fn drop(&mut self) {}
|
fn drop(&mut self) {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,15 +9,15 @@ LL | struct Foo {
|
||||||
LL | x: T,
|
LL | x: T,
|
||||||
| ^ use of generic parameter from outer function
|
| ^ use of generic parameter from outer function
|
||||||
|
|
||||||
error[E0107]: this struct takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this struct takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/issue-3214.rs:6:22
|
--> $DIR/issue-3214.rs:6:22
|
||||||
|
|
|
|
||||||
LL | impl<T> Drop for Foo<T> {
|
LL | impl<T> Drop for Foo<T> {
|
||||||
| ^^^--- help: remove these generics
|
| ^^^--- help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: struct defined here, with 0 type parameters
|
note: struct defined here, with 0 generic parameters
|
||||||
--> $DIR/issue-3214.rs:2:12
|
--> $DIR/issue-3214.rs:2:12
|
||||||
|
|
|
|
||||||
LL | struct Foo {
|
LL | struct Foo {
|
||||||
|
|
|
@ -9,8 +9,8 @@ macro_rules! impl_add {
|
||||||
$(
|
$(
|
||||||
fn $n() {
|
fn $n() {
|
||||||
S::f::<i64>();
|
S::f::<i64>();
|
||||||
//~^ ERROR this associated function takes 0 type arguments but 1 type argument was supplied
|
//~^ ERROR this associated function takes 0 generic
|
||||||
//~| ERROR this associated function takes 0 type arguments but 1 type argument was supplied
|
//~| ERROR this associated function takes 0 generic
|
||||||
}
|
}
|
||||||
)*
|
)*
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,33 +1,33 @@
|
||||||
error[E0107]: this associated function takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/issue-53251.rs:11:20
|
--> $DIR/issue-53251.rs:11:20
|
||||||
|
|
|
|
||||||
LL | S::f::<i64>();
|
LL | S::f::<i64>();
|
||||||
| ^------- help: remove these generics
|
| ^------- help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
...
|
...
|
||||||
LL | impl_add!(a b);
|
LL | impl_add!(a b);
|
||||||
| --------------- in this macro invocation
|
| --------------- in this macro invocation
|
||||||
|
|
|
|
||||||
note: associated function defined here, with 0 type parameters
|
note: associated function defined here, with 0 generic parameters
|
||||||
--> $DIR/issue-53251.rs:4:8
|
--> $DIR/issue-53251.rs:4:8
|
||||||
|
|
|
|
||||||
LL | fn f() {}
|
LL | fn f() {}
|
||||||
| ^
|
| ^
|
||||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error[E0107]: this associated function takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/issue-53251.rs:11:20
|
--> $DIR/issue-53251.rs:11:20
|
||||||
|
|
|
|
||||||
LL | S::f::<i64>();
|
LL | S::f::<i64>();
|
||||||
| ^------- help: remove these generics
|
| ^------- help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
...
|
...
|
||||||
LL | impl_add!(a b);
|
LL | impl_add!(a b);
|
||||||
| --------------- in this macro invocation
|
| --------------- in this macro invocation
|
||||||
|
|
|
|
||||||
note: associated function defined here, with 0 type parameters
|
note: associated function defined here, with 0 generic parameters
|
||||||
--> $DIR/issue-53251.rs:4:8
|
--> $DIR/issue-53251.rs:4:8
|
||||||
|
|
|
|
||||||
LL | fn f() {}
|
LL | fn f() {}
|
||||||
|
|
|
@ -9,7 +9,7 @@ impl Borked {
|
||||||
fn run_wild<T>(b: &Borked) {
|
fn run_wild<T>(b: &Borked) {
|
||||||
b.a::<'_, T>();
|
b.a::<'_, T>();
|
||||||
//~^ ERROR cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
//~^ ERROR cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||||
//~| ERROR this associated function takes 0 type arguments but 1 type argument was supplied
|
//~| ERROR this associated function takes 0 generic arguments but 1 generic argument
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,15 +16,15 @@ LL | #![deny(warnings)]
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
|
= note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
|
||||||
|
|
||||||
error[E0107]: this associated function takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/issue-60622.rs:10:7
|
--> $DIR/issue-60622.rs:10:7
|
||||||
|
|
|
|
||||||
LL | b.a::<'_, T>();
|
LL | b.a::<'_, T>();
|
||||||
| ^ --- help: remove this type argument
|
| ^ - help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: associated function defined here, with 0 type parameters
|
note: associated function defined here, with 0 generic parameters
|
||||||
--> $DIR/issue-60622.rs:6:8
|
--> $DIR/issue-60622.rs:6:8
|
||||||
|
|
|
|
||||||
LL | fn a(&self) {}
|
LL | fn a(&self) {}
|
||||||
|
|
|
@ -14,7 +14,7 @@ impl S {
|
||||||
fn method_call() {
|
fn method_call() {
|
||||||
S.early(); // OK
|
S.early(); // OK
|
||||||
S.early::<'static>();
|
S.early::<'static>();
|
||||||
//~^ ERROR this associated function takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
//~^ ERROR this associated function takes 2 lifetime arguments but 1 lifetime argument
|
||||||
S.early::<'static, 'static, 'static>();
|
S.early::<'static, 'static, 'static>();
|
||||||
//~^ ERROR this associated function takes 2 lifetime arguments but 3 lifetime arguments were supplied
|
//~^ ERROR this associated function takes 2 lifetime arguments but 3 lifetime arguments were supplied
|
||||||
let _: &u8 = S.life_and_type::<'static>();
|
let _: &u8 = S.life_and_type::<'static>();
|
||||||
|
@ -61,7 +61,7 @@ fn ufcs() {
|
||||||
|
|
||||||
S::early(S); // OK
|
S::early(S); // OK
|
||||||
S::early::<'static>(S);
|
S::early::<'static>(S);
|
||||||
//~^ ERROR this associated function takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
//~^ ERROR this associated function takes 2 lifetime arguments but 1 lifetime argument
|
||||||
S::early::<'static, 'static, 'static>(S);
|
S::early::<'static, 'static, 'static>(S);
|
||||||
//~^ ERROR this associated function takes 2 lifetime arguments but 3 lifetime arguments were supplied
|
//~^ ERROR this associated function takes 2 lifetime arguments but 3 lifetime arguments were supplied
|
||||||
let _: &u8 = S::life_and_type::<'static>(S);
|
let _: &u8 = S::life_and_type::<'static>(S);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
error[E0107]: this associated function takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
error[E0107]: this associated function takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
--> $DIR/method-call-lifetime-args-fail.rs:16:7
|
--> $DIR/method-call-lifetime-args-fail.rs:16:7
|
||||||
|
|
|
|
||||||
LL | S.early::<'static>();
|
LL | S.early::<'static>();
|
||||||
|
@ -20,7 +20,7 @@ error[E0107]: this associated function takes 2 lifetime arguments but 3 lifetime
|
||||||
--> $DIR/method-call-lifetime-args-fail.rs:18:7
|
--> $DIR/method-call-lifetime-args-fail.rs:18:7
|
||||||
|
|
|
|
||||||
LL | S.early::<'static, 'static, 'static>();
|
LL | S.early::<'static, 'static, 'static>();
|
||||||
| ^^^^^ --------- help: remove this lifetime argument
|
| ^^^^^ ------- help: remove this lifetime argument
|
||||||
| |
|
| |
|
||||||
| expected 2 lifetime arguments
|
| expected 2 lifetime arguments
|
||||||
|
|
|
|
||||||
|
@ -198,7 +198,7 @@ note: the late bound lifetime parameter is introduced here
|
||||||
LL | fn late_unused_early<'a, 'b>(self) -> &'b u8 { loop {} }
|
LL | fn late_unused_early<'a, 'b>(self) -> &'b u8 { loop {} }
|
||||||
| ^^
|
| ^^
|
||||||
|
|
||||||
error[E0107]: this associated function takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
error[E0107]: this associated function takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
--> $DIR/method-call-lifetime-args-fail.rs:63:8
|
--> $DIR/method-call-lifetime-args-fail.rs:63:8
|
||||||
|
|
|
|
||||||
LL | S::early::<'static>(S);
|
LL | S::early::<'static>(S);
|
||||||
|
@ -220,7 +220,7 @@ error[E0107]: this associated function takes 2 lifetime arguments but 3 lifetime
|
||||||
--> $DIR/method-call-lifetime-args-fail.rs:65:8
|
--> $DIR/method-call-lifetime-args-fail.rs:65:8
|
||||||
|
|
|
|
||||||
LL | S::early::<'static, 'static, 'static>(S);
|
LL | S::early::<'static, 'static, 'static>(S);
|
||||||
| ^^^^^ --------- help: remove this lifetime argument
|
| ^^^^^ ------- help: remove this lifetime argument
|
||||||
| |
|
| |
|
||||||
| expected 2 lifetime arguments
|
| expected 2 lifetime arguments
|
||||||
|
|
|
|
||||||
|
|
|
@ -2,12 +2,12 @@ fn main() {
|
||||||
trait Seq { }
|
trait Seq { }
|
||||||
|
|
||||||
impl<T> Seq<T> for Vec<T> {
|
impl<T> Seq<T> for Vec<T> {
|
||||||
//~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied
|
//~^ ERROR this trait takes 0 generic arguments but 1 generic argument
|
||||||
/* ... */
|
/* ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Seq<bool> for u32 {
|
impl Seq<bool> for u32 {
|
||||||
//~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied
|
//~^ ERROR this trait takes 0 generic arguments but 1 generic argument
|
||||||
/* Treat the integer as a sequence of bits */
|
/* Treat the integer as a sequence of bits */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/seq-args.rs:4:13
|
--> $DIR/seq-args.rs:4:13
|
||||||
|
|
|
|
||||||
LL | impl<T> Seq<T> for Vec<T> {
|
LL | impl<T> Seq<T> for Vec<T> {
|
||||||
| ^^^--- help: remove these generics
|
| ^^^--- help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: trait defined here, with 0 type parameters
|
note: trait defined here, with 0 generic parameters
|
||||||
--> $DIR/seq-args.rs:2:11
|
--> $DIR/seq-args.rs:2:11
|
||||||
|
|
|
|
||||||
LL | trait Seq { }
|
LL | trait Seq { }
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/seq-args.rs:9:10
|
--> $DIR/seq-args.rs:9:10
|
||||||
|
|
|
|
||||||
LL | impl Seq<bool> for u32 {
|
LL | impl Seq<bool> for u32 {
|
||||||
| ^^^------ help: remove these generics
|
| ^^^------ help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: trait defined here, with 0 type parameters
|
note: trait defined here, with 0 generic parameters
|
||||||
--> $DIR/seq-args.rs:2:11
|
--> $DIR/seq-args.rs:2:11
|
||||||
|
|
|
|
||||||
LL | trait Seq { }
|
LL | trait Seq { }
|
||||||
|
|
|
@ -45,13 +45,13 @@ fn main() {
|
||||||
y: 8,
|
y: 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
let pt3 = PointF::<i32> { //~ ERROR this type alias takes 0 type arguments but 1 type argument was supplied
|
let pt3 = PointF::<i32> { //~ ERROR this type alias takes 0 generic arguments but 1 generic argument
|
||||||
x: 9, //~ ERROR mismatched types
|
x: 9, //~ ERROR mismatched types
|
||||||
y: 10, //~ ERROR mismatched types
|
y: 10, //~ ERROR mismatched types
|
||||||
};
|
};
|
||||||
|
|
||||||
match (Point { x: 1, y: 2 }) {
|
match (Point { x: 1, y: 2 }) {
|
||||||
PointF::<u32> { .. } => {} //~ ERROR this type alias takes 0 type arguments but 1 type argument was supplied
|
PointF::<u32> { .. } => {} //~ ERROR this type alias takes 0 generic arguments but 1 generic argument
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,15 +52,15 @@ LL | x: 7,
|
||||||
| expected `f32`, found integer
|
| expected `f32`, found integer
|
||||||
| help: use a float literal: `7.0`
|
| help: use a float literal: `7.0`
|
||||||
|
|
||||||
error[E0107]: this type alias takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/structure-constructor-type-mismatch.rs:48:15
|
--> $DIR/structure-constructor-type-mismatch.rs:48:15
|
||||||
|
|
|
|
||||||
LL | let pt3 = PointF::<i32> {
|
LL | let pt3 = PointF::<i32> {
|
||||||
| ^^^^^^------- help: remove these generics
|
| ^^^^^^------- help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: type alias defined here, with 0 type parameters
|
note: type alias defined here, with 0 generic parameters
|
||||||
--> $DIR/structure-constructor-type-mismatch.rs:6:6
|
--> $DIR/structure-constructor-type-mismatch.rs:6:6
|
||||||
|
|
|
|
||||||
LL | type PointF = Point<f32>;
|
LL | type PointF = Point<f32>;
|
||||||
|
@ -84,15 +84,15 @@ LL | y: 10,
|
||||||
| expected `f32`, found integer
|
| expected `f32`, found integer
|
||||||
| help: use a float literal: `10.0`
|
| help: use a float literal: `10.0`
|
||||||
|
|
||||||
error[E0107]: this type alias takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/structure-constructor-type-mismatch.rs:54:9
|
--> $DIR/structure-constructor-type-mismatch.rs:54:9
|
||||||
|
|
|
|
||||||
LL | PointF::<u32> { .. } => {}
|
LL | PointF::<u32> { .. } => {}
|
||||||
| ^^^^^^------- help: remove these generics
|
| ^^^^^^------- help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: type alias defined here, with 0 type parameters
|
note: type alias defined here, with 0 generic parameters
|
||||||
--> $DIR/structure-constructor-type-mismatch.rs:6:6
|
--> $DIR/structure-constructor-type-mismatch.rs:6:6
|
||||||
|
|
|
|
||||||
LL | type PointF = Point<f32>;
|
LL | type PointF = Point<f32>;
|
||||||
|
|
|
@ -16,8 +16,8 @@ trait Tar<'t, 'k, I> {}
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static a: RefCell<HashMap<i32, Vec<Vec<Foo>>>> = RefCell::new(HashMap::new());
|
static a: RefCell<HashMap<i32, Vec<Vec<Foo>>>> = RefCell::new(HashMap::new());
|
||||||
//~^ ERROR missing lifetime specifier
|
//~^ ERROR missing lifetime specifiers
|
||||||
//~| ERROR missing lifetime specifier
|
//~| ERROR missing lifetime specifiers
|
||||||
}
|
}
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
|
static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
|
||||||
|
@ -28,32 +28,32 @@ thread_local! {
|
||||||
}
|
}
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static c: RefCell<HashMap<i32, Vec<Vec<Qux<i32>>>>> = RefCell::new(HashMap::new());
|
static c: RefCell<HashMap<i32, Vec<Vec<Qux<i32>>>>> = RefCell::new(HashMap::new());
|
||||||
//~^ ERROR missing lifetime specifier
|
//~^ ERROR missing lifetime
|
||||||
//~| ERROR missing lifetime specifier
|
//~| ERROR missing lifetime
|
||||||
}
|
}
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
|
static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
|
||||||
//~^ ERROR missing lifetime specifier
|
//~^ ERROR missing lifetime
|
||||||
//~| ERROR missing lifetime specifier
|
//~| ERROR missing lifetime
|
||||||
//~| ERROR missing lifetime specifier
|
//~| ERROR missing lifetime
|
||||||
//~| ERROR missing lifetime specifier
|
//~| ERROR missing lifetime
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
|
static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
//~^ ERROR this union takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
//~^ ERROR this union takes 2 lifetime arguments but 1 lifetime argument
|
||||||
//~| ERROR this union takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
//~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
//~| ERROR this union takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
//~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
//~| ERROR this union takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
//~| ERROR this union takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
}
|
}
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
//~^ ERROR this trait takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
//~^ ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
//~| ERROR this trait takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
//~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
//~| ERROR this trait takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
//~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
//~| ERROR this trait takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
//~| ERROR this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
//~| ERROR missing lifetime specifier
|
//~| ERROR missing lifetime
|
||||||
//~| ERROR missing lifetime specifier
|
//~| ERROR missing lifetime
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -142,7 +142,25 @@ help: consider using the `'static` lifetime
|
||||||
LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
|
LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0107]: this union takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
|
--> $DIR/missing-lifetime-specifier.rs:43:44
|
||||||
|
|
|
||||||
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
|
| ^^^ ------- supplied 1 lifetime argument
|
||||||
|
| |
|
||||||
|
| expected 2 lifetime arguments
|
||||||
|
|
|
||||||
|
note: union defined here, with 2 lifetime parameters: `'t`, `'k`
|
||||||
|
--> $DIR/missing-lifetime-specifier.rs:11:11
|
||||||
|
|
|
||||||
|
LL | pub union Qux<'t, 'k, I> {
|
||||||
|
| ^^^ -- --
|
||||||
|
help: add missing lifetime argument
|
||||||
|
|
|
||||||
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, '_, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
|
| ^^^^
|
||||||
|
|
||||||
|
error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
--> $DIR/missing-lifetime-specifier.rs:43:44
|
--> $DIR/missing-lifetime-specifier.rs:43:44
|
||||||
|
|
|
|
||||||
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
|
@ -160,7 +178,7 @@ help: add missing lifetime argument
|
||||||
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'k, i32>>>>> = RefCell::new(HashMap::new());
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'k, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
||||||
error[E0107]: this union takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
--> $DIR/missing-lifetime-specifier.rs:43:44
|
--> $DIR/missing-lifetime-specifier.rs:43:44
|
||||||
|
|
|
|
||||||
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
|
@ -178,7 +196,7 @@ help: add missing lifetime argument
|
||||||
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'k, i32>>>>> = RefCell::new(HashMap::new());
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'k, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
||||||
error[E0107]: this union takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
error[E0107]: this union takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
--> $DIR/missing-lifetime-specifier.rs:43:44
|
--> $DIR/missing-lifetime-specifier.rs:43:44
|
||||||
|
|
|
|
||||||
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
|
@ -193,28 +211,40 @@ LL | pub union Qux<'t, 'k, I> {
|
||||||
| ^^^ -- --
|
| ^^^ -- --
|
||||||
help: add missing lifetime argument
|
help: add missing lifetime argument
|
||||||
|
|
|
|
||||||
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'k, i32>>>>> = RefCell::new(HashMap::new());
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, '_, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
||||||
error[E0107]: this union takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
--> $DIR/missing-lifetime-specifier.rs:43:44
|
--> $DIR/missing-lifetime-specifier.rs:50:45
|
||||||
|
|
|
|
||||||
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
| ^^^ ------- supplied 1 lifetime argument
|
| ^^^ ------- supplied 1 lifetime argument
|
||||||
| |
|
| |
|
||||||
| expected 2 lifetime arguments
|
| expected 2 lifetime arguments
|
||||||
|
|
|
|
||||||
note: union defined here, with 2 lifetime parameters: `'t`, `'k`
|
note: trait defined here, with 2 lifetime parameters: `'t`, `'k`
|
||||||
--> $DIR/missing-lifetime-specifier.rs:11:11
|
--> $DIR/missing-lifetime-specifier.rs:15:7
|
||||||
|
|
|
|
||||||
LL | pub union Qux<'t, 'k, I> {
|
LL | trait Tar<'t, 'k, I> {}
|
||||||
| ^^^ -- --
|
| ^^^ -- --
|
||||||
help: add missing lifetime argument
|
help: add missing lifetime argument
|
||||||
|
|
|
|
||||||
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'k, i32>>>>> = RefCell::new(HashMap::new());
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, '_, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
||||||
error[E0107]: this trait takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
error[E0106]: missing lifetime specifier
|
||||||
|
--> $DIR/missing-lifetime-specifier.rs:50:44
|
||||||
|
|
|
||||||
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
|
| ^ expected named lifetime parameter
|
||||||
|
|
|
||||||
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
||||||
|
help: consider using the `'static` lifetime
|
||||||
|
|
|
||||||
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&'static Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
|
| ^^^^^^^^
|
||||||
|
|
||||||
|
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
--> $DIR/missing-lifetime-specifier.rs:50:45
|
--> $DIR/missing-lifetime-specifier.rs:50:45
|
||||||
|
|
|
|
||||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
|
@ -244,7 +274,7 @@ help: consider using the `'static` lifetime
|
||||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&'static Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&'static Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error[E0107]: this trait takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
--> $DIR/missing-lifetime-specifier.rs:50:45
|
--> $DIR/missing-lifetime-specifier.rs:50:45
|
||||||
|
|
|
|
||||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
|
@ -262,19 +292,7 @@ help: add missing lifetime argument
|
||||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'k, i32>>>>> = RefCell::new(HashMap::new());
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'k, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
||||||
error[E0106]: missing lifetime specifier
|
error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||||
--> $DIR/missing-lifetime-specifier.rs:50:44
|
|
||||||
|
|
|
||||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
|
||||||
| ^ expected named lifetime parameter
|
|
||||||
|
|
|
||||||
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
|
|
||||||
help: consider using the `'static` lifetime
|
|
||||||
|
|
|
||||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&'static Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
|
||||||
| ^^^^^^^^
|
|
||||||
|
|
||||||
error[E0107]: this trait takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
|
||||||
--> $DIR/missing-lifetime-specifier.rs:50:45
|
--> $DIR/missing-lifetime-specifier.rs:50:45
|
||||||
|
|
|
|
||||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
|
@ -289,25 +307,7 @@ LL | trait Tar<'t, 'k, I> {}
|
||||||
| ^^^ -- --
|
| ^^^ -- --
|
||||||
help: add missing lifetime argument
|
help: add missing lifetime argument
|
||||||
|
|
|
|
||||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'k, i32>>>>> = RefCell::new(HashMap::new());
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, '_, i32>>>>> = RefCell::new(HashMap::new());
|
||||||
| ^^^^
|
|
||||||
|
|
||||||
error[E0107]: this trait takes 2 lifetime arguments but only 1 lifetime argument was supplied
|
|
||||||
--> $DIR/missing-lifetime-specifier.rs:50:45
|
|
||||||
|
|
|
||||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
|
|
||||||
| ^^^ ------- supplied 1 lifetime argument
|
|
||||||
| |
|
|
||||||
| expected 2 lifetime arguments
|
|
||||||
|
|
|
||||||
note: trait defined here, with 2 lifetime parameters: `'t`, `'k`
|
|
||||||
--> $DIR/missing-lifetime-specifier.rs:15:7
|
|
||||||
|
|
|
||||||
LL | trait Tar<'t, 'k, I> {}
|
|
||||||
| ^^^ -- --
|
|
||||||
help: add missing lifetime argument
|
|
||||||
|
|
|
||||||
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'k, i32>>>>> = RefCell::new(HashMap::new());
|
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
||||||
error: aborting due to 22 previous errors
|
error: aborting due to 22 previous errors
|
||||||
|
|
|
@ -6,7 +6,7 @@ pub trait T<X, Y> {
|
||||||
pub struct Foo {
|
pub struct Foo {
|
||||||
i: Box<dyn T<usize, usize, usize, usize, B=usize>>,
|
i: Box<dyn T<usize, usize, usize, usize, B=usize>>,
|
||||||
//~^ ERROR must be specified
|
//~^ ERROR must be specified
|
||||||
//~| ERROR this trait takes 2 type arguments but 4 type arguments were supplied
|
//~| ERROR this trait takes 2 generic arguments but 4 generic arguments were supplied
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
error[E0107]: this trait takes 2 type arguments but 4 type arguments were supplied
|
error[E0107]: this trait takes 2 generic arguments but 4 generic arguments were supplied
|
||||||
--> $DIR/use-type-argument-instead-of-assoc-type.rs:7:16
|
--> $DIR/use-type-argument-instead-of-assoc-type.rs:7:16
|
||||||
|
|
|
|
||||||
LL | i: Box<dyn T<usize, usize, usize, usize, B=usize>>,
|
LL | i: Box<dyn T<usize, usize, usize, usize, B=usize>>,
|
||||||
| ^ -------------- help: remove these type arguments
|
| ^ ------------ help: remove these generic arguments
|
||||||
| |
|
| |
|
||||||
| expected 2 type arguments
|
| expected 2 generic arguments
|
||||||
|
|
|
|
||||||
note: trait defined here, with 2 type parameters: `X`, `Y`
|
note: trait defined here, with 2 generic parameters: `X`, `Y`
|
||||||
--> $DIR/use-type-argument-instead-of-assoc-type.rs:1:11
|
--> $DIR/use-type-argument-instead-of-assoc-type.rs:1:11
|
||||||
|
|
|
|
||||||
LL | pub trait T<X, Y> {
|
LL | pub trait T<X, Y> {
|
||||||
|
|
|
@ -2,17 +2,17 @@ error[E0107]: missing generics for enum `Quux`
|
||||||
--> $DIR/tag-type-args.rs:3:11
|
--> $DIR/tag-type-args.rs:3:11
|
||||||
|
|
|
|
||||||
LL | fn foo(c: Quux) { assert!((false)); }
|
LL | fn foo(c: Quux) { assert!((false)); }
|
||||||
| ^^^^ expected 1 type argument
|
| ^^^^ expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: enum defined here, with 1 type parameter: `T`
|
note: enum defined here, with 1 generic parameter: `T`
|
||||||
--> $DIR/tag-type-args.rs:1:6
|
--> $DIR/tag-type-args.rs:1:6
|
||||||
|
|
|
|
||||||
LL | enum Quux<T> { Bar }
|
LL | enum Quux<T> { Bar }
|
||||||
| ^^^^ -
|
| ^^^^ -
|
||||||
help: use angle brackets to add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | fn foo(c: Quux<T>) { assert!((false)); }
|
LL | fn foo(c: Quux<T>) { assert!((false)); }
|
||||||
| ^^^
|
| ^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ fn main() {
|
||||||
//~^ at least one trait is required for an object type
|
//~^ at least one trait is required for an object type
|
||||||
let _: S<'static, 'static>;
|
let _: S<'static, 'static>;
|
||||||
//~^ ERROR this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
|
//~^ ERROR this struct takes 1 lifetime argument but 2 lifetime arguments were supplied
|
||||||
//~| ERROR this struct takes 1 type argument but 0 type arguments were supplied
|
//~| ERROR this struct takes 1 generic argument but 0 generic arguments were supplied
|
||||||
let _: S<dyn 'static +, 'static>;
|
let _: S<dyn 'static +, 'static>;
|
||||||
//~^ ERROR type provided when a lifetime was expected
|
//~^ ERROR type provided when a lifetime was expected
|
||||||
//~| ERROR at least one trait is required for an object type
|
//~| ERROR at least one trait is required for an object type
|
||||||
|
|
|
@ -8,7 +8,7 @@ error[E0107]: this struct takes 1 lifetime argument but 2 lifetime arguments wer
|
||||||
--> $DIR/vs-lifetime.rs:11:12
|
--> $DIR/vs-lifetime.rs:11:12
|
||||||
|
|
|
|
||||||
LL | let _: S<'static, 'static>;
|
LL | let _: S<'static, 'static>;
|
||||||
| ^ --------- help: remove this lifetime argument
|
| ^ ------- help: remove this lifetime argument
|
||||||
| |
|
| |
|
||||||
| expected 1 lifetime argument
|
| expected 1 lifetime argument
|
||||||
|
|
|
|
||||||
|
@ -18,18 +18,18 @@ note: struct defined here, with 1 lifetime parameter: `'a`
|
||||||
LL | struct S<'a, T>(&'a u8, T);
|
LL | struct S<'a, T>(&'a u8, T);
|
||||||
| ^ --
|
| ^ --
|
||||||
|
|
||||||
error[E0107]: this struct takes 1 type argument but 0 type arguments were supplied
|
error[E0107]: this struct takes 1 generic argument but 0 generic arguments were supplied
|
||||||
--> $DIR/vs-lifetime.rs:11:12
|
--> $DIR/vs-lifetime.rs:11:12
|
||||||
|
|
|
|
||||||
LL | let _: S<'static, 'static>;
|
LL | let _: S<'static, 'static>;
|
||||||
| ^ expected 1 type argument
|
| ^ expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: struct defined here, with 1 type parameter: `T`
|
note: struct defined here, with 1 generic parameter: `T`
|
||||||
--> $DIR/vs-lifetime.rs:4:8
|
--> $DIR/vs-lifetime.rs:4:8
|
||||||
|
|
|
|
||||||
LL | struct S<'a, T>(&'a u8, T);
|
LL | struct S<'a, T>(&'a u8, T);
|
||||||
| ^ -
|
| ^ -
|
||||||
help: add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | let _: S<'static, 'static, T>;
|
LL | let _: S<'static, 'static, T>;
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
@ -7,9 +7,9 @@ impl bar for u32 { fn dup(&self) -> u32 { *self } fn blah<X>(&self) {} }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
10.dup::<i32>();
|
10.dup::<i32>();
|
||||||
//~^ ERROR this associated function takes 0 type arguments but 1 type argument was supplied
|
//~^ ERROR this associated function takes 0 generic arguments but 1
|
||||||
10.blah::<i32, i32>();
|
10.blah::<i32, i32>();
|
||||||
//~^ ERROR this associated function takes 1 type argument but 2 type arguments were supplied
|
//~^ ERROR this associated function takes 1 generic argument but 2
|
||||||
(box 10 as Box<dyn bar>).dup();
|
(box 10 as Box<dyn bar>).dup();
|
||||||
//~^ ERROR E0038
|
//~^ ERROR E0038
|
||||||
//~| ERROR E0038
|
//~| ERROR E0038
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
error[E0107]: this associated function takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/test-2.rs:9:8
|
--> $DIR/test-2.rs:9:8
|
||||||
|
|
|
|
||||||
LL | 10.dup::<i32>();
|
LL | 10.dup::<i32>();
|
||||||
| ^^^------- help: remove these generics
|
| ^^^------- help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: associated function defined here, with 0 type parameters
|
note: associated function defined here, with 0 generic parameters
|
||||||
--> $DIR/test-2.rs:4:16
|
--> $DIR/test-2.rs:4:16
|
||||||
|
|
|
|
||||||
LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
|
LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error[E0107]: this associated function takes 1 type argument but 2 type arguments were supplied
|
error[E0107]: this associated function takes 1 generic argument but 2 generic arguments were supplied
|
||||||
--> $DIR/test-2.rs:11:8
|
--> $DIR/test-2.rs:11:8
|
||||||
|
|
|
|
||||||
LL | 10.blah::<i32, i32>();
|
LL | 10.blah::<i32, i32>();
|
||||||
| ^^^^ ----- help: remove this type argument
|
| ^^^^ --- help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected 1 type argument
|
| expected 1 generic argument
|
||||||
|
|
|
|
||||||
note: associated function defined here, with 1 type parameter: `X`
|
note: associated function defined here, with 1 generic parameter: `X`
|
||||||
--> $DIR/test-2.rs:4:39
|
--> $DIR/test-2.rs:4:39
|
||||||
|
|
|
|
||||||
LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
|
LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
|
||||||
|
|
|
@ -62,10 +62,10 @@ fn main() {
|
||||||
AliasFixed::TSVariant::<()>(());
|
AliasFixed::TSVariant::<()>(());
|
||||||
//~^ ERROR type arguments are not allowed for this type [E0109]
|
//~^ ERROR type arguments are not allowed for this type [E0109]
|
||||||
AliasFixed::<()>::TSVariant(());
|
AliasFixed::<()>::TSVariant(());
|
||||||
//~^ ERROR this type alias takes 0 type arguments but 1 type argument was supplied [E0107]
|
//~^ ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
|
||||||
AliasFixed::<()>::TSVariant::<()>(());
|
AliasFixed::<()>::TSVariant::<()>(());
|
||||||
//~^ ERROR type arguments are not allowed for this type [E0109]
|
//~^ ERROR type arguments are not allowed for this type [E0109]
|
||||||
//~| ERROR this type alias takes 0 type arguments but 1 type argument was supplied [E0107]
|
//~| ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
|
||||||
|
|
||||||
// Struct variant
|
// Struct variant
|
||||||
|
|
||||||
|
@ -80,10 +80,10 @@ fn main() {
|
||||||
AliasFixed::SVariant::<()> { v: () };
|
AliasFixed::SVariant::<()> { v: () };
|
||||||
//~^ ERROR type arguments are not allowed for this type [E0109]
|
//~^ ERROR type arguments are not allowed for this type [E0109]
|
||||||
AliasFixed::<()>::SVariant { v: () };
|
AliasFixed::<()>::SVariant { v: () };
|
||||||
//~^ ERROR this type alias takes 0 type arguments but 1 type argument was supplied [E0107]
|
//~^ ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
|
||||||
AliasFixed::<()>::SVariant::<()> { v: () };
|
AliasFixed::<()>::SVariant::<()> { v: () };
|
||||||
//~^ ERROR type arguments are not allowed for this type [E0109]
|
//~^ ERROR type arguments are not allowed for this type [E0109]
|
||||||
//~| ERROR this type alias takes 0 type arguments but 1 type argument was supplied [E0107]
|
//~| ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
|
||||||
|
|
||||||
// Unit variant
|
// Unit variant
|
||||||
|
|
||||||
|
@ -98,8 +98,8 @@ fn main() {
|
||||||
AliasFixed::UVariant::<()>;
|
AliasFixed::UVariant::<()>;
|
||||||
//~^ ERROR type arguments are not allowed for this type [E0109]
|
//~^ ERROR type arguments are not allowed for this type [E0109]
|
||||||
AliasFixed::<()>::UVariant;
|
AliasFixed::<()>::UVariant;
|
||||||
//~^ ERROR this type alias takes 0 type arguments but 1 type argument was supplied [E0107]
|
//~^ ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
|
||||||
AliasFixed::<()>::UVariant::<()>;
|
AliasFixed::<()>::UVariant::<()>;
|
||||||
//~^ ERROR type arguments are not allowed for this type [E0109]
|
//~^ ERROR type arguments are not allowed for this type [E0109]
|
||||||
//~| ERROR this type alias takes 0 type arguments but 1 type argument was supplied [E0107]
|
//~| ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,29 +166,29 @@ error[E0109]: type arguments are not allowed for this type
|
||||||
LL | AliasFixed::TSVariant::<()>(());
|
LL | AliasFixed::TSVariant::<()>(());
|
||||||
| ^^ type argument not allowed
|
| ^^ type argument not allowed
|
||||||
|
|
||||||
error[E0107]: this type alias takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/enum-variant-generic-args.rs:64:5
|
--> $DIR/enum-variant-generic-args.rs:64:5
|
||||||
|
|
|
|
||||||
LL | AliasFixed::<()>::TSVariant(());
|
LL | AliasFixed::<()>::TSVariant(());
|
||||||
| ^^^^^^^^^^------ help: remove these generics
|
| ^^^^^^^^^^------ help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: type alias defined here, with 0 type parameters
|
note: type alias defined here, with 0 generic parameters
|
||||||
--> $DIR/enum-variant-generic-args.rs:9:6
|
--> $DIR/enum-variant-generic-args.rs:9:6
|
||||||
|
|
|
|
||||||
LL | type AliasFixed = Enum<()>;
|
LL | type AliasFixed = Enum<()>;
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0107]: this type alias takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/enum-variant-generic-args.rs:66:5
|
--> $DIR/enum-variant-generic-args.rs:66:5
|
||||||
|
|
|
|
||||||
LL | AliasFixed::<()>::TSVariant::<()>(());
|
LL | AliasFixed::<()>::TSVariant::<()>(());
|
||||||
| ^^^^^^^^^^------ help: remove these generics
|
| ^^^^^^^^^^------ help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: type alias defined here, with 0 type parameters
|
note: type alias defined here, with 0 generic parameters
|
||||||
--> $DIR/enum-variant-generic-args.rs:9:6
|
--> $DIR/enum-variant-generic-args.rs:9:6
|
||||||
|
|
|
|
||||||
LL | type AliasFixed = Enum<()>;
|
LL | type AliasFixed = Enum<()>;
|
||||||
|
@ -224,29 +224,29 @@ error[E0109]: type arguments are not allowed for this type
|
||||||
LL | AliasFixed::SVariant::<()> { v: () };
|
LL | AliasFixed::SVariant::<()> { v: () };
|
||||||
| ^^ type argument not allowed
|
| ^^ type argument not allowed
|
||||||
|
|
||||||
error[E0107]: this type alias takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/enum-variant-generic-args.rs:82:5
|
--> $DIR/enum-variant-generic-args.rs:82:5
|
||||||
|
|
|
|
||||||
LL | AliasFixed::<()>::SVariant { v: () };
|
LL | AliasFixed::<()>::SVariant { v: () };
|
||||||
| ^^^^^^^^^^------ help: remove these generics
|
| ^^^^^^^^^^------ help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: type alias defined here, with 0 type parameters
|
note: type alias defined here, with 0 generic parameters
|
||||||
--> $DIR/enum-variant-generic-args.rs:9:6
|
--> $DIR/enum-variant-generic-args.rs:9:6
|
||||||
|
|
|
|
||||||
LL | type AliasFixed = Enum<()>;
|
LL | type AliasFixed = Enum<()>;
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0107]: this type alias takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/enum-variant-generic-args.rs:84:5
|
--> $DIR/enum-variant-generic-args.rs:84:5
|
||||||
|
|
|
|
||||||
LL | AliasFixed::<()>::SVariant::<()> { v: () };
|
LL | AliasFixed::<()>::SVariant::<()> { v: () };
|
||||||
| ^^^^^^^^^^------ help: remove these generics
|
| ^^^^^^^^^^------ help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: type alias defined here, with 0 type parameters
|
note: type alias defined here, with 0 generic parameters
|
||||||
--> $DIR/enum-variant-generic-args.rs:9:6
|
--> $DIR/enum-variant-generic-args.rs:9:6
|
||||||
|
|
|
|
||||||
LL | type AliasFixed = Enum<()>;
|
LL | type AliasFixed = Enum<()>;
|
||||||
|
@ -282,29 +282,29 @@ error[E0109]: type arguments are not allowed for this type
|
||||||
LL | AliasFixed::UVariant::<()>;
|
LL | AliasFixed::UVariant::<()>;
|
||||||
| ^^ type argument not allowed
|
| ^^ type argument not allowed
|
||||||
|
|
||||||
error[E0107]: this type alias takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/enum-variant-generic-args.rs:100:5
|
--> $DIR/enum-variant-generic-args.rs:100:5
|
||||||
|
|
|
|
||||||
LL | AliasFixed::<()>::UVariant;
|
LL | AliasFixed::<()>::UVariant;
|
||||||
| ^^^^^^^^^^------ help: remove these generics
|
| ^^^^^^^^^^------ help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: type alias defined here, with 0 type parameters
|
note: type alias defined here, with 0 generic parameters
|
||||||
--> $DIR/enum-variant-generic-args.rs:9:6
|
--> $DIR/enum-variant-generic-args.rs:9:6
|
||||||
|
|
|
|
||||||
LL | type AliasFixed = Enum<()>;
|
LL | type AliasFixed = Enum<()>;
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0107]: this type alias takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/enum-variant-generic-args.rs:102:5
|
--> $DIR/enum-variant-generic-args.rs:102:5
|
||||||
|
|
|
|
||||||
LL | AliasFixed::<()>::UVariant::<()>;
|
LL | AliasFixed::<()>::UVariant::<()>;
|
||||||
| ^^^^^^^^^^------ help: remove these generics
|
| ^^^^^^^^^^------ help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: type alias defined here, with 0 type parameters
|
note: type alias defined here, with 0 generic parameters
|
||||||
--> $DIR/enum-variant-generic-args.rs:9:6
|
--> $DIR/enum-variant-generic-args.rs:9:6
|
||||||
|
|
|
|
||||||
LL | type AliasFixed = Enum<()>;
|
LL | type AliasFixed = Enum<()>;
|
||||||
|
|
|
@ -14,17 +14,17 @@ error[E0107]: missing generics for struct `Vec`
|
||||||
--> $DIR/issue-34255-1.rs:7:22
|
--> $DIR/issue-34255-1.rs:7:22
|
||||||
|
|
|
|
||||||
LL | input_cells: Vec::new()
|
LL | input_cells: Vec::new()
|
||||||
| ^^^ expected at least 1 type argument
|
| ^^^ expected at least 1 generic argument
|
||||||
|
|
|
|
||||||
note: struct defined here, with at least 1 type parameter: `T`
|
note: struct defined here, with at least 1 generic parameter: `T`
|
||||||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
|
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
|
LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
|
||||||
| ^^^ -
|
| ^^^ -
|
||||||
help: use angle brackets to add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | input_cells: Vec<T>::new()
|
LL | input_cells: Vec<T>::new()
|
||||||
| ^^^
|
| ^^^^^^
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ pub struct UI {}
|
||||||
|
|
||||||
impl UI {
|
impl UI {
|
||||||
pub fn run() -> Result<_> {
|
pub fn run() -> Result<_> {
|
||||||
//~^ ERROR: this enum takes 2 type arguments but only 1 type argument was supplied
|
//~^ ERROR: this enum takes 2 generic arguments but 1 generic argument was supplied
|
||||||
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures
|
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures
|
||||||
let mut ui = UI {};
|
let mut ui = UI {};
|
||||||
ui.interact();
|
ui.interact();
|
||||||
|
@ -13,7 +13,7 @@ impl UI {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn interact(&mut self) -> Result<_> {
|
pub fn interact(&mut self) -> Result<_> {
|
||||||
//~^ ERROR: this enum takes 2 type arguments but only 1 type argument was supplied
|
//~^ ERROR: this enum takes 2 generic arguments but 1 generic argument was supplied
|
||||||
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures
|
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
error[E0107]: this enum takes 2 type arguments but only 1 type argument was supplied
|
error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/issue-75883.rs:6:21
|
--> $DIR/issue-75883.rs:6:21
|
||||||
|
|
|
|
||||||
LL | pub fn run() -> Result<_> {
|
LL | pub fn run() -> Result<_> {
|
||||||
| ^^^^^^ - supplied 1 type argument
|
| ^^^^^^ - supplied 1 generic argument
|
||||||
| |
|
| |
|
||||||
| expected 2 type arguments
|
| expected 2 generic arguments
|
||||||
|
|
|
|
||||||
note: enum defined here, with 2 type parameters: `T`, `E`
|
note: enum defined here, with 2 generic parameters: `T`, `E`
|
||||||
--> $SRC_DIR/core/src/result.rs:LL:COL
|
--> $SRC_DIR/core/src/result.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub enum Result<T, E> {
|
LL | pub enum Result<T, E> {
|
||||||
| ^^^^^^ - -
|
| ^^^^^^ - -
|
||||||
help: add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | pub fn run() -> Result<_, E> {
|
LL | pub fn run() -> Result<_, E> {
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error[E0107]: this enum takes 2 type arguments but only 1 type argument was supplied
|
error[E0107]: this enum takes 2 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/issue-75883.rs:15:35
|
--> $DIR/issue-75883.rs:15:35
|
||||||
|
|
|
|
||||||
LL | pub fn interact(&mut self) -> Result<_> {
|
LL | pub fn interact(&mut self) -> Result<_> {
|
||||||
| ^^^^^^ - supplied 1 type argument
|
| ^^^^^^ - supplied 1 generic argument
|
||||||
| |
|
| |
|
||||||
| expected 2 type arguments
|
| expected 2 generic arguments
|
||||||
|
|
|
|
||||||
note: enum defined here, with 2 type parameters: `T`, `E`
|
note: enum defined here, with 2 generic parameters: `T`, `E`
|
||||||
--> $SRC_DIR/core/src/result.rs:LL:COL
|
--> $SRC_DIR/core/src/result.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub enum Result<T, E> {
|
LL | pub enum Result<T, E> {
|
||||||
| ^^^^^^ - -
|
| ^^^^^^ - -
|
||||||
help: add missing type argument
|
help: add missing generic argument
|
||||||
|
|
|
|
||||||
LL | pub fn interact(&mut self) -> Result<_, E> {
|
LL | pub fn interact(&mut self) -> Result<_, E> {
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
fn foo1<T:Copy<U>, U>(x: T) {}
|
fn foo1<T:Copy<U>, U>(x: T) {}
|
||||||
//~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied
|
//~^ ERROR this trait takes 0 generic arguments but 1 generic argument was supplied
|
||||||
|
|
||||||
trait Trait: Copy<dyn Send> {}
|
trait Trait: Copy<dyn Send> {}
|
||||||
//~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied
|
//~^ ERROR this trait takes 0 generic arguments but 1 generic argument was supplied
|
||||||
|
|
||||||
struct MyStruct1<T: Copy<T>>;
|
struct MyStruct1<T: Copy<T>>;
|
||||||
//~^ ERROR this trait takes 0 type arguments but 1 type argument was supplied
|
//~^ ERROR this trait takes 0 generic arguments but 1 generic argument was supplied
|
||||||
|
|
||||||
struct MyStruct2<'a, T: Copy<'a>>;
|
struct MyStruct2<'a, T: Copy<'a>>;
|
||||||
//~^ ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
|
//~^ ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
|
||||||
|
|
||||||
fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
|
fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
|
||||||
//~^ ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
|
//~^ ERROR this trait takes 0 lifetime arguments but 1 lifetime argument was supplied
|
||||||
//~| ERROR this trait takes 0 type arguments but 1 type argument was supplied
|
//~| ERROR this trait takes 0 generic arguments but 1 generic argument was supplied
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -1,40 +1,40 @@
|
||||||
error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/typeck-builtin-bound-type-parameters.rs:1:11
|
--> $DIR/typeck-builtin-bound-type-parameters.rs:1:11
|
||||||
|
|
|
|
||||||
LL | fn foo1<T:Copy<U>, U>(x: T) {}
|
LL | fn foo1<T:Copy<U>, U>(x: T) {}
|
||||||
| ^^^^--- help: remove these generics
|
| ^^^^--- help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: trait defined here, with 0 type parameters
|
note: trait defined here, with 0 generic parameters
|
||||||
--> $SRC_DIR/core/src/marker.rs:LL:COL
|
--> $SRC_DIR/core/src/marker.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub trait Copy: Clone {
|
LL | pub trait Copy: Clone {
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
||||||
error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/typeck-builtin-bound-type-parameters.rs:4:14
|
--> $DIR/typeck-builtin-bound-type-parameters.rs:4:14
|
||||||
|
|
|
|
||||||
LL | trait Trait: Copy<dyn Send> {}
|
LL | trait Trait: Copy<dyn Send> {}
|
||||||
| ^^^^---------- help: remove these generics
|
| ^^^^---------- help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: trait defined here, with 0 type parameters
|
note: trait defined here, with 0 generic parameters
|
||||||
--> $SRC_DIR/core/src/marker.rs:LL:COL
|
--> $SRC_DIR/core/src/marker.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub trait Copy: Clone {
|
LL | pub trait Copy: Clone {
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
||||||
error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/typeck-builtin-bound-type-parameters.rs:7:21
|
--> $DIR/typeck-builtin-bound-type-parameters.rs:7:21
|
||||||
|
|
|
|
||||||
LL | struct MyStruct1<T: Copy<T>>;
|
LL | struct MyStruct1<T: Copy<T>>;
|
||||||
| ^^^^--- help: remove these generics
|
| ^^^^--- help: remove these generics
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: trait defined here, with 0 type parameters
|
note: trait defined here, with 0 generic parameters
|
||||||
--> $SRC_DIR/core/src/marker.rs:LL:COL
|
--> $SRC_DIR/core/src/marker.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub trait Copy: Clone {
|
LL | pub trait Copy: Clone {
|
||||||
|
@ -58,7 +58,7 @@ error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was
|
||||||
--> $DIR/typeck-builtin-bound-type-parameters.rs:13:15
|
--> $DIR/typeck-builtin-bound-type-parameters.rs:13:15
|
||||||
|
|
|
|
||||||
LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
|
LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
|
||||||
| ^^^^ ---- help: remove this lifetime argument
|
| ^^^^ -- help: remove this lifetime argument
|
||||||
| |
|
| |
|
||||||
| expected 0 lifetime arguments
|
| expected 0 lifetime arguments
|
||||||
|
|
|
|
||||||
|
@ -68,15 +68,15 @@ note: trait defined here, with 0 lifetime parameters
|
||||||
LL | pub trait Copy: Clone {
|
LL | pub trait Copy: Clone {
|
||||||
| ^^^^
|
| ^^^^
|
||||||
|
|
||||||
error[E0107]: this trait takes 0 type arguments but 1 type argument was supplied
|
error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied
|
||||||
--> $DIR/typeck-builtin-bound-type-parameters.rs:13:15
|
--> $DIR/typeck-builtin-bound-type-parameters.rs:13:15
|
||||||
|
|
|
|
||||||
LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
|
LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
|
||||||
| ^^^^ --- help: remove this type argument
|
| ^^^^ - help: remove this generic argument
|
||||||
| |
|
| |
|
||||||
| expected 0 type arguments
|
| expected 0 generic arguments
|
||||||
|
|
|
|
||||||
note: trait defined here, with 0 type parameters
|
note: trait defined here, with 0 generic parameters
|
||||||
--> $SRC_DIR/core/src/marker.rs:LL:COL
|
--> $SRC_DIR/core/src/marker.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | pub trait Copy: Clone {
|
LL | pub trait Copy: Clone {
|
||||||
|
|
|
@ -7,5 +7,5 @@ struct Foo<'a, T:'a> {
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let c: Foo<_, _> = Foo { r: &5 };
|
let c: Foo<_, _> = Foo { r: &5 };
|
||||||
//~^ ERROR this struct takes 1 type argument but 2 type arguments were supplied
|
//~^ ERROR this struct takes 1 generic argument but 2 generic arguments were supplied
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue