Commit Graph

302 Commits

Author SHA1 Message Date
bowlerman
f75eb24f4f remove E0280 and ICE instead 2023-01-10 03:04:28 +01:00
Ezra Shaw
24ce65c8d6
docs/test: add error-docs and UI test for E0711 2023-01-09 15:48:53 +13:00
Ezra Shaw
ecc0507fdd
docs/test: add empty error-docs for E0208, E0640 and E0717 2023-01-09 15:48:52 +13:00
Yuki Okushi
6459a51c3f
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
3b5afa590b
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
93c0d8d5d5
remove unreachable error code E0313 2023-01-08 14:47:12 +13:00
Ezra Shaw
ae61c250cd
doc/test: add UI test and reword docs for E0013 and E0015 2023-01-08 13:33:09 +13:00
Michael Goulet
01cb9dcd5b
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
dc0e4207d4 Fix a typo in the explanation of E0588 2023-01-07 05:10:53 +01:00
Ezra Shaw
9618f646b3
docs: revert removal of E0729 2023-01-02 09:11:36 +13:00
Ezra Shaw
04b9038610
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
24b39ece2f
refactor: merge E0465 into E0464 2022-12-31 20:44:54 +13:00
Ezra Shaw
726519d4f5
docs: add long-form error docs for E0514 2022-12-29 14:32:39 +13:00
Ezra Shaw
da7fcc7a09
docs/test: add UI test and long-form error docs for E0519 2022-12-29 13:16:10 +13:00
Ezra Shaw
f66e7529b5
docs: add long-form error docs for E0461 2022-12-27 17:03:39 +13:00
Matthias Krüger
e08dd9d998
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
66ed1812cf
docs/test: add UI test and long-form error docs for E0462 2022-12-23 10:56:16 +13:00
Matthias Krüger
4726e514d7
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
082ca1e461
docs: add long error explanation for error E0472 2022-12-20 21:34:30 +13:00
Ezra Shaw
e798fdf7be
docs/test: add UI test and long-form error docs for E0377 2022-12-20 18:31:15 +13:00
Ezra Shaw
5ecac8ede6
more markdown list formatting
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2022-12-19 22:50:31 +13:00
Ezra Shaw
540c3f434f
docs: add long-form error-code docs for E0457 2022-12-19 08:55:08 +13:00
Ezra Shaw
7e66d451ad
docs: add long-form error-code docs for E0460 2022-12-19 08:55:08 +13:00
Ezra Shaw
fe52882986
docs: add long error explanation for error E0320 2022-12-17 07:38:23 +13:00
Ezra Shaw
fded03ee2d
docs: rewrite E0158 error-code docs for clarity 2022-12-16 08:36:40 +13:00
KaDiWa
9bc69925cb
compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
Peter Collingbourne
f44a0153bc 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
7fe6f36224 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
55ff8bf847
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
b5b6467810 Add rustc_deny_explicit_impl 2022-11-14 03:23:41 +00:00
Camille GILLOT
da9dca7040 Retire error code. 2022-11-12 10:03:13 +00:00
Dylan DPC
6e819af3a7
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
408b8cf7c4
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
4b5cff5b55
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
b978bba6a9
Update E0382.md 2022-10-31 00:41:12 -04:00
Fernando Fernandez Mancera
2159df22a2 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
5b6455318a
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
Jesse Ruderman
e3a091ad6a
Remove redundant sentence 2022-10-24 00:52:26 -07:00
Deadbeef
988e75bb65 Stabilize arbitrary_enum_discriminant, take 2 2022-10-22 13:54:39 +08:00
Rageking8
d1982bd0af fix small word dupe typos 2022-10-13 00:53:46 +08:00
nils
1df0a1890a Cleanup some error code explanations
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-10-03 08:53:06 +02:00
bors
ce7f0f1aa0 Auto merge of #100719 - CohenArthur:rust-safe-intrinsic-attribute, r=wesleywiser
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-28 19:07:50 +00:00
Matthew Kelly
c0d32fd2cc review updates 2022-09-27 19:23:59 -04:00
Arthur Cohen
99d57ee23d core: Mark all safe intrinsics with #[rustc_safe_intrinsic] 2022-09-27 15:55:42 +02:00
Matthew Kelly
0d9c01480b remove implied link bound per review
also update .stderr outputs
2022-09-26 20:50:33 -04:00
Matthew Kelly
eda2a40145 Merge remote-tracking branch 'origin/master' into mpk/add-long-error-message-for-E0311 2022-08-31 19:39:39 -04:00
Matthew Kelly
4a443dfb82 review updates to E0311 description 2022-08-29 06:05:01 -04:00
Matthew Kelly
deadf071ed fix trailing ] 2022-08-27 14:36:17 -04:00
Matthew Kelly
de3e95b56c Review updates: simpler MWE and docs
- 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-27 14:20:59 -04:00
Matthew Kelly
4f194a76c8 Fix rust-doc error
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-25 05:46:47 -04:00