Commit Graph

38814 Commits

Author SHA1 Message Date
Manish Goregaokar
a03ce81f92 Rollup merge of #22273 - nagisa:doc-deprecated, r=alexcrichton
Since we don’t have Deprecated stability level anymore, the only other source of information is
deprecated-since version, which conveniently to us, only exists if the symbol is deprecated.

Fixes #21789
2015-02-17 06:23:40 +05:30
Manish Goregaokar
d264ef2b11 Rollup merge of #22313 - japaric:iter, r=aturon
`IntoIterator` now has an extra associated item:

``` rust
trait IntoIterator {
    type Item;
    type IntoIter: Iterator<Self=Self::Item>;
}
```

This lets you bind the iterator \"`Item`\" directly when writing generic functions:

``` rust
// hypothetical change, not included in this PR
impl Extend<T> for Vec<T> {
    // you can now write
    fn extend<I>(&mut self, it: I) where I: IntoIterator<Item=T> { .. }
    // instead of
    fn extend<I: IntoIterator>(&mut self, it: I) where I::IntoIter: Iterator<Item=T> { .. }
}
```

The downside is that now you have to write an extra associated type in your `IntoIterator` implementations:

``` diff
 impl<T> IntoIterator for Vec<T> {
+    type Item = T;
     type IntoIter = IntoIter<T>;

     fn into_iter(self) -> IntoIter<T> { .. }
 }
```

Because this breaks all downstream implementations of `IntoIterator`, this is a [breaking-change]

---

r? @aturon
2015-02-17 06:23:40 +05:30
Manish Goregaokar
e337a5728a Rollup merge of #22326 - semarie:compat-cp, r=alexcrichton
`cp -a` is a GNU extension. Use an alternate combinaison of POSIX options
(`-PRp`) that do nearly the same.

The difference is `-a` will preserve context, links and xattr attributes,
whereas `-p` not. But as we use it only for copy a file, there is no
difference in the current context.
2015-02-17 06:23:40 +05:30
Manish Goregaokar
8a6b724009 Rollup merge of #22344 - nagisa:exactsizediter, r=alexcrichton
Appears to be just an oversight given it is the only method in a stable trait.

r? @aturon because you did final alpha stabilisation of iterators.
2015-02-17 06:23:39 +05:30
Manish Goregaokar
47803212e8 Rollup merge of #22392 - laijs:fix-reference-md-plugin-link, r=steveklabnik
book/syntax-extensions.html was renamed to book/plugins.html,
the link should be also updated.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
2015-02-17 06:23:39 +05:30
Manish Goregaokar
adea99c5d9 Rollup merge of #22378 - jxcl:master, r=steveklabnik
The Rust Programming Language book has no explanation of what `i32` actually means. I have added an explanation for the first time the reader encounters this type.
2015-02-17 06:23:39 +05:30
Manish Goregaokar
47814a4b29 Rollup merge of #22377 - thiagooak:book-glossary, r=steveklabnik
@steveklabnik Trying out the Glossary idea.

Added the paragraph about 'complicated words' because I think it would be useful to those contributing to the book. Maybe this should not be here
2015-02-17 06:23:38 +05:30
Manish Goregaokar
96a4756c21 Rollup merge of #22374 - richo:warn-fixup, r=huonw
This snuck through my refactor.

Would it be worth the effort to have a test pass that attempts to lint the code for all targets, even if it's not feasible to actually build and test it?
2015-02-17 06:23:38 +05:30
Manish Goregaokar
bc0d5456eb Rollup merge of #22373 - bombless:fix-rustbook, r=steveklabnik 2015-02-17 06:23:38 +05:30
Manish Goregaokar
68472441e7 Rollup merge of #22369 - nagisa:docblock-table, r=steveklabnik
Fixes #22357

Before and after:

![screenshot from 2015-02-15 15 53 24](https://cloud.githubusercontent.com/assets/679122/6203452/dbde7324-b52b-11e4-8252-da96a44c1cf3.png)
2015-02-17 06:23:38 +05:30
Manish Goregaokar
fe3b6a1662 Rollup merge of #22368 - thiagooak:book-arity, r=steveklabnik
#21568
2015-02-17 06:23:37 +05:30
Manish Goregaokar
f28d89f6fb Rollup merge of #22366 - dotdash:ret_adjust, r=alexcrichton
Without the adjustments the retslot might have the wrong type, e.g. when
the return value is implicitly coerced to a trait object.

Fixes #22346
2015-02-17 06:23:37 +05:30
Manish Goregaokar
e0477fa7f9 Rollup merge of #22365 - serejkus:configs-link, r=steveklabnik
The book in "hello-world" tells that there are configs for some programs and gives a link to main repo's src/etc. Actually, these configs moved to separate repos some days ago. This PR adds a markdown file with links and moves "hello-world" link about editors to point directly to this new file.
2015-02-17 06:23:37 +05:30
Manish Goregaokar
3e7af91851 Rollup merge of #22363 - semarie:openbsd-test_file_desc, r=alexcrichton
`pipe(2)`, under FreeBSD and OpenBSD return a bidirectionnal pipe. So
reading from the writer would block (waiting data) instead of returning
an error.

like for FreeBSD, disable the test for OpenBSD.
2015-02-17 06:23:36 +05:30
Manish Goregaokar
cdf0cb0a16 Rollup merge of #22360 - wg:master, r=alexcrichton 2015-02-17 06:23:36 +05:30
Manish Goregaokar
1c8e592bb7 Rollup merge of #22353 - tshepang:improve-fs-create-docs, r=alexcrichton 2015-02-17 06:23:36 +05:30
Manish Goregaokar
6cab5bba75 Rollup merge of #22341 - fhahn:issue-22291-PLEASE-FAIL, r=alexcrichton
This is a patch for #22291.

PLEASE_BENCH=1 adds --bench to the arguments passed to the executable to be tested. At the moment, compiletest does not accept a --bench argument, because it is not needed for any test in src/test/, even the tests in src/test/bench do not use #[bench].

I have updated the makefile to only add the --bench flag for crate tests. I do not think that changing compiletest add --bench to the run arguments of all compile tests makes sense, because it would mess up tests which check command line arguments. Also the bench option can be added as comment in a compile test as well.
2015-02-17 06:23:36 +05:30
Manish Goregaokar
b0d2c6a714 Rollup merge of #22294 - nikomatsakis:integer-audit, r=huonw
cc https://github.com/rust-lang/rust/issues/22240
2015-02-17 06:23:35 +05:30
Manish Goregaokar
d660739f9a Rollup merge of #22253 - huonw:unstable-words, r=aturon
It is not totally clear if we should just use whitespace, or if the full
unicode word-breaking algorithm is more correct. If there is demand we
can reconsider this decision (and consider the precise algorithm to use
in detail).

cc #15628.
2015-02-17 06:23:35 +05:30
Steve Klabnik
93633c9c5f fix up style guide .gitignore 2015-02-16 17:33:10 -05:00
Steve Klabnik
3f9b0999d1 clean up README 2015-02-16 17:32:12 -05:00
Ingo Blechschmidt
918d097c8e Tiny typo changes (per discussion in pull request #22027) 2015-02-16 23:13:58 +01:00
Steve Klabnik
96bea5eb72 Import rust-guidlines
at 16fa41b3b0

Fixes #19315
2015-02-16 17:04:16 -05:00
Aaron Turon
4a9dd3f840 Expose more of std::path
This commit exposes the `is_sep` function and `MAIN_SEP` constant, as
well as Windows path prefixes. The path prefix enum is safely exposed on
all platforms, but it only yielded as a component for Windows.

Exposing the prefix enum as part of prefix components involved changing
the type from `OsStr` to the `Prefix` enum, which is a:

[breaking-change]
2015-02-16 13:53:09 -08:00
Manish Goregaokar
f64d71b6ed Add custom_attribute and rustc_attrs to reference.md 2015-02-17 02:26:57 +05:30
Manish Goregaokar
1bbf7187ad Fix tests for rustc_* 2015-02-17 02:26:53 +05:30
bors
81bce5290f Auto merge of #22230 - nikomatsakis:object-lifetime-defaults-2, r=pnkfelix
Implement rules described in rust-lang/rfcs#599.

Fixes https://github.com/rust-lang/rust/issues/22211.

~~Based atop PR https://github.com/rust-lang/rust/pull/22182, so the first few commits (up to and including "Pacify the mercilous nrc") have already been reviewed.~~
2015-02-16 20:31:15 +00:00
Manish Goregaokar
0129002d3a Add gating for rustc_* attrs 2015-02-17 01:52:34 +05:30
posixphreak
c24f35389d rustup: Fix for locale bug
Since `tr` converts lowercase to uppercase according to system locale using `LC_CTYPE` environment variable; on some locales, rustup.sh fails to use correct variables names, thus deletes temporarily downloaded files and gives a meaningless error as shown below. This a simple fix which explictly sets `LC_CTYPE` as `C`.
2015-02-16 22:17:15 +02:00
Florian Hahn
6824f1365d Add pfail targets for parse-fail tests 2015-02-16 20:52:39 +01:00
Florian Hahn
5550bebcaa Move remaning compile-fail tests that are rejected by the parser to parse-fail 2015-02-16 20:52:39 +01:00
Jorge Aparicio
9462a207ff Make orphan check diagnostics clearer
closes #22388
2015-02-16 14:42:20 -05:00
Manish Goregaokar
1fffdafe41 fix linkage tests 2015-02-17 00:49:42 +05:30
GuillaumeGomez
318f262d68 Remove warning instead of implementing Copy trait 2015-02-16 20:03:44 +01:00
Keegan McAllister
6cef0e5dae Rewrite the macros chapter
This is a more introductory document, suitable for Part II.  The arcane details
move to an "Advanced macros" chapter in Part III.
2015-02-16 10:59:40 -08:00
GuillaumeGomez
441e09bc70 Add missing Copy trait for enums 2015-02-16 19:56:58 +01:00
Manish Goregaokar
0112f3b098 move other attribute check to visit_attribute 2015-02-17 00:25:56 +05:30
Manish Goregaokar
5ffb7db423 Add Gated attribute type 2015-02-17 00:25:34 +05:30
Steve Klabnik
5ebf4c4bd5 remove 'crate files' sentence
Fixes #22386
2015-02-16 13:36:18 -05:00
Aaron Turon
411593130d Update std::os deprecation warnings
They now point to the correct locations in std::env
2015-02-16 10:10:35 -08:00
Henrik Schopmans
ad827af11c Fixed typo and removed unfitting 'can' 2015-02-16 17:58:17 +00:00
Niko Matsakis
be7b20e16d Stop advertisting the old_impl_check feature. We can't ENTIRELY
remove it yet, but we don't have to add new uses.
2015-02-16 12:50:42 -05:00
Steve Klabnik
eeee0e8f4c Remove hax
Fixes #19321
2015-02-16 12:45:41 -05:00
Niko Matsakis
503e15b7c9 Address nits by @pnkfelix 2015-02-16 11:58:47 -05:00
bors
e4e7aa2856 Auto merge of #21744 - eddyb:rvalue-promotion, r=nikomatsakis
This includes everything necessary for promoting borrows of constant rvalues to `'static`.
That is, `&expr` will have the type `&'static T` if `const T: &'static T = &expr;` is valid.
There is a small exception, dereferences of raw pointers, as they misbehave.
They still "work" in constants as I didn't want to break legitimate uses (are there any?).

The qualification done here can be expanded to allow simple CTFE via `const fn`.
2015-02-16 16:38:51 +00:00
Niko Matsakis
d0ef1664ca Clarify and improve comment, removing a TODO. 2015-02-16 10:55:37 -05:00
Niko Matsakis
f58a1bfa98 Fix fallout in libsyntax from RFC 599. Clarity and efficiency seems to be mostly improved, to my eye.
Nonetheless, as this commit demonstrates, the previous commits was a [breaking-change].

In practice, breakage is focused on functions of this form:

```rust
fn foo(..., object: Box<FnMut()>)
````

where `FnMut()` could be any trait object type. The older scheme defaulted objects in argument
position so that they were bounded by a fresh lifetime:

```rust
fn foo<'a>(..., object: Box<FnMut()+'a>)
```

This meant that the object could contain borrowed data. The newer
scheme defaults to a lifetime bound of `'static`:

```rust
fn foo(..., object: Box<FnMut()+'static>)
```

This means that the object cannot contain borrowed data. In some cases, the best fix
is to stop using `Box`:

```rust
fn foo(..., object: &mut FnMut())
```

but another option is to write an explicit annotation for the `'a`
lifetime that used to be implicit.  Both fixes are demonstrated in
this commit.
2015-02-16 10:55:37 -05:00
Niko Matsakis
369adaf515 Implement the rules for RFC 599, and add various tests.
Fixes #22211.
2015-02-16 10:55:37 -05:00
Niko Matsakis
ab579883f2 Factor out the "region substs" creation to occur earlier, so that the
complete set of regions are available when converting types.
2015-02-16 10:55:37 -05:00
Niko Matsakis
80d1f14e7d Implement the basic rules of RFC 599, but do not yet support custom types. 2015-02-16 10:55:37 -05:00