about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-08-09Rollup merge of #100305 - ↵Dylan DPC-0/+43
TaKO8Ki:suggest-adding-appropriate-missing-pattern-excluding-comments, r=compiler-errors Suggest adding an appropriate missing pattern excluding comments fixes #100272
2022-08-09Rollup merge of #100228 - luqmana:suggestion-ice, r=estebankDylan DPC-0/+49
Don't ICE while suggesting updating item path. When an item isn't found, we may suggest an appropriate import to `use`. Along with that, we also suggest updating the path to work with the `use`. Unfortunately, if the code in question originates from a macro, the span used to indicate which part of the path needs updating may not be suitable and cause an ICE (*). Since, such code is not adjustable directly by the user without modifying the macro, just skip the suggestion in such cases. (*) The ICE happens because the emitter want to indicate to the user what code to delete by referencing a certain span. But in this case, said span has `lo == hi == 0` which means it thinks it's a dummy span. Adding a space before the proc macro attribute is enough to stop it from ICE'ing but even then the suggestion doesn't really make any sense: ``` help: if you import `DataStore`, refer to it directly | 1 - #[dbstruct::dbstruct] 1 + #[dbstruct::dbstruct] ``` Since suggestions are best-effort, I just gated this one on `can_be_used_for_suggestions` which catches cases like this. Fixes #100199
2022-08-09Rollup merge of #96478 - WaffleLapkin:rustc_default_body_unstable, r=Aaron1011Dylan DPC-0/+125
Implement `#[rustc_default_body_unstable]` This PR implements a new stability attribute — `#[rustc_default_body_unstable]`. `#[rustc_default_body_unstable]` controls the stability of default bodies in traits. For example: ```rust pub trait Trait { #[rustc_default_body_unstable(feature = "feat", isssue = "none")] fn item() {} } ``` In order to implement `Trait` user needs to either - implement `item` (even though it has a default implementation) - enable `#![feature(feat)]` This is useful in conjunction with [`#[rustc_must_implement_one_of]`](https://github.com/rust-lang/rust/pull/92164), we may want to relax requirements for a trait, for example allowing implementing either of `PartialEq::{eq, ne}`, but do so in a safe way — making implementation of only `PartialEq::ne` unstable. r? `@Aaron1011` cc `@nrc` (iirc you were interested in this wrt `read_buf`), `@danielhenrymantilla` (you were interested in the related `#[rustc_must_implement_one_of]`) P.S. This is my first time working with stability attributes, so I'm not sure if I did everything right 😅
2022-08-09don't normalize wf predicateslcnr-76/+136
this allows us to soundly use unnormalized projections for wf
2022-08-09Keep going if normalized projection has unevaluated consts in QueryNormalizerMichael Goulet-0/+279
2022-08-09Extend comma suggestion to cases where fields arent missingMichael Goulet-11/+60
2022-08-09Move JSON tests into a directory.Nicholas Nethercote-2/+2
To get around the "following path contains more than 968 entries, you should move the test to some relevant subdirectory" tidy error.
2022-08-09suggest adding an appropriate missing pattern excluding commentsTakayuki Maeda-0/+43
2022-08-09Rollup merge of #100268 - TaKO8Ki:add-regression-test-for-79148, ↵Matthias Krüger-0/+45
r=Mark-Simulacrum Add regression test for #79148 closes #79148
2022-08-09Rollup merge of #100238 - Bryysen:master, r=cjgillotMatthias Krüger-101/+78
Further improve error message for E0081 Closes #97533
2022-08-09Rollup merge of #100163 - TaKO8Ki:remove-unnecessary-string-search, ↵Matthias Krüger-3/+6
r=wesleywiser Refactor: remove an unnecessary string search
2022-08-09Add ui test for #100197Obei Sideg-0/+20
Recover from mutable variable declaration where `mut` is placed before `let`
2022-08-08Fix plural form of `variant` in error message not formatting correctlyBryysen-32/+26
due to ordering, added/improved comments and removed redundant test already caught by `E0081.rs`
2022-08-08Add test for #100246.Luqman Aden-0/+43
2022-08-08add regression test for #79148Takayuki Maeda-0/+45
2022-08-08Auto merge of #98863 - compiler-errors:projection-msg, r=estebankbors-65/+75
Implement special-cased projection error message for some common traits Not sure what the best phrasing is, but I feel like these are more clear than the plain `<Type as Iterator>::Output == Type` messages. If this is actually a good idea, are there any other traits this could benefit?
2022-08-08Auto merge of #98489 - cjgillot:naked-nohir, r=davidtwco,tmiaskobors-58/+45
Only fetch HIR for naked functions that have the attribute.
2022-08-08Adjust wordingMichael Goulet-65/+74
2022-08-07Implement special-cased projection error message for some common traitsMichael Goulet-30/+31
2022-08-07Add tuple trait testsMichael Goulet-3/+97
2022-08-07Add UI test for #100199Luqman Aden-0/+49
2022-08-07Rollup merge of #100230 - cjgillot:noice-multibyte-amp, r=compiler-errorsMatthias Krüger-0/+33
Use start_point instead of next_point to point to elided lifetime amp… Using `next_point` creates a span which points inside the multibyte token, ICEing. Fixes https://github.com/rust-lang/rust/issues/100224
2022-08-07Rollup merge of #100194 - est31:box_syntax_tests, r=Mark-SimulacrumMatthias Krüger-181/+124
Remove even more box syntax uses from src/test Prior work, notably #88316 has removed box syntax from most of the testsuite. However, some tests were left out. This commit removes box_syntax uses from more locations in src/test. This migrates the tests where `box` is mostly an "implementation detail" and not the primary thing being tested by the test. Furthermore, some tests from the mir-opt test suite are not being migrated.
2022-08-07Rollup merge of #100019 - ↵Matthias Krüger-0/+181
TaKO8Ki:suggest-boxed-trait-objects-instead-of-impl-trait, r=compiler-errors Revive suggestions for boxed trait objects instead of impl Trait The suggestion implemented in #75608 was not working properly, so I fixed it.
2022-08-07Fail gracefully when const pattern is not structural match.Camille GILLOT-0/+41
2022-08-07Further improve error message for E0081Bryysen-77/+60
Multiple duplicate assignments of the same discriminant are now reported in the samme error. We now point out the incrementation start point for discriminants that are not explicitly assigned that are also duplicates. Removed old test related to E0081 that is now covered by error-codes/E0081.rs. Also refactored parts of the `check_enum` function.
2022-08-07add -Zextra-const-ub-checks to enable more UB checking in const-evalRalf Jung-0/+114
2022-08-07Use start_point instead of next_point to point to elided lifetime ampersand.Camille GILLOT-0/+33
2022-08-07Do not manually craft a span pointing inside a multibyte character.Camille GILLOT-0/+54
2022-08-07fix wrong suggestions for boxed trait objects instead of impl traitTakayuki Maeda-4/+88
2022-08-07revive suggestions for boxed trait objects instead of impl TraitTakayuki Maeda-0/+97
2022-08-07Auto merge of #100091 - chenyukang:add-check-for-link-ordinal, ↵bors-0/+54
r=michaelwoerister Check link ordinal to make sure it is targetted for foreign function Fix #100009, when link ordinal is not target for foreign functions, emit an error. cc `@dpaoliello`
2022-08-07Remove even more box syntax uses from src/testest31-181/+124
Prior work, notably 6550021124451628b1efc60c59284465b109e3aa from #88316 has removed box syntax from most of the testsuite. However, some tests were left out. This commit removes box_syntax uses from more locations in src/test. Some tests that are very box syntax specific are not being migrated.
2022-08-07Rollup merge of #100130 - compiler-errors:erroneous-return-span, r=lcnrMatthias Krüger-15/+136
Avoid pointing out `return` span if it has nothing to do with type error This code: ```rust fn f(_: String) {} fn main() { let x = || { if true { return (); } f(""); }; } ``` Emits this: ``` Compiling playground v0.0.1 (/playground) error[E0308]: mismatched types --> src/main.rs:8:11 | 8 | f(""); | ^^- help: try using a conversion method: `.to_string()` | | | expected struct `String`, found `&str` | note: return type inferred to be `String` here --> src/main.rs:6:20 | 6 | return (); | ^^ ``` Specifically, that note has nothing to do with the type error in question. This is because the change implemented in #84244 tries to point out the `return` span on _any_ type coercion error within a closure that happens after a `return` statement, regardless of if the error has anything to do with it. This is really easy to trigger -- just needs a closure (or an `async`) and an early return (or any other form, e.g. `?` operator suffices) -- and super distracting in production codebases. I'm letting #84128 regress because that issue is much harder to fix correctly, and I can re-open that issue after this lands. As a drive-by, I added a `resolve_vars_if_possible` to the coercion error logic, which leads to some error improvements. Unrelated to the issue above, though.
2022-08-06make NOP dyn casts not require anything about the vtableRalf Jung-20/+38
2022-08-06Bless ui tests.Camille GILLOT-5/+5
2022-08-06Auto merge of #100195 - matthiaskrgr:rollup-ovzyyb0, r=matthiaskrgrbors-2/+86
Rollup of 4 pull requests Successful merges: - #100094 (Detect type mismatch due to loop that might never iterate) - #100132 (Use (actually) dummy place for let-else divergence) - #100167 (Recover `require`, `include` instead of `use` in item) - #100193 (Remove more Clean trait implementations) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-06Rollup merge of #100167 - chenyukang:require-suggestion, r=estebankMatthias Krüger-2/+30
Recover `require`, `include` instead of `use` in item Fix #100140
2022-08-06Rollup merge of #100132 - compiler-errors:issue-100103, r=tmiaskoMatthias Krüger-0/+15
Use (actually) dummy place for let-else divergence Fixes #100103
2022-08-06Rollup merge of #100094 - lyming2007:issue-98982, r=estebankMatthias Krüger-0/+41
Detect type mismatch due to loop that might never iterate When loop as tail expression causes a miss match type E0308 error, recursively get the return statement and add diagnostic information on it.
2022-08-06Auto merge of #99893 - compiler-errors:issue-99387, r=davidtwcobors-0/+24
Delay formatting trimmed path until lint/error is emitted Fixes #99387 r? `@davidtwco`
2022-08-05Fix ReErased leaking into typeck due to typeof recoveryMichael Goulet-0/+20
2022-08-05implement #98982Yiming Lei-0/+41
when loop as tail expression for miss match type E0308 error, recursively get the return statement and add diagnostic information on it use rustc_hir::intravisit to collect the return expression modified: compiler/rustc_typeck/src/check/coercion.rs new file: src/test/ui/typeck/issue-98982.rs new file: src/test/ui/typeck/issue-98982.stderr
2022-08-05Use `#![warn(let_underscore_drop)]` in tests.Aaron Kofsky-2/+6
2022-08-05Delay formatting trimmed path until lint/error is emittedMichael Goulet-0/+24
2022-08-05Rollup merge of #100168 - ↵Dylan DPC-54/+86
WaffleLapkin:improve_diagnostics_for_missing_type_in_a_const_item, r=compiler-errors Improve diagnostics for `const a: = expr;` Adds a suggestion to write a type when there is a colon, but the type is not present. I've also shrunk spans a little, so the suggestions are a little nicer. Resolves #100146 r? `@compiler-errors`
2022-08-05Rollup merge of #100155 - compiler-errors:issue-100154, r=jackh726Dylan DPC-2/+44
Use `node_type_opt` to skip over generics that were not expected Fixes #100154
2022-08-05Rollup merge of #99835 - ↵Dylan DPC-2/+111
TaKO8Ki:suggest-adding-or-removing-ref-for-binding-pattern, r=estebank Suggest adding/removing `ref` for binding patterns This fixes what a fixme comment says. r? `@estebank`
2022-08-05Ignore test on wasmWesley Wiser-0/+1
2022-08-05Auto merge of #100073 - dpaoliello:externvar, r=michaelwoeristerbors-7/+88
Add test for raw-dylib with an external variable All existing tests of link kind `raw-dylib` only validate the ability to link against functions, but it is also possible to link against variables. This adds tests for linking against a variable using `raw-dylib` both by-name and by-ordinal.