Fix integer overflow
This commit is contained in:
parent
734ce4ae1a
commit
d5e24dc121
1 changed files with 8 additions and 6 deletions
|
@ -4997,18 +4997,20 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
let param_idx = param.index as usize - has_self as usize - lifetime_offset;
|
let param_idx = (param.index as usize - has_self as usize)
|
||||||
|
.saturating_sub(lifetime_offset);
|
||||||
if let Some(arg) = data.args.get(param_idx) {
|
if let Some(arg) = data.args.get(param_idx) {
|
||||||
return match param.kind {
|
match param.kind {
|
||||||
GenericParamDefKind::Lifetime => match arg {
|
GenericParamDefKind::Lifetime => match arg {
|
||||||
GenericArg::Lifetime(lt) => {
|
GenericArg::Lifetime(lt) => {
|
||||||
AstConv::ast_region_to_region(self, lt, Some(param)).into()
|
return AstConv::ast_region_to_region(self,
|
||||||
|
lt, Some(param)).into();
|
||||||
}
|
}
|
||||||
_ => bug!("expected a lifetime arg"),
|
_ => {}
|
||||||
}
|
}
|
||||||
GenericParamDefKind::Type { .. } => match arg {
|
GenericParamDefKind::Type { .. } => match arg {
|
||||||
GenericArg::Type(ty) => self.to_ty(ty).into(),
|
GenericArg::Type(ty) => return self.to_ty(ty).into(),
|
||||||
_ => bug!("expected a type arg"),
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue