Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
61b26f9
Improve diagnostics for buffer reuse with borrowed references
JohnTitor Oct 22, 2025
4e9dfb5
cmse: add test for `async` and `const` functions
folkertdev Nov 5, 2025
568c6ed
propagate function attributes in ast visitor
folkertdev Nov 9, 2025
1cff528
epoll: unblock threads when new interest is registered
RalfJung Nov 9, 2025
ac12e46
simplify epoll data structures: dont make the interests themselves in…
RalfJung Nov 9, 2025
ebd173f
add `feature(c_variadic_naked_functions)`
folkertdev Nov 9, 2025
9129b90
use `feature(c_variadic_naked_functions)` in tests
folkertdev Nov 9, 2025
69be846
Merge pull request #4675 from RalfJung/epoll
RalfJung Nov 9, 2025
047ee0a
epoll: when an event disappears entirely, remove it from the ready list
RalfJung Nov 10, 2025
a8baf33
epoll: do proper edge detection inside the epoll system
RalfJung Nov 10, 2025
6c6aa0f
Prepare for merging from rust-lang/rust
Nov 10, 2025
c9a2581
Merge ref '8401398e1f14' from rust-lang/rust
Nov 10, 2025
e8aa88f
fmt
Nov 10, 2025
3c56919
clippy
RalfJung Nov 10, 2025
656fe2f
Merge pull request #4677 from rust-lang/rustup-2025-11-10
RalfJung Nov 10, 2025
4412a0a
eventfd: force spurious wakeups, matching Linux
RalfJung Nov 10, 2025
7b4802d
fix EPOLL_CTL_MOD
RalfJung Nov 10, 2025
fc4748c
make EpollInterestTable sorted to avoid linear scan
RalfJung Nov 10, 2025
fe6bc02
avoid using the address of an FD; now that we sort by that it may be …
RalfJung Nov 10, 2025
b340f08
add the tokio poll_fns test that triggered this investigation
RalfJung Nov 10, 2025
15299b7
Merge pull request #4676 from RalfJung/epoll-edge
RalfJung Nov 10, 2025
e611ef3
fix filecheck typos in tests
klensy Nov 10, 2025
ecb0d3b
Update tests/codegen-llvm/deduced-param-attrs.rs
klensy Nov 11, 2025
69da9af
Update git index before running diff-index
Kobzol Nov 4, 2025
fcce61c
Remove specialized warning for removed target
bjorn3 Nov 11, 2025
0b45ab3
Suggest add bounding value for RangeTo
chenyukang Oct 16, 2025
04f798b
Fix invalid jump to def macro link generation
GuillaumeGomez Oct 24, 2025
dacabcd
Update jump to def macro link generation test
GuillaumeGomez Oct 24, 2025
f4e1ffc
Add missing documentation
GuillaumeGomez Nov 6, 2025
050412a
add shim for avx512 ternarylogic functions
folkertdev Nov 10, 2025
4d3d3b3
Improve code
GuillaumeGomez Nov 11, 2025
13b8cf5
Merge pull request #4678 from folkertdev/ternary-logic
RalfJung Nov 11, 2025
dd2159e
Simplify jemalloc setup
madsmtm Nov 11, 2025
65f0b7a
Fix building rustdoc and clippy with jemalloc feature
madsmtm Oct 25, 2025
54ee492
Update rustbook dependencies
jamie-osec Nov 11, 2025
c8d1ac9
Remove more #[must_use] from portable-simd
dtolnay Nov 11, 2025
c6f924c
rustc_target: move comment to macro
tamird Nov 7, 2025
a1122a1
rustc_target: rename Arch::{Uknown,Other}
tamird Nov 7, 2025
b808f33
rustdoc: Don't pass `RenderOptions` to `DocContext`
aDotInTheVoid Oct 17, 2025
86c74a4
rustc_target: introduce Abi
tamird Nov 5, 2025
ddd7596
rustc_target: introduce Env
tamird Nov 5, 2025
fcf6809
rustc_target: introduce Os
tamird Nov 5, 2025
19e26af
rustc_target: rehome target_abi comment
tamird Nov 7, 2025
98a534e
rustc_codegen_ssa: reduce repetition
tamird Nov 7, 2025
76067c4
Adjust spans into the `for` loops context before creating the pattern…
Jarcho Nov 3, 2025
c523b65
fix(rustdoc): Color doctest errors
Muscraft Nov 11, 2025
5dc3c19
Rollup merge of #146627 - madsmtm:jemalloc-simplify, r=jdonszelmann
Zalathar Nov 12, 2025
4cd28de
Rollup merge of #147753 - chenyukang:yukang-147749, r=fmease
Zalathar Nov 12, 2025
203130b
Rollup merge of #147832 - aDotInTheVoid:rustdoc-format-options, r=Gui…
Zalathar Nov 12, 2025
b98d127
Rollup merge of #147974 - JohnTitor:diag-detect-buf-reuse-pattern, r=…
Zalathar Nov 12, 2025
87ba9a5
Rollup merge of #148080 - GuillaumeGomez:fix-jump-def-links, r=lolbin…
Zalathar Nov 12, 2025
a2c8493
Rollup merge of #148465 - Jarcho:for_span, r=davidtwco,Zalathar
Zalathar Nov 12, 2025
de8f0c0
Rollup merge of #148500 - Kobzol:git-update-inex, r=jieyouxu
Zalathar Nov 12, 2025
3b8d30b
Rollup merge of #148531 - tamird:vendor-enum, r=nnethercote
Zalathar Nov 12, 2025
ab8bdf7
Rollup merge of #148536 - folkertdev:cmse-async-const-fn, r=davidtwco
Zalathar Nov 12, 2025
60b2068
Rollup merge of #148770 - folkertdev:naked-c-variadic, r=workingjubilee
Zalathar Nov 12, 2025
64b5637
Rollup merge of #148780 - klensy:filecheck-typo, r=jieyouxu
Zalathar Nov 12, 2025
672c6b6
Rollup merge of #148819 - bjorn3:fix_fixme, r=jieyouxu
Zalathar Nov 12, 2025
3906623
Rollup merge of #148830 - RalfJung:miri, r=RalfJung
Zalathar Nov 12, 2025
9b7cfdf
Rollup merge of #148833 - clubby789:cargo-update-rustbook-11-11-25, r…
Zalathar Nov 12, 2025
0675923
Rollup merge of #148834 - Muscraft:fix-doctest-colors, r=fmease
Zalathar Nov 12, 2025
2443cfb
Rollup merge of #148841 - dtolnay:simdmustuse, r=calebzulawski
Zalathar Nov 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 4 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ dependencies = [
"serde_json",
"tempfile",
"termize",
"tikv-jemalloc-sys",
"toml 0.9.7",
"ui_test",
"walkdir",
Expand Down Expand Up @@ -4806,6 +4807,7 @@ dependencies = [
"stringdex",
"tempfile",
"threadpool",
"tikv-jemalloc-sys",
"tracing",
"tracing-subscriber",
"tracing-tree",
Expand Down Expand Up @@ -5537,9 +5539,9 @@ version = "0.1.0"

[[package]]
name = "tikv-jemalloc-sys"
version = "0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7"
version = "0.6.1+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd3c60906412afa9c2b5b5a48ca6a5abe5736aec9eb48ad05037a677e52e4e2d"
checksum = "cd8aa5b2ab86a2cefa406d889139c162cbb230092f7d1d7cbc1716405d852a3b"
dependencies = [
"cc",
"libc",
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ rustc_public_bridge = { path = "../rustc_public_bridge" }
# tidy-alphabetical-end

[dependencies.tikv-jemalloc-sys]
version = "0.6.0"
version = "0.6.1"
optional = true
features = ['unprefixed_malloc_on_supported_platforms']
features = ['override_allocator_on_supported_platforms']

[features]
# tidy-alphabetical-start
Expand Down
63 changes: 14 additions & 49 deletions compiler/rustc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,25 @@
// distribution. The obvious way to do this is with the `#[global_allocator]`
// mechanism. However, for complicated reasons (see
// https://github.com/rust-lang/rust/pull/81782#issuecomment-784438001 for some
// details) that mechanism doesn't work here. Also, we must use a consistent
// allocator across the rustc <-> llvm boundary, and `#[global_allocator]`
// wouldn't provide that.
// details) that mechanism doesn't work here. Also, we'd like to use a
// consistent allocator across the rustc <-> llvm boundary, and
// `#[global_allocator]` wouldn't provide that.
//
// Instead, we use a lower-level mechanism. rustc is linked with jemalloc in a
// way such that jemalloc's implementation of `malloc`, `free`, etc., override
// the libc allocator's implementation. This means that Rust's `System`
// allocator, which calls `libc::malloc()` et al., is actually calling into
// jemalloc.
// Instead, we use a lower-level mechanism, namely the
// `"override_allocator_on_supported_platforms"` Cargo feature of jemalloc-sys.
//
// This makes jemalloc-sys override the libc/system allocator's implementation
// of `malloc`, `free`, etc.. This means that Rust's `System` allocator, which
// calls `libc::malloc()` et al., is actually calling into jemalloc.
//
// A consequence of not using `GlobalAlloc` (and the `tikv-jemallocator` crate
// provides an impl of that trait, which is called `Jemalloc`) is that we
// cannot use the sized deallocation APIs (`sdallocx`) that jemalloc provides.
// It's unclear how much performance is lost because of this.
//
// As for the symbol overrides in `main` below: we're pulling in a static copy
// of jemalloc. We need to actually reference its symbols for it to get linked.
// The two crates we link to here, `std` and `rustc_driver`, are both dynamic
// libraries. So we must reference jemalloc symbols one way or another, because
// this file is the only object code in the rustc executable.
// NOTE: Even though Cargo passes `--extern` with `tikv_jemalloc_sys`, we still need to `use` the
// crate for the compiler to see the `#[used]`, see https://github.com/rust-lang/rust/issues/64402.
// This is similarly required if we used a crate with `#[global_allocator]`.
//
// NOTE: if you are reading this comment because you want to set a custom `global_allocator` for
// benchmarking, consider using the benchmarks in the `rustc-perf` collector suite instead:
Expand All @@ -36,43 +35,9 @@
// to compare their performance, see
// https://github.com/rust-lang/rust/commit/b90cfc887c31c3e7a9e6d462e2464db1fe506175#diff-43914724af6e464c1da2171e4a9b6c7e607d5bc1203fa95c0ab85be4122605ef
// for an example of how to do so.
#[cfg(feature = "jemalloc")]
use tikv_jemalloc_sys as _;

fn main() {
// See the comment at the top of this file for an explanation of this.
#[cfg(feature = "jemalloc")]
{
use std::os::raw::{c_int, c_void};

use tikv_jemalloc_sys as jemalloc_sys;

#[used]
static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::calloc;
#[used]
static _F2: unsafe extern "C" fn(*mut *mut c_void, usize, usize) -> c_int =
jemalloc_sys::posix_memalign;
#[used]
static _F3: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::aligned_alloc;
#[used]
static _F4: unsafe extern "C" fn(usize) -> *mut c_void = jemalloc_sys::malloc;
#[used]
static _F5: unsafe extern "C" fn(*mut c_void, usize) -> *mut c_void = jemalloc_sys::realloc;
#[used]
static _F6: unsafe extern "C" fn(*mut c_void) = jemalloc_sys::free;

// On OSX, jemalloc doesn't directly override malloc/free, but instead
// registers itself with the allocator's zone APIs in a ctor. However,
// the linker doesn't seem to consider ctors as "used" when statically
// linking, so we need to explicitly depend on the function.
#[cfg(target_os = "macos")]
{
unsafe extern "C" {
fn _rjem_je_zone_register();
}

#[used]
static _F7: unsafe extern "C" fn() = _rjem_je_zone_register;
}
}

rustc_driver::main()
}
17 changes: 11 additions & 6 deletions compiler/rustc_ast/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,9 @@ macro_rules! common_visitor_and_walkers {
fn visit_fn(
&mut self,
fk: FnKind<$($lt)? $(${ignore($mut)} '_)?>,
_: &AttrVec,
_: Span,
_: NodeId
_: NodeId,
) -> Self::Result {
walk_fn(self, fk)
}
Expand Down Expand Up @@ -740,6 +741,7 @@ macro_rules! common_visitor_and_walkers {
type Ctxt;
fn walk<$($lt,)? V: $Visitor$(<$lt>)?>(
&$($lt)? $($mut)? self,
attrs: &AttrVec,
span: Span,
id: NodeId,
visibility: &$($lt)? $($mut)? Visibility,
Expand Down Expand Up @@ -773,7 +775,7 @@ macro_rules! common_visitor_and_walkers {
) -> V::Result {
let Item { attrs, id, kind, vis, span, tokens: _ } = item;
visit_visitable!($($mut)? visitor, id, attrs, vis);
try_visit!(kind.walk(*span, *id, vis, ctxt, visitor));
try_visit!(kind.walk(attrs, *span, *id, vis, ctxt, visitor));
visit_visitable!($($mut)? visitor, span);
V::Result::output()
}
Expand All @@ -799,6 +801,7 @@ macro_rules! common_visitor_and_walkers {
type Ctxt = ();
fn walk<$($lt,)? V: $Visitor$(<$lt>)?>(
&$($lt)? $($mut)? self,
attrs: &AttrVec,
span: Span,
id: NodeId,
visibility: &$($lt)? $($mut)? Visibility,
Expand All @@ -808,7 +811,7 @@ macro_rules! common_visitor_and_walkers {
match self {
ItemKind::Fn(func) => {
let kind = FnKind::Fn(FnCtxt::Free, visibility, &$($mut)? *func);
try_visit!(vis.visit_fn(kind, span, id));
try_visit!(vis.visit_fn(kind, attrs, span, id));
}
ItemKind::ExternCrate(orig_name, ident) =>
visit_visitable!($($mut)? vis, orig_name, ident),
Expand Down Expand Up @@ -856,6 +859,7 @@ macro_rules! common_visitor_and_walkers {
type Ctxt = AssocCtxt;
fn walk<$($lt,)? V: $Visitor$(<$lt>)?>(
&$($lt)? $($mut)? self,
attrs: &AttrVec,
span: Span,
id: NodeId,
visibility: &$($lt)? $($mut)? Visibility,
Expand All @@ -867,7 +871,7 @@ macro_rules! common_visitor_and_walkers {
visit_visitable!($($mut)? vis, item),
AssocItemKind::Fn(func) => {
let kind = FnKind::Fn(FnCtxt::Assoc(ctxt), visibility, &$($mut)? *func);
try_visit!(vis.visit_fn(kind, span, id))
try_visit!(vis.visit_fn(kind, attrs, span, id))
}
AssocItemKind::Type(alias) =>
visit_visitable!($($mut)? vis, alias),
Expand All @@ -886,6 +890,7 @@ macro_rules! common_visitor_and_walkers {
type Ctxt = ();
fn walk<$($lt,)? V: $Visitor$(<$lt>)?>(
&$($lt)? $($mut)? self,
attrs: &AttrVec,
span: Span,
id: NodeId,
visibility: &$($lt)? $($mut)? Visibility,
Expand All @@ -897,7 +902,7 @@ macro_rules! common_visitor_and_walkers {
visit_visitable!($($mut)? vis, item),
ForeignItemKind::Fn(func) => {
let kind = FnKind::Fn(FnCtxt::Foreign, visibility, &$($mut)?*func);
try_visit!(vis.visit_fn(kind, span, id))
try_visit!(vis.visit_fn(kind, attrs, span, id))
}
ForeignItemKind::TyAlias(alias) =>
visit_visitable!($($mut)? vis, alias),
Expand Down Expand Up @@ -999,7 +1004,7 @@ macro_rules! common_visitor_and_walkers {
}) => {
visit_visitable!($($mut)? vis, constness, movability, capture_clause);
let kind = FnKind::Closure(binder, coroutine_kind, fn_decl, body);
try_visit!(vis.visit_fn(kind, *span, *id));
try_visit!(vis.visit_fn(kind, attrs, *span, *id));
visit_visitable!($($mut)? vis, fn_decl_span, fn_arg_span);
}
ExprKind::Block(block, opt_label) =>
Expand Down
10 changes: 8 additions & 2 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1771,8 +1771,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
let pat = self.lower_pat(pat);
let for_span =
self.mark_span_with_reason(DesugaringKind::ForLoop, self.lower_span(e.span), None);
let head_span = self.mark_span_with_reason(DesugaringKind::ForLoop, head.span, None);
let pat_span = self.mark_span_with_reason(DesugaringKind::ForLoop, pat.span, None);
let for_ctxt = for_span.ctxt();

// Try to point both the head and pat spans to their position in the for loop
// rather than inside a macro.
let head_span =
head.span.find_ancestor_in_same_ctxt(e.span).unwrap_or(head.span).with_ctxt(for_ctxt);
let pat_span =
pat.span.find_ancestor_in_same_ctxt(e.span).unwrap_or(pat.span).with_ctxt(for_ctxt);

let loop_hir_id = self.lower_node_id(e.id);
let label = self.lower_label(opt_label, e.id, loop_hir_id);
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_ast_passes/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ ast_passes_c_variadic_bad_extern = `...` is not supported for `extern "{$abi}"`
.label = `extern "{$abi}"` because of this
.help = only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
ast_passes_c_variadic_bad_naked_extern = `...` is not supported for `extern "{$abi}"` naked functions
.label = `extern "{$abi}"` because of this
.help = C-variadic function must have a compatible calling convention
ast_passes_c_variadic_must_be_unsafe =
functions with a C variable argument list must be unsafe
.suggestion = add the `unsafe` keyword to this definition
Expand Down
Loading
Loading