Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
307310c
Add tests/ui/impl-trait/unpin-for-future.rs
Darksonn May 28, 2026
e789c33
Add missing tests and adress concerns
P8L1 Jun 8, 2026
5004367
Make Share::share final and improve docs
P8L1 Jun 8, 2026
16e2fd2
Remove redundant normalize-stderr directives
P8L1 Jun 9, 2026
6a93bcc
ci: rename `job-macos` anchor to `job-macos-15`
jieyouxu Jun 10, 2026
3619e22
ci: add new anchor for `macos-26` runners
jieyouxu Jun 10, 2026
b509dcc
ci: create experiment test job `aarch64-apple-macos-26`
jieyouxu Jun 10, 2026
334c9df
fuchsia: Support AddressSanitizer on riscv64gc-unknown-fuchsia
PiJoules Jun 11, 2026
cc89e06
Disable retagging for variadic arguments.
icmccorm Jun 8, 2026
390c6a4
use empty assumptions not no assumptions in solver relating
BoxyUwU Jun 9, 2026
f8aff87
revert let pattern check
Kivooeo Jun 12, 2026
25e83a0
Update library/core/src/clone.rs
P8L1 Jun 12, 2026
c9ecb9f
interpret: avoid computing layout of sized raw pointee
RalfJung Jun 11, 2026
602df86
Bless reborrow UI tests
P8L1 Jun 12, 2026
23e03d9
Extend capabilities of `TypeFoldable_Generic`
Jamesbarford Jun 10, 2026
42d7bf1
add #[rustc_no_writable] to slice::get_unchecked_mut
quiode Jun 12, 2026
c15d9ab
Prevent approving PRs that wait for Crater or formal decisions
Kobzol Jun 12, 2026
ccca660
Rename `rustc_hir_analysis/src/errors.rs` into `rustc_hir_analysis/sr…
GuillaumeGomez Jun 11, 2026
14bce1a
Rename `rustc_hir_typeck/src/errors.rs` into `rustc_hir_typeck/src/di…
GuillaumeGomez Jun 11, 2026
9dcf73a
Rename `rustc_hir_monomorphize/src/errors.rs` into `rustc_hir_monomor…
GuillaumeGomez Jun 12, 2026
d0b019e
Rename `rustc_incremental/src/errors.rs` into `rustc_incremental/src/…
GuillaumeGomez Jun 12, 2026
71c6ea1
Rollup merge of #157490 - P8L1:split/coerceshared-field-reborrow-test…
JonathanBrouwer Jun 12, 2026
97236be
Rollup merge of #157655 - P8L1:share-trait-final-docs, r=nikomatsakis
JonathanBrouwer Jun 12, 2026
cf52af5
Rollup merge of #157688 - jieyouxu:jieyouxu/ci/try-macos-26, r=Kobzol
JonathanBrouwer Jun 12, 2026
21b8c24
Rollup merge of #157069 - Darksonn:unpin-for-fut-tait, r=lcnr,RalfJung
JonathanBrouwer Jun 12, 2026
443037b
Rollup merge of #157202 - quiode:add-rustc_no_writable-more-fns, r=Ra…
JonathanBrouwer Jun 12, 2026
2048c54
Rollup merge of #157622 - BorrowSanitizer:ignore-retags-variadics, r=…
JonathanBrouwer Jun 12, 2026
9f43cde
Rollup merge of #157684 - BoxyUwU:empty_assumptions_in_solver_relatin…
JonathanBrouwer Jun 12, 2026
4511409
Rollup merge of #157695 - Jamesbarford:feat/extend-type-foldable-gene…
JonathanBrouwer Jun 12, 2026
3ef2267
Rollup merge of #157752 - GuillaumeGomez:rename-err-to-diag-3, r=Jona…
JonathanBrouwer Jun 12, 2026
4789ffd
Rollup merge of #157766 - RalfJung:too-big, r=oli-obk
JonathanBrouwer Jun 12, 2026
0a1b1e6
Rollup merge of #157785 - PiJoules:fuchsia-riscv64-asan-support, r=nn…
JonathanBrouwer Jun 12, 2026
62accaf
Rollup merge of #157795 - Kivooeo:revert-2, r=lcnr
JonathanBrouwer Jun 12, 2026
7cd6129
Rollup merge of #157798 - Kobzol:crater-block-bors, r=jieyouxu
JonathanBrouwer Jun 12, 2026
0a85379
Rollup merge of #157803 - GuillaumeGomez:rename-err-to-diag, r=Jonath…
JonathanBrouwer Jun 12, 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
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4892,6 +4892,7 @@ dependencies = [
name = "rustc_type_ir_macros"
version = "0.0.0"
dependencies = [
"indexmap",
"proc-macro2",
"quote",
"syn",
Expand Down
8 changes: 6 additions & 2 deletions compiler/rustc_const_eval/src/interpret/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,12 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
let mplace = ecx.force_allocation(&place)?;

// Consume the remaining arguments by putting them into the variable argument
// list.
let varargs = ecx.allocate_varargs(&mut caller_args, &mut callee_args_abis)?;
// list. We disable retagging to avoid creating protected tags. Protection should
// only use callee-side information, and the varargs have no static callee-side type.
let varargs = M::with_retag_mode(ecx, RetagMode::None, |ecx| {
ecx.allocate_varargs(&mut caller_args, &mut callee_args_abis)
})?;

// When the frame is dropped, these variable arguments are deallocated.
ecx.frame_mut().va_list = varargs.clone();
let key = ecx.va_list_ptr(varargs.into());
Expand Down
10 changes: 7 additions & 3 deletions compiler/rustc_const_eval/src/interpret/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -925,16 +925,20 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
}
interp_ok(true)
}
ty::RawPtr(..) => {
ty::RawPtr(pointee, ..) => {
let ptr = self.read_immediate(value, ExpectedKind::RawPtr)?;
if self.reset_provenance_and_padding {
self.reset_pointer_provenance(value, &ptr)?;
// There's no padding in a pointer.
self.add_data_range_place(value);
}

let place = self.ecx.imm_ptr_to_mplace(&ptr)?;
if place.layout.is_unsized() {
if !pointee.is_sized(*self.ecx.tcx, self.ecx.typing_env) {
// Raw pointers to unsized types need to have their metadata checked.
// We avoid creating this place for sized types to match codegen: those types
// might actually be invalid (i.e., too big)!
let place = self.ecx.imm_ptr_to_mplace(&ptr)?;
assert!(place.layout.is_unsized());
self.check_wide_ptr_meta(place.meta(), place.layout)?;
}
interp_ok(true)
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/autoderef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc_span::{ErrorGuaranteed, Span};
use rustc_trait_selection::traits::ObligationCtxt;
use tracing::{debug, instrument};

use crate::errors::AutoDerefReachedRecursionLimit;
use crate::diagnostics::AutoDerefReachedRecursionLimit;
use crate::traits;
use crate::traits::query::evaluate_obligation::InferCtxtExt;

Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_hir_analysis/src/check/always_applicable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use rustc_span::sym;
use rustc_trait_selection::regions::InferCtxtRegionExt;
use rustc_trait_selection::traits::{self, ObligationCtxt};

use crate::errors;
use crate::diagnostics;
use crate::hir::def_id::{DefId, LocalDefId};

/// This function confirms that the `Drop` implementation identified by
Expand All @@ -42,12 +42,12 @@ pub(crate) fn check_drop_impl(
match tcx.impl_polarity(drop_impl_did) {
ty::ImplPolarity::Positive => {}
ty::ImplPolarity::Negative => {
return Err(tcx.dcx().emit_err(errors::DropImplPolarity::Negative {
return Err(tcx.dcx().emit_err(diagnostics::DropImplPolarity::Negative {
span: tcx.def_span(drop_impl_did),
}));
}
ty::ImplPolarity::Reservation => {
return Err(tcx.dcx().emit_err(errors::DropImplPolarity::Reservation {
return Err(tcx.dcx().emit_err(diagnostics::DropImplPolarity::Reservation {
span: tcx.def_span(drop_impl_did),
}));
}
Expand Down Expand Up @@ -393,7 +393,7 @@ fn check_drop_xor_pin_drop<'tcx>(
match (drop_span, pin_drop_span) {
(None, None) => {
if tcx.features().pin_ergonomics() {
return Err(tcx.dcx().emit_err(crate::errors::MissingOneOfTraitItem {
return Err(tcx.dcx().emit_err(crate::diagnostics::MissingOneOfTraitItem {
span: tcx.def_span(drop_impl_did),
note: None,
missing_items_msg: "drop`, `pin_drop".to_string(),
Expand All @@ -408,7 +408,7 @@ fn check_drop_xor_pin_drop<'tcx>(
if tcx.adt_def(adt_def_id).is_pin_project() {
let pin_v2_span = rustc_hir::find_attr!(tcx, adt_def_id, PinV2(attr) => *attr);
let adt_name = tcx.item_name(adt_def_id);
return Err(tcx.dcx().emit_err(crate::errors::PinV2WithoutPinDrop {
return Err(tcx.dcx().emit_err(crate::diagnostics::PinV2WithoutPinDrop {
span,
pin_v2_span,
adt_name,
Expand All @@ -424,7 +424,7 @@ fn check_drop_xor_pin_drop<'tcx>(
}
}
(Some(drop_span), Some(pin_drop_span)) => {
return Err(tcx.dcx().emit_err(crate::errors::ConflictImplDropAndPinDrop {
return Err(tcx.dcx().emit_err(crate::diagnostics::ConflictImplDropAndPinDrop {
span: tcx.def_span(drop_impl_did),
drop_span,
pin_drop_span,
Expand Down
41 changes: 21 additions & 20 deletions compiler/rustc_hir_analysis/src/check/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ use crate::check::wfcheck::{
check_associated_item, check_trait_item, check_type_defn, check_variances_for_type_defn,
check_where_clauses, enter_wf_checking_ctxt,
};
use crate::diagnostics;

fn add_abi_diag_help<T: EmissionGuarantee>(abi: ExternAbi, diag: &mut Diag<'_, T>) {
if let ExternAbi::Cdecl { unwind } = abi {
Expand Down Expand Up @@ -95,7 +96,7 @@ pub fn check_custom_abi(tcx: TyCtxt<'_>, def_id: LocalDefId, fn_sig: FnSig<'_>,
if fn_sig.abi() == ExternAbi::Custom {
// Function definitions that use `extern "custom"` must be naked functions.
if !find_attr!(tcx, def_id, Naked(_)) {
tcx.dcx().emit_err(crate::errors::AbiCustomClothedFunction {
tcx.dcx().emit_err(crate::diagnostics::AbiCustomClothedFunction {
span: fn_sig_span,
naked_span: tcx.def_span(def_id).shrink_to_lo(),
});
Expand Down Expand Up @@ -181,9 +182,9 @@ fn check_union_fields(tcx: TyCtxt<'_>, span: Span, item_def_id: LocalDefId) -> b
Some(Node::Field(field)) => (field.span, field.ty.span),
_ => unreachable!("mir field has to correspond to hir field"),
};
tcx.dcx().emit_err(errors::InvalidUnionField {
tcx.dcx().emit_err(diagnostics::InvalidUnionField {
field_span,
sugg: errors::InvalidUnionFieldSuggestion {
sugg: diagnostics::InvalidUnionFieldSuggestion {
lo: ty_span.shrink_to_lo(),
hi: ty_span.shrink_to_hi(),
},
Expand Down Expand Up @@ -217,7 +218,7 @@ fn check_static_inhabited(tcx: TyCtxt<'_>, def_id: LocalDefId) {
if matches!(tcx.def_kind(def_id), DefKind::Static{ .. }
if tcx.def_kind(tcx.local_parent(def_id)) == DefKind::ForeignMod) =>
{
tcx.dcx().emit_err(errors::TooLargeStatic { span });
tcx.dcx().emit_err(diagnostics::TooLargeStatic { span });
return;
}
// SIMD types with invalid layout (e.g., zero-length) should emit an error
Expand Down Expand Up @@ -599,7 +600,7 @@ fn check_opaque_precise_captures<'tcx>(tcx: TyCtxt<'tcx>, opaque_def_id: LocalDe
}
hir::PreciseCapturingArg::Lifetime(&hir::Lifetime { hir_id, ident, .. }) => {
if let Some(prev_non_lifetime_param) = prev_non_lifetime_param {
tcx.dcx().emit_err(errors::LifetimesMustBeFirst {
tcx.dcx().emit_err(diagnostics::LifetimesMustBeFirst {
lifetime_span: ident.span,
name: ident.name,
other_span: prev_non_lifetime_param.span,
Expand All @@ -611,7 +612,7 @@ fn check_opaque_precise_captures<'tcx>(tcx: TyCtxt<'tcx>, opaque_def_id: LocalDe

let ident = ident.normalize_to_macros_2_0();
if let Some(span) = seen_params.insert(ident, ident.span) {
tcx.dcx().emit_err(errors::DuplicatePreciseCapture {
tcx.dcx().emit_err(diagnostics::DuplicatePreciseCapture {
name: ident.name,
first_span: span,
second_span: ident.span,
Expand Down Expand Up @@ -675,14 +676,14 @@ fn check_opaque_precise_captures<'tcx>(tcx: TyCtxt<'tcx>, opaque_def_id: LocalDe
.map_opaque_lifetime_to_parent_lifetime(param.def_id.expect_local())
.opt_param_def_id(tcx, tcx.parent(opaque_def_id.to_def_id()))
{
tcx.dcx().emit_err(errors::LifetimeNotCaptured {
tcx.dcx().emit_err(diagnostics::LifetimeNotCaptured {
opaque_span,
use_span,
param_span: tcx.def_span(def_id),
});
} else {
if tcx.def_kind(tcx.parent(param.def_id)) == DefKind::Trait {
tcx.dcx().emit_err(errors::LifetimeImplicitlyCaptured {
tcx.dcx().emit_err(diagnostics::LifetimeImplicitlyCaptured {
opaque_span,
param_span: tcx.def_span(param.def_id),
});
Expand All @@ -691,7 +692,7 @@ fn check_opaque_precise_captures<'tcx>(tcx: TyCtxt<'tcx>, opaque_def_id: LocalDe
// have not duplicated the lifetime but captured the original.
// The "effective" `use_span` will be the span of the opaque itself,
// and the param span will be the def span of the param.
tcx.dcx().emit_err(errors::LifetimeNotCaptured {
tcx.dcx().emit_err(diagnostics::LifetimeNotCaptured {
opaque_span,
use_span: opaque_span,
param_span: use_span,
Expand All @@ -704,13 +705,13 @@ fn check_opaque_precise_captures<'tcx>(tcx: TyCtxt<'tcx>, opaque_def_id: LocalDe
ty::GenericParamDefKind::Type { .. } => {
if matches!(tcx.def_kind(param.def_id), DefKind::Trait | DefKind::TraitAlias) {
// FIXME(precise_capturing): Structured suggestion for this would be useful
tcx.dcx().emit_err(errors::SelfTyNotCaptured {
tcx.dcx().emit_err(diagnostics::SelfTyNotCaptured {
trait_span: tcx.def_span(param.def_id),
opaque_span: tcx.def_span(opaque_def_id),
});
} else {
// FIXME(precise_capturing): Structured suggestion for this would be useful
tcx.dcx().emit_err(errors::ParamNotCaptured {
tcx.dcx().emit_err(diagnostics::ParamNotCaptured {
param_span: tcx.def_span(param.def_id),
opaque_span: tcx.def_span(opaque_def_id),
kind: "type",
Expand All @@ -719,7 +720,7 @@ fn check_opaque_precise_captures<'tcx>(tcx: TyCtxt<'tcx>, opaque_def_id: LocalDe
}
ty::GenericParamDefKind::Const { .. } => {
// FIXME(precise_capturing): Structured suggestion for this would be useful
tcx.dcx().emit_err(errors::ParamNotCaptured {
tcx.dcx().emit_err(diagnostics::ParamNotCaptured {
param_span: tcx.def_span(param.def_id),
opaque_span: tcx.def_span(opaque_def_id),
kind: "const",
Expand Down Expand Up @@ -755,7 +756,7 @@ fn check_static_linkage(tcx: TyCtxt<'_>, def_id: LocalDefId) {
ty::Adt(adt_def, args) => !is_enum_of_nonnullable_ptr(tcx, *adt_def, *args),
_ => true,
} {
tcx.dcx().emit_err(errors::LinkageType { span: tcx.def_span(def_id) });
tcx.dcx().emit_err(diagnostics::LinkageType { span: tcx.def_span(def_id) });
}
}
}
Expand Down Expand Up @@ -1238,8 +1239,8 @@ pub(super) fn check_specialization_validity<'tcx>(
let ident = tcx.item_ident(impl_item);

let err = match tcx.span_of_impl(parent_impl) {
Ok(sp) => errors::ImplNotMarkedDefault::Ok { span, ident, ok_label: sp },
Err(cname) => errors::ImplNotMarkedDefault::Err { span, ident, cname },
Ok(sp) => diagnostics::ImplNotMarkedDefault::Ok { span, ident, ok_label: sp },
Err(cname) => diagnostics::ImplNotMarkedDefault::Err { span, ident, cname },
};

tcx.dcx().emit_err(err);
Expand All @@ -1255,7 +1256,7 @@ fn check_overriding_final_trait_item<'tcx>(
impl_item: ty::AssocItem,
) {
if trait_item.defaultness(tcx).is_final() {
tcx.dcx().emit_err(errors::OverridingFinalTraitFunction {
tcx.dcx().emit_err(diagnostics::OverridingFinalTraitFunction {
impl_span: tcx.def_span(impl_item.def_id),
trait_span: tcx.def_span(trait_item.def_id),
ident: tcx.item_ident(impl_item.def_id),
Expand Down Expand Up @@ -1330,7 +1331,7 @@ fn check_impl_items_against_trait<'tcx>(
rustc_lint_defs::builtin::DEAD_CODE,
tcx.local_def_id_to_hir_id(ty_impl_item.def_id.expect_local()),
tcx.def_span(ty_impl_item.def_id),
errors::UselessImplItem,
diagnostics::UselessImplItem,
)
}

Expand Down Expand Up @@ -1638,7 +1639,7 @@ pub(super) fn check_packed(tcx: TyCtxt<'_>, sp: Span, def: ty::AdtDef<'_>) {
// over-aligned field to an aligned location before running its destructor, which would
// move a structurally pinned field out from under a `Pin<&mut _>` that was handed out.
if def.is_pin_project() {
tcx.dcx().emit_err(errors::PinV2OnPacked {
tcx.dcx().emit_err(diagnostics::PinV2OnPacked {
span: sp,
pin_v2_span: find_attr!(tcx, def.did(), PinV2(span) => *span),
adt_name: tcx.item_name(def.did()),
Expand Down Expand Up @@ -2119,11 +2120,11 @@ fn check_type_alias_type_params_are_used<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalD
|| (*bounded_params).get(&param.index).is_some_and(|&&pred_sp| pred_sp != span);
let const_param_help = !has_explicit_bounds;

let mut diag = tcx.dcx().create_err(errors::UnusedGenericParameter {
let mut diag = tcx.dcx().create_err(diagnostics::UnusedGenericParameter {
span,
param_name,
param_def_kind: tcx.def_descr(param.def_id),
help: errors::UnusedGenericParameterHelp::TyAlias { param_name },
help: diagnostics::UnusedGenericParameterHelp::TyAlias { param_name },
usage_spans: vec![],
const_param_help,
});
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/compare_eii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use super::potentially_plural_count;
use crate::check::compare_impl_item::{
CheckNumberOfEarlyBoundRegionsError, check_number_of_early_bound_regions,
};
use crate::errors::{
use crate::diagnostics::{
EiiDefkindMismatch, EiiDefkindMismatchStaticMutability, EiiDefkindMismatchStaticSafety,
EiiWithGenerics, LifetimesOrBoundsMismatchOnEii,
};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use rustc_trait_selection::traits::{
use tracing::{debug, instrument};

use super::potentially_plural_count;
use crate::errors::{LifetimesOrBoundsMismatchOnTrait, MethodShouldReturnFuture};
use crate::diagnostics::{LifetimesOrBoundsMismatchOnTrait, MethodShouldReturnFuture};

pub(super) mod refine;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ fn report_mismatched_rpitit_signature<'tcx>(
if is_internal { REFINING_IMPL_TRAIT_INTERNAL } else { REFINING_IMPL_TRAIT_REACHABLE },
tcx.local_def_id_to_hir_id(impl_m_def_id.expect_local()),
span,
crate::errors::ReturnPositionImplTraitInTraitRefined {
crate::diagnostics::ReturnPositionImplTraitInTraitRefined {
impl_return_span,
trait_return_span,
pre,
Expand Down Expand Up @@ -464,7 +464,7 @@ fn report_mismatched_rpitit_captures<'tcx>(
if is_internal { REFINING_IMPL_TRAIT_INTERNAL } else { REFINING_IMPL_TRAIT_REACHABLE },
tcx.local_def_id_to_hir_id(impl_opaque_def_id),
use_bound_span,
crate::errors::ReturnPositionImplTraitInTraitRefinedLifetimes {
crate::diagnostics::ReturnPositionImplTraitInTraitRefinedLifetimes {
suggestion_span: use_bound_span,
suggestion,
},
Expand Down
19 changes: 10 additions & 9 deletions compiler/rustc_hir_analysis/src/check/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use rustc_trait_selection::regions::InferCtxtRegionExt;
use rustc_trait_selection::traits::{self, ObligationCause, ObligationCauseCode};

use super::check_function_signature;
use crate::errors;
use crate::diagnostics;

pub(crate) fn check_for_entry_fn(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
match tcx.entry_fn(()) {
Expand Down Expand Up @@ -92,23 +92,24 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) -> Result<(), ErrorGuar
let main_asyncness = tcx.asyncness(main_def_id);
if main_asyncness.is_async() {
let asyncness_span = main_fn_asyncness_span(tcx, main_def_id);
return Err(tcx
.dcx()
.emit_err(errors::MainFunctionAsync { span: main_span, asyncness: asyncness_span }));
return Err(tcx.dcx().emit_err(diagnostics::MainFunctionAsync {
span: main_span,
asyncness: asyncness_span,
}));
}

if let Some(attr_span) = find_attr!(tcx, main_def_id, TrackCaller(span) => *span) {
return Err(tcx
.dcx()
.emit_err(errors::TrackCallerOnMain { span: attr_span, annotated: main_span }));
.emit_err(diagnostics::TrackCallerOnMain { span: attr_span, annotated: main_span }));
}

if !tcx.codegen_fn_attrs(main_def_id).target_features.is_empty()
// Calling functions with `#[target_feature]` is not unsafe on WASM, see #84988
&& !tcx.sess.target.is_like_wasm
&& !tcx.sess.opts.actually_rustdoc
{
return Err(tcx.dcx().emit_err(errors::TargetFeatureOnMain { main: main_span }));
return Err(tcx.dcx().emit_err(diagnostics::TargetFeatureOnMain { main: main_span }));
}

// Main should have no WC, so empty param env is OK here.
Expand All @@ -120,7 +121,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) -> Result<(), ErrorGuar
let Some(return_ty) = return_ty.no_bound_vars() else {
return Err(tcx
.dcx()
.emit_err(errors::MainFunctionReturnTypeGeneric { span: return_ty_span }));
.emit_err(diagnostics::MainFunctionReturnTypeGeneric { span: return_ty_span }));
};
let infcx = tcx.infer_ctxt().build(TypingMode::non_body_analysis());
let cause = traits::ObligationCause::new(
Expand Down Expand Up @@ -168,14 +169,14 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) -> Result<(), ErrorGuar
let main_fn_predicates = tcx.predicates_of(main_def_id);
if main_fn_generics.count() != 0 || !main_fnsig.bound_vars().is_empty() {
let generics_param_span = main_fn_generics_params_span(tcx, main_def_id);
return Err(tcx.dcx().emit_err(errors::MainFunctionGenericParameters {
return Err(tcx.dcx().emit_err(diagnostics::MainFunctionGenericParameters {
span: generics_param_span.unwrap_or(main_span),
label_span: generics_param_span,
}));
} else if !main_fn_predicates.predicates.is_empty() {
// generics may bring in implicit predicates, so we skip this check if generics is present.
let generics_where_clauses_span = main_fn_where_clauses_span(tcx, main_def_id);
return Err(tcx.dcx().emit_err(errors::WhereClauseOnMain {
return Err(tcx.dcx().emit_err(diagnostics::WhereClauseOnMain {
span: generics_where_clauses_span.unwrap_or(main_span),
generics_span: generics_where_clauses_span,
}));
Expand Down
Loading
Loading