use &Path instead of AsRef<Path>

This commit is contained in:
Yoshiki Matsuda 2022-05-08 11:24:48 +09:00
parent dcb599fe6c
commit 47c36893a1

View File

@ -2195,7 +2195,7 @@ impl<D: Decoder> Decodable<D> for EncodedMetadata {
}
}
pub fn encode_metadata(tcx: TyCtxt<'_>, path: impl AsRef<Path> + Send) {
pub fn encode_metadata(tcx: TyCtxt<'_>, path: &Path) {
let _prof_timer = tcx.prof.verbose_generic_activity("generate_crate_metadata");
// Since encoding metadata is not in a query, and nothing is cached,
@ -2216,8 +2216,8 @@ pub fn encode_metadata(tcx: TyCtxt<'_>, path: impl AsRef<Path> + Send) {
);
}
fn encode_metadata_impl(tcx: TyCtxt<'_>, path: impl AsRef<Path>) {
let mut encoder = opaque::FileEncoder::new(path.as_ref())
fn encode_metadata_impl(tcx: TyCtxt<'_>, path: &Path) {
let mut encoder = opaque::FileEncoder::new(path)
.unwrap_or_else(|err| tcx.sess.fatal(&format!("failed to create file encoder: {}", err)));
encoder.emit_raw_bytes(METADATA_HEADER);