Skip to content

Rollup of 9 pull requests #144485

New issue

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

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

Already on GitHub? Sign in to your account

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b676f55
rustdoc: add ways of collapsing all impl blocks
lolbinarycat May 27, 2025
978e11b
Upgrade the `fortanix-sgx-abi` dependency
tgross35 Jul 1, 2025
69b9bae
Guarantee 8 bytes of alignment in Thread::into_raw
orlp Jul 12, 2025
6f4d0bd
Tidy
orlp Jul 12, 2025
1d0eddb
tests: debuginfo: Work around or disable broken tests on powerpc
Gelbpunkt Jul 18, 2025
e1b6cfe
Rephrase comment to include some tracking issues
Gelbpunkt Jul 21, 2025
e958b20
Fix unused_parens false positive
benschulz Jul 9, 2025
6fc68c1
Add test case for single bound
benschulz Jul 10, 2025
307f664
Replace unwrap_or with explicit match
benschulz Jul 24, 2025
a5f73bf
Verify llvm-needs-components are not empty and match the --target value
dpaoliello Jul 16, 2025
730d33d
`loop_match`: suggest extracting to a `const` item
folkertdev Jul 7, 2025
1f4561b
Don't lint against named labels in `naked_asm!`
Amanieu May 9, 2025
53018dc
Disable has_reliable_f128_math on musl targets
Gelbpunkt Jul 25, 2025
945502c
Rollup merge of #140871 - Amanieu:naked-asm-label, r=compiler-errors
tgross35 Jul 26, 2025
c22e2f5
Rollup merge of #141663 - lolbinarycat:rustdoc-collapse-impl-134429, …
tgross35 Jul 26, 2025
777e329
Rollup merge of #143272 - tgross35:bump-fortanix, r=jhpratt,jethrogb
tgross35 Jul 26, 2025
1369b5a
Rollup merge of #143585 - folkertdev:loop-match-suggest-const-block, …
tgross35 Jul 26, 2025
377b3d9
Rollup merge of #143698 - benschulz:unused-parens-2, r=lcnr,compiler-…
tgross35 Jul 26, 2025
60533ad
Rollup merge of #143859 - orlp:thread-into-raw-align, r=jhpratt
tgross35 Jul 26, 2025
455776d
Rollup merge of #144042 - dpaoliello:verifyllvmcomp, r=jieyouxu
tgross35 Jul 26, 2025
bd407d9
Rollup merge of #144160 - Gelbpunkt:debuginfo-tests-ppc, r=oli-obk
tgross35 Jul 26, 2025
e5b7040
Rollup merge of #144431 - Gelbpunkt:f128-math-musl, r=petrochenkov,tg…
tgross35 Jul 26, 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
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2849,7 +2849,7 @@ impl InlineAsmOperand {
}
}

#[derive(Clone, Copy, Encodable, Decodable, Debug, HashStable_Generic, Walkable)]
#[derive(Clone, Copy, Encodable, Decodable, Debug, HashStable_Generic, Walkable, PartialEq, Eq)]
pub enum AsmMacro {
/// The `asm!` macro
Asm,
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,9 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
// This rules out anything that doesn't have `long double` = `binary128`; <= 32 bits
// (ld is `f64`), anything other than Linux (Windows and MacOS use `f64`), and `x86`
// (ld is 80-bit extended precision).
//
// musl does not implement the symbols required for f128 math at all.
_ if target_env == "musl" => false,
("x86_64", _) => false,
(_, "linux") if target_pointer_width == 64 => true,
_ => false,
Expand Down
11 changes: 10 additions & 1 deletion compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2870,14 +2870,23 @@ impl<'tcx> LateLintPass<'tcx> for AsmLabels {
if let hir::Expr {
kind:
hir::ExprKind::InlineAsm(hir::InlineAsm {
asm_macro: AsmMacro::Asm | AsmMacro::NakedAsm,
asm_macro: asm_macro @ (AsmMacro::Asm | AsmMacro::NakedAsm),
template_strs,
options,
..
}),
..
} = expr
{
// Non-generic naked functions are allowed to define arbitrary
// labels.
if *asm_macro == AsmMacro::NakedAsm {
let def_id = expr.hir_id.owner.def_id;
if !cx.tcx.generics_of(def_id).requires_monomorphization(cx.tcx) {
return;
}
}

// asm with `options(raw)` does not do replacement with `{` and `}`.
let raw = options.contains(InlineAsmOptions::RAW);

Expand Down
10 changes: 9 additions & 1 deletion compiler/rustc_lint/src/unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,15 @@ impl EarlyLintPass for UnusedParens {
self.with_self_ty_parens = false;
}
ast::TyKind::Ref(_, mut_ty) | ast::TyKind::Ptr(mut_ty) => {
self.in_no_bounds_pos.insert(mut_ty.ty.id, NoBoundsException::OneBound);
// If this type itself appears in no-bounds position, we propagate its
// potentially tighter constraint or risk a false posive (issue 143653).
let own_constraint = self.in_no_bounds_pos.get(&ty.id);
let constraint = match own_constraint {
Some(NoBoundsException::None) => NoBoundsException::None,
Some(NoBoundsException::OneBound) => NoBoundsException::OneBound,
None => NoBoundsException::OneBound,
};
self.in_no_bounds_pos.insert(mut_ty.ty.id, constraint);
}
ast::TyKind::TraitObject(bounds, _) | ast::TyKind::ImplTrait(_, bounds) => {
for i in 0..bounds.len() {
Expand Down
8 changes: 7 additions & 1 deletion compiler/rustc_mir_build/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,16 @@ mir_build_confused = missing patterns are not covered because `{$variable}` is i

mir_build_const_continue_bad_const = could not determine the target branch for this `#[const_continue]`
.label = this value is too generic
.note = the value must be a literal or a monomorphic const

mir_build_const_continue_missing_value = a `#[const_continue]` must break to a label with a value

mir_build_const_continue_not_const = could not determine the target branch for this `#[const_continue]`
.help = try extracting the expression into a `const` item

mir_build_const_continue_not_const_const_block = `const` blocks may use generics, and are not evaluated early enough
mir_build_const_continue_not_const_const_other = this value must be a literal or a monomorphic const
mir_build_const_continue_not_const_constant_parameter = constant parameters may use generics, and are not evaluated early enough

mir_build_const_continue_unknown_jump_target = the target of this `#[const_continue]` is not statically known
.label = this value must be a literal or a monomorphic const

Expand Down
29 changes: 26 additions & 3 deletions compiler/rustc_mir_build/src/builder/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ use tracing::{debug, instrument};

use super::matches::BuiltMatchTree;
use crate::builder::{BlockAnd, BlockAndExtension, BlockFrame, Builder, CFG};
use crate::errors::{ConstContinueBadConst, ConstContinueUnknownJumpTarget};
use crate::errors::{
ConstContinueBadConst, ConstContinueNotMonomorphicConst, ConstContinueUnknownJumpTarget,
};

#[derive(Debug)]
pub(crate) struct Scopes<'tcx> {
Expand Down Expand Up @@ -867,7 +869,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
span_bug!(span, "break value must be a scope")
};

let constant = match &self.thir[value].kind {
let expr = &self.thir[value];
let constant = match &expr.kind {
ExprKind::Adt(box AdtExpr { variant_index, fields, base, .. }) => {
assert!(matches!(base, AdtExprBase::None));
assert!(fields.is_empty());
Expand All @@ -887,7 +890,27 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
),
}
}
_ => self.as_constant(&self.thir[value]),

ExprKind::Literal { .. }
| ExprKind::NonHirLiteral { .. }
| ExprKind::ZstLiteral { .. }
| ExprKind::NamedConst { .. } => self.as_constant(&self.thir[value]),

other => {
use crate::errors::ConstContinueNotMonomorphicConstReason as Reason;

let span = expr.span;
let reason = match other {
ExprKind::ConstParam { .. } => Reason::ConstantParameter { span },
ExprKind::ConstBlock { .. } => Reason::ConstBlock { span },
_ => Reason::Other { span },
};

self.tcx
.dcx()
.emit_err(ConstContinueNotMonomorphicConst { span: expr.span, reason });
return block.unit();
}
};

let break_index = self
Expand Down
32 changes: 32 additions & 0 deletions compiler/rustc_mir_build/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,38 @@ pub(crate) struct LoopMatchArmWithGuard {
pub span: Span,
}

#[derive(Diagnostic)]
#[diag(mir_build_const_continue_not_const)]
#[help]
pub(crate) struct ConstContinueNotMonomorphicConst {
#[primary_span]
pub span: Span,

#[subdiagnostic]
pub reason: ConstContinueNotMonomorphicConstReason,
}

#[derive(Subdiagnostic)]
pub(crate) enum ConstContinueNotMonomorphicConstReason {
#[label(mir_build_const_continue_not_const_constant_parameter)]
ConstantParameter {
#[primary_span]
span: Span,
},

#[label(mir_build_const_continue_not_const_const_block)]
ConstBlock {
#[primary_span]
span: Span,
},

#[label(mir_build_const_continue_not_const_const_other)]
Other {
#[primary_span]
span: Span,
},
}

#[derive(Diagnostic)]
#[diag(mir_build_const_continue_bad_const)]
pub(crate) struct ConstContinueBadConst {
Expand Down
5 changes: 2 additions & 3 deletions library/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,10 @@ dependencies = [

[[package]]
name = "fortanix-sgx-abi"
version = "0.5.0"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57cafc2274c10fab234f176b25903ce17e690fca7597090d50880e047a0389c5"
checksum = "5efc85edd5b83e8394f4371dd0da6859dff63dd387dab8568fece6af4cde6f84"
dependencies = [
"compiler_builtins",
"rustc-std-workspace-core",
]

Expand Down
2 changes: 1 addition & 1 deletion library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ rand_xorshift = "0.4.0"
dlmalloc = { version = "0.2.4", features = ['rustc-dep-of-std'] }

[target.x86_64-fortanix-unknown-sgx.dependencies]
fortanix-sgx-abi = { version = "0.5.0", features = [
fortanix-sgx-abi = { version = "0.6.1", features = [
'rustc-dep-of-std',
], public = true }

Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/pal/sgx/abi/usercalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ pub fn send(event_set: u64, tcs: Option<Tcs>) -> IoResult<()> {
/// Usercall `insecure_time`. See the ABI documentation for more information.
#[unstable(feature = "sgx_platform", issue = "56975")]
pub fn insecure_time() -> Duration {
let t = unsafe { raw::insecure_time() };
let t = unsafe { raw::insecure_time().0 };
Duration::new(t / 1_000_000_000, (t % 1_000_000_000) as _)
}

Expand Down
8 changes: 7 additions & 1 deletion library/std/src/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,11 @@ where
}

/// The internal representation of a `Thread` handle
///
/// We explicitly set the alignment for our guarantee in Thread::into_raw. This
/// allows applications to stuff extra metadata bits into the alignment, which
/// can be rather useful when working with atomics.
#[repr(align(8))]
struct Inner {
name: Option<ThreadNameString>,
id: ThreadId,
Expand Down Expand Up @@ -1582,7 +1587,8 @@ impl Thread {
/// Consumes the `Thread`, returning a raw pointer.
///
/// To avoid a memory leak the pointer must be converted
/// back into a `Thread` using [`Thread::from_raw`].
/// back into a `Thread` using [`Thread::from_raw`]. The pointer is
/// guaranteed to be aligned to at least 8 bytes.
///
/// # Examples
///
Expand Down
13 changes: 11 additions & 2 deletions src/doc/rustc-dev-guide/src/tests/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,6 @@ See [Pretty-printer](compiletest.md#pretty-printer-tests).

- `no-auto-check-cfg` — disable auto check-cfg (only for `--check-cfg` tests)
- [`revisions`](compiletest.md#revisions) — compile multiple times
- [`unused-revision-names`](compiletest.md#ignoring-unused-revision-names) -
suppress tidy checks for mentioning unknown revision names
-[`forbid-output`](compiletest.md#incremental-tests) — incremental cfail rejects
output pattern
- [`should-ice`](compiletest.md#incremental-tests) — incremental cfail should
Expand All @@ -315,6 +313,17 @@ test suites that use those tools:
- `llvm-cov-flags` adds extra flags when running LLVM's `llvm-cov` tool.
- Used by [coverage tests](compiletest.md#coverage-tests) in `coverage-run` mode.

### Tidy specific directives

The following directives control how the [tidy script](../conventions.md#formatting)
verifies tests.

- `ignore-tidy-target-specific-tests` disables checking that the appropriate
LLVM component is required (via a `needs-llvm-components` directive) when a
test is compiled for a specific target (via the `--target` flag in a
`compile-flag` directive).
- [`unused-revision-names`](compiletest.md#ignoring-unused-revision-names) -
suppress tidy checks for mentioning unknown revision names.

## Substitutions

Expand Down
24 changes: 19 additions & 5 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,11 @@ function preLoadCss(cssUrl) {
break;
case "-":
ev.preventDefault();
collapseAllDocs();
collapseAllDocs(false);
break;
case "_":
ev.preventDefault();
collapseAllDocs(true);
break;

case "?":
Expand Down Expand Up @@ -1038,11 +1042,14 @@ function preLoadCss(cssUrl) {
innerToggle.children[0].innerText = "Summary";
}

function collapseAllDocs() {
/**
* @param {boolean} collapseImpls - also collapse impl blocks if set to true
*/
function collapseAllDocs(collapseImpls) {
const innerToggle = document.getElementById(toggleAllDocsId);
addClass(innerToggle, "will-expand");
onEachLazy(document.getElementsByClassName("toggle"), e => {
if (e.parentNode.id !== "implementations-list" ||
if ((collapseImpls || e.parentNode.id !== "implementations-list") ||
(!hasClass(e, "implementors-toggle") &&
!hasClass(e, "type-contents-toggle"))
) {
Expand All @@ -1053,15 +1060,18 @@ function preLoadCss(cssUrl) {
innerToggle.children[0].innerText = "Show all";
}

function toggleAllDocs() {
/**
* @param {MouseEvent=} ev
*/
function toggleAllDocs(ev) {
const innerToggle = document.getElementById(toggleAllDocsId);
if (!innerToggle) {
return;
}
if (hasClass(innerToggle, "will-expand")) {
expandAllDocs();
} else {
collapseAllDocs();
collapseAllDocs(ev !== undefined && ev.shiftKey);
}
}

Expand Down Expand Up @@ -1519,6 +1529,10 @@ function preLoadCss(cssUrl) {
["&#9166;", "Go to active search result"],
["+", "Expand all sections"],
["-", "Collapse all sections"],
// for the sake of brevity, we don't say "inherint impl blocks",
// although that would be more correct,
// since trait impl blocks are collapsed by -
["_", "Collapse all sections, including impl blocks"],
].map(x => "<dt>" +
x[0].split(" ")
.map((y, index) => ((index & 1) === 0 ? "<kbd>" + y + "</kbd>" : " " + y + " "))
Expand Down
4 changes: 3 additions & 1 deletion src/librustdoc/html/static/js/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,9 @@ class RustdocToolbarElement extends HTMLElement {
<div id="help-button" tabindex="-1">
<a href="${rootPath}help.html"><span class="label">Help</span></a>
</div>
<button id="toggle-all-docs"><span class="label">Summary</span></button>`;
<button id="toggle-all-docs"
title="Collapse sections (shift-click to also collapse impl blocks)"><span
class="label">Summary</span></button>`;
}
}
window.customElements.define("rustdoc-toolbar", RustdocToolbarElement);
Loading
Loading