about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-05-09Auto merge of #124157 - wutchzone:partial_eq, r=estebankbors-10/+48
Do not add leading asterisk in the `PartialEq` I think we should address this issue, however I am not exactly sure, if this is the right way to do it. It is related to the #123056. Imagine the simplified code: ```rust trait MyTrait {} impl PartialEq for dyn MyTrait { fn eq(&self, _other: &Self) -> bool { true } } #[derive(PartialEq)] enum Bar { Foo(Box<dyn MyTrait>), } ``` On the nightly compiler, the `derive` produces invalid code with the weird error message: ``` error[E0507]: cannot move out of `*__arg1_0` which is behind a shared reference --> src/main.rs:11:9 | 9 | #[derive(PartialEq)] | --------- in this derive macro expansion 10 | enum Things { 11 | Foo(Box<dyn MyTrait>), | ^^^^^^^^^^^^^^^^ move occurs because `*__arg1_0` has type `Box<dyn MyTrait>`, which does not implement the `Copy` trait | = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) ``` It may be related to the perfect derive problem, although requiring the _type_ to be `Copy` seems unfortunate because it is not necessary. Besides, we are adding the extra dereference only for the diagnostics?
2024-05-09Rollup merge of #124908 - saethlin:ref-casting_bigger_place_projection, ↵Matthias Krüger-0/+6
r=fee1-dead Handle field projections like slice indexing in invalid_reference_casting r? `@Urgau` I saw the implementation in https://github.com/rust-lang/rust/pull/124761, and I was wondering if we also need to handle field access. We do. Without this PR, we get this errant diagnostic: ``` error: casting references to a bigger memory layout than the backing allocation is undefined behavior, even if the reference is unused --> /home/ben/rust/tests/ui/lint/reference_casting.rs:262:18 | LL | let r = &mut v.0; | --- backing allocation comes from here LL | let ptr = r as *mut i32 as *mut Vec3<i32>; | ------------------------------- casting happend here LL | unsafe { *ptr = Vec3(0, 0, 0) } | ^^^^^^^^^^^^^^^^^^^^ | = note: casting from `i32` (4 bytes) to `Vec3<i32>` (12 bytes) ```
2024-05-09Rollup merge of #124875 - compiler-errors:more-diagnostics-ices, r=estebankMatthias Krüger-35/+190
Fix more ICEs in `diagnostic::on_unimplemented` There were 8 other calls to `expect_local` left in `on_unimplemented.rs` -- all of which (afaict) could be turned into ICEs. I would really like to see validation of `on_unimplemented` separated from parsing, so we only emit errors here: https://github.com/rust-lang/rust/blob/a60f077c38fe66d05449919842d3d73e3299bbab/compiler/rustc_hir_analysis/src/check/check.rs#L836-L839 ...And gracefully fail instead when emitting trait predicate failures, not *ever* even trying to emit an error or a lint. But that's left for a separate PR. r? `@estebank`
2024-05-09Rollup merge of #124837 - GuillaumeGomez:migrate-rustdoc-map-file, r=jieyouxuMatthias Krüger-5/+15
Migrate `run-make/rustdoc-map-file` to rmake Part of https://github.com/rust-lang/rust/issues/121876. r? `@jieyouxu`
2024-05-09Rollup merge of #124777 - veera-sivarajan:bugfix-124495-identify-gen-block, ↵Matthias Krüger-6/+101
r=compiler-errors Fix Error Messages for `break` Inside Coroutines Fixes #124495 Previously, `break` inside `gen` blocks and functions were incorrectly identified to be enclosed by a closure. This PR fixes it by displaying an appropriate error message for async blocks, async closures, async functions, gen blocks, gen closures, gen functions, async gen blocks, async gen closures and async gen functions. Note: gen closure and async gen closure are not supported by the compiler yet but I have added an error message here assuming that they might be implemented in the future. ~~Also, fixes grammar in a few places by replacing `inside of a $coroutine` with `inside a $coroutine`.~~
2024-05-08Auto merge of #124910 - matthiaskrgr:rollup-lo1uvdn, r=matthiaskrgrbors-53/+337
Rollup of 8 pull requests Successful merges: - #123344 (Remove braces when fixing a nested use tree into a single item) - #124587 (Generic `NonZero` post-stabilization changes.) - #124775 (crashes: add lastest batch of crash tests) - #124869 (Make sure we don't deny macro vars w keyword names) - #124876 (Simplify `use crate::rustc_foo::bar` occurrences.) - #124892 (Update cc crate to v1.0.97) - #124903 (Ignore empty RUSTC_WRAPPER in bootstrap) - #124909 (Reapply the part of #124548 that bors forgot) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-08Rollup merge of #124869 - compiler-errors:keyword, r=NilstriebMatthias Krüger-33/+60
Make sure we don't deny macro vars w keyword names `$async:ident`, etc are all valid. Fixes #124862
2024-05-08Rollup merge of #124775 - matthiaskrgr:boom, r=jieyouxuMatthias Krüger-0/+148
crashes: add lastest batch of crash tests
2024-05-08Rollup merge of #124587 - reitermarkus:use-generic-nonzero, r=dtolnayMatthias Krüger-20/+20
Generic `NonZero` post-stabilization changes. Tracking issue: https://github.com/rust-lang/rust/issues/120257 r? ``@dtolnay``
2024-05-08Rollup merge of #123344 - pietroalbini:pa-unused-imports, r=NilstriebMatthias Krüger-0/+109
Remove braces when fixing a nested use tree into a single item [Back in 2019](https://github.com/rust-lang/rust/pull/56645) I added rustfix support for the `unused_imports` lint, to automatically remove them when running `cargo fix`. For the most part this worked great, but when removing all but one childs of a nested use tree it turned `use foo::{Unused, Used}` into `use foo::{Used}`. This is slightly annoying, because it then requires you to run `rustfmt` to get `use foo::Used`. This PR automatically removes braces and the surrouding whitespace when all but one child of a nested use tree are unused. To get it done I had to add the span of the nested use tree to the AST, and refactor a bit the code I wrote back then. A thing I noticed is, there doesn't seem to be any `//@ run-rustfix` test for fixing the `unused_imports` lint. I created a test in `tests/suggestions` (is that the right directory?) that for now tests just what I added in the PR. I can followup in a separate PR to add more tests for fixing `unused_lints`. This PR is best reviewed commit-by-commit.
2024-05-08Handle field projections like slice indexing in invalid_reference_castingBen Kimock-0/+6
2024-05-08Auto merge of #124795 - scottmcm:simplify-slice-from-raw-parts, r=joboetbors-76/+128
Avoid a cast in `ptr::slice_from_raw_parts(_mut)` Casting to `*const ()` or `*mut ()` is no longer needed after https://github.com/rust-lang/rust/pull/123840 so let's make the MIR smaller (and more inline-able, as seen in the tests). If [ACP#362](https://github.com/rust-lang/libs-team/issues/362) goes through we can keep calling `ptr::from_raw_parts(_mut)` in these also without the cast, but that hasn't had any libs-api attention yet, so I'm not waiting on it.
2024-05-08Use generic `NonZero`.Markus Reiter-4/+4
2024-05-08Simplify suggestion.Markus Reiter-16/+16
2024-05-08Rollup merge of #124864 - ↵Matthias Krüger-2/+23
notriddle:notriddle/feature-flags-are-not-stability-markers, r=fmease rustdoc: use stability, instead of features, to decide what to show Fixes #124635 To decide if internal items should be inlined in a doc page, check if the crate is itself internal, rather than if it has the rustc_private feature flag. The standard library uses internal items, but is not itself internal and should not show internal items on its docs pages.
2024-05-08Rollup merge of #124761 - Urgau:ref-casting_bigger_slice_index, r=jieyouxuMatthias Krüger-0/+8
Fix insufficient logic when searching for the underlying allocation This PR fixes the logic inside the `invalid_reference_casting` lint, when trying to lint on bigger memory layout casts. More specifically when looking for the "underlying allocation" we were wrongly assuming that when we got `&mut slice[index]` that `slice[index]` was the allocation, but it's not. Fixes https://github.com/rust-lang/rust/issues/124685
2024-05-08Rollup merge of #124548 - gurry:113272-ice-failed-to-normalize, ↵Matthias Krüger-1/+21
r=compiler-errors Handle normalization failure in `struct_tail_erasing_lifetimes` Fixes #113272 The ICE occurred because the struct being normalized had an error. This PR adds some defensive code to guard against that.
2024-05-08Migrate `run-make/rustdoc-map-file` to rmakeGuillaume Gomez-5/+15
2024-05-07rustdoc: use stability, instead of features, to decide what to showMichael Howell-2/+23
To decide if internal items should be inlined in a doc page, check if the crate is itself internal, rather than if it has the rustc_private feature flag. The standard library uses internal items, but is not itself internal and should not show internal items on its docs pages.
2024-05-07Fix ICEs in diagnostic::on_unimplementedMichael Goulet-0/+134
2024-05-07Add more ICEs due to malformed diagnostic::on_unimplementedMichael Goulet-35/+56
2024-05-08Auto merge of #124683 - estebank:issue-124651, r=compiler-errorsbors-0/+36
Do not ICE on foreign malformed `diagnostic::on_unimplemented` Fix #124651.
2024-05-07Make sure we don't deny macro vars w keyword namesMichael Goulet-33/+60
2024-05-07Add test for #124651Esteban Küber-0/+36
2024-05-07Auto merge of #124223 - Zalathar:conditional-let, r=compiler-errorsbors-10/+34
coverage: Branch coverage support for let-else and if-let This PR adds branch coverage instrumentation for let-else and if-let, including let-chains. This lifts two of the limitations listed at #124118.
2024-05-07Update TestsVeera-6/+101
2024-05-07Auto merge of #124219 - gurry:122989-ice-unexpected-anon-const, ↵bors-8/+200
r=compiler-errors Do not ICE on `AnonConst`s in `diagnostic_hir_wf_check` Fixes #122989 Below is the snippet from #122989 that ICEs: ```rust trait Traitor<const N: N<2> = 1, const N: N<2> = N> { fn N(&N) -> N<2> { M } } trait N<const N: Traitor<2> = 12> {} ``` The `AnonConst` that triggers the ICE is the `2` in the param `const N: N<2> = 1`. The currently existing code in `diagnostic_hir_wf_check` deals only with `AnonConst`s that are default values of some param, but the `2` is not a default value. It is just an `AnonConst` HIR node inside a `TraitRef` HIR node corresponding to `N<2>`. Therefore the existing code cannot handle it and this PR ensures that it does.
2024-05-07Auto merge of #124849 - matthiaskrgr:rollup-68humsk, r=matthiaskrgrbors-4/+132
Rollup of 5 pull requests Successful merges: - #124738 (rustdoc: dedup search form HTML) - #124827 (generalize hr alias: avoid unconstrainable infer vars) - #124832 (narrow down visibilities in `rustc_parse::lexer`) - #124842 (replace another Option<Span> by DUMMY_SP) - #124846 (Don't ICE when we cannot eval a const to a valtree in the new solver) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-07Rollup merge of #124846 - compiler-errors:const-eval, r=lcnrMatthias Krüger-2/+10
Don't ICE when we cannot eval a const to a valtree in the new solver Use `const_eval_resolve` instead of `try_const_eval_resolve` because naming aside, the former doesn't ICE when a value can't be evaluated to a valtree. r? lcnr
2024-05-07Rollup merge of #124827 - lcnr:generalize-incomplete, r=compiler-errorsMatthias Krüger-0/+120
generalize hr alias: avoid unconstrainable infer vars fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/108 see inline comments for more details r? `@compiler-errors` cc `@BoxyUwU`
2024-05-07Rollup merge of #124738 - notriddle:notriddle/search-form-js, r=GuillaumeGomezMatthias Krüger-2/+2
rustdoc: dedup search form HTML This change constructs the search form HTML using JavaScript, instead of plain HTML. It uses a custom element because - the [parser]'s insert algorithm runs the connected callback synchronously, so we won't get layout jank - it requires very little HTML, so it's a real win in size [parser]: https://html.spec.whatwg.org/multipage/parsing.html#create-an-element-for-the-token This shrinks the standard library by about 60MiB, by my test. There should be no visible changes. Just use less disk space.
2024-05-07generalize hr alias: avoid unconstrainable infer varslcnr-0/+120
2024-05-07Don't ICE when we cannot eval a const to a valtree in the new solverMichael Goulet-2/+10
2024-05-07Auto merge of #123332 - Nadrieril:testkind-never, r=matthewjasperbors-18/+231
never patterns: lower never patterns to `Unreachable` in MIR This lowers a `!` pattern to "goto Unreachable". Ideally I'd like to read from the place to make it clear that the UB is coming from an invalid value, but that's tricky so I'm leaving it for later. r? `@compiler-errors` how do you feel about a lil bit of MIR lowering
2024-05-07Auto merge of #124781 - VladimirMakaev:lldb-enum-formatter, r=dtolnaybors-23/+102
Implement lldb formatter for "clang encoded" enums (LLDB 18.1+) (V3) This is a redo of PR (#124458) which was approved previously but force-pushed out. Then a V2 (#124745) failed `debuginfo\msvc-pretty-enums.rs` test during merge. I've fixed the test and checked it to pass on Windows with `.\x.ps1 test .\tests\debuginfo\msvc-pretty-enums.rs` Below is the original summary: ## Summary: fixes #79530 I landed a fix last year to enable `DW_TAG_variant_part` encoding in LLDBs (https://reviews.llvm.org/D149213). This PR is a corresponding fix in synthetic formatters to decode that information. This is in no way perfect implementation but at least it improves the status quo. But most types of enums will be visible and debuggable in some way. I've also updated most of the existing tests that touch enums and re-enabled test cases based on LLDB for enums. ## Test Plan: ran tests `./x test tests/debuginfo/`. Also tested manually in LLDB CLI and LLDB VSCode ## Other Thoughs: A better approach would probably be adopting [formatters from codelldb](https://github.com/vadimcn/codelldb/blob/master/formatters/rust.py). There is some neat hack that hooks up summary provider via synthetic provider which can ultimately fix more display issues for Rust types and enums too. But getting it to work well might take more time that I have right now.
2024-05-07Auto merge of #124830 - aeubanks:dbg, r=durin42bors-10/+10
Adjust dbg.value/dbg.declare checks for LLVM update https://github.com/llvm/llvm-project/pull/89799 changes llvm.dbg.value/declare intrinsics to be in a different, out-of-instruction-line representation. For example call void `@llvm.dbg.declare(...)` becomes #dbg_declare(...) Update tests accordingly to work with both the old and new way.
2024-05-06Adjust dbg.value/dbg.declare checks for LLVM updateArthur Eubanks-10/+10
https://github.com/llvm/llvm-project/pull/89799 changes llvm.dbg.value/declare intrinsics to be in a different, out-of-instruction-line representation. For example call void @llvm.dbg.declare(...) becomes #dbg_declare(...) Update tests accordingly to work with both the old and new way.
2024-05-06Rollup merge of #124809 - lcnr:prepopulate-opaques, r=compiler-errorsMatthias Krüger-46/+36
borrowck: prepopulate opaque storage more eagerly otherwise we ICE due to ambiguity when normalizing while computing implied bounds. r? ``@compiler-errors``
2024-05-06Rollup merge of #124759 - compiler-errors:impl-args, r=lcnrMatthias Krüger-0/+13
Record impl args in the proof tree in new solver Rather than rematching them during select. Also use `ImplSource::Param` instead of `ImplSource::Builtin` for alias-bound candidates, so we don't ICE in `Instance::resolve`. r? lcnr
2024-05-06Use correct ImplSource for alias boundsMichael Goulet-0/+13
2024-05-06Auto merge of #124811 - matthiaskrgr:rollup-4zpov13, r=matthiaskrgrbors-0/+74
Rollup of 4 pull requests Successful merges: - #124520 (Document that `create_dir_all` calls `mkdir`/`CreateDirW` multiple times) - #124724 (Prefer lower vtable candidates in select in new solver) - #124771 (Don't consider candidates with no failing where clauses when refining obligation causes in new solver) - #124808 (Use `super_fold` in `RegionsToStatic` visitor) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-06Rollup merge of #124808 - compiler-errors:super, r=lcnrMatthias Krüger-0/+27
Use `super_fold` in `RegionsToStatic` visitor so as to avoid an infinite stack cycle fixes #124805 r? lcnr
2024-05-06Rollup merge of #124771 - compiler-errors:cand-has-failing-wc, r=lcnrMatthias Krüger-0/+44
Don't consider candidates with no failing where clauses when refining obligation causes in new solver Improves error messages when we have param-env candidates that don't deeply unify (i.e. after alias-bounds). r? lcnr
2024-05-06Rollup merge of #124724 - compiler-errors:prefer-lower, r=lcnrMatthias Krüger-0/+3
Prefer lower vtable candidates in select in new solver Also, adjust the select visitor to only winnow when the *parent* goal is `Certainty::Yes`. This means that we won't winnow in cases when we have any ambiguous inference guidance from two candidates. r? lcnr
2024-05-06Use super_fold in RegionsToStatic visitorMichael Goulet-0/+27
2024-05-06borrowck: more eagerly prepopulate opaqueslcnr-46/+36
2024-05-06Don't consider candidates with no failing where clausesMichael Goulet-0/+44
2024-05-06Prefer lower vtable candidates in select in new solverMichael Goulet-0/+3
2024-05-06Auto merge of #123850 - tspiteri:f16_f128_consts, r=Amanieubors-0/+16
Add constants for f16 and f128 - Commit 1 adds associated constants for `f16`, excluding NaN and infinities as these are implemented using arithmetic for `f32` and `f64`. - Commit 2 adds associated constants for `f128`, excluding NaN and infinities. - Commit 3 adds constants in `std::f16::consts`. - Commit 4 adds constants in `std::f128::consts`.
2024-05-06Auto merge of #124753 - GuillaumeGomez:migrate-rustdoc-determinism, r=jieyouxubors-47/+77
Migrate `run-make/rustdoc-error-lines` to new `rmake.rs` Part of https://github.com/rust-lang/rust/issues/121876. There was a weird naming inconsistency with `input`/`output`. A few tests write `.arg("-o").arg(path)` and the `output` method was actually the command output. So instead, I renamed the original `output` into `command_output` so that I could create the `output` method with the expected effect (and updated the tests to use it too). EDIT: The first two commits come from https://github.com/rust-lang/rust/pull/124711. Some weird things happened recently pparently. ^^' r? `@jieyouxu`