about summary refs log tree commit diff
path: root/tests/ui/coherence
AgeCommit message (Collapse)AuthorLines
2025-09-13Rollup merge of #145896 - Oneirical:uncountable-integer-10, r=jieyouxuJacob Pratt-0/+8
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#3 of Batch #2] Part of rust-lang/rust#133895 Methodology: 1. Refer to the previously written `tests/ui/SUMMARY.md` 2. Find an appropriate category for the test, using the original issue thread and the test contents. 3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers) 4. Rename the tests to make their purpose clearer Inspired by the methodology that `@Kivooeo` was using. r? `@jieyouxu`
2025-09-12Add test batch 3Oneirical-0/+8
2025-08-22On E0277, point at type that doesn't implement boundEsteban Küber-2/+12
When encountering an unmet trait bound, point at local type that doesn't implement the trait: ``` error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied --> $DIR/issue-64855.rs:9:19 | LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ; | ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | help: the trait `Foo` is not implemented for `Bar<T>` --> $DIR/issue-64855.rs:9:1 | LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ; | ^^^^^^^^^^^^^^^^^ ```
2025-08-19bless tests with new lint messagesKarol Zwolak-13/+13
2025-08-07Account for bare tuples in field searching logicEsteban Küber-0/+2
When looking for the field names and types of a given type, account for tuples. This allows suggestions for incorrectly nested field accesses and field name typos to trigger as intended. Previously these suggestions only worked on `ty::Adt`, including tuple structs which are no different to tuples, so they should behave the same in suggestions. ``` error[E0599]: no method named `get_ref` found for tuple `(BufReader<File>,)` in the current scope --> $DIR/missing-field-access.rs:11:15 | LL | let x = f.get_ref(); | ^^^^^^^ method not found in `(BufReader<File>,)` | help: one of the expressions' fields has a method of the same name | LL | let x = f.0.get_ref(); | ++ ```
2025-08-02Rehome tests/ui/issues/ tests [2/?]Oneirical-0/+14
2025-07-04Remove Symbol for Named LateParam/Bound variantsMichael Goulet-4/+4
2025-06-30Unconditionally run `check_item_type` on all itemsOli Scherer-17/+17
2025-06-07const-eval error: always say in which item the error occurredRalf Jung-2/+2
also adjust the wording a little so that we don't say "the error occurred here" for two different spans
2025-06-04Rollup merge of #141888 - ferrocene:lw/decouple-tests-from-2015, ↵Matthias Krüger-3/+3
r=compiler-errors Use non-2015 edition paths in tests that do not test for their resolution This allows for testing these tests on editions other than 2015
2025-06-03Use non-2015 edition paths in tests that do not test for their resolutionLukas Wirth-3/+3
This allows for testing these tests on editions other than 2015
2025-06-02Clarify why we are talking about a failed const eval at a random placeOli Scherer-2/+2
2025-06-02Use the informative error as the main const eval error messageOli Scherer-4/+4
2025-03-20Do not rely on type_var_origin in OrphanCheckErr::NonLocalInputTypeMichael Goulet-0/+33
2025-03-14Do not suggest using `-Zmacro-backtrace` for builtin macrosEsteban Küber-4/+0
For macros that are implemented on the compiler, we do *not* mention the `-Zmacro-backtrace` flag. This includes `derive`s and standard macros.
2025-03-11Implement `#[define_opaque]` attribute for functions.Oli Scherer-22/+27
2025-03-04Make rustdoc tests use always applicable negative auto implsMichael Goulet-58/+0
2025-03-04Ensure that negative auto impls are always applicableMichael Goulet-20/+64
2025-02-28Shorten span of panic failures in const contextEsteban Küber-22/+11
Previously, we included a redundant prefix on the panic message and a postfix of the location of the panic. The prefix didn't carry any additional information beyond "something failed", and the location of the panic is redundant with the diagnostic's span, which gets printed out even if its code is not shown. ``` error[E0080]: evaluation of constant value failed --> $DIR/assert-type-intrinsics.rs:11:9 | LL | MaybeUninit::<!>::uninit().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: aborted execution: attempted to instantiate uninhabited type `!` ``` ``` error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-closure.rs:9:19 | LL | const C: () = panic!(); | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ``` ``` error[E0080]: evaluation of constant value failed --> $DIR/uninhabited.rs:41:9 | LL | assert!(false); | ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) ``` --- When the primary span for a const error is the same as the first frame in the const error report, skip it. ``` error[E0080]: evaluation of constant value failed --> $DIR/issue-88434-removal-index-should-be-less.rs:3:24 | LL | const _CONST: &[u8] = &f(&[], |_| {}); | ^^^^^^^^^^^^^^ evaluation panicked: explicit panic | note: inside `f::<{closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34}>` --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | LL | panic!() | ^^^^^^^^ the failure occurred here = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ``` instead of ``` error[E0080]: evaluation of constant value failed --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | LL | panic!() | ^^^^^^^^ explicit panic | note: inside `f::<{closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34}>` --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | LL | panic!() | ^^^^^^^^ note: inside `_CONST` --> $DIR/issue-88434-removal-index-should-be-less.rs:3:24 | LL | const _CONST: &[u8] = &f(&[], |_| {}); | ^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ``` --- Revert order of constant evaluation errors Point at the code the user wrote first and std functions last. ``` error[E0080]: evaluation of constant value failed --> $DIR/const-errs-dont-conflict-103369.rs:5:25 | LL | impl ConstGenericTrait<{my_fn(1)}> for () {} | ^^^^^^^^ evaluation panicked: Some error occurred | note: called from `my_fn` --> $DIR/const-errs-dont-conflict-103369.rs:10:5 | LL | panic!("Some error occurred"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ``` instead of ``` error[E0080]: evaluation of constant value failed --> $DIR/const-errs-dont-conflict-103369.rs:10:5 | LL | panic!("Some error occurred"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Some error occurred | note: called from `<() as ConstGenericTrait<{my_fn(1)}>>::{constant#0}` --> $DIR/const-errs-dont-conflict-103369.rs:5:25 | LL | impl ConstGenericTrait<{my_fn(1)}> for () {} | ^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ```
2025-02-24Remove dyn_compatible_for_dispatchMichael Goulet-40/+0
2025-01-26Compiler: Finalize dyn compatibility renamingLeón Orell Valerian Liehr-1/+1
2025-01-25Auto merge of #133154 - estebank:issue-133137, r=wesleywiserbors-4/+8
Reword resolve errors caused by likely missing crate in dep tree Reword label and add `help`: ``` error[E0432]: unresolved import `some_novel_crate` --> f704.rs:1:5 | 1 | use some_novel_crate::Type; | ^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `some_novel_crate` | = help: if you wanted to use a crate named `some_novel_crate`, use `cargo add some_novel_crate` to add it to your `Cargo.toml` ``` Fix #133137.
2025-01-24Reword "crate not found" resolve messageEsteban Küber-4/+8
``` error[E0432]: unresolved import `some_novel_crate` --> file.rs:1:5 | 1 | use some_novel_crate::Type; | ^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `some_novel_crate` ``` On resolve errors where there might be a missing crate, mention `cargo add foo`: ``` error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nope` --> $DIR/conflicting-impl-with-err.rs:4:11 | LL | impl From<nope::Thing> for Error { | ^^^^ use of unresolved module or unlinked crate `nope` | = help: if you wanted to use a crate named `nope`, use `cargo add nope` to add it to your `Cargo.toml` ```
2025-01-22Refactor dyn-compatibility error and suggestionsTaylor Cramer-4/+5
This CL makes a number of small changes to dyn compatibility errors: - "object safety" has been renamed to "dyn-compatibility" throughout - "Convert to enum" suggestions are no longer generated when there exists a type-generic impl of the trait or an impl for `dyn OtherTrait` - Several error messages are reorganized for user readability Additionally, the dyn compatibility error creation code has been split out into functions. cc #132713 cc #133267
2025-01-18Auto merge of #135618 - lcnr:coherence-unknown, r=compiler-errorsbors-4/+0
add cache to `AmbiguityCausesVisitor` fixes #135457, alternative to #135524. cc https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/new-solver.20hang.20.23135457 r? `@compiler-errors`
2025-01-15Rollup merge of #132397 - m-ou-se:warn-missing-abi, r=NadrierilJacob Pratt-1/+1
Make missing_abi lint warn-by-default. This makes the missing_abi lint warn-by-default, as suggested here: https://github.com/rust-lang/rfcs/pull/3722#issuecomment-2447719047 This needs a lang FCP.
2025-01-15avoid running the overlap check twicelcnr-4/+0
2025-01-09Add tests cases from review of #132289Frank Steffahn-0/+178
2025-01-07Update tests.Mara Bos-1/+1
2024-12-07reword trait bound suggestion message to include the boundsEsteban Küber-1/+1
2024-11-27Rollup merge of #133493 - lcnr:fulfill-fudge, r=compiler-errorsMatthias Krüger-0/+89
do not constrain infer vars in `find_best_leaf_obligation` This ended up causing an ICE by making the following code path reachable by incorrectly constraining an inference variable while computing the best obligation for a preceding ambiguity. Closes #129444. https://github.com/rust-lang/rust/blob/f2abf827c128120ed7a874d02973947968c158b8/compiler/rustc_trait_selection/src/solve/fulfill.rs#L312-L314 I have to be honest, I don't fully understand how that change removes all the additional diagnostics :3 r? `@compiler-errors`
2024-11-26update crasheslcnr-0/+89
2024-11-26tests: remove `//@ pretty-expanded` usages许杰友 Jieyou Xu (Joe)-8/+0
Done with ```bash sd '//@ pretty-expanded.*\n' '' tests/ui/**/*.rs ``` and ``` sd '//@pretty-expanded.*\n' '' tests/ui/**/*.rs ```
2024-10-29Remove detail from label/note that is already available in other noteEsteban Küber-1/+1
Remove the "which is required by `{root_obligation}`" post-script in "the trait `X` is not implemented for `Y`" explanation in E0277. This information is already conveyed in the notes explaining requirements, making it redundant while making the text (particularly in labels) harder to read. ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ``` vs the prior ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ```
2024-10-17Rollup merge of #128391 - cafce25:issue-128390, r=lcnrMatthias Krüger-134/+174
Change orphan hint from "only" to "any uncovered type inside..." Fix #128390
2024-10-15remove unnecessary revisionslcnr-273/+22
2024-10-15stabilize `-Znext-solver=coherence`lcnr-79/+67
2024-10-10UI tests: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-30/+30
2024-10-10Rename feature object_safe_for_dispatch to dyn_compatible_for_dispatchLeón Orell Valerian Liehr-1/+1
2024-09-27Rollup merge of #130826 - fmease:compiler-mv-obj-safe-dyn-compat, ↵Matthias Krüger-1/+1
r=compiler-errors Compiler: Rename "object safe" to "dyn compatible" Completed T-lang FCP: https://github.com/rust-lang/lang-team/issues/286#issuecomment-2338905118. Tracking issue: https://github.com/rust-lang/rust/issues/130852 Excludes `compiler/rustc_codegen_cranelift` (to be filed separately). Includes Stable MIR. Regarding https://github.com/rust-lang/rust/labels/relnotes, I guess I will manually open a https://github.com/rust-lang/rust/labels/relnotes-tracking-issue since this change affects everything (compiler, library, tools, docs, books, everyday language). r? ghost
2024-09-27Rollup merge of #130718 - jackh726:known-bug-cleanup, r=compiler-errorsMatthias Krüger-1/+59
Cleanup some known-bug issues I went through most of the known-bug tests (except those under `tests/crashes`) and made sure the issue had the `S-bug-has-test` label and checked that the linked issue was open. This is a bunch of cleanups, mainly issues that have been closed and the tests should have been updated. Importantly, there are many known-bug tests linking to #110395. This *probably* isn't right - that is a tracking issue. But I don't really know what the "right" thing to do here. Probably, most that are actually *supposed* to be tests for const trait need to be linked to *that* tracking issue. And any other tests that were mislabeled need to be handled accordingly e.g. #130482. cc `@fee1-dead`
2024-09-27Cleanup some known-bug issuesJack Huey-1/+59
2024-09-27On implicit `Sized` bound on fn argument, point at type instead of patternEsteban Küber-2/+2
Instead of ``` error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time --> $DIR/issue-59324.rs:23:20 | LL | fn with_factory<H>(factory: dyn ThriftService<()>) {} | ^^^^^^^ doesn't have a size known at compile-time ``` output ``` error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time --> $DIR/issue-59324.rs:23:29 | LL | fn with_factory<H>(factory: dyn ThriftService<()>) {} | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time ```
2024-09-26Make new information notes instead of labelsJonathan Birk-174/+174
2024-09-25Compiler: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-1/+1
2024-09-14Rollup merge of #130311 - heiseish:issue-70849-fix, r=fmeaseStuart Cook-0/+23
(fix) conflicting negative impl marker ## Context This MR fixes the error message for conflicting negative trait impls by adding the corresponding the polarity marker to the trait name. ## Issues - closes #70849 r​? `@fmease`
2024-09-14(fix) conflicting negative impl marker and add testsGiang Dao-0/+23
2024-09-12Re-enable `ConstArgKind::Path` lowering by defaultNoah Lev-19/+3
...and remove the `const_arg_path` feature gate as a result. It was only a stopgap measure to fix the regression that the new lowering introduced (which should now be fixed by this PR).
2024-09-11Revert 'Stabilize -Znext-solver=coherence'Michael Goulet-52/+315
2024-09-05remove unnecessary revisionslcnr-273/+22