Commit Graph

197056 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Konrad Borowski
de95117ea8 Inline CStr::from_bytes_with_nul_unchecked::rt_impl 2022-08-10 12:21:17 +00:00
b-naber
4bf350dc38 add test 2022-08-10 10:22:07 +02:00
bors
1603a70f82 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
2022-08-10 06:09:10 +00:00
Matthias Krüger
f6ce6aba6e
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)
2022-08-10 07:21:40 +02:00
Eric Huss
0a31aa29e4 Update cargo 2022-08-10 04:07:57 -07:00
Matthias Krüger
3b97de6b1b
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`
2022-08-10 07:21:39 +02:00
Matthias Krüger
636f0c71cb
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.
2022-08-10 07:21:38 +02:00
Matthias Krüger
354b831c32
Rollup merge of #100334 - TaKO8Ki:suggest-missing-semicolon-before-array, r=fee1-dead
Suggest a missing semicolon before an array

fixes #99658
2022-08-10 07:21:37 +02:00
Matthias Krüger
0cbecda7fe
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.`
2022-08-10 07:21:36 +02:00
Matthias Krüger
f9d6cc58b4
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
2022-08-10 07:21:35 +02:00
Matthias Krüger
6b5ec41936
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.
2022-08-10 07:21:34 +02:00
Matthias Krüger
e10f924e27
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`
2022-08-10 07:21:33 +02:00
Noah Lev
7bfcfd2242 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.
2022-08-09 21:18:12 -07:00
Anton Romanov
4a71447d38 Fix doc links in core::time::Duration::as_secs 2022-08-09 21:15:06 -07:00
bors
0459d2fa73 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
2022-08-10 03:21:23 +00:00
Noah Lev
fcbdf08a86 Add regression test for #93205
This issue was most likely fixed by #93805.
2022-08-09 19:57:56 -07:00
Takayuki Maeda
54cf66f241 remove a type string comparison 2022-08-10 11:42:46 +09:00
Jakob Degen
7a1bfc0ba7 Add more // unit-tests to MIR opt tests 2022-08-09 17:32:50 -07:00
Jane Losare-Lusby
21396828e4
Apply suggestions from code review 2022-08-09 15:59:53 -07:00
Matthias Krüger
752b9a85dc
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`
2022-08-10 00:00:37 +02:00
Matthias Krüger
a431ef4949
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``
2022-08-10 00:00:36 +02:00
Matthias Krüger
e8d8599ad9
Rollup merge of #100314 - JakobDegen:test-docs, r=RalfJung
Mention `unit-test` in MIR opt test README

r? `@RalfJung`
2022-08-10 00:00:35 +02:00
Matthias Krüger
790b19f514
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`
2022-08-10 00:00:34 +02:00
Matthias Krüger
45c9dde4e1
Rollup merge of #100275 - RalfJung:anyhow, r=bjorn3
also update anyhow in codegen_cranelift

now that is has been un-yanked
r? ``@bjorn3``
2022-08-10 00:00:33 +02:00
Matthias Krüger
2be32e8e9b
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.
2022-08-10 00:00:32 +02:00
Matthias Krüger
4add5148a5
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`
2022-08-10 00:00:31 +02:00
Matthias Krüger
b11b8d6939
Rollup merge of #100240 - cjgillot:noice-structural-match, r=davidtwco
Fail gracefully when const pattern is not structural match.

Fixes https://github.com/rust-lang/rust/issues/82909
2022-08-10 00:00:30 +02:00
Matthias Krüger
e6c9594213
Rollup merge of #100226 - cjgillot:noice-multibyte, r=davidtwco
Do not manually craft a span pointing inside a multibyte character.

Fixes https://github.com/rust-lang/rust/issues/92462
2022-08-10 00:00:29 +02:00
Matthias Krüger
867453e2df
Rollup merge of #100098 - compiler-errors:field-suggestion-fixups, r=davidtwco
Some "this expression has a field"-related fixes

Each commit does something different and is worth reviewing, but the final diff from `master..HEAD` contains the sum of the changes to the UI tests, since some commits added UI tests "regressions" which were later removed in other commits.

The only change I could see adding on top of this is suppressing `Clone::clone` from the "this expression has a field that has this method" suggestion, since it's so commonly implemented by types that it's not worthwhile suggesting in general.
2022-08-10 00:00:28 +02:00