Skip to content

Conversation

@tobz1000
Copy link
Contributor

@tobz1000 tobz1000 commented Feb 6, 2020

Fixes #2847.

  • Fn__(...) parameters with idents/patterns no longer parse
  • Trait function parameters with arbitrary patterns parse
  • Trait function parameters without idents/patterns no longer parse
  • fn(...) parameters no longer parse with patterns other than a single ident

Question: The pre-existing test param_list_opt_patterns has been kept as-is, although the name no longer makes sense (it's testing Fn__(...) params, which aren't allowed patterns any more). What would be best to do about this?

- `Fn__(...)` parameters with idents/patterns no longer parse
- Trait function parameters with arbitrary patterns parse
- Trait function parameters without idents/patterns no longer parse
- `fn(...)` parameters no longer parse with patterns other than a single ident
@@ -1 +1 @@
type F = Box<Fn(a: i32, &b: &i32, &mut c: &i32, ())>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, this was never allowed in the first place? 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add some code to test all code which should compile with rustc too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That could be a good catch-all, but I think a lot of existing tests won't compile due to undefined symbols, rather than syntax errors.

@matklad
Copy link
Contributor

matklad commented Feb 7, 2020

bors r+

bors bot added a commit that referenced this pull request Feb 7, 2020
3040: Rework value parameter parsing r=matklad a=tobz1000

Fixes #2847.

- `Fn__(...)` parameters with idents/patterns no longer parse
- Trait function parameters with arbitrary patterns parse
- Trait function parameters without idents/patterns no longer parse
- `fn(...)` parameters no longer parse with patterns other than a single ident

__Question__: The pre-existing test `param_list_opt_patterns` has been kept as-is, although the name no longer makes sense (it's testing `Fn__(...)` params, which aren't allowed patterns any more). What would be best to do about this?

Co-authored-by: Toby Dimmick <tobydimmick@pm.me>
@bors
Copy link
Contributor

bors bot commented Feb 7, 2020

Build succeeded

  • Rust (macos-latest)
  • Rust (ubuntu-latest)
  • Rust (windows-latest)
  • TypeScript

@bors bors bot merged commit 90ff2be into rust-lang:master Feb 7, 2020
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.

Syntax error on trait fns with destructured args

3 participants