Move diagnostics code out of the critical path
This commit is contained in:
parent
898f36c83c
commit
5bb0a03fa7
1 changed files with 21 additions and 20 deletions
|
@ -213,12 +213,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
segment,
|
segment,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if result.illegal_sized_bound {
|
||||||
let mut needs_mut = false;
|
let mut needs_mut = false;
|
||||||
if let ty::Ref(region, t_type, mutability) = self_ty.kind {
|
if let ty::Ref(region, t_type, mutability) = self_ty.kind {
|
||||||
let trait_type = self.tcx.mk_ref(region, ty::TypeAndMut {
|
let trait_type = self.tcx.mk_ref(region, ty::TypeAndMut {
|
||||||
ty: t_type,
|
ty: t_type,
|
||||||
mutbl: mutability.invert(),
|
mutbl: mutability.invert(),
|
||||||
});
|
});
|
||||||
|
// We probe again to see if there might be a borrow mutability discrepancy.
|
||||||
match self.lookup_probe(
|
match self.lookup_probe(
|
||||||
span,
|
span,
|
||||||
segment.ident,
|
segment.ident,
|
||||||
|
@ -233,7 +235,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if result.illegal_sized_bound {
|
|
||||||
// We probe again, taking all traits into account (not only those in scope).
|
// We probe again, taking all traits into account (not only those in scope).
|
||||||
let candidates = match self.lookup_probe(
|
let candidates = match self.lookup_probe(
|
||||||
span,
|
span,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue