Commit Graph

6993 Commits

Author SHA1 Message Date
Vadim Petrochenkov 8640a51ff8 Implement multiple patterns with | in if let and while let 2018-02-24 03:12:35 +03:00
bors 063deba92e Auto merge of #47799 - topecongiro:fix-span-of-visibility, r=petrochenkov
Fix span of visibility

This PR

1. adds a closing parenthesis to the span of `Visibility::Crate` (e.g. `pub(crate)`). The current span only covers `pub(crate`.
2. adds a `span` field to `Visibility::Restricted`. This span covers the entire visibility expression (e.g. `pub (in self)`). Currently all we can have is a span for `Path`.

This PR is motivated by the bug found in rustfmt (https://github.com/rust-lang-nursery/rustfmt/issues/2398).

The first change is a strict improvement IMHO. The second change may not be desirable, as it adds a field which is currently not used by the compiler.
2018-02-23 11:21:29 +00:00
Mark Simulacrum 33f5ceee1f stage0 cfg cleanup 2018-02-20 08:52:33 -07:00
Guillaume Gomez af140ecdbc Rollup merge of #48275 - matthiaskrgr:codespell, r=kennytm,varkor
fix more typos found by codespell.
2018-02-18 13:21:01 +01:00
Matthias Krüger 4452446292 fix more typos found by codespell. 2018-02-17 17:38:49 +01:00
Seiichi Uchida 291c51b9c8 Fix up tests and typos 2018-02-18 00:10:40 +09:00
Seiichi Uchida b5099a708d Replace dummy spans with empty spans 2018-02-18 00:10:40 +09:00
Seiichi Uchida d6bdf296a4 Change ast::Visibility to Spanned type 2018-02-18 00:10:40 +09:00
Seiichi Uchida 0bddba9248 Add a span field to Visibility::Restricted
This span covers the whole visibility expression: e.g. `pub (in path)`.
2018-02-18 00:10:40 +09:00
Seiichi Uchida 01a70c6589 Add a closing parenthesis to the span of Visibility::Crate 2018-02-18 00:10:40 +09:00
Alex Crawford c670ae67b6 Remove unneeded string allocations 2018-02-16 15:23:28 -08:00
kennytm dc9d93f220 Rollup merge of #48167 - Mark-Simulacrum:remove-allocation-codemap, r=estebank
Remove allocation from width of character function.

Locally this seems to eliminate the problem or at least resolve most of the
issue.

Fixes #48153.

r? @estebank
2018-02-14 18:25:27 +08:00
kennytm dcb15269f6 Rollup merge of #48154 - estebank:issue-31481, r=nikomatsakis
Continue parsing function after finding `...` arg

When encountering a variadic argument in a function definition that
doesn't accept it, if immediately after there's a closing paren,
continue parsing as normal. Otherwise keep current behavior of emitting
error and stopping.

Fix #31481.
2018-02-14 18:25:21 +08:00
kennytm 3bcaaf47a1 Rollup merge of #48130 - ollie27:stab, r=Mark-Simulacrum
Correct a few stability attributes

* `core_float_bits`, `duration_core`, `path_component_asref`, and `repr_align` were stabalized in 1.25.0 not 1.24.0.
* Impls for `NonNull` involving unstable things should remain unstable.
* `Duration` should remain stable since 1.3.0 so it appears correctly in the `std` docs.
* `cursor_mut_vec` is an impl on only stable things so should be marked stable.
2018-02-14 18:25:16 +08:00
Mark Simulacrum f237e9e2e7 Remove allocation from width of character function. 2018-02-12 12:28:32 -07:00
Esteban Küber f7cabc6550 Continue parsing function after finding ... arg
When encountering a variadic argument in a function definition that
doesn't accept it, if immediately after there's a closing paren,
continue parsing as normal. Otherwise keep current behavior of emitting
error and stopping.
2018-02-11 22:10:35 -08:00
bors b8398d947d Auto merge of #47752 - mark-i-m:at-most-once-rep, r=nikomatsakis
Implement `?` macro repetition

See rust-lang/rfcs#2298 (with disposition merge)
2018-02-11 18:11:01 +00:00
Oliver Middleton 45d5a420ad Correct a few stability attributes 2018-02-10 21:20:42 +00:00
Mark Mansi 4cf3b65714 Use the right tracking issue 2018-02-08 18:40:00 -06:00
Alex Crichton 35dca7edd3 Add rustc_args_required_const to the feature whitelist
Unfortunately left out it means that when the `#![feature(proc_macro)]` flag is
in effect it fails to find `rustc_args_required_const` for expansion. This
version, however, is verified to work with stdsimd's requirements!
2018-02-08 13:38:58 -08:00
Manish Goregaokar aee22556a9 Rollup merge of #47613 - estebank:rustc_on_unimplemented, r=nikomatsakis
Add filtering options to `rustc_on_unimplemented`

- Add filtering options to `rustc_on_unimplemented` for local traits, filtering on `Self` and type arguments.
- Add a way to provide custom notes.
- Tweak binops text.
- Add filter to detect wether `Self` is local or belongs to another crate.
- Add filter to `Iterator` diagnostic for `&str`.

Partly addresses #44755 with a different syntax, as a first approach. Fixes #46216, fixes #37522, CC #34297, #46806.
2018-02-07 08:30:47 -08:00
Pietro Albini 01f0814a2a Stabilize use_nested_groups 2018-02-05 10:23:40 +01:00
kennytm 1439c2ac35 Rollup merge of #47947 - goodmanjonathan:stabilize_match_beginning_vert, r=petrochenkov
Stabilize feature(match_beginning_vert)

With this feature stabilized, match expressions can optionally have a `|` at the beginning of each arm.

Reference PR: rust-lang-nursery/reference#231

Closes #44101
2018-02-04 23:28:58 +08:00
bors 3d292b793a Auto merge of #47845 - Zoxc:gen-fixes, r=nikomatsakis
Generator bugfixes

r? @nikomatsakis
2018-02-03 17:28:08 +00:00
kennytm b4b73a1d95 Rollup merge of #47914 - etaoins:improve-char-escape-in-lexer-msg, r=petrochenkov Improve char escaping in lexer messages Currently ', " and \ are escaped as \', \" and \\ respectively. This leads to confusing messages such as error: unknown start of token: \\ when encountering a single backslash. Fix by emitting printable ASCII characters directly. This will still escape \r, \n, \t and Unicode characters. Fixes #47902 2018-02-02 22:48:46 +08:00
bors 616b66dca2 Auto merge of #47465 - estebank:include-space-after-mut, r=nikomatsakis
Include space in suggestion `mut` in bindings

Fix #46614.
2018-02-02 04:19:12 +00:00
Esteban Küber fd3f2312a7 Fix test after rebase 2018-02-01 15:16:02 -08:00
Esteban Küber 378e73e6db Remove support for Self in attributes 2018-02-01 15:06:23 -08:00
Esteban Küber f7c61783e4 Fix tests 2018-02-01 15:06:22 -08:00
Esteban Küber 27a23db660 Rework parse_ident_attr 2018-02-01 15:06:22 -08:00
Esteban Küber c1383e4dc4 Add filtering options to rustc_on_unimplemented
- filter error on the evaluated value of `Self`
 - filter error on the evaluated value of the type arguments
 - add argument to include custom note in diagnostic
 - allow the parser to parse `Self` when processing attributes
 - add custom message to binops
2018-02-01 15:06:20 -08:00
Esteban Küber df412ce208 Change offset to 0 2018-02-01 12:18:15 -08:00
bors 26792f0607 Auto merge of #47540 - Manishearth:suggestion, r=nrc
Add approximate suggestions for rustfix

This adds `span_approximate_suggestion()` that lets you emit a
suggestion marked as "non-machine applicable" in the JSON output. UI
users see no difference. This is for when rustc and clippy wish to
 emit suggestions which will make sense to the reader (e.g. they may
have placeholders like `<type>`) but are not source-applicable, so that
rustfix/etc can ignore these.

fixes #39254
2018-02-01 04:47:46 +00:00
Ryan Cumming b9441f2428 Improve char escaping in lexer messages
Currently ', " and \ are escaped as \', \" and \\ respectively. This
leads to confusing messages such as `error: unknown start of token: \\`
when encountering a single backslash.

Fix by emitting printable ASCII characters directly. This will still
escape \r, \n, \t and Unicode characters.

Fixes #47902
2018-02-01 08:19:22 +11:00
bors 560a2f4faf Auto merge of #45752 - estebank:highlight-primary, r=nikomatsakis
Highlight code on diagnostics when underlined

Highlight the label's span with the respective color:

<img width="692" alt="" src="https://user-images.githubusercontent.com/1606434/32411026-a1842482-c18d-11e7-9933-6510eefbad19.png">

Fix #42112.
2018-01-31 07:53:57 +00:00
Mark Mansi 549534e438 Update a few comments 2018-01-30 16:20:46 -06:00
Jonathan Goodman a99b5db56a stabilize match_beginning_vert 2018-01-30 16:00:55 -06:00
Mark Mansi 786b2ca155 Fix trailing whitespace 2018-01-30 12:45:35 -06:00
Mark Mansi 3859eca851 Improved tests + typo fixes + assert 2018-01-30 12:42:51 -06:00
Mark Mansi 3c15405c25 Add feature gate + tests 2018-01-30 12:42:51 -06:00
Mark Mansi 51ef7393ef Fix typo in error message + update tests 2018-01-30 12:41:04 -06:00
Mark Mansi f59b821944 Attempted fix for ? kleene op 2018-01-30 12:41:04 -06:00
Mark Mansi 5ac48ec826 Run rustfmt on macro_parser.rs 2018-01-30 12:38:02 -06:00
Mark Mansi c33649cd8e Run rustfmt on quoted.rs 2018-01-30 12:32:41 -06:00
Mark Mansi bb8110c1fc Update the macro parser to allow at most once repetitions for ? Kleene 2018-01-30 12:30:41 -06:00
Mark Mansi 760879bc88 Allow ? as a KleeneOp in the macro parser 2018-01-30 12:30:41 -06:00
John Kåre Alsaker 6c66e11ff8 The static keyword can now begin expressions 2018-01-30 12:50:42 +01:00
bors def3269a71 Auto merge of #47870 - kennytm:rollup, r=kennytm
Rollup of 12 pull requests

- Successful merges: #47515, #47603, #47718, #47732, #47760, #47780, #47822, #47826, #47836, #47839, #47853, #47855
- Failed merges:
2018-01-30 11:10:06 +00:00
kennytm f06a391a40 Rollup merge of #47732 - mark-i-m:markim_comments_0001, r=jseyfried
Run rustfmt and add doc comments to libsyntax/ext/tt/macro_parser.rs

Similar to #47603

cc @theotherphil since you reviewed my other PR 😄

And because they are already assigned on #47603:

r? @arielb1
2018-01-30 17:10:52 +08:00
kennytm 3e39180706 Rollup merge of #47603 - mark-i-m:markim_comments_0000, r=jseyfried
Run rustfmt and add doc comments to libsyntax/ext/tt/quoted.rs

I was already going to try to understand this code to try to implement rust-lang/rfcs#2298. I figured I would put that knowledge into comments and share... This PR contains _no changes_ to the code itself -- just formatting and comments.

I'm not sure what the best way to do this is. I plan to make more such PR for other files, but I figured it would have fewer conflicts if I do it file by file...
2018-01-30 17:10:49 +08:00