Commit Graph

197170 Commits

Author SHA1 Message Date
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
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
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
bors
29e4a9ee02 Auto merge of #100385 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/100361
r? `@ghost`
2022-08-10 20:52:35 +00:00
Ralf Jung
d1cace5a97
grammar
Co-authored-by: Frank Steffahn <fdsteffahn@gmail.com>
2022-08-10 16:15:21 -04:00
Ralf Jung
3ba055fdc5 update Miri 2022-08-10 14:17:48 -04:00
bors
7bc32faebc 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
2022-08-10 18:05:34 +00:00
Scott McMurray
dfb3713cdb Update error message to clarify that it's not the enum itself that's non_exhaustive 2022-08-10 10:02:03 -07:00
Lamb
a3b84ad197 Check if extern crate enum has non exhaustive variant when cast 2022-08-10 09:55:41 -07:00
Bryanskiy
874ee5bede add crt-static for android 2022-08-10 19:42:24 +03:00
Camille GILLOT
69205db766 Adapt ui-fulldeps test. 2022-08-10 18:34:54 +02:00
Camille GILLOT
9701845287 Do not consider method call receiver as an argument in AST. 2022-08-10 18:34:54 +02:00
Camille GILLOT
0df84ae67c Ban indirect references to Self too. 2022-08-10 18:33:06 +02:00
Camille GILLOT
e1e25a845c Generalize trait object generic param check to aliases. 2022-08-10 18:32:08 +02:00
Michael Goulet
eff71b9927
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`.
2022-08-10 09:28:25 -07:00
Michael Goulet
96fc9f177e
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
2022-08-10 09:28:24 -07:00
Michael Goulet
efa182f3db
Rollup merge of #100353 - theli-ua:master, r=joshtriplett
Fix doc links in core::time::Duration::as_secs
2022-08-10 09:28:23 -07:00
Michael Goulet
5459edf8bd
Rollup merge of #100349 - TaKO8Ki:remove-type-string-comparison, r=lcnr
Refactor: remove a type string comparison
2022-08-10 09:28:22 -07:00
Michael Goulet
a6116b9564
Rollup merge of #100348 - camelid:test-93205, r=jyn514
Add regression test for #93205

Closes #93205.

This issue was most likely fixed by #93805.
2022-08-10 09:28:21 -07:00
Michael Goulet
f0fdc464be
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.
2022-08-10 09:28:20 -07:00
Michael Goulet
eae824d5bb
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``
2022-08-10 09:28:19 -07:00
Michael Goulet
d0d2f60e49
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.
2022-08-10 09:28:18 -07:00
Jacob Hoffman-Andrews
20cc5f9e9a 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.
2022-08-10 09:08:28 -07:00
Martin Habovstiak
2a3ce7890c 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-10 17:22:58 +02:00
bors
c7ff1e8b00 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
2022-08-10 15:22:26 +00:00
joboet
3d21c371ef
std: optimize thread ID generation 2022-08-10 16:56:09 +02:00
Guillaume Gomez
ea05be2cf8 Update GUI test 2022-08-10 15:57:32 +02:00
Guillaume Gomez
107e039d9b Add missing ID into the ID map 2022-08-10 15:55:26 +02:00
Frank Steffahn
e957480f04 Two small improvements:
Fix oversight duplicate property left in CSS (dark theme).

Improve wording in comment that mentions `appearance: none`
2022-08-10 15:55:26 +02:00