Commit Graph

315 Commits

Author SHA1 Message Date
Ezra Shaw 6c5dbccd13 refactor: statically guarantee that current error codes are documented 2023-02-26 20:12:36 +13:00
Ezra Shaw 12df6d4fe2 docs/test: add UI test and docs for E0476 2023-02-25 19:31:02 +13:00
Matthew Kelly 75fc3ee6dd Add extended error message for E0523
Adds the extended error documentation for E0523 to indicate that the
error is no longer produced by the compiler.

Update the E0464 documentation to include example code that produces the
error.

Remove the error message E0523 from the compiler and replace it with an
internal compiler error.
2023-02-06 06:58:30 -05:00
Ralf Jung ffbbcdafdb make unaligned_reference a hard error 2023-01-31 20:28:11 +01:00
Samuel Ortiz ad9633d8cc compiler: Fix E0587 explanation
We meant to use 8 as the packed argument.

Signed-off-by: Samuel Ortiz <sameo@rivosinc.com>
2023-01-27 10:59:51 +01:00
Ezra Shaw 47187f4380 add UI test + docs for E0789 2023-01-23 20:38:14 +13:00
Guillaume Gomez 71f9fc050a Rollup merge of #106931 - Ezrashaw:docs-e0208, r=compiler-errors
document + UI test `E0208` and make its output more user-friendly

Cleans up `E0208`'s output a lot. It could actually be useful for someone learning about variance now. I also added a UI test for it in `tests/ui/error-codes/` and wrote some docs for it.

r? `@GuillaumeGomez` another error code, can't be bothered to find the issue :P. Obviously there's some compiler stuff, so you'll have to hand it off.

Part of https://github.com/rust-lang/rust/issues/61137.
2023-01-19 11:19:35 +01:00
Ezra Shaw e455178b09 remove error code from #[rustc_variance] and document its remains 2023-01-18 21:10:27 +13:00
Matthias Krüger 16f836c05c Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726
Remove double spaces after dots in comments

Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17 20:21:25 +01:00
Maybe Waffle ce02ef648a Remove double spaces after dots in comments 2023-01-17 08:09:33 +00:00
Oli Scherer 999ad2a6b1 Improve a TAIT error and add an error code plus documentation 2023-01-16 16:54:14 +00:00
nils 6dd02d547d Rollup merge of #106714 - Ezrashaw:remove-e0490, r=davidtwco
remove unreachable error code `E0490`

AFAIK, the untested and undocumented error code `E0490` is now unreachable, it was from the days of the original borrow checker.

cc ``@GuillaumeGomez`` #61137
2023-01-12 15:44:52 +01:00
Ezra Shaw d7cad10dcb remove unreachable error code E0490 2023-01-12 14:15:21 +13:00
bowlerman 64548e5e2c remove E0280 and ICE instead 2023-01-10 03:04:28 +01:00
Ezra Shaw 0352536b19 docs/test: add error-docs and UI test for E0711 2023-01-09 15:48:53 +13:00
Ezra Shaw ea44182eea docs/test: add empty error-docs for E0208, E0640 and E0717 2023-01-09 15:48:52 +13:00
Yuki Okushi b75d9ddb2d Rollup merge of #106580 - Ezrashaw:remove-e0313, r=compiler-errors
remove unreachable error code `E0313`

Fixes #103742
Makes #103433 redundant

Implements removal of `E0313`. I agree with the linked issue that this error code is unreachable but if someone could confirm that would be great, are crater runs done for this sort of thing?

Also removed a redundant `// ignore-tidy-filelength` that I found while reading code.

cc ``@GuillaumeGomez`` #61137
2023-01-08 17:01:49 +09:00
Yuki Okushi 88b2a4c134 Rollup merge of #106557 - Ezrashaw:ui-test-fixups-1, r=GuillaumeGomez
Add some UI tests and reword error-code docs

Added UI tests for `E0013` and `E0015`. Error code docs for `E0015` were a bit unclear (they referred to all non-const errors in const context, when only non-const functions applied), so I touched them up a bit.

I also fixed up some issues in the new `error_codes.rs` tidy check (linked #106341), that I overlooked previously.

r? ``@GuillaumeGomez``
2023-01-08 17:01:48 +09:00
Ezra Shaw 0b1336285d remove unreachable error code E0313 2023-01-08 14:47:12 +13:00
Ezra Shaw b9c56856e4 doc/test: add UI test and reword docs for E0013 and E0015 2023-01-08 13:33:09 +13:00
Michael Goulet 3cfb8f809f Rollup merge of #106554 - LingMan:explanation_typo, r=compiler-errors
Fix a typo in the explanation of E0588
2023-01-06 21:54:01 -08:00
LingMan f5a244d4d1 Fix a typo in the explanation of E0588 2023-01-07 05:10:53 +01:00
Ezra Shaw 8074cf5504 docs: revert removal of E0729 2023-01-02 09:11:36 +13:00
Ezra Shaw a02419688c refactor: clean up errors.rs and error_codes_check.rs
Move them into new `error_codes.rs` tidy check.
2023-01-01 15:22:01 +13:00
Ezra Shaw 38fdb62006 refactor: merge E0465 into E0464 2022-12-31 20:44:54 +13:00
Ezra Shaw 6ef3be4303 docs: add long-form error docs for E0514 2022-12-29 14:32:39 +13:00
Ezra Shaw c25e738a96 docs/test: add UI test and long-form error docs for E0519 2022-12-29 13:16:10 +13:00
Ezra Shaw b364f0a5d5 docs: add long-form error docs for E0461 2022-12-27 17:03:39 +13:00
Matthias Krüger a1caf8f143 Rollup merge of #105970 - Ezrashaw:add-docs+test-e0462, r=GuillaumeGomez
docs/test: add UI test and long-form error docs for E0462

Another UI test/ docs combo.

r? ``@GuillaumeGomez``
2022-12-24 00:31:40 +01:00
Ezra Shaw bd4cefe123 docs/test: add UI test and long-form error docs for E0462 2022-12-23 10:56:16 +13:00
Matthias Krüger 53c9538bd1 Rollup merge of #105791 - Ezrashaw:add-e0472-long-docs, r=GuillaumeGomez
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-20 23:35:14 +01:00
Ezra Shaw fe23cb50e7 docs: add long error explanation for error E0472 2022-12-20 21:34:30 +13:00
Ezra Shaw 7f987e3bfe docs/test: add UI test and long-form error docs for E0377 2022-12-20 18:31:15 +13:00
Ezra Shaw 3b0e7ff7bf more markdown list formatting
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2022-12-19 22:50:31 +13:00
Ezra Shaw 21fe8b6a77 docs: add long-form error-code docs for E0457 2022-12-19 08:55:08 +13:00
Ezra Shaw 56ffe62a2c docs: add long-form error-code docs for E0460 2022-12-19 08:55:08 +13:00
Ezra Shaw 62a10a1880 docs: add long error explanation for error E0320 2022-12-17 07:38:23 +13:00
Ezra Shaw 7bc06e148f docs: rewrite E0158 error-code docs for clarity 2022-12-16 08:36:40 +13:00
KaDiWa 2a55af13bc compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
Peter Collingbourne b7a766467b Support Option and similar enums as type of static variable with linkage attribute.
Compiler MCP:
https://github.com/rust-lang/compiler-team/issues/565
2022-12-05 15:05:43 -08:00
bors d612378900 Auto merge of #103491 - cjgillot:self-rpit, r=oli-obk
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-21 12:17:03 +00:00
Matthias Krüger 9e495ccee9 Rollup merge of #104339 - compiler-errors:rustc_deny_explicit_impl, r=cjgillot
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-15 10:44:12 +01:00
Michael Goulet 44fc15974e Add rustc_deny_explicit_impl 2022-11-14 03:23:41 +00:00
Camille GILLOT b5d5b906ba Retire error code. 2022-11-12 10:03:13 +00:00
Dylan DPC 60e06ee5b2 Rollup merge of #103924 - PeteDevoy:patch-1, r=estebank
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-11 20:51:39 +05:30
Dylan DPC 398a2485e5 Rollup merge of #103757 - ffmancera:ff/clarify_E0207, r=jackh726
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-07 18:35:23 +05:30
Pete 22026f5c08 Fix broken link in error code E0706 docs
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-11-03 14:15:32 +01:00
Dominic Farolino 00a1cb8e35 Update E0382.md 2022-10-31 00:41:12 -04:00
Fernando Fernandez Mancera c6e5825630 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-10-30 12:01:39 +01:00
Dylan DPC 1b3f326e79 Rollup merge of #95710 - 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-26 17:32:53 +05:30