Commit graph

151352 commits

Author SHA1 Message Date
Guillaume Gomez
e5c24ba400 Clean up rustdoc static files 2021-07-07 17:52:18 +02:00
Justus K
27b55e636f
Document rustdoc with --document-private-items 2021-07-07 16:52:30 +02:00
bjorn3
2977dff116 Remove a sorting operation from used_crates 2021-07-07 15:32:51 +02:00
Mara Bos
10d6b34d32 Add generic types to prelude collision lint test. 2021-07-07 13:26:38 +00:00
Mara Bos
f77dd5ac93 Add test for trait check in prelude collision lint. 2021-07-07 13:26:38 +00:00
Mara Bos
60535441c8 Check FromIterator trait impl in prelude collision check. 2021-07-07 13:26:38 +00:00
Ryan Levick
04a9c10fc2 Fix ICE when misplaced visibility cannot be properly parsed 2021-07-07 15:02:20 +02:00
Ryan Levick
7515bcf01a Change linked tracking issue for more qualified paths 2021-07-07 14:56:51 +02:00
Trevor Spiteri
ed76c11202 special case for integer log10 2021-07-07 14:10:05 +02:00
Trevor Spiteri
b0f98c60a6 test integer log10 values close to all powers of 10 2021-07-07 14:07:32 +02:00
Guillaume Gomez
74d71c204f Only show restricted pub use 2021-07-07 13:47:28 +02:00
EFanZh
2b2bcf11ab Ignore Android debugger pretty-printing tests 2021-07-07 18:46:24 +08:00
bjorn3
00b2f56bc6 Add memchr to list of permitted cg_clif deps
Object started depending on it
2021-07-07 11:39:29 +02:00
Guillaume Gomez
e7bc2a012a Add tests for reexports (both public and private) 2021-07-07 11:30:08 +02:00
Guillaume Gomez
cc0932641a Fix inconsistency on visibility display for typedefs 2021-07-07 11:30:08 +02:00
Guillaume Gomez
e948e8de79 Fix reexports visibility 2021-07-07 11:30:08 +02:00
Guillaume Gomez
84f259e44c Unify macro source display 2021-07-07 11:30:08 +02:00
Guillaume Gomez
c70250dfbd Add test for reexported macros 2.0 rendering 2021-07-07 11:30:08 +02:00
Guillaume Gomez
d1ad40eac4 Fix rendering of reexported macros 2.0 2021-07-07 11:30:08 +02:00
bjorn3
d531f3d6ee Merge commit '3a31c6d8272c14388a34622193baf553636fe470' into sync_cg_clif-2021-07-07 2021-07-07 11:14:20 +02:00
bjorn3
3a31c6d827 Rustup to rustc 1.55.0-nightly (885399992 2021-07-06) 2021-07-07 11:08:52 +02:00
bjorn3
97c2fa1f9d Update regex crates
This removes two dependencies of rustbuild
2021-07-07 11:07:25 +02:00
inquisitivecrystal
0db66e568c Add self to mailmap 2021-07-07 01:33:25 -07:00
bors
c5e344f774 Auto merge of #86920 - JohnTitor:rollup-buvzpkr, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #80918 (Add Integer::log variants)
 - #86717 (Rename some Rust 2021 lints to better names )
 - #86819 (Clean up rustdoc IDs)
 - #86880 (Test ManuallyDrop::clone_from.)
 - #86906 (Replace deprecated compare_and_swap and fix typo in core::sync::atomic::{fence, compiler_fence} docs)
 - #86907 (Migrate `cpu-usage-over-time.py` to Python 3)
 - #86916 (rewrote documentation for thread::yield_now())
 - #86919 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-07 03:31:23 +00:00
Yuki Okushi
51968854f4
Rollup merge of #86919 - ehuss:update-books, r=ehuss
Update books

## nomicon

8 commits in b9ca313e687c991223e23e5520529815dc281205..7a13537f96af4b9b8e3ea296d6e5c3c7ab72ce9f
2021-06-22 12:02:20 -0400 to 2021-07-05 23:34:47 -0400
- Apply review comments
- Fix some style issues
- Move the list of coercions to the reference
- Add an example that shows the null-pointer opt does not happen
- Remove casting list from the nomicon (rust-lang-nursery/nomicon#287)
- Audit `ignore` annotations (rust-lang-nursery/nomicon#288)
- rename typo "lifetime" to "reference" (rust-lang-nursery/nomicon#286)
- Add an incomplete warning to the top page (rust-lang-nursery/nomicon#274)

## reference

7 commits in d9699fa8f3186440fdaadd703d63d8d42322c176..ab60513a3a5a0591e237fddff5d027a982648392
2021-06-21 12:23:10 -0700 to 2021-07-05 08:27:31 -0700
- fix grammar in Expressions (rust-lang-nursery/reference#1057)
- fix comment in function parameter drop scope example (rust-lang-nursery/reference#1056)
- fix typo in macro-ambiguity.md (rust-lang-nursery/reference#1058)
- Mention (negative) infinity values on float-to-int casting (rust-lang-nursery/reference#1054)
-  (rust-lang-nursery/reference#841)
- Missing TypeParamBounds in TypeAlias (rust-lang-nursery/reference#1036)
- Be more precise about array offset in type layouts (rust-lang-nursery/reference#1034)

## book

34 commits in 55a26488ddefc8433e73a2e8352d70f7a5c7fc2b..a90f07f1e9a7fc75dc9105a6c6f16d5c13edceb0
2021-05-09 12:03:18 -0500 to 2021-07-05 14:43:12 -0400
- Clarify ?Sized syntax. Fixes rust-lang/book#2422.
- Add some notes that macros are different than functions
- Break up a long sentence. Fixes rust-lang/book#2329.
- Further clarify and make consistent the reference to deref coercion
- Update ch04-03-slices.md
- add usage for `String` reference
- Update ch15-02-deref.md (rust-lang/book#2780)
- Remove claim about performance of i32
- Reword to avoid awkward pluralization
- Make the link to the reference relative
- Merge remote-tracking branch 'origin/pr/2753'
- Reword number of library crates a package contains (rust-lang/book#2750)
- Clarify explanation of why you can test private functions; add link
- Merge remote-tracking branch 'origin/pr/2743'
- Fix code hiding that I broke in eb60fedc9
- Link to the exact later section we're talking about
- improve cross-references for newtype pattern
- ch12-05, listing 12-20: Add missing "does not compile" warning (rust-lang/book#2731)
- cargo format
- Merge remote-tracking branch 'origin/pr/2724'
- Remove ordinal numbers and only refer to indexes to avoid confusion
- Let's mention the former and current authors of tlborm.
- Update tlborm link to point to Veykril's up-to-date version (rust-lang/book#2722)
- Merge remote-tracking branch 'origin/pr/2720'
- Describe the ferris pictures in the alt text
- Merge remote-tracking branch 'origin/pr/2707'
- Reword ... explanation to include the word deprecated, list that first
- Precise that the `...` inclusive range pattern has been replaces (rust-lang/book#2714)
-  (rust-lang/book#2696)
- fix typo: missing "type" after generic (rust-lang/book#2777)
-  (rust-lang/book#2709)
- Remove sentence about how Rust used to be
- Fix a potentially confusing statement about static lifetimes of static variables. (rust-lang/book#2692)
- Replace 'which'. (rust-lang/book#2663)

## rust-by-example

2 commits in 805e016c5792ad2adabb66e348233067d5ea9f10..028f93a61500fe8f746ee7cc6b204ea6c9f42935
2021-05-20 17:08:34 -0300 to 2021-07-06 06:28:53 -0300
- Fix a couple of typos in the `integration_testing.md` file (rust-lang/rust-by-example#1448)
- Fix Structures type list (rust-lang/rust-by-example#1446)

## rustc-dev-guide

13 commits in fe34beddb41dea5cb891032512a8d5b842b99696..60e282559104035985331645907c3d9f842312c5
2021-06-21 21:50:12 +0200 to 2021-07-05 11:21:03 -0400
- Fixed typos in inline code
- Document lang items (rust-lang/rustc-dev-guide#1119)
- More specifics on what future-incompatible lints are used for
- Fix line lens
- Update information on lints particularly on future-incompatible
- Update section of lint store
- Update around half of the January 2021 date references (rust-lang/rustc-dev-guide#1155)
- Create issues for many TODOs (rust-lang/rustc-dev-guide#1163)
- Links from rustc-dev-guide to std-dev-guide (rust-lang/rustc-dev-guide#1152)
- Document how to mark features as incomplete (rust-lang/rustc-dev-guide#1151)
- Remove requests or suggestions about rebase and fixup contradictory to rust-highfive bot comment (rust-lang/rustc-dev-guide#1111)
- Generate glossary table correctly (rust-lang/rustc-dev-guide#1146)
- Correct the wrong serial number (rust-lang/rustc-dev-guide#1147)

## edition-guide

3 commits in c74b2a0d6bf55774cf15d69f05dfe05408b8f81a..5d57b3832f8d308a9f478ce0a69799548f27ad4d
2021-06-14 10:48:27 -0700 to 2021-07-05 10:33:32 +0200
- Add more info for warnings promoted to errors (rust-lang-nursery/edition-guide#247)
- Create triagebot.toml
- Clarify snippets in 2021 panic docs. (rust-lang-nursery/edition-guide#245)

## embedded-book

1 commits in cbec77fbd8eea0c13e390dd9eded1ae200e811d1..506840eb73b0749336e1d5274e16d6393892ee82
2021-06-10 06:26:32 +0000 to 2021-06-24 00:01:32 +0000
- Update book to track quickstart changes  (rust-embedded/book#296)
2021-07-07 12:17:45 +09:00
Yuki Okushi
9aee3c2883
Rollup merge of #86916 - godmar:@godmar/thread-yield-documentation-fix, r=joshtriplett
rewrote documentation for thread::yield_now()

The old documentation suggested the use of yield_now for repeated
polling instead of discouraging it; it also made the false claim that
channels are implemented using yield_now. (They are not, except for
a corner case).
2021-07-07 12:17:44 +09:00
Yuki Okushi
7be29c1627
Rollup merge of #86907 - pietroalbini:ci-cpu-stats-python3, r=Mark-Simulacrum
Migrate `cpu-usage-over-time.py` to Python 3

The only change here is a fix for `sys.platform` on Linux. Python 3.3 changed the API to return `"linux"` instead of `"linux2"`/`"linux3"`, so this PR uses `.startswith("linux")` to make the code work on Python 3 without breaking Python 2.
2021-07-07 12:17:43 +09:00
Yuki Okushi
fe3d6a74d9
Rollup merge of #86906 - juniorbassani:update-sync-docs, r=yaahc
Replace deprecated compare_and_swap and fix typo in core::sync::atomic::{fence, compiler_fence} docs
2021-07-07 12:17:42 +09:00
Yuki Okushi
c630b6b0fc
Rollup merge of #86880 - m-ou-se:test-manuallydrop-clone-from, r=Mark-Simulacrum
Test ManuallyDrop::clone_from.

See #86288
2021-07-07 12:17:41 +09:00
Yuki Okushi
cbb40cd0f2
Rollup merge of #86819 - GuillaumeGomez:cleanup-rustdoc-ids, r=jyn514
Clean up rustdoc IDs

I cherry-picked the commit from https://github.com/rust-lang/rust/pull/86178. It adds missing rustdoc IDs (for the HTML) and remove unused ones.

cc `@camelid`

r? `@jyn514`
2021-07-07 12:17:40 +09:00
Yuki Okushi
7e95290caa
Rollup merge of #86717 - rylev:rename, r=nikomatsakis
Rename some Rust 2021 lints to better names

Based on conversation in https://github.com/rust-lang/rust/issues/85894.

Rename a bunch of Rust 2021 related lints:

Lints that are officially renamed because they are already in beta or stable:
* `disjoint_capture_migration` => `rust_2021_incompatible_closure_captures`
* `or_patterns_back_compat` => `rust_2021_incompatible_or_patterns`
* `non_fmt_panic` => `non_fmt_panics`

Lints that are renamed but don't require any back -compat work since they aren't yet in stable:
* `future_prelude_collision` => `rust_2021_prelude_collisions`
* `reserved_prefix` => `rust_2021_token_prefixes`

Lints that have been discussed but that I did not rename:
* ~`non_fmt_panic` and `bare_trait_object`: is making this plural worth the headache we might cause users?~
* `array_into_iter`: I'm unsure of a good name and whether bothering users with a name change is worth it.

r? `@nikomatsakis`
2021-07-07 12:17:39 +09:00
Yuki Okushi
9bbc470e97
Rollup merge of #80918 - yoshuawuyts:int-log2, r=m-ou-se
Add Integer::log variants

_This is another attempt at landing https://github.com/rust-lang/rust/pull/70835, which was approved by the libs team but failed on Android tests through Bors. The text copied here is from the original issue. The only change made so far is the addition of non-`checked_` variants of the log methods._

_Tracking issue: #70887_

---

This implements `{log,log2,log10}` methods for all integer types. The implementation was provided by `@substack` for use in the stdlib.

_Note: I'm not big on math, so this PR is a best effort written with limited knowledge. It's likely I'll be getting things wrong, but happy to learn and correct. Please bare with me._

## Motivation
Calculating the logarithm of a number is a generally useful operation. Currently the stdlib only provides implementations for floats, which means that if we want to calculate the logarithm for an integer we have to cast it to a float and then back to an int.

> would be nice if there was an integer log2 instead of having to either use the f32 version or leading_zeros() which i have to verify the results of every time to be sure

_— [`@substack,` 2020-03-08](https://twitter.com/substack/status/1236445105197727744)_

At higher numbers converting from an integer to a float we also risk overflows. This means that Rust currently only provides log operations for a limited set of integers.

The process of doing log operations by converting between floats and integers is also prone to rounding errors. In the following example we're trying to calculate `base10` for an integer. We might try and calculate the `base2` for the values, and attempt [a base swap](https://www.rapidtables.com/math/algebra/Logarithm.html#log-rules) to arrive at `base10`. However because we're performing intermediate rounding we arrive at the wrong result:

```rust
// log10(900) = ~2.95 = 2
dbg!(900f32.log10() as u64);

// log base change rule: logb(x) = logc(x) / logc(b)
// log2(900) / log2(10) = 9/3 = 3
dbg!((900f32.log2() as u64) / (10f32.log2() as u64));
```
_[playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6bd6c68b3539e400f9ca4fdc6fc2eed0)_

This is somewhat nuanced as a lot of the time it'll work well, but in real world code this could lead to some hard to track bugs. By providing correct log implementations directly on integers we can help prevent errors around this.

## Implementation notes

I checked whether LLVM intrinsics existed before implementing this, and none exist yet. ~~Also I couldn't really find a better way to write the `ilog` function. One option would be to make it a private method on the number, but I didn't see any precedent for that. I also didn't know where to best place the tests, so I added them to the bottom of the file. Even though they might seem like quite a lot they take no time to execute.~~

## References

- [Log rules](https://www.rapidtables.com/math/algebra/Logarithm.html#log-rules)
- [Rounding error playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6bd6c68b3539e400f9ca4fdc6fc2eed0)
- [substack's tweet asking about integer log2 in the stdlib](https://twitter.com/substack/status/1236445105197727744)
- [Integer Logarithm, A. Jaffer 2008](https://people.csail.mit.edu/jaffer/III/ilog.pdf)
2021-07-07 12:17:32 +09:00
bors
c0bd5a584d Auto merge of #86901 - sexxi-goose:query_remove, r=nikomatsakis
Make type_implements_trait not a query

r? `@nikomatsakis`
2021-07-07 01:03:41 +00:00
Niko Matsakis
38dcae2cda
Apply suggestions from code review 2021-07-06 20:52:53 -04:00
Eric Holk
8b4f538320 Unify lint tool and lint name checking
This shares a little more code between checking command line and
attribute lint specifications.
2021-07-06 17:19:20 -07:00
Eric Huss
1b4704d200 Update books 2021-07-06 17:07:35 -07:00
Eric Holk
1e0db4cfed Parse tool name for command line lint options 2021-07-06 15:50:10 -07:00
Eric Holk
65b28a987b Add ui test for command line lints with tool names
This adds a ui test to make sure rustc accepts lint arguments such as
`-A clippy::foo` when clippy is disabled.
2021-07-06 15:49:47 -07:00
bors
b20e3ff2af Auto merge of #86911 - bjorn3:crate_info_refactor, r=petrochenkov
Refactor linker code

This merges `LinkerInfo` into `CrateInfo` as there is no reason to keep them separate. `LinkerInfo::to_linker` is merged into `get_linker` as both have different logic for each linker type and `to_linker` is directly called after `get_linker`. Also contains a couple of small cleanups.

See the individual commits for all changes.
2021-07-06 22:20:43 +00:00
Michael Howell
a151982af3 Add doc comment for impl From<LayoutError> for TryReserveError 2021-07-06 14:44:18 -07:00
Aman Arora
1bcbc18e3d Fix depnode size 2021-07-06 15:55:13 -04:00
Godmar Back
fb464a3b39 rewrote documentation for thread::yield_now()
The old documentation suggested the use of yield_now for repeated
polling instead of discouraging it; it also made the false claim that
channels are implementing using yield_now. (They are not, except for
a corner case).
2021-07-06 15:50:42 -04:00
bors
885399992c Auto merge of #86636 - wesleywiser:misc_enum_improvements, r=michaelwoerister
[msvc] Consistently show active variant and fix visualization for single variant enums

Prior to this change, there were a few cases where inspecting an enum in either WinDbg or Visual Studio would not show the active variant name. After these changes, we now consistently show the active variant name as `[variant]` in the debugger.

We also didn't handle single variant enums very well. That is now also resolved.

Before:
![image](https://user-images.githubusercontent.com/831192/123480097-dc8b5f00-d5cf-11eb-93a8-9fc05a97029b.png)

After:
![image](https://user-images.githubusercontent.com/831192/123479966-aa79fd00-d5cf-11eb-955e-9798616a8829.png)

r? `@michaelwoerister`
2021-07-06 19:31:24 +00:00
Aman Arora
8ef5212eff Make type_implements_trait not a query 2021-07-06 14:38:10 -04:00
Ryan Levick
d4e384bc1d rename rust_2021_token_prefixes to rust_2021_prefixes_incompatible_syntax 2021-07-06 20:13:36 +02:00
Ryan Levick
941eb2adbd Rename future_prelude_collisions to rust_2021_prelude_collisions 2021-07-06 20:13:17 +02:00
Ryan Levick
81c11a212e rust_2021_token_prefixes 2021-07-06 20:13:16 +02:00
Ryan Levick
a902e25f58 Add s to non_fmt_panic 2021-07-06 20:12:56 +02:00
Ryan Levick
4e5b78fdcf Allow lint names to have ascii numbers 2021-07-06 20:12:55 +02:00
Ryan Levick
3a45bb919c Fix mis-styled code 2021-07-06 20:12:55 +02:00