about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
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-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-05Stop allocating vtable entries for non-object-safe methodsGary Guo-4/+41
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/+10
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 #88572 - matthewjasper:if-let-scoping-fix, r=oli-obkbors-16/+19
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-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/+10
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-02Auto merge of #85868 - Aaron1011:projection-cache, r=jackh726bors-31/+31
Preserve most sub-obligations in the projection cache Fixes https://github.com/rust-lang/rust/issues/85360 When we evaluate a projection predicate, we may produce sub-obligations. During trait evaluation, evaluating these sub-obligations might cause us to produce `EvaluatedToOkModuloRegions`. When we cache the result of projection in our projection cache, we try to throw away some of the sub-obligations, so that we don't need to re-evaluate/process them the next time we need to perform this particular projection. However, we may end up throwing away predicates that will (recursively) evaluate to `EvaluatedToOkModuloRegions`. If we do, then the result of evaluating a predicate will depend on the state of the predicate cache - this is global untracked state, which interacts badly with incremental compilation. To fix this, we now only discard global predicates that evaluate to `EvaluatedToOk`. This ensures that any predicates that (may) evaluate to `EvaluatedToOkModuloRegions` are kept in the cache, and influence the results of any queries which perform this projection.
2021-09-02tidyEllen-2/+2
2021-09-02E-not-needs-testEllen-0/+203
2021-09-02Provide more context on incorrect inner attributeEsteban Kuber-46/+263
Suggest changing an inner attribute into an outer attribute if followed by an item.
2021-09-02Bless ast-json tests.Camille GILLOT-2/+2
2021-09-02Rollup merge of #88592 - b-naber:region_substs, r=oli-obkMara Bos-0/+26
Fix ICE in const check Fixes https://github.com/rust-lang/rust/issues/88433
2021-09-02Rollup merge of #88565 - lqd:issue-83190, r=spastorinoMara Bos-0/+49
Add regression test for issue 83190 Reduced from `bioyino-metric` by ````@hellow554```` and myself. Closes #83190. r? ````@spastorino````
2021-09-02Rollup merge of #88543 - m-ou-se:closure-migration-macro-block-fragment, ↵Mara Bos-0/+86
r=estebank Improve closure dummy capture suggestion in macros. Fixes some cases of https://github.com/rust-lang/rust/issues/88440 Fixes https://crater-reports.s3.amazonaws.com/pr-87190-3/try%23a7a572ce3edd6d476191fbfe92c9c1986e009b34/reg/rcodec-1.0.1/log.txt
2021-09-02Rollup merge of #88512 - m-ou-se:array-into-iter-deref-stuff, r=estebankMara Bos-82/+31
Upgrade array_into_iter lint to include Deref-to-array types. Fixes https://github.com/rust-lang/rust/issues/88099 Fixes the issue mentioned here: https://github.com/rust-lang/rust/pull/84147#issuecomment-819000436
2021-09-02Bless tests.Camille GILLOT-17/+34
2021-09-02Report cycle error using 'deepest' obligation in the cycleAaron Hill-18/+36
2021-09-02Preserve most sub-obligations in the projection cacheAaron Hill-33/+15
2021-09-02add testb-naber-0/+26
2021-09-02expand: Treat more macro calls as statement macro callsVadim Petrochenkov-0/+25
2021-09-01fix(test): update with `&mut` suggestionMichael Howell-2/+5
2021-09-01Ensure suggestion is in its own diagnostic windowNoah Lev-44/+66
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.
2021-09-01Fix span used for structured tuple struct suggestionNoah Lev-6/+127
(And same for tuple variants.) 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.
2021-09-01fix(rustc): suggest `items` be borrowed in `for i in items[x..]`Michael Howell-0/+44
Fixes #87994
2021-09-01Fix drop handling for `if let` expressionsMatthew Jasper-16/+19
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.
2021-09-01Stop sorting bodies by span.Camille GILLOT-126/+126
The definition order is already close to the span order, and only differs in corner cases.
2021-09-01add regression test for issue 83190Rémy Rakic-0/+49
2021-09-01Add checks for a block before a unary plus. Fix failing testsTheodore Luo Wang-45/+48
2021-09-01Rollup merge of #88525 - notriddle:notriddle/coherence-dyn-auto-trait, ↵Mara Bos-0/+29
r=petrochenkov fix(rustc_typeck): produce better errors for dyn auto trait Fixes #85026
2021-09-01Rollup merge of #86376 - asquared31415:extern-no-mangle-84204, r=Mark-SimulacrumMara Bos-0/+72
Emit specific warning to clarify that `#[no_mangle]` should not be applied on foreign statics or functions Foreign statics and foreign functions should not have `#[no_mangle]` applied, as it does nothing to the name and has some extra hidden behavior that is normally unwanted. There was an existing warning for this, but it says the attribute is only allowed on "statics or functions", which to the user can be confusing. This PR adds a specific version of the unused `#[no_mangle]` warning that explains that the target is a *foreign* static or function and that they do not need the attribute. Fixes #78989
2021-08-31fix(rustc_lint): better detect when parens are necessaryMichael Howell-0/+94
Fixes #88519
2021-09-01Auto merge of #88121 - camelid:better-recursive-alias-error, r=estebankbors-18/+113
Improve errors for recursive type aliases Fixes #17539.