about summary refs log tree commit diff
path: root/tests/ui/indexing
AgeCommit message (Collapse)AuthorLines
2025-10-02Rollup merge of #146585 - hkBst:indexing-1, r=jdonszelmannMatthias Krüger-1/+3
indexing: reword help After looking at https://github.com/rust-lang/rust/issues/40850, I thought I'd try to improve wording around error E0608 a bit. Hopefully I've succeeded.
2025-10-01indexing: reword helpMarijn Schouten-1/+3
Co-authored-by: beef <ent3rm4n@gmail.com>
2025-09-30add testslcnr-0/+26
2025-06-29cleaned up some testsKivooeo-0/+119
2025-03-11Implement SliceIndex for ByteStrThalia Archibald-4/+6
2024-12-31chore: fix typosdxsullivan-1/+1
Signed-off-by: dxsullivan <193140725+dxsullivan@users.noreply.github.com>
2024-11-02Trim output of E0277 in some casesEsteban Küber-2/+0
Remove default note for "trait is not implemented" in favor of the more colorful diff output from the previous commit. Removes duplicated output.
2024-11-02Add trait diff highlighting logic and use it in E0277Esteban Küber-3/+6
When a trait is not implemented for a type, but there *is* an `impl` for another type or different trait params, we format the output to use highlighting in the same way that E0308 does for types. The logic accounts for 3 cases: - When both the type and trait in the expected predicate and the candidate are different - When only the types are different - When only the trait generic params are different For each case, we use slightly different formatting and wording.
2024-10-29Remove detail from label/note that is already available in other noteEsteban Küber-3/+3
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-06-01check index `value <= 0xFFFF_FF00`Luv-Ray-0/+26
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-1/+1
2024-01-30Provide more context on derived obligation error primary labelEsteban Küber-3/+3
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.
2023-11-24Show number in error message even for one errorNilstrieb-4/+4
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-13review comments: more targeted span setting approachEsteban Küber-0/+2
2023-11-13Always point at index span on index obligation failureEsteban Küber-0/+20
Use more targetted span for index obligation failures by rewriting the obligation cause span. CC #66023
2023-10-02Point out the actual mismatch errorMichael Goulet-0/+2
2023-10-02For a single impl candidate, try to unify it with error trait refMichael Goulet-2/+2
2023-08-04Improve spans for indexing expressionsNilstrieb-0/+115
Indexing is similar to method calls in having an arbitrary left-hand-side and then something on the right, which is the main part of the expression. Method calls already have a span for that right part, but indexing does not. This means that long method chains that use indexing have really bad spans, especially when the indexing panics and that span in coverted into a panic location. This does the same thing as method calls for the AST and HIR, storing an extra span which is then put into the `fn_span` field in THIR.