]> git.lizzy.rs Git - rust.git/log
rust.git
23 months agoRemove box syntax from Box<function pointer> construction
est31 [Sun, 10 Jul 2022 22:25:25 +0000 (00:25 +0200)]
Remove box syntax from Box<function pointer> construction

The function pointer should be extremely small, close to pointer size.

23 months agoAuto merge of #98959 - cjgillot:late-bound-order, r=michaelwoerister
bors [Wed, 6 Jul 2022 17:38:48 +0000 (17:38 +0000)]
Auto merge of #98959 - cjgillot:late-bound-order, r=michaelwoerister

Return a FxIndexSet in is_late_bound query.

This return value is iterated upon by borrowck, hence the need to preserve
a deterministic iteration order.

Fixes https://github.com/rust-lang/rust/issues/98890
Affects https://github.com/rust-lang/rust/issues/96655

I don't know if this supersedes https://github.com/rust-lang/rust/pull/98924 or fixes an unrelated bug.

r? `@michaelwoerister`
This may deserve a backport.

23 months agoAuto merge of #98970 - Dylan-DPC:rollup-j0od37w, r=Dylan-DPC
bors [Wed, 6 Jul 2022 15:10:37 +0000 (15:10 +0000)]
Auto merge of #98970 - Dylan-DPC:rollup-j0od37w, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #98881 (Only compute DefKind through the query.)
 - #98884 (macros: `LintDiagnostic` derive)
 - #98964 (fix typo in function name)
 - #98967 (fix typo in note about multiple inaccessible type aliases)
 - #98968 (assert Scalar sanity)

Failed merges:

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

23 months agoAuto merge of #98567 - Patryk27:update-llvm, r=nikic
bors [Wed, 6 Jul 2022 12:29:40 +0000 (12:29 +0000)]
Auto merge of #98567 - Patryk27:update-llvm, r=nikic

Update llvm-project

Closes https://github.com/rust-lang/rust/issues/98167 🙂

23 months agoAdd link to issue for src/test/incremental/async-lifetimes.rs
Michael Woerister [Wed, 6 Jul 2022 09:32:55 +0000 (11:32 +0200)]
Add link to issue for src/test/incremental/async-lifetimes.rs

23 months agoRollup merge of #98968 - RalfJung:scalar-sanity, r=oli-obk
Dylan DPC [Wed, 6 Jul 2022 09:19:13 +0000 (14:49 +0530)]
Rollup merge of #98968 - RalfJung:scalar-sanity, r=oli-obk

assert Scalar sanity

With https://github.com/rust-lang/rust/pull/96814 having landed, finally our `Scalar` layouts have the invariants they deserve. :)

23 months agoRollup merge of #98967 - ClementTsang:fix_inaccessible_type_alias_plural_typo, r...
Dylan DPC [Wed, 6 Jul 2022 09:19:12 +0000 (14:49 +0530)]
Rollup merge of #98967 - ClementTsang:fix_inaccessible_type_alias_plural_typo, r=lcnr

fix typo in note about multiple inaccessible type aliases

Mainly intended as a small typo fix ("aliass" -> "aliases") for the case where a type cannot be found in scope but there are multiple inaccessible type aliases that match the missing type.

In general this change would use the correct plural form in this scenario for base words that end with 's'.

23 months agoRollup merge of #98964 - RalfJung:typo, r=Dylan-DPC
Dylan DPC [Wed, 6 Jul 2022 09:19:11 +0000 (14:49 +0530)]
Rollup merge of #98964 - RalfJung:typo, r=Dylan-DPC

fix typo in function name

I don't know what I was doing when I named that function...
follow-up to #98888
r? `@oli-obk`

23 months agoRollup merge of #98884 - davidtwco:translation-on-lints-derive, r=oli-obk
Dylan DPC [Wed, 6 Jul 2022 09:19:10 +0000 (14:49 +0530)]
Rollup merge of #98884 - davidtwco:translation-on-lints-derive, r=oli-obk

macros: `LintDiagnostic` derive

- Move `LintDiagnosticBuilder` into `rustc_errors` so that a diagnostic derive can refer to it.
- Introduce a `DecorateLint` trait, which is equivalent to `SessionDiagnostic` or `AddToDiagnostic` but for lints. Necessary without making more changes to the lint infrastructure as `DecorateLint` takes a `LintDiagnosticBuilder` and re-uses all of the existing logic for determining what type of diagnostic a lint should be emitted as (e.g. error/warning).
- Various refactorings of the diagnostic derive machinery (extracting `build_field_mapping` helper and moving `sess` field out of the `DiagnosticDeriveBuilder`).
- Introduce a `LintDiagnostic` derive macro that works almost exactly like the `SessionDiagnostic` derive macro  except that it derives a `DecorateLint` implementation instead. A new derive is necessary for this because `SessionDiagnostic` is intended for when the generated code creates the diagnostic. `AddToDiagnostic` could have been used but it would have required more changes to the lint machinery.

~~At time of opening this pull request, ignore all of the commits from #98624, it's just the last few commits that are new.~~

r? `@oli-obk`

23 months agoRollup merge of #98881 - cjgillot:q-def-kind, r=fee1-dead
Dylan DPC [Wed, 6 Jul 2022 09:19:08 +0000 (14:49 +0530)]
Rollup merge of #98881 - cjgillot:q-def-kind, r=fee1-dead

Only compute DefKind through the query.

23 months agoFix double space
fee1-dead [Wed, 6 Jul 2022 09:02:58 +0000 (17:02 +0800)]
Fix double space

23 months agoAdd regression test.
Camille GILLOT [Wed, 6 Jul 2022 08:56:35 +0000 (10:56 +0200)]
Add regression test.

23 months agoAuto merge of #98206 - eggyal:align-to-chalk-folding-api, r=jackh726
bors [Wed, 6 Jul 2022 05:48:11 +0000 (05:48 +0000)]
Auto merge of #98206 - eggyal:align-to-chalk-folding-api, r=jackh726

Split TypeVisitable from TypeFoldable

Impl of rust-lang/compiler-team#520 following MCP approval.

r? `@ghost`

23 months agoUpdate TypeVisitor paths
Alan Egerton [Fri, 17 Jun 2022 12:15:00 +0000 (13:15 +0100)]
Update TypeVisitor paths

23 months agoadd test
Ralf Jung [Wed, 6 Jul 2022 00:29:37 +0000 (20:29 -0400)]
add test

23 months agofinally enable Scalar layout sanity checks
Ralf Jung [Wed, 6 Jul 2022 00:26:26 +0000 (20:26 -0400)]
finally enable Scalar layout sanity checks

23 months agofix typo in note about multiple inaccessible type aliases
ClementTsang [Wed, 6 Jul 2022 01:01:53 +0000 (21:01 -0400)]
fix typo in note about multiple inaccessible type aliases

Mainly intended as a small typo fix ("aliass" -> "aliases") for
the case where a type cannot be found in scope, and there are
multiple inaccessible type aliases that match the missing type.

In general this change would use the correct plural form in
this scenario for words that end with 's'.

23 months agoAuto merge of #98963 - GuillaumeGomez:rollup-n030us5, r=GuillaumeGomez
bors [Tue, 5 Jul 2022 23:12:34 +0000 (23:12 +0000)]
Auto merge of #98963 - GuillaumeGomez:rollup-n030us5, r=GuillaumeGomez

Rollup of 6 pull requests

Successful merges:

 - #95503 (bootstrap: Allow building individual crates)
 - #96814 (Fix repr(align) enum handling)
 - #98256 (Fix whitespace handling after where clause)
 - #98880 (Proper macOS libLLVM symlink when cross compiling)
 - #98944 (Edit `rustc_mir_dataflow::framework::lattice::FlatSet` docs)
 - #98951 (Update books)

Failed merges:

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

23 months agofix type in function name
Ralf Jung [Tue, 5 Jul 2022 21:48:43 +0000 (17:48 -0400)]
fix type in function name

23 months agoRollup merge of #98951 - ehuss:update-books, r=ehuss
Guillaume Gomez [Tue, 5 Jul 2022 21:43:34 +0000 (23:43 +0200)]
Rollup merge of #98951 - ehuss:update-books, r=ehuss

Update books

## nomicon

2 commits in 3a43983b76174342b7dbd3e12ea2c49f762e52be..70db9e4189f64d1d8e2451b1046111fb356b6dc2
2022-05-30 17:01:30 +0900 to 2022-06-27 20:47:21 +0900
- should be `size_of` instead of `align_of` (rust-lang/nomicon#371)
- Fix wording on the aliasing section (rust-lang/nomicon#366)

## book

20 commits in efbafdba3618487fbc9305318fcab9775132ac15..cf2653a5ca553cbbb4a17f1a7db1947820f6a775
2022-06-19 21:06:50 -0400 to 2022-07-05 12:07:58 -0400
- Frontmatter
- Update to Rust 1.62
- Extract where clause example so it'll get rustfmtted in the future
- Merge remote-tracking branch 'origin/pr/3238' into extract-where-clause-example
- Fix line wrapping of lib placement fix
- Fix grammar, spelling, and line wrapping of description of appendices
- Merge remote-tracking branch 'origin/pr/3244' into binlib
- Clarify *type* parameter names
- Fix listing 8-21. Fixes rust-lang/book#3251
- Propagate tech review changes for ch13
- Responses to tech review of chapter 13
- Tech review comments on chapter 13
- Fix double the
- Propagate tech review chapter 1 changes to src
- Address tech review comments for chapter 1
- Tech review comments for chapter 1
- Fix grammar
- Fix grammar
- Edits to edits to the introduction
- Comments from nostarch on the introduction

## rust-by-example

8 commits in 1095df2a5850f2d345fad43a30633133365875ba..83724ca387a2a1cd3e8d848f62820020760e358b
2022-06-18 21:47:12 -0300 to 2022-07-05 10:38:07 -0300
- changing names of params (rust-lang/rust-by-example#1567)
- Update incorrect print output in std/box.md (rust-lang/rust-by-example#1564)
- minor typo (rust-lang/rust-by-example#1563)
- fix: Fibonacci sequence starts from zero (rust-lang/rust-by-example#1562)
- add Vietnamese version on README.md (rust-lang/rust-by-example#1561)
- Update variadics.md (rust-lang/rust-by-example#1559)
- Change fold to sum in fn hof.md (rust-lang/rust-by-example#1560)
- Small typo, fixed compileable -&gt; compilable (rust-lang/rust-by-example#1556)

## rustc-dev-guide

8 commits in 048d925f0a955aac601c4160c0e7f05771bcf63b..eb83839e903a0a8f1406f7e941886273f189b26b
2022-06-21 22:25:34 +0900 to 2022-07-03 15:17:39 +0900
- Suggest a separate build directory for rust-analyzer (rust-lang/rustc-dev-guide#1378)
- Change the old filename, "src/stage0.txt" to "src/stage0.json" (rust-lang/rustc-dev-guide#1383)
- Add the config needed to get rust-analyzer working on src/bootstrap (rust-lang/rustc-dev-guide#1381)
- Fix path to hir_id_validator.rs
- leave formatOnSave to the user (rust-lang/rustc-dev-guide#1380)
- diagnostics: structs with new slug syntax (rust-lang/rustc-dev-guide#1377)
- Few readability fixes
- humorust: Forbid pineapple on pizza (rust-lang/rustc-dev-guide#1374)

## embedded-book

1 commits in e17dcef5e96346ee3d7fa56820ddc7e5c39636bc..766979590da8100998f0d662499d4a901d8d1640
2022-06-19 10:28:00 +0000 to 2022-07-04 09:13:58 +0000
- "linker `link.exe` not found" fix  (rust-embedded/book#321)

23 months agoRollup merge of #98944 - pierwill:flatset-docs, r=Dylan-DPC
Guillaume Gomez [Tue, 5 Jul 2022 21:43:33 +0000 (23:43 +0200)]
Rollup merge of #98944 - pierwill:flatset-docs, r=Dylan-DPC

Edit `rustc_mir_dataflow::framework::lattice::FlatSet` docs

Cosmetic improvements. Adds a paragraph break, and
ellipses to signify arbitrary size of a flat set.

23 months agoRollup merge of #98880 - topjohnwu:macos-dylib-cross, r=jyn514
Guillaume Gomez [Tue, 5 Jul 2022 21:43:32 +0000 (23:43 +0200)]
Rollup merge of #98880 - topjohnwu:macos-dylib-cross, r=jyn514

Proper macOS libLLVM symlink when cross compiling

Follow up of #98418

When cross compiling on macOS with `llvm.link-shared` enabled, the symlink creation will fail after compiling LLVM for the target architecture, because it will attempt to create the symlink in the host LLVM directory, which was already created when being built.

This commit changes the symlink path to the actual LLVM output.

r? `@jyn514`

23 months agoRollup merge of #98256 - GuillaumeGomez:whitespace-where-clause, r=notriddle
Guillaume Gomez [Tue, 5 Jul 2022 21:43:31 +0000 (23:43 +0200)]
Rollup merge of #98256 - GuillaumeGomez:whitespace-where-clause, r=notriddle

Fix whitespace handling after where clause

Fixes #97733.

You can see the result [here](https://rustdoc.crud.net/imperio/whitespace-where-clause/doc/foo/index.html).

r? `@jsha`

23 months agoRollup merge of #96814 - RalfJung:enum-repr-align, r=oli-obk
Guillaume Gomez [Tue, 5 Jul 2022 21:43:30 +0000 (23:43 +0200)]
Rollup merge of #96814 - RalfJung:enum-repr-align, r=oli-obk

Fix repr(align) enum handling

`enum`, for better or worse, supports `repr(align)`. That has already caused a bug in https://github.com/rust-lang/rust/issues/92464, which was "fixed" in https://github.com/rust-lang/rust/pull/92932, but it turns out that that fix is wrong and caused https://github.com/rust-lang/rust/issues/96185.

So this reverts #92932 (which fixes #96185), and attempts another strategy for fixing #92464: special-case enums when doing a cast, re-using the code to load the discriminant rather than assuming that the enum has scalar layout. This works fine for the interpreter.

However, #92464 contained another testcase that was previously not in the test suite -- and after adding it, it ICEs again. This is not surprising; codegen needs the same patch that I did in the interpreter. Probably this has to happen [around here](https://github.com/rust-lang/rust/blob/d32ce37a171663048a4c4a536803434e40f52bd6/compiler/rustc_codegen_ssa/src/mir/rvalue.rs#L276). Unfortunately I don't know how to do that -- the interpreter can load a discriminant from an operand, but codegen can only do that from a place. `@oli-obk` `@eddyb` `@bjorn3` any idea?

23 months agoRollup merge of #95503 - jyn514:build-single-crate, r=Mark-Simulacrum
Guillaume Gomez [Tue, 5 Jul 2022 21:43:28 +0000 (23:43 +0200)]
Rollup merge of #95503 - jyn514:build-single-crate, r=Mark-Simulacrum

bootstrap: Allow building individual crates

This aims to be as unintrusive as possible, but did still require adding a new `tail_args` field to all `Rustc` and `Std` steps.

New library and compiler crates are added to the sysroot as they are built, since it's useful to have e.g. just alloc and not std.

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

23 months agoRelax constrained generics to TypeVisitable
Alan Egerton [Fri, 17 Jun 2022 12:10:07 +0000 (13:10 +0100)]
Relax constrained generics to TypeVisitable

23 months agoExplicit TypeVisitable implementations
Alan Egerton [Fri, 17 Jun 2022 11:09:23 +0000 (12:09 +0100)]
Explicit TypeVisitable implementations

23 months agoimpl TypeVisitable in type traversal macros
Alan Egerton [Fri, 17 Jun 2022 10:05:17 +0000 (11:05 +0100)]
impl TypeVisitable in type traversal macros

23 months agoAdd #[derive(TypeVisitable)]
Alan Egerton [Fri, 17 Jun 2022 09:53:29 +0000 (10:53 +0100)]
Add #[derive(TypeVisitable)]

23 months agoClarify the behaviour from inside the query system.
Camille GILLOT [Tue, 5 Jul 2022 20:52:21 +0000 (22:52 +0200)]
Clarify the behaviour from inside the query system.

23 months agoAdd test for invalid whitespace display after where clause
Guillaume Gomez [Sun, 19 Jun 2022 14:38:10 +0000 (16:38 +0200)]
Add test for invalid whitespace display after where clause

23 months agoAuto merge of #98954 - ehuss:update-cargo, r=ehuss
bors [Tue, 5 Jul 2022 20:31:45 +0000 (20:31 +0000)]
Auto merge of #98954 - ehuss:update-cargo, r=ehuss

Update cargo

9 commits in dbff32b27893b899ae2397f3d56d1be111041d56..c0bbd42ce5e83fe2a93e817c3f9b955492d3130a
2022-06-24 19:25:13 +0000 to 2022-07-03 13:41:11 +0000
- fix typo (rust-lang/cargo#10818)
- fix(add): Don't panic with `--offline` (rust-lang/cargo#10817)
- chore: Set permissions for GitHub actions (rust-lang/cargo#10816)
- Bump to 0.65.0, update changelog (rust-lang/cargo#10812)
- Fix zsh completions for add and locate-project (rust-lang/cargo#10810)
- Bump cargo-util version. (rust-lang/cargo#10804)
- Update os_info (rust-lang/cargo#10802)
- Fix deserialization of check-cfg in config.toml (rust-lang/cargo#10799)
- fix: bash complete `install --path` with dirs (rust-lang/cargo#10798)

23 months agoReturn a FxIndexSet in is_late_bound query.
Camille GILLOT [Tue, 5 Jul 2022 19:54:38 +0000 (21:54 +0200)]
Return a FxIndexSet in is_late_bound query.

This return value is iterated upon by borrowck, hence the need to preserve
a deterministic iteration order.

23 months agoFix invalid add of whitespace when there is where clause
Guillaume Gomez [Sun, 19 Jun 2022 14:36:58 +0000 (16:36 +0200)]
Fix invalid add of whitespace when there is where clause

23 months agoUpdate cargo
Eric Huss [Tue, 5 Jul 2022 18:58:38 +0000 (11:58 -0700)]
Update cargo

23 months agoUpdate books
Eric Huss [Tue, 5 Jul 2022 18:44:56 +0000 (11:44 -0700)]
Update books

23 months agoSplit TypeVisitable from TypeFoldable
Alan Egerton [Fri, 17 Jun 2022 09:15:24 +0000 (10:15 +0100)]
Split TypeVisitable from TypeFoldable

23 months agoAuto merge of #98936 - matthiaskrgr:rollup-dvr0ucm, r=matthiaskrgr
bors [Tue, 5 Jul 2022 17:46:53 +0000 (17:46 +0000)]
Auto merge of #98936 - matthiaskrgr:rollup-dvr0ucm, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #98860 (adjust dangling-int-ptr error message)
 - #98888 (interpret: fix CheckedBinOp behavior when overflow checking is disabled)
 - #98889 (Add regression test for #79467)
 - #98895 (bootstrap.py: Always use `.exe` for Windows)
 - #98920 (adapt issue-37945 codegen test to accept any order of ops)
 - #98921 (Refactor: remove a redundant mutable variable)

Failed merges:

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

23 months agoadd asserts
Ralf Jung [Tue, 5 Jul 2022 17:26:52 +0000 (13:26 -0400)]
add asserts

23 months agofix the layout of repr(align) enums
Ralf Jung [Sat, 7 May 2022 13:01:25 +0000 (15:01 +0200)]
fix the layout of repr(align) enums

23 months agoEdit `rustc_mir_dataflow::framework::lattice::FlatSet` docs
pierwill [Tue, 5 Jul 2022 16:32:25 +0000 (11:32 -0500)]
Edit `rustc_mir_dataflow::framework::lattice::FlatSet` docs

Cosmetic improvements. Adds a paragraph break, and
ellipses to signify arbitrary size of a flat set.

23 months agoUpdate llvm-project
Patryk Wychowaniec [Mon, 27 Jun 2022 09:15:35 +0000 (11:15 +0200)]
Update llvm-project

23 months agoRollup merge of #98921 - TaKO8Ki:refactor-fulfillment-context-select, r=Dylan-DPC
Matthias Krüger [Tue, 5 Jul 2022 15:08:15 +0000 (17:08 +0200)]
Rollup merge of #98921 - TaKO8Ki:refactor-fulfillment-context-select, r=Dylan-DPC

Refactor: remove a redundant mutable variable

23 months agoRollup merge of #98920 - krasimirgg:llvm-15-issue-37945, r=nikic
Matthias Krüger [Tue, 5 Jul 2022 15:08:14 +0000 (17:08 +0200)]
Rollup merge of #98920 - krasimirgg:llvm-15-issue-37945, r=nikic

adapt issue-37945 codegen test to accept any order of ops

Adapt this test to accept `icmp` operands in any order as a follow-up to https://github.com/rust-lang/rust/commit/cbbf06b0cd39dc93033568f1e65f5363cbbdebcd#commitcomment-77670922.

23 months agoRollup merge of #98895 - ChrisDenton:no-elves-allowed, r=jyn514
Matthias Krüger [Tue, 5 Jul 2022 15:08:13 +0000 (17:08 +0200)]
Rollup merge of #98895 - ChrisDenton:no-elves-allowed, r=jyn514

bootstrap.py: Always use `.exe` for Windows

This ensures that it will run the Windows executable if other files in the directory (such as Linux executables) have the same file name minus the extension. I've been tripped up by this a few times where both `bootstrap` and `bootstrap.exe` end up in the same directory.

This PR avoids ever having to see the following message:

`OSError: [WinError 193] %1 is not a valid Win32 application`

23 months agoRollup merge of #98889 - TaKO8Ki:add-regression-test-for-79467, r=Dylan-DPC
Matthias Krüger [Tue, 5 Jul 2022 15:08:12 +0000 (17:08 +0200)]
Rollup merge of #98889 - TaKO8Ki:add-regression-test-for-79467, r=Dylan-DPC

Add regression test for #79467

closes #79467

23 months agoRollup merge of #98888 - RalfJung:interpret-checked-bin, r=oli-obk
Matthias Krüger [Tue, 5 Jul 2022 15:08:11 +0000 (17:08 +0200)]
Rollup merge of #98888 - RalfJung:interpret-checked-bin, r=oli-obk

interpret: fix CheckedBinOp behavior when overflow checking is disabled

Adjusts the interpreter to https://github.com/rust-lang/rust/pull/98738.

r? `@oli-obk`

23 months agoRollup merge of #98860 - RalfJung:dangling-int-ptr, r=davidtwco
Matthias Krüger [Tue, 5 Jul 2022 15:08:10 +0000 (17:08 +0200)]
Rollup merge of #98860 - RalfJung:dangling-int-ptr, r=davidtwco

adjust dangling-int-ptr error message

based on suggestions by `@saethlin` in https://github.com/rust-lang/miri/issues/2163

Fixes https://github.com/rust-lang/miri/issues/2163

I also did a bit of refactoring on this, so we have a helper method to create a `Pointer` with `None` provenance.

23 months agomacros: add diagnostic derive for lints
David Wood [Thu, 30 Jun 2022 07:57:45 +0000 (08:57 +0100)]
macros: add diagnostic derive for lints

`SessionDiagnostic` isn't suitable for use on lints as whether or not it
creates an error or a warning is decided at compile-time by the macro,
whereas lints decide this at runtime based on the location of the lint
being reported (as it will depend on the user's `allow`/`deny`
attributes, etc). Re-using most of the machinery for
`SessionDiagnostic`, this macro introduces a `LintDiagnostic` derive
which implements a `DecorateLint` trait, taking a
`LintDiagnosticBuilder` and adding to the lint according to the
diagnostic struct.

23 months agomacros: move `sess` out of builder
David Wood [Wed, 29 Jun 2022 15:22:27 +0000 (16:22 +0100)]
macros: move `sess` out of builder

`sess` field of `SessionDiagnosticDeriveBuilder` is never actually used
in the builder's member functions, so it doesn't need to be a field.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agomacros: introduce `build_field_mapping`
David Wood [Wed, 29 Jun 2022 15:13:01 +0000 (16:13 +0100)]
macros: introduce `build_field_mapping`

Move the logic for building a field mapping (which is used by the
building of format strings in `suggestion` annotations) into a helper
function.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agoerrors: introduce `DecorateLint`
David Wood [Wed, 29 Jun 2022 15:07:46 +0000 (16:07 +0100)]
errors: introduce `DecorateLint`

Add a new trait to be generated by diagnostic derives which uses a
`LintDiagnosticBuilder`.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agolint: `LintDiagnosticBuilder` into `rustc_errors`
David Wood [Wed, 29 Jun 2022 14:50:26 +0000 (15:50 +0100)]
lint: `LintDiagnosticBuilder` into `rustc_errors`

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agomacros: fix documentation link for diag derive
David Wood [Wed, 29 Jun 2022 14:42:12 +0000 (15:42 +0100)]
macros: fix documentation link for diag derive

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agoAuto merge of #98584 - lcnr:region-stuff-more-beans, r=oli-obk
bors [Tue, 5 Jul 2022 14:58:31 +0000 (14:58 +0000)]
Auto merge of #98584 - lcnr:region-stuff-more-beans, r=oli-obk

continue nll transition by removing stuff

r? `@jackh726` for now

building on #98641

23 months agoAuto merge of #98925 - Dylan-DPC:rollup-9185c9y, r=Dylan-DPC
bors [Tue, 5 Jul 2022 12:17:26 +0000 (12:17 +0000)]
Auto merge of #98925 - Dylan-DPC:rollup-9185c9y, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #97712 (ptr::copy and ptr::swap are doing untyped copies)
 - #98624 (lints: mostly translatable diagnostics)
 - #98776 (rustdoc: improve click behavior of the source code mobile full-screen "sidebar")
 - #98856 (Remove FIXME from rustdoc intra-doc test)
 - #98913 (:arrow_up: rust-analyzer)

Failed merges:

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

23 months agoadjust dangling-int-ptr error message
Ralf Jung [Sun, 3 Jul 2022 19:46:22 +0000 (15:46 -0400)]
adjust dangling-int-ptr error message

23 months agoalways check overflow in CheckedBinOp in CTFE
Ralf Jung [Mon, 4 Jul 2022 23:24:41 +0000 (19:24 -0400)]
always check overflow in CheckedBinOp in CTFE

23 months agoRollup merge of #98913 - lnicola:rust-analyzer-2022-07-05, r=lnicola
Dylan DPC [Tue, 5 Jul 2022 10:34:35 +0000 (16:04 +0530)]
Rollup merge of #98913 - lnicola:rust-analyzer-2022-07-05, r=lnicola

:arrow_up: rust-analyzer

r? ``@ghost``

23 months agoRollup merge of #98856 - GuillaumeGomez:rustdoc-test-rm-fixme, r=Dylan-DPC
Dylan DPC [Tue, 5 Jul 2022 10:34:34 +0000 (16:04 +0530)]
Rollup merge of #98856 - GuillaumeGomez:rustdoc-test-rm-fixme, r=Dylan-DPC

Remove FIXME from rustdoc intra-doc test

Removed the FIXME.

For the `extern crate`, even if `pub` exported, its documentation wasn't rendered so there is no point in keeping it.

r? ``@notriddle``

23 months agoRollup merge of #98776 - notriddle:notriddle/mobile-sidebar-auto-close, r=GuillaumeGomez
Dylan DPC [Tue, 5 Jul 2022 10:34:33 +0000 (16:04 +0530)]
Rollup merge of #98776 - notriddle:notriddle/mobile-sidebar-auto-close, r=GuillaumeGomez

rustdoc: improve click behavior of the source code mobile full-screen "sidebar"

On desktop, if you open the source code sidebar, it stays open even when you move from page to page. It used to do the same thing on mobile, but I think that's stupid. Since the file list fills the entire screen on mobile, and you can't really do anything with the currently selected file other than dismiss the "sidebar" to look at it, it's safe to assume that anybody who clicks a file in that list probably wants the list to go away so they can see it.

Split out separately from #98772

23 months agoRollup merge of #98624 - davidtwco:translation-on-lints, r=compiler-errors
Dylan DPC [Tue, 5 Jul 2022 10:34:32 +0000 (16:04 +0530)]
Rollup merge of #98624 - davidtwco:translation-on-lints, r=compiler-errors

lints: mostly translatable diagnostics

As lints are created slightly differently than other diagnostics, intended to try make them translatable first and then look into the applicability of diagnostic structs but ended up just making most of the diagnostics in the crate translatable (which will still be useful if I do make a lot of them structs later anyway).

r? ``@compiler-errors``

23 months agoRollup merge of #97712 - RalfJung:untyped, r=scottmcm
Dylan DPC [Tue, 5 Jul 2022 10:34:31 +0000 (16:04 +0530)]
Rollup merge of #97712 - RalfJung:untyped, r=scottmcm

ptr::copy and ptr::swap are doing untyped copies

The consensus in https://github.com/rust-lang/rust/issues/63159 seemed to be that these operations should be "untyped", i.e., they should treat the data as raw bytes, should work when these bytes violate the validity invariant of `T`, and should exactly preserve the initialization state of the bytes that are being copied. This is already somewhat implied by the description of "copying/swapping size*N bytes" (rather than "N instances of `T`").

The implementations mostly already work that way (well, for LLVM's intrinsics the documentation is not precise enough to say what exactly happens to poison, but if this ever gets clarified to something that would *not* perfectly preserve poison, then I strongly assume there will be some way to make a copy that *does* perfectly preserve poison). However, I had to adjust `swap_nonoverlapping`; after ``@scottmcm's`` [recent changes](https://github.com/rust-lang/rust/pull/94212), that one (sometimes) made a typed copy. (Note that `mem::swap`, which works on mutable references, is unchanged. It is documented as "swapping the values at two mutable locations", which to me strongly indicates that it is indeed typed. It is also safe and can rely on `&mut T` pointing to a valid `T` as part of its safety invariant.)

On top of adding a test (that will be run by Miri), this PR then also adjusts the documentation to indeed stably promise the untyped semantics. I assume this means the PR has to go through t-libs (and maybe t-lang?) FCP.

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

23 months agoadapt issue-37945 codegen test to accept any order of ops
Krasimir Georgiev [Tue, 5 Jul 2022 08:59:50 +0000 (08:59 +0000)]
adapt issue-37945 codegen test to accept any order of ops

23 months agoAuto merge of #96862 - oli-obk:enum_cast_mir, r=RalfJung
bors [Tue, 5 Jul 2022 09:36:29 +0000 (09:36 +0000)]
Auto merge of #96862 - oli-obk:enum_cast_mir, r=RalfJung

Change enum->int casts to not go through MIR casts.

follow-up to https://github.com/rust-lang/rust/pull/96814

this simplifies all backends and even gives LLVM more information about the return value of `Rvalue::Discriminant`, enabling optimizations in more cases.

23 months agorefactor: remove a redundant mutable variable
Takayuki Maeda [Tue, 5 Jul 2022 09:28:36 +0000 (18:28 +0900)]
refactor: remove a redundant mutable variable

23 months agoPrefer trace level instrumentation for the new noisy instrument attributes
Oli Scherer [Tue, 5 Jul 2022 09:27:06 +0000 (09:27 +0000)]
Prefer trace level instrumentation for the new noisy instrument attributes

23 months agoAdd a helper method with an explicit name instead of hand rolling a match 3x
Oli Scherer [Tue, 5 Jul 2022 09:26:45 +0000 (09:26 +0000)]
Add a helper method with an explicit name instead of hand rolling a match 3x

23 months agoFix typo in src/bootstrap/bootstrap.py
Chris Denton [Tue, 5 Jul 2022 08:06:43 +0000 (09:06 +0100)]
Fix typo in src/bootstrap/bootstrap.py

Co-authored-by: Marco Colombo <mar.colombo13@gmail.com>
23 months agoAuto merge of #98910 - Dylan-DPC:rollup-9x82wdg, r=Dylan-DPC
bors [Tue, 5 Jul 2022 06:44:49 +0000 (06:44 +0000)]
Auto merge of #98910 - Dylan-DPC:rollup-9x82wdg, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #97300 (Implement `FusedIterator` for `std::net::[Into]Incoming`)
 - #98761 (more `need_type_info` improvements)
 - #98811 (Interpret: AllocRange Debug impl, and use it more consistently)
 - #98847 (fix interpreter validity check on Box)
 - #98854 (clean up the borrowing in rustc_hir_pretty)
 - #98873 (Suggest `#[derive(Default)]` to enums with `#[default]`)

Failed merges:

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

23 months ago:arrow_up: rust-analyzer
Laurențiu Nicola [Tue, 5 Jul 2022 06:29:11 +0000 (09:29 +0300)]
:arrow_up: rust-analyzer

23 months agoRollup merge of #98873 - TaKO8Ki:suggest-default-derive-to-enum-with-default-attribut...
Dylan DPC [Tue, 5 Jul 2022 05:12:59 +0000 (10:42 +0530)]
Rollup merge of #98873 - TaKO8Ki:suggest-default-derive-to-enum-with-default-attribute, r=fee1-dead

Suggest `#[derive(Default)]` to enums with `#[default]`

fixes #95226

23 months agoRollup merge of #98854 - kadiwa4:rustc_hir_pretty_clean_up_borrowing, r=oli-obk
Dylan DPC [Tue, 5 Jul 2022 05:12:58 +0000 (10:42 +0530)]
Rollup merge of #98854 - kadiwa4:rustc_hir_pretty_clean_up_borrowing, r=oli-obk

clean up the borrowing in rustc_hir_pretty

A whole lot of the `&`s and `ref`s were redundant. I hope doing this in one big commit is fine, because all of the changes are pretty self-contained.

`@rustbot` label: +C-cleanup

23 months agoRollup merge of #98847 - RalfJung:box-is-special, r=oli-obk
Dylan DPC [Tue, 5 Jul 2022 05:12:57 +0000 (10:42 +0530)]
Rollup merge of #98847 - RalfJung:box-is-special, r=oli-obk

fix interpreter validity check on Box

Follow-up to https://github.com/rust-lang/rust/pull/98554: avoid walking over parts of the value twice.

And then move all that logic into the general visitor so not each visitor implementation has to deal with it...

23 months agoRollup merge of #98811 - RalfJung:interpret-alloc-range, r=oli-obk
Dylan DPC [Tue, 5 Jul 2022 05:12:55 +0000 (10:42 +0530)]
Rollup merge of #98811 - RalfJung:interpret-alloc-range, r=oli-obk

Interpret: AllocRange Debug impl, and use it more consistently

The two commits are pretty independent but it did not seem worth having two PRs for them.
r? ``@oli-obk``

23 months agoRollup merge of #98761 - lcnr:need_type_info-cont, r=estebank
Dylan DPC [Tue, 5 Jul 2022 05:12:54 +0000 (10:42 +0530)]
Rollup merge of #98761 - lcnr:need_type_info-cont, r=estebank

more `need_type_info` improvements

this now deals with macros in suggestions and the source cost computation does what I want for `channel` :tada:

r? ``@estebank``

23 months agoRollup merge of #97300 - ChayimFriedman2:patch-1, r=dtolnay
Dylan DPC [Tue, 5 Jul 2022 05:12:52 +0000 (10:42 +0530)]
Rollup merge of #97300 - ChayimFriedman2:patch-1, r=dtolnay

Implement `FusedIterator` for `std::net::[Into]Incoming`

They never return `None`, so they trivially fulfill the contract.

What should I put for the stability attribute of `Incoming`?

23 months agoAuto merge of #98872 - JakobDegen:no-invalidate, r=davidtwco
bors [Tue, 5 Jul 2022 04:04:04 +0000 (04:04 +0000)]
Auto merge of #98872 - JakobDegen:no-invalidate, r=davidtwco

Add method to mutate MIR body without invalidating CFG caches.

In addition to adding this method, a handful of passes are updated to use it. There's still quite a few passes that could in principle make use of this as well, but do not at the moment because they use `VisitorMut` or `MirPatch`, which needs additional support for this.

The method name is slightly unwieldy, but I don't expect anyone to be writing it a lot, and at least it says what it does. If anyone has a suggestion for a better name though, would be happy to rename.

r? rust-lang/mir-opt

23 months agointerpret: fix CheckedBinOp behavior when overflow checking is disabled
Ralf Jung [Mon, 4 Jul 2022 12:57:10 +0000 (08:57 -0400)]
interpret: fix CheckedBinOp behavior when overflow checking is disabled

23 months agoAuto merge of #98846 - RalfJung:alignment-is-a-type-thing, r=oli-obk
bors [Tue, 5 Jul 2022 01:23:09 +0000 (01:23 +0000)]
Auto merge of #98846 - RalfJung:alignment-is-a-type-thing, r=oli-obk

interpret: track place alignment together with the type, not the value

This matches how I handle alignment in [MiniRust](https://github.com/RalfJung/minirust). I think it makes conceptually a lot more sense.
Fixes https://github.com/rust-lang/rust/issues/63085

r? `@oli-obk`

23 months agoAuto merge of #98904 - matthiaskrgr:rollup-05owsx7, r=matthiaskrgr
bors [Mon, 4 Jul 2022 22:42:15 +0000 (22:42 +0000)]
Auto merge of #98904 - matthiaskrgr:rollup-05owsx7, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #98738 (Clarify MIR semantics of checked binary operations)
 - #98782 (Improve spans for specialization error)
 - #98793 (Lint against executable files in the root directory)
 - #98814 (rustdoc: Censor certain complex unevaluated const exprs)
 - #98878 (add more `rustc_pass_by_value`)
 - #98879 (Fix "wrap closure in parenthesis" suggestion for `async` closure)
 - #98886 (incr.comp.: Make split-dwarf commandline options [TRACKED].)
 - #98898 (Add "no-div-regex" eslint rule)

Failed merges:

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

23 months agoRollup merge of #98898 - GuillaumeGomez:new-eslint-rul, r=Dylan-DPC
Matthias Krüger [Mon, 4 Jul 2022 21:11:15 +0000 (23:11 +0200)]
Rollup merge of #98898 - GuillaumeGomez:new-eslint-rul, r=Dylan-DPC

Add "no-div-regex" eslint rule

r? `@Dylan-DPC`

23 months agoRollup merge of #98886 - michaelwoerister:tracked-split-dwarf-kind, r=davidtwco
Matthias Krüger [Mon, 4 Jul 2022 21:11:14 +0000 (23:11 +0200)]
Rollup merge of #98886 - michaelwoerister:tracked-split-dwarf-kind, r=davidtwco

incr.comp.: Make split-dwarf commandline options [TRACKED].

This commandline options have an influence on the contents of object files (and .dwo files), so they need to be `[TRACKED]`.

r? `@davidtwco`

23 months agoRollup merge of #98879 - compiler-errors:async-closure-wrap-parens, r=oli-obk
Matthias Krüger [Mon, 4 Jul 2022 21:11:13 +0000 (23:11 +0200)]
Rollup merge of #98879 - compiler-errors:async-closure-wrap-parens, r=oli-obk

Fix "wrap closure in parenthesis" suggestion for `async` closure

Fixes #98023

23 months agoRollup merge of #98878 - lcnr:more-rustc_pass_by_value, r=oli-obk
Matthias Krüger [Mon, 4 Jul 2022 21:11:12 +0000 (23:11 +0200)]
Rollup merge of #98878 - lcnr:more-rustc_pass_by_value, r=oli-obk

add more `rustc_pass_by_value`

r? ```@oli-obk``` cc #98766

23 months agoRollup merge of #98814 - fmease:minimal-fix-for-issue-97933, r=GuillaumeGomez
Matthias Krüger [Mon, 4 Jul 2022 21:11:11 +0000 (23:11 +0200)]
Rollup merge of #98814 - fmease:minimal-fix-for-issue-97933, r=GuillaumeGomez

rustdoc: Censor certain complex unevaluated const exprs

Fixes #97933.

This is more of a hotfix for the aforementioned issue. By that, I mean that my proposed patch is
not the best solution but one that does not change as much existing code.
It treats symptoms rather than the root cause.

This PR “censors” certain complex unevaluated constant expressions like `match`es, blocks, function calls, struct literals etc. by pretty-printing them as `_` / `{ _ }` (number and string literals, paths and `()` are still printed as one would expect).
Resorting to this placeholder is preferable to printing the full expression verbatim since
they can be quite large and verbose resulting in an unreadable mess in the generated documentation.
Further, mindlessly printing the const would leak private and `doc(hidden)` struct fields (#97933), at least in the current
stable & nightly implementations which rely on `span_to_snippet` (!) and `rustc_hir_pretty::id_to_string`.

The censoring of _verbose_ expressions is probably going to stay longer term.
However, in regards to private and `doc(hidden)` struct fields, I have a more proper fix in mind
which I have already partially implemented locally and for which I am going to open a separate PR sometime soon.
For that, I was already in contact with `@GuillaumeGomez.`
The proper fix involves rustdoc not falling back on pretty-printing unevaluated consts so easily (what this PR is concerned about)
and instead preferring to print evaluated consts which contain more information allowing it to selectively hide private and `doc(hidden)` fields, create hyperlinks etc. generally making the output more granular and precise (compared to the brutal `_` placeholder).

Unfortunately, I was a bit too late and the issue just hit stable (1.62).
Should this be backported to beta or even a potential 1.62.1?

r? `@GuillaumeGomez`

23 months agoRollup merge of #98793 - Mark-Simulacrum:fix-tidy-bins, r=jyn514
Matthias Krüger [Mon, 4 Jul 2022 21:11:10 +0000 (23:11 +0200)]
Rollup merge of #98793 - Mark-Simulacrum:fix-tidy-bins, r=jyn514

Lint against executable files in the root directory

This avoids accidental introduction (such as in #97488) of executable files into the root directory, not just under library/, src/ or compiler/.

Resolves #98792

23 months agoRollup merge of #98782 - compiler-errors:specialization-error-span, r=oli-obk
Matthias Krüger [Mon, 4 Jul 2022 21:11:09 +0000 (23:11 +0200)]
Rollup merge of #98782 - compiler-errors:specialization-error-span, r=oli-obk

Improve spans for specialization error

Fixes #98777

23 months agoRollup merge of #98738 - tmiasko:checked-binop, r=oli-obk
Matthias Krüger [Mon, 4 Jul 2022 21:11:07 +0000 (23:11 +0200)]
Rollup merge of #98738 - tmiasko:checked-binop, r=oli-obk

Clarify MIR semantics of checked binary operations

23 months agoAuto merge of #98627 - RalfJung:interpret-arith, r=lcnr
bors [Mon, 4 Jul 2022 20:00:41 +0000 (20:00 +0000)]
Auto merge of #98627 - RalfJung:interpret-arith, r=lcnr

interpret: don't rely on ScalarPair for overflowed arithmetic

This is for https://github.com/rust-lang/rust/pull/97861.
Cc `@eddyb`

I would like to avoid making this depend on `dest.layout.abi` to avoid a branch that we are not usually covering both sides of. Though OTOH this seems like fairly straight-forward code. But let's benchmark this option first to see how bad that extra `force_allocation` really is.

23 months agorustdoc: censor certain complex unevaluated const exprs
León Orell Valerian Liehr [Thu, 23 Jun 2022 15:19:56 +0000 (17:19 +0200)]
rustdoc: censor certain complex unevaluated const exprs

23 months agoAuto merge of #98573 - krasimirgg:nlmb-llvm-nm, r=nikic
bors [Mon, 4 Jul 2022 15:59:44 +0000 (15:59 +0000)]
Auto merge of #98573 - krasimirgg:nlmb-llvm-nm, r=nikic

adapt native-link-modifier-bundle test to use llvm-nm

No functional changes intended.

This updates the test case to use `llvm-nm` as an alternative to https://github.com/rust-lang/rust/pull/98424.

This fixes a test failure over at the experimental build of rustc with HEAD LLVM:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/11144#01814d0f-a46a-4c19-91cf-41e720edb6f9/684-691.

The issue is that this test uses the system nm, which may not be recent
enough to understand the bitcode produced by rustc when compiled against HEAD LLVM.

Similar to what we did for another test in https://github.com/rust-lang/rust/pull/94023.

23 months agoAdd "no-div-regex" eslint rule
Guillaume Gomez [Mon, 4 Jul 2022 15:50:19 +0000 (17:50 +0200)]
Add "no-div-regex" eslint rule

23 months agobootstrap.py: Always use `.exe` for Windows
Chris Denton [Mon, 4 Jul 2022 14:57:10 +0000 (15:57 +0100)]
bootstrap.py: Always use `.exe` for Windows

This ensure that it will run the Windows executable if other files in the directory (such as Linux executables) have the same file name minus the extension.

23 months agoadd regression test for #79467
Takayuki Maeda [Mon, 4 Jul 2022 13:29:03 +0000 (22:29 +0900)]
add regression test for #79467

23 months agoextra assertion, extra sure
Ralf Jung [Mon, 4 Jul 2022 13:12:22 +0000 (09:12 -0400)]
extra assertion, extra sure

23 months agoclarify comment
Ralf Jung [Mon, 4 Jul 2022 13:05:23 +0000 (09:05 -0400)]
clarify comment

23 months agoregion obligations, remove `body_id`
lcnr [Wed, 29 Jun 2022 16:14:11 +0000 (18:14 +0200)]
region obligations, remove `body_id`

23 months agoimplied bounds byebye nested hir ids
lcnr [Wed, 29 Jun 2022 16:04:58 +0000 (18:04 +0200)]
implied bounds byebye nested hir ids

23 months agorip out `RegionCtxt` from hir typeck
lcnr [Wed, 29 Jun 2022 15:46:16 +0000 (17:46 +0200)]
rip out `RegionCtxt` from hir typeck