Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #101315

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4eae7a1
don't ICE when normalizing closure input tys
aliemjay Jul 27, 2022
6b68921
Change implementation of `-Z gcc-ld` and `lld-wrapper` again
petrochenkov Aug 6, 2022
38de102
Support eager and lazy methods for providing references and values
shepmaster Jul 21, 2022
260ec93
Add `Provider::{would_be_satisfied_by_value_of,would_be_satisfied_by_…
shepmaster Jul 22, 2022
81a583c
Try normalizing types without RevealAll in ParamEnv in mir validation
Noratrieb Aug 3, 2022
96d4137
Only normalize once in mir validator typechecker
Noratrieb Aug 6, 2022
54645e8
set up rustc_metadata for SessionDiagnostics, port dependency_format.rs
CleanCut Aug 23, 2022
3ed9310
port native_libs.rs to SessionDiagnostics
CleanCut Aug 23, 2022
f7e462a
port encoder.rs to SessionDiagnostics
CleanCut Aug 23, 2022
32e1823
port creader.rs to SessionDiagnostics
CleanCut Aug 23, 2022
bd8e312
port fs.rs to SessionDiagnostics
CleanCut Aug 23, 2022
d0ba1fb
port of locator.rs to SessionDiagnostics, fix some of the errors
CleanCut Aug 24, 2022
0d65819
respond to review feedback: mainly eliminate as many conversions as p…
CleanCut Aug 26, 2022
30adfd6
port 5 new diagnostics that appeared in master
CleanCut Aug 27, 2022
1171697
Generate error index with mdbook instead of raw HTML pages
GuillaumeGomez Aug 29, 2022
630f831
Use `FILE_ATTRIBUTE_TAG_INFO` to get reparse tag
ChrisDenton Sep 1, 2022
f5857d5
Move error code book into a sub folder
GuillaumeGomez Aug 31, 2022
096efc2
rustdoc: remove unused CSS `#main-content > .since`
notriddle Sep 1, 2022
e5d60af
Simplify MIR opt tests
JakobDegen Aug 21, 2022
a53e417
Rollup merge of #99583 - shepmaster:provider-plus-plus, r=yaahc
Dylan-DPC Sep 2, 2022
aae7b23
Rollup merge of #99818 - aliemjay:fix-closure-normalize, r=estebank
Dylan-DPC Sep 2, 2022
0d368cd
Rollup merge of #100121 - Nilstrieb:mir-validator-param-env, r=oli-obk
Dylan-DPC Sep 2, 2022
b15dd6e
Rollup merge of #100200 - petrochenkov:zgccld2, r=lqd,Mark-Simulacrum
Dylan-DPC Sep 2, 2022
77b74d6
Rollup merge of #100827 - JakobDegen:better-tests, r=wesleywiser
Dylan-DPC Sep 2, 2022
19f3a31
Rollup merge of #100928 - CleanCut:rustc_metadata_diagnostics, r=davi…
Dylan-DPC Sep 2, 2022
2143179
Rollup merge of #101166 - GuillaumeGomez:error-index-mdbook, r=notriddle
Dylan-DPC Sep 2, 2022
fc65833
Rollup merge of #101260 - ChrisDenton:attribute-tag, r=thomcc
Dylan-DPC Sep 2, 2022
3b44a86
Rollup merge of #101298 - notriddle:notriddle/rustdoc-main-since, r=G…
Dylan-DPC Sep 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
port fs.rs to SessionDiagnostics
  • Loading branch information
CleanCut committed Aug 31, 2022
commit bd8e312d73f07517e24a58a201e8524ebe4da8da
12 changes: 12 additions & 0 deletions compiler/rustc_error_messages/locales/en-US/metadata.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,15 @@ metadata_global_alloc_required =

metadata_no_transitive_needs_dep =
the crate `{$crate_name}` cannot depend on a crate that needs {$needs_crate_name}, but it depends on `{$deps_crate_name}`

metadata_failed_write_error =
failed to write {$filename}: {$err}

metadata_failed_create_tempdir =
couldn't create a temp dir: {$err}

metadata_failed_create_file =
failed to create the file {$filename}: {$err}

metadata_failed_create_encoded_metadata =
failed to create encoded metadata from file: {$err}
26 changes: 26 additions & 0 deletions compiler/rustc_metadata/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,29 @@ pub struct NoTransitiveNeedsDep {
pub needs_crate_name: String,
pub deps_crate_name: String,
}

#[derive(SessionDiagnostic)]
#[diag(metadata::failed_write_error)]
pub struct FailedWriteError {
pub filename: String,
pub err: String,
}

#[derive(SessionDiagnostic)]
#[diag(metadata::failed_create_tempdir)]
pub struct FailedCreateTempdir {
pub err: String,
}

#[derive(SessionDiagnostic)]
#[diag(metadata::failed_create_file)]
pub struct FailedCreateFile {
pub filename: String,
pub err: String,
}

#[derive(SessionDiagnostic)]
#[diag(metadata::failed_create_encoded_metadata)]
pub struct FailedCreateEncodedMetadata {
pub err: String,
}
26 changes: 17 additions & 9 deletions compiler/rustc_metadata/src/fs.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
use crate::errors::{
FailedCreateEncodedMetadata, FailedCreateFile, FailedCreateTempdir, FailedWriteError,
};
use crate::{encode_metadata, EncodedMetadata};

use rustc_data_structures::temp_dir::MaybeTempDir;
Expand All @@ -24,7 +27,10 @@ pub fn emit_metadata(sess: &Session, metadata: &[u8], tmpdir: &MaybeTempDir) ->
let result = fs::write(&out_filename, metadata);

if let Err(e) = result {
sess.fatal(&format!("failed to write {}: {}", out_filename.display(), e));
sess.emit_fatal(FailedWriteError {
filename: out_filename.display().to_string(),
err: e.to_string(),
});
}

out_filename
Expand Down Expand Up @@ -65,7 +71,7 @@ pub fn encode_and_write_metadata(
let metadata_tmpdir = TempFileBuilder::new()
.prefix("rmeta")
.tempdir_in(out_filename.parent().unwrap_or_else(|| Path::new("")))
.unwrap_or_else(|err| tcx.sess.fatal(&format!("couldn't create a temp dir: {}", err)));
.unwrap_or_else(|err| tcx.sess.emit_fatal(FailedCreateTempdir { err: err.to_string() }));
let metadata_tmpdir = MaybeTempDir::new(metadata_tmpdir, tcx.sess.opts.cg.save_temps);
let metadata_filename = metadata_tmpdir.as_ref().join(METADATA_FILENAME);

Expand All @@ -74,11 +80,10 @@ pub fn encode_and_write_metadata(
match metadata_kind {
MetadataKind::None => {
std::fs::File::create(&metadata_filename).unwrap_or_else(|e| {
tcx.sess.fatal(&format!(
"failed to create the file {}: {}",
metadata_filename.display(),
e
))
tcx.sess.emit_fatal(FailedCreateFile {
filename: metadata_filename.display().to_string(),
err: e.to_string(),
});
});
}
MetadataKind::Uncompressed | MetadataKind::Compressed => {
Expand All @@ -94,7 +99,10 @@ pub fn encode_and_write_metadata(
let need_metadata_file = tcx.sess.opts.output_types.contains_key(&OutputType::Metadata);
let (metadata_filename, metadata_tmpdir) = if need_metadata_file {
if let Err(e) = non_durable_rename(&metadata_filename, &out_filename) {
tcx.sess.fatal(&format!("failed to write {}: {}", out_filename.display(), e));
tcx.sess.emit_fatal(FailedWriteError {
filename: out_filename.display().to_string(),
err: e.to_string(),
});
}
if tcx.sess.opts.json_artifact_notifications {
tcx.sess
Expand All @@ -110,7 +118,7 @@ pub fn encode_and_write_metadata(
// Load metadata back to memory: codegen may need to include it in object files.
let metadata =
EncodedMetadata::from_path(metadata_filename, metadata_tmpdir).unwrap_or_else(|e| {
tcx.sess.fatal(&format!("failed to create encoded metadata from file: {}", e))
tcx.sess.emit_fatal(FailedCreateEncodedMetadata { err: e.to_string() });
});

let need_metadata_module = metadata_kind == MetadataKind::Compressed;
Expand Down