Commit graph

143217 commits

Author SHA1 Message Date
Ian Jackson
8832b0a81c Fix typo in doc
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-05-12 11:12:19 +01:00
Ian Jackson
60a4d9612d unix: impl ExitStatusExt for ExitStatusError
It is unergnomic to have to say things like
   bad.into_status().signal()

Implementing `ExitStatusExt` for `ExitStatusError` fixes this.
Unfortunately it does mean making a previously-infallible method
capable of panicing, although of course the existing impl remains
infallible.

The alternative would be a whole new `ExitStatusErrorExt` trait.

`<ExitStatus as ExitStatusExt>::into_raw()` is not particularly
ergonomic to call because of the often-required type annotation.
See for example the code in the test case in
  library/std/src/sys/unix/process/process_unix/tests.rs

Perhaps we should provide equivalent free functions for `ExitStatus`
and `ExitStatusExt` in std::os::unix::process and maybe deprecate this
trait method.  But I think that is for the future.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-05-12 11:12:19 +01:00
Ian Jackson
e893089ea0 Provide ExitStatusError
Closes #73125

This is in pursuance of
  Issue #73127 Consider adding #[must_use] to std::process::ExitStatus

In
  MR #81452 Add #[must_use] to [...] process::ExitStatus
we concluded that the existing arrangements in are too awkward
so adding that #[must_use] is blocked on improving the ergonomics.

I wrote a mini-RFC-style discusion of the approach in
  https://github.com/rust-lang/rust/issues/73125#issuecomment-771092741

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-05-12 11:12:19 +01:00
Ian Jackson
b50c1bbb0e windows: provide NonZeroDWORD
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-05-10 11:18:08 +01:00
bors
2fb1dee14b Auto merge of #85104 - hi-rustin:rustin-patch-typo, r=jonas-schievink
Fix typo
2021-05-10 07:15:23 +00:00
bors
00f2bf40d6 Auto merge of #85074 - GuillaumeGomez:end-toggle-migration, r=jsha
Migrate top doc and non-exhaustive toggles to details tag

Fixes #83332.

r? `@jsha`
2021-05-10 04:05:55 +00:00
bors
d29289c509 Auto merge of #84507 - crlf0710:codegen_nonlocal_main_wrapper, r=nagisa
Add primary marker on codegen unit and generate main wrapper on primary codegen.

This is the codegen part of changes extracted from #84062.

This add a marker called `primary` on each codegen units, where exactly one codegen unit will be `primary = true` at a time. This specific codegen unit will take charge of generating `main` wrapper when `main` is imported from a foreign crate after the implementation of RFC 1260.

cc #28937

I'm not sure who should i ask for review for codegen changes, so feel free to reassign.
r? `@nagisa`
2021-05-10 00:42:31 +00:00
Guillaume Gomez
3837c1ce33 Update rustdoc test 2021-05-10 00:09:57 +02:00
Guillaume Gomez
4edcf61479 End toggle migration 2021-05-10 00:09:57 +02:00
bors
c55c26cb36 Auto merge of #83800 - xobs:impl-16351-nightly, r=nagisa
Add default search path to `Target::search()`

The function `Target::search()` accepts a target triple and returns a `Target` struct defining the requested target.

There is a `// FIXME 16351: add a sane default search path?` comment that indicates it is desirable to include some sort of default. This was raised in https://github.com/rust-lang/rust/issues/16351 which was closed without any resolution.

https://github.com/rust-lang/rust/pull/31117 was proposed, however that has platform-specific logic that is unsuitable for systems without `/etc/`.

This patch implements the suggestion raised in https://github.com/rust-lang/rust/issues/16351#issuecomment-180878193 where a `target.json` file may be placed in `$(rustc --print sysroot)/lib/rustlib/<target-triple>/target.json`. This allows shipping a toolchain distribution as a single file that gets extracted to the sysroot.
2021-05-09 22:01:26 +00:00
bors
ca82264ec7 Auto merge of #85065 - Mark-Simulacrum:preds-no-alloc, r=jackh726
Avoid predecessors having Drop impls

Should be a simple win - but let's make sure with perf.
2021-05-09 19:01:05 +00:00
bors
7a2f446889 Auto merge of #83894 - nikic:newpm, r=nagisa
Improve support for NewPM

This adds various missing bits of support for NewPM and allows us to successfully run stage 2 tests with NewPM enabled.

This does not yet enable NewPM by default, as there are still known issue on LLVM 12 (such as a weak fat LTO pipeline). The plan is to make the switch after we update to LLVM 13.
2021-05-09 16:19:21 +00:00
bors
bba8710616 Auto merge of #83596 - jyn514:session-dead-code, r=oli-obk
Remove dead or useless code from Session

This is a more principled follow-up to https://github.com/rust-lang/rust/pull/83185#discussion_r601753839.

- Rename `Parser::span_fatal_err` -> `Parser::span_err`
- Remove some unnecessary uses of `struct_span_fatal`
- Make `Diagnostic::span_fatal` unconditionally raise an error
- Add `impl Deref<Target = Handler>` for Session and remove all functions that are exactly the same as their Handler counterparts
- Note why `Handler::fatal` is different from `Sesssion::fatal`
- Remove unused `opt_span_warn` function

r? `@oli-obk` or `@estebank`
2021-05-09 13:38:17 +00:00
bors
19dae7b453 Auto merge of #85093 - camelid:remove-fake-expect_local, r=GuillaumeGomez
Remove `FakeDefId::expect_local()`

This function returned a fake `DefIndex`, with no indication that it was
fake, when it was provided with a `FakeDefId::Fake`. Every use of the
function uses the returned `DefIndex` in a call to
`tcx.local_def_id_to_hir_id()`, which I'm pretty sure would panic if it
were given a fake `DefIndex`.

I removed the function and replaced all calls to it with a call to
`expect_real()` followed by `DefId::expect_local()` (that's a function
on the *real* `DefId`).
2021-05-09 11:17:17 +00:00
hi-rustin
fc544abe03 Fix typo 2021-05-09 12:24:58 +08:00
Joshua Nelson
f25aa5767f Remove unused opt_span_warn function 2021-05-08 23:14:09 -04:00
Joshua Nelson
ebbc949575 Note why Handler::fatal is different from Sesssion::fatal 2021-05-08 23:13:04 -04:00
Joshua Nelson
96509b4835 Make Diagnostic::span_fatal unconditionally raise an error
It had no callers which didn't immediately call `raise()`, and this
unifies the behavior with `Session`.
2021-05-08 23:12:04 -04:00
Joshua Nelson
e49f4471aa Remove some unnecessary uses of struct_span_fatal
All of them immediately called `emit()` then `raise()`, so they could
just call `span_fatal` directly.
2021-05-08 23:12:04 -04:00
Joshua Nelson
955fdaea4a Rename Parser::span_fatal_err -> Parser::span_err
The name was misleading, it wasn't actually a fatal error.
2021-05-08 23:11:59 -04:00
Charles Lew
89a67051a7 Add primary marker on codegen unit to take charge of main_wrapper for non-local cases. 2021-05-09 10:52:03 +08:00
bors
d6d028369b Auto merge of #83089 - Aaron1011:bootstrap-semi, r=Mark-Simulacrum
Enable `-W semicolon_in_expressions_from_macros` in bootstrap

Now that stdarch has been updated, we can do this without breaking the
build.
2021-05-08 23:11:45 +00:00
Camelid
4b7c8b0b53 Add #[track_caller] to FakeDefId::expect_real()
Now, in the case that the function is not inlined, the panic location
will be the caller's location, which is more helpful since the panic is
not `expect_real()`'s fault.
2021-05-08 15:35:44 -07:00
Camelid
ba13225ba1 Remove FakeDefId::expect_local()
This function returned a fake `DefIndex`, with no indication that it was
fake, when it was provided with a `FakeDefId::Fake`. Every use of the
function uses the returned `DefIndex` in a call to
`tcx.local_def_id_to_hir_id()`, which I'm pretty sure would panic if it
were given a fake `DefIndex`.

I removed the function and replaced all calls to it with a call to
`expect_real()` followed by `DefId::expect_local()` (that's a function
on the *real* `DefId`).
2021-05-08 15:35:44 -07:00
Aaron Hill
020d83d9f5
Enable -W semicolon_in_expressions_from_macros in bootstrap
Now that stdarch has been updated, we can do this without breaking the
build.
2021-05-08 18:15:14 -04:00
bors
881c1ac408 Auto merge of #83278 - Amanieu:bump_stdarch, r=Mark-Simulacrum
Bump stdarch submodule

Major changes:
- More AVX-512 intrinsics.
- More ARM & AArch64 NEON intrinsics.
- Updated unstable WASM intrinsics to latest draft standards.
- Intrinsics that previously used `#[rustc_args_required_const]` now use const generics. See #83167 for more details.
- `std_detect` is now a separate crate instead of a submodule of `std`.
2021-05-08 18:41:16 +00:00
Amanieu d'Antras
bf8b15f553 Bump stdarch submodule 2021-05-08 19:40:27 +01:00
bors
ff34b91907 Auto merge of #85072 - hyd-dev:miri, r=RalfJung
Update Miri

Fixes #85027

r? `@RalfJung`
2021-05-08 12:11:01 +00:00
hyd-dev
b55d9c0387
Update Miri 2021-05-08 19:53:15 +08:00
bors
bef3dc5b7f Auto merge of #84470 - jyn514:lints, r=GuillaumeGomez
rustdoc: Stop special casing `broken_intra_doc_links` unnecessarily
2021-05-08 09:46:18 +00:00
Nikita Popov
1b928ff8f8 Update LLVM submodule
This updates the LLVM submodule with recent LLVM 12.x fixes. In
particular, it resolves an assertion failure when targeting
AArch64 at O0.
2021-05-08 11:01:09 +02:00
Nikita Popov
c2b15a6b64 Support -C passes in NewPM
And report an error if parsing the additional pass pipeline fails.
Threading through the error accounts for most of the changes here.
2021-05-08 10:58:08 +02:00
Nikita Popov
5519cbfe33 Don't force -O1 with ThinLTO
This doesn't seem to be necessary anymore, although I don't know
at which point or why that changed.

Forcing -O1 makes some tests fail under NewPM, because NewPM also
performs inlining at -O1, so it ends up performing much more
optimization in practice than before.
2021-05-08 10:58:08 +02:00
Nikita Popov
7c4989ab70 Drop -opt-bisect-limit=0 flag from test
This causes an assertion failure under NewPM, because it also ends
up disabling the NameAnonGlobals pass.

Instead pass -Copt-level=0 to disable optimizations. If that should
be insufficient, we can use -C no-prepopulate-passes.
2021-05-08 10:58:08 +02:00
Nikita Popov
db140de8f2 Explicitly register GCOV profiling pass as well 2021-05-08 10:58:08 +02:00
Nikita Popov
5ecbe7fcf8 Explicitly register instrprof pass
Don't use "passes" for this purpose, explicitly insert it into
the correct place in the pipeline instead.
2021-05-08 10:58:08 +02:00
Nikita Popov
0318883cd6 Make -Z new-llvm-pass-manager an Option<bool>
To allow it to have an LLVM version dependent default.
2021-05-08 10:58:08 +02:00
bors
50e1dc1536 Auto merge of #85059 - ehuss:update-cargo, r=ehuss
Update cargo

7 commits in f3e13226d6d17a2bc5f325303494b43a45f53b7f..e51522ab3db23b0d8f1de54eb1f0113924896331
2021-04-30 21:50:27 +0000 to 2021-05-07 21:29:52 +0000
- Add CARGO_TARGET_TMPDIR env var for integration tests & benches (rust-lang/cargo#9375)
- Bump to 0.55.0, update changelog (rust-lang/cargo#9464)
- Some updates to the unstable documentation (rust-lang/cargo#9457)
- Add CARGO_PROFILE_&lt;name&gt;_SPLIT_DEBUGINFO to env docs. (rust-lang/cargo#9456)
- Add `report` subcommand. (rust-lang/cargo#9438)
- Respect Cargo.toml `[package.exclude]` even not in a git repo. (rust-lang/cargo#9186)
- Document the other crates in the codebase in the contrib guide. (rust-lang/cargo#9439)
2021-05-08 05:50:00 +00:00
bors
e002ac7e8a Auto merge of #85058 - Xanewok:update-rls, r=Xanewok
Update RLS

This mostly just includes e33f4e6849 so that this fixes #85055 (clippy-related breakage).
2021-05-08 02:57:40 +00:00
Mark Rousskov
0367e24f94 Avoid predecessors having Drop impls 2021-05-07 22:44:08 -04:00
bors
abf3ec5b33 Auto merge of #85057 - Dylan-DPC:rollup-efaseq2, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #76808 (Improve diagnostics for functions in `struct` definitions)
 - #84887 (Remove SpanInterner::get)
 - #85034 (fix null pointer error messages)
 - #85038 (Don't stop running rustdoc-gui tests at first failure)
 - #85044 (Use `path.exists()` instead of `fs::metadata(path).is_ok()`)
 - #85052 (rustdoc: Link to the docs on namespaces when an unknown disambiguator is found)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-08 00:37:38 +00:00
Eric Huss
b0e49c798b Update cargo 2021-05-07 16:51:52 -07:00
Igor Matuszewski
3a17b01058 Update RLS 2021-05-08 01:10:51 +02:00
Dylan DPC
885231768b
Rollup merge of #85052 - jyn514:disambiguator, r=camelid
rustdoc: Link to the docs on namespaces when an unknown disambiguator is found

This was reverted in https://github.com/rust-lang/rust/pull/84950; this re-lands the changes, but without different behavior depending on the channel.

r? `@camelid` cc `@pietroalbini`
2021-05-08 01:06:27 +02:00
Dylan DPC
b5092627c7
Rollup merge of #85044 - ChrisDenton:file-exists, r=jackh726
Use `path.exists()` instead of `fs::metadata(path).is_ok()`

It's more explicit and potentially allows platforms to optimize the existence check.
2021-05-08 01:06:26 +02:00
Dylan DPC
b4a00205d8
Rollup merge of #85038 - GuillaumeGomez:dont-stop-first-rustdoc-gui-failure, r=Mark-Simulacrum
Don't stop running rustdoc-gui tests at first failure

I just realized that before this PR, the rustdoc-gui test suite was stopping at the first failure, which isn't very convenient. All tests are now running and if one failed, it returns an error at the end once all tests have run.

r? `@Mark-Simulacrum`
2021-05-08 01:06:25 +02:00
Dylan DPC
bba8f99281
Rollup merge of #85034 - RalfJung:null-ptr, r=oli-obk
fix null pointer error messages

I got the `match` in https://github.com/rust-lang/rust/pull/84972 wrong, this fixes that.
Also avoid redundant "inbounds test failed:" prefix.

Should fix https://github.com/rust-lang/rust/issues/85027

r? `@oli-obk`
2021-05-08 01:06:24 +02:00
Dylan DPC
44bee536fe
Rollup merge of #84887 - jyn514:index-span, r=Xanewok
Remove SpanInterner::get

- It's used exactly once, so it's trivial to replace
- It doesn't match the normal convention for containers: normally
`get()` returns an option and indexing panics. Instead `SpanInterner::get()` panics
  and there's no indexing operation available.
2021-05-08 01:06:23 +02:00
Dylan DPC
eb36bc666a
Rollup merge of #76808 - LeSeulArtichaut:diagnose-functions-struct, r=jackh726
Improve diagnostics for functions in `struct` definitions

Tries to implement #76421.
This is probably going to need unit tests, but I wanted to hear from review all the cases tests should cover.

I'd like to follow up with the "mechanically applicable suggestion here that adds an impl block" step, but I'd need guidance. My idea for now would be to try to parse a function, and if that succeeds, create a dummy `ast::Item` impl block to then format it using `pprust`. Would that be a viable approach? Is there a better alternative?

r? `@matklad` cc `@estebank`
2021-05-08 01:06:22 +02:00
bors
467253ff6a Auto merge of #83901 - cjgillot:hash-attr, r=wesleywiser
Integrate attributes as part of the crate hash

r? `@Aaron1011`
2021-05-07 21:56:31 +00:00