]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRemove animation on source sidebar
Guillaume Gomez [Sat, 19 Mar 2022 15:59:56 +0000 (16:59 +0100)]
Remove animation on source sidebar

2 years agoAuto merge of #95065 - matthiaskrgr:rollup-75i6oz5, r=matthiaskrgr
bors [Fri, 18 Mar 2022 05:26:14 +0000 (05:26 +0000)]
Auto merge of #95065 - matthiaskrgr:rollup-75i6oz5, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #95013 (Update browser-ui-test version to 0.8.2)
 - #95039 (Make negative coherence work when there's impl negative on super predicates)
 - #95047 (Refactor: remove an unnecessary pattern for ignoring all parts)
 - #95048 (update Miri)

Failed merges:

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

2 years agoRollup merge of #95048 - RalfJung:miri, r=RalfJung
Matthias Krüger [Fri, 18 Mar 2022 04:21:57 +0000 (05:21 +0100)]
Rollup merge of #95048 - RalfJung:miri, r=RalfJung

update Miri

Let's get those SIMD intrinsics out there. :)
r? `@ghost`

2 years agoRollup merge of #95047 - TaKO8Ki:remove-unnecessary-pattern-for-ignoring-all-parts...
Matthias Krüger [Fri, 18 Mar 2022 04:21:56 +0000 (05:21 +0100)]
Rollup merge of #95047 - TaKO8Ki:remove-unnecessary-pattern-for-ignoring-all-parts, r=wesleywiser

Refactor: remove an unnecessary pattern for ignoring all parts

2 years agoRollup merge of #95039 - spastorino:overlap-super-predicates, r=nikomatsakis
Matthias Krüger [Fri, 18 Mar 2022 04:21:55 +0000 (05:21 +0100)]
Rollup merge of #95039 - spastorino:overlap-super-predicates, r=nikomatsakis

Make negative coherence work when there's impl negative on super predicates

r? `@nikomatsakis`

2 years agoRollup merge of #95013 - GuillaumeGomez:browser-ui-test-v, r=notriddle
Matthias Krüger [Fri, 18 Mar 2022 04:21:54 +0000 (05:21 +0100)]
Rollup merge of #95013 - GuillaumeGomez:browser-ui-test-v, r=notriddle

Update browser-ui-test version to 0.8.2

It brings mostly debugging improvements: it doesn't stop at the first failing command but rather at the first "fatal error".

r? `@notriddle`

2 years agoAuto merge of #88098 - Amanieu:oom_panic, r=nagisa
bors [Fri, 18 Mar 2022 03:01:46 +0000 (03:01 +0000)]
Auto merge of #88098 - Amanieu:oom_panic, r=nagisa

Implement -Z oom=panic

This PR removes the `#[rustc_allocator_nounwind]` attribute on `alloc_error_handler` which allows it to unwind with a panic instead of always aborting. This is then used to implement `-Z oom=panic` as per RFC 2116 (tracking issue #43596).

Perf and binary size tests show negligible impact.

2 years agoAuto merge of #95056 - Dylan-DPC:rollup-swtuw2n, r=Dylan-DPC
bors [Fri, 18 Mar 2022 00:35:19 +0000 (00:35 +0000)]
Auto merge of #95056 - Dylan-DPC:rollup-swtuw2n, r=Dylan-DPC

Rollup of 10 pull requests

Successful merges:

 - #91133 (Improve `unsafe` diagnostic)
 - #93222 (Make ErrorReported impossible to construct outside `rustc_errors`)
 - #93745 (Stabilize ADX target feature)
 - #94309 ([generator_interior] Be more precise with scopes of borrowed places)
 - #94698 (Remove redundant code from copy-suggestions)
 - #94731 (Suggest adding `{ .. }` around a const function call with arguments)
 - #94960 (Fix many spelling mistakes)
 - #94982 (Add deprecated_safe feature gate and attribute, cc #94978)
 - #94997 (debuginfo: Fix ICE when generating name for type that produces a layout error.)
 - #95000 (Fixed wrong type name in comment)

Failed merges:

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

2 years agoRollup merge of #95000 - fee1-dead:fee1-dead-patch-1, r=Mark-Simulacrum
Dylan DPC [Thu, 17 Mar 2022 21:55:08 +0000 (22:55 +0100)]
Rollup merge of #95000 - fee1-dead:fee1-dead-patch-1, r=Mark-Simulacrum

Fixed wrong type name in comment

95kth issue/pr!

2 years agoRollup merge of #94997 - michaelwoerister:fix-enum-type-name-layout-error, r=wesleywiser
Dylan DPC [Thu, 17 Mar 2022 21:55:07 +0000 (22:55 +0100)]
Rollup merge of #94997 - michaelwoerister:fix-enum-type-name-layout-error, r=wesleywiser

debuginfo: Fix ICE when generating name for type that produces a layout error.

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

2 years agoRollup merge of #94982 - skippy10110:deprecated_safe, r=Dylan-DPC
Dylan DPC [Thu, 17 Mar 2022 21:55:06 +0000 (22:55 +0100)]
Rollup merge of #94982 - skippy10110:deprecated_safe, r=Dylan-DPC

Add deprecated_safe feature gate and attribute, cc #94978

2 years agoRollup merge of #94960 - codehorseman:master, r=oli-obk
Dylan DPC [Thu, 17 Mar 2022 21:55:05 +0000 (22:55 +0100)]
Rollup merge of #94960 - codehorseman:master, r=oli-obk

Fix many spelling mistakes

Signed-off-by: codehorseman <cricis@yeah.net>
2 years agoRollup merge of #94731 - TaKO8Ki:const-generic-expr-recovery, r=davidtwco,oli-obk
Dylan DPC [Thu, 17 Mar 2022 21:55:04 +0000 (22:55 +0100)]
Rollup merge of #94731 - TaKO8Ki:const-generic-expr-recovery, r=davidtwco,oli-obk

Suggest adding `{ .. }` around a const function call with arguments

closes #91020

2 years agoRollup merge of #94698 - WaffleLapkin:simplify-copy-suggestions, r=estebank
Dylan DPC [Thu, 17 Mar 2022 21:55:03 +0000 (22:55 +0100)]
Rollup merge of #94698 - WaffleLapkin:simplify-copy-suggestions, r=estebank

Remove redundant code from copy-suggestions

Follow up to #94375, just remove some code that is not necessary anymore. This may make the perf of such suggestions a little bit worse, but I don't think this is significant.

r? `@estebank`

2 years agoRollup merge of #94309 - eholk:issue-57017, r=tmandry
Dylan DPC [Thu, 17 Mar 2022 21:55:02 +0000 (22:55 +0100)]
Rollup merge of #94309 - eholk:issue-57017, r=tmandry

[generator_interior] Be more precise with scopes of borrowed places

Previously the generator interior type checking analysis would use the nearest temporary scope as the scope of a borrowed value. This ends up being overly broad for cases such as:

```rust
fn status(_client_status: &Client) -> i16 {
    200
}

fn main() {
    let client = Client;
    let g = move || match status(&client) {
        _status => yield,
    };
    assert_send(g);
}
```

In this case, the borrow `&client` could be considered in scope for the entirety of the `match` expression, meaning it would be viewed as live across the `yield`, therefore making the generator not `Send`.

In most cases, we want to use the enclosing expression as the scope for a borrowed value which will be less than or equal to the nearest temporary scope. This PR changes the analysis to use the enclosing expression as the scope for most borrows, with the exception of borrowed RValues which are true temporary values that should have the temporary scope. There's one further exception where borrows of a copy such as happens in autoref cases also should be ignored despite being RValues.

Joint work with `@nikomatsakis`

Fixes #57017

r? `@tmandry`

2 years agoRollup merge of #93745 - tarcieri:stabilize-adx, r=cjgillot
Dylan DPC [Thu, 17 Mar 2022 21:55:01 +0000 (22:55 +0100)]
Rollup merge of #93745 - tarcieri:stabilize-adx, r=cjgillot

Stabilize ADX target feature

This is a continuation of #60109, which noted that while the ADX intrinsics were stabilized, the corresponding target feature never was.

This PR follows the same general structure and stabilizes the ADX target feature.

See also https://github.com/rust-lang/rust/issues/44839 - tracking issue for target feature

2 years agoRollup merge of #93222 - mark-i-m:errorreported, r=oli-obk
Dylan DPC [Thu, 17 Mar 2022 21:55:00 +0000 (22:55 +0100)]
Rollup merge of #93222 - mark-i-m:errorreported, r=oli-obk

Make ErrorReported impossible to construct outside `rustc_errors`

There are a few places were we have to construct it, though, and a few
places that are more invasive to change. To do this, we create a
constructor with a long obvious name.

cc #69426 `@varkor` `@eddyb` `@estebank`

I actually didn't see that I was assigned to this issue until now...

2 years agoRollup merge of #91133 - terrarier2111:unsafe-diagnostic, r=jackh726
Dylan DPC [Thu, 17 Mar 2022 21:54:59 +0000 (22:54 +0100)]
Rollup merge of #91133 - terrarier2111:unsafe-diagnostic, r=jackh726

Improve `unsafe` diagnostic

This fixes: https://github.com/rust-lang/rust/issues/90880
I didn't use the exact proposed messages though.

2 years agoAuto merge of #95020 - compiler-errors:late-debuginfo, r=jackh726
bors [Thu, 17 Mar 2022 21:54:25 +0000 (21:54 +0000)]
Auto merge of #95020 - compiler-errors:late-debuginfo, r=jackh726

erase late-bound regions in dyn projection types for debuginfo

simply skipping the binder leaves late-bound regions that will cause debug assertions to fail when checking the layout of the projection ty, so let's erase the regions instead.

sorry for taking so long to put this up, had trouble getting rustc set up on a new computer.

fixes #94998

2 years agoUpdate compiler/rustc_trait_selection/src/traits/coherence.rs
Niko Matsakis [Thu, 17 Mar 2022 20:51:30 +0000 (16:51 -0400)]
Update compiler/rustc_trait_selection/src/traits/coherence.rs

2 years agoAuto merge of #95050 - ehuss:fix-cmake-build, r=Mark-Simulacrum
bors [Thu, 17 Mar 2022 18:52:14 +0000 (18:52 +0000)]
Auto merge of #95050 - ehuss:fix-cmake-build, r=Mark-Simulacrum

Fix cmake build.

This is an attempt to fix the cmake build. For some reason, it has recently started failing with a permission denied trying to overwrite `/tmp/build.log`.  This file exists from the `build-toolchains.sh` step, which is owned by the rustbuild user. I think there is some behavior where a sticky `/tmp` directory doesn't allow overwriting files owned by other users even when running as root.  I do not know why this has suddenly started, and I can't reproduce locally with my own docker setup. However, this fix seems to work on CI.

2 years agoFix cmake build.
Eric Huss [Thu, 17 Mar 2022 18:43:38 +0000 (11:43 -0700)]
Fix cmake build.

2 years agoupdate Miri
Ralf Jung [Thu, 17 Mar 2022 18:27:42 +0000 (14:27 -0400)]
update Miri

2 years agoUse let else here
Santiago Pastorino [Thu, 17 Mar 2022 17:55:16 +0000 (14:55 -0300)]
Use let else here

2 years agorefactor: remove an unnecessary pattern for ignoring all parts
Takayuki Maeda [Thu, 17 Mar 2022 17:54:06 +0000 (02:54 +0900)]
refactor: remove an unnecessary pattern for ignoring all parts

2 years agoAdd more commments
Santiago Pastorino [Thu, 17 Mar 2022 15:37:18 +0000 (12:37 -0300)]
Add more commments

2 years agoThis test now works
Santiago Pastorino [Thu, 17 Mar 2022 15:36:12 +0000 (12:36 -0300)]
This test now works

2 years agoExtract obligation resolution to function
Santiago Pastorino [Thu, 17 Mar 2022 15:09:00 +0000 (12:09 -0300)]
Extract obligation resolution to function

2 years agoMake negative coherence work when there's impl negative on super predicates
Santiago Pastorino [Thu, 17 Mar 2022 14:26:45 +0000 (11:26 -0300)]
Make negative coherence work when there's impl negative on super predicates

2 years agoAdd comments on Polarity
Santiago Pastorino [Thu, 17 Mar 2022 14:10:19 +0000 (11:10 -0300)]
Add comments on Polarity

2 years agoRun GUI test when browser-ui-test version is updated
Guillaume Gomez [Wed, 16 Mar 2022 21:22:16 +0000 (22:22 +0100)]
Run GUI test when browser-ui-test version is updated

2 years agoUpdate browser-ui-test version to 0.8.3
Guillaume Gomez [Wed, 16 Mar 2022 15:18:47 +0000 (16:18 +0100)]
Update browser-ui-test version to 0.8.3

2 years agoerase late-bound regions in dyn projection types for debuginfo
Michael Goulet [Wed, 16 Mar 2022 18:53:31 +0000 (11:53 -0700)]
erase late-bound regions in dyn projection types for debuginfo

2 years agoAdd double negative trait test case
Santiago Pastorino [Wed, 16 Mar 2022 17:59:03 +0000 (14:59 -0300)]
Add double negative trait test case

2 years agorustc_error: make ErrorReported impossible to construct
mark [Sun, 23 Jan 2022 00:49:12 +0000 (18:49 -0600)]
rustc_error: make ErrorReported impossible to construct

There are a few places were we have to construct it, though, and a few
places that are more invasive to change. To do this, we create a
constructor with a long obvious name.

2 years agodebuginfo: Fix ICE when generating name for type that produces a layout error.
Michael Woerister [Wed, 16 Mar 2022 10:03:07 +0000 (11:03 +0100)]
debuginfo: Fix ICE when generating name for type that produces a layout error.

2 years agoresolve the conflict in compiler/rustc_session/src/parse.rs
codehorseman [Wed, 16 Mar 2022 12:12:30 +0000 (20:12 +0800)]
resolve the conflict in compiler/rustc_session/src/parse.rs

Signed-off-by: codehorseman <cricis@yeah.net>
2 years agoUpdate issue-92111.rs
fee1-dead [Wed, 16 Mar 2022 10:50:18 +0000 (21:50 +1100)]
Update issue-92111.rs

2 years agoAuto merge of #94995 - luojia65:riscv-more-features, r=Amanieu
bors [Wed, 16 Mar 2022 10:16:33 +0000 (10:16 +0000)]
Auto merge of #94995 - luojia65:riscv-more-features, r=Amanieu

Support more RISC-V backend features on rustc compiler

This pull request adds the following RISC-V compiler features:

- V for vector extension
- Zfinx, Zdinx, Zhinx and Zhinxmin float in integer register extensions
- Zfh, Zfhmin 16-bit float pointer extensions
- Zbkb, Zkbc, Zbkc, Zk* cryptography extensions

It matches name in LLVM feature and is_riscv_feature_detected!. In this case we can use `#[target_feature]` on new RISC-V features. Ref: https://github.com/rust-lang/stdarch/pull/1263#pullrequestreview-825891905

Use `rustc --print target-features` under any RISC-V target (or with `--target`) to check the features the rustc compiler support.

<details>

```
luojia@luojia-virtual-machine:~/IntrinRiscv/stdarch-riscv-crypto$ cargo rustc -- --print target-features
   Compiling stdarch-riscv-crypto v0.1.0 (/home/luojia/IntrinRiscv/stdarch-riscv-crypto)
Features supported by rustc for this target:
    m                - 'M' (Integer Multiplication and Division).
    a                - 'A' (Atomic Instructions).
    c                - 'C' (Compressed Instructions).
    f                - 'F' (Single-Precision Floating-Point).
    d                - 'D' (Double-Precision Floating-Point).
    e                - Implements RV32E (provides 16 rather than 32 GPRs).
    v                - 'V' (Vector Extension for Application Processors).
    zfinx            - 'Zfinx' (Float in Integer).
    zdinx            - 'Zdinx' (Double in Integer).
    zhinx            - 'Zhinx' (Half Float in Integer).
    zhinxmin         - 'Zhinxmin' (Half Float in Integer Minimal).
    zfh              - 'Zfh' (Half-Precision Floating-Point).
    zfhmin           - 'Zfhmin' (Half-Precision Floating-Point Minimal).
    zbkb             - 'Zbkb' (Bitmanip instructions for Cryptography).
    zbkc             - 'Zbkc' (Carry-less multiply instructions for Cryptography).
    zbkx             - 'Zbkx' (Crossbar permutation instructions).
    zknd             - 'Zknd' (NIST Suite: AES Decryption).
    zkne             - 'Zkne' (NIST Suite: AES Encryption).
    zknh             - 'Zknh' (NIST Suite: Hash Function Instructions).
    zksed            - 'Zksed' (ShangMi Suite: SM4 Block Cipher Instructions).
    zksh             - 'Zksh' (ShangMi Suite: SM3 Hash Function Instructions).
    zkr              - 'Zkr' (Entropy Source Extension).
    zkn              - 'Zkn' (NIST Algorithm Suite).
    zks              - 'Zks' (ShangMi Algorithm Suite).
    zk               - 'Zk' (Standard scalar cryptography extension).
    zkt              - 'Zkt' (Data Independent Execution Latency).
    crt-static       - Enables C Run-time Libraries to be statically linked.

Code-generation features supported by LLVM for this target:
    64bit            - Implements RV64.
    experimental-zbe - 'Zbe' (Extract-Deposit 'Zb' Instructions).
    experimental-zbf - 'Zbf' (Bit-Field 'Zb' Instructions).
    experimental-zbm - 'Zbm' (Matrix 'Zb' Instructions).
    experimental-zbp - 'Zbp' (Permutation 'Zb' Instructions).
    experimental-zbr - 'Zbr' (Polynomial Reduction 'Zb' Instructions).
    experimental-zbt - 'Zbt' (Ternary 'Zb' Instructions).
    no-rvc-hints     - Disable RVC Hint Instructions..
    relax            - Enable Linker relaxation..
    reserve-x1       - Reserve X1.
    reserve-x10      - Reserve X10.
    reserve-x11      - Reserve X11.
    reserve-x12      - Reserve X12.
    reserve-x13      - Reserve X13.
    reserve-x14      - Reserve X14.
    reserve-x15      - Reserve X15.
    reserve-x16      - Reserve X16.
    reserve-x17      - Reserve X17.
    reserve-x18      - Reserve X18.
    reserve-x19      - Reserve X19.
    reserve-x2       - Reserve X2.
    reserve-x20      - Reserve X20.
    reserve-x21      - Reserve X21.
    reserve-x22      - Reserve X22.
    reserve-x23      - Reserve X23.
    reserve-x24      - Reserve X24.
    reserve-x25      - Reserve X25.
    reserve-x26      - Reserve X26.
    reserve-x27      - Reserve X27.
    reserve-x28      - Reserve X28.
    reserve-x29      - Reserve X29.
    reserve-x3       - Reserve X3.
    reserve-x30      - Reserve X30.
    reserve-x31      - Reserve X31.
    reserve-x4       - Reserve X4.
    reserve-x5       - Reserve X5.
    reserve-x6       - Reserve X6.
    reserve-x7       - Reserve X7.
    reserve-x8       - Reserve X8.
    reserve-x9       - Reserve X9.
    save-restore     - Enable save/restore..
    sifive7          - SiFive 7-Series processors.
    zba              - 'Zba' (Address Generation Instructions).
    zbb              - 'Zbb' (Basic Bit-Manipulation).
    zbc              - 'Zbc' (Carry-Less Multiplication).
    zbs              - 'Zbs' (Single-Bit Instructions).
    zve32f           - 'Zve32f' (Vector Extensions for Embedded Processors with maximal 32 EEW and F extension).
    zve32x           - 'Zve32x' (Vector Extensions for Embedded Processors with maximal 32 EEW).
    zve64d           - 'Zve64d' (Vector Extensions for Embedded Processors with maximal 64 EEW, F and D extension).
    zve64f           - 'Zve64f' (Vector Extensions for Embedded Processors with maximal 64 EEW and F extension).
    zve64x           - 'Zve64x' (Vector Extensions for Embedded Processors with maximal 64 EEW).
    zvl1024b         - 'Zvl' (Minimum Vector Length) 1024.
    zvl128b          - 'Zvl' (Minimum Vector Length) 128.
    zvl16384b        - 'Zvl' (Minimum Vector Length) 16384.
    zvl2048b         - 'Zvl' (Minimum Vector Length) 2048.
    zvl256b          - 'Zvl' (Minimum Vector Length) 256.
    zvl32768b        - 'Zvl' (Minimum Vector Length) 32768.
    zvl32b           - 'Zvl' (Minimum Vector Length) 32.
    zvl4096b         - 'Zvl' (Minimum Vector Length) 4096.
    zvl512b          - 'Zvl' (Minimum Vector Length) 512.
    zvl64b           - 'Zvl' (Minimum Vector Length) 64.
    zvl8192b         - 'Zvl' (Minimum Vector Length) 8192.

Use +feature to enable a feature, or -feature to disable it.
For example, rustc -C target-cpu=mycpu -C target-feature=+feature1,-feature2

Code-generation features cannot be used in cfg or #[target_feature],
and may be renamed or removed in a future version of LLVM or rustc.

    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
```
</details>

Proof of concept:

<details>

```rust
#![feature(link_llvm_intrinsics)]
#![feature(target_feature_11)]
#![feature(riscv_target_feature)]

extern "C" {
    #[link_name = "llvm.riscv.sm3p0"]
    fn llvm_sm3p0(x: u32) -> u32;
    #[link_name = "llvm.riscv.sm3p1"]
    fn llvm_sm3p1(x: u32) -> u32;
}

#[target_feature(enable = "zksh")]
pub unsafe fn sm3p0(x: u32) -> u32 {
    unsafe { llvm_sm3p0(x) }
}

extern "C" {
    #[link_name = "llvm.riscv.vsetvli"]
    fn llvm_vsetvli(avl: usize, sew: usize, lmul: usize) -> usize;
    #[link_name = "llvm.riscv.vsetvlimax"]
    fn llvm_vsetvlimax(sew: usize, lmul: usize) -> usize;
}

#[target_feature(enable = "v")]
pub unsafe fn vsetvli<const SEW: usize, const LMUL: usize>(avl: usize) -> usize {
    unsafe { llvm_vsetvli(avl, SEW, LMUL) }
}
```
</details>

r? `@Amanieu`

2 years agofeat: more RISC-V features
luojia65 [Wed, 16 Mar 2022 08:57:36 +0000 (16:57 +0800)]
feat: more RISC-V features

These features include:
- V for vector extension
- Zfinx, Zdinx, Zhinx and Zhinxmin float in integer register extensions
- Zfh, Zfhmin 16-bit float pointer extensions
- Zbkb, Zkbc, Zbkc, Zk* cryptography extensions

It matches name in LLVM feature and is_riscv_feature_detected!.

2 years agoAuto merge of #94990 - ehuss:update-books, r=ehuss
bors [Wed, 16 Mar 2022 06:19:54 +0000 (06:19 +0000)]
Auto merge of #94990 - ehuss:update-books, r=ehuss

Update books

## reference

8 commits in 9d289c05fce7254b99c6a0d354d84abb7fd7a032..0a2fe6651fbccc6416c5110fdf5b93fb3cb29247
2022-02-23 08:58:20 -0800 to 2022-03-15 09:32:25 -0700
- Documentation PR for cfg_panic (rust-lang/reference#1157)
- Document aarch64 `target_feature` options (rust-lang/reference#1102)
- Try to clarify destructor not being run scenario. (rust-lang/reference#1107)
- Add undocumented Punctuation token Tilde `~` (rust-lang/reference#1149)
- update UB list for safe target_feature (rust-lang/reference#1050)
- Update const_eval.md for feature stabilization (rust-lang/reference#1166)
- Remove `.intel_syntax`/`.att_syntax` support entirely.
- Fix `.intel_syntax` directive

## book

3 commits in 3f255ed40b8c82a0434088568fbed270dc31bf00..036e88a4f135365de85358febe5324976a56030a
2022-02-27 21:26:12 -0500 to 2022-03-04 21:53:33 -0500
- Fix some links and small wordings
- Snapshot of chapter 19 for nostarch
- Clarify fully-qualified syntax explanation

## rust-by-example

2 commits in 2a928483a20bb306a7399c0468234db90d89afb5..d504324f1e7dc7edb918ac39baae69f1f1513b8e
2022-02-28 11:36:59 -0300 to 2022-03-07 09:26:32 -0300
- Fixed extra indentation at line 43 in Phantom Testcase example. (rust-lang/rust-by-example#1515)
- Typo fixed in description of inline ASM cpuid function (rust-lang/rust-by-example#1514)

## rustc-dev-guide

3 commits in 32f2a5b4e7545318846185198542230170dd8a42..0e4b961a9c708647bca231430ce1b199993e0196
2022-03-01 10:45:24 -0600 to 2022-03-14 08:40:37 -0700
- update winget install instructions to ensure proper packages are installed (-e for --exact, and full package names to ensure arbitrary packages from
the msstore source aren't installed)
- Add missing rustdoc tests explanations
- Fix incorrectly escaped backtick

2 years agoAuto merge of #94987 - Dylan-DPC:rollup-5tssuhi, r=Dylan-DPC
bors [Wed, 16 Mar 2022 04:05:35 +0000 (04:05 +0000)]
Auto merge of #94987 - Dylan-DPC:rollup-5tssuhi, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #94868 (Format core and std macro rules, removing needless surrounding blocks)
 - #94951 (Extend the irrefutable_let_patterns lint to let chains)
 - #94955 (Refactor: Use `format_args_capture` in some parts of `rustc_parse`)
 - #94957 (Improve the explanation about the behaviour of read_line)
 - #94974 (Ensure that `let_else` does not interact with `let_chains`)

Failed merges:

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

2 years agoUpdate books
Eric Huss [Wed, 16 Mar 2022 03:42:35 +0000 (20:42 -0700)]
Update books

2 years agoRollup merge of #94974 - c410-f3r:let-chain-dashufwrqwemkf-let-else, r=joshtriplett
Dylan DPC [Wed, 16 Mar 2022 02:34:35 +0000 (03:34 +0100)]
Rollup merge of #94974 - c410-f3r:let-chain-dashufwrqwemkf-let-else, r=joshtriplett

Ensure that `let_else` does not interact with `let_chains`

As requested on https://github.com/rust-lang/rust/pull/94927.

cc `@joshtriplett` `@estebank`

2 years agoRollup merge of #94957 - iamzhangyong:explanation-read_line, r=Dylan-DPC
Dylan DPC [Wed, 16 Mar 2022 02:34:34 +0000 (03:34 +0100)]
Rollup merge of #94957 - iamzhangyong:explanation-read_line, r=Dylan-DPC

Improve the explanation about the behaviour of read_line

Close issue like https://github.com/rust-lang/book/issues/2574

2 years agoRollup merge of #94955 - TaKO8Ki:use-format-args-capture-in-rustc-parse, r=Dylan-DPC
Dylan DPC [Wed, 16 Mar 2022 02:34:33 +0000 (03:34 +0100)]
Rollup merge of #94955 - TaKO8Ki:use-format-args-capture-in-rustc-parse, r=Dylan-DPC

Refactor: Use `format_args_capture` in some parts of `rustc_parse`

2 years agoRollup merge of #94951 - est31:irrefutable_let_chain_patterns, r=estebank
Dylan DPC [Wed, 16 Mar 2022 02:34:32 +0000 (03:34 +0100)]
Rollup merge of #94951 - est31:irrefutable_let_chain_patterns, r=estebank

Extend the irrefutable_let_patterns lint to let chains

Implements the suggestion from https://github.com/rust-lang/rust/pull/94927#issuecomment-1067078300

We only look for complete suffixes or prefixes of irrefutable let patterns, so
that an irrefutable let pattern in a chain surrounded by refutable ones is
not linted, as it is an useful pattern that has no low-cost replacement (unlike suffixes or prefixes which can just be copied outside of the `if`: either into the `if`'s block, or the block surrounding the `if`).
If all patterns in a let chain are irrefutable, we lint as well.

Depends on #94958 ~~so I included it into the PR for now~~ *which has been merged since*.

r? `@estebank`

cc `@joshtriplett` `@c410-f3r`

2 years agoRollup merge of #94868 - dtolnay:noblock, r=Dylan-DPC
Dylan DPC [Wed, 16 Mar 2022 02:34:32 +0000 (03:34 +0100)]
Rollup merge of #94868 - dtolnay:noblock, r=Dylan-DPC

Format core and std macro rules, removing needless surrounding blocks

Many of the asserting and printing macros in `core` and `std` are written with prehistoric-looking formatting, like this:

https://github.com/rust-lang/rust/blob/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/std/src/macros.rs#L96-L101

In modern Rust style this would conventionally be written as follows instead, always using braces and a trailing semicolon on the macro arms:

https://github.com/rust-lang/rust/blob/af53809c874e0afb7be966df4d3cfcaa05277c53/library/std/src/macros.rs#L98-L105

Getting rid of the unneeded braces inside the expansion reduces extraneous indentation in macro-expanded code. For example:

```rust
println!("repro {}", true);
```

```rust
// before:

{
    ::std::io::_print(
        ::core::fmt::Arguments::new_v1(
            &["repro ", "\n"],
            &[::core::fmt::ArgumentV1::new_display(&true)],
        ),
    );
};
```

```rust
// after:

::std::io::_print(
    ::core::fmt::Arguments::new_v1(
        &["repro ", "\n"],
        &[::core::fmt::ArgumentV1::new_display(&true)],
    ),
);
```

2 years agochanged wording
Dylan DPC [Wed, 16 Mar 2022 02:04:40 +0000 (03:04 +0100)]
changed wording

2 years agoAuto merge of #94861 - aDotInTheVoid:rdj-trait-tests, r=CraftSpider
bors [Wed, 16 Mar 2022 01:24:37 +0000 (01:24 +0000)]
Auto merge of #94861 - aDotInTheVoid:rdj-trait-tests, r=CraftSpider

rustdoc-json: More tests, and better jsondocck errors

Helps with #81359

r? `@CraftSpider`

`@rustbot` modify labels: +A-rustdoc-json +T-rustdoc +A-testsuite

2 years agoBless coverage-reports after core macro blocks change
David Tolnay [Wed, 16 Mar 2022 01:10:44 +0000 (18:10 -0700)]
Bless coverage-reports after core macro blocks change

2 years agoExtend the irrefutable_let_patterns lint to let chains
est31 [Tue, 15 Mar 2022 02:48:53 +0000 (03:48 +0100)]
Extend the irrefutable_let_patterns lint to let chains

Only look for complete suffixes or prefixes of irrefutable let patterns, so
that an irrefutable let pattern in a chain surrounded by refutable ones is
not linted, as it is an useful pattern.

2 years agoAuto merge of #94925 - lcnr:relax-sus-auto-impls, r=estebank
bors [Tue, 15 Mar 2022 22:54:35 +0000 (22:54 +0000)]
Auto merge of #94925 - lcnr:relax-sus-auto-impls, r=estebank

relax `suspicious_auto_trait_impls` lint wrt lifetimes

fixes the warning for https://github.com/rust-lang/rust/issues/93367#issuecomment-1063993489.

2 years agoAdd deprecated_safe feature gate and attribute, cc #94978
skippy10110 [Tue, 15 Mar 2022 22:28:53 +0000 (19:28 -0300)]
Add deprecated_safe feature gate and attribute, cc #94978

2 years agoAuto merge of #94973 - GuillaumeGomez:more-gui-tests, r=notriddle
bors [Tue, 15 Mar 2022 20:13:35 +0000 (20:13 +0000)]
Auto merge of #94973 - GuillaumeGomez:more-gui-tests, r=notriddle

Add GUI test to check URLs

The first commit merges both file doing kinda the same thing. Didn't make much sense to keep them separated.

The second commit add checks to ensure the URL has the expected value depending if the search is displayed or not.

r? `@notriddle`

2 years agoEnsure that `let_else` does not interact with `let_chains`
Caio [Tue, 15 Mar 2022 20:00:16 +0000 (17:00 -0300)]
Ensure that `let_else` does not interact with `let_chains`

2 years agoAdd URL GUI tests
Guillaume Gomez [Tue, 15 Mar 2022 19:56:14 +0000 (20:56 +0100)]
Add URL GUI tests

2 years agoMerge both "search-result-color" GUI tests
Guillaume Gomez [Tue, 15 Mar 2022 19:41:24 +0000 (20:41 +0100)]
Merge both "search-result-color" GUI tests

2 years agorustdoc-json: Lifetime tests
Nixon Enraght-Moony [Fri, 11 Mar 2022 19:11:23 +0000 (19:11 +0000)]
rustdoc-json: Lifetime tests

2 years agojsondocck: Better error for invalid @count number
Nixon Enraght-Moony [Thu, 10 Mar 2022 15:55:38 +0000 (15:55 +0000)]
jsondocck: Better error for invalid @count number

2 years agorustdoc-json: Add tests for generic fn args and returns
Nixon Enraght-Moony [Thu, 10 Mar 2022 15:53:48 +0000 (15:53 +0000)]
rustdoc-json: Add tests for generic fn args and returns

2 years agojsondocck: better error for when @set matches multiple items
Nixon Enraght-Moony [Fri, 25 Feb 2022 15:27:11 +0000 (15:27 +0000)]
jsondocck: better error for when @set matches multiple items

2 years agorustdoc-json: Add test for supertraits
Nixon Enraght-Moony [Sun, 20 Feb 2022 22:51:05 +0000 (22:51 +0000)]
rustdoc-json: Add test for supertraits

2 years agoAuto merge of #94966 - matthiaskrgr:rollup-iqzswh3, r=matthiaskrgr
bors [Tue, 15 Mar 2022 16:26:10 +0000 (16:26 +0000)]
Auto merge of #94966 - matthiaskrgr:rollup-iqzswh3, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #94810 (debuginfo: Fix bug in type name generation for dyn types with associated types but no other generic arguments.)
 - #94947 (fix typos)
 - #94956 (Fix small typo in FIXME)
 - #94958 (Support other types of pluralization in pluralize macro)

Failed merges:

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

2 years agoRollup merge of #94958 - est31:pluralize, r=oli-obk
Matthias Krüger [Tue, 15 Mar 2022 16:15:55 +0000 (17:15 +0100)]
Rollup merge of #94958 - est31:pluralize, r=oli-obk

Support other types of pluralization in pluralize macro

2 years agoRollup merge of #94956 - martingms:fix-fixme-comment-typo, r=lqd
Matthias Krüger [Tue, 15 Mar 2022 16:15:54 +0000 (17:15 +0100)]
Rollup merge of #94956 - martingms:fix-fixme-comment-typo, r=lqd

Fix small typo in FIXME

I introduced a few small typos when linking to an optimizing PR, this PR fixes them.

r? `@lqd`

2 years agoRollup merge of #94947 - Dylan-DPC:fix/typos, r=oli-obk
Matthias Krüger [Tue, 15 Mar 2022 16:15:53 +0000 (17:15 +0100)]
Rollup merge of #94947 - Dylan-DPC:fix/typos, r=oli-obk

fix typos

Rework of #94603 which got closed as I was trying to unmerge and repush.  This is a subset of changes from the original pr as I sed'd whatever typos I remembered from the original PR

thanks to `@cuishuang` for the original PR

2 years agoRollup merge of #94810 - michaelwoerister:fix-trait-pointer-debuginfo-names, r=wesley...
Matthias Krüger [Tue, 15 Mar 2022 16:15:52 +0000 (17:15 +0100)]
Rollup merge of #94810 - michaelwoerister:fix-trait-pointer-debuginfo-names, r=wesleywiser

debuginfo: Fix bug in type name generation for dyn types with associated types but no other generic arguments.

For types like `&dyn Future<Output=bool>` the compiler currently emits invalid types names in debuginfo. This PR fixes this.

Before:
```txt
// DWARF
&dyn core::future::future::Future, Output=bool>

// CodeView
ref$<dyn$<core::future::future::Future,assoc$<Output,bool> > > >
```

After:
```txt
// DWARF
&dyn core::future::future::Future<Output=bool>

// CodeView
ref$<dyn$<core::future::future::Future<assoc$<Output,bool> > > >
```

These syntactically incorrect type names can cause downstream tools (e.g. debugger extensions) crash when trying to parse them.

r? `@wesleywiser`

2 years agoSupport other types of pluralization in pluralize macro
est31 [Mon, 14 Mar 2022 16:55:14 +0000 (17:55 +0100)]
Support other types of pluralization in pluralize macro

2 years agoAuto merge of #94928 - lcnr:inline-as_substs, r=michaelwoerister
bors [Tue, 15 Mar 2022 13:14:13 +0000 (13:14 +0000)]
Auto merge of #94928 - lcnr:inline-as_substs, r=michaelwoerister

inline `tuple_fields`

more https://github.com/rust-lang/rust/pull/93505 fun, after this i have no idea what might be causing the perf impact.

2 years agoImprove the explanation about the behaviour of read_line
zed.zy [Tue, 15 Mar 2022 11:37:52 +0000 (19:37 +0800)]
Improve the explanation about the behaviour of read_line

2 years agoFix small typo in FIXME
Martin Gammelsæter [Tue, 15 Mar 2022 11:04:23 +0000 (12:04 +0100)]
Fix small typo in FIXME

2 years agoAuto merge of #94261 - michaelwoerister:debuginfo-types-refactor, r=wesleywiser
bors [Tue, 15 Mar 2022 10:52:32 +0000 (10:52 +0000)]
Auto merge of #94261 - michaelwoerister:debuginfo-types-refactor, r=wesleywiser

debuginfo: Refactor debuginfo generation for types

This PR implements the refactoring of the `rustc_codegen_llvm::debuginfo::metadata` module as described in MCP https://github.com/rust-lang/compiler-team/issues/482.

In particular it
- changes names to use `di_node` instead of `metadata`
- uniformly names all functions that build new debuginfo nodes `build_xyz_di_node`
- renames `CrateDebugContext` to `CodegenUnitDebugContext` (which is more accurate)
- removes outdated parts from `compiler/rustc_codegen_llvm/src/debuginfo/doc.md`
- moves `TypeMap` and functions that work directly work with it to a new `type_map` module
- moves enum related builder functions to a new `enums` module
- splits enum debuginfo building for the native and cpp-like cases, since they are mostly separate
- uses `SmallVec` instead of `Vec` in many places
- removes the old infrastructure for dealing with recursion cycles (`create_and_register_recursive_type_forward_declaration()`, `RecursiveTypeDescription`, `set_members_of_composite_type()`, `MemberDescription`, `MemberDescriptionFactory`, `prepare_xyz_metadata()`, etc)
- adds `type_map::build_type_with_children()` as a replacement for dealing with recursion cycles
- adds many (doc-)comments explaining what's going on
- changes cpp-like naming for C-Style enums so they don't get a `enum$<...>` name (because the NatVis visualizer does not apply to them)
- fixes detection of what is a C-style enum because some enums where classified as C-style even though they have fields
- changes cpp-like naming for generator enums so that NatVis works for them
- changes the position of discriminant debuginfo node so it is consistently nested inside the top-level union instead of, sometimes, next to it

The following could be done in subsequent PRs:
- add caching for `closure_saved_names_of_captured_variables`
- add caching for `generator_layout_and_saved_local_names`
- fix inconsistent handling of what is considered a C-style enum wrt to debuginfo
- rename `metadata` module to `types`
- move common generator fields to front instead of appending them

This PR is based on https://github.com/rust-lang/rust/pull/93644 which is not merged yet.

Right now, the changes are all done in one big commit. They could be split into smaller commits but hopefully the list of changes above makes it tractable to review them as a single commit too.

For now: r? `@ghost` (let's see if this affects compile times)

2 years agodebuginfo: Refactor debuginfo generation for types -- Make generator-objects test...
Michael Woerister [Tue, 15 Mar 2022 10:45:51 +0000 (11:45 +0100)]
debuginfo: Refactor debuginfo generation for types -- Make generator-objects test case architecture independent.

2 years agouse `format_args_capture` in some parts of rustc_parse
Takayuki Maeda [Tue, 15 Mar 2022 10:13:56 +0000 (19:13 +0900)]
use `format_args_capture` in some parts of rustc_parse

2 years agoAuto merge of #94938 - lnicola:rust-analyzer-2022-03-14, r=lnicola
bors [Tue, 15 Mar 2022 07:23:50 +0000 (07:23 +0000)]
Auto merge of #94938 - lnicola:rust-analyzer-2022-03-14, r=lnicola

:arrow_up: rust-analyzer

r? `@ghost`

2 years agoAuto merge of #94584 - pnkfelix:inject-use-suggestion-sites, r=ekuber
bors [Tue, 15 Mar 2022 03:56:33 +0000 (03:56 +0000)]
Auto merge of #94584 - pnkfelix:inject-use-suggestion-sites, r=ekuber

More robust fallback for `use` suggestion

Our old way to suggest where to add `use`s would first look for pre-existing `use`s in the relevant crate/module, and if there are *no* uses, it would fallback on trying to use another item as the basis for the suggestion.

But this was fragile, as illustrated in issue #87613

This PR instead identifies span of the first token after any inner attributes, and uses *that* as the fallback for the `use` suggestion.

Fix #87613

2 years agoAuto merge of #92285 - compiler-errors:dyn-proj-bounds, r=nikomatsakis
bors [Tue, 15 Mar 2022 01:31:42 +0000 (01:31 +0000)]
Auto merge of #92285 - compiler-errors:dyn-proj-bounds, r=nikomatsakis

check ~Projection~ all supertrait bounds when confirming dyn candidate

I'm pretty sure Projection is the only other PredicateKind that we care about enforcing here.

Fixes #80800

2 years agofix typos
Dylan DPC [Tue, 15 Mar 2022 01:00:08 +0000 (02:00 +0100)]
fix typos

2 years agocheck all dyn obligations, actually
Michael Goulet [Tue, 1 Feb 2022 03:11:23 +0000 (19:11 -0800)]
check all dyn obligations, actually

2 years agoStabilize ADX target feature
Tony Arcieri [Mon, 7 Feb 2022 19:22:21 +0000 (12:22 -0700)]
Stabilize ADX target feature

This is a continuation of #60109, which noted that while the ADX
intrinsics were stabilized, the corresponding target feature never was.

This PR follows the same general structure and stabilizes the ADX target
feature.

2 years agocheck Projection supertrait bounds when confirming dyn candidate
Michael Goulet [Sun, 26 Dec 2021 06:45:05 +0000 (22:45 -0800)]
check Projection supertrait bounds when confirming dyn candidate

2 years agoAuto merge of #94935 - matthiaskrgr:rollup-2o2kyz6, r=matthiaskrgr
bors [Mon, 14 Mar 2022 21:51:31 +0000 (21:51 +0000)]
Auto merge of #94935 - matthiaskrgr:rollup-2o2kyz6, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #90621 (Stabilise `aarch64_target_feature`)
 - #93977 (Type params and assoc types have unit metadata if they are sized)
 - #94670 (Improve `expect` impl and handle `#[expect(unfulfilled_lint_expectations)]` (RFC 2383))
 - #94884 (Fix remaining meta-variable expression TODOs)
 - #94931 (update miri)

Failed merges:

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

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Mon, 14 Mar 2022 17:04:16 +0000 (19:04 +0200)]
:arrow_up: rust-analyzer

2 years agodebuginfo: Refactor debuginfo generation for types -- Rename DebugInfoMethods::create...
Michael Woerister [Mon, 14 Mar 2022 16:18:30 +0000 (17:18 +0100)]
debuginfo: Refactor debuginfo generation for types -- Rename DebugInfoMethods::create_vtable_metadata() to DebugInfoMethods::create_vtable_debuginfo()

2 years agodebuginfo: Refactor debuginfo generation for types -- Address review comments.
Michael Woerister [Mon, 14 Mar 2022 16:11:58 +0000 (17:11 +0100)]
debuginfo: Refactor debuginfo generation for types -- Address review comments.

2 years agoRollup merge of #94931 - RalfJung:miri, r=RalfJung
Matthias Krüger [Mon, 14 Mar 2022 16:25:00 +0000 (17:25 +0100)]
Rollup merge of #94931 - RalfJung:miri, r=RalfJung

update miri

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

2 years agoRollup merge of #94884 - c410-f3r:meta-take-2, r=petrochenkov
Matthias Krüger [Mon, 14 Mar 2022 16:24:59 +0000 (17:24 +0100)]
Rollup merge of #94884 - c410-f3r:meta-take-2, r=petrochenkov

Fix remaining meta-variable expression TODOs

As promised on https://github.com/rust-lang/rust/pull/93545.

cc #83527
cc `@mark-i-m`
cc `@petrochenkov`

2 years agoRollup merge of #94670 - xFrednet:rfc-2383-expect-impl-after-party, r=flip1995,wesley...
Matthias Krüger [Mon, 14 Mar 2022 16:24:58 +0000 (17:24 +0100)]
Rollup merge of #94670 - xFrednet:rfc-2383-expect-impl-after-party, r=flip1995,wesleywiser

Improve `expect` impl and handle `#[expect(unfulfilled_lint_expectations)]` (RFC 2383)

This PR updates unstable `ExpectationIds` in stashed diagnostics and adds some asserts to ensure that the stored expectations are really empty in the end. Additionally, it handles the `#[expect(unfulfilled_lint_expectations)]` case.

According to the [Errors and lints docs](https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-levels) the `error` level should only be used _"when the compiler detects a problem that makes it unable to compile the program"_. As this isn't the case with `#[expect(unfulfilled_lint_expectations)]` I decided to only create a warning. To avoid adding a new lint only for this case, I simply emit a `unfulfilled_lint_expectations` diagnostic with an additional note.

---

r? `@wesleywiser` I'm requesting a review from you since you reviewed the previous PR https://github.com/rust-lang/rust/pull/87835. You are welcome to reassign it if you're busy :upside_down_face:

rfc: [RFC-2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html)

tracking issue: https://github.com/rust-lang/rust/issues/85549

cc: `@flip1995` In case you're also interested in this :)

2 years agoRollup merge of #93977 - compiler-errors:sized-generic-metadata, r=wesleywiser
Matthias Krüger [Mon, 14 Mar 2022 16:24:57 +0000 (17:24 +0100)]
Rollup merge of #93977 - compiler-errors:sized-generic-metadata, r=wesleywiser

Type params and assoc types have unit metadata if they are sized

Extend the logic in `Pointee` projection to ensure that we can satisfy `<T as Pointee>::Metadata = ()` if `T: Sized`.

cc: `@SimonSapin` and #93959

2 years agoRollup merge of #90621 - adamgemmell:dev/stabilise-target-feature, r=Amanieu
Matthias Krüger [Mon, 14 Mar 2022 16:24:56 +0000 (17:24 +0100)]
Rollup merge of #90621 - adamgemmell:dev/stabilise-target-feature, r=Amanieu

Stabilise `aarch64_target_feature`

This PR stabilises `aarch64_target_feature` - see https://github.com/rust-lang/rust/issues/90620

2 years agoAuto merge of #94929 - flip1995:clippyup, r=Manishearth
bors [Mon, 14 Mar 2022 16:24:12 +0000 (16:24 +0000)]
Auto merge of #94929 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

A few days delayed, because I recovered from a cold last week and couldn't get myself to do the sync, sorry. :upside_down_face:

2 years agodebuginfo: Refactor debuginfo generation for types -- Address outstanding FIXMEs.
Michael Woerister [Thu, 3 Mar 2022 13:43:17 +0000 (14:43 +0100)]
debuginfo: Refactor debuginfo generation for types -- Address outstanding FIXMEs.

2 years agodebuginfo: Refactor debuginfo generation for types -- Run x.py fmt
Michael Woerister [Thu, 3 Mar 2022 11:45:35 +0000 (12:45 +0100)]
debuginfo: Refactor debuginfo generation for types -- Run x.py fmt

2 years agoRemove out-dated information from rustc_codegen_llvm/src/debuginfo/doc.md
Michael Woerister [Thu, 3 Mar 2022 11:35:55 +0000 (12:35 +0100)]
Remove out-dated information from rustc_codegen_llvm/src/debuginfo/doc.md

2 years agocompiletest: Don't update PDB files of test cases in-place.
Michael Woerister [Thu, 3 Mar 2022 11:34:38 +0000 (12:34 +0100)]
compiletest: Don't update PDB files of test cases in-place.

2 years agodebuginfo: change cpp-like naming for generator environments so that NatVis works...
Michael Woerister [Thu, 3 Mar 2022 11:10:02 +0000 (12:10 +0100)]
debuginfo: change cpp-like naming for generator environments so that NatVis works for them

2 years agodebuginfo: Refactor debuginfo generation for types
Michael Woerister [Thu, 3 Mar 2022 10:15:25 +0000 (11:15 +0100)]
debuginfo: Refactor debuginfo generation for types

This commit
- changes names to use di_node instead of metadata
- uniformly names all functions that build new debuginfo nodes build_xyz_di_node
- renames CrateDebugContext to CodegenUnitDebugContext (which is more accurate)
- moves TypeMap and functions that work directly work with it to a new type_map module
- moves and reimplements enum related builder functions to a new enums module
- splits enum debuginfo building for the native and cpp-like cases, since they are mostly separate
- uses SmallVec instead of Vec in many places
- removes the old infrastructure for dealing with recursion cycles (create_and_register_recursive_type_forward_declaration(), RecursiveTypeDescription, set_members_of_composite_type(), MemberDescription, MemberDescriptionFactory, prepare_xyz_metadata(), etc)
- adds type_map::build_type_with_children() as a replacement for dealing with recursion cycles
- adds many (doc-)comments explaining what's going on
- changes cpp-like naming for C-Style enums so they don't get a enum$<...> name (because the NatVis visualizer does not apply to them)
- fixes detection of what is a C-style enum because some enums where classified as C-style even though they have fields
- changes the position of discriminant debuginfo node so it is consistently nested inside the top-level union instead of, sometimes, next to it

2 years agoupdate miri
Ralf Jung [Mon, 14 Mar 2022 13:52:47 +0000 (09:52 -0400)]
update miri

2 years agoAuto merge of #93749 - ridwanabdillahi:riscv32im_support, r=wesleywiser
bors [Mon, 14 Mar 2022 13:43:20 +0000 (13:43 +0000)]
Auto merge of #93749 - ridwanabdillahi:riscv32im_support, r=wesleywiser

Add riscv32im-unknown-none-elf built-in target triple.

* Add built-in target `riscv32im-unknown-none-elf`.
* Update `platform-support.md` to list it as a Tier 3 target.

Below are details on how this target meets the requirements for tier 3:

> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

I would be willing to be a target maintainer, though I would appreciate if others with more experience around RISC-V volunteered to help with that as well.

> Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target.

Uses the same naming as the LLVM target, and the same convention as many other bare-metal targets.

> Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it.

I don't believe there is any ambiguity here.

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

I don't see any legal issues here.

> The target must not introduce license incompatibilities.
> Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).
> The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements.
> If the target supports building host tools (such as rustc or cargo), those host tools must not depend on proprietary (non-FOSS) libraries, other than ordinary runtime libraries supplied by the platform and commonly used by other binaries built for the target. For instance, rustc built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3.
> Targets should not require proprietary (non-FOSS) components to link a functional binary or library.
> "onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms include but are not limited to: non-disclosure requirements, non-compete requirements, contributor license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional on the employer or employment of any particular Rust developers, revocable terms, any requirements that create liability for the Rust project or its developers or users, or any requirements that adversely affect the livelihood or prospects of the Rust project or its developers or users.

I see no issues with any of the above.

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.
> This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements.

Only relevant to those making approval decisions.

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

`core` and `alloc` can be used. `std` cannot be used as this is a bare-metal target.

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running tests (even if they do not pass), the documentation must explain how to run tests for the target, using emulation if possible or dedicated hardware if necessary.

Use `--target=x86_64-unknown-none-elf` option to cross compile, just like any target. The target does not support running tests.

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via `@)` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.
> Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications.

I don't foresee this being a problem.

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.
> In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target.

No other targets should be affected by the pull request.