Commit Graph

457 Commits

Author SHA1 Message Date
Tomasz Miąsko 0d84e0b68c Add test case for -Zinline-mir & -Zinstrument-coverage 2021-03-16 00:00:00 +00:00
Tomasz Miąsko 4b6cc0c204 Add support for compile-flags in coverage tests 2021-03-15 23:26:03 +01:00
hyd-dev 0bbfd548ec
Fix `src/test/run-make-fulldeps/issue-19371` 2021-03-15 21:16:39 +08:00
Camille GILLOT 445b4e379c Make def_key and HIR parenting consistent. 2021-03-12 22:48:32 +01:00
katelyn a. martin baf227ea0c add integration tests, unwind across FFI boundary
### Integration Tests

    This commit introduces some new fixtures to the `run-make-fulldeps`
    test suite.

        * c-unwind-abi-catch-panic: Exercise unwinding a panic. This
          catches a panic across an FFI boundary and downcasts it into
          an integer.

        * c-unwind-abi-catch-lib-panic: This is similar to the previous
         `*catch-panic` test, however in this case the Rust code that
         panics resides in a separate crate.

 ### Add `rust_eh_personality` to `#[no_std]` alloc tests

    This commit addresses some test failures that now occur in the
    following two tests:

        * no_std-alloc-error-handler-custom.rs
        * no_std-alloc-error-handler-default.rs

    Each test now defines a `rust_eh_personality` extern function, in
    the same manner as shown in the "Writing an executable without
    stdlib" section of the `lang_items` documentation here:
    https://doc.rust-lang.org/unstable-book/language-features/lang-items.html#writing-an-executable-without-stdlib

    Without this change, these tests would fail to compile due to a
    linking error explaining that there was an "undefined reference
    to `rust_eh_personality'."

 ### Updated hash

    * update 32-bit hash in `impl1` test

 ### Panics

    This commit uses `panic!` macro invocations that return a string,
    rather than using an integer as a panic payload.

    Doing so avoids the following warnings that were observed during
    rollup for the `*-msvc-1` targets:

    ```
    warning: panic message is not a string literal
      --> panic.rs:10:16
       |
    10 |         panic!(x); // That is too big!
       |                ^
       |
       = note: `#[warn(non_fmt_panic)]` on by default
       = note: this is no longer accepted in Rust 2021
    help: add a "{}" format string to Display the message
       |
    10 |         panic!("{}", x); // That is too big!
       |                ^^^^^
    help: or use std::panic::panic_any instead
       |
    10 |         std::panic::panic_any(x); // That is too big!
       |         ^^^^^^^^^^^^^^^^^^^^^

    warning: 1 warning emitted
    ```

    See: https://github.com/rust-lang-ci/rust/runs/1992118428

    As these errors imply, panicking without a format string will be
    disallowed in Rust 2021, per #78500.
2021-03-09 14:40:33 -05:00
Joshua Nelson 173d2aaa00 Add an unstable option to print all unversioned files
This allows sharing those files between different doc invocations
without having to know their names ahead of time.
2021-03-05 15:31:30 -05:00
bors 409920873c Auto merge of #81451 - nikic:llvm-12, r=nagisa
Upgrade to LLVM 12

This implements the necessary adjustments to make rustc work with LLVM 12. I didn't encounter any major issues so far.

r? `@cuviper`
2021-03-04 15:16:44 +00:00
Nikita Popov ab03c56ba2 Explicitly disable preinline during pgo-use test
We previously used -Os to disable this pass, but since
https://reviews.llvm.org/D91673 this no longer works. Explicitly
disable it using -Cllvm-args instead.
2021-03-03 20:48:37 +01:00
Yuki Okushi 9a827d9f7e
Rollup merge of #81223 - GuillaumeGomez:generate-redirect-map, r=jyn514
[rustdoc] Generate redirect map file

Fixes #81134.

So with this code:

```rust
#![crate_name = "foo"]

pub use private::Quz;
pub use hidden::Bar;

mod private {
    pub struct Quz;
}

#[doc(hidden)]
pub mod hidden {
    pub struct Bar;
}

#[macro_export]
macro_rules! foo {
() => {}
}
```

It generates:

```json
{
  "foo/macro.foo!.html": "foo/macro.foo.html",
  "foo/private/struct.Quz.html": "foo/struct.Quz.html",
  "foo/hidden/struct.Bar.html": "foo/struct.Bar.html"
}
```

Do the pathes look as you expected ````@pietroalbini?````

r? ````@jyn514````
2021-03-03 16:27:38 +09:00
Nikita Popov 55f345f325 Support LLVM 12 in rustc 2021-02-28 10:19:44 +01:00
Guillaume Gomez 1a7126b30b Add full test for rustdoc map file 2021-02-23 11:13:35 +01:00
bors 446d4533e8 Auto merge of #82102 - nagisa:nagisa/fix-dwo-name, r=davidtwco
Set path of the compile unit to the source directory

As part of the effort to implement split dwarf debug info, we ended up
setting the compile unit location to the output directory rather than
the source directory. Furthermore, it seems like we failed to remap the
prefixes for this as well!

The desired behaviour is to instead set the `DW_AT_GNU_dwo_name` to a
path relative to compiler's working directory. This still allows
debuggers to find the split dwarf files, while not changing the
behaviour of the code that is compiling with regular debug info, and not
changing the compiler's behaviour with regards to reproducibility.

Fixes #82074

cc `@alexcrichton` `@davidtwco`
2021-02-23 10:02:16 +00:00
bors cd64446196 Auto merge of #82076 - jyn514:update-bootstrap, r=Mark-Simulacrum
Update the bootstrap compiler

This updates the bootstrap compiler, notably leaving out a change to enable semicolon in macro expressions lint, because stdarch still depends on the old behavior.
2021-02-23 07:19:41 +00:00
bors ed58a2b03b Auto merge of #79100 - a1phyr:better_assert_eq, r=m-ou-se
Improve assert_eq! and assert_ne!

This PR improves `assert_eq!` and `assert_ne!` by moving the panicking code in an external function.

It does not change the fast path, but the move of the formatting in the cold path (the panic) may have a positive effect on in instruction cache use and with inlining.

Moreover, the use of trait objects instead of generic may improve compile times for `assert_eq!`-heavy code.

Godbolt link: ~~https://rust.godbolt.org/z/TYa9MT~~ \
Updated: https://rust.godbolt.org/z/bzE84x
2021-02-21 05:41:09 +00:00
Joshua Nelson 3733275854 Update the bootstrap compiler
Note this does not change `core::derive` since it was merged after the
beta bump.
2021-02-20 17:19:30 -05:00
Simonas Kazlauskas 925ed4828d Update LLVM to pull in fixes to llvm-dwp
Includes https://github.com/rust-lang/llvm-project/pull/90 in
particular.
2021-02-20 15:56:36 +02:00
Benoît du Garreau 7333759502 Fix run-make-fulldeps test 2021-02-16 09:02:13 +01:00
bors 090dac0c38 Auto merge of #81734 - richkadel:fixfordash, r=pnkfelix
Ensures `make` tests run under /bin/dash (if available), like CI, and fixes a Makefile

Note: This cherrypicks #81688 (`@pnkfelix)`

Updates `tools.mk` to explicitly require `SHELL := /bin/dash`, since CI uses `dash` but other environments (including developer local machines) may default to `bash`.

Replaces bash-specific shell command in one Makefile with a dash-compatible alternative, and re-enables the affected Makefile test.

Removes apparently redundant definition of `UNAME`.

Also see: [zulip discussion thread](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/how.20to.20run.2Fbless.20src.2Ftest.2Frun-make-fulldeps.2Fcoverage.20.3F)

r? `@pnkfelix`

FYI: `@wesleywiser` `@tmandry`
2021-02-16 05:45:10 +00:00
Rich Kadel cbe6c70c68 Disabled SHELL=dash on Windows due to invalid path backslash handling
Calling an executable via full path with Windows backslashes fails in
dash.
2021-02-13 00:14:50 -08:00
Rich Kadel b211acf683 Re-blessed the partial_eq.rs coverage test 2021-02-11 14:11:08 -08:00
Rich Kadel 625803d77e Set SHELL = /bin/dash only if it exists 2021-02-11 11:40:30 -08:00
Rich Kadel 01f5a2a81d Ensures `make` tests run under /bin/dash, like CI, and fixes a Makefile
Updates `tools.mk` to explicitly require `SHELL := /bin/dash`, since CI
uses `dash` but other environments (including developer local machines)
may default to `bash`.

Replaces bash-specific shell command in one Makefile with a
dash-compatible alternative, and re-enables the affected Makefile test.

Removes apparently redundant definition of `UNAME`.
2021-02-11 11:40:29 -08:00
Tomasz Miąsko 1cf95059eb Borrow builder only once in debug derive 2021-02-10 00:00:00 +00:00
bors c648bd5558 Auto merge of #81384 - tmiasko:partial-ord, r=petrochenkov
Fix derived PartialOrd operators

The derived implementation of `partial_cmp` compares matching fields one
by one, stopping the computation when the result of a comparison is not
equal to `Some(Equal)`.

On the other hand the derived implementation for `lt`, `le`, `gt` and
`ge` continues the computation when the result of a field comparison is
`None`, consequently those operators are not transitive and inconsistent
with `partial_cmp`.

Fix the inconsistency by using the default implementation that fall-backs
to the `partial_cmp`. This also avoids creating very deeply nested
closures that were quite costly to compile.

Fixes #81373.
Helps with #81278, #80118.
2021-02-09 08:47:38 +00:00
Tomasz Miąsko 62366ee6f1 ./x.py test --bless 2021-02-09 00:00:00 +00:00
Mara Bos 35ebbe3e01
Rollup merge of #71531 - spastorino:move-treat-err-as-bug-tests-to-ui, r=oli-obk
Move treat err as bug tests to ui

cc `@oli-obk`
2021-02-08 19:28:09 +01:00
Santiago Pastorino 6d9efd17e5
Remove treat-err-as-bug delay_span_bug test from run-make-fulldeps 2021-02-07 16:13:59 -03:00
Vadim Petrochenkov dbdbd30bf2 expand/resolve: Turn `#[derive]` into a regular macro attribute 2021-02-07 20:08:45 +03:00
Santiago Pastorino 748b550bf6
Remove treat-err-as-bug err test from run-make-fulldeps 2021-02-07 01:51:04 -03:00
Dan Aloni 64950297e2 path trimming: disable on src/test/run-make-fulldeps/coverage-spanview 2021-02-06 12:03:48 +02:00
Dan Aloni eaefe4a230 path trimming: ignore type aliases 2021-02-06 12:03:48 +02:00
bors 5605b5d693 Auto merge of #81257 - pnkfelix:issue-80949-short-term-resolution-via-revert-of-pr-78373, r=matthewjasper
Revert 78373 ("dont leak return value after panic in drop")

Short term resolution for issue #80949.

Reopen #47949 after this lands.

(We plan to fine-tune PR #78373 to not run into this problem.)
2021-02-05 14:52:57 +00:00
bors 9e5d58fb42 Auto merge of #81688 - pnkfelix:fix-llvm-version-check-in-run-make-tests, r=simulacrum
Use `# min-llvm-version: 11.0` to force a minimum LLVM version

Use `# min-llvm-version: 11.0` to force a minimum LLVM version, rather than ad-hoc internal solution.

In particular: the specific code to define LLVM_VERSION_11_PLUS here was, for some reason, using `$(shell ...)` with bash-specific variable replacement code. On non-bash platforms like dash, that `shell` invocation would fail, and the
LLVM_VERSION_11_PLUS check would always fail, the test would always be ignored, and thus be treated as a "success" (in the sense that `--bless` would never do anything).

 * Note in particular that GNU Make treats the SHELL variable as a very special case: it does not inherit the value of SHELL from the user's environment. Except on Windows. See more explanation in the [GNU Make docs](https://www.gnu.org/software/make/manual/html_node/Choosing-the-Shell.html).
 * The effect of this is that these tests end up using `/bin/sh` (except on Windows) for their `$(shell ...)` invocations, and thus we see differing behaviors depending on whether your `/bin/sh` links to `/bin/dash` or to `/bin/bash`.

This was causing me a lot of pain.
2021-02-05 06:12:26 +00:00
Wesley Wiser 7c7f10ba38 Bless code coverage test 2021-02-04 21:29:50 -05:00
Felix S. Klock II a71a819480 Revert "Avoid leaking block expression values"
This reverts commit 4fef39113a.
2021-02-04 21:29:49 -05:00
Felix S. Klock II 5ce6710668 Ignore broken test.
(Test was silently ignored on Linux CI prior to parent commit that switched to
using `# min-llvm-version`. But the switch made the ignoring stop, exposing
other brokenness in the form of bash-dependent syntax in the `$(shell ...)`
invocations.)
2021-02-03 16:02:41 -05:00
Felix S. Klock II 1783c476fa bless the coverage-spanview output. Cc #81688. 2021-02-02 22:29:04 -05:00
Felix S. Klock II 03c000eb20 Use `# min-llvm-version: 11.0` to force a minimum LLVM version, rather than ad-hoc internal solution.
In particular: the specific code to define LLVM_VERSION_11_PLUS here was, for
some reason, using `$(shell ...)` with bash-specific variable replacement code.
On non-bash platforms like dash, that `shell` invocation would fail, and the
LLVM_VERSION_11_PLUS check would always fail, the test would always be ignored,
and thus be treated as a "success" (in the sense that `--bless` would never do
anything).

This was causing me a lot of pain.
2021-02-02 21:53:30 -05:00
bors e0d9f79399 Auto merge of #80851 - m-ou-se:panic-2021, r=petrochenkov
Implement Rust 2021 panic

This implements the Rust 2021 versions of `panic!()`. See https://github.com/rust-lang/rust/issues/80162 and https://github.com/rust-lang/rfcs/pull/3007.

It does so by replacing `{std, core}::panic!()` by a bulitin macro that expands to either `$crate::panic::panic_2015!(..)` or `$crate::panic::panic_2021!(..)` depending on the edition of the caller.

This does not yet make std's panic an alias for core's panic on Rust 2021 as the RFC proposes. That will be a separate change: c5273bdfb2 That change is blocked on figuring out what to do with https://github.com/rust-lang/rust/issues/80846 first.
2021-02-01 10:25:31 +00:00
Mara Bos 5b11a9722c Bless coverage-spanview/expected_mir_dump.*. 2021-01-31 16:10:08 +01:00
Alex Crichton a124043fb0 rustc: Stabilize `-Zrun-dsymutil` as `-Csplit-debuginfo`
This commit adds a new stable codegen option to rustc,
`-Csplit-debuginfo`. The old `-Zrun-dsymutil` flag is deleted and now
subsumed by this stable flag. Additionally `-Zsplit-dwarf` is also
subsumed by this flag but still requires `-Zunstable-options` to
actually activate. The `-Csplit-debuginfo` flag takes one of
three values:

* `off` - This indicates that split-debuginfo from the final artifact is
  not desired. This is not supported on Windows and is the default on
  Unix platforms except macOS. On macOS this means that `dsymutil` is
  not executed.

* `packed` - This means that debuginfo is desired in one location
  separate from the main executable. This is the default on Windows
  (`*.pdb`) and macOS (`*.dSYM`). On other Unix platforms this subsumes
  `-Zsplit-dwarf=single` and produces a `*.dwp` file.

* `unpacked` - This means that debuginfo will be roughly equivalent to
  object files, meaning that it's throughout the build directory
  rather than in one location (often the fastest for local development).
  This is not the default on any platform and is not supported on Windows.

Each target can indicate its own default preference for how debuginfo is
handled. Almost all platforms default to `off` except for Windows and
macOS which default to `packed` for historical reasons.

Some equivalencies for previous unstable flags with the new flags are:

* `-Zrun-dsymutil=yes` -> `-Csplit-debuginfo=packed`
* `-Zrun-dsymutil=no` -> `-Csplit-debuginfo=unpacked`
* `-Zsplit-dwarf=single` -> `-Csplit-debuginfo=packed`
* `-Zsplit-dwarf=split` -> `-Csplit-debuginfo=unpacked`

Note that `-Csplit-debuginfo` still requires `-Zunstable-options` for
non-macOS platforms since split-dwarf support was *just* implemented in
rustc.

There's some more rationale listed on #79361, but the main gist of the
motivation for this commit is that `dsymutil` can take quite a long time
to execute in debug builds and provides little benefit. This means that
incremental compile times appear that much worse on macOS because the
compiler is constantly running `dsymutil` over every single binary it
produces during `cargo build` (even build scripts!). Ideally rustc would
switch to not running `dsymutil` by default, but that's a problem left
to get tackled another day.

Closes #79361
2021-01-28 08:51:11 -08:00
bors d03fe84169 Auto merge of #79328 - c410-f3r:hir-if, r=matthewjasper
Reintroduce hir::ExprKind::If

Basically copied and paste #59288/https://github.com/rust-lang/rust-clippy/pull/4080 with some modifications.

The vast majority of tests were fixed and now there are only a few remaining. Since I am still unable to figure out the missing pieces, any help with the following list is welcome.

- [ ] **Unnecessary `typeck` exception**: [Cheated on this one to make CI green.](https://github.com/rust-lang/rust/pull/79328/files#diff-3faee9ba23fc54a12b7c43364ba81f8c5660045c7e1d7989a02a0cee1c5b2051)
- [x] **Incorrect span**: [Span should reference `then` and `else` separately.](https://github.com/rust-lang/rust/pull/79328/files#diff-cf2c46e82222ee4b1037a68fff8a1af3c4f1de7a6b3fd798aacbf3c0475abe3d)
- [x] **New note regarding `assert!`**: [Modified but not "wrong". Maybe can be a good thing?](https://github.com/rust-lang/rust/pull/79328/files#diff-9e0d7c89ed0224e2b62060c957177c27db43c30dfe3c2974cb6b5091cda9cfb5)
- [x] **Inverted report location**: [Modified but not "wrong". Locations were inverted.](https://github.com/rust-lang/rust/pull/79328/files#diff-f637ce7c1f68d523a165aa9651765df05e36c4d7d279194b1a6b28b48a323691)
- [x] **`src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs` has weird errors**: [Not sure why this is happening.](https://github.com/rust-lang/rust/pull/79328/files#diff-c823c09660f5b112f95e97e8ff71f1797b6c7f37dbb3d16f8e98bbaea8072e95)
- [x] **Missing diagnostic**: [???](https://github.com/rust-lang/rust/pull/79328/files#diff-6b8ab09360d725ba4513933827f9796b42ff9522b0690f80b76de067143af2fc)
2021-01-14 14:41:58 +00:00
Mark Rousskov 4614671cae Update code to account for extern ABI requirement 2021-01-13 07:49:45 -05:00
Mark Rousskov 8a3edb1d66 Update tests for extern block linting 2021-01-13 07:49:16 -05:00
Matthew Jasper b0ac0fbdef Bless profiler run make tests 2021-01-12 20:24:07 +00:00
Santiago Pastorino 82d0c597bf
Revert "Auto merge of #76896 - spastorino:codegen-inline-fns2, r=davidtwco,wesleywiser"
This reverts commit ddf2cc7f8e, reversing
changes made to 937f629535.
2021-01-11 16:27:59 -03:00
bors ddf2cc7f8e Auto merge of #76896 - spastorino:codegen-inline-fns2, r=davidtwco,wesleywiser
Do not make local copies of inline fns in debug mode

r? `@wesleywiser`

cc `@rust-lang/wg-incr-comp`

If this is correct it supersedes https://github.com/rust-lang/rust/pull/76889

Related to #54089
2021-01-08 15:21:45 +00:00
Yuki Okushi c851ae9d26
Rollup merge of #80761 - andjo403:generic_coverage, r=spastorino
handle generic trait methods in coverage-report tests

also make the generic function pattern more specific and remove the extra $ that fails the matching.

r? `@wesleywiser`
as this was failing the test of #76896
2021-01-08 11:11:43 +09:00
Andreas Jonson 4f6305bc37 handle generic trait methods in coverage tests
make the generic function pattern more specific
2021-01-07 19:40:19 +01:00
Rich Kadel e4aa99fe7a Inlining enabled by -mir-opt-level > 1 is incompatible with coverage
Fixes: #80060

Also adds additional test cases for coverage of doctests.
2021-01-04 11:06:42 -08:00