]> git.lizzy.rs Git - rust.git/log
rust.git
22 months agoMove a comment to the right place.
Nicholas Nethercote [Mon, 29 Aug 2022 01:11:31 +0000 (11:11 +1000)]
Move a comment to the right place.

This comment on the HIR `visit_path_segment` is supposed be on the AST
`visit_path_segment`.

22 months agoUse `&'hir Mod` everywhere.
Nicholas Nethercote [Fri, 26 Aug 2022 06:22:13 +0000 (16:22 +1000)]
Use `&'hir Mod` everywhere.

For consistency, and because it makes HIR measurement simpler and more
accurate.

22 months agoUse `&'hir Ty` everywhere.
Nicholas Nethercote [Fri, 26 Aug 2022 05:57:44 +0000 (15:57 +1000)]
Use `&'hir Ty` everywhere.

For consistency, and because it makes HIR measurement simpler and more
accurate.

22 months agoUse `&'hir Expr` everywhere.
Nicholas Nethercote [Fri, 26 Aug 2022 05:43:00 +0000 (15:43 +1000)]
Use `&'hir Expr` everywhere.

For consistency, and because it makes HIR measurement simpler and more
accurate.

22 months agoExpand the HIR (and AST) size assertions.
Nicholas Nethercote [Fri, 26 Aug 2022 05:07:40 +0000 (15:07 +1000)]
Expand the HIR (and AST) size assertions.

22 months agoAdd prefix to every line of `-Zhir-stats` output.
Nicholas Nethercote [Fri, 26 Aug 2022 03:52:41 +0000 (13:52 +1000)]
Add prefix to every line of `-Zhir-stats` output.

This is based on `-Zprint-type-sizes` which does the same thing. It
makes the output provenance clearer, and helps with post-processing.
E.g. if you have `-Zhir-stats` output from numerous compiler invocations
you can now easily extract the pre-expansion stats separately from the
post-expansion stats.

22 months agoAuto merge of #100201 - RalfJung:thread-local-key, r=thomcc
bors [Sun, 28 Aug 2022 15:12:31 +0000 (15:12 +0000)]
Auto merge of #100201 - RalfJung:thread-local-key, r=thomcc

std: use realstd fast key when building tests

Under `cfg(test)`, the `std` crate is not the actual standard library, just any old crate we are testing. It imports the real standard library as `realstd`, and then does some careful `cfg` magic so that the crate built for testing uses the `realstd` global state rather than having its own copy of that.

However, this was not done for all global state hidden in std: the 'fast' version of thread-local keys, at least on some platforms, also involves some global state. Specifically its macOS version has this [`static REGISTERED`](https://github.com/rust-lang/rust/blob/bc63d5a26a65752fb105957d3235cc9c8cb0767f/library/std/src/sys/unix/thread_local_dtor.rs#L62) that would get duplicated. So this PR imports the 'fast' key type from `realstd` rather than using the local copy, to ensure its internal state (and that of the functions it calls) does not get duplicated.

I also noticed that the `__OsLocalKeyInner` is unused under `cfg(target_thread_local)`, so I removed it for that configuration. There was a comment saying macOS picks between `__OsLocalKeyInner` and `__FastLocalKeyInner` at runtime, but I think that comment is outdated -- I found no trace of such a runtime switching mechanism, and the library still check-builds on apple targets with this PR. (I don't have a Mac so I cannot actually run it.)

22 months agoAuto merge of #96324 - berendjan:set_tcp_quickack, r=dtolnay
bors [Sun, 28 Aug 2022 12:26:37 +0000 (12:26 +0000)]
Auto merge of #96324 - berendjan:set_tcp_quickack, r=dtolnay

Add setter and getter for TCP_QUICKACK on TcpStream for Linux

Reference issue #96256

Setting TCP_QUICKACK on TcpStream for Linux

22 months agoAuto merge of #101115 - matthiaskrgr:rollup-iy14ztr, r=matthiaskrgr
bors [Sun, 28 Aug 2022 09:45:27 +0000 (09:45 +0000)]
Auto merge of #101115 - matthiaskrgr:rollup-iy14ztr, r=matthiaskrgr

Rollup of 13 pull requests

Successful merges:

 - #97015 (std::io: migrate ReadBuf to BorrowBuf/BorrowCursor)
 - #98301 (Add GDB/LLDB pretty-printers for NonZero types)
 - #99570 (Box::from(slice): Clarify that contents are copied)
 - #100296 (Add standard C error function aliases to last_os_error)
 - #100520 (Add mention of `BufReader` in `Read::bytes` docs)
 - #100885 (Export Cancel from std::os::fortanix_sgx::usercalls::raw)
 - #100955 (Some papercuts on error::Error)
 - #101002 (Provide structured suggestion for `hashmap[idx] = val`)
 - #101038 (no alignment check during interning)
 - #101055 (Use smaller span for suggestions)
 - #101091 (Extend attrs if local_def_id exists)
 - #101098 (rustc_middle: Remove `Visibility::Invisible`)
 - #101102 (unstable-book-gen: use std::fs::write)

Failed merges:

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

22 months agoRollup merge of #101102 - est31:unstable_book_gen_write, r=Mark-Simulacrum
Matthias Krüger [Sun, 28 Aug 2022 07:35:23 +0000 (09:35 +0200)]
Rollup merge of #101102 - est31:unstable_book_gen_write, r=Mark-Simulacrum

unstable-book-gen: use std::fs::write

I wrote this code in 2017 back when std::fs::write wasn't available.
Also, use the t macro from tidy.

22 months agoRollup merge of #101098 - petrochenkov:noinvis, r=TaKO8Ki
Matthias Krüger [Sun, 28 Aug 2022 07:35:22 +0000 (09:35 +0200)]
Rollup merge of #101098 - petrochenkov:noinvis, r=TaKO8Ki

rustc_middle: Remove `Visibility::Invisible`

It had a different meaning in the past, but now it's only used as an implementation detail of import resolution.

22 months agoRollup merge of #101091 - TaKO8Ki:fix-101076, r=notriddle
Matthias Krüger [Sun, 28 Aug 2022 07:35:21 +0000 (09:35 +0200)]
Rollup merge of #101091 - TaKO8Ki:fix-101076, r=notriddle

Extend attrs if local_def_id exists

Fixes #101076

22 months agoRollup merge of #101055 - TaKO8Ki:use-smaller-span, r=compiler-errors
Matthias Krüger [Sun, 28 Aug 2022 07:35:20 +0000 (09:35 +0200)]
Rollup merge of #101055 - TaKO8Ki:use-smaller-span, r=compiler-errors

Use smaller span for suggestions

22 months agoRollup merge of #101038 - RalfJung:interning-alignment, r=oli-obk
Matthias Krüger [Sun, 28 Aug 2022 07:35:19 +0000 (09:35 +0200)]
Rollup merge of #101038 - RalfJung:interning-alignment, r=oli-obk

no alignment check during interning

This should fix https://github.com/rust-lang/rust/issues/101034
r? `@oli-obk`

Unfortunately we don't have a self-contained testcase for this problem. I am not sure how it can be triggered...

22 months agoRollup merge of #101002 - estebank:hashmap-idx, r=davidtwco
Matthias Krüger [Sun, 28 Aug 2022 07:35:18 +0000 (09:35 +0200)]
Rollup merge of #101002 - estebank:hashmap-idx, r=davidtwco

Provide structured suggestion for `hashmap[idx] = val`

22 months agoRollup merge of #100955 - nrc:chain, r=joshtriplett
Matthias Krüger [Sun, 28 Aug 2022 07:35:17 +0000 (09:35 +0200)]
Rollup merge of #100955 - nrc:chain, r=joshtriplett

Some papercuts on error::Error

Renames the chain method, since I chain could mean anything and doesn't refer to a chain of sources (cc #58520) (and adds a comment explaining why sources is not a provided method on Error). Renames arguments to the request method from `req` to `demand` since the type is `Demand` rather than Request or Requisition.

r? ``@yaahc``

22 months agoRollup merge of #100885 - mzohreva:mz/sgx-export-cancel-type, r=Mark-Simulacrum
Matthias Krüger [Sun, 28 Aug 2022 07:35:16 +0000 (09:35 +0200)]
Rollup merge of #100885 - mzohreva:mz/sgx-export-cancel-type, r=Mark-Simulacrum

Export Cancel from std::os::fortanix_sgx::usercalls::raw

This was missed in https://github.com/rust-lang/rust/pull/100642

cc ``@raoulstrackx`` and ``@jethrogb``

22 months agoRollup merge of #100520 - jakubdabek:patch-1, r=thomcc
Matthias Krüger [Sun, 28 Aug 2022 07:35:15 +0000 (09:35 +0200)]
Rollup merge of #100520 - jakubdabek:patch-1, r=thomcc

Add mention of `BufReader` in `Read::bytes` docs

There is a general paragraph about `BufRead` in the `Read` trait's docs, however using `bytes` without `BufRead` *always* has a large impact, due to reads of size 1.

`@rustbot` label +A-docs

22 months agoRollup merge of #100296 - BlackHoleFox:os-error-aliases, r=thomcc
Matthias Krüger [Sun, 28 Aug 2022 07:35:14 +0000 (09:35 +0200)]
Rollup merge of #100296 - BlackHoleFox:os-error-aliases, r=thomcc

Add standard C error function aliases to last_os_error

This aids the discoverability of `io::Error::last_os_error()` by linking to commonly used error number functions from C/C++.

I've seen a few people not realize this exists, so hopefully this helps draw attention to the API to encourage using it over integer error codes.

22 months agoRollup merge of #99570 - XrXr:box-from-slice-docs, r=thomcc
Matthias Krüger [Sun, 28 Aug 2022 07:35:13 +0000 (09:35 +0200)]
Rollup merge of #99570 - XrXr:box-from-slice-docs, r=thomcc

Box::from(slice): Clarify that contents are copied

A colleague mentioned that they interpreted the old text
as saying that only the pointer and the length are copied.
Add a clause so it is more clear that the pointed to contents
are also copied.

22 months agoRollup merge of #98301 - ortem:pretty-printers-nonzero, r=wesleywiser
Matthias Krüger [Sun, 28 Aug 2022 07:35:12 +0000 (09:35 +0200)]
Rollup merge of #98301 - ortem:pretty-printers-nonzero, r=wesleywiser

Add GDB/LLDB pretty-printers for NonZero types

Add GDB/LLDB pretty-printers for `NonZero` types.
These pretty-printers were originally implemented for IntelliJ Rust by ```@Kobzol``` in https://github.com/intellij-rust/intellij-rust/pull/5270.

Part of #29392.

22 months agoRollup merge of #97015 - nrc:read-buf-cursor, r=Mark-Simulacrum
Matthias Krüger [Sun, 28 Aug 2022 07:35:11 +0000 (09:35 +0200)]
Rollup merge of #97015 - nrc:read-buf-cursor, r=Mark-Simulacrum

std::io: migrate ReadBuf to BorrowBuf/BorrowCursor

This PR replaces `ReadBuf` (used by the `Read::read_buf` family of methods) with `BorrowBuf` and `BorrowCursor`.

The general idea is to split `ReadBuf` because its API is large and confusing. `BorrowBuf` represents a borrowed buffer which is mostly read-only and (other than for construction) deals only with filled vs unfilled segments. a `BorrowCursor` is a mostly write-only view of the unfilled part of a `BorrowBuf` which distinguishes between initialized and uninitialized segments. For `Read::read_buf`, the caller would create a `BorrowBuf`, then pass a `BorrowCursor` to `read_buf`.

In addition to the major API split, I've made the following smaller changes:

* Removed some methods entirely from the API (mostly the functionality can be replicated with two calls rather than a single one)
* Unified naming, e.g., by replacing initialized with init and assume_init with set_init
* Added an easy way to get the number of bytes written to a cursor (`written` method)

As well as simplifying the API (IMO), this approach has the following advantages:

* Since we pass the cursor by value, we remove the 'unsoundness footgun' where a malicious `read_buf` could swap out the `ReadBuf`.
* Since `read_buf` cannot write into the filled part of the buffer, we prevent the filled part shrinking or changing which could cause underflow for the caller or unexpected behaviour.

## Outline

```rust
pub struct BorrowBuf<'a>

impl Debug for BorrowBuf<'_>

impl<'a> From<&'a mut [u8]> for BorrowBuf<'a>
impl<'a> From<&'a mut [MaybeUninit<u8>]> for BorrowBuf<'a>

impl<'a> BorrowBuf<'a> {
    pub fn capacity(&self) -> usize
    pub fn len(&self) -> usize
    pub fn init_len(&self) -> usize
    pub fn filled(&self) -> &[u8]
    pub fn unfilled<'this>(&'this mut self) -> BorrowCursor<'this, 'a>
    pub fn clear(&mut self) -> &mut Self
    pub unsafe fn set_init(&mut self, n: usize) -> &mut Self
}

pub struct BorrowCursor<'buf, 'data>

impl<'buf, 'data> BorrowCursor<'buf, 'data> {
    pub fn clone<'this>(&'this mut self) -> BorrowCursor<'this, 'data>
    pub fn capacity(&self) -> usize
    pub fn written(&self) -> usize
    pub fn init_ref(&self) -> &[u8]
    pub fn init_mut(&mut self) -> &mut [u8]
    pub fn uninit_mut(&mut self) -> &mut [MaybeUninit<u8>]
    pub unsafe fn as_mut(&mut self) -> &mut [MaybeUninit<u8>]
    pub unsafe fn advance(&mut self, n: usize) -> &mut Self
    pub fn ensure_init(&mut self) -> &mut Self
    pub unsafe fn set_init(&mut self, n: usize) -> &mut Self
    pub fn append(&mut self, buf: &[u8])
}
```

## TODO

* ~~Migrate non-unix libs and tests~~
* ~~Naming~~
  * ~~`BorrowBuf` or `BorrowedBuf` or `SliceBuf`? (We might want an owned equivalent for the async IO traits)~~
  * ~~Should we rename the `readbuf` module? We might keep the name indicate it includes both the buf and cursor variations and someday the owned version too. Or we could change it. It is not publicly exposed, so it is not that important~~.
  * ~~`read_buf` method: we read into the cursor now, so the `_buf` suffix is a bit weird.~~
* ~~Documentation~~
* Tests are incomplete (I adjusted existing tests, but did not add new ones).

cc https://github.com/rust-lang/rust/issues/78485, https://github.com/rust-lang/rust/issues/94741
supersedes: https://github.com/rust-lang/rust/pull/95770, https://github.com/rust-lang/rust/pull/93359
fixes #93305

22 months agoAuto merge of #100863 - ehuss:sunset-rls, r=Mark-Simulacrum
bors [Sun, 28 Aug 2022 07:04:21 +0000 (07:04 +0000)]
Auto merge of #100863 - ehuss:sunset-rls, r=Mark-Simulacrum

Sunset RLS

This removes RLS per the plan outlined in https://blog.rust-lang.org/2022/07/01/RLS-deprecation.html. This replaces the `rls` executable with a small program which will display an alert telling the user that RLS is no longer available.

An overview of the changes here:
* Removes the rls submodule and replaces it with a small stub program.
* `rls` is removed from `./x.py install`. I do not think users running `install` will need the stub.
* `rls` is removed from `./x.py test`, it doesn't have any tests.

Other things of note:
* I kept `DIST_REQUIRE_ALL_TOOLS` even though it is no longer needed, with the thought that it could be useful in the feature. However, I could remove it if desired.
* I kept `extra_deps` in `tool_extended` (which allows tools to depend on other things), even though it is no longer needed. This can also be removed if desired.
* ~~This keeps RLS in the macOS `pkg` installer and the Windows `msi` installer. I kinda lean towards removing it from those, but I'm not sure?~~ RLS has been removed from pkg and msi.
* This does not remove the analysis component. It is not clear if we should keep this or not. RLS was the primary user, but I think there are a few users that have made tools around it.
* There will be several followup steps after this PR:
    * Updating the toolstate repo to remove RLS.
    * Updating documentation, such as rustc-dev-guide, to remove references to RLS.

The alert looks like this in VSCode:

<img width="989" alt="image" src="https://user-images.githubusercontent.com/43198/185817530-930c5842-24b5-4162-a213-016a25810955.png">

In Sublime it looks similar.

I would appreciate if others could help test with other editors such as vim or Emacs.

22 months agoRemove RLS from macOS pkg and Windows msi installers.
Eric Huss [Tue, 23 Aug 2022 16:54:32 +0000 (09:54 -0700)]
Remove RLS from macOS pkg and Windows msi installers.

These generally aren't used too much, and I feel like aren't really
helpful for installing the RLS stub.

22 months agoSunset RLS
Eric Huss [Sun, 21 Aug 2022 04:19:43 +0000 (21:19 -0700)]
Sunset RLS

22 months agoAuto merge of #92845 - Amanieu:std_personality, r=Mark-Simulacrum
bors [Sun, 28 Aug 2022 04:16:29 +0000 (04:16 +0000)]
Auto merge of #92845 - Amanieu:std_personality, r=Mark-Simulacrum

Move EH personality functions to std

These were previously in the panic_unwind crate with dummy stubs in the
panic_abort crate. However it turns out that this is insufficient: we
still need a proper personality function even with -C panic=abort to
handle the following cases:

1) `extern "C-unwind"` still needs to catch foreign exceptions with -C
panic=abort to turn them into aborts. This requires landing pads and a
personality function.

2) ARM EHABI uses the personality function when creating backtraces.
The dummy personality function in panic_abort was causing backtrace
generation to get stuck in a loop since the personality function is
responsible for advancing the unwind state to the next frame.

Fixes #41004

22 months agoAuto merge of #96946 - WaffleLapkin:ptr_mask, r=scottmcm
bors [Sun, 28 Aug 2022 01:34:47 +0000 (01:34 +0000)]
Auto merge of #96946 - WaffleLapkin:ptr_mask, r=scottmcm

Add pointer masking convenience functions

This PR adds the following public API:
```rust
impl<T: ?Sized> *const T {
    fn mask(self, mask: usize) -> *const T;
}

impl<T: ?Sized> *mut T {
    fn mask(self, mask: usize) -> *const T;
}

// mod intrinsics
fn mask<T>(ptr: *const T, mask: usize) -> *const T
```
This is equivalent to `ptr.map_addr(|a| a & mask)` but also uses a cool llvm intrinsic.

Proposed in https://github.com/rust-lang/rust/pull/95643#issuecomment-1121562352

cc `@Gankra` `@scottmcm` `@RalfJung`

r? rust-lang/libs-api

22 months agounstable-book-gen: use std::fs::write
est31 [Sat, 27 Aug 2022 15:32:04 +0000 (17:32 +0200)]
unstable-book-gen: use std::fs::write

I wrote this code in 2017 back when std::fs::write wasn't available.
Also, use the t macro from tidy.

22 months agoFix handling of rust_eh_personality in reachable_non_generics
Amanieu d'Antras [Sat, 27 Aug 2022 22:38:01 +0000 (06:38 +0800)]
Fix handling of rust_eh_personality in reachable_non_generics

22 months agorustc_middle: Remove `Visibility::Invisible`
Vadim Petrochenkov [Sat, 27 Aug 2022 15:36:57 +0000 (18:36 +0300)]
rustc_middle: Remove `Visibility::Invisible`

22 months agoAuto merge of #100591 - est31:stabilization_placeholder, r=Mark-Simulacrum
bors [Sat, 27 Aug 2022 16:57:19 +0000 (16:57 +0000)]
Auto merge of #100591 - est31:stabilization_placeholder, r=Mark-Simulacrum

Require stabilizations to use a placeholder instead of writing out stabilization version

Implements the idea from [this](https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/libs.20stabilization.20placeholder) zulip stream.

It's a common phenomenon that feature stabilizations don't make it into a particular release, but the version is still inaccurate. Often this is caught in the PR, but it can also require subsequent changes to adjust/correct the version. A list with examples of such PRs is given in #100577, but it's far from complete.

This PR requires stabilization PRs to use the placeholder `CURRENT_RUSTC_VERSION`, enforced via tidy tooling. The PR also adds a tool that replaces the placeholder with the version number. It can be invoked via `./x.py run src/tools/replace-version-placeholder` and is supposed to be ran upon beta branching as well as version bumping and any backports to the beta branch.  I filed PRs to the dev guide and forge to document these changes in the release and stabilization workflows:

* The [dev guide](https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#determining-the-stabilization-version) PR: https://github.com/rust-lang/rustc-dev-guide/pull/1443
* The [std dev guide](https://std-dev-guide.rust-lang.org/) PR: https://github.com/rust-lang/std-dev-guide/pull/43
* The [forge](https://github.com/rust-lang/rust-forge) PR: https://github.com/rust-lang/rust-forge/pull/643

Alternative to #100577 which added checking.

22 months agoextend attrs if local_def_id exists
Takayuki Maeda [Sat, 27 Aug 2022 16:20:26 +0000 (01:20 +0900)]
extend attrs if local_def_id exists

22 months agoAdd replace-version-placeholder tool
est31 [Tue, 23 Aug 2022 20:14:12 +0000 (22:14 +0200)]
Add replace-version-placeholder tool

This tool is to be ran at specific points in the release process to replace
the version place holder made by stabilizations with the version number.

22 months agotidy: move directory traversal utility functions into dedicated module
est31 [Tue, 23 Aug 2022 16:45:29 +0000 (18:45 +0200)]
tidy: move directory traversal utility functions into dedicated module

22 months agoAdjust label break value stabilization version to CURRENT_RUSTC_VERSION
est31 [Sat, 27 Aug 2022 15:35:46 +0000 (17:35 +0200)]
Adjust label break value stabilization version to CURRENT_RUSTC_VERSION

22 months agoAdjust backtrace stabilization version to CURRENT_RUSTC_VERSION
est31 [Mon, 15 Aug 2022 15:35:34 +0000 (17:35 +0200)]
Adjust backtrace stabilization version to CURRENT_RUSTC_VERSION

22 months agoAdjust ptr_const_cast stabilization version to CURRENT_RUSTC_VERSION
est31 [Mon, 15 Aug 2022 15:34:09 +0000 (17:34 +0200)]
Adjust ptr_const_cast stabilization version to CURRENT_RUSTC_VERSION

22 months agoExpand the version placeholder to the current version in stability attribute parsing
est31 [Mon, 15 Aug 2022 15:28:43 +0000 (17:28 +0200)]
Expand the version placeholder to the current version in stability attribute parsing

That way, the current version is shown in rustdoc etc.

22 months agotidy: forbid since values for features that point to the current release or future...
est31 [Mon, 15 Aug 2022 14:57:46 +0000 (16:57 +0200)]
tidy: forbid since values for features that point to the current release or future ones

It's a common phenomenon that feature stabilizations don't make it into
a particular release, but the version is still inaccurate. Often this
leads to subsequent changes to adjust/correct the version.

Instead, require people to put a placeholder that gets replaced during
beta branching time with the current rust version. That way, there is
no chance that an error can be introduced.

Usage of the placeholder is required on the nightly channel, and forbidden
on the stable and beta channels.

22 months agoAuto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3
bors [Sat, 27 Aug 2022 14:00:53 +0000 (14:00 +0000)]
Auto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3

Shrink `FnAbi`

Because they can take up a lot of memory in debug and release builds.

r? `@bjorn3`

22 months agoAuto merge of #100989 - lcnr:implied-bounds-uwu, r=spastorino
bors [Sat, 27 Aug 2022 11:37:06 +0000 (11:37 +0000)]
Auto merge of #100989 - lcnr:implied-bounds-uwu, r=spastorino

no unnormalized types for implied bounds outside borrowck

fixes #100910 - introduced in https://github.com/rust-lang/rust/pull/100676 - by only considering normalized types for wf.

r? types

22 months agoAuto merge of #100946 - jyn514:query-system-3, r=cjgillot
bors [Sat, 27 Aug 2022 08:53:24 +0000 (08:53 +0000)]
Auto merge of #100946 - jyn514:query-system-3, r=cjgillot

Simplify the arguments to macros generated by the `rustc_queries` proc macro

Very small cleanup. Based on https://github.com/rust-lang/rust/pull/100436 which modifies some of the same code.

r? `@cjgillot`

22 months agouse smaller span for suggestions
Takayuki Maeda [Fri, 26 Aug 2022 17:23:21 +0000 (02:23 +0900)]
use smaller span for suggestions

22 months agoAuto merge of #101074 - JohnTitor:rollup-zwznihq, r=JohnTitor
bors [Sat, 27 Aug 2022 06:12:17 +0000 (06:12 +0000)]
Auto merge of #101074 - JohnTitor:rollup-zwznihq, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #96240 (Stabilize `const_ptr_offset_from`.)
 - #99784 (Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by default)
 - #100811 (Fix wrong compiletest filters on Windows)
 - #100924 (Smaller improvements of tidy and the unicode generator)
 - #100953 (Update documentation for `write!` and `writeln!`)
 - #101018 (rustdoc: omit start/end tags for empty item description blocks)
 - #101044 (rustdoc: remove unused CSS for `hidden-by-*-hider`)
 - #101046 (rustdoc: remove incorrect CSS selector `.impl-items table td`)
 - #101057 (Merge implementations of HIR fn_decl and fn_sig.)
 - #101062 (rustdoc: remove empty extern_crates and type="text/javascript" on script)
 - #101063 (Merge duplicated CSS rules)

Failed merges:

 - #101055 (Use smaller span for suggestions)

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

22 months agoRollup merge of #101063 - GuillaumeGomez:merge-duplicated-css, r=notriddle
Yuki Okushi [Sat, 27 Aug 2022 04:14:26 +0000 (13:14 +0900)]
Rollup merge of #101063 - GuillaumeGomez:merge-duplicated-css, r=notriddle

Merge duplicated CSS rules

I used the [stylelint](https://stylelint.io/user-guide/configure) tool to check for duplicated CSS rules in order to merge them.

r? `@notriddle`

22 months agoRollup merge of #101062 - notriddle:notriddle/text-javascript, r=GuillaumeGomez
Yuki Okushi [Sat, 27 Aug 2022 04:14:25 +0000 (13:14 +0900)]
Rollup merge of #101062 - notriddle:notriddle/text-javascript, r=GuillaumeGomez

rustdoc: remove empty extern_crates and type="text/javascript" on script

Like #101023, this removes an attribute with a default value.

22 months agoRollup merge of #101057 - cjgillot:one-fn-sig, r=compiler-errors
Yuki Okushi [Sat, 27 Aug 2022 04:14:24 +0000 (13:14 +0900)]
Rollup merge of #101057 - cjgillot:one-fn-sig, r=compiler-errors

Merge implementations of HIR fn_decl and fn_sig.

22 months agoRollup merge of #101046 - notriddle:notriddle/table-css, r=jsha
Yuki Okushi [Sat, 27 Aug 2022 04:14:23 +0000 (13:14 +0900)]
Rollup merge of #101046 - notriddle:notriddle/table-css, r=jsha

rustdoc: remove incorrect CSS selector `.impl-items table td`

Fixes #100994

This selector was added in c7312fbae4979c6d4fdfbd1f55a71cd47d82a480. The bug can be seen at <https://doc.rust-lang.org/1.27.0/alloc/slice/trait.SliceIndex.html#foreign-impls>.

This rule was added to help with a `<table>` that was used for displaying the function signature [src] lockup. That lockup was changed in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9 to use flexbox instead, leaving this selector unused (at least, for its original purpose).

22 months agoRollup merge of #101044 - notriddle:notriddle/css-hidden-by, r=jsha
Yuki Okushi [Sat, 27 Aug 2022 04:14:22 +0000 (13:14 +0900)]
Rollup merge of #101044 - notriddle:notriddle/css-hidden-by, r=jsha

rustdoc: remove unused CSS for `hidden-by-*-hider`

This CSS seems to have become obsolete with the move to `<details>` tags,
and its corresponding JavaScript was removed in aee054d05d8b795d35c0b448a4b731b6507aa459

22 months agoRollup merge of #101018 - notriddle:notriddle/item-right-docblock-short, r=GuillaumeGomez
Yuki Okushi [Sat, 27 Aug 2022 04:14:21 +0000 (13:14 +0900)]
Rollup merge of #101018 - notriddle:notriddle/item-right-docblock-short, r=GuillaumeGomez

rustdoc: omit start/end tags for empty item description blocks

Related to #100952

This is definitely not a complete solution, but it does shrink keysyms/index.html on smithay from 620K to 516K.

22 months agoRollup merge of #100953 - joshtriplett:write-docs, r=Mark-Simulacrum
Yuki Okushi [Sat, 27 Aug 2022 04:14:20 +0000 (13:14 +0900)]
Rollup merge of #100953 - joshtriplett:write-docs, r=Mark-Simulacrum

Update documentation for `write!` and `writeln!`

https://github.com/rust-lang/rust/pull/37472 added this documentation, but it
needs updating:

- Remove some documentation duplicated between `writeln!` and `write!`
- Update `write!` docs: can now import traits as `_` to avoid conflicts
- Expand example to show how to implement qualified trait names

22 months agoRollup merge of #100924 - est31:closure_to_fn_ptr, r=Mark-Simulacrum
Yuki Okushi [Sat, 27 Aug 2022 04:14:19 +0000 (13:14 +0900)]
Rollup merge of #100924 - est31:closure_to_fn_ptr, r=Mark-Simulacrum

Smaller improvements of tidy and the unicode generator

22 months agoRollup merge of #100811 - czzrr:master, r=Mark-Simulacrum
Yuki Okushi [Sat, 27 Aug 2022 04:14:18 +0000 (13:14 +0900)]
Rollup merge of #100811 - czzrr:master, r=Mark-Simulacrum

Fix wrong compiletest filters on Windows

As discussed in [#79334](https://github.com/rust-lang/rust/issues/79334), when calling e.g.
```
python x.py test src/test/ui/expr/compound-assignment/eval-order.rs
```
on Windows, compiletest passes the filter `expr/compound-assignment/eval-order.rs` to libtest, which instead should be `expr\compound-assignment\eval-order.rs`, as that is the file found when collecting tests. This is what I fixed.

I'm not sure how to organize a test for this. Any suggestions?

22 months agoRollup merge of #99784 - est31:deny_cfg_attr_crate_type_name, r=Mark-Simulacrum
Yuki Okushi [Sat, 27 Aug 2022 04:14:16 +0000 (13:14 +0900)]
Rollup merge of #99784 - est31:deny_cfg_attr_crate_type_name, r=Mark-Simulacrum

Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by default

Turns the forward compatibility lint added by #83744 to deprecate `cfg_attr` usage with `#![crate_type]` and `#![crate_name]` attributes into deny by default. Copying the example from #83744:

```Rust
#![crate_type = "lib"] // remains working
#![cfg_attr(foo, crate_type = "bin")] // will stop working
```

Over 8 months have passed since #83744 was merged so I'd say this gives ample time for people to have been warned, so we can make the warning stronger. No usage was found via grep.app except for one, which was in an unmaintained code base that didn't seem to be used in the open source eco system. The crater run conducted in #83744 also didn't show up anything.

cc #91632 - tracking issue for the lint

22 months agoRollup merge of #96240 - fee1-dead-contrib:stabilize_const_offset_from, r=Mark-Simulacrum
Yuki Okushi [Sat, 27 Aug 2022 04:14:15 +0000 (13:14 +0900)]
Rollup merge of #96240 - fee1-dead-contrib:stabilize_const_offset_from, r=Mark-Simulacrum

Stabilize `const_ptr_offset_from`.

Stabilization has been completed [here](https://github.com/rust-lang/rust/issues/92980#issuecomment-1065644848) with a FCP.

Closes #92980.

22 months agoAuto merge of #100732 - dpaoliello:import_name_type, r=wesleywiser
bors [Sat, 27 Aug 2022 03:19:12 +0000 (03:19 +0000)]
Auto merge of #100732 - dpaoliello:import_name_type, r=wesleywiser

Implementation of import_name_type

Fixes #96534 by implementing https://github.com/rust-lang/compiler-team/issues/525

Symbols that are exported or imported from a binary on 32bit x86 Windows can be named in four separate ways, corresponding to the [import name types](https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-name-type) from the PE-COFF spec. The exporting and importing binaries must use the same name encoding, otherwise mismatches can lead to link failures due to "missing symbols" or to 0xc0000139 (`STATUS_ENTRYPOINT_NOT_FOUND`) errors when the executable/library is loaded. For details, see the comments on the raw-dylib feature's https://github.com/rust-lang/rust/issues/58713. To generate the correct import libraries for these DLLs, therefore, rustc must know the import name type for each `extern` function, and there is currently no way for users to provide this information.

This change adds a new `MetaNameValueStr` key to the `#[link]` attribute called `import_name_type`, and which accepts one of three values: `decorated`, `noprefix`, and `undecorated`.

A single DLL is likely to export all its functions using the same import type name, hence `import_name_type` is a parameter of `#[link]` rather than being its own attribute that is applied per-function. It is possible to have a single DLL that exports different functions using different import name types, but users could express such cases by providing multiple export blocks for the same DLL, each with a different import name type.

Note: there is a fourth import name type defined in the PE-COFF spec, `IMPORT_ORDINAL`. This case is already handled by the `#[link_ordinal]` attribute. While it could be merged into `import_type_name`, that would not make sense as `#[link_ordinal]` provides per-function information (namely the ordinal itself).

Design decisions (these match the MCP linked above):
* For GNU, `decorated` matches the PE Spec and MSVC rather than the default behavior of `dlltool` (i.e., there will be a leading `_` for `stdcall`).
* If `import_name_type` is not present, we will keep our current behavior of matching the environment (MSVC vs GNU) default for decorating.
* Using `import_name_type` on architectures other than 32bit x86 will result in an error.
* Using `import_name_type` with link kinds other than `"raw-dylib"` will result in an error.

22 months agoAuto merge of #101064 - compiler-errors:rollup-fwm5m5f, r=compiler-errors
bors [Sat, 27 Aug 2022 00:38:06 +0000 (00:38 +0000)]
Auto merge of #101064 - compiler-errors:rollup-fwm5m5f, r=compiler-errors

Rollup of 9 pull requests

Successful merges:

 - #100724 (Migrate ast lowering to session diagnostic)
 - #100735 (Migrate `rustc_ty_utils` to `SessionDiagnostic`)
 - #100738 (Diagnostics migr const eval)
 - #100744 (Migrate rustc_mir_dataflow to diagnostic structs)
 - #100776 (Migrate `rustc_lint` errors to `SessionDiagnostic`)
 - #100817 (sugg: suggest the usage of boolean value when there is a typo in the keyword)
 - #100836 (Migrate `rustc_attr` crate diagnostics)
 - #100890 (Migrate rustc_driver to SessionDiagnostic)
 - #100900 (on `region_errors.rs`)

Failed merges:

 - #100831 (Migrate `symbol_mangling` module to new diagnostics structs)

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

22 months agoRollup merge of #100900 - AndyJado:diag-migrate, r=davidtwco
Michael Goulet [Fri, 26 Aug 2022 22:56:30 +0000 (15:56 -0700)]
Rollup merge of #100900 - AndyJado:diag-migrate, r=davidtwco

on `region_errors.rs`

`@rustbot` label +A-translation

22 months agoRollup merge of #100890 - adriantombu:migrate_diagnostic_rustc_driver, r=davidtwco
Michael Goulet [Fri, 26 Aug 2022 22:56:29 +0000 (15:56 -0700)]
Rollup merge of #100890 - adriantombu:migrate_diagnostic_rustc_driver, r=davidtwco

Migrate rustc_driver to SessionDiagnostic

First timer noob here 👋🏽 I'm having a problem understanding how I can retrieve the span, and how to properly construct the error structs to avoid the current compilation errors.

Any help pointing me in the right direction would be much appreciated 🙌🏽

22 months agoRollup merge of #100836 - hampuslidin:migrate-attr-crate-diagnostics, r=davidtwco
Michael Goulet [Fri, 26 Aug 2022 22:56:28 +0000 (15:56 -0700)]
Rollup merge of #100836 - hampuslidin:migrate-attr-crate-diagnostics, r=davidtwco

Migrate `rustc_attr` crate diagnostics

Hi!

This is my first PR to the rustc project, excited to be part of the development! This PR is part of the diagnostics effort, to make diagnostics translatable.

`@rustbot` label +A-translation

22 months agoRollup merge of #100817 - vincenzopalazzo:macros/bool_spelling_sugg, r=davidtwco
Michael Goulet [Fri, 26 Aug 2022 22:56:26 +0000 (15:56 -0700)]
Rollup merge of #100817 - vincenzopalazzo:macros/bool_spelling_sugg, r=davidtwco

sugg: suggest the usage of boolean value when there is a typo in the keyword

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

This adds a new suggestion when there is a well-known typo

With the following program

```rust
fn main() {
    let x = True;
}
```

Now we have the following suggestion

```
error[E0425]: cannot find value `True` in this scope
 --> test.rs:2:13
  |
2 |     let x = True;
  |             ^^^^ not found in this scope
  |
help: you may want to use a bool value instead
  |
2 |     let x = true;
  |             ~~~~

error: aborting due to previous error
```

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
22 months agoRollup merge of #100776 - Rejyr:diagnostic-migration-rustc-lint, r=davidtwco
Michael Goulet [Fri, 26 Aug 2022 22:56:25 +0000 (15:56 -0700)]
Rollup merge of #100776 - Rejyr:diagnostic-migration-rustc-lint, r=davidtwco

Migrate `rustc_lint` errors to `SessionDiagnostic`

Draft PR for migrating `rustc_lint` to `SessionDiagnostic`, as part of the [recent blog post](https://blog.rust-lang.org/inside-rust/2022/08/16/diagnostic-effort.html)

22 months agoRollup merge of #100744 - 5225225:migrate-rustc-mir-dataflow, r=davidtwco
Michael Goulet [Fri, 26 Aug 2022 22:56:24 +0000 (15:56 -0700)]
Rollup merge of #100744 - 5225225:migrate-rustc-mir-dataflow, r=davidtwco

Migrate rustc_mir_dataflow to diagnostic structs

22 months agoRollup merge of #100738 - nidnogg:diagnostics_migr_const_eval, r=davidtwco
Michael Goulet [Fri, 26 Aug 2022 22:56:23 +0000 (15:56 -0700)]
Rollup merge of #100738 - nidnogg:diagnostics_migr_const_eval, r=davidtwco

Diagnostics migr const eval

This PR should eventually contain all diagnostic migrations for the `rustc_const_eval` crate.

r? `@davidtwco`
`@rustbot` label +A-translation

22 months agoRollup merge of #100735 - Facel3ss1:ty-utils-translation, r=davidtwco
Michael Goulet [Fri, 26 Aug 2022 22:56:22 +0000 (15:56 -0700)]
Rollup merge of #100735 - Facel3ss1:ty-utils-translation, r=davidtwco

Migrate `rustc_ty_utils` to `SessionDiagnostic`

I have migrated the `rustc_ty_utils` crate to use `SessionDiagnostic`, motivated by the [recent blog post about the diagnostic translation effort](https://blog.rust-lang.org/inside-rust/2022/08/16/diagnostic-effort.html).

This is my first PR to the Rust repository, so if I have missed anything, or anything needs to be changed, please let me know! 😄

`@rustbot` label +A-translation

22 months agoRollup merge of #100724 - JeanCASPAR:migrate-ast_lowering-to-session-diagnostic,...
Michael Goulet [Fri, 26 Aug 2022 22:56:21 +0000 (15:56 -0700)]
Rollup merge of #100724 - JeanCASPAR:migrate-ast_lowering-to-session-diagnostic, r=davidtwco

Migrate ast lowering to session diagnostic

I migrated the whole rustc_ast_lowering crate to session diagnostic *except* the for the use of `span_fatal` at /compiler/rustc_ast_lowering/src/expr.rs#L1268 because `#[fatal(...)]` is not yet supported (see https://github.com/rust-lang/rust/pull/100694).

22 months agoMerge duplicated CSS rules
Guillaume Gomez [Fri, 26 Aug 2022 22:37:04 +0000 (00:37 +0200)]
Merge duplicated CSS rules

22 months agorustdoc: remove empty extern_crates and type="text/javascript" on script
Michael Howell [Fri, 26 Aug 2022 21:49:06 +0000 (14:49 -0700)]
rustdoc: remove empty extern_crates and type="text/javascript" on script

Like #101023, this removes an attribute with a default value.

22 months agoAuto merge of #100043 - RalfJung:scalar-always-init, r=RalfJung
bors [Fri, 26 Aug 2022 21:50:09 +0000 (21:50 +0000)]
Auto merge of #100043 - RalfJung:scalar-always-init, r=RalfJung

interpret: remove support for uninitialized scalars

With Miri no longer supporting `-Zmiri-allow-uninit-numbers`, we no longer need to support storing uninit data in a `Scalar`. We anyway already only use this representation for types with *initialized* `Scalar` layout (and we have to, due to partial initialization), so let's get rid of the `ScalarMaybeUninit` type entirely.

I tried to stage this into meaningful commits, but the one that changes `read_immediate` to always trigger UB on uninit is the largest chunk of the PR and I don't see how it could be subdivided.

Fixes https://github.com/rust-lang/miri/issues/2187
r? `@oli-obk`

22 months agoMerge implementations of HIR fn_decl and fn_sig.
Camille GILLOT [Mon, 22 Aug 2022 19:23:09 +0000 (21:23 +0200)]
Merge implementations of HIR fn_decl and fn_sig.

22 months agoAuto merge of #101039 - ouz-a:issue-100991, r=compiler-errors
bors [Fri, 26 Aug 2022 18:53:16 +0000 (18:53 +0000)]
Auto merge of #101039 - ouz-a:issue-100991, r=compiler-errors

Don't catch overflow when running with cargo doc

Fixes #100991

r? `@compiler-errors`

22 months agoDon't catch overflow when running with cargo doc
ouz-a [Fri, 26 Aug 2022 12:41:14 +0000 (15:41 +0300)]
Don't catch overflow when running with cargo doc

22 months agoremove now-unused ScalarMaybeUninit
Ralf Jung [Tue, 2 Aug 2022 01:40:29 +0000 (21:40 -0400)]
remove now-unused ScalarMaybeUninit

22 months agomake read_immediate error immediately on uninit, so ImmTy can carry initialized Scalar
Ralf Jung [Mon, 1 Aug 2022 23:05:20 +0000 (19:05 -0400)]
make read_immediate error immediately on uninit, so ImmTy can carry initialized Scalar

22 months agoremove some now-unnecessary parameters from check_bytes
Ralf Jung [Wed, 27 Jul 2022 01:49:34 +0000 (21:49 -0400)]
remove some now-unnecessary parameters from check_bytes

22 months agoremove enforce_number_init machine hook that Miri no longer needs
Ralf Jung [Wed, 27 Jul 2022 01:45:47 +0000 (21:45 -0400)]
remove enforce_number_init machine hook that Miri no longer needs

22 months agofix an outdated machine hook name
Ralf Jung [Wed, 27 Jul 2022 01:43:17 +0000 (21:43 -0400)]
fix an outdated machine hook name

22 months agoImplementation of import_name_type
Daniel Paoliello [Tue, 12 Jul 2022 20:52:35 +0000 (13:52 -0700)]
Implementation of import_name_type

22 months agorustdoc: remove incorrect CSS selector `.impl-items table td`
Michael Howell [Fri, 26 Aug 2022 15:27:31 +0000 (08:27 -0700)]
rustdoc: remove incorrect CSS selector `.impl-items table td`

Fixes #100994

This selector was added in c7312fbae4979c6d4fdfbd1f55a71cd47d82a480.
The bug can be seen at <https://doc.rust-lang.org/1.27.0/alloc/slice/trait.SliceIndex.html#foreign-impls>.

This rule was added to help with a `<table>` that was used for displaying the
function signature [src] lockup. That lockup was changed in
34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9 to use flexbox instead, leaving this
selector unused (at least, for its original purpose).

22 months agoAuto merge of #98051 - davidtwco:split-dwarf-stabilization, r=wesleywiser
bors [Fri, 26 Aug 2022 15:47:26 +0000 (15:47 +0000)]
Auto merge of #98051 - davidtwco:split-dwarf-stabilization, r=wesleywiser

session: stabilize split debuginfo on linux

Stabilize the `-Csplit-debuginfo` flag...

- ...on Linux for all values of the flag. Split DWARF has been implemented for a few months, hasn't had any bug reports and has had some promising benchmarking for incremental debug build performance.
- ..on other platforms for the default value. It doesn't make any sense that `-Csplit-debuginfo=packed` is unstable on Windows MSVC when that's the default behaviour, but keep the other values unstable.

22 months agoadd a test
Ralf Jung [Fri, 26 Aug 2022 15:04:13 +0000 (11:04 -0400)]
add a test

22 months agorustdoc: remove unused CSS for `hidden-by-*-hider`
Michael Howell [Fri, 26 Aug 2022 14:34:55 +0000 (07:34 -0700)]
rustdoc: remove unused CSS for `hidden-by-*-hider`

This CSS seems to have become obsolete with the move to `<details>` tags,
and its corresponding JavaScript was removed in aee054d05d8b795d35c0b448a4b731b6507aa459

22 months agoMigrate rustc_ty_utils to use SessionDiagnostic
Peter Medus [Thu, 18 Aug 2022 23:04:31 +0000 (00:04 +0100)]
Migrate rustc_ty_utils to use SessionDiagnostic

22 months agoAuto merge of #101037 - GuillaumeGomez:rollup-opn6kj1, r=GuillaumeGomez
bors [Fri, 26 Aug 2022 13:05:57 +0000 (13:05 +0000)]
Auto merge of #101037 - GuillaumeGomez:rollup-opn6kj1, r=GuillaumeGomez

Rollup of 8 pull requests

Successful merges:

 - #95005 (BTree: evaluate static type-related check at compile time)
 - #99742 (Add comments about stdout locking)
 - #100128 (Document that `RawWakerVTable` functions must be thread-safe.)
 - #100956 (Reduce right-side DOM size)
 - #101006 (Fix doc cfg on reexports)
 - #101012 (rustdoc: remove unused CSS for `.variants_table`)
 - #101023 (rustdoc: remove `type="text/css"` from stylesheet links)
 - #101031 (Remove unused build dependency)

Failed merges:

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

22 months agono alignment check during interning
Ralf Jung [Fri, 26 Aug 2022 12:08:10 +0000 (08:08 -0400)]
no alignment check during interning

22 months agoRollup merge of #101031 - rust-lang:remove-unused-build-dep, r=bjorn3
Guillaume Gomez [Fri, 26 Aug 2022 12:08:51 +0000 (14:08 +0200)]
Rollup merge of #101031 - rust-lang:remove-unused-build-dep, r=bjorn3

Remove unused build dependency

There is no more `build.rs` so this dependency is unused.

r? `@Dylan-DPC`

22 months agoRollup merge of #101023 - notriddle:notriddle/head-shrink, r=Dylan-DPC
Guillaume Gomez [Fri, 26 Aug 2022 12:08:50 +0000 (14:08 +0200)]
Rollup merge of #101023 - notriddle:notriddle/head-shrink, r=Dylan-DPC

rustdoc: remove `type="text/css"` from stylesheet links

MDN directly recommends this in <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link>, since "CSS is the only stylesheet language used on the web."

22 months agoRollup merge of #101012 - notriddle:notriddle/variants_table, r=jsha
Guillaume Gomez [Fri, 26 Aug 2022 12:08:49 +0000 (14:08 +0200)]
Rollup merge of #101012 - notriddle:notriddle/variants_table, r=jsha

rustdoc: remove unused CSS for `.variants_table`

Continuation of #100938 and #101010. This rule was added to support the old, table-based style for displaying enum variants, which are now displayed using headers and paragraphs.

22 months agoRollup merge of #101006 - GuillaumeGomez:doc-cfg-reexport, r=notriddle
Guillaume Gomez [Fri, 26 Aug 2022 12:08:48 +0000 (14:08 +0200)]
Rollup merge of #101006 - GuillaumeGomez:doc-cfg-reexport, r=notriddle

Fix doc cfg on reexports

Fixes #83428.

The problem was that the newly inlined item cfg propagation was not working since its real parent is different than its current one.

For the implementation, I decided to put it directly into `CfgPropagation` instead of inside `inline.rs` because I thought it would be simpler to maintain and to not forget if new kind of items are added if it's all done in one place.

r? `@notriddle`

22 months agoRollup merge of #100956 - GuillaumeGomez:reduce-rightside-dom-size, r=notriddle
Guillaume Gomez [Fri, 26 Aug 2022 12:08:47 +0000 (14:08 +0200)]
Rollup merge of #100956 - GuillaumeGomez:reduce-rightside-dom-size, r=notriddle

Reduce right-side DOM size

This is another follow-up of https://github.com/rust-lang/rust/pull/100429 but not in code blocks this time.

So the idea is: if there is only one element in the `.rightside` element, there is no need to wrap it, we can just create one node.

On each page, I run this JS: `document.getElementsByTagName('*').length`. Important to note: the bigger the number of elements inside the page, the greater the gain. It also doesn't work very nicely on std docs because there are a lot of version annotations. So with this PR, It allows to get the following results:

| file name | before this PR | with this PR | diff |
|-|-|-|-|
| std/default/trait.Default.html | 2189 | 1331 | 39.2% |
| std/vec/struct.Vec.html | 14073 | 13842 | 1.7% |
| std/fmt/trait.Debug.html | 5313 | 4907 | 7.7% |
| std/ops/trait.Index.html | 642 | 630 | 1.9% |
| gtk4/WidgetExt | 3269 | 3061 | 6.4% |

You can test it [here](https://rustdoc.crud.net/imperio/reduce-rightsize-dom-size/gtk4/prelude/trait.WidgetExt.html).

r? `@notriddle`

22 months agoRollup merge of #100128 - kpreid:waker-doc, r=thomcc
Guillaume Gomez [Fri, 26 Aug 2022 12:08:45 +0000 (14:08 +0200)]
Rollup merge of #100128 - kpreid:waker-doc, r=thomcc

Document that `RawWakerVTable` functions must be thread-safe.

Also add some intra-doc links and more high-level explanation of how `Waker` is used, while I'm here.

Context: https://internals.rust-lang.org/t/thread-safety-of-rawwakervtables/17126

22 months agoRollup merge of #99742 - sigaloid:master, r=thomcc
Guillaume Gomez [Fri, 26 Aug 2022 12:08:44 +0000 (14:08 +0200)]
Rollup merge of #99742 - sigaloid:master, r=thomcc

Add comments about stdout locking

This is the source of some confusion regarding the `println!` macro:
* https://llogiq.github.io/2017/06/01/perf-pitfalls.html#unbuffered-io
* https://news.ycombinator.com/item?id=18794930
* https://reddit.com/r/rust/comments/5puyx2/why_is_println_so_slow/dcua5g5/
* https://reddit.com/r/rust/comments/ab7hsi/comparing_pythagorean_triples_in_c_d_and_rust/ecy7ql8/

In some of these cases it's not the locking behavior where the bottleneck lies, but it's still mentioned as a surprise when, eg, benchmarking a million `println!`'s in a very tight loop.

If there's any stylistic problems please feel free to correct me! This is my first contribution and I want to get it right :crab:

22 months agoRollup merge of #95005 - ssomers:btree_static_assert, r=thomcc
Guillaume Gomez [Fri, 26 Aug 2022 12:08:43 +0000 (14:08 +0200)]
Rollup merge of #95005 - ssomers:btree_static_assert, r=thomcc

BTree: evaluate static type-related check at compile time

`assert`s like the ones replaced here would only go off when you run the right test cases, if the code were ever incorrectly changed such that rhey would trigger. But [inspired on a nice forum question](https://users.rust-lang.org/t/compile-time-const-generic-parameter-check/69202), they can be checked at compile time.

22 months agoAuto merge of #100944 - nnethercote:shrink-thir-Expr, r=cjgillot
bors [Fri, 26 Aug 2022 10:00:27 +0000 (10:00 +0000)]
Auto merge of #100944 - nnethercote:shrink-thir-Expr, r=cjgillot

Shrink `thir::Expr`

r? `@cjgillot`

22 months agoRemove unused build dependency
Guillaume Gomez [Fri, 26 Aug 2022 09:18:48 +0000 (11:18 +0200)]
Remove unused build dependency

22 months agoAuto merge of #100705 - compiler-errors:issue-100620, r=oli-obk
bors [Fri, 26 Aug 2022 06:05:06 +0000 (06:05 +0000)]
Auto merge of #100705 - compiler-errors:issue-100620, r=oli-obk

Avoid reporting overflow in `is_impossible_method`

Fixes #100620

We're evaluating a new predicate in a different param-env than it was checked during typeck, so be more careful about handling overflow errors. Instead of using `FulfillmentCtxt`, using `InferCtxt::evaluate_obligation` by itself will give us back the overflow error, so we can throw it away properly.

This may give us more false-positives, but it doesn't regress the `<HashMap as Iterator>::rev` example that originally motivated adding `is_impossible_method` in the first place.

22 months agorustdoc: remove `type="text/css" from stylesheet links
Michael Howell [Fri, 26 Aug 2022 04:28:20 +0000 (21:28 -0700)]
rustdoc: remove `type="text/css" from stylesheet links

MDN directly recommends this in <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link>,
since "CSS is the only stylesheet language used on the web."

22 months agorustdoc: omit start/end tags for empty item description blocks
Michael Howell [Fri, 26 Aug 2022 00:41:25 +0000 (17:41 -0700)]
rustdoc: omit start/end tags for empty item description blocks

Related to #100952

This is definitely not a complete solution, but it does shrink
keysyms/index.html on smithay from 620K to 516K.

22 months agoAuto merge of #101017 - JohnTitor:rollup-73f2fhb, r=JohnTitor
bors [Fri, 26 Aug 2022 03:23:54 +0000 (03:23 +0000)]
Auto merge of #101017 - JohnTitor:rollup-73f2fhb, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #99064 (distinguish the method and associated function diagnostic information)
 - #99920 (Custom allocator support in `rustc_serialize`)
 - #100034 ( Elaborate all box dereferences in `ElaborateBoxDerefs`)
 - #100076 (make slice::{split_at,split_at_unchecked} const functions)
 - #100604 (Remove unstable Result::into_ok_or_err)
 - #100933 (Reduce code size of `assert_matches_failed`)
 - #100978 (Handle `Err` in `ast::LitKind::to_token_lit`.)
 - #101010 (rustdoc: remove unused CSS for `.multi-column`)

Failed merges:

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

22 months agodiag-mig
AndyJado [Fri, 26 Aug 2022 02:32:59 +0000 (10:32 +0800)]
diag-mig