Uh oh!
There was an error while loading. Please reload this page.
Properly enforce the "patterns aren't allowed in foreign functions" rule - #35015
Conversation
nikomatsakis
commented
Jul 26, 2016
Started crater run. |
nikomatsakis
commented
Jul 26, 2016
PR looks good, but I'd like to see the results of the crater run so as to decide if this should be a warning or what. |
matklad
commented
Jul 26, 2016
Hm, if we make the plain |
nikomatsakis
commented
Jul 29, 2016
Crater run failed for some reason. =( |
nikomatsakis
commented
Jul 29, 2016
Trying to restart this crater run. |
Argh, sorry, that took a while. Here was the result: https://gist.github.com/nikomatsakis/47dea4e98ffa9d3f350838602cc2a080
Of those 6 regressions, only So, per rust-lang/rfcs#1589, So I'd be happy to land this change without a lint warning, but we are still missing a few things:
|
…heck Apply the same check to function pointer types
petrochenkov
commented
Aug 2, 2016
@nikomatsakis |
nikomatsakis
commented
Aug 3, 2016
@petrochenkov great! @bors r+ |
bors
commented
Aug 3, 2016
📌 Commit 5c88efc has been approved by |
bors
commented
Aug 4, 2016
⌛ Testing commit 5c88efc with merge 271d048... |
Properly enforce the "patterns aren't allowed in foreign functions" rule Cases like `arg @ PATTERN` or `mut arg` were missing. Apply the same rule to function pointer types. Closes#35203 [breaking-change], no breakage in sane code is expected though r? @nikomatsakis This is somewhat related to rust-lang/rfcs#1685 (cc @matklad). The goal is to eventually support full pattern syntax where it makes sense (function body may present) and to support *only* the following forms - `TYPE`, `ident: TYPE`, `_: TYPE` - where patterns don't make sense (function body doesn't present), i.e. in foreign functions and function pointer types.
bors
commented
Aug 4, 2016
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#35015rust-lang/rfcs#1685rust-lang#35203
r? @eddybProhibit 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)#35015rust-lang/rfcs#1685#35203
r? @eddyb
Cases like
arg @ PATTERNormut argwere missing.Apply the same rule to function pointer types.
Closes#35203
[breaking-change], no breakage in sane code is expected though
r? @nikomatsakis
This is somewhat related to rust-lang/rfcs#1685 (cc @matklad).
The goal is to eventually support full pattern syntax where it makes sense (function body may present) and to support only the following forms -
TYPE,ident: TYPE,_: TYPE- where patterns don't make sense (function body doesn't present), i.e. in foreign functions and function pointer types.