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,
}

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

Fields

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

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

expected_min: usize

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

expected_max: usize

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

provided: usize

Number of generic arguments provided by the user

params_offset: usize

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

args_offset: usize

Offset into gen_args - depends on the kind

path_segment: &'a PathSegment<'a>

Offending path segment

gen_params: &'a Generics

Generic parameters as expected by type or trait

gen_args: &'a GenericArgs<'a>

Generic arguments as provided by user

def_id: DefId

DefId of the generic type

span: Span

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]

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]

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

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

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

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

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

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.

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.

impl<T> WithConstness for T[src]