authorbors <bors@rust-lang.org> 2026-06-30 23:49:17 UTC
committerbors <bors@rust-lang.org> 2026-06-30 23:49:17 UTC
log17aa77551e89d5e80d4b506c9a32fc151264b8e4
treed0b6bb978181f8f1e17eb7a00e0419ab57f9f8c0
parentf46ec5218fe7829ac18323b5ee0b409a63169f27
parent16cad037de1771e0bad551699b1dd8d6e1cae6cd

Auto merge of #158629 - JonathanBrouwer:rollup-42QCg7x, r=JonathanBrouwer

Rollup of 7 pull requests Successful merges: - rust-lang/rust#156379 (lint on `core::ffi::c_void` as a return type) - rust-lang/rust#157347 (Implement `Box::as_non_null()`.) - rust-lang/rust#157650 (rustc_target: Add OpenEmbedded/Yocto Linux base targets) - rust-lang/rust#158569 ([rustdoc] Fix handling of inlining of `no_inline` of foreign items) - rust-lang/rust#158573 (stabilize `feature(atomic_from_mut)`) - rust-lang/rust#158614 (Fix error message when rejecting implicit stage != 2 in CI) - rust-lang/rust#158616 (Remove dependency from `rustc_metadata` on `rustc_incremental`)

34 files changed, 598 insertions(+), 118 deletions(-)

Cargo.lock-1
......@@ -4392,7 +4392,6 @@ dependencies = [
43924392 "rustc_fs_util",
43934393 "rustc_hir",
43944394 "rustc_hir_pretty",
4395 "rustc_incremental",
43964395 "rustc_index",
43974396 "rustc_macros",
43984397 "rustc_middle",
compiler/rustc_codegen_ssa/src/back/write.rs+10-8
......@@ -15,9 +15,7 @@ use rustc_errors::{
1515};
1616use rustc_fs_util::link_or_copy;
1717use rustc_hir::find_attr;
18use rustc_incremental::{
19 copy_cgu_workproduct_to_incr_comp_cache_dir, in_incr_comp_dir, in_incr_comp_dir_sess,
20};
18use rustc_incremental::{copy_cgu_workproduct_to_incr_comp_cache_dir, in_incr_comp_dir_sess};
2119use rustc_macros::{Decodable, Encodable};
2220use rustc_metadata::fs::copy_to_stdout;
2321use rustc_middle::bug;
......@@ -884,20 +882,24 @@ fn execute_copy_from_cache_work_item(
884882 let mut links_from_incr_cache = Vec::new();
885883
886884 let mut load_from_incr_comp_dir = |output_path: PathBuf, saved_path: &str| {
887 let source_file = in_incr_comp_dir(incr_comp_session_dir, saved_path);
885 let source_file_in_incr_comp_dir = incr_comp_session_dir.join(saved_path);
888886 debug!(
889887 "copying preexisting module `{}` from {:?} to {}",
890888 module.name,
891 source_file,
889 source_file_in_incr_comp_dir,
892890 output_path.display()
893891 );
894 match link_or_copy(&source_file, &output_path) {
892 match link_or_copy(&source_file_in_incr_comp_dir, &output_path) {
895893 Ok(_) => {
896 links_from_incr_cache.push(source_file);
894 links_from_incr_cache.push(source_file_in_incr_comp_dir);
897895 Some(output_path)
898896 }
899897 Err(error) => {
900 dcx.emit_err(errors::CopyPathBuf { source_file, output_path, error });
898 dcx.emit_err(errors::CopyPathBuf {
899 source_file: source_file_in_incr_comp_dir,
900 output_path,
901 error,
902 });
901903 None
902904 }
903905 }
compiler/rustc_incremental/src/lib.rs+2-2
......@@ -10,8 +10,8 @@ mod diagnostics;
1010mod persist;
1111
1212pub use persist::{
13 copy_cgu_workproduct_to_incr_comp_cache_dir, finalize_session_directory, in_incr_comp_dir,
14 in_incr_comp_dir_sess, load_query_result_cache, save_work_product_index, setup_dep_graph,
13 copy_cgu_workproduct_to_incr_comp_cache_dir, finalize_session_directory, in_incr_comp_dir_sess,
14 load_query_result_cache, save_work_product_index, setup_dep_graph,
1515};
1616use rustc_middle::util::Providers;
1717
compiler/rustc_incremental/src/persist/fs.rs+1-9
......@@ -184,15 +184,7 @@ fn lock_file_path(session_dir: &Path) -> PathBuf {
184184/// Returns the path for a given filename within the incremental compilation directory
185185/// in the current session.
186186pub fn in_incr_comp_dir_sess(sess: &Session, file_name: &str) -> PathBuf {
187 in_incr_comp_dir(&sess.incr_comp_session_dir(), file_name)
188}
189
190/// Returns the path for a given filename within the incremental compilation directory,
191/// not necessarily from the current session.
192///
193/// To ensure the file is part of the current session, use [`in_incr_comp_dir_sess`].
194pub fn in_incr_comp_dir(incr_comp_session_dir: &Path, file_name: &str) -> PathBuf {
195 incr_comp_session_dir.join(file_name)
187 sess.incr_comp_session_dir().join(file_name)
196188}
197189
198190/// Allocates the private session directory.
compiler/rustc_incremental/src/persist/mod.rs+1-1
......@@ -10,7 +10,7 @@ mod load;
1010mod save;
1111mod work_product;
1212
13pub use fs::{finalize_session_directory, in_incr_comp_dir, in_incr_comp_dir_sess};
13pub use fs::{finalize_session_directory, in_incr_comp_dir_sess};
1414pub use load::{load_query_result_cache, setup_dep_graph};
1515pub(crate) use save::save_dep_graph;
1616pub use save::save_work_product_index;
compiler/rustc_lint/src/c_void_returns.rs created+89
......@@ -0,0 +1,89 @@
1use rustc_abi::ExternAbi;
2use rustc_hir::def::Res;
3use rustc_hir::def_id::LocalDefId;
4use rustc_hir::intravisit::FnKind;
5use rustc_hir::{self as hir, LangItem};
6use rustc_session::{declare_lint, declare_lint_pass};
7use rustc_span::Span;
8
9use crate::lints::{CVoidReturn, ExternCVoidReturn};
10use crate::{LateContext, LateLintPass, LintContext};
11
12declare_lint! {
13 /// The `c_void_returns` lint detects the use of [`core::ffi::c_void`] as a return type.
14 ///
15 /// ### Example
16 ///
17 /// ```rust
18 /// use std::ffi::c_void;
19 ///
20 /// unsafe extern "C" {
21 /// fn foo() -> c_void;
22 /// }
23 /// ```
24 ///
25 /// {{produces}}
26 ///
27 /// ### Explanation
28 ///
29 /// `c_void` is designed for use through a [`pointer`], equivalent to C's `void*` type. It is a
30 /// mistake to use it directly as a return type, and calling `extern` functions declared as such
31 /// may result in undefined behavior. C functions that return `void` must be declared to return
32 /// [`()`] in Rust (omitting the return type implicitly returns `()`).
33 ///
34 /// [`core::ffi::c_void`]: https://doc.rust-lang.org/core/ffi/enum.c_void.html
35 /// [`pointer`]: https://doc.rust-lang.org/core/primitive.pointer.html
36 /// [`()`]: https://doc.rust-lang.org/core/primitive.unit.html
37 pub C_VOID_RETURNS,
38 Warn,
39 "detects use of `c_void` as a return type"
40}
41
42declare_lint_pass!(CVoidReturns => [C_VOID_RETURNS]);
43
44impl<'tcx> LateLintPass<'tcx> for CVoidReturns {
45 fn check_fn(
46 &mut self,
47 cx: &LateContext<'tcx>,
48 fn_kind: FnKind<'tcx>,
49 decl: &'tcx hir::FnDecl<'tcx>,
50 _: &'tcx hir::Body<'tcx>,
51 _: Span,
52 _: LocalDefId,
53 ) {
54 check_decl(
55 cx,
56 decl,
57 !matches!(fn_kind, FnKind::ItemFn(.., hir::FnHeader { abi: ExternAbi::Rust, .. })),
58 );
59 }
60
61 fn check_foreign_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::ForeignItem<'tcx>) {
62 if let hir::ForeignItemKind::Fn(sig, ..) = item.kind {
63 check_decl(cx, sig.decl, true);
64 }
65 }
66
67 fn check_ty(&mut self, cx: &LateContext<'tcx>, ty: &'tcx hir::Ty<'tcx, hir::AmbigArg>) {
68 if let hir::TyKind::FnPtr(fn_ptr_ty) = ty.kind {
69 check_decl(cx, fn_ptr_ty.decl, fn_ptr_ty.abi != ExternAbi::Rust);
70 }
71 }
72}
73
74fn check_decl(cx: &LateContext<'_>, decl: &hir::FnDecl<'_>, is_extern: bool) {
75 if let hir::FnRetTy::Return(output_ty) = decl.output
76 && let hir::TyKind::Path(qpath) = output_ty.kind
77 && let Res::Def(.., def_id) = cx.qpath_res(&qpath, output_ty.hir_id)
78 && cx.tcx.is_lang_item(def_id, LangItem::CVoid)
79 {
80 let suggestion =
81 cx.sess().source_map().span_extend_to_prev_char(decl.output.span(), ')', true);
82
83 if is_extern {
84 cx.emit_span_lint(C_VOID_RETURNS, decl.output.span(), ExternCVoidReturn { suggestion });
85 } else {
86 cx.emit_span_lint(C_VOID_RETURNS, decl.output.span(), CVoidReturn { suggestion });
87 }
88 }
89}
compiler/rustc_lint/src/lib.rs+3
......@@ -32,6 +32,7 @@ mod async_closures;
3232mod async_fn_in_trait;
3333mod autorefs;
3434pub mod builtin;
35mod c_void_returns;
3536mod context;
3637mod dangling;
3738mod default_could_be_derived;
......@@ -86,6 +87,7 @@ use async_closures::AsyncClosureUsage;
8687use async_fn_in_trait::AsyncFnInTrait;
8788use autorefs::*;
8889use builtin::*;
90use c_void_returns::*;
8991use dangling::*;
9092use default_could_be_derived::DefaultCouldBeDerived;
9193use deref_into_dyn_supertrait::*;
......@@ -269,6 +271,7 @@ late_lint_methods!(
269271 LifetimeSyntax: LifetimeSyntax,
270272 InternalEqTraitMethodImpls: InternalEqTraitMethodImpls,
271273 ImplicitProvenanceCasts: ImplicitProvenanceCasts,
274 CVoidReturns: CVoidReturns,
272275 ]
273276 ]
274277);
compiler/rustc_lint/src/lints.rs+27
......@@ -614,6 +614,33 @@ pub(crate) enum BuiltinSpecialModuleNameUsed {
614614 Main,
615615}
616616
617// c_void_return.rs
618#[derive(Diagnostic)]
619#[diag("`c_void` should not be used as a return type")]
620#[help("returning `()` in Rust is equivalent to returning `void` in C")]
621pub(crate) struct CVoidReturn {
622 #[suggestion(
623 "remove the return type to implicitly return `()`",
624 code = "",
625 applicability = "maybe-incorrect"
626 )]
627 pub suggestion: Span,
628}
629
630// c_void_return.rs
631#[derive(Diagnostic)]
632#[diag("declarations returning `c_void` are not compatible with C functions returning `void`")]
633#[help("returning `()` in Rust is equivalent to returning `void` in C")]
634#[note("`c_void` is only used through raw pointers for compatibility with `void` pointers")]
635pub(crate) struct ExternCVoidReturn {
636 #[suggestion(
637 "remove the return type to implicitly return `()`",
638 code = "",
639 applicability = "maybe-incorrect"
640 )]
641 pub suggestion: Span,
642}
643
617644// deref_into_dyn_supertrait.rs
618645#[derive(Diagnostic)]
619646#[diag("this `Deref` implementation is covered by an implicit supertrait coercion")]
compiler/rustc_metadata/Cargo.toml-1
......@@ -18,7 +18,6 @@ rustc_feature = { path = "../rustc_feature" }
1818rustc_fs_util = { path = "../rustc_fs_util" }
1919rustc_hir = { path = "../rustc_hir" }
2020rustc_hir_pretty = { path = "../rustc_hir_pretty" }
21rustc_incremental = { path = "../rustc_incremental" }
2221rustc_index = { path = "../rustc_index" }
2322rustc_macros = { path = "../rustc_macros" }
2423rustc_middle = { path = "../rustc_middle" }
compiler/rustc_metadata/src/rmeta/encoder.rs+4-4
......@@ -2472,10 +2472,10 @@ pub fn encode_metadata(tcx: TyCtxt<'_>, path: &Path, ref_path: Option<&Path>) {
24722472 && tcx.dep_graph.try_mark_green(tcx, &dep_node).is_some()
24732473 {
24742474 let saved_path = &work_product.saved_files["rmeta"];
2475 let incr_comp_session_dir = tcx.sess.incr_comp_session_dir_opt().unwrap();
2476 let source_file = rustc_incremental::in_incr_comp_dir(&incr_comp_session_dir, saved_path);
2477 debug!("copying preexisting metadata from {source_file:?} to {path:?}");
2478 match rustc_fs_util::link_or_copy(&source_file, path) {
2475 let incr_comp_session_dir = tcx.sess.incr_comp_session_dir();
2476 let source_file_in_incr_dir = &incr_comp_session_dir.join(saved_path);
2477 debug!("copying preexisting metadata from {source_file_in_incr_dir:?} to {path:?}");
2478 match rustc_fs_util::link_or_copy(&source_file_in_incr_dir, path) {
24792479 Ok(_) => {}
24802480 Err(err) => tcx.dcx().emit_fatal(FailCreateFileEncoder { err }),
24812481 };
compiler/rustc_target/src/spec/mod.rs+6
......@@ -1825,6 +1825,12 @@ supported_targets! {
18251825 ("x86_64-unknown-linux-gnuasan", x86_64_unknown_linux_gnuasan),
18261826 ("x86_64-unknown-linux-gnumsan", x86_64_unknown_linux_gnumsan),
18271827 ("x86_64-unknown-linux-gnutsan", x86_64_unknown_linux_gnutsan),
1828
1829 ("aarch64-oe-linux-gnu", aarch64_oe_linux_gnu),
1830 ("armv7-oe-linux-gnueabihf", armv7_oe_linux_gnueabihf),
1831 ("i686-oe-linux-gnu", i686_oe_linux_gnu),
1832 ("riscv64-oe-linux-gnu", riscv64_oe_linux_gnu),
1833 ("x86_64-oe-linux-gnu", x86_64_oe_linux_gnu),
18281834}
18291835
18301836/// Cow-Vec-Str: Cow<'static, [Cow<'static, str>]>
compiler/rustc_target/src/spec/targets/aarch64_oe_linux_gnu.rs created+17
......@@ -0,0 +1,17 @@
1use crate::spec::{Target, TargetMetadata};
2
3pub(crate) fn target() -> Target {
4 let mut base = super::aarch64_unknown_linux_gnu::target();
5
6 base.metadata = TargetMetadata {
7 description: Some("64-bit Linux (kernel 3.2+, glibc 2.17+) for yocto".into()),
8 tier: Some(3),
9 host_tools: Some(false),
10 std: Some(true),
11 };
12
13 base.llvm_target = "aarch64-oe-linux-gnu".into();
14 base.options.linker = Some("aarch64-oe-linux-gcc".into());
15
16 base
17}
compiler/rustc_target/src/spec/targets/armv7_oe_linux_gnueabihf.rs created+17
......@@ -0,0 +1,17 @@
1use crate::spec::{Target, TargetMetadata};
2
3pub(crate) fn target() -> Target {
4 let mut base = super::armv7_unknown_linux_gnueabihf::target();
5
6 base.metadata = TargetMetadata {
7 description: Some("Armv7-A Linux, hardfloat (kernel 3.2, glibc 2.17) for yocto".into()),
8 tier: Some(3),
9 host_tools: Some(false),
10 std: Some(true),
11 };
12
13 base.llvm_target = "armv7-oe-linux-gnueabihf".into();
14 base.options.linker = Some("arm-oe-linux-gnueabi-gcc".into());
15
16 base
17}
compiler/rustc_target/src/spec/targets/i686_oe_linux_gnu.rs created+21
......@@ -0,0 +1,21 @@
1use crate::spec::{Target, TargetMetadata};
2
3pub(crate) fn target() -> Target {
4 let mut base = super::i686_unknown_linux_gnu::target();
5
6 base.metadata = TargetMetadata {
7 description: Some("32-bit Linux (kernel 3.2, glibc 2.17+) for yocto".into()),
8 tier: Some(3),
9 host_tools: Some(false),
10 std: Some(true),
11 };
12
13 base.llvm_target = "i686-oe-linux-gnu".into();
14
15 base.options.linker = Some("i686-oe-linux-gcc".into());
16
17 base.options.cpu = "core2".into();
18 base.options.features = "+sse3".into();
19
20 base
21}
compiler/rustc_target/src/spec/targets/riscv64_oe_linux_gnu.rs created+17
......@@ -0,0 +1,17 @@
1use crate::spec::{Target, TargetMetadata};
2
3pub(crate) fn target() -> Target {
4 let mut base = super::riscv64gc_unknown_linux_gnu::target();
5
6 base.metadata = TargetMetadata {
7 description: Some("RISC-V Linux (kernel 4.20, glibc 2.29) for yocto".into()),
8 tier: Some(3),
9 host_tools: Some(false),
10 std: Some(true),
11 };
12
13 base.llvm_target = "riscv64-oe-linux-gnu".into();
14 base.options.linker = Some("riscv64-oe-linux-gcc".into());
15
16 base
17}
compiler/rustc_target/src/spec/targets/x86_64_oe_linux_gnu.rs created+17
......@@ -0,0 +1,17 @@
1use crate::spec::{Target, TargetMetadata};
2
3pub(crate) fn target() -> Target {
4 let mut base = super::x86_64_unknown_linux_gnu::target();
5
6 base.metadata = TargetMetadata {
7 description: Some("64-bit Linux (kernel 3.2+, glibc 2.17+) for yocto".into()),
8 tier: Some(3),
9 host_tools: Some(false),
10 std: Some(true),
11 };
12
13 base.llvm_target = "x86_64-oe-linux-gnu".into();
14 base.options.linker = Some("x86_64-oe-linux-gcc".into());
15
16 base
17}
library/alloc/src/boxed.rs+48-2
......@@ -1753,7 +1753,7 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
17531753 ///
17541754 /// This method guarantees that for the purpose of the aliasing model, this method
17551755 /// does not materialize a reference to the underlying memory, and thus the returned pointer
1756 /// will remain valid when mixed with other calls to [`as_ptr`] and [`as_mut_ptr`].
1756 /// will remain valid when mixed with other calls to [`as_ptr`], [`as_mut_ptr`], and [`as_non_null`].
17571757 /// Note that calling other methods that materialize references to the memory
17581758 /// may still invalidate this pointer.
17591759 /// See the example below for how this guarantee can be used.
......@@ -1776,6 +1776,8 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
17761776 ///
17771777 /// [`as_mut_ptr`]: Self::as_mut_ptr
17781778 /// [`as_ptr`]: Self::as_ptr
1779 /// [`as_non_null`]: Self::as_non_null
1780 #[must_use]
17791781 #[stable(feature = "box_as_ptr", since = "CURRENT_RUSTC_VERSION")]
17801782 #[rustc_never_returns_null_ptr]
17811783 #[rustc_as_ptr]
......@@ -1797,7 +1799,7 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
17971799 ///
17981800 /// This method guarantees that for the purpose of the aliasing model, this method
17991801 /// does not materialize a reference to the underlying memory, and thus the returned pointer
1800 /// will remain valid when mixed with other calls to [`as_ptr`] and [`as_mut_ptr`].
1802 /// will remain valid when mixed with other calls to [`as_ptr`], [`as_mut_ptr`], and [`as_non_null`].
18011803 /// Note that calling other methods that materialize mutable references to the memory,
18021804 /// as well as writing to this memory, may still invalidate this pointer.
18031805 /// See the example below for how this guarantee can be used.
......@@ -1823,6 +1825,8 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
18231825 ///
18241826 /// [`as_mut_ptr`]: Self::as_mut_ptr
18251827 /// [`as_ptr`]: Self::as_ptr
1828 /// [`as_non_null`]: Self::as_non_null
1829 #[must_use]
18261830 #[stable(feature = "box_as_ptr", since = "CURRENT_RUSTC_VERSION")]
18271831 #[rustc_never_returns_null_ptr]
18281832 #[rustc_as_ptr]
......@@ -1833,6 +1837,48 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
18331837 &raw const **b
18341838 }
18351839
1840 /// Returns a `NonNull` pointer to the `Box`'s contents.
1841 ///
1842 /// The caller must ensure that the `Box` outlives the pointer this
1843 /// function returns, or else it will end up dangling.
1844 ///
1845 /// This method guarantees that for the purpose of the aliasing model, this method
1846 /// does not materialize a reference to the underlying memory, and thus the returned pointer
1847 /// will remain valid when mixed with other calls to [`as_ptr`], [`as_mut_ptr`], and [`as_non_null`].
1848 /// Note that calling other methods that materialize references to the memory
1849 /// may still invalidate this pointer.
1850 /// See the example below for how this guarantee can be used.
1851 ///
1852 /// # Examples
1853 ///
1854 /// Due to the aliasing guarantee, the following code is legal:
1855 ///
1856 /// ```rust
1857 /// #![feature(box_as_non_null)]
1858 ///
1859 /// unsafe {
1860 /// let mut b = Box::new(0);
1861 /// let ptr1 = Box::as_non_null(&mut b);
1862 /// ptr1.write(1);
1863 /// let ptr2 = Box::as_non_null(&mut b);
1864 /// ptr2.write(2);
1865 /// // Notably, the write to `ptr2` did *not* invalidate `ptr1`:
1866 /// ptr1.write(3);
1867 /// }
1868 /// ```
1869 ///
1870 /// [`as_mut_ptr`]: Self::as_mut_ptr
1871 /// [`as_ptr`]: Self::as_ptr
1872 /// [`as_non_null`]: Self::as_non_null
1873 #[must_use]
1874 #[unstable(feature = "box_as_non_null", issue = "157345")]
1875 #[rustc_as_ptr]
1876 #[inline]
1877 pub fn as_non_null(b: &mut Self) -> NonNull<T> {
1878 // SAFETY: `Box` is guaranteed to be non-null.
1879 unsafe { NonNull::new_unchecked(Self::as_mut_ptr(b)) }
1880 }
1881
18361882 /// Returns a reference to the underlying allocator.
18371883 ///
18381884 /// Note: this is an associated function, which means that you have
library/core/src/sync/atomic.rs+9-18
......@@ -608,7 +608,6 @@ impl AtomicBool {
608608 /// # Examples
609609 ///
610610 /// ```
611 /// #![feature(atomic_from_mut)]
612611 /// use std::sync::atomic::{AtomicBool, Ordering};
613612 ///
614613 /// let mut some_bool = true;
......@@ -618,7 +617,7 @@ impl AtomicBool {
618617 /// ```
619618 #[inline]
620619 #[cfg(target_has_atomic_primitive_alignment = "8")]
621 #[unstable(feature = "atomic_from_mut", issue = "76314")]
620 #[stable(feature = "atomic_from_mut", since = "CURRENT_RUSTC_VERSION")]
622621 pub fn from_mut(v: &mut bool) -> &mut Self {
623622 // SAFETY: the mutable reference guarantees unique ownership, and
624623 // alignment of both `bool` and `Self` is 1.
......@@ -633,7 +632,6 @@ impl AtomicBool {
633632 /// # Examples
634633 ///
635634 /// ```ignore-wasm
636 /// #![feature(atomic_from_mut)]
637635 /// use std::sync::atomic::{AtomicBool, Ordering};
638636 ///
639637 /// let mut some_bools = [const { AtomicBool::new(false) }; 10];
......@@ -653,7 +651,7 @@ impl AtomicBool {
653651 /// });
654652 /// ```
655653 #[inline]
656 #[unstable(feature = "atomic_from_mut", issue = "76314")]
654 #[stable(feature = "atomic_from_mut", since = "CURRENT_RUSTC_VERSION")]
657655 pub fn get_mut_slice(this: &mut [Self]) -> &mut [bool] {
658656 // SAFETY: the mutable reference guarantees unique ownership.
659657 unsafe { &mut *(this as *mut [Self] as *mut [bool]) }
......@@ -664,7 +662,6 @@ impl AtomicBool {
664662 /// # Examples
665663 ///
666664 /// ```rust,ignore-wasm
667 /// #![feature(atomic_from_mut)]
668665 /// use std::sync::atomic::{AtomicBool, Ordering};
669666 ///
670667 /// let mut some_bools = [false; 10];
......@@ -678,7 +675,7 @@ impl AtomicBool {
678675 /// ```
679676 #[inline]
680677 #[cfg(target_has_atomic_primitive_alignment = "8")]
681 #[unstable(feature = "atomic_from_mut", issue = "76314")]
678 #[stable(feature = "atomic_from_mut", since = "CURRENT_RUSTC_VERSION")]
682679 pub fn from_mut_slice(v: &mut [bool]) -> &mut [Self] {
683680 // SAFETY: the mutable reference guarantees unique ownership, and
684681 // alignment of both `bool` and `Self` is 1.
......@@ -1577,7 +1574,6 @@ impl<T> AtomicPtr<T> {
15771574 /// # Examples
15781575 ///
15791576 /// ```
1580 /// #![feature(atomic_from_mut)]
15811577 /// use std::sync::atomic::{AtomicPtr, Ordering};
15821578 ///
15831579 /// let mut data = 123;
......@@ -1589,7 +1585,7 @@ impl<T> AtomicPtr<T> {
15891585 /// ```
15901586 #[inline]
15911587 #[cfg(target_has_atomic_primitive_alignment = "ptr")]
1592 #[unstable(feature = "atomic_from_mut", issue = "76314")]
1588 #[stable(feature = "atomic_from_mut", since = "CURRENT_RUSTC_VERSION")]
15931589 pub fn from_mut(v: &mut *mut T) -> &mut Self {
15941590 let [] = [(); align_of::<AtomicPtr<()>>() - align_of::<*mut ()>()];
15951591 // SAFETY:
......@@ -1607,7 +1603,6 @@ impl<T> AtomicPtr<T> {
16071603 /// # Examples
16081604 ///
16091605 /// ```ignore-wasm
1610 /// #![feature(atomic_from_mut)]
16111606 /// use std::ptr::null_mut;
16121607 /// use std::sync::atomic::{AtomicPtr, Ordering};
16131608 ///
......@@ -1633,7 +1628,7 @@ impl<T> AtomicPtr<T> {
16331628 /// });
16341629 /// ```
16351630 #[inline]
1636 #[unstable(feature = "atomic_from_mut", issue = "76314")]
1631 #[stable(feature = "atomic_from_mut", since = "CURRENT_RUSTC_VERSION")]
16371632 pub fn get_mut_slice(this: &mut [Self]) -> &mut [*mut T] {
16381633 // SAFETY: the mutable reference guarantees unique ownership.
16391634 unsafe { &mut *(this as *mut [Self] as *mut [*mut T]) }
......@@ -1646,7 +1641,6 @@ impl<T> AtomicPtr<T> {
16461641 /// # Examples
16471642 ///
16481643 /// ```ignore-wasm
1649 /// #![feature(atomic_from_mut)]
16501644 /// use std::ptr::null_mut;
16511645 /// use std::sync::atomic::{AtomicPtr, Ordering};
16521646 ///
......@@ -1668,7 +1662,7 @@ impl<T> AtomicPtr<T> {
16681662 /// ```
16691663 #[inline]
16701664 #[cfg(target_has_atomic_primitive_alignment = "ptr")]
1671 #[unstable(feature = "atomic_from_mut", issue = "76314")]
1665 #[stable(feature = "atomic_from_mut", since = "CURRENT_RUSTC_VERSION")]
16721666 pub fn from_mut_slice(v: &mut [*mut T]) -> &mut [Self] {
16731667 // SAFETY:
16741668 // - the mutable reference guarantees unique ownership.
......@@ -2721,7 +2715,6 @@ macro_rules! atomic_int {
27212715 /// # Examples
27222716 ///
27232717 /// ```
2724 /// #![feature(atomic_from_mut)]
27252718 #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")]
27262719 ///
27272720 /// let mut some_int = 123;
......@@ -2732,7 +2725,7 @@ macro_rules! atomic_int {
27322725 ///
27332726 #[inline]
27342727 #[$cfg_align]
2735 #[unstable(feature = "atomic_from_mut", issue = "76314")]
2728 #[stable(feature = "atomic_from_mut", since = "CURRENT_RUSTC_VERSION")]
27362729 pub fn from_mut(v: &mut $int_type) -> &mut Self {
27372730 let [] = [(); align_of::<Self>() - align_of::<$int_type>()];
27382731 // SAFETY:
......@@ -2750,7 +2743,6 @@ macro_rules! atomic_int {
27502743 /// # Examples
27512744 ///
27522745 /// ```ignore-wasm
2753 /// #![feature(atomic_from_mut)]
27542746 #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")]
27552747 ///
27562748 #[doc = concat!("let mut some_ints = [const { ", stringify!($atomic_type), "::new(0) }; 10];")]
......@@ -2772,7 +2764,7 @@ macro_rules! atomic_int {
27722764 /// });
27732765 /// ```
27742766 #[inline]
2775 #[unstable(feature = "atomic_from_mut", issue = "76314")]
2767 #[stable(feature = "atomic_from_mut", since = "CURRENT_RUSTC_VERSION")]
27762768 pub fn get_mut_slice(this: &mut [Self]) -> &mut [$int_type] {
27772769 // SAFETY: the mutable reference guarantees unique ownership.
27782770 unsafe { &mut *(this as *mut [Self] as *mut [$int_type]) }
......@@ -2791,7 +2783,6 @@ macro_rules! atomic_int {
27912783 /// # Examples
27922784 ///
27932785 /// ```ignore-wasm
2794 /// #![feature(atomic_from_mut)]
27952786 #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")]
27962787 ///
27972788 /// let mut some_ints = [0; 10];
......@@ -2807,7 +2798,7 @@ macro_rules! atomic_int {
28072798 /// ```
28082799 #[inline]
28092800 #[$cfg_align]
2810 #[unstable(feature = "atomic_from_mut", issue = "76314")]
2801 #[stable(feature = "atomic_from_mut", since = "CURRENT_RUSTC_VERSION")]
28112802 pub fn from_mut_slice(v: &mut [$int_type]) -> &mut [Self] {
28122803 let [] = [(); align_of::<Self>() - align_of::<$int_type>()];
28132804 // SAFETY:
src/bootstrap/src/core/config/config.rs+3-1
......@@ -1206,7 +1206,9 @@ impl Config {
12061206 | Subcommand::Install => {
12071207 assert_eq!(
12081208 stage, 2,
1209 "x.py should be run with `--stage 2` on CI, but was run with `--stage {stage}`",
1209 "\
1210x.py was run under CI with an implicit `--stage {stage}`. This is probably wrong and you want stage 2.
1211NOTE: Please add `--stage 2` to your command line, or if you're sure you want to run stage {stage} then add `--stage {stage}` explicitly"
12101212 );
12111213 }
12121214 Subcommand::Clean { .. }
src/doc/rustc/src/SUMMARY.md+1
......@@ -104,6 +104,7 @@
104104 - [mips\*-mti-none-elf](platform-support/mips-mti-none-elf.md)
105105 - [mipsisa\*r6\*-unknown-linux-gnu\*](platform-support/mips-release-6.md)
106106 - [nvptx64-nvidia-cuda](platform-support/nvptx64-nvidia-cuda.md)
107 - [\*-oe-linux-gnu](platform-support/oe-linux-gnu.md)
107108 - [powerpc-unknown-openbsd](platform-support/powerpc-unknown-openbsd.md)
108109 - [powerpc-unknown-linux-gnuspe](platform-support/powerpc-unknown-linux-gnuspe.md)
109110 - [powerpc-unknown-linux-muslspe](platform-support/powerpc-unknown-linux-muslspe.md)
src/doc/rustc/src/platform-support.md+5
......@@ -267,6 +267,7 @@ target | std | host | notes
267267-------|:---:|:----:|-------
268268[`aarch64-kmc-solid_asp3`](platform-support/kmc-solid.md) | ✓ | | ARM64 SOLID with TOPPERS/ASP3
269269[`aarch64-nintendo-switch-freestanding`](platform-support/aarch64-nintendo-switch-freestanding.md) | * | | ARM64 Nintendo Switch, Horizon
270[`aarch64-oe-linux-gnu`](platform-support/oe-linux-gnu.md) | ✓ | | ARM64 OpenEmbedded/Yocto Linux (GNU)
270271[`aarch64-unknown-helenos`](platform-support/helenos.md) | ✓ | | ARM64 HelenOS
271272[`aarch64-unknown-hermit`](platform-support/hermit.md) | ✓ | | ARM64 Hermit
272273[`aarch64-unknown-illumos`](platform-support/illumos.md) | ✓ | ✓ | ARM64 illumos
......@@ -310,6 +311,7 @@ target | std | host | notes
310311[`armv6-unknown-freebsd`](platform-support/freebsd.md) | ✓ | ✓ | Armv6 FreeBSD
311312[`armv6-unknown-netbsd-eabihf`](platform-support/netbsd.md) | ✓ | ✓ | Armv6 NetBSD w/hard-float
312313[`armv6k-nintendo-3ds`](platform-support/armv6k-nintendo-3ds.md) | ? | | Armv6k Nintendo 3DS, Horizon (Requires devkitARM toolchain)
314[`armv7-oe-linux-gnueabihf`](platform-support/oe-linux-gnu.md) | ✓ | | ARMv7 OpenEmbedded/Yocto Linux (GNU)
313315[`armv7-rtems-eabihf`](platform-support/armv7-rtems-eabihf.md) | ? | | RTEMS OS for ARM BSPs
314316[`armv7-sony-vita-newlibeabihf`](platform-support/armv7-sony-vita-newlibeabihf.md) | ✓ | | Armv7-A Cortex-A9 Sony PlayStation Vita (requires VITASDK toolchain)
315317[`armv7-unknown-freebsd`](platform-support/freebsd.md) | ✓ | ✓ | Armv7-A FreeBSD
......@@ -337,6 +339,7 @@ target | std | host | notes
337339[`i586-unknown-netbsd`](platform-support/netbsd.md) | ✓ | | 32-bit x86 (original Pentium) [^x86_32-floats-x87]
338340[`i586-unknown-redox`](platform-support/redox.md) | ✓ | | 32-bit x86 Redox OS (PentiumPro) [^x86_32-floats-x87]
339341[`i686-apple-darwin`](platform-support/apple-darwin.md) | ✓ | ✓ | 32-bit macOS (10.12+, Sierra+, Penryn) [^x86_32-floats-return-ABI]
342[`i686-oe-linux-gnu`](platform-support/oe-linux-gnu.md) | ✓ | | 32-bit x86 OpenEmbedded/Yocto Linux (GNU)
340343[`i686-pc-nto-qnx700`](platform-support/nto-qnx.md) | * | | 32-bit x86 QNX Neutrino 7.0 RTOS (Pentium 4) [^x86_32-floats-return-ABI]
341344`i686-unknown-haiku` | ✓ | ✓ | 32-bit Haiku (Pentium 4) [^x86_32-floats-return-ABI]
342345[`i686-unknown-helenos`](platform-support/helenos.md) | ✓ | | HelenOS IA-32 (see docs for pending issues)
......@@ -406,6 +409,7 @@ target | std | host | notes
406409[`riscv32imc-esp-espidf`](platform-support/esp-idf.md) | ✓ | | RISC-V ESP-IDF
407410[`riscv32imc-unknown-nuttx-elf`](platform-support/nuttx.md) | ✓ | | RISC-V 32bit with NuttX
408411[`riscv64-linux-android`](platform-support/android.md) | ? | | RISC-V 64-bit Android
412[`riscv64-oe-linux-gnu`](platform-support/oe-linux-gnu.md) | ✓ | | RISC-V OpenEmbedded/Yocto Linux (GNU)
409413[`riscv64-wrs-vxworks`](platform-support/vxworks.md) | ✓ | |
410414`riscv64gc-unknown-freebsd` | ? | | RISC-V FreeBSD
411415`riscv64gc-unknown-fuchsia` | ? | | RISC-V Fuchsia
......@@ -443,6 +447,7 @@ target | std | host | notes
443447[`x86_64-apple-tvos`](platform-support/apple-tvos.md) | ✓ | | x86 64-bit tvOS
444448[`x86_64-apple-watchos-sim`](platform-support/apple-watchos.md) | ✓ | | x86 64-bit Apple WatchOS simulator
445449[`x86_64-lynx-lynxos178`](platform-support/lynxos178.md) | | | x86_64 LynxOS-178
450[`x86_64-oe-linux-gnu`](platform-support/oe-linux-gnu.md) | ✓ | | x86 64-bit OpenEmbedded/Yocto Linux (GNU)
446451[`x86_64-pc-cygwin`](platform-support/x86_64-pc-cygwin.md) | ✓ | | 64-bit x86 Cygwin |
447452[`x86_64-pc-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX Neutrino 7.1 RTOS with default network stack (io-pkt) |
448453[`x86_64-pc-nto-qnx710_iosock`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX Neutrino 7.1 RTOS with new network stack (io-sock) |
src/doc/rustc/src/platform-support/oe-linux-gnu.md created+41
......@@ -0,0 +1,41 @@
1# `*-oe-linux-gnu`
2
3**Tier: 3**
4
5Targets for OpenEmbedded/Yocto-based Linux systems.
6
7Target triplets available:
8
9* `x86_64-oe-linux-gnu`
10* `aarch64-oe-linux-gnu`
11* `i686-oe-linux-gnu`
12* `armv7-oe-linux-gnueabihf`
13* `riscv64-oe-linux-gnu`
14
15## Target maintainers
16
17[@DeepeshWR](https://github.com/DeepeshWR)
18
19## Requirements
20
21### Operating System
22
23These targets are intended for Linux systems built using the OpenEmbedded and Yocto Project build systems.
24
25### C Toolchain
26
27The targets use the architecture-specific OpenEmbedded GCC driver as the default linker and therefore require the corresponding OpenEmbedded cross-compilation toolchain to be available in the build environment.
28
29## Building
30
31These targets are intended for use with the OpenEmbedded/Yocto build system. They provide base target definitions from which downstream Yocto-generated targets may inherit.
32
33## Building Rust programs
34
35Rust does not currently ship precompiled artifacts for these targets.
36
37Downstream Yocto-generated targets may inherit from these base OpenEmbedded targets and customize metadata or vendor-specific configuration as needed.
38
39## Cross-compilation toolchains and C code
40
41The targets support linking with C code through the corresponding OpenEmbedded cross-compilation toolchains.
src/librustdoc/clean/inline.rs+128-54
......@@ -142,7 +142,7 @@ pub(crate) fn try_inline(
142142 Res::Def(DefKind::Ctor(..), _) | Res::SelfCtor(..) => return Some(Vec::new()),
143143 Res::Def(DefKind::Mod, did) => {
144144 record_extern_fqn(cx, did, ItemType::Module);
145 clean::ModuleItem(build_module(cx, did, visited))
145 clean::ModuleItem(build_module(cx, did, name, visited))
146146 }
147147 Res::Def(DefKind::Static { .. }, did) => {
148148 record_extern_fqn(cx, did, ItemType::Static);
......@@ -207,6 +207,7 @@ pub(crate) fn try_inline_glob(
207207 let mut items = build_module_items(
208208 cx,
209209 did,
210 cx.tcx.item_name(did),
210211 visited,
211212 inlined_names,
212213 Some(&reexports),
......@@ -665,16 +666,43 @@ pub(crate) fn build_impl(
665666 ));
666667}
667668
668fn build_module(cx: &mut DocContext<'_>, did: DefId, visited: &mut DefIdSet) -> clean::Module {
669 let items = build_module_items(cx, did, visited, &mut FxHashSet::default(), None, None);
669fn build_module(
670 cx: &mut DocContext<'_>,
671 did: DefId,
672 name: Symbol,
673 visited: &mut DefIdSet,
674) -> clean::Module {
675 let items = build_module_items(cx, did, name, visited, &mut FxHashSet::default(), None, None);
670676
671677 let span = clean::Span::new(cx.tcx.def_span(did));
672678 clean::Module { items, span }
673679}
674680
681// We are only interested into `Res::Def`. And in there, we only want "items" which get their own
682// rustdoc page. So not `DefKind::Ctor` for example (which is returned by `tcx.module_children()`).
683fn should_ignore_res(res: Res) -> bool {
684 !matches!(
685 res,
686 Res::Def(DefKind::Trait, _)
687 | Res::Def(DefKind::TraitAlias, _)
688 | Res::Def(DefKind::Fn, _)
689 | Res::Def(DefKind::Struct, _)
690 | Res::Def(DefKind::Union, _)
691 | Res::Def(DefKind::TyAlias, _)
692 | Res::Def(DefKind::Enum, _)
693 | Res::Def(DefKind::ForeignTy, _)
694 | Res::Def(DefKind::Variant, _)
695 | Res::Def(DefKind::Mod, _)
696 | Res::Def(DefKind::Static { .. }, _)
697 | Res::Def(DefKind::Const { .. }, _)
698 | Res::Def(DefKind::Macro(_), _)
699 )
700}
701
675702fn build_module_items(
676703 cx: &mut DocContext<'_>,
677 did: DefId,
704 module_def_id: DefId,
705 module_name: Symbol,
678706 visited: &mut DefIdSet,
679707 inlined_names: &mut FxHashSet<(ItemType, Symbol)>,
680708 allowed_def_ids: Option<&DefIdSet>,
......@@ -685,61 +713,107 @@ fn build_module_items(
685713 // If we're re-exporting a re-export it may actually re-export something in
686714 // two namespaces, so the target may be listed twice. Make sure we only
687715 // visit each node at most once.
688 for item in cx.tcx.module_children(did).iter() {
689 if item.vis.is_public() {
690 let res = item.res.expect_non_local();
691 if let Some(def_id) = res.opt_def_id()
692 && let Some(allowed_def_ids) = allowed_def_ids
693 && !allowed_def_ids.contains(&def_id)
716 for item in cx.tcx.module_children(module_def_id).iter() {
717 if !item.vis.is_public() {
718 continue;
719 }
720 let res = item.res.expect_non_local();
721 if let Some(def_id) = res.opt_def_id()
722 && let Some(allowed_def_ids) = allowed_def_ids
723 && !allowed_def_ids.contains(&def_id)
724 {
725 continue;
726 }
727 if let Some(def_id) = res.mod_def_id() {
728 // If we're inlining a glob import, it's possible to have
729 // two distinct modules with the same name. We don't want to
730 // inline it, or mark any of its contents as visited.
731 if module_def_id == def_id
732 || inlined_names.contains(&(ItemType::Module, item.ident.name))
733 || !visited.insert(def_id)
694734 {
695735 continue;
696736 }
697 if let Some(def_id) = res.mod_def_id() {
698 // If we're inlining a glob import, it's possible to have
699 // two distinct modules with the same name. We don't want to
700 // inline it, or mark any of its contents as visited.
701 if did == def_id
702 || inlined_names.contains(&(ItemType::Module, item.ident.name))
703 || !visited.insert(def_id)
704 {
705 continue;
706 }
707 }
708 if let Res::PrimTy(p) = res {
709 // Primitive types can't be inlined so generate an import instead.
710 let prim_ty = clean::PrimitiveType::from(p);
711 items.push(clean::Item {
712 inner: Box::new(clean::ItemInner {
713 name: None,
714 // We can use the item's `DefId` directly since the only information ever
715 // used from it is `DefId.krate`.
716 item_id: ItemId::DefId(did),
717 attrs: Default::default(),
718 stability: None,
719 kind: clean::ImportItem(clean::Import::new_simple(
720 item.ident.name,
721 clean::ImportSource {
722 path: clean::Path {
723 res,
724 segments: thin_vec![clean::PathSegment {
725 name: prim_ty.as_sym(),
726 args: clean::GenericArgs::AngleBracketed {
727 args: Default::default(),
728 constraints: ThinVec::new(),
729 },
730 }],
731 },
732 did: None,
737 }
738 if let Res::PrimTy(p) = res {
739 // Primitive types can't be inlined so generate an import instead.
740 let prim_ty = clean::PrimitiveType::from(p);
741 items.push(clean::Item {
742 inner: Box::new(clean::ItemInner {
743 name: None,
744 // We can use the item's `DefId` directly since the only information ever
745 // used from it is `DefId.krate`.
746 item_id: ItemId::DefId(module_def_id),
747 attrs: Default::default(),
748 stability: None,
749 kind: clean::ImportItem(clean::Import::new_simple(
750 item.ident.name,
751 clean::ImportSource {
752 path: clean::Path {
753 res,
754 segments: thin_vec![clean::PathSegment {
755 name: prim_ty.as_sym(),
756 args: clean::GenericArgs::AngleBracketed {
757 args: Default::default(),
758 constraints: ThinVec::new(),
759 },
760 }],
733761 },
734 true,
735 )),
736 cfg: None,
737 inline_stmt_id: None,
738 }),
739 });
740 } else if let Some(i) = try_inline(cx, res, item.ident.name, attrs, visited) {
741 items.extend(i)
762 did: None,
763 },
764 true,
765 )),
766 cfg: None,
767 inline_stmt_id: None,
768 }),
769 });
770 } else if let Some(def_id) = res.opt_def_id()
771 && let Some(reexport) = item.reexport_chain.first()
772 && let Some(reexport_def_id) = reexport.id()
773 && find_attr!(
774 load_attrs(cx.tcx, reexport_def_id),
775 Doc(d)
776 if d.inline.first().is_some_and(|(inline, _)| *inline == hir::attrs::DocInline::NoInline)
777 )
778 {
779 if should_ignore_res(res) {
780 continue;
742781 }
782 // This item is reexported as `no_inline` so it shouldn't be inlined.
783 let item = Item::from_def_id_and_parts(
784 module_def_id,
785 None,
786 clean::ImportItem(clean::Import::new_simple(
787 item.ident.name,
788 clean::ImportSource {
789 path: clean::Path {
790 res,
791 segments: thin_vec![
792 clean::PathSegment {
793 name: module_name,
794 args: clean::GenericArgs::AngleBracketed {
795 args: Default::default(),
796 constraints: ThinVec::new(),
797 },
798 },
799 clean::PathSegment {
800 name: cx.tcx.item_name(def_id),
801 args: clean::GenericArgs::AngleBracketed {
802 args: Default::default(),
803 constraints: ThinVec::new(),
804 },
805 },
806 ],
807 },
808 did: None,
809 },
810 true,
811 )),
812 cx.tcx,
813 );
814 items.push(item);
815 } else if let Some(i) = try_inline(cx, res, item.ident.name, attrs, visited) {
816 items.extend(i)
743817 }
744818 }
745819
src/librustdoc/passes/stripper.rs+2
......@@ -287,12 +287,14 @@ impl DocFolder for ImportStripper<'_> {
287287 clean::ImportItem(imp)
288288 if !self.document_hidden && self.import_should_be_hidden(&i, imp) =>
289289 {
290 debug!("ImportStripper: stripping {:?}", i.name);
290291 None
291292 }
292293 // clean::ImportItem(_) if !self.document_hidden && i.is_doc_hidden() => None,
293294 clean::ExternCrateItem { .. } | clean::ImportItem(..)
294295 if i.visibility(self.tcx) != Some(Visibility::Public) =>
295296 {
297 debug!("ImportStripper: stripping {:?}", i.name);
296298 None
297299 }
298300 _ => Some(self.fold_item_recur(i)),
src/tools/miri/tests/pass/0weak_memory/extra_cpp.rs-2
......@@ -3,8 +3,6 @@
33// Tests operations not performable through C++'s atomic API
44// but doable in safe (at least sound) Rust.
55
6#![feature(atomic_from_mut)]
7
86use std::sync::atomic::Ordering::*;
97use std::sync::atomic::{AtomicU16, AtomicU32};
108use std::thread::spawn;
tests/assembly-llvm/targets/targets-elf.rs+15
......@@ -28,6 +28,9 @@
2828//@ revisions: aarch64_nintendo_switch_freestanding
2929//@ [aarch64_nintendo_switch_freestanding] compile-flags: --target aarch64-nintendo-switch-freestanding
3030//@ [aarch64_nintendo_switch_freestanding] needs-llvm-components: aarch64
31//@ revisions: aarch64_oe_linux_gnu
32//@ [aarch64_oe_linux_gnu] compile-flags: --target aarch64-oe-linux-gnu
33//@ [aarch64_oe_linux_gnu] needs-llvm-components: aarch64
3134//@ revisions: aarch64_unknown_freebsd
3235//@ [aarch64_unknown_freebsd] compile-flags: --target aarch64-unknown-freebsd
3336//@ [aarch64_unknown_freebsd] needs-llvm-components: aarch64
......@@ -166,6 +169,9 @@
166169//@ revisions: armv7_linux_androideabi
167170//@ [armv7_linux_androideabi] compile-flags: --target armv7-linux-androideabi
168171//@ [armv7_linux_androideabi] needs-llvm-components: arm
172//@ revisions: armv7_oe_linux_gnueabihf
173//@ [armv7_oe_linux_gnueabihf] compile-flags: --target armv7-oe-linux-gnueabihf
174//@ [armv7_oe_linux_gnueabihf] needs-llvm-components: arm
169175//@ revisions: armv7_rtems_eabihf
170176//@ [armv7_rtems_eabihf] compile-flags: --target armv7-rtems-eabihf
171177//@ [armv7_rtems_eabihf] needs-llvm-components: arm
......@@ -271,6 +277,9 @@
271277//@ revisions: i686_linux_android
272278//@ [i686_linux_android] compile-flags: --target i686-linux-android
273279//@ [i686_linux_android] needs-llvm-components: x86
280//@ revisions: i686_oe_linux_gnu
281//@ [i686_oe_linux_gnu] compile-flags: --target i686-oe-linux-gnu
282//@ [i686_oe_linux_gnu] needs-llvm-components: x86
274283//@ revisions: i686_unknown_freebsd
275284//@ [i686_unknown_freebsd] compile-flags: --target i686-unknown-freebsd
276285//@ [i686_unknown_freebsd] needs-llvm-components: x86
......@@ -502,6 +511,9 @@
502511//@ revisions: riscv64_linux_android
503512//@ [riscv64_linux_android] compile-flags: --target riscv64-linux-android
504513//@ [riscv64_linux_android] needs-llvm-components: riscv
514//@ revisions: riscv64_oe_linux_gnu
515//@ [riscv64_oe_linux_gnu] compile-flags: --target riscv64-oe-linux-gnu
516//@ [riscv64_oe_linux_gnu] needs-llvm-components: riscv
505517//@ revisions: riscv64_wrs_vxworks
506518//@ [riscv64_wrs_vxworks] compile-flags: --target riscv64-wrs-vxworks
507519//@ [riscv64_wrs_vxworks] needs-llvm-components: riscv
......@@ -664,6 +676,9 @@
664676//@ revisions: x86_64_lynx_lynxos178
665677//@ [x86_64_lynx_lynxos178] compile-flags: --target x86_64-lynx-lynxos178
666678//@ [x86_64_lynx_lynxos178] needs-llvm-components: x86
679//@ revisions: x86_64_oe_linux_gnu
680//@ [x86_64_oe_linux_gnu] compile-flags: --target x86_64-oe-linux-gnu
681//@ [x86_64_oe_linux_gnu] needs-llvm-components: x86
667682//@ revisions: x86_64_pc_nto_qnx710
668683//@ [x86_64_pc_nto_qnx710] compile-flags: --target x86_64-pc-nto-qnx710
669684//@ [x86_64_pc_nto_qnx710] needs-llvm-components: x86
tests/rustdoc-html/reexport/auxiliary/inline-foreign-no_inline.rs created+9
......@@ -0,0 +1,9 @@
1#[doc(no_inline)]
2pub use crate::{
3 future::{Future, FutureExt as _},
4};
5
6mod future {
7 pub struct Future;
8 pub trait FutureExt {}
9}
tests/rustdoc-html/reexport/inline-foreign-no_inline.rs created+22
......@@ -0,0 +1,22 @@
1// This test ensures that an inlined foreign item with `#[doc(no_inline)]` is
2// not inlined.
3// This is a regression test for <https://github.com/rust-lang/rust/issues/92379>.
4
5//@ aux-build: inline-foreign-no_inline.rs
6
7#![crate_name = "foo"]
8
9extern crate inline_foreign_no_inline;
10
11// Since we cannot inline `inline_foreign_no_inline` because it has `no_inline`, there
12// should have no other items than "Module".
13//@ has 'foo/index.html'
14//@ count - '//*[@id="main-content"]/h2' 1
15//@ has - '//*[@id="main-content"]/h2' 'Module'
16//@ has - '//*[@id="main-content"]/dl[@class="item-table"]/dt' 'dep'
17
18//@ has 'foo/dep/index.html'
19//@ has - '//*[@class="item-table reexports"]/dt' 'pub use dep::Future;'
20//@ has - '//*[@class="item-table reexports"]/dt' 'pub use dep::FutureExt as _;'
21#[doc(inline)]
22pub use inline_foreign_no_inline as dep;
tests/rustdoc-html/reexport/inline-no_inline.rs created+21
......@@ -0,0 +1,21 @@
1// This test checks that inlining a `no_inline` is done correctly.
2
3#![crate_name = "foo"]
4
5//@ has 'foo/index.html'
6// There should be `Re-exports` and `Structs`
7//@ count - '//*[@id="main-content"]/h2' 2
8//@ has - '//*[@id="main-content"]/h2[@class="section-header"]' 'Re-exports'
9//@ has - '//*[@id="main-content"]/h2[@class="section-header"]' 'Structs'
10
11//@ has - '//*[@id="main-content"]/dl[@class="item-table reexports"]/dt' 'pub use self::bar::A;'
12//@ has - '//*[@id="main-content"]/dl[@class="item-table"]/dt' 'X'
13
14mod bar {
15 pub struct A;
16}
17
18#[doc(no_inline)]
19pub use self::bar::A;
20#[doc(inline)]
21pub use self::A as X;
tests/ui/lint/c-void-returns.rs created+22
......@@ -0,0 +1,22 @@
1#![allow(unused)]
2#![deny(c_void_returns)]
3
4use std::ffi::c_void;
5use std::ptr;
6
7fn foo() -> c_void { //~ ERROR c_void
8 unreachable!()
9}
10
11fn bar() -> *mut c_void {
12 ptr::null_mut()
13}
14
15unsafe extern "C" {
16 fn baz() -> c_void; //~ ERROR c_void
17 fn quux() -> *const c_void;
18}
19
20type Xyzzy = fn() -> c_void; //~ ERROR c_void
21
22fn main() {}
tests/ui/lint/c-void-returns.stderr created+38
......@@ -0,0 +1,38 @@
1error: `c_void` should not be used as a return type
2 --> $DIR/c-void-returns.rs:7:13
3 |
4LL | fn foo() -> c_void {
5 | ----^^^^^^
6 | |
7 | help: remove the return type to implicitly return `()`
8 |
9 = help: returning `()` in Rust is equivalent to returning `void` in C
10note: the lint level is defined here
11 --> $DIR/c-void-returns.rs:2:9
12 |
13LL | #![deny(c_void_returns)]
14 | ^^^^^^^^^^^^^^
15
16error: declarations returning `c_void` are not compatible with C functions returning `void`
17 --> $DIR/c-void-returns.rs:16:17
18 |
19LL | fn baz() -> c_void;
20 | ----^^^^^^
21 | |
22 | help: remove the return type to implicitly return `()`
23 |
24 = help: returning `()` in Rust is equivalent to returning `void` in C
25 = note: `c_void` is only used through raw pointers for compatibility with `void` pointers
26
27error: `c_void` should not be used as a return type
28 --> $DIR/c-void-returns.rs:20:22
29 |
30LL | type Xyzzy = fn() -> c_void;
31 | ----^^^^^^
32 | |
33 | help: remove the return type to implicitly return `()`
34 |
35 = help: returning `()` in Rust is equivalent to returning `void` in C
36
37error: aborting due to 3 previous errors
38
tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_matches.stderr deleted-13
......@@ -1,13 +0,0 @@
1error[E0658]: use of unstable library feature `atomic_from_mut`
2 --> $DIR/atomic-from-mut-not-available.rs:24:5
3 |
4LL | core::sync::atomic::AtomicU64::from_mut(&mut 0u64);
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6 |
7 = note: see issue #76314 <https://github.com/rust-lang/rust/issues/76314> for more information
8 = help: add `#![feature(atomic_from_mut)]` to the crate attributes to enable
9 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10
11error: aborting due to 1 previous error
12
13For more information about this error, try `rustc --explain E0658`.
tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr+1-1
......@@ -1,5 +1,5 @@
11error[E0599]: no associated function or constant named `from_mut` found for struct `Atomic<u64>` in the current scope
2 --> $DIR/atomic-from-mut-not-available.rs:24:36
2 --> $DIR/atomic-from-mut-not-available.rs:25:36
33 |
44LL | core::sync::atomic::AtomicU64::from_mut(&mut 0u64);
55 | ^^^^^^^^ associated function or constant not found in `Atomic<u64>`
tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.rs+1-1
......@@ -19,9 +19,9 @@
1919// ... but pass on 64-bit x86_64 linux.
2020//@[alignment_matches] only-x86_64
2121//@[alignment_matches] only-linux
22//@[alignment_matches] check-pass
2223
2324fn main() {
2425 core::sync::atomic::AtomicU64::from_mut(&mut 0u64);
2526 //[alignment_mismatch]~^ ERROR no associated function or constant named `from_mut` found for struct `Atomic<u64>`
26 //[alignment_matches]~^^ ERROR use of unstable library feature `atomic_from_mut`
2727}