Skip to content

Rollup of 16 pull requests #142299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 53 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
dc14e73
Delete unused variant and document AttributeKind
mejrs Apr 27, 2025
5fdacfe
Force exhaustive handling of every parsed attribute
mejrs Apr 27, 2025
c677dc2
Allow transmute casts in pre-runtime-MIR
oli-obk Jun 6, 2025
cd7533a
Stabilize the `keylocker_x86` flag, and the `kl` and `widekl` target …
sayantn May 7, 2025
3ab5e60
Add execution context
Shourya742 Jun 8, 2025
81ee86b
add execution context to bootstrap workflow
Shourya742 Jun 8, 2025
def4488
move git command to new execution context
Shourya742 Jun 8, 2025
8bd8169
moved render_tests in utils to new execution context
Shourya742 Jun 6, 2025
c2986ee
Add ui test removed-features-note-version-and-pr-issue-141619
xizheyin May 27, 2025
b4ba017
Note the version and PR of removed features when using it
xizheyin May 27, 2025
4b89804
Make `since` of removed features the version removed and fill `pull`
xizheyin Jun 4, 2025
9b0ad97
deduplicate the rest of AST walker functions
fee1-dead Jun 9, 2025
81abbe1
moved sanity command to exec context
Shourya742 Jun 6, 2025
2d1ca83
moved curl to use new execution_context
Shourya742 Jun 6, 2025
d544c2b
covert uname to new extext method
Shourya742 Jun 6, 2025
bae39b8
move all download.rs method to new execution context command invocation
Shourya742 Jun 6, 2025
746276c
moved git command to new exec context
Shourya742 Jun 7, 2025
98be2a0
move all config command invocation to new execution context invocation
Shourya742 Jun 7, 2025
50725f3
move all commands to new execution context
Shourya742 Jun 7, 2025
f3e1eb1
update dry_run value in exec_ctx and start forwarding exec_ctx verbos…
Shourya742 Jun 8, 2025
e9ced50
remove execution context from flag module and correct the command inv…
Shourya742 Jun 9, 2025
51fbd14
Initialize the execution context in parse_inner, start using dry run …
Shourya742 Jun 9, 2025
1cdd33e
core::ptr: deduplicate more method docs
lolbinarycat Jun 6, 2025
a9401ea
platform-support.md: Mention specific Linux kernel version or later
teohhanhui Jun 9, 2025
1b9d7ea
Mark `core::slice::memchr` as `#[doc(hidden)]`
aDotInTheVoid Jun 9, 2025
fea6a22
Specify the behavior of `file!`
epage Dec 17, 2024
4f0b60a
Don't create .msi installer for gnullvm hosts
mati865 May 6, 2025
580a955
compiler: Fix reusing same lint on fn ptrs with newly-deprecated ABIs
workingjubilee Jun 9, 2025
0df01a0
tests: bless unsupported_calling_conventions linting on some fn_ptrs
workingjubilee Jun 9, 2025
856c997
rustdoc: Refractor `clean_ty_generics`
aDotInTheVoid Jun 10, 2025
7d7fedb
docs: Small clarification on the usage of read_to_string and read_to_…
Jun 7, 2025
8808a9c
hir_analysis: Elaborate on lint strategy for unsupported ABIs
workingjubilee Jun 10, 2025
f3af860
add a fixme to use `extern_custom` when available
folkertdev Jun 9, 2025
b6eb4f9
use `#[naked]` for `__rust_probestack`
folkertdev Jun 3, 2025
45d649e
merge the sgx/fortanix `__rust_probestack` into the general `x86_64` one
folkertdev Jun 3, 2025
b030442
indent the probestack inline assembly
folkertdev Jun 3, 2025
6d1db11
const_eval: fix some outdated comments
RalfJung Jun 10, 2025
ea1d186
Rollup merge of #134442 - epage:change, r=workingjubilee
fmease Jun 10, 2025
0f16ccb
Rollup merge of #140372 - mejrs:attrs, r=jdonszelmann
fmease Jun 10, 2025
d11756f
Rollup merge of #140766 - sayantn:stabilize-keylocker, r=traviscross,…
fmease Jun 10, 2025
2aea4b2
Rollup merge of #141642 - xizheyin:issue-141619, r=BoxyUwU
fmease Jun 10, 2025
04025fa
Rollup merge of #141818 - mati865:dont-create-msi-from-non-windows, r…
fmease Jun 10, 2025
b9a578e
Rollup merge of #141909 - Shourya742:2025-06-01-add-execution-context…
fmease Jun 10, 2025
a55b610
Rollup merge of #141992 - folkertdev:probestack-naked-function, r=tgr…
fmease Jun 10, 2025
b13df84
Rollup merge of #142101 - lolbinarycat:core-dedup-ptr-docs-139190-pt2…
fmease Jun 10, 2025
590f630
Rollup merge of #142102 - kiseitai3:141714_stdin_read_to_string_docs,…
fmease Jun 10, 2025
e8be230
Rollup merge of #142124 - oli-obk:transmute-cast, r=scottmcm
fmease Jun 10, 2025
407b81c
Rollup merge of #142240 - fee1-dead-contrib:push-zkkzoxlymslv, r=oli-obk
fmease Jun 10, 2025
28d3856
Rollup merge of #142258 - teohhanhui:docs/platform-support-linux-kern…
fmease Jun 10, 2025
f76f1f2
Rollup merge of #142262 - aDotInTheVoid:nomemchr, r=Noratrieb
fmease Jun 10, 2025
a2badeb
Rollup merge of #142271 - workingjubilee:fn-ptrs-have-two-different-l…
fmease Jun 10, 2025
34d39eb
Rollup merge of #142275 - aDotInTheVoid:gen-ty-of, r=fmease
fmease Jun 10, 2025
9f5c10e
Rollup merge of #142288 - RalfJung:const-eval-comments, r=oli-obk
fmease Jun 10, 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
616 changes: 24 additions & 592 deletions compiler/rustc_ast/src/mut_visit.rs

Large diffs are not rendered by default.

1,215 changes: 642 additions & 573 deletions compiler/rustc_ast/src/visit.rs

Large diffs are not rendered by default.

44 changes: 24 additions & 20 deletions compiler/rustc_attr_data_structures/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ impl OptimizeAttr {
}
}

#[derive(Clone, Debug, Encodable, Decodable, HashStable_Generic, PrintAttribute)]
pub enum DiagnosticAttribute {
// tidy-alphabetical-start
DoNotRecommend,
OnUnimplemented,
// tidy-alphabetical-end
}

#[derive(PartialEq, Debug, Encodable, Decodable, Copy, Clone, HashStable_Generic, PrintAttribute)]
pub enum ReprAttr {
ReprInt(IntType),
Expand Down Expand Up @@ -160,40 +152,52 @@ impl Deprecation {
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
pub enum AttributeKind {
// tidy-alphabetical-start
/// Represents `#[rustc_allow_const_fn_unstable]`.
AllowConstFnUnstable(ThinVec<Symbol>),

/// Represents `#[allow_internal_unstable]`.
AllowInternalUnstable(ThinVec<(Symbol, Span)>),

/// Represents `#[rustc_default_body_unstable]`.
BodyStability {
stability: DefaultBodyStability,
/// Span of the `#[rustc_default_body_unstable(...)]` attribute
span: Span,
},

/// Represents `#[rustc_confusables]`.
Confusables {
symbols: ThinVec<Symbol>,
// FIXME(jdonszelmann): remove when target validation code is moved
first_span: Span,
},

/// Represents `#[rustc_const_stable]` and `#[rustc_const_unstable]`.
ConstStability {
stability: PartialConstStability,
/// Span of the `#[rustc_const_stable(...)]` or `#[rustc_const_unstable(...)]` attribute
span: Span,
},

/// Represents `#[rustc_const_stable_indirect]`.
ConstStabilityIndirect,
Deprecation {
deprecation: Deprecation,
span: Span,
},
Diagnostic(DiagnosticAttribute),
DocComment {
style: AttrStyle,
kind: CommentKind,
span: Span,
comment: Symbol,
},

/// Represents [`#[deprecated]`](https://doc.rust-lang.org/stable/reference/attributes/diagnostics.html#the-deprecated-attribute).
Deprecation { deprecation: Deprecation, span: Span },

/// Represents [`#[doc]`](https://doc.rust-lang.org/stable/rustdoc/write-documentation/the-doc-attribute.html).
DocComment { style: AttrStyle, kind: CommentKind, span: Span, comment: Symbol },

/// Represents `#[rustc_macro_transparency]`.
MacroTransparency(Transparency),

/// Represents [`#[repr]`](https://doc.rust-lang.org/stable/reference/type-layout.html#representations).
Repr(ThinVec<(ReprAttr, Span)>),

/// Represents `#[stable]`, `#[unstable]` and `#[rustc_allowed_through_unstable_modules]`.
Stability {
stability: Stability,
/// Span of the `#[stable(...)]` or `#[unstable(...)]` attribute
/// Span of the attribute.
span: Span,
},
// tidy-alphabetical-end
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_codegen_llvm/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use rustc_hir::def_id::DefId;
use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, PatchableFunctionEntry};
use rustc_middle::ty::{self, TyCtxt};
use rustc_session::config::{BranchProtection, FunctionReturn, OptLevel, PAuthKey, PacRet};
use rustc_symbol_mangling::mangle_internal_symbol;
use rustc_target::spec::{FramePointer, SanitizerSet, StackProbeType, StackProtector};
use smallvec::SmallVec;

Expand Down Expand Up @@ -256,11 +257,11 @@ fn probestack_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
StackProbeType::Inline => "inline-asm",
// Flag our internal `__rust_probestack` function as the stack probe symbol.
// This is defined in the `compiler-builtins` crate for each architecture.
StackProbeType::Call => "__rust_probestack",
StackProbeType::Call => &mangle_internal_symbol(cx.tcx, "__rust_probestack"),
// Pick from the two above based on the LLVM version.
StackProbeType::InlineOrCall { min_llvm_version_for_inline } => {
if llvm_util::get_version() < min_llvm_version_for_inline {
"__rust_probestack"
&mangle_internal_symbol(cx.tcx, "__rust_probestack")
} else {
"inline-asm"
}
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_const_eval/src/check_consts/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,7 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
hir::ConstContext::ConstFn => true,
_ => {
// For indirect places, we are not creating a new permanent borrow, it's just as
// transient as the already existing one. For reborrowing references this is handled
// at the top of `visit_rvalue`, but for raw pointers we handle it here.
// Pointers/references to `static mut` and cases where the `*` is not the first
// projection also end up here.
// transient as the already existing one.
// Locals with StorageDead do not live beyond the evaluation and can
// thus safely be borrowed without being able to be leaked to the final
// value of the constant.
Expand Down
15 changes: 7 additions & 8 deletions compiler/rustc_const_eval/src/interpret/intern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,11 @@ pub fn intern_const_alloc_recursive<'tcx, M: CompileTimeMachine<'tcx, const_eval

// Keep interning as long as there are things to intern.
// We show errors if there are dangling pointers, or mutable pointers in immutable contexts
// (i.e., everything except for `static mut`). When these errors affect references, it is
// unfortunate that we show these errors here and not during validation, since validation can
// show much nicer errors. However, we do need these checks to be run on all pointers, including
// raw pointers, so we cannot rely on validation to catch them -- and since interning runs
// before validation, and interning doesn't know the type of anything, this means we can't show
// better errors. Maybe we should consider doing validation before interning in the future.
// (i.e., everything except for `static mut`). We only return these errors as a `Result`
// so that the caller can run validation, and subsequently only report interning errors
// if validation fails. Validation has the better error messages so we prefer those, but
// interning has better coverage since it "sees" *all* pointers, including raw pointers and
// references stored in unions.
while let Some(prov) = todo.pop() {
trace!(?prov);
let alloc_id = prov.alloc_id();
Expand Down Expand Up @@ -279,12 +278,12 @@ pub fn intern_const_alloc_recursive<'tcx, M: CompileTimeMachine<'tcx, const_eval
// when there is memory there that someone might expect to be mutable, but we make it immutable.
let dangling = !is_already_global && !ecx.memory.alloc_map.contains_key(&alloc_id);
if !dangling {
// Found a mutable reference inside a const where inner allocations should be
// Found a mutable pointer inside a const where inner allocations should be
// immutable.
if !ecx.tcx.sess.opts.unstable_opts.unleash_the_miri_inside_of_you {
span_bug!(
ecx.tcx.span,
"the static const safety checks accepted mutable references they should not have accepted"
"the static const safety checks accepted a mutable pointer they should not have accepted"
);
}
// Prefer dangling pointer errors over mutable pointer errors
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_expand/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ expand_feature_not_allowed =
expand_feature_removed =
feature has been removed
.label = feature has been removed
.note = removed in {$removed_rustc_version} (you are using {$current_rustc_version}){$pull_note}
.reason = {$reason}

expand_glob_delegation_outside_impls =
Expand Down
11 changes: 11 additions & 0 deletions compiler/rustc_expand/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,20 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute], crate_name: Symbol) -

// If the enabled feature has been removed, issue an error.
if let Some(f) = REMOVED_LANG_FEATURES.iter().find(|f| name == f.feature.name) {
let pull_note = if let Some(pull) = f.pull {
format!(
"; see <https://github.com/rust-lang/rust/pull/{}> for more information",
pull
)
} else {
"".to_owned()
};
sess.dcx().emit_err(FeatureRemoved {
span: mi.span(),
reason: f.reason.map(|reason| FeatureRemovedReason { reason }),
removed_rustc_version: f.feature.since,
current_rustc_version: sess.cfg_version,
pull_note,
});
continue;
}
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_expand/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,16 @@ pub(crate) struct HelperAttributeNameInvalid {

#[derive(Diagnostic)]
#[diag(expand_feature_removed, code = E0557)]
#[note]
pub(crate) struct FeatureRemoved<'a> {
#[primary_span]
#[label]
pub span: Span,
#[subdiagnostic]
pub reason: Option<FeatureRemovedReason<'a>>,
pub removed_rustc_version: &'a str,
pub current_rustc_version: &'a str,
pub pull_note: String,
}

#[derive(Subdiagnostic)]
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ declare_features! (
/// Allows some increased flexibility in the name resolution rules,
/// especially around globs and shadowing (RFC 1560).
(accepted, item_like_imports, "1.15.0", Some(35120)),
// Allows using the `kl` and `widekl` target features and the associated intrinsics
(accepted, keylocker_x86, "CURRENT_RUSTC_VERSION", Some(134813)),
/// Allows `'a: { break 'a; }`.
(accepted, label_break_value, "1.65.0", Some(48594)),
/// Allows `let...else` statements.
Expand Down
Loading
Loading