Commit Graph

172994 Commits

Author SHA1 Message Date
Michael Goulet
f7326989e6 Use VecMap::get in ConstraintLocator::check 2022-07-24 05:51:03 +00:00
bors
93ffde6f04 Auto merge of #98208 - ivanloz:master, r=nagisa
Add support for LLVM ShadowCallStack.

LLVMs ShadowCallStack provides backward edge control flow integrity protection by using a separate shadow stack to store and retrieve a function's return address.

LLVM currently only supports this for AArch64 targets. The x18 register is used to hold the pointer to the shadow stack, and therefore this only works on ABIs which reserve x18. Further details are available in the [LLVM ShadowCallStack](https://clang.llvm.org/docs/ShadowCallStack.html) docs.

# Usage
`-Zsanitizer=shadow-call-stack`

# Comments/Caveats
* Currently only enabled for the aarch64-linux-android target
* Requires the platform to define a runtime to initialize the shadow stack, see the [LLVM docs](https://clang.llvm.org/docs/ShadowCallStack.html) for more detail.
2022-07-23 20:01:07 +00:00
bors
0e7c843da4 Auto merge of #98471 - wesleywiser:update_measureme, r=Mark-Simulacrum
Update measureme to the latest version
2022-07-23 16:14:40 +00:00
bors
e55c53c57e Auto merge of #97925 - the8472:cgroupv1, r=joshtriplett
Add cgroupv1 support to available_parallelism

Fixes #97549

My dev machine uses cgroup v2 so I was only able to test that code path. So the v1 code path is written only based on documentation. I could use some help testing that it works on a machine with cgroups v1:

```
$ x.py build --stage 1

# quota.rs
fn main() {
    println!("{:?}", std:🧵:available_parallelism());
}

# assuming stage1 is linked in rustup
$ rust +stage1 quota.rs

# spawn a new cgroup scope for the current user
$ sudo systemd-run -p CPUQuota="300%" --uid=$(id -u) -tdS

# should print Ok(3)
$ ./quota
```

If it doesn't work as expected an strace, the contents of `/proc/self/cgroups` and the structure of `/sys/fs/cgroups` would help.
2022-07-23 13:33:56 +00:00
bors
2e43d068ce Auto merge of #99636 - matthiaskrgr:rollup-yg0xxkx, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #99580 (Don't suggest unnameable generic arguments)
 - #99617 (Update mdbook)
 - #99631 (Use span_bug in case of unexpected rib kind)
 - #99632 (Fix typo/grammar in locator.rs doc comment)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-23 10:40:41 +00:00
Matthias Krüger
7c5df1f425
Rollup merge of #99632 - danbev:locator.rs-typo, r=Dylan-DPC
Fix typo/grammar in locator.rs doc comment
2022-07-23 12:08:14 +02:00
Matthias Krüger
f510d98ad3
Rollup merge of #99631 - jmqd:master, r=oli-obk
Use span_bug in case of unexpected rib kind

Extremely minor QOL change to improve the ICE compiler output in case
this default match case is encountered (an unexpected rib kind).

I have limited experience in this area of the compiler; please let me know
if a span more precise than `param.ident.span` is more applicable.
2022-07-23 12:08:13 +02:00
Matthias Krüger
539b8dd2e3
Rollup merge of #99617 - ehuss:update-mdbook, r=Dylan-DPC
Update mdbook

This updates mdbook from 0.4.20 to 0.4.21
Changelog: https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-0421

This contains a single fix that prevents mdbook from compiling on nightly (due to #99413). This will be necessary to keep everything working after the next master bootstrap switch.
2022-07-23 12:08:12 +02:00
Matthias Krüger
b6d6f100a1
Rollup merge of #99580 - fmease:fix-issue-99565, r=estebank
Don't suggest unnameable generic arguments

Fixes #99565.

`@rustbot` label T-compiler A-diagnostics
r? `@rust-lang/wg-diagnostics`
2022-07-23 12:08:11 +02:00
bors
47ba935965 Auto merge of #99320 - NiklasJonsson:84447/rustc_expand, r=compiler-errors
rustc_expand: Switch FxHashMap to FxIndexMap where iteration is used

Relates #84447
2022-07-23 07:59:54 +00:00
Daniel Bevenius
db977ca37e Fix typo/grammar in locator.rs doc comment 2022-07-23 07:31:20 +02:00
bors
7d0a55bcdc Auto merge of #99599 - RalfJung:miri-stage-0, r=RalfJung
miri: make --stage 0 testing work

This needs https://github.com/rust-lang/miri/pull/2415 or it'll break Miri entirely.

also fixes https://github.com/rust-lang/rust/issues/99589
2022-07-23 05:28:35 +00:00
Jordan McQueen
e0c9be539a Use span_bug in case of unexpected rib kind
Extremely minor QOL change to improve the ICE output in case this
default match case is encountered (an unexpected rib kind).
2022-07-23 13:26:45 +09:00
bors
ed793d86da Auto merge of #93397 - joshtriplett:sort-floats, r=Amanieu
Add `[f32]::sort_floats` and `[f64]::sort_floats`

It's inconvenient to sort a slice or Vec of floats, compared to sorting integers. To simplify numeric code, add a convenience method to `[f32]` and `[f64]` to sort them using `sort_unstable_by` with `total_cmp`.
2022-07-23 02:47:54 +00:00
bors
8aedb9c68d Auto merge of #99623 - RalfJung:rollup-0h066kc, r=RalfJung
Rollup of 3 pull requests

Successful merges:

 - #99588 (Update books)
 - #99602 (cargotest: do not run quickcheck tests in xsv)
 - #99607 (interpret: fix vtable check debug assertion)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-23 00:01:19 +00:00
Ralf Jung
25de227b43
Rollup merge of #99607 - RalfJung:vtable-check, r=eddyb
interpret: fix vtable check debug assertion

Fixes https://github.com/rust-lang/rust/issues/99605
Thanks to `@eddyb` for suggesting the fix!
2022-07-22 17:26:10 -04:00
Ralf Jung
0549516230
Rollup merge of #99602 - RalfJung:xsv, r=Mark-Simulacrum
cargotest: do not run quickcheck tests in xsv

Fixes https://github.com/rust-lang/rust/issues/73514
I know https://github.com/rust-lang/rust/issues/70659 discusses a larger overhaul of cargotest, but that seems to have stalled and I'd like to fix the immediate issue of PRs failing due to random test failures in xsv.

This still runs the vast majority of tests by numbers:
```
test result: ok. 394 passed; 0 failed; 0 ignored; 0 measured; 32 filtered out; finished in 1.84s
```
So the loss in test coverage is hopefully not too big.
2022-07-22 17:26:09 -04:00
Ralf Jung
e51a4762b5
Rollup merge of #99588 - ehuss:update-books, r=ehuss
Update books

## nomicon

1 commits in 70db9e4189f64d1d8e2451b1046111fb356b6dc2..8d1e4dccf71114ff56f328f671f2026d8e6b62a2
2022-06-27 20:47:21 +0900 to 2022-07-18 18:12:35 -0400
- Should be `align_of` instead of `size_of`

## reference

11 commits in 9fce337a55ee4a4629205f6094656195cecad231..a92be0fef439b3d8e0468d82cb24812d303520a0
2022-06-22 13:59:28 -0700 to 2022-07-21 19:01:23 -0700
- Add `IntoFuture::into_future` desugaring (rust-lang/reference#1233)
- Remove uses of the phrase "in Rust" (rust-lang/reference#1241)
- Revert "Add stable references of `macro_metavar_expr`" (rust-lang/reference#1242)
- tweaks
- further tweak addr_of exposition
- edits
- Apply suggestions from code review
- document raw-addr-of operators
- update union field type rules (rust-lang/reference#1238)
- clarify that references size_of_val can never exceed isize::MAX (rust-lang/reference#1186)
- Describe what `windows_subsystem` does (rust-lang/reference#1232)

## book

9 commits in cf2653a5ca553cbbb4a17f1a7db1947820f6a775..36383b4da21dbd0a0781473bc8ad7ef0ed1b6751
2022-07-05 12:07:58 -0400 to 2022-07-19 21:03:20 -0400
- Update ch16-02-message-passing.md
- Update snapshots with edits made to src that need to be checked
- Remove inconsistent newline. Fixes rust-lang/book#3240.
- add missing `b` in chapter 15.6
- Grammar: corrected 'as much' to 'as such'
- grammar: add missing 'of'
- Fix incorrect link for listing 13-06
- Correct method name
- Remove unused theme directories.

## rust-by-example

2 commits in 83724ca387a2a1cd3e8d848f62820020760e358b..3155db49b0d57cd82c65456ac210b69ecec5ccb1
2022-07-05 10:38:07 -0300 to 2022-07-05 20:35:53 -0300
- fix-type (rust-lang/rust-by-example#1565)
- add-examples-to-destructure-tuples (rust-lang/rust-by-example#1566)

## rustc-dev-guide

27 commits in eb83839e903a0a8f1406f7e941886273f189b26b..d5201cddace979b299ec1bf9fd8997338151aa9d
2022-07-03 15:17:39 +0900 to 2022-07-21 04:48:49 +0200
- Debuginfo tests now also support revisions.
- Link to rendered book directly
- Fix link to clippy sync docs
- remove stray markup
- renamed
- sync with hackmd version
- replace misleading name (rust-lang/rustc-dev-guide#1401)
- Remove a mention to Steve on r? example
- obey line length limit (part 3)
- obey line length limit (part 2)
- obey line length limit
- sync with hackmd
- add draft chapter
- add mdbook-mermaid
- use relative links
- fix some typos (rust-lang/rustc-dev-guide#1398)
- typo: monomorph docs
- Rename debugging_opts to unstable_opts, use link
- address review comment
- update date reference on MIR inliner
- remove outdated info on debugging
- small fixes to ty chapter (rust-lang/rustc-dev-guide#1390)
- Update the build instructions for the standard library
- overview.md: Link to existing Macro Expansion and Name Resolution docs (rust-lang/rustc-dev-guide#1388)
- Git-ignore `pulls.json` (rust-lang/rustc-dev-guide#1386)
- Revert "Add the config needed to get rust-analyzer working on src/bootstrap (rust-lang/rustc-dev-guide#1381)"
- Use `x.py check` instead of `cargo check` for build scripts (rust-lang/rustc-dev-guide#1384)
2022-07-22 17:26:08 -04:00
bors
848090dcd1 Auto merge of #98017 - RalfJung:dereferenceable, r=nikic
do not mark interior mutable shared refs as dereferenceable

My proposed solution to https://github.com/rust-lang/rust/issues/55005.
2022-07-22 21:20:35 +00:00
the8472
2e33c812e8
[review] mention that runtime may scale with # of mountpoints
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2022-07-22 22:18:07 +02:00
Eric Huss
31dd1f6859 Update mdbook 2022-07-22 11:59:20 -07:00
Ralf Jung
35c6dec921 adjust UnsafeCell documentation 2022-07-22 14:25:41 -04:00
Ralf Jung
5b7197af7f do not mark interior mutable shared refs as dereferenceable 2022-07-22 14:25:41 -04:00
Ralf Jung
307e80c1a6 rename PointerKind::Shared → SharedMutable to indicate this is NOT the usual shared reference 2022-07-22 14:22:05 -04:00
bors
ffa77332c6 Auto merge of #99598 - GuillaumeGomez:clean-trait-fields-on-demand, r=notriddle
Make some clean::Trait fields computation on demand

r? `@notriddle`
2022-07-22 16:52:10 +00:00
Ralf Jung
2564a080d8 update Miri 2022-07-22 12:18:52 -04:00
Ralf Jung
77be253c9b cargotest: do not run quickcheck tests in xsv 2022-07-22 11:51:44 -04:00
Ralf Jung
19e29e9a57 interpret: fix vtable check debug assertion 2022-07-22 10:37:03 -04:00
bors
22d25f21dc Auto merge of #99521 - fee1-dead-contrib:const_fix_hax, r=oli-obk
Fix hack that remaps env constness.

WARNING: might have perf implications.

Are there any more problems with having a constness in the `ParamEnv` now? :)

r? `@oli-obk`
2022-07-22 12:48:29 +00:00
Ralf Jung
ae22ae1358 miri: make --stage 0 testing work 2022-07-22 08:33:35 -04:00
Guillaume Gomez
edb9add193 Make some clean::Trait fields computation on demand 2022-07-22 14:26:05 +02:00
bors
41419e7036 Auto merge of #99491 - workingjubilee:sync-psimd, r=workingjubilee
Sync in portable-simd subtree

r? `@ghost`
2022-07-22 09:48:00 +00:00
bors
e7a9c11416 Auto merge of #99592 - Dylan-DPC:rollup-xlw4wax, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #98174 (Rename `<*{mut,const} T>::as_{const,mut}` to `cast_`)
 - #98868 (Fix unreachable coverage generation for inlined functions)
 - #99393 (feat: omit suffixes in const generics (e.g. `1_i32`))
 - #99423 (Group CSS font rule)
 - #99539 (Improve suggestions for returning binding)
 - #99579 (Add same warning to Result::expect as Result::unwrap)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-22 07:12:19 +00:00
Dylan DPC
5df3b98321
Rollup merge of #99579 - CleanCut:expect-warning, r=joshtriplett
Add same warning to Result::expect as Result::unwrap

I was reading a recent blog post by Jimmy Hartzell and [he noted](https://www.thecodedmessage.com/posts/2022-07-14-programming-unwrap/#context):

> I will however note that the documentation of `unwrap` comes with [a warning not to use it](https://doc.rust-lang.org/std/result/enum.Result.html#method.unwrap). The warning is framed in terms of the fact that `unwrap` may panic, but the [documentation of `expect`](https://doc.rust-lang.org/std/result/enum.Result.html#method.expect), where this is equally true, does not come with such a warning.

It _is_ equally true. Let's add the same warning to `expect`. This PR is a copy-and-paste of the warning text from the docstring for `unwrap`.
2022-07-22 11:53:43 +05:30
Dylan DPC
92bebac0b9
Rollup merge of #99539 - compiler-errors:bidirectional-block-suggestions, r=fee1-dead
Improve suggestions for returning binding

Fixes #99525

Also reworks the cause codes for match and if a bit, I think cleaning them up in a positive way.
We no longer need to call `could_remove_semicolon` in successful code, which might save a few cycles?
2022-07-22 11:53:42 +05:30
Dylan DPC
aec458b54f
Rollup merge of #99423 - GuillaumeGomez:group-css-font-rule, r=notriddle
Group CSS font rule

Another CSS cleanup I came by when working on something else.

r? ``@notriddle``
2022-07-22 11:53:41 +05:30
Dylan DPC
449ffe0bd5
Rollup merge of #99393 - Logarithmus:feature/99255-omit-const-generic-suffixes, r=petrochenkov
feat: omit suffixes in const generics (e.g. `1_i32`)

Closes #99255
2022-07-22 11:53:40 +05:30
Dylan DPC
6e3dd69e36
Rollup merge of #98868 - tmiasko:unreachable-coverage, r=wesleywiser
Fix unreachable coverage generation for inlined functions

To generate a function coverage we need at least one coverage counter,
so a coverage from unreachable blocks is retained only when some live
counters remain.

The previous implementation incorrectly retained unreachable coverage,
because it didn't account for the fact that those live counters can
belong to another function due to inlining.

Fixes #98833.
2022-07-22 11:53:40 +05:30
Dylan DPC
ad31d5c6a5
Rollup merge of #98174 - Kixunil:rename_ptr_as_mut_const_to_cast, r=scottmcm
Rename `<*{mut,const} T>::as_{const,mut}` to `cast_`

This renames the methods to use the `cast_` prefix instead of `as_` to
make it more readable and avoid confusion with `<*mut T>::as_mut()`
which is `unsafe` and returns a reference.

Sorry, didn't notice ACP process exists, opened https://github.com/rust-lang/libs-team/issues/51

See #92675
2022-07-22 11:53:39 +05:30
Eric Huss
d2cd32c7da Update books 2022-07-21 20:41:44 -07:00
León Orell Valerian Liehr
c98399f5eb Don't suggest unnameable generic arguments 2022-07-22 04:55:31 +02:00
bors
aa01891700 Auto merge of #99420 - RalfJung:vtable, r=oli-obk
make vtable pointers entirely opaque

This implements the scheme discussed in https://github.com/rust-lang/unsafe-code-guidelines/issues/338: vtable pointers should be considered entirely opaque and not even readable by Rust code, similar to function pointers.

- We have a new kind of `GlobalAlloc` that symbolically refers to a vtable.
- Miri uses that kind of allocation when generating a vtable.
- The codegen backends, upon encountering such an allocation, call `vtable_allocation` to obtain an actually dataful allocation for this vtable.
- We need new intrinsics to obtain the size and align from a vtable (for some `ptr::metadata` APIs), since direct accesses are UB now.

I had to touch quite a bit of code that I am not very familiar with, so some of this might not make much sense...
r? `@oli-obk`
2022-07-22 01:33:49 +00:00
Nathan Stocks
7ba0be832a add same warning to Result::expect as Result::unwrap 2022-07-21 18:15:24 -06:00
bors
31b9b012bb Auto merge of #99530 - RalfJung:miri, r=oli-obk
update Miri

Fixes https://github.com/rust-lang/rust/issues/99461
r? `@oli-obk` because of lockfile changes (seems like serde is getting implicitly bumped)
2022-07-21 22:24:06 +00:00
Ralf Jung
c2df1c21f8 update Miri 2022-07-21 16:04:37 -04:00
bors
62b272d25c Auto merge of #99501 - lcnr:check-regions-infcx, r=oli-obk
move `considering_regions` to the infcx

it seems weird to prove some obligations which constrain inference vars while ignoring regions  in a context which considers regions. This is especially weird because even for a fulfillment context with ignored regions, we still added region outlives bounds when directly relating regions.

tbh our handling of regions is still very weird, but at least this is a step in the right direction imo.

r? rust-lang/types
2022-07-21 19:43:21 +00:00
bors
af7ab34470 Auto merge of #99567 - matthiaskrgr:rollup-08hh3r4, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #98707 (std: use futex-based locks on Fuchsia)
 - #99413 (Add `PhantomData` marker for dropck to `BTreeMap`)
 - #99454 (Add map_continue and continue_value combinators to ControlFlow)
 - #99523 (Fix the stable version of `AsFd for Arc<T>` and `Box<T>`)
 - #99526 (Normalize the arg spans to be within the call span)
 - #99528 (couple of clippy::perf fixes)
 - #99549 (Add regression test for #52304)
 - #99552 (Rewrite `orphan_check_trait_ref` to use a `TypeVisitor`)
 - #99557 (Edit `rustc_index::vec::IndexVec::pick3_mut` docs)
 - #99558 (Fix `remap_constness`)
 - #99559 (Remove unused field in ItemKind::KeywordItem)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-21 17:02:31 +00:00
Michael Goulet
3eef023da0 Address more nits 2022-07-21 16:43:10 +00:00
Matthias Krüger
af64d93dbb
Rollup merge of #99559 - GuillaumeGomez:rm-unused-field-keyword, r=notriddle
Remove unused field in ItemKind::KeywordItem

For the keyword name, we use `Item::name` directly everywhere so there is no point into keeping it.

r? ``@notriddle``
2022-07-21 18:42:12 +02:00
Matthias Krüger
b068dc7392
Rollup merge of #99558 - fee1-dead-contrib:remap_constness_fix, r=oli-obk
Fix `remap_constness`

`~const Drop` was renamed to `~const Destruct` and this special case should
be removed
2022-07-21 18:42:11 +02:00