Struct rustc_typeck::structured_errors::wrong_number_of_generic_args::WrongNumberOfGenericArgs[−][src]

pub struct WrongNumberOfGenericArgs<'a, 'tcx> {
    pub(crate) tcx: TyCtxt<'tcx>,
    pub(crate) kind: &'static str,
    pub(crate) expected_min: usize,
    pub(crate) expected_max: usize,
    pub(crate) provided: usize,
    pub(crate) params_offset: usize,
    pub(crate) args_offset: usize,
    pub(crate) path_segment: &'a PathSegment<'a>,
    pub(crate) gen_params: &'a Generics,
    pub(crate) gen_args: &'a GenericArgs<'a>,
    pub(crate) def_id: DefId,
    pub(crate) span: Span,
}
Expand description

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

Fields

tcx: TyCtxt<'tcx>kind: &'static str
Expand description

“type”, “lifetime” etc., put verbatim into the message

expected_min: usize
Expand description

Minimum number of expected generic arguments (e.g. 2 for HashMap)

expected_max: usize
Expand description

Maximum number of expected generic arguments (e.g. 3 for HashMap)

provided: usize
Expand description

Number of generic arguments provided by the user

params_offset: usize
Expand description

Offset into gen_params - depends on the kind; might be different than args_offset when user passed e.g. more arguments than was actually expected

args_offset: usize
Expand description

Offset into gen_args - depends on the kind

path_segment: &'a PathSegment<'a>
Expand description

Offending path segment

gen_params: &'a Generics
Expand description

Generic parameters as expected by type or trait

gen_args: &'a GenericArgs<'a>
Expand description

Generic arguments as provided by user

def_id: DefId
Expand description

DefId of the generic type

span: Span
Expand description

Offending place where the generic type has been misused

Implementations

impl<'tcx> WrongNumberOfGenericArgs<'_, 'tcx>[src]

fn quantifier_and_bound(&self) -> (&'static str, usize)[src]

fn start_diagnostics(&self) -> DiagnosticBuilder<'tcx>[src]

fn notify(&self, err: &mut DiagnosticBuilder<'_>)[src]

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

fn suggest(&self, err: &mut DiagnosticBuilder<'_>)[src]

fn suggest_creating_generics(&self, err: &mut DiagnosticBuilder<'_>)[src]

Suggests to create generics (<...>) when current invocation site contains no generics at all:

type Map = HashMap;

fn suggest_adding_args(&self, err: &mut DiagnosticBuilder<'_>)[src]

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

type Map = HashMap<String>;

fn suggest_removing_args_or_generics(&self, err: &mut DiagnosticBuilder<'_>)[src]

Suggests to remove redundant argument(s):

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

fn show_definition(&self, err: &mut DiagnosticBuilder<'_>)[src]

Builds the type defined here message.

Trait Implementations

impl<'tcx> StructuredDiagnostic<'tcx> for WrongNumberOfGenericArgs<'_, 'tcx>[src]

fn session(&self) -> &Session[src]

fn code(&self) -> DiagnosticId[src]

fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx>[src]

fn diagnostic(&self) -> DiagnosticBuilder<'tcx>[src]

fn diagnostic_regular(
    &self,
    err: DiagnosticBuilder<'tcx>
) -> DiagnosticBuilder<'tcx>
[src]

fn diagnostic_extended(
    &self,
    err: DiagnosticBuilder<'tcx>
) -> DiagnosticBuilder<'tcx>
[src]

Auto Trait Implementations

impl<'a, 'tcx> !RefUnwindSafe for WrongNumberOfGenericArgs<'a, 'tcx>

impl<'a, 'tcx> !Send for WrongNumberOfGenericArgs<'a, 'tcx>

impl<'a, 'tcx> !Sync for WrongNumberOfGenericArgs<'a, 'tcx>

impl<'a, 'tcx> Unpin for WrongNumberOfGenericArgs<'a, 'tcx>

impl<'a, 'tcx> !UnwindSafe for WrongNumberOfGenericArgs<'a, 'tcx>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> WithConstness for T[src]

fn with_constness(self, constness: Constness) -> ConstnessAnd<Self>[src]

fn with_const(self) -> ConstnessAnd<Self>[src]

fn without_const(self) -> ConstnessAnd<Self>[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]