Provide previous generic arguments to provided_kind
This commit is contained in:
parent
108a1e5f4b
commit
d498eb5937
4 changed files with 6 additions and 17 deletions
|
@ -282,7 +282,7 @@ pub fn lower_generic_args<'tcx: 'a, 'a>(
|
||||||
GenericParamDefKind::Const { .. },
|
GenericParamDefKind::Const { .. },
|
||||||
_,
|
_,
|
||||||
) => {
|
) => {
|
||||||
args.push(ctx.provided_kind(param, arg));
|
args.push(ctx.provided_kind(&args, param, arg));
|
||||||
args_iter.next();
|
args_iter.next();
|
||||||
params.next();
|
params.next();
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,6 +239,7 @@ pub trait GenericArgsLowerer<'a, 'tcx> {
|
||||||
|
|
||||||
fn provided_kind(
|
fn provided_kind(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
preceding_args: &[ty::GenericArg<'tcx>],
|
||||||
param: &ty::GenericParamDef,
|
param: &ty::GenericParamDef,
|
||||||
arg: &GenericArg<'tcx>,
|
arg: &GenericArg<'tcx>,
|
||||||
) -> ty::GenericArg<'tcx>;
|
) -> ty::GenericArg<'tcx>;
|
||||||
|
@ -437,6 +438,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
||||||
|
|
||||||
fn provided_kind(
|
fn provided_kind(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
preceding_args: &[ty::GenericArg<'tcx>],
|
||||||
param: &ty::GenericParamDef,
|
param: &ty::GenericParamDef,
|
||||||
arg: &GenericArg<'tcx>,
|
arg: &GenericArg<'tcx>,
|
||||||
) -> ty::GenericArg<'tcx> {
|
) -> ty::GenericArg<'tcx> {
|
||||||
|
@ -444,22 +446,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
||||||
|
|
||||||
if let Err(incorrect) = self.incorrect_args {
|
if let Err(incorrect) = self.incorrect_args {
|
||||||
if incorrect.invalid_args.contains(&(param.index as usize)) {
|
if incorrect.invalid_args.contains(&(param.index as usize)) {
|
||||||
// FIXME: use `param.to_error` once `provided_kind` is supplied a list of
|
return param.to_error(tcx, preceding_args);
|
||||||
// all previous generic args.
|
|
||||||
return match param.kind {
|
|
||||||
GenericParamDefKind::Lifetime => {
|
|
||||||
ty::Region::new_error(tcx, incorrect.reported).into()
|
|
||||||
}
|
|
||||||
GenericParamDefKind::Type { .. } => {
|
|
||||||
Ty::new_error(tcx, incorrect.reported).into()
|
|
||||||
}
|
|
||||||
GenericParamDefKind::Const { .. } => ty::Const::new_error(
|
|
||||||
tcx,
|
|
||||||
incorrect.reported,
|
|
||||||
Ty::new_error(tcx, incorrect.reported),
|
|
||||||
)
|
|
||||||
.into(),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1275,6 +1275,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
fn provided_kind(
|
fn provided_kind(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
_preceding_args: &[ty::GenericArg<'tcx>],
|
||||||
param: &ty::GenericParamDef,
|
param: &ty::GenericParamDef,
|
||||||
arg: &GenericArg<'tcx>,
|
arg: &GenericArg<'tcx>,
|
||||||
) -> ty::GenericArg<'tcx> {
|
) -> ty::GenericArg<'tcx> {
|
||||||
|
|
|
@ -383,6 +383,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
|
||||||
|
|
||||||
fn provided_kind(
|
fn provided_kind(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
_preceding_args: &[ty::GenericArg<'tcx>],
|
||||||
param: &ty::GenericParamDef,
|
param: &ty::GenericParamDef,
|
||||||
arg: &GenericArg<'tcx>,
|
arg: &GenericArg<'tcx>,
|
||||||
) -> ty::GenericArg<'tcx> {
|
) -> ty::GenericArg<'tcx> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue