Commit Graph

207 Commits

Author SHA1 Message Date
Oli Scherer
86d17b98f2 Revert "Auto merge of #91403 - cjgillot:inherit-async, r=oli-obk"
This reverts commit 3cfa4def7c, reversing
changes made to 5d8767cb22.
2022-02-17 16:00:04 +00:00
bors
3cfa4def7c Auto merge of #91403 - cjgillot:inherit-async, r=oli-obk
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-12 21:42:10 +00:00
Camille GILLOT
c6a3f5d606 Update error code documentation. 2022-02-12 01:26:17 +01:00
Guillaume Gomez
087fb23dc9 Add missing E0192 in the error code listing 2022-02-12 00:43:09 +01:00
Matthias Krüger
58bfe72f52
Rollup merge of #91939 - GKFX:feature-91866, r=cjgillot
Clarify error on casting larger integers to char

Closes #91836 with changes to E0604.md and a `span_help`.
2022-02-06 04:13:29 +01:00
Matthias Krüger
11898a56c2
Rollup merge of #88205 - danii:e0772, r=GuillaumeGomez
Add Explanation For Error E0772

I've added an error explanation for the error code E0772.

Assists with #61137
2022-01-29 14:46:29 +01:00
Daniel Conley
4f8b9a4126
Add Explanation For Error E0772 2022-01-28 11:00:56 -05:00
Tomasz Miąsko
888332fee4 Reject unsupported naked functions
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-21 17:38:21 +01:00
Matthias Krüger
4de63e7c23
Rollup merge of #92752 - jamestiotio:error-codes-typos, r=nagisa
Correct minor typos in some long error code explanations

Just a little nitpick to improve the long explanations of the error codes. 😊
2022-01-17 20:07:04 +01:00
Tomasz Miąsko
b085eb0b10 Error codes specific to LLVM-style inline asssembly are no longer emitted 2022-01-12 21:43:36 +01:00
James R T
842bf71fda
fix(compiler): correct minor typos in some long error code explanations 2022-01-11 10:42:51 +08:00
TmLev
406d6d4028 docs(error-codes): Add long error explanation for E0227 2021-12-28 15:46:20 +03:00
George Bateman
a15cb49362
#91836: Clarify error on casting larger integers to char 2021-12-14 21:49:49 +00:00
Graydon Hoare
7907fa8ec4
Clarify and tidy up explanation of E0038 2021-11-30 09:25:17 -08:00
bstrie
3024efff59 Update Copy/Clone documentation WRT arrays 2021-11-08 13:11:59 -05:00
Joshua Nelson
257ac1b498 Improve error when an .rlib can't be parsed
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
```
2021-11-07 15:03:40 +00:00
Ben Boeckel
863e5226d3 error_codes: uniformly comment error codes 2021-11-05 11:57:17 -04:00
Yuki Okushi
327d8073e2
Rollup merge of #89922 - JohnTitor:update-e0637, r=jackh726
Update E0637 description to mention `&` w/o an explicit lifetime name

Deal with https://github.com/rust-lang/rust/issues/89824#issuecomment-941598647. Another solution would be splitting the error code into two as (I think) it's a bit unclear to users why they have the same error code.
2021-10-22 19:42:46 +09:00
Oli Scherer
4413f8c709 Member constraints already covered all of E0482 already, so that error never occurred anymore 2021-10-18 15:50:56 +00:00
Yuki Okushi
4333091625
Update E0637 description to mention & w/o an explicit lifetime name 2021-10-16 02:49:58 +09:00
bors
72d66064e7 Auto merge of #89903 - matthiaskrgr:rollup-s0c69xl, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #86011 (move implicit `Sized` predicate to end of list)
 - #89821 (Add a strange test for `unsafe_code` lint.)
 - #89859 (add dedicated error variant for writing the discriminant of an uninhabited enum variant)
 - #89870 (Suggest Box::pin when Pin::new is used instead)
 - #89880 (Use non-checking TLS relocation in aarch64 asm! sym test.)
 - #89885 (add long explanation for E0183)
 - #89894 (Remove unused dependencies from rustc_const_eval)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-15 05:59:49 +00:00
Matthias Krüger
e3099e7d8c
Rollup merge of #89885 - cameron1024:long-explanation-E0183, r=GuillaumeGomez
add long explanation for E0183

Addresses #61137
2021-10-15 07:44:49 +02:00
cameron1024
cca39148f3 add long explanation for E0183 2021-10-14 17:44:04 +01:00
Mark Rousskov
8485e6fdec Revert "Stabilize arbitrary_enum_discriminant"
This reverts commit 7a62f29f31.
2021-10-14 10:57:56 -04:00
Noah Lev
cc6a09009d Add long explanation for E0464
The test is copied from `src/test/ui/crate-loading/crateresolve1.rs` and
its auxiliary tests. I added it to the `compile_fail` code example check
exemption list since it's hard if not impossible to reproduce this error
in a standalone code example.
2021-10-12 13:10:12 -07:00
Matthias Krüger
57504aafe8
Rollup merge of #89710 - sireliah:e0482, r=GuillaumeGomez
Add long explanation for error E0482

This is longer explanation for error E0482 in the #61137.

Please take a look and leave some feedback!
2021-10-11 23:45:50 +02:00
sireliah
0fde6f672f Clarify the error descriptions 2021-10-11 21:48:35 +02:00
sireliah
a94e39e7f4 Add long explanation for error E0482 2021-10-09 21:49:09 +02:00
Bruce Mitchener
058a21d5cf Consistently use 'supertrait'.
A subset of places referred to 'super-trait', so this changes them
to all use 'supertrait'. This matches 'supertype' and some other
usages. An exception is 'auto-trait' which is consistently used
in that manner.
2021-10-02 08:05:44 +07:00
Mark Rousskov
c746be2219 Migrate to 2021 2021-09-20 22:21:42 -04:00
Yuki Okushi
e675073e73
Rollup merge of #88855 - calebzulawski:feature/simd_shuffle, r=nagisa
Allow simd_shuffle to accept vectors of any length

cc ``@rust-lang/project-portable-simd`` ``@workingjubilee``
2021-09-19 17:31:29 +09:00
Fabian Wolff
ab83d501a4 Do not issue E0071 if a type error has already been reported 2021-09-12 23:07:23 +02:00
Caleb Zulawski
1b3fe755ea Allow simd_shuffle to accept vectors of any length 2021-09-11 14:55:14 +00:00
Michael Howell
435cdd0f9a
Update E0785.md 2021-08-30 22:18:55 -07:00
Michael Howell
026322c34b fix(rustc_typeck): produce better errors for dyn auto trait
Fixes #85026
2021-08-30 22:15:11 -07:00
lcnr
87e781799a feature(const_param_types) -> feature(adt_const_params) 2021-08-30 12:07:36 +02:00
lcnr
0c28e028b6 feature(const_generics) -> feature(const_param_types) 2021-08-30 11:00:21 +02:00
asquared31415
385a233f18 Detect incorrect number of lang item generics 2021-08-23 10:15:25 -04:00
bors
99b73e81b3 Auto merge of #88134 - rylev:force-warn-improvements, r=nikomatsakis
Force warn improvements

As part of stablization of the `--force-warn` option (#86516) I've made the following changes:
* Error when the `warnings` lint group is based to the `--force-warn` option
* Tests have been updated to make it easier to understand the semantics of `--force-warn`

r? `@nikomatsakis`
2021-08-21 15:51:50 +00:00
Anton Golov
ba83b39d4e Change example and tests for E0161.
The code will not emit this warning once box expressions require a sized
type (since that error is emitted earlier in the flow).
2021-08-20 15:59:42 +02:00
Ryan Levick
d70056e30c Error when warnings lint group is used with force-warn 2021-08-18 11:53:59 +02:00
bors
02b27f1e70 Auto merge of #86860 - fee1-dead:stabilize, r=LeSeulArtichaut
Stabilize `arbitrary_enum_discriminant`

Closes #60553.

----

## Stabilization Report

_copied from https://github.com/rust-lang/rust/issues/60553#issuecomment-865922311_

### Summary

Enables a user to specify *explicit* discriminants on arbitrary enums.

Previously, this was hard to achieve:

```rust
#[repr(u8)]
enum Foo {
    A(u8) = 0,
    B(i8) = 1,
    C(bool) = 42,
}
```

Someone would need to add 41 hidden variants in between as a workaround with implicit discriminants.

In conjunction with [RFC 2195](https://github.com/rust-lang/rfcs/blob/master/text/2195-really-tagged-unions.md), this feature would provide more flexibility for FFI and unsafe code involving enums.

### Test cases

Most tests are in [`src/test/ui/enum-discriminant`](https://github.com/rust-lang/rust/tree/master/src/test/ui/enum-discriminant), there are two [historical](https://github.com/rust-lang/rust/blob/master/src/test/ui/parser/tag-variant-disr-non-nullary.rs) [tests](https://github.com/rust-lang/rust/blob/master/src/test/ui/parser/issue-17383.rs) that are now covered by the feature (removed by this pr due to them being obsolete).

### Edge cases

The feature is well defined and does not have many edge cases.
One [edge case](https://github.com/rust-lang/rust/issues/70509) was related to another unstable feature named `repr128` and is resolved.

### Previous PRs

The [implementation PR](https://github.com/rust-lang/rust/pull/60732) added documentation to the Unstable Book, https://github.com/rust-lang/reference/pull/1055 was opened as a continuation of https://github.com/rust-lang/reference/pull/639.

### Resolution of unresolved questions

The questions are resolved in https://github.com/rust-lang/rust/issues/60553#issuecomment-511235271.

----

(someone please add `needs-fcp`)
2021-08-18 01:00:17 +00:00
Yuki Okushi
4442806626
Rollup merge of #87700 - kornelski:e530text, r=oli-obk
Expand explanation of E0530

The explanation didn't cover a puzzling case of enum variants missing fields.
2021-08-11 04:18:36 +09:00
bors
442e627bee Auto merge of #87697 - GuillaumeGomez:add-e0784, r=nagisa
Assign E0784 error code for union expression errors
2021-08-08 16:40:14 +00:00
Yuki Okushi
772db06e10
Rollup merge of #87715 - bhgomes:long-explanation-E0625, r=GuillaumeGomez
Add long error explanation for E0625

For #61137.
2021-08-06 11:21:29 +09:00
Brandon H. Gomes
dc5f6d2e48 move full explanation to after erroneous example 2021-08-04 15:49:00 -04:00
Alex Crichton
1c07096a45 rustc: Fill out remaining parts of C-unwind ABI
This commit intends to fill out some of the remaining pieces of the
C-unwind ABI. This has a number of other changes with it though to move
this design space forward a bit. Notably contained within here is:

* On `panic=unwind`, the `extern "C"` ABI is now considered as "may
  unwind". This fixes a longstanding soundness issue where if you
  `panic!()` in an `extern "C"` function defined in Rust that's actually
  UB because the LLVM representation for the function has the `nounwind`
  attribute, but then you unwind.

* Whether or not a function unwinds now mainly considers the ABI of the
  function instead of first checking the panic strategy. This fixes a
  miscompile of `extern "C-unwind"` with `panic=abort` because that ABI
  can still unwind.

* The aborting stub for non-unwinding ABIs with `panic=unwind` has been
  reimplemented. Previously this was done as a small tweak during MIR
  generation, but this has been moved to a separate and dedicated MIR
  pass. This new pass will, for appropriate functions and function
  calls, insert a `cleanup` landing pad for any function call that may
  unwind within a function that is itself not allowed to unwind. Note
  that this subtly changes some behavior from before where previously on
  an unwind which was caught-to-abort it would run active destructors in
  the function, and now it simply immediately aborts the process.

* The `#[unwind]` attribute has been removed and all users in tests and
  such are now using `C-unwind` and `#![feature(c_unwind)]`.

I think this is largely the last piece of the RFC to implement.
Unfortunately I believe this is still not stabilizable as-is because
activating the feature gate changes the behavior of the existing `extern
"C"` ABI in a way that has no replacement. My thinking for how to enable
this is that we add support for the `C-unwind` ABI on stable Rust first,
and then after it hits stable we change the behavior of the `C` ABI.
That way anyone straddling stable/beta/nightly can switch to `C-unwind`
safely.
2021-08-03 07:06:19 -07:00
Brandon H. Gomes
2f85aa6590 remove trailing newline 2021-08-03 09:25:18 -04:00
Kornel
ecb6686914 Expand explanation of E0530 2021-08-03 11:11:17 +01:00
Brandon H. Gomes
a77d6ff359 add long error explanation for E0625 2021-08-02 23:03:16 -04:00