]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoRollup merge of #22201 - brson:version, r=nick29581
Manish Goregaokar [Sun, 15 Feb 2015 12:52:31 +0000 (18:22 +0530)]
Rollup merge of #22201 - brson:version, r=nick29581

rustc --version says

```
rustc 1.0.0-dev (d0e82a68a 2015-02-05 14:38:56 -0800) (built 2015-02-11)
```

9 years agoRollup merge of #22132 - steveklabnik:gh16645, r=alexcrichton
Manish Goregaokar [Sun, 15 Feb 2015 12:52:31 +0000 (18:22 +0530)]
Rollup merge of #22132 - steveklabnik:gh16645, r=alexcrichton

Fixes #16645

Fixing this in any deeper way will require an RFC, so let's just document the current behavior.

9 years agoAuto merge of #22126 - steveklabnik:gh21281, r=nikomatsakis
bors [Sun, 15 Feb 2015 07:53:07 +0000 (07:53 +0000)]
Auto merge of #22126 - steveklabnik:gh21281, r=nikomatsakis

This is super black magic internals at the moment, but having it
somewhere semi-public seems good. The current versions weren't being
rendered, and they'll be useful for some people.

Fixes #21281

r? @nikomatsakis @kmcallister

9 years agoAuto merge of #22058 - Gankro:all-the-impls, r=huonw
bors [Sun, 15 Feb 2015 03:07:59 +0000 (03:07 +0000)]
Auto merge of #22058 - Gankro:all-the-impls, r=huonw

Working on just knocking these out for all the collections so that there's something there.

9 years agonaive RingBuf::append impl
Alexis [Sat, 7 Feb 2015 17:13:32 +0000 (12:13 -0500)]
naive RingBuf::append impl

9 years agoremove extra mod doc;s
Steve Klabnik [Sat, 14 Feb 2015 17:07:09 +0000 (12:07 -0500)]
remove extra mod doc;s

9 years agoAuto merge of #22158 - Kimundi:the_lonely_uppercase_keyword, r=pnkfelix
bors [Sat, 14 Feb 2015 17:01:11 +0000 (17:01 +0000)]
Auto merge of #22158 - Kimundi:the_lonely_uppercase_keyword, r=pnkfelix

It is only allowed in paths now, where it will either work inside a `trait`
or `impl` item, or not resolve outside of it.

[breaking-change]

Closes #22137

9 years agoAuto merge of #22114 - alexcrichton:issue-22084, r=steveklabnik
bors [Sat, 14 Feb 2015 13:08:33 +0000 (13:08 +0000)]
Auto merge of #22114 - alexcrichton:issue-22084, r=steveklabnik

This ended up just being a forgotten attribute on the `char` module in
libunicode.

Closes #22084

9 years agoAuto merge of #22119 - aturon:new-process, r=alexcrichton
bors [Sat, 14 Feb 2015 10:03:01 +0000 (10:03 +0000)]
Auto merge of #22119 - aturon:new-process, r=alexcrichton

Per [RFC 579](https://github.com/rust-lang/rfcs/pull/579), this commit
adds a new `std::process` module. This module is largely based on the
existing `std::old_io::process` module, but refactors the API to use
`OsStr` and other new standards set out by IO reform.

The existing module is not yet deprecated, to allow for the new API to
get a bit of testing before a mass migration to it.

9 years agoAdd std::process
Aaron Turon [Fri, 6 Feb 2015 17:42:57 +0000 (09:42 -0800)]
Add std::process

Per [RFC 579](https://github.com/rust-lang/rfcs/pull/579), this commit
adds a new `std::process` module. This module is largely based on the
existing `std::old_io::process` module, but refactors the API to use
`OsStr` and other new standards set out by IO reform.

The existing module is not yet deprecated, to allow for the new API to
get a bit of testing before a mass migration to it.

9 years agoAuto merge of #22041 - semarie:configure-compat, r=alexcrichton
bors [Sat, 14 Feb 2015 07:10:52 +0000 (07:10 +0000)]
Auto merge of #22041 - semarie:configure-compat, r=alexcrichton

the sed option `--in-place` (or `-i`) is a GNU extension, and it is not
portable to BSD system (openbsd and freebsd checked).

use an alternate construction in order to keep the semantic.

9 years agoAuto merge of #21834 - genbattle:doc-range-notation, r=steveklabnik
bors [Sat, 14 Feb 2015 03:10:40 +0000 (03:10 +0000)]
Auto merge of #21834 - genbattle:doc-range-notation, r=steveklabnik

Replaced outdated use of the `range(start, end)` function where appropriate with `start..end`, and tweaked the examples to compile and run with the latest rust. I also fixed two periphery compile issues in reference.md which were occluding whether there were any new errors created by these changes.

9 years agoAuto merge of #21376 - fhahn:issue-15881-model-lexer-dotdotdot, r=cmr
bors [Fri, 13 Feb 2015 23:56:40 +0000 (23:56 +0000)]
Auto merge of #21376 - fhahn:issue-15881-model-lexer-dotdotdot, r=cmr

This PR adds a dedicated regression test for #15881 as @cmr suggested.

9 years agoAdd the build date to the reported version. #21957
Brian Anderson [Thu, 12 Feb 2015 00:48:16 +0000 (16:48 -0800)]
Add the build date to the reported version. #21957

rustc --version says

```
rustc 1.0.0-dev (d0e82a68a 2015-02-05) (built 2015-02-11)
```

9 years agoAuto merge of #22200 - alexcrichton:opt-vec-collect, r=huonw
bors [Fri, 13 Feb 2015 21:15:39 +0000 (21:15 +0000)]
Auto merge of #22200 - alexcrichton:opt-vec-collect, r=huonw

This PR is an optimization of the `FromIterator` implementation of `Vec`

Benchmark: https://gist.github.com/alexcrichton/03d666159a28a80e7c70

Before:

    test macro_repeat1     ... bench:        57 ns/iter (+/- 1)
    test macro_repeat2     ... bench:        56 ns/iter (+/- 1)
    test map_clone1        ... bench:       828 ns/iter (+/- 13)
    test map_clone2        ... bench:       828 ns/iter (+/- 8)
    test repeat1           ... bench:      1104 ns/iter (+/- 10)
    test repeat2           ... bench:      1106 ns/iter (+/- 11)

After:

    test macro_repeat1     ... bench:        75 ns/iter (+/- 21)
    test macro_repeat2     ... bench:        59 ns/iter (+/- 31)
    test map_clone1        ... bench:        34 ns/iter (+/- 22)
    test map_clone2        ... bench:        52 ns/iter (+/- 21)
    test repeat1           ... bench:        34 ns/iter (+/- 11)
    test repeat2           ... bench:        33 ns/iter (+/- 12)

The idea behind this optimization is to avoid all bounds checks for space
already allocated into the vector. This may involve running the iterator twice,
but the first run of the iterator should be optimizable to a memcpy or memset if
possible.

The same treatment can in theory be applied to `Vec::extend` but the benchmarks
for that currently get *worse* if the change is applied. This appears to be some
LLVM optimizations going awry but it's seems prudent to land at least the
`collect` portion beforehand.

9 years agoInstead of putting them in the book, make them READMEs.
Steve Klabnik [Wed, 11 Feb 2015 03:09:42 +0000 (22:09 -0500)]
Instead of putting them in the book, make them READMEs.

9 years agoMake note of doc duplication with reexports
Steve Klabnik [Tue, 10 Feb 2015 03:24:49 +0000 (22:24 -0500)]
Make note of doc duplication with reexports

Fixes #16645

9 years agoAuto merge of #22093 - petrochenkov:builtin, r=pnkfelix
bors [Fri, 13 Feb 2015 07:44:41 +0000 (07:44 +0000)]
Auto merge of #22093 - petrochenkov:builtin, r=pnkfelix

Names of structs, enums, traits, type aliases and type parameters (i.e. all identifiers that can be used as full paths in type position) are not allowed to match the names of primitive types.
See #20427 for more information.

This is a minor [breaking-change]

9 years agoAuto merge of #22219 - pnkfelix:partial-reinit, r=pnkfelix
bors [Fri, 13 Feb 2015 02:09:15 +0000 (02:09 +0000)]
Auto merge of #22219 - pnkfelix:partial-reinit, r=pnkfelix

borrowck: Prevent partial reinitialization of uninitialized structures

This is a pnkfelix-swiped squash of #22079, which was a rebase and revision of #18963

Fixes #18571.

9 years agoMade `Self` a keyword.
Marvin Löbel [Tue, 10 Feb 2015 13:55:45 +0000 (14:55 +0100)]
Made `Self` a keyword.

It is only allowed in paths now, where it will either work inside a `trait`
or `impl` item, or not resolve outside of it.

[breaking-change]

Closes #22137

9 years agoAuto merge of #22182 - nikomatsakis:cycles-in-collect, r=nikomatsakis
bors [Thu, 12 Feb 2015 20:03:50 +0000 (20:03 +0000)]
Auto merge of #22182 - nikomatsakis:cycles-in-collect, r=nikomatsakis

This resolves a number of bugs that trigger stack overflows or other cyclic errors.

r? @nick29581 (it is based on work that you started)
f? @jroesch (also based on your branch)

9 years agoPacify the merciless nrc.
Niko Matsakis [Wed, 11 Feb 2015 21:55:22 +0000 (16:55 -0500)]
Pacify the merciless nrc.

9 years agoPacify the mercilous tidy.
Niko Matsakis [Wed, 11 Feb 2015 16:54:30 +0000 (11:54 -0500)]
Pacify the mercilous tidy.

9 years agoAdd test that shows how a cycle between the where-clauses on a type
Niko Matsakis [Wed, 11 Feb 2015 15:32:21 +0000 (10:32 -0500)]
Add test that shows how a cycle between the where-clauses on a type
and the type appearing in the trait would (previously) trigger an
error message. The code is now accepted. No reported issue that I am
aware of.

9 years agoAdd test for self-referencing pattern blocked by #20551. Fixes #20551.
Niko Matsakis [Wed, 11 Feb 2015 15:31:37 +0000 (10:31 -0500)]
Add test for self-referencing pattern blocked by #20551. Fixes #20551.

9 years agoAdd test for IntoIterator pattern blocked by #20220. Fixes #20220.
Niko Matsakis [Wed, 11 Feb 2015 15:31:19 +0000 (10:31 -0500)]
Add test for IntoIterator pattern blocked by #20220. Fixes #20220.

9 years agoAdjust wording of astconv comment.
Niko Matsakis [Wed, 11 Feb 2015 15:30:16 +0000 (10:30 -0500)]
Adjust wording of astconv comment.

9 years agoModify `repr()` so that when `-Z verbose` is used, at least, it does not
Niko Matsakis [Wed, 11 Feb 2015 15:29:46 +0000 (10:29 -0500)]
Modify `repr()` so that when `-Z verbose` is used, at least, it does not
fetch trait definitions. This allows is to be used early in the compiler
without triggering ICEs. Also make -Z verbose less horrifyingly ugly.

9 years agoRote changes to fix fallout throughout the compiler from splitting the
Niko Matsakis [Wed, 11 Feb 2015 15:28:52 +0000 (10:28 -0500)]
Rote changes to fix fallout throughout the compiler from splitting the
predicates and renaming some things.

9 years agostd: Optimize Vec::from_iter
Alex Crichton [Wed, 11 Feb 2015 22:18:32 +0000 (14:18 -0800)]
std: Optimize Vec::from_iter

This PR is an optimization of the `FromIterator` implementation of `Vec`

Benchmark: https://gist.github.com/alexcrichton/03d666159a28a80e7c70

Before:
    test macro_repeat1     ... bench:        57 ns/iter (+/- 1)
    test macro_repeat2     ... bench:        56 ns/iter (+/- 1)
    test map_clone1        ... bench:       828 ns/iter (+/- 13)
    test map_clone2        ... bench:       828 ns/iter (+/- 8)
    test repeat1           ... bench:      1104 ns/iter (+/- 10)
    test repeat2           ... bench:      1106 ns/iter (+/- 11)

After:
    test macro_repeat1     ... bench:        75 ns/iter (+/- 21)
    test macro_repeat2     ... bench:        59 ns/iter (+/- 31)
    test map_clone1        ... bench:        34 ns/iter (+/- 22)
    test map_clone2        ... bench:        52 ns/iter (+/- 21)
    test repeat1           ... bench:        34 ns/iter (+/- 11)
    test repeat2           ... bench:        33 ns/iter (+/- 12)

The idea behind this optimization is to avoid all bounds checks for space
already allocated into the vector. This may involve running the iterator twice,
but the first run of the iterator should be optimizable to a memcpy or memset if
possible.

The same treatment can in theory be applied to `Vec::extend` but the benchmarks
for that currently get *worse* if the change is applied. This appears to be some
LLVM optimizations going awry but it's seems prudent to land at least the
`collect` portion beforehand.

9 years agoRefactor collect to separate out the computation of the type scheme
Niko Matsakis [Wed, 11 Feb 2015 15:25:52 +0000 (10:25 -0500)]
Refactor collect to separate out the computation of the type scheme
and predicates. Try to document how things work. More cleanup is
needed here but I had to draw the line somewhere gosh darn it.

9 years agoSplit the predicates listing out of `TraitDef` and `TypeScheme` and into a separate...
Niko Matsakis [Wed, 11 Feb 2015 11:54:05 +0000 (06:54 -0500)]
Split the predicates listing out of `TraitDef` and `TypeScheme` and into a separate map, `tcx.predicates`, that is used for both traits and other kinds of items. Also use two newtypes to distinguish
instantiated predicates from the raw, unsubstituted predicates extracted from the map.

9 years agoMake VecPerParamSpace support IntoIterator
Niko Matsakis [Wed, 11 Feb 2015 10:59:59 +0000 (05:59 -0500)]
Make VecPerParamSpace support IntoIterator

9 years agoUpdate metadata to reflect that predicates/schemes/trait-defs are now severed
Niko Matsakis [Wed, 11 Feb 2015 10:59:01 +0000 (05:59 -0500)]
Update metadata to reflect that predicates/schemes/trait-defs are now severed

9 years agoFix duplicate error code
Vadim Petrochenkov [Thu, 12 Feb 2015 17:31:31 +0000 (20:31 +0300)]
Fix duplicate error code

9 years agoAuto merge of #21895 - alfie:libcoretest, r=pnkfelix
bors [Thu, 12 Feb 2015 14:58:13 +0000 (14:58 +0000)]
Auto merge of #21895 - alfie:libcoretest, r=pnkfelix

9 years agoAdd a couple FIXME notes inspired during my review.
Felix S. Klock II [Thu, 12 Feb 2015 12:53:16 +0000 (13:53 +0100)]
Add a couple FIXME notes inspired during my review.

9 years agolibrustc: Forbid partial reinitialization of uninitialized structures or
Kevin Butler [Fri, 14 Nov 2014 23:14:52 +0000 (15:14 -0800)]
librustc: Forbid partial reinitialization of uninitialized structures or
enumerations that implement the `Drop` trait.

This breaks code like:

    struct Struct {
        f: String,
        g: String,
    }

    impl Drop for Struct { ... }

    fn main() {
        let x = Struct { ... };
        drop(x);
        x.f = ...;
    }

Change this code to not create partially-initialized structures. For
example:

    struct Struct {
        f: String,
        g: String,
    }

    impl Drop for Struct { ... }

    fn main() {
        let x = Struct { ... };
        drop(x);
        x = Struct {
            f: ...,
            g: ...,
        }
    }

Closes #18571.

[breaking-change]

----

(Joint authorship by pcwalton and Ryman; thanks all!)

9 years agoAuto merge of #22217 - mmatyas:char_typofix, r=huonw
bors [Thu, 12 Feb 2015 12:45:13 +0000 (12:45 +0000)]
Auto merge of #22217 - mmatyas:char_typofix, r=huonw

There are two dots at the end of a line in the documentation of std::char.

9 years agoFixed a tiny typo in the documentation of std::char.
Mátyás Mustoha [Thu, 12 Feb 2015 11:40:16 +0000 (12:40 +0100)]
Fixed a tiny typo in the documentation of std::char.

9 years agoUpdated usage of StrExt.parse() as per a recommendation by edwardw.
Nick Sarten [Thu, 12 Feb 2015 07:48:09 +0000 (20:48 +1300)]
Updated usage of StrExt.parse() as per a recommendation by edwardw.

9 years agoFixed one newly created instance of range(start, end).
Nick Sarten [Fri, 6 Feb 2015 22:44:45 +0000 (11:44 +1300)]
Fixed one newly created instance of range(start, end).

9 years agoUpdated documentation to use range notation syntax.
Nick Sarten [Sun, 1 Feb 2015 05:37:01 +0000 (18:37 +1300)]
Updated documentation to use range notation syntax.

Replaced outdated use of the `range(start, end)` function where
approriate with `start..end`, and tweaked the examples to compile and run with the latest rust. I also fixed two periphery compile issues in reference.md which were occluding whether there were any new errors created by these changes, so I fixed them.

9 years agoAuto merge of #22193 - pnkfelix:cleanup-pr22012, r=eddyb
bors [Thu, 12 Feb 2015 03:53:08 +0000 (03:53 +0000)]
Auto merge of #22193 - pnkfelix:cleanup-pr22012, r=eddyb

PR #22012 followup: clean up vtable::check_object_cast by reusing `fresh_ty`

(hat tip to nikomatsakis, who was the one who pointed out this simplification to the logic.)

9 years agoAuto merge of #22192 - alexcrichton:rollup, r=alexcrichton
bors [Thu, 12 Feb 2015 00:38:24 +0000 (00:38 +0000)]
Auto merge of #22192 - alexcrichton:rollup, r=alexcrichton

9 years agoEven more test fixes
Alex Crichton [Thu, 12 Feb 2015 00:35:37 +0000 (16:35 -0800)]
Even more test fixes

9 years agorollup merge of #22197: alexcrichton/do-not-link-plugins
Alex Crichton [Thu, 12 Feb 2015 00:20:34 +0000 (16:20 -0800)]
rollup merge of #22197: alexcrichton/do-not-link-plugins

9 years agorustc: Do not link to plugins
Alex Crichton [Thu, 12 Feb 2015 00:13:27 +0000 (16:13 -0800)]
rustc: Do not link to plugins

This flag seems to have erroneously been set to `true`.

9 years agoMore test fixes and rebase conflicts
Alex Crichton [Wed, 11 Feb 2015 23:29:51 +0000 (15:29 -0800)]
More test fixes and rebase conflicts

9 years agoPR #22012 followup: clean up vtable::check_object_cast by reusing `fresh_ty`
Felix S. Klock II [Wed, 11 Feb 2015 23:29:50 +0000 (00:29 +0100)]
PR #22012 followup: clean up vtable::check_object_cast by reusing `fresh_ty`

(hat tip to nikomatsakis who was the one who pointed out this
simplification to the logic.)

9 years agorollup merge of #22166: dcrewi/iter-impls-for-windows
Alex Crichton [Wed, 11 Feb 2015 23:25:59 +0000 (15:25 -0800)]
rollup merge of #22166: dcrewi/iter-impls-for-windows

- DoubleEndedIterator
- ExactSizeIterator
- RandomAccessIterator

9 years agorollup merge of #22015: alexcrichton/netv2
Alex Crichton [Wed, 11 Feb 2015 23:25:40 +0000 (15:25 -0800)]
rollup merge of #22015: alexcrichton/netv2

This commit is an implementation of [RFC 807][rfc] which adds a `std::net`
module for basic neworking based on top of `std::io`. This module serves as a
replacement for the `std::old_io::net` module and networking primitives in
`old_io`.

[rfc]: fillmein

The major focus of this redesign is to cut back on the level of abstraction to
the point that each of the networking types is just a bare socket. To this end
functionality such as timeouts and cloning has been removed (although cloning
can be done through `duplicate`, it may just yield an error).

With this `net` module comes a new implementation of `SocketAddr` and `IpAddr`.
This work is entirely based on #20785 and the only changes were to alter the
in-memory representation to match the `libc`-expected variants and to move from
public fields to accessors.

9 years agostd: Add a `net` module for TCP/UDP
Alex Crichton [Fri, 6 Feb 2015 00:50:11 +0000 (16:50 -0800)]
std: Add a `net` module for TCP/UDP

This commit is an implementation of [RFC 807][rfc] which adds a `std::net`
module for basic neworking based on top of `std::io`. This module serves as a
replacement for the `std::old_io::net` module and networking primitives in
`old_io`.

[rfc]: fillmein

The major focus of this redesign is to cut back on the level of abstraction to
the point that each of the networking types is just a bare socket. To this end
functionality such as timeouts and cloning has been removed (although cloning
can be done through `duplicate`, it may just yield an error).

With this `net` module comes a new implementation of `SocketAddr` and `IpAddr`.
This work is entirely based on #20785 and the only changes were to alter the
in-memory representation to match the `libc`-expected variants and to move from
public fields to accessors.

9 years agoTest fixes and rebase conflicts
Alex Crichton [Wed, 11 Feb 2015 22:40:09 +0000 (14:40 -0800)]
Test fixes and rebase conflicts

9 years agoimplement missing iterator traits for slice::Windows
David Creswick [Wed, 11 Feb 2015 03:32:00 +0000 (21:32 -0600)]
implement missing iterator traits for slice::Windows

- DoubleEndedIterator
- ExactSizeIterator
- RandomAccessIterator

9 years agorollup merge of #22178: pnkfelix/featuregate-unsafe-no-drop-flag
Alex Crichton [Wed, 11 Feb 2015 22:03:33 +0000 (14:03 -0800)]
rollup merge of #22178: pnkfelix/featuregate-unsafe-no-drop-flag

Conflicts:
src/libsyntax/feature_gate.rs

9 years agorollup merge of #22188: alexcrichton/envv2
Alex Crichton [Wed, 11 Feb 2015 22:02:24 +0000 (14:02 -0800)]
rollup merge of #22188: alexcrichton/envv2

This commit tweaks the interface of the `std::env` module to make it more
ergonomic for common usage:

* `env::var` was renamed to `env::var_os`
* `env::var_string` was renamed to `env::var`
* `env::args` was renamed to `env::args_os`
* `env::args` was re-added as a panicking iterator over string values
* `env::vars` was renamed to `env::vars_os`
* `env::vars` was re-added as a panicking iterator over string values.

This should make common usage (e.g. unicode values everywhere) more ergonomic
as well as "the default". This is also a breaking change due to the differences
of what's yielded from each of these functions, but migration should be fairly
easy as the defaults operate over `String` which is a common type to use.

[breaking-change]

9 years agorollup merge of #22186: GuillaumeGomez/fix-fs
Alex Crichton [Wed, 11 Feb 2015 22:02:22 +0000 (14:02 -0800)]
rollup merge of #22186: GuillaumeGomez/fix-fs

Fixes issue #22174.

9 years agorollup merge of #22185: edwardw/default-methods
Alex Crichton [Wed, 11 Feb 2015 22:02:21 +0000 (14:02 -0800)]
rollup merge of #22185: edwardw/default-methods

When projecting associate types for a trait's default methods, the
trait itself was added to the predicate candidate list twice: one from
parameter environment, the other from trait definition. Then the
duplicates were deemed as code ambiguity and the compiler rejected the
code. Simply checking and dropping the duplicates solves the issue.

Closes #22036

9 years agorollup merge of #22184: nagisa/revert-emissions
Alex Crichton [Wed, 11 Feb 2015 22:02:19 +0000 (14:02 -0800)]
rollup merge of #22184: nagisa/revert-emissions

This resulted in some very unexpected fallout such as empty llvm-ir, llvm-bc and asm in some cases.
See #22183 for related info.

r? @alexcrichton

9 years agorollup merge of #22177: semarie/openbsd-notls
Alex Crichton [Wed, 11 Feb 2015 22:02:17 +0000 (14:02 -0800)]
rollup merge of #22177: semarie/openbsd-notls

OpenBSD doesn't have thread-local-storage support (yet).
Permit to compile (and run) `check-stage1-crates` under OpenBSD.

9 years agorollup merge of #22167: kmcallister/undef-macro
Alex Crichton [Wed, 11 Feb 2015 22:02:15 +0000 (14:02 -0800)]
rollup merge of #22167: kmcallister/undef-macro

Fixes #21062.

9 years agorollup merge of #22164: huonw/alloc--
Alex Crichton [Wed, 11 Feb 2015 22:02:13 +0000 (14:02 -0800)]
rollup merge of #22164: huonw/alloc--

It doesn't have to be a literal memory allocation (ala malloc), e.g. it
can be in static memory, so saying "allocated" is mildly misleading.

Thanks to @mahkoh for pointing it out.

r? @steveklabnik

9 years agorollup merge of #22162: ogham/patch-1
Alex Crichton [Wed, 11 Feb 2015 22:02:11 +0000 (14:02 -0800)]
rollup merge of #22162: ogham/patch-1

It returns `false`, not `None`.

9 years agorollup merge of #22161: steveklabnik/close_2741
Alex Crichton [Wed, 11 Feb 2015 22:02:09 +0000 (14:02 -0800)]
rollup merge of #22161: steveklabnik/close_2741

Given that this is entirely internal, this enhancement isn't going to be needed. And if it is, we'll add it.

Closes #2741.

9 years agorollup merge of #22151: Gankro/macro-bench
Alex Crichton [Wed, 11 Feb 2015 22:02:08 +0000 (14:02 -0800)]
rollup merge of #22151: Gankro/macro-bench

r? @alexcrichton

9 years agorollup merge of #22150: nagisa/de-perm-frost
Alex Crichton [Wed, 11 Feb 2015 22:02:06 +0000 (14:02 -0800)]
rollup merge of #22150: nagisa/de-perm-frost

Fixes #22124

9 years agorollup merge of #22127: alexcrichton/stability-holes
Alex Crichton [Wed, 11 Feb 2015 22:02:04 +0000 (14:02 -0800)]
rollup merge of #22127: alexcrichton/stability-holes

There are a number of holes that the stability lint did not previously cover,
including:

* Types
* Bounds on type parameters on functions and impls
* Where clauses
* Imports
* Patterns (structs and enums)

These holes have all been fixed by overriding the `visit_path` function on the
AST visitor instead of a few specialized cases. This change also necessitated a
few stability changes:

* The `collections::fmt` module is now stable (it was already supposed to be).
* The `thread_local::imp::Key` type is now stable (it was already supposed to
  be).
* The `std::rt::{begin_unwind, begin_unwind_fmt}` functions are now stable.
  These are required via the `panic!` macro.
* The `std::old_io::stdio::{println, println_args}` functions are now stable.
  These are required by the `print!` and `println!` macros.
* The `ops::{FnOnce, FnMut, Fn}` traits are now `#[stable]`. This is required to
  make bounds with these traits stable. Note that manual implementations of
  these traits are still gated by default, this stability only allows bounds
  such as `F: FnOnce()`.

Closes #8962
Closes #16360
Closes #20327

9 years agorollup merge of #22048: LeoTestard/impl-patterns-used
Alex Crichton [Wed, 11 Feb 2015 22:02:02 +0000 (14:02 -0800)]
rollup merge of #22048: LeoTestard/impl-patterns-used

The live code analysis only visited the function's body when visiting a
method, and not the FnDecl and the generics, resulting in code to be
incorrectly marked as unused when it only appeared in the generics, the
arguments, or the return type, whereas the same code in non-method
functions was correctly detected as used. Fixes #20343.

Originally I just added a call to `walk_generics` and `walk_fndecl` alongside `walk_block` but then I noticed the `walk_method_helper` function did pretty much the same thing. The only difference is that it also calls `visit_mac`, but since this is not going to happen at this stage, I think it's ok. However let me know if this was not the right thing to do.

9 years agorollup merge of #21881: richo/lint-no-mangle-const
Alex Crichton [Wed, 11 Feb 2015 22:02:00 +0000 (14:02 -0800)]
rollup merge of #21881: richo/lint-no-mangle-const

This renames the PrivateNoMangleFns lint to allow both to happen in a
single pass, since they do roughly the same work.

Closes #21856

Open questions:

[ ]: Do the tests actually pass (I'm running make check and running out the door now)
[ ]: Is the name of this lint ok. it seems to mostly be fine with [convention](https://github.com/rust-lang/rfcs/blob/cc53afbe5dea41e1f7d1c3dce71e013abe025211/text/0344-conventions-galore.md#lints)
[ ]: I'm not super thrilled about the warning text

r? @kmcallister (Shamelessly nominating because you were looking at my other ticket)

9 years agostd: Tweak the std::env OsString/String interface
Alex Crichton [Wed, 11 Feb 2015 19:47:53 +0000 (11:47 -0800)]
std: Tweak the std::env OsString/String interface

This commit tweaks the interface of the `std::env` module to make it more
ergonomic for common usage:

* `env::var` was renamed to `env::var_os`
* `env::var_string` was renamed to `env::var`
* `env::args` was renamed to `env::args_os`
* `env::args` was re-added as a panicking iterator over string values
* `env::vars` was renamed to `env::vars_os`
* `env::vars` was re-added as a panicking iterator over string values.

This should make common usage (e.g. unicode values everywhere) more ergonomic
as well as "the default". This is also a breaking change due to the differences
of what's yielded from each of these functions, but migration should be fairly
easy as the defaults operate over `String` which is a common type to use.

[breaking-change]

9 years agorustc: Fix a number of stability lint holes
Alex Crichton [Tue, 10 Feb 2015 00:33:19 +0000 (16:33 -0800)]
rustc: Fix a number of stability lint holes

There are a number of holes that the stability lint did not previously cover,
including:

* Types
* Bounds on type parameters on functions and impls
* Where clauses
* Imports
* Patterns (structs and enums)

These holes have all been fixed by overriding the `visit_path` function on the
AST visitor instead of a few specialized cases. This change also necessitated a
few stability changes:

* The `collections::fmt` module is now stable (it was already supposed to be).
* The `thread_local::imp::Key` type is now stable (it was already supposed to
  be).
* The `std::rt::{begin_unwind, begin_unwind_fmt}` functions are now stable.
  These are required via the `panic!` macro.
* The `std::old_io::stdio::{println, println_args}` functions are now stable.
  These are required by the `print!` and `println!` macros.
* The `ops::{FnOnce, FnMut, Fn}` traits are now `#[stable]`. This is required to
  make bounds with these traits stable. Note that manual implementations of
  these traits are still gated by default, this stability only allows bounds
  such as `F: FnOnce()`.

Additionally, the compiler now has special logic to ignore its own generated
`__test` module for the `--test` harness in terms of stability.

Closes #8962
Closes #16360
Closes #20327

[breaking-change]

9 years agoAdd read and write rights to group and other when creating file
GuillaumeGomez [Wed, 11 Feb 2015 18:38:57 +0000 (19:38 +0100)]
Add read and write rights to group and other when creating file

9 years agoAuto merge of #21972 - pnkfelix:new-dtor-semantics-6, r=nikomatsakis
bors [Wed, 11 Feb 2015 17:59:37 +0000 (17:59 +0000)]
Auto merge of #21972 - pnkfelix:new-dtor-semantics-6, r=nikomatsakis

This is a resurrection and heavy revision/expansion of a PR that pcwalton did to resolve #8861.

The most relevant, user-visible semantic change is this: #[unsafe_destructor] is gone. Instead, if a type expression for some value has a destructor, then any lifetimes referenced within that type expression must strictly outlive the scope of the value.

See discussion on https://github.com/rust-lang/rfcs/pull/769

9 years agoRevert #22051
Simonas Kazlauskas [Wed, 11 Feb 2015 17:23:06 +0000 (19:23 +0200)]
Revert #22051

This resulted in some very unexpected fallout such as empty llvm-ir, llvm-bc and asm in some cases.
See #22183 for related info.

9 years agoEliminate assoc type projection predicate candidate duplicates
Edward Wang [Wed, 11 Feb 2015 17:12:57 +0000 (01:12 +0800)]
Eliminate assoc type projection predicate candidate duplicates

When projecting associate types for a trait's default methods, the
trait itself was added to the predicate candidate list twice: one from
parameter environment, the other from trait definition. Then the
duplicates were deemed as code ambiguity and the compiler rejected the
code. Simply checking and dropping the duplicates solves the issue.

Closes #22036

9 years agoAuto merge of #22175 - pnkfelix:featuregate-boxpat-rfc469, r=nikomatsakis
bors [Wed, 11 Feb 2015 15:00:35 +0000 (15:00 +0000)]
Auto merge of #22175 - pnkfelix:featuregate-boxpat-rfc469, r=nikomatsakis

Feature gate `box` patterns.

Note that this adds a new feature gate, `box_patterns` specific to e.g. `let box i = ...`, while leaving  `box` expressions (alone) still guarded via the preexisting `box_syntax`.

9 years agoGeneralize all error messages with "experimental in alpha release" to
Felix S. Klock II [Wed, 11 Feb 2015 13:13:33 +0000 (14:13 +0100)]
Generalize all error messages with "experimental in alpha release" to
just say "experimental."

9 years agoFeature-gate the `#[unsafe_no_drop_flag]` attribute.
Felix S. Klock II [Wed, 11 Feb 2015 12:57:40 +0000 (13:57 +0100)]
Feature-gate the `#[unsafe_no_drop_flag]` attribute.

See RFC 320, "Non-zeroing dynamic drops."

Fix #22173

[breaking-change]

9 years agoAdded lifetime param to Arena.
Felix S. Klock II [Mon, 2 Feb 2015 13:10:36 +0000 (14:10 +0100)]
Added lifetime param to Arena.

It (1.) is invariant, (2.) must strictly outlive the arena itself,
(3.) constrains the inputs to the arena so that their borrows must
also strictly outlive the arena itself.

This implies that, for now, one can no longer have cross-references
between data allocated via the same `Arena` (even when the data is not
subject to the Drop Check rule).  Instead one must carry multiple
`Arena` instances, or (more commonly), use one or more `TypedArena`
instances with enums encoding the different variants of allocated
data.

9 years agocompile-fail tests.
Felix S. Klock II [Mon, 27 Oct 2014 11:58:30 +0000 (12:58 +0100)]
compile-fail tests.

Some compile-fail tests illustrated cases to be rejected by dropck,
including ones that check cyclic data cases designed to exposed bugs
if they are actually tricked into running by an unsound analysis.

E.g. these exposed bugs in earlier broken ways of handling `Vec<T>`.

(Note that all the uses of `unsafe_destructor` are just placating the
simple analysis used for that feature, which will eventually go away
once we have put the dropck through its paces.)

9 years agorun-pass tests.
Felix S. Klock II [Mon, 5 Jan 2015 12:26:29 +0000 (13:26 +0100)]
run-pass tests.

includes regression tests discovered during bootstrapping and tests of
cyclic structure that currently pass and are expected to continue
passing under the dropck rule.

(Note that all the uses of `unsafe_destructor` are just placating the
simple analysis used for that feature, which will eventually go away
once we have put the dropck through its paces.)

9 years agoaddress nit from niko's review.
Felix S. Klock II [Wed, 11 Feb 2015 08:21:21 +0000 (09:21 +0100)]
address nit from niko's review.

9 years agodropck: treat parametric types as safe for dropping.
Felix S. Klock II [Wed, 21 Jan 2015 22:43:29 +0000 (23:43 +0100)]
dropck: treat parametric types as safe for dropping.

Handles e.g. `impl<T> Drop for Vec<T>` as parametric: If `T` does not
have any drop code that could read from borrowed data of lifetime `'a`,
then we infer that the drop code for `Vec<T>` also cannot read from
borrowed data of lifetime `'a`, and therefore we do not need to inject
the SafeDestructor constraint for it.

Notably, this enables us to continue storing cyclic structure, without
any `unsafe` code, in `Vec`, without allowing (unsound) destructors on
such cyclic data. (Later commits have tests illustrating these two
cases in run-pass and compile-fail, respectively.)

(This is "Condition (B.)" in Drop-Check rule described in RFC 769.)

9 years agoAdd core::marker::PhantomData.
Felix S. Klock II [Wed, 21 Jan 2015 19:02:52 +0000 (20:02 +0100)]
Add core::marker::PhantomData.

Port `core::ptr::Unique` to have `PhantomData`. Add `PhantomData` to
`TypedArena` and `Vec` as well.

As a drive-by, switch `ptr::Unique` from a tuple-struct to a struct
with fields.

9 years agoopenbsd don't support TLS
Sébastien Marie [Wed, 11 Feb 2015 12:36:44 +0000 (13:36 +0100)]
openbsd don't support TLS

9 years agogeneralize error text to not focus on any particular release.
Felix S. Klock II [Wed, 11 Feb 2015 11:01:57 +0000 (12:01 +0100)]
generalize error text to not focus on any particular release.

9 years agoopt into box_patterns in the reference doc that uses them.
Felix S. Klock II [Wed, 11 Feb 2015 10:44:33 +0000 (11:44 +0100)]
opt into box_patterns in the reference doc that uses them.

9 years agoopt into box_patterns in debuginfo tests.
Felix S. Klock II [Wed, 11 Feb 2015 10:44:20 +0000 (11:44 +0100)]
opt into box_patterns in debuginfo tests.

9 years agoOpt into `box_patterns` feature gate in all tests that use them.
Felix S. Klock II [Tue, 10 Feb 2015 21:52:00 +0000 (22:52 +0100)]
Opt into `box_patterns` feature gate in all tests that use them.

9 years agoOpt into new `box_patterns` feature gate in various crates.
Felix S. Klock II [Tue, 10 Feb 2015 21:52:44 +0000 (22:52 +0100)]
Opt into new `box_patterns` feature gate in various crates.

Namely: `collections` (used in `dlist.rs`), `syntax`, `rustc`,
`rustc_typeck`, `rustc_trans`, and `rustdoc`.

9 years agoAdd `box_patterns` feature gate.
Felix S. Klock II [Tue, 10 Feb 2015 21:49:56 +0000 (22:49 +0100)]
Add `box_patterns` feature gate.

Switch feature-gate checker from `box_syntax` to `box_patterns` when
visiting a pattern.

(Having to opt into both `box_syntax` and `box_patterns` seemed
unnecessary.)

[breaking-change]

9 years agoAuto merge of #22169 - gfxmonk:disable-docs, r=steveklabnik
bors [Wed, 11 Feb 2015 08:54:30 +0000 (08:54 +0000)]
Auto merge of #22169 - gfxmonk:disable-docs, r=steveklabnik

`make docs` fails when (xe)latex is not installed. The output is pretty weird, looks like it's doing some `eval` tricks but something is blank:

    /bin/sh: -output-directory=.: command not found
    /home/tim/dev/rust/rust/mk/docs.mk:220: recipe for target 'doc/reference.pdf' failed

I have neither latex or xelatex installed. It seems like the following snippet is meant for me, but the logic is backwards:

    ifeq ($(CFG_XELATEX),)
        CFG_LATEX := $(CFG_XELATEX)
        XELATEX = 1
      else
        $(info cfg: no xelatex found, disabling LaTeX docs)
        NO_PDF_DOCS = 1
    endif

I verified with:

    $ make doc/reference.pdf CFG_XELATEX=/bin/foo
    cfg: no xelatex found, disabling LaTeX docs

9 years agoFail nicely when copying artefacts fails
Simonas Kazlauskas [Tue, 10 Feb 2015 18:02:09 +0000 (20:02 +0200)]
Fail nicely when copying artefacts fails

Fixes #22124

9 years agodestructor checker (dropck).
Felix S. Klock II [Mon, 27 Oct 2014 11:55:16 +0000 (12:55 +0100)]
destructor checker (dropck).

Largely adapted from pcwalton's original branch, with following
notable modifications:

Use `regionck::type_must_outlive` to generate `SafeDestructor`
constraints.  (this plugged some soundness holes in the analysis).

Avoid exponential time blowup on compile-fail/huge-struct.rs by
keeping the breadcrumbs until end of traversal.

Avoid premature return from regionck::visit_expr.

Factored drop-checking code out into dropck module.

Added `SafeDestructor` to enum `SubregionOrigin` (for error reporting).

----

Since this imposes restrictions on the lifetimes used in types with
destructors, this is a (wait for it)

[breaking-change]

9 years agoAdded DestructionScope variant to CodeExtent, representing the area
Felix S. Klock II [Tue, 25 Nov 2014 16:02:20 +0000 (17:02 +0100)]
Added DestructionScope variant to CodeExtent, representing the area
immediately surrounding a node that is a terminating_scope
(e.g. statements, looping forms) during which the destructors run (the
destructors for temporaries from the execution of that node, that is).

Introduced DestructionScopeData newtype wrapper around ast::NodeId, to
preserve invariant that FreeRegion and ScopeChain::BlockScope carry
destruction scopes (rather than arbitrary CodeExtents).

Insert DestructionScope and block Remainder into enclosing CodeExtents
hierarchy.

Add more doc for DestructionScope, complete with ASCII art.

Switch to constructing DestructionScope rather than Misc in a number
of places, mostly related to `ty::ReFree` creation, and use
destruction-scopes of node-ids at various calls to
liberate_late_bound_regions.

middle::resolve_lifetime: Map BlockScope to DestructionScope in `fn resolve_free_lifetime`.

Add the InnermostDeclaringBlock and InnermostEnclosingExpr enums that
are my attempt to clarify the region::Context structure, and that
later commmts build upon.

Improve the debug output for `CodeExtent` attached to `ty::Region::ReScope`.

Loosened an assertion in `rustc_trans::trans::cleanup` to account for
`DestructionScope`.  (Perhaps this should just be switched entirely
over to `DestructionScope`, rather than allowing for either `Misc` or
`DestructionScope`.)

----

Even though the DestructionScope is new, this particular commit should
not actually change the semantics of any current code.

9 years agoshift bindings to accommodate new lifetime/dtor rules.
Felix S. Klock II [Mon, 12 Jan 2015 16:23:40 +0000 (17:23 +0100)]
shift bindings to accommodate new lifetime/dtor rules.

(My fix to for-loops (21984) did not deal with similar problems in
if-let expressions, so those binding shifts stay.)

9 years agoAuto merge of #22163 - bleibig:grammar-updates, r=sanxiyn
bors [Wed, 11 Feb 2015 06:45:25 +0000 (06:45 +0000)]
Auto merge of #22163 - bleibig:grammar-updates, r=sanxiyn

Updates to the bison grammar:

* Fixes to range syntax - allow `expr[..]`, and fix precedence to allow `for _ in i.. { }`
* Allow "extern crate" in stmts
* Add qualified path expressions (`<TYPE as TRAIT_REF>::item`)

9 years agodocs: disable PDF docs when latex _isn't_ present
Tim Cuthbertson [Wed, 11 Feb 2015 06:16:37 +0000 (17:16 +1100)]
docs: disable PDF docs when latex _isn't_ present

9 years agoForbid undefined names in macro use / macro reexport
Keegan McAllister [Wed, 11 Feb 2015 03:30:33 +0000 (19:30 -0800)]
Forbid undefined names in macro use / macro reexport

Fixes #21062.