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 6 pull requests #103077

Closed
wants to merge 27 commits into from
Closed

Conversation

Dylan-DPC
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

joboet and others added 27 commits October 6, 2022 22:46
rustc's startup has several layers, including:
- `interface::run_compiler` passes a closure, `f`, to
  `run_in_thread_pool_with_globals`, which creates a thread pool, sets
  up session globals, and passes `f` to `create_compiler_and_run`.
- `create_compiler_and_run` creates a `Session`, a `Compiler`, sets the
  source map, and calls `f`.

rustdoc is a bit different.
- `main_args` calls `main_options` via
  `run_in_thread_pool_with_globals`, which (again) creates a thread pool
  (hardcoded to a single thread!) and sets up session globals.
- `main_options` has four different paths.
  - The second one calls `interface::run_compiler`, which redoes the
    `run_in_thread_pool_with_globals`! This is bad.
  - The fourth one calls `interface::create_compiler_and_run`, which is
    reasonable.
  - The first and third ones don't do anything of note involving the
    above functions, except for some symbol interning which requires
    session globals.

In other words, rustdoc calls into `rustc_interface` at three different
levels. It's a bit confused, and feels like code where functionality has
been added by different people at different times without fully
understanding how the globally accessible stuff is set up.

This commit tidies things up. It removes the
`run_in_thread_pool_with_globals` call in `main_args`, and adjust the
four paths in `main_options` as follows.
- `markdown::test` calls `test::test_main`, which provides its own
  parallelism and so doesn't need a thread pool. It had one small use of
  symbol interning, which required session globals, but the commit
  removes this.
- `doctest::run` already calls `interface::run_compiler`, so it doesn't
  need further adjustment.
- `markdown::render` is simple but needs session globals for interning
  (which can't easily be removed), so it's now wrapped in
  `create_session_globals_then`.
- The fourth path now uses `interface::run_compiler`, which is
  equivalent to the old `run_in_thread_pool_with_globals` +
  `create_compiler_and_run` pairing.
There is no longer any need for them to be separate.
It has a single call site, and removing it slightly improves the
confusing tangle of nested closures present at startup.
This avoids the need for a degenerate `Lrc::get_mut` call.
12 commits in b8f30cb23c4e5f20854a4f683325782b7cff9837..b332991a57c9d055f1864de1eed93e2178d49440
2022-10-10 19:16:06 +0000 to 2022-10-13 22:05:28 +0000
- Differentiate the warning when an alias (built-in or user-defined) shadows an external subcommand (rust-lang/cargo#11170)
- chore: Update tests for latest clap (rust-lang/cargo#11235)
- feat(publish): Support 'publish.timeout' config behind '-Zpublish-timeout' (rust-lang/cargo#11230)
- Add missing edition (rust-lang/cargo#11231)
- doc(profiles): add module level doc (rust-lang/cargo#11219)
- refactor(publish): Clarify which SourceId is being used (rust-lang/cargo#11216)
- Add new SourceKind::SparseRegistry to differentiate sparse registries (rust-lang/cargo#11209)
- Fix deadlock when build scripts are waiting for input on stdin (rust-lang/cargo#11205)
- refactor: New variant `FeaturesFor::ArtifactDep` (rust-lang/cargo#11184)
- Fix rustdoc warning about unclosed HTML tag (rust-lang/cargo#11221)
- refactor(tests): Prepare for wait-for-publish test changes (rust-lang/cargo#11210)
- Add configuration option for controlling crates.io protocol (rust-lang/cargo#11215)
…holk

Make `dyn*` casts into a coercion, allow `dyn*` upcasting

I know that `dyn*` is likely not going to be a feature exposed to surface Rust, but this makes it slightly more ergonomic to write tests for these types anyways. ... and this was just fun to implement anyways.

1. Make `dyn*` into a coercion instead of a cast
2. Enable `dyn*` upcasting since we basically get it for free
3. Simplify some of the cast checking code since we're using the coercion path now

r? `@eholk` but feel free to reassign
cc `@nikomatsakis` and `@tmandry` who might care about making `dyn*` casts into a coercion
Clean up rustdoc startup

Startup is pretty hairy, in both rustdoc and rustc. The first commit here improves the rustdoc situation quite a bit. The remaining commits are smaller but also help.

Best reviewed one commit at a time.

r? ````@jyn514````
Use semaphores for thread parking on Apple platforms

Currently we use a mutex-condvar pair for thread parking on Apple systems. Unfortunately, `pthread_cond_timedwait` uses the real-time clock for measuring time, which causes problems when the system time changes. The parking implementation in this PR uses a semaphore instead, which measures monotonic time by default, avoiding these issues. As a further benefit, this has the potential to improve performance a bit, since `unpark` does not need to wait for a lock to be released.

Since the Mach semaphores are poorly documented (I could not find availability or stability guarantees for instance), this uses a [dispatch semaphore](https://developer.apple.com/documentation/dispatch/dispatch_semaphore?language=objc) instead. While it adds a layer of indirection (it uses Mach semaphores internally), the overhead is probably negligible.

Tested on macOS 12.5.

r? ````@thomcc````
…s, r=Manishearth

Add missing checks for `doc(cfg_hide(...))`

Part of  rust-lang#43781.

The `doc(cfg_hide(...))` attribute can only be used at the crate level and takes a list of attributes as argument.

r? `@Manishearth`
Update cargo

12 commits in b8f30cb23c4e5f20854a4f683325782b7cff9837..b332991a57c9d055f1864de1eed93e2178d49440 2022-10-10 19:16:06 +0000 to 2022-10-13 22:05:28 +0000
- Differentiate the warning when an alias (built-in or user-defined) shadows an external subcommand (rust-lang/cargo#11170)
- chore: Update tests for latest clap (rust-lang/cargo#11235)
- feat(publish): Support 'publish.timeout' config behind '-Zpublish-timeout' (rust-lang/cargo#11230)
- Add missing edition (rust-lang/cargo#11231)
- doc(profiles): add module level doc (rust-lang/cargo#11219)
- refactor(publish): Clarify which SourceId is being used (rust-lang/cargo#11216)
- Add new SourceKind::SparseRegistry to differentiate sparse registries (rust-lang/cargo#11209)
- Fix deadlock when build scripts are waiting for input on stdin (rust-lang/cargo#11205)
- refactor: New variant `FeaturesFor::ArtifactDep` (rust-lang/cargo#11184)
- Fix rustdoc warning about unclosed HTML tag (rust-lang/cargo#11221)
- refactor(tests): Prepare for wait-for-publish test changes (rust-lang/cargo#11210)
- Add configuration option for controlling crates.io protocol (rust-lang/cargo#11215)
@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 15, 2022
@rustbot rustbot added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Oct 15, 2022
@Dylan-DPC
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Oct 15, 2022

📌 Commit 8437d75 has been approved by Dylan-DPC

It is now in the queue for this repository.

@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 Oct 15, 2022
@bors
Copy link
Contributor

bors commented Oct 15, 2022

⌛ Testing commit 8437d75 with merge 8df04bd7c03103b83a8de2e7ceec9e8de0478591...

@bors
Copy link
Contributor

bors commented Oct 15, 2022

💔 Test failed - checks-actions

@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 Oct 15, 2022
@rust-log-analyzer
Copy link
Collaborator

The job dist-x86_64-msvc-alt failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Finished release [optimized] target(s) in 1m 46s
[TIMING] tool::Rustdoc { compiler: Compiler { stage: 2, host: x86_64-pc-windows-msvc } } -- 106.436
[TIMING] doc::Standalone { compiler: Compiler { stage: 2, host: x86_64-pc-windows-msvc }, target: x86_64-pc-windows-msvc } -- 0.675
Documenting book redirect pages (x86_64-pc-windows-msvc)
thread 'main' panicked at 'WorkerLocal can only be used on the thread pool it was created on', C:\Users\runneradmin\.cargo\registry\src\git.luolix.top-1ecc6299db9ec823\rustc-rayon-core-0.4.1\src\worker_local.rs:49:17
   0:     0x7ffe36c390e2 - std::sys_common::backtrace::_print_fmt
                               at /rustc/8df04bd7c03103b83a8de2e7ceec9e8de0478591/library\std\src\sys_common\backtrace.rs:66
                               at /rustc/8df04bd7c03103b83a8de2e7ceec9e8de0478591/library\std\src\sys_common\backtrace.rs:66
   1:     0x7ffe36c390e2 - std::sys_common::backtrace::_print::impl$0::fmt
                               at /rustc/8df04bd7c03103b83a8de2e7ceec9e8de0478591/library\std\src\sys_common\backtrace.rs:45
   2:     0x7ffe36c74a5b - core::fmt::write
                               at /rustc/8df04bd7c03103b83a8de2e7ceec9e8de0478591/library\core\src\fmt\mod.rs:1209
   3:     0x7ffe36c2baba - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                               at /rustc/8df04bd7c03103b83a8de2e7ceec9e8de0478591/library\std\src\io\mod.rs:1682
                               at /rustc/8df04bd7c03103b83a8de2e7ceec9e8de0478591/library\std\src\sys_common\backtrace.rs:48
   5:     0x7ffe36c3c7d4 - std::sys_common::backtrace::print
                               at /rustc/8df04bd7c03103b83a8de2e7ceec9e8de0478591/library\std\src\sys_common\backtrace.rs:35
   6:     0x7ffe36c3c7d4 - std::panicking::default_hook::closure$1
   6:     0x7ffe36c3c7d4 - std::panicking::default_hook::closure$1
                               at /rustc/8df04bd7c03103b83a8de2e7ceec9e8de0478591/library\std\src\panicking.rs:267
   7:     0x7ffe36c3c40a - std::panicking::default_hook
                               at /rustc/8df04bd7c03103b83a8de2e7ceec9e8de0478591/library\std\src\panicking.rs:286
   8:     0x7ffe2e3a432c - rustc_driver[99224586ab6d1566]::handle_options
                               at /rustc/8df04bd7c03103b83a8de2e7ceec9e8de0478591/library\std\src\panicking.rs:692
                               at /rustc/8df04bd7c03103b83a8de2e7ceec9e8de0478591/library\std\src\panicking.rs:692
  10:     0x7ffe33b6aa29 - std[9f64c043ca95492d]::sys_common::backtrace::__rust_end_short_backtrace::<std[9f64c043ca95492d]::panicking::begin_panic<&str>::{closure#0}, !>
  11:     0x7ffe33b6a9ef - std[9f64c043ca95492d]::sys_common::backtrace::__rust_end_short_backtrace::<std[9f64c043ca95492d]::panicking::begin_panic<&str>::{closure#0}, !>
  12:     0x7ffe33d0e7ad - std[9f64c043ca95492d]::panicking::begin_panic::<&str>
  13:     0x7ffe33b09556 - rustc_ast[92c1cb422da947f1]::attr::mk_attr_from_item
  14:     0x7ffe3311612e - <rustc_parse[2aaa6f3e73492909]::parser::Parser>::parse_meta_item_inner
  15:     0x7ffe33100f74 - <&(rustc_parse[2aaa6f3e73492909]::parser::FlatToken, rustc_ast[92c1cb422da947f1]::tokenstream::Spacing) as core[343bf02eedee9c0a]::fmt::Debug>::fmt
  16:     0x7ffe33179df2 - <rustc_parse[2aaa6f3e73492909]::parser::Parser>::parse_item
  17:     0x7ff626517efe - <scoped_tls[683f74c81906d24f]::ScopedKey<rustc_span[80b1b8a5c3c553be]::SessionGlobals>>::with::<rustdoc[caa07696e35e4ea9]::doctest::make_test::{closure#0}::{closure#0}, (bool, bool, bool)>
  18:     0x7ff6264c140e - <core[343bf02eedee9c0a]::panic::unwind_safe::AssertUnwindSafe<rustdoc[caa07696e35e4ea9]::doctest::make_test::{closure#0}> as core[343bf02eedee9c0a]::ops::function::FnOnce<()>>::call_once
  19:     0x7ff6262725b8 - rustc_driver[99224586ab6d1566]::catch_fatal_errors::<rustdoc[caa07696e35e4ea9]::doctest::make_test::{closure#0}, (bool, bool, bool)>
  20:     0x7ff6264dcad9 - rustdoc[caa07696e35e4ea9]::doctest::make_test
  21:     0x7ff6262e3f49 - RNvXs1_NtNtCshozOSAXfEs7_7rustdoc4html8markdownINtB5_10CodeBlocksINtB5_12TableWrapperINtB5_12LinkReplacerINtNtNtNtCs4u2xRBjjfte_4core4iter8adapters3map3MapINtB5_9FootnotesINtB5_12HeadingLinksNtNtCsdfqYq8o0aup_14pulldown_cmark5parse10OffsetIterEENCNvMsf_B5
  22:     0x7ff626597ce1 - RNvMNtCsdfqYq8o0aup_14pulldown_cmark4htmlINtB2_10HtmlWriterINtNtNtCshozOSAXfEs7_7rustdoc4html8markdown10CodeBlocksINtBY_12TableWrapperINtBY_12LinkReplacerINtNtNtNtCs4u2xRBjjfte_4core4iter8adapters3map3MapINtBY_9FootnotesINtBY_12HeadingLinksNtNtB4_5parse10
  23:     0x7ff62658f1ec - RINvNtCsdfqYq8o0aup_14pulldown_cmark4html9push_htmlINtNtNtCshozOSAXfEs7_7rustdoc4html8markdown10CodeBlocksINtBQ_12TableWrapperINtBQ_12LinkReplacerINtNtNtNtCs4u2xRBjjfte_4core4iter8adapters3map3MapINtBQ_9FootnotesINtBQ_12HeadingLinksNtNtB4_5parse10OffsetIt
  24:     0x7ff6262ef736 - <rustdoc[caa07696e35e4ea9]::html::markdown::Markdown>::into_string
  25:     0x7ff6264f53cc - rustdoc[caa07696e35e4ea9]::markdown::render::<&std[9f64c043ca95492d]::path::PathBuf>
  26:     0x7ff62651596d - <scoped_tls[683f74c81906d24f]::ScopedKey<rustc_span[80b1b8a5c3c553be]::SessionGlobals>>::set::<rustdoc[caa07696e35e4ea9]::main_args::{closure#0}, core[343bf02eedee9c0a]::result::Result<(), alloc[f0b811c1c605c2b3]::string::String>>
  27:     0x7ff6261d94ed - rustdoc[caa07696e35e4ea9]::main_args
  28:     0x7ff6264c0f9a - <core[343bf02eedee9c0a]::panic::unwind_safe::AssertUnwindSafe<rustdoc[caa07696e35e4ea9]::main::{closure#0}> as core[343bf02eedee9c0a]::ops::function::FnOnce<()>>::call_once
  29:     0x7ff626272717 - rustc_driver[99224586ab6d1566]::catch_with_exit_code::<rustdoc[caa07696e35e4ea9]::main::{closure#0}>
  30:     0x7ff6261d37a9 - rustdoc[caa07696e35e4ea9]::main
  31:     0x7ff6261b1006 - std[9f64c043ca95492d]::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
  32:     0x7ff6261b107c - std[9f64c043ca95492d]::rt::lang_start::<()>::{closure#0}
  33:     0x7ffe36c1d12e - core::ops::function::impls::impl$2::call_once
                               at /rustc/8df04bd7c03103b83a8de2e7ceec9e8de0478591/library\core\src\ops\function.rs:286
                               at /rustc/8df04bd7c03103b83a8de2e7ceec9e8de0478591/library\std\src\panicking.rs:483
  35:     0x7ffe36c1d12e - std::panicking::try
                               at /rustc/8df04bd7c03103b83a8de2e7ceec9e8de0478591/library\std\src\panicking.rs:447
  36:     0x7ffe36c1d12e - std::panic::catch_unwind
---
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.66.0-nightly (8df04bd7c 2022-10-15) running on x86_64-pc-windows-msvc

note: compiler flags: -Z normalize-docs -Z unstable-options
query stack during panic:
end of query stack
Build completed unsuccessfully in 0:23:39

@Dylan-DPC Dylan-DPC closed this Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants