Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
e772f7a
corrected lifetime in core::panic::Location::file return type
ijchen Oct 24, 2024
9c4a35e
added regression test for `core::panic::Location::file`'s lifetime
ijchen Oct 24, 2024
5577370
corrected lifetime in core::panic::Location::file return type
ijchen Oct 24, 2024
8a0438f
moved new test to updated test location
ijchen Aug 2, 2025
792ec3b
updated line number in test
ijchen Aug 2, 2025
8adc296
allow using `target_val!` with a rename
WaffleLapkin Jul 25, 2025
be42f3f
turn pointer width into an integer in target.json
WaffleLapkin Jul 25, 2025
6caa8ff
accept integer `target-pointer-width` in compiletest
WaffleLapkin Jul 25, 2025
51134eb
fix target-pointer-width in tests
WaffleLapkin Jul 31, 2025
d710a8e
reorganize rwlock file
connortsui20 Jul 19, 2025
4b7e904
add `nonpoison::rwlock` implementation
connortsui20 Jul 20, 2025
d8a0df0
reorganize rwlock tests
connortsui20 Jul 21, 2025
ad499d0
add nonpoison and poison rwlock tests
connortsui20 Jul 29, 2025
9aa8cfa
Convert moves of references to copies in RefProp
saethlin Jun 7, 2025
12eb1a0
feat(lldb debug info): improve enum value formatting in lldb
nilptr Aug 10, 2025
c39ebea
feat(lldb debug info): deref pointer types for more accurate rust typ…
nilptr Aug 10, 2025
6be749b
fix: python formatting error
nilptr Aug 10, 2025
37e7f52
Introduce ProjectionElem::try_map.
cjgillot Jul 2, 2025
9e28de2
Add codegen regression tests
okaneco Aug 14, 2025
d07009c
Fix the ABI parameter inconsistency issue in debug.rs for LoongArch64
heiher Aug 21, 2025
53b775d
rustdoc-search: GUI tests check for `//` in URL
notriddle Aug 20, 2025
719880d
Introduce reborrow unstable feature
aapoalas Aug 21, 2025
ead9f58
make primitive:pointer work in type-based search.
lolbinarycat Aug 21, 2025
5af3591
Introduce Reborrow lang item and trait
aapoalas Aug 21, 2025
fd44708
Add reborrow feature gate test
aapoalas Aug 21, 2025
4b730a2
rustdoc search: accept *mut T syntax for raw pointers
lolbinarycat Aug 21, 2025
ae9845f
add special formatting for displaying raw pointers in signatures
lolbinarycat Aug 21, 2025
eeaad50
unbox raw pointers in type-based search
lolbinarycat Aug 21, 2025
3501e4f
rustdoc: add tests for raw pointers in type-based search
lolbinarycat Aug 21, 2025
291da71
Add an experimental unsafe(force_target_feature) attribute.
veluca93 Aug 18, 2025
e5bd01b
Correct comments.
cjgillot Aug 21, 2025
42d6330
triagebot: Update style team reviewers
joshtriplett Aug 22, 2025
401f40f
tests/rustdoc-js-std/parser-errors.js: remove syntax that is now valid
lolbinarycat Aug 22, 2025
689171d
Uplift rustc_mir_transform::coverage::counters::union_find to rustc_d…
cjgillot Aug 22, 2025
1e5b5ba
print raw lifetime idents with `r#`
fee1-dead Aug 4, 2025
30bb704
don't print invalid labels with `r#`
fee1-dead Aug 4, 2025
4970127
address review comments
fee1-dead Aug 22, 2025
e1d4f09
doc: fix some typos in comment
xihuwenhua Aug 22, 2025
d61353f
tests: Ignore basic-stepping.rs on LoongArch
heiher Aug 22, 2025
774d96a
resolve: `early_resolve_ident_in_lexical_scope` -> `resolve_ident_in_…
petrochenkov Aug 19, 2025
b82b947
resolve: Remove `Module` from `ScopeSet::Late`
petrochenkov Aug 19, 2025
a47c372
resolve: Remove derive fallback lint id from `ScopeSet::Late`
petrochenkov Aug 19, 2025
e26b175
resolve: Remove `ScopeSet::Late`
petrochenkov Aug 19, 2025
f0e9fd6
CI: rfl: support Rust >= 1.91.0 target spec
ojeda Aug 21, 2025
049c327
On E0277, point at type that doesn't implement bound
estebank Aug 19, 2025
6caa586
Recover param: Ty = EXPR
compiler-errors Feb 21, 2025
1c74260
Rollup merge of #132087 - ijchen:issue-131770-fix, r=dtolnay
jhpratt Aug 22, 2025
df37146
Rollup merge of #137396 - compiler-errors:param-default, r=fmease
jhpratt Aug 22, 2025
e7ec60a
Rollup merge of #142185 - saethlin:refprop-moves, r=cjgillot
jhpratt Aug 22, 2025
4c64d49
Rollup merge of #144443 - WaffleLapkin:integer-target-pointer-width, …
jhpratt Aug 22, 2025
9c2aa65
Rollup merge of #144648 - connortsui20:nonpoison_rwlock, r=Mark-Simul…
jhpratt Aug 22, 2025
d9c5c9d
Rollup merge of #144897 - fee1-dead-contrib:raw_lifetimes_printing, r…
jhpratt Aug 22, 2025
0bd40f5
Rollup merge of #145218 - nilptr:nilptr/feat/lldb-enum-pretty-printer…
jhpratt Aug 22, 2025
f8624f2
Rollup merge of #145380 - okaneco:add-codegen-tests, r=Mark-Simulacrum
jhpratt Aug 22, 2025
e71195e
Rollup merge of #145573 - veluca93:unsafe-force-target-feature, r=dav…
jhpratt Aug 22, 2025
7a225b1
Rollup merge of #145597 - petrochenkov:nolateset, r=b-naber
jhpratt Aug 22, 2025
3af75e0
Rollup merge of #145641 - estebank:point-at-type-in-e0277, r=davidtwco
jhpratt Aug 22, 2025
2529559
Rollup merge of #145669 - notriddle:test-js-search-scripts-path, r=Gu…
jhpratt Aug 22, 2025
95e7eae
Rollup merge of #145695 - cjgillot:place-elem-map, r=oli-obk,lcnr
jhpratt Aug 22, 2025
a82d689
Rollup merge of #145710 - heiher:issue-145692-2, r=nnethercote
jhpratt Aug 22, 2025
ca61fba
Rollup merge of #145726 - aapoalas:reborrow-lang-experiment, r=petroc…
jhpratt Aug 22, 2025
3817985
Rollup merge of #145731 - lolbinarycat:rustdoc-search-generic-pointer…
jhpratt Aug 22, 2025
06ef778
Rollup merge of #145736 - joshtriplett:triagebot-style, r=traviscross
jhpratt Aug 22, 2025
5e1f11e
Rollup merge of #145738 - cjgillot:union-find-uplift, r=Zalathar
jhpratt Aug 22, 2025
ad89f2d
Rollup merge of #145743 - xihuwenhua:master, r=petrochenkov
jhpratt Aug 22, 2025
555ef1c
Rollup merge of #145745 - heiher:ignore-basic-stepping, r=lqd
jhpratt Aug 22, 2025
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_abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ pub enum TargetDataLayoutErrors<'a> {
MissingAlignment { cause: &'a str },
InvalidAlignment { cause: &'a str, err: AlignFromBytesError },
InconsistentTargetArchitecture { dl: &'a str, target: &'a str },
InconsistentTargetPointerWidth { pointer_size: u64, target: u32 },
InconsistentTargetPointerWidth { pointer_size: u64, target: u16 },
InvalidBitsSize { err: String },
UnknownPointerSpecification { err: String },
}
Expand Down
22 changes: 16 additions & 6 deletions compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub use NtPatKind::*;
pub use TokenKind::*;
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_span::edition::Edition;
use rustc_span::symbol::IdentPrintMode;
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, kw, sym};
#[allow(clippy::useless_attribute)] // FIXME: following use of `hidden_glob_reexports` incorrectly triggers `useless_attribute` lint.
#[allow(hidden_glob_reexports)]
Expand Down Expand Up @@ -344,15 +345,24 @@ pub enum IdentIsRaw {
Yes,
}

impl From<bool> for IdentIsRaw {
fn from(b: bool) -> Self {
if b { Self::Yes } else { Self::No }
impl IdentIsRaw {
pub fn to_print_mode_ident(self) -> IdentPrintMode {
match self {
IdentIsRaw::No => IdentPrintMode::Normal,
IdentIsRaw::Yes => IdentPrintMode::RawIdent,
}
}
pub fn to_print_mode_lifetime(self) -> IdentPrintMode {
match self {
IdentIsRaw::No => IdentPrintMode::Normal,
IdentIsRaw::Yes => IdentPrintMode::RawLifetime,
}
}
}

impl From<IdentIsRaw> for bool {
fn from(is_raw: IdentIsRaw) -> bool {
matches!(is_raw, IdentIsRaw::Yes)
impl From<bool> for IdentIsRaw {
fn from(b: bool) -> Self {
if b { Self::Yes } else { Self::No }
}
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_ir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl IntTy {
})
}

pub fn normalize(&self, target_width: u32) -> Self {
pub fn normalize(&self, target_width: u16) -> Self {
match self {
IntTy::Isize => match target_width {
16 => IntTy::I16,
Expand Down Expand Up @@ -148,7 +148,7 @@ impl UintTy {
})
}

pub fn normalize(&self, target_width: u32) -> Self {
pub fn normalize(&self, target_width: u16) -> Self {
match self {
UintTy::Usize => match target_width {
16 => UintTy::U16,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1596,7 +1596,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let safety = self.lower_safety(h.safety, default_safety);

// Treat safe `#[target_feature]` functions as unsafe, but also remember that we did so.
let safety = if find_attr!(attrs, AttributeKind::TargetFeature { .. })
let safety = if find_attr!(attrs, AttributeKind::TargetFeature { was_forced: false, .. })
&& safety.is_safe()
&& !self.tcx.sess.target.is_like_wasm
{
Expand Down
17 changes: 8 additions & 9 deletions compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::borrow::Cow;
use std::sync::Arc;

use rustc_ast::attr::AttrIdGenerator;
use rustc_ast::token::{self, CommentKind, Delimiter, IdentIsRaw, Token, TokenKind};
use rustc_ast::token::{self, CommentKind, Delimiter, Token, TokenKind};
use rustc_ast::tokenstream::{Spacing, TokenStream, TokenTree};
use rustc_ast::util::classify;
use rustc_ast::util::comments::{Comment, CommentStyle};
Expand Down Expand Up @@ -441,7 +441,7 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
fn print_generic_args(&mut self, args: &ast::GenericArgs, colons_before_params: bool);

fn print_ident(&mut self, ident: Ident) {
self.word(IdentPrinter::for_ast_ident(ident, ident.is_raw_guess()).to_string());
self.word(IdentPrinter::for_ast_ident(ident, ident.guess_print_mode()).to_string());
self.ann_post(ident)
}

Expand Down Expand Up @@ -1015,17 +1015,16 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere

/* Name components */
token::Ident(name, is_raw) => {
IdentPrinter::new(name, is_raw.into(), convert_dollar_crate).to_string().into()
IdentPrinter::new(name, is_raw.to_print_mode_ident(), convert_dollar_crate)
.to_string()
.into()
}
token::NtIdent(ident, is_raw) => {
IdentPrinter::for_ast_ident(ident, is_raw.into()).to_string().into()
IdentPrinter::for_ast_ident(ident, is_raw.to_print_mode_ident()).to_string().into()
}

token::Lifetime(name, IdentIsRaw::No)
| token::NtLifetime(Ident { name, .. }, IdentIsRaw::No) => name.to_string().into(),
token::Lifetime(name, IdentIsRaw::Yes)
| token::NtLifetime(Ident { name, .. }, IdentIsRaw::Yes) => {
format!("'r#{}", &name.as_str()[1..]).into()
token::Lifetime(name, is_raw) | token::NtLifetime(Ident { name, .. }, is_raw) => {
IdentPrinter::new(name, is_raw.to_print_mode_lifetime(), None).to_string().into()
}

/* Other */
Expand Down
118 changes: 78 additions & 40 deletions compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,57 +376,68 @@ impl<S: Stage> AttributeParser<S> for UsedParser {
}
}

fn parse_tf_attribute<'c, S: Stage>(
cx: &'c mut AcceptContext<'_, '_, S>,
args: &'c ArgParser<'_>,
) -> impl IntoIterator<Item = (Symbol, Span)> + 'c {
let mut features = Vec::new();
let ArgParser::List(list) = args else {
cx.expected_list(cx.attr_span);
return features;
};
if list.is_empty() {
cx.warn_empty_attribute(cx.attr_span);
return features;
}
for item in list.mixed() {
let Some(name_value) = item.meta_item() else {
cx.expected_name_value(item.span(), Some(sym::enable));
return features;
};

// Validate name
let Some(name) = name_value.path().word_sym() else {
cx.expected_name_value(name_value.path().span(), Some(sym::enable));
return features;
};
if name != sym::enable {
cx.expected_name_value(name_value.path().span(), Some(sym::enable));
return features;
}

// Use value
let Some(name_value) = name_value.args().name_value() else {
cx.expected_name_value(item.span(), Some(sym::enable));
return features;
};
let Some(value_str) = name_value.value_as_str() else {
cx.expected_string_literal(name_value.value_span, Some(name_value.value_as_lit()));
return features;
};
for feature in value_str.as_str().split(",") {
features.push((Symbol::intern(feature), item.span()));
}
}
features
}

pub(crate) struct TargetFeatureParser;

impl<S: Stage> CombineAttributeParser<S> for TargetFeatureParser {
type Item = (Symbol, Span);
const PATH: &[Symbol] = &[sym::target_feature];
const CONVERT: ConvertFn<Self::Item> = |items, span| AttributeKind::TargetFeature(items, span);
const CONVERT: ConvertFn<Self::Item> = |items, span| AttributeKind::TargetFeature {
features: items,
attr_span: span,
was_forced: false,
};
const TEMPLATE: AttributeTemplate = template!(List: &["enable = \"feat1, feat2\""]);

fn extend<'c>(
cx: &'c mut AcceptContext<'_, '_, S>,
args: &'c ArgParser<'_>,
) -> impl IntoIterator<Item = Self::Item> + 'c {
let mut features = Vec::new();
let ArgParser::List(list) = args else {
cx.expected_list(cx.attr_span);
return features;
};
if list.is_empty() {
cx.warn_empty_attribute(cx.attr_span);
return features;
}
for item in list.mixed() {
let Some(name_value) = item.meta_item() else {
cx.expected_name_value(item.span(), Some(sym::enable));
return features;
};

// Validate name
let Some(name) = name_value.path().word_sym() else {
cx.expected_name_value(name_value.path().span(), Some(sym::enable));
return features;
};
if name != sym::enable {
cx.expected_name_value(name_value.path().span(), Some(sym::enable));
return features;
}

// Use value
let Some(name_value) = name_value.args().name_value() else {
cx.expected_name_value(item.span(), Some(sym::enable));
return features;
};
let Some(value_str) = name_value.value_as_str() else {
cx.expected_string_literal(name_value.value_span, Some(name_value.value_as_lit()));
return features;
};
for feature in value_str.as_str().split(",") {
features.push((Symbol::intern(feature), item.span()));
}
}
features
parse_tf_attribute(cx, args)
}

const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Expand All @@ -440,3 +451,30 @@ impl<S: Stage> CombineAttributeParser<S> for TargetFeatureParser {
Warn(Target::MacroDef),
]);
}

pub(crate) struct ForceTargetFeatureParser;

impl<S: Stage> CombineAttributeParser<S> for ForceTargetFeatureParser {
type Item = (Symbol, Span);
const PATH: &[Symbol] = &[sym::force_target_feature];
const CONVERT: ConvertFn<Self::Item> = |items, span| AttributeKind::TargetFeature {
features: items,
attr_span: span,
was_forced: true,
};
const TEMPLATE: AttributeTemplate = template!(List: &["enable = \"feat1, feat2\""]);

fn extend<'c>(
cx: &'c mut AcceptContext<'_, '_, S>,
args: &'c ArgParser<'_>,
) -> impl IntoIterator<Item = Self::Item> + 'c {
parse_tf_attribute(cx, args)
}

const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: true })),
Allow(Target::Method(MethodKind::TraitImpl)),
]);
}
5 changes: 3 additions & 2 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use crate::attributes::allow_unstable::{
};
use crate::attributes::body::CoroutineParser;
use crate::attributes::codegen_attrs::{
ColdParser, CoverageParser, ExportNameParser, NakedParser, NoMangleParser, OptimizeParser,
TargetFeatureParser, TrackCallerParser, UsedParser,
ColdParser, CoverageParser, ExportNameParser, ForceTargetFeatureParser, NakedParser,
NoMangleParser, OptimizeParser, TargetFeatureParser, TrackCallerParser, UsedParser,
};
use crate::attributes::confusables::ConfusablesParser;
use crate::attributes::deprecation::DeprecationParser;
Expand Down Expand Up @@ -157,6 +157,7 @@ attribute_parsers!(
// tidy-alphabetical-start
Combine<AllowConstFnUnstableParser>,
Combine<AllowInternalUnstableParser>,
Combine<ForceTargetFeatureParser>,
Combine<ReprParser>,
Combine<TargetFeatureParser>,
Combine<UnstableFeatureBoundParser>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
"unix"
],
"target-mcount": "_mcount",
"target-pointer-width": "32"
"target-pointer-width": 32
}
7 changes: 4 additions & 3 deletions compiler/rustc_codegen_ssa/src/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@ fn process_builtin_attrs(
}
}
AttributeKind::Optimize(optimize, _) => codegen_fn_attrs.optimize = *optimize,
AttributeKind::TargetFeature(features, attr_span) => {
AttributeKind::TargetFeature { features, attr_span, was_forced } => {
let Some(sig) = tcx.hir_node_by_def_id(did).fn_sig() else {
tcx.dcx().span_delayed_bug(*attr_span, "target_feature applied to non-fn");
continue;
};
let safe_target_features =
matches!(sig.header.safety, hir::HeaderSafety::SafeTargetFeatures);
codegen_fn_attrs.safe_target_features = safe_target_features;
if safe_target_features {
if safe_target_features && !was_forced {
if tcx.sess.target.is_like_wasm || tcx.sess.opts.actually_rustdoc {
// The `#[target_feature]` attribute is allowed on
// WebAssembly targets on all functions. Prior to stabilizing
Expand Down Expand Up @@ -232,6 +232,7 @@ fn process_builtin_attrs(
tcx,
did,
features,
*was_forced,
rust_target_features,
&mut codegen_fn_attrs.target_features,
);
Expand Down Expand Up @@ -462,7 +463,7 @@ fn check_result(
.collect(),
) {
let span =
find_attr!(tcx.get_all_attrs(did), AttributeKind::TargetFeature(_, span) => *span)
find_attr!(tcx.get_all_attrs(did), AttributeKind::TargetFeature{attr_span: span, ..} => *span)
.unwrap_or_else(|| tcx.def_span(did));

tcx.dcx()
Expand Down
12 changes: 10 additions & 2 deletions compiler/rustc_codegen_ssa/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc_data_structures::unord::{UnordMap, UnordSet};
use rustc_hir::attrs::InstructionSetAttr;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId};
use rustc_middle::middle::codegen_fn_attrs::TargetFeature;
use rustc_middle::middle::codegen_fn_attrs::{TargetFeature, TargetFeatureKind};
use rustc_middle::query::Providers;
use rustc_middle::ty::TyCtxt;
use rustc_session::Session;
Expand All @@ -22,6 +22,7 @@ pub(crate) fn from_target_feature_attr(
tcx: TyCtxt<'_>,
did: LocalDefId,
features: &[(Symbol, Span)],
was_forced: bool,
rust_target_features: &UnordMap<String, target_features::Stability>,
target_features: &mut Vec<TargetFeature>,
) {
Expand Down Expand Up @@ -88,7 +89,14 @@ pub(crate) fn from_target_feature_attr(
}
}
}
target_features.push(TargetFeature { name, implied: name != feature })
let kind = if name != feature {
TargetFeatureKind::Implied
} else if was_forced {
TargetFeatureKind::Forced
} else {
TargetFeatureKind::Enabled
};
target_features.push(TargetFeature { name, kind })
}
}
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pub mod thinvec;
pub mod thousands;
pub mod transitive_relation;
pub mod unhash;
pub mod union_find;
pub mod unord;
pub mod vec_cache;
pub mod work_queue;
Expand Down
Loading
Loading