Skip to content

Commit c4ec606

Browse files
committed
Auto merge of rust-lang#85734 - Dylan-DPC:rollup-q6iiees, r=Dylan-DPC
Rollup of 8 pull requests Successful merges: - rust-lang#84221 (E0599 suggestions and elision of generic argument if no canditate is found) - rust-lang#84701 (stabilize member constraints) - rust-lang#85564 ( readd capture disjoint fields gate) - rust-lang#85583 (Get rid of PreviousDepGraph.) - rust-lang#85649 (Update cc) - rust-lang#85689 (Remove Iterator #[rustc_on_unimplemented]s that no longer apply.) - rust-lang#85719 (Add inline attr to CString::into_inner so it can optimize out NonNull checks) - rust-lang#85725 (Remove unneeded workaround) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 86ac0b4 + 85a408a commit c4ec606

File tree

55 files changed

+447
-388
lines changed

Some content is hidden

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

55 files changed

+447
-388
lines changed

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,9 @@ version = "0.1.0"
441441

442442
[[package]]
443443
name = "cc"
444-
version = "1.0.67"
444+
version = "1.0.68"
445445
source = "registry+https://github.com/rust-lang/crates.io-index"
446-
checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd"
446+
checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787"
447447
dependencies = [
448448
"jobserver",
449449
]

compiler/rustc_codegen_ssa/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test = false
99

1010
[dependencies]
1111
bitflags = "1.2.1"
12-
cc = "1.0.67"
12+
cc = "1.0.68"
1313
itertools = "0.9"
1414
tracing = "0.1"
1515
libc = "0.2.50"
@@ -24,7 +24,7 @@ rustc_middle = { path = "../rustc_middle" }
2424
rustc_apfloat = { path = "../rustc_apfloat" }
2525
rustc_attr = { path = "../rustc_attr" }
2626
rustc_symbol_mangling = { path = "../rustc_symbol_mangling" }
27-
rustc_data_structures = { path = "../rustc_data_structures"}
27+
rustc_data_structures = { path = "../rustc_data_structures" }
2828
rustc_errors = { path = "../rustc_errors" }
2929
rustc_fs_util = { path = "../rustc_fs_util" }
3030
rustc_hir = { path = "../rustc_hir" }

compiler/rustc_feature/src/accepted.rs

+2
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ declare_features! (
285285
(accepted, extended_key_value_attributes, "1.54.0", Some(78835), None),
286286
/// Allows unsizing coercions in `const fn`.
287287
(accepted, const_fn_unsize, "1.54.0", Some(64992), None),
288+
/// Allows `impl Trait` with multiple unrelated lifetimes.
289+
(accepted, member_constraints, "1.54.0", Some(61997), None),
288290

289291
// -------------------------------------------------------------------------
290292
// feature-group-end: accepted features

compiler/rustc_feature/src/active.rs

-3
Original file line numberDiff line numberDiff line change
@@ -472,9 +472,6 @@ declare_features! (
472472
/// Allows explicit discriminants on non-unit enum variants.
473473
(active, arbitrary_enum_discriminant, "1.37.0", Some(60553), None),
474474

475-
/// Allows `impl Trait` with multiple unrelated lifetimes.
476-
(active, member_constraints, "1.37.0", Some(61997), None),
477-
478475
/// Allows `async || body` closures.
479476
(active, async_closure, "1.37.0", Some(62290), None),
480477

compiler/rustc_incremental/src/persist/load.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use rustc_data_structures::fx::FxHashMap;
44
use rustc_hir::definitions::DefPathTable;
5-
use rustc_middle::dep_graph::{PreviousDepGraph, SerializedDepGraph, WorkProduct, WorkProductId};
5+
use rustc_middle::dep_graph::{SerializedDepGraph, WorkProduct, WorkProductId};
66
use rustc_middle::ty::query::OnDiskCache;
77
use rustc_serialize::opaque::Decoder;
88
use rustc_serialize::Decodable;
@@ -22,8 +22,8 @@ pub enum LoadResult<T> {
2222
Error { message: String },
2323
}
2424

25-
impl LoadResult<(PreviousDepGraph, WorkProductMap)> {
26-
pub fn open(self, sess: &Session) -> (PreviousDepGraph, WorkProductMap) {
25+
impl LoadResult<(SerializedDepGraph, WorkProductMap)> {
26+
pub fn open(self, sess: &Session) -> (SerializedDepGraph, WorkProductMap) {
2727
match self {
2828
LoadResult::Error { message } => {
2929
sess.warn(&message);
@@ -84,7 +84,7 @@ impl<T> MaybeAsync<T> {
8484
}
8585
}
8686

87-
pub type DepGraphFuture = MaybeAsync<LoadResult<(PreviousDepGraph, WorkProductMap)>>;
87+
pub type DepGraphFuture = MaybeAsync<LoadResult<(SerializedDepGraph, WorkProductMap)>>;
8888

8989
/// Launch a thread and load the dependency graph in the background.
9090
pub fn load_dep_graph(sess: &Session) -> DepGraphFuture {
@@ -185,7 +185,7 @@ pub fn load_dep_graph(sess: &Session) -> DepGraphFuture {
185185
let dep_graph = SerializedDepGraph::decode(&mut decoder)
186186
.expect("Error reading cached dep-graph");
187187

188-
LoadResult::Ok { data: (PreviousDepGraph::new(dep_graph), prev_work_products) }
188+
LoadResult::Ok { data: (dep_graph, prev_work_products) }
189189
}
190190
}
191191
}))

compiler/rustc_incremental/src/persist/save.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc_data_structures::fx::FxHashMap;
22
use rustc_data_structures::sync::join;
3-
use rustc_middle::dep_graph::{DepGraph, PreviousDepGraph, WorkProduct, WorkProductId};
3+
use rustc_middle::dep_graph::{DepGraph, SerializedDepGraph, WorkProduct, WorkProductId};
44
use rustc_middle::ty::TyCtxt;
55
use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
66
use rustc_serialize::Encodable as RustcEncodable;
@@ -186,7 +186,7 @@ fn encode_query_cache(tcx: TyCtxt<'_>, encoder: &mut FileEncoder) -> FileEncodeR
186186

187187
pub fn build_dep_graph(
188188
sess: &Session,
189-
prev_graph: PreviousDepGraph,
189+
prev_graph: SerializedDepGraph,
190190
prev_work_products: FxHashMap<WorkProductId, WorkProduct>,
191191
) -> Option<DepGraph> {
192192
if sess.opts.incremental.is_none() {

compiler/rustc_llvm/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ libc = "0.2.73"
1313

1414
[build-dependencies]
1515
build_helper = { path = "../../src/build_helper" }
16-
cc = "1.0.67"
16+
cc = "1.0.68"

compiler/rustc_middle/src/dep_graph/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ crate use dep_node::{make_compile_codegen_unit, make_compile_mono_item};
1818
pub type DepGraph = rustc_query_system::dep_graph::DepGraph<DepKind>;
1919
pub type TaskDeps = rustc_query_system::dep_graph::TaskDeps<DepKind>;
2020
pub type DepGraphQuery = rustc_query_system::dep_graph::DepGraphQuery<DepKind>;
21-
pub type PreviousDepGraph = rustc_query_system::dep_graph::PreviousDepGraph<DepKind>;
2221
pub type SerializedDepGraph = rustc_query_system::dep_graph::SerializedDepGraph<DepKind>;
2322
pub type EdgeFilter = rustc_query_system::dep_graph::debug::EdgeFilter<DepKind>;
2423

compiler/rustc_mir/src/interpret/place.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use rustc_target::abi::{Abi, Align, FieldsShape, TagEncoding};
1515
use rustc_target::abi::{HasDataLayout, LayoutOf, Size, VariantIdx, Variants};
1616

1717
use super::{
18-
alloc_range, mir_assign_valid_types, AllocId, AllocMap, AllocRef, AllocRefMut, Allocation,
19-
ConstAlloc, ImmTy, Immediate, InterpCx, InterpResult, LocalValue, Machine, MemoryKind, OpTy,
20-
Operand, Pointer, PointerArithmetic, Scalar, ScalarMaybeUninit,
18+
alloc_range, mir_assign_valid_types, AllocRef, AllocRefMut, ConstAlloc, ImmTy, Immediate,
19+
InterpCx, InterpResult, LocalValue, Machine, MemoryKind, OpTy, Operand, Pointer,
20+
PointerArithmetic, Scalar, ScalarMaybeUninit,
2121
};
2222

2323
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable)]
@@ -292,8 +292,6 @@ where
292292
// FIXME: Working around https://github.com/rust-lang/rust/issues/54385
293293
Tag: Debug + Copy + Eq + Hash + 'static,
294294
M: Machine<'mir, 'tcx, PointerTag = Tag>,
295-
// FIXME: Working around https://github.com/rust-lang/rust/issues/24159
296-
M::MemoryMap: AllocMap<AllocId, (MemoryKind<M::MemoryKind>, Allocation<Tag, M::AllocExtra>)>,
297295
{
298296
/// Take a value, which represents a (thin or wide) reference, and make it a place.
299297
/// Alignment is just based on the type. This is the inverse of `MemPlace::to_ref()`.

compiler/rustc_mir_build/src/build/expr/as_rvalue.rs

+20-15
Original file line numberDiff line numberDiff line change
@@ -185,21 +185,26 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
185185
// match x { _ => () } // fake read of `x`
186186
// };
187187
// ```
188-
for (thir_place, cause, hir_id) in fake_reads.into_iter() {
189-
let place_builder =
190-
unpack!(block = this.as_place_builder(block, &this.thir[*thir_place]));
191-
192-
if let Ok(place_builder_resolved) =
193-
place_builder.try_upvars_resolved(this.tcx, this.typeck_results)
194-
{
195-
let mir_place =
196-
place_builder_resolved.into_place(this.tcx, this.typeck_results);
197-
this.cfg.push_fake_read(
198-
block,
199-
this.source_info(this.tcx.hir().span(*hir_id)),
200-
*cause,
201-
mir_place,
202-
);
188+
//
189+
// FIXME(RFC2229, rust#85435): Remove feature gate once diagnostics are
190+
// improved and unsafe checking works properly in closure bodies again.
191+
if this.tcx.features().capture_disjoint_fields {
192+
for (thir_place, cause, hir_id) in fake_reads.into_iter() {
193+
let place_builder =
194+
unpack!(block = this.as_place_builder(block, &this.thir[*thir_place]));
195+
196+
if let Ok(place_builder_resolved) =
197+
place_builder.try_upvars_resolved(this.tcx, this.typeck_results)
198+
{
199+
let mir_place =
200+
place_builder_resolved.into_place(this.tcx, this.typeck_results);
201+
this.cfg.push_fake_read(
202+
block,
203+
this.source_info(this.tcx.hir().span(*hir_id)),
204+
*cause,
205+
mir_place,
206+
);
207+
}
203208
}
204209
}
205210

compiler/rustc_query_system/src/dep_graph/graph.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ use std::marker::PhantomData;
1919
use std::mem;
2020
use std::sync::atomic::Ordering::Relaxed;
2121

22-
use super::prev::PreviousDepGraph;
2322
use super::query::DepGraphQuery;
24-
use super::serialized::{GraphEncoder, SerializedDepNodeIndex};
23+
use super::serialized::{GraphEncoder, SerializedDepGraph, SerializedDepNodeIndex};
2524
use super::{DepContext, DepKind, DepNode, HasDepContext, WorkProductId};
2625
use crate::query::QueryContext;
2726

@@ -78,7 +77,7 @@ struct DepGraphData<K: DepKind> {
7877

7978
/// The dep-graph from the previous compilation session. It contains all
8079
/// nodes and edges as well as all fingerprints of nodes that have them.
81-
previous: PreviousDepGraph<K>,
80+
previous: SerializedDepGraph<K>,
8281

8382
colors: DepNodeColorMap,
8483

@@ -109,7 +108,7 @@ where
109108

110109
impl<K: DepKind> DepGraph<K> {
111110
pub fn new(
112-
prev_graph: PreviousDepGraph<K>,
111+
prev_graph: SerializedDepGraph<K>,
113112
prev_work_products: FxHashMap<WorkProductId, WorkProduct>,
114113
encoder: FileEncoder,
115114
record_graph: bool,
@@ -857,7 +856,7 @@ rustc_index::newtype_index! {
857856
/// For this reason, we avoid storing `DepNode`s more than once as map
858857
/// keys. The `new_node_to_index` map only contains nodes not in the previous
859858
/// graph, and we map nodes in the previous graph to indices via a two-step
860-
/// mapping. `PreviousDepGraph` maps from `DepNode` to `SerializedDepNodeIndex`,
859+
/// mapping. `SerializedDepGraph` maps from `DepNode` to `SerializedDepNodeIndex`,
861860
/// and the `prev_index_to_index` vector (which is more compact and faster than
862861
/// using a map) maps from `SerializedDepNodeIndex` to `DepNodeIndex`.
863862
///
@@ -982,7 +981,7 @@ impl<K: DepKind> CurrentDepGraph<K> {
982981
fn intern_node(
983982
&self,
984983
profiler: &SelfProfilerRef,
985-
prev_graph: &PreviousDepGraph<K>,
984+
prev_graph: &SerializedDepGraph<K>,
986985
key: DepNode<K>,
987986
edges: EdgesVec,
988987
fingerprint: Option<Fingerprint>,
@@ -1080,7 +1079,7 @@ impl<K: DepKind> CurrentDepGraph<K> {
10801079
fn promote_node_and_deps_to_current(
10811080
&self,
10821081
profiler: &SelfProfilerRef,
1083-
prev_graph: &PreviousDepGraph<K>,
1082+
prev_graph: &SerializedDepGraph<K>,
10841083
prev_index: SerializedDepNodeIndex,
10851084
) -> DepNodeIndex {
10861085
self.debug_assert_not_in_new_nodes(prev_graph, prev_index);
@@ -1112,7 +1111,7 @@ impl<K: DepKind> CurrentDepGraph<K> {
11121111
#[inline]
11131112
fn debug_assert_not_in_new_nodes(
11141113
&self,
1115-
prev_graph: &PreviousDepGraph<K>,
1114+
prev_graph: &SerializedDepGraph<K>,
11161115
prev_index: SerializedDepNodeIndex,
11171116
) {
11181117
let node = &prev_graph.index_to_node(prev_index);

compiler/rustc_query_system/src/dep_graph/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
pub mod debug;
22
mod dep_node;
33
mod graph;
4-
mod prev;
54
mod query;
65
mod serialized;
76

87
pub use dep_node::{DepNode, DepNodeParams, WorkProductId};
98
pub use graph::{hash_result, DepGraph, DepNodeColor, DepNodeIndex, TaskDeps, WorkProduct};
10-
pub use prev::PreviousDepGraph;
119
pub use query::DepGraphQuery;
1210
pub use serialized::{SerializedDepGraph, SerializedDepNodeIndex};
1311

compiler/rustc_query_system/src/dep_graph/prev.rs

-56
This file was deleted.

compiler/rustc_query_system/src/dep_graph/serialized.rs

+35-5
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,19 @@ rustc_index::newtype_index! {
3737
#[derive(Debug)]
3838
pub struct SerializedDepGraph<K: DepKind> {
3939
/// The set of all DepNodes in the graph
40-
pub nodes: IndexVec<SerializedDepNodeIndex, DepNode<K>>,
40+
nodes: IndexVec<SerializedDepNodeIndex, DepNode<K>>,
4141
/// The set of all Fingerprints in the graph. Each Fingerprint corresponds to
4242
/// the DepNode at the same index in the nodes vector.
43-
pub fingerprints: IndexVec<SerializedDepNodeIndex, Fingerprint>,
43+
fingerprints: IndexVec<SerializedDepNodeIndex, Fingerprint>,
4444
/// For each DepNode, stores the list of edges originating from that
4545
/// DepNode. Encoded as a [start, end) pair indexing into edge_list_data,
4646
/// which holds the actual DepNodeIndices of the target nodes.
47-
pub edge_list_indices: IndexVec<SerializedDepNodeIndex, (u32, u32)>,
47+
edge_list_indices: IndexVec<SerializedDepNodeIndex, (u32, u32)>,
4848
/// A flattened list of all edge targets in the graph. Edge sources are
4949
/// implicit in edge_list_indices.
50-
pub edge_list_data: Vec<SerializedDepNodeIndex>,
50+
edge_list_data: Vec<SerializedDepNodeIndex>,
51+
/// Reciprocal map to `nodes`.
52+
index: FxHashMap<DepNode<K>, SerializedDepNodeIndex>,
5153
}
5254

5355
impl<K: DepKind> Default for SerializedDepGraph<K> {
@@ -57,6 +59,7 @@ impl<K: DepKind> Default for SerializedDepGraph<K> {
5759
fingerprints: Default::default(),
5860
edge_list_indices: Default::default(),
5961
edge_list_data: Default::default(),
62+
index: Default::default(),
6063
}
6164
}
6265
}
@@ -67,6 +70,30 @@ impl<K: DepKind> SerializedDepGraph<K> {
6770
let targets = self.edge_list_indices[source];
6871
&self.edge_list_data[targets.0 as usize..targets.1 as usize]
6972
}
73+
74+
#[inline]
75+
pub fn index_to_node(&self, dep_node_index: SerializedDepNodeIndex) -> DepNode<K> {
76+
self.nodes[dep_node_index]
77+
}
78+
79+
#[inline]
80+
pub fn node_to_index_opt(&self, dep_node: &DepNode<K>) -> Option<SerializedDepNodeIndex> {
81+
self.index.get(dep_node).cloned()
82+
}
83+
84+
#[inline]
85+
pub fn fingerprint_of(&self, dep_node: &DepNode<K>) -> Option<Fingerprint> {
86+
self.index.get(dep_node).map(|&node_index| self.fingerprints[node_index])
87+
}
88+
89+
#[inline]
90+
pub fn fingerprint_by_index(&self, dep_node_index: SerializedDepNodeIndex) -> Fingerprint {
91+
self.fingerprints[dep_node_index]
92+
}
93+
94+
pub fn node_count(&self) -> usize {
95+
self.index.len()
96+
}
7097
}
7198

7299
impl<'a, K: DepKind + Decodable<opaque::Decoder<'a>>> Decodable<opaque::Decoder<'a>>
@@ -121,7 +148,10 @@ impl<'a, K: DepKind + Decodable<opaque::Decoder<'a>>> Decodable<opaque::Decoder<
121148
})?;
122149
}
123150

124-
Ok(SerializedDepGraph { nodes, fingerprints, edge_list_indices, edge_list_data })
151+
let index: FxHashMap<_, _> =
152+
nodes.iter_enumerated().map(|(idx, &dep_node)| (dep_node, idx)).collect();
153+
154+
Ok(SerializedDepGraph { nodes, fingerprints, edge_list_indices, edge_list_data, index })
125155
}
126156
}
127157

0 commit comments

Comments
 (0)