Commit Graph

142233 Commits

Author SHA1 Message Date
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
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
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
r00ster
c86ffe9e89
Say that it "may panic" 2021-04-18 18:16:10 +02:00
Tor Hovland
c975fe25e4 Put attrs in a Box for memory efficiency. 2021-04-18 18:02:08 +02:00
bors
ef88434286 Auto merge of #84274 - nagisa:fix-simd, r=nikic
Don't set fast-math for the SIMD operations we set it for previously

Instead of `fast-math`. `fast-math` implies things like functions not
being able to accept as an argument or return as a result, say, `inf`
which made these functions confusingly named or behaving incorrectly,
depending on how you interpret it. It seems that the intended behaviour
was to set a `afn` flag instead. In doing so we also renamed the
intrinsics to say `_approx` so that it is clear these are not precision
oriented and the users can act accordingly.

Fixes #84268
2021-04-18 14:39:34 +00:00
r00ster
df01b3a67b
Document that index and index_mut can panic 2021-04-18 15:51:16 +02:00
bors
b021beeb60 Auto merge of #84285 - hi-rustin:rustin-patch-search, r=GuillaumeGomez
Fix the wrong return value type description of validateResult

It's should be boolean not [boolean].
2021-04-18 11:42:51 +00:00
Rich Kadel
448e52d97c Add coverage to continue statements
`continue` statements were missing coverage. This was particularly
noticeable in a match pattern that contained only a `continue`
statement, leaving the branch appear uncounted. This PR addresses the
problem and adds tests to prove it.
2021-04-18 03:11:25 -07:00
Waffle Lapkin
3ecaf57b29
Slightly change wording and fix typo in vec/mod.rs 2021-04-18 12:32:10 +03:00
Ralf Jung
7a5418dae1 fix aliasing violations in thread_local_const_init 2021-04-18 10:55:09 +02:00
Tor Hovland
e2a77b3d46 Test Deprecated, Portability, and Unstable. 2021-04-18 10:46:06 +02:00
Tor Hovland
fca088ae23 Now also displays portability tags. 2021-04-18 10:46:06 +02:00
Tor Hovland
1e2ab998c3 Give import items their own CSS class. 2021-04-18 10:46:06 +02:00
Tor Hovland
41f49aac4e Added a test. 2021-04-18 10:45:52 +02:00
Tor Hovland
0c736e92a3 Add stability tags to ImportItem. 2021-04-18 10:45:22 +02:00
Christiaan Dirkx
5b5afaefff Fix clippy test using ErrorKind 2021-04-18 09:29:24 +02:00
CDirkx
b42e52f2cc Bump to 1.53.0
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
2021-04-18 09:29:24 +02:00
Christiaan Dirkx
0895a693bd Fix test metadata_access_times to also check for Unsupported 2021-04-18 09:29:24 +02:00
Christiaan Dirkx
af0dec2795 Rename NotSupported to Unsupported 2021-04-18 09:29:23 +02:00
Christiaan Dirkx
1b5f117c47 Use NotSupported in more places 2021-04-18 09:29:23 +02:00
CDirkx
86592b9939 Bump since to 1.52.0 2021-04-18 09:29:22 +02:00
Christiaan Dirkx
9f589b023f Update decode_error_kind to decode os errors to NotSupported 2021-04-18 09:29:22 +02:00
Christiaan Dirkx
4a15bd8eaf Add and insta-stabilize std::io::ErrorKind::NotSupported 2021-04-18 09:29:22 +02:00
bors
d7c3386414 Auto merge of #84207 - SimonSapin:deprecate-core-raw, r=dtolnay
Deprecate the core::raw / std::raw module

It only contains the `TraitObject` struct which exposes components of wide pointer. Pointer metadata APIs are designed to replace this: https://github.com/rust-lang/rust/issues/81513
2021-04-18 07:23:54 +00:00
Anders Kaseorg
6dfd700c59 bootstrap: Restore missing --bulk-dirs for rust-docs, rustc-docs
The --bulk-dirs argument was removed for rust-docs in commit
c768ce1384 and rustc-docs in commit
8ca46fc7a8 (#79788), presumably by
mistake; that slowed down installation of rust-docs from under a
second to some twenty *minutes*.  Restoring --bulk-dirs reverses this
slowdown.

Fixes #80684.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2021-04-17 23:43:50 -07:00
Michael Howell
18fbd3692f rustdoc: get rid of CURRENT_DEPTH 2021-04-17 23:08:28 -07:00
bors
6765010495 Auto merge of #84065 - c410-f3r:tests-tests-tests, r=petrochenkov
Move some tests to more reasonable directories - 6

cc #73494
r? `@petrochenkov`

git mv bad/bad-const-type.* static/
git mv bad/bad-crate-name.* extern
git mv bad/bad-env-capture* fn/
git mv bad/bad-expr-lhs.* expr/
git mv bad/bad-expr-path* expr/
git mv bad/bad-extern-link-attrs.* extern/
git mv bad/bad-intrinsic-monomorphization.* intrinsics/
git mv bad/bad-lint-cap* lint/
git mv bad/bad-main.* fn
git mv bad/bad-method-typaram-kind.* type/
git mv bad/bad-mid-path-type-params.* fn
git mv bad/bad-module.* modules/
git mv bad/bad-sized.* type/
git mv bad/bad-type-env-capture.* fn
2021-04-18 04:53:18 +00:00
hi-rustin
37b289720d Fix the wrong return value type description of validateResult 2021-04-18 10:43:14 +08:00
bors
dc99219d3a Auto merge of #84064 - hyd-dev:unknown-lints, r=petrochenkov
Do not ignore path segments in the middle in `#[allow]`/`#[warn]`/`#[deny]`/`#[forbid]` attributes

Fixes #83477.
2021-04-18 02:12:13 +00:00
Jacob Hoffman-Andrews
e23b035bbe Reduce visual weight of attributes. 2021-04-17 18:08:50 -07:00
bors
83ca4b7e60 Auto merge of #84061 - AngelicosPhosphoros:issue-75598-add-inline-always-arithmetic, r=nagisa
Add some #[inline(always)] to arithmetic methods of integers

I tried to add it only to methods which return results of intrinsics and don't have any branching.
Branching could made performance of debug builds (`-Copt-level=0`) worse.
Main goal of changes is allowing wider optimizations in `-Copt-level=1`.

Closes: https://github.com/rust-lang/rust/issues/75598

r? `@nagisa`
2021-04-17 23:31:10 +00:00
Caio
4e6d6abc6a Move some tests to more reasonable directories - 6 2021-04-17 18:53:54 -03:00
bors
392ba2ba1a Auto merge of #84279 - Dylan-DPC:rollup-k7otd7e, r=Dylan-DPC
Rollup of 4 pull requests

Successful merges:

 - #83237 (rustdoc: use more precise relative URLs)
 - #84150 (rustdoc: move some search code into search.js)
 - #84203 (rustdoc: Give a more accurate span for anchor failures)
 - #84257 (Add documentation to help people find `Ipv4Addr::UNSPECIFIED`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-04-17 20:41:37 +00:00
Simonas Kazlauskas
487e27350a Don't set fast(-math) for certain simd ops
`fast-math` implies things like functions not being able to accept as an
argument or return as a result, say, `inf` which made these functions
confusingly named or behaving incorrectly, depending on how you
interpret it. Since the time when these intrinsics have been implemented
the intrinsics user's (stdsimd) approach has changed significantly and
so now it is required that these intrinsics operate normally rather than
in "whatever" way.

Fixes #84268
2021-04-17 23:33:10 +03:00
Dylan DPC
a3277e2a0a
Rollup merge of #84257 - joshtriplett:inaddr-any, r=m-ou-se
Add documentation to help people find `Ipv4Addr::UNSPECIFIED`

People looking for `INADDR_ANY` don't always find `Ipv4Addr::UNSPECIFIED`;
add some documentation to help.
2021-04-17 22:31:34 +02:00
Dylan DPC
d919a5a8f8
Rollup merge of #84203 - jyn514:anchor-span, r=euclio
rustdoc: Give a more accurate span for anchor failures

r? `@euclio`
2021-04-17 22:31:33 +02:00
Dylan DPC
b5ce9c44a3
Rollup merge of #84150 - jsha:defer-search-js, r=GuillaumeGomez
rustdoc: move some search code into search.js

This reduces main.s from 3094 lines to 1587. Also it saves some bytes
of download in the case where search isn't used.

There were a fair number of variables that needed to be accessible in
both main.js and search.js, but I didn't want to put too many symbols in
the global namespace, so I consolidated much of the search-related
state and functions into a new object `window.searchState`.

Demo at https://hoffman-andrews.com/rust/move-search/std/?search=foo
2021-04-17 22:31:32 +02:00
Dylan DPC
5dae27a8da
Rollup merge of #83237 - notriddle:short-links, r=jyn514
rustdoc: use more precise relative URLs

This is a fairly large diff, and will probably conflict with https://github.com/rust-lang/rust/pull/82815 since it reduces (but does not eliminate) the use of the old depth variable.

Instead of using a depth counter and adding "../" to get to the top, this commit makes rustdoc actually compare the path of what it's linking from to the path that it's linking to. This makes the resulting HTML shorter.

Here's a comparison of one of the largest (non-source) files in the Rust standard library docs (about 4% improvement before gzipping).

    $ wc -c struct.Wrapping.old.html struct.Wrapping.new.html
    2387389 struct.Wrapping.old.html
    2298538 struct.Wrapping.new.html

Most if it can be efficiently gzipped away.

    $ wc -c struct.Wrapping.old.html.gz struct.Wrapping.new.html.gz
    70679 struct.Wrapping.old.html.gz
    70050 struct.Wrapping.new.html.gz

But it also makes a difference in the final DOM size, reducing it from 91MiB to 82MiB.
2021-04-17 22:31:31 +02:00
Joshua Nelson
59546efaa3 rustdoc: Give a more accurate span for anchor failures 2021-04-17 16:03:03 -04:00
bors
bd9949b8e6 Auto merge of #84270 - nagisa:nagisa/bump-llvm, r=cuviper
Include a backport for wrong DWARF information

A partial fix for #83139

r? `@cuviper` or `@nikic`
2021-04-17 18:10:41 +00:00