Remove some the spans pointing at the enum in the path and its generic args
``` error[E0109]: type arguments are not allowed on tuple variant `TSVariant` --> $DIR/enum-variant-generic-args.rs:54:29 | LL | Enum::<()>::TSVariant::<()>(()); | --------- ^^ type argument not allowed | | | not allowed on tuple variant `TSVariant` | = note: generic arguments are not allowed on both an enum and its variant's path segments simultaneously; they are only valid in one place or the other help: remove the generics arguments from one of the path segments | LL - Enum::<()>::TSVariant::<()>(()); LL + Enum::<()>::TSVariant(()); | ```
This commit is contained in:
parent
1b98d0ed13
commit
23daa8c724
3 changed files with 23 additions and 29 deletions
|
@ -1047,10 +1047,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
};
|
||||
});
|
||||
|
||||
let segments: Vec<_> = match err_extend {
|
||||
GenericsArgsErrExtend::DefVariant(segments) => segments.iter().collect(),
|
||||
_ => segments.collect(),
|
||||
};
|
||||
let segments: Vec<_> = segments.collect();
|
||||
let types_and_spans: Vec<_> = segments
|
||||
.iter()
|
||||
.flat_map(|segment| {
|
||||
|
@ -1511,10 +1508,10 @@ fn generics_args_err_extend<'a>(
|
|||
if args.len() > 1
|
||||
&& let Some(span) = args.into_iter().last()
|
||||
{
|
||||
let msg = "generic arguments are not allowed on both an enum and its variant's \
|
||||
path segments simultaneously; they are only valid in one place or the \
|
||||
other";
|
||||
err.note(msg);
|
||||
err.note(
|
||||
"generic arguments are not allowed on both an enum and its variant's path \
|
||||
segments simultaneously; they are only valid in one place or the other",
|
||||
);
|
||||
err.span_suggestion_verbose(
|
||||
span,
|
||||
"remove the generics arguments from one of the path segments",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue