Commit Graph

38356 Commits

Author SHA1 Message Date
caipre
1ac10dde6f Minor change in 'method-syntax' chapter 2015-02-14 12:27:17 -05:00
bors
3d1c1added 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
2015-02-14 13:08:33 +00:00
bors
df54632601 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.
2015-02-14 10:03:01 +00:00
Aaron Turon
4175f1ce2f 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.
2015-02-13 23:21:08 -08:00
bors
95b228ab95 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.
2015-02-14 07:10:52 +00:00
bors
f174bcabcb 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.
2015-02-14 03:10:40 +00:00
bors
b8c112fc72 Auto merge of #21376 - fhahn:issue-15881-model-lexer-dotdotdot, r=cmr
This PR adds a dedicated regression test for #15881 as @cmr suggested.
2015-02-13 23:56:40 +00:00
bors
b9ba643b72 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.
2015-02-13 21:15:39 +00:00
bors
cf636c233d 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]
2015-02-13 07:44:41 +00:00
bors
ba2efe96ae 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.
2015-02-13 02:09:15 +00:00
bors
39b463f153 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)
2015-02-12 20:03:50 +00:00
Niko Matsakis
a25ed227a7 Pacify the merciless nrc. 2015-02-12 13:29:52 -05:00
Niko Matsakis
eec3b431aa Pacify the mercilous tidy. 2015-02-12 13:29:52 -05:00
Niko Matsakis
21fb420592 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.
2015-02-12 13:29:52 -05:00
Niko Matsakis
14141aca80 Add test for self-referencing pattern blocked by #20551. Fixes #20551. 2015-02-12 13:29:51 -05:00
Niko Matsakis
28e48f308c Add test for IntoIterator pattern blocked by #20220. Fixes #20220. 2015-02-12 13:29:51 -05:00
Niko Matsakis
c87166e149 Adjust wording of astconv comment. 2015-02-12 13:29:51 -05:00
Niko Matsakis
a6c295cb22 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.
2015-02-12 13:29:51 -05:00
Niko Matsakis
3e88b5bbf9 Rote changes to fix fallout throughout the compiler from splitting the
predicates and renaming some things.
2015-02-12 13:29:51 -05:00
Alex Crichton
985fc7d09b 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.
2015-02-12 10:25:34 -08:00
Niko Matsakis
3764699c83 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.
2015-02-12 13:02:38 -05:00
Niko Matsakis
d1630970de 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.
2015-02-12 13:02:37 -05:00
Niko Matsakis
bea8b81225 Make VecPerParamSpace support IntoIterator 2015-02-12 13:02:37 -05:00
Niko Matsakis
acd1a0090a Update metadata to reflect that predicates/schemes/trait-defs are now severed 2015-02-12 13:02:37 -05:00
Vadim Petrochenkov
8ed58d8ccc Fix duplicate error code 2015-02-12 20:31:31 +03:00
bors
cca1cf613b Auto merge of #21895 - alfie:libcoretest, r=pnkfelix 2015-02-12 14:58:13 +00:00
Felix S. Klock II
6cc3b00d3f Add a couple FIXME notes inspired during my review. 2015-02-12 13:55:49 +01:00
Kevin Butler
32d0dbd49a 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!)
2015-02-12 13:55:08 +01:00
bors
c34421e490 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.
2015-02-12 12:45:13 +00:00
Mátyás Mustoha
7eecb94028 Fixed a tiny typo in the documentation of std::char. 2015-02-12 12:40:16 +01:00
Nick Sarten
830009543d Updated usage of StrExt.parse() as per a recommendation by edwardw. 2015-02-12 20:48:09 +13:00
Nick Sarten
9e9b1d6085 Fixed one newly created instance of range(start, end). 2015-02-12 18:51:32 +13:00
Nick Sarten
5fa9222572 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.
2015-02-12 18:51:31 +13:00
bors
0fdca30fcb 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.)
2015-02-12 03:53:08 +00:00
bors
3ef8ff1f81 Auto merge of #22192 - alexcrichton:rollup, r=alexcrichton 2015-02-12 00:38:24 +00:00
Alex Crichton
fb1f4d11ec Even more test fixes 2015-02-11 16:38:02 -08:00
Alex Crichton
18bafad027 rollup merge of #22197: alexcrichton/do-not-link-plugins 2015-02-11 16:20:34 -08:00
Alex Crichton
d4cece25cc rustc: Do not link to plugins
This flag seems to have erroneously been set to `true`.
2015-02-11 16:13:27 -08:00
Alex Crichton
d2f990f2b0 More test fixes and rebase conflicts 2015-02-11 15:45:15 -08:00
Felix S. Klock II
f27b3e251c 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.)
2015-02-12 00:29:50 +01:00
Alex Crichton
adcda46011 rollup merge of #22166: dcrewi/iter-impls-for-windows
- DoubleEndedIterator
- ExactSizeIterator
- RandomAccessIterator
2015-02-11 15:25:59 -08:00
Alex Crichton
a1056360ec 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.
2015-02-11 15:25:40 -08:00
Alex Crichton
395709ca6d 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.
2015-02-11 15:23:34 -08:00
Alex Crichton
315730fb27 Test fixes and rebase conflicts 2015-02-11 15:05:39 -08:00
David Creswick
cf475e6b10 implement missing iterator traits for slice::Windows
- DoubleEndedIterator
- ExactSizeIterator
- RandomAccessIterator
2015-02-11 17:03:48 -06:00
Alex Crichton
aa0db172de rollup merge of #22178: pnkfelix/featuregate-unsafe-no-drop-flag
Conflicts:
	src/libsyntax/feature_gate.rs
2015-02-11 14:03:33 -08:00
Alex Crichton
9492275106 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]
2015-02-11 14:02:24 -08:00
Alex Crichton
43a2004416 rollup merge of #22186: GuillaumeGomez/fix-fs
Fixes issue #22174.
2015-02-11 14:02:22 -08:00
Alex Crichton
9675f514ef 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
2015-02-11 14:02:21 -08:00
Alex Crichton
76a3852b72 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
2015-02-11 14:02:19 -08:00