Commit Graph

160 Commits

Author SHA1 Message Date
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
Brandon H. Gomes a77d6ff359 add long error explanation for E0625 2021-08-02 23:03:16 -04:00
bors b53a93db2d Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum
rfc3052 followup: Remove authors field from Cargo manifests

Since RFC 3052 soft deprecated the authors field, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information for contributors, we may as well
remove it from crates in this repo.
2021-08-02 05:49:17 +00:00
Jonas Schievink c5a29f9245 Update error code description 2021-07-30 00:33:30 +02:00
Jade 3cf820e17d rfc3052: Remove authors field from Cargo manifests
Since RFC 3052 soft deprecated the authors field anyway, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information, we should remove it from
crates in this repo.
2021-07-29 14:56:05 -07:00
Yuki Okushi 1d5f15f9fb
Rollup merge of #87521 - midgleyc:long-E0498, r=GuillaumeGomez
Add long explanation for E0498

Helps with #61137
2021-07-29 06:11:47 +09:00
Yuki Okushi 9222984636
Rollup merge of #87435 - ibraheemdev:patch-4, r=JohnTitor
fix example code for E0617

Closes #86908
2021-07-29 06:11:44 +09:00
Ibraheem Ahmed 00198dd902 fix example code for E0617 2021-07-28 16:33:02 -04:00
Jacob Pratt 5ae2371ceb
Indicate E0665 is no longer emitted 2021-07-27 15:47:49 -04:00
Chris Midgley bc70252f50 Mark code as ignored due to requiring external plugin 2021-07-27 19:44:50 +01:00
Chris Midgley 7f563f7f4e Add long explanation for E0498 2021-07-27 18:06:34 +01:00
Chris Midgley b21024f7b9 Add long explanation for E0544. 2021-07-26 22:59:16 +01:00
Guillaume Gomez 3a8bc0d7da
Rollup merge of #87342 - midgleyc:add-E0757-long, r=GuillaumeGomez
Add long explanation for E0757

Helps with #61137
2021-07-21 15:52:53 +02:00
Chris Midgley 8b75fecedd docs: normalise wording in line with docs 2021-07-21 14:13:46 +01:00
Chris Midgley 3e981e2209 docs: add additional links for ffi_pure / ffi_const 2021-07-21 14:13:40 +01:00
Chris Midgley 27ffc3725a Add long explanation for E0757 2021-07-21 13:31:47 +01:00
Chris Midgley b24d4915b8 docs: add newline before example 2021-07-21 10:58:35 +01:00
Chris Midgley adc5de601f docs: remove spurious main functions 2021-07-21 10:57:27 +01:00
Chris Midgley e09d782609 add working code example 2021-07-21 10:29:20 +01:00
Chris Midgley 320d049e87 Add long explanation for E0722 2021-07-20 20:30:07 +01:00
Guillaume Gomez d85718ad01
Rollup merge of #86838 - lambinoo:I-69630-rust_const_unstable_check_const, r=oli-obk
Checking that function is const if marked with rustc_const_unstable

Fixes #69630

This one is still missing tests to check the behavior but I checked by hand and it seemed to work.
I would not mind some direction for writing those unit tests!
2021-07-08 18:30:34 +02:00
Lamb 07f903e0e0 fn must be const if marked with stability attribut
remove trailing newline

fix: test with attribute but missing const

Update compiler/rustc_passes/src/stability.rs

Co-authored-by: Léo Lanteri Thauvin <leseulartichaut@gmail.com>

Add test for extern functions

fix: using span_help instead of span_suggestion

add test for some ABIs + fmt fix

Update compiler/rustc_passes/src/stability.rs

Co-authored-by: Léo Lanteri Thauvin <leseulartichaut@gmail.com>

Refractor and add test for `impl const`

Add test to make sure no output + cleanup condition

-----------------------------

remove stdcall test, failing CI test

C abi is already tested in this, so it is not that useful to test another one.
The tested code is blind to which specific ABI for now, as long as it's not an intrinsic one
2021-07-08 07:52:05 +02:00
Yuki Okushi 5d555bf239
Rollup merge of #86477 - tlyu:e0716-clarification, r=JohnTitor
E0716: clarify that equivalent code example is erroneous

In E0716, there is a code block that is equivalent to the erroneous
code example. Especially when viewed with `rustc --explain`, it's
not obvious that it is also erroneous, and some users have been
confused when they try to change their code to match the erroneous
equivalent.

`@rustbot` label +A-diagnostics +D-newcomer-roadblock +T-compiler
2021-07-05 07:13:22 +09:00
Taylor Yu 92197a551f E0716: clarify that equivalent code example is erroneous
In E0716, there is a code block that is equivalent to the erroneous
code example. Especially when viewed with `rustc --explain`, it's
not obvious that it is also erroneous, and some users have been
confused when they try to change their code to match the erroneous
equivalent.
2021-07-04 10:04:37 -05:00
Yuki Okushi ab4d16fe7a
Rollup merge of #86148 - FabianWolff:issue-85855, r=varkor
Check the number of generic lifetime and const parameters of intrinsics

This pull request fixes #85855. The current code for type checking intrinsics only checks the number of generic _type_ parameters, but does not check for an incorrect number of lifetime or const parameters, which can cause problems later on, such as the ICE in #85855, where the code thought that it was looking at a type parameter but found a lifetime parameter:
```
error: internal compiler error: compiler/rustc_middle/src/ty/generics.rs:188:18:
    expected type parameter, but found another generic parameter
```

The changes in this PR add checks for the number of lifetime and const parameters, expand the scope of `E0094` to also apply to these cases, and improve the error message by properly pluralizing the number of expected generic parameters.
2021-07-02 06:20:28 +09:00
Fabian Wolff fe93349109 Minor adjustments and refactoring 2021-07-01 17:48:19 +02:00
Fabian Wolff 4e08bb5225 Fix typo and improve documentation for E0632 2021-06-29 01:09:44 +02:00
bors 456a03227e Auto merge of #86279 - JohnTitor:transparent-zero-size-fields, r=nikomatsakis
Permit zero non-zero-field on transparent types

Fixes #77841

This makes the transparent fields meet the below:
> * A `repr(transparent)` type `T` must meet the following rules:
>   * It may have any number of 1-ZST fields
>   * In addition, it may have at most one other field of type U

r? `@nikomatsakis`
2021-06-24 07:29:59 +00:00
Guillaume Gomez 12b6d32387 Remove unused error codes from error_codes.rs and from EXEMPTED_FROM_TEST constant 2021-06-23 21:32:37 +02:00
mbartlett21 9db5c483ab
Add destructuring example of E0508
This adds an example that destructures the array to move the value, instead of taking a reference or cloning.
2021-06-22 22:24:46 +10:00
Yuki Okushi 4e755a96a7
Adjust documentation 2021-06-14 07:42:15 +09:00
Shadlock0133 dab89b51ac
Fix typo `with custom a custom` -> `with a custom` 2021-06-13 21:21:45 +02:00
Fabian Wolff 7b2befc27b Check the number of generic lifetime and const parameters of intrinsics 2021-06-08 20:41:16 +02:00
Fabian Wolff c01d63ab76 Add E0316.md 2021-06-07 14:20:39 +02:00
Fabian Wolff a20870bdb9 Comment out unused error codes in error_codes.rs 2021-06-07 13:01:04 +02:00
Fabian Wolff 31eee595cf Fix corrected example in E0759.md 2021-06-06 22:54:00 +02:00
Rafael Kraut a56d0e2f6e
swap function order for better read flow
When having the order

```
foo.bar(); // we can now use this method since i32 implements the Foo trait

[...]

impl Foo for i32
```

the `// we can now use this method` comment is less clear to me.
2021-05-13 13:22:24 +02:00
bors 7a0f1781d0 Auto merge of #83213 - rylev:update-lints-to-errors, r=nikomatsakis
Update BARE_TRAIT_OBJECT and ELLIPSIS_INCLUSIVE_RANGE_PATTERNS to errors in Rust 2021

This addresses https://github.com/rust-lang/rust/pull/81244 by updating two lints to errors in the Rust 2021 edition.

r? `@estebank`
2021-05-04 08:09:23 +00:00
Charles Lew d261df4a72 Implement RFC 1260 with feature_name `imported_main`. 2021-04-29 08:35:08 +08:00
Ralf Jung 8a961a5b33 remove const_fn from some error_code descriptions 2021-04-25 12:19:06 +02:00
bors b56b175c6c Auto merge of #84310 - RalfJung:const-fn-feature-flags, r=oli-obk
further split up const_fn feature flag

This continues the work on splitting up `const_fn` into separate feature flags:
* `const_fn_trait_bound` for `const fn` with trait bounds
* `const_fn_unsize` for unsizing coercions in `const fn` (looks like only `dyn` unsizing is still guarded here)

I don't know if there are even any things left that `const_fn` guards... at least libcore and liballoc do not need it any more.

`@oli-obk` are you currently able to do reviews?
2021-04-24 23:16:03 +00:00
bors 8ad0821b03 Auto merge of #83729 - JohnTitor:issue-43913, r=estebank
Add a suggestion when using a type alias instead of trait alias

Fixes #43913

r? `@estebank`
2021-04-23 23:44:49 +00:00
Ralf Jung 46d09f7a4b remove E0723 error code 2021-04-19 14:58:11 +02:00
bors c4ba8e3e5f Auto merge of #83799 - crlf0710:stablize_non_ascii_idents, r=Manishearth
Stablize `non-ascii-idents`

This is the stablization PR for RFC 2457. Currently this is waiting on fcp in [tracking issue](https://github.com/rust-lang/rust/issues/55467).

r? `@Manishearth`
2021-04-18 23:28:43 +00:00
Charles Lew fc357039f9 Remove #[main] attribute. 2021-04-16 13:04:02 +08:00
Ryan Levick aa4457fa5f Add compatibility info to lints 2021-04-13 16:55:54 +02:00
Ryan Levick cebc520034 Fix error code tests 2021-04-08 16:33:24 +02:00