about summary refs log tree commit diff
path: root/compiler/rustc_error_codes
AgeCommit message (Collapse)AuthorLines
2025-10-02Rollup merge of #146585 - hkBst:indexing-1, r=jdonszelmannMatthias Krüger-4/+11
indexing: reword help After looking at https://github.com/rust-lang/rust/issues/40850, I thought I'd try to improve wording around error E0608 a bit. Hopefully I've succeeded.
2025-10-01indexing: reword helpMarijn Schouten-4/+11
Co-authored-by: beef <ent3rm4n@gmail.com>
2025-09-24Address review commentsJules Bertholet-1/+1
2025-09-18Enforce E0719 only for trait aliasesJules Bertholet-10/+4
2025-08-27Changes to the uitestsJonathan Brouwer-1/+3
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-15Rollup merge of #144944 - He1pa:E0793, r=compiler-errorsStuart Cook-1/+33
E0793: Clarify that it applies to unions as well pick up inactive PR: https://github.com/rust-lang/rust/pull/131472 Also: Adjust the language slightly to be more consistent with other similar messages (was created instead of got created). Add a short section on union. Add an example line showing referencing a field in a packed struct is safe if the field's type isn't more strictly aligned than the pack. r? compiler-errors
2025-08-14Remove the old target checking logicJonathan Brouwer-6/+18
2025-08-13resolve: Split extern prelude into two scopesVadim Petrochenkov-1/+3
One for `--extern` options and another for `extern crate` items.
2025-08-12E0793: Clarify that it applies to unions as well黑怕-1/+33
2025-08-02Update E0562 to account for the new impl trait positionsNoratrieb-5/+4
2025-07-23Update uitest stderrsJonathan Brouwer-1/+3
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-18Don't reject *multiple* relaxed bounds, reject *duplicate* ones.León Orell Valerian Liehr-5/+5
Having multiple relaxed bounds like `?Sized + ?Iterator` is actually *fine*. We actually want to reject *duplicate* relaxed bounds like `?Sized + ?Sized` because these most certainly represent a user error. Note that this doesn't mean that we accept more code because a bound like `?Iterator` is still invalid as it's not relaxing a *default* trait and the only way to define / use more default bounds is under the experimental and internal feature `more_maybe_bounds` plus `lang_items` plus unstable flag `-Zexperimental-default-bounds` (historical context: for the longest time, bounds like `?Iterator` were actually allowed and lead to a hard warning). Ultimately, this simply *reframes* the diagnostic. The scope of `more_maybe_bounds` / `-Zexperimental-default-bounds` remains unchanged as well.
2025-07-15New example for E0536Jonathan Brouwer-9/+7
2025-06-25compiler: Trim the misleading C of C-cmse from errorsJubilee Young-13/+13
2025-06-18convert the `optimize` attribute to a new parserJana Dönszelmann-1/+8
2025-06-17make error codes reflect reality betterJana Dönszelmann-9/+71
2025-06-07intrinsics: use const generic to set atomic orderingRalf Jung-29/+7
2025-06-05doc: Fix inverted meaning in E0783.mdmaflcko-1/+1
2025-05-28Stabilise `repr128`beetrees-9/+3
2025-05-02resolve: Support imports of associated types and glob imports from traitsVadim Petrochenkov-1/+5
2025-05-01Rollup merge of #138703 - pudongair:master, r=workingjubileeGuillaume Gomez-1/+1
chore: remove redundant words in comment remove redundant words in comment
2025-04-20stabilize `naked_functions`Folkert de Vries-2/+0
2025-04-19Make `#[naked]` an unsafe attributeFolkert de Vries-2/+2
2025-04-13error on unsafe attributes in pre-2024 editionsFolkert de Vries-7/+8
the `no_mangle`, `link_section` and `export_name` attributes are exceptions, and can still be used without an unsafe in earlier editions
2025-04-09Remove some dead or leftover code related to rustc-intrinsic abi removalOli Scherer-2/+4
2025-04-06update/bless testsBennet Bleßmann-5/+5
2025-03-26chore: remove redundant words in commentpudongair-1/+1
Signed-off-by: pudongair <744355276@qq.com>
2025-03-25Avoid `kw::Empty` when dealing with `rustc_allowed_through_unstable_modules`.Nicholas Nethercote-1/+1
The existing code produces `Some(kw::Empty)` for these invalid forms: - a non-name-value, e.g. `#[rustc_allowed_through_unstable_modules]` - a non-string arg, e.g. `#[rustc_allowed_through_unstable_modules = 3]` The new code avoids the `kw::Empty` and is a little shorter. It will produce `None` in those cases, which means E0789 won't be produced if the `stable` attribute is missing for these invalid forms. This doesn't matter, because these invalid forms will trigger an "malformed `rustc_allowed_through_unstable_modules` attribute" anyway.
2025-03-21Rollup merge of #138364 - BLANKatGITHUB:compiler, r=RalfJungMatthias Krüger-25/+17
ports the compiler test cases to new rust_intrinsic format pr is part of #132735
2025-03-19Allow builtin macros to be used more than once.Mara Bos-39/+3
This removes E0773 "A builtin-macro was defined more than once."
2025-03-18updated compiler tests for rustc_intrinsic'aaishwarymishra@gmail.com-25/+17
Update compiler/rustc_error_codes/src/error_codes/E0622.md Co-authored-by: Ralf Jung <post@ralfj.de> reverted chages on E0622.md updated E0622.md
2025-03-14Clarify "owned data" in E0515.mdMarijn Schouten-3/+6
This clarifies the explanation of why this is not allowed and also what to do instead. Fixes 62071 PS There was suggestion of adding a link to the book. I did not yet do that, but if desired that could be added.
2025-03-12Rollup merge of #138331 - nnethercote:use-RUSTC_LINT_FLAGS-more, ↵Matthias Krüger-1/+0
r=onur-ozkan,jieyouxu Use `RUSTC_LINT_FLAGS` more An alternative to the failed #138084. Fixes #138106. r? ````@jieyouxu````
2025-03-11Auto merge of #128440 - oli-obk:defines, r=lcnrbors-0/+4
Add `#[define_opaques]` attribute and require it for all type-alias-impl-trait sites that register a hidden type Instead of relying on the signature of items to decide whether they are constraining an opaque type, the opaque types that the item constrains must be explicitly listed. A previous version of this PR used an actual attribute, but had to keep the resolved `DefId`s in a side table. Now we just lower to fields in the AST that have no surface syntax, instead a builtin attribute macro fills in those fields where applicable. Note that for convenience referencing opaque types in associated types from associated methods on the same impl will not require an attribute. If that causes problems `#[defines()]` can be used to overwrite the default of searching for opaques in the signature. One wart of this design is that closures and static items do not have generics. So since I stored the opaques in the generics of functions, consts and methods, I would need to add a custom field to closures and statics to track this information. During a T-types discussion we decided to just not do this for now. fixes #131298
2025-03-11Implement `#[define_opaque]` attribute for functions.Oli Scherer-0/+4
2025-03-11Remove `#![warn(unreachable_pub)]` from all `compiler/` crates.Nicholas Nethercote-1/+0
It's no longer necessary now that `-Wunreachable_pub` is being passed.
2025-03-10Revert "Use workspace lints for crates in `compiler/` #138084"许杰友 Jieyou Xu (Joe)-3/+1
Revert <https://github.com/rust-lang/rust/pull/138084> to buy time to consider options that avoids breaking downstream usages of cargo on distributed `rustc-src` artifacts, where such cargo invocations fail due to inability to inherit `lints` from workspace root manifest's `workspace.lints` (this is only valid for the source rust-lang/rust workspace, but not really the distributed `rustc-src` artifacts). This breakage was reported in <https://github.com/rust-lang/rust/issues/138304>. This reverts commit 48caf81484b50dca5a5cebb614899a3df81ca898, reversing changes made to c6662879b27f5161e95f39395e3c9513a7b97028.
2025-03-08Remove `#![warn(unreachable_pub)]` from all `compiler/` crates.Nicholas Nethercote-1/+0
(Except for `rustc_codegen_cranelift`.) It's no longer necessary now that `unreachable_pub` is in the workspace lints.
2025-03-08Specify rust lints for `compiler/` crates via Cargo.Nicholas Nethercote-0/+3
By naming them in `[workspace.lints.rust]` in the top-level `Cargo.toml`, and then making all `compiler/` crates inherit them with `[lints] workspace = true`. (I omitted `rustc_codegen_{cranelift,gcc}`, because they're a bit different.) The advantages of this over the current approach: - It uses a standard Cargo feature, rather than special handling in bootstrap. So, easier to understand, and less likely to get accidentally broken in the future. - It works for proc macro crates. It's a shame it doesn't work for rustc-specific lints, as the comments explain.
2025-03-05Rollup merge of #136764 - ↵许杰友 Jieyou Xu (Joe)-0/+42
traviscross:TC/make-ptr_cast_add_auto_to_object-hard-error, r=oli-obk Make `ptr_cast_add_auto_to_object` lint into hard error In Rust 1.81, we added a FCW lint (including linting in dependencies) against pointer casts that add an auto trait to dyn bounds. This was part of work making casts of pointers involving trait objects stricter, and was part of the work needed to restabilize trait upcasting. We considered just making this a hard error, but opted against it at that time due to breakage found by crater. This breakage was mostly due to the `anymap` crate which has been a persistent problem for us. It's now a year later, and the fact that this is not yet a hard error is giving us pause about stabilizing arbitrary self types and `derive(CoercePointee)`. So let's see about making a hard error of this. r? ghost cc ```@adetaylor``` ```@Darksonn``` ```@BoxyUwU``` ```@RalfJung``` ```@compiler-errors``` ```@oli-obk``` ```@WaffleLapkin``` Related: - https://github.com/rust-lang/rust/pull/135881 - https://github.com/rust-lang/rust/issues/136702 - https://github.com/rust-lang/rust/pull/136776 Tracking: - https://github.com/rust-lang/rust/issues/127323 - https://github.com/rust-lang/rust/issues/44874 - https://github.com/rust-lang/rust/issues/123430
2025-03-03Add ``dyn`` keywordKirill Podoprigora-2/+2
2025-02-27Update E0133 docs for 2024 editionEric Huss-1/+2
2025-02-24Rollup merge of #137489 - ↵Michael Goulet-11/+3
RalfJung:no-more-rustc_intrinsic_must_be_overridden, r=oli-obk remove `#[rustc_intrinsic_must_be_overridde]` In https://github.com/rust-lang/rust/pull/135031, we gained support for just leaving away the body. Now that the bootstrap compiler got bumped, stop using the old style and remove support for it. r? `@oli-obk` There are a few more mentions of this attribute in RA code that I didn't touch; Cc `@rust-lang/rust-analyzer`
2025-02-24Consolidate and rework CoercePointee and DispatchFromDyn errorsMichael Goulet-117/+44
2025-02-24remove support for rustc_intrinsic_must_be_overridden from the compilerRalf Jung-11/+3
2025-02-22Make `ptr_cast_add_auto_to_object` lint into hard errorTravis Cross-0/+42
In Rust 1.81, we added a FCW lint (including linting in dependencies) against pointer casts that add an auto trait to dyn bounds. This was part of work making casts of pointers involving trait objects stricter which was needed to restabilize trait upcasting. We considered just making this a hard error at the time, but opted against it due to breakage found by crater. This breakage was mostly due to the `anymap` crate which has been a persistent problem for us. It's now a year later, and the fact that this is not yet a hard error is giving us pause about stabilizing arbitrary self types and `derive(CoercePointee)`. So let's now make a hard error of this.
2025-02-22Upgrade the compiler to edition 2024Michael Goulet-1/+1
2025-02-15fix: Alloc new errorcode E0803 for E0495xizheyin-0/+47
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-02-10fix the error code documentDing Xiang Fei-0/+14
2025-02-09introduce CoercePointeeWellformed for coherence checks at typeck stageDing Xiang Fei-0/+81