]> git.lizzy.rs Git - rust.git/log
rust.git
23 months agoRollup merge of #99374 - TethysSvensson:patch-1, r=Dylan-DPC
Yuki Okushi [Sun, 17 Jul 2022 23:40:02 +0000 (08:40 +0900)]
Rollup merge of #99374 - TethysSvensson:patch-1, r=Dylan-DPC

Fix doc for `rchunks_exact`

`rchunks_exact` is not a more optimized version of `chunks`, but of `rchunks`.

23 months agoRollup merge of #99373 - GuillaumeGomez:source-code-sidebar-tree-auto-expand, r=notriddle
Yuki Okushi [Sun, 17 Jul 2022 23:40:01 +0000 (08:40 +0900)]
Rollup merge of #99373 - GuillaumeGomez:source-code-sidebar-tree-auto-expand, r=notriddle

Fix source code sidebar tree auto-expand

Here is the bug:

![Screenshot from 2022-07-17 13-32-00](https://user-images.githubusercontent.com/3050060/179397712-bfb1c279-0ed2-4cb5-aef5-05741921bcc3.png)

It was happening because as soon as we found the file (from the URL), every item following it was then opened, even if it wasn't supposed to.

The GUI test ensures that it doesn't happen by adding two nested levels and ensuring only this path is "open".

r? ``@notriddle``

23 months agoRollup merge of #99360 - compiler-errors:issue-99331, r=fee1-dead
Yuki Okushi [Sun, 17 Jul 2022 23:40:00 +0000 (08:40 +0900)]
Rollup merge of #99360 - compiler-errors:issue-99331, r=fee1-dead

Do not ICE when we have `-Zunpretty=expanded` with invalid ABI

Fixes #99331

23 months agoRollup merge of #99356 - compiler-errors:tait-in-assoc-ty-supertraits, r=oli-obk
Yuki Okushi [Sun, 17 Jul 2022 23:39:59 +0000 (08:39 +0900)]
Rollup merge of #99356 - compiler-errors:tait-in-assoc-ty-supertraits, r=oli-obk

Do not constraint TAITs when checking impl/trait item compatibility

Check out the UI test for the example.

Open to other approaches to fix this issue -- ideally we _would_ be able to collect this opaque type constraint in a way to use it in `find_opaque_ty_constraints`, so we can report a better mismatch error in the incompatible case, and just allow it in the compatible case. But that seems like a bigger refactor, so I wouldn't want to start it unless someone else thought it was a good idea.

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

23 months agoRollup merge of #99350 - compiler-errors:issue-99240, r=fee1-dead
Yuki Okushi [Sun, 17 Jul 2022 23:39:58 +0000 (08:39 +0900)]
Rollup merge of #99350 - compiler-errors:issue-99240, r=fee1-dead

Be more precise when suggesting removal of parens on unit ctor

* Fixes #99240 by only suggesting to remove parens on path exprs, not arbitrary expressions with enum type
* Generalizes by suggesting removal of parens on unit struct, too, because why not?

23 months agoRollup merge of #98383 - m-ou-se:remove-memory-order-restrictions, r=joshtriplett
Yuki Okushi [Sun, 17 Jul 2022 23:39:57 +0000 (08:39 +0900)]
Rollup merge of #98383 - m-ou-se:remove-memory-order-restrictions, r=joshtriplett

Remove restrictions on compare-exchange memory ordering.

We currently don't allow the failure memory ordering of compare-exchange operations to be stronger than the success ordering, as was the case in C++11 when its memory model was copied to Rust. However, this restriction was lifted in C++17 as part of [p0418r2](https://wg21.link/p0418r2). It's time  we lift the restriction too.

| Success | Failure | Before | After |
|---------|---------|--------|-------|
| Relaxed | Relaxed | :heavy_check_mark: | :heavy_check_mark: |
| Relaxed | Acquire | :x:                | :heavy_check_mark: |
| Relaxed | SeqCst  | :x:                | :heavy_check_mark: |
| Acquire | Relaxed | :heavy_check_mark: | :heavy_check_mark: |
| Acquire | Acquire | :heavy_check_mark: | :heavy_check_mark: |
| Acquire | SeqCst  | :x:                | :heavy_check_mark: |
| Release | Relaxed | :heavy_check_mark: | :heavy_check_mark: |
| Release | Acquire | :x:                | :heavy_check_mark: |
| Release | SeqCst  | :x:                | :heavy_check_mark: |
| AcqRel  | Relaxed | :heavy_check_mark: | :heavy_check_mark: |
| AcqRel  | Acquire | :heavy_check_mark: | :heavy_check_mark: |
| AcqRel  | SeqCst  | :x:                | :heavy_check_mark: |
| SeqCst  | Relaxed | :heavy_check_mark: | :heavy_check_mark: |
| SeqCst  | Acquire | :heavy_check_mark: | :heavy_check_mark: |
| SeqCst  | SeqCst  | :heavy_check_mark: | :heavy_check_mark: |
| \*      | Release | :x:                | :x:                |
| \*      | AcqRel  | :x:                | :x:                |

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

23 months agoAuto merge of #99033 - 5225225:interpreter-validity-checks, r=oli-obk
bors [Sun, 17 Jul 2022 19:28:01 +0000 (19:28 +0000)]
Auto merge of #99033 - 5225225:interpreter-validity-checks, r=oli-obk

Use constant eval to do strict mem::uninit/zeroed validity checks

I'm not sure about the code organisation here, I just dumped the check in rustc_const_eval at the root. Not hard to move it elsewhere, in any case.

Also, this means cranelift codegen intrinsics lose the strict checks, since they don't seem to depend on rustc_const_eval, and I didn't see a point in keeping around two copies.

I also left comments in the is_zero_valid methods about "uhhh help how do i do this", those apply to both methods equally.

Also rustc_codegen_ssa now depends on rustc_const_eval... is this okay?

Pinging `@RalfJung` since you were the one who mentioned this to me, so I'm assuming you're interested.

Haven't had a chance to run full tests on this since it's really warm, and it's 1AM, I'll check out any failures/comments in the morning :)

23 months agoAdd GUI test for source code sidebar auto-expand
Guillaume Gomez [Sun, 17 Jul 2022 12:12:03 +0000 (14:12 +0200)]
Add GUI test for source code sidebar auto-expand

23 months agoAuto merge of #99283 - RalfJung:miri, r=RalfJung
bors [Sun, 17 Jul 2022 13:08:06 +0000 (13:08 +0000)]
Auto merge of #99283 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/99224
r? `@ghost`

23 months agomake tidy accept another permutation of this license string
Ralf Jung [Fri, 15 Jul 2022 15:57:04 +0000 (11:57 -0400)]
make tidy accept another permutation of this license string

23 months agoupdate Miri
Ralf Jung [Fri, 15 Jul 2022 14:04:23 +0000 (10:04 -0400)]
update Miri

23 months agoFix for `rchunks_exact` doc
Tethys Svensson [Sun, 17 Jul 2022 12:18:36 +0000 (14:18 +0200)]
Fix for `rchunks_exact` doc

`rchunks_exact` is not a more optimized version of `chunks`, but of `rchunks`.

23 months agoFix auto-expand of trees in source code page sidebar
Guillaume Gomez [Sun, 17 Jul 2022 12:11:45 +0000 (14:11 +0200)]
Fix auto-expand of trees in source code page sidebar

23 months agoAuto merge of #99040 - gimbles:ci-std-tests, r=pietroalbini
bors [Sun, 17 Jul 2022 10:40:56 +0000 (10:40 +0000)]
Auto merge of #99040 - gimbles:ci-std-tests, r=pietroalbini

Run stage 0 std tests in CI

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

23 months agouse rustc_hir_pretty::qpath_to_string to avoid span_to_snippet when rendering path
Michael Goulet [Sun, 17 Jul 2022 04:03:30 +0000 (21:03 -0700)]
use rustc_hir_pretty::qpath_to_string to avoid span_to_snippet when rendering path

23 months agoAuto merge of #99362 - JohnTitor:rollup-4d5zo9d, r=JohnTitor
bors [Sun, 17 Jul 2022 04:11:33 +0000 (04:11 +0000)]
Auto merge of #99362 - JohnTitor:rollup-4d5zo9d, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #94927 (Stabilize `let_chains` in Rust 1.64)
 - #97915 (Implement `fmt::Write` for `OsString`)
 - #99036 (Add `#[test]` to functions in test modules)
 - #99088 (Document and stabilize process_set_process_group)
 - #99302 (add tracking issue to generic member access APIs)
 - #99306 (Stabilize `future_poll_fn`)
 - #99354 (Add regression test for #95829)

Failed merges:

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

23 months agoRollup merge of #99354 - JohnTitor:issue-95829, r=compiler-errors
Yuki Okushi [Sun, 17 Jul 2022 04:08:53 +0000 (13:08 +0900)]
Rollup merge of #99354 - JohnTitor:issue-95829, r=compiler-errors

Add regression test for #95829

Closes #95829
r? `@compiler-errors`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agoRollup merge of #99306 - JohnTitor:stabilize-future-poll-fn, r=joshtriplett
Yuki Okushi [Sun, 17 Jul 2022 04:08:52 +0000 (13:08 +0900)]
Rollup merge of #99306 - JohnTitor:stabilize-future-poll-fn, r=joshtriplett

Stabilize `future_poll_fn`

FCP is done: https://github.com/rust-lang/rust/issues/72302#issuecomment-1179620512
Closes #72302

r? `@joshtriplett` as you started FCP

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agoRollup merge of #99302 - yaahc:gma-tracking-issue, r=joshtriplett
Yuki Okushi [Sun, 17 Jul 2022 04:08:51 +0000 (13:08 +0900)]
Rollup merge of #99302 - yaahc:gma-tracking-issue, r=joshtriplett

add tracking issue to generic member access APIs

Missed as part of https://github.com/rust-lang/rust/pull/98072

23 months agoRollup merge of #99088 - niklasf:stabilize-process_set_process_group, r=joshtriplett
Yuki Okushi [Sun, 17 Jul 2022 04:08:50 +0000 (13:08 +0900)]
Rollup merge of #99088 - niklasf:stabilize-process_set_process_group, r=joshtriplett

Document and stabilize process_set_process_group

Tracking issue: https://github.com/rust-lang/rust/issues/93857

FCP finished here: https://github.com/rust-lang/rust/issues/93857#issuecomment-1179551697

23 months agoRollup merge of #99036 - TaKO8Ki:fix-test-for-88138, r=compiler-errors
Yuki Okushi [Sun, 17 Jul 2022 04:08:49 +0000 (13:08 +0900)]
Rollup merge of #99036 - TaKO8Ki:fix-test-for-88138, r=compiler-errors

Add `#[test]` to functions in test modules

I implemented a suggestion in #91770, but the ui test I created was inadequate and I have fixed that.

23 months agoRollup merge of #97915 - tbu-:pr_os_string_fmt_write, r=joshtriplett
Yuki Okushi [Sun, 17 Jul 2022 04:08:48 +0000 (13:08 +0900)]
Rollup merge of #97915 - tbu-:pr_os_string_fmt_write, r=joshtriplett

Implement `fmt::Write` for `OsString`

This allows to format into an `OsString` without unnecessary
allocations. E.g.

```
let mut temp_filename = path.into_os_string();
write!(&mut temp_filename, ".tmp.{}", process::id());
```

23 months agoRollup merge of #94927 - c410-f3r:stabilize-let-chains, r=joshtriplett
Yuki Okushi [Sun, 17 Jul 2022 04:08:47 +0000 (13:08 +0900)]
Rollup merge of #94927 - c410-f3r:stabilize-let-chains, r=joshtriplett

Stabilize `let_chains` in Rust 1.64

# Stabilization proposal

This PR proposes the stabilization of `#![feature(let_chains)]` in a future-compatibility way that will allow the **possible** addition of the `EXPR is PAT` syntax.

Tracking issue: #53667
Version: 1.64 (beta => 2022-08-11, stable => 2022-10-22).

## What is stabilized

The ability to chain let expressions along side local variable declarations or ordinary conditional expressions. For example:

```rust
pub enum Color {
    Blue,
    Red,
    Violet,
}

pub enum Flower {
    Rose,
    Tulip,
    Violet,
}

pub fn roses_are_red_violets_are_blue_printer(
    (first_flower, first_flower_color): (Flower, Color),
    (second_flower, second_flower_color): (Flower, Color),
    pick_up_lines: &[&str],
) {
    if let Flower::Rose = first_flower
        && let Color::Red = first_flower_color
        && let Flower::Violet = second_flower
        && let Color::Blue = second_flower_color
        && let &[first_pick_up_line, ..] = pick_up_lines
    {
        println!("Roses are red, violets are blue, {}", first_pick_up_line);
    }
}

fn main() {
    roses_are_red_violets_are_blue_printer(
        (Flower::Rose, Color::Red),
        (Flower::Violet, Color::Blue),
        &["sugar is sweet and so are you"],
    );
}
```

## Motivation

The main motivation for this feature is improving readability, ergonomics and reducing paper cuts.

For more examples, see the [RFC](https://github.com/rust-lang/rfcs/blob/master/text/2497-if-let-chains.md).

## What isn't stabilized

* Let chains in match guards (`if_let_guard`)

* Resolution of divergent non-terminal matchers

* The `EXPR is PAT` syntax

## History

* On 2017-12-24, [RFC: if- and while-let-chains](https://github.com/rust-lang/rfcs/pull/2260)
* On 2018-07-12, [eRFC: if- and while-let-chains, take 2](https://github.com/rust-lang/rfcs/pull/2497)
* On 2018-08-24, [Tracking issue for eRFC 2497, "if- and while-let-chains, take 2](https://github.com/rust-lang/rust/issues/53667)
* On 2019-03-19, [Run branch cleanup after copy prop](https://github.com/rust-lang/rust/pull/59290)
* On 2019-03-26, [Generalize diagnostic for x = y where bool is the expected type](https://github.com/rust-lang/rust/pull/59439)
* On 2019-04-24, [Introduce hir::ExprKind::Use and employ in for loop desugaring](https://github.com/rust-lang/rust/pull/60225)
* On 2019-03-19, [[let_chains, 1/6] Remove hir::ExprKind::If](https://github.com/rust-lang/rust/pull/59288)
* On 2019-05-15, [[let_chains, 2/6] Introduce Let(..) in AST, remove IfLet + WhileLet and parse let chains](https://github.com/rust-lang/rust/pull/60861)
* On 2019-06-20, [[let_chains, 3/6] And then there was only Loop](https://github.com/rust-lang/rust/pull/61988)
* On 2020-11-22, [Reintroduce hir::ExprKind::If](https://github.com/rust-lang/rust/pull/79328)
* On 2020-12-24, [Introduce hir::ExprKind::Let - Take 2](https://github.com/rust-lang/rust/pull/80357)
* On 2021-02-19, [Lower condition of if expression before it's "then" block](https://github.com/rust-lang/rust/pull/82308)
* On 2021-09-01, [Fix drop handling for `if let` expressions](https://github.com/rust-lang/rust/pull/88572)
* On 2021-09-04, [Formally implement let chains](https://github.com/rust-lang/rust/pull/88642)
* On 2022-01-19, [Add tests to ensure that let_chains works with if_let_guard](https://github.com/rust-lang/rust/pull/93086)
* On 2022-01-18, [Introduce `enhanced_binary_op` feature](https://github.com/rust-lang/rust/pull/93049)
* On 2022-01-22, [Fix `let_chains` and `if_let_guard` feature flags](https://github.com/rust-lang/rust/pull/93213)
* On 2022-02-25, [Initiate the inner usage of `let_chains`](https://github.com/rust-lang/rust/pull/94376)
* On 2022-01-28, [[WIP] Introduce ast::StmtKind::LetElse to allow the usage of `let_else` with `let_chains`](https://github.com/rust-lang/rust/pull/93437)
* On 2022-02-26, [1 - Make more use of `let_chains`](https://github.com/rust-lang/rust/pull/94396)
* On 2022-02-26, [2 - Make more use of `let_chains`](https://github.com/rust-lang/rust/pull/94400)
* On 2022-02-27, [3 - Make more use of `let_chains`](https://github.com/rust-lang/rust/pull/94420)
* On 2022-02-28, [4 - Make more use of `let_chains`](https://github.com/rust-lang/rust/pull/94445)
* On 2022-02-28, [5 - Make more use of `let_chains`](https://github.com/rust-lang/rust/pull/94448)
* On 2022-02-28, [6 - Make more use of `let_chains`](https://github.com/rust-lang/rust/pull/94465)
* On 2022-03-01, [7 - Make more use of `let_chains`](https://github.com/rust-lang/rust/pull/94476)
* On 2022-03-01, [8 - Make more use of `let_chains`](https://github.com/rust-lang/rust/pull/94484)
* On 2022-03-01, [9 - Make more use of `let_chains`](https://github.com/rust-lang/rust/pull/94498)
* On 2022-03-08, [Warn users about `||` in let chain expressions](https://github.com/rust-lang/rust/pull/94754)

From the first RFC (2017-12-24) to the theoretical future stabilization day (2022-10-22), it can be said that this feature took 4 years, 9 months and 28 days of research, development, discussions, agreements and headaches to be settled.

## Divergent non-terminal matchers

More specifically, https://github.com/rust-lang/rust/issues/86730.

```rust
macro_rules! mac {
    ($e:expr) => {
        if $e {
            true
        } else {
            false
        }
    };
}

fn main() {
    // OK!
    assert_eq!(mac!(true && let 1 = 1), true);

    // ERROR! Anything starting with `let` is not considered an expression
    assert_eq!(mac!(let 1 = 1 && true), true);
}
```

To the best of my knowledge, such error or divergence is orthogonal, does not prevent stabilization and can be tackled independently in the near future or effectively in the next Rust 2024 edition. If not, then https://github.com/c410-f3r/rust/tree/let-macro-blah contains a set of changes that will consider `let` an expression.

It is possible that none of the solutions above satisfies all applicable constraints but I personally don't know of any other plausible answers.

## Alternative syntax

Taking into account the usefulness of this feature and the overwhelming desire to use both now and in the past, `let PAT = EXPR` will be utilized for stabilization but it doesn't or shall create any obstacle for a **possible** future addition of `EXPR is PAT`.

The introductory snippet would then be written as the following.

```rust
if first_flower is Flower::Rose
    && first_flower_color is Color::Red
    && second_flower is Flower::Violet
    && second_flower_color is Color::Blue
    && pick_up_lines is &[first_pick_up_line, ..]
{
    println!("Roses are red, violets are blue, {}", first_pick_up_line);
}
```

Just to reinforce, this PR only unblocks a **possible** future road for `EXPR is PAT` and does emphasize what is better or what is worse.

## Tests

* [Verifies the drop order of let chains and ensures it won't change in the future in an unpredictable way](https://github.com/rust-lang/rust/blob/master/src/test/ui/mir/mir_let_chains_drop_order.rs)

* [AST lowering does not wrap let chains in an `DropTemps` expression](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2497-if-let-chains/ast-lowering-does-not-wrap-let-chains.rs)

* [Checks pretty printing output](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2497-if-let-chains/ast-pretty-check.rs)

* [Verifies uninitialized variables due to MIR modifications](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2497-if-let-chains/chains-without-let.rs)

* [A collection of statements where `let` expressions are forbidden](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.rs)

* [All or at least most of the places where let chains are allowed](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2497-if-let-chains/feature-gate.rs)

* [Ensures that irrefutable lets are allowed in let chains](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2497-if-let-chains/irrefutable-lets.rs)

* [issue-88498.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2497-if-let-chains/issue-88498.rs), [issue-90722.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2497-if-let-chains/issue-90722.rs), [issue-92145.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2497-if-let-chains/issue-92145.rs) and [issue-93150.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2497-if-let-chains/issue-93150.rs) were bugs found by third parties and fixed overtime.

* [Indexing was triggering a ICE due to a wrongly constructed MIR graph](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2497-if-let-chains/no-double-assigments.rs)

* [Protects the precedence of `&&` in relation to other things](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2497-if-let-chains/protect-precedences.rs)

* [`let_chains`, as well as `if_let_guard`, has a valid MIR graph that evaluates conditional expressions correctly](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2497-if-let-chains/then-else-blocks.rs)

Most of the infra-structure used by let chains is also used by `if` expressions in stable compiler versions since https://github.com/rust-lang/rust/pull/80357 and https://github.com/rust-lang/rust/pull/88572. As a result, no bugs were found since the integration of https://github.com/rust-lang/rust/pull/88642.

## Possible future work

* Let chains in match guards is implemented and working but stabilization is blocked by `if_let_guard`.

* The usage of `let_chains` with `let_else` is possible but not implemented. Regardless, one attempt was introduced and closed in https://github.com/rust-lang/rust/pull/93437.

Thanks `@Centril` for creating the RFC and huge thanks (again) to `@matthewjasper` for all the reviews, mentoring and MIR implementations.

Fixes #53667

23 months agoDo not ICE when we have -Zunpretty=expand with invalid ABI
Michael Goulet [Sun, 17 Jul 2022 03:35:54 +0000 (20:35 -0700)]
Do not ICE when we have -Zunpretty=expand with invalid ABI

23 months agoDo not constraint TAITs when checking impl/trait item compatibility
Michael Goulet [Sun, 17 Jul 2022 01:35:56 +0000 (18:35 -0700)]
Do not constraint TAITs when checking impl/trait item compatibility

23 months agoAdd regression test for #95829
Yuki Okushi [Sat, 16 Jul 2022 23:50:41 +0000 (08:50 +0900)]
Add regression test for #95829

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agoAuto merge of #98866 - nagisa:nagisa/align-offset-wroom, r=Mark-Simulacrum
bors [Sat, 16 Jul 2022 23:28:28 +0000 (23:28 +0000)]
Auto merge of #98866 - nagisa:nagisa/align-offset-wroom, r=Mark-Simulacrum

Add a special case for align_offset /w stride != 1

This generalizes the previous `stride == 1` special case to apply to any
situation where the requested alignment is divisible by the stride. This
in turn allows the test case from #98809 produce ideal assembly, along
the lines of:

    leaq 15(%rdi), %rax
    andq $-16, %rax

This also produces pretty high quality code for situations where the
alignment of the input pointer isn’t known:

    pub unsafe fn ptr_u32(slice: *const u32) -> *const u32 {
        slice.offset(slice.align_offset(16) as isize)
    }

    // =>

    movl %edi, %eax
    andl $3, %eax
    leaq 15(%rdi), %rcx
    andq $-16, %rcx
    subq %rdi, %rcx
    shrq $2, %rcx
    negq %rax
    sbbq %rax, %rax
    orq  %rcx, %rax
    leaq (%rdi,%rax,4), %rax

Here LLVM is smart enough to replace the `usize::MAX` special case with
a branch-less bitwise-OR approach, where the mask is constructed using
the neg and sbb instructions. This appears to work across various
architectures I’ve tried.

This change ends up introducing more branches and code in situations
where there is less knowledge of the arguments. For example when the
requested alignment is entirely unknown. This use-case was never really
a focus of this function, so I’m not particularly worried, especially
since llvm-mca is saying that the new code is still appreciably faster,
despite all the new branching.

Fixes #98809.
Sadly, this does not help with #72356.

23 months agoStabilize `let_chains`
Caio [Tue, 12 Jul 2022 18:36:59 +0000 (15:36 -0300)]
Stabilize `let_chains`

23 months agoAdd a special case for align_offset /w stride != 1
Simonas Kazlauskas [Sun, 3 Jul 2022 21:23:31 +0000 (00:23 +0300)]
Add a special case for align_offset /w stride != 1

This generalizes the previous `stride == 1` special case to apply to any
situation where the requested alignment is divisible by the stride. This
in turn allows the test case from #98809 produce ideal assembly, along
the lines of:

    leaq 15(%rdi), %rax
    andq $-16, %rax

This also produces pretty high quality code for situations where the
alignment of the input pointer isn’t known:

    pub unsafe fn ptr_u32(slice: *const u32) -> *const u32 {
        slice.offset(slice.align_offset(16) as isize)
    }

    // =>

    movl %edi, %eax
    andl $3, %eax
    leaq 15(%rdi), %rcx
    andq $-16, %rcx
    subq %rdi, %rcx
    shrq $2, %rcx
    negq %rax
    sbbq %rax, %rax
    orq  %rcx, %rax
    leaq (%rdi,%rax,4), %rax

Here LLVM is smart enough to replace the `usize::MAX` special case with
a branch-less bitwise-OR approach, where the mask is constructed using
the neg and sbb instructions. This appears to work across various
architectures I’ve tried.

This change ends up introducing more branches and code in situations
where there is less knowledge of the arguments. For example when the
requested alignment is entirely unknown. This use-case was never really
a focus of this function, so I’m not particularly worried, especially
since llvm-mca is saying that the new code is still appreciably faster,
despite all the new branching.

Fixes #98809.
Sadly, this does not help with #72356.

23 months agoBe more precise when suggesting removal of parens on unit adt ctor
Michael Goulet [Sat, 16 Jul 2022 22:15:41 +0000 (22:15 +0000)]
Be more precise when suggesting removal of parens on unit adt ctor

23 months agoExpand documentation for `process_group`
Josh Triplett [Sat, 16 Jul 2022 21:45:16 +0000 (14:45 -0700)]
Expand documentation for `process_group`

Explain PGID 0, and provide the acronym PGID.

23 months agoUpdate `since` version to 1.64
Josh Triplett [Sat, 16 Jul 2022 21:36:48 +0000 (14:36 -0700)]
Update `since` version to 1.64

23 months agoAuto merge of #99346 - matthiaskrgr:rollup-p4dl1qt, r=matthiaskrgr
bors [Sat, 16 Jul 2022 20:31:42 +0000 (20:31 +0000)]
Auto merge of #99346 - matthiaskrgr:rollup-p4dl1qt, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #98582 (Allow destructuring opaque types in their defining scopes)
 - #99213 (migrate some of `rustc_passes::check_attr`'s diagnostics and derive improvements)
 - #99258 (Provide structured suggestion for dropped temp value)
 - #99259 (interpret/visitor: support visiting with a PlaceTy)
 - #99287 ([rustdoc-json] JSON no longer inlines)
 - #99290 (Revert "Highlight conflicting param-env candidates")
 - #99316 (docs: add missing word)
 - #99317 (Borrow Vec<T, A> as [T])
 - #99323 (Fix flakyness of GUI tests)
 - #99342 (Avoid some `Symbol` to `String` conversions)

Failed merges:

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

23 months agoRollup merge of #99342 - TaKO8Ki:avoid-symbol-to-string-conversions, r=compiler-errors
Matthias Krüger [Sat, 16 Jul 2022 20:30:56 +0000 (22:30 +0200)]
Rollup merge of #99342 - TaKO8Ki:avoid-symbol-to-string-conversions, r=compiler-errors

Avoid some `Symbol` to `String` conversions

This patch removes some Symbol to String conversions.

23 months agoRollup merge of #99323 - GuillaumeGomez:fix-gui-flaky, r=Dylan-DPC
Matthias Krüger [Sat, 16 Jul 2022 20:30:55 +0000 (22:30 +0200)]
Rollup merge of #99323 - GuillaumeGomez:fix-gui-flaky, r=Dylan-DPC

Fix flakyness of GUI tests

Fixes #98163.

All flaky tests seemed to be linked to the search. Since the search JS is loaded when we focus the search input, I think it's possible that we enter faster than the JS is actually loaded. The solution for that would be to do it in two steps: first we write into the search input (`browser-ui-test` adds a small sleep time after such commands) and then we press enter to be sure that it wasn't missed.

cc `@JohnTitor`
r? `@Dylan-DPC`

23 months agoRollup merge of #99317 - yanchith:borrow-vec-ta-as-slice-t, r=Mark-Simulacrum
Matthias Krüger [Sat, 16 Jul 2022 20:30:54 +0000 (22:30 +0200)]
Rollup merge of #99317 - yanchith:borrow-vec-ta-as-slice-t, r=Mark-Simulacrum

Borrow Vec<T, A> as [T]

Hello all,

When `Vec` was parametrized with `A`, the `Borrow` impls were omitted and currently `Vec<T, A>` can't be borrowed as `[T]`. This PR fixes that.

This was probably missed, because the `Borrow` impls are in a different file - `src/alloc/slice.rs`.

We briefly discussed this here: https://github.com/rust-lang/wg-allocators/issues/96 and I was told to go ahead and make a PR :)

I tested this by building the toolchain and building my code that needed the `Borrow` impl against it, but let me know if I should add any tests to this PR.

23 months agoRollup merge of #99316 - tshepang:clearer, r=compiler-errors
Matthias Krüger [Sat, 16 Jul 2022 20:30:53 +0000 (22:30 +0200)]
Rollup merge of #99316 - tshepang:clearer, r=compiler-errors

docs: add missing word

23 months agoRollup merge of #99290 - compiler-errors:revert-98794, r=lcnr
Matthias Krüger [Sat, 16 Jul 2022 20:30:52 +0000 (22:30 +0200)]
Rollup merge of #99290 - compiler-errors:revert-98794, r=lcnr

Revert "Highlight conflicting param-env candidates"

This reverts #98794, commit 08135254dcf22be0d5661ea8f75e703b29a83514.

Seems to have caused an incremental compilation bug. The root cause of the incr comp bug is somewhat unrelated but is triggered by this PR, so I don't feel comfortable with having this PR in the codebase until it can be investigated further. Fixes #99233.

23 months agoRollup merge of #99287 - GuillaumeGomez:rustdoc-json-double-export, r=notriddle
Matthias Krüger [Sat, 16 Jul 2022 20:30:51 +0000 (22:30 +0200)]
Rollup merge of #99287 - GuillaumeGomez:rustdoc-json-double-export, r=notriddle

[rustdoc-json] JSON no longer inlines

Fixes #98007.
Fixes #96161.
Fixes https://github.com/rust-lang/rust/issues/83057.
Fixes https://github.com/rust-lang/rust/issues/83720.

I took over #93518 and applied the comments and added more tests.

There was one thing missing (which is in the second commit): if a non-exported item was used in a public API but not reexported, it was still missing.

cc `@CraftSpider` `@Urgau` `@Enselic`

r? `@notriddle`

23 months agoRollup merge of #99259 - RalfJung:visit-a-place, r=oli-obk
Matthias Krüger [Sat, 16 Jul 2022 20:30:51 +0000 (22:30 +0200)]
Rollup merge of #99259 - RalfJung:visit-a-place, r=oli-obk

interpret/visitor: support visiting with a PlaceTy

Finally we can visit a `PlaceTy` in a way that will only do `force_allocation` when needed ti visit a field. :)

r? `@oli-obk`

23 months agoRollup merge of #99258 - estebank:suggest-let, r=wesleywiser
Matthias Krüger [Sat, 16 Jul 2022 20:30:49 +0000 (22:30 +0200)]
Rollup merge of #99258 - estebank:suggest-let, r=wesleywiser

Provide structured suggestion for dropped temp value

23 months agoRollup merge of #99213 - davidtwco:translation-migrate-passes, r=compiler-errors
Matthias Krüger [Sat, 16 Jul 2022 20:30:48 +0000 (22:30 +0200)]
Rollup merge of #99213 - davidtwco:translation-migrate-passes, r=compiler-errors

migrate some of `rustc_passes::check_attr`'s diagnostics and derive improvements

- Implements `IntoDiagnosticArg` for `char` using its `Debug` implementation and introduces a macro for those types which just delegate the implementation to `ToString`.
- Apply the `#[rustc_lint_diagnostics]` attribute to `LintDiagnosticBuilder::build` so that diagnostic migration lints will trigger for it - some diagnostics in `rustc_privacy` need updated after this since the lints apply to that crate.
- Add support for `MultiSpan` with any of the attributes that work on a `Span` in the diagnostic derive (`SessionDiagnostic` + `LintDiagnostic`). Requires that diagnostic logic generated for these attributes are emitted in the by-move block rather than the by-ref block that they would normally have been generated in.
- Both diagnostic and subdiagnostic derives were missing the ability to add warnings to diagnostics - this is made more difficult by the `warn` attribute already existing, so this name being unavailable for the derives to use. `#[warn_]` is used instead, which requires special-casing so that `{span_,}warn` is called instead of `{span_,}warn_`.
- Migrate half of the `rustc_passes::check_attr` diagnostics to using diagnostic derives and being translatable. I got tired after a while. I modified some diagnostic output for consistency while doing this, nothing too crazy.

r? `@compiler-errors`

23 months agoRollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank
Matthias Krüger [Sat, 16 Jul 2022 20:30:47 +0000 (22:30 +0200)]
Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank

Allow destructuring opaque types in their defining scopes

fixes #96572

Before this PR, the following code snippet failed with an incomprehensible error, and similar code just ICEd in mir borrowck.

```rust
    type T = impl Copy;
    let foo: T = (1u32, 2u32);
    let (a, b) = foo;
```

The problem was that the last line created MIR projections of the form `foo.0` and `foo.1`, but `foo`'s type is `T`, which doesn't have fields (only its hidden type does). But the pattern supplies enough type information (a tuple of two different inference types) to bind a hidden type.

23 months agoavoid some `Symbol` to `String` conversions
Takayuki Maeda [Sat, 16 Jul 2022 19:09:20 +0000 (04:09 +0900)]
avoid some `Symbol` to `String` conversions

23 months agoAuto merge of #99315 - JohnTitor:rollup-77wzoc1, r=JohnTitor
bors [Sat, 16 Jul 2022 16:30:25 +0000 (16:30 +0000)]
Auto merge of #99315 - JohnTitor:rollup-77wzoc1, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #98387 (Add new unstable API `downcast` to `std::io::Error`)
 - #98662 (Add std::fs::write documentation precision)
 - #99253 (Remove FIXME from MIR `always_storage_live_locals`)
 - #99264 (Fix typo in mod.rs)
 - #99270 (Add `#[must_use]` to `Box::from_raw`)
 - #99277 (Stabilize `core::ffi::CStr`, `alloc::ffi::CString`, and friends)
 - #99307 (Add regression test for #64401)

Failed merges:

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

23 months agoAuto merge of #99263 - compiler-errors:issue-99261, r=jyn514
bors [Sat, 16 Jul 2022 14:05:52 +0000 (14:05 +0000)]
Auto merge of #99263 - compiler-errors:issue-99261, r=jyn514

Fix ICE in `named_arguments_used_positionally` lint

Fixes #99261
Fixes #99289
Fixes #99284
Fixes #99273
Fixes #99297
Fixes #99271

This match pattern:

```
 FormatSpec { width: Count::CountIsName(s, _), .. }
| FormatSpec { precision: Count::CountIsName(s, _), .. }
```

does not account for when both `width` and `precision` are both `Count::CountIsName`, so split the check for these two fields into two separate `if let`.

Also, remove any future potential for ICEs by removing the index operator altogether.

---

It is still suspicious that this indexing was broken and caused the ICE, as opposed to just causing a spurious lint message.

cc `@PrestonFrom,` who may be familiar with this code because of implementing the lint this touches, perhaps you'd like to look into why named arguments in `FormatSpec.precision` seem to have indices that don't correspond to a span in `Context.arg_spans`?

Edit: Opened #99265 to track a (related?) incorrect argument indexing issue.

23 months agoFix flakyness of GUI tests
Guillaume Gomez [Sat, 16 Jul 2022 11:53:43 +0000 (13:53 +0200)]
Fix flakyness of GUI tests

23 months agoAdd tests for JSON non-inlining
Guillaume Gomez [Fri, 15 Jul 2022 15:48:46 +0000 (17:48 +0200)]
Add tests for JSON non-inlining

23 months agoCorrectly handle usage of private items in public API for JSON output format
Guillaume Gomez [Fri, 15 Jul 2022 16:10:52 +0000 (18:10 +0200)]
Correctly handle usage of private items in public API for JSON output format

23 months agoFix rustdoc JSON inline
Guillaume Gomez [Fri, 15 Jul 2022 15:37:07 +0000 (17:37 +0200)]
Fix rustdoc JSON inline

23 months agoAuto merge of #96482 - willcrichton:fix-trait-suggestion-for-binops, r=estebank
bors [Sat, 16 Jul 2022 11:36:19 +0000 (11:36 +0000)]
Auto merge of #96482 - willcrichton:fix-trait-suggestion-for-binops, r=estebank

Add Output = expected type trait obligation for known binary operators

This PR is a follow-on to #94034 that addresses #96442. That is, after replacing the trait-suggestion logic in `op.rs` with a more generic path that analyzes a general set of `Obligation`s, then we lost some specificity in the suggestions where the bounds on the associated type `Output=` would not get suggested.

This PR fixes this issue by changing `FnCtxt::construct_obligation_for_trait` to include a new `ProjectionPredicate` obligation for binary operators that obliges that `Output` is the same as the expected type of the expression. Additionally, to get the expected type of the expression, this PR threads the `Expectation<'tcx>` structure throughout several functions.

See src/test/ui/generic-associated-types/missing-bounds.stderr for an example of how this works.

One side effect of this change is it causes type-check failures with binops to include additional information. Specifically, many now say

```
error: type mismatch resolving `<Lhs as TheBinop>::Output == ExpectedTy`
```

It's up for discussion whether this added context is worth it to the user.

r? `@estebank`

23 months agodocs: add missing word
Tshepang Mbambo [Sat, 16 Jul 2022 10:11:43 +0000 (12:11 +0200)]
docs: add missing word

23 months agoBorrow Vec<T, A> as [T]
yanchith [Sat, 16 Jul 2022 09:58:26 +0000 (11:58 +0200)]
Borrow Vec<T, A> as [T]

23 months agoRollup merge of #99307 - JohnTitor:issue-64401, r=compiler-errors
Yuki Okushi [Sat, 16 Jul 2022 08:53:05 +0000 (17:53 +0900)]
Rollup merge of #99307 - JohnTitor:issue-64401, r=compiler-errors

Add regression test for #64401

Closes #64401
r? `@compiler-errors`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agoRollup merge of #99277 - joshtriplett:stabilize-core-cstr-alloc-cstring, r=Mark-Simul...
Yuki Okushi [Sat, 16 Jul 2022 08:53:04 +0000 (17:53 +0900)]
Rollup merge of #99277 - joshtriplett:stabilize-core-cstr-alloc-cstring, r=Mark-Simulacrum

Stabilize `core::ffi::CStr`, `alloc::ffi::CString`, and friends

Stabilize the `core_c_str` and `alloc_c_string` feature gates.

Change `std::ffi` to re-export these types rather than creating type
aliases, since they now have matching stability.

23 months agoRollup merge of #99270 - rhysd:issue-99269, r=Mark-Simulacrum
Yuki Okushi [Sat, 16 Jul 2022 08:53:03 +0000 (17:53 +0900)]
Rollup merge of #99270 - rhysd:issue-99269, r=Mark-Simulacrum

Add `#[must_use]` to `Box::from_raw`

Fixes #99269

23 months agoRollup merge of #99264 - eltociear:patch-14, r=compiler-errors
Yuki Okushi [Sat, 16 Jul 2022 08:53:02 +0000 (17:53 +0900)]
Rollup merge of #99264 - eltociear:patch-14, r=compiler-errors

Fix typo in mod.rs

constuct -> construct

23 months agoRollup merge of #99253 - pierwill:pierwill/rm-storage-fixme, r=oli-obk
Yuki Okushi [Sat, 16 Jul 2022 08:53:01 +0000 (17:53 +0900)]
Rollup merge of #99253 - pierwill:pierwill/rm-storage-fixme, r=oli-obk

Remove FIXME from MIR `always_storage_live_locals`

See discussion in https://github.com/rust-lang/rust/pull/99025#issuecomment-1183347428.

23 months agoRollup merge of #98662 - LucasDumont:document_fs_write, r=thomcc
Yuki Okushi [Sat, 16 Jul 2022 08:53:00 +0000 (17:53 +0900)]
Rollup merge of #98662 - LucasDumont:document_fs_write, r=thomcc

Add std::fs::write documentation precision

Fixes #97947.

As mentioned in #97947, the documentation is updated

23 months agoRollup merge of #98387 - NobodyXu:feature/std_io_Error_try_downgrade_inner, r=yaahc
Yuki Okushi [Sat, 16 Jul 2022 08:52:59 +0000 (17:52 +0900)]
Rollup merge of #98387 - NobodyXu:feature/std_io_Error_try_downgrade_inner, r=yaahc

Add new unstable API `downcast` to `std::io::Error`

https://github.com/rust-lang/libs-team/issues/57

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
23 months agoAdd regression test for #64401
Yuki Okushi [Sat, 16 Jul 2022 01:25:00 +0000 (10:25 +0900)]
Add regression test for #64401

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agoFix suggestion regression with incorrect syntactic combination of trait bounds
Will Crichton [Sat, 16 Jul 2022 01:02:26 +0000 (18:02 -0700)]
Fix suggestion regression with incorrect syntactic combination of trait bounds

23 months agoPropagate Expectation around binop typeck code to construct more precise trait obliga...
Will Crichton [Tue, 26 Apr 2022 20:59:08 +0000 (13:59 -0700)]
Propagate Expectation around binop typeck code to construct more precise trait obligations for binops.

23 months agoStabilize `future_poll_fn`
Yuki Okushi [Sat, 16 Jul 2022 01:04:14 +0000 (10:04 +0900)]
Stabilize `future_poll_fn`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agoAuto merge of #95685 - oxidecomputer:restore-static-dwarf, r=pnkfelix
bors [Sat, 16 Jul 2022 00:18:54 +0000 (00:18 +0000)]
Auto merge of #95685 - oxidecomputer:restore-static-dwarf, r=pnkfelix

Revert "Work around invalid DWARF bugs for fat LTO"

Since September, the toolchain has not been generating reliable DWARF
information for static variables when LTO is on. This has affected
projects in the embedded space where the use of LTO is typical. In our
case, it has kept us from bumping past the 2021-09-22 nightly toolchain
lest our debugger break. This has been a pretty dramatic regression for
people using debuggers and static variables. See #90357 for more info
and a repro case.

This commit is a mechanical revert of
d5de680e20def848751cb3c11e1182408112b1d3 from PR #89041, which caused
the issue. (Note on that PR that the commit's author has requested it be
reverted.)

I have locally verified that this fixes #90357 by restoring the
functionality of both the repro case I posted on that bug, and debugger
behavior on real programs. There do not appear to be test cases for this
in the toolchain; if I've missed them, point me at 'em and I'll update
them.

23 months agoadd tracking issue to generic member access APIs
Jane Losare-Lusby [Fri, 15 Jul 2022 22:13:43 +0000 (22:13 +0000)]
add tracking issue to generic member access APIs

23 months agoAuto merge of #99288 - Aaron1011:stable-intrinsics, r=yaahc
bors [Fri, 15 Jul 2022 21:38:02 +0000 (21:38 +0000)]
Auto merge of #99288 - Aaron1011:stable-intrinsics, r=yaahc

Mark stabilized intrinsics with `rustc_allowed_through_unstable_modules`

Fixes #99286

PR #95956 accidentally made these intrinsics unstable when
accessed through the unstable path segment 'std::intrinsics'

23 months agoSet minimum GDB version needed for basic-types-globals* tests.
Luqman Aden [Fri, 15 Jul 2022 20:46:14 +0000 (13:46 -0700)]
Set minimum GDB version needed for basic-types-globals* tests.

23 months agoApply suggestions from code review
Jane Losare-Lusby [Fri, 15 Jul 2022 20:17:44 +0000 (13:17 -0700)]
Apply suggestions from code review

23 months agoFix rebase
Esteban Küber [Fri, 15 Jul 2022 18:07:20 +0000 (11:07 -0700)]
Fix rebase

23 months agoMove tests to fit in limit
Esteban Küber [Fri, 15 Jul 2022 01:43:41 +0000 (18:43 -0700)]
Move tests to fit in limit

23 months agoAvoid incorrect suggestion
Esteban Küber [Fri, 15 Jul 2022 01:41:12 +0000 (18:41 -0700)]
Avoid incorrect suggestion

We check that there's a single level of block nesting to ensure always
correct suggestions. If we don't, then we only provide a free-form
message to avoid misleading users in cases like
`src/test/ui/nll/borrowed-temporary-error.rs`.

We could expand the analysis to suggest hoising all of the relevant
parts of the users' code to make the code compile, but that could be
too much.

23 months agoProvide structured suggestion for dropped temp value
Esteban Küber [Fri, 15 Jul 2022 00:12:01 +0000 (17:12 -0700)]
Provide structured suggestion for dropped temp value

23 months agoOnly suggest if span is not erroneous
Michael Goulet [Fri, 15 Jul 2022 17:32:15 +0000 (17:32 +0000)]
Only suggest if span is not erroneous

23 months agoFix ICE in named_arguments_used_positionally lint
Michael Goulet [Fri, 15 Jul 2022 03:45:23 +0000 (20:45 -0700)]
Fix ICE in named_arguments_used_positionally lint

23 months agoRevert "Highlight conflicting param-env candidates"
Michael Goulet [Fri, 15 Jul 2022 16:30:07 +0000 (16:30 +0000)]
Revert "Highlight conflicting param-env candidates"

This reverts commit 08135254dcf22be0d5661ea8f75e703b29a83514.

23 months agoAuto merge of #99015 - lcnr:fn-ctxt-no-more, r=compiler-errors
bors [Fri, 15 Jul 2022 17:11:07 +0000 (17:11 +0000)]
Auto merge of #99015 - lcnr:fn-ctxt-no-more, r=compiler-errors

stop using `FnCtxt` outside of hir typeck

the requirements between **hir typeck**™, and **not hir typeck**™ are different enough to warrant a full split. with this PR `FnCtxt` is now only used for hir typeck (and for one clippy lint which seems to be emulating hir typeck).

Once this PR has landed I intend to move `FnCtxt` into a new crate. This should also allow some further general improvements here.

r? rust-lang/types

23 months agoMark stabilized intrinsics with `rustc_allowed_through_unstable_modules`
Aaron Hill [Fri, 15 Jul 2022 16:17:17 +0000 (11:17 -0500)]
Mark stabilized intrinsics with `rustc_allowed_through_unstable_modules`

Fixes #99286

PR #95956 accidentally made these intrinsics unstable when
accessed through the unstable path segment 'std::intrinsics'

23 months agoInfer wildcard type from other patterns at every pattern level
Oli Scherer [Tue, 28 Jun 2022 11:19:38 +0000 (11:19 +0000)]
Infer wildcard type from other patterns at every pattern level

23 months agoMove constructor into the branch that actually uses it
Oli Scherer [Tue, 28 Jun 2022 10:49:55 +0000 (10:49 +0000)]
Move constructor into the branch that actually uses it

23 months agoRevert a hack that only ever worked on level deep
Oli Scherer [Tue, 28 Jun 2022 08:00:25 +0000 (08:00 +0000)]
Revert a hack that only ever worked on level deep

23 months agoMake destructuring a defining use
Oli Scherer [Tue, 28 Jun 2022 07:17:43 +0000 (07:17 +0000)]
Make destructuring a defining use

23 months agoAllow destructuring opaque types, since the patterns constrain the opaque types
Oli Scherer [Mon, 27 Jun 2022 16:26:41 +0000 (16:26 +0000)]
Allow destructuring opaque types, since the patterns constrain the opaque types

23 months agoSome tracing helpers
Oli Scherer [Mon, 27 Jun 2022 16:16:11 +0000 (16:16 +0000)]
Some tracing helpers

23 months agoReuse a helper method instead of manually rolling it
Oli Scherer [Mon, 27 Jun 2022 14:46:36 +0000 (14:46 +0000)]
Reuse a helper method instead of manually rolling it

23 months agoRemove early return that would likely have caused miscompilations if it ever happened
Oli Scherer [Fri, 24 Jun 2022 14:53:59 +0000 (14:53 +0000)]
Remove early return that would likely have caused miscompilations if it ever happened

23 months agoPass one argument instead of fetching two fields of it at every call site
Oli Scherer [Thu, 23 Jun 2022 16:08:02 +0000 (16:08 +0000)]
Pass one argument instead of fetching two fields of it at every call site

23 months agoAdd some tracing instrumentation
Oli Scherer [Thu, 23 Jun 2022 14:32:01 +0000 (14:32 +0000)]
Add some tracing instrumentation

23 months agointerpret/visitor: support visiting with a PlaceTy
Ralf Jung [Fri, 15 Jul 2022 00:32:45 +0000 (20:32 -0400)]
interpret/visitor: support visiting with a PlaceTy

23 months agoIntroduce opaque type to hidden type projection
Oli Scherer [Wed, 22 Jun 2022 15:28:28 +0000 (15:28 +0000)]
Introduce opaque type to hidden type projection

23 months agopasses: migrate half of `check_attr`
David Wood [Mon, 11 Jul 2022 17:59:04 +0000 (18:59 +0100)]
passes: migrate half of `check_attr`

Migrate half of the `rustc_passes::check_attr` diagnostics to using
diagnostic derives and being translatable.

23 months agomacros: support adding warnings to diags
David Wood [Mon, 11 Jul 2022 17:46:24 +0000 (18:46 +0100)]
macros: support adding warnings to diags

Both diagnostic and subdiagnostic derives were missing the ability to
add warnings to diagnostics - this is made more difficult by the `warn`
attribute already existing, so this name being unavailable for the
derives to use. `#[warn_]` is used instead, which requires
special-casing so that `{span_,}warn` is called instead of
`{span_,}warn_`.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agomacros: support `MultiSpan` in diag derives
David Wood [Mon, 11 Jul 2022 16:15:31 +0000 (17:15 +0100)]
macros: support `MultiSpan` in diag derives

Add support for `MultiSpan` with any of the attributes that work on a
`Span` - requires that diagnostic logic generated for these attributes
are emitted in the by-move block rather than the by-ref block that they
would normally have been generated in.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agoerrors: lint on `LintDiagnosticBuilder::build`
David Wood [Mon, 11 Jul 2022 15:29:24 +0000 (16:29 +0100)]
errors: lint on `LintDiagnosticBuilder::build`

Apply the `#[rustc_lint_diagnostics]` attribute to
`LintDiagnosticBuilder::build` so that diagnostic migration lints will
trigger for it.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agoerrors: impl `IntoDiagnosticArg` for `char`
David Wood [Mon, 11 Jul 2022 15:28:38 +0000 (16:28 +0100)]
errors: impl `IntoDiagnosticArg` for `char`

Implements `IntoDiagnosticArg` for `char` using its `Debug`
implementation and introduces a macro for those types which just
delegate the implementation to `ToString`.

Signed-off-by: David Wood <david.wood@huawei.com>
23 months agohir typeck: `fulfillment_cx` ignore regions
lcnr [Fri, 8 Jul 2022 09:17:12 +0000 (11:17 +0200)]
hir typeck: `fulfillment_cx` ignore regions

23 months agoprovide `generic_param_scope` for region errors
lcnr [Fri, 8 Jul 2022 08:59:35 +0000 (10:59 +0200)]
provide `generic_param_scope` for region errors

23 months agodon't require `FnCtxt` to check global asm
lcnr [Thu, 7 Jul 2022 14:14:27 +0000 (16:14 +0200)]
don't require `FnCtxt` to check global asm

23 months agotry to avoid `FnCtxt` during wf
lcnr [Thu, 7 Jul 2022 13:12:32 +0000 (15:12 +0200)]
try to avoid `FnCtxt` during wf

23 months agoremove unnecessary `select_obligations_where_possible`
lcnr [Thu, 7 Jul 2022 11:43:01 +0000 (13:43 +0200)]
remove unnecessary `select_obligations_where_possible`

this was previously used for opaque types but became unnecessary
after #89024