Commit Graph

38409 Commits

Author SHA1 Message Date
bors
f04a2f4b8e Auto merge of #91255 - b-naber:normalization-ice, r=jackh276
Implement version of normalize_erasing_regions that allows for normalization failure

Fixes https://github.com/rust-lang/rust/issues/59324
Fixes https://github.com/rust-lang/rust/issues/67684
Fixes https://github.com/rust-lang/rust/issues/69398
Fixes https://github.com/rust-lang/rust/issues/71113
Fixes https://github.com/rust-lang/rust/issues/82079
Fixes #85103
Fixes https://github.com/rust-lang/rust/issues/88856
Fixes #91231
Fixes https://github.com/rust-lang/rust/issues/91234

Previously we called `normalize_erasing_regions` inside `layout_of`. `normalize_erasing_regions` assumes that the normalization succeeds. Since some `layout_of` calls happen before typecheck has finished, we introduce a new variant that allows for returning an error.
2021-12-01 13:33:33 +00:00
b-naber
a040b4189d more fixed issues 2021-12-01 12:12:39 +01:00
b-naber
e0c98e2a33 add tests and bless existing ones 2021-12-01 12:12:39 +01:00
Matthias Krüger
d93df5775c
Rollup merge of #91207 - richkadel:rk-bump-coverage-version, r=tmandry
Add support for LLVM coverage mapping format versions 5 and 6

This PR cherry-pick's Swatinem's initial commit in unsubmitted PR #90047.

My additional commit augments Swatinem's great starting point, but adds full support for LLVM
Coverage Mapping Format version 6, conditionally, if compiling with LLVM 13.

Version 6 requires adding the compilation directory when file paths are
relative, and since Rustc coverage maps use relative paths, we should
add the expected compilation directory entry.

Note, however, that with the compilation directory, coverage reports
from `llvm-cov show` can now report file names (when the report includes
more than one file) with the full absolute path to the file.

This would be a problem for test results, but the workaround (for the
rust coverage tests) is to include an additional `llvm-cov show`
parameter: `--compilation-dir=.`
2021-12-01 10:50:20 +01:00
Matthias Krüger
2695e85c09
Rollup merge of #91087 - rukai:fix_test_nll_revisions, r=jackh726
Remove all migrate.nll.stderr files

There are a few ui tests that setup the revisions like:
```rust
// revisions: migrate nll`
// [nll]compile-flags: -Zborrowck=mir
```

However most of them fail to disable the nll compare mode like this:
```rust
// ignore-compare-mode-nll
```

This ends up generating confusing files ending in `.migrate.nll.stderr` because the nll compare mode is run on top of the migrate revision.

This PR fixes this by adding `ignore-compare-mode-nll` to these tests.

I would have just made these tests use compare modes instead but I assume the reason these tests are messing around with revisions instead of just letting the nll compare mode do its thing is to enforce error annotations for both migrate and nll.
Relying on just compare modes would only have the error annotations for migrate.
2021-12-01 10:50:19 +01:00
Matthias Krüger
e68e5d2391
Rollup merge of #87160 - estebank:colon-recovery, r=nagisa
When recovering from a `:` in a pattern, use adequate AST pattern

If the suggestion to use `::` instead of `:` in the pattern isn't correct, a second resolution error will be emitted.
2021-12-01 10:50:18 +01:00
Matthias Krüger
7baafb1f5e
Rollup merge of #91397 - jyn514:generic-param-docs, r=wesleywiser
Emit a warning on generic parameters with doc comments

Fixes https://github.com/rust-lang/rust/issues/90610
2021-11-30 23:43:33 +01:00
Matthias Krüger
2b8259af05
Rollup merge of #91366 - notriddle:notriddle/only-show-notable-if-types-are-the-same, r=GuillaumeGomez
Only show notable traits if both types are the same

Checking only their DefId doesn't work because all slices have the same
fake DefId.

Fixes #91347
2021-11-30 23:43:32 +01:00
Rich Kadel
0c57fab5fc Add conditional support for coverage map version 6
This commit augments Swatinem's initial commit in uncommitted PR #90047,
which was a great starting point, but did not fully support LLVM
Coverage Mapping Format version 6.

Version 6 requires adding the compilation directory when file paths are
relative, and since Rustc coverage maps use relative paths, we should
add the expected compilation directory entry.

Note, however, that with the compilation directory, coverage reports
from `llvm-cov show` can now report file names (when the report includes
more than one file) with the full absolute path to the file.

This would be a problem for test results, but the workaround (for the
rust coverage tests) is to include an additional `llvm-cov show`
parameter: `--compilation-dir=.`
2021-11-30 13:54:53 -08:00
Joshua Nelson
bd894a0877 Emit a warning on generic parameters with doc comments 2021-11-30 18:49:55 +00:00
Yuki Okushi
a940c68035
Rollup merge of #91323 - RalfJung:assert-type, r=oli-obk
CTFE: support assert_zero_valid and assert_uninit_valid

This ensures the implementation of all three type-based assert_ intrinsics remains consistent in Miri.

`assert_inhabited` recently got stabilized in https://github.com/rust-lang/rust/pull/90896 (meaning stable `const fn` can call it), so do the same with these other intrinsics.

Cc ```@rust-lang/wg-const-eval```
2021-11-30 17:29:09 +09:00
Yuki Okushi
ae1badb047
Rollup merge of #91317 - petrochenkov:debugnu, r=Mark-Simulacrum
tests: Ignore `test/debuginfo/rc_arc.rs` on windows-gnu

The tests checks some pretty-printer output, but pretty-printers are not embedded on windows-gnu.

Regressed in https://github.com/rust-lang/rust/pull/85448.
2021-11-30 17:29:08 +09:00
Yuki Okushi
6e7cf2e88b
Rollup merge of #91243 - jackh726:issue-91068, r=nikomatsakis
Don't treat unnormalized function arguments as well-formed

Partial revert of #88312

r? ``@pnkfelix``
cc ``@nikomatsakis``
2021-11-30 17:29:06 +09:00
Lucas Kent
abd704b844 Remove all migrate.nll.stderr files 2021-11-30 12:05:34 +11:00
Jack Huey
692e96c327 Bless nll 2021-11-29 15:24:44 -05:00
Michael Howell
85ba6c7b34 Only show notable traits if both types are the same
Checking only their DefId doesn't work because all slices have the same
fake DefId.

Fixes #91347
2021-11-29 12:23:07 -07:00
Ralf Jung
6c3c3e0952 CTFE: support assert_zero_valid and assert_uninit_valid 2021-11-29 11:49:31 -05:00
bors
6db0a0e9a4 Auto merge of #91299 - cjgillot:expect-ldid, r=petrochenkov
Take a LocalDefId in expect_*item.

Items and item-likes are always HIR owners.
When trying to find such nodes, there is no ambiguity, the `LocalDefId` and the `HirId::owner` always match.
In such cases, `local_def_id_to_hir_id` does not carry any meaningful information, so we can just skip calling it altogether.
2021-11-29 15:02:01 +00:00
Matthias Krüger
e15e0ba45c
Rollup merge of #91349 - tmiasko:accumulate-remark-args, r=nikic
Accumulate all values of `-C remark` option

When `-C remark=...` option is specified multiple times,
accumulate all values instead of using only the last one.

r? `@nikic`
2021-11-29 10:41:38 +01:00
Matthias Krüger
a2f924a255
Rollup merge of #91281 - scottmcm:non-exhaustive-as-test, r=Mark-Simulacrum
Add demonstration test for #91161

Since cross-crate things are hard to demonstrate in playground, here's a test showing that something currently works that shouldn't.

cc https://github.com/rust-lang/rust/issues/91161 that tracks fixing the problem (and updating this test)
2021-11-29 10:41:34 +01:00
Tomasz Miąsko
e74e39a699 Accumulate all values of -C remark option
When `-C remark=...` option is specified multiple times,
accumulate all values instead of using only the last one.
2021-11-29 09:12:01 +01:00
Matthias Krüger
67762ffe35
Rollup merge of #90833 - tmiasko:optimization-remarks, r=nikic
Emit LLVM optimization remarks when enabled with `-Cremark`

The default diagnostic handler considers all remarks to be disabled by
default unless configured otherwise through LLVM internal flags:
`-pass-remarks`, `-pass-remarks-missed`, and `-pass-remarks-analysis`.
This behaviour makes `-Cremark` ineffective on its own.

Fix this by configuring a custom diagnostic handler that enables
optimization remarks based on the value of `-Cremark` option. With
`-Cremark=all` enabling all remarks.

Fixes #90924.

r? `@nikic`
2021-11-28 23:45:17 +01:00
Matthias Krüger
9715724006
Rollup merge of #90131 - camsteffen:fmt-args-span-fix, r=cjgillot
Fix a format_args span to be expansion

I found this while exploring solutions for rust-lang/rust-clippy#7843.

r? `@m-ou-se`
2021-11-28 23:45:15 +01:00
Camille GILLOT
5fb4648757 Take a LocalDefId in expect_*item. 2021-11-28 21:09:45 +01:00
Matthias Krüger
a7639b67ac
Rollup merge of #91319 - fee1-dead:rustdoc-ice-fix, r=jyn514
Change output path to {{build-base}} for rustdoc scrape_examples ui test

See https://github.com/rust-lang/rust/pull/90611#issuecomment-981092909

r? `@jyn514`

cc `@petrochenkov`
2021-11-28 17:11:12 +01:00
Matthias Krüger
67d175515f
Rollup merge of #91308 - BGR360:issue-88586, r=jackh726
Fix ICE when lowering `trait A where for<'a> Self: 'a`

Fixes #88586.

r? `@jackh726`

Jack, this fix is much smaller in scope than what I think you were proposing in the issue. Let me know if you had a vision for a larger refactor here.

cc `@JohnTitor`
2021-11-28 17:11:11 +01:00
Matthias Krüger
233c50e79e
Rollup merge of #91251 - oli-obk:wf_sync_statics, r=matthewjasper
Perform Sync check on static items in wf-check instead of during const checks

r? `@RalfJung`

This check is solely happening on the signature of the static item and not on its body, therefor it belongs into wf-checking instead of const checking.
2021-11-28 17:11:10 +01:00
Deadbeef
e13562c118 Change output path to {{build-base}} 2021-11-28 23:42:47 +08:00
Vadim Petrochenkov
b6f9416863 tests: Ignore test/debuginfo/rc_arc.rs on windows-gnu
The tests checks some pretty-printer output, but pretty-printers are not embedded on windows-gnu
2021-11-28 23:09:33 +08:00
Ben Reeves
6df2c78e1c Address PR feedback 2021-11-28 07:05:23 -06:00
Matthias Krüger
9e8dfcffb7
Rollup merge of #91254 - Aaron1011:impl-candidate-err-ty, r=lcnr
Only check for errors in predicate when skipping impl assembly

Prior to PR #91205, checking for errors in the overall obligation
would check checking the `ParamEnv`, due to an incorrect
`super_visit_with` impl. With this bug fixed, we will now
bail out of impl candidate assembly if the `ParamEnv` contains
any error types.

In practice, this appears to be overly conservative - when an error
occurs early in compilation, we end up giving up early for some
predicates that we could have successfully evaluated without overflow.
By only checking for errors in the predicate itself, we avoid causing
additional spurious 'type annotations needed' errors after a 'real'
error has already occurred.

With this PR, the diagnostic changes caused by PR #91205 are reverted.
2021-11-28 10:42:39 +01:00
Ben Reeves
9155f672bf typeck: Ensure proper bound vars passed to add_bounds.
Fixes the ICE in #88586.
2021-11-27 23:59:08 -06:00
Aaron Hill
d18065d997
Only check for errors in predicate when skipping impl assembly
Prior to PR #91205, checking for errors in the overall obligation
would check checking the `ParamEnv`, due to an incorrect
`super_visit_with` impl. With this bug fixed, we will now
bail out of impl candidate assembly if the `ParamEnv` contains
any error types.

In practice, this appears to be overly conservative - when an error
occurs early in compilation, we end up giving up early for some
predicates that we could have successfully evaluated without overflow.
By only checking for errors in the predicate itself, we avoid causing
additional spurious 'type annotations needed' errors after a 'real'
error has already occurred.

With this PR, the diagnostic changes caused by PR #91205 are reverted.
2021-11-27 11:33:55 -06:00
Matthias Krüger
7c5bcd548b
Rollup merge of #91208 - estebank:eq-constraint, r=cjgillot
Account for incorrect `where T::Assoc = Ty` bound

Provide suggestoin to constrain trait bound for associated type.
Revert incorrect changes to `missing-bounds` test.

Address part of #20041.
2021-11-27 11:46:44 +01:00
Matthias Krüger
55f8b5f559
Rollup merge of #91062 - jsha:static-file-replace, r=jyn514,GuillaumeGomez
rustdoc: Consolidate static-file replacement mechanism

There were a few places in rustdoc where we would take static JS or CSS and rewrite it at doc generation time to insert values. This consolidates all the CSS instances into one CSS file and replaces the JS examples with data- attributes on the rustdoc-vars div.

Demo https://rustdoc.crud.net/jsha/static-file-replace/test_docs/

r? ``@GuillaumeGomez``
2021-11-27 11:46:43 +01:00
Scott McMurray
50619f568a Demonstration test for #91161 2021-11-26 19:27:40 -08:00
Matthias Krüger
092477d8c9
Rollup merge of #91259 - jyn514:doctest-warnings, r=GuillaumeGomez
Remove `--display-doctest-warnings`

`--display-doctest-warnings` can be replicated in full with other existing features, there's no
need to have a separate option for it. This removes the option and documents the combination of other features to replicate it.

This also fixes a bug where `--test-args=--show-output` had no effect.

cc `@ollie27,` https://github.com/rust-lang/rust/pull/73314#issuecomment-668317262
Fixes https://github.com/rust-lang/rust/issues/41574

r? `@GuillaumeGomez`
2021-11-26 22:41:44 +01:00
Matthias Krüger
330a558e42
Rollup merge of #91223 - GuillaumeGomez:headings-indent, r=jsha
Fix headings indent

Fixes #91200.

Screenshots with the fix:

![Screenshot from 2021-11-25 15-32-35](https://user-images.githubusercontent.com/3050060/143462481-f7e9ea13-72d5-46fe-90e0-9527e74599e3.png)
![Screenshot from 2021-11-25 15-32-49](https://user-images.githubusercontent.com/3050060/143462485-c010716a-0276-421b-a777-afff19c81c96.png)

If the first element of a top docblock is a heading, we still need to keep the indent, but only on this one (I added a test to check it). We need it because otherwise the anchor will go over the `[-]` toggle.

cc `@camelid`
r? `@jsha`
2021-11-26 22:41:40 +01:00
Matthias Krüger
10743f0f68
Rollup merge of #90611 - fee1-dead:rustdoc-ice-fix, r=jyn514,willcrichton
Fix another ICE in rustdoc scrape_examples

This has occurred to me when documenting a crate with the arguments. Not sure what could have caused it.

r? `@willcrichton`
2021-11-26 22:41:39 +01:00
Joshua Nelson
7e4bf4bfc6 Remove --display-doctest-warnings
This can be replicated in full with other existing features, there's no
need to have a separate option for it.

This also fixes a bug where `--test-args=--show-output` had no effect,
and updates the documentation.
2021-11-26 16:18:16 -05:00
Guillaume Gomez
23427567b2 Update test for anchors and headings position 2021-11-26 21:03:45 +01:00
Deadbeef
9c14d828ba
Reduce the ICE 2021-11-27 01:33:07 +08:00
bors
6d246f0c8d Auto merge of #91253 - matthiaskrgr:rollup-dnlcjmr, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #91169 (Change cg_ssa's get_param to borrow the builder mutably)
 - #91176 (If the thread does not get the lock in the short term, yield the CPU)
 - #91212 (Fix ICE due to out-of-bounds statement index when reporting borrowck error)
 - #91225 (Fix invalid scrollbar display on source code page)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-26 16:30:42 +00:00
Deadbeef
85c20698d4
Add ICE test 2021-11-27 00:26:22 +08:00
Matthias Krüger
13c60669cc
Rollup merge of #91212 - compiler-errors:issue91206, r=oli-obk
Fix ICE due to out-of-bounds statement index when reporting borrowck error

Replace an `[index]` with a `.get` when `statement_index` points to a basic-block terminator (and is therefore out-of-bounds in the statements list).

Fixes #91206
Cc ``@camsteffen``
r? ``@oli-obk``
2021-11-26 16:02:26 +01:00
Oli Scherer
18694126b1 Perform Sync check on static items in wf-check instead of during const checks 2021-11-26 14:22:45 +00:00
bors
454cc5fb86 Auto merge of #91164 - Badel2:usefulness-stack-overflow, r=davidtwco
Fix stack overflow in `usefulness.rs`

Fix #88747

Applied the suggestion from `@nbdd0121,` not sure if this has any drawbacks. The first call to `ensure_sufficient_stack` is not needed to fix the test case, but I added it to be safe.
2021-11-26 13:42:35 +00:00
bors
1e79d79dac Auto merge of #91205 - Aaron1011:visit_param_env, r=lcnr
Visit `param_env` field in Obligation's `TypeFoldable` impl

This oversight appears to have gone unnoticed for a long time
without causing issues, but it should still be fixed.
2021-11-26 09:55:06 +00:00
bors
a7836bf885 Auto merge of #91181 - GuillaumeGomez:improve-rustdoc-gui-ci, r=jsha
Improve rustdoc-gui CI

As commented [here](https://github.com/rust-lang/rust/pull/91179#discussion_r756023009):

When the text isn't displayed, the color returned by puppeteer is always `rgba(0,0,0,0)`, which is definitely not the right value. To prevent this error from happening again, `browser-ui-test` will now fail if a CSS color check is run when the text isn't displayed.

Either this PR or #91179 is merged first, they'll conflict because I made changes to the same test file.

cc `@jyn514`
r? `@jsha`
2021-11-26 06:44:00 +00:00
bors
9adfd9db78 Auto merge of #85102 - estebank:point-at-assignment, r=oli-obk
Diagnostic tweaks

* On type mismatch caused by assignment, point at the source of the expectation
* Hide redundant errors
* Suggest `while let` when `let` is missing in some cases
2021-11-26 03:57:55 +00:00