]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoport `codegen_module` activity to arg recorder API
Rémy Rakic [Thu, 7 Apr 2022 08:32:58 +0000 (10:32 +0200)]
port `codegen_module` activity to arg recorder API

2 years agoremove allocation from a self-profiling call in the LLVM backend
Rémy Rakic [Fri, 1 Apr 2022 19:10:44 +0000 (21:10 +0200)]
remove allocation from a self-profiling call in the LLVM backend

2 years agosimplify a self-profiling activity call in the cg_gcc backend
Rémy Rakic [Fri, 1 Apr 2022 19:02:14 +0000 (21:02 +0200)]
simplify a self-profiling activity call in the cg_gcc backend

2 years agosimplify a self-profiling activity call in the LLVM backend
Rémy Rakic [Fri, 1 Apr 2022 19:01:47 +0000 (21:01 +0200)]
simplify a self-profiling activity call in the LLVM backend

and so that it doesn't allocate unless event argument recording is turned on

2 years agoadd `generic_activity_with_arg_recorder` to the self-profiler
Rémy Rakic [Fri, 1 Apr 2022 18:54:12 +0000 (20:54 +0200)]
add `generic_activity_with_arg_recorder` to the self-profiler

This allows profiling costly arguments to be recorded only when `-Zself-profile-events=args` is on: using a closure that takes an `EventArgRecorder` and call its `record_arg` or `record_args` methods.

2 years agoturn `exec` comment into doc comment
Rémy Rakic [Fri, 1 Apr 2022 18:50:16 +0000 (20:50 +0200)]
turn `exec` comment into doc comment

2 years agoAuto merge of #95760 - Dylan-DPC:rollup-uskzggh, r=Dylan-DPC
bors [Thu, 7 Apr 2022 09:50:11 +0000 (09:50 +0000)]
Auto merge of #95760 - Dylan-DPC:rollup-uskzggh, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #95189 (Stop flagging unexpected inner attributes as outer ones in certain diagnostics)
 - #95752 (Regression test for #82866)
 - #95753 (Correct safety reasoning in `str::make_ascii_{lower,upper}case()`)
 - #95757 (Use gender neutral terms)

Failed merges:

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

2 years agoRollup merge of #95757 - zofrex:gender-neutral-terms, r=dtolnay
Dylan DPC [Thu, 7 Apr 2022 09:17:17 +0000 (11:17 +0200)]
Rollup merge of #95757 - zofrex:gender-neutral-terms, r=dtolnay

Use gender neutral terms

#95508 was not executed well, but it did find a couple of legitimate issues: some uses of unnecessarily gendered language, and some typos. This PR fixes (properly) the legitimate issues it found.

2 years agoRollup merge of #95753 - ChayimFriedman2:patch-1, r=dtolnay
Dylan DPC [Thu, 7 Apr 2022 09:17:16 +0000 (11:17 +0200)]
Rollup merge of #95753 - ChayimFriedman2:patch-1, r=dtolnay

Correct safety reasoning in `str::make_ascii_{lower,upper}case()`

I don't understand why the previous comment was used (it was inserted in #66564), but it doesn't explain why these functions are safe, only why `str::as_bytes{_mut}()` are safe.

If someone thinks they make perfect sense, I'm fine with closing this PR.

2 years agoRollup merge of #95752 - compiler-errors:issue-82866, r=Dylan-DPC
Dylan DPC [Thu, 7 Apr 2022 09:17:14 +0000 (11:17 +0200)]
Rollup merge of #95752 - compiler-errors:issue-82866, r=Dylan-DPC

Regression test for #82866

Saw that this issue was open when i was cleaning my old branch for #92237.
I am also not opposed to not adding an extra test and just closing #82866.

Fixes #82866

2 years agoRollup merge of #95189 - fmease:fix-issue-94340, r=estebank
Dylan DPC [Thu, 7 Apr 2022 09:17:13 +0000 (11:17 +0200)]
Rollup merge of #95189 - fmease:fix-issue-94340, r=estebank

Stop flagging unexpected inner attributes as outer ones in certain diagnostics

Fixes #94340.

In the issue to-be-fixed I write that the general message _an inner attribute is not permitted in this context_ should be more specific noting that the “context” is the `include` macro. This, however, cannot be achieved without touching a lot of things and passing a flag to the `parse_expr` and `parse_item` calls in `expand_include`. This seems rather hacky to me. That's why I left it as it. `Span::from_expansion` does not apply either AFAIK.

`@rustbot` label A-diagnostics T-compiler

2 years agoUse gender neutral terms
James 'zofrex' Sanderson [Thu, 7 Apr 2022 07:51:59 +0000 (08:51 +0100)]
Use gender neutral terms

2 years agoAuto merge of #95678 - pietroalbini:pa-1.62.0-bootstrap, r=Mark-Simulacrum
bors [Thu, 7 Apr 2022 07:34:04 +0000 (07:34 +0000)]
Auto merge of #95678 - pietroalbini:pa-1.62.0-bootstrap, r=Mark-Simulacrum

Bump bootstrap compiler to 1.61.0 beta

This PR bumps the bootstrap compiler to the 1.61.0 beta. The first commit changes the stage0 compiler, the second commit applies the "mechanical" changes and the third and fourth commits apply changes explained in the relevant comments.

r? `@Mark-Simulacrum`

2 years agoAuto merge of #95748 - Dylan-DPC:rollup-t208j51, r=Dylan-DPC
bors [Thu, 7 Apr 2022 05:12:08 +0000 (05:12 +0000)]
Auto merge of #95748 - Dylan-DPC:rollup-t208j51, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #95352 ([bootstrap] Print the full relative path to failed tests)
 - #95646 (Mention `std::env::var` in `env!`)
 - #95708 (Update documentation for `trim*` and `is_whitespace` to include newlines)
 - #95714 (Add test for issue #83474)
 - #95725 (Message: Chunks cannot have a size of zero.)

Failed merges:

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

2 years agoCorrect safety reasoning in `str::make_ascii_{lower,upper}case()`
Chayim Refael Friedman [Thu, 7 Apr 2022 04:52:07 +0000 (07:52 +0300)]
Correct safety reasoning in `str::make_ascii_{lower,upper}case()`

2 years agoregression test for #82866
Michael Goulet [Thu, 7 Apr 2022 04:43:34 +0000 (21:43 -0700)]
regression test for #82866

2 years agoRollup merge of #95725 - hkBst:patch-1, r=Dylan-DPC
Dylan DPC [Thu, 7 Apr 2022 04:04:54 +0000 (06:04 +0200)]
Rollup merge of #95725 - hkBst:patch-1, r=Dylan-DPC

Message: Chunks cannot have a size of zero.

Add a message to the assertion that chunks cannot have a size of zero.

2 years agoRollup merge of #95714 - KSBilodeau:master, r=Dylan-DPC
Dylan DPC [Thu, 7 Apr 2022 04:04:54 +0000 (06:04 +0200)]
Rollup merge of #95714 - KSBilodeau:master, r=Dylan-DPC

Add test for issue #83474

Adds test for https://github.com/rust-lang/rust/issues/83474 - second attempt at PR https://github.com/rust-lang/rust/pull/91821 which was abandoned.

2 years agoRollup merge of #95708 - fee1-dead:doc_whitespace_trim, r=Dylan-DPC
Dylan DPC [Thu, 7 Apr 2022 04:04:52 +0000 (06:04 +0200)]
Rollup merge of #95708 - fee1-dead:doc_whitespace_trim, r=Dylan-DPC

Update documentation for `trim*` and `is_whitespace` to include newlines

2 years agoRollup merge of #95646 - mgeisler:mention-std-env-var, r=Dylan-DPC
Dylan DPC [Thu, 7 Apr 2022 04:04:52 +0000 (06:04 +0200)]
Rollup merge of #95646 - mgeisler:mention-std-env-var, r=Dylan-DPC

Mention `std::env::var` in `env!`

When searching for how to read an environment variable, I first encountered the `env!` macro. It would have been useful to me if the documentation had included a link to `std::env::var`, which is what I was actually looking for.

2 years agoRollup merge of #95352 - jyn514:full-relative-path, r=Mark-Simulacrum
Dylan DPC [Thu, 7 Apr 2022 04:04:51 +0000 (06:04 +0200)]
Rollup merge of #95352 - jyn514:full-relative-path, r=Mark-Simulacrum

[bootstrap] Print the full relative path to failed tests

Before:
```
failures:
    [ui] rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.rs

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 163 filtered out; finished in 0.45s
```

After:
```
failures:
    [ui] src/test/rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.rs

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 163 filtered out; finished in 0.45s
```

This allows copy pasting the path or using Ctrl+Click in IDEs to go directly to the file, instead of having to edit the filename first.

2 years agoUpdate library/core/src/slice/mod.rs
Dylan DPC [Thu, 7 Apr 2022 02:44:30 +0000 (04:44 +0200)]
Update library/core/src/slice/mod.rs

Co-authored-by: Janusz Marcinkiewicz <virrages@gmail.com>
2 years agoremove exclamation mark
Dylan DPC [Thu, 7 Apr 2022 02:44:11 +0000 (04:44 +0200)]
remove exclamation mark

Co-authored-by: Janusz Marcinkiewicz <virrages@gmail.com>
2 years agoAuto merge of #95688 - pfmooney:libc-update, r=Mark-Simulacrum
bors [Thu, 7 Apr 2022 02:41:28 +0000 (02:41 +0000)]
Auto merge of #95688 - pfmooney:libc-update, r=Mark-Simulacrum

Update libc to 0.2.121

With the updated libc, UNIX stack overflow handling in libstd can now
use the common `si_addr` accessor function, rather than attempting to
use a field from that name in `siginfo_t`.  This simplifies the
collection of the fault address, particularly on platforms where that
data resides within a union in `siginfo_t`.

2 years agoAuto merge of #95745 - Dylan-DPC:rollup-485ajqi, r=Dylan-DPC
bors [Thu, 7 Apr 2022 00:15:18 +0000 (00:15 +0000)]
Auto merge of #95745 - Dylan-DPC:rollup-485ajqi, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #95185 (Stabilize Stdin::lines.)
 - #95626 (Don't cast thread name to an integer for prctl)
 - #95709 (Improve terse test output.)
 - #95735 (Revert "Mark Location::caller() as #[inline]")
 - #95738 (Switch item-info from div to span)

Failed merges:

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

2 years agoRollup merge of #95738 - GuillaumeGomez:item-info-switch-to-span, r=jsha
Dylan DPC [Wed, 6 Apr 2022 23:59:24 +0000 (01:59 +0200)]
Rollup merge of #95738 - GuillaumeGomez:item-info-switch-to-span, r=jsha

Switch item-info from div to span

Following discussion in #95684.

cc `@jsha`
r? `@notriddle`

2 years agoRollup merge of #95735 - bjorn3:revert_inline_location_caller, r=compiler-errors
Dylan DPC [Wed, 6 Apr 2022 23:59:24 +0000 (01:59 +0200)]
Rollup merge of #95735 - bjorn3:revert_inline_location_caller, r=compiler-errors

Revert "Mark Location::caller() as #[inline]"

This reverts https://github.com/rust-lang/rust/pull/95619. As noted in https://github.com/rust-lang/rust/pull/95619#issuecomment-1088548140 this seems to break several tests with cg_clif.

2 years agoRollup merge of #95709 - nnethercote:improve-terse-test-output, r=Dylan-DPC
Dylan DPC [Wed, 6 Apr 2022 23:59:23 +0000 (01:59 +0200)]
Rollup merge of #95709 - nnethercote:improve-terse-test-output, r=Dylan-DPC

Improve terse test output.

The current terse output gives 112 chars per line, which causes
wraparound for people using 100 char wide terminals, which is very
common.

This commit changes it to be exactly 100 wide, which makes the output
look much nicer.

2 years agoRollup merge of #95626 - saethlin:pass-pointer-to-prctl, r=cuviper
Dylan DPC [Wed, 6 Apr 2022 23:59:22 +0000 (01:59 +0200)]
Rollup merge of #95626 - saethlin:pass-pointer-to-prctl, r=cuviper

Don't cast thread name to an integer for prctl

`libc::prctl` and the `prctl` definitions in glibc, musl, and the kernel headers are C variadic functions. Therefore, all the arguments (except for the first) are untyped. It is only the Linux man page which says that `prctl` takes 4 `unsigned long` arguments. I have no idea why it says this.

In any case, the upshot is that we don't need to cast the pointer to an integer and confuse Miri.

But in light of this... what are we doing with those three `0`s? We're passing 3 `i32`s to `prctl`, which doesn't fill me with confidence. The man page says `unsigned long` and all the constants in the linux kernel are macros for expressions of the form `1UL << N`. I'm mostly commenting on this because looks a whole lot like some UB that was found in SQLite a few years ago: <https://youtu.be/LbzbHWdLAI0?t=1925> that was related to accidentally passing a 32-bit value from a literal `0` instead of a pointer-sized value. This happens to work on x86 due to the size of pointers and happens to work on x86_64 due to the calling convention. But also, there is no good reason for an implementation to be looking at those arguments. Some other calls to `prctl` require that other arguments be zeroed, but not `PR_SET_NAME`... so why are we even passing them?

I would prefer to end such questions by either passing 3 `libc::c_ulong`, or not passing those at all, but I'm not sure which is better.

2 years agoRollup merge of #95185 - m-ou-se:stabilize-stdin-lines, r=Mark-Simulacrum
Dylan DPC [Wed, 6 Apr 2022 23:59:21 +0000 (01:59 +0200)]
Rollup merge of #95185 - m-ou-se:stabilize-stdin-lines, r=Mark-Simulacrum

Stabilize Stdin::lines.

Closes https://github.com/rust-lang/rust/issues/87096

Fcp completed here: https://github.com/rust-lang/rust/issues/87096#issuecomment-1028792980

2 years agoAuto merge of #95742 - Dylan-DPC:rollup-8n7o87y, r=Dylan-DPC
bors [Wed, 6 Apr 2022 21:15:16 +0000 (21:15 +0000)]
Auto merge of #95742 - Dylan-DPC:rollup-8n7o87y, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #95342 (Ignore "format the world" commit in git blame)
 - #95353 ([bootstrap] Give a hard error when filtering tests for a file that does not exist)
 - #95649 (New mir-opt deref_separator)
 - #95721 (Fix typo in bootstrap/setup.rs)
 - #95730 (Rename RWLock to RwLock in std::sys.)
 - #95731 (Check that all hidden types are the same and then deduplicate them.)

Failed merges:

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

2 years agoChange trailing prctl arguments to c_ulong
Ben Kimock [Wed, 6 Apr 2022 21:11:50 +0000 (17:11 -0400)]
Change trailing prctl arguments to c_ulong

2 years agoRollup merge of #95731 - oli-obk:lazy_tait_regression, r=compiler-errors
Dylan DPC [Wed, 6 Apr 2022 21:06:10 +0000 (23:06 +0200)]
Rollup merge of #95731 - oli-obk:lazy_tait_regression, r=compiler-errors

Check that all hidden types are the same and then deduplicate them.

fixes #95538

This used to trigger a sanity check. Now we accept that there may be multiple places where a hidden type is constrained and we merge all of these at the end.

Ideally we'd merge eagerly, but that is a larger refactoring that I don't want to put into a backport

2 years agoRollup merge of #95730 - m-ou-se:rwlock-case, r=Dylan-DPC
Dylan DPC [Wed, 6 Apr 2022 21:06:08 +0000 (23:06 +0200)]
Rollup merge of #95730 - m-ou-se:rwlock-case, r=Dylan-DPC

Rename RWLock to RwLock in std::sys.

std::sync::RwLock is spelled with two capital letters, but std::sys's RWLock was spelled with three capital letters. This cleans that up and uses `RwLock` everywhere.

2 years agoRollup merge of #95721 - xu-cheng:typo, r=compiler-errors
Dylan DPC [Wed, 6 Apr 2022 21:06:07 +0000 (23:06 +0200)]
Rollup merge of #95721 - xu-cheng:typo, r=compiler-errors

Fix typo in bootstrap/setup.rs

2 years agoRollup merge of #95649 - ouz-a:mir-opt, r=oli-obk
Dylan DPC [Wed, 6 Apr 2022 21:06:06 +0000 (23:06 +0200)]
Rollup merge of #95649 - ouz-a:mir-opt, r=oli-obk

New mir-opt deref_separator

This adds a new mir-opt that split certain derefs into this form:
`let x = (*a.b).c;` to => `tmp = a.b; let x = (*tmp).c;`

Huge thanks to ``@oli-obk`` for his patient mentoring.

2 years agoRollup merge of #95353 - jyn514:invalid-filter-hard-error, r=Mark-Simulacrum
Dylan DPC [Wed, 6 Apr 2022 21:06:05 +0000 (23:06 +0200)]
Rollup merge of #95353 - jyn514:invalid-filter-hard-error, r=Mark-Simulacrum

[bootstrap] Give a hard error when filtering tests for a file that does not exist

A common issue people run into when running compiletest is that filtering for files that don't exist is only a warning and not an error; running the whole test suite instead.
See for example https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Question.20about.20compiletest.
This is especially bad when using `--bless`, which will modify all `.stderr` files.

Change bootstrap to require valid filters instead of discarding invalid filters and continuing.

Before:

```
Warning: Skipping "/home/jnelson/rust-lang/rust/src/test/rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.r": not a regular file or directory
Check compiletest suite=rustdoc-ui mode=ui (x86_64-unknown-linux-gnu(x86_64-unknown-linux-gnu) -> x86_64-unknown-linux-gnu(x86_64-unknown-linux-gnu))

running 163 tests
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii.......................... 100/163
...............................................................
test result: ok. 89 passed; 0 failed; 74 ignored; 0 measured; 0 filtered out; finished in 7.20s

        finished in 7.248 seconds
Build completed successfully in 0:00:08
```

After:
```
thread 'main' panicked at 'Invalid test suite filter "/home/jnelson/rust-lang/rust/src/test/rustdoc-ui/intra-doc/feature-gate-intra-doc-pointers.r": file or directory does not exist', src/bootstrap/util.rs:311:
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Build completed unsuccessfully in 0:00:08
```

2 years agoRollup merge of #95342 - jyn514:ignore-revs, r=Mark-Simulacrum
Dylan DPC [Wed, 6 Apr 2022 21:06:04 +0000 (23:06 +0200)]
Rollup merge of #95342 - jyn514:ignore-revs, r=Mark-Simulacrum

Ignore "format the world" commit in git blame

This tells github to hide it in its blame view: https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view
It can also be used locally by running `git config blame.ignorerevsfile .git-blame-ignore-revs` (although it's advised to avoid `--global` since git gives a hard error when the file doesn't exist).

We may want to add more commits in later PRs, but this should be a good start.

Before: ![image](https://user-images.githubusercontent.com/23638587/160255130-d7283cc4-4d33-4a7d-bc70-f9ce6820293c.png)
After: ![image](https://user-images.githubusercontent.com/23638587/160255138-90d0325a-e063-4e0e-8cfb-732724bf6c60.png)
cc https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Hide.20some.20commits.20in.20GitHub.20blame

2 years agofix regression caused by rust-lang/cargo#10448
Pietro Albini [Wed, 6 Apr 2022 21:04:03 +0000 (23:04 +0200)]
fix regression caused by rust-lang/cargo#10448

2 years agoUpdate rustdoc test following DOM change
Guillaume Gomez [Wed, 6 Apr 2022 18:41:57 +0000 (20:41 +0200)]
Update rustdoc test following DOM change

2 years agoSwitch item-info div to span to generate valid HTML
Guillaume Gomez [Wed, 6 Apr 2022 18:41:44 +0000 (20:41 +0200)]
Switch item-info div to span to generate valid HTML

2 years agoStop flagging certain inner attrs as outer ones
León Orell Valerian Liehr [Mon, 21 Mar 2022 23:36:47 +0000 (00:36 +0100)]
Stop flagging certain inner attrs as outer ones

2 years agoRevert "Mark Location::caller() as #[inline]"
bjorn3 [Wed, 6 Apr 2022 16:45:11 +0000 (18:45 +0200)]
Revert "Mark Location::caller() as #[inline]"

This reverts commit 6d0b61e2f598c1d1102ea9b6f22c4d0e71e5f967.

2 years agoAuto merge of #95669 - nnethercote:call-compute_locs-once-per-rule, r=petrochenkov
bors [Wed, 6 Apr 2022 16:29:32 +0000 (16:29 +0000)]
Auto merge of #95669 - nnethercote:call-compute_locs-once-per-rule, r=petrochenkov

Call `compute_locs` once per rule

This fixes the small regressions on `wg-grammar` and `hyper-0.14.18` seen in #95555.

r? `@petrochenkov`

2 years agoBump stabilization of stdin_forwarders to 1.62.0.
Mara Bos [Wed, 6 Apr 2022 15:26:33 +0000 (17:26 +0200)]
Bump stabilization of stdin_forwarders to 1.62.0.

2 years agoCheck that all hidden types are the same and then deduplicate them.
Oli Scherer [Wed, 6 Apr 2022 15:02:37 +0000 (15:02 +0000)]
Check that all hidden types are the same and then deduplicate them.

2 years agoRename RWLock to RwLock in std::sys.
Mara Bos [Wed, 6 Apr 2022 14:33:53 +0000 (16:33 +0200)]
Rename RWLock to RwLock in std::sys.

2 years agoAuto merge of #95707 - RalfJung:initialized, r=oli-obk
bors [Wed, 6 Apr 2022 14:07:27 +0000 (14:07 +0000)]
Auto merge of #95707 - RalfJung:initialized, r=oli-obk

interp/validity: enforce Scalar::Initialized

This is a follow-up to https://github.com/rust-lang/rust/pull/94527, to also account for the new kind of `Scalar` layout inside the validity checker.

r? `@oli-obk`

2 years agoMention `std::env::var` in `env!`
Martin Geisler [Mon, 4 Apr 2022 14:22:02 +0000 (16:22 +0200)]
Mention `std::env::var` in `env!`

When searching for how to read an environment variable, I first encountered the `env!` macro. It would have been useful to me if the documentation had included a link to `std::env::var`, which is what I was actually looking for.

2 years agoAuto merge of #95723 - SparrowLii:const_goto, r=fee1-dead
bors [Wed, 6 Apr 2022 10:08:08 +0000 (10:08 +0000)]
Auto merge of #95723 - SparrowLii:const_goto, r=fee1-dead

enhance `ConstGoto` mir-opt by moving up `StorageDead` statements

From the `FIXME` in the implementation of `ConstGoto` miropt. We can move `StorageDead` statements up to the predecessor. This can expand the scope of application of this opt.

2 years agoremove ~const Drop from rustdoc test
Pietro Albini [Wed, 6 Apr 2022 08:35:49 +0000 (10:35 +0200)]
remove ~const Drop from rustdoc test

2 years agoMessage: Chunks cannot have a size of zero.
Marijn Schouten [Wed, 6 Apr 2022 07:54:43 +0000 (09:54 +0200)]
Message: Chunks cannot have a size of zero.

Add a message to the assertion that chunks cannot have a size of zero.

2 years agobless tests
Pietro Albini [Wed, 6 Apr 2022 07:29:58 +0000 (09:29 +0200)]
bless tests

2 years agoenhance `ConstGoto` mir-opt by moving up `StorageDead` statements
SparrowLii [Wed, 6 Apr 2022 07:17:41 +0000 (15:17 +0800)]
enhance `ConstGoto` mir-opt by moving up `StorageDead` statements

2 years agoAuto merge of #95720 - ehuss:update-cargo, r=ehuss
bors [Wed, 6 Apr 2022 06:08:47 +0000 (06:08 +0000)]
Auto merge of #95720 - ehuss:update-cargo, r=ehuss

Update cargo

5 commits in 1ef1e0a12723ce9548d7da2b63119de9002bead8..e2e2dddebe66dfc1403a312653557e332445308b
2022-03-31 00:17:18 +0000 to 2022-04-05 17:04:53 +0000
- Part 2 of RFC2906 -- allow inheriting from a different `Cargo.toml` (rust-lang/cargo#10517)
- File Cache is valid if checkout or contents hasn't changed (rust-lang/cargo#10507)
- Fix how scrape-examples handles proc macros (rust-lang/cargo#10533)
- tools: update checkout action on CI (rust-lang/cargo#10521)
- Don't error if no binaries were installed (rust-lang/cargo#10508)

2 years agoFix typo in bootstrap/setup.rs
Cheng XU [Wed, 6 Apr 2022 05:52:30 +0000 (22:52 -0700)]
Fix typo in bootstrap/setup.rs

2 years agoUpdate cargo
Eric Huss [Wed, 6 Apr 2022 04:19:53 +0000 (21:19 -0700)]
Update cargo

2 years agoAuto merge of #95711 - Dylan-DPC:rollup-ujss3oi, r=Dylan-DPC
bors [Wed, 6 Apr 2022 03:45:36 +0000 (03:45 +0000)]
Auto merge of #95711 - Dylan-DPC:rollup-ujss3oi, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #95659 (Rely on #[link] attribute for unwind on Fuchsia.)
 - #95684 (rustdoc: Fix item info display overflow)
 - #95693 (interp: pass TyCtxt to Machine methods that do not take InterpCx)
 - #95699 (fix: Vec leak when capacity is 0)

Failed merges:

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

2 years agoMerge remote-tracking branch 'origin/master'
kangarooCoder [Wed, 6 Apr 2022 02:50:12 +0000 (21:50 -0500)]
Merge remote-tracking branch 'origin/master'

2 years agoAdd test for issue rust-lang/rust#83474
kangarooCoder [Wed, 6 Apr 2022 02:45:07 +0000 (21:45 -0500)]
Add test for issue rust-lang/rust#83474

2 years agoRollup merge of #95699 - SparkyPotato:master, r=dtolnay
Dylan DPC [Wed, 6 Apr 2022 01:39:09 +0000 (03:39 +0200)]
Rollup merge of #95699 - SparkyPotato:master, r=dtolnay

fix: Vec leak when capacity is 0

When `RawVec::with_capacity_in` is called with capacity 0, an allocation of size 0 is allocated.
However, `<RawVec as Drop>::drop` doesn't deallocate, since it only checks if capacity was 0. Fixed by not allocating when capacity is 0.

2 years agoRollup merge of #95693 - RalfJung:more-context, r=oli-obk
Dylan DPC [Wed, 6 Apr 2022 01:39:08 +0000 (03:39 +0200)]
Rollup merge of #95693 - RalfJung:more-context, r=oli-obk

interp: pass TyCtxt to Machine methods that do not take InterpCx

This just seems like something you might need, so let's consistently have it.

One day we might have to add `ParamEnv` as well, though that seems less likely (and in Miri you can always use `reveal_all` anyway). It might make sense to have a type that packages `TyCtxt` and `ParamEnv`, this pairing occurs quite frequently in rustc...

r? `@oli-obk`

2 years agoRollup merge of #95684 - GuillaumeGomez:fix-item-info-overflow, r=notriddle
Dylan DPC [Wed, 6 Apr 2022 01:39:08 +0000 (03:39 +0200)]
Rollup merge of #95684 - GuillaumeGomez:fix-item-info-overflow, r=notriddle

rustdoc: Fix item info display overflow

I came across this issue when reading local `Iterator` docs (reproduced in this screenshot):

![Screenshot from 2022-04-05 17-45-13](https://user-images.githubusercontent.com/3050060/161798150-769ee838-4768-4df8-9d34-b02eb8104eed.png)

The problem comes from the fact that `span` isn't `display: block` by default. Since `item-info` was already present on `<div>` in other places, I moved the last one to `div` as well.

r? `@notriddle`

2 years agoRollup merge of #95659 - anp:remove-link-print, r=tmandry
Dylan DPC [Wed, 6 Apr 2022 01:39:07 +0000 (03:39 +0200)]
Rollup merge of #95659 - anp:remove-link-print, r=tmandry

Rely on #[link] attribute for unwind on Fuchsia.

Closes #95575.

2 years agoAuto merge of #95469 - ChrisDenton:unsound-read-write, r=joshtriplett
bors [Wed, 6 Apr 2022 01:23:08 +0000 (01:23 +0000)]
Auto merge of #95469 - ChrisDenton:unsound-read-write, r=joshtriplett

Fix unsound `File` methods

This is a draft attempt to fix #81357. *EDIT*: this PR now tackles `read()`, `write()`, `read_at()`, `write_at()` and `read_buf`. Still needs more testing though.

cc `@jstarks,` can you confirm the the Windows team is ok with the Rust stdlib using `NtReadFile` and `NtWriteFile`?

~Also, I'm provisionally using `CancelIo` in a last ditch attempt to recover but I'm not sure that this is actually a good idea. Especially as getting into this state would be a programmer error so aborting the process is justified in any case.~ *EDIT*: removed, see comments.

2 years agoImprove terse test output.
Nicholas Nethercote [Wed, 6 Apr 2022 01:09:16 +0000 (11:09 +1000)]
Improve terse test output.

The current terse output gives 112 chars per line, which causes
wraparound for people using 100 char wide terminals, which is very
common.

This commit changes it to be exactly 100 wide, which makes the output
look much nicer.

2 years agoUpdate documentation for `trim*` and `is_whitespace` to include newlines
Deadbeef [Wed, 6 Apr 2022 01:03:36 +0000 (11:03 +1000)]
Update documentation for `trim*` and `is_whitespace` to include newlines

2 years agoCall `compute_locs` once per rule.
Nicholas Nethercote [Tue, 5 Apr 2022 06:34:46 +0000 (16:34 +1000)]
Call `compute_locs` once per rule.

Currently it's called in `parse_tt` every time a match rule is invoked.
This commit moves it so it's called instead once per match rule, in
`compile_declarative_macro. This is a performance win.

The commit also moves `compute_locs` out of `TtParser`, because there's
no longer any reason for it to be in there.

2 years agointerp/validity: enforce Scalar::Initialized
Ralf Jung [Tue, 5 Apr 2022 23:14:35 +0000 (19:14 -0400)]
interp/validity: enforce Scalar::Initialized

2 years agoAuto merge of #95702 - Dylan-DPC:rollup-793rz6v, r=Dylan-DPC
bors [Tue, 5 Apr 2022 22:42:04 +0000 (22:42 +0000)]
Auto merge of #95702 - Dylan-DPC:rollup-793rz6v, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #88025 (ScmCredentials netbsd implementation.)
 - #95473 (track individual proc-macro expansions in the self-profiler)
 - #95547 (caution against ptr-to-int transmutes)
 - #95585 (Explain why `&T` is cloned when `T` is not `Clone`)
 - #95591 (Use revisions to track NLL test output (part 1))
 - #95663 (diagnostics: give a special note for unsafe fn / Fn/FnOnce/FnMut)
 - #95673 (:arrow_up: rust-analyzer)
 - #95681 (resolve: Fix resolution of empty paths passed from rustdoc)

Failed merges:

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

2 years agorustdoc changes for ~const Drop
Pietro Albini [Tue, 5 Apr 2022 13:11:13 +0000 (15:11 +0200)]
rustdoc changes for ~const Drop

2 years agorustc_trait_selection changes
Pietro Albini [Tue, 5 Apr 2022 13:09:41 +0000 (15:09 +0200)]
rustc_trait_selection changes

2 years agotrivial cfg(bootstrap) changes
Pietro Albini [Tue, 5 Apr 2022 20:42:23 +0000 (22:42 +0200)]
trivial cfg(bootstrap) changes

2 years agoRollup merge of #95681 - petrochenkov:doclinkregr2, r=Dylan-DPC
Dylan DPC [Tue, 5 Apr 2022 20:59:01 +0000 (22:59 +0200)]
Rollup merge of #95681 - petrochenkov:doclinkregr2, r=Dylan-DPC

resolve: Fix resolution of empty paths passed from rustdoc

Fixes https://github.com/rust-lang/rust/pull/95337#issuecomment-1088426179

2 years agoRollup merge of #95673 - lnicola:rust-analyzer-2022-04-05, r=lnicola
Dylan DPC [Tue, 5 Apr 2022 20:59:00 +0000 (22:59 +0200)]
Rollup merge of #95673 - lnicola:rust-analyzer-2022-04-05, r=lnicola

:arrow_up: rust-analyzer

r? ``@ghost``

2 years agoRollup merge of #95663 - notriddle:notriddle/unsafe-fn-closure, r=compiler-errors
Dylan DPC [Tue, 5 Apr 2022 20:58:59 +0000 (22:58 +0200)]
Rollup merge of #95663 - notriddle:notriddle/unsafe-fn-closure, r=compiler-errors

diagnostics: give a special note for unsafe fn / Fn/FnOnce/FnMut

Fixes #90073

2 years agoRollup merge of #95591 - jackh726:nll-revisions-1, r=oli-obk
Dylan DPC [Tue, 5 Apr 2022 20:58:58 +0000 (22:58 +0200)]
Rollup merge of #95591 - jackh726:nll-revisions-1, r=oli-obk

Use revisions to track NLL test output (part 1)

The idea here is 2 fold: 1) When we eventually do make NLL default on, that PR should be systematic in "delete revisions and corresponding error annotations" 2) This allows us to look at test NLL outputs in chunks. (Though, I've opted here not to "mark" these tests. There are some tests with NLL revisions *now* that will be missed. I expect we do a second pass once we have all the tests with NLL revisions; these tests should be easy enough to eyeball.)

The actual review here should be "easy", but a bit tedious. I expect we should manually go through each test output and confirm it's okay.

The majority of these are either: 1) Only span change (the one I see most common is highlighting an entire function call, rather than just the function name in that call) 2) "E0308 mismatched types" -> "lifetime does not live long enough" 3) "E0495 cannot infer an appropriate lifetime for lifetime parameter" -> "lifetime does not live long enough" 4) "E0312 lifetime of reference outlives lifetime of borrowed content" -> "lifetime does not live long enough" 5) "E0759 `XXX` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement" -> "lifetime does not live long enough" 6) "E0623 lifetime mismatch" -> "lifetime does not live long enough"

Other than the now lack of an error code, most of these look fine (with most giving more helpful suggestions now).

`rfc1623` output isn't great.

cc ``@marmeladema`` if you want to look through these

Let's r? ``@oli-obk`` since you've commented on the Zulip thread ;)

2 years agoRollup merge of #95585 - compiler-errors:ref-clone, r=estebank
Dylan DPC [Tue, 5 Apr 2022 20:58:57 +0000 (22:58 +0200)]
Rollup merge of #95585 - compiler-errors:ref-clone, r=estebank

Explain why `&T` is cloned when `T` is not `Clone`

Fixes #95535

2 years agoRollup merge of #95547 - RalfJung:ptr-int-transmutes, r=scottmcm
Dylan DPC [Tue, 5 Apr 2022 20:58:56 +0000 (22:58 +0200)]
Rollup merge of #95547 - RalfJung:ptr-int-transmutes, r=scottmcm

caution against ptr-to-int transmutes

I don't know how strong of a statement we want to make here, but I am very concerned that the current docs could be interpreted as saying that ptr-to-int transmutes are just as okay as transmuting `*mut T` into an `&mut T`.

Examples [like this](https://github.com/rust-lang/unsafe-code-guidelines/issues/286#issuecomment-1085144431) show that ptr-to-int transmutes are deeply suspicious -- they are either UB, or they don't round-trip properly, or we have to basically say that `transmute` will actively look for pointers and do all the things a ptr-to-int cast does (which includes a global side-effect of marking the pointed-to allocation as 'exposed').

Another alternative might be to simply not talk about them... but we *do* want people to use casts rather than transmutes for this.

Cc `@rust-lang/lang`

2 years agoRollup merge of #95473 - lqd:macro-expansion, r=petrochenkov
Dylan DPC [Tue, 5 Apr 2022 20:58:55 +0000 (22:58 +0200)]
Rollup merge of #95473 - lqd:macro-expansion, r=petrochenkov

track individual proc-macro expansions in the self-profiler

As described in [this zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Macro.20expansion.20performance.20on.20complex.20macros/near/275063190), users don't currently have a lot of information to diagnose macro expansion performance issues. That comment suggests using the macro names to add further timing information.

This PR starts to do this for proc-macros which have the same issue, and performance problems happening in the wild in [this other zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/Identifying.20proc-macro.20slowdowns) could be helped by such information.

It uses the available proc-macro name to track their individual expansions with self-profiling events.

r? `@Aaron1011` who mentioned this idea originally

2 years agoRollup merge of #88025 - devnexen:netbsd_scm_creds, r=Amanieu
Dylan DPC [Tue, 5 Apr 2022 20:58:54 +0000 (22:58 +0200)]
Rollup merge of #88025 - devnexen:netbsd_scm_creds, r=Amanieu

ScmCredentials netbsd implementation.

2 years agobump stage0 to the latest beta
Pietro Albini [Tue, 5 Apr 2022 12:37:41 +0000 (14:37 +0200)]
bump stage0 to the latest beta

2 years agoAuto merge of #95035 - m-ou-se:futex-locks-on-linux, r=Amanieu
bors [Tue, 5 Apr 2022 20:17:08 +0000 (20:17 +0000)]
Auto merge of #95035 - m-ou-se:futex-locks-on-linux, r=Amanieu

Replace Linux Mutex and Condvar with futex based ones.

Tracking issue: https://github.com/rust-lang/rust/issues/93740

2 years agoformatting
SparkyPotato [Tue, 5 Apr 2022 20:06:46 +0000 (01:36 +0530)]
formatting

2 years agocleanup
SparkyPotato [Tue, 5 Apr 2022 20:06:24 +0000 (01:36 +0530)]
cleanup

2 years agofix Vec leak with 0 capacity
SparkyPotato [Tue, 5 Apr 2022 20:02:26 +0000 (01:32 +0530)]
fix Vec leak with 0 capacity

2 years agokill temp early
ouz-a [Tue, 5 Apr 2022 19:38:03 +0000 (22:38 +0300)]
kill temp early

2 years agodiagnostics: tweak error message to give more rationale to unsafe Fn
Michael Howell [Tue, 5 Apr 2022 18:13:48 +0000 (11:13 -0700)]
diagnostics: tweak error message to give more rationale to unsafe Fn

2 years agointerp: pass TyCtxt to Machine methods that do not take InterpCx
Ralf Jung [Tue, 5 Apr 2022 17:31:51 +0000 (13:31 -0400)]
interp: pass TyCtxt to Machine methods that do not take InterpCx

2 years agoAuto merge of #94527 - oli-obk:undef_scalars, r=nagisa,erikdesjardin
bors [Tue, 5 Apr 2022 16:46:13 +0000 (16:46 +0000)]
Auto merge of #94527 - oli-obk:undef_scalars, r=nagisa,erikdesjardin

Let CTFE to handle partially uninitialized unions without marking the entire value as uninitialized.

follow up to #94411

To fix https://github.com/rust-lang/rust/issues/69488 and by extension fix https://github.com/rust-lang/rust/issues/94371, we should stop treating types like `MaybeUninit<usize>` as something that the `Scalar` type in the interpreter engine can represent. So we add a new field to `abi::Primitive` that records whether the primitive is nested in a union

cc `@RalfJung`

r? `@ghost`

2 years agoExplain why `&T` is cloned when `T` is not `Clone`
Michael Goulet [Sat, 2 Apr 2022 07:23:52 +0000 (00:23 -0700)]
Explain why `&T` is cloned when `T` is not `Clone`

2 years agoUpdate libc to 0.2.121
Patrick Mooney [Mon, 4 Apr 2022 17:55:30 +0000 (17:55 +0000)]
Update libc to 0.2.121

With the updated libc, UNIX stack overflow handling in libstd can now
use the common `si_addr` accessor function, rather than attempting to
use a field from that name in `siginfo_t`.  This simplifies the
collection of the fault address, particularly on platforms where that
data resides within a union in `siginfo_t`.

2 years agoUpdate browser-ui-test version to 0.8.5
Guillaume Gomez [Tue, 5 Apr 2022 16:05:12 +0000 (18:05 +0200)]
Update browser-ui-test version to 0.8.5

2 years agoAdd GUI test to ensure that the width of the item-info does not overflow its parent
Guillaume Gomez [Tue, 5 Apr 2022 16:04:16 +0000 (18:04 +0200)]
Add GUI test to ensure that the width of the item-info does not overflow its parent

2 years agoGenerate a <div> instead of a <span> for item-info elements
Guillaume Gomez [Tue, 5 Apr 2022 16:03:30 +0000 (18:03 +0200)]
Generate a <div> instead of a <span> for item-info elements

2 years agounboxed-closures and type-alias-impl-trait nll revisions
Jack Huey [Sat, 2 Apr 2022 15:08:16 +0000 (11:08 -0400)]
unboxed-closures and type-alias-impl-trait nll revisions

2 years agounderscore-lifetime nll revisions
Jack Huey [Sat, 2 Apr 2022 02:29:27 +0000 (22:29 -0400)]
underscore-lifetime nll revisions

2 years agoMore nll revisions
Jack Huey [Sat, 2 Apr 2022 02:12:17 +0000 (22:12 -0400)]
More nll revisions

2 years agoMove some tests with compare-mode=nll output to revisions
Jack Huey [Fri, 1 Apr 2022 23:51:50 +0000 (19:51 -0400)]
Move some tests with compare-mode=nll output to revisions

2 years agoReword comment in futex condvar implementation.
Mara Bos [Tue, 5 Apr 2022 15:08:12 +0000 (17:08 +0200)]
Reword comment in futex condvar implementation.