Commit graph

101 commits

Author SHA1 Message Date
Yuki Okushi f898aa3f5b
Rollup merge of #80527 - jyn514:rustdoc-lints, r=GuillaumeGomez
Make rustdoc lints a tool lint instead of built-in

- Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links` (and similar for other rustdoc lints; I don't expect any others to be used frequently, though).
- Ensure that the old lint names still work and give deprecation errors
- Register lints even when running doctests
- Move lint machinery into a separate file
- Add `declare_rustdoc_lint!` macro

Unblocks https://github.com/rust-lang/rust/pull/80300, https://github.com/rust-lang/rust/pull/79816, https://github.com/rust-lang/rust/pull/80965. Makes the strangeness in https://github.com/rust-lang/rust/pull/77364 more apparent to the end user (note that `missing_docs` is *not* moved to rustdoc in this PR). Closes https://github.com/rust-lang/rust/issues/78786.

## Current status

This is blocked on #82620 (see https://github.com/rust-lang/rust/pull/80527#issuecomment-787401519)
2021-03-04 20:01:01 +09:00
Yuki Okushi 5e68c60406
Rollup merge of #82516 - PoignardAzur:inherent-impl-ty, r=oli-obk
Add incomplete feature gate for inherent associate types.

Mentored by ``````@oli-obk``````

So far the only change is that instead of giving an automatic error, the following code compiles:

```rust
struct Foo;

impl Foo {
    type Bar = isize;
}
```

The backend work to make it actually usable isn't there yet. In particular, this:

```rust
let x : Foo::Bar;
```

will give you:

```sh
error[E0223]: ambiguous associated type
  --> /$RUSTC_DIR/src/test/ui/assoc-inherent.rs:15:13
   |
LL |     let x : Foo::Bar;
   |             ^^^^^^^^ help: use fully-qualified syntax: `<Foo as Trait>::Bar`
```
2021-03-02 21:23:15 +09:00
Joshua Nelson cc62018e61 Rename rustdoc lints to be a tool lint instead of built-in.
- Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links`
- Ensure that the old lint names still work and give deprecation errors
- Register lints even when running doctests

  Otherwise, all `rustdoc::` lints would be ignored.

- Register all existing lints as removed

  This unfortunately doesn't work with `register_renamed` because tool
  lints have not yet been registered when rustc is running. For similar
  reasons, `check_backwards_compat` doesn't work either. Call
  `register_removed` directly instead.

- Fix fallout

  + Rustdoc lints for compiler/
  + Rustdoc lints for library/

Note that this does *not* suggest `rustdoc::broken_intra_doc_links` for
`rustdoc::intra_doc_link_resolution_failure`, since there was no time
when the latter was valid.
2021-03-01 19:29:15 -05:00
bors d95d304861 Auto merge of #78429 - casey:doctest-attribute-splitting, r=jyn514
[librustdoc] Only split lang string on `,`, ` `, and `\t`

Split markdown lang strings into tokens on `,`.

The previous behavior was to split lang strings into tokens on any
character that wasn't a `_`, `_`, or alphanumeric.

This is a potentially breaking change, so please scrutinize! See discussion in #78344.

I noticed some test cases that made me wonder if there might have been some reason for the original behavior:

```
t("{.no_run .example}", false, true, Ignore::None, true, false, false, false, v(), None);
t("{.sh .should_panic}", true, false, Ignore::None, false, false, false, false, v(), None);
t("{.example .rust}", false, false, Ignore::None, true, false, false, false, v(), None);
t("{.test_harness .rust}", false, false, Ignore::None, true, true, false, false, v(), None);
```

It seemed pretty peculiar to specifically test lang strings in braces, with all the tokens prefixed by `.`.

I did some digging, and it looks like the test cases were added way back in [this commit from 2014](https://github.com/rust-lang/rust/commit/3fef7a74ca9a) by `@skade.`

It looks like they were added just to make sure that the splitting was permissive, and aren't testing that those strings in particular are accepted.

Closes https://github.com/rust-lang/rust/issues/78344.
2021-02-26 00:17:22 +00:00
Olivier FAURE 4f4e15d5eb Add feature gate for inherent associate types. 2021-02-25 14:10:25 +01:00
Dylan DPC 5ca94cd00a
Rollup merge of #82246 - jesusprubio:add-long-explanation-e0549, r=GuillaumeGomez
Add long explanation for E0549

Helps with #61137
2021-02-18 16:57:41 +01:00
Dylan DPC b3d3251271
Rollup merge of #82215 - TaKO8Ki:replace-if-let-while-let, r=varkor
Replace if-let and while-let with `if let` and `while let`

This pull request replaces if-let and while-let with `if let` and `while let`.

closes https://github.com/rust-lang/rust/issues/82205
2021-02-18 16:57:37 +01:00
Jesús Rubio 3c4fe1e3db
Update compiler/rustc_error_codes/src/error_codes/E0549.md
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2021-02-18 10:03:01 +01:00
Jesús Rubio 0e01c41c02
Update compiler/rustc_error_codes/src/error_codes/E0549.md
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2021-02-18 09:38:42 +01:00
Jesús Rubio 5112cf0282
Update compiler/rustc_error_codes/src/error_codes/E0549.md
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2021-02-18 09:23:21 +01:00
Jesus Rubio 5ae392f3c6 Add long explanation for E0549 2021-02-18 06:53:01 +01:00
Jesus Rubio c80b737394 Add long explanation for E0543 2021-02-17 18:08:30 +01:00
Takayuki Maeda 0f04875d2e replace if-let and while-let with if let and while let 2021-02-17 19:26:38 +09:00
Jesus Rubio 8192793d50 Add long explanation for E0545 2021-02-15 19:16:39 +01:00
Casey Rodarmor 66f4883308
[librustdoc] Reform lang string token splitting
Only split doctest lang strings on `,`, ` `, and `\t`. Additionally, to
preserve backwards compatibility with pandoc-style langstrings, strip a
surrounding `{}`, and remove leading `.`s from each token.

Prior to this change, doctest lang strings were split on all
non-alphanumeric characters except `-` or `_`, which limited future
extensions to doctest lang string tokens, for example using `=` for
key-value tokens.

This is a breaking change, although it is not expected to be disruptive,
because lang strings using separators other than `,` and ` ` are not
very common
2021-02-12 00:02:52 -08:00
Jesus Rubio a99d869e6c Improve long explanation for E0542 and E0546 2021-02-11 16:26:07 +01:00
Jesús Rubio 8fbdd2d15e
Update compiler/rustc_error_codes/src/error_codes/E0547.md
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2021-02-09 14:13:40 +01:00
Jesus Rubio 7b84b62d29 Lost text re-added 2021-02-09 14:09:19 +01:00
Jesus Rubio 4d33d41ef3 Add long explanation for E0547 2021-02-08 18:25:05 +01:00
bors bb587b1a17 Auto merge of #80652 - calebzulawski:simd-lanes, r=nagisa
Improve SIMD type element count validation

Resolves rust-lang/stdsimd#53.

These changes are motivated by `stdsimd` moving in the direction of const generic vectors, e.g.:
```rust
#[repr(simd)]
struct SimdF32<const N: usize>([f32; N]);
```

This makes a few changes:
* Establishes a maximum SIMD lane count of 2^16 (65536).  This value is arbitrary, but attempts to validate lane count before hitting potential errors in the backend.  It's not clear what LLVM's maximum lane count is, but cranelift's appears to be much less than `usize::MAX`, at least.
* Expands some SIMD intrinsics to support arbitrary lane counts.  This resolves the ICE in the linked issue.
* Attempts to catch invalid-sized vectors during typeck when possible.

Unresolved questions:
* Generic-length vectors can't be validated in typeck and are only validated after monomorphization while computing layout.  This "works", but the errors simply bail out with no context beyond the name of the type.  Should these errors instead return `LayoutError` or otherwise provide context in some way?  As it stands, users of `stdsimd` could trivially produce monomorphization errors by making zero-length vectors.

cc `@bjorn3`
2021-02-07 22:25:14 +00:00
Guillaume Gomez b2beb67fac
Rollup merge of #81835 - jesusprubio:improve-long-eplanation-e0546, r=GuillaumeGomez
Improve long explanation for E0546

Helps with #61137
2021-02-07 14:45:54 +01:00
Jesus Rubio ac6c09a980 Typo fix 2021-02-06 19:45:43 +01:00
Jesus Rubio 777582228c References added 2021-02-06 19:44:09 +01:00
Jesus Rubio 023c6d2e04 Comments updated to keep the consistency 2021-02-06 19:41:03 +01:00
Jesus Rubio 0d8a071f98 Improve long explanation for E0546 2021-02-06 18:27:19 +01:00
Jesus Rubio 9be5d2d01f Format fixes 2021-02-06 18:05:21 +01:00
Jesús Rubio 956c81355a
Update compiler/rustc_error_codes/src/error_codes/E0542.md
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2021-02-06 17:39:11 +01:00
Jesus Rubio be159379f6 Add long error explanation for E0542 2021-02-06 16:42:34 +01:00
Mara Bos 29371c2504
Rollup merge of #81676 - jyn514:crate-not-found, r=oli-obk
Add more information to the error code for 'crate not found'

This comes up a lot when bootstrapping.
2021-02-05 12:26:02 +01:00
Joshua Nelson 82914a5031 Add more information to the error code for 'crate not found'
This comes up a lot when bootstrapping.
2021-02-03 11:51:42 -05:00
bors b593389edb Auto merge of #81346 - hug-dev:nonsecure-call-abi, r=jonas-schievink
Add a new ABI to support cmse_nonsecure_call

This adds support for the `cmse_nonsecure_call` feature to be able to perform non-secure function call.

See the discussion on Zulip [here](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Support.20for.20callsite.20attributes/near/223054928).

This is a followup to #75810 which added `cmse_nonsecure_entry`. As for that PR, I assume that the changes are small enough to not have to go through a RFC but I don't mind doing one if needed 😃
I did not yet create a tracking issue, but if most of it is fine, I can create one and update the various files accordingly (they refer to the other tracking issue now).

On the Zulip chat, I believe `@jonas-schievink` volunteered to be a reviewer 💯
2021-02-03 06:00:43 +00:00
Hugues de Valon ce9818f2b7 Add a new ABI to support cmse_nonsecure_call
This commit adds a new ABI to be selected via `extern
"C-cmse-nonsecure-call"` on function pointers in order for the compiler to
apply the corresponding cmse_nonsecure_call callsite attribute.
For Armv8-M targets supporting TrustZone-M, this will perform a
non-secure function call by saving, clearing and calling a non-secure
function pointer using the BLXNS instruction.

See the page on the unstable book for details.

Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
2021-02-02 13:04:31 +00:00
Jesus Rubio ee5ea24d36 Add long error explanation for E0521 2021-02-01 18:22:13 +01:00
Jonas Schievink 36af32a740
Rollup merge of #81572 - pierwill:edit-error-codes-1, r=jonas-schievink
Edit multiple error code Markdown files

Makes small edits to several error code files. Fixes some missing punctuation. Changes some wording, grammar, and formatting for clarity and readability.

Adds a link to the rustup book in E0658.
2021-01-31 16:36:54 +01:00
pierwill fabb332c1a Edit multiple error code Markdown files
Makes small edits to several error code files. Fixes some
missing punctuation. Changes some wording, grammar, and formatting
for clarity and readability.

Adds a link to the rustup book in E0658.
2021-01-30 15:57:46 -08:00
Steve Heindel 642d27d40a Fix typo in E0759 2021-01-30 09:48:37 -05:00
Joakim Åkerblom 1d03648e67 Fix spelling in documentation for error E0207
I have trouble parsing the the wording "type parameter parameter".
2021-01-24 20:31:42 +01:00
Caleb Zulawski a4bab7c6fa Update docs with powers-of-two 2021-01-24 00:17:40 -05:00
Mara Bos af5b0d9883
Rollup merge of #80614 - 1000teslas:issue-78938-fix, r=tmandry
Explain why borrows can't be held across yield point in async blocks

For https://github.com/rust-lang/rust/issues/78938.
2021-01-16 17:29:49 +00:00
1000teslas 5468d9805a Simplify E0373 async code example 2021-01-15 16:50:48 +11:00
1000teslas 63deae5e25 Fix E0373 code example 2021-01-14 21:52:38 +11:00
1000teslas 174135fb3b Fix error E0373 documentation 2021-01-14 17:15:04 +11:00
1000teslas a9ead34371 Fix whitespace 2021-01-14 01:21:27 +11:00
Mark Rousskov 4614671cae Update code to account for extern ABI requirement 2021-01-13 07:49:45 -05:00
Mark Rousskov 8a3edb1d66 Update tests for extern block linting 2021-01-13 07:49:16 -05:00
1000teslas 7f41465f6d Move help link to error index 2021-01-13 23:37:49 +11:00
Daiki Ihara c71348a9c6 Refine E0435 description 2021-01-07 20:20:58 +09:00
oli 3ed14033f7 Reinstate the error-code error over the feature gate error 2021-01-01 16:59:12 +00:00
oli 0b841846ba Allow references to interior mutable data behind a feature gate 2021-01-01 16:59:12 +00:00
bors a6bd5246da Auto merge of #80267 - 0urobor0s:ouro/61592, r=jyn514
Rustdoc render public underscore_imports as Re-exports

Fixes #61592
2020-12-31 09:07:52 +00:00