Commit Graph

35026 Commits

Author SHA1 Message Date
Alex Crichton
b095eb1720 rollup merge of #19300: killercup/patch-1
Just saw this when looking at #19297 and couldn't find an issue/PR dealing with this. #18773 seems to have missed this file.

Compiler output is generated [here](770378a313/src/librustc_trans/driver/mod.rs (L466)).

cc @steveklabnik
2014-11-26 16:49:48 -08:00
Alex Crichton
24349fbeae rollup merge of #19299: nikomatsakis/stop-indenting-test-output
This fixes a long-time irritant of mine. Inserting tabs causes M-x next-error to not work in emacs and seems to serve relatively little purpose in improving overall readability.

r? @brson
2014-11-26 16:49:48 -08:00
Alex Crichton
f4a775639c rollup merge of #19298: nikomatsakis/unboxed-closure-parse-the-plus
Implements RFC 438.

Fixes #19092.

This is a [breaking-change]: change types like `&Foo+Send` or `&'a mut Foo+'a` to `&(Foo+Send)` and `&'a mut (Foo+'a)`, respectively.

r? @brson
2014-11-26 16:49:46 -08:00
Alex Crichton
702127f6f1 rollup merge of #19296: csouth3/trieset-union
TrieSet doesn't yet have union, intersection, difference, and symmetric difference functions implemented.  Luckily, TrieSet is largely similar to TreeSet, so I was able to reference the implementations of these functions in the latter, and adapt them as necessary to make them work for TrieSet.

One thing that I thought was interesting is that the Iterator yielded by `iter()` for TrieSet iterates over the set's values directly rather than references to the values (whereas I think in most cases I see the Iterator given by `iter()` iterating over immutable references), so for consistency within TrieSet's interface, all of these Iterators also iterate over the values directly.  Let me know if all of these should be instead iterating over references.
2014-11-26 16:49:36 -08:00
Alex Crichton
f40fa8304f rollup merge of #19288: steveklabnik/doc_style_cleanup
This is considered good convention.

This is about half of them in total, I just don't want an impossible to land patch. 😄
2014-11-26 16:49:36 -08:00
Alex Crichton
34b98b306a rollup merge of #19287: alexcrichton/issue-19272
At the same time remove the `pub use` of the variants in favor of accessing
through the enum type itself. This is a breaking change as the `Found` and
`NotFound` variants must now be imported through `BinarySearchResult` instead of
just `std::slice`.

[breaking-change]
Closes #19271
2014-11-26 16:49:36 -08:00
Alex Crichton
60299d75e2 rollup merge of #19282: steveklabnik/remove_grammar
I stumbled across this today, and it's not really working. It's been around for a very, very long time, and seems to be based on stuff we don't even have anymore.

I asked in `#rust-internals`, and @cmr said we should just kill it, so here I am. :) I don't think that anything else uses Java, but maybe I missed something.

And if this _isn't_ what we want, I'm fine with closing too. Just some housekeeping.
2014-11-26 16:49:36 -08:00
Alex Crichton
3649c2a39f rollup merge of #19273: ogham/rename-file-types
All of the enum components had a redundant 'Type' specifier: TypeSymlink, TypeDirectory, TypeFile. This change removes them, replacing them with a namespace: FileType::Symlink, FileType::Directory, and FileType::RegularFile.

RegularFile is used instead of just File, as File by itself could be mistakenly thought of as referring to the struct.

Part of #19253.
2014-11-26 16:49:35 -08:00
Alex Crichton
52d4526e1b rollup merge of #19272: tomjakubowski/rustdoc-sized
Both `trait Foo for Sized?` and `<Sized? T>` are handled correctly.

Fix #18515
2014-11-26 16:49:35 -08:00
Alex Crichton
51d146a56a rollup merge of #19266: aochagavia/const
With this PR, the following code works:

```
#![feature(tuple_indexing)]
struct MyStruct { field1: uint }

const S: MyStruct = MyStruct { field1: 42u };
const T: (uint,) = (42u,);

struct ConstCheck {
    array1: [int, ..S.field1],
    array2: [int, ..T.0],
}
```

Closes https://github.com/rust-lang/rust/issues/19244
Related https://github.com/rust-lang/rust/issues/19265
2014-11-26 16:49:35 -08:00
Alex Crichton
74f0ceba6c rollup merge of #19231: Gankro/ringbuf-into-iter
r? @huonw @csherratt
2014-11-26 16:49:35 -08:00
Alex Crichton
97495da163 rollup merge of #19224: frewsxcv/unprefix-json-types
Addressing the issues brought up in [this thread](https://github.com/rust-lang/rust/pull/19114#discussion_r20614461)

This pull request:

* Unpublicizes reexports
* Renames type aliases:
 * `json::JsonArray` ☞ `json::Array`
 * `json::JsonObject` ☞ `json::Object`
2014-11-26 16:49:35 -08:00
Tom Jakubowski
c4da418b25 rustdoc: inherited vis. for struct variant fields
Teach rustdoc that struct variant fields have inherited visibility.

Fix #19048
2014-11-26 15:58:20 -08:00
Simon Sapin
104b3ab6a0 Update docstrings for UnicodeChar::is_digit => is_numeric rename 2014-11-26 23:42:54 +00:00
bors
fac5a07679 auto merge of #19115 : jakub-/rust/issue-19100, r=alexcrichton
...of the type being matched.

This change will result in a better diagnostic for code like the following:

```rust
enum Enum {
    Foo,
    Bar
}

fn f(x: Enum) {
    match x {
        Foo => (),
        Bar => ()
    }
}
```

which would currently simply fail with an unreachable pattern error
on the 2nd arm.

The user is advised to either use a qualified path in the patterns
or import the variants explicitly into the scope.
2014-11-26 22:37:06 +00:00
Jakub Bukaj
9d01db1966 Do not print any warnings if '-A warnings' is specified on the command line 2014-11-26 22:21:52 +00:00
Jakub Bukaj
5804a30686 Warn on pattern bindings that have the same name as a variant
...of the type being matched.

This change will result in a better diagnostic for code like the following:

```rust
enum Enum {
    Foo,
    Bar
}

fn f(x: Enum) {
    match x {
        Foo => (),
        Bar => ()
    }
}
```

which would currently simply fail with an unreachable pattern error
on the 2nd arm.

The user is advised to either use a qualified path in the patterns
or import the variants explicitly into the scope.
2014-11-26 22:21:52 +00:00
bors
6faff24ec8 auto merge of #19144 : michaelwoerister/rust/lldb-scripts, r=alexcrichton
This PR adds the `rust-lldb` script (feel free to bikeshed about the name).
The script will start LLDB and, before doing anything else, load [LLDB type summaries](http://lldb.llvm.org/varformats.html) that will make LLDB print values with Rust syntax. Just use the script like you would normally use LLDB:

```
rust-lldb executable-to-debug --and-any-other-commandline --args 
```
The script will just add one additional commandline argument to the LLDB invocation and pass along the rest of the arguments to LLDB after that.

Given the following program...
```rust
fn main() {
	let x = Some(1u);
	let y = [0, 1, 2i];
	let z = (x, y);

	println!("{} {} {}", x, y, z);
}
```
...*without* the 'LLDB type summaries', values will be printed something like this...
```
(lldb) p x
(core::option::Option<uint>) $3 = {
   = (RUST$ENUM$DISR = Some)
   = (RUST$ENUM$DISR = Some, 1)
}
(lldb) p y
(long [3]) $4 = ([0] = 0, [1] = 1, [2] = 2)
(lldb) p z
((core::option::Option<uint>, [int, ..3])) $5 = {
   = {
     = (RUST$ENUM$DISR = Some)
     = (RUST$ENUM$DISR = Some, 1)
  }
   = ([0] = 0, [1] = 1, [2] = 2)
}
```
...*with* the 'LLDB type summaries', values will be printed like this:
```
(lldb) p x
(core::option::Option<uint>) $0 = Some(1)
(lldb) p y
(long [3]) $1 = [0, 1, 2]
(lldb) p z
((core::option::Option<uint>, [int, ..3])) $2 = (Some(1), [0, 1, 2])
```

The 'LLDB type summaries' used by the script have been in use for a while in the LLDB autotests but I still consider them to be of alpha-version quality. If you see anything weird when you use them, feel free to file an issue.

The script will use whatever Rust "installation" is in PATH, so whichever `rustc` will be called if you type `rustc` into the console, this is the one that the script will ask for the LLDB extension module location. The build system will take care of putting the script and LLDB python module in the right places, whether you want to use the stage1 or stage2 compiler or the one coming with `make install` / `rustup.sh`.

Since I don't have much experience with the build system, Makefiles and shell scripts, please look these changes over carefully.
2014-11-26 20:12:09 +00:00
Steve Klabnik
e2fe7a083e Lifetime guide -> ownership guide 2014-11-26 15:03:12 -05:00
Steven Fackler
348cc9418a Remove special casing for some meta attributes
Descriptions and licenses are handled by Cargo now, so there's no reason
to keep these attributes around.
2014-11-26 11:44:45 -08:00
bors
1a44875af9 auto merge of #19176 : aturon/rust/stab-iter, r=alexcrichton
This is an initial pass at stabilizing the `iter` module. The module is
fairly large, but is also pretty polished, so most of the stabilization
leaves things as they are.

Some changes:

* Due to the new object safety rules, various traits needs to be split
  into object-safe traits and extension traits. This includes `Iterator`
  itself. While splitting up the traits adds some complexity, it will
  also increase flexbility: once we have automatic impls of `Trait` for
  trait objects over `Trait`, then things like the iterator adapters
  will all work with trait objects.

* Iterator adapters that use up the entire iterator now take it by
  value, which makes the semantics more clear and helps catch bugs. Due
  to the splitting of Iterator, this does not affect trait objects. If
  the underlying iterator is still desired for some reason, `by_ref` can
  be used. (Note: this change had no fallout in the Rust distro except
  for the useless mut lint.)

* In general, extension traits new and old are following an [in-progress
  convention](rust-lang/rfcs#445). As such, they
  are marked `unstable`.

* As usual, anything involving closures is `unstable` pending unboxed
  closures.

* A few of the more esoteric/underdeveloped iterator forms (like
  `RandomAccessIterator` and `MutableDoubleEndedIterator`, along with
  various unfolds) are left experimental for now.

* The `order` submodule is left `experimental` because it will hopefully
  be replaced by generalized comparison traits.

* "Leaf" iterators (like `Repeat` and `Counter`) are uniformly
  constructed by free fns at the module level. That's because the types
  are not otherwise of any significance (if we had `impl Trait`, you
  wouldn't want to define a type at all).

Closes #17701

Due to renamings and splitting of traits, this is a:

[breaking-change]
2014-11-26 17:42:07 +00:00
Michael Woerister
67ba096cc3 debuginfo: Fix LLDB pretty printer for enum variants with zero fields. 2014-11-26 17:42:32 +01:00
Niko Matsakis
21d5d139fc Add tests for the parsing of + and the error messages if people get it wrong.
Fixes #18772.
2014-11-26 11:42:06 -05:00
Niko Matsakis
1479a909bb Fix odd example where bounds were permitted and then ignored 2014-11-26 11:42:06 -05:00
Niko Matsakis
bc2356558d Fix rustdoc 2014-11-26 11:42:06 -05:00
Niko Matsakis
c4a3be6bd1 Rote changes due to the fact that ast paths no longer carry this extraneous bounds. 2014-11-26 11:42:06 -05:00
Niko Matsakis
f4e29e7e9a Fixup various places that were doing &T+'a and do &(T+'a) 2014-11-26 11:42:06 -05:00
Niko Matsakis
74a1041a4d Implement the new parsing rules for types in the parser, modifying the AST appropriately. 2014-11-26 11:42:05 -05:00
Corey Farwell
ce238d752b Unpublicize reexports, unprefix JSON type aliases
The type aliases json::JsonString and json::JsonObject were originally
prefixed with 'json' to prevent collisions with (at the time) the enums
json::String and json::Object respectively. Now that enum namespacing
has landed, this 'json' prefix is redundant and can be removed:

json::JsonArray -> json::Array
json::JsonObject -> json::Object

In addition, this commit also unpublicizes all of the re-exports in this
JSON module, as a part of #19253

[breaking-change]
2014-11-26 11:19:54 -05:00
bors
930f87774d auto merge of #19262 : murarth/rust/module-path-fix, r=jakub-
Closes #18859
2014-11-26 15:07:23 +00:00
Michael Woerister
7608d06027 debuginfo: Add script that allows to conveniently start LLDB in "rust-mode" 2014-11-26 15:58:17 +01:00
Michael Woerister
f19e6d71cd Add -Z print-sysroot commandline option to rustc. 2014-11-26 15:58:17 +01:00
Andrew Paseltiner
b7520f595f fix errors in the guide
- `s/(left|right) hand/\1-hand/`
- `s/parenthesis/parentheses/`
- `s/unicode/Unicode/`
- `s/validly-encoded/validly encoded/`
2014-11-26 08:41:40 -05:00
bors
8fb027e398 auto merge of #19252 : japaric/rust/cow, r=aturon
- Add `IntoCow` trait, and put it in the prelude
- Add `is_owned`/`is_borrowed` methods to `Cow`
- Add `CowString`/`CowVec` type aliases (to `Cow<'_, String, str>`/`Cow<'_, Vec, [T]>` respectively)
- `Cow` implements: `Show`, `Hash`, `[Partial]{Eq,Ord}`
- `impl BorrowFrom<Cow<'a, T, B>> for B`

[breaking-change]s:

- `IntoMaybeOwned` has been removed from the prelude
- libcollections: `SendStr` is now an alias to `CowString<'static>` (it was aliased to `MaybeOwned<'static>`)
- libgraphviz:
  - `LabelText` variants now wrap `CowString` instead of `MaybeOwned`
  - `Nodes` and `Edges` are now type aliases to `CowVec` (they were aliased to `MaybeOwnedVec`)
- libstd/path: `Display::as_maybe_owned` has been renamed to `Display::as_cow` and now returns a `CowString`
- These functions now accept/return `Cow` instead of `MaybeOwned[Vector]`:
  - libregex: `Replacer::reg_replace`
  - libcollections: `str::from_utf8_lossy`
  - libgraphviz: `Id::new`, `Id::name`, `LabelText::pre_escaped_content`
  - libstd: `TaskBuilder::named`

r? @aturon
2014-11-26 12:02:16 +00:00
bors
61af402789 auto merge of #19169 : aturon/rust/fds, r=alexcrichton
This PR adds some internal infrastructure to allow the private `std::sys` module to access internal representation details of `std::io`.

It then exposes those details in two new, platform-specific API surfaces: `std::os::unix` and `std::os::windows`.

To start with, these will provide the ability to extract file descriptors, HANDLEs, SOCKETs, and so on from `std::io` types.

More functionality, and more specific platforms (e.g. `std::os::linux`) will be added over time.

Closes #18897
2014-11-26 08:42:09 +00:00
bors
8d7b3199d9 auto merge of #19212 : steveklabnik/rust/doc_format_specifiers, r=alexcrichton
Fixes #19209
2014-11-26 06:42:06 +00:00
Chase Southwood
d48886cc88 Make BinaryHeap's Items iterator implement DoubleEnded and ExactSize 2014-11-25 21:41:23 -06:00
Steve Klabnik
f38e4e6d97 /** -> ///
This is considered good convention.
2014-11-25 21:24:16 -05:00
Steve Klabnik
7dadb14fb2 remove deprecated stuff from std::fmt docs
Fixes #19209
2014-11-25 21:19:28 -05:00
Aaron Turon
b299c2b57d Fallout from stabilization 2014-11-25 17:41:54 -08:00
Aaron Turon
a86f72d9a2 libs: stabilize iter module
This is an initial pass at stabilizing the `iter` module. The module is
fairly large, but is also pretty polished, so most of the stabilization
leaves things as they are.

Some changes:

* Due to the new object safety rules, various traits needs to be split
  into object-safe traits and extension traits. This includes `Iterator`
  itself. While splitting up the traits adds some complexity, it will
  also increase flexbility: once we have automatic impls of `Trait` for
  trait objects over `Trait`, then things like the iterator adapters
  will all work with trait objects.

* Iterator adapters that use up the entire iterator now take it by
  value, which makes the semantics more clear and helps catch bugs. Due
  to the splitting of Iterator, this does not affect trait objects. If
  the underlying iterator is still desired for some reason, `by_ref` can
  be used. (Note: this change had no fallout in the Rust distro except
  for the useless mut lint.)

* In general, extension traits new and old are following an [in-progress
  convention](https://github.com/rust-lang/rfcs/pull/445). As such, they
  are marked `unstable`.

* As usual, anything involving closures is `unstable` pending unboxed
  closures.

* A few of the more esoteric/underdeveloped iterator forms (like
  `RandomAccessIterator` and `MutableDoubleEndedIterator`, along with
  various unfolds) are left experimental for now.

* The `order` submodule is left `experimental` because it will hopefully
  be replaced by generalized comparison traits.

* "Leaf" iterators (like `Repeat` and `Counter`) are uniformly
  constructed by free fns at the module level. That's because the types
  are not otherwise of any significance (if we had `impl Trait`, you
  wouldn't want to define a type at all).

Closes #17701

Due to renamings and splitting of traits, this is a:

[breaking-change]
2014-11-25 17:41:25 -08:00
Steven Fackler
945b4edd67 Allow mutable access to wrapped internal type in Buffered*
This is necessary to e.g. set a timeout on the underlying stream.
2014-11-25 17:39:53 -08:00
Richard Diamond
ce507c6c22 Don't forget the tests. 2014-11-25 19:05:28 -06:00
Huon Wilson
4653ad0205 Make syntax::owned_slice a Box<[T]> wrapper.
This makes it correct (e.g. avoiding null pointers) and safe.
2014-11-26 11:55:39 +11:00
Ulysse Carion
6cb03baffa Fix formatting of the pointers guide. 2014-11-25 16:32:53 -08:00
Richard Diamond
f17faf49be Never generate multiple extern {} blocks in mklldeps.py. 2014-11-25 17:53:05 -06:00
Richard Diamond
80d520fcf2 Don't use the same llvmdeps.rs for every host. 2014-11-25 17:28:49 -06:00
bors
eedfc07796 auto merge of #19011 : ricky26/rust/trait_supertraits, r=nikomatsakis
It looks like currently kinds required by traits are not propagated when they are wrapped in a TyTrait. Additionally, in SelectionContext::builtin_bound, no attempt is made to check whether the target trait or its supertraits require the kind specified.

This PR alters SelectionContext::builtin_bound to examine all supertraits in the target trait's bounds recursively for required kinds.

Alternatively, the kinds could be added to the TyTrait upon creation (by just setting its builtin_bounds to the union of the bounds requested in this instance and the bounds required by the trait), this option may have less overhead during compilation but information is lost about which kinds were explicitly requested for this instance (vs those specified by traits/supertraits) would be lost.
2014-11-25 22:36:59 +00:00
Steve Klabnik
a1d983aa16 Document liballoc::rc
This commit introduces a bunch of documentation, fixes some consistency
issues, and just basically brings Rc<T> and Weak<T> up to snuff.
2014-11-25 15:49:51 -05:00
bors
689ef2dabf auto merge of #19255 : aturon/rust/merge-sync, r=alexcrichton,alexcrichton
This patch merges the `libsync` crate into `libstd`, undoing part of the
facade. This is in preparation for ultimately merging `librustrt`, as
well as the upcoming rewrite of `sync`.

Because this removes the `libsync` crate, it is a:

[breaking-change]

However, all uses of `libsync` should be able to reroute through
`std::sync` and `std::comm` instead.

r? @alexcrichton
2014-11-25 20:32:20 +00:00