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 18 pull requests #57690

Closed
wants to merge 48 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
5eafae2
Remove confusing comment about ideally using `!` for `c_void`
sdroege Dec 7, 2018
8de8880
Update code comments of `c_void` to explain the reasoning for its cur…
sdroege Dec 10, 2018
96678df
Cleanup PartialEq docs.
frewsxcv Jan 5, 2019
b91d211
Add a target option "merge-functions" taking values in ("disabled",
peterhj Dec 31, 2018
0d3dfdf
Fix compile error
frewsxcv Jan 6, 2019
319a2c1
add missing derive to fix compile error
frewsxcv Jan 6, 2019
bbbabdf
Update cmp.rs
frewsxcv Jan 6, 2019
6c60662
Use correct tracking issue for c_variadic
eqrion Jan 4, 2019
423a5bb
add comment explaining what the derive does
frewsxcv Jan 12, 2019
1445a06
bring back the example i removed, also add symmetry and simplify impl
frewsxcv Jan 12, 2019
0394dce
whitespace
frewsxcv Jan 12, 2019
ebdd072
resolve: Add a test for issue #57539
petrochenkov Jan 12, 2019
c663272
Support passing cflags/cxxflags/ldflags to LLVM build
petrhosek Nov 14, 2018
f4ded5b
Add a regression test for mutating a non-mut #[thread_local]
mjbshaw Dec 24, 2018
e459000
Make privacy checking, intrinsic checking and liveness checking incre…
Zoxc Jun 8, 2018
e301f90
Address comments
Zoxc Jan 14, 2019
8ef7413
Optimize try_mark_green and eliminate the lock on dep node colors
Zoxc Dec 22, 2018
1313678
Address comments
Zoxc Jan 15, 2019
93b5536
use structured macro and path resolve suggestions
euclio Jan 15, 2019
ed717f3
Fix sources sidebar not showing up
GuillaumeGomez Jan 15, 2019
6046be4
fix nested matchers with ?
mark-i-m Jan 14, 2019
dabe86d
update/add tests
mark-i-m Jan 15, 2019
24ca530
Move spin_loop_hint to core::hint module
Dec 19, 2018
feda604
Fixes text becoming invisible when element targetted
GuillaumeGomez Jan 15, 2019
aa1ce32
update test output
mark-i-m Jan 15, 2019
32b2834
demonstrate symmetry
frewsxcv Jan 16, 2019
bd8ee51
Add some links in std::fs.
ehuss Jan 16, 2019
1a51bb8
OSX: fix #57534 registering thread dtors while running thread dtors
mtak- Jan 16, 2019
0772dbb
Fix release manifest generation
Jan 16, 2019
01d0ae9
Prioritize variants as inherent associated items during name resolution
petrochenkov Jan 10, 2019
4d6bd05
Rollup merge of #56594 - sdroege:c_void-is-not-never, r=TimNN
Centril Jan 17, 2019
621b0dd
Rollup merge of #56996 - clarcharr:spin_loop_hint, r=KodrAus
Centril Jan 17, 2019
d552d34
Rollup merge of #57065 - Zoxc:graph-tweaks, r=michaelwoerister
Centril Jan 17, 2019
adf7163
Rollup merge of #57107 - mjbshaw:thread_local_test, r=nikomatsakis
Centril Jan 17, 2019
51cfa49
Rollup merge of #57253 - Zoxc:incr-passes2, r=michaelwoerister
Centril Jan 17, 2019
2fb815c
Rollup merge of #57268 - peterhj:peterhj-optmergefunc, r=nagisa
Centril Jan 17, 2019
9ba024b
Rollup merge of #57340 - eqrion:doc/c_variadic, r=Mark-Simulacrum
Centril Jan 17, 2019
2e4392e
Rollup merge of #57357 - frewsxcv:frewsxcv-partial-eq, r=QuietMisdreavus
Centril Jan 17, 2019
8b38c28
Rollup merge of #57370 - petrhosek:llvm-flags, r=alexcrichton
Centril Jan 17, 2019
fb4ba9a
Rollup merge of #57501 - petrochenkov:highvar, r=alexreg
Centril Jan 17, 2019
f941a92
Rollup merge of #57551 - petrochenkov:regrtest, r=nikomatsakis
Centril Jan 17, 2019
02a1295
Rollup merge of #57610 - mark-i-m:nested-matchers, r=petrochenkov
Centril Jan 17, 2019
d35b6e2
Rollup merge of #57635 - euclio:path-separators, r=michaelwoerister
Centril Jan 17, 2019
bf39858
Rollup merge of #57636 - GuillaumeGomez:fix-sources-sidebar, r=QuietM…
Centril Jan 17, 2019
ff03bcd
Rollup merge of #57646 - GuillaumeGomez:fix-css, r=QuietMisdreavus
Centril Jan 17, 2019
4c9a7c5
Rollup merge of #57654 - ehuss:fs-links, r=alexcrichton
Centril Jan 17, 2019
38a0a02
Rollup merge of #57655 - mtak-:fix-tls-dtors-macos, r=alexcrichton
Centril Jan 17, 2019
a9c7eb4
Rollup merge of #57659 - jethrogb:jb/release-manifest, r=alexcrichton
Centril Jan 17, 2019
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
5 changes: 5 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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>,
}

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

Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
15 changes: 14 additions & 1 deletion src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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");
}
Expand Down
38 changes: 22 additions & 16 deletions src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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
/// }
/// }
///
Expand All @@ -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);
/// ```
///
Expand Down
39 changes: 21 additions & 18 deletions src/libcore/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -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;
}
Expand All @@ -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 (),
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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);

Expand All @@ -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 {}
}

Expand All @@ -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 {}
)+
}
Expand All @@ -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)
}
Expand All @@ -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"),
Expand Down
23 changes: 23 additions & 0 deletions src/libcore/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,26 @@ use intrinsics;
pub unsafe fn unreachable_unchecked() -> ! {
intrinsics::unreachable()
}

/// Save power or switch hyperthreads in a busy-wait spin-loop.
///
/// This function is deliberately more primitive than
/// [`std::thread::yield_now`](../../std/thread/fn.yield_now.html) and
/// does not directly yield to the system's scheduler.
/// In some cases it might be useful to use a combination of both functions.
/// Careful benchmarking is advised.
///
/// On some platforms this function may not do anything at all.
#[inline]
#[unstable(feature = "renamed_spin_loop", issue = "55002")]
pub fn spin_loop() {
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
unsafe {
asm!("pause" ::: "memory" : "volatile");
}

#[cfg(target_arch = "aarch64")]
unsafe {
asm!("yield" ::: "memory" : "volatile");
}
}
12 changes: 3 additions & 9 deletions src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ use intrinsics;
use cell::UnsafeCell;
use fmt;

use hint::spin_loop;

/// Save power or switch hyperthreads in a busy-wait spin-loop.
///
/// This function is deliberately more primitive than
Expand All @@ -96,15 +98,7 @@ use fmt;
#[inline]
#[stable(feature = "spin_loop_hint", since = "1.24.0")]
pub fn spin_loop_hint() {
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
unsafe {
asm!("pause" ::: "memory" : "volatile");
}

#[cfg(target_arch = "aarch64")]
unsafe {
asm!("yield" ::: "memory" : "volatile");
}
spin_loop()
}

/// A boolean type which can be safely shared between threads.
Expand Down
3 changes: 3 additions & 0 deletions src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,9 @@ define_dep_nodes!( <'tcx>
[] CheckModLoops(DefId),
[] CheckModUnstableApiUsage(DefId),
[] CheckModItemTypes(DefId),
[] CheckModPrivacy(DefId),
[] CheckModIntrinsics(DefId),
[] CheckModLiveness(DefId),
[] CollectModItemTypes(DefId),

[] Reachability,
Expand Down
Loading