about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-04-10Revert method-not-found-generic-arg-elision test blessDaniPopes-2/+0
2023-04-10Fix typos in compilerDaniPopes-4/+6
2023-04-10Rollup merge of #110021 - scottmcm:fix-110005, r=compiler-errorsDylan DPC-2/+165
Fix a couple ICEs in the new `CastKind::Transmute` code Check the sizes of the immediates, rather than the overall types, when deciding whether we can convert types without going through memory. Fixes #110005 Fixes #109992 Fixes #110032 cc `@matthiaskrgr`
2023-04-10review + some small stufflcnr-1/+23
2023-04-10prioritize param-env candidateslcnr-7/+53
2023-04-10Auto merge of #110127 - matthiaskrgr:rollup-6ui12x5, r=matthiaskrgrbors-0/+45
Rollup of 6 pull requests Successful merges: - #108843 (Instantiate instead of erasing binder when probing param methods) - #109985 (Add little `is_test_crate` function) - #110028 (Migrate `rustc_hir_analysis` to session diagnostic [Part 3]) - #110095 (Migrate remainder of rustc_ty_utils to `SessionDiagnostic`) - #110108 (Add renaming of ignore-git to changelog) - #110114 (compiletest: Give a better error message if `node` isn't installed) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-09Rollup merge of #110095 - matthewjasper:ty-utils-diagnostics, r=compiler-errorsMatthias Krüger-0/+18
Migrate remainder of rustc_ty_utils to `SessionDiagnostic` This moves the remaining errors in `rust_ty_utils` to `SessionsDiagnostic`. r? ``@davidtwco``
2023-04-09Rollup merge of #108843 - compiler-errors:non_lifetime_binders-method-probe, ↵Matthias Krüger-0/+27
r=jackh726 Instantiate instead of erasing binder when probing param methods Fixes #108836 There is a really old comment saying that a `WhereClauseCandidate` probe candidate "should not contain any inference variables", but I'm not really confident that that comment applies anymore. In contrast, other candidates that we assemble during method probe contain inference variables in their substitutions (e.g. `InherentImplCandidate`)... Since this change is made only to support a nightly feature, I'm happy to gate the new behavior behind this feature flag or discuss it further. r? types
2023-04-09Auto merge of #109760 - MaciejWas:struct-tuple-field-names-suggestion, ↵bors-2/+21
r=jackh726 Better diagnostic when pattern matching tuple structs Fixes #108284 When trying to pattern match a tuple struct we might get a flawed error message if there are missing fields. E.g. ``` let x = Foo(100, 200); if let Foo { 0: bar } = x { ... } ``` Produces this error: ``` error[E0769]: tuple variant `Foo` written as struct variant --> hello.rs:5:12 | 5 | if let Foo { 0: foo } = x { | ^^^^^^^^^^^^^^ | help: use the tuple variant pattern syntax instead | 5 | if let Foo(_, _) = x { | ~~~~~~ ``` Which doesn't highlight that we can still use the struct syntax but we need to fill missing fields. This pr changes this error to: ``` error[E0027]: pattern does not mention field `1` --> hello.rs:5:12 | 5 | if let Foo { 0: foo } = x { | ^^^^^^^^^^^^^^ missing field `1` | help: include the missing field in the pattern | 5 | if let Foo { 0: foo, 1: _ } = x { | ~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | 5 | if let Foo { 0: foo, .. } = x { | ~~~~~~ ```
2023-04-09Handle not all immediates having `abi::Scalar`sScott McMurray-1/+92
2023-04-09Auto merge of #109684 - fee1-dead-contrib:rv_const_range, r=Mark-Simulacrumbors-6/+49
Revert #104100, Allow using `Range` as an `Iterator` in const contexts. This fixes #109632.
2023-04-09Auto merge of #110041 - fmease:diag-sugg-adding-const-param, r=compiler-errorsbors-0/+88
Suggest defining const parameter when appropriate Helps a bit with #91119. Following #105523's lead, I use placeholder `/* Type */` instead of `_` in the suggestion. It should be easier for newcomers to parse. `@rustbot` label A-diagnostics r? diagnostics
2023-04-09Auto merge of #110101 - JohnTitor:rollup-ol20aw7, r=JohnTitorbors-4/+19
Rollup of 6 pull requests Successful merges: - #110058 (Remove `box_syntax` usage) - #110059 (ignore_git → omit_git_hash) - #110060 (Document that `&T` and `&mut T` are `Sync` if `T` is) - #110074 (Make the "codegen" profile of `config.toml` download and build llvm from source.) - #110086 (Add `max_line_length` to `.editorconfig`, matching rustfmt) - #110096 (Tweak tuple indexing suggestion) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-09Rollup merge of #110096 - compiler-errors:tweak-tuple-idx-msg, r=NilstriebYuki Okushi-4/+19
Tweak tuple indexing suggestion Fixes #110091
2023-04-09Auto merge of #109413 - compiler-errors:pointer-like-abi, r=cjgillotbors-14/+22
Enforce that `PointerLike` requires a pointer-like ABI At least temporarily, let's ban coercing things that are pointer-sized and pointer-aligned but *not* `Abi::Scalar(..)` into `dyn*`. See: https://github.com/rust-lang/rust/pull/104694#discussion_r1142522073 This can be lifted in the future if we decie that we *want* to be able to coerce something `repr(C)` into a `dyn*`, but we'll have to figure out what to do with Miri and codegen... r? compiler
2023-04-08Tweak tuple indexing suggestionMichael Goulet-4/+19
2023-04-08Add test for new delayed bug code pathMatthew Jasper-0/+18
2023-04-08Enforce that PointerLike requires a pointer-like ABIMichael Goulet-14/+22
2023-04-08Auto merge of #106281 - JulianKnodt:transmute_const_generics, r=b-naberbors-0/+345
Add ability to transmute (somewhat) with generic consts in arrays Previously if the expression contained generic consts and did not have a directly equivalent type, transmuting the type in this way was forbidden, despite the two sizes being identical. Instead, we should be able to lazily tell if the two consts are identical, and if so allow them to be transmuted. This is done by normalizing the forms of expressions into sorted order of multiplied terms, which is not generic over all expressions, but should handle most cases. This allows for some _basic_ transmutations between types that are equivalent in size without requiring additional stack space at runtime. I only see one other location at which `SizeSkeleton` is being used, and it checks for equality so this shouldn't affect anywhere else that I can tell. See [this Stackoverflow post](https://stackoverflow.com/questions/73085012/transmute-nested-const-generic-array-rust) for what was previously necessary to convert between types. This PR makes converting nested `T -> [T; 1]` transmutes possible, and `[uB*2; N] -> [uB; N * 2]` possible as well. I'm not sure whether this is something that would be wanted, and if it is it definitely should not be insta-stable, so I'd add a feature gate.
2023-04-08bless ui testsDeadbeef-5/+34
2023-04-08Rollup merge of #110037 - notriddle:notriddle/theme-default, r=GuillaumeGomezNilstrieb-0/+24
rustdoc: add test and bug fix for theme defaults Part of https://github.com/rust-lang/rust/issues/66181
2023-04-08Revert "Mark DoubleEndedIterator as #[const_trait] using ↵Deadbeef-1/+15
rustc_do_not_const_check, implement const Iterator and DoubleEndedIterator for Range." This reverts commit 8a9d6bf4fd540b2a2882193cbd6232b86e5dcd7e.
2023-04-08Auto merge of #110043 - ickk:fix_infer_message, r=eholkbors-3/+3
Fix help message for `infer_source_kind_subdiag_let` I discovered there's a double "the" in the help message for E0282.
2023-04-07Auto merge of #109788 - compiler-errors:trait-item-from-non-trait, ↵bors-118/+175
r=petrochenkov More descriptive error when qself path doesnt have a trait on the RHS of `as` `<Ty as Enum>::Assoc` should report that `Enum` is a trait. Main question is whether to eagerly report the error, or raise it with `return Err(..)` -- i'll note that in an inline comment though. cc `@GuillaumeGomez` who said this came up at a Paris Rust meetup. r? `@petrochenkov`
2023-04-07Add feature gatekadmin-10/+187
2023-04-07Auto merge of #109983 - tmiasko:inline-try, r=bjorn3bors-182/+296
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-07Auto merge of #110036 - jackh726:placeholder_boundvar, r=nnethercotebors-16/+16
Remove u32 on BrAnon and BoundTyKind::Anon in favor of BoundVar on Placeholder types r? `@nnethercote` Better alternative to #110025
2023-04-07Auto merge of #102906 - nbdd0121:mir, r=wesleywiser,tmiaskobors-371/+455
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-07Fix coverage testGary Guo-1/+1
2023-04-07update tests/uiickk-3/+3
2023-04-07suggest adding const paramLeón Orell Valerian Liehr-0/+88
2023-04-07Use smart-resolve when checking for trait in RHS of UFCSMichael Goulet-118/+175
2023-04-07Auto merge of #109663 - fee1-dead-contrib:rustc_macros-syn-2.0, r=Nilstriebbors-341/+347
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-06rustdoc: add test and bug fix for theme defaultsMichael Howell-0/+24
2023-04-06Remove index from BrAnonJack Huey-16/+16
2023-04-07./x.py test --blessTomasz Miąsko-182/+296
2023-04-07Rollup merge of #110022 - Ezrashaw:fix-parser-ident-regression, ↵Matthias Krüger-0/+22
r=compiler-errors fix: fix regression in #109203 Fixes #110014 r? `@compiler-errors`
2023-04-07Rollup merge of #110016 - GuillaumeGomez:gui-collapsed-mobile, r=notriddleMatthias Krüger-7/+26
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-07Rollup merge of #110013 - compiler-errors:non-exhaustive-privacy-reason, ↵Matthias Krüger-10/+19
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-07Rollup merge of #109957 - fmease:fix-109905, r=petrochenkovMatthias Krüger-4/+48
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]: https://github.com/rust-lang/rust/blob/f98a2718141593fbb8dbad10acc537786d748156/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs#L471
2023-04-07fix: fix regression in #109203Ezra Shaw-0/+22
2023-04-06Check `CastKind::Transmute` sizes in a better wayScott McMurray-1/+73
Fixes #110005
2023-04-06Run collapsed GUI test in mobile mode as wellGuillaume Gomez-7/+26
2023-04-06Make span a bit betterMichael Goulet-40/+19
2023-04-06Label non_exhaustive on privacy errorsMichael Goulet-3/+33
2023-04-06Rollup merge of #110004 - SparrowLii:failure_status, r=oli-obkMatthias Krüger-1/+1
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::new::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::new::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-06Rollup merge of #109782 - WaffleLapkin:nocommawhenremovingarguments, r=oli-obkMatthias Krüger-1/+139
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-06Rollup merge of #109755 - compiler-errors:new-solver-generator-witness-mir, ↵Matthias Krüger-0/+44
r=cjgillot Implement support for `GeneratorWitnessMIR` in new solver r? ```@cjgillot``` I mostly want this to cut down the number of failing UI tests when running the UI test suite with `--compare-mode=next-solver`, but there doesn't seem like much reason to block implementing this since it adds minimal complexity to the existing structural traits impl in the new solver. If others are against adding this for some reason, then maybe we should just make `GeneratorWitnessMIR` return `NoSolution` for these traits. Anything but an ICE please :smile_cat: :ice_cube:
2023-04-06Rollup merge of #109395 - chenyukang:yukang/fix-109291, r=cjgillotMatthias Krüger-0/+16
Fix issue when there are multiple candidates for edit_distance_with_substrings Fixes #109291
2023-04-06Auto merge of #108504 - cjgillot:thir-pattern, r=compiler-errors,Nilstriebbors-971/+574
Check pattern refutability on THIR The current `check_match` query is based on HIR, but partially re-lowers HIR into THIR. This PR proposed to use the results of the `thir_body` query to check matches, instead of re-building THIR. Most of the diagnostic changes are spans getting shorter, or commas/semicolons not getting removed. This PR degrades the diagnostic for confusing constants in patterns (`let A = foo()` where `A` resolves to a `const A` somewhere): it does not point ot the definition of `const A` any more.