1
Fork 0

Auto merge of #26307 - nrc:save-bugs, r=cmr

r? @brson (or anyone, really)
This commit is contained in:
bors 2015-06-15 09:02:31 +00:00
commit 0d82fb55db

View file

@ -255,16 +255,17 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
match typ.node { match typ.node {
// Common case impl for a struct or something basic. // Common case impl for a struct or something basic.
ast::TyPath(None, ref path) => { ast::TyPath(None, ref path) => {
sub_span = self.span_utils.sub_span_for_type_name(path.span); sub_span = self.span_utils.sub_span_for_type_name(path.span).unwrap();
type_data = self.lookup_ref_id(typ.id).map(|id| TypeRefData { type_data = self.lookup_ref_id(typ.id).map(|id| TypeRefData {
span: sub_span.unwrap(), span: sub_span,
scope: parent, scope: parent,
ref_id: id, ref_id: id,
}); });
}, },
_ => { _ => {
// Less useful case, impl for a compound type. // Less useful case, impl for a compound type.
sub_span = self.span_utils.sub_span_for_type_name(typ.span); let span = typ.span;
sub_span = self.span_utils.sub_span_for_type_name(span).unwrap_or(span);
} }
} }
@ -273,7 +274,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
Data::ImplData(ImplData { Data::ImplData(ImplData {
id: item.id, id: item.id,
span: sub_span.unwrap(), span: sub_span,
scope: parent, scope: parent,
trait_ref: trait_data, trait_ref: trait_data,
self_ref: type_data, self_ref: type_data,
@ -320,9 +321,10 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
parent: NodeId) parent: NodeId)
-> Option<TypeRefData> { -> Option<TypeRefData> {
self.lookup_ref_id(trait_ref.ref_id).map(|def_id| { self.lookup_ref_id(trait_ref.ref_id).map(|def_id| {
let sub_span = self.span_utils.sub_span_for_type_name(trait_ref.path.span); let span = trait_ref.path.span;
let sub_span = self.span_utils.sub_span_for_type_name(span).unwrap_or(span);
TypeRefData { TypeRefData {
span: sub_span.unwrap(), span: sub_span,
scope: parent, scope: parent,
ref_id: def_id, ref_id: def_id,
} }