Commit Graph

163691 Commits

Author SHA1 Message Date
bors
4b043faba3 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.
2022-02-24 17:18:07 +00:00
Michael Goulet
ee98dc8b3b restore spans for issue-50480 2022-02-24 08:40:59 -08:00
Michael Goulet
8ba74369c2 better ObligationCause for normalization errors in can_type_implement_copy 2022-02-24 08:30:38 -08:00
Mark Rousskov
34319ff4e1 Avoid emitting full macro body into JSON 2022-02-24 11:16:45 -05:00
Jakob Degen
57c4163294 Remove an unnecessary restriction in dest_prop 2022-02-24 09:47:13 -05:00
lcnr
ae45e8a638 don't special case DefKind::Ctor in encoding 2022-02-24 14:46:11 +01:00
Petr Sumbera
992c27c601 Add test for nested structures. 2022-02-24 13:46:34 +01:00
bors
3d127e2040 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.
2022-02-24 12:28:19 +00:00
bjorn3
96cf7999ab Introduce Bx::switch_to_block 2022-02-24 12:18:21 +01:00
bors
7ccfe2ff1d Auto merge of #94129 - cjgillot:rmeta-table, r=petrochenkov
Back more metadata using per-query tables

r? `@ghost`
2022-02-24 10:02:26 +00:00
lcnr
70018c19cb update auto trait lint 2022-02-24 08:36:29 +01:00
bors
1204400ab8 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 (⬆️ rust-analyzer)
 - #94300 (Fix a typo in documentation of `array::IntoIter::new_unchecked`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-02-24 06:56:38 +00:00
Matthias Krüger
bdcdd1b122
Rollup merge of #94300 - WaffleLapkin:patch-4, r=scottmcm
Fix a typo in documentation of `array::IntoIter::new_unchecked`

🌸
2022-02-24 07:48:12 +01:00
Matthias Krüger
fe9d909caf
Rollup merge of #94296 - lnicola:rust-analyzer-2022-02-23, r=lnicola
⬆️ rust-analyzer

r? `@ghost`
2022-02-24 07:48:11 +01:00
Matthias Krüger
a93be6def9
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`
2022-02-24 07:48:10 +01:00
Matthias Krüger
ae27c4ab1f
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`
2022-02-24 07:48:09 +01:00
Matthias Krüger
f3433d1b59
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 :)
2022-02-24 07:48:08 +01:00
Matthias Krüger
aa0b7ac0bf
Rollup merge of #94273 - Dylan-DPC:doc/errorkind, r=joshtriplett
add matching doc to errorkind

Rework of #90706
2022-02-24 07:48:07 +01:00
Matthias Krüger
3cd1dc1d6e
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`
2022-02-24 07:48:06 +01:00
Matthias Krüger
8a42e3da0b
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.
2022-02-24 07:48:05 +01:00
Matthias Krüger
77a8e60dd7
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`
2022-02-24 07:48:04 +01:00
Nicholas Nethercote
44308dc348 Inline a hot closure in from_lit_token.
The change looks big because `rustfmt` rearranges things, but the only
real change is the inlining annotation.
2022-02-24 17:07:49 +11:00
Nicholas Nethercote
37d9ea745b Improve scan_escape.
`scan_escape` currently has a fast path (for when the first char isn't
'\\') and a slow path.

This commit changes `scan_escape` so it only handles the slow path, i.e.
the actual escaping code. The fast path is inlined into the two call
sites.

This change makes the code faster, because there is no function call
overhead on the fast path. (`scan_escape` is a big function and doesn't
get inlined.)

This change also improves readability, because it removes a bunch of
mode checks on the the fast paths.
2022-02-24 17:01:01 +11:00
bors
e780264e1e Auto merge of #94107 - tmiasko:fewer-types, r=davidtwco
Reapply cg_llvm: `fewer_names` in `uncached_llvm_type`

r? `@davidtwco` `@erikdesjardins`
2022-02-24 04:07:48 +00:00
bors
8ebec97e09 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`
2022-02-24 01:26:57 +00:00
Dylan DPC
3f4b039e33 word wrpa 2022-02-24 00:37:06 +01:00
Dylan DPC
eb795c24fb word wrpa 2022-02-24 00:30:07 +01:00
Dylan DPC
c46d9f6c89
Update library/std/src/io/error.rs
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2022-02-23 23:18:42 +01:00
Tomasz Miąsko
f047af24b3 Normalize main return type during mono item collection & codegen 2022-02-23 22:33:50 +01:00
Mark Rousskov
4d89292785 Avoid exhausting stack space in dominator compression 2022-02-23 16:07:56 -05:00
Ralf Jung
182d335870 Miri: relax fn ptr check 2022-02-23 15:11:38 -05:00
bors
042892a081 Auto merge of #8466 - tamaroning:fix_reduntant_closure, r=Manishearth
False positive redundant_closure when using ref pattern in closure params

fixes #8460
Fixed [redundant_closure] so that closures of which params bound as `ref` or `ref mut ` doesn't trigger the lint.
(e.g. `|ref x| some_expr` doesn't trigger the lint.)
changelog: none
2022-02-23 18:26:30 +00:00
bors
532d3cda90 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
2022-02-23 18:18:23 +00:00
Waffle Maybe
715262f151
Fix a typo in documentation of array::IntoIter::new_unchecked 2022-02-23 21:10:04 +03:00
bjorn3
512cc355b3 Always check cg_llvm with ./x.py check
Previously it would be skipped if codegen-backends doesn't contain llvm.
2022-02-23 18:53:05 +01:00
Arlo Siemsen
be454f056f 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.
2022-02-23 08:31:10 -08:00
Michael Goulet
c73a2f8a65 properly handle fat pointers to uninhabitable types 2022-02-23 08:20:12 -08:00
tamaron
31b49b0be8 fix typo 2022-02-24 00:25:07 +09:00
lcnr
d9230a3c0f backport from stable and fix link 2022-02-23 16:16:34 +01:00
tamaron
db62821c03 fix 2022-02-24 00:16:24 +09:00
lcnr
adc8a8a30a update rel notes for cg stabilization 2022-02-23 16:11:26 +01:00
Laurențiu Nicola
dbe0007a49 ⬆️ rust-analyzer 2022-02-23 17:11:18 +02:00
Scott Mabin
65614e91ad riscv32imc_esp_espidf: set max_atomic_width to 64 2022-02-23 13:11:26 +00:00
Loïc BRANSTETT
a556a2a8e6 Add compiler flag --check-cfg to the unstable book 2022-02-23 13:22:23 +01:00
Loïc BRANSTETT
8d3de56da1 Continue improvements on the --check-cfg implementation
- Test the combinations of --check-cfg with partial values() and --cfg
- Test that we detect unexpected value when none are expected
2022-02-23 13:22:23 +01:00
Matthias Krüger
8f53bdb45f
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
2022-02-23 12:26:48 +01:00
Matthias Krüger
ecf2faacff
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
2022-02-23 12:26:47 +01:00
Matthias Krüger
81794bed12
Rollup merge of #94271 - RalfJung:downcast, r=oli-obk
Miri: extend comments on downcast operation

r? `@oli-obk`
2022-02-23 12:26:46 +01:00
Matthias Krüger
efe6a979b5
Rollup merge of #94264 - NyantasticUwU:patch-1, r=yaahc
Fix typo.

Yeah just a typo (probably some breaking changes in here be careful) :)
2022-02-23 12:26:45 +01:00
Matthias Krüger
6550671fa5
Rollup merge of #94263 - anko:patch-1, r=GuillaumeGomez
Typo fix: Close inline-code backtick

A drop in the ocean.
2022-02-23 12:26:45 +01:00