Commit Graph

53823 Commits

Author SHA1 Message Date
bors
4fb145867b Auto merge of #33991 - alexcrichton:rustbuild-more-clean, r=aturon
rustbuild: Clean more on `make clean`

Be sure to not use the old build cache for the bootstrap build system nor the
old caches of the compiler/cargo extractions (in case something went wrong).

Closes #33986
2016-06-04 01:23:02 -07:00
bors
7738479d72 Auto merge of #33460 - shepmaster:16-bit-pointers, r=Aatch
Support 16-bit pointers as well as i/usize

I'm opening this pull request to get some feedback from the community.

Although Rust doesn't support any platforms with a native 16-bit pointer at the moment, the [AVR-Rust][ar] fork is working towards that goal. Keeping this forked logic up-to-date with the changes in master has been onerous so I'd like to merge these changes so that they get carried along when refactoring happens. I do not believe this should increase the maintenance burden.

This is based on the original work of Dylan McKay (@dylanmckay).

[ar]: https://github.com/avr-rust/rust
2016-06-03 22:32:15 -07:00
bors
c81c75076c Auto merge of #33803 - WiSaGaN:feature/rename-main-thread, r=alexcrichton
Rename main thread from "<main>" to "main".

Fix issue #33789

We may need to discuss whether this counts as a breaking change since code may check the main thread name against "\<main\>". Discussion is in #33789
2016-06-03 19:36:32 -07:00
bors
7de2e6dc82 Auto merge of #34020 - Stebalien:py-cleanup, r=alexcrichton
Avoid repeated string concatenation in python

While performance isn't really critical here, IMO, format strings are more
readable.

/end nit
2016-06-03 12:37:01 -07:00
bors
1ceaa86e0a Auto merge of #33997 - jseyfried:resolve_in_phase_2, r=nrc
Move name resolution into phase 2

r? @nrc
2016-06-03 08:22:54 -07:00
bors
9552bcdd92 Auto merge of #33861 - Amanieu:lock_elision_fix, r=alexcrichton
Make sure Mutex and RwLock can't be re-locked on the same thread

Fixes #33770

r? @alexcrichton
2016-06-03 04:09:31 -07:00
bors
95206f438f Auto merge of #34016 - sanxiyn:travis-docker, r=brson
Use Docker for Travis

The primary motivtion is to use system LLVM from ubuntu.com, instead of llvm.org.

Travis provides two environments: Ubuntu 12.04 LTS aka precise by default, and Ubuntu 14.04 LTS aka trusty if you specify dist: trusty. According to travis-ci/travis-ci#5821, Ubuntu 16.04 LTS aka xenial is unlikely to be available this year, and Travis recommends to use Docker.

LLVM 3.7 binary for 12.04 and 14.04 is not available from ubuntu.com, that's why we used llvm.org. But LLVM 3.7 binary for 16.04 is available from ubuntu.com, and we can use Docker to run on 16.04.

Fix #34009.
2016-06-03 00:13:38 -07:00
Seo Sanghyeon
b1651fb4d2 Use Docker for Travis 2016-06-03 11:44:30 +09:00
bors
0646e8ae6e Auto merge of #33878 - GuillaumeGomez:improve_helps, r=jonathandturner
Improve help messages for E0425

Fixes #33876.

r? @Manishearth

cc @steveklabnik
cc @jonathandturner
2016-06-02 18:10:37 -07:00
bors
915b003e32 Auto merge of #33894 - nagisa:windows-lack-endurance-for-sprint, r=alexcrichton
Rewrite variadic-ffi pass to use test helper

The sprintf used in this test previously isn’t available on some versions of MSVC.

Fixes #32305

r? @alexcrichton
2016-06-02 15:20:36 -07:00
bors
12d165352c Auto merge of #33583 - luqmana:tri-bool-mir, r=arielb1
MIR: Don't generate 3-armed boolean switch from match.

Fixes #33540.

Snippet from issue:
```Rust
fn foo(x: bool, y: bool) -> u32 {
    match (x, y) {
         (false, _) => 0,
         (_, false) => 1,
         (true, true) => 2,
    }
}
```

Generated MIR:
```
fn foo(arg0: bool, arg1: bool) -> u32 {
    let var0: bool;                      // "x" in scope 1 at 3bbm.rs:17:8: 17:9
    let var1: bool;                      // "y" in scope 1 at 3bbm.rs:17:17: 17:18
    let mut tmp0: (bool, bool);
    let mut tmp1: bool;
    let mut tmp2: bool;
    let mut tmp3: (&'static str, &'static str, u32);
    let mut tmp4: &'static (&'static str, &'static str, u32);

    bb0: {
        var0 = arg0;                     // scope 1 at 3bbm.rs:17:8: 17:9
        var1 = arg1;                     // scope 1 at 3bbm.rs:17:17: 17:18
        tmp1 = var0;                     // scope 5 at 3bbm.rs:18:12: 18:13
        tmp2 = var1;                     // scope 6 at 3bbm.rs:18:15: 18:16
        tmp0 = (tmp1, tmp2);             // scope 4 at 3bbm.rs:18:11: 18:17
        if((tmp0.0: bool)) -> [true: bb4, false: bb1]; // scope 3 at 3bbm.rs:19:10: 19:15
    }

    bb1: {
        return = const 0u32;             // scope 10 at 3bbm.rs:19:23: 19:24
        goto -> bb7;                     // scope 3 at 3bbm.rs:18:5: 22:6
    }

    bb2: {
        return = const 1u32;             // scope 11 at 3bbm.rs:20:23: 20:24
        goto -> bb7;                     // scope 3 at 3bbm.rs:18:5: 22:6
    }

    bb3: {
        return = const 2u32;             // scope 12 at 3bbm.rs:21:25: 21:26
        goto -> bb7;                     // scope 3 at 3bbm.rs:18:5: 22:6
    }

    bb4: {
        if((tmp0.1: bool)) -> [true: bb5, false: bb2]; // scope 3 at 3bbm.rs:20:13: 20:18
    }

    bb5: {
        if((tmp0.0: bool)) -> [true: bb3, false: bb6]; // scope 3 at 3bbm.rs:21:10: 21:14
    }

    bb6: {
        tmp4 = promoted0;                // scope 3 at 3bbm.rs:18:5: 22:6
        core::panicking::panic(tmp4);    // scope 3 at 3bbm.rs:18:5: 22:6
    }

    bb7: {
        return;                          // scope 0 at 3bbm.rs:17:1: 23:2
    }
}
```

Not sure about this approach. I was also thinking maybe just a standalone pass?

cc @arielb1, @nagisa
2016-06-02 10:55:43 -07:00
Simonas Kazlauskas
ed4688c232 Fix the test to use explicit argument types
Hopefully this pacifies the 32bit windows. Apparently there’s an ABI out there that not only allows
non-64 bit variadic arguments, but also has differing ABI for them!

Good thing all variadic functions are unsafe.
2016-06-02 20:09:59 +03:00
Amanieu d'Antras
fc4b356125 Fix rwlock successfully acquiring a write lock after a read lock 2016-06-02 14:34:00 +01:00
Amanieu d'Antras
f3c68a0fdf Add a test to ensure mutexes and rwlocks can't be re-locked 2016-06-02 14:34:00 +01:00
Amanieu d'Antras
960d1b74c5 Don't allow pthread_rwlock_t to recursively lock itself
This is allowed by POSIX and can happen on glibc with processors
that support hardware lock elision.
2016-06-02 13:31:01 +01:00
Amanieu d'Antras
d73f5e65ec Fix undefined behavior when re-locking a mutex from the same thread
The only applies to pthread mutexes. We solve this by creating the
mutex with the PTHREAD_MUTEX_NORMAL type, which guarantees that
re-locking from the same thread will deadlock.
2016-06-02 13:31:01 +01:00
Amanieu d'Antras
eea4f0c248 Update libc to bring in pthread mutex type definitions 2016-06-02 13:31:00 +01:00
bors
b47a442f0b Auto merge of #34034 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 7 pull requests

- Successful merges: #33993, #34013, #34014, #34015, #34019, #34021, #34033
- Failed merges:
2016-06-02 05:28:46 -07:00
ggomez
f4e6f3c186 Improve help messages for E0425 2016-06-02 13:58:21 +02:00
Guillaume Gomez
7399403f38 Rollup merge of #34033 - tshepang:typo, r=GuillaumeGomez
doc: typo
2016-06-02 13:47:08 +02:00
Guillaume Gomez
2c1da5b650 Rollup merge of #34021 - ollie27:book_links_offline, r=steveklabnik
Fix a few links in the book

Links to directories and direct links to doc.rust-lang.org don't work properly
when viewing the docs offline so fix them.

r? @steveklabnik
2016-06-02 13:47:08 +02:00
Guillaume Gomez
083e013086 Rollup merge of #34019 - kennytm:fix-33958, r=steveklabnik
Restore original meaning of std::fs::read_dir's example changed in #33958

`DirEntry.file_type().is_dir()` will not follow symlinks, but the original example (`fs::metadata(&path).is_dir()`) does. Therefore the change in #33958 introduced a subtle difference that now it won't enter linked folders. To preserve the same behavior, we use `Path::is_dir()` instead, which does follow symlink.

(See discussion in the previous PR for detail.)
2016-06-02 13:47:08 +02:00
Guillaume Gomez
320e27dc80 Rollup merge of #34015 - GuillaumeGomez:err-code-tests, r=jonathandturner
Add new error code tests

r? @steveklabnik
2016-06-02 13:47:07 +02:00
Guillaume Gomez
705b613037 Rollup merge of #34014 - GuillaumeGomez:fix-E0165, r=jonathandturner
Fix E0165 code examples

r? @steveklabnik
2016-06-02 13:47:07 +02:00
Guillaume Gomez
82d9103700 Rollup merge of #34013 - kraai:fix-link, r=steveklabnik
Fix broken link name in `bool` documentation
2016-06-02 13:47:07 +02:00
Guillaume Gomez
1d9e713121 Rollup merge of #33993 - oconnor663:filedocs, r=alexcrichton
document that Files close themselves automatically
2016-06-02 13:47:07 +02:00
Tshepang Lekhonkhobe
920129a258 doc: typo 2016-06-02 13:30:26 +02:00
Wangshan Lu
f67c4bb6ce Update cargo version in cargotest 2016-06-02 18:53:40 +08:00
bors
270bd7c897 Auto merge of #33988 - intelfx:hoedown-bump, r=alexcrichton
hoedown: fix trigger of -Werror=misleading-indentation

See rust-lang/hoedown#6.
2016-06-02 01:42:40 -07:00
bors
e752aa8b57 Auto merge of #33947 - xosmig:btree_split_off, r=gereeter
Implement split_off for BTreeMap and BTreeSet (RFC 509)

Fixes #19986 and refactors common with append methods.
It splits the tree with O(log n) operations and then calculates sizes by traversing the lower one.

CC @gereeter
2016-06-01 21:48:32 -07:00
Luqman Aden
a97f6b35ac [MIR] Use If terminator for switches on bools rather than SwitchInt. 2016-06-01 21:02:36 -04:00
bors
728eea7dc1 Auto merge of #33853 - alexcrichton:remove-deprecated, r=aturon
std: Clean out old unstable + deprecated APIs

These should all have been deprecated for at least one cycle, so this commit
cleans them all out.
2016-06-01 15:11:38 -07:00
Jeffrey Seyfried
3fc0407fb3 Remove the dep-info-no-analysis test and fix other fallout. 2016-06-01 19:20:42 +00:00
Jeffrey Seyfried
c52968af8c Move name resolution to phase 2 2016-06-01 19:20:39 +00:00
Jeffrey Seyfried
58d7e1bf70 Remove redundant check_for_macros AST pass. 2016-06-01 18:51:35 +00:00
bors
12d16599d8 Auto merge of #33814 - lambda:rtabort-use-platform-abort, r=alexcrichton
Open code the __fastfail intrinsic for rtabort! on windows

As described https://msdn.microsoft.com/en-us/library/dn774154.aspx

This is a Windows 8+ mechanism for terminating the process quickly,
which degrades to either an access violation or bugcheck in older versions.

I'm not sure this is better the the current mechanism of terminating
with an illegal instruction, but we recently converted unix to
terminate more correctly with SIGABORT, and this *seems* more correct
for windows.

[breaking-change]
2016-06-01 10:21:55 -07:00
Steven Allen
cde72b071c build: avoid repeated string concatenation in python 2016-06-01 12:29:39 -04:00
kennytm
1d7f34538d
Restore original meaning of std::fs::read_dir's example changed in #33958.
DirEntry.file_type().is_dir() will not follow symlinks, but the original
example (fs::metadata(&path).is_dir()) does. Therefore the change in
#33958 introduced a subtle difference that now it won't enter linked
folders. To preserve the same behavior, we use Path::is_dir() instead,
which does follow symlink.
2016-06-02 00:01:53 +08:00
Oliver Middleton
658253d30c Fix a few links in the book
Links to directories and direct links to doc.rust-lang.org don't work properly
when viewing the docs offline so fix them.
2016-06-01 16:53:14 +01:00
Guillaume Gomez
2b80753330 Add new error code tests 2016-06-01 16:30:13 +02:00
Guillaume Gomez
d211cd6550 Close unclosed code example in E0185 2016-06-01 16:17:21 +02:00
Jack O'Connor
df8d5baab7 allow for the future addition of a close method on File 2016-06-01 10:16:45 -04:00
Guillaume Gomez
c34676a7c4 Fix E0165 code examples 2016-06-01 16:02:23 +02:00
bors
c2cab1fd58 Auto merge of #33794 - petrochenkov:sanity, r=nrc
Add AST validation pass and move some checks to it

The purpose of this pass is to catch constructions that fit into AST data structures, but not permitted by the language. As an example, `impl`s don't have visibilities, but for convenience and uniformity with other items they are represented with a structure `Item` which has `Visibility` field.

This pass is intended to run after expansion of macros and syntax extensions (and before lowering to HIR), so it can catch erroneous constructions that were generated by them. This pass allows to remove ad hoc semantic checks from the parser, which can be overruled by syntax extensions and occasionally macros.

The checks can be put here if they are simple, local, don't require results of any complex analysis like name resolution or type checking and maybe don't logically fall into other passes. I expect most of errors generated by this pass to be non-fatal and allowing the compilation to proceed.

I intend to move some more checks to this pass later and maybe extend it with new checks, like, for example, identifier validity. Given that syntax extensions are going to be stabilized in the measurable future, it's important that they would not be able to subvert usual language rules.

In this patch I've added two new checks - a check for labels named `'static` and a check for lifetimes and labels named `'_`. The first one gives a hard error, the second one - a future compatibility warning.
Fixes https://github.com/rust-lang/rust/issues/33059 ([breaking-change])
cc https://github.com/rust-lang/rfcs/pull/1177

r? @nrc
2016-06-01 06:21:53 -07:00
Matt Kraai
68ac3e9ff0 Fix broken link name in bool documentation 2016-06-01 05:32:11 -07:00
bors
806a5535da Auto merge of #34004 - Manishearth:rollup, r=Manishearth
Rollup of 11 pull requests

- Successful merges: #33385, #33606, #33841, #33892, #33896, #33915, #33921, #33967, #33970, #33973, #33977
- Failed merges:
2016-06-01 00:28:44 -07:00
Manish Goregaokar
42e593a540 Rollup merge of #33977 - Ms2ger:create-and-enter, r=nrc
Take the def_map argument to TyCtxt::create_and_enter out of its RefCell.
2016-06-01 12:57:42 +05:30
Manish Goregaokar
86319f7f81 Rollup merge of #33973 - zackmdavis:stable_features_warning_notes_version_stabilized, r=brson
stable features lint warning mentions version stabilized

To accomplish this, we alter the checks in `rustc::middle::stability` to
use the `StabilityLevel` defined in `syntax::attr` (which includes the
version in which the feature was stabilized) rather than the local
`StabilityLevel` in the same module, and make the
`declared_stable_lang_features` field of
`syntax::feature_gate::Features` hold a Vec of feature-name, span
tuples (in analogy to the `declared_lib_features` field) rather than
just spans.

Fixes #33394.

![stable_features_version_lint_before_and_after](https://cloud.githubusercontent.com/assets/1076988/15659237/5d952a3a-267c-11e6-9181-c9e612eefd7d.png)

r? @brson (tagging Brian because he [wrote](https://github.com/rust-lang/rust/pull/21958) the lint)
2016-06-01 12:57:42 +05:30
Manish Goregaokar
e214c3e2da Rollup merge of #33970 - arielb1:normal-type-check, r=eddyb
normalize types in MIR typeck after erasing regions

this fixes the MIR bug @frankmcsherry encountered.

r? @eddyb
2016-06-01 12:57:42 +05:30
Manish Goregaokar
eba82bb569 Rollup merge of #33967 - dsprenkels:enum_pattern_resolve_ice, r=petrochenkov
resolve: record pattern def when `resolve_pattern` returns `Err(true)`

I propose a fix for issue #33293.

In 1a374b8, (pr #33046) fixed the error reporting of a specific case, but the change that was introduced did not make sure that `record_def` was called in all cases, which lead to an ICE in [1].
This change restores the original `else` case, but keeps the changes that were committed in 1a374b8.

[1] `rustc::middle::mem_categorization::MemCategorizationContext::cat_pattern_`
2016-06-01 12:57:42 +05:30