Skip to content

Commit

Permalink
Auto merge of #75966 - Dylan-DPC:rollup-srfpces, r=Dylan-DPC
Browse files Browse the repository at this point in the history
Rollup of 10 pull requests

Successful merges:

 - #74730 (Hexagon libstd: update type defs)
 - #75758 (Fixes for VxWorks)
 - #75780 (Unconfuse Unpin docs a bit)
 - #75806 (Prevent automatic page change when using history)
 - #75818 (Update docs for SystemTime Windows implementation)
 - #75837 (Fix font color for help button in ayu and dark themes)
 - #75870 (Unify theme choices border color in ayu theme)
 - #75875 (Shorten liballoc vec resize intra-doc link)
 - #75953 (Fix swapped stability attributes for rustdoc lints)
 - #75958 (Avoid function-scoping global variables)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Aug 27, 2020
2 parents 45a83e9 + 8fd73aa commit 09b06f9
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 79 deletions.
8 changes: 3 additions & 5 deletions library/alloc/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1456,9 +1456,9 @@ impl<T> Vec<T> {
/// If `new_len` is less than `len`, the `Vec` is simply truncated.
///
/// This method uses a closure to create new values on every push. If
/// you'd rather [`Clone`] a given value, use [`resize`]. If you want
/// to use the [`Default`] trait to generate values, you can pass
/// [`Default::default()`] as the second argument.
/// you'd rather [`Clone`] a given value, use [`Vec::resize`]. If you
/// want to use the [`Default`] trait to generate values, you can
/// pass [`Default::default`] as the second argument.
///
/// # Examples
///
Expand All @@ -1472,8 +1472,6 @@ impl<T> Vec<T> {
/// vec.resize_with(4, || { p *= 2; p });
/// assert_eq!(vec, [2, 4, 8, 16]);
/// ```
///
/// [`resize`]: Vec::resize
#[stable(feature = "vec_resize_with", since = "1.33.0")]
pub fn resize_with<F>(&mut self, new_len: usize, f: F)
where
Expand Down
28 changes: 14 additions & 14 deletions library/core/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,23 +728,23 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}

/// Types that can be safely moved after being pinned.
///
/// Since Rust itself has no notion of immovable types, and considers moves
/// (e.g., through assignment or [`mem::replace`]) to always be safe,
/// this trait cannot prevent types from moving by itself.
/// Rust itself has no notion of immovable types, and considers moves (e.g.,
/// through assignment or [`mem::replace`]) to always be safe.
///
/// Instead it is used to prevent moves through the type system,
/// by controlling the behavior of pointers `P` wrapped in the [`Pin<P>`] wrapper,
/// which "pin" the type in place by not allowing it to be moved out of them.
/// See the [`pin module`] documentation for more information on pinning.
/// The [`Pin`][Pin] type is used instead to prevent moves through the type
/// system. Pointers `P<T>` wrapped in the [`Pin<P<T>>`][Pin] wrapper can't be
/// moved out of. See the [`pin module`] documentation for more information on
/// pinning.
///
/// Implementing this trait lifts the restrictions of pinning off a type,
/// which then allows it to move out with functions such as [`mem::replace`].
/// Implementing the `Unpin` trait for `T` lifts the restrictions of pinning off
/// the type, which then allows moving `T` out of [`Pin<P<T>>`][Pin] with
/// functions such as [`mem::replace`].
///
/// `Unpin` has no consequence at all for non-pinned data. In particular,
/// [`mem::replace`] happily moves `!Unpin` data (it works for any `&mut T`, not
/// just when `T: Unpin`). However, you cannot use
/// [`mem::replace`] on data wrapped inside a [`Pin<P>`] because you cannot get the
/// `&mut T` you need for that, and *that* is what makes this system work.
/// just when `T: Unpin`). However, you cannot use [`mem::replace`] on data
/// wrapped inside a [`Pin<P<T>>`][Pin] because you cannot get the `&mut T` you
/// need for that, and *that* is what makes this system work.
///
/// So this, for example, can only be done on types implementing `Unpin`:
///
Expand All @@ -765,8 +765,8 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
/// This trait is automatically implemented for almost every type.
///
/// [`mem::replace`]: ../../std/mem/fn.replace.html
/// [`Pin<P>`]: ../pin/struct.Pin.html
/// [`pin module`]: ../../std/pin/index.html
/// [Pin]: crate::pin::Pin
/// [`pin module`]: crate::pin
#[stable(feature = "pin", since = "1.33.0")]
#[rustc_on_unimplemented(
on(_Self = "std::future::Future", note = "consider using `Box::pin`",),
Expand Down
48 changes: 24 additions & 24 deletions library/std/src/os/linux/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,63 +170,63 @@ mod arch {

#[cfg(target_arch = "hexagon")]
mod arch {
use crate::os::raw::{c_int, c_long, c_longlong, c_ulonglong};
use crate::os::raw::{c_int, c_long, c_uint};

#[stable(feature = "raw_ext", since = "1.1.0")]
pub type blkcnt_t = c_longlong;
pub type blkcnt_t = i64;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type blksize_t = c_long;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type ino_t = c_ulonglong;
pub type ino_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type nlink_t = c_uint;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type off_t = c_longlong;
pub type off_t = i64;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type time_t = c_long;
pub type time_t = i64;

#[repr(C)]
#[derive(Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_dev: ::dev_t,
pub st_dev: u64,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_ino: ::c_ulonglong,
pub st_ino: u64,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_mode: ::c_uint,
pub st_mode: u32,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_nlink: ::c_uint,
pub st_nlink: u32,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_uid: ::c_uint,
pub st_uid: u32,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_gid: ::c_uint,
pub st_gid: u32,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_rdev: ::c_ulonglong,
pub st_rdev: u64,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub __pad1: ::c_ulong,
pub __pad1: u32,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_size: ::c_longlong,
pub st_size: i64,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_blksize: ::blksize_t,
pub st_blksize: i32,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub __pad2: ::c_int,
pub __pad2: i32,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_blocks: ::blkcnt_t,
pub st_blocks: i64,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_atime: ::time_t,
pub st_atime: i64,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_atime_nsec: ::c_long,
pub st_atime_nsec: c_long,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_mtime: ::time_t,
pub st_mtime: i64,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_mtime_nsec: ::c_long,
pub st_mtime_nsec: c_long,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_ctime: ::time_t,
pub st_ctime: i64,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_ctime_nsec: ::c_long,
pub st_ctime_nsec: c_long,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub __pad3: [::c_int; 2],
pub __pad3: [c_int; 2],
}
}

Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/vxworks/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl FileDesc {
}

#[inline]
fn is_read_vectored(&self) -> bool {
pub fn is_read_vectored(&self) -> bool {
true
}

Expand Down
15 changes: 3 additions & 12 deletions library/std/src/sys/vxworks/process/process_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,28 +351,19 @@ impl ExitStatus {
}

fn exited(&self) -> bool {
/*unsafe*/
{ libc::WIFEXITED(self.0) }
libc::WIFEXITED(self.0)
}

pub fn success(&self) -> bool {
self.code() == Some(0)
}

pub fn code(&self) -> Option<i32> {
if self.exited() {
Some(/*unsafe*/ { libc::WEXITSTATUS(self.0) })
} else {
None
}
if self.exited() { Some(libc::WEXITSTATUS(self.0)) } else { None }
}

pub fn signal(&self) -> Option<i32> {
if !self.exited() {
Some(/*unsafe*/ { libc::WTERMSIG(self.0) })
} else {
None
}
if !self.exited() { Some(libc::WTERMSIG(self.0)) } else { None }
}
}

Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/vxworks/thread_local_dtor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
#![unstable(feature = "thread_local_internals", issue = "none")]

pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
use crate::sys_common::thread_local::register_dtor_fallback;
use crate::sys_common::thread_local_dtor::register_dtor_fallback;
register_dtor_fallback(t, dtor);
}
3 changes: 2 additions & 1 deletion library/std/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,15 @@ pub struct Instant(time::Instant);
/// | DARWIN | [gettimeofday] |
/// | VXWorks | [clock_gettime (Realtime Clock)] |
/// | WASI | [__wasi_clock_time_get (Realtime Clock)] |
/// | Windows | [GetSystemTimeAsFileTime] |
/// | Windows | [GetSystemTimePreciseAsFileTime] / [GetSystemTimeAsFileTime] |
///
/// [clock_time_get (Realtime Clock)]: https://nuxi.nl/cloudabi/#clock_time_get
/// [`insecure_time` usercall]: https://edp.fortanix.com/docs/api/fortanix_sgx_abi/struct.Usercalls.html#method.insecure_time
/// [timekeeping in SGX]: https://edp.fortanix.com/docs/concepts/rust-std/#codestdtimecode
/// [gettimeofday]: http://man7.org/linux/man-pages/man2/gettimeofday.2.html
/// [clock_gettime (Realtime Clock)]: https://linux.die.net/man/3/clock_gettime
/// [__wasi_clock_time_get (Realtime Clock)]: https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/docs.md#clock_time_get
/// [GetSystemTimePreciseAsFileTime]: https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime
/// [GetSystemTimeAsFileTime]: https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime
///
/// **Disclaimer:** These system calls might change over time.
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/cc_detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ pub fn find(build: &mut Build) {
false
};

if cxx_configured {
// for VxWorks, record CXX compiler which will be used in lib.rs:linker()
if cxx_configured || target.contains("vxworks") {
let compiler = cfg.get_compiler();
build.cxx.insert(target, compiler);
}
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,10 @@ impl Build {
if let Some(linker) = self.config.target_config.get(&target).and_then(|c| c.linker.as_ref())
{
Some(linker)
} else if target.contains("vxworks") {
// need to use CXX compiler as linker to resolve the exception functions
// that are only existed in CXX libraries
Some(self.cxx[&target].path())
} else if target != self.config.build
&& util::use_host_linker(target)
&& !target.contains("msvc")
Expand Down
18 changes: 14 additions & 4 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1576,14 +1576,21 @@ function defocusSearchBar() {
}

function showResults(results) {
if (results.others.length === 1 &&
getCurrentValue("rustdoc-go-to-only-result") === "true") {
var search = getSearchElement();
if (results.others.length === 1
&& getCurrentValue("rustdoc-go-to-only-result") === "true"
// By default, the search DOM element is "empty" (meaning it has no children not
// text content). Once a search has been run, it won't be empty, even if you press
// ESC or empty the search input (which also "cancels" the search).
&& (!search.firstChild || search.firstChild.innerText !== getSearchLoadingText()))
{
var elem = document.createElement("a");
elem.href = results.others[0].href;
elem.style.display = "none";
// For firefox, we need the element to be in the DOM so it can be clicked.
document.body.appendChild(elem);
elem.click();
return;
}
var query = getQuery(search_input.value);

Expand All @@ -1602,7 +1609,6 @@ function defocusSearchBar() {
"</div><div id=\"results\">" +
ret_others[0] + ret_in_args[0] + ret_returned[0] + "</div>";

var search = getSearchElement();
search.innerHTML = output;
showSearchResults(search);
var tds = search.getElementsByTagName("td");
Expand Down Expand Up @@ -2679,6 +2685,10 @@ function defocusSearchBar() {
}
}

function getSearchLoadingText() {
return "Loading search results...";
}

if (search_input) {
search_input.onfocus = function() {
putBackSearch(this);
Expand All @@ -2688,7 +2698,7 @@ function defocusSearchBar() {
var params = getQueryStringParams();
if (params && params.search) {
var search = getSearchElement();
search.innerHTML = "<h3 style=\"text-align: center;\">Loading search results...</h3>";
search.innerHTML = "<h3 style=\"text-align: center;\">" + getSearchLoadingText() + "</h3>";
showSearchResults(search);
}

Expand Down
3 changes: 2 additions & 1 deletion src/librustdoc/html/static/themes/ayu.css
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ kbd {
#theme-picker, #settings-menu, .help-button {
border-color: #5c6773;
background-color: #0f1419;
color: #fff;
}

#theme-picker > img, #settings-menu > img {
Expand All @@ -513,7 +514,7 @@ kbd {
}

#theme-choices > button:not(:first-child) {
border-top-color: #c5c5c5;
border-top-color: #5c6773;
}

#theme-choices > button:hover, #theme-choices > button:focus {
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/html/static/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ kbd {
#theme-picker, #settings-menu, .help-button {
border-color: #e0e0e0;
background: #f0f0f0;
color: #000;
}

#theme-picker:hover, #theme-picker:focus,
Expand Down
12 changes: 6 additions & 6 deletions src/librustdoc/passes/doc_test_lints.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! This pass is overloaded and runs two different lints.
//!
//! - MISSING_DOC_CODE_EXAMPLES: this looks for public items missing doc-tests
//! - PRIVATE_DOC_TESTS: this looks for private items with doc-tests.
//! - MISSING_DOC_CODE_EXAMPLES: this lint is **UNSTABLE** and looks for public items missing doc-tests
//! - PRIVATE_DOC_TESTS: this lint is **STABLE** and looks for private items with doc-tests.

use super::{span_of_attrs, Pass};
use crate::clean;
Expand Down Expand Up @@ -89,7 +89,9 @@ pub fn look_for_tests<'tcx>(cx: &DocContext<'tcx>, dox: &str, item: &Item) {

find_testable_code(&dox, &mut tests, ErrorCodes::No, false, None);

if tests.found_tests == 0 {
if tests.found_tests == 0
&& rustc_feature::UnstableFeatures::from_environment().is_nightly_build()
{
if should_have_doc_example(&item.inner) {
debug!("reporting error for {:?} (hir_id={:?})", item, hir_id);
let sp = span_of_attrs(&item.attrs).unwrap_or(item.source.span());
Expand All @@ -100,9 +102,7 @@ pub fn look_for_tests<'tcx>(cx: &DocContext<'tcx>, dox: &str, item: &Item) {
|lint| lint.build("missing code example in this documentation").emit(),
);
}
} else if rustc_feature::UnstableFeatures::from_environment().is_nightly_build()
&& tests.found_tests > 0
&& !cx.renderinfo.borrow().access_levels.is_public(item.def_id)
} else if tests.found_tests > 0 && !cx.renderinfo.borrow().access_levels.is_public(item.def_id)
{
cx.tcx.struct_span_lint_hir(
lint::builtin::PRIVATE_DOC_TESTS,
Expand Down
18 changes: 9 additions & 9 deletions src/tools/publish_toolstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,12 @@ def update_latest(
return message


def main():
# Warning: Do not try to add a function containing the body of this try block.
# There are variables declared within that are implicitly global; it is unknown
# which ones precisely but at least this is true for `github_token`.
try:
if __name__ != '__main__':
exit(0)
repo = os.environ.get('TOOLSTATE_VALIDATE_MAINTAINERS_REPO')
if repo:
github_token = os.environ.get('TOOLSTATE_REPO_ACCESS_TOKEN')
Expand Down Expand Up @@ -342,11 +347,6 @@ def main():
}
))
response.read()


if __name__ == '__main__':
try:
main()
except urllib2.HTTPError as e:
print("HTTPError: %s\n%s" % (e, e.read()))
raise
except urllib2.HTTPError as e:
print("HTTPError: %s\n%s" % (e, e.read()))
raise

0 comments on commit 09b06f9

Please sign in to comment.