Skip to content
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

Move bounds from generic param list to where-clause after 'async_trait bound #194

Merged
merged 2 commits into from Mar 25, 2022

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Mar 25, 2022

I experimented with this as an alternative to #191. There are a few diagnostics that this still makes worse, but I think this one is an improvement often enough that I think it's worth trying.

Here is what it does to the expanded code from the ui test:

-  fn publish<'life0, 'async_trait, T: IntoUrl>(
+  fn publish<'life0, 'async_trait, T>(
       &'life0 self,
       url: T,
   ) -> ::core::pin::Pin<Box<dyn ::core::future::Future<Output = ()> + ::core::marker::Send + 'async_trait>>
   where
-      T: 'async_trait,
+      T: 'async_trait + IntoUrl,
       'life0: 'async_trait,
       Self: 'async_trait,
   {…}

Since we've inserted 'async_trait + at the beginning of the bounds list, instead of + 'async_trait at the end, when rustc goes to add more bounds they'll appear correctly after the last user-written bound in the source code.

@dtolnay dtolnay merged commit e572d92 into master Mar 25, 2022
@dtolnay dtolnay deleted the parambounds branch March 25, 2022 05:36
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.

None yet

1 participant