about summary refs log tree commit diff
path: root/compiler/rustc_error_codes
AgeCommit message (Collapse)AuthorLines
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.
2024-04-27Mention Both HRTB and Generic Lifetime in `E0637` documentationVeera-4/+17
Also, small grammar fix.
2024-04-24Error on using `yield` without also using `#[coroutine]` on the closureOli Scherer-21/+21
And suggest adding the `#[coroutine]` to the closure
2024-04-17consistency rename: language item -> lang itemRalf Jung-1/+1
2024-04-12Update compiler/rustc_error_codes/src/error_codes/E0384.mdJimmy Ohn-0/+13
Add an example for the shadowing usage.
2024-03-20Use the more informative generic type inference failure error on method ↵Oli Scherer-2/+4
calls on raw pointers
2024-03-19Auto merge of #122055 - compiler-errors:stabilize-atb, r=oli-obkbors-4/+0
Stabilize associated type bounds (RFC 2289) This PR stabilizes associated type bounds, which were laid out in [RFC 2289]. This gives us a shorthand to express nested type bounds that would otherwise need to be expressed with nested `impl Trait` or broken into several `where` clauses. ### What are we stabilizing? We're stabilizing the associated item bounds syntax, which allows us to put bounds in associated type position within other bounds, i.e. `T: Trait<Assoc: Bounds...>`. See [RFC 2289] for motivation. In all position, the associated type bound syntax expands into a set of two (or more) bounds, and never anything else (see "How does this differ[...]" section for more info). Associated type bounds are stabilized in four positions: * **`where` clauses (and APIT)** - This is equivalent to breaking up the bound into two (or more) `where` clauses. For example, `where T: Trait<Assoc: Bound>` is equivalent to `where T: Trait, <T as Trait>::Assoc: Bound`. * **Supertraits** - Similar to above, `trait CopyIterator: Iterator<Item: Copy> {}`. This is almost equivalent to breaking up the bound into two (or more) `where` clauses; however, the bound on the associated item is implied whenever the trait is used. See #112573/#112629. * **Associated type item bounds** - This allows constraining the *nested* rigid projections that are associated with a trait's associated types. e.g. `trait Trait { type Assoc: Trait2<Assoc2: Copy>; }`. * **opaque item bounds (RPIT, TAIT)** - This allows constraining associated types that are associated with the opaque without having to *name* the opaque. For example, `impl Iterator<Item: Copy>` defines an iterator whose item is `Copy` without having to actually name that item bound. The latter three are not expressible in surface Rust (though for associated type item bounds, this will change in #120752, which I don't believe should block this PR), so this does represent a slight expansion of what can be expressed in trait bounds. ### How does this differ from the RFC? Compared to the RFC, the current implementation *always* desugars associated type bounds to sets of `ty::Clause`s internally. Specifically, it does *not* introduce a position-dependent desugaring as laid out in [RFC 2289], and in particular: * It does *not* desugar to anonymous associated items in associated type item bounds. * It does *not* desugar to nested RPITs in RPIT bounds, nor nested TAITs in TAIT bounds. This position-dependent desugaring laid out in the RFC existed simply to side-step limitations of the trait solver, which have mostly been fixed in #120584. The desugaring laid out in the RFC also added unnecessary complication to the design of the feature, and introduces its own limitations to, for example: * Conditionally lowering to nested `impl Trait` in certain positions such as RPIT and TAIT means that we inherit the limitations of RPIT/TAIT, namely lack of support for higher-ranked opaque inference. See this code example: https://github.com/rust-lang/rust/pull/120752#issuecomment-1979412531. * Introducing anonymous associated types makes traits no longer object safe, since anonymous associated types are not nameable, and all associated types must be named in `dyn` types. This last point motivates why this PR is *not* stabilizing support for associated type bounds in `dyn` types, e.g, `dyn Assoc<Item: Bound>`. Why? Because `dyn` types need to have *concrete* types for all associated items, this would necessitate a distinct lowering for associated type bounds, which seems both complicated and unnecessary compared to just requiring the user to write `impl Trait` themselves. See #120719. ### Implementation history: Limited to the significant behavioral changes and fixes and relevant PRs, ping me if I left something out-- * #57428 * #108063 * #110512 * #112629 * #120719 * #120584 Closes #52662 [RFC 2289]: https://rust-lang.github.io/rfcs/2289-associated-type-bounds.html
2024-03-08Stabilize associated type boundsMichael Goulet-4/+0
2024-03-08Improve error message for opaque capturesMichael Goulet-45/+14
2024-03-02Rollup merge of #120684 - carschandler:patch-1, r=nnethercoteMatthias Krüger-1/+1
Update E0716.md for clarity When reading through this, I got slightly hung up thinking the `let` it was referring to was the `let tmp` on line 25, which was confusing considering the comment states that the temporary is freed at the end of the block. I think adding this clarification could potentially help some beginners like myself without being overly verbose.
2024-03-01Update E0716.mdcarschandler-3/+2
Clearer wording
2024-02-25remove platform-intrinsics ABI; make SIMD intrinsics be regular intrinsicsRalf Jung-4/+4
2024-02-18Improve wording of static_mut_refObei Sideg-11/+15
Rename `static_mut_ref` lint to `static_mut_refs`.
2024-02-12Dejargnonize substShoyu Vanilla-14/+14
2024-02-10unstably allow constants to refer to statics and read from immutable staticsRalf Jung-1/+3
2024-02-09Rollup merge of #120693 - nnethercote:invert-diagnostic-lints, r=davidtwcoMatthias Krüger-2/+0
Invert diagnostic lints. That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has been converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted. r? ````@davidtwco````
2024-02-06Rollup merge of #120502 - clubby789:remove-ffi-returns-twice, r=compiler-errorsMatthias Krüger-2/+5
Remove `ffi_returns_twice` feature The [tracking issue](https://github.com/rust-lang/rust/issues/58314) and [RFC](https://github.com/rust-lang/rfcs/pull/2633) have been closed for a couple of years. There is also an attribute gate in R-A which should be removed if this lands.
2024-02-06Invert diagnostic lints.Nicholas Nethercote-2/+0
That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has be converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.
2024-02-05Update E0716.md for claritycarschandler-2/+3
When reading through this, I got slightly hung up thinking the `let` it was referring to was the `let tmp` on line 25, which was confusing considering the comment states that the temporary is freed at the end of the block. I think adding this clarification could potentially help some beginners like myself without being overly verbose.
2024-02-05Rollup merge of #119600 - aDotInTheVoid:comment-fix, r=compiler-errorsMatthias Krüger-1/+1
Remove outdated references to librustc_middle The relevant comment is now in https://github.com/rust-lang/rust/blob/791a53f380d5cf800191f25941c94ace5099876e/compiler/rustc_middle/src/tests.rs#L3-L13
2024-02-01Improve the diagnostics for unused generic parametersLeón Orell Valerian Liehr-3/+3
2024-01-30Remove `ffi_returns_twice` featureclubby789-2/+5
2024-01-29Stop using `String` for error codes.Nicholas Nethercote-667/+669
Error codes are integers, but `String` is used everywhere to represent them. Gross! This commit introduces `ErrCode`, an integral newtype for error codes, replacing `String`. It also introduces a constant for every error code, e.g. `E0123`, and removes the `error_code!` macro. The constants are imported wherever used with `use rustc_errors::codes::*`. With the old code, we have three different ways to specify an error code at a use point: ``` error_code!(E0123) // macro call struct_span_code_err!(dcx, span, E0123, "msg"); // bare ident arg to macro call \#[diag(name, code = "E0123")] // string struct Diag; ``` With the new code, they all use the `E0123` constant. ``` E0123 // constant struct_span_code_err!(dcx, span, E0123, "msg"); // constant \#[diag(name, code = E0123)] // constant struct Diag; ``` The commit also changes the structure of the error code definitions: - `rustc_error_codes` now just defines a higher-order macro listing the used error codes and nothing else. - Because that's now the only thing in the `rustc_error_codes` crate, I moved it into the `lib.rs` file and removed the `error_codes.rs` file. - `rustc_errors` uses that macro to define everything, e.g. the error code constants and the `DIAGNOSTIC_TABLES`. This is in its new `codes.rs` file.
2024-01-19Stabilize simple offset_ofGeorge Bateman-2/+2
2024-01-16Async closures will move params into the future alwaysMichael Goulet-2/+4