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 strExpand description
“type”, “lifetime” etc., put verbatim into the message
expected_min: usizeExpand description
Minimum number of expected generic arguments (e.g. 2 for HashMap)
expected_max: usizeExpand description
Maximum number of expected generic arguments (e.g. 3 for HashMap)
provided: usizeExpand description
Number of generic arguments provided by the user
params_offset: usizeExpand 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: usizeExpand description
Offset into gen_args - depends on the kind
path_segment: &'a PathSegment<'a>Expand description
Offending path segment
gen_params: &'a GenericsExpand description
Generic parameters as expected by type or trait
gen_args: &'a GenericArgs<'a>Expand description
Generic arguments as provided by user
def_id: DefIdExpand description
DefId of the generic type
span: SpanExpand description
Offending place where the generic type has been misused
Implementations
impl<'tcx> WrongNumberOfGenericArgs<'_, 'tcx>[src]
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]
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]
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]
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]
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]
fn show_definition(&self, err: &mut DiagnosticBuilder<'_>)[src]Builds the type defined here message.
Trait Implementations
impl<'tcx> StructuredDiagnostic<'tcx> for WrongNumberOfGenericArgs<'_, 'tcx>[src]
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]
&self,
err: DiagnosticBuilder<'tcx>
) -> DiagnosticBuilder<'tcx>
fn diagnostic_extended(
&self,
err: DiagnosticBuilder<'tcx>
) -> DiagnosticBuilder<'tcx>[src]
&self,
err: DiagnosticBuilder<'tcx>
) -> DiagnosticBuilder<'tcx>
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> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> WithConstness for T[src]
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]
T: ?Sized,