]> git.lizzy.rs Git - rust.git/log
rust.git
19 months agoDisable coverage instrumentation for naked functions
Tomasz Miąsko [Fri, 2 Dec 2022 00:00:00 +0000 (00:00 +0000)]
Disable coverage instrumentation for naked functions

19 months agoAuto merge of #104999 - saethlin:immediate-abort-inlining, r=thomcc
bors [Fri, 2 Dec 2022 20:07:23 +0000 (20:07 +0000)]
Auto merge of #104999 - saethlin:immediate-abort-inlining, r=thomcc

Adjust inlining attributes around panic_immediate_abort

The goal of `panic_immediate_abort` is to permit the panic runtime and formatting code paths to be optimized away. But while poking through some disassembly of a small program compiled with that option, I found that was not the case. Enabling LTO did address that specific issue, but enabling LTO is a steep price to pay for this feature doing its job.

This PR fixes that, by tweaking two things:
* All the slice indexing functions that we `const_eval_select` on get `#[inline]`. `objdump -dC` told me that originally some `_ct` functions could end up in an executable. I won't pretend to understand what's going on there.
* Normalize attributes across all `panic!` wrappers: use `inline(never) + cold` normally, and `inline` when `panic_immediate_abort` is enabled.

But also, with LTO and `panic_immediate_abort` enabled, this patch knocks ~709 kB out of the `.text` segment of `librustc_driver.so`. That is slightly surprising to me, my best theory is that this shifts some inlining earlier in compilation, enabling some subsequent optimizations. The size improvement of `librustc_driver.so` with `panic_immediate_abort` due to this patch is greater with LTO than without LTO, which I suppose backs up this theory.

I do not know how to test this. I would quite like to, because I think what this is solving was an accidental regression. This only works with `-Zbuild-std` which is a cargo flag, and thus can't be used in a rustc codegen test.

r? `@thomcc`

---

I do not seriously think anyone is going to use a compiler built with `panic_immediate_abort`, but I wanted a big complicated Rust program to try this out on, and the compiler is such.

19 months agoAuto merge of #104863 - nnethercote:reduce-lint-macros, r=cjgillot
bors [Fri, 2 Dec 2022 15:31:15 +0000 (15:31 +0000)]
Auto merge of #104863 - nnethercote:reduce-lint-macros, r=cjgillot

Reduce macro usage for lints

r? `@cjgillot`

19 months agoAuto merge of #105166 - matthiaskrgr:rollup-s9l6vt2, r=matthiaskrgr
bors [Fri, 2 Dec 2022 12:03:59 +0000 (12:03 +0000)]
Auto merge of #105166 - matthiaskrgr:rollup-s9l6vt2, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #104614 (Add `type_ascribe!` macro as placeholder syntax for type ascription)
 - #105126 (Make `VecDeque::new_in` unstably const)
 - #105132 (Migrate summary toggle filter to CSS variable)
 - #105136 (clarify comment on Deref promotion)
 - #105137 (Add tracking issue number for `file_create_new` feature)
 - #105143 (rustdoc: use simpler CSS for setting the font on scraped examples)

Failed merges:

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

19 months agoRollup merge of #105143 - notriddle:notriddle/scraped-example-list-font, r=GuillaumeGomez
Matthias Krüger [Fri, 2 Dec 2022 07:28:12 +0000 (08:28 +0100)]
Rollup merge of #105143 - notriddle:notriddle/scraped-example-list-font, r=GuillaumeGomez

rustdoc: use simpler CSS for setting the font on scraped examples

19 months agoRollup merge of #105137 - yjhn:patch-1, r=Dylan-DPC
Matthias Krüger [Fri, 2 Dec 2022 07:28:11 +0000 (08:28 +0100)]
Rollup merge of #105137 - yjhn:patch-1, r=Dylan-DPC

Add tracking issue number for `file_create_new` feature

It was missing a tracking issue, so I opened one (#105135).

19 months agoRollup merge of #105136 - RalfJung:deref-promotion-comment, r=oli-obk
Matthias Krüger [Fri, 2 Dec 2022 07:28:10 +0000 (08:28 +0100)]
Rollup merge of #105136 - RalfJung:deref-promotion-comment, r=oli-obk

clarify comment on Deref promotion

r? `@oli-obk`

19 months agoRollup merge of #105132 - GuillaumeGomez:migrate-summary-toggle-to-var, r=notriddle
Matthias Krüger [Fri, 2 Dec 2022 07:28:09 +0000 (08:28 +0100)]
Rollup merge of #105132 - GuillaumeGomez:migrate-summary-toggle-to-var, r=notriddle

Migrate summary toggle filter to CSS variable

r? `@notriddle`

19 months agoRollup merge of #105126 - Sp00ph:const_new_in, r=dtolnay
Matthias Krüger [Fri, 2 Dec 2022 07:28:09 +0000 (08:28 +0100)]
Rollup merge of #105126 - Sp00ph:const_new_in, r=dtolnay

Make `VecDeque::new_in` unstably const

(See #105072)

19 months agoRollup merge of #104614 - Nilstrieb:type-ascribe!, r=TaKO8Ki
Matthias Krüger [Fri, 2 Dec 2022 07:28:08 +0000 (08:28 +0100)]
Rollup merge of #104614 - Nilstrieb:type-ascribe!, r=TaKO8Ki

Add `type_ascribe!` macro as placeholder syntax for type ascription

This makes it still possible to test the internal semantics of type ascription even once the `:`-syntax is removed from the parser. The macro now gets used in a bunch of UI tests that test the semantics and not syntax of type ascription.

I might have forgotten a few tests but this should hopefully be most of them. The remaining ones will certainly be found once type ascription is removed from the parser altogether.

Part of #101728

19 months agoAuto merge of #104963 - petrochenkov:noaddids2, r=cjgillot
bors [Fri, 2 Dec 2022 04:24:57 +0000 (04:24 +0000)]
Auto merge of #104963 - petrochenkov:noaddids2, r=cjgillot

rustc_ast_lowering: Stop lowering imports into multiple items

Lower them into a single item with multiple resolutions instead.
This also allows to remove additional `NodId`s and `DefId`s related to those additional items.

19 months agoInline and remove `early_lint_node`.
Nicholas Nethercote [Thu, 1 Dec 2022 02:31:48 +0000 (13:31 +1100)]
Inline and remove `early_lint_node`.

It has a single call site.

19 months agoMerge `builtins` into `EarlyLintPassObjects`.
Nicholas Nethercote [Thu, 1 Dec 2022 02:22:08 +0000 (13:22 +1100)]
Merge `builtins` into `EarlyLintPassObjects`.

This avoids calling `early_lint_node` twice.

Note: one `early_lint_node` call had `!pre_expansion` for the second
argument and the other had `false`. The new single call just has
`!pre_expansion`. This results in a reduction of duplicate error
messages in some `ui-fulldeps` tests. The order of some `ui-fulldeps`
output also changes, but that doesn't matter.

19 months agoRemove some unnecessary `Send` bounds.
Nicholas Nethercote [Thu, 1 Dec 2022 04:42:31 +0000 (15:42 +1100)]
Remove some unnecessary `Send` bounds.

Required to get the parallel compiler building again.

19 months agoInline and remove `late_lint_pass_crate`.
Nicholas Nethercote [Thu, 1 Dec 2022 01:23:16 +0000 (12:23 +1100)]
Inline and remove `late_lint_pass_crate`.

It has a single call site.

19 months agoInline and remove `late_lint_mod_pass`.
Nicholas Nethercote [Thu, 1 Dec 2022 01:18:02 +0000 (12:18 +1100)]
Inline and remove `late_lint_mod_pass`.

It has a single call site.

19 months agoMerge `builtins` into `LateLintPassObjects`.
Nicholas Nethercote [Thu, 1 Dec 2022 01:10:23 +0000 (12:10 +1100)]
Merge `builtins` into `LateLintPassObjects`.

This avoids calling the `late_lint_{mod_pass,pass_crate}` twice.

19 months agoRemove six macros relating to lint definitions.
Nicholas Nethercote [Fri, 25 Nov 2022 04:01:29 +0000 (15:01 +1100)]
Remove six macros relating to lint definitions.

These were enabled by the removal of `-Zno-interleave-lints`.

19 months agoRemove `-Zno-interleave-lints`.
Nicholas Nethercote [Fri, 25 Nov 2022 03:42:43 +0000 (14:42 +1100)]
Remove `-Zno-interleave-lints`.

Because it complicates lint implementation greatly.

19 months agoEliminate four unnecessary lint macros.
Nicholas Nethercote [Fri, 25 Nov 2022 02:42:01 +0000 (13:42 +1100)]
Eliminate four unnecessary lint macros.

The lint definitions use macros heavily. This commit merges some of them
that are split unnecessarily. I find the reduced indirection makes it
easier to imagine what the generated code will look like.

19 months agoAuto merge of #105140 - flip1995:clippyup, r=Manishearth
bors [Thu, 1 Dec 2022 20:57:23 +0000 (20:57 +0000)]
Auto merge of #105140 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

19 months agorustdoc: use simpler CSS for setting the font on scraped examples
Michael Howell [Thu, 1 Dec 2022 18:31:44 +0000 (11:31 -0700)]
rustdoc: use simpler CSS for setting the font on scraped examples

19 months agoAuto merge of #105125 - matthiaskrgr:rollup-fr0snmj, r=matthiaskrgr
bors [Thu, 1 Dec 2022 17:47:12 +0000 (17:47 +0000)]
Auto merge of #105125 - matthiaskrgr:rollup-fr0snmj, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #105078 (Fix `expr_to_spanned_string` ICE)
 - #105087 (Extract llvm datalayout parsing out of spec module)
 - #105088 (rustdoc: remove redundant CSS `div.desc { display: block }`)
 - #105106 (Fix ICE from #105101)

Failed merges:

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

19 months agoMerge commit 'd822110d3b5625b9dc80ccc442e06fc3cc851d76' into clippyup
Philipp Krones [Thu, 1 Dec 2022 17:29:38 +0000 (18:29 +0100)]
Merge commit 'd822110d3b5625b9dc80ccc442e06fc3cc851d76' into clippyup

19 months agorustc_ast_lowering: Stop lowering imports into multiple items
Vadim Petrochenkov [Thu, 1 Dec 2022 15:51:20 +0000 (18:51 +0300)]
rustc_ast_lowering: Stop lowering imports into multiple items

Lower them into a single item with multiple resolutions instead.
This also allows to remove additional `NodId`s and `DefId`s related to those additional items.

19 months agorustc_hir: Change representation of import paths to support multiple resolutions
Vadim Petrochenkov [Fri, 25 Nov 2022 14:39:38 +0000 (17:39 +0300)]
rustc_hir: Change representation of import paths to support multiple resolutions

19 months agoclarify comment on Deref promotion
Ralf Jung [Thu, 1 Dec 2022 15:41:49 +0000 (16:41 +0100)]
clarify comment on Deref promotion

19 months agoAdd tracking issue for file_create_new
Andrius Pukšta [Thu, 1 Dec 2022 15:42:31 +0000 (17:42 +0200)]
Add tracking issue for file_create_new

19 months agoAdd GUI test for toggle filter and opacity
Guillaume Gomez [Thu, 1 Dec 2022 14:58:16 +0000 (15:58 +0100)]
Add GUI test for toggle filter and opacity

19 months agoMigrate summary toggle filter to CSS variable
Guillaume Gomez [Thu, 1 Dec 2022 14:55:09 +0000 (15:55 +0100)]
Migrate summary toggle filter to CSS variable

19 months agoAuto merge of #105003 - flba-eb:only_windows, r=Mark-Simulacrum
bors [Thu, 1 Dec 2022 14:27:34 +0000 (14:27 +0000)]
Auto merge of #105003 - flba-eb:only_windows, r=Mark-Simulacrum

Run Windows-only tests only on Windows

This removes the need to maintain an ignore-list of all other OSs.

See https://github.com/rust-lang/rust/pull/102305 for a similar change.

19 months agorustc_hir: Relax lifetime requirements on `Visitor::visit_path`
Vadim Petrochenkov [Fri, 25 Nov 2022 08:26:36 +0000 (11:26 +0300)]
rustc_hir: Relax lifetime requirements on `Visitor::visit_path`

19 months agoIgnore `gnu` systems (`windows-msvc` only)
Florian Bartels [Thu, 1 Dec 2022 13:12:55 +0000 (14:12 +0100)]
Ignore `gnu` systems (`windows-msvc` only)

19 months agoAuto merge of #10010 - flip1995:rustup, r=flip1995
bors [Thu, 1 Dec 2022 13:21:51 +0000 (13:21 +0000)]
Auto merge of #10010 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

19 months agoBump nightly version -> 2022-12-01
Philipp Krones [Thu, 1 Dec 2022 11:55:29 +0000 (12:55 +0100)]
Bump nightly version -> 2022-12-01

19 months agoMerge remote-tracking branch 'upstream/master' into rustup
Philipp Krones [Thu, 1 Dec 2022 11:39:42 +0000 (12:39 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

19 months agoFix typo in comment
Markus Everling [Thu, 1 Dec 2022 11:44:29 +0000 (12:44 +0100)]
Fix typo in comment

19 months agoMake `VecDeque::new_in` unstably const
Markus Everling [Thu, 1 Dec 2022 11:15:29 +0000 (12:15 +0100)]
Make `VecDeque::new_in` unstably const

19 months agoRollup merge of #105106 - jhpratt:issue-105101, r=TaKO8Ki
Matthias Krüger [Thu, 1 Dec 2022 10:59:01 +0000 (11:59 +0100)]
Rollup merge of #105106 - jhpratt:issue-105101, r=TaKO8Ki

Fix ICE from #105101

Fixes #105101

Rather than comparing idents, compare spans, which should be unique to each variant.

19 months agoRollup merge of #105088 - notriddle:notriddle/search-results-div-desc, r=GuillaumeGomez
Matthias Krüger [Thu, 1 Dec 2022 10:59:00 +0000 (11:59 +0100)]
Rollup merge of #105088 - notriddle:notriddle/search-results-div-desc, r=GuillaumeGomez

rustdoc: remove redundant CSS `div.desc { display: block }`

DIV tags have block display by default. It is from when this rule used to target a SPAN tag, but became redundant in 4bd6748bb9b73c210558498070ae0b7ed8193ddf.

19 months agoRollup merge of #105087 - HKalbasi:master, r=eddyb
Matthias Krüger [Thu, 1 Dec 2022 10:59:00 +0000 (11:59 +0100)]
Rollup merge of #105087 - HKalbasi:master, r=eddyb

Extract llvm datalayout parsing out of spec module

fix https://github.com/rust-lang/rust/pull/103693#discussion_r1033250846

19 months agoRollup merge of #105078 - TaKO8Ki:fix-105011, r=nnethercote
Matthias Krüger [Thu, 1 Dec 2022 10:58:59 +0000 (11:58 +0100)]
Rollup merge of #105078 - TaKO8Ki:fix-105011, r=nnethercote

Fix `expr_to_spanned_string` ICE

Fixes #105011

19 months agoAuto merge of #104975 - JakobDegen:custom_mir_let, r=oli-obk
bors [Thu, 1 Dec 2022 10:40:10 +0000 (10:40 +0000)]
Auto merge of #104975 - JakobDegen:custom_mir_let, r=oli-obk

`#![custom_mir]`: Various improvements

This PR makes a bunch of improvements to `#![custom_mir]`. Ideally this would be 4 PRs, one for each commit, but those would take forever to get merged and be a pain to juggle. Should still be reviewed one commit at a time though.

### Commit 1: Support arbitrary `let`

Before this change, all locals used in the body need to be declared at the top of the `mir!` invocation, which is rather annoying. We attempt to change that.

Unfortunately, we still have the requirement that the output of the `mir!` macro must resolve, typecheck, etc. Because of that, we can't just accept this in the THIR -> MIR parser because something like
```rust
{
    let x = 0;
    Goto(other)
}
other = {
    RET = x;
    Return()
}
```
will fail to resolve. Instead, the implementation does macro shenanigans to find the let declarations and extract them as part of the `mir!` macro. That *works*, but it is fairly complicated and degrades debuginfo by quite a bit. Specifically, the spans for any statements and declarations that are affected by this are completely wrong. My guess is that this is a net improvement though.

One way to recover some of the debuginfo would be to not support type annotations in the `let` statements, which would allow us to parse like `let $stmt:stmt`. That seems quite surprising though.

### Commit 2: Parse consts

Reuses most of the const parsing from regular Mir building for building custom mir

### Commit 3: Parse statics

Statics are slightly weird because the Mir primitive associated with them is a reference/pointer to them, so this is factored out separately.

### Commit 4: Fix some spans

A bunch of the spans were non-ideal, so we adjust them to be much more helpful.

r? `@oli-obk`

19 months agoGate macros behind `#[cfg(not(bootstrap))]`
nils [Thu, 1 Dec 2022 10:16:18 +0000 (11:16 +0100)]
Gate macros behind `#[cfg(not(bootstrap))]`

Co-authored-by: Takayuki Maeda <takoyaki0316@gmail.com>
19 months agoAuto merge of #10007 - Jarcho:issue_10005, r=giraffate
bors [Thu, 1 Dec 2022 07:20:06 +0000 (07:20 +0000)]
Auto merge of #10007 - Jarcho:issue_10005, r=giraffate

Fix ICE in `result_large_err` with uninhabited enums

fixes #10005
changelog: `result_large_err`: Fix ICE with uninhabited enums

19 months agoAuto merge of #104861 - nnethercote:attr-cleanups, r=petrochenkov
bors [Thu, 1 Dec 2022 07:13:45 +0000 (07:13 +0000)]
Auto merge of #104861 - nnethercote:attr-cleanups, r=petrochenkov

Attribute cleanups

Best reviewed one commit at a time.

r? `@petrochenkov`

19 months agoAuto merge of #105095 - matthiaskrgr:rollup-9pu7vrx, r=matthiaskrgr
bors [Thu, 1 Dec 2022 04:16:30 +0000 (04:16 +0000)]
Auto merge of #105095 - matthiaskrgr:rollup-9pu7vrx, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #103065 (rustdoc-json: Document and Test that args can be patterns.)
 - #104865 (Don't overwrite local changes when updating submodules)
 - #104895 (Avoid Invalid code suggested when encountering unsatisfied trait bounds in derive macro code)
 - #105063 (Rustdoc Json Tests: Don't assume that core::fmt::Debug will always have one item.)
 - #105064 (rustdoc: add comment to confusing CSS `main { min-width: 0 }`)
 - #105074 (Add Nicholas Bishop to `.mailmap`)
 - #105081 (Add a regression test for #104322)
 - #105086 (rustdoc: clean up sidebar link CSS)
 - #105091 (add Tshepang Mbambo to .mailmap)

Failed merges:

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

19 months agoFix ICE in `result large_err` with uninhabited enums
Jason Newcomb [Thu, 1 Dec 2022 02:44:18 +0000 (21:44 -0500)]
Fix ICE in `result large_err` with uninhabited enums

19 months agoAuto merge of #104160 - Ayush1325:windows-args, r=m-ou-se
bors [Thu, 1 Dec 2022 01:22:32 +0000 (01:22 +0000)]
Auto merge of #104160 - Ayush1325:windows-args, r=m-ou-se

  Extract WStrUnits to sys_common::wstr

This commit extracts WStrUnits from sys::windows::args to sys_common::wstr. This allows using the same structure for other targets which use wtf8 (example UEFI).

This was originally a part of https://github.com/rust-lang/rust/pull/100316

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
19 months agoAuto merge of #9943 - dswij:pr-9940, r=Jarcho
bors [Wed, 30 Nov 2022 21:23:10 +0000 (21:23 +0000)]
Auto merge of #9943 - dswij:pr-9940, r=Jarcho

manual_let_else: keep macro call on suggestion blocks

Closes #9940

changelog: [`manual_let_else`]: Do not expand macro calls on suggestions

19 months agoFix ICE from #105101
Jacob Pratt [Wed, 30 Nov 2022 21:17:00 +0000 (21:17 +0000)]
Fix ICE from #105101

19 months agoAuto merge of #10001 - Jarcho:issue_9866, r=llogiq
bors [Wed, 30 Nov 2022 19:54:25 +0000 (19:54 +0000)]
Auto merge of #10001 - Jarcho:issue_9866, r=llogiq

Fix ICE in `unused_rounding`

fixes #9866
changelog: `unused_rounding`: Fix ICE when using the `_` separator

19 months agoAuto merge of #9996 - Jarcho:issue_9906, r=Alexendoo
bors [Wed, 30 Nov 2022 19:40:22 +0000 (19:40 +0000)]
Auto merge of #9996 - Jarcho:issue_9906, r=Alexendoo

Fix `unnecessary_cast` suggestion when taking a reference

fixes #9906
changelog: `unnecessary_cast`: Fix suggestion when taking a reference

19 months agoAuto merge of #9997 - Jarcho:issue_9901, r=llogiq
bors [Wed, 30 Nov 2022 19:29:40 +0000 (19:29 +0000)]
Auto merge of #9997 - Jarcho:issue_9901, r=llogiq

Don't lint `explicit_auto_deref` when the initial type is neither a reference, nor a receiver

fixes #9901
fixes #9777
changelog: `explicit_auto_deref`: Don't lint when the initial value is neither a reference, nor a receiver

19 months agoRollup merge of #105091 - tshepang:mailmap, r=compiler-errors
Matthias Krüger [Wed, 30 Nov 2022 18:53:21 +0000 (19:53 +0100)]
Rollup merge of #105091 - tshepang:mailmap, r=compiler-errors

add Tshepang Mbambo to .mailmap

... because my surname has changed

```
# before
❯ git shortlog --summary --email | rg Tshepang
   326  Tshepang Lekhonkhobe <tshepang@gmail.com>
     8  Tshepang Mbambo <tshepang@gmail.com>

# after
❯ git shortlog --summary --email | rg Tshepang
   334  Tshepang Mbambo <tshepang@gmail.com>

19 months agoRollup merge of #105086 - notriddle:notriddle/sidebar-css, r=GuillaumeGomez
Matthias Krüger [Wed, 30 Nov 2022 18:53:20 +0000 (19:53 +0100)]
Rollup merge of #105086 - notriddle:notriddle/sidebar-css, r=GuillaumeGomez

rustdoc: clean up sidebar link CSS

Group `text-overflow: ellipses` along with `white-space: nowrap`. It makes no sense to try to apply it to links with `overflow-wrap: anywhere`, because it can't actually make ellipses when that's turned on.

Simplify the selector for the 25rem left padding on sidebar links, to match up with the style for the container left padding that makes room for it.

19 months agoRollup merge of #105081 - weiznich:regression_test_for_104322, r=compiler-errors
Matthias Krüger [Wed, 30 Nov 2022 18:53:20 +0000 (19:53 +0100)]
Rollup merge of #105081 - weiznich:regression_test_for_104322, r=compiler-errors

Add a regression test for #104322

r? ``@compiler-errors``

19 months agoRollup merge of #105074 - nicholasbishop:bishop-mailmap, r=Mark-Simulacrum
Matthias Krüger [Wed, 30 Nov 2022 18:53:19 +0000 (19:53 +0100)]
Rollup merge of #105074 - nicholasbishop:bishop-mailmap, r=Mark-Simulacrum

Add Nicholas Bishop to `.mailmap`

19 months agoRollup merge of #105064 - notriddle:notriddle/main-min-width, r=GuillaumeGomez
Matthias Krüger [Wed, 30 Nov 2022 18:53:19 +0000 (19:53 +0100)]
Rollup merge of #105064 - notriddle:notriddle/main-min-width, r=GuillaumeGomez

rustdoc: add comment to confusing CSS `main { min-width: 0 }`

This CSS was added in cad0fce2053d52b7ba04c458f4c124c8b5c6141e, but the reason why it was necessary was unclear. This comment makes it clear.

19 months agoRollup merge of #105063 - aDotInTheVoid:rdj-dont-assume-core, r=notriddle
Matthias Krüger [Wed, 30 Nov 2022 18:53:18 +0000 (19:53 +0100)]
Rollup merge of #105063 - aDotInTheVoid:rdj-dont-assume-core, r=notriddle

Rustdoc Json Tests: Don't assume that core::fmt::Debug will always have one item.

See https://github.com/rust-lang/rust/pull/104525#issuecomment-1330837047 and https://github.com/rust-lang/rust/pull/104525#issuecomment-1331087852 for motivation.

This still assumes that `fmt` is the first method, but thats alot less brittle than assuming it will be the only method.

Sadly, we can't use a aux crate to insulate the tests from core changes, because core is special, so all we can do is try not to depend on things that may change.

19 months agoRollup merge of #104895 - chenyukang:yukang/fix-104884-serde, r=TaKO8Ki
Matthias Krüger [Wed, 30 Nov 2022 18:53:18 +0000 (19:53 +0100)]
Rollup merge of #104895 - chenyukang:yukang/fix-104884-serde, r=TaKO8Ki

Avoid Invalid code suggested when encountering unsatisfied trait bounds in derive macro code

Fixes #104884

19 months agoRollup merge of #104865 - pratushrai0309:bootstrap, r=jyn514
Matthias Krüger [Wed, 30 Nov 2022 18:53:17 +0000 (19:53 +0100)]
Rollup merge of #104865 - pratushrai0309:bootstrap, r=jyn514

Don't overwrite local changes when updating submodules

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

19 months agoRollup merge of #103065 - aDotInTheVoid:rdj-arg-pattern, r=GuillaumeGomez
Matthias Krüger [Wed, 30 Nov 2022 18:53:17 +0000 (19:53 +0100)]
Rollup merge of #103065 - aDotInTheVoid:rdj-arg-pattern, r=GuillaumeGomez

rustdoc-json: Document and Test that args can be patterns.

19 months agoFix ICE in `unused_rounding`
Jason Newcomb [Wed, 30 Nov 2022 17:31:38 +0000 (12:31 -0500)]
Fix ICE in `unused_rounding`

19 months agoExtract llvm datalayout parsing out of spec module
hkalbasi [Wed, 30 Nov 2022 15:43:09 +0000 (19:13 +0330)]
Extract llvm datalayout parsing out of spec module

19 months agoadd Tshepang Mbambo to .mailmap
Tshepang Mbambo [Wed, 30 Nov 2022 17:29:41 +0000 (19:29 +0200)]
add Tshepang Mbambo to .mailmap

19 months agoAuto merge of #104940 - cjgillot:query-feed-simple, r=oli-obk
bors [Wed, 30 Nov 2022 17:20:14 +0000 (17:20 +0000)]
Auto merge of #104940 - cjgillot:query-feed-simple, r=oli-obk

Allow to feed a value in another query's cache

Restricted version of https://github.com/rust-lang/rust/pull/96840

A query can create new definitions.

If those definitions are created after HIR lowering, they do not appear in the initial HIR map, and information for them cannot be provided in the normal pull-based way.

In order to make those definitions useful, we allow to feed values as query results for the newly created definition.

The API is as follows:
```rust
let feed = tcx.create_def(<parent def id>, <DefPathData>);
// `feed` is a TyCtxtFeed<'tcx>.

// Access the created definition.
let def_id: LocalDefId = feed.def_id;

// Assign `my_query(def_id) := my_value`.
feed.my_query(my_value).
```

This PR keeps the consistency checks introduced by https://github.com/rust-lang/rust/pull/96840, even if they are not reachable. This allows to extend the behaviour later without forgetting them.

cc `@oli-obk` `@spastorino`

19 months agoAuto merge of #9987 - Jarcho:issue_9957, r=flip1995
bors [Wed, 30 Nov 2022 16:31:56 +0000 (16:31 +0000)]
Auto merge of #9987 - Jarcho:issue_9957, r=flip1995

Don't cross contexts while building the suggestion for `redundant_closure_call`

fixes #9957

changelog: `redundant_closure_call`: Don't cross macro contexts while building the suggestion

19 months agoAdd Nicholas Bishop to `.mailmap`
Nicholas Bishop [Tue, 29 Nov 2022 23:01:58 +0000 (18:01 -0500)]
Add Nicholas Bishop to `.mailmap`

19 months agoDon't lint `explicit_auto_deref` when the initial type is neither a reference, nor...
Jason Newcomb [Wed, 30 Nov 2022 16:15:49 +0000 (11:15 -0500)]
Don't lint `explicit_auto_deref` when the initial type is neither a reference, nor a receiver

19 months agorustdoc: remove redundant CSS `div.desc { display: block }`
Michael Howell [Wed, 30 Nov 2022 16:00:02 +0000 (09:00 -0700)]
rustdoc: remove redundant CSS `div.desc { display: block }`

DIV tags have block display by default. It is from when this rule
used to target a SPAN tag, but became redundant in
4bd6748bb9b73c210558498070ae0b7ed8193ddf.

19 months agoFix `unnecessary_cast` suggestion when taking a reference
Jason Newcomb [Wed, 30 Nov 2022 15:48:53 +0000 (10:48 -0500)]
Fix `unnecessary_cast` suggestion when taking a reference

19 months agoDon't cross contexts while building the suggestion for `redundant_closure_call`
Jason Newcomb [Tue, 29 Nov 2022 15:36:43 +0000 (10:36 -0500)]
Don't cross contexts while building the suggestion for `redundant_closure_call`

19 months agorustdoc: clean up sidebar link CSS
Michael Howell [Wed, 30 Nov 2022 14:51:18 +0000 (07:51 -0700)]
rustdoc: clean up sidebar link CSS

Group `text-overflow: ellipses` along with `white-space: nowrap`. It makes
no sense to try to apply it to links with `overflow-wrap: anywhere`, because
it can't actually make ellipses when that's turned on.

Simplify the selector for the 25rem left padding on sidebar links, to match
up with the style for the container left padding that makes room for it.

19 months agoAuto merge of #99814 - aliemjay:patch-2, r=jackh726
bors [Wed, 30 Nov 2022 14:03:36 +0000 (14:03 +0000)]
Auto merge of #99814 - aliemjay:patch-2, r=jackh726

fix universe map in ifcx.instantiate_canonical_*

Previously, `infcx.instantiate_canonical_*` maps the root universe in `canonical` into `ty::UniverseIndex::Root`, I think because it assumes it works with a fresh `infcx` but this is not true for the use cases in mir typeck. Now the root universe is mapped into `infcx.universe()`.

I catched this accidentally while reviewing the code. I'm not sure if this is the right fix or if it is really a bug!

19 months agoAdd a regression test for #104322
Georg Semmler [Wed, 30 Nov 2022 06:46:01 +0000 (07:46 +0100)]
Add a regression test for #104322

19 months agoAuto merge of #9989 - xFrednet:9986-move-safety-thingy, r=flip1995
bors [Wed, 30 Nov 2022 12:44:45 +0000 (12:44 +0000)]
Auto merge of #9989 - xFrednet:9986-move-safety-thingy, r=flip1995

Move `unnecessary_unsafety_doc` to `pedantic`

This lint was added in #9822. I like the idea, but also agree with #9986 as well. I think it should at least not be warn-by-default. This is one of these cases, where I'd like a group between pedantic and restriction. But I believe that users using `#![warn(clippy::pedantic)]` will know how to enable the lint if they disagree with it.

---

Since the lint is new:

changelog: none

r? `@flip1995` since I'd suggest back porting this, the original PR was merged 16 days ago.

Closes: #9986 (While it doesn't address everything, I believe that this is the best compromise)
19 months agoMove `unnecessary_unsafety_doc` to `pedantic`
xFrednet [Tue, 29 Nov 2022 17:22:02 +0000 (18:22 +0100)]
Move `unnecessary_unsafety_doc` to `pedantic`

19 months agoAuto merge of #104905 - compiler-errors:normalization-changes, r=spastorino
bors [Wed, 30 Nov 2022 11:13:09 +0000 (11:13 +0000)]
Auto merge of #104905 - compiler-errors:normalization-changes, r=spastorino

Some initial normalization method changes

1. Rename `AtExt::normalize` to `QueryNormalizeExt::query_normalize` (using the `QueryNormalizer`)
2. Introduce `NormalizeExt::normalize` to replace `partially_normalize_associated_types_in` (using the `AssocTypeNormalizer`)
3. Rename `FnCtxt::normalize_associated_types_in` to `FnCtxt::normalize`
4. Remove some unused other normalization fns in `Inherited` and `FnCtxt`

Also includes one drive-by where we're no longer creating a `FnCtxt` inside of `check_fn`, but passing it in. This means we don't need such weird `FnCtxt` construction logic.

Stacked on top of #104835 for convenience.

r? types

19 months agoAuto merge of #104905 - compiler-errors:normalization-changes, r=spastorino
bors [Wed, 30 Nov 2022 11:13:09 +0000 (11:13 +0000)]
Auto merge of #104905 - compiler-errors:normalization-changes, r=spastorino

Some initial normalization method changes

1. Rename `AtExt::normalize` to `QueryNormalizeExt::query_normalize` (using the `QueryNormalizer`)
2. Introduce `NormalizeExt::normalize` to replace `partially_normalize_associated_types_in` (using the `AssocTypeNormalizer`)
3. Rename `FnCtxt::normalize_associated_types_in` to `FnCtxt::normalize`
4. Remove some unused other normalization fns in `Inherited` and `FnCtxt`

Also includes one drive-by where we're no longer creating a `FnCtxt` inside of `check_fn`, but passing it in. This means we don't need such weird `FnCtxt` construction logic.

Stacked on top of #104835 for convenience.

r? types

19 months agoAuto merge of #105080 - matthiaskrgr:rollup-7ffj4oe, r=matthiaskrgr
bors [Wed, 30 Nov 2022 07:59:24 +0000 (07:59 +0000)]
Auto merge of #105080 - matthiaskrgr:rollup-7ffj4oe, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #104697 (Restore control flow on error in EUV)
 - #104811 (feat: implement TcpStream shutdown for wasm32-wasi)
 - #105039 (Fix an ICE parsing a malformed literal in `concat_bytes!`.)
 - #105071 (Add Nicholas Nethercote to `.mailmap`.)
 - #105079 (Add bots to `.mailmap`)

Failed merges:

 - #105074 (Add Nicholas Bishop to `.mailmap`)

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

19 months agoUse `snippet_with_context` instead of `_with_macro_callsite`
dswij [Wed, 30 Nov 2022 06:50:13 +0000 (14:50 +0800)]
Use `snippet_with_context` instead of `_with_macro_callsite`

19 months agoRollup merge of #105079 - nnethercote:bots-mailmap, r=jyn514
Matthias Krüger [Wed, 30 Nov 2022 06:00:32 +0000 (07:00 +0100)]
Rollup merge of #105079 - nnethercote:bots-mailmap, r=jyn514

Add bots to `.mailmap`

r? `@compiler-errors`

19 months agoRollup merge of #105071 - nnethercote:nnethercote-mailmap, r=compiler-errors
Matthias Krüger [Wed, 30 Nov 2022 06:00:32 +0000 (07:00 +0100)]
Rollup merge of #105071 - nnethercote:nnethercote-mailmap, r=compiler-errors

Add Nicholas Nethercote to `.mailmap`.

Before:
```
$ git shortlog -se | grep Nethercote
   517 Nicholas Nethercote <n.nethercote@gmail.com>
     2 Nicholas Nethercote <nnethercote@apple.com>
   560 Nicholas Nethercote <nnethercote@mozilla.com>
```
After
```
$ git shortlog -se | grep Nethercote
  1079 Nicholas Nethercote <n.nethercote@gmail.com>
```

19 months agoRollup merge of #105039 - nnethercote:fix-104769, r=petrochenkov
Matthias Krüger [Wed, 30 Nov 2022 06:00:31 +0000 (07:00 +0100)]
Rollup merge of #105039 - nnethercote:fix-104769, r=petrochenkov

Fix an ICE parsing a malformed literal in `concat_bytes!`.

Fixes #104769.

r? `@petrochenkov`

19 months agoRollup merge of #104811 - haraldh:feat/wasm32_wasi_shutdown, r=joshtriplett
Matthias Krüger [Wed, 30 Nov 2022 06:00:31 +0000 (07:00 +0100)]
Rollup merge of #104811 - haraldh:feat/wasm32_wasi_shutdown, r=joshtriplett

feat: implement TcpStream shutdown for wasm32-wasi

Signed-off-by: Harald Hoyer <harald@profian.com>
19 months agoRollup merge of #104697 - dingxiangfei2009:fix-euv-control-flow, r=oli-obk
Matthias Krüger [Wed, 30 Nov 2022 06:00:30 +0000 (07:00 +0100)]
Rollup merge of #104697 - dingxiangfei2009:fix-euv-control-flow, r=oli-obk

Restore control flow on error in EUV

cc `@Nilstrieb`

Fix #104649

Since #98574 refactored a piece of scrutinee memory categorization out as a subroutine, there is a subtle change in handling match arms especially when the categorization process faults and bails. In the correct case, it is not supposed to continue to process the arms any more. This PR restores the original control flow in EUV.

I promise to add a compile-fail test to demonstrate that this indeed fixes the issue after coming back from a nap.

19 months agoavoid an unnecessary `&str` to `String` conversion
Takayuki Maeda [Wed, 30 Nov 2022 04:31:35 +0000 (13:31 +0900)]
avoid an unnecessary `&str` to `String` conversion

19 months agoreport literal errors when `token_lit` has errors
Takayuki Maeda [Wed, 30 Nov 2022 04:31:11 +0000 (13:31 +0900)]
report literal errors when `token_lit` has errors

19 months agoAuto merge of #104679 - dvdhrm:rw/dso, r=petrochenkov
bors [Wed, 30 Nov 2022 04:18:15 +0000 (04:18 +0000)]
Auto merge of #104679 - dvdhrm:rw/dso, r=petrochenkov

codegen-llvm: never combine DSOLocal and DllImport

Prevent DllImport from being attached to DSOLocal definitions in the LLVM IR. The combination makes no sense, since definitions local to the compilation unit will never be imported from external objects.

Additionally, LLVM will refuse the IR if it encounters the combination (introduced in [1]):

```
  if (GV.hasDLLImportStorageClass())
    Assert(!GV.isDSOLocal(),
           "GlobalValue with DLLImport Storage is dso_local!", &GV);
```

Right now, codegen-llvm will only apply DllImport to constants and rely on call-stubs for functions. Hence, we simply extend the codegen of constants to skip DllImport for any local definitions.

This was discovered when switching the EFI targets to the static relocation model [2]. With this fixed, we can start another attempt at this.

[1] https://smlnj-gitlab.cs.uchicago.edu/manticore/llvm/commit/509132b368efed10bbdad825403f45e9cf1d6e38
[2] https://github.com/rust-lang/rust/issues/101656

19 months agoImprove spans in custom mir
Jakob Degen [Mon, 28 Nov 2022 05:23:39 +0000 (21:23 -0800)]
Improve spans in custom mir

19 months agoSupport statics in custom mir
Jakob Degen [Mon, 28 Nov 2022 03:25:55 +0000 (19:25 -0800)]
Support statics in custom mir

19 months agoSupport most constant kinds in custom mir
Jakob Degen [Mon, 28 Nov 2022 02:48:04 +0000 (18:48 -0800)]
Support most constant kinds in custom mir

19 months agoSupport arbitrary `let` statements in custom mir
Jakob Degen [Sun, 27 Nov 2022 10:32:48 +0000 (02:32 -0800)]
Support arbitrary `let` statements in custom mir

19 months agoAdd dependabot to `.mailmap`.
Nicholas Nethercote [Wed, 30 Nov 2022 02:08:43 +0000 (13:08 +1100)]
Add dependabot to `.mailmap`.

Before:
```
$ git shortlog -se | grep "depend"
    44 dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
     6 dependabot-preview[bot] <dependabot-preview[bot]@users.noreply.github.com>
     4 dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    74 dependabot[bot] <dependabot[bot]@users.noreply.github.com>
    93 dependabot[bot] <support@dependabot.com>
```
After:
```
$ git shortlog -se | grep "depend"
   221  dependabot[bot] <dependabot[bot]@users.noreply.github.com>
```

19 months agoAdd bors to `.mailmap`.
Nicholas Nethercote [Wed, 30 Nov 2022 02:01:17 +0000 (13:01 +1100)]
Add bors to `.mailmap`.

Before:
```
$ git shortlog -se | grep "\<bors\>"
 27755 bors <bors@rust-lang.org>
  5729 bors[bot] <26634292+bors[bot]@users.noreply.github.com>
   995 bors[bot] <bors[bot]@users.noreply.github.com>
```
After:
```
$ git shortlog -se | grep "\<bors\>"
 34479 bors <bors@rust-lang.org>
```

19 months agoFix an ICE parsing a malformed literal in `concat_bytes!`.
Nicholas Nethercote [Tue, 29 Nov 2022 00:50:03 +0000 (11:50 +1100)]
Fix an ICE parsing a malformed literal in `concat_bytes!`.

Fixes #104769.

19 months agoAuto merge of #105070 - matthiaskrgr:rollup-9b25khj, r=matthiaskrgr
bors [Wed, 30 Nov 2022 00:42:43 +0000 (00:42 +0000)]
Auto merge of #105070 - matthiaskrgr:rollup-9b25khj, r=matthiaskrgr

Rollup of 14 pull requests

Successful merges:

 - #103876 (type alias impl trait: add tests showing that hidden type only outlives lifetimes that occur in bounds)
 - #104427 (Explain why `rematch_impl` fails to be infallible)
 - #104436 (Add slice to the stack allocated string comment)
 - #104523 (Don't use periods in target names)
 - #104627 (Print all features with --print target-features)
 - #104911 (Make inferred_outlives_crate return Clause)
 - #105002 (Add `PathBuf::as_mut_os_string` and `Path::as_mut_os_str`)
 - #105023 (Statics used in reachable function's inline asm are reachable)
 - #105045 (`rustc_ast_{passes,pretty}`: remove `ref` patterns)
 - #105049 (Hermit: Minor build fixes)
 - #105051 (Replace a macro with a function)
 - #105062 (rustdoc: use shorthand background for rustdoc toggle CSS)
 - #105066 (move `candidate_from_obligation` out of assembly)
 - #105068 (Run patchelf also on rust-analyzer-proc-macro-srv.)

Failed merges:

 - #105050 (Remove useless borrows and derefs)

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

19 months agoAdd Nicholas Nethercote to `.mailmap`.
Nicholas Nethercote [Tue, 29 Nov 2022 21:51:43 +0000 (08:51 +1100)]
Add Nicholas Nethercote to `.mailmap`.

Before:
```
$ git shortlog -se | grep Nethercote
   517 Nicholas Nethercote <n.nethercote@gmail.com>
     2 Nicholas Nethercote <nnethercote@apple.com>
   560 Nicholas Nethercote <nnethercote@mozilla.com>
```
After
```
$ git shortlog -se | grep Nethercote
  1079 Nicholas Nethercote <n.nethercote@gmail.com>
```

19 months agoRollup merge of #105068 - jneem:master, r=jyn514
Matthias Krüger [Tue, 29 Nov 2022 21:43:22 +0000 (22:43 +0100)]
Rollup merge of #105068 - jneem:master, r=jyn514

Run patchelf also on rust-analyzer-proc-macro-srv.

On NixOS, `rust-analyzer-proc-macro-srv` needs to be `patchelf`ed just like all the other libs and binaries.

With this fix, I am able to use the language server configuration recommended in [the guide](https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc).