File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -145,12 +145,12 @@ fn install_server(sh: &Shell, opts: ServerOpt) -> anyhow::Result<()> {
145145    ) ; 
146146
147147    if  let  Some ( train_crate)  = opts. pgo  { 
148+         let  target = detect_target ( sh) ; 
148149        let  build_cmd = cmd ! ( 
149150            sh, 
150-             "cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --profile={profile} --locked --features force-always-assert {features...}" 
151+             "cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --target {target} -- profile={profile} --locked --features force-always-assert {features...}" 
151152        ) ; 
152153
153-         let  target = detect_target ( sh) ; 
154154        let  profile = crate :: pgo:: gather_pgo_profile ( sh,  build_cmd,  & target,  train_crate) ?; 
155155        install_cmd = crate :: pgo:: apply_pgo_to_cmd ( install_cmd,  & profile) ; 
156156    } 
Original file line number Diff line number Diff line change @@ -60,7 +60,12 @@ pub(crate) fn gather_pgo_profile<'a>(
6060        }  else  { 
6161            None 
6262        } 
63-     } ) ; 
63+     } ) . collect :: < Vec < _ > > ( ) ; 
64+ 
65+     if  profile_files. is_empty ( )  { 
66+         anyhow:: bail!( "rust-analyzer analysis-stats produced no pgo files. This is a bug in rust-analyzer; please file an issue." ) ; 
67+     } 
68+ 
6469    cmd ! ( sh,  "{llvm_profdata} merge {profile_files...} -o {merged_profile}" ) . run ( ) . context ( 
6570        "cannot merge PGO profiles. Do you have the rustup `llvm-tools` component installed?" , 
6671    ) ?; 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments