Struct rustc_typeck::structured_errors::wrong_number_of_generic_args::WrongNumberOfGenericArgs
source · [−]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: AngleBracketsgen_args_info: GenericArgsInfopath_segment: &'a PathSegment<'a>Offending path segment
gen_params: &'a GenericsGeneric parameters as expected by type or trait
params_offset: usizeIndex 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: DefIdDefId of the generic type
Implementations
pub fn new(
tcx: TyCtxt<'tcx>,
gen_args_info: GenericArgsInfo,
path_segment: &'a PathSegment<'_>,
gen_params: &'a Generics,
params_offset: usize,
gen_args: &'a GenericArgs<'a>,
def_id: DefId
) -> Self
fn get_lifetime_args_suggestions_from_param_names(
&self,
num_params_to_take: usize
) -> String
fn get_type_or_const_args_suggestions_from_param_names(
&self,
num_params_to_take: usize
) -> String
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 to remove redundant argument(s):
type Map = HashMap<String, String, String, String>;Builds the type defined here message.
Trait Implementations
Auto Trait Implementations
impl<'a, 'tcx> !RefUnwindSafe for WrongNumberOfGenericArgs
impl<'a, 'tcx> !Send for WrongNumberOfGenericArgs
impl<'a, 'tcx> !Sync for WrongNumberOfGenericArgs
impl<'a, 'tcx> Unpin for WrongNumberOfGenericArgs
impl<'a, 'tcx> !UnwindSafe for WrongNumberOfGenericArgs
Blanket Implementations
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