about summary refs log tree commit diff
path: root/tests/ui/lifetimes
AgeCommit message (Collapse)AuthorLines
2025-07-20Lower extra lifetimes before normal generic params.Camille GILLOT-0/+20
2025-07-20Add test.Camille GILLOT-0/+12
2025-07-14Reword mismatched-lifetime-syntaxes text based on feedbackJake Goulding-308/+414
Key changes include: - Removal of the word "syntax" from the lint message. More accurately, it could have been something like "syntax group" or "syntax category", but avoiding it completely is easier. - The primary lint message now reflects exactly which mismatch is occurring, instead of trying to be general. A new `help` line is general across the mismatch kinds. - Suggestions have been reduced to be more minimal, no longer also changing non-idiomatic but unrelated aspects. - Suggestion text no longer mentions changes when those changes don't occur in that specific suggestion.
2025-07-11Rollup merge of #143302 - Kivooeo:tf27, r=tgross35Matthias Krüger-0/+37
`tests/ui`: A New Order [27/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? ``@tgross35``
2025-07-10cleaned up some testsKivooeo-3/+9
2025-07-01moved testsKivooeo-0/+31
2025-06-30Use predicate spans instead of whole item spansOli Scherer-6/+24
2025-06-30Check variances in the non-hir wfcheckerOli Scherer-6/+6
2025-06-30Unconditionally run `check_item_type` on all itemsOli Scherer-8/+8
2025-06-24Make missing lifetime suggestion verboseMichael Goulet-6/+16
2025-06-23compiletest: Improve diagnostics for line annotation mismatchesVadim Petrochenkov-3/+3
2025-06-18Bless/update tests.Mara Bos-1/+1
2025-06-14Auto merge of #142129 - ↵bors-1/+105
shepmaster:mismatched-syntaxes-in-function-like-places, r=jieyouxu Apply `mismatched-lifetime-syntaxes` to trait and extern functions r? `@jieyouxu`
2025-06-13Add test for temporary lifetime extension in `Self()` syntax.Mara Bos-1/+12
2025-06-13Add tests.Mara Bos-0/+44
2025-06-09Make E0621 missing lifetime suggestion verboseEsteban Küber-26/+56
``` error[E0621]: explicit lifetime required in the type of `x` --> $DIR/42701_one_named_and_one_anonymous.rs:10:9 | LL | &*x | ^^^ lifetime `'a` required | help: add explicit lifetime `'a` to the type of `x` | LL | fn foo2<'a>(a: &'a Foo, x: &'a i32) -> &'a i32 { | ++ ```
2025-06-08cleaned up some testsKivooeo-0/+89
2025-06-06Apply `mismatched-lifetime-syntaxes` to trait and extern functionsJake Goulding-1/+105
2025-06-06Rollup merge of #141982 - Kivooeo:tf5, r=jieyouxuMatthias Krüger-0/+128
`tests/ui`: A New Order [5/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. r? ``@jieyouxu``
2025-06-05Auto merge of #138677 - shepmaster:consistent-elided-lifetime-syntax, ↵bors-30/+1077
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-05cleaned up some testsKivooeo-0/+128
2025-06-04Replace `elided_named_lifetimes` with `mismatched_lifetime_syntaxes`Jake Goulding-67/+323
2025-06-04Introduce the `mismatched_lifetime_syntaxes` lintJake Goulding-0/+791
2025-06-04Rollup merge of #141959 - ferrocene:lw/2015-edition-directives2, ↵Matthias Krüger-1/+4
r=compiler-errors Add more missing 2015 edition directives These tests specifically test 2015 edition behavior, so ensure that they can only be run with this edition
2025-06-03Add missing `dyn` keywords to tests that do not test for them Part 2Lukas Wirth-3/+2
2025-06-03Add missing 2015 edition directivesLukas Wirth-1/+4
These tests specifically test 2015 edition behavior, so ensure that they can only be run with this edition
2025-04-11Auto merge of #139578 - ferrocene:pa-compiletest-edition, r=jieyouxubors-2/+2
Fix breakage when running compiletest with `--test-args=--edition=2015` Compiletest has an `--edition` flag to change the default edition tests are run with. Unfortunately no test suite successfully executes when that flag is passed. If the edition is set to something greater than 2015 the breakage is expected, since the test suite currently supports only edition 2015 (Ferrous Systems will open an MCP about fixing that soonish). Surprisingly, the test suite is also broken if `--edition=2015` is passed to compiletest. This PR focuses on fixing the latter. This PR fixes the two categories of failures happening when `--edition=2015` is passed: * Some edition-specific tests set their edition through `//@ compile-flags` instead of `//@ edition`. Compiletest doesn't parse the compile flags, so it would see no `//@ edition` and add another `--edition` flag, leading to a rustc error. * Compiletest would add the edition after `//@ compile-flags`, while some tests depend on flags passed to `//@ compile-flags` being the last flags in the rustc invocation. Note that for the first category, I opted to manually go and replace all `//@ compile-flags` setting an edition with an explicit `//@ edition`. We could've changed compiletest to instead check whether an edition was set in `//@ compile-flags`, but I thought it was better to enforce a consistent way to set the edition in tests. I also added the edition to the stamp, so that changing `--edition` results in tests being re-executed. r? `@jieyouxu`
2025-04-11Improve `AssocItem::descr`.Nicholas Nethercote-4/+4
The commit adds "associated" to the description of associated types and associated consts, to match the description of associated functions. This increases error message precision and consistency with `AssocKind::fmt`. The commit also notes an imperfection in `AssocKind::fmt`; fixing this imperfection is possible but beyond the scope of this PR.
2025-04-10replace `//@ compile-flags: --edition` with `//@ edition`Pietro Albini-2/+2
2025-04-08UI tests: add missing diagnostic kinds where possibleVadim Petrochenkov-4/+4
2025-03-06Suggest typo fix for static lifetimeMichael Goulet-0/+33
2025-03-03Do not recover missing lifetime with random in-scope lifetimeMichael Goulet-15/+3
2025-02-28Introduce `feature(generic_const_parameter_types)`Boxy-2/+0
2025-02-21More sophisticated span trimmingMichael Goulet-4/+3
2025-02-14Trim suggestion parts to the subset that is purely additiveMichael Goulet-1/+1
2025-02-14Consider add-prefix replacements tooMichael Goulet-3/+2
2025-02-10Show diff suggestion format on verbose replacementEsteban Küber-14/+21
``` error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 | LL | let _ = 2.l; | ^ | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | LL - let _ = 2.l; LL + let _ = 2.0f64; | ```
2025-02-03tests: remove redundant `//@ ignore-{wasm,wasm32,emscripten}`许杰友 Jieyou Xu (Joe)-1/+0
2025-01-23tests: use `needs-subprocess` instead of `ignore-{wasm32,emscripten,sgx}`许杰友 Jieyou Xu (Joe)-1/+2
2025-01-08Remove special-casing for argument patterns in MIR typeckdianne-7/+9
2025-01-06point out unblamed constraints from `Copy`/`Sized` bounds in region errorsdianne-1/+4
2025-01-06`best_blame_constraint`: prioritize blaming interesting-seeming constraintsdianne-1/+5
2025-01-06`best_blame_constraint`: avoid blaming assignments without user-provided typesdianne-9/+7
2025-01-06`best_blame_constraint`: don't filter constraints by sup SCCdianne-32/+89
The SCCs of the region graph are not a reliable heuristic to use for blaming an interesting constraint for diagnostics. For region errors, if the outlived region is `'static`, or the involved types are invariant in their lifetiems, there will be cycles in the constraint graph containing both the target region and the most interesting constraints to blame. To get better diagnostics in these cases, this commit removes that heuristic.
2025-01-06Improve span when temporary receiver is dropped in edition 2024Michael Goulet-2/+1
2024-12-14Rollup merge of #134181 - estebank:trim-render, r=oli-obkMatthias Krüger-13/+1
Tweak multispan rendering to reduce output length Consider comments and bare delimiters the same as an "empty line" for purposes of hiding rendered code output of long multispans. This results in more aggressive shortening of rendered output without losing too much context, specially in `*.stderr` tests that have "hidden" comments. We do that check not only on the first 4 lines of the multispan, but now also on the previous to last line as well.
2024-12-12Tweak multispan renderingEsteban Küber-13/+1
Consider comments and bare delimiters the same as an "empty line" for purposes of hiding rendered code output of long multispans. This results in more aggressive shortening of rendered output without losing too much context, specially in `*.stderr` tests that have "hidden" comments.
2024-12-11Arbitrary self types v2: use Receiver traitAdrian Taylor-1/+1
In this new version of Arbitrary Self Types, we no longer use the Deref trait exclusively when working out which self types are valid. Instead, we follow a chain of Receiver traits. This enables methods to be called on smart pointer types which fundamentally cannot support Deref (for instance because they are wrappers for pointers that don't follow Rust's aliasing rules). This includes: * Changes to tests appropriately * New tests for: * The basics of the feature * Ensuring lifetime elision works properly * Generic Receivers * A copy of the method subst test enhanced with Receiver This is really the heart of the 'arbitrary self types v2' feature, and is the most critical commit in the current PR. Subsequent commits are focused on: * Detecting "shadowing" problems, where a smart pointer type can hide methods in the pointee. * Diagnostics and cleanup. Naming: in this commit, the "Autoderef" type is modified so that it no longer solely focuses on the "Deref" trait, but can now consider the "Receiver" trait instead. Should it be renamed, to something like "TraitFollower"? This was considered, but rejected, because * even in the Receiver case, it still considers built-in derefs * the name Autoderef is short and snappy.
2024-12-01Only error raw lifetime followed by \' in edition 2021+Michael Goulet-3/+7
2024-11-28Update more 2024 tests to remove -Zunstable-optionsEric Huss-8/+3