-
Notifications
You must be signed in to change notification settings - Fork 898
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
Support non-lifetime binders #5848
Support non-lifetime binders #5848
Conversation
context: &RewriteContext<'_>, | ||
shape: Shape, | ||
generic_params: &[ast::GenericParam], | ||
) -> Option<String> { | ||
let result = generic_params | ||
.iter() | ||
.filter(|p| matches!(p.kind, ast::GenericParamKind::Lifetime)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this filter line is the only non-name-tweaking change.
6614042
to
a2622a2
Compare
#![feature(non_lifetime_binders)] | ||
#![allow(incomplete_features)] | ||
|
||
trait Other<U: ?Sized> {} | ||
|
||
trait Trait<U> | ||
where | ||
for<T> U: Other<T> {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No real issue keeping the source
file, but I just want to point out that the target
file is enough to show that the input is idempotent, and that rustfmt no longer remove the for<T>
.
a2622a2
to
a99f36e
Compare
Thanks! |
rustfmt doesn't seem to break lengthy higher-ranked parameter lists (ones that contain long binder names or lots of bounds) into multiple lines yet though at least according to my limited testing. Slightly unrelated since this seems to concern (the stable) lifetime binders, too. Just something I've noticed. Might require a style edition though. Edit: For verbose lifetime names only I guess, everything else is unstable or semantically not permitted yet in rustc. |
@fmease it would be great if you could open up a new issue and provide some example code snippets that the team can use to investigate. |
Makes it so we stop yeeting non-lifetime binders into the void. Rustfmt already generally supports formatting
ast::GenericParam
anyways, so this just is piggybacking on that formatting.Fixes #5721