mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Auto merge of #151864 - aerooneqq:delegation-generics-propagation, r=petrochenkov
Implement AST -> HIR generics propagation in delegation This PR adds support for generics propagation during AST -> HIR lowering and is a part of rust-lang/rust#118212. # High-level design overview ## Motivation The task is to generate generics for delegations (i.e. in this context we assume a function that is created for `reuse` statements) during AST -> HIR lowering. Then we want to propagate those generated params to generated method call (or default call) in delegation. This will help to solve issues like the following: ```rust mod to_reuse { pub fn consts<const N: i32>() -> i32 { N } } reuse to_reuse::consts; //~^ ERROR type annotations needed // DESUGARED CURRENT: #[attr = Inline(Hint)] fn consts() -> _ { to_reuse::consts() } // DESUGARED DESIRED: #[attr = Inline(Hint)] fn consts<const N: i32>() -> _ { to_reuse::consts::<N>() } ``` Moreover, user can specify generic args in `reuse`, we need to propagate them (works now) and inherit signature with substituted generic args: ```rust mod to_reuse { pub fn foo<T>(t: T) -> i32 { 0 } } reuse to_reuse::foo::<i32>; //~^ ERROR mismatched types fn main() { foo(123); } error[E0308]: mismatched types --> src/main.rs:24:17 | 19 | pub fn foo<T>(t: T) -> i32 { | - found this type parameter ... 24 | reuse to_reuse::foo::<i32>; | ^^^ | | | expected `i32`, found type parameter `T` | arguments to this function are incorrect | = note: expected type `i32` found type parameter `T` ``` In this case we want the delegation to have signature that have one `i32` parameter (not `T` parameter). Considering all other cases, for now we want to preserve existing behavior, which was almost fully done (at this stage there are changes in behavior of delegations with placeholders and late-bound lifetimes). ## Main approach overview The main approach is as follows: - We determine generic params of delegee parent (now only trait can act as a parent as delegation to inherent impls is not yet supported) and delegee function, - Based on presence of user-specified args in `reuse` statement (i.e. `reuse Trait::<'static, i32, 123>::foo::<String>`) we either generate delegee generic params or not. If not, then we should include user-specified generic args into the signature of delegation, - The general order of generic params generation is as following: `[DELEGEE PARENT LIFETIMES, DELEGEE LIFETIMES, DELEGEE PARENT TYPES AND CONSTS, DELEGEE TYPES AND CONSTS]`, - There are two possible generic params orderings (they differ only in a position of `Self` generic param): - When Self is after lifetimes, this happens only in free to trait delegation scenario, as we need to generate implicit Self param of the delegee trait, - When Self is in the beginning and we should not generate Self param, this is basically all other cases if there is an implicit Self generic param in delegation parent. - Considering propagation, we do not propagate lifetimes for child, as at AST -> HIR lowering stage we can not know whether the lifetime is late-bound or early bound, so for now we do not propagate them at all. There is one more hack with child lifetimes, for the same reason we create predicates of kind `'a: 'a` in order to preserve all lifetimes in HIR, so for now we can generate more lifetimes params then needed. This will be partially fixed in one of next pull requests. ## Implementation details - We obtain AST generics either from AST of a current crate if delegee is local or from external crate through `generics_of` of `tcx`. Next, as we want to generate new generic params we generate new node ids for them, remove default types and then invoke already existent routine for lowering AST generic params into HIR, - If there are user-specified args in either parent or child parts of the path, we save HIR ids of those segments and pass them to `hir_analysis` part, where user-specified args are obtained, then lowered through existing API and then used during signature and predicates inheritance, - If there are no user-specified args then we propagate generic args that correspond to generic params during generation of delegation, - During signature inheritance we know whether parent or child generic args were specified by the user, if so, we should merge them with generic params (i.e. cases when parent args are specified and child args are not: `reuse Trait::<String>::foo`), next we use those generic args and mapping for delegee parent and child generic params into those args in order to fold delegee signature and delegee predicates. ## Tests New tests were developed and can be found in `ast-hir-engine` folder, those tests cover all cases of delegation with different number of lifetimes, types, consts in generic params and different user-specified args cases (parent and child, parent/child only, none). ## Edge cases There are some edge cases worth mentioning. ### Free to trait delegation. Consider this example: ```rust trait Trait<'a, T, const N: usize> { fn foo<'x: 'x, A, B>(&self) {} } reuse Trait::foo; ``` As we are reusing from trait and delegee has `&self` param it means that delegation must have `Self` generic param: ```rust fn foo<'a, 'x, Self, T, const N: usize, A, B>(self) {} ``` We inherit predicates from Self implicit generic param in `Trait`, thus we can pass to delegation anything that implements this trait. Now, consider the case when user explicitly specifies parent generic args. ```rust reuse Trait::<'static, String, 1>::foo; ``` In this case we do not need to generate parent generic params, but we still need to generate `Self` in delegation (`DelegationGenerics::SelfAndUserSpecified` variant): ```rust fn foo<'x, Self, A, B>(self) {} ``` User-specified generic arguments should be used to replace parent generic params in delegation, so if we had param of type `T` in `foo`, during signature inheritance we should replace it with user-specified `String` type. ### impl trait delegation When we delegate from impl trait to something, we want the delegation to have signature that matches signature in trait. For this reason we already resolve delegation not to the actual delegee but to the trait method in order to inherit its signature. That is why when processing user-specified args when the caller kind is `impl trait` (`FnKind::AssocTraitImpl`), we discard parent user-specified args and replace them with those that are specified in trait header. In future we will also discard `child_args` but we need proper error handling for this case, so it will be addressed in one of future pull requests that are approximately specified in "Nearest future work" section. ## Nearest future work (approximate future pull requests): - Late-bound lifetimes - `impl Trait` params in functions - Proper propagation of parent generics when generating method call - ~Fix diagnostics duplication during lowering of user-specified types~ - Support for recursive delegations - Self types support `reuse <u8 as Trait<_>>::foo as generic_arguments2` - Decide what to do with infer args `reuse Trait::<_, _>::foo::<_>` - Proper error handling when there is a mismatch between actual and expected args (impl trait case) r? @petrochenkov
This commit is contained in:
@@ -46,7 +46,6 @@
|
||||
use rustc_attr_parsing::{AttributeParser, ShouldEmit};
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir::Target;
|
||||
use rustc_hir::attrs::{AttributeKind, InlineAttr};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_middle::span_bug;
|
||||
@@ -56,9 +55,14 @@
|
||||
use smallvec::SmallVec;
|
||||
use {rustc_ast as ast, rustc_hir as hir};
|
||||
|
||||
use super::{GenericArgsMode, ImplTraitContext, LoweringContext, ParamMode};
|
||||
use crate::delegation::generics::{GenericsGenerationResult, GenericsGenerationResults};
|
||||
use crate::errors::{CycleInDelegationSignatureResolution, UnresolvedDelegationCallee};
|
||||
use crate::{AllowReturnTypeNotation, ImplTraitPosition, ResolverAstLoweringExt};
|
||||
use crate::{
|
||||
AllowReturnTypeNotation, GenericArgsMode, ImplTraitContext, ImplTraitPosition, LoweringContext,
|
||||
ParamMode, ResolverAstLoweringExt,
|
||||
};
|
||||
|
||||
mod generics;
|
||||
|
||||
pub(crate) struct DelegationResults<'hir> {
|
||||
pub body_id: hir::BodyId,
|
||||
@@ -184,18 +188,48 @@ pub(crate) fn lower_delegation(
|
||||
// we need a function to extract this information
|
||||
let (param_count, c_variadic) = self.param_count(root_function_id);
|
||||
|
||||
let mut generics = self.lower_delegation_generics(
|
||||
delegation,
|
||||
ids.root_function_id(),
|
||||
item_id,
|
||||
span,
|
||||
);
|
||||
|
||||
let body_id = self.lower_delegation_body(
|
||||
delegation,
|
||||
item_id,
|
||||
is_method,
|
||||
param_count,
|
||||
&mut generics,
|
||||
span,
|
||||
);
|
||||
|
||||
// Here we use `delegee_id`, as this id will then be used to calculate parent for generics
|
||||
// inheritance, and we want this id to point on a delegee, not on the original
|
||||
// function (see https://github.com/rust-lang/rust/issues/150152#issuecomment-3674834654)
|
||||
let decl = self.lower_delegation_decl(delegee_id, param_count, c_variadic, span);
|
||||
let decl = self.lower_delegation_decl(
|
||||
delegee_id,
|
||||
param_count,
|
||||
c_variadic,
|
||||
span,
|
||||
&generics,
|
||||
);
|
||||
|
||||
// Here we pass `root_function_id` as we want to inherit signature (including consts, async)
|
||||
// from the root function that started delegation
|
||||
let sig = self.lower_delegation_sig(root_function_id, decl, span);
|
||||
|
||||
let body_id = self.lower_delegation_body(delegation, is_method, param_count, span);
|
||||
let ident = self.lower_ident(delegation.ident);
|
||||
let generics = self.lower_delegation_generics(span);
|
||||
|
||||
let generics = self.arena.alloc(hir::Generics {
|
||||
has_where_clause_predicates: false,
|
||||
params: self.arena.alloc_from_iter(generics.all_params(item_id, span, self)),
|
||||
predicates: self
|
||||
.arena
|
||||
.alloc_from_iter(generics.all_predicates(item_id, span, self)),
|
||||
span,
|
||||
where_clause_span: span,
|
||||
});
|
||||
|
||||
DelegationResults { body_id, sig, ident, generics }
|
||||
}
|
||||
Err(err) => self.generate_delegation_error(err, span, delegation),
|
||||
@@ -295,7 +329,7 @@ fn parse_local_original_attrs(&self, def_id: DefId) -> Option<Vec<hir::Attribute
|
||||
self.tcx.sess,
|
||||
attrs,
|
||||
None,
|
||||
Target::Fn,
|
||||
hir::Target::Fn,
|
||||
DUMMY_SP,
|
||||
DUMMY_NODE_ID,
|
||||
Some(self.tcx.features()),
|
||||
@@ -364,16 +398,6 @@ fn get_resolution_id(&self, node_id: NodeId) -> Option<DefId> {
|
||||
self.resolver.get_partial_res(node_id).and_then(|r| r.expect_full_res().opt_def_id())
|
||||
}
|
||||
|
||||
fn lower_delegation_generics(&mut self, span: Span) -> &'hir hir::Generics<'hir> {
|
||||
self.arena.alloc(hir::Generics {
|
||||
params: &[],
|
||||
predicates: &[],
|
||||
has_where_clause_predicates: false,
|
||||
where_clause_span: span,
|
||||
span,
|
||||
})
|
||||
}
|
||||
|
||||
// Function parameter count, including C variadic `...` if present.
|
||||
fn param_count(&self, def_id: DefId) -> (usize, bool /*c_variadic*/) {
|
||||
if let Some(local_sig_id) = def_id.as_local() {
|
||||
@@ -393,6 +417,7 @@ fn lower_delegation_decl(
|
||||
param_count: usize,
|
||||
c_variadic: bool,
|
||||
span: Span,
|
||||
generics: &GenericsGenerationResults<'hir>,
|
||||
) -> &'hir hir::FnDecl<'hir> {
|
||||
// The last parameter in C variadic functions is skipped in the signature,
|
||||
// like during regular lowering.
|
||||
@@ -405,7 +430,13 @@ fn lower_delegation_decl(
|
||||
|
||||
let output = self.arena.alloc(hir::Ty {
|
||||
hir_id: self.next_id(),
|
||||
kind: hir::TyKind::InferDelegation(sig_id, hir::InferDelegationKind::Output),
|
||||
kind: hir::TyKind::InferDelegation(
|
||||
sig_id,
|
||||
hir::InferDelegationKind::Output(self.arena.alloc(hir::DelegationGenerics {
|
||||
child_args_segment_id: generics.child.args_segment_id,
|
||||
parent_args_segment_id: generics.parent.args_segment_id,
|
||||
})),
|
||||
),
|
||||
span,
|
||||
});
|
||||
|
||||
@@ -460,6 +491,7 @@ fn lower_delegation_sig(
|
||||
abi: sig.abi,
|
||||
}
|
||||
};
|
||||
|
||||
hir::FnSig { decl, header, span }
|
||||
}
|
||||
|
||||
@@ -501,6 +533,7 @@ fn generate_arg(
|
||||
} else {
|
||||
Symbol::intern(&format!("arg{idx}"))
|
||||
};
|
||||
|
||||
let segments = self.arena.alloc_from_iter(iter::once(hir::PathSegment {
|
||||
ident: Ident::with_dummy_span(name),
|
||||
hir_id: self.next_id(),
|
||||
@@ -516,8 +549,10 @@ fn generate_arg(
|
||||
fn lower_delegation_body(
|
||||
&mut self,
|
||||
delegation: &Delegation,
|
||||
item_id: NodeId,
|
||||
is_method: bool,
|
||||
param_count: usize,
|
||||
generics: &mut GenericsGenerationResults<'hir>,
|
||||
span: Span,
|
||||
) -> BodyId {
|
||||
let block = delegation.body.as_deref();
|
||||
@@ -548,7 +583,8 @@ fn lower_delegation_body(
|
||||
args.push(arg);
|
||||
}
|
||||
|
||||
let final_expr = this.finalize_body_lowering(delegation, args, span);
|
||||
let final_expr = this.finalize_body_lowering(delegation, item_id, args, generics, span);
|
||||
|
||||
(this.arena.alloc_from_iter(parameters), final_expr)
|
||||
})
|
||||
}
|
||||
@@ -584,7 +620,9 @@ fn lower_target_expr(&mut self, block: &Block) -> hir::Expr<'hir> {
|
||||
fn finalize_body_lowering(
|
||||
&mut self,
|
||||
delegation: &Delegation,
|
||||
item_id: NodeId,
|
||||
args: Vec<hir::Expr<'hir>>,
|
||||
generics: &mut GenericsGenerationResults<'hir>,
|
||||
span: Span,
|
||||
) -> hir::Expr<'hir> {
|
||||
let args = self.arena.alloc_from_iter(args);
|
||||
@@ -609,6 +647,10 @@ fn finalize_body_lowering(
|
||||
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
|
||||
None,
|
||||
);
|
||||
|
||||
// FIXME(fn_delegation): proper support for parent generics propagation
|
||||
// in method call scenario.
|
||||
let segment = self.process_segment(item_id, span, &segment, &mut generics.child, false);
|
||||
let segment = self.arena.alloc(segment);
|
||||
|
||||
self.arena.alloc(hir::Expr {
|
||||
@@ -627,9 +669,41 @@ fn finalize_body_lowering(
|
||||
None,
|
||||
);
|
||||
|
||||
let callee_path = self.arena.alloc(self.mk_expr(hir::ExprKind::Path(path), span));
|
||||
let new_path = match path {
|
||||
hir::QPath::Resolved(ty, path) => {
|
||||
let mut new_path = path.clone();
|
||||
let len = new_path.segments.len();
|
||||
|
||||
new_path.segments = self.arena.alloc_from_iter(
|
||||
new_path.segments.iter().enumerate().map(|(idx, segment)| {
|
||||
let mut process_segment = |result, add_lifetimes| {
|
||||
self.process_segment(item_id, span, segment, result, add_lifetimes)
|
||||
};
|
||||
|
||||
if idx + 2 == len {
|
||||
process_segment(&mut generics.parent, true)
|
||||
} else if idx + 1 == len {
|
||||
process_segment(&mut generics.child, false)
|
||||
} else {
|
||||
segment.clone()
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
hir::QPath::Resolved(ty, self.arena.alloc(new_path))
|
||||
}
|
||||
hir::QPath::TypeRelative(ty, segment) => {
|
||||
let segment =
|
||||
self.process_segment(item_id, span, segment, &mut generics.child, false);
|
||||
|
||||
hir::QPath::TypeRelative(ty, self.arena.alloc(segment))
|
||||
}
|
||||
};
|
||||
|
||||
let callee_path = self.arena.alloc(self.mk_expr(hir::ExprKind::Path(new_path), span));
|
||||
self.arena.alloc(self.mk_expr(hir::ExprKind::Call(callee_path, args), span))
|
||||
};
|
||||
|
||||
let block = self.arena.alloc(hir::Block {
|
||||
stmts: &[],
|
||||
expr: Some(call),
|
||||
@@ -642,14 +716,40 @@ fn finalize_body_lowering(
|
||||
self.mk_expr(hir::ExprKind::Block(block, None), span)
|
||||
}
|
||||
|
||||
fn process_segment(
|
||||
&mut self,
|
||||
item_id: NodeId,
|
||||
span: Span,
|
||||
segment: &hir::PathSegment<'hir>,
|
||||
result: &mut GenericsGenerationResult<'hir>,
|
||||
add_lifetimes: bool,
|
||||
) -> hir::PathSegment<'hir> {
|
||||
// The first condition is needed when there is SelfAndUserSpecified case,
|
||||
// we don't want to propagate generics params in this situation.
|
||||
let segment = if !result.generics.is_user_specified()
|
||||
&& let Some(args) = result
|
||||
.generics
|
||||
.into_hir_generics(self, item_id, span)
|
||||
.into_generic_args(self, add_lifetimes, span)
|
||||
{
|
||||
hir::PathSegment { args: Some(args), ..segment.clone() }
|
||||
} else {
|
||||
segment.clone()
|
||||
};
|
||||
|
||||
if result.generics.is_user_specified() {
|
||||
result.args_segment_id = Some(segment.hir_id);
|
||||
}
|
||||
|
||||
segment
|
||||
}
|
||||
|
||||
fn generate_delegation_error(
|
||||
&mut self,
|
||||
err: ErrorGuaranteed,
|
||||
span: Span,
|
||||
delegation: &Delegation,
|
||||
) -> DelegationResults<'hir> {
|
||||
let generics = self.lower_delegation_generics(span);
|
||||
|
||||
let decl = self.arena.alloc(hir::FnDecl {
|
||||
inputs: &[],
|
||||
output: hir::FnRetTy::DefaultReturn(span),
|
||||
@@ -696,6 +796,7 @@ fn generate_delegation_error(
|
||||
(&[], this.mk_expr(body_expr, span))
|
||||
});
|
||||
|
||||
let generics = hir::Generics::empty();
|
||||
DelegationResults { ident, generics, body_id, sig }
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,578 @@
|
||||
use hir::HirId;
|
||||
use hir::def::{DefKind, Res};
|
||||
use rustc_ast::*;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_middle::ty::GenericParamDefKind;
|
||||
use rustc_middle::{bug, ty};
|
||||
use rustc_span::sym::{self};
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::{DUMMY_SP, Ident, Span};
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
|
||||
use crate::{AstOwner, LoweringContext};
|
||||
|
||||
pub(super) enum DelegationGenerics<T> {
|
||||
/// User-specified args are present: `reuse foo::<String>;`.
|
||||
UserSpecified,
|
||||
/// The default case when no user-specified args are present: `reuse Trait::foo;`.
|
||||
Default(Option<T>),
|
||||
/// In free-to-trait reuse, when user specified args for trait `reuse Trait::<i32>::foo;`
|
||||
/// in this case we need to both generate `Self` and process user args.
|
||||
SelfAndUserSpecified(Option<T>),
|
||||
}
|
||||
|
||||
/// Used for storing either AST generics or their lowered HIR version. Firstly we obtain
|
||||
/// AST generics either from local function from AST index or from external function
|
||||
/// through `tcx`. Next, at some point of generics processing we need to lower those
|
||||
/// generics to HIR, for this purpose we use `into_hir_generics` that lowers AST generics
|
||||
/// and replaces Ast variant with Hir. Such approach is useful as we can call this method
|
||||
/// at any time knowing that lowering will occur at most only once. Then, in order to obtain generic
|
||||
/// params or args we use `hir_generics_or_empty` or `into_generic_args` functions.
|
||||
/// There also may be situations when we obtained AST generics but never lowered them to HIR,
|
||||
/// meaning we did not propagate them and thus we do not need to generate generic params
|
||||
/// (i.e., method call scenarios), in such a case this approach helps
|
||||
/// a lot as if `into_hir_generics` will not be called then lowering will not happen.
|
||||
pub(super) enum HirOrAstGenerics<'hir> {
|
||||
Ast(DelegationGenerics<Generics>),
|
||||
Hir(DelegationGenerics<&'hir hir::Generics<'hir>>),
|
||||
}
|
||||
|
||||
pub(super) struct GenericsGenerationResult<'hir> {
|
||||
pub(super) generics: HirOrAstGenerics<'hir>,
|
||||
pub(super) args_segment_id: Option<HirId>,
|
||||
}
|
||||
|
||||
pub(super) struct GenericsGenerationResults<'hir> {
|
||||
pub(super) parent: GenericsGenerationResult<'hir>,
|
||||
pub(super) child: GenericsGenerationResult<'hir>,
|
||||
}
|
||||
|
||||
impl<T> DelegationGenerics<T> {
|
||||
fn is_user_specified(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
DelegationGenerics::UserSpecified | DelegationGenerics::SelfAndUserSpecified { .. }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'hir> HirOrAstGenerics<'hir> {
|
||||
pub(super) fn into_hir_generics(
|
||||
&mut self,
|
||||
ctx: &mut LoweringContext<'_, 'hir>,
|
||||
item_id: NodeId,
|
||||
span: Span,
|
||||
) -> &mut HirOrAstGenerics<'hir> {
|
||||
if let HirOrAstGenerics::Ast(generics) = self {
|
||||
let process_params = |generics: &mut Generics| {
|
||||
ctx.lower_delegation_generic_params(item_id, span, &mut generics.params)
|
||||
};
|
||||
|
||||
let hir_generics = match generics {
|
||||
DelegationGenerics::UserSpecified => DelegationGenerics::UserSpecified,
|
||||
DelegationGenerics::Default(generics) => {
|
||||
DelegationGenerics::Default(generics.as_mut().map(process_params))
|
||||
}
|
||||
DelegationGenerics::SelfAndUserSpecified(generics) => {
|
||||
DelegationGenerics::SelfAndUserSpecified(generics.as_mut().map(process_params))
|
||||
}
|
||||
};
|
||||
|
||||
*self = HirOrAstGenerics::Hir(hir_generics);
|
||||
}
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
fn hir_generics_or_empty(&self) -> &'hir hir::Generics<'hir> {
|
||||
match self {
|
||||
HirOrAstGenerics::Ast(_) => hir::Generics::empty(),
|
||||
HirOrAstGenerics::Hir(hir_generics) => match hir_generics {
|
||||
DelegationGenerics::UserSpecified => hir::Generics::empty(),
|
||||
DelegationGenerics::Default(generics)
|
||||
| DelegationGenerics::SelfAndUserSpecified(generics) => {
|
||||
generics.unwrap_or(hir::Generics::empty())
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn into_generic_args(
|
||||
&self,
|
||||
ctx: &mut LoweringContext<'_, 'hir>,
|
||||
add_lifetimes: bool,
|
||||
span: Span,
|
||||
) -> Option<&'hir hir::GenericArgs<'hir>> {
|
||||
match self {
|
||||
HirOrAstGenerics::Ast(_) => {
|
||||
bug!("Attempting to get generic args before lowering to HIR")
|
||||
}
|
||||
HirOrAstGenerics::Hir(hir_generics) => match hir_generics {
|
||||
DelegationGenerics::UserSpecified => None,
|
||||
DelegationGenerics::Default(generics)
|
||||
| DelegationGenerics::SelfAndUserSpecified(generics) => generics.map(|generics| {
|
||||
ctx.create_generics_args_from_params(generics.params, add_lifetimes, span)
|
||||
}),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn is_user_specified(&self) -> bool {
|
||||
match self {
|
||||
HirOrAstGenerics::Ast(ast_generics) => ast_generics.is_user_specified(),
|
||||
HirOrAstGenerics::Hir(hir_generics) => hir_generics.is_user_specified(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> GenericsGenerationResult<'a> {
|
||||
fn new(generics: DelegationGenerics<Generics>) -> GenericsGenerationResult<'a> {
|
||||
GenericsGenerationResult {
|
||||
generics: HirOrAstGenerics::Ast(generics),
|
||||
args_segment_id: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'hir> GenericsGenerationResults<'hir> {
|
||||
pub(super) fn all_params(
|
||||
&mut self,
|
||||
item_id: NodeId,
|
||||
span: Span,
|
||||
ctx: &mut LoweringContext<'_, 'hir>,
|
||||
) -> impl Iterator<Item = hir::GenericParam<'hir>> {
|
||||
// Now we always call `into_hir_generics` both on child and parent,
|
||||
// however in future we would not do that, when scenarios like
|
||||
// method call will be supported (if HIR generics were not obtained
|
||||
// then it means that we did not propagated them, thus we do not need
|
||||
// to generate params).
|
||||
let parent = self
|
||||
.parent
|
||||
.generics
|
||||
.into_hir_generics(ctx, item_id, span)
|
||||
.hir_generics_or_empty()
|
||||
.params;
|
||||
|
||||
let child = self
|
||||
.child
|
||||
.generics
|
||||
.into_hir_generics(ctx, item_id, span)
|
||||
.hir_generics_or_empty()
|
||||
.params;
|
||||
|
||||
// Order generics, firstly we have parent and child lifetimes,
|
||||
// then parent and child types and consts.
|
||||
// `generics_of` in `rustc_hir_analysis` will order them anyway,
|
||||
// however we want the order to be consistent in HIR too.
|
||||
parent
|
||||
.iter()
|
||||
.filter(|p| p.is_lifetime())
|
||||
.chain(child.iter().filter(|p| p.is_lifetime()))
|
||||
.chain(parent.iter().filter(|p| !p.is_lifetime()))
|
||||
.chain(child.iter().filter(|p| !p.is_lifetime()))
|
||||
.copied()
|
||||
}
|
||||
|
||||
/// As we add hack predicates(`'a: 'a`) for all lifetimes (see `lower_delegation_generic_params`
|
||||
/// and `generate_lifetime_predicate` functions) we need to add them to delegation generics.
|
||||
/// Those predicates will not affect resulting predicate inheritance and folding
|
||||
/// in `rustc_hir_analysis`, as we inherit all predicates from delegation signature.
|
||||
pub(super) fn all_predicates(
|
||||
&mut self,
|
||||
item_id: NodeId,
|
||||
span: Span,
|
||||
ctx: &mut LoweringContext<'_, 'hir>,
|
||||
) -> impl Iterator<Item = hir::WherePredicate<'hir>> {
|
||||
// Now we always call `into_hir_generics` both on child and parent,
|
||||
// however in future we would not do that, when scenarios like
|
||||
// method call will be supported (if HIR generics were not obtained
|
||||
// then it means that we did not propagated them, thus we do not need
|
||||
// to generate predicates).
|
||||
self.parent
|
||||
.generics
|
||||
.into_hir_generics(ctx, item_id, span)
|
||||
.hir_generics_or_empty()
|
||||
.predicates
|
||||
.into_iter()
|
||||
.chain(
|
||||
self.child
|
||||
.generics
|
||||
.into_hir_generics(ctx, item_id, span)
|
||||
.hir_generics_or_empty()
|
||||
.predicates
|
||||
.into_iter(),
|
||||
)
|
||||
.copied()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'hir> LoweringContext<'_, 'hir> {
|
||||
pub(super) fn lower_delegation_generics(
|
||||
&mut self,
|
||||
delegation: &Delegation,
|
||||
root_fn_id: DefId,
|
||||
item_id: NodeId,
|
||||
span: Span,
|
||||
) -> GenericsGenerationResults<'hir> {
|
||||
let delegation_in_free_ctx = !matches!(
|
||||
self.tcx.def_kind(self.tcx.local_parent(self.local_def_id(item_id))),
|
||||
DefKind::Trait | DefKind::Impl { .. }
|
||||
);
|
||||
|
||||
let root_function_in_trait =
|
||||
matches!(self.tcx.def_kind(self.tcx.parent(root_fn_id)), DefKind::Trait);
|
||||
|
||||
let generate_self = delegation_in_free_ctx && root_function_in_trait;
|
||||
|
||||
let parent_generics_factory = |this: &mut Self, user_specified: bool| {
|
||||
this.get_parent_generics(
|
||||
this.tcx.parent(root_fn_id),
|
||||
generate_self,
|
||||
user_specified,
|
||||
span,
|
||||
)
|
||||
};
|
||||
|
||||
let segments = &delegation.path.segments;
|
||||
let len = segments.len();
|
||||
|
||||
let can_add_generics_to_parent = len >= 2
|
||||
&& self.get_resolution_id(segments[len - 2].id).is_some_and(|def_id| {
|
||||
matches!(self.tcx.def_kind(def_id), DefKind::Trait | DefKind::TraitAlias)
|
||||
});
|
||||
|
||||
let parent_generics = if can_add_generics_to_parent {
|
||||
if segments[len - 2].args.is_some() {
|
||||
if generate_self {
|
||||
DelegationGenerics::SelfAndUserSpecified(parent_generics_factory(self, true))
|
||||
} else {
|
||||
DelegationGenerics::UserSpecified
|
||||
}
|
||||
} else {
|
||||
DelegationGenerics::Default(parent_generics_factory(self, false))
|
||||
}
|
||||
} else {
|
||||
DelegationGenerics::Default(None)
|
||||
};
|
||||
|
||||
let child_generics = if segments[len - 1].args.is_some() {
|
||||
DelegationGenerics::UserSpecified
|
||||
} else {
|
||||
DelegationGenerics::Default(self.get_fn_like_generics(root_fn_id, span))
|
||||
};
|
||||
|
||||
GenericsGenerationResults {
|
||||
parent: GenericsGenerationResult::new(parent_generics),
|
||||
child: GenericsGenerationResult::new(child_generics),
|
||||
}
|
||||
}
|
||||
|
||||
fn lower_delegation_generic_params(
|
||||
&mut self,
|
||||
item_id: NodeId,
|
||||
span: Span,
|
||||
params: &mut ThinVec<GenericParam>,
|
||||
) -> &'hir hir::Generics<'hir> {
|
||||
for p in params.iter_mut() {
|
||||
// We want to create completely new params, so we generate
|
||||
// a new id, otherwise assertions will be triggered.
|
||||
p.id = self.next_node_id();
|
||||
|
||||
// Remove default params, as they are not supported on functions
|
||||
// and there will duplicate DefId when we try to lower them later.
|
||||
match &mut p.kind {
|
||||
GenericParamKind::Lifetime => {}
|
||||
GenericParamKind::Type { default } => *default = None,
|
||||
GenericParamKind::Const { default, .. } => *default = None,
|
||||
}
|
||||
|
||||
// Note that we use self.disambiguator here, if we will create new every time
|
||||
// we will get ICE if params have the same name.
|
||||
self.resolver.node_id_to_def_id.insert(
|
||||
p.id,
|
||||
self.tcx
|
||||
.create_def(
|
||||
self.resolver.node_id_to_def_id[&item_id],
|
||||
Some(p.ident.name),
|
||||
match p.kind {
|
||||
GenericParamKind::Lifetime => DefKind::LifetimeParam,
|
||||
GenericParamKind::Type { .. } => DefKind::TyParam,
|
||||
GenericParamKind::Const { .. } => DefKind::ConstParam,
|
||||
},
|
||||
None,
|
||||
&mut self.disambiguator,
|
||||
)
|
||||
.def_id(),
|
||||
);
|
||||
}
|
||||
|
||||
// Fallback to default generic param lowering, we modified them in the loop above.
|
||||
let params = self.arena.alloc_from_iter(
|
||||
params.iter().map(|p| self.lower_generic_param(p, hir::GenericParamSource::Generics)),
|
||||
);
|
||||
|
||||
// HACK: for now we generate predicates such that all lifetimes are early bound,
|
||||
// we can not not generate early-bound lifetimes, but we can't know which of them
|
||||
// are late-bound at this level of compilation.
|
||||
// FIXME(fn_delegation): proper support for late bound lifetimes.
|
||||
self.arena.alloc(hir::Generics {
|
||||
params,
|
||||
predicates: self.arena.alloc_from_iter(
|
||||
params
|
||||
.iter()
|
||||
.filter_map(|p| p.is_lifetime().then(|| self.generate_lifetime_predicate(p))),
|
||||
),
|
||||
has_where_clause_predicates: false,
|
||||
where_clause_span: span,
|
||||
span,
|
||||
})
|
||||
}
|
||||
|
||||
fn generate_lifetime_predicate(
|
||||
&mut self,
|
||||
p: &hir::GenericParam<'hir>,
|
||||
) -> hir::WherePredicate<'hir> {
|
||||
let create_lifetime = |this: &mut Self| -> &'hir hir::Lifetime {
|
||||
this.arena.alloc(hir::Lifetime {
|
||||
hir_id: this.next_id(),
|
||||
ident: p.name.ident(),
|
||||
kind: rustc_hir::LifetimeKind::Param(p.def_id),
|
||||
source: rustc_hir::LifetimeSource::Path {
|
||||
angle_brackets: rustc_hir::AngleBrackets::Full,
|
||||
},
|
||||
syntax: rustc_hir::LifetimeSyntax::ExplicitBound,
|
||||
})
|
||||
};
|
||||
|
||||
hir::WherePredicate {
|
||||
hir_id: self.next_id(),
|
||||
span: DUMMY_SP,
|
||||
kind: self.arena.alloc(hir::WherePredicateKind::RegionPredicate(
|
||||
hir::WhereRegionPredicate {
|
||||
in_where_clause: true,
|
||||
lifetime: create_lifetime(self),
|
||||
bounds: self
|
||||
.arena
|
||||
.alloc_slice(&[hir::GenericBound::Outlives(create_lifetime(self))]),
|
||||
},
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
fn create_generics_args_from_params(
|
||||
&mut self,
|
||||
params: &[hir::GenericParam<'hir>],
|
||||
add_lifetimes: bool,
|
||||
span: Span,
|
||||
) -> &'hir hir::GenericArgs<'hir> {
|
||||
self.arena.alloc(hir::GenericArgs {
|
||||
args: self.arena.alloc_from_iter(params.iter().filter_map(|p| {
|
||||
// Skip self generic arg, we do not need to propagate it.
|
||||
if p.name.ident().name == kw::SelfUpper {
|
||||
return None;
|
||||
}
|
||||
|
||||
let create_path = |this: &mut Self| {
|
||||
let res = Res::Def(
|
||||
match p.kind {
|
||||
hir::GenericParamKind::Lifetime { .. } => DefKind::LifetimeParam,
|
||||
hir::GenericParamKind::Type { .. } => DefKind::TyParam,
|
||||
hir::GenericParamKind::Const { .. } => DefKind::ConstParam,
|
||||
},
|
||||
p.def_id.to_def_id(),
|
||||
);
|
||||
|
||||
hir::QPath::Resolved(
|
||||
None,
|
||||
self.arena.alloc(hir::Path {
|
||||
segments: this.arena.alloc_slice(&[hir::PathSegment {
|
||||
args: None,
|
||||
hir_id: this.next_id(),
|
||||
ident: p.name.ident(),
|
||||
infer_args: false,
|
||||
res,
|
||||
}]),
|
||||
res,
|
||||
span: p.span,
|
||||
}),
|
||||
)
|
||||
};
|
||||
|
||||
match p.kind {
|
||||
hir::GenericParamKind::Lifetime { .. } => match add_lifetimes {
|
||||
true => Some(hir::GenericArg::Lifetime(self.arena.alloc(hir::Lifetime {
|
||||
hir_id: self.next_id(),
|
||||
ident: p.name.ident(),
|
||||
kind: hir::LifetimeKind::Param(p.def_id),
|
||||
source: hir::LifetimeSource::Path {
|
||||
angle_brackets: hir::AngleBrackets::Full,
|
||||
},
|
||||
syntax: hir::LifetimeSyntax::ExplicitBound,
|
||||
}))),
|
||||
false => None,
|
||||
},
|
||||
hir::GenericParamKind::Type { .. } => {
|
||||
Some(hir::GenericArg::Type(self.arena.alloc(hir::Ty {
|
||||
hir_id: self.next_id(),
|
||||
span: p.span,
|
||||
kind: hir::TyKind::Path(create_path(self)),
|
||||
})))
|
||||
}
|
||||
hir::GenericParamKind::Const { .. } => {
|
||||
Some(hir::GenericArg::Const(self.arena.alloc(hir::ConstArg {
|
||||
hir_id: self.next_id(),
|
||||
kind: hir::ConstArgKind::Path(create_path(self)),
|
||||
span: p.span,
|
||||
})))
|
||||
}
|
||||
}
|
||||
})),
|
||||
constraints: &[],
|
||||
parenthesized: hir::GenericArgsParentheses::No,
|
||||
span_ext: span,
|
||||
})
|
||||
}
|
||||
|
||||
fn get_fn_like_generics(&mut self, id: DefId, span: Span) -> Option<Generics> {
|
||||
if let Some(local_id) = id.as_local() {
|
||||
match self.ast_index.get(local_id) {
|
||||
Some(AstOwner::Item(item)) if let ItemKind::Fn(f) = &item.kind => {
|
||||
Some(f.generics.clone())
|
||||
}
|
||||
Some(AstOwner::AssocItem(item, _)) if let AssocItemKind::Fn(f) = &item.kind => {
|
||||
Some(f.generics.clone())
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
} else {
|
||||
self.get_external_generics(id, false, span)
|
||||
}
|
||||
}
|
||||
|
||||
fn get_external_generics(
|
||||
&mut self,
|
||||
id: DefId,
|
||||
processing_parent: bool,
|
||||
span: Span,
|
||||
) -> Option<Generics> {
|
||||
let generics = self.tcx.generics_of(id);
|
||||
if generics.own_params.is_empty() {
|
||||
return None;
|
||||
}
|
||||
|
||||
// Skip first Self parameter if we are in trait, it will be added later.
|
||||
let to_skip = (processing_parent && generics.has_self) as usize;
|
||||
|
||||
Some(Generics {
|
||||
params: generics
|
||||
.own_params
|
||||
.iter()
|
||||
.skip(to_skip)
|
||||
.map(|p| GenericParam {
|
||||
attrs: Default::default(),
|
||||
bounds: Default::default(),
|
||||
colon_span: None,
|
||||
id: self.next_node_id(),
|
||||
ident: Ident::with_dummy_span(p.name),
|
||||
is_placeholder: false,
|
||||
kind: match p.kind {
|
||||
GenericParamDefKind::Lifetime => GenericParamKind::Lifetime,
|
||||
GenericParamDefKind::Type { .. } => {
|
||||
GenericParamKind::Type { default: None }
|
||||
}
|
||||
GenericParamDefKind::Const { .. } => self.map_const_kind(p, span),
|
||||
},
|
||||
})
|
||||
.collect(),
|
||||
where_clause: Default::default(),
|
||||
span: DUMMY_SP,
|
||||
})
|
||||
}
|
||||
|
||||
fn map_const_kind(&mut self, p: &ty::GenericParamDef, span: Span) -> GenericParamKind {
|
||||
let const_type = self.tcx.type_of(p.def_id).instantiate_identity();
|
||||
|
||||
let (type_symbol, res) = match const_type.kind() {
|
||||
ty::Bool => (sym::bool, Res::PrimTy(hir::PrimTy::Bool)),
|
||||
ty::Uint(uint) => (uint.name(), Res::PrimTy(hir::PrimTy::Uint(*uint))),
|
||||
ty::Int(int) => (int.name(), Res::PrimTy(hir::PrimTy::Int(*int))),
|
||||
ty::Char => (sym::char, Res::PrimTy(hir::PrimTy::Char)),
|
||||
_ => {
|
||||
self.tcx
|
||||
.dcx()
|
||||
.span_delayed_bug(span, format!("Unexpected const type: {}", const_type));
|
||||
|
||||
(sym::dummy, Res::Err)
|
||||
}
|
||||
};
|
||||
|
||||
let node_id = self.next_node_id();
|
||||
|
||||
self.resolver.partial_res_map.insert(node_id, hir::def::PartialRes::new(res));
|
||||
|
||||
GenericParamKind::Const {
|
||||
ty: Box::new(Ty {
|
||||
id: node_id,
|
||||
kind: TyKind::Path(
|
||||
None,
|
||||
Path {
|
||||
segments: thin_vec![PathSegment {
|
||||
ident: Ident::with_dummy_span(type_symbol),
|
||||
id: self.next_node_id(),
|
||||
args: None
|
||||
}],
|
||||
span: DUMMY_SP,
|
||||
tokens: None,
|
||||
},
|
||||
),
|
||||
span: DUMMY_SP,
|
||||
tokens: None,
|
||||
}),
|
||||
span: DUMMY_SP,
|
||||
default: None,
|
||||
}
|
||||
}
|
||||
|
||||
fn get_parent_generics(
|
||||
&mut self,
|
||||
id: DefId,
|
||||
add_self: bool,
|
||||
user_specified: bool,
|
||||
span: Span,
|
||||
) -> Option<Generics> {
|
||||
// If args are user-specified we still maybe need to add self.
|
||||
let mut generics = if user_specified {
|
||||
None
|
||||
} else {
|
||||
if let Some(local_id) = id.as_local() {
|
||||
if let Some(AstOwner::Item(item)) = self.ast_index.get(local_id)
|
||||
&& matches!(item.kind, ItemKind::Trait(..))
|
||||
{
|
||||
item.opt_generics().cloned()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
self.get_external_generics(id, true, span)
|
||||
}
|
||||
};
|
||||
|
||||
if add_self {
|
||||
generics.get_or_insert_default().params.insert(
|
||||
0,
|
||||
GenericParam {
|
||||
id: self.next_node_id(),
|
||||
ident: Ident::new(kw::SelfUpper, DUMMY_SP),
|
||||
attrs: Default::default(),
|
||||
bounds: vec![],
|
||||
is_placeholder: false,
|
||||
kind: GenericParamKind::Type { default: None },
|
||||
colon_span: None,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
generics
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ fn with_lctx(
|
||||
owner: NodeId,
|
||||
f: impl FnOnce(&mut LoweringContext<'_, 'hir>) -> hir::OwnerNode<'hir>,
|
||||
) {
|
||||
let mut lctx = LoweringContext::new(self.tcx, self.resolver);
|
||||
let mut lctx = LoweringContext::new(self.tcx, self.ast_index, self.resolver);
|
||||
lctx.with_hir_id_owner(owner, |lctx| f(lctx));
|
||||
|
||||
for (def_id, info) in lctx.children {
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
// tidy-alphabetical-start
|
||||
#![cfg_attr(bootstrap, feature(if_let_guard))]
|
||||
#![feature(box_patterns)]
|
||||
#![recursion_limit = "256"]
|
||||
// tidy-alphabetical-end
|
||||
|
||||
use std::mem;
|
||||
@@ -89,6 +90,15 @@ macro_rules! arena_vec {
|
||||
|
||||
struct LoweringContext<'a, 'hir> {
|
||||
tcx: TyCtxt<'hir>,
|
||||
|
||||
// During lowering of delegation we need to access AST of other functions
|
||||
// in order to properly propagate generics, we could have done it at resolve
|
||||
// stage, however it will require either to firstly identify functions that
|
||||
// are being reused and store their generics, or to store generics of all functions
|
||||
// in resolver. This approach helps with those problems, as functions that are reused
|
||||
// will be in AST index.
|
||||
ast_index: &'a IndexSlice<LocalDefId, AstOwner<'a>>,
|
||||
|
||||
resolver: &'a mut ResolverAstLowering,
|
||||
disambiguator: DisambiguatorState,
|
||||
|
||||
@@ -149,11 +159,16 @@ struct LoweringContext<'a, 'hir> {
|
||||
}
|
||||
|
||||
impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
fn new(tcx: TyCtxt<'hir>, resolver: &'a mut ResolverAstLowering) -> Self {
|
||||
fn new(
|
||||
tcx: TyCtxt<'hir>,
|
||||
ast_index: &'a IndexSlice<LocalDefId, AstOwner<'a>>,
|
||||
resolver: &'a mut ResolverAstLowering,
|
||||
) -> Self {
|
||||
let registered_tools = tcx.registered_tools(()).iter().map(|x| x.name).collect();
|
||||
Self {
|
||||
// Pseudo-globals.
|
||||
tcx,
|
||||
ast_index,
|
||||
resolver,
|
||||
disambiguator: DisambiguatorState::new(),
|
||||
arena: tcx.hir_arena,
|
||||
|
||||
@@ -861,6 +861,10 @@ pub fn is_impl_trait(&self) -> bool {
|
||||
pub fn is_elided_lifetime(&self) -> bool {
|
||||
matches!(self.kind, GenericParamKind::Lifetime { kind: LifetimeParamKind::Elided(_) })
|
||||
}
|
||||
|
||||
pub fn is_lifetime(&self) -> bool {
|
||||
matches!(self.kind, GenericParamKind::Lifetime { .. })
|
||||
}
|
||||
}
|
||||
|
||||
/// Records where the generic parameter originated from.
|
||||
@@ -3759,10 +3763,18 @@ pub enum OpaqueTyOrigin<D> {
|
||||
},
|
||||
}
|
||||
|
||||
// Ids of parent (or child) path segment that contains user-specified args
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable_Generic)]
|
||||
pub enum InferDelegationKind {
|
||||
pub struct DelegationGenerics {
|
||||
pub parent_args_segment_id: Option<HirId>,
|
||||
pub child_args_segment_id: Option<HirId>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable_Generic)]
|
||||
pub enum InferDelegationKind<'hir> {
|
||||
Input(usize),
|
||||
Output,
|
||||
// Place generics info here, as we always specify output type for delegations.
|
||||
Output(&'hir DelegationGenerics),
|
||||
}
|
||||
|
||||
/// The various kinds of types recognized by the compiler.
|
||||
@@ -3774,7 +3786,7 @@ pub enum InferDelegationKind {
|
||||
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||
pub enum TyKind<'hir, Unambig = ()> {
|
||||
/// Actual type should be inherited from `DefId` signature
|
||||
InferDelegation(DefId, InferDelegationKind),
|
||||
InferDelegation(DefId, InferDelegationKind<'hir>),
|
||||
/// A variable length slice (i.e., `[T]`).
|
||||
Slice(&'hir Ty<'hir>),
|
||||
/// A fixed length array (i.e., `[T; n]`).
|
||||
@@ -3931,6 +3943,17 @@ pub fn opt_delegation_sig_id(&self) -> Option<DefId> {
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub fn opt_delegation_generics(&self) -> Option<&'hir DelegationGenerics> {
|
||||
if let FnRetTy::Return(ty) = self.output
|
||||
&& let TyKind::InferDelegation(_, kind) = ty.kind
|
||||
&& let InferDelegationKind::Output(generics) = kind
|
||||
{
|
||||
return Some(generics);
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents what type of implicit self a function has, if any.
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
use rustc_span::{Span, Symbol, kw};
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use crate::delegation::inherit_generics_for_delegation_item;
|
||||
use crate::middle::resolve_bound_vars as rbv;
|
||||
|
||||
#[instrument(level = "debug", skip(tcx), ret)]
|
||||
@@ -56,13 +55,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
|
||||
}
|
||||
|
||||
let hir_id = tcx.local_def_id_to_hir_id(def_id);
|
||||
|
||||
let node = tcx.hir_node(hir_id);
|
||||
if let Some(sig) = node.fn_sig()
|
||||
&& let Some(sig_id) = sig.decl.opt_delegation_sig_id()
|
||||
{
|
||||
return inherit_generics_for_delegation_item(tcx, def_id, sig_id);
|
||||
}
|
||||
|
||||
let parent_def_id = match node {
|
||||
Node::ImplItem(_)
|
||||
|
||||
@@ -6,10 +6,14 @@
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::{HirId, PathSegment};
|
||||
use rustc_middle::ty::{
|
||||
self, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitableExt,
|
||||
self, EarlyBinder, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitableExt,
|
||||
};
|
||||
use rustc_span::{ErrorGuaranteed, Span};
|
||||
use rustc_span::{ErrorGuaranteed, Span, kw};
|
||||
|
||||
use crate::collect::ItemCtxt;
|
||||
use crate::hir_ty_lowering::{GenericArgPosition, HirTyLowerer};
|
||||
|
||||
type RemapTable = FxHashMap<u32, u32>;
|
||||
|
||||
@@ -59,6 +63,25 @@ fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
enum SelfPositionKind {
|
||||
AfterLifetimes,
|
||||
Zero,
|
||||
None,
|
||||
}
|
||||
|
||||
fn create_self_position_kind(caller_kind: FnKind, callee_kind: FnKind) -> SelfPositionKind {
|
||||
match (caller_kind, callee_kind) {
|
||||
(FnKind::AssocInherentImpl, FnKind::AssocTrait)
|
||||
| (FnKind::AssocTraitImpl, FnKind::AssocTrait)
|
||||
| (FnKind::AssocTrait, FnKind::AssocTrait)
|
||||
| (FnKind::AssocTrait, FnKind::Free) => SelfPositionKind::Zero,
|
||||
|
||||
(FnKind::Free, FnKind::AssocTrait) => SelfPositionKind::AfterLifetimes,
|
||||
|
||||
_ => SelfPositionKind::None,
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
enum FnKind {
|
||||
Free,
|
||||
@@ -67,7 +90,9 @@ enum FnKind {
|
||||
AssocTraitImpl,
|
||||
}
|
||||
|
||||
fn fn_kind<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> FnKind {
|
||||
fn fn_kind<'tcx>(tcx: TyCtxt<'tcx>, def_id: impl Into<DefId>) -> FnKind {
|
||||
let def_id = def_id.into();
|
||||
|
||||
debug_assert_matches!(tcx.def_kind(def_id), DefKind::Fn | DefKind::AssocFn);
|
||||
|
||||
let parent = tcx.parent(def_id);
|
||||
@@ -99,103 +124,338 @@ enum InheritanceKind {
|
||||
Own,
|
||||
}
|
||||
|
||||
fn build_generics<'tcx>(
|
||||
/// Maps sig generics into generic args of delegation. Delegation generics has the following pattern:
|
||||
///
|
||||
/// [SELF | maybe self in the beginning]
|
||||
/// [PARENT | args of delegation parent]
|
||||
/// [SIG PARENT LIFETIMES]
|
||||
/// [SIG LIFETIMES]
|
||||
/// [SELF | maybe self after lifetimes, when we reuse trait fn in free context]
|
||||
/// [SIG PARENT TYPES/CONSTS]
|
||||
/// [SIG TYPES/CONSTS]
|
||||
fn create_mapping<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
sig_id: DefId,
|
||||
parent: Option<DefId>,
|
||||
inh_kind: InheritanceKind,
|
||||
) -> ty::Generics {
|
||||
let mut own_params = vec![];
|
||||
def_id: LocalDefId,
|
||||
args: &[ty::GenericArg<'tcx>],
|
||||
) -> FxHashMap<u32, u32> {
|
||||
let mut mapping: FxHashMap<u32, u32> = Default::default();
|
||||
|
||||
let (caller_kind, callee_kind) = (fn_kind(tcx, def_id), fn_kind(tcx, sig_id));
|
||||
let self_pos_kind = create_self_position_kind(caller_kind, callee_kind);
|
||||
let is_self_at_zero = matches!(self_pos_kind, SelfPositionKind::Zero);
|
||||
|
||||
// Is self at zero? If so insert mapping, self in sig parent is always at 0.
|
||||
if is_self_at_zero {
|
||||
mapping.insert(0, 0);
|
||||
}
|
||||
|
||||
let mut args_index = 0;
|
||||
|
||||
args_index += is_self_at_zero as usize;
|
||||
args_index += get_delegation_parent_args_count_without_self(tcx, def_id, sig_id);
|
||||
|
||||
let sig_generics = tcx.generics_of(sig_id);
|
||||
if let InheritanceKind::WithParent(has_self) = inh_kind
|
||||
&& let Some(parent_def_id) = sig_generics.parent
|
||||
{
|
||||
let sig_parent_generics = tcx.generics_of(parent_def_id);
|
||||
own_params.append(&mut sig_parent_generics.own_params.clone());
|
||||
if !has_self {
|
||||
own_params.remove(0);
|
||||
}
|
||||
}
|
||||
own_params.append(&mut sig_generics.own_params.clone());
|
||||
let process_sig_parent_generics = matches!(callee_kind, FnKind::AssocTrait);
|
||||
|
||||
// Lifetime parameters must be declared before type and const parameters.
|
||||
// Therefore, When delegating from a free function to a associated function,
|
||||
// generic parameters need to be reordered:
|
||||
//
|
||||
// trait Trait<'a, A> {
|
||||
// fn foo<'b, B>(...) {...}
|
||||
// }
|
||||
//
|
||||
// reuse Trait::foo;
|
||||
// desugaring:
|
||||
// fn foo<'a, 'b, This: Trait<'a, A>, A, B>(...) {
|
||||
// Trait::foo(...)
|
||||
// }
|
||||
own_params.sort_by_key(|key| key.kind.is_ty_or_const());
|
||||
|
||||
let (parent_count, has_self) = if let Some(def_id) = parent {
|
||||
let parent_generics = tcx.generics_of(def_id);
|
||||
let parent_kind = tcx.def_kind(def_id);
|
||||
(parent_generics.count(), parent_kind == DefKind::Trait)
|
||||
} else {
|
||||
(0, false)
|
||||
};
|
||||
|
||||
for (idx, param) in own_params.iter_mut().enumerate() {
|
||||
param.index = (idx + parent_count) as u32;
|
||||
// FIXME(fn_delegation): Default parameters are not inherited, because they are
|
||||
// not permitted in functions. Therefore, there are 2 options here:
|
||||
//
|
||||
// - We can create non-default generic parameters.
|
||||
// - We can substitute default parameters into the signature.
|
||||
//
|
||||
// At the moment, first option has been selected as the most general.
|
||||
if let ty::GenericParamDefKind::Type { has_default, .. }
|
||||
| ty::GenericParamDefKind::Const { has_default, .. } = &mut param.kind
|
||||
{
|
||||
*has_default = false;
|
||||
if process_sig_parent_generics {
|
||||
for i in (sig_generics.has_self as usize)..sig_generics.parent_count {
|
||||
let param = sig_generics.param_at(i, tcx);
|
||||
if !param.kind.is_ty_or_const() {
|
||||
mapping.insert(param.index, args_index as u32);
|
||||
args_index += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let param_def_id_to_index =
|
||||
own_params.iter().map(|param| (param.def_id, param.index)).collect();
|
||||
for param in &sig_generics.own_params {
|
||||
if !param.kind.is_ty_or_const() {
|
||||
mapping.insert(param.index, args_index as u32);
|
||||
args_index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
ty::Generics {
|
||||
parent,
|
||||
parent_count,
|
||||
own_params,
|
||||
param_def_id_to_index,
|
||||
has_self,
|
||||
has_late_bound_regions: sig_generics.has_late_bound_regions,
|
||||
// If there are still unmapped lifetimes left and we are to map types and maybe self
|
||||
// then skip them, now it is the case when we generated more lifetimes then needed.
|
||||
// FIXME(fn_delegation): proper support for late bound lifetimes.
|
||||
while args_index < args.len() && args[args_index].as_region().is_some() {
|
||||
args_index += 1;
|
||||
}
|
||||
|
||||
// If self after lifetimes insert mapping, relying that self is at 0 in sig parent.
|
||||
if matches!(self_pos_kind, SelfPositionKind::AfterLifetimes) {
|
||||
mapping.insert(0, args_index as u32);
|
||||
args_index += 1;
|
||||
}
|
||||
|
||||
if process_sig_parent_generics {
|
||||
for i in (sig_generics.has_self as usize)..sig_generics.parent_count {
|
||||
let param = sig_generics.param_at(i, tcx);
|
||||
if param.kind.is_ty_or_const() {
|
||||
mapping.insert(param.index, args_index as u32);
|
||||
args_index += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for param in &sig_generics.own_params {
|
||||
if param.kind.is_ty_or_const() {
|
||||
mapping.insert(param.index, args_index as u32);
|
||||
args_index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
mapping
|
||||
}
|
||||
|
||||
fn get_delegation_parent_args_count_without_self<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
delegation_id: LocalDefId,
|
||||
sig_id: DefId,
|
||||
) -> usize {
|
||||
let delegation_parent_args_count = tcx.generics_of(delegation_id).parent_count;
|
||||
|
||||
match (fn_kind(tcx, delegation_id), fn_kind(tcx, sig_id)) {
|
||||
(FnKind::Free, FnKind::Free)
|
||||
| (FnKind::Free, FnKind::AssocTrait)
|
||||
| (FnKind::AssocTraitImpl, FnKind::AssocTrait) => 0,
|
||||
|
||||
(FnKind::AssocInherentImpl, FnKind::Free)
|
||||
| (FnKind::AssocInherentImpl, FnKind::AssocTrait) => {
|
||||
delegation_parent_args_count /* No Self in AssocInherentImpl */
|
||||
}
|
||||
|
||||
(FnKind::AssocTrait, FnKind::Free) | (FnKind::AssocTrait, FnKind::AssocTrait) => {
|
||||
delegation_parent_args_count - 1 /* Without Self */
|
||||
}
|
||||
|
||||
// For trait impl's `sig_id` is always equal to the corresponding trait method.
|
||||
// For inherent methods delegation is not yet supported.
|
||||
(FnKind::AssocTraitImpl, _)
|
||||
| (_, FnKind::AssocTraitImpl)
|
||||
| (_, FnKind::AssocInherentImpl) => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn build_predicates<'tcx>(
|
||||
fn get_parent_and_inheritance_kind<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def_id: LocalDefId,
|
||||
sig_id: DefId,
|
||||
) -> (Option<DefId>, InheritanceKind) {
|
||||
match (fn_kind(tcx, def_id), fn_kind(tcx, sig_id)) {
|
||||
(FnKind::Free, FnKind::Free) | (FnKind::Free, FnKind::AssocTrait) => {
|
||||
(None, InheritanceKind::WithParent(true))
|
||||
}
|
||||
|
||||
(FnKind::AssocTraitImpl, FnKind::AssocTrait) => {
|
||||
(Some(tcx.parent(def_id.to_def_id())), InheritanceKind::Own)
|
||||
}
|
||||
|
||||
(FnKind::AssocInherentImpl, FnKind::AssocTrait)
|
||||
| (FnKind::AssocTrait, FnKind::AssocTrait)
|
||||
| (FnKind::AssocInherentImpl, FnKind::Free)
|
||||
| (FnKind::AssocTrait, FnKind::Free) => {
|
||||
(Some(tcx.parent(def_id.to_def_id())), InheritanceKind::WithParent(false))
|
||||
}
|
||||
|
||||
// For trait impl's `sig_id` is always equal to the corresponding trait method.
|
||||
// For inherent methods delegation is not yet supported.
|
||||
(FnKind::AssocTraitImpl, _)
|
||||
| (_, FnKind::AssocTraitImpl)
|
||||
| (_, FnKind::AssocInherentImpl) => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn get_delegation_self_ty<'tcx>(tcx: TyCtxt<'tcx>, delegation_id: LocalDefId) -> Option<Ty<'tcx>> {
|
||||
let sig_id = tcx.hir_opt_delegation_sig_id(delegation_id).expect("Delegation must have sig_id");
|
||||
let (caller_kind, callee_kind) = (fn_kind(tcx, delegation_id), fn_kind(tcx, sig_id));
|
||||
|
||||
match (caller_kind, callee_kind) {
|
||||
(FnKind::Free, FnKind::AssocTrait)
|
||||
| (FnKind::AssocInherentImpl, FnKind::Free)
|
||||
| (FnKind::Free, FnKind::Free)
|
||||
| (FnKind::AssocTrait, FnKind::Free)
|
||||
| (FnKind::AssocTrait, FnKind::AssocTrait) => {
|
||||
match create_self_position_kind(caller_kind, callee_kind) {
|
||||
SelfPositionKind::None => None,
|
||||
SelfPositionKind::AfterLifetimes => {
|
||||
// Both sig parent and child lifetimes are in included in this count.
|
||||
Some(tcx.generics_of(delegation_id).own_counts().lifetimes)
|
||||
}
|
||||
SelfPositionKind::Zero => Some(0),
|
||||
}
|
||||
.map(|self_index| Ty::new_param(tcx, self_index as u32, kw::SelfUpper))
|
||||
}
|
||||
|
||||
(FnKind::AssocTraitImpl, FnKind::AssocTrait)
|
||||
| (FnKind::AssocInherentImpl, FnKind::AssocTrait) => {
|
||||
Some(tcx.type_of(tcx.local_parent(delegation_id)).instantiate_identity())
|
||||
}
|
||||
|
||||
// For trait impl's `sig_id` is always equal to the corresponding trait method.
|
||||
// For inherent methods delegation is not yet supported.
|
||||
(FnKind::AssocTraitImpl, _)
|
||||
| (_, FnKind::AssocTraitImpl)
|
||||
| (_, FnKind::AssocInherentImpl) => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates generic arguments for further delegation signature and predicates instantiation.
|
||||
/// Arguments can be user-specified (in this case they are in `parent_args` and `child_args`)
|
||||
/// or propagated. User can specify either both `parent_args` and `child_args`, one of them or none,
|
||||
/// that is why we firstly create generic arguments from generic params and then adjust them with
|
||||
/// user-specified args.
|
||||
///
|
||||
/// The order of produced list is important, it must be of this pattern:
|
||||
///
|
||||
/// [SELF | maybe self in the beginning]
|
||||
/// [PARENT | args of delegation parent]
|
||||
/// [SIG PARENT LIFETIMES] <- `lifetimes_end_pos`
|
||||
/// [SIG LIFETIMES]
|
||||
/// [SELF | maybe self after lifetimes, when we reuse trait fn in free context]
|
||||
/// [SIG PARENT TYPES/CONSTS]
|
||||
/// [SIG TYPES/CONSTS]
|
||||
fn create_generic_args<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
sig_id: DefId,
|
||||
parent: Option<DefId>,
|
||||
inh_kind: InheritanceKind,
|
||||
args: ty::GenericArgsRef<'tcx>,
|
||||
delegation_id: LocalDefId,
|
||||
mut parent_args: &[ty::GenericArg<'tcx>],
|
||||
child_args: &[ty::GenericArg<'tcx>],
|
||||
) -> Vec<ty::GenericArg<'tcx>> {
|
||||
let (caller_kind, callee_kind) = (fn_kind(tcx, delegation_id), fn_kind(tcx, sig_id));
|
||||
|
||||
let delegation_args = ty::GenericArgs::identity_for_item(tcx, delegation_id);
|
||||
let delegation_parent_args_count = tcx.generics_of(delegation_id).parent_count;
|
||||
|
||||
let deleg_parent_args_without_self_count =
|
||||
get_delegation_parent_args_count_without_self(tcx, delegation_id, sig_id);
|
||||
|
||||
let args = match (caller_kind, callee_kind) {
|
||||
(FnKind::Free, FnKind::Free)
|
||||
| (FnKind::Free, FnKind::AssocTrait)
|
||||
| (FnKind::AssocInherentImpl, FnKind::Free)
|
||||
| (FnKind::AssocTrait, FnKind::Free)
|
||||
| (FnKind::AssocTrait, FnKind::AssocTrait) => delegation_args,
|
||||
|
||||
(FnKind::AssocTraitImpl, FnKind::AssocTrait) => {
|
||||
// Special case, as user specifies Trait args in impl trait header, we want to treat
|
||||
// them as parent args.
|
||||
let parent = tcx.local_parent(delegation_id);
|
||||
parent_args = tcx.impl_trait_header(parent).trait_ref.instantiate_identity().args;
|
||||
tcx.mk_args(&delegation_args[delegation_parent_args_count..])
|
||||
}
|
||||
|
||||
(FnKind::AssocInherentImpl, FnKind::AssocTrait) => {
|
||||
let self_ty = tcx.type_of(tcx.local_parent(delegation_id)).instantiate_identity();
|
||||
|
||||
tcx.mk_args_from_iter(
|
||||
std::iter::once(ty::GenericArg::from(self_ty)).chain(delegation_args.iter()),
|
||||
)
|
||||
}
|
||||
|
||||
// For trait impl's `sig_id` is always equal to the corresponding trait method.
|
||||
// For inherent methods delegation is not yet supported.
|
||||
(FnKind::AssocTraitImpl, _)
|
||||
| (_, FnKind::AssocTraitImpl)
|
||||
| (_, FnKind::AssocInherentImpl) => unreachable!(),
|
||||
};
|
||||
|
||||
let mut new_args = vec![];
|
||||
|
||||
let self_pos_kind = create_self_position_kind(caller_kind, callee_kind);
|
||||
let mut lifetimes_end_pos;
|
||||
|
||||
if !parent_args.is_empty() {
|
||||
let parent_args_lifetimes_count =
|
||||
parent_args.iter().filter(|a| a.as_region().is_some()).count();
|
||||
|
||||
match self_pos_kind {
|
||||
SelfPositionKind::AfterLifetimes => {
|
||||
new_args.extend(&parent_args[1..1 + parent_args_lifetimes_count]);
|
||||
|
||||
lifetimes_end_pos = parent_args_lifetimes_count;
|
||||
|
||||
new_args.push(parent_args[0]);
|
||||
|
||||
new_args.extend(&parent_args[1 + parent_args_lifetimes_count..]);
|
||||
}
|
||||
SelfPositionKind::Zero => {
|
||||
lifetimes_end_pos = 1 /* Self */ + parent_args_lifetimes_count;
|
||||
new_args.extend_from_slice(parent_args);
|
||||
|
||||
for i in 0..deleg_parent_args_without_self_count {
|
||||
new_args.insert(1 + i, args[1 + i]);
|
||||
}
|
||||
|
||||
lifetimes_end_pos += deleg_parent_args_without_self_count;
|
||||
}
|
||||
// If we have parent args then we obtained them from trait, then self must be somewhere
|
||||
SelfPositionKind::None => unreachable!(),
|
||||
};
|
||||
} else {
|
||||
let self_impact = matches!(self_pos_kind, SelfPositionKind::Zero) as usize;
|
||||
|
||||
lifetimes_end_pos = self_impact
|
||||
+ deleg_parent_args_without_self_count
|
||||
+ &args[self_impact + deleg_parent_args_without_self_count..]
|
||||
.iter()
|
||||
.filter(|a| a.as_region().is_some())
|
||||
.count();
|
||||
|
||||
new_args.extend_from_slice(args);
|
||||
}
|
||||
|
||||
if !child_args.is_empty() {
|
||||
let child_lifetimes_count = child_args.iter().filter(|a| a.as_region().is_some()).count();
|
||||
|
||||
for i in 0..child_lifetimes_count {
|
||||
new_args.insert(lifetimes_end_pos + i, child_args[i]);
|
||||
}
|
||||
|
||||
new_args.extend_from_slice(&child_args[child_lifetimes_count..]);
|
||||
} else if !parent_args.is_empty() {
|
||||
let child_args = &delegation_args[delegation_parent_args_count..];
|
||||
|
||||
let child_lifetimes_count =
|
||||
child_args.iter().take_while(|a| a.as_region().is_some()).count();
|
||||
|
||||
for i in 0..child_lifetimes_count {
|
||||
new_args.insert(lifetimes_end_pos + i, child_args[i]);
|
||||
}
|
||||
|
||||
let skip_self = matches!(self_pos_kind, SelfPositionKind::AfterLifetimes);
|
||||
new_args.extend(&child_args[child_lifetimes_count + skip_self as usize..]);
|
||||
}
|
||||
|
||||
new_args
|
||||
}
|
||||
|
||||
pub(crate) fn inherit_predicates_for_delegation_item<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def_id: LocalDefId,
|
||||
sig_id: DefId,
|
||||
) -> ty::GenericPredicates<'tcx> {
|
||||
struct PredicatesCollector<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
preds: Vec<(ty::Clause<'tcx>, Span)>,
|
||||
args: ty::GenericArgsRef<'tcx>,
|
||||
args: Vec<ty::GenericArg<'tcx>>,
|
||||
folder: ParamIndexRemapper<'tcx>,
|
||||
}
|
||||
|
||||
impl<'tcx> PredicatesCollector<'tcx> {
|
||||
fn new(tcx: TyCtxt<'tcx>, args: ty::GenericArgsRef<'tcx>) -> PredicatesCollector<'tcx> {
|
||||
PredicatesCollector { tcx, preds: vec![], args }
|
||||
}
|
||||
|
||||
fn with_own_preds(
|
||||
mut self,
|
||||
f: impl Fn(DefId) -> ty::GenericPredicates<'tcx>,
|
||||
def_id: DefId,
|
||||
) -> Self {
|
||||
let preds = f(def_id).instantiate_own(self.tcx, self.args);
|
||||
self.preds.extend(preds);
|
||||
let preds = f(def_id);
|
||||
let args = self.args.as_slice();
|
||||
|
||||
for pred in preds.predicates {
|
||||
let new_pred = pred.0.fold_with(&mut self.folder);
|
||||
self.preds.push((EarlyBinder::bind(new_pred).instantiate(self.tcx, args), pred.1));
|
||||
}
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
@@ -208,10 +468,16 @@ fn with_preds(
|
||||
if let Some(parent_def_id) = preds.parent {
|
||||
self = self.with_own_preds(f, parent_def_id);
|
||||
}
|
||||
|
||||
self.with_own_preds(f, def_id)
|
||||
}
|
||||
}
|
||||
let collector = PredicatesCollector::new(tcx, args);
|
||||
|
||||
let (parent_args, child_args) = get_delegation_user_specified_args(tcx, def_id);
|
||||
let (folder, args) = create_folder_and_args(tcx, def_id, sig_id, parent_args, child_args);
|
||||
let collector = PredicatesCollector { tcx, preds: vec![], args, folder };
|
||||
|
||||
let (parent, inh_kind) = get_parent_and_inheritance_kind(tcx, def_id, sig_id);
|
||||
|
||||
// `explicit_predicates_of` is used here to avoid copying `Self: Trait` predicate.
|
||||
// Note: `predicates_of` query can also add inferred outlives predicates, but that
|
||||
@@ -232,157 +498,17 @@ fn with_preds(
|
||||
ty::GenericPredicates { parent, predicates: tcx.arena.alloc_from_iter(preds) }
|
||||
}
|
||||
|
||||
fn build_generic_args<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
sig_id: DefId,
|
||||
def_id: LocalDefId,
|
||||
args: ty::GenericArgsRef<'tcx>,
|
||||
) -> ty::GenericArgsRef<'tcx> {
|
||||
let caller_generics = tcx.generics_of(def_id);
|
||||
let callee_generics = tcx.generics_of(sig_id);
|
||||
|
||||
let mut remap_table = FxHashMap::default();
|
||||
for caller_param in &caller_generics.own_params {
|
||||
let callee_index = callee_generics.param_def_id_to_index(tcx, caller_param.def_id).unwrap();
|
||||
remap_table.insert(callee_index, caller_param.index);
|
||||
}
|
||||
|
||||
let mut folder = ParamIndexRemapper { tcx, remap_table };
|
||||
args.fold_with(&mut folder)
|
||||
}
|
||||
|
||||
fn create_generic_args<'tcx>(
|
||||
fn create_folder_and_args<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def_id: LocalDefId,
|
||||
sig_id: DefId,
|
||||
) -> ty::GenericArgsRef<'tcx> {
|
||||
let caller_kind = fn_kind(tcx, def_id.into());
|
||||
let callee_kind = fn_kind(tcx, sig_id);
|
||||
match (caller_kind, callee_kind) {
|
||||
(FnKind::Free, FnKind::Free)
|
||||
| (FnKind::Free, FnKind::AssocTrait)
|
||||
| (FnKind::AssocInherentImpl, FnKind::Free)
|
||||
| (FnKind::AssocTrait, FnKind::Free)
|
||||
| (FnKind::AssocTrait, FnKind::AssocTrait) => {
|
||||
let args = ty::GenericArgs::identity_for_item(tcx, sig_id);
|
||||
build_generic_args(tcx, sig_id, def_id, args)
|
||||
}
|
||||
parent_args: &'tcx [ty::GenericArg<'tcx>],
|
||||
child_args: &'tcx [ty::GenericArg<'tcx>],
|
||||
) -> (ParamIndexRemapper<'tcx>, Vec<ty::GenericArg<'tcx>>) {
|
||||
let args = create_generic_args(tcx, sig_id, def_id, parent_args, child_args);
|
||||
let remap_table = create_mapping(tcx, sig_id, def_id, &args);
|
||||
|
||||
(FnKind::AssocTraitImpl, FnKind::AssocTrait) => {
|
||||
let callee_generics = tcx.generics_of(sig_id);
|
||||
let parent = tcx.parent(def_id.into());
|
||||
let parent_args = tcx.impl_trait_header(parent).trait_ref.instantiate_identity().args;
|
||||
|
||||
let trait_args = ty::GenericArgs::identity_for_item(tcx, sig_id);
|
||||
let method_args = tcx.mk_args(&trait_args[callee_generics.parent_count..]);
|
||||
let method_args = build_generic_args(tcx, sig_id, def_id, method_args);
|
||||
|
||||
tcx.mk_args_from_iter(parent_args.iter().chain(method_args))
|
||||
}
|
||||
|
||||
(FnKind::AssocInherentImpl, FnKind::AssocTrait) => {
|
||||
let parent = tcx.parent(def_id.into());
|
||||
let self_ty = tcx.type_of(parent).instantiate_identity();
|
||||
let generic_self_ty = ty::GenericArg::from(self_ty);
|
||||
|
||||
let trait_args = ty::GenericArgs::identity_for_item(tcx, sig_id);
|
||||
let trait_args = build_generic_args(tcx, sig_id, def_id, trait_args);
|
||||
|
||||
let args = std::iter::once(generic_self_ty).chain(trait_args.iter().skip(1));
|
||||
tcx.mk_args_from_iter(args)
|
||||
}
|
||||
|
||||
// For trait impl's `sig_id` is always equal to the corresponding trait method.
|
||||
// For inherent methods delegation is not yet supported.
|
||||
(FnKind::AssocTraitImpl, _)
|
||||
| (_, FnKind::AssocTraitImpl)
|
||||
| (_, FnKind::AssocInherentImpl) => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME(fn_delegation): Move generics inheritance to the AST->HIR lowering.
|
||||
// For now, generic parameters are not propagated to the generated call,
|
||||
// which leads to inference errors:
|
||||
//
|
||||
// fn foo<T>(x: i32) {}
|
||||
//
|
||||
// reuse foo as bar;
|
||||
// desugaring:
|
||||
// fn bar<T>() {
|
||||
// foo::<_>() // ERROR: type annotations needed
|
||||
// }
|
||||
pub(crate) fn inherit_generics_for_delegation_item<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def_id: LocalDefId,
|
||||
sig_id: DefId,
|
||||
) -> ty::Generics {
|
||||
let caller_kind = fn_kind(tcx, def_id.into());
|
||||
let callee_kind = fn_kind(tcx, sig_id);
|
||||
match (caller_kind, callee_kind) {
|
||||
(FnKind::Free, FnKind::Free) | (FnKind::Free, FnKind::AssocTrait) => {
|
||||
build_generics(tcx, sig_id, None, InheritanceKind::WithParent(true))
|
||||
}
|
||||
|
||||
(FnKind::AssocTraitImpl, FnKind::AssocTrait) => {
|
||||
build_generics(tcx, sig_id, Some(tcx.parent(def_id.into())), InheritanceKind::Own)
|
||||
}
|
||||
|
||||
(FnKind::AssocInherentImpl, FnKind::AssocTrait)
|
||||
| (FnKind::AssocTrait, FnKind::AssocTrait)
|
||||
| (FnKind::AssocInherentImpl, FnKind::Free)
|
||||
| (FnKind::AssocTrait, FnKind::Free) => build_generics(
|
||||
tcx,
|
||||
sig_id,
|
||||
Some(tcx.parent(def_id.into())),
|
||||
InheritanceKind::WithParent(false),
|
||||
),
|
||||
|
||||
// For trait impl's `sig_id` is always equal to the corresponding trait method.
|
||||
// For inherent methods delegation is not yet supported.
|
||||
(FnKind::AssocTraitImpl, _)
|
||||
| (_, FnKind::AssocTraitImpl)
|
||||
| (_, FnKind::AssocInherentImpl) => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn inherit_predicates_for_delegation_item<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def_id: LocalDefId,
|
||||
sig_id: DefId,
|
||||
) -> ty::GenericPredicates<'tcx> {
|
||||
let args = create_generic_args(tcx, def_id, sig_id);
|
||||
let caller_kind = fn_kind(tcx, def_id.into());
|
||||
let callee_kind = fn_kind(tcx, sig_id);
|
||||
match (caller_kind, callee_kind) {
|
||||
(FnKind::Free, FnKind::Free) | (FnKind::Free, FnKind::AssocTrait) => {
|
||||
build_predicates(tcx, sig_id, None, InheritanceKind::WithParent(true), args)
|
||||
}
|
||||
|
||||
(FnKind::AssocTraitImpl, FnKind::AssocTrait) => build_predicates(
|
||||
tcx,
|
||||
sig_id,
|
||||
Some(tcx.parent(def_id.into())),
|
||||
InheritanceKind::Own,
|
||||
args,
|
||||
),
|
||||
|
||||
(FnKind::AssocInherentImpl, FnKind::AssocTrait)
|
||||
| (FnKind::AssocTrait, FnKind::AssocTrait)
|
||||
| (FnKind::AssocInherentImpl, FnKind::Free)
|
||||
| (FnKind::AssocTrait, FnKind::Free) => build_predicates(
|
||||
tcx,
|
||||
sig_id,
|
||||
Some(tcx.parent(def_id.into())),
|
||||
InheritanceKind::WithParent(false),
|
||||
args,
|
||||
),
|
||||
|
||||
// For trait impl's `sig_id` is always equal to the corresponding trait method.
|
||||
// For inherent methods delegation is not yet supported.
|
||||
(FnKind::AssocTraitImpl, _)
|
||||
| (_, FnKind::AssocTraitImpl)
|
||||
| (_, FnKind::AssocInherentImpl) => unreachable!(),
|
||||
}
|
||||
(ParamIndexRemapper { tcx, remap_table }, args)
|
||||
}
|
||||
|
||||
fn check_constraints<'tcx>(
|
||||
@@ -412,18 +538,91 @@ pub(crate) fn inherit_sig_for_delegation_item<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def_id: LocalDefId,
|
||||
) -> &'tcx [Ty<'tcx>] {
|
||||
let sig_id = tcx.hir_opt_delegation_sig_id(def_id).unwrap();
|
||||
let sig_id = tcx.hir_opt_delegation_sig_id(def_id).expect("Delegation must have sig_id");
|
||||
let caller_sig = tcx.fn_sig(sig_id);
|
||||
|
||||
if let Err(err) = check_constraints(tcx, def_id, sig_id) {
|
||||
let sig_len = caller_sig.instantiate_identity().skip_binder().inputs().len() + 1;
|
||||
let err_type = Ty::new_error(tcx, err);
|
||||
return tcx.arena.alloc_from_iter((0..sig_len).map(|_| err_type));
|
||||
}
|
||||
let args = create_generic_args(tcx, def_id, sig_id);
|
||||
|
||||
// Bound vars are also inherited from `sig_id`.
|
||||
// They will be rebound later in `lower_fn_ty`.
|
||||
let sig = caller_sig.instantiate(tcx, args).skip_binder();
|
||||
let (parent_args, child_args) = get_delegation_user_specified_args(tcx, def_id);
|
||||
let (mut folder, args) = create_folder_and_args(tcx, def_id, sig_id, parent_args, child_args);
|
||||
let caller_sig = EarlyBinder::bind(caller_sig.skip_binder().fold_with(&mut folder));
|
||||
|
||||
let sig = caller_sig.instantiate(tcx, args.as_slice()).skip_binder();
|
||||
let sig_iter = sig.inputs().iter().cloned().chain(std::iter::once(sig.output()));
|
||||
tcx.arena.alloc_from_iter(sig_iter)
|
||||
}
|
||||
|
||||
// Creates user-specified generic arguments from delegation path,
|
||||
// they will be used during delegation signature and predicates inheritance.
|
||||
// Example: reuse Trait::<'static, i32, 1>::foo::<A, B>
|
||||
// we want to extract [Self, 'static, i32, 1] for parent and [A, B] for child.
|
||||
fn get_delegation_user_specified_args<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
delegation_id: LocalDefId,
|
||||
) -> (&'tcx [ty::GenericArg<'tcx>], &'tcx [ty::GenericArg<'tcx>]) {
|
||||
let info = tcx
|
||||
.hir_node(tcx.local_def_id_to_hir_id(delegation_id))
|
||||
.fn_sig()
|
||||
.expect("Lowering delegation")
|
||||
.decl
|
||||
.opt_delegation_generics()
|
||||
.expect("Lowering delegation");
|
||||
|
||||
let get_segment = |hir_id: HirId| -> (&'tcx PathSegment<'tcx>, DefId) {
|
||||
let segment = tcx.hir_node(hir_id).expect_path_segment();
|
||||
let def_id = segment.res.def_id();
|
||||
|
||||
(segment, def_id)
|
||||
};
|
||||
|
||||
let ctx = ItemCtxt::new(tcx, delegation_id);
|
||||
let lowerer = ctx.lowerer();
|
||||
|
||||
let parent_args = info.parent_args_segment_id.map(get_segment).map(|(segment, def_id)| {
|
||||
let self_ty = get_delegation_self_ty(tcx, delegation_id);
|
||||
|
||||
lowerer
|
||||
.lower_generic_args_of_path(
|
||||
segment.ident.span,
|
||||
def_id,
|
||||
&[],
|
||||
segment,
|
||||
self_ty,
|
||||
GenericArgPosition::Type,
|
||||
)
|
||||
.0
|
||||
.as_slice()
|
||||
});
|
||||
|
||||
let child_args = info.child_args_segment_id.map(get_segment).map(|(segment, def_id)| {
|
||||
let parent_args = if let Some(parent_args) = parent_args {
|
||||
parent_args
|
||||
} else {
|
||||
let parent = tcx.parent(def_id);
|
||||
if matches!(tcx.def_kind(parent), DefKind::Trait) {
|
||||
ty::GenericArgs::identity_for_item(tcx, parent).as_slice()
|
||||
} else {
|
||||
&[]
|
||||
}
|
||||
};
|
||||
|
||||
let args = lowerer
|
||||
.lower_generic_args_of_path(
|
||||
segment.ident.span,
|
||||
def_id,
|
||||
parent_args,
|
||||
segment,
|
||||
None,
|
||||
GenericArgPosition::Value,
|
||||
)
|
||||
.0;
|
||||
|
||||
&args[parent_args.len()..]
|
||||
});
|
||||
|
||||
(parent_args.unwrap_or_default(), child_args.unwrap_or_default())
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ pub enum IsMethodCall {
|
||||
|
||||
/// Denotes the "position" of a generic argument, indicating if it is a generic type,
|
||||
/// generic function or generic method call.
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
pub(crate) enum GenericArgPosition {
|
||||
Type,
|
||||
Value, // e.g., functions
|
||||
@@ -556,7 +556,14 @@ pub fn lower_generic_args_of_path_segment(
|
||||
def_id: DefId,
|
||||
item_segment: &hir::PathSegment<'tcx>,
|
||||
) -> GenericArgsRef<'tcx> {
|
||||
let (args, _) = self.lower_generic_args_of_path(span, def_id, &[], item_segment, None);
|
||||
let (args, _) = self.lower_generic_args_of_path(
|
||||
span,
|
||||
def_id,
|
||||
&[],
|
||||
item_segment,
|
||||
None,
|
||||
GenericArgPosition::Type,
|
||||
);
|
||||
if let Some(c) = item_segment.args().constraints.first() {
|
||||
prohibit_assoc_item_constraint(self, c, Some((def_id, item_segment, span)));
|
||||
}
|
||||
@@ -598,13 +605,14 @@ pub fn lower_generic_args_of_path_segment(
|
||||
/// type itself: `['a]`. The returned `GenericArgsRef` concatenates these two
|
||||
/// lists: `[Vec<u8>, u8, 'a]`.
|
||||
#[instrument(level = "debug", skip(self, span), ret)]
|
||||
fn lower_generic_args_of_path(
|
||||
pub(crate) fn lower_generic_args_of_path(
|
||||
&self,
|
||||
span: Span,
|
||||
def_id: DefId,
|
||||
parent_args: &[ty::GenericArg<'tcx>],
|
||||
segment: &hir::PathSegment<'tcx>,
|
||||
self_ty: Option<Ty<'tcx>>,
|
||||
pos: GenericArgPosition,
|
||||
) -> (GenericArgsRef<'tcx>, GenericArgCountResult) {
|
||||
// If the type is parameterized by this region, then replace this
|
||||
// region with the current anon region binding (in other words,
|
||||
@@ -627,14 +635,8 @@ fn lower_generic_args_of_path(
|
||||
assert!(self_ty.is_none());
|
||||
}
|
||||
|
||||
let arg_count = check_generic_arg_count(
|
||||
self,
|
||||
def_id,
|
||||
segment,
|
||||
generics,
|
||||
GenericArgPosition::Type,
|
||||
self_ty.is_some(),
|
||||
);
|
||||
let arg_count =
|
||||
check_generic_arg_count(self, def_id, segment, generics, pos, self_ty.is_some());
|
||||
|
||||
// Skip processing if type has no generic parameters.
|
||||
// Traits always have `Self` as a generic parameter, which means they will not return early
|
||||
@@ -797,6 +799,7 @@ fn inferred_kind(
|
||||
infer_args: segment.infer_args,
|
||||
incorrect_args: &arg_count.correct,
|
||||
};
|
||||
|
||||
let args = lower_generic_args(
|
||||
self,
|
||||
def_id,
|
||||
@@ -818,8 +821,14 @@ pub fn lower_generic_args_of_assoc_item(
|
||||
item_segment: &hir::PathSegment<'tcx>,
|
||||
parent_args: GenericArgsRef<'tcx>,
|
||||
) -> GenericArgsRef<'tcx> {
|
||||
let (args, _) =
|
||||
self.lower_generic_args_of_path(span, item_def_id, parent_args, item_segment, None);
|
||||
let (args, _) = self.lower_generic_args_of_path(
|
||||
span,
|
||||
item_def_id,
|
||||
parent_args,
|
||||
item_segment,
|
||||
None,
|
||||
GenericArgPosition::Type,
|
||||
);
|
||||
if let Some(c) = item_segment.args().constraints.first() {
|
||||
prohibit_assoc_item_constraint(self, c, Some((item_def_id, item_segment, span)));
|
||||
}
|
||||
@@ -931,6 +940,7 @@ pub(crate) fn lower_poly_trait_ref(
|
||||
&[],
|
||||
segment,
|
||||
Some(self_ty),
|
||||
GenericArgPosition::Type,
|
||||
);
|
||||
|
||||
let constraints = segment.args().constraints;
|
||||
@@ -1106,8 +1116,14 @@ fn lower_mono_trait_ref(
|
||||
) -> ty::TraitRef<'tcx> {
|
||||
self.report_internal_fn_trait(span, trait_def_id, trait_segment, is_impl);
|
||||
|
||||
let (generic_args, _) =
|
||||
self.lower_generic_args_of_path(span, trait_def_id, &[], trait_segment, Some(self_ty));
|
||||
let (generic_args, _) = self.lower_generic_args_of_path(
|
||||
span,
|
||||
trait_def_id,
|
||||
&[],
|
||||
trait_segment,
|
||||
Some(self_ty),
|
||||
GenericArgPosition::Type,
|
||||
);
|
||||
if let Some(c) = trait_segment.args().constraints.first() {
|
||||
prohibit_assoc_item_constraint(self, c, Some((trait_def_id, trait_segment, span)));
|
||||
}
|
||||
@@ -2892,11 +2908,12 @@ fn require_type_const_attribute(
|
||||
}
|
||||
}
|
||||
|
||||
fn lower_delegation_ty(&self, idx: hir::InferDelegationKind) -> Ty<'tcx> {
|
||||
fn lower_delegation_ty(&self, idx: hir::InferDelegationKind<'tcx>) -> Ty<'tcx> {
|
||||
let delegation_sig = self.tcx().inherit_sig_for_delegation_item(self.item_def_id());
|
||||
|
||||
match idx {
|
||||
hir::InferDelegationKind::Input(idx) => delegation_sig[idx],
|
||||
hir::InferDelegationKind::Output => *delegation_sig.last().unwrap(),
|
||||
hir::InferDelegationKind::Output { .. } => *delegation_sig.last().unwrap(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ mod recursive {
|
||||
|
||||
#[attr = MustUse {reason: "some reason"}]
|
||||
#[attr = Inline(Hint)]
|
||||
fn foo(self: _, arg1: _) -> _ { <X as T>::foo(self + 1, arg1) }
|
||||
fn foo<Self>(self: _, arg1: _) -> _ { <X as T>::foo(self + 1, arg1) }
|
||||
#[attr = MustUse {reason: "some reason"}]
|
||||
#[attr = Inline(Hint)]
|
||||
fn bar(self: _, arg1: _) -> _ { foo(self + 1, arg1) }
|
||||
|
||||
@@ -12,7 +12,7 @@ fn b<C>(e: C) { }
|
||||
|
||||
trait G {
|
||||
#[attr = Inline(Hint)]
|
||||
fn b(arg0: _) -> _ { b({ }) }
|
||||
fn b<C>(arg0: _) -> _ { b::<C>({ }) }
|
||||
}
|
||||
|
||||
mod m {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
pub fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
|
||||
pub trait Trait<'b, T, const N: usize>: Sized {
|
||||
fn foo<'d: 'd, U, const M: bool>(self) {}
|
||||
}
|
||||
|
||||
impl Trait<'static, i32, 1> for u8 {}
|
||||
@@ -11,15 +11,13 @@ pub fn late<'a>(x: &'a u8) -> u8 {
|
||||
pub fn bounds<T: Clone>(_: T) {}
|
||||
}
|
||||
|
||||
// FIXME(fn_delegation): this is supposed to work eventually
|
||||
reuse to_reuse::consts;
|
||||
//~^ ERROR type annotations needed
|
||||
reuse to_reuse::late;
|
||||
reuse to_reuse::bounds;
|
||||
|
||||
fn main() {
|
||||
// FIXME(fn_delegation): proper support for late bound lifetimes.
|
||||
late::<'static>(&0u8);
|
||||
//~^ ERROR cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
|
||||
struct S;
|
||||
bounds(S);
|
||||
|
||||
@@ -1,33 +1,5 @@
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/free-fn-to-free-fn.rs:15:17
|
||||
|
|
||||
LL | reuse to_reuse::consts;
|
||||
| ^^^^^^ cannot infer the value of the const parameter `N` declared on the function `consts`
|
||||
|
|
||||
note: required by a const generic parameter in `to_reuse::consts`
|
||||
--> $DIR/free-fn-to-free-fn.rs:5:19
|
||||
|
|
||||
LL | pub fn consts<const N: i32>() -> i32 {
|
||||
| ^^^^^^^^^^^^ required by this const generic parameter in `consts`
|
||||
help: consider specifying the generic argument
|
||||
|
|
||||
LL | reuse to_reuse::consts::<N>;
|
||||
| +++++
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/free-fn-to-free-fn.rs:21:12
|
||||
|
|
||||
LL | late::<'static>(&0u8);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/free-fn-to-free-fn.rs:8:17
|
||||
|
|
||||
LL | pub fn late<'a>(x: &'a u8) -> u8 {
|
||||
| ^^
|
||||
|
||||
error[E0277]: the trait bound `S: Clone` is not satisfied
|
||||
--> $DIR/free-fn-to-free-fn.rs:25:12
|
||||
--> $DIR/free-fn-to-free-fn.rs:23:12
|
||||
|
|
||||
LL | bounds(S);
|
||||
| ------ ^ the trait `Clone` is not implemented for `S`
|
||||
@@ -48,7 +20,6 @@ LL + #[derive(Clone)]
|
||||
LL | struct S;
|
||||
|
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
Some errors have detailed explanations: E0277, E0284, E0794.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
//@ compile-flags: -Z deduplicate-diagnostics=yes
|
||||
|
||||
#![feature(fn_delegation)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
trait Trait<T> {
|
||||
fn foo<U>(&self, _: U, _: T) {}
|
||||
}
|
||||
|
||||
impl<T> Trait<T> for u8 {}
|
||||
|
||||
reuse Trait::<_>::foo::<i32> as generic_arguments1;
|
||||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for functions
|
||||
reuse <u8 as Trait<_>>::foo as generic_arguments2;
|
||||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for functions
|
||||
//~| ERROR mismatched types
|
||||
reuse <_ as Trait<_>>::foo as generic_arguments3;
|
||||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,40 @@
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/free-fn-to-trait-infer.rs:12:15
|
||||
|
|
||||
LL | reuse Trait::<_>::foo::<i32> as generic_arguments1;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/free-fn-to-trait-infer.rs:14:20
|
||||
|
|
||||
LL | reuse <u8 as Trait<_>>::foo as generic_arguments2;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/free-fn-to-trait-infer.rs:17:19
|
||||
|
|
||||
LL | reuse <_ as Trait<_>>::foo as generic_arguments3;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/free-fn-to-trait-infer.rs:14:25
|
||||
|
|
||||
LL | reuse <u8 as Trait<_>>::foo as generic_arguments2;
|
||||
| ^^^
|
||||
| |
|
||||
| expected `&u8`, found `&Self`
|
||||
| found this type parameter
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
= note: expected reference `&u8`
|
||||
found reference `&Self`
|
||||
note: method defined here
|
||||
--> $DIR/free-fn-to-trait-infer.rs:7:8
|
||||
|
|
||||
LL | fn foo<U>(&self, _: U, _: T) {}
|
||||
| ^^^ -----
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0121, E0308.
|
||||
For more information about an error, try `rustc --explain E0121`.
|
||||
@@ -26,20 +26,6 @@ fn foo<U: Clone>(&self, t: T, u: U) where T: Copy {}
|
||||
impl<T> Trait<T> for u8 {}
|
||||
}
|
||||
|
||||
mod generic_arguments {
|
||||
trait Trait<T> {
|
||||
fn foo<U>(&self, _: U, _: T) {}
|
||||
}
|
||||
|
||||
impl<T> Trait<T> for u8 {}
|
||||
|
||||
reuse Trait::<_>::foo::<i32> as generic_arguments1;
|
||||
//~^ ERROR mismatched types
|
||||
reuse <u8 as Trait<_>>::foo as generic_arguments2;
|
||||
//~^ ERROR mismatched types
|
||||
reuse <_ as Trait<_>>::foo as generic_arguments3; // OK
|
||||
}
|
||||
|
||||
reuse default_param::Trait::foo as default_param;
|
||||
reuse types_and_lifetimes::Trait::foo as types_and_lifetimes;
|
||||
reuse bounds::Trait::foo as bounds;
|
||||
|
||||
@@ -1,45 +1,5 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/free-fn-to-trait-method.rs:36:23
|
||||
|
|
||||
LL | fn foo<U>(&self, _: U, _: T) {}
|
||||
| - found this type parameter
|
||||
...
|
||||
LL | reuse Trait::<_>::foo::<i32> as generic_arguments1;
|
||||
| ^^^
|
||||
| |
|
||||
| expected `i32`, found type parameter `U`
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found type parameter `U`
|
||||
note: method defined here
|
||||
--> $DIR/free-fn-to-trait-method.rs:31:12
|
||||
|
|
||||
LL | fn foo<U>(&self, _: U, _: T) {}
|
||||
| ^^^ ----
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/free-fn-to-trait-method.rs:38:29
|
||||
|
|
||||
LL | trait Trait<T> {
|
||||
| -------------- found this type parameter
|
||||
...
|
||||
LL | reuse <u8 as Trait<_>>::foo as generic_arguments2;
|
||||
| ^^^
|
||||
| |
|
||||
| expected `&u8`, found `&Self`
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
= note: expected reference `&u8`
|
||||
found reference `&Self`
|
||||
note: method defined here
|
||||
--> $DIR/free-fn-to-trait-method.rs:31:12
|
||||
|
|
||||
LL | fn foo<U>(&self, _: U, _: T) {}
|
||||
| ^^^ -----
|
||||
|
||||
error[E0277]: the trait bound `S: Copy` is not satisfied
|
||||
--> $DIR/free-fn-to-trait-method.rs:53:18
|
||||
--> $DIR/free-fn-to-trait-method.rs:39:18
|
||||
|
|
||||
LL | bounds(&0u8, S, U);
|
||||
| ------ ^ the trait `Copy` is not implemented for `S`
|
||||
@@ -61,7 +21,7 @@ LL | struct S;
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `U: Clone` is not satisfied
|
||||
--> $DIR/free-fn-to-trait-method.rs:53:21
|
||||
--> $DIR/free-fn-to-trait-method.rs:39:21
|
||||
|
|
||||
LL | bounds(&0u8, S, U);
|
||||
| ------ ^ the trait `Clone` is not implemented for `U`
|
||||
@@ -82,7 +42,6 @@ LL + #[derive(Clone)]
|
||||
LL | struct U;
|
||||
|
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0308.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
||||
@@ -9,6 +9,5 @@ fn foo<T = usize>(&self) {
|
||||
}
|
||||
|
||||
reuse Trait::foo;
|
||||
//~^ ERROR: type annotations needed
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -8,20 +8,8 @@ LL | fn foo<T = usize>(&self) {
|
||||
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
|
||||
= note: `#[deny(invalid_type_param_default)]` (part of `#[deny(future_incompatible)]`) on by default
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/generic-params-defaults.rs:11:14
|
||||
|
|
||||
LL | reuse Trait::foo;
|
||||
| ^^^ cannot infer type of the type parameter `T` declared on the method `foo`
|
||||
|
|
||||
help: consider specifying the generic argument
|
||||
|
|
||||
LL | reuse Trait::foo::<T>;
|
||||
| +++++
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0282`.
|
||||
Future incompatibility report: Future breakage diagnostic:
|
||||
error: defaults for generic parameters are not allowed here
|
||||
--> $DIR/generic-params-defaults.rs:5:12
|
||||
|
||||
@@ -14,6 +14,5 @@ fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) {
|
||||
}
|
||||
|
||||
reuse Trait::foo;
|
||||
//~^ ERROR: type annotations needed
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -54,23 +54,7 @@ LL | trait Trait<'a, 'b, 'c, A, B, C, const N: usize> {
|
||||
LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) {
|
||||
| ^ already used
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/generic-params-same-names.rs:16:14
|
||||
|
|
||||
LL | reuse Trait::foo;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `Trait::foo`
|
||||
--> $DIR/generic-params-same-names.rs:5:33
|
||||
|
|
||||
LL | fn foo<'a, 'b, 'c, A, B, C, const N: usize>(&self) {
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::foo::<A, B, C, N>;
|
||||
| ++++++++++++++
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0284, E0403, E0496.
|
||||
For more information about an error, try `rustc --explain E0284`.
|
||||
Some errors have detailed explanations: E0403, E0496.
|
||||
For more information about an error, try `rustc --explain E0403`.
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
//@ aux-crate:generics=generics.rs
|
||||
//@ run-pass
|
||||
|
||||
#![feature(fn_delegation)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
reuse generics::foo as bar;
|
||||
reuse generics::Trait::foo as trait_foo;
|
||||
|
||||
reuse generics::foo::<'static, 'static, i32, i32, 1> as bar1;
|
||||
reuse generics::Trait::<'static, i32, 1>::foo::<'static, i32, false> as trait_foo1;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
struct X;
|
||||
|
||||
impl generics::Trait<'static, i32, 1> for X {}
|
||||
|
||||
impl X {
|
||||
reuse generics::foo as bar;
|
||||
reuse generics::Trait::foo as trait_foo;
|
||||
|
||||
reuse generics::foo::<'static, 'static, i32, i32, 1> as bar1;
|
||||
reuse generics::Trait::<'static, i32, 1>::foo::<'static, i32, false> as trait_foo1;
|
||||
}
|
||||
|
||||
trait LocalTrait {
|
||||
fn get() -> u8 { 123 }
|
||||
fn get_self(&self) -> u8 { 123 }
|
||||
|
||||
reuse generics::foo as bar;
|
||||
reuse generics::foo::<'static, 'static, i32, i32, 1> as bar1;
|
||||
|
||||
reuse generics::Trait::foo as trait_foo { Self::get() }
|
||||
reuse generics::Trait::<'static, i32, 1>::foo::<'static, i32, false> as trait_foo1 {
|
||||
Self::get_self(&self)
|
||||
}
|
||||
}
|
||||
|
||||
impl LocalTrait for usize {}
|
||||
|
||||
fn main() {
|
||||
bar::<i32, i32, 1>();
|
||||
bar::<'static, 'static, i32, i32, 1>();
|
||||
trait_foo::<'static, 'static, u8, i32, 1, String, true>(123);
|
||||
|
||||
bar1();
|
||||
trait_foo1::<u8>(123);
|
||||
|
||||
let x = X{};
|
||||
|
||||
X::bar::<i32, i32, 1>();
|
||||
X::bar::<'static, 'static, i32, i32, 1>();
|
||||
X::bar1();
|
||||
x.trait_foo::<'static, 'static, i32, 1, String, true>();
|
||||
x.trait_foo1();
|
||||
|
||||
<usize as LocalTrait>::bar::<i32, i32, 1>();
|
||||
<usize as LocalTrait>::bar::<'static, 'static, i32, i32, 1>();
|
||||
<usize as LocalTrait>::bar1();
|
||||
|
||||
1usize.trait_foo::<'static, 'static, i32, 1, String, true>();
|
||||
1usize.trait_foo1();
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
mod test_1 {
|
||||
fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
reuse foo as bar;
|
||||
//~^ ERROR: type annotations needed
|
||||
|
||||
fn check<A, B, C>() {
|
||||
bar::<1, 2, 3, 4, 5, 6>();
|
||||
@@ -44,7 +43,7 @@ mod test_2 {
|
||||
fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
|
||||
reuse foo::<> as bar1;
|
||||
//~^ ERROR: type annotations needed
|
||||
//~^ ERROR: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
reuse foo::<String, String> as bar2;
|
||||
//~^ ERROR: function takes 3 generic arguments but 2 generic arguments were supplied
|
||||
@@ -85,18 +84,23 @@ fn foo<'d: 'd, U, const M: bool>(self) {}
|
||||
//~| ERROR: cannot find type `asd` in this scope
|
||||
//~| ERROR: cannot find type `asd` in this scope
|
||||
//~| ERROR: cannot find type `asdasa` in this scope
|
||||
//~| ERROR: trait takes 3 lifetime arguments but 0 lifetime arguments were supplied
|
||||
//~| ERROR: trait takes 2 generic arguments but 6 generic arguments were supplied
|
||||
|
||||
reuse Trait::<'static, 'static>::foo as bar2;
|
||||
//~^ ERROR: trait takes 3 lifetime arguments but 2 lifetime arguments were supplied
|
||||
//~| ERROR: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
reuse Trait::<1, 2, 3, 4, 5>::foo as bar3;
|
||||
//~^ ERROR: trait takes 2 generic arguments but 5 generic arguments were supplied
|
||||
//~^ ERROR: trait takes 3 lifetime arguments but 0 lifetime arguments were supplied
|
||||
//~| ERROR: trait takes 2 generic arguments but 5 generic arguments were supplied
|
||||
|
||||
reuse Trait::<1, 2, true>::foo as bar4;
|
||||
//~^ ERROR: trait takes 2 generic arguments but 3 generic arguments were supplied
|
||||
//~^ ERROR: trait takes 3 lifetime arguments but 0 lifetime arguments were supplied
|
||||
//~| ERROR: trait takes 2 generic arguments but 3 generic arguments were supplied
|
||||
|
||||
reuse Trait::<'static>::foo as bar5;
|
||||
//~^ ERROR: trait takes 3 lifetime arguments but 1 lifetime argument was supplied
|
||||
//~| ERROR: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
|
||||
reuse Trait::<1, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6;
|
||||
//~^ ERROR: cannot find type `DDDD` in this scope [E0425]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
error[E0401]: can't use generic parameters from outer item
|
||||
--> $DIR/generics-gen-args-errors.rs:35:21
|
||||
--> $DIR/generics-gen-args-errors.rs:34:21
|
||||
|
|
||||
LL | fn check<A, B, C>() {
|
||||
| - type parameter from outer item
|
||||
@@ -12,7 +12,7 @@ LL | reuse foo::<A, B, C> as xd;
|
||||
= note: nested items are independent from their parent item for everything except for privacy and name resolution
|
||||
|
||||
error[E0401]: can't use generic parameters from outer item
|
||||
--> $DIR/generics-gen-args-errors.rs:35:24
|
||||
--> $DIR/generics-gen-args-errors.rs:34:24
|
||||
|
|
||||
LL | fn check<A, B, C>() {
|
||||
| - type parameter from outer item
|
||||
@@ -25,7 +25,7 @@ LL | reuse foo::<A, B, C> as xd;
|
||||
= note: nested items are independent from their parent item for everything except for privacy and name resolution
|
||||
|
||||
error[E0401]: can't use generic parameters from outer item
|
||||
--> $DIR/generics-gen-args-errors.rs:35:27
|
||||
--> $DIR/generics-gen-args-errors.rs:34:27
|
||||
|
|
||||
LL | fn check<A, B, C>() {
|
||||
| - type parameter from outer item
|
||||
@@ -38,7 +38,7 @@ LL | reuse foo::<A, B, C> as xd;
|
||||
= note: nested items are independent from their parent item for everything except for privacy and name resolution
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'asdasd`
|
||||
--> $DIR/generics-gen-args-errors.rs:52:29
|
||||
--> $DIR/generics-gen-args-errors.rs:51:29
|
||||
|
|
||||
LL | reuse foo::<'static, _, 'asdasd, 'static, 'static, 'static, _> as bar3;
|
||||
| ^^^^^^^ undeclared lifetime
|
||||
@@ -49,7 +49,7 @@ LL | reuse foo'asdasd, ::<'static, _, 'asdasd, 'static, 'static, 'static, _>
|
||||
| ++++++++
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/generics-gen-args-errors.rs:67:50
|
||||
--> $DIR/generics-gen-args-errors.rs:66:50
|
||||
|
|
||||
LL | reuse foo::<"asdasd", asd, "askdn", 'static, 'a> as bar7;
|
||||
| ^^ undeclared lifetime
|
||||
@@ -60,7 +60,7 @@ LL | reuse foo'a, ::<"asdasd", asd, "askdn", 'static, 'a> as bar7;
|
||||
| +++
|
||||
|
||||
error[E0106]: missing lifetime specifiers
|
||||
--> $DIR/generics-gen-args-errors.rs:107:19
|
||||
--> $DIR/generics-gen-args-errors.rs:111:19
|
||||
|
|
||||
LL | reuse Trait::<Trait, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7;
|
||||
| ^^^^^ expected 3 lifetime parameters
|
||||
@@ -71,7 +71,7 @@ LL | reuse Trait::<Trait<'a, 'a, 'a>, Clone, _, 'static, dyn Send, _>::foo'a
|
||||
| ++++++++++++ +++
|
||||
|
||||
error[E0423]: expected value, found struct `String`
|
||||
--> $DIR/generics-gen-args-errors.rs:15:33
|
||||
--> $DIR/generics-gen-args-errors.rs:14:33
|
||||
|
|
||||
LL | bar::<String, String, { String }>();
|
||||
| ^^^^^^
|
||||
@@ -81,7 +81,7 @@ LL | bar::<String, String, { String }>();
|
||||
= note: `String` defined here
|
||||
|
||||
error[E0425]: cannot find type `asd` in this scope
|
||||
--> $DIR/generics-gen-args-errors.rs:29:15
|
||||
--> $DIR/generics-gen-args-errors.rs:28:15
|
||||
|
|
||||
LL | bar::<asd, asd, asd>();
|
||||
| ^^^ not found in this scope
|
||||
@@ -92,7 +92,7 @@ LL | fn check<A, B, C, asd>() {
|
||||
| +++++
|
||||
|
||||
error[E0425]: cannot find type `asd` in this scope
|
||||
--> $DIR/generics-gen-args-errors.rs:29:20
|
||||
--> $DIR/generics-gen-args-errors.rs:28:20
|
||||
|
|
||||
LL | bar::<asd, asd, asd>();
|
||||
| ^^^ not found in this scope
|
||||
@@ -103,7 +103,7 @@ LL | fn check<A, B, C, asd>() {
|
||||
| +++++
|
||||
|
||||
error[E0425]: cannot find type `asd` in this scope
|
||||
--> $DIR/generics-gen-args-errors.rs:29:25
|
||||
--> $DIR/generics-gen-args-errors.rs:28:25
|
||||
|
|
||||
LL | bar::<asd, asd, asd>();
|
||||
| ^^^ not found in this scope
|
||||
@@ -114,83 +114,420 @@ LL | fn check<A, B, C, asd>() {
|
||||
| +++++
|
||||
|
||||
error[E0425]: cannot find type `asdasd` in this scope
|
||||
--> $DIR/generics-gen-args-errors.rs:56:39
|
||||
--> $DIR/generics-gen-args-errors.rs:55:39
|
||||
|
|
||||
LL | reuse foo::<String, 'static, 123, asdasd> as bar4;
|
||||
| ^^^^^^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find type `asd` in this scope
|
||||
--> $DIR/generics-gen-args-errors.rs:63:22
|
||||
--> $DIR/generics-gen-args-errors.rs:62:22
|
||||
|
|
||||
LL | reuse foo::<1, 2,asd,String, { let x = 0; }> as bar6;
|
||||
| ^^^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find type `asd` in this scope
|
||||
--> $DIR/generics-gen-args-errors.rs:67:27
|
||||
--> $DIR/generics-gen-args-errors.rs:66:27
|
||||
|
|
||||
LL | reuse foo::<"asdasd", asd, "askdn", 'static, 'a> as bar7;
|
||||
| ^^^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find type `asd` in this scope
|
||||
--> $DIR/generics-gen-args-errors.rs:81:19
|
||||
--> $DIR/generics-gen-args-errors.rs:80:19
|
||||
|
|
||||
LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1;
|
||||
| ^^^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find type `asd` in this scope
|
||||
--> $DIR/generics-gen-args-errors.rs:81:24
|
||||
--> $DIR/generics-gen-args-errors.rs:80:24
|
||||
|
|
||||
LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1;
|
||||
| ^^^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find type `asd` in this scope
|
||||
--> $DIR/generics-gen-args-errors.rs:81:29
|
||||
--> $DIR/generics-gen-args-errors.rs:80:29
|
||||
|
|
||||
LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1;
|
||||
| ^^^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find type `asd` in this scope
|
||||
--> $DIR/generics-gen-args-errors.rs:81:34
|
||||
--> $DIR/generics-gen-args-errors.rs:80:34
|
||||
|
|
||||
LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1;
|
||||
| ^^^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find type `asd` in this scope
|
||||
--> $DIR/generics-gen-args-errors.rs:81:39
|
||||
--> $DIR/generics-gen-args-errors.rs:80:39
|
||||
|
|
||||
LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1;
|
||||
| ^^^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find type `asdasa` in this scope
|
||||
--> $DIR/generics-gen-args-errors.rs:81:44
|
||||
--> $DIR/generics-gen-args-errors.rs:80:44
|
||||
|
|
||||
LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1;
|
||||
| ^^^^^^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find type `DDDD` in this scope
|
||||
--> $DIR/generics-gen-args-errors.rs:101:34
|
||||
--> $DIR/generics-gen-args-errors.rs:105:34
|
||||
|
|
||||
LL | reuse Trait::<1, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6;
|
||||
| ^^^^ not found in this scope
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/generics-gen-args-errors.rs:8:11
|
||||
error[E0747]: unresolved item provided when a constant was expected
|
||||
--> $DIR/generics-gen-args-errors.rs:34:27
|
||||
|
|
||||
LL | reuse foo as bar;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
LL | reuse foo::<A, B, C> as xd;
|
||||
| ^
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::foo`
|
||||
--> $DIR/generics-gen-args-errors.rs:7:48
|
||||
help: if this generic argument was intended as a const parameter, surround it with braces
|
||||
|
|
||||
LL | reuse foo::<A, B, { C }> as xd;
|
||||
| + +
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/generics-gen-args-errors.rs:45:11
|
||||
|
|
||||
LL | reuse foo::<> as bar1;
|
||||
| ^^^ not allowed in type signatures
|
||||
|
||||
error[E0107]: function takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:48:11
|
||||
|
|
||||
LL | reuse foo::<String, String> as bar2;
|
||||
| ^^^ ------ ------ supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: function defined here, with 3 generic parameters: `T`, `U`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:43:8
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
| ^^^ - - --------------
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | reuse foo::<T, U, N> as bar;
|
||||
| +++++++++++
|
||||
LL | reuse foo::<String, String, N> as bar2;
|
||||
| +++
|
||||
|
||||
error[E0107]: function takes 2 lifetime arguments but 5 lifetime arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:51:11
|
||||
|
|
||||
LL | reuse foo::<'static, _, 'asdasd, 'static, 'static, 'static, _> as bar3;
|
||||
| ^^^ --------------------------- help: remove the lifetime arguments
|
||||
| |
|
||||
| expected 2 lifetime arguments
|
||||
|
|
||||
note: function defined here, with 2 lifetime parameters: `'a`, `'b`
|
||||
--> $DIR/generics-gen-args-errors.rs:43:8
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^ -- --
|
||||
|
||||
error[E0107]: function takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:51:11
|
||||
|
|
||||
LL | reuse foo::<'static, _, 'asdasd, 'static, 'static, 'static, _> as bar3;
|
||||
| ^^^ expected 3 generic arguments ------- - supplied 2 generic arguments
|
||||
|
|
||||
note: function defined here, with 3 generic parameters: `T`, `U`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:43:8
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^ - - --------------
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | reuse foo::<'static, _, 'asdasd, 'static, 'static, 'static, _, N> as bar3;
|
||||
| +++
|
||||
|
||||
error[E0107]: function takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:55:11
|
||||
|
|
||||
LL | reuse foo::<String, 'static, 123, asdasd> as bar4;
|
||||
| ^^^ ------ supplied 1 lifetime argument
|
||||
| |
|
||||
| expected 2 lifetime arguments
|
||||
|
|
||||
note: function defined here, with 2 lifetime parameters: `'a`, `'b`
|
||||
--> $DIR/generics-gen-args-errors.rs:43:8
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^ -- --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | reuse foo::<String, 'static, 'static, 123, asdasd> as bar4;
|
||||
| +++++++++
|
||||
|
||||
error[E0107]: function takes 3 generic arguments but 6 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:12:9
|
||||
--> $DIR/generics-gen-args-errors.rs:59:11
|
||||
|
|
||||
LL | reuse foo::<1, 2, _, 4, 5, _> as bar5;
|
||||
| ^^^ --------- help: remove the unnecessary generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: function defined here, with 3 generic parameters: `T`, `U`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:43:8
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^ - - --------------
|
||||
|
||||
error[E0107]: function takes 3 generic arguments but 5 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:62:11
|
||||
|
|
||||
LL | reuse foo::<1, 2,asd,String, { let x = 0; }> as bar6;
|
||||
| ^^^ ----------------------- help: remove the unnecessary generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: function defined here, with 3 generic parameters: `T`, `U`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:43:8
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^ - - --------------
|
||||
|
||||
error[E0747]: constant provided when a type was expected
|
||||
--> $DIR/generics-gen-args-errors.rs:66:17
|
||||
|
|
||||
LL | reuse foo::<"asdasd", asd, "askdn", 'static, 'a> as bar7;
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0747]: constant provided when a type was expected
|
||||
--> $DIR/generics-gen-args-errors.rs:71:17
|
||||
|
|
||||
LL | reuse foo::<{}, {}, {}> as bar8;
|
||||
| ^^
|
||||
|
||||
error[E0107]: trait takes 3 lifetime arguments but 0 lifetime arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:80:11
|
||||
|
|
||||
LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1;
|
||||
| ^^^^^ expected 3 lifetime arguments
|
||||
|
|
||||
note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a`
|
||||
--> $DIR/generics-gen-args-errors.rs:76:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ -- -- --
|
||||
help: add missing lifetime arguments
|
||||
|
|
||||
LL | reuse Trait::<'b, 'c, 'a, asd, asd, asd, asd, asd, asdasa>::foo as bar1;
|
||||
| +++++++++++
|
||||
|
||||
error[E0107]: trait takes 2 generic arguments but 6 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:80:11
|
||||
|
|
||||
LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1;
|
||||
| ^^^^^ ----------------------- help: remove the unnecessary generic arguments
|
||||
| |
|
||||
| expected 2 generic arguments
|
||||
|
|
||||
note: trait defined here, with 2 generic parameters: `T`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:76:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ - --------------
|
||||
|
||||
error[E0107]: trait takes 3 lifetime arguments but 2 lifetime arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:90:11
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static>::foo as bar2;
|
||||
| ^^^^^ ------- ------- supplied 2 lifetime arguments
|
||||
| |
|
||||
| expected 3 lifetime arguments
|
||||
|
|
||||
note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a`
|
||||
--> $DIR/generics-gen-args-errors.rs:76:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ -- -- --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo as bar2;
|
||||
| +++++++++
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/generics-gen-args-errors.rs:90:11
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static>::foo as bar2;
|
||||
| ^^^^^ not allowed in type signatures
|
||||
|
||||
error[E0107]: trait takes 3 lifetime arguments but 0 lifetime arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:93:11
|
||||
|
|
||||
LL | reuse Trait::<1, 2, 3, 4, 5>::foo as bar3;
|
||||
| ^^^^^ expected 3 lifetime arguments
|
||||
|
|
||||
note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a`
|
||||
--> $DIR/generics-gen-args-errors.rs:76:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ -- -- --
|
||||
help: add missing lifetime arguments
|
||||
|
|
||||
LL | reuse Trait::<'b, 'c, 'a, 1, 2, 3, 4, 5>::foo as bar3;
|
||||
| +++++++++++
|
||||
|
||||
error[E0107]: trait takes 2 generic arguments but 5 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:93:11
|
||||
|
|
||||
LL | reuse Trait::<1, 2, 3, 4, 5>::foo as bar3;
|
||||
| ^^^^^ --------- help: remove the unnecessary generic arguments
|
||||
| |
|
||||
| expected 2 generic arguments
|
||||
|
|
||||
note: trait defined here, with 2 generic parameters: `T`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:76:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ - --------------
|
||||
|
||||
error[E0107]: trait takes 3 lifetime arguments but 0 lifetime arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:97:11
|
||||
|
|
||||
LL | reuse Trait::<1, 2, true>::foo as bar4;
|
||||
| ^^^^^ expected 3 lifetime arguments
|
||||
|
|
||||
note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a`
|
||||
--> $DIR/generics-gen-args-errors.rs:76:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ -- -- --
|
||||
help: add missing lifetime arguments
|
||||
|
|
||||
LL | reuse Trait::<'b, 'c, 'a, 1, 2, true>::foo as bar4;
|
||||
| +++++++++++
|
||||
|
||||
error[E0107]: trait takes 2 generic arguments but 3 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:97:11
|
||||
|
|
||||
LL | reuse Trait::<1, 2, true>::foo as bar4;
|
||||
| ^^^^^ ------ help: remove the unnecessary generic argument
|
||||
| |
|
||||
| expected 2 generic arguments
|
||||
|
|
||||
note: trait defined here, with 2 generic parameters: `T`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:76:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ - --------------
|
||||
|
||||
error[E0107]: trait takes 3 lifetime arguments but 1 lifetime argument was supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:101:11
|
||||
|
|
||||
LL | reuse Trait::<'static>::foo as bar5;
|
||||
| ^^^^^ ------- supplied 1 lifetime argument
|
||||
| |
|
||||
| expected 3 lifetime arguments
|
||||
|
|
||||
note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a`
|
||||
--> $DIR/generics-gen-args-errors.rs:76:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ -- -- --
|
||||
help: add missing lifetime arguments
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo as bar5;
|
||||
| ++++++++++++++++++
|
||||
|
||||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
|
||||
--> $DIR/generics-gen-args-errors.rs:101:11
|
||||
|
|
||||
LL | reuse Trait::<'static>::foo as bar5;
|
||||
| ^^^^^ not allowed in type signatures
|
||||
|
||||
error[E0107]: trait takes 3 lifetime arguments but 1 lifetime argument was supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:105:11
|
||||
|
|
||||
LL | reuse Trait::<1, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6;
|
||||
| ^^^^^ - supplied 1 lifetime argument
|
||||
| |
|
||||
| expected 3 lifetime arguments
|
||||
|
|
||||
note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a`
|
||||
--> $DIR/generics-gen-args-errors.rs:76:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ -- -- --
|
||||
help: add missing lifetime arguments
|
||||
|
|
||||
LL | reuse Trait::<1, 'static, 'static, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6;
|
||||
| ++++++++++++++++++
|
||||
|
||||
error[E0107]: trait takes 2 generic arguments but 3 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:105:11
|
||||
|
|
||||
LL | reuse Trait::<1, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6;
|
||||
| ^^^^^ --------------- help: remove the unnecessary generic argument
|
||||
| |
|
||||
| expected 2 generic arguments
|
||||
|
|
||||
note: trait defined here, with 2 generic parameters: `T`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:76:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ - --------------
|
||||
|
||||
error[E0107]: method takes 2 generic arguments but 6 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:105:41
|
||||
|
|
||||
LL | reuse Trait::<1, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6;
|
||||
| ^^^ ------------ help: remove the unnecessary generic arguments
|
||||
| |
|
||||
| expected 2 generic arguments
|
||||
|
|
||||
note: method defined here, with 2 generic parameters: `U`, `M`
|
||||
--> $DIR/generics-gen-args-errors.rs:77:12
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(self) {}
|
||||
| ^^^ - -------------
|
||||
|
||||
error[E0107]: trait takes 3 lifetime arguments but 1 lifetime argument was supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:111:11
|
||||
|
|
||||
LL | reuse Trait::<Trait, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7;
|
||||
| ^^^^^ ----- supplied 1 lifetime argument
|
||||
| |
|
||||
| expected 3 lifetime arguments
|
||||
|
|
||||
note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a`
|
||||
--> $DIR/generics-gen-args-errors.rs:76:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ -- -- --
|
||||
help: add missing lifetime arguments
|
||||
|
|
||||
LL | reuse Trait::<Trait, 'static, 'static, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7;
|
||||
| ++++++++++++++++++
|
||||
|
||||
error[E0107]: trait takes 2 generic arguments but 5 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:111:11
|
||||
|
|
||||
LL | reuse Trait::<Trait, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7;
|
||||
| ^^^^^ --- help: remove the unnecessary generic argument
|
||||
| |
|
||||
| expected 2 generic arguments
|
||||
|
|
||||
note: trait defined here, with 2 generic parameters: `T`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:76:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ - --------------
|
||||
|
||||
error[E0107]: method takes 2 generic arguments but 5 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:111:59
|
||||
|
|
||||
LL | reuse Trait::<Trait, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7;
|
||||
| ^^^ --------- help: remove the unnecessary generic arguments
|
||||
| |
|
||||
| expected 2 generic arguments
|
||||
|
|
||||
note: method defined here, with 2 generic parameters: `U`, `M`
|
||||
--> $DIR/generics-gen-args-errors.rs:77:12
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(self) {}
|
||||
| ^^^ - -------------
|
||||
|
||||
error[E0107]: function takes 3 generic arguments but 6 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:11:9
|
||||
|
|
||||
LL | bar::<1, 2, 3, 4, 5, 6>();
|
||||
| ^^^ --------- help: remove the unnecessary generic arguments
|
||||
@@ -206,7 +543,7 @@ LL | reuse foo as bar;
|
||||
| ^^^
|
||||
|
||||
error[E0107]: function takes 2 lifetime arguments but 5 lifetime arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:18:9
|
||||
--> $DIR/generics-gen-args-errors.rs:17:9
|
||||
|
|
||||
LL | bar::<'static, 'static, 'static, 'static, 'static>();
|
||||
| ^^^ --------------------------- help: remove the lifetime arguments
|
||||
@@ -222,13 +559,13 @@ LL | reuse foo as bar;
|
||||
| ^^^
|
||||
|
||||
error[E0747]: constant provided when a type was expected
|
||||
--> $DIR/generics-gen-args-errors.rs:21:23
|
||||
--> $DIR/generics-gen-args-errors.rs:20:23
|
||||
|
|
||||
LL | bar::<String, 1, 'static, i32, 'static>();
|
||||
| ^
|
||||
|
||||
error[E0107]: function takes 3 generic arguments but 5 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:26:9
|
||||
--> $DIR/generics-gen-args-errors.rs:25:9
|
||||
|
|
||||
LL | bar::<_, _, _, _, _>();
|
||||
| ^^^ ------ help: remove the unnecessary generic arguments
|
||||
@@ -244,7 +581,7 @@ LL | reuse foo as bar;
|
||||
| ^^^
|
||||
|
||||
error[E0747]: unresolved item provided when a constant was expected
|
||||
--> $DIR/generics-gen-args-errors.rs:29:25
|
||||
--> $DIR/generics-gen-args-errors.rs:28:25
|
||||
|
|
||||
LL | bar::<asd, asd, asd>();
|
||||
| ^^^
|
||||
@@ -254,310 +591,7 @@ help: if this generic argument was intended as a const parameter, surround it wi
|
||||
LL | bar::<asd, asd, { asd }>();
|
||||
| + +
|
||||
|
||||
error[E0747]: unresolved item provided when a constant was expected
|
||||
--> $DIR/generics-gen-args-errors.rs:35:27
|
||||
|
|
||||
LL | reuse foo::<A, B, C> as xd;
|
||||
| ^
|
||||
|
|
||||
help: if this generic argument was intended as a const parameter, surround it with braces
|
||||
|
|
||||
LL | reuse foo::<A, B, { C }> as xd;
|
||||
| + +
|
||||
error: aborting due to 51 previous errors
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/generics-gen-args-errors.rs:46:11
|
||||
|
|
||||
LL | reuse foo::<> as bar1;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::foo`
|
||||
--> $DIR/generics-gen-args-errors.rs:44:48
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse foo::<T, U, N> as bar1;
|
||||
| +++++++
|
||||
|
||||
error[E0107]: function takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:49:11
|
||||
|
|
||||
LL | reuse foo::<String, String> as bar2;
|
||||
| ^^^ ------ ------ supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: function defined here, with 3 generic parameters: `T`, `U`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:44:8
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^ - - --------------
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | reuse foo::<String, String, N> as bar2;
|
||||
| +++
|
||||
|
||||
error[E0107]: function takes 2 lifetime arguments but 5 lifetime arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:52:11
|
||||
|
|
||||
LL | reuse foo::<'static, _, 'asdasd, 'static, 'static, 'static, _> as bar3;
|
||||
| ^^^ --------------------------- help: remove the lifetime arguments
|
||||
| |
|
||||
| expected 2 lifetime arguments
|
||||
|
|
||||
note: function defined here, with 2 lifetime parameters: `'a`, `'b`
|
||||
--> $DIR/generics-gen-args-errors.rs:44:8
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^ -- --
|
||||
|
||||
error[E0107]: function takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:52:11
|
||||
|
|
||||
LL | reuse foo::<'static, _, 'asdasd, 'static, 'static, 'static, _> as bar3;
|
||||
| ^^^ expected 3 generic arguments ------- - supplied 2 generic arguments
|
||||
|
|
||||
note: function defined here, with 3 generic parameters: `T`, `U`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:44:8
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^ - - --------------
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | reuse foo::<'static, _, 'asdasd, 'static, 'static, 'static, _, N> as bar3;
|
||||
| +++
|
||||
|
||||
error[E0107]: function takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:56:11
|
||||
|
|
||||
LL | reuse foo::<String, 'static, 123, asdasd> as bar4;
|
||||
| ^^^ ------ supplied 1 lifetime argument
|
||||
| |
|
||||
| expected 2 lifetime arguments
|
||||
|
|
||||
note: function defined here, with 2 lifetime parameters: `'a`, `'b`
|
||||
--> $DIR/generics-gen-args-errors.rs:44:8
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^ -- --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | reuse foo::<String, 'static, 'static, 123, asdasd> as bar4;
|
||||
| +++++++++
|
||||
|
||||
error[E0107]: function takes 3 generic arguments but 6 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:60:11
|
||||
|
|
||||
LL | reuse foo::<1, 2, _, 4, 5, _> as bar5;
|
||||
| ^^^ --------- help: remove the unnecessary generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: function defined here, with 3 generic parameters: `T`, `U`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:44:8
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^ - - --------------
|
||||
|
||||
error[E0107]: function takes 3 generic arguments but 5 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:63:11
|
||||
|
|
||||
LL | reuse foo::<1, 2,asd,String, { let x = 0; }> as bar6;
|
||||
| ^^^ ----------------------- help: remove the unnecessary generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: function defined here, with 3 generic parameters: `T`, `U`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:44:8
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^ - - --------------
|
||||
|
||||
error[E0747]: constant provided when a type was expected
|
||||
--> $DIR/generics-gen-args-errors.rs:67:17
|
||||
|
|
||||
LL | reuse foo::<"asdasd", asd, "askdn", 'static, 'a> as bar7;
|
||||
| ^^^^^^^^
|
||||
|
||||
error[E0747]: constant provided when a type was expected
|
||||
--> $DIR/generics-gen-args-errors.rs:72:17
|
||||
|
|
||||
LL | reuse foo::<{}, {}, {}> as bar8;
|
||||
| ^^
|
||||
|
||||
error[E0107]: trait takes 2 generic arguments but 6 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:81:11
|
||||
|
|
||||
LL | reuse Trait::<asd, asd, asd, asd, asd, asdasa>::foo as bar1;
|
||||
| ^^^^^ ----------------------- help: remove the unnecessary generic arguments
|
||||
| |
|
||||
| expected 2 generic arguments
|
||||
|
|
||||
note: trait defined here, with 2 generic parameters: `T`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:77:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ - --------------
|
||||
|
||||
error[E0107]: trait takes 3 lifetime arguments but 2 lifetime arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:90:11
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static>::foo as bar2;
|
||||
| ^^^^^ ------- ------- supplied 2 lifetime arguments
|
||||
| |
|
||||
| expected 3 lifetime arguments
|
||||
|
|
||||
note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a`
|
||||
--> $DIR/generics-gen-args-errors.rs:77:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ -- -- --
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo as bar2;
|
||||
| +++++++++
|
||||
|
||||
error[E0107]: trait takes 2 generic arguments but 5 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:92:11
|
||||
|
|
||||
LL | reuse Trait::<1, 2, 3, 4, 5>::foo as bar3;
|
||||
| ^^^^^ --------- help: remove the unnecessary generic arguments
|
||||
| |
|
||||
| expected 2 generic arguments
|
||||
|
|
||||
note: trait defined here, with 2 generic parameters: `T`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:77:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ - --------------
|
||||
|
||||
error[E0107]: trait takes 2 generic arguments but 3 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:95:11
|
||||
|
|
||||
LL | reuse Trait::<1, 2, true>::foo as bar4;
|
||||
| ^^^^^ ------ help: remove the unnecessary generic argument
|
||||
| |
|
||||
| expected 2 generic arguments
|
||||
|
|
||||
note: trait defined here, with 2 generic parameters: `T`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:77:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ - --------------
|
||||
|
||||
error[E0107]: trait takes 3 lifetime arguments but 1 lifetime argument was supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:98:11
|
||||
|
|
||||
LL | reuse Trait::<'static>::foo as bar5;
|
||||
| ^^^^^ ------- supplied 1 lifetime argument
|
||||
| |
|
||||
| expected 3 lifetime arguments
|
||||
|
|
||||
note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a`
|
||||
--> $DIR/generics-gen-args-errors.rs:77:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ -- -- --
|
||||
help: add missing lifetime arguments
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo as bar5;
|
||||
| ++++++++++++++++++
|
||||
|
||||
error[E0107]: trait takes 3 lifetime arguments but 1 lifetime argument was supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:101:11
|
||||
|
|
||||
LL | reuse Trait::<1, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6;
|
||||
| ^^^^^ - supplied 1 lifetime argument
|
||||
| |
|
||||
| expected 3 lifetime arguments
|
||||
|
|
||||
note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a`
|
||||
--> $DIR/generics-gen-args-errors.rs:77:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ -- -- --
|
||||
help: add missing lifetime arguments
|
||||
|
|
||||
LL | reuse Trait::<1, 'static, 'static, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6;
|
||||
| ++++++++++++++++++
|
||||
|
||||
error[E0107]: trait takes 2 generic arguments but 3 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:101:11
|
||||
|
|
||||
LL | reuse Trait::<1, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6;
|
||||
| ^^^^^ --------------- help: remove the unnecessary generic argument
|
||||
| |
|
||||
| expected 2 generic arguments
|
||||
|
|
||||
note: trait defined here, with 2 generic parameters: `T`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:77:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ - --------------
|
||||
|
||||
error[E0107]: method takes 2 generic arguments but 6 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:101:41
|
||||
|
|
||||
LL | reuse Trait::<1, 2, 'static, DDDD>::foo::<1, 2, 3, 4, 5, 6> as bar6;
|
||||
| ^^^ ------------ help: remove the unnecessary generic arguments
|
||||
| |
|
||||
| expected 2 generic arguments
|
||||
|
|
||||
note: method defined here, with 2 generic parameters: `U`, `M`
|
||||
--> $DIR/generics-gen-args-errors.rs:78:12
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(self) {}
|
||||
| ^^^ - -------------
|
||||
|
||||
error[E0107]: trait takes 3 lifetime arguments but 1 lifetime argument was supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:107:11
|
||||
|
|
||||
LL | reuse Trait::<Trait, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7;
|
||||
| ^^^^^ ----- supplied 1 lifetime argument
|
||||
| |
|
||||
| expected 3 lifetime arguments
|
||||
|
|
||||
note: trait defined here, with 3 lifetime parameters: `'b`, `'c`, `'a`
|
||||
--> $DIR/generics-gen-args-errors.rs:77:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ -- -- --
|
||||
help: add missing lifetime arguments
|
||||
|
|
||||
LL | reuse Trait::<Trait, 'static, 'static, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7;
|
||||
| ++++++++++++++++++
|
||||
|
||||
error[E0107]: trait takes 2 generic arguments but 5 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:107:11
|
||||
|
|
||||
LL | reuse Trait::<Trait, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7;
|
||||
| ^^^^^ --- help: remove the unnecessary generic argument
|
||||
| |
|
||||
| expected 2 generic arguments
|
||||
|
|
||||
note: trait defined here, with 2 generic parameters: `T`, `N`
|
||||
--> $DIR/generics-gen-args-errors.rs:77:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T, const N: usize>: Sized {
|
||||
| ^^^^^ - --------------
|
||||
|
||||
error[E0107]: method takes 2 generic arguments but 5 generic arguments were supplied
|
||||
--> $DIR/generics-gen-args-errors.rs:107:59
|
||||
|
|
||||
LL | reuse Trait::<Trait, Clone, _, 'static, dyn Send, _>::foo::<1, 2, 3, _, 6> as bar7;
|
||||
| ^^^ --------- help: remove the unnecessary generic arguments
|
||||
| |
|
||||
| expected 2 generic arguments
|
||||
|
|
||||
note: method defined here, with 2 generic parameters: `U`, `M`
|
||||
--> $DIR/generics-gen-args-errors.rs:78:12
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(self) {}
|
||||
| ^^^ - -------------
|
||||
|
||||
error: aborting due to 47 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0106, E0107, E0261, E0284, E0401, E0423, E0425, E0747.
|
||||
Some errors have detailed explanations: E0106, E0107, E0121, E0261, E0401, E0423, E0425, E0747.
|
||||
For more information about an error, try `rustc --explain E0106`.
|
||||
|
||||
@@ -21,9 +21,10 @@ struct X<'x1, 'x2, 'x3, 'x4, X1, X2, const X3: usize>(
|
||||
|
||||
impl<'a, 'b, 'c, A, B, const N: usize> Trait<'a, 'b, 'c, A, B, N> for XX {
|
||||
reuse to_reuse::bar;
|
||||
//~^ ERROR: type annotations needed
|
||||
//~^ ERROR: function takes at most 2 generic arguments but 3 generic arguments were supplied
|
||||
|
||||
reuse to_reuse::bar1;
|
||||
//~^ ERROR: function takes 0 generic arguments but 3 generic arguments were supplied
|
||||
|
||||
reuse to_reuse::bar2;
|
||||
//~^ ERROR: type annotations needed
|
||||
@@ -32,6 +33,7 @@ impl<'a, 'b, 'c, A, B, const N: usize> Trait<'a, 'b, 'c, A, B, N> for XX {
|
||||
reuse to_reuse::bar2::<i32, i32, i32, i32, i32, i32, 123, true> as bar3;
|
||||
|
||||
reuse to_reuse::bar2::<i32, i32, i32, i32, i32, i32, 123, true> as bar4;
|
||||
//~^ ERROR: method `bar4` has 0 type parameters but its trait declaration has 3 type parameters
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
@@ -1,16 +1,43 @@
|
||||
error[E0282]: type annotations needed
|
||||
error[E0049]: method `bar4` has 0 type parameters but its trait declaration has 3 type parameters
|
||||
--> $DIR/impl-trait-wrong-args-count.rs:35:21
|
||||
|
|
||||
LL | fn bar4<X, Y, Z>(&self) {}
|
||||
| - - -
|
||||
| |
|
||||
| expected 3 type parameters
|
||||
...
|
||||
LL | reuse to_reuse::bar2::<i32, i32, i32, i32, i32, i32, 123, true> as bar4;
|
||||
| ^^^^ found 0 type parameters
|
||||
|
||||
error[E0107]: function takes at most 2 generic arguments but 3 generic arguments were supplied
|
||||
--> $DIR/impl-trait-wrong-args-count.rs:23:21
|
||||
|
|
||||
LL | fn bar<'x: 'x, 'y: 'y, AA, BB, const NN: usize>(&self) {}
|
||||
| ----------------- help: remove the unnecessary generic argument
|
||||
...
|
||||
LL | reuse to_reuse::bar;
|
||||
| ^^^ cannot infer type of the type parameter `A` declared on the function `bar`
|
||||
| ^^^ expected at most 2 generic arguments
|
||||
|
|
||||
help: consider specifying the generic arguments
|
||||
note: function defined here, with at most 2 generic parameters: `A`, `B`
|
||||
--> $DIR/impl-trait-wrong-args-count.rs:5:12
|
||||
|
|
||||
LL | reuse to_reuse::bar::<A, B>;
|
||||
| ++++++++
|
||||
LL | pub fn bar<'a: 'a, 'b: 'b, A, B>(x: &super::XX) {}
|
||||
| ^^^ - -
|
||||
|
||||
error[E0107]: function takes 0 generic arguments but 3 generic arguments were supplied
|
||||
--> $DIR/impl-trait-wrong-args-count.rs:26:21
|
||||
|
|
||||
LL | reuse to_reuse::bar1;
|
||||
| ^^^^ expected 0 generic arguments
|
||||
|
|
||||
note: function defined here, with 0 generic parameters
|
||||
--> $DIR/impl-trait-wrong-args-count.rs:6:12
|
||||
|
|
||||
LL | pub fn bar1(x: &super::XX) {}
|
||||
| ^^^^
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/impl-trait-wrong-args-count.rs:28:21
|
||||
--> $DIR/impl-trait-wrong-args-count.rs:29:21
|
||||
|
|
||||
LL | reuse to_reuse::bar2;
|
||||
| ^^^^ cannot infer the value of the const parameter `X` declared on the function `bar2`
|
||||
@@ -26,7 +53,7 @@ LL | reuse to_reuse::bar2::<A, B, C, D, E, F, X, Y>;
|
||||
| ++++++++++++++++++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/impl-trait-wrong-args-count.rs:28:21
|
||||
--> $DIR/impl-trait-wrong-args-count.rs:29:21
|
||||
|
|
||||
LL | reuse to_reuse::bar2;
|
||||
| ^^^^ cannot infer the value of the const parameter `Y` declared on the function `bar2`
|
||||
@@ -41,7 +68,7 @@ help: consider specifying the generic arguments
|
||||
LL | reuse to_reuse::bar2::<A, B, C, D, E, F, X, Y>;
|
||||
| ++++++++++++++++++++++++++
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0282, E0284.
|
||||
For more information about an error, try `rustc --explain E0282`.
|
||||
Some errors have detailed explanations: E0049, E0107, E0284.
|
||||
For more information about an error, try `rustc --explain E0049`.
|
||||
|
||||
+2
-11
@@ -1,3 +1,5 @@
|
||||
//@ run-pass
|
||||
|
||||
#![feature(fn_delegation)]
|
||||
#![allow(incomplete_features)]
|
||||
#![allow(late_bound_lifetime_arguments)]
|
||||
@@ -15,7 +17,6 @@ fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
|
||||
pub fn check() {
|
||||
reuse foo as bar;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
bar::<i32, i32, 1>();
|
||||
}
|
||||
}
|
||||
@@ -27,7 +28,6 @@ fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
|
||||
pub fn check<T: Clone, U: Clone>() {
|
||||
reuse foo as bar;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
bar::<T, U, 1>();
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,6 @@ fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
|
||||
pub fn check<T: Clone, U: Clone>() {
|
||||
reuse foo as bar;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
bar::<u64, i32, 1>();
|
||||
}
|
||||
}
|
||||
@@ -52,7 +51,6 @@ fn foo<'a, 'b, T: Clone, U: Clone, const N: usize>(_t: &'a T, _u: &'b U) {}
|
||||
|
||||
pub fn check<T: Clone, U: Clone>() {
|
||||
reuse foo as bar;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
bar::<u64, i32, 1>(&1, &2);
|
||||
}
|
||||
}
|
||||
@@ -65,7 +63,6 @@ fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
|
||||
|
||||
pub fn check<T: Clone, U: Clone>() {
|
||||
reuse foo as bar;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
bar::<u64, 1, u32>(&1, &2);
|
||||
}
|
||||
}
|
||||
@@ -77,9 +74,7 @@ fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
|
||||
|
||||
pub fn check<T: Clone, U: Clone>() {
|
||||
reuse foo::<String, 1, String> as bar;
|
||||
//~^ ERROR: arguments to this function are incorrect [E0308]
|
||||
bar(&"".to_string(), &"".to_string());
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,9 +99,7 @@ pub fn check<T: Clone, U: Clone>() {
|
||||
fn foo<'a, 'b, const N: usize, T: Clone, U: Clone>(_t: &'a T, _u: &'b U) {}
|
||||
|
||||
reuse foo::<1, String, String> as bar;
|
||||
//~^ ERROR: arguments to this function are incorrect [E0308]
|
||||
bar(&"".to_string(), &"".to_string());
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,9 +112,7 @@ pub fn check<T: Clone, U: Clone>() {
|
||||
fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
|
||||
|
||||
reuse foo::<String, 1, String> as bar;
|
||||
//~^ ERROR: arguments to this function are incorrect [E0308]
|
||||
bar(&"".to_string(), &"".to_string());
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
};
|
||||
|
||||
closure();
|
||||
@@ -1,213 +0,0 @@
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/free-to-free.rs:17:15
|
||||
|
|
||||
LL | reuse foo as bar;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::foo`
|
||||
--> $DIR/free-to-free.rs:14:48
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse foo::<T, U, N> as bar;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/free-to-free.rs:29:15
|
||||
|
|
||||
LL | reuse foo as bar;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::foo`
|
||||
--> $DIR/free-to-free.rs:26:48
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse foo::<T, U, N> as bar;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/free-to-free.rs:41:15
|
||||
|
|
||||
LL | reuse foo as bar;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_3::foo`
|
||||
--> $DIR/free-to-free.rs:38:48
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse foo::<T, U, N> as bar;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/free-to-free.rs:54:15
|
||||
|
|
||||
LL | reuse foo as bar;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::foo`
|
||||
--> $DIR/free-to-free.rs:51:40
|
||||
|
|
||||
LL | fn foo<'a, 'b, T: Clone, U: Clone, const N: usize>(_t: &'a T, _u: &'b U) {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse foo::<T, U, N> as bar;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/free-to-free.rs:67:15
|
||||
|
|
||||
LL | reuse foo as bar;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_5::foo`
|
||||
--> $DIR/free-to-free.rs:64:30
|
||||
|
|
||||
LL | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse foo::<T, N, U> as bar;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/free-to-free.rs:81:9
|
||||
|
|
||||
LL | bar(&"".to_string(), &"".to_string());
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_6::check::bar`
|
||||
--> $DIR/free-to-free.rs:76:30
|
||||
|
|
||||
LL | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `bar`
|
||||
...
|
||||
LL | reuse foo::<String, 1, String> as bar;
|
||||
| --- required by a bound in this function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | bar::<String, N, String>(&"".to_string(), &"".to_string());
|
||||
| +++++++++++++++++++++
|
||||
|
||||
error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/free-to-free.rs:79:15
|
||||
|
|
||||
LL | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
|
||||
| - - found this type parameter
|
||||
| |
|
||||
| found this type parameter
|
||||
...
|
||||
LL | reuse foo::<String, 1, String> as bar;
|
||||
| ^^^
|
||||
| |
|
||||
| expected `&String`, found `&T`
|
||||
| expected `&String`, found `&U`
|
||||
|
|
||||
= note: expected reference `&String`
|
||||
found reference `&'a T`
|
||||
= note: expected reference `&String`
|
||||
found reference `&'b U`
|
||||
note: function defined here
|
||||
--> $DIR/free-to-free.rs:76:8
|
||||
|
|
||||
LL | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
|
||||
| ^^^ --------- ---------
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/free-to-free.rs:108:9
|
||||
|
|
||||
LL | bar(&"".to_string(), &"".to_string());
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_8::check::bar`
|
||||
--> $DIR/free-to-free.rs:104:24
|
||||
|
|
||||
LL | fn foo<'a, 'b, const N: usize, T: Clone, U: Clone>(_t: &'a T, _u: &'b U) {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `bar`
|
||||
LL |
|
||||
LL | reuse foo::<1, String, String> as bar;
|
||||
| --- required by a bound in this function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | bar::<N, String, String>(&"".to_string(), &"".to_string());
|
||||
| +++++++++++++++++++++
|
||||
|
||||
error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/free-to-free.rs:106:15
|
||||
|
|
||||
LL | fn foo<'a, 'b, const N: usize, T: Clone, U: Clone>(_t: &'a T, _u: &'b U) {}
|
||||
| - - found this type parameter
|
||||
| |
|
||||
| found this type parameter
|
||||
LL |
|
||||
LL | reuse foo::<1, String, String> as bar;
|
||||
| ^^^
|
||||
| |
|
||||
| expected `&String`, found `&T`
|
||||
| expected `&String`, found `&U`
|
||||
|
|
||||
= note: expected reference `&String`
|
||||
found reference `&'a T`
|
||||
= note: expected reference `&String`
|
||||
found reference `&'b U`
|
||||
note: function defined here
|
||||
--> $DIR/free-to-free.rs:104:12
|
||||
|
|
||||
LL | fn foo<'a, 'b, const N: usize, T: Clone, U: Clone>(_t: &'a T, _u: &'b U) {}
|
||||
| ^^^ --------- ---------
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/free-to-free.rs:123:13
|
||||
|
|
||||
LL | bar(&"".to_string(), &"".to_string());
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_9::check::{closure#0}::bar`
|
||||
--> $DIR/free-to-free.rs:119:38
|
||||
|
|
||||
LL | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `bar`
|
||||
LL |
|
||||
LL | reuse foo::<String, 1, String> as bar;
|
||||
| --- required by a bound in this function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | bar::<String, N, String>(&"".to_string(), &"".to_string());
|
||||
| +++++++++++++++++++++
|
||||
|
||||
error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/free-to-free.rs:121:19
|
||||
|
|
||||
LL | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
|
||||
| - - found this type parameter
|
||||
| |
|
||||
| found this type parameter
|
||||
LL |
|
||||
LL | reuse foo::<String, 1, String> as bar;
|
||||
| ^^^
|
||||
| |
|
||||
| expected `&String`, found `&T`
|
||||
| expected `&String`, found `&U`
|
||||
|
|
||||
= note: expected reference `&String`
|
||||
found reference `&'a T`
|
||||
= note: expected reference `&String`
|
||||
found reference `&'b U`
|
||||
note: function defined here
|
||||
--> $DIR/free-to-free.rs:119:16
|
||||
|
|
||||
LL | fn foo<'a, 'b, T: Clone, const N: usize, U: Clone>(_t: &'a T, _u: &'b U) {}
|
||||
| ^^^ --------- ---------
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0284, E0308.
|
||||
For more information about an error, try `rustc --explain E0284`.
|
||||
+2
-22
@@ -1,3 +1,5 @@
|
||||
//@ run-pass
|
||||
|
||||
#![feature(fn_delegation)]
|
||||
#![allow(incomplete_features)]
|
||||
#![allow(late_bound_lifetime_arguments)]
|
||||
@@ -20,13 +22,11 @@ impl Trait<'static, 'static, 'static, i32, 1> for u8 {}
|
||||
pub fn check() {
|
||||
fn no_ctx() {
|
||||
reuse Trait::foo as bar;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
bar::<'static, 'static, 'static, 'static, u8, i32, 1, String, true>(123);
|
||||
}
|
||||
|
||||
fn with_ctx<'a, 'b, 'c, A, B, C, const N: usize, const M: bool>() {
|
||||
reuse Trait::foo as bar;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
bar::<'static, 'static, 'static, 'a, u8, i32, 1, A, M>(123);
|
||||
}
|
||||
|
||||
@@ -45,11 +45,8 @@ impl Trait<'static, i32, 1> for u8 {}
|
||||
|
||||
pub fn check() {
|
||||
reuse Trait::<'static, i32, 1>::foo as bar;
|
||||
//~^ ERROR: the trait bound `Self: test_2::Trait<'static, i32, 1>` is not satisfied [E0277]
|
||||
|
||||
bar::<'static, u8, String, true>(123);
|
||||
//~^ ERROR: function takes 5 generic arguments but 3 generic arguments were supplied [E0107]
|
||||
//~| ERROR: function takes 2 lifetime arguments but 1 lifetime argument was supplied [E0107]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,8 +63,6 @@ pub fn check() {
|
||||
reuse Trait::foo::<'static, i32, true> as bar;
|
||||
|
||||
bar::<'static, u8, String, 1>(123);
|
||||
//~^ ERROR: function takes 5 generic arguments but 3 generic arguments were supplied [E0107]
|
||||
//~| ERROR: function takes 2 lifetime arguments but 1 lifetime argument was supplied [E0107]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +79,6 @@ pub fn check() {
|
||||
reuse Trait::foo::<'static, i32, true> as bar;
|
||||
|
||||
bar::<u8, String, 1>(123);
|
||||
//~^ ERROR: function takes 5 generic arguments but 3 generic arguments were supplied [E0107]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +94,6 @@ pub fn check() {
|
||||
reuse Trait::foo::<'static, i32, true> as bar;
|
||||
|
||||
bar::<u8, 1>(123);
|
||||
//~^ ERROR: function takes 4 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +110,6 @@ pub fn check() {
|
||||
reuse Trait::foo::<'static, i32, true> as bar;
|
||||
|
||||
bar::<u8>(123);
|
||||
//~^ ERROR: function takes 3 generic arguments but 1 generic argument was supplied [E0107]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,10 +124,8 @@ impl Trait<'static, i32, 1> for u8 {}
|
||||
|
||||
pub fn check() {
|
||||
reuse Trait::<'static, i32, 1>::foo as bar;
|
||||
//~^ ERROR: the trait bound `Self: test_7::Trait<'static, i32, 1>` is not satisfied [E0277]
|
||||
|
||||
bar::<u8, String, true>(123);
|
||||
//~^ ERROR: function takes 5 generic arguments but 3 generic arguments were supplied [E0107]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,10 +139,8 @@ impl Trait<'static, i32, 1> for u8 {}
|
||||
|
||||
pub fn check() {
|
||||
reuse Trait::<'static, i32, 1>::foo as bar;
|
||||
//~^ ERROR: the trait bound `Self: test_8::Trait<'static, i32, 1>` is not satisfied [E0277]
|
||||
|
||||
bar::<u8, true>(123);
|
||||
//~^ ERROR: function takes 4 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,10 +154,8 @@ impl Trait<'static, i32, 1> for u8 {}
|
||||
|
||||
pub fn check() {
|
||||
reuse Trait::<'static, i32, 1>::foo as bar;
|
||||
//~^ ERROR: the trait bound `Self: test_9::Trait<'static, i32, 1>` is not satisfied [E0277]
|
||||
|
||||
bar::<u8>(123);
|
||||
//~^ ERROR: function takes 3 generic arguments but 1 generic argument was supplied [E0107]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,19 +172,14 @@ impl<'b, 'c, T> Trait<'b, 'c, T> for u8 {}
|
||||
pub fn check() {
|
||||
fn with_ctx<'a, 'b, 'c, A, B, C, const N: usize, const M: bool>() {
|
||||
reuse <u8 as Trait>::foo as bar;
|
||||
//~^ ERROR: missing generics for trait `test_10::Trait` [E0107]
|
||||
bar::<'a, 'b, 'c, u8, C, A, M>();
|
||||
bar::<'static, 'static, 'static, u8, i32, i32, false>();
|
||||
|
||||
reuse <u8 as Trait::<'static, 'static, i32>>::foo as bar1;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
bar1::<'static, u8, i32, true>();
|
||||
//~^ ERROR: function takes 4 generic arguments but 3 generic arguments were supplied [E0107]
|
||||
//~| ERROR: function takes 3 lifetime arguments but 1 lifetime argument was supplied [E0107]
|
||||
|
||||
reuse <u8 as Trait::<'static, 'static, i32>>::foo::<'static, u32, true> as bar2;
|
||||
bar2::<u8>();
|
||||
//~^ ERROR: function takes 4 generic arguments but 1 generic argument was supplied [E0107]
|
||||
}
|
||||
|
||||
with_ctx::<i32, i32, i32, 1, true>();
|
||||
@@ -231,7 +212,6 @@ impl Bound2<Struct, Vec<Vec<Vec<u32>>>> for Struct {}
|
||||
|
||||
pub fn check<'b>() {
|
||||
reuse <usize as Trait>::foo;
|
||||
//~^ ERROR: missing generics for trait `test_11::Trait` [E0107]
|
||||
foo::<'static, 'b, usize, u32, Struct, String, false>();
|
||||
}
|
||||
}
|
||||
@@ -1,401 +0,0 @@
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/free-to-trait.rs:22:26
|
||||
|
|
||||
LL | reuse Trait::foo as bar;
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::Trait::foo`
|
||||
--> $DIR/free-to-trait.rs:15:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::foo::<U, M> as bar;
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/free-to-trait.rs:28:26
|
||||
|
|
||||
LL | reuse Trait::foo as bar;
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::Trait::foo`
|
||||
--> $DIR/free-to-trait.rs:15:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::foo::<U, M> as bar;
|
||||
| ++++++++
|
||||
|
||||
error[E0107]: function takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||
--> $DIR/free-to-trait.rs:50:9
|
||||
|
|
||||
LL | bar::<'static, u8, String, true>(123);
|
||||
| ^^^ ------- supplied 1 lifetime argument
|
||||
| |
|
||||
| expected 2 lifetime arguments
|
||||
|
|
||||
note: function defined here, with 2 lifetime parameters: `'a`, `'b`
|
||||
--> $DIR/free-to-trait.rs:47:48
|
||||
|
|
||||
LL | trait Trait<'a, T, const N: usize>: Sized {
|
||||
| --
|
||||
LL | fn foo<'b: 'b, U, const M: bool>(self) {}
|
||||
| --
|
||||
...
|
||||
LL | reuse Trait::<'static, i32, 1>::foo as bar;
|
||||
| ^^^
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | bar::<'static, 'static, u8, String, true>(123);
|
||||
| +++++++++
|
||||
|
||||
error[E0107]: function takes 5 generic arguments but 3 generic arguments were supplied
|
||||
--> $DIR/free-to-trait.rs:50:9
|
||||
|
|
||||
LL | bar::<'static, u8, String, true>(123);
|
||||
| ^^^ -- ------ ---- supplied 3 generic arguments
|
||||
| |
|
||||
| expected 5 generic arguments
|
||||
|
|
||||
note: function defined here, with 5 generic parameters: `Self`, `T`, `N`, `U`, `M`
|
||||
--> $DIR/free-to-trait.rs:47:48
|
||||
|
|
||||
LL | trait Trait<'a, T, const N: usize>: Sized {
|
||||
| -----------------------------------------
|
||||
LL | fn foo<'b: 'b, U, const M: bool>(self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, i32, 1>::foo as bar;
|
||||
| ^^^
|
||||
help: add missing generic arguments
|
||||
|
|
||||
LL | bar::<'static, u8, String, true, U, M>(123);
|
||||
| ++++++
|
||||
|
||||
error[E0277]: the trait bound `Self: test_2::Trait<'static, i32, 1>` is not satisfied
|
||||
--> $DIR/free-to-trait.rs:47:41
|
||||
|
|
||||
LL | reuse Trait::<'static, i32, 1>::foo as bar;
|
||||
| ^^^ the trait `test_2::Trait<'static, i32, 1>` is not implemented for `Self`
|
||||
|
||||
error[E0107]: function takes 2 lifetime arguments but 1 lifetime argument was supplied
|
||||
--> $DIR/free-to-trait.rs:68:9
|
||||
|
|
||||
LL | bar::<'static, u8, String, 1>(123);
|
||||
| ^^^ ------- supplied 1 lifetime argument
|
||||
| |
|
||||
| expected 2 lifetime arguments
|
||||
|
|
||||
note: function defined here, with 2 lifetime parameters: `'a`, `'b`
|
||||
--> $DIR/free-to-trait.rs:66:51
|
||||
|
|
||||
LL | trait Trait<'a, T, const N: usize>: Sized {
|
||||
| --
|
||||
LL | fn foo<'b: 'b, U, const M: bool>(self) {}
|
||||
| --
|
||||
...
|
||||
LL | reuse Trait::foo::<'static, i32, true> as bar;
|
||||
| ^^^
|
||||
help: add missing lifetime argument
|
||||
|
|
||||
LL | bar::<'static, 'static, u8, String, 1>(123);
|
||||
| +++++++++
|
||||
|
||||
error[E0107]: function takes 5 generic arguments but 3 generic arguments were supplied
|
||||
--> $DIR/free-to-trait.rs:68:9
|
||||
|
|
||||
LL | bar::<'static, u8, String, 1>(123);
|
||||
| ^^^ -- ------ - supplied 3 generic arguments
|
||||
| |
|
||||
| expected 5 generic arguments
|
||||
|
|
||||
note: function defined here, with 5 generic parameters: `Self`, `T`, `N`, `U`, `M`
|
||||
--> $DIR/free-to-trait.rs:66:51
|
||||
|
|
||||
LL | trait Trait<'a, T, const N: usize>: Sized {
|
||||
| -----------------------------------------
|
||||
LL | fn foo<'b: 'b, U, const M: bool>(self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::foo::<'static, i32, true> as bar;
|
||||
| ^^^
|
||||
help: add missing generic arguments
|
||||
|
|
||||
LL | bar::<'static, u8, String, 1, U, M>(123);
|
||||
| ++++++
|
||||
|
||||
error[E0107]: function takes 5 generic arguments but 3 generic arguments were supplied
|
||||
--> $DIR/free-to-trait.rs:86:9
|
||||
|
|
||||
LL | bar::<u8, String, 1>(123);
|
||||
| ^^^ -- ------ - supplied 3 generic arguments
|
||||
| |
|
||||
| expected 5 generic arguments
|
||||
|
|
||||
note: function defined here, with 5 generic parameters: `Self`, `T`, `N`, `U`, `M`
|
||||
--> $DIR/free-to-trait.rs:84:51
|
||||
|
|
||||
LL | trait Trait<T, const N: usize>: Sized {
|
||||
| -------------------------------------
|
||||
LL | fn foo<'b: 'b, U, const M: bool>(self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::foo::<'static, i32, true> as bar;
|
||||
| ^^^
|
||||
help: add missing generic arguments
|
||||
|
|
||||
LL | bar::<u8, String, 1, U, M>(123);
|
||||
| ++++++
|
||||
|
||||
error[E0107]: function takes 4 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/free-to-trait.rs:102:9
|
||||
|
|
||||
LL | bar::<u8, 1>(123);
|
||||
| ^^^ -- - supplied 2 generic arguments
|
||||
| |
|
||||
| expected 4 generic arguments
|
||||
|
|
||||
note: function defined here, with 4 generic parameters: `Self`, `N`, `U`, `M`
|
||||
--> $DIR/free-to-trait.rs:100:51
|
||||
|
|
||||
LL | trait Trait<const N: usize>: Sized {
|
||||
| ----------------------------------
|
||||
LL | fn foo<'b: 'b, U, const M: bool>(self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::foo::<'static, i32, true> as bar;
|
||||
| ^^^
|
||||
help: add missing generic arguments
|
||||
|
|
||||
LL | bar::<u8, 1, U, M>(123);
|
||||
| ++++++
|
||||
|
||||
error[E0107]: function takes 3 generic arguments but 1 generic argument was supplied
|
||||
--> $DIR/free-to-trait.rs:119:9
|
||||
|
|
||||
LL | bar::<u8>(123);
|
||||
| ^^^ -- supplied 1 generic argument
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: function defined here, with 3 generic parameters: `Self`, `U`, `M`
|
||||
--> $DIR/free-to-trait.rs:117:51
|
||||
|
|
||||
LL | trait Trait: Sized {
|
||||
| ------------------
|
||||
LL | fn foo<'b: 'b, U, const M: bool>(self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::foo::<'static, i32, true> as bar;
|
||||
| ^^^
|
||||
help: add missing generic arguments
|
||||
|
|
||||
LL | bar::<u8, U, M>(123);
|
||||
| ++++++
|
||||
|
||||
error[E0107]: function takes 5 generic arguments but 3 generic arguments were supplied
|
||||
--> $DIR/free-to-trait.rs:137:9
|
||||
|
|
||||
LL | bar::<u8, String, true>(123);
|
||||
| ^^^ -- ------ ---- supplied 3 generic arguments
|
||||
| |
|
||||
| expected 5 generic arguments
|
||||
|
|
||||
note: function defined here, with 5 generic parameters: `Self`, `T`, `N`, `U`, `M`
|
||||
--> $DIR/free-to-trait.rs:134:48
|
||||
|
|
||||
LL | trait Trait<'a, T, const N: usize>: Sized {
|
||||
| -----------------------------------------
|
||||
LL | fn foo<U, const M: bool>(self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, i32, 1>::foo as bar;
|
||||
| ^^^
|
||||
help: add missing generic arguments
|
||||
|
|
||||
LL | bar::<u8, String, true, U, M>(123);
|
||||
| ++++++
|
||||
|
||||
error[E0277]: the trait bound `Self: test_7::Trait<'static, i32, 1>` is not satisfied
|
||||
--> $DIR/free-to-trait.rs:134:41
|
||||
|
|
||||
LL | reuse Trait::<'static, i32, 1>::foo as bar;
|
||||
| ^^^ the trait `test_7::Trait<'static, i32, 1>` is not implemented for `Self`
|
||||
|
||||
error[E0107]: function takes 4 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/free-to-trait.rs:154:9
|
||||
|
|
||||
LL | bar::<u8, true>(123);
|
||||
| ^^^ -- ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 4 generic arguments
|
||||
|
|
||||
note: function defined here, with 4 generic parameters: `Self`, `T`, `N`, `M`
|
||||
--> $DIR/free-to-trait.rs:151:48
|
||||
|
|
||||
LL | trait Trait<'a, T, const N: usize>: Sized {
|
||||
| -----------------------------------------
|
||||
LL | fn foo<const M: bool>(self) {}
|
||||
| -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, i32, 1>::foo as bar;
|
||||
| ^^^
|
||||
help: add missing generic arguments
|
||||
|
|
||||
LL | bar::<u8, true, N, M>(123);
|
||||
| ++++++
|
||||
|
||||
error[E0277]: the trait bound `Self: test_8::Trait<'static, i32, 1>` is not satisfied
|
||||
--> $DIR/free-to-trait.rs:151:41
|
||||
|
|
||||
LL | reuse Trait::<'static, i32, 1>::foo as bar;
|
||||
| ^^^ the trait `test_8::Trait<'static, i32, 1>` is not implemented for `Self`
|
||||
|
||||
error[E0107]: function takes 3 generic arguments but 1 generic argument was supplied
|
||||
--> $DIR/free-to-trait.rs:171:9
|
||||
|
|
||||
LL | bar::<u8>(123);
|
||||
| ^^^ -- supplied 1 generic argument
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: function defined here, with 3 generic parameters: `Self`, `T`, `N`
|
||||
--> $DIR/free-to-trait.rs:168:48
|
||||
|
|
||||
LL | trait Trait<'a, T, const N: usize>: Sized {
|
||||
| -----------------------------------------
|
||||
...
|
||||
LL | reuse Trait::<'static, i32, 1>::foo as bar;
|
||||
| ^^^
|
||||
help: add missing generic arguments
|
||||
|
|
||||
LL | bar::<u8, T, N>(123);
|
||||
| ++++++
|
||||
|
||||
error[E0277]: the trait bound `Self: test_9::Trait<'static, i32, 1>` is not satisfied
|
||||
--> $DIR/free-to-trait.rs:168:41
|
||||
|
|
||||
LL | reuse Trait::<'static, i32, 1>::foo as bar;
|
||||
| ^^^ the trait `test_9::Trait<'static, i32, 1>` is not implemented for `Self`
|
||||
|
||||
error[E0107]: function takes 3 lifetime arguments but 1 lifetime argument was supplied
|
||||
--> $DIR/free-to-trait.rs:195:13
|
||||
|
|
||||
LL | bar1::<'static, u8, i32, true>();
|
||||
| ^^^^ ------- supplied 1 lifetime argument
|
||||
| |
|
||||
| expected 3 lifetime arguments
|
||||
|
|
||||
note: function defined here, with 3 lifetime parameters: `'b`, `'c`, `'d`
|
||||
--> $DIR/free-to-trait.rs:193:66
|
||||
|
|
||||
LL | trait Trait<'b, 'c, T> {
|
||||
| -- --
|
||||
LL | fn foo<'d: 'd, U, const M: bool>() {}
|
||||
| --
|
||||
...
|
||||
LL | reuse <u8 as Trait::<'static, 'static, i32>>::foo as bar1;
|
||||
| ^^^^
|
||||
help: add missing lifetime arguments
|
||||
|
|
||||
LL | bar1::<'static, 'static, 'static, u8, i32, true>();
|
||||
| ++++++++++++++++++
|
||||
|
||||
error[E0107]: function takes 4 generic arguments but 3 generic arguments were supplied
|
||||
--> $DIR/free-to-trait.rs:195:13
|
||||
|
|
||||
LL | bar1::<'static, u8, i32, true>();
|
||||
| ^^^^ -- --- ---- supplied 3 generic arguments
|
||||
| |
|
||||
| expected 4 generic arguments
|
||||
|
|
||||
note: function defined here, with 4 generic parameters: `Self`, `T`, `U`, `M`
|
||||
--> $DIR/free-to-trait.rs:193:66
|
||||
|
|
||||
LL | trait Trait<'b, 'c, T> {
|
||||
| ----------------------
|
||||
LL | fn foo<'d: 'd, U, const M: bool>() {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse <u8 as Trait::<'static, 'static, i32>>::foo as bar1;
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | bar1::<'static, u8, i32, true, M>();
|
||||
| +++
|
||||
|
||||
error[E0107]: function takes 4 generic arguments but 1 generic argument was supplied
|
||||
--> $DIR/free-to-trait.rs:200:13
|
||||
|
|
||||
LL | bar2::<u8>();
|
||||
| ^^^^ -- supplied 1 generic argument
|
||||
| |
|
||||
| expected 4 generic arguments
|
||||
|
|
||||
note: function defined here, with 4 generic parameters: `Self`, `T`, `U`, `M`
|
||||
--> $DIR/free-to-trait.rs:199:88
|
||||
|
|
||||
LL | trait Trait<'b, 'c, T> {
|
||||
| ----------------------
|
||||
LL | fn foo<'d: 'd, U, const M: bool>() {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse <u8 as Trait::<'static, 'static, i32>>::foo::<'static, u32, true> as bar2;
|
||||
| ^^^^
|
||||
help: add missing generic arguments
|
||||
|
|
||||
LL | bar2::<u8, T, U, M>();
|
||||
| +++++++++
|
||||
|
||||
error[E0107]: missing generics for trait `test_10::Trait`
|
||||
--> $DIR/free-to-trait.rs:188:26
|
||||
|
|
||||
LL | reuse <u8 as Trait>::foo as bar;
|
||||
| ^^^^^ expected 1 generic argument
|
||||
|
|
||||
note: trait defined here, with 1 generic parameter: `T`
|
||||
--> $DIR/free-to-trait.rs:180:11
|
||||
|
|
||||
LL | trait Trait<'b, 'c, T> {
|
||||
| ^^^^^ -
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | reuse <u8 as Trait<T>>::foo as bar;
|
||||
| +++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/free-to-trait.rs:193:59
|
||||
|
|
||||
LL | reuse <u8 as Trait::<'static, 'static, i32>>::foo as bar1;
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the associated function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_10::Trait::foo`
|
||||
--> $DIR/free-to-trait.rs:181:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>() {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0107]: missing generics for trait `test_11::Trait`
|
||||
--> $DIR/free-to-trait.rs:233:25
|
||||
|
|
||||
LL | reuse <usize as Trait>::foo;
|
||||
| ^^^^^ expected 2 generic arguments
|
||||
|
|
||||
note: trait defined here, with 2 generic parameters: `T`, `P`
|
||||
--> $DIR/free-to-trait.rs:216:11
|
||||
|
|
||||
LL | trait Trait<'a: 'static, T, P>
|
||||
| ^^^^^ - -
|
||||
help: add missing generic arguments
|
||||
|
|
||||
LL | reuse <usize as Trait<T, P>>::foo;
|
||||
| ++++++
|
||||
|
||||
error: aborting due to 22 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0107, E0277, E0284.
|
||||
For more information about an error, try `rustc --explain E0107`.
|
||||
+14
-17
@@ -1,3 +1,5 @@
|
||||
//@ run-pass
|
||||
|
||||
#![feature(fn_delegation)]
|
||||
#![allow(incomplete_features)]
|
||||
#![allow(late_bound_lifetime_arguments)]
|
||||
@@ -13,7 +15,7 @@
|
||||
mod test_1 {
|
||||
mod to_reuse {
|
||||
pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
|
||||
pub fn bar<'a: 'a, 'b: 'b, A, B, const N: usize>(x: &super::XX) {}
|
||||
pub fn bar<'a: 'a, 'b: 'b, A, B, const N: usize>(_x: &super::XX) {}
|
||||
}
|
||||
|
||||
trait Trait<'a, 'b, 'c, A, B, const N: usize>: Sized {
|
||||
@@ -23,15 +25,14 @@ fn oof() {}
|
||||
fn rab(&self) {}
|
||||
}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct X<'x1, 'x2, 'x3, 'x4, X1, X2, const X3: usize>(
|
||||
&'x1 X1, &'x2 X2, &'x3 X1, &'x4 [usize; X3]);
|
||||
type XX = X::<'static, 'static, 'static, 'static, i32, i32, 3>;
|
||||
|
||||
impl<'a, 'b, 'c, A, B, const N: usize> Trait<'a, 'b, 'c, A, B, N> for XX {
|
||||
reuse to_reuse::foo;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse to_reuse::bar;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
|
||||
reuse to_reuse::foo::<'a, 'c, A, String, 322> as oof;
|
||||
reuse to_reuse::bar::<'a, 'c, A, B, 223> as rab;
|
||||
@@ -54,7 +55,7 @@ pub fn check() {
|
||||
mod test_2 {
|
||||
mod to_reuse {
|
||||
pub fn foo<A, B, const N: usize>() {}
|
||||
pub fn bar<A, B, const N: usize>(x: &super::X) {}
|
||||
pub fn bar<A, B, const N: usize>(_x: &super::X) {}
|
||||
}
|
||||
|
||||
trait Trait<'a, 'b, 'c, A, B, const N: usize>: Sized {
|
||||
@@ -67,9 +68,7 @@ fn rab(&self) {}
|
||||
struct X;
|
||||
impl<'a, A, B, const N: usize> Trait<'a, 'static, 'static, A, B, N> for X {
|
||||
reuse to_reuse::foo;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse to_reuse::bar;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
|
||||
reuse to_reuse::foo::<A, String, 322> as oof;
|
||||
reuse to_reuse::bar::<i32, B, 223> as rab;
|
||||
@@ -88,7 +87,7 @@ pub fn check() {
|
||||
mod test_3 {
|
||||
mod to_reuse {
|
||||
pub fn foo() {}
|
||||
pub fn bar(x: &super::X) {}
|
||||
pub fn bar(_x: &super::X) {}
|
||||
}
|
||||
|
||||
trait Trait<'a, 'b, 'c, A, B, const N: usize>: Sized {
|
||||
@@ -113,7 +112,7 @@ pub fn check() {
|
||||
mod test_4 {
|
||||
mod to_reuse {
|
||||
pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
|
||||
pub fn bar<'a: 'a, 'b: 'b, A, B, const N: usize>(x: &super::X) {}
|
||||
pub fn bar<'a: 'a, 'b: 'b, A, B, const N: usize>(_x: &super::X) {}
|
||||
}
|
||||
|
||||
trait Trait<A, B, const N: usize>: Sized {
|
||||
@@ -126,9 +125,7 @@ fn rab(&self) {}
|
||||
struct X;
|
||||
impl<'a, 'c, A, B, const N: usize> Trait<A, B, N> for X {
|
||||
reuse to_reuse::foo;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse to_reuse::bar;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
|
||||
reuse to_reuse::foo::<'a, 'c, A, String, 322> as oof;
|
||||
reuse to_reuse::bar::<'a, 'c, i32, B, 223> as rab;
|
||||
@@ -147,23 +144,25 @@ pub fn check() {
|
||||
mod test_5 {
|
||||
mod to_reuse {
|
||||
pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
|
||||
pub fn bar<'a: 'a, 'b: 'b, A, B, const N: usize>(x: &super::X::<A, B>) {}
|
||||
pub fn bar<'a: 'a, 'b: 'b, A, B, const N: usize>(_x: &super::X::<A, B>) {}
|
||||
}
|
||||
|
||||
trait Trait: Sized {
|
||||
fn foo<'x: 'x, 'y: 'y, AA, BB, const NN: usize>() {}
|
||||
fn bar<'x: 'x, 'y: 'y, AA, BB, const NN: usize>(&self) {}
|
||||
fn oof() {}
|
||||
fn rab(&self) {}
|
||||
}
|
||||
|
||||
struct X<A, B>(A, B);
|
||||
impl<'a, 'c, A, B> Trait for X<A, B> {
|
||||
reuse to_reuse::foo;
|
||||
|
||||
reuse to_reuse::foo::<'a, 'c, A, B, 322> as oof;
|
||||
reuse to_reuse::bar::<'a, 'c, A, B, 223> as rab;
|
||||
}
|
||||
|
||||
pub fn check() {
|
||||
<X::<i32, i32> as Trait>::foo::<'static, 'static, i8, i16, 123>();
|
||||
<X::<i32, i32> as Trait>::oof();
|
||||
<X::<i32, i32> as Trait>::rab(&X(1, 2));
|
||||
}
|
||||
@@ -174,7 +173,7 @@ pub fn check() {
|
||||
mod test_6 {
|
||||
mod to_reuse {
|
||||
pub fn foo<A, B, const N: usize>() {}
|
||||
pub fn bar<A, B, const N: usize>(x: &super::X) {}
|
||||
pub fn bar<A, B, const N: usize>(_x: &super::X) {}
|
||||
}
|
||||
|
||||
trait Trait<A, B, const N: usize>: Sized {
|
||||
@@ -187,9 +186,7 @@ fn rab(&self) {}
|
||||
struct X;
|
||||
impl<'a, 'c, A, B, const N: usize> Trait<A, B, N> for X {
|
||||
reuse to_reuse::foo;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse to_reuse::bar;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
|
||||
reuse to_reuse::foo::<A, String, 322> as oof;
|
||||
reuse to_reuse::bar::<i32, B, 223> as rab;
|
||||
@@ -208,7 +205,7 @@ pub fn check() {
|
||||
mod test_7 {
|
||||
mod to_reuse {
|
||||
pub fn foo() {}
|
||||
pub fn bar(x: &super::X) {}
|
||||
pub fn bar(_x: &super::X) {}
|
||||
}
|
||||
|
||||
trait Trait<A, B, const N: usize>: Sized {
|
||||
@@ -232,7 +229,7 @@ pub fn check() {
|
||||
mod test_8 {
|
||||
mod to_reuse {
|
||||
pub fn foo() {}
|
||||
pub fn bar(x: &super::X) {}
|
||||
pub fn bar(_x: &super::X) {}
|
||||
}
|
||||
|
||||
trait Trait: Sized {
|
||||
@@ -1,131 +0,0 @@
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/impl-trait-to-free.rs:31:25
|
||||
|
|
||||
LL | reuse to_reuse::foo;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::to_reuse::foo`
|
||||
--> $DIR/impl-trait-to-free.rs:15:42
|
||||
|
|
||||
LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse to_reuse::foo::<A, B, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/impl-trait-to-free.rs:33:25
|
||||
|
|
||||
LL | reuse to_reuse::bar;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::to_reuse::bar`
|
||||
--> $DIR/impl-trait-to-free.rs:16:42
|
||||
|
|
||||
LL | pub fn bar<'a: 'a, 'b: 'b, A, B, const N: usize>(x: &super::XX) {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `bar`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse to_reuse::bar::<A, B, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/impl-trait-to-free.rs:69:25
|
||||
|
|
||||
LL | reuse to_reuse::foo;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::to_reuse::foo`
|
||||
--> $DIR/impl-trait-to-free.rs:56:26
|
||||
|
|
||||
LL | pub fn foo<A, B, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse to_reuse::foo::<A, B, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/impl-trait-to-free.rs:71:25
|
||||
|
|
||||
LL | reuse to_reuse::bar;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::to_reuse::bar`
|
||||
--> $DIR/impl-trait-to-free.rs:57:26
|
||||
|
|
||||
LL | pub fn bar<A, B, const N: usize>(x: &super::X) {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `bar`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse to_reuse::bar::<A, B, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/impl-trait-to-free.rs:128:25
|
||||
|
|
||||
LL | reuse to_reuse::foo;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::to_reuse::foo`
|
||||
--> $DIR/impl-trait-to-free.rs:115:42
|
||||
|
|
||||
LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse to_reuse::foo::<A, B, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/impl-trait-to-free.rs:130:25
|
||||
|
|
||||
LL | reuse to_reuse::bar;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::to_reuse::bar`
|
||||
--> $DIR/impl-trait-to-free.rs:116:42
|
||||
|
|
||||
LL | pub fn bar<'a: 'a, 'b: 'b, A, B, const N: usize>(x: &super::X) {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `bar`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse to_reuse::bar::<A, B, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/impl-trait-to-free.rs:189:25
|
||||
|
|
||||
LL | reuse to_reuse::foo;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_6::to_reuse::foo`
|
||||
--> $DIR/impl-trait-to-free.rs:176:26
|
||||
|
|
||||
LL | pub fn foo<A, B, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse to_reuse::foo::<A, B, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/impl-trait-to-free.rs:191:25
|
||||
|
|
||||
LL | reuse to_reuse::bar;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_6::to_reuse::bar`
|
||||
--> $DIR/impl-trait-to-free.rs:177:26
|
||||
|
|
||||
LL | pub fn bar<A, B, const N: usize>(x: &super::X) {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `bar`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse to_reuse::bar::<A, B, N>;
|
||||
| +++++++++++
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0284`.
|
||||
+11
-3
@@ -1,3 +1,5 @@
|
||||
//@ run-pass
|
||||
|
||||
#![feature(fn_delegation)]
|
||||
#![allow(incomplete_features)]
|
||||
#![allow(late_bound_lifetime_arguments)]
|
||||
@@ -26,11 +28,11 @@ fn foo<U>(&self)
|
||||
struct F;
|
||||
impl<T> Trait1<T> for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B);
|
||||
|
||||
impl<'a, 'b, 'c, T, A, B> Trait1<T> for S<'a, 'b, 'c, A, B> {
|
||||
reuse Trait1::<T>::foo { &self.0 }
|
||||
//~^ ERROR: type annotations needed [E0283]
|
||||
}
|
||||
|
||||
impl Trait0 for u16 {}
|
||||
@@ -51,6 +53,7 @@ fn foo(&self) {}
|
||||
struct F;
|
||||
impl Trait for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B, const C: bool>(F, &'a A, &'b B, &'c B);
|
||||
|
||||
impl<'a, 'b, 'c, A, B, const C: bool> Trait for S<'a, 'b, 'c, A, B, C> {
|
||||
@@ -73,6 +76,7 @@ fn foo(&self) {}
|
||||
struct F;
|
||||
impl<'a, 'b, 'c, X, Y, Z> Trait<'a, 'b, 'c, X, Y, Z> for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B, const C: bool>(F, &'a A, &'b B, &'c B);
|
||||
|
||||
impl<'a, 'b, 'c, A, B, const C: bool> Trait<'a, 'b, 'static, A, String, bool>
|
||||
@@ -97,12 +101,12 @@ fn foo<'x: 'x, 'y: 'y, 'z: 'z, A, B, C, const XX: usize>(&self) {}
|
||||
struct F;
|
||||
impl<'a, 'b, 'c, X, Y, Z> Trait<'a, 'b, 'c, X, Y, Z> for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B, const C: bool>(F, &'a A, &'b B, &'c B);
|
||||
|
||||
impl<'a, 'b, 'c, A, B, const C: bool> Trait<'a, 'b, 'static, A, String, bool>
|
||||
for S<'a, 'b, 'c, A, B, C> {
|
||||
reuse Trait::<'a, 'b, 'static, A, String, bool>::foo { &self.0 }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
}
|
||||
|
||||
pub fn check() {
|
||||
@@ -123,6 +127,7 @@ fn foo<'a: 'a, 'b: 'b, 'c: 'c>(&self) {}
|
||||
struct F;
|
||||
impl<X, Y, Z> Trait<X, Y, Z> for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B, const C: bool>(F, &'a A, &'b B, &'c B);
|
||||
|
||||
impl<'a, 'b, 'c, A, B, const C: bool> Trait<A, String, bool> for S<'a, 'b, 'c, A, B, C> {
|
||||
@@ -147,11 +152,11 @@ fn foo<A, B, C>(&self) {}
|
||||
struct F;
|
||||
impl<X, Y, Z> Trait<X, Y, Z> for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B, const C: bool>(F, &'a A, &'b B, &'c B);
|
||||
|
||||
impl<'a, 'b, 'c, A, B, const C: bool> Trait<A, String, bool> for S<'a, 'b, 'c, A, B, C> {
|
||||
reuse Trait::<A, String, bool>::foo { &self.0 }
|
||||
//~^ ERROR: type annotations needed [E0282]
|
||||
}
|
||||
|
||||
pub fn check() {
|
||||
@@ -170,6 +175,7 @@ fn foo(&self) {}
|
||||
struct F;
|
||||
impl<X, Y, Z> Trait<X, Y, Z> for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B, const C: bool>(F, &'a A, &'b B, &'c B);
|
||||
|
||||
impl<'a, 'b, 'c, A, B, const C: bool> Trait<A, String, bool> for S<'a, 'b, 'c, A, B, C> {
|
||||
@@ -192,6 +198,7 @@ fn foo(&self) {}
|
||||
struct F;
|
||||
impl<'a, 'b, 'c> Trait<'a, 'b, 'c> for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B, const C: bool>(F, &'a A, &'b B, &'c B);
|
||||
|
||||
impl<'a, 'b, 'c, A, B, const C: bool> Trait<'a, 'b, 'c> for S<'a, 'b, 'c, A, B, C> {
|
||||
@@ -214,6 +221,7 @@ fn foo<'x: 'x, 'y: 'y>(&self) {}
|
||||
struct F;
|
||||
impl<'a, 'b, 'c> Trait<'a, 'b, 'c> for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B, const C: bool>(F, &'a A, &'b B, &'c B);
|
||||
|
||||
impl<'a, 'b, 'c, A, B, const C: bool> Trait<'a, 'b, 'c> for S<'a, 'b, 'c, A, B, C> {
|
||||
@@ -1,43 +0,0 @@
|
||||
error[E0283]: type annotations needed
|
||||
--> $DIR/impl-trait-to-trait.rs:32:28
|
||||
|
|
||||
LL | reuse Trait1::<T>::foo { &self.0 }
|
||||
| ^^^ cannot infer type of the type parameter `U` declared on the method `foo`
|
||||
|
|
||||
= note: cannot satisfy `_: Trait0`
|
||||
help: the trait `Trait0` is implemented for `u16`
|
||||
--> $DIR/impl-trait-to-trait.rs:36:5
|
||||
|
|
||||
LL | impl Trait0 for u16 {}
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
note: required by a bound in `Trait1::foo`
|
||||
--> $DIR/impl-trait-to-trait.rs:21:16
|
||||
|
|
||||
LL | fn foo<U>(&self)
|
||||
| --- required by a bound in this associated function
|
||||
...
|
||||
LL | U: Trait0,
|
||||
| ^^^^^^ required by this bound in `Trait1::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/impl-trait-to-trait.rs:104:58
|
||||
|
|
||||
LL | reuse Trait::<'a, 'b, 'static, A, String, bool>::foo { &self.0 }
|
||||
| ^^^ cannot infer the value of the const parameter `XX` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait::foo`
|
||||
--> $DIR/impl-trait-to-trait.rs:94:49
|
||||
|
|
||||
LL | fn foo<'x: 'x, 'y: 'y, 'z: 'z, A, B, C, const XX: usize>(&self) {}
|
||||
| ^^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/impl-trait-to-trait.rs:153:41
|
||||
|
|
||||
LL | reuse Trait::<A, String, bool>::foo { &self.0 }
|
||||
| ^^^ cannot infer type of the type parameter `A` declared on the method `foo`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0282, E0283, E0284.
|
||||
For more information about an error, try `rustc --explain E0282`.
|
||||
+8
-12
@@ -1,3 +1,5 @@
|
||||
//@ run-pass
|
||||
|
||||
#![feature(fn_delegation)]
|
||||
#![allow(incomplete_features)]
|
||||
#![allow(late_bound_lifetime_arguments)]
|
||||
@@ -16,24 +18,23 @@ mod to_reuse {
|
||||
pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
|
||||
}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct X1<'a, 'b, T, X, const N: usize>(&'a T, &'b X, &'a [i32; N]);
|
||||
impl<'a, 'b, T, E, const N: usize> X1<'a, 'b, T, E, N> {
|
||||
reuse to_reuse::foo;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse to_reuse::foo::<'static, 'static, i32, String, 1> as bar;
|
||||
}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct X2<T, X, const N: usize>(T, X, &'static [i32; N]);
|
||||
impl<T, E, const N: usize> X2<T, E, N> {
|
||||
reuse to_reuse::foo;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse to_reuse::foo::<'static, 'static, i32, String, 1> as bar;
|
||||
}
|
||||
|
||||
struct X3;
|
||||
impl X3 {
|
||||
reuse to_reuse::foo;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse to_reuse::foo::<'static, 'static, i32, String, 1> as bar;
|
||||
}
|
||||
|
||||
@@ -41,15 +42,12 @@ pub fn check() {
|
||||
X1::<'static, 'static, i32, i32, 1>
|
||||
::foo::<'static, 'static, String, String, 123>();
|
||||
X1::<'static, 'static, i32, i32, 1>::bar();
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
|
||||
X2::<i32, i32, 1>::foo::<'static, 'static, String, String, 123>();
|
||||
X2::<i32, i32, 1>::bar();
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
|
||||
X3::foo::<'static, 'static, String, String, 123>();
|
||||
X3::bar();
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,39 +56,35 @@ pub fn check() {
|
||||
mod test_2 {
|
||||
fn foo<A, B, const N: usize>() {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct X1<'a, 'b, T, X, const N: usize>(&'a T, &'b X, &'a [i32; N]);
|
||||
impl<'a, 'b, T, E, const N: usize> X1<'a, 'b, T, E, N> {
|
||||
reuse foo;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse foo::<i32, String, 1> as bar;
|
||||
}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct X2<T, X, const N: usize>(T, X, &'static [i32; N]);
|
||||
impl<T, E, const N: usize> X2<T, E, N> {
|
||||
reuse foo;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse foo::<i32, String, 1> as bar;
|
||||
}
|
||||
|
||||
struct X3;
|
||||
impl X3 {
|
||||
reuse foo;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse foo::<i32, String, 1> as bar;
|
||||
}
|
||||
|
||||
pub fn check() {
|
||||
X1::<'static, 'static, i32, i32, 1>::foo::<String, String, 123>();
|
||||
X1::<'static, 'static, i32, i32, 1>::bar();
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
|
||||
X2::<i32, i32, 1>::foo::<String, String, 123>();
|
||||
X2::<i32, i32, 1>::bar();
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
|
||||
X3::foo::<String, String, 123>();
|
||||
X3::bar();
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,11 +93,13 @@ pub fn check() {
|
||||
mod test_3 {
|
||||
fn foo() {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct X1<'a, 'b, T, X, const N: usize>(&'a T, &'b X, &'a [i32; N]);
|
||||
impl<'a, 'b, T, E, const N: usize> X1<'a, 'b, T, E, N> {
|
||||
reuse foo;
|
||||
}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct X2<T, X, const N: usize>(T, X, &'static [i32; N]);
|
||||
impl<T, E, const N: usize> X2<T, E, N> {
|
||||
reuse foo;
|
||||
@@ -1,213 +0,0 @@
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-free.rs:21:25
|
||||
|
|
||||
LL | reuse to_reuse::foo;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `to_reuse::foo`
|
||||
--> $DIR/inherent-impl-to-free.rs:16:42
|
||||
|
|
||||
LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse to_reuse::foo::<A, B, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-free.rs:28:25
|
||||
|
|
||||
LL | reuse to_reuse::foo;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `to_reuse::foo`
|
||||
--> $DIR/inherent-impl-to-free.rs:16:42
|
||||
|
|
||||
LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse to_reuse::foo::<A, B, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-free.rs:35:25
|
||||
|
|
||||
LL | reuse to_reuse::foo;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `to_reuse::foo`
|
||||
--> $DIR/inherent-impl-to-free.rs:16:42
|
||||
|
|
||||
LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse to_reuse::foo::<A, B, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-free.rs:43:9
|
||||
|
|
||||
LL | X1::<'static, 'static, i32, i32, 1>::bar();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::X1::<'a, 'b, T, E, N>::bar`
|
||||
--> $DIR/inherent-impl-to-free.rs:16:42
|
||||
|
|
||||
LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `X1::<'a, 'b, T, E, N>::bar`
|
||||
...
|
||||
LL | reuse to_reuse::foo::<'static, 'static, i32, String, 1> as bar;
|
||||
| --- required by a bound in this associated function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | X1::<'static, 'static, i32, i32, 1>::bar::<A, B, N>();
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-free.rs:47:9
|
||||
|
|
||||
LL | X2::<i32, i32, 1>::bar();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::X2::<T, E, N>::bar`
|
||||
--> $DIR/inherent-impl-to-free.rs:16:42
|
||||
|
|
||||
LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `X2::<T, E, N>::bar`
|
||||
...
|
||||
LL | reuse to_reuse::foo::<'static, 'static, i32, String, 1> as bar;
|
||||
| --- required by a bound in this associated function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | X2::<i32, i32, 1>::bar::<A, B, N>();
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-free.rs:51:9
|
||||
|
|
||||
LL | X3::bar();
|
||||
| ^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::X3::bar`
|
||||
--> $DIR/inherent-impl-to-free.rs:16:42
|
||||
|
|
||||
LL | pub fn foo<'a: 'a, 'b: 'b, A, B, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `X3::bar`
|
||||
...
|
||||
LL | reuse to_reuse::foo::<'static, 'static, i32, String, 1> as bar;
|
||||
| --- required by a bound in this associated function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | X3::bar::<A, B, N>();
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-free.rs:63:15
|
||||
|
|
||||
LL | reuse foo;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::foo`
|
||||
--> $DIR/inherent-impl-to-free.rs:59:18
|
||||
|
|
||||
LL | fn foo<A, B, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse foo::<A, B, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-free.rs:70:15
|
||||
|
|
||||
LL | reuse foo;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::foo`
|
||||
--> $DIR/inherent-impl-to-free.rs:59:18
|
||||
|
|
||||
LL | fn foo<A, B, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse foo::<A, B, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-free.rs:77:15
|
||||
|
|
||||
LL | reuse foo;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::foo`
|
||||
--> $DIR/inherent-impl-to-free.rs:59:18
|
||||
|
|
||||
LL | fn foo<A, B, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse foo::<A, B, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-free.rs:84:9
|
||||
|
|
||||
LL | X1::<'static, 'static, i32, i32, 1>::bar();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::X1::<'a, 'b, T, E, N>::bar`
|
||||
--> $DIR/inherent-impl-to-free.rs:59:18
|
||||
|
|
||||
LL | fn foo<A, B, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `X1::<'a, 'b, T, E, N>::bar`
|
||||
...
|
||||
LL | reuse foo::<i32, String, 1> as bar;
|
||||
| --- required by a bound in this associated function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | X1::<'static, 'static, i32, i32, 1>::bar::<A, B, N>();
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-free.rs:88:9
|
||||
|
|
||||
LL | X2::<i32, i32, 1>::bar();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::X2::<T, E, N>::bar`
|
||||
--> $DIR/inherent-impl-to-free.rs:59:18
|
||||
|
|
||||
LL | fn foo<A, B, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `X2::<T, E, N>::bar`
|
||||
...
|
||||
LL | reuse foo::<i32, String, 1> as bar;
|
||||
| --- required by a bound in this associated function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | X2::<i32, i32, 1>::bar::<A, B, N>();
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-free.rs:92:9
|
||||
|
|
||||
LL | X3::bar();
|
||||
| ^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::X3::bar`
|
||||
--> $DIR/inherent-impl-to-free.rs:59:18
|
||||
|
|
||||
LL | fn foo<A, B, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `X3::bar`
|
||||
...
|
||||
LL | reuse foo::<i32, String, 1> as bar;
|
||||
| --- required by a bound in this associated function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | X3::bar::<A, B, N>();
|
||||
| +++++++++++
|
||||
|
||||
error: aborting due to 12 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0284`.
|
||||
+11
-7
@@ -1,3 +1,5 @@
|
||||
//@ run-pass
|
||||
|
||||
#![feature(fn_delegation)]
|
||||
#![allow(incomplete_features)]
|
||||
#![allow(late_bound_lifetime_arguments)]
|
||||
@@ -19,6 +21,7 @@ fn foo(&self) {}
|
||||
struct F;
|
||||
impl<T: ToString> Trait<T> for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B);
|
||||
impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> {
|
||||
reuse Trait::<String>::foo { &self.0 }
|
||||
@@ -27,7 +30,6 @@ impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> {
|
||||
pub fn check() {
|
||||
let s = S(F, &123, &123, &123);
|
||||
S::<'static, 'static, 'static, i32, i32>::foo(&s);
|
||||
//~^ ERROR: type annotations needed [E0283]
|
||||
s.foo();
|
||||
}
|
||||
}
|
||||
@@ -42,6 +44,7 @@ fn foo(&self) {}
|
||||
struct F;
|
||||
impl<'x, 'y, T, const B: bool> Trait<'x, 'y, T, B> for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B);
|
||||
impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> {
|
||||
reuse Trait::<'a, 'b, String, true>::foo { &self.0 }
|
||||
@@ -50,9 +53,7 @@ impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> {
|
||||
pub fn check() {
|
||||
let s = S(F, &123, &123, &123);
|
||||
S::<'static, 'static, 'static, i32, i32>::foo(&s);
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
s.foo();
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +67,7 @@ fn foo(&self) {}
|
||||
struct F;
|
||||
impl<'x, 'y> Trait<'x, 'y> for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B);
|
||||
impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> {
|
||||
reuse Trait::<'a, 'b>::foo { &self.0 }
|
||||
@@ -88,6 +90,7 @@ fn foo(&self) {}
|
||||
struct F;
|
||||
impl Trait for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B);
|
||||
impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> {
|
||||
reuse Trait::foo { &self.0 }
|
||||
@@ -110,6 +113,7 @@ fn foo<'a: 'a, 'b: 'b>(&self) {}
|
||||
struct F;
|
||||
impl Trait for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B);
|
||||
impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> {
|
||||
reuse Trait::foo::<'a, 'b> { &self.0 }
|
||||
@@ -132,6 +136,7 @@ fn foo<'a: 'a, 'b: 'b, A, B, C>(&self) {}
|
||||
struct F;
|
||||
impl Trait for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B);
|
||||
impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> {
|
||||
reuse Trait::foo::<'a, 'b, A, B, String> { &self.0 }
|
||||
@@ -140,7 +145,6 @@ impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> {
|
||||
pub fn check() {
|
||||
let s = S(F, &123, &123, &123);
|
||||
S::<'static, 'static, 'static, i32, i32>::foo(&s);
|
||||
//~^ ERROR: type annotations needed [E0282]
|
||||
s.foo();
|
||||
}
|
||||
}
|
||||
@@ -155,6 +159,7 @@ fn foo<'a: 'a, 'b: 'b, A, B, C>(&self) {}
|
||||
struct F;
|
||||
impl<'a, 'b, 'c> Trait<'a, 'b, 'c> for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B);
|
||||
impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> {
|
||||
reuse Trait::<'a, 'b, 'c>::foo::<'a, 'b, A, B, String> { &self.0 }
|
||||
@@ -163,7 +168,6 @@ impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> {
|
||||
pub fn check() {
|
||||
let s = S(F, &123, &123, &123);
|
||||
S::<'static, 'static, 'static, i32, i32>::foo(&s);
|
||||
//~^ ERROR: type annotations needed [E0282]
|
||||
s.foo();
|
||||
}
|
||||
}
|
||||
@@ -178,6 +182,7 @@ fn foo<'a: 'a, 'b: 'b, A, B, C>(&self) {}
|
||||
struct F;
|
||||
impl<'a, 'b, 'c, X, Y, Z> Trait<'a, 'b, 'c, X, Y, Z> for F {}
|
||||
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B);
|
||||
impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> {
|
||||
reuse Trait::<'a, 'b, 'c, B, A, i32>::foo::<'a, 'b, A, B, String> { &self.0 }
|
||||
@@ -186,7 +191,6 @@ impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> {
|
||||
pub fn check() {
|
||||
let s = S(F, &123, &123, &123);
|
||||
S::<'static, 'static, 'static, i32, i32>::foo(&s);
|
||||
//~^ ERROR: type annotations needed [E0282]
|
||||
s.foo();
|
||||
}
|
||||
}
|
||||
@@ -203,6 +207,7 @@ fn foo<'a: 'a, 'b: 'b, A, B, C>(&self) {}
|
||||
impl<'a, 'b, 'c, X, Y, Z> Trait<'a, 'b, 'c, X, Y, Z> for F {}
|
||||
|
||||
pub fn check<T, U>() {
|
||||
#[allow(dead_code)] // Fields are used instead of phantom data for generics use
|
||||
struct S<'a, 'b, 'c, A, B>(F, &'a A, &'b B, &'c B);
|
||||
impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> {
|
||||
reuse Trait::<'a, 'b, 'c, B, A, i32>::foo::<'a, 'b, A, B, String> { &self.0 }
|
||||
@@ -210,7 +215,6 @@ impl<'a, 'b, 'c, A, B> S<'a, 'b, 'c, A, B> {
|
||||
|
||||
let s = S(F, &123, &123, &123);
|
||||
S::<'static, 'static, 'static, i32, i32>::foo(&s);
|
||||
//~^ ERROR: type annotations needed [E0282]
|
||||
s.foo();
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
error[E0283]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-trait.rs:29:9
|
||||
|
|
||||
LL | S::<'static, 'static, 'static, i32, i32>::foo(&s);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the method `foo`
|
||||
|
|
||||
= note: cannot satisfy `_: ToString`
|
||||
note: required by a bound in `test_1::S::<'a, 'b, 'c, A, B>::foo`
|
||||
--> $DIR/inherent-impl-to-trait.rs:15:20
|
||||
|
|
||||
LL | trait Trait<T: ToString> {
|
||||
| ^^^^^^^^ required by this bound in `S::<'a, 'b, 'c, A, B>::foo`
|
||||
...
|
||||
LL | reuse Trait::<String>::foo { &self.0 }
|
||||
| --- required by a bound in this associated function
|
||||
help: consider specifying the generic argument
|
||||
|
|
||||
LL | S::<'static, 'static, 'static, i32, i32>::foo::<T>(&s);
|
||||
| +++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-trait.rs:52:9
|
||||
|
|
||||
LL | S::<'static, 'static, 'static, i32, i32>::foo(&s);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `B` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::S::<'a, 'b, 'c, A, B>::foo`
|
||||
--> $DIR/inherent-impl-to-trait.rs:38:28
|
||||
|
|
||||
LL | trait Trait<'x, 'y, T, const B: bool> {
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `S::<'a, 'b, 'c, A, B>::foo`
|
||||
...
|
||||
LL | reuse Trait::<'a, 'b, String, true>::foo { &self.0 }
|
||||
| --- required by a bound in this associated function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | S::<'static, 'static, 'static, i32, i32>::foo::<T, B>(&s);
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-trait.rs:54:11
|
||||
|
|
||||
LL | s.foo();
|
||||
| ^^^ cannot infer the value of the const parameter `B` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::S::<'a, 'b, 'c, A, B>::foo`
|
||||
--> $DIR/inherent-impl-to-trait.rs:38:28
|
||||
|
|
||||
LL | trait Trait<'x, 'y, T, const B: bool> {
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `S::<'a, 'b, 'c, A, B>::foo`
|
||||
...
|
||||
LL | reuse Trait::<'a, 'b, String, true>::foo { &self.0 }
|
||||
| --- required by a bound in this associated function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | s.foo::<T, B>();
|
||||
| ++++++++
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-trait.rs:142:9
|
||||
|
|
||||
LL | S::<'static, 'static, 'static, i32, i32>::foo(&s);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `A` declared on the method `foo`
|
||||
|
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | S::<'static, 'static, 'static, i32, i32>::foo::<A, B, C>(&s);
|
||||
| +++++++++++
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-trait.rs:165:9
|
||||
|
|
||||
LL | S::<'static, 'static, 'static, i32, i32>::foo(&s);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `A` declared on the method `foo`
|
||||
|
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | S::<'static, 'static, 'static, i32, i32>::foo::<A, B, C>(&s);
|
||||
| +++++++++++
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-trait.rs:188:9
|
||||
|
|
||||
LL | S::<'static, 'static, 'static, i32, i32>::foo(&s);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `X` declared on the method `foo`
|
||||
|
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | S::<'static, 'static, 'static, i32, i32>::foo::<X, Y, Z, A, B, C>(&s);
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/inherent-impl-to-trait.rs:212:9
|
||||
|
|
||||
LL | S::<'static, 'static, 'static, i32, i32>::foo(&s);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `X` declared on the method `foo`
|
||||
|
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | S::<'static, 'static, 'static, i32, i32>::foo::<X, Y, Z, A, B, C>(&s);
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0282, E0283, E0284.
|
||||
For more information about an error, try `rustc --explain E0282`.
|
||||
+2
-10
@@ -1,3 +1,5 @@
|
||||
//@ run-pass
|
||||
|
||||
#![feature(fn_delegation)]
|
||||
#![allow(incomplete_features)]
|
||||
#![allow(late_bound_lifetime_arguments)]
|
||||
@@ -15,7 +17,6 @@ fn foo<'a: 'a, 'b: 'b, T: Clone + ToString, U: Clone, const N: usize>() {}
|
||||
|
||||
trait Trait<'a, A, B, C, const N: usize> {
|
||||
reuse foo;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse foo::<'static, 'static, i32, String, 1> as bar;
|
||||
}
|
||||
|
||||
@@ -23,7 +24,6 @@ impl Trait<'static, i32, i32, i32, 1> for u32 {}
|
||||
pub fn check() {
|
||||
<u32 as Trait<'static, i32, i32, i32, 1>>::foo::<'static, 'static, i32, String, 1>();
|
||||
<u32 as Trait<'static, i32, i32, i32, 1>>::bar();
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ fn foo<T: Clone, U: Clone, const N: usize>() {}
|
||||
|
||||
trait Trait<'a, A, B, C, const N: usize> {
|
||||
reuse foo;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse foo::<i32, String, 1> as bar;
|
||||
}
|
||||
|
||||
@@ -42,7 +41,6 @@ impl Trait<'static, i32, i32, i32, 1> for u32 {}
|
||||
pub fn check() {
|
||||
<u32 as Trait<'static, i32, i32, i32, 1>>::foo::<i32, String, 1>();
|
||||
<u32 as Trait<'static, i32, i32, i32, 1>>::bar();
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +66,6 @@ fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
|
||||
trait Trait<A, B, C, const N: usize> {
|
||||
reuse foo;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse foo::<'static, 'static, i32, String, 1> as bar;
|
||||
}
|
||||
|
||||
@@ -76,7 +73,6 @@ impl Trait<i32, i32, i32, 1> for u32 {}
|
||||
pub fn check() {
|
||||
<u32 as Trait<i32, i32, i32, 1>>::foo::<'static, 'static, i32, String, 1>();
|
||||
<u32 as Trait<i32, i32, i32, 1>>::bar();
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +83,6 @@ fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
|
||||
trait Trait {
|
||||
reuse foo;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse foo::<'static, 'static, i32, String, 1> as bar;
|
||||
}
|
||||
|
||||
@@ -95,7 +90,6 @@ impl Trait for u32 {}
|
||||
pub fn check() {
|
||||
<u32 as Trait>::foo::<'static, 'static, i32, String, 1>();
|
||||
<u32 as Trait>::bar();
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +99,6 @@ fn foo<T: Clone, U: Clone, const N: usize>() {}
|
||||
|
||||
trait Trait {
|
||||
reuse foo;
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse foo::<i32, String, 1> as bar;
|
||||
}
|
||||
|
||||
@@ -113,7 +106,6 @@ impl Trait for u32 {}
|
||||
pub fn check() {
|
||||
<u32 as Trait>::foo::<i32, String, 1>();
|
||||
<u32 as Trait>::bar();
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-free.rs:17:15
|
||||
|
|
||||
LL | reuse foo;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::foo`
|
||||
--> $DIR/trait-to-free.rs:14:59
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone + ToString, U: Clone, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse foo::<T, U, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-free.rs:25:9
|
||||
|
|
||||
LL | <u32 as Trait<'static, i32, i32, i32, 1>>::bar();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::Trait::bar`
|
||||
--> $DIR/trait-to-free.rs:14:59
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone + ToString, U: Clone, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::bar`
|
||||
...
|
||||
LL | reuse foo::<'static, 'static, i32, String, 1> as bar;
|
||||
| --- required by a bound in this associated function
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-free.rs:36:15
|
||||
|
|
||||
LL | reuse foo;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::foo`
|
||||
--> $DIR/trait-to-free.rs:33:32
|
||||
|
|
||||
LL | fn foo<T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse foo::<T, U, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-free.rs:44:9
|
||||
|
|
||||
LL | <u32 as Trait<'static, i32, i32, i32, 1>>::bar();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::Trait::bar`
|
||||
--> $DIR/trait-to-free.rs:33:32
|
||||
|
|
||||
LL | fn foo<T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::bar`
|
||||
...
|
||||
LL | reuse foo::<i32, String, 1> as bar;
|
||||
| --- required by a bound in this associated function
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-free.rs:70:15
|
||||
|
|
||||
LL | reuse foo;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::foo`
|
||||
--> $DIR/trait-to-free.rs:67:48
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse foo::<T, U, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-free.rs:78:9
|
||||
|
|
||||
LL | <u32 as Trait<i32, i32, i32, 1>>::bar();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait::bar`
|
||||
--> $DIR/trait-to-free.rs:67:48
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::bar`
|
||||
...
|
||||
LL | reuse foo::<'static, 'static, i32, String, 1> as bar;
|
||||
| --- required by a bound in this associated function
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-free.rs:89:15
|
||||
|
|
||||
LL | reuse foo;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_5::foo`
|
||||
--> $DIR/trait-to-free.rs:86:48
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse foo::<T, U, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-free.rs:97:9
|
||||
|
|
||||
LL | <u32 as Trait>::bar();
|
||||
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_5::Trait::bar`
|
||||
--> $DIR/trait-to-free.rs:86:48
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b, T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::bar`
|
||||
...
|
||||
LL | reuse foo::<'static, 'static, i32, String, 1> as bar;
|
||||
| --- required by a bound in this associated function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | <u32 as Trait>::bar::<T, U, N>();
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-free.rs:107:15
|
||||
|
|
||||
LL | reuse foo;
|
||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_6::foo`
|
||||
--> $DIR/trait-to-free.rs:104:32
|
||||
|
|
||||
LL | fn foo<T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse foo::<T, U, N>;
|
||||
| +++++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-free.rs:115:9
|
||||
|
|
||||
LL | <u32 as Trait>::bar();
|
||||
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the associated function `bar`
|
||||
|
|
||||
note: required by a const generic parameter in `test_6::Trait::bar`
|
||||
--> $DIR/trait-to-free.rs:104:32
|
||||
|
|
||||
LL | fn foo<T: Clone, U: Clone, const N: usize>() {}
|
||||
| ^^^^^^^^^^^^^^ required by this const generic parameter in `Trait::bar`
|
||||
...
|
||||
LL | reuse foo::<i32, String, 1> as bar;
|
||||
| --- required by a bound in this associated function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | <u32 as Trait>::bar::<T, U, N>();
|
||||
| +++++++++++
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0284`.
|
||||
+2
-99
@@ -1,3 +1,5 @@
|
||||
//@ run-pass
|
||||
|
||||
#![feature(fn_delegation)]
|
||||
#![allow(incomplete_features)]
|
||||
#![allow(late_bound_lifetime_arguments)]
|
||||
@@ -24,13 +26,11 @@ trait Trait2<'a, 'b, 'c, X, Y, Z> {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo::<'static, String, false> as bar2 {
|
||||
Self::get()
|
||||
}
|
||||
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo::<'static, String, false>
|
||||
as bar4 { self.get_self() }
|
||||
|
||||
@@ -47,11 +47,9 @@ trait Trait3 {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo::<'static, String, false>
|
||||
as bar2 { Self::get() }
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo::<'static, String, false>
|
||||
as bar4 { self.get_self() }
|
||||
}
|
||||
@@ -60,11 +58,9 @@ trait Trait4<'a, 'b, 'c> {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo::<'static, String, false>
|
||||
as bar2 { Self::get() }
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo::<'static, String, false>
|
||||
as bar4 { self.get_self() }
|
||||
}
|
||||
@@ -73,11 +69,9 @@ trait Trait5<X, Y, Z> {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo::<'static, String, false>
|
||||
as bar2 { Self::get() }
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo::<'static, String, false>
|
||||
as bar4 { self.get_self() }
|
||||
}
|
||||
@@ -90,17 +84,9 @@ impl<X, Y, Z> Trait5<X, Y, Z> for u32 {}
|
||||
pub fn check<'a: 'a>() {
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>
|
||||
::bar1::<'static, String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
//~| ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait3>::bar1::<'static, String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
//~| ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
//~| ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
//~| ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar2(&123);
|
||||
<u32 as Trait3>::bar2(&123);
|
||||
@@ -109,17 +95,9 @@ pub fn check<'a: 'a>() {
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>
|
||||
::bar3::<'static, String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
//~| ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait3>::bar3::<'static, String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
//~| ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
//~| ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
//~| ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar4(&123);
|
||||
<u32 as Trait3>::bar4(&123);
|
||||
@@ -144,10 +122,8 @@ trait Trait2<'a, 'b, 'c, X, Y, Z> {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::<i32>::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<i32>::foo::<'static, String, false> as bar2 { Self::get() }
|
||||
reuse Trait::<i32>::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<i32>::foo::<'static, String, false> as bar4 { self.get_self() }
|
||||
}
|
||||
|
||||
@@ -155,10 +131,8 @@ trait Trait3 {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::<i32>::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<i32>::foo::<'static, String, false> as bar2 { Self::get() }
|
||||
reuse Trait::<i32>::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<i32>::foo::<'static, String, false> as bar4 { self.get_self() }
|
||||
}
|
||||
|
||||
@@ -166,10 +140,8 @@ trait Trait4<'a, 'b, 'c> {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::<i32>::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<i32>::foo::<'static, String, false> as bar2 { Self::get() }
|
||||
reuse Trait::<i32>::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<i32>::foo::<'static, String, false> as bar4 { self.get_self() }
|
||||
}
|
||||
|
||||
@@ -177,10 +149,8 @@ trait Trait5<X, Y, Z> {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::<i32>::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<i32>::foo::<'static, String, false> as bar2 { Self::get() }
|
||||
reuse Trait::<i32>::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<i32>::foo::<'static, String, false> as bar4 { self.get_self() }
|
||||
}
|
||||
|
||||
@@ -192,13 +162,9 @@ impl<X, Y, Z> Trait5<X, Y, Z> for u32 {}
|
||||
pub fn check<'a: 'a>() {
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>
|
||||
::bar1::<'static, String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
<u32 as Trait3>::bar1::<'static, String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
<u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
<u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar2(&123);
|
||||
<u32 as Trait3>::bar2(&123);
|
||||
@@ -207,13 +173,9 @@ pub fn check<'a: 'a>() {
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>
|
||||
::bar3::<'static, String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
<u32 as Trait3>::bar3::<'static, String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
<u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
<u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar4(&123);
|
||||
<u32 as Trait3>::bar4(&123);
|
||||
@@ -238,12 +200,10 @@ trait Trait2<'a, 'b, 'c, X, Y, Z> {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static>::foo::<'static, String, false> as bar2 {
|
||||
Self::get()
|
||||
}
|
||||
reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static>::foo::<'static, String, false> as bar4 {
|
||||
self.get_self()
|
||||
}
|
||||
@@ -253,12 +213,10 @@ trait Trait3 {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static>::foo::<'static, String, false> as bar2 {
|
||||
Self::get()
|
||||
}
|
||||
reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static>::foo::<'static, String, false> as bar4 {
|
||||
self.get_self()
|
||||
}
|
||||
@@ -268,12 +226,10 @@ trait Trait4<'a, 'b, 'c> {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static>::foo::<'static, String, false> as bar2 {
|
||||
Self::get()
|
||||
}
|
||||
reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static>::foo::<'static, String, false> as bar4 {
|
||||
self.get_self()
|
||||
}
|
||||
@@ -283,11 +239,9 @@ trait Trait5<X, Y, Z> {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static>::foo::<'static, String, false>
|
||||
as bar2 { Self::get() }
|
||||
reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static>::foo::<'static, String, false>
|
||||
as bar4 { self.get_self() }
|
||||
}
|
||||
@@ -300,13 +254,9 @@ impl<X, Y, Z> Trait5<X, Y, Z> for u32 {}
|
||||
pub fn check<'a: 'a>() {
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>
|
||||
::bar1::<'static, String, true>(&123);
|
||||
//~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait3>::bar1::<'static, String, true>(&123);
|
||||
//~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123);
|
||||
//~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123);
|
||||
//~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar2(&123);
|
||||
<u32 as Trait3>::bar2(&123);
|
||||
@@ -315,13 +265,9 @@ pub fn check<'a: 'a>() {
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>
|
||||
::bar3::<'static, String, true>(&123);
|
||||
//~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait3>::bar3::<'static, String, true>(&123);
|
||||
//~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123);
|
||||
//~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123);
|
||||
//~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar4(&123);
|
||||
<u32 as Trait3>::bar4(&123);
|
||||
@@ -346,10 +292,8 @@ trait Trait2<'a, 'b, 'c, X, Y, Z> {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::foo::<'static, String, false> as bar2 { Self::get() }
|
||||
reuse Trait::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() }
|
||||
}
|
||||
|
||||
@@ -357,10 +301,8 @@ trait Trait3 {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::foo::<'static, String, false> as bar2 { Self::get() }
|
||||
reuse Trait::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() }
|
||||
}
|
||||
|
||||
@@ -368,10 +310,8 @@ trait Trait4<'a, 'b, 'c> {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::foo::<'static, String, false> as bar2 { Self::get() }
|
||||
reuse Trait::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() }
|
||||
}
|
||||
|
||||
@@ -379,10 +319,8 @@ trait Trait5<X, Y, Z> {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::foo::<'static, String, false> as bar2 { Self::get() }
|
||||
reuse Trait::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() }
|
||||
}
|
||||
|
||||
@@ -399,13 +337,9 @@ pub fn check<'a: 'a>() {
|
||||
<u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123);
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar2(&123);
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
<u32 as Trait3>::bar2(&123);
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
<u32 as Trait4<'a, 'a, 'static>>::bar2(&123);
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
<u32 as Trait5<i32, u64, String>>::bar2(&123);
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>
|
||||
::bar3::<'static, String, true>(&123);
|
||||
@@ -414,13 +348,9 @@ pub fn check<'a: 'a>() {
|
||||
<u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123);
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar4(&123);
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
<u32 as Trait3>::bar4(&123);
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
<u32 as Trait4<'a, 'a, 'static>>::bar4(&123);
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
<u32 as Trait5<i32, u64, String>>::bar4(&123);
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,12 +370,10 @@ trait Trait2<'a, 'b, 'c, X, Y, Z> {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo::<String, false> as bar2 {
|
||||
Self::get()
|
||||
}
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo::<String, false> as bar4 {
|
||||
self.get_self()
|
||||
}
|
||||
@@ -455,12 +383,10 @@ trait Trait3 {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo::<String, false> as bar2 {
|
||||
Self::get()
|
||||
}
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo::<String, false> as bar4 {
|
||||
self.get_self()
|
||||
}
|
||||
@@ -470,12 +396,10 @@ trait Trait4<'a, 'b, 'c> {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo::<String, false> as bar2 {
|
||||
Self::get()
|
||||
}
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo::<String, false> as bar4 {
|
||||
self.get_self()
|
||||
}
|
||||
@@ -485,12 +409,10 @@ trait Trait5<X, Y, Z> {
|
||||
fn get() -> &'static u8 { &0 }
|
||||
fn get_self(&self) -> &'static u8 { &0 }
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo::<String, false> as bar2 {
|
||||
Self::get()
|
||||
}
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
//~^ ERROR: type annotations needed [E0284]
|
||||
reuse Trait::<'static, 'static, 'static, i32>::foo::<String, false> as bar4 {
|
||||
self.get_self()
|
||||
}
|
||||
@@ -503,13 +425,9 @@ impl<X, Y, Z> Trait5<X, Y, Z> for u32 {}
|
||||
|
||||
pub fn check<'a: 'a>() {
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar1::<String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
<u32 as Trait3>::bar1::<String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
<u32 as Trait4<'a, 'a, 'static>>::bar1::<String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
<u32 as Trait5<i32, u64, String>>::bar1::<String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar2(&123);
|
||||
<u32 as Trait3>::bar2(&123);
|
||||
@@ -517,13 +435,9 @@ pub fn check<'a: 'a>() {
|
||||
<u32 as Trait5<i32, u64, String>>::bar2(&123);
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar3::<String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
<u32 as Trait3>::bar3::<String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
<u32 as Trait4<'a, 'a, 'static>>::bar3::<String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
<u32 as Trait5<i32, u64, String>>::bar3::<String, true>(&123);
|
||||
//~^ ERROR: method takes 3 generic arguments but 2 generic arguments were supplied [E0107]
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar4(&123);
|
||||
<u32 as Trait3>::bar4(&123);
|
||||
@@ -579,7 +493,6 @@ impl<X, Y, Z> Trait5<X, Y, Z> for u32 {}
|
||||
|
||||
pub fn check<'a: 'a>() {
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar1(&123);
|
||||
//~^ ERROR: type annotations needed [E0282]
|
||||
<u32 as Trait3>::bar1(&123);
|
||||
<u32 as Trait4<'a, 'a, 'static>>::bar1(&123);
|
||||
<u32 as Trait5<i32, u64, String>>::bar1(&123);
|
||||
@@ -638,7 +551,6 @@ impl<X, Y, Z> Trait5<X, Y, Z> for u32 {}
|
||||
|
||||
pub fn check<'a: 'a>() {
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar1(&123);
|
||||
//~^ ERROR: type annotations needed [E0282]
|
||||
<u32 as Trait3>::bar1(&123);
|
||||
<u32 as Trait4<'a, 'a, 'static>>::bar1(&123);
|
||||
<u32 as Trait5<i32, u64, String>>::bar1(&123);
|
||||
@@ -763,7 +675,6 @@ impl<X, Y, Z> Trait5<X, Y, Z> for u32 {}
|
||||
|
||||
pub fn check<'a: 'a>() {
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>
|
||||
//~^ ERROR: type annotations needed [E0282]
|
||||
::bar1::<'static, 'static>(&123);
|
||||
<u32 as Trait3>::bar1::<'static, 'static>(&123);
|
||||
<u32 as Trait4<'a, 'a, 'static>>::bar1::<'a, 'a>(&123);
|
||||
@@ -851,13 +762,9 @@ impl<X, Y, Z> Trait5<X, Y, Z> for u32 {}
|
||||
pub fn check<'a: 'a>() {
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>
|
||||
::bar1::<'static, 'static>(&123);
|
||||
//~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait3>::bar1::<'static, 'static>(&123);
|
||||
//~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait4<'a, 'a, 'static>>::bar1::<'a, 'a>(&123);
|
||||
//~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait5<i32, u64, String>>::bar1::<'a, 'a>(&123);
|
||||
//~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar2(&123);
|
||||
<u32 as Trait3>::bar2(&123);
|
||||
@@ -866,13 +773,9 @@ pub fn check<'a: 'a>() {
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>
|
||||
::bar3::<'static, 'static>(&123);
|
||||
//~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait3>::bar3::<'static, 'static>(&123);
|
||||
//~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, 'static>(&123);
|
||||
//~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
<u32 as Trait5<i32, u64, String>>::bar3::<'static, 'static>(&123);
|
||||
//~^ ERROR: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present [E0794]
|
||||
|
||||
<u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar4(&123);
|
||||
<u32 as Trait3>::bar4(&123);
|
||||
@@ -1,1544 +0,0 @@
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:26:56
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:18:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:32:56
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:18:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:49:56
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:18:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:53:56
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:18:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:62:56
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:18:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:66:56
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:18:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:75:56
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:18:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:79:56
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_1::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:18:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:92:22
|
||||
|
|
||||
LL | ::bar1::<'static, String, true>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:18:42
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:92:15
|
||||
|
|
||||
LL | ::bar1::<'static, String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:26:63
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T>: Sized {
|
||||
| -
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | ::bar1::<'static, String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:95:33
|
||||
|
|
||||
LL | <u32 as Trait3>::bar1::<'static, String, true>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:18:42
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:95:26
|
||||
|
|
||||
LL | <u32 as Trait3>::bar1::<'static, String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:49:63
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T>: Sized {
|
||||
| -
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait3>::bar1::<'static, String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:98:50
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:18:42
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:98:43
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:62:63
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T>: Sized {
|
||||
| -
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:101:51
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:18:42
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:101:44
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:75:63
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T>: Sized {
|
||||
| -
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:111:22
|
||||
|
|
||||
LL | ::bar3::<'static, String, true>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:18:42
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:111:15
|
||||
|
|
||||
LL | ::bar3::<'static, String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:32:63
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T>: Sized {
|
||||
| -
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | ::bar3::<'static, String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:114:33
|
||||
|
|
||||
LL | <u32 as Trait3>::bar3::<'static, String, true>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:18:42
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:114:26
|
||||
|
|
||||
LL | <u32 as Trait3>::bar3::<'static, String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:53:63
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T>: Sized {
|
||||
| -
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait3>::bar3::<'static, String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:117:50
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:18:42
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:117:43
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:66:63
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T>: Sized {
|
||||
| -
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:120:51
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:18:42
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:120:44
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:79:63
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T>: Sized {
|
||||
| -
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:146:29
|
||||
|
|
||||
LL | reuse Trait::<i32>::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:138:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:149:29
|
||||
|
|
||||
LL | reuse Trait::<i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:138:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:157:29
|
||||
|
|
||||
LL | reuse Trait::<i32>::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:138:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:160:29
|
||||
|
|
||||
LL | reuse Trait::<i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:138:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:168:29
|
||||
|
|
||||
LL | reuse Trait::<i32>::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:138:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:171:29
|
||||
|
|
||||
LL | reuse Trait::<i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:138:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:179:29
|
||||
|
|
||||
LL | reuse Trait::<i32>::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:138:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:182:29
|
||||
|
|
||||
LL | reuse Trait::<i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_2::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:138:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:194:15
|
||||
|
|
||||
LL | ::bar1::<'static, String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:146:36
|
||||
|
|
||||
LL | trait Trait<T>: Sized {
|
||||
| -
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<i32>::foo as bar1 { Self::get() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | ::bar1::<'static, String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:196:26
|
||||
|
|
||||
LL | <u32 as Trait3>::bar1::<'static, String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:157:36
|
||||
|
|
||||
LL | trait Trait<T>: Sized {
|
||||
| -
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<i32>::foo as bar1 { Self::get() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait3>::bar1::<'static, String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:198:43
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:168:36
|
||||
|
|
||||
LL | trait Trait<T>: Sized {
|
||||
| -
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<i32>::foo as bar1 { Self::get() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:200:44
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:179:36
|
||||
|
|
||||
LL | trait Trait<T>: Sized {
|
||||
| -
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<i32>::foo as bar1 { Self::get() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:209:15
|
||||
|
|
||||
LL | ::bar3::<'static, String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:149:36
|
||||
|
|
||||
LL | trait Trait<T>: Sized {
|
||||
| -
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | ::bar3::<'static, String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:211:26
|
||||
|
|
||||
LL | <u32 as Trait3>::bar3::<'static, String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:160:36
|
||||
|
|
||||
LL | trait Trait<T>: Sized {
|
||||
| -
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait3>::bar3::<'static, String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:213:43
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:171:36
|
||||
|
|
||||
LL | trait Trait<T>: Sized {
|
||||
| -
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:215:44
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:182:36
|
||||
|
|
||||
LL | trait Trait<T>: Sized {
|
||||
| -
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:240:51
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_3::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:232:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar1 { Self::get() }
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:245:51
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_3::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:232:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar3 { self.get_self() }
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:255:51
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_3::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:232:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar1 { Self::get() }
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:260:51
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_3::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:232:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar3 { self.get_self() }
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:270:51
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_3::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:232:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar1 { Self::get() }
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:275:51
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_3::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:232:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar3 { self.get_self() }
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:285:51
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_3::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:232:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar1 { Self::get() }
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:289:51
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_3::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:232:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static>::foo::<U, M> as bar3 { self.get_self() }
|
||||
| ++++++++
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:302:22
|
||||
|
|
||||
LL | ::bar1::<'static, String, true>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:232:42
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:304:33
|
||||
|
|
||||
LL | <u32 as Trait3>::bar1::<'static, String, true>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:232:42
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:306:50
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'static, String, true>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:232:42
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:308:51
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar1::<'static, String, true>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:232:42
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:317:22
|
||||
|
|
||||
LL | ::bar3::<'static, String, true>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:232:42
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:319:33
|
||||
|
|
||||
LL | <u32 as Trait3>::bar3::<'static, String, true>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:232:42
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:321:50
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, String, true>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:232:42
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:323:51
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, String, true>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:232:42
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:348:22
|
||||
|
|
||||
LL | reuse Trait::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:340:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::foo::<U, M> as bar1 { Self::get() }
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:351:22
|
||||
|
|
||||
LL | reuse Trait::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:340:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::foo::<U, M> as bar3 { self.get_self() }
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:359:22
|
||||
|
|
||||
LL | reuse Trait::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:340:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::foo::<U, M> as bar1 { Self::get() }
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:362:22
|
||||
|
|
||||
LL | reuse Trait::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:340:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::foo::<U, M> as bar3 { self.get_self() }
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:370:22
|
||||
|
|
||||
LL | reuse Trait::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:340:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::foo::<U, M> as bar1 { Self::get() }
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:373:22
|
||||
|
|
||||
LL | reuse Trait::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:340:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::foo::<U, M> as bar3 { self.get_self() }
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:381:22
|
||||
|
|
||||
LL | reuse Trait::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:340:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::foo::<U, M> as bar1 { Self::get() }
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:384:22
|
||||
|
|
||||
LL | reuse Trait::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:340:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | reuse Trait::foo::<U, M> as bar3 { self.get_self() }
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:401:9
|
||||
|
|
||||
LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar2(&123);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar2`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait2::bar2`
|
||||
--> $DIR/trait-to-trait.rs:340:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait2::bar2`
|
||||
...
|
||||
LL | reuse Trait::foo::<'static, String, false> as bar2 { Self::get() }
|
||||
| ---- required by a bound in this associated function
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:403:9
|
||||
|
|
||||
LL | <u32 as Trait3>::bar2(&123);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar2`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait3::bar2`
|
||||
--> $DIR/trait-to-trait.rs:340:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait3::bar2`
|
||||
...
|
||||
LL | reuse Trait::foo::<'static, String, false> as bar2 { Self::get() }
|
||||
| ---- required by a bound in this associated function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | <u32 as Trait3>::bar2::<U, M>(&123);
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:405:9
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar2(&123);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar2`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait4::bar2`
|
||||
--> $DIR/trait-to-trait.rs:340:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait4::bar2`
|
||||
...
|
||||
LL | reuse Trait::foo::<'static, String, false> as bar2 { Self::get() }
|
||||
| ---- required by a bound in this associated function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar2::<U, M>(&123);
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:407:9
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar2(&123);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar2`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait5::bar2`
|
||||
--> $DIR/trait-to-trait.rs:340:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait5::bar2`
|
||||
...
|
||||
LL | reuse Trait::foo::<'static, String, false> as bar2 { Self::get() }
|
||||
| ---- required by a bound in this associated function
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:416:9
|
||||
|
|
||||
LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar4(&123);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar4`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait2::bar4`
|
||||
--> $DIR/trait-to-trait.rs:340:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait2::bar4`
|
||||
...
|
||||
LL | reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() }
|
||||
| ---- required by a bound in this associated function
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:418:9
|
||||
|
|
||||
LL | <u32 as Trait3>::bar4(&123);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar4`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait3::bar4`
|
||||
--> $DIR/trait-to-trait.rs:340:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait3::bar4`
|
||||
...
|
||||
LL | reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() }
|
||||
| ---- required by a bound in this associated function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | <u32 as Trait3>::bar4::<U, M>(&123);
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:420:9
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar4(&123);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar4`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait4::bar4`
|
||||
--> $DIR/trait-to-trait.rs:340:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait4::bar4`
|
||||
...
|
||||
LL | reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() }
|
||||
| ---- required by a bound in this associated function
|
||||
help: consider specifying the generic arguments
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar4::<U, M>(&123);
|
||||
| ++++++++
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:422:9
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar4(&123);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `M` declared on the method `bar4`
|
||||
|
|
||||
note: required by a const generic parameter in `test_4::Trait5::bar4`
|
||||
--> $DIR/trait-to-trait.rs:340:27
|
||||
|
|
||||
LL | fn foo<'d: 'd, U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait5::bar4`
|
||||
...
|
||||
LL | reuse Trait::foo::<'static, String, false> as bar4 { self.get_self() }
|
||||
| ---- required by a bound in this associated function
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:442:56
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_5::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:434:19
|
||||
|
|
||||
LL | fn foo<U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:447:56
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_5::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:434:19
|
||||
|
|
||||
LL | fn foo<U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:457:56
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_5::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:434:19
|
||||
|
|
||||
LL | fn foo<U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:462:56
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_5::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:434:19
|
||||
|
|
||||
LL | fn foo<U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:472:56
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_5::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:434:19
|
||||
|
|
||||
LL | fn foo<U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:477:56
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_5::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:434:19
|
||||
|
|
||||
LL | fn foo<U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:487:56
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_5::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:434:19
|
||||
|
|
||||
LL | fn foo<U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0284]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:492:56
|
||||
|
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^ cannot infer the value of the const parameter `M` declared on the method `foo`
|
||||
|
|
||||
note: required by a const generic parameter in `test_5::Trait::foo`
|
||||
--> $DIR/trait-to-trait.rs:434:19
|
||||
|
|
||||
LL | fn foo<U, const M: bool>(&self) {}
|
||||
| ^^^^^^^^^^^^^ required by this const generic parameter in `Trait::foo`
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:505:68
|
||||
|
|
||||
LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar1::<String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:442:63
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T>: Sized {
|
||||
| -
|
||||
LL | fn foo<U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar1::<String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:507:26
|
||||
|
|
||||
LL | <u32 as Trait3>::bar1::<String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:457:63
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T>: Sized {
|
||||
| -
|
||||
LL | fn foo<U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait3>::bar1::<String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:509:43
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:472:63
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T>: Sized {
|
||||
| -
|
||||
LL | fn foo<U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:511:44
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar1::<String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:487:63
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T>: Sized {
|
||||
| -
|
||||
LL | fn foo<U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar1 { Self::get() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar1::<String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:519:68
|
||||
|
|
||||
LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar3::<String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:447:63
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T>: Sized {
|
||||
| -
|
||||
LL | fn foo<U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar3::<String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:521:26
|
||||
|
|
||||
LL | <u32 as Trait3>::bar3::<String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:462:63
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T>: Sized {
|
||||
| -
|
||||
LL | fn foo<U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait3>::bar3::<String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:523:43
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:477:63
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T>: Sized {
|
||||
| -
|
||||
LL | fn foo<U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0107]: method takes 3 generic arguments but 2 generic arguments were supplied
|
||||
--> $DIR/trait-to-trait.rs:525:44
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar3::<String, true>(&123);
|
||||
| ^^^^ ------ ---- supplied 2 generic arguments
|
||||
| |
|
||||
| expected 3 generic arguments
|
||||
|
|
||||
note: method defined here, with 3 generic parameters: `T`, `U`, `M`
|
||||
--> $DIR/trait-to-trait.rs:492:63
|
||||
|
|
||||
LL | trait Trait<'b, 'c, 'a, T>: Sized {
|
||||
| -
|
||||
LL | fn foo<U, const M: bool>(&self) {}
|
||||
| - -------------
|
||||
...
|
||||
LL | reuse Trait::<'static, 'static, 'static, i32>::foo as bar3 { self.get_self() }
|
||||
| ^^^^
|
||||
help: add missing generic argument
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar3::<String, true, M>(&123);
|
||||
| +++
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:581:9
|
||||
|
|
||||
LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar1(&123);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the method `bar1`
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:640:9
|
||||
|
|
||||
LL | <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>::bar1(&123);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the method `bar1`
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/trait-to-trait.rs:765:9
|
||||
|
|
||||
LL | / <u32 as Trait2<'static, 'static, 'static, i32, i32, i32>>
|
||||
LL | |
|
||||
LL | | ::bar1::<'static, 'static>(&123);
|
||||
| |______________________________________^ cannot infer type of the type parameter `T` declared on the method `bar1`
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:853:22
|
||||
|
|
||||
LL | ::bar1::<'static, 'static>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:797:32
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:855:33
|
||||
|
|
||||
LL | <u32 as Trait3>::bar1::<'static, 'static>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:797:32
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:857:50
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar1::<'a, 'a>(&123);
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:797:32
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:859:51
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar1::<'a, 'a>(&123);
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:797:32
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:868:22
|
||||
|
|
||||
LL | ::bar3::<'static, 'static>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:797:32
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:870:33
|
||||
|
|
||||
LL | <u32 as Trait3>::bar3::<'static, 'static>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:797:32
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:872:50
|
||||
|
|
||||
LL | <u32 as Trait4<'a, 'a, 'static>>::bar3::<'static, 'static>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:797:32
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b>(&self) {}
|
||||
| ^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/trait-to-trait.rs:874:51
|
||||
|
|
||||
LL | <u32 as Trait5<i32, u64, String>>::bar3::<'static, 'static>(&123);
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/trait-to-trait.rs:797:32
|
||||
|
|
||||
LL | fn foo<'a: 'a, 'b: 'b>(&self) {}
|
||||
| ^
|
||||
|
||||
error: aborting due to 99 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0107, E0282, E0284, E0794.
|
||||
For more information about an error, try `rustc --explain E0107`.
|
||||
Reference in New Issue
Block a user