rust-lang / trait-system-refactor-initiative

The Rustc Trait System Refactor Initiative
22 stars 0 forks source link

Is the folding strategy in `check_type_bound` sufficient? #116

Open compiler-errors opened 6 months ago

compiler-errors commented 6 months ago

https://github.com/rust-lang/rust/pull/125786 folds associated type bounds to replace associated types w/ their concrete types. However, it only does it for identity-substituted associated types, and only for the associated type that we're checking.

This seems to be sufficient, but I'm somewhat suspicious about things like:

type Assoc<T>: Bound<Self::Assoc<u32>>;
type Assoc: Bound<Self::Other>;
type Other: ...;

We should revisit this strategy and convince ourselves it's sound before stabilization, or else make it more general (which doesn't seem too difficult).

Previous unsoundnesses: