about summary refs log tree commit diff
path: root/tests/ui/issues
AgeCommit message (Collapse)AuthorLines
2025-02-21More sophisticated span trimmingMichael Goulet-15/+10
2025-02-19Rollup merge of #137059 - xizheyin:issue-136827, r=davidtwcoMatthias Krüger-2/+2
fix: Alloc new errorcode E0803 for E0495 As discussion in #136827, I alloc a new errorcode.
2025-02-15fix: Alloc new errorcode E0803 for E0495xizheyin-2/+2
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-02-14Trim suggestion parts to the subset that is purely additiveMichael Goulet-9/+9
2025-02-14Consider add-prefix replacements tooMichael Goulet-12/+8
2025-02-14Use underline suggestions for purely 'additive' replacementsMichael Goulet-15/+10
2025-02-14fallout :skull_emoji:lcnr-2/+29
2025-02-11Reject `impl Trait` bounds in various places where we unconditionally warned ↵Oli Scherer-12/+12
since 1.0
2025-02-10Show diff suggestion format on verbose replacementEsteban Küber-102/+153
``` 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-05Rollup merge of #136583 - Jarcho:fn_ctxt2, r=compiler-errorsJubilee-1/+1
Only highlight unmatchable parameters at the definition site Followup to #136497 This generally results more focused messages in the same vein as #99635 (see `test/ui/argument-suggestions/complex.rs`). There are still some cases (e.g. `test/ui/argument-suggestions/permuted_arguments.rs`) where it might be worth highlighting the arguments. This is mitigated by the fact that a suggestion with a suggested rearrangement is given. r? `@compiler-errors`
2025-02-05When displaying a parameter mismatch error, only highlight the mismatched ↵Jason Newcomb-1/+1
parameters when showing the definition.
2025-02-05Rollup merge of #136536 - DuskyElf:master, r=jieyouxu许杰友 Jieyou Xu (Joe)-404/+0
Rename and Move some UI tests to more suitable subdirs ## Affected Tests - tests/ui/issues/issue-48838.rs -> tests/ui/enum/closure-in-enum-issue-48838.rs https://github.com/rust-lang/rust/issues/48838 - tests/ui/issues/issue-40350.rs -> tests/ui/enum/enum-inside-enum-issue-40350.rs https://github.com/rust-lang/rust/issues/40350 - tests/ui/issues/issue-41272.rs -> tests/ui/expr/if/if-let-no-match-guards-issue-41272.rs https://github.com/rust-lang/rust/issues/41272 - tests/ui/issues/issue-40408.rs -> tests/ui/lexer/floating-point-0e10-issue-40408.rs https://github.com/rust-lang/rust/issues/40408 - tests/ui/issues/issue-40136.rs -> tests/ui/macros/const-expr-invocations-issue-40136.rs https://github.com/rust-lang/rust/issues/40136 - tests/ui/issues/issue-40845.rs -> tests/ui/macros/macros-in-trait-positions-issue-40845.rs https://github.com/rust-lang/rust/issues/40845 - tests/ui/issues/issue-41213.rs -> tests/ui/match/enum-and-break-in-match-issue-41213.rs https://github.com/rust-lang/rust/issues/41213 - tests/ui/issues/issue-40782.rs -> tests/ui/suggestions/for-loop-missing-in.rs https://github.com/rust-lang/rust/issues/40782 - tests/ui/issues/issue-40827.rs -> tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.rs https://github.com/rust-lang/rust/issues/40827 - tests/ui/issues/issue-40610.rs -> tests/ui/typeck/coercion-check-for-addition-issue-40610.rs https://github.com/rust-lang/rust/issues/40610 - tests/ui/issues/issue-40883.rs -> tests/ui/codegen/StackColoring-not-blowup-stack-issue-40883.rs https://github.com/rust-lang/rust/issues/40883 - tests/ui/issues/issue-40861.rs -> tests/ui/typeck/coercion-check-for-indexing-expression-issue-40861.rs https://github.com/rust-lang/rust/issues/40861 - tests/ui/issues/issue-41139.rs -> tests/ui/typeck/unsized-rvalue-issue-41139.rs https://github.com/rust-lang/rust/issues/41139 - tests/ui/issues/issue-40749.rs -> tests/ui/wf/range-expr-root-of-constant-issue-40749.rs https://github.com/rust-lang/rust/issues/40749 - tests/ui/issues/issue-40235.rs -> tests/ui/while/while-let-scope-issue-40235.rs https://github.com/rust-lang/rust/issues/40235
2025-02-04Rollup merge of #136477 - lqd:nll-tls-spans, r=matthewjasperMatthias Krüger-1/+1
Fix a couple NLL TLS spans Some NLL TLS tests show incorrect spans for the end of function. It seems that the `TerminatorKind::Return` source info span can sometimes point at the single character after the end of the function. Completely changing the span where the terminator is built also changes a bunch of diagnostics: small functions have more code shown unrelated to the errors at hand, wrapping symbols appear and weird-looking arrows point to the end of function, etc. So it seems this is somehow unexpectedly relied upon in making diagnostics look better and their heuristics. So I just changed it where it matters for these few tests: the diagnostics specialized to conflict errors with thread locals. r? `@matthewjasper`
2025-02-04Rollup merge of #136274 - compiler-errors:sized-wf, r=lcnrMatthias Krüger-4/+18
Check Sizedness of return type in WF Still need to clean this up a bit. This should fix https://github.com/rust-lang/trait-system-refactor-initiative/issues/150. r? lcnr
2025-02-04Rename and Move some UI tests to more suitable subdirsDuskyElf-404/+0
2025-02-04bless test expectationsRémy Rakic-1/+1
2025-02-04Rollup merge of #136167 - pitaj:new_range, r=NadrierilJacob Pratt-2/+2
Implement unstable `new_range` feature Switches `a..b`, `a..`, and `a..=b` to resolve to the new range types. For rust-lang/rfcs#3550 Tracking issue #123741 also adds the re-export that was missed in the original implementation of `new_range_api`
2025-02-03Make error message less awkwardMichael Goulet-2/+2
2025-02-03Check Sizedness of return type in WFMichael Goulet-2/+16
2025-01-31Auto merge of #136350 - matthiaskrgr:rollup-6eqfyvh, r=matthiaskrgrbors-12/+12
Rollup of 9 pull requests Successful merges: - #134531 ([rustdoc] Add `--extract-doctests` command-line flag) - #135860 (Compiler: Finalize dyn compatibility renaming) - #135992 (Improve documentation when adding a new target) - #136194 (Support clobber_abi in BPF inline assembly) - #136325 (Delay a bug when indexing unsized slices) - #136326 (Replace our `LLVMRustDIBuilderRef` with LLVM-C's `LLVMDIBuilderRef`) - #136330 (Remove unnecessary hooks) - #136336 (Overhaul `rustc_middle::util`) - #136341 (Remove myself from vacation) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-31Rollup merge of #135860 - fmease:compiler-mv-obj-save-dyn-compat-ii, r=jieyouxuMatthias Krüger-12/+12
Compiler: Finalize dyn compatibility renaming Update the Reference link to use the new URL fragment from https://github.com/rust-lang/reference/pull/1666 (this change has finally hit stable). Fixes a FIXME. Follow-up to #130826. Part of #130852. ~~Blocking it on #133372.~~ (merged) r? ghost
2025-01-30std::rangePeter Jaszkowiak-2/+2
2025-01-30normalize long-type.txt in testsRémy Rakic-13/+16
this allows compare-mode to share the same subdirectory and removes differences due to that
2025-01-27Make a previously unreachable UI test reachableLeón Orell Valerian Liehr-44/+0
2025-01-27Remove all dead files inside tests/ui/León Orell Valerian Liehr-88/+0
2025-01-26Compiler: Finalize dyn compatibility renamingLeón Orell Valerian Liehr-12/+12
2025-01-25Auto merge of #133154 - estebank:issue-133137, r=wesleywiserbors-3/+5
Reword resolve errors caused by likely missing crate in dep tree Reword label and add `help`: ``` error[E0432]: unresolved import `some_novel_crate` --> f704.rs:1:5 | 1 | use some_novel_crate::Type; | ^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `some_novel_crate` | = help: if you wanted to use a crate named `some_novel_crate`, use `cargo add some_novel_crate` to add it to your `Cargo.toml` ``` Fix #133137.
2025-01-25Rollup merge of #135971 - compiler-errors:self-projection, r=fmeaseMatthias Krüger-1/+1
Properly report error when object type param default references self I accidentally broke this error for cases where a type parameter references `Self` via a projection (i.e. `trait Foo<Arg = Self::Bar> {}`). This PR fixes that, and also makes the error a bit easier to understand. Fixes #135918
2025-01-24Properly report error when object type param default references selfMichael Goulet-1/+1
2025-01-24Reword "crate not found" resolve messageEsteban Küber-3/+5
``` error[E0432]: unresolved import `some_novel_crate` --> file.rs:1:5 | 1 | use some_novel_crate::Type; | ^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `some_novel_crate` ``` On resolve errors where there might be a missing crate, mention `cargo add foo`: ``` error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nope` --> $DIR/conflicting-impl-with-err.rs:4:11 | LL | impl From<nope::Thing> for Error { | ^^^^ use of unresolved module or unlinked crate `nope` | = help: if you wanted to use a crate named `nope`, use `cargo add nope` to add it to your `Cargo.toml` ```
2025-01-23tests: use `needs-threads` instead of `ignore-emscripten`许杰友 Jieyou Xu (Joe)-5/+5
2025-01-23tests: use `needs-subprocess` instead of `ignore-{wasm32,emscripten,sgx}`许杰友 Jieyou Xu (Joe)-14/+13
2025-01-23tests: update `tests/ui/issues/issue-2190-1.rs`许杰友 Jieyou Xu (Joe)-9/+5
- Convert `run-pass` to `check-pass`, the test is about closure inference based on expected type, does not need to run-pass. - Dropped unnecessary ignores.
2025-01-23tests: move `tests/ui/issues/issue-39175.rs` under `suggestions/` and rename许杰友 Jieyou Xu (Joe)-48/+0
2025-01-23tests: adjust `tests/ui/issues/issue-39175.rs`许杰友 Jieyou Xu (Joe)-7/+22
- Change test to check only. - Don't ignore `wasm` or `sgx`. - Gate test to be Unix only because Unix `CommandExt` influences the suggestion. - Run rustfix on the suggestion.
2025-01-22Rollup merge of #135816 - BoxyUwU:root_normalizes_to_goal_ice, r=lcnrMatthias Krüger-4/+33
Use `structurally_normalize` instead of manual `normalizes-to` goals in alias relate errors r? `@lcnr` I added `structurally_normalize_term` so that code that is generic over ty or const can use the structurally normalize helpers. See `tests/ui/traits/next-solver/diagnostics/alias_relate_error_uses_structurally_normalize.rs` for a description of the reason for the (now fixed) ICEs
2025-01-22Refactor dyn-compatibility error and suggestionsTaylor Cramer-57/+69
This CL makes a number of small changes to dyn compatibility errors: - "object safety" has been renamed to "dyn-compatibility" throughout - "Convert to enum" suggestions are no longer generated when there exists a type-generic impl of the trait or an impl for `dyn OtherTrait` - Several error messages are reorganized for user readability Additionally, the dyn compatibility error creation code has been split out into functions. cc #132713 cc #133267
2025-01-22Use `structurally_normalize` instead of manual `normalizes-to` goalsBoxy-4/+33
2025-01-21Auto merge of #134299 - RalfJung:remove-start, r=compiler-errorsbors-39/+0
remove support for the (unstable) #[start] attribute As explained by `@Noratrieb:` `#[start]` should be deleted. It's nothing but an accidentally leaked implementation detail that's a not very useful mix between "portable" entrypoint logic and bad abstraction. I think the way the stable user-facing entrypoint should work (and works today on stable) is pretty simple: - `std`-using cross-platform programs should use `fn main()`. the compiler, together with `std`, will then ensure that code ends up at `main` (by having a platform-specific entrypoint that gets directed through `lang_start` in `std` to `main` - but that's just an implementation detail) - `no_std` platform-specific programs should use `#![no_main]` and define their own platform-specific entrypoint symbol with `#[no_mangle]`, like `main`, `_start`, `WinMain` or `my_embedded_platform_wants_to_start_here`. most of them only support a single platform anyways, and need cfg for the different platform's ways of passing arguments or other things *anyways* `#[start]` is in a super weird position of being neither of those two. It tries to pretend that it's cross-platform, but its signature is a total lie. Those arguments are just stubbed out to zero on ~~Windows~~ wasm, for example. It also only handles the platform-specific entrypoints for a few platforms that are supported by `std`, like Windows or Unix-likes. `my_embedded_platform_wants_to_start_here` can't use it, and neither could a libc-less Linux program. So we have an attribute that only works in some cases anyways, that has a signature that's a total lie (and a signature that, as I might want to add, has changed recently, and that I definitely would not be comfortable giving *any* stability guarantees on), and where there's a pretty easy way to get things working without it in the first place. Note that this feature has **not** been RFCed in the first place. *This comment was posted [in May](https://github.com/rust-lang/rust/issues/29633#issuecomment-2088596042) and so far nobody spoke up in that issue with a usecase that would require keeping the attribute.* Closes https://github.com/rust-lang/rust/issues/29633 try-job: x86_64-gnu-nopt try-job: x86_64-msvc-1 try-job: x86_64-msvc-2 try-job: test-various
2025-01-21remove support for the #[start] attributeRalf Jung-39/+0
2025-01-21Auto merge of #133830 - compiler-errors:span-key, r=lcnrbors-2/+2
Rework dyn trait lowering to stop being so intertwined with trait alias expansion This PR reworks the trait object lowering code to stop handling trait aliases so funky, and removes the `TraitAliasExpander` in favor of a much simpler design. This refactoring is important for making the code that I'm writing in https://github.com/rust-lang/rust/pull/133397 understandable and easy to maintain, so the diagnostics regressions are IMO inevitable. In the old trait object lowering code, we used to be a bit sloppy with the lists of traits in their unexpanded and expanded forms. This PR largely rewrites this logic to expand the trait aliases *once* and handle them more responsibly throughout afterwards. Please review this with whitespace disabled. r? lcnr
2025-01-15Rework trait expansion to happen once explicitlyMichael Goulet-2/+2
2025-01-14Do not consider traits that have unsatisfied const conditions to be ↵Michael Goulet-6/+9
conditionally const
2025-01-09Unify conditional and non const call error reportingMichael Goulet-3/+9
2025-01-09Add note back to conditionally-const error messageMichael Goulet-0/+1
2025-01-06Normalize each signature input/output in typeck_with_fallback with its own spanMichael Goulet-14/+7
2025-01-01Try to write the panic message with a single `write_all` callJohn Kåre Alsaker-0/+2
2025-01-01Rollup merge of #134945 - compiler-errors:map-mutate-nits, r=estebankStuart Cook-1/+4
Some small nits to the borrowck suggestions for mutating a map through index 1. Suggesting users to either use `.insert` or `.get_mut` (which do totally different things) can be a bit of a footgun, so let's make that a bit more nuanced. 2. I find the suggestion of `.get_mut(|val| { *val = whatever; })` to be a bit awkward. I changed this to be an if-let instead. 3. Fix a bug which was suppressing the structured suggestion for some mutations via the index operator on `HashMap`/`BTreeMap`. r? estebank or reassign
2024-12-31Rollup merge of #133486 - dianne:fix-move-error-suggestion, r=estebankTrevor Gross-12/+16
borrowck diagnostics: make `add_move_error_suggestions` use the HIR rather than `SourceMap` This PR aims to fix #132806 by rewriting `add_move_error_suggestions`[^1]. Previously, it manually scanned the source text to find a leading `&`, which isn't always going to produce a correct result (see: that issue). Admittedly, the HIR visitor in this PR introduces a lot of boilerplate, but hopefully the logic at its core isn't too complicated (I go over it in the comments). I also tried a simpler version that didn't use a HIR visitor and suggested adding `ref` always, but the `&ref x` suggestions really didn't look good. As a bonus for the added complexity though, it's now able to produce nice `&`-removing suggestions in more cases. I tried to do this such that it avoids edition-dependent checks and its suggestions can be applied together with those from the match ergonomics 2024 migration lint. I haven't added tests for that since the details of match ergonomics 2024 are still being sorted out, but I can try if desired once that's finalized. [^1]: In brief, it fires on patterns where users try to bind by-value in such a way that moves out of a reference to a non-Copy type (including slice references with non-copy elements). The suggestions are to change the binding's mode to be by-reference, either by removing[^2] an enclosing `&`/`&mut` or adding `ref` to the binding. [^2]: Incidentally, I find the terminology of "consider removing the borrow" a bit confusing for a suggestion to remove a `&` pattern in order to make bindings borrow rather than move. I'm not sure what a good, concise way to explain that would be though, and that should go in a separate PR anyway.
2024-12-31Fix span for IndexMut method call on HashMap/BTreeMapMichael Goulet-1/+4