]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoConvert `newtype_index` to a proc macro
Aaron Hill [Wed, 9 Feb 2022 22:24:51 +0000 (17:24 -0500)]
Convert `newtype_index` to a proc macro

The `macro_rules!` implementation was becomng excessively complicated,
and difficult to modify. The new proc macro implementation should make
it much easier to add new features (e.g. skipping certain `#[derive]`s)

2 years agoAuto merge of #94131 - Mark-Simulacrum:fmt-string, r=oli-obk
bors [Thu, 24 Feb 2022 17:18:07 +0000 (17:18 +0000)]
Auto merge of #94131 - Mark-Simulacrum:fmt-string, r=oli-obk

Always format to internal String in FmtPrinter

This avoids monomorphizing for different parameters, decreasing generic code
instantiated downstream from rustc_middle -- locally seeing 7% unoptimized LLVM IR
line wins on rustc_borrowck, for example.

We likely can't/shouldn't get rid of the Result-ness on most functions, though some
further cleanup avoiding fmt::Error where we now know it won't occur may be possible,
though somewhat painful -- fmt::Write is a pretty annoying API to work with in practice
when you're trying to use it infallibly.

2 years agoAuto merge of #94123 - bjorn3:cg_ssa_singleton_builder, r=tmiasko
bors [Thu, 24 Feb 2022 12:28:19 +0000 (12:28 +0000)]
Auto merge of #94123 - bjorn3:cg_ssa_singleton_builder, r=tmiasko

Partially move cg_ssa towards using a single builder

Not all codegen backends can handle hopping between blocks well. For example Cranelift requires blocks to be terminated before switching to building a new block. Rust-gpu requires a `RefCell` to allow hopping between blocks and cg_gcc currently has a buggy implementation of hopping between blocks. This PR reduces the amount of cases where cg_ssa switches between blocks before they are finished and mostly fixes the block hopping in cg_gcc. (~~only `scalar_to_backend` doesn't handle it correctly yet in cg_gcc~~ fixed that one.)

`@antoyo` please review the cg_gcc changes.

2 years agoIntroduce Bx::switch_to_block
bjorn3 [Fri, 18 Feb 2022 14:37:31 +0000 (15:37 +0100)]
Introduce Bx::switch_to_block

2 years agoAuto merge of #94129 - cjgillot:rmeta-table, r=petrochenkov
bors [Thu, 24 Feb 2022 10:02:26 +0000 (10:02 +0000)]
Auto merge of #94129 - cjgillot:rmeta-table, r=petrochenkov

Back more metadata using per-query tables

r? `@ghost`

2 years agoAuto merge of #94314 - matthiaskrgr:rollup-hmed8n7, r=matthiaskrgr
bors [Thu, 24 Feb 2022 06:56:38 +0000 (06:56 +0000)]
Auto merge of #94314 - matthiaskrgr:rollup-hmed8n7, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #89887 (Change `char` type in debuginfo to DW_ATE_UTF)
 - #94267 (Remove unused ordering derivations and bounds for `SimplifiedTypeGen`)
 - #94270 (Miri: relax fn ptr check)
 - #94273 (add matching doc to errorkind)
 - #94283 (remove feature gate in control_flow examples)
 - #94288 (Cleanup a few Decoder methods)
 - #94292 (riscv32imc_esp_espidf: set max_atomic_width to 64)
 - #94296 (:arrow_up: rust-analyzer)
 - #94300 (Fix a typo in documentation of `array::IntoIter::new_unchecked`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #94300 - WaffleLapkin:patch-4, r=scottmcm
Matthias Krüger [Thu, 24 Feb 2022 06:48:12 +0000 (07:48 +0100)]
Rollup merge of #94300 - WaffleLapkin:patch-4, r=scottmcm

Fix a typo in documentation of `array::IntoIter::new_unchecked`

🌸

2 years agoRollup merge of #94296 - lnicola:rust-analyzer-2022-02-23, r=lnicola
Matthias Krüger [Thu, 24 Feb 2022 06:48:11 +0000 (07:48 +0100)]
Rollup merge of #94296 - lnicola:rust-analyzer-2022-02-23, r=lnicola

:arrow_up: rust-analyzer

r? `@ghost`

2 years agoRollup merge of #94292 - esp-rs:riscv32imc-esp-espidf-64bit-atomics, r=petrochenkov
Matthias Krüger [Thu, 24 Feb 2022 06:48:10 +0000 (07:48 +0100)]
Rollup merge of #94292 - esp-rs:riscv32imc-esp-espidf-64bit-atomics, r=petrochenkov

riscv32imc_esp_espidf: set max_atomic_width to 64

For espidf targets without native atomics, there is atomic emulation inside [the newlib component of espidf](https://github.com/espressif/esp-idf/blob/master/components/newlib/stdatomic.c), this has been extended to support emulation up to 64bits therefore we are safe to increase the atomic width for the `riscv32imc_esp_espidf` target.

Closes https://github.com/esp-rs/rust/issues/107

cc: `@ivmarkov`

2 years agoRollup merge of #94288 - Mark-Simulacrum:ser-opt, r=nnethercote
Matthias Krüger [Thu, 24 Feb 2022 06:48:09 +0000 (07:48 +0100)]
Rollup merge of #94288 - Mark-Simulacrum:ser-opt, r=nnethercote

Cleanup a few Decoder methods

This is just some simple follow up to #93839.

r? `@nnethercote`

2 years agoRollup merge of #94283 - hellow554:stable_flow_control, r=Dylan-DPC
Matthias Krüger [Thu, 24 Feb 2022 06:48:08 +0000 (07:48 +0100)]
Rollup merge of #94283 - hellow554:stable_flow_control, r=Dylan-DPC

remove feature gate in control_flow examples

Stabilization was done in https://github.com/rust-lang/rust/pull/91091, but the two examples weren't updated accordingly.

Probably too late to put it into stable, but it should be in the next release :)

2 years agoRollup merge of #94273 - Dylan-DPC:doc/errorkind, r=joshtriplett
Matthias Krüger [Thu, 24 Feb 2022 06:48:07 +0000 (07:48 +0100)]
Rollup merge of #94273 - Dylan-DPC:doc/errorkind, r=joshtriplett

add matching doc to errorkind

Rework of #90706

2 years agoRollup merge of #94270 - RalfJung:fn-ptrs, r=oli-obk
Matthias Krüger [Thu, 24 Feb 2022 06:48:06 +0000 (07:48 +0100)]
Rollup merge of #94270 - RalfJung:fn-ptrs, r=oli-obk

Miri: relax fn ptr check

As discussed in https://github.com/rust-lang/unsafe-code-guidelines/issues/72#issuecomment-1025407536, the function pointer check done by Miri is currently overeager: contrary to our usual principle of only checking rather uncontroversial validity invariants, we actually check that the pointer points to a real function.

So, this relaxes the check to what the validity invariant probably will be (and what the reference already says it is): the function pointer must be non-null, and that's it.

The check that CTFE does on the final value of a constant is unchanged -- CTFE recurses through references, so it makes some sense to also recurse through function pointers. We might still want to relax this in the future, but that would be a separate change.

r? `@oli-obk`

2 years agoRollup merge of #94267 - pierwill:fast-reject-bound, r=michaelwoerister
Matthias Krüger [Thu, 24 Feb 2022 06:48:05 +0000 (07:48 +0100)]
Rollup merge of #94267 - pierwill:fast-reject-bound, r=michaelwoerister

Remove unused ordering derivations and bounds for `SimplifiedTypeGen`

This is another small PR clearing the way for work on #90317.

2 years agoRollup merge of #89887 - arlosi:char-debug, r=wesleywiser
Matthias Krüger [Thu, 24 Feb 2022 06:48:04 +0000 (07:48 +0100)]
Rollup merge of #89887 - arlosi:char-debug, r=wesleywiser

Change `char` type in debuginfo to DW_ATE_UTF

Rust previously encoded the `char` type as DW_ATE_unsigned_char. The more appropriate encoding is `DW_ATE_UTF`.

Clang also uses the DW_ATE_UTF for `char32_t` in C++.

This fixes the display of the `char` type in the Windows debuggers. Without this change, the variable did not show in the locals window.
![image](https://user-images.githubusercontent.com/704597/137368067-9b3e4dc8-a075-44ba-a687-bf3810a44e5a.png)

LLDB 13 is also able to display the char value, when before it failed with `need to add support for DW_TAG_base_type 'char' encoded with DW_ATE = 0x8, bit_size = 32`

r? `@wesleywiser`

2 years agoAuto merge of #94107 - tmiasko:fewer-types, r=davidtwco
bors [Thu, 24 Feb 2022 04:07:48 +0000 (04:07 +0000)]
Auto merge of #94107 - tmiasko:fewer-types, r=davidtwco

Reapply cg_llvm: `fewer_names` in `uncached_llvm_type`

r? `@davidtwco` `@erikdesjardins`

2 years agoAuto merge of #93438 - spastorino:node_id_to_hir_id_refactor, r=oli-obk
bors [Thu, 24 Feb 2022 01:26:57 +0000 (01:26 +0000)]
Auto merge of #93438 - spastorino:node_id_to_hir_id_refactor, r=oli-obk

Node id to hir id refactor

Related to #89278

r? `@oli-obk`

2 years agoword wrpa
Dylan DPC [Wed, 23 Feb 2022 23:37:06 +0000 (00:37 +0100)]
word wrpa

2 years agoword wrpa
Dylan DPC [Wed, 23 Feb 2022 23:30:07 +0000 (00:30 +0100)]
word wrpa

2 years agoUpdate library/std/src/io/error.rs
Dylan DPC [Wed, 23 Feb 2022 22:18:42 +0000 (23:18 +0100)]
Update library/std/src/io/error.rs

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2 years agoMiri: relax fn ptr check
Ralf Jung [Tue, 22 Feb 2022 23:49:12 +0000 (18:49 -0500)]
Miri: relax fn ptr check

2 years agoAuto merge of #94286 - matthiaskrgr:rollup-6i1spjg, r=matthiaskrgr
bors [Wed, 23 Feb 2022 18:18:23 +0000 (18:18 +0000)]
Auto merge of #94286 - matthiaskrgr:rollup-6i1spjg, r=matthiaskrgr

Rollup of 12 pull requests

Successful merges:

 - #94128 (rustdoc: several minor fixes)
 - #94137 (rustdoc-json: Better Header Type)
 - #94213 (fix names in feature(...) suggestion)
 - #94240 (Suggest calling .display() on `PathBuf` too)
 - #94253 (Use 2021 edition in ./x.py fmt)
 - #94259 (Bump download-ci-llvm-stamp for llvm-nm inclusion)
 - #94260 (Fix rustdoc infinite redirection generation)
 - #94263 (Typo fix: Close inline-code backtick)
 - #94264 (Fix typo.)
 - #94271 (Miri: extend comments on downcast operation)
 - #94280 (Rename `region_should_not_be_omitted` to `should_print_region`)
 - #94285 (Sync rustc_codegen_cranelift)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoFix a typo in documentation of `array::IntoIter::new_unchecked`
Waffle Maybe [Wed, 23 Feb 2022 18:10:04 +0000 (21:10 +0300)]
Fix a typo in documentation of `array::IntoIter::new_unchecked`

2 years agoChange `char` type in debuginfo to DW_ATE_UTF
Arlo Siemsen [Thu, 14 Oct 2021 17:26:42 +0000 (10:26 -0700)]
Change `char` type in debuginfo to DW_ATE_UTF

Rust previously encoded the `char` type as DW_ATE_unsigned_char. The more
appropriate encoding is DW_ATE_UTF.

Clang uses this same debug encoding for char32_t.

This fixes the display of `char` types in Windows debuggers as well as LLDB.

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Wed, 23 Feb 2022 15:11:18 +0000 (17:11 +0200)]
:arrow_up: rust-analyzer

2 years agoriscv32imc_esp_espidf: set max_atomic_width to 64
Scott Mabin [Tue, 22 Feb 2022 10:44:56 +0000 (10:44 +0000)]
riscv32imc_esp_espidf: set max_atomic_width to 64

2 years agoRollup merge of #94285 - bjorn3:sync_cg_clif-2022-02-23, r=bjorn3
Matthias Krüger [Wed, 23 Feb 2022 11:26:48 +0000 (12:26 +0100)]
Rollup merge of #94285 - bjorn3:sync_cg_clif-2022-02-23, r=bjorn3

Sync rustc_codegen_cranelift

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler

2 years agoRollup merge of #94280 - tmiasko:should-print-region, r=oli-obk
Matthias Krüger [Wed, 23 Feb 2022 11:26:47 +0000 (12:26 +0100)]
Rollup merge of #94280 - tmiasko:should-print-region, r=oli-obk

Rename `region_should_not_be_omitted` to `should_print_region`

to avoid double negation

2 years agoRollup merge of #94271 - RalfJung:downcast, r=oli-obk
Matthias Krüger [Wed, 23 Feb 2022 11:26:46 +0000 (12:26 +0100)]
Rollup merge of #94271 - RalfJung:downcast, r=oli-obk

Miri: extend comments on downcast operation

r? `@oli-obk`

2 years agoRollup merge of #94264 - NyantasticUwU:patch-1, r=yaahc
Matthias Krüger [Wed, 23 Feb 2022 11:26:45 +0000 (12:26 +0100)]
Rollup merge of #94264 - NyantasticUwU:patch-1, r=yaahc

Fix typo.

Yeah just a typo (probably some breaking changes in here be careful) :)

2 years agoRollup merge of #94263 - anko:patch-1, r=GuillaumeGomez
Matthias Krüger [Wed, 23 Feb 2022 11:26:45 +0000 (12:26 +0100)]
Rollup merge of #94263 - anko:patch-1, r=GuillaumeGomez

Typo fix: Close inline-code backtick

A drop in the ocean.

2 years agoRollup merge of #94260 - GuillaumeGomez:infinite-redirection, r=notriddle
Matthias Krüger [Wed, 23 Feb 2022 11:26:44 +0000 (12:26 +0100)]
Rollup merge of #94260 - GuillaumeGomez:infinite-redirection, r=notriddle

Fix rustdoc infinite redirection generation

Someone came to me about a funny bug they had when clicking on any link on [this page](https://world.pages.gitlab.gnome.org/Rust/libadwaita-rs/stable/latest/docs/libadwaita/builders/index.html): it ended one page redirecting to itself indefinitely.

I was able to make a minimum reproducible case to trigger this bug which I now use as a test.

r? ``@notriddle``

2 years agoRollup merge of #94259 - krasimirgg:bump-llvm-ci, r=Mark-Simulacrum
Matthias Krüger [Wed, 23 Feb 2022 11:26:44 +0000 (12:26 +0100)]
Rollup merge of #94259 - krasimirgg:bump-llvm-ci, r=Mark-Simulacrum

Bump download-ci-llvm-stamp for llvm-nm inclusion

We started using it in https://github.com/rust-lang/rust/pull/94023.

2 years agoRollup merge of #94253 - bjorn3:xpy-fmt-2021, r=Mark-Simulacrum
Matthias Krüger [Wed, 23 Feb 2022 11:26:43 +0000 (12:26 +0100)]
Rollup merge of #94253 - bjorn3:xpy-fmt-2021, r=Mark-Simulacrum

Use 2021 edition in ./x.py fmt

2 years agoRollup merge of #94240 - compiler-errors:pathbuf-display, r=lcnr
Matthias Krüger [Wed, 23 Feb 2022 11:26:42 +0000 (12:26 +0100)]
Rollup merge of #94240 - compiler-errors:pathbuf-display, r=lcnr

Suggest calling .display() on `PathBuf` too

Fixes #94210

2 years agoRollup merge of #94213 - digama0:patch-4, r=Dylan-DPC
Matthias Krüger [Wed, 23 Feb 2022 11:26:41 +0000 (12:26 +0100)]
Rollup merge of #94213 - digama0:patch-4, r=Dylan-DPC

fix names in feature(...) suggestion

2 years agoRollup merge of #94137 - aDotInTheVoid:abi-enum, r=CraftSpider
Matthias Krüger [Wed, 23 Feb 2022 11:26:41 +0000 (12:26 +0100)]
Rollup merge of #94137 - aDotInTheVoid:abi-enum, r=CraftSpider

rustdoc-json: Better Header Type

- Make ABI an enum, instead of being stringly typed
- Replace Qualifier HashSet with 3 bools
- Merge ABI field into header, as they always occor together

r? ``@CraftSpider``

``@rustbot`` modify labels: +A-rustdoc-json +T-rustdoc

2 years agoRollup merge of #94128 - mqy:master, r=Dylan-DPC
Matthias Krüger [Wed, 23 Feb 2022 11:26:40 +0000 (12:26 +0100)]
Rollup merge of #94128 - mqy:master, r=Dylan-DPC

rustdoc: several minor fixes

``@rustbot`` label A-docs

2 years agoMerge commit '35d9c6bf256968e1b40e0d554607928bdf9cebea' into sync_cg_clif-2022-02-23
bjorn3 [Wed, 23 Feb 2022 10:49:34 +0000 (11:49 +0100)]
Merge commit '35d9c6bf256968e1b40e0d554607928bdf9cebea' into sync_cg_clif-2022-02-23

2 years agoRustup to rustc 1.61.0-nightly (68369a041 2022-02-22)
bjorn3 [Wed, 23 Feb 2022 10:45:41 +0000 (11:45 +0100)]
Rustup to rustc 1.61.0-nightly (68369a041 2022-02-22)

2 years agoSync from rust bafe8d06e015eb00724d3d497516191d6681943f
bjorn3 [Wed, 23 Feb 2022 10:38:28 +0000 (11:38 +0100)]
Sync from rust bafe8d06e015eb00724d3d497516191d6681943f

2 years agoremove feature gate in control_flow examples
Marcel Hellwig [Wed, 23 Feb 2022 09:42:46 +0000 (10:42 +0100)]
remove feature gate in control_flow examples

2 years agoAuto merge of #94277 - ehuss:update-cargo, r=ehuss
bors [Wed, 23 Feb 2022 08:04:34 +0000 (08:04 +0000)]
Auto merge of #94277 - ehuss:update-cargo, r=ehuss

Update cargo

8 commits in ea2a21c994ca1e4d4c49412827b3cf4dcb158b1d..d6cdde584a1f15ea086bae922e20fd27f7165431
2022-02-15 04:24:07 +0000 to 2022-02-22 19:55:51 +0000
- Add common profile validation. (rust-lang/cargo#10411)
- Add -Z check-cfg-features to enable compile-time checking of features (rust-lang/cargo#10408)
- Remove invalid target-specific dependency example. (rust-lang/cargo#10401)
- Fix errors in `cargo fetch` usage guide (rust-lang/cargo#10398)
- Fix some broken doc links. (rust-lang/cargo#10404)
- Implement "artifact dependencies" (RFC-3028) (rust-lang/cargo#9992)
- Print executable name on cargo test --no-run rust-lang/cargo#2 (rust-lang/cargo#10346)
- Avoid new deprecation warnings from clap 3.1.0 (rust-lang/cargo#10396)

2 years agoRename `region_should_not_be_omitted` to `should_print_region`
Tomasz Miąsko [Tue, 22 Feb 2022 00:00:00 +0000 (00:00 +0000)]
Rename `region_should_not_be_omitted` to `should_print_region`

to avoid double negation

2 years agoUpdate cargo
Eric Huss [Wed, 23 Feb 2022 07:22:42 +0000 (23:22 -0800)]
Update cargo

2 years agoRemove unused ordering derivations and bounds for `SimplifiedTypeGen`
pierwill [Tue, 22 Feb 2022 21:56:37 +0000 (15:56 -0600)]
Remove unused ordering derivations and bounds for `SimplifiedTypeGen`

2 years agoadd some more summary from pr discussion
Dylan DPC [Wed, 23 Feb 2022 02:29:02 +0000 (03:29 +0100)]
add some more summary from pr discussion

2 years agoadd some more summary from pr discussion
Dylan DPC [Wed, 23 Feb 2022 02:28:27 +0000 (03:28 +0100)]
add some more summary from pr discussion

2 years agoadd matching to errorkind
Dylan DPC [Wed, 23 Feb 2022 02:22:23 +0000 (03:22 +0100)]
add matching to errorkind

2 years agoAuto merge of #93984 - nnethercote:ChunkedBitSet, r=Mark-Simulacrum
bors [Wed, 23 Feb 2022 01:26:07 +0000 (01:26 +0000)]
Auto merge of #93984 - nnethercote:ChunkedBitSet, r=Mark-Simulacrum

Introduce `ChunkedBitSet` and use it for some dataflow analyses.

This reduces peak memory usage significantly for some programs with very
large functions.

r? `@ghost`

2 years agoMiri: extend comments on downcast operation
Ralf Jung [Wed, 23 Feb 2022 00:09:11 +0000 (19:09 -0500)]
Miri: extend comments on downcast operation

2 years agoIntroduce `ChunkedBitSet` and use it for some dataflow analyses.
Nicholas Nethercote [Wed, 9 Feb 2022 13:47:48 +0000 (00:47 +1100)]
Introduce `ChunkedBitSet` and use it for some dataflow analyses.

This reduces peak memory usage significantly for some programs with very
large functions, such as:
- `keccak`, `unicode_normalization`, and `match-stress-enum`, from
  the `rustc-perf` benchmark suite;
- `http-0.2.6` from crates.io.

The new type is used in the analyses where the bitsets can get huge
(e.g. 10s of thousands of bits): `MaybeInitializedPlaces`,
`MaybeUninitializedPlaces`, and `EverInitializedPlaces`.

Some refactoring was required in `rustc_mir_dataflow`. All existing
analysis domains are either `BitSet` or a trivial wrapper around
`BitSet`, and access in a few places is done via `Borrow<BitSet>` or
`BorrowMut<BitSet>`. Now that some of these domains are `ClusterBitSet`,
that no longer works. So this commit replaces the `Borrow`/`BorrowMut`
usage with a new trait `BitSetExt` containing the needed bitset
operations. The impls just forward these to the underlying bitset type.
This required fiddling with trait bounds in a few places.

The commit also:
- Moves `static_assert_size` from `rustc_data_structures` to
  `rustc_index` so it can be used in the latter; the former now
  re-exports it so existing users are unaffected.
- Factors out some common "clear excess bits in the final word"
  functionality in `bit_set.rs`.
- Uses `fill` in a few places instead of loops.

2 years agoDelete Decoder::read_unit
Mark Rousskov [Tue, 22 Feb 2022 23:14:51 +0000 (18:14 -0500)]
Delete Decoder::read_unit

2 years agoProvide copy-free access to raw Decoder bytes
Mark Rousskov [Tue, 22 Feb 2022 23:11:59 +0000 (18:11 -0500)]
Provide copy-free access to raw Decoder bytes

2 years agoProvide raw &str access from Decoder
Mark Rousskov [Tue, 22 Feb 2022 23:05:51 +0000 (18:05 -0500)]
Provide raw &str access from Decoder

2 years agoAuto merge of #83706 - a1phyr:fix_vec_layout_calculation, r=JohnTitor
bors [Tue, 22 Feb 2022 20:50:38 +0000 (20:50 +0000)]
Auto merge of #83706 - a1phyr:fix_vec_layout_calculation, r=JohnTitor

Fix a layout possible miscalculation in `alloc::RawVec`

A layout miscalculation could happen in `RawVec` when used with a type whose size isn't a multiple of its alignment. I don't know if such type can exist in Rust, but the Layout API provides ways to manipulate such types. Anyway, it is better to calculate memory size in a consistent way.

2 years agoRustup to rustc 1.61.0-nightly (03a8cc7df 2022-02-21)
bjorn3 [Tue, 22 Feb 2022 19:37:22 +0000 (20:37 +0100)]
Rustup to rustc 1.61.0-nightly (03a8cc7df 2022-02-21)

2 years agoSync from rust 03a8cc7df1d65554a4d40825b0490c93ac0f0236
bjorn3 [Tue, 22 Feb 2022 18:55:24 +0000 (19:55 +0100)]
Sync from rust 03a8cc7df1d65554a4d40825b0490c93ac0f0236

2 years agoFix typo.
NyantasticUwU [Tue, 22 Feb 2022 17:44:45 +0000 (11:44 -0600)]
Fix typo.

Yeah just a typo (probably some breaking changes in here be careful) :)

2 years agoTypo fix: Close inline-code backtick
Antti Korpi [Tue, 22 Feb 2022 17:26:41 +0000 (18:26 +0100)]
Typo fix: Close inline-code backtick

2 years agoAdd test for infinite redirection
Guillaume Gomez [Tue, 22 Feb 2022 14:21:15 +0000 (15:21 +0100)]
Add test for infinite redirection

2 years agoPrevent generation of infinite redirections
Guillaume Gomez [Tue, 22 Feb 2022 14:20:57 +0000 (15:20 +0100)]
Prevent generation of infinite redirections

2 years agoAuto merge of #94254 - matthiaskrgr:rollup-7llbjhd, r=matthiaskrgr
bors [Tue, 22 Feb 2022 14:41:26 +0000 (14:41 +0000)]
Auto merge of #94254 - matthiaskrgr:rollup-7llbjhd, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #94169 (Fix several asm! related issues)
 - #94178 (tidy: fire less "ignoring file length unneccessarily" warnings)
 - #94179 (solarish current_exe using libc call directly)
 - #94196 (compiletest: Print process output info with less whitespace)
 - #94208 (Add the let else tests found missing in the stabilization report)
 - #94237 (Do not suggest wrapping an item if it has ambiguous un-imported methods)
 - #94246 (ScalarMaybeUninit is explicitly hexadecimal in its formatting)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoBump download-ci-llvm-stamp for llvm-nm inclusion
Krasimir Georgiev [Tue, 22 Feb 2022 13:47:44 +0000 (14:47 +0100)]
Bump download-ci-llvm-stamp for llvm-nm inclusion

We started using it in https://github.com/rust-lang/rust/pull/94023.

2 years agolocal_id is always != 0 at this point
Santiago Pastorino [Tue, 22 Feb 2022 12:37:47 +0000 (09:37 -0300)]
local_id is always != 0 at this point

2 years agoRollup merge of #94246 - RalfJung:hex, r=oli-obk
Matthias Krüger [Tue, 22 Feb 2022 11:16:34 +0000 (12:16 +0100)]
Rollup merge of #94246 - RalfJung:hex, r=oli-obk

ScalarMaybeUninit is explicitly hexadecimal in its formatting

This makes `ScalarMaybeUninit` consistent with `Scalar` after the changes in https://github.com/rust-lang/rust/pull/94189.

r? ``@oli-obk``

2 years agoRollup merge of #94237 - compiler-errors:dont-wrap-ambiguous-receivers, r=lcnr
Matthias Krüger [Tue, 22 Feb 2022 11:16:33 +0000 (12:16 +0100)]
Rollup merge of #94237 - compiler-errors:dont-wrap-ambiguous-receivers, r=lcnr

Do not suggest wrapping an item if it has ambiguous un-imported methods

If the method is defined for the receiver we have, but is ambiguous during probe, then it probably comes from one of several traits that just weren't `use`d. Don't suggest wrapping the receiver in `Box`/etc., even if that makes the method probe unambiguous.

Fixes #94218

2 years agoRollup merge of #94208 - est31:let_else, r=Mark-Simulacrum
Matthias Krüger [Tue, 22 Feb 2022 11:16:32 +0000 (12:16 +0100)]
Rollup merge of #94208 - est31:let_else, r=Mark-Simulacrum

Add the let else tests found missing in the stabilization report

In the stabilization report of `let else`, in #93628, I found various cases which weren't tested. This PR adds them.

2 years agoRollup merge of #94196 - aDotInTheVoid:terse-procres-info, r=Mark-Simulacrum
Matthias Krüger [Tue, 22 Feb 2022 11:16:31 +0000 (12:16 +0100)]
Rollup merge of #94196 - aDotInTheVoid:terse-procres-info, r=Mark-Simulacrum

compiletest: Print process output info with less whitespace

Before:

```
error: jsondocck failed!
status: exit status: 1
command: "/data/ne321/rust/build/x86_64-unknown-linux-gnu/stage0-tools-bin/jsondocck" "--doc-dir" "/data/ne321/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-json/traits/supertrait" "--template" "/data/ne321/rust/src/test/rustdoc-json/traits/supertrait.rs"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
Invalid command: Tried to use the previous path in the first command on line 10
Error: "Jsondocck failed for /data/ne321/rust/src/test/rustdoc-json/traits/supertrait.rs"

------------------------------------------

Rustdoc Output:
status: exit status: 0
command: "/data/ne321/rust/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "-L" "/data/ne321/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/data/ne321/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-json/traits/supertrait/auxiliary" "-o" "/data/ne321/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-json/traits/supertrait" "--deny" "warnings" "/data/ne321/rust/src/test/rustdoc-json/traits/supertrait.rs" "--output-format" "json" "-Zunstable-options"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------

------------------------------------------

```

After:

```

error: jsondocck failed!
status: exit status: 1
command: "/data/ne321/rust/build/x86_64-unknown-linux-gnu/stage0-tools-bin/jsondocck" "--doc-dir" "/data/ne321/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-json/traits/supertrait" "--template" "/data/ne321/rust/src/test/rustdoc-json/traits/supertrait.rs"
stdout: none
--- stderr -------------------------------
Invalid command: Tried to use the previous path in the first command on line 10
Error: "Jsondocck failed for /data/ne321/rust/src/test/rustdoc-json/traits/supertrait.rs"
------------------------------------------

Rustdoc Output:
status: exit status: 0
command: "/data/ne321/rust/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "-L" "/data/ne321/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/data/ne321/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-json/traits/supertrait/auxiliary" "-o" "/data/ne321/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-json/traits/supertrait" "--deny" "warnings" "/data/ne321/rust/src/test/rustdoc-json/traits/supertrait.rs" "--output-format" "json" "-Zunstable-options"
stdout: none
stderr: none

```

2 years agoRollup merge of #94179 - devnexen:getexecname_directcall, r=kennytm
Matthias Krüger [Tue, 22 Feb 2022 11:16:30 +0000 (12:16 +0100)]
Rollup merge of #94179 - devnexen:getexecname_directcall, r=kennytm

solarish current_exe using libc call directly

2 years agoRollup merge of #94178 - est31:tolerant_lines_check, r=Mark-Simulacrum
Matthias Krüger [Tue, 22 Feb 2022 11:16:29 +0000 (12:16 +0100)]
Rollup merge of #94178 - est31:tolerant_lines_check, r=Mark-Simulacrum

tidy: fire less "ignoring file length unneccessarily" warnings

This avoids a situation where a file is at the border of the limit,
and alternates between hitting the limit and not hitting it, causing
a back and forth of addition of the ignore-tidy-linelength directive.

As an example, consider the ignore-tidy-filelength of compiler/rustc_typeck/src/collect.rs.

It was added in 2ca4964db5d263a8f9222846bd70a7f26cf414cf, removed in
37354ebc9794b0eb14b08c02177e3094c8fe91cd (a revert of the earlier commit), added again in 448d07683a6defd567996114793a09c9a8aef5df,
removed in 3171bd5bf54fb91f7f7df7c40df5adc7d8bd5dea, added in 438826fd1a9a119d00992ede948cdd479431ecbb,
and removed in bb0a2f985cb6e980cc026ea952733d53bb868f87.

To avoid this back and forth, we exempt files from the unneccessary
ignoring warning that have length of at least 70% of the limit.

2 years agoRollup merge of #94169 - Amanieu:asm_stuff, r=nagisa
Matthias Krüger [Tue, 22 Feb 2022 11:16:28 +0000 (12:16 +0100)]
Rollup merge of #94169 - Amanieu:asm_stuff, r=nagisa

Fix several asm! related issues

This is a combination of several fixes, each split into a separate commit. Splitting these into PRs is not practical since they conflict with each other.

Fixes #92378
Fixes #85247

r? ``@nagisa``

2 years agoRollup merge of #94169 - Amanieu:asm_stuff, r=nagisa
Matthias Krüger [Tue, 22 Feb 2022 11:16:28 +0000 (12:16 +0100)]
Rollup merge of #94169 - Amanieu:asm_stuff, r=nagisa

Fix several asm! related issues

This is a combination of several fixes, each split into a separate commit. Splitting these into PRs is not practical since they conflict with each other.

Fixes #92378
Fixes #85247

r? ``@nagisa``

2 years agoAuto merge of #94209 - lcnr:print-mir-consts, r=oli-obk
bors [Tue, 22 Feb 2022 11:10:26 +0000 (11:10 +0000)]
Auto merge of #94209 - lcnr:print-mir-consts, r=oli-obk

change `mir::Constant` in mir dumps

this removes duplicate information and avoids printing the `stable_crate_id` in mir dumps which broke CI in #94059

r? `@oli-obk` cc `@b-naber`

2 years agoUse 2021 edition in ./x.py fmt
bjorn3 [Tue, 22 Feb 2022 10:36:39 +0000 (11:36 +0100)]
Use 2021 edition in ./x.py fmt

2 years agochange `mir::Constant` in mir dumps
lcnr [Mon, 21 Feb 2022 07:10:07 +0000 (08:10 +0100)]
change `mir::Constant` in mir dumps

2 years agoAuto merge of #93839 - Mark-Simulacrum:delete-json-rust-deserialization, r=nnethercote
bors [Tue, 22 Feb 2022 07:54:22 +0000 (07:54 +0000)]
Auto merge of #93839 - Mark-Simulacrum:delete-json-rust-deserialization, r=nnethercote

Simplify rustc_serialize by dropping support for decoding into JSON

This PR currently bundles two (somewhat separate) tasks.

First, it removes the JSON Decoder trait impl, which permitted going from JSON to Rust structs. For now, we keep supporting JSON deserialization, but only to `Json` (an equivalent of serde_json::Value). The primary hard to remove user there is for custom targets -- which need some form of JSON deserialization -- but they already have a custom ad-hoc pass for moving from Json to a Rust struct.

A [comment](https://github.com/rust-lang/rust/blob/e7aca895980f25f6d2d3c48e10fd04656764d1e4/compiler/rustc_target/src/spec/mod.rs#L1653) there suggests that it would be impractical to move them to a Decodable-based impl, at least without backwards compatibility concerns. I suspect that if we were widely breaking compat there, it would make sense to use serde_json at this point which would produce better error messages; the types in rustc_target are relatively isolated so we would not particularly suffer from using serde_derive.

The second part of the PR (all but the first commit) is to simplify the Decoder API by removing the non-primitive `read_*` functions. These primarily add indirection (through a closure), which doesn't directly cause a performance issue (the unique closure types essentially guarantee monomorphization), but does increase the amount of work rustc and LLVM need to do. This could be split out to a separate PR, but is included here in part to help motivate the first part.

Future work might consist of:

* Specializing enum discriminant encoding to avoid leb128 for small enums (since we know the variant count, we can directly use read/write u8 in almost all cases)
* Adding new methods to support faster deserialization (e.g., access to the underlying byte stream)
   * Currently these are somewhat ad-hoc supported by specializations for e.g. `Vec<u8>`, but other types which could benefit don't today.
* Removing the Decoder trait entirely in favor of a concrete type -- today, we only really have one impl of it modulo wrappers used for specialization-based dispatch.

Highly recommend review with whitespace changes off, as the removal of closures frequently causes things to be de-indented.

2 years agoReapply cg_llvm: `fewer_names` in `uncached_llvm_type`
David Wood [Thu, 17 Feb 2022 18:36:44 +0000 (19:36 +0100)]
Reapply cg_llvm: `fewer_names` in `uncached_llvm_type`

Co-authored-by: Erik Desjardins <erikdesjardins@users.noreply.github.com>
Co-authored-by: Tomasz Miąsko <tomasz.miasko@gmail.com>
2 years agoScalarMaybeUninit is explicitly hexadecimal in its formatting
Ralf Jung [Tue, 22 Feb 2022 02:46:51 +0000 (21:46 -0500)]
ScalarMaybeUninit is explicitly hexadecimal in its formatting

2 years agoSuggest calling .display() on PathBuf too
Michael Goulet [Tue, 22 Feb 2022 00:58:12 +0000 (16:58 -0800)]
Suggest calling .display() on PathBuf too

2 years agoDo not suggest wrapping an item if it has ambiguous un-imported methods
Michael Goulet [Tue, 22 Feb 2022 00:25:59 +0000 (16:25 -0800)]
Do not suggest wrapping an item if it has ambiguous un-imported methods

2 years agoAuto merge of #94225 - matthiaskrgr:rollup-0728x8n, r=matthiaskrgr
bors [Mon, 21 Feb 2022 22:53:45 +0000 (22:53 +0000)]
Auto merge of #94225 - matthiaskrgr:rollup-0728x8n, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #91192 (Some improvements to the async docs)
 - #94143 (rustc_const_eval: adopt let else in more places)
 - #94156 (Gracefully handle non-UTF-8 string slices when pretty printing)
 - #94186 (Update pin_static_ref stabilization version.)
 - #94189 (Implement LowerHex on Scalar to clean up their display in rustdoc)
 - #94190 (Use Metadata::modified instead of FileTime::from_last_modification_ti…)
 - #94203 (CTFE engine: Scalar: expose size-generic to_(u)int methods)
 - #94211 (Better error if the user tries to do assignment ... else)
 - #94215 (trait system: comments and small nonfunctional changes)
 - #94220 (Correctly handle miniz_oxide extern crate declaration)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoAdd ignore-tidy-filelength
Amanieu d'Antras [Mon, 21 Feb 2022 19:18:00 +0000 (19:18 +0000)]
Add ignore-tidy-filelength

2 years agoRollup merge of #94220 - GuillaumeGomez:miniz-oxide-decl, r=Amanieu
Matthias Krüger [Mon, 21 Feb 2022 18:36:55 +0000 (19:36 +0100)]
Rollup merge of #94220 - GuillaumeGomez:miniz-oxide-decl, r=Amanieu

Correctly handle miniz_oxide extern crate declaration

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

Follow-up of https://github.com/rust-lang/rust/pull/94122.

The `miniz_oxide` dependency is optional and therefore should allow be "imported" when it makes sense.

r? `@ivmarkov`

2 years agoRollup merge of #94215 - lcnr:leak-check, r=jackh726
Matthias Krüger [Mon, 21 Feb 2022 18:36:54 +0000 (19:36 +0100)]
Rollup merge of #94215 - lcnr:leak-check, r=jackh726

trait system: comments and small nonfunctional changes

r? `@nikomatsakis` because of the leak-check check removal

2 years agoRollup merge of #94211 - est31:let_else_destructuring_error, r=matthewjasper
Matthias Krüger [Mon, 21 Feb 2022 18:36:53 +0000 (19:36 +0100)]
Rollup merge of #94211 - est31:let_else_destructuring_error, r=matthewjasper

Better error if the user tries to do assignment ... else

If the user tries to do assignment ... else, we now issue a more comprehensible error in the parser.

closes #93995

2 years agoRollup merge of #94203 - RalfJung:to_sized_int, r=oli-obk
Matthias Krüger [Mon, 21 Feb 2022 18:36:52 +0000 (19:36 +0100)]
Rollup merge of #94203 - RalfJung:to_sized_int, r=oli-obk

CTFE engine: Scalar: expose size-generic to_(u)int methods

This matches the size-generic constructors `Scalar::from_(u)int`, and it would have helped in https://github.com/rust-lang/miri/pull/1978.

r? `@oli-obk`

2 years agoRollup merge of #94190 - bjorn3:less_filetime, r=Mark-Simulacrum
Matthias Krüger [Mon, 21 Feb 2022 18:36:51 +0000 (19:36 +0100)]
Rollup merge of #94190 - bjorn3:less_filetime, r=Mark-Simulacrum

Use Metadata::modified instead of FileTime::from_last_modification_ti…

…me in run_cargo

Metadata::modified works in all platforms supported by the filetime
crate. This changes brings rustbuild a tiny bit closer towards dropping
the filetime dependency.

2 years agoRollup merge of #94189 - GuillaumeGomez:scalar-lower-hex, r=RalfJung
Matthias Krüger [Mon, 21 Feb 2022 18:36:50 +0000 (19:36 +0100)]
Rollup merge of #94189 - GuillaumeGomez:scalar-lower-hex, r=RalfJung

Implement LowerHex on Scalar to clean up their display in rustdoc

Follow-up of https://github.com/rust-lang/rust/pull/94091.

r? ````@RalfJung````

2 years agoRollup merge of #94186 - ehuss:pin-stable-1.61, r=m-ou-se
Matthias Krüger [Mon, 21 Feb 2022 18:36:49 +0000 (19:36 +0100)]
Rollup merge of #94186 - ehuss:pin-stable-1.61, r=m-ou-se

Update pin_static_ref stabilization version.

#93580 slipped into 1.61

cc `@m-ou-se`

2 years agoRollup merge of #94156 - tmiasko:pp-str, r=petrochenkov
Matthias Krüger [Mon, 21 Feb 2022 18:36:48 +0000 (19:36 +0100)]
Rollup merge of #94156 - tmiasko:pp-str, r=petrochenkov

Gracefully handle non-UTF-8 string slices when pretty printing

Fixes #78520.

2 years agoRollup merge of #94143 - est31:let_else_const_eval, r=lcnr
Matthias Krüger [Mon, 21 Feb 2022 18:36:48 +0000 (19:36 +0100)]
Rollup merge of #94143 - est31:let_else_const_eval, r=lcnr

rustc_const_eval: adopt let else in more places

Continuation of #89933, #91018, #91481, #93046, #93590, #94011.

I have extended my clippy lint to also recognize tuple passing and match statements. The diff caused by fixing it is way above 1 thousand lines. Thus, I split it up into multiple pull requests to make reviewing easier. This PR handles rustc_const_eval.

2 years agoRollup merge of #91192 - r00ster91:futuredocs, r=GuillaumeGomez
Matthias Krüger [Mon, 21 Feb 2022 18:36:46 +0000 (19:36 +0100)]
Rollup merge of #91192 - r00ster91:futuredocs, r=GuillaumeGomez

Some improvements to the async docs

The goal here is to make the docs overall a little bit more comprehensive and add more links between the things.

One thing that's not working yet is the links to the keywords. Somehow I couldn't get them to work.

r? ````@GuillaumeGomez```` do you know how I could get the keyword links to work?

2 years agoTake CodegenFnAttrs into account when validating asm! register operands
Amanieu d'Antras [Thu, 17 Feb 2022 18:16:04 +0000 (18:16 +0000)]
Take CodegenFnAttrs into account when validating asm! register operands

Checking of asm! register operands now properly takes function
attributes such as #[target_feature] and #[instruction_set] into
account.

2 years agoAdd tests
Amanieu d'Antras [Sat, 19 Feb 2022 21:46:49 +0000 (21:46 +0000)]
Add tests

2 years agoOn ARM, use relocation_model to detect whether r9 should be reserved
Amanieu d'Antras [Thu, 17 Feb 2022 14:16:52 +0000 (14:16 +0000)]
On ARM, use relocation_model to detect whether r9 should be reserved

The previous approach of checking for the reserve-r9 target feature
didn't actually work because LLVM only sets this feature very late when
initializing the per-function subtarget.

2 years agoTake CodegenFnAttrs into account when validating asm! register operands
Amanieu d'Antras [Thu, 17 Feb 2022 18:16:04 +0000 (18:16 +0000)]
Take CodegenFnAttrs into account when validating asm! register operands

Checking of asm! register operands now properly takes function
attributes such as #[target_feature] and #[instruction_set] into
account.

2 years agoOn ARM, use relocation_model to detect whether r9 should be reserved
Amanieu d'Antras [Thu, 17 Feb 2022 14:16:52 +0000 (14:16 +0000)]
On ARM, use relocation_model to detect whether r9 should be reserved

The previous approach of checking for the reserve-r9 target feature
didn't actually work because LLVM only sets this feature very late when
initializing the per-function subtarget.

2 years agoSimplify gating of BPF w registers behind the alu32 target feature
Amanieu d'Antras [Thu, 17 Feb 2022 12:46:47 +0000 (12:46 +0000)]
Simplify gating of BPF w registers behind the alu32 target feature

This is already handled by supported_types().

2 years agoCorrectly handle miniz_oxide extern crate declaration
Guillaume Gomez [Mon, 21 Feb 2022 16:27:55 +0000 (17:27 +0100)]
Correctly handle miniz_oxide extern crate declaration