about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2021-09-08Auto merge of #80522 - cjgillot:borrowcrate, r=oli-obkbors-5/+5
Split rustc_mir The `rustc_mir` crate is the second largest in the compiler. This PR splits it up into 5 crates: - rustc_borrowck; - rustc_const_eval; - rustc_mir_dataflow; - rustc_mir_transform; - rustc_monomorphize.
2021-09-08Update run-make-fulldeps.Camille GILLOT-4/+4
2021-09-08Rollup merge of #88691 - hyd-dev:88649, r=Mark-SimulacrumJack Huey-0/+18
Add a regression test for #88649 I noticed that #88649 does not have a regression test, so I add one in this PR. The test fails with this without #88678: ``` error[E0080]: evaluation of constant value failed --> /checkout/src/test/ui/consts/issue-88649.rs:13:52 | LL | Foo::Variant1(x) | Foo::Variant2(x) if x => {} | ^ StorageLive on a local that was already live error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. ```
2021-09-08Rollup merge of #88553 - theo-lw:issue-88276, r=estebankJack Huey-6/+78
Improve diagnostics for unary plus operators (#88276) This pull request improves the diagnostics emitted on parsing a unary plus operator. See #88276. Before: ``` error: expected expression, found `+` --> src/main.rs:2:13 | 2 | let x = +1; | ^ expected expression ``` After: ``` error: leading `+` is not supported --> main.rs:2:13 | 2 | let x = +1; | ^ | | | unexpected `+` | help: try removing the `+` ```
2021-09-08Rollup merge of #88541 - vandenheuvel:regression_test_74400, r=Mark-SimulacrumJack Huey-0/+54
Add regression test for #74400 Closes #74400 by adding a regression test.
2021-09-08Rollup merge of #86263 - fee1-dead:rustdoc-layout-variants, r=camelidJack Huey-0/+18
Rustdoc: Report Layout of enum variants Followup of #83501, Fixes #86253. cc `@camelid` `@rustbot` label A-rustdoc
2021-09-08Auto merge of #86943 - ptrojahn:suggest_derive, r=estebankbors-0/+148
Suggest deriving traits if possible This only applies to builtin derives as I don't think there is a clean way to get the available derives in typeck. Closes #85851
2021-09-08Auto merge of #88061 - jackh726:genericbound-cleanup, r=estebankbors-49/+56
Remove `hir::GenericBound::Unsized` Rather than "moving" the `?Sized` bounds to the param bounds, just also check where clauses in `astconv`. I also did some related cleanup here, but that's not strictly neccesary. Also going to do a perf run here. r? `@estebank`
2021-09-08Auto merge of #88477 - sexxi-goose:issue-88476, r=nikomatsakisbors-0/+206
2229: Don't move out of drop type Fixes #88476 r? `@nikomatsakis`
2021-09-07A bit of cleanup to astconvjackh726-45/+45
2021-09-07Don't move ?Trait bounds to param bounds if they're in where clausesjackh726-4/+11
2021-09-07Rename rustc_mir to rustc_const_eval.Camille GILLOT-1/+1
2021-09-07Auto merge of #88161 - michaelwoerister:fix-whole-archive-no-bundle, ↵bors-0/+118
r=petrochenkov Fix handling of +whole-archive native link modifier. This PR fixes a bug in `add_upstream_native_libraries` that led to the `+whole-archive` modifier being ignored when linking in native libs. ~~Note that the PR does not address the situation when `+whole-archive` is combined with `+bundle`.~~ `@wesleywiser's` commit adds validation code that turns combining `+whole-archive` with `+bundle` into an error. Fixes https://github.com/rust-lang/rust/issues/88085. r? `@petrochenkov` cc `@wesleywiser` `@gcoakes`
2021-09-07Add test case for no-bundle/whole-archive native libs linking.Michael Woerister-0/+87
2021-09-06Add a regression test for https://github.com/rust-lang/rust/issues/88649hyd-dev-0/+18
2021-09-06Auto merge of #88686 - rylev:rollup-m1tf9ir, r=m-ou-sebors-1/+204
Rollup of 6 pull requests Successful merges: - #88602 (Add tests for some const generics issues) - #88647 (Document when to use Windows' `symlink_dir` vs. `symlink_file`) - #88659 (Remove SmallVector mention) - #88661 (Correct typo) - #88673 (Fix typo: needede -> needed) - #88685 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-09-06Suggest deriving traits if possiblePaul Trojahn-0/+148
This only applies to builtin derives as I don't think there is a clean way to get the available derives in typeck. Closes #85851
2021-09-06Auto merge of #88678 - matthewjasper:if-boolean-scoping, r=oli-obkbors-19/+20
Change scope of temporaries in match guards Each pattern in a match arm has its own copy of the match guard in MIR, with its own temporary, so it has to be dropped before the the guards are joined to the single copy of the arm. This PR changes `then_else_break` to allow it to put the temporary in the innermost scope possible. This change isn't done for `if` expressions because that affects a large number of mir-opt tests and could more significantly affect performance. closes #88649 r? `@oli-obk`
2021-09-06Rollup merge of #88661 - est31:typo_fix_in_test, r=joshtriplettRyan Levick-1/+1
Correct typo found while addressing reviewer remarks for #88316
2021-09-06Rollup merge of #88602 - BoxyUwU:tests-uwu-nya, r=lcnrRyan Levick-0/+203
Add tests for some const generics issues closes #82956 closes #84659 closes #86530 closes #86535 there is also a random test in here about array repeat expressions that I already had on this branch but it seems to fit the theme of this PR so kept it... r? `@lcnr`
2021-09-06Auto merge of #88631 - camelid:sugg-span, r=davidtwcobors-9/+152
Improve structured tuple struct suggestion Previously, the span was just for the constructor name, which meant it would result in syntactically-invalid code when applied. Now, the span is for the entire expression. I also changed it to use `span_suggestion_verbose`, for two reasons: 1. Now that the suggestion span has been corrected, the output is a bit cluttered and hard to read. Putting the suggestion its own window creates more space. 2. It's easier to see what's being suggested, since now the version after the suggestion is applied is shown. r? `@davidtwco`
2021-09-06Correctly handle niche of enumDeadbeef-0/+9
2021-09-06Auto merge of #88640 - SkiFire13:tests-for-85499, r=jackh726bors-0/+144
Add tests for issues fixed by #85499 Closes #80706 Closes #80956 Closes #81809 Closes #85455
2021-09-06Auto merge of #88493 - chenyukang:fix-duplicated-diagnostic, r=estebankbors-31/+5
Fix #88256 remove duplicated diagnostics Fix #88256
2021-09-06Add regression test for #74400Bram van den Heuvel-0/+54
2021-09-05Auto merge of #88435 - cjgillot:no-walk-crate, r=Aaron1011bors-17/+34
Avoid invoking the hir_crate query to traverse the HIR Walking the HIR tree is done using the `hir_crate` query. However, this is unnecessary, since `hir_owner(CRATE_DEF_ID)` provides the same information. Since depending on `hir_crate` forces dependents to always be executed, this leads to unnecessary work. By splitting HIR and attributes visits, we can avoid an edge to `hir_crate` when trying to visit the HIR tree.
2021-09-05Auto merge of #88552 - nbdd0121:vtable, r=nagisabors-4/+41
Stop allocating vtable entries for non-object-safe methods Current a vtable entry is allocated for all associated fns, even if the method is not object-safe: https://godbolt.org/z/h7vx6f35T As a result, each vtable for `Iterator`' currently consumes 74 `usize`s. This PR stops allocating vtable entries for those methods, reducing vtable size of each `Iterator` vtable to 7 `usize`s. Note that this PR introduces will cause more invocations of `is_vtable_safe_method`. So a perf run might be needed. If result isn't favorable then we might need to query-ify `is_vtable_safe_method`.
2021-09-05Change scope of temporaries in match guardsMatthew Jasper-19/+20
Each pattern in a match arm has its own copy of the match guard in MIR, with its own temporary, so it has to be dropped before the the guards are joined to the single copy of the arm.
2021-09-05Stop allocating vtable entries for non-object-safe methodsGary Guo-4/+41
2021-09-05Auto merge of #88604 - camelid:rustdoc-lifetime-bounds, r=GuillaumeGomezbors-1/+20
rustdoc: Clean up handling of lifetime bounds Previously, rustdoc recorded lifetime bounds by rendering them into the name of the lifetime parameter. Now, it leaves the name as the actual name and instead records lifetime bounds in an `outlives` list, similar to how type parameter bounds are recorded. Also, higher-ranked lifetimes cannot currently have bounds, so I simplified the code to reflect that. r? `@GuillaumeGomez`
2021-09-05Add testsGiacomo Stevanato-0/+144
2021-09-05Rollup merge of #88657 - camelid:fix-dyn-sugg, r=m-ou-seMara Bos-0/+21
Fix 2021 `dyn` suggestion that used code as label The arguments to `span_suggestion` were in the wrong order, so the error looked like this: error[E0783]: trait objects without an explicit `dyn` are deprecated --> src/test/ui/editions/dyn-trait-sugg-2021.rs:10:5 | 10 | Foo::hi(123); | ^^^ help: <dyn Foo>: `use `dyn`` Now the error looks like this, as expected: error[E0783]: trait objects without an explicit `dyn` are deprecated --> src/test/ui/editions/dyn-trait-sugg-2021.rs:10:5 | 10 | Foo::hi(123); | ^^^ help: use `dyn`: `<dyn Foo>` This issue was only present in the 2021 error; the 2018 lint was correct. r? `@m-ou-se`
2021-09-05Rollup merge of #88257 - estebank:invalid-attr-error, r=oli-obkMara Bos-46/+263
Provide more context on incorrect inner attribute Suggest changing an inner attribute into an outer attribute if followed by an item.
2021-09-05Correct typoest31-1/+1
2021-09-04Use verbose suggestions and only match if the + is seen before a numeric literalTheodore Luo Wang-88/+48
2021-09-04Fix 2021 `dyn` suggestion that used code as labelNoah Lev-0/+21
The arguments to `span_suggestion` were in the wrong order, so the error looked like this: error[E0783]: trait objects without an explicit `dyn` are deprecated --> src/test/ui/editions/dyn-trait-sugg-2021.rs:10:5 | 10 | Foo::hi(123); | ^^^ help: <dyn Foo>: `use `dyn`` Now the error looks like this, as expected: error[E0783]: trait objects without an explicit `dyn` are deprecated --> src/test/ui/editions/dyn-trait-sugg-2021.rs:10:5 | 10 | Foo::hi(123); | ^^^ help: use `dyn`: `<dyn Foo>` This issue was only present in the 2021 error; the 2018 lint was correct.
2021-09-04Fix #88256, remove duplicated diagnosticyukang-31/+5
2021-09-04Auto merge of #88547 - notriddle:notriddle/is-expr-delims-necessary, r=davidtwcobors-0/+94
fix(rustc_lint): better detect when parens are necessary Fixes #88519
2021-09-04Auto merge of #88598 - estebank:type-ascription-can-die-in-a-fire, r=wesleywiserbors-0/+11
Detect bare blocks with type ascription that were meant to be a `struct` literal Address part of #34255. Potential improvement: silence the other knock down errors in `issue-34255-1.rs`.
2021-09-03Auto merge of #88482 - athei:add-import-test, r=the8472bors-0/+30
Add regression test for a spurious import This PR adds a test that verifies that the bug described in the linked issue does not creep back into the code. In essence it checks that compiling some specific code (that uses 128 bit multiplication) with a specific set of compiler options does not lead to a spurious import of a panic function. I noticed that other wasm tests use `# only-wasm32-bare` in their `Makefile`. This will skip the test for me. I did not find out how to run this test locally. Maybe someone can help. closes #78744 r? `@jyn514`
2021-09-03Auto merge of #88572 - matthewjasper:if-let-scoping-fix, r=oli-obkbors-447/+401
Fix drop handling for `if let` expressions MIR lowering for `if let` expressions is now more complicated now that `if let` exists in HIR. This PR adds a scope for the variables bound in an `if let` expression and then uses an approach similar to how we handle loops to ensure that we reliably drop the correct variables. Closes #88307 cc `@flip1995` `@richkadel` `@c410-f3r`
2021-09-03Update coverage testsMatthew Jasper-5/+5
2021-09-03Auto merge of #88597 - cjgillot:lower-global, r=petrochenkovbors-128/+128
Move global analyses from lowering to resolution Split off https://github.com/rust-lang/rust/pull/87234 r? `@petrochenkov`
2021-09-03Detect bare blocks with type ascription that were meant to be a `struct` literalEsteban Kuber-0/+11
Address part of #34255. Potential improvement: silence the other knock down errors in `issue-34255-1.rs`.
2021-09-032229: Don't move out of drop typeAman Arora-0/+206
2021-09-03Auto merge of #88428 - petrochenkov:stmtid, r=Aaron1011bors-0/+25
expand: Treat more macro calls as statement macro calls This PR implements the suggestion from https://github.com/rust-lang/rust/pull/87981#issuecomment-906641052 and treats fn-like macro calls inside `StmtKind::Item` and `StmtKind::Semi` as statement macro calls, which is consistent with treatment of attribute invocations in the same positions and with token-based macro expansion model in general. This also allows to remove a special case in `NodeId` assignment (previously tried in #87779), and to use statement `NodeId`s for linting (`assign_id!`). r? `@Aaron1011`
2021-09-03Auto merge of #88386 - estebank:unmatched-delims, r=jackh726bors-64/+64
Point at unclosed delimiters as part of the primary MultiSpan Both the place where the parser encounters a needed closed delimiter and the unclosed opening delimiter are important, so they should get the same level of highlighting in the output. _Context: https://twitter.com/mwk4/status/1430631546432675840_
2021-09-03Auto merge of #88363 - michaelwoerister:remapped-diagnostics, r=estebankbors-0/+18
Path remapping: Make behavior of diagnostics output dependent on presence of --remap-path-prefix. This PR fixes a regression (#87745) with `--remap-path-prefix` where the flag stopped causing diagnostic messages to be remapped as well. The regression was introduced in https://github.com/rust-lang/rust/pull/83813 where we erroneously assumed that remapping of diagnostic messages was not desired anymore (because #70642 partially undid that functionality with nobody objecting). The issue is fixed by making `--remap-path-prefix` remap diagnostic messages again, including for paths that have been remapped in upstream crates (e.g. the standard library). This means that "sysroot-localization" (implemented in #70642) is also disabled if `rustc` is invoked with `--remap-path-prefix`. The assumption is that once someone starts explicitly remapping paths they also don't want paths to their local Rust installation in their build output. In the future we might want to give more fine-grained control over this behavior via compiler flags (see https://github.com/rust-lang/rfcs/pull/3127 for a related RFC). For now this PR is intended as a regression fix. This PR is an alternative to https://github.com/rust-lang/rust/pull/88191, which makes diagnostic messages be remapped unconditionally. That approach, however, would effectively revert #70642. Fixes https://github.com/rust-lang/rust/issues/87745. cc `@cbeuw` r? `@ghost`
2021-09-02rustdoc: Higher-ranked lifetimes can't have boundsNoah Lev-0/+19
This cleans up the other spot I found where rustdoc was rendering bounds into the lifetime name itself. However, in this case, I don't think it could have actually happened because higher-ranked lifetime definitions aren't currently allowed to have bounds.
2021-09-02rustdoc: Clean up handling of lifetime boundsNoah Lev-1/+1
Previously, rustdoc recorded lifetime bounds by rendering them into the name of the lifetime parameter. Now, it leaves the name as the actual name and instead records lifetime bounds in an `outlives` list, similar to how type parameter bounds are recorded.