summary refs log tree commit diff
path: root/tests/ui/issues
AgeCommit message (Collapse)AuthorLines
2024-03-04Improve wording of static_mut_refObei Sideg-7/+7
Rename `static_mut_ref` lint to `static_mut_refs`. (cherry picked from commit 408eeae59d35cbcaab2cfb345d24373954e74fc5)
2024-01-30Provide more context on derived obligation error primary labelEsteban Küber-5/+5
Expand the primary span of E0277 when the immediate unmet bound is not what the user wrote: ``` error[E0277]: the trait bound `i32: Bar` is not satisfied --> f100.rs:6:6 | 6 | <i32 as Foo>::foo(); | ^^^ the trait `Bar` is not implemented for `i32`, which is required by `i32: Foo` | help: this trait has no implementations, consider adding one --> f100.rs:2:1 | 2 | trait Bar {} | ^^^^^^^^^ note: required for `i32` to implement `Foo` --> f100.rs:3:14 | 3 | impl<T: Bar> Foo for T {} | --- ^^^ ^ | | | unsatisfied trait bound introduced here ``` Fix #40120.
2024-01-30Rollup merge of #120293 - estebank:issue-102629, r=nnethercoteGuillaume Gomez-2/+2
Deduplicate more sized errors on call exprs Change the implicit `Sized` `Obligation` `Span` for call expressions to include the whole expression. This aids the existing deduplication machinery to reduce the number of errors caused by a single unsized expression.
2024-01-29Move multiple UI issue tests to subdirectoriesMarek 'seqre' Grzelak-0/+0
Issue tests numbered 1920, 3668, 5997, 23302, 32122, 40510, 57741, 71676, and 76077 were moved to relevant better-named subdirectories. ISSUES_ENTRY_LIMIT was adjusted to match new number of files and FIXME note was expanded.
2024-01-24Deduplicate more sized errors on call exprsEsteban Küber-2/+2
Change the implicit `Sized` `Obligation` `Span` for call expressions to include the whole expression. This aids the existing deduplication machinery to reduce the number of errors caused by a single unsized expression.
2024-01-20Auto merge of #119821 - oli-obk:reveal_all_const_evals, r=lcnrbors-11/+24
Always use RevealAll for const eval queries implements what is described in https://github.com/rust-lang/rust/pull/116803#discussion_r1364089471 Using `UserFacing` for const eval does not make sense anymore, unless we significantly change things like avoiding revealing opaque types. New tests are copied from https://github.com/rust-lang/rust/pull/101478
2024-01-19Always use RevealAll for const eval queriesOli Scherer-11/+24
2024-01-13Bless testsGeorge-lewis-0/+6
Update tests
2024-01-11Silence follow up errors if astconv already erroredOli Scherer-9/+2
2024-01-09Auto merge of #117449 - oli-obk:query_merge_immobile_game, r=matthewjasperbors-8/+59
Avoid silencing relevant follow-up errors r? `@matthewjasper` This PR only adds new errors to tests that are already failing and fixes one ICE. Several tests were changed to not emit new errors. I believe all of them were faulty tests, and not explicitly testing for the code that had new errors.
2024-01-09Avoid silencing relevant follow-up errorsOli Scherer-8/+59
2024-01-09Rollup merge of #117556 - obeis:static-mut-ref-lint, r=davidtwcoGuillaume Gomez-65/+40
Disallow reference to `static mut` and adding `static_mut_ref` lint Closes #114447 r? `@scottmcm`
2024-01-07Split note, fix const/static impl trait errorMichael Goulet-8/+16
2024-01-07Update test for `E0796` and `static_mut_ref` lintObei Sideg-65/+40
2024-01-05Stabilize THIR unsafeckMatthew Jasper-2/+2
2024-01-05Remove revisions for THIR unsafeckMatthew Jasper-60/+6
This is to make the diff when stabilizing it easier to review.
2024-01-05Auto merge of #118297 - shepmaster:warn-dead-tuple-fields, r=WaffleLapkinbors-29/+29
Merge `unused_tuple_struct_fields` into `dead_code` This implicitly upgrades the lint from `allow` to `warn` and places it into the `unused` lint group. [Discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Moving.20.60unused_tuple_struct_fields.60.20from.20allow.20to.20warn)
2024-01-05Auto merge of #117213 - oli-obk:check_item_type_cleanup, r=estebankbors-1/+1
Reorder check_item_type diagnostics so they occur next to the corresponding `check_well_formed` diagnostics The first commit is just a cleanup. The second commit moves most checks from `check_mod_item_types` into `check_well_formed`, invoking the checks in lockstep per-item instead of iterating over all items twice.
2024-01-03Make `derive(Trait)` suggestion more accurateEsteban Küber-5/+0
Only suggest `derive(PartialEq)` when both LHS and RHS types are the same, otherwise the suggestion is not useful.
2024-01-02Adjust compiler tests for unused_tuple_struct_fields -> dead_codeJake Goulding-29/+29
2024-01-02Reorder `check_item_type` diagnostics so they occur next to the ↵Oli Scherer-1/+1
corresponding `check_well_formed` diagnostics
2023-12-27Rollup merge of #119175 - veera-sivarajan:fix-cast-to-slice, r=WaffleLapkinMatthias Krüger-7/+3
fix: diagnostic for casting reference to slice fixes: #118790 Removes `if self.cast_ty.is_trait()` to produce the same diagnostic for cast to slice and trait.
2023-12-20Update existing testsVeera-7/+3
2023-12-19rename to verbose-internalsjyn-1/+1
2023-12-18Adjust the ignore-compare-mode-next-solver for hangsMichael Goulet-5/+5
2023-12-14update use of feature flagslcnr-2/+2
2023-12-13Tweak `short_ty_string` to reduce number of filesEsteban Küber-1/+1
When shortening types and writing them to disk, make `short_ty_string` capable of reusing the same file, instead of writing a file per shortened type.
2023-12-13Rollup merge of #118759 - compiler-errors:bare-unit-structs, r=petrochenkovMatthias Krüger-8/+11
Support bare unit structs in destructuring assignments We should be allowed to use destructuring assignments on *bare* unit structs, not just unit structs that are located within other pattern constructors. Fixes #118753 r? petrochenkov since you reviewed #95380, reassign if you're busy or don't want to review this.
2023-12-12Rollup merge of #117914 - estebank:issue-85843, r=wesleywiserMatthias Krüger-1/+5
On borrow return type, suggest borrowing from arg or owned return type When we encounter a function with a return type that has an anonymous lifetime with no argument to borrow from, besides suggesting the `'static` lifetime we now also suggest changing the arguments to be borrows or changing the return type to be an owned type. ``` error[E0106]: missing lifetime specifier --> $DIR/variadic-ffi-6.rs:7:6 | LL | ) -> &usize { | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static` | LL | ) -> &'static usize { | +++++++ help: instead, you are more likely to want to change one of the arguments to be borrowed... | LL | x: &usize, | + help: ...or alternatively, to want to return an owned value | LL - ) -> &usize { LL + ) -> usize { | ``` Fix #85843.
2023-12-11Auto merge of #117758 - Urgau:lint_pointer_trait_comparisons, r=davidtwcobors-0/+3
Add lint against ambiguous wide pointer comparisons This PR is the resolution of https://github.com/rust-lang/rust/issues/106447 decided in https://github.com/rust-lang/rust/issues/117717 by T-lang. ## `ambiguous_wide_pointer_comparisons` *warn-by-default* The `ambiguous_wide_pointer_comparisons` lint checks comparison of `*const/*mut ?Sized` as the operands. ### Example ```rust let ab = (A, B); let a = &ab.0 as *const dyn T; let b = &ab.1 as *const dyn T; let _ = a == b; ``` ### Explanation The comparison includes metadata which may not be expected. ------- This PR also drops `clippy::vtable_address_comparisons` which is superseded by this one. ~~One thing: is the current naming right? `invalid` seems a bit too much.~~ Fixes https://github.com/rust-lang/rust/issues/117717
2023-12-10remove redundant importssurechen-5/+0
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-08Support bare unit structs in destructuring assignmentsMichael Goulet-8/+11
2023-12-07recurse into refs when comparing tys for diagnosticsjyn-14/+14
2023-12-06Adjust tests for newly added ambiguous_wide_pointer_comparisons lintUrgau-0/+3
2023-12-01Tweak unclosed generics errorsEsteban Küber-3/+2
Remove unnecessary span label for parse errors that already have a suggestion. Provide structured suggestion to close generics in more cases.
2023-11-30Rollup merge of #118453 - estebank:priv-fields, r=compiler-errorsMatthias Krüger-1/+1
Tweak message on ADT with private fields building When trying to create an inaccessible ADT due to private fields, handle the case when no fields were passed. ``` error: cannot construct `Foo` with struct literal syntax due to private fields --> $DIR/issue-76077.rs:8:5 | LL | foo::Foo {}; | ^^^^^^^^ | = note: private field `you_cant_use_this_field` that was not provided ```
2023-11-29Make `parse_pat_ident` not recover bad nameEsteban Küber-1/+3
2023-11-29Tweak message on ADT with private fields buildingEsteban Küber-1/+1
When trying to create an inaccessible ADT due to private fields, handle the case when no fields were passed. ``` error: cannot construct `Foo` with struct literal syntax due to private fields --> $DIR/issue-76077.rs:8:5 | LL | foo::Foo {}; | ^^^^^^^^ | = note: private field `you_cant_use_this_field` that was not provided ```
2023-11-24Manual find replace updatesNilstrieb-7/+7
2023-11-24Show number in error message even for one errorNilstrieb-386/+386
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-20On borrow return type, suggest borrowing from arg or owned return typeEsteban Küber-1/+5
When we encounter a function with a return type that has an anonymous lifetime with no argument to borrow from, besides suggesting the `'static` lifetime we now also suggest changing the arguments to be borrows or changing the return type to be an owned type. ``` error[E0106]: missing lifetime specifier --> $DIR/variadic-ffi-6.rs:7:6 | LL | ) -> &usize { | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static` | LL | ) -> &'static usize { | +++++++ help: instead, you are more likely to want to change one of the arguments to be borrowed... | LL | x: &usize, | + help: ...or alternatively, to want to return an owned value | LL - ) -> &usize { LL + ) -> usize { | ``` Fix #85843.
2023-11-19Rollup merge of #117110 - estebank:deref-field-suggestion, r=b-naberTakayuki Maeda-14/+21
Suggest field typo through derefs Take into account implicit dereferences when suggesting fields. ``` error[E0609]: no field `longname` on type `Arc<S>` --> $DIR/suggest-field-through-deref.rs:10:15 | LL | let _ = x.longname; | ^^^^^^^^ help: a field with a similar name exists: `long_name` ``` CC https://github.com/rust-lang/rust/issues/78374#issuecomment-719564114
2023-11-18Auto merge of #117924 - estebank:issue-53841, r=petrochenkovbors-0/+3
When a local binding shadows a fn, point at fn def in call failure When a local binding shadows a function that is then called, this local binding will cause an E0618 error. We now point not only at the binding definition, but also at the locally defined function of the same name. ``` error[E0618]: expected function, found `&str` --> $DIR/issue-22468.rs:3:13 | LL | let foo = "bar"; | --- `foo` has type `&str` LL | let x = foo("baz"); | ^^^------- | | | call expression requires function ... LL | fn foo(file: &str) -> bool { | -------------------------- this function of the same name is available here, but it shadowed by the local binding of the same name ``` Fix #53841
2023-11-18When a local binding shadows a fn, point at fn def in call failureEsteban Küber-0/+3
When a local binding shadows a function that is then called, this local binding will cause an E0618 error. We now point not only at the binding definition, but also at the locally defined function of the same name. ``` error[E0618]: expected function, found `&str` --> $DIR/issue-22468.rs:3:13 | LL | let foo = "bar"; | --- `foo` has type `&str` LL | let x = foo("baz"); | ^^^------- | | | call expression requires function ... LL | fn foo(file: &str) -> bool { | -------------------------- this function of the same name is avalable here, but it shadowed by the local binding of the same name ``` Fix #53841
2023-11-17Auto merge of #118023 - matthiaskrgr:rollup-i9skwic, r=matthiaskrgrbors-11/+0
Rollup of 7 pull requests Successful merges: - #117338 (Remove asmjs) - #117549 (Use `copied` instead of manual `map`) - #117745 (Emit smir) - #117964 (When using existing fn as module, don't claim it doesn't exist) - #118006 (clarify `fn discriminant` guarantees: only free lifetimes may get erased) - #118016 (Add stable mir members to triagebot config) - #118022 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-17Rollup merge of #117338 - workingjubilee:asmjs-meets-thanatos, r=b-naberMatthias Krüger-11/+0
Remove asmjs Fulfills [MCP 668](https://github.com/rust-lang/compiler-team/issues/668). `asmjs-unknown-emscripten` does not work as-specified, and lacks essential upstream support for generating asm.js, so it should not exist at all.
2023-11-16recover primary span labelEsteban Küber-15/+17
2023-11-16Suggest `unwrap()` on field not found for `Result`/`Option`Esteban Küber-1/+6
When encountering a `Result<T, _>` or `Option<T>` where `T` has a field that's being accessed, suggest calling `.unwrap()` to get to the field.
2023-11-16Suggest field typo through derefsEsteban Küber-3/+3
Take into account implicit dereferences when suggesting fields. ``` error[E0609]: no field `longname` on type `Arc<S>` --> $DIR/suggest-field-through-deref.rs:10:15 | LL | let _ = x.longname; | ^^^^^^^^ help: a field with a similar name exists: `long_name` ``` CC https://github.com/rust-lang/rust/issues/78374#issuecomment-719564114
2023-11-16More detail when expecting expression but encountering bad macro argumentEsteban Küber-2/+2
Partially address #71039.