Skip to content

Commit a45391f

Browse files
committed
Auto merge of rust-lang#133634 - matthiaskrgr:rollup-v7m4j2k, r=matthiaskrgr
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
2 parents 0c4f3a4 + eabe6db commit a45391f

File tree

94 files changed

+281
-212
lines changed

Some content is hidden

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

94 files changed

+281
-212
lines changed

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ no_llvm_build
4646
/inst/
4747
/llvm/
4848
/mingw-build/
49-
build/
50-
!/compiler/rustc_mir_build/src/build/
49+
/build
5150
/build-rust-analyzer/
5251
/dist/
5352
/unicode-downloads

RELEASES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Libraries
4343
- [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)
4444
- [Implement `Default` for `HashMap`/`HashSet` iterators that don't already have it.](https://github.com/rust-lang/rust/pull/128711)
4545
- [Bump Unicode to version 16.0.0.](https://github.com/rust-lang/rust/pull/130183)
46-
- [Change documentation of `ptr::add`/`sub` to not claim equivalence with `offset`.](https://github.com/rust-lang/rust/pull/130229).
46+
- [Change documentation of `ptr::add`/`sub` to not claim equivalence with `offset`.](https://github.com/rust-lang/rust/pull/130229)
4747

4848

4949
<a id="1.83.0-Stabilized-APIs"></a>

compiler/rustc_mir_build/src/build/expr/as_rvalue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
231231
if range.start <= range.end { BinOp::BitAnd } else { BinOp::BitOr };
232232

233233
let mut comparer = |range: u128, bin_op: BinOp| -> Place<'tcx> {
234-
// We can use `ty::TypingEnv::fully_monomorphized()`` here
234+
// We can use `ty::TypingEnv::fully_monomorphized()` here
235235
// as we only need it to compute the layout of a primitive.
236236
let range_val = Const::from_bits(
237237
this.tcx,

compiler/rustc_target/src/asm/avr.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,12 @@ def_regs! {
105105
#error = ["SP", "SPL", "SPH"] =>
106106
"the stack pointer cannot be used as an operand for inline asm",
107107
#error = ["r0", "r1", "r1r0"] =>
108-
"r0 and r1 are not available due to an issue in LLVM",
108+
"LLVM reserves r0 (scratch register) and r1 (zero register)",
109+
// If this changes within LLVM, the compiler might use the registers
110+
// in the future. This must be reflected in the set of clobbered
111+
// registers, else the clobber ABI implementation is *unsound*, as
112+
// this generates invalid code (register is not marked as clobbered
113+
// but may change the register content).
109114
}
110115
}
111116

compiler/rustc_target/src/asm/mod.rs

+22
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,7 @@ pub enum InlineAsmClobberAbi {
928928
AArch64,
929929
AArch64NoX18,
930930
Arm64EC,
931+
Avr,
931932
RiscV,
932933
RiscVE,
933934
LoongArch,
@@ -986,6 +987,10 @@ impl InlineAsmClobberAbi {
986987
}),
987988
_ => Err(&["C", "system", "efiapi"]),
988989
},
990+
InlineAsmArch::Avr => match name {
991+
"C" | "system" => Ok(InlineAsmClobberAbi::Avr),
992+
_ => Err(&["C", "system"]),
993+
},
989994
InlineAsmArch::LoongArch64 => match name {
990995
"C" | "system" => Ok(InlineAsmClobberAbi::LoongArch),
991996
_ => Err(&["C", "system"]),
@@ -1133,6 +1138,23 @@ impl InlineAsmClobberAbi {
11331138
d24, d25, d26, d27, d28, d29, d30, d31,
11341139
}
11351140
},
1141+
InlineAsmClobberAbi::Avr => clobbered_regs! {
1142+
Avr AvrInlineAsmReg {
1143+
// The list of "Call-Used Registers" according to
1144+
// https://gcc.gnu.org/wiki/avr-gcc#Call-Used_Registers
1145+
1146+
// Clobbered registers available in inline assembly
1147+
r18, r19, r20, r21, r22, r23, r24, r25, r26, r27, r30, r31,
1148+
// As per the AVR-GCC-ABI documentation linked above, the R0
1149+
// register is a clobbered register as well. Since we don't
1150+
// allow the usage of R0 in inline assembly, nothing has to
1151+
// be done here.
1152+
// Likewise, the T-flag in the SREG should be clobbered, but
1153+
// this is not necessary to be listed here, since the SREG
1154+
// is considered clobbered anyways unless `preserve_flags`
1155+
// is used.
1156+
}
1157+
},
11361158
InlineAsmClobberAbi::RiscV => clobbered_regs! {
11371159
RiscV RiscVInlineAsmReg {
11381160
// ra

src/doc/rustc/src/platform-support/armeb-unknown-linux-gnueabi.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ BE8 architecture is the default big-endian architecture for Arm since [Armv6](ht
1616
The target is cross-compiled. This target supports `std` in the normal way (indeed only nominal changes are required from the standard Arm configuration).
1717

1818
## Target definition
19-
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.
19+
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.
2020

2121
## Building the target
2222
Because it is Tier 3, rust does not yet ship pre-compiled artifacts for this target.

src/doc/rustc/src/platform-support/s390x-unknown-linux-gnu.md

+16
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,22 @@ There are no special requirements for testing and running the target.
6464
For testing cross builds on the host, please refer to the "Cross-compilation
6565
toolchains and C code" section below.
6666

67+
If you want to do native testing but do not have your own s390x
68+
machine, there are several options how to get access to one:
69+
70+
* The [IBM LinuxONE Community Cloud][cloud-community] provides a
71+
self-service portal where you can create s390x virtual machine
72+
instances. These are intended for temporary use (limited to 120 days).
73+
74+
* The [IBM LinuxONE Open Source Cloud][cloud-opensource] provides
75+
permanent access to s390x machines. This requires approval by IBM,
76+
which will normally be granted if you're planning to use the machine
77+
to work on an open-source project that is relevant to the IBM Z
78+
ecosystem - the Rust compiler would certainly qualify.
79+
80+
[cloud-community]: https://linuxone.cloud.marist.edu/
81+
[cloud-opensource]: https://community.ibm.com/zsystems/form/l1cc-oss-vm-request/
82+
6783
## Cross-compilation toolchains and C code
6884

6985
Rust code built using the target is compatible with C code compiled with

src/librustdoc/html/static/css/rustdoc.css

+35-15
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ xmlns="http://www.w3.org/2000/svg" fill="black" height="18px">\
3636
--button-border-radius: 2px;
3737
--toolbar-button-border-radius: 6px;
3838
--code-block-border-radius: 6px;
39+
--impl-items-indent: 0.3em;
40+
--docblock-indent: 24px;
3941
}
4042

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

911913
.docblock {
912-
margin-left: 24px;
914+
margin-left: var(--docblock-indent);
913915
position: relative;
914916
}
915917

@@ -982,7 +984,11 @@ div.where {
982984

983985
.item-info {
984986
display: block;
985-
margin-left: 24px;
987+
margin-left: var(--docblock-indent);
988+
}
989+
.impl-items > .item-info {
990+
/* Margin of docblocks + margin of impl block items. */
991+
margin-left: calc(var(--docblock-indent) + var(--impl-items-indent));
986992
}
987993

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

2175+
/* We indent items of an impl block to have a visual marker that these items are part
2176+
of this impl block. */
2177+
.impl-items > *:not(.item-info),
2178+
/* We also indent the first top doc comment the same to still keep an indent on the
2179+
doc block while aligning it with the impl block items. */
2180+
.implementors-toggle > .docblock {
2181+
margin-left: var(--impl-items-indent);
2182+
}
2183+
21692184
details.big-toggle > summary:not(.hideme)::before {
21702185
left: -34px;
21712186
top: 9px;
@@ -2255,6 +2270,10 @@ If you update this line, then you also need to update the line with the same war
22552270
in src-script.js and main.js
22562271
*/
22572272
@media (max-width: 700px) {
2273+
:root {
2274+
--impl-items-indent: 0.7em;
2275+
}
2276+
22582277
/* When linking to an item with an `id` (for instance, by clicking a link in the sidebar,
22592278
or visiting a URL with a fragment like `#method.new`, we don't want the item to be obscured
22602279
by the topbar. Anything with an `id` gets scroll-margin-top equal to .mobile-topbar's size.
@@ -2454,19 +2473,20 @@ in src-script.js and main.js
24542473
padding-top: 0;
24552474
}
24562475

2457-
/* Position of the "[-]" element. */
2458-
details.toggle:not(.top-doc) > summary, .impl-items > section {
2476+
details.implementors-toggle:not(.top-doc) > summary {
24592477
margin-left: 10px;
24602478
}
2461-
.impl-items > details.toggle > summary:not(.hideme)::before,
2462-
#main-content > details.toggle:not(.top-doc) > summary::before,
2463-
#main-content > div > details.toggle > summary::before {
2464-
left: -11px;
2479+
2480+
.impl-items > details.toggle > summary:not(.hideme)::before {
2481+
left: -20px;
24652482
}
24662483

24672484
/* Align summary-nested and unnested item-info gizmos. */
2485+
summary > .item-info {
2486+
margin-left: 10px;
2487+
}
24682488
.impl-items > .item-info {
2469-
margin-left: 34px;
2489+
margin-left: calc(var(--impl-items-indent) + 10px);
24702490
}
24712491

24722492
.src nav.sub {
@@ -2500,24 +2520,24 @@ in src-script.js and main.js
25002520
}
25012521

25022522
@media print {
2523+
:root {
2524+
--docblock-indent: 0;
2525+
}
2526+
25032527
nav.sidebar, nav.sub, .out-of-band, a.src, #copy-path,
25042528
details.toggle[open] > summary::before, details.toggle > summary::before,
25052529
details.toggle.top-doc > summary {
25062530
display: none;
25072531
}
25082532

2509-
.docblock {
2510-
margin-left: 0;
2511-
}
2512-
25132533
main {
25142534
padding: 10px;
25152535
}
25162536
}
25172537

25182538
@media (max-width: 464px) {
2519-
.docblock {
2520-
margin-left: 12px;
2539+
:root {
2540+
--docblock-indent: 12px;
25212541
}
25222542

25232543
.docblock code {

src/tools/nix-dev-shell/envrc-flake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# If you want to use this as an .envrc file to create a shell with necessery components
22
# to develop rustc, use the following command in the root of the rusr checkout:
33
#
4-
# ln -s ./src/tools/nix-dev-shell/envrc-flake ./.envrc && echo .envrc >> .git/info/exclude
4+
# ln -s ./src/tools/nix-dev-shell/envrc-flake ./.envrc && nix flake update --flake ./src/tools/nix-dev-shell && echo .envrc >> .git/info/exclude
55

66
if nix flake show path:./src/tools/nix-dev-shell &> /dev/null; then
77
use flake path:./src/tools/nix-dev-shell

tests/codegen/asm/avr-clobbers.rs

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//@ assembly-output: emit-asm
2+
//@ compile-flags: --target avr-unknown-gnu-atmega328
3+
//@ needs-llvm-components: avr
4+
5+
#![crate_type = "rlib"]
6+
#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)]
7+
#![no_core]
8+
9+
#[lang = "sized"]
10+
trait Sized {}
11+
12+
#[rustc_builtin_macro]
13+
macro_rules! asm {
14+
() => {};
15+
}
16+
17+
// CHECK-LABEL: @sreg_is_clobbered
18+
// CHECK: void asm sideeffect "", "~{sreg}"()
19+
#[no_mangle]
20+
pub unsafe fn sreg_is_clobbered() {
21+
asm!("", options(nostack, nomem));
22+
}
23+
24+
// CHECK-LABEL: @sreg_is_not_clobbered_if_preserve_flags_is_used
25+
// CHECK: void asm sideeffect "", ""()
26+
#[no_mangle]
27+
pub unsafe fn sreg_is_not_clobbered_if_preserve_flags_is_used() {
28+
asm!("", options(nostack, nomem, preserves_flags));
29+
}
30+
31+
// CHECK-LABEL: @clobber_abi
32+
// CHECK: asm sideeffect "", "={r18},={r19},={r20},={r21},={r22},={r23},={r24},={r25},={r26},={r27},={r30},={r31},~{sreg}"()
33+
#[no_mangle]
34+
pub unsafe fn clobber_abi() {
35+
asm!("", clobber_abi("C"), options(nostack, nomem));
36+
}
37+
38+
// CHECK-LABEL: @clobber_abi_with_preserved_flags
39+
// CHECK: asm sideeffect "", "={r18},={r19},={r20},={r21},={r22},={r23},={r24},={r25},={r26},={r27},={r30},={r31}"()
40+
#[no_mangle]
41+
pub unsafe fn clobber_abi_with_preserved_flags() {
42+
asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags));
43+
}

tests/rustdoc-gui/deref-block.goml

+6-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ assert-css: (".big-toggle summary::before", {
2020
"left": "-11px",
2121
"top": "9px",
2222
})
23-
// It should have the same X position as the other toggles.
24-
compare-elements-position: (".big-toggle summary::before", ".method-toggle summary::before", ["x"])
23+
// It should have a slightly different X position as the other toggles.
24+
store-position: (".big-toggle summary::before", {"x": big_toggle})
25+
store-position: (".method-toggle summary::before", {"x": small_toggle})
26+
assert: |big_toggle| < |small_toggle|
27+
// Margin is 0.5em so around 8 px.
28+
assert: |small_toggle| - |big_toggle| < 10
2529
// But still shouldn't have the same Y position.
2630
compare-elements-position-false: (
2731
".big-toggle summary::before",

tests/rustdoc-gui/docblock-table-overflow.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ compare-elements-property: (
1616
"#implementations-list > details .docblock > p",
1717
["scrollWidth"],
1818
)
19-
assert-property: ("#implementations-list > details .docblock", {"scrollWidth": "816"})
19+
assert-property: ("#implementations-list > details .docblock", {"scrollWidth": "835"})
2020
// However, since there is overflow in the <table>, its scroll width is bigger.
2121
assert-property: ("#implementations-list > details .docblock table", {"scrollWidth": "1572"})

tests/rustdoc-gui/item-info-alignment.goml

+2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ go-to: "file://" + |DOC_PATH| + "/lib2/struct.ItemInfoAlignmentTest.html"
44

55
// First, we try it in "desktop" mode.
66
set-window-size: (1200, 870)
7+
wait-for-size: ("body", {"width": 1200})
78
compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ["x"])
89
// Next, we try it in "mobile" mode (max-width: 700px).
910
set-window-size: (650, 650)
11+
wait-for-size: ("body", {"width": 650})
1012
compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ["x"])

tests/rustdoc-gui/item-info.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ store-position: (
1919
"//*[@class='stab portability']//code[normalize-space()='Win32_System_Diagnostics']",
2020
{"x": second_line_x, "y": second_line_y},
2121
)
22-
assert: |first_line_x| != |second_line_x| && |first_line_x| == 516 && |second_line_x| == 272
22+
assert: |first_line_x| != |second_line_x| && |first_line_x| == 521 && |second_line_x| == 277
2323
assert: |first_line_y| != |second_line_y| && |first_line_y| == 718 && |second_line_y| == 741
2424

2525
// Now we ensure that they're not rendered on the same line.

tests/rustdoc-gui/methods-left-margin.goml

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// This test is to ensure that methods are correctly aligned on the left side.
22

33
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
4-
54
// First we ensure that we have methods with and without documentation.
65
assert: ".impl-items > details.method-toggle > summary > section.method"
76
assert: ".impl-items > section.method"

tests/rustdoc-gui/notable-trait.goml

+7-7
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ define-function: (
6262
// We start with a wide screen.
6363
set-window-size: (1100, 600)
6464
call-function: ("check-notable-tooltip-position-complete", {
65-
"x": 677,
66-
"i_x": 955,
67-
"popover_x": 463,
65+
"x": 682,
66+
"i_x": 960,
67+
"popover_x": 468,
6868
})
6969

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

8585
// Checking on mobile now.
8686
set-window-size: (650, 600)
8787
wait-for-size: ("body", {"width": 650})
8888
call-function: ("check-notable-tooltip-position-complete", {
89-
"x": 25,
90-
"i_x": 303,
89+
"x": 26,
90+
"i_x": 305,
9191
"popover_x": 0,
9292
})
9393

tests/rustdoc-gui/toggle-docs-mobile.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ assert-position: ("#implementations-list > details > summary::before", {"x": 4})
1818
// Assert the position of the toggle on a method.
1919
assert-position: (
2020
"#trait-implementations-list .impl-items .method-toggle > summary::before",
21-
{"x": 4},
21+
{"x": 6},
2222
)
2323

2424
// Now we do the same but with a little bigger width

tests/rustdoc-ui/doctest/doctest-output-include-fail.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ edition:2024
2-
//@ compile-flags:--test --test-args=--test-threads=1 -Z unstable-options
2+
//@ compile-flags:--test --test-args=--test-threads=1
33
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
44
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
55
//@ failure-status: 101

tests/rustdoc-ui/doctest/doctest-output.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//@[edition2015]compile-flags:--test --test-args=--test-threads=1
55
//@[edition2024]edition:2015
66
//@[edition2024]aux-build:extern_macros.rs
7-
//@[edition2024]compile-flags:--test --test-args=--test-threads=1 -Z unstable-options
7+
//@[edition2024]compile-flags:--test --test-args=--test-threads=1
88
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
99
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
1010
//@ check-pass

0 commit comments

Comments
 (0)