about summary refs log tree commit diff
path: root/tests/ui/issues
AgeCommit message (Collapse)AuthorLines
2025-07-18Reword diagnostic about relaxing non-`Sized` boundLeón Orell Valerian Liehr-10/+10
* The phrasing "only does something for" made sense back when this diagnostic was a (hard) warning. Now however, it's simply a hard error and thus completely rules out "doing something". * The primary message was way too long * The new wording more closely mirrors the wording we use for applying other bound modifiers (like `const` and `async`) to incompatible traits. * "all other traits are not bound by default" is no longer accurate under Sized Hierarchy. E.g., traits and assoc tys are (currently) bounded by `MetaSized` by default but can't be relaxed using `?MetaSized` (instead, you relax it by adding `PointeeSized`). * I've decided against adding any diagnositic notes or suggestions for now like "trait `Trait` can't be relaxed as it's not bound by default" which would be incorrect for `MetaSized` and assoc tys as mentioned above) or "consider changing `?MetaSized` to `PointeeSized`" as the Sized Hierarchy impl is still WIP)
2025-07-15Recover and suggest use `;` to construct array typexizheyin-35/+0
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-07Add `ty_span` queryOli Scherer-2/+2
2025-06-30Don't look at static items' HIR for wfcheckOli Scherer-4/+4
2025-06-27const checks: avoid 'top-level scope' terminologyRalf Jung-3/+7
2025-06-26clarify and unify 'transient mutable borrow' errorsRalf Jung-2/+2
2025-06-24Rollup merge of #142704 - tgross35:remove-concat_idents, r=fee1-deadGuillaume Gomez-39/+0
Remove the deprecated unstable `concat_idents!` macro In [rust-lang/rust#137653], the lang and libs-API teams did a joint FCP to deprecate and eventually remove the long-unstable `concat_idents!` macro. The deprecation is landing in 1.88, so do the removal here (target version 1.90). This macro has been superseded by the more recent `${concat(...)}` metavariable expression language feature, which avoids some of the limitations of `concat_idents!`. The metavar expression is unstably available under the [`macro_metavar_expr_concat`] feature. History is mildly interesting here: `concat_idents!` goes back to 2011 when it was introduced with 513276e595f8 ("Add #concat_idents[] and #ident_to_str[]"). The syntax looks a bit different but it still works about the same: let asdf_fdsa = "<.<"; assert(#concat_idents[asd,f_f,dsa] == "<.<"); assert(#ident_to_str[use_mention_distinction] == "use_mention_distinction"); (That test existed from introduction until its removal here.) Closes: https://github.com/rust-lang/rust/issues/29599 [rust-lang/rust#137653]: https://github.com/rust-lang/rust/pull/137653 [`macro_metavar_expr_concat`]: https://github.com/rust-lang/rust/issues/124225
2025-06-24Move some `issues-*` tests to better homesTrevor Gross-73/+0
These tests were updated in the previous commit; while they are being cleaned up, move them to a non-issue directory.
2025-06-24Migrate some tests away from `concat-idents`Trevor Gross-23/+57
`concat_idents!` is in the process of being removed, but a few things it is used to test will still be relevant. Migrate these tests to something other than `concat_idents`.
2025-06-23compiletest: Improve diagnostics for line annotation mismatchesVadim Petrochenkov-3/+3
2025-06-22Implement DesugaringKind::FormatLiteralmejrs-6/+3
2025-06-18better template for repr attributesJana Dönszelmann-2/+2
2025-06-17make error codes reflect reality betterJana Dönszelmann-24/+24
2025-06-17use consistent attr errors in all attribute parsersJana Dönszelmann-2/+2
2025-06-17fix bugs in inline/force_inline and diagnostics of all attr parsersJana Dönszelmann-19/+43
2025-06-14Rollup merge of #141811 - mejrs:bye_locals, r=compiler-errorsMatthias Krüger-1/+0
Unimplement unsized_locals Implements https://github.com/rust-lang/compiler-team/issues/630 Tracking issue here: https://github.com/rust-lang/rust/issues/111942 Note that this just removes the feature, not the implementation, and does not touch `unsized_fn_params`. This is because it is required to support `Box<dyn FnOnce()>: FnOnce()`. There may be more that should be removed (possibly in follow up prs) - the `forget_unsized` function and `forget` intrinsic. - the `unsized_locals` test directory; I've just fixed up the tests for now - various codegen support for unsized values and allocas cc ``@JakobDegen`` ``@oli-obk`` ``@Noratrieb`` ``@programmerjake`` ``@bjorn3`` ``@rustbot`` label F-unsized_locals Fixes rust-lang/rust#79409
2025-06-13Unimplement unsized_localsmejrs-1/+0
2025-06-12Rollup merge of #134536 - Urgau:fn-ptr-option, r=compiler-errors,traviscrossMatthias Krüger-0/+1
Lint on fn pointers comparisons in external macros This PR extends the recently stabilized `unpredictable_function_pointer_comparisons` lint ~~to also lint on `Option<{function pointer}>` and~~ as well as linting in external macros (as to catch `assert_eq!` and others). ```rust assert_eq!(Some::<FnPtr>(func), Some(func as unsafe extern "C" fn())); //~^ WARN function pointer comparisons #[derive(PartialEq, Eq)] struct A { f: fn(), //~^ WARN function pointer comparisons } ``` Fixes https://github.com/rust-lang/rust/issues/134527
2025-06-12Allow `unpredictable_function_pointer_comparisons` lint in more placesUrgau-0/+1
2025-06-09Make E0621 missing lifetime suggestion verboseEsteban Küber-15/+31
``` 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-08Auto merge of #142008 - RalfJung:const-eval-error-here, r=oli-obkbors-1/+1
const-eval error: always say in which item the error occurred I don't see why "is this generic" should make a difference. It may be reasonable to key this on whether the error occurs in a `const fn` that was invoked by a const (making it non-obvious which constant it is) vs inside the body of the const. r? `@oli-obk`
2025-06-07const-eval error: always say in which item the error occurredRalf Jung-1/+1
also adjust the wording a little so that we don't say "the error occurred here" for two different spans
2025-06-07Rollup merge of #142131 - estebank:cast-sugg, r=UrgauJacob Pratt-8/+18
Make cast suggestions verbose ``` error[E0604]: only `u8` can be cast as `char`, not `u32` --> $DIR/E0604.rs:2:5 | LL | 1u32 as char; | ^^^^^^^^^^^^ invalid cast | help: try `char::from_u32` instead | LL - 1u32 as char; LL + char::from_u32(1u32); | ``` ``` error[E0620]: cast to unsized type: `&[u8]` as `[char]` --> $DIR/cast-to-slice.rs:6:5 | LL | arr as [char]; | ^^^^^^^^^^^^^ | help: try casting to a reference instead | LL | arr as &[char]; | + ``` ``` error[E0620]: cast to unsized type: `Box<{integer}>` as `dyn Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:3:5 | LL | Box::new(1) as dyn Send; | ^^^^^^^^^^^^^^^^^^^^^^^ | help: you can cast to a `Box` instead | LL | Box::new(1) as Box<dyn Send>; | ++++ + ``` Part of rust-lang/rust#141973.
2025-06-06reword suggestion messageEsteban Küber-1/+1
2025-06-06Make cast suggestions verboseEsteban Küber-8/+18
``` error[E0604]: only `u8` can be cast as `char`, not `u32` --> $DIR/E0604.rs:2:5 | LL | 1u32 as char; | ^^^^^^^^^^^^ invalid cast | help: try `char::from_u32` instead | LL - 1u32 as char; LL + char::from_u32(1u32); | ``` ``` error[E0620]: cast to unsized type: `&[u8]` as `[char]` --> $DIR/cast-to-slice.rs:6:5 | LL | arr as [char]; | ^^^^^^^^^^^^^ | help: try casting to a reference instead | LL | arr as &[char]; | + ``` ``` error[E0620]: cast to unsized type: `Box<{integer}>` as `dyn Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:3:5 | LL | Box::new(1) as dyn Send; | ^^^^^^^^^^^^^^^^^^^^^^^ | help: you can cast to a `Box` instead | LL | Box::new(1) as Box<dyn Send>; | ++++ + ```
2025-06-05Auto merge of #138677 - shepmaster:consistent-elided-lifetime-syntax, ↵bors-3/+3
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-05Auto merge of #142033 - matthiaskrgr:rollup-99lvg0j, r=matthiaskrgrbors-40/+40
Rollup of 11 pull requests Successful merges: - rust-lang/rust#141890 (Add link to correct documentation in htmldocck.py) - rust-lang/rust#141932 (Fix for async drop inside async gen fn) - rust-lang/rust#141960 (Use non-2015 edition paths in tests that do not test for their resolution) - rust-lang/rust#141968 (Run wfcheck in one big loop instead of per module) - rust-lang/rust#141969 (Triagebot: Remove `assign.users_on_vacation`) - rust-lang/rust#141985 (Ensure query keys are printed with reduced queries) - rust-lang/rust#141999 (Visit the ident in `PreciseCapturingNonLifetimeArg`.) - rust-lang/rust#142005 (Change `tag_field` to `FieldIdx` in `Variants::Multiple`) - rust-lang/rust#142017 (Fix incorrect use of "recommend" over "recommended") - rust-lang/rust#142024 (Don't refer to 'this tail expression' in expansion.) - rust-lang/rust#142025 (Don't refer to 'local binding' in extern macro.) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-04Rollup merge of #141960 - ferrocene:lw/2015-paths2, r=compiler-errorsMatthias Krüger-40/+40
Use non-2015 edition paths in tests that do not test for their resolution This allows for testing these tests on editions other than 2015 Follow up to https://github.com/rust-lang/rust/pull/141888
2025-06-04Replace `elided_named_lifetimes` with `mismatched_lifetime_syntaxes`Jake Goulding-3/+3
2025-06-04Rollup merge of #141959 - ferrocene:lw/2015-edition-directives2, ↵Matthias Krüger-6/+15
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-03Rollup merge of #141957 - ferrocene:lw/missing-dyn-kw2, r=compiler-errorsMatthias Krüger-20/+20
Add missing `dyn` keywords to tests that do not test for them Part 2 Some more tests that were found
2025-06-03Use non-2015 edition paths in tests that do not test for their resolutionLukas Wirth-40/+40
This allows for testing these tests on editions other than 2015
2025-06-03Add missing `dyn` keywords to tests that do not test for them Part 2Lukas Wirth-20/+20
2025-06-03Add missing 2015 edition directivesLukas Wirth-6/+15
These tests specifically test 2015 edition behavior, so ensure that they can only be run with this edition
2025-06-02Clarify why we are talking about a failed const eval at a random placeOli Scherer-1/+1
2025-06-02Use the informative error as the main const eval error messageOli Scherer-3/+3
2025-05-27Use more detailed spans in dyn compat errors within bodiesOli Scherer-16/+25
2025-05-26Deduplicate dyn compatibility violations due to coercionMichael Goulet-66/+3
2025-05-25Rollup merge of #141512 - Noratrieb:stop-trimming-this-much, r=compiler-errorsGuillaume Gomez-2/+2
Avoid extra path trimming in method not found error Method errors have an extra check that force trim paths whenever the normal string is longer than 10 characters, which can be quite unhelpful when multiple items have the same name (for example an `Error`). A user reported this force trimming as being quite unhelpful when they had a method error where the precise path of the `Error` mattered. The code uses `tcx.short_string` already to get the normal path, which tries to be clever around trimming paths if necessary, so there is no reason for this extra force trimming.
2025-05-24Avoid extra path trimming in method not found errorNoratrieb-2/+2
Method errors have an extra check that force trim paths whenever the normal string is longer than 10 characters, which can be quite unhelpful when multiple items have the same name (for example an `Error`). A user reported this force trimming as being quite unhelpful when they had a method error where the precise path of the `Error` mattered. The code uses `tcx.short_string` already to get the normal path, which tries to be clever around trimming paths if necessary, so there is no reason for this extra force trimming.
2025-05-23Do not try to confirm non-dyn compatible methodMichael Goulet-20/+3
2025-05-12Move more tests/ui testsmejrs-7/+0
2025-05-05Do not gather local all together at the beginning of typeckMichael Goulet-21/+4
2025-05-03compiletest: Do not require annotations on empty labels and suggestionsVadim Petrochenkov-4/+2
2025-04-30Auto merge of #140503 - matthiaskrgr:rollup-n7zigts, r=matthiaskrgrbors-30/+0
Rollup of 11 pull requests Successful merges: - #136160 (Remove backticks from `ShouldPanic::YesWithMessage`'s `TrFailedMsg`) - #139059 (uses_power_alignment: wording tweaks) - #139192 (mention provenance in the pointer::wrapping_offset docs) - #140312 (Improve pretty-printing of braces) - #140404 (rm `TypeVistable` impls for `Canonical`) - #140437 (enable msa feature for mips in codegen tests) - #140438 (Add `rust.debug-assertions-tools` option) - #140439 (miri: algebraic intrinsics: bring back float non-determinism) - #140445 (Treat ManuallyDrop as ~const Destruct) - #140446 (chore: fix some tests) - #140448 (Rename `rustc_query_append!` to `rustc_with_all_queries!`) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-30Rollup merge of #140446 - mejrs:test1, r=jieyouxuMatthias Krüger-30/+0
chore: fix some tests
2025-04-30compiletest: Make diagnostic kind mandatory on line annotationsVadim Petrochenkov-119/+158
2025-04-29Coalesce duplicate missing clone testsmejrs-30/+0
2025-04-26Fix error message for static references or mutable referencesyuk1ty-2/+2
2025-04-25Rollup merge of #137653 - tgross35:deprecate-concat_idents, r=workingjubileeMatthias Krüger-3/+5
Deprecate the unstable `concat_idents!` `concat_idents` has been around unstably for a long time, but there is now a better (but still unstable) way to join identifiers using `${concat(...)}` syntax with `macro_metavar_expr_concat`. This resolves a lot of the problems with `concat_idents` and is on a better track toward stabilization, so there is no need to keep both versions around. `concat_idents!` still has a lot of use in the ecosystem so deprecate it before removing, as discussed in [1]. Link: https://github.com/rust-lang/rust/issues/124225 [1]: https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Removing.20.60concat_idents.60