pub struct WrongNumberOfGenericArgs<'a, 'tcx> {
    pub(crate) tcx: TyCtxt<'tcx>,
    pub(crate) angle_brackets: AngleBrackets,
    pub(crate) gen_args_info: GenericArgsInfo,
    pub(crate) path_segment: &'a PathSegment<'a>,
    pub(crate) gen_params: &'a Generics,
    pub(crate) params_offset: usize,
    pub(crate) gen_args: &'a GenericArgs<'a>,
    pub(crate) def_id: DefId,
}
Expand description

Handles the wrong number of type / lifetime / ... arguments family of error messages.

Fields§

§tcx: TyCtxt<'tcx>§angle_brackets: AngleBrackets§gen_args_info: GenericArgsInfo§path_segment: &'a PathSegment<'a>

Offending path segment

§gen_params: &'a Generics

Generic parameters as expected by type or trait

§params_offset: usize

Index offset into parameters. Depends on whether Self is included and on number of lifetime parameters in case we’re processing missing or redundant type or constant arguments.

§gen_args: &'a GenericArgs<'a>

Generic arguments as provided by user

§def_id: DefId

DefId of the generic type

Implementations§

Builds the expected 1 type argument / supplied 2 type arguments message.

Suggests to add missing argument(s) when current invocation site already contains some generics:

type Map = HashMap<String>;

Suggests moving redundant argument(s) of an associate function to the trait it belongs to.

Into::into::<Option<_>>(42) // suggests considering `Into::<Option<_>>::into(42)`

Suggests to remove redundant argument(s):

type Map = HashMap<String, String, String, String>;

Builds the type defined here message.

Add note if impl Trait is explicitly specified.

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 88 bytes