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

Fix impl being removed excessively #82496

Closed

Conversation

GuillaumeGomez
Copy link
Member

Fixes #82465.

To prevent some impls to get removed, the type has to be "registered". This is because of the change from 8eaf68f , before that commit, the impls were filtered before we added the multiple Deref "go down".

cc @jryans
r? @jyn514

@GuillaumeGomez GuillaumeGomez added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Feb 24, 2021
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 24, 2021
Copy link
Contributor

@jryans jryans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks for fixing this regression, the fix makes sense to me. I suppose my testing had been too focused on the non-primitive variant...

@GuillaumeGomez
Copy link
Member Author

Thanks to you for the initial implementation! :p

I added a foreign non-primitive type (String) to ensure that it didn't break either.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-9 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
.................................................................................................... 9200/11491
.................................................................................................... 9300/11491
.................................................................................................... 9400/11491
...............................................i......i............................................. 9500/11491
......................................................................................i.iiiiii.iiiii 9600/11491
.................................................................................................... 9800/11491
.................................................................................................... 9900/11491
.................................................................................................... 10000/11491
.................................................................................................... 10100/11491
---
 finished in 0.430 seconds
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 29 tests
iiiiiiiiiiiiiiiiiiiiiiiiiiiii

 finished in 0.076 seconds
Suite("src/test/incremental") not skipped for "bootstrap::test::Incremental" -- not in ["src/tools/tidy"]
Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
 finished in 10.227 seconds
Check compiletest suite=debuginfo mode=debuginfo (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 116 tests
iiiiiiiiii.i.i..i..i..ii....i.i....ii..........iiii.........i.....i...i.......ii.i.ii.....iiii.....i 100/116
test result: ok. 78 passed; 0 failed; 38 ignored; 0 measured; 0 filtered out; finished in 2.30s

 finished in 2.383 seconds
Suite("src/test/ui-fulldeps") not skipped for "bootstrap::test::UiFullDeps" -- not in ["src/tools/tidy"]
---
 Documenting std v0.0.0 (/checkout/library/std)
    Finished release [optimized] target(s) in 16.03s
   Compiling std v0.0.0 (/checkout/library/std)
 Documenting proc_macro v0.0.0 (/checkout/library/proc_macro)
error[E0773]: attempted to define built-in macro more than once
     |
1111 | /     macro_rules! cfg {
1111 | /     macro_rules! cfg {
1112 | |         ($($cfg:tt)*) => {
1113 | |             /* compiler built-in */
1115 | |     }
     | |_____^
     |
note: previously defined here
note: previously defined here
    --> /checkout/library/core/src/macros/mod.rs:1111:5
     |
1111 | /     macro_rules! cfg {
1112 | |         ($($cfg:tt)*) => {
1113 | |             /* compiler built-in */
1115 | |     }
     | |_____^

thread 'rustc' panicked at 'index out of bounds: the len is 18 but the index is 18', compiler/rustc_metadata/src/creader.rs:130:21
---
For more information about this error, try `rustc --explain E0773`.
error: could not document `proc_macro`

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustdoc --edition=2018 --crate-type lib --crate-name proc_macro library/proc_macro/src/lib.rs --target x86_64-unknown-linux-gnu -o /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/x86_64-unknown-linux-gnu/doc --error-format=json --json=diagnostic-rendered-ansi --markdown-css rust.css --markdown-no-toc -Z unstable-options --resource-suffix 1.52.0 --index-page /checkout/src/doc/index.md -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/release/deps --extern std=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/x86_64-unknown-linux-gnu/release/deps/libstd-e68db195a71b092b.rmeta -Dwarnings -Winvalid_codeblock_attributes --crate-version '1.52.0-nightly
  (e975e0ea3
  2021-02-24)'` (exit code: 1)


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "rustdoc" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/library/test/Cargo.toml" "-p" "proc_macro" "--" "--markdown-css" "rust.css" "--markdown-no-toc" "-Z" "unstable-options" "--resource-suffix" "1.52.0" "--index-page" "/checkout/src/doc/index.md"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test --exclude src/tools/tidy
Build completed unsuccessfully in 0:26:20

@GuillaumeGomez
Copy link
Member Author

Apparently, the fix is breaking something else later on. Investigating...

@jyn514
Copy link
Member

jyn514 commented Feb 24, 2021

error[E0773]: attempted to define built-in macro more than once

This looks like #75176. Can you get a backtrace of that error with -Z treat-err-as-bug?

@GuillaumeGomez
Copy link
Member Author

Here it is:

error[E0773]: attempted to define built-in macro more than once
    --> /home/imperio/rust/rust/library/core/src/macros/mod.rs:1111:5
     |
1111 | /     macro_rules! cfg {
1112 | |         ($($cfg:tt)*) => {
1113 | |             /* compiler built-in */
1114 | |         };
1115 | |     }
     | |_____^
     |
note: previously defined here
    --> /home/imperio/rust/rust/library/core/src/macros/mod.rs:1111:5
     |
1111 | /     macro_rules! cfg {
1112 | |         ($($cfg:tt)*) => {
1113 | |             /* compiler built-in */
1114 | |         };
1115 | |     }
     | |_____^

thread 'rustc' panicked at 'aborting due to `-Z treat-err-as-bug=1`', compiler/rustc_errors/src/lib.rs:1028:27
stack backtrace:
   0: std::panicking::begin_panic
   1: rustc_errors::HandlerInner::emit_diagnostic
   2: rustc_errors::diagnostic_builder::DiagnosticBuilder::emit
   3: rustc_resolve::macros::<impl rustc_resolve::Resolver>::compile_macro
   4: rustc_resolve::build_reduced_graph::<impl rustc_resolve::Resolver>::get_macro_by_def_id
   5: rustc_resolve::macros::<impl rustc_resolve::Resolver>::check_reserved_macro_name
   6: rustc_resolve::imports::<impl rustc_resolve::Resolver>::try_define
   7: rustc_resolve::build_reduced_graph::<impl rustc_resolve::Resolver>::define
   8: rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor::build_reduced_graph_for_external_crate_res
   9: rustc_resolve::Resolver::resolutions
  10: rustc_resolve::Resolver::resolution
  11: rustc_resolve::imports::<impl rustc_resolve::Resolver>::resolve_ident_in_module_unadjusted_ext
  12: rustc_resolve::Resolver::resolve_path_with_ribs::{{closure}}
  13: rustc_resolve::Resolver::resolve_path_with_ribs
  14: rustc_resolve::Resolver::resolve_str_path_error
  15: rustc_interface::passes::BoxedResolver::access::{{closure}}
  16: rustc_interface::passes::configure_and_expand::{{closure}}
  17: rustc_interface::passes::BoxedResolver::access
  18: rustdoc::passes::collect_intra_doc_links::LinkCollector::resolve_link
  19: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::fold::DocFolder>::fold_item
  20: alloc::vec::source_iter_marker::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
  21: rustdoc::fold::DocFolder::fold_inner_recur
  22: rustdoc::fold::DocFolder::fold_item_recur
  23: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::fold::DocFolder>::fold_item
  24: rustdoc::passes::collect_intra_doc_links::collect_intra_doc_links
  25: rustdoc::core::run_global_ctxt
  26: rustc_session::utils::<impl rustc_session::session::Session>::time
  27: rustc_interface::passes::QueryContext::enter
  28: rustc_interface::interface::create_compiler_and_run
  29: rustdoc::main_options
  30: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

@GuillaumeGomez
Copy link
Member Author

I also used this opportunity to remove the useless insert in the primitives.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
Copy link
Member Author

I was able to track down the origin more precisely:

.resolve_str_path_error(DUMMY_SP, &path_str, ns, module_id)

When we call the resolve_str_path_error, it returns a ast::Path which looks like this:

Path { span: library/proc_macro/src/lib.rs:1:1: 1:1 (#0), segments: [PathSegment { ident: core#0, id: NodeId(57356), args: None }, PathSegment { ident: cmp#0, id: NodeId(57357), args: None }, PathSegment { ident: Ord#0, id: NodeId(57358), args: None }], tokens: None }

So completely fine from what I can see, however the Res returned alongside looks like this:

Def(Trait, DefId(18:1894

Yes, it's the complete output, rustc crashes when trying to display more information because the crate "18" doesn't exist.

I precise that we send "core::cmp::Ord" as path_str argument and the module_id is one from the alloc crate:

DefId(5:4868 ~ alloc[d315]::vec)

And ns is TypeNS.

At this point, I'm not sure where to look at to be honest. Is it an issue inside the compiler maybe or are we doing something completely wrong on rustdoc side?

cc @rust-lang/compiler

@GuillaumeGomez GuillaumeGomez added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Feb 25, 2021
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-9 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
.................................................................................................... 9200/11498
.................................................................................................... 9300/11498
.................................................................................................... 9400/11498
..................................................i......i.......................................... 9500/11498
.........................................................................................iiiiiii..ii 9600/11498
.................................................................................................... 9800/11498
.................................................................................................... 9900/11498
.................................................................................................... 10000/11498
.................................................................................................... 10100/11498
---
Suite("src/test/assembly") not skipped for "bootstrap::test::Assembly" -- not in ["src/tools/tidy"]
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 29 tests
iiiiiiiiiiiiiiiiiiiiiiiiiiiii

 finished in 0.063 seconds
Suite("src/test/incremental") not skipped for "bootstrap::test::Incremental" -- not in ["src/tools/tidy"]
Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
Suite("src/test/debuginfo") not skipped for "bootstrap::test::Debuginfo" -- not in ["src/tools/tidy"]
Check compiletest suite=debuginfo mode=debuginfo (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 116 tests
iiiiiiiiii.i.i..i..i..ii....i.i....ii..........iiii.........i.....i...i.......ii.i.ii.....iiii.....i 100/116
test result: ok. 78 passed; 0 failed; 38 ignored; 0 measured; 0 filtered out; finished in 1.90s

 finished in 1.963 seconds
Suite("src/test/ui-fulldeps") not skipped for "bootstrap::test::UiFullDeps" -- not in ["src/tools/tidy"]
---
 Documenting std v0.0.0 (/checkout/library/std)
    Finished release [optimized] target(s) in 14.82s
   Compiling std v0.0.0 (/checkout/library/std)
 Documenting proc_macro v0.0.0 (/checkout/library/proc_macro)
error[E0773]: attempted to define built-in macro more than once
     |
1111 | /     macro_rules! cfg {
1111 | /     macro_rules! cfg {
1112 | |         ($($cfg:tt)*) => {
1113 | |             /* compiler built-in */
1115 | |     }
     | |_____^
     |
note: previously defined here
note: previously defined here
    --> /checkout/library/core/src/macros/mod.rs:1111:5
     |
1111 | /     macro_rules! cfg {
1112 | |         ($($cfg:tt)*) => {
1113 | |             /* compiler built-in */
1115 | |     }
     | |_____^

thread 'rustc' panicked at 'index out of bounds: the len is 18 but the index is 18', compiler/rustc_metadata/src/creader.rs:130:21
---
For more information about this error, try `rustc --explain E0773`.
error: could not document `proc_macro`

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustdoc --edition=2018 --crate-type lib --crate-name proc_macro library/proc_macro/src/lib.rs --target x86_64-unknown-linux-gnu -o /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/x86_64-unknown-linux-gnu/doc --error-format=json --json=diagnostic-rendered-ansi --markdown-css rust.css --markdown-no-toc -Z unstable-options --resource-suffix 1.52.0 --index-page /checkout/src/doc/index.md -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/release/deps --extern std=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/x86_64-unknown-linux-gnu/release/deps/libstd-e68db195a71b092b.rmeta -Dwarnings -Winvalid_codeblock_attributes --crate-version '1.52.0-nightly
  (6023d4485
  2021-02-25)'` (exit code: 1)


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "rustdoc" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/library/test/Cargo.toml" "-p" "proc_macro" "--" "--markdown-css" "rust.css" "--markdown-no-toc" "-Z" "unstable-options" "--resource-suffix" "1.52.0" "--index-page" "/checkout/src/doc/index.md"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test --exclude src/tools/tidy
Build completed unsuccessfully in 0:22:33

@petrochenkov petrochenkov self-assigned this Feb 26, 2021
@petrochenkov
Copy link
Contributor

This looks like #75176.

Yes, looks similar.
Perhaps a similar check on whether resolution is speculative will help as well.

Also, rustdoc still has fundamental issues with using frozen resolver/cstore discussed in #68427 and you will continue meeting issues until they are addressed.

@petrochenkov petrochenkov added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 26, 2021
@petrochenkov petrochenkov removed their assignment Feb 26, 2021
@JohnCSimon
Copy link
Member

@rustbot label: -S-waiting-on-review +S-waiting-on-author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 16, 2021
@bstrie bstrie added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 31, 2021
@jyn514
Copy link
Member

jyn514 commented Mar 31, 2021

Here's a backtrace with debuginfo:

thread 'rustc' panicked at 'aborting due to `-Z treat-err-as-bug=1`', compiler/rustc_errors/src/lib.rs:1030:27
stack backtrace:
   0: std::panicking::begin_panic
             at ./library/std/src/panicking.rs:519:12
   1: rustc_errors::HandlerInner::panic_if_treat_err_as_bug
             at ./compiler/rustc_errors/src/lib.rs:1030:27
   2: rustc_errors::HandlerInner::bump_err_count
             at ./compiler/rustc_errors/src/lib.rs:1020:9
   3: rustc_errors::HandlerInner::emit_diagnostic
             at ./compiler/rustc_errors/src/lib.rs:836:13
   4: rustc_errors::Handler::emit_diagnostic
             at ./compiler/rustc_errors/src/lib.rs:756:9
   5: rustc_errors::diagnostic_builder::DiagnosticBuilder::emit
             at ./compiler/rustc_errors/src/diagnostic_builder.rs:103:9
   6: rustc_resolve::macros::<impl rustc_resolve::Resolver>::compile_macro
             at ./compiler/rustc_resolve/src/macros.rs:1205:25
   7: rustc_resolve::build_reduced_graph::<impl rustc_resolve::Resolver>::get_macro_by_def_id
             at ./compiler/rustc_resolve/src/build_reduced_graph.rs:200:53
   8: rustc_resolve::build_reduced_graph::<impl rustc_resolve::Resolver>::get_macro
             at ./compiler/rustc_resolve/src/build_reduced_graph.rs:188:58
   9: rustc_resolve::macros::<impl rustc_resolve::Resolver>::check_reserved_macro_name
             at ./compiler/rustc_resolve/src/macros.rs:1176:30
  10: rustc_resolve::imports::<impl rustc_resolve::Resolver>::try_define
             at ./compiler/rustc_resolve/src/imports.rs:498:9
  11: rustc_resolve::build_reduced_graph::<impl rustc_resolve::Resolver>::define
             at ./compiler/rustc_resolve/src/build_reduced_graph.rs:92:35
  12: rustc_resolve::build_reduced_graph::BuildReducedGraphVisitor::build_reduced_graph_for_external_crate_res
  13: rustc_resolve::build_reduced_graph::<impl rustc_resolve::Resolver>::build_reduced_graph_external
             at ./compiler/rustc_resolve/src/build_reduced_graph.rs:224:13
  14: rustc_resolve::Resolver::resolutions
             at ./compiler/rustc_resolve/src/lib.rs:1572:13
  15: rustc_resolve::Resolver::resolution
             at ./compiler/rustc_resolve/src/lib.rs:1582:10
  16: rustc_resolve::imports::<impl rustc_resolve::Resolver>::resolve_ident_in_module_unadjusted_ext
             at ./compiler/rustc_resolve/src/imports.rs:265:13
  17: rustc_resolve::Resolver::resolve_ident_in_module_ext
             at ./compiler/rustc_resolve/src/lib.rs:2012:9
  18: rustc_resolve::Resolver::resolve_ident_in_module
             at ./compiler/rustc_resolve/src/lib.rs:1982:9
  19: rustc_resolve::Resolver::resolve_path_with_ribs::{{closure}}
             at ./compiler/rustc_resolve/src/lib.rs:2239:21
  20: rustc_resolve::Resolver::resolve_path_with_ribs
             at ./compiler/rustc_resolve/src/lib.rs:2287:33
  21: rustc_resolve::Resolver::resolve_path
             at ./compiler/rustc_resolve/src/lib.rs:2112:9
  22: rustc_resolve::Resolver::resolve_ast_path
             at ./compiler/rustc_resolve/src/lib.rs:3224:15
  23: rustc_resolve::Resolver::resolve_str_path_error
             at ./compiler/rustc_resolve/src/lib.rs:3213:19
  24: rustdoc::passes::collect_intra_doc_links::LinkCollector::resolve_macro::{{closure}}
             at ./src/librustdoc/passes/collect_intra_doc_links.rs:449:17
  25: rustc_interface::passes::BoxedResolver::access::{{closure}}
             at ./compiler/rustc_data_structures/src/box_region.rs:113:34
  26: rustc_interface::passes::configure_and_expand::{{closure}}
             at ./compiler/rustc_interface/src/passes.rs:138:9
  27: alloc::boxed::<impl core::ops::generator::Generator<R> for core::pin::Pin<alloc::boxed::Box<G,A>>>::resume
             at ./library/alloc/src/boxed.rs:1668:9
  28: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::access
             at ./compiler/rustc_data_structures/src/box_region.rs:55:13
  29: rustc_interface::passes::BoxedResolver::access
             at ./compiler/rustc_data_structures/src/box_region.rs:119:21
  30: rustdoc::core::DocContext::enter_resolver
             at ./src/librustdoc/core.rs:104:9
  31: rustdoc::passes::collect_intra_doc_links::LinkCollector::resolve_macro
             at ./src/librustdoc/passes/collect_intra_doc_links.rs:431:9
  32: rustdoc::passes::collect_intra_doc_links::LinkCollector::resolve_with_disambiguator
             at ./src/librustdoc/passes/collect_intra_doc_links.rs:1368:31
  33: rustdoc::passes::collect_intra_doc_links::LinkCollector::resolve_with_disambiguator_cached
             at ./src/librustdoc/passes/collect_intra_doc_links.rs:1282:19
  34: rustdoc::passes::collect_intra_doc_links::LinkCollector::resolve_link
             at ./src/librustdoc/passes/collect_intra_doc_links.rs:1091:39
  35: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::fold::DocFolder>::fold_item
             at ./src/librustdoc/passes/collect_intra_doc_links.rs:906:28
  36: rustdoc::fold::DocFolder::fold_mod::{{closure}}
             at ./src/librustdoc/fold.rs:85:55
  37: core::iter::adapters::filter_map::filter_map_try_fold::{{closure}}
             at ./library/core/src/iter/adapters/filter_map.rs:46:28
  38: core::iter::traits::iterator::Iterator::try_fold
             at ./library/core/src/iter/traits/iterator.rs:1993:21
  39: <core::iter::adapters::filter_map::FilterMap<I,F> as core::iter::traits::iterator::Iterator>::try_fold
             at ./library/core/src/iter/adapters/filter_map.rs:77:9
  40: <I as alloc::vec::source_iter_marker::SpecInPlaceCollect<T,I>>::collect_in_place
             at ./library/alloc/src/vec/source_iter_marker.rs:117:13
  41: alloc::vec::source_iter_marker::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
             at ./library/alloc/src/vec/source_iter_marker.rs:55:19
  42: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
             at ./library/alloc/src/vec/mod.rs:2398:9
  43: core::iter::traits::iterator::Iterator::collect
             at ./library/core/src/iter/traits/iterator.rs:1775:9
  44: rustdoc::fold::DocFolder::fold_mod
             at ./src/librustdoc/fold.rs:85:20
  45: rustdoc::fold::DocFolder::fold_inner_recur
             at ./src/librustdoc/fold.rs:26:41
  46: rustdoc::fold::DocFolder::fold_item_recur
             at ./src/librustdoc/fold.rs:77:18
  47: <rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::fold::DocFolder>::fold_item
             at ./src/librustdoc/passes/collect_intra_doc_links.rs:918:23
  48: rustdoc::fold::DocFolder::fold_crate
             at ./src/librustdoc/fold.rs:90:20
  49: rustdoc::passes::collect_intra_doc_links::collect_intra_doc_links
             at ./src/librustdoc/passes/collect_intra_doc_links.rs:49:5
  50: rustdoc::core::run_global_ctxt::{{closure}}
             at ./src/librustdoc/core.rs:577:56
  51: rustc_data_structures::profiling::VerboseTimingGuard::run
             at ./compiler/rustc_data_structures/src/profiling.rs:573:9
  52: rustc_session::utils::<impl rustc_session::session::Session>::time
             at ./compiler/rustc_session/src/utils.rs:10:9
  53: rustdoc::core::run_global_ctxt
             at ./src/librustdoc/core.rs:577:21
  54: rustdoc::main_options::{{closure}}::{{closure}}::{{closure}}::{{closure}}
             at ./src/librustdoc/lib.rs:662:21
  55: rustc_data_structures::profiling::VerboseTimingGuard::run
             at ./compiler/rustc_data_structures/src/profiling.rs:573:9
  56: rustc_session::utils::<impl rustc_session::session::Session>::time
             at ./compiler/rustc_session/src/utils.rs:10:9
  57: rustdoc::main_options::{{closure}}::{{closure}}::{{closure}}
             at ./src/librustdoc/lib.rs:661:55
  58: rustc_interface::passes::QueryContext::enter::{{closure}}
             at ./compiler/rustc_interface/src/passes.rs:755:42
  59: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1726:50
  60: rustc_rayon_core::tlv::with
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.1/src/tlv.rs:19:5
  61: rustc_middle::ty::context::tls::set_tlv
             at ./compiler/rustc_middle/src/ty/context.rs:1684:9
  62: rustc_middle::ty::context::tls::enter_context
             at ./compiler/rustc_middle/src/ty/context.rs:1726:9
  63: rustc_interface::passes::QueryContext::enter
             at ./compiler/rustc_interface/src/passes.rs:755:9
  64: rustdoc::main_options::{{closure}}::{{closure}}
             at ./src/librustdoc/lib.rs:660:13
  65: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
             at ./compiler/rustc_interface/src/queries.rs:422:19
  66: rustdoc::main_options::{{closure}}
             at ./src/librustdoc/lib.rs:646:9
  67: rustc_interface::interface::create_compiler_and_run::{{closure}}
             at ./compiler/rustc_interface/src/interface.rs:208:13
  68: rustc_span::with_source_map
             at ./compiler/rustc_span/src/lib.rs:788:5
  69: rustc_interface::interface::create_compiler_and_run
             at ./compiler/rustc_interface/src/interface.rs:202:5
  70: rustdoc::main_options
             at ./src/librustdoc/lib.rs:645:5
  71: rustdoc::main_args::{{closure}}
             at ./src/librustdoc/lib.rs:570:17
  72: rustc_rayon_core::thread_pool::ThreadPool::install::{{closure}}
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.1/src/thread_pool/mod.rs:110:40
  73: rustc_rayon_core::registry::Registry::in_worker_cold::{{closure}}::{{closure}}
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.1/src/registry.rs:468:21
  74: <rustc_rayon_core::job::StackJob<L,F,R> as rustc_rayon_core::job::Job>::execute::call::{{closure}}
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.1/src/job.rs:116:21
  75: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at ./library/std/src/panic.rs:344:9
  76: std::panicking::try::do_call
             at ./library/std/src/panicking.rs:379:40
  77: std::panicking::try
             at ./library/std/src/panicking.rs:343:19
  78: std::panic::catch_unwind
             at ./library/std/src/panic.rs:431:14
  79: rustc_rayon_core::unwind::halt_unwinding
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.1/src/unwind.rs:17:5
  80: <rustc_rayon_core::job::StackJob<L,F,R> as rustc_rayon_core::job::Job>::execute
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.1/src/job.rs:123:38
  81: rustc_rayon_core::job::JobRef::execute
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.1/src/job.rs:60:9
  82: rustc_rayon_core::registry::WorkerThread::execute
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.1/src/registry.rs:726:9
  83: rustc_rayon_core::registry::WorkerThread::wait_until_cold
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.1/src/registry.rs:707:17
  84: rustc_rayon_core::registry::WorkerThread::wait_until
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.1/src/registry.rs:681:13
  85: rustc_rayon_core::registry::main_loop
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.1/src/registry.rs:805:5
  86: rustc_rayon_core::registry::ThreadBuilder::run
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.1/src/registry.rs:57:18
  87: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}::{{closure}}::{{closure}}::{{closure}}
             at ./compiler/rustc_interface/src/util.rs:214:21
  88: scoped_tls::ScopedKey<T>::set
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137:9
  89: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}::{{closure}}::{{closure}}
             at ./compiler/rustc_interface/src/util.rs:212:17
  90: rustc_rayon_core::ThreadPoolBuilder::build_scoped::{{closure}}::{{closure}}::{{closure}}
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.1/src/lib.rs:307:44
  91: crossbeam_utils::thread::ScopedThreadBuilder::spawn::{{closure}}
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.7.2/src/thread.rs:415:31
  92: crossbeam_utils::thread::ScopedThreadBuilder::spawn::{{closure}}
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.7.2/src/thread.rs:423:39
  93: <alloc::boxed::Box<F,A> as core::ops::function::FnMut<Args>>::call_mut
             at ./library/alloc/src/boxed.rs:1553:9
  94: crossbeam_utils::thread::ScopedThreadBuilder::spawn::{{closure}}
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.7.2/src/thread.rs:431:44
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

and the logging immediately before:

TRACE rustdoc::passes::collect_intra_doc_links considering link 'core::cmp::Ord#lexicographical-comparison'
DEBUG rustdoc::passes::collect_intra_doc_links resolving core::cmp::Ord as a macro in the module DefId(5:5981 ~ alloc[5d23]::vec)
2:rustcDEBUG rustc_resolve resolve_path(path=[Segment { ident: core#0, id: Some(NodeId(57541)), has_generic_args: false }, Segment { ident: cmp#0, id: Some(NodeId(57542)), ha
s_generic_args: false }, Segment { ident: Ord#0, id: Some(NodeId(57543)), has_generic_args: false }], opt_ns=Some(MacroNS), record_used=false, path_span=library/proc_macro/src/lib.rs:1:1: 1:1 (#0), crate_lint=No)
2:rustcDEBUG rustc_resolve resolve_path ident 0 core#0 Some(NodeId(57541))
2:rustcDEBUG rustc_resolve resolve_path ident 1 cmp#0 Some(NodeId(57542))
error[E0773]: attempted to define built-in macro more than once

@jyn514
Copy link
Member

jyn514 commented Apr 1, 2021

I don't see anything that looks wrong from resolve's perspective. I'm going to take a look at implementing #68427 (comment).

@jyn514
Copy link
Member

jyn514 commented Apr 1, 2021

Welp, #83738 didn't help unfortunately. It looks like the module is already from the second copy of core (crate id 18) when resolve_ident_in_module_unadjusted_ext calls resolution? I spent a while looking at early_resolve_ident_in_lexical_scope without much progress, I don't know why it's loading a new crate.

@jyn514 jyn514 mentioned this pull request Apr 1, 2021
6 tasks
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Apr 2, 2021
…rochenkov

rustdoc: Don't load all extern crates unconditionally

Instead, only load the crates that are linked to with intra-doc links.

This doesn't help very much with any of rustdoc's fundamental issues
with freezing the resolver, but it at least fixes a stable-to-stable
regression, and makes the crate loading model somewhat more consistent
with rustc's. I tested and it unfortunately does not help at all with rust-lang#82496.

Closes rust-lang#68427. Let me know if you want me to open a separate issue for not freezing the resolver.
r? `@petrochenkov` cc `@eddyb` `@ollie27`
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Apr 2, 2021
…rochenkov

rustdoc: Don't load all extern crates unconditionally

Instead, only load the crates that are linked to with intra-doc links.

This doesn't help very much with any of rustdoc's fundamental issues
with freezing the resolver, but it at least fixes a stable-to-stable
regression, and makes the crate loading model somewhat more consistent
with rustc's. I tested and it unfortunately does not help at all with rust-lang#82496.

Closes rust-lang#68427. Let me know if you want me to open a separate issue for not freezing the resolver.
r? ``@petrochenkov`` cc ``@eddyb`` ``@ollie27``
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 3, 2021
…chenkov

rustdoc: Don't load all extern crates unconditionally

Instead, only load the crates that are linked to with intra-doc links.

This doesn't help very much with any of rustdoc's fundamental issues
with freezing the resolver, but it at least fixes a stable-to-stable
regression, and makes the crate loading model somewhat more consistent
with rustc's. I tested and it unfortunately does not help at all with rust-lang#82496.

Closes rust-lang#68427. Let me know if you want me to open a separate issue for not freezing the resolver.
r? `@petrochenkov` cc `@eddyb` `@ollie27`
@Anders429 Anders429 mentioned this pull request Apr 5, 2021
10 tasks
@crlf0710 crlf0710 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 17, 2021
@jyn514 jyn514 added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 3, 2021
@jyn514
Copy link
Member

jyn514 commented May 9, 2021

This can be closed when #84867 lands I believe.

@GuillaumeGomez
Copy link
Member Author

It can be closed already. :)

@GuillaumeGomez GuillaumeGomez deleted the put-back-impls branch May 9, 2021 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: Blocked on something else such as an RFC or other implementation work. T-compiler Relevant to the compiler 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.

rustdoc drops impl Foreign<Local> for Foreign