Skip to content

Rollup of 16 pull requests #142483

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 46 commits into from
Jun 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
bde63bb
builtin dyn impl no guide inference
lcnr May 21, 2025
188c401
add Vec::peek_mut
Qelxiros Jun 4, 2025
cc80429
fix tests
Qelxiros Jun 6, 2025
6469eb1
bless test stderr
Qelxiros Jun 7, 2025
6cea550
tests: Minicore `extern "gpu-kernel"` feature test
workingjubilee Jun 1, 2025
0d74252
Allow initializing logger with additional tracing Layer
Stypox May 12, 2025
fc96ca8
Use closure to allow passing custom tracing layers
Stypox Jun 11, 2025
9d19cbe
update docs, test
Qelxiros Jun 12, 2025
de4e7ad
Don't hardcode the intrinsic return types twice in the compiler
oli-obk Apr 16, 2025
781baaf
Add documentation for init_logger_with_additional_layer
Stypox Jun 12, 2025
9d642fe
Pre-install eslint in `mingw-check-tidy` Dockerfile
Kobzol Jun 12, 2025
bb2b765
Require generic params for const generic params
oli-obk Jun 12, 2025
ae645fc
Remove "intermittent" wording from `ReadDir`
ChrisDenton Jun 13, 2025
3160dfa
Add failing tests
JonathanBrouwer Jun 10, 2025
527f35a
doc: mention that intrinsics should not be called in user code
scrabsha Jun 13, 2025
da0ccee
replace output usage in sanity with new execution context
Shourya742 Jun 13, 2025
66beaa6
replace output usage in bootstrap/lib.rs with new execution context
Shourya742 Jun 13, 2025
2f7cc5a
remove output from helpers
Shourya742 Jun 13, 2025
85fe615
move stack into submodule
lcnr Jun 13, 2025
64f9c47
refactor `reached_depth -> required_depth`
lcnr Jun 13, 2025
9c07e8e
remove unnecessary function arg
lcnr Jun 13, 2025
764e97c
compiletest: Clarify that `--no-capture` is needed with `--verbose`
Enselic Jun 13, 2025
b131b6f
Rework how the disallowed qualifier lints are generated
JonathanBrouwer Jun 10, 2025
86497e6
Don't use BTreeMap for mapped_consts
compiler-errors Jun 12, 2025
fe92efa
Make connection between Placeholder and Bound a bit more clear in the…
compiler-errors Jun 12, 2025
6fa6d0e
Uplift BoundVarReplacer
compiler-errors Jun 12, 2025
da8d529
Replace escaping bound vars in ty/ct visiting, not binder visiting
compiler-errors Jun 12, 2025
b138202
TypeVisiting binders no longer requires TypeFolding its interior
compiler-errors Jun 12, 2025
bdc531e
Add platform support docs & maintainers for *-windows-msvc
wesleywiser Jun 11, 2025
4658aee
tests: Convert two handwritten minicores to add-core-stubs
workingjubilee Jun 14, 2025
94dfe49
Rollup merge of #140969 - Stypox:logger-layer, r=RalfJung,oli-obk
workingjubilee Jun 14, 2025
efc55fa
Rollup merge of #141352 - lcnr:no-builtin-preference, r=compiler-errors
workingjubilee Jun 14, 2025
b38ee5e
Rollup merge of #142046 - Qelxiros:122742-vec_peek_mut, r=cuviper
workingjubilee Jun 14, 2025
69b3c57
Rollup merge of #142273 - workingjubilee:rework-gpu-kernel-feature-ga…
workingjubilee Jun 14, 2025
4db9554
Rollup merge of #142302 - JonathanBrouwer:invalid-const-token, r=jdon…
workingjubilee Jun 14, 2025
179bcf6
Rollup merge of #142405 - oli-obk:type-once, r=RalfJung
workingjubilee Jun 14, 2025
fa359f6
Rollup merge of #142434 - Kobzol:preinstall-eslint, r=marcoieni
workingjubilee Jun 14, 2025
2f56557
Rollup merge of #142439 - scrabsha:rust/sasha/uwkqrkztvqry, r=RalfJung
workingjubilee Jun 14, 2025
c3537c2
Rollup merge of #142441 - compiler-errors:lazier-binder-value-folding…
workingjubilee Jun 14, 2025
4d1ded8
Rollup merge of #142449 - oli-obk:missing-mgca-args, r=BoxyUwU
workingjubilee Jun 14, 2025
63631fb
Rollup merge of #142452 - ChrisDenton:intermittent, r=Noratrieb
workingjubilee Jun 14, 2025
8b22fcb
Rollup merge of #142459 - Shourya742:2025-06-11-remove-output-helper,…
workingjubilee Jun 14, 2025
8effd40
Rollup merge of #142460 - lcnr:search_graph-3, r=BoxyUwU
workingjubilee Jun 14, 2025
52894f9
Rollup merge of #142461 - Enselic:no-capture-tip, r=jieyouxu
workingjubilee Jun 14, 2025
e3aa60d
Rollup merge of #142475 - wesleywiser:windows_msvc_maintainers, r=Chr…
workingjubilee Jun 14, 2025
572b452
Rollup merge of #142480 - workingjubilee:unhandwrite-minicore, r=tgro…
workingjubilee Jun 14, 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
2 changes: 1 addition & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4618,7 +4618,7 @@ dependencies = [
"derive-where",
"ena",
"indexmap",
"rustc-hash 1.1.0",
"rustc-hash 2.1.1",
"rustc_ast_ir",
"rustc_data_structures",
"rustc_index",
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2147,7 +2147,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
ty_id,
&None,
path,
ParamMode::Optional,
ParamMode::Explicit,
AllowReturnTypeNotation::No,
// FIXME(mgca): update for `fn foo() -> Bar<FOO<impl Trait>>` support
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
Expand Down Expand Up @@ -2219,7 +2219,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
expr.id,
qself,
path,
ParamMode::Optional,
ParamMode::Explicit,
AllowReturnTypeNotation::No,
// FIXME(mgca): update for `fn foo() -> Bar<FOO<impl Trait>>` support
ImplTraitContext::Disallowed(ImplTraitPosition::Path),
Expand Down
14 changes: 7 additions & 7 deletions compiler/rustc_const_eval/src/interpret/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {

sym::needs_drop | sym::type_id | sym::type_name | sym::variant_count => {
let gid = GlobalId { instance, promoted: None };
let ty = match intrinsic_name {
sym::variant_count => self.tcx.types.usize,
sym::needs_drop => self.tcx.types.bool,
sym::type_id => self.tcx.types.u128,
sym::type_name => Ty::new_static_str(self.tcx.tcx),
_ => bug!(),
};
let ty = self
.tcx
.fn_sig(instance.def_id())
.instantiate(self.tcx.tcx, instance.args)
.output()
.no_bound_vars()
.unwrap();
let val = self
.ctfe_query(|tcx| tcx.const_eval_global_id(self.typing_env, gid, tcx.span))?;
let val = self.const_val_to_op(val, ty, Some(dest.layout))?;
Expand Down
20 changes: 19 additions & 1 deletion compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1500,13 +1500,31 @@ pub fn init_rustc_env_logger(early_dcx: &EarlyDiagCtxt) {

/// This allows tools to enable rust logging without having to magically match rustc's
/// tracing crate version. In contrast to `init_rustc_env_logger` it allows you to choose
/// the values directly rather than having to set an environment variable.
/// the logger config directly rather than having to set an environment variable.
pub fn init_logger(early_dcx: &EarlyDiagCtxt, cfg: rustc_log::LoggerConfig) {
if let Err(error) = rustc_log::init_logger(cfg) {
early_dcx.early_fatal(error.to_string());
}
}

/// This allows tools to enable rust logging without having to magically match rustc's
/// tracing crate version. In contrast to `init_rustc_env_logger`, it allows you to
/// choose the logger config directly rather than having to set an environment variable.
/// Moreover, in contrast to `init_logger`, it allows you to add a custom tracing layer
/// via `build_subscriber`, for example `|| Registry::default().with(custom_layer)`.
pub fn init_logger_with_additional_layer<F, T>(
early_dcx: &EarlyDiagCtxt,
cfg: rustc_log::LoggerConfig,
build_subscriber: F,
) where
F: FnOnce() -> T,
T: rustc_log::BuildSubscriberRet,
{
if let Err(error) = rustc_log::init_logger_with_additional_layer(cfg, build_subscriber) {
early_dcx.early_fatal(error.to_string());
}
}

/// Install our usual `ctrlc` handler, which sets [`rustc_const_eval::CTRL_C_RECEIVED`].
/// Making this handler optional lets tools can install a different handler, if they wish.
pub fn install_ctrlc_handler() {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_middle::bug;
use rustc_middle::ty::{
self as ty, IsSuggestable, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable, TypeVisitable,
TypeVisitableExt, TypeVisitor, Upcast,
self as ty, IsSuggestable, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt,
TypeVisitor, Upcast,
};
use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol, kw, sym};
use rustc_trait_selection::traits;
Expand Down Expand Up @@ -927,7 +927,7 @@ struct GenericParamAndBoundVarCollector<'a, 'tcx> {
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for GenericParamAndBoundVarCollector<'_, 'tcx> {
type Result = ControlFlow<ErrorGuaranteed>;

fn visit_binder<T: TypeFoldable<TyCtxt<'tcx>>>(
fn visit_binder<T: TypeVisitable<TyCtxt<'tcx>>>(
&mut self,
binder: &ty::Binder<'tcx, T>,
) -> Self::Result {
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_lint/src/impl_trait_overcaptures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ use rustc_middle::ty::relate::{
Relate, RelateResult, TypeRelation, structurally_relate_consts, structurally_relate_tys,
};
use rustc_middle::ty::{
self, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable, TypeVisitable, TypeVisitableExt,
TypeVisitor,
self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor,
};
use rustc_middle::{bug, span_bug};
use rustc_session::lint::FutureIncompatibilityReason;
Expand Down Expand Up @@ -210,7 +209,7 @@ where
VarFn: FnOnce() -> FxHashMap<DefId, ty::Variance>,
OutlivesFn: FnOnce() -> OutlivesEnvironment<'tcx>,
{
fn visit_binder<T: TypeFoldable<TyCtxt<'tcx>>>(&mut self, t: &ty::Binder<'tcx, T>) {
fn visit_binder<T: TypeVisitable<TyCtxt<'tcx>>>(&mut self, t: &ty::Binder<'tcx, T>) {
// When we get into a binder, we need to add its own bound vars to the scope.
let mut added = vec![];
for arg in t.bound_vars() {
Expand Down
33 changes: 32 additions & 1 deletion compiler/rustc_log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ use tracing_subscriber::filter::{Directive, EnvFilter, LevelFilter};
use tracing_subscriber::fmt::FmtContext;
use tracing_subscriber::fmt::format::{self, FormatEvent, FormatFields};
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::{Layer, Registry};

/// The values of all the environment variables that matter for configuring a logger.
/// Errors are explicitly preserved so that we can share error handling.
Expand Down Expand Up @@ -72,6 +73,36 @@ impl LoggerConfig {

/// Initialize the logger with the given values for the filter, coloring, and other options env variables.
pub fn init_logger(cfg: LoggerConfig) -> Result<(), Error> {
init_logger_with_additional_layer(cfg, || Registry::default())
}

/// Trait alias for the complex return type of `build_subscriber` in
/// [init_logger_with_additional_layer]. A [Registry] with any composition of [tracing::Subscriber]s
/// (e.g. `Registry::default().with(custom_layer)`) should be compatible with this type.
/// Having an alias is also useful so rustc_driver_impl does not need to explicitly depend on
/// `tracing_subscriber`.
pub trait BuildSubscriberRet:
tracing::Subscriber + for<'span> tracing_subscriber::registry::LookupSpan<'span> + Send + Sync
{
}

impl<
T: tracing::Subscriber + for<'span> tracing_subscriber::registry::LookupSpan<'span> + Send + Sync,
> BuildSubscriberRet for T
{
}

/// Initialize the logger with the given values for the filter, coloring, and other options env variables.
/// Additionally add a custom layer to collect logging and tracing events via `build_subscriber`,
/// for example: `|| Registry::default().with(custom_layer)`.
pub fn init_logger_with_additional_layer<F, T>(
cfg: LoggerConfig,
build_subscriber: F,
) -> Result<(), Error>
where
F: FnOnce() -> T,
T: BuildSubscriberRet,
{
let filter = match cfg.filter {
Ok(env) => EnvFilter::new(env),
_ => EnvFilter::default().add_directive(Directive::from(LevelFilter::WARN)),
Expand Down Expand Up @@ -124,7 +155,7 @@ pub fn init_logger(cfg: LoggerConfig) -> Result<(), Error> {
Err(_) => {} // no wraptree
}

let subscriber = tracing_subscriber::Registry::default().with(filter).with(layer);
let subscriber = build_subscriber().with(layer.with_filter(filter));
match cfg.backtrace {
Ok(backtrace_target) => {
let fmt_layer = tracing_subscriber::fmt::layer()
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_middle/src/ty/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ impl<'tcx> rustc_type_ir::inherent::Const<TyCtxt<'tcx>> for Const<'tcx> {
Const::new_bound(tcx, debruijn, var)
}

fn new_placeholder(tcx: TyCtxt<'tcx>, placeholder: ty::PlaceholderConst) -> Self {
Const::new_placeholder(tcx, placeholder)
}

fn new_unevaluated(interner: TyCtxt<'tcx>, uv: ty::UnevaluatedConst<'tcx>) -> Self {
Const::new_unevaluated(interner, uv)
}
Expand Down
30 changes: 24 additions & 6 deletions compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,9 @@ impl Placeholder<BoundVar> {

pub type PlaceholderRegion = Placeholder<BoundRegion>;

impl rustc_type_ir::inherent::PlaceholderLike for PlaceholderRegion {
impl<'tcx> rustc_type_ir::inherent::PlaceholderLike<TyCtxt<'tcx>> for PlaceholderRegion {
type Bound = BoundRegion;

fn universe(self) -> UniverseIndex {
self.universe
}
Expand All @@ -946,14 +948,20 @@ impl rustc_type_ir::inherent::PlaceholderLike for PlaceholderRegion {
Placeholder { universe: ui, ..self }
}

fn new(ui: UniverseIndex, var: BoundVar) -> Self {
fn new(ui: UniverseIndex, bound: BoundRegion) -> Self {
Placeholder { universe: ui, bound }
}

fn new_anon(ui: UniverseIndex, var: BoundVar) -> Self {
Placeholder { universe: ui, bound: BoundRegion { var, kind: BoundRegionKind::Anon } }
}
}

pub type PlaceholderType = Placeholder<BoundTy>;

impl rustc_type_ir::inherent::PlaceholderLike for PlaceholderType {
impl<'tcx> rustc_type_ir::inherent::PlaceholderLike<TyCtxt<'tcx>> for PlaceholderType {
type Bound = BoundTy;

fn universe(self) -> UniverseIndex {
self.universe
}
Expand All @@ -966,7 +974,11 @@ impl rustc_type_ir::inherent::PlaceholderLike for PlaceholderType {
Placeholder { universe: ui, ..self }
}

fn new(ui: UniverseIndex, var: BoundVar) -> Self {
fn new(ui: UniverseIndex, bound: BoundTy) -> Self {
Placeholder { universe: ui, bound }
}

fn new_anon(ui: UniverseIndex, var: BoundVar) -> Self {
Placeholder { universe: ui, bound: BoundTy { var, kind: BoundTyKind::Anon } }
}
}
Expand All @@ -980,7 +992,9 @@ pub struct BoundConst<'tcx> {

pub type PlaceholderConst = Placeholder<BoundVar>;

impl rustc_type_ir::inherent::PlaceholderLike for PlaceholderConst {
impl<'tcx> rustc_type_ir::inherent::PlaceholderLike<TyCtxt<'tcx>> for PlaceholderConst {
type Bound = BoundVar;

fn universe(self) -> UniverseIndex {
self.universe
}
Expand All @@ -993,7 +1007,11 @@ impl rustc_type_ir::inherent::PlaceholderLike for PlaceholderConst {
Placeholder { universe: ui, ..self }
}

fn new(ui: UniverseIndex, var: BoundVar) -> Self {
fn new(ui: UniverseIndex, bound: BoundVar) -> Self {
Placeholder { universe: ui, bound }
}

fn new_anon(ui: UniverseIndex, var: BoundVar) -> Self {
Placeholder { universe: ui, bound: var }
}
}
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_middle/src/ty/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ impl<'tcx> rustc_type_ir::inherent::Region<TyCtxt<'tcx>> for Region<'tcx> {
Region::new_bound(tcx, debruijn, ty::BoundRegion { var, kind: ty::BoundRegionKind::Anon })
}

fn new_placeholder(tcx: TyCtxt<'tcx>, placeholder: ty::PlaceholderRegion) -> Self {
Region::new_placeholder(tcx, placeholder)
}

fn new_static(tcx: TyCtxt<'tcx>) -> Self {
tcx.lifetimes.re_static
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/ty/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl<'tcx> TyCtxt<'tcx> {
{
type Result = ControlFlow<()>;

fn visit_binder<T: TypeFoldable<TyCtxt<'tcx>>>(
fn visit_binder<T: TypeVisitable<TyCtxt<'tcx>>>(
&mut self,
t: &Binder<'tcx, T>,
) -> Self::Result {
Expand Down Expand Up @@ -168,7 +168,7 @@ impl LateBoundRegionsCollector {
}

impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for LateBoundRegionsCollector {
fn visit_binder<T: TypeFoldable<TyCtxt<'tcx>>>(&mut self, t: &Binder<'tcx, T>) {
fn visit_binder<T: TypeVisitable<TyCtxt<'tcx>>>(&mut self, t: &Binder<'tcx, T>) {
self.current_index.shift_in(1);
t.super_visit_with(self);
self.current_index.shift_out(1);
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_next_trait_solver/src/canonicalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,13 +435,13 @@ impl<'a, D: SolverDelegate<Interner = I>, I: Interner> Canonicalizer<'a, D, I> {
},
ty::Placeholder(placeholder) => match self.canonicalize_mode {
CanonicalizeMode::Input { .. } => CanonicalVarKind::PlaceholderTy(
PlaceholderLike::new(placeholder.universe(), self.variables.len().into()),
PlaceholderLike::new_anon(placeholder.universe(), self.variables.len().into()),
),
CanonicalizeMode::Response { .. } => CanonicalVarKind::PlaceholderTy(placeholder),
},
ty::Param(_) => match self.canonicalize_mode {
CanonicalizeMode::Input { .. } => CanonicalVarKind::PlaceholderTy(
PlaceholderLike::new(ty::UniverseIndex::ROOT, self.variables.len().into()),
PlaceholderLike::new_anon(ty::UniverseIndex::ROOT, self.variables.len().into()),
),
CanonicalizeMode::Response { .. } => panic!("param ty in response: {t:?}"),
},
Expand Down Expand Up @@ -594,15 +594,15 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> TypeFolder<I> for Canonicaliz
},
ty::ConstKind::Placeholder(placeholder) => match self.canonicalize_mode {
CanonicalizeMode::Input { .. } => CanonicalVarKind::PlaceholderConst(
PlaceholderLike::new(placeholder.universe(), self.variables.len().into()),
PlaceholderLike::new_anon(placeholder.universe(), self.variables.len().into()),
),
CanonicalizeMode::Response { .. } => {
CanonicalVarKind::PlaceholderConst(placeholder)
}
},
ty::ConstKind::Param(_) => match self.canonicalize_mode {
CanonicalizeMode::Input { .. } => CanonicalVarKind::PlaceholderConst(
PlaceholderLike::new(ty::UniverseIndex::ROOT, self.variables.len().into()),
PlaceholderLike::new_anon(ty::UniverseIndex::ROOT, self.variables.len().into()),
),
CanonicalizeMode::Response { .. } => panic!("param ty in response: {c:?}"),
},
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_next_trait_solver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
pub mod canonicalizer;
pub mod coherence;
pub mod delegate;
pub mod placeholder;
pub mod resolve;
pub mod solve;
Loading