Commit graph

143036 commits

Author SHA1 Message Date
Ian Jackson
1b1bf24636 std panicking: Provide panic::always_abort
We must change the atomic read on panic entry to `Acquire`, to pick up
a possible an `always_panic` on another thread.

We add `count` to the names of panic_count::get and ::is_zaero,
because now there is another reason why panic ought to maybe abort.
Renaming these ensures that we have checked every call site to ensure
that they don't need further adjustment.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
2021-05-07 11:17:44 +01:00
Ian Jackson
a9f43a2a8f std panicking: Make decrease() return ()
Nothing uses the return value.  This will make the next changes
easier.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-05-07 11:17:44 +01:00
bors
ac888e8675 Auto merge of #85022 - JohnTitor:rollup-2q4706v, r=JohnTitor
Rollup of 9 pull requests

Successful merges:

 - #84779 (Add support for --test-args to cargotest)
 - #84781 (Don't check bootstrap artifacts by default)
 - #84787 (bump deps)
 - #84815 (Update coverage docs and command line help)
 - #84875 (Removes unneeded check of `#[no_coverage]` in mapgen)
 - #84897 (Coverage instruments closure bodies in macros (not the macro body))
 - #84911 (Retry clang+llvm download)
 - #84972 (CTFE inbounds-error-messages tweak)
 - #84990 (Sort rustdoc-gui tests)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-07 07:44:53 +00:00
Yuki Okushi
87faf2e64f
Rollup merge of #84990 - GuillaumeGomez:sort-rustdoc-gui-tests, r=Mark-Simulacrum
Sort rustdoc-gui tests

The rustdoc-gui tests were randomly run. Not really a big issue but I prefer the tests to be sorted.
2021-05-07 15:20:30 +09:00
Yuki Okushi
47050275f4
Rollup merge of #84972 - RalfJung:null-ptr-msg, r=oli-obk
CTFE inbounds-error-messages tweak

* use CheckInAllocMsg::PointerArithmeticTest for ptr_offset error
* nicer errors for some null pointer cases

r? `@oli-obk`
2021-05-07 15:20:29 +09:00
Yuki Okushi
326fec27a6
Rollup merge of #84911 - Mark-Simulacrum:retry-clang, r=pietroalbini
Retry clang+llvm download

We've been seeing a pretty high rate of spurious network failures (e.g., openssl
connection reset by peer). Not clear why, but let's add a retry.

r? `@pietroalbini`
2021-05-07 15:20:28 +09:00
Yuki Okushi
343a094aa1
Rollup merge of #84897 - richkadel:cover-closure-macros, r=tmandry
Coverage instruments closure bodies in macros (not the macro body)

Fixes: #84884

This solution might be considered a compromise, but I think it is the
better choice.

The results in the `closure.rs` test correctly resolve all test cases
broken as described in #84884.

One test pattern (in both `closure_macro.rs` and
`closure_macro_async.rs`) was also affected, and removes coverage
statistics for the lines inside the closure, because the closure
includes a macro. (The coverage remains at the callsite of the macro, so
we lose some detail, but there isn't a perfect choice with macros.

Often macro implementations are split across the macro and the callsite,
and there doesn't appear to be a single "right choice" for which body
should be covered. For the current implementation, we can't do both.

The callsite is most likely to be the preferred site for coverage.

r? `@tmandry`
cc: `@wesleywiser`
2021-05-07 15:20:26 +09:00
Yuki Okushi
b088318985
Rollup merge of #84875 - richkadel:no-coverage-dont-check-unused, r=tmandry
Removes unneeded check of `#[no_coverage]` in mapgen

There is an anticipated feature request to support a compiler flag that
only adds coverage for specific files (or perhaps mods). As I thought
about where that change would need to be supported, I realized that
checking the attribute in mapgen (for unused functions) was unnecessary.
The unused functions are only synthesized if they have MIR coverage, and
functions with the `no_coverage` attribute will not have been
instrumented with MIR coverage statements in the first place.

New tests confirm this.

Also, while adding tests, I updated resolved comments and FIXMEs in
other tests, and expanded comments and tests on one remaining issue that
is still not resolved.

r? `@tmandry`
cc: `@wesleywiser`
2021-05-07 15:20:25 +09:00
Yuki Okushi
283ef86784
Rollup merge of #84815 - richkadel:coverage-docs-update-2021-05, r=tmandry
Update coverage docs and command line help

r? `@tmandry`
cc: `@wesleywiser`
2021-05-07 15:20:24 +09:00
Yuki Okushi
246e8d17ff
Rollup merge of #84787 - klensy:deps-bump, r=Mark-Simulacrum
bump deps

openssl vulns:
https://rustsec.org/advisories/RUSTSEC-2021-0056.html
https://rustsec.org/advisories/RUSTSEC-2021-0055.html

openssl-src v111.12.0+1.1.1h -> v111.15.0+1.1.1k

not latest, but newer
openssl-sys v0.9.58 -> v0.9.61
openssl v0.10.30 -> v0.10.33

curl vulns: https://curl.se/docs/vuln-7.74.0.html

curl v0.4.34 -> v0.4.36
curl-sys v0.4.39+curl-7.74.0 -> v0.4.42+curl-7.76.0
2021-05-07 15:20:23 +09:00
Yuki Okushi
1224e1341a
Rollup merge of #84781 - jyn514:check-bootstrap, r=Mark-Simulacrum
Don't check bootstrap artifacts by default

Bootstrap has to build successfully or this won't run, so all it checks
are the tests, which are uncommon to change.

Fixes https://github.com/rust-lang/rust/issues/76624.
2021-05-07 15:20:22 +09:00
Yuki Okushi
2d496f46bf
Rollup merge of #84779 - jyn514:cargotest-args, r=Mark-Simulacrum
Add support for --test-args to cargotest

This allows running a single test without having to wait for all tests
to complete.

Closes https://github.com/rust-lang/rust/issues/77260.
2021-05-07 15:20:21 +09:00
bors
1773f14a24 Auto merge of #85014 - Dylan-DPC:rollup-jzpbkdu, r=Dylan-DPC
Rollup of 11 pull requests

Successful merges:

 - #84409 (Ensure TLS destructors run before thread joins in SGX)
 - #84500 (Add --run flag to compiletest)
 - #84728 (Add test for suggestion to borrow unsized function parameters)
 - #84734 (Add `needs-unwind` and beginning of support for testing `panic=abort` std to compiletest)
 - #84755 (Allow using `core::` in intra-doc links within core itself)
 - #84871 (Disallows `#![feature(no_coverage)]` on stable and beta (using standard crate-level gating))
 - #84872 (Wire up tidy dependency checks for cg_clif)
 - #84896 (Handle incorrect placement of parentheses in trait bounds more gracefully)
 - #84905 (CTFE engine: rename copy → copy_intrinsic, move to intrinsics.rs)
 - #84953 (Remove unneeded call to with_default_session_globals in rustdoc highlight)
 - #84987 (small nits)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-07 01:16:08 +00:00
Dylan DPC
01e9d09d3b
Rollup merge of #84987 - lcnr:nits, r=Mark-Simulacrum
small nits
2021-05-07 00:38:45 +02:00
Dylan DPC
3c5da6e6b9
Rollup merge of #84953 - GuillaumeGomez:remove-unneeded-with_default_session_globals, r=jyn514
Remove unneeded call to with_default_session_globals in rustdoc highlight

This was the origin of the `Span` bug in https://github.com/rust-lang/rust/pull/84176.

cc `````@Aaron1011`````
r? `````@jyn514`````
2021-05-07 00:38:44 +02:00
Dylan DPC
eec3ae3feb
Rollup merge of #84905 - RalfJung:copy, r=oli-obk
CTFE engine: rename copy → copy_intrinsic, move to intrinsics.rs

The `copy` name is confusing for this function because we also have `copy_op` which is pretty different. I hope `copy_intrinsic` is clearer. Also `step.rs` should really just contain the main loop and opcode dispatch, so move this helper function to a more appropriate place.

r? ``````@oli-obk``````
2021-05-07 00:38:43 +02:00
Dylan DPC
b44e56f968
Rollup merge of #84896 - estebank:issue-84772, r=jackh726
Handle incorrect placement of parentheses in trait bounds more gracefully

Fix #84772.

CC ``````@jonhoo``````
2021-05-07 00:38:42 +02:00
Dylan DPC
746f97e969
Rollup merge of #84872 - bjorn3:cg_clif_tidy, r=Mark-Simulacrum
Wire up tidy dependency checks for cg_clif

Also contains a fix and improvement to tidy.

Required for https://github.com/rust-lang/rust/pull/81746.
2021-05-07 00:38:41 +02:00
Dylan DPC
aaf23892ab
Rollup merge of #84871 - richkadel:no-coverage-unstable-only, r=nagisa
Disallows `#![feature(no_coverage)]` on stable and beta (using standard crate-level gating)

Fixes: #84836

Removes the function-level feature gating solution originally implemented, and solves the same problem using `allow_internal_unstable`, so normal crate-level feature gating mechanism can still be used (which disallows the feature on stable and beta).

I tested this, building the compiler with and without `CFG_DISABLE_UNSTABLE_FEATURES=1`

With unstable features disabled, I get the expected result as shown here:

```shell
$ ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc     src/test/run-make-fulldeps/coverage/no_cov_crate.rs
error[E0554]: `#![feature]` may not be used on the dev release channel
 --> src/test/run-make-fulldeps/coverage/no_cov_crate.rs:2:1
  |
2 | #![feature(no_coverage)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0554`.
```

r? ````@Mark-Simulacrum````
cc: ````@tmandry```` ````@wesleywiser````
2021-05-07 00:38:40 +02:00
Dylan DPC
7835c7802d
Rollup merge of #84755 - jyn514:core-links, r=kennytm
Allow using `core::` in intra-doc links within core itself

I came up with this idea ages ago, but rustdoc used to ICE on it. Now it doesn't.

Helps with https://github.com/rust-lang/rust/issues/73445. Doesn't fix it completely since `extern crate self as std;` in std still gives strange errors.
2021-05-07 00:38:38 +02:00
Dylan DPC
577f1d007d
Rollup merge of #84734 - tmandry:compiletest-needs-unwind, r=Mark-Simulacrum
Add `needs-unwind` and beginning of support for testing `panic=abort` std to compiletest

For the Fuchsia platform we build libstd with `panic=abort` and would like a way to run tests with that enabled. This adds low-level support for this directly to compiletest.

In the future I'd like to add high-level support in rustbuild, e.g. having target-specific flags that allow configuring a panic strategy. (Side note: It would be nice if we could also build multiple configurations for the same target, but I'm getting ahead of myself.)

This plus #84500 have everything that's needed to get ui tests passing on fuchsia targets.

Part of #84766. Note that this change only includes the header on tests which need an unwinder to _build_, not those which need it to _run_.

r? ````@Mark-Simulacrum````
2021-05-07 00:38:37 +02:00
Dylan DPC
3a0d6bec56
Rollup merge of #84728 - camelid:sized-param-sugg-test, r=Mark-Simulacrum
Add test for suggestion to borrow unsized function parameters

Closes #82820.

This is a regression test for #82820.

This test case is included in more general tests, but I think the error
regressed because there were a bunch of other diagnostic changes in the
test that obscured this regression.

Hopefully, having a test specific to the suggestion, and running rustfix
for the test, will prevent this error from regressing in the future.
2021-05-07 00:38:36 +02:00
Dylan DPC
dd3747b4ad
Rollup merge of #84500 - tmandry:compiletest-run-flag, r=Mark-Simulacrum
Add --run flag to compiletest

This controls whether run-* tests actually get run.

r? ```@Mark-Simulacrum```
2021-05-07 00:38:35 +02:00
Dylan DPC
b30e428689
Rollup merge of #84409 - mzohreva:mz/tls-dtors-before-join, r=jethrogb
Ensure TLS destructors run before thread joins in SGX

The excellent test is from ```@jethrogb```

For context see: https://github.com/rust-lang/rust/pull/83416#discussion_r617282907
2021-05-07 00:38:33 +02:00
bors
777bb2f612 Auto merge of #84806 - Mark-Simulacrum:try-start-entry, r=cjgillot
Streamline try_start code

This shifts some branches around and avoids interleaving parallel and
non-parallel versions of the function too much.
2021-05-06 22:35:06 +00:00
bors
676ee14729 Auto merge of #79930 - tgnottingham:bufwriter_performance, r=m-ou-se
Optimize BufWriter
2021-05-06 20:04:32 +00:00
Rich Kadel
cd3a8c1b7f Removes unneeded check of #[no_coverage] in mapgen
And adds tests to validate it still works.

There is an anticipated feature request to support a compiler flag that
only adds coverage for specific files (or perhaps mods). As I thought
about where that change would need to be supported, I realized that
checking the attribute in mapgen (for unused functions) was unnecessary.
The unused functions are only synthesized if they have MIR coverage, and
functions with the `no_coverage` attribute will not have been
instrumented with MIR coverage statements in the first place.

New tests confirm this.

Also, while adding tests, I updated resolved comments and FIXMEs in
other tests.
2021-05-06 12:44:49 -07:00
Rich Kadel
8075b28df1 Renamed compiler-flags file to name of compiler-flag: instrument-coverage
And redirect users from the old file name.
2021-05-06 12:21:24 -07:00
Rich Kadel
f58a362d18 Update coverage docs and command line help 2021-05-06 12:20:31 -07:00
Camelid
a7500e52ef Add test for suggestion to borrow unsized function parameters
This is a regression test for #82820.

This test case is included in more general tests, but I think the error
regressed because there were a bunch of other diagnostic changes in the
test that obscured this regression.

Hopefully, having a test specific to the suggestion, and running rustfix
for the test, will prevent this error from regressing in the future.
2021-05-06 12:06:43 -07:00
Rich Kadel
cb70221857 Coverage instruments closure bodies in macros (not the macro body)
Fixes: #84884

This solution might be considered a compromise, but I think it is the
better choice.

The results in the `closure.rs` test correctly resolve all test cases
broken as described in #84884.

One test pattern (in both `closure_macro.rs` and
`closure_macro_async.rs`) was also affected, and removes coverage
statistics for the lines inside the closure, because the closure
includes a macro. (The coverage remains at the callsite of the macro, so
we lose some detail, but there isn't a perfect choice with macros.

Often macro implementations are split across the macro and the callsite,
and there doesn't appear to be a single "right choice" for which body
should be covered. For the current implementation, we can't do both.

The callsite is most likely to be the preferred site for coverage.

I applied this fix to all `MacroKinds`, not just `Bang`.

I'm trying to resolve an issue of lost coverage in a
`MacroKind::Attr`-based, function-scoped macro. Instead of only
searching for a body_span that is "not a function-like macro" (that is,
MacroKind::Bang), I'm expanding this to all `MacroKind`s. Maybe I should
expand this to `ExpnKind::Desugaring` and `ExpnKind::AstPass` (or
subsets, depending on their sub-kinds) as well, but I'm not sure that's
a good idea.

I'd like to add a test of the `Attr` macro on functions, but I need time
to figure out how to constract a good, simple example without external
crate dependencies. For the moment, all tests still work as expected (no
change), this new commit shouldn't have a negative affect, and more
importantly, I believe it will have a positive effect. I will try to
confirm this.
2021-05-06 11:15:39 -07:00
bors
377d1a984c Auto merge of #84559 - jackh726:issue-84398, r=nikomatsakis
Deduplicate ParamCandidates with the same value except for bound vars

Fixes #84398

This is kind of a hack. I wonder if we can get other types of candidates that are the same except for bound vars. This won't be a problem with Chalk, since we don't really need to know that there are two different "candidates" if they both give the same final substitution.

r? `@nikomatsakis`
2021-05-06 17:42:32 +00:00
Mohsen Zohrevandi
2acd62d7c3 join_orders_after_tls_destructors: ensure thread 2 is launched before thread 1 enters TLS destructors 2021-05-06 09:36:26 -07:00
bors
d44f647ffc Auto merge of #84982 - Dylan-DPC:rollup-q4cbec2, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #83507 (Implement RFC 2951: Native link modifiers)
 - #84328 (Stablize {HashMap,BTreeMap}::into_{keys,values})
 - #84712 (Simplify chdir implementation and minimize unsafe block)
 - #84851 (⬆️ rust-analyzer)
 - #84923 (Only compute Obligation `cache_key` once  in `register_obligation_at`)
 - #84945 (E0583: Include secondary path in error message)
 - #84949 (Fix typo in `MaybeUninit::array_assume_init` safety comment)
 - #84950 (Revert PR 83866)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-06 15:19:39 +00:00
Guillaume Gomez
cdbfea5c6c Sort rustdoc-gui tests 2021-05-06 16:51:04 +02:00
lcnr
b9811418dd outdated comment 2021-05-06 16:27:59 +02:00
Jack Huey
c1ef0f3050
Pick candidate with fewer bound vars 2021-05-06 10:19:51 -04:00
lcnr
513c56a611 remove unused variant 2021-05-06 14:59:53 +02:00
Dylan DPC
ccc820e1f8
Rollup merge of #84950 - pietroalbini:revert-3478f83c0, r=Mark-Simulacrum
Revert PR 83866

https://github.com/rust-lang/rust/pull/83866 caused multiple test failures when Rust's channel is changed from nightly to anything else. The PR will have to be landed again after the test suite is fixed.

The two kinds of test failures were:

* Rustdoc tests failed because the links in the generated HTML didn't point at nightly anymore, see https://github.com/rust-lang/rust/pull/84909#issuecomment-832028701
* Rustdoc UI tests failed because the links included in error messages didn't point at nightly anymore, see https://github.com/rust-lang/rust/pull/84909#issuecomment-832517722

r? ``@Mark-Simulacrum``
cc ``@jyn514``
2021-05-06 13:31:01 +02:00
Dylan DPC
ccf0e3e068
Rollup merge of #84949 - sdroege:maybe-unint-typo, r=m-ou-se
Fix typo in `MaybeUninit::array_assume_init` safety comment

And also add backticks around `MaybeUninit`.
2021-05-06 13:31:00 +02:00
Dylan DPC
b07834b986
Rollup merge of #84945 - fee1-dead:E0583-better-message, r=petrochenkov
E0583: Include secondary path in error message

Fixes #84819.
2021-05-06 13:30:59 +02:00
Dylan DPC
b5f40df95c
Rollup merge of #84923 - estebank:as_cache_key-once, r=petrochenkov
Only compute Obligation `cache_key` once  in `register_obligation_at`
2021-05-06 13:30:58 +02:00
Dylan DPC
ae409558e7
Rollup merge of #84851 - lnicola:rust-analyzer-2021-05-03, r=jonas-schievink
⬆️ rust-analyzer
2021-05-06 13:30:56 +02:00
Dylan DPC
2ed0134cfa
Rollup merge of #84712 - joshtriplett:simplify-chdir, r=yaahc
Simplify chdir implementation and minimize unsafe block
2021-05-06 13:30:55 +02:00
Dylan DPC
6a6c644016
Rollup merge of #84328 - Folyd:stablize_map_into_keys_values, r=m-ou-se
Stablize {HashMap,BTreeMap}::into_{keys,values}

I would propose to stabilize `{HashMap,BTreeMap}::into_{keys,values}`( aka. `map_into_keys_values`).

Closes #75294.
2021-05-06 13:30:54 +02:00
Dylan DPC
5dcdeb81e1
Rollup merge of #83507 - luqmana:native-link-modifiers, r=petrochenkov
Implement RFC 2951: Native link modifiers

A first attempt at implementing https://github.com/rust-lang/rfcs/pull/2951 / https://github.com/rust-lang/compiler-team/issues/356.

Tracking Issue: https://github.com/rust-lang/rust/issues/81490

Introduces feature flags for the general syntax (`native_link_modifiers`) and each modifier (`native_link_modifiers_{as_needed,bundle,verbatim,whole_archive}`).

r? `@petrochenkov`
2021-05-06 13:30:51 +02:00
bors
109248a4eb Auto merge of #84965 - the8472:lazy-delayed-diagnostics, r=Mark-Simulacrum
lazify backtrace formatting for delayed diagnostics

Formatting backtraces causes debug info to be parsed, which is superfluous work if the delayed bugs get cleared later.

Lazifying them results in these speedups for the UI testsuite:

|       | debuginfo = 0 | debuginfo = 1 | debuginfo = 2 |
|-------|---------------|---------------|---------------|
| eager | 31.59s        | 37.55s        | 42.64s        |
| lazy  | 30.44s        | 30.86s        | 34.07s        |
2021-05-06 11:29:29 +00:00
Ralf Jung
bcf622b87d 32bit bless 2021-05-06 12:00:19 +02:00
Ralf Jung
abdba81d03 use CheckInAllocMsg::PointerArithmeticTest for ptr_offset error 2021-05-06 10:39:35 +02:00
bors
1d99508b52 Auto merge of #84468 - iladin:iladin/fix-84467, r=petrochenkov
Fix#84467 linker_args with --target=sparcv9-sun-solaris

Trying to cross-compile for sparcv9-sun-solaris
getting a error message for -zignore

Introduced when -z -ignore was seperated here
22d0ab0

No formatting done

Reproduce

``` bash
rustup target add sparcv9-sun-solaris
cargo new --bin hello && cd hello && cargo run --target=sparcv9-sun-solaris
```

config.toml

[target.sparcv9-sun-solaris]
linker = "gcc"
2021-05-06 07:02:06 +00:00