Skip to content

Commit

Permalink
librustc_typeck: store a DefId rather than a Name
Browse files Browse the repository at this point in the history
  • Loading branch information
tamird committed Aug 19, 2017
1 parent 7f397bd commit ceeb399
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/librustc/infer/error_reporting/mod.rs
Expand Up @@ -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 `{}`",
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/mod.rs
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_typeck/check/mod.rs
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_typeck/check/regionck.rs
Expand Up @@ -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)",
Expand Down

0 comments on commit ceeb399

Please sign in to comment.