-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Prohibit patterns in trait methods without bodies #37378
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Started crater run. |
Crater run looks pretty bad (177 root regressions). |
Something is wrong with root/non-root partitioning in crater. Anyway, it looks like we can't make this an error in the nearest future, but I still hope to proceed with a warn-by-default lint. |
@petrochenkov Maybe they don't show themselves? They might be broken or missing? EDIT: started a second run, only on the "after" half. |
traits: Remove pattern in trait's method signature This use of `mut` was nonsensical for now, but is proposed to be disallowed by rustc in the future (as a bugfix). See rust-lang/rust/pull/37378 for context.
Second crater report shows only 22 root regressions. |
I've updated the PR with warning-by-default and tracking issue number. |
@bors r+ |
📌 Commit 82d4200 has been approved by |
Prohibit patterns in trait methods without bodies They are not properly type checked ```rust trait Tr { fn f(&a: u8); // <- This compiles } ``` , mostly rejected by the parser already and generally don't make much sense. This PR is kind of a missing part of rust-lang#35015. Needs crater run. cc rust-lang#35078 (comment) rust-lang#35015 rust-lang/rfcs#1685 rust-lang#35203 r? @eddyb
Fails tidy, d230a7e |
The used error code ( |
@@ -228,4 +228,5 @@ pub impl Foo for Bar { | |||
register_diagnostics! { | |||
E0472, // asm! is unsupported on this target | |||
E0561, // patterns aren't allowed in function pointer types | |||
E0570, // patterns aren't allowed in methods without bodies |
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.
This seems to be unused?
I believe this caused #37416 to fail https://buildbot.rust-lang.org/builders/auto-win-msvc-64-cargotest/builds/2155
|
Fix rust-lang/rust#35203 warning/error rust-lang/rust#35203 made patterns in functions without body into a warn by default lint (which is being `deny`ed here). cc rust-lang/rust#37378, rust-lang/rust#37416
@bors r=eddyb |
📌 Commit 811a2b9 has been approved by |
⌛ Testing commit 811a2b9 with merge e61c918... |
💔 Test failed - auto-win-msvc-64-cargotest |
This probably needs to update the sha at https://github.com/rust-lang/rust/blob/master/src/tools/cargotest/main.rs#L27 to at least rust-lang/cargo@806e3c3 |
@bors r=eddyb |
📌 Commit 4ca11ce has been approved by |
Prohibit patterns in trait methods without bodies They are not properly type checked ```rust trait Tr { fn f(&a: u8); // <- This compiles } ``` , mostly rejected by the parser already and generally don't make much sense. This PR is kind of a missing part of #35015. Given the [statistics from crater](#37378 (comment)), the effect of this PR is mostly equivalent to improving `unused_mut` lint. cc #35078 (comment) #35015 rust-lang/rfcs#1685 #35203 r? @eddyb
@petrochenkov Edit. Ah the first one was broken already from rustc-serialize and num-traits and didn't reveal that the crate would fail to build even without them... (And this is why I would really like central place to check crater runs...) |
@WaDelma
, anonymous parameters
are not reported (yet, waiting for rust-lang/rfcs#1685). |
Ah okay. That was the part I was missing. :D |
They are not properly type checked
, mostly rejected by the parser already and generally don't make much sense.
This PR is kind of a missing part of #35015.
Given the statistics from crater, the effect of this PR is mostly equivalent to improving
unused_mut
lint.cc #35078 (comment) #35015 rust-lang/rfcs#1685 #35203
r? @eddyb