]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoDiagnose shadowing on AST.
Camille GILLOT [Sat, 4 Dec 2021 20:20:58 +0000 (21:20 +0100)]
Diagnose shadowing on AST.

2 years agoAuto merge of #97293 - est31:remove_box, r=oli-obk
bors [Thu, 2 Jun 2022 13:20:19 +0000 (13:20 +0000)]
Auto merge of #97293 - est31:remove_box, r=oli-obk

Add #[rustc_box] and use it inside alloc

This commit adds an alternative content boxing syntax, and uses it inside alloc.

```Rust
#![feature(box_syntax)]

fn foo() {
    let foo = box bar;
}
```

is equivalent to

```Rust
#![feature(rustc_attrs)]

fn foo() {
    let foo = #[rustc_box] Box::new(bar);
}
```

The usage inside the very performance relevant code in
liballoc is the only remaining relevant usage of box syntax
in the compiler (outside of tests, which are comparatively easy to port).

box syntax was originally designed to be used by all Rust
developers. This introduces a replacement syntax more tailored
to only being used inside the Rust compiler, and with it,
lays the groundwork for eventually removing box syntax.

[Earlier work](https://github.com/rust-lang/rust/pull/87781#issuecomment-894714878) by `@nbdd0121` to lower `Box::new` to `box` during THIR -> MIR building ran into borrow checker problems, requiring the lowering to be adjusted in a way that led to [performance regressions](https://github.com/rust-lang/rust/pull/87781#issuecomment-894872367). The proposed change in this PR lowers `#[rustc_box] Box::new` -> `box` in the AST -> HIR lowering step, which is way earlier in the compiler, and thus should cause less issues both performance wise as well as regarding type inference/borrow checking/etc. Hopefully, future work can move the lowering further back in the compiler, as long as there are no performance regressions.

2 years agoAuto merge of #97644 - Dylan-DPC:rollup-xaeio91, r=Dylan-DPC
bors [Thu, 2 Jun 2022 10:39:24 +0000 (10:39 +0000)]
Auto merge of #97644 - Dylan-DPC:rollup-xaeio91, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #96894 (Apply track_caller to closure on `expect_non_local()`)
 - #97023 (Diagnose anonymous lifetimes errors more uniformly between async and regular fns)
 - #97397 (Stabilize `box_into_pin`)
 - #97587 (Migrate more diagnostics to use the `#[derive(SessionDiagnostic)]`)
 - #97603 (Arc make_mut doc comment spelling correction.)
 - #97635 (Fix file metadata documentation for Windows)

Failed merges:

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

2 years agoRollup merge of #97635 - rgwood:patch-1, r=ChrisDenton
Dylan DPC [Thu, 2 Jun 2022 09:13:26 +0000 (11:13 +0200)]
Rollup merge of #97635 - rgwood:patch-1, r=ChrisDenton

Fix file metadata documentation for Windows

I noticed that the documentation for `fs::symlink_metadata()` and `fs::metadata()` is incorrect; [the underlying code](https://github.com/rust-lang/rust/blob/481db40311cdd241ae4d33f34f2f75732e44d8e8/library/std/src/sys/windows/fs.rs#L334) calls [`GetFileInformationByHandle()`](https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfileinformationbyhandle) on Windows, not [`GetFileAttributesEx()`](https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfileattributesexw). There are currently [no uses of `GetFileAttributesEx()` in this repo](https://github.com/rust-lang/rust/search?q=GetFileAttributesEx).

2 years agoRollup merge of #97603 - ximon18:arc-make-mut-spelling-correction, r=GuillaumeGomez
Dylan DPC [Thu, 2 Jun 2022 09:13:25 +0000 (11:13 +0200)]
Rollup merge of #97603 - ximon18:arc-make-mut-spelling-correction, r=GuillaumeGomez

Arc make_mut doc comment spelling correction.

2 years agoRollup merge of #97587 - pvdrz:maybe-recover-from-bad-qpath-stage-2, r=davidtwco
Dylan DPC [Thu, 2 Jun 2022 09:13:24 +0000 (11:13 +0200)]
Rollup merge of #97587 - pvdrz:maybe-recover-from-bad-qpath-stage-2, r=davidtwco

Migrate more diagnostics to use the `#[derive(SessionDiagnostic)]`

r? ``@davidtwco``

2 years agoRollup merge of #97397 - JohnTitor:stabilize-box-into-pin, r=Mark-Simulacrum
Dylan DPC [Thu, 2 Jun 2022 09:13:23 +0000 (11:13 +0200)]
Rollup merge of #97397 - JohnTitor:stabilize-box-into-pin, r=Mark-Simulacrum

Stabilize `box_into_pin`

FCP has been completed: https://github.com/rust-lang/rust/issues/62370#issuecomment-1012162279
Also, adds notes as per https://github.com/rust-lang/rust/issues/62370#issuecomment-1004108116
Closes #62370

2 years agoRollup merge of #97023 - cjgillot:uniform-anon, r=estebank
Dylan DPC [Thu, 2 Jun 2022 09:13:22 +0000 (11:13 +0200)]
Rollup merge of #97023 - cjgillot:uniform-anon, r=estebank

Diagnose anonymous lifetimes errors more uniformly between async and regular fns

Async fns and regular fns are desugared differently.  For the former, we create a generic parameter at HIR level.  For the latter, we just create an anonymous region for typeck.

I plan to migrate regular fns to the async fn desugaring.

Before that, this PR attempts to merge the diagnostics for both cases.

r? ```@estebank```

2 years agoRollup merge of #96894 - JohnTitor:expect-non-local-track-caller, r=petrochenkov
Dylan DPC [Thu, 2 Jun 2022 09:13:21 +0000 (11:13 +0200)]
Rollup merge of #96894 - JohnTitor:expect-non-local-track-caller, r=petrochenkov

Apply track_caller to closure on `expect_non_local()`

r? `@petrochenkov`

Alternatively we could remove the closure by replicating the same logic of `map_id()`. I'm happy to switch to it if you'd like.

2 years agoAuto merge of #96737 - ChrisDenton:win-manifest, r=wesleywiser
bors [Thu, 2 Jun 2022 07:58:29 +0000 (07:58 +0000)]
Auto merge of #96737 - ChrisDenton:win-manifest, r=wesleywiser

Add Windows application manifest to rustc-main

Windows allows setting some runtime options using a manifest file. The format of the XML file is documented here: https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests

The manifest file in this PR does three things:

* Declares which Windows versions we support. This may help avoid unnecessary compatibility shims.
* Uses the UTF-8 code page. While Rust itself uses UTF-16 APIs, other code may rely on the code page.
* Makes the application long path aware (if also enabled by the user). This allows for the current directory to be longer than `PATH_MAX`.

These changes only affect the `rustc` process and not any other DLLs or compiled programs.

2 years agoAuto merge of #97414 - LYF1999:yf/cachealign, r=Mark-Simulacrum
bors [Thu, 2 Jun 2022 04:14:02 +0000 (04:14 +0000)]
Auto merge of #97414 - LYF1999:yf/cachealign, r=Mark-Simulacrum

use 128 cache align for aarch64

the cache line size of m1 mac is 128.
so use `align(128)` for m1 mac

here is `sysctl -a hw machdep.cpu` output on m1 mac
```
hw.ncpu: 10
hw.byteorder: 1234
hw.memsize: 68719476736
hw.activecpu: 10
hw.perflevel0.physicalcpu: 8
hw.perflevel0.physicalcpu_max: 8
hw.perflevel0.logicalcpu: 8
hw.perflevel0.logicalcpu_max: 8
hw.perflevel0.l1icachesize: 196608
hw.perflevel0.l1dcachesize: 131072
hw.perflevel0.l2cachesize: 12582912
hw.perflevel0.cpusperl2: 4
hw.perflevel1.physicalcpu: 2
hw.perflevel1.physicalcpu_max: 2
hw.perflevel1.logicalcpu: 2
hw.perflevel1.logicalcpu_max: 2
hw.perflevel1.l1icachesize: 131072
hw.perflevel1.l1dcachesize: 65536
hw.perflevel1.l2cachesize: 4194304
hw.perflevel1.cpusperl2: 2
hw.optional.arm.FEAT_FlagM: 1
hw.optional.arm.FEAT_FlagM2: 1
hw.optional.arm.FEAT_FHM: 1
hw.optional.arm.FEAT_DotProd: 1
hw.optional.arm.FEAT_SHA3: 1
hw.optional.arm.FEAT_RDM: 1
hw.optional.arm.FEAT_LSE: 1
hw.optional.arm.FEAT_SHA256: 1
hw.optional.arm.FEAT_SHA512: 1
hw.optional.arm.FEAT_SHA1: 1
hw.optional.arm.FEAT_AES: 1
hw.optional.arm.FEAT_PMULL: 1
hw.optional.arm.FEAT_SPECRES: 0
hw.optional.arm.FEAT_SB: 1
hw.optional.arm.FEAT_FRINTTS: 1
hw.optional.arm.FEAT_LRCPC: 1
hw.optional.arm.FEAT_LRCPC2: 1
hw.optional.arm.FEAT_FCMA: 1
hw.optional.arm.FEAT_JSCVT: 1
hw.optional.arm.FEAT_PAuth: 1
hw.optional.arm.FEAT_PAuth2: 0
hw.optional.arm.FEAT_FPAC: 0
hw.optional.arm.FEAT_DPB: 1
hw.optional.arm.FEAT_DPB2: 1
hw.optional.arm.FEAT_BF16: 0
hw.optional.arm.FEAT_I8MM: 0
hw.optional.arm.FEAT_ECV: 1
hw.optional.arm.FEAT_LSE2: 1
hw.optional.arm.FEAT_CSV2: 1
hw.optional.arm.FEAT_CSV3: 1
hw.optional.arm.FEAT_FP16: 1
hw.optional.arm.FEAT_SSBS: 1
hw.optional.arm.FEAT_BTI: 0
hw.optional.floatingpoint: 1
hw.optional.neon: 1
hw.optional.neon_hpfp: 1
hw.optional.neon_fp16: 1
hw.optional.armv8_1_atomics: 1
hw.optional.armv8_2_fhm: 1
hw.optional.armv8_2_sha512: 1
hw.optional.armv8_2_sha3: 1
hw.optional.armv8_3_compnum: 1
hw.optional.watchpoint: 4
hw.optional.breakpoint: 6
hw.optional.armv8_crc32: 1
hw.optional.armv8_gpi: 1
hw.optional.AdvSIMD: 1
hw.optional.AdvSIMD_HPFPCvt: 1
hw.optional.ucnormal_mem: 1
hw.optional.arm64: 1
hw.features.allows_security_research: 0
hw.physicalcpu: 10
hw.physicalcpu_max: 10
hw.logicalcpu: 10
hw.logicalcpu_max: 10
hw.cputype: 16777228
hw.cpusubtype: 2
hw.cpu64bit_capable: 1
hw.cpufamily: 458787763
hw.cpusubfamily: 5
hw.cacheconfig: 10 1 2 0 0 0 0 0 0 0
hw.cachesize: 3373957120 65536 4194304 0 0 0 0 0 0 0
hw.pagesize: 16384
hw.pagesize32: 16384
hw.cachelinesize: 128
hw.l1icachesize: 131072
hw.l1dcachesize: 65536
hw.l2cachesize: 4194304
hw.tbfrequency: 24000000
hw.packages: 1
hw.osenvironment:
hw.ephemeral_storage: 0
hw.use_recovery_securityd: 0
hw.use_kernelmanagerd: 1
hw.serialdebugmode: 0
hw.nperflevels: 2
hw.targettype: J316c
machdep.cpu.cores_per_package: 10
machdep.cpu.core_count: 10
machdep.cpu.logical_per_package: 10
machdep.cpu.thread_count: 10
machdep.cpu.brand_string: Apple M1 Max
```

2 years agoFix Windows file metadata docs
Reilly Wood [Thu, 2 Jun 2022 00:32:33 +0000 (20:32 -0400)]
Fix Windows file metadata docs

Retrieving file metadata on Windows now uses GetFileInformationByHandle not GetFileAttributesEx

2 years agoAuto merge of #97632 - JohnTitor:rollup-d2ucrjw, r=JohnTitor
bors [Wed, 1 Jun 2022 22:34:38 +0000 (22:34 +0000)]
Auto merge of #97632 - JohnTitor:rollup-d2ucrjw, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #95594 (Additional `*mut [T]` methods)
 - #97130 (rustdoc: avoid including impl blocks with filled-in generics)
 - #97166 (Move conditions out of recover/report functions.)
 - #97605 (Mention filename in suggestion when it differs from primary span)
 - #97613 (rustdoc: Improve calculation of "Impls on Foreign Types")
 - #97626 (rename PointerAddress → PointerExposeAddress)

Failed merges:

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

2 years agoStabilize `box_into_pin`
Yuki Okushi [Wed, 25 May 2022 12:45:35 +0000 (21:45 +0900)]
Stabilize `box_into_pin`

2 years agoRollup merge of #97626 - RalfJung:expose, r=tmiasko
Yuki Okushi [Wed, 1 Jun 2022 21:44:29 +0000 (06:44 +0900)]
Rollup merge of #97626 - RalfJung:expose, r=tmiasko

rename PointerAddress → PointerExposeAddress

`PointerAddress` sounds a bit too much like `ptr.addr()`, but this corresponds to `ptr.expose_addr()`.

r? `@tmiasko`

2 years agoRollup merge of #97613 - jsha:implementation-is-on-local-type, r=GuillaumeGomez
Yuki Okushi [Wed, 1 Jun 2022 21:44:29 +0000 (06:44 +0900)]
Rollup merge of #97613 - jsha:implementation-is-on-local-type, r=GuillaumeGomez

rustdoc: Improve calculation of "Impls on Foreign Types"

The existing code to calculate whether an implementation was on a "Foreign Type" was duplicated across the sidebar generation and the page generation. It also came to the wrong conclusion for some cases where both the trait and the "for" type were re-exports.

This PR extracts the logic into a method of `Impl`, breaks it into a multi-line method so it can be commented, and adds a case for when the trait and the "for" type came from the same crate. This fixes some cases - like the platform-specific integer types (`__m256`, `__m128`, etc). But it doesn't fix all cases. See the screenshots below.

[Before](https://doc.rust-lang.org/nightly/std/clone/trait.Clone.html#foreign-impls):

<img src="https://user-images.githubusercontent.com/220205/171338226-59ce6daf-3d76-4bad-bc8d-72a8259a8f43.png" width=200>

[After](https://rustdoc.crud.net/jsha/implementation-is-on-local-type/std/clone/trait.Clone.html):

<img src="https://user-images.githubusercontent.com/220205/171338147-28308a65-1597-4223-be47-9550062404dd.png" width=200>

The remaining types (`CString`, `NulError`, etc) are all from the `alloc` crate, while the `Clone` trait is from the `core` crate. Since `CString` and `Clone` are both re-exported by `std`, they are logically local to each other, but I couldn't figure out a good way to detect that in this code. I figure this is still a good step forward.

Related: #97610

r? `@camelid`

2 years agoRollup merge of #97605 - estebank:suggestion-filename, r=oli-obk
Yuki Okushi [Wed, 1 Jun 2022 21:44:28 +0000 (06:44 +0900)]
Rollup merge of #97605 - estebank:suggestion-filename, r=oli-obk

Mention filename in suggestion when it differs from primary span

2 years agoRollup merge of #97166 - nnethercote:move-conditions-out, r=estebank
Yuki Okushi [Wed, 1 Jun 2022 21:44:27 +0000 (06:44 +0900)]
Rollup merge of #97166 - nnethercote:move-conditions-out, r=estebank

Move conditions out of recover/report functions.

`Parser` has six recover/report functions that are passed a boolean, and
nothing is done if the boolean has a particular value.

This PR moves the tests outside the functions. This has the following effects.
- The number of lines of code goes down.
- Some `use` items become shorter.
- Avoids the strangeness whereby 11 out of 12 calls to
  `maybe_recover_from_bad_qpath` pass `true` as the second argument.
- Makes it clear at the call site that only one of
  `maybe_recover_from_bad_type_plus` and `maybe_report_ambiguous_plus` will be
  run.

r? `@estebank`

2 years agoRollup merge of #97130 - notriddle:notriddle/collect-trait-impls-dup, r=GuillaumeGomez
Yuki Okushi [Wed, 1 Jun 2022 21:44:26 +0000 (06:44 +0900)]
Rollup merge of #97130 - notriddle:notriddle/collect-trait-impls-dup, r=GuillaumeGomez

rustdoc: avoid including impl blocks with filled-in generics

Fixes #94937

# Before

![image](https://user-images.githubusercontent.com/1593513/168933282-02ccc4ae-9c89-4836-ba34-e2bd83946105.png)

# After

![image](https://user-images.githubusercontent.com/1593513/168933255-4c17407d-d8d1-406e-87f5-9ea809437173.png)

2 years agoRollup merge of #95594 - the8472:raw_slice_methods, r=yaahc
Yuki Okushi [Wed, 1 Jun 2022 21:44:25 +0000 (06:44 +0900)]
Rollup merge of #95594 - the8472:raw_slice_methods, r=yaahc

Additional `*mut [T]` methods

Split out from #94247

This adds the following methods to raw slices that already exist on regular slices

* `*mut [T]::is_empty`
* `*mut [T]::split_at_mut`
* `*mut [T]::split_at_mut_unchecked`

These methods reduce the amount of unsafe code needed to migrate `ChunksMut` and related iterators
to raw slices (#94247)

r? `@m-ou-se`

2 years agoAuto merge of #97612 - ehuss:update-cargo, r=ehuss
bors [Wed, 1 Jun 2022 20:06:14 +0000 (20:06 +0000)]
Auto merge of #97612 - ehuss:update-cargo, r=ehuss

Update cargo

5 commits in 39ad1039d9e3e1746177bf5d134af4c164f95528..38472bc19f2f76e245eba54a6e97ee6821b3c1db
2022-05-25 00:50:02 +0000 to 2022-05-31 02:03:24 +0000
- Emit warning upon encountering multiple packages with the same name (rust-lang/cargo#10701)
- Guide new users to add use `super::*;` to `mod test` (rust-lang/cargo#10706)
- Document how to debug change detection events (rust-lang/cargo#10708)
- fix(publish): add more check when use `publish -p &lt;SPEC&gt;` (rust-lang/cargo#10677)
- fix key formatting when switching to a dotted `WorkspaceSource` (rust-lang/cargo#10705)

2 years agorename PointerAddress → PointerExposeAddress
Ralf Jung [Wed, 1 Jun 2022 17:24:44 +0000 (13:24 -0400)]
rename PointerAddress → PointerExposeAddress

2 years agorustdoc: add test case for auto traits on slice primitive
Michael Howell [Wed, 1 Jun 2022 18:00:25 +0000 (11:00 -0700)]
rustdoc: add test case for auto traits on slice primitive

2 years agoAuto merge of #97624 - matthiaskrgr:rollup-rtcqjx9, r=matthiaskrgr
bors [Wed, 1 Jun 2022 17:25:29 +0000 (17:25 +0000)]
Auto merge of #97624 - matthiaskrgr:rollup-rtcqjx9, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #96271 (suggest `?` when method is missing on `Result<T, _>` but found on `T`)
 - #97264 (Suggest `extern crate foo` when failing to resolve `use foo`)
 - #97592 (rustdoc: also index impl trait and raw pointers)
 - #97621 (update Miri)

Failed merges:

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

2 years agoUpdate src/librustdoc/passes/collect_trait_impls.rs
Michael Howell [Wed, 1 Jun 2022 15:40:19 +0000 (08:40 -0700)]
Update src/librustdoc/passes/collect_trait_impls.rs

Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2 years agoMention filename in suggestion when it differs from primary span
Esteban Küber [Tue, 31 May 2022 23:38:03 +0000 (16:38 -0700)]
Mention filename in suggestion when it differs from primary span

2 years agoImprove calculation of "Impls on Foreign Types"
Jacob Hoffman-Andrews [Tue, 31 May 2022 05:53:59 +0000 (22:53 -0700)]
Improve calculation of "Impls on Foreign Types"

2 years agoRollup merge of #97621 - RalfJung:miri, r=RalfJung
Matthias Krüger [Wed, 1 Jun 2022 15:11:07 +0000 (17:11 +0200)]
Rollup merge of #97621 - RalfJung:miri, r=RalfJung

update Miri

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

2 years agoRollup merge of #97592 - notriddle:notriddle/impl-trait, r=GuillaumeGomez
Matthias Krüger [Wed, 1 Jun 2022 15:11:06 +0000 (17:11 +0200)]
Rollup merge of #97592 - notriddle:notriddle/impl-trait, r=GuillaumeGomez

rustdoc: also index impl trait and raw pointers

Revives #92339

2 years agoRollup merge of #97264 - TaKO8Ki:suggest-extern-crate-when-failing-to-resolve-use...
Matthias Krüger [Wed, 1 Jun 2022 15:11:05 +0000 (17:11 +0200)]
Rollup merge of #97264 - TaKO8Ki:suggest-extern-crate-when-failing-to-resolve-use-crate, r=estebank

Suggest `extern crate foo` when failing to resolve `use foo`

closes #97095

r? ``@estebank``

2 years agoRollup merge of #96271 - compiler-errors:suggest-question-mark, r=estebank
Matthias Krüger [Wed, 1 Jun 2022 15:11:04 +0000 (17:11 +0200)]
Rollup merge of #96271 - compiler-errors:suggest-question-mark, r=estebank

suggest `?` when method is missing on `Result<T, _>` but found on `T`

The wording needs help, I think.

Fixes #95729

2 years agoAuto merge of #97622 - JohnTitor:rollup-4qoxrjn, r=JohnTitor
bors [Wed, 1 Jun 2022 14:44:20 +0000 (14:44 +0000)]
Auto merge of #97622 - JohnTitor:rollup-4qoxrjn, r=JohnTitor

Rollup of 9 pull requests

Successful merges:

 - #94647 (Expose `get_many_mut` and `get_many_unchecked_mut` to HashMap)
 - #97216 (Ensure we never consider the null pointer dereferencable)
 - #97399 (simplify code of finding arg index in `opt_const_param_of`)
 - #97470 (rustdoc: add more test coverage)
 - #97498 (Corrected EBNF grammar for from_str)
 - #97562 (Fix comment in `poly_project_and_unify_type`)
 - #97580 (Add regression test for #71546)
 - #97611 (Tweak insert docs)
 - #97616 (Remove an unnecessary `Option`)

Failed merges:

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

2 years agoRollup merge of #97616 - TaKO8Ki:remove-unnecessary-option, r=Dylan-DPC
Yuki Okushi [Wed, 1 Jun 2022 14:36:53 +0000 (23:36 +0900)]
Rollup merge of #97616 - TaKO8Ki:remove-unnecessary-option, r=Dylan-DPC

Remove an unnecessary `Option`

2 years agoRollup merge of #97611 - azdavis:master, r=Dylan-DPC
Yuki Okushi [Wed, 1 Jun 2022 14:36:52 +0000 (23:36 +0900)]
Rollup merge of #97611 - azdavis:master, r=Dylan-DPC

Tweak insert docs

For `{Hash, BTree}Map::insert`, I always have to take a few extra seconds to think about the slight weirdness about the fact that if we "did not" insert (which "sounds" false), we return true, and if we "did" insert, (which "sounds" true), we return false.

This tweaks the doc comments for the `insert` methods of those types (as well as what looks like a rustc internal data structure that I found just by searching the codebase for "If the set did") to first use the "Returns whether _something_" pattern used in e.g. `remove`, where we say that `remove` "returns whether the value was present".

2 years agoRollup merge of #97580 - JohnTitor:issue-71546, r=compiler-errors
Yuki Okushi [Wed, 1 Jun 2022 14:36:51 +0000 (23:36 +0900)]
Rollup merge of #97580 - JohnTitor:issue-71546, r=compiler-errors

Add regression test for #71546

Closes #71546
r? `@compiler-errors`

2 years agoRollup merge of #97562 - compiler-errors:comment-poly_project_and_unify_type, r=lcnr
Yuki Okushi [Wed, 1 Jun 2022 14:36:50 +0000 (23:36 +0900)]
Rollup merge of #97562 - compiler-errors:comment-poly_project_and_unify_type, r=lcnr

Fix comment in `poly_project_and_unify_type`

Renamed some variants to match `ProjectAndUnifyResult`

2 years agoRollup merge of #97498 - ijchen:master, r=Mark-Simulacrum
Yuki Okushi [Wed, 1 Jun 2022 14:36:49 +0000 (23:36 +0900)]
Rollup merge of #97498 - ijchen:master, r=Mark-Simulacrum

Corrected EBNF grammar for from_str

Hello! This is my first time contributing to an open-source project. I'm excited to have the chance to contribute to the rust community 🥳

I noticed an issue with the documentation for `from_str` in `f32` and `f64`. It states that "All strings that adhere to the following [EBNF](https://www.w3.org/TR/REC-xml/#sec-notation) grammar when lowercased will result in an `Ok` being returned. I believe this is incorrect for the string `"."`, which is valid for the given EBNF grammar, but does not result in an `Ok` being returned ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=09f891aa87963a56d3b0d715d8cbc2b4)). I have simplified the grammar in a way which fixes that, but is otherwise identical.

Previously, the `Number` part of the EBNF grammar had an option for `'.' Digit*`, which would include the string `"."`. This is not valid, and does not return an Ok as stated. The corrected version removes this, and still allows for the `'.' Digit+` case with the already existing `Digit* '.' Digit+` case.

2 years agoRollup merge of #97470 - notriddle:notriddle/test-cases, r=GuillaumeGomez
Yuki Okushi [Wed, 1 Jun 2022 14:36:48 +0000 (23:36 +0900)]
Rollup merge of #97470 - notriddle:notriddle/test-cases, r=GuillaumeGomez

rustdoc: add more test coverage

https://github.com/rust-lang/rust/issues/91113

2 years agoRollup merge of #97399 - SparrowLii:arg_index, r=oli-obk
Yuki Okushi [Wed, 1 Jun 2022 14:36:47 +0000 (23:36 +0900)]
Rollup merge of #97399 - SparrowLii:arg_index, r=oli-obk

simplify code of finding arg index in `opt_const_param_of`

From the FIXME in the impl of `opt_const_param_of`. Part of the code is simplified by blending two iterator statements and using `let...else` statement.

2 years agoRollup merge of #97216 - RalfJung:null-ptr-check, r=oli-obk
Yuki Okushi [Wed, 1 Jun 2022 14:36:46 +0000 (23:36 +0900)]
Rollup merge of #97216 - RalfJung:null-ptr-check, r=oli-obk

Ensure we never consider the null pointer dereferencable

This replaces the checks that are being removed in https://github.com/rust-lang/rust/pull/97188. Those checks were too early and hence incorrect.

2 years agoRollup merge of #94647 - Urgau:hash-map-many-mut, r=Amanieu
Yuki Okushi [Wed, 1 Jun 2022 14:36:45 +0000 (23:36 +0900)]
Rollup merge of #94647 - Urgau:hash-map-many-mut, r=Amanieu

Expose `get_many_mut` and `get_many_unchecked_mut` to HashMap

This pull-request expose the function [`get_many_mut`](https://docs.rs/hashbrown/0.12.0/hashbrown/struct.HashMap.html#method.get_many_mut) and [`get_many_unchecked_mut`](https://docs.rs/hashbrown/0.12.0/hashbrown/struct.HashMap.html#method.get_many_unchecked_mut) from `hashbrown` to the standard library `HashMap` type. They obviously keep the same API and are added under the (new) `map_many_mut` feature.

- `get_many_mut`: Attempts to get mutable references to `N` values in the map at once.
- `get_many_unchecked_mut`: Attempts to get mutable references to `N` values in the map at once, without validating that the values are unique.

2 years agoupdate Miri
Ralf Jung [Wed, 1 Jun 2022 13:26:26 +0000 (09:26 -0400)]
update Miri

2 years agorename `sp` to `span`
Christian Poveda [Wed, 1 Jun 2022 12:14:33 +0000 (07:14 -0500)]
rename `sp` to `span`

2 years agoUpdate sync.rs
Dylan DPC [Wed, 1 Jun 2022 12:12:36 +0000 (14:12 +0200)]
Update sync.rs

2 years agoUpdate sync.rs
Dylan DPC [Wed, 1 Jun 2022 11:47:39 +0000 (13:47 +0200)]
Update sync.rs

2 years agoAdd regression test for #71546
Yuki Okushi [Tue, 31 May 2022 11:35:41 +0000 (20:35 +0900)]
Add regression test for #71546

2 years agoremove an unnecessary `Option`
Takayuki Maeda [Wed, 1 Jun 2022 08:06:07 +0000 (17:06 +0900)]
remove an unnecessary `Option`

2 years agoUpdate cargo
Eric Huss [Wed, 1 Jun 2022 05:50:43 +0000 (22:50 -0700)]
Update cargo

2 years agoTweak insert docs
Ariel Davis [Wed, 1 Jun 2022 05:08:14 +0000 (22:08 -0700)]
Tweak insert docs

2 years agoAuto merge of #97553 - nbdd0121:lib, r=Mark-Simulacrum
bors [Wed, 1 Jun 2022 04:52:11 +0000 (04:52 +0000)]
Auto merge of #97553 - nbdd0121:lib, r=Mark-Simulacrum

Add `#[inline]` to `Vec`'s `Deref/DerefMut`

This should help #97552 (although I haven't verified).

2 years agouse 128 cache align for m1 mac
yifei [Thu, 26 May 2022 06:25:25 +0000 (14:25 +0800)]
use 128 cache align for m1 mac

2 years agoAuto merge of #97435 - Patryk27:bump-compiler-builtins, r=Dylan-DPC
bors [Wed, 1 Jun 2022 01:49:04 +0000 (01:49 +0000)]
Auto merge of #97435 - Patryk27:bump-compiler-builtins, r=Dylan-DPC

library/std: Bump compiler_builtins

Some neat changes include faster float conversions & fixes for AVR 🙂

(note that's it's my first time upgrading `compiler_builtins`, so I'm not 100% sure if bumping `library/std/Cargo.toml` is enough; certainly seems to be so, though.)

2 years agoRemove #[rustc_box] attr during lowering
est31 [Wed, 25 May 2022 00:30:55 +0000 (02:30 +0200)]
Remove #[rustc_box] attr during lowering

2 years agoUse #[rustc_box] in alloc instead of box syntax
est31 [Sat, 28 May 2022 14:37:52 +0000 (16:37 +0200)]
Use #[rustc_box] in alloc instead of box syntax

2 years agoAdd #[rustc_box]
est31 [Sun, 22 May 2022 21:10:27 +0000 (23:10 +0200)]
Add #[rustc_box]

This commit adds an alternative content boxing syntax,
and uses it inside alloc.

The usage inside the very performance relevant code in
liballoc is the only remaining relevant usage of box syntax
in the compiler (outside of tests, which are comparatively
easy to port).

box syntax was originally designed to be used by all Rust
developers. This introduces a replacement syntax more tailored
to only being used inside the Rust compiler, and with it,
lays the groundwork for eventually removing box syntax.

2 years agoAuto merge of #97600 - matthiaskrgr:rollup-yivyeu5, r=matthiaskrgr
bors [Tue, 31 May 2022 23:24:39 +0000 (23:24 +0000)]
Auto merge of #97600 - matthiaskrgr:rollup-yivyeu5, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #97316 (Put a bound on collection misbehavior)
 - #97578 (alloc: remove repeated word in comment)
 - #97593 (:arrow_up: rust-analyzer)
 - #97596 (Fixup feature name to be more consistent with others)

Failed merges:

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

2 years agoSpelling correction.
Ximon Eighteen [Tue, 31 May 2022 22:23:23 +0000 (00:23 +0200)]
Spelling correction.

2 years agoExpose get_many_mut and get_many_unchecked_mut to HashMap
Loïc BRANSTETT [Sat, 5 Mar 2022 17:32:33 +0000 (18:32 +0100)]
Expose get_many_mut and get_many_unchecked_mut to HashMap

2 years agomigrate `check_for_for_in_in_typo` diagnostic
Christian Poveda [Tue, 31 May 2022 21:28:05 +0000 (16:28 -0500)]
migrate `check_for_for_in_in_typo` diagnostic

2 years agoRollup merge of #97596 - WaffleLapkin:fixup_feature_name, r=compiler-errors
Matthias Krüger [Tue, 31 May 2022 21:11:37 +0000 (23:11 +0200)]
Rollup merge of #97596 - WaffleLapkin:fixup_feature_name, r=compiler-errors

Fixup feature name to be more consistent with others

`slice_from_mut_ptr_range_const` -> `const_slice_from_mut_ptr_range`, we usually have `const` in the front.

I've made a typo in  #97419

2 years agoRollup merge of #97593 - lnicola:rust-analyzer-2022-05-31, r=lnicola
Matthias Krüger [Tue, 31 May 2022 21:11:36 +0000 (23:11 +0200)]
Rollup merge of #97593 - lnicola:rust-analyzer-2022-05-31, r=lnicola

:arrow_up: rust-analyzer

r? `@ghost`

2 years agoRollup merge of #97578 - ojeda:checkpatch, r=JohnTitor
Matthias Krüger [Tue, 31 May 2022 21:11:35 +0000 (23:11 +0200)]
Rollup merge of #97578 - ojeda:checkpatch, r=JohnTitor

alloc: remove repeated word in comment

Linux's `checkpatch.pl` reports:

```txt
#42544: FILE: rust/alloc/vec/mod.rs:2692:
WARNING: Possible repeated word: 'to'
+            // - Elements are :Copy so it's OK to to copy them, without doing
```

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2 years agoRollup merge of #97316 - CAD97:bound-misbehavior, r=dtolnay
Matthias Krüger [Tue, 31 May 2022 21:11:34 +0000 (23:11 +0200)]
Rollup merge of #97316 - CAD97:bound-misbehavior, r=dtolnay

Put a bound on collection misbehavior

As currently written, when a logic error occurs in a collection's trait parameters, this allows *completely arbitrary* misbehavior, so long as it does not cause undefined behavior in std. However, because the extent of misbehavior is not specified, it is allowed for *any* code in std to start misbehaving in arbitrary ways which are not formally UB; consider the theoretical example of a global which gets set on an observed logic error. Because the misbehavior is only bound by not resulting in UB from safe APIs and the crate-level encapsulation boundary of all of std, this makes writing user unsafe code that utilizes std theoretically impossible, as it now relies on undocumented QOI (quality of implementation) that unrelated parts of std cannot be caused to misbehave by a misuse of std::collections APIs.

In practice, this is a nonconcern, because std has reasonable QOI and an implementation that takes advantage of this freedom is essentially a malicious implementation and only compliant by the most langauage-lawyer reading of the documentation.

To close this hole, we just add a small clause to the existing logic error paragraph that ensures that any misbehavior is limited to the collection which observed the logic error, making it more plausible to prove the soundness of user unsafe code.

This is not meant to be formal; a formal refinement would likely need to mention that values derived from the collection can also misbehave after a logic error is observed, as well as define what it means to "observe" a logic error in the first place. This fix errs on the side of informality in order to close the hole without complicating a normal reading which can assume a reasonable nonmalicious QOI.

See also [discussion on IRLO][1].

[1]: https://internals.rust-lang.org/t/using-std-collections-and-unsafe-anything-can-happen/16640

r? rust-lang/libs-api ```@rustbot``` label +T-libs-api -T-libs

This technically adds a new guarantee to the documentation, though I argue as written it's one already implicitly provided.

2 years agoAuto merge of #97582 - tmiasko:pointer-address-cast, r=oli-obk
bors [Tue, 31 May 2022 21:06:11 +0000 (21:06 +0000)]
Auto merge of #97582 - tmiasko:pointer-address-cast, r=oli-obk

Add a pointer to address cast kind

A pointer to address cast are often special-cased. Introduce a dedicated cast kind to make them easy distinguishable.

2 years agomerge diagnostics about incorrect uses of `.await`
Christian Poveda [Tue, 31 May 2022 20:07:44 +0000 (15:07 -0500)]
merge diagnostics about incorrect uses of `.await`

2 years agomigrate `error_on_incorrect_await` diagnostic
Christian Poveda [Tue, 31 May 2022 19:32:07 +0000 (14:32 -0500)]
migrate `error_on_incorrect_await` diagnostic

2 years agoFixup feature name to be more consistent with others
Maybe Waffle [Tue, 31 May 2022 19:12:28 +0000 (23:12 +0400)]
Fixup feature name to be more consistent with others

`slice_from_mut_ptr_range_const` -> `const_slice_from_mut_ptr_range`,
we usually have `const` in the front.

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Tue, 31 May 2022 18:32:15 +0000 (21:32 +0300)]
:arrow_up: rust-analyzer

2 years agorustdoc: also index raw pointers
Michael Howell [Tue, 31 May 2022 18:18:51 +0000 (11:18 -0700)]
rustdoc: also index raw pointers

Co-authored-by: Noah Lev <camelidcamel@gmail.com>
2 years agorustdoc: also index impl trait
Michael Howell [Tue, 31 May 2022 18:12:02 +0000 (11:12 -0700)]
rustdoc: also index impl trait

2 years agoAuto merge of #97570 - JakobDegen:dse-test, r=tmiasko
bors [Tue, 31 May 2022 17:59:41 +0000 (17:59 +0000)]
Auto merge of #97570 - JakobDegen:dse-test, r=tmiasko

Fix TLS access mir opt test and remove stale files

Thanks `@pietroalbini` for noticing that the TLS test was not doing what it was supposed to. Switched to `PreCodegen` because `SimplifyCfg` does not run on opt level 0.

Also addresses the easy part of #97564 .

r? rust-lang/mir-opt

2 years agouse `suggestion_short` for incorrect semicolon diagnostic
Christian Poveda [Tue, 31 May 2022 17:56:26 +0000 (12:56 -0500)]
use `suggestion_short` for incorrect semicolon diagnostic

2 years agomigrate `recover_from_await_method_call` diagnostic
Christian Poveda [Tue, 31 May 2022 17:33:35 +0000 (12:33 -0500)]
migrate `recover_from_await_method_call` diagnostic

2 years agoFix comment in poly_project_and_unify_type
Michael Goulet [Mon, 30 May 2022 21:36:12 +0000 (14:36 -0700)]
Fix comment in poly_project_and_unify_type

2 years agomigrate `maybe_consume_incorrect_semicolon` diagnostic
Christian Poveda [Tue, 31 May 2022 16:45:44 +0000 (11:45 -0500)]
migrate `maybe_consume_incorrect_semicolon` diagnostic

2 years agomigrate `maybe_recover_from_bad_qpath_stage_2` diagnostic
Christian Poveda [Tue, 31 May 2022 16:22:26 +0000 (11:22 -0500)]
migrate `maybe_recover_from_bad_qpath_stage_2` diagnostic

2 years agoApply track_caller to closure on `expect_non_local()`
Yuki Okushi [Tue, 10 May 2022 11:17:38 +0000 (20:17 +0900)]
Apply track_caller to closure on `expect_non_local()`

2 years agoAuto merge of #97419 - WaffleLapkin:const_from_ptr_range, r=oli-obk
bors [Tue, 31 May 2022 14:55:33 +0000 (14:55 +0000)]
Auto merge of #97419 - WaffleLapkin:const_from_ptr_range, r=oli-obk

Make `from{,_mut}_ptr_range` const

This PR makes the following APIs `const`:
```rust
// core::slice

pub const unsafe fn from_ptr_range<'a, T>(range: Range<*const T>) -> &'a [T];
pub const unsafe fn from_mut_ptr_range<'a, T>(range: Range<*mut T>) -> &'a mut [T];
```

Tracking issue: #89792.
Feature for `from_ptr_range` as a `const fn`: `slice_from_ptr_range_const`.
Feature for `from_mut_ptr_range` as a `const fn`: `slice_from_mut_ptr_range_const`.

r? `@oli-obk`

2 years agoAuto merge of #97521 - SkiFire13:clarify-vec-as-ptr, r=Dylan-DPC
bors [Tue, 31 May 2022 12:14:51 +0000 (12:14 +0000)]
Auto merge of #97521 - SkiFire13:clarify-vec-as-ptr, r=Dylan-DPC

Clarify the guarantees of Vec::as_ptr and Vec::as_mut_ptr when there's no allocation

Currently the documentation says they return a pointer to the vector's buffer, which has the implied precondition that the vector allocated some memory. However `Vec`'s documentation also specifies that it won't always allocate, so it's unclear whether the pointer returned is valid in that case. Of course you won't be able to read/write actual bytes to/from it since the capacity is 0, but there's an exception: zero sized read/writes. They are still valid as long as the pointer is not null and the memory it points to wasn't deallocated, but `Vec::as_ptr` and `Vec::as_mut_ptr` don't specify that's not the case. This PR thus specifies they are actually valid for zero sized reads since `Vec` is implemented to hold a dangling pointer in those cases, which is neither null nor was deallocated.

2 years agoalloc: remove repeated word in comment
Miguel Ojeda [Tue, 31 May 2022 10:28:57 +0000 (12:28 +0200)]
alloc: remove repeated word in comment

Linux's `checkpatch.pl` reports:

```txt
#42544: FILE: rust/alloc/vec/mod.rs:2692:
WARNING: Possible repeated word: 'to'
+            // - Elements are :Copy so it's OK to to copy them, without doing
```

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2 years agoAuto merge of #97526 - Nilstrieb:unicode-is-printable-fastpath, r=joshtriplett
bors [Tue, 31 May 2022 09:34:00 +0000 (09:34 +0000)]
Auto merge of #97526 - Nilstrieb:unicode-is-printable-fastpath, r=joshtriplett

Add unicode fast path to `is_printable`

Before, it would enter the full expensive check even for normal ascii characters. Now, it skips the check for the ascii characters in `32..127`. This range was checked manually from the current behavior.

I ran the `tracing` test suite in miri, and it was really slow. I looked at a profile, and miri spent most of the time in `core::char::methods::escape_debug_ext`, where half of that was dominated by `core::unicode::printable::is_printable`. So I optimized it here.

The tracing profile:
![The tracing profile](https://user-images.githubusercontent.com/48135649/170883650-23876e7b-3fd1-4e8b-9001-47672e06d914.svg)

2 years agoAdd unicode fast path to `is_printable`
Nilstrieb [Sun, 29 May 2022 17:21:57 +0000 (19:21 +0200)]
Add unicode fast path to `is_printable`

Before, it would enter the full expensive check even for normal ascii
characters. Now, it skips the check for the ascii characters in
`32..127`. This range was checked manually from the current behavior.

2 years agoAuto merge of #97574 - Dylan-DPC:rollup-jq850l6, r=Dylan-DPC
bors [Tue, 31 May 2022 06:53:02 +0000 (06:53 +0000)]
Auto merge of #97574 - Dylan-DPC:rollup-jq850l6, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #97089 (Improve settings theme display)
 - #97229 (Document the current aliasing rules for `Box<T>`.)
 - #97371 (Suggest adding a semicolon to a closure without block)
 - #97455 (Stabilize `toowned_clone_into`)
 - #97565 (Add doc alias `memset` to `write_bytes`)
 - #97569 (Remove `memset` alias from `fill_with`.)

Failed merges:

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

2 years agoRollup merge of #97569 - thomcc:fill_with_isnt_memset, r=Amanieu
Dylan DPC [Tue, 31 May 2022 05:57:37 +0000 (07:57 +0200)]
Rollup merge of #97569 - thomcc:fill_with_isnt_memset, r=Amanieu

Remove `memset` alias from `fill_with`.

In https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Unsafe.20and.20Safe.20versions.20of.20APIs.20both.20getting.20the.20same.20alias/near/284413029 `@Amanieu` pointed out that we had this, which is not really right.

In our guidelines we say that we will "not add an alias for a function that's only somewhat similar or related", which applies here. Memset doesn't take a closure, not even conceptually.

2 years agoRollup merge of #97565 - lukas-code:patch-1, r=thomcc
Dylan DPC [Tue, 31 May 2022 05:57:36 +0000 (07:57 +0200)]
Rollup merge of #97565 - lukas-code:patch-1, r=thomcc

Add doc alias `memset` to `write_bytes`

I were looking for `memset` in rust, but the docs only pointed me to `slice::fill`.

With only the old aliases, one might write code like this, which is incorrect if the memory is uninitialized.
``` Rust
core::slice::from_raw_parts(ptr, len).fill(0)
```

2 years agoRollup merge of #97455 - JohnTitor:stabilize-toowned-clone-into, r=dtolnay
Dylan DPC [Tue, 31 May 2022 05:57:35 +0000 (07:57 +0200)]
Rollup merge of #97455 - JohnTitor:stabilize-toowned-clone-into, r=dtolnay

Stabilize `toowned_clone_into`

Closes #41263
FCP has been done: https://github.com/rust-lang/rust/issues/41263#issuecomment-1100760750

2 years agoRollup merge of #97371 - ChayimFriedman2:closure-non-block-add-semicolon, r=oli-obk
Dylan DPC [Tue, 31 May 2022 05:57:34 +0000 (07:57 +0200)]
Rollup merge of #97371 - ChayimFriedman2:closure-non-block-add-semicolon, r=oli-obk

Suggest adding a semicolon to a closure without block

This transforms `|| expr` into `|| { expr; }`.

Closes #97359.

2 years agoRollup merge of #97229 - Nilstrieb:doc-box-noalias, r=dtolnay
Dylan DPC [Tue, 31 May 2022 05:57:33 +0000 (07:57 +0200)]
Rollup merge of #97229 - Nilstrieb:doc-box-noalias, r=dtolnay

Document the current aliasing rules for `Box<T>`.

Currently, `Box<T>` gets `noalias`, meaning it has the same rules as `&mut T`. This is sparsely documented, even though it can have quite a big impact on unsafe code using box. Therefore, these rules are documented here, with a big warning that they are not normative and subject to change, since we have not yet committed to an aliasing model and the state of `Box<T>` is especially uncertain.

If you have any suggestions and improvements, make sure to leave them here. This is mostly intended to inform people about what is currently going on (to prevent misunderstandings such as [Jon Gjengset's Box aliasing](https://www.youtube.com/watch?v=EY7Wi9fV5bk)).

This is supposed to _only document current UB_ and not add any new guarantees or rules.

2 years agoRollup merge of #97089 - GuillaumeGomez:improve-settings-theme-display, r=jsha
Dylan DPC [Tue, 31 May 2022 05:57:32 +0000 (07:57 +0200)]
Rollup merge of #97089 - GuillaumeGomez:improve-settings-theme-display, r=jsha

Improve settings theme display

This is a follow-up of #96958. In this PR, I changed how the theme radio buttons are displayed and improved their look as well.

It now looks like this:

![Screenshot from 2022-05-17 20-46-20](https://user-images.githubusercontent.com/3050060/168887703-a01e3bd5-9644-4012-ac11-2ae7bacd6be6.png)
![Screenshot from 2022-05-17 20-46-12](https://user-images.githubusercontent.com/3050060/168887707-132f8b2d-1163-462f-b7dd-f861121bdee7.png)

You can test it [here](https://rustdoc.crud.net/imperio/improve-settings-theme-display/doc/foo/index.html).

r? `@jsha`

2 years agoAuto merge of #96881 - est31:join_osstr, r=dtolnay
bors [Tue, 31 May 2022 04:28:29 +0000 (04:28 +0000)]
Auto merge of #96881 - est31:join_osstr, r=dtolnay

Implement [OsStr]::join

Implements join for `OsStr` and `OsString` slices:

```Rust
    let strings = [OsStr::new("hello"), OsStr::new("dear"), OsStr::new("world")];
    assert_eq!("hello dear world", strings.join(OsStr::new(" ")));
````

This saves one from converting to strings and back, or from implementing it manually.

This PR has been re-filed after #96744 was first accidentally merged and then reverted.

The change is instantly stable and thus:

r? rust-lang/libs-api `@rustbot` label +T-libs-api -T-libs

cc `@thomcc` `@m-ou-se` `@faptc`

2 years agoAuto merge of #97566 - compiler-errors:rollup-qfxw4j8, r=compiler-errors
bors [Tue, 31 May 2022 01:17:00 +0000 (01:17 +0000)]
Auto merge of #97566 - compiler-errors:rollup-qfxw4j8, r=compiler-errors

Rollup of 6 pull requests

Successful merges:

 - #89685 (refactor: VecDeques Iter fields to private)
 - #97172 (Optimize the diagnostic generation for `extern unsafe`)
 - #97395 (Miri call ABI check: ensure type size+align stay the same)
 - #97431 (don't do `Sized` and other return type checks on RPIT's real type)
 - #97555 (Source code page: line number click adds `NaN`)
 - #97558 (Fix typos in comment)

Failed merges:

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

2 years agoBTreeSet->BTreeMap (fix copy/paste mistake in documentation)
David Tolnay [Tue, 31 May 2022 00:56:35 +0000 (17:56 -0700)]
BTreeSet->BTreeMap (fix copy/paste mistake in documentation)

Co-authored-by: lcnr <rust@lcnr.de>
2 years agoAdd a pointer to address cast kind
Tomasz Miąsko [Tue, 31 May 2022 00:00:00 +0000 (00:00 +0000)]
Add a pointer to address cast kind

A pointer to address cast are often special-cased.
Introduce a dedicated cast kind to make them easy distinguishable.

2 years agoFix typo uniqeness -> uniqueness
David Tolnay [Mon, 30 May 2022 23:49:28 +0000 (16:49 -0700)]
Fix typo uniqeness -> uniqueness

2 years agonormalize harder
Maybe Waffle [Mon, 30 May 2022 23:46:04 +0000 (03:46 +0400)]
normalize harder

2 years agoFix TLS access mir opt test and remove stale files
Jakob Degen [Mon, 30 May 2022 23:26:02 +0000 (16:26 -0700)]
Fix TLS access mir opt test and remove stale files

2 years agoRemove `memset` alias from `fill_with`.
Thom Chiovoloni [Mon, 30 May 2022 23:26:00 +0000 (16:26 -0700)]
Remove `memset` alias from `fill_with`.

2 years agoRollup merge of #97558 - stoeckmann:typos, r=compiler-errors
Michael Goulet [Mon, 30 May 2022 22:57:31 +0000 (15:57 -0700)]
Rollup merge of #97558 - stoeckmann:typos, r=compiler-errors

Fix typos in comment

Just two typos in HashingControls' description.

2 years agoRollup merge of #97555 - GuillaumeGomez:line-number-click, r=notriddle
Michael Goulet [Mon, 30 May 2022 22:57:30 +0000 (15:57 -0700)]
Rollup merge of #97555 - GuillaumeGomez:line-number-click, r=notriddle

Source code page: line number click adds `NaN`

When you click on the parent element of the line numbers in the source code pages, it'll add `NaN` (like in https://doc.rust-lang.org/nightly/src/alloc/lib.rs.html#NaN). This PR fixes this bug.

cc ``@jsha``
r? ``@notriddle``

2 years agoRollup merge of #97431 - compiler-errors:issue-97413, r=oli-obk
Michael Goulet [Mon, 30 May 2022 22:57:29 +0000 (15:57 -0700)]
Rollup merge of #97431 - compiler-errors:issue-97413, r=oli-obk

don't do `Sized` and other return type checks on RPIT's real type

Fixes an ICE where we're doing `Sized` check against the RPIT's real type, instead of against the opaque type. This differs from what we're doing in MIR typeck, which causes ICE #97226.

This regressed in #96516 -- this adjusts that fix to be a bit more conservative. That PR was backported and thus the ICE is also present in stable. Not sure if it's worth to beta and/or stable backport, probably not the latter but I could believe the former.

r? `@oli-obk`

cc: another attempt to fix this ICE #97413. I believe this PR addresses the root cause.