]> git.lizzy.rs Git - rust.git/log
rust.git
21 months agoadd comment explaining read permissions
Sikkema, Isaac [Tue, 20 Sep 2022 14:06:50 +0000 (10:06 -0400)]
add comment explaining read permissions

22 months agouse `File::options()` instead of `File::create()`
Sikkema, Isaac [Thu, 25 Aug 2022 22:00:45 +0000 (18:00 -0400)]
use `File::options()` instead of `File::create()`

22 months agoAuto merge of #100571 - cjgillot:mir-cost-visit, r=compiler-errors
bors [Thu, 25 Aug 2022 08:16:43 +0000 (08:16 +0000)]
Auto merge of #100571 - cjgillot:mir-cost-visit, r=compiler-errors

Check projection types before inlining MIR

Fixes https://github.com/rust-lang/rust/issues/100550

I'm very unhappy with this solution, having to duplicate MIR validation code, but at least it removes the ICE.

r? `@compiler-errors`

22 months agoAuto merge of #100436 - jyn514:macro-query-system, r=cjgillot
bors [Thu, 25 Aug 2022 05:35:27 +0000 (05:35 +0000)]
Auto merge of #100436 - jyn514:macro-query-system, r=cjgillot

try and simplify some things in the query system

22 months agoAuto merge of #100977 - JohnTitor:rollup-8hc7rxh, r=JohnTitor
bors [Thu, 25 Aug 2022 02:32:11 +0000 (02:32 +0000)]
Auto merge of #100977 - JohnTitor:rollup-8hc7rxh, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #99332 (Stabilize `#![feature(label_break_value)]`)
 - #99954 (let-else: break out to one scope higher for let-else)
 - #100188 (Parser will not suggest invalid expression when use public)
 - #100780 (save_analysis: Migrate diagnostic)
 - #100808 (Migrate `rustc_interface` diagnostics )
 - #100921 (Add a warning about `Option/Result::and()` being eagerly evaluated)
 - #100960 (rustdoc: ayu code color selector more specific)
 - #100964 (Sync rustc_codegen_cranelift)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

22 months agoAuto merge of #99946 - tmiasko:elide-storage-makers, r=oli-obk
bors [Wed, 24 Aug 2022 23:51:06 +0000 (23:51 +0000)]
Auto merge of #99946 - tmiasko:elide-storage-makers, r=oli-obk

Elide superfluous storage markers

Follow the existing strategy of omitting the storage markers for temporaries
introduced for internal usage when elaborating derefs and deref projections.

Those temporaries are simple scalars which are used immediately after being
defined and never have their address taken. There is no benefit from storage
markers from either liveness analysis or code generation perspective.

22 months agoRollup merge of #100964 - bjorn3:sync_cg_clif-2022-08-24, r=bjorn3
Yuki Okushi [Wed, 24 Aug 2022 23:51:01 +0000 (08:51 +0900)]
Rollup merge of #100964 - bjorn3:sync_cg_clif-2022-08-24, r=bjorn3

Sync rustc_codegen_cranelift

The main highlights this time are support for parallel compilation of codegen units (by me) and improved windows support (by ``@afonso360)`` In addition ``@afonso360`` added abi-checker to cg_clif's CI. This has already catched an abi compatibility issue with AArch64. The fix has landed on Cranelift's main branch, but doesn't yet have a release. ``@uweigand`` also submitted a couple of PR's that will are prerequisites for supporting IBM's s390x architecture.

r? ``@ghost``

``@rustbot`` label +A-codegen +A-cranelift +T-compiler

22 months agoRollup merge of #100960 - rust-lang:notriddle/ayu-span-code, r=GuillaumeGomez
Yuki Okushi [Wed, 24 Aug 2022 23:51:00 +0000 (08:51 +0900)]
Rollup merge of #100960 - rust-lang:notriddle/ayu-span-code, r=GuillaumeGomez

rustdoc: ayu code color selector more specific

According to https://github.com/rust-lang/rust/pull/100960#issuecomment-1225970579, this selector is only really intended to apply to item info. However, it's so broad that it's hard to tell when it deliberately applies vs where it accidentally applies.

22 months agoRollup merge of #100921 - ChayimFriedman2:and-eager-eval, r=JohnTitor
Yuki Okushi [Wed, 24 Aug 2022 23:50:59 +0000 (08:50 +0900)]
Rollup merge of #100921 - ChayimFriedman2:and-eager-eval, r=JohnTitor

Add a warning about `Option/Result::and()` being eagerly evaluated

Copied from `or()`.

Inspired by [this StackOverflow question](https://stackoverflow.com/questions/73461846/why-is-in-rust-the-expression-in-option-and-evaluated-if-option-is-none).

[The PR for `or()`](https://github.com/rust-lang/rust/pull/46548) mentions the Clippy lint `or_fun_call` which doesn't exist for `and()` (although there is `unnecessary_lazy_evaluations`). I still think this warning is also good for `and()`. Feel free to close if you disagree.

22 months agoRollup merge of #100808 - SkiFire13:migrate_diagnostics_rustc_interface, r=davidtwco
Yuki Okushi [Wed, 24 Aug 2022 23:50:58 +0000 (08:50 +0900)]
Rollup merge of #100808 - SkiFire13:migrate_diagnostics_rustc_interface, r=davidtwco

Migrate `rustc_interface` diagnostics

``@rustbot`` label +A-translation

r? rust-lang/diagnostics
cc #100717

22 months agoRollup merge of #100780 - wonchulee:translation_save_analysis, r=davidtwco
Yuki Okushi [Wed, 24 Aug 2022 23:50:57 +0000 (08:50 +0900)]
Rollup merge of #100780 - wonchulee:translation_save_analysis, r=davidtwco

save_analysis: Migrate diagnostic

* Migrate the `rustc_save_analysis` crate's diagnostic to translatable diagnostic structs.

Depends on https://github.com/rust-lang/rust/pull/100694 and https://github.com/rust-lang/rust/pull/100754 for #[fatal(..)] support, then https://github.com/rust-lang/rust/commit/aa68eb4179881ed25106e675a6a224746f8fad5f, https://github.com/rust-lang/rust/commit/f5219a396083b764f3741e9e105685323a745ce8, https://github.com/rust-lang/rust/commit/7da52f694a4ff7c4b9870415584f2c86cec5ce62 can be removed. (I copied commits from https://github.com/rust-lang/rust/pull/100754)

22 months agoRollup merge of #100188 - chenyukang:fix-issue-100165, r=estebank
Yuki Okushi [Wed, 24 Aug 2022 23:50:56 +0000 (08:50 +0900)]
Rollup merge of #100188 - chenyukang:fix-issue-100165, r=estebank

Parser will not suggest invalid expression when use public

Fixes #100165

22 months agoRollup merge of #99954 - dingxiangfei2009:break-out-let-else-higher-up, r=oli-obk
Yuki Okushi [Wed, 24 Aug 2022 23:50:55 +0000 (08:50 +0900)]
Rollup merge of #99954 - dingxiangfei2009:break-out-let-else-higher-up, r=oli-obk

let-else: break out to one scope higher for let-else

```@est31``` This PR follows up with #99518 which is to break out to the last remainder scope. It breaks to the out-most `region_scope` of the block if the first statement is a `let-else`.

22 months agoRollup merge of #99332 - jyn514:stabilize-label-break-value, r=petrochenkov
Yuki Okushi [Wed, 24 Aug 2022 23:50:54 +0000 (08:50 +0900)]
Rollup merge of #99332 - jyn514:stabilize-label-break-value, r=petrochenkov

Stabilize `#![feature(label_break_value)]`

See the stabilization report in https://github.com/rust-lang/rust/issues/48594#issuecomment-1186213313.

22 months agoAuto merge of #100963 - matthiaskrgr:rollup-pjr0lb3, r=matthiaskrgr
bors [Wed, 24 Aug 2022 19:54:22 +0000 (19:54 +0000)]
Auto merge of #100963 - matthiaskrgr:rollup-pjr0lb3, r=matthiaskrgr

Rollup of 15 pull requests

Successful merges:

 - #99993 (linker: Update some outdated comments)
 - #100220 (Properly forward `ByRefSized::fold` to the inner iterator)
 - #100826 (sugg: take into count the debug formatting)
 - #100855 (Extra documentation for new formatting feature)
 - #100888 (Coherence negative impls implied bounds)
 - #100901 (Make some methods private)
 - #100906 (Suggest alternatives when trying to mutate a `HashMap`/`BTreeMap` via indexing)
 - #100912 (Diagnose missing includes in run-make tests)
 - #100919 (Use par_body_owners for liveness)
 - #100922 (Rewrite error index generator to greatly reduce the size of the pages)
 - #100926 (Update README.md)
 - #100930 (Use `--userns=keep-id` when "docker" is really podman)
 - #100938 (rustdoc: remove unused CSS rule)
 - #100940 (Do not suggest adding a bound to a opaque type)
 - #100945 (Add a missing test case for impl generic mismatch)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

22 months agorustdoc: ayu code color selector more specific
Michael Howell [Wed, 24 Aug 2022 16:01:35 +0000 (09:01 -0700)]
rustdoc: ayu code color selector more specific

According to https://github.com/rust-lang/rust/pull/100960#issuecomment-1225970579,
this selector is only really intended to apply to item info. However,
it's so broad that it's hard to tell when it deliberately applies vs where it
accidentally applies.

22 months agoRustfmt
bjorn3 [Wed, 24 Aug 2022 17:06:47 +0000 (17:06 +0000)]
Rustfmt

22 months agoAdd new allowed deps
bjorn3 [Wed, 24 Aug 2022 17:06:37 +0000 (17:06 +0000)]
Add new allowed deps

22 months agoAuto merge of #100803 - klensy:do-not-encode-preinterned-symbols, r=bjorn3
bors [Wed, 24 Aug 2022 16:56:32 +0000 (16:56 +0000)]
Auto merge of #100803 - klensy:do-not-encode-preinterned-symbols, r=bjorn3

Symbols: do not write string values of preinterned symbols into compiled artifacts

r? `@bjorn3`

Followup for #98851

https://github.com/rust-lang/rust/pull/98851#issuecomment-1215606291

22 months agoMerge commit 'e9d1a0a7b0b28dd422f1a790ccde532acafbf193' into sync_cg_clif-2022-08-24
bjorn3 [Wed, 24 Aug 2022 16:40:58 +0000 (18:40 +0200)]
Merge commit 'e9d1a0a7b0b28dd422f1a790ccde532acafbf193' into sync_cg_clif-2022-08-24

22 months agoRustup to rustc 1.65.0-nightly (060e47f74 2022-08-23)
bjorn3 [Wed, 24 Aug 2022 16:37:37 +0000 (18:37 +0200)]
Rustup to rustc 1.65.0-nightly (060e47f74 2022-08-23)

22 months agoSync from rust 4a24f08ba43166cfee86d868b3fe8612aec6faca
bjorn3 [Wed, 24 Aug 2022 16:29:45 +0000 (18:29 +0200)]
Sync from rust 4a24f08ba43166cfee86d868b3fe8612aec6faca

22 months agoRollup merge of #100945 - TaKO8Ki:add-missing-test-case-for-impl-generic-mismatch...
Matthias Krüger [Wed, 24 Aug 2022 16:20:21 +0000 (18:20 +0200)]
Rollup merge of #100945 - TaKO8Ki:add-missing-test-case-for-impl-generic-mismatch, r=Dylan-DPC

Add a missing test case for impl generic mismatch

This suggestion use different span depending on whether the method has generics or not, so I added a test case about the method with some generics.

22 months agoRollup merge of #100940 - TaKO8Ki:do-not-suggest-adding-bound-to-opaque-type, r=fee1...
Matthias Krüger [Wed, 24 Aug 2022 16:20:20 +0000 (18:20 +0200)]
Rollup merge of #100940 - TaKO8Ki:do-not-suggest-adding-bound-to-opaque-type, r=fee1-dead

Do not suggest adding a bound to a opaque type

fixes #100442

22 months agoRollup merge of #100938 - notriddle:notriddle/fields-table, r=sanxiyn
Matthias Krüger [Wed, 24 Aug 2022 16:20:19 +0000 (18:20 +0200)]
Rollup merge of #100938 - notriddle:notriddle/fields-table, r=sanxiyn

rustdoc: remove unused CSS rule

According to [blame], this rule was added to support enum struct variants. However, enum struct variants don't use tables in their design any more, so this rule does nothing.

[blame]: https://github.com/rust-lang/rust/blame/87991d5f5d72d6baca490141cb890211ba2f3843/src/librustdoc/html/static/css/rustdoc.css#L748

22 months agoRollup merge of #100930 - cuviper:podman-keep-id, r=jyn514
Matthias Krüger [Wed, 24 Aug 2022 16:20:18 +0000 (18:20 +0200)]
Rollup merge of #100930 - cuviper:podman-keep-id, r=jyn514

Use `--userns=keep-id` when "docker" is really podman

Rootless podman creates a separate user namespace, where an inner
`LOCAL_USER_ID` will map to a different subuid range on the host.
The "keep-id" mode maps the current UID directly into the container.

This makes `src/ci/docker/run.sh` work better for testing container
images on systems running podman, where "docker" is just a shim.

22 months agoRollup merge of #100926 - tusharxoxoxo:master, r=Dylan-DPC
Matthias Krüger [Wed, 24 Aug 2022 16:20:17 +0000 (18:20 +0200)]
Rollup merge of #100926 - tusharxoxoxo:master, r=Dylan-DPC

Update README.md

Fixed Small grammatical Errors

22 months agoRollup merge of #100922 - GuillaumeGomez:rewrite-error-index, r=notriddle
Matthias Krüger [Wed, 24 Aug 2022 16:20:16 +0000 (18:20 +0200)]
Rollup merge of #100922 - GuillaumeGomez:rewrite-error-index, r=notriddle

Rewrite error index generator to greatly reduce the size of the pages

Fixes https://github.com/rust-lang/rust/issues/100736.

Instead of having all error codes in a same page (making the DOM way too big), I split the output into multiple files and generated a list of links (if there is an explanation) to the error codes' explanation into the already existing file.

I also used this opportunity to greatly simplify the code. Instead of needing a `build.rs`, I simply imported the file we want and wrote the macro which generates a function containing everything we need. We just need to call it to get the error codes and their explanation (if any). Also, considering the implementations between markdown and HTML formats differed even further, the `Formatter` trait was becoming too problematic so I removed it too.

You can test it [here](https://rustdoc.crud.net/imperio/rewrite-error-index/error-index.html).

cc ``@jsha``
r? ``@notriddle``

22 months agoRollup merge of #100919 - sanxiyn:parallel-liveness, r=oli-obk
Matthias Krüger [Wed, 24 Aug 2022 16:20:15 +0000 (18:20 +0200)]
Rollup merge of #100919 - sanxiyn:parallel-liveness, r=oli-obk

Use par_body_owners for liveness

I did this refactoring while working on something else. Liveness is about bodies, there is no reason to use par_for_each_module here.

Tests are updated because things are visited in a different order. I checked diagnostics are same, just in a different (and IMO, better) order.

22 months agoRollup merge of #100912 - tmiasko:make-include, r=TaKO8Ki
Matthias Krüger [Wed, 24 Aug 2022 16:20:14 +0000 (18:20 +0200)]
Rollup merge of #100912 - tmiasko:make-include, r=TaKO8Ki

Diagnose missing includes in run-make tests

22 months agoRollup merge of #100906 - ChayimFriedman2:map-index-mut, r=davidtwco
Matthias Krüger [Wed, 24 Aug 2022 16:20:13 +0000 (18:20 +0200)]
Rollup merge of #100906 - ChayimFriedman2:map-index-mut, r=davidtwco

Suggest alternatives when trying to mutate a `HashMap`/`BTreeMap` via indexing

The error can be quite confusing to newcomers.

Fixes #100873.

I'm not so sure about the message, open to wording suggestions.

22 months agoRollup merge of #100901 - TaKO8Ki:make-some-methods-private, r=sanxiyn
Matthias Krüger [Wed, 24 Aug 2022 16:20:12 +0000 (18:20 +0200)]
Rollup merge of #100901 - TaKO8Ki:make-some-methods-private, r=sanxiyn

Make some methods private

22 months agoRollup merge of #100888 - spastorino:coherence-negative-impls-implied-bounds, r=lcnr
Matthias Krüger [Wed, 24 Aug 2022 16:20:11 +0000 (18:20 +0200)]
Rollup merge of #100888 - spastorino:coherence-negative-impls-implied-bounds, r=lcnr

Coherence negative impls implied bounds

Fixes #93875

This PR is rebased on top of #100789 and it would need to include that one which is already r+ed.

r? ``@nikomatsakis``

cc ``@lcnr`` (which I've talked about https://github.com/rust-lang/rust/commit/3222f420d9d2312efe0735eb48160c7b070adc54, I guess after you finish your reordering of modules and work with OutlivesEnvironmentEnv this commit can just be reverted).

22 months agoRollup merge of #100855 - IsaacCloos:master, r=joshtriplett
Matthias Krüger [Wed, 24 Aug 2022 16:20:10 +0000 (18:20 +0200)]
Rollup merge of #100855 - IsaacCloos:master, r=joshtriplett

Extra documentation for new formatting feature

Documentation of this feature was added in #90473 and released in Rust 1.58. However, high traffic macros did not receive new examples. Namely `println!()` and `format!()`.

The doc comments included in Rust are super important to the community- especially newcomers. I have met several other newbies like myself who are unaware of this recent (well about 7 months old now) update to the language allowing for convenient intra-string identifiers.

Bringing small examples of this feature to the doc comments of `println!()` and `format!()` would be helpful to everyone learning the language.

[Blog Post Announcing Feature](https://blog.rust-lang.org/2022/01/13/Rust-1.58.0.html)
[Feature PR](https://github.com/rust-lang/rust/pull/90473) - includes several instances of documentation of the feature- minus the macros in question for this PR

*This is my first time contributing to a project this large. Feedback would mean the world to me 😄*

---

*Recreated; I violated the [No-Merge Policy](https://rustc-dev-guide.rust-lang.org/git.html#no-merge-policy)*

22 months agoRollup merge of #100826 - vincenzopalazzo:macros/wrong_sugg_with_positional_arg,...
Matthias Krüger [Wed, 24 Aug 2022 16:20:09 +0000 (18:20 +0200)]
Rollup merge of #100826 - vincenzopalazzo:macros/wrong_sugg_with_positional_arg, r=TaKO8Ki

sugg: take into count the debug formatting

Closes https://github.com/rust-lang/rust/issues/100648

This PR will fix a suggestion error by taking into consideration also the `:?` symbol and act in a different way

``@rustbot`` r? ``@compiler-errors``

N.B: I did not find a full way to test the change, any idea?

22 months agoRollup merge of #100220 - scottmcm:fix-by-ref-sized, r=joshtriplett
Matthias Krüger [Wed, 24 Aug 2022 16:20:08 +0000 (18:20 +0200)]
Rollup merge of #100220 - scottmcm:fix-by-ref-sized, r=joshtriplett

Properly forward `ByRefSized::fold` to the inner iterator

cc ``@timvermeulen,`` who noticed this mistake in https://github.com/rust-lang/rust/pull/100214#issuecomment-1207317625

22 months agoRollup merge of #99993 - petrochenkov:linkdated, r=bjorn3
Matthias Krüger [Wed, 24 Aug 2022 16:20:07 +0000 (18:20 +0200)]
Rollup merge of #99993 - petrochenkov:linkdated, r=bjorn3

linker: Update some outdated comments

r? ``@bjorn3``

22 months agouse a minimized example
Takayuki Maeda [Wed, 24 Aug 2022 15:42:34 +0000 (00:42 +0900)]
use a minimized example

22 months agoMerge pull request #1271 from bjorn3/parallel_comp_support
bjorn3 [Wed, 24 Aug 2022 15:22:30 +0000 (17:22 +0200)]
Merge pull request #1271 from bjorn3/parallel_comp_support

Support compiling codegen units in parallel

22 months agoAdd fixme
bjorn3 [Wed, 24 Aug 2022 14:28:40 +0000 (14:28 +0000)]
Add fixme

22 months agoTune drop_excess_capacity
bjorn3 [Wed, 24 Aug 2022 10:22:01 +0000 (12:22 +0200)]
Tune drop_excess_capacity

22 months agoAuto merge of #100942 - ehuss:update-cargo, r=ehuss
bors [Wed, 24 Aug 2022 05:34:43 +0000 (05:34 +0000)]
Auto merge of #100942 - ehuss:update-cargo, r=ehuss

Update cargo

7 commits in 9809f8ff33c2b998919fd0432c626f0f7323697a..6da726708a4406f31f996d813790818dce837161
2022-08-16 22:10:06 +0000 to 2022-08-23 21:39:56 +0000
- Update non-ASCII crate name warning message (rust-lang/cargo#11017)
- Add more tests for aggressive or precise update (rust-lang/cargo#11011)
- Ignore broken but excluded file during traversing (rust-lang/cargo#11008)
- Improve error message for wrong target names (rust-lang/cargo#10999)
- Bump snapbox to 0.3 (rust-lang/cargo#11005)
- remove missed reference to workspace inheritance in unstable.md (rust-lang/cargo#11001)
- Warning when precise or aggressive without -p flag (rust-lang/cargo#10988)

22 months agoadd a missing test case for impl generic mismatch
Takayuki Maeda [Wed, 24 Aug 2022 05:09:55 +0000 (14:09 +0900)]
add a missing test case for impl generic mismatch

22 months agoUpdate cargo
Eric Huss [Wed, 24 Aug 2022 03:58:12 +0000 (20:58 -0700)]
Update cargo

22 months agoget rid of another unnecessary lifetime macro argument
Joshua Nelson [Fri, 12 Aug 2022 02:35:33 +0000 (21:35 -0500)]
get rid of another unnecessary lifetime macro argument

22 months agoMove most of `make_query` into a generic function, away from the macro
Joshua Nelson [Fri, 12 Aug 2022 01:36:13 +0000 (20:36 -0500)]
Move most of `make_query` into a generic function, away from the macro

This should both make the code easier to read and also greatly reduce the amount of codegen
the compiler has to do, since it only needs to monomorphize `create_query_frame` for each
new key and not for each query.

22 months agodo not suggest adding a bound to a opaque type
Takayuki Maeda [Wed, 24 Aug 2022 02:34:14 +0000 (11:34 +0900)]
do not suggest adding a bound to a opaque type

22 months agoGet rid of some usages of `query_keys`
Joshua Nelson [Fri, 12 Aug 2022 01:20:46 +0000 (20:20 -0500)]
Get rid of some usages of `query_keys`

Rustdoc documents these with the name of the type alias instead of normalizing them to the underlying type.
Use associated types instead so that the generated docs for nightly-rustc are easier to read.

22 months agoRemove `$tcx` metavariable from `rustc_query_append`
Joshua Nelson [Fri, 12 Aug 2022 00:54:42 +0000 (19:54 -0500)]
Remove `$tcx` metavariable from `rustc_query_append`

It's not actually necessary and it makes the code harder to read.

22 months agoStabilize `#![feature(label_break_value)]`
Joshua Nelson [Thu, 14 Jul 2022 13:30:38 +0000 (08:30 -0500)]
Stabilize `#![feature(label_break_value)]`

 # 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<(), ()> = 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
        _ => {}
    }
}

macro_rules! m {
    ($b:block) => {
        'lab: $b; //~ ERROR cannot use a `block` macro fragment here
        unsafe $b; //~ ERROR cannot use a `block` macro fragment here
        |x: u8| -> () $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

22 months agoAuto merge of #96869 - sunfishcode:main, r=joshtriplett
bors [Wed, 24 Aug 2022 01:17:52 +0000 (01:17 +0000)]
Auto merge of #96869 - sunfishcode:main, r=joshtriplett

Optimize `Wtf8Buf::into_string` for the case where it contains UTF-8.

Add a `is_known_utf8` flag to `Wtf8Buf`, which tracks whether the
string is known to contain UTF-8. This is efficiently computed in many
common situations, such as when a `Wtf8Buf` is constructed from a `String`
or `&str`, or with `Wtf8Buf::from_wide` which is already doing UTF-16
decoding and already checking for surrogates.

This makes `OsString::into_string` O(1) rather than O(N) on Windows in
common cases.

And, it eliminates the need to scan through the string for surrogates in
`Args::next` and `Vars::next`, because the strings are already being
translated with `Wtf8Buf::from_wide`.

Many things on Windows construct `OsString`s with `Wtf8Buf::from_wide`,
such as `DirEntry::file_name` and `fs::read_link`, so with this patch,
users of those functions can subsequently call `.into_string()` without
paying for an extra scan through the string for surrogates.

r? `@ghost`

22 months agorustdoc: remove unused CSS rule
Michael Howell [Wed, 24 Aug 2022 01:15:53 +0000 (18:15 -0700)]
rustdoc: remove unused CSS rule

According to [blame], this rule was added to support enum struct
variants. However, enum struct variants don't use tables in their design
any more, so this rule does nothing.

[blame]: https://github.com/rust-lang/rust/blame/87991d5f5d72d6baca490141cb890211ba2f3843/src/librustdoc/html/static/css/rustdoc.css#L748

22 months agoAuto merge of #100675 - Xiretza:fluent-mandate-crate-prefix, r=davidtwco
bors [Tue, 23 Aug 2022 22:30:07 +0000 (22:30 +0000)]
Auto merge of #100675 - Xiretza:fluent-mandate-crate-prefix, r=davidtwco

fluent: mandate slug names to be prefixed by crate name

This is currently only convention, but not actively checked for.

Additionally, improve error messages to highlight the path of the offending fluent file rather than the identifier preceding it.

This will conflict with #100671, so I'll leave it as draft until that's merged.

22 months agoUse `--userns=keep-id` when "docker" is really podman
Josh Stone [Tue, 23 Aug 2022 22:10:36 +0000 (15:10 -0700)]
Use `--userns=keep-id` when "docker" is really podman

Rootless podman creates a separate user namespace, where an inner
`LOCAL_USER_ID` will map to a different subuid range on the host.
The "keep-id" mode maps the current UID directly into the container.

This makes `src/ci/docker/run.sh` work better for testing container
images on systems running podman, where "docker" is just a shim.

22 months agosugg: take into count the debug formatting
Vincenzo Palazzo [Sat, 20 Aug 2022 23:29:38 +0000 (23:29 +0000)]
sugg: take into count the debug formatting

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
22 months agoerrors: `IntoDiagnosticArg` for `io::Error`/paths
David Wood [Fri, 19 Aug 2022 13:45:54 +0000 (14:45 +0100)]
errors: `IntoDiagnosticArg` for `io::Error`/paths

Add impls of `IntoDiagnosticArg` for `std::io::Error`, `std::path::Path`
and `std::path::PathBuf`.

Signed-off-by: David Wood <david.wood@huawei.com>
22 months agosave_analysis: Migrate diagnostics
Wonchul Lee [Fri, 19 Aug 2022 21:40:31 +0000 (06:40 +0900)]
save_analysis: Migrate diagnostics

22 months agoAuto merge of #99917 - yaahc:error-in-core-move, r=thomcc
bors [Tue, 23 Aug 2022 19:48:55 +0000 (19:48 +0000)]
Auto merge of #99917 - yaahc:error-in-core-move, r=thomcc

Move Error trait into core

This PR moves the error trait from the standard library into a new unstable `error` module within the core library. The goal of this PR is to help unify error reporting across the std and no_std ecosystems, as well as open the door to integrating the error trait into the panic reporting system when reporting panics whose source is an errors (such as via `expect`).

This PR is a rewrite of https://github.com/rust-lang/rust/pull/90328 using new compiler features that have been added to support error in core.

22 months agoFix links to error codes
Guillaume Gomez [Tue, 23 Aug 2022 19:47:31 +0000 (21:47 +0200)]
Fix links to error codes

22 months agoHandle error code hash by redirecting to the correct error code page
Guillaume Gomez [Tue, 23 Aug 2022 19:44:25 +0000 (21:44 +0200)]
Handle error code hash by redirecting to the correct error code page

22 months agoUpdate README.md
Tushar Dahiya [Tue, 23 Aug 2022 17:57:23 +0000 (23:27 +0530)]
Update README.md

22 months agoMake sure to count reused cgus towards the count of jobs done
bjorn3 [Tue, 23 Aug 2022 16:51:06 +0000 (16:51 +0000)]
Make sure to count reused cgus towards the count of jobs done

22 months agoAdd some self profiler calls
bjorn3 [Tue, 23 Aug 2022 16:11:12 +0000 (16:11 +0000)]
Add some self profiler calls

22 months agoCompile functions from clif ir to object code in parallel
bjorn3 [Tue, 23 Aug 2022 16:09:08 +0000 (16:09 +0000)]
Compile functions from clif ir to object code in parallel

22 months agoUse correct CguReuse variant
bjorn3 [Tue, 23 Aug 2022 16:06:01 +0000 (16:06 +0000)]
Use correct CguReuse variant

22 months agoRewrite error index generator to greatly reduce the size of the pages
Guillaume Gomez [Tue, 23 Aug 2022 16:27:18 +0000 (18:27 +0200)]
Rewrite error index generator to greatly reduce the size of the pages

22 months agoAdd a warning about `Option/Result::and()` being eagerly evaluated
Chayim Refael Friedman [Tue, 23 Aug 2022 16:15:09 +0000 (16:15 +0000)]
Add a warning about `Option/Result::and()` being eagerly evaluated

Copied from `or()`.

22 months agoDo asm compilation and object file emission in parallel
bjorn3 [Tue, 23 Aug 2022 16:05:29 +0000 (16:05 +0000)]
Do asm compilation and object file emission in parallel

22 months agoAdd a jobserver based concurrency limiter
bjorn3 [Tue, 23 Aug 2022 15:44:39 +0000 (15:44 +0000)]
Add a jobserver based concurrency limiter

22 months agoStore symbol name as owned string
bjorn3 [Fri, 19 Aug 2022 10:27:00 +0000 (10:27 +0000)]
Store symbol name as owned string

22 months agoSuggest alternatives when trying to mutate a `HashMap`/`BTreeMap` via indexing
Chayim Refael Friedman [Tue, 23 Aug 2022 15:15:34 +0000 (15:15 +0000)]
Suggest alternatives when trying to mutate a `HashMap`/`BTreeMap` via indexing

The error can be quite confusing to newcomers.

22 months agoAuto merge of #100920 - Dylan-DPC:rollup-vlcw3sr, r=Dylan-DPC
bors [Tue, 23 Aug 2022 15:12:09 +0000 (15:12 +0000)]
Auto merge of #100920 - Dylan-DPC:rollup-vlcw3sr, r=Dylan-DPC

Rollup of 9 pull requests

Successful merges:

 - #99249 (Do not re-parse function signatures to suggest generics)
 - #100309 (Extend comma suggestion to cases where fields arent missing)
 - #100368 (InferCtxt tainted_by_errors_flag should be Option<ErrorGuaranteed>)
 - #100768 (Migrate `rustc_plugin_impl` to `SessionDiagnostic`)
 - #100835 (net listen backlog update, follow-up from #97963.)
 - #100851 (Fix rustc_parse_format precision & width spans)
 - #100857 (Refactor query modifier parsing)
 - #100907 (Fix typo in UnreachableProp)
 - #100909 (Minor `ast::LitKind` improvements)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

22 months agoRollup merge of #100909 - nnethercote:minor-ast-LitKind-improvement, r=petrochenkov
Dylan DPC [Tue, 23 Aug 2022 15:10:09 +0000 (20:40 +0530)]
Rollup merge of #100909 - nnethercote:minor-ast-LitKind-improvement, r=petrochenkov

Minor `ast::LitKind` improvements

r? `@petrochenkov`

22 months agoRollup merge of #100907 - Nilstrieb:unrachable-typo-lol, r=Dylan-DPC
Dylan DPC [Tue, 23 Aug 2022 15:10:08 +0000 (20:40 +0530)]
Rollup merge of #100907 - Nilstrieb:unrachable-typo-lol, r=Dylan-DPC

Fix typo in UnreachableProp

r? ``@Dylan-DPC``

22 months agoRollup merge of #100857 - camsteffen:query-parse-refactor, r=davidtwco
Dylan DPC [Tue, 23 Aug 2022 15:10:07 +0000 (20:40 +0530)]
Rollup merge of #100857 - camsteffen:query-parse-refactor, r=davidtwco

Refactor query modifier parsing

Reduce redundancy and improve error spans.

22 months agoRollup merge of #100851 - Alexendoo:rpf-width-prec-spans, r=fee1-dead
Dylan DPC [Tue, 23 Aug 2022 15:10:06 +0000 (20:40 +0530)]
Rollup merge of #100851 - Alexendoo:rpf-width-prec-spans, r=fee1-dead

Fix rustc_parse_format precision & width spans

When a `precision`/`width` was `CountIsName - {:name$}` or `CountIs - {:10}` the `precision_span`/`width_span` was set to `None`

For `width` the name span in `CountIsName(_, name_span)` had its `.start` off by one

r? ``@fee1-dead`` / cc ``@PrestonFrom`` since this is similar to #99987

22 months agoRollup merge of #100835 - devnexen:listener_followups, r=devnexen
Dylan DPC [Tue, 23 Aug 2022 15:10:05 +0000 (20:40 +0530)]
Rollup merge of #100835 - devnexen:listener_followups, r=devnexen

net listen backlog update, follow-up from #97963.

FreeBSD and using system limit instead for others.

22 months agoRollup merge of #100768 - Facel3ss1:plugin-impl-translation, r=davidtwco
Dylan DPC [Tue, 23 Aug 2022 15:10:04 +0000 (20:40 +0530)]
Rollup merge of #100768 - Facel3ss1:plugin-impl-translation, r=davidtwco

Migrate `rustc_plugin_impl` to `SessionDiagnostic`

Migration of the `rustc_plugin_impl` crate.
~Draft PR because it is blocked on #100694 for `#[fatal(...)]` support~ (this has been merged, and I've changed over to `#[diag(...)]` now too), but I would also like to know if what I did with `LoadPluginError` is okay, because all it does is display the error message from `libloading` ([See conversation on zulip](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.23100717.20diagnostic.20translation/near/294327843)). This crate is apparently for a deprecated feature which is used by servo, so I don't know how much this matters anyway.

22 months agoRollup merge of #100368 - chenyukang:fix-100321, r=lcnr
Dylan DPC [Tue, 23 Aug 2022 15:10:03 +0000 (20:40 +0530)]
Rollup merge of #100368 - chenyukang:fix-100321, r=lcnr

InferCtxt tainted_by_errors_flag should be Option<ErrorGuaranteed>

Fixes #100321.
Use Cell<Option<ErrorGuaranteed>> to guarantee that we emit an error when that flag is set.

22 months agoRollup merge of #100309 - compiler-errors:issue-100300, r=sanxiyn
Dylan DPC [Tue, 23 Aug 2022 15:10:02 +0000 (20:40 +0530)]
Rollup merge of #100309 - compiler-errors:issue-100300, r=sanxiyn

Extend comma suggestion to cases where fields arent missing

Fixes #100300

22 months agoRollup merge of #99249 - cjgillot:no-reparse-fn, r=fee1-dead
Dylan DPC [Tue, 23 Aug 2022 15:10:01 +0000 (20:40 +0530)]
Rollup merge of #99249 - cjgillot:no-reparse-fn, r=fee1-dead

Do not re-parse function signatures to suggest generics

This PR uses the existing resolution rib infrastructure to channel the correct span information to suggest generic parameters.  This allows to avoid re-parsing a function's source code.

Drive-by cleanup: this removes useless `FnItemRibKind` from late resolution ribs.  All the use cases are already covered by `ItemRibKind` and `AssocItemRibKind` which have more precise semantics.

22 months agoUse CRATE_HIR_ID and CRATE_DEF_ID for obligations from foreign crates
Santiago Pastorino [Tue, 23 Aug 2022 12:08:30 +0000 (09:08 -0300)]
Use CRATE_HIR_ID and CRATE_DEF_ID for obligations from foreign crates

22 months agoDo not use unneeded extra errors variable
Santiago Pastorino [Mon, 22 Aug 2022 18:54:02 +0000 (15:54 -0300)]
Do not use unneeded extra errors variable

22 months agoPermit negative impls coherence to take advantage of implied bounds
Santiago Pastorino [Mon, 22 Aug 2022 18:52:49 +0000 (15:52 -0300)]
Permit negative impls coherence to take advantage of implied bounds

22 months agoMove InferCtxtExt to rustc_trait_selection
Santiago Pastorino [Mon, 22 Aug 2022 19:53:34 +0000 (16:53 -0300)]
Move InferCtxtExt to rustc_trait_selection

22 months agoUse par_body_owners for liveness
Seo Sanghyeon [Tue, 23 Aug 2022 11:53:02 +0000 (20:53 +0900)]
Use par_body_owners for liveness

22 months agoRevert "Avoid masking shift amounts (#1268)"
bjorn3 [Tue, 23 Aug 2022 11:10:44 +0000 (11:10 +0000)]
Revert "Avoid masking shift amounts (#1268)"

This reverts commit 156bda8bc708cca60e9de18743d833c8d97dd7ff.

This breaks the mir_overflow_off rustc test:
https://github.com/bjorn3/rustc_codegen_cranelift/runs/7971362755?check_suite_focus=true#step:7:2904

22 months agoUse native scalar `fma` instruction (#1267)
Afonso Bordado [Tue, 23 Aug 2022 10:42:35 +0000 (11:42 +0100)]
Use native scalar `fma` instruction (#1267)

Cranelift 0.87 now supports lowering `fma` as a libcall on x86 [0].
With 0.88 enabling the native x86 instruction under the `has_fma` flag.

aarch64 and s390x already support this as a native instruction, so it's
nice that we emit it for those.

We can't lower the SIMD version using the `fma` instruction since the
lowering can fail if the x86 `has_fma` flag is not enabled. Cranelift
doesn't yet know how to fallback for these cases

[0]: https://github.com/bytecodealliance/wasmtime/commit/709716bb8e6adaf7e65f3497168af23ce0cf09ef

22 months agoAvoid masking shift amounts (#1268)
Afonso Bordado [Tue, 23 Aug 2022 10:42:24 +0000 (11:42 +0100)]
Avoid masking shift amounts (#1268)

Cranelift 0.87 now follows its own documentation regarding
shift amounts, and implicitly masks them if the arch requires it. [0]

[0]: https://github.com/bytecodealliance/wasmtime/commit/05089321740a07757dff0a285176b2651a49aae2

22 months agoparser will not give wrong help message for 'public'
yukang [Tue, 23 Aug 2022 09:02:40 +0000 (17:02 +0800)]
parser will not give wrong help message for 'public'

22 months agoAuto merge of #100782 - thomcc:fix-android-sigaddset, r=Mark-Simulacrum
bors [Tue, 23 Aug 2022 08:09:19 +0000 (08:09 +0000)]
Auto merge of #100782 - thomcc:fix-android-sigaddset, r=Mark-Simulacrum

Align android `sigaddset` impl with the reference impl from Bionic

In https://github.com/rust-lang/rust/pull/100737 I noticed we were treating the sigset_t as an array of bytes, while referencing code from android (https://github.com/aosp-mirror/platform_bionic/blob/ad8dcd6023294b646e5a8288c0ed431b0845da49/libc/include/android/legacy_signal_inlines.h) which treats it as an array of unsigned long.

That said, the behavior difference is so subtle here that it's not hard to see why nobody noticed. This fixes the implementation to be equivalent to the one in bionic.

22 months agoDiagnose missing includes in run-make tests
Tomasz Miąsko [Tue, 23 Aug 2022 00:00:00 +0000 (00:00 +0000)]
Diagnose missing includes in run-make tests

22 months agoRemove the symbol from `ast::LitKind::Err`.
Nicholas Nethercote [Mon, 22 Aug 2022 03:27:52 +0000 (13:27 +1000)]
Remove the symbol from `ast::LitKind::Err`.

Because it's never used meaningfully.

22 months agoAdd some useful comments to `LitKind`.
Nicholas Nethercote [Mon, 22 Aug 2022 03:38:19 +0000 (13:38 +1000)]
Add some useful comments to `LitKind`.

22 months agoFix typo in UnreachableProp
nils [Tue, 23 Aug 2022 06:18:18 +0000 (08:18 +0200)]
Fix typo in UnreachableProp

22 months agoAuto merge of #100904 - matthiaskrgr:rollup-z3yzivj, r=matthiaskrgr
bors [Tue, 23 Aug 2022 05:22:05 +0000 (05:22 +0000)]
Auto merge of #100904 - matthiaskrgr:rollup-z3yzivj, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #100382 (Make the GATS self outlives error take into GATs in the inputs)
 - #100565 (Suggest adding a missing semicolon before an item)
 - #100641 (Add the armv4t-none-eabi target to the supported_targets)
 - #100789 (Use separate infcx to solve obligations during negative coherence)
 - #100832 (Some small bootstrap cleanup)
 - #100861 (fix ICE with extra-const-ub-checks)
 - #100862 (tidy: remove crossbeam-utils)
 - #100887 (Refactor part of codegen_call_terminator)
 - #100893 (Remove out-of-context comment in `mem::MaybeUninit` documentation)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

22 months agoRollup merge of #100893 - thinety:master, r=scottmcm
Matthias Krüger [Tue, 23 Aug 2022 04:55:31 +0000 (06:55 +0200)]
Rollup merge of #100893 - thinety:master, r=scottmcm

Remove out-of-context comment in `mem::MaybeUninit` documentation

Reverted the comment to an earlier version to avoid confusion: neither raw pointer assignment nor `ptr::write` is used inside the for loop.

22 months agoRollup merge of #100887 - eholk:codegen_call_terminator-cleanup, r=fee1-dead
Matthias Krüger [Tue, 23 Aug 2022 04:55:30 +0000 (06:55 +0200)]
Rollup merge of #100887 - eholk:codegen_call_terminator-cleanup, r=fee1-dead

Refactor part of codegen_call_terminator

I was reading through this code and found the chain of `if let` and a nested match on the same value that was matched in the `if let` to be kind of hard to follow. This PR cleans it up by flattening the `if let` chain and nested match into a single `match` expression.

22 months agoRollup merge of #100862 - ehuss:tidy-crossbeam, r=Mark-Simulacrum
Matthias Krüger [Tue, 23 Aug 2022 04:55:29 +0000 (06:55 +0200)]
Rollup merge of #100862 - ehuss:tidy-crossbeam, r=Mark-Simulacrum

tidy: remove crossbeam-utils

crossbeam-utils is no longer needed now that scoped threads are available in 1.63.

22 months agoRollup merge of #100861 - RalfJung:const-ice, r=oli-obk
Matthias Krüger [Tue, 23 Aug 2022 04:55:28 +0000 (06:55 +0200)]
Rollup merge of #100861 - RalfJung:const-ice, r=oli-obk

fix ICE with extra-const-ub-checks

Fixes https://github.com/rust-lang/rust/issues/100771