Commit Graph

38684 Commits

Author SHA1 Message Date
Manish Goregaokar
020e4e4ad9 Rollup merge of #22383 - pnkfelix:pass-features-along-during-expansion, r=huonw
Pass features along during expansion

Use the set of passed features to detect uses of feature-gated macros without the corresponding feature enabled.

Fix #22234.

----

Also, the framework this add (passing along a reference to the features in the expansion context) is a necessary precursor for landing a properly feature-gated desugaring-based overloaded-`box` and placement-`in` (#22181).

----

This is fixing a bug, but since there might be code out there that is unknowingly taking advantage of that bug, I feel obligated to mark this as a:

[breaking-change]
2015-02-17 17:33:20 +05:30
Manish Goregaokar
0e89228361 Rollup merge of #22030 - mdinger:f32_examples, r=steveklabnik
Some examples for `std::num::Float`

~~This is WIP for making examples for `f32`. This probably won't pass `make tidy` and I'm not sure which `f32` needs documentation. https://github.com/rust-lang/rust/issues/22025 shows 2 sets of `f32` which seems split between `core` and `std`. I'm not sure which should be documented but I started doing a couple from `std`. Easy to move if that's where they go...~~

~~Gotta build it eventually to actually see if the docs actually appear where I think they will or if I'm just disillusioned.~~

cc @steveklabnik
2015-02-17 17:33:20 +05:30
Manish Goregaokar
bf52f2eef5 Rollup merge of #22311 - lfairy:consistent-fmt, r=alexcrichton
This brings it in line with its namesake in `std::io`.

[breaking-change]

r? @aturon
2015-02-17 17:33:20 +05:30
Manish Goregaokar
4647d89205 Rollup merge of #22364 - Manishearth:rfc-572-forbid-attr, r=nikomatsakis
fixes #22203

r? @nikomatsakis

This breaks code that might be using attributes randomly, so it's technically a

[breaking-change]
2015-02-17 17:33:19 +05:30
Manish Goregaokar
1a1ac6c1ab Rollup merge of #22404 - semarie:signal_reported_right, r=aturon
The test \"signal_reported_right\" send a signal `1` to `/bin/sh`, and check
the status code to check if the signal is reported right.

Under OpenBSD, the signal `1` (`SIGHUP`) is catched by `/bin/sh`,
resulting the test failed.

Use the uncatchable signal `9` (`SIGKILL`) for test.
2015-02-17 17:33:19 +05:30
Manish Goregaokar
5e0adf2401 Rollup merge of #22433 - sfackler:seek-docs, r=aturon
r? @aturon
2015-02-17 17:33:19 +05:30
Manish Goregaokar
9eed8b1c27 Rollup merge of #22410 - Reignbeaux:master, r=steveklabnik
I just stumbled on a typo and fixed it.
2015-02-17 17:33:19 +05:30
Manish Goregaokar
be83d60298 Rollup merge of #22408 - steveklabnik:gh19321, r=nikomatsakis
Fixes #19321

... I think? `make check` passes, but I'm not 100% sure that there's a test for that behavior. Thoughts?
2015-02-17 17:33:18 +05:30
Manish Goregaokar
2833976ccc Rollup merge of #22402 - nagisa:spring-cleanup-2, r=nikomatsakis
This commit mostly replaces some of the uses of os::args with env::args.

This, for obvious reasons is based on top of #22400. Do not r+ before that lands.
2015-02-17 17:33:18 +05:30
Manish Goregaokar
c0865dfe1c Rollup merge of #22401 - pnkfelix:fsk-int-uint-audit, r=Gankro
cc #22240
2015-02-17 17:33:18 +05:30
Manish Goregaokar
071f8cc9ac Rollup merge of #22394 - alexcrichton:vec-from-iter-comment, r=brson
Requested by Niko in #22200 (and is good to have anyway)
2015-02-17 17:33:18 +05:30
Manish Goregaokar
34ab88e30b Rollup merge of #22385 - dotdash:slice_by_val_copy, r=nikomatsakis
When matching against strings/slices, we call the comparison function
for strings, which takes two string slices by value. The slices are
passed in memory, and currently we just pass in a pointer to the
original slice. That can cause misoptimizations because we emit a call
to llvm.lifetime.end for all by-value arguments at the end of a
function, which in this case marks the original slice as dead.

So we need to properly create copies of the slices to pass them to the
comparison function.

Fixes #22008
2015-02-17 17:33:17 +05:30
Manish Goregaokar
4a7eed1e01 Rollup merge of #22333 - caipre:patch-1, r=steveklabnik
The `Circle::grow` method multiplies the radius by a factor of 10, not 2.
2015-02-17 17:33:17 +05:30
Manish Goregaokar
2aa31827ed Rollup merge of #22296 - steveklabnik:gh21577, r=Gankro
Fixes #21577.
2015-02-17 17:33:17 +05:30
Manish Goregaokar
edac2a07c5 Rollup merge of #22282 - steveklabnik:gh5831, r=brson
This redux of CONTRIBUTING.md adds in more information, including
subsuming both compliment-bugreport.md and Note-development-policy
in the wiki.

I only glanced at the broad TOC of Note-development-policy, and did
not use the text as the basis for the re-write. This will then address
the last outstanding part of #5831.
2015-02-17 17:33:16 +05:30
Markus Siemens
bad3bcbfc0 Fix a small typo in libstd/fs.rs 2015-02-17 11:22:27 +01:00
Sébastien Marie
9eeaa3c786 openbsd: adapt connect_error test
The connect_error test check if connecting to "0.0.0.0:1" works (it
shouldn't). And in case of error, the test expects a ConnectionRefused
error.

Under OpenBSD, trying to connect to "0.0.0.0" isn't a ConnectionRefused:
it is an InvalidInput error.

The patch allow the error to be ConnectionRefused or InvalidInput.
2015-02-17 11:11:53 +01:00
Manish Goregaokar
ab51363da5 Rollup merge of #22232 - alexcrichton:missing-fmt-stability, r=aturon
The `Arguments::new_v1_formatted` function was accidentally left out when this
module was stabilized.
2015-02-17 15:41:30 +05:30
Manish Goregaokar
e4e4afa92d Rollup merge of #22111 - robinst:option-docs-flatmap, r=steveklabnik
Some newcomers might look for a "flatMap" method on Option. Include the
reference so that searching the page would find "and_then".
2015-02-17 15:41:30 +05:30
Manish Goregaokar
2d94c4482d Rollup merge of #22027 - iblech:patch-1, r=steveklabnik
The first commit adds a short note which I believe will reduce worries in people who work with closures very often and read the Rust book for their first time.

The second commit consists solely of tiny typo fixes. In some cases, I changed "logical" quotations like

    She said, "I like programming".

to

    She said, "I like programming."

because the latter seems to be the prevalent style in the book.
2015-02-17 15:41:30 +05:30
Manish Goregaokar
522091e55d Rollup merge of #21990 - steveklabnik:doc_core_cmp, r=huonw
Fix up, add examples, make them all the same.
2015-02-17 15:41:30 +05:30
bors
f1bb6c2f46 Auto merge of #22397 - Manishearth:rollup, r=huonw
None
2015-02-17 05:57:55 +00:00
Steven Fackler
a1b755862c Make io::Seek docs less prescriptive 2015-02-16 21:03:39 -08:00
bors
22224ca449 Auto merge of #21932 - Jormundir:std-os-errno-type, r=alexcrichton
Changes std::os::errno to return i32, the return type used by the function being delegated to.

This is my first contribution, so feel free to give me advice. I'll be happy to correct things.
2015-02-17 03:42:54 +00:00
Manish Goregaokar
35ee89599c Rollup merge of #22409 - nikomatsakis:stop-advertisting-old-impl-check, r=aturon
Stop advertisting the `old_impl_check` feature. We can't ENTIRELY remove it yet, but we don't have to add new uses.

r? @aturon
2015-02-17 06:25:55 +05:30
Manish Goregaokar
a555fbd88c Rollup merge of #22416 - GuillaumeGomez:copy, r=eddyb 2015-02-17 06:25:34 +05:30
Manish Goregaokar
8c639d3c6e Rollup merge of #22420 - posixphreak:fix-rustup-locale, r=brson
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`.

Here is what happens without the fix:
```
➜  projects  curl -s https://static.rust-lang.org/rustup.sh | sudo sh
rustup: CFG_CURL             := /usr/bin/curl (7.22.0)
rustup: CFG_TAR              := /bin/tar (1.26)
rustup: CFG_FILE             := /usr/bin/file (5.09)
rustup: CFG_SHA256SUM        := /usr/bin/sha256sum (256sum)
rustup: CFG_SHASUM           := /usr/bin/shasum (5.61)
rustup:
rustup: processing sh args
rustup:
rustup: CFG_PREFiX           :=
rustup: CFG_DATE             :=
rustup:
rustup: validating sh args
rustup:
rustup: host triple: i686-unknown-linux-gnu
rustup: Downloading https://static.rust-lang.org/dist/rust-nightly-i686-unknown-linux-gnu.tar.gz to /tmp/tmp.Wz6F1ToG5z/rust-nightly-i686-unknown-linux-gnu.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  132M  100  132M    0     0  59947      0  0:38:31  0:38:31 --:--:-- 71204
rustup: Downloading https://static.rust-lang.org/dist/rust-nightly-i686-unknown-linux-gnu.tar.gz.sha256
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   109  100   109    0     0    107      0  0:00:01  0:00:01 --:--:--   169
rustup: Verifying hash
rustup: Extracting /tmp/tmp.Wz6F1ToG5z/rust-nightly-i686-unknown-linux-gnu.tar.gz
install: looking for install programs
install:
install: found mkdir
install: found printf
install: found cut
install: found grep
install: found uname
install: found tr
install: found sed
install: found chmod
install:
install: processing /tmp/tmp.Wz6F1ToG5z/rust-nightly-i686-unknown-linux-gnu/install.sh args
install:
install: CFG_DESTDiR          :=
install: CFG_PREFiX           := /usr/local
install: CFG_LiBDiR           := /lib
install: CFG_MANDiR           := /share/man
install:
install: validating /tmp/tmp.Wz6F1ToG5z/rust-nightly-i686-unknown-linux-gnu/install.sh args
install:
install: verifying platform can run binaries
install: verifying destination is writable
mkdir: cannot create directory `': No such file or directory
install: error: can't write to destination. consider `sudo`.
rustup: error: failed to install Rust
```
Notice how `i` wasn't replaced with `I`.

Rust is installed as usual after the fix. Tested on Ubuntu x86 12.04 LTS.
I'm not exactly sure if setting LC_CTYPE is the best solution, but there's that.
2015-02-17 06:25:21 +05:30
Manish Goregaokar
bc48107a85 Rollup merge of #22418 - japaric:diagnostics, r=nikomatsakis
closes #22388

r? @nikomatsakis
cc @insaneinside
2015-02-17 06:25:03 +05:30
Manish Goregaokar
23306de287 Rollup merge of #22411 - aturon:fix-os-deprecation, r=alexcrichton
They now point to the correct locations in std::env

r? @alexcrichton
2015-02-17 06:24:51 +05:30
Manish Goregaokar
a97ffa24d5 Rollup merge of #22413 - steveklabnik:gh22386, r=alexcrichton
Fixes #22386
2015-02-17 06:24:34 +05:30
Manish Goregaokar
b491b16b86 Rollup merge of #22394 - alexcrichton:vec-from-iter-comment, r=brson
Requested by Niko in #22200 (and is good to have anyway)
2015-02-17 06:23:42 +05:30
Manish Goregaokar
901d2c7b0d Rollup merge of #22241 - kmcallister:macro-plugin-cleanup, r=sfackler 2015-02-17 06:23:41 +05:30
Alex Crichton
a35824b149 std: Add Vec::from_iter comment
Requested by Niko in #22200 (and is good to have anyway)
2015-02-17 06:23:41 +05:30
Manish Goregaokar
02fb58af05 Rollup merge of #22225 - vhbit:darwin-types, r=alexcrichton
"body": null,
2015-02-17 06:23:41 +05:30
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