Commit Graph

221495 Commits

Author SHA1 Message Date
bors
da636956dd Auto merge of #109983 - tmiasko:inline-try, r=bjorn3
Inline try_from and try_into

To avoid link time dependency between core and compiler-builtins, when using opt-level that implicitly enables -Zshare-generics.

While compiler-builtins should be compiled with -Zshare-generics disabled, the -Zbuild-std does not ensure this at the moment.

r? `@bjorn3`
2023-04-07 17:06:24 +00:00
bors
94524020ea Auto merge of #110036 - jackh726:placeholder_boundvar, r=nnethercote
Remove u32 on BrAnon and BoundTyKind::Anon in favor of BoundVar on Placeholder types

r? `@nnethercote`

Better alternative to #110025
2023-04-07 14:26:24 +00:00
Nicholas Nethercote
f08f15481a Add a size assertion for RegionKind. 2023-04-07 09:15:38 -04:00
bors
da14081468 Auto merge of #102906 - nbdd0121:mir, r=wesleywiser,tmiasko
Refactor unwind in MIR

This makes unwinding from current `Option<BasicBlock>` into
```rust
enum UnwindAction {
	Continue,
	Cleanup(BasicBlock),
	Unreachable,
	Terminate,
}
```

cc `@JakobDegen` `@RalfJung` `@Amanieu`
2023-04-07 10:31:14 +00:00
Maybe Waffle
fbe0591c68 Mark OwnedSlice::{deref, borrow} as #[inline] 2023-04-07 10:14:50 +00:00
Gary Guo
ea69dad8fa Fix coverage test 2023-04-07 10:18:28 +01:00
Scott McMurray
1042b5df9b Avoid some manual slice length calculation
No need for us to write the multiplication when `size_of_val` does exactly what we need.
2023-04-07 01:32:12 -07:00
bors
b6f6104a1f Auto merge of #110019 - jplatte:jplatte/stabilize-is-some-and, r=Amanieu
Stabilize is_some_and

This stabilizes the following public API:

```rust
impl<T> Option<T> {
    pub fn is_some_and(self, f: impl FnOnce(T) -> bool) -> bool;
}

impl<T, E> Result<T, E> {
    pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool;
    pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool;
}
```

Closes #93050 (tracking issue).

`@rustbot` label +T-libs-api -T-libs
2023-04-07 08:09:20 +00:00
ickk
30f458ed1e update tests/ui 2023-04-07 18:07:11 +10:00
ickk
726598ed9a fix infer_source_kind_subdiag_let help message - remove double "the" 2023-04-07 17:42:17 +10:00
León Orell Valerian Liehr
f2acafe9e2 suggest adding const param 2023-04-07 09:11:53 +02:00
bors
97879ce24b Auto merge of #109990 - gwy15:remove-bufwriter-useless-mut-pointer, r=jyn514
Remove an unnecessary `mut` in `BufWriter::into_parts`.

`ptr::read` takes `*const T` so `&mut` is not necessary.
2023-04-07 05:49:34 +00:00
Michael Goulet
d5b1ef1c3f Use smart-resolve when checking for trait in RHS of UFCS 2023-04-07 05:33:52 +00:00
bors
32ea4bb9e3 Auto merge of #109663 - fee1-dead-contrib:rustc_macros-syn-2.0, r=Nilstrieb
migrate rustc_macros to syn 2.0

WIP at this point since I need to work on migrating the code that heavily uses `NestedMeta` for parsing. Perhaps a full refactor would be nice..
2023-04-07 03:37:21 +00:00
Michael Howell
5cad51c0c5 rustdoc: add test and bug fix for theme defaults 2023-04-06 20:25:07 -07:00
Jack Huey
b15195a304 Remove u32 on BoundTyKind::Anon 2023-04-06 23:08:04 -04:00
Jack Huey
f0edcc8a6f Remove index from BrAnon 2023-04-06 23:01:40 -04:00
Jack Huey
e4edf00f12 Don't use BrAnon index in diagnostics 2023-04-06 23:01:38 -04:00
Jack Huey
167b70692b Remove expect_anon and expect_anon_placeholder in favor of var 2023-04-06 23:01:38 -04:00
Jack Huey
4646b3df6a Use BoundTy and BoundRegion instead of kind of PlaceholderTy and PlaceholderRegion 2023-04-06 23:01:35 -04:00
bors
c934ce9e0a Auto merge of #110024 - matthiaskrgr:rollup-mydkufd, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #109806 (Workaround #109797 on windows-gnu)
 - #109957 (diagnostics: account for self type when looking for source of unsolved type variable)
 - #109960 (Fix buffer overrun in bootstrap and (test-only) symlink_junction)
 - #110013 (Label `non_exhaustive` attribute on privacy errors from non-local items)
 - #110016 (Run collapsed GUI test in mobile mode as well)
 - #110022 (fix: fix regression in #109203)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-07 00:11:26 +00:00
Tomasz Miąsko
7ddc245b14 ./x.py test --bless 2023-04-07 00:00:00 +00:00
Tomasz Miąsko
67b4614180 Inline try_from and try_into
To avoid link time dependency between core and compiler-builtins, when
using opt-level that implicitly enables -Zshare-generics.

While compiler-builtins should be compiled with -Zshare-generics
disabled, the -Zbuild-std does not ensure this at the moment.
2023-04-07 14:59:10 +02:00
Michael Goulet
2cd0729d63 Get rid of elaborate_trait_ref{s} too 2023-04-06 23:30:22 +00:00
Michael Goulet
758bedc104 Make elaborator generic 2023-04-06 23:30:22 +00:00
Michael Howell
815f5bbcc5 rustdoc: clean up JS
* Stop checking `func` in `onEach`. It's always hard-coded right
  at the call site, so there's no point.
* Use the ternary operator in a few spots where it makes sense.
* No point in making `onEach` store `arr.length` in a variable if
  it's only used once anyway.
2023-04-06 16:25:38 -07:00
Matthias Krüger
903b439cac
Rollup merge of #110022 - Ezrashaw:fix-parser-ident-regression, r=compiler-errors
fix: fix regression in #109203

Fixes #110014

r? `@compiler-errors`
2023-04-07 00:00:26 +02:00
Matthias Krüger
273b221537
Rollup merge of #110016 - GuillaumeGomez:gui-collapsed-mobile, r=notriddle
Run collapsed GUI test in mobile mode as well

Extending test from https://github.com/rust-lang/rust/pull/109818 to be run on mobile as well.

Part of https://github.com/rust-lang/rust/issues/66181.

r? `@notriddle`
2023-04-07 00:00:26 +02:00
Matthias Krüger
e70818983b
Rollup merge of #110013 - compiler-errors:non-exhaustive-privacy-reason, r=WaffleLapkin
Label `non_exhaustive` attribute on privacy errors from non-local items

Label when an ADT is `non_exhaustive` and we get a privacy error, help with confusion in a case like this:

```rust
#[non_exhaustive]
pub struct Foo;

// other crate
let x = Foo;
//~^ ERROR unit struct `Foo` is private
```
2023-04-07 00:00:25 +02:00
Matthias Krüger
17ed06aad2
Rollup merge of #109960 - thomcc:symlink-junction-buffer-overrun, r=ChrisDenton
Fix buffer overrun in bootstrap and (test-only) symlink_junction

I don't think these can be hit in practice, due to their inputs being valid paths. It's also not security-sensitive code, but just... bad vibes.

I think this is still not really the right way to do this (in terms of path correctness), but is no worse than it was.

r? `@ChrisDenton`
2023-04-07 00:00:25 +02:00
Matthias Krüger
e63586f386
Rollup merge of #109957 - fmease:fix-109905, r=petrochenkov
diagnostics: account for self type when looking for source of unsolved type variable

Fixes #109905.

When searching for the source of an unsolved infer var inside of a list of generic args, we look through the `tcx.generics_of(…).own_substs(…)` which *skips* the self type if present. However, the computed `argument_index` is later[^1] used to index into `tcx.generics_of(…).params` which may still contain the self type. In such case, we are off by one when indexing into the parameters.

From now on, we account for this immediately after calling `own_substs` which keeps things local.

This also fixes the wrong output in the preexisting UI test `inference/need_type_info/concrete-impl.rs` which was overlooked. It used to claim that the *type of type parameter `Self`* couldn't be inferred in `<Struct as Ambiguous<_>>::method()` which of course isn't true: `Self` equals `Struct` here, `A` couldn't be inferred.

`@rustbot` label A-diagnostics

[^1]: f98a271814/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs (L471)
2023-04-07 00:00:24 +02:00
Matthias Krüger
b7e6973287
Rollup merge of #109806 - Zoxc:gnu-tls, r=pnkfelix
Workaround #109797 on windows-gnu

The addition of `#[inline]` here in https://github.com/rust-lang/rust/pull/108089 caused an unrelated linking issue (https://github.com/rust-lang/rust/issues/109797). This PR removes this attribute again on Windows to avoid regressions.
2023-04-07 00:00:23 +02:00
Gary Guo
1499a6faad UnwindAction::Terminate edge is also critical edge 2023-04-06 22:24:47 +01:00
bors
28a29282f6 Auto merge of #109162 - ozkanonur:extend_detect_src_and_out_test, r=jyn514
extend `detect_src_and_out` test

> I was thinking about the following cases when I wrote the comment in #109055
>
> 1. Running bootstrap from the source root.
> 2. Running from a subdirectory of the source root.
> 3. Running from outside the source root.
> 4. Running on a different machine from where bootstrap was compiled (which will be important > for #107812). You can mostly replicate this by renaming the source root so it no longer exists on disk.
> 5. Running with `--build-dir`.
> 6. Running with `$RUST_BOOTSTRAP_CONFIG` set in the environment and `build-dir` set in the file.

Tested all the topics mentioned above. All worked fine. The test is now also covers if build dir is manually specified in config.

r? `@jyn514`

helps #109120 partially
2023-04-06 21:18:49 +00:00
Jonas Platte
443928f7e3
Stabilize is_some_and 2023-04-06 23:14:23 +02:00
Ezra Shaw
9dbf20ef27
fix: fix regression in #109203 2023-04-07 08:54:13 +12:00
Scott McMurray
454bca514a Check CastKind::Transmute sizes in a better way
Fixes #110005
2023-04-06 13:53:10 -07:00
bors
de74dab880 Auto merge of #110012 - matthiaskrgr:rollup-sgmm5xv, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #109395 (Fix issue when there are multiple candidates for edit_distance_with_substrings)
 - #109755 (Implement support for `GeneratorWitnessMIR` in new solver)
 - #109782 (Don't leave a comma at the start of argument list when removing arguments)
 - #109977 (rustdoc: avoid including line numbers in Google SERP snippets)
 - #109980 (Derive String's PartialEq implementation)
 - #109984 (Remove f32 & f64 from MemDecoder/MemEncoder)
 - #110004 (add `dont_check_failure_status` option in the compiler test)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-06 18:48:42 +00:00
Guillaume Gomez
529ceeeefc Run collapsed GUI test in mobile mode as well 2023-04-06 20:26:27 +02:00
Maybe Waffle
2733c29bb1 Support multithreaded mode in OwnedSlice tests 2023-04-06 18:13:07 +00:00
Maybe Waffle
e0e39caf84 Add basic tests for OwnedSlice 2023-04-06 17:33:55 +00:00
ozkanonur
925a3040c7 improve/extend detect_src_and_out test
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-04-06 20:16:51 +03:00
Maybe Waffle
b6970d0e26 Use FnOnce for slice_owned instead of Fn 2023-04-06 17:03:42 +00:00
Michael Goulet
8ed2dc0bce Make span a bit better 2023-04-06 16:52:17 +00:00
Michael Goulet
00d54c879b Label non_exhaustive on privacy errors 2023-04-06 16:49:43 +00:00
Matthias Krüger
3473f734bd
Rollup merge of #110004 - SparrowLii:failure_status, r=oli-obk
add `dont_check_failure_status` option in the compiler test

Sometimes the compiler triggers one ice while processing another ice. This will cause a recursive panic and go to [`sys::abort_internal()`](https://github.com/rust-lang/rust/blob/master/library/std/src/panicking.rs#L675), which generates an unfixed exit code. So I think we need an option to allow these use cases to generate different exit codes

Updates #75760
cc #95134

For example, when set `parallel_compiler = true`, issue-95134 will ice in `report_ice` since it try to print the query stack. Below is the brief error message:
```
failures:

---- [ui] tests\ui\recursion\issue-95134.rs stdout ----

error: Error: expected failure status (Some(101)) but received status Some(-1073740791).
status: exit code: 0xc0000409
command: PATH="D:\rust-backup\parallel_rust\rust-para\build\x86_64-pc-windows-msvc\stage1\bin;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64;D:\rust-backup\parallel_rust\rust-para\build\x86_64-pc-windows-msvc\stage0-bootstrap-tools\x86_64-pc-windows-msvc\release\deps;D:\rust-backup\parallel_rust\rust-para\build\x86_64-pc-windows-msvc\stage0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\libnvvp;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\TortoiseGit\bin;C:\Program Files\CMake\bin;C:\Program Files (x86)\GnuWin32\bin;C:\Program Files\Git\cmd;C:\Program Files\NVIDIA Corporation\Nsight Compute 2021.2.1\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\HuaweiOpensource\anaconda3;C:\Users\HuaweiOpensource\anaconda3\Scripts;C:\Users\HuaweiOpensource\anaconda3\Library\bin;C:\Users\HuaweiOpensource\anaconda3\Library\mingw-w64;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\GnuWin32\bin;C:\Users\HuaweiOpensource\AppData\Local\Programs\Python\Python38\Scripts\;C:\Users\HuaweiOpensource\AppData\Local\Programs\Python\Python38\;C:\Users\HuaweiOpensource\.cargo\bin;C:\Users\HuaweiOpensource\.cargo\bin;D:\Program Files\JetBrains\CLion 2022.1.3\bin;;D:\Program Files\JetBrains\PyCharm Community Edition 2020.3\bin;;D:\Program Files\OpenSSL-Win64\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64;" "D:\\rust-backup\\parallel_rust\\rust-para\\build\\x86_64-pc-windows-msvc\\stage1\\bin\\rustc.exe" "D:\\rust-backup\\parallel_rust\\rust-para\\tests\\ui\\recursion\\issue-95134.rs" "-Zthreads=1" "--target=x86_64-pc-windows-msvc" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--remap-path-prefix=D:\\rust-backup\\parallel_rust\\rust-para\\tests\\ui=fake-test-src-base" "-C" "prefer-dynamic" "--out-dir" "D:\\rust-backup\\parallel_rust\\rust-para\\build\\x86_64-pc-windows-msvc\\test\\ui\\recursion\\issue-95134" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=D:\\rust-backup\\parallel_rust\\rust-para\\build\\x86_64-pc-windows-msvc\\native\\rust-test-helpers" "-L" "D:\\rust-backup\\parallel_rust\\rust-para\\build\\x86_64-pc-windows-msvc\\test\\ui\\recursion\\issue-95134\\auxiliary" "-Copt-level=0"
stdout: none
--- stderr -------------------------------
thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', C:\Users\HuaweiOpensource\.cargo\registry\src\github.com-1ecc6299db9ec823\ena-0.14.2\src\snapshot_vec.rs:199:10
stack backtrace:
   0:     0x7ffc3e90bc05 - std::backtrace_rs::backtrace::trace_unsynchronized::hfabb14c555fa1e54
   1:     0x7ffc3e900799 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h88786f2c1c37cad0
   2:     0x7ffc3e95143b - core::fmt::write::hef4555c5285e005b
   3:     0x7ffc3e8ef2aa - std::io::Write::write_fmt::h9ea304efc4781c26
   4:     0x7ffc3e90059b - std::sys_common::backtrace::print::h7b33cd350eefb143
......
 178:     0x7ffc27d6a3f2 - <&mut serde_json[7222a1897944c7c8]::ser::Serializer<&mut alloc[6a6f6c0f0cd9fa15]::vec::Vec<u8>, serde_json[7222a1897944c7c8]::ser::PrettyFormatter> as serde[d3e6684f4f38fcf7]::ser::Serializer>::collect_seq::<&alloc[6a6f6c0f0cd9fa15]::vec::Vec<serde_json[7222a1897944c7c8]::value::Value>>
 179:     0x7ffc3e8ed9ec - std::sys::windows:🧵:Thread:🆕:thread_start::h5be4f069fac1a629
 180:     0x7ffcb0b37614 - BaseThreadInitThunk
 181:     0x7ffcb18c26a1 - RtlUserThreadStart

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.70.0-dev running on x86_64-pc-windows-msvc

note: compiler flags: -Z threads=1 -C codegen-units=1 -Z ui-testing -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z deduplicate-diagnostics=no -C strip=debuginfo -C prefer-dynamic -C rpath -C debuginfo=0 -C opt-level=0

query stack during panic:
thread 'rustc' panicked at 'type variables should not be hashed: _#0t', D:\rust-backup\parallel_rust\rust-para\compiler\rustc_type_ir\src\lib.rs:718:17
stack backtrace:
   0:     0x7ffc3e90bc05 - std::backtrace_rs::backtrace::trace_unsynchronized::hfabb14c555fa1e54
   1:     0x7ffc3e900799 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h88786f2c1c37cad0
   2:     0x7ffc3e95143b - core::fmt::write::hef4555c5285e005b
   3:     0x7ffc3e8ef2aa - std::io::Write::write_fmt::h9ea304efc4781c26
   4:     0x7ffc3e90059b - std::sys_common::backtrace::print::h7b33cd350eefb143
   5:     0x7ffc3e91c109 - std::panicking::default_hook::h12f01c5f2b8959c6
......
 197:     0x7ffc27d6a3f2 - <&mut serde_json[7222a1897944c7c8]::ser::Serializer<&mut alloc[6a6f6c0f0cd9fa15]::vec::Vec<u8>, serde_json[7222a1897944c7c8]::ser::PrettyFormatter> as serde[d3e6684f4f38fcf7]::ser::Serializer>::collect_seq::<&alloc[6a6f6c0f0cd9fa15]::vec::Vec<serde_json[7222a1897944c7c8]::value::Value>>
 198:     0x7ffc3e8ed9ec - std::sys::windows:🧵:Thread:🆕:thread_start::h5be4f069fac1a629
 199:     0x7ffcb0b37614 - BaseThreadInitThunk
 200:     0x7ffcb18c26a1 - RtlUserThreadStart

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.70.0-dev running on x86_64-pc-windows-msvc

note: compiler flags: -Z threads=1 -C codegen-units=1 -Z ui-testing -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z deduplicate-diagnostics=no -C strip=debuginfo -C prefer-dynamic -C rpath -C debuginfo=0 -C opt-level=0

query stack during panic:
thread panicked while processing panic. aborting.
------------------------------------------
```
2023-04-06 18:43:00 +02:00
Matthias Krüger
4ecfb7fc04
Rollup merge of #109984 - scottmcm:less-float, r=Nilstrieb
Remove f32 & f64 from MemDecoder/MemEncoder

r? ```@Nilstrieb```
since they said (maybe joked) on discord that it's a bug if the compiler uses f32 anywhere 🙃
2023-04-06 18:42:59 +02:00
Matthias Krüger
dbc2941c15
Rollup merge of #109980 - xfix:derive-string-partialeq, r=scottmcm
Derive String's PartialEq implementation
2023-04-06 18:42:59 +02:00
Matthias Krüger
08ab38a703
Rollup merge of #109977 - notriddle:notriddle/data-nosnippet, r=jsha,the8472
rustdoc: avoid including line numbers in Google SERP snippets

![image](https://user-images.githubusercontent.com/1593513/230141184-9171c8e0-de92-48e6-85b6-8baee35e6d86.png)
2023-04-06 18:42:58 +02:00
Matthias Krüger
b153e2bd12
Rollup merge of #109782 - WaffleLapkin:nocommawhenremovingarguments, r=oli-obk
Don't leave a comma at the start of argument list when removing arguments

Fixes #109425

Quite a dirty hack, but at least it works ig.
2023-04-06 18:42:58 +02:00