about summary refs log tree commit diff
path: root/compiler/rustc_error_codes
AgeCommit message (Collapse)AuthorLines
2022-07-19Improve the function pointer docsMichael Howell-5/+5
* Reduce duplicate impls; show only the `fn (T)` and include a sentence saying that there exists up to twelve of them. * Show `Copy` and `Clone`. * Show auto traits like `Send` and `Sync`, and blanket impls like `Any`.
2022-07-19Don't use main; improve exampleaticu-19/+11
2022-07-19Add E0790 as more specific variant of E0283aticu-29/+64
2022-07-08fixes post rebaseJane Losare-Lusby-1/+1
2022-07-08add opt in attribute for stable-in-unstable itemsJane Lusby-0/+1
2022-06-29Rollup merge of #97423 - m-ou-se:memory-ordering-intrinsics, r=tmiaskoDylan DPC-2/+2
Simplify memory ordering intrinsics This changes the names of the atomic intrinsics to always fully include their memory ordering arguments. ```diff - atomic_cxchg + atomic_cxchg_seqcst_seqcst - atomic_cxchg_acqrel + atomic_cxchg_acqrel_release - atomic_cxchg_acqrel_failrelaxed + atomic_cxchg_acqrel_relaxed // And so on. ``` - `seqcst` is no longer implied - The failure ordering on chxchg is no longer implied in some cases, but now always explicitly part of the name. - `release` is no longer shortened to just `rel`. That was especially confusing, since `relaxed` also starts with `rel`. - `acquire` is no longer shortened to just `acq`, such that the names now all match the `std::sync::atomic::Ordering` variants exactly. - This now allows for more combinations on the compare exchange operations, such as `atomic_cxchg_acquire_release`, which is necessary for #68464. - This PR only exposes the new possibilities through unstable intrinsics, but not yet through the stable API. That's for [a separate PR](https://github.com/rust-lang/rust/pull/98383) that requires an FCP. Suffixes for operations with a single memory order: | Order | Before | After | |---------|--------------|------------| | Relaxed | `_relaxed` | `_relaxed` | | Acquire | `_acq` | `_acquire` | | Release | `_rel` | `_release` | | AcqRel | `_acqrel` | `_acqrel` | | SeqCst | (none) | `_seqcst` | Suffixes for compare-and-exchange operations with two memory orderings: | Success | Failure | Before | After | |---------|---------|--------------------------|--------------------| | Relaxed | Relaxed | `_relaxed` | `_relaxed_relaxed` | | Relaxed | Acquire | :x: | `_relaxed_acquire` | | Relaxed | SeqCst | :x: | `_relaxed_seqcst` | | Acquire | Relaxed | `_acq_failrelaxed` | `_acquire_relaxed` | | Acquire | Acquire | `_acq` | `_acquire_acquire` | | Acquire | SeqCst | :x: | `_acquire_seqcst` | | Release | Relaxed | `_rel` | `_release_relaxed` | | Release | Acquire | :x: | `_release_acquire` | | Release | SeqCst | :x: | `_release_seqcst` | | AcqRel | Relaxed | `_acqrel_failrelaxed` | `_acqrel_relaxed` | | AcqRel | Acquire | `_acqrel` | `_acqrel_acquire` | | AcqRel | SeqCst | :x: | `_acqrel_seqcst` | | SeqCst | Relaxed | `_failrelaxed` | `_seqcst_relaxed` | | SeqCst | Acquire | `_failacq` | `_seqcst_acquire` | | SeqCst | SeqCst | (none) | `_seqcst_seqcst` |
2022-06-28Rename/restructure memory ordering intrinsics.Mara Bos-2/+2
2022-06-12Add comment for internal error codesonlinesoftwaredevok-4/+4
2022-06-11Rollup merge of #96868 - nrc:turbo-stable, r=jhpratt,nbdd0121,nagisaDylan DPC-1/+3
Stabilize explicit_generic_args_with_impl_trait This is a stabilisation PR for `explicit_generic_args_with_impl_trait`. * [tracking issue](https://github.com/rust-lang/rust/issues/83701) - [Stabilisation report](https://github.com/rust-lang/rust/issues/83701#issuecomment-1109949897) - [FCP entered](https://github.com/rust-lang/rust/issues/83701#issuecomment-1120285703) * [implementation PR](https://github.com/rust-lang/rust/pull/86176) * [Reference PR](https://github.com/rust-lang/reference/pull/1212) * There is no mention of using the turbofish operator in the book (other than an entry in the operator list in the appendix), so there is no documentation to change/add there, unless we felt like we should add a section on using turbofish, but that seems orthogonal to `explicit_generic_args_with_impl_trait`
2022-06-10E0577 fixed Sea struct CamelCase/sea module snake_caseCorinJG-3/+3
2022-06-10Fixed several error_codes/Exxxx.md messages which used UpperCamelCase ↵CorinJG-30/+30
instead of snake_case for module names
2022-06-09Stabilize the `bundle` native library modifierVadim Petrochenkov-2/+2
2022-06-07Auto merge of #95565 - jackh726:remove-borrowck-mode, r=nikomatsakisbors-24/+63
Remove migrate borrowck mode Closes #58781 Closes #43234 # Stabilization proposal This PR proposes the stabilization of `#![feature(nll)]` and the removal of `-Z borrowck`. Current borrow checking behavior of item bodies is currently done by first infering regions *lexically* and reporting any errors during HIR type checking. If there *are* any errors, then MIR borrowck (NLL) never occurs. If there *aren't* any errors, then MIR borrowck happens and any errors there would be reported. This PR removes the lexical region check of item bodies entirely and only uses MIR borrowck. Because MIR borrowck could never *not* be run for a compiled program, this should not break any programs. It does, however, change diagnostics significantly and allows a slightly larger set of programs to compile. Tracking issue: #43234 RFC: https://github.com/rust-lang/rfcs/blob/master/text/2094-nll.md Version: 1.63 (2022-06-30 => beta, 2022-08-11 => stable). ## Motivation Over time, the Rust borrow checker has become "smarter" and thus allowed more programs to compile. There have been three different implementations: AST borrowck, MIR borrowck, and polonius (well, in progress). Additionally, there is the "lexical region resolver", which (roughly) solves the constraints generated through HIR typeck. It is not a full borrow checker, but does emit some errors. The AST borrowck was the original implementation of the borrow checker and was part of the initially stabilized Rust 1.0. In mid 2017, work began to implement the current MIR borrow checker and that effort ompleted by the end of 2017, for the most part. During 2018, efforts were made to migrate away from the AST borrow checker to the MIR borrow checker - eventually culminating into "migrate" mode - where HIR typeck with lexical region resolving following by MIR borrow checking - being active by default in the 2018 edition. In early 2019, migrate mode was turned on by default in the 2015 edition as well, but with MIR borrowck errors emitted as warnings. By late 2019, these warnings were upgraded to full errors. This was followed by the complete removal of the AST borrow checker. In the period since, various errors emitted by the MIR borrow checker have been improved to the point that they are mostly the same or better than those emitted by the lexical region resolver. While there do remain some degradations in errors (tracked under the [NLL-diagnostics tag](https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3ANLL-diagnostics), those are sufficiently small and rare enough that increased flexibility of MIR borrow check-only is now a worthwhile tradeoff. ## What is stabilized As said previously, this does not fundamentally change the landscape of accepted programs. However, there are a [few](https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3ANLL-fixed-by-NLL) cases where programs can compile under `feature(nll)`, but not otherwise. There are two notable patterns that are "fixed" by this stabilization. First, the `scoped_threads` feature, which is a continutation of a pre-1.0 API, can sometimes emit a [weird lifetime error](https://github.com/rust-lang/rust/issues/95527) without NLL. Second, actually seen in the standard library. In the `Extend` impl for `HashMap`, there is an implied bound of `K: 'a` that is available with NLL on but not without - this is utilized in the impl. As mentioned before, there are a large number of diagnostic differences. Most of them are better, but some are worse. None are serious or happen often enough to need to block this PR. The biggest change is the loss of error code for a number of lifetime errors in favor of more general "lifetime may not live long enough" error. While this may *seem* bad, the former error codes were just attempts to somewhat-arbitrarily bin together lifetime errors of the same type; however, on paper, they end up being roughly the same with roughly the same kinds of solutions. ## What isn't stabilized This PR does not completely remove the lexical region resolver. In the future, it may be possible to remove that (while still keeping HIR typeck) or to remove it together with HIR typeck. ## Tests Many test outputs get updated by this PR. However, there are number of tests specifically geared towards NLL under `src/test/ui/nll` ## History * On 2017-07-14, [tracking issue opened](https://github.com/rust-lang/rust/issues/43234) * On 2017-07-20, [initial empty MIR pass added](https://github.com/rust-lang/rust/pull/43271) * On 2017-08-29, [RFC opened](https://github.com/rust-lang/rfcs/pull/2094) * On 2017-11-16, [Integrate MIR type-checker with NLL](https://github.com/rust-lang/rust/pull/45825) * On 2017-12-20, [NLL feature complete](https://github.com/rust-lang/rust/pull/46862) * On 2018-07-07, [Don't run AST borrowck on mir mode](https://github.com/rust-lang/rust/pull/52083) * On 2018-07-27, [Add migrate mode](https://github.com/rust-lang/rust/pull/52681) * On 2019-04-22, [Enable migrate mode on 2015 edition](https://github.com/rust-lang/rust/pull/59114) * On 2019-08-26, [Don't downgrade errors on 2015 edition](https://github.com/rust-lang/rust/pull/64221) * On 2019-08-27, [Remove AST borrowck](https://github.com/rust-lang/rust/pull/64790)
2022-06-06Rollup merge of #97787 - matthiaskrgr:e0432_explain, r=Dylan-DPCDylan DPC-6/+6
E0432: rust 2018 -> rust 2018 or later in --explain message
2022-06-06Rollup merge of #97495 - clarfonthey:e0788-no-coverage, r=nagisaDylan DPC-0/+27
Add E0788 for improper #[no_coverage] usage Essentially, this adds proper checking for the attribute (tracking issue #84605) and throws errors when it's put in obviously-wrong places, like on struct or const definitions. Most of the code is taken directly from the checks for the `#[inline]` attribute, since it's very similar. Right now, the code only checks at the function level, but it seems reasonable to allow adding `#[no_coverage]` to individual blocks or expressions, so, for now those just throw `unused_attributes` warnings. Similarly, since there was a lot of desire to eventually allow recursive definitions as well on modules and impl blocks, these also throw `unused_attributes` instead of an error. I'm not sure if anything has to be done since this error is technically for an unstable feature, but since an error for using unstable features will show up anyway, I think it's okay. This is the first big piece needed for stabilising this attribute, although I personally would like to explore renaming it to `#[coverage(never)]` on a separate PR, which I will offer soon. There's a lot of discussion still to be had about that, which is why it will be kept separate. I don't think much is needed besides adding this simple check and a UI test, but let me know if there's something else that should be added to make this happen.
2022-06-06Deactivate feature gate explicit_generic_args_with_impl_traitNick Cameron-1/+3
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2022-06-06E0432: rust 2018 -> rust 2018 or later in --explain messageMatthias Krüger-6/+6
2022-06-05Changes from code reviewltdk-2/+7
2022-06-03Fully stabilize NLLJack Huey-24/+63
2022-06-03Use the same message as type & const generics.Camille GILLOT-1/+3
2022-05-28Add E0788 for improper #[no_coverage] usageltdk-0/+22
2022-05-15rustc: Stricter checking for #[link] attributesVadim Petrochenkov-0/+6
2022-05-09Auto merge of #95960 - jhpratt:remove-rustc_deprecated, r=compiler-errorsbors-19/+20
Remove `#[rustc_deprecated]` This removes `#[rustc_deprecated]` and introduces diagnostics to help users to the right direction (that being `#[deprecated]`). All uses of `#[rustc_deprecated]` have been converted. CI is expected to fail initially; this requires #95958, which includes converting `stdarch`. I plan on following up in a short while (maybe a bootstrap cycle?) removing the diagnostics, as they're only intended to be short-term.
2022-04-30Remove ```` ```ignore```` from E0705 testCAD97-1/+1
2022-04-14Add note to E0550Jacob Pratt-1/+3
With the change to built-in duplicate checking, E0550 is no longer emitted.
2022-04-14Update error code docsJacob Pratt-18/+17
2022-03-30rework error messages for incorrect inherent implslcnr-27/+26
2022-03-27Add long error explanation for E0667Guillaume Gomez-1/+19
2022-03-03Rollup merge of #94555 - cuishuang:master, r=oli-obkMatthias Krüger-1/+1
all: fix some typos Signed-off-by: cuishuang <imcusg@gmail.com>
2022-03-03all: fix some typoscuishuang-1/+1
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-03-02Remove out-of-context line at end of E0284 messageThiago Trannin-2/+0
2022-02-28Rollup merge of #94449 - GuillaumeGomez:explanation-e0726, r=UrgauMatthias Krüger-1/+47
Add long explanation for E0726 This is the cleaned up version of #87655 with the missing fixes. Part of https://github.com/rust-lang/rust/issues/61137. r? `@Urgau`
2022-02-28Add explanation for E0726Guillaume Gomez-1/+47
2022-02-24Remove in-band lifetimesMichael Goulet-2/+6
2022-02-17Revert "Auto merge of #91403 - cjgillot:inherit-async, r=oli-obk"Oli Scherer-3/+3
This reverts commit 3cfa4def7c87d571bd46d92fed608edf8fad236e, reversing changes made to 5d8767cb229b097fedb1dd4bd9420d463c37774f.
2022-02-12Auto merge of #91403 - cjgillot:inherit-async, r=oli-obkbors-3/+3
Inherit lifetimes for async fn instead of duplicating them. The current desugaring of `async fn foo<'a>(&usize) -> &u8` is equivalent to ```rust fn foo<'a, '0>(&'0 usize) -> foo<'static, 'static>::Opaque<'a, '0, '_>; type foo<'_a, '_0>::Opaque<'a, '0, '1> = impl Future<Output = &'1 u8>; ``` following the RPIT model. Duplicating all the inherited lifetime parameters and setting the inherited version to `'static` makes lowering more complex and causes issues like #61949. This PR removes the duplication of inherited lifetimes to directly use ```rust fn foo<'a, '0>(&'0 usize) -> foo<'a, '0>::Opaque<'_>; type foo<'a, '0>::Opaque<'1> = impl Future<Output = &'1 u8>; ``` following the TAIT model. Fixes https://github.com/rust-lang/rust/issues/61949
2022-02-12Update error code documentation.Camille GILLOT-3/+3
2022-02-12Add missing E0192 in the error code listingGuillaume Gomez-3/+5
2022-02-06Rollup merge of #91939 - GKFX:feature-91866, r=cjgillotMatthias Krüger-3/+8
Clarify error on casting larger integers to char Closes #91836 with changes to E0604.md and a `span_help`.
2022-01-29Rollup merge of #88205 - danii:e0772, r=GuillaumeGomezMatthias Krüger-1/+90
Add Explanation For Error E0772 I've added an error explanation for the error code E0772. Assists with #61137
2022-01-28Add Explanation For Error E0772Daniel Conley-1/+90
2022-01-21Reject unsupported naked functionsTomasz Miąsko-0/+29
Transition unsupported naked functions future incompatibility lint into an error: * Naked functions must contain a single inline assembly block. Introduced as future incompatibility lint in 1.50 #79653. Change into an error fixes a soundness issue described in #32489. * Naked functions must not use any forms of inline attribute. Introduced as future incompatibility lint in 1.56 #87652.
2022-01-17Rollup merge of #92752 - jamestiotio:error-codes-typos, r=nagisaMatthias Krüger-6/+6
Correct minor typos in some long error code explanations Just a little nitpick to improve the long explanations of the error codes. 😊
2022-01-12Error codes specific to LLVM-style inline asssembly are no longer emittedTomasz Miąsko-32/+21
2022-01-11fix(compiler): correct minor typos in some long error code explanationsJames R T-6/+6
2021-12-28docs(error-codes): Add long error explanation for E0227TmLev-1/+34
2021-12-14#91836: Clarify error on casting larger integers to charGeorge Bateman-3/+8
2021-11-30Clarify and tidy up explanation of E0038Graydon Hoare-32/+65
2021-11-08Update Copy/Clone documentation WRT arraysbstrie-6/+3
2021-11-07Improve error when an .rlib can't be parsedJoshua Nelson-0/+15
This usually describes either an error in the compiler itself or some sort of IO error. Either way, we should report it to the user rather than just saying "crate not found". This only gives an error if the crate couldn't be loaded at all - if the compiler finds another .rlib or .rmeta file which was valid, it will continue to compile the crate. Example output: ``` error[E0785]: found invalid metadata files for crate `foo` --> bar.rs:3:24 | 3 | println!("{}", foo::FOO_11_49[0]); | ^^^ | = warning: failed to parse rlib '/home/joshua/test-rustdoc/libfoo.rlib': Invalid archive extended name offset ```