Commit Graph

34595 Commits

Author SHA1 Message Date
bors
afd657e207 auto merge of #18556 : seanmonstar/rust/tm-fmt, r=alexcrichton
The internals of strftime were converted to use a single formatter,
instead of creating and concatenating a bunch of small strings. This
showed ~3x improvement in the benches.

Also, since the formatted time may be going straight to a Writer, TmFmt
was introduced, and is returned from all formatting methods on Tm. This
allows the saving of another string allocation. Anyone wanting a String
can just call .to_string() on the returned value.

This runs validation prior to return the created `TmFmt`, catching errors before formatting happens. The specialized formats skip this validation, since we already know they are valid.

[breaking-change]
2014-11-08 07:06:36 +00:00
mdinger
c39e9f3437 Reword &str coercion into viewing 2014-11-08 00:46:11 -05:00
bors
7bc3588faf auto merge of #18729 : bkoropoff/rust/issue-18711, r=cmr
Closes #18711
2014-11-08 05:01:34 +00:00
bors
c437fcf3e5 auto merge of #18724 : gamazeps/rust/toc, r=alexcrichton
Using @adrientetar advices

Closes #17505
2014-11-08 02:26:37 +00:00
Sean McArthur
7ddf8cb0e0 libtime: alter strftime to use a TmFmt
The internals of strftime were converted to use a single formatter,
instead of creating and concatenating a bunch of small strings. This
showed ~3x improvement in the benches.

Also, since the formatted time may be going straight to a Writer, TmFmt
was introduced, and is returned from all formatting methods on Tm. This
allows the saving of another string allocation. Anyone wanting a String
can just call .to_string() on the returned value.

[breaking-change]
2014-11-07 17:49:40 -08:00
Jorge Aparicio
54068eea42 Update Partial/Total Eq/Ord terminology 2014-11-07 19:19:36 -05:00
Joseph Crail
12db4de554 Add tests for BitAnd and BitXor. 2014-11-07 18:46:29 -05:00
bors
e81670856a auto merge of #18723 : mprobinson/rust/fence-typos, r=thestinger 2014-11-07 23:31:38 +00:00
Jorge Aparicio
3c442b92ae syntax: Use UFCS in the expansion of #[deriving(PartialOrd)] 2014-11-07 18:26:44 -05:00
Joseph Crail
01b599eb34 Add BitXor to EnumSet. 2014-11-07 18:00:14 -05:00
Joseph Crail
e15a3903e0 Rename deprecated EnumSet methods in unit tests. 2014-11-07 17:55:39 -05:00
Joseph Crail
a79d4be39c Implement len() for EnumSet. 2014-11-07 16:08:43 -05:00
Niko Matsakis
cf4e53eee7 Fix tidy error 2014-11-07 15:58:19 -05:00
Niko Matsakis
091dc6e98a Purge the old once_fns, which are not coming back 2014-11-07 15:51:30 -05:00
Niko Matsakis
3112771001 Update tests where we don't report errors twice anymore 2014-11-07 15:51:30 -05:00
Niko Matsakis
244231720d Update parser with for syntax 2014-11-07 15:51:30 -05:00
Niko Matsakis
c18a1327e3 Make TyTrait embed a TraitRef, so that when we extend TraitRef, it naturally carries over to object types.
I wanted to embed an `Rc<TraitRef>`, but I was foiled by the current
static rules, which prohibit non-Sync values from being stored in
static locations. This means that the constants for `ty_int` and so
forth cannot be initialized.
2014-11-07 15:51:30 -05:00
bors
6ee56c9a5f auto merge of #18688 : bkoropoff/rust/unboxed-closure-subst-fixes, r=nikomatsakis
This resolves some issues that remained after adding support for monomorphizing unboxed closures in trans.

There were a few places where a set of substitutions for an unboxed closure type were dropped on the floor and later recalculated from scratch based on the def ID, but this failed spectacularly when the closure originated from a different param environment.  The substitutions are now plumbed through end-to-end.  Closes #18661

There was also a conflict in the meaning of the self param space within the body of the unboxed closure.  Trans attempted to insert the unboxed closure type as the self type, but this could conflict with the self type from the param environment when an unboxed closure was used within a default method on a trait.  Since the body of an unboxed closure cannot refer to its own self type or value, there's no need for it to actually use the self space.  The downstream consumers of the substitutions in trans do not seem to need it either since they look up the type of the closure some other way, so I just stopped setting it.  Closes #18685.

r? @pcwalton @nikomatsakis
2014-11-07 20:41:29 +00:00
Alex Crichton
3dbd32854f rustc: Process #[cfg]/#[cfg_attr] on crates
This commit implements processing these two attributes at the crate level as
well as at the item level. When #[cfg] is applied at the crate level, then the
entire crate will be omitted if the cfg doesn't match. The #[cfg_attr] attribute
is processed as usual in that the attribute is included or not depending on
whether the cfg matches.

This was spurred on by motivations of #18585 where #[cfg_attr] annotations will
be applied at the crate-level.

cc #18585
2014-11-07 12:04:28 -08:00
Carol Nichols
fc47dd9c0f Prepend should be append in the 30 minute intro
The examples are about adding to the end of the array, not the
beginning.
2014-11-07 14:59:42 -05:00
bors
0a3cbf8cf4 auto merge of #18673 : VHaravy/rust/issue-18632, r=alexcrichton
1. Introduce `putpathvar` function that prints variable shell-quoted by using `%q` format specifier. This function is used within `probe` to save the result into `config.tmp`.
2. Removes search-and-replace pattern that transforms `\` into `/` as it messes up shell-quoted strings.
2014-11-07 18:46:25 +00:00
Valerii Hiora
a722f70207 Properly static lib packaging
Fixes #18574
2014-11-07 19:14:22 +02:00
bors
0b48001c28 auto merge of #17830 : pczarn/rust/interp_tt, r=pnkfelix
Closes #14197

Removes the `matchers` nonterminal.

If you're using `$foo:matchers` in a macro, write `$foo:tt` instead.

[breaking-change]
2014-11-07 15:26:26 +00:00
bors
223ca76439 auto merge of #18721 : SimonSapin/rust/safer-enumset, r=alexcrichton
Assert at run time instead. Fixes #13756.

I’d rather have this be detected at compile-time, but I don’t know how to do that.
2014-11-07 13:31:25 +00:00
Vitali Haravy
c7a0b9c562 Do not put double quotes around empty variables. 2014-11-07 13:17:11 +00:00
Utkarsh Kukreti
0741dd795a Remove unnecessary .to_string()s from Vec.swap_remove's doc example. 2014-11-07 17:34:32 +05:30
bors
97a57ec909 auto merge of #18714 : nikomatsakis/rust/issue-18621-deref-for-refs, r=aturon
libs: add Deref, DerefMut impls for references, fixing a bug in compiler in the process that was blocking this.

r? @aturon
2014-11-07 11:31:25 +00:00
bors
932eec7d70 auto merge of #18698 : japaric/rust/index, r=alexcrichton
Closes #16529

r? @aturon
2014-11-07 09:31:50 +00:00
Piotr Czarnecki
00676c8ea2 Add ast::SequenceRepetition 2014-11-07 10:21:57 +01:00
Piotr Czarnecki
964191a313 Add and update tests 2014-11-07 10:21:50 +01:00
bors
a0a7ab4612 auto merge of #18672 : brandonson/rust/functional-update-walk, r=nikomatsakis
Fixes #18567. `Struct{x:foo, .. with_expr}` did not walk `with_expr`, which allowed
using moved variables in some cases.  The CFG for structs also built up with
`with_expr` happening before the fields, which is now reversed. (Fields are now
before the `with_expr` in the CFG)
2014-11-07 07:16:33 +00:00
Chris Morgan
1971e02ec6 Derive Clone for TypeId. 2014-11-07 17:12:44 +11:00
Brian Koropoff
2c956d0abf Add regression test for #18652 2014-11-06 20:46:23 -08:00
Brian Koropoff
c3c72239b7 Remove incorrect assert in trans
As an optimization, once unboxed closures receive their environment by
value if it fits within the size of an `int`.  An assert in this code
path assumed that this would only occur if the environment had no more
than a single free variable in it, but multiple smaller free variables
can easily be packed into the space of an `int`, particularly if any
of them are 0-sized.  The assert can simply be removed.

Closes #18652
2014-11-06 20:40:32 -08:00
Brian Koropoff
5f6392d848 Add regression test for #18711 2014-11-06 19:33:47 -08:00
Brian Koropoff
bb0a719434 Fix panic due to overly long borrow of RefCell
Closes #18711
2014-11-06 19:31:56 -08:00
Niko Matsakis
f2aaed8338 libs: add Deref, DerefMut impls for references, fixing a bug in compiler in the process that was blocking this.
Fixes #18621.
2014-11-06 21:51:40 -05:00
Brian Koropoff
ddb17b239b Add regression test for #18685 2014-11-06 18:17:58 -08:00
Brian Koropoff
d317039b22 Add regression test for #18661 2014-11-06 18:17:58 -08:00
Brian Koropoff
daa215e8c5 Fix handling of unboxed closure type param substitutions
- When selecting an implicit trait impl for an unboxed closure, plumb
  through and use the substitutions from impl selection instead of
  using those from the current param environment in trans, which may
  be incorrect.
- When generating a function declaration for an unboxed closure, plumb
  through the substitutions from the param environment of the closure
  as above.  Also normalize the type to avoid generating duplicate
  declarations due to regions being inconsistently replaced with
  ReStatic elsewhere.
- Do not place the closure type in the self param space when
  translating the unboxed closure callee, etc.  It is not actually
  used, and doing so conflicts with the self substitution from
  default trait methods.

Closes #18661
Closes #18685
2014-11-06 18:17:57 -08:00
Simon Sapin
d8ab2f87c1 Add example impl in CLike docs. Fix 13752. 2014-11-06 18:16:18 -08:00
Simon Sapin
a22772d6a6 EnumSet assertion: better error message. 2014-11-06 18:16:17 -08:00
Simon Sapin
1fdb759527 Make EnumSet not silently corrupt data.
Assert at run time instead. Fixes #13756.

I’d rather have this be detected at compile-time, but I don’t know how to do that.
2014-11-06 18:15:59 -08:00
bors
b03a275519 auto merge of #18713 : juxiliary/rust/master, r=alexcrichton
* `from_str_radix_float` gives incorrect results for negative float strings. Changes the accumulator used to start at -0.0 instead of -1.0.
* Adds missing tests
2014-11-07 02:11:27 +00:00
Jorge Aparicio
f7c1771fd1 Implement Index/IndexMut for [T]
Closes #16529
2014-11-06 21:11:19 -05:00
bors
45cbdec417 auto merge of #18719 : alexcrichton/rust/rollup, r=alexcrichton 2014-11-07 00:02:18 +00:00
Alex Crichton
d27039d701 rollup merge of #18709 : alexcrichton/fix-windows 2014-11-06 15:55:46 -08:00
Alex Crichton
2655abdd39 fix EnumSet::is_subset
Fix by @Gankro!
2014-11-06 15:41:50 -08:00
Mike Robinson
cd59582609 Fix atomic::fence documentation typos 2014-11-06 23:14:02 +00:00
gamazeps
9e5b283e17 Guide: Puts the toc again in the doc
Closes #17505
2014-11-07 00:06:58 +01:00