Commit Graph

54669 Commits

Author SHA1 Message Date
Scott A Carr
d4551ece5f remove trailing whitespace 2016-06-02 15:40:03 -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
Jonas Schievink
f6a243d231 Add regression test for issue #32829
Closes #32829
2016-06-02 23:58:47 +02:00
Jake Goulding
0eacb9f8f9 Correct issue number in test 2016-06-02 16:03:12 -04: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
Wojciech Nawrocki
8841f26e94 atomic doc: fix statement 2016-06-02 19:36:10 +02: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
Oliver Middleton
cfb4ad2f23 rustdoc: Don't generate empty files for stripped items
We need to traverse stripped modules to generate redirect pages, but we shouldn't generate
anything else for them.

This now renders the file contents to a Vec before writing it to a file in one go. I think
that's probably a better strategy anyway.
2016-06-02 17:49:53 +01: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
Oliver Middleton
8e0baf492a linkchecker: Treat directory links as errors
Directory links don't work well offline so they should be treated as errors.
2016-06-02 14:29:36 +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
Jeffrey Seyfried
daf916bf9a Fix bug in the syntax::config::StripUnconfigured folder 2016-06-02 07:34:19 +00: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
Andrew Brinker
00e77d7489 Rewrote "How Safe and Unsafe Interact" Nomicon chapter.
The previous version of the chapter covered a lot of ground, but was a little
meandering and hard to follow at times. This draft is intended to be clearer
and more direct, while still providing the same information as the previous
version.
2016-06-01 16:13:44 -04: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
Scott A Carr
79bf586d4b switch to BitVector, simplify target_block logic
clarify comments and panic message
2016-06-01 10:23:56 -07: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
Jeffrey Seyfried
dc5cc1b1f2 Run decorators on expanded AST. 2016-06-01 11:12:38 +00: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