Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3715fc6
style-guide: Document absence of trailing whitespace
joshtriplett Aug 22, 2025
ef94abd
tidy: --bless now makes escheck run with --fix
lolbinarycat Aug 30, 2025
df324fa
Add note about trailing whitespace in string literals.
joshtriplett Sep 3, 2025
b301e3a
unstable book: in a sanitizer example, check the code
folkertdev Mar 29, 2025
923b892
compiler: Apply target features to the entry function
heiher Sep 3, 2025
bc17bcd
Simplify `{f16, f32, f54, f128}::midpoint()`
Jules-Bertholet Sep 5, 2025
98e1029
change file-is-generated doc comment to inner
hkBst Sep 5, 2025
0e2224b
rustc_infer: change top-level doc comment to inner
hkBst Sep 5, 2025
b6f8824
Ensure that `--html-after-content` option is used to check `scrape_ex…
GuillaumeGomez Sep 5, 2025
8104252
remove couple of clones
matthiaskrgr Sep 5, 2025
846d6a4
Add __isOSVersionAtLeast and __isPlatformVersionAtLeast symbols
madsmtm Mar 25, 2025
33baaaf
Bump stage0 rustfmt
fmease Sep 5, 2025
349fbba
Rollup merge of #138944 - madsmtm:apple_os_version_check, r=tgross35
fmease Sep 5, 2025
90f5101
Rollup merge of #139113 - folkertdev:sanitizer-unstable-book-check-bl…
fmease Sep 5, 2025
9edce86
Rollup merge of #145735 - joshtriplett:style-guide-trailing-whitespac…
fmease Sep 5, 2025
7e189a0
Rollup merge of #146041 - lolbinarycat:tidy-escheck-bless, r=Kobzol
fmease Sep 5, 2025
1c2d264
Rollup merge of #146144 - heiher:entry-func-features, r=petrochenkov
fmease Sep 5, 2025
690753f
Rollup merge of #146225 - Jules-Bertholet:simplify-float-midpoint, r=…
fmease Sep 5, 2025
d82ee66
Rollup merge of #146234 - hkBst:file-generated-header, r=tgross35
fmease Sep 5, 2025
910d6be
Rollup merge of #146241 - hkBst:context-1, r=jieyouxu
fmease Sep 5, 2025
56d99b1
Rollup merge of #146242 - GuillaumeGomez:rustdoc-gui-scrape, r=lolbin…
fmease Sep 5, 2025
8f3801f
Rollup merge of #146243 - matthiaskrgr:declone, r=lqd
fmease Sep 5, 2025
55a62d5
Rollup merge of #146250 - fmease:bump-stage0-rustfmt, r=Mark-Simulacrum
fmease Sep 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions compiler/rustc_codegen_llvm/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,19 @@ pub(crate) fn tune_cpu_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribu
.map(|tune_cpu| llvm::CreateAttrStringValue(cx.llcx, "tune-cpu", tune_cpu))
}

/// Get the `target-features` LLVM attribute.
pub(crate) fn target_features_attr<'ll>(
cx: &CodegenCx<'ll, '_>,
function_features: Vec<String>,
) -> Option<&'ll Attribute> {
let global_features = cx.tcx.global_backend_features(()).iter().map(String::as_str);
let function_features = function_features.iter().map(String::as_str);
let target_features =
global_features.chain(function_features).intersperse(",").collect::<String>();
(!target_features.is_empty())
.then(|| llvm::CreateAttrStringValue(cx.llcx, "target-features", &target_features))
}

/// Get the `NonLazyBind` LLVM attribute,
/// if the codegen options allow skipping the PLT.
pub(crate) fn non_lazy_bind_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
Expand Down Expand Up @@ -523,14 +536,7 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
}
}

let global_features = cx.tcx.global_backend_features(()).iter().map(|s| s.as_str());
let function_features = function_features.iter().map(|s| s.as_str());
let target_features: String =
global_features.chain(function_features).intersperse(",").collect();

if !target_features.is_empty() {
to_add.push(llvm::CreateAttrStringValue(cx.llcx, "target-features", &target_features));
}
to_add.extend(target_features_attr(cx, function_features));

attributes::apply_to_llfn(llfn, Function, &to_add);
}
Expand Down
10 changes: 8 additions & 2 deletions compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -853,15 +853,21 @@ impl<'ll, 'tcx> MiscCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function> {
let entry_name = self.sess().target.entry_name.as_ref();
if self.get_declared_value(entry_name).is_none() {
Some(self.declare_entry_fn(
let llfn = self.declare_entry_fn(
entry_name,
llvm::CallConv::from_conv(
self.sess().target.entry_abi,
self.sess().target.arch.borrow(),
),
llvm::UnnamedAddr::Global,
fn_type,
))
);
attributes::apply_to_llfn(
llfn,
llvm::AttributePlace::Function,
attributes::target_features_attr(self, vec![]).as_slice(),
);
Some(llfn)
} else {
// If the symbol already exists, it is an error: for example, the user wrote
// #[no_mangle] extern "C" fn main(..) {..}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl<M> ModuleCodegen<M> {
});

CompiledModule {
name: self.name.clone(),
name: self.name,
object,
dwarf_object,
bytecode,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/context.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///! Definition of `InferCtxtLike` from the librarified type layer.
//! Definition of `InferCtxtLike` from the librarified type layer.
use rustc_hir::def_id::DefId;
use rustc_middle::traits::ObligationCause;
use rustc_middle::ty::relate::RelateResult;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/coverage/expansion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl ExpnNode {
Self {
expn_id,

expn_kind: expn_data.kind.clone(),
expn_kind: expn_data.kind,
call_site,
call_site_expn_id,

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3099,7 +3099,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
|err, _, span, message, suggestion, span_suggs| {
err.multipart_suggestion_verbose(
message,
std::iter::once((span, suggestion)).chain(span_suggs.clone()).collect(),
std::iter::once((span, suggestion)).chain(span_suggs).collect(),
Applicability::MaybeIncorrect,
);
true
Expand Down
8 changes: 6 additions & 2 deletions compiler/rustc_symbol_mangling/src/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,13 @@ pub(super) fn mangle<'tcx>(
}

pub fn mangle_internal_symbol<'tcx>(tcx: TyCtxt<'tcx>, item_name: &str) -> String {
if item_name == "rust_eh_personality" {
match item_name {
// rust_eh_personality must not be renamed as LLVM hard-codes the name
return "rust_eh_personality".to_owned();
"rust_eh_personality" => return item_name.to_owned(),
// Apple availability symbols need to not be mangled to be usable by
// C/Objective-C code.
"__isPlatformVersionAtLeast" | "__isOSVersionAtLeast" => return item_name.to_owned(),
_ => {}
}

let prefix = "_R";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
let (expected, found) = if expected_str == found_str {
(join_path_syms(&expected_abs), join_path_syms(&found_abs))
} else {
(expected_str.clone(), found_str.clone())
(expected_str, found_str)
};

// We've displayed "expected `a::b`, found `a::b`". We add context to
Expand Down
8 changes: 0 additions & 8 deletions library/core/src/num/f128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,6 @@ impl f128 {
#[unstable(feature = "f128", issue = "116909")]
#[rustc_const_unstable(feature = "f128", issue = "116909")]
pub const fn midpoint(self, other: f128) -> f128 {
const LO: f128 = f128::MIN_POSITIVE * 2.;
const HI: f128 = f128::MAX / 2.;

let (a, b) = (self, other);
Expand All @@ -842,14 +841,7 @@ impl f128 {
if abs_a <= HI && abs_b <= HI {
// Overflow is impossible
(a + b) / 2.
} else if abs_a < LO {
// Not safe to halve `a` (would underflow)
a + (b / 2.)
} else if abs_b < LO {
// Not safe to halve `b` (would underflow)
(a / 2.) + b
} else {
// Safe to halve `a` and `b`
(a / 2.) + (b / 2.)
}
}
Expand Down
8 changes: 0 additions & 8 deletions library/core/src/num/f16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,6 @@ impl f16 {
#[unstable(feature = "f16", issue = "116909")]
#[rustc_const_unstable(feature = "f16", issue = "116909")]
pub const fn midpoint(self, other: f16) -> f16 {
const LO: f16 = f16::MIN_POSITIVE * 2.;
const HI: f16 = f16::MAX / 2.;

let (a, b) = (self, other);
Expand All @@ -830,14 +829,7 @@ impl f16 {
if abs_a <= HI && abs_b <= HI {
// Overflow is impossible
(a + b) / 2.
} else if abs_a < LO {
// Not safe to halve `a` (would underflow)
a + (b / 2.)
} else if abs_b < LO {
// Not safe to halve `b` (would underflow)
(a / 2.) + b
} else {
// Safe to halve `a` and `b`
(a / 2.) + (b / 2.)
}
}
Expand Down
8 changes: 0 additions & 8 deletions library/core/src/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,6 @@ impl f32 {
((self as f64 + other as f64) / 2.0) as f32
}
_ => {
const LO: f32 = f32::MIN_POSITIVE * 2.;
const HI: f32 = f32::MAX / 2.;

let (a, b) = (self, other);
Expand All @@ -1035,14 +1034,7 @@ impl f32 {
if abs_a <= HI && abs_b <= HI {
// Overflow is impossible
(a + b) / 2.
} else if abs_a < LO {
// Not safe to halve `a` (would underflow)
a + (b / 2.)
} else if abs_b < LO {
// Not safe to halve `b` (would underflow)
(a / 2.) + b
} else {
// Safe to halve `a` and `b`
(a / 2.) + (b / 2.)
}
}
Expand Down
8 changes: 0 additions & 8 deletions library/core/src/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,6 @@ impl f64 {
#[stable(feature = "num_midpoint", since = "1.85.0")]
#[rustc_const_stable(feature = "num_midpoint", since = "1.85.0")]
pub const fn midpoint(self, other: f64) -> f64 {
const LO: f64 = f64::MIN_POSITIVE * 2.;
const HI: f64 = f64::MAX / 2.;

let (a, b) = (self, other);
Expand All @@ -1036,14 +1035,7 @@ impl f64 {
if abs_a <= HI && abs_b <= HI {
// Overflow is impossible
(a + b) / 2.
} else if abs_a < LO {
// Not safe to halve `a` (would underflow)
a + (b / 2.)
} else if abs_b < LO {
// Not safe to halve `b` (would underflow)
(a / 2.) + b
} else {
// Safe to halve `a` and `b`
(a / 2.) + (b / 2.)
}
}
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/unicode/unicode_data.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///! This file is generated by `./x run src/tools/unicode-table-generator`; do not edit manually!
//! This file is generated by `./x run src/tools/unicode-table-generator`; do not edit manually!
// Alphabetic : 1727 bytes, 142759 codepoints in 757 ranges (U+000041 - U+0323B0) using skiplist
// Case_Ignorable : 1053 bytes, 2749 codepoints in 452 ranges (U+000027 - U+0E01F0) using skiplist
// Cased : 407 bytes, 4578 codepoints in 159 ranges (U+000041 - U+01F18A) using skiplist
Expand Down
2 changes: 2 additions & 0 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@
#![feature(hasher_prefixfree_extras)]
#![feature(hashmap_internals)]
#![feature(hint_must_use)]
#![feature(int_from_ascii)]
#![feature(ip)]
#![feature(lazy_get)]
#![feature(maybe_uninit_slice)]
Expand All @@ -369,6 +370,7 @@
#![feature(slice_internals)]
#![feature(slice_ptr_get)]
#![feature(slice_range)]
#![feature(slice_split_once)]
#![feature(std_internals)]
#![feature(str_internals)]
#![feature(sync_unsafe_cell)]
Expand Down
1 change: 1 addition & 0 deletions library/std/src/sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub mod io;
pub mod net;
pub mod os_str;
pub mod path;
pub mod platform_version;
pub mod process;
pub mod random;
pub mod stdio;
Expand Down
Loading
Loading