Commit Graph

58719 Commits

Author SHA1 Message Date
Guillaume Gomez
0b7fe4d67c Rollup merge of #36699 - bluss:repeat-str, r=alexcrichton
Add method str::repeat(self, usize) -> String

It is relatively simple to repeat a string n times:
`(0..n).map(|_| s).collect::<String>()`. It becomes slightly more
complicated to do it “right” (sizing the allocation up front), which
warrants a method that does it for us.

This method is useful in writing testcases, or when generating text.
`format!()` can be used to repeat single characters, but not repeating
strings like this.
2016-10-11 17:51:26 +02:00
Guillaume Gomez
6717dba276 Rollup merge of #36679 - QuietMisdreavus:rustdoc-line-breaks, r=steveklabnik
rustdoc: print non-self arguments of bare functions and struct methods on their own line

This change alters the formatting rustdoc uses when it creates function and struct method documentation. For bare functions, each argument is printed on its own line. For struct methods, non-self arguments are printed on their own line. In both cases, no line breaks are introduced if there are no arguments, and for struct methods, no line breaks are introduced if there is only a single self argument. This should aid readability of long function signatures and allow for greater comprehension of these functions.

I've run rustdoc with these changes on my crate egg-mode and its set of dependencies and put the result [on my server](https://shiva.icesoldier.me/doc-custom/egg_mode/). Of note, here are a few shortcut links that highlight the changes:

* [Bare function with a long signature](https://shiva.icesoldier.me/doc-custom/egg_mode/place/fn.reverse_geocode.html)
* [Struct methods, with single self argument and with self and non-self arguments](https://shiva.icesoldier.me/doc-custom/egg_mode/tweet/struct.Timeline.html#method.reset)
* [Bare functions with no arguments](https://shiva.icesoldier.me/doc-custom/rand/fn.thread_rng.html) and [struct methods with no arguments](https://shiva.icesoldier.me/doc-custom/hyper/client/struct.Client.html#method.new) are left unchanged.

This PR consists of two commits: one for bare functions and one for struct methods.
2016-10-11 17:51:25 +02:00
Guillaume Gomez
b5bedfcd3f Add missing urls in io module 2016-10-11 17:48:14 +02:00
bors
304d0c8d85 Auto merge of #36871 - petrochenkov:pdderr, r=nikomatsakis
Turn compatibility lint `match_of_unit_variant_via_paren_dotdot` into a hard error

The lint was introduced 10 months ago and made deny-by-default 7 months ago.
In case someone is still using it, https://github.com/rust-lang/rust/pull/36868 contains a stable replacement.

r? @nikomatsakis
2016-10-11 07:39:09 -07:00
Felix S. Klock II
7d2d5bcbcf Code for enforcing #[may_dangle] attribute. 2016-10-11 16:34:31 +02:00
Felix S. Klock II
e8ccc68254 Thread pure_wrt_drop field through lifetime and type parameters. 2016-10-11 16:08:37 +02:00
Felix S. Klock II
4bb68be681 Add feature gate for dropck_eyepatch feature (RFC 1327). 2016-10-11 16:08:36 +02:00
Simon Sapin
401f1c45db Merge two impl<T> Vec<T> blocks.
The show up separately in rustdoc.

This is a separate commit to keep the previous one’s diff shorter.
2016-10-11 14:40:05 +02:00
Simon Sapin
be34bac1ab Add Vec::dedup_by and Vec::dedup_by_key 2016-10-11 14:39:14 +02:00
bors
e33562078f Auto merge of #36983 - alexcrichton:configure-multiple-musl, r=brson
configure: Add options for separate musl roots

This allows using the `./configure` script to enable rustbuild to compile
multiple musl targets at once. We'll hopefully use this soon on our bots to
produce a bunch of targets.
2016-10-11 04:26:56 -07:00
Tobias Bucher
2eda01ee43 Fix Android compilation io::Error -> io::ErrorKind 2016-10-11 12:16:35 +02:00
bors
1e4c8b1a81 Auto merge of #36825 - sbwtw:master, r=alexcrichton
add println!() macro with out any arguments

lets add println!() to write "\n".
like java https://docs.oracle.com/javase/7/docs/api/java/io/PrintStream.html#println()
2016-10-11 01:17:03 -07:00
Jeffrey Seyfried
829bd8c9b9 Add test. 2016-10-11 05:14:10 +00:00
Jeffrey Seyfried
a4c0daab6d Remove LegacyBindingKind::MacroUse. 2016-10-11 05:14:10 +00:00
Jeffrey Seyfried
111caef9a3 Clean up the scopes of expanded #[macro_use] imports. 2016-10-11 05:14:08 +00:00
Jeffrey Seyfried
31e0e12e69 Add support for undetermined macro invocations. 2016-10-11 03:41:48 +00:00
Jeffrey Seyfried
d5281ef681 Merge branch 'persistent_macro_scopes' into cleanup_expanded_macro_use_scopes 2016-10-11 03:41:18 +00:00
Jeffrey Seyfried
6808b0a2b7 Check for shadowing errors after all invocations have been expanded. 2016-10-11 03:28:54 +00:00
Wesley Wiser
5e91c073f2 Move IdxSetBuf and BitSlice to rustc_data_structures
Resolves a FIXME
2016-10-10 20:26:26 -04:00
bors
ead9212c33 Auto merge of #36707 - achanda:ip_type, r=alexcrichton
Add two functions to check type of given address

The is_v4 function returns true if the given IP is v4. The is_v6
function returns true if the IP is v6.
2016-10-10 17:18:01 -07:00
Corey Farwell
0038430192 Simplify str and Path comparison. 2016-10-10 19:46:18 -04:00
Corey Farwell
7c7a5949fe Return early to avoid excessive indentation.` 2016-10-10 19:40:05 -04:00
Corey Farwell
a8e257091b Use Cow instead of String to avoid unnecessary allocations. 2016-10-10 19:35:22 -04:00
Corey Farwell
3a15475d36 Convert String generating functions into &str constants. 2016-10-10 19:28:16 -04:00
p512
ee3de444e6 Changed 0 into '0'
0 is not a production rule but a literal
2016-10-11 01:25:50 +02:00
Ulrik Sverdrup
2b7222d3ec Add method str::repeat(self, usize) -> String
It is relatively simple to repeat a string n times:
`(0..n).map(|_| s).collect::<String>()`. It becomes slightly more
complicated to do it “right” (sizing the allocation up front), which
warrants a method that does it for us.

This method is useful in writing testcases, or when generating text.
`format!()` can be used to repeat single characters, but not repeating
strings like this.
2016-10-11 00:24:23 +02:00
Jeffrey Seyfried
448d6ad72e Test derive expansion ordering. 2016-10-10 22:15:57 +00:00
Jeffrey Seyfried
60a4b69ec0 Expand #[derive] attribute macro invocations last. 2016-10-10 22:15:55 +00:00
bors
a3bc191b5f Auto merge of #37030 - michaelwoerister:live-debug-values-fix, r=alexcrichton
llvm: Update LLVM to include fix for pathologic case in its LiveDebugValues pass.

See #36926.
r? @alexcrichton
2016-10-10 12:15:14 -07:00
Marcin Fatyga
ca76d43dcb Fix comments 2016-10-10 18:54:37 +02:00
Guillaume Gomez
3c66f96aac Add missing urls on String module 2016-10-10 18:15:55 +02:00
Mark-Simulacrum
f9c73adce8 Add comparison operators to boolean const eval. 2016-10-10 09:58:00 -06:00
Michael Woerister
f52723c330 ICH: Enable some cases in trait definition hashing. 2016-10-10 11:57:49 -04:00
Michael Woerister
7d03badb2a LLVM: Backport "[SimplifyCFG] Correctly test for unconditional branches in GetCaseResults" 2016-10-10 11:12:29 -04:00
Michael Woerister
d46defc82c Update LLVM to fix bug in SimplifyCFG pass. 2016-10-10 09:53:14 -04:00
Felix S. Klock II
b0eee76d25 Include attributes on generic parameter bindings in pretty printer. 2016-10-10 15:27:08 +02:00
bors
6d620843f6 Auto merge of #36341 - sagebind:thread_id, r=alexcrichton
Add ThreadId for comparing threads

This adds the capability to store and compare threads with the current calling thread via a new struct, `std:🧵:ThreadId`. Addresses the need outlined in issue #21507.

This avoids the need to add any special checks to the existing thread structs and does not rely on the system to provide an identifier for a thread, since it seems that this approach is unreliable and undesirable. Instead, this simply uses a lazily-created, thread-local `usize` whose value is copied from a global atomic counter. The code should be simple enough that it should be as much reliable as the `#[thread_local]` attribute it uses (however much that is).

`ThreadId`s can be compared directly for equality and have copy semantics.

Also see these other attempts:
- rust-lang/rust#29457
- rust-lang/rust#29448
- rust-lang/rust#29447

And this in the RFC repo: rust-lang/rfcs#1435
2016-10-10 04:04:51 -07:00
Jeffrey Seyfried
53fd3b0acc Avoid quadratic complexity. 2016-10-10 09:35:25 +00:00
Nicholas Nethercote
67a5444183 Merge Printer::token and Printer::size.
Logically, it's a vector of pairs, so might as well represent it that
way.

The commit also changes `scan_stack` so that it is initialized with the
default size, instead of the excessive `55 * linewidth` size, which it
usually doesn't get even close to reaching.
2016-10-10 16:19:53 +11:00
Nick Cameron
4df0f3f6a6 Error monitor should emit error to stderr instead of stdout 2016-10-10 18:14:45 +13:00
Nicholas Nethercote
b043e11de2 Avoid allocations in Decoder::read_str.
`opaque::Decoder::read_str` is very hot within `rustc` due to its use in
the reading of crate metadata, and it currently returns a `String`. This
commit changes it to instead return a `Cow<str>`, which avoids a heap
allocation.

This change reduces the number of calls to `malloc` by almost 10% in
some benchmarks.

This is a [breaking-change] to libserialize.
2016-10-10 10:36:35 +11:00
John Firebaugh
9d364267d6 Update E0303 to new error format 2016-10-09 11:41:59 -07:00
John Firebaugh
16a979c106 Remove TypeOrigin::RangeExpression
This variant became unused in #30884.
2016-10-09 10:54:56 -07:00
bors
a7bfb1aba9 Auto merge of #37055 - kali:master, r=alexcrichton
use MSG_NOSIGNAL on all relevant platforms

followup #36824
2016-10-09 10:07:39 -07:00
Marcin Fatyga
def0b4ebc8 Fix trailing whitespace. 2016-10-09 14:10:56 +02:00
Mathieu Poumeyrol
14f9cbdfd5 use MSG_NOSIGNAL on all relevant platforms 2016-10-09 13:01:29 +02:00
Matthew Piziak
a802ec1f65 Merge branch 'silent-overflow' of github.com:matthew-piziak/rust into silent-overflow 2016-10-09 06:35:42 -04:00
Matthew Piziak
dc607deac7 use UFCS with Add::add and Sub::sub instead of unstable attributes 2016-10-09 06:35:07 -04:00
Marcin Fatyga
d41c91c1fa Add or and or_else for ordering. 2016-10-09 12:01:17 +02:00
Tobias Bucher
70dcfd634e Use try_into and move some functions 2016-10-09 10:49:05 +02:00