]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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 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 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 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 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 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 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 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`

22 months agoRollup merge of #100240 - cjgillot:noice-structural-match, r=davidtwco
Matthias Krüger [Tue, 9 Aug 2022 22:00:30 +0000 (00:00 +0200)]
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

22 months agoRollup merge of #100226 - cjgillot:noice-multibyte, r=davidtwco
Matthias Krüger [Tue, 9 Aug 2022 22:00:29 +0000 (00:00 +0200)]
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

22 months agoRollup merge of #100098 - compiler-errors:field-suggestion-fixups, r=davidtwco
Matthias Krüger [Tue, 9 Aug 2022 22:00:28 +0000 (00:00 +0200)]
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.

22 months agoRollup merge of #100072 - oToToT:patch-1, r=michaelwoerister
Matthias Krüger [Tue, 9 Aug 2022 22:00:27 +0000 (00:00 +0200)]
Rollup merge of #100072 - oToToT:patch-1, r=michaelwoerister

linker-plugin-lto.md: Correct the name of example c file

The final output is linked with `cmain.o`, but we use `main.o` in the example.
This patch changes the name to `cmain.c` and `cmain.o` as the "C/C++ code as a dependency in Rust" section.

22 months agoRollup merge of #100040 - ChrisDenton:broken-pipe, r=davidtwco
Matthias Krüger [Tue, 9 Aug 2022 22:00:26 +0000 (00:00 +0200)]
Rollup merge of #100040 - ChrisDenton:broken-pipe, r=davidtwco

Error on broken pipe but do not backtrace or ICE

Windows will report a broken pipe as a normal error which in turn `println!` will panic on. Currently this causes rustc to produce a backtrace and ICE. However, this is not a bug with rustc so a backtrace is overly verbose and ultimately unhelpful to the user.

Kind of fixes #98700. Although this is admittedly a bit of a hack because at panic time all we have is a string to inspect. On zulip it was suggested that libstd might someday provide a way to indicate a soft panic but that day isn't today.

22 months agoRollup merge of #99479 - Enselic:import-can-be-without-id, r=camelid
Matthias Krüger [Tue, 9 Aug 2022 22:00:24 +0000 (00:00 +0200)]
Rollup merge of #99479 - Enselic:import-can-be-without-id, r=camelid

rustdoc-json: Remove doc FIXME for Import::id and explain

Also add some test and refactor related code a bit.

``@rustbot`` labels +A-rustdoc-json +T-rustdoc

22 months agoRollup merge of #98775 - notriddle:notriddle/mobile-sidebar-scroll-lock, r=jsha
Matthias Krüger [Tue, 9 Aug 2022 22:00:23 +0000 (00:00 +0200)]
Rollup merge of #98775 - notriddle:notriddle/mobile-sidebar-scroll-lock, r=jsha

rustdoc: improve scroll locking in the rustdoc mobile sidebars

This PR prevents the main content area from scrolling while the mobile sidebar is open on documentation pages (porting the scroll locking behavior from the source sidebar to the regular sidebar), and also fixes some bad behavior where opening a "mobile" sidebar, and growing the viewport so that the "desktop" mode without scroll locking is activated, could potentially leave the page stuck.

This does not affect the behavior on larger screens. Only small ones, where the sidebar covers up the main content.

Split out from #98772

22 months agodocs: remove repetition
Vincenzo Palazzo [Tue, 9 Aug 2022 21:52:22 +0000 (21:52 +0000)]
docs: remove repetition

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
22 months agoAuto merge of #100150 - notriddle:notriddle/implementors-js, r=GuillaumeGomez
bors [Tue, 9 Aug 2022 20:00:58 +0000 (20:00 +0000)]
Auto merge of #100150 - notriddle:notriddle/implementors-js, r=GuillaumeGomez

rustdoc: use a more compact encoding for implementors/trait.*.js

The exact amount that this reduces the size of an implementors file depends on whether most of the impls are synthetic or not. For `Send`, it reduces the file from 128K to 112K, while for `Clone` it went from 64K to 44K.

22 months agoAdd docs for get_remapped_def_id
Santiago Pastorino [Tue, 9 Aug 2022 19:39:02 +0000 (16:39 -0300)]
Add docs for get_remapped_def_id

22 months agoIterate def_ids map backwards to try first the latest mappings (it's a stack)
Santiago Pastorino [Tue, 9 Aug 2022 19:33:19 +0000 (16:33 -0300)]
Iterate def_ids map backwards to try first the latest mappings (it's a stack)

22 months agoadded some comments
shourya5 [Tue, 9 Aug 2022 19:25:07 +0000 (00:55 +0530)]
added some comments

22 months agoUpdate rustdoc-json test
Eric Holk [Tue, 9 Aug 2022 19:06:54 +0000 (12:06 -0700)]
Update rustdoc-json test

22 months agoAdd regression test for issue 100187
Santiago Pastorino [Tue, 9 Aug 2022 18:42:59 +0000 (15:42 -0300)]
Add regression test for issue 100187

22 months agoMove folding into just projection cases
Michael Goulet [Tue, 9 Aug 2022 18:19:58 +0000 (18:19 +0000)]
Move folding into just projection cases

22 months agoAdd error if link_ordinal used without raw-dylib
Daniel Paoliello [Tue, 2 Aug 2022 17:33:27 +0000 (10:33 -0700)]
Add error if link_ordinal used without raw-dylib

22 months agoAddress review comments
Noah Lev [Mon, 8 Aug 2022 04:16:47 +0000 (21:16 -0700)]
Address review comments

22 months agosuggest a missing semicolon before an array
Takayuki Maeda [Tue, 9 Aug 2022 17:29:28 +0000 (02:29 +0900)]
suggest a missing semicolon before an array

22 months agoreplaced resume_unwind with process::exit to fix
shourya5 [Tue, 9 Aug 2022 17:25:57 +0000 (22:55 +0530)]
replaced resume_unwind with process::exit to fix
bootstrap panic when running x fmt --check.
running x fmt --check

22 months agoRename integer log* methods to ilog*
Eric Holk [Tue, 9 Aug 2022 17:20:49 +0000 (10:20 -0700)]
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

Co-authored-by: Yosh Wuyts <github@yosh.is>
22 months agofix
b-naber [Tue, 9 Aug 2022 17:12:14 +0000 (19:12 +0200)]
fix

22 months agoMention `unit-test` in MIR opt test README
Jakob Degen [Tue, 9 Aug 2022 08:44:32 +0000 (01:44 -0700)]
Mention `unit-test` in MIR opt test README

22 months agoAuto merge of #99217 - lcnr:implied-bounds-pre-norm, r=lcnr
bors [Tue, 9 Aug 2022 16:39:43 +0000 (16:39 +0000)]
Auto merge of #99217 - lcnr:implied-bounds-pre-norm, r=lcnr

consider unnormalized types for implied bounds

extracted, and slightly modified, from #98900

The idea here is that generally, rustc is split into things which can assume its inputs are well formed[^1], and things which have verify that themselves.

Generally most predicates should only deal with well formed inputs, e.g. a `&'a &'b (): Trait` predicate should be able to assume that `'b: 'a` holds. Normalization can loosen wf requirements (see #91068) and must therefore not be used in places which still have to check well formedness. The only such place should hopefully be `WellFormed` predicates

fixes #87748 and #98543

r? `@jackh726` cc `@rust-lang/types`

[^1]: These places may still encounter non-wf inputs and have to deal with them without causing an ICE as we may check for well formedness out of order.

22 months agoAdd test for impl blocks containing only private items
Guillaume Gomez [Tue, 9 Aug 2022 13:49:55 +0000 (15:49 +0200)]
Add test for impl blocks containing only private items

22 months agoAuto merge of #100318 - Dylan-DPC:rollup-18tzp6q, r=Dylan-DPC
bors [Tue, 9 Aug 2022 13:51:33 +0000 (13:51 +0000)]
Auto merge of #100318 - Dylan-DPC:rollup-18tzp6q, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #96478 (Implement `#[rustc_default_body_unstable]`)
 - #99787 (Rustdoc-Json: Document HRTB's on DynTrait)
 - #100181 (add method to get the mutability of an AllocId)
 - #100221 (Don't document impossible to call default trait items on impls)
 - #100228 (Don't ICE while suggesting updating item path.)
 - #100301 (Avoid `&str` to `String` conversions)
 - #100305 (Suggest adding an appropriate missing pattern excluding comments)

Failed merges:

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

22 months agoPrevent impl blocks containing only private items to be documented by default
Guillaume Gomez [Tue, 9 Aug 2022 13:39:58 +0000 (15:39 +0200)]
Prevent impl blocks containing only private items to be documented by default

22 months agotest implied bounds + nested proj oblig
lcnr [Tue, 9 Aug 2022 11:05:46 +0000 (13:05 +0200)]
test implied bounds + nested proj oblig

22 months agoremove Clean trait implementation for ast::Module
Guillaume Gomez [Mon, 8 Aug 2022 16:00:42 +0000 (18:00 +0200)]
remove Clean trait implementation for ast::Module

22 months agoRollup merge of #100305 - TaKO8Ki:suggest-adding-appropriate-missing-pattern-excludin...
Dylan DPC [Tue, 9 Aug 2022 12:04:57 +0000 (17:34 +0530)]
Rollup merge of #100305 - TaKO8Ki:suggest-adding-appropriate-missing-pattern-excluding-comments, r=compiler-errors

Suggest adding an appropriate missing pattern excluding comments

fixes #100272

22 months agoRollup merge of #100301 - TaKO8Ki:avoid-&str-to-String-conversions, r=compiler-errors
Dylan DPC [Tue, 9 Aug 2022 12:04:56 +0000 (17:34 +0530)]
Rollup merge of #100301 - TaKO8Ki:avoid-&str-to-String-conversions, r=compiler-errors

Avoid `&str` to `String` conversions

This patch removes the recently added unnecessary `&str` to `String` conversions.

follow-up to #99718

22 months agoRollup merge of #100228 - luqmana:suggestion-ice, r=estebank
Dylan DPC [Tue, 9 Aug 2022 12:04:55 +0000 (17:34 +0530)]
Rollup merge of #100228 - luqmana:suggestion-ice, r=estebank

Don't ICE while suggesting updating item path.

When an item isn't found, we may suggest an appropriate import to `use`. Along with that, we also suggest updating the path to work with the `use`. Unfortunately, if the code in question originates from a macro, the span used to indicate which part of the path needs updating may not be suitable and cause an ICE (*). Since, such code is not adjustable directly by the user without modifying the macro, just skip the suggestion in such cases.

(*) The ICE happens because the emitter want to indicate to the user what code to delete by referencing a certain span. But in this case, said span has `lo == hi == 0` which means it thinks it's a dummy span. Adding a space before the proc macro attribute is enough to stop it from ICE'ing but even then the suggestion doesn't really make any sense:
```
help: if you import `DataStore`, refer to it directly
  |
1 -  #[dbstruct::dbstruct]
1 +  #[dbstruct::dbstruct]
```

Since suggestions are best-effort, I just gated this one on `can_be_used_for_suggestions` which catches cases like this.

Fixes #100199

22 months agoRollup merge of #100221 - compiler-errors:impossible-trait-items, r=lcnr,notriddle...
Dylan DPC [Tue, 9 Aug 2022 12:04:54 +0000 (17:34 +0530)]
Rollup merge of #100221 - compiler-errors:impossible-trait-items, r=lcnr,notriddle,camelid

Don't document impossible to call default trait items on impls

Closes #100176

This only skips documenting _default_ trait items on impls, not ones that are written inside the impl block. This is a conservative approach, since I think we should document all items written in an impl block (I guess unless hidden or whatever), but the existence of this new query I added makes this easy to extend to other rustdoc cases.

22 months agoRollup merge of #100181 - RalfJung:alloc-ref-mutability, r=jackh726
Dylan DPC [Tue, 9 Aug 2022 12:04:52 +0000 (17:34 +0530)]
Rollup merge of #100181 - RalfJung:alloc-ref-mutability, r=jackh726

add method to get the mutability of an AllocId

Miri needs this for https://github.com/rust-lang/miri/issues/2463.

22 months agoRollup merge of #99787 - aDotInTheVoid:rdj-dyn, r=camelid,notriddle,GuillaumeGomez
Dylan DPC [Tue, 9 Aug 2022 12:04:51 +0000 (17:34 +0530)]
Rollup merge of #99787 - aDotInTheVoid:rdj-dyn, r=camelid,notriddle,GuillaumeGomez

Rustdoc-Json: Document HRTB's on DynTrait

Closes https://github.com/rust-lang/rust/issues/99118

Probably best reviewed commit by commit.

`@rustbot` modify labels: +A-rustdoc-json

cc `@Enselic`

r? `@CraftSpider`

22 months agoRollup merge of #96478 - WaffleLapkin:rustc_default_body_unstable, r=Aaron1011
Dylan DPC [Tue, 9 Aug 2022 12:04:50 +0000 (17:34 +0530)]
Rollup merge of #96478 - WaffleLapkin:rustc_default_body_unstable, r=Aaron1011

Implement `#[rustc_default_body_unstable]`

This PR implements a new stability attribute — `#[rustc_default_body_unstable]`.

`#[rustc_default_body_unstable]` controls the stability of default bodies in traits.
For example:
```rust
pub trait Trait {
    #[rustc_default_body_unstable(feature = "feat", isssue = "none")]
    fn item() {}
}
```
In order to implement `Trait` user needs to either
- implement `item` (even though it has a default implementation)
- enable `#![feature(feat)]`

This is useful in conjunction with [`#[rustc_must_implement_one_of]`](https://github.com/rust-lang/rust/pull/92164), we may want to relax requirements for a trait, for example allowing implementing either of `PartialEq::{eq, ne}`, but do so in a safe way — making implementation of only `PartialEq::ne` unstable.

r? `@Aaron1011`
cc `@nrc` (iirc you were interested in this wrt `read_buf`), `@danielhenrymantilla` (you were interested in the related `#[rustc_must_implement_one_of]`)
P.S. This is my first time working with stability attributes, so I'm not sure if I did everything right 😅

22 months agoRemove logic related to deprecated nvptx-nvidia-cuda (32-bit) target
Kjetil Kjeka [Tue, 9 Aug 2022 11:29:06 +0000 (13:29 +0200)]
Remove logic related to deprecated nvptx-nvidia-cuda (32-bit) target

22 months agoAuto merge of #100089 - JakobDegen:no-invalidate-visitor, r=tmiasko
bors [Tue, 9 Aug 2022 11:05:42 +0000 (11:05 +0000)]
Auto merge of #100089 - JakobDegen:no-invalidate-visitor, r=tmiasko

Add option to `mir::MutVisitor` to not invalidate CFG.

This also applies that option to some uses of the visitor. I had considered a design more similar to #100087 in which we detect if the CFG needs to be invalidated, but that is more difficult with the visitor API and so I decided against it. Another alternative to this design is to offer an API for "saving" and "restoring" CFG caches across arbitrary code. Such an API is more general, and so we may eventually want it anyway, but it seems overkill for this use case.

r? `@tmiasko`

22 months agodon't normalize wf predicates
lcnr [Wed, 13 Jul 2022 17:42:08 +0000 (19:42 +0200)]
don't normalize wf predicates

this allows us to soundly use unnormalized projections for wf

22 months agoKeep going if normalized projection has unevaluated consts in QueryNormalizer
Michael Goulet [Tue, 9 Aug 2022 09:41:23 +0000 (09:41 +0000)]
Keep going if normalized projection has unevaluated consts in QueryNormalizer

22 months agoAdd support for link-flavor rust-lld for macOS
Mary [Tue, 9 Aug 2022 09:04:48 +0000 (11:04 +0200)]
Add support for link-flavor rust-lld for macOS

Also refactor iOS, watchOS and tvOS common code.

22 months agoAdd option to `mir::MutVisitor` to not invalidate CFG.
Jakob Degen [Wed, 3 Aug 2022 03:06:16 +0000 (20:06 -0700)]
Add option to `mir::MutVisitor` to not invalidate CFG.

This also applies that option to some uses of the visitor

22 months agoAuto merge of #100304 - matthiaskrgr:rollup-gs56vlw, r=matthiaskrgr
bors [Tue, 9 Aug 2022 08:03:08 +0000 (08:03 +0000)]
Auto merge of #100304 - matthiaskrgr:rollup-gs56vlw, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #100163 (Refactor: remove an unnecessary string search)
 - #100212 (Remove more Clean trait implementations)
 - #100238 (Further improve error message for E0081)
 - #100268 (Add regression test for #79148)
 - #100294 (Update Duration::as_secs doc to point to as_secs_f64/32 for including fractional part)
 - #100303 (:arrow_up: rust-analyzer)

Failed merges:

 - #100281 (Remove more Clean trait implementations)

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

22 months agocompiletest: Add warning and comment about running tests without RUSTC
Eric Huss [Tue, 9 Aug 2022 05:51:16 +0000 (22:51 -0700)]
compiletest: Add warning and comment about running tests without RUSTC

22 months agosuggest adding an appropriate missing pattern excluding comments
Takayuki Maeda [Tue, 9 Aug 2022 05:27:26 +0000 (14:27 +0900)]
suggest adding an appropriate missing pattern excluding comments

22 months agoRollup merge of #100303 - lnicola:rust-analyzer-2022-08-09, r=lnicola
Matthias Krüger [Tue, 9 Aug 2022 05:06:02 +0000 (07:06 +0200)]
Rollup merge of #100303 - lnicola:rust-analyzer-2022-08-09, r=lnicola

:arrow_up: rust-analyzer

r? `@ghost`

22 months agoRollup merge of #100294 - theli-ua:master, r=thomcc
Matthias Krüger [Tue, 9 Aug 2022 05:06:01 +0000 (07:06 +0200)]
Rollup merge of #100294 - theli-ua:master, r=thomcc

Update Duration::as_secs doc to point to as_secs_f64/32 for including fractional part

Rather than suggesting to calculate manually

22 months agoRollup merge of #100268 - TaKO8Ki:add-regression-test-for-79148, r=Mark-Simulacrum
Matthias Krüger [Tue, 9 Aug 2022 05:05:59 +0000 (07:05 +0200)]
Rollup merge of #100268 - TaKO8Ki:add-regression-test-for-79148, r=Mark-Simulacrum

Add regression test for #79148

closes #79148

22 months agoRollup merge of #100238 - Bryysen:master, r=cjgillot
Matthias Krüger [Tue, 9 Aug 2022 05:05:58 +0000 (07:05 +0200)]
Rollup merge of #100238 - Bryysen:master, r=cjgillot

Further improve error message for E0081

Closes #97533