Auto merge of #125164 - fmease:rollup-s5vwzlg, r=fmease · rust-lang/rust@1871252 (original) (raw)
File tree
10 files changed
lines changed
- compiler/rustc_target/src/abi/call
- library/std/src/sys/pal/unix
- rustdoc-scrape-examples-ordering
10 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -779,26 +779,31 @@ impl RiscvInterruptKind { | ||
779 | 779 | /// Metadata describing how the arguments to a native function |
780 | 780 | /// should be passed in order to respect the native ABI. |
781 | 781 | /// |
782 | +/// The signature represented by this type may not match the MIR function signature. | |
783 | +/// Certain attributes, like `#[track_caller]` can introduce additional arguments, which are present in [`FnAbi`], but not in `FnSig`. | |
784 | +/// While this difference is rarely relevant, it should still be kept in mind. | |
785 | +/// | |
782 | 786 | /// I will do my best to describe this structure, but these |
783 | 787 | /// comments are reverse-engineered and may be inaccurate. -NDM |
784 | 788 | #[derive(Clone, PartialEq, Eq, Hash, HashStable_Generic)] |
785 | 789 | pub struct FnAbi<'a, Ty> { |
786 | -/// The LLVM types of each argument. | |
790 | +/// The type, layout, and information about how each argument is passed. | |
787 | 791 | pub args: Box<[ArgAbi<'a, Ty>]>, |
788 | 792 | |
789 | -/// LLVM return type. | |
793 | +/// The layout, type, and the way a value is returned from this function. | |
790 | 794 | pub ret: ArgAbi<'a, Ty>, |
791 | 795 | |
796 | +/// Marks this function as variadic (accepting a variable number of arguments). | |
792 | 797 | pub c_variadic: bool, |
793 | 798 | |
794 | 799 | /// The count of non-variadic arguments. |
795 | 800 | /// |
796 | 801 | /// Should only be different from args.len() when c_variadic is true. |
797 | 802 | /// This can be used to know whether an argument is variadic or not. |
798 | 803 | pub fixed_count: u32, |
799 | - | |
804 | + /// The calling convention of this function. | |
800 | 805 | pub conv: Conv, |
801 | - | |
806 | + /// Indicates if an unwind may happen across a call to this function. | |
802 | 807 | pub can_unwind: bool, |
803 | 808 | } |
804 | 809 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -87,21 +87,18 @@ cfg_if::cfg_if! { | ||
87 | 87 | // /memory/aligned_memory.cc |
88 | 88 | libc::memalign(layout.align(), layout.size()) as *mut u8 |
89 | 89 | } |
90 | -} else if #[cfg(target_os = "wasi")] { | |
91 | - #[inline] | |
92 | -unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 { | |
93 | -// C11 aligned_alloc requires that the size be a multiple of the alignment. | |
94 | -// Layout already checks that the size rounded up doesn't overflow isize::MAX. | |
95 | -let align = layout.align(); | |
96 | -let size = layout.size().next_multiple_of(align); | |
97 | - libc::aligned_alloc(align, size) as *mut u8 | |
98 | -} | |
99 | 90 | } else { |
100 | 91 | #[inline] |
101 | 92 | unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 { |
102 | 93 | let mut out = ptr::null_mut(); |
103 | -// posix_memalign requires that the alignment be a multiple of `sizeof(void*)`. | |
104 | -// Since these are all powers of 2, we can just use max. | |
94 | +// We prefer posix_memalign over aligned_malloc since with aligned_malloc, | |
95 | +// implementations are making almost arbitrary choices for which alignments are | |
96 | +// "supported", making it hard to use. For instance, some implementations require the | |
97 | +// size to be a multiple of the alignment (wasi emmalloc), while others require the | |
98 | +// alignment to be at least the pointer size (Illumos, macOS) -- which may or may not be | |
99 | +// standards-compliant, but that does not help us. | |
100 | +// posix_memalign only has one, clear requirement: that the alignment be a multiple of | |
101 | +// `sizeof(void*)`. Since these are all powers of 2, we can just use max. | |
105 | 102 | let align = layout.align().max(crate::mem::size_of::<usize>()); |
106 | 103 | let ret = libc::posix_memalign(&mut out, align, layout.size()); |
107 | 104 | if ret != 0 { ptr::null_mut() } else { out as *mut u8 } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -64,6 +64,12 @@ pub fn python_command() -> Command { | ||
64 | 64 | Command::new(python_path) |
65 | 65 | } |
66 | 66 | |
67 | +pub fn htmldocck() -> Command { | |
68 | +let mut python = python_command(); | |
69 | + python.arg(source_path().join("/src/etc/htmldocck.py")); | |
70 | + python | |
71 | +} | |
72 | + | |
67 | 73 | pub fn source_path() -> PathBuf { |
68 | 74 | std::env::var("S").expect("S variable does not exist").into() |
69 | 75 | } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -190,7 +190,6 @@ run-make/output-with-hyphens/Makefile | ||
190 | 190 | run-make/override-aliased-flags/Makefile |
191 | 191 | run-make/overwrite-input/Makefile |
192 | 192 | run-make/panic-abort-eh_frame/Makefile |
193 | -run-make/panic-impl-transitive/Makefile | |
194 | 193 | run-make/pass-linker-flags-flavor/Makefile |
195 | 194 | run-make/pass-linker-flags-from-dep/Makefile |
196 | 195 | run-make/pass-linker-flags/Makefile |
@@ -243,7 +242,6 @@ run-make/rustdoc-scrape-examples-multiple/Makefile | ||
243 | 242 | run-make/rustdoc-scrape-examples-remap/Makefile |
244 | 243 | run-make/rustdoc-scrape-examples-test/Makefile |
245 | 244 | run-make/rustdoc-scrape-examples-whitespace/Makefile |
246 | -run-make/rustdoc-themes/Makefile | |
247 | 245 | run-make/rustdoc-verify-output-files/Makefile |
248 | 246 | run-make/rustdoc-with-out-dir-option/Makefile |
249 | 247 | run-make/rustdoc-with-output-option/Makefile |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
1 | +// In Rust programs where the standard library is unavailable (#![no_std]), we may be interested | |
2 | +// in customizing how panics are handled. Here, the provider specifies that panics should be handled | |
3 | +// by entering an infinite loop. This test checks that this panic implementation can be transitively | |
4 | +// provided by an external crate. | |
5 | +// --emit=llvm-ir is used to avoid running the linker, as linking will fail due to the lack of main | |
6 | +// function in the crate. | |
7 | +// See https://github.com/rust-lang/rust/pull/50338 | |
8 | + | |
9 | +use run_make_support::{rustc, tmp_dir}; | |
10 | + | |
11 | +fn main() { | |
12 | +rustc().input("panic-impl-provider.rs").run(); | |
13 | +rustc() | |
14 | +.input("panic-impl-consumer.rs") | |
15 | +.panic("abort") | |
16 | +.emit("llvm-ir") | |
17 | +.library_search_path(tmp_dir()) | |
18 | +.run(); | |
19 | +} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
1 | -use run_make_support::{python_command, rustc, rustdoc, source_path, tmp_dir}; | |
1 | +use run_make_support::{htmldocck, rustc, rustdoc, source_path, tmp_dir}; | |
2 | 2 | use std::fs::read_dir; |
3 | 3 | use std::path::Path; |
4 | 4 | |
@@ -45,11 +45,5 @@ fn main() { | ||
45 | 45 | } |
46 | 46 | rustdoc.run(); |
47 | 47 | |
48 | -python_command() | |
49 | -.arg(source_path().join("/src/etc/htmldocck.py")) | |
50 | -.arg(out_dir) | |
51 | -.arg("src/lib.rs") | |
52 | -.status() | |
53 | -.unwrap() | |
54 | -.success(); | |
48 | +htmldocck().arg(out_dir).arg("src/lib.rs").status().unwrap().success(); | |
55 | 49 | } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
1 | +// Test that rustdoc will properly load in a theme file and display it in the theme selector. | |
2 | + | |
3 | +use run_make_support::{htmldocck, rustdoc, source_path, tmp_dir}; | |
4 | + | |
5 | +fn main() { | |
6 | +let out_dir = tmp_dir().join("rustdoc-themes"); | |
7 | +let test_css = out_dir.join("test.css"); | |
8 | + | |
9 | +let no_script = | |
10 | + std::fs::read_to_string(source_path().join("src/librustdoc/html/static/css/noscript.css")) | |
11 | +.unwrap(); | |
12 | + | |
13 | +let mut test_content = String::new(); | |
14 | +let mut found_begin_light = false; | |
15 | +for line in no_script.split('\n') { | |
16 | +if line == "/* Begin theme: light */" { | |
17 | + found_begin_light = true; | |
18 | +} else if line == "/* End theme: light */" { | |
19 | +break; | |
20 | +} else if found_begin_light { | |
21 | + test_content.push_str(line); | |
22 | + test_content.push('\n'); | |
23 | +} | |
24 | +} | |
25 | +assert!(!test_content.is_empty()); | |
26 | + std::fs::create_dir_all(&out_dir).unwrap(); | |
27 | + std::fs::write(&test_css, test_content).unwrap(); | |
28 | + | |
29 | +rustdoc().output(&out_dir).input("foo.rs").arg("--theme").arg(&test_css).run(); | |
30 | +htmldocck().arg(out_dir).arg("foo.rs").status().unwrap().success(); | |
31 | +} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -9,11 +9,14 @@ allow-unauthenticated = [ | ||
9 | 9 | "E-*", |
10 | 10 | "F-*", |
11 | 11 | "I-*", |
12 | +"L-*", | |
12 | 13 | "NLL-*", |
13 | 14 | "O-*", |
15 | +"PG-*", | |
14 | 16 | "S-*", |
15 | 17 | "T-*", |
16 | 18 | "WG-*", |
19 | +"-Z*", | |
17 | 20 | "beta-nominated", |
18 | 21 | "const-hack", |
19 | 22 | "llvm-*", |