Skip to content
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
ae174cf
Make `std::fs::{File, ReadDir, DirEntry}` always `needs_drop` even wh…
kpreid Sep 7, 2026
9da36d0
Collect all limit attributes during TyCtxt creation
oli-obk Oct 5, 2026
ac009af
make the safety documentation consistent in task::LocalWaker
yilin0518 Oct 13, 2026
f6bb16b
std: make SOLID `sockaddr_storage` large enough for IPv6
portlandhodl Oct 13, 2026
9a6401d
Add missing full stop
shepmaster Oct 15, 2026
ec9a248
core: hint: fix `unlikely`'s example polarity typo
ojeda Oct 15, 2026
fd92098
Add ui test for issue 164169
xizheyin Oct 16, 2026
ad1fd47
skip wrong loops when explaining borrow errors
xizheyin Oct 16, 2026
8c284bd
Fix test pattern column placement and alignment
jieyouxu Oct 9, 2026
b02b177
Tighten patterns to actually check for absence of return attribute
jieyouxu Oct 9, 2026
26bffca
Canonicalize operands for commutative binary ops
mu001999 Sep 26, 2026
7ef3170
Update other tests
mu001999 Oct 13, 2026
52b5c71
Add methods to TCP and UDP sockets to modify hop limit (refresh of #9…
Mallets Oct 17, 2026
d8980d3
Remap local def ids for deterministic metadata encoding
aerooneqq Oct 17, 2026
827434e
Rollup merge of #162809 - aerooneqq:def-index-remapping, r=oli-obk
JonathanBrouwer Oct 17, 2026
8c955a1
Rollup merge of #163373 - mu001999-contrib:fix-162220, r=dianqk
JonathanBrouwer Oct 17, 2026
9634c28
Rollup merge of #164016 - jieyouxu:jieyouxu/tighten-test, r=saethlin
JonathanBrouwer Oct 17, 2026
0afe2c3
Rollup merge of #164259 - portlandhodl:kmc-solid-sockaddr-storage-ipv…
JonathanBrouwer Oct 17, 2026
ff3ab52
Rollup merge of #164424 - xizheyin:issue-164169, r=estebank
JonathanBrouwer Oct 17, 2026
37a7c56
Rollup merge of #138744 - Mallets:set_ipv6_sock_hop_limit, r=jhpratt
JonathanBrouwer Oct 17, 2026
42fe16a
Rollup merge of #162444 - kpreid:filedrop, r=joboet
JonathanBrouwer Oct 17, 2026
4a85cd2
Rollup merge of #163862 - oli-obk:push-uotnnkkkpmzv, r=fee1-dead
JonathanBrouwer Oct 17, 2026
e0d877b
Rollup merge of #164213 - yilin0518:fix_local_waker, r=JohnTitor
JonathanBrouwer Oct 17, 2026
3f8f57f
Rollup merge of #164356 - shepmaster:full-stop, r=JohnTitor
JonathanBrouwer Oct 17, 2026
52efcc8
Rollup merge of #164374 - ojeda:likely-typo, r=hanna-kruppe
JonathanBrouwer Oct 17, 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_borrowck/src/diagnostics/explain_borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
// loop iteration. In this case, try using the loop terminator location in
// `find_sub_region_live_at`.
if let Some(loop_terminator_location) =
regioncx.find_loop_terminator_location(borrow.region, body)
regioncx.find_loop_terminator_location(borrow.region, body, location)
{
region_sub = self
.regioncx
Expand Down
11 changes: 7 additions & 4 deletions compiler/rustc_borrowck/src/region_infer/region_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -816,16 +816,19 @@ impl<'tcx> RegionInferenceContextInner<'tcx> {
&self,
r: RegionVid,
body: &Body<'_>,
from_location: Location,
) -> Option<Location> {
let scc = self.constraint_sccs.scc(r);
let locations = self.scc_values.locations_outlived_by(scc);
for location in locations {
let bb = &body[location.block];
if let Some(terminator) = &bb.terminator
if from_location.is_predecessor_of(location, body) {
let bb = &body[location.block];
if let Some(terminator) = &bb.terminator
// terminator of a loop should be TerminatorKind::FalseUnwind
&& let TerminatorKind::FalseUnwind { .. } = terminator.kind
{
return Some(location);
{
return Some(location);
}
}
}
None
Expand Down
19 changes: 14 additions & 5 deletions compiler/rustc_hir_id/src/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ pub struct Definitions {
def_id_to_key: IndexVec<LocalDefId, DefKey>,
// We do only store the local hash, as all the definitions are from the current crate.
def_path_hashes: IndexVec<LocalDefId, Hash64>,
// The first non deterministic def index, may correspond to non-allocated
// def id, in this case `first_non_det_index.as_usize() == num_definitions`.
first_non_det_index: Option<DefIndex>,
def_path_hash_to_index: DefPathToIndexMap,
}

Expand Down Expand Up @@ -302,13 +305,18 @@ pub enum DefPathData {
}

impl Definitions {
/// This function indicates that the order of def id allocations
/// This function indicates that the def id allocations
/// may be non-deterministic after it was called.
pub fn commit_end_of_determinism(&mut self) {
assert!(
self.def_path_hash_to_index.after_parallel_alloc.replace(Default::default()).is_none(),
"this function should be called only once"
)
let prev = self.def_path_hash_to_index.after_parallel_alloc.replace(Default::default());
assert!(prev.is_none(), "this function should be called only once");

let def_index = DefIndex::from_usize(self.def_id_to_key.len());
self.first_non_det_index.replace(def_index);
}

pub fn first_non_det_index(&self) -> DefIndex {
self.first_non_det_index.expect("must contain index")
}

#[inline(always)]
Expand Down Expand Up @@ -362,6 +370,7 @@ impl Definitions {
def_path_hashes: Default::default(),
def_id_to_key: Default::default(),
def_path_hash_to_index: Default::default(),
first_non_det_index: Default::default(),
};

// Create the root definition.
Expand Down
53 changes: 38 additions & 15 deletions compiler/rustc_interface/src/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,51 @@
//! Users can override these limits via an attribute on the crate like
//! `#![recursion_limit="22"]`. This pass just looks for those attributes.

use rustc_ast::{self as ast, DUMMY_NODE_ID};
use rustc_attr_ir::target::Target;
use rustc_attr_ir::{Attribute, find_attr};
use rustc_middle::query::Providers;
use rustc_attr_parsing::{AttributeParser, ShouldEmit};
use rustc_feature::Features;
use rustc_session::{Limits, Session};
use rustc_span::{DUMMY_SP, sym};
use rustc_structures::Limit;

pub(crate) fn provide(providers: &mut Providers) {
providers.limits = |tcx, ()| {
let attrs = tcx.hir_krate_attrs();
Limits {
recursion_limit: get_recursion_limit(tcx.hir_krate_attrs(), tcx.sess),
move_size_limit: find_attr!(attrs, MoveSizeLimit { limit } => *limit)
.unwrap_or(Limit::new(tcx.sess.opts.unstable_opts.move_size_limit.unwrap_or(0))),
type_length_limit: find_attr!(attrs, TypeLengthLimit { limit } => *limit)
.unwrap_or(Limit::new(2usize.pow(24))),
pattern_complexity_limit: find_attr!(attrs, PatternComplexityLimit { limit } => *limit)
.unwrap_or(Limit::unlimited()),
}
pub fn get_limits(krate_attrs: &[ast::Attribute], sess: &Session, features: &Features) -> Limits {
let attrs = AttributeParser::parse_limited_all(
sess,
&krate_attrs,
Some(&|attr| {
attr.has_any_name(&[
sym::recursion_limit,
sym::move_size_limit,
sym::type_length_limit,
sym::pattern_complexity_limit,
])
}),
Target::Crate,
DUMMY_SP,
DUMMY_NODE_ID,
Some(features),
// errors are fatal here, but lints aren't.
// If things aren't fatal we continue, and will parse this again.
// That makes the same lint trigger again.
// So, no lints here to avoid duplicates.
ShouldEmit::EarlyFatal { also_emit_lints: false },
None,
);
let attrs = &attrs;
Limits {
recursion_limit: get_recursion_limit(attrs, sess),
move_size_limit: find_attr!(attrs, MoveSizeLimit { limit } => *limit)
.unwrap_or(Limit::new(sess.opts.unstable_opts.move_size_limit.unwrap_or(0))),
type_length_limit: find_attr!(attrs, TypeLengthLimit { limit } => *limit)
.unwrap_or(Limit::new(2usize.pow(24))),
pattern_complexity_limit: find_attr!(attrs, PatternComplexityLimit { limit } => *limit)
.unwrap_or(Limit::unlimited()),
}
}

// This one is separate because it must be read prior to macro expansion.
pub(crate) fn get_recursion_limit(attrs: &[Attribute], sess: &Session) -> Limit {
fn get_recursion_limit(attrs: &[Attribute], sess: &Session) -> Limit {
let limit_from_crate = find_attr!(attrs, RecursionLimit { limit } => limit.0).unwrap_or(128);
Limit::new(
sess.opts
Expand Down
27 changes: 6 additions & 21 deletions compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use rustc_session::{IncrCompSession, Session};
use rustc_span::{
DUMMY_SP, ErrorGuaranteed, ExpnKind, SourceFileHash, SourceFileHashAlgorithm, Span, Symbol, sym,
};
use rustc_structures::{CrateType, Limit};
use rustc_structures::CrateType;
use rustc_trait_selection::{solve, traits};
use tracing::{info, instrument};

Expand Down Expand Up @@ -201,7 +201,7 @@ fn configure_and_expand(
}

// Create the config for macro expansion
let recursion_limit = get_recursion_limit(pre_configured_attrs, sess);
let recursion_limit = tcx.recursion_limit();
let cfg = rustc_expand::expand::ExpansionConfig {
crate_name,
features,
Expand Down Expand Up @@ -905,7 +905,6 @@ pub static DEFAULT_QUERY_PROVIDERS: LazyLock<Providers> = LazyLock::new(|| {
providers.queries.env_var_os = env_var_os;
providers.queries.proc_macro_decls_static = |tcx, _| tcx.hir_crate_items(()).proc_macro_decls();
rustc_ast_lowering::provide(&mut providers.queries);
limits::provide(&mut providers.queries);
rustc_expand_queries::provide(&mut providers.queries);
rustc_const_eval::provide(providers);
rustc_middle::hir::provide(&mut providers.queries);
Expand Down Expand Up @@ -1037,11 +1036,13 @@ pub fn create_and_enter_global_ctxt<T, F: for<'tcx> FnOnce(TyCtxt<'tcx>) -> T>(
feed.crate_name(crate_name);

let feed = tcx.feed_unit_query();
feed.features_query(tcx.arena.alloc(rustc_expand::config::features(
let features = tcx.arena.alloc(rustc_expand::config::features(
tcx.sess,
&pre_configured_attrs,
crate_name,
)));
));
feed.features_query(features);
feed.limits(limits::get_limits(&pre_configured_attrs, tcx.sess, features));
feed.crate_for_resolver(tcx.arena.alloc(Steal::new((krate, pre_configured_attrs))));
feed.output_filenames(Arc::new(outputs));

Expand Down Expand Up @@ -1523,19 +1524,3 @@ pub fn collect_crate_types(
fn default_output_for_target(sess: &Session) -> CrateType {
if !sess.target.executables { CrateType::StaticLib } else { CrateType::Executable }
}

fn get_recursion_limit(krate_attrs: &[ast::Attribute], sess: &Session) -> Limit {
let attr = AttributeParser::parse_limited_sym_should_emit(
sess,
&krate_attrs,
&[sym::recursion_limit],
DUMMY_SP,
None,
// errors are fatal here, but lints aren't.
// If things aren't fatal we continue, and will parse this again.
// That makes the same lint trigger again.
// So, no lints here to avoid duplicates.
ShouldEmit::EarlyFatal { also_emit_lints: false },
);
crate::limits::get_recursion_limit(attr.as_slice(), sess)
}
7 changes: 4 additions & 3 deletions compiler/rustc_metadata/src/rmeta/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use tracing::debug;

use crate::creader::CStore;
use crate::eii::EiiMapEncodedKeyValue;
use crate::rmeta::remapped_def_id::RemappedRawDefId;
use crate::rmeta::table::IsDefault;
use crate::rmeta::*;

Expand Down Expand Up @@ -103,7 +104,7 @@ pub(crate) struct CrateMetadata {
/// FIXME: make type of the value `LazyArray<(DefIndex, Option<SimplifiedType>)>`
/// through transmuting or somehow else, as `LocalDefId` here should be `DefIndex`,
/// as it is from external crate.
trait_impls: FxIndexMap<RawDefId, LazyArray<(LocalDefId, Option<SimplifiedType>)>>,
trait_impls: FxIndexMap<RemappedRawDefId, LazyArray<(LocalDefId, Option<SimplifiedType>)>>,
/// Inherent impls which do not follow the normal coherence rules.
///
/// These can be introduced using either `#![rustc_coherence_is_core]`
Expand Down Expand Up @@ -2163,10 +2164,10 @@ impl CrateMetadata {

// Translate a DefId from the current compilation environment to a DefId
// for an external crate.
fn reverse_translate_def_id(&self, did: DefId) -> Option<RawDefId> {
fn reverse_translate_def_id(&self, did: DefId) -> Option<RemappedRawDefId> {
for (local, &global) in self.cnum_map.iter_enumerated() {
if global == did.krate {
return Some(RawDefId { krate: local.as_u32(), index: did.index.as_u32() });
return Some(RemappedRawDefId::new_unchecked(local.as_u32(), did.index.as_u32()));
}
}

Expand Down
Loading
Loading