Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
73e35ee
Fix incorrect trailing comma suggested in no_accessible_fields
chenyukang Jan 18, 2026
0f786b9
ValTreeKind::Branch use List
spirali Feb 13, 2026
c5a6131
fix: use `ExprIsRead::Yes` for binary operator operands
Albab-Hasan Feb 16, 2026
85de83b
fix: use check_infer_with_mismatches in binop_lhs_never_place_diverge…
Albab-Hasan Feb 16, 2026
05cd01b
fix: verify NeverToAny adjustment in binop_lhs_never_place_diverges test
Albab-Hasan Feb 16, 2026
46ddd48
Changes after code review
spirali Feb 15, 2026
c1b0b32
fix: verify NeverToAny adjustment on binop lhs never place
Albab-Hasan Feb 18, 2026
f4dcfa2
fix: offer block `.let` in ref-expr in match arm
A4-Tacks Feb 17, 2026
5ea0716
feat: offer destructure_struct_binding on self param
A4-Tacks Feb 20, 2026
14b3a40
Test updated
spirali Feb 23, 2026
05ab6d1
internal: Configure codecov
Wilfred Feb 17, 2026
cde693c
fix: Improve newline for make `match`, `if`, `while` etc
A4-Tacks Feb 27, 2026
f19a73c
build(deps-dev): bump minimatch from 3.1.2 to 3.1.5 in /editors/code
dependabot[bot] Feb 28, 2026
aa53530
fix: Fix wrong confiditon in `Visibility::min`
Veykril Feb 28, 2026
89573c1
Merge pull request #21725 from Veykril/push-skvpqzkooolm
Veykril Feb 28, 2026
a4c683f
fix: use compound assignment in binop_lhs_never_place_diverges test
Albab-Hasan Feb 28, 2026
ad7acd5
Merge pull request #21654 from Albab-Hasan/fix/binop-rhs-never-coercion
ChayimFriedman2 Feb 28, 2026
c9763e7
triagebot: roll rustfmt reviewers for in-tree rustfmt
jieyouxu Feb 28, 2026
747aa5b
Fix: use `FnAbi::Rust` for tuple struct/enum constructors and align `…
Albab-Hasan Mar 1, 2026
a9e35bc
Merge pull request #21722 from rust-lang/dependabot/npm_and_yarn/edit…
lnicola Mar 1, 2026
21674fe
fix: Fix wrong descend range for add_missing_match_arms
A4-Tacks Mar 1, 2026
7a81a8e
Prepare for merging from rust-lang/rust
invalid-email-address Mar 2, 2026
cbbd454
Merge ref 'e7d90c695a39' from rust-lang/rust
invalid-email-address Mar 2, 2026
1d89279
Format code
invalid-email-address Mar 2, 2026
debbabe
Merge pull request #21731 from rust-lang/rustc-pull
lnicola Mar 2, 2026
7bd3c42
internal: Define rules for LLMs
Wilfred Mar 2, 2026
02e1aea
Merge pull request #21728 from A4-Tacks/add-match-arms-descend-range
ChayimFriedman2 Mar 4, 2026
a64732c
Merge pull request #21726 from Albab-Hasan/fix/next-solver-is-rust
ChayimFriedman2 Mar 4, 2026
91c193d
Merge pull request #21719 from A4-Tacks/make-block-newline
ChayimFriedman2 Mar 4, 2026
4dc4e42
Merge pull request #21687 from A4-Tacks/destruct-self-param
ChayimFriedman2 Mar 4, 2026
2c69534
Release a new smol-str minor version with borsh fix
ChayimFriedman2 Mar 4, 2026
8454a15
Merge pull request #21743 from ChayimFriedman2/bump-smol-str
ChayimFriedman2 Mar 4, 2026
6b13e5e
Fix a bug in associated type lowering
ChayimFriedman2 Mar 4, 2026
560ec97
Merge pull request #21671 from A4-Tacks/postfix-tree-climbing
ChayimFriedman2 Mar 4, 2026
0f1a1ad
Only complain about uncanonicalized issue links
lnicola Mar 4, 2026
2129e09
Merge pull request #21746 from lnicola/triagebot-issue-links
lnicola Mar 4, 2026
312a764
Merge pull request #21745 from ChayimFriedman2/assoc-type-fixup
Veykril Mar 4, 2026
83bedb3
Allow never coercions in struct update syntax
ChayimFriedman2 Mar 4, 2026
b1eedb6
Merge pull request #21747 from ChayimFriedman2/never-upd-syn
ShoyuVanilla Mar 4, 2026
bd8c9f3
Do not use PostAnalysis TypingMode for IDE method resolution
ChayimFriedman2 Mar 4, 2026
8bfd981
When going to def on `?` on `Result` that goes through `From`, go to …
ChayimFriedman2 Mar 4, 2026
61fbc07
Merge pull request #21750 from ChayimFriedman2/method-res-typingmode
ShoyuVanilla Mar 5, 2026
e502782
Prepare for merging from rust-lang/rust
invalid-email-address Mar 5, 2026
3ef39ff
Merge ref 'f8704be04fe1' from rust-lang/rust
invalid-email-address Mar 5, 2026
43b6fa2
Merge pull request #21753 from rust-lang/rustc-pull
lnicola Mar 5, 2026
4343bc7
Add `has_pending` methods to `Incoming` and `Outgoing` in `lsp_server`
oeb25 Mar 5, 2026
d63bb88
Merge pull request #21752 from ChayimFriedman2/question-mark-conversion
Veykril Mar 5, 2026
a5c4f69
Merge pull request #21755 from oeb25/lsp-server-has-pending
Veykril Mar 5, 2026
1bd871f
Merge pull request #21732 from Wilfred/add_claude_rules
Veykril Mar 5, 2026
92845ed
Merge pull request #21660 from Wilfred/configure_codecov
Veykril Mar 5, 2026
07a3da1
Consider try blocks as block-like for overflowed expr
ia0 Mar 5, 2026
2093158
refactor: move `check_align` to `parse_alignment`
JayanAXHF Mar 5, 2026
f8998e9
as_slice removed
spirali Mar 5, 2026
06f959c
fix clippy on master
Shourya742 Mar 6, 2026
f2abae6
Merge pull request #21760 from Shourya742/2026-03-06-fix-clippy
ShoyuVanilla Mar 6, 2026
006929f
Tweak pre-release check for beta
lnicola Mar 6, 2026
80af448
Merge pull request #21763 from lnicola/lockfile-beta
lnicola Mar 6, 2026
a62c671
bootstrap.py: fix typo "parallle"
DanielEScherzer Mar 6, 2026
6a950e7
add wasm64 to sync::Once and thread_parking atomics cfg guard
Trivo25 Feb 27, 2026
cb66c85
Preserve parentheses around Fn trait bounds in pretty printer
aytey Mar 6, 2026
7fd6caf
Rollup merge of #153466 - lnicola:sync-from-ra, r=lnicola
JonathanBrouwer Mar 6, 2026
31dce92
Rollup merge of #151280 - chenyukang:yukang-fix-149787, r=estebank
JonathanBrouwer Mar 6, 2026
06e9bb8
Rollup merge of #152593 - spirali:valtreekind-list, r=lcnr
JonathanBrouwer Mar 6, 2026
be75acf
Rollup merge of #153174 - Trivo25:fix-wasm64-sync-cfg, r=joboet
JonathanBrouwer Mar 6, 2026
7f9e761
Rollup merge of #153189 - JayanAXHF:refactor/check_attrs_reftor_1, r=…
JonathanBrouwer Mar 6, 2026
ece28f3
Rollup merge of #153230 - jieyouxu:rustfmt-reviewers-for-rustfmt, r=y…
JonathanBrouwer Mar 6, 2026
19bf824
Rollup merge of #153445 - ia0:overflow_try, r=ytmimi
JonathanBrouwer Mar 6, 2026
1e51dd8
Rollup merge of #153476 - DanielEScherzer:patch-2, r=bjorn3
JonathanBrouwer Mar 6, 2026
1dcf802
Rollup merge of #153483 - aytey:dyn_paren_impl_fn_return, r=fmease
JonathanBrouwer Mar 6, 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
8 changes: 7 additions & 1 deletion compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,9 @@ impl<'a> State<'a> {
}

fn print_poly_trait_ref(&mut self, t: &ast::PolyTraitRef) {
if let ast::Parens::Yes = t.parens {
self.popen();
}
self.print_formal_generic_params(&t.bound_generic_params);

let ast::TraitBoundModifiers { constness, asyncness, polarity } = t.modifiers;
Expand All @@ -1437,7 +1440,10 @@ impl<'a> State<'a> {
}
}

self.print_trait_ref(&t.trait_ref)
self.print_trait_ref(&t.trait_ref);
if let ast::Parens::Yes = t.parens {
self.pclose();
}
}

fn print_stmt(&mut self, st: &ast::Stmt) {
Expand Down
50 changes: 31 additions & 19 deletions compiler/rustc_attr_parsing/src/attributes/repr.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rustc_abi::Align;
use rustc_abi::{Align, Size};
use rustc_ast::{IntTy, LitIntType, LitKind, UintTy};
use rustc_hir::attrs::{IntType, ReprAttr};

Expand Down Expand Up @@ -229,7 +229,7 @@ fn parse_repr_align<S: Stage>(
return None;
};

match parse_alignment(&lit.kind) {
match parse_alignment(&lit.kind, cx) {
Ok(literal) => Some(match align_kind {
AlignKind::Packed => ReprAttr::ReprPacked(literal),
AlignKind::Align => ReprAttr::ReprAlign(literal),
Expand All @@ -248,23 +248,35 @@ fn parse_repr_align<S: Stage>(
}
}

fn parse_alignment(node: &LitKind) -> Result<Align, &'static str> {
if let LitKind::Int(literal, LitIntType::Unsuffixed) = node {
// `Align::from_bytes` accepts 0 as an input, check is_power_of_two() first
if literal.get().is_power_of_two() {
// Only possible error is larger than 2^29
literal
.get()
.try_into()
.ok()
.and_then(|v| Align::from_bytes(v).ok())
.ok_or("larger than 2^29")
} else {
Err("not a power of two")
}
} else {
Err("not an unsuffixed integer")
fn parse_alignment<S: Stage>(
node: &LitKind,
cx: &AcceptContext<'_, '_, S>,
) -> Result<Align, String> {
let LitKind::Int(literal, LitIntType::Unsuffixed) = node else {
return Err("not an unsuffixed integer".to_string());
};

// `Align::from_bytes` accepts 0 as a valid input,
// so we check if its a power of two first
if !literal.get().is_power_of_two() {
return Err("not a power of two".to_string());
}
// lit must be < 2^29
let align = literal
.get()
.try_into()
.ok()
.and_then(|a| Align::from_bytes(a).ok())
.ok_or("larger than 2^29".to_string())?;

// alignment must not be larger than the pointer width (`isize::MAX`)
let max = Size::from_bits(cx.sess.target.pointer_width).signed_int_max() as u64;
if align.bytes() > max {
return Err(format!(
"alignment larger than `isize::MAX` bytes ({max} for the current target)"
));
}
Ok(align)
}

/// Parse #[align(N)].
Expand Down Expand Up @@ -294,7 +306,7 @@ impl RustcAlignParser {
return;
};

match parse_alignment(&lit.kind) {
match parse_alignment(&lit.kind, cx) {
Ok(literal) => self.0 = Ord::max(self.0, Some((literal, cx.attr_span))),
Err(message) => {
cx.emit_err(session_diagnostics::InvalidAlignmentValue {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_attr_parsing/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,12 @@ pub(crate) struct InvalidReprAlignNeedArg {

#[derive(Diagnostic)]
#[diag("invalid `repr({$repr_arg})` attribute: {$error_part}", code = E0589)]
pub(crate) struct InvalidReprGeneric<'a> {
pub(crate) struct InvalidReprGeneric {
#[primary_span]
pub span: Span,

pub repr_arg: String,
pub error_part: &'a str,
pub error_part: String,
}

#[derive(Diagnostic)]
Expand Down Expand Up @@ -479,7 +479,7 @@ pub(crate) struct InvalidTarget {
pub(crate) struct InvalidAlignmentValue {
#[primary_span]
pub span: Span,
pub error_part: &'static str,
pub error_part: String,
}

#[derive(Diagnostic)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/const_eval/valtrees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ fn valtree_into_mplace<'tcx>(
Some(variant_idx),
)
}
_ => (place.clone(), branches, None),
_ => (place.clone(), branches.as_slice(), None),
};
debug!(?place_adjusted, ?branches);

Expand Down
14 changes: 12 additions & 2 deletions compiler/rustc_hir_typeck/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2436,10 +2436,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
.struct_span_err(pat.span, "pattern requires `..` due to inaccessible fields");

if let Some(field) = fields.last() {
let tail_span = field.span.shrink_to_hi().to(pat.span.shrink_to_hi());
let comma_hi_offset =
self.tcx.sess.source_map().span_to_snippet(tail_span).ok().and_then(|snippet| {
let trimmed = snippet.trim_start();
trimmed.starts_with(',').then(|| (snippet.len() - trimmed.len() + 1) as u32)
});
err.span_suggestion_verbose(
field.span.shrink_to_hi(),
if let Some(comma_hi_offset) = comma_hi_offset {
tail_span.with_hi(tail_span.lo() + BytePos(comma_hi_offset)).shrink_to_hi()
} else {
field.span.shrink_to_hi()
},
"ignore the inaccessible and unused fields",
", ..",
if comma_hi_offset.is_some() { " .." } else { ", .." },
Applicability::MachineApplicable,
);
} else {
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_middle/src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ macro_rules! arena_types {
[] name_set: rustc_data_structures::unord::UnordSet<rustc_span::Symbol>,
[] autodiff_item: rustc_hir::attrs::AutoDiffItem,
[] ordered_name_set: rustc_data_structures::fx::FxIndexSet<rustc_span::Symbol>,
[] valtree: rustc_middle::ty::ValTreeKind<rustc_middle::ty::TyCtxt<'tcx>>,
[] stable_order_of_exportable_impls:
rustc_data_structures::fx::FxIndexMap<rustc_hir::def_id::DefId, usize>,

Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_middle/src/ty/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use std::marker::{DiscriminantKind, PointeeSized};
use rustc_abi::FieldIdx;
use rustc_data_structures::fx::FxHashMap;
use rustc_hir::def_id::LocalDefId;
use rustc_middle::ty::Const;
use rustc_serialize::{Decodable, Encodable};
use rustc_span::source_map::Spanned;
use rustc_span::{Span, SpanDecoder, SpanEncoder};
Expand Down Expand Up @@ -497,6 +498,7 @@ impl_decodable_via_ref! {
&'tcx ty::List<ty::BoundVariableKind<'tcx>>,
&'tcx ty::List<ty::Pattern<'tcx>>,
&'tcx ty::ListWithCachedTypeInfo<ty::Clause<'tcx>>,
&'tcx ty::List<Const<'tcx>>,
}

#[macro_export]
Expand Down
20 changes: 12 additions & 8 deletions compiler/rustc_middle/src/ty/consts/valtree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,14 @@ impl<'tcx> ty::ValTreeKind<TyCtxt<'tcx>> {
// recurses through
pub struct ValTree<'tcx>(pub(crate) Interned<'tcx, ty::ValTreeKind<TyCtxt<'tcx>>>);

impl<'tcx> rustc_type_ir::inherent::ValTree<TyCtxt<'tcx>> for ValTree<'tcx> {
fn kind(&self) -> &ty::ValTreeKind<TyCtxt<'tcx>> {
&self
}
}

impl<'tcx> ValTree<'tcx> {
/// Returns the zero-sized valtree: `Branch([])`.
pub fn zst(tcx: TyCtxt<'tcx>) -> Self {
tcx.consts.valtree_zst
}

pub fn is_zst(self) -> bool {
matches!(*self, ty::ValTreeKind::Branch(box []))
matches!(*self, ty::ValTreeKind::Branch(consts) if consts.is_empty())
}

pub fn from_raw_bytes(tcx: TyCtxt<'tcx>, bytes: &[u8]) -> Self {
Expand All @@ -58,7 +52,9 @@ impl<'tcx> ValTree<'tcx> {
tcx: TyCtxt<'tcx>,
branches: impl IntoIterator<Item = ty::Const<'tcx>>,
) -> Self {
tcx.intern_valtree(ty::ValTreeKind::Branch(branches.into_iter().collect()))
tcx.intern_valtree(ty::ValTreeKind::Branch(
tcx.mk_const_list_from_iter(branches.into_iter()),
))
}

pub fn from_scalar_int(tcx: TyCtxt<'tcx>, i: ScalarInt) -> Self {
Expand All @@ -81,6 +77,14 @@ impl fmt::Debug for ValTree<'_> {
}
}

impl<'tcx> rustc_type_ir::inherent::IntoKind for ty::ValTree<'tcx> {
type Kind = ty::ValTreeKind<TyCtxt<'tcx>>;

fn kind(self) -> Self::Kind {
*self.0
}
}

/// `Ok(Err(ty))` indicates the constant was fine, but the valtree couldn't be constructed
/// because the value contains something of type `ty` that is not valtree-compatible.
/// The caller can then show an appropriate error; the query does not have the
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ impl<'tcx> CommonConsts<'tcx> {
))
};

let valtree_zst = mk_valtree(ty::ValTreeKind::Branch(Box::default()));
let valtree_zst = mk_valtree(ty::ValTreeKind::Branch(List::empty()));
let valtree_true = mk_valtree(ty::ValTreeKind::Leaf(ty::ScalarInt::TRUE));
let valtree_false = mk_valtree(ty::ValTreeKind::Leaf(ty::ScalarInt::FALSE));

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_middle/src/ty/context/impl_interner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
type Safety = hir::Safety;
type Abi = ExternAbi;
type Const = ty::Const<'tcx>;
type Consts = &'tcx List<Self::Const>;

type ParamConst = ty::ParamConst;
type ValueConst = ty::Value<'tcx>;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1930,7 +1930,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
}
// Otherwise, print the array separated by commas (or if it's a tuple)
(ty::ValTreeKind::Branch(fields), ty::Array(..) | ty::Tuple(..)) => {
let fields_iter = fields.iter().copied();
let fields_iter = fields.iter();

match *cv.ty.kind() {
ty::Array(..) => {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_middle/src/ty/structural_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -797,4 +797,5 @@ list_fold! {
&'tcx ty::List<PlaceElem<'tcx>> : mk_place_elems,
&'tcx ty::List<ty::Pattern<'tcx>> : mk_patterns,
&'tcx ty::List<ty::ArgOutlivesPredicate<'tcx>> : mk_outlives,
&'tcx ty::List<ty::Const<'tcx>> : mk_const_list,
}
9 changes: 5 additions & 4 deletions compiler/rustc_mir_build/src/builder/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2941,12 +2941,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {

match pat.ctor() {
Constructor::Variant(variant_index) => {
let ValTreeKind::Branch(box [actual_variant_idx]) = *valtree else {
let ValTreeKind::Branch(branch) = *valtree else {
bug!("malformed valtree for an enum")
};

let ValTreeKind::Leaf(actual_variant_idx) = *actual_variant_idx.to_value().valtree
else {
if branch.len() != 1 {
bug!("malformed valtree for an enum")
};
let ValTreeKind::Leaf(actual_variant_idx) = **branch[0].to_value().valtree else {
bug!("malformed valtree for an enum")
};

Expand Down
69 changes: 23 additions & 46 deletions compiler/rustc_passes/src/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::cell::Cell;
use std::collections::hash_map::Entry;
use std::slice;

use rustc_abi::{Align, ExternAbi, Size};
use rustc_abi::ExternAbi;
use rustc_ast::{AttrStyle, MetaItemKind, ast};
use rustc_attr_parsing::{AttributeParser, Late};
use rustc_data_structures::fx::FxHashMap;
Expand Down Expand Up @@ -190,8 +190,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
&Attribute::Parsed(AttributeKind::RustcPubTransparent(attr_span)) => {
self.check_rustc_pub_transparent(attr_span, span, attrs)
}
Attribute::Parsed(AttributeKind::RustcAlign { align, span: attr_span }) => {
self.check_align(*align, *attr_span)
Attribute::Parsed(AttributeKind::RustcAlign {..}) => {

}
Attribute::Parsed(AttributeKind::Naked(..)) => {
self.check_naked(hir_id, target)
Expand Down Expand Up @@ -1335,31 +1335,27 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
}
}
}
ReprAttr::ReprAlign(align) => {
match target {
Target::Struct | Target::Union | Target::Enum => {}
Target::Fn | Target::Method(_) if self.tcx.features().fn_align() => {
self.dcx().emit_err(errors::ReprAlignShouldBeAlign {
span: *repr_span,
item: target.plural_name(),
});
}
Target::Static if self.tcx.features().static_align() => {
self.dcx().emit_err(errors::ReprAlignShouldBeAlignStatic {
span: *repr_span,
item: target.plural_name(),
});
}
_ => {
self.dcx().emit_err(errors::AttrApplication::StructEnumUnion {
hint_span: *repr_span,
span,
});
}
ReprAttr::ReprAlign(..) => match target {
Target::Struct | Target::Union | Target::Enum => {}
Target::Fn | Target::Method(_) if self.tcx.features().fn_align() => {
self.dcx().emit_err(errors::ReprAlignShouldBeAlign {
span: *repr_span,
item: target.plural_name(),
});
}

self.check_align(*align, *repr_span);
}
Target::Static if self.tcx.features().static_align() => {
self.dcx().emit_err(errors::ReprAlignShouldBeAlignStatic {
span: *repr_span,
item: target.plural_name(),
});
}
_ => {
self.dcx().emit_err(errors::AttrApplication::StructEnumUnion {
hint_span: *repr_span,
span,
});
}
},
ReprAttr::ReprPacked(_) => {
if target != Target::Struct && target != Target::Union {
self.dcx().emit_err(errors::AttrApplication::StructUnion {
Expand Down Expand Up @@ -1475,25 +1471,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
}
}

fn check_align(&self, align: Align, span: Span) {
if align.bytes() > 2_u64.pow(29) {
// for values greater than 2^29, a different error will be emitted, make sure that happens
self.dcx().span_delayed_bug(
span,
"alignment greater than 2^29 should be errored on elsewhere",
);
} else {
// only do this check when <= 2^29 to prevent duplicate errors:
// alignment greater than 2^29 not supported
// alignment is too large for the current target

let max = Size::from_bits(self.tcx.sess.target.pointer_width).signed_int_max() as u64;
if align.bytes() > max {
self.dcx().emit_err(errors::InvalidReprAlignForTarget { span, size: max });
}
}
}

/// Outputs an error for attributes that can only be applied to macros, such as
/// `#[allow_internal_unsafe]` and `#[allow_internal_unstable]`.
/// (Allows proc_macro functions)
Expand Down
9 changes: 0 additions & 9 deletions compiler/rustc_passes/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,6 @@ pub(crate) struct ReprConflicting {
pub hint_spans: Vec<Span>,
}

#[derive(Diagnostic)]
#[diag("alignment must not be greater than `isize::MAX` bytes", code = E0589)]
#[note("`isize::MAX` is {$size} for the current target")]
pub(crate) struct InvalidReprAlignForTarget {
#[primary_span]
pub span: Span,
pub size: u64,
}

#[derive(Diagnostic)]
#[diag("conflicting representation hints", code = E0566)]
pub(crate) struct ReprConflictingLint;
Expand Down
Loading
Loading