]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoRollup merge of #35610 - JessRudder:33637-doc-update-for-str-representaton, r=stevekl...
Jonathan Turner [Wed, 17 Aug 2016 13:25:24 +0000 (06:25 -0700)]
Rollup merge of #35610 - JessRudder:33637-doc-update-for-str-representaton, r=steveklabnik

Add note to docs for &str that example is to demo internals only

r? @steveklabnik

This adds a note below the &str representation example explaining that the example provided should not be used under normal circumstances..

Would it make sense to point people in the direction of the method(s) they should use instead?  I left it out in the interest of not complicating the documentation, but, there's definitely an argument to be made for adding a bit of guidance in there.

7 years agoRollup merge of #35595 - urschrei:associated_types_docfix, r=steveklabnik
Jonathan Turner [Wed, 17 Aug 2016 13:25:23 +0000 (06:25 -0700)]
Rollup merge of #35595 - urschrei:associated_types_docfix, r=steveklabnik

Clarify type declaration language in Associated Types docs

A small fix for the Associated Types docs

r? @steveklabnik

7 years agoRollup merge of #35415 - silenuss:e0030-formatting, r=jonathandturner
Jonathan Turner [Wed, 17 Aug 2016 13:25:23 +0000 (06:25 -0700)]
Rollup merge of #35415 - silenuss:e0030-formatting, r=jonathandturner

Update compiler error 0030 to use new error format.

Part of #35233,
Addresses #35204

r? @jonathandturner

7 years agoRollup merge of #34370 - steveklabnik:keyword-ref-mention, r=Manishearth
Jonathan Turner [Wed, 17 Aug 2016 13:25:22 +0000 (06:25 -0700)]
Rollup merge of #34370 - steveklabnik:keyword-ref-mention, r=Manishearth

A disclaimer about keywords.

Some people cite this list as "zomg Rust has so many keywords," so make
it clear that these aren't all used by the language today.

7 years agoAuto merge of #35605 - eddyb:substs, r=nikomatsakis
bors [Wed, 17 Aug 2016 05:52:55 +0000 (22:52 -0700)]
Auto merge of #35605 - eddyb:substs, r=nikomatsakis

Remove the ParamSpace separation from formal and actual generics in rustc.

This is the first step towards enabling the typesystem implemented by `rustc` to be extended
(with generic modules, HKT associated types, generics over constants, etc.).

The current implementation splits all formal (`ty::Generics`) and actual (`Substs`) lifetime and type parameters (and even `where` clauses) into 3 "parameter spaces":
* `TypeSpace` for `enum`, `struct`, `trait` and `impl`
* `SelfSpace` for `Self` in a `trait`
* `FnSpace` for functions and methods

For example, in `<X as Trait<A, B>>::method::<T, U>`, the `Substs` are `[[A, B], [X], [T, U]]`.
The representation uses a single `Vec` with 2 indices where it's split into the 3 "parameter spaces".
Such a simplistic approach doesn't scale beyond the Rust 1.0 typesystem, and its existence was mainly motivated by keeping code manipulating generic parameters correct, across all possible situations.

Summary of changes:
* `ty::Generics` are uniformly stored and can be queried with `tcx.lookup_generics(def_id)`
 * the `typeck::collect` changes for this resulted in a function to lazily compute the `ty::Generics` for a local node, given only its `DefId` - this can be further generalized to other kinds of type information
* `ty::Generics` and `ty::GenericPredicates` now contain only their own parameters (or `where` clauses, respectively), and refer to their "parent", forming a linked list
 * right now most items have one level of nesting, only associated items and variants having two
 * in the future, if `<X as mod1<A>::mod2<B>::mod3::Trait<C>>::Assoc<Y>` is supported, it would be represented by item with the path `mod1::mod2::mod3::Trait::Assoc`, and 4 levels of generics: `mod1` with `[A]`, `mod2` with `[B]`, `Trait` with `[X, C]` and `Assoc` with `[Y]`
* `Substs` gets two new APIs for working with arbitrary items:
 * `Substs::for_item(def_id, mk_region, mk_type)` will construct `Substs` expected by the definition `def_id`, calling `mk_region` for lifetime parameters and `mk_type` for type parameters, and it's guaranteed to *always* return `Substs` compatible with `def_id`
 * `substs.rebase_onto(from_base_def_id, to_base_substs)` can be used if `substs` is for an item nested within `from_base_def_id` (e.g. an associated item), to replace the "outer parameters" with `to_base_substs` - for example, you can translate a method's `Substs` between a `trait` and an `impl` (in both directions) if you have the `DefId` of one and `Substs` for the other
* trait objects, without a `Self` in their `Substs`, use *solely* `ExistentialTraitRef` now, letting `TraitRef` assume it *always* has a `Self` present
* both `TraitRef` and `ExistentialTraitRef` get methods which do operations on their `Substs` which are valid only for traits (or trait objects, respectively)
* `Substs` loses its "parameter spaces" distinction, with effectively no code creating `Substs` in an ad-hoc manner, or inspecting them, without knowing what shape they have already

Future plans:
* combine both lifetimes and types in a single `Vec<Kind<'tcx>>` where `Kind` would be a tagged pointer that can be `Ty<'tcx>`, `&'tcx ty::Region` or, in the future, potentially-polymorphic constants
 * this would require some performance investigation, if it implies a lot of dynamic checks
* introduce an abstraction for `(T, Substs)`, where the `Substs` are even more hidden away from code
manipulating it; a precedent for this is `Instance` in trans, which has `T = DefId`; @nikomatsakis also referred to this, as "lazy substitution", when `T = Ty`
* rewrite type pretty-printing to fully take advantage of this to inject actual in the exact places of formal generic parameters in any paths
* extend the set of type-level information (e.g. beyond `ty::Generics`) that can be lazily queried during `typeck` and introduce a way to do those queries from code that can't refer to `typeck` directly
 * this is almost unrelated but is necessary for DAG-shaped recursion between constant evaluation and type-level information, i.e. for implementing generics over constants

r? @nikomatsakis
cc @rust-lang/compiler

cc @nrc Could get any perf numbers ahead of merging this?

7 years agorustc: remove ParamSpace from Substs.
Eduard Burtescu [Wed, 17 Aug 2016 03:32:00 +0000 (06:32 +0300)]
rustc: remove ParamSpace from Substs.

7 years agorustc: split GenericPredicates of a method from its parent predicates.
Eduard Burtescu [Thu, 11 Aug 2016 06:19:42 +0000 (09:19 +0300)]
rustc: split GenericPredicates of a method from its parent predicates.

7 years agorustc: split Generics of a method from its parent Generics.
Eduard Burtescu [Wed, 10 Aug 2016 17:39:09 +0000 (20:39 +0300)]
rustc: split Generics of a method from its parent Generics.

7 years agorustc: remove SelfSpace from ParamSpace.
Eduard Burtescu [Sun, 14 Aug 2016 22:07:09 +0000 (01:07 +0300)]
rustc: remove SelfSpace from ParamSpace.

7 years agorustc: reduce Substs and Generics to a simple immutable API.
Eduard Burtescu [Mon, 8 Aug 2016 20:39:49 +0000 (23:39 +0300)]
rustc: reduce Substs and Generics to a simple immutable API.

7 years agorustc_typeck: use Substs::from_generics instead of manually building them.
Eduard Burtescu [Wed, 17 Aug 2016 01:05:00 +0000 (04:05 +0300)]
rustc_typeck: use Substs::from_generics instead of manually building them.

7 years agorustc: move trait objects from TraitRef to ExistentialTraitRef.
Eduard Burtescu [Thu, 4 Aug 2016 12:52:57 +0000 (15:52 +0300)]
rustc: move trait objects from TraitRef to ExistentialTraitRef.

7 years agorustc: move defaulting's use of &mut Substs from InferCtxt to typeck.
Eduard Burtescu [Wed, 17 Aug 2016 00:56:18 +0000 (03:56 +0300)]
rustc: move defaulting's use of &mut Substs from InferCtxt to typeck.

7 years agorustc: avoid using subst::VecPerParamSpace::{empty,new} directly.
Eduard Burtescu [Tue, 14 Jun 2016 22:40:09 +0000 (01:40 +0300)]
rustc: avoid using subst::VecPerParamSpace::{empty,new} directly.

7 years agorustc: force all raw accesses to VecPerParamSpace through as_full_slice.
Eduard Burtescu [Mon, 13 Jun 2016 17:46:08 +0000 (20:46 +0300)]
rustc: force all raw accesses to VecPerParamSpace through as_full_slice.

7 years agorustc: move the SelfSpace before TypeSpace in Substs.
Eduard Burtescu [Mon, 13 Jun 2016 17:13:37 +0000 (20:13 +0300)]
rustc: move the SelfSpace before TypeSpace in Substs.

7 years agorustc: use Vec instead of VecPerParamSpace for ty::GenericPredicates.
Eduard Burtescu [Mon, 13 Jun 2016 17:10:32 +0000 (20:10 +0300)]
rustc: use Vec instead of VecPerParamSpace for ty::GenericPredicates.

7 years agoAuto merge of #35559 - frewsxcv:slice-iter-as-ref, r=alexcrichton
bors [Wed, 17 Aug 2016 02:44:10 +0000 (19:44 -0700)]
Auto merge of #35559 - frewsxcv:slice-iter-as-ref, r=alexcrichton

Implement `AsRef<[T]>` for `std::slice::Iter`.

`AsRef` is designed for conversions that are "cheap" (as per
the API docs). It is the case that retrieving the underlying
data of `std::slice::Iter` is cheap. In my opinion, there's no
ambiguity about what slice data will be returned, otherwise,
I would be more cautious about implementing `AsRef`.

7 years agoAuto merge of #35538 - cgswords:libproc_macro, r=nrc
bors [Tue, 16 Aug 2016 23:35:10 +0000 (16:35 -0700)]
Auto merge of #35538 - cgswords:libproc_macro, r=nrc

Kicking off libproc_macro

This PR introduces `libproc_macro`, which is currently quite bare-bones (just a few macro construction tools and an initial `quote!` macro).

This PR also introduces a few test cases for it, and an additional `shim` file (at `src/libsyntax/ext/proc_macro_shim.rs` to allow a facsimile usage of Macros 2.0 *today*!

7 years agoAuto merge of #35354 - tomgarcia:covariant-drain, r=alexcrichton
bors [Tue, 16 Aug 2016 20:26:15 +0000 (13:26 -0700)]
Auto merge of #35354 - tomgarcia:covariant-drain, r=alexcrichton

Made vec_deque::Drain, hash_map::Drain, and hash_set::Drain covariant

Fixed the rest of the Drain iterators.

7 years agoProc_macro is alive
cgswords [Thu, 4 Aug 2016 19:20:01 +0000 (12:20 -0700)]
Proc_macro is alive

7 years agoAuto merge of #35637 - japaric:no-builtins-lto, r=alexcrichton
bors [Tue, 16 Aug 2016 17:13:18 +0000 (10:13 -0700)]
Auto merge of #35637 - japaric:no-builtins-lto, r=alexcrichton

exclude `#![no_builtins]` crates from LTO

this prevents intrinsics like `memcpy` from being mis-optimized to
infinite recursive calls when LTO is used.

fixes #31544
closes #35540

---

r? @alexcrichton
cc @Amanieu

7 years agoAdd basic unit test for `std::slice::Iter::as_slice`.
Corey Farwell [Wed, 10 Aug 2016 00:51:47 +0000 (20:51 -0400)]
Add basic unit test for `std::slice::Iter::as_slice`.

7 years agoImplement `AsRef<[T]>` for `std::slice::Iter`.
Corey Farwell [Wed, 10 Aug 2016 00:49:41 +0000 (20:49 -0400)]
Implement `AsRef<[T]>` for `std::slice::Iter`.

`AsRef` is designed for conversions that are "cheap" (as per
the API docs). It is the case that retrieving the underlying
data of `std::slice::Iter` is cheap. In my opinion, there's no
ambiguity about what slice data will be returned, otherwise,
I would be more cautious about implementing `AsRef`.

7 years agoAuto merge of #35617 - jseyfried:fix_unused_cfg_attr_path, r=eddyb
bors [Tue, 16 Aug 2016 13:32:20 +0000 (06:32 -0700)]
Auto merge of #35617 - jseyfried:fix_unused_cfg_attr_path, r=eddyb

Fix incorrect unused import warnings on `cfg_attr`ed `path` attributes

Fixes #35584.
r? @eddyb

7 years agoAuto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis
bors [Tue, 16 Aug 2016 07:12:12 +0000 (00:12 -0700)]
Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis

Implement the `!` type

This implements the never type (`!`) and hides it behind the feature gate `#[feature(never_type)]`. With the feature gate off, things should build as normal (although some error messages may be different). With the gate on, `!` is usable as a type and diverging type variables (ie. types that are unconstrained by anything in the code) will default to `!` instead of `()`.

7 years agotest that a no_builtins crate is passed to the linker
Jorge Aparicio [Mon, 15 Aug 2016 02:56:48 +0000 (21:56 -0500)]
test that a no_builtins crate is passed to the linker

7 years agoAuto merge of #35680 - GuillaumeGomez:err_codes, r=jonathandturner
bors [Mon, 15 Aug 2016 18:35:01 +0000 (11:35 -0700)]
Auto merge of #35680 - GuillaumeGomez:err_codes, r=jonathandturner

Err codes

r? @jonathandturner

7 years agoAuto merge of #35340 - michaelwoerister:incr-comp-cli-args, r=nikomatsakis
bors [Mon, 15 Aug 2016 15:35:18 +0000 (08:35 -0700)]
Auto merge of #35340 - michaelwoerister:incr-comp-cli-args, r=nikomatsakis

Take commandline arguments into account for incr. comp.

Implements the conservative strategy described in https://github.com/rust-lang/rust/issues/33727.

From now one, every time a new commandline option is added, one has to specify if it influences the incremental compilation cache. I've tried to implement this as automatic as possible: One just has to added either the `[TRACKED]` or the `[UNTRACKED]` marker next to the field. The `Options`, `CodegenOptions`, and `DebuggingOptions` definitions in `session::config` show plenty of examples.

The PR removes some cruft from `session::config::Options`, mostly unnecessary copies of flags also present in `DebuggingOptions` or `CodeGenOptions` in the same struct.

One notable removal is the `cfg` field that contained the values passed via `--cfg` commandline arguments. I chose to remove it because (1) its content is only a subset of what later is stored in `hir::Crate::config` and it's pretty likely that reading the cfgs from `Options` would not be what you wanted, and (2) we could not incorporate it into the dep-tracking hash of the `Options` struct because of how the test framework works, leaving us with a piece of untracked but vital data.

It is now recommended (just as before) to access the crate config via the `krate()` method in the HIR map.

Because the `cfg` field is not present in the `Options` struct any more, some methods in the `CompilerCalls` trait now take the crate config as an explicit parameter -- which might constitute a breaking change for plugin authors.

7 years agoA disclaimer about keywords.
Steve Klabnik [Sun, 19 Jun 2016 20:27:37 +0000 (16:27 -0400)]
A disclaimer about keywords.

Some people cite this list as "zomg Rust has so many keywords," so make
it clear that these aren't all used by the language today.

7 years agoAdd new error code tests
Guillaume Gomez [Mon, 15 Aug 2016 11:58:28 +0000 (13:58 +0200)]
Add new error code tests

7 years agoAdd E0394 error explanation
Guillaume Gomez [Mon, 15 Aug 2016 11:57:10 +0000 (13:57 +0200)]
Add E0394 error explanation

7 years agoAuto merge of #35567 - creativcoder:e0261, r=jonathandturner
bors [Mon, 15 Aug 2016 12:12:35 +0000 (05:12 -0700)]
Auto merge of #35567 - creativcoder:e0261, r=jonathandturner

Update E0261 and E0262 to new error format

Fixes #35516 and  #35517 . Part of #35233
r? @jonathandturner

7 years agoUpdate compiler error 0030 to use new error format.
silenuss [Mon, 15 Aug 2016 06:21:13 +0000 (00:21 -0600)]
Update compiler error 0030 to use new error format.

7 years agoFix bug for ! in old trans
Andrew Cann [Mon, 15 Aug 2016 05:32:12 +0000 (13:32 +0800)]
Fix bug for ! in old trans

7 years agoAuto merge of #35638 - ahmedcharles:url, r=alexcrichton
bors [Mon, 15 Aug 2016 04:38:21 +0000 (21:38 -0700)]
Auto merge of #35638 - ahmedcharles:url, r=alexcrichton

Upgrade linkchecker to url 1.2.0.

7 years agorefactor: use CStore::is_no_builtins
Jorge Aparicio [Mon, 15 Aug 2016 02:56:26 +0000 (21:56 -0500)]
refactor: use CStore::is_no_builtins

7 years agoAuto merge of #35427 - cardoe:arm-musl-targets, r=alexcrichton
bors [Mon, 15 Aug 2016 01:36:33 +0000 (18:36 -0700)]
Auto merge of #35427 - cardoe:arm-musl-targets, r=alexcrichton

add GNU make files for arm-unknown-linux-musleabi

For Yocto (Embedded Linux meta distro) Rust is provided via the [meta-rust layer](https://github.com/meta-rust/meta-rust). In this project there have been patches to add `arm-unknown-linux-musleabi`. Rust recently acquired that support via #35060 but only for rustbuild. meta-rust is currently only able to build Rust support with the existing GNU Makefiles. This adds `arm-unknown-linux-musleabi` support to Rust for the GNU Makefiles until meta-rust is able to sort out why using rustbuild does not work for it.

/cc @srwalter @derekstraka @jmesmon @japaric

7 years agoAuto merge of #35666 - eddyb:rollup, r=eddyb
bors [Sun, 14 Aug 2016 22:27:15 +0000 (15:27 -0700)]
Auto merge of #35666 - eddyb:rollup, r=eddyb

Rollup of 30 pull requests

- Successful merges: #34941, #35392, #35444, #35447, #35491, #35533, #35539, #35558, #35573, #35574, #35577, #35586, #35588, #35594, #35596, #35597, #35598, #35606, #35611, #35615, #35616, #35620, #35622, #35640, #35643, #35644, #35646, #35647, #35648, #35661
- Failed merges: #35395, #35415

7 years agoAuto merge of #35409 - eddyb:mir-storage-stmts, r=nikomatsakis
bors [Sun, 14 Aug 2016 19:28:48 +0000 (12:28 -0700)]
Auto merge of #35409 - eddyb:mir-storage-stmts, r=nikomatsakis

[MIR] Add Storage{Live,Dead} statements to emit llvm.lifetime.{start,end}.

Storage live ranges are tracked for all MIR variables and temporaries with a drop scope.
`StorageLive` is lowered to `llvm.lifetime.start` and `StorageDead` to `llvm.lifetime.end`.

There are some improvements possible here, such as:
* pack multiple storage liveness statements by using the index of first local + `u64` bitset
* enforce that locals are not directly accessed outside their storage live range
* shrink storage live ranges for never-borrowed locals to initialization -> last use
* emit storage liveness statements for *all* temporaries
 * however, the remaining ones are *always* SSA immediates, so they'd be noop in MIR trans
 * could have a flag on the temporary that its storage is irrelevant (a la C's old `register`)
   * would also deny borrows if necessary
    * this seems like an overcompliation and with packing & optimizations it may be pointless

Even in the current state, it helps stage2 `rustc` compile `boiler` without overflowing (see #35408).

A later addition fixes #26764 and closes #27372 by emitting `.section` directives for dylib metadata to avoid them being allocated into memory or read as `.note`. For this PR, those bugs were tripping valgrind.

7 years agoRollup merge of #35661 - IvanUkhov:raw-vec, r=alexcrichton
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:53 +0000 (20:29 +0300)]
Rollup merge of #35661 - IvanUkhov:raw-vec, r=alexcrichton

Fix a couple of typos in RawVec

Hi,

The pull request is to fix a couple of typos in `liballoc/raw_vec.rs`.

Regards,
Ivan

7 years agoRollup merge of #35648 - ahmedcharles:pred, r=alexcrichton
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:53 +0000 (20:29 +0300)]
Rollup merge of #35648 - ahmedcharles:pred, r=alexcrichton

Predicates haven't existed in almost 5 years.

This test probably adds negative value other than historical amusement.

7 years agoRollup merge of #35647 - ahmedcharles:spelling, r=alexcrichton
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:53 +0000 (20:29 +0300)]
Rollup merge of #35647 - ahmedcharles:spelling, r=alexcrichton

Ensure that attributes are spelled properly.

7 years agoRollup merge of #35646 - theypsilon:master, r=jonathandturner
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:52 +0000 (20:29 +0300)]
Rollup merge of #35646 - theypsilon:master, r=jonathandturner

E0094 error message updated

Part of #35233
Fixes #35231

r? @jonathandturner

7 years agoRollup merge of #35644 - garekkream:update-E0302-new-error-format, r=jonathandturner
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:52 +0000 (20:29 +0300)]
Rollup merge of #35644 - garekkream:update-E0302-new-error-format, r=jonathandturner

Update E0302 to the new format

Part of #35233.
Fixes #35523.

r? @jonathandturner

7 years agoRollup merge of #35643 - garekkream:update-E0301-new-error-format, r=jonathandturner
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:52 +0000 (20:29 +0300)]
Rollup merge of #35643 - garekkream:update-E0301-new-error-format, r=jonathandturner

Update E0301 to the new format

Part of #35233.
Fixes #35522.

r? @jonathandturner

7 years agoRollup merge of #35640 - ahmedcharles:dead, r=alexcrichton
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:52 +0000 (20:29 +0300)]
Rollup merge of #35640 - ahmedcharles:dead, r=alexcrichton

compiletest: Remove dead code.

7 years agoRollup merge of #35622 - matthew-piziak:convert-docs-typos, r=apasel422
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:52 +0000 (20:29 +0300)]
Rollup merge of #35622 - matthew-piziak:convert-docs-typos, r=apasel422

fix small typos in std::convert documentation

Fix subject-verb agreement in copypasta: "`AsRef` dereference" to
"`AsRef` dereferences".

Formalize "eg" to "e.g." Italicization of common Latin abbreviations
seems to be going out of style in written English, so I left it plain.

7 years agoRollup merge of #35620 - cvubrugier:master, r=Manishearth
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:51 +0000 (20:29 +0300)]
Rollup merge of #35620 - cvubrugier:master, r=Manishearth

book: fix the hidden find() functions in error-handling.md

The hidden find() functions always returns None. Consequently, one of the
examples using find() prints "No file extension found" instead of
"File extension: rs" which is the expected output.

This patch fixes the issue by implementing find() with std::str::find().

Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
7 years agoRollup merge of #35616 - clementmiao:E0067_new_error_format, r=jonathandturner
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:51 +0000 (20:29 +0300)]
Rollup merge of #35616 - clementmiao:E0067_new_error_format, r=jonathandturner

changed E0067 to new error format

Updated E0067 to new error format.
Part of #35233
Fixes #35502

Passes all the tests when running:
`python src/bootstrap/bootstrap.py --step check-cfail --stage 1`

**This seems strange, given that the format for E0067 has been changed.**
It feels like it should fail some unit tests maybe?

Let me know if I'm mistaken. Otherwise I can create a unit test for it.

Thanks for letting me help!

r? @jonathandturner

7 years agoRollup merge of #35615 - clementmiao:E0070_new_error_format, r=jonathandturner
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:51 +0000 (20:29 +0300)]
Rollup merge of #35615 - clementmiao:E0070_new_error_format, r=jonathandturner

Update E0070 to new error format

Updated E0070 to new error format.
Part of #35233
Fixes #35503

Thanks for letting me help!

r? @jonathandturner

7 years agoRollup merge of #35611 - jonathandturner:ptr-helper, r=nikomatsakis
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:51 +0000 (20:29 +0300)]
Rollup merge of #35611 - jonathandturner:ptr-helper, r=nikomatsakis

Improve &-ptr printing

This PR replaces printing `&-ptr` with a more readable description.  To do so it uses a few heuristics.

If the name of the type is unknown, too long (longer than just saying "reference"), or too complex (a type with explicit lifetime annotations), it will instead opt to print either "reference" or "mutable reference", depending on the mutability of the type.

Before:

```
error[E0308]: mismatched types
  --> src/test/compile-fail/issue-7061.rs:14:46
   |
14 |     fn foo(&'a mut self) -> Box<BarStruct> { self }
   |                                              ^^^^ expected box, found &-ptr
   |
   = note: expected type `Box<BarStruct>`
   = note:    found type `&'a mut BarStruct`

error: aborting due to previous error
```

After:

```
error[E0308]: mismatched types
  --> src/test/compile-fail/issue-7061.rs:14:46
   |
14 |     fn foo(&'a mut self) -> Box<BarStruct> { self }
   |                                              ^^^^ expected box, found mutable reference
   |
   = note: expected type `Box<BarStruct>`
   = note:    found type `&'a mut BarStruct`

error: aborting due to previous error
```

7 years agoRollup merge of #35606 - Mark-Simulacrum:no-std-fix, r=brson
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:51 +0000 (20:29 +0300)]
Rollup merge of #35606 - Mark-Simulacrum:no-std-fix, r=brson

Change stabilization version of no_std from 1.0 to 1.6.

I don't know if more than this is needed.

Fixes #35579.

7 years agoRollup merge of #35598 - tshepang:needless-binding, r=steveklabnik
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:50 +0000 (20:29 +0300)]
Rollup merge of #35598 - tshepang:needless-binding, r=steveklabnik

string: remove needless binding

7 years agoRollup merge of #35597 - tshepang:it-is-a-slice, r=steveklabnik
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:50 +0000 (20:29 +0300)]
Rollup merge of #35597 - tshepang:it-is-a-slice, r=steveklabnik

doc: a value of type `&str` is called a "string slice"

7 years agoRollup merge of #35596 - crypto-universe:E0254_style_and_tests, r=jonathandturner
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:50 +0000 (20:29 +0300)]
Rollup merge of #35596 - crypto-universe:E0254_style_and_tests, r=jonathandturner

Add label to E0254

This issue #35513 is a part of #35233.
r? @jonathandturner

7 years agoRollup merge of #35594 - shepmaster:configure-llvm-39, r=alexcrichton
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:50 +0000 (20:29 +0300)]
Rollup merge of #35594 - shepmaster:configure-llvm-39, r=alexcrichton

Allow compiling against a custom LLVM 3.9 installation

7 years agoRollup merge of #35588 - Antti:fix-atomics-docs, r=alexcrichton
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:50 +0000 (20:29 +0300)]
Rollup merge of #35588 - Antti:fix-atomics-docs, r=alexcrichton

Use an existing constant name as an example.

By reading atomics documentation I tried to use `INIT_ATOMIC_BOOL`, which I couldn't find. Turns out it was renamed to `ATOMIC_BOOL_INIT`.

7 years agoRollup merge of #35586 - shyaamsundhar:SqushCom, r=jonathandturner
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:49 +0000 (20:29 +0300)]
Rollup merge of #35586 - shyaamsundhar:SqushCom, r=jonathandturner

E0248, E0267 & E0268 Change into issue format

r? @jonathandturner  Part of #35391, #35519 and #35520. I have squashed all changes into a single commit. Please review the changes.

E0248 Change in issue format

E0267 UT New Format

E0268 UT New Format

E0267 & E0268 New Error Format

7 years agoRollup merge of #35577 - japaric:relax, r=alexcrichton
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:49 +0000 (20:29 +0300)]
Rollup merge of #35577 - japaric:relax, r=alexcrichton

add -mrelax-relocations=no to i686-musl and i586-gnu

I've been experiencing #34978 with these two targets. This applies the
hack in #35178 to these targets as well.

r? @alexcrichton

7 years agoRollup merge of #35574 - badboy:emscripten-test-fixes, r=brson
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:49 +0000 (20:29 +0300)]
Rollup merge of #35574 - badboy:emscripten-test-fixes, r=brson

Emscripten test fixes

This picks up parts of #31623 to disable certain tests that emscripten can't run, as threads/processes are not supported.
I re-applied @tomaka's changes manually, I can rebase those commits with his credentials if he wants.

It also disables jemalloc for emscripten (at least in Rustbuild, I have to check if there is another setting for the same thing in the old makefile approach).

This should not impact anything for normal builds.

7 years agoRollup merge of #35573 - wdv4758h:E0138, r=jonathandturner
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:49 +0000 (20:29 +0300)]
Rollup merge of #35573 - wdv4758h:E0138, r=jonathandturner

Update E0138 to new format

Part of #35233
Fix #35510
r? @jonathandturner

![e0138](https://cloud.githubusercontent.com/assets/2716047/17562415/7200d93c-5f5d-11e6-98ff-e15c29f40e03.png)

Question: How can I only underline the function name ? I have observed the debug output and the struct of item, but I can't find the `Span` for function name. Should I modify the struct I get to save function name's position or there is another way to get it ? (I can only find `Span`s for function attributes, inputs, outputs, blocks)

7 years agoRollup merge of #35558 - lukehinds:master, r=nikomatsakis
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:49 +0000 (20:29 +0300)]
Rollup merge of #35558 - lukehinds:master, r=nikomatsakis

Update error message for E0253 #35512

Fixes #35512. Part of #35233.

7 years agoRollup merge of #35539 - cgswords:ts_concat, r=nrc
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:49 +0000 (20:29 +0300)]
Rollup merge of #35539 - cgswords:ts_concat, r=nrc

Implemented a smarter TokenStream concatenation system

The new algorithm performs 'aggressive compacting' during concatenation as follows:

- If the nodes' combined total total length is less than 32, we copy both of
   them into a new vector and build a new leaf node.
- If one node is an internal node and the other is a 'small' leaf (length<32),
   we recur down the internal node on the appropriate side.
 - Otherwise, we construct a new internal node that points to them as left and
 right.

This should produce notably better behavior than the current concatenation implementation.

7 years agoRollup merge of #35533 - frewsxcv:22984, r=brson
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:48 +0000 (20:29 +0300)]
Rollup merge of #35533 - frewsxcv:22984, r=brson

Add regression test for #22894.

None

7 years agoRollup merge of #35491 - sanxiyn:pub-restricted-span, r=nikomatsakis
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:48 +0000 (20:29 +0300)]
Rollup merge of #35491 - sanxiyn:pub-restricted-span, r=nikomatsakis

Correct span for pub_restricted field

Fix #35435.

7 years agoRollup merge of #35447 - frewsxcv:vec-into-iter-as-slice, r=alexcrichton
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:48 +0000 (20:29 +0300)]
Rollup merge of #35447 - frewsxcv:vec-into-iter-as-slice, r=alexcrichton

Introduce `as_slice`/`as_mut_slice` methods on `std::vec::IntoIter` struct.

Similar to the `as_slice` method on `core::slice::Iter` struct.

7 years agoRollup merge of #35444 - alexcrichton:optimize-catch-unwind, r=brson
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:48 +0000 (20:29 +0300)]
Rollup merge of #35444 - alexcrichton:optimize-catch-unwind, r=brson

std: Optimize panic::catch_unwind slightly

The previous implementation of this function was overly conservative with
liberal usage of `Option` and `.unwrap()` which in theory never triggers. This
commit essentially removes the `Option`s in favor of unsafe implementations,
improving the code generation of the fast path for LLVM to see through what's
happening more clearly.

cc #34727

7 years agoRollup merge of #35392 - malbarbo:cell-from, r=brson
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:47 +0000 (20:29 +0300)]
Rollup merge of #35392 - malbarbo:cell-from, r=brson

Implement From for Cell, RefCell and UnsafeCell

Considering that `From` is implemented for `Box`, `Rc` and `Arc`, it seems [reasonable](https://internals.rust-lang.org/t/implementing-from-t-for-other-std-types/3744) to implement it for `Cell`, `RefCell` and `UnsafeCell`.

7 years agoRollup merge of #34941 - qolop:patch-2, r=apasel422
Eduard-Mihai Burtescu [Sun, 14 Aug 2016 17:29:47 +0000 (20:29 +0300)]
Rollup merge of #34941 - qolop:patch-2, r=apasel422

Fix typo (privledge->privilege)

7 years agoAuto merge of #34366 - Diggsey:rust-src-pkg, r=brson
bors [Sun, 14 Aug 2016 16:34:18 +0000 (09:34 -0700)]
Auto merge of #34366 - Diggsey:rust-src-pkg, r=brson

Produce source package in rust-installer format

See rust-lang/rust-buildbot#102

There may be a better way to do this, wasn't sure how to clean-up the `rust-src-image` directory when it's used by multiple make rules.

7 years agoAuto merge of #35534 - michaelwoerister:fix-const-collection2, r=nikomatsakis
bors [Sun, 14 Aug 2016 13:42:16 +0000 (06:42 -0700)]
Auto merge of #35534 - michaelwoerister:fix-const-collection2, r=nikomatsakis

Make the translation item collector handle *uses* of 'const' items instead of declarations.

This should fix issue #34754.

7 years agoAuto merge of #34206 - petrochenkov:pipdeny, r=nikomatsakis
bors [Sun, 14 Aug 2016 10:50:50 +0000 (03:50 -0700)]
Auto merge of #34206 - petrochenkov:pipdeny, r=nikomatsakis

Make `private_in_public` compatibility lint deny-by-default

In accordance with the [plan](https://internals.rust-lang.org/t/fcp-for-various-future-compatibility-warnings/3590/5?u=petrochenkov).

r? @nikomatsakis

7 years agoupdated compile-fail tests
Rahul Sharma [Sun, 14 Aug 2016 10:48:58 +0000 (16:18 +0530)]
updated compile-fail tests

7 years agoGet rid of the .note interpretation of rustc dylib metadata.
Eduard Burtescu [Sun, 14 Aug 2016 08:16:28 +0000 (11:16 +0300)]
Get rid of the .note interpretation of rustc dylib metadata.

7 years agoAuto merge of #35453 - jseyfried:hygienize_metavariables, r=nrc
bors [Sun, 14 Aug 2016 06:37:11 +0000 (23:37 -0700)]
Auto merge of #35453 - jseyfried:hygienize_metavariables, r=nrc

macros: Make metavariables hygienic

This PR makes metavariables hygienic. For example, consider:
```rust
macro_rules! foo {
    ($x:tt) => { // Suppose that this token tree argument is always a metavariable.
        macro_rules! bar { ($x:expr, $y:expr) => { ($x, $y) } }
    }
}

fn main() {
    foo!($z); // This currently compiles.
    foo!($y); // This is an error today but compiles after this PR.
}
```
Today, the `macro_rules! bar { ... }` definition is only valid when the metavariable passed to `foo` is not `$y` (since it unhygienically conflicts with the `$y` in the definition of `bar`) or `$x` (c.f. #35450).

After this PR, the definition of `bar` is always valid (and `bar!(a, b)` always expands to `(a, b)` as expected).

This can break code that was allowed in #34925 (landed two weeks ago). For example,
```rust
macro_rules! outer {
    ($t:tt) => {
        macro_rules! inner { ($i:item) => { $t } }
    }
}

outer!($i); // This `$i` should not interact with the `$i` in the definition of `inner!`.
inner!(fn main() {}); // After this PR, this is an error ("unknown macro variable `i`").
```

Due to the severe limitations on nested `macro_rules!` before #34925, this is not a breaking change for stable/beta.

Fixes #35450.

r? @nrc

7 years agoFix a couple of typos in RawVec
Ivan Ukhov [Sun, 14 Aug 2016 04:59:43 +0000 (06:59 +0200)]
Fix a couple of typos in RawVec

7 years ago[MIR] Add Storage{Live,Dead} statements to emit llvm.lifetime.{start,end}.
Eduard Burtescu [Sun, 14 Aug 2016 03:34:14 +0000 (06:34 +0300)]
[MIR] Add Storage{Live,Dead} statements to emit llvm.lifetime.{start,end}.

7 years agoFix make-tidy lock file checks
Diggory Blake [Sat, 13 Aug 2016 21:36:04 +0000 (22:36 +0100)]
Fix make-tidy lock file checks

7 years agoAdd regression test.
Jeffrey Seyfried [Fri, 12 Aug 2016 08:30:48 +0000 (08:30 +0000)]
Add regression test.

7 years agoAllow attributes to be marked used before `cfg` proccessing.
Jeffrey Seyfried [Fri, 12 Aug 2016 08:15:40 +0000 (08:15 +0000)]
Allow attributes to be marked used before `cfg` proccessing.

7 years agoAuto merge of #35414 - jupp0r:feature/test-threads-flag, r=alexcrichton
bors [Sat, 13 Aug 2016 16:52:49 +0000 (09:52 -0700)]
Auto merge of #35414 - jupp0r:feature/test-threads-flag, r=alexcrichton

Add --test-threads option to test binaries

This change allows parallelism of test runs to be specified by a
command line flag names --test-threads in addition to the existing
environment variable RUST_TEST_THREADS. Fixes #25636.

7 years agoRemove diagnostic E0166
Andrew Cann [Sat, 13 Aug 2016 16:30:05 +0000 (00:30 +0800)]
Remove diagnostic E0166

7 years agoFix bug in PostExpansionVisitor
Andrew Cann [Sat, 13 Aug 2016 10:02:13 +0000 (18:02 +0800)]
Fix bug in PostExpansionVisitor

7 years agoFix build after rebase
Andrew Cann [Sat, 13 Aug 2016 06:13:39 +0000 (14:13 +0800)]
Fix build after rebase

7 years agoImprove comments on ! tests
Andrew Cann [Thu, 11 Aug 2016 18:59:19 +0000 (02:59 +0800)]
Improve comments on ! tests

7 years agoFix `make tidy`
Andrew Cann [Thu, 11 Aug 2016 17:42:24 +0000 (01:42 +0800)]
Fix `make tidy`

7 years agoAdd explanations to tests
Andrew Cann [Thu, 11 Aug 2016 17:22:34 +0000 (01:22 +0800)]
Add explanations to tests

7 years agoPermit `! as T` with test
Andrew Cann [Thu, 11 Aug 2016 11:28:52 +0000 (19:28 +0800)]
Permit `! as T` with test

7 years agoAdd another test for !
Andrew Cann [Thu, 11 Aug 2016 11:28:28 +0000 (19:28 +0800)]
Add another test for !

7 years agoAdd tests for ! type
Andrew Cann [Thu, 11 Aug 2016 09:06:39 +0000 (17:06 +0800)]
Add tests for ! type

7 years agoAdd some tests for ! type
Andrew Cann [Wed, 10 Aug 2016 14:22:45 +0000 (22:22 +0800)]
Add some tests for ! type

7 years agoRevert Ty::is_uninhabited to its original state
Andrew Cann [Wed, 3 Aug 2016 06:34:22 +0000 (14:34 +0800)]
Revert Ty::is_uninhabited to its original state

7 years agoMinor fixups based on feedback
Andrew Cann [Wed, 3 Aug 2016 05:59:27 +0000 (13:59 +0800)]
Minor fixups based on feedback

7 years agoAdd run-pass/never_coercions.rs test
Andrew Cann [Wed, 3 Aug 2016 05:58:59 +0000 (13:58 +0800)]
Add run-pass/never_coercions.rs test

7 years agoCorrectly handle AdjustNeverToAny in try_find_coercion_lub
Andrew Cann [Wed, 3 Aug 2016 05:10:39 +0000 (13:10 +0800)]
Correctly handle AdjustNeverToAny in try_find_coercion_lub

7 years agoMinor fixup.
Andrew Cann [Tue, 2 Aug 2016 18:29:14 +0000 (02:29 +0800)]
Minor fixup.

7 years agoLookup node type in map rather than using write_ty_expr
Andrew Cann [Tue, 2 Aug 2016 16:43:19 +0000 (00:43 +0800)]
Lookup node type in map rather than using write_ty_expr

7 years agoDefault diverging types based on feature gate.
Andrew Cann [Tue, 2 Aug 2016 11:56:33 +0000 (19:56 +0800)]
Default diverging types based on feature gate.

Default to either `!` or `()` depending on whether feature(never_type)
is on or not.

7 years agoMinor fix
Andrew Cann [Tue, 2 Aug 2016 08:51:11 +0000 (16:51 +0800)]
Minor fix