Skip to content

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.

2 participants