Commit graph

171804 commits

Author SHA1 Message Date
Guillaume Gomez 6fa68c9b44 Fix link generation in the sidebar for impls 2022-07-05 21:33:39 +02:00
Guillaume Gomez 05e69d8fc6 Update rustdoc tests 2022-07-05 21:33:39 +02:00
Eric Huss 4caec093d7 Update cargo 2022-07-05 11:58:38 -07:00
Eric Huss 15747dc910 Update books 2022-07-05 11:44:56 -07:00
Alan Egerton bca894909c
Split TypeVisitable from TypeFoldable 2022-07-05 19:18:19 +01:00
bors 41ad4d9b2d 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
2022-07-05 17:46:53 +00:00
pierwill 499e024ac9 rustdoc: Add more semantic information to impl ids
Instead of generating `#impl`, `#impl-1`, etc., generate IDs
like `#impl-Foo<M>`.

Co-authored-by: Noah Lev <camelidcamel@gmail.com>
2022-07-05 19:43:52 +02:00
Ralf Jung d5721ce3a0 add asserts 2022-07-05 13:26:52 -04:00
Ralf Jung cedc428a5f fix the layout of repr(align) enums 2022-07-05 13:24:21 -04:00
pierwill f8b16c5d87 Edit rustc_mir_dataflow::framework::lattice::FlatSet docs
Cosmetic improvements. Adds a paragraph break, and
ellipses to signify arbitrary size of a flat set.
2022-07-05 11:34:39 -05:00
Patryk Wychowaniec d61e4a4df0
Update llvm-project 2022-07-05 17:57:29 +02:00
Matthias Krüger 720eb123af
Rollup merge of #98921 - TaKO8Ki:refactor-fulfillment-context-select, r=Dylan-DPC
Refactor: remove a redundant mutable variable
2022-07-05 17:08:15 +02:00
Matthias Krüger 1c248ea22f
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 cbbf06b0cd (commitcomment-77670922).
2022-07-05 17:08:14 +02:00
Matthias Krüger a82f4a574e
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`
2022-07-05 17:08:13 +02:00
Matthias Krüger 70ade7d503
Rollup merge of #98889 - TaKO8Ki:add-regression-test-for-79467, r=Dylan-DPC
Add regression test for #79467

closes #79467
2022-07-05 17:08:12 +02:00
Matthias Krüger cca43fe8e2
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`
2022-07-05 17:08:11 +02:00
Matthias Krüger 69195c026e
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.
2022-07-05 17:08:10 +02:00
David Wood 9d864c8d56 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.
2022-07-05 16:00:21 +01:00
David Wood 7f9d8480d6 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>
2022-07-05 16:00:21 +01:00
David Wood 406579ae13 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>
2022-07-05 16:00:21 +01:00
David Wood 540eaf985d 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>
2022-07-05 16:00:20 +01:00
David Wood 2874f09534 lint: LintDiagnosticBuilder into rustc_errors
Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-05 16:00:20 +01:00
David Wood 84ec77769f macros: fix documentation link for diag derive
Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-05 16:00:20 +01:00
bors efb171e235 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
2022-07-05 14:58:31 +00:00
bors 54f79babae 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 (⬆️ rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-05 12:17:26 +00:00
Ralf Jung 46956f76ca adjust dangling-int-ptr error message 2022-07-05 08:08:24 -04:00
Ralf Jung 2f6e996662 always check overflow in CheckedBinOp in CTFE 2022-07-05 07:32:38 -04:00
Dylan DPC 1036a3854c
Rollup merge of #98913 - lnicola:rust-analyzer-2022-07-05, r=lnicola
⬆️ rust-analyzer

r? ``@ghost``
2022-07-05 16:04:35 +05:30
Dylan DPC 6a61e18688
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``
2022-07-05 16:04:34 +05:30
Dylan DPC c2613a5c7f
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
2022-07-05 16:04:33 +05:30
Dylan DPC 291df97fae
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``
2022-07-05 16:04:32 +05:30
Dylan DPC 8fa1ed8f12
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
2022-07-05 16:04:31 +05:30
Krasimir Georgiev 9eec33464e adapt issue-37945 codegen test to accept any order of ops 2022-07-05 09:45:24 +00:00
bors 53792b9c5c 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.
2022-07-05 09:36:29 +00:00
Takayuki Maeda c9e2aa4d7f refactor: remove a redundant mutable variable 2022-07-05 18:28:36 +09:00
Oli Scherer 82c73af4a6 Prefer trace level instrumentation for the new noisy instrument attributes 2022-07-05 09:27:06 +00:00
Oli Scherer c3aec3056e Add a helper method with an explicit name instead of hand rolling a match 3x 2022-07-05 09:26:45 +00:00
Chris Denton 9ac4a4e67a
Fix typo in src/bootstrap/bootstrap.py
Co-authored-by: Marco Colombo <mar.colombo13@gmail.com>
2022-07-05 09:06:43 +01:00
bors 4045ce641a 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
2022-07-05 06:44:49 +00:00
Laurențiu Nicola 170b173a3b ⬆️ rust-analyzer 2022-07-05 09:29:11 +03:00
Michael Howell 3ac1a9b50d rustdoc: filter '_ lifetimes from ty::Generics
Fixes a weirdly-rendered section of the std::string::String docs.
2022-07-04 22:21:38 -07:00
Dylan DPC 9a2274cf81
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
2022-07-05 10:42:59 +05:30
Dylan DPC 6e5f1d491a
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
2022-07-05 10:42:58 +05:30
Dylan DPC 7702c50ea5
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...
2022-07-05 10:42:57 +05:30
Dylan DPC 522d52cef7
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``
2022-07-05 10:42:55 +05:30
Dylan DPC 6a9db39f6c
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` 🎉

r? ``@estebank``
2022-07-05 10:42:54 +05:30
Dylan DPC d26ccf7067
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`?
2022-07-05 10:42:52 +05:30
bors 880646ca9c 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
2022-07-05 04:04:04 +00:00
Ralf Jung 6f01ff61b3 interpret: fix CheckedBinOp behavior when overflow checking is disabled 2022-07-04 23:29:41 -04:00
bors 4008dd8c6d 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`
2022-07-05 01:23:09 +00:00