-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Add a suggestion when using a type alias instead of trait alias #83729
Conversation
This comment has been minimized.
This comment has been minimized.
or, if you want to use a trait alias, not a type alias, you should use | ||
`#![feature(trait_alias)]`: |
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.
I would change this to be something along the lines of
Alternatively, you could introduce a new trait with your desired restrictions as a super trait:
```
# trait Foo {}
# struct Bar;
# impl Foo for Bar {}
trait Qux: Foo {} // Anything that implements Qux also needs to implement Foo
fn baz<T: Qux>(t: T) {} // also ok!
```
Finally, if you are on nightly and want to use a trait alias instead of a type alias, you should use `#![feature(trait_alias)]`:
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.
Thanks, just applied your suggestion.
This comment has been minimized.
This comment has been minimized.
@estebank Approving means r=you? |
this looks fine to me, so assuming the approval to mean a r+, giving it a pass @bors r=estebank rollup |
📌 Commit eea27b8 has been approved by |
Add a suggestion when using a type alias instead of trait alias Fixes rust-lang#43913 r? `@estebank`
Add a suggestion when using a type alias instead of trait alias Fixes rust-lang#43913 r? ``@estebank``
Add a suggestion when using a type alias instead of trait alias Fixes rust-lang#43913 r? ```@estebank```
⌛ Testing commit eea27b8 with merge 3a5e0119313a0c45261e05e8ce9e826a9542ead9... |
Add a suggestion when using a type alias instead of trait alias Fixes rust-lang#43913 r? ```@estebank```
Add a suggestion when using a type alias instead of trait alias Fixes rust-lang#43913 r? ````@estebank````
Add a suggestion when using a type alias instead of trait alias Fixes rust-lang#43913 r? `````@estebank`````
Add a suggestion when using a type alias instead of trait alias Fixes rust-lang#43913 r? ``````@estebank``````
@Dylan-DPC Hm, why did you think it's related? I haven't figured out how the change here caused the failure. |
@JohnTitor i'm not sure, a few rollups have failed because of the same error, and this one seems to be one of the few that are common between them. I don't have time right now to investigate, but if you can find the culprit PR would be helpful :) |
It was meant as "r+ after addressing the comment". Sorry I didn't see the PR again since. Should we try r+ing this with rollup=never? |
Let's try it. @bors r=estebank rollup=never |
📌 Commit eea27b8 has been approved by |
☀️ Test successful - checks-actions |
Fixes #43913
r? @estebank