@@ -159,8 +159,8 @@ pub struct ParsedArguments {
159159 crate_types : CrateTypes ,
160160 /// If dependency info is being emitted, the name of the dep info file.
161161 dep_info : Option < PathBuf > ,
162- /// If gcno info is being emitted, the name of the gcno file.
163- gcno : Option < PathBuf > ,
162+ /// If profile info is being emitted, the name of the profile file.
163+ profile : Option < PathBuf > ,
164164 /// rustc says that emits .rlib for --emit=metadata
165165 /// https://github.com/rust-lang/rust/issues/54852
166166 emit : HashSet < String > ,
@@ -994,7 +994,6 @@ ArgData! {
994994 CodeGen ( ArgCodegen ) ,
995995 PassThrough ( OsString ) ,
996996 Target ( ArgTarget ) ,
997- Unstable ( ArgUnstable ) ,
998997}
999998
1000999use self :: ArgData :: * ;
@@ -1036,7 +1035,6 @@ counted_array!(static ARGS: [ArgInfo<ArgData>; _] = [
10361035 take_arg!( "-L" , ArgLinkPath , CanBeSeparated , LinkPath ) ,
10371036 flag!( "-V" , NotCompilationFlag ) ,
10381037 take_arg!( "-W" , OsString , CanBeSeparated , PassThrough ) ,
1039- take_arg!( "-Z" , ArgUnstable , CanBeSeparated , Unstable ) ,
10401038 take_arg!( "-l" , ArgLinkLibrary , CanBeSeparated , LinkLibrary ) ,
10411039 take_arg!( "-o" , PathBuf , CanBeSeparated , TooHardPath ) ,
10421040] ) ;
@@ -1114,6 +1112,7 @@ fn parse_arguments(arguments: &[OsString], cwd: &Path) -> CompilerArguments<Pars
11141112 match ( opt. as_ref ( ) , value) {
11151113 ( "extra-filename" , Some ( value) ) => extra_filename = Some ( value. to_owned ( ) ) ,
11161114 ( "extra-filename" , None ) => cannot_cache ! ( "extra-filename" ) ,
1115+ ( "profile-generate" , Some ( _) ) => profile = true ,
11171116 // Incremental compilation makes a mess of sccache's entire world
11181117 // view. It produces additional compiler outputs that we don't cache,
11191118 // and just letting rustc do its work in incremental mode is likely
@@ -1126,12 +1125,6 @@ fn parse_arguments(arguments: &[OsString], cwd: &Path) -> CompilerArguments<Pars
11261125 ( _, _) => ( ) ,
11271126 }
11281127 }
1129- Some ( Unstable ( ArgUnstable { opt, value } ) ) => match value. as_deref ( ) {
1130- Some ( "y" ) | Some ( "yes" ) | Some ( "on" ) | None if opt == "profile" => {
1131- profile = true ;
1132- }
1133- _ => ( ) ,
1134- } ,
11351128 Some ( Color ( value) ) => {
11361129 // We'll just assume the last specified value wins.
11371130 color_mode = match value. as_ref ( ) {
@@ -1220,14 +1213,15 @@ fn parse_arguments(arguments: &[OsString], cwd: &Path) -> CompilerArguments<Pars
12201213 None
12211214 } ;
12221215
1223- // Figure out the gcno filename, if producing gcno files with `-Zprofile `.
1224- let gcno = if profile && emit. contains ( "link" ) {
1225- let mut gcno = crate_name. clone ( ) ;
1216+ // Figure out the profile filename, if producing profile files with `-C profile-generate `.
1217+ let profile = if profile && emit. contains ( "link" ) {
1218+ let mut profile = crate_name. clone ( ) ;
12261219 if let Some ( extra_filename) = extra_filename {
1227- gcno . push_str ( & extra_filename[ ..] ) ;
1220+ profile . push_str ( & extra_filename[ ..] ) ;
12281221 }
1229- gcno. push_str ( ".gcno" ) ;
1230- Some ( gcno)
1222+ // LLVM will append ".profraw" to the filename.
1223+ profile. push_str ( ".profraw" ) ;
1224+ Some ( profile)
12311225 } else {
12321226 None
12331227 } ;
@@ -1267,7 +1261,7 @@ fn parse_arguments(arguments: &[OsString], cwd: &Path) -> CompilerArguments<Pars
12671261 staticlibs,
12681262 crate_name,
12691263 dep_info : dep_info. map ( |s| s. into ( ) ) ,
1270- gcno : gcno . map ( |s| s. into ( ) ) ,
1264+ profile : profile . map ( |s| s. into ( ) ) ,
12711265 emit,
12721266 color_mode,
12731267 has_json,
@@ -1311,7 +1305,7 @@ where
13111305 dep_info,
13121306 emit,
13131307 has_json,
1314- gcno ,
1308+ profile ,
13151309 ..
13161310 } ,
13171311 } = * self ;
@@ -1535,10 +1529,10 @@ where
15351529 } else {
15361530 None
15371531 } ;
1538- if let Some ( gcno ) = gcno {
1539- let p = output_dir. join ( & gcno ) ;
1532+ if let Some ( profile ) = profile {
1533+ let p = output_dir. join ( & profile ) ;
15401534 outputs. insert (
1541- gcno . to_string_lossy ( ) . into_owned ( ) ,
1535+ profile . to_string_lossy ( ) . into_owned ( ) ,
15421536 ArtifactDescriptor {
15431537 path : p,
15441538 optional : true ,
@@ -3213,7 +3207,7 @@ proc_macro false
32133207 emit,
32143208 color_mode : ColorMode :: Auto ,
32153209 has_json : false ,
3216- gcno : None ,
3210+ profile : None ,
32173211 } ,
32183212 } ) ;
32193213 let creator = new_creator ( ) ;
@@ -3561,10 +3555,11 @@ proc_macro false
35613555 "--emit=dep-info,link" ,
35623556 "--out-dir" ,
35633557 "/out" ,
3564- "-Zprofile"
3558+ "-C" ,
3559+ "profile-generate=."
35653560 ) ;
35663561
3567- assert_eq ! ( h. gcno , Some ( "foo.gcno " . into( ) ) ) ;
3562+ assert_eq ! ( h. profile , Some ( "foo.profraw " . into( ) ) ) ;
35683563
35693564 let h = parses ! (
35703565 "--crate-name" ,
@@ -3577,9 +3572,10 @@ proc_macro false
35773572 "extra-filename=-a1b6419f8321841f" ,
35783573 "--out-dir" ,
35793574 "/out" ,
3580- "-Zprofile"
3575+ "-C" ,
3576+ "profile-generate=."
35813577 ) ;
35823578
3583- assert_eq ! ( h. gcno , Some ( "foo-a1b6419f8321841f.gcno " . into( ) ) ) ;
3579+ assert_eq ! ( h. profile , Some ( "foo-a1b6419f8321841f.profraw " . into( ) ) ) ;
35843580 }
35853581}
0 commit comments