-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Allow parentheses in dyn (Trait)
#48481
Conversation
There's a test |
59a574e
to
4c73f82
Compare
Oh, right, you can alias @nikomatsakis is this something we should just land (perhaps w/ crater) or make it an epoch breakage? If we do the latter, bear in mind that there will be no automated way to rustfix |
We should just land this, IMO, crater won't find anything. |
brb publishing a crate to prove you wrong 😜 but yeah, perhaps. Though I'm really wary about breaking changes. Feel free to r+ |
I agree with @petrochenkov we can probably get away with this one, though like @Manishearth I am getting ever more wary about breaking changes. =) |
Nonehtless, tagging as relnotes. Description would be something like this: The @petrochenkov, that's the case you were thinking of, right? |
I would like some tests that cover the precedence and the interesting cases. For example: let x: &dyn (Debug + Send) = ..; // this should work, right?
let x: &dyn (Debug + Send + Sync) = ..; // this too
let x: &dyn (Debug + Send + ) = ..; // I think we support trailing `+` terminators elsewhere
let x: Box<dyn (Debug + Send) + Sync> = ...; // what about this? =) I forget what we decided there Also, does this work for |
ah, none of those work |
We don't seem to allow parens in trait bounds, |
@Manishearth yes, I know. I think the way to fix this is by allowing parens in trait bounds, or at least I think that's what @cramertj and I always had in mind (they can confirm) |
This has been a historical point of disagreement with @petrochenkov though =) |
I can make it work with dyn trait for now; it does not exacerbate any breakages, and is necessary to make |
This PR doesn't implement that extension, it does other thing - it supports already existing parentheses around a single bound (e.g. |
My personal preference is for |
@bors r+ ( |
📌 Commit 4c73f82 has been approved by |
Allow parentheses in `dyn (Trait)` r? @eddyb @nikomatsakis
Regression in rollup, pretty print test failed.
|
This merged, I just messed up on including it in the rollup |
r? @eddyb @nikomatsakis