about summary refs log tree commit diff
path: root/compiler/rustc_error_codes
AgeCommit message (Collapse)AuthorLines
2022-12-31refactor: merge `E0465` into `E0464`Ezra Shaw-1/+1
2022-12-29docs: add long-form error docs for `E0514`Ezra Shaw-1/+34
2022-12-29docs/test: add UI test and long-form error docs for `E0519`Ezra Shaw-1/+41
2022-12-27docs: add long-form error docs for `E0461`Ezra Shaw-1/+31
2022-12-24Rollup merge of #105970 - Ezrashaw:add-docs+test-e0462, r=GuillaumeGomezMatthias Krüger-1/+33
docs/test: add UI test and long-form error docs for E0462 Another UI test/ docs combo. r? ``@GuillaumeGomez``
2022-12-23docs/test: add UI test and long-form error docs for E0462Ezra Shaw-1/+33
2022-12-20Rollup merge of #105791 - Ezrashaw:add-e0472-long-docs, r=GuillaumeGomezMatthias Krüger-1/+32
docs: add long error explanation for error E0472 Add long-form error docs for E0472: "inline assembly not supported on this target" and update UI tests. R? `@GuillaumeGomez`
2022-12-20docs: add long error explanation for error E0472Ezra Shaw-1/+32
2022-12-20docs/test: add UI test and long-form error docs for `E0377`Ezra Shaw-2/+30
2022-12-19more markdown list formattingEzra Shaw-3/+3
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2022-12-19docs: add long-form error-code docs for E0457Ezra Shaw-1/+37
2022-12-19docs: add long-form error-code docs for E0460Ezra Shaw-1/+72
2022-12-17docs: add long error explanation for error E0320Ezra Shaw-1/+28
2022-12-16docs: rewrite E0158 error-code docs for clarityEzra Shaw-19/+34
2022-12-10compiler: remove unnecessary imports and qualified pathsKaDiWa-1/+0
2022-12-05Support Option and similar enums as type of static variable with linkage ↵Peter Collingbourne-0/+42
attribute. Compiler MCP: https://github.com/rust-lang/compiler-team/issues/565
2022-11-21Auto merge of #103491 - cjgillot:self-rpit, r=oli-obkbors-1/+3
Support using `Self` or projections inside an RPIT/async fn I reuse the same idea as https://github.com/rust-lang/rust/pull/103449 to use variances to encode whether a lifetime parameter is captured by impl-trait. The current implementation of async and RPIT replace all lifetimes from the parent generics by `'static`. This PR changes the scheme ```rust impl<'a> Foo<'a> { fn foo<'b, T>() -> impl Into<Self> + 'b { ... } } opaque Foo::<'_a>::foo::<'_b, T>::opaque<'b>: Into<Foo<'_a>> + 'b; impl<'a> Foo<'a> { // OLD fn foo<'b, T>() -> Foo::<'static>::foo::<'static, T>::opaque::<'b> { ... } ^^^^^^^ the `Self` becomes `Foo<'static>` // NEW fn foo<'b, T>() -> Foo::<'a>::foo::<'b, T>::opaque::<'b> { ... } ^^ the `Self` stays `Foo<'a>` } ``` There is the same issue with projections. In the example, substitute `Self` by `<T as Trait<'b>>::Assoc` in the sugared version, and `Foo<'_a>` by `<T as Trait<'_b>>::Assoc` in the desugared one. This allows to support `Self` in impl-trait, since we do not replace lifetimes by `'static` any more. The same trick allows to use projections like `T::Assoc` where `Self` is allowed. The feature is gated behind a `impl_trait_projections` feature gate. The implementation relies on 2 tweaking rules for opaques in 2 places: - we only relate substs that correspond to captured lifetimes during TypeRelation; - we only list captured lifetimes in choice region computation. For simplicity, I encoded the "capturedness" of lifetimes as a variance, `Bivariant` vs `Invariant` for unused vs captured lifetimes. The `variances_of` query used to ICE for opaques. Impl-trait that do not reference `Self` or projections will have their variances as: - `o` (invariant) for each parent type or const; - `*` (bivariant) for each parent lifetime --> will not participate in borrowck; - `o` (invariant) for each own lifetime. Impl-trait that does reference `Self` and/or projections will have some parent lifetimes marked as `o` (as the example above), and participate in type relation and borrowck. In the example above, `variances_of(opaque) = ['_a: o, '_b: *, T: o, 'b: o]`. r? types cc `@compiler-errors` , as you asked about the issue with `Self` and projections.
2022-11-15Rollup merge of #104339 - compiler-errors:rustc_deny_explicit_impl, r=cjgillotMatthias Krüger-1/+2
Add `rustc_deny_explicit_impl` Also adjust `E0322` error message to be more general, since it's used for `DiscriminantKind` and `Pointee` as well. Also add `rustc_deny_explicit_impl` on the `Tuple` and `Destruct` marker traits.
2022-11-14Add rustc_deny_explicit_implMichael Goulet-1/+2
2022-11-12Retire error code.Camille GILLOT-1/+3
2022-11-11Rollup merge of #103924 - PeteDevoy:patch-1, r=estebankDylan DPC-1/+1
Fix broken link in description of error code E0706 Corresponding subsection in async book is `07.05` not `07.06`. The information on the linked page is the same so it may be reasonable to remove the whole sentence.
2022-11-07Rollup merge of #103757 - ffmancera:ff/clarify_E0207, r=jackh726Dylan DPC-4/+71
Mention const and lifetime parameters in error E0207 Error Index for E0207 must mention const and lifetime parameters. In addition, add code examples for these situations. Fixes #80862
2022-11-03Fix broken link in error code E0706 docsPete-1/+1
Corresponding subsection in async book is not `07.05` not `07.06`. The information on the linked page is the same so it may be reasonable to remove the whole sentence.
2022-10-31Update E0382.mdDominic Farolino-1/+1
2022-10-30Mention const and lifetime parameters in error E0207Fernando Fernandez Mancera-4/+71
Error Index for E0207 must mention const and lifetime parameters. In addition, add code examples for these situations. Fixes #80862
2022-10-26Rollup merge of #95710 - ↵Dylan DPC-4/+0
fee1-dead-contrib:stabilize_arbitrary_enum_discriminant, r=joshtriplett Stabilize arbitrary_enum_discriminant, take 2 Documentation has been updated in https://github.com/rust-lang/reference/pull/1055. cc #86860 for previous stabilization report. Not yet marks https://github.com/rust-lang/rust/issues/60553 as done: need documentation in the rust reference.
2022-10-24Remove redundant sentenceJesse Ruderman-2/+0
2022-10-22Stabilize arbitrary_enum_discriminant, take 2Deadbeef-4/+0
2022-10-13fix small word dupe typosRageking8-2/+2
2022-10-03Cleanup some error code explanationsnils-14/+7
E0045: Use a stable non-C ABI instead E0092: Use an atomic intrinsic that actually exists E0161: Don't use box_syntax E0579: Format ranges in the rustfmt style E0622: Use the rustfmt style E0743: Remove feature gate as it's not needed
2022-09-28Auto merge of #100719 - CohenArthur:rust-safe-intrinsic-attribute, r=wesleywiserbors-0/+4
Add `#[rustc_safe_intrinsic]` This PR adds the `#[rustc_safe_intrinsic]` attribute as mentionned on Zulip. The goal of this attribute is to avoid keeping a list of symbols as the source for stable intrinsics, and instead rely on an attribute. This is similar to `#[rustc_const_stable]` and `#[rustc_const_unstable]`, which among other things, are used to mark the constness of intrinsic functions.
2022-09-27review updatesMatthew Kelly-2/+2
2022-09-27core: Mark all safe intrinsics with #[rustc_safe_intrinsic]Arthur Cohen-0/+4
2022-09-26remove implied link bound per reviewMatthew Kelly-3/+1
also update .stderr outputs
2022-08-31Merge remote-tracking branch 'origin/master' into ↵Matthew Kelly-3/+2
mpk/add-long-error-message-for-E0311
2022-08-29review updates to E0311 descriptionMatthew Kelly-23/+15
2022-08-27fix trailing `]`Matthew Kelly-1/+1
2022-08-27Review updates: simpler MWE and docsMatthew Kelly-50/+33
- use the simpler minimum working example from the review - add an alterate "fix" that helps make the cause of the error more clear - attempt to add an improved description of what is going on
2022-08-25Fix rust-doc errorMatthew Kelly-16/+11
There was a partial rust code block in the readme that was invalid because of a missing line. I inlined the code snippet into the text to fix the error. This also improves readability a bit.
2022-08-24fix wrappingMatthew Kelly-5/+4
2022-08-24Improve description againMatthew Kelly-34/+39
-- update summary based on review -- rewrite explanation to be more clear and correct
2022-08-23Stabilize `#![feature(label_break_value)]`Joshua Nelson-3/+0
# Stabilization proposal The feature was implemented in https://github.com/rust-lang/rust/pull/50045 by est31 and has been in nightly since 2018-05-16 (over 4 years now). There are [no open issues][issue-label] other than the tracking issue. There is a strong consensus that `break` is the right keyword and we should not use `return`. There have been several concerns raised about this feature on the tracking issue (other than the one about tests, which has been fixed, and an interaction with try blocks, which has been fixed). 1. nrc's original comment about cost-benefit analysis: https://github.com/rust-lang/rust/issues/48594#issuecomment-422235234 2. joshtriplett's comments about seeing use cases: https://github.com/rust-lang/rust/issues/48594#issuecomment-422281176 3. withoutboats's comments that Rust does not need more control flow constructs: https://github.com/rust-lang/rust/issues/48594#issuecomment-450050630 Many different examples of code that's simpler using this feature have been provided: - A lexer by rpjohnst which must repeat code without label-break-value: https://github.com/rust-lang/rust/issues/48594#issuecomment-422502014 - A snippet by SergioBenitez which avoids using a new function and adding several new return points to a function: https://github.com/rust-lang/rust/issues/48594#issuecomment-427628251. This particular case would also work if `try` blocks were stabilized (at the cost of making the code harder to optimize). - Several examples by JohnBSmith: https://github.com/rust-lang/rust/issues/48594#issuecomment-434651395 - Several examples by Centril: https://github.com/rust-lang/rust/issues/48594#issuecomment-440154733 - An example by petrochenkov where this is used in the compiler itself to avoid duplicating error checking code: https://github.com/rust-lang/rust/issues/48594#issuecomment-443557569 - Amanieu recently provided another example related to complex conditions, where try blocks would not have helped: https://github.com/rust-lang/rust/issues/48594#issuecomment-1184213006 Additionally, petrochenkov notes that this is strictly more powerful than labelled loops due to macros which accidentally exit a loop instead of being consumed by the macro matchers: https://github.com/rust-lang/rust/issues/48594#issuecomment-450246249 nrc later resolved their concern, mostly because of the aforementioned macro problems. joshtriplett suggested that macros could be able to generate IR directly (https://github.com/rust-lang/rust/issues/48594#issuecomment-451685983) but there are no open RFCs, and the design space seems rather speculative. joshtriplett later resolved his concerns, due to a symmetry between this feature and existing labelled break: https://github.com/rust-lang/rust/issues/48594#issuecomment-632960804 withoutboats has regrettably left the language team. joshtriplett later posted that the lang team would consider starting an FCP given a stabilization report: https://github.com/rust-lang/rust/issues/48594#issuecomment-1111269353 [issue-label]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3AF-label_break_value+ ## Report + Feature gate: - https://github.com/rust-lang/rust/blob/d695a497bbf4b20d2580b75075faa80230d41667/src/test/ui/feature-gates/feature-gate-label_break_value.rs + Diagnostics: - https://github.com/rust-lang/rust/blob/6b2d3d5f3cd1e553d87b5496632132565b6779d3/compiler/rustc_parse/src/parser/diagnostics.rs#L2629 - https://github.com/rust-lang/rust/blob/f65bf0b2bb1a99f73095c01a118f3c37d3ee614c/compiler/rustc_resolve/src/diagnostics.rs#L749 - https://github.com/rust-lang/rust/blob/f65bf0b2bb1a99f73095c01a118f3c37d3ee614c/compiler/rustc_resolve/src/diagnostics.rs#L1001 - https://github.com/rust-lang/rust/blob/111df9e6eda1d752233482c1309d00d20a4bbf98/compiler/rustc_passes/src/loops.rs#L254 - https://github.com/rust-lang/rust/blob/d695a497bbf4b20d2580b75075faa80230d41667/compiler/rustc_parse/src/parser/expr.rs#L2079 - https://github.com/rust-lang/rust/blob/d695a497bbf4b20d2580b75075faa80230d41667/compiler/rustc_parse/src/parser/expr.rs#L1569 + Tests: - https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_continue.rs - https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_unlabeled_break.rs - https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_illegal_uses.rs - https://github.com/rust-lang/rust/blob/master/src/test/ui/lint/unused_labels.rs - https://github.com/rust-lang/rust/blob/master/src/test/ui/run-pass/for-loop-while/label_break_value.rs ## Interactions with other features Labels follow the hygiene of local variables. label-break-value is permitted within `try` blocks: ```rust let _: Result<(), ()> = try { 'foo: { Err(())?; break 'foo; } }; ``` label-break-value is disallowed within closures, generators, and async blocks: ```rust 'a: { || break 'a //~^ ERROR use of unreachable label `'a` //~| ERROR `break` inside of a closure } ``` label-break-value is disallowed on [_BlockExpression_]; it can only occur as a [_LoopExpression_]: ```rust fn labeled_match() { match false 'b: { //~ ERROR block label not supported here _ => {} } } macro_rules! m { ($b:block) => { 'lab: $b; //~ ERROR cannot use a `block` macro fragment here unsafe $b; //~ ERROR cannot use a `block` macro fragment here |x: u8| -> () $b; //~ ERROR cannot use a `block` macro fragment here } } fn foo() { m!({}); } ``` [_BlockExpression_]: https://doc.rust-lang.org/nightly/reference/expressions/block-expr.html [_LoopExpression_]: https://doc.rust-lang.org/nightly/reference/expressions/loop-expr.html
2022-08-23actually fix typo this timeMatthew Kelly-1/+1
2022-08-23Improve E0311.md descriptionMatthew Kelly-8/+29
2022-08-19fix line lengthsMatthew Kelly-6/+7
2022-08-19Apply suggestions from code reviewMatthew Kelly-10/+9
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2022-08-19Add long description and test for E0311Matthew Kelly-1/+50
Adds a long description and unit test for the E0311 compiler error.
2022-08-18Add diagnostic translation lints to crates that don't emit them5225225-0/+2
2022-07-21`region_outlives_predicate` no snapshotlcnr-1/+1
2022-07-19Auto merge of #98180 - notriddle:notriddle/rustdoc-fn, ↵bors-5/+5
r=petrochenkov,GuillaumeGomez Improve the function pointer docs This is #97842 but for function pointers instead of tuples. The concept is basically the same. * Reduce duplicate impls; show `fn (T₁, T₂, …, 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`. https://notriddle.com/notriddle-rustdoc-test/std/primitive.fn.html