]> git.lizzy.rs Git - rust.git/log
rust.git
23 months agoUse VecMap::get in ConstraintLocator::check
Michael Goulet [Sun, 24 Jul 2022 05:51:03 +0000 (05:51 +0000)]
Use VecMap::get in ConstraintLocator::check

23 months agoAuto merge of #98208 - ivanloz:master, r=nagisa
bors [Sat, 23 Jul 2022 20:01:07 +0000 (20:01 +0000)]
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.

23 months agoAuto merge of #98471 - wesleywiser:update_measureme, r=Mark-Simulacrum
bors [Sat, 23 Jul 2022 16:14:40 +0000 (16:14 +0000)]
Auto merge of #98471 - wesleywiser:update_measureme, r=Mark-Simulacrum

Update measureme to the latest version

23 months agoAuto merge of #97925 - the8472:cgroupv1, r=joshtriplett
bors [Sat, 23 Jul 2022 13:33:56 +0000 (13:33 +0000)]
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::thread::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.

23 months agoAuto merge of #99636 - matthiaskrgr:rollup-yg0xxkx, r=matthiaskrgr
bors [Sat, 23 Jul 2022 10:40:41 +0000 (10:40 +0000)]
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

23 months agoRollup merge of #99632 - danbev:locator.rs-typo, r=Dylan-DPC
Matthias Krüger [Sat, 23 Jul 2022 10:08:14 +0000 (12:08 +0200)]
Rollup merge of #99632 - danbev:locator.rs-typo, r=Dylan-DPC

Fix typo/grammar in locator.rs doc comment

23 months agoRollup merge of #99631 - jmqd:master, r=oli-obk
Matthias Krüger [Sat, 23 Jul 2022 10:08:13 +0000 (12:08 +0200)]
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.

23 months agoRollup merge of #99617 - ehuss:update-mdbook, r=Dylan-DPC
Matthias Krüger [Sat, 23 Jul 2022 10:08:12 +0000 (12:08 +0200)]
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.

23 months agoRollup merge of #99580 - fmease:fix-issue-99565, r=estebank
Matthias Krüger [Sat, 23 Jul 2022 10:08:11 +0000 (12:08 +0200)]
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`

23 months agoAuto merge of #99320 - NiklasJonsson:84447/rustc_expand, r=compiler-errors
bors [Sat, 23 Jul 2022 07:59:54 +0000 (07:59 +0000)]
Auto merge of #99320 - NiklasJonsson:84447/rustc_expand, r=compiler-errors

rustc_expand: Switch FxHashMap to FxIndexMap where iteration is used

Relates #84447

23 months agoFix typo/grammar in locator.rs doc comment
Daniel Bevenius [Sat, 23 Jul 2022 05:31:20 +0000 (07:31 +0200)]
Fix typo/grammar in locator.rs doc comment

23 months agoAuto merge of #99599 - RalfJung:miri-stage-0, r=RalfJung
bors [Sat, 23 Jul 2022 05:28:35 +0000 (05:28 +0000)]
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

23 months agoUse span_bug in case of unexpected rib kind
Jordan McQueen [Sat, 23 Jul 2022 04:26:45 +0000 (13:26 +0900)]
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).

23 months agoAuto merge of #93397 - joshtriplett:sort-floats, r=Amanieu
bors [Sat, 23 Jul 2022 02:47:54 +0000 (02:47 +0000)]
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`.

23 months agoAuto merge of #99623 - RalfJung:rollup-0h066kc, r=RalfJung
bors [Sat, 23 Jul 2022 00:01:19 +0000 (00:01 +0000)]
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

23 months agoRollup merge of #99607 - RalfJung:vtable-check, r=eddyb
Ralf Jung [Fri, 22 Jul 2022 21:26:10 +0000 (17:26 -0400)]
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!

23 months agoRollup merge of #99602 - RalfJung:xsv, r=Mark-Simulacrum
Ralf Jung [Fri, 22 Jul 2022 21:26:09 +0000 (17:26 -0400)]
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.

23 months agoRollup merge of #99588 - ehuss:update-books, r=ehuss
Ralf Jung [Fri, 22 Jul 2022 21:26:08 +0000 (17:26 -0400)]
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)

23 months agoAuto merge of #98017 - RalfJung:dereferenceable, r=nikic
bors [Fri, 22 Jul 2022 21:20:35 +0000 (21:20 +0000)]
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.

23 months ago[review] mention that runtime may scale with # of mountpoints
the8472 [Fri, 22 Jul 2022 20:18:07 +0000 (22:18 +0200)]
[review] mention that runtime may scale with # of mountpoints

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
23 months agoUpdate mdbook
Eric Huss [Fri, 22 Jul 2022 18:59:20 +0000 (11:59 -0700)]
Update mdbook

23 months agoadjust UnsafeCell documentation
Ralf Jung [Wed, 22 Jun 2022 21:36:30 +0000 (14:36 -0700)]
adjust UnsafeCell documentation

23 months agodo not mark interior mutable shared refs as dereferenceable
Ralf Jung [Tue, 21 Jun 2022 03:51:15 +0000 (20:51 -0700)]
do not mark interior mutable shared refs as dereferenceable

23 months agorename PointerKind::Shared → SharedMutable to indicate this is NOT the usual shared...
Ralf Jung [Sun, 12 Jun 2022 06:20:00 +0000 (23:20 -0700)]
rename PointerKind::Shared → SharedMutable to indicate this is NOT the usual shared reference

23 months agoAuto merge of #99598 - GuillaumeGomez:clean-trait-fields-on-demand, r=notriddle
bors [Fri, 22 Jul 2022 16:52:10 +0000 (16:52 +0000)]
Auto merge of #99598 - GuillaumeGomez:clean-trait-fields-on-demand, r=notriddle

Make some clean::Trait fields computation on demand

r? `@notriddle`

23 months agoupdate Miri
Ralf Jung [Fri, 22 Jul 2022 16:18:52 +0000 (12:18 -0400)]
update Miri

23 months agocargotest: do not run quickcheck tests in xsv
Ralf Jung [Fri, 22 Jul 2022 13:23:21 +0000 (09:23 -0400)]
cargotest: do not run quickcheck tests in xsv

23 months agointerpret: fix vtable check debug assertion
Ralf Jung [Fri, 22 Jul 2022 14:37:03 +0000 (10:37 -0400)]
interpret: fix vtable check debug assertion

23 months agoAuto merge of #99521 - fee1-dead-contrib:const_fix_hax, r=oli-obk
bors [Fri, 22 Jul 2022 12:48:29 +0000 (12:48 +0000)]
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`

23 months agomiri: make --stage 0 testing work
Ralf Jung [Fri, 22 Jul 2022 11:49:20 +0000 (07:49 -0400)]
miri: make --stage 0 testing work

23 months agoMake some clean::Trait fields computation on demand
Guillaume Gomez [Fri, 22 Jul 2022 12:26:05 +0000 (14:26 +0200)]
Make some clean::Trait fields computation on demand

23 months agoAuto merge of #99491 - workingjubilee:sync-psimd, r=workingjubilee
bors [Fri, 22 Jul 2022 09:48:00 +0000 (09:48 +0000)]
Auto merge of #99491 - workingjubilee:sync-psimd, r=workingjubilee

Sync in portable-simd subtree

r? `@ghost`

23 months agoAuto merge of #99592 - Dylan-DPC:rollup-xlw4wax, r=Dylan-DPC
bors [Fri, 22 Jul 2022 07:12:19 +0000 (07:12 +0000)]
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

23 months agoRollup merge of #99579 - CleanCut:expect-warning, r=joshtriplett
Dylan DPC [Fri, 22 Jul 2022 06:23:43 +0000 (11:53 +0530)]
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`.

23 months agoRollup merge of #99539 - compiler-errors:bidirectional-block-suggestions, r=fee1...
Dylan DPC [Fri, 22 Jul 2022 06:23:42 +0000 (11:53 +0530)]
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?

23 months agoRollup merge of #99423 - GuillaumeGomez:group-css-font-rule, r=notriddle
Dylan DPC [Fri, 22 Jul 2022 06:23:41 +0000 (11:53 +0530)]
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``

23 months agoRollup merge of #99393 - Logarithmus:feature/99255-omit-const-generic-suffixes, r...
Dylan DPC [Fri, 22 Jul 2022 06:23:40 +0000 (11:53 +0530)]
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

23 months agoRollup merge of #98868 - tmiasko:unreachable-coverage, r=wesleywiser
Dylan DPC [Fri, 22 Jul 2022 06:23:40 +0000 (11:53 +0530)]
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.

23 months agoRollup merge of #98174 - Kixunil:rename_ptr_as_mut_const_to_cast, r=scottmcm
Dylan DPC [Fri, 22 Jul 2022 06:23:39 +0000 (11:53 +0530)]
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

23 months agoUpdate books
Eric Huss [Fri, 22 Jul 2022 03:41:44 +0000 (20:41 -0700)]
Update books

23 months agoDon't suggest unnameable generic arguments
León Orell Valerian Liehr [Fri, 22 Jul 2022 00:28:03 +0000 (02:28 +0200)]
Don't suggest unnameable generic arguments

23 months agoAuto merge of #99420 - RalfJung:vtable, r=oli-obk
bors [Fri, 22 Jul 2022 01:33:49 +0000 (01:33 +0000)]
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`

23 months agoadd same warning to Result::expect as Result::unwrap
Nathan Stocks [Fri, 22 Jul 2022 00:15:24 +0000 (18:15 -0600)]
add same warning to Result::expect as Result::unwrap

23 months agoAuto merge of #99530 - RalfJung:miri, r=oli-obk
bors [Thu, 21 Jul 2022 22:24:06 +0000 (22:24 +0000)]
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)

23 months agoupdate Miri
Ralf Jung [Thu, 21 Jul 2022 20:04:37 +0000 (16:04 -0400)]
update Miri

23 months agoAuto merge of #99501 - lcnr:check-regions-infcx, r=oli-obk
bors [Thu, 21 Jul 2022 19:43:21 +0000 (19:43 +0000)]
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

23 months agoAuto merge of #99567 - matthiaskrgr:rollup-08hh3r4, r=matthiaskrgr
bors [Thu, 21 Jul 2022 17:02:31 +0000 (17:02 +0000)]
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

23 months agoAddress more nits
Michael Goulet [Thu, 21 Jul 2022 16:12:57 +0000 (16:12 +0000)]
Address more nits

23 months agoRollup merge of #99559 - GuillaumeGomez:rm-unused-field-keyword, r=notriddle
Matthias Krüger [Thu, 21 Jul 2022 16:42:12 +0000 (18:42 +0200)]
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``

23 months agoRollup merge of #99558 - fee1-dead-contrib:remap_constness_fix, r=oli-obk
Matthias Krüger [Thu, 21 Jul 2022 16:42:11 +0000 (18:42 +0200)]
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

23 months agoRollup merge of #99557 - pierwill:patch-6, r=tmiasko
Matthias Krüger [Thu, 21 Jul 2022 16:42:10 +0000 (18:42 +0200)]
Rollup merge of #99557 - pierwill:patch-6, r=tmiasko

Edit `rustc_index::vec::IndexVec::pick3_mut` docs

Clarify when this method will panic.

Part of #93792.

23 months agoRollup merge of #99552 - lcnr:orphan_check-rework, r=oli-obk
Matthias Krüger [Thu, 21 Jul 2022 16:42:09 +0000 (18:42 +0200)]
Rollup merge of #99552 - lcnr:orphan_check-rework, r=oli-obk

Rewrite `orphan_check_trait_ref` to use a `TypeVisitor`

The current impl is far more confusing than it has any right to be :sparkles:

r? rust-lang/types

23 months agoRollup merge of #99549 - JohnTitor:issue-52304, r=compiler-errors
Matthias Krüger [Thu, 21 Jul 2022 16:42:08 +0000 (18:42 +0200)]
Rollup merge of #99549 - JohnTitor:issue-52304, r=compiler-errors

Add regression test for #52304

Closes #52304
r? ```@compiler-errors```

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agoRollup merge of #99528 - matthiaskrgr:2022_07_perf, r=estebank
Matthias Krüger [Thu, 21 Jul 2022 16:42:07 +0000 (18:42 +0200)]
Rollup merge of #99528 - matthiaskrgr:2022_07_perf, r=estebank

couple of clippy::perf fixes

23 months agoRollup merge of #99526 - compiler-errors:normalize-arg-spans, r=oli-obk
Matthias Krüger [Thu, 21 Jul 2022 16:42:06 +0000 (18:42 +0200)]
Rollup merge of #99526 - compiler-errors:normalize-arg-spans, r=oli-obk

Normalize the arg spans to be within the call span

Makes more sense to point out the arg's span, and not the expression inside the macro

23 months agoRollup merge of #99523 - cuviper:asfd_ptrs-1.64, r=jyn514
Matthias Krüger [Thu, 21 Jul 2022 16:42:05 +0000 (18:42 +0200)]
Rollup merge of #99523 - cuviper:asfd_ptrs-1.64, r=jyn514

Fix the stable version of `AsFd for Arc<T>` and `Box<T>`

These merged in #97437 for 1.64.0, apart from the main `io_safety`
feature that stabilized in 1.63.0.

23 months agoRollup merge of #99454 - benluelo:control-flow/continue-combinators, r=scottmcm
Matthias Krüger [Thu, 21 Jul 2022 16:42:04 +0000 (18:42 +0200)]
Rollup merge of #99454 - benluelo:control-flow/continue-combinators, r=scottmcm

Add map_continue and continue_value combinators to ControlFlow

As suggested in this comment: https://github.com/rust-lang/rust/issues/75744#issuecomment-1188549494

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

r? ``````@scottmcm``````

23 months agoRollup merge of #99413 - steffahn:btree_dropck, r=m-ou-se
Matthias Krüger [Thu, 21 Jul 2022 16:42:02 +0000 (18:42 +0200)]
Rollup merge of #99413 - steffahn:btree_dropck, r=m-ou-se

Add `PhantomData` marker for dropck to `BTreeMap`

closes #99408

23 months agoRollup merge of #98707 - joboet:fuchsia_locks, r=m-ou-se
Matthias Krüger [Thu, 21 Jul 2022 16:42:02 +0000 (18:42 +0200)]
Rollup merge of #98707 - joboet:fuchsia_locks, r=m-ou-se

std: use futex-based locks on Fuchsia

This switches `Condvar` and `RwLock` to the futex-based implementation currently used on Linux and some BSDs. Additionally, `Mutex` now has its own, priority-inheriting implementation based on the mutex in Fuchsia's `libsync`. It differs from the original in that it panics instead of aborting when reentrant locking is detected.

````@rustbot```` ping fuchsia
r? ````@m-ou-se````

23 months agoRename `<*{mut,const} T>::as_{const,mut}` to `cast_`
Martin Habovstiak [Thu, 16 Jun 2022 17:47:24 +0000 (19:47 +0200)]
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.

See #92675

23 months agoUpdate compiler/rustc_mir_transform/src/simplify.rs
Wesley Wiser [Thu, 21 Jul 2022 15:51:40 +0000 (11:51 -0400)]
Update compiler/rustc_mir_transform/src/simplify.rs

23 months agoGeneralize same_type_modulo_infer
Michael Goulet [Thu, 21 Jul 2022 15:45:35 +0000 (15:45 +0000)]
Generalize same_type_modulo_infer

23 months agoRemove unused field in ItemKind::KeywordItem
Guillaume Gomez [Thu, 21 Jul 2022 14:05:17 +0000 (16:05 +0200)]
Remove unused field in ItemKind::KeywordItem

23 months agoFix `remap_constness`
Deadbeef [Thu, 21 Jul 2022 14:02:38 +0000 (14:02 +0000)]
Fix `remap_constness`

`~const Drop` was renamed to `~const Destruct` and this special case should
be removed

23 months agoEdit `rustc_index::vec::IndexVec::pick3_mut` docs
pierwill [Thu, 21 Jul 2022 13:49:53 +0000 (08:49 -0500)]
Edit `rustc_index::vec::IndexVec::pick3_mut` docs

Clarify when this method will panic.

Also fix formatting for `pick2_mut`.

23 months agoAuto merge of #99059 - Amanieu:fix-96797, r=Mark-Simulacrum
bors [Thu, 21 Jul 2022 13:40:28 +0000 (13:40 +0000)]
Auto merge of #99059 - Amanieu:fix-96797, r=Mark-Simulacrum

Add test for #96797

This was fixed in LLVM which was updated in #98285.

https://reviews.llvm.org/D127751

Fixes #96797

23 months agoAdd test for #96797
Amanieu d'Antras [Wed, 8 Jun 2022 22:58:11 +0000 (23:58 +0100)]
Add test for #96797

This was fixed in LLVM which was updated in #98285.

https://reviews.llvm.org/D127751

Fixes #96797

23 months ago`region_outlives_predicate` no snapshot
lcnr [Wed, 20 Jul 2022 09:49:20 +0000 (11:49 +0200)]
`region_outlives_predicate` no snapshot

23 months agomove `considering_regions` to the infcx
lcnr [Wed, 20 Jul 2022 09:40:15 +0000 (11:40 +0200)]
move `considering_regions` to the infcx

23 months agoAuto merge of #98162 - nextsilicon:support_lto_embed_bitcode, r=davidtwco
bors [Thu, 21 Jul 2022 10:13:59 +0000 (10:13 +0000)]
Auto merge of #98162 - nextsilicon:support_lto_embed_bitcode, r=davidtwco

Allow to disable thinLTO buffer to support lto-embed-bitcode lld feature

Hello
This change is to fix issue (https://github.com/rust-lang/rust/issues/84395) in which passing "-lto-embed-bitcode=optimized" to lld when linking rust code via linker-plugin-lto doesn't produce the expected result.

Instead of emitting a single unified module into a llvmbc section of the linked elf, it emits multiple submodules.
This is caused because rustc emits the BC modules after running llvm `createWriteThinLTOBitcodePass` pass.
Which in turn triggers a thinLTO linkage and causes the said issue.

This patch allows via compiler flag (-Cemit-thin-lto=<bool>) to select between running `createWriteThinLTOBitcodePass` and `createBitcodeWriterPass`.
Note this pattern of selecting between those 2 passes is common inside of LLVM code.
The default is to match the old behavior.

23 months agoremove unused import
joboet [Thu, 21 Jul 2022 09:51:26 +0000 (11:51 +0200)]
remove unused import

23 months agorewrite the orphan check to use a type visitor
lcnr [Thu, 21 Jul 2022 09:51:09 +0000 (11:51 +0200)]
rewrite the orphan check to use a type visitor

23 months agoorphan check: opaque types are an error
lcnr [Thu, 21 Jul 2022 08:53:54 +0000 (10:53 +0200)]
orphan check: opaque types are an error

23 months agoAdd regression test for #52304
Yuki Okushi [Thu, 21 Jul 2022 08:08:41 +0000 (17:08 +0900)]
Add regression test for #52304

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
23 months agochange `map_bound(|_| x` to `rebind(x`
Deadbeef [Thu, 21 Jul 2022 07:45:49 +0000 (07:45 +0000)]
change `map_bound(|_| x` to `rebind(x`

23 months agoAnd for patterns too
Michael Goulet [Thu, 21 Jul 2022 01:26:00 +0000 (01:26 +0000)]
And for patterns too

23 months agoDo if-expression obligation stuff less eagerly
Michael Goulet [Thu, 21 Jul 2022 00:03:02 +0000 (00:03 +0000)]
Do if-expression obligation stuff less eagerly

23 months agoResolve vars in same_type_modulo_infer
Michael Goulet [Wed, 20 Jul 2022 23:42:24 +0000 (23:42 +0000)]
Resolve vars in same_type_modulo_infer

23 months agoAuto merge of #93718 - thomcc:used-macho, r=pnkfelix
bors [Thu, 21 Jul 2022 06:59:32 +0000 (06:59 +0000)]
Auto merge of #93718 - thomcc:used-macho, r=pnkfelix

Only compile #[used] as llvm.compiler.used for ELF targets

This returns `#[used]` to how it worked prior to the LLVM 13 update. The intention is not that this is a stable promise.

I'll add tests later today. The tests will test things that we don't actually promise, though.

It's a deliberately small patch, mostly comments. And assuming it's reviewed and lands in time, IMO it should at least be considered for uplifting to beta (so that it can be in 1.59), as the change broke many crates in the ecosystem, even if they are relying on behavior that is not guaranteed.

# Background

LLVM has two ways of preventing removal of an unused variable: `llvm.compiler.used`, which must be present in object files, but allows the linker to remove the value, and `llvm.used` which is supposed to apply to the linker as well, if possible.

Prior to LLVM 13, `llvm.used` and `llvm.compiler.used` were the same on ELF targets, although they were different elsewhere. Prior to our update to LLVM 13, we compiled `#[used]` using `llvm.used` unconditionally, even though we only ever promised behavior like `llvm.compiler.used`.

In LLVM 13, ELF targets gained some support for preventing linker removal of `llvm.used` via the SHF_RETAIN section flag. This has some compatibility issues though: Concretely: some older versions `ld.gold` (specifically ones prior to v2.36, released in Jan 2021) had a bug where it would fail to place a `#[used] #[link_section = ".init_array"]` static in between `__init_array_start`/`__init_array_end`, leading to code that does this failing to run a static constructor. This is technically not a thing we guarantee will work, is a common use case, and is needed in `libstd` (for example, to get access to `std::env::args()` even if Rust does not control `main`, such as when in a `cdylib` crate).

As a result, when updating to LLVM 13, we unconditionally switched to using `llvm.compiler.used`, which mirror the guarantees we make for `#[used]` and doesn't require the latest ld.gold. Unfortunately, this happened to break quite a bit of things in the ecosystem, as non-ELF targets had come to rely on `#[used]` being slightly stronger. In particular, there are cases where it will even break static constructors on these targets[^initinit] (and in fact, breaks way more use cases, as Mach-O uses special sections as an interface to the OS/linker/loader in many places).

As a result, we only switch to `llvm.compiler.used` on ELF[^elfish] targets. The rationale here is:

1. It is (hopefully) identical to the semantics we used prior to the LLVM13 update as prior to that update we unconditionally used `llvm.used`, but on ELF `llvm.used` was the same as `llvm.compiler.used`.

2. It seems to be how Clang compiles this, and given that they have similar (but stronger) compatibility promises, that makes sense.

[^initinit]: For Mach-O targets: It is not always guaranteed that `__DATA,__mod_init_func` is a GC root if it does not have the `S_MOD_INIT_FUNC_POINTERS` flag which we cannot add. In most cases, when ld64 transformed this section into `__DATA_CONST,__mod_init_func` it gets applied, but it's not clear that that is intentional (let alone guaranteed), and the logic is complex enough that it probably happens sometimes, and people in the wild report it occurring.

[^elfish]: Actually, there's not a great way to tell if it's ELF, so I've approximated it.

This is pretty ad-hoc and hacky! We probably should have a firmer set of guarantees here, but this change should relax the pressure on coming up with that considerably, returning it to previous levels.

---

Unsure who should review so leaving it open, but for sure CC `@nikic`

23 months agoAuto merge of #99540 - Mark-Simulacrum:bump-beta, r=jyn514
bors [Thu, 21 Jul 2022 03:17:38 +0000 (03:17 +0000)]
Auto merge of #99540 - Mark-Simulacrum:bump-beta, r=jyn514

Bump to latest beta bootstrap compiler

Hopefully this will address https://github.com/rust-lang/rust/issues/99538, but I'm not sure we can confirm that without rolling it out. Should be safe in general, so likely little risk to just landing this.

23 months agoBump to latest beta
Mark Rousskov [Thu, 21 Jul 2022 01:36:08 +0000 (01:36 +0000)]
Bump to latest beta

23 months agoIntroduce core::simd trait imports in tests
Jubilee Young [Thu, 21 Jul 2022 01:08:14 +0000 (18:08 -0700)]
Introduce core::simd trait imports in tests

23 months agoSync core::simd up to rust-lang/portable-simd@2e081db92aa3ee0a4563bc28ce01bdad5b1b2efd
Jubilee Young [Thu, 21 Jul 2022 00:57:56 +0000 (17:57 -0700)]
Sync core::simd up to rust-lang/portable-simd@2e081db92aa3ee0a4563bc28ce01bdad5b1b2efd

23 months agoFix doctest imports using as_crate feature
The Atelier [Thu, 21 Jul 2022 00:23:46 +0000 (17:23 -0700)]
Fix doctest imports using as_crate feature

Within core, `use self::` does not work to import these items.
And because core is not core_simd, neither does the existing `use`.
So, use this quirky hack instead, switching the import on a feature.

23 months agodetect bad vptrs on dyn calls
Ralf Jung [Wed, 20 Jul 2022 22:33:51 +0000 (18:33 -0400)]
detect bad vptrs on dyn calls

23 months agoAuto merge of #99058 - michaelwoerister:remove-stable-set-and-map, r=nagisa
bors [Wed, 20 Jul 2022 22:19:30 +0000 (22:19 +0000)]
Auto merge of #99058 - michaelwoerister:remove-stable-set-and-map, r=nagisa

Remove the unused StableSet and StableMap types from rustc_data_structures.

The current implementation is not "stable" in the same sense that `HashStable` and `StableHasher` are stable, i.e. across compilation sessions. So, in my opinion, it's better to remove those types (which are basically unused anyway) than to give the wrong impression that these are safe for incr. comp.

I plan to provide new "stable" collection types soon that can be used to replace `FxHashMap` and `FxHashSet` in query results (see [draft](https://github.com/michaelwoerister/rust/commit/69d03ac7a7d651a397ab793e9d78f8fce3edf7a6)). It's unsound that `HashMap` and `HashSet` implement `HashStable` (see https://github.com/rust-lang/rust/issues/98890 for a recent P-critical bug caused by this) -- so we should make some progress there.

23 months agodetect bad vtables on an upcast
Ralf Jung [Wed, 20 Jul 2022 15:36:19 +0000 (11:36 -0400)]
detect bad vtables on an upcast

23 months agovarious nits from review
Ralf Jung [Wed, 20 Jul 2022 14:47:49 +0000 (10:47 -0400)]
various nits from review

23 months agoadd range metadata to alignment loads
Ralf Jung [Wed, 20 Jul 2022 14:45:09 +0000 (10:45 -0400)]
add range metadata to alignment loads

23 months agoMove vtable_size and vtable_align impls to cg_ssa
bjorn3 [Wed, 20 Jul 2022 13:40:30 +0000 (13:40 +0000)]
Move vtable_size and vtable_align impls to cg_ssa

23 months agoImplement vtable_size and vtable_align intrinsics for cg_clif
bjorn3 [Wed, 20 Jul 2022 13:36:58 +0000 (13:36 +0000)]
Implement vtable_size and vtable_align intrinsics for cg_clif

23 months agobless some tests
Ralf Jung [Wed, 20 Jul 2022 00:49:16 +0000 (20:49 -0400)]
bless some tests

23 months agoslightly cleaner, if more verbose, vtable handling in codegen backends
Ralf Jung [Wed, 20 Jul 2022 00:19:15 +0000 (20:19 -0400)]
slightly cleaner, if more verbose, vtable handling in codegen backends

23 months agoconsistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)
Ralf Jung [Tue, 19 Jul 2022 23:57:44 +0000 (19:57 -0400)]
consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)

23 months agouse extern type for extra opaqueness
Ralf Jung [Tue, 19 Jul 2022 23:57:25 +0000 (19:57 -0400)]
use extern type for extra opaqueness

23 months agoincorporate some review feedback
Ralf Jung [Tue, 19 Jul 2022 23:50:04 +0000 (19:50 -0400)]
incorporate some review feedback

23 months agoadd intrinsic to access vtable size and align
Ralf Jung [Mon, 18 Jul 2022 13:48:20 +0000 (09:48 -0400)]
add intrinsic to access vtable size and align

23 months agowe seem to monomorphize fewer vtables by default now, so adjust some tests
Ralf Jung [Sun, 17 Jul 2022 20:17:25 +0000 (16:17 -0400)]
we seem to monomorphize fewer vtables by default now, so adjust some tests

23 months agomake use of symbolic vtables in interpreter
Ralf Jung [Sun, 17 Jul 2022 20:02:49 +0000 (16:02 -0400)]
make use of symbolic vtables in interpreter

23 months agorename get_global_alloc to try_get_global_alloc
Ralf Jung [Sun, 17 Jul 2022 15:40:34 +0000 (11:40 -0400)]
rename get_global_alloc to try_get_global_alloc