about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
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-08Add tests to ensure that <table> don't break doc blocks width anymoreGuillaume Gomez-0/+33
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-07Fix duplicate errorjackh726-27/+6
2021-09-07Detect stricter constraints on gats where clauses in impls vs traitjackh726-20/+57
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-07remap-cwd-prefixdanakj-0/+42
2021-09-07Rename rustc_mir to rustc_const_eval.Camille GILLOT-1/+1
2021-09-07Recover from `Foo(a: 1, b: 2)`Esteban Kuber-24/+42
Detect likely `struct` literal using parentheses as delimiters and emit targeted suggestion instead of type ascription parse error. Fix #61326.
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-07test: add case for mutating iteratorMichael Howell-1/+44
Note that this incorrectly suggests a shared borrow, but at least we know it's happening.
2021-09-06Suggest wapping expr in parentheses on invalid unary negationAndrew Hickman-2/+34
Fixes #88701
2021-09-06Normalize assoc types when checking ret ty of mainThePuzzlemaker-0/+19
This fixes #88609. Previously, the return type of `fn main()` would not have any associated type projections within normalized before checking if it implements the standard library trait `std::process::Termination`. This commit appears to fix it. This feels vaguely symptomatic of a problem in the underlying trait solving engine, but I am not sure how I would solve that. I am unsure why the example in #88609 with `assert_impl_termination` and `fn foo()` work, but simply `fn main()` doesn't. The way that I solved this is also probably not the best way to do this, so please let me know if there is a better way to do this. I have added a build-pass regression test for this issue.
2021-09-06fix ICE on hidden tuple variant fieldsEmil Gardström-0/+34
this also renders them as `_`, which rustdoc previously did not.
2021-09-06Add test for braced-macro followed by `.` or `?`.Mara Bos-0/+9
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-04test for issue #77175Stefano Buliani-0/+19
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`.