rust-lang / rust-lang/rust

rustdoc fails to build when rustc-dev is installed

Open
#154,558 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug needs-triage T-bootstrap
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Summary

This is somewhat related to #153612, specifically to the fact that rustc-dev is now installed by default if bootstrap was configured with extended toolset.

If I build rust 1.94.x with rust 1.93.0 and then use newly built cargo/rustc/rust-std to rebuild rust 1.94.x from scratch then it builds fine. However the moment I install rustc-dev (which is now installed by default given extended=true) build of rustdoc fails

Command used

(make sure rustc-dev is installed)

./configure --local-rust-root=/usr ... 
./x.py dist

Expected behaviour

Build succeeds irrespective of what is installed.

Actual behaviour

Build fails seemingly due to multiple conflicting libraries found:

...
Building stage1 rustdoc_tool_binary (stage0 -> stage1, armv7-unknown-linux-gnueabihf)
...
error[E0464]: multiple candidates for `rmeta` dependency `rustc_abi` found                                                                                                                                                                                      
  --> src/librustdoc/lib.rs:31:1                                                                                                                                                                                                                                
   |                                                                                                                                                                                                                                                            
31 | extern crate rustc_abi;                                                                                                                                                                                                                                    
   | ^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                    
   |                                                                                                                                                                                                                                                            
   = note: candidate #1: .../rustc-1.94.1-src/build/armv7-unknown-linux-gnueabihf/stage0-sysroot/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/librustc_abi-b86fd47698a24a08.rmeta                                  
   = note: candidate #2: .../rustc-1.94.1-src/build/armv7-unknown-linux-gnueabihf/stage0-sysroot/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/librustc_abi-df01d199348aa9ab.rmeta                                  
                                                                                                                                                                                                                                                                
error[E0464]: multiple candidates for `rmeta` dependency `rustc_ast` found                                                                                                                                                                                      
  --> src/librustdoc/lib.rs:32:1                                                                                                                                                                                                                                
   |                                                                                                                                                                                                                                                            
32 | extern crate rustc_ast;                                                                                                                                                                                                                                    
   | ^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                    
   |                                                                                                                                                                                                                                                            
   = note: candidate #1: .../rustc-1.94.1-src/build/armv7-unknown-linux-gnueabihf/stage0-sysroot/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/librustc_ast-0904ebfb9520125d.rmeta                                  
   = note: candidate #2: .../rustc-1.94.1-src/build/armv7-unknown-linux-gnueabihf/stage0-sysroot/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/librustc_ast-24a53b6b0d89b024.rmeta                                  
                                                                                                                                                                                                                                                                
error[E0464]: multiple candidates for `rmeta` dependency `rustc_ast_pretty` found                                                                                                                                                                               
  --> src/librustdoc/lib.rs:33:1                                                                                                                                                                                                                                
   |                                                                                                                                                                                                                                                            
33 | extern crate rustc_ast_pretty;                                                                                                                                                                                                                             
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                             
   |                                                                                                                                                                                                                                                            
   = note: candidate #1: .../rustc-1.94.1-src/build/armv7-unknown-linux-gnueabihf/stage0-sysroot/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/librustc_ast_pretty-850d3cf2ae770d20.rmeta                           
   = note: candidate #2: .../rustc-1.94.1-src/build/armv7-unknown-linux-gnueabihf/stage0-sysroot/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/librustc_ast_pretty-b7574a739c992e10.rmeta 
...
<list of conflicts goes on and on, then come other errors>
...                                                                                                                                                                                                                                                                
error[E0432]: unresolved imports `crate::lint::BROKEN_INTRA_DOC_LINKS`, `crate::lint::PRIVATE_INTRA_DOC_LINKS`                                                                                                                                                  
  --> src/librustdoc/passes/collect_intra_doc_links.rs:37:19                                                                                                                                                                                                    
   |                                                                                                                                                                                                                                                            
37 | use crate::lint::{BROKEN_INTRA_DOC_LINKS, PRIVATE_INTRA_DOC_LINKS};                                                                                                                                                                                        
   |                   ^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^ no `PRIVATE_INTRA_DOC_LINKS` in `lint`                                                                                                                                                   
   |                   |                                                                                                                                                                                                                                        
   |                   no `BROKEN_INTRA_DOC_LINKS` in `lint`                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                
error[E0408]: variable `AssocFn` is not bound in all patterns                                                                                                                                                                                                   
   --> src/librustdoc/clean/utils.rs:502:13                                                                                                                                                                                                                     
    |                                                                                                                                                                                                                                                           
502 |             AssocTy                                                                                                                                                                                                                                       
    |             ^^^^^^^ pattern doesn't bind `AssocFn`                                                                                                                                                                                                        
503 |             | AssocFn                                                                                                                                                                                                                                     
    |               ------- variable not in all patterns                                                                                                                                                                                                        
504 |             | AssocConst                                                                                                                                                                                                                                  
    |               ^^^^^^^^^^ pattern doesn't bind `AssocFn`                                                                                                                                                                                                   
505 |             | Variant                                                                                                                                                                                                                                     
    |               ^^^^^^^ pattern doesn't bind `AssocFn`                                                                                                                                                                                                      
506 |             | Fn                                                                                                                                                                                                                                          
    |               ^^ pattern doesn't bind `AssocFn`
...
<list of errors goes on and on>
...
error: could not compile `rustdoc` (lib) due to 221 previous errors
Bootstrap configuration (bootstrap.toml)

N/A

Operating system

Linux

HEAD

e408947bfd200af42db322daf0fadfe7e26d3bd1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with rustc-dev installed using ./configure --local-rust-root=/usr and ./x.py dist. Inspect the stage1 rustdoc_tool_binary build and the dependencies referenced from src/librustdoc/lib.rs, along with the reported failures in src/librustdoc/passes/collect_intra_doc_links.rs and src/librustdoc/clean/utils.rs. Done means the distribution build succeeds without duplicate rmeta candidates or the follow-on rustdoc errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.