Skip to content

Rolling up PRs in the queue #17725

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

Merged
merged 62 commits into from
Oct 3, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
293b577
Add missing case for pointer -> int when translating constant cast ex…
bkoropoff Sep 30, 2014
7c9db32
Disallow casting directly between C-like enums and unsafe pointers
bkoropoff Oct 1, 2014
eb8b369
Add regression test for issue #17458
bkoropoff Sep 30, 2014
93408be
Add regression test for issue #17444
bkoropoff Sep 30, 2014
3dc32a1
Fix async assertion in test_sendable_future
lucidd Oct 1, 2014
1dfb23f
librustc/driver: expose build information of rustc.
nodakai Oct 1, 2014
ac956c0
Guide: clarify exporting
jistr Oct 1, 2014
fc818ff
:fire: τ
steveklabnik Oct 1, 2014
ee1cbb9
use similar syntax in all arms
steveklabnik Oct 1, 2014
e2357cf
Don't compare () to null.
steveklabnik Oct 1, 2014
dc35a53
Fix incorrect statement about ok()
steveklabnik Oct 1, 2014
9115a73
Fix `make TAGS.vi` target
bnoordhuis Oct 2, 2014
45fd7cd
Enable a test for .. in range patterns.
nrc Oct 2, 2014
497b635
rm obsolete valgrind suppressions
thestinger Oct 2, 2014
7b3eb43
rm libuv-auto-clean-trigger
thestinger Oct 2, 2014
618e418
remove the uv_support code
thestinger Oct 2, 2014
382f1bc
core: remove raw::GcBox.
eddyb Sep 30, 2014
2487e16
rustrt: remove local_heap implementation.
eddyb Sep 30, 2014
d07cd17
std: remove gc module.
eddyb Sep 30, 2014
8b1d3e6
serialize: remove proxy impls for Gc<T>.
eddyb Sep 30, 2014
fb58109
debug: remove Gc support from Repr.
eddyb Sep 30, 2014
a99e626
syntax: remove unused imports of Gc and GC.
eddyb Sep 30, 2014
d1a57e4
syntax: ast: remove TyBox and UnBox.
eddyb Sep 30, 2014
8a91d33
rustc: remove support for Gc.
eddyb Sep 30, 2014
39de846
rustdoc: remove handling of Gc.
eddyb Sep 30, 2014
aa0b350
docs: remove mentions of Gc.
eddyb Sep 30, 2014
db55e70
syntax: mark the managed_boxes feature as Removed.
eddyb Oct 1, 2014
aa59693
syntax: remove ObsoleteManaged{Type,Expr}.
eddyb Oct 1, 2014
58bea31
tests: remove uses of Gc.
eddyb Oct 2, 2014
4184396
Add lifetime bounds on Items and MutItems.
dschatzberg Sep 4, 2014
f14cb96
Use RawPtr::offset when size_of::<T>() > 0
dschatzberg Sep 4, 2014
0c63a4a
Add tests for MoveItems
dschatzberg Oct 2, 2014
49e593c
Add fixes for new lifetime bounds
dschatzberg Oct 2, 2014
16cca6d
I am bad at math
steveklabnik Oct 2, 2014
85a8b92
extra comment about macros
steveklabnik Oct 2, 2014
8d7274b
alloc: fix reallocate_inplace implementation
thestinger Oct 2, 2014
af633ce
native: fix passing errno to parent after fork
ben0x539 Oct 2, 2014
f2973f6
Fix cross-crate tuple structs in statics
Oct 1, 2014
53cdaa5
std: Help diagnose a flaky test
alexcrichton Oct 2, 2014
52d2f2a
Add tests for a few resolved issues
Oct 2, 2014
cc9347a
travis: Stop building and testing rust
alexcrichton Oct 2, 2014
b58f77e
rollup merge of #17715 : aturon/revert-slice-ops-libs
alexcrichton Oct 2, 2014
4c8d033
rollup merge of #17719 : alexcrichton/diagnose
alexcrichton Oct 2, 2014
8bb5a67
rollup merge of #16993 : dschatzberg/items-bounds
alexcrichton Oct 2, 2014
51820b6
rollup merge of #17646 : bkoropoff/cast-ice
alexcrichton Oct 2, 2014
dd0c786
rollup merge of #17682 : nodakai/librustc-handy-version
alexcrichton Oct 2, 2014
67717b6
rollup merge of #17686 : lucidd/fix
alexcrichton Oct 2, 2014
979f7cd
rollup merge of #17695 : steveklabnik/various_docs
alexcrichton Oct 2, 2014
6ee3c28
rollup merge of #17698 : jistr/guide_export
alexcrichton Oct 2, 2014
d596aa2
rollup merge of #17702 : nick29581/enable-dots-test
alexcrichton Oct 2, 2014
f40767a
rollup merge of #17705 : thestinger/realloc
alexcrichton Oct 2, 2014
182044b
rollup merge of #17706 : thestinger/supp
alexcrichton Oct 2, 2014
6adeb6a
rollup merge of #17708 : bnoordhuis/fix-ctags-makefile-target
alexcrichton Oct 2, 2014
005ae8e
rollup merge of #17717 : steveklabnik/gh17190
alexcrichton Oct 2, 2014
2bb4455
rollup merge of #17720 : ben0x539/shifts
alexcrichton Oct 2, 2014
fba72d3
rollup merge of #17721 : jakub-/resolved-issues
alexcrichton Oct 2, 2014
9998052
rollup merge of #17722 : jakub-/issue-17169
alexcrichton Oct 2, 2014
ebe4da9
rollup merge of #17723 : alexcrichton/travis
alexcrichton Oct 2, 2014
7ae802f
rollup merge of #17666 : eddyb/take-garbage-out
alexcrichton Oct 2, 2014
9ac804e
travis: Stop building and testing rust
alexcrichton Oct 2, 2014
f96ee10
Test fixes from the rollup
alexcrichton Oct 2, 2014
d911936
Merge branch 'travis' into rollup
alexcrichton Oct 2, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
64 changes: 15 additions & 49 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,26 @@
# Use something that's not 'ruby' so we don't set up things like
# RVM/bundler/ruby and whatnot. Right now 'rust' isn't a language on travis and
# it treats unknown languages as ruby-like I believe.
# RVM/bundler/ruby and whatnot. Right now 'rust' as a language actually
# downloads a rust/cargo snapshot, which we don't really want for building rust.
language: c

# Before we start doing anything, install a stock LLVM
# Make sure we've got an up-to-date g++ compiler to get past the LLVM configure
# script.
install:
- sudo sh -c "echo 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.4 main' >> /etc/apt/sources.list"
- sudo sh -c "echo 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main' >> /etc/apt/sources.list"
- sudo sh -c "echo 'deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main' >> /etc/apt/sources.list"
- wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update -qq
- sudo apt-get install -qq --force-yes -y llvm-$LLVM_VERSION
llvm-${LLVM_VERSION}-dev clang-$LLVM_VERSION lldb-$LLVM_VERSION
- sudo apt-get install g++-4.7


# All of the llvm tools are suffixed with "-$VERS" which we don't want, so
# symlink them all into a local directory and just use that
# The test suite is in general way too stressful for travis, especially in
# terms of time limit and reliability. In the past we've tried to scale things
# back to only build the stage1 compiler and run a subset of tests, but this
# didn't end up panning out very well.
#
# FIXME: this shouldn't update the src/llvm sub-repo, that takes about a minute
# it's gotta download so much stuff.
# As a result, we're just using travis to run `make tidy` now. It'll help
# everyone find out about their trailing spaces early on!
before_script:
- mkdir -p local-llvm/bin
- ln -nsf /usr/bin/llvm-config-$LLVM_VERSION local-llvm/bin/llvm-config
- ln -nsf /usr/bin/llvm-mc-$LLVM_VERSION local-llvm/bin/llvm-mc
- ln -nsf /usr/bin/llvm-as-$LLVM_VERSION local-llvm/bin/llvm-as
- ln -nsf /usr/bin/llvm-dis-$LLVM_VERSION local-llvm/bin/llvm-dis
- ln -nsf /usr/bin/llc-$LLVM_VERSION local-llvm/bin/llc
- ln -nsf /usr/include/llvm-$LLVM_VERSION local-llvm/include
- ./configure --disable-optimize-tests --llvm-root=`pwd`/local-llvm
--enable-fast-make --enable-clang

# Tidy everything up first, then build a few things, and then run a few tests.
# Note that this is meant to run in a "fairly small" amount of time, so this
# isn't exhaustive at all.
#
# As a result of https://github.com/travis-ci/travis-ci/issues/1066, we run
# everything in one large command instead of multiple commands.
script: |
if [[ $TRAVIS_PULL_REQUEST != 'false' ]]; then
if [[ $LLVM_VERSION != '3.4' ]]; then exit 0; fi
fi &&
make tidy &&
make -j4 rustc-stage1 RUSTFLAGS='-Z time-passes' &&
make check-stage1-std check-stage1-rpass check-stage1-cfail check-stage1-rfail check-stage1-doc

env:
global:
- NO_BENCH=1
matrix:
- LLVM_VERSION=3.3
- LLVM_VERSION=3.4

# We track this ourselves, and in theory we don't have to update the LLVM repo
# (but sadly we do right now anyway).
git:
submodules: false
- ./configure
script:
- make tidy

notifications:
email: false
Expand Down
2 changes: 1 addition & 1 deletion mk/ctags.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ CTAGS_LOCATIONS=$(patsubst ${CFG_SRC_DIR}src/llvm,, \
$(patsubst ${CFG_SRC_DIR}src/rt/sundown,, \
$(patsubst ${CFG_SRC_DIR}src/rt/vg,, \
$(wildcard ${CFG_SRC_DIR}src/*) $(wildcard ${CFG_SRC_DIR}src/rt/*) \
)))))))))))
)))))))))
CTAGS_OPTS=--options="${CFG_SRC_DIR}src/etc/ctags.rust" --languages=-javascript --recurse ${CTAGS_LOCATIONS}
# We could use `--languages=Rust`, but there is value in producing tags for the
# C++ parts of the code base too (at the time of writing, those are .h and .cpp
Expand Down
3 changes: 1 addition & 2 deletions mk/rt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# that's per-target so you're allowed to conditionally add files based on the
# target.
################################################################################
NATIVE_LIBS := rust_builtin hoedown uv_support morestack miniz context_switch \
NATIVE_LIBS := rust_builtin hoedown morestack miniz context_switch \
rustrt_native rust_test_helpers

# $(1) is the target triple
Expand All @@ -50,7 +50,6 @@ NATIVE_DEPS_hoedown_$(1) := hoedown/src/autolink.c \
hoedown/src/html_smartypants.c \
hoedown/src/stack.c \
hoedown/src/version.c
NATIVE_DEPS_uv_support_$(1) := rust_uv.c
NATIVE_DEPS_miniz_$(1) = miniz.c
NATIVE_DEPS_rust_builtin_$(1) := rust_builtin.c \
rust_android_dummy.c
Expand Down
8 changes: 2 additions & 6 deletions src/doc/guide-lifetimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,21 +305,17 @@ copying.
# Circle(Point, f64), // origin, radius
# Rectangle(Point, Size) // upper-left, dimensions
# }
# static tau: f64 = 6.28;
fn compute_area(shape: &Shape) -> f64 {
match *shape {
Circle(_, radius) => 0.5 * tau * radius * radius,
Circle(_, radius) => std::f64::consts::PI * radius * radius,
Rectangle(_, ref size) => size.w * size.h
}
}
~~~

The first case matches against circles. Here, the pattern extracts the
radius from the shape variant and the action uses it to compute the
area of the circle. (Like any up-to-date engineer, we use the [tau
circle constant][tau] and not that dreadfully outdated notion of pi).

[tau]: http://www.math.utah.edu/~palais/pi.html
area of the circle.

The second match is more interesting. Here we match against a
rectangle and extract its size: but rather than copy the `size`
Expand Down
13 changes: 0 additions & 13 deletions src/doc/guide-pointers.md
Original file line number Diff line number Diff line change
Expand Up @@ -632,19 +632,6 @@ This part is coming soon.

This part is coming soon.

# Gc

The `Gc<T>` type exists for historical reasons, and is [still used
internally](https://github.com/rust-lang/rust/issues/7929) by the compiler.
It is not even a 'real' garbage collected type at the moment.

In the future, Rust may have a real garbage collected type, and so it
has not yet been removed for that reason.

## Best practices

There is currently no legitimate use case for the `Gc<T>` type.

# Raw Pointers

This part is coming soon.
Expand Down
1 change: 0 additions & 1 deletion src/doc/guide-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ list):
* Task synchronization
* Task-local storage
* Logging
* Local heaps (GC heaps)
* Task unwinding

## What is the runtime accomplishing?
Expand Down
4 changes: 1 addition & 3 deletions src/doc/guide-unsafe.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,7 @@ pub struct Unique<T> {
// Implement methods for creating and using the values in the box.

// NB: For simplicity and correctness, we require that T has kind Send
// (owned boxes relax this restriction, and can contain managed (GC) boxes).
// This is because, as implemented, the garbage collector would not know
// about any shared boxes stored in the malloc'd region of memory.
// (owned boxes relax this restriction).
impl<T: Send> Unique<T> {
pub fn new(value: T) -> Unique<T> {
unsafe {
Expand Down
40 changes: 20 additions & 20 deletions src/doc/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,11 @@ The second point is the `println!()` part. This is calling a Rust **macro**,
which is how metaprogramming is done in Rust. If it were a function instead, it
would look like this: `println()`. For our purposes, we don't need to worry
about this difference. Just know that sometimes, you'll see a `!`, and that
means that you're calling a macro instead of a normal function. One last thing
to mention: Rust's macros are significantly different than C macros, if you've
used those. Don't be scared of using macros. We'll get to the details
means that you're calling a macro instead of a normal function. Rust implements
`println!` as a macro rather than a function for good reasons, but that's a
very advanced topic. You'll learn more when we talk about macros later. One
last thing to mention: Rust's macros are significantly different than C macros,
if you've used those. Don't be scared of using macros. We'll get to the details
eventually, you'll just have to trust us for now.

Next, `"Hello, world!"` is a **string**. Strings are a surprisingly complicated
Expand Down Expand Up @@ -659,14 +661,12 @@ error: mismatched types: expected `int` but found `()` (expected int but found (
```

We expected an integer, but we got `()`. `()` is pronounced 'unit', and is a
special type in Rust's type system. `()` is different than `null` in other
languages, because `()` is distinct from other types. For example, in C, `null`
is a valid value for a variable of type `int`. In Rust, `()` is _not_ a valid
value for a variable of type `int`. It's only a valid value for variables of
the type `()`, which aren't very useful. Remember how we said statements don't
return a value? Well, that's the purpose of unit in this case. The semicolon
turns any expression into a statement by throwing away its value and returning
unit instead.
special type in Rust's type system. In Rust, `()` is _not_ a valid value for a
variable of type `int`. It's only a valid value for variables of the type `()`,
which aren't very useful. Remember how we said statements don't return a value?
Well, that's the purpose of unit in this case. The semicolon turns any
expression into a statement by throwing away its value and returning unit
instead.

There's one more time in which you won't see a semicolon at the end of a line
of Rust code. For that, we'll need our next concept: functions.
Expand Down Expand Up @@ -1680,11 +1680,11 @@ just `int`s.

Rust provides a method on these `IoResult<T>`s called `ok()`, which does the
same thing as our `match` statement, but assuming that we have a valid value.
If we don't, it will terminate our program. In this case, if we can't get
input, our program doesn't work, so we're okay with that. In most cases, we
would want to handle the error case explicitly. The result of `ok()` has a
method, `expect()`, which allows us to give an error message if this crash
happens.
We then call `expect()` on the result, which will terminate our program if we
don't have a valid value. In this case, if we can't get input, our program
doesn't work, so we're okay with that. In most cases, we would want to handle
the error case explicitly. `expect()` allows us to give an error message if
this crash happens.

We will cover the exact details of how all of this works later in the Guide.
For now, this gives you enough of a basic understanding to work with.
Expand Down Expand Up @@ -2030,7 +2030,7 @@ fn main() {
match cmp(input, secret_number) {
Less => println!("Too small!"),
Greater => println!("Too big!"),
Equal => { println!("You win!"); },
Equal => println!("You win!"),
}
}

Expand Down Expand Up @@ -2727,7 +2727,8 @@ mod hello {
}
```

This will work:
Usage of the `pub` keyword is sometimes called 'exporting', because
we're making the function available for other modules. This will work:

```{notrust,ignore}
$ cargo run
Expand Down Expand Up @@ -3291,8 +3292,7 @@ use super::times_four;

Because we've made a nested module, we can import functions from the parent
module by using `super`. Sub-modules are allowed to 'see' private functions in
the parent. We sometimes call this usage of `use` a 're-export,' because we're
exporting the name again, somewhere else.
the parent.

We've now covered the basics of testing. Rust's tools are primitive, but they
work well in the simple cases. There are some Rustaceans working on building
Expand Down
2 changes: 1 addition & 1 deletion src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3381,7 +3381,7 @@ fn main() {

```

Patterns can also dereference pointers by using the `&`, `box` or `@` symbols,
Patterns can also dereference pointers by using the `&`, `box` symbols,
as appropriate. For example, these two matches on `x: &int` are equivalent:

```
Expand Down
20 changes: 0 additions & 20 deletions src/etc/x86.supp
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,6 @@
fun:_ZN4llvm4UsernwEjj
}

{
libuv-0-byte-realloc
Memcheck:Leak
fun:malloc
...
fun:*uv_loop_delete*
}

{
race-or-something-ask-pcwalton-0
Memcheck:Value4
Expand Down Expand Up @@ -502,15 +494,3 @@
fun:*
...
}

{
libuv-mac-no-thread-join
Memcheck:Leak
fun:malloc_zone_malloc
fun:_CFRuntimeCreateInstance
fun:CFRunLoopSourceCreate
fun:uv__platform_loop_init
fun:uv__loop_init
fun:uv_loop_new
...
}
36 changes: 27 additions & 9 deletions src/liballoc/heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,15 @@ mod imp {

#[inline]
pub unsafe fn reallocate_inplace(ptr: *mut u8, size: uint, align: uint,
_old_size: uint) -> bool {
old_size: uint) -> bool {
let flags = align_to_flags(align);
je_xallocx(ptr as *mut c_void, size as size_t, 0, flags) == size as size_t
let new_size = je_xallocx(ptr as *mut c_void, size as size_t, 0, flags) as uint;
// checking for failure to shrink is tricky
if size < old_size {
usable_size(size, align) == new_size as uint
} else {
new_size >= size
}
}

#[inline]
Expand Down Expand Up @@ -250,9 +256,9 @@ mod imp {
}

#[inline]
pub unsafe fn reallocate_inplace(_ptr: *mut u8, _size: uint, _align: uint,
_old_size: uint) -> bool {
false
pub unsafe fn reallocate_inplace(_ptr: *mut u8, size: uint, _align: uint,
old_size: uint) -> bool {
size == old_size
}

#[inline]
Expand Down Expand Up @@ -312,9 +318,9 @@ mod imp {
}

#[inline]
pub unsafe fn reallocate_inplace(_ptr: *mut u8, _size: uint, _align: uint,
_old_size: uint) -> bool {
false
pub unsafe fn reallocate_inplace(_ptr: *mut u8, size: uint, _align: uint,
old_size: uint) -> bool {
size == old_size
}

#[inline]
Expand All @@ -335,9 +341,21 @@ mod imp {
}

#[cfg(test)]
mod bench {
mod test {
extern crate test;
use self::test::Bencher;
use heap;

#[test]
fn basic_reallocate_inplace_noop() {
unsafe {
let size = 4000;
let ptr = heap::allocate(size, 8);
let ret = heap::reallocate_inplace(ptr, size, 8, size);
heap::deallocate(ptr, size, 8);
assert!(ret);
}
}

#[bench]
fn alloc_owned_small(b: &mut Bencher) {
Expand Down
1 change: 0 additions & 1 deletion src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ pub use boxed as owned;

pub mod heap;
pub mod libc_heap;
pub mod util;

// Primitive types using the heaps above

Expand Down
8 changes: 0 additions & 8 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,14 +541,6 @@ mod tests {
assert!(y.upgrade().is_none());
}

#[test]
fn gc_inside() {
// see issue #11532
use std::gc::GC;
let a = Rc::new(RefCell::new(box(GC) 1i));
assert!(a.try_borrow_mut().is_some());
}

#[test]
fn weak_self_cyclic() {
struct Cycle {
Expand Down
Loading