Auto merge of #75966 - Dylan-DPC:rollup-srfpces, r=Dylan-DPC

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
This commit is contained in:
bors 2020-08-27 00:25:52 +00:00
commit 09b06f9a09
14 changed files with 86 additions and 79 deletions

View File

@ -1456,9 +1456,9 @@ fn assert_failed(at: usize, len: usize) -> ! {
/// 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
///
@ -1472,8 +1472,6 @@ fn assert_failed(at: usize, len: usize) -> ! {
/// 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

View File

@ -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`:
///
@ -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`",),

View File

@ -170,63 +170,63 @@ pub struct stat {
#[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],
}
}

View File

@ -53,7 +53,7 @@ pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
}
#[inline]
fn is_read_vectored(&self) -> bool {
pub fn is_read_vectored(&self) -> bool {
true
}

View File

@ -351,8 +351,7 @@ pub fn new(status: c_int) -> ExitStatus {
}
fn exited(&self) -> bool {
/*unsafe*/
{ libc::WIFEXITED(self.0) }
libc::WIFEXITED(self.0)
}
pub fn success(&self) -> bool {
@ -360,19 +359,11 @@ pub fn success(&self) -> bool {
}
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 }
}
}

View File

@ -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);
}

View File

@ -159,7 +159,7 @@
/// | 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
@ -167,6 +167,7 @@
/// [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.

View File

@ -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);
}

View File

@ -854,6 +854,10 @@ fn linker(&self, target: TargetSelection, can_use_lld: bool) -> Option<&Path> {
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")

View File

@ -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);
@ -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");
@ -2679,6 +2685,10 @@ function defocusSearchBar() {
}
}
function getSearchLoadingText() {
return "Loading search results...";
}
if (search_input) {
search_input.onfocus = function() {
putBackSearch(this);
@ -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);
}

View File

@ -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 {
@ -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 {

View File

@ -389,6 +389,7 @@ kbd {
#theme-picker, #settings-menu, .help-button {
border-color: #e0e0e0;
background: #f0f0f0;
color: #000;
}
#theme-picker:hover, #theme-picker:focus,

View File

@ -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;
@ -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());
@ -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,

View File

@ -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')
@ -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