Commit graph

38103 commits

Author SHA1 Message Date
bors
0b6dbbc9cf Auto merge of #21949 - japaric:index, r=nikomatsakis
closes #21630

Overloaded indexing (`&[mut] foo[bar]`) only works when `<Self as Index>::Output` is the same as `<Self as IndexMut>::Output` (see issue above). To restrict implementations of `IndexMut` that doesn't work, this PR makes `IndexMut` a supertrait over `Index`, i.e. `trait IndexMut<I>: Index<I>`, just like in the `trait DerefMut: Deref` case.

This breaks all downstream implementations of `IndexMut`, in most cases this simply means removing the `type Output = ..` bit, which is now redundant, from `IndexMut` implementations:

``` diff
 impl Index<Foo> for Bar {
     type Output = Baz;
     ..
 }

 impl IndexMut<Foo> for Bar {
-    type Output = Baz;
     ..
 }
```

[breaking-change]

---

r? @nikomatsakis
2015-02-07 04:14:22 +00:00
Jorge Aparicio
724bf7bce2 make IndexMut a super trait over Index
closes #21630
2015-02-06 21:11:59 -05:00
bors
7ebf9bc5c2 Auto merge of #21505 - GuillaumeGomez:interned_string, r=alexcrichton
It's in order to make the code more homogeneous.
2015-02-07 02:04:47 +00:00
bors
d3732a12e8 Auto merge of #21997 - Manishearth:rollup, r=alexcrichton
None
2015-02-06 23:30:17 +00:00
GuillaumeGomez
a2e01c62d5 librustdoc has been updated
Fixes run build error

Fix test failure

Fix tests' errors
2015-02-06 22:54:41 +01:00
bors
b75b21cb9b Auto merge of #21926 - mzabaluev:raw-lifetime, r=alexcrichton
New functions, `slice::from_raw_parts` and `slice::from_raw_parts_mut`,
are added to implement the lifetime convention as agreed in rust-lang/rfcs#556.
The functions `slice::from_raw_buf` and `slice::from_raw_mut_buf` are
left deprecated for the time being.

Holding back on changing the signature of `std::ffi::c_str_to_bytes` as consensus in rust-lang/rfcs#592 is building to replace it with a composition of other functions.

Contribution to #21923.
2015-02-06 19:49:31 +00:00
Manish Goregaokar
df7db970dc Rollup merge of #22009 - japaric:no-mov, r=alexcrichton
If you were still using `MaybeOwnedVector`, update your code to use `CowVec`.

[breaking-change]

---

We already removed `MaybeOwned` (the string equivalent) long time ago and with a much shorter deprecation period. It's time to let go.
2015-02-07 00:44:31 +05:30
Manish Goregaokar
fc1e045d83 Rollup merge of #22005 - nagisa:obsolete-ctx, r=alexcrichton
The word is repeated twice in the message like:

    error: obsolete syntax: `:`, `&mut:`, or `&:` syntax

This removes the word syntax that appears in messages after the second colon (:).
2015-02-07 00:44:14 +05:30
Manish Goregaokar
0346bcf44d Rollup merge of #21994 - iKevinY:featureck-fix, r=brson
It seems that `lang_feature_stats` was supposed to refer to `language_feature_stats` instead.

r? @brson
2015-02-07 00:43:54 +05:30
Alexis
e15538d7ac fix outdated docs
Conflicts:
	src/libstd/collections/mod.rs
2015-02-07 00:42:29 +05:30
Alexis
3a9b4e5f8d fix outdated docs
Conflicts:
	src/libstd/collections/mod.rs
2015-02-07 00:31:20 +05:30
Manish Goregaokar
e5f25244f1 More libcollections fixes 2015-02-06 23:36:02 +05:30
bors
7884eb8e2f Auto merge of #21860 - mdinger:enum_rewording, r=steveklabnik
Second try to address https://github.com/rust-lang/rust/issues/21196 . A lot that was removed at the end basically seemed repetitive showing simple variations on the same type. It seems more effective to just show more variants at the beginning instead.

If you want to pack values into an example, better to use `i32` or some digit than `String` because you don't need the `to_string()` method.

I didn't mention `derive` because:
* I can't explain it (only use it)
* I don't have a link to a good description (maybe rustbyexample but you probably want links internal)
* Giving more detail especially stating that `==` won't work and why should help quite a bit

I didn't `make test` or check links but I will if this will be merged.

@steveklabnik
2015-02-06 17:45:19 +00:00
Jorge Aparicio
67ee26d94e remove the deprecated MaybeOwnedVector 2015-02-06 10:00:17 -05:00
Simonas Kazlauskas
1589dcf944 Remove word syntax from obsolete syntax messages
The word is repeated twice in the message like

    error: obsolete syntax: `:`, `&mut:`, or `&:` syntax

This removes the word syntax that appears in messages after the second colon (:).
2015-02-06 16:25:39 +02:00
Manish Goregaokar
1a2b602675 Rollup merge of #21991 - steveklabnik:gh21915, r=huonw
Fixes #21915
2015-02-06 19:42:34 +05:30
Manish Goregaokar
40d1b23fdd rm unused feature 2015-02-06 19:42:33 +05:30
Manish Goregaokar
f7aac937f5 libcollections: unit test fixes 2015-02-06 19:42:33 +05:30
Alexis
73b9aeb429 remove int_uint feature from libcollections 2015-02-06 19:42:33 +05:30
Manish Goregaokar
c4e12c1536 Rollup merge of #21989 - steveklabnik:gh21491, r=Gankro
Fixes #21491

r? @kmcallister @Gankro
2015-02-06 19:42:32 +05:30
bors
0b56e9b1cb Auto merge of #21962 - vrinek:printable-book, r=steveklabnik
Tested on:

* Safari on OSX
* Firefox on OSX
2015-02-06 13:57:11 +00:00
GuillaumeGomez
9e20035e33 Fix infinite loop error 2015-02-06 12:03:48 +01:00
GuillaumeGomez
b0b4136d45 Remove getenv warning 2015-02-06 12:03:48 +01:00
GuillaumeGomez
7b973ba827 Update to last version, remove "[]" as much as possible 2015-02-06 12:03:46 +01:00
GuillaumeGomez
93fe5c82bf librustc_driver has been updated 2015-02-06 12:01:58 +01:00
GuillaumeGomez
b0097783b9 librustc_trans has been updated 2015-02-06 12:01:57 +01:00
GuillaumeGomez
1ff6e5356c librustc_resolve has been updated 2015-02-06 12:01:14 +01:00
GuillaumeGomez
4b6632d82d librustc_typeck has been updated 2015-02-06 12:00:27 +01:00
GuillaumeGomez
0f09021b37 librustc_borrowck has been updated 2015-02-06 11:59:11 +01:00
GuillaumeGomez
664c41b427 librustc has been updated 2015-02-06 11:59:10 +01:00
GuillaumeGomez
8b12d3ddf9 Libsyntax has been updated 2015-02-06 11:59:10 +01:00
GuillaumeGomez
12f1f4c546 Update HEAD:master 2015-02-06 11:59:10 +01:00
GuillaumeGomez
d58c0a7597 Replace the get method by the deref one on InternedString 2015-02-06 11:59:10 +01:00
GuillaumeGomez
966e6c0c37 Add Str trait to InternedString, set get method deprecated 2015-02-06 11:59:09 +01:00
Manish Goregaokar
703364f214 Rollup merge of #21968 - nikomatsakis:issue-21965-duplicate-preds-in-env, r=pnkfelix
We were already building a hashset to check for duplicates, but we assumed that the initial vector had no duplicates. Fixes #21965.

r? @pnkfelix
2015-02-06 16:21:13 +05:30
Manish Goregaokar
dfc92656e5 Rollup merge of #21966 - scialex:fix-extern, r=alexcrichton
Also added test for it.

Fixes #21928
2015-02-06 16:21:12 +05:30
Manish Goregaokar
8e4c00b939 Rollup merge of #21958 - brson:stable-features, r=alexcrichton
....

The 'stable_features' lint helps people progress from unstable to
stable Rust by telling them when they no longer need a `feature`
attribute because upstream Rust has declared it stable.

This compares to the existing 'unstable_features' lint, which is used
to implement feature staging, and triggers on *any* use
of `#[feature]`.
2015-02-06 16:21:11 +05:30
Manish Goregaokar
6c28ad61a2 Rollup merge of #21926 - mzabaluev:raw-lifetime, r=alexcrichton
New functions, `slice::from_raw_parts` and `slice::from_raw_parts_mut`,
are added to implement the lifetime convention as agreed in rust-lang/rfcs#556.
The functions `slice::from_raw_buf` and `slice::from_raw_mut_buf` are
left deprecated for the time being.

Holding back on changing the signature of `std::ffi::c_str_to_bytes` as consensus in rust-lang/rfcs#592 is building to replace it with a composition of other functions.

Contribution to #21923.
2015-02-06 16:21:10 +05:30
Manish Goregaokar
f6d08b0b17 Rollup merge of #21969 - Gankro:collections-cleanup, r=alexcrichton
This is 99% burning ints to the ground, but I also got rid of useless annotations or made code more \"idiomatic\" as I went along. Mostly changes in tests.
2015-02-06 16:21:09 +05:30
Manish Goregaokar
60cb151be0 Rollup merge of #21924 - steveklabnik:fix_try_docs, r=huonw
This is now a Result, not an Option.
2015-02-06 16:21:09 +05:30
Manish Goregaokar
67b51291f0 Rollup merge of #21925 - sfackler:allow-missing-copy, r=alexcrichton
This was particularly helpful in the time just after OIBIT's
implementation to make sure things that were supposed to be Copy
continued to be, but it's now creates a lot of noise for types that
intentionally don't want to be Copy.

r? @alexcrichton
2015-02-06 16:21:08 +05:30
Manish Goregaokar
cfae247ce0 Rollup merge of #21941 - dotdash:with_cond_false, r=Aatch
Currently \"k / 2\" generates one (k: uint) or two (k: int) \"br false,
...\" instructions and the corresponding basic blocks, producing quite
some noise and making the code unnecessarily hard to read.

Additionally we can skip translation if the code would end up
unreachable anyway.
2015-02-06 16:21:08 +05:30
Manish Goregaokar
d1a1d339ef Rollup merge of #21951 - Gankro:entry, r=aturon
This also removes two erroneous re-exports of the Entry variants, and so is incidentally a [breaking-change], though presumably no one should have been using those.

r? @aturon
2015-02-06 16:21:07 +05:30
Manish Goregaokar
08a2bef632 Rollup merge of #21954 - jbcrail:fix-misspelled-comments, r=steveklabnik
The spelling corrections were made in both documentation comments and
regular comments.
2015-02-06 16:21:06 +05:30
Manish Goregaokar
6bf0cd8f00 Rollup merge of #21955 - jbcrail:fix-test-comments, r=steveklabnik
Just spelling corrections.
2015-02-06 16:21:05 +05:30
Manish Goregaokar
efdf16b72f Rollup merge of #21964 - semarie:openbsd-env, r=alexcrichton
- add `_SC_GETPW_R_SIZE_MAX` constant
- declare `struct passwd`
- convert `load_self` to `current_exe`

Note: OpenBSD don't provide system function to return a valuable Path
for `env::current_exe`. The implementation is currently based on the
value of `argv[0]`, which couldn't be used when executable is called via
PATH.
2015-02-06 16:21:05 +05:30
Manish Goregaokar
5c172ad03c Rollup merge of #21976 - mzabaluev:fix-copy-mut-lifetime, r=alexcrichton
Part of #21923
2015-02-06 16:21:04 +05:30
Manish Goregaokar
ce3a4afd73 Rollup merge of #21980 - pnkfelix:more-robust-span-to-snippet, r=huonw
This can be considered partial work on #8256.

The main observable change: macro expansion sometimes results in spans where `lo > hi`; so for now, when we have such a span, do not attempt to return a snippet result.

(Longer term, we might think about whether we could still present a snippet for the cases where this arises, e.g. perhaps by showing the whole macro as the snippet, assuming that is the sole cause of such spans; or by somehow looking up the closest AST node that holds both `lo` and `hi`, and showing that.)

As a drive-by, revised the API to return a `Result` rather than an `Option`, with better information-packed error value that should help us (and maybe also our users) identify the causes of such problems in the future.  Ideally the call-sites that really want an actual snippet would be updated to catch the newly added `Err` case and print something meaningful about it, but that is not part of this PR.
2015-02-06 16:21:03 +05:30
Manish Goregaokar
60c9f56070 Rollup merge of #21981 - pnkfelix:improve-compile-test-malformed-option-handling, r=huonw
improve `compiletest` error message when path option missing.

I often run `compiletest` by hand by cut-and-pasting from what `make` runs, (which I observe via `remake --trace`), but then I need to tweak it (cut out options) and its useful to be told when I have removed an option that is actually required, such as `--android-cross-path=path`.)
2015-02-06 16:21:03 +05:30
Manish Goregaokar
05e45d094e Rollup merge of #21983 - pnkfelix:eschew-untyped-arena-in-regions-mock-tcx, r=huonw
Ported regions-mock-tcx to use TypedArena rather than Arena since it holds cyclic structure (which the Arena API updated for the Drop-Check-Rule cannot handle).

Plus, the use of `arena::Arena` here really is not justified; the allocated values are all the same type anyway.
2015-02-06 16:21:03 +05:30