George Bateman
2348eb271c
Update mir-opt tests, add proper regression test
2024-04-28 21:10:09 +01:00
George Bateman
ca79086c87
Fix #124478 - offset_of! returns a temporary
...
This was due to the must_use() call. Adding HIR's OffsetOf to the must_use
checking within the compiler avoids this issue.
2024-04-28 18:36:08 +01:00
Esteban Küber
cc9631a371
When displaying multispans, ignore empty lines adjacent to `...`
...
```
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-03-18 16:25:36 +00:00
许杰友 Jieyou Xu (Joe)
ec2cc761bc
[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives
2024-02-16 20:02:50 +00:00
Esteban Küber
6efddac288
Provide more context on derived obligation error primary label
...
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-30 21:28:18 +00:00
George Bateman
615946db4f
Stabilize simple offset_of
2024-01-19 20:38:51 +00:00
George-lewis
d56cdd48cb
Bless tests
...
Update tests
2024-01-13 12:46:58 -05:00
George Bateman
09bb07e38f
Make offset_of field parsing use metavariable which handles any spacing
2024-01-02 22:18:35 +00:00
Nilstrieb
41e8d152dc
Show number in error message even for one error
...
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24 19:15:52 +01:00
Esteban Küber
dfa75391f8
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-16 17:00:23 +00:00
George Bateman
7c09b99ebb
Feature gate enums in offset_of
2023-11-03 13:16:47 +00:00
George Bateman
e742f809f6
Update based on wesleywiser review
2023-10-31 23:41:40 +00:00
George Bateman
d995bd61e7
Enums in offset_of: update based on est31, scottmcm & llogiq review
2023-10-31 23:26:02 +00:00
George Bateman
e936416a8d
Support enum variants in offset_of!
2023-10-31 23:25:54 +00:00
Michael Goulet
137b6d0b01
Point to where missing return type should go
2023-10-04 21:09:54 +00:00
Chayim Refael Friedman
592844cf88
Warn on unused offset_of!() result
2023-06-21 11:43:14 +03:00
Lukas Markeffsky
b6a3f126c0
change `std::marker::Sized` to just `Sized`
2023-06-15 12:01:38 +02:00
est31
1b90f5efaf
Support float-like tuple indices in offset_of!()
...
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-08 23:42:58 +02:00
clubby789
d722f27684
Test invalid tuple field identifiers
2023-06-02 01:33:09 +00:00
clubby789
731601ccd1
Check tuple elements are `Sized` in `offset_of`
2023-06-02 01:18:59 +00:00
clubby789
6c18d1ecef
offset_of: Don't require type to be sized
2023-05-29 21:56:10 +00:00
Lukas Markeffsky
7cdb23b98a
don't skip inference for type in `offset_of!`
2023-05-20 15:20:27 +02:00
est31
30c0e4e72b
Add more tests for the offset_of!() macro
...
* 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-18 13:16:17 +02:00
clubby789
35cf5726e3
Erase regions of type in `offset_of!`
2023-05-16 21:36:42 +00:00
est31
83b4df4e61
Add feature gate
2023-05-05 21:44:48 +02:00
est31
5eb29c7f49
Migrate offset_of from a macro to builtin # syntax
2023-05-05 21:44:13 +02:00
DrMeepster
a642563d49
major test improvements
2023-04-21 02:45:48 -07:00
DrMeepster
511e457c4b
offset_of
2023-04-21 02:14:02 -07:00