Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 1c7d10e

Browse files
committed
Auto merge of rust-lang#127004 - matthiaskrgr:rollup-gft2hqv, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - rust-lang#125016 (Update compiler_builtins to 0.1.113) - rust-lang#126571 (Less `maybe_whole_expr`, take 2) - rust-lang#126692 (patch `rust-lld` and `ld.lld` on NixOS) - rust-lang#126721 (coverage: Make `#[coverage(..)]` apply recursively to nested functions) - rust-lang#126928 (Some `Nonterminal` removal precursors) - rust-lang#126929 (Remove `__rust_force_expr`.) - rust-lang#126970 (Simplify `str::clone_into`) - rust-lang#126980 (set self.is_known_utf8 to false in extend_from_slice) - rust-lang#126983 (Remove `f16` and `f128` ICE paths from smir) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 4bc39f0 + 30c64d8 commit 1c7d10e

File tree

48 files changed

+595
-424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+595
-424
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,9 @@ checksum = "55b672471b4e9f9e95499ea597ff64941a309b2cdbffcc46f2cc5e2d971fd335"
794794

795795
[[package]]
796796
name = "compiler_builtins"
797-
version = "0.1.109"
797+
version = "0.1.113"
798798
source = "registry+https://github.com/rust-lang/crates.io-index"
799-
checksum = "f11973008a8cf741fe6d22f339eba21fd0ca81e2760a769ba8243ed6c21edd7e"
799+
checksum = "f7a6025b8e1885a239509ec7a00859e721eecb5725a64206ab1a6a96f7b55660"
800800
dependencies = [
801801
"cc",
802802
"rustc-std-workspace-core",

compiler/rustc_ast/src/attr/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ impl MetaItem {
327327
I: Iterator<Item = &'a TokenTree>,
328328
{
329329
// FIXME: Share code with `parse_path`.
330-
let path = match tokens.next().map(|tt| TokenTree::uninterpolate(tt)).as_deref() {
330+
let tt = tokens.next().map(|tt| TokenTree::uninterpolate(tt));
331+
let path = match tt.as_deref() {
331332
Some(&TokenTree::Token(
332333
Token { kind: ref kind @ (token::Ident(..) | token::PathSep), span },
333334
_,
@@ -368,6 +369,12 @@ impl MetaItem {
368369
token::Nonterminal::NtPath(path) => (**path).clone(),
369370
_ => return None,
370371
},
372+
Some(TokenTree::Token(
373+
Token { kind: token::OpenDelim(_) | token::CloseDelim(_), .. },
374+
_,
375+
)) => {
376+
panic!("Should be `AttrTokenTree::Delimited`, not delim tokens: {:?}", tt);
377+
}
371378
_ => return None,
372379
};
373380
let list_closing_paren_pos = tokens.peek().map(|tt| tt.span().hi());

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ impl AttrTokenStream {
224224
// Inner attributes are only supported on extern blocks, functions,
225225
// impls, and modules. All of these have their inner attributes
226226
// placed at the beginning of the rightmost outermost braced group:
227-
// e.g. fn foo() { #![my_attr} }
227+
// e.g. fn foo() { #![my_attr] }
228228
//
229229
// Therefore, we can insert them back into the right location
230230
// without needing to do any extra position tracking.

compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ fn build_clif_sysroot_for_triple(
276276
if channel == "release" {
277277
build_cmd.arg("--release");
278278
}
279-
build_cmd.arg("--features").arg("backtrace panic-unwind");
279+
build_cmd.arg("--features").arg("backtrace panic-unwind compiler-builtins-no-f16-f128");
280280
build_cmd.env("CARGO_PROFILE_RELEASE_DEBUG", "true");
281281
build_cmd.env("__CARGO_DEFAULT_LIB_METADATA", "cg_clif");
282282
if compiler.triple.contains("apple") {

compiler/rustc_codegen_gcc/build_system/src/build.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,14 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu
112112
}
113113
let mut env = env.clone();
114114

115-
let mut args: Vec<&dyn AsRef<OsStr>> = vec![&"cargo", &"build", &"--target", &config.target];
115+
let mut args: Vec<&dyn AsRef<OsStr>> = vec![
116+
&"cargo",
117+
&"build",
118+
&"--target",
119+
&config.target,
120+
&"--features",
121+
&"compiler-builtins-no-f16-f128",
122+
];
116123

117124
if config.no_default_features {
118125
rustflags.push_str(" -Csymbol-mangling-version=v0");

compiler/rustc_codegen_llvm/src/abi.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ impl LlvmType for Reg {
121121
match self.kind {
122122
RegKind::Integer => cx.type_ix(self.size.bits()),
123123
RegKind::Float => match self.size.bits() {
124+
16 => cx.type_f16(),
124125
32 => cx.type_f32(),
125126
64 => cx.type_f64(),
127+
128 => cx.type_f128(),
126128
_ => bug!("unsupported float: {:?}", self),
127129
},
128130
RegKind::Vector => cx.type_vector(cx.type_i8(), self.size.bytes()),

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -124,22 +124,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
124124
.emit();
125125
}
126126
}
127-
sym::coverage => {
128-
let inner = attr.meta_item_list();
129-
match inner.as_deref() {
130-
Some([item]) if item.has_name(sym::off) => {
131-
codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_COVERAGE;
132-
}
133-
Some([item]) if item.has_name(sym::on) => {
134-
// Allow #[coverage(on)] for being explicit, maybe also in future to enable
135-
// coverage on a smaller scope within an excluded larger scope.
136-
}
137-
Some(_) | None => {
138-
tcx.dcx()
139-
.span_delayed_bug(attr.span, "unexpected value of coverage attribute");
140-
}
141-
}
142-
}
143127
sym::rustc_std_internal_symbol => {
144128
codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL
145129
}
@@ -584,7 +568,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
584568
}
585569

586570
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NAKED) {
587-
codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_COVERAGE;
588571
codegen_fn_attrs.inline = InlineAttr::Never;
589572
}
590573

compiler/rustc_expand/src/config.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ impl<'a> StripUnconfigured<'a> {
214214
) => {
215215
panic!("Nonterminal should have been flattened: {:?}", tree);
216216
}
217+
AttrTokenTree::Token(
218+
Token { kind: TokenKind::OpenDelim(_) | TokenKind::CloseDelim(_), .. },
219+
_,
220+
) => {
221+
panic!("Should be `AttrTokenTree::Delimited`, not delim tokens: {:?}", tree);
222+
}
217223
AttrTokenTree::Token(token, spacing) => {
218224
Some(AttrTokenTree::Token(token, spacing)).into_iter()
219225
}

compiler/rustc_middle/src/middle/codegen_fn_attrs.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,7 @@ bitflags::bitflags! {
8787
/// #[cmse_nonsecure_entry]: with a TrustZone-M extension, declare a
8888
/// function as an entry function from Non-Secure code.
8989
const CMSE_NONSECURE_ENTRY = 1 << 13;
90-
/// `#[coverage(off)]`: indicates that the function should be ignored by
91-
/// the MIR `InstrumentCoverage` pass and not added to the coverage map
92-
/// during codegen.
93-
const NO_COVERAGE = 1 << 14;
90+
// (Bit 14 was used for `#[coverage(off)]`, but is now unused.)
9491
/// `#[used(linker)]`:
9592
/// indicates that neither LLVM nor the linker will eliminate this function.
9693
const USED_LINKER = 1 << 15;

compiler/rustc_middle/src/query/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,15 @@ rustc_queries! {
572572
separate_provide_extern
573573
}
574574

575+
/// Checks for the nearest `#[coverage(off)]` or `#[coverage(on)]` on
576+
/// this def and any enclosing defs, up to the crate root.
577+
///
578+
/// Returns `false` if `#[coverage(off)]` was found, or `true` if
579+
/// either `#[coverage(on)]` or no coverage attribute was found.
580+
query coverage_attr_on(key: LocalDefId) -> bool {
581+
desc { |tcx| "checking for `#[coverage(..)]` on `{}`", tcx.def_path_str(key) }
582+
}
583+
575584
/// Summarizes coverage IDs inserted by the `InstrumentCoverage` MIR pass
576585
/// (for compiler option `-Cinstrument-coverage`), after MIR optimizations
577586
/// have had a chance to potentially remove some of them.

0 commit comments

Comments
 (0)