Skip to content

Commit 8396efe

Browse files
committed
Auto merge of #117228 - matthiaskrgr:rollup-23zzepv, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #116905 (refactor(compiler/resolve): simplify some code) - #117095 (Add way to differentiate argument locals from other locals in Stable MIR) - #117143 (Avoid unbounded O(n^2) when parsing nested type args) - #117194 (Minor improvements to `rustc_incremental`) - #117202 (Revert "Remove TaKO8Ki from reviewers") - #117207 (The value of `-Cinstrument-coverage=` doesn't need to be `Option`) - #117214 (Quietly fail if an error has already occurred) - #117221 (Rename type flag `HAS_TY_GENERATOR` to `HAS_TY_COROUTINE`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 698db85 + a461de7 commit 8396efe

File tree

104 files changed

+278
-82
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+278
-82
lines changed

compiler/rustc_borrowck/src/type_check/free_region_relations.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_infer::infer::InferCtxt;
88
use rustc_middle::mir::ConstraintCategory;
99
use rustc_middle::traits::query::OutlivesBound;
1010
use rustc_middle::ty::{self, RegionVid, Ty};
11-
use rustc_span::{Span, DUMMY_SP};
11+
use rustc_span::{ErrorGuaranteed, Span, DUMMY_SP};
1212
use rustc_trait_selection::traits::query::type_op::{self, TypeOp};
1313
use std::rc::Rc;
1414
use type_op::TypeOpOutput;
@@ -318,7 +318,8 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
318318
.param_env
319319
.and(type_op::implied_outlives_bounds::ImpliedOutlivesBounds { ty })
320320
.fully_perform(self.infcx, DUMMY_SP)
321-
.unwrap_or_else(|_| bug!("failed to compute implied bounds {:?}", ty));
321+
.map_err(|_: ErrorGuaranteed| debug!("failed to compute implied bounds {:?}", ty))
322+
.ok()?;
322323
debug!(?bounds, ?constraints);
323324
self.add_outlives_bounds(bounds);
324325
constraints

compiler/rustc_incremental/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#![cfg_attr(not(bootstrap), doc(rust_logo))]
66
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
77
#![cfg_attr(not(bootstrap), allow(internal_features))]
8-
#![feature(never_type)]
98
#![recursion_limit = "256"]
109
#![deny(rustc::untranslatable_diagnostic)]
1110
#![deny(rustc::diagnostic_outside_of_impl)]
@@ -19,15 +18,11 @@ mod assert_dep_graph;
1918
mod errors;
2019
mod persist;
2120

22-
use assert_dep_graph::assert_dep_graph;
2321
pub use persist::copy_cgu_workproduct_to_incr_comp_cache_dir;
24-
pub use persist::delete_workproduct_files;
2522
pub use persist::finalize_session_directory;
26-
pub use persist::garbage_collect_session_directories;
2723
pub use persist::in_incr_comp_dir;
2824
pub use persist::in_incr_comp_dir_sess;
2925
pub use persist::load_query_result_cache;
30-
pub use persist::prepare_session_directory;
3126
pub use persist::save_dep_graph;
3227
pub use persist::save_work_product_index;
3328
pub use persist::setup_dep_graph;

compiler/rustc_incremental/src/persist/fs.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
//! ## Synchronization
5454
//!
5555
//! There is some synchronization needed in order for the compiler to be able to
56-
//! determine whether a given private session directory is not in used any more.
56+
//! determine whether a given private session directory is not in use any more.
5757
//! This is done by creating a lock file for each session directory and
5858
//! locking it while the directory is still being used. Since file locks have
5959
//! operating system support, we can rely on the lock being released if the
@@ -136,26 +136,29 @@ const QUERY_CACHE_FILENAME: &str = "query-cache.bin";
136136
const INT_ENCODE_BASE: usize = base_n::CASE_INSENSITIVE;
137137

138138
/// Returns the path to a session's dependency graph.
139-
pub fn dep_graph_path(sess: &Session) -> PathBuf {
139+
pub(crate) fn dep_graph_path(sess: &Session) -> PathBuf {
140140
in_incr_comp_dir_sess(sess, DEP_GRAPH_FILENAME)
141141
}
142+
142143
/// Returns the path to a session's staging dependency graph.
143144
///
144145
/// On the difference between dep-graph and staging dep-graph,
145146
/// see `build_dep_graph`.
146-
pub fn staging_dep_graph_path(sess: &Session) -> PathBuf {
147+
pub(crate) fn staging_dep_graph_path(sess: &Session) -> PathBuf {
147148
in_incr_comp_dir_sess(sess, STAGING_DEP_GRAPH_FILENAME)
148149
}
149-
pub fn work_products_path(sess: &Session) -> PathBuf {
150+
151+
pub(crate) fn work_products_path(sess: &Session) -> PathBuf {
150152
in_incr_comp_dir_sess(sess, WORK_PRODUCTS_FILENAME)
151153
}
154+
152155
/// Returns the path to a session's query cache.
153156
pub fn query_cache_path(sess: &Session) -> PathBuf {
154157
in_incr_comp_dir_sess(sess, QUERY_CACHE_FILENAME)
155158
}
156159

157160
/// Locks a given session directory.
158-
pub fn lock_file_path(session_dir: &Path) -> PathBuf {
161+
fn lock_file_path(session_dir: &Path) -> PathBuf {
159162
let crate_dir = session_dir.parent().unwrap();
160163

161164
let directory_name = session_dir.file_name().unwrap().to_string_lossy();
@@ -202,7 +205,7 @@ pub fn in_incr_comp_dir(incr_comp_session_dir: &Path, file_name: &str) -> PathBu
202205
/// The garbage collection will take care of it.
203206
///
204207
/// [`rustc_interface::queries::dep_graph`]: ../../rustc_interface/struct.Queries.html#structfield.dep_graph
205-
pub fn prepare_session_directory(
208+
pub(crate) fn prepare_session_directory(
206209
sess: &Session,
207210
crate_name: Symbol,
208211
stable_crate_id: StableCrateId,
@@ -373,7 +376,7 @@ pub fn finalize_session_directory(sess: &Session, svh: Option<Svh>) {
373376
let _ = garbage_collect_session_directories(sess);
374377
}
375378

376-
pub fn delete_all_session_dir_contents(sess: &Session) -> io::Result<()> {
379+
pub(crate) fn delete_all_session_dir_contents(sess: &Session) -> io::Result<()> {
377380
let sess_dir_iterator = sess.incr_comp_session_dir().read_dir()?;
378381
for entry in sess_dir_iterator {
379382
let entry = entry?;
@@ -621,7 +624,7 @@ fn is_old_enough_to_be_collected(timestamp: SystemTime) -> bool {
621624
}
622625

623626
/// Runs garbage collection for the current session.
624-
pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> {
627+
pub(crate) fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> {
625628
debug!("garbage_collect_session_directories() - begin");
626629

627630
let session_directory = sess.incr_comp_session_dir();

compiler/rustc_incremental/src/persist/load.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Code to save/load the dep-graph from files.
1+
//! Code to load the dep-graph from files.
22
33
use crate::errors;
44
use rustc_data_structures::memmap::Mmap;

compiler/rustc_incremental/src/persist/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,11 @@ mod save;
1111
mod work_product;
1212

1313
pub use fs::finalize_session_directory;
14-
pub use fs::garbage_collect_session_directories;
1514
pub use fs::in_incr_comp_dir;
1615
pub use fs::in_incr_comp_dir_sess;
17-
pub use fs::prepare_session_directory;
1816
pub use load::load_query_result_cache;
1917
pub use load::setup_dep_graph;
2018
pub use load::LoadResult;
2119
pub use save::save_dep_graph;
2220
pub use save::save_work_product_index;
2321
pub use work_product::copy_cgu_workproduct_to_incr_comp_cache_dir;
24-
pub use work_product::delete_workproduct_files;

compiler/rustc_incremental/src/persist/save.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::assert_dep_graph::assert_dep_graph;
12
use crate::errors;
23
use rustc_data_structures::fx::FxIndexMap;
34
use rustc_data_structures::sync::join;
@@ -39,7 +40,7 @@ pub fn save_dep_graph(tcx: TyCtxt<'_>) {
3940
let dep_graph_path = dep_graph_path(sess);
4041
let staging_dep_graph_path = staging_dep_graph_path(sess);
4142

42-
sess.time("assert_dep_graph", || crate::assert_dep_graph(tcx));
43+
sess.time("assert_dep_graph", || assert_dep_graph(tcx));
4344
sess.time("check_dirty_clean", || dirty_clean::check_dirty_clean_annotations(tcx));
4445

4546
if sess.opts.unstable_opts.incremental_info {

compiler/rustc_incremental/src/persist/work_product.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ use rustc_session::Session;
1111
use std::fs as std_fs;
1212
use std::path::Path;
1313

14-
/// Copies a CGU work product to the incremental compilation directory, so next compilation can find and reuse it.
14+
/// Copies a CGU work product to the incremental compilation directory, so next compilation can
15+
/// find and reuse it.
1516
pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
1617
sess: &Session,
1718
cgu_name: &str,
@@ -45,7 +46,7 @@ pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
4546
}
4647

4748
/// Removes files for a given work product.
48-
pub fn delete_workproduct_files(sess: &Session, work_product: &WorkProduct) {
49+
pub(crate) fn delete_workproduct_files(sess: &Session, work_product: &WorkProduct) {
4950
for (_, path) in work_product.saved_files.items().into_sorted_stable_ord() {
5051
let path = in_incr_comp_dir_sess(sess, path);
5152
if let Err(err) = std_fs::remove_file(&path) {

compiler/rustc_interface/src/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ fn test_codegen_options_tracking_hash() {
614614
tracked!(force_frame_pointers, Some(false));
615615
tracked!(force_unwind_tables, Some(true));
616616
tracked!(inline_threshold, Some(0xf007ba11));
617-
tracked!(instrument_coverage, Some(InstrumentCoverage::All));
617+
tracked!(instrument_coverage, InstrumentCoverage::All);
618618
tracked!(link_dead_code, Some(true));
619619
tracked!(linker_plugin_lto, LinkerPluginLto::LinkerPluginAuto);
620620
tracked!(llvm_args, vec![String::from("1"), String::from("2")]);

compiler/rustc_middle/src/ty/flags.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl FlagComputation {
134134
if should_remove_further_specializable {
135135
self.flags -= TypeFlags::STILL_FURTHER_SPECIALIZABLE;
136136
}
137-
self.add_flags(TypeFlags::HAS_TY_GENERATOR);
137+
self.add_flags(TypeFlags::HAS_TY_COROUTINE);
138138
}
139139

140140
&ty::Closure(_, args) => {

compiler/rustc_middle/src/ty/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub trait TypeVisitableExt<'tcx>: TypeVisitable<TyCtxt<'tcx>> {
4848
self.has_type_flags(TypeFlags::HAS_TY_OPAQUE)
4949
}
5050
fn has_coroutines(&self) -> bool {
51-
self.has_type_flags(TypeFlags::HAS_TY_GENERATOR)
51+
self.has_type_flags(TypeFlags::HAS_TY_COROUTINE)
5252
}
5353
fn references_error(&self) -> bool {
5454
self.has_type_flags(TypeFlags::HAS_ERROR)

0 commit comments

Comments
 (0)