Merge ref '7a72c5459d' from rust-lang/rust

Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 7a72c5459d
Filtered ref: bd4cd7ec310d2634b0837ec149eac9bf0af82716
Upstream diff: 0b329f801a...7a72c5459d

This merge was created using https://github.com/rust-lang/josh-sync.
This commit is contained in:
The Miri Cronjob Bot 2025-11-14 05:01:17 +00:00
commit e66f1b0af4
169 changed files with 3689 additions and 1409 deletions

View file

@ -600,7 +600,6 @@ dependencies = [
"serde_json",
"tempfile",
"termize",
"tikv-jemalloc-sys",
"toml 0.9.7",
"ui_test",
"walkdir",
@ -1289,7 +1288,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad"
dependencies = [
"libc",
"windows-sys 0.52.0",
"windows-sys 0.60.2",
]
[[package]]
@ -2155,7 +2154,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667"
dependencies = [
"cfg-if",
"windows-targets 0.52.6",
"windows-targets 0.53.3",
]
[[package]]
@ -4807,7 +4806,6 @@ dependencies = [
"stringdex",
"tempfile",
"threadpool",
"tikv-jemalloc-sys",
"tracing",
"tracing-subscriber",
"tracing-tree",
@ -4907,7 +4905,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.52.0",
"windows-sys 0.61.2",
]
[[package]]
@ -5275,9 +5273,9 @@ dependencies = [
[[package]]
name = "stringdex"
version = "0.0.2"
version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18b3bd4f10d15ef859c40291769f0d85209de6b0f1c30713ff9cdf45ac43ea36"
checksum = "556a6126952cb2f5150057c98a77cc6c771027dea2825bf7fa03d3d638b0a4f8"
dependencies = [
"stacker",
]
@ -5539,9 +5537,9 @@ version = "0.1.0"
[[package]]
name = "tikv-jemalloc-sys"
version = "0.6.1+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7"
version = "0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd8aa5b2ab86a2cefa406d889139c162cbb230092f7d1d7cbc1716405d852a3b"
checksum = "cd3c60906412afa9c2b5b5a48ca6a5abe5736aec9eb48ad05037a677e52e4e2d"
dependencies = [
"cc",
"libc",

View file

@ -21,9 +21,9 @@ rustc_public_bridge = { path = "../rustc_public_bridge" }
# tidy-alphabetical-end
[dependencies.tikv-jemalloc-sys]
version = "0.6.1"
version = "0.6.0"
optional = true
features = ['override_allocator_on_supported_platforms']
features = ['unprefixed_malloc_on_supported_platforms']
[features]
# tidy-alphabetical-start

View file

@ -7,25 +7,26 @@
// 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'd like to 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 must use a consistent
// allocator across the rustc <-> llvm boundary, and `#[global_allocator]`
// wouldn't provide that.
//
// 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.
// 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.
//
// 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.
//
// 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]`.
// 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: 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:
@ -35,9 +36,43 @@
// 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()
}

View file

@ -13,7 +13,7 @@ use rustc_middle::span_bug;
use rustc_middle::ty::TyCtxt;
use rustc_session::errors::report_lit_error;
use rustc_span::source_map::{Spanned, respan};
use rustc_span::{DUMMY_SP, DesugaringKind, Ident, Span, Symbol, sym};
use rustc_span::{ByteSymbol, DUMMY_SP, DesugaringKind, Ident, Span, Symbol, sym};
use thin_vec::{ThinVec, thin_vec};
use visit::{Visitor, walk_expr};
@ -924,7 +924,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
arena_vec![self; new_unchecked, get_context],
),
};
self.arena.alloc(self.expr_unsafe(call))
self.arena.alloc(self.expr_unsafe(span, call))
};
// `::std::task::Poll::Ready(result) => break result`
@ -1832,7 +1832,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
arena_vec![self; iter],
));
// `unsafe { ... }`
let iter = self.arena.alloc(self.expr_unsafe(iter));
let iter = self.arena.alloc(self.expr_unsafe(head_span, iter));
let kind = self.make_lowered_await(head_span, iter, FutureKind::AsyncIterator);
self.arena.alloc(hir::Expr { hir_id: self.next_id(), kind, span: head_span })
}
@ -1887,7 +1887,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
arena_vec![self; iter],
));
// `unsafe { ... }`
let iter = self.arena.alloc(self.expr_unsafe(iter));
let iter = self.arena.alloc(self.expr_unsafe(head_span, iter));
let inner_match_expr = self.arena.alloc(self.expr_match(
for_span,
iter,
@ -2103,26 +2103,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
self.arena.alloc(self.expr(sp, hir::ExprKind::Tup(&[])))
}
fn expr_uint(&mut self, sp: Span, ty: ast::UintTy, value: u128) -> hir::Expr<'hir> {
let lit = hir::Lit {
span: self.lower_span(sp),
node: ast::LitKind::Int(value.into(), ast::LitIntType::Unsigned(ty)),
};
self.expr(sp, hir::ExprKind::Lit(lit))
}
pub(super) fn expr_usize(&mut self, sp: Span, value: usize) -> hir::Expr<'hir> {
self.expr_uint(sp, ast::UintTy::Usize, value as u128)
}
pub(super) fn expr_u32(&mut self, sp: Span, value: u32) -> hir::Expr<'hir> {
self.expr_uint(sp, ast::UintTy::U32, value as u128)
}
pub(super) fn expr_u16(&mut self, sp: Span, value: u16) -> hir::Expr<'hir> {
self.expr_uint(sp, ast::UintTy::U16, value as u128)
}
pub(super) fn expr_str(&mut self, sp: Span, value: Symbol) -> hir::Expr<'hir> {
let lit = hir::Lit {
span: self.lower_span(sp),
@ -2131,6 +2111,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
self.expr(sp, hir::ExprKind::Lit(lit))
}
pub(super) fn expr_byte_str(&mut self, sp: Span, value: ByteSymbol) -> hir::Expr<'hir> {
let lit = hir::Lit {
span: self.lower_span(sp),
node: ast::LitKind::ByteStr(value, ast::StrStyle::Cooked),
};
self.expr(sp, hir::ExprKind::Lit(lit))
}
pub(super) fn expr_call_mut(
&mut self,
span: Span,
@ -2262,9 +2250,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
self.expr(span, expr_path)
}
fn expr_unsafe(&mut self, expr: &'hir hir::Expr<'hir>) -> hir::Expr<'hir> {
pub(super) fn expr_unsafe(
&mut self,
span: Span,
expr: &'hir hir::Expr<'hir>,
) -> hir::Expr<'hir> {
let hir_id = self.next_id();
let span = expr.span;
self.expr(
span,
hir::ExprKind::Block(
@ -2302,15 +2293,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
self.arena.alloc(self.expr_block(b))
}
pub(super) fn expr_array_ref(
&mut self,
span: Span,
elements: &'hir [hir::Expr<'hir>],
) -> hir::Expr<'hir> {
let array = self.arena.alloc(self.expr(span, hir::ExprKind::Array(elements)));
self.expr_ref(span, array)
}
pub(super) fn expr_ref(&mut self, span: Span, expr: &'hir hir::Expr<'hir>) -> hir::Expr<'hir> {
self.expr(span, hir::ExprKind::AddrOf(hir::BorrowKind::Ref, hir::Mutability::Not, expr))
}

View file

@ -4,7 +4,7 @@ use rustc_ast::*;
use rustc_data_structures::fx::FxIndexMap;
use rustc_hir as hir;
use rustc_session::config::FmtDebug;
use rustc_span::{DesugaringKind, Ident, Span, Symbol, sym};
use rustc_span::{ByteSymbol, DesugaringKind, Ident, Span, Symbol, sym};
use super::LoweringContext;
@ -90,20 +90,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
let mut inlined_anything = false;
for i in 0..fmt.template.len() {
let FormatArgsPiece::Placeholder(placeholder) = &fmt.template[i] else { continue };
let Ok(arg_index) = placeholder.argument.index else { continue };
let mut literal = None;
if let FormatTrait::Display = placeholder.format_trait
if let FormatArgsPiece::Placeholder(placeholder) = &fmt.template[i]
&& let Ok(arg_index) = placeholder.argument.index
&& let FormatTrait::Display = placeholder.format_trait
&& placeholder.format_options == Default::default()
&& let arg = fmt.arguments.all_args()[arg_index].expr.peel_parens_and_refs()
&& let ExprKind::Lit(lit) = arg.kind
&& let Some(literal) = self.try_inline_lit(lit)
{
literal = self.try_inline_lit(lit);
}
if let Some(literal) = literal {
// Now we need to mutate the outer FormatArgs.
// If this is the first time, this clones the outer FormatArgs.
let fmt = fmt.to_mut();
@ -265,136 +259,21 @@ fn make_argument<'hir>(
ctx.expr_call_mut(sp, new_fn, std::slice::from_ref(arg))
}
/// Generate a hir expression for a format_args Count.
/// Get the value for a `width` or `precision` field.
///
/// Generates:
///
/// ```text
/// <core::fmt::rt::Count>::Is(…)
/// ```
///
/// or
///
/// ```text
/// <core::fmt::rt::Count>::Param(…)
/// ```
///
/// or
///
/// ```text
/// <core::fmt::rt::Count>::Implied
/// ```
fn make_count<'hir>(
ctx: &mut LoweringContext<'_, 'hir>,
sp: Span,
count: &Option<FormatCount>,
/// Returns the value and whether it is indirect (an indexed argument) or not.
fn make_count(
count: &FormatCount,
argmap: &mut FxIndexMap<(usize, ArgumentType), Option<Span>>,
) -> hir::Expr<'hir> {
) -> (bool, u16) {
match count {
Some(FormatCount::Literal(n)) => {
let count_is = ctx.arena.alloc(ctx.expr_lang_item_type_relative(
sp,
hir::LangItem::FormatCount,
sym::Is,
));
let value = ctx.arena.alloc_from_iter([ctx.expr_u16(sp, *n)]);
ctx.expr_call_mut(sp, count_is, value)
}
Some(FormatCount::Argument(arg)) => {
if let Ok(arg_index) = arg.index {
let (i, _) = argmap.insert_full((arg_index, ArgumentType::Usize), arg.span);
let count_param = ctx.arena.alloc(ctx.expr_lang_item_type_relative(
sp,
hir::LangItem::FormatCount,
sym::Param,
));
let value = ctx.arena.alloc_from_iter([ctx.expr_usize(sp, i)]);
ctx.expr_call_mut(sp, count_param, value)
} else {
ctx.expr(
sp,
hir::ExprKind::Err(
ctx.dcx().span_delayed_bug(sp, "lowered bad format_args count"),
),
)
}
}
None => ctx.expr_lang_item_type_relative(sp, hir::LangItem::FormatCount, sym::Implied),
}
}
/// Generate a hir expression for a format_args placeholder specification.
///
/// Generates
///
/// ```text
/// <core::fmt::rt::Placeholder {
/// position: …usize,
/// flags: …u32,
/// precision: <core::fmt::rt::Count::…>,
/// width: <core::fmt::rt::Count::…>,
/// }
/// ```
fn make_format_spec<'hir>(
ctx: &mut LoweringContext<'_, 'hir>,
sp: Span,
placeholder: &FormatPlaceholder,
argmap: &mut FxIndexMap<(usize, ArgumentType), Option<Span>>,
) -> hir::Expr<'hir> {
let position = match placeholder.argument.index {
Ok(arg_index) => {
let (i, _) = argmap.insert_full(
(arg_index, ArgumentType::Format(placeholder.format_trait)),
placeholder.span,
);
ctx.expr_usize(sp, i)
}
Err(_) => ctx.expr(
sp,
hir::ExprKind::Err(ctx.dcx().span_delayed_bug(sp, "lowered bad format_args count")),
FormatCount::Literal(n) => (false, *n),
FormatCount::Argument(arg) => (
true,
argmap.insert_full((arg.index.unwrap_or(usize::MAX), ArgumentType::Usize), arg.span).0
as u16,
),
};
let &FormatOptions {
ref width,
ref precision,
alignment,
fill,
sign,
alternate,
zero_pad,
debug_hex,
} = &placeholder.format_options;
let fill = fill.unwrap_or(' ');
// These need to match the constants in library/core/src/fmt/rt.rs.
let align = match alignment {
Some(FormatAlignment::Left) => 0,
Some(FormatAlignment::Right) => 1,
Some(FormatAlignment::Center) => 2,
None => 3,
};
// This needs to match the constants in library/core/src/fmt/rt.rs.
let flags: u32 = fill as u32
| ((sign == Some(FormatSign::Plus)) as u32) << 21
| ((sign == Some(FormatSign::Minus)) as u32) << 22
| (alternate as u32) << 23
| (zero_pad as u32) << 24
| ((debug_hex == Some(FormatDebugHex::Lower)) as u32) << 25
| ((debug_hex == Some(FormatDebugHex::Upper)) as u32) << 26
| (width.is_some() as u32) << 27
| (precision.is_some() as u32) << 28
| align << 29
| 1 << 31; // Highest bit always set.
let flags = ctx.expr_u32(sp, flags);
let precision = make_count(ctx, sp, precision, argmap);
let width = make_count(ctx, sp, width, argmap);
let position = ctx.expr_field(Ident::new(sym::position, sp), ctx.arena.alloc(position), sp);
let flags = ctx.expr_field(Ident::new(sym::flags, sp), ctx.arena.alloc(flags), sp);
let precision = ctx.expr_field(Ident::new(sym::precision, sp), ctx.arena.alloc(precision), sp);
let width = ctx.expr_field(Ident::new(sym::width, sp), ctx.arena.alloc(width), sp);
let placeholder =
ctx.arena.alloc(ctx.make_lang_item_qpath(hir::LangItem::FormatPlaceholder, sp, None));
let fields = ctx.arena.alloc_from_iter([position, flags, precision, width]);
ctx.expr(sp, hir::ExprKind::Struct(placeholder, fields, hir::StructTailExpr::None))
}
}
fn expand_format_args<'hir>(
@ -405,85 +284,152 @@ fn expand_format_args<'hir>(
) -> hir::ExprKind<'hir> {
let macsp = ctx.lower_span(macsp);
let mut incomplete_lit = String::new();
let lit_pieces =
ctx.arena.alloc_from_iter(fmt.template.iter().enumerate().filter_map(|(i, piece)| {
match piece {
&FormatArgsPiece::Literal(s) => {
// Coalesce adjacent literal pieces.
if let Some(FormatArgsPiece::Literal(_)) = fmt.template.get(i + 1) {
incomplete_lit.push_str(s.as_str());
None
} else if !incomplete_lit.is_empty() {
incomplete_lit.push_str(s.as_str());
let s = Symbol::intern(&incomplete_lit);
incomplete_lit.clear();
Some(ctx.expr_str(fmt.span, s))
} else {
Some(ctx.expr_str(fmt.span, s))
}
}
&FormatArgsPiece::Placeholder(_) => {
// Inject empty string before placeholders when not already preceded by a literal piece.
if i == 0 || matches!(fmt.template[i - 1], FormatArgsPiece::Placeholder(_)) {
Some(ctx.expr_str(fmt.span, sym::empty))
} else {
None
}
}
}
}));
let lit_pieces = ctx.expr_array_ref(fmt.span, lit_pieces);
// Whether we'll use the `Arguments::new_v1_formatted` form (true),
// or the `Arguments::new_v1` form (false).
let mut use_format_options = false;
// Create a list of all _unique_ (argument, format trait) combinations.
// E.g. "{0} {0:x} {0} {1}" -> [(0, Display), (0, LowerHex), (1, Display)]
//
// We use usize::MAX for arguments that don't exist, because that can never be a valid index
// into the arguments array.
let mut argmap = FxIndexMap::default();
for piece in &fmt.template {
let FormatArgsPiece::Placeholder(placeholder) = piece else { continue };
if placeholder.format_options != Default::default() {
// Can't use basic form if there's any formatting options.
use_format_options = true;
}
if let Ok(index) = placeholder.argument.index {
if argmap
.insert((index, ArgumentType::Format(placeholder.format_trait)), placeholder.span)
.is_some()
{
// Duplicate (argument, format trait) combination,
// which we'll only put once in the args array.
use_format_options = true;
let mut incomplete_lit = String::new();
let mut implicit_arg_index = 0;
let mut bytecode = Vec::new();
let template = if fmt.template.is_empty() {
// Treat empty templates as a single literal piece (with an empty string),
// so we produce `from_str("")` for those.
&[FormatArgsPiece::Literal(sym::empty)][..]
} else {
&fmt.template[..]
};
// See library/core/src/fmt/mod.rs for the format string encoding format.
for (i, piece) in template.iter().enumerate() {
match piece {
&FormatArgsPiece::Literal(sym) => {
// Coalesce adjacent literal pieces.
if let Some(FormatArgsPiece::Literal(_)) = template.get(i + 1) {
incomplete_lit.push_str(sym.as_str());
continue;
}
let mut s = if incomplete_lit.is_empty() {
sym.as_str()
} else {
incomplete_lit.push_str(sym.as_str());
&incomplete_lit
};
// If this is the last piece and was the only piece, that means
// there are no placeholders and the entire format string is just a literal.
//
// In that case, we can just use `from_str`.
if i + 1 == template.len() && bytecode.is_empty() {
// Generate:
// <core::fmt::Arguments>::from_str("meow")
let from_str = ctx.arena.alloc(ctx.expr_lang_item_type_relative(
macsp,
hir::LangItem::FormatArguments,
if allow_const { sym::from_str } else { sym::from_str_nonconst },
));
let sym = if incomplete_lit.is_empty() { sym } else { Symbol::intern(s) };
let s = ctx.expr_str(fmt.span, sym);
let args = ctx.arena.alloc_from_iter([s]);
return hir::ExprKind::Call(from_str, args);
}
// Encode the literal in chunks of up to u16::MAX bytes, split at utf-8 boundaries.
while !s.is_empty() {
let len = s.floor_char_boundary(usize::from(u16::MAX));
if len < 0x80 {
bytecode.push(len as u8);
} else {
bytecode.push(0x80);
bytecode.extend_from_slice(&(len as u16).to_le_bytes());
}
bytecode.extend(&s.as_bytes()[..len]);
s = &s[len..];
}
incomplete_lit.clear();
}
FormatArgsPiece::Placeholder(p) => {
// Push the start byte and remember its index so we can set the option bits later.
let i = bytecode.len();
bytecode.push(0xC0);
let position = argmap
.insert_full(
(
p.argument.index.unwrap_or(usize::MAX),
ArgumentType::Format(p.format_trait),
),
p.span,
)
.0 as u64;
// This needs to match the constants in library/core/src/fmt/mod.rs.
let o = &p.format_options;
let align = match o.alignment {
Some(FormatAlignment::Left) => 0,
Some(FormatAlignment::Right) => 1,
Some(FormatAlignment::Center) => 2,
None => 3,
};
let default_flags = 0x6000_0020;
let flags: u32 = o.fill.unwrap_or(' ') as u32
| ((o.sign == Some(FormatSign::Plus)) as u32) << 21
| ((o.sign == Some(FormatSign::Minus)) as u32) << 22
| (o.alternate as u32) << 23
| (o.zero_pad as u32) << 24
| ((o.debug_hex == Some(FormatDebugHex::Lower)) as u32) << 25
| ((o.debug_hex == Some(FormatDebugHex::Upper)) as u32) << 26
| (o.width.is_some() as u32) << 27
| (o.precision.is_some() as u32) << 28
| align << 29;
if flags != default_flags {
bytecode[i] |= 1;
bytecode.extend_from_slice(&flags.to_le_bytes());
if let Some(val) = &o.width {
let (indirect, val) = make_count(val, &mut argmap);
// Only encode if nonzero; zero is the default.
if indirect || val != 0 {
bytecode[i] |= 1 << 1 | (indirect as u8) << 4;
bytecode.extend_from_slice(&val.to_le_bytes());
}
}
if let Some(val) = &o.precision {
let (indirect, val) = make_count(val, &mut argmap);
// Only encode if nonzero; zero is the default.
if indirect || val != 0 {
bytecode[i] |= 1 << 2 | (indirect as u8) << 5;
bytecode.extend_from_slice(&val.to_le_bytes());
}
}
}
if implicit_arg_index != position {
bytecode[i] |= 1 << 3;
bytecode.extend_from_slice(&(position as u16).to_le_bytes());
}
implicit_arg_index = position + 1;
}
}
}
let format_options = use_format_options.then(|| {
// Generate:
// &[format_spec_0, format_spec_1, format_spec_2]
let elements = ctx.arena.alloc_from_iter(fmt.template.iter().filter_map(|piece| {
let FormatArgsPiece::Placeholder(placeholder) = piece else { return None };
Some(make_format_spec(ctx, macsp, placeholder, &mut argmap))
}));
ctx.expr_array_ref(macsp, elements)
});
assert!(incomplete_lit.is_empty());
// Zero terminator.
bytecode.push(0);
// Ensure all argument indexes actually fit in 16 bits, as we truncated them to 16 bits before.
if argmap.len() > u16::MAX as usize {
ctx.dcx().span_err(macsp, "too many format arguments");
}
let arguments = fmt.arguments.all_args();
if allow_const && arguments.is_empty() && argmap.is_empty() {
// Generate:
// <core::fmt::Arguments>::new_const(lit_pieces)
let new = ctx.arena.alloc(ctx.expr_lang_item_type_relative(
macsp,
hir::LangItem::FormatArguments,
sym::new_const,
));
let new_args = ctx.arena.alloc_from_iter([lit_pieces]);
return hir::ExprKind::Call(new, new_args);
}
let (let_statements, args) = if arguments.is_empty() {
// Generate:
// []
@ -512,22 +458,30 @@ fn expand_format_args<'hir>(
// ];
let args = ctx.arena.alloc_from_iter(argmap.iter().map(
|(&(arg_index, ty), &placeholder_span)| {
let arg = &arguments[arg_index];
let placeholder_span =
placeholder_span.unwrap_or(arg.expr.span).with_ctxt(macsp.ctxt());
let arg_span = match arg.kind {
FormatArgumentKind::Captured(_) => placeholder_span,
_ => arg.expr.span.with_ctxt(macsp.ctxt()),
};
let args_ident_expr = ctx.expr_ident(macsp, args_ident, args_hir_id);
let arg = ctx.arena.alloc(ctx.expr(
arg_span,
hir::ExprKind::Field(
args_ident_expr,
Ident::new(sym::integer(arg_index), macsp),
),
));
make_argument(ctx, placeholder_span, arg, ty)
if let Some(arg) = arguments.get(arg_index) {
let placeholder_span =
placeholder_span.unwrap_or(arg.expr.span).with_ctxt(macsp.ctxt());
let arg_span = match arg.kind {
FormatArgumentKind::Captured(_) => placeholder_span,
_ => arg.expr.span.with_ctxt(macsp.ctxt()),
};
let args_ident_expr = ctx.expr_ident(macsp, args_ident, args_hir_id);
let arg = ctx.arena.alloc(ctx.expr(
arg_span,
hir::ExprKind::Field(
args_ident_expr,
Ident::new(sym::integer(arg_index), macsp),
),
));
make_argument(ctx, placeholder_span, arg, ty)
} else {
ctx.expr(
macsp,
hir::ExprKind::Err(
ctx.dcx().span_delayed_bug(macsp, "missing format_args argument"),
),
)
}
},
));
let args = ctx.arena.alloc(ctx.expr(macsp, hir::ExprKind::Array(args)));
@ -540,58 +494,38 @@ fn expand_format_args<'hir>(
};
// Generate:
// &args
let args = ctx.expr_ref(macsp, args);
let call = if let Some(format_options) = format_options {
// Generate:
// unsafe {
// <core::fmt::Arguments>::new_v1_formatted(
// lit_pieces,
// args,
// format_options,
// )
// }
let new_v1_formatted = ctx.arena.alloc(ctx.expr_lang_item_type_relative(
// unsafe {
// <core::fmt::Arguments>::new(b"…", &args)
// }
let template = ctx.expr_byte_str(macsp, ByteSymbol::intern(&bytecode));
let call = {
let new = ctx.arena.alloc(ctx.expr_lang_item_type_relative(
macsp,
hir::LangItem::FormatArguments,
sym::new_v1_formatted,
sym::new,
));
let args = ctx.arena.alloc_from_iter([lit_pieces, args, format_options]);
let call = ctx.expr_call(macsp, new_v1_formatted, args);
let hir_id = ctx.next_id();
hir::ExprKind::Block(
ctx.arena.alloc(hir::Block {
stmts: &[],
expr: Some(call),
hir_id,
rules: hir::BlockCheckMode::UnsafeBlock(hir::UnsafeSource::CompilerGenerated),
span: macsp,
targeted_by_break: false,
}),
None,
)
} else {
// Generate:
// <core::fmt::Arguments>::new_v1(
// lit_pieces,
// args,
// )
let new_v1 = ctx.arena.alloc(ctx.expr_lang_item_type_relative(
macsp,
hir::LangItem::FormatArguments,
sym::new_v1,
));
let new_args = ctx.arena.alloc_from_iter([lit_pieces, args]);
hir::ExprKind::Call(new_v1, new_args)
let args = ctx.expr_ref(macsp, args);
let new_args = ctx.arena.alloc_from_iter([template, args]);
ctx.expr_call(macsp, new, new_args)
};
let call = hir::ExprKind::Block(
ctx.arena.alloc(hir::Block {
stmts: &[],
expr: Some(call),
hir_id: ctx.next_id(),
rules: hir::BlockCheckMode::UnsafeBlock(hir::UnsafeSource::CompilerGenerated),
span: macsp,
targeted_by_break: false,
}),
None,
);
if !let_statements.is_empty() {
// Generate:
// {
// super let …
// super let …
// <core::fmt::Arguments>::new_…(…)
// <core::fmt::Arguments>::new(…)
// }
let call = ctx.arena.alloc(ctx.expr(macsp, call));
let block = ctx.block_all(macsp, ctx.arena.alloc_from_iter(let_statements), Some(call));

View file

@ -690,6 +690,17 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
);
diag.span_label(*span, format!("`{fr_name}` escapes the {escapes_from} body here"));
} else {
diag.span_label(
*span,
format!("a temporary borrow escapes the {escapes_from} body here"),
);
if let Some((Some(outlived_name), _)) = outlived_fr_name_and_span {
diag.help(format!(
"`{outlived_name}` is declared outside the {escapes_from}, \
so any data borrowed inside the {escapes_from} cannot be stored into it"
));
}
}
// Only show an extra note if we can find an 'error region' for both of the region

View file

@ -62,7 +62,7 @@ jobs:
- name: Build
run: |
./y.sh prepare --only-libcore
EMBED_LTO_BITCODE=1 ./y.sh build --sysroot --release --release-sysroot
./y.sh build --sysroot --release --release-sysroot
./y.sh test --cargo-tests
./y.sh clean all
@ -72,19 +72,14 @@ jobs:
git config --global user.name "User"
./y.sh prepare
- name: Add more failing tests because of undefined symbol errors (FIXME)
run: cat tests/failing-lto-tests.txt >> tests/failing-ui-tests.txt
- name: Run tests
run: |
# FIXME(antoyo): we cannot enable LTO for stdarch tests currently because of some failing LTO tests using proc-macros.
# FIXME(antoyo): this should probably not be needed since we embed the LTO bitcode.
printf '[profile.release]\nlto = "fat"\n' >> build/build_sysroot/sysroot_src/library/Cargo.toml
EMBED_LTO_BITCODE=1 ./y.sh test --release --clean --release-sysroot --build-sysroot --keep-lto-tests ${{ matrix.commands }}
CG_RUSTFLAGS="-Cembed-bitcode=yes" ./y.sh test --release --clean --release-sysroot --build-sysroot --keep-lto-tests ${{ matrix.commands }}
- name: Run y.sh cargo build
- name: LTO test
run: |
EMBED_LTO_BITCODE=1 CHANNEL="release" ./y.sh cargo build --release --manifest-path tests/hello-world/Cargo.toml
CHANNEL="release" ./y.sh cargo build --release --manifest-path tests/hello-world/Cargo.toml
call_found=$(objdump -dj .text tests/hello-world/target/release/hello_world | grep -c "call .*mylib.*my_func" ) ||:
if [ $call_found -gt 0 ]; then
echo "ERROR: call my_func found in asm"
@ -92,6 +87,21 @@ jobs:
exit 1
fi
- name: Cross-language LTO test
run: |
pushd tests/cross_lang_lto
gcc -c -flto add.c -masm=intel -fPIC -O3
ar rcs libadd.a add.o
popd
CHANNEL="release" CG_RUSTFLAGS="-L native=. -Clinker-plugin-lto -Clinker=gcc" ./y.sh cargo build --release --manifest-path tests/cross_lang_lto/Cargo.toml
call_found=$(objdump -dj .text tests/cross_lang_lto/target/release/cross_lang_lto | grep -c "call .*my_add" ) ||:
if [ $call_found -gt 0 ]; then
echo "ERROR: call my_add found in asm"
echo "Test is done with cross-language LTO enabled, hence inlining should occur across object files"
exit 1
fi
# Summary job for the merge queue.
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
success_release:

View file

@ -41,7 +41,7 @@ jobs:
# TODO: remove when we have binutils version 2.43 in the repo.
- name: Install more recent binutils
run: |
echo "deb http://archive.ubuntu.com/ubuntu oracular main universe" | sudo tee /etc/apt/sources.list.d/oracular-copies.list
echo "deb http://archive.ubuntu.com/ubuntu plucky main universe" | sudo tee /etc/apt/sources.list.d/plucky-copies.list
sudo apt-get update
sudo apt-get install binutils

View file

@ -56,18 +56,18 @@ dependencies = [
[[package]]
name = "gccjit"
version = "2.9.0"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a0e310ef75f396cd11b2443b353d55376656ca92c13cba36f92b7aff346ac1a"
checksum = "60362e038e71e4bdc1a5b23fb45e1aba587b5947fe0db58f4871d95608f89eca"
dependencies = [
"gccjit_sys",
]
[[package]]
name = "gccjit_sys"
version = "0.8.2"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95ed7572b30cd32430294dde6fb70822d58e67c6846a548647e8739776a0125b"
checksum = "ddd542c8414e122217551c6af6b7d33acf51a227aee85276f218c087525e01bb"
dependencies = [
"libc",
]

View file

@ -24,7 +24,7 @@ default = ["master"]
[dependencies]
object = { version = "0.37.0", default-features = false, features = ["std", "read"] }
tempfile = "3.20"
gccjit = "2.8"
gccjit = "2.10"
#gccjit = { git = "https://github.com/rust-lang/gccjit.rs" }
# Local copy.

View file

@ -70,11 +70,17 @@ $ ../gcc/configure \
$ make -j4 # You can replace `4` with another number depending on how many cores you have.
```
If you want to run libgccjit tests, you will need to also enable the C++ language in the `configure`:
If you want to run libgccjit tests, you will need to
* Enable the C++ language in the `configure` step:
```bash
--enable-languages=jit,c++
```
* Install [dejagnu](https://www.gnu.org/software/dejagnu/#downloading) to run the tests:
```bash
$ sudo apt install dejagnu
```
Then to run libgccjit tests:
@ -135,16 +141,6 @@ $ CHANNEL="release" $CG_GCCJIT_DIR/y.sh cargo run
If you compiled cg_gccjit in debug mode (aka you didn't pass `--release` to `./y.sh test`) you should use `CHANNEL="debug"` instead or omit `CHANNEL="release"` completely.
### LTO
To use LTO, you need to set the variable `EMBED_LTO_BITCODE=1` in addition to setting `lto = "fat"` in the `Cargo.toml`.
Failing to set `EMBED_LTO_BITCODE` will give you the following error:
```
error: failed to copy bitcode to object file: No such file or directory (os error 2)
```
### Rustc
If you want to run `rustc` directly, you can do so with:

View file

@ -149,6 +149,9 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu
// Copy files to sysroot
let sysroot_path = start_dir.join(format!("sysroot/lib/rustlib/{}/lib/", config.target_triple));
// To avoid errors like "multiple candidates for `rmeta` dependency `core` found", we clean the
// sysroot directory before copying the sysroot build artifacts.
let _ = fs::remove_dir_all(&sysroot_path);
create_dir(&sysroot_path)?;
let mut copier = |dir_to_copy: &Path| {
// FIXME: should not use shell command!

View file

@ -69,8 +69,13 @@ fn clean_all() -> Result<(), String> {
}
fn clean_ui_tests() -> Result<(), String> {
let path = Path::new(crate::BUILD_DIR).join("rust/build/x86_64-unknown-linux-gnu/test/ui/");
run_command(&[&"find", &path, &"-name", &"stamp", &"-delete"], None)?;
let directories = ["run-make", "run-make-cargo", "ui"];
for directory in directories {
let path = Path::new(crate::BUILD_DIR)
.join("rust/build/x86_64-unknown-linux-gnu/test/")
.join(directory);
run_command(&[&"find", &path, &"-name", &"stamp", &"-delete"], None)?;
}
Ok(())
}

View file

@ -1,5 +1,7 @@
use std::ffi::OsStr;
use std::fs;
use std::path::{Path, PathBuf};
use std::process::Output;
use crate::rustc_info::get_rustc_path;
use crate::utils::{
@ -7,6 +9,41 @@ use crate::utils::{
run_command_with_output, walk_dir,
};
// This is needed on systems where nothing is configured.
// git really needs something here, or it will fail.
// Even using --author is not enough.
const GIT_CMD: [&dyn AsRef<OsStr>; 9] = [
&"git",
&"-c",
&"user.name=None",
&"-c",
&"user.email=none@example.com",
&"-c",
&"core.autocrlf=false",
&"-c",
&"commit.gpgSign=false",
];
fn run_git_command(
command: &dyn AsRef<OsStr>,
input: &[&dyn AsRef<OsStr>],
cwd: Option<&Path>,
) -> Result<Output, String> {
let git_cmd =
&GIT_CMD.into_iter().chain([command]).chain(input.iter().cloned()).collect::<Vec<_>>()[..];
run_command(git_cmd, cwd)
}
fn run_git_command_with_output(
command: &dyn AsRef<OsStr>,
input: &[&dyn AsRef<OsStr>],
cwd: Option<&Path>,
) -> Result<(), String> {
let git_cmd =
&GIT_CMD.into_iter().chain([command]).chain(input.iter().cloned()).collect::<Vec<_>>()[..];
run_command_with_output(git_cmd, cwd)
}
fn prepare_libcore(
sysroot_path: &Path,
libgccjit12_patches: bool,
@ -55,19 +92,12 @@ fn prepare_libcore(
run_command(&[&"cp", &"-r", &rustlib_dir.join("library"), &sysroot_dir], None)?;
println!("[GIT] init (cwd): `{}`", sysroot_dir.display());
run_command(&[&"git", &"init"], Some(&sysroot_dir))?;
run_git_command(&"init", &[], Some(&sysroot_dir))?;
println!("[GIT] add (cwd): `{}`", sysroot_dir.display());
run_command(&[&"git", &"add", &"."], Some(&sysroot_dir))?;
run_git_command(&"add", &[&"."], Some(&sysroot_dir))?;
println!("[GIT] commit (cwd): `{}`", sysroot_dir.display());
// This is needed on systems where nothing is configured.
// git really needs something here, or it will fail.
// Even using --author is not enough.
run_command(&[&"git", &"config", &"user.email", &"none@example.com"], Some(&sysroot_dir))?;
run_command(&[&"git", &"config", &"user.name", &"None"], Some(&sysroot_dir))?;
run_command(&[&"git", &"config", &"core.autocrlf", &"false"], Some(&sysroot_dir))?;
run_command(&[&"git", &"config", &"commit.gpgSign", &"false"], Some(&sysroot_dir))?;
run_command(&[&"git", &"commit", &"-m", &"Initial commit", &"-q"], Some(&sysroot_dir))?;
run_git_command(&"commit", &[&"-m", &"Initial commit", &"-q"], Some(&sysroot_dir))?;
let mut patches = Vec::new();
walk_dir(
@ -105,10 +135,11 @@ fn prepare_libcore(
for file_path in patches {
println!("[GIT] apply `{}`", file_path.display());
let path = Path::new("../../..").join(file_path);
run_command_with_output(&[&"git", &"apply", &path], Some(&sysroot_dir))?;
run_command_with_output(&[&"git", &"add", &"-A"], Some(&sysroot_dir))?;
run_command_with_output(
&[&"git", &"commit", &"--no-gpg-sign", &"-m", &format!("Patch {}", path.display())],
run_git_command_with_output(&"apply", &[&path], Some(&sysroot_dir))?;
run_git_command_with_output(&"add", &[&"-A"], Some(&sysroot_dir))?;
run_git_command_with_output(
&"commit",
&[&"-m", &format!("Patch {}", path.display())],
Some(&sysroot_dir),
)?;
}
@ -124,10 +155,11 @@ fn prepare_rand() -> Result<(), String> {
let rand_dir = Path::new("build/rand");
println!("[GIT] apply `{file_path}`");
let path = Path::new("../..").join(file_path);
run_command_with_output(&[&"git", &"apply", &path], Some(rand_dir))?;
run_command_with_output(&[&"git", &"add", &"-A"], Some(rand_dir))?;
run_command_with_output(
&[&"git", &"commit", &"--no-gpg-sign", &"-m", &format!("Patch {}", path.display())],
run_git_command_with_output(&"apply", &[&path], Some(rand_dir))?;
run_git_command_with_output(&"add", &[&"-A"], Some(rand_dir))?;
run_git_command_with_output(
&"commit",
&[&"-m", &format!("Patch {}", path.display())],
Some(rand_dir),
)?;
@ -154,8 +186,8 @@ where
println!("`{}` has already been cloned", clone_result.repo_name);
}
let repo_path = Path::new(crate::BUILD_DIR).join(&clone_result.repo_name);
run_command(&[&"git", &"checkout", &"--", &"."], Some(&repo_path))?;
run_command(&[&"git", &"checkout", &checkout_commit], Some(&repo_path))?;
run_git_command(&"checkout", &[&"--", &"."], Some(&repo_path))?;
run_git_command(&"checkout", &[&checkout_commit], Some(&repo_path))?;
if let Some(extra) = extra {
extra(&repo_path)?;
}

View file

@ -910,6 +910,7 @@ fn test_rustc_inner<F>(
prepare_files_callback: F,
run_error_pattern_test: bool,
test_type: &str,
run_ignored_tests: bool,
) -> Result<(), String>
where
F: Fn(&Path) -> Result<bool, String>,
@ -944,17 +945,7 @@ where
rust_path.join("tests/ui"),
&mut |dir| {
let dir_name = dir.file_name().and_then(|name| name.to_str()).unwrap_or("");
if [
"abi",
"extern",
"unsized-locals",
"proc-macro",
"threads-sendsync",
"borrowck",
"test-attrs",
]
.contains(&dir_name)
{
if ["abi", "extern", "proc-macro", "threads-sendsync"].contains(&dir_name) {
remove_dir_all(dir).map_err(|error| {
format!("Failed to remove folder `{}`: {:?}", dir.display(), error)
})?;
@ -1061,30 +1052,34 @@ where
env.get_mut("RUSTFLAGS").unwrap().clear();
run_command_with_output_and_env(
&[
&"./x.py",
&"test",
&"--run",
&"always",
&"--stage",
&"0",
&"--set",
&"build.compiletest-allow-stage0=true",
&format!("tests/{test_type}"),
&"--compiletest-rustc-args",
&rustc_args,
],
Some(&rust_path),
Some(&env),
)?;
let test_dir = format!("tests/{test_type}");
let mut command: Vec<&dyn AsRef<OsStr>> = vec![
&"./x.py",
&"test",
&"--run",
&"always",
&"--stage",
&"0",
&"--set",
&"build.compiletest-allow-stage0=true",
&test_dir,
&"--compiletest-rustc-args",
&rustc_args,
];
if run_ignored_tests {
command.push(&"--");
command.push(&"--ignored");
}
run_command_with_output_and_env(&command, Some(&rust_path), Some(&env))?;
Ok(())
}
fn test_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
test_rustc_inner(env, args, |_| Ok(false), false, "run-make")?;
test_rustc_inner(env, args, |_| Ok(false), false, "run-make-cargo")?;
test_rustc_inner(env, args, |_| Ok(false), false, "ui")
test_rustc_inner(env, args, |_| Ok(false), false, "run-make", false)?;
test_rustc_inner(env, args, |_| Ok(false), false, "run-make-cargo", false)?;
test_rustc_inner(env, args, |_| Ok(false), false, "ui", false)
}
fn test_failing_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
@ -1094,6 +1089,7 @@ fn test_failing_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
retain_files_callback("tests/failing-run-make-tests.txt", "run-make"),
false,
"run-make",
true,
);
let run_make_cargo_result = test_rustc_inner(
@ -1102,6 +1098,7 @@ fn test_failing_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
retain_files_callback("tests/failing-run-make-tests.txt", "run-make-cargo"),
false,
"run-make",
true,
);
let ui_result = test_rustc_inner(
@ -1110,6 +1107,7 @@ fn test_failing_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
retain_files_callback("tests/failing-ui-tests.txt", "ui"),
false,
"ui",
true,
);
run_make_result.and(run_make_cargo_result).and(ui_result)
@ -1122,6 +1120,7 @@ fn test_successful_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
remove_files_callback("tests/failing-ui-tests.txt", "ui"),
false,
"ui",
false,
)?;
test_rustc_inner(
env,
@ -1129,6 +1128,7 @@ fn test_successful_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
remove_files_callback("tests/failing-run-make-tests.txt", "run-make"),
false,
"run-make",
false,
)?;
test_rustc_inner(
env,
@ -1136,6 +1136,7 @@ fn test_successful_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
remove_files_callback("tests/failing-run-make-tests.txt", "run-make-cargo"),
false,
"run-make-cargo",
false,
)
}
@ -1146,6 +1147,7 @@ fn test_failing_ui_pattern_tests(env: &Env, args: &TestArg) -> Result<(), String
remove_files_callback("tests/failing-ice-tests.txt", "ui"),
true,
"ui",
false,
)
}

View file

@ -112,8 +112,7 @@ pub fn run_command_with_output(
cwd: Option<&Path>,
) -> Result<(), String> {
let exit_status = exec_command(input, cwd, None)?;
check_exit_status(input, cwd, exit_status, None, true)?;
Ok(())
check_exit_status(input, cwd, exit_status, None, true)
}
pub fn run_command_with_output_and_env(
@ -122,8 +121,7 @@ pub fn run_command_with_output_and_env(
env: Option<&HashMap<String, String>>,
) -> Result<(), String> {
let exit_status = exec_command(input, cwd, env)?;
check_exit_status(input, cwd, exit_status, None, true)?;
Ok(())
check_exit_status(input, cwd, exit_status, None, true)
}
#[cfg(not(unix))]
@ -133,8 +131,7 @@ pub fn run_command_with_output_and_env_no_err(
env: Option<&HashMap<String, String>>,
) -> Result<(), String> {
let exit_status = exec_command(input, cwd, env)?;
check_exit_status(input, cwd, exit_status, None, false)?;
Ok(())
check_exit_status(input, cwd, exit_status, None, false)
}
pub fn cargo_install(to_install: &str) -> Result<(), String> {

View file

@ -603,7 +603,7 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Box<U, A>> fo
impl<T> Box<T> {
pub fn new(val: T) -> Box<T> {
unsafe {
let size = intrinsics::size_of::<T>();
let size = size_of::<T>();
let ptr = libc::malloc(size);
intrinsics::copy(&val as *const T as *const u8, ptr, size);
Box(Unique { pointer: NonNull(ptr as *const T), _marker: PhantomData }, Global)
@ -657,11 +657,11 @@ pub mod intrinsics {
#[rustc_intrinsic]
pub fn abort() -> !;
#[rustc_intrinsic]
pub fn size_of<T>() -> usize;
pub const fn size_of<T>() -> usize;
#[rustc_intrinsic]
pub unsafe fn size_of_val<T: ?::Sized>(val: *const T) -> usize;
#[rustc_intrinsic]
pub fn align_of<T>() -> usize;
pub const fn align_of<T>() -> usize;
#[rustc_intrinsic]
pub unsafe fn align_of_val<T: ?::Sized>(val: *const T) -> usize;
#[rustc_intrinsic]
@ -671,7 +671,7 @@ pub mod intrinsics {
#[rustc_intrinsic]
pub unsafe fn ctlz_nonzero<T>(x: T) -> u32;
#[rustc_intrinsic]
pub fn needs_drop<T: ?::Sized>() -> bool;
pub const fn needs_drop<T: ?::Sized>() -> bool;
#[rustc_intrinsic]
pub fn bitreverse<T>(x: T) -> T;
#[rustc_intrinsic]
@ -699,6 +699,24 @@ pub mod libc {
}
}
pub const fn size_of<T>() -> usize {
<T as SizedTypeProperties>::SIZE
}
pub const fn align_of<T>() -> usize {
<T as SizedTypeProperties>::ALIGN
}
trait SizedTypeProperties: Sized {
#[lang = "mem_size_const"]
const SIZE: usize = intrinsics::size_of::<Self>();
#[lang = "mem_align_const"]
const ALIGN: usize = intrinsics::align_of::<Self>();
}
impl<T> SizedTypeProperties for T {}
#[lang = "index"]
pub trait Index<Idx: ?Sized> {
type Output: ?Sized;

View file

@ -90,8 +90,8 @@ fn start<T: Termination + 'static>(
) -> isize {
if argc == 3 {
unsafe { puts(*argv); }
unsafe { puts(*((argv as usize + intrinsics::size_of::<*const u8>()) as *const *const u8)); }
unsafe { puts(*((argv as usize + 2 * intrinsics::size_of::<*const u8>()) as *const *const u8)); }
unsafe { puts(*((argv as usize + size_of::<*const u8>()) as *const *const u8)); }
unsafe { puts(*((argv as usize + 2 * size_of::<*const u8>()) as *const *const u8)); }
}
main().report();
@ -154,7 +154,7 @@ fn main() {
let slice = &[0, 1] as &[i32];
let slice_ptr = slice as *const [i32] as *const i32;
let align = intrinsics::align_of::<*const i32>();
let align = align_of::<*const i32>();
assert_eq!(slice_ptr as usize % align, 0);
//return;
@ -195,11 +195,9 @@ fn main() {
assert_eq!(intrinsics::size_of_val(a) as u8, 8);
assert_eq!(intrinsics::size_of_val(&0u32) as u8, 4);
assert_eq!(intrinsics::align_of::<u16>() as u8, 2);
assert_eq!(intrinsics::align_of_val(&a) as u8, intrinsics::align_of::<&str>() as u8);
assert_eq!(align_of::<u16>() as u8, 2);
assert_eq!(intrinsics::align_of_val(&a) as u8, align_of::<&str>() as u8);
/*
* TODO: re-enable in the next sync.
let u8_needs_drop = const { intrinsics::needs_drop::<u8>() };
assert!(!u8_needs_drop);
let slice_needs_drop = const { intrinsics::needs_drop::<[u8]>() };
@ -208,7 +206,6 @@ fn main() {
assert!(noisy_drop);
let noisy_unsized_drop = const { intrinsics::needs_drop::<NoisyDropUnsized>() };
assert!(noisy_unsized_drop);
*/
Unique {
pointer: 0 as *const &str,

View file

@ -1 +1 @@
4e995bd73c4490edfe5080ec6014d63aa9abed5f
28b84db392ac0a572f1a2a2a1317aa5f2bc742cb

View file

@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2025-08-25"
channel = "nightly-2025-11-04"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

View file

@ -90,7 +90,7 @@ impl GccType for Reg {
64 => cx.type_f64(),
_ => bug!("unsupported float: {:?}", self),
},
RegKind::Vector => unimplemented!(), //cx.type_vector(cx.type_i8(), self.size.bytes()),
RegKind::Vector => cx.type_vector(cx.type_i8(), self.size.bytes()),
}
}
}

View file

@ -21,6 +21,7 @@ use std::ffi::{CStr, CString};
use std::fs::{self, File};
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::sync::atomic::Ordering;
use gccjit::{Context, OutputKind};
use object::read::archive::ArchiveFile;
@ -39,7 +40,7 @@ use tempfile::{TempDir, tempdir};
use crate::back::write::save_temp_bitcode;
use crate::errors::LtoBitcodeFromRlib;
use crate::{GccCodegenBackend, GccContext, SyncContext, to_gcc_opt_level};
use crate::{GccCodegenBackend, GccContext, LTO_SUPPORTED, LtoMode, SyncContext, to_gcc_opt_level};
struct LtoData {
// TODO(antoyo): use symbols_below_threshold.
@ -229,7 +230,7 @@ fn fat_lto(
info!("linking {:?}", name);
match bc_decoded {
SerializedModule::Local(ref module_buffer) => {
module.module_llvm.should_combine_object_files = true;
module.module_llvm.lto_mode = LtoMode::Fat;
module
.module_llvm
.context
@ -534,7 +535,7 @@ pub fn optimize_thin_module(
// that LLVM Context and Module.
//let llcx = llvm::LLVMRustContextCreate(cgcx.fewer_names);
//let llmod_raw = parse_module(llcx, module_name, thin_module.data(), &dcx)? as *const _;
let mut should_combine_object_files = false;
let mut lto_mode = LtoMode::None;
let context = match thin_module.shared.thin_buffers.get(thin_module.idx) {
Some(thin_buffer) => Arc::clone(&thin_buffer.context),
None => {
@ -545,7 +546,7 @@ pub fn optimize_thin_module(
SerializedModule::Local(ref module_buffer) => {
let path = module_buffer.0.to_str().expect("path");
context.add_driver_option(path);
should_combine_object_files = true;
lto_mode = LtoMode::Thin;
/*module.module_llvm.should_combine_object_files = true;
module
.module_llvm
@ -560,11 +561,13 @@ pub fn optimize_thin_module(
Arc::new(SyncContext::new(context))
}
};
let lto_supported = LTO_SUPPORTED.load(Ordering::SeqCst);
let module = ModuleCodegen::new_regular(
thin_module.name().to_string(),
GccContext {
context,
should_combine_object_files,
lto_mode,
lto_supported,
// TODO(antoyo): use the correct relocation model here.
relocation_model: RelocModel::Pic,
temp_dir: None,

View file

@ -11,7 +11,7 @@ use rustc_target::spec::SplitDebuginfo;
use crate::base::add_pic_option;
use crate::errors::CopyBitcode;
use crate::{GccCodegenBackend, GccContext};
use crate::{GccCodegenBackend, GccContext, LtoMode};
pub(crate) fn codegen(
cgcx: &CodegenContext<GccCodegenBackend>,
@ -25,12 +25,8 @@ pub(crate) fn codegen(
{
let context = &module.module_llvm.context;
let should_combine_object_files = module.module_llvm.should_combine_object_files;
// NOTE: Only generate object files with GIMPLE when this environment variable is set for
// now because this requires a particular setup (same gcc/lto1/lto-wrapper commit as libgccjit).
// TODO(antoyo): remove this environment variable.
let fat_lto = env::var("EMBED_LTO_BITCODE").as_deref() == Ok("1");
let lto_mode = module.module_llvm.lto_mode;
let lto_supported = module.module_llvm.lto_supported;
let bc_out = cgcx.output_filenames.temp_path_for_cgu(
OutputType::Bitcode,
@ -44,80 +40,46 @@ pub(crate) fn codegen(
);
if config.bitcode_needed() {
if fat_lto {
let _timer = cgcx
.prof
.generic_activity_with_arg("GCC_module_codegen_make_bitcode", &*module.name);
// TODO(antoyo)
/*if let Some(bitcode_filename) = bc_out.file_name() {
cgcx.prof.artifact_size(
"llvm_bitcode",
bitcode_filename.to_string_lossy(),
data.len() as u64,
);
}*/
if config.emit_bc || config.emit_obj == EmitObj::Bitcode {
let _timer = cgcx
.prof
.generic_activity_with_arg("GCC_module_codegen_make_bitcode", &*module.name);
// TODO(antoyo)
/*if let Some(bitcode_filename) = bc_out.file_name() {
cgcx.prof.artifact_size(
"llvm_bitcode",
bitcode_filename.to_string_lossy(),
data.len() as u64,
);
}*/
if config.emit_bc || config.emit_obj == EmitObj::Bitcode {
let _timer = cgcx.prof.generic_activity_with_arg(
"GCC_module_codegen_emit_bitcode",
&*module.name,
);
.generic_activity_with_arg("GCC_module_codegen_emit_bitcode", &*module.name);
if lto_supported {
context.add_command_line_option("-flto=auto");
context.add_command_line_option("-flto-partition=one");
// TODO(antoyo): remove since we don't want fat objects when it is for Bitcode only.
context.add_command_line_option("-ffat-lto-objects");
context.compile_to_file(
OutputKind::ObjectFile,
bc_out.to_str().expect("path to str"),
);
}
context
.compile_to_file(OutputKind::ObjectFile, bc_out.to_str().expect("path to str"));
}
if config.emit_obj == EmitObj::ObjectCode(BitcodeSection::Full) {
let _timer = cgcx.prof.generic_activity_with_arg(
"GCC_module_codegen_embed_bitcode",
&*module.name,
);
if config.emit_obj == EmitObj::ObjectCode(BitcodeSection::Full) {
let _timer = cgcx
.prof
.generic_activity_with_arg("GCC_module_codegen_embed_bitcode", &*module.name);
if lto_supported {
// TODO(antoyo): maybe we should call embed_bitcode to have the proper iOS fixes?
//embed_bitcode(cgcx, llcx, llmod, &config.bc_cmdline, data);
context.add_command_line_option("-flto=auto");
context.add_command_line_option("-flto-partition=one");
context.add_command_line_option("-ffat-lto-objects");
// TODO(antoyo): Send -plugin/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/liblto_plugin.so to linker (this should be done when specifying the appropriate rustc cli argument).
context.compile_to_file(
OutputKind::ObjectFile,
bc_out.to_str().expect("path to str"),
);
}
} else {
if config.emit_bc || config.emit_obj == EmitObj::Bitcode {
let _timer = cgcx.prof.generic_activity_with_arg(
"GCC_module_codegen_emit_bitcode",
&*module.name,
);
context.compile_to_file(
OutputKind::ObjectFile,
bc_out.to_str().expect("path to str"),
);
}
if config.emit_obj == EmitObj::ObjectCode(BitcodeSection::Full) {
// TODO(antoyo): we might want to emit to emit an error here, saying to set the
// environment variable EMBED_LTO_BITCODE.
let _timer = cgcx.prof.generic_activity_with_arg(
"GCC_module_codegen_embed_bitcode",
&*module.name,
);
// TODO(antoyo): maybe we should call embed_bitcode to have the proper iOS fixes?
//embed_bitcode(cgcx, llcx, llmod, &config.bc_cmdline, data);
// TODO(antoyo): Send -plugin/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/liblto_plugin.so to linker (this should be done when specifying the appropriate rustc cli argument).
context.compile_to_file(
OutputKind::ObjectFile,
bc_out.to_str().expect("path to str"),
);
}
// TODO(antoyo): Send -plugin/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/liblto_plugin.so to linker (this should be done when specifying the appropriate rustc cli argument).
context
.compile_to_file(OutputKind::ObjectFile, bc_out.to_str().expect("path to str"));
}
}
@ -166,7 +128,10 @@ pub(crate) fn codegen(
context.set_debug_info(true);
context.dump_to_file(path, true);
}
if should_combine_object_files {
if lto_mode != LtoMode::None {
let fat_lto = lto_mode == LtoMode::Fat;
// We need to check if we're doing LTO since this code is also used for the
// dummy ThinLTO implementation to combine the object files.
if fat_lto {
context.add_command_line_option("-flto=auto");
context.add_command_line_option("-flto-partition=one");

View file

@ -21,7 +21,7 @@ use rustc_target::spec::{Arch, RelocModel};
use crate::builder::Builder;
use crate::context::CodegenCx;
use crate::{GccContext, LockedTargetInfo, SyncContext, gcc_util, new_context};
use crate::{GccContext, LockedTargetInfo, LtoMode, SyncContext, gcc_util, new_context};
#[cfg(feature = "master")]
pub fn visibility_to_gcc(visibility: Visibility) -> gccjit::Visibility {
@ -74,6 +74,7 @@ pub fn compile_codegen_unit(
tcx: TyCtxt<'_>,
cgu_name: Symbol,
target_info: LockedTargetInfo,
lto_supported: bool,
) -> (ModuleCodegen<GccContext>, u64) {
let prof_timer = tcx.prof.generic_activity("codegen_module");
let start_time = Instant::now();
@ -82,7 +83,7 @@ pub fn compile_codegen_unit(
let (module, _) = tcx.dep_graph.with_task(
dep_node,
tcx,
(cgu_name, target_info),
(cgu_name, target_info, lto_supported),
module_codegen,
Some(dep_graph::hash_result),
);
@ -95,7 +96,7 @@ pub fn compile_codegen_unit(
fn module_codegen(
tcx: TyCtxt<'_>,
(cgu_name, target_info): (Symbol, LockedTargetInfo),
(cgu_name, target_info, lto_supported): (Symbol, LockedTargetInfo, bool),
) -> ModuleCodegen<GccContext> {
let cgu = tcx.codegen_unit(cgu_name);
// Instantiate monomorphizations without filling out definitions yet...
@ -247,7 +248,8 @@ pub fn compile_codegen_unit(
GccContext {
context: Arc::new(SyncContext::new(context)),
relocation_model: tcx.sess.relocation_model(),
should_combine_object_files: false,
lto_supported,
lto_mode: LtoMode::None,
temp_dir: None,
},
)

View file

@ -668,32 +668,38 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
}
fn add(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
self.gcc_add(a, b)
self.assign_to_var(self.gcc_add(a, b))
}
fn fadd(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
a + b
self.assign_to_var(a + b)
}
// TODO(antoyo): should we also override the `unchecked_` versions?
fn sub(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
self.gcc_sub(a, b)
self.assign_to_var(self.gcc_sub(a, b))
}
fn fsub(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
a - b
self.assign_to_var(a - b)
}
fn mul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
self.gcc_mul(a, b)
self.assign_to_var(self.gcc_mul(a, b))
}
fn fmul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
self.cx.context.new_binary_op(self.location, BinaryOp::Mult, a.get_type(), a, b)
self.assign_to_var(self.cx.context.new_binary_op(
self.location,
BinaryOp::Mult,
a.get_type(),
a,
b,
))
}
fn udiv(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
self.gcc_udiv(a, b)
self.assign_to_var(self.gcc_udiv(a, b))
}
fn exactudiv(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
@ -702,11 +708,11 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
let a = self.gcc_int_cast(a, a_type);
let b_type = b.get_type().to_unsigned(self);
let b = self.gcc_int_cast(b, b_type);
self.gcc_udiv(a, b)
self.assign_to_var(self.gcc_udiv(a, b))
}
fn sdiv(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
self.gcc_sdiv(a, b)
self.assign_to_var(self.gcc_sdiv(a, b))
}
fn exactsdiv(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
@ -715,19 +721,19 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
// should be the same.
let typ = a.get_type().to_signed(self);
let b = self.gcc_int_cast(b, typ);
self.gcc_sdiv(a, b)
self.assign_to_var(self.gcc_sdiv(a, b))
}
fn fdiv(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
a / b
self.assign_to_var(a / b)
}
fn urem(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
self.gcc_urem(a, b)
self.assign_to_var(self.gcc_urem(a, b))
}
fn srem(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
self.gcc_srem(a, b)
self.assign_to_var(self.gcc_srem(a, b))
}
fn frem(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
@ -865,22 +871,26 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
fn fadd_fast(&mut self, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> RValue<'gcc> {
// NOTE: it seems like we cannot enable fast-mode for a single operation in GCC.
set_rvalue_location(self, lhs + rhs)
let result = set_rvalue_location(self, lhs + rhs);
self.assign_to_var(result)
}
fn fsub_fast(&mut self, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> RValue<'gcc> {
// NOTE: it seems like we cannot enable fast-mode for a single operation in GCC.
set_rvalue_location(self, lhs - rhs)
let result = set_rvalue_location(self, lhs - rhs);
self.assign_to_var(result)
}
fn fmul_fast(&mut self, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> RValue<'gcc> {
// NOTE: it seems like we cannot enable fast-mode for a single operation in GCC.
set_rvalue_location(self, lhs * rhs)
let result = set_rvalue_location(self, lhs * rhs);
self.assign_to_var(result)
}
fn fdiv_fast(&mut self, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> RValue<'gcc> {
// NOTE: it seems like we cannot enable fast-mode for a single operation in GCC.
set_rvalue_location(self, lhs / rhs)
let result = set_rvalue_location(self, lhs / rhs);
self.assign_to_var(result)
}
fn frem_fast(&mut self, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> RValue<'gcc> {
@ -892,22 +902,22 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
fn fadd_algebraic(&mut self, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> RValue<'gcc> {
// NOTE: it seems like we cannot enable fast-mode for a single operation in GCC.
lhs + rhs
self.assign_to_var(lhs + rhs)
}
fn fsub_algebraic(&mut self, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> RValue<'gcc> {
// NOTE: it seems like we cannot enable fast-mode for a single operation in GCC.
lhs - rhs
self.assign_to_var(lhs - rhs)
}
fn fmul_algebraic(&mut self, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> RValue<'gcc> {
// NOTE: it seems like we cannot enable fast-mode for a single operation in GCC.
lhs * rhs
self.assign_to_var(lhs * rhs)
}
fn fdiv_algebraic(&mut self, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> RValue<'gcc> {
// NOTE: it seems like we cannot enable fast-mode for a single operation in GCC.
lhs / rhs
self.assign_to_var(lhs / rhs)
}
fn frem_algebraic(&mut self, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> RValue<'gcc> {
@ -2409,6 +2419,15 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
let res = then_vals | else_vals;
self.bitcast_if_needed(res, result_type)
}
// GCC doesn't like deeply nested expressions.
// By assigning intermediate expressions to a variable, this allow us to avoid deeply nested
// expressions and GCC will use much less RAM.
fn assign_to_var(&self, value: RValue<'gcc>) -> RValue<'gcc> {
let var = self.current_func().new_local(self.location, value.get_type(), "opResult");
self.llbb().add_assignment(self.location, var, value);
var.to_rvalue()
}
}
fn difference_or_zero<'gcc>(

View file

@ -83,12 +83,11 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
let a_size = a_type.get_size();
let b_size = b_type.get_size();
match a_size.cmp(&b_size) {
std::cmp::Ordering::Less => {
let a = self.context.new_cast(self.location, a, b_type);
a >> b
}
std::cmp::Ordering::Equal => a >> b,
std::cmp::Ordering::Greater => {
_ => {
// NOTE: it is OK to cast even if b has a type bigger than a because b has
// been masked by codegen_ssa before calling Builder::lshr or
// Builder::ashr.
let b = self.context.new_cast(self.location, b, a_type);
a >> b
}
@ -692,12 +691,10 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
let a_size = a_type.get_size();
let b_size = b_type.get_size();
match a_size.cmp(&b_size) {
std::cmp::Ordering::Less => {
let a = self.context.new_cast(self.location, a, b_type);
a << b
}
std::cmp::Ordering::Equal => a << b,
std::cmp::Ordering::Greater => {
_ => {
// NOTE: it is OK to cast even if b has a type bigger than a because b has
// been masked by codegen_ssa before calling Builder::shl.
let b = self.context.new_cast(self.location, b, a_type);
a << b
}

View file

@ -85,12 +85,41 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
fn amdgcn(name: &str, full_name: &str) -> &'static str {
match name {
// amdgcn
"add.max.i32" => "__builtin_amdgcn_add_max_i32",
"add.max.u32" => "__builtin_amdgcn_add_max_u32",
"add.min.i32" => "__builtin_amdgcn_add_min_i32",
"add.min.u32" => "__builtin_amdgcn_add_min_u32",
"alignbyte" => "__builtin_amdgcn_alignbyte",
"ashr.pk.i8.i32" => "__builtin_amdgcn_ashr_pk_i8_i32",
"ashr.pk.u8.i32" => "__builtin_amdgcn_ashr_pk_u8_i32",
"buffer.wbinvl1" => "__builtin_amdgcn_buffer_wbinvl1",
"buffer.wbinvl1.sc" => "__builtin_amdgcn_buffer_wbinvl1_sc",
"buffer.wbinvl1.vol" => "__builtin_amdgcn_buffer_wbinvl1_vol",
"cluster.id.x" => "__builtin_amdgcn_cluster_id_x",
"cluster.id.y" => "__builtin_amdgcn_cluster_id_y",
"cluster.id.z" => "__builtin_amdgcn_cluster_id_z",
"cluster.load.async.to.lds.b128" => {
"__builtin_amdgcn_cluster_load_async_to_lds_b128"
}
"cluster.load.async.to.lds.b32" => {
"__builtin_amdgcn_cluster_load_async_to_lds_b32"
}
"cluster.load.async.to.lds.b64" => {
"__builtin_amdgcn_cluster_load_async_to_lds_b64"
}
"cluster.load.async.to.lds.b8" => {
"__builtin_amdgcn_cluster_load_async_to_lds_b8"
}
"cluster.workgroup.flat.id" => "__builtin_amdgcn_cluster_workgroup_flat_id",
"cluster.workgroup.id.x" => "__builtin_amdgcn_cluster_workgroup_id_x",
"cluster.workgroup.id.y" => "__builtin_amdgcn_cluster_workgroup_id_y",
"cluster.workgroup.id.z" => "__builtin_amdgcn_cluster_workgroup_id_z",
"cluster.workgroup.max.flat.id" => {
"__builtin_amdgcn_cluster_workgroup_max_flat_id"
}
"cluster.workgroup.max.id.x" => "__builtin_amdgcn_cluster_workgroup_max_id_x",
"cluster.workgroup.max.id.y" => "__builtin_amdgcn_cluster_workgroup_max_id_y",
"cluster.workgroup.max.id.z" => "__builtin_amdgcn_cluster_workgroup_max_id_z",
"cubeid" => "__builtin_amdgcn_cubeid",
"cubema" => "__builtin_amdgcn_cubema",
"cubesc" => "__builtin_amdgcn_cubesc",
@ -101,18 +130,36 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
"cvt.f32.fp8" => "__builtin_amdgcn_cvt_f32_fp8",
"cvt.f32.fp8.e5m3" => "__builtin_amdgcn_cvt_f32_fp8_e5m3",
"cvt.off.f32.i4" => "__builtin_amdgcn_cvt_off_f32_i4",
"cvt.pk.bf8.f16" => "__builtin_amdgcn_cvt_pk_bf8_f16",
"cvt.pk.bf8.f32" => "__builtin_amdgcn_cvt_pk_bf8_f32",
"cvt.pk.f16.bf8" => "__builtin_amdgcn_cvt_pk_f16_bf8",
"cvt.pk.f16.fp8" => "__builtin_amdgcn_cvt_pk_f16_fp8",
"cvt.pk.f32.bf8" => "__builtin_amdgcn_cvt_pk_f32_bf8",
"cvt.pk.f32.fp8" => "__builtin_amdgcn_cvt_pk_f32_fp8",
"cvt.pk.fp8.f16" => "__builtin_amdgcn_cvt_pk_fp8_f16",
"cvt.pk.fp8.f32" => "__builtin_amdgcn_cvt_pk_fp8_f32",
"cvt.pk.fp8.f32.e5m3" => "__builtin_amdgcn_cvt_pk_fp8_f32_e5m3",
"cvt.pk.i16" => "__builtin_amdgcn_cvt_pk_i16",
"cvt.pk.u16" => "__builtin_amdgcn_cvt_pk_u16",
"cvt.pk.u8.f32" => "__builtin_amdgcn_cvt_pk_u8_f32",
"cvt.pknorm.i16" => "__builtin_amdgcn_cvt_pknorm_i16",
"cvt.pknorm.u16" => "__builtin_amdgcn_cvt_pknorm_u16",
"cvt.pkrtz" => "__builtin_amdgcn_cvt_pkrtz",
"cvt.scale.pk16.bf16.bf6" => "__builtin_amdgcn_cvt_scale_pk16_bf16_bf6",
"cvt.scale.pk16.bf16.fp6" => "__builtin_amdgcn_cvt_scale_pk16_bf16_fp6",
"cvt.scale.pk16.f16.bf6" => "__builtin_amdgcn_cvt_scale_pk16_f16_bf6",
"cvt.scale.pk16.f16.fp6" => "__builtin_amdgcn_cvt_scale_pk16_f16_fp6",
"cvt.scale.pk16.f32.bf6" => "__builtin_amdgcn_cvt_scale_pk16_f32_bf6",
"cvt.scale.pk16.f32.fp6" => "__builtin_amdgcn_cvt_scale_pk16_f32_fp6",
"cvt.scale.pk8.bf16.bf8" => "__builtin_amdgcn_cvt_scale_pk8_bf16_bf8",
"cvt.scale.pk8.bf16.fp4" => "__builtin_amdgcn_cvt_scale_pk8_bf16_fp4",
"cvt.scale.pk8.bf16.fp8" => "__builtin_amdgcn_cvt_scale_pk8_bf16_fp8",
"cvt.scale.pk8.f16.bf8" => "__builtin_amdgcn_cvt_scale_pk8_f16_bf8",
"cvt.scale.pk8.f16.fp4" => "__builtin_amdgcn_cvt_scale_pk8_f16_fp4",
"cvt.scale.pk8.f16.fp8" => "__builtin_amdgcn_cvt_scale_pk8_f16_fp8",
"cvt.scale.pk8.f32.bf8" => "__builtin_amdgcn_cvt_scale_pk8_f32_bf8",
"cvt.scale.pk8.f32.fp4" => "__builtin_amdgcn_cvt_scale_pk8_f32_fp4",
"cvt.scale.pk8.f32.fp8" => "__builtin_amdgcn_cvt_scale_pk8_f32_fp8",
"cvt.scalef32.2xpk16.bf6.f32" => "__builtin_amdgcn_cvt_scalef32_2xpk16_bf6_f32",
"cvt.scalef32.2xpk16.fp6.f32" => "__builtin_amdgcn_cvt_scalef32_2xpk16_fp6_f32",
"cvt.scalef32.f16.bf8" => "__builtin_amdgcn_cvt_scalef32_f16_bf8",
@ -137,6 +184,12 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
"cvt.scalef32.pk.fp8.bf16" => "__builtin_amdgcn_cvt_scalef32_pk_fp8_bf16",
"cvt.scalef32.pk.fp8.f16" => "__builtin_amdgcn_cvt_scalef32_pk_fp8_f16",
"cvt.scalef32.pk.fp8.f32" => "__builtin_amdgcn_cvt_scalef32_pk_fp8_f32",
"cvt.scalef32.pk16.bf6.bf16" => "__builtin_amdgcn_cvt_scalef32_pk16_bf6_bf16",
"cvt.scalef32.pk16.bf6.f16" => "__builtin_amdgcn_cvt_scalef32_pk16_bf6_f16",
"cvt.scalef32.pk16.bf6.f32" => "__builtin_amdgcn_cvt_scalef32_pk16_bf6_f32",
"cvt.scalef32.pk16.fp6.bf16" => "__builtin_amdgcn_cvt_scalef32_pk16_fp6_bf16",
"cvt.scalef32.pk16.fp6.f16" => "__builtin_amdgcn_cvt_scalef32_pk16_fp6_f16",
"cvt.scalef32.pk16.fp6.f32" => "__builtin_amdgcn_cvt_scalef32_pk16_fp6_f32",
"cvt.scalef32.pk32.bf16.bf6" => "__builtin_amdgcn_cvt_scalef32_pk32_bf16_bf6",
"cvt.scalef32.pk32.bf16.fp6" => "__builtin_amdgcn_cvt_scalef32_pk32_bf16_fp6",
"cvt.scalef32.pk32.bf6.bf16" => "__builtin_amdgcn_cvt_scalef32_pk32_bf6_bf16",
@ -147,6 +200,15 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
"cvt.scalef32.pk32.f32.fp6" => "__builtin_amdgcn_cvt_scalef32_pk32_f32_fp6",
"cvt.scalef32.pk32.fp6.bf16" => "__builtin_amdgcn_cvt_scalef32_pk32_fp6_bf16",
"cvt.scalef32.pk32.fp6.f16" => "__builtin_amdgcn_cvt_scalef32_pk32_fp6_f16",
"cvt.scalef32.pk8.bf8.bf16" => "__builtin_amdgcn_cvt_scalef32_pk8_bf8_bf16",
"cvt.scalef32.pk8.bf8.f16" => "__builtin_amdgcn_cvt_scalef32_pk8_bf8_f16",
"cvt.scalef32.pk8.bf8.f32" => "__builtin_amdgcn_cvt_scalef32_pk8_bf8_f32",
"cvt.scalef32.pk8.fp4.bf16" => "__builtin_amdgcn_cvt_scalef32_pk8_fp4_bf16",
"cvt.scalef32.pk8.fp4.f16" => "__builtin_amdgcn_cvt_scalef32_pk8_fp4_f16",
"cvt.scalef32.pk8.fp4.f32" => "__builtin_amdgcn_cvt_scalef32_pk8_fp4_f32",
"cvt.scalef32.pk8.fp8.bf16" => "__builtin_amdgcn_cvt_scalef32_pk8_fp8_bf16",
"cvt.scalef32.pk8.fp8.f16" => "__builtin_amdgcn_cvt_scalef32_pk8_fp8_f16",
"cvt.scalef32.pk8.fp8.f32" => "__builtin_amdgcn_cvt_scalef32_pk8_fp8_f32",
"cvt.scalef32.sr.bf8.bf16" => "__builtin_amdgcn_cvt_scalef32_sr_bf8_bf16",
"cvt.scalef32.sr.bf8.f16" => "__builtin_amdgcn_cvt_scalef32_sr_bf8_f16",
"cvt.scalef32.sr.bf8.f32" => "__builtin_amdgcn_cvt_scalef32_sr_bf8_f32",
@ -156,6 +218,24 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
"cvt.scalef32.sr.pk.fp4.bf16" => "__builtin_amdgcn_cvt_scalef32_sr_pk_fp4_bf16",
"cvt.scalef32.sr.pk.fp4.f16" => "__builtin_amdgcn_cvt_scalef32_sr_pk_fp4_f16",
"cvt.scalef32.sr.pk.fp4.f32" => "__builtin_amdgcn_cvt_scalef32_sr_pk_fp4_f32",
"cvt.scalef32.sr.pk16.bf6.bf16" => {
"__builtin_amdgcn_cvt_scalef32_sr_pk16_bf6_bf16"
}
"cvt.scalef32.sr.pk16.bf6.f16" => {
"__builtin_amdgcn_cvt_scalef32_sr_pk16_bf6_f16"
}
"cvt.scalef32.sr.pk16.bf6.f32" => {
"__builtin_amdgcn_cvt_scalef32_sr_pk16_bf6_f32"
}
"cvt.scalef32.sr.pk16.fp6.bf16" => {
"__builtin_amdgcn_cvt_scalef32_sr_pk16_fp6_bf16"
}
"cvt.scalef32.sr.pk16.fp6.f16" => {
"__builtin_amdgcn_cvt_scalef32_sr_pk16_fp6_f16"
}
"cvt.scalef32.sr.pk16.fp6.f32" => {
"__builtin_amdgcn_cvt_scalef32_sr_pk16_fp6_f32"
}
"cvt.scalef32.sr.pk32.bf6.bf16" => {
"__builtin_amdgcn_cvt_scalef32_sr_pk32_bf6_bf16"
}
@ -174,10 +254,30 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
"cvt.scalef32.sr.pk32.fp6.f32" => {
"__builtin_amdgcn_cvt_scalef32_sr_pk32_fp6_f32"
}
"cvt.scalef32.sr.pk8.bf8.bf16" => {
"__builtin_amdgcn_cvt_scalef32_sr_pk8_bf8_bf16"
}
"cvt.scalef32.sr.pk8.bf8.f16" => "__builtin_amdgcn_cvt_scalef32_sr_pk8_bf8_f16",
"cvt.scalef32.sr.pk8.bf8.f32" => "__builtin_amdgcn_cvt_scalef32_sr_pk8_bf8_f32",
"cvt.scalef32.sr.pk8.fp4.bf16" => {
"__builtin_amdgcn_cvt_scalef32_sr_pk8_fp4_bf16"
}
"cvt.scalef32.sr.pk8.fp4.f16" => "__builtin_amdgcn_cvt_scalef32_sr_pk8_fp4_f16",
"cvt.scalef32.sr.pk8.fp4.f32" => "__builtin_amdgcn_cvt_scalef32_sr_pk8_fp4_f32",
"cvt.scalef32.sr.pk8.fp8.bf16" => {
"__builtin_amdgcn_cvt_scalef32_sr_pk8_fp8_bf16"
}
"cvt.scalef32.sr.pk8.fp8.f16" => "__builtin_amdgcn_cvt_scalef32_sr_pk8_fp8_f16",
"cvt.scalef32.sr.pk8.fp8.f32" => "__builtin_amdgcn_cvt_scalef32_sr_pk8_fp8_f32",
"cvt.sr.bf16.f32" => "__builtin_amdgcn_cvt_sr_bf16_f32",
"cvt.sr.bf8.f16" => "__builtin_amdgcn_cvt_sr_bf8_f16",
"cvt.sr.bf8.f32" => "__builtin_amdgcn_cvt_sr_bf8_f32",
"cvt.sr.f16.f32" => "__builtin_amdgcn_cvt_sr_f16_f32",
"cvt.sr.fp8.f16" => "__builtin_amdgcn_cvt_sr_fp8_f16",
"cvt.sr.fp8.f32" => "__builtin_amdgcn_cvt_sr_fp8_f32",
"cvt.sr.fp8.f32.e5m3" => "__builtin_amdgcn_cvt_sr_fp8_f32_e5m3",
"cvt.sr.pk.bf16.f32" => "__builtin_amdgcn_cvt_sr_pk_bf16_f32",
"cvt.sr.pk.f16.f32" => "__builtin_amdgcn_cvt_sr_pk_f16_f32",
"dispatch.id" => "__builtin_amdgcn_dispatch_id",
"dot4.f32.bf8.bf8" => "__builtin_amdgcn_dot4_f32_bf8_bf8",
"dot4.f32.bf8.fp8" => "__builtin_amdgcn_dot4_f32_bf8_fp8",
@ -297,8 +397,20 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
"mqsad.u32.u8" => "__builtin_amdgcn_mqsad_u32_u8",
"msad.u8" => "__builtin_amdgcn_msad_u8",
"perm" => "__builtin_amdgcn_perm",
"perm.pk16.b4.u4" => "__builtin_amdgcn_perm_pk16_b4_u4",
"perm.pk16.b6.u4" => "__builtin_amdgcn_perm_pk16_b6_u4",
"perm.pk16.b8.u4" => "__builtin_amdgcn_perm_pk16_b8_u4",
"permlane.bcast" => "__builtin_amdgcn_permlane_bcast",
"permlane.down" => "__builtin_amdgcn_permlane_down",
"permlane.idx.gen" => "__builtin_amdgcn_permlane_idx_gen",
"permlane.up" => "__builtin_amdgcn_permlane_up",
"permlane.xor" => "__builtin_amdgcn_permlane_xor",
"permlane16.var" => "__builtin_amdgcn_permlane16_var",
"permlanex16.var" => "__builtin_amdgcn_permlanex16_var",
"pk.add.max.i16" => "__builtin_amdgcn_pk_add_max_i16",
"pk.add.max.u16" => "__builtin_amdgcn_pk_add_max_u16",
"pk.add.min.i16" => "__builtin_amdgcn_pk_add_min_i16",
"pk.add.min.u16" => "__builtin_amdgcn_pk_add_min_u16",
"prng.b32" => "__builtin_amdgcn_prng_b32",
"qsad.pk.u16.u8" => "__builtin_amdgcn_qsad_pk_u16_u8",
"queue.ptr" => "__builtin_amdgcn_queue_ptr",
@ -306,11 +418,15 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
"rcp.legacy" => "__builtin_amdgcn_rcp_legacy",
"rsq.legacy" => "__builtin_amdgcn_rsq_legacy",
"s.barrier" => "__builtin_amdgcn_s_barrier",
"s.barrier.init" => "__builtin_amdgcn_s_barrier_init",
"s.barrier.join" => "__builtin_amdgcn_s_barrier_join",
"s.barrier.leave" => "__builtin_amdgcn_s_barrier_leave",
"s.barrier.signal" => "__builtin_amdgcn_s_barrier_signal",
"s.barrier.signal.isfirst" => "__builtin_amdgcn_s_barrier_signal_isfirst",
"s.barrier.signal.var" => "__builtin_amdgcn_s_barrier_signal_var",
"s.barrier.wait" => "__builtin_amdgcn_s_barrier_wait",
"s.buffer.prefetch.data" => "__builtin_amdgcn_s_buffer_prefetch_data",
"s.cluster.barrier" => "__builtin_amdgcn_s_cluster_barrier",
"s.dcache.inv" => "__builtin_amdgcn_s_dcache_inv",
"s.dcache.inv.vol" => "__builtin_amdgcn_s_dcache_inv_vol",
"s.dcache.wb" => "__builtin_amdgcn_s_dcache_wb",
@ -1900,6 +2016,8 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
"V6.vfneg.hf.128B" => "__builtin_HEXAGON_V6_vfneg_hf_128B",
"V6.vfneg.sf" => "__builtin_HEXAGON_V6_vfneg_sf",
"V6.vfneg.sf.128B" => "__builtin_HEXAGON_V6_vfneg_sf_128B",
"V6.vgather.vscattermh" => "__builtin_HEXAGON_V6_vgather_vscattermh",
"V6.vgather.vscattermh.128B" => "__builtin_HEXAGON_V6_vgather_vscattermh_128B",
"V6.vgathermh" => "__builtin_HEXAGON_V6_vgathermh",
"V6.vgathermh.128B" => "__builtin_HEXAGON_V6_vgathermh_128B",
"V6.vgathermhq" => "__builtin_HEXAGON_V6_vgathermhq",
@ -2382,6 +2500,8 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
"V6.vsub.hf.f8.128B" => "__builtin_HEXAGON_V6_vsub_hf_f8_128B",
"V6.vsub.hf.hf" => "__builtin_HEXAGON_V6_vsub_hf_hf",
"V6.vsub.hf.hf.128B" => "__builtin_HEXAGON_V6_vsub_hf_hf_128B",
"V6.vsub.hf.mix" => "__builtin_HEXAGON_V6_vsub_hf_mix",
"V6.vsub.hf.mix.128B" => "__builtin_HEXAGON_V6_vsub_hf_mix_128B",
"V6.vsub.qf16" => "__builtin_HEXAGON_V6_vsub_qf16",
"V6.vsub.qf16.128B" => "__builtin_HEXAGON_V6_vsub_qf16_128B",
"V6.vsub.qf16.mix" => "__builtin_HEXAGON_V6_vsub_qf16_mix",
@ -2396,6 +2516,8 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
"V6.vsub.sf.bf.128B" => "__builtin_HEXAGON_V6_vsub_sf_bf_128B",
"V6.vsub.sf.hf" => "__builtin_HEXAGON_V6_vsub_sf_hf",
"V6.vsub.sf.hf.128B" => "__builtin_HEXAGON_V6_vsub_sf_hf_128B",
"V6.vsub.sf.mix" => "__builtin_HEXAGON_V6_vsub_sf_mix",
"V6.vsub.sf.mix.128B" => "__builtin_HEXAGON_V6_vsub_sf_mix_128B",
"V6.vsub.sf.sf" => "__builtin_HEXAGON_V6_vsub_sf_sf",
"V6.vsub.sf.sf.128B" => "__builtin_HEXAGON_V6_vsub_sf_sf_128B",
"V6.vsubb" => "__builtin_HEXAGON_V6_vsubb",
@ -4883,6 +5005,26 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
"f2ull.rp.ftz" => "__nvvm_f2ull_rp_ftz",
"f2ull.rz" => "__nvvm_f2ull_rz",
"f2ull.rz.ftz" => "__nvvm_f2ull_rz_ftz",
"f32x4.to.e2m1x4.rs.relu.satfinite" => {
"__nvvm_f32x4_to_e2m1x4_rs_relu_satfinite"
}
"f32x4.to.e2m1x4.rs.satfinite" => "__nvvm_f32x4_to_e2m1x4_rs_satfinite",
"f32x4.to.e2m3x4.rs.relu.satfinite" => {
"__nvvm_f32x4_to_e2m3x4_rs_relu_satfinite"
}
"f32x4.to.e2m3x4.rs.satfinite" => "__nvvm_f32x4_to_e2m3x4_rs_satfinite",
"f32x4.to.e3m2x4.rs.relu.satfinite" => {
"__nvvm_f32x4_to_e3m2x4_rs_relu_satfinite"
}
"f32x4.to.e3m2x4.rs.satfinite" => "__nvvm_f32x4_to_e3m2x4_rs_satfinite",
"f32x4.to.e4m3x4.rs.relu.satfinite" => {
"__nvvm_f32x4_to_e4m3x4_rs_relu_satfinite"
}
"f32x4.to.e4m3x4.rs.satfinite" => "__nvvm_f32x4_to_e4m3x4_rs_satfinite",
"f32x4.to.e5m2x4.rs.relu.satfinite" => {
"__nvvm_f32x4_to_e5m2x4_rs_relu_satfinite"
}
"f32x4.to.e5m2x4.rs.satfinite" => "__nvvm_f32x4_to_e5m2x4_rs_satfinite",
"fabs.d" => "__nvvm_fabs_d",
"fabs.f" => "__nvvm_fabs_f",
"fabs.ftz.f" => "__nvvm_fabs_ftz_f",
@ -4902,10 +5044,18 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
"ff.to.ue8m0x2.rz.satfinite" => "__nvvm_ff_to_ue8m0x2_rz_satfinite",
"ff2bf16x2.rn" => "__nvvm_ff2bf16x2_rn",
"ff2bf16x2.rn.relu" => "__nvvm_ff2bf16x2_rn_relu",
"ff2bf16x2.rs" => "__nvvm_ff2bf16x2_rs",
"ff2bf16x2.rs.relu" => "__nvvm_ff2bf16x2_rs_relu",
"ff2bf16x2.rs.relu.satfinite" => "__nvvm_ff2bf16x2_rs_relu_satfinite",
"ff2bf16x2.rs.satfinite" => "__nvvm_ff2bf16x2_rs_satfinite",
"ff2bf16x2.rz" => "__nvvm_ff2bf16x2_rz",
"ff2bf16x2.rz.relu" => "__nvvm_ff2bf16x2_rz_relu",
"ff2f16x2.rn" => "__nvvm_ff2f16x2_rn",
"ff2f16x2.rn.relu" => "__nvvm_ff2f16x2_rn_relu",
"ff2f16x2.rs" => "__nvvm_ff2f16x2_rs",
"ff2f16x2.rs.relu" => "__nvvm_ff2f16x2_rs_relu",
"ff2f16x2.rs.relu.satfinite" => "__nvvm_ff2f16x2_rs_relu_satfinite",
"ff2f16x2.rs.satfinite" => "__nvvm_ff2f16x2_rs_satfinite",
"ff2f16x2.rz" => "__nvvm_ff2f16x2_rz",
"ff2f16x2.rz.relu" => "__nvvm_ff2f16x2_rz_relu",
"floor.d" => "__nvvm_floor_d",
@ -5129,6 +5279,7 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
"read.ptx.sreg.envreg8" => "__nvvm_read_ptx_sreg_envreg8",
"read.ptx.sreg.envreg9" => "__nvvm_read_ptx_sreg_envreg9",
"read.ptx.sreg.globaltimer" => "__nvvm_read_ptx_sreg_globaltimer",
"read.ptx.sreg.globaltimer.lo" => "__nvvm_read_ptx_sreg_globaltimer_lo",
"read.ptx.sreg.gridid" => "__nvvm_read_ptx_sreg_gridid",
// [DUPLICATE]: "read.ptx.sreg.gridid" => "__nvvm_read_ptx_sreg_",
"read.ptx.sreg.laneid" => "__nvvm_read_ptx_sreg_laneid",
@ -5803,6 +5954,8 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
"altivec.vupklsw" => "__builtin_altivec_vupklsw",
"bcdadd" => "__builtin_ppc_bcdadd",
"bcdadd.p" => "__builtin_ppc_bcdadd_p",
"bcdcopysign" => "__builtin_ppc_bcdcopysign",
"bcdsetsign" => "__builtin_ppc_bcdsetsign",
"bcdsub" => "__builtin_ppc_bcdsub",
"bcdsub.p" => "__builtin_ppc_bcdsub_p",
"bpermd" => "__builtin_bpermd",
@ -6160,6 +6313,9 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
"aes64im" => "__builtin_riscv_aes64im",
"aes64ks1i" => "__builtin_riscv_aes64ks1i",
"aes64ks2" => "__builtin_riscv_aes64ks2",
"mips.ehb" => "__builtin_riscv_mips_ehb",
"mips.ihb" => "__builtin_riscv_mips_ihb",
"mips.pause" => "__builtin_riscv_mips_pause",
"sha512sig0" => "__builtin_riscv_sha512sig0",
"sha512sig0h" => "__builtin_riscv_sha512sig0h",
"sha512sig0l" => "__builtin_riscv_sha512sig0l",

View file

@ -308,10 +308,6 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
.or_else(|| get_simple_function_f128(self, name))
.or_else(|| get_simple_function_f128_2args(self, name));
// FIXME(tempdragon): Re-enable `clippy::suspicious_else_formatting` if the following issue is solved:
// https://github.com/rust-lang/rust-clippy/issues/12497
// and leave `else if use_integer_compare` to be placed "as is".
#[allow(clippy::suspicious_else_formatting)]
let value = match name {
_ if simple.is_some() => {
let func = simple.expect("simple intrinsic function");

View file

@ -72,10 +72,7 @@ use std::any::Any;
use std::fmt::Debug;
use std::ops::Deref;
use std::path::PathBuf;
#[cfg(not(feature = "master"))]
use std::sync::atomic::AtomicBool;
#[cfg(not(feature = "master"))]
use std::sync::atomic::Ordering;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use back::lto::{ThinBuffer, ThinData};
@ -167,8 +164,11 @@ impl LockedTargetInfo {
#[derive(Clone)]
pub struct GccCodegenBackend {
target_info: LockedTargetInfo,
lto_supported: Arc<AtomicBool>,
}
static LTO_SUPPORTED: AtomicBool = AtomicBool::new(false);
impl CodegenBackend for GccCodegenBackend {
fn locale_resource(&self) -> &'static str {
crate::DEFAULT_LOCALE_RESOURCE
@ -193,7 +193,13 @@ impl CodegenBackend for GccCodegenBackend {
}
#[cfg(feature = "master")]
gccjit::set_global_personality_function_name(b"rust_eh_personality\0");
{
let lto_supported = gccjit::is_lto_supported();
LTO_SUPPORTED.store(lto_supported, Ordering::SeqCst);
self.lto_supported.store(lto_supported, Ordering::SeqCst);
gccjit::set_global_personality_function_name(b"rust_eh_personality\0");
}
#[cfg(not(feature = "master"))]
{
@ -276,10 +282,12 @@ impl ExtraBackendMethods for GccCodegenBackend {
module_name: &str,
methods: &[AllocatorMethod],
) -> Self::Module {
let lto_supported = self.lto_supported.load(Ordering::SeqCst);
let mut mods = GccContext {
context: Arc::new(SyncContext::new(new_context(tcx))),
relocation_model: tcx.sess.relocation_model(),
should_combine_object_files: false,
lto_mode: LtoMode::None,
lto_supported,
temp_dir: None,
};
@ -294,7 +302,12 @@ impl ExtraBackendMethods for GccCodegenBackend {
tcx: TyCtxt<'_>,
cgu_name: Symbol,
) -> (ModuleCodegen<Self::Module>, u64) {
base::compile_codegen_unit(tcx, cgu_name, self.target_info.clone())
base::compile_codegen_unit(
tcx,
cgu_name,
self.target_info.clone(),
self.lto_supported.load(Ordering::SeqCst),
)
}
fn target_machine_factory(
@ -308,12 +321,20 @@ impl ExtraBackendMethods for GccCodegenBackend {
}
}
#[derive(Clone, Copy, PartialEq)]
pub enum LtoMode {
None,
Thin,
Fat,
}
pub struct GccContext {
context: Arc<SyncContext>,
/// This field is needed in order to be able to set the flag -fPIC when necessary when doing
/// LTO.
relocation_model: RelocModel,
should_combine_object_files: bool,
lto_mode: LtoMode,
lto_supported: bool,
// Temporary directory used by LTO. We keep it here so that it's not removed before linking.
temp_dir: Option<TempDir>,
}
@ -425,7 +446,10 @@ pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> {
supports_128bit_integers: AtomicBool::new(false),
})));
Box::new(GccCodegenBackend { target_info: LockedTargetInfo { info } })
Box::new(GccCodegenBackend {
lto_supported: Arc::new(AtomicBool::new(false)),
target_info: LockedTargetInfo { info },
})
}
fn to_gcc_opt_level(optlevel: Option<OptLevel>) -> OptimizationLevel {

View file

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "cross_lang_lto"
version = "0.1.0"

View file

@ -0,0 +1,6 @@
[package]
name = "cross_lang_lto"
version = "0.1.0"
edition = "2024"
[dependencies]

View file

@ -0,0 +1,5 @@
#include <stdint.h>
uint32_t my_add(uint32_t a, uint32_t b) {
return a + b;
}

View file

@ -0,0 +1,18 @@
/*
* Compile the C code with:
* gcc -c -flto add.c -ffat-lto-objects
* ar rcs libadd.a add.o
*
* Compile the Rust code with:
* CG_RUSTFLAGS="-L native=. -Clinker-plugin-lto -Clinker=gcc" y cargo run --release
*/
#[link(name="add")]
unsafe extern "C" {
fn my_add(a: u32, b: u32) -> u32;
}
fn main() {
let res = unsafe { my_add(30, 12) };
println!("{}", res);
}

View file

@ -1,33 +0,0 @@
tests/ui/lint/unsafe_code/forge_unsafe_block.rs
tests/ui/lint/unused-qualification-in-derive-expansion.rs
tests/ui/macros/macro-quote-test.rs
tests/ui/macros/proc_macro.rs
tests/ui/panic-runtime/lto-unwind.rs
tests/ui/resolve/derive-macro-1.rs
tests/ui/resolve/derive-macro-2.rs
tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-pretty.rs
tests/ui/rfcs/rfc-2565-param-attrs/issue-64682-dropping-first-attrs-in-impl-fns.rs
tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs
tests/ui/rust-2018/suggestions-not-always-applicable.rs
tests/ui/rust-2021/reserved-prefixes-via-macro.rs
tests/ui/underscore-imports/duplicate.rs
tests/ui/async-await/issues/issue-60674.rs
tests/ui/attributes/main-removed-2/main.rs
tests/ui/cfg/assume-incomplete-release/assume-incomplete.rs
tests/ui/crate-loading/cross-compiled-proc-macro.rs
tests/ui/derives/derive-marker-tricky.rs
tests/ui/diagnostic_namespace/existing_proc_macros.rs
tests/ui/fmt/format-args-capture-issue-106408.rs
tests/ui/fmt/indoc-issue-106408.rs
tests/ui/hygiene/issue-77523-def-site-async-await.rs
tests/ui/inherent-impls-overlap-check/no-overlap.rs
tests/ui/enum-discriminant/issue-46519.rs
tests/ui/issues/issue-45731.rs
tests/ui/lint/test-allow-dead-extern-static-no-warning.rs
tests/ui/macros/macro-comma-behavior-rpass.rs
tests/ui/macros/rfc-2011-nicer-assert-messages/assert-with-custom-errors-does-not-create-unnecessary-code.rs
tests/ui/macros/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs
tests/ui/macros/stringify.rs
tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-in-test.rs
tests/ui/binding/fn-arg-incomplete-pattern-drop-order.rs
tests/ui/lto/debuginfo-lto-alloc.rs

View file

@ -1,35 +1,11 @@
tests/run-make/a-b-a-linker-guard/
tests/run-make/CURRENT_RUSTC_VERSION/
tests/run-make/cross-lang-lto/
tests/run-make/cross-lang-lto-upstream-rlibs/
tests/run-make/doctests-keep-binaries/
tests/run-make/doctests-runtool/
tests/run-make/emit-shared-files/
tests/run-make/exit-code/
tests/run-make/llvm-ident/
tests/run-make/native-link-modifier-bundle/
tests/run-make/remap-path-prefix-dwarf/
tests/run-make/repr128-dwarf/
tests/run-make/rlib-format-packed-bundled-libs/
tests/run-make/rlib-format-packed-bundled-libs-2/
tests/run-make/rustdoc-determinism/
tests/run-make/rustdoc-error-lines/
tests/run-make/rustdoc-map-file/
tests/run-make/rustdoc-output-path/
tests/run-make/rustdoc-scrape-examples-invalid-expr/
tests/run-make/rustdoc-scrape-examples-multiple/
tests/run-make/rustdoc-scrape-examples-ordering/
tests/run-make/rustdoc-scrape-examples-remap/
tests/run-make/rustdoc-scrape-examples-test/
tests/run-make/rustdoc-scrape-examples-whitespace/
tests/run-make/rustdoc-scrape-examples-macros/
tests/run-make/rustdoc-with-out-dir-option/
tests/run-make/rustdoc-verify-output-files/
tests/run-make/rustdoc-themes/
tests/run-make/rustdoc-with-short-out-dir-option/
tests/run-make/rustdoc-with-output-option/
tests/run-make/arguments-non-c-like-enum/
tests/run-make/c-link-to-rust-staticlib/
tests/run-make/foreign-double-unwind/
tests/run-make/foreign-exceptions/
tests/run-make/glibc-staticlib-args/

View file

@ -1,5 +1,3 @@
tests/ui/allocator/no_std-alloc-error-handler-custom.rs
tests/ui/allocator/no_std-alloc-error-handler-default.rs
tests/ui/asm/may_unwind.rs
tests/ui/asm/x86_64/may_unwind.rs
tests/ui/drop/dynamic-drop-async.rs
@ -17,7 +15,6 @@ tests/ui/panic-runtime/link-to-abort.rs
tests/ui/parser/unclosed-delimiter-in-dep.rs
tests/ui/consts/missing_span_in_backtrace.rs
tests/ui/drop/dynamic-drop.rs
tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.rs
tests/ui/simd/issue-17170.rs
tests/ui/simd/issue-39720.rs
tests/ui/drop/panic-during-drop-14875.rs
@ -31,11 +28,9 @@ tests/ui/coroutine/resume-after-return.rs
tests/ui/simd/masked-load-store.rs
tests/ui/simd/repr_packed.rs
tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs
tests/ui/consts/try-operator.rs
tests/ui/coroutine/unwind-abort-mix.rs
tests/ui/consts/issue-miri-1910.rs
tests/ui/consts/const_cmp_type_id.rs
tests/ui/consts/issue-73976-monomorphic.rs
tests/ui/consts/issue-94675.rs
tests/ui/traits/const-traits/const-drop-fail.rs
tests/ui/runtime/on-broken-pipe/child-processes.rs
@ -53,7 +48,6 @@ tests/ui/sanitizer/cfi/virtual-auto.rs
tests/ui/sanitizer/cfi/sized-associated-ty.rs
tests/ui/sanitizer/cfi/can-reveal-opaques.rs
tests/ui/sanitizer/kcfi-mangling.rs
tests/ui/statics/const_generics.rs
tests/ui/backtrace/dylib-dep.rs
tests/ui/delegation/fn-header.rs
tests/ui/consts/const-eval/parse_ints.rs
@ -74,13 +68,7 @@ tests/ui/codegen/equal-pointers-unequal/strict-provenance/zero.rs
tests/ui/simd/simd-bitmask-notpow2.rs
tests/ui/codegen/StackColoring-not-blowup-stack-issue-40883.rs
tests/ui/numbers-arithmetic/u128-as-f32.rs
tests/ui/lto/all-crates.rs
tests/ui/uninhabited/uninhabited-transparent-return-abi.rs
tests/ui/coroutine/panic-drops-resume.rs
tests/ui/coroutine/panic-drops.rs
tests/ui/coroutine/panic-safe.rs
tests/ui/process/nofile-limit.rs
tests/ui/simd/intrinsic/generic-arithmetic-pass.rs
tests/ui/linking/no-gc-encapsulation-symbols.rs
tests/ui/panics/unwind-force-no-unwind-tables.rs
tests/ui/attributes/fn-align-dyn.rs
@ -88,3 +76,4 @@ tests/ui/linkage-attr/raw-dylib/elf/glibc-x86_64.rs
tests/ui/explicit-tail-calls/recursion-etc.rs
tests/ui/explicit-tail-calls/indexer.rs
tests/ui/explicit-tail-calls/drop-order.rs
tests/ui/c-variadic/valid.rs

View file

@ -469,16 +469,18 @@ fn check_result(
})
}
// warn for nonblocking async fn.
// warn for nonblocking async functions, blocks and closures.
// This doesn't behave as expected, because the executor can run blocking code without the sanitizer noticing.
if codegen_fn_attrs.sanitizers.rtsan_setting == RtsanSetting::Nonblocking
&& let Some(sanitize_span) = interesting_spans.sanitize
// async function
&& (tcx.asyncness(did).is_async() || (tcx.is_closure_like(did.into())
// async fn
&& (tcx.asyncness(did).is_async()
// async block
&& (tcx.coroutine_is_async(did.into())
// async closure
|| tcx.coroutine_is_async(tcx.coroutine_for_closure(did)))))
|| tcx.is_coroutine(did.into())
// async closure
|| (tcx.is_closure_like(did.into())
&& tcx.hir_node_by_def_id(did).expect_closure().kind
!= rustc_hir::ClosureKind::Closure))
{
let hir_id = tcx.local_def_id_to_hir_id(did);
tcx.node_span_lint(

View file

@ -350,22 +350,27 @@ impl AnnotateSnippetEmitter {
"all spans must be disjoint",
);
let lo = subst.parts.iter().map(|part| part.span.lo()).min()?;
let lo_file = sm.lookup_source_file(lo);
let hi = subst.parts.iter().map(|part| part.span.hi()).max()?;
let hi_file = sm.lookup_source_file(hi);
// The different spans might belong to different contexts, if so ignore suggestion.
if lo_file.stable_id != hi_file.stable_id {
return None;
}
// We can't splice anything if the source is unavailable.
if !sm.ensure_source_file_source_present(&lo_file) {
return None;
}
// Account for cases where we are suggesting the same code that's already
// there. This shouldn't happen often, but in some cases for multipart
// suggestions it's much easier to handle it here than in the origin.
subst.parts.retain(|p| is_different(sm, &p.snippet, p.span));
let item_span = subst.parts.first()?;
let file = sm.lookup_source_file(item_span.span.lo());
if should_show_source_code(
&self.ignored_directories_in_source_blocks,
sm,
&file,
) {
Some(subst)
} else {
None
}
if subst.parts.is_empty() { None } else { Some(subst) }
})
.collect::<Vec<_>>();
@ -745,14 +750,20 @@ fn shrink_file(
) -> Option<(Span, String, usize)> {
let lo_byte = spans.iter().map(|s| s.lo()).min()?;
let lo_loc = sm.lookup_char_pos(lo_byte);
let lo = lo_loc.file.line_bounds(lo_loc.line.saturating_sub(1)).start;
let hi_byte = spans.iter().map(|s| s.hi()).max()?;
let hi_loc = sm.lookup_char_pos(hi_byte);
let hi = lo_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
if lo_loc.file.stable_id != hi_loc.file.stable_id {
// this may happen when spans cross file boundaries due to macro expansion.
return None;
}
let lo = lo_loc.file.line_bounds(lo_loc.line.saturating_sub(1)).start;
let hi = hi_loc.file.line_bounds(hi_loc.line.saturating_sub(1)).end;
let bounding_span = Span::with_root_ctxt(lo, hi);
let source = sm.span_to_snippet(bounding_span).unwrap_or_default();
let source = sm.span_to_snippet(bounding_span).ok()?;
let offset_line = sm.doctest_offset_line(file_name, lo_loc.line);
Some((bounding_span, source, offset_line))

View file

@ -329,9 +329,6 @@ language_item_table! {
// Lang items needed for `format_args!()`.
FormatArgument, sym::format_argument, format_argument, Target::Struct, GenericRequirement::None;
FormatArguments, sym::format_arguments, format_arguments, Target::Struct, GenericRequirement::None;
FormatCount, sym::format_count, format_count, Target::Enum, GenericRequirement::None;
FormatPlaceholder, sym::format_placeholder, format_placeholder, Target::Struct, GenericRequirement::None;
FormatUnsafeArg, sym::format_unsafe_arg, format_unsafe_arg, Target::Struct, GenericRequirement::None;
ExchangeMalloc, sym::exchange_malloc, exchange_malloc_fn, Target::Fn, GenericRequirement::None;
DropInPlace, sym::drop_in_place, drop_in_place_fn, Target::Fn, GenericRequirement::Minimum(1);

View file

@ -191,7 +191,18 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
variant.fields.iter().map(move |field| {
let ty = field.ty(self.tcx, args);
// `field.ty()` doesn't normalize after instantiating.
let ty = self.tcx.normalize_erasing_regions(self.typing_env, ty);
let ty =
self.tcx.try_normalize_erasing_regions(self.typing_env, ty).unwrap_or_else(|e| {
self.tcx.dcx().span_delayed_bug(
self.scrut_span,
format!(
"Failed to normalize {:?} in typing_env={:?} while getting variant sub tys for {ty:?}",
e.get_type_for_failure(),
self.typing_env,
),
);
ty
});
let ty = self.reveal_opaque_ty(ty);
(field, ty)
})

View file

@ -1096,10 +1096,7 @@ symbols! {
format_args_nl,
format_argument,
format_arguments,
format_count,
format_macro,
format_placeholder,
format_unsafe_arg,
framework,
freeze,
freeze_impls,
@ -1114,7 +1111,9 @@ symbols! {
from_output,
from_residual,
from_size_align_unchecked,
from_str,
from_str_method,
from_str_nonconst,
from_u16,
from_usize,
from_yeet,

View file

@ -4,10 +4,12 @@
use crate::cell::{Cell, Ref, RefCell, RefMut, SyncUnsafeCell, UnsafeCell};
use crate::char::{EscapeDebugExtArgs, MAX_LEN_UTF8};
use crate::hint::assert_unchecked;
use crate::marker::{PhantomData, PointeeSized};
use crate::num::fmt as numfmt;
use crate::ops::Deref;
use crate::{iter, result, str};
use crate::ptr::NonNull;
use crate::{iter, mem, result, str};
mod builders;
#[cfg(not(no_fp_fmt_parse))]
@ -288,7 +290,7 @@ pub struct FormattingOptions {
/// ```text
/// 31 30 29 28 27 26 25 24 23 22 21 20 0
/// ┌───┬───────┬───┬───┬───┬───┬───┬───┬───┬───┬──────────────────────────────────┐
/// │ 1 │ align │ p │ w │ X?│ x?│'0'│ # │ - │ + │ fill │
/// │ 0 │ align │ p │ w │ X?│ x?│'0'│ # │ - │ + │ fill │
/// └───┴───────┴───┴───┴───┴───┴───┴───┴───┴───┴──────────────────────────────────┘
/// │ │ │ │ └─┬───────────────────┘ └─┬──────────────────────────────┘
/// │ │ │ │ │ └─ The fill character (21 bits char).
@ -299,12 +301,9 @@ pub struct FormattingOptions {
/// │ ├─ 1: Align right. (>)
/// │ ├─ 2: Align center. (^)
/// │ └─ 3: Alignment not set. (default)
/// └─ Always set.
/// This makes it possible to distinguish formatting flags from
/// a &str size when stored in (the upper bits of) the same field.
/// (fmt::Arguments will make use of this property in the future.)
/// └─ Always zero.
/// ```
// Note: This could use a special niche type with range 0x8000_0000..=0xfdd0ffff.
// Note: This could use a pattern type with range 0x0000_0000..=0x7dd0ffff.
// It's unclear if that's useful, though.
flags: u32,
/// Width if width flag (bit 27) above is set. Otherwise, always 0.
@ -328,7 +327,6 @@ mod flags {
pub(super) const ALIGN_RIGHT: u32 = 1 << 29;
pub(super) const ALIGN_CENTER: u32 = 2 << 29;
pub(super) const ALIGN_UNKNOWN: u32 = 3 << 29;
pub(super) const ALWAYS_SET: u32 = 1 << 31;
}
impl FormattingOptions {
@ -344,11 +342,7 @@ impl FormattingOptions {
/// - no [`DebugAsHex`] output mode.
#[unstable(feature = "formatting_options", issue = "118117")]
pub const fn new() -> Self {
Self {
flags: ' ' as u32 | flags::ALIGN_UNKNOWN | flags::ALWAYS_SET,
width: 0,
precision: 0,
}
Self { flags: ' ' as u32 | flags::ALIGN_UNKNOWN, width: 0, precision: 0 }
}
/// Sets or removes the sign (the `+` or the `-` flag).
@ -612,19 +606,152 @@ impl<'a> Formatter<'a> {
/// ```
///
/// [`format()`]: ../../std/fmt/fn.format.html
//
// Internal representation:
//
// fmt::Arguments is represented in one of two ways:
//
// 1) String literal representation (e.g. format_args!("hello"))
// ┌────────────────────────────────┐
// template: │ *const u8 │ ─▷ "hello"
// ├──────────────────────────────┬─┤
// args: │ len │1│ (lowest bit is 1; field contains `len << 1 | 1`)
// └──────────────────────────────┴─┘
// In this representation, there are no placeholders and `fmt::Arguments::as_str()` returns Some.
// The pointer points to the start of a static `str`. The length is given by `args as usize >> 1`.
// (The length of a `&str` is isize::MAX at most, so it always fits in a usize minus one bit.)
//
// `fmt::Arguments::from_str()` constructs this representation from a `&'static str`.
//
// 2) Placeholders representation (e.g. format_args!("hello {name}\n"))
// ┌────────────────────────────────┐
// template: │ *const u8 │ ─▷ b"\x06hello \x80\x01\n\x00"
// ├────────────────────────────────┤
// args: │ &'a [Argument<'a>; _] 0│ (lower bit is 0 due to alignment of Argument type)
// └────────────────────────────────┘
// In this representation, the template is a byte sequence encoding both the literal string pieces
// and the placeholders (including their options/flags).
//
// The `args` pointer points to an array of `fmt::Argument<'a>` values, of sufficient length to
// match the placeholders in the template.
//
// `fmt::Arguments::new()` constructs this representation from a template byte slice and a slice
// of arguments. This function is unsafe, as the template is assumed to be valid and the args
// slice is assumed to have elements matching the template.
//
// The template byte sequence is the concatenation of parts of the following types:
//
// - Literal string piece:
// Pieces that must be formatted verbatim (e.g. "hello " and "\n" in "hello {name}\n")
// appear literally in the template byte sequence, prefixed by their length.
//
// For pieces of up to 127 bytes, these are represented as a single byte containing the
// length followed directly by the bytes of the string:
// ┌───┬────────────────────────────┐
// │len│ `len` bytes (utf-8) │ (e.g. b"\x06hello ")
// └───┴────────────────────────────┘
//
// For larger pieces up to u16::MAX bytes, these are represented as a 0x80 followed by
// their length in 16-bit little endian, followed by the bytes of the string:
// ┌────┬─────────┬───────────────────────────┐
// │0x80│ len │ `len` bytes (utf-8) │ (e.g. b"\x80\x00\x01hello … ")
// └────┴─────────┴───────────────────────────┘
//
// Longer pieces are split into multiple pieces of max u16::MAX bytes (at utf-8 boundaries).
//
// - Placeholder:
// Placeholders (e.g. `{name}` in "hello {name}") are represented as a byte with the highest
// two bits set, followed by zero or more fields depending on the flags in the first byte:
// ┌──────────┬┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┬┄┄┄┄┄┄┄┄┄┄┄┬┄┄┄┄┄┄┄┄┄┄┄┬┄┄┄┄┄┄┄┄┄┄┄┐
// │0b11______│ flags ┊ width ┊ precision ┊ arg_index ┊ (e.g. b"\xC2\x05\0")
// └────││││││┴┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┴┄┄┄┄┄┄┄┄┄┄┄┴┄┄┄┄┄┄┄┄┄┄┄┴┄┄┄┄┄┄┄┄┄┄┄┘
// ││││││ 32 bit 16 bit 16 bit 16 bit
// │││││└─ flags present
// ││││└─ width present
// │││└─ precision present
// ││└─ arg_index present
// │└─ width indirect
// └─ precision indirect
//
// All fields other than the first byte are optional and only present when their
// corresponding flag is set in the first byte.
//
// So, a fully default placeholder without any options is just a single byte:
// ┌──────────┐
// │0b11000000│ (b"\xC0")
// └──────────┘
//
// The fields are stored as little endian.
//
// The `flags` fields corresponds to the `flags` field of `FormattingOptions`.
// See doc comment of `FormattingOptions::flags` for details.
//
// The `width` and `precision` fields correspond to their respective fields in
// `FormattingOptions`. However, if their "indirect" flag is set, the field contains the
// index in the `args` array where the dynamic width or precision is stored, rather than the
// value directly.
//
// The `arg_index` field is the index into the `args` array for the argument to be
// formatted.
//
// If omitted, the flags, width and precision of the default FormattingOptions::new() are
// used.
//
// If the `arg_index` is omitted, the next argument in the `args` array is used (starting
// at 0).
//
// - End:
// A single zero byte marks the end of the template:
// ┌───┐
// │ 0 │ ("\0")
// └───┘
//
// (Note that a zero byte may also occur naturally as part of the string pieces or flags,
// width, precision and arg_index fields above. That is, the template byte sequence ends
// with a 0 byte, but isn't terminated by the first 0 byte.)
//
#[lang = "format_arguments"]
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy, Clone)]
pub struct Arguments<'a> {
// Format string pieces to print.
pieces: &'a [&'static str],
template: NonNull<u8>,
args: NonNull<rt::Argument<'a>>,
}
// Placeholder specs, or `None` if all specs are default (as in "{}{}").
fmt: Option<&'a [rt::Placeholder]>,
/// Used by the format_args!() macro to create a fmt::Arguments object.
#[doc(hidden)]
#[rustc_diagnostic_item = "FmtArgumentsNew"]
#[unstable(feature = "fmt_internals", issue = "none")]
impl<'a> Arguments<'a> {
// SAFETY: The caller must ensure that the provided template and args encode a valid
// fmt::Arguments, as documented above.
#[inline]
pub unsafe fn new<const N: usize, const M: usize>(
template: &'a [u8; N],
args: &'a [rt::Argument<'a>; M],
) -> Arguments<'a> {
// SAFETY: Responsibility of the caller.
unsafe { Arguments { template: mem::transmute(template), args: mem::transmute(args) } }
}
// Dynamic arguments for interpolation, to be interleaved with string
// pieces. (Every argument is preceded by a string piece.)
args: &'a [rt::Argument<'a>],
#[inline]
pub const fn from_str(s: &'static str) -> Arguments<'a> {
// SAFETY: This is the "static str" representation of fmt::Arguments; see above.
unsafe {
Arguments {
template: mem::transmute(s.as_ptr()),
args: mem::transmute(s.len() << 1 | 1),
}
}
}
// Same as `from_str`, but not const.
// Used by format_args!() expansion when arguments are inlined,
// e.g. format_args!("{}", 123), which is not allowed in const.
#[inline]
pub fn from_str_nonconst(s: &'static str) -> Arguments<'a> {
Arguments::from_str(s)
}
}
#[doc(hidden)]
@ -636,20 +763,56 @@ impl<'a> Arguments<'a> {
/// when using `format!`. Note: this is neither the lower nor upper bound.
#[inline]
pub fn estimated_capacity(&self) -> usize {
let pieces_length: usize = self.pieces.iter().map(|x| x.len()).sum();
if let Some(s) = self.as_str() {
return s.len();
}
// Iterate over the template, counting the length of literal pieces.
let mut length = 0usize;
let mut starts_with_placeholder = false;
let mut template = self.template;
loop {
// SAFETY: We can assume the template is valid.
unsafe {
let n = template.read();
template = template.add(1);
if n == 0 {
// End of template.
break;
} else if n < 128 {
// Short literal string piece.
length += n as usize;
template = template.add(n as usize);
} else if n == 128 {
// Long literal string piece.
let len = usize::from(u16::from_le_bytes(template.cast_array().read()));
length += len;
template = template.add(2 + len);
} else {
assert_unchecked(n >= 0xC0);
// Placeholder piece.
if length == 0 {
starts_with_placeholder = true;
}
// Skip remainder of placeholder:
let skip = (n & 1 != 0) as usize * 4 // flags (32 bit)
+ (n & 2 != 0) as usize * 2 // width (16 bit)
+ (n & 4 != 0) as usize * 2 // precision (16 bit)
+ (n & 8 != 0) as usize * 2; // arg_index (16 bit)
template = template.add(skip as usize);
}
}
}
if self.args.is_empty() {
pieces_length
} else if !self.pieces.is_empty() && self.pieces[0].is_empty() && pieces_length < 16 {
// If the format string starts with an argument,
if starts_with_placeholder && length < 16 {
// If the format string starts with a placeholder,
// don't preallocate anything, unless length
// of pieces is significant.
// of literal pieces is significant.
0
} else {
// There are some arguments, so any additional push
// There are some placeholders, so any additional push
// will reallocate the string. To avoid that,
// we're "pre-doubling" the capacity here.
pieces_length.checked_mul(2).unwrap_or(0)
length.wrapping_mul(2)
}
}
}
@ -702,10 +865,22 @@ impl<'a> Arguments<'a> {
#[must_use]
#[inline]
pub const fn as_str(&self) -> Option<&'static str> {
match (self.pieces, self.args) {
([], []) => Some(""),
([s], []) => Some(s),
_ => None,
// SAFETY: During const eval, `self.args` must have come from a usize,
// not a pointer, because that's the only way to create a fmt::Arguments in const.
// (I.e. only fmt::Arguments::from_str is const, fmt::Arguments::new is not.)
//
// Outside const eval, transmuting a pointer to a usize is fine.
let bits: usize = unsafe { mem::transmute(self.args) };
if bits & 1 == 1 {
// SAFETY: This fmt::Arguments stores a &'static str. See encoding documentation above.
Some(unsafe {
str::from_utf8_unchecked(crate::slice::from_raw_parts(
self.template.as_ptr(),
bits >> 1,
))
})
} else {
None
}
}
@ -1448,86 +1623,113 @@ pub trait UpperExp: PointeeSized {
///
/// [`write!`]: crate::write!
#[stable(feature = "rust1", since = "1.0.0")]
pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result {
let mut formatter = Formatter::new(output, FormattingOptions::new());
let mut idx = 0;
pub fn write(output: &mut dyn Write, fmt: Arguments<'_>) -> Result {
if let Some(s) = fmt.as_str() {
return output.write_str(s);
}
match args.fmt {
None => {
// We can use default formatting parameters for all arguments.
for (i, arg) in args.args.iter().enumerate() {
// SAFETY: args.args and args.pieces come from the same Arguments,
// which guarantees the indexes are always within bounds.
let piece = unsafe { args.pieces.get_unchecked(i) };
if !piece.is_empty() {
formatter.buf.write_str(*piece)?;
let mut template = fmt.template;
let args = fmt.args;
let mut arg_index = 0;
// See comment on `fmt::Arguments` for the details of how the template is encoded.
// This must match the encoding from `expand_format_args` in
// compiler/rustc_ast_lowering/src/format.rs.
loop {
// SAFETY: We can assume the template is valid.
let n = unsafe {
let n = template.read();
template = template.add(1);
n
};
if n == 0 {
// End of template.
return Ok(());
} else if n < 0x80 {
// Literal string piece of length `n`.
// SAFETY: We can assume the strings in the template are valid.
let s = unsafe {
let s = crate::str::from_raw_parts(template.as_ptr(), n as usize);
template = template.add(n as usize);
s
};
output.write_str(s)?;
} else if n == 0x80 {
// Literal string piece with a 16-bit length.
// SAFETY: We can assume the strings in the template are valid.
let s = unsafe {
let len = usize::from(u16::from_le_bytes(template.cast_array().read()));
template = template.add(2);
let s = crate::str::from_raw_parts(template.as_ptr(), len);
template = template.add(len);
s
};
output.write_str(s)?;
} else if n == 0xC0 {
// Placeholder for next argument with default options.
//
// Having this as a separate case improves performance for the common case.
// SAFETY: We can assume the template only refers to arguments that exist.
unsafe {
args.add(arg_index)
.as_ref()
.fmt(&mut Formatter::new(output, FormattingOptions::new()))?;
}
arg_index += 1;
} else {
// SAFETY: We can assume the template is valid.
unsafe { assert_unchecked(n > 0xC0) };
// Placeholder with custom options.
let mut opt = FormattingOptions::new();
// SAFETY: We can assume the template is valid.
unsafe {
if n & 1 != 0 {
opt.flags = u32::from_le_bytes(template.cast_array().read());
template = template.add(4);
}
// SAFETY: There are no formatting parameters and hence no
// count arguments.
if n & 2 != 0 {
opt.width = u16::from_le_bytes(template.cast_array().read());
template = template.add(2);
}
if n & 4 != 0 {
opt.precision = u16::from_le_bytes(template.cast_array().read());
template = template.add(2);
}
if n & 8 != 0 {
arg_index = usize::from(u16::from_le_bytes(template.cast_array().read()));
template = template.add(2);
}
}
if n & 16 != 0 {
// Dynamic width from a usize argument.
// SAFETY: We can assume the template only refers to arguments that exist.
unsafe {
arg.fmt(&mut formatter)?;
opt.width = args.add(opt.width as usize).as_ref().as_u16().unwrap_unchecked();
}
idx += 1;
}
}
Some(fmt) => {
// Every spec has a corresponding argument that is preceded by
// a string piece.
for (i, arg) in fmt.iter().enumerate() {
// SAFETY: fmt and args.pieces come from the same Arguments,
// which guarantees the indexes are always within bounds.
let piece = unsafe { args.pieces.get_unchecked(i) };
if !piece.is_empty() {
formatter.buf.write_str(*piece)?;
if n & 32 != 0 {
// Dynamic precision from a usize argument.
// SAFETY: We can assume the template only refers to arguments that exist.
unsafe {
opt.precision =
args.add(opt.precision as usize).as_ref().as_u16().unwrap_unchecked();
}
// SAFETY: arg and args.args come from the same Arguments,
// which guarantees the indexes are always within bounds.
unsafe { run(&mut formatter, arg, args.args) }?;
idx += 1;
}
}
}
// There can be only one trailing string piece left.
if let Some(piece) = args.pieces.get(idx) {
formatter.buf.write_str(*piece)?;
}
Ok(())
}
unsafe fn run(fmt: &mut Formatter<'_>, arg: &rt::Placeholder, args: &[rt::Argument<'_>]) -> Result {
let (width, precision) =
// SAFETY: arg and args come from the same Arguments,
// which guarantees the indexes are always within bounds.
unsafe { (getcount(args, &arg.width), getcount(args, &arg.precision)) };
let options = FormattingOptions { flags: arg.flags, width, precision };
// Extract the correct argument
debug_assert!(arg.position < args.len());
// SAFETY: arg and args come from the same Arguments,
// which guarantees its index is always within bounds.
let value = unsafe { args.get_unchecked(arg.position) };
// Set all the formatting options.
fmt.options = options;
// Then actually do some printing
// SAFETY: this is a placeholder argument.
unsafe { value.fmt(fmt) }
}
unsafe fn getcount(args: &[rt::Argument<'_>], cnt: &rt::Count) -> u16 {
match *cnt {
rt::Count::Is(n) => n,
rt::Count::Implied => 0,
rt::Count::Param(i) => {
debug_assert!(i < args.len());
// SAFETY: cnt and args come from the same Arguments,
// which guarantees this index is always within bounds.
unsafe { args.get_unchecked(i).as_u16().unwrap_unchecked() }
// SAFETY: We can assume the template only refers to arguments that exist.
unsafe {
args.add(arg_index).as_ref().fmt(&mut Formatter::new(output, opt))?;
}
arg_index += 1;
}
}
}

View file

@ -10,28 +10,6 @@ use super::*;
use crate::hint::unreachable_unchecked;
use crate::ptr::NonNull;
#[lang = "format_placeholder"]
#[derive(Copy, Clone)]
pub struct Placeholder {
pub position: usize,
pub flags: u32,
pub precision: Count,
pub width: Count,
}
/// Used by [width](https://doc.rust-lang.org/std/fmt/#width)
/// and [precision](https://doc.rust-lang.org/std/fmt/#precision) specifiers.
#[lang = "format_count"]
#[derive(Copy, Clone)]
pub enum Count {
/// Specified with a literal number, stores the value
Is(u16),
/// Specified using `$` and `*` syntaxes, stores the index into `args`
Param(usize),
/// Not specified
Implied,
}
#[derive(Copy, Clone)]
enum ArgumentType<'a> {
Placeholder {
@ -56,6 +34,7 @@ enum ArgumentType<'a> {
/// precision and width.
#[lang = "format_argument"]
#[derive(Copy, Clone)]
#[repr(align(2))] // To ensure pointers to this struct always have their lowest bit cleared.
pub struct Argument<'a> {
ty: ArgumentType<'a>,
}
@ -184,55 +163,3 @@ impl Argument<'_> {
}
}
}
/// Used by the format_args!() macro to create a fmt::Arguments object.
#[doc(hidden)]
#[unstable(feature = "fmt_internals", issue = "none")]
#[rustc_diagnostic_item = "FmtArgumentsNew"]
impl<'a> Arguments<'a> {
#[inline]
pub const fn new_const<const N: usize>(pieces: &'a [&'static str; N]) -> Self {
const { assert!(N <= 1) };
Arguments { pieces, fmt: None, args: &[] }
}
/// When using the format_args!() macro, this function is used to generate the
/// Arguments structure.
///
/// This function should _not_ be const, to make sure we don't accept
/// format_args!() and panic!() with arguments in const, even when not evaluated:
///
/// ```compile_fail,E0015
/// const _: () = if false { panic!("a {}", "a") };
/// ```
#[inline]
pub fn new_v1<const P: usize, const A: usize>(
pieces: &'a [&'static str; P],
args: &'a [rt::Argument<'a>; A],
) -> Arguments<'a> {
const { assert!(P >= A && P <= A + 1, "invalid args") }
Arguments { pieces, fmt: None, args }
}
/// Specifies nonstandard formatting parameters.
///
/// SAFETY: the following invariants must be held:
/// 1. The `pieces` slice must be at least as long as `fmt`.
/// 2. Every `rt::Placeholder::position` value within `fmt` must be a valid index of `args`.
/// 3. Every `rt::Count::Param` within `fmt` must contain a valid index of `args`.
///
/// This function should _not_ be const, to make sure we don't accept
/// format_args!() and panic!() with arguments in const, even when not evaluated:
///
/// ```compile_fail,E0015
/// const _: () = if false { panic!("a {:1}", "a") };
/// ```
#[inline]
pub unsafe fn new_v1_formatted(
pieces: &'a [&'static str],
args: &'a [rt::Argument<'a>],
fmt: &'a [rt::Placeholder],
) -> Arguments<'a> {
Arguments { pieces, fmt: Some(fmt), args }
}
}

View file

@ -136,18 +136,18 @@ pub const fn panic_nounwind_fmt(fmt: fmt::Arguments<'_>, force_no_backtrace: boo
#[rustc_const_stable_indirect] // must follow stable const rules since it is exposed to stable
#[lang = "panic"] // used by lints and miri for panics
pub const fn panic(expr: &'static str) -> ! {
// Use Arguments::new_const instead of format_args!("{expr}") to potentially
// Use Arguments::from_str instead of format_args!("{expr}") to potentially
// reduce size overhead. The format_args! macro uses str's Display trait to
// write expr, which calls Formatter::pad, which must accommodate string
// truncation and padding (even though none is used here). Using
// Arguments::new_const may allow the compiler to omit Formatter::pad from the
// Arguments::from_str may allow the compiler to omit Formatter::pad from the
// output binary, saving up to a few kilobytes.
// However, this optimization only works for `'static` strings: `new_const` also makes this
// However, this optimization only works for `'static` strings: `from_str` also makes this
// message return `Some` from `Arguments::as_str`, which means it can become part of the panic
// payload without any allocation or copying. Shorter-lived strings would become invalid as
// stack frames get popped during unwinding, and couldn't be directly referenced from the
// payload.
panic_fmt(fmt::Arguments::new_const(&[expr]));
panic_fmt(fmt::Arguments::from_str(expr));
}
// We generate functions for usage by compiler-generated assertions.
@ -171,13 +171,8 @@ macro_rules! panic_const {
#[rustc_const_stable_indirect] // must follow stable const rules since it is exposed to stable
#[lang = stringify!($lang)]
pub const fn $lang() -> ! {
// Use Arguments::new_const instead of format_args!("{expr}") to potentially
// reduce size overhead. The format_args! macro uses str's Display trait to
// write expr, which calls Formatter::pad, which must accommodate string
// truncation and padding (even though none is used here). Using
// Arguments::new_const may allow the compiler to omit Formatter::pad from the
// output binary, saving up to a few kilobytes.
panic_fmt(fmt::Arguments::new_const(&[$message]));
// See the comment in `panic(&'static str)` for why we use `Arguments::from_str` here.
panic_fmt(fmt::Arguments::from_str($message));
}
)+
}
@ -227,7 +222,7 @@ pub mod panic_const {
#[rustc_nounwind]
#[rustc_const_stable_indirect] // must follow stable const rules since it is exposed to stable
pub const fn panic_nounwind(expr: &'static str) -> ! {
panic_nounwind_fmt(fmt::Arguments::new_const(&[expr]), /* force_no_backtrace */ false);
panic_nounwind_fmt(fmt::Arguments::from_str(expr), /* force_no_backtrace */ false);
}
/// Like `panic_nounwind`, but also inhibits showing a backtrace.
@ -235,7 +230,7 @@ pub const fn panic_nounwind(expr: &'static str) -> ! {
#[cfg_attr(panic = "immediate-abort", inline)]
#[rustc_nounwind]
pub fn panic_nounwind_nobacktrace(expr: &'static str) -> ! {
panic_nounwind_fmt(fmt::Arguments::new_const(&[expr]), /* force_no_backtrace */ true);
panic_nounwind_fmt(fmt::Arguments::from_str(expr), /* force_no_backtrace */ true);
}
#[inline]

View file

@ -317,7 +317,6 @@ impl Duration {
/// # Examples
///
/// ```
/// #![feature(duration_from_nanos_u128)]
/// use std::time::Duration;
///
/// let nanos = 10_u128.pow(24) + 321;
@ -326,12 +325,12 @@ impl Duration {
/// assert_eq!(10_u64.pow(15), duration.as_secs());
/// assert_eq!(321, duration.subsec_nanos());
/// ```
#[unstable(feature = "duration_from_nanos_u128", issue = "139201")]
// This is necessary because of const `try_from`, but can be removed if a trait-free impl is used instead
#[rustc_const_unstable(feature = "duration_from_nanos_u128", issue = "139201")]
#[stable(feature = "duration_from_nanos_u128", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "duration_from_nanos_u128", since = "CURRENT_RUSTC_VERSION")]
#[must_use]
#[inline]
#[track_caller]
#[rustc_allow_const_fn_unstable(const_trait_impl, const_convert)] // for `u64::try_from`
pub const fn from_nanos_u128(nanos: u128) -> Duration {
const NANOS_PER_SEC: u128 = self::NANOS_PER_SEC as u128;
let Ok(secs) = u64::try_from(nanos / NANOS_PER_SEC) else {

View file

@ -70,7 +70,7 @@ macro_rules! assert_unsafe_precondition {
let msg = concat!("unsafe precondition(s) violated: ", $message,
"\n\nThis indicates a bug in the program. \
This Undefined Behavior check is optional, and cannot be relied on for safety.");
::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::new_const(&[msg]), false);
::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg), false);
}
}

View file

@ -42,7 +42,6 @@
#![feature(drop_guard)]
#![feature(duration_constants)]
#![feature(duration_constructors)]
#![feature(duration_from_nanos_u128)]
#![feature(error_generic_member_access)]
#![feature(exact_div)]
#![feature(exact_size_is_empty)]

View file

@ -3413,6 +3413,13 @@ impl Step for Bootstrap {
.env("INSTA_WORKSPACE_ROOT", &builder.src)
.env("RUSTC_BOOTSTRAP", "1");
if builder.config.cmd.bless() {
// Tell `insta` to automatically bless any failing `.snap` files.
// Unlike compiletest blessing, the tests might still report failure.
// Does not bless inline snapshots.
cargo.env("INSTA_UPDATE", "always");
}
run_cargo_test(cargo, &[], &[], None, host, builder);
}

View file

@ -7,6 +7,9 @@ use std::path::PathBuf;
use crate::core::builder::{Builder, Kind, PathSet, ShouldRun, StepDescription};
#[cfg(test)]
mod tests;
pub(crate) const PATH_REMAP: &[(&str, &[&str])] = &[
// bootstrap.toml uses `rust-analyzer-proc-macro-srv`, but the
// actual path is `proc-macro-srv-cli`

View file

@ -0,0 +1,23 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: build
---
[Build] compile::Std
targets: [aarch64-unknown-linux-gnu]
- Set({build::library})
- Set({build::library/alloc})
- Set({build::library/compiler-builtins/compiler-builtins})
- Set({build::library/core})
- Set({build::library/panic_abort})
- Set({build::library/panic_unwind})
- Set({build::library/proc_macro})
- Set({build::library/rustc-std-workspace-core})
- Set({build::library/std})
- Set({build::library/std_detect})
- Set({build::library/sysroot})
- Set({build::library/test})
- Set({build::library/unwind})
[Build] tool::Rustdoc
targets: [x86_64-unknown-linux-gnu]
- Set({build::src/librustdoc})
- Set({build::src/tools/rustdoc})

View file

@ -0,0 +1,84 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: build compiler
---
[Build] compile::Rustc
targets: [x86_64-unknown-linux-gnu]
- Set({build::compiler/rustc_abi})
- Set({build::compiler/rustc_arena})
- Set({build::compiler/rustc_ast})
- Set({build::compiler/rustc_ast_ir})
- Set({build::compiler/rustc_ast_lowering})
- Set({build::compiler/rustc_ast_passes})
- Set({build::compiler/rustc_ast_pretty})
- Set({build::compiler/rustc_attr_parsing})
- Set({build::compiler/rustc_baked_icu_data})
- Set({build::compiler/rustc_borrowck})
- Set({build::compiler/rustc_builtin_macros})
- Set({build::compiler/rustc_codegen_llvm})
- Set({build::compiler/rustc_codegen_ssa})
- Set({build::compiler/rustc_const_eval})
- Set({build::compiler/rustc_data_structures})
- Set({build::compiler/rustc_driver})
- Set({build::compiler/rustc_driver_impl})
- Set({build::compiler/rustc_error_codes})
- Set({build::compiler/rustc_error_messages})
- Set({build::compiler/rustc_errors})
- Set({build::compiler/rustc_expand})
- Set({build::compiler/rustc_feature})
- Set({build::compiler/rustc_fluent_macro})
- Set({build::compiler/rustc_fs_util})
- Set({build::compiler/rustc_graphviz})
- Set({build::compiler/rustc_hashes})
- Set({build::compiler/rustc_hir})
- Set({build::compiler/rustc_hir_analysis})
- Set({build::compiler/rustc_hir_id})
- Set({build::compiler/rustc_hir_pretty})
- Set({build::compiler/rustc_hir_typeck})
- Set({build::compiler/rustc_incremental})
- Set({build::compiler/rustc_index})
- Set({build::compiler/rustc_index_macros})
- Set({build::compiler/rustc_infer})
- Set({build::compiler/rustc_interface})
- Set({build::compiler/rustc_lexer})
- Set({build::compiler/rustc_lint})
- Set({build::compiler/rustc_lint_defs})
- Set({build::compiler/rustc_llvm})
- Set({build::compiler/rustc_log})
- Set({build::compiler/rustc_macros})
- Set({build::compiler/rustc_metadata})
- Set({build::compiler/rustc_middle})
- Set({build::compiler/rustc_mir_build})
- Set({build::compiler/rustc_mir_dataflow})
- Set({build::compiler/rustc_mir_transform})
- Set({build::compiler/rustc_monomorphize})
- Set({build::compiler/rustc_next_trait_solver})
- Set({build::compiler/rustc_parse})
- Set({build::compiler/rustc_parse_format})
- Set({build::compiler/rustc_passes})
- Set({build::compiler/rustc_pattern_analysis})
- Set({build::compiler/rustc_privacy})
- Set({build::compiler/rustc_proc_macro})
- Set({build::compiler/rustc_public})
- Set({build::compiler/rustc_public_bridge})
- Set({build::compiler/rustc_query_impl})
- Set({build::compiler/rustc_query_system})
- Set({build::compiler/rustc_resolve})
- Set({build::compiler/rustc_sanitizers})
- Set({build::compiler/rustc_serialize})
- Set({build::compiler/rustc_session})
- Set({build::compiler/rustc_span})
- Set({build::compiler/rustc_symbol_mangling})
- Set({build::compiler/rustc_target})
- Set({build::compiler/rustc_thread_pool})
- Set({build::compiler/rustc_trait_selection})
- Set({build::compiler/rustc_traits})
- Set({build::compiler/rustc_transmute})
- Set({build::compiler/rustc_ty_utils})
- Set({build::compiler/rustc_type_ir})
- Set({build::compiler/rustc_type_ir_macros})
- Set({build::compiler/rustc_windows_rc})
[Build] compile::Assemble
targets: [x86_64-unknown-linux-gnu]
- Set({build::compiler})
- Set({build::compiler/rustc})

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: build compiletest
---
[Build] tool::Compiletest
targets: [aarch64-unknown-linux-gnu]
- Set({build::src/tools/compiletest})

View file

@ -0,0 +1,22 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: build library
---
[Build] compile::Std
targets: [aarch64-unknown-linux-gnu]
- Set({build::library})
- Set({build::library/alloc})
- Set({build::library/compiler-builtins/compiler-builtins})
- Set({build::library/core})
- Set({build::library/panic_abort})
- Set({build::library/panic_unwind})
- Set({build::library/proc_macro})
- Set({build::library/rustc-std-workspace-core})
- Set({build::library/std})
- Set({build::library/std_detect})
- Set({build::library/sysroot})
- Set({build::library/test})
- Set({build::library/unwind})
[Build] compile::StartupObjects
targets: [aarch64-unknown-linux-gnu]
- Set({build::library/rtstartup})

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: build llvm
---
[Build] llvm::Llvm
targets: [x86_64-unknown-linux-gnu]
- Set({build::src/llvm-project/llvm})

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: build rustc
---
[Build] compile::Assemble
targets: [x86_64-unknown-linux-gnu]
- Set({build::compiler/rustc})

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: build rustc_llvm
---
[Build] compile::Rustc
targets: [x86_64-unknown-linux-gnu]
- Set({build::compiler/rustc_llvm})

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: build rustdoc
---
[Build] tool::Rustdoc
targets: [x86_64-unknown-linux-gnu]
- Set({build::src/tools/rustdoc})

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: build sysroot
---
[Build] compile::Std
targets: [aarch64-unknown-linux-gnu]
- Set({build::library/sysroot})

View file

@ -0,0 +1,134 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: check
---
[Check] check::Rustc
targets: [x86_64-unknown-linux-gnu]
- Set({check::compiler})
- Set({check::compiler/rustc})
- Set({check::compiler/rustc_abi})
- Set({check::compiler/rustc_arena})
- Set({check::compiler/rustc_ast})
- Set({check::compiler/rustc_ast_ir})
- Set({check::compiler/rustc_ast_lowering})
- Set({check::compiler/rustc_ast_passes})
- Set({check::compiler/rustc_ast_pretty})
- Set({check::compiler/rustc_attr_parsing})
- Set({check::compiler/rustc_baked_icu_data})
- Set({check::compiler/rustc_borrowck})
- Set({check::compiler/rustc_builtin_macros})
- Set({check::compiler/rustc_codegen_llvm})
- Set({check::compiler/rustc_codegen_ssa})
- Set({check::compiler/rustc_const_eval})
- Set({check::compiler/rustc_data_structures})
- Set({check::compiler/rustc_driver})
- Set({check::compiler/rustc_driver_impl})
- Set({check::compiler/rustc_error_codes})
- Set({check::compiler/rustc_error_messages})
- Set({check::compiler/rustc_errors})
- Set({check::compiler/rustc_expand})
- Set({check::compiler/rustc_feature})
- Set({check::compiler/rustc_fluent_macro})
- Set({check::compiler/rustc_fs_util})
- Set({check::compiler/rustc_graphviz})
- Set({check::compiler/rustc_hashes})
- Set({check::compiler/rustc_hir})
- Set({check::compiler/rustc_hir_analysis})
- Set({check::compiler/rustc_hir_id})
- Set({check::compiler/rustc_hir_pretty})
- Set({check::compiler/rustc_hir_typeck})
- Set({check::compiler/rustc_incremental})
- Set({check::compiler/rustc_index})
- Set({check::compiler/rustc_index_macros})
- Set({check::compiler/rustc_infer})
- Set({check::compiler/rustc_interface})
- Set({check::compiler/rustc_lexer})
- Set({check::compiler/rustc_lint})
- Set({check::compiler/rustc_lint_defs})
- Set({check::compiler/rustc_llvm})
- Set({check::compiler/rustc_log})
- Set({check::compiler/rustc_macros})
- Set({check::compiler/rustc_metadata})
- Set({check::compiler/rustc_middle})
- Set({check::compiler/rustc_mir_build})
- Set({check::compiler/rustc_mir_dataflow})
- Set({check::compiler/rustc_mir_transform})
- Set({check::compiler/rustc_monomorphize})
- Set({check::compiler/rustc_next_trait_solver})
- Set({check::compiler/rustc_parse})
- Set({check::compiler/rustc_parse_format})
- Set({check::compiler/rustc_passes})
- Set({check::compiler/rustc_pattern_analysis})
- Set({check::compiler/rustc_privacy})
- Set({check::compiler/rustc_proc_macro})
- Set({check::compiler/rustc_public})
- Set({check::compiler/rustc_public_bridge})
- Set({check::compiler/rustc_query_impl})
- Set({check::compiler/rustc_query_system})
- Set({check::compiler/rustc_resolve})
- Set({check::compiler/rustc_sanitizers})
- Set({check::compiler/rustc_serialize})
- Set({check::compiler/rustc_session})
- Set({check::compiler/rustc_span})
- Set({check::compiler/rustc_symbol_mangling})
- Set({check::compiler/rustc_target})
- Set({check::compiler/rustc_thread_pool})
- Set({check::compiler/rustc_trait_selection})
- Set({check::compiler/rustc_traits})
- Set({check::compiler/rustc_transmute})
- Set({check::compiler/rustc_ty_utils})
- Set({check::compiler/rustc_type_ir})
- Set({check::compiler/rustc_type_ir_macros})
- Set({check::compiler/rustc_windows_rc})
[Check] check::Rustdoc
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/librustdoc, check::src/tools/rustdoc})
[Check] check::CraneliftCodegenBackend
targets: [x86_64-unknown-linux-gnu]
- Set({check::cg_clif})
- Set({check::rustc_codegen_cranelift})
[Check] check::GccCodegenBackend
targets: [x86_64-unknown-linux-gnu]
- Set({check::cg_gcc})
- Set({check::rustc_codegen_gcc})
[Check] check::Clippy
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/clippy})
[Check] check::Miri
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/miri})
[Check] check::CargoMiri
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/miri/cargo-miri})
[Check] check::MiroptTestTools
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/miropt-test-tools})
[Check] check::Rustfmt
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/rustfmt})
[Check] check::RustAnalyzer
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/rust-analyzer})
[Check] check::TestFloatParse
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/test-float-parse})
[Check] check::FeaturesStatusDump
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/features-status-dump})
[Check] check::Std
targets: [aarch64-unknown-linux-gnu]
- Set({check::library})
- Set({check::library/alloc})
- Set({check::library/alloctests})
- Set({check::library/compiler-builtins/compiler-builtins})
- Set({check::library/core})
- Set({check::library/coretests})
- Set({check::library/panic_abort})
- Set({check::library/panic_unwind})
- Set({check::library/proc_macro})
- Set({check::library/rustc-std-workspace-core})
- Set({check::library/std})
- Set({check::library/std_detect})
- Set({check::library/sysroot})
- Set({check::library/test})
- Set({check::library/unwind})

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: check bootstrap
---
[Check] check::Bootstrap
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/bootstrap})

View file

@ -0,0 +1,82 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: check compiler
---
[Check] check::Rustc
targets: [x86_64-unknown-linux-gnu]
- Set({check::compiler})
- Set({check::compiler/rustc})
- Set({check::compiler/rustc_abi})
- Set({check::compiler/rustc_arena})
- Set({check::compiler/rustc_ast})
- Set({check::compiler/rustc_ast_ir})
- Set({check::compiler/rustc_ast_lowering})
- Set({check::compiler/rustc_ast_passes})
- Set({check::compiler/rustc_ast_pretty})
- Set({check::compiler/rustc_attr_parsing})
- Set({check::compiler/rustc_baked_icu_data})
- Set({check::compiler/rustc_borrowck})
- Set({check::compiler/rustc_builtin_macros})
- Set({check::compiler/rustc_codegen_llvm})
- Set({check::compiler/rustc_codegen_ssa})
- Set({check::compiler/rustc_const_eval})
- Set({check::compiler/rustc_data_structures})
- Set({check::compiler/rustc_driver})
- Set({check::compiler/rustc_driver_impl})
- Set({check::compiler/rustc_error_codes})
- Set({check::compiler/rustc_error_messages})
- Set({check::compiler/rustc_errors})
- Set({check::compiler/rustc_expand})
- Set({check::compiler/rustc_feature})
- Set({check::compiler/rustc_fluent_macro})
- Set({check::compiler/rustc_fs_util})
- Set({check::compiler/rustc_graphviz})
- Set({check::compiler/rustc_hashes})
- Set({check::compiler/rustc_hir})
- Set({check::compiler/rustc_hir_analysis})
- Set({check::compiler/rustc_hir_id})
- Set({check::compiler/rustc_hir_pretty})
- Set({check::compiler/rustc_hir_typeck})
- Set({check::compiler/rustc_incremental})
- Set({check::compiler/rustc_index})
- Set({check::compiler/rustc_index_macros})
- Set({check::compiler/rustc_infer})
- Set({check::compiler/rustc_interface})
- Set({check::compiler/rustc_lexer})
- Set({check::compiler/rustc_lint})
- Set({check::compiler/rustc_lint_defs})
- Set({check::compiler/rustc_llvm})
- Set({check::compiler/rustc_log})
- Set({check::compiler/rustc_macros})
- Set({check::compiler/rustc_metadata})
- Set({check::compiler/rustc_middle})
- Set({check::compiler/rustc_mir_build})
- Set({check::compiler/rustc_mir_dataflow})
- Set({check::compiler/rustc_mir_transform})
- Set({check::compiler/rustc_monomorphize})
- Set({check::compiler/rustc_next_trait_solver})
- Set({check::compiler/rustc_parse})
- Set({check::compiler/rustc_parse_format})
- Set({check::compiler/rustc_passes})
- Set({check::compiler/rustc_pattern_analysis})
- Set({check::compiler/rustc_privacy})
- Set({check::compiler/rustc_proc_macro})
- Set({check::compiler/rustc_public})
- Set({check::compiler/rustc_public_bridge})
- Set({check::compiler/rustc_query_impl})
- Set({check::compiler/rustc_query_system})
- Set({check::compiler/rustc_resolve})
- Set({check::compiler/rustc_sanitizers})
- Set({check::compiler/rustc_serialize})
- Set({check::compiler/rustc_session})
- Set({check::compiler/rustc_span})
- Set({check::compiler/rustc_symbol_mangling})
- Set({check::compiler/rustc_target})
- Set({check::compiler/rustc_thread_pool})
- Set({check::compiler/rustc_trait_selection})
- Set({check::compiler/rustc_traits})
- Set({check::compiler/rustc_transmute})
- Set({check::compiler/rustc_ty_utils})
- Set({check::compiler/rustc_type_ir})
- Set({check::compiler/rustc_type_ir_macros})
- Set({check::compiler/rustc_windows_rc})

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: check compiletest
---
[Check] check::Compiletest
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/compiletest})

View file

@ -0,0 +1,137 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: check compiletest --include-default-paths
---
[Check] check::Rustc
targets: [x86_64-unknown-linux-gnu]
- Set({check::compiler})
- Set({check::compiler/rustc})
- Set({check::compiler/rustc_abi})
- Set({check::compiler/rustc_arena})
- Set({check::compiler/rustc_ast})
- Set({check::compiler/rustc_ast_ir})
- Set({check::compiler/rustc_ast_lowering})
- Set({check::compiler/rustc_ast_passes})
- Set({check::compiler/rustc_ast_pretty})
- Set({check::compiler/rustc_attr_parsing})
- Set({check::compiler/rustc_baked_icu_data})
- Set({check::compiler/rustc_borrowck})
- Set({check::compiler/rustc_builtin_macros})
- Set({check::compiler/rustc_codegen_llvm})
- Set({check::compiler/rustc_codegen_ssa})
- Set({check::compiler/rustc_const_eval})
- Set({check::compiler/rustc_data_structures})
- Set({check::compiler/rustc_driver})
- Set({check::compiler/rustc_driver_impl})
- Set({check::compiler/rustc_error_codes})
- Set({check::compiler/rustc_error_messages})
- Set({check::compiler/rustc_errors})
- Set({check::compiler/rustc_expand})
- Set({check::compiler/rustc_feature})
- Set({check::compiler/rustc_fluent_macro})
- Set({check::compiler/rustc_fs_util})
- Set({check::compiler/rustc_graphviz})
- Set({check::compiler/rustc_hashes})
- Set({check::compiler/rustc_hir})
- Set({check::compiler/rustc_hir_analysis})
- Set({check::compiler/rustc_hir_id})
- Set({check::compiler/rustc_hir_pretty})
- Set({check::compiler/rustc_hir_typeck})
- Set({check::compiler/rustc_incremental})
- Set({check::compiler/rustc_index})
- Set({check::compiler/rustc_index_macros})
- Set({check::compiler/rustc_infer})
- Set({check::compiler/rustc_interface})
- Set({check::compiler/rustc_lexer})
- Set({check::compiler/rustc_lint})
- Set({check::compiler/rustc_lint_defs})
- Set({check::compiler/rustc_llvm})
- Set({check::compiler/rustc_log})
- Set({check::compiler/rustc_macros})
- Set({check::compiler/rustc_metadata})
- Set({check::compiler/rustc_middle})
- Set({check::compiler/rustc_mir_build})
- Set({check::compiler/rustc_mir_dataflow})
- Set({check::compiler/rustc_mir_transform})
- Set({check::compiler/rustc_monomorphize})
- Set({check::compiler/rustc_next_trait_solver})
- Set({check::compiler/rustc_parse})
- Set({check::compiler/rustc_parse_format})
- Set({check::compiler/rustc_passes})
- Set({check::compiler/rustc_pattern_analysis})
- Set({check::compiler/rustc_privacy})
- Set({check::compiler/rustc_proc_macro})
- Set({check::compiler/rustc_public})
- Set({check::compiler/rustc_public_bridge})
- Set({check::compiler/rustc_query_impl})
- Set({check::compiler/rustc_query_system})
- Set({check::compiler/rustc_resolve})
- Set({check::compiler/rustc_sanitizers})
- Set({check::compiler/rustc_serialize})
- Set({check::compiler/rustc_session})
- Set({check::compiler/rustc_span})
- Set({check::compiler/rustc_symbol_mangling})
- Set({check::compiler/rustc_target})
- Set({check::compiler/rustc_thread_pool})
- Set({check::compiler/rustc_trait_selection})
- Set({check::compiler/rustc_traits})
- Set({check::compiler/rustc_transmute})
- Set({check::compiler/rustc_ty_utils})
- Set({check::compiler/rustc_type_ir})
- Set({check::compiler/rustc_type_ir_macros})
- Set({check::compiler/rustc_windows_rc})
[Check] check::Rustdoc
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/librustdoc, check::src/tools/rustdoc})
[Check] check::CraneliftCodegenBackend
targets: [x86_64-unknown-linux-gnu]
- Set({check::cg_clif})
- Set({check::rustc_codegen_cranelift})
[Check] check::GccCodegenBackend
targets: [x86_64-unknown-linux-gnu]
- Set({check::cg_gcc})
- Set({check::rustc_codegen_gcc})
[Check] check::Clippy
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/clippy})
[Check] check::Miri
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/miri})
[Check] check::CargoMiri
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/miri/cargo-miri})
[Check] check::MiroptTestTools
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/miropt-test-tools})
[Check] check::Rustfmt
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/rustfmt})
[Check] check::RustAnalyzer
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/rust-analyzer})
[Check] check::TestFloatParse
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/test-float-parse})
[Check] check::FeaturesStatusDump
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/features-status-dump})
[Check] check::Std
targets: [aarch64-unknown-linux-gnu]
- Set({check::library})
- Set({check::library/alloc})
- Set({check::library/alloctests})
- Set({check::library/compiler-builtins/compiler-builtins})
- Set({check::library/core})
- Set({check::library/coretests})
- Set({check::library/panic_abort})
- Set({check::library/panic_unwind})
- Set({check::library/proc_macro})
- Set({check::library/rustc-std-workspace-core})
- Set({check::library/std})
- Set({check::library/std_detect})
- Set({check::library/sysroot})
- Set({check::library/test})
- Set({check::library/unwind})
[Check] check::Compiletest
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/compiletest})

View file

@ -0,0 +1,21 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: check library
---
[Check] check::Std
targets: [aarch64-unknown-linux-gnu]
- Set({check::library})
- Set({check::library/alloc})
- Set({check::library/alloctests})
- Set({check::library/compiler-builtins/compiler-builtins})
- Set({check::library/core})
- Set({check::library/coretests})
- Set({check::library/panic_abort})
- Set({check::library/panic_unwind})
- Set({check::library/proc_macro})
- Set({check::library/rustc-std-workspace-core})
- Set({check::library/std})
- Set({check::library/std_detect})
- Set({check::library/sysroot})
- Set({check::library/test})
- Set({check::library/unwind})

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: check rustc
---
[Check] check::Rustc
targets: [x86_64-unknown-linux-gnu]
- Set({check::compiler/rustc})

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: check rustdoc
---
[Check] check::Rustdoc
targets: [x86_64-unknown-linux-gnu]
- Set({check::src/tools/rustdoc})

View file

@ -0,0 +1,34 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: dist
---
[Dist] dist::Docs
targets: [aarch64-unknown-linux-gnu]
- Set({dist::rust-docs})
[Dist] dist::JsonDocs
targets: [aarch64-unknown-linux-gnu]
- Set({dist::rust-docs-json})
[Dist] dist::Mingw
targets: [aarch64-unknown-linux-gnu]
- Set({dist::rust-mingw})
[Dist] dist::Rustc
targets: [x86_64-unknown-linux-gnu]
- Set({dist::rustc})
[Dist] dist::Std
targets: [aarch64-unknown-linux-gnu]
- Set({dist::rust-std})
[Dist] dist::RustcDev
targets: [x86_64-unknown-linux-gnu]
- Set({dist::rustc-dev})
[Dist] dist::Src
targets: [x86_64-unknown-linux-gnu]
- Set({dist::rust-src})
[Dist] dist::RustDev
targets: [x86_64-unknown-linux-gnu]
- Set({dist::rust-dev})
[Dist] dist::PlainSourceTarball
targets: [x86_64-unknown-linux-gnu]
- Set({dist::rustc-src})
[Dist] dist::ReproducibleArtifacts
targets: [x86_64-unknown-linux-gnu]
- Set({dist::reproducible-artifacts})

View file

@ -0,0 +1,212 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test
---
[Test] test::Tidy
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/tidy})
[Test] test::Ui
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/ui)
[Test] test::Crashes
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/crashes)
[Test] test::Coverage
targets: [aarch64-unknown-linux-gnu]
- Set({test::coverage-map})
- Set({test::coverage-run})
- Suite(test::tests/coverage)
[Test] test::MirOpt
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/mir-opt)
[Test] test::CodegenLlvm
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/codegen-llvm)
[Test] test::CodegenUnits
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/codegen-units)
[Test] test::AssemblyLlvm
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/assembly-llvm)
[Test] test::Incremental
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/incremental)
[Test] test::Debuginfo
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/debuginfo)
[Test] test::UiFullDeps
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/ui-fulldeps)
[Test] test::Rustdoc
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc)
[Test] test::CoverageRunRustdoc
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/coverage-run-rustdoc)
[Test] test::Pretty
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/pretty)
[Test] test::CodegenCranelift
targets: [x86_64-unknown-linux-gnu]
- Set({test::compiler/rustc_codegen_cranelift})
[Test] test::CodegenGCC
targets: [x86_64-unknown-linux-gnu]
- Set({test::compiler/rustc_codegen_gcc})
[Test] test::Crate
targets: [aarch64-unknown-linux-gnu]
- Set({test::library/alloc})
- Set({test::library/alloctests})
- Set({test::library/compiler-builtins/compiler-builtins})
- Set({test::library/core})
- Set({test::library/coretests})
- Set({test::library/panic_abort})
- Set({test::library/panic_unwind})
- Set({test::library/proc_macro})
- Set({test::library/rustc-std-workspace-core})
- Set({test::library/std})
- Set({test::library/std_detect})
- Set({test::library/sysroot})
- Set({test::library/test})
- Set({test::library/unwind})
[Test] test::CrateLibrustc
targets: [x86_64-unknown-linux-gnu]
- Set({test::compiler})
- Set({test::compiler/rustc})
- Set({test::compiler/rustc_abi})
- Set({test::compiler/rustc_arena})
- Set({test::compiler/rustc_ast})
- Set({test::compiler/rustc_ast_ir})
- Set({test::compiler/rustc_ast_lowering})
- Set({test::compiler/rustc_ast_passes})
- Set({test::compiler/rustc_ast_pretty})
- Set({test::compiler/rustc_attr_parsing})
- Set({test::compiler/rustc_baked_icu_data})
- Set({test::compiler/rustc_borrowck})
- Set({test::compiler/rustc_builtin_macros})
- Set({test::compiler/rustc_codegen_llvm})
- Set({test::compiler/rustc_codegen_ssa})
- Set({test::compiler/rustc_const_eval})
- Set({test::compiler/rustc_data_structures})
- Set({test::compiler/rustc_driver})
- Set({test::compiler/rustc_driver_impl})
- Set({test::compiler/rustc_error_codes})
- Set({test::compiler/rustc_error_messages})
- Set({test::compiler/rustc_errors})
- Set({test::compiler/rustc_expand})
- Set({test::compiler/rustc_feature})
- Set({test::compiler/rustc_fluent_macro})
- Set({test::compiler/rustc_fs_util})
- Set({test::compiler/rustc_graphviz})
- Set({test::compiler/rustc_hashes})
- Set({test::compiler/rustc_hir})
- Set({test::compiler/rustc_hir_analysis})
- Set({test::compiler/rustc_hir_id})
- Set({test::compiler/rustc_hir_pretty})
- Set({test::compiler/rustc_hir_typeck})
- Set({test::compiler/rustc_incremental})
- Set({test::compiler/rustc_index})
- Set({test::compiler/rustc_index_macros})
- Set({test::compiler/rustc_infer})
- Set({test::compiler/rustc_interface})
- Set({test::compiler/rustc_lexer})
- Set({test::compiler/rustc_lint})
- Set({test::compiler/rustc_lint_defs})
- Set({test::compiler/rustc_llvm})
- Set({test::compiler/rustc_log})
- Set({test::compiler/rustc_macros})
- Set({test::compiler/rustc_metadata})
- Set({test::compiler/rustc_middle})
- Set({test::compiler/rustc_mir_build})
- Set({test::compiler/rustc_mir_dataflow})
- Set({test::compiler/rustc_mir_transform})
- Set({test::compiler/rustc_monomorphize})
- Set({test::compiler/rustc_next_trait_solver})
- Set({test::compiler/rustc_parse})
- Set({test::compiler/rustc_parse_format})
- Set({test::compiler/rustc_passes})
- Set({test::compiler/rustc_pattern_analysis})
- Set({test::compiler/rustc_privacy})
- Set({test::compiler/rustc_proc_macro})
- Set({test::compiler/rustc_public})
- Set({test::compiler/rustc_public_bridge})
- Set({test::compiler/rustc_query_impl})
- Set({test::compiler/rustc_query_system})
- Set({test::compiler/rustc_resolve})
- Set({test::compiler/rustc_sanitizers})
- Set({test::compiler/rustc_serialize})
- Set({test::compiler/rustc_session})
- Set({test::compiler/rustc_span})
- Set({test::compiler/rustc_symbol_mangling})
- Set({test::compiler/rustc_target})
- Set({test::compiler/rustc_thread_pool})
- Set({test::compiler/rustc_trait_selection})
- Set({test::compiler/rustc_traits})
- Set({test::compiler/rustc_transmute})
- Set({test::compiler/rustc_ty_utils})
- Set({test::compiler/rustc_type_ir})
- Set({test::compiler/rustc_type_ir_macros})
- Set({test::compiler/rustc_windows_rc})
[Test] test::CrateRustdoc
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/librustdoc, test::src/tools/rustdoc})
[Test] test::CrateRustdocJsonTypes
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/rustdoc-json-types})
[Test] test::CrateBootstrap
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/coverage-dump})
- Set({test::src/tools/jsondoclint})
- Set({test::src/tools/replace-version-placeholder})
- Set({test::tidyselftest})
[Test] test::Linkcheck
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/linkchecker})
[Test] test::TierCheck
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/tier-check})
[Test] test::RustAnalyzer
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/rust-analyzer})
[Test] test::ErrorIndex
targets: [x86_64-unknown-linux-gnu]
- Set({test::error-index})
- Set({test::src/tools/error_index_generator})
[Test] test::RustdocBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/rustdoc})
[Test] test::UnstableBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/unstable-book})
[Test] test::RustcBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/rustc})
[Test] test::RustdocJSStd
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-js-std)
[Test] test::RustdocJSNotStd
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-js)
[Test] test::RustdocTheme
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/rustdoc-themes})
[Test] test::RustdocUi
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-ui)
[Test] test::RustdocJson
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-json)
[Test] test::HtmlCheck
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/html-checker})
[Test] test::RustInstaller
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/rust-installer})
[Test] test::TestFloatParse
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/test-float-parse})
[Test] test::RunMake
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/run-make)
[Test] test::RunMakeCargo
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/run-make-cargo)

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test coverage
---
[Test] test::Coverage
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/coverage)

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test coverage-map
---
[Test] test::Coverage
targets: [aarch64-unknown-linux-gnu]
- Set({test::coverage-map})

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test coverage-run
---
[Test] test::Coverage
targets: [aarch64-unknown-linux-gnu]
- Set({test::coverage-run})

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test coverage --skip=coverage-run
---
[Test] test::Coverage
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/coverage)

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test debuginfo
---
[Test] test::Debuginfo
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/debuginfo)

View file

@ -0,0 +1,20 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test library
---
[Test] test::Crate
targets: [aarch64-unknown-linux-gnu]
- Set({test::library/alloc})
- Set({test::library/alloctests})
- Set({test::library/compiler-builtins/compiler-builtins})
- Set({test::library/core})
- Set({test::library/coretests})
- Set({test::library/panic_abort})
- Set({test::library/panic_unwind})
- Set({test::library/proc_macro})
- Set({test::library/rustc-std-workspace-core})
- Set({test::library/std})
- Set({test::library/std_detect})
- Set({test::library/sysroot})
- Set({test::library/test})
- Set({test::library/unwind})

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test librustdoc
---
[Test] test::CrateRustdoc
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/librustdoc})

View file

@ -0,0 +1,13 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test librustdoc rustdoc
---
[Test] test::CrateRustdoc
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/librustdoc, test::src/tools/rustdoc})
[Test] test::Rustdoc
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc)
[Test] test::RustdocBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/rustdoc})

View file

@ -0,0 +1,13 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test rustdoc
---
[Test] test::Rustdoc
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc)
[Test] test::CrateRustdoc
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/rustdoc})
[Test] test::RustdocBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/rustdoc})

View file

@ -0,0 +1,211 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test --skip=coverage
---
[Test] test::Tidy
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/tidy})
[Test] test::Ui
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/ui)
[Test] test::Crashes
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/crashes)
[Test] test::Coverage
targets: [aarch64-unknown-linux-gnu]
- Set({test::coverage-map})
- Set({test::coverage-run})
[Test] test::MirOpt
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/mir-opt)
[Test] test::CodegenLlvm
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/codegen-llvm)
[Test] test::CodegenUnits
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/codegen-units)
[Test] test::AssemblyLlvm
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/assembly-llvm)
[Test] test::Incremental
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/incremental)
[Test] test::Debuginfo
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/debuginfo)
[Test] test::UiFullDeps
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/ui-fulldeps)
[Test] test::Rustdoc
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc)
[Test] test::CoverageRunRustdoc
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/coverage-run-rustdoc)
[Test] test::Pretty
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/pretty)
[Test] test::CodegenCranelift
targets: [x86_64-unknown-linux-gnu]
- Set({test::compiler/rustc_codegen_cranelift})
[Test] test::CodegenGCC
targets: [x86_64-unknown-linux-gnu]
- Set({test::compiler/rustc_codegen_gcc})
[Test] test::Crate
targets: [aarch64-unknown-linux-gnu]
- Set({test::library/alloc})
- Set({test::library/alloctests})
- Set({test::library/compiler-builtins/compiler-builtins})
- Set({test::library/core})
- Set({test::library/coretests})
- Set({test::library/panic_abort})
- Set({test::library/panic_unwind})
- Set({test::library/proc_macro})
- Set({test::library/rustc-std-workspace-core})
- Set({test::library/std})
- Set({test::library/std_detect})
- Set({test::library/sysroot})
- Set({test::library/test})
- Set({test::library/unwind})
[Test] test::CrateLibrustc
targets: [x86_64-unknown-linux-gnu]
- Set({test::compiler})
- Set({test::compiler/rustc})
- Set({test::compiler/rustc_abi})
- Set({test::compiler/rustc_arena})
- Set({test::compiler/rustc_ast})
- Set({test::compiler/rustc_ast_ir})
- Set({test::compiler/rustc_ast_lowering})
- Set({test::compiler/rustc_ast_passes})
- Set({test::compiler/rustc_ast_pretty})
- Set({test::compiler/rustc_attr_parsing})
- Set({test::compiler/rustc_baked_icu_data})
- Set({test::compiler/rustc_borrowck})
- Set({test::compiler/rustc_builtin_macros})
- Set({test::compiler/rustc_codegen_llvm})
- Set({test::compiler/rustc_codegen_ssa})
- Set({test::compiler/rustc_const_eval})
- Set({test::compiler/rustc_data_structures})
- Set({test::compiler/rustc_driver})
- Set({test::compiler/rustc_driver_impl})
- Set({test::compiler/rustc_error_codes})
- Set({test::compiler/rustc_error_messages})
- Set({test::compiler/rustc_errors})
- Set({test::compiler/rustc_expand})
- Set({test::compiler/rustc_feature})
- Set({test::compiler/rustc_fluent_macro})
- Set({test::compiler/rustc_fs_util})
- Set({test::compiler/rustc_graphviz})
- Set({test::compiler/rustc_hashes})
- Set({test::compiler/rustc_hir})
- Set({test::compiler/rustc_hir_analysis})
- Set({test::compiler/rustc_hir_id})
- Set({test::compiler/rustc_hir_pretty})
- Set({test::compiler/rustc_hir_typeck})
- Set({test::compiler/rustc_incremental})
- Set({test::compiler/rustc_index})
- Set({test::compiler/rustc_index_macros})
- Set({test::compiler/rustc_infer})
- Set({test::compiler/rustc_interface})
- Set({test::compiler/rustc_lexer})
- Set({test::compiler/rustc_lint})
- Set({test::compiler/rustc_lint_defs})
- Set({test::compiler/rustc_llvm})
- Set({test::compiler/rustc_log})
- Set({test::compiler/rustc_macros})
- Set({test::compiler/rustc_metadata})
- Set({test::compiler/rustc_middle})
- Set({test::compiler/rustc_mir_build})
- Set({test::compiler/rustc_mir_dataflow})
- Set({test::compiler/rustc_mir_transform})
- Set({test::compiler/rustc_monomorphize})
- Set({test::compiler/rustc_next_trait_solver})
- Set({test::compiler/rustc_parse})
- Set({test::compiler/rustc_parse_format})
- Set({test::compiler/rustc_passes})
- Set({test::compiler/rustc_pattern_analysis})
- Set({test::compiler/rustc_privacy})
- Set({test::compiler/rustc_proc_macro})
- Set({test::compiler/rustc_public})
- Set({test::compiler/rustc_public_bridge})
- Set({test::compiler/rustc_query_impl})
- Set({test::compiler/rustc_query_system})
- Set({test::compiler/rustc_resolve})
- Set({test::compiler/rustc_sanitizers})
- Set({test::compiler/rustc_serialize})
- Set({test::compiler/rustc_session})
- Set({test::compiler/rustc_span})
- Set({test::compiler/rustc_symbol_mangling})
- Set({test::compiler/rustc_target})
- Set({test::compiler/rustc_thread_pool})
- Set({test::compiler/rustc_trait_selection})
- Set({test::compiler/rustc_traits})
- Set({test::compiler/rustc_transmute})
- Set({test::compiler/rustc_ty_utils})
- Set({test::compiler/rustc_type_ir})
- Set({test::compiler/rustc_type_ir_macros})
- Set({test::compiler/rustc_windows_rc})
[Test] test::CrateRustdoc
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/librustdoc, test::src/tools/rustdoc})
[Test] test::CrateRustdocJsonTypes
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/rustdoc-json-types})
[Test] test::CrateBootstrap
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/coverage-dump})
- Set({test::src/tools/jsondoclint})
- Set({test::src/tools/replace-version-placeholder})
- Set({test::tidyselftest})
[Test] test::Linkcheck
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/linkchecker})
[Test] test::TierCheck
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/tier-check})
[Test] test::RustAnalyzer
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/rust-analyzer})
[Test] test::ErrorIndex
targets: [x86_64-unknown-linux-gnu]
- Set({test::error-index})
- Set({test::src/tools/error_index_generator})
[Test] test::RustdocBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/rustdoc})
[Test] test::UnstableBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/unstable-book})
[Test] test::RustcBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/rustc})
[Test] test::RustdocJSStd
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-js-std)
[Test] test::RustdocJSNotStd
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-js)
[Test] test::RustdocTheme
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/rustdoc-themes})
[Test] test::RustdocUi
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-ui)
[Test] test::RustdocJson
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-json)
[Test] test::HtmlCheck
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/html-checker})
[Test] test::RustInstaller
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/rust-installer})
[Test] test::TestFloatParse
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/test-float-parse})
[Test] test::RunMake
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/run-make)
[Test] test::RunMakeCargo
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/run-make-cargo)

View file

@ -0,0 +1,157 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test --skip=tests
---
[Test] test::Tidy
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/tidy})
[Test] test::Coverage
targets: [aarch64-unknown-linux-gnu]
- Set({test::coverage-map})
- Set({test::coverage-run})
[Test] test::CodegenCranelift
targets: [x86_64-unknown-linux-gnu]
- Set({test::compiler/rustc_codegen_cranelift})
[Test] test::CodegenGCC
targets: [x86_64-unknown-linux-gnu]
- Set({test::compiler/rustc_codegen_gcc})
[Test] test::Crate
targets: [aarch64-unknown-linux-gnu]
- Set({test::library/alloc})
- Set({test::library/alloctests})
- Set({test::library/compiler-builtins/compiler-builtins})
- Set({test::library/core})
- Set({test::library/coretests})
- Set({test::library/panic_abort})
- Set({test::library/panic_unwind})
- Set({test::library/proc_macro})
- Set({test::library/rustc-std-workspace-core})
- Set({test::library/std})
- Set({test::library/std_detect})
- Set({test::library/sysroot})
- Set({test::library/test})
- Set({test::library/unwind})
[Test] test::CrateLibrustc
targets: [x86_64-unknown-linux-gnu]
- Set({test::compiler})
- Set({test::compiler/rustc})
- Set({test::compiler/rustc_abi})
- Set({test::compiler/rustc_arena})
- Set({test::compiler/rustc_ast})
- Set({test::compiler/rustc_ast_ir})
- Set({test::compiler/rustc_ast_lowering})
- Set({test::compiler/rustc_ast_passes})
- Set({test::compiler/rustc_ast_pretty})
- Set({test::compiler/rustc_attr_parsing})
- Set({test::compiler/rustc_baked_icu_data})
- Set({test::compiler/rustc_borrowck})
- Set({test::compiler/rustc_builtin_macros})
- Set({test::compiler/rustc_codegen_llvm})
- Set({test::compiler/rustc_codegen_ssa})
- Set({test::compiler/rustc_const_eval})
- Set({test::compiler/rustc_data_structures})
- Set({test::compiler/rustc_driver})
- Set({test::compiler/rustc_driver_impl})
- Set({test::compiler/rustc_error_codes})
- Set({test::compiler/rustc_error_messages})
- Set({test::compiler/rustc_errors})
- Set({test::compiler/rustc_expand})
- Set({test::compiler/rustc_feature})
- Set({test::compiler/rustc_fluent_macro})
- Set({test::compiler/rustc_fs_util})
- Set({test::compiler/rustc_graphviz})
- Set({test::compiler/rustc_hashes})
- Set({test::compiler/rustc_hir})
- Set({test::compiler/rustc_hir_analysis})
- Set({test::compiler/rustc_hir_id})
- Set({test::compiler/rustc_hir_pretty})
- Set({test::compiler/rustc_hir_typeck})
- Set({test::compiler/rustc_incremental})
- Set({test::compiler/rustc_index})
- Set({test::compiler/rustc_index_macros})
- Set({test::compiler/rustc_infer})
- Set({test::compiler/rustc_interface})
- Set({test::compiler/rustc_lexer})
- Set({test::compiler/rustc_lint})
- Set({test::compiler/rustc_lint_defs})
- Set({test::compiler/rustc_llvm})
- Set({test::compiler/rustc_log})
- Set({test::compiler/rustc_macros})
- Set({test::compiler/rustc_metadata})
- Set({test::compiler/rustc_middle})
- Set({test::compiler/rustc_mir_build})
- Set({test::compiler/rustc_mir_dataflow})
- Set({test::compiler/rustc_mir_transform})
- Set({test::compiler/rustc_monomorphize})
- Set({test::compiler/rustc_next_trait_solver})
- Set({test::compiler/rustc_parse})
- Set({test::compiler/rustc_parse_format})
- Set({test::compiler/rustc_passes})
- Set({test::compiler/rustc_pattern_analysis})
- Set({test::compiler/rustc_privacy})
- Set({test::compiler/rustc_proc_macro})
- Set({test::compiler/rustc_public})
- Set({test::compiler/rustc_public_bridge})
- Set({test::compiler/rustc_query_impl})
- Set({test::compiler/rustc_query_system})
- Set({test::compiler/rustc_resolve})
- Set({test::compiler/rustc_sanitizers})
- Set({test::compiler/rustc_serialize})
- Set({test::compiler/rustc_session})
- Set({test::compiler/rustc_span})
- Set({test::compiler/rustc_symbol_mangling})
- Set({test::compiler/rustc_target})
- Set({test::compiler/rustc_thread_pool})
- Set({test::compiler/rustc_trait_selection})
- Set({test::compiler/rustc_traits})
- Set({test::compiler/rustc_transmute})
- Set({test::compiler/rustc_ty_utils})
- Set({test::compiler/rustc_type_ir})
- Set({test::compiler/rustc_type_ir_macros})
- Set({test::compiler/rustc_windows_rc})
[Test] test::CrateRustdoc
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/librustdoc, test::src/tools/rustdoc})
[Test] test::CrateRustdocJsonTypes
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/rustdoc-json-types})
[Test] test::CrateBootstrap
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/coverage-dump})
- Set({test::src/tools/jsondoclint})
- Set({test::src/tools/replace-version-placeholder})
- Set({test::tidyselftest})
[Test] test::Linkcheck
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/linkchecker})
[Test] test::TierCheck
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/tier-check})
[Test] test::RustAnalyzer
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/rust-analyzer})
[Test] test::ErrorIndex
targets: [x86_64-unknown-linux-gnu]
- Set({test::error-index})
- Set({test::src/tools/error_index_generator})
[Test] test::RustdocBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/rustdoc})
[Test] test::UnstableBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/unstable-book})
[Test] test::RustcBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/rustc})
[Test] test::RustdocTheme
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/rustdoc-themes})
[Test] test::HtmlCheck
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/html-checker})
[Test] test::RustInstaller
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/rust-installer})
[Test] test::TestFloatParse
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/test-float-parse})

View file

@ -0,0 +1,136 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test --skip=tests --skip=coverage-map --skip=coverage-run --skip=library --skip=tidyselftest
---
[Test] test::Tidy
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/tidy})
[Test] test::CodegenCranelift
targets: [x86_64-unknown-linux-gnu]
- Set({test::compiler/rustc_codegen_cranelift})
[Test] test::CodegenGCC
targets: [x86_64-unknown-linux-gnu]
- Set({test::compiler/rustc_codegen_gcc})
[Test] test::CrateLibrustc
targets: [x86_64-unknown-linux-gnu]
- Set({test::compiler})
- Set({test::compiler/rustc})
- Set({test::compiler/rustc_abi})
- Set({test::compiler/rustc_arena})
- Set({test::compiler/rustc_ast})
- Set({test::compiler/rustc_ast_ir})
- Set({test::compiler/rustc_ast_lowering})
- Set({test::compiler/rustc_ast_passes})
- Set({test::compiler/rustc_ast_pretty})
- Set({test::compiler/rustc_attr_parsing})
- Set({test::compiler/rustc_baked_icu_data})
- Set({test::compiler/rustc_borrowck})
- Set({test::compiler/rustc_builtin_macros})
- Set({test::compiler/rustc_codegen_llvm})
- Set({test::compiler/rustc_codegen_ssa})
- Set({test::compiler/rustc_const_eval})
- Set({test::compiler/rustc_data_structures})
- Set({test::compiler/rustc_driver})
- Set({test::compiler/rustc_driver_impl})
- Set({test::compiler/rustc_error_codes})
- Set({test::compiler/rustc_error_messages})
- Set({test::compiler/rustc_errors})
- Set({test::compiler/rustc_expand})
- Set({test::compiler/rustc_feature})
- Set({test::compiler/rustc_fluent_macro})
- Set({test::compiler/rustc_fs_util})
- Set({test::compiler/rustc_graphviz})
- Set({test::compiler/rustc_hashes})
- Set({test::compiler/rustc_hir})
- Set({test::compiler/rustc_hir_analysis})
- Set({test::compiler/rustc_hir_id})
- Set({test::compiler/rustc_hir_pretty})
- Set({test::compiler/rustc_hir_typeck})
- Set({test::compiler/rustc_incremental})
- Set({test::compiler/rustc_index})
- Set({test::compiler/rustc_index_macros})
- Set({test::compiler/rustc_infer})
- Set({test::compiler/rustc_interface})
- Set({test::compiler/rustc_lexer})
- Set({test::compiler/rustc_lint})
- Set({test::compiler/rustc_lint_defs})
- Set({test::compiler/rustc_llvm})
- Set({test::compiler/rustc_log})
- Set({test::compiler/rustc_macros})
- Set({test::compiler/rustc_metadata})
- Set({test::compiler/rustc_middle})
- Set({test::compiler/rustc_mir_build})
- Set({test::compiler/rustc_mir_dataflow})
- Set({test::compiler/rustc_mir_transform})
- Set({test::compiler/rustc_monomorphize})
- Set({test::compiler/rustc_next_trait_solver})
- Set({test::compiler/rustc_parse})
- Set({test::compiler/rustc_parse_format})
- Set({test::compiler/rustc_passes})
- Set({test::compiler/rustc_pattern_analysis})
- Set({test::compiler/rustc_privacy})
- Set({test::compiler/rustc_proc_macro})
- Set({test::compiler/rustc_public})
- Set({test::compiler/rustc_public_bridge})
- Set({test::compiler/rustc_query_impl})
- Set({test::compiler/rustc_query_system})
- Set({test::compiler/rustc_resolve})
- Set({test::compiler/rustc_sanitizers})
- Set({test::compiler/rustc_serialize})
- Set({test::compiler/rustc_session})
- Set({test::compiler/rustc_span})
- Set({test::compiler/rustc_symbol_mangling})
- Set({test::compiler/rustc_target})
- Set({test::compiler/rustc_thread_pool})
- Set({test::compiler/rustc_trait_selection})
- Set({test::compiler/rustc_traits})
- Set({test::compiler/rustc_transmute})
- Set({test::compiler/rustc_ty_utils})
- Set({test::compiler/rustc_type_ir})
- Set({test::compiler/rustc_type_ir_macros})
- Set({test::compiler/rustc_windows_rc})
[Test] test::CrateRustdoc
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/librustdoc, test::src/tools/rustdoc})
[Test] test::CrateRustdocJsonTypes
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/rustdoc-json-types})
[Test] test::CrateBootstrap
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/coverage-dump})
- Set({test::src/tools/jsondoclint})
- Set({test::src/tools/replace-version-placeholder})
[Test] test::Linkcheck
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/linkchecker})
[Test] test::TierCheck
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/tier-check})
[Test] test::RustAnalyzer
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/rust-analyzer})
[Test] test::ErrorIndex
targets: [x86_64-unknown-linux-gnu]
- Set({test::error-index})
- Set({test::src/tools/error_index_generator})
[Test] test::RustdocBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/rustdoc})
[Test] test::UnstableBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/unstable-book})
[Test] test::RustcBook
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/doc/rustc})
[Test] test::RustdocTheme
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/rustdoc-themes})
[Test] test::HtmlCheck
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/html-checker})
[Test] test::RustInstaller
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/rust-installer})
[Test] test::TestFloatParse
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/test-float-parse})

View file

@ -0,0 +1,64 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test tests
---
[Test] test::AssemblyLlvm
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/assembly-llvm)
[Test] test::CodegenLlvm
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/codegen-llvm)
[Test] test::CodegenUnits
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/codegen-units)
[Test] test::Coverage
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/coverage)
[Test] test::CoverageRunRustdoc
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/coverage-run-rustdoc)
[Test] test::Crashes
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/crashes)
[Test] test::Debuginfo
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/debuginfo)
[Test] test::Incremental
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/incremental)
[Test] test::MirOpt
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/mir-opt)
[Test] test::Pretty
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/pretty)
[Test] test::RunMake
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/run-make)
[Test] test::RunMakeCargo
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/run-make-cargo)
[Test] test::Rustdoc
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc)
[Test] test::RustdocGUI
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-gui)
[Test] test::RustdocJSNotStd
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-js)
[Test] test::RustdocJSStd
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-js-std)
[Test] test::RustdocJson
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-json)
[Test] test::RustdocUi
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-ui)
[Test] test::Ui
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/ui)
[Test] test::UiFullDeps
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/ui-fulldeps)

View file

@ -0,0 +1,61 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test tests --skip=coverage
---
[Test] test::AssemblyLlvm
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/assembly-llvm)
[Test] test::CodegenLlvm
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/codegen-llvm)
[Test] test::CodegenUnits
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/codegen-units)
[Test] test::CoverageRunRustdoc
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/coverage-run-rustdoc)
[Test] test::Crashes
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/crashes)
[Test] test::Debuginfo
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/debuginfo)
[Test] test::Incremental
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/incremental)
[Test] test::MirOpt
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/mir-opt)
[Test] test::Pretty
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/pretty)
[Test] test::RunMake
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/run-make)
[Test] test::RunMakeCargo
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/run-make-cargo)
[Test] test::Rustdoc
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc)
[Test] test::RustdocGUI
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-gui)
[Test] test::RustdocJSNotStd
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-js)
[Test] test::RustdocJSStd
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-js-std)
[Test] test::RustdocJson
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-json)
[Test] test::RustdocUi
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/rustdoc-ui)
[Test] test::Ui
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/ui)
[Test] test::UiFullDeps
targets: [x86_64-unknown-linux-gnu]
- Suite(test::tests/ui-fulldeps)

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test tests/ui
---
[Test] test::Ui
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/ui)

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test tidy
---
[Test] test::Tidy
targets: [x86_64-unknown-linux-gnu]
- Set({test::src/tools/tidy})

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test tidyselftest
---
[Test] test::CrateBootstrap
targets: [x86_64-unknown-linux-gnu]
- Set({test::tidyselftest})

View file

@ -0,0 +1,7 @@
---
source: src/bootstrap/src/core/builder/cli_paths/tests.rs
expression: test ui
---
[Test] test::Ui
targets: [aarch64-unknown-linux-gnu]
- Suite(test::tests/ui)

View file

@ -0,0 +1,178 @@
use std::collections::{BTreeSet, HashSet};
use std::fs;
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex};
use crate::Build;
use crate::core::builder::cli_paths::match_paths_to_steps_and_run;
use crate::core::builder::{Builder, StepDescription};
use crate::utils::tests::TestCtx;
fn render_steps_for_cli_args(args_str: &str) -> String {
// Split a single string into a step kind and subsequent arguments.
// E.g. "test ui" => ("test", &["ui"])
let args = args_str.split_ascii_whitespace().collect::<Vec<_>>();
let (kind, args) = args.split_first().unwrap();
// Arbitrary tuple to represent the host system.
let hosts = &["x86_64-unknown-linux-gnu"];
// Arbitrary tuple to represent the target system, which might not be the host.
let targets = &["aarch64-unknown-linux-gnu"];
let config = TestCtx::new()
.config(kind)
// `test::Bootstrap` is only run by default in CI, causing inconsistency.
.arg("--ci=false")
.args(args)
.hosts(hosts)
.targets(targets)
.create_config();
let mut build = Build::new(config);
// Some rustdoc test steps are only run by default if nodejs is
// configured/discovered, causing inconsistency.
build.config.nodejs = Some(PathBuf::from("node"));
let mut builder = Builder::new(&build);
// Tell the builder to log steps that it would run, instead of running them.
let mut buf = Arc::new(Mutex::new(String::new()));
let buf2 = Arc::clone(&buf);
builder.log_cli_step_for_tests = Some(Box::new(move |step_desc, pathsets, targets| {
use std::fmt::Write;
let mut buf = buf2.lock().unwrap();
let StepDescription { name, kind, .. } = step_desc;
// Strip boilerplate to make step names easier to read.
let name = name.strip_prefix("bootstrap::core::build_steps::").unwrap_or(name);
writeln!(buf, "[{kind:?}] {name}").unwrap();
writeln!(buf, " targets: {targets:?}").unwrap();
for pathset in pathsets {
// Normalize backslashes in paths, to avoid snapshot differences on Windows.
// FIXME(Zalathar): Doing a string-replace on <PathSet as Debug>
// is a bit unprincipled, but it's good enough for now.
let pathset_str = format!("{pathset:?}").replace('\\', "/");
writeln!(buf, " - {pathset_str}").unwrap();
}
}));
builder.execute_cli();
String::clone(&buf.lock().unwrap())
}
fn snapshot_test_inner(name: &str, args_str: &str) {
let mut settings = insta::Settings::clone_current();
// Use the test name as the snapshot filename, not its whole fully-qualified name.
settings.set_prepend_module_to_snapshot(false);
settings.bind(|| {
insta::assert_snapshot!(name, render_steps_for_cli_args(args_str), args_str);
});
}
/// Keep the snapshots directory tidy by forbidding `.snap` files that don't
/// correspond to a test name.
fn no_unused_snapshots_inner(known_test_names: &[&str]) {
let known_test_names = known_test_names.iter().copied().collect::<HashSet<&str>>();
let mut unexpected_file_names = BTreeSet::new();
// FIXME(Zalathar): Is there a better way to locate the snapshots dir?
for entry in walkdir::WalkDir::new("src/core/builder/cli_paths/snapshots")
.into_iter()
.map(Result::unwrap)
{
let meta = entry.metadata().unwrap();
if !meta.is_file() {
continue;
}
let name = entry.file_name().to_str().unwrap();
if let Some(name_stub) = name.strip_suffix(".snap")
&& !known_test_names.contains(name_stub)
{
unexpected_file_names.insert(name.to_owned());
}
}
assert!(
unexpected_file_names.is_empty(),
"Found snapshot files that don't correspond to a test name: {unexpected_file_names:#?}",
);
}
macro_rules! declare_tests {
(
$( ($name:ident, $args:literal) ),* $(,)?
) => {
$(
#[test]
fn $name() {
snapshot_test_inner(stringify!($name), $args);
}
)*
#[test]
fn no_unused_snapshots() {
let known_test_names = &[ $( stringify!($name), )* ];
no_unused_snapshots_inner(known_test_names);
}
};
}
// Snapshot tests for bootstrap's command-line path-to-step handling.
//
// To bless these tests as necessary, choose one:
// - Run `INSTA_UPDATE=always ./x test bootstrap`
// - Run `./x test bootstrap --bless`
// - Follow the instructions for `cargo-insta` in bootstrap's README.md
//
// These snapshot tests capture _current_ behavior, to prevent unintended
// changes or regressions. If the current behavior is wrong or undersirable,
// then any fix will necessarily have to re-bless the affected tests!
declare_tests!(
// tidy-alphabetical-start
(x_build, "build"),
(x_build_compiler, "build compiler"),
(x_build_compiletest, "build compiletest"),
(x_build_library, "build library"),
(x_build_llvm, "build llvm"),
(x_build_rustc, "build rustc"),
(x_build_rustc_llvm, "build rustc_llvm"),
(x_build_rustdoc, "build rustdoc"),
(x_build_sysroot, "build sysroot"),
(x_check, "check"),
(x_check_bootstrap, "check bootstrap"),
(x_check_compiler, "check compiler"),
(x_check_compiletest, "check compiletest"),
(x_check_compiletest_include_default_paths, "check compiletest --include-default-paths"),
(x_check_library, "check library"),
(x_check_rustc, "check rustc"),
(x_check_rustdoc, "check rustdoc"),
(x_dist, "dist"),
(x_test, "test"),
(x_test_coverage, "test coverage"),
(x_test_coverage_map, "test coverage-map"),
(x_test_coverage_run, "test coverage-run"),
// FIXME(Zalathar): Currently this doesn't actually skip the coverage-run tests!
(x_test_coverage_skip_coverage_run, "test coverage --skip=coverage-run"),
(x_test_debuginfo, "test debuginfo"),
(x_test_library, "test library"),
(x_test_librustdoc, "test librustdoc"),
(x_test_librustdoc_rustdoc, "test librustdoc rustdoc"),
(x_test_rustdoc, "test rustdoc"),
(x_test_skip_coverage, "test --skip=coverage"),
// FIXME(Zalathar): This doesn't skip the coverage-map or coverage-run tests.
(x_test_skip_tests, "test --skip=tests"),
// From `src/ci/docker/scripts/stage_2_test_set2.sh`.
(
x_test_skip_tests_etc,
"test --skip=tests --skip=coverage-map --skip=coverage-run --skip=library --skip=tidyselftest"
),
(x_test_tests, "test tests"),
(x_test_tests_skip_coverage, "test tests --skip=coverage"),
(x_test_tests_ui, "test tests/ui"),
(x_test_tidy, "test tidy"),
(x_test_tidyselftest, "test tidyselftest"),
(x_test_ui, "test ui"),
// tidy-alphabetical-end
);

View file

@ -66,6 +66,12 @@ pub struct Builder<'a> {
/// Cached list of submodules from self.build.src.
submodule_paths_cache: OnceLock<Vec<String>>,
/// When enabled by tests, this causes the top-level steps that _would_ be
/// executed to be logged instead. Used by snapshot tests of command-line
/// paths-to-steps handling.
#[expect(clippy::type_complexity)]
log_cli_step_for_tests: Option<Box<dyn Fn(&StepDescription, &[PathSet], &[TargetSelection])>>,
}
impl Deref for Builder<'_> {
@ -447,6 +453,13 @@ impl StepDescription {
// Determine the targets participating in this rule.
let targets = if self.is_host { &builder.hosts } else { &builder.targets };
// Log the step that's about to run, for snapshot tests.
if let Some(ref log_cli_step) = builder.log_cli_step_for_tests {
log_cli_step(self, &pathsets, targets);
// Return so that the step won't actually run in snapshot tests.
return;
}
for target in targets {
let run = RunConfig { builder, paths: pathsets.clone(), target: *target };
(self.make_run)(run);
@ -1079,6 +1092,7 @@ impl<'a> Builder<'a> {
time_spent_on_dependencies: Cell::new(Duration::new(0, 0)),
paths,
submodule_paths_cache: Default::default(),
log_cli_step_for_tests: None,
}
}

View file

@ -142,6 +142,7 @@ pub fn check(build: &mut Build) {
// We need cmake, but only if we're actually building LLVM or sanitizers.
let building_llvm = !build.config.llvm_from_ci
&& !build.config.local_rebuild
&& build.hosts.iter().any(|host| {
build.config.llvm_enabled(*host)
&& build

View file

@ -28,9 +28,6 @@ COPY scripts/nodejs.sh /scripts/
RUN sh /scripts/nodejs.sh /node
ENV PATH="/node/bin:${PATH}"
# Install eslint
COPY host-x86_64/tidy/eslint.version /tmp/
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
@ -40,8 +37,6 @@ RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-require
COPY host-x86_64/pr-check-1/validate-toolstate.sh /scripts/
RUN bash -c 'npm install -g eslint@$(cat /tmp/eslint.version)'
# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \

View file

@ -1 +0,0 @@
8.57.1

@ -1 +1 @@
Subproject commit 4e995bd73c4490edfe5080ec6014d63aa9abed5f
Subproject commit 28b84db392ac0a572f1a2a2a1317aa5f2bc742cb

View file

@ -21,10 +21,9 @@ rustdoc-json-types = { path = "../rustdoc-json-types" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
smallvec = "1.8.1"
stringdex = "=0.0.2"
stringdex = "=0.0.3"
tempfile = "3"
threadpool = "1.8.1"
tikv-jemalloc-sys = { version = "0.6.1", optional = true, features = ['override_allocator_on_supported_platforms'] }
tracing = "0.1"
tracing-tree = "0.3.0"
unicode-segmentation = "1.9"
@ -43,7 +42,7 @@ minifier = { version = "0.3.2", default-features = false }
expect-test = "1.4.0"
[features]
jemalloc = ["dep:tikv-jemalloc-sys"]
jemalloc = []
[package.metadata.rust-analyzer]
rustc_private = true

View file

@ -3,7 +3,9 @@ mod serde;
use std::collections::BTreeSet;
use std::collections::hash_map::Entry;
use std::io;
use std::path::Path;
use std::string::FromUtf8Error;
use ::serde::de::{self, Deserializer, Error as _};
use ::serde::ser::{SerializeSeq, Serializer};
@ -95,21 +97,22 @@ impl SerializedSearchIndex {
) -> Result<(), Error> {
let root_path = doc_root.join(format!("search.index/root{resource_suffix}.js"));
let column_path = doc_root.join(format!("search.index/{column_name}/"));
let mut consume = |_, cell: &[u8]| {
column.push(String::from_utf8(cell.to_vec())?);
Ok::<_, FromUtf8Error>(())
};
stringdex_internals::read_data_from_disk_column(
root_path,
column_name.as_bytes(),
column_path.clone(),
&mut |_id, item| {
column.push(String::from_utf8(item.to_vec())?);
Ok(())
},
)
.map_err(
|error: stringdex_internals::ReadDataError<Box<dyn std::error::Error>>| Error {
file: column_path,
error: format!("failed to read column from disk: {error}"),
},
&mut consume,
)
.map_err(|error| Error {
file: column_path,
error: format!("failed to read column from disk: {error}"),
})
}
fn perform_read_serde(
resource_suffix: &str,
@ -119,25 +122,26 @@ impl SerializedSearchIndex {
) -> Result<(), Error> {
let root_path = doc_root.join(format!("search.index/root{resource_suffix}.js"));
let column_path = doc_root.join(format!("search.index/{column_name}/"));
let mut consume = |_, cell: &[u8]| {
if cell.is_empty() {
column.push(None);
} else {
column.push(Some(serde_json::from_slice(cell)?));
}
Ok::<_, serde_json::Error>(())
};
stringdex_internals::read_data_from_disk_column(
root_path,
column_name.as_bytes(),
column_path.clone(),
&mut |_id, item| {
if item.is_empty() {
column.push(None);
} else {
column.push(Some(serde_json::from_slice(item)?));
}
Ok(())
},
)
.map_err(
|error: stringdex_internals::ReadDataError<Box<dyn std::error::Error>>| Error {
file: column_path,
error: format!("failed to read column from disk: {error}"),
},
&mut consume,
)
.map_err(|error| Error {
file: column_path,
error: format!("failed to read column from disk: {error}"),
})
}
fn perform_read_postings(
resource_suffix: &str,
@ -147,23 +151,28 @@ impl SerializedSearchIndex {
) -> Result<(), Error> {
let root_path = doc_root.join(format!("search.index/root{resource_suffix}.js"));
let column_path = doc_root.join(format!("search.index/{column_name}/"));
fn consumer(
column: &mut Vec<Vec<Vec<u32>>>,
) -> impl FnMut(u32, &[u8]) -> io::Result<()> {
|_, cell| {
let mut postings = Vec::new();
encode::read_postings_from_string(&mut postings, cell);
column.push(postings);
Ok(())
}
}
stringdex_internals::read_data_from_disk_column(
root_path,
column_name.as_bytes(),
column_path.clone(),
&mut |_id, buf| {
let mut postings = Vec::new();
encode::read_postings_from_string(&mut postings, buf);
column.push(postings);
Ok(())
},
)
.map_err(
|error: stringdex_internals::ReadDataError<Box<dyn std::error::Error>>| Error {
file: column_path,
error: format!("failed to read column from disk: {error}"),
},
&mut consumer(column),
)
.map_err(|error| Error {
file: column_path,
error: format!("failed to read column from disk: {error}"),
})
}
assert_eq!(names.len(), path_data.len());
@ -1055,12 +1064,12 @@ impl Serialize for TypeData {
let mut buf = Vec::new();
encode::write_postings_to_string(&self.inverted_function_inputs_index, &mut buf);
let mut serialized_result = Vec::new();
stringdex_internals::encode::write_base64_to_bytes(&buf, &mut serialized_result);
stringdex_internals::encode::write_base64_to_bytes(&buf, &mut serialized_result).unwrap();
seq.serialize_element(&str::from_utf8(&serialized_result).unwrap())?;
buf.clear();
serialized_result.clear();
encode::write_postings_to_string(&self.inverted_function_output_index, &mut buf);
stringdex_internals::encode::write_base64_to_bytes(&buf, &mut serialized_result);
stringdex_internals::encode::write_base64_to_bytes(&buf, &mut serialized_result).unwrap();
seq.serialize_element(&str::from_utf8(&serialized_result).unwrap())?;
if self.search_unbox {
seq.serialize_element(&1)?;

View file

@ -683,6 +683,7 @@ function preLoadCss(cssUrl) {
break;
case "+":
case "=":
ev.preventDefault();
expandAllDocs();
break;
@ -1620,7 +1621,7 @@ function preLoadCss(cssUrl) {
["↓", "Move down in search results"],
["← / →", "Switch result tab (when results focused)"],
["&#9166;", "Go to active search result"],
["+", "Expand all sections"],
["+ / =", "Expand all sections"],
["-", "Collapse all sections"],
// for the sake of brevity, we don't say "inherit impl blocks",
// although that would be more correct,

View file

@ -3926,16 +3926,25 @@ class DocSearch {
* @returns {Promise<rustdoc.PlainResultObject?>}
*/
const handleAlias = async(name, alias, dist, index) => {
const item = nonnull(await this.getRow(alias, false));
// space both is an alias for ::,
// and is also allowed to appear in doc alias names
const path_dist = name.includes(" ") || parsedQuery.elems.length === 0 ?
0 : checkRowPath(parsedQuery.elems[0].pathWithoutLast, item);
// path distance exceeds max, omit alias from results
if (path_dist === null) {
return null;
}
return {
id: alias,
dist,
path_dist: 0,
path_dist,
index,
alias: name,
is_alias: true,
elems: [], // only used in type-based queries
returned: [], // only used in type-based queries
item: nonnull(await this.getRow(alias, false)),
item,
};
};
/**

View file

@ -61,6 +61,11 @@ extern crate rustc_target;
extern crate rustc_trait_selection;
extern crate test;
// See docs in https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc/src/main.rs
// about jemalloc.
#[cfg(feature = "jemalloc")]
extern crate tikv_jemalloc_sys as jemalloc_sys;
use std::env::{self, VarError};
use std::io::{self, IsTerminal};
use std::path::Path;
@ -72,10 +77,6 @@ use rustc_interface::interface;
use rustc_middle::ty::TyCtxt;
use rustc_session::config::{ErrorOutputType, RustcOptGroup, make_crate_type_option};
use rustc_session::{EarlyDiagCtxt, getopts};
/// See docs in https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc/src/main.rs
/// and https://github.com/rust-lang/rust/pull/146627 for why we need this `use` statement.
#[cfg(feature = "jemalloc")]
use tikv_jemalloc_sys as _;
use tracing::info;
use crate::clean::utils::DOC_RUST_LANG_ORG_VERSION;
@ -123,6 +124,37 @@ mod visit_ast;
mod visit_lib;
pub fn main() {
// See docs in https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc/src/main.rs
// about jemalloc.
#[cfg(feature = "jemalloc")]
{
use std::os::raw::{c_int, c_void};
#[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;
#[cfg(target_os = "macos")]
{
unsafe extern "C" {
fn _rjem_je_zone_register();
}
#[used]
static _F7: unsafe extern "C" fn() = _rjem_je_zone_register;
}
}
let mut early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default());
rustc_driver::install_ice_hook(

@ -1 +1 @@
Subproject commit 445fe4a68f469bf936b2fd81de2c503b233a7f4f
Subproject commit 2d4fa139552ebdd5f091a1401ed03f7dc62cb43f

View file

@ -31,7 +31,6 @@ tempfile = { version = "3.20", optional = true }
termize = "0.2"
color-print = "0.3.4"
anstream = "0.6.18"
tikv-jemalloc-sys = { version = "0.6.1", optional = true, features = ['override_allocator_on_supported_platforms'] }
[dev-dependencies]
cargo_metadata = "0.18.1"
@ -57,7 +56,7 @@ rustc_tools_util = { path = "rustc_tools_util", version = "0.4.2" }
[features]
integration = ["dep:tempfile"]
internal = ["dep:clippy_lints_internal", "dep:tempfile"]
jemalloc = ["dep:tikv-jemalloc-sys"]
jemalloc = []
[package.metadata.rust-analyzer]
# This package uses #[feature(rustc_private)]

View file

@ -166,7 +166,6 @@ generate! {
from_ne_bytes,
from_ptr,
from_raw,
from_str,
from_str_radix,
fs,
fuse,

Some files were not shown because too many files have changed in this diff Show more