Commit graph

157500 commits

Author SHA1 Message Date
Guillaume Gomez
ec83b95ab9
Rollup merge of #90156 - jsha:less-border-bottom-2, r=GuillaumeGomez
Remove underlines from non-top docblocks.

We still had a number of places where underlined section headings would
show up, like under Implementations.

Follow-up to #89506 (thanks `@yaymukund!)` and #90036. Related to #59829.

r? `@camelid`

Demo:

[Before](https://doc.rust-lang.org/nightly/std/string/struct.String.html#trait-implementations):

[![image](https://user-images.githubusercontent.com/220205/138402555-b0c0a3ea-ff50-4aad-bb74-6f9e57323807.png)](https://jacob.hoffman-andrews.com/rust/less-border-bottom-2/std/string/struct.String.html#trait-implementations)

[After](https://jacob.hoffman-andrews.com/rust/less-border-bottom-2/std/string/struct.String.html#trait-implementations):

[![image](https://user-images.githubusercontent.com/220205/138402669-d0835bd9-8813-4f0c-8697-f86e9759acec.png)](https://jacob.hoffman-andrews.com/rust/less-border-bottom-2/std/string/struct.String.html#trait-implementations)
2021-10-30 20:30:25 +02:00
Noah Lev
a58e214894 rustdoc: Stop sorting external crates
Now that #73423 is fixed, sorting should no longer be necessary.
See also this discussion [1].

[1]: https://github.com/rust-lang/rust/pull/86889#discussion_r664134963
2021-10-30 11:16:26 -07:00
Noah Lev
ebe9a11f71 rustdoc: Remove Crate.name and instead compute it on-demand
It is not as large as `Crate.src` was, but it's still 8 bytes, and
`clean::Crate` is moved by-value a lot.
2021-10-30 11:16:24 -07:00
Noah Lev
85f8ae8ec4 rustdoc: Remove Crate.src and instead compute it on-demand
It is only used in one place; `src` was about a third of `Crate`'s total
size; `Crate` is frequently moved by-value; and `src` can be easily
computed on-demand.
2021-10-30 11:16:00 -07:00
Noah Lev
47b0059dba rustdoc: Document that Crate is always local 2021-10-30 11:15:21 -07:00
Thom Chiovoloni
d429d0df33
Replace std::os::raw::c_ssize_t with std::os::raw::c_ptrdiff_t 2021-10-30 10:54:34 -07:00
Gary Guo
94e940dd30 Collect panic/panic_bounds_check during monomorphization 2021-10-30 18:21:44 +01:00
bors
2609fab8e4 Auto merge of #90205 - mati865:link-modifiers-in-rustc, r=petrochenkov
Repace use of `static_nobundle` with `native_link_modifiers` within Rust codebase

This fixes warnings when building Rust and running tests:
```
warning: library kind `static-nobundle` has been superseded by specifying `-bundle` on library kind `static`. Try `static:-bundle`
warning: `rustc_llvm` (lib) generated 2 warnings (1 duplicate)
```
2021-10-30 16:22:49 +00:00
Jacob Hoffman-Andrews
a65c98fefb Remove underlines from non-top docblocks.
We still had a number of places where underlined section headings would
show up, like under Implementations.
2021-10-30 09:22:28 -07:00
Guillaume Gomez
78b604569b Document tests a bit more 2021-10-30 16:30:14 +02:00
lcnr
b40aa64e48 stabilize relaxed_struct_unsize 2021-10-30 15:56:02 +02:00
bors
310ecb0a5c Auto merge of #7899 - mikerite:fullint-20211030, r=xFrednet
Refactoring `FullInt`

Refactoring `FullInt`

changelog: None
2021-10-30 13:29:56 +00:00
bors
9f13083542 Auto merge of #90416 - matthiaskrgr:rollup-55lzqng, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #89876 (Make most std::ops traits const on numeric types)
 - #90371 (Fix incorrect doc link)
 - #90374 (Unify titles in rustdoc book doc attributes chapter)
 - #90377 (Make `core::slice::from_raw_parts[_mut]` const)
 - #90395 (Restrict liveness of mutable borrow of inner infcx in ConstInferUnifier::consts)
 - #90396 (Prevent type flags assertions being thrown in default_anon_const_substs if errors occurred)
 - #90402 (Add a few query descriptions)
 - #90412 (Remove unnecessary `macro_use`s in rustdoc)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-30 13:06:51 +00:00
Andre Bogus
a4ede72b3d update most tests to 2021 edition 2021-10-30 14:50:53 +02:00
Matthias Krüger
19b5b0f8fb
Rollup merge of #90412 - jyn514:macro-use, r=camelid
Remove unnecessary `macro_use`s in rustdoc
2021-10-30 14:37:04 +02:00
Matthias Krüger
f9111e0336
Rollup merge of #90402 - wesleywiser:query_descriptions, r=oli-obk
Add a few query descriptions
2021-10-30 14:37:04 +02:00
Matthias Krüger
d99dc7abfa
Rollup merge of #90396 - b-naber:type_flags_ices_default_anon_consts, r=lcnr
Prevent type flags assertions being thrown in default_anon_const_substs if errors occurred

Fixes https://github.com/rust-lang/rust/issues/90364
Fixes https://github.com/rust-lang/rust/issues/88997

r? ``@lcnr``
2021-10-30 14:37:03 +02:00
Matthias Krüger
88e0bea7ca
Rollup merge of #90395 - b-naber:const-expr-type-relation, r=oli-obk
Restrict liveness of mutable borrow of inner infcx in ConstInferUnifier::consts

Fixes https://github.com/rust-lang/rust/issues/89304

r? ``@oli-obk``
2021-10-30 14:37:02 +02:00
Matthias Krüger
b531364a1a
Rollup merge of #90377 - WaffleLapkin:const_slice_from_raw_parts, r=oli-obk
Make `core::slice::from_raw_parts[_mut]` const

Responses to #90012 seem to allow ``@rust-lang/wg-const-eval`` to decide on use of `const_eval_select`, so we can make `core::slice::from_raw_parts[_mut]` const :)

---
This PR marks the following APIs as const:
```rust
// core::slice
pub const unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T];
pub const unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T];
```
---

Resolves #90011
r? ``@oli-obk``
2021-10-30 14:37:01 +02:00
Matthias Krüger
a213740abe
Rollup merge of #90374 - GuillaumeGomez:unify-rustdoc-book-titles, r=camelid
Unify titles in rustdoc book doc attributes chapter

As discussed in https://github.com/rust-lang/rust/pull/90339.

I wasn't able to find out where the link to the titles was used so let's see if the CI fails. :)

r? ``@camelid``
2021-10-30 14:37:00 +02:00
Matthias Krüger
86087f906d
Rollup merge of #90371 - Veykril:patch-2, r=jyn514
Fix incorrect doc link

Looks like a copy paste mistake
2021-10-30 14:36:59 +02:00
Matthias Krüger
20bb93210d
Rollup merge of #89876 - AlexApps99:const_ops, r=oli-obk
Make most std::ops traits const on numeric types

This PR makes existing implementations of `std::ops` traits (`Add`, `Sub`, etc) [`impl const`](https://github.com/rust-lang/rust/issues/67792) where possible.
This affects:
- All numeric primitives (`u*`, `i*`, `f*`)
- `NonZero*`
- `Wrapping`

This is under the `rustc_const_unstable` feature `const_ops`.
I will write tests once I know what can and can't be kept for the final version of this PR.

Since this is my first PR to rustc (and hopefully one of many), please give me feedback on how to better handle the PR process wherever possible. Thanks

[Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Const.20std.3A.3Aops.20traits.20PR)
2021-10-30 14:36:58 +02:00
bors
2b643e9871 Auto merge of #89174 - ChrisDenton:automatic-verbatim-paths, r=dtolnay
Automatically convert paths to verbatim for filesystem operations that support it

This allows using longer paths without the user needing to `canonicalize` or manually prefix paths. If the path is already verbatim then this has no effect.

Fixes: #32689
2021-10-30 07:21:21 +00:00
Michael Wright
e8c4046841 Simplify FullInt Ord impl
`cmp_s_u` is a tiny helper function only used by `cmp` and isn't useful on
it's own. Making it a nested function of `cmp` makes that clear and as a
bonus it's easier to call and doesn't require a `#[must_use]` attribute.
2021-10-30 06:22:19 +02:00
Michael Wright
4a86156c66 Simplify FullInt Ord impl (2) 2021-10-30 06:22:19 +02:00
Michael Wright
c6dca68eca Simplify FullInt Ord impl 2021-10-30 06:22:19 +02:00
Michael Wright
c8edd9a16e Remove casts from FullInt impl 2021-10-30 06:22:19 +02:00
Michael Wright
665ff57fde Remove expects from FullInt Partial{Ord,Eq} 2021-10-30 06:22:19 +02:00
bors
22f1ad75e9 Auto merge of #88268 - GuillaumeGomez:generics-search-index, r=notriddle,camelid,jyn514
rustdoc: Fix generics generation in search index

The generics were not added to the search index as they should, instead they were added as arguments. I used this opportunity to allow generics to have generics themselves (will come in very handy for my current rewrite of the search engine!).

r? `@jyn514`
2021-10-30 04:12:40 +00:00
Noah Lev
27d47d93be rustdoc: Add static size assertion for clean::Crate 2021-10-29 20:43:27 -07:00
Joshua Nelson
b6851ba3c9 Remove unnecessary macro_uses in rustdoc 2021-10-30 02:22:38 +00:00
bors
021947d37a Auto merge of #90403 - michaelwoerister:odht-0.3.1, r=Mark-Simulacrum
Update odht crate to 0.3.1 (big-endian bugfix)

Update `odht` to 0.3.1 in order to get https://github.com/rust-lang/odht/pull/20 which fixes issue https://github.com/rust-lang/rust/issues/90123.
2021-10-30 01:01:19 +00:00
bors
6d42707cde Auto merge of #90346 - ferrocene:pa-short-circuit, r=oli-obk
Replace some operators in libcore with their short-circuiting equivalents

In libcore there are a few occurrences of bitwise operators used in boolean expressions instead of their short-circuiting equivalents. This makes it harder to perform some kinds of source code analysis over libcore, for example [MC/DC] code coverage (a requirement in safety-critical environments).

This PR aims to remove as many bitwise operators in boolean expressions from libcore as possible, without any performance regression and without other changes. This means not all bitwise operators are removed, only the ones that don't have any difference with their short-circuiting counterparts. This already simplifies achieving MC/DC coverage, and the other functions can be changed in future PRs.

The PR is best reviewed commit-by-commit, and each commit has the resulting assembly in the message.

## Checked integer methods

These methods recently switched to bitwise operators in PRs https://github.com/rust-lang/rust/pull/89459 and https://github.com/rust-lang/rust/pull/89351. I confirmed bitwise operators are needed in most of the functions, except these two:

* `{integer}::checked_div` ([Godbolt link (nightly)](https://rust.godbolt.org/z/17efh5jPc))
* `{integer}::checked_rem` ([Godbolt link (nightly)](https://rust.godbolt.org/z/85qGWc94K))

`@tspiteri` already mentioned this was the case in https://github.com/rust-lang/rust/pull/89459#issuecomment-932728384, but opted to also switch those two to bitwise operators for consistency. As that makes MC/DC analysis harder this PR proposes switching those two back to short-circuiting operators.

## `{unsigned_ints}::carrying_add`

[Godbolt link (1.56.0)](https://rust.godbolt.org/z/vG9vx8x48)

In this instance replacing the `|` with `||` produces the exact same assembly when optimizations are enabled, so switching to the short-circuiting operator shouldn't have any impact.

## `{unsigned_ints}::borrowing_sub`

[Godbolt link (1.56.0)](https://rust.godbolt.org/z/asEfKaGE4)

In this instance replacing the `|` with `||` produces the exact same assembly when optimizations are enabled, so switching to the short-circuiting operator shouldn't have any impact.

## String UTF-8 validation

[Godbolt link (1.56.0)](https://rust.godbolt.org/z/a4rEbTvvx)

In this instance replacing the `|` with `||` produces practically the same assembly, with the two operands for the "or" swapped:

```asm
; Old
mov  rax, qword ptr [rdi + rdx + 8]
or   rax, qword ptr [rdi + rdx]
test rax, r9
je   .LBB0_7

; New
mov  rax, qword ptr [rdi + rdx]
or   rax, qword ptr [rdi + rdx + 8]
test rax, r8
je   .LBB0_7
```

[MC/DC]: https://en.wikipedia.org/wiki/Modified_condition/decision_coverage
2021-10-29 21:50:46 +00:00
Maybe Waffle
afaa54a99d Apply changes proposed in the review 2021-10-29 23:45:09 +03:00
bors
4c70c182c0 Auto merge of #7895 - ahmedkrmn:master, r=Manishearth
Disable "if_not_else" lints from firing on else-ifs

Fixes #7892

1. Convert `['if_not_else']` to `LateLintPass` and use `clippy_utils::is_else_clause` for checking.
2. Update tests.

changelog: [`if_not_else`] now ignores else if statements.
2021-10-29 20:31:51 +00:00
Will Crichton
b8ecc9fefa Fix rare ICE during typeck in rustdoc scrape_examples 2021-10-29 13:21:50 -07:00
Ahmed Karaman
2f327aaba5
Disable "if_not_else" lints firing on else-ifs
1. Convert IfNotElse to LateLintPass and use clippy_utils::is_else_clause for checking.
2. Handle the case where the span comes from desugaring.
3. Update tests.
2021-10-29 22:07:05 +02:00
Andre Bogus
00ea73e162 avoid linting possible_truncation on bit-reducing operations 2021-10-29 21:59:24 +02:00
bors
dbe167daaa Auto merge of #7890 - Alexendoo:ptr-arg-alias, r=camsteffen
Ignore references to type aliases in ptr_arg

Works using the fact that the hir path will point to a TyAlias, rather than being resolved to the underlying type

Fixes #7699

changelog: [`ptr_arg`] No longer lints references to type aliases
2021-10-29 19:45:26 +00:00
Maybe Waffle
878ac10fe1 Use proper issue number for feature(const_slice_from_raw_parts) 2021-10-29 22:45:10 +03:00
Guillaume Gomez
0c70831171 Unify titles in rustdoc book doc attributes chapter 2021-10-29 21:27:44 +02:00
Guillaume Gomez
355e6eddfe Fix invalid handling of generics 2021-10-29 20:54:15 +02:00
bors
e99963c554 Auto merge of #90390 - umanwizard:update-miri, r=RalfJung
Update miri

Fixes https://github.com/rust-lang/rust/issues/90298
2021-10-29 18:41:17 +00:00
Martin Kröning
311a249f9d hermitkernel-target: Set OS to "none"
For our kernel targets, we should not set OS, as the kernel runs bare
metal without a circular dependency on std.

This also prepares us for unifying with
https://github.com/rust-lang/rust/pull/89062. This patch requires
libhermit-rs to change a `cfg`s from `target_os = "hermit"` to `target_os
= "none"`.

I tested this patch locally.
2021-10-29 18:07:36 +02:00
Michael Woerister
6771ac3f19 Update odht crate to 0.3.1 (big-endian bugfix) 2021-10-29 18:05:15 +02:00
bors
deb4572923 Auto merge of #90389 - camelid:rustdoc-rayon, r=jyn514
rustdoc: Switch to mainline rayon

The rustc fork of rayon integrates with Cargo's jobserver to limit the
amount of parallelism. However, rustdoc's use case is concurrent I/O,
which is not CPU-heavy, so it should be able to use mainline rayon.

See [this discussion][1] for more details.

[1]: https://github.com/rust-lang/rust/issues/90227#issuecomment-952468618

Note: I chose rayon 1.3.1 so that the rayon version used elsewhere in
the workspace does not change.

r? `@Mark-Simulacrum`
cc `@jyn514`
2021-10-29 15:31:37 +00:00
Martin Kröning
42cab439f5 hermit: Implement Condvar::wait_timeout 2021-10-29 17:20:03 +02:00
Wesley Wiser
60bf2f1926 Add a few query descriptions 2021-10-29 11:15:45 -04:00
Yuval Dolev
cad2d21cb6 Explicitly skipping suggestions for 'Pin' as it does not implement the 'AsRef' trait 2021-10-29 15:49:55 +03:00
Yuval Dolev
e2151497bf Skip suggestions for the AsRef trait 2021-10-29 15:49:55 +03:00