Skip to content

Conversation

@nikomatsakis
Copy link
Contributor

We used to directly embed Vec<Parameter<TF>>. This branch changes those references to Substitution<TF> which (internally) relies on an TF::InternedSubstitution. This should enable rustc to use interned slices.

In order to support interning, we're going to want to be passing in
the interner, so `collect()` is not going to work long term.
It is constructed from an iterator over results
)
})
TF::debug_projection(self, fmt)
.unwrap_or_else(|| write!(fmt, "({:?}){:?}", self.associated_ty_id, &self.substitution))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be &self.substitution.with_angle()

fn intern_goal(data: GoalData<Self>) -> Self::InternedGoal;

/// Lookup the `GoalData` that was interned to create a `InternedGoal`.
/// Lookup the `LifetimeData` that was interned to create a `InternedLifetime`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These docs don't reflect the function...

/// index. Naturally, the kind of the variable must agree with
/// the kind of the value.
pub parameters: Vec<Parameter<TF>>,
parameters: TF::InternedSubstitution,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point, why not just replace Substitution with an associated type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern is what we use for all the "interned things". Having the newtype'd wrapper allows us to implement traits like Fold and add methods. You can't quite make Fold work without the newtype'd wrapper. The other advantage is consistency: you always write Foo<TF>, never TF::Foo, in regular code.

Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants