Commit Graph

197469 Commits

Author SHA1 Message Date
Matthias Krüger
bd64d67d11
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
2022-08-11 22:53:04 +02:00
Matthias Krüger
275d4e779a
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
2022-08-11 22:53:03 +02:00
Matthias Krüger
20f124a193
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`
2022-08-11 22:53:02 +02:00
Matthias Krüger
37efd55210
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.
2022-08-11 22:53:01 +02:00
Matthias Krüger
92b32e307c
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.
2022-08-11 22:52:59 +02:00
Matthias Krüger
6737549aaf
Rollup merge of #99421 - Bryanskiy:android-crt-static, r=petrochenkov
add crt-static for android
2022-08-11 22:52:58 +02:00
Matthias Krüger
9606408688
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```
2022-08-11 22:52:57 +02:00
Matthias Krüger
8bbb54adfc
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`
2022-08-11 22:52:56 +02:00
bors
20ffea6938 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
2022-08-11 18:05:55 +00:00
Theodore Dubois
121fab0396 Add stability attributes to BacktraceStatus variants
Fixes #100399
2022-08-11 11:00:07 -07:00
Philipp Krones
ea90d4bce5
Update Cargo.lock 2022-08-11 19:42:37 +02:00
Philipp Krones
ad76883ff9
Merge commit '2b2190cb5667cdd276a24ef8b9f3692209c54a89' into clippyup 2022-08-11 19:42:16 +02:00
bors
2b2190cb56 Auto merge of #9323 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2022-08-11 17:28:47 +00:00
Philipp Krones
280b527821
Bump Clippy version -> 0.1.65 2022-08-11 19:26:38 +02:00
Philipp Krones
eda0b001e8
Bump nightly version -> 2022-08-11 2022-08-11 19:26:26 +02:00
Philipp Krones
879855bbaf
Merge remote-tracking branch 'upstream/master' into rustup 2022-08-11 19:26:04 +02:00
Dylan DPC
f583bf611d
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`
2022-08-11 22:47:07 +05:30
Dylan DPC
7ecc8923db
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`
2022-08-11 22:47:06 +05:30
Dylan DPC
bc0f9e39f4
Rollup merge of #100391 - nnethercote:improve-size-assertions, r=lqd
Improve size assertions

r? `@lqd`
2022-08-11 22:47:05 +05:30
Dylan DPC
1d09545702
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`
2022-08-11 22:47:04 +05:30
Dylan DPC
b5f5bdce87
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.
2022-08-11 22:47:03 +05:30
Dylan DPC
a5b0f72e71
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).
2022-08-11 22:47:02 +05:30
Dylan DPC
1c43cabdfe
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
2022-08-11 22:47:01 +05:30
Dylan DPC
32bd147f79
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.
2022-08-11 22:46:59 +05:30
Dylan DPC
d749914f79
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
2022-08-11 22:46:58 +05:30
Dylan DPC
561ea0a746
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.
2022-08-11 22:46:57 +05:30
Dylan DPC
dfddc2f918
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.
2022-08-11 22:46:56 +05:30
chenyukang
98518c2379 suggest const or static for global variable 2022-08-11 23:15:39 +08:00
Ralf Jung
b5786dcae6 avoid some int2ptr casts in thread_local_key tests 2022-08-11 09:39:25 -04:00
Ralf Jung
338d7c2fb0
more typos
Co-authored-by: Nicholas Nethercote <n.nethercote@gmail.com>
2022-08-11 07:37:22 -04:00
Guillaume Gomez
46af79c0ab Improve error message when browser-ui-test crashes 2022-08-11 13:20:18 +02:00
Nicholas Nethercote
ce78042a42 Avoid lowering a MacArgs::Eq twice.
Fixes #96847.
2022-08-11 21:06:40 +10:00
Guillaume Gomez
a72f0c2e07 Add instructions on how to update the browser-ui-test version 2022-08-11 13:02:19 +02:00
bors
aeb5067967 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
2022-08-11 10:47:48 +00:00
Nicholas Nethercote
4f8a1702ba 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.
2022-08-11 20:46:41 +10:00
bors
696bee3246 Auto merge of #12997 - Veykril:no-such-field, r=Veykril
fix: Fix panic in `no_such_field` when using tuple fields on record structs
2022-08-11 08:42:04 +00:00
Lukas Wirth
1bb58205f0 Fix panic in no_such_field when using tuple fields on record structs 2022-08-11 10:41:30 +02:00
Josh Stone
bd81c0d80a Allow old toolchain on images with CUSTOM_MINGW 2022-08-10 21:07:13 -07:00
Nicholas Nethercote
85c749266d Add percentages to -Zhir-stats output. 2022-08-11 13:46:26 +10:00
Nicholas Nethercote
6a3c663cbb 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.
2022-08-11 12:46:55 +10:00
Nicholas Nethercote
288b6672be 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.
2022-08-11 12:46:49 +10:00
bors
187654481f 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.
2022-08-11 02:46:32 +00:00
Nicholas Nethercote
bf20777d13 Add a test for -Zhir-stats output.
This will be very useful in subsequent commits where I will improve the
output.
2022-08-11 12:23:06 +10:00
Vincenzo Palazzo
d91dff3c1b promote debug_assert to assert
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-08-11 01:18:45 +00:00
Nicholas Nethercote
b8b851f42e Simplify rustc_hir::intravisit::Visitor::visit_enum_def.
It is passed an argument that is never used.
2022-08-11 11:10:03 +10:00
Nicholas Nethercote
232bd80130 Simplify rustc_ast::visit::Visitor::visit_poly_trait_ref.
It is passed an argument that is never used.
2022-08-11 11:10:01 +10:00
Nicholas Nethercote
421125f30a Simplify rustc_ast::visit::Visitor::visit_enum_def.
It's passed three arguments that are never used.
2022-08-11 10:54:01 +10:00
Nicholas Nethercote
8c5303898e 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`.
2022-08-11 10:54:01 +10:00
bors
908fc5b26d 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.
2022-08-10 23:50:18 +00:00
Tyler Mandry
55d5dcb1aa 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.
2022-08-10 16:35:27 -07:00