-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trait aliases make it possible to sidestep various syntactic trait bound checks #135342
Comments
I'm not totally convinced all of these are bugs. For the first one, That For the second one, maybe we should just make Third one seems like a disagreement about what we consider to be WF when it comes to dyn trait aliases. This will remain a bug until we stop doing that sketchy eager trait alias expansion behavior in dyn. Same thing with the fourth one. |
I guess I need to shift my perspective, thanks for the "reality check". Your explanation does make sense yeah. Do we track the issues concerning trait aliases inside trait object types anywhere? In an issue or in one of your PRs? |
Not currently, though it would be useful if you opened open an issue for those specifically since I've wanted to point to them / may want to link to it if I ever get around to opening a PR to remove the current |
On the other hand, #![feature(trait_alias)]
trait Lol = Sized;
fn foo<T: ?Lol>() {}
fn main() {
foo::<str>();
}
See also #135809 |
I think
You're writing an automatically-implemented subtrait of |
I guess I won't create a follow-up issue since your FCP-merge PR seems to take care of it (e.g., tests/ui/associated-types/associated-types-overridden-binding.rs) |
Similar to how type aliases allow you to circumvent some syntactic/syntax-driven1 checks made by AST lowering (#132212), you can utilize trait aliases to bypass certain restrictions applying to trait bounds.
This either calls into question the very existence of these restrictions or it demonstrates that all of these checks ought to run "later" (i.e., after trait alias expansion).
Footnotes
I.e., checks on the AST or HIR without any sort of prior substitution/expansion/normalization/... ↩
The text was updated successfully, but these errors were encountered: