]> git.lizzy.rs Git - rust.git/log
rust.git
23 months agoReview comments: wording
Esteban Küber [Wed, 22 Jun 2022 18:04:36 +0000 (11:04 -0700)]
Review comments: wording

23 months agoTweak wording and spans
Esteban Küber [Tue, 21 Jun 2022 22:54:17 +0000 (15:54 -0700)]
Tweak wording and spans

23 months agoOn partial uninit error point at where we need init
Esteban Küber [Tue, 21 Jun 2022 18:57:45 +0000 (11:57 -0700)]
On partial uninit error point at where we need init

When a binding is declared without a value, borrowck verifies that all
codepaths have *one* assignment to them to initialize them fully. If
there are any cases where a condition can be met that leaves the binding
uninitialized or we attempt to initialize a field of an unitialized
binding, we emit E0381.

We now look at all the statements that initialize the binding, and use
them to explore branching code paths that *don't* and point at them. If
we find *no* potential places where an assignment to the binding might
be missing, we display the spans of all the existing initializers to
provide some context.

23 months agoAuto merge of #99014 - Dylan-DPC:rollup-n84y0jk, r=Dylan-DPC
bors [Thu, 7 Jul 2022 15:08:27 +0000 (15:08 +0000)]
Auto merge of #99014 - Dylan-DPC:rollup-n84y0jk, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #96856 (Fix ProjectionElem validation)
 - #97711 (Improve soundness of rustc_arena)
 - #98507 (Finishing touches for `#[expect]` (RFC 2383))
 - #98692 (rustdoc: Cleanup more FIXMEs)
 - #98901 (incr: cache dwarf objects in work products)
 - #98930 (Make MIR basic blocks field public)
 - #98973 (Remove (unused) inherent impl anchors)
 - #98981 ( Edit `rustc_mir_dataflow::framework` documentation )

Failed merges:

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

23 months agoRollup merge of #98981 - pierwill:pierwill/dataflow-docs-edits, r=Dylan-DPC
Dylan DPC [Thu, 7 Jul 2022 12:36:55 +0000 (18:06 +0530)]
Rollup merge of #98981 - pierwill:pierwill/dataflow-docs-edits, r=Dylan-DPC

 Edit `rustc_mir_dataflow::framework` documentation

Some edits for clarity and consistency.

23 months agoRollup merge of #98973 - GuillaumeGomez:inherent-impl-anchors, r=notriddle
Dylan DPC [Thu, 7 Jul 2022 12:36:54 +0000 (18:06 +0530)]
Rollup merge of #98973 - GuillaumeGomez:inherent-impl-anchors, r=notriddle

Remove (unused) inherent impl anchors

This is something `@notriddle` realized a few days ago: we have unused anchors in the DOM.

This PR removes them.

You can test it [here](https://rustdoc.crud.net/imperio/inherent-impl-anchors/foo/index.html).

r? `@notriddle`

23 months agoRollup merge of #98930 - tmiasko:pub-basic-blocks, r=oli-obk
Dylan DPC [Thu, 7 Jul 2022 12:36:53 +0000 (18:06 +0530)]
Rollup merge of #98930 - tmiasko:pub-basic-blocks, r=oli-obk

Make MIR basic blocks field public

This makes it possible to mutably borrow different fields of the MIR
body without resorting to methods like `basic_blocks_local_decls_mut_and_var_debug_info`.

To preserve validity of control flow graph caches in the presence of
modifications, a new struct `BasicBlocks` wraps together basic blocks
and control flow graph caches.

The `BasicBlocks` dereferences to `IndexVec<BasicBlock, BasicBlockData>`.
On the other hand a mutable access requires explicit `as_mut()` call.

23 months agoRollup merge of #98901 - davidtwco:split-dwarf-incr-workproduct, r=michaelwoerister
Dylan DPC [Thu, 7 Jul 2022 12:36:52 +0000 (18:06 +0530)]
Rollup merge of #98901 - davidtwco:split-dwarf-incr-workproduct, r=michaelwoerister

incr: cache dwarf objects in work products

Cache DWARF objects alongside object files in work products when those exist so that DWARF object files are available for thorin in packed mode in incremental scenarios.

r? `@michaelwoerister`

23 months agoRollup merge of #98692 - camelid:more-fixmes, r=GuillaumeGomez
Dylan DPC [Thu, 7 Jul 2022 12:36:51 +0000 (18:06 +0530)]
Rollup merge of #98692 - camelid:more-fixmes, r=GuillaumeGomez

rustdoc: Cleanup more FIXMEs

r? `@GuillaumeGomez`

23 months agoRollup merge of #98507 - xFrednet:rfc-2383-manual-expectation-magic, r=wesleywiser
Dylan DPC [Thu, 7 Jul 2022 12:36:50 +0000 (18:06 +0530)]
Rollup merge of #98507 - xFrednet:rfc-2383-manual-expectation-magic, r=wesleywiser

Finishing touches for `#[expect]` (RFC 2383)

This PR adds documentation and some functionality to rustc's lint passes, to manually fulfill expectations. This is needed for some lints in Clippy. Hopefully, it should be one of the last things before we can move forward with stabilizing this feature.

As part of this PR, I've also updated `clippy::duplicate_mod` to showcase how this new functionality can be used and to ensure that it works correctly.

---

changelog: [`duplicate_mod`]: Fixed lint attribute interaction

r? `@wesleywiser`

cc: https://github.com/rust-lang/rust/issues/97660, https://github.com/rust-lang/rust/issues/85549

And I guess that's it. Here have a magical unicorn :unicorn:

23 months agoRollup merge of #97711 - Nilstrieb:rustc-arena-ub, r=wesleywiser
Dylan DPC [Thu, 7 Jul 2022 12:36:49 +0000 (18:06 +0530)]
Rollup merge of #97711 - Nilstrieb:rustc-arena-ub, r=wesleywiser

Improve soundness of rustc_arena

Make it runnable in miri by changing the loop iteration count for some tests in miri. Also fix a stacked borrows issue with box.

23 months agoRollup merge of #96856 - DrMeepster:fix_projection_validation, r=Icnr
Dylan DPC [Thu, 7 Jul 2022 12:36:48 +0000 (18:06 +0530)]
Rollup merge of #96856 - DrMeepster:fix_projection_validation, r=Icnr

Fix ProjectionElem validation

`TypeChecker::visit_projection_elem` was not actually being called.

23 months agoAuto merge of #98675 - eddyb:cg-array-literal, r=nikic
bors [Thu, 7 Jul 2022 12:23:26 +0000 (12:23 +0000)]
Auto merge of #98675 - eddyb:cg-array-literal, r=nikic

rustc_codegen_ssa: use `project_index`, not `project_field`, for array literals.

See https://github.com/rust-lang/rust/pull/98615#issuecomment-1170082774 for some context.

In short, we were using `project_field` even for array `mir::Rvalue::Aggregate`s, which results in benchmarks like `deep-vector.rs` (and presumably also some real-world usecases?) being impacted by how we handle non-array aggregate fields.

(This is a separate PR so that we can measure the perf effects in isolation)

r? `@nikic`

23 months agoAuto merge of #98841 - Kobzol:hir-validator-bitset, r=cjgillot
bors [Thu, 7 Jul 2022 07:38:08 +0000 (07:38 +0000)]
Auto merge of #98841 - Kobzol:hir-validator-bitset, r=cjgillot

Use a bitset instead of a hash map in HIR ID validator

The hashset insertion was slightly hot in incr patched runs, but it seems unnecessary to use a hashset here, as it just checks that a dense set of N integers was seen.

I'm not sure if it's possible to know the amount of items beforehand to preallocate the bitset? I suppose not.

23 months agoMove `dominators` from Body to BasicBlocks
Tomasz Miąsko [Tue, 5 Jul 2022 00:00:00 +0000 (00:00 +0000)]
Move `dominators` from Body to BasicBlocks

23 months agoMove `switch_sources` from Body to BasicBlocks
Tomasz Miąsko [Tue, 5 Jul 2022 00:00:00 +0000 (00:00 +0000)]
Move `switch_sources` from Body to BasicBlocks

23 months agoMove `predecessors` from Body to BasicBlocks
Tomasz Miąsko [Tue, 5 Jul 2022 00:00:00 +0000 (00:00 +0000)]
Move `predecessors` from Body to BasicBlocks

23 months agoMove `is_cfg_cyclic` from Body to BasicBlocks
Tomasz Miąsko [Tue, 5 Jul 2022 00:00:00 +0000 (00:00 +0000)]
Move `is_cfg_cyclic` from Body to BasicBlocks

23 months agoMake MIR basic blocks field public
Tomasz Miąsko [Mon, 4 Jul 2022 00:00:00 +0000 (00:00 +0000)]
Make MIR basic blocks field public

This makes it possible to mutably borrow different fields of the MIR
body without resorting to methods like `basic_blocks_local_decls_mut_and_var_debug_info`.

To preserve validity of control flow graph caches in the presence of
modifications, a new struct `BasicBlocks` wraps together basic blocks
and control flow graph caches.

The `BasicBlocks` dereferences to `IndexVec<BasicBlock, BasicBlockData>`.
On the other hand a mutable access requires explicit `as_mut()` call.

23 months agoAuto merge of #98827 - aDotInTheVoid:suggest-extern-block, r=nagisa
bors [Thu, 7 Jul 2022 04:18:47 +0000 (04:18 +0000)]
Auto merge of #98827 - aDotInTheVoid:suggest-extern-block, r=nagisa

Suggest using block for `extern "abi" fn` with no body

`@rustbot` modify labels: +A-diagnostics

23 months agoAuto merge of #98487 - cjgillot:variance-nohir, r=wesleywiser
bors [Thu, 7 Jul 2022 01:17:36 +0000 (01:17 +0000)]
Auto merge of #98487 - cjgillot:variance-nohir, r=wesleywiser

Do not fetch HIR to compute variances.

Everything can be done using higher-level queries.  This simplifies the code, and should allow better incremental caching.

23 months agoAuto merge of #98831 - RalfJung:no-more-unsized-locals, r=oli-obk
bors [Wed, 6 Jul 2022 22:50:29 +0000 (22:50 +0000)]
Auto merge of #98831 - RalfJung:no-more-unsized-locals, r=oli-obk

interpret: remove support for unsized_locals

I added support for unsized_locals in https://github.com/rust-lang/rust/pull/59780 but the current implementation is a crude hack and IMO definitely not the right way to have unsized locals in MIR. It also [causes problems](https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Missing.20Layout.20Check.20in.20.60interpret.2Foperand.2Ers.60.3F). and what codegen does is unsound and has been for years since clearly nobody cares (so I hope nobody actually relies on that implementation and I'll be happy if Miri ensures they do not). I think if we want to have unsized locals in Miri/MIR we should add them properly, either by having a `StorageLive` that takes metadata or by having an `alloca` that returns a pointer (making the ptr indirection explicit) or something like that.

So, this PR removes the `LocalValue::Unallocated` hack. It adds `Immediate::Uninit`, for several reasons:
- This lets us still do fairly little work in `push_stack_frame`, in particular we do not actually have to create any allocations.
- If/when I remove `ScalarMaybeUninit`, we will need something like this to have an "optimized" representation of uninitialized locals. Without this we'd have to put uninitialized integers into the heap!
- const-prop needs some way to indicate "I don't know the value of this local'; it used to use `LocalValue::Unallocated` for that, now it can use `Immediate::Uninit`.

There is still a fundamental difference between `LocalValue::Unallocated` and `Immediate::Uninit`: the latter is considered a regular local that you can read from and write to, it just has a more optimized representation when compared with an actual `Allocation` that is fully uninit. In contrast, `LocalValue::Unallocated`  had this really odd behavior where you would write to it but not read from it. (This is in fact what caused the problems mentioned above.)

While at it I also did two drive-by cleanups/improvements:
- In `pop_stack_frame`, do the return value copying and local deallocation while the frame is still on the stack. This leads to better error locations being reported. The old errors were [sometimes rather confusing](https://rust-lang.zulipchat.com/#narrow/stream/269128-miri/topic/Cron.20Job.20Failure.202022-06-24/near/287445522).
- Deduplicate `copy_op` and `copy_op_transmute`.

r? `@oli-obk`

23 months agoAuto merge of #98987 - GuillaumeGomez:rollup-bcy32bp, r=GuillaumeGomez
bors [Wed, 6 Jul 2022 20:09:41 +0000 (20:09 +0000)]
Auto merge of #98987 - GuillaumeGomez:rollup-bcy32bp, r=GuillaumeGomez

Rollup of 7 pull requests

Successful merges:

 - #96935 (Allow arithmetic and certain bitwise ops on AtomicPtr)
 - #98519 (Replace some `guess_head_span` with `def_span`)
 - #98911 (rustdoc: filter '_ lifetimes from ty::Generics)
 - #98939 (rustdoc: Add more semantic information to impl IDs)
 - #98971 (Fix typo in file descriptor docs)
 - #98983 (docs: Add overview of `rustc_middle::mir::TerminatorKind`)
 - #98984 (Remove erroneous doc comment)

Failed merges:

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

23 months agoFix `#[expect]` and `#[allow]` for `clippy::duplicate_mod`
xFrednet [Sat, 25 Jun 2022 22:00:47 +0000 (00:00 +0200)]
Fix `#[expect]` and `#[allow]` for `clippy::duplicate_mod`

23 months agoAdd function to manually fulfill lint expectations (RFC 2383)
xFrednet [Thu, 16 Jun 2022 11:20:57 +0000 (13:20 +0200)]
Add function to manually fulfill lint expectations (RFC 2383)

23 months agoDocument, that some lint have to be expected on the crate level (RFC 2383)
xFrednet [Thu, 16 Jun 2022 10:52:35 +0000 (12:52 +0200)]
Document, that some lint have to be expected on the crate level (RFC 2383)

Examples: NON_ASCII_IDENTS, UNCOMMON_CODEPOINTS, CONFUSABLE_IDENTS, MIXED_SCRIPT_CONFUSABLES

23 months agoRollup merge of #98984 - pierwill:patch-4, r=RalfJung
Guillaume Gomez [Wed, 6 Jul 2022 18:43:29 +0000 (20:43 +0200)]
Rollup merge of #98984 - pierwill:patch-4, r=RalfJung

Remove erroneous doc comment

Fixes the formatting issue shown here:

<img width="803" alt="Screen Shot 2022-07-06 at 12 50 56 PM" src="https://user-images.githubusercontent.com/19642016/177612734-2d881c6a-2850-4c1b-8f1a-08339ad5bfbc.png">

23 months agoRollup merge of #98983 - pierwill:patch-3, r=RalfJung
Guillaume Gomez [Wed, 6 Jul 2022 18:43:28 +0000 (20:43 +0200)]
Rollup merge of #98983 - pierwill:patch-3, r=RalfJung

docs: Add overview of `rustc_middle::mir::TerminatorKind`

23 months agoRollup merge of #98971 - MinnDevelopment:patch-1, r=Dylan-DPC
Guillaume Gomez [Wed, 6 Jul 2022 18:43:28 +0000 (20:43 +0200)]
Rollup merge of #98971 - MinnDevelopment:patch-1, r=Dylan-DPC

Fix typo in file descriptor docs

23 months agoRollup merge of #98939 - GuillaumeGomez:rustdoc-disamb-impls, r=notriddle
Guillaume Gomez [Wed, 6 Jul 2022 18:43:27 +0000 (20:43 +0200)]
Rollup merge of #98939 - GuillaumeGomez:rustdoc-disamb-impls, r=notriddle

rustdoc: Add more semantic information to impl IDs

Take over of #92745.

I fixed the last remaining issue for the links in the sidebar (mentioned by `@jsha)` and fixed the few links broken in the std/core docs.

cc `@camelid`
r? `@notriddle`

23 months agoRollup merge of #98911 - notriddle:notriddle/rustdoc-string-impl, r=GuillaumeGomez
Guillaume Gomez [Wed, 6 Jul 2022 18:43:25 +0000 (20:43 +0200)]
Rollup merge of #98911 - notriddle:notriddle/rustdoc-string-impl, r=GuillaumeGomez

rustdoc: filter '_ lifetimes from ty::Generics

Fixes a weirdly-rendered section of the std::string::String docs.

Before:

![image](https://user-images.githubusercontent.com/1593513/177256873-20b9cf6e-2429-4865-853b-b269d74672f4.png)

After:

![image](https://user-images.githubusercontent.com/1593513/177256900-ef3efd17-f624-40c5-af90-fe709ec034f2.png)

23 months agoRollup merge of #98519 - TaKO8Ki:add-head-span-field-to-item-and-impl-item, r=cjgillot
Guillaume Gomez [Wed, 6 Jul 2022 18:43:24 +0000 (20:43 +0200)]
Rollup merge of #98519 - TaKO8Ki:add-head-span-field-to-item-and-impl-item, r=cjgillot

Replace some `guess_head_span` with `def_span`

This patch fixes a part of #97417.
r? `@cjgillot`

23 months agoRollup merge of #96935 - thomcc:atomicptr-strict-prov, r=dtolnay
Guillaume Gomez [Wed, 6 Jul 2022 18:43:23 +0000 (20:43 +0200)]
Rollup merge of #96935 - thomcc:atomicptr-strict-prov, r=dtolnay

Allow arithmetic and certain bitwise ops on AtomicPtr

This is mainly to support migrating from `AtomicUsize`, for the strict provenance experiment.

This is a pretty dubious set of APIs, but it should be sufficient to allow code that's using `AtomicUsize` to manipulate a tagged pointer atomically. It's under a new feature gate, `#![feature(strict_provenance_atomic_ptr)]`, but I'm not sure if it needs its own tracking issue. I'm happy to make one, but it's not clear that it's needed.

I'm unsure if it needs changes in the various non-LLVM backends. Because we just cast things to integers anyway (and were already doing so), I doubt it.

API change proposal: https://github.com/rust-lang/libs-team/issues/60

Fixes #95492

23 months agofix a strange ConstProp ICE
Ralf Jung [Sun, 3 Jul 2022 02:02:12 +0000 (22:02 -0400)]
fix a strange ConstProp ICE

23 months agodeduplicate some copy_op code
Ralf Jung [Sun, 3 Jul 2022 00:40:41 +0000 (20:40 -0400)]
deduplicate some copy_op code

23 months agobless
Ralf Jung [Sun, 3 Jul 2022 00:10:15 +0000 (20:10 -0400)]
bless

23 months agosupport passing unsized fn arguments
Ralf Jung [Sat, 2 Jul 2022 21:09:40 +0000 (17:09 -0400)]
support passing unsized fn arguments

23 months agointerpret: remove LocalValue::Unallocated, add Operand::Uninit
Ralf Jung [Sat, 2 Jul 2022 20:24:42 +0000 (16:24 -0400)]
interpret: remove LocalValue::Unallocated, add Operand::Uninit

Operand::Uninit is an *allocated* operand that is fully uninitialized.
This lets us lazily allocate the actual backing store of *all* locals (no matter their ABI).

I also reordered things in pop_stack_frame at the same time.
I should probably have made that a separate commit...

23 months agoFix stacked borrows violation in rustc_arena
Nilstrieb [Fri, 3 Jun 2022 20:47:05 +0000 (22:47 +0200)]
Fix stacked borrows violation in rustc_arena

There was a problem with storing a `Box<T>` in a struct, where
the current rules would invalidate the value. this makes it store
a raw pointer instead, circumventing the aliasing problems.

23 months agoRemove erroneous doc comment
pierwill [Wed, 6 Jul 2022 17:52:02 +0000 (12:52 -0500)]
Remove erroneous doc comment

23 months agodocs: Add overview of `rustc_middle::mir::TerminatorKind`
pierwill [Wed, 6 Jul 2022 17:48:19 +0000 (12:48 -0500)]
docs: Add overview of `rustc_middle::mir::TerminatorKind`

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 agoEdit `rustc_mir_dataflow::framework` documentation
pierwill [Wed, 6 Jul 2022 16:16:29 +0000 (11:16 -0500)]
Edit `rustc_mir_dataflow::framework` documentation

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 agoAdd test for inherent impls anchors
Guillaume Gomez [Wed, 6 Jul 2022 12:07:41 +0000 (14:07 +0200)]
Add test for inherent impls anchors

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 agoSuggest using block for `extern "abi" fn` with no body
Nixon Enraght-Moony [Sat, 2 Jul 2022 17:53:16 +0000 (18:53 +0100)]
Suggest using block for `extern "abi" fn` with no body

23 months agoDon't generate anchors on inherent impl methods
Guillaume Gomez [Wed, 6 Jul 2022 11:48:51 +0000 (13:48 +0200)]
Don't generate anchors on inherent impl methods

23 months agossa: abort if dwarf packaging fails
David Wood [Wed, 6 Jul 2022 09:56:08 +0000 (10:56 +0100)]
ssa: abort if dwarf packaging fails

This should have been here from the start... oops. When `thorin` fails
to package a DWARF package, that should fail compilation.

23 months agossa: remove dwo of metadata and allocator module
David Wood [Wed, 6 Jul 2022 09:15:45 +0000 (10:15 +0100)]
ssa: remove dwo of metadata and allocator module

Compiling with `-Csplit-debuginfo=packed` was leaving behind `.dwo`
files because either the metadata or allocator module contained a DWARF
object which was not being removed by the
`maybe_remove_temps_from_module` closure.

23 months agoincr: cache dwarf objects in work products
David Wood [Mon, 4 Jul 2022 13:38:42 +0000 (14:38 +0100)]
incr: cache dwarf objects in work products

Cache DWARF objects alongside object files in work products when those
exist so that DWARF object files are available for thorin in packed mode
in incremental scenarios.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agofix miri-opt tests
Takayuki Maeda [Wed, 6 Jul 2022 01:47:29 +0000 (10:47 +0900)]
fix miri-opt tests

23 months agouse `named_span` in case of tuple variant
Takayuki Maeda [Mon, 4 Jul 2022 09:13:16 +0000 (18:13 +0900)]
use `named_span` in case of tuple variant

23 months agoadd `Node::Variant` to `Map::opt_span`
Takayuki Maeda [Mon, 4 Jul 2022 08:23:58 +0000 (17:23 +0900)]
add `Node::Variant` to `Map::opt_span`

23 months agoreplace `guess_head_span` with `def_span`
Takayuki Maeda [Mon, 4 Jul 2022 08:23:24 +0000 (17:23 +0900)]
replace `guess_head_span` with `def_span`

23 months agoFix typo in file descriptor docs
Florian Spieß [Wed, 6 Jul 2022 09:57:58 +0000 (11:57 +0200)]
Fix typo in file descriptor docs

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 agofix projectionelem validation
DrMeepster [Mon, 9 May 2022 04:23:52 +0000 (21:23 -0700)]
fix projectionelem validation

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 agoFix links in std/core documentation
Guillaume Gomez [Tue, 5 Jul 2022 15:42:11 +0000 (17:42 +0200)]
Fix links in std/core documentation

23 months agoFix link generation in the sidebar for impls
Guillaume Gomez [Tue, 5 Jul 2022 15:42:01 +0000 (17:42 +0200)]
Fix link generation in the sidebar for impls

23 months agoUpdate rustdoc tests
Guillaume Gomez [Tue, 5 Jul 2022 13:10:12 +0000 (15:10 +0200)]
Update rustdoc tests

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 agorustdoc: Add more semantic information to impl ids
pierwill [Mon, 10 Jan 2022 21:35:55 +0000 (15:35 -0600)]
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>
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