summary refs log tree commit diff
path: root/compiler/rustc_error_codes
AgeCommit message (Collapse)AuthorLines
2024-10-09Fix typo in E0793Alyssa Haroldsen-1/+1
2024-10-06disallow `asm!` in `#[naked]` functionsFolkert de Vries-3/+2
also disallow the `noreturn` option, and infer `naked_asm!` as `!`
2024-10-04Use wide pointers consistenly across the compilerUrgau-5/+5
2024-09-27Rollup merge of #130826 - fmease:compiler-mv-obj-safe-dyn-compat, ↵Matthias Krüger-16/+19
r=compiler-errors Compiler: Rename "object safe" to "dyn compatible" Completed T-lang FCP: https://github.com/rust-lang/lang-team/issues/286#issuecomment-2338905118. Tracking issue: https://github.com/rust-lang/rust/issues/130852 Excludes `compiler/rustc_codegen_cranelift` (to be filed separately). Includes Stable MIR. Regarding https://github.com/rust-lang/rust/labels/relnotes, I guess I will manually open a https://github.com/rust-lang/rust/labels/relnotes-tracking-issue since this change affects everything (compiler, library, tools, docs, books, everyday language). r? ghost
2024-09-26Stabilize `const_refs_to_static`Ding Xiang Fei-1/+1
update tests fix bitwidth-sensitive stderr output use build-fail for asm tests
2024-09-25Compiler: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-16/+19
2024-09-21mark `E0775` as no longer emitte by the compilerFolkert de Vries-0/+2
2024-09-21remove `#[cmse_nonsecure_entry]`Folkert-4/+6
2024-09-20Auto merge of #124895 - obeis:static-mut-hidden-ref, r=compiler-errorsbors-3/+4
Disallow hidden references to mutable static Closes #123060 Tracking: - https://github.com/rust-lang/rust/issues/123758
2024-09-16Introduce distinct error codes for precise capturingMichael Goulet-0/+32
2024-09-15stabilize const_mut_refsRalf Jung-4/+0
2024-09-13Disallow hidden references to mutable staticObei Sideg-3/+4
2024-09-09Ban non-array SIMDScott McMurray-17/+23
2024-09-02chore: Fix typos in 'compiler' (batch 1)Alexander Cyon-1/+1
2024-08-27Add `warn(unreachable_pub)` to `rustc_error_codes`.Nicholas Nethercote-0/+1
2024-08-18stabilize raw_ref_opRalf Jung-2/+0
2024-08-07Update E0517 message to reflect RFC 2195.Zachary S-7/+12
2024-07-29Stabilize offset_of_nestedGeorge Bateman-2/+2
2024-07-28Rollup merge of #127853 - folkertdev:naked-function-error-messages, r=bjorn3Matthias Krüger-7/+13
`#[naked]`: report incompatible attributes tracking issue: https://github.com/rust-lang/rust/issues/90957 this is a re-implementation of https://github.com/rust-lang/rust/pull/93809 by ``@bstrie`` which was closed 2 years ago due to inactivity. This PR takes some of the final comments into account, specifically providing a little more context in error messages, and using an allow list to determine which attributes are compatible with `#[naked]`. Notable attributes that are incompatible with `#[naked]` are: * `#[inline]` * `#[track_caller]` * ~~`#[target_feature]`~~ (this is now allowed, see PR discussion) * `#[test]`, `#[ignore]`, `#[should_panic]` These attributes just directly conflict with what `#[naked]` should do. Naked functions are still important for systems programming, embedded, and operating systems, so I'd like to move them forward.
2024-07-27allow `#[target_feature]` on `#[naked]` functionsFolkert-1/+0
2024-07-27switch to an allowlist approachFolkert-24/+6
- merge error codes - use attribute name that is incompatible in error message - add test for conditional incompatible attribute - add `linkage` to the allowlist
2024-07-23Rollup merge of #126994 - Alexendoo:explain-markdown, r=tgross35Matthias Krüger-2/+2
Support lists and stylings in more places for `rustc --explain` Adds support for `*foo*`, stylings not immediately following whitespace e.g. ``(`Foo`)`` and lists starting with whitespace: ```md * previously supported ``` ```md * now also supported ``` These are fairly common in the existing error docs, some before/after examples: ### E0460 ![image](https://github.com/rust-lang/rust/assets/1830331/4d0dc5dd-b71f-48b1-97ae-9f7199e952ed) ![image](https://github.com/rust-lang/rust/assets/1830331/4bbcb1e4-99ba-4d0d-b338-fe19d96a5eb1) ### E0059 ![image](https://github.com/rust-lang/rust/assets/1830331/8457f69a-3126-4777-aa4a-953f7b29f59b) ![image](https://github.com/rust-lang/rust/assets/1830331/ac2189f8-512e-4b3b-886d-6c4a619d17f2)
2024-07-21Reword E0626 to mention static coroutineMichael Goulet-8/+24
2024-07-21Auto merge of #127722 - BoxyUwU:new_adt_const_params_limitations, ↵bors-2/+2
r=compiler-errors Forbid borrows and unsized types from being used as the type of a const generic under `adt_const_params` Fixes #112219 Fixes #112124 Fixes #112125 ### Motivation Currently the `adt_const_params` feature allows writing `Foo<const N: [u8]>` this is entirely useless as it is not possible to write an expression which evaluates to a type that is not `Sized`. In order to actually use unsized types in const generics they are typically written as `const N: &[u8]` which *is* possible to provide a value of. Unfortunately allowing the types of const parameters to contain references is non trivial (#120961) as it introduces a number of difficult questions about how equality of references in the type system should behave. References in the types of const generics is largely only useful for using unsized types in const generics. This PR introduces a new feature gate `unsized_const_parameters` and moves support for `const N: [u8]` and `const N: &...` from `adt_const_params` into it. The goal here hopefully is to experiment with allowing `const N: [u8]` to work without references and then eventually completely forbid references in const generics. Splitting this out into a new feature gate means that stabilization of `adt_const_params` does not have to resolve #120961 which is the only remaining "big" blocker for the feature. Remaining issues after this are a few ICEs and naming bikeshed for `ConstParamTy`. ### Implementation The implementation is slightly subtle here as we would like to ensure that a stabilization of `adt_const_params` is forwards compatible with any outcome of `unsized_const_parameters`. This is inherently tricky as we do not support unstable trait implementations and we determine whether a type is valid as the type of a const parameter via a trait bound. There are a few constraints here: - We would like to *allow for the possibility* of adding a `Sized` supertrait to `ConstParamTy` in the event that we wind up opting to not support unsized types and instead requiring people to write the 'sized version', e.g. `const N: [u8; M]` instead of `const N: [u8]`. - Crates should be able to enable `unsized_const_parameters` and write trait implementations of `ConstParamTy` for `!Sized` types without downstream crates that only enable `adt_const_params` being able to observe this (required for std to be able to `impl<T> ConstParamTy for [T]` Ultimately the way this is accomplished is via having two traits (sad), `ConstParamTy` and `UnsizedConstParamTy`. Depending on whether `unsized_const_parameters` is enabled or not we change which trait is used to check whether a type is allowed to be a const parameter. Long term (when stabilizing `UnsizedConstParamTy`) it should be possible to completely merge these traits (and derive macros), only having a single `trait ConstParamTy` and `macro ConstParamTy`. Under `adt_const_params` it is now illegal to directly refer to `ConstParamTy` it is only used as an internal impl detail by `derive(ConstParamTy)` and checking const parameters are well formed. This is necessary in order to ensure forwards compatibility with all possible future directions for `feature(unsized_const_parameters)`. Generally the intuition here should be that `ConstParamTy` is the stable trait that everything uses, and `UnsizedConstParamTy` is that plus unstable implementations (well, I suppose `ConstParamTy` isn't stable yet :P).
2024-07-19Rollup merge of #127949 - princess-entrapta:master, r=tgross35Matthias Krüger-8/+16
fix: explain E0120 better cover cases when its raised Fixes https://github.com/rust-lang/rust/issues/98996 Wording change on the explain of E0120 as requested
2024-07-19Rollup merge of #127814 - folkertdev:c-cmse-nonsecure-call-error-messages, ↵Matthias Krüger-0/+40
r=oli-obk `C-cmse-nonsecure-call`: improved error messages tracking issue: #81391 issue for the error messages (partially implemented by this PR): #81347 related, in that it also deals with CMSE: https://github.com/rust-lang/rust/pull/127766 When using the `C-cmse-nonsecure-call` ABI, both the arguments and return value must be passed via registers. Previously, when violating this constraint, an ugly LLVM error would be shown. Now, the rust compiler itself will print a pretty message and link to more information.
2024-07-19fix: explain E0120 better cover cases when its raisedPrincess Entrapta-8/+16
2024-07-18move CMSE validation to hir_analysisFolkert-0/+1
2024-07-18avoid creating an Instance only to immediately disassemble it againRalf Jung-9/+8
2024-07-17Split part of `adt_const_params` into `unsized_const_params`Boxy-2/+2
2024-07-17add error message when `#[naked]` is used with `#[test]`Folkert-0/+15
2024-07-16update text for E0736 and E0739Folkert-6/+16
2024-07-16stop running code samples in the error code .mdFolkert-2/+2
2024-07-16another attempt at fixing the examples in the error codes .mdFolkert-0/+2
2024-07-16make function pub in error_codes markdown fileFolkert-2/+2
the error is only generated for functions that are actually codegen'd
2024-07-16add rust error message for CMSE stack spillFolkert-0/+37
when the `C-cmse-nonsecure-call` ABI is used, arguments and return values must be passed via registers. Failing to do so (i.e. spilling to the stack) causes an LLVM error down the line, but now rustc will properly emit an error a bit earlier in the chain
2024-07-10Support lists and stylings in more places for `rustc --explain`Alex Macleod-2/+2
2024-07-06Correct description of E0502trevyn-2/+3
2024-06-12Auto merge of #126319 - workingjubilee:rollup-lendnud, r=workingjubileebors-2/+4
Rollup of 16 pull requests Successful merges: - #123374 (DOC: Add FFI example for slice::from_raw_parts()) - #124514 (Recommend to never display zero disambiguators when demangling v0 symbols) - #125978 (Cleanup: HIR ty lowering: Consolidate the places that do assoc item probing & access checking) - #125980 (Nvptx remove direct passmode) - #126187 (For E0277 suggest adding `Result` return type for function when using QuestionMark `?` in the body.) - #126210 (docs(core): make more const_ptr doctests assert instead of printing) - #126249 (Simplify `[T; N]::try_map` signature) - #126256 (Add {{target}} substitution to compiletest) - #126263 (Make issue-122805.rs big endian compatible) - #126281 (set_env: State the conclusion upfront) - #126286 (Make `storage-live.rs` robust against rustc internal changes.) - #126287 (Update a cranelift patch file for formatting changes.) - #126301 (Use `tidy` to sort crate attributes for all compiler crates.) - #126305 (Make PathBuf less Ok with adding UTF-16 then `into_string`) - #126310 (Migrate run make prefer rlib) - #126314 (fix RELEASES: we do not support upcasting to auto traits) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-12Add a `fn main() {}` to a doctest to prevent the test from being wrapped in ↵Oli Scherer-0/+4
a `fn main() {}` body
2024-06-12Use `tidy` to sort crate attributes for all compiler crates.Nicholas Nethercote-2/+4
We already do this for a number of crates, e.g. `rustc_middle`, `rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`. For the ones we don't, in many cases the attributes are a mess. - There is no consistency about order of attribute kinds (e.g. `allow`/`deny`/`feature`). - Within attribute kind groups (e.g. the `feature` attributes), sometimes the order is alphabetical, and sometimes there is no particular order. - Sometimes the attributes of a particular kind aren't even grouped all together, e.g. there might be a `feature`, then an `allow`, then another `feature`. This commit extends the existing sorting to all compiler crates, increasing consistency. If any new attribute line is added there is now only one place it can go -- no need for arbitrary decisions. Exceptions: - `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`, because they have no crate attributes. - `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's ignored in `rustfmt.toml`).
2024-06-05Rollup merge of #124746 - ↵Matthias Krüger-0/+34
OliverKillane:E0582-explain-assoc-types-improvement, r=pnkfelix `rustc --explain E0582` additional example ## Context *From #124744* Expands the example for E0582, an error ensuring that lifetime in a function's return type is sufficiently constrained (e.g. actually tied to some input type), to show an additional example where one sees the lifetime occurring syntactically among the relevant function input types, but is nonetheless rejected by rustc because a syntactic occurrence is not always sufficient.
2024-05-30Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanupLeón Orell Valerian Liehr-7/+6
2024-05-15tidy fix from suggestionOliver Killane-3/+3
2024-05-15Update compiler/rustc_error_codes/src/error_codes/E0582.mdOliver Killane-1/+1
Co-authored-by: Felix S Klock II <pnkfelix@pnkfx.org>
2024-05-13Remove a stray backtick in an error explanation.Nicholas Nethercote-1/+1
2024-05-05fix whitespaceOliver Killane-2/+2
2024-05-05Updated error code explanationOliver Killane-0/+34
2024-05-02Stabilize exclusive_rangeRoss Smyth-1/+0
2024-04-30Rollup merge of #123247 - veera-sivarajan:fix-error-code-E0637-example-code, ↵Matthias Krüger-4/+17
r=fmease Mention Both HRTB and Generic Lifetime Param in `E0637` documentation The compiler (rustc 1.77.0) error for `and_without_explicit_lifetime()` in the erroneous code example suggests using a HRTB. But, the corrected example uses an explicit lifetime parameter. This PR fixes it so that the documentation and the compiler suggestion for error code `E0637` are consistent with each other.