Commit Graph

168405 Commits

Author SHA1 Message Date
Guillaume Gomez
afcf099e30
Rollup merge of #96565 - notriddle:notriddle/impl-box, r=camelid
rustdoc: show implementations on `#[fundamental]` wrappers

Fixes #92940
2022-05-20 14:03:01 +02:00
bors
cd73afadae Auto merge of #96422 - tmccombs:mutex-unpoison, r=m-ou-se
Add functions to un-poison Mutex and RwLock

See discussion at https://internals.rust-lang.org/t/unpoisoning-a-mutex/16521/3
2022-05-20 08:06:56 +00:00
Thayne McCombs
a65afd82d1 Remove references to guards in documentation for clear_poison 2022-05-20 00:15:26 -06:00
bors
52cc779524 Auto merge of #97147 - Mark-Simulacrum:stage0-bump, r=pietroalbini
stage0 bootstrap bump

r? `@pietroalbini`
2022-05-20 05:44:52 +00:00
bors
f24ef2e296 Auto merge of #97029 - eholk:drop-tracking-yielding-in-match-guard, r=nikomatsakis
generator_interior: Count match pattern bindings as borrowed for the whole guard expression

The test case `yielding-in-match-guard.rs` was failing with `-Zdrop-tracking` enabled. The reason is that the copy of a local (`y`) was not counted as a borrow in typeck, while MIR did consider this as borrowed.

The correct thing to do here is to count pattern bindings are borrowed for the whole guard. Instead, what we were doing is to record the type at the use site of the variable and check if the variable comes from a borrowed pattern. Due to the fix for #57017, we were considering too small of a scope for this variable, which meant it was not counted as borrowed.

Because we now unconditionally record the borrow, rather than only for bindings that are used, this PR is also able to remove a lot of the logic around match bindings that was there before.

r? `@nikomatsakis`
2022-05-20 03:27:01 +00:00
bors
4d6992bc18 Auto merge of #97027 - cuviper:yesalias-refcell, r=thomcc
Use pointers in `cell::{Ref,RefMut}` to avoid `noalias`

When `Ref` and `RefMut` were based on references, they would get LLVM `noalias` attributes that were incorrect, because that alias guarantee is only true until the guard drops. A `&RefCell` on the same value can get a new borrow that aliases the previous guard, possibly leading to miscompilation. Using `NonNull` pointers in `Ref` and `RefCell` avoids `noalias`.

Fixes the library side of #63787, but we still might want to explore language solutions there.
2022-05-20 01:05:53 +00:00
Eric Holk
7d1dbdf3de Update IfLet syntax 2022-05-19 16:32:06 -07:00
Eric Holk
fce4c7998b Remove old match guard pattern tracking code
This is subsumed by the new changes that count pattern variables as
bound for the whole guard expression.
2022-05-19 16:23:28 -07:00
Eric Holk
d08efdec1c Borrow guard patterns for the body of the guard 2022-05-19 16:23:28 -07:00
Eric Holk
7db4c0277d Revert "Count copies of locals as borrowed temporaries"
This reverts commit 0d270b5e9f48268735f9a05462df65c9d1039855.
2022-05-19 16:23:28 -07:00
Eric Holk
d5b72058fe Count copies of locals as borrowed temporaries 2022-05-19 16:23:27 -07:00
Eric Holk
577bf0f354 Further reduce test case
Thanks to @tmiasko for this one!
2022-05-19 16:23:27 -07:00
Eric Holk
ab8c50f964 Add drop tracking version of yielding-in-match-guard.rs 2022-05-19 16:23:27 -07:00
bors
a09d36deae Auto merge of #97180 - Dylan-DPC:rollup-aa5j2yw, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #96539 (Add release notes for 1.61.0)
 - #97142 (move processing of `source_scope_data` into `MutVisitor`'s impl of `Integrator` when inline)
 - #97155 (Fix doc typo)
 - #97169 (Improve `u32 as char` cast diagnostic)
 - #97170 (Remove unnecessay .report() on ExitCode)
 - #97171 (Add regression test for #88119)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-19 22:43:00 +00:00
Dylan DPC
1fb9be0cee
Rollup merge of #97171 - JohnTitor:issue-88119, r=compiler-errors
Add regression test for #88119

Closes #88119
2022-05-19 17:22:51 +02:00
Dylan DPC
175974743a
Rollup merge of #97170 - benediktwerner:master, r=JohnTitor
Remove unnecessay .report() on ExitCode

Since #93442, the return type is `ExitCode` anyway so there's no need to do a conversion using `.report()` (which is now just a no-op).
2022-05-19 17:22:51 +02:00
Dylan DPC
3913d99c40
Rollup merge of #97169 - gimbles:u32-diagnostic, r=petrochenkov
Improve `u32 as char` cast diagnostic

Fixes #97160
2022-05-19 17:22:50 +02:00
Dylan DPC
12644bc39d
Rollup merge of #97155 - alygin:patch-1, r=JohnTitor
Fix doc typo

Fixes a minor doc typo for `atomic::fence()`.
2022-05-19 17:22:49 +02:00
Dylan DPC
362f598a75
Rollup merge of #97142 - SparrowLii:inline, r=tmiasko
move processing of `source_scope_data` into `MutVisitor`'s impl of `Integrator` when inline

This PR fixes the FIXME in the inline mir-opt which moves processing of `source_scope_data` into `MutVisitor`'s impl of `Integrator` when inline
2022-05-19 17:22:48 +02:00
Dylan DPC
0ee37d5836
Rollup merge of #96539 - tmandry:relnotes-1.61, r=Mark-Simulacrum
Add release notes for 1.61.0

cc `@rust-lang/release`
2022-05-19 17:22:47 +02:00
gimbles
9e5c24eaf8 Improve u32 to char diagnostic 2022-05-19 20:03:40 +05:30
bors
c067287049 Auto merge of #97024 - lcnr:simplify_type-sus, r=<try>
`simplify_type` improvements and cursed docs

the existing `TreatParams` enum pretty much mixes everything up. Not sure why this looked right to me in #94057

This also includes two changes which impact perf:
- `ty::Projection` with inference vars shouldn't be treated as a rigid type, even if fully normalized
- `ty::Placeholder` only unifies with itself, so actually return `Some` for them

r? `@nikomatsakis`
2022-05-19 13:08:51 +00:00
Yuki Okushi
676604bdd2
Add regression test for #88119 2022-05-19 20:51:32 +09:00
benediktwerner
7013dc52d5 Remove unnecessay .report() on ExitCode 2022-05-19 11:47:36 +02:00
bors
6913c7487e Auto merge of #97114 - klensy:cursor-ref, r=petrochenkov
use CursorRef more

This allows skipping clone of `TreeAndSpacing` (and `TokenTree`).
2022-05-19 09:27:55 +00:00
Thayne McCombs
66d88c9a18 Change clear_poison to take the lock instead of a guard 2022-05-19 01:53:41 -06:00
bors
67a9bcb31b Auto merge of #97103 - luqmana:asm-unwind-cleanup, r=Amanieu,tmiasko
Update MIR passes to handle unwinding Inline Asm

Some more follow up fixes from https://github.com/rust-lang/rust/pull/95864#issuecomment-1094165398

r? `@Amanieu`
2022-05-19 06:57:59 +00:00
Luqman Aden
af7f53d6d0 Add mir-opt test for asm_unwind + panic=abort 2022-05-18 23:15:00 -07:00
bors
50872bdb99 Auto merge of #97033 - nbdd0121:unwind3, r=Amanieu
Remove libstd's calls to `C-unwind` foreign functions

Remove all libstd and its dependencies' usage of `extern "C-unwind"`.

This is a prerequiste of a WIP PR which will forbid libraries calling `extern "C-unwind"` functions to be compiled in `-Cpanic=unwind` and linked against `panic_abort` (this restriction is necessary to address soundness bug #96926).
Cargo will ensure all crates are compiled with the same `-Cpanic` but the std is only compiled `-Cpanic=unwind` but needs the ability to be linked into `-Cpanic=abort`.

Currently there are two places where `C-unwind` is used in libstd:
* `__rust_start_panic` is used for interfacing to the panic runtime. This could be `extern "Rust"`
* `_{rdl,rg}_oom`: a shim `__rust_alloc_error_handler` will be generated by codegen to call into one of these; they can also be `extern "Rust"` (in fact, the generated shim is used as `extern "Rust"`, so I am not even sure why these are not, probably because they used to `extern "C"` and was changed to `extern "C-unwind"` when we allow alloc error hooks to unwind, but they really should just be using Rust ABI).

For dependencies, there is only one `extern "C-unwind"` function call, in `unwind` crate. This can be expressed as a re-export.

More dicussions can be seen in the Zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/210922-project-ffi-unwind/topic/soundness.20in.20mixed.20panic.20mode

`@rustbot` label: T-libs F-c_unwind
2022-05-19 04:04:40 +00:00
bors
e6327bc8b8 Auto merge of #97159 - JohnTitor:rollup-ibl51vw, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #96866 (Switch CI bucket uploads to intelligent tiering)
 - #97062 (Couple of refactorings to cg_ssa::base::codegen_crate)
 - #97127 (Revert "Auto merge of #96441 - ChrisDenton:sync-pipes, r=m-ou-se")
 - #97131 (Improve println! documentation)
 - #97139 (Move some settings DOM generation out of JS)
 - #97152 (Update cargo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-05-19 01:41:07 +00:00
Yuki Okushi
9babb1c0da
Rollup merge of #97152 - ehuss:update-cargo, r=ehuss
Update cargo

3 commits in 3f052d8eed98c6a24f8b332fb2e6e6249d12d8c1..a4c1cd0eb6b18082a7e693f5a665548fe1534be4
2022-05-12 15:19:04 +0000 to 2022-05-18 01:52:07 +0000
- Add notes about pre-stabilization to contributor unstable docs (rust-lang/cargo#10675)
- reference: Update syntax supported by `rustc-link-lib` (rust-lang/cargo#10674)
- Correct the release dates for 1.61 and 1.62 (rust-lang/cargo#10665)
2022-05-19 08:22:45 +09:00
Yuki Okushi
4a4c07a9e0
Rollup merge of #97139 - GuillaumeGomez:move-dom-settings-generation, r=notriddle
Move some settings DOM generation out of JS

The first commit reduce the JS size a bit by moving some DOM content generation into the HTML file directly.

The second commit is an update of the `browser-ui-test` version which improves `wait-for-*` command (if the element doesn't exist, it'll wait for it instead of failing).

r? ``@notriddle``
2022-05-19 08:22:44 +09:00
Yuki Okushi
b7d72add46
Rollup merge of #97131 - gimbles:patch-2, r=Dylan-DPC
Improve println! documentation
2022-05-19 08:22:43 +09:00
Yuki Okushi
8aba26d34c
Rollup merge of #97127 - Mark-Simulacrum:revert-96441, r=m-ou-se
Revert "Auto merge of #96441 - ChrisDenton:sync-pipes, r=m-ou-se"

This reverts commit ddb7fbe843.

Partially addresses https://github.com/rust-lang/rust/issues/97124, but not marking as fixed as we're still pending on a beta backport (for 1.62, which is happening in https://github.com/rust-lang/rust/pull/97088).

r? ``@m-ou-se`` ``@ChrisDenton``
2022-05-19 08:22:43 +09:00
Yuki Okushi
330e03f682
Rollup merge of #97062 - bjorn3:cg_ssa_driver_refactor, r=compiler-errors
Couple of refactorings to cg_ssa::base::codegen_crate

This makes the code simpler and easier to read.
2022-05-19 08:22:42 +09:00
Yuki Okushi
ca3bddd14e
Rollup merge of #96866 - Mark-Simulacrum:intelligent-tiering-ci, r=pietroalbini
Switch CI bucket uploads to intelligent tiering

We currently upload approximately 166 GB/day into this bucket (estimate based on
duration of storage and total current size). My estimate is that this change
should decrease our costs (which are currently in credits) and is in the worst
case (if all objects are brought into hot storage due to unanticipated frequent
access) only going to add an additional ~$4 to the monthly bill. If access is
rare (as expected) to most objects then we expect to save approximately
~$350/month (after this change takes full effect in ~168 days).

r? ``@pietroalbini``
2022-05-19 08:22:41 +09:00
bors
d8a3fc4d71 Auto merge of #95643 - WaffleLapkin:ptr_convenience, r=joshtriplett
Add convenience byte offset/check align functions to pointers

This PR adds the following APIs:
```rust
impl *const T {
    // feature gates `pointer_byte_offsets` and `const_pointer_byte_offsets
    pub const unsafe fn byte_offset(self, count: isize) -> Self;
    pub const fn wrapping_byte_offset(self, count: isize) -> Self;
    pub const unsafe fn byte_offset_from(self, origin: *const T) -> isize;
    pub const unsafe fn byte_add(self, count: usize) -> Self;
    pub const unsafe fn byte_sub(self, count: usize) -> Self;
    pub const fn wrapping_byte_add(self, count: usize) -> Self;
    pub const fn wrapping_byte_sub(self, count: usize) -> Self;

    // feature gate `pointer_is_aligned`
    pub fn is_aligned(self) -> bool where T: Sized;
    pub fn is_aligned_to(self, align: usize) -> bool;
}
// ... and the same for` *mut T`
```

Note that all functions except `is_aligned` do **not** require `T: Sized` as their pointee-sized-offset counterparts.

cc `@oli-obk` (you may want to check that I've correctly placed `const`s)
cc `@RalfJung`
2022-05-18 23:18:03 +00:00
Andrew Lygin
0d99b90983
Fix doc typo 2022-05-19 00:25:14 +03:00
Eric Huss
6986a72547 Update cargo 2022-05-18 13:52:43 -07:00
Luqman Aden
f45f826207 Update MIR passes that assumed inline can never unwind. 2022-05-18 13:42:23 -07:00
bors
cd282d7f75 Auto merge of #97019 - b-naber:transition-to-valtrees-pt1, r=oli-obk
Transition to valtrees pt1

Compartmentalising https://github.com/rust-lang/rust/pull/96591 as much as possible.

r? `@oli-obk`
2022-05-18 20:12:07 +00:00
bors
07ae142d77 Auto merge of #96863 - SparrowLii:let, r=michaelwoerister
use `hir::Let` in `hir::Guard::IfLet`

This PR fixes the FIXME about using `hir::Let` in `hir::Guard::IfLet`
2022-05-18 17:48:46 +00:00
klensy
05f459ea82 fix rustfmt 2022-05-18 20:43:16 +03:00
Mark Rousskov
bf29b3c218 Bump RLS to latest master 2022-05-18 12:29:35 -04:00
Mark Rousskov
32fdc6b207 Stage-step cfgs 2022-05-18 12:29:35 -04:00
klensy
cc5f3e21ac use CursorRef more, to not to clone Trees 2022-05-18 18:43:48 +03:00
Mark Rousskov
c64c29f8d1 Bump stage 0 to new beta 2022-05-18 11:38:34 -04:00
bors
10d9ecda48 Auto merge of #96800 - nbdd0121:const, r=nagisa
Permit `asm_const` and `asm_sym` to reference generic params

Related #96557

These constructs will be allowed:
```rust
fn foofoo<const N: usize>() {}

unsafe fn foo<const N: usize>() {
    asm!("/* {0} */", const N);
    asm!("/* {0} */", const N + 1);
    asm!("/* {0} */", sym foofoo::<N>);
}

fn barbar<T>() {}

unsafe fn bar<T>() {
    asm!("/* {0} */", const std::mem::size_of::<T>());
    asm!("/* {0} */", const std::mem::size_of::<(T, T)>());
    asm!("/* {0} */", sym barbar::<T>);
    asm!("/* {0} */", sym barbar::<(T, T)>);
}
```

`@Amanieu,` I didn't switch inline asms to use `DefKind::InlineAsm`, as I see little value doing that; given that no type inference is needed, it will only make typecking slower and more complex but will have no real gains. I did switch them to follow the same code path as inline asm during symbol resolution, though.
The `error: unconstrained generic constant` you mentioned in #76001 is due to the fact that `to_const` will actually add a wfness obligation to the constant, which we don't need for `asm_const`, so I have that removed.

`@rustbot` label: +A-inline-assembly +F-asm
2022-05-18 15:07:47 +00:00
SparrowLii
420f9a3489 move processing of source_scope_data into MutVisitor's impl of Integrator when inline mir-opt 2022-05-18 20:58:11 +08:00
bors
936eba3b34 Auto merge of #96867 - michaelwoerister:path-prefix-fixes-2, r=davidtwco
--remap-path-prefix: Fix duplicated path components in debuginfo

This PR fixes an issue with `--remap-path-prefix` where path components could appear twice in the remapped version of the path (e.g. https://github.com/rust-lang/rust/issues/78479). The underlying problem was that `--remap-path-prefix` is often used to map an absolute path to something that looks like a relative path, e.g.:

```
--remap-path-prefix=/home/calvin/.cargo/registry/src/github.com-1ecc6299db9ec823=crates.io",
```

and relative paths in debuginfo are interpreted as being relative to the compilation directory. So if Cargo invokes the compiler with `/home/calvin/.cargo/registry/src/github.com-1ecc6299db9ec823/some_crate-0.1.0/src/lib.rs` as input and `/home/calvin/.cargo/registry/src/github.com-1ecc6299db9ec823/some_crate-0.1.0` as the compiler's working directory, then debuginfo will state that the working directory was `crates.io/some_crate-0.1.0` and the file is question was `crates.io/some_crate-0.1.0/src/lib.rs`, which combined gives the path:

```
crates.io/some_crate-0.1.0/crates.io/some_crate-0.1.0/src/lib.rs
```

With this PR the compiler will detect this situation and set up debuginfo in LLVM in a way that makes it strip the duplicated path components when emitting DWARF.

The PR also extracts the logic for making remapped paths absolute into a common helper function that is now used by debuginfo too (instead of just during crate metadata generation).
2022-05-18 12:45:44 +00:00