Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Rollup of 6 pull requests #102558

Merged
merged 14 commits into from
Oct 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
432 changes: 271 additions & 161 deletions COPYRIGHT

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions library/core/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2066,9 +2066,6 @@ impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> {
/// so the final value of `shared` is 6 (= `3 + 2 + 1`), not 16.
#[inline]
fn from_iter<I: IntoIterator<Item = Result<A, E>>>(iter: I) -> Result<V, E> {
// FIXME(#11084): This could be replaced with Iterator::scan when this
// performance bug is closed.

iter::try_process(iter.into_iter(), |i| i.collect())
}
}
Expand Down
2 changes: 2 additions & 0 deletions library/std/src/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,8 @@ pub fn panicking() -> bool {
panicking::panicking()
}

/// Use [`sleep`].
///
/// Puts the current thread to sleep for at least the specified amount of time.
///
/// The thread may sleep longer than the duration specified due to scheduling
Expand Down
7 changes: 5 additions & 2 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &'static str, Option<&[&'static str]>)]
// FIXME: Used by proc-macro2, but we should not be triggering on external dependencies.
(Some(Mode::Rustc), "span_locations", None),
(Some(Mode::ToolRustc), "span_locations", None),
// Can be passed in RUSTFLAGS to prevent direct syscalls in rustix.
(None, "rustix_use_libc", None),
];

/// A structure representing a Rust compiler.
Expand Down Expand Up @@ -654,8 +656,6 @@ impl Build {
job::setup(self);
}

// Download rustfmt early so that it can be used in rust-analyzer configs.
let _ = &builder::Builder::new(&self).initial_rustfmt();
self.maybe_update_submodules();

if let Subcommand::Format { check, paths } = &self.config.cmd {
Expand All @@ -670,6 +670,9 @@ impl Build {
return setup::setup(&self.config, *profile);
}

// Download rustfmt early so that it can be used in rust-analyzer configs.
let _ = &builder::Builder::new(&self).initial_rustfmt();

{
let builder = builder::Builder::new(&self);
if let Some(path) = builder.paths.get(0) {
Expand Down
26 changes: 18 additions & 8 deletions src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1010,15 +1010,25 @@ fn fmt_type<'cx>(
write!(f, "]")
}
},
clean::Array(ref t, ref n) => {
primitive_link(f, PrimitiveType::Array, "[", cx)?;
fmt::Display::fmt(&t.print(cx), f)?;
if f.alternate() {
primitive_link(f, PrimitiveType::Array, &format!("; {}]", n), cx)
} else {
primitive_link(f, PrimitiveType::Array, &format!("; {}]", Escape(n)), cx)
clean::Array(ref t, ref n) => match **t {
clean::Generic(name) if !f.alternate() => primitive_link(
f,
PrimitiveType::Array,
&format!("[{name}; {n}]", n = Escape(n)),
cx,
),
_ => {
write!(f, "[")?;
fmt::Display::fmt(&t.print(cx), f)?;
if f.alternate() {
write!(f, "; {n}")?;
} else {
write!(f, "; ")?;
primitive_link(f, PrimitiveType::Array, &format!("{n}", n = Escape(n)), cx)?;
}
write!(f, "]")
}
}
},
clean::RawPointer(m, ref t) => {
let m = match m {
hir::Mutability::Mut => "mut",
Expand Down
1 change: 1 addition & 0 deletions src/test/rustdoc/array-links.link_box_generic.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<code>pub fn delta&lt;T&gt;() -&gt; <a class="struct" href="struct.MyBox.html" title="struct foo::MyBox">MyBox</a>&lt;<a class="primitive" href="{{channel}}/core/primitive.array.html">[T; 1]</a>&gt;</code>
1 change: 1 addition & 0 deletions src/test/rustdoc/array-links.link_box_u32.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<code>pub fn gamma() -&gt; <a class="struct" href="struct.MyBox.html" title="struct foo::MyBox">MyBox</a>&lt;[<a class="primitive" href="{{channel}}/core/primitive.u32.html">u32</a>; <a class="primitive" href="{{channel}}/core/primitive.array.html">1</a>]&gt;</code>
1 change: 1 addition & 0 deletions src/test/rustdoc/array-links.link_slice_generic.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<code>pub fn beta&lt;T&gt;() -&gt; &amp;'static <a class="primitive" href="{{channel}}/core/primitive.array.html">[T; 1]</a></code>
1 change: 1 addition & 0 deletions src/test/rustdoc/array-links.link_slice_u32.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<code>pub fn alpha() -&gt; &amp;'static [<a class="primitive" href="{{channel}}/core/primitive.u32.html">u32</a>; <a class="primitive" href="{{channel}}/core/primitive.array.html">1</a>]</code>
28 changes: 28 additions & 0 deletions src/test/rustdoc/array-links.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#![crate_name = "foo"]
#![no_std]

pub struct MyBox<T: ?Sized>(*const T);

// @has 'foo/fn.alpha.html'
// @snapshot link_slice_u32 - '//pre[@class="rust fn"]/code'
pub fn alpha() -> &'static [u32; 1] {
loop {}
}

// @has 'foo/fn.beta.html'
// @snapshot link_slice_generic - '//pre[@class="rust fn"]/code'
pub fn beta<T>() -> &'static [T; 1] {
loop {}
}

// @has 'foo/fn.gamma.html'
// @snapshot link_box_u32 - '//pre[@class="rust fn"]/code'
pub fn gamma() -> MyBox<[u32; 1]> {
loop {}
}

// @has 'foo/fn.delta.html'
// @snapshot link_box_generic - '//pre[@class="rust fn"]/code'
pub fn delta<T>() -> MyBox<[T; 1]> {
loop {}
}