Commit graph

39232 commits

Author SHA1 Message Date
Edward Wang 101498cd88 Tweak VecDeque's IterMut implementation
So it is symmetric to its `Iter` implementation. Also kills an FIXME.
2015-02-26 13:48:09 +08:00
Huon Wilson eafdc7135b Record the publicity of struct fields and enum variants.
The stability check checks the `PublicItems` map when giving errors if
there is a #[stable] item with a public contents that doesn't not have
its own stability. Without recording this, struct fields and enum
variants will not get errors for e.g. stable modules with unmarked
functions internally.

This is just improving the compiler's precision to give the standard
library developers more information earlier.

E.g.

    #![staged_api]
    #![feature(staged_api)]
    #![crate_type = "lib"]

    #[stable(feature = "rust1", since = "1.0.0")]
    pub struct Foo {
        pub x: i32
    }

    #[stable(feature = "rust1", since = "1.0.0")]
    pub mod bar {
        pub fn baz() {}
    }

Without the patch it gives:

    test.rs:12:5: 12:20 error: This node does not have a stability attribute
    test.rs:12     pub fn baz() {}
                   ^~~~~~~~~~~~~~~
    error: aborting due to previous error

With the patch it gives:

    test.rs:7:9: 7:15 error: This node does not have a stability attribute
    test.rs:7     pub x: i32
                      ^~~~~~
    test.rs:12:5: 12:20 error: This node does not have a stability attribute
    test.rs:12     pub fn baz() {}
                   ^~~~~~~~~~~~~~~
    error: aborting due to 2 previous errors
2015-02-26 16:26:34 +11:00
Huon Wilson 19cb8f32d8 Check stability of struct fields.
We were recording stability attributes applied to fields in the
compiler, and even annotating it in the libs, but the compiler didn't
actually do the checks to give errors/warnings in user crates.
2015-02-26 16:26:34 +11:00
Tshepang Lekhonkhobe 8b2ff472cf remove some compiler warnings 2015-02-26 07:21:26 +02:00
Sébastien Marie 653ceee3b3 path -> PathBuf for openbsd/bitrig 2015-02-26 06:16:41 +01:00
Alexander Bliskovsky f618e2e1ec Changed prose to assert_eq! macro. 2015-02-25 20:29:13 -05:00
Alexander Bliskovsky 65b0655230 Added documentation of backslash ending string literals.
Closes #22698
2015-02-25 20:26:24 -05:00
Keegan McAllister 65ea9110bd Always error on invalid macro fragment specifiers
Fixes #21370.

unused-macro-with-follow-violation.rs was already handled correctly. That test
is just for good measure. :)
2015-02-25 17:13:16 -08:00
bors 610d1695d1 Auto merge of #22767 - pnkfelix:issue-22265, r=nikomatsakis
Avoid `cat_expr Erred` notes when already in error state.

Also, to ensure we do not let the dropck get skipped, ICE if `cat_expr` errors when *not* in error state.

This is not known to be a breaking change (i.e. I do not know of a current case that causes the new ICE to be exercised).

Fix #22265
2015-02-25 23:08:53 +00:00
Vadim Chugunov 5dd001b2fc Fix overflow in precise_time_ns() on Windows,
which starts happening after ~2 hours of machine uptime.
2015-02-25 15:02:43 -08:00
Cody P Schafer 07dc8d67c9 Result::or : avoid over-specializing the type
Changes .or() so that it can return a Result with a different E type
than the one it is called on.

Essentially:

    fn or(self, res: Result<T, E>) -> Result<T, E>

becomes

    fn or<F>(self, res: Result<T, F>) -> Result<T, F>

This brings `or` in line with the existing `and` and `or_else` member
types.

This is a
[breaking-change]
Due to some code needing additional type annotations.
2015-02-25 17:38:28 -05:00
bors 4db0b32467 Auto merge of #22796 - Manishearth:rollup, r=Manishearth 2015-02-25 20:32:58 +00:00
Jorge Aparicio 2de7a7c9ba impl IntoCow for Path[Buf] 2015-02-25 12:34:50 -05:00
Niko Matsakis 7074346e4f Change MarkerTrait to be invariant. This is a (small) loss of expressiveness,
but is necessary for now to work around #22806. Fixes #22655.
2015-02-25 12:21:15 -05:00
Manish Goregaokar 357b41bfcf Path -> PathBuf for Windows test (fixup #22727) 2015-02-25 19:52:42 +05:30
Manish Goregaokar d54ed567e0 path -> PathBuf for osx/dragonfly (fixup #22727) 2015-02-25 15:21:58 +05:30
Manish Goregaokar 2470fa155e Assert is internal now (fixup #22739) 2015-02-25 14:11:37 +05:30
Manish Goregaokar e61a790495 Fix type inference error (fixup #22739) 2015-02-25 13:58:58 +05:30
Manish Goregaokar 9f8a1cb38d Use os::getcwd instead of env in rustbook (fixup #22727) 2015-02-25 12:48:14 +05:30
Manish Goregaokar f8e4fcb38c allow(deprecated) for TaskPool (fixup #22783) 2015-02-25 11:45:06 +05:30
Alex Crichton 18878b155e std: Require &mut self for Iterator::all
Keeps the method consistent with `Iterator::any`.

Closes #22617
[breaking-change]
2015-02-24 22:04:21 -08:00
Manish Goregaokar f164254392 Rollup merge of #22787 - pnkfelix:reenable-gate-for-unsafe_no_drop_flag, r=alexcrichton
Turn `unsafe_no_drop_flag` back into a gated-feature.

Fix #22173
2015-02-25 10:30:12 +05:30
Manish Goregaokar 1f2b3ebd7b Rollup merge of #22744 - alexcrichton:issue-22738, r=aturon
Currently we have a `set_mode` mutator, so this just adds the pairing of a
`mode` accessor to read the value.

Closes #22738
2015-02-25 10:30:01 +05:30
Manish Goregaokar ecaf74ab3b Rollup merge of #22742 - alexcrichton:issue-22737, r=aturon
If the filename for a path is `None` then we know that the creation of the
parent directory created the whole path so there's no need to retry the call to
`create_dir`.

Closes #22737
2015-02-25 10:29:53 +05:30
Manish Goregaokar 6c6f2317ba Rollup merge of #22729 - alexcrichton:ptr-stabilization, r=aturon
Specifically, the following actions were takend:

* The `copy_memory` and `copy_nonoverlapping_memory` functions
  to drop the `_memory` suffix (as it's implied by the functionality). Both
  functions are now marked as `#[stable]`.
* The `set_memory` function was renamed to `write_bytes` and is now stable.
* The `zero_memory` function is now deprecated in favor of `write_bytes`
  directly.
* The `Unique` pointer type is now behind its own feature gate called `unique`
  to facilitate future stabilization.

[breaking-change]
2015-02-25 10:29:46 +05:30
Manish Goregaokar b18584cbd9 Rollup merge of #22727 - alexcrichton:prep-env, r=aturon
This commit moves `std::env` away from the `std::old_io` error type as well as
the `std::old_path` module. Methods returning an error now return `io::Error`
and methods consuming or returning paths use `std::path` instead of
`std::old_path`. This commit does not yet mark these APIs as `#[stable]`.

This commit also migrates `std::old_io::TempDir` to `std::fs::TempDir` with
essentially the exact same API. This type was added to interoperate with the new
path API and has its own `tempdir` feature.

Finally, this commit reverts the deprecation of `std::os` APIs returning the old
path API types. This deprecation can come back once the entire `std::old_path`
module is deprecated.

[breaking-change]
2015-02-25 10:29:39 +05:30
Manish Goregaokar 7b7cf84975 Rollup merge of #22596 - alexcrichton:fix-some-impls, r=huonw
This commit removes many unnecessary `unsafe impl` blocks as well as pushing the
needed implementations to the lowest level possible. I noticed that the bounds
for `RwLock` are a little off when reviewing #22574 and wanted to ensure that we
had our story straight on these implementations.
2015-02-25 10:29:32 +05:30
Manish Goregaokar c950ee93c9 Rollup merge of #22157 - tbu-:pr_debug_collections, r=alexcrichton
r? @Gankro
2015-02-25 10:29:23 +05:30
Manish Goregaokar 1c97ac3d12 Rollup merge of #22792 - semarie:openbsd-unbreak-nacl, r=alexcrichton
The recent commit on liblibc for nacl break the compilation for OpenBSD (and Bitrig too, I think).

The problem is `ino_t` come from another block too now. This patch remove the extra declaration.

```
.../src/liblibc/lib.rs:98:9: 98:37 error: a type named `ino_t` has already been imported in this module [E0251]
.../src/liblibc/lib.rs:98 pub use types::os::arch::posix01::*;
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
```

@dhuseby do you have this problem too ? and if yes, does this patch correct it ?
2015-02-25 10:27:30 +05:30
Manish Goregaokar 3a49c3bd9c Rollup merge of #22785 - nikomatsakis:issue-21750-normalization-with-regions, r=pnkfelix
Two changes:

1. Make traits with assoc types invariant w/r/t their inputs.
2. Fully normalize parameter environments, including any region variables (which were being overlooked).

The former supports the latter, but also just seems like a reasonably good idea.

Fixes #21750

cc @edwardw
r? @pnkfelix
2015-02-25 10:27:24 +05:30
Manish Goregaokar 267c5873e2 Rollup merge of #22784 - rnestler:fix_doc_faq, r=dotdash
According to #22650 and bb0bbf639e the
link changed.
I think this should fix the link on http://doc.rust-lang.org/#faqs
2015-02-25 10:27:17 +05:30
Manish Goregaokar 24fc50d295 Rollup merge of #22783 - alexcrichton:deprecate-taskpool, r=alexcrichton
Rather than stabilize on the current API, we're going to punt this
concern to crates.io, to allow for faster iteration.

[breaking-change]
2015-02-25 10:27:11 +05:30
Manish Goregaokar 9692f3bc94 Rollup merge of #22635 - kmcallister:macros-chapter, r=steveklabnik
r? @steveklabnik
2015-02-25 10:27:03 +05:30
bors 880fb89bde Auto merge of #22512 - nikomatsakis:issue-20300-where-clause-not-bounds, r=nikomatsakis
This is a fix for #20300 though as a side-sweep it fixes a number of stack overflows because it integrates cycle detection into the conversion process. I didn't go through and retest everything.

The tricky part here is that in some cases we have to go find the information we need from the AST -- we can't use the converted form of the where-clauses because we often have to handle something like `T::Item` *while converting the where-clauses themselves*. Since this is also not a fixed-point process we can't just try and keep trying to find the best order. So instead I modified the `AstConv` interface to allow you to request the bounds for a type parameter; we'll then do a secondary scan of the where-clauses to figure out what we need. This may create a cycle in some cases, but we have code to catch that.

Another approach that is NOT taken by this PR would be to "convert" `T::Item` into a form that does not specify what trait it's using. This then kind of defers the problem of picking the trait till later. That might be a good idea, but it would make normalization and everything else much harder, so I'm holding off on that (and hoping to find a better way for handling things like `i32::T`).

This PR also removes "most of" the `bounds` struct from `TypeParameterDef`. Still a little ways to go before `ParamBounds` can be removed entirely -- it's used for supertraits, for example (though those really ought to be converted, I think, to a call to `get_type_parameter_bounds` on `Self` from within the trait definition).

cc @jroesch 

Fixes #20300
2015-02-25 04:28:23 +00:00
Sébastien Marie 91e00f3bfa unbreak openbsd after nacl intergration 2015-02-25 05:07:40 +01:00
Felix S. Klock II 5d7e283ead Turn unsafe_no_drop_flag back into a gated-feature.
Fix #22173
2015-02-25 01:35:41 +01:00
Keegan McAllister 848a7e6921 Enhance and move information about macro debugging
Fixes #22424.
2015-02-24 16:34:18 -08:00
Keegan McAllister df0865754e Tweak wording in the macros guide 2015-02-24 16:28:54 -08:00
Keegan McAllister 1804242a2d Add a second, more vexing section on recursive macros
Fixes #22423.
2015-02-24 16:28:54 -08:00
Keegan McAllister 65e1e6bb94 Add a section on recursive macros 2015-02-24 16:28:54 -08:00
Alex Crichton 2d200c9c8b std: Move std::env to the new I/O APIs
This commit moves `std::env` away from the `std::old_io` error type as well as
the `std::old_path` module. Methods returning an error now return `io::Error`
and methods consuming or returning paths use `std::path` instead of
`std::old_path`. This commit does not yet mark these APIs as `#[stable]`.

This commit also migrates `std::old_io::TempDir` to `std::fs::TempDir` with
essentially the exact same API. This type was added to interoperate with the new
path API and has its own `tempdir` feature.

Finally, this commit reverts the deprecation of `std::os` APIs returning the old
path API types. This deprecation can come back once the entire `std::old_path`
module is deprecated.

[breaking-change]
2015-02-24 15:27:42 -08:00
Niko Matsakis 206c2546c0 Improve debug output from coherence. 2015-02-24 18:21:20 -05:00
Niko Matsakis eb841fc44a Resolve regions too when normalizing param env. 2015-02-24 18:21:20 -05:00
Niko Matsakis db6ae66764 Make traits with assoc types invariant in their inputs. 2015-02-24 18:21:20 -05:00
Tobias Bucher 870ad3bc75 Change Debug implementation of BTree* as well 2015-02-24 23:47:31 +01:00
Tobias Bucher 408f7b5747 Modify collection's Debug output to resemble in their content only 2015-02-24 23:47:31 +01:00
Raphael Nestler 14c76834fe Fix "How to submit a bug report" link
According to #22650 and bb0bbf639e the
link changed
2015-02-24 23:26:25 +01:00
Alex Crichton 27f8708ba4 std: Recomend threadpool on crates.io for TaskPool 2015-02-24 14:24:15 -08:00
Alex Crichton ab45694198 std: Stabilize some ptr functions
Specifically, the following actions were taken:

* The `copy_memory` and `copy_nonoverlapping_memory` functions
  to drop the `_memory` suffix (as it's implied by the functionality). Both
  functions are now marked as `#[stable]`.
* The `set_memory` function was renamed to `write_bytes` and is now stable.
* The `zero_memory` function is now deprecated in favor of `write_bytes`
  directly.
* The `Unique` pointer type is now behind its own feature gate called `unique`
  to facilitate future stabilization.
* All type parameters now are `T: ?Sized` wherever possible and new clauses were
  added to the `offset` functions to require that the type is sized.

[breaking-change]
2015-02-24 14:22:33 -08:00
Manish Goregaokar b711b6a5b2 Rollup merge of #22778 - mzabaluev:leftover-lifetime, r=alexcrichton 2015-02-25 03:21:50 +05:30