Commit graph

9455 commits

Author SHA1 Message Date
Michael 2ca9333011 Improve suggestion for extern crate self error message 2021-12-01 21:59:54 +00:00
Michael 62f4ce993e Stop treating extern crate loading failures as fatal errors 2021-12-01 21:04:13 +00:00
Michael 10b3a571d2 Factor out build reduced graph for extern crate 2021-12-01 21:04:12 +00:00
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 6952470095 rebase 2021-12-01 13:15:59 +01:00
b-naber 4d9a0bf21b address review 2021-12-01 12:12:40 +01:00
b-naber 84bcd40927 fix query description 2021-12-01 12:12:40 +01:00
b-naber 0b32cf3a8d remove static_assert_size on InterpError 2021-12-01 12:12:39 +01:00
b-naber ff448cfcee implement version of normalize_erasing_regions that doesn't assume value is normalizable 2021-12-01 12:12:38 +01:00
Matthias Krüger 4f252f1a91
Rollup merge of #91404 - nnethercote:fix-bad-NodeId-limit-checking, r=dtolnay
Fix bad `NodeId` limit checking.

`Resolver::next_node_id` converts a `u32` to a `usize` (which is
possibly bigger), does a checked add, and then converts the result back
to a `u32`. The `usize` conversion completely subverts the checked add!

This commit removes the conversion to/from `usize`.
2021-12-01 10:50:23 +01:00
Matthias Krüger c09c16c0df
Rollup merge of #91298 - FabianWolff:issue-91028-source-avail, r=cjgillot
Improve error message for `E0659` if the source is not available

Fixes #91028. The fix is similar to those in #89233 and #87088. With this change, instead of the dangling
```
note: `Option` could also refer to the enum defined here
```
I get
```
note: `Option` could also refer to an enum from prelude
```
If the standard library source code _is_ available, the output does not change.
2021-12-01 10:50:21 +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 a4f46742c2
Rollup merge of #90985 - camsteffen:diag-name-usage, r=jackh726
Use `get_diagnostic_name` more
2021-12-01 10:50:18 +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
bors 2446a21595 Auto merge of #91324 - eggyal:avoid-uneccesary-clone-of-annotatable, r=Aaron1011
Avoid uneccessary clone of Annotatable

Addresses FIXME comment created in #82608

r? `@Aaron1011`
2021-12-01 06:18:39 +00:00
Nicholas Nethercote e7ee8230ce Fix bad NodeId limit checking.
`Resolver::next_node_id` converts a `u32` to a `usize` (which is
possibly bigger), does a checked add, and then converts the result back
to a `u32`. The `usize` conversion completely subverts the checked add!

This commit removes the conversion to/from `usize`.
2021-12-01 15:08:37 +11: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 dc78cd4c61
Rollup merge of #91294 - cjgillot:process-elem, r=jackh726
Visit type in process_projection_elem.

Instead of reimplementing it for each visitor.
2021-11-30 23:43:31 +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
bors 1c0287830e Auto merge of #91388 - JohnTitor:rollup-640o1e5, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #91243 (Don't treat unnormalized function arguments as well-formed)
 - #91250 (Refactor EmitterWriter::emit_suggestion_default )
 - #91317 (tests: Ignore `test/debuginfo/rc_arc.rs` on windows-gnu)
 - #91323 (CTFE: support assert_zero_valid and assert_uninit_valid)
 - #91358 (Fix small typo)
 - #91360 (⬆️ rust-analyzer)
 - #91368 (Don't re-export `MirPass`)
 - #91383 (Add `drop_while` as doc alias to `Iterator::skip_while`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-30 10:45:22 +00:00
Yuki Okushi 898f1e4717
Rollup merge of #91368 - ecstatic-morse:mir-pass-reexport, r=cjgillot
Don't re-export `MirPass`

`rust-analyzer` wants to use the `rustc_const_eval` one by default, which is weird.

r? ``@cjgillot``
2021-11-30 17:29:12 +09:00
Yuki Okushi 56c838cdc7
Rollup merge of #91358 - kd-collective:fix_typo, r=cjgillot
Fix small typo

Fix a typo in code commenting!
`accross` -> `across`
2021-11-30 17:29:10 +09: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 626afa18b3
Rollup merge of #91250 - rukai:remove_trailing_whitespace, r=wesleywiser
Refactor EmitterWriter::emit_suggestion_default

Makes progress towards https://github.com/rust-lang/rust/issues/89979

Split into 2 commits:
* the first commit is purely a refactor and I verified that `./x.py test src/test/ui --stage 1` and  `./x.py test src/test/rustdoc-ui --stage 1` continue to pass on this commit.
* ~~the second commit removes the empty trailing line from diff style suggestions.~~ - I discovered an issue with this so its just the refactor now.

r? diagnostics
2021-11-30 17:29:07 +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
bors 90912e68ab Auto merge of #91330 - cjgillot:no-ee-features, r=Aaron1011
Remove eval_always for lib_features.

r? `@Aaron1011`
2021-11-30 07:40:08 +00:00
Dylan MacKenzie 188d670125 Don't re-export MirPass 2021-11-29 12:58:15 -08:00
Esteban Kuber c02710530c review comments: clean up 2021-11-29 18:39:08 +00:00
Ralf Jung 6c3c3e0952 CTFE: support assert_zero_valid and assert_uninit_valid 2021-11-29 11:49:31 -05:00
kijima 3c42a11895 Fix small typo 2021-11-30 01:31:10 +09: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
bors 8b954910c5 Auto merge of #91350 - matthiaskrgr:rollup-nleabdj, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #91049 (Add a caveat to std::os::windows::fs::symlink_file)
 - #91281 (Add demonstration test for #91161)
 - #91327 (Delete an unreachable codepath from format_args implementation)
 - #91336 (Remove unused root_parent.)
 - #91349 (Accumulate all values of `-C remark` option)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-29 10:34:52 +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 b8a4a4c232
Rollup merge of #91336 - cjgillot:root_parent, r=matthewjasper
Remove unused root_parent.
2021-11-29 10:41:37 +01:00
Matthias Krüger 7df49eff10
Rollup merge of #91327 - dtolnay:exact, r=michaelwoerister
Delete an unreachable codepath from format_args implementation
2021-11-29 10:41:36 +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
bors 44723c5d59 Auto merge of #91043 - camsteffen:descendant-eq, r=petrochenkov
Add fast path to `is_descendant_of`
2021-11-29 07:46:36 +00: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
Cameron Steffen ac8d514376 Add parent crate assert to register_expn_id 2021-11-28 16:35:54 -06:00
Cameron Steffen 768cfac705 Add fast path to is_descendant_of 2021-11-28 16:35:54 -06:00
Camille GILLOT 06b2e659d3 Remove unused root_parent. 2021-11-28 21:48:28 +01:00
Camille GILLOT 877b2d79d9 Remove eval_always for lib_features. 2021-11-28 21:13:36 +01:00
Camille GILLOT 5fb4648757 Take a LocalDefId in expect_*item. 2021-11-28 21:09:45 +01:00
David Tolnay cc53f1356d
Delete an unreachable codepath from format_args implementation 2021-11-28 11:52:38 -08:00
Alan Egerton d05e4d2c9b
Avoid uneccessary clone of Annotatable 2021-11-28 18:41:04 +00: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
Ben Reeves 6df2c78e1c Address PR feedback 2021-11-28 07:05:23 -06:00