]> git.lizzy.rs Git - rust.git/log
rust.git
22 months agoRollup merge of #100418 - tbodt:stabilize-backtrace, r=dtolnay
Matthias Krüger [Thu, 11 Aug 2022 20:53:10 +0000 (22:53 +0200)]
Rollup merge of #100418 - tbodt:stabilize-backtrace, r=dtolnay

Add stability attributes to BacktraceStatus variants

Fixes #100399

22 months agoRollup merge of #100392 - nnethercote:simplify-visitors, r=cjgillot
Matthias Krüger [Thu, 11 Aug 2022 20:53:08 +0000 (22:53 +0200)]
Rollup merge of #100392 - nnethercote:simplify-visitors, r=cjgillot

Simplify visitors

By removing some unused arguments.

r? `@cjgillot`

22 months agoRollup merge of #100374 - GuillaumeGomez:improve_rustdoc_search_results_page_crates_s...
Matthias Krüger [Thu, 11 Aug 2022 20:53:07 +0000 (22:53 +0200)]
Rollup merge of #100374 - GuillaumeGomez:improve_rustdoc_search_results_page_crates_selection, r=notriddle

Improve crate selection on rustdoc search results page

Take over of #98855 (screenshots and explanations are there).

You can test it [here](https://rustdoc.crud.net/imperio/improve_rustdoc_search_results_page_crates_selection/std/index.html?search=test).

cc ``@steffahn`` ``@jsha``
r? ``@notriddle``

22 months agoRollup merge of #100350 - jhpratt:stringify-vis, r=cjgillot
Matthias Krüger [Thu, 11 Aug 2022 20:53:06 +0000 (22:53 +0200)]
Rollup merge of #100350 - jhpratt:stringify-vis, r=cjgillot

Stringify non-shorthand visibility correctly

This makes `stringify!(pub(in crate))` evaluate to `pub(in crate)` rather than `pub(crate)`, matching the behavior before the `crate` shorthand was removed. Further, this changes `stringify!(pub(in super))` to evaluate to `pub(in super)` rather than the current `pub(super)`. If the latter is not desired (it is _technically_ breaking), it can be undone.

Fixes #99981

`@rustbot` label +C-bug +regression-from-stable-to-beta +T-compiler

22 months agoRollup merge of #100307 - nnethercote:fix-96847, r=cjgillot
Matthias Krüger [Thu, 11 Aug 2022 20:53:05 +0000 (22:53 +0200)]
Rollup merge of #100307 - nnethercote:fix-96847, r=cjgillot

Fix #96847

r? `@petrochenkov`

22 months agoRollup merge of #100203 - compiler-errors:command-args-size-hint, r=m-ou-se
Matthias Krüger [Thu, 11 Aug 2022 20:53:04 +0000 (22:53 +0200)]
Rollup merge of #100203 - compiler-errors:command-args-size-hint, r=m-ou-se

provide correct size hint for unsupported platform `CommandArgs`

Split from https://github.com/rust-lang/rust/pull/99880#discussion_r932994172

22 months agoRollup merge of #100112 - RalfJung:assert_send_and_sync, r=m-ou-se
Matthias Krüger [Thu, 11 Aug 2022 20:53:03 +0000 (22:53 +0200)]
Rollup merge of #100112 - RalfJung:assert_send_and_sync, r=m-ou-se

Fix test: chunks_mut_are_send_and_sync

Follow-up to https://github.com/rust-lang/rust/pull/100023 to make the test actually effective

22 months agoRollup merge of #99992 - jyn514:shell-scripts, r=Mark-Simulacrum
Matthias Krüger [Thu, 11 Aug 2022 20:53:02 +0000 (22:53 +0200)]
Rollup merge of #99992 - jyn514:shell-scripts, r=Mark-Simulacrum

Add `x.sh` and `x.ps1` shell scripts

This is a more ambitious version of https://github.com/rust-lang/rust/pull/98716.
It still changes the x.py shebang back to python3, for compatibility with non-Unix systems,
but also adds alternative entrypoints for systems without `python3` installed.

These scripts will be necessary for the rust entrypoint (#94829), so I see
little downside in adding them early.

I'll update the dev-guide to suggest using these instead of x.py once this is merged.

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

r? `@Mark-Simulacrum` cc `@dtolnay` `@CAD97` `@yoshuawuyts`

22 months agoRollup merge of #99511 - RalfJung:raw_eq, r=wesleywiser
Matthias Krüger [Thu, 11 Aug 2022 20:53:01 +0000 (22:53 +0200)]
Rollup merge of #99511 - RalfJung:raw_eq, r=wesleywiser

make raw_eq precondition more restrictive

Specifically, don't allow comparing pointers that way. Comparing pointers is subtle because you have to talk about what happens to the provenance.

This matches what [Miri already implements](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=9eb1dfb8a61b5a2d4a7cee43df2717af), and all existing users are fine with this.

If raw_eq on pointers is ever desired, we can adjust the intrinsic spec and Miri implementation as needed, but for now that seems just unnecessary. Also, this is a const intrinsic, and in const, comparing pointers this way is *not possible* -- so if we allow the intrinsic to compare pointers in general, we need to impose an extra restrictions saying that in const-context, pointers are *not* okay.

22 months agoRollup merge of #99500 - tmandry:fuchsia-flags, r=petrochenkov
Matthias Krüger [Thu, 11 Aug 2022 20:52:59 +0000 (22:52 +0200)]
Rollup merge of #99500 - tmandry:fuchsia-flags, r=petrochenkov

Fix flags when using clang as linker for Fuchsia

Don't add C runtime or set dynamic linker when linking with clang for
Fuchsia. Clang already does this for us.

22 months agoRollup merge of #99421 - Bryanskiy:android-crt-static, r=petrochenkov
Matthias Krüger [Thu, 11 Aug 2022 20:52:58 +0000 (22:52 +0200)]
Rollup merge of #99421 - Bryanskiy:android-crt-static, r=petrochenkov

add crt-static for android

22 months agoRollup merge of #99337 - jsha:simplify-highlight, r=GuillaumeGomez
Matthias Krüger [Thu, 11 Aug 2022 20:52:57 +0000 (22:52 +0200)]
Rollup merge of #99337 - jsha:simplify-highlight, r=GuillaumeGomez

rustdoc: simplify highlight.rs

Split render_with_highlighting, which took many optional parameters, into three functions for specific purposes, which each take a smaller number of mostly required parameters.

Remove some plumbing to pass through an "edition" parameter, which was used solely to avoid highlighting some 2021 Edition keywords in non-2021 code.

I've tested a build of std docs before and after, and this does not change the generated HTML at all.

Followup from https://github.com/rust-lang/rust/pull/91264#discussion_r901151101

r? ```@GuillaumeGomez```

22 months agoRollup merge of #93896 - jsha:dark-colors, r=GuillaumeGomez
Matthias Krüger [Thu, 11 Aug 2022 20:52:56 +0000 (22:52 +0200)]
Rollup merge of #93896 - jsha:dark-colors, r=GuillaumeGomez

rustdoc: make item-infos dimmer on dark theme

Previously the item-info background colors were too bright for a dark theme, making a bright rectangle that draws the attention.

Demo:

https://rustdoc.crud.net/jsha/dark-colors/std/os/linux/process/struct.PidFd.html
https://rustdoc.crud.net/jsha/dark-colors/std/error/trait.Error.html#method.description

Before:

<img width=300 src="https://user-images.githubusercontent.com/220205/153565049-f35ee83e-181d-491c-b2af-7cce1baa4912.png">

After:

<img width=300 src="https://user-images.githubusercontent.com/220205/181166727-b4218e96-daf1-46cd-a2df-5fd870eaa857.png">

r? `@GuillaumeGomez`

22 months agoAuto merge of #100416 - Dylan-DPC:rollup-m344lh1, r=Dylan-DPC
bors [Thu, 11 Aug 2022 18:05:55 +0000 (18:05 +0000)]
Auto merge of #100416 - Dylan-DPC:rollup-m344lh1, r=Dylan-DPC

Rollup of 11 pull requests

Successful merges:

 - #92744 (Check if enum from foreign crate has any non exhaustive variants when attempting a cast)
 - #99110 (Determine match_has_guard from candidates instead of looking up thir table again)
 - #100184 (Stabilize ptr_const_cast)
 - #100192 ( Remove duplicated temporaries creating during box derefs elaboration)
 - #100232 (Do not consider method call receiver as an argument in AST.)
 - #100287 (linux: Use `pthread_setname_np` instead of `prctl`)
 - #100351 (Use `&mut Diagnostic` instead of `&mut DiagnosticBuilder` unless needed)
 - #100370 (Remove more Clean trait implementations)
 - #100391 (Improve size assertions)
 - #100398 (Improve `-Zhir-stats`)
 - #100403 (Improve error messages when running rustdoc GUI tests)

Failed merges:

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

22 months agoAdd stability attributes to BacktraceStatus variants
Theodore Dubois [Thu, 11 Aug 2022 18:00:07 +0000 (11:00 -0700)]
Add stability attributes to BacktraceStatus variants

Fixes #100399

22 months agoRollup merge of #100403 - GuillaumeGomez:improve-messages, r=jsha
Dylan DPC [Thu, 11 Aug 2022 17:17:07 +0000 (22:47 +0530)]
Rollup merge of #100403 - GuillaumeGomez:improve-messages, r=jsha

Improve error messages when running rustdoc GUI tests

There was already a message on how to install `browser-ui-test`, so nothing to be done there. However, we didn't show how to update its version, so the first commit adds it.

Another pain point was how to fix the unexpected crash in `browser-ui-test` (because of a missing `--no-sandbox`, still no idea why it became mandatory a few months ago on some linux distributions...). It now looks like this:

```console
Running 1 rustdoc-gui (8 concurrently) ...
ERROR: puppeteer failed when trying to create a new page. Please try again with `--no-sandbox`

`browser-ui-test` crashed unexpectedly. Please try again with adding `--test-args --no-sandbox` at the end. For example: `x.py test src/test/rustdoc-gui --test-args --no-sandbox`

Build completed unsuccessfully in 0:00:03
```

Thanks to `@jsha` for suggesting these improvements!

r? `@jsha`

22 months agoRollup merge of #100398 - nnethercote:improve-Zhir-stats, r=michaelwoerister
Dylan DPC [Thu, 11 Aug 2022 17:17:06 +0000 (22:47 +0530)]
Rollup merge of #100398 - nnethercote:improve-Zhir-stats, r=michaelwoerister

Improve `-Zhir-stats`

Add testing, improve coverage, avoid some double counting, and add more detail.

r? `@michaelwoerister`

22 months agoRollup merge of #100391 - nnethercote:improve-size-assertions, r=lqd
Dylan DPC [Thu, 11 Aug 2022 17:17:05 +0000 (22:47 +0530)]
Rollup merge of #100391 - nnethercote:improve-size-assertions, r=lqd

Improve size assertions

r? `@lqd`

22 months agoRollup merge of #100370 - GuillaumeGomez:rm-more-clean-impls, r=Dylan-DPC
Dylan DPC [Thu, 11 Aug 2022 17:17:04 +0000 (22:47 +0530)]
Rollup merge of #100370 - GuillaumeGomez:rm-more-clean-impls, r=Dylan-DPC

Remove more Clean trait implementations

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

r? `@Dylan-DPC`

22 months agoRollup merge of #100351 - compiler-errors:diagnostic-convention, r=fee1-dead
Dylan DPC [Thu, 11 Aug 2022 17:17:03 +0000 (22:47 +0530)]
Rollup merge of #100351 - compiler-errors:diagnostic-convention, r=fee1-dead

Use `&mut Diagnostic` instead of `&mut DiagnosticBuilder` unless needed

This seems to be the established convention (02ff9e0) when `DiagnosticBuilder` was first added. I am guilty of introducing some of these.

22 months agoRollup merge of #100287 - cuviper:no-linux-prctl, r=Mark-Simulacrum
Dylan DPC [Thu, 11 Aug 2022 17:17:02 +0000 (22:47 +0530)]
Rollup merge of #100287 - cuviper:no-linux-prctl, r=Mark-Simulacrum

linux: Use `pthread_setname_np` instead of `prctl`

This function is available on Linux since glibc 2.12, musl 1.1.16, and
uClibc 1.0.20. The main advantage over `prctl` is that it properly
represents the pointer argument, rather than a multi-purpose `long`,
so we're better representing strict provenance (#95496).

22 months agoRollup merge of #100232 - cjgillot:no-desugar-methodcall, r=nagisa
Dylan DPC [Thu, 11 Aug 2022 17:17:01 +0000 (22:47 +0530)]
Rollup merge of #100232 - cjgillot:no-desugar-methodcall, r=nagisa

Do not consider method call receiver as an argument in AST.

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

22 months agoRollup merge of #100192 - tmiasko:rm-duplicated-locals, r=nagisa
Dylan DPC [Thu, 11 Aug 2022 17:16:59 +0000 (22:46 +0530)]
Rollup merge of #100192 - tmiasko:rm-duplicated-locals, r=nagisa

 Remove duplicated temporaries creating during box derefs elaboration

Temporaries created with `MirPatch::new_temp` will be declared after
patch application. Remove manually created duplicate declarations.

Removing duplicates exposes another issue. Visitor elaborates
terminator twice and attempts to access new, but not yet available,
local declarations. Remove duplicated call to `visit_terminator`.

Extracted from #99946.

22 months agoRollup merge of #100184 - Kixunil:stabilize_ptr_const_cast, r=m-ou-se
Dylan DPC [Thu, 11 Aug 2022 17:16:58 +0000 (22:46 +0530)]
Rollup merge of #100184 - Kixunil:stabilize_ptr_const_cast, r=m-ou-se

Stabilize ptr_const_cast

This stabilizes `ptr_const_cast` feature as was decided in a recent
[FCP](https://github.com/rust-lang/rust/issues/92675#issuecomment-1190660233)

Closes #92675

22 months agoRollup merge of #99110 - audunhalland:match_has_guard_from_candidate, r=pnkfelix
Dylan DPC [Thu, 11 Aug 2022 17:16:57 +0000 (22:46 +0530)]
Rollup merge of #99110 - audunhalland:match_has_guard_from_candidate, r=pnkfelix

Determine match_has_guard from candidates instead of looking up thir table again

Currently looking through mir build of matches because of interest in deref patterns. Finding some micro-optimizable things.

22 months agoRollup merge of #92744 - lambinoo:I-91161-non-exhaustive-foreign-variants, r=scottmcm
Dylan DPC [Thu, 11 Aug 2022 17:16:56 +0000 (22:46 +0530)]
Rollup merge of #92744 - lambinoo:I-91161-non-exhaustive-foreign-variants, r=scottmcm

Check if enum from foreign crate has any non exhaustive variants when attempting a cast

Fixes #91161

As stated in the issue, this will require a crater run as it might break other people's stuff.

22 months agomore typos
Ralf Jung [Thu, 11 Aug 2022 11:37:22 +0000 (07:37 -0400)]
more typos

Co-authored-by: Nicholas Nethercote <n.nethercote@gmail.com>
22 months agoImprove error message when browser-ui-test crashes
Guillaume Gomez [Thu, 11 Aug 2022 11:20:18 +0000 (13:20 +0200)]
Improve error message when browser-ui-test crashes

22 months agoAvoid lowering a `MacArgs::Eq` twice.
Nicholas Nethercote [Tue, 9 Aug 2022 05:03:56 +0000 (15:03 +1000)]
Avoid lowering a `MacArgs::Eq` twice.

Fixes #96847.

22 months agoAdd instructions on how to update the browser-ui-test version
Guillaume Gomez [Thu, 11 Aug 2022 11:02:19 +0000 (13:02 +0200)]
Add instructions on how to update the browser-ui-test version

22 months agoAuto merge of #100315 - compiler-errors:norm-ct-in-proj, r=lcnr
bors [Thu, 11 Aug 2022 10:47:48 +0000 (10:47 +0000)]
Auto merge of #100315 - compiler-errors:norm-ct-in-proj, r=lcnr

Keep going if normalized projection has unevaluated consts in `QueryNormalizer`

#100312 was the wrong approach, I think this is the right one.

When normalizing a type, if we see that it's a projection, we currently defer to `tcx.normalize_projection_ty`, which normalizes the projections away but doesn't touch the unevaluated constants. So now we just continue to fold the type if it has unevaluated constants so we make sure to evaluate those too, if we can.

Fixes #100217
Fixes #83972
Fixes #84669
Fixes #86710
Fixes #82268
Fixes #73298

22 months agoAdd a second level to the AST size reporting.
Nicholas Nethercote [Thu, 11 Aug 2022 04:37:21 +0000 (14:37 +1000)]
Add a second level to the AST size reporting.

This tells you which variants of the enums are most common, which is
very useful. I've only done it for the AST for now, HIR can be done
later.

22 months agoAdd percentages to `-Zhir-stats` output.
Nicholas Nethercote [Thu, 11 Aug 2022 03:46:26 +0000 (13:46 +1000)]
Add percentages to `-Zhir-stats` output.

22 months agoChange how `AssocItem` is reported.
Nicholas Nethercote [Thu, 11 Aug 2022 02:34:52 +0000 (12:34 +1000)]
Change how `AssocItem` is reported.

Currently it's reported as either `TraitItem` or `ImplItem`. This commit
changes it to `AssocItem`, because having the report match the type name
is (a) consistent with other types, and (b) the trait/impl split isn't
that important here.

22 months agoImprove AST stat collector.
Nicholas Nethercote [Thu, 11 Aug 2022 02:18:21 +0000 (12:18 +1000)]
Improve AST stat collector.

This commit:
- Adds a comment explaining which `visit_*` methods should be
  implemented.
- Adds and removes some `visit_*` methods accordingly, improving
  coverage, and avoiding some double counting.

22 months agoAuto merge of #100298 - BlackHoleFox:hashmap_keygen_cleanup, r=Mark-Simulacrum
bors [Thu, 11 Aug 2022 02:46:32 +0000 (02:46 +0000)]
Auto merge of #100298 - BlackHoleFox:hashmap_keygen_cleanup, r=Mark-Simulacrum

Replace pointer casting in hashmap_random_keys with safe code

The old code was unnecessarily unsafe and relied on the layout of tuples always being the same as an array of the same size (which might be bad with `-Z randomize-layout`)?

The replacement has [identical codegen](https://rust.godbolt.org/z/qxsvdb8nx), so it seems like a reasonable change.

22 months agoAdd a test for `-Zhir-stats` output.
Nicholas Nethercote [Thu, 11 Aug 2022 00:11:13 +0000 (10:11 +1000)]
Add a test for `-Zhir-stats` output.

This will be very useful in subsequent commits where I will improve the
output.

22 months agoSimplify `rustc_hir::intravisit::Visitor::visit_enum_def`.
Nicholas Nethercote [Thu, 11 Aug 2022 01:07:34 +0000 (11:07 +1000)]
Simplify `rustc_hir::intravisit::Visitor::visit_enum_def`.

It is passed an argument that is never used.

22 months agoSimplify `rustc_ast::visit::Visitor::visit_poly_trait_ref`.
Nicholas Nethercote [Thu, 11 Aug 2022 01:05:26 +0000 (11:05 +1000)]
Simplify `rustc_ast::visit::Visitor::visit_poly_trait_ref`.

It is passed an argument that is never used.

22 months agoSimplify `rustc_ast::visit::Visitor::visit_enum_def`.
Nicholas Nethercote [Wed, 10 Aug 2022 02:02:48 +0000 (12:02 +1000)]
Simplify `rustc_ast::visit::Visitor::visit_enum_def`.

It's passed three arguments that are never used.

22 months agoSimplify `rustc_hir::intravisit::Visitor::visit_variant_data`.
Nicholas Nethercote [Wed, 10 Aug 2022 01:22:01 +0000 (11:22 +1000)]
Simplify `rustc_hir::intravisit::Visitor::visit_variant_data`.

It has four arguments that are never used. This avoids lots of argument
passing in functions that feed into `visit_variant_data`.

22 months agoAuto merge of #99174 - scottmcm:reoptimize-layout-array, r=joshtriplett
bors [Wed, 10 Aug 2022 23:50:18 +0000 (23:50 +0000)]
Auto merge of #99174 - scottmcm:reoptimize-layout-array, r=joshtriplett

Reoptimize layout array

This way it's one check instead of two, so hopefully (cc #99117) it'll be simpler for rustc perf too 🤞

Quick demonstration:
```rust
pub fn demo(n: usize) -> Option<Layout> {
    Layout::array::<i32>(n).ok()
}
```

Nightly: <https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=e97bf33508aa03f38968101cdeb5322d>
```nasm
mov rax, rdi
mov ecx, 4
mul rcx
seto cl
movabs rdx, 9223372036854775805
xor esi, esi
cmp rax, rdx
setb sil
shl rsi, 2
xor edx, edx
test cl, cl
cmove rdx, rsi
ret
```

This PR (note no `mul`, in addition to being much shorter):
```nasm
xor edx, edx
lea rax, [4*rcx]
shr rcx, 61
sete dl
shl rdx, 2
ret
```

This is built atop `@CAD97` 's #99136; the new changes are cb8aba66ef6a0e17f08a0574e4820653e31b45a0.

I added a bunch more tests for `Layout::from_size_align` and `Layout::array` too.

22 months agoFix flags when using clang as linker for Fuchsia
Tyler Mandry [Wed, 20 Jul 2022 09:30:29 +0000 (02:30 -0700)]
Fix flags when using clang as linker for Fuchsia

Don't add C runtime or set dynamic linker when linking with clang for
Fuchsia. Clang already does this for us.

22 months agoAuto merge of #100385 - RalfJung:miri, r=RalfJung
bors [Wed, 10 Aug 2022 20:52:35 +0000 (20:52 +0000)]
Auto merge of #100385 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/100361
r? `@ghost`

22 months agogrammar
Ralf Jung [Wed, 10 Aug 2022 20:15:21 +0000 (16:15 -0400)]
grammar

Co-authored-by: Frank Steffahn <fdsteffahn@gmail.com>
22 months agoupdate Miri
Ralf Jung [Wed, 10 Aug 2022 18:17:48 +0000 (14:17 -0400)]
update Miri

22 months agoAuto merge of #100378 - compiler-errors:rollup-8vzsd92, r=compiler-errors
bors [Wed, 10 Aug 2022 18:05:34 +0000 (18:05 +0000)]
Auto merge of #100378 - compiler-errors:rollup-8vzsd92, r=compiler-errors

Rollup of 8 pull requests

Successful merges:

 - #100286 (Add support for link-flavor rust-lld for macOS)
 - #100317 (Remove logic related to deprecated nvptx-nvidia-cuda (32-bit) target)
 - #100339 (Fixes bootstrap panic when running x fmt --check )
 - #100348 (Add regression test for #93205)
 - #100349 (Refactor: remove a type string comparison)
 - #100353 (Fix doc links in core::time::Duration::as_secs)
 - #100359 (Special-case references to leafs in valtree pretty-printing)
 - #100371 (Inline CStr::from_bytes_with_nul_unchecked::rt_impl)

Failed merges:

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

22 months agoUpdate error message to clarify that it's not the enum itself that's non_exhaustive
Scott McMurray [Wed, 10 Aug 2022 17:02:03 +0000 (10:02 -0700)]
Update error message to clarify that it's not the enum itself that's non_exhaustive

22 months agoCheck if extern crate enum has non exhaustive variant when cast
Lamb [Mon, 10 Jan 2022 21:01:23 +0000 (21:01 +0000)]
Check if extern crate enum has non exhaustive variant when cast

22 months agoadd crt-static for android
Bryanskiy [Sat, 16 Jul 2022 16:33:54 +0000 (19:33 +0300)]
add crt-static for android

22 months agoAdapt ui-fulldeps test.
Camille GILLOT [Sun, 7 Aug 2022 15:36:00 +0000 (17:36 +0200)]
Adapt ui-fulldeps test.

22 months agoDo not consider method call receiver as an argument in AST.
Camille GILLOT [Sun, 7 Aug 2022 13:21:11 +0000 (15:21 +0200)]
Do not consider method call receiver as an argument in AST.

22 months agoRollup merge of #100371 - xfix:inline-from-bytes-with-nul-unchecked-rt-impl, r=scottmcm
Michael Goulet [Wed, 10 Aug 2022 16:28:25 +0000 (09:28 -0700)]
Rollup merge of #100371 - xfix:inline-from-bytes-with-nul-unchecked-rt-impl, r=scottmcm

Inline CStr::from_bytes_with_nul_unchecked::rt_impl

Currently `CStr::from_bytes_with_nul_unchecked::rt_impl` is not being inlined. The following function:

```rust
pub unsafe fn from_bytes_with_nul_unchecked(bytes: &[u8]) {
    CStr::from_bytes_with_nul_unchecked(bytes);
}
```

Outputs the following assembly on current nightly

```asm
example::from_bytes_with_nul_unchecked:
        jmp     qword ptr [rip + _ZN4core3ffi5c_str4CStr29from_bytes_with_nul_unchecked7rt_impl17h026f29f3d6a41333E@GOTPCREL]
```

Meanwhile on beta this provides the following assembly:

```asm
example::from_bytes_with_nul_unchecked:
        ret
```

This pull request adds `#[inline]` annotation to`rt_impl` to fix a code generation regression for `CStr::from_bytes_with_nul_unchecked`.

22 months agoRollup merge of #100359 - b-naber:valtrees-pretty-print-ice, r=lcnr
Michael Goulet [Wed, 10 Aug 2022 16:28:24 +0000 (09:28 -0700)]
Rollup merge of #100359 - b-naber:valtrees-pretty-print-ice, r=lcnr

Special-case references to leafs in valtree pretty-printing

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

22 months agoRollup merge of #100353 - theli-ua:master, r=joshtriplett
Michael Goulet [Wed, 10 Aug 2022 16:28:23 +0000 (09:28 -0700)]
Rollup merge of #100353 - theli-ua:master, r=joshtriplett

Fix doc links in core::time::Duration::as_secs

22 months agoRollup merge of #100349 - TaKO8Ki:remove-type-string-comparison, r=lcnr
Michael Goulet [Wed, 10 Aug 2022 16:28:22 +0000 (09:28 -0700)]
Rollup merge of #100349 - TaKO8Ki:remove-type-string-comparison, r=lcnr

Refactor: remove a type string comparison

22 months agoRollup merge of #100348 - camelid:test-93205, r=jyn514
Michael Goulet [Wed, 10 Aug 2022 16:28:21 +0000 (09:28 -0700)]
Rollup merge of #100348 - camelid:test-93205, r=jyn514

Add regression test for #93205

Closes #93205.

This issue was most likely fixed by #93805.

22 months agoRollup merge of #100339 - shourya5:issue#100258, r=jyn514
Michael Goulet [Wed, 10 Aug 2022 16:28:20 +0000 (09:28 -0700)]
Rollup merge of #100339 - shourya5:issue#100258, r=jyn514

Fixes bootstrap panic when running x fmt --check

closes #100258 wherein bootstrap panics when running x fmt --check. Fixed by replacing resume_unwind  in #98994. with process::exit.

22 months agoRollup merge of #100317 - kjetilkjeka:remove-nvptx32-logic, r=eddyb
Michael Goulet [Wed, 10 Aug 2022 16:28:19 +0000 (09:28 -0700)]
Rollup merge of #100317 - kjetilkjeka:remove-nvptx32-logic, r=eddyb

Remove logic related to deprecated nvptx-nvidia-cuda (32-bit) target

As described in the MCP https://github.com/rust-lang/compiler-team/issues/496#issuecomment-1196328748

r? ``@eddyb``

22 months agoRollup merge of #100286 - Thog:rust-lld-macosx-target, r=petrochenkov
Michael Goulet [Wed, 10 Aug 2022 16:28:18 +0000 (09:28 -0700)]
Rollup merge of #100286 - Thog:rust-lld-macosx-target, r=petrochenkov

Add support for link-flavor rust-lld for macOS

Also refactor iOS, watchOS and tvOS common code.

The ``-arch`` argument was moved to the ``apple_base`` module instead of the target definitions for macOS.
As ld64 requires ``-syslibroot`` to be passed, ``add_apple_sdk`` was modified accordingly.

22 months agorustdoc: make item-infos dimmer on dark theme #93896
Jacob Hoffman-Andrews [Wed, 27 Jul 2022 05:11:21 +0000 (22:11 -0700)]
rustdoc: make item-infos dimmer on dark theme #93896

Previously the item-info background colors were too bright for a dark
theme, making a bright rectangle that draws the attention.

22 months agoStabilize ptr_const_cast
Martin Habovstiak [Wed, 10 Aug 2022 15:22:58 +0000 (17:22 +0200)]
Stabilize ptr_const_cast

This stabilizes `ptr_const_cast` feature as was decided in a recent
[FCP](https://github.com/rust-lang/rust/issues/92675#issuecomment-1190660233)

Closes #92675

22 months agoAuto merge of #100260 - ehuss:compiletest-target-cfg, r=Mark-Simulacrum
bors [Wed, 10 Aug 2022 15:22:26 +0000 (15:22 +0000)]
Auto merge of #100260 - ehuss:compiletest-target-cfg, r=Mark-Simulacrum

compiletest: use target cfg instead of hard-coded tables

This changes compiletest to use `rustc --print=cfg` to dynamically determine the properties of a target when matching `ignore` and `only` rules instead of using hard-coded tables or target-triple parsing (which don't always follow the `<arch><sub>-<vendor>-<sys>-<abi>` pattern). The benefit here is that it will more accurately match the target properties, and not require maintaining these extra tables.

This also adds matching the `target_family` in ignore rules. The primary benefit here is so that `ignore-wasm` works as expected (matching all wasm-like targets). There were already several tests that had `ignore-wasm` in them (which previously had no effect), so it is evident that some people expected that to work. This also adds `ignore-unix/only-unix`.

There is some risk that this changes the behavior from before since the tables aren't quite the same as the target properties. However, I did fairly extensive comparisons to see what would be different. https://gist.github.com/ehuss/5bf7ab347605160cefb6f84ba5ea5f6b contains a full list of differences for all targets for all tests. I do not think any of the affected target/test combinations are things that are actually tested in CI. I tested several of the more unusual test images (test-various, dist-various-1, wasm32), and they seem fine.

A summary of most of the reasons behind the differences:

- wasm64-unknown-unknown wasm32-wasi now match "wasm"
- Targets now match "gnu" because they have target_env=gnu
    - aarch64-wrs-vxworks
    - armv7-wrs-vxworks-eabihf
    - i686-wrs-vxworks
    - powerpc-wrs-vxworks
    - powerpc64-wrs-vxworks
    - x86_64-wrs-vxworks
- wasm64-unknown-unknown now matches wasm64
- x86_64-unknown-none-linuxkernel no longer matches "linux", but will match "gnu" and "none"
- Various arm targets now match "aarch64" or "arm":
    - arm64_32-apple-watchos
    - armebv7r-none-eabi
    - armv6-unknown-freebsd
    - armv6-unknown-netbsd-eabihf
    - armv6k-nintendo-3ds
    - armv7-wrs-vxworks-eabihf
    - armv7a-kmc-solid_asp3-eabi
    - armv7a-kmc-solid_asp3-eabihf
    - armv7a-none-eabi
    - armv7a-none-eabihf
    - armv7k-apple-watchos
    - armv7r-none-eabi
    - armv7r-none-eabihf
- Now matches "thumb" and "arm"
    - thumbv4t-none-eabi
    - thumbv6m-none-eabi
    - thumbv7a-pc-windows-msvc
    - thumbv7a-uwp-windows-msvc
    - thumbv7em-none-eabi
    - thumbv7em-none-eabihf
    - thumbv7m-none-eabi
    - thumbv7neon-linux-androideabi
    - thumbv7neon-unknown-linux-gnueabihf
    - thumbv7neon-unknown-linux-musleabihf
    - thumbv8m.base-none-eabi
    - thumbv8m.main-none-eabi
- asmjs-unknown-emscripten now matches "wasm32" because that it is its defined arch
- avr-unknown-gnu-atmega328 now matches "none" (because target_os="none")
- now matches 64bit:
    - bpfeb-unknown-none
    - bpfel-unknown-none
    - sparcv9-sun-solaris
- now matches endian-big:
    - m68k-unknown-linux-gnu
- now matches 16bit:
    - msp430-none-elf
- now matches 32bit:
    - arm64_32-apple-watchos
- now matches riscv32 (and needs-asm-support):
    - riscv32gc-unknown-linux-gnu
    - riscv32gc-unknown-linux-musl
    - riscv32i-unknown-none-elf
    - riscv32im-unknown-none-elf
    - riscv32imac-unknown-none-elf
    - riscv32imac-unknown-xous-elf
    - riscv32imc-esp-espidf
    - riscv32imc-unknown-none-elf
    - riscv64imac-unknown-none-elf

22 months agoUpdate GUI test
Guillaume Gomez [Wed, 10 Aug 2022 13:50:20 +0000 (15:50 +0200)]
Update GUI test

22 months agoAdd missing ID into the ID map
Guillaume Gomez [Wed, 10 Aug 2022 13:37:18 +0000 (15:37 +0200)]
Add missing ID into the ID map

22 months agoTwo small improvements:
Frank Steffahn [Mon, 11 Jul 2022 19:52:26 +0000 (21:52 +0200)]
Two small improvements:

Fix oversight duplicate property left in CSS (dark theme).

Improve wording in comment that mentions `appearance: none`

22 months agoImprove crate selection on rustdoc search results page
Frank Steffahn [Sun, 3 Jul 2022 18:10:19 +0000 (20:10 +0200)]
Improve crate selection on rustdoc search results page

Resolves all of issue #93240

Reproduces a similar change as #99086, but with improvements

In particular, this PR inlcludes:
* redesigning the crate-search selector so the background color matches its surroundings
* decrease the font of the dropdown menu to a reaonable size
* add a hover effect
* make the color of the arrow theme-dependent, using a surrounding div, with :after pseudo-element
  that can then be transformed using CSS filters to approximate the desired color
* fix the text "in" to match the title font
* remove the "for xyz" in the "Results for xyz in [All crates]" title when
  searching for search term "xyz"; you can already see what you're searching for
  as it's typed in the search bar!
* in line with #99086, handle super-long crate names appropriately without a long <select>
  element escaping the screen area; the improvement is that we also keep the title
  within a single line now; uses some flex layout shenanigans...
* the margins / paddings are adjusted so the selected label of the <select> fits within
  the rest of that title nicely; also some inconsistency in the way that Firefox renders
  a <select> with "appearance: none" (roughly 4px more padding left and right of the text
  than e.g. Chrome) is worked around, and it now produces a result that looks (essentially)
  identical to Chrome
* the color of the help menu and settings menu border in light theme is made to match with
  the color of the corresponding buttons, like they do (match) in the ayu theme
* the casing of "All crates" changes to "all crates"
* the new tests from #99086 are temporarily disabled, until they can be adapted later

22 months agoremove Clean trait implementation for hir::GenericArgs
Guillaume Gomez [Wed, 10 Aug 2022 12:46:18 +0000 (14:46 +0200)]
remove Clean trait implementation for hir::GenericArgs

22 months agoremove Clean trait implementation for ty::AssocItem
Guillaume Gomez [Wed, 10 Aug 2022 12:40:18 +0000 (14:40 +0200)]
remove Clean trait implementation for ty::AssocItem

22 months agoInline CStr::from_bytes_with_nul_unchecked::rt_impl
Konrad Borowski [Wed, 10 Aug 2022 12:21:17 +0000 (12:21 +0000)]
Inline CStr::from_bytes_with_nul_unchecked::rt_impl

22 months agoadd test
b-naber [Wed, 10 Aug 2022 07:58:53 +0000 (09:58 +0200)]
add test

22 months agoAuto merge of #100356 - matthiaskrgr:rollup-he0vkjc, r=matthiaskrgr
bors [Wed, 10 Aug 2022 06:09:10 +0000 (06:09 +0000)]
Auto merge of #100356 - matthiaskrgr:rollup-he0vkjc, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #99573 (Stabilize backtrace)
 - #100069 (Add error if link_ordinal used with unsupported link kind)
 - #100086 (Add more `// unit-test`s to MIR opt tests)
 - #100332 (Rename integer log* methods to ilog*)
 - #100334 (Suggest a missing semicolon before an array)
 - #100340 (Iterate generics_def_id_map in reverse order to fix P-critical issue)
 - #100345 (docs: remove repetition in `is_numeric` function docs)
 - #100352 (Update cargo)

Failed merges:

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

22 months agoRollup merge of #100352 - ehuss:update-cargo, r=ehuss
Matthias Krüger [Wed, 10 Aug 2022 05:21:40 +0000 (07:21 +0200)]
Rollup merge of #100352 - ehuss:update-cargo, r=ehuss

Update cargo

7 commits in 4fd148c47e733770c537efac5220744945d572ef..ce40690a5e4e315d3dab0aae1eae69d0252c52ac
2022-08-03 15:03:52 +0000 to 2022-08-09 22:32:17 +0000
- Make the `rust-version` error recommend `cargo update --precise -p crate@ver` (rust-lang/cargo#10891)
- resolver docs: link to version requirements syntax full explanation (rust-lang/cargo#10946)
- Bump os_info to 3.5.0 (rust-lang/cargo#10943)
- Mark --timings=html unstable in the document (rust-lang/cargo#10941)
- Mention that aliases are recursive (rust-lang/cargo#10935)
- Test if reserved filenames are allowed in Windows (rust-lang/cargo#10322)
- improve error message for `no such subcommand` (rust-lang/cargo#10924)

22 months agoUpdate cargo
Eric Huss [Wed, 10 Aug 2022 11:07:57 +0000 (04:07 -0700)]
Update cargo

22 months agoRollup merge of #100345 - vincenzopalazzo:macros/is_number_doc, r=joshtriplett
Matthias Krüger [Wed, 10 Aug 2022 05:21:39 +0000 (07:21 +0200)]
Rollup merge of #100345 - vincenzopalazzo:macros/is_number_doc, r=joshtriplett

docs: remove repetition in `is_numeric` function docs

In https://github.com/rust-lang/rust/pull/99628 we introduce new docs for the `is_numeric` function, and this is a follow-up PR that removes some unnecessary repetition that may be introduced by some rebasing.

`@rustbot` r? `@joshtriplett`

22 months agoRollup merge of #100340 - spastorino:fix-100187, r=compiler-errors
Matthias Krüger [Wed, 10 Aug 2022 05:21:38 +0000 (07:21 +0200)]
Rollup merge of #100340 - spastorino:fix-100187, r=compiler-errors

Iterate generics_def_id_map in reverse order to fix P-critical issue

Closes #100187

Fixes a `P-critical` beta regression.

22 months agoRollup merge of #100334 - TaKO8Ki:suggest-missing-semicolon-before-array, r=fee1...
Matthias Krüger [Wed, 10 Aug 2022 05:21:37 +0000 (07:21 +0200)]
Rollup merge of #100334 - TaKO8Ki:suggest-missing-semicolon-before-array, r=fee1-dead

Suggest a missing semicolon before an array

fixes #99658

22 months agoRollup merge of #100332 - eholk:stabilize-ilog, r=scottmcm
Matthias Krüger [Wed, 10 Aug 2022 05:21:36 +0000 (07:21 +0200)]
Rollup merge of #100332 - eholk:stabilize-ilog, r=scottmcm

Rename integer log* methods to ilog*

This reflects the concensus from the libs team as reported at https://github.com/rust-lang/rust/issues/70887#issuecomment-1209513261.

Joint work with `@yoshuawuyts.`

22 months agoRollup merge of #100086 - JakobDegen:better-tests, r=wesleyweiser
Matthias Krüger [Wed, 10 Aug 2022 05:21:35 +0000 (07:21 +0200)]
Rollup merge of #100086 - JakobDegen:better-tests, r=wesleyweiser

Add more `// unit-test`s to MIR opt tests

I only changed things which are hopefully completely uninteresting. I plan to submit more PRs that cover more files, but those cases will need some more complicated (and hence possibly controversial) changes, so I'll try and submit those in reasonably sized batches.

r? rust-lang/wg-mir-opt

22 months agoRollup merge of #100069 - dpaoliello:linkordinal, r=michaelwoerister
Matthias Krüger [Wed, 10 Aug 2022 05:21:34 +0000 (07:21 +0200)]
Rollup merge of #100069 - dpaoliello:linkordinal, r=michaelwoerister

Add error if link_ordinal used with unsupported link kind

The `link_ordinal` attribute only has an affect if the `raw-dylib` link kind is used, so add an error if it is used with any other link kind.

22 months agoRollup merge of #99573 - tbodt:stabilize-backtrace, r=yaahc
Matthias Krüger [Wed, 10 Aug 2022 05:21:33 +0000 (07:21 +0200)]
Rollup merge of #99573 - tbodt:stabilize-backtrace, r=yaahc

Stabilize backtrace

This PR stabilizes the std::backtrace module. As of #99431, the std::Error::backtrace item has been removed, and so the rest of the backtrace feature is set to be stabilized.

Previous discussion can be found in #72981, #3156.

Stabilized API summary:
```rust
pub mod std {
    pub mod backtrace {
        pub struct Backtrace { }
        pub enum BacktraceStatus {
            Unsupported,
            Disabled,
            Captured,
        }
        impl fmt::Debug for Backtrace {}
        impl Backtrace {
            pub fn capture() -> Backtrace;
            pub fn force_capture() -> Backtrace;
            pub const fn disabled() -> Backtrace;
            pub fn status(&self) -> BacktraceStatus;
        }
        impl fmt::Display for Backtrace {}
    }
}
```

`@yaahc`

22 months agoFix failing test
Noah Lev [Wed, 10 Aug 2022 04:13:31 +0000 (21:13 -0700)]
Fix failing test

For some reason, adding some text to match against makes this test pass.
Before, when it was *more* general, it was failing!

This seems very likely to be a bug in htmldocck, which I'm going to
investigate.

22 months agoFix doc links in core::time::Duration::as_secs
Anton Romanov [Wed, 10 Aug 2022 04:15:06 +0000 (21:15 -0700)]
Fix doc links in core::time::Duration::as_secs

22 months agoUse &mut Diagnostic instead of &mut DiagnosticBuilder unless needed
Michael Goulet [Wed, 10 Aug 2022 03:39:41 +0000 (03:39 +0000)]
Use &mut Diagnostic instead of &mut DiagnosticBuilder unless needed

22 months agoStringify non-shorthand visibility correctly
Jacob Pratt [Wed, 10 Aug 2022 03:31:45 +0000 (23:31 -0400)]
Stringify non-shorthand visibility correctly

22 months agoAuto merge of #100346 - matthiaskrgr:rollup-6rljn4p, r=matthiaskrgr
bors [Wed, 10 Aug 2022 03:21:23 +0000 (03:21 +0000)]
Auto merge of #100346 - matthiaskrgr:rollup-6rljn4p, r=matthiaskrgr

Rollup of 14 pull requests

Successful merges:

 - #98775 (rustdoc: improve scroll locking in the rustdoc mobile sidebars)
 - #99479 (rustdoc-json: Remove doc FIXME for Import::id and explain)
 - #100040 (Error on broken pipe but do not backtrace or ICE)
 - #100072 (linker-plugin-lto.md: Correct the name of example c file)
 - #100098 (Some "this expression has a field"-related fixes)
 - #100226 (Do not manually craft a span pointing inside a multibyte character.)
 - #100240 (Fail gracefully when const pattern is not structural match.)
 - #100256 (Add some high-level docs to `FnCtxt` and `ItemCtxt`)
 - #100261 (Set tainted errors bit before emitting coerce suggestions.)
 - #100275 (also update anyhow in codegen_cranelift)
 - #100281 (Remove more Clean trait implementations)
 - #100314 (Mention `unit-test` in MIR opt test README)
 - #100319 (Remove more Clean trait implementations)
 - #100323 ([rustdoc] Don't render impl blocks with doc comment if they only contain private items by default)

Failed merges:

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

22 months agorustdoc: simplify highlight.rs
Jacob Hoffman-Andrews [Sat, 16 Jul 2022 16:07:40 +0000 (09:07 -0700)]
rustdoc: simplify highlight.rs

Split render_with_highlighting, which took many optional parameters, into three
functions for specific purposes, which each take a smaller number of mostly
required parameters.

Remove some plumbing to pass through an "edition" parameter, which was used
solely to avoid highlighting some 2021 Edition keywords in non-2021 code.

22 months agoAdd regression test for #93205
Noah Lev [Tue, 9 Aug 2022 23:08:42 +0000 (16:08 -0700)]
Add regression test for #93205

This issue was most likely fixed by #93805.

22 months agoremove a type string comparison
Takayuki Maeda [Wed, 10 Aug 2022 02:42:46 +0000 (11:42 +0900)]
remove a type string comparison

22 months agoAdd a couple more AST node size assertions.
Nicholas Nethercote [Wed, 10 Aug 2022 00:06:38 +0000 (10:06 +1000)]
Add a couple more AST node size assertions.

22 months agoAvoid repeating qualifiers on `static_assert_size` calls.
Nicholas Nethercote [Tue, 9 Aug 2022 23:47:59 +0000 (09:47 +1000)]
Avoid repeating qualifiers on `static_assert_size` calls.

Some of these don't need a `use` statement because there is already a
`#[macro_use] extern crate rustc_data_structures` item in the crate.

22 months agoAdd more `// unit-test`s to MIR opt tests
Jakob Degen [Wed, 3 Aug 2022 00:44:25 +0000 (17:44 -0700)]
Add more `// unit-test`s to MIR opt tests

22 months agoApply suggestions from code review
Jane Losare-Lusby [Tue, 9 Aug 2022 22:59:53 +0000 (15:59 -0700)]
Apply suggestions from code review

22 months agoRollup merge of #100323 - GuillaumeGomez:impl-blocks-only-private, r=notriddle
Matthias Krüger [Tue, 9 Aug 2022 22:00:37 +0000 (00:00 +0200)]
Rollup merge of #100323 - GuillaumeGomez:impl-blocks-only-private, r=notriddle

[rustdoc] Don't render impl blocks with doc comment if they only contain private items by default

Fixes #100001.

cc `@jhpratt`
r? `@notriddle`

22 months agoRollup merge of #100319 - GuillaumeGomez:rm-clean-impls-2, r=Dylan-DPC
Matthias Krüger [Tue, 9 Aug 2022 22:00:36 +0000 (00:00 +0200)]
Rollup merge of #100319 - GuillaumeGomez:rm-clean-impls-2, r=Dylan-DPC

Remove more Clean trait implementations

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

r? ``@Dylan-DPC``

22 months agoRollup merge of #100314 - JakobDegen:test-docs, r=RalfJung
Matthias Krüger [Tue, 9 Aug 2022 22:00:35 +0000 (00:00 +0200)]
Rollup merge of #100314 - JakobDegen:test-docs, r=RalfJung

Mention `unit-test` in MIR opt test README

r? `@RalfJung`

22 months agoRollup merge of #100281 - GuillaumeGomez:rm-clean-impls-3, r=notriddle
Matthias Krüger [Tue, 9 Aug 2022 22:00:34 +0000 (00:00 +0200)]
Rollup merge of #100281 - GuillaumeGomez:rm-clean-impls-3, r=notriddle

Remove more Clean trait implementations

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

r? `@notriddle`

22 months agoRollup merge of #100275 - RalfJung:anyhow, r=bjorn3
Matthias Krüger [Tue, 9 Aug 2022 22:00:33 +0000 (00:00 +0200)]
Rollup merge of #100275 - RalfJung:anyhow, r=bjorn3

also update anyhow in codegen_cranelift

now that is has been un-yanked
r? ``@bjorn3``

22 months agoRollup merge of #100261 - luqmana:suggestions-overflow, r=lcnr
Matthias Krüger [Tue, 9 Aug 2022 22:00:32 +0000 (00:00 +0200)]
Rollup merge of #100261 - luqmana:suggestions-overflow, r=lcnr

Set tainted errors bit before emitting coerce suggestions.

Fixes #100246.

#89576 basically got 99% of the way there but the match typechecking code (which calls `coerce_inner`) also needed a similar fix.

22 months agoRollup merge of #100256 - camelid:typeck-ctxt-doc, r=compiler-errors
Matthias Krüger [Tue, 9 Aug 2022 22:00:31 +0000 (00:00 +0200)]
Rollup merge of #100256 - camelid:typeck-ctxt-doc, r=compiler-errors

Add some high-level docs to `FnCtxt` and `ItemCtxt`

I haven't understood the difference between these before, but
``@compiler-errors`` helped me clear it up. Hopefully this will help other
people who've been confused!

r? `@compiler-errors`