Skip to content

Commit 097cd98

Browse files
committed
Auto merge of rust-lang#140613 - matthiaskrgr:rollup-yag6z7w, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#138712 (resolve: Support imports of associated types and glob imports from traits) - rust-lang#140395 (organize and extend forbidden target feature tests) - rust-lang#140576 (Remove fragile equal-pointers-unequal tests.) - rust-lang#140582 (Update sysinfo to `0.35.0` in bootstrap and `tools/opt-dist`) - rust-lang#140595 (doc(std): fix typo lchown -> lchmod) - rust-lang#140597 (zkvm: remove schmerik as target maintainer) - rust-lang#140604 (yet another small borrowck cleanup ) r? `@ghost` `@rustbot` modify labels: rollup
2 parents d7df5bd + 4360fd7 commit 097cd98

File tree

57 files changed

+502
-488
lines changed

Some content is hidden

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

57 files changed

+502
-488
lines changed

Cargo.lock

+34-67
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ dependencies = [
744744
"tracing-subscriber",
745745
"unified-diff",
746746
"walkdir",
747-
"windows 0.59.0",
747+
"windows",
748748
]
749749

750750
[[package]]
@@ -2463,6 +2463,25 @@ version = "0.4.0"
24632463
source = "registry+https://github.com/rust-lang/crates.io-index"
24642464
checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
24652465

2466+
[[package]]
2467+
name = "objc2-core-foundation"
2468+
version = "0.3.1"
2469+
source = "registry+https://github.com/rust-lang/crates.io-index"
2470+
checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166"
2471+
dependencies = [
2472+
"bitflags",
2473+
]
2474+
2475+
[[package]]
2476+
name = "objc2-io-kit"
2477+
version = "0.3.1"
2478+
source = "registry+https://github.com/rust-lang/crates.io-index"
2479+
checksum = "71c1c64d6120e51cd86033f67176b1cb66780c2efe34dec55176f77befd93c0a"
2480+
dependencies = [
2481+
"libc",
2482+
"objc2-core-foundation",
2483+
]
2484+
24662485
[[package]]
24672486
name = "object"
24682487
version = "0.32.2"
@@ -3466,7 +3485,7 @@ dependencies = [
34663485
"thorin-dwp",
34673486
"tracing",
34683487
"wasm-encoder 0.219.2",
3469-
"windows 0.59.0",
3488+
"windows",
34703489
]
34713490

34723491
[[package]]
@@ -3525,7 +3544,7 @@ dependencies = [
35253544
"tempfile",
35263545
"thin-vec",
35273546
"tracing",
3528-
"windows 0.59.0",
3547+
"windows",
35293548
]
35303549

35313550
[[package]]
@@ -3588,7 +3607,7 @@ dependencies = [
35883607
"serde_json",
35893608
"shlex",
35903609
"tracing",
3591-
"windows 0.59.0",
3610+
"windows",
35923611
]
35933612

35943613
[[package]]
@@ -3643,7 +3662,7 @@ dependencies = [
36433662
"termcolor",
36443663
"termize",
36453664
"tracing",
3646-
"windows 0.59.0",
3665+
"windows",
36473666
]
36483667

36493668
[[package]]
@@ -4386,7 +4405,7 @@ dependencies = [
43864405
"smallvec",
43874406
"termize",
43884407
"tracing",
4389-
"windows 0.59.0",
4408+
"windows",
43904409
]
43914410

43924411
[[package]]
@@ -5068,13 +5087,14 @@ dependencies = [
50685087

50695088
[[package]]
50705089
name = "sysinfo"
5071-
version = "0.31.4"
5090+
version = "0.35.0"
50725091
source = "registry+https://github.com/rust-lang/crates.io-index"
5073-
checksum = "355dbe4f8799b304b05e1b0f05fc59b2a18d36645cf169607da45bde2f69a1be"
5092+
checksum = "b897c8ea620e181c7955369a31be5f48d9a9121cb59fd33ecef9ff2a34323422"
50745093
dependencies = [
5075-
"core-foundation-sys",
50765094
"libc",
5077-
"windows 0.57.0",
5095+
"objc2-core-foundation",
5096+
"objc2-io-kit",
5097+
"windows",
50785098
]
50795099

50805100
[[package]]
@@ -5949,16 +5969,6 @@ version = "0.4.0"
59495969
source = "registry+https://github.com/rust-lang/crates.io-index"
59505970
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
59515971

5952-
[[package]]
5953-
name = "windows"
5954-
version = "0.57.0"
5955-
source = "registry+https://github.com/rust-lang/crates.io-index"
5956-
checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143"
5957-
dependencies = [
5958-
"windows-core 0.57.0",
5959-
"windows-targets 0.52.6",
5960-
]
5961-
59625972
[[package]]
59635973
name = "windows"
59645974
version = "0.59.0"
@@ -5980,27 +5990,15 @@ dependencies = [
59805990
"serde_json",
59815991
]
59825992

5983-
[[package]]
5984-
name = "windows-core"
5985-
version = "0.57.0"
5986-
source = "registry+https://github.com/rust-lang/crates.io-index"
5987-
checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d"
5988-
dependencies = [
5989-
"windows-implement 0.57.0",
5990-
"windows-interface 0.57.0",
5991-
"windows-result 0.1.2",
5992-
"windows-targets 0.52.6",
5993-
]
5994-
59955993
[[package]]
59965994
name = "windows-core"
59975995
version = "0.59.0"
59985996
source = "registry+https://github.com/rust-lang/crates.io-index"
59995997
checksum = "810ce18ed2112484b0d4e15d022e5f598113e220c53e373fb31e67e21670c1ce"
60005998
dependencies = [
60015999
"windows-implement 0.59.0",
6002-
"windows-interface 0.59.1",
6003-
"windows-result 0.3.2",
6000+
"windows-interface",
6001+
"windows-result",
60046002
"windows-strings 0.3.1",
60056003
"windows-targets 0.53.0",
60066004
]
@@ -6012,23 +6010,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
60126010
checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980"
60136011
dependencies = [
60146012
"windows-implement 0.60.0",
6015-
"windows-interface 0.59.1",
6013+
"windows-interface",
60166014
"windows-link",
6017-
"windows-result 0.3.2",
6015+
"windows-result",
60186016
"windows-strings 0.4.0",
60196017
]
60206018

6021-
[[package]]
6022-
name = "windows-implement"
6023-
version = "0.57.0"
6024-
source = "registry+https://github.com/rust-lang/crates.io-index"
6025-
checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"
6026-
dependencies = [
6027-
"proc-macro2",
6028-
"quote",
6029-
"syn 2.0.100",
6030-
]
6031-
60326019
[[package]]
60336020
name = "windows-implement"
60346021
version = "0.59.0"
@@ -6051,17 +6038,6 @@ dependencies = [
60516038
"syn 2.0.100",
60526039
]
60536040

6054-
[[package]]
6055-
name = "windows-interface"
6056-
version = "0.57.0"
6057-
source = "registry+https://github.com/rust-lang/crates.io-index"
6058-
checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"
6059-
dependencies = [
6060-
"proc-macro2",
6061-
"quote",
6062-
"syn 2.0.100",
6063-
]
6064-
60656041
[[package]]
60666042
name = "windows-interface"
60676043
version = "0.59.1"
@@ -6079,15 +6055,6 @@ version = "0.1.1"
60796055
source = "registry+https://github.com/rust-lang/crates.io-index"
60806056
checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
60816057

6082-
[[package]]
6083-
name = "windows-result"
6084-
version = "0.1.2"
6085-
source = "registry+https://github.com/rust-lang/crates.io-index"
6086-
checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8"
6087-
dependencies = [
6088-
"windows-targets 0.52.6",
6089-
]
6090-
60916058
[[package]]
60926059
name = "windows-result"
60936060
version = "0.3.2"

compiler/rustc_borrowck/src/region_infer/reverse_sccs.rs

+27-18
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use rustc_middle::ty::RegionVid;
77

88
use crate::RegionInferenceContext;
99
use crate::constraints::ConstraintSccIndex;
10+
use crate::region_infer::ConstraintSccs;
11+
use crate::universal_regions::UniversalRegions;
1012

1113
pub(crate) struct ReverseSccGraph {
1214
graph: VecGraph<ConstraintSccIndex>,
@@ -19,6 +21,29 @@ pub(crate) struct ReverseSccGraph {
1921
}
2022

2123
impl ReverseSccGraph {
24+
pub(super) fn compute(
25+
constraint_sccs: &ConstraintSccs,
26+
universal_regions: &UniversalRegions<'_>,
27+
) -> Self {
28+
let graph = constraint_sccs.reverse();
29+
let mut paired_scc_regions = universal_regions
30+
.universal_regions_iter()
31+
.map(|region| (constraint_sccs.scc(region), region))
32+
.collect::<Vec<_>>();
33+
paired_scc_regions.sort();
34+
let universal_regions = paired_scc_regions.iter().map(|&(_, region)| region).collect();
35+
36+
let mut scc_regions = FxIndexMap::default();
37+
let mut start = 0;
38+
for chunk in paired_scc_regions.chunk_by(|&(scc1, _), &(scc2, _)| scc1 == scc2) {
39+
let (scc, _) = chunk[0];
40+
41+
scc_regions.insert(scc, start..start + chunk.len());
42+
start += chunk.len();
43+
}
44+
ReverseSccGraph { graph, scc_regions, universal_regions }
45+
}
46+
2247
/// Find all universal regions that are required to outlive the given SCC.
2348
pub(super) fn upper_bounds(&self, scc0: ConstraintSccIndex) -> impl Iterator<Item = RegionVid> {
2449
let mut duplicates = FxIndexSet::default();
@@ -40,23 +65,7 @@ impl RegionInferenceContext<'_> {
4065
return;
4166
}
4267

43-
let graph = self.constraint_sccs.reverse();
44-
let mut paired_scc_regions = self
45-
.universal_regions()
46-
.universal_regions_iter()
47-
.map(|region| (self.constraint_sccs.scc(region), region))
48-
.collect::<Vec<_>>();
49-
paired_scc_regions.sort();
50-
let universal_regions = paired_scc_regions.iter().map(|&(_, region)| region).collect();
51-
52-
let mut scc_regions = FxIndexMap::default();
53-
let mut start = 0;
54-
for chunk in paired_scc_regions.chunk_by(|&(scc1, _), &(scc2, _)| scc1 == scc2) {
55-
let (scc, _) = chunk[0];
56-
scc_regions.insert(scc, start..start + chunk.len());
57-
start += chunk.len();
58-
}
59-
60-
self.rev_scc_graph = Some(ReverseSccGraph { graph, scc_regions, universal_regions });
68+
self.rev_scc_graph =
69+
Some(ReverseSccGraph::compute(&self.constraint_sccs, self.universal_regions()));
6170
}
6271
}

compiler/rustc_borrowck/src/type_check/free_region_relations.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ type NormalizedInputsAndOutput<'tcx> = Vec<Ty<'tcx>>;
4141

4242
pub(crate) struct CreateResult<'tcx> {
4343
pub(crate) universal_region_relations: Frozen<UniversalRegionRelations<'tcx>>,
44-
pub(crate) region_bound_pairs: RegionBoundPairs<'tcx>,
45-
pub(crate) known_type_outlives_obligations: Vec<ty::PolyTypeOutlivesPredicate<'tcx>>,
44+
pub(crate) region_bound_pairs: Frozen<RegionBoundPairs<'tcx>>,
45+
pub(crate) known_type_outlives_obligations: Frozen<Vec<ty::PolyTypeOutlivesPredicate<'tcx>>>,
4646
pub(crate) normalized_inputs_and_output: NormalizedInputsAndOutput<'tcx>,
4747
}
4848

@@ -333,8 +333,8 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
333333
outlives: self.outlives.freeze(),
334334
inverse_outlives: self.inverse_outlives.freeze(),
335335
}),
336-
known_type_outlives_obligations,
337-
region_bound_pairs: self.region_bound_pairs,
336+
known_type_outlives_obligations: Frozen::freeze(known_type_outlives_obligations),
337+
region_bound_pairs: Frozen::freeze(self.region_bound_pairs),
338338
normalized_inputs_and_output,
339339
}
340340
}

compiler/rustc_borrowck/src/type_check/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ pub(crate) fn type_check<'a, 'tcx>(
151151
body,
152152
promoted,
153153
user_type_annotations: &body.user_type_annotations,
154-
region_bound_pairs,
155-
known_type_outlives_obligations,
154+
region_bound_pairs: &region_bound_pairs,
155+
known_type_outlives_obligations: &known_type_outlives_obligations,
156156
reported_errors: Default::default(),
157157
universal_regions: &universal_region_relations.universal_regions,
158158
location_table,
@@ -216,8 +216,8 @@ struct TypeChecker<'a, 'tcx> {
216216
/// User type annotations are shared between the main MIR and the MIR of
217217
/// all of the promoted items.
218218
user_type_annotations: &'a CanonicalUserTypeAnnotations<'tcx>,
219-
region_bound_pairs: RegionBoundPairs<'tcx>,
220-
known_type_outlives_obligations: Vec<ty::PolyTypeOutlivesPredicate<'tcx>>,
219+
region_bound_pairs: &'a RegionBoundPairs<'tcx>,
220+
known_type_outlives_obligations: &'a [ty::PolyTypeOutlivesPredicate<'tcx>],
221221
reported_errors: FxIndexSet<(Ty<'tcx>, Span)>,
222222
universal_regions: &'a UniversalRegions<'tcx>,
223223
location_table: &'a PoloniusLocationTable,
@@ -412,9 +412,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
412412
constraint_conversion::ConstraintConversion::new(
413413
self.infcx,
414414
self.universal_regions,
415-
&self.region_bound_pairs,
415+
self.region_bound_pairs,
416416
self.infcx.param_env,
417-
&self.known_type_outlives_obligations,
417+
self.known_type_outlives_obligations,
418418
locations,
419419
locations.span(self.body),
420420
category,
@@ -2506,9 +2506,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
25062506
constraint_conversion::ConstraintConversion::new(
25072507
self.infcx,
25082508
self.universal_regions,
2509-
&self.region_bound_pairs,
2509+
self.region_bound_pairs,
25102510
self.infcx.param_env,
2511-
&self.known_type_outlives_obligations,
2511+
self.known_type_outlives_obligations,
25122512
locations,
25132513
self.body.span, // irrelevant; will be overridden.
25142514
ConstraintCategory::Boring, // same as above.

compiler/rustc_error_codes/src/error_codes/E0253.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
#### Note: this error code is no longer emitted by the compiler.
2+
13
Attempt was made to import an unimportable type. This can happen when trying
24
to import a type from a trait.
35

46
Erroneous code example:
57

6-
```compile_fail,E0253
8+
```
9+
#![feature(import_trait_associated_functions)]
10+
711
mod foo {
812
pub trait MyTrait {
913
type SomeType;

0 commit comments

Comments
 (0)