]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agorustdoc: Fix a few missing colors in the CSS
Oliver Middleton [Sat, 4 Jun 2016 22:43:24 +0000 (23:43 +0100)]
rustdoc: Fix a few missing colors in the CSS

This adds color to some of the search results and sidebar items which were missing.

8 years agoAuto merge of #33816 - nikomatsakis:projection-cache-2, r=arielb1
bors [Sat, 4 Jun 2016 17:47:55 +0000 (10:47 -0700)]
Auto merge of #33816 - nikomatsakis:projection-cache-2, r=arielb1

Projection cache and better warnings for #32330

This PR does three things:

- it lays the groundwork for the more precise subtyping rules discussed in #32330, but does not enable them;
- it issues warnings when the result of a leak-check or subtyping check relies on a late-bound region which will late become early-bound when #32330 is fixed;
- it introduces a cache for projection in the inference context.

I'm not 100% happy with the approach taken by the cache here, but it seems like a step in the right direction. It results in big wins on some test cases, but not as big as previous versions -- I think because it is caching the `Vec<Obligation>` (whereas before I just returned the normalized type with an empty vector). However, that change was needed to fix an ICE in @alexcrichton's future-rs module (I haven't fully tracked the cause of that ICE yet). Also, because trans/the collector use a fresh inference context for every call to `fulfill_obligation`, they don't profit nearly as much from this cache as they ought to.

Still, here are the results from the future-rs `retry.rs`:

```
06:26 <nmatsakis> time: 6.246; rss: 44MB  item-bodies checking
06:26 <nmatsakis> time: 54.783; rss: 63MB   translation item collection
06:26 <nmatsakis> time: 140.086; rss: 86MB    translation

06:26 <nmatsakis> time: 0.361; rss: 46MB  item-bodies checking
06:26 <nmatsakis> time: 5.299; rss: 63MB    translation item collection
06:26 <nmatsakis> time: 12.140; rss: 86MB translation
```

~~Another example is the example from #31849. For that, I get 34s to run item-bodies without any cache. The version of the cache included here takes 2s to run item-bodies type-checking. An alternative version which doesn't track nested obligations takes 0.2s, but that version ICEs on @alexcrichton's future-rs (and may well be incorrect, I've not fully convinced myself of that). So, a definite win, but I think there's definitely room for further progress.~~

Pushed a modified version which improves performance of the case from #31849:

```
lunch-box. time rustc --stage0 ~/tmp/issue-31849.rs  -Z no-trans
real    0m33.539s
user    0m32.932s
sys     0m0.570s
lunch-box. time rustc --stage2 ~/tmp/issue-31849.rs  -Z no-trans
real    0m0.195s
user    0m0.154s
sys     0m0.042s
```

Some sort of cache is also needed for unblocking further work on lazy normalization, since that will lean even more heavily on the cache, and will also require cycle detection.

r? @arielb1

8 years agoAuto merge of #33998 - nikomatsakis:incr-comp-dep-node-trait, r=mw
bors [Sat, 4 Jun 2016 13:14:57 +0000 (06:14 -0700)]
Auto merge of #33998 - nikomatsakis:incr-comp-dep-node-trait, r=mw

Incr. comp. dep-node for traits, tests

Introduce new tests and also make dep-node for trait selection a bit more selective.

Fixes #33850

r? @michaelwoerister

8 years agoAuto merge of #33991 - alexcrichton:rustbuild-more-clean, r=aturon
bors [Sat, 4 Jun 2016 08:23:02 +0000 (01:23 -0700)]
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

8 years agoAuto merge of #33460 - shepmaster:16-bit-pointers, r=Aatch
bors [Sat, 4 Jun 2016 05:32:15 +0000 (22:32 -0700)]
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

8 years agoAuto merge of #33803 - WiSaGaN:feature/rename-main-thread, r=alexcrichton
bors [Sat, 4 Jun 2016 02:36:32 +0000 (19:36 -0700)]
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

8 years agocorrect misspelled word
Niko Matsakis [Sat, 4 Jun 2016 00:40:44 +0000 (20:40 -0400)]
correct misspelled word

8 years agoavoid extra clone
Niko Matsakis [Sat, 4 Jun 2016 00:39:43 +0000 (20:39 -0400)]
avoid extra clone

8 years agoAuto merge of #34020 - Stebalien:py-cleanup, r=alexcrichton
bors [Fri, 3 Jun 2016 19:37:01 +0000 (12:37 -0700)]
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

8 years agoAuto merge of #33997 - jseyfried:resolve_in_phase_2, r=nrc
bors [Fri, 3 Jun 2016 15:22:54 +0000 (08:22 -0700)]
Auto merge of #33997 - jseyfried:resolve_in_phase_2, r=nrc

Move name resolution into phase 2

r? @nrc

8 years agoAuto merge of #33861 - Amanieu:lock_elision_fix, r=alexcrichton
bors [Fri, 3 Jun 2016 11:09:31 +0000 (04:09 -0700)]
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

8 years agoAuto merge of #34016 - sanxiyn:travis-docker, r=brson
bors [Fri, 3 Jun 2016 07:13:38 +0000 (00:13 -0700)]
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.

8 years agoUse Docker for Travis
Seo Sanghyeon [Wed, 1 Jun 2016 15:14:22 +0000 (00:14 +0900)]
Use Docker for Travis

8 years agoAuto merge of #33878 - GuillaumeGomez:improve_helps, r=jonathandturner
bors [Fri, 3 Jun 2016 01:10:37 +0000 (18:10 -0700)]
Auto merge of #33878 - GuillaumeGomez:improve_helps, r=jonathandturner

Improve help messages for E0425

Fixes #33876.

r? @Manishearth

cc @steveklabnik
cc @jonathandturner

8 years agoAuto merge of #33894 - nagisa:windows-lack-endurance-for-sprint, r=alexcrichton
bors [Thu, 2 Jun 2016 22:20:36 +0000 (15:20 -0700)]
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

8 years agoAuto merge of #33583 - luqmana:tri-bool-mir, r=arielb1
bors [Thu, 2 Jun 2016 17:55:43 +0000 (10:55 -0700)]
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

8 years agoFix the test to use explicit argument types
Simonas Kazlauskas [Thu, 2 Jun 2016 14:18:11 +0000 (17:18 +0300)]
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.

8 years agoFix rwlock successfully acquiring a write lock after a read lock
Amanieu d'Antras [Thu, 26 May 2016 05:32:15 +0000 (06:32 +0100)]
Fix rwlock successfully acquiring a write lock after a read lock

8 years agoAdd a test to ensure mutexes and rwlocks can't be re-locked
Amanieu d'Antras [Thu, 26 May 2016 05:10:43 +0000 (06:10 +0100)]
Add a test to ensure mutexes and rwlocks can't be re-locked

8 years agoDon't allow pthread_rwlock_t to recursively lock itself
Amanieu d'Antras [Wed, 25 May 2016 05:07:54 +0000 (06:07 +0100)]
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.

8 years agoFix undefined behavior when re-locking a mutex from the same thread
Amanieu d'Antras [Wed, 25 May 2016 04:44:28 +0000 (05:44 +0100)]
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.

8 years agoUpdate libc to bring in pthread mutex type definitions
Amanieu d'Antras [Wed, 25 May 2016 04:40:57 +0000 (05:40 +0100)]
Update libc to bring in pthread mutex type definitions

8 years agoAuto merge of #34034 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Thu, 2 Jun 2016 12:28:46 +0000 (05:28 -0700)]
Auto merge of #34034 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 7 pull requests

- Successful merges: #33993, #34013, #34014, #34015, #34019, #34021, #34033
- Failed merges:

8 years agoImprove help messages for E0425
ggomez [Thu, 26 May 2016 13:29:17 +0000 (15:29 +0200)]
Improve help messages for E0425

8 years agoRollup merge of #34033 - tshepang:typo, r=GuillaumeGomez
Guillaume Gomez [Thu, 2 Jun 2016 11:47:08 +0000 (13:47 +0200)]
Rollup merge of #34033 - tshepang:typo, r=GuillaumeGomez

doc: typo

8 years agoRollup merge of #34021 - ollie27:book_links_offline, r=steveklabnik
Guillaume Gomez [Thu, 2 Jun 2016 11:47:08 +0000 (13:47 +0200)]
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

8 years agoRollup merge of #34019 - kennytm:fix-33958, r=steveklabnik
Guillaume Gomez [Thu, 2 Jun 2016 11:47:08 +0000 (13:47 +0200)]
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.)

8 years agoRollup merge of #34015 - GuillaumeGomez:err-code-tests, r=jonathandturner
Guillaume Gomez [Thu, 2 Jun 2016 11:47:07 +0000 (13:47 +0200)]
Rollup merge of #34015 - GuillaumeGomez:err-code-tests, r=jonathandturner

Add new error code tests

r? @steveklabnik

8 years agoRollup merge of #34014 - GuillaumeGomez:fix-E0165, r=jonathandturner
Guillaume Gomez [Thu, 2 Jun 2016 11:47:07 +0000 (13:47 +0200)]
Rollup merge of #34014 - GuillaumeGomez:fix-E0165, r=jonathandturner

Fix E0165 code examples

r? @steveklabnik

8 years agoRollup merge of #34013 - kraai:fix-link, r=steveklabnik
Guillaume Gomez [Thu, 2 Jun 2016 11:47:07 +0000 (13:47 +0200)]
Rollup merge of #34013 - kraai:fix-link, r=steveklabnik

Fix broken link name in `bool` documentation

8 years agoRollup merge of #33993 - oconnor663:filedocs, r=alexcrichton
Guillaume Gomez [Thu, 2 Jun 2016 11:47:07 +0000 (13:47 +0200)]
Rollup merge of #33993 - oconnor663:filedocs, r=alexcrichton

document that Files close themselves automatically

8 years agodoc: typo
Tshepang Lekhonkhobe [Thu, 2 Jun 2016 11:28:24 +0000 (13:28 +0200)]
doc: typo

8 years agoUpdate cargo version in cargotest
Wangshan Lu [Thu, 2 Jun 2016 10:53:40 +0000 (18:53 +0800)]
Update cargo version in cargotest

8 years agoAuto merge of #33988 - intelfx:hoedown-bump, r=alexcrichton
bors [Thu, 2 Jun 2016 08:42:40 +0000 (01:42 -0700)]
Auto merge of #33988 - intelfx:hoedown-bump, r=alexcrichton

hoedown: fix trigger of -Werror=misleading-indentation

See rust-lang/hoedown#6.

8 years agoAuto merge of #33947 - xosmig:btree_split_off, r=gereeter
bors [Thu, 2 Jun 2016 04:48:32 +0000 (21:48 -0700)]
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

8 years ago[MIR] Use If terminator for switches on bools rather than SwitchInt.
Luqman Aden [Sat, 28 May 2016 19:50:33 +0000 (15:50 -0400)]
[MIR] Use If terminator for switches on bools rather than SwitchInt.

8 years agoAuto merge of #33853 - alexcrichton:remove-deprecated, r=aturon
bors [Wed, 1 Jun 2016 22:11:38 +0000 (15:11 -0700)]
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.

8 years agoRemove the `dep-info-no-analysis` test and fix other fallout.
Jeffrey Seyfried [Fri, 27 May 2016 07:02:19 +0000 (07:02 +0000)]
Remove the `dep-info-no-analysis` test and fix other fallout.

8 years agoMove name resolution to phase 2
Jeffrey Seyfried [Wed, 25 May 2016 23:15:23 +0000 (23:15 +0000)]
Move name resolution to phase 2

8 years agoRemove redundant `check_for_macros` AST pass.
Jeffrey Seyfried [Sat, 28 May 2016 20:08:10 +0000 (20:08 +0000)]
Remove redundant `check_for_macros` AST pass.

8 years agoAuto merge of #33814 - lambda:rtabort-use-platform-abort, r=alexcrichton
bors [Wed, 1 Jun 2016 17:21:55 +0000 (10:21 -0700)]
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]

8 years agobuild: avoid repeated string concatenation in python
Steven Allen [Wed, 1 Jun 2016 16:24:41 +0000 (12:24 -0400)]
build: avoid repeated string concatenation in python

8 years agoRestore original meaning of std::fs::read_dir's example changed in #33958.
kennytm [Wed, 1 Jun 2016 16:01:53 +0000 (00:01 +0800)]
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.

8 years agoFix a few links in the book
Oliver Middleton [Wed, 1 Jun 2016 12:32:58 +0000 (13:32 +0100)]
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.

8 years agoAdd new error code tests
Guillaume Gomez [Wed, 1 Jun 2016 14:30:13 +0000 (16:30 +0200)]
Add new error code tests

8 years agoClose unclosed code example in E0185
Guillaume Gomez [Wed, 1 Jun 2016 14:17:21 +0000 (16:17 +0200)]
Close unclosed code example in E0185

8 years agoallow for the future addition of a close method on File
Jack O'Connor [Wed, 1 Jun 2016 14:16:45 +0000 (10:16 -0400)]
allow for the future addition of a close method on File

8 years agoFix E0165 code examples
Guillaume Gomez [Wed, 1 Jun 2016 14:02:23 +0000 (16:02 +0200)]
Fix E0165 code examples

8 years agoAuto merge of #33794 - petrochenkov:sanity, r=nrc
bors [Wed, 1 Jun 2016 13:21:53 +0000 (06:21 -0700)]
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

8 years agoFix broken link name in `bool` documentation
Matt Kraai [Wed, 1 Jun 2016 12:32:11 +0000 (05:32 -0700)]
Fix broken link name in `bool` documentation

8 years agoAuto merge of #34004 - Manishearth:rollup, r=Manishearth
bors [Wed, 1 Jun 2016 07:28:44 +0000 (00:28 -0700)]
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:

8 years agoRollup merge of #33977 - Ms2ger:create-and-enter, r=nrc
Manish Goregaokar [Wed, 1 Jun 2016 07:27:42 +0000 (12:57 +0530)]
Rollup merge of #33977 - Ms2ger:create-and-enter, r=nrc

Take the def_map argument to TyCtxt::create_and_enter out of its RefCell.

8 years agoRollup merge of #33973 - zackmdavis:stable_features_warning_notes_version_stabilized...
Manish Goregaokar [Wed, 1 Jun 2016 07:27:42 +0000 (12:57 +0530)]
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)

8 years agoRollup merge of #33970 - arielb1:normal-type-check, r=eddyb
Manish Goregaokar [Wed, 1 Jun 2016 07:27:42 +0000 (12:57 +0530)]
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

8 years agoRollup merge of #33967 - dsprenkels:enum_pattern_resolve_ice, r=petrochenkov
Manish Goregaokar [Wed, 1 Jun 2016 07:27:42 +0000 (12:57 +0530)]
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_`

8 years agoRollup merge of #33921 - jameysharp:patch-1, r=alexcrichton
Manish Goregaokar [Wed, 1 Jun 2016 07:27:42 +0000 (12:57 +0530)]
Rollup merge of #33921 - jameysharp:patch-1, r=alexcrichton

Inline simple Cursor write calls

Implementing the Write trait for Cursors over slices is so light-weight that under some circumstances multiple writes can be fused into a single instruction. In general I think inlining these functions is a good idea because most of the code can be constant-folded and copy-propagated away.

Closes issue #33916.

r? @alexcrichton

8 years agoRollup merge of #33915 - GuillaumeGomez:err-codes, r=steveklabnik
Manish Goregaokar [Wed, 1 Jun 2016 07:27:41 +0000 (12:57 +0530)]
Rollup merge of #33915 - GuillaumeGomez:err-codes, r=steveklabnik

Add new error code tests

r? @steveklabnik

8 years agoRollup merge of #33896 - strake:next_code_point, r=aturon
Manish Goregaokar [Wed, 1 Jun 2016 07:27:41 +0000 (12:57 +0530)]
Rollup merge of #33896 - strake:next_code_point, r=aturon

make core::str::next_code_point work on arbitrary iterator

8 years agoRollup merge of #33892 - seanmonstar:slice-eq-ptr, r=alexcrichton
Manish Goregaokar [Wed, 1 Jun 2016 07:27:41 +0000 (12:57 +0530)]
Rollup merge of #33892 - seanmonstar:slice-eq-ptr, r=alexcrichton

core: check pointer equality when comparing byte slices

If pointer address and length are the same, it should be the same slice.

In experiments, I've seen that this doesn't happen as often in debug builds, but release builds seem to optimize to using a single pointer more often.

8 years agoRollup merge of #33841 - LeoTestard:macro-sequence-lhs, r=pnkfelix
Manish Goregaokar [Wed, 1 Jun 2016 07:27:41 +0000 (12:57 +0530)]
Rollup merge of #33841 - LeoTestard:macro-sequence-lhs, r=pnkfelix

Reject a LHS formed of a single sequence TT during `macro_rules!` checking.

This was already rejected during expansion. Encountering malformed LHS or RHS during expansion is now considered a bug.

Follow up to #33689.

r? @pnkfelix

Note: this can break code that defines such macros but does not use them.

8 years agoRollup merge of #33606 - tshepang:future-talk, r=brson
Manish Goregaokar [Wed, 1 Jun 2016 07:27:41 +0000 (12:57 +0530)]
Rollup merge of #33606 - tshepang:future-talk, r=brson

doc: format! may or may not handle streams in future

No need to talk about that here

8 years agoRollup merge of #33385 - cheercroaker:doc-correction, r=brson
Manish Goregaokar [Wed, 1 Jun 2016 07:27:40 +0000 (12:57 +0530)]
Rollup merge of #33385 - cheercroaker:doc-correction, r=brson

Mention initial year of publication only for the documentation copyright

I have corrected the "copyright expiration year" that was still 2015 in the documentation copyright notice.

According to #31007 it seems that we could go one step further and simplify the copyright notice to only mention the year of original publication ("Copyright &copy; 2011" in this case).

Let me know if you would prefer this copyright notice to only mention the year of original publication (please make sure that it is really 2011 as stated in the current version of the documentation, and not 2010 like Rust's code) and I'll make the simplification.

8 years agoImplement split_off for BTreeMap and BTreeSet (RFC 509)
Andrey Tonkih [Sun, 29 May 2016 10:30:13 +0000 (13:30 +0300)]
Implement split_off for BTreeMap and BTreeSet (RFC 509)

8 years agoAuto merge of #33141 - tshepang:python-love, r=brson
bors [Wed, 1 Jun 2016 04:37:42 +0000 (21:37 -0700)]
Auto merge of #33141 - tshepang:python-love, r=brson

some Python nits and fixes

8 years agoAuto merge of #33979 - retep998:why-the-long-face, r=alexcrichton
bors [Wed, 1 Jun 2016 01:49:48 +0000 (18:49 -0700)]
Auto merge of #33979 - retep998:why-the-long-face, r=alexcrichton

Attempt to diagnose #33844

https://github.com/rust-lang/rust/issues/33844 is a spurious failure that causes builds to fail due to the linker command sometimes failing with error 206, which means that the command is too long. This PR makes rustc print out the linker arguments in that case so the reason for it being so long can be diagnosed and hopefully fixed.

r? @alexcrichton

8 years agokill some unused imports
Niko Matsakis [Tue, 24 May 2016 00:34:26 +0000 (20:34 -0400)]
kill some unused imports

8 years agoadd def-ids from nominal types into TraitSelect
Niko Matsakis [Sat, 28 May 2016 01:19:11 +0000 (21:19 -0400)]
add def-ids from nominal types into TraitSelect

This way we distinguish, in particular, `Foo: Sized`
and `Bar: Sized`, which fixes #33850.

8 years agoexpand `DepNode::TraitSelect` to include type ids
Niko Matsakis [Thu, 26 May 2016 10:11:16 +0000 (06:11 -0400)]
expand `DepNode::TraitSelect` to include type ids

To handle the general case, we include a vector of def-ids, so that we
can account for things like `(Foo, Bar)` which references both `Foo` and
`Bar`. This means it is not Copy, so re-jigger some APIs to use
borrowing more intelligently.

8 years agoextend type alias test to include a clean rev
Niko Matsakis [Tue, 24 May 2016 19:59:07 +0000 (15:59 -0400)]
extend type alias test to include a clean rev

8 years agoadd a series of tests for changes to structs
Niko Matsakis [Tue, 24 May 2016 19:50:24 +0000 (15:50 -0400)]
add a series of tests for changes to structs

These tests reveal that the edges are in some cases
too strict.

8 years agosome new tests
Niko Matsakis [Sat, 21 May 2016 12:34:18 +0000 (08:34 -0400)]
some new tests

8 years agodo not use fresh regions in return type
Niko Matsakis [Sat, 21 May 2016 12:33:37 +0000 (08:33 -0400)]
do not use fresh regions in return type

This test was abusing #32330; cleanup the code some.

8 years agofallout in tests
Niko Matsakis [Sat, 21 May 2016 12:32:40 +0000 (08:32 -0400)]
fallout in tests

in some cases we give more specific messages or fewer
duplicates, now that we have cache and make fewer region variables

8 years agoadd FIXME to fulfill
Niko Matsakis [Sat, 21 May 2016 12:31:42 +0000 (08:31 -0400)]
add FIXME to fulfill

8 years agoconsult cache in projection
Niko Matsakis [Sat, 21 May 2016 12:30:52 +0000 (08:30 -0400)]
consult cache in projection

8 years agocleanup imports for cache
Niko Matsakis [Sat, 21 May 2016 12:30:29 +0000 (08:30 -0400)]
cleanup imports for cache

8 years agothread vtable-closure obligations to result
Niko Matsakis [Mon, 23 May 2016 23:52:44 +0000 (19:52 -0400)]
thread vtable-closure obligations to result

the vtable.nested obligations were being dropped on the floor.

8 years agochange to use `higher_ranked_match`
Niko Matsakis [Sat, 21 May 2016 12:29:50 +0000 (08:29 -0400)]
change to use `higher_ranked_match`

also, consolidate the return type into from a tuple into a struct
`Progress`

8 years agocreate but do not use a projection cache
Niko Matsakis [Sat, 21 May 2016 12:18:52 +0000 (08:18 -0400)]
create but do not use a projection cache

8 years agoadd a snapshottable hashmap
Niko Matsakis [Sat, 21 May 2016 12:18:09 +0000 (08:18 -0400)]
add a snapshottable hashmap

8 years agoadd a higher-ranked match routine
Niko Matsakis [Sat, 21 May 2016 12:16:07 +0000 (08:16 -0400)]
add a higher-ranked match routine

Currently, when projecting out of a higher-ranked where-clause, we
instantiate all higher-ranked regions with lifetime variables. This is
unnecessary since the language rules ought to guarantee (modulo #32330)
that each of those higher-ranked regions is equated with some regions
from the input types. This routine figures out what those regions are
and just uses them. Also, since #32330 is not fully fixed, it detects
when we may have unconstrained variables and indicates that in its
return value.

8 years agoprojection predicates can be copy
Niko Matsakis [Sat, 21 May 2016 12:15:06 +0000 (08:15 -0400)]
projection predicates can be copy

8 years agoadd trailing comma
Niko Matsakis [Sat, 21 May 2016 12:14:58 +0000 (08:14 -0400)]
add trailing comma

8 years agomake region-param-def encoding more DRY
Niko Matsakis [Sat, 21 May 2016 12:13:56 +0000 (08:13 -0400)]
make region-param-def encoding more DRY

we used to have two separate routines, one in tyencode/tydecode, and one
in encode/decode.

8 years agoremove VerifyRegSubReg and cleanup region infer
Niko Matsakis [Sat, 21 May 2016 12:11:54 +0000 (08:11 -0400)]
remove VerifyRegSubReg and cleanup region infer

We used to make region->region edges part of the verify set, but this
change stores them like other edges, as a full-fledged constraint.
Besides making the code somewhat cleaner, this allows them to be more
easily dropped as part of `pop_skolemized`. This change also refactors
the code a bit to remove some intermediate data structures that are no
longer particular useful (e.g., VarValue).

8 years agoadd trailing comma
Niko Matsakis [Sat, 21 May 2016 09:43:13 +0000 (05:43 -0400)]
add trailing comma

8 years agomore debug dumping in trans
Niko Matsakis [Sat, 21 May 2016 09:43:17 +0000 (05:43 -0400)]
more debug dumping in trans

8 years agomore debug dumping in traits
Niko Matsakis [Sat, 21 May 2016 09:42:27 +0000 (05:42 -0400)]
more debug dumping in traits

8 years agobetter debug dumping with inference variables
Niko Matsakis [Sat, 21 May 2016 09:41:40 +0000 (05:41 -0400)]
better debug dumping with inference variables

8 years agosimplify HR subtyping back to what we did before
Niko Matsakis [Mon, 16 May 2016 23:59:58 +0000 (19:59 -0400)]
simplify HR subtyping back to what we did before

A lot of the refactors, however, seem helpful, so leave those in,
particularly since we may want to make this change in the future.

8 years agowarn if leak-check relies on LBRs that will change
Niko Matsakis [Thu, 21 Apr 2016 09:15:53 +0000 (05:15 -0400)]
warn if leak-check relies on LBRs that will change

When we do a "HR subtype" check, we replace all late-bound regions (LBR)
in the subtype with fresh variables, and skolemize the late-bound
regions in the supertype. If those skolemized regions from the supertype
wind up being super-regions (directly or indirectly) of either

- another skolemized region; or,
- some region that pre-exists the HR subtype check
  - e.g., a region variable that is not one of those created
    to represent bound regions in the subtype

then the subtype check fails.

What will change when we fix #32330 is that some of the LBR in the
subtype may become early-bound. In that case, they would no longer be in
the "permitted set" of variables that can be related to a skolemized
type.

So the foundation for this warning is to collect variables that we found
to be related to a skolemized type. For each of them, we have a
`BoundRegion` which carries a `Issue32330` flag. We check whether any of
those flags indicate that this variable was created from a lifetime
that will change from late- to early-bound. If so, we issue a warning
indicating that the results of compilation may change.

This is imperfect, since there are other kinds of code that will not
compile once #32330 is fixed. However, it fixes the errors observed in
practice on crater runs.

8 years agoadd `Issue32330` warning marker to bound regions
Niko Matsakis [Thu, 21 Apr 2016 09:10:10 +0000 (05:10 -0400)]
add `Issue32330` warning marker to bound regions

This indicates whether this `BoundRegion` will change from late to early
bound when issue 32330 is fixed. It also indicates the function on
which the lifetime is declared.

8 years agomake HR algorithms account for region subtyping
Niko Matsakis [Wed, 20 Apr 2016 23:51:56 +0000 (19:51 -0400)]
make HR algorithms account for region subtyping

Currently, we consider region subtyping a failure
if a skolemized lifetime is relatable to any
other lifetime in any way at all. But a more precise
formulation is to say that a skolemized lifetime:

- must not have any *incoming* edges in the region graph
- only has *outgoing* edges to nodes that are `'static`

To enforce the latter requirement, we add edges from `'static -> 'x` for
each lifetime '`x' reachable from a skolemized region.

We now have to add a new `pop_skolemized` routine to do cleanup.
Whereas before if there were *any* edges relating to a skolemized
region, we would return `Err` and hence rollback the transaction, we now
tolerate some edges and return `Ok`. Therefore, the `pop_skolemized`
routine runs and cleans up those edges.

8 years agoadd flag for ReSkolemized
Niko Matsakis [Tue, 15 Mar 2016 12:23:23 +0000 (08:23 -0400)]
add flag for ReSkolemized

8 years agoAuto merge of #33857 - alexcrichton:new-stage0, r=nikomatsakis
bors [Tue, 31 May 2016 23:12:16 +0000 (16:12 -0700)]
Auto merge of #33857 - alexcrichton:new-stage0, r=nikomatsakis

mk: Prepare for a new stage0 compiler

This commit prepares the source for a new stage0 compiler, the 1.10.0 beta
compiler. These artifacts are hot off the bots and should be ready to go.

8 years agomk: Prepare for a new stage0 compiler
Alex Crichton [Tue, 24 May 2016 05:28:15 +0000 (22:28 -0700)]
mk: Prepare for a new stage0 compiler

This commit prepares the source for a new stage0 compiler, the 1.10.0 beta
compiler. These artifacts are hot off the bots and should be ready to go.

8 years agodocument that Files close themselves automatically
Jack O'Connor [Tue, 31 May 2016 21:12:08 +0000 (17:12 -0400)]
document that Files close themselves automatically

8 years agoPrint linker arguments if calling the linker fails
Peter Atashian [Tue, 31 May 2016 20:14:34 +0000 (16:14 -0400)]
Print linker arguments if calling the linker fails
Needed to diagnose https://github.com/rust-lang/rust/issues/33844

Signed-off-by: Peter Atashian <retep998@gmail.com>
8 years agorustbuild: Clean more on `make clean`
Alex Crichton [Tue, 31 May 2016 20:24:28 +0000 (13:24 -0700)]
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

8 years agohoedown: fix trigger of -Werror=misleading-indentation
Ivan Shapovalov [Tue, 31 May 2016 18:33:17 +0000 (21:33 +0300)]
hoedown: fix trigger of -Werror=misleading-indentation