<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/compiler/rustc_parse/src/parser/expr.rs, branch 1.65.0</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=1.65.0</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=1.65.0'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2022-10-27T14:53:42+00:00</updated>
<entry>
<title>Revert "Do not consider method call receiver as an argument in AST."</title>
<updated>2022-10-27T14:53:42+00:00</updated>
<author>
<name>Michael Goulet</name>
<email>michael@errs.io</email>
</author>
<published>2022-10-27T14:53:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=85dee2b354cf06ec24b00e61fc70cf88d27b1cd9'/>
<id>urn:sha1:85dee2b354cf06ec24b00e61fc70cf88d27b1cd9</id>
<content type='text'>
This reverts commit 970184528718d7c10579cac7b7e7e66ef2e2a3f5.
</content>
</entry>
<entry>
<title>Rollup merge of #101502 - TaKO8Ki:do-not-suggest-semicolon-for-macro-without-exclamation-mark, r=wesleywiser</title>
<updated>2022-09-07T19:48:15+00:00</updated>
<author>
<name>Matthias Krüger</name>
<email>matthias.krueger@famsik.de</email>
</author>
<published>2022-09-07T19:48:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=c365ce3ffddd05d85c55bdbcdb30a1106baf6072'/>
<id>urn:sha1:c365ce3ffddd05d85c55bdbcdb30a1106baf6072</id>
<content type='text'>
Do not suggest a semicolon for a macro without `!`

Fixes a regression in #101490
</content>
</entry>
<entry>
<title>do not suggest a semicolon for a macro without `!`</title>
<updated>2022-09-06T18:59:47+00:00</updated>
<author>
<name>Takayuki Maeda</name>
<email>takoyaki0316@gmail.com</email>
</author>
<published>2022-09-06T18:59:47+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=7ac124803f696b7e28d9fdae2f676093024de378'/>
<id>urn:sha1:7ac124803f696b7e28d9fdae2f676093024de378</id>
<content type='text'>
</content>
</entry>
<entry>
<title>UPDATE - into_diagnostic to take a Handler instead of a ParseSess</title>
<updated>2022-09-05T06:18:45+00:00</updated>
<author>
<name>Jhonny Bill Mena</name>
<email>jhonnybillm@gmail.com</email>
</author>
<published>2022-09-05T04:15:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=321e60bf3429d32c5ab1d03f22e3e4654bc0c388'/>
<id>urn:sha1:321e60bf3429d32c5ab1d03f22e3e4654bc0c388</id>
<content type='text'>
Suggested by the team in this Zulip Topic https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20SessionDiagnostic.20on.20Handler

Handler already has almost all the capabilities of ParseSess when it comes to diagnostic emission, in this migration we only needed to add the ability to access source_map from the emitter in order to get a Snippet and the start_point. Not sure if this is the best way to address this gap
</content>
</entry>
<entry>
<title>Auto merge of #100869 - nnethercote:replace-ThinVec, r=spastorino</title>
<updated>2022-09-01T08:01:06+00:00</updated>
<author>
<name>bors</name>
<email>bors@rust-lang.org</email>
</author>
<published>2022-09-01T08:01:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=eac6c33bc6338f40e66975dd6f65dab27765067b'/>
<id>urn:sha1:eac6c33bc6338f40e66975dd6f65dab27765067b</id>
<content type='text'>
Replace `rustc_data_structures::thin_vec::ThinVec` with `thin_vec::ThinVec`

`rustc_data_structures::thin_vec::ThinVec` looks like this:
```
pub struct ThinVec&lt;T&gt;(Option&lt;Box&lt;Vec&lt;T&gt;&gt;&gt;);
```
It's just a zero word if the vector is empty, but requires two
allocations if it is non-empty. So it's only usable in cases where the
vector is empty most of the time.

This commit removes it in favour of `thin_vec::ThinVec`, which is also
word-sized, but stores the length and capacity in the same allocation as
the elements. It's good in a wider variety of situation, e.g. in enum
variants where the vector is usually/always non-empty.

The commit also:
- Sorts some `Cargo.toml` dependency lists, to make additions easier.
- Sorts some `use` item lists, to make additions easier.
- Changes `clean_trait_ref_with_bindings` to take a
  `ThinVec&lt;TypeBinding&gt;` rather than a `&amp;[TypeBinding]`, because this
  avoid some unnecessary allocations.

r? `@spastorino`
</content>
</entry>
<entry>
<title>Fix a bunch of typo</title>
<updated>2022-08-31T10:24:55+00:00</updated>
<author>
<name>Dezhi Wu</name>
<email>wu543065657@163.com</email>
</author>
<published>2022-08-18T02:13:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=b1430fb7ca499d517d9f4b3b6c5a81442129c88b'/>
<id>urn:sha1:b1430fb7ca499d517d9f4b3b6c5a81442129c88b</id>
<content type='text'>
This PR will fix some typos detected by [typos].

I only picked the ones I was sure were spelling errors to fix, mostly in
the comments.

[typos]: https://github.com/crate-ci/typos
</content>
</entry>
<entry>
<title>Revert let_chains stabilization</title>
<updated>2022-08-29T17:34:11+00:00</updated>
<author>
<name>Nilstrieb</name>
<email>48135649+Nilstrieb@users.noreply.github.com</email>
</author>
<published>2022-08-20T18:40:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d1ef8180f956c9f1a7267e32491d65188f0aefd7'/>
<id>urn:sha1:d1ef8180f956c9f1a7267e32491d65188f0aefd7</id>
<content type='text'>
This reverts commit 326646074940222d602f3683d0559088690830f4.

This is the revert against master, the beta revert was already done in #100538.
</content>
</entry>
<entry>
<title>Improve `parse_dot_or_call_expr_with`.</title>
<updated>2022-08-29T05:42:16+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2022-08-23T03:28:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=c768617f6fae82388df9ac1a5907c30fcba3ef44'/>
<id>urn:sha1:c768617f6fae82388df9ac1a5907c30fcba3ef44</id>
<content type='text'>
Avoid all the extra work in the very common case where `attrs` is empty.
</content>
</entry>
<entry>
<title>Rollup merge of #99332 - jyn514:stabilize-label-break-value, r=petrochenkov</title>
<updated>2022-08-24T23:50:54+00:00</updated>
<author>
<name>Yuki Okushi</name>
<email>jtitor@2k36.org</email>
</author>
<published>2022-08-24T23:50:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=f4550a6edfcbb1e284d9eb1d095f034848e1ee01'/>
<id>urn:sha1:f4550a6edfcbb1e284d9eb1d095f034848e1ee01</id>
<content type='text'>
Stabilize `#![feature(label_break_value)]`

See the stabilization report in https://github.com/rust-lang/rust/issues/48594#issuecomment-1186213313.
</content>
</entry>
<entry>
<title>Stabilize `#![feature(label_break_value)]`</title>
<updated>2022-08-24T02:14:12+00:00</updated>
<author>
<name>Joshua Nelson</name>
<email>jnelson@cloudflare.com</email>
</author>
<published>2022-07-14T13:30:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=31e39446ec2f251efbcaf9eb22c80e93021f9bbc'/>
<id>urn:sha1:31e39446ec2f251efbcaf9eb22c80e93021f9bbc</id>
<content type='text'>
 # Stabilization proposal

The feature was implemented in https://github.com/rust-lang/rust/pull/50045 by est31 and has been in nightly since 2018-05-16 (over 4 years now).
There are [no open issues][issue-label] other than the tracking issue. There is a strong consensus that `break` is the right keyword and we should not use `return`.

There have been several concerns raised about this feature on the tracking issue (other than the one about tests, which has been fixed, and an interaction with try blocks, which has been fixed).
1. nrc's original comment about cost-benefit analysis: https://github.com/rust-lang/rust/issues/48594#issuecomment-422235234
2. joshtriplett's comments about seeing use cases: https://github.com/rust-lang/rust/issues/48594#issuecomment-422281176
3. withoutboats's comments that Rust does not need more control flow constructs: https://github.com/rust-lang/rust/issues/48594#issuecomment-450050630

Many different examples of code that's simpler using this feature have been provided:
- A lexer by rpjohnst which must repeat code without label-break-value: https://github.com/rust-lang/rust/issues/48594#issuecomment-422502014
- A snippet by SergioBenitez which avoids using a new function and adding several new return points to a function: https://github.com/rust-lang/rust/issues/48594#issuecomment-427628251. This particular case would also work if `try` blocks were stabilized (at the cost of making the code harder to optimize).
- Several examples by JohnBSmith: https://github.com/rust-lang/rust/issues/48594#issuecomment-434651395
- Several examples by Centril: https://github.com/rust-lang/rust/issues/48594#issuecomment-440154733
- An example by petrochenkov where this is used in the compiler itself to avoid duplicating error checking code: https://github.com/rust-lang/rust/issues/48594#issuecomment-443557569
- Amanieu recently provided another example related to complex conditions, where try blocks would not have helped: https://github.com/rust-lang/rust/issues/48594#issuecomment-1184213006

Additionally, petrochenkov notes that this is strictly more powerful than labelled loops due to macros which accidentally exit a loop instead of being consumed by the macro matchers: https://github.com/rust-lang/rust/issues/48594#issuecomment-450246249

nrc later resolved their concern, mostly because of the aforementioned macro problems.
joshtriplett suggested that macros could be able to generate IR directly
(https://github.com/rust-lang/rust/issues/48594#issuecomment-451685983) but there are no open RFCs,
and the design space seems rather speculative.

joshtriplett later resolved his concerns, due to a symmetry between this feature and existing labelled break: https://github.com/rust-lang/rust/issues/48594#issuecomment-632960804

withoutboats has regrettably left the language team.

joshtriplett later posted that the lang team would consider starting an FCP given a stabilization report: https://github.com/rust-lang/rust/issues/48594#issuecomment-1111269353

[issue-label]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3AF-label_break_value+

 ## Report

+ Feature gate:
    - https://github.com/rust-lang/rust/blob/d695a497bbf4b20d2580b75075faa80230d41667/src/test/ui/feature-gates/feature-gate-label_break_value.rs
+ Diagnostics:
    - https://github.com/rust-lang/rust/blob/6b2d3d5f3cd1e553d87b5496632132565b6779d3/compiler/rustc_parse/src/parser/diagnostics.rs#L2629
    - https://github.com/rust-lang/rust/blob/f65bf0b2bb1a99f73095c01a118f3c37d3ee614c/compiler/rustc_resolve/src/diagnostics.rs#L749
    - https://github.com/rust-lang/rust/blob/f65bf0b2bb1a99f73095c01a118f3c37d3ee614c/compiler/rustc_resolve/src/diagnostics.rs#L1001
    - https://github.com/rust-lang/rust/blob/111df9e6eda1d752233482c1309d00d20a4bbf98/compiler/rustc_passes/src/loops.rs#L254
    - https://github.com/rust-lang/rust/blob/d695a497bbf4b20d2580b75075faa80230d41667/compiler/rustc_parse/src/parser/expr.rs#L2079
    - https://github.com/rust-lang/rust/blob/d695a497bbf4b20d2580b75075faa80230d41667/compiler/rustc_parse/src/parser/expr.rs#L1569
+ Tests:
    - https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_continue.rs
    - https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_unlabeled_break.rs
    - https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_illegal_uses.rs
    - https://github.com/rust-lang/rust/blob/master/src/test/ui/lint/unused_labels.rs
    - https://github.com/rust-lang/rust/blob/master/src/test/ui/run-pass/for-loop-while/label_break_value.rs

 ## Interactions with other features

Labels follow the hygiene of local variables.

label-break-value is permitted within `try` blocks:
```rust
let _: Result&lt;(), ()&gt; = try {
    'foo: {
        Err(())?;
        break 'foo;
    }
};
```

label-break-value is disallowed within closures, generators, and async blocks:
```rust
'a: {
    || break 'a
    //~^ ERROR use of unreachable label `'a`
    //~| ERROR `break` inside of a closure
}
```

label-break-value is disallowed on [_BlockExpression_]; it can only occur as a [_LoopExpression_]:
```rust
fn labeled_match() {
    match false 'b: { //~ ERROR block label not supported here
        _ =&gt; {}
    }
}

macro_rules! m {
    ($b:block) =&gt; {
        'lab: $b; //~ ERROR cannot use a `block` macro fragment here
        unsafe $b; //~ ERROR cannot use a `block` macro fragment here
        |x: u8| -&gt; () $b; //~ ERROR cannot use a `block` macro fragment here
    }
}

fn foo() {
    m!({});
}
```

[_BlockExpression_]: https://doc.rust-lang.org/nightly/reference/expressions/block-expr.html
[_LoopExpression_]: https://doc.rust-lang.org/nightly/reference/expressions/loop-expr.html
</content>
</entry>
</feed>
