librustc_typeck: store a DefId rather than a Name

This commit is contained in:
Tamir Duberstein 2017-08-19 13:41:10 -07:00
parent 7f397bdb06
commit ceeb399cea
No known key found for this signature in database
GPG key ID: 1C1E98CC8E17BB89
4 changed files with 5 additions and 7 deletions

View file

@ -899,9 +899,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
infer::LateBoundRegion(_, br, infer::HigherRankedType) => {
format!(" for lifetime parameter {}in generic type", br_string(br))
}
infer::LateBoundRegion(_, br, infer::AssocTypeProjection(type_name)) => {
infer::LateBoundRegion(_, br, infer::AssocTypeProjection(def_id)) => {
format!(" for lifetime parameter {}in trait containing associated type `{}`",
br_string(br), type_name)
br_string(br), self.tcx.associated_item(def_id).name)
}
infer::EarlyBoundRegion(_, name) => {
format!(" for lifetime parameter `{}`",

View file

@ -274,7 +274,7 @@ pub enum LateBoundRegionConversionTime {
HigherRankedType,
/// when projecting an associated type
AssocTypeProjection(ast::Name), // FIXME(tschottdorf): should contain DefId, not Name
AssocTypeProjection(DefId),
}
/// Reasons to create a region inference variable

View file

@ -1646,11 +1646,10 @@ impl<'a, 'gcx, 'tcx> AstConv<'gcx, 'tcx> for FnCtxt<'a, 'gcx, 'tcx> {
poly_trait_ref: ty::PolyTraitRef<'tcx>)
-> Ty<'tcx>
{
let item = self.tcx().associated_item(item_def_id);
let (trait_ref, _) =
self.replace_late_bound_regions_with_fresh_var(
span,
infer::LateBoundRegionConversionTime::AssocTypeProjection(item.name),
infer::LateBoundRegionConversionTime::AssocTypeProjection(item_def_id),
&poly_trait_ref);
self.tcx().mk_projection(item_def_id, trait_ref.substs)

View file

@ -1805,8 +1805,7 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> {
let (outlives, _) =
self.replace_late_bound_regions_with_fresh_var(
span,
infer::AssocTypeProjection(
self.tcx.associated_item(projection_ty.item_def_id).name),
infer::AssocTypeProjection(projection_ty.item_def_id),
&outlives);
debug!("projection_bounds: outlives={:?} (3)",