summary refs log tree commit diff
path: root/tests/ui/error-codes
AgeCommit message (Collapse)AuthorLines
2025-03-14Revert "Rollup merge of #136274 - compiler-errors:sized-wf, r=lcnr"Michael Goulet-2/+2
This reverts commit a8ecb79d19e1bad732dae7f34f2481499db12f7c, reversing changes made to 40c4e05013c1805044ae2611ba0b95c0acecd331. (cherry picked from commit 9ea587e023dfa4458c5003ba74ae02bd146ec2df)
2025-02-14Trim suggestion parts to the subset that is purely additiveMichael Goulet-3/+3
2025-02-14Consider add-prefix replacements tooMichael Goulet-9/+6
2025-02-12Split out the `extern_system_varargs` featureJubilee Young-1/+1
After the stabilization PR was opened, `extern "system"` functions were added to `extended_varargs_abi_support`. This has a number of questions regarding it that were not discussed and were somewhat surprising. It deserves to be considered as its own feature, separate from `extended_varargs_abi_support`.
2025-02-11Revert "Stabilize `extended_varargs_abi_support`"Jubilee Young-1/+1
This reverts commit 685f189b4307435b83d625fea397ef36dff4e955.
2025-02-10Show diff suggestion format on verbose replacementEsteban Küber-76/+115
``` 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-06Label mismatched parameters at the def site for foreign functions.Jason Newcomb-1/+1
2025-02-05When displaying a parameter mismatch error, only highlight the mismatched ↵Jason Newcomb-1/+1
parameters when showing the definition.
2025-02-04Rollup merge of #136274 - compiler-errors:sized-wf, r=lcnrMatthias Krüger-2/+2
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-03fix `json-*.rs` and `E0462` tests for compare-modesRémy Rakic-1/+1
2025-02-03fix `crateresolve*.rs` tests and duplicates for compare modesRémy Rakic-2/+2
- duplicates of crateresolve1 are used in a couple error-codes tests - also fix the note in crateresolve1 to link to these other duplicates, now that E0523 has been merged into E0464
2025-02-03Make error message less awkwardMichael Goulet-2/+2
2025-02-02rustc_allowed_through_unstable_modules: require deprecation messageRalf Jung-1/+1
2025-01-26Compiler: Finalize dyn compatibility renamingLeón Orell Valerian Liehr-2/+2
2025-01-25Auto merge of #133154 - estebank:issue-133137, r=wesleywiserbors-2/+2
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-24Properly report error when object type param default references selfMichael Goulet-1/+1
2025-01-24Reword "crate not found" resolve messageEsteban Küber-2/+2
``` 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-22Refactor dyn-compatibility error and suggestionsTaylor Cramer-8/+10
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-21Auto merge of #134299 - RalfJung:remove-start, r=compiler-errorsbors-54/+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-54/+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-18Emit a single privacy error for multiple fields on the same struct expressionEsteban Küber-1/+1
Collect all unreachable fields in a single struct literal struct and emit a single error, instead of one error per private field. ``` error[E0451]: fields `beta` and `gamma` of struct `Alpha` are private --> $DIR/visibility.rs:18:13 | LL | let _x = Alpha { | ----- in this type LL | beta: 0, | ^^^^^^^ private field LL | .. | ^^ field `gamma` is private ```
2025-01-16Rollup merge of #134754 - ↵Matthias Krüger-5/+5
frank-king:feature/import_trait_associated_functions, r=oli-obk Implement `use` associated items of traits This PR implements #134691.
2025-01-16Implement `use` associated items of traitsFrank King-5/+5
2025-01-15Rework trait expansion to happen once explicitlyMichael Goulet-2/+2
2025-01-06Normalize each signature input/output in typeck_with_fallback with its own spanMichael Goulet-2/+2
2025-01-02Make suggestion verbose and tweak error messageMichael Goulet-4/+6
2024-12-27Remove the `-test` suffix from normalize directivesZalathar-13/+13
2024-12-24Rollup merge of #134701 - compiler-errors:non-const-def-descr, r=Urgau,fmeaseStuart Cook-6/+6
Correctly note item kind in `NonConstFunctionCall` error message Don't just call everything a "`fn`". This is more consistent with the error message we give for conditionally-const items, which do note the item's def kind. r? fmease, this is a prerequisite for making those `~const PartialEq` error messages better. Re-roll if you're busy or don't want to review this.
2024-12-23Note def descr in NonConstFunctionCallMichael Goulet-6/+6
2024-12-23Always run tail_expr_drop_order lint on promoted MIRMichael Goulet-1/+19
2024-12-07reword trait bound suggestion message to include the boundsEsteban Küber-2/+2
2024-12-02Add `core::arch::breakpoint` and testJosh Triplett-4/+4
Approved in [ACP 491](https://github.com/rust-lang/libs-team/issues/491). Remove the `unsafe` on `core::intrinsics::breakpoint()`, since it's a safe intrinsic to call and has no prerequisites. (Thanks to @zachs18 for figuring out the `bootstrap`/`not(bootstrap)` logic.)
2024-11-30Rollup merge of #133620 - ↵许杰友 Jieyou Xu (Joe)-5/+30
dev-ardi:simplify-hir_typeck_pass_to_variadic_function, r=compiler-errors Simplify hir_typeck_pass_to_variadic_function r? ``@compiler-errors`` This reworks a bit how the diagnostic is generated so that it does the same as #133538 The `help` is useless now so I removed it
2024-11-30Rollup merge of #116161 - Soveu:varargs2, r=cjgillot许杰友 Jieyou Xu (Joe)-1/+1
Stabilize `extended_varargs_abi_support` I think that is everything? If there is any documentation regarding `extern` and/or varargs to correct, let me know, some quick greps suggest that there might be none. Tracking issue: https://github.com/rust-lang/rust/issues/100189
2024-11-29simplify how the `hir_typeck_pass_to_variadic_function` diagnostic is createdOrion Gonzalez-5/+30
2024-11-29Rollup merge of #133538 - dev-ardi:69232-better-diag, r=compiler-errorsMatthias Krüger-5/+8
Better diagnostic for fn items in variadic functions closes #69232
2024-11-29bless the tests and add a new oneOrion Gonzalez-5/+8
2024-11-27Stabilize `extended_varargs_abi_support`Soveu-1/+1
2024-11-27Bless tests due to extra error reporting due to normalizing types that are ↵Michael Goulet-2/+5
not WF It's okay though b/c these are duplicated diagnostics.
2024-11-23Update tests for new TRPL chapter orderChris Krycho-1/+1
2024-11-08remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic ↵Ralf Jung-19/+21
functions instead
2024-11-04Rollup merge of #132025 - duncpro:E0027, r=compiler-errorsJubilee-0/+16
fix suggestion for diagnostic error E0027 Closes #132008
2024-10-29Remove detail from label/note that is already available in other noteEsteban Küber-2/+2
Remove the "which is required by `{root_obligation}`" post-script in "the trait `X` is not implemented for `Y`" explanation in E0277. This information is already conveyed in the notes explaining requirements, making it redundant while making the text (particularly in labels) harder to read. ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ``` vs the prior ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ```
2024-10-24add third help hint to diagnostic error E0027Duncan Proctor-0/+16
2024-10-19Prevent overflowing enum cast from ICEingclubby789-2/+68
2024-10-17Rollup merge of #128391 - cafce25:issue-128390, r=lcnrMatthias Krüger-6/+8
Change orphan hint from "only" to "any uncovered type inside..." Fix #128390
2024-10-15stabilize `-Znext-solver=coherence`lcnr-1/+1
2024-10-08fix/update teach_note from 'escaping mutable ref/ptr' const-checkRalf Jung-1/+1
2024-10-04Use wide pointers consistenly across the compilerUrgau-1/+1