Commit Graph

7 Commits

Author SHA1 Message Date
Ali MJ Al-Nasrawy
19e0ea4a6d make type_flags(ReError) & HAS_ERROR 2024-03-20 17:29:58 +00:00
Esteban Küber
d30252e359 Tweak wording 2023-11-20 23:44:37 +00:00
Esteban Küber
b7a23bc08b 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-11-20 23:44:36 +00:00
yukang
f3d20be42b suggest unwrap/expect for let binding type mismatch 2023-10-25 00:32:58 +08:00
Esteban Küber
30cf7a3f51 Introduce ReError
CC #69314
2023-02-09 10:26:49 +00:00
Esteban Küber
62ba3e70a1 Modify primary span label for E0308
The previous output was unintuitive to users.
2023-01-30 20:12:19 +00:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests 2023-01-11 09:32:08 +00:00