Commit graph

142407 commits

Author SHA1 Message Date
Arpad Borsos
d93d77b713
rustdoc: Simplify some document functions
* Remove `prefix` param of `document_short/full`, `render_markdown`, as its always an empty string.
* Remove `Option` wrapping of `document_short` `parent`, as its always `Some`.
2021-04-19 23:42:09 +02:00
Michael Howell
20c3627052 Use onEachLazy to iterate DOMTokenList 2021-04-19 14:12:40 -07:00
Eric Huss
0502bccde7 Remove comment about doc hack. 2021-04-19 14:06:36 -07:00
bors
9d9c2c92b8 Auto merge of #84342 - Dylan-DPC:rollup-5b40142, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #84123 (Introduce CompileMonoItem DepNode)
 - #84126 (Enable sanitizers for x86_64-unknown-linux-musl)
 - #84168 (Lower async fn in traits.)
 - #84256 (doc: use U+2212 for minus sign in floating-point -0.0 remarks)
 - #84291 (fix aliasing violations in thread_local_const_init)
 - #84313 (fix suggestion for unsized function parameters)
 - #84330 (Remove unused footer section)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-04-19 20:49:27 +00:00
Cameron Steffen
c9c14d0c1f Small refactor 2021-04-19 15:40:21 -05:00
Cameron Steffen
98a11e01e5 Remove closure_tree 2021-04-19 15:40:20 -05:00
Michael Howell
9b624071d3 rustdoc: Show nag box on IE10
Rustdoc doesn't work on IE11. It's been broken for months, it isn't supported
by the [tiered browser support list], it's even more severely broken on other
Rust websites, and IE11 doesn't support the `<details>` tag that we want
to use.

In the interest of honesty, let's give an actual error message for anyone
on IE11.

[tiered browser support list]: https://github.com/rust-lang/rfcs/blob/master/text/1985-tiered-browser-support.md
2021-04-19 13:39:48 -07:00
Guillaume Gomez
e2e104b993 Add lint to check for boolean comparison in assert macro calls 2021-04-19 22:15:51 +02:00
Dylan DPC
a23fd1694d
Rollup merge of #84330 - GuillaumeGomez:remove-footer, r=jyn514
Remove unused footer section

I realized yesterday while working on docs.rs that rustdoc was generating a "footer"section that it doesn't use. No need to keep it then.

r? `@jyn514`
2021-04-19 22:00:11 +02:00
Dylan DPC
349fae3a32
Rollup merge of #84313 - lcnr:sized-err-msg, r=petrochenkov
fix suggestion for unsized function parameters

taken from `@fasterthanlime's` article https://fasterthanli.me/articles/whats-in-the-box
2021-04-19 22:00:10 +02:00
Dylan DPC
761243572e
Rollup merge of #84291 - RalfJung:thread-local-const-init, r=alexcrichton
fix aliasing violations in thread_local_const_init

Fixes https://github.com/rust-lang/rust/pull/83416#discussion_r615364774

r? `@alexcrichton` `@sfackler`
2021-04-19 22:00:09 +02:00
Dylan DPC
fb78dc05e4
Rollup merge of #84256 - tspiteri:pretty-minus-zero, r=workingjubilee
doc: use U+2212 for minus sign in floating-point -0.0 remarks

Also remove plus sign in `-0.0 == +0.0` to make it a valid expression.
2021-04-19 22:00:08 +02:00
Dylan DPC
e5b5745db1
Rollup merge of #84168 - cjgillot:asi, r=davidtwco
Lower async fn in traits.

An error is already created by AST validation.

Fixes #84149
2021-04-19 22:00:06 +02:00
Dylan DPC
3b81ea86fb
Rollup merge of #84126 - 12101111:musl-sanitizer, r=davidtwco
Enable sanitizers for x86_64-unknown-linux-musl

Those 4 sanitizers get musl target support in LLVM 12 release.
2021-04-19 22:00:04 +02:00
Dylan DPC
817b7e0c11
Rollup merge of #84123 - bjorn3:compile_mono_item_dep_node, r=wesleywiser
Introduce CompileMonoItem DepNode

This is likely required for allowing efficient hot code swap support in cg_clif's jit mode. My prototype currently requires re-compiling all functions, which is both slow and uses a lot of memory as there is not support for freeing the memory used by replaced functions yet.

cc https://github.com/bjorn3/rustc_codegen_cranelift/issues/1087
2021-04-19 22:00:01 +02:00
Rich Kadel
5d8d67f746 compute fn_sig span from body call_site, and use body ctxt, not root 2021-04-19 12:30:55 -07:00
Tor Hovland
64a68ae69a No longer need to add attrs to ImportSource. 2021-04-19 20:39:04 +02:00
lcnr
419bf6bbd8 fix suggestion for unsized function parameters 2021-04-19 20:06:19 +02:00
lcnr
a8193ca4c3 fix suggestion for unsized function parameters 2021-04-19 20:06:19 +02:00
bors
1a6c98e4d6 Auto merge of #84091 - tmiasko:check-attrs-sym, r=davidtwco
Match against attribute name when validating attributes

Extract attribute name once and match it against symbols that are being
validated, instead of using `Session::check_name` for each symbol
individually.

Assume that all validated attributes are used, instead of marking them
as such, since the attribute check should be exhaustive.
2021-04-19 18:05:44 +00:00
bors
8f77e2067f Auto merge of #7111 - giraffate:fix_link_in_doc, r=Manishearth
Fix links in doc

changelog: none
2021-04-19 15:56:04 +00:00
Caleb Tennis
42d070286e Ignore aarch64 for this test as it's x86 assembly only. Fixes #7091 2021-04-19 11:39:42 -04:00
Basavesh Shivakumar
c6b381c59b useless use of format! should return function directly 2021-04-19 17:20:21 +02:00
Aleksey Kladov
de16951dad Clarify the difference between insert and get_or_insert 2021-04-19 18:17:45 +03:00
bors
a3b1efd8e6 Auto merge of #7112 - giraffate:update_pull_request_template, r=camsteffen
Update pull request template

A follow-up of <https://github.com/rust-lang/rust-clippy/pull/7064#issuecomment-817857168>.

changelog: none
2021-04-19 14:39:11 +00:00
Takayuki Nakata
2d65b2d543 Update pull request template 2021-04-19 23:02:41 +09:00
Takayuki Nakata
b20cbff666 Fix links in doc 2021-04-19 22:47:09 +09:00
bors
fe5cefceba Auto merge of #7101 - camsteffen:flat-map-option, r=giraffate
Add flat_map_option lint

changelog: Add flat_map_option lint

Closes #2241
2021-04-19 13:34:23 +00:00
Ralf Jung
46d09f7a4b remove E0723 error code 2021-04-19 14:58:11 +02:00
klensy
f43ee8ebf6 fix few typos 2021-04-19 15:57:08 +03:00
bors
41f0e13bc5 Auto merge of #84294 - WaffleLapkin:patch-2, r=jonas-schievink
Slightly change wording in doc comment and fix typo in vec/mod.rs

Suggested by `@pickfire` in https://github.com/rust-lang/rust/pull/82760
2021-04-19 11:55:52 +00:00
Christiaan Dirkx
9bd9cbb28e Fix vxworks compilation errors 2021-04-19 13:29:35 +02:00
Christiaan Dirkx
12120409d5 Move sys::vxworks code to sys::unix 2021-04-19 13:29:22 +02:00
Ralf Jung
04db4abbfc add gate tests and pacify tidy 2021-04-19 10:25:31 +02:00
Guillaume Gomez
4fa1d6177c Remove unused footer section 2021-04-19 10:21:31 +02:00
Arpad Borsos
9f8eeca3bf
rustdoc: Convert sub-variant toggle to HTML
Instead of creating a JS toggle, this injects details/summary for
sub-variants of enums. This also fixes the CSS so that the toggle button
does not jump when expanding/collapsing.
2021-04-19 09:38:22 +02:00
bors
62652865b6 Auto merge of #84283 - jsha:de-emphasize-attributes, r=GuillaumeGomez
rustdoc: Reduce visual weight of attributes.

Followup from #83337. As part of that PR, we stopped hiding attributes behind a toggle, because most things have just zero or one attributes. However, this made clear that the current rendering of attributes emphasizes them a lot, which distracts from function signatures. This PR changes their color of attributes to be the same as the toggles, and reduces their font weight.

This also removes `#[lang]` from the list of ALLOWED_ATTRIBUTES. This attribute is an implementation detail rather than part of the public-facing documentation.

![image](https://user-images.githubusercontent.com/220205/115131061-cc407d80-9fa9-11eb-9a77-ad3f3217f391.png)

Demo at https://hoffman-andrews.com/rust/de-emph-attr/std/string/struct.String.html#method.trim
2021-04-19 07:32:55 +00:00
bors
532609b01c Auto merge of #84316 - teymour-aldridge:improve-defaulted-never-note, r=petrochenkov
Improve an error message.
2021-04-19 04:51:48 +00:00
bors
8108e17faa Auto merge of #84288 - notriddle:short-links, r=jyn514
rustdoc: get rid of CURRENT_DEPTH

Fixes #82742
2021-04-19 01:59:20 +00:00
Trevor Spiteri
4c6477026d
Update library/std/src/primitive_docs.rs
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
2021-04-19 02:58:38 +02:00
bors
c569d33be5 Auto merge of #7108 - rust-lang:fix-return-try-err, r=Manishearth
un-double `return` on try_err

This fixes #7103 by looking at the parent expression and omitting the "return " in the suggestion when its already a `return` expression.

---

changelog: none
2021-04-18 23:47:18 +00: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
Rich Kadel
1893721ec4 Fixes the issue with uncovered source in async function bodies
The body_span was assumed to be in the Span root context, but this was
not the case for async function bodies.
2021-04-18 16:26:18 -07:00
Rich Kadel
3ece6061b4 DRAFT: coverage of async function bodies should match non-async
The initial commit demonstrates the issue, but the fix is not yet
implemented.

Once corrected...

Fixes: #83985
2021-04-18 15:04:59 -07:00
Andre Bogus
243dc46250 un-double return on try_err 2021-04-18 23:49:54 +02:00
Ralf Jung
bd9556956a fix feature use in rustc libs 2021-04-18 22:05:45 +02:00
bors
392d54963f Auto merge of #78880 - CDirkx:not_supported, r=joshtriplett
Add `Unsupported` to `std::io::ErrorKind`

I noticed a significant portion of the uses of `ErrorKind::Other` in std is for unsupported operations.
The notion that a specific operation is not available on a target (and will thus never succeed) seems semantically distinct enough from just "an unspecified error occurred", which is why I am proposing to add the variant `Unsupported` to `std::io::ErrorKind`.

**Implementation**:

The following variant will be added to `std::io::ErrorKind`:

```rust
/// This operation is unsupported on this platform.
Unsupported
```
`std::io::ErrorKind::Unsupported` is an error returned when a given operation is not supported on a platform, and will thus never succeed; there is no way for the software to recover. It will be used instead of `Other` where appropriate, e.g. on wasm for file and network operations.

`decode_error_kind` will be updated  to decode operating system errors to `Unsupported`:
- Unix and VxWorks: `libc::ENOSYS`
- Windows: `c::ERROR_CALL_NOT_IMPLEMENTED`
- WASI: `wasi::ERRNO_NOSYS`

**Stability**:
This changes the kind of error returned by some functions on some platforms, which I think is not covered by the stability guarantees of the std? User code could depend on this behavior, expecting `ErrorKind::Other`, however the docs already mention:

> Errors that are `Other` now may move to a different or a new `ErrorKind` variant in the future. It is not recommended to match an error against `Other` and to expect any additional characteristics, e.g., a specific `Error::raw_os_error` return value.

The most recent variant added to `ErrorKind` was `UnexpectedEof` in `1.6.0` (almost 5 years ago), but `ErrorKind` is marked as `#[non_exhaustive]` and the docs warn about exhaustively matching on it, so adding a new variant per se should not be a breaking change.

The variant `Unsupported` itself could be marked as `#[unstable]`, however, because this PR also immediately uses this new variant and changes the errors returned by functions I'm inclined to agree with the others in this thread that the variant should be insta-stabilized.
2021-04-18 20:03:54 +00:00
bors
5a4ab26459 Auto merge of #78880 - CDirkx:not_supported, r=joshtriplett
Add `Unsupported` to `std::io::ErrorKind`

I noticed a significant portion of the uses of `ErrorKind::Other` in std is for unsupported operations.
The notion that a specific operation is not available on a target (and will thus never succeed) seems semantically distinct enough from just "an unspecified error occurred", which is why I am proposing to add the variant `Unsupported` to `std::io::ErrorKind`.

**Implementation**:

The following variant will be added to `std::io::ErrorKind`:

```rust
/// This operation is unsupported on this platform.
Unsupported
```
`std::io::ErrorKind::Unsupported` is an error returned when a given operation is not supported on a platform, and will thus never succeed; there is no way for the software to recover. It will be used instead of `Other` where appropriate, e.g. on wasm for file and network operations.

`decode_error_kind` will be updated  to decode operating system errors to `Unsupported`:
- Unix and VxWorks: `libc::ENOSYS`
- Windows: `c::ERROR_CALL_NOT_IMPLEMENTED`
- WASI: `wasi::ERRNO_NOSYS`

**Stability**:
This changes the kind of error returned by some functions on some platforms, which I think is not covered by the stability guarantees of the std? User code could depend on this behavior, expecting `ErrorKind::Other`, however the docs already mention:

> Errors that are `Other` now may move to a different or a new `ErrorKind` variant in the future. It is not recommended to match an error against `Other` and to expect any additional characteristics, e.g., a specific `Error::raw_os_error` return value.

The most recent variant added to `ErrorKind` was `UnexpectedEof` in `1.6.0` (almost 5 years ago), but `ErrorKind` is marked as `#[non_exhaustive]` and the docs warn about exhaustively matching on it, so adding a new variant per se should not be a breaking change.

The variant `Unsupported` itself could be marked as `#[unstable]`, however, because this PR also immediately uses this new variant and changes the errors returned by functions I'm inclined to agree with the others in this thread that the variant should be insta-stabilized.
2021-04-18 20:03:54 +00:00
teymour-aldridge
567de4a202 Improve an error message. 2021-04-18 20:38:23 +01:00
Rich Kadel
d1d7fb1ae5 Only generate dummy assign when instrumenting coverage
And make the LocalDecl internal, to avoid needing to declare storage.
(For multiple `continue` stateuemtns, it must also be mutable.)
2021-04-18 12:09:14 -07:00