Files
rust/tests/ui
bors ccf3198de3 Auto merge of #138677 - shepmaster:consistent-elided-lifetime-syntax, r=traviscross,jieyouxu
Add a new `mismatched-lifetime-syntaxes` lint

The lang-team [discussed this](https://hackmd.io/nf4ZUYd7Rp6rq-1svJZSaQ) and I attempted to [summarize](https://github.com/rust-lang/rust/pull/120808#issuecomment-2701863833) their decision. The summary-of-the-summary is:

- Using two different kinds of syntax for elided lifetimes is confusing. In rare cases, it may even [lead to unsound code](https://github.com/rust-lang/rust/issues/48686)! Some examples:

    ```rust
    // Lint will warn about these
    fn(v: ContainsLifetime) -> ContainsLifetime<'_>;
    fn(&'static u8) -> &u8;
    ```

- Matching up references with no lifetime syntax, references with anonymous lifetime syntax, and paths with anonymous lifetime syntax is an exception to the simplest possible rule:

    ```rust
    // Lint will not warn about these
    fn(&u8) -> &'_ u8;
    fn(&'_ u8) -> &u8;
    fn(&u8) -> ContainsLifetime<'_>;
    ```

- Having a lint for consistent syntax of elided lifetimes will make the [future goal](https://github.com/rust-lang/rust/issues/91639) of warning-by-default for paths participating in elision much simpler.

---

This new lint attempts to accomplish the goal of enforcing consistent syntax. In the process, it supersedes and replaces the existing `elided-named-lifetimes` lint, which means it starts out life as warn-by-default.
2025-06-05 19:49:30 +00:00
..
2025-05-21 07:24:43 +00:00
2025-06-04 17:48:50 +05:00
2025-06-04 17:48:50 +05:00
2025-05-12 16:35:09 +02:00
2025-06-03 10:52:32 -07:00
2025-06-04 19:32:06 +05:00
2025-06-02 11:00:46 +02:00
2025-06-03 10:52:32 -07:00
2025-05-31 19:49:19 +05:00
2025-05-09 12:09:15 +02:00
2025-06-03 10:52:32 -07:00
2025-05-21 20:38:49 +01:00
2025-06-03 11:45:58 +02:00
2025-06-04 17:48:50 +05:00
2025-05-31 19:49:19 +05:00
2025-04-25 20:50:57 +09:00
2025-06-03 07:38:06 +05:00
2025-05-26 16:35:36 +01:00
2025-03-30 01:32:21 +03:00
2025-06-03 14:50:22 +10:00
2025-05-31 19:49:19 +05:00
2025-05-30 12:14:27 +02:00
2025-04-25 20:50:57 +09:00
2025-05-05 21:09:31 +02:00
2025-05-31 18:34:35 +02:00
2025-04-03 21:41:58 +00:00
2025-04-03 21:41:58 +00:00
2025-05-07 21:51:41 +05:00
2025-04-04 16:32:18 +02:00
2025-05-09 22:21:35 +05:00