Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4828030
Diagnostics ICE when replaying proof trees with next-solver
VicenteGusmao Aug 5, 2026
a529dee
[Priroda] Add bootstrap test and check steps
moabo3li Aug 6, 2026
e2a6442
[Priroda] Add rust_2018_idioms lint, bootstrap check, and clippy step
moabo3li Aug 8, 2026
d577cbc
Fix visible_parent_map fallback map merging perf regression
zalanlevai Aug 9, 2026
aed6c87
Add regression test for assoc const panic ICE in match
zakrad Aug 10, 2026
60aee43
misc renames
ada4a Aug 10, 2026
0bdc067
rename `HostEffectPredicate` to `HostEffectClause`
ada4a Aug 10, 2026
5575f9a
rename `DerivedHostCause.parent_host_pred`
ada4a Aug 10, 2026
7e2398f
rename `ConstConditions.predicates`
ada4a Aug 10, 2026
1cf12a5
Add explanation to regression test
VicenteGusmao Aug 10, 2026
1fd0a40
Ensure inferred let pattern types are well-formed
s7tya Jun 13, 2026
93bc4e8
Remove crash-test
JonathanBrouwer Aug 10, 2026
bb32b7c
Implement `to_string()` on `ByteStr` and `ByteString`
DanielEScherzer Aug 10, 2026
e84bdbd
Rollup merge of #160629 - moabo3li:priroda-bootstrap-ci, r=oli-obk
JonathanBrouwer Aug 10, 2026
65c0a8b
Rollup merge of #160811 - zalanlevai:160464-perf-regression, r=Jonath…
JonathanBrouwer Aug 10, 2026
ef94a79
Rollup merge of #154329 - VicenteGusmao:fix-bug-151304, r=lcnr
JonathanBrouwer Aug 10, 2026
ac84f4a
Rollup merge of #157841 - Kivooeo:fix-let-pat-inferred-wf, r=lcnr
JonathanBrouwer Aug 10, 2026
b3459ae
Rollup merge of #159300 - DanielEScherzer:bytestr-to-string, r=clarfo…
JonathanBrouwer Aug 10, 2026
46f532d
Rollup merge of #160858 - zakrad:regr-test-91514, r=JohnTitor
JonathanBrouwer Aug 10, 2026
d3a5cbc
Rollup merge of #160864 - ada4a:rename-HostEffectPredicate, r=oli-obk
JonathanBrouwer Aug 10, 2026
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 compiler/rustc_hir_analysis/src/check/always_applicable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ fn ensure_all_fields_are_const_destruct<'tcx>(
tcx,
cause,
env,
ty::ClauseKind::HostEffect(ty::HostEffectPredicate {
ty::ClauseKind::HostEffect(ty::HostEffectClause {
trait_ref: ty::TraitRef::new(tcx, destruct_trait, [field_ty]),
constness: ty::BoundConstness::Maybe,
}),
Expand Down
34 changes: 17 additions & 17 deletions compiler/rustc_hir_analysis/src/collect/clauses_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -776,18 +776,18 @@ pub(super) fn assert_only_contains_clauses_from<'tcx>(
`{filter:?}` implied bounds: {clause:?}"
);
}
ty::ClauseKind::TypeOutlives(outlives_predicate) => {
ty::ClauseKind::TypeOutlives(outlives_clause) => {
assert_eq!(
outlives_predicate.0, ty,
"expected `Self` predicate when computing \
outlives_clause.0, ty,
"expected `Self` clause when computing \
`{filter:?}` implied bounds: {clause:?}"
);
}
ty::ClauseKind::HostEffect(host_effect_predicate) => {
ty::ClauseKind::HostEffect(host_effect_clause) => {
assert_eq!(
host_effect_predicate.self_ty(),
host_effect_clause.self_ty(),
ty,
"expected `Self` predicate when computing \
"expected `Self` clause when computing \
`{filter:?}` implied bounds: {clause:?}"
);
}
Expand Down Expand Up @@ -836,13 +836,13 @@ pub(super) fn assert_only_contains_clauses_from<'tcx>(
PredicateFilter::ConstIfConst => {
for (clause, _) in bounds {
match clause.kind().skip_binder() {
ty::ClauseKind::HostEffect(ty::HostEffectPredicate {
ty::ClauseKind::HostEffect(ty::HostEffectClause {
trait_ref: _,
constness: ty::BoundConstness::Maybe,
}) => {}
_ => {
bug!(
"unexpected non-`HostEffect` predicate when computing \
"unexpected non-`HostEffect` clause when computing \
`{filter:?}` implied bounds: {clause:?}"
);
}
Expand All @@ -852,23 +852,23 @@ pub(super) fn assert_only_contains_clauses_from<'tcx>(
PredicateFilter::SelfConstIfConst => {
for (clause, _) in bounds {
match clause.kind().skip_binder() {
ty::ClauseKind::HostEffect(pred) => {
ty::ClauseKind::HostEffect(host_clause) => {
assert_eq!(
pred.constness,
host_clause.constness,
ty::BoundConstness::Maybe,
"expected `[const]` predicate when computing `{filter:?}` \
"expected `[const]` clause when computing `{filter:?}` \
implied bounds: {clause:?}",
);
assert_eq!(
pred.trait_ref.self_ty(),
host_clause.trait_ref.self_ty(),
ty,
"expected `Self` predicate when computing `{filter:?}` \
"expected `Self` clause when computing `{filter:?}` \
implied bounds: {clause:?}"
);
}
_ => {
bug!(
"unexpected non-`HostEffect` predicate when computing \
"unexpected non-`HostEffect` clause when computing \
`{filter:?}` implied bounds: {clause:?}"
);
}
Expand Down Expand Up @@ -1151,10 +1151,10 @@ pub(super) fn const_conditions<'tcx>(

ty::ConstConditions {
parent: has_parent.then(|| tcx.local_parent(def_id).to_def_id()),
predicates: tcx.arena.alloc_from_iter(bounds.into_iter().map(|(clause, span)| {
clauses: tcx.arena.alloc_from_iter(bounds.into_iter().map(|(clause, span)| {
(
clause.kind().map_bound(|clause| match clause {
ty::ClauseKind::HostEffect(ty::HostEffectPredicate {
ty::ClauseKind::HostEffect(ty::HostEffectClause {
trait_ref,
constness: ty::BoundConstness::Maybe,
}) => trait_ref,
Expand Down Expand Up @@ -1206,7 +1206,7 @@ pub(super) fn explicit_implied_const_bounds<'tcx>(
&*tcx.arena.alloc_from_iter(bounds.iter().copied().map(|(clause, span)| {
(
clause.kind().map_bound(|clause| match clause {
ty::ClauseKind::HostEffect(ty::HostEffectPredicate {
ty::ClauseKind::HostEffect(ty::HostEffectClause {
trait_ref,
constness: ty::BoundConstness::Maybe,
}) => trait_ref,
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_hir_analysis/src/variance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,24 +181,24 @@ fn variance_of_opaque(
let mut collector =
OpaqueTypeLifetimeCollector { tcx, root_def_id: item_def_id.to_def_id(), variances };
let id_args = ty::GenericArgs::identity_for_item(tcx, item_def_id);
for (pred, _) in tcx
for (clause, _) in tcx
.explicit_item_bounds(item_def_id)
.iter_instantiated_copied(tcx, id_args)
.map(Unnormalized::skip_norm_wip)
{
debug!(?pred);
debug!(?clause);

// We only ignore opaque type args if the opaque type is the outermost type.
// The opaque type may be nested within itself via recursion in e.g.
// type Foo<'a> = impl PartialEq<Foo<'a>>;
// which thus mentions `'a` and should thus accept hidden types that borrow 'a
// instead of requiring an additional `+ 'a`.
match pred.kind().skip_binder() {
match clause.kind().skip_binder() {
ty::ClauseKind::Trait(ty::TraitPredicate {
trait_ref: ty::TraitRef { def_id: _, args, .. },
polarity: _,
})
| ty::ClauseKind::HostEffect(ty::HostEffectPredicate {
| ty::ClauseKind::HostEffect(ty::HostEffectClause {
trait_ref: ty::TraitRef { def_id: _, args, .. },
constness: _,
}) => {
Expand All @@ -219,7 +219,7 @@ fn variance_of_opaque(
region.visit_with(&mut collector);
}
_ => {
pred.visit_with(&mut collector);
clause.visit_with(&mut collector);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
ty::ClauseKind::Trait(pred) => {
(pred.trait_ref.args.to_vec(), Some(pred.self_ty().into()))
}
ty::ClauseKind::HostEffect(pred) => {
(pred.trait_ref.args.to_vec(), Some(pred.self_ty().into()))
ty::ClauseKind::HostEffect(clause) => {
(clause.trait_ref.args.to_vec(), Some(clause.self_ty().into()))
}
ty::ClauseKind::Projection(pred) => (pred.projection_term.args.to_vec(), None),
ty::ClauseKind::ConstArgHasType(arg, ty) => (vec![ty.into(), arg.into()], None),
Expand Down
10 changes: 10 additions & 0 deletions compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// Type check the pattern. Override if necessary to avoid knock-on errors.
self.check_pat_top(decl.pat, decl_ty, ty_span, origin_expr, Some(decl.origin));
let pat_ty = self.node_ty(decl.pat.hir_id);
if decl.ty.is_none()
&& decl.init.is_none()
&& !matches!(decl.pat.kind, hir::PatKind::Binding(.., None) | hir::PatKind::Wild)
{
self.register_wf_obligation(
decl_ty.into(),
decl.pat.span,
ObligationCauseCode::WellFormed(None),
);
}
self.overwrite_local_ty_if_err(decl.hir_id, decl.pat, pat_ty);

if let Some(blk) = decl.origin.try_get_else() {
Expand Down
16 changes: 11 additions & 5 deletions compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::any::Any;
use std::mem;
use std::sync::Arc;

use rustc_data_structures::unord::ExtendUnord;
use rustc_data_structures::fx::FxHashMap;
use rustc_hir::attrs::Deprecation;
use rustc_hir::def::{CtorKind, DefKind};
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LOCAL_CRATE};
Expand Down Expand Up @@ -473,7 +473,7 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
// the former.
// This is a rudimentary check that does not catch all cases,
// just the easiest.
let mut fallback_map: DefIdMap<DefId> = Default::default();
let mut fallback_map: FxHashMap<DefId, DefId> = Default::default();

// Issue 46112: We want the map to prefer the shortest
// paths when reporting the path to an item. Therefore we
Expand Down Expand Up @@ -574,10 +574,16 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
// We must extend the fallback map with items from the visible parent map
// as the extend call overrides existing entries from the latter map,
// which we prefer over fallback entries.
let mut merged_visible_parent_map = fallback_map;
merged_visible_parent_map.extend_unord(visible_parent_map.into_items());
// FIXME: The Unord* APIs lack an efficient way of merging
// the values of one map for only the missing keys of the other map,
// which is required to merge the fallback map into the visible parent map.
// In the meantime, use an "ordered" map internally for fallback entries.
#[allow(rustc::potential_query_instability)]
for (child, parent) in fallback_map {
visible_parent_map.entry(child).or_insert(parent);
}

merged_visible_parent_map
visible_parent_map
},

dependency_formats: |tcx, ()| Arc::new(crate::dependency_format::calculate(tcx)),
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_middle/src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ impl<'tcx> ObligationCause<'tcx> {

pub fn derived_host_cause(
mut self,
parent_host_pred: ty::Binder<'tcx, ty::HostEffectPredicate<'tcx>>,
parent_host_clause: ty::Binder<'tcx, ty::HostEffectClause<'tcx>>,
variant: impl FnOnce(DerivedHostCause<'tcx>) -> ObligationCauseCode<'tcx>,
) -> ObligationCause<'tcx> {
self.code = variant(DerivedHostCause { parent_host_pred, parent_code: self.code }).into();
self.code = variant(DerivedHostCause { parent_host_clause, parent_code: self.code }).into();
self
}

Expand Down Expand Up @@ -600,11 +600,11 @@ pub struct ImplDerivedCause<'tcx> {
#[derive(Clone, Debug, PartialEq, Eq, StableHash, TyEncodable, TyDecodable)]
#[derive(TypeVisitable, TypeFoldable)]
pub struct DerivedHostCause<'tcx> {
/// The trait predicate of the parent obligation that led to the
/// The trait clause of the parent obligation that led to the
/// current obligation. Note that only trait obligations lead to
/// derived obligations, so we just store the trait predicate here
/// derived obligations, so we just store the trait clause here
/// directly.
pub parent_host_pred: ty::Binder<'tcx, ty::HostEffectPredicate<'tcx>>,
pub parent_host_clause: ty::Binder<'tcx, ty::HostEffectClause<'tcx>>,

/// The parent trait had this cause.
pub parent_code: ObligationCauseCodeHandle<'tcx>,
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_middle/src/ty/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ impl<'tcx> GenericClauses<'tcx> {
#[derive(Copy, Clone, Default, Debug, TyEncodable, TyDecodable, StableHash)]
pub struct ConstConditions<'tcx> {
pub parent: Option<DefId>,
pub predicates: &'tcx [(ty::PolyTraitRef<'tcx>, Span)],
pub clauses: &'tcx [(ty::PolyTraitRef<'tcx>, Span)],
}

impl<'tcx> ConstConditions<'tcx> {
Expand All @@ -559,7 +559,7 @@ impl<'tcx> ConstConditions<'tcx> {
+ DoubleEndedIterator
+ ExactSizeIterator
+ Clone {
EarlyBinder::bind_iter(self.predicates).iter_instantiated_copied(tcx, args).map(|u| {
EarlyBinder::bind_iter(self.clauses).iter_instantiated_copied(tcx, args).map(|u| {
let (trait_ref, span) = u.unzip();
(trait_ref, span.skip_normalization())
})
Expand All @@ -571,7 +571,7 @@ impl<'tcx> ConstConditions<'tcx> {
+ DoubleEndedIterator
+ ExactSizeIterator
+ Clone {
EarlyBinder::bind_iter(self.predicates).iter_identity_copied().map(|u| {
EarlyBinder::bind_iter(self.clauses).iter_identity_copied().map(|u| {
let (trait_ref, span) = u.unzip();
(trait_ref, span.skip_normalization())
})
Expand All @@ -588,9 +588,9 @@ impl<'tcx> ConstConditions<'tcx> {
tcx.const_conditions(def_id).instantiate_into(tcx, instantiated, args);
}
instantiated.extend(
self.predicates
self.clauses
.iter()
.map(|&(p, s)| (EarlyBinder::bind(tcx, p).instantiate(tcx, args), s)),
.map(|&(c, s)| (EarlyBinder::bind(tcx, c).instantiate(tcx, args), s)),
);
}

Expand All @@ -612,7 +612,7 @@ impl<'tcx> ConstConditions<'tcx> {
tcx.const_conditions(def_id).instantiate_identity_into(tcx, instantiated);
}
instantiated.extend(
self.predicates
self.clauses
.iter()
.copied()
.map(|(trait_ref, span)| (Unnormalized::new(trait_ref), span)),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub use self::pattern::{Pattern, PatternKind};
pub use self::predicate::{
AliasTerm, AliasTermKind, ArgOutlivesClause, Clause, ClauseKind, CoercePredicate,
ExistentialPredicate, ExistentialPredicateStableCmpExt, ExistentialProjection,
ExistentialTraitRef, HostEffectPredicate, NormalizesTo, OutlivesClause, PolyCoercePredicate,
ExistentialTraitRef, HostEffectClause, NormalizesTo, OutlivesClause, PolyCoercePredicate,
PolyExistentialPredicate, PolyExistentialProjection, PolyExistentialTraitRef,
PolyProjectionPredicate, PolyRegionOutlivesClause, PolySubtypePredicate, PolyTraitPredicate,
PolyTraitRef, PolyTypeOutlivesClause, Predicate, PredicateKind, ProjectionPredicate,
Expand Down
18 changes: 5 additions & 13 deletions compiler/rustc_middle/src/ty/predicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub type ExistentialPredicate<'tcx> = ir::ExistentialPredicate<TyCtxt<'tcx>>;
pub type ExistentialTraitRef<'tcx> = ir::ExistentialTraitRef<TyCtxt<'tcx>>;
pub type ExistentialProjection<'tcx> = ir::ExistentialProjection<TyCtxt<'tcx>>;
pub type TraitPredicate<'tcx> = ir::TraitPredicate<TyCtxt<'tcx>>;
pub type HostEffectPredicate<'tcx> = ir::HostEffectPredicate<TyCtxt<'tcx>>;
pub type HostEffectClause<'tcx> = ir::HostEffectClause<TyCtxt<'tcx>>;
pub type ClauseKind<'tcx> = ir::ClauseKind<TyCtxt<'tcx>>;
pub type PredicateKind<'tcx> = ir::PredicateKind<TyCtxt<'tcx>>;
pub type NormalizesTo<'tcx> = ir::NormalizesTo<TyCtxt<'tcx>>;
Expand Down Expand Up @@ -582,24 +582,16 @@ impl<'tcx> UpcastFrom<TyCtxt<'tcx>, PolyProjectionPredicate<'tcx>> for Clause<'t
}
}

impl<'tcx> UpcastFrom<TyCtxt<'tcx>, ty::Binder<'tcx, ty::HostEffectPredicate<'tcx>>>
impl<'tcx> UpcastFrom<TyCtxt<'tcx>, ty::Binder<'tcx, ty::HostEffectClause<'tcx>>>
for Predicate<'tcx>
{
fn upcast_from(
from: ty::Binder<'tcx, ty::HostEffectPredicate<'tcx>>,
tcx: TyCtxt<'tcx>,
) -> Self {
fn upcast_from(from: ty::Binder<'tcx, ty::HostEffectClause<'tcx>>, tcx: TyCtxt<'tcx>) -> Self {
from.map_bound(ty::ClauseKind::HostEffect).upcast(tcx)
}
}

impl<'tcx> UpcastFrom<TyCtxt<'tcx>, ty::Binder<'tcx, ty::HostEffectPredicate<'tcx>>>
for Clause<'tcx>
{
fn upcast_from(
from: ty::Binder<'tcx, ty::HostEffectPredicate<'tcx>>,
tcx: TyCtxt<'tcx>,
) -> Self {
impl<'tcx> UpcastFrom<TyCtxt<'tcx>, ty::Binder<'tcx, ty::HostEffectClause<'tcx>>> for Clause<'tcx> {
fn upcast_from(from: ty::Binder<'tcx, ty::HostEffectClause<'tcx>>, tcx: TyCtxt<'tcx>) -> Self {
from.map_bound(ty::ClauseKind::HostEffect).upcast(tcx)
}
}
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3223,7 +3223,7 @@ define_print! {
self.trait_ref.print_trait_sugared().print(p)?;
}

ty::HostEffectPredicate<'tcx> {
ty::HostEffectClause<'tcx> {
let constness = match self.constness {
ty::BoundConstness::Const => { "const" }
ty::BoundConstness::Maybe => { "[const]" }
Expand All @@ -3241,10 +3241,10 @@ define_print! {
ty::ClauseKind<'tcx> {
match *self {
ty::ClauseKind::Trait(ref data) => data.print(p)?,
ty::ClauseKind::RegionOutlives(predicate) => predicate.print(p)?,
ty::ClauseKind::TypeOutlives(predicate) => predicate.print(p)?,
ty::ClauseKind::RegionOutlives(clause) => clause.print(p)?,
ty::ClauseKind::TypeOutlives(clause) => clause.print(p)?,
ty::ClauseKind::Projection(predicate) => predicate.print(p)?,
ty::ClauseKind::HostEffect(predicate) => predicate.print(p)?,
ty::ClauseKind::HostEffect(clause) => clause.print(p)?,
ty::ClauseKind::ConstArgHasType(ct, ty) => {
write!(p, "the constant `")?;
ct.print(p)?;
Expand Down
Loading
Loading