Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d3a782d
Partially stabilize LoongArch target features
heiher Mar 27, 2026
dface0a
Fix ICE: Scalar layout for non-primitive non-enum type unsafe binder
cijiugechu Apr 21, 2026
f9c9efb
Stop using `rustc_scalar_layout` attr in gvn test
oli-obk Apr 16, 2026
6988b2e
Stop using `rustc_scalar_layout` attr in jump threading test
oli-obk Apr 16, 2026
8b9a4f0
Stop using `rustc_scalar_layout` in enum test
oli-obk Apr 16, 2026
27a32ff
Remove mir-opt mention of rustc_scalar_layout attr
oli-obk Apr 16, 2026
190314b
Remove rustc_layout_scalar_valid_range attr from debuginfo
oli-obk Apr 17, 2026
e993ad9
Rip out rustc_layout_scalar_valid_range_* attribute support
oli-obk Feb 13, 2026
9515f52
Change `ItemKind::Trait` to have named fields.
mejrs Apr 24, 2026
36459d9
Make it possible to have access to `Session` and crates name in `attr…
GuillaumeGomez Apr 23, 2026
b80d0b8
Remove remaining `AttributeLintKind` variants
GuillaumeGomez Apr 25, 2026
e7b9d94
Remove unused diagnostic types
GuillaumeGomez Apr 25, 2026
33a1ed1
disallow non_exhaustive structs and enums with non_exhaustive variant…
zedddie Apr 20, 2026
d5a26d8
Support trailing self in import paths
mu001999 Apr 11, 2026
4467940
Support trailing self in normal paths
mu001999 Apr 11, 2026
8b584eb
Remove type_ns_only
mu001999 Apr 11, 2026
ddb2721
Add test for middle self
mu001999 Apr 13, 2026
d93395c
Remove the special case of ::self after edition 2018
mu001999 Apr 13, 2026
7616881
Avoid misleading closure return type note
chenyukang Apr 27, 2026
57008e9
CI: rfl: move job forward to Linux v7.1-rc1
ojeda Apr 26, 2026
faecc47
Update `triagebot.toml` file to take into account the moved file
GuillaumeGomez Apr 25, 2026
e1ab432
Rollup merge of #155760 - GuillaumeGomez:rm-attributelintkind, r=Jona…
JonathanBrouwer Apr 27, 2026
cc44bbf
Rollup merge of #154510 - heiher:stabilize-loongarch-target-features,…
JonathanBrouwer Apr 27, 2026
8511605
Rollup merge of #155137 - mu001999-contrib:self-at-end, r=petrochenkov
JonathanBrouwer Apr 27, 2026
178efdd
Rollup merge of #155433 - oli-obk:bye-bye-long-attribute, r=RalfJung,…
JonathanBrouwer Apr 27, 2026
3a1bfd7
Rollup merge of #155702 - mejrs:itemkind_trait-fields, r=petrochenkov
JonathanBrouwer Apr 27, 2026
5bd8e29
Rollup merge of #154896 - cijiugechu:fix-unsafe-binder-layout-ice, r=…
JonathanBrouwer Apr 27, 2026
d69240e
Rollup merge of #155675 - zedddie:disallow-non_exhaustive-adt-const-p…
JonathanBrouwer Apr 27, 2026
0a5a28c
Rollup merge of #155874 - chenyukang:yukang-fix-155770-return-note-in…
JonathanBrouwer Apr 27, 2026
22c3c2a
Rollup merge of #155876 - ojeda:rfl, r=lqd
JonathanBrouwer Apr 27, 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
51 changes: 1 addition & 50 deletions compiler/rustc_abi/src/layout.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::BTreeSet;
use std::fmt::{self, Write};
use std::ops::{Bound, Deref};
use std::ops::Deref;
use std::{cmp, iter};

use rustc_hashes::Hash64;
Expand Down Expand Up @@ -348,7 +348,6 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
variants: &IndexSlice<VariantIdx, IndexVec<FieldIdx, F>>,
is_enum: bool,
is_special_no_niche: bool,
scalar_valid_range: (Bound<u128>, Bound<u128>),
discr_range_of_repr: impl Fn(i128, i128) -> (Integer, bool),
discriminants: impl Iterator<Item = (VariantIdx, i128)>,
always_sized: bool,
Expand Down Expand Up @@ -380,7 +379,6 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
variants,
is_enum,
is_special_no_niche,
scalar_valid_range,
always_sized,
present_first,
)
Expand Down Expand Up @@ -530,7 +528,6 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
variants: &IndexSlice<VariantIdx, IndexVec<FieldIdx, F>>,
is_enum: bool,
is_special_no_niche: bool,
scalar_valid_range: (Bound<u128>, Bound<u128>),
always_sized: bool,
present_first: VariantIdx,
) -> LayoutCalculatorResult<FieldIdx, VariantIdx, F> {
Expand Down Expand Up @@ -570,52 +567,6 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
return Ok(st);
}

let (start, end) = scalar_valid_range;
match st.backend_repr {
BackendRepr::Scalar(ref mut scalar) | BackendRepr::ScalarPair(ref mut scalar, _) => {
// Enlarging validity ranges would result in missed
// optimizations, *not* wrongly assuming the inner
// value is valid. e.g. unions already enlarge validity ranges,
// because the values may be uninitialized.
//
// Because of that we only check that the start and end
// of the range is representable with this scalar type.

let max_value = scalar.size(dl).unsigned_int_max();
if let Bound::Included(start) = start {
// FIXME(eddyb) this might be incorrect - it doesn't
// account for wrap-around (end < start) ranges.
assert!(start <= max_value, "{start} > {max_value}");
scalar.valid_range_mut().start = start;
}
if let Bound::Included(end) = end {
// FIXME(eddyb) this might be incorrect - it doesn't
// account for wrap-around (end < start) ranges.
assert!(end <= max_value, "{end} > {max_value}");
scalar.valid_range_mut().end = end;
}

// Update `largest_niche` if we have introduced a larger niche.
let niche = Niche::from_scalar(dl, Size::ZERO, *scalar);
if let Some(niche) = niche {
match st.largest_niche {
Some(largest_niche) => {
// Replace the existing niche even if they're equal,
// because this one is at a lower offset.
if largest_niche.available(dl) <= niche.available(dl) {
st.largest_niche = Some(niche);
}
}
None => st.largest_niche = Some(niche),
}
}
}
_ => assert!(
start == Bound::Unbounded && end == Bound::Unbounded,
"nonscalar layout for layout_scalar_valid_range type: {st:#?}",
),
}

Ok(st)
}

Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,16 +569,16 @@ impl<'hir> LoweringContext<'_, 'hir> {
(safety, items, bounds)
},
);
hir::ItemKind::Trait(
hir::ItemKind::Trait {
impl_restriction,
constness,
*is_auto,
is_auto: *is_auto,
safety,
ident,
generics,
bounds,
items,
)
}
}
ItemKind::TraitAlias(box TraitAlias { constness, ident, generics, bounds }) => {
let constness = self.lower_constness(*constness);
Expand Down
33 changes: 14 additions & 19 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use std::sync::Arc;
use rustc_ast::node_id::NodeMap;
use rustc_ast::visit::Visitor;
use rustc_ast::{self as ast, *};
use rustc_attr_parsing::{AttributeParser, EmitAttribute, Late, OmitDoc};
use rustc_attr_parsing::{AttributeParser, Late, OmitDoc};
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::FxIndexSet;
use rustc_data_structures::sorted_map::SortedMap;
Expand All @@ -52,7 +52,7 @@ use rustc_errors::{DiagArgFromDisplay, DiagCtxtHandle};
use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE, LocalDefId};
use rustc_hir::definitions::PerParentDisambiguatorState;
use rustc_hir::lints::{AttributeLint, DelayedLint, DynAttribute};
use rustc_hir::lints::DelayedLint;
use rustc_hir::{
self as hir, AngleBrackets, ConstArg, GenericArg, HirId, ItemLocalMap, LifetimeSource,
LifetimeSyntax, ParamName, Target, TraitCandidate, find_attr,
Expand Down Expand Up @@ -1096,23 +1096,18 @@ impl<'hir> LoweringContext<'_, 'hir> {
target,
OmitDoc::Lower,
|s| l.lower(s),
|lint_id, span, kind| match kind {
EmitAttribute::Static(attr_kind) => {
self.delayed_lints.push(DelayedLint::AttributeParsing(AttributeLint {
lint_id,
id: target_hir_id,
span,
kind: attr_kind,
}));
}
EmitAttribute::Dynamic(callback) => {
self.delayed_lints.push(DelayedLint::Dynamic(DynAttribute {
lint_id,
id: target_hir_id,
span,
callback,
}));
}
|lint_id, span, kind| {
self.delayed_lints.push(DelayedLint {
lint_id,
id: target_hir_id,
span,
callback: Box::new(move |dcx, level, sess: &dyn std::any::Any| {
let sess = sess
.downcast_ref::<rustc_session::Session>()
.expect("expected `Session`");
(kind.0)(dcx, level, sess)
}),
});
},
)
}
Expand Down
17 changes: 11 additions & 6 deletions compiler/rustc_attr_parsing/src/attributes/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ use std::convert::identity;
use rustc_ast::token::Delimiter;
use rustc_ast::tokenstream::DelimSpan;
use rustc_ast::{AttrItem, Attribute, LitKind, ast, token};
use rustc_errors::{Applicability, PResult, msg};
use rustc_errors::{Applicability, Diagnostic, PResult, msg};
use rustc_feature::{
AttrSuggestionStyle, AttributeTemplate, Features, GatedCfg, find_gated_cfg, template,
};
use rustc_hir::attrs::CfgEntry;
use rustc_hir::lints::AttributeLintKind;
use rustc_hir::{AttrPath, RustcVersion, Target};
use rustc_parse::parser::{ForceCollect, Parser, Recovery};
use rustc_parse::{exp, parse_in};
Expand All @@ -20,6 +19,7 @@ use rustc_span::{ErrorGuaranteed, Span, Symbol, sym};
use thin_vec::ThinVec;

use crate::attributes::AttributeSafety;
use crate::attributes::diagnostic::check_cfg;
use crate::context::{AcceptContext, ShouldEmit, Stage};
use crate::parser::{
AllowExprMetavar, ArgParser, MetaItemListParser, MetaItemOrLitParser, NameValueParser,
Expand Down Expand Up @@ -224,14 +224,19 @@ pub(crate) fn parse_name_value<S: Stage>(

match cx.sess.psess.check_config.expecteds.get(&name) {
Some(ExpectedValues::Some(values)) if !values.contains(&value.map(|(v, _)| v)) => cx
.emit_lint(
.emit_dyn_lint_with_sess(
UNEXPECTED_CFGS,
AttributeLintKind::UnexpectedCfgValue((name, name_span), value),
move |dcx, level, sess| {
check_cfg::unexpected_cfg_value(sess, (name, name_span), value)
.into_diag(dcx, level)
},
span,
),
None if cx.sess.psess.check_config.exhaustive_names => cx.emit_lint(
None if cx.sess.psess.check_config.exhaustive_names => cx.emit_dyn_lint_with_sess(
UNEXPECTED_CFGS,
AttributeLintKind::UnexpectedCfgName((name, name_span), value),
move |dcx, level, sess| {
check_cfg::unexpected_cfg_name(sess, (name, name_span), value).into_diag(dcx, level)
},
span,
),
_ => { /* not unexpected */ }
Expand Down
Loading
Loading