]> git.lizzy.rs Git - rust.git/log
rust.git
18 months agoRollup merge of #105505 - WaffleLapkin:yeet_unused_parens_lint, r=fee1-dead
Matthias Krüger [Sat, 10 Dec 2022 08:24:44 +0000 (09:24 +0100)]
Rollup merge of #105505 - WaffleLapkin:yeet_unused_parens_lint, r=fee1-dead

Don't warn about unused parens when they are used by yeet expr

Don't even get me started on how I've found this.

18 months agoRollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3
Matthias Krüger [Sat, 10 Dec 2022 08:24:43 +0000 (09:24 +0100)]
Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3

Add LLVM KCFI support to the Rust compiler

This PR adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.)

Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653).

LLVM KCFI can be enabled with -Zsanitizer=kcfi.

Thank you again, `@bjorn3,` `@eddyb,` `@nagisa,` and `@ojeda,` for all the help!

18 months agoRollup merge of #105082 - Swatinem:async-abi, r=compiler-errors
Matthias Krüger [Sat, 10 Dec 2022 08:24:43 +0000 (09:24 +0100)]
Rollup merge of #105082 - Swatinem:async-abi, r=compiler-errors

Fix Async Generator ABI

This change was missed when making async generators implement `Future` directly.
It did not cause any problems in codegen so far, as `GeneratorState<(), Output>`
happens to have the same ABI as `Poll<Output>`.

18 months agoRollup merge of #104901 - krtab:filetype_compare, r=the8472
Matthias Krüger [Sat, 10 Dec 2022 08:24:42 +0000 (09:24 +0100)]
Rollup merge of #104901 - krtab:filetype_compare, r=the8472

Implement masking in FileType comparison on Unix

Fixes: https://github.com/rust-lang/rust/issues/104900
18 months agoRollup merge of #104512 - jyn514:download-ci-llvm-default, r=Mark-Simulacrum
Matthias Krüger [Sat, 10 Dec 2022 08:24:41 +0000 (09:24 +0100)]
Rollup merge of #104512 - jyn514:download-ci-llvm-default, r=Mark-Simulacrum

Set `download-ci-llvm = "if-available"` by default when `channel = dev`

See https://github.com/rust-lang/compiler-team/issues/566. The motivation for changing the default is to avoid downloading and building LLVM when someone runs `x build` before running `x setup`. The motivation for only doing it on `channel = "dev"` is to avoid breaking distros or users installing from source. It works because `dev` is also the default channel.

The diff looks larger than it is; most of it is moving the `llvm` branch below the `rust` so `config.channel` is set.

r? `@Mark-Simulacrum` cc `@oli-obk` `@bjorn3` `@cuviper`

18 months agoRollup merge of #104019 - compiler-errors:print-generator-sizes, r=wesleywiser
Matthias Krüger [Sat, 10 Dec 2022 08:24:41 +0000 (09:24 +0100)]
Rollup merge of #104019 - compiler-errors:print-generator-sizes, r=wesleywiser

Compute generator sizes with `-Zprint_type_sizes`

Fixes #103887
r? `@pnkfelix`

18 months agoRollup merge of #98391 - joboet:sgx_parker, r=m-ou-se
Matthias Krüger [Sat, 10 Dec 2022 08:24:40 +0000 (09:24 +0100)]
Rollup merge of #98391 - joboet:sgx_parker, r=m-ou-se

Reimplement std's thread parker on top of events on SGX

Mutex and Condvar are being replaced by more efficient implementations, which need thread parking themselves (see #93740). Therefore, the generic `Parker` needs to be replaced on all platforms where the new lock implementation will be used.

SGX enclaves have a per-thread event state, which allows waiting for and setting specific bits. This is already used by the current mutex implementation. The thread parker can however be much more efficient, as it only needs to store the `TCS` address of one thread. This address is stored in a state variable, which can also be set to indicate the thread was already notified.

`park_timeout` does not guard against spurious wakeups like the current condition variable does. This is allowed by the API of `Parker`, and I think it is better to let users handle these wakeups themselves as the guarding is quite expensive and might not be necessary.

`@jethrogb` as you wrote the initial SGX support for `std`, I assume you are the target maintainer? Could you help me test this, please? Lacking a x86_64 chip, I can't run SGX.

18 months agoAuto merge of #105512 - matthiaskrgr:rollup-i74avrf, r=matthiaskrgr
bors [Sat, 10 Dec 2022 05:32:44 +0000 (05:32 +0000)]
Auto merge of #105512 - matthiaskrgr:rollup-i74avrf, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #102406 (Make `missing_copy_implementations` more cautious)
 - #105265 (Add `rustc_on_unimplemented` to `Sum` and `Product` trait.)
 - #105385 (Skip test on s390x as LLD does not support the platform)
 - #105453 (Make `VecDeque::from_iter` O(1) from `vec(_deque)::IntoIter`)
 - #105468 (Mangle "main" as "__main_void" on wasm32-wasi)
 - #105480 (rustdoc: remove no-op mobile CSS `#sidebar-toggle { text-align }`)
 - #105489 (Fix typo in apple_base.rs)
 - #105504 (rustdoc: make stability badge CSS more consistent)
 - #105506 (Tweak `rustc_must_implement_one_of` diagnostic output)

Failed merges:

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

18 months agoRollup merge of #105506 - estebank:rustc_must_implement_one_of, r=compiler-errors
Matthias Krüger [Fri, 9 Dec 2022 21:31:59 +0000 (22:31 +0100)]
Rollup merge of #105506 - estebank:rustc_must_implement_one_of, r=compiler-errors

Tweak `rustc_must_implement_one_of` diagnostic output

18 months agoRollup merge of #105504 - notriddle:notriddle/stab-css, r=GuillaumeGomez
Matthias Krüger [Fri, 9 Dec 2022 21:31:58 +0000 (22:31 +0100)]
Rollup merge of #105504 - notriddle:notriddle/stab-css, r=GuillaumeGomez

rustdoc: make stability badge CSS more consistent

# Before

![image](https://user-images.githubusercontent.com/1593513/206763667-8e0deb74-be63-4906-8229-9a7eb51725c2.png)

![image](https://user-images.githubusercontent.com/1593513/206764007-6301c0e8-4594-4a41-ba93-105824dffee6.png)

# After

![image](https://user-images.githubusercontent.com/1593513/206763698-e187cee2-3a50-4e48-b7b5-c3cfa41a797d.png)

![image](https://user-images.githubusercontent.com/1593513/206764058-3999ee67-1439-4c98-8216-b90575342aa8.png)

# Description

* They all get rounded corners now. A test case has been added for this, too.

* There are now broadly two kinds of stability badge, where there used to be three: item-info "fat badge", and the "thin badge" in both item tables and in docblocks (which got merged). The fat badges can have icons, while the thin badges can't.

* The old Ayu design doesn't make sense to me. Does anyone know why it was done that way?

18 months agoRollup merge of #105489 - eltociear:patch-17, r=Dylan-DPC
Matthias Krüger [Fri, 9 Dec 2022 21:31:58 +0000 (22:31 +0100)]
Rollup merge of #105489 - eltociear:patch-17, r=Dylan-DPC

Fix typo in apple_base.rs

erronous -> erroneous

18 months agoRollup merge of #105480 - notriddle:notriddle/sidebar-toggle-mobile-center, r=Guillau...
Matthias Krüger [Fri, 9 Dec 2022 21:31:57 +0000 (22:31 +0100)]
Rollup merge of #105480 - notriddle:notriddle/sidebar-toggle-mobile-center, r=GuillaumeGomez

rustdoc: remove no-op mobile CSS `#sidebar-toggle { text-align }`

Since 8b001b4da0716936e0ca32303cc0e3c5e53e42f8 make the sidebar toggle a flex container, and already centers its content in desktop mode, this rule doesn't do anything.

18 months agoRollup merge of #105468 - sunfishcode:sunfishcode/main-void-wasi, r=estebank
Matthias Krüger [Fri, 9 Dec 2022 21:31:57 +0000 (22:31 +0100)]
Rollup merge of #105468 - sunfishcode:sunfishcode/main-void-wasi, r=estebank

Mangle "main" as "__main_void" on wasm32-wasi

On wasm, the age-old C trick of having a main function which can either have no arguments or argc+argv doesn't work, because wasm requires caller and callee signatures to match. WASI's current strategy is to have compilers mangle main's name to indicate which signature they're using. Rust uses the no-argument form, which should be mangled as `__main_void`.

This is needed on wasm32-wasi as of #105395.

18 months agoRollup merge of #105453 - scottmcm:vecdeque_from_iter, r=the8472
Matthias Krüger [Fri, 9 Dec 2022 21:31:56 +0000 (22:31 +0100)]
Rollup merge of #105453 - scottmcm:vecdeque_from_iter, r=the8472

Make `VecDeque::from_iter` O(1) from `vec(_deque)::IntoIter`

As suggested in https://github.com/rust-lang/rust/pull/105046#issuecomment-1330371695 by
r? ``@the8472``

`Vec` & `VecDeque`'s `IntoIter`s own the allocations, and even if advanced can be turned into `VecDeque`s in O(1).

This is just a specialization, not an API or doc commitment, so I don't think it needs an FCP.

18 months agoRollup merge of #105385 - uweigand:s390x-test-lld, r=Mark-Simulacrum
Matthias Krüger [Fri, 9 Dec 2022 21:31:56 +0000 (22:31 +0100)]
Rollup merge of #105385 - uweigand:s390x-test-lld, r=Mark-Simulacrum

Skip test on s390x as LLD does not support the platform

test/run-make/issue-71519 requires use of lld as linker, but lld does not currently support the s390x architecture.

18 months agoRollup merge of #105265 - aDotInTheVoid:sum-product-on-unimplemented, r=estebank
Matthias Krüger [Fri, 9 Dec 2022 21:31:55 +0000 (22:31 +0100)]
Rollup merge of #105265 - aDotInTheVoid:sum-product-on-unimplemented, r=estebank

Add `rustc_on_unimplemented` to `Sum` and `Product` trait.

Helps with #105184, but I don't think it fully fixes it.

18 months agoRollup merge of #102406 - mejrs:missing_copy, r=wesleywiser
Matthias Krüger [Fri, 9 Dec 2022 21:31:54 +0000 (22:31 +0100)]
Rollup merge of #102406 - mejrs:missing_copy, r=wesleywiser

Make `missing_copy_implementations` more cautious

- Fixes https://github.com/rust-lang/rust/issues/98348
- Also makes the lint not fire on large types and types containing raw pointers. Thoughts?

18 months agoAuto merge of #105363 - WaffleLapkin:thin2win_box_next_argument, r=nnethercote
bors [Fri, 9 Dec 2022 21:27:35 +0000 (21:27 +0000)]
Auto merge of #105363 - WaffleLapkin:thin2win_box_next_argument, r=nnethercote

Shrink `rustc_parse_format::Piece`

This makes both variants closer together in size (previously they were different by 208 bytes -- 16 vs 224). This may make things worse, but it's worth a try.

r? `@nnethercote`

18 months agoAuto merge of #105499 - pietroalbini:pa-bump-version, r=pietroalbini
bors [Fri, 9 Dec 2022 18:46:42 +0000 (18:46 +0000)]
Auto merge of #105499 - pietroalbini:pa-bump-version, r=pietroalbini

Bump version to 1.68

cc `@rust-lang/release`

18 months agoTweak `rustc_must_implement_one_of` diagnostic output
Esteban Küber [Fri, 9 Dec 2022 18:44:11 +0000 (10:44 -0800)]
Tweak `rustc_must_implement_one_of` diagnostic output

18 months agoDon't warn about unused parens when they are used by yeet expr
Maybe Waffle [Fri, 9 Dec 2022 18:32:06 +0000 (18:32 +0000)]
Don't warn about unused parens when they are used by yeet expr

18 months agorustdoc: make stability badge CSS more consistent
Michael Howell [Fri, 9 Dec 2022 17:40:49 +0000 (10:40 -0700)]
rustdoc: make stability badge CSS more consistent

* They all get rounded corners now. A test case has been added for this, too.

* There are now broadly two kinds of stability badge, where there used to be
  three: item-info "fat badge", and the "thin badge" in both item tables and
  in docblocks (which got merged). The fat badges can have icons, while the
  thin badges can't.

18 months agobump version to 1.68
Pietro Albini [Fri, 9 Dec 2022 16:47:46 +0000 (17:47 +0100)]
bump version to 1.68

18 months agoAuto merge of #105262 - eduardosm:more-inline-always, r=thomcc
bors [Fri, 9 Dec 2022 15:42:18 +0000 (15:42 +0000)]
Auto merge of #105262 - eduardosm:more-inline-always, r=thomcc

Make some trivial functions `#[inline(always)]`

This is some kind of follow-up of PRs like https://github.com/rust-lang/rust/pull/85218, https://github.com/rust-lang/rust/pull/84061, https://github.com/rust-lang/rust/pull/87150. Functions that do very basic operations are made `#[inline(always)]` to avoid pessimizing them in debug builds when compared to using built-in operations directly.

18 months agoReplace hand-made masking by call to masked() method in FileType
Arthur Carcano [Fri, 9 Dec 2022 14:04:36 +0000 (15:04 +0100)]
Replace hand-made masking by call to masked() method in FileType

18 months agoAuto merge of #104572 - pkubaj:patch-1, r=cuviper
bors [Fri, 9 Dec 2022 12:00:58 +0000 (12:00 +0000)]
Auto merge of #104572 - pkubaj:patch-1, r=cuviper

Fix build on powerpc-unknown-freebsd

Probably also fixes build on arm and mips*. Related to https://github.com/rust-lang/rust/issues/104220

18 months agoAuto merge of #105486 - matthiaskrgr:rollup-o7c4l1c, r=matthiaskrgr
bors [Fri, 9 Dec 2022 09:19:26 +0000 (09:19 +0000)]
Auto merge of #105486 - matthiaskrgr:rollup-o7c4l1c, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #105216 (Remove unused GUI test)
 - #105245 (attempt to clarify align_to docs)
 - #105387 (Improve Rustdoc scrape-examples UI)
 - #105389 (Enable profiler in dist-powerpc64le-linux)
 - #105427 (Dont silently ignore rustdoc errors)
 - #105442 (rustdoc: clean up docblock table CSS)
 - #105443 (Move some queries and methods)
 - #105455 (use the correct `Reveal` during validation)
 - #105470 (Clippy: backport ICE fix before beta branch)
 - #105474 (lib docs: fix typo)

Failed merges:

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

18 months agoFix typo in apple_base.rs
Ikko Ashimine [Fri, 9 Dec 2022 09:09:32 +0000 (18:09 +0900)]
Fix typo in apple_base.rs

erronous -> erroneous

18 months agoRollup merge of #105474 - RalfJung:typo, r=dtolnay
Matthias Krüger [Fri, 9 Dec 2022 06:25:48 +0000 (07:25 +0100)]
Rollup merge of #105474 - RalfJung:typo, r=dtolnay

lib docs: fix typo

r? `@thomcc`

18 months agoRollup merge of #105470 - flip1995:clippy_backport, r=Manishearth
Matthias Krüger [Fri, 9 Dec 2022 06:25:47 +0000 (07:25 +0100)]
Rollup merge of #105470 - flip1995:clippy_backport, r=Manishearth

Clippy: backport ICE fix before beta branch

r? `@Manishearth`

Before beta is branched tomorrow we should backport the fix from https://github.com/rust-lang/rust-clippy/pull/10027 for an ICE. That way we'll get this into stable one release sooner.

This only cherry-picks the fix, not the tests for it. The proper sync of this will be done next week Thursday.

18 months agoRollup merge of #105455 - lcnr:correct-reveal-in-validate, r=jackh726
Matthias Krüger [Fri, 9 Dec 2022 06:25:47 +0000 (07:25 +0100)]
Rollup merge of #105455 - lcnr:correct-reveal-in-validate, r=jackh726

use the correct `Reveal` during validation

supersedes #105454. Deals with https://github.com/rust-lang/rust/issues/105009#issuecomment-1342395333, not closing #105009 as the ICE may leak into beta

The issue was the following:
- we optimize the mir, using `Reveal::All`
- some optimization relies on the hidden type of an opaque type
- we then validate using `Reveal::UserFacing` again which is not able to observe the hidden type

r? `@jackh726`

18 months agoRollup merge of #105443 - compiler-errors:move-more, r=oli-obk
Matthias Krüger [Fri, 9 Dec 2022 06:25:46 +0000 (07:25 +0100)]
Rollup merge of #105443 - compiler-errors:move-more, r=oli-obk

Move some queries and methods

Each commit's title should be self-explanatory. Motivated to break up some large, general files and move queries into leaf crates.

18 months agoRollup merge of #105442 - notriddle:notriddle/docblock-table-css, r=GuillaumeGomez
Matthias Krüger [Fri, 9 Dec 2022 06:25:46 +0000 (07:25 +0100)]
Rollup merge of #105442 - notriddle:notriddle/docblock-table-css, r=GuillaumeGomez

rustdoc: clean up docblock table CSS

# Preview

http://notriddle.com/notriddle-rustdoc-demos/table-2/test_dingus/fn.test.html

# Before

![image](https://user-images.githubusercontent.com/1593513/206364287-1b80eaaf-2e0e-4138-8b56-4aa8ff39abac.png)

# After

![image](https://user-images.githubusercontent.com/1593513/206364209-d287d165-31be-4de1-9b43-05b35ce2a86b.png)

# Details

* The rule `display: block` had no noticeable effect. Technically, because markdown tables have a tbody and thead, they get wrapped in an [anonymous table box] in the CSS tree, nested within the `<table>` element's block layout box.

  This rule was added in #87230 to make the table side-scrolling, but this same issue was doubly fixed in #88742 by wrapping it in an explicit `<div>` tag. Since accessibility advocates recommend the wrapper div over marking the table as `display: block`, we'll stick with that.

  https://adrianroselli.com/2020/11/under-engineered-responsive-tables.html

* The rule `width: calc(100% - 2px)` had no visible effect, because the anonymous table box was not affected.

* The style is tweaked to basically be the same style GitHub uses. In particular, it adds zebra stripes, and removes dotted borders.

  https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Markdown.20table.20styling

[anonymous table box]: https://www.w3.org/TR/CSS2/tables.html#anonymous-boxes

18 months agoRollup merge of #105427 - GuillaumeGomez:dont-silently-ignore-rustdoc-errors, r=notriddle
Matthias Krüger [Fri, 9 Dec 2022 06:25:45 +0000 (07:25 +0100)]
Rollup merge of #105427 - GuillaumeGomez:dont-silently-ignore-rustdoc-errors, r=notriddle

Dont silently ignore rustdoc errors

I applied the suggestions from https://github.com/rust-lang/rust/pull/104995 and also checked the rustdoc-ui error but couldn't reproduce it.

r? `@notriddle`

18 months agoRollup merge of #105389 - ogarokpeter:patch-1, r=Mark-Simulacrum
Matthias Krüger [Fri, 9 Dec 2022 06:25:45 +0000 (07:25 +0100)]
Rollup merge of #105389 - ogarokpeter:patch-1, r=Mark-Simulacrum

Enable profiler in dist-powerpc64le-linux

Build the profiler runtime to allow using -C profile-generate and -C instrument-coverage on POWER little endian systems.

I have verified locally that the runtime builds and the profiler is working fine on the platform.

Similar pull request for a different system: https://github.com/rust-lang/rust/pull/104304

18 months agoRollup merge of #105387 - willcrichton:scrape-examples-ui-improvements, r=notriddle
Matthias Krüger [Fri, 9 Dec 2022 06:25:44 +0000 (07:25 +0100)]
Rollup merge of #105387 - willcrichton:scrape-examples-ui-improvements, r=notriddle

Improve Rustdoc scrape-examples UI

This PR combines a few different improvements to the scrape-examples UI. See a live demo here: https://willcrichton.net/misc/scrape-examples/small-first-example/clap/struct.Arg.html

### 1. The first scraped example now takes up significantly less screen height.
Inserting the first scraped example takes up a lot of vertical screen space. I don't want this addition to overwhelm users, so I decided to reduce the height of the initial example in two ways: (A) the default un-expanded height is reduced from 240px (10 LOC) to 120px (5 LOC), and (B) the link to the example is now positioned *over* the example instead of *atop* the example (only on desktop though, not mobile). The changes to `scrape-examples.js` and `rustdoc.css` implement this fix.

Here is what an example docblock now looks like:

![Screen Shot 2022-12-06 at 10 02 21 AM](https://user-images.githubusercontent.com/663326/205987450-3940063c-5973-4a34-8579-baff6a43aa9b.png)

### 2. Expanding all docblocks will not expand "More examples".
The "More examples blocks" are huge, so fully expanding everything on the page would take up too much vertical space. The changes to `main.js` implement this fix. This is tested in `scrape-examples-toggle.goml`.

### 3. Examples from binary crates are sorted higher than examples from library crates.
Code that is written as an example of an API is probably better for learning than code that happens to use an API, but isn't intended for pedagogic purposes. Unfortunately Rustc doesn't know whether a particular crate comes from an example target (only Cargo knows this). But we can at least create a proxy that prefers examples from binary crates over library crates, which we know from `--crate-type`.

This change is implemented by adding a new field `bin_crate` in `Options` (see `config.rs`). An `is_bin` field has been added to the scraped examples metadata (see `scrape_examples.rs`). Then the example sorting metric uses `is_bin` as the first entry of a lexicographic sort on `(is_bin, example_size, display_name)` (see `render/mod.rs`).

Note that in the future we can consider adding another flag like `--scrape-examples-cargo-target` that would pass target information from Cargo into the example metadata. But I'm proposing a less intrusive change for now.

### 4. The scrape-examples help page has been updated to reflect the latest Cargo interface.

See `scrape-examples-help.md`.

r? `@notriddle`

P.S. once this PR and rust-lang/cargo#11450 are merged, then I think the scrape-examples feature is officially ready for deployment on docs.rs!

18 months agoRollup merge of #105245 - RalfJung:align_to, r=Amanieu
Matthias Krüger [Fri, 9 Dec 2022 06:25:44 +0000 (07:25 +0100)]
Rollup merge of #105245 - RalfJung:align_to, r=Amanieu

attempt to clarify align_to docs

This is not intended the change the docs at all, but `@workingjubilee` said the current docs are incomprehensible to some people so this is an attempt to fix that. No idea if it helps, so -- feedback welcome.

(Please let's not use this to discuss *changing* the spec. Whoever wants to change the spec should please make a separate PR for that.)

18 months agoRollup merge of #105216 - GuillaumeGomez:rm-unused-gui-test, r=notriddle
Matthias Krüger [Fri, 9 Dec 2022 06:25:43 +0000 (07:25 +0100)]
Rollup merge of #105216 - GuillaumeGomez:rm-unused-gui-test, r=notriddle

Remove unused GUI test

It's not testing anything so better just remove it.

r? `@notriddle`

18 months agoAuto merge of #104449 - oli-obk:unhide_unknown_spans, r=estebank,RalfJung
bors [Fri, 9 Dec 2022 06:24:28 +0000 (06:24 +0000)]
Auto merge of #104449 - oli-obk:unhide_unknown_spans, r=estebank,RalfJung

Start emitting labels even if their pointed to file is not available locally

r? `@estebank`

cc `@RalfJung`

fixes #97699

18 months agoApply review feedback; Fix no_global_oom_handling build
Scott McMurray [Fri, 9 Dec 2022 06:08:55 +0000 (22:08 -0800)]
Apply review feedback; Fix no_global_oom_handling build

18 months agoAuto merge of #105456 - matthiaskrgr:rollup-yennygf, r=matthiaskrgr
bors [Fri, 9 Dec 2022 03:05:27 +0000 (03:05 +0000)]
Auto merge of #105456 - matthiaskrgr:rollup-yennygf, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #104922 (Detect long types in E0308 and write them to disk)
 - #105120 (kmc-solid: `std::sys` code maintenance)
 - #105255 (Make nested RPIT inherit the parent opaque's generics.)
 - #105317 (make retagging work even with 'unstable' places)
 - #105405 (Stop passing -export-dynamic to wasm-ld.)
 - #105408 (Add help for `#![feature(impl_trait_in_fn_trait_return)]`)
 - #105423 (Use `Symbol` for the crate name instead of `String`/`str`)
 - #105433 (CI: add missing line continuation marker)
 - #105434 (Fix warning when libcore is compiled with no_fp_fmt_parse)
 - #105441 (Remove `UnsafetyState`)

Failed merges:

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

18 months agoAdd documentation for LLVM KCFI support
Ramon de C Valle [Thu, 1 Dec 2022 00:41:35 +0000 (16:41 -0800)]
Add documentation for LLVM KCFI support

This commit adds initial documentation for LLVM Kernel Control Flow
Integrity (KCFI) support to the Rust compiler (see #105109 and #89653).

Co-authored-by: Miguel Ojeda <ojeda@users.noreply.github.com>
18 months agoAdd LLVM KCFI support to the Rust compiler
Ramon de C Valle [Tue, 22 Nov 2022 05:29:00 +0000 (21:29 -0800)]
Add LLVM KCFI support to the Rust compiler

This commit adds LLVM Kernel Control Flow Integrity (KCFI) support to
the Rust compiler. It initially provides forward-edge control flow
protection for operating systems kernels for Rust-compiled code only by
aggregating function pointers in groups identified by their return and
parameter types. (See llvm/llvm-project@cff5bef.)

Forward-edge control flow protection for C or C++ and Rust -compiled
code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code
share the same virtual address space) will be provided in later work as
part of this project by identifying C char and integer type uses at the
time types are encoded (see Type metadata in the design document in the
tracking issue #89653).

LLVM KCFI can be enabled with -Zsanitizer=kcfi.

Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
18 months agoFix build on powerpc-unknown-freebsd
pkubaj [Fri, 18 Nov 2022 12:36:49 +0000 (12:36 +0000)]
Fix build on powerpc-unknown-freebsd

Probably also fixes build on mips*. Related to https://github.com/rust-lang/rust/issues/104220

18 months agorustdoc: remove no-op mobile CSS `#sidebar-toggle { text-align }`
Michael Howell [Fri, 9 Dec 2022 00:38:07 +0000 (17:38 -0700)]
rustdoc: remove no-op mobile CSS `#sidebar-toggle { text-align }`

Since 8b001b4da0716936e0ca32303cc0e3c5e53e42f8 make the sidebar toggle a
flex container, and already centers its content in desktop mode, this
rule doesn't do anything.

18 months agoAuto merge of #105477 - tmiasko:make, r=ehuss
bors [Thu, 8 Dec 2022 23:50:39 +0000 (23:50 +0000)]
Auto merge of #105477 - tmiasko:make, r=ehuss

Ignore errors when including clear_expected_if_blessed

Include is there only for the effect executing the rule. The file is not intended to be remade successfully to be actually included.

I erroneously changed this in #100912.

18 months agoAdd `rustc_on_unimplemented` to `Sum` and `Product` trait.
Nixon Enraght-Moony [Sun, 4 Dec 2022 18:46:57 +0000 (18:46 +0000)]
Add `rustc_on_unimplemented` to `Sum` and `Product` trait.

18 months agoIgnore errors when including clear_expected_if_blessed
Tomasz Miąsko [Thu, 8 Dec 2022 00:00:00 +0000 (00:00 +0000)]
Ignore errors when including clear_expected_if_blessed

Include is there only for the effect executing the rule.
The file is not intended to be remade successfully to be
actually included.

18 months agoAssert size of `rustc_parse_format::Piece<'_>`
Maybe Waffle [Thu, 8 Dec 2022 11:20:01 +0000 (11:20 +0000)]
Assert size of `rustc_parse_format::Piece<'_>`

18 months agoFix Async Generator ABI
Arpad Borsos [Tue, 29 Nov 2022 22:17:08 +0000 (23:17 +0100)]
Fix Async Generator ABI

This change was missed when making async generators implement `Future` directly.
It did not cause any problems in codegen so far, as `GeneratorState<(), Output>`
happens to have the same ABI as `Poll<Output>`.

18 months agolib docs: fix typo
Ralf Jung [Thu, 8 Dec 2022 21:36:57 +0000 (22:36 +0100)]
lib docs: fix typo

18 months agoMangle "main" as "__main_void" on wasm32-wasi
Dan Gohman [Thu, 8 Dec 2022 18:35:46 +0000 (10:35 -0800)]
Mangle "main" as "__main_void" on wasm32-wasi

On wasm, the age-old C trick of having a main function which can either have
no arguments or argc+argv doesn't work, because wasm requires caller and
callee signatures to match. WASI's current strategy is to have compilers
mangle main's name to indicate which signature they're using. Rust uses the
no-argument form, which should be mangled as `__main_void`.

This is needed on wasm32-wasi as of #105395.

18 months agoFix #10021
Samuel Moelius [Sat, 3 Dec 2022 01:41:29 +0000 (20:41 -0500)]
Fix #10021

18 months agorustdoc: add GUI test case for docblock table colors
Michael Howell [Thu, 8 Dec 2022 16:38:27 +0000 (09:38 -0700)]
rustdoc: add GUI test case for docblock table colors

18 months agoUpdate rustdoc test to check its error output
Guillaume Gomez [Wed, 7 Dec 2022 15:08:58 +0000 (16:08 +0100)]
Update rustdoc test to check its error output

18 months agoRollup merge of #105441 - nnethercote:rm-UnsafetyState, r=lcnr
Matthias Krüger [Thu, 8 Dec 2022 11:57:33 +0000 (12:57 +0100)]
Rollup merge of #105441 - nnethercote:rm-UnsafetyState, r=lcnr

Remove `UnsafetyState`

r? `@lcnr`

18 months agoRollup merge of #105434 - nbdd0121:lib, r=thomcc
Matthias Krüger [Thu, 8 Dec 2022 11:57:33 +0000 (12:57 +0100)]
Rollup merge of #105434 - nbdd0121:lib, r=thomcc

Fix warning when libcore is compiled with no_fp_fmt_parse

Discovered when trying to compile Rust-for-Linux with Rust 1.66 beta.

It'll be helpful if this is backported to beta (should be trivial enough for backporting), so Rust-for-Linux's rust version bump wouldn't need to do `--cap-lints allow` for libcore.

18 months agoRollup merge of #105433 - ComputerDruid:docker_continuation_fix, r=jyn514
Matthias Krüger [Thu, 8 Dec 2022 11:57:32 +0000 (12:57 +0100)]
Rollup merge of #105433 - ComputerDruid:docker_continuation_fix, r=jyn514

CI: add missing line continuation marker

Resolves this docker warning:

```
[WARNING]: Empty continuation line found in:
    RUN apt-get update && apt-get install -y --no-install-recommends   g++   gcc-multilib   make   ninja-build   file   curl   ca-certificates   python2.7   python3.9   git   cmake   sudo   gdb   llvm-13-tools   llvm-13-dev   libedit-dev   libssl-dev   pkg-config   zlib1g-dev   xz-utils   nodejs     apt-transport-https software-properties-common &&     curl -s "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb" > packages-microsoft-prod.deb &&     dpkg -i packages-microsoft-prod.deb &&     apt-get update &&     apt-get install -y powershell     && rm -rf /var/lib/apt/lists/*
Warning: : Empty continuation lines will become errors in a future release.
```

18 months agoRollup merge of #105423 - oli-obk:symbols, r=jackh726
Matthias Krüger [Thu, 8 Dec 2022 11:57:32 +0000 (12:57 +0100)]
Rollup merge of #105423 - oli-obk:symbols, r=jackh726

Use `Symbol` for the crate name instead of `String`/`str`

It always got converted to a symbol anyway

18 months agoRollup merge of #105408 - cuviper:help-rpitirpit, r=compiler-errors
Matthias Krüger [Thu, 8 Dec 2022 11:57:31 +0000 (12:57 +0100)]
Rollup merge of #105408 - cuviper:help-rpitirpit, r=compiler-errors

Add help for `#![feature(impl_trait_in_fn_trait_return)]`

This adds a new variant `ImplTraitContext::FeatureGated`, so we can
generalize the help for `return_position_impl_trait_in_trait` to also
work for `impl_trait_in_fn_trait_return`.

cc #99697

18 months agoRollup merge of #105405 - sunfishcode:sunfishcode/export-dynamic, r=TaKO8Ki
Matthias Krüger [Thu, 8 Dec 2022 11:57:30 +0000 (12:57 +0100)]
Rollup merge of #105405 - sunfishcode:sunfishcode/export-dynamic, r=TaKO8Ki

Stop passing -export-dynamic to wasm-ld.

-export-dynamic was a temporary hack added in the early days of the Rust wasm32 target when Rust didn't have a way to specify wasm exports in the source code. This flag causes all global symbols, and some compiler-internal symbols, to be exported, which is often more than needed.

Rust now does have a way to specify exports in the source code: `#[export_name = "..."]`.

So as the original comment suggests, -export-dynamic can now be removed, allowing users to have smaller binaries and better encapsulation in their wasm32-unknown-unknown modules.

It's possible that this change will require existing wasm32-unknown-unknown users will to add explicit `#[export_name = "..."]` directives to exporrt the symbols that their programs depend on having exported.

18 months agoRollup merge of #105317 - RalfJung:retag-rework, r=oli-obk
Matthias Krüger [Thu, 8 Dec 2022 11:57:30 +0000 (12:57 +0100)]
Rollup merge of #105317 - RalfJung:retag-rework, r=oli-obk

make retagging work even with 'unstable' places

This is based on top of https://github.com/rust-lang/rust/pull/105301. Only the last two commits are new.

While investigating https://github.com/rust-lang/unsafe-code-guidelines/issues/381 I realized that we would have caught this issue much earlier if the add_retag pass wouldn't bail out on assignments of the form `*ptr = ...`.

So this PR changes our retag strategy:
- When a new reference is created via `Rvalue::Ref` (or a raw ptr via `Rvalue::AddressOf`), we do the retagging as part of just executing that address-taking operation.
- For everything else, we still insert retags -- these retags basically serve to ensure that references stored in local variables (and their fields) are always freshly tagged, so skipping this for assignments like `*ptr = ...` is less egregious.
r? ```@oli-obk```

18 months agoRollup merge of #105255 - cjgillot:issue-105197, r=compiler-errors
Matthias Krüger [Thu, 8 Dec 2022 11:57:29 +0000 (12:57 +0100)]
Rollup merge of #105255 - cjgillot:issue-105197, r=compiler-errors

Make nested RPIT inherit the parent opaque's generics.

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

r? ```@compiler-errors```

18 months agoRollup merge of #105120 - solid-rs:patch/kmc-solid/maintainance, r=thomcc
Matthias Krüger [Thu, 8 Dec 2022 11:57:29 +0000 (12:57 +0100)]
Rollup merge of #105120 - solid-rs:patch/kmc-solid/maintainance, r=thomcc

kmc-solid: `std::sys` code maintenance

Includes a set of changes to fix the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets and make some other improvements.

- Address `fuzzy_provenance_casts` by using `expose_addr` and `from_exposed_addr` for pointer-integer casts
- Add a stub implementation of `is_terminal` (#98070)
- Address `unused_imports` and `unused_unsafe`
- Stop doing `Box::from_raw(&*(x: Box<T>) as *const T as *mut T)`

18 months agoRollup merge of #104922 - estebank:fur-elize, r=oli-obk
Matthias Krüger [Thu, 8 Dec 2022 11:57:28 +0000 (12:57 +0100)]
Rollup merge of #104922 - estebank:fur-elize, r=oli-obk

Detect long types in E0308 and write them to disk

On type error with long types, print an abridged type and write the full type to disk.

Print the widest possible short type while still fitting in the terminal.

18 months agoadd regression test for #105009
lcnr [Thu, 8 Dec 2022 11:23:10 +0000 (12:23 +0100)]
add regression test for #105009

18 months agovalidate: use the correct reveal during opts
lcnr [Thu, 8 Dec 2022 10:24:25 +0000 (11:24 +0100)]
validate: use the correct reveal during opts

18 months agoMake `VecDeque::from_iter` O(1) from `vec(_deque)::IntoIter`
Scott McMurray [Thu, 8 Dec 2022 09:42:45 +0000 (01:42 -0800)]
Make `VecDeque::from_iter` O(1) from `vec(_deque)::IntoIter`

18 months agoAuto merge of #105415 - nikic:update-llvm-10, r=cuviper
bors [Thu, 8 Dec 2022 07:46:42 +0000 (07:46 +0000)]
Auto merge of #105415 - nikic:update-llvm-10, r=cuviper

Update LLVM submodule

This is a rebase to LLVM 15.0.6.

Fixes #103380.
Fixes #104099.

18 months agoMove some suggestions from error_reporting to error_reporting::suggest
Michael Goulet [Thu, 8 Dec 2022 05:58:30 +0000 (05:58 +0000)]
Move some suggestions from error_reporting to error_reporting::suggest

18 months agorustdoc: clean up docblock table CSS
Michael Howell [Thu, 8 Dec 2022 04:59:54 +0000 (21:59 -0700)]
rustdoc: clean up docblock table CSS

* The rule `display: block` had no noticeable effect. Technically, because
  markdown tables have a tbody and thead, they get wrapped in an [anonymous
  table box] in the CSS tree, nested within the `<table>` element's block
  layout box.

  This rule was added in #87230 to make the table side-scrolling, but
  this same issue was doubly fixed in #88742 by wrapping it in an explicit
  `<div>` tag. Since accessibility advocates recommend the wrapper div over
  marking the table as `display: block`, we'll stick with that.

  https://adrianroselli.com/2020/11/under-engineered-responsive-tables.html

* The rule `width: calc(100% - 2px)` had no visible effect, because the
  anonymous table box was not affected.

* The style is tweaked to basically be the same style GitHub uses.
  In particular, it adds zebra stripes, and removes dotted borders.

[anonymous table box]: https://www.w3.org/TR/CSS2/tables.html#anonymous-boxes

18 months agoMove codegen_select_candidate to a rustc_traits
Michael Goulet [Thu, 8 Dec 2022 05:16:39 +0000 (05:16 +0000)]
Move codegen_select_candidate to a rustc_traits

18 months agoMove vtable methods into its own module
Michael Goulet [Thu, 8 Dec 2022 04:51:46 +0000 (04:51 +0000)]
Move vtable methods into its own module

18 months agoMove has_structural_eq_impls provider to rustc_ty_utils
Michael Goulet [Thu, 8 Dec 2022 04:02:50 +0000 (04:02 +0000)]
Move has_structural_eq_impls provider to rustc_ty_utils

18 months agoPull out logic into distinct functions
Michael Goulet [Wed, 7 Dec 2022 20:30:42 +0000 (20:30 +0000)]
Pull out logic into distinct functions

18 months agoFix a typo.
Nicholas Nethercote [Thu, 8 Dec 2022 04:53:31 +0000 (15:53 +1100)]
Fix a typo.

18 months agoRemove `UnsafetyState`.
Nicholas Nethercote [Thu, 8 Dec 2022 04:42:12 +0000 (15:42 +1100)]
Remove `UnsafetyState`.

`FnCtxt::ps` is the only occurrence. It gets updated during HIR
typechecking, but is never looked at.

18 months agoAuto merge of #105425 - matthiaskrgr:rollup-3ngvxmt, r=matthiaskrgr
bors [Thu, 8 Dec 2022 03:04:51 +0000 (03:04 +0000)]
Auto merge of #105425 - matthiaskrgr:rollup-3ngvxmt, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #105267 (Don't ICE in ExprUseVisitor on FRU for non-existent struct)
 - #105343 (Simplify attribute handling in rustc_ast_lowering)
 - #105368 (Remove more `ref` patterns from the compiler)
 - #105400 (normalize before handling simple checks for evaluatability of `ty::Const`)
 - #105403 (rustdoc: simplify CSS selectors for item table `.stab`)
 - #105418 (fix: remove hack from link.rs)

Failed merges:

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

18 months agoFix warning when libcore is compiled with no_fp_fmt_parse
Gary Guo [Thu, 8 Dec 2022 00:07:00 +0000 (00:07 +0000)]
Fix warning when libcore is compiled with no_fp_fmt_parse

18 months agoCI: add missing line continuation marker
Dan Johnson [Wed, 7 Dec 2022 22:15:56 +0000 (14:15 -0800)]
CI: add missing line continuation marker

Resolves this docker warning:

```
[WARNING]: Empty continuation line found in:
    RUN apt-get update && apt-get install -y --no-install-recommends   g++   gcc-multilib   make   ninja-build   file   curl   ca-certificates   python2.7   python3.9   git   cmake   sudo   gdb   llvm-13-tools   llvm-13-dev   libedit-dev   libssl-dev   pkg-config   zlib1g-dev   xz-utils   nodejs     apt-transport-https software-properties-common &&     curl -s "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb" > packages-microsoft-prod.deb &&     dpkg -i packages-microsoft-prod.deb &&     apt-get update &&     apt-get install -y powershell     && rm -rf /var/lib/apt/lists/*
Warning: : Empty continuation lines will become errors in a future release.
```

18 months agoUse `Symbol` for the crate name instead of `String`/`str`
Oli Scherer [Tue, 6 Dec 2022 12:46:10 +0000 (12:46 +0000)]
Use `Symbol` for the crate name instead of `String`/`str`

18 months agoImprove calculation of scraped example minimized height
Will Crichton [Wed, 7 Dec 2022 18:24:16 +0000 (10:24 -0800)]
Improve calculation of scraped example minimized height

18 months agoProperly print generator interior type sizes
Michael Goulet [Wed, 7 Dec 2022 18:33:26 +0000 (18:33 +0000)]
Properly print generator interior type sizes

18 months agoRevert crate_types change, add new bin_crate field
Will Crichton [Tue, 6 Dec 2022 20:56:02 +0000 (12:56 -0800)]
Revert crate_types change, add new bin_crate field

18 months agoFix rustdoc error with no providec crate-type, fix scrape examples button colors...
Will Crichton [Tue, 6 Dec 2022 19:24:26 +0000 (11:24 -0800)]
Fix rustdoc error with no providec crate-type, fix scrape examples button colors w/ themes

18 months agoFix es-check
Will Crichton [Tue, 6 Dec 2022 18:22:23 +0000 (10:22 -0800)]
Fix es-check

18 months agoUpdate scrape-examples help, fix documentation typos
Will Crichton [Tue, 6 Dec 2022 18:11:55 +0000 (10:11 -0800)]
Update scrape-examples help, fix documentation typos

18 months agoFactor scrape-examples toggle test into a new file
Will Crichton [Tue, 6 Dec 2022 17:59:49 +0000 (09:59 -0800)]
Factor scrape-examples toggle test into a new file

18 months agoInclude additional documentation for scrape-examples changes
Will Crichton [Tue, 6 Dec 2022 17:34:37 +0000 (09:34 -0800)]
Include additional documentation for scrape-examples changes

18 months agoOnly put title over example on large screens
Will Crichton [Tue, 6 Dec 2022 07:48:07 +0000 (23:48 -0800)]
Only put title over example on large screens

18 months agoAdd explanations to scrape-examples integration test
Will Crichton [Tue, 6 Dec 2022 07:34:02 +0000 (23:34 -0800)]
Add explanations to scrape-examples integration test

18 months agoImprove several aspects of the Rustdoc scrape-examples UI.
Will Crichton [Sun, 27 Nov 2022 19:11:21 +0000 (13:11 -0600)]
Improve several aspects of the Rustdoc scrape-examples UI.
* Examples take up less screen height.
* Snippets from binary crates are prioritized.
* toggle-all-docs does not expand "More examples" sections.

18 months agoMove closure/generator type info methods to TyCtxt
Michael Goulet [Wed, 7 Dec 2022 17:00:33 +0000 (17:00 +0000)]
Move closure/generator type info methods to TyCtxt

18 months agoMake some trivial functions `#[inline(always)]`
Eduardo Sánchez Muñoz [Wed, 7 Dec 2022 16:11:17 +0000 (17:11 +0100)]
Make some trivial functions `#[inline(always)]`

18 months agoDon't silently ignore errors that happen during rendering
Guillaume Gomez [Wed, 7 Dec 2022 15:08:13 +0000 (16:08 +0100)]
Don't silently ignore errors that happen during rendering

18 months agoRollup merge of #105418 - BelovDV:fix-libc-hack, r=petrochenkov
Matthias Krüger [Wed, 7 Dec 2022 14:39:09 +0000 (15:39 +0100)]
Rollup merge of #105418 - BelovDV:fix-libc-hack, r=petrochenkov

fix: remove hack from link.rs

This logic implemented in libc.

r? `@petrochenkov`

18 months agoRollup merge of #105403 - notriddle:notriddle/item-stab-css, r=GuillaumeGomez
Matthias Krüger [Wed, 7 Dec 2022 14:39:09 +0000 (15:39 +0100)]
Rollup merge of #105403 - notriddle:notriddle/item-stab-css, r=GuillaumeGomez

rustdoc: simplify CSS selectors for item table `.stab`

The module-item and import-item classes are attached to the item-left. Just target that, instead.

18 months agoRollup merge of #105400 - BoxyUwU:braced_param_evaluatability, r=oli-obk
Matthias Krüger [Wed, 7 Dec 2022 14:39:08 +0000 (15:39 +0100)]
Rollup merge of #105400 - BoxyUwU:braced_param_evaluatability, r=oli-obk

normalize before handling simple checks for evaluatability of `ty::Const`

`{{{{{{{ N }}}}}}}` is desugared into a `ConstKind::Unevaluated` for an anonymous `const` item so when calling `is_const_evaluatable` on it we skip the `ConstKind::Param(_) => Ok(())` arm which is incorrect.

18 months agoRollup merge of #105368 - WaffleLapkin:deref-even-harder, r=TaKO8Ki
Matthias Krüger [Wed, 7 Dec 2022 14:39:07 +0000 (15:39 +0100)]
Rollup merge of #105368 - WaffleLapkin:deref-even-harder, r=TaKO8Ki

Remove more `ref` patterns from the compiler

Previous PR: #105045

18 months agoRollup merge of #105343 - nbdd0121:hir, r=fee1-dead
Matthias Krüger [Wed, 7 Dec 2022 14:39:07 +0000 (15:39 +0100)]
Rollup merge of #105343 - nbdd0121:hir, r=fee1-dead

Simplify attribute handling in rustc_ast_lowering

Given that attributes is stored in a separate BTreeMap, it's not necessary to pass it in when constructing `hir::Expr`. We can just construct `hir::Expr` and then call `self.lower_attrs` later if it needs attributes.

As most desugaring code don't use attributes, this allows some code cleanup.