Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #68011

Merged
merged 28 commits into from
Jan 8, 2020
Merged

Rollup of 10 pull requests #68011

merged 28 commits into from
Jan 8, 2020

Conversation

JohnTitor
Copy link
Member

Successful merges:

Failed merges:

r? @ghost

matklad and others added 28 commits January 2, 2020 04:02
Using a pure spin lock for a critical section in a preemptable thread
is always wrong, however short the critical section may be. The thread
might be preempted, which will cause all other threads to hammer
busily at the core for the whole quant. Moreover, if threads have
different priorities, this might lead to a priority inversion problem
and a deadlock. More generally, a spinlock is not more efficient than
a well-written mutex, which typically does several spin iterations at
the start anyway.

The advise about UP vs SMP is also irrelevant in the context of
preemptive threads.
I believe rustdoc should not be conflating private items (visibility
lower than `pub`) and hidden items (attribute `doc(hidden)`). This
matters now that Cargo is passing --document-private-items by default
for bin crates. In bin crates that rely on macros, intentionally hidden
implementation details of the macros can overwhelm the actual useful
internal API that one would want to document.

This PR restores the strip-hidden pass when documenting private items,
and introduces a separate unstable --document-hidden-items option to
skip the strip-hidden pass. The two options are orthogonal to one
another.
Also includes a simple test with a custom panic hook to ensure we don't regress.
Co-Authored-By: lzutao <taolzu@gmail.com>
These notes are about a distinction that is not going to be observable
in the API. Whether or not the UTF-8 check knows the string length ahead
of time, these methods require linear time.
The only two uses of the associated methods are in librustc_mir and
librustdoc. Please tell me if there is a better choice.
Try statx for all linux-gnu target.

After rust-lang/libc#1577, which is contained in `libc` 0.2.66,  provides `SYS_statx` for all Linux platform, so we can try to use `statx` for ~all Linux target~ all linux-gnu targets.

Unfortunately, `struct statx` and `fn statx` is not a part of public interface of musl (currently), ~we still need to invoke it through `syscall`~ we does **not** support statx for musl or other libc impls currently.

Previous PR: rust-lang#65094

cc @alexcrichton
Move `is_min_const_fn` query to librustc_mir.

The only two uses of the associated methods are in `librustc_mir` and
`librustdoc`. Please tell me if there is a better choice.

cc rust-lang#65031
Remove wrong advice about spin locks from `spin_loop_hint` docs

Using a pure spin lock for a critical section in a preemptable thread
is always wrong, however short the critical section may be. The thread
might be preempted, which will cause all other threads to hammer
busily at the core for the whole quant. Moreover, if threads have
different priorities, this might lead to a priority inversion problem
and a deadlock. More generally, a spinlock is not more efficient than
a well-written mutex, which typically does several spin iterations at
the start anyway.

The advise about UP vs SMP is also irrelevant in the context of
preemptive threads.

See also accompanying piece: https://matklad.github.io/2020/01/02/spinlocs-considered-harmful.html

And another, independent piece: https://probablydance.com/2019/12/30/measuring-mutexes-spinlocks-and-how-bad-the-linux-scheduler-really-is

EDIT: obligatory disclosure that I am not an expert in these things, and might be terribly wrong :)
Add a check for swapped words when we can't find an identifier

Fixes rust-lang#66968

Couple things here:
1. The matches take the precedence of case insensitive match, then levenshtein match, then swapped words match. Doing this allows us to not even check for swapped words unless the other checks return `None`.
2. I've assumed that the swapped words check is not held to the limits of the max levenshtein distance threshold (ie. we want to try and find a match even if the levenshtein distance is very high). This means that we cannot perform this check in the `fold` that occurs after the `filter_map` call, because the candidate will be filtered out. So, I've split this into two separate `fold` calls, and had to collect the original iterator into a vec so it can be copied (I don't think we want to change the function signature to take a vec or require the `Copy` trait). An alternative implemenation may be to remove the `filter_map`, `fold` over the entire iterator, and do a check against `max_dist` inside the relevant cases there.

r? @estebank
Distinguish between private items and hidden items in rustdoc

I believe rustdoc should not be conflating private items (visibility lower than `pub`) and hidden items (attribute `doc(hidden)`). This matters now that Cargo is passing --document-private-items by default for bin crates. In bin crates that rely on macros, intentionally hidden implementation details of the macros can overwhelm the actual useful internal API that one would want to document.

This PR restores the strip-hidden pass when documenting private items, and introduces a separate unstable --document-hidden-items option to skip the strip-hidden pass. The two options are orthogonal to one another.

Fixes rust-lang#67851. Closes rust-lang#60884.
`Option::{expect,unwrap}` and `Result::{expect, expect_err, unwrap, unwrap_err}` have `#[track_caller]`

The annotated functions now produce panic messages pointing to the location where they were called, rather than `core`'s internals.
…umeGomez

rustdoc: Remove more `#[doc(cfg(..))]` duplicates

This is a follow up to rust-lang#66959.

r? @GuillaumeGomez
Remove insignificant notes from CStr documentation

The to_str and to_string_lossy methods contain a note about the behavior possibly changing in the future. But those notes are referring to a distinction that is not observable in the API. Whether or not the UTF-8 check knows the string length ahead of time, these methods require linear time.
…fix, r=Mark-Simulacrum

ci: fix wrong shared.sh import for publish_toolstate

r? @Mark-Simulacrum
@JohnTitor
Copy link
Member Author

@bors r+ p=10 rollup=never

@bors
Copy link
Contributor

bors commented Jan 8, 2020

📌 Commit 844530e has been approved by JohnTitor

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 8, 2020
@JohnTitor
Copy link
Member Author

@bors p=101
Yield prio over ci fix

@bors
Copy link
Contributor

bors commented Jan 8, 2020

⌛ Testing commit 844530e with merge 254db01...

bors added a commit that referenced this pull request Jan 8, 2020
Rollup of 10 pull requests

Successful merges:

 - #67774 (Try statx for all linux-gnu target.)
 - #67781 (Move `is_min_const_fn` query to librustc_mir.)
 - #67798 (Remove wrong advice about spin locks from `spin_loop_hint` docs)
 - #67849 (Add a check for swapped words when we can't find an identifier)
 - #67875 (Distinguish between private items and hidden items in rustdoc)
 - #67887 (`Option::{expect,unwrap}` and `Result::{expect, expect_err, unwrap, unwrap_err}` have `#[track_caller]`)
 - #67955 (rustdoc: Remove more `#[doc(cfg(..))]` duplicates)
 - #67977 (Updates for VxWorks)
 - #67985 (Remove insignificant notes from CStr documentation)
 - #68003 (ci: fix wrong shared.sh import for publish_toolstate)

Failed merges:

 - #67820 (Parse the syntax described in RFC 2632)
 - #67979 (Move `intravisit` => `rustc_hir` + misc cleanup)

r? @ghost
@JohnTitor JohnTitor added the rollup A PR which is a rollup label Jan 8, 2020
@rust-highfive
Copy link
Collaborator

The job mingw-check of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-01-08T15:30:01.8901442Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-01-08T15:30:01.8912237Z ##[command]git config gc.auto 0
2020-01-08T15:30:01.8915732Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-01-08T15:30:01.8917650Z ##[command]git config --get-all http.proxy
2020-01-08T15:30:01.8920212Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/68011/merge:refs/remotes/pull/68011/merge

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@JohnTitor
Copy link
Member Author

The failures for PR are spurious, let's check auto builders.

@bors
Copy link
Contributor

bors commented Jan 8, 2020

💥 Test timed out

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 8, 2020
@JohnTitor
Copy link
Member Author

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 8, 2020
@bors
Copy link
Contributor

bors commented Jan 8, 2020

⌛ Testing commit 844530e with merge caa231d...

bors added a commit that referenced this pull request Jan 8, 2020
Rollup of 10 pull requests

Successful merges:

 - #67774 (Try statx for all linux-gnu target.)
 - #67781 (Move `is_min_const_fn` query to librustc_mir.)
 - #67798 (Remove wrong advice about spin locks from `spin_loop_hint` docs)
 - #67849 (Add a check for swapped words when we can't find an identifier)
 - #67875 (Distinguish between private items and hidden items in rustdoc)
 - #67887 (`Option::{expect,unwrap}` and `Result::{expect, expect_err, unwrap, unwrap_err}` have `#[track_caller]`)
 - #67955 (rustdoc: Remove more `#[doc(cfg(..))]` duplicates)
 - #67977 (Updates for VxWorks)
 - #67985 (Remove insignificant notes from CStr documentation)
 - #68003 (ci: fix wrong shared.sh import for publish_toolstate)

Failed merges:

 - #67820 (Parse the syntax described in RFC 2632)
 - #67979 (Move `intravisit` => `rustc_hir` + misc cleanup)

r? @ghost
@bors
Copy link
Contributor

bors commented Jan 8, 2020

☀️ Test successful - checks-azure
Approved by: JohnTitor
Pushing caa231d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 8, 2020
@bors bors merged commit 844530e into rust-lang:master Jan 8, 2020
@rust-highfive
Copy link
Collaborator

Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-01-08T22:56:03.2819223Z ##[command]git config gc.auto 0
2020-01-08T22:56:03.2821795Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-01-08T22:56:03.2823890Z ##[command]git config --get-all http.proxy
2020-01-08T22:56:03.2826908Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin
2020-01-08T22:56:03.3816399Z remote: du: cannot access 'objects/tmp_object_git2_A6FMZv': No such file or directory        

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.