Skip to content

Commit 8f43b85

Browse files
committed
Auto merge of #140282 - matthiaskrgr:rollup-g6ze4jj, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #137653 (Deprecate the unstable `concat_idents!`) - #138957 (Update the index of Option to make the summary more comprehensive) - #140006 (ensure compiler existance of tools on the dist step) - #140143 (Move `sys::pal::os::Env` into `sys::env`) - #140202 (Make #![feature(let_chains)] bootstrap conditional in compiler/) - #140236 (norm nested aliases before evaluating the parent goal) - #140257 (Some drive-by housecleaning in `rustc_borrowck`) - #140278 (Don't use item name to look up associated item from trait item) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5c54aa7 + 3c08a50 commit 8f43b85

File tree

119 files changed

+1410
-1515
lines changed

Some content is hidden

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

119 files changed

+1410
-1515
lines changed

Cargo.lock

-1
Original file line numberDiff line numberDiff line change
@@ -4158,7 +4158,6 @@ dependencies = [
41584158
"rustc_data_structures",
41594159
"rustc_index",
41604160
"rustc_macros",
4161-
"rustc_serialize",
41624161
"rustc_type_ir",
41634162
"rustc_type_ir_macros",
41644163
"tracing",

compiler/rustc_ast/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
77
// tidy-alphabetical-start
88
#![allow(internal_features)]
9+
#![cfg_attr(bootstrap, feature(let_chains))]
910
#![doc(
1011
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
1112
test(attr(deny(warnings)))
@@ -14,7 +15,6 @@
1415
#![feature(associated_type_defaults)]
1516
#![feature(box_patterns)]
1617
#![feature(if_let_guard)]
17-
#![feature(let_chains)]
1818
#![feature(negative_impls)]
1919
#![feature(never_type)]
2020
#![feature(rustdoc_internals)]

compiler/rustc_ast_lowering/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
3333
// tidy-alphabetical-start
3434
#![allow(internal_features)]
35+
#![cfg_attr(bootstrap, feature(let_chains))]
3536
#![doc(rust_logo)]
3637
#![feature(assert_matches)]
3738
#![feature(box_patterns)]
3839
#![feature(exact_size_is_empty)]
3940
#![feature(if_let_guard)]
40-
#![feature(let_chains)]
4141
#![feature(rustdoc_internals)]
4242
// tidy-alphabetical-end
4343

compiler/rustc_ast_passes/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
55
// tidy-alphabetical-start
66
#![allow(internal_features)]
7+
#![cfg_attr(bootstrap, feature(let_chains))]
78
#![doc(rust_logo)]
89
#![feature(box_patterns)]
910
#![feature(if_let_guard)]
1011
#![feature(iter_is_partitioned)]
11-
#![feature(let_chains)]
1212
#![feature(rustdoc_internals)]
1313
// tidy-alphabetical-end
1414

compiler/rustc_attr_data_structures/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// tidy-alphabetical-start
22
#![allow(internal_features)]
3+
#![cfg_attr(bootstrap, feature(let_chains))]
34
#![doc(rust_logo)]
4-
#![feature(let_chains)]
55
#![feature(rustdoc_internals)]
66
// tidy-alphabetical-end
77

compiler/rustc_attr_parsing/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@
7777
7878
// tidy-alphabetical-start
7979
#![allow(internal_features)]
80+
#![cfg_attr(bootstrap, feature(let_chains))]
8081
#![doc(rust_logo)]
81-
#![feature(let_chains)]
8282
#![feature(rustdoc_internals)]
8383
// tidy-alphabetical-end
8484

compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs

+18-21
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<'tcx> UniverseInfo<'tcx> {
4949
UniverseInfo::RelateTys { expected, found }
5050
}
5151

52-
pub(crate) fn report_error(
52+
pub(crate) fn report_erroneous_element(
5353
&self,
5454
mbcx: &mut MirBorrowckCtxt<'_, '_, 'tcx>,
5555
placeholder: ty::PlaceholderRegion,
@@ -68,7 +68,7 @@ impl<'tcx> UniverseInfo<'tcx> {
6868
mbcx.buffer_error(err);
6969
}
7070
UniverseInfo::TypeOp(ref type_op_info) => {
71-
type_op_info.report_error(mbcx, placeholder, error_element, cause);
71+
type_op_info.report_erroneous_element(mbcx, placeholder, error_element, cause);
7272
}
7373
UniverseInfo::Other => {
7474
// FIXME: This error message isn't great, but it doesn't show
@@ -145,8 +145,11 @@ pub(crate) trait TypeOpInfo<'tcx> {
145145
error_region: Option<ty::Region<'tcx>>,
146146
) -> Option<Diag<'infcx>>;
147147

148+
/// Constraints require that `error_element` appear in the
149+
/// values of `placeholder`, but this cannot be proven to
150+
/// hold. Report an error.
148151
#[instrument(level = "debug", skip(self, mbcx))]
149-
fn report_error(
152+
fn report_erroneous_element(
150153
&self,
151154
mbcx: &mut MirBorrowckCtxt<'_, '_, 'tcx>,
152155
placeholder: ty::PlaceholderRegion,
@@ -190,12 +193,7 @@ pub(crate) trait TypeOpInfo<'tcx> {
190193
let nice_error = self.nice_error(mbcx, cause, placeholder_region, error_region);
191194

192195
debug!(?nice_error);
193-
194-
if let Some(nice_error) = nice_error {
195-
mbcx.buffer_error(nice_error);
196-
} else {
197-
mbcx.buffer_error(self.fallback_error(tcx, span));
198-
}
196+
mbcx.buffer_error(nice_error.unwrap_or_else(|| self.fallback_error(tcx, span)));
199197
}
200198
}
201199

@@ -450,7 +448,8 @@ fn try_extract_error_from_region_constraints<'a, 'tcx>(
450448
ty::ReVar(vid) => universe_of_region(vid),
451449
_ => ty::UniverseIndex::ROOT,
452450
};
453-
let matches =
451+
// Are the two regions the same?
452+
let regions_the_same =
454453
|a_region: Region<'tcx>, b_region: Region<'tcx>| match (a_region.kind(), b_region.kind()) {
455454
(RePlaceholder(a_p), RePlaceholder(b_p)) => a_p.bound == b_p.bound,
456455
_ => a_region == b_region,
@@ -459,7 +458,7 @@ fn try_extract_error_from_region_constraints<'a, 'tcx>(
459458
|constraint: &Constraint<'tcx>, cause: &SubregionOrigin<'tcx>, exact| match *constraint {
460459
Constraint::RegSubReg(sub, sup)
461460
if ((exact && sup == placeholder_region)
462-
|| (!exact && matches(sup, placeholder_region)))
461+
|| (!exact && regions_the_same(sup, placeholder_region)))
463462
&& sup != sub =>
464463
{
465464
Some((sub, cause.clone()))
@@ -468,23 +467,21 @@ fn try_extract_error_from_region_constraints<'a, 'tcx>(
468467
if (exact
469468
&& sup == placeholder_region
470469
&& !universe_of_region(vid).can_name(placeholder_universe))
471-
|| (!exact && matches(sup, placeholder_region)) =>
470+
|| (!exact && regions_the_same(sup, placeholder_region)) =>
472471
{
473472
Some((ty::Region::new_var(infcx.tcx, vid), cause.clone()))
474473
}
475474
_ => None,
476475
};
477-
let mut info = region_constraints
478-
.constraints
479-
.iter()
480-
.find_map(|(constraint, cause)| check(constraint, cause, true));
481-
if info.is_none() {
482-
info = region_constraints
476+
477+
let mut find_culprit = |exact_match: bool| {
478+
region_constraints
483479
.constraints
484480
.iter()
485-
.find_map(|(constraint, cause)| check(constraint, cause, false));
486-
}
487-
let (sub_region, cause) = info?;
481+
.find_map(|(constraint, cause)| check(constraint, cause, exact_match))
482+
};
483+
484+
let (sub_region, cause) = find_culprit(true).or_else(|| find_culprit(false))?;
488485

489486
debug!(?sub_region, "cause = {:#?}", cause);
490487
let error = match (error_region, sub_region.kind()) {

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
405405
let universe = placeholder.universe;
406406
let universe_info = self.regioncx.universe_info(universe);
407407

408-
universe_info.report_error(self, placeholder, error_element, cause);
408+
universe_info.report_erroneous_element(self, placeholder, error_element, cause);
409409
}
410410

411411
RegionErrorKind::RegionError { fr_origin, longer_fr, shorter_fr, is_reported } => {

compiler/rustc_borrowck/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
33
// tidy-alphabetical-start
44
#![allow(internal_features)]
5+
#![cfg_attr(bootstrap, feature(let_chains))]
56
#![doc(rust_logo)]
67
#![feature(assert_matches)]
78
#![feature(box_patterns)]
89
#![feature(file_buffered)]
910
#![feature(if_let_guard)]
10-
#![feature(let_chains)]
1111
#![feature(negative_impls)]
1212
#![feature(never_type)]
1313
#![feature(rustc_attrs)]

compiler/rustc_borrowck/src/region_infer/mod.rs

+19-22
Original file line numberDiff line numberDiff line change
@@ -1628,30 +1628,23 @@ impl<'tcx> RegionInferenceContext<'tcx> {
16281628
let longer_fr_scc = self.constraint_sccs.scc(longer_fr);
16291629
debug!("check_bound_universal_region: longer_fr_scc={:?}", longer_fr_scc,);
16301630

1631-
for error_element in self.scc_values.elements_contained_in(longer_fr_scc) {
1632-
match error_element {
1633-
RegionElement::Location(_) | RegionElement::RootUniversalRegion(_) => {}
1634-
// If we have some bound universal region `'a`, then the only
1635-
// elements it can contain is itself -- we don't know anything
1636-
// else about it!
1637-
RegionElement::PlaceholderRegion(placeholder1) => {
1638-
if placeholder == placeholder1 {
1639-
continue;
1640-
}
1641-
}
1642-
}
1643-
1631+
// If we have some bound universal region `'a`, then the only
1632+
// elements it can contain is itself -- we don't know anything
1633+
// else about it!
1634+
if let Some(error_element) = self
1635+
.scc_values
1636+
.elements_contained_in(longer_fr_scc)
1637+
.find(|e| *e != RegionElement::PlaceholderRegion(placeholder))
1638+
{
1639+
// Stop after the first error, it gets too noisy otherwise, and does not provide more information.
16441640
errors_buffer.push(RegionErrorKind::BoundUniversalRegionError {
16451641
longer_fr,
16461642
error_element,
16471643
placeholder,
16481644
});
1649-
1650-
// Stop after the first error, it gets too noisy otherwise, and does not provide more
1651-
// information.
1652-
break;
1645+
} else {
1646+
debug!("check_bound_universal_region: all bounds satisfied");
16531647
}
1654-
debug!("check_bound_universal_region: all bounds satisfied");
16551648
}
16561649

16571650
#[instrument(level = "debug", skip(self, infcx, errors_buffer))]
@@ -2071,7 +2064,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
20712064
constraint.category
20722065
};
20732066

2074-
match category {
2067+
let interest = match category {
20752068
// Returns usually provide a type to blame and have specially written diagnostics,
20762069
// so prioritize them.
20772070
ConstraintCategory::Return(_) => 0,
@@ -2123,9 +2116,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
21232116
// specific, and are not used for relations that would make sense to blame.
21242117
ConstraintCategory::BoringNoLocation => 6,
21252118
// Do not blame internal constraints.
2126-
ConstraintCategory::Internal => 7,
2127-
ConstraintCategory::IllegalUniverse => 8,
2128-
}
2119+
ConstraintCategory::IllegalUniverse => 7,
2120+
ConstraintCategory::Internal => 8,
2121+
};
2122+
2123+
debug!("constraint {constraint:?} category: {category:?}, interest: {interest:?}");
2124+
2125+
interest
21292126
};
21302127

21312128
let best_choice = if blame_source {

compiler/rustc_borrowck/src/region_infer/values.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ rustc_index::newtype_index! {
2121

2222
/// An individual element in a region value -- the value of a
2323
/// particular region variable consists of a set of these elements.
24-
#[derive(Debug, Clone)]
24+
#[derive(Debug, Clone, PartialEq)]
2525
pub(crate) enum RegionElement {
2626
/// A point in the control-flow graph.
2727
Location(Location),

compiler/rustc_builtin_macros/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
#![allow(internal_features)]
66
#![allow(rustc::diagnostic_outside_of_impl)]
77
#![allow(rustc::untranslatable_diagnostic)]
8+
#![cfg_attr(bootstrap, feature(let_chains))]
89
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
910
#![doc(rust_logo)]
1011
#![feature(assert_matches)]
1112
#![feature(autodiff)]
1213
#![feature(box_patterns)]
1314
#![feature(decl_macro)]
1415
#![feature(if_let_guard)]
15-
#![feature(let_chains)]
1616
#![feature(proc_macro_internals)]
1717
#![feature(proc_macro_quote)]
1818
#![feature(rustdoc_internals)]

compiler/rustc_codegen_llvm/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
77
// tidy-alphabetical-start
88
#![allow(internal_features)]
9+
#![cfg_attr(bootstrap, feature(let_chains))]
910
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1011
#![doc(rust_logo)]
1112
#![feature(assert_matches)]
@@ -15,7 +16,6 @@
1516
#![feature(if_let_guard)]
1617
#![feature(impl_trait_in_assoc_type)]
1718
#![feature(iter_intersperse)]
18-
#![feature(let_chains)]
1919
#![feature(rustdoc_internals)]
2020
#![feature(slice_as_array)]
2121
#![feature(try_blocks)]

compiler/rustc_codegen_ssa/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
#![allow(internal_features)]
33
#![allow(rustc::diagnostic_outside_of_impl)]
44
#![allow(rustc::untranslatable_diagnostic)]
5+
#![cfg_attr(bootstrap, feature(let_chains))]
56
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
67
#![doc(rust_logo)]
78
#![feature(assert_matches)]
89
#![feature(box_patterns)]
910
#![feature(file_buffered)]
1011
#![feature(if_let_guard)]
11-
#![feature(let_chains)]
1212
#![feature(negative_impls)]
1313
#![feature(rustdoc_internals)]
1414
#![feature(string_from_utf8_lossy_owned)]

compiler/rustc_const_eval/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// tidy-alphabetical-start
22
#![allow(internal_features)]
33
#![allow(rustc::diagnostic_outside_of_impl)]
4+
#![cfg_attr(bootstrap, feature(let_chains))]
45
#![doc(rust_logo)]
56
#![feature(assert_matches)]
67
#![feature(box_patterns)]
78
#![feature(decl_macro)]
89
#![feature(if_let_guard)]
9-
#![feature(let_chains)]
1010
#![feature(never_type)]
1111
#![feature(rustdoc_internals)]
1212
#![feature(slice_ptr_get)]

compiler/rustc_data_structures/src/marker.rs

+18-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,15 @@ impls_dyn_send_neg!(
3939
[std::io::StderrLock<'_>]
4040
);
4141

42-
#[cfg(any(unix, target_os = "hermit", target_os = "wasi", target_os = "solid_asp3"))]
43-
// Consistent with `std`, `os_imp::Env` is `!Sync` in these platforms
42+
#[cfg(any(
43+
unix,
44+
target_os = "hermit",
45+
all(target_vendor = "fortanix", target_env = "sgx"),
46+
target_os = "solid_asp3",
47+
target_os = "wasi",
48+
target_os = "xous"
49+
))]
50+
// Consistent with `std`, `env_imp::Env` is `!Sync` in these platforms
4451
impl !DynSend for std::env::VarsOs {}
4552

4653
macro_rules! already_send {
@@ -106,8 +113,15 @@ impls_dyn_sync_neg!(
106113
[std::sync::mpsc::Sender<T> where T]
107114
);
108115

109-
#[cfg(any(unix, target_os = "hermit", target_os = "wasi", target_os = "solid_asp3"))]
110-
// Consistent with `std`, `os_imp::Env` is `!Sync` in these platforms
116+
#[cfg(any(
117+
unix,
118+
target_os = "hermit",
119+
all(target_vendor = "fortanix", target_env = "sgx"),
120+
target_os = "solid_asp3",
121+
target_os = "wasi",
122+
target_os = "xous"
123+
))]
124+
// Consistent with `std`, `env_imp::Env` is `!Sync` in these platforms
111125
impl !DynSync for std::env::VarsOs {}
112126

113127
macro_rules! already_sync {

compiler/rustc_driver_impl/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
// tidy-alphabetical-start
88
#![allow(internal_features)]
99
#![allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
10+
#![cfg_attr(bootstrap, feature(let_chains))]
1011
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1112
#![doc(rust_logo)]
1213
#![feature(decl_macro)]
13-
#![feature(let_chains)]
1414
#![feature(panic_backtrace_config)]
1515
#![feature(panic_update_hook)]
1616
#![feature(result_flattening)]

compiler/rustc_errors/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#![allow(internal_features)]
88
#![allow(rustc::diagnostic_outside_of_impl)]
99
#![allow(rustc::untranslatable_diagnostic)]
10+
#![cfg_attr(bootstrap, feature(let_chains))]
1011
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1112
#![doc(rust_logo)]
1213
#![feature(array_windows)]
@@ -17,7 +18,6 @@
1718
#![feature(default_field_values)]
1819
#![feature(error_reporter)]
1920
#![feature(if_let_guard)]
20-
#![feature(let_chains)]
2121
#![feature(negative_impls)]
2222
#![feature(never_type)]
2323
#![feature(rustc_attrs)]

0 commit comments

Comments
 (0)