1
Fork 0

Extend rustc_on_implemented to improve a ?-on-ControlFlow error message

This commit is contained in:
Scott McMurray 2021-05-22 23:47:12 -07:00
parent 3bcaeb0bf9
commit 8be67998a1
5 changed files with 47 additions and 15 deletions

View file

@ -186,6 +186,15 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
};
let name = param.name;
flags.push((name, Some(value)));
if let GenericParamDefKind::Type { .. } = param.kind {
let param_ty = trait_ref.substs[param.index as usize].expect_ty();
if let Some(def) = param_ty.ty_adt_def() {
// We also want to be able to select the parameter's
// original signature with no type arguments resolved
flags.push((name, Some(self.tcx.type_of(def.did).to_string())));
}
}
}
if let Some(true) = self_ty.ty_adt_def().map(|def| def.did.is_local()) {