Commit Graph

197469 Commits

Author SHA1 Message Date
Dylan DPC
a8c799a6a0
Rollup merge of #100022 - joboet:faster_threadid, r=joshtriplett
Optimize thread ID generation

By using atomics where available, thread IDs can be generated without locking while still enforcing uniqueness.
2022-08-12 20:39:09 +05:30
bors
cee1e157d7 Auto merge of #12993 - lowr:patch/swap-name-and-escaped-name, r=Veykril
Make `Name` hold escaped name

Resolves #12787
Resolves rust-lang/rust#99361

This PR effectively swaps `Name` and `EscapedName` in hir. In other words, it makes `Name` hold and print escaped raw identifiers and introduces another struct `UnescapedName` for cases where you need to print names without "r#" prefix.

My rationale is that it makes it easier for us to format an escaped name into string, which is what we want when we serialize names in general. This is because we format a name into string usually when we are presenting it to the users and arguably they expect its escaped form as that's what they see and write in the source code.

I split the change for `Name` into 3 commits to make it easier to follow but it also made some tests fail in the intermediate commits. I can squash them into a commit after the review if desired. I've also made similar changes for `ModPath` and `EscapedModPath` as it makes them consistent with `Name`.

For reference, there was a brief discussion on this in [a zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/escaping.20.60Name.60s).
2022-08-12 14:53:45 +00:00
bors
0068b8bf4b Auto merge of #100328 - davidtwco:perf-implications, r=nnethercote
passes: load `defined_lib_features` query less

Hopefully addresses the perf regressions from #99212 (see #99905).

Re-structure the stability checks for library features to avoid calling `defined_lib_features` for any more crates than necessary for each of the implications or local feature attributes that need validation.

r? `@ghost` (just checking perf at first)
2022-08-12 13:51:26 +00:00
Maybe Waffle
5fbcde1b55 fill-in tracking issue for feature(iter_array_chunks) 2022-08-12 15:04:29 +04:00
Maybe Waffle
eb6b729545 address review comments 2022-08-12 14:57:15 +04:00
Michael Woerister
ee634fbf0d [debuginfo] Update codegen tests for new cpp-like enum debuginfo encoding. 2022-08-12 12:00:02 +02:00
bors
569788e47e Auto merge of #99624 - vincenzopalazzo:macros/unix_error, r=Amanieu
promote debug_assert to assert when possible and useful

This PR fixed a very old issue https://github.com/rust-lang/rust/issues/94705 to clarify and improve the POSIX error checking, and some of the checks are skipped because can have no benefit, but I'm sure that this can open some interesting discussion.

Fixes https://github.com/rust-lang/rust/issues/94705

cc: `@tavianator`
cc: `@cuviper`
2022-08-12 09:49:55 +00:00
Guillaume Gomez
001cc12af7 remove Clean trait implementation for hir::BareFnTy 2022-08-12 11:40:39 +02:00
Guillaume Gomez
a65647a7f6 remove Clean trait implementation for hir::PathSegment 2022-08-12 11:37:32 +02:00
Goldstein
3fb249bebc
improve "try ignoring the field" diagnostic
Closes #95795
2022-08-12 12:32:43 +03:00
Takayuki Maeda
48c0341a70 suggest removing a semicolon after impl/trait items 2022-08-12 18:11:01 +09:00
Krasimir Georgiev
43eda18a6c adapt test for msan message change
LLVM commit 057cabd997 removed the function from the msan error message. This adapts our test accordingly.

Found via our experimental rust + llvm @ HEAD bot:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12634#018289fe-b0bc-4bab-89b3-fb1d4e38f6db
2022-08-12 08:59:42 +00:00
Michael Woerister
b0e3ed6e8d [debuginfo] Use IndexMap instead of FxHashMap while generating cpp-like generator debuginfo. 2022-08-12 10:53:08 +02:00
Michael Woerister
95d7591478 [debuginfo] Update cpp-like enum decoding docs to account for wrapping tag ranges. 2022-08-12 10:53:08 +02:00
Michael Woerister
171d8a3f57 [debuginfo] Don't mark fields and types as artificial in CPP-like enum debuginfo encoding.
LLDB historically has had problems with "artificial" entries and there
is no real benefit to emitting that flag.
2022-08-12 10:53:08 +02:00
Michael Woerister
8433e2a66f [debuginfo] Remove the notion of a 'fallback variant' from the CPP-like enum debuginfo encoding. 2022-08-12 10:53:08 +02:00
Michael Woerister
dfb2c89e5e [compiletest] Add compiler-bundled NatVis files to test input stamp. 2022-08-12 10:53:07 +02:00
Michael Woerister
8ef0301833 intrinsic.natvis: Add comments, make names more consistent. 2022-08-12 10:53:07 +02:00
Michael Woerister
3a72ea05a0 [debuginfo] Add more test cases cpp-like enum debuginfo. 2022-08-12 10:53:07 +02:00
Michael Woerister
1bbda887ff intrinsic.natvis: Don't access fields from context object in <Intrinsic>.
WinDbg supports that but Visual Studio doesn't. Pass the value as a parameter instead.
2022-08-12 10:53:07 +02:00
Michael Woerister
6875f1272f Remove out-dated NatVis visualizer. 2022-08-12 10:53:07 +02:00
Michael Woerister
725ceae455 Support wrapping 128-bit tag ranges for cpp-like enum debuginfo. 2022-08-12 10:53:07 +02:00
Michael Woerister
063ebfa570 Use enum2<_> instead of enum<_> for Cpp-like debuginfo enum type names.
And add more comments about niche tag enum encoding.
2022-08-12 10:53:07 +02:00
Michael Woerister
622da5d834 debuginfo: Change C++-like encoding for enums.
The updated encoding should be able to handle niche layouts where
more than one variant has fields.
2022-08-12 10:53:07 +02:00
est31
981852677c Add regression test for #94176 2022-08-12 10:03:57 +02:00
Cormac Relf
e3c5bd617d let-else: add a test for warnings on let-else with diverging tail 2022-08-12 10:03:57 +02:00
bors
cc65e1a548 Auto merge of #100435 - ehuss:update-cargo, r=ehuss
Update cargo

8 commits in ce40690a5e4e315d3dab0aae1eae69d0252c52ac..efd4ca3dc0b89929dc8c5f5c023d25978d76cb61
2022-08-09 22:32:17 +0000 to 2022-08-12 01:28:28 +0000
- Use `std:🧵:scope` to replace crossbeam (rust-lang/cargo#10977)
- [docs] Remove extra "in" from `cargo-test.md` (rust-lang/cargo#10978)
- Enable two windows tests (rust-lang/cargo#10930)
- Improve error msg for get target runner (rust-lang/cargo#10968)
- Ensure rustc-echo-wrapper works with an overridden build.target-dir (rust-lang/cargo#10962)
- Switch back to `available_parallelism` (rust-lang/cargo#10969)
- Only override published resolver when the workspace is different (rust-lang/cargo#10961)
- Add `CARGO_LOG` to "Environment variables Cargo reads" (rust-lang/cargo#10967)
2022-08-12 06:45:35 +00:00
Eric Huss
900a9d3f4e Update clippy for introduction of Node::ExprField 2022-08-11 21:56:33 -07:00
Eric Huss
1c70b8669a Fix diagnostic that was looking for a PatKind::Struct
Now that fields are first-class HIR nodes, they appear before the struct pat.
2022-08-11 21:48:39 -07:00
Eric Huss
c655f17bce Add missing visit_pat_field in early lint visitor.
This ensures that lint attributes on pattern fields can control
early lints.
2022-08-11 21:48:39 -07:00
Eric Huss
7b36047239 Make Node::ExprField a child of Node::Expr.
This was incorrectly inserting the ExprField as a sibling of the struct
expression.

This required adjusting various parts which were looking at parent node
of a field expression to find the struct.
2022-08-11 21:48:39 -07:00
Eric Huss
dcd5177fd4 Add visitors for PatField and ExprField.
This helps simplify the code. It also fixes it to use the correct parent
when lowering. One consequence is the `non_snake_case` lint needed
to change the way it looked for parent nodes in a struct pattern.

This also includes a small fix to use the correct `Target` for
expression field attribute validation.
2022-08-11 21:48:39 -07:00
Eric Huss
6c7cb2bb77 Honor lint level attributes in more places.
This extends the LintLevelBuilder to handle lint level attributes on
struct expression fields and pattern fields.

This also updates the early lints to honor lint levels on generic
parameters.
2022-08-11 21:48:39 -07:00
Eric Huss
b651c1cebe Check attributes on struct expression fields.
Attributes on struct expression fields were not being checked for
validity. This adds the fields as HIR nodes so that `CheckAttrVisitor`
can visit those nodes to check their attributes.
2022-08-11 21:48:39 -07:00
Eric Huss
1b464c73b7 Check attributes on pattern fields.
Attributes on pattern struct fields were not being checked for validity.
This adds the fields as HIR nodes so that the `CheckAttrVisitor` can
visit those nodes to check their attributes.
2022-08-11 21:48:39 -07:00
Michael Goulet
f94220f68e Erase regions better in promote_candidate 2022-08-12 03:48:40 +00:00
Eric Huss
bffa751b2f Update cargo 2022-08-11 20:03:43 -07:00
bors
e2b52ff73e Auto merge of #99464 - nikic:llvm-15, r=cuviper
Update to LLVM 15

For preliminary testing. Some LLVM 15 compatibility fixes were applied separately in #99512.

Release timeline:
 * LLVM 15 branched on Jul 26.
 * The final LLVM 15.0.0 release is scheduled for Sep 6.
 * Current nightly (1.65.0) is scheduled for Nov 3.

Changes in this PR (apart from the LLVM update):
 * Pass `--set llvm.allow-old-toolchain` for many Docker images. LLVM 16 will require GCC >= 7.1, while LLVM 15 still allows older compilers with an option. Specify the option for builders still using GCC 5.4. #95026 updated some of the used toolchains, but not all.
 * Use the `+atomics-32` target feature for thumbv6m.
 * Explicitly link libatomic when cross-compiling LLVM to 32-bit target.
 * Explicitly disable zstd support, to avoid libzstd.so dependency.

New LLVM patches ([commits](https://github.com/rust-lang/llvm-project/commits/rustc/15.0-2022-08-09)):
 * [rust-only] Fix ICE with GCC 5.4 (15be58d7f0)
 * [rust-only] Fix build with GCC 5.4 (774edc10fa)
 * ~~[rust-only] Fix build with GCC 5.2 (1a6069a7bb)~~
 * ~~[rust-only] Fix ICE with GCC 5.2 (493081f290)~~
 * ~~[rust-only] Fix build with GCC 5.2 (0fc5979d73)~~
 * [backported] Addition of `+atomics` target feature (57bdd9892d).
 * [backported] Revert compiler-rt change that broke powerpc (9c68b43915)
 * [awaiting backport] Fix RelLookupTableConverter on gnux32 (639388a05f / https://github.com/llvm/llvm-project/issues/57021)

Tested images: dist-x86_64-linux, armhf-gnu, arm-android, dist-s390x-linux, dist-x86_64-illumos, dist-x86_64-freebsd, wasm32, dist-x86_64-musl, dist-various-1, dist-riscv64-linux, dist-mips-linux, dist-mipsel-linux, dist-powerpc-linux, dist-aarch64-linux, dist-x86_64-apple, x86_64-msvc-1, x86_64-msvc-2, dist-various-2, dist-arm-linux
Tested up to the usual ipv6 error: test-various, i686-gnu, x86_64-gnu-nopt

r? `@ghost`
2022-08-12 02:58:51 +00:00
Michael Goulet
e182d12a84 Fix HIR pretty printing of let else 2022-08-12 02:47:57 +00:00
bors
b998821e4c Auto merge of #100419 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2022-08-12 00:12:51 +00:00
Jacob Hoffman-Andrews
dd4613cbc0 rustdoc: don't generate DOM element for operator
In our source page highlighting, we were generating `<span class="op">`
tags for all "operators", including e.g. `<` `>` around generic
parameters, `*`, `&`. This contributed significantly to DOM size, but
we don't actually style `.op` except in the ayu theme.

Remove the styles for `.op` in ayu, and stop generating the `<span>`s.

This reduces DOM size of an example page[1] from 265,938 HTML elements
to 242,165 elements, a 9% reduction.

[1]:
https://doc.rust-lang.org/nightly/src/core/up/up/stdarch/crates/core_arch/src/x86/avx512f.rs.html
2022-08-11 17:00:17 -07:00
ridwanabdillahi
100882296e Add support for generating unique *.profraw files by default when using the -C instrument-coverage flag.
Respond to PR comments.
2022-08-11 16:04:08 -07:00
Josh Stone
115dfe267e Patch lld for older toolchains 2022-08-11 15:51:59 -07:00
bors
2ed0f29168 Auto merge of #100426 - matthiaskrgr:rollup-0ks4dou, r=matthiaskrgr
Rollup of 13 pull requests

Successful merges:

 - #93896 (rustdoc: make item-infos dimmer on dark theme)
 - #99337 (rustdoc: simplify highlight.rs)
 - #99421 (add crt-static for android)
 - #99500 (Fix flags when using clang as linker for Fuchsia)
 - #99511 (make raw_eq precondition more restrictive)
 - #99992 (Add `x.sh` and `x.ps1` shell scripts)
 - #100112 (Fix test: chunks_mut_are_send_and_sync)
 - #100203 (provide correct size hint for unsupported platform `CommandArgs`)
 - #100307 (Fix #96847)
 - #100350 (Stringify non-shorthand visibility correctly)
 - #100374 (Improve crate selection on rustdoc search results page)
 - #100392 (Simplify visitors)
 - #100418 (Add stability attributes to BacktraceStatus variants)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-11 21:30:07 +00:00
León Orell Valerian Liehr
0fb4ef6769 Suggest path separator when a dot is used on a trait 2022-08-11 23:09:39 +02:00
Matthias Krüger
c7578b4e65
Rollup merge of #100418 - tbodt:stabilize-backtrace, r=dtolnay
Add stability attributes to BacktraceStatus variants

Fixes #100399
2022-08-11 22:53:10 +02:00
Matthias Krüger
8237efc52d
Rollup merge of #100392 - nnethercote:simplify-visitors, r=cjgillot
Simplify visitors

By removing some unused arguments.

r? `@cjgillot`
2022-08-11 22:53:08 +02:00
Matthias Krüger
cefcfda6e6
Rollup merge of #100374 - GuillaumeGomez:improve_rustdoc_search_results_page_crates_selection, r=notriddle
Improve crate selection on rustdoc search results page

Take over of #98855 (screenshots and explanations are there).

You can test it [here](https://rustdoc.crud.net/imperio/improve_rustdoc_search_results_page_crates_selection/std/index.html?search=test).

cc ``@steffahn`` ``@jsha``
r? ``@notriddle``
2022-08-11 22:53:07 +02:00
Matthias Krüger
6ae0414122
Rollup merge of #100350 - jhpratt:stringify-vis, r=cjgillot
Stringify non-shorthand visibility correctly

This makes `stringify!(pub(in crate))` evaluate to `pub(in crate)` rather than `pub(crate)`, matching the behavior before the `crate` shorthand was removed. Further, this changes `stringify!(pub(in super))` to evaluate to `pub(in super)` rather than the current `pub(super)`. If the latter is not desired (it is _technically_ breaking), it can be undone.

Fixes #99981

`@rustbot` label +C-bug +regression-from-stable-to-beta +T-compiler
2022-08-11 22:53:06 +02:00
Matthias Krüger
e221aafae6
Rollup merge of #100307 - nnethercote:fix-96847, r=cjgillot
Fix #96847

r? `@petrochenkov`
2022-08-11 22:53:05 +02:00