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 9 pull requests #41115

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3fb1a84
Add a common Build::src_is_git flag
cuviper Apr 3, 2017
e9cfc30
Only use cargo-vendor if building from git sources
cuviper Apr 3, 2017
4d32ff4
Loosen src_is_git to just check exists()
cuviper Apr 3, 2017
aab2cca
On-demandify reachability
cramertj Mar 27, 2017
b970bc2
Enable appveyor cache, add more paranoia
aidanhs Apr 4, 2017
608e8fe
dist-powerpc-linux: use a pure 32-bit CPU profile
cuviper Apr 5, 2017
631f761
travis: Update musl for i686/x86_64
alexcrichton Apr 5, 2017
f37ca60
First attempt at global_asm! macro
mrhota Mar 16, 2017
df0f15a
Expand _ into explicit variants in match
mrhota Mar 17, 2017
ec680c1
Add new TransItem for global_asm trans
mrhota Mar 21, 2017
9301d16
Remove unused str_style field
mrhota Mar 24, 2017
2d77fe7
Ensure walk_item visits GlobalAsm NodeId
mrhota Mar 30, 2017
8bd182b
Expose LLVM appendModuleInlineAsm
mrhota Mar 22, 2017
b67c1a6
Update unstable book with global_asm feature
mrhota Mar 21, 2017
10cbcd3
Add global_asm tests
mrhota Mar 22, 2017
57bd395
Replace ExpnId with SyntaxContext
mrhota Apr 6, 2017
95bd41e
don't try to blame tuple fields for immutability
arielb1 Apr 6, 2017
b4be475
Fix Markdown issues in the docs
ollie27 Apr 6, 2017
1f93a78
.gitmodules: use the official Git URL w/o redirect
nodakai Apr 6, 2017
99b81e5
Rollup merge of #40702 - mrhota:global_asm, r=nagisa
frewsxcv Apr 6, 2017
d25a6d8
Rollup merge of #40873 - cramertj:on-demandify-queries, r=nikomatsakis
frewsxcv Apr 6, 2017
96ba480
Rollup merge of #41047 - cuviper:src_is_git, r=alexcrichton
frewsxcv Apr 6, 2017
ab29327
Rollup merge of #41075 - aidanhs:aphs-enable-appveyor-cache, r=alexcr…
frewsxcv Apr 6, 2017
88585d7
Rollup merge of #41080 - cuviper:generic-powerpc, r=alexcrichton
frewsxcv Apr 6, 2017
ca047cb
Rollup merge of #41089 - alexcrichton:update-musl, r=brson
frewsxcv Apr 6, 2017
7320e84
Rollup merge of #41108 - arielb1:tuple-blame, r=estebank
frewsxcv Apr 6, 2017
7bc4577
Rollup merge of #41111 - ollie27:docs_markdown_fix, r=GuillaumeGomez
frewsxcv Apr 6, 2017
709f614
Rollup merge of #41114 - nodakai:patch-2, r=petrochenkov
frewsxcv Apr 6, 2017
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
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
url = https://github.com/rust-lang-nursery/reference.git
[submodule "book"]
path = src/doc/book
url = https://github.com/rust-lang/book
url = https://github.com/rust-lang/book.git
7 changes: 5 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,18 @@ install:
- set SCCACHE_ERROR_LOG=%CD%/sccache.log

test_script:
- appveyor-retry sh -c 'git submodule deinit -f . && git submodule update --init'
- if not exist C:\cache\rustsrc\NUL mkdir C:\cache\rustsrc
- sh src/ci/init_repo.sh . /c/cache/rustsrc
- set SRC=.
- set NO_CCACHE=1
- sh src/ci/run.sh

on_failure:
- cat %CD%/sccache.log
- cat %CD%\sccache.log
- cat C:\Users\appveyor\AppData\Local\Temp\1\build-cache-logs\*.log

cache:
- C:\cache\rustsrc
- "build/i686-pc-windows-msvc/llvm -> src/rustllvm/llvm-rebuild-trigger"
- "build/x86_64-pc-windows-msvc/llvm -> src/rustllvm/llvm-rebuild-trigger"
- "i686-pc-windows-msvc/llvm -> src/rustllvm/llvm-rebuild-trigger"
Expand Down
41 changes: 22 additions & 19 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,29 +433,32 @@ pub fn rust_src(build: &Build) {
copy(&build.src.join(item), &dst_src.join(item));
}

// Get cargo-vendor installed, if it isn't already.
let mut has_cargo_vendor = false;
let mut cmd = Command::new(&build.cargo);
for line in output(cmd.arg("install").arg("--list")).lines() {
has_cargo_vendor |= line.starts_with("cargo-vendor ");
}
if !has_cargo_vendor {
// If we're building from git sources, we need to vendor a complete distribution.
if build.src_is_git {
// Get cargo-vendor installed, if it isn't already.
let mut has_cargo_vendor = false;
let mut cmd = Command::new(&build.cargo);
for line in output(cmd.arg("install").arg("--list")).lines() {
has_cargo_vendor |= line.starts_with("cargo-vendor ");
}
if !has_cargo_vendor {
let mut cmd = Command::new(&build.cargo);
cmd.arg("install")
.arg("--force")
.arg("--debug")
.arg("--vers").arg(CARGO_VENDOR_VERSION)
.arg("cargo-vendor")
.env("RUSTC", &build.rustc);
build.run(&mut cmd);
}

// Vendor all Cargo dependencies
let mut cmd = Command::new(&build.cargo);
cmd.arg("install")
.arg("--force")
.arg("--debug")
.arg("--vers").arg(CARGO_VENDOR_VERSION)
.arg("cargo-vendor")
.env("RUSTC", &build.rustc);
cmd.arg("vendor")
.current_dir(&dst_src.join("src"));
build.run(&mut cmd);
}

// Vendor all Cargo dependencies
let mut cmd = Command::new(&build.cargo);
cmd.arg("vendor")
.current_dir(&dst_src.join("src"));
build.run(&mut cmd);

// Create source tarball in rust-installer format
let mut cmd = Command::new(SH_CMD);
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ pub struct Build {
cxx: HashMap<String, gcc::Tool>,
crates: HashMap<String, Crate>,
is_sudo: bool,
src_is_git: bool,
}

#[derive(Debug)]
Expand Down Expand Up @@ -233,6 +234,7 @@ impl Build {
};
let rust_info = channel::GitInfo::new(&src);
let cargo_info = channel::GitInfo::new(&src.join("cargo"));
let src_is_git = src.join(".git").exists();

Build {
flags: flags,
Expand All @@ -251,6 +253,7 @@ impl Build {
lldb_version: None,
lldb_python_dir: None,
is_sudo: is_sudo,
src_is_git: src_is_git,
}
}

Expand Down Expand Up @@ -307,10 +310,7 @@ impl Build {
OutOfSync,
}

if !self.config.submodules {
return
}
if fs::metadata(self.src.join(".git")).is_err() {
if !self.src_is_git || !self.config.submodules {
return
}
let git = || {
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub fn check(build: &mut Build) {

// If we've got a git directory we're gona need git to update
// submodules and learn about various other aspects.
if fs::metadata(build.src.join(".git")).is_ok() {
if build.src_is_git {
need_cmd("git".as_ref());
}

Expand Down
7 changes: 1 addition & 6 deletions src/ci/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,13 @@ For targets: `powerpc-unknown-linux-gnu`
- Path and misc options > Patches origin = Bundled, then local
- Path and misc options > Local patch directory = /tmp/patches
- Target options > Target Architecture = powerpc
- Target options > Emit assembly for CPU = power4 -- (+)
- Target options > Tune for CPU = power6 -- (+)
- Target options > Emit assembly for CPU = powerpc -- pure 32-bit PowerPC
- Operating System > Target OS = linux
- Operating System > Linux kernel version = 2.6.32.68 -- ~RHEL6 kernel
- C-library > glibc version = 2.12.2 -- ~RHEL6 glibc
- C compiler > gcc version = 4.9.3
- C compiler > Core gcc extra config = --with-cpu-32=power4 --with-cpu=default32 -- (+)
- C compiler > gcc extra config = --with-cpu-32=power4 --with-cpu=default32 -- (+)
- C compiler > C++ = ENABLE -- to cross compile LLVM

(+) These CPU options match the configuration of the toolchains in RHEL6.

## `powerpc64-linux-gnu.config`

For targets: `powerpc64-unknown-linux-gnu`
Expand Down
9 changes: 6 additions & 3 deletions src/ci/docker/dist-i586-gnu-i686-musl/build-musl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ set -ex
export CFLAGS="-fPIC -Wa,-mrelax-relocations=no"
export CXXFLAGS="-Wa,-mrelax-relocations=no"

MUSL=musl-1.1.14
MUSL=musl-1.1.16
curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf -
cd $MUSL
CFLAGS="$CFLAGS -m32" ./configure --prefix=/musl-i686 --disable-shared --target=i686
make -j10
CC=gcc \
CFLAGS="$CFLAGS -m32" \
./configure --prefix=/musl-i686 --disable-shared \
--target=i686
make AR=ar RANLIB=ranlib -j10
make install
cd ..

Expand Down
8 changes: 4 additions & 4 deletions src/ci/docker/dist-powerpc-linux/powerpc-linux-gnu.config
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ CT_ARCH_SUPPORTS_WITH_FLOAT=y
CT_ARCH_DEFAULT_BE=y
CT_ARCH_DEFAULT_32=y
CT_ARCH_ABI=""
CT_ARCH_CPU="power4"
CT_ARCH_TUNE="power6"
CT_ARCH_CPU="powerpc"
CT_ARCH_TUNE=""
CT_ARCH_BE=y
# CT_ARCH_LE is not set
CT_ARCH_32=y
Expand Down Expand Up @@ -391,8 +391,8 @@ CT_CC_GCC_HAS_LIBSANITIZER=y
CT_CC_GCC_VERSION="4.9.3"
# CT_CC_LANG_FORTRAN is not set
CT_CC_GCC_ENABLE_CXX_FLAGS=""
CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="--with-cpu-32=power4 --with-cpu=default32"
CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-cpu-32=power4 --with-cpu=default32"
CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY=""
CT_CC_GCC_EXTRA_CONFIG_ARRAY=""
CT_CC_GCC_EXTRA_ENV_ARRAY=""
CT_CC_GCC_STATIC_LIBSTDCXX=y
# CT_CC_GCC_SYSTEM_ZLIB is not set
Expand Down
2 changes: 1 addition & 1 deletion src/ci/docker/dist-x86_64-musl/build-musl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set -ex
export CFLAGS="-fPIC -Wa,-mrelax-relocations=no"
export CXXFLAGS="-Wa,-mrelax-relocations=no"

MUSL=musl-1.1.14
MUSL=musl-1.1.16
curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf -
cd $MUSL
./configure --prefix=/musl-x86_64 --disable-shared
Expand Down
15 changes: 13 additions & 2 deletions src/ci/init_repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,20 @@ fi

# Wipe the cache if it's not valid, or mark it as invalid while we update it
if [ ! -f "$cache_valid_file" ]; then
rm -rf "$CACHE_DIR" && mkdir "$CACHE_DIR"
rm -rf "$CACHE_DIR"
mkdir "$CACHE_DIR"
else
rm "$cache_valid_file"
stat_lines=$(cd "$cache_src_dir" && git status --porcelain | wc -l)
stat_ec=$(cd "$cache_src_dir" && git status >/dev/null 2>&1 && echo $?)
if [ ! -d "$cache_src_dir/.git" -o $stat_lines != 0 -o $stat_ec != 0 ]; then
# Something is badly wrong - the cache valid file is here, but something
# about the git repo is fishy. Nuke it all, just in case
echo "WARNING: $cache_valid_file exists but bad repo: l:$stat_lines, ec:$stat_ec"
rm -rf "$CACHE_DIR"
mkdir "$CACHE_DIR"
else
rm "$cache_valid_file"
fi
fi

# Update the cache (a pristine copy of the rust source master)
Expand Down
1 change: 1 addition & 0 deletions src/doc/unstable-book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
- [future_atomic_orderings](future-atomic-orderings.md)
- [generic_param_attrs](generic-param-attrs.md)
- [get_type_id](get-type-id.md)
- [global_asm](global_asm.md)
- [heap_api](heap-api.md)
- [i128](i128.md)
- [i128_type](i128-type.md)
Expand Down
2 changes: 2 additions & 0 deletions src/doc/unstable-book/src/asm.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,5 @@ constraints, etc.

[llvm-docs]: http://llvm.org/docs/LangRef.html#inline-assembler-expressions

If you need more power and don't mind losing some of the niceties of
`asm!`, check out [global_asm](global_asm.html).
78 changes: 78 additions & 0 deletions src/doc/unstable-book/src/global_asm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# `global_asm`

The tracking issue for this feature is: [#35119]

[#35119]: https://github.com/rust-lang/rust/issues/35119

------------------------

The `global_asm!` macro allows the programmer to write arbitrary
assembly outside the scope of a function body, passing it through
`rustc` and `llvm` to the assembler. The macro is a no-frills
interface to LLVM's concept of [module-level inline assembly]. That is,
all caveats applicable to LLVM's module-level inline assembly apply
to `global_asm!`.

[module-level inline assembly]: http://llvm.org/docs/LangRef.html#module-level-inline-assembly

`global_asm!` fills a role not currently satisfied by either `asm!`
or `#[naked]` functions. The programmer has _all_ features of the
assembler at their disposal. The linker will expect to resolve any
symbols defined in the inline assembly, modulo any symbols marked as
external. It also means syntax for directives and assembly follow the
conventions of the assembler in your toolchain.

A simple usage looks like this:

```rust,ignore
# #![feature(global_asm)]
# you also need relevant target_arch cfgs
global_asm!(include_str!("something_neato.s"));
```

And a more complicated usage looks like this:

```rust,ignore
# #![feature(global_asm)]
# #![cfg(any(target_arch = "x86", target_arch = "x86_64"))]

pub mod sally {
global_asm!(r#"
.global foo
foo:
jmp baz
"#);

#[no_mangle]
pub unsafe extern "C" fn baz() {}
}

// the symbols `foo` and `bar` are global, no matter where
// `global_asm!` was used.
extern "C" {
fn foo();
fn bar();
}

pub mod harry {
global_asm!(r#"
.global bar
bar:
jmp quux
"#);

#[no_mangle]
pub unsafe extern "C" fn quux() {}
}
```

You may use `global_asm!` multiple times, anywhere in your crate, in
whatever way suits you. The effect is as if you concatenated all
usages and placed the larger, single usage in the crate root.

------------------------

If you don't need quite as much power and flexibility as
`global_asm!` provides, and you don't mind restricting your inline
assembly to `fn` bodies only, you might try the [asm](asm.html)
feature instead.
2 changes: 1 addition & 1 deletion src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,7 @@ impl<T: PartialEq> Vec<T> {
/// # Examples
///
/// ```
///# #![feature(vec_remove_item)]
/// # #![feature(vec_remove_item)]
/// let mut vec = vec![1, 2, 3, 1];
///
/// vec.remove_item(&1);
Expand Down
5 changes: 3 additions & 2 deletions src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ unsafe impl<T> Sync for AtomicPtr<T> {}
/// Rust's memory orderings are [the same as
/// LLVM's](http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations).
///
/// For more information see the [nomicon][1].
/// [1]: ../../../nomicon/atomics.html
/// For more information see the [nomicon].
///
/// [nomicon]: ../../../nomicon/atomics.html
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy, Clone, Debug)]
pub enum Ordering {
Expand Down
6 changes: 5 additions & 1 deletion src/librustc/hir/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ pub enum Def {
// Macro namespace
Macro(DefId, MacroKind),

GlobalAsm(DefId),

// Both namespaces
Err,
}
Expand Down Expand Up @@ -144,7 +146,8 @@ impl Def {
Def::Variant(id) | Def::VariantCtor(id, ..) | Def::Enum(id) | Def::TyAlias(id) |
Def::AssociatedTy(id) | Def::TyParam(id) | Def::Struct(id) | Def::StructCtor(id, ..) |
Def::Union(id) | Def::Trait(id) | Def::Method(id) | Def::Const(id) |
Def::AssociatedConst(id) | Def::Local(id) | Def::Upvar(id, ..) | Def::Macro(id, ..) => {
Def::AssociatedConst(id) | Def::Local(id) | Def::Upvar(id, ..) | Def::Macro(id, ..) |
Def::GlobalAsm(id) => {
id
}

Expand Down Expand Up @@ -185,6 +188,7 @@ impl Def {
Def::Label(..) => "label",
Def::SelfTy(..) => "self type",
Def::Macro(..) => "macro",
Def::GlobalAsm(..) => "global asm",
Def::Err => "unresolved item",
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/librustc/hir/intravisit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,9 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
visitor.visit_id(item.id);
walk_list!(visitor, visit_foreign_item, &foreign_module.items);
}
ItemGlobalAsm(_) => {
visitor.visit_id(item.id);
}
ItemTy(ref typ, ref type_parameters) => {
visitor.visit_id(item.id);
visitor.visit_ty(typ);
Expand Down
8 changes: 8 additions & 0 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,13 @@ impl<'a> LoweringContext<'a> {
}
}

fn lower_global_asm(&mut self, ga: &GlobalAsm) -> P<hir::GlobalAsm> {
P(hir::GlobalAsm {
asm: ga.asm,
ctxt: ga.ctxt,
})
}

fn lower_variant(&mut self, v: &Variant) -> hir::Variant {
Spanned {
node: hir::Variant_ {
Expand Down Expand Up @@ -1287,6 +1294,7 @@ impl<'a> LoweringContext<'a> {
}
ItemKind::Mod(ref m) => hir::ItemMod(self.lower_mod(m)),
ItemKind::ForeignMod(ref nm) => hir::ItemForeignMod(self.lower_foreign_mod(nm)),
ItemKind::GlobalAsm(ref ga) => hir::ItemGlobalAsm(self.lower_global_asm(ga)),
ItemKind::Ty(ref t, ref generics) => {
hir::ItemTy(self.lower_ty(t), self.lower_generics(generics))
}
Expand Down
1 change: 1 addition & 0 deletions src/librustc/hir/map/def_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
DefPathData::ValueNs(i.ident.name.as_str()),
ItemKind::MacroDef(..) => DefPathData::MacroDef(i.ident.name.as_str()),
ItemKind::Mac(..) => return self.visit_macro_invoc(i.id, false),
ItemKind::GlobalAsm(..) => DefPathData::Misc,
ItemKind::Use(ref view_path) => {
match view_path.node {
ViewPathGlob(..) => {}
Expand Down
Loading