Skip to content

Commit

Permalink
Auto merge of rust-lang#133634 - matthiaskrgr:rollup-v7m4j2k, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#131323 (Support `clobber_abi` in AVR inline assembly)
 - rust-lang#131718 ([rustdoc] Change impl items indent)
 - rust-lang#133565 (chore: fix 404 status URL)
 - rust-lang#133575 (Fix typo in RELEASES.md)
 - rust-lang#133577 (Document s390x machine access via community cloud)
 - rust-lang#133584 (Update more 2024 tests to remove -Zunstable-options)
 - rust-lang#133592 (Misc: better instructions for envrc, ignore `/build` instead of `build/`)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Nov 29, 2024
2 parents 0c4f3a4 + eabe6db commit a45391f
Show file tree
Hide file tree
Showing 94 changed files with 281 additions and 212 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ no_llvm_build
/inst/
/llvm/
/mingw-build/
build/
!/compiler/rustc_mir_build/src/build/
/build
/build-rust-analyzer/
/dist/
/unicode-downloads
Expand Down
2 changes: 1 addition & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Libraries
- [Document that `catch_unwind` can deal with foreign exceptions without UB, although the exact behavior is unspecified.](https://github.com/rust-lang/rust/pull/128321)
- [Implement `Default` for `HashMap`/`HashSet` iterators that don't already have it.](https://github.com/rust-lang/rust/pull/128711)
- [Bump Unicode to version 16.0.0.](https://github.com/rust-lang/rust/pull/130183)
- [Change documentation of `ptr::add`/`sub` to not claim equivalence with `offset`.](https://github.com/rust-lang/rust/pull/130229).
- [Change documentation of `ptr::add`/`sub` to not claim equivalence with `offset`.](https://github.com/rust-lang/rust/pull/130229)


<a id="1.83.0-Stabilized-APIs"></a>
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/build/expr/as_rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
if range.start <= range.end { BinOp::BitAnd } else { BinOp::BitOr };

let mut comparer = |range: u128, bin_op: BinOp| -> Place<'tcx> {
// We can use `ty::TypingEnv::fully_monomorphized()`` here
// We can use `ty::TypingEnv::fully_monomorphized()` here
// as we only need it to compute the layout of a primitive.
let range_val = Const::from_bits(
this.tcx,
Expand Down
7 changes: 6 additions & 1 deletion compiler/rustc_target/src/asm/avr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ def_regs! {
#error = ["SP", "SPL", "SPH"] =>
"the stack pointer cannot be used as an operand for inline asm",
#error = ["r0", "r1", "r1r0"] =>
"r0 and r1 are not available due to an issue in LLVM",
"LLVM reserves r0 (scratch register) and r1 (zero register)",
// If this changes within LLVM, the compiler might use the registers
// in the future. This must be reflected in the set of clobbered
// registers, else the clobber ABI implementation is *unsound*, as
// this generates invalid code (register is not marked as clobbered
// but may change the register content).
}
}

Expand Down
22 changes: 22 additions & 0 deletions compiler/rustc_target/src/asm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,7 @@ pub enum InlineAsmClobberAbi {
AArch64,
AArch64NoX18,
Arm64EC,
Avr,
RiscV,
RiscVE,
LoongArch,
Expand Down Expand Up @@ -986,6 +987,10 @@ impl InlineAsmClobberAbi {
}),
_ => Err(&["C", "system", "efiapi"]),
},
InlineAsmArch::Avr => match name {
"C" | "system" => Ok(InlineAsmClobberAbi::Avr),
_ => Err(&["C", "system"]),
},
InlineAsmArch::LoongArch64 => match name {
"C" | "system" => Ok(InlineAsmClobberAbi::LoongArch),
_ => Err(&["C", "system"]),
Expand Down Expand Up @@ -1133,6 +1138,23 @@ impl InlineAsmClobberAbi {
d24, d25, d26, d27, d28, d29, d30, d31,
}
},
InlineAsmClobberAbi::Avr => clobbered_regs! {
Avr AvrInlineAsmReg {
// The list of "Call-Used Registers" according to
// https://gcc.gnu.org/wiki/avr-gcc#Call-Used_Registers

// Clobbered registers available in inline assembly
r18, r19, r20, r21, r22, r23, r24, r25, r26, r27, r30, r31,
// As per the AVR-GCC-ABI documentation linked above, the R0
// register is a clobbered register as well. Since we don't
// allow the usage of R0 in inline assembly, nothing has to
// be done here.
// Likewise, the T-flag in the SREG should be clobbered, but
// this is not necessary to be listed here, since the SREG
// is considered clobbered anyways unless `preserve_flags`
// is used.
}
},
InlineAsmClobberAbi::RiscV => clobbered_regs! {
RiscV RiscVInlineAsmReg {
// ra
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ BE8 architecture is the default big-endian architecture for Arm since [Armv6](ht
The target is cross-compiled. This target supports `std` in the normal way (indeed only nominal changes are required from the standard Arm configuration).

## Target definition
The target definition can be seen [here](https://github.com/rust-lang/rust/tree/master/compiler/rustc_target/src/spec/armeb_unknown_linux_gnueabi.rs). In particular, it should be noted that the `features` specify that this target is built for the Armv8 core. Though this can likely be modified as required.
The target definition can be seen [here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs). In particular, it should be noted that the `features` specify that this target is built for the Armv8 core. Though this can likely be modified as required.

## Building the target
Because it is Tier 3, rust does not yet ship pre-compiled artifacts for this target.
Expand Down
16 changes: 16 additions & 0 deletions src/doc/rustc/src/platform-support/s390x-unknown-linux-gnu.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@ There are no special requirements for testing and running the target.
For testing cross builds on the host, please refer to the "Cross-compilation
toolchains and C code" section below.

If you want to do native testing but do not have your own s390x
machine, there are several options how to get access to one:

* The [IBM LinuxONE Community Cloud][cloud-community] provides a
self-service portal where you can create s390x virtual machine
instances. These are intended for temporary use (limited to 120 days).

* The [IBM LinuxONE Open Source Cloud][cloud-opensource] provides
permanent access to s390x machines. This requires approval by IBM,
which will normally be granted if you're planning to use the machine
to work on an open-source project that is relevant to the IBM Z
ecosystem - the Rust compiler would certainly qualify.

[cloud-community]: https://linuxone.cloud.marist.edu/
[cloud-opensource]: https://community.ibm.com/zsystems/form/l1cc-oss-vm-request/

## Cross-compilation toolchains and C code

Rust code built using the target is compatible with C code compiled with
Expand Down
50 changes: 35 additions & 15 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ xmlns="http://www.w3.org/2000/svg" fill="black" height="18px">\
--button-border-radius: 2px;
--toolbar-button-border-radius: 6px;
--code-block-border-radius: 6px;
--impl-items-indent: 0.3em;
--docblock-indent: 24px;
}

/* See FiraSans-LICENSE.txt for the Fira Sans license. */
Expand Down Expand Up @@ -909,7 +911,7 @@ both the code example and the line numbers, so we need to remove the radius in t
.docblock h6 { font-size: 0.875rem; }

.docblock {
margin-left: 24px;
margin-left: var(--docblock-indent);
position: relative;
}

Expand Down Expand Up @@ -982,7 +984,11 @@ div.where {

.item-info {
display: block;
margin-left: 24px;
margin-left: var(--docblock-indent);
}
.impl-items > .item-info {
/* Margin of docblocks + margin of impl block items. */
margin-left: calc(var(--docblock-indent) + var(--impl-items-indent));
}

.item-info code {
Expand Down Expand Up @@ -2166,6 +2172,15 @@ details.toggle > summary:not(.hideme)::before {
left: -24px;
}

/* We indent items of an impl block to have a visual marker that these items are part
of this impl block. */
.impl-items > *:not(.item-info),
/* We also indent the first top doc comment the same to still keep an indent on the
doc block while aligning it with the impl block items. */
.implementors-toggle > .docblock {
margin-left: var(--impl-items-indent);
}

details.big-toggle > summary:not(.hideme)::before {
left: -34px;
top: 9px;
Expand Down Expand Up @@ -2255,6 +2270,10 @@ If you update this line, then you also need to update the line with the same war
in src-script.js and main.js
*/
@media (max-width: 700px) {
:root {
--impl-items-indent: 0.7em;
}

/* When linking to an item with an `id` (for instance, by clicking a link in the sidebar,
or visiting a URL with a fragment like `#method.new`, we don't want the item to be obscured
by the topbar. Anything with an `id` gets scroll-margin-top equal to .mobile-topbar's size.
Expand Down Expand Up @@ -2454,19 +2473,20 @@ in src-script.js and main.js
padding-top: 0;
}

/* Position of the "[-]" element. */
details.toggle:not(.top-doc) > summary, .impl-items > section {
details.implementors-toggle:not(.top-doc) > summary {
margin-left: 10px;
}
.impl-items > details.toggle > summary:not(.hideme)::before,
#main-content > details.toggle:not(.top-doc) > summary::before,
#main-content > div > details.toggle > summary::before {
left: -11px;

.impl-items > details.toggle > summary:not(.hideme)::before {
left: -20px;
}

/* Align summary-nested and unnested item-info gizmos. */
summary > .item-info {
margin-left: 10px;
}
.impl-items > .item-info {
margin-left: 34px;
margin-left: calc(var(--impl-items-indent) + 10px);
}

.src nav.sub {
Expand Down Expand Up @@ -2500,24 +2520,24 @@ in src-script.js and main.js
}

@media print {
:root {
--docblock-indent: 0;
}

nav.sidebar, nav.sub, .out-of-band, a.src, #copy-path,
details.toggle[open] > summary::before, details.toggle > summary::before,
details.toggle.top-doc > summary {
display: none;
}

.docblock {
margin-left: 0;
}

main {
padding: 10px;
}
}

@media (max-width: 464px) {
.docblock {
margin-left: 12px;
:root {
--docblock-indent: 12px;
}

.docblock code {
Expand Down
2 changes: 1 addition & 1 deletion src/tools/nix-dev-shell/envrc-flake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# If you want to use this as an .envrc file to create a shell with necessery components
# to develop rustc, use the following command in the root of the rusr checkout:
#
# ln -s ./src/tools/nix-dev-shell/envrc-flake ./.envrc && echo .envrc >> .git/info/exclude
# ln -s ./src/tools/nix-dev-shell/envrc-flake ./.envrc && nix flake update --flake ./src/tools/nix-dev-shell && echo .envrc >> .git/info/exclude

if nix flake show path:./src/tools/nix-dev-shell &> /dev/null; then
use flake path:./src/tools/nix-dev-shell
Expand Down
43 changes: 43 additions & 0 deletions tests/codegen/asm/avr-clobbers.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//@ assembly-output: emit-asm
//@ compile-flags: --target avr-unknown-gnu-atmega328
//@ needs-llvm-components: avr

#![crate_type = "rlib"]
#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)]
#![no_core]

#[lang = "sized"]
trait Sized {}

#[rustc_builtin_macro]
macro_rules! asm {
() => {};
}

// CHECK-LABEL: @sreg_is_clobbered
// CHECK: void asm sideeffect "", "~{sreg}"()
#[no_mangle]
pub unsafe fn sreg_is_clobbered() {
asm!("", options(nostack, nomem));
}

// CHECK-LABEL: @sreg_is_not_clobbered_if_preserve_flags_is_used
// CHECK: void asm sideeffect "", ""()
#[no_mangle]
pub unsafe fn sreg_is_not_clobbered_if_preserve_flags_is_used() {
asm!("", options(nostack, nomem, preserves_flags));
}

// CHECK-LABEL: @clobber_abi
// CHECK: asm sideeffect "", "={r18},={r19},={r20},={r21},={r22},={r23},={r24},={r25},={r26},={r27},={r30},={r31},~{sreg}"()
#[no_mangle]
pub unsafe fn clobber_abi() {
asm!("", clobber_abi("C"), options(nostack, nomem));
}

// CHECK-LABEL: @clobber_abi_with_preserved_flags
// CHECK: asm sideeffect "", "={r18},={r19},={r20},={r21},={r22},={r23},={r24},={r25},={r26},={r27},={r30},={r31}"()
#[no_mangle]
pub unsafe fn clobber_abi_with_preserved_flags() {
asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags));
}
8 changes: 6 additions & 2 deletions tests/rustdoc-gui/deref-block.goml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ assert-css: (".big-toggle summary::before", {
"left": "-11px",
"top": "9px",
})
// It should have the same X position as the other toggles.
compare-elements-position: (".big-toggle summary::before", ".method-toggle summary::before", ["x"])
// It should have a slightly different X position as the other toggles.
store-position: (".big-toggle summary::before", {"x": big_toggle})
store-position: (".method-toggle summary::before", {"x": small_toggle})
assert: |big_toggle| < |small_toggle|
// Margin is 0.5em so around 8 px.
assert: |small_toggle| - |big_toggle| < 10
// But still shouldn't have the same Y position.
compare-elements-position-false: (
".big-toggle summary::before",
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/docblock-table-overflow.goml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ compare-elements-property: (
"#implementations-list > details .docblock > p",
["scrollWidth"],
)
assert-property: ("#implementations-list > details .docblock", {"scrollWidth": "816"})
assert-property: ("#implementations-list > details .docblock", {"scrollWidth": "835"})
// However, since there is overflow in the <table>, its scroll width is bigger.
assert-property: ("#implementations-list > details .docblock table", {"scrollWidth": "1572"})
2 changes: 2 additions & 0 deletions tests/rustdoc-gui/item-info-alignment.goml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ go-to: "file://" + |DOC_PATH| + "/lib2/struct.ItemInfoAlignmentTest.html"

// First, we try it in "desktop" mode.
set-window-size: (1200, 870)
wait-for-size: ("body", {"width": 1200})
compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ["x"])
// Next, we try it in "mobile" mode (max-width: 700px).
set-window-size: (650, 650)
wait-for-size: ("body", {"width": 650})
compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ["x"])
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/item-info.goml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ store-position: (
"//*[@class='stab portability']//code[normalize-space()='Win32_System_Diagnostics']",
{"x": second_line_x, "y": second_line_y},
)
assert: |first_line_x| != |second_line_x| && |first_line_x| == 516 && |second_line_x| == 272
assert: |first_line_x| != |second_line_x| && |first_line_x| == 521 && |second_line_x| == 277
assert: |first_line_y| != |second_line_y| && |first_line_y| == 718 && |second_line_y| == 741

// Now we ensure that they're not rendered on the same line.
Expand Down
1 change: 0 additions & 1 deletion tests/rustdoc-gui/methods-left-margin.goml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// This test is to ensure that methods are correctly aligned on the left side.

go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"

// First we ensure that we have methods with and without documentation.
assert: ".impl-items > details.method-toggle > summary > section.method"
assert: ".impl-items > section.method"
Expand Down
14 changes: 7 additions & 7 deletions tests/rustdoc-gui/notable-trait.goml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ define-function: (
// We start with a wide screen.
set-window-size: (1100, 600)
call-function: ("check-notable-tooltip-position-complete", {
"x": 677,
"i_x": 955,
"popover_x": 463,
"x": 682,
"i_x": 960,
"popover_x": 468,
})

// Now only the `i` should be on the next line.
Expand All @@ -78,16 +78,16 @@ compare-elements-position-false: (
// Now both the `i` and the struct name should be on the next line.
set-window-size: (980, 600)
call-function: ("check-notable-tooltip-position", {
"x": 245,
"i_x": 523,
"x": 250,
"i_x": 528,
})

// Checking on mobile now.
set-window-size: (650, 600)
wait-for-size: ("body", {"width": 650})
call-function: ("check-notable-tooltip-position-complete", {
"x": 25,
"i_x": 303,
"x": 26,
"i_x": 305,
"popover_x": 0,
})

Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-gui/toggle-docs-mobile.goml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ assert-position: ("#implementations-list > details > summary::before", {"x": 4})
// Assert the position of the toggle on a method.
assert-position: (
"#trait-implementations-list .impl-items .method-toggle > summary::before",
{"x": 4},
{"x": 6},
)

// Now we do the same but with a little bigger width
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-ui/doctest/doctest-output-include-fail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ edition:2024
//@ compile-flags:--test --test-args=--test-threads=1 -Z unstable-options
//@ compile-flags:--test --test-args=--test-threads=1
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ failure-status: 101
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-ui/doctest/doctest-output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//@[edition2015]compile-flags:--test --test-args=--test-threads=1
//@[edition2024]edition:2015
//@[edition2024]aux-build:extern_macros.rs
//@[edition2024]compile-flags:--test --test-args=--test-threads=1 -Z unstable-options
//@[edition2024]compile-flags:--test --test-args=--test-threads=1
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ check-pass
Expand Down
Loading

0 comments on commit a45391f

Please sign in to comment.