Skip to content
Closed
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
3d40189
Hermit: Don't cast `i32` to `i32`
mkroening Jun 30, 2026
87900d9
Hermit: Inline `InnerReadDir::new`
mkroening Jun 30, 2026
149dc77
Hermit: Avoid unsoundness around dirent64
mkroening Jun 30, 2026
736fa96
Hermit: Avoid cloning `InnerReadDir::root`
mkroening Jun 30, 2026
5b4b02e
avoid ICE in From/TryFrom cast diag
sjwang05 Jul 9, 2026
576d1bd
Hermit: Rework `getdents64` implementation
jounathaen Jun 26, 2026
0229444
Hermit: Filter out `.` and `..` from `getdents64`
mkroening Jul 1, 2026
50d66b9
Work around Wine bug 60084 by calling WSAStartup at most once
tbu- Jul 29, 2026
51b4904
bootstrap: remove use-lld config alias
kn1g78 Jul 29, 2026
31918e4
Rename `rustc_codegen_gcc/errors.rs` into `rustc_codegen_gcc/diagnost…
GuillaumeGomez Jul 29, 2026
6229545
Rename `rustc_codegen_llvm/errors.rs` into `rustc_codegen_llvm/diagno…
GuillaumeGomez Jul 29, 2026
580253e
split module resolutions into local and external types, with external…
LorrensP-2158466 Jul 28, 2026
3d0b63d
hermit/fs: Return `unsupported()` instead of `from_raw_os_error(22)`
mkroening Jun 22, 2026
bf3917c
Rollup merge of #158247 - hermit-os:hermit-fs-unsupported, r=clarfonthey
JonathanBrouwer Jul 29, 2026
c58a754
Rollup merge of #158649 - hermit-os:hermit-readdir, r=joboet
JonathanBrouwer Jul 29, 2026
3082c99
Rollup merge of #159049 - sjwang05:issue-158967, r=lcnr
JonathanBrouwer Jul 29, 2026
4c7cdab
Rollup merge of #160099 - LorrensP-2158466:split-module-resolutions, …
JonathanBrouwer Jul 29, 2026
078e630
Rollup merge of #160134 - tbu-:pr_wine_60084_wsastartup, r=ChrisDenton
JonathanBrouwer Jul 29, 2026
3ff0384
Rollup merge of #160142 - kn1g78:remove-use-lld-config-alias, r=Kobzol
JonathanBrouwer Jul 29, 2026
ece20ed
Rollup merge of #160148 - GuillaumeGomez:rename-errors, r=JonathanBro…
JonathanBrouwer Jul 29, 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_codegen_gcc/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use rustc_target::asm::*;
use crate::builder::Builder;
use crate::callee::get_fn;
use crate::context::CodegenCx;
use crate::errors::{NulBytesInAsm, UnwindingInlineAsm};
use crate::diagnostics::{NulBytesInAsm, UnwindingInlineAsm};
use crate::type_of::LayoutGccExt;

// Rust asm! and GCC Extended Asm semantics differ substantially.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use rustc_log::tracing::info;
use tempfile::{TempDir, tempdir};

use crate::back::write::{codegen, save_temp_bitcode};
use crate::errors::LtoBitcodeFromRlib;
use crate::diagnostics::LtoBitcodeFromRlib;
use crate::{GccCodegenBackend, GccContext, LtoMode, to_gcc_opt_level};

struct LtoData {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use rustc_session::config::OutputType;
use rustc_target::spec::SplitDebuginfo;

use crate::base::add_pic_option;
use crate::errors::CopyBitcode;
use crate::diagnostics::CopyBitcode;
use crate::{GccContext, LtoMode};

pub(crate) fn codegen(
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_gcc/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use rustc_target::spec::{HasTargetSpec, HasX86AbiOpt, Target, X86Abi};
use crate::abi::FnAbiGccExt;
use crate::common::{SignType, TypeReflection, type_is_pointer};
use crate::context::CodegenCx;
use crate::errors;
use crate::diagnostics;
use crate::intrinsic::llvm;
use crate::type_of::LayoutGccExt;

Expand Down Expand Up @@ -1803,7 +1803,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
_instance: Option<Instance<'tcx>>,
) {
// FIXME: implement support for explicit tail calls like rustc_codegen_llvm.
self.tcx.dcx().emit_fatal(errors::ExplicitTailCallsUnsupported);
self.tcx.dcx().emit_fatal(diagnostics::ExplicitTailCallsUnsupported);
}

fn zext(&mut self, value: RValue<'gcc>, dest_typ: Type<'gcc>) -> RValue<'gcc> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mod context;
mod coverageinfo;
mod debuginfo;
mod declare;
mod errors;
mod diagnostics;
mod gcc_util;
mod int;
mod intrinsic;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use rustc_target::spec::{Arch, FramePointer, SanitizerSet, StackProbeType, Stack
use smallvec::SmallVec;

use crate::context::SimpleCx;
use crate::errors::{PackedStackBackchainNeedsSoftfloat, SanitizerMemtagRequiresMte};
use crate::diagnostics::{PackedStackBackchainNeedsSoftfloat, SanitizerMemtagRequiresMte};
use crate::llvm::AttributePlace::Function;
use crate::llvm::{
self, AllocKindFlags, Attribute, AttributeKind, AttributePlace, MemoryEffects, Value,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::back::write::{
self, CodegenDiagnosticsStage, DiagnosticHandlers, bitcode_section_name, codegen,
save_temp_bitcode,
};
use crate::errors::{LlvmError, LtoBitcodeFromRlib};
use crate::diagnostics::{LlvmError, LtoBitcodeFromRlib};
use crate::llvm::{self, build_string};
use crate::{LlvmCodegenBackend, ModuleLlvm};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::ptr::NonNull;

use rustc_data_structures::small_c_str::SmallCStr;

use crate::errors::LlvmError;
use crate::diagnostics::LlvmError;
use crate::llvm;

/// Responsible for safely creating and disposing llvm::TargetMachine via ffi functions.
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use crate::back::profiling::{
use crate::builder::SBuilder;
use crate::builder::gpu_offload::scalar_width;
use crate::common::AsCCharPtr;
use crate::errors::{
use crate::diagnostics::{
CopyBitcode, FromLlvmDiag, FromLlvmOptimizationDiag, LlvmError, ParseTargetMachineConfig,
UnsupportedCompression, WithLlvmError, WriteBytecode,
};
Expand Down Expand Up @@ -819,7 +819,7 @@ pub(crate) unsafe fn llvm_optimize(
device_out_c.as_ptr(),
);
if !ok || !device_out.exists() {
dcx.emit_err(crate::errors::OffloadBundleImagesFailed);
dcx.emit_err(crate::diagnostics::OffloadBundleImagesFailed);
}
}
}
Expand All @@ -837,15 +837,15 @@ pub(crate) unsafe fn llvm_optimize(
{
let device_pathbuf = PathBuf::from(device_path);
if device_pathbuf.is_relative() {
dcx.emit_err(crate::errors::OffloadWithoutAbsPath);
dcx.emit_err(crate::diagnostics::OffloadWithoutAbsPath);
} else if device_pathbuf
.file_name()
.and_then(|n| n.to_str())
.is_some_and(|n| n != "device.bin")
{
dcx.emit_err(crate::errors::OffloadWrongFileName);
dcx.emit_err(crate::diagnostics::OffloadWrongFileName);
} else if !device_pathbuf.exists() {
dcx.emit_err(crate::errors::OffloadNonexistingPath);
dcx.emit_err(crate::diagnostics::OffloadNonexistingPath);
}
let host_path = cgcx.output_filenames.path(OutputType::Object);
let host_dir = host_path.parent().unwrap();
Expand All @@ -859,7 +859,7 @@ pub(crate) unsafe fn llvm_optimize(
let ok =
unsafe { llvm::LLVMRustOffloadEmbedBufferInModule(llmod2, device_bin_c.as_ptr()) };
if !ok {
dcx.emit_err(crate::errors::OffloadEmbedFailed);
dcx.emit_err(crate::diagnostics::OffloadEmbedFailed);
}
write_output_file(
dcx,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use rustc_target::spec::Arch;
use tracing::{debug, instrument, trace};

use crate::common::CodegenCx;
use crate::errors::SymbolAlreadyDefined;
use crate::diagnostics::SymbolAlreadyDefined;
use crate::llvm::{self, Type, Value, const_ptr_auth};
use crate::type_of::LayoutLlvmExt;
use crate::{base, debuginfo};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ pub(crate) unsafe fn create_module<'ll>(
.expect("got a non-UTF8 data-layout from LLVM");

if target_data_layout != llvm_data_layout {
tcx.dcx().emit_err(crate::errors::MismatchedDataLayout {
tcx.dcx().emit_err(crate::diagnostics::MismatchedDataLayout {
rustc_target: sess.opts.target_triple.to_string().as_str(),
rustc_layout: target_data_layout.as_str(),
llvm_target: sess.target.llvm_target.borrow(),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use crate::builder::gpu_offload::{
};
use crate::context::CodegenCx;
use crate::declare::declare_raw_fn;
use crate::errors::{
use crate::diagnostics::{
AutoDiffWithoutEnable, AutoDiffWithoutLto, IntrinsicSignatureMismatch, IntrinsicWrongArch,
OffloadWithoutEnable, OffloadWithoutFatLTO, UnknownIntrinsic,
};
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_codegen_llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mod context;
mod coverageinfo;
mod debuginfo;
mod declare;
mod errors;
mod diagnostics;
mod intrinsic;
mod llvm;
mod llvm_util;
Expand Down Expand Up @@ -233,10 +233,11 @@ impl CodegenBackend for LlvmCodegenBackend {
match llvm::EnzymeWrapper::get_or_init(&sess.opts.sysroot) {
Ok(_) => {}
Err(llvm::EnzymeLibraryError::NotFound { err }) => {
sess.dcx().emit_fatal(crate::errors::AutoDiffComponentMissing { err });
sess.dcx().emit_fatal(crate::diagnostics::AutoDiffComponentMissing { err });
}
Err(llvm::EnzymeLibraryError::LoadFailed { err }) => {
sess.dcx().emit_fatal(crate::errors::AutoDiffComponentUnavailable { err });
sess.dcx()
.emit_fatal(crate::diagnostics::AutoDiffComponentUnavailable { err });
}
}
enable_autodiff_settings(&sess.opts.unstable_opts.autodiff);
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use rustc_target::spec::{
use smallvec::{SmallVec, smallvec};

use crate::back::write::create_informational_target_machine;
use crate::{errors, llvm};
use crate::{diagnostics, llvm};

static INIT: Once = Once::new();

Expand Down Expand Up @@ -636,7 +636,8 @@ fn llvm_features_by_flags(sess: &Session, features: &mut Vec<String>) {
// -Zfixed-x18
if sess.opts.unstable_opts.fixed_x18 {
if sess.target.arch != Arch::AArch64 {
sess.dcx().emit_fatal(errors::FixedX18InvalidArch { arch: sess.target.arch.desc() });
sess.dcx()
.emit_fatal(diagnostics::FixedX18InvalidArch { arch: sess.target.arch.desc() });
} else {
features.push("+reserve-x18".into());
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/mono_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use tracing::debug;
use crate::abi::FnAbiLlvmExt;
use crate::builder::Builder;
use crate::context::CodegenCx;
use crate::errors::SymbolAlreadyDefined;
use crate::diagnostics::SymbolAlreadyDefined;
use crate::type_of::LayoutLlvmExt;
use crate::{base, llvm};

Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_resolve/src/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ use crate::ref_mut::CmCell;
use crate::{
BindingKey, Decl, DeclData, DeclKind, DelayedVisResolutionError, ExternModule,
ExternPreludeEntry, Finalize, IdentKey, LocalModule, Module, ModuleKind, ModuleOrUniformRoot,
ParentScope, PathResult, Res, Resolver, Segment, Used, VisResolutionError, diagnostics,
ParentScope, PathResult, Res, ResolutionTable, Resolver, Segment, Used, VisResolutionError,
diagnostics,
};

impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
Expand Down Expand Up @@ -336,7 +337,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
pub(crate) fn build_reduced_graph_external(
&self,
module: ExternModule<'ra>,
) -> FxIndexMap<BindingKey, NameResolutionRef<'ra>> {
) -> ResolutionTable<'ra> {
let mut resolutions = FxIndexMap::default();
let def_id = module.def_id();
let children = self.tcx.module_children(def_id);
Expand Down
49 changes: 28 additions & 21 deletions compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
use std::cell::Ref;
use std::collections::BTreeSet;
use std::ops::ControlFlow;
use std::sync::{Arc, Once};
use std::sync::{Arc, OnceLock};
use std::{fmt, mem};

use diagnostics::{ParamKindInEnumDiscriminant, ParamKindInNonTrivialAnonConst};
Expand Down Expand Up @@ -633,7 +633,22 @@ impl BindingKey {
}
}

type Resolutions<'ra> = CmRefCell<FxIndexMap<BindingKey, NameResolutionRef<'ra>>>;
type ResolutionTable<'ra> = FxIndexMap<BindingKey, NameResolutionRef<'ra>>;

enum Resolutions<'ra> {
Local(CmRefCell<ResolutionTable<'ra>>),
Extern(OnceLock<CmRefCell<ResolutionTable<'ra>>>),
}

impl<'ra> Resolutions<'ra> {
fn new(local: bool) -> Self {
if local {
Resolutions::Local(Default::default())
} else {
Resolutions::Extern(Default::default())
}
}
}

/// One node in the tree of modules.
///
Expand All @@ -655,8 +670,6 @@ struct ModuleData<'ra> {
/// Mapping between names and their (possibly in-progress) resolutions in this module.
/// Resolutions in modules from other crates are not populated until accessed.
lazy_resolutions: Resolutions<'ra>,
/// True if this is a module from other crate that needs to be populated on access.
populate_on_access: Once,
/// Used to disambiguate underscore items (`const _: T = ...`) in the module.
underscore_disambiguator: CmCell<u32>,

Expand Down Expand Up @@ -710,6 +723,7 @@ impl<'ra> ModuleData<'ra> {
vis: Visibility<ModId>,
arenas: &'ra ResolverArenas<'ra>,
) -> Self {
let lazy_resolutions = Resolutions::new(kind.is_local());
let self_decl = match kind {
ModuleKind::Def(def_kind, def_id, ..) => {
let expn_id = expansion.as_local().unwrap_or(LocalExpnId::ROOT);
Expand All @@ -720,8 +734,7 @@ impl<'ra> ModuleData<'ra> {
ModuleData {
parent,
kind,
lazy_resolutions: Default::default(),
populate_on_access: Once::new(),
lazy_resolutions,
underscore_disambiguator: CmCell::new(0),
unexpanded_invocations: Default::default(),
no_implicit_prelude,
Expand Down Expand Up @@ -2162,15 +2175,16 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
self.tcx.hir_arena.alloc_slice(&import_ids)
}

fn resolutions(&self, module: Module<'ra>) -> &'ra Resolutions<'ra> {
if !module.is_local() {
// as long as 1 thread is building this external table, all other threads will wait
module.populate_on_access.call_once(|| {
*module.lazy_resolutions.borrow_mut_unchecked() =
self.build_reduced_graph_external(module.expect_extern());
});
fn resolutions(&self, module: Module<'ra>) -> &'ra CmRefCell<ResolutionTable<'ra>> {
match &module.0.0.lazy_resolutions {
Resolutions::Local(local_res) => local_res,
Resolutions::Extern(extern_res) => {
// as long as 1 thread is building this external table, all other threads will wait
extern_res.get_or_init(|| {
CmRefCell::new(self.build_reduced_graph_external(module.expect_extern()))
})
}
}
&module.0.0.lazy_resolutions
}

fn resolution(
Expand Down Expand Up @@ -2924,13 +2938,6 @@ mod ref_mut {
CmRefCell(RefCell::new(value))
}

#[track_caller]
// FIXME: this should be eliminated in the process of migration
// to parallel name resolution.
pub(crate) fn borrow_mut_unchecked(&self) -> RefMut<'_, T> {
self.0.borrow_mut()
}

#[track_caller]
pub(crate) fn borrow_mut<'ra, 'tcx>(&self, r: &Resolver<'ra, 'tcx>) -> RefMut<'_, T> {
if r.assert_speculative {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,27 +285,21 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|| self.tcx.is_diagnostic_item(sym::TryFrom, trait_def_id))
&& (self.tcx.is_diagnostic_item(sym::From, leaf_trait_def_id)
|| self.tcx.is_diagnostic_item(sym::TryFrom, leaf_trait_def_id))
{
let trait_ref = leaf_trait_predicate.skip_binder().trait_ref;

if let Some(found_ty) =
&& let Some(trait_ref) =
leaf_trait_predicate.no_bound_vars().map(|pred| pred.trait_ref)
&& let Some(found_ty) =
trait_ref.args.get(1).and_then(|arg| arg.as_type())
{
let ty = main_trait_predicate.skip_binder().self_ty();
&& let Some(ty) =
main_trait_predicate.no_bound_vars().map(|pred| pred.self_ty())
&& let Some(cast_ty) =
self.find_explicit_cast_type(obligation.param_env, found_ty, ty)
{
let found_ty_str = self.tcx.short_string(found_ty, &mut long_ty_file);
let cast_ty_str = self.tcx.short_string(cast_ty, &mut long_ty_file);

if let Some(cast_ty) =
self.find_explicit_cast_type(obligation.param_env, found_ty, ty)
{
let found_ty_str =
self.tcx.short_string(found_ty, &mut long_ty_file);
let cast_ty_str =
self.tcx.short_string(cast_ty, &mut long_ty_file);

err.help(format!(
"consider casting the `{found_ty_str}` value to `{cast_ty_str}`",
));
}
}
err.help(format!(
"consider casting the `{found_ty_str}` value to `{cast_ty_str}`",
));
}

*err.long_ty_path() = long_ty_file;
Expand Down
Loading
Loading