summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_incremental/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
commit9918693037dce8aa4bb6f08741b6812923486c18 (patch)
tree21d2b40bec7e6a7ea664acee056eb3d08e15a1cf /compiler/rustc_incremental/src
parentReleasing progress-linux version 1.75.0+dfsg1-5~progress7.99u1. (diff)
downloadrustc-9918693037dce8aa4bb6f08741b6812923486c18.tar.xz
rustc-9918693037dce8aa4bb6f08741b6812923486c18.zip
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_incremental/src')
-rw-r--r--compiler/rustc_incremental/src/assert_dep_graph.rs10
-rw-r--r--compiler/rustc_incremental/src/lib.rs11
-rw-r--r--compiler/rustc_incremental/src/persist/dirty_clean.rs9
-rw-r--r--compiler/rustc_incremental/src/persist/file_format.rs4
-rw-r--r--compiler/rustc_incremental/src/persist/fs.rs14
-rw-r--r--compiler/rustc_incremental/src/persist/load.rs2
-rw-r--r--compiler/rustc_incremental/src/persist/save.rs7
-rw-r--r--compiler/rustc_incremental/src/persist/work_product.rs2
8 files changed, 26 insertions, 33 deletions
diff --git a/compiler/rustc_incremental/src/assert_dep_graph.rs b/compiler/rustc_incremental/src/assert_dep_graph.rs
index 1b160eca9..a5e0654c8 100644
--- a/compiler/rustc_incremental/src/assert_dep_graph.rs
+++ b/compiler/rustc_incremental/src/assert_dep_graph.rs
@@ -122,7 +122,7 @@ impl<'tcx> IfThisChanged<'tcx> {
fn process_attrs(&mut self, def_id: LocalDefId) {
let def_path_hash = self.tcx.def_path_hash(def_id.to_def_id());
- let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id);
+ let hir_id = self.tcx.local_def_id_to_hir_id(def_id);
let attrs = self.tcx.hir().attrs(hir_id);
for attr in attrs {
if attr.has_name(sym::rustc_if_this_changed) {
@@ -231,13 +231,13 @@ fn dump_graph(query: &DepGraphQuery) {
// Expect one of: "-> target", "source -> target", or "source ->".
let edge_filter =
EdgeFilter::new(&string).unwrap_or_else(|e| bug!("invalid filter: {}", e));
- let sources = node_set(&query, &edge_filter.source);
- let targets = node_set(&query, &edge_filter.target);
- filter_nodes(&query, &sources, &targets)
+ let sources = node_set(query, &edge_filter.source);
+ let targets = node_set(query, &edge_filter.target);
+ filter_nodes(query, &sources, &targets)
}
Err(_) => query.nodes().into_iter().map(|n| n.kind).collect(),
};
- let edges = filter_edges(&query, &nodes);
+ let edges = filter_edges(query, &nodes);
{
// dump a .txt file with just the edges:
diff --git a/compiler/rustc_incremental/src/lib.rs b/compiler/rustc_incremental/src/lib.rs
index dde138973..367a15e14 100644
--- a/compiler/rustc_incremental/src/lib.rs
+++ b/compiler/rustc_incremental/src/lib.rs
@@ -2,9 +2,9 @@
#![deny(missing_docs)]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
-#![cfg_attr(not(bootstrap), doc(rust_logo))]
-#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
-#![cfg_attr(not(bootstrap), allow(internal_features))]
+#![doc(rust_logo)]
+#![feature(rustdoc_internals)]
+#![allow(internal_features)]
#![recursion_limit = "256"]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
@@ -28,7 +28,4 @@ pub use persist::save_work_product_index;
pub use persist::setup_dep_graph;
pub use persist::LoadResult;
-use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
-use rustc_fluent_macro::fluent_messages;
-
-fluent_messages! { "../messages.ftl" }
+rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
diff --git a/compiler/rustc_incremental/src/persist/dirty_clean.rs b/compiler/rustc_incremental/src/persist/dirty_clean.rs
index 5dd06c6ca..8a7b97139 100644
--- a/compiler/rustc_incremental/src/persist/dirty_clean.rs
+++ b/compiler/rustc_incremental/src/persist/dirty_clean.rs
@@ -32,7 +32,6 @@ use rustc_middle::hir::nested_filter;
use rustc_middle::ty::TyCtxt;
use rustc_span::symbol::{sym, Symbol};
use rustc_span::Span;
-use std::iter::FromIterator;
use thin_vec::ThinVec;
const LOADED_FROM_DISK: Symbol = sym::loaded_from_disk;
@@ -233,7 +232,7 @@ impl<'tcx> DirtyCleanVisitor<'tcx> {
/// Return all DepNode labels that should be asserted for this item.
/// index=0 is the "name" used for error messages
fn auto_labels(&mut self, item_id: LocalDefId, attr: &Attribute) -> (&'static str, Labels) {
- let node = self.tcx.hir().get_by_def_id(item_id);
+ let node = self.tcx.hir_node_by_def_id(item_id);
let (name, labels) = match node {
HirNode::Item(item) => {
match item.kind {
@@ -378,15 +377,15 @@ impl<'tcx> DirtyCleanVisitor<'tcx> {
};
self.checked_attrs.insert(attr.id);
for label in assertion.clean.items().into_sorted_stable_ord() {
- let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
+ let dep_node = DepNode::from_label_string(self.tcx, label, def_path_hash).unwrap();
self.assert_clean(item_span, dep_node);
}
for label in assertion.dirty.items().into_sorted_stable_ord() {
- let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
+ let dep_node = DepNode::from_label_string(self.tcx, label, def_path_hash).unwrap();
self.assert_dirty(item_span, dep_node);
}
for label in assertion.loaded_from_disk.items().into_sorted_stable_ord() {
- let dep_node = DepNode::from_label_string(self.tcx, &label, def_path_hash).unwrap();
+ let dep_node = DepNode::from_label_string(self.tcx, label, def_path_hash).unwrap();
self.assert_loaded_from_disk(item_span, dep_node);
}
}
diff --git a/compiler/rustc_incremental/src/persist/file_format.rs b/compiler/rustc_incremental/src/persist/file_format.rs
index 25bf83f64..b5742b97d 100644
--- a/compiler/rustc_incremental/src/persist/file_format.rs
+++ b/compiler/rustc_incremental/src/persist/file_format.rs
@@ -80,8 +80,8 @@ where
);
debug!("save: data written to disk successfully");
}
- Err(err) => {
- sess.emit_err(errors::WriteNew { name, path: path_buf, err });
+ Err((path, err)) => {
+ sess.emit_err(errors::WriteNew { name, path, err });
}
}
}
diff --git a/compiler/rustc_incremental/src/persist/fs.rs b/compiler/rustc_incremental/src/persist/fs.rs
index f56fb0d05..92297a27a 100644
--- a/compiler/rustc_incremental/src/persist/fs.rs
+++ b/compiler/rustc_incremental/src/persist/fs.rs
@@ -262,7 +262,7 @@ pub(crate) fn prepare_session_directory(
directory."
);
- sess.init_incr_comp_session(session_dir, directory_lock, false);
+ sess.init_incr_comp_session(session_dir, directory_lock);
return Ok(());
};
@@ -276,7 +276,7 @@ pub(crate) fn prepare_session_directory(
sess.emit_warning(errors::HardLinkFailed { path: &session_dir });
}
- sess.init_incr_comp_session(session_dir, directory_lock, true);
+ sess.init_incr_comp_session(session_dir, directory_lock);
return Ok(());
} else {
debug!("copying failed - trying next directory");
@@ -312,7 +312,7 @@ pub fn finalize_session_directory(sess: &Session, svh: Option<Svh>) {
let incr_comp_session_dir: PathBuf = sess.incr_comp_session_dir().clone();
- if let Some(_) = sess.has_errors_or_delayed_span_bugs() {
+ if let Some(_) = sess.has_errors_or_span_delayed_bugs() {
// If there have been any errors during compilation, we don't want to
// publish this session directory. Rather, we'll just delete it.
@@ -499,7 +499,7 @@ fn lock_directory(
}
fn delete_session_dir_lock_file(sess: &Session, lock_file_path: &Path) {
- if let Err(err) = safe_remove_file(&lock_file_path) {
+ if let Err(err) = safe_remove_file(lock_file_path) {
sess.emit_warning(errors::DeleteLock { path: lock_file_path, err });
}
}
@@ -847,10 +847,10 @@ pub(crate) fn garbage_collect_session_directories(sess: &Session) -> io::Result<
fn delete_old(sess: &Session, path: &Path) {
debug!("garbage_collect_session_directories() - deleting `{}`", path.display());
- if let Err(err) = safe_remove_dir_all(&path) {
- sess.emit_warning(errors::SessionGcFailed { path: &path, err });
+ if let Err(err) = safe_remove_dir_all(path) {
+ sess.emit_warning(errors::SessionGcFailed { path: path, err });
} else {
- delete_session_dir_lock_file(sess, &lock_file_path(&path));
+ delete_session_dir_lock_file(sess, &lock_file_path(path));
}
}
diff --git a/compiler/rustc_incremental/src/persist/load.rs b/compiler/rustc_incremental/src/persist/load.rs
index 6dfc40969..f2c1d0b83 100644
--- a/compiler/rustc_incremental/src/persist/load.rs
+++ b/compiler/rustc_incremental/src/persist/load.rs
@@ -99,7 +99,7 @@ fn load_dep_graph(sess: &Session) -> LoadResult<(SerializedDepGraph, WorkProduct
// Calling `sess.incr_comp_session_dir()` will panic if `sess.opts.incremental.is_none()`.
// Fortunately, we just checked that this isn't the case.
- let path = dep_graph_path(&sess);
+ let path = dep_graph_path(sess);
let expected_hash = sess.opts.dep_tracking_hash(false);
let mut prev_work_products = UnordMap::default();
diff --git a/compiler/rustc_incremental/src/persist/save.rs b/compiler/rustc_incremental/src/persist/save.rs
index fa21320be..ff0953e9f 100644
--- a/compiler/rustc_incremental/src/persist/save.rs
+++ b/compiler/rustc_incremental/src/persist/save.rs
@@ -32,7 +32,7 @@ pub fn save_dep_graph(tcx: TyCtxt<'_>) {
return;
}
// This is going to be deleted in finalize_session_directory, so let's not create it
- if let Some(_) = sess.has_errors_or_delayed_span_bugs() {
+ if let Some(_) = sess.has_errors_or_span_delayed_bugs() {
return;
}
@@ -50,9 +50,6 @@ pub fn save_dep_graph(tcx: TyCtxt<'_>) {
join(
move || {
sess.time("incr_comp_persist_dep_graph", || {
- if let Err(err) = tcx.dep_graph.encode(&tcx.sess.prof) {
- sess.emit_err(errors::WriteDepGraph { path: &staging_dep_graph_path, err });
- }
if let Err(err) = fs::rename(&staging_dep_graph_path, &dep_graph_path) {
sess.emit_err(errors::MoveDepGraph {
from: &staging_dep_graph_path,
@@ -90,7 +87,7 @@ pub fn save_work_product_index(
return;
}
// This is going to be deleted in finalize_session_directory, so let's not create it
- if let Some(_) = sess.has_errors_or_delayed_span_bugs() {
+ if let Some(_) = sess.has_errors_or_span_delayed_bugs() {
return;
}
diff --git a/compiler/rustc_incremental/src/persist/work_product.rs b/compiler/rustc_incremental/src/persist/work_product.rs
index fb96bed5a..1ee3d1392 100644
--- a/compiler/rustc_incremental/src/persist/work_product.rs
+++ b/compiler/rustc_incremental/src/persist/work_product.rs
@@ -31,7 +31,7 @@ pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
}
Err(err) => {
sess.emit_warning(errors::CopyWorkProductToCache {
- from: &path,
+ from: path,
to: &path_in_incr_dir,
err,
});