about summary refs log tree commit diff
path: root/tests/ui/offset-of
AgeCommit message (Collapse)AuthorLines
2025-08-07Do not provide field typo suggestions for tuples and tuple structsEsteban Küber-15/+3
2025-08-07Account for bare tuples in field searching logicEsteban Küber-0/+48
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-07-25Update ui tests with new macro early erroringGuillaume Gomez-116/+125
2025-06-16tests: `PointeeSized` bounds with extern typesDavid Wood-12/+13
These tests necessarily need to change now that `?Sized` is not sufficient to accept extern types and `PointeeSized` is now necessary. In addition, the `size_of_val`/`align_of_val` test can now be changed to expect an error.
2025-04-08UI tests: add missing diagnostic kinds where possibleVadim Petrochenkov-5/+5
2025-01-07Update tests.Mara Bos-1/+1
2024-11-03use backticks instead of single quotes when reporting "use of unstable ↵dianne-8/+8
library feature" This is consistent with all other diagnostics I could find containing features and enables the use of `DiagSymbolList` for generalizing diagnostics for unstable library features to multiple features.
2024-10-30Rollup merge of #132332 - nnethercote:use-token_descr-more, r=estebankMatthias Krüger-3/+3
Use `token_descr` more in error messages This is the first two commits from #124141, put into their own PR to get things rolling. Commit messages have the details. r? ``@estebank`` cc ``@petrochenkov``
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-28Tweak more warnings.Nicholas Nethercote-3/+3
Much like the previous commit. I think the removal of "the token" in each message is fine here. There are many more error messages that mention tokens without saying "the token" than those that do say it.
2024-09-14Fix `Parser::break_up_float`'s right spanLieselotte-24/+24
2024-08-08Normalize when computing offset_of for slice tailMichael Goulet-0/+37
2024-07-29Stabilize offset_of_nestedGeorge Bateman-59/+52
2024-06-08offset_of: allow (unstably) taking the offset of slice tail fieldsRalf Jung-1/+40
2024-04-28Update mir-opt tests, add proper regression testGeorge Bateman-8/+30
2024-04-28Fix #124478 - offset_of! returns a temporaryGeorge Bateman-24/+25
This was due to the must_use() call. Adding HIR's OffsetOf to the must_use checking within the compiler avoids this issue.
2024-03-18When displaying multispans, ignore empty lines adjacent to `...`Esteban Küber-1/+0
``` error[E0308]: `match` arms have incompatible types --> tests/ui/codemap_tests/huge_multispan_highlight.rs:98:18 | 6 | let _ = match true { | ---------- `match` arms have incompatible types 7 | true => ( | _________________- 8 | | // last line shown in multispan header ... | 96 | | 97 | | ), | |_________- this is found to be of type `()` 98 | false => " | __________________^ ... | 119 | | 120 | | ", | |_________^ expected `()`, found `&str` error[E0308]: `match` arms have incompatible types --> tests/ui/codemap_tests/huge_multispan_highlight.rs:215:18 | 122 | let _ = match true { | ---------- `match` arms have incompatible types 123 | true => ( | _________________- 124 | | 125 | | 1 // last line shown in multispan header ... | 213 | | 214 | | ), | |_________- this is found to be of type `{integer}` 215 | false => " | __________________^ 216 | | 217 | | 218 | | 1 last line shown in multispan ... | 237 | | 238 | | ", | |_________^ expected integer, found `&str` ```
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-6/+6
2024-01-30Provide more context on derived obligation error primary labelEsteban Küber-1/+1
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-19Stabilize simple offset_ofGeorge Bateman-33/+24
2024-01-13Bless testsGeorge-lewis-0/+8
Update tests
2024-01-02Make offset_of field parsing use metavariable which handles any spacingGeorge Bateman-220/+150
2023-11-24Show number in error message even for one errorNilstrieb-1/+1
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-16Suggest field typo through derefsEsteban Küber-0/+4
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-03Feature gate enums in offset_ofGeorge Bateman-2/+2
2023-10-31Update based on wesleywiser reviewGeorge Bateman-3/+10
2023-10-31Enums in offset_of: update based on est31, scottmcm & llogiq reviewGeorge Bateman-2/+27
2023-10-31Support enum variants in offset_of!George Bateman-13/+31
2023-10-04Point to where missing return type should goMichael Goulet-1/+1
2023-06-21Warn on unused offset_of!() resultChayim Refael Friedman-49/+49
2023-06-15change `std::marker::Sized` to just `Sized`Lukas Markeffsky-1/+1
2023-06-08Support float-like tuple indices in offset_of!()est31-18/+298
The tokenizer gives us whole float literal tokens, we have to split them up in order to be able to create field access from them.
2023-06-02Test invalid tuple field identifiersclubby789-0/+47
2023-06-02Check tuple elements are `Sized` in `offset_of`clubby789-6/+18
2023-05-29offset_of: Don't require type to be sizedclubby789-0/+15
2023-05-20don't skip inference for type in `offset_of!`Lukas Markeffsky-3/+33
2023-05-18Add more tests for the offset_of!() macroest31-7/+330
* ensuring that offset_of!(Self, ...) works iff inside an impl block * ensuring that the output type is usize and doesn't coerce. this can be changed in the future, but if it is done, it should be a conscious descision * improving the privacy checking test * ensuring that generics don't let you escape the unsized check
2023-05-16Erase regions of type in `offset_of!`clubby789-0/+5
2023-05-05Add feature gateest31-2/+2
2023-05-05Migrate offset_of from a macro to builtin # syntaxest31-13/+177
2023-04-21major test improvementsDrMeepster-9/+239
2023-04-21offset_ofDrMeepster-0/+79