Skip to content

Rollup of 8 pull requests #140282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
fc126df
Update the index.html of Option to make the summary more comprehensive
Natural-selection1 Mar 26, 2025
159ae8f
Keeps the inspect() classification the same as in Result
Natural-selection1 Mar 26, 2025
edfef42
ensure compiler existance of tools on the dist step
onur-ozkan Apr 18, 2025
4ba9fff
add regression test for dist compilation
onur-ozkan Apr 18, 2025
ea0b6cb
Solved suggestions
Natural-selection1 Apr 21, 2025
90fe280
Move `sys::pal::os::Env` into `sys::env`
thaliaarchi Apr 22, 2025
6518bcb
Fix `unsafe_op_in_unsafe_fn` for Unix env
thaliaarchi Apr 22, 2025
1b00ebe
Update !DynSend and !DynSync platform impls
thaliaarchi Apr 22, 2025
4695212
Deduplicate unsupported env items
thaliaarchi Apr 22, 2025
01485c9
Unify owned `Env` types between platforms
thaliaarchi Apr 22, 2025
7493e1c
Make #![feature(let_chains)] bootstrap conditional in compiler/
est31 Apr 23, 2025
c0446d3
keep the original text for is_some and is_none
Natural-selection1 Apr 24, 2025
d0ac97d
add examples using .as_ref() for is_some_and and is_none_or
Natural-selection1 Apr 24, 2025
d8528c6
Some drive-by housecleaning in `rustc_borrowck`
amandasystems Apr 24, 2025
e5e3a95
norm nested aliases before evaluating the parent goal
lcnr Apr 24, 2025
75a9be6
Deprecate the unstable `concat_idents!`
tgross35 Feb 26, 2025
1d0b3be
Don't use item name to look up associated item from trait item
compiler-errors Apr 25, 2025
84a921d
Rollup merge of #137653 - tgross35:deprecate-concat_idents, r=working…
matthiaskrgr Apr 25, 2025
59191fa
Rollup merge of #138957 - Natural-selection1:update-Option-doc, r=Ama…
matthiaskrgr Apr 25, 2025
8868163
Rollup merge of #140006 - onur-ozkan:138778, r=onur-ozkan
matthiaskrgr Apr 25, 2025
f3641df
Rollup merge of #140143 - thaliaarchi:move-env-pal, r=joboet
matthiaskrgr Apr 25, 2025
564e5cc
Rollup merge of #140202 - est31:let_chains_feature_compiler, r=lcnr
matthiaskrgr Apr 25, 2025
9eb0078
Rollup merge of #140236 - lcnr:normalizes-to-goals, r=compiler-errors
matthiaskrgr Apr 25, 2025
e534fad
Rollup merge of #140257 - amandasystems:housecleaning, r=wesleywiser
matthiaskrgr Apr 25, 2025
3c08a50
Rollup merge of #140278 - compiler-errors:name-based-comparison, r=nn…
matthiaskrgr Apr 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4158,7 +4158,6 @@ dependencies = [
"rustc_data_structures",
"rustc_index",
"rustc_macros",
"rustc_serialize",
"rustc_type_ir",
"rustc_type_ir_macros",
"tracing",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(let_chains))]
#![doc(
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
test(attr(deny(warnings)))
Expand All @@ -14,7 +15,6 @@
#![feature(associated_type_defaults)]
#![feature(box_patterns)]
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(rustdoc_internals)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@

// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(let_chains))]
#![doc(rust_logo)]
#![feature(assert_matches)]
#![feature(box_patterns)]
#![feature(exact_size_is_empty)]
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(rustdoc_internals)]
// tidy-alphabetical-end

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_passes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(let_chains))]
#![doc(rust_logo)]
#![feature(box_patterns)]
#![feature(if_let_guard)]
#![feature(iter_is_partitioned)]
#![feature(let_chains)]
#![feature(rustdoc_internals)]
// tidy-alphabetical-end

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(let_chains))]
#![doc(rust_logo)]
#![feature(let_chains)]
#![feature(rustdoc_internals)]
// tidy-alphabetical-end

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@

// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(let_chains))]
#![doc(rust_logo)]
#![feature(let_chains)]
#![feature(rustdoc_internals)]
// tidy-alphabetical-end

Expand Down
39 changes: 18 additions & 21 deletions compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl<'tcx> UniverseInfo<'tcx> {
UniverseInfo::RelateTys { expected, found }
}

pub(crate) fn report_error(
pub(crate) fn report_erroneous_element(
&self,
mbcx: &mut MirBorrowckCtxt<'_, '_, 'tcx>,
placeholder: ty::PlaceholderRegion,
Expand All @@ -68,7 +68,7 @@ impl<'tcx> UniverseInfo<'tcx> {
mbcx.buffer_error(err);
}
UniverseInfo::TypeOp(ref type_op_info) => {
type_op_info.report_error(mbcx, placeholder, error_element, cause);
type_op_info.report_erroneous_element(mbcx, placeholder, error_element, cause);
}
UniverseInfo::Other => {
// FIXME: This error message isn't great, but it doesn't show
Expand Down Expand Up @@ -145,8 +145,11 @@ pub(crate) trait TypeOpInfo<'tcx> {
error_region: Option<ty::Region<'tcx>>,
) -> Option<Diag<'infcx>>;

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

debug!(?nice_error);

if let Some(nice_error) = nice_error {
mbcx.buffer_error(nice_error);
} else {
mbcx.buffer_error(self.fallback_error(tcx, span));
}
mbcx.buffer_error(nice_error.unwrap_or_else(|| self.fallback_error(tcx, span)));
}
}

Expand Down Expand Up @@ -450,7 +448,8 @@ fn try_extract_error_from_region_constraints<'a, 'tcx>(
ty::ReVar(vid) => universe_of_region(vid),
_ => ty::UniverseIndex::ROOT,
};
let matches =
// Are the two regions the same?
let regions_the_same =
|a_region: Region<'tcx>, b_region: Region<'tcx>| match (a_region.kind(), b_region.kind()) {
(RePlaceholder(a_p), RePlaceholder(b_p)) => a_p.bound == b_p.bound,
_ => a_region == b_region,
Expand All @@ -459,7 +458,7 @@ fn try_extract_error_from_region_constraints<'a, 'tcx>(
|constraint: &Constraint<'tcx>, cause: &SubregionOrigin<'tcx>, exact| match *constraint {
Constraint::RegSubReg(sub, sup)
if ((exact && sup == placeholder_region)
|| (!exact && matches(sup, placeholder_region)))
|| (!exact && regions_the_same(sup, placeholder_region)))
&& sup != sub =>
{
Some((sub, cause.clone()))
Expand All @@ -468,23 +467,21 @@ fn try_extract_error_from_region_constraints<'a, 'tcx>(
if (exact
&& sup == placeholder_region
&& !universe_of_region(vid).can_name(placeholder_universe))
|| (!exact && matches(sup, placeholder_region)) =>
|| (!exact && regions_the_same(sup, placeholder_region)) =>
{
Some((ty::Region::new_var(infcx.tcx, vid), cause.clone()))
}
_ => None,
};
let mut info = region_constraints
.constraints
.iter()
.find_map(|(constraint, cause)| check(constraint, cause, true));
if info.is_none() {
info = region_constraints

let mut find_culprit = |exact_match: bool| {
region_constraints
.constraints
.iter()
.find_map(|(constraint, cause)| check(constraint, cause, false));
}
let (sub_region, cause) = info?;
.find_map(|(constraint, cause)| check(constraint, cause, exact_match))
};

let (sub_region, cause) = find_culprit(true).or_else(|| find_culprit(false))?;

debug!(?sub_region, "cause = {:#?}", cause);
let error = match (error_region, sub_region.kind()) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/region_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
let universe = placeholder.universe;
let universe_info = self.regioncx.universe_info(universe);

universe_info.report_error(self, placeholder, error_element, cause);
universe_info.report_erroneous_element(self, placeholder, error_element, cause);
}

RegionErrorKind::RegionError { fr_origin, longer_fr, shorter_fr, is_reported } => {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(let_chains))]
#![doc(rust_logo)]
#![feature(assert_matches)]
#![feature(box_patterns)]
#![feature(file_buffered)]
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(rustc_attrs)]
Expand Down
41 changes: 19 additions & 22 deletions compiler/rustc_borrowck/src/region_infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1628,30 +1628,23 @@ impl<'tcx> RegionInferenceContext<'tcx> {
let longer_fr_scc = self.constraint_sccs.scc(longer_fr);
debug!("check_bound_universal_region: longer_fr_scc={:?}", longer_fr_scc,);

for error_element in self.scc_values.elements_contained_in(longer_fr_scc) {
match error_element {
RegionElement::Location(_) | RegionElement::RootUniversalRegion(_) => {}
// If we have some bound universal region `'a`, then the only
// elements it can contain is itself -- we don't know anything
// else about it!
RegionElement::PlaceholderRegion(placeholder1) => {
if placeholder == placeholder1 {
continue;
}
}
}

// If we have some bound universal region `'a`, then the only
// elements it can contain is itself -- we don't know anything
// else about it!
if let Some(error_element) = self
.scc_values
.elements_contained_in(longer_fr_scc)
.find(|e| *e != RegionElement::PlaceholderRegion(placeholder))
{
// Stop after the first error, it gets too noisy otherwise, and does not provide more information.
errors_buffer.push(RegionErrorKind::BoundUniversalRegionError {
longer_fr,
error_element,
placeholder,
});

// Stop after the first error, it gets too noisy otherwise, and does not provide more
// information.
break;
} else {
debug!("check_bound_universal_region: all bounds satisfied");
}
debug!("check_bound_universal_region: all bounds satisfied");
}

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

match category {
let interest = match category {
// Returns usually provide a type to blame and have specially written diagnostics,
// so prioritize them.
ConstraintCategory::Return(_) => 0,
Expand Down Expand Up @@ -2123,9 +2116,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
// specific, and are not used for relations that would make sense to blame.
ConstraintCategory::BoringNoLocation => 6,
// Do not blame internal constraints.
ConstraintCategory::Internal => 7,
ConstraintCategory::IllegalUniverse => 8,
}
ConstraintCategory::IllegalUniverse => 7,
ConstraintCategory::Internal => 8,
};

debug!("constraint {constraint:?} category: {category:?}, interest: {interest:?}");

interest
};

let best_choice = if blame_source {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/region_infer/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ rustc_index::newtype_index! {

/// An individual element in a region value -- the value of a
/// particular region variable consists of a set of these elements.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq)]
pub(crate) enum RegionElement {
/// A point in the control-flow graph.
Location(Location),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
#![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![cfg_attr(bootstrap, feature(let_chains))]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![feature(assert_matches)]
#![feature(autodiff)]
#![feature(box_patterns)]
#![feature(decl_macro)]
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(proc_macro_internals)]
#![feature(proc_macro_quote)]
#![feature(rustdoc_internals)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(let_chains))]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![feature(assert_matches)]
Expand All @@ -15,7 +16,6 @@
#![feature(if_let_guard)]
#![feature(impl_trait_in_assoc_type)]
#![feature(iter_intersperse)]
#![feature(let_chains)]
#![feature(rustdoc_internals)]
#![feature(slice_as_array)]
#![feature(try_blocks)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
#![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![cfg_attr(bootstrap, feature(let_chains))]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![feature(assert_matches)]
#![feature(box_patterns)]
#![feature(file_buffered)]
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(negative_impls)]
#![feature(rustdoc_internals)]
#![feature(string_from_utf8_lossy_owned)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![cfg_attr(bootstrap, feature(let_chains))]
#![doc(rust_logo)]
#![feature(assert_matches)]
#![feature(box_patterns)]
#![feature(decl_macro)]
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(never_type)]
#![feature(rustdoc_internals)]
#![feature(slice_ptr_get)]
Expand Down
22 changes: 18 additions & 4 deletions compiler/rustc_data_structures/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@ impls_dyn_send_neg!(
[std::io::StderrLock<'_>]
);

#[cfg(any(unix, target_os = "hermit", target_os = "wasi", target_os = "solid_asp3"))]
// Consistent with `std`, `os_imp::Env` is `!Sync` in these platforms
#[cfg(any(
unix,
target_os = "hermit",
all(target_vendor = "fortanix", target_env = "sgx"),
target_os = "solid_asp3",
target_os = "wasi",
target_os = "xous"
))]
// Consistent with `std`, `env_imp::Env` is `!Sync` in these platforms
impl !DynSend for std::env::VarsOs {}

macro_rules! already_send {
Expand Down Expand Up @@ -106,8 +113,15 @@ impls_dyn_sync_neg!(
[std::sync::mpsc::Sender<T> where T]
);

#[cfg(any(unix, target_os = "hermit", target_os = "wasi", target_os = "solid_asp3"))]
// Consistent with `std`, `os_imp::Env` is `!Sync` in these platforms
#[cfg(any(
unix,
target_os = "hermit",
all(target_vendor = "fortanix", target_env = "sgx"),
target_os = "solid_asp3",
target_os = "wasi",
target_os = "xous"
))]
// Consistent with `std`, `env_imp::Env` is `!Sync` in these platforms
impl !DynSync for std::env::VarsOs {}

macro_rules! already_sync {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
#![cfg_attr(bootstrap, feature(let_chains))]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![feature(decl_macro)]
#![feature(let_chains)]
#![feature(panic_backtrace_config)]
#![feature(panic_update_hook)]
#![feature(result_flattening)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![cfg_attr(bootstrap, feature(let_chains))]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![feature(array_windows)]
Expand All @@ -17,7 +18,6 @@
#![feature(default_field_values)]
#![feature(error_reporter)]
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(rustc_attrs)]
Expand Down
Loading
Loading