Point to local place span on "type too big" error

This commit is contained in:
Esteban Küber 2019-08-03 15:59:25 -07:00
parent 2c5684208c
commit db099fb491
14 changed files with 65 additions and 9 deletions

View file

@ -901,6 +901,9 @@ impl<'a, 'tcx> LayoutOf for LateContext<'a, 'tcx> {
fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
self.tcx.layout_of(self.param_env.and(ty))
}
fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
self.layout_of(ty)
}
}
impl<'a, 'tcx, T: LateLintPass<'a, 'tcx>> LateContextAndPass<'a, 'tcx, T> {

View file

@ -3,7 +3,7 @@ use crate::ty::{self, Ty, TyCtxt, TypeFoldable, ReprOptions};
use syntax::ast::{self, Ident, IntTy, UintTy};
use syntax::attr;
use syntax_pos::DUMMY_SP;
use syntax_pos::{DUMMY_SP, Span};
use std::cmp;
use std::fmt;
@ -1943,6 +1943,9 @@ impl<'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'tcx>> {
Ok(layout)
}
fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
self.layout_of(ty)
}
}
impl LayoutOf for LayoutCx<'tcx, ty::query::TyCtxtAt<'tcx>> {
@ -1974,6 +1977,9 @@ impl LayoutOf for LayoutCx<'tcx, ty::query::TyCtxtAt<'tcx>> {
Ok(layout)
}
fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
self.layout_of(ty)
}
}
// Helper (inherent) `layout_of` methods to avoid pushing `LayoutCx` to users.