Commit Graph

62908 Commits

Author SHA1 Message Date
Ulrik Sverdrup
74f8ea263e iter: Simplification in rfind's provided implementation
- Prefer simpler constructs instead of going through &mut I's Iterator
  implementation.
2017-04-03 02:03:19 +02:00
Ulrik Sverdrup
29a6a9e8d2 iter: Use underlying find/rfind for the same methods in Rev 2017-04-03 02:03:19 +02:00
Nathan Stocks
efd6eab366 Handle symlinks in src/bootstrap/clean.rs (mostly) -- resolves #40860.
The broken condition can be replicated with:

``shell
export MYARCH=x86_64-apple-darwin && mkdir -p build/$MYARCH/subdir &&
touch build/$MYARCH/subdir/file && ln -s build/$MYARCH/subdir/file
build/$MYARCH/subdir/symlink
``

`src/bootstrap/clean.rs` has a custom implementation of removing a tree
`fn rm_rf` that used `std::path::Path::{is_file, is_dir, exists}` while
recursively deleting directories and files.  Unfortunately, `Path`'s
implementation of `is_file()` and `is_dir()` and `exists()` always
unconditionally follow symlinks, which is the exact opposite of standard
implementations of deleting file trees.

It appears that this custom implementation is being used to workaround a
behavior in Windows where the files often get marked as read-only, which
prevents us from simply using something nice and simple like
`std::fs::remove_dir_all`, which properly deletes links instead of
following them.

So it looks like the fix is to use `.symlink_metadata()` to figure out
whether tree items are files/symlinks/directories.  The one corner case
this won't cover is if there is a broken symlink in the "root"
`build/$MYARCH` directory, because those initial entries are run through
`Path::canonicalize()`, which panics with broken symlinks.  So lets just
never use symlinks in that one directory. :-)
2017-04-02 16:26:43 -06:00
Nathan Stocks
1e5389853c Fix breaking the 'clean' subcommand caused replacing a single-letter variable with the same value in two contexts where it was used differently. That's why you don't use "m" as a variable for hundreds of lines in an outer function, and re-use it in closures several times in the same function. Sheesh. 2017-04-02 13:11:53 -06:00
Nathan Stocks
6b7258670f Simplify a "use" statement as per @grunweg's feedback. 2017-04-02 12:57:09 -06:00
Nathan Stocks
2c9ae48149 Oops, we can't parse options until all options have been defined. Tiny bit of manual arg-parsing. Fixed tidy stuff too. 2017-04-02 12:57:08 -06:00
Nathan Stocks
aa4bd0ec0e Finish the improvements I planned.
- No more manual args manipulation -- getopts used for everything.
  As a result, options can be in any position, now, even before the
  subcommand.
- The additional options for test, bench, and dist now appear in the
  help output.
- No more single-letter variable bindings used internally for large
  scopes.
- Don't output the time measurement when just invoking 'x.py'
- Logic is now much more linear.  We build strings up, and then print
  them.
2017-04-02 12:57:08 -06:00
Nathan Stocks
5ba579e7f4 Save my TODO's as comments, so I don't forget. 2017-04-02 12:57:08 -06:00
Nathan Stocks
992a59efc3 Using an untyped, one-letter variable binding as an argument to a function and then not using it until over 100 lines later is just mean. 2017-04-02 12:57:08 -06:00
Nathan Stocks
584b40578d Vastly improve the help output.
- Don't print 'unknown subcommand' at the top of the help message.  The help message now clearly instructs the user to provide a subcommand.
- Clarify the usage line.  Subcommand is required.  Don't echo invalid input back out in the usage line (what the...???).  args renamed to paths, because that's what all the args are referred to elsewhere.
- List the available subcommands immediately following the usage line.  It's the one required argument, after all.
- Slightly improve the extra documentation for the build, test, and doc commands.
- Don't print 'Available invocations:' at all.  It occurred immediately before 'Available paths:'.
- Clearly state that running with '-h -v' will produce a list of available paths.
2017-04-02 12:56:52 -06:00
bors
72ecd79a6c Auto merge of #40919 - GuillaumeGomez:fix-new-rustdoc, r=frewsxcv,steveklabnik
Add support for image, rules and footnotes

Part of #40912.

r? @rust-lang/docs

PS: the footnotes are waiting for https://github.com/google/pulldown-cmark/pull/21 to be merged to be fully working.
2017-04-02 18:16:09 +00:00
mandeep
255d9191a9 Fixed typo in doc comments for swap_remove 2017-04-02 11:21:05 -05:00
Ariel Ben-Yehuda
09ac56d6ef mark build::cfg::start_new_block as inline(never)
LLVM has a bug - PR32488 - where it fails to deduplicate allocas in some
circumstances. The function `start_new_block` has allocas totalling 1216
bytes, and when LLVM inlines several copies of that function into
the recursive function `expr::into`, that function's stack space usage
goes into tens of kiBs, causing stack overflows.

Mark `start_new_block` as inline(never) to keep it from being inlined,
getting stack usage under control.

Fixes #40493.
Fixes #40573.
2017-04-02 16:18:39 +03:00
Simon Sapin
509ef4c496 std::thread docs: fix link to current() 2017-04-02 12:03:54 +02:00
Peter Gerber
ff4febf8ea Improve documentation for std::fs::DirBuilder 2017-04-02 04:06:29 +02:00
Irfan Hudda
4c9f8ae4fd Minor changes to core::option docs 2017-04-02 06:10:34 +05:30
Irfan Hudda
c414628782 Improve docs of core::option::Iter 2017-04-01 22:17:48 +05:30
Irfan Hudda
029ace4071 Improve docs of core::option::IterMut 2017-04-01 22:09:10 +05:30
Irfan Hudda
128a313ee2 Improve docs of core::option::IntoIter 2017-04-01 21:58:30 +05:30
Alex Crichton
8ad8ba6194 Update cargo submodule
Pulls in a fix for rust-lang/rust#40956
2017-04-01 06:58:11 -07:00
Donnie Bishop
364241c709 Added links to types in from_utf8 description 2017-04-01 09:56:40 -04:00
Alex Crichton
34cf28826f rustc: Stabilize the #![windows_subsystem] attribute
This commit stabilizes the `#![windows_subsystem]` attribute which is a
conservative exposure of the `/SUBSYSTEM` linker flag on Widnows platforms. This
is useful for creating applications as well as console programs.

Closes #37499
2017-04-01 06:36:48 -07:00
Eugene Bulkin
a5d775d2b6 Add more std::ascii module-level docs. 2017-04-01 00:47:58 -07:00
Eugene Bulkin
d8fb322acc Clean up std::ascii sub-level docs.
* Change `utf8` variable names to `non_ascii` to be more clear, since
ASCII and UTF-8 are compatible.

* Fix `EscapeDefault` struct description to follow the typical iterator
method format with a link to the generating function.

* Add more `escape_default` examples to cover every case mentioned in
the function description itself.
2017-04-01 00:07:55 -07:00
Guillaume Gomez
ef01ae7fe0 Force footnote references to be sorted by id 2017-04-01 00:31:37 -06:00
Bryan Tan
dab8e8121f Fix warnings in examples 2017-03-31 23:22:59 -07:00
bors
5e122f59ba Auto merge of #40967 - alexcrichton:old-osx, r=brson
travis: Compile OSX releases with Xcode 7

Unfortunately what we're using right now, Xcode 8.2, cannot compile LLVM for OSX
10.7. We've done this historically and Gecko would like to maintain this
compabitiliby. This commit moves our release builders for OSX to using Xcode 7
which can compile LLVM for 10.7.

The builders running tests continue to use Xcode 8.2, however, because the LLDB
version with Xcode 7, 350, is blacklisted in running our LLDB tests. To continue
running LLDB tests we'll stick with Xcode 8.2.
2017-04-01 05:56:08 +00:00
Donnie Bishop
5198072c3a Added links to from_utf8 methods in Utf8Error 2017-03-31 23:22:22 -04:00
Bryan Tan
ae8ba78e9d Fix broken links to std::iter::Iterator::next 2017-03-31 18:51:37 -07:00
Stjepan Glavina
1e2a61d4a6 Change wording for push_front 2017-04-01 02:47:41 +02:00
Bryan Tan
89c35ae764 Add links and examples to std::sync::mpsc docs (#29377)
This change adds links to to `Receiver`, `Iter`, `TryIter`, `IntoIter`,
`Sender`, `SyncSender`, `SendError`, `RecvError`, `TryRecvError`,
`RecvTimeoutError`, `TrySendError`, `Sender::send`, `SyncSender::send`,
`SyncSender::try_send`, `Receiver::recv`, `Receiver::recv_timeout`,
`Receiver::iter`, and `Receiver::try_iter`.

Examples added to `Receiver`, `Sender`, `Receiver::iter`.
2017-03-31 17:07:01 -07:00
bors
2f1652870f Auto merge of #40972 - frewsxcv:rollup, r=frewsxcv
Rollup of 6 pull requests

- Successful merges: #40703, #40728, #40763, #40871, #40935, #40947
- Failed merges:
2017-03-31 23:23:49 +00:00
projektir
44d8b236f4 Updating the description for BarrierWaitResult #29377 2017-03-31 18:58:32 -04:00
Matthew Jasper
2060266c16 Don't warn about char comparisons in constexprs 2017-03-31 23:52:35 +01:00
Corey Farwell
54b3f6aa21 Rollup merge of #40947 - stjepang:test-sort-random-cmp, r=alexcrichton
Test sort algorithms using a random cmp function

This ensures that sorting using a broken comparison function doesn't panic nor fail in some other way (especially not segfault).

r? @alexcrichton
2017-03-31 16:48:29 -04:00
Corey Farwell
c9a9d7acaf Rollup merge of #40935 - donniebishop:str_boilerplate_docs, r=steveklabnik
Modify str Structs descriptions

References #29375. Modified descriptions of multiple structs to be more in line with structs found under [`std::iter`](https://doc.rust-lang.org/std/iter/#structs), such as [`Chain`](https://doc.rust-lang.org/std/iter/struct.Chain.html) and [`Enumerate`](https://doc.rust-lang.org/std/iter/struct.Enumerate.html)
2017-03-31 16:48:28 -04:00
Corey Farwell
c5082fe801 Rollup merge of #40871 - projektir:atomic_links, r=steveklabnik
Adding links for Atomics docs #29377

r? @steveklabnik

This should be good for `std::sync::atomic`. The other pages still need more (examples, etc.).
2017-03-31 16:48:27 -04:00
Corey Farwell
6edab01499 Rollup merge of #40763 - pirate:patch-2, r=steveklabnik
Add helpful hint in io docs about how ? is not allowed in main()

This is my effort to help alleviate the confusion caused by the error message:
```rust
error[E0277]: the trait bound `(): std::ops::Carrier` is not satisfied
  --> hello_world.rs:72:5
   |
72 |     io::stdin().read_line(&mut d_input)?;
   |     ------------------------------------
   |     |
   |     the trait `std::ops::Carrier` is not implemented for `()`
   |     in this macro invocation
   |
   = note: required by `std::ops::Carrier::from_error`

error: aborting due to previous error
```
This has been discussed at length in https://github.com/rust-lang/rust/issues/35946, but I figured it would be helpful to mention in the docs.
Reading user input is one of the first things beginners will look up in the docs, so my thinking was they'd see this warning here and not have to deal with the [tricky error message](https://blog.rust-lang.org/2017/03/02/lang-ergonomics.html).

If you think this isn't the right place to put this in the docs, that's understandable, I'm open to suggestions for putting it elsewhere or removing it entirely.
2017-03-31 16:48:26 -04:00
Corey Farwell
c6e2512705 Rollup merge of #40728 - topecongiro:stabilize, r=arielb1
Make overlapping_inherent_impls lint a hard error

Closes #36889.
2017-03-31 16:48:25 -04:00
Corey Farwell
efc2ae8e59 Rollup merge of #40703 - GuillaumeGomez:pointer-docs, r=steveklabnik
Add missing urls in ptr docs

r? @rust-lang/docs
2017-03-31 16:48:24 -04:00
Alex Crichton
3076155674 travis: Compile OSX releases with Xcode 7
Unfortunately what we're using right now, Xcode 8.2, cannot compile LLVM for OSX
10.7. We've done this historically and Gecko would like to maintain this
compabitiliby. This commit moves our release builders for OSX to using Xcode 7
which can compile LLVM for 10.7.

The builders running tests continue to use Xcode 8.2, however, because the LLDB
version with Xcode 7, 350, is blacklisted in running our LLDB tests. To continue
running LLDB tests we'll stick with Xcode 8.2.
2017-03-31 11:19:36 -07:00
Guillaume Gomez
4de4a95505 Add end whitespace ignore flag for tidy 2017-03-31 12:16:03 -06:00
Guillaume Gomez
51d3cec387 Fix hard break issue 2017-03-31 12:16:03 -06:00
Björn Steinbrink
0ba7da3449 Ignore tests for the personality slot lifetimes on MSVC
Exception handling on MSVC targets doesn't use personality slots.
2017-03-31 20:09:37 +02:00
bors
40feadb966 Auto merge of #40950 - frewsxcv:rollup, r=frewsxcv
Rollup of 10 pull requests

- Successful merges: #40694, #40842, #40869, #40888, #40898, #40904, #40925, #40928, #40929, #40934
- Failed merges:
2017-03-31 16:04:18 +00:00
Corey Farwell
c34f533a85 Rollup merge of #40934 - SamWhited:improve_write_writeln_docs, r=steveklabnik
Improve the docs for the write and writeln macros

This change reduces duplication by linking the documentation for
`writeln!` to `write!`. It also restructures the `write!` documentation
to read in a more logical manner (I hope; feedback would be welcome).

Updates #29329, #29381
2017-03-31 11:43:39 -04:00
Corey Farwell
d36b24d8bf Rollup merge of #40929 - bluss:full-reverse, r=alexcrichton
Implement all PartialOrd methods for Reverse

When making a forwarding wrapper we must in general forward all methods,
so that we use the type's own `lt` for example instead of the default.

Example important case: f32's partial_cmp does several operations but
its lt is a primitive.

Follow up on #40720
2017-03-31 11:43:38 -04:00
Corey Farwell
c650ed8ee7 Rollup merge of #40928 - GAJaloyan:patch-2, r=eddyb
adding debug in consume_body function

When in debug_assertions=true mode, the function consume_body lacks some debug output, which makes it harder to follow the control flow. This commit adds this needed debug.
2017-03-31 11:43:37 -04:00
Corey Farwell
4af41b4789 Rollup merge of #40925 - DaseinPhaos:patch-5, r=steveklabnik
Add missing link in unstable-book

add link to specialization's tracking issue
2017-03-31 11:43:36 -04:00
Corey Farwell
fe34818606 Rollup merge of #40904 - rap2hpoutre:patch-1, r=steveklabnik
Add example to std::process::abort

This is a first step in order to complete this issue: https://github.com/rust-lang/rust/issues/29370
I submitted this PR with the help of @steveklabnik More info here: https://github.com/rust-lang/rust/issues/29370#issuecomment-290089330

It's my first PR on Rust, I'm learning how to contribute: Should I ping someone? I will post another PR with a more complicated example soon, I prefer send it separately (cause maybe I made some mistakes).
2017-03-31 11:43:35 -04:00