Open matthiaskrgr opened 5 years ago
Does it work when specifying an absolute path? Maybe Cargo runs rustc in an unexpected working dir.
Oh that works, weird...
I would suggest the following: if the path is absolute and works, use it. If the path is relative but exists, print an error but suggest using its absolute path/form. Otherwise throw an error as before.
Nit: The error message should also be changed to start with a lowercase letter (so "file" instead of "File")
It is also strange that -Cprofile-generate
works with relative paths but -Cprofile-use
does not..
Maybe that should be consistent somehow...
I believe -Cprofile-generate
will just write the relative dir into the binary, so wherever you run the binary it will write to that path (ie. rustc never needs to do any IO with that path). If you run rustc by hand relative paths should work fine with -Cprofile-use
though.
Oh and the rustc book mentions this:
It is recommended to use absolute paths for the argument of -Cprofile-generate and -Cprofile-use. Cargo can invoke rustc with varying working directories, meaning that rustc will not be able to find the supplied .profdata file. With absolute paths this is not an issue.
I get an error with absolute path instead of some reason:
The file certainly exists :confused:
Possibly related #115344
The file is definitely there, but for some reason it is not found??
rustc 1.38.0-nightly (c43d03a19 2019-08-14)