Skip to content
Permalink
Browse files

Auto merge of #57727 - Centril:rollup, r=Centril

Rollup of 22 pull requests

Successful merges:

 - #56594 (Remove confusing comment about ideally using `!` for `c_void`)
 - #57107 (Add a regression test for mutating a non-mut #[thread_local])
 - #57340 (Use correct tracking issue for c_variadic)
 - #57357 (Cleanup PartialEq docs.)
 - #57370 (Support passing cflags/cxxflags/ldflags to LLVM build)
 - #57475 (Add signed num::NonZeroI* types)
 - #57501 (High priority resolutions for associated variants)
 - #57551 (resolve: Add a test for issue #57539)
 - #57610 (Fix nested `?` matchers)
 - #57634 (Remove an unused function argument)
 - #57635 (use structured macro and path resolve suggestions)
 - #57636 (Fix sources sidebar not showing up)
 - #57646 (Fixes text becoming invisible when element targetted)
 - #57649 (privacy: Account for associated existential types)
 - #57650 (librustc_metadata: Pass a default value when unwrapping a span)
 - #57654 (Add some links in std::fs.)
 - #57658 (Two HIR tweaks)
 - #57659 (Fix release manifest generation)
 - #57683 (Document Unpin in std::prelude documentation)
 - #57685 (Enhance `Pin` impl applicability for `PartialEq` and `PartialOrd`.)
 - #57698 (Fix typo bug in DepGraph::try_mark_green().)
 - #57720 (Fix suggestions given mulitple bad lifetimes)

Failed merges:

r? @ghost
  • Loading branch information...
bors committed Jan 18, 2019
2 parents 38650b6 + ca72ad1 commit fd3f45b02699d0b74948edc199da7898ac331846
Showing with 930 additions and 363 deletions.
  1. +5 −0 config.toml.example
  2. +10 −0 src/bootstrap/config.rs
  3. +4 −0 src/bootstrap/configure.py
  4. +14 −1 src/bootstrap/native.rs
  5. +22 −16 src/libcore/cmp.rs
  6. +21 −18 src/libcore/ffi.rs
  7. +21 −15 src/libcore/num/mod.rs
  8. +45 −3 src/libcore/pin.rs
  9. +9 −1 src/libcore/tests/nonzero.rs
  10. +1 −1 src/librustc/dep_graph/graph.rs
  11. +1 −57 src/librustc/hir/intravisit.rs
  12. +1 −1 src/librustc/hir/lowering.rs
  13. +2 −13 src/librustc/hir/mod.rs
  14. +1 −1 src/librustc/ich/impls_hir.rs
  15. +7 −0 src/librustc/lint/builtin.rs
  16. +0 −9 src/librustc_borrowck/borrowck/mod.rs
  17. +0 −4 src/librustc_borrowck/borrowck/move_data.rs
  18. +3 −4 src/librustc_borrowck/dataflow.rs
  19. +5 −4 src/librustc_errors/lib.rs
  20. +5 −0 src/librustc_lint/lib.rs
  21. +1 −1 src/librustc_metadata/native_libs.rs
  22. +26 −17 src/librustc_privacy/lib.rs
  23. +19 −5 src/librustc_resolve/lib.rs
  24. +96 −66 src/librustc_typeck/astconv.rs
  25. +26 −35 src/librustc_typeck/check/method/mod.rs
  26. +2 −2 src/librustc_typeck/check/mod.rs
  27. +1 −1 src/librustdoc/html/render.rs
  28. +0 −2 src/librustdoc/html/static/source-script.js
  29. +1 −7 src/librustdoc/html/static/themes/dark.css
  30. +1 −7 src/librustdoc/html/static/themes/light.css
  31. +1 −1 src/libstd/ffi/mod.rs
  32. +17 −5 src/libstd/fs.rs
  33. +3 −2 src/libstd/prelude/mod.rs
  34. +10 −4 src/libsyntax/ext/tt/macro_rules.rs
  35. +6 −15 src/libsyntax/parse/parser.rs
  36. +17 −0 src/test/incremental/change_name_of_static_in_fn.rs
  37. +6 −0 src/test/ui/feature-gate/feature-gate-static-nobundle-2.rs
  38. +7 −0 src/test/ui/feature-gate/feature-gate-static-nobundle-2.stderr
  39. +8 −0 src/test/ui/imports/issue-57539.rs
  40. +18 −0 src/test/ui/imports/issue-57539.stderr
  41. +29 −8 src/test/ui/issues/issue-5067.rs
  42. +60 −12 src/test/ui/issues/issue-5067.stderr
  43. +80 −0 src/test/ui/issues/issue-57597.rs
  44. +74 −0 src/test/ui/issues/issue-57597.stderr
  45. +9 −0 src/test/ui/lifetime-before-type-params.rs
  46. +47 −0 src/test/ui/lifetime-before-type-params.stderr
  47. +8 −1 src/test/ui/privacy/private-in-public-assoc-ty.rs
  48. +15 −5 src/test/ui/privacy/private-in-public-assoc-ty.stderr
  49. +10 −0 src/test/ui/privacy/private-in-public-existential.rs
  50. +1 −1 src/test/ui/resolve/resolve-hint-macro.stderr
  51. +23 −13 src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr
  52. +2 −2 src/test/ui/suggestions/suggest-move-lifetimes.stderr
  53. +9 −0 src/test/ui/thread-local-mutation.nll.stderr
  54. +18 −0 src/test/ui/thread-local-mutation.rs
  55. +9 −0 src/test/ui/thread-local-mutation.stderr
  56. +2 −2 src/test/ui/try-block/try-block-bad-type.stderr
  57. +1 −1 src/test/ui/try-block/try-block-in-edition2015.stderr
  58. +13 −0 src/test/ui/type-alias-enum-variants-priority-2.rs
  59. +12 −0 src/test/ui/type-alias-enum-variants-priority-2.stderr
  60. +10 −0 src/test/ui/type-alias-enum-variants-priority-3.rs
  61. +8 −0 src/test/ui/type-alias-enum-variants-priority-3.stderr
  62. +20 −0 src/test/ui/type-alias-enum-variants-priority.rs
  63. +26 −0 src/test/ui/type-alias-enum-variants-priority.stderr
  64. +1 −0 src/tools/build-manifest/src/main.rs
@@ -90,6 +90,11 @@
# with clang-cl, so this is special in that it only compiles LLVM with clang-cl
#clang-cl = '/path/to/clang-cl.exe'

# Pass extra compiler and linker flags to the LLVM CMake build.
#cflags = "-fextra-flag"
#cxxflags = "-fextra-flag"
#ldflags = "-Wl,extra-flag"

# Use libc++ when building LLVM instead of libstdc++. This is the default on
# platforms already use libc++ as the default C++ library, but this option
# allows you to use libc++ even on platforms when it's not. You need to ensure
@@ -82,6 +82,9 @@ pub struct Config {
pub lldb_enabled: bool,
pub llvm_tools_enabled: bool,

pub llvm_cflags: Option<String>,
pub llvm_cxxflags: Option<String>,
pub llvm_ldflags: Option<String>,
pub llvm_use_libcxx: bool,

// rust codegen options
@@ -254,6 +257,9 @@ struct Llvm {
link_shared: Option<bool>,
version_suffix: Option<String>,
clang_cl: Option<String>,
cflags: Option<String>,
cxxflags: Option<String>,
ldflags: Option<String>,
use_libcxx: Option<bool>,
}

@@ -516,6 +522,10 @@ impl Config {
config.llvm_link_jobs = llvm.link_jobs;
config.llvm_version_suffix = llvm.version_suffix.clone();
config.llvm_clang_cl = llvm.clang_cl.clone();

config.llvm_cflags = llvm.cflags.clone();
config.llvm_cxxflags = llvm.cxxflags.clone();
config.llvm_ldflags = llvm.ldflags.clone();
set(&mut config.llvm_use_libcxx, llvm.use_libcxx);
}

@@ -64,6 +64,10 @@ def v(*args):
o("missing-tools", "dist.missing-tools", "allow failures when building tools")
o("use-libcxx", "llvm.use_libcxx", "build LLVM with libc++")

o("cflags", "llvm.cflags", "build LLVM with these extra compiler flags")
o("cxxflags", "llvm.cxxflags", "build LLVM with these extra compiler flags")
o("ldflags", "llvm.ldflags", "build LLVM with these extra linker flags")

# Optimization and debugging options. These may be overridden by the release
# channel, etc.
o("optimize", "rust.optimize", "build optimized rust code")
@@ -358,14 +358,21 @@ fn configure_cmake(builder: &Builder,
}

cfg.build_arg("-j").build_arg(builder.jobs().to_string());
cfg.define("CMAKE_C_FLAGS", builder.cflags(target, GitRepo::Llvm).join(" "));
let mut cflags = builder.cflags(target, GitRepo::Llvm).join(" ");
if let Some(ref s) = builder.config.llvm_cxxflags {
cflags.push_str(&format!(" {}", s));
}
cfg.define("CMAKE_C_FLAGS", cflags);
let mut cxxflags = builder.cflags(target, GitRepo::Llvm).join(" ");
if builder.config.llvm_static_stdcpp &&
!target.contains("windows") &&
!target.contains("netbsd")
{
cxxflags.push_str(" -static-libstdc++");
}
if let Some(ref s) = builder.config.llvm_cxxflags {
cxxflags.push_str(&format!(" {}", s));
}
cfg.define("CMAKE_CXX_FLAGS", cxxflags);
if let Some(ar) = builder.ar(target) {
if ar.is_absolute() {
@@ -383,6 +390,12 @@ fn configure_cmake(builder: &Builder,
}
}

if let Some(ref s) = builder.config.llvm_ldflags {
cfg.define("CMAKE_SHARED_LINKER_FLAGS", s);
cfg.define("CMAKE_MODULE_LINKER_FLAGS", s);
cfg.define("CMAKE_EXE_LINKER_FLAGS", s);
}

if env::var_os("SCCACHE_ERROR_LOG").is_some() {
cfg.env("RUST_LOG", "sccache=warn");
}
@@ -91,6 +91,8 @@ use self::Ordering::*;
/// For example, let's tweak our previous code a bit:
///
/// ```
/// // The derive implements <BookFormat> == <BookFormat> comparisons
/// #[derive(PartialEq)]
/// enum BookFormat {
/// Paperback,
/// Hardback,
@@ -102,31 +104,34 @@ use self::Ordering::*;
/// format: BookFormat,
/// }
///
/// // Implement <Book> == <BookFormat> comparisons
/// impl PartialEq<BookFormat> for Book {
/// fn eq(&self, other: &BookFormat) -> bool {
/// match (&self.format, other) {
/// (BookFormat::Paperback, BookFormat::Paperback) => true,
/// (BookFormat::Hardback, BookFormat::Hardback) => true,
/// (BookFormat::Ebook, BookFormat::Ebook) => true,
/// (_, _) => false,
/// }
/// self.format == *other
/// }
/// }
///
/// // Implement <BookFormat> == <Book> comparisons
/// impl PartialEq<Book> for BookFormat {
/// fn eq(&self, other: &Book) -> bool {
/// *self == other.format
/// }
/// }
///
/// let b1 = Book { isbn: 3, format: BookFormat::Paperback };
///
/// assert!(b1 == BookFormat::Paperback);
/// assert!(b1 != BookFormat::Ebook);
/// assert!(BookFormat::Ebook != b1);
/// ```
///
/// By changing `impl PartialEq for Book` to `impl PartialEq<BookFormat> for Book`,
/// we've changed what type we can use on the right side of the `==` operator.
/// This lets us use it in the `assert!` statements at the bottom.
/// we allow `BookFormat`s to be compared with `Book`s.
///
/// You can also combine these implementations to let the `==` operator work with
/// two different types:
///
/// ```
/// #[derive(PartialEq)]
/// enum BookFormat {
/// Paperback,
/// Hardback,
@@ -140,12 +145,13 @@ use self::Ordering::*;
///
/// impl PartialEq<BookFormat> for Book {
/// fn eq(&self, other: &BookFormat) -> bool {
/// match (&self.format, other) {
/// (&BookFormat::Paperback, &BookFormat::Paperback) => true,
/// (&BookFormat::Hardback, &BookFormat::Hardback) => true,
/// (&BookFormat::Ebook, &BookFormat::Ebook) => true,
/// (_, _) => false,
/// }
/// self.format == *other
/// }
/// }
///
/// impl PartialEq<Book> for BookFormat {
/// fn eq(&self, other: &Book) -> bool {
/// *self == other.format
/// }
/// }
///
@@ -159,7 +165,7 @@ use self::Ordering::*;
/// let b2 = Book { isbn: 3, format: BookFormat::Ebook };
///
/// assert!(b1 == BookFormat::Paperback);
/// assert!(b1 != BookFormat::Ebook);
/// assert!(BookFormat::Ebook != b1);
/// assert!(b1 == b2);
/// ```
///
@@ -12,24 +12,27 @@ use ::fmt;
/// and `*mut c_void` is equivalent to C's `void*`. That said, this is
/// *not* the same as C's `void` return type, which is Rust's `()` type.
///
/// Ideally, this type would be equivalent to [`!`], but currently it may
/// be more ideal to use `c_void` for FFI purposes.
/// To model pointers to opaque types in FFI, until `extern type` is
/// stabilized, it is recommended to use a newtype wrapper around an empty
/// byte array. See the [Nomicon] for details.
///
/// [`!`]: ../../std/primitive.never.html
/// [pointer]: ../../std/primitive.pointer.html
/// [Nomicon]: https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs
// N.B., for LLVM to recognize the void pointer type and by extension
// functions like malloc(), we need to have it represented as i8* in
// LLVM bitcode. The enum used here ensures this and prevents misuse
// of the "raw" type by only having private variants.. We need two
// of the "raw" type by only having private variants. We need two
// variants, because the compiler complains about the repr attribute
// otherwise.
// otherwise and we need at least one variant as otherwise the enum
// would be uninhabited and at least dereferencing such pointers would
// be UB.
#[repr(u8)]
#[stable(feature = "raw_os", since = "1.1.0")]
pub enum c_void {
#[unstable(feature = "c_void_variant", reason = "should not have to exist",
#[unstable(feature = "c_void_variant", reason = "temporary implementation detail",
issue = "0")]
#[doc(hidden)] __variant1,
#[unstable(feature = "c_void_variant", reason = "should not have to exist",
#[unstable(feature = "c_void_variant", reason = "temporary implementation detail",
issue = "0")]
#[doc(hidden)] __variant2,
}
@@ -49,7 +52,7 @@ impl fmt::Debug for c_void {
#[unstable(feature = "c_variadic",
reason = "the `c_variadic` feature has not been properly tested on \
all supported platforms",
issue = "27745")]
issue = "44930")]
extern {
type VaListImpl;
}
@@ -74,7 +77,7 @@ impl fmt::Debug for VaListImpl {
#[unstable(feature = "c_variadic",
reason = "the `c_variadic` feature has not been properly tested on \
all supported platforms",
issue = "27745")]
issue = "44930")]
struct VaListImpl {
stack: *mut (),
gr_top: *mut (),
@@ -90,7 +93,7 @@ struct VaListImpl {
#[unstable(feature = "c_variadic",
reason = "the `c_variadic` feature has not been properly tested on \
all supported platforms",
issue = "27745")]
issue = "44930")]
struct VaListImpl {
gpr: u8,
fpr: u8,
@@ -106,7 +109,7 @@ struct VaListImpl {
#[unstable(feature = "c_variadic",
reason = "the `c_variadic` feature has not been properly tested on \
all supported platforms",
issue = "27745")]
issue = "44930")]
struct VaListImpl {
gp_offset: i32,
fp_offset: i32,
@@ -120,7 +123,7 @@ struct VaListImpl {
#[unstable(feature = "c_variadic",
reason = "the `c_variadic` feature has not been properly tested on \
all supported platforms",
issue = "27745")]
issue = "44930")]
#[repr(transparent)]
pub struct VaList<'a>(&'a mut VaListImpl);

@@ -140,7 +143,7 @@ mod sealed_trait {
#[unstable(feature = "c_variadic",
reason = "the `c_variadic` feature has not been properly tested on \
all supported platforms",
issue = "27745")]
issue = "44930")]
pub trait VaArgSafe {}
}

@@ -150,7 +153,7 @@ macro_rules! impl_va_arg_safe {
#[unstable(feature = "c_variadic",
reason = "the `c_variadic` feature has not been properly tested on \
all supported platforms",
issue = "27745")]
issue = "44930")]
impl sealed_trait::VaArgSafe for $t {}
)+
}
@@ -163,20 +166,20 @@ impl_va_arg_safe!{f64}
#[unstable(feature = "c_variadic",
reason = "the `c_variadic` feature has not been properly tested on \
all supported platforms",
issue = "27745")]
issue = "44930")]
impl<T> sealed_trait::VaArgSafe for *mut T {}
#[unstable(feature = "c_variadic",
reason = "the `c_variadic` feature has not been properly tested on \
all supported platforms",
issue = "27745")]
issue = "44930")]
impl<T> sealed_trait::VaArgSafe for *const T {}

impl<'a> VaList<'a> {
/// Advance to the next arg.
#[unstable(feature = "c_variadic",
reason = "the `c_variadic` feature has not been properly tested on \
all supported platforms",
issue = "27745")]
issue = "44930")]
pub unsafe fn arg<T: sealed_trait::VaArgSafe>(&mut self) -> T {
va_arg(self)
}
@@ -185,7 +188,7 @@ impl<'a> VaList<'a> {
#[unstable(feature = "c_variadic",
reason = "the `c_variadic` feature has not been properly tested on \
all supported platforms",
issue = "27745")]
issue = "44930")]
pub unsafe fn copy<F, R>(&self, f: F) -> R
where F: for<'copy> FnOnce(VaList<'copy>) -> R {
#[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"),
@@ -10,9 +10,9 @@ use ops;
use str::FromStr;

macro_rules! impl_nonzero_fmt {
( ( $( $Trait: ident ),+ ) for $Ty: ident ) => {
( #[$stability: meta] ( $( $Trait: ident ),+ ) for $Ty: ident ) => {
$(
#[stable(feature = "nonzero", since = "1.28.0")]
#[$stability]
impl fmt::$Trait for $Ty {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -31,7 +31,7 @@ macro_rules! doc_comment {
}

macro_rules! nonzero_integers {
( $( $Ty: ident($Int: ty); )+ ) => {
( $( #[$stability: meta] $Ty: ident($Int: ty); )+ ) => {
$(
doc_comment! {
concat!("An integer that is known not to equal zero.
@@ -41,10 +41,10 @@ For example, `Option<", stringify!($Ty), ">` is the same size as `", stringify!(
```rust
use std::mem::size_of;
assert_eq!(size_of::<Option<std::num::", stringify!($Ty), ">>(), size_of::<", stringify!($Int),
assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", stringify!($Int),
">());
```"),
#[stable(feature = "nonzero", since = "1.28.0")]
#[$stability]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(transparent)]
#[rustc_layout_scalar_valid_range_start(1)]
@@ -57,14 +57,14 @@ assert_eq!(size_of::<Option<std::num::", stringify!($Ty), ">>(), size_of::<", st
/// # Safety
///
/// The value must not be zero.
#[stable(feature = "nonzero", since = "1.28.0")]
#[$stability]
#[inline]
pub const unsafe fn new_unchecked(n: $Int) -> Self {
$Ty(n)
}

/// Create a non-zero if the given value is not zero.
#[stable(feature = "nonzero", since = "1.28.0")]
#[$stability]
#[inline]
pub fn new(n: $Int) -> Option<Self> {
if n != 0 {
@@ -75,7 +75,7 @@ assert_eq!(size_of::<Option<std::num::", stringify!($Ty), ">>(), size_of::<", st
}

/// Returns the value as a primitive type.
#[stable(feature = "nonzero", since = "1.28.0")]
#[$stability]
#[inline]
pub const fn get(self) -> $Int {
self.0
@@ -91,19 +91,25 @@ assert_eq!(size_of::<Option<std::num::", stringify!($Ty), ">>(), size_of::<", st
}

impl_nonzero_fmt! {
(Debug, Display, Binary, Octal, LowerHex, UpperHex) for $Ty
#[$stability] (Debug, Display, Binary, Octal, LowerHex, UpperHex) for $Ty
}
)+
}
}

nonzero_integers! {
NonZeroU8(u8);
NonZeroU16(u16);
NonZeroU32(u32);
NonZeroU64(u64);
NonZeroU128(u128);
NonZeroUsize(usize);
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU64(u64);
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroU128(u128);
#[stable(feature = "nonzero", since = "1.28.0")] NonZeroUsize(usize);
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI8(i8);
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI16(i16);
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI32(i32);
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI64(i64);
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI128(i128);
#[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize);
}

/// Provides intentionally-wrapped arithmetic on `T`.
Oops, something went wrong.

0 comments on commit fd3f45b

Please sign in to comment.
You can’t perform that action at this time.