Commit Graph

38799 Commits

Author SHA1 Message Date
Valerii Hiora
f89622f84d Updated darwin types 2015-02-12 18:05:51 +02:00
Seo Sanghyeon
995b159157 rustdoc: Show must_use attribute 2015-02-13 00:47:03 +09: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
Jormundir
64d33b1e98 fix windows specific errno type errors. 2015-02-11 19:00:42 -08: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
Alex Crichton
5bcf2a9212 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.
2015-02-11 14:02:17 -08:00
Alex Crichton
7362bd57a9 rollup merge of #22167: kmcallister/undef-macro
Fixes #21062.
2015-02-11 14:02:15 -08:00
Alex Crichton
4876716507 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
2015-02-11 14:02:13 -08:00
Alex Crichton
5e2b69c1b2 rollup merge of #22162: ogham/patch-1
It returns `false`, not `None`.
2015-02-11 14:02:11 -08:00
Alex Crichton
92e7aebf4b 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.
2015-02-11 14:02:09 -08:00
Alex Crichton
fcf679cb88 rollup merge of #22151: Gankro/macro-bench
r? @alexcrichton
2015-02-11 14:02:08 -08:00
Alex Crichton
18d31cc14b rollup merge of #22150: nagisa/de-perm-frost
Fixes #22124
2015-02-11 14:02:06 -08:00
Alex Crichton
84e5c11785 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:👿: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
2015-02-11 14:02:04 -08:00
Alex Crichton
c9fdfdb2bb 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.
2015-02-11 14:02:02 -08:00
Alex Crichton
8b8331ad09 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](cc53afbe5d/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)
2015-02-11 14:02:00 -08:00
Alex Crichton
a828e79480 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]
2015-02-11 13:46:35 -08:00
Simonas Kazlauskas
6f5944bfcf Change target-word-size to target-pointer-width
This aligns json target specification to match terminology used elsewhere in the code base.

[breaking-change] for custom target json users. Change all appearances of target-word-size
to target-pointer-width.
2015-02-11 22:29:16 +02:00
Alex Crichton
bbbb571fee 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:👿: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]
2015-02-11 12:14:59 -08:00
GuillaumeGomez
d4985accb7 Add read and write rights to group and other when creating file 2015-02-11 19:38:57 +01:00
bors
e29f420255 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
2015-02-11 17:59:37 +00:00
Simonas Kazlauskas
2f48651111 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.
2015-02-11 19:28:02 +02:00
Edward Wang
2af968eaa6 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
2015-02-12 01:12:57 +08:00
bors
446bc899b2 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`.
2015-02-11 15:00:35 +00:00
Felix S. Klock II
cdd8a5ad74 Generalize all error messages with "experimental in alpha release" to
just say "experimental."
2015-02-11 14:13:33 +01:00
Felix S. Klock II
f9a1087f27 Feature-gate the #[unsafe_no_drop_flag] attribute.
See RFC 320, "Non-zeroing dynamic drops."

Fix #22173

[breaking-change]
2015-02-11 13:57:40 +01:00
Felix S. Klock II
2c9d81b2d4 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.
2015-02-11 13:51:21 +01:00
Felix S. Klock II
c1cda0793e 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.)
2015-02-11 13:51:21 +01:00