Commit Graph

148507 Commits

Author SHA1 Message Date
Yuki Okushi
e27f20a9a2
Rollup merge of #85196 - richkadel:reverts-cover-unreachable-statements, r=tmandry
Revert "Auto merge of #84797 - richkadel:cover-unreachable-statements…

This reverts commit e5f83d24ae, reversing
changes made to ac888e8675.

See https://github.com/rust-lang/rust/pull/84797#issuecomment-839068132

r? `@tmandry`
2021-05-12 07:18:06 +09:00
Yuki Okushi
8f3c2cce36
Rollup merge of #85191 - GuillaumeGomez:improve-rustdoc-gui-tester, r=Mark-Simulacrum
Improve rustdoc gui tester

I cherry-picked the commit from https://github.com/rust-lang/rust/pull/84834 (and modified it a bit). I also used this opportunity to update it to last version (forgot to update GUI test in https://github.com/rust-lang/rust/pull/85074, really can't wait to make https://github.com/rust-lang/rust/pull/84586 finally work).

cc `@Mark-Simulacrum` for the changes in bootstrap.

r? `@jsha`
2021-05-12 07:18:05 +09:00
Yuki Okushi
c4c654f422
Rollup merge of #85187 - FabianWolff:issue-84976, r=jackh726
Use .name_str() to format primitive types in error messages

This pull request fixes #84976. The problem described there is caused by this code
506e75cbf8/compiler/rustc_middle/src/ty/error.rs (L161-L166)
using `Debug` formatting (`{:?}`), while the proper solution is to call `name_str()` of `ty::IntTy`, `ty::UintTy` and `ty::FloatTy`, respectively.
2021-05-12 07:18:04 +09:00
Yuki Okushi
9ad5c4d8ea
Rollup merge of #85162 - LingMan:patch-1, r=varkor
Fix typo in variable name

All other sibling functions call this variable "slot", so "slote" was most likely a typo.
2021-05-12 07:18:03 +09:00
Yuki Okushi
6ec4f91610
Rollup merge of #85136 - shirshak55:master, r=dtolnay
Change param name (k to key and v to value) in std::env module

1. When I was reading code the ide displayed `k` and `v`, so I
thought it would be better to show key and value?

2. I noticed var method already uses `key` instead of `k` so it
is more consistent to use `key` instead of `k`?

Thanks
2021-05-12 07:18:02 +09:00
Yuki Okushi
4ab305031c
Rollup merge of #85124 - jsha:trust-the-bool, r=GuillaumeGomez
rustdoc: remove explicit boolean comparisons.

For boolean variables it's shorter and more readable to check the value directly, or negate it with `!`.

In a couple of cases I reordered an if/else pair because it made the initial `if` statement simpler.

An example of a style guide recommending this: https://airbnb.io/javascript/#comparison--shortcuts

r? `@GuillaumeGomez`
2021-05-12 07:18:01 +09:00
Yuki Okushi
649b385471
Rollup merge of #85018 - hi-rustin:rustin-patch-84637, r=estebank
shrinking the deprecated method span

close https://github.com/rust-lang/rust/issues/84637
2021-05-12 07:18:00 +09:00
Yuki Okushi
40be1d3152
Rollup merge of #83501 - camelid:rustdoc-layout, r=jyn514,GuillaumeGomez
rustdoc: Add unstable CLI option to show basic type layout information

Closes #75988.

Right now it just shows the size.
2021-05-12 07:17:59 +09:00
Jacob Hoffman-Andrews
09454513d1 Move global click handlers to per-element ones.
In rustdoc's main.js, we had an onclick handler for the whole document
that would dispatch to handlers for various elements. This change
attaches the handlers to the elements that trigger them, instead.
This simplfies the code and avoids reimplementing the browser's bubbling
functionality.

As part of this change, change from a class to an id for help button.

Move the handlers and associated code for highlighting source lines into
source-script.js (and factor out a shared regex).
2021-05-11 13:45:08 -07:00
Fabian Wolff
69a4ae2030 Add explanatory comment to the issue-84976.rs test case 2021-05-11 21:51:58 +02:00
Rich Kadel
bea112ba07 Revert "Auto merge of #84797 - richkadel:cover-unreachable-statements, r=tmandry"
This reverts commit e5f83d24ae, reversing
changes made to ac888e8675.
2021-05-11 12:47:08 -07:00
Mark Rousskov
e400595190 Store VariantIdx to distinguish enum variants
This saves ~24% of the instructions on the match-stress-enum benchmark.
2021-05-11 15:44:56 -04:00
bors
5c02926546 Auto merge of #84904 - ssomers:btree_drop_kv_in_place, r=Mark-Simulacrum
BTree: no longer copy keys and values before dropping them

When dropping BTreeMap or BTreeSet instances, keys-value pairs are up to now each copied and then dropped, at least according to source code. This is because the code for dropping and for iterators is shared.

This PR postpones the treatment of doomed key-value pairs from the intermediate functions `deallocating_next`(`_back`) to the last minute, so the we can drop the keys and values in place. According to the library/alloc benchmarks, this does make a difference, (and a positive difference with an `#[inline]` on `drop_key_val`). It does not change anything for #81444 though.

r? `@Mark-Simulacrum`
2021-05-11 19:36:54 +00:00
klensy
73b39c84a7 fix tidy 2021-05-11 22:25:10 +03:00
Guillaume Gomez
6b9499085b Make rustdoc-gui test suite able to run with different sub directories 2021-05-11 21:14:40 +02:00
klensy
dcdc308641 updated deps 2021-05-11 22:03:59 +03:00
Guillaume Gomez
1b0976c42f Update toggle-docs GUI test to last version 2021-05-11 20:56:16 +02:00
Guillaume Gomez
d5a24b0a33 Move rustdoc-gui rust libraries into their own folder and prepare the field for more libraries 2021-05-11 20:56:16 +02:00
LeSeulArtichaut
985fb4caa0 Add helper for switching safety contexts 2021-05-11 20:35:44 +02:00
LeSeulArtichaut
d5ea294114 Test -Zthir-unsafeck for unused unsafe blocks 2021-05-11 20:35:44 +02:00
LeSeulArtichaut
a95b342f02 Test -Zthir-unsafeck for unsafe function calls 2021-05-11 20:35:38 +02:00
Roxane
564b4de626 use the correct attributes and add helper function 2021-05-11 14:01:33 -04:00
Jacob Hoffman-Andrews
f510e412e9 rustdoc: remove explicit boolean comparisons.
For boolean variables it's shorter and more readable to check the value
directly, or negate it with `!`.

In a couple of cases I reordered an if/else pair because it made the
initial `if` statement simpler.

Removed unused isType parameter from two functions.
2021-05-11 10:50:09 -07:00
Camelid
d43701caa0 Disable layout docs for type aliases for now
There are issues with computing layout for type aliases; see #85103.
Once the issues are fixed, we should re-enable layout docs for them.
2021-05-11 10:19:46 -07:00
Camelid
9b89d01bbb Enable --show-type-layout for the rustdoc API docs 2021-05-11 09:55:32 -07:00
Camelid
8b9298bbaa Add note to docs when layout cannot be computed
This should prevent confusion about why generic types don't have layout
docs.
2021-05-11 09:55:32 -07:00
Camelid
879a914eea Add test case for zero-sized types 2021-05-11 09:55:31 -07:00
Camelid
61a8479472 Make test more specific 2021-05-11 09:55:31 -07:00
Camelid
bcbc727672 Apply suggestions from code review
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-05-11 09:55:31 -07:00
Camelid
8048c70568 Add tcx local variable 2021-05-11 09:55:31 -07:00
Camelid
db3a06d01e Fix a few small things 2021-05-11 09:55:31 -07:00
Camelid
9615d6dd48 Enable --show-type-layout for the rustc API docs 2021-05-11 09:55:31 -07:00
Camelid
12ee920a7c Only show type layout info if --show-type-layout is passed 2021-05-11 09:55:31 -07:00
Camelid
48da66f28f Show memory layout for type aliases
At first you might think "why not just click through to the aliased
type?", but if a type alias instantiates all of the generic parameters
of the aliased type, then it can show layout info even though the
aliased type cannot (because we can't compute the layout of a generic
type). So I think it's still useful to show layout info for type
aliases.
2021-05-11 09:55:31 -07:00
Camelid
9859e2b01d Add test for memory layout information 2021-05-11 09:55:31 -07:00
Camelid
20b30acfa8 Include a warning in the layout docs that layout is unstable 2021-05-11 09:55:31 -07:00
Camelid
5859c5d333 Remove FIXME
Layout errors can occur with valid code, e.g. generic types.
2021-05-11 09:55:31 -07:00
Camelid
001f0dd5a1 rustdoc: Show basic type layout information
Right now it just shows the size.
2021-05-11 09:55:31 -07:00
bors
ba8d7e2cb7 Auto merge of #82272 - b-naber:gat_diag, r=estebank,jackh726
Improve diagnostics for GATs

Fixes https://github.com/rust-lang/rust/issues/81801
Fixes https://github.com/rust-lang/rust/issues/81961
Fixes https://github.com/rust-lang/rust/issues/81862

r? `@estebank`
2021-05-11 16:49:08 +00:00
Fabian Wolff
f740923b8c Use .name_str() to format primitive types in error messages 2021-05-11 18:12:36 +02:00
bors
2bafe96272 Auto merge of #85023 - RalfJung:array-to-raw-elem, r=Mark-Simulacrum
array-to-raw-elem cast: test that Retag covers entire array

Make sure that we `Retag` *before* doing the `ArrayToPointer` cast.
2021-05-11 14:08:06 +00:00
LeSeulArtichaut
29780f43e2 Introduce the (WIP) THIR unsafety checker 2021-05-11 15:33:00 +02:00
LeSeulArtichaut
d956122f7e [WIP] Create a Visitor for the THIR 2021-05-11 15:33:00 +02:00
b-naber
e4d9bc66f6 improve diagnosts for GATs 2021-05-11 14:09:46 +02:00
Trevor Spiteri
a381e29117 add BITS associated constant to core::num::Wrapping
This keeps `Wrapping` synchronized with the primitives it wraps as for
the #32463 `wrapping_int_impl` feature.
2021-05-11 13:36:43 +02:00
bors
506e75cbf8 Auto merge of #85109 - RalfJung:remove-const_fn, r=oli-obk
remove const_fn feature gate

Fixes https://github.com/rust-lang/rust/issues/84510
r? `@oli-obk`
2021-05-11 10:25:14 +00:00
Guillaume Gomez
e55283ab8e Fix border radius for doc code blocks in rustdoc 2021-05-11 11:16:14 +02:00
Ralf Jung
74918b753f fix clippy test 2021-05-11 11:15:33 +02:00
bors
382f748f23 Auto merge of #85100 - HKalbasi:issue-68049-fix, r=Aaron1011
Fix invalid suggestion of changing impl trait signature

Fix #68049
2021-05-11 07:44:16 +00:00
bors
fe62c6e295 Auto merge of #80300 - LeSeulArtichaut:80275-doc-inline, r=Manishearth
Emit errors/warns on some wrong uses of rustdoc attributes

This PR adds a few diagnostics:
- error if conflicting `#[doc(inline)]`/`#[doc(no_inline)]` are found
- introduce the `invalid_doc_attributes` lint (warn-by-default) which triggers:
  - if a crate-level attribute is used on a non-`crate` item
  - if `#[doc(inline)]`/`#[doc(no_inline)]` is used on a non-`use` item

The code could probably be improved but I wanted to get feedback first. Also, some of those changes could be considered breaking changes, so I don't know what the procedure would be? ~~And finally, for the warnings, they are currently hard warnings, maybe it would be better to introduce a lint?~~ (EDIT: introduced the `invalid_doc_attributes` lint)

Closes #80275.
r? `@jyn514`
2021-05-11 05:03:18 +00:00