Skip to content
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

Rollup of 17 pull requests #138127

Merged
merged 38 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
ddd04d0
Add timestamp to unstable feature usage metrics
yaahc Feb 28, 2025
056ec72
trim channel value in `get_closest_merge_commit`
onur-ozkan Mar 5, 2025
3dbf3dc
Increase the max. custom try jobs requested to `20`
Kobzol Mar 5, 2025
9c75ed2
triagebot: add `compiler_leads` ad-hoc group
jieyouxu Mar 5, 2025
376955e
feat: Remove - from xtensa targets cpu names
SergioGasquez Mar 5, 2025
c85d3f6
bootstrap and compiletest: Use size_of_val from the prelude instead o…
thaliaarchi Mar 5, 2025
181ef54
Use final path segment for diagnostic
compiler-errors Mar 5, 2025
571f95f
Remember silenced bootstrap changelog warnings even in --dry-run
moxian Mar 6, 2025
fde3733
`librustdoc`: flatten nested ifs
yotamofek Mar 6, 2025
e13af7a
Don't even bother checking changelog in --dry-run mode
moxian Mar 6, 2025
ca64815
Revert "rustc_middle: parallel: TyCtxt: remove "unsafe impl DynSend/D…
lqd Mar 6, 2025
ad45962
`apply_closure_requirement` use `LocalDefId`
lcnr Mar 6, 2025
7d6bbe2
expand comments of `TyCtxt` impl of `DynSync`/`DynSend`
lqd Mar 6, 2025
71d688b
`TypeVerifier` do not walk into required consts
lcnr Mar 6, 2025
d4c0c94
Stabilize `const_copy_from_slice` feature
okaneco Mar 6, 2025
1fac14d
fix typo
lcnr Mar 6, 2025
662d735
Git ignore citool's target directory
ehuss Mar 6, 2025
6b14125
Fix broken link to Miri intrinsics in documentation
reddevilmidzy Mar 6, 2025
feae279
[llvm/PassWrapper] use `size_t` when building arg strings
cuviper Mar 6, 2025
5143638
Mention me (WaffleLapkin) when changes to `rustc_codegen_ssa` occur
WaffleLapkin Mar 6, 2025
432e1c3
Add the yield_expr feature
eholk Mar 6, 2025
234a68f
Rollup merge of #137827 - yaahc:timestamp-metrics, r=estebank
compiler-errors Mar 6, 2025
65b5a23
Rollup merge of #138041 - thaliaarchi:use-prelude-size-of.boostrap-co…
compiler-errors Mar 6, 2025
3ce0614
Rollup merge of #138046 - onur-ozkan:trim-include-str, r=jieyouxu
compiler-errors Mar 6, 2025
b16f1ac
Rollup merge of #138053 - Kobzol:more-try-jobs, r=marcoieni
compiler-errors Mar 6, 2025
5804b52
Rollup merge of #138061 - jieyouxu:target-reviewers, r=wesleywiser
compiler-errors Mar 6, 2025
3f4c31c
Rollup merge of #138064 - SergioGasquez:feat/xtensa-names, r=jieyouxu
compiler-errors Mar 6, 2025
d36961f
Rollup merge of #138075 - compiler-errors:final-seg, r=Noratrieb
compiler-errors Mar 6, 2025
6963d74
Rollup merge of #138078 - moxian:rember-warns, r=Kobzol
compiler-errors Mar 6, 2025
bc45cdb
Rollup merge of #138081 - eholk:yield-feature, r=oli-obk
compiler-errors Mar 6, 2025
184c2b0
Rollup merge of #138090 - yotamofek:pr/rustdoc/flatten-ifs, r=Guillau…
compiler-errors Mar 6, 2025
efd22c2
Rollup merge of #138092 - lqd:revert-136731, r=SparrowLii
compiler-errors Mar 6, 2025
9452a57
Rollup merge of #138094 - lcnr:cleanup-borrowck, r=fee1-dead
compiler-errors Mar 6, 2025
33985ce
Rollup merge of #138098 - okaneco:stabilize_const_copy_from_slice, r=…
compiler-errors Mar 6, 2025
963b226
Rollup merge of #138103 - ehuss:citool-target, r=Kobzol
compiler-errors Mar 6, 2025
61aaec7
Rollup merge of #138105 - reddevilmidzy:fix-broken-link, r=saethlin
compiler-errors Mar 6, 2025
9891f55
Rollup merge of #138108 - WaffleLapkin:rustc_codegen_ssa_mentions, r=…
compiler-errors Mar 6, 2025
e6d1856
Rollup merge of #138117 - cuviper:passwrapper-size_t, r=Urgau
compiler-errors Mar 6, 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: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ no_llvm_build
/target
/library/target
/src/bootstrap/target
/src/ci/citool/target
/src/tools/x/target
# Created by `x vendor`
/vendor
Expand Down
35 changes: 14 additions & 21 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,19 @@ impl<'hir> LoweringContext<'_, 'hir> {
let yielded =
opt_expr.as_ref().map(|x| self.lower_expr(x)).unwrap_or_else(|| self.expr_unit(span));

if !self.tcx.features().yield_expr()
&& !self.tcx.features().coroutines()
&& !self.tcx.features().gen_blocks()
{
rustc_session::parse::feature_err(
&self.tcx.sess,
sym::yield_expr,
span,
fluent_generated::ast_lowering_yield,
)
.emit();
}

let is_async_gen = match self.coroutine_kind {
Some(hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Gen, _)) => false,
Some(hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::AsyncGen, _)) => true,
Expand All @@ -1714,28 +1727,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
None,
);
}
Some(hir::CoroutineKind::Coroutine(_)) => {
if !self.tcx.features().coroutines() {
rustc_session::parse::feature_err(
&self.tcx.sess,
sym::coroutines,
span,
fluent_generated::ast_lowering_yield,
)
.emit();
}
false
}
Some(hir::CoroutineKind::Coroutine(_)) => false,
None => {
if !self.tcx.features().coroutines() {
rustc_session::parse::feature_err(
&self.tcx.sess,
sym::coroutines,
span,
fluent_generated::ast_lowering_yield,
)
.emit();
}
let suggestion = self.current_item.map(|s| s.shrink_to_lo());
self.dcx().emit_err(YieldInClosure { span, suggestion });
self.coroutine_kind = Some(hir::CoroutineKind::Coroutine(Movability::Movable));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rustc_hir::def_id::DefId;
use rustc_hir::def_id::LocalDefId;
use rustc_infer::infer::canonical::QueryRegionConstraints;
use rustc_infer::infer::outlives::env::RegionBoundPairs;
use rustc_infer::infer::outlives::obligations::{TypeOutlives, TypeOutlivesDelegate};
Expand Down Expand Up @@ -88,7 +88,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
pub(crate) fn apply_closure_requirements(
&mut self,
closure_requirements: &ClosureRegionRequirements<'tcx>,
closure_def_id: DefId,
closure_def_id: LocalDefId,
closure_args: ty::GenericArgsRef<'tcx>,
) {
// Extract the values of the free regions in `closure_args`
Expand All @@ -98,7 +98,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
self.tcx,
closure_args,
closure_requirements.num_external_vids,
closure_def_id.expect_local(),
closure_def_id,
);
debug!(?closure_mapping);

Expand Down
37 changes: 24 additions & 13 deletions compiler/rustc_borrowck/src/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,8 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
}
}

#[instrument(level = "debug", skip(self))]
fn visit_const_operand(&mut self, constant: &ConstOperand<'tcx>, location: Location) {
debug!(?constant, ?location, "visit_const_operand");

self.super_const_operand(constant, location);
let ty = constant.const_.ty();

Expand All @@ -339,14 +338,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
self.typeck.constraints.liveness_constraints.add_location(live_region_vid, location);
});

// HACK(compiler-errors): Constants that are gathered into Body.required_consts
// have their locations erased...
let locations = if location != Location::START {
location.to_locations()
} else {
Locations::All(constant.span)
};

let locations = location.to_locations();
if let Some(annotation_index) = constant.user_ty {
if let Err(terr) = self.typeck.relate_type_and_user_type(
constant.const_.ty(),
Expand Down Expand Up @@ -491,9 +483,28 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
}
}

#[instrument(level = "debug", skip(self))]
fn visit_body(&mut self, body: &Body<'tcx>) {
// The types of local_decls are checked above which is called in super_body.
self.super_body(body);
// We intentionally do not recurse into `body.required_consts` or
// `body.mentioned_items` here as the MIR at this phase should still
// refer to all items and we don't want to check them multiple times.

for (local, local_decl) in body.local_decls.iter_enumerated() {
self.visit_local_decl(local, local_decl);
}

for (block, block_data) in body.basic_blocks.iter_enumerated() {
let mut location = Location { block, statement_index: 0 };
for stmt in &block_data.statements {
if !stmt.source_info.span.is_dummy() {
self.last_span = stmt.source_info.span;
}
self.visit_statement(stmt, location);
location.statement_index += 1;
}

self.visit_terminator(block_data.terminator(), location);
}
}
}

Expand Down Expand Up @@ -2582,7 +2593,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
ConstraintCategory::Boring, // same as above.
self.constraints,
)
.apply_closure_requirements(closure_requirements, def_id.to_def_id(), args);
.apply_closure_requirements(closure_requirements, def_id, args);
}

// Now equate closure args to regions inherited from `typeck_root_def_id`. Fixes #98589.
Expand Down
17 changes: 16 additions & 1 deletion compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! List of the unstable feature gates.

use std::path::PathBuf;
use std::time::{SystemTime, UNIX_EPOCH};

use rustc_data_structures::fx::FxHashSet;
use rustc_span::{Span, Symbol, sym};
Expand Down Expand Up @@ -669,6 +670,7 @@ declare_features! (
(unstable, xop_target_feature, "1.81.0", Some(127208)),
/// Allows `do yeet` expressions
(unstable, yeet_expr, "1.62.0", Some(96373)),
(unstable, yield_expr, "CURRENT_RUSTC_VERSION", Some(43122)),
// !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!!
// Features are listed in alphabetical order. Tidy will fail if you don't keep it this way.
// !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!!
Expand All @@ -685,11 +687,13 @@ impl Features {
) -> Result<(), Box<dyn std::error::Error>> {
#[derive(serde::Serialize)]
struct LibFeature {
timestamp: u128,
symbol: String,
}

#[derive(serde::Serialize)]
struct LangFeature {
timestamp: u128,
symbol: String,
since: Option<String>,
}
Expand All @@ -703,10 +707,20 @@ impl Features {
let metrics_file = std::fs::File::create(metrics_path)?;
let metrics_file = std::io::BufWriter::new(metrics_file);

let now = || {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.expect("system time should always be greater than the unix epoch")
.as_nanos()
};

let lib_features = self
.enabled_lib_features
.iter()
.map(|EnabledLibFeature { gate_name, .. }| LibFeature { symbol: gate_name.to_string() })
.map(|EnabledLibFeature { gate_name, .. }| LibFeature {
symbol: gate_name.to_string(),
timestamp: now(),
})
.collect();

let lang_features = self
Expand All @@ -715,6 +729,7 @@ impl Features {
.map(|EnabledLangFeature { gate_name, stable_since, .. }| LangFeature {
symbol: gate_name.to_string(),
since: stable_since.map(|since| since.to_string()),
timestamp: now(),
})
.collect();

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/demand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} else {
CallableKind::Function
};
maybe_emit_help(def_id, path.segments[0].ident, args, callable_kind);
maybe_emit_help(def_id, path.segments.last().unwrap().ident, args, callable_kind);
}
hir::ExprKind::MethodCall(method, _receiver, args, _span) => {
let Some(def_id) =
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(

if (ArgsCstrBuff != nullptr) {
#if LLVM_VERSION_GE(20, 0)
int buffer_offset = 0;
size_t buffer_offset = 0;
assert(ArgsCstrBuff[ArgsCstrBuffLen - 1] == '\0');
auto Arg0 = std::string(ArgsCstrBuff);
buffer_offset = Arg0.size() + 1;
Expand All @@ -502,7 +502,7 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
Options.MCOptions.Argv0 = Arg0;
Options.MCOptions.CommandlineArgs = CommandlineArgs;
#else
int buffer_offset = 0;
size_t buffer_offset = 0;
assert(ArgsCstrBuff[ArgsCstrBuffLen - 1] == '\0');

const size_t arg0_len = std::strlen(ArgsCstrBuff);
Expand All @@ -511,13 +511,13 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
arg0[arg0_len] = '\0';
buffer_offset += arg0_len + 1;

const int num_cmd_arg_strings = std::count(
const size_t num_cmd_arg_strings = std::count(
&ArgsCstrBuff[buffer_offset], &ArgsCstrBuff[ArgsCstrBuffLen], '\0');

std::string *cmd_arg_strings = new std::string[num_cmd_arg_strings];
for (int i = 0; i < num_cmd_arg_strings; ++i) {
for (size_t i = 0; i < num_cmd_arg_strings; ++i) {
assert(buffer_offset < ArgsCstrBuffLen);
const int len = std::strlen(ArgsCstrBuff + buffer_offset);
const size_t len = std::strlen(ArgsCstrBuff + buffer_offset);
cmd_arg_strings[i] = std::string(&ArgsCstrBuff[buffer_offset], len);
buffer_offset += len + 1;
}
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,11 @@ pub struct TyCtxt<'tcx> {
gcx: &'tcx GlobalCtxt<'tcx>,
}

// Explicitly implement `DynSync` and `DynSend` for `TyCtxt` to short circuit trait resolution. Its
// field are asserted to implement these traits below, so this is trivially safe, and it greatly
// speeds-up compilation of this crate and its dependents.
unsafe impl DynSend for TyCtxt<'_> {}
unsafe impl DynSync for TyCtxt<'_> {}
fn _assert_tcx_fields() {
sync::assert_dyn_sync::<&'_ GlobalCtxt<'_>>();
sync::assert_dyn_send::<&'_ GlobalCtxt<'_>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target {
vendor: "espressif".into(),

executables: true,
cpu: "esp32-s2".into(),
cpu: "esp32s2".into(),
linker: Some("xtensa-esp32s2-elf-gcc".into()),

// See https://github.com/espressif/rust-esp32-example/issues/3#issuecomment-861054477
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {

options: TargetOptions {
vendor: "espressif".into(),
cpu: "esp32-s2".into(),
cpu: "esp32s2".into(),
linker: Some("xtensa-esp32s2-elf-gcc".into()),
max_atomic_width: Some(32),
features: "+forced-atomics".into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(crate) fn target() -> Target {
vendor: "espressif".into(),

executables: true,
cpu: "esp32-s3".into(),
cpu: "esp32s3".into(),
linker: Some("xtensa-esp32s3-elf-gcc".into()),

// The esp32s3 only supports native 32bit atomics.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {

options: TargetOptions {
vendor: "espressif".into(),
cpu: "esp32-s3".into(),
cpu: "esp32s3".into(),
linker: Some("xtensa-esp32s3-elf-gcc".into()),
max_atomic_width: Some(32),
atomic_cas: true,
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//!
//! In order to make an intrinsic usable at compile-time, it needs to be declared in the "new"
//! style, i.e. as a `#[rustc_intrinsic]` function, not inside an `extern` block. Then copy the
//! implementation from <https://github.com/rust-lang/miri/blob/master/src/shims/intrinsics> to
//! implementation from <https://github.com/rust-lang/miri/blob/master/src/intrinsics> to
//! <https://github.com/rust-lang/rust/blob/master/compiler/rustc_const_eval/src/interpret/intrinsics.rs>
//! and make the intrinsic declaration a `const fn`.
//!
Expand Down
3 changes: 1 addition & 2 deletions library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3732,8 +3732,7 @@ impl<T> [T] {
#[doc(alias = "memcpy")]
#[inline]
#[stable(feature = "copy_from_slice", since = "1.9.0")]
#[rustc_const_unstable(feature = "const_copy_from_slice", issue = "131415")]
#[rustc_const_stable_indirect]
#[rustc_const_stable(feature = "const_copy_from_slice", since = "CURRENT_RUSTC_VERSION")]
#[track_caller]
pub const fn copy_from_slice(&mut self, src: &[T])
where
Expand Down
13 changes: 7 additions & 6 deletions src/bootstrap/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ fn main() {
}

// check_version warnings are not printed during setup, or during CI
let changelog_suggestion = if matches!(config.cmd, Subcommand::Setup { .. }) || CiEnv::is_ci() {
None
} else {
check_version(&config)
};
let changelog_suggestion =
if matches!(config.cmd, Subcommand::Setup { .. }) || CiEnv::is_ci() || config.dry_run() {
None
} else {
check_version(&config)
};

// NOTE: Since `./configure` generates a `config.toml`, distro maintainers will see the
// changelog warning, not the `x.py setup` message.
Expand Down Expand Up @@ -187,7 +188,7 @@ fn check_version(config: &Config) -> Option<String> {
"update `config.toml` to use `change-id = {latest_change_id}` instead"
));

if io::stdout().is_terminal() && !config.dry_run() {
if io::stdout().is_terminal() {
t!(fs::write(warned_id_path, latest_change_id.to_string()));
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ fn format_rusage_data(child: Child) -> Option<String> {
let mut kernel_filetime = Default::default();
let mut kernel_time = Default::default();
let mut memory_counters = PROCESS_MEMORY_COUNTERS::default();
let memory_counters_size = std::mem::size_of_val(&memory_counters);
let memory_counters_size = size_of_val(&memory_counters);

unsafe {
GetProcessTimes(
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/src/utils/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub unsafe fn setup(build: &mut crate::Build) {
#[cfg(windows)]
mod for_windows {
use std::ffi::c_void;
use std::{io, mem};
use std::io;

use windows::Win32::Foundation::CloseHandle;
use windows::Win32::System::Diagnostics::Debug::{
Expand Down Expand Up @@ -82,7 +82,7 @@ mod for_windows {
job,
JobObjectExtendedLimitInformation,
&info as *const _ as *const c_void,
mem::size_of_val(&info) as u32,
size_of_val(&info) as u32,
);
assert!(r.is_ok(), "{}", io::Error::last_os_error());

Expand Down
2 changes: 1 addition & 1 deletion src/build_helper/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub fn get_closest_merge_commit(
git.current_dir(git_dir);
}

let channel = include_str!("../../ci/channel");
let channel = include_str!("../../ci/channel").trim();

let merge_base = {
if CiEnv::is_ci() &&
Expand Down
Loading
Loading