]> git.lizzy.rs Git - rust.git/log
rust.git
23 months agoUse map_bound
Jack Huey [Fri, 8 Jul 2022 01:43:24 +0000 (21:43 -0400)]
Use map_bound

23 months agoAdd bound_const_param_default
Jack Huey [Fri, 8 Jul 2022 00:56:22 +0000 (20:56 -0400)]
Add bound_const_param_default

23 months agoMove EarlyBinder calls in rustc_typeck::outlives a bit further up
Jack Huey [Sat, 2 Jul 2022 22:27:49 +0000 (18:27 -0400)]
Move EarlyBinder calls in rustc_typeck::outlives a bit further up

23 months agoAuto merge of #99024 - matthiaskrgr:rollup-8ygpcpg, r=matthiaskrgr
bors [Thu, 7 Jul 2022 20:55:34 +0000 (20:55 +0000)]
Auto merge of #99024 - matthiaskrgr:rollup-8ygpcpg, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #97917 (Implement ExitCodeExt for Windows)
 - #98844 (Reword comments and rename HIR visiting methods.)
 - #98979 (interpret: use AllocRange in UninitByteAccess)
 - #98986 (Fix missing word in comment)
 - #98994 (replace process exit with more detailed exit in src/bootstrap/*.rs)
 - #98995 (Add a test for #80471)
 - #99002 (suggest adding a derive for #[default] applied to variants)
 - #99004 (Add a test for #70408)
 - #99017 (Replace boolean argument for print_where_clause with an enum to make code more clear)

Failed merges:

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

23 months agoRollup merge of #99017 - GuillaumeGomez:rustdoc-ending-enum, r=notriddle
Matthias Krüger [Thu, 7 Jul 2022 18:33:32 +0000 (20:33 +0200)]
Rollup merge of #99017 - GuillaumeGomez:rustdoc-ending-enum, r=notriddle

Replace boolean argument for print_where_clause with an enum to make code more clear

As you suggested ``@notriddle.`` Just not sure if the naming seems good to you?

r? ``@notriddle``

23 months agoRollup merge of #99004 - TaKO8Ki:add-test-for-70408, r=Mark-Simulacrum
Matthias Krüger [Thu, 7 Jul 2022 18:33:31 +0000 (20:33 +0200)]
Rollup merge of #99004 - TaKO8Ki:add-test-for-70408, r=Mark-Simulacrum

Add a test for #70408

closes #70408

23 months agoRollup merge of #99002 - fee1-dead-contrib:sugg_derive, r=michaelwoerister
Matthias Krüger [Thu, 7 Jul 2022 18:33:30 +0000 (20:33 +0200)]
Rollup merge of #99002 - fee1-dead-contrib:sugg_derive, r=michaelwoerister

suggest adding a derive for #[default] applied to variants

cc ``@TaKO8Ki`` as followup to #98873.

23 months agoRollup merge of #98995 - TaKO8Ki:add-test-for-80471, r=Mark-Simulacrum
Matthias Krüger [Thu, 7 Jul 2022 18:33:29 +0000 (20:33 +0200)]
Rollup merge of #98995 - TaKO8Ki:add-test-for-80471, r=Mark-Simulacrum

Add a test for #80471

Tests #80471, but doesn't close it, see https://github.com/rust-lang/rust/issues/80471#issuecomment-1177658967.

23 months agoRollup merge of #98994 - kons-9:dont_use_process_exit, r=jyn514
Matthias Krüger [Thu, 7 Jul 2022 18:33:28 +0000 (20:33 +0200)]
Rollup merge of #98994 - kons-9:dont_use_process_exit, r=jyn514

replace process exit with more detailed exit in src/bootstrap/*.rs

Fixes [#98830](https://github.com/rust-lang/rust/issues/98830)

I implemeted "detail_exit.rs" in lib.rs, and replace all of std::process::exit.
So, error code should panic in test code.
```
// lib.rs
pub fn detail_exit(code: i32) -> ! {
    // Successful exit
    if code == 0 {
        std::process::exit(0);
    }
    if cfg!(test) {
        panic!("status code: {}", code);
    } else {
        std::panic::resume_unwind(Box::new(code));
    }
}
```

<details>
<summary>% rg "exit\(" src/bootstrap/*.rs</summary>

```
builder.rs
351:            crate::detail_exit(1);
1000:            crate::detail_exit(1);
1429:                    crate::detail_exit(1);

compile.rs
1331:        crate::detail_exit(1);

config.rs
818:                    crate::detail_exit(2);
1488:        crate::detail_exit(1);

flags.rs
263:                crate::detail_exit(exit_code);
349:            crate::detail_exit(exit_code);
381:            crate::detail_exit(1);
602:                        crate::detail_exit(1);
616:                crate::detail_exit(1);
807:            crate::detail_exit(1);

format.rs
35:            crate::detail_exit(1);
117:        crate::detail_exit(1);

lib.rs
714:            detail_exit(1);
1620:                detail_exit(1);
1651:pub fn detail_exit(code: i32) -> ! {
1654:        std::process::exit(0);

sanity.rs
107:            crate::detail_exit(1);

setup.rs
97:        crate::detail_exit(1);
290:            crate::detail_exit(1);

test.rs
676:            crate::detail_exit(1);
1024:                crate::detail_exit(1);
1254:            crate::detail_exit(1);

tool.rs
207:                crate::detail_exit(1);

toolstate.rs
96:    crate::detail_exit(3);
111:            crate::detail_exit(1);
182:            crate::detail_exit(1);
228:            crate::detail_exit(1);

util.rs
339:        crate::detail_exit(1);
378:        crate::detail_exit(1);
468:    crate::detail_exit(1);
```
</details>

23 months agoRollup merge of #98986 - pierwill:patch-5, r=oli-obk
Matthias Krüger [Thu, 7 Jul 2022 18:33:27 +0000 (20:33 +0200)]
Rollup merge of #98986 - pierwill:patch-5, r=oli-obk

Fix missing word in comment

23 months agoRollup merge of #98979 - RalfJung:more-alloc-range, r=oli-obk
Matthias Krüger [Thu, 7 Jul 2022 18:33:26 +0000 (20:33 +0200)]
Rollup merge of #98979 - RalfJung:more-alloc-range, r=oli-obk

interpret: use AllocRange in UninitByteAccess

also use nice new format string syntax in `interpret/error.rs`, and use the `#` flag to add `0x` prefixes where applicable.

r? ``@oli-obk``

23 months agoRollup merge of #98844 - cjgillot:deep-visit, r=jyn514
Matthias Krüger [Thu, 7 Jul 2022 18:33:24 +0000 (20:33 +0200)]
Rollup merge of #98844 - cjgillot:deep-visit, r=jyn514

Reword comments and rename HIR visiting methods.

Sparked by this discussion in [zulip](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Confused.20by.20comment.20on.20.60deep_visit_item_likes_in_module.60)

r? ``@jyn514`` ``@camsteffen``

23 months agoRollup merge of #97917 - AronParker:master, r=ChrisDenton
Matthias Krüger [Thu, 7 Jul 2022 18:33:23 +0000 (20:33 +0200)]
Rollup merge of #97917 - AronParker:master, r=ChrisDenton

Implement ExitCodeExt for Windows

Fixes #97914

### Motivation:

On Windows it is common for applications to return `HRESULT` (`i32`) or `DWORD` (`u32`) values. These stem from COM based components ([HRESULTS](https://docs.microsoft.com/en-us/windows/win32/api/objbase/nf-objbase-coinitialize)), Win32 errors ([GetLastError](https://docs.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-getlasterror)), GUI applications ([WM_QUIT](https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-quit)) and more. The newly stabilized `ExitCode` provides an excellent fit for propagating these values, because `std::process::exit` does not run deconstructors which can result in errors. However, `ExitCode` currently only implements `From<u8> for ExitCode`, which disallows the full range of `i32`/`u32` values. This pull requests attempts to address that shortcoming by providing windows specific extensions that accept a `u32` value (which covers all possible `HRESULTS` and Win32 errors) analog to [ExitStatusExt::from_raw](https://doc.rust-lang.org/std/os/windows/process/trait.ExitStatusExt.html#tymethod.from_raw).

This was also intended by the original Stabilization https://github.com/rust-lang/rust/pull/93840#issue-1129209143=  as pointed out by ``@eggyal`` in https://github.com/rust-lang/rust/issues/97914#issuecomment-1151076755:

> Issues around platform specific representations: We resolved this issue by changing the return type of report from i32 to the opaque type ExitCode. __That way we can change the underlying representation without affecting the API, letting us offer full support for platform specific exit code APIs in the future.__

[Emphasis added]

### API

```rust
/// Windows-specific extensions to [`process::ExitCode`].
///
/// This trait is sealed: it cannot be implemented outside the standard library.
/// This is so that future additional methods are not breaking changes.
#[stable(feature = "windows_process_exit_code_from", since = "1.63.0")]
pub trait ExitCodeExt: Sealed {
    /// Creates a new `ExitCode` from the raw underlying `u32` return value of
    /// a process.
    #[stable(feature = "windows_process_exit_code_from", since = "1.63.0")]
    fn from_raw(raw: u32) -> Self;
}

#[stable(feature = "windows_process_exit_code_from", since = "1.63.0")]
impl ExitCodeExt for process::ExitCode {
    fn from_raw(raw: u32) -> Self {
        process::ExitCode::from_inner(From::from(raw))
    }
}
```

### Misc

I apologize in advance if I misplaced any attributes regarding stabilzation, as far as I learned traits are insta-stable so I chose to make them stable. If this is an error, please let me know and I'll correct it. I also added some additional machinery to make it work, analog to [ExitStatus](https://doc.rust-lang.org/std/process/struct.ExitStatus.html#).

EDIT: Proposal: https://github.com/rust-lang/libs-team/issues/48

23 months agoAuto merge of #95573 - cjgillot:lower-query, r=michaelwoerister
bors [Thu, 7 Jul 2022 18:14:44 +0000 (18:14 +0000)]
Auto merge of #95573 - cjgillot:lower-query, r=michaelwoerister

Make lowering a query

Split from https://github.com/rust-lang/rust/pull/88186.

This PR refactors the relationship between lowering and the resolver outputs in order to make lowering itself a query.
In a first part, lowering is changed to avoid modifying resolver outputs, by maintaining its own data structures for creating new `NodeId`s and so.

Then, the `TyCtxt` is modified to allow creating new `LocalDefId`s from inside it. This is done by:
- enclosing `Definitions` in a lock, so as to allow modification;
- creating a query `register_def` whose purpose is to declare a `LocalDefId` to the query system.

See `TyCtxt::create_def` and `TyCtxt::iter_local_def_id` for more detailed explanations of the design.

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 agoReplace boolean argument for print_where_clause with an enum to make code more clear
Guillaume Gomez [Thu, 7 Jul 2022 14:16:35 +0000 (16:16 +0200)]
Replace boolean argument for print_where_clause with an enum to make code more clear

23 months agoReword comments and rename HIR visiting methods.
Camille GILLOT [Sun, 3 Jul 2022 13:28:57 +0000 (15:28 +0200)]
Reword comments and rename HIR visiting methods.

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 agoadd a test for #70408
Takayuki Maeda [Thu, 7 Jul 2022 06:42:48 +0000 (15:42 +0900)]
add a test for #70408

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 agosuggest adding a derive for #[default] applied to variants
Deadbeef [Thu, 7 Jul 2022 04:57:01 +0000 (04:57 +0000)]
suggest adding a derive for #[default] applied to variants

23 months agosquash the commits
toshiki goto [Wed, 6 Jul 2022 06:05:44 +0000 (15:05 +0900)]
squash the commits

implement detail_exit but I'm not sure it is right.

not create new file and write detail exit in lib.rs

replace std::process::exit to detail_exit

that is not related to code runnning.

remove pub

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 agoadd a test for #80471
Takayuki Maeda [Thu, 7 Jul 2022 02:33:56 +0000 (11:33 +0900)]
add a test for #80471

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 agoUse DefIdTree instead of re-implementing it.
Camille GILLOT [Thu, 2 Jun 2022 18:08:38 +0000 (20:08 +0200)]
Use DefIdTree instead of re-implementing it.

23 months agoRemove dead code.
Camille GILLOT [Tue, 3 May 2022 20:14:44 +0000 (22:14 +0200)]
Remove dead code.

23 months agoReword create_def comment.
Camille GILLOT [Tue, 3 May 2022 20:14:07 +0000 (22:14 +0200)]
Reword create_def comment.

23 months agoUse a dedicated DepKind for the forever-red node.
Camille GILLOT [Tue, 3 May 2022 20:04:49 +0000 (22:04 +0200)]
Use a dedicated DepKind for the forever-red node.

23 months agoComment untracked_crate.
Camille GILLOT [Tue, 3 May 2022 20:01:01 +0000 (22:01 +0200)]
Comment untracked_crate.

23 months agoRemove `sess` field from LoweringContext.
Camille GILLOT [Mon, 2 May 2022 18:32:17 +0000 (20:32 +0200)]
Remove `sess` field from LoweringContext.

23 months agoExpand comment in `with_hir_id_owner`.
Camille GILLOT [Mon, 2 May 2022 18:32:10 +0000 (20:32 +0200)]
Expand comment in `with_hir_id_owner`.

23 months agoCreate a forever red node and use it to force side effects.
Camille GILLOT [Wed, 27 Apr 2022 17:18:26 +0000 (19:18 +0200)]
Create a forever red node and use it to force side effects.

23 months agoDo not create a new NodeId when not used.
Camille GILLOT [Sat, 2 Apr 2022 14:13:20 +0000 (16:13 +0200)]
Do not create a new NodeId when not used.

23 months agoRemove useless branch.
Camille GILLOT [Sat, 2 Apr 2022 14:13:01 +0000 (16:13 +0200)]
Remove useless branch.

23 months agoMake AST lowering a query.
Camille GILLOT [Tue, 13 Jul 2021 16:45:20 +0000 (18:45 +0200)]
Make AST lowering a query.

23 months agoAllow to create definitions inside the query system.
Camille GILLOT [Mon, 12 Jul 2021 20:19:25 +0000 (22:19 +0200)]
Allow to create definitions inside the query system.

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 missing word in comment
pierwill [Wed, 6 Jul 2022 18:26:26 +0000 (13:26 -0500)]
Fix missing word in comment

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 agointerpret: use AllocRange in UninitByteAccess
Ralf Jung [Wed, 6 Jul 2022 14:52:20 +0000 (10:52 -0400)]
interpret: use AllocRange in UninitByteAccess

also use nice new format string syntax in interpret/error.rs

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