Commit Graph

34469 Commits

Author SHA1 Message Date
bors
f637f1c5a2 auto merge of #19050 : japaric/rust/moar-dst, r=aturon
r? @aturon 
cc #16918
2014-11-18 03:26:36 +00:00
Murarth
2293a04b49 libsyntax: Add tests for parse_view_item 2014-11-17 20:26:21 -07:00
Murarth
7ef200774f libsyntax: Add parse_view_item method to Parser 2014-11-17 20:26:21 -07:00
NODA, Kai
3fcf2840a4 libcore: add num::Int::pow() and deprecate num::pow().
Signed-off-by: NODA, Kai <nodakai@gmail.com>
2014-11-18 10:42:27 +08:00
bors
9c96a79a74 auto merge of #19049 : jakub-/rust/roll-up, r=alexcrichton
r? @alexcrichton
2014-11-18 01:02:19 +00:00
Jakub Bukaj
330a1afae8 Fix compilation and tests after the roll-up 2014-11-18 01:14:14 +01:00
Jorge Aparicio
d50e80f449 librustc: DSTify ClassList, LlvmRepr and Repr 2014-11-17 18:43:28 -05:00
Jakub Bukaj
9673365b37 rollup merge of #19045: jmesmon/jemalloc-flags-2
- CFG_CFLAGS is only used for jemalloc
- We grew an extra set of flags for jemalloc (CFG_JEMALLOC_CFLAGS) in addition to CFG_CFLAGS
- This kills of CFG_CFLAGS and keeps the more specific and less confusing CFG_JEMALLOC_CFLAGS
- Additionally, pass CFG_JEMALLOC_CFLAGS to jemalloc's configure slightly differently so things work when people use --sysroot in their CFLAGS.
2014-11-18 00:24:10 +01:00
Jakub Bukaj
2f8da7bbd0 rollup merge of #19041: japaric/clone
Closes #19037
cc #16918

r? @aturon
2014-11-18 00:24:08 +01:00
Jakub Bukaj
da5c61d469 rollup merge of #19038: jayelm/fixed-typos
Baby steps here...

Fixed some comments in liblog, libregex, librustc, libstd.
2014-11-18 00:24:08 +01:00
Jakub Bukaj
de05565ba3 rollup merge of #19029: vberger/stability_function_body
Items defined in the body of a function has no visibility outside it, and thus have no reason to inherit its stability.

Closes #17488
2014-11-18 00:24:07 +01:00
Jakub Bukaj
f3759dd2b6 rollup merge of #19026: alfie/doc-fixes
Updated all the adjacent character literals in the BCNF that cannot have an optional space between them
2014-11-18 00:24:06 +01:00
Jakub Bukaj
20241aa408 rollup merge of #19020: Gankro/better-warn
Came up on IRC that this was a bit unhelpful as to what should actually be *done*. I am new to changing compiler messages, please let me know if there's anything else that needs to be done to accomadate this change.

(My build system is still constantly crashing [Is bors contagious?], so this hasn't been formally `check`ed. I figure it's a simple enough change that any consequences [like compile-fail expected messages?] can be eyeballed by someone more experienced.)
2014-11-18 00:24:05 +01:00
Jakub Bukaj
f712a6fd01 rollup merge of #19018: tomjakubowski/fix-issue-19003
Make struct variant syntax more consistent with struct syntax and fix an
assert in middle::typeck.

Fix #19003
2014-11-18 00:24:04 +01:00
Jakub Bukaj
f1fd6b9407 rollup merge of #19016: gkoz/use_util_copy
This code is identical to io::util::copy()
2014-11-18 00:24:03 +01:00
Jakub Bukaj
789777babd rollup merge of #19015: alex/libcore-typos 2014-11-18 00:24:02 +01:00
Jakub Bukaj
7783e80d98 rollup merge of #19013: jakub-/issue-18986
Fixes #18986.
2014-11-18 00:24:01 +01:00
Jakub Bukaj
bcd3a4f42b rollup merge of #19008: alex/collections-typos 2014-11-18 00:24:00 +01:00
Jakub Bukaj
559c2cfe75 rollup merge of #19000: IvanUkhov/doc-link-dylib
Hello,

`dylib` [seems][1] to be no longer an option for the `kind` key of the `link` attribute.

UPDATE: It should be the other way around: It [seems][1] `dylib` has been lost as a possible variant of the `kind` key of the `link` attribute. See the comment below.

Regards,
Ivan

[1]: 8f87538786/src/librustc/metadata/creader.rs (L237)
2014-11-18 00:23:59 +01:00
Jakub Bukaj
6309d6e66e rollup merge of #18951: tbu-/pr_array_cloneshow
Due to not being able to parametrize over array sizes, `Clone` is only
implemented for element types that are `Copy`able.
2014-11-18 00:23:58 +01:00
Jakub Bukaj
76daa0c77c rollup merge of #18921: oli-obk/refactoring/graphviz/id/new/result_instead_of_fail
creating a new Id object requires the format to match a subset of `ID` format defined by the DOT language. When the format did not match, the function called assert. This was not mentioned in the docs or the spec. I made the failure explicit by returning an Result<Id, ()>.
2014-11-18 00:23:57 +01:00
Jakub Bukaj
db4d60afb0 rollup merge of #18911: canndrew/slice_shift_char
`slice_shift_char` splits a `str` into it's leading `char` and the remainder of the `str`. Currently, it returns a `(Option<char>, &str)` such that:

    "bar".slice_shift_char() => (Some('b'), "ar")
    "ar".slice_shift_char()  => (Some('a'), "r")
    "r".slice_shift_char()   => (Some('r'), "")
    "".slice_shift_char()    => (None,      "")

This is a little odd. Either a `str` can be split into both a head and a tail or it cannot. So the return type should be `Option<(char, &str)>`. With the current behaviour, in the case of the empty string, the `str` returned is meaningless - it is always the empty string.

This PR changes `slice_shift_char` so that:

    "bar".slice_shift_char() => Some(('b', "ar"))
    "ar".slice_shift_char()  => Some(('a', "r"))
    "r".slice_shift_char()   => Some(('r', ""))
    "".slice_shift_char()    => None
2014-11-18 00:23:55 +01:00
Jakub Bukaj
7137c2cc83 rollup merge of #18910: aturon/borrow-traits
Following [the collections reform RFC](https://github.com/rust-lang/rfcs/pull/235), this PR:

* Adds a new `borrow` module to libcore. The module contains traits for borrowing data (`BorrowFrom` and `BorrowFromMut`), generalized cloning (`ToOwned`), and a clone-on-write smartpointer (`Cow`).

* Deprecates the `_equiv` family of methods on `HashMap` and `HashSet` by instead generalizing the "normal" methods like `get` and `remove` to use the new `std::borrow` infrastructure.

* Generalizes `TreeMap`, `TreeSet`, `BTreeMap` and `BTreeSet` to use the new `std::borrow` infrastructure for lookups.

[breaking-change]
2014-11-18 00:23:53 +01:00
Jakub Bukaj
fcf9fb6157 rollup merge of #18890: luqmana/tf
This is especially useful for declaring a static with external linkage in an executable. There isn't any way to do that currently since we mark everything in an executable as internal by default.

Also, a quick fix to have the no-compiler-rt target option respected when building staticlibs as well.
2014-11-18 00:23:50 +01:00
Cody P Schafer
600cec1cd8 mk/rt/jemalloc: pass CFG_GCCISH_CFLAGS inside CC instead of passing CFG_CFLAGS in EXTRA_CFLAGS
- CFG_CFLAGS is gone (it was previously only used by jemalloc anyhow).
 - CFG_JEMALLOC_CFLAGS may contain flags needed for the compiler to
   function (produce a binary output).
 - jemalloc's configure runs $(CC) without EXTRA_CFLAGS, and (without
   this change) will fail if any flags are required for CC to work.
2014-11-17 16:41:15 -05:00
Cody P Schafer
61e53c94f2 CFG_CFLAGS is only used for jemalloc, rename all uses to CFG_JEMALLOC_CFLAGS
i386-apple-ios already used CFG_JEMALLOC_CFLAGS, so merge that one
2014-11-17 16:41:09 -05:00
Nick Cameron
d46f7adb53 Regression test 2014-11-18 10:02:27 +13:00
Nick Cameron
85914df05a Disallow coercions from [T, ..n] to &[T]or *[T]
[breaking-change]

Insert an `&` to fix
2014-11-18 10:02:27 +13:00
Jakub Bukaj
54c76e6e81 Fix an ICE when using struct patterns with traits
Fixes #18986.
2014-11-17 21:49:41 +01:00
Jorge Aparicio
daa949e516 libsyntax: DSTify ToSource and ToSourceWithHygiene 2014-11-17 15:40:35 -05:00
bors
336349c932 auto merge of #18694 : nikomatsakis/rust/issue-18208-method-dispatch-2, r=nrc
This is a pretty major refactoring of the method dispatch infrastructure. It is intended to avoid gross inefficiencies and enable caching and other optimizations (e.g. #17995), though it itself doesn't seem to execute particularly faster yet. It also solves some cases where we were failing to resolve methods that we theoretically should have succeeded with.

Fixes #18674.

cc #18208
2014-11-17 20:37:19 +00:00
Niko Matsakis
99fbd34d7e Fix merge conflicts from making enum variants namespaced. 2014-11-17 15:25:56 -05:00
Luqman Aden
33893aebcf librustc: Whitelist linkage attribute for unused attribute lint since it's processed during trans. 2014-11-17 15:24:35 -05:00
Luqman Aden
acd890d96d Add tests. 2014-11-17 15:24:34 -05:00
Jorge Aparicio
38c17dc324 libtest: DSTify Stats 2014-11-17 15:19:56 -05:00
jmu303
215f693400 Fix several typos in comments
liblog, libregex, librustc, libstd
2014-11-17 14:41:47 -05:00
Jorge Aparicio
d429039e7b DSTify impl Clone for &T
Closes #19037
2014-11-17 14:35:27 -05:00
Aaron Turon
46be8eb47c Remove bogus Duration::span test 2014-11-17 11:26:48 -08:00
Aaron Turon
9f1217da91 Further DSTify Index traits 2014-11-17 11:26:48 -08:00
Aaron Turon
ff88510535 libcollections: generalize BTree* to use BorrowFrom
Generalizes the BTree-based collections to use the new BorrowFrom
infrastructure for more flexible lookups and removals.
2014-11-17 11:26:48 -08:00
Aaron Turon
7213de1c49 Fallout from deprecation
This commit handles the fallout from deprecating `_with` and `_equiv` methods.
2014-11-17 11:26:48 -08:00
Aaron Turon
80a2867ea7 libstd: Deprecate _equiv methods
This commit deprecates the `_equiv` family of methods on `HashMap` and
`HashSet` by instead generalizing the "normal" methods like `get` and
`remove` to use the new `std::borrow` infrastructure.

[breaking-change]
2014-11-17 11:26:47 -08:00
Aaron Turon
5eec666c8c libcollections: use BorrowFrom in TreeSet, Map
This commit generalizes methods like `get` and `remove` for `TreeMap`
and `TreeSet` to use the new `std::borrow` infrastructure.

[breaking-change]
2014-11-17 11:26:30 -08:00
Aaron Turon
4ab22355d4 libcore: add borrow module
Following [the collections reform
RFC](https://github.com/rust-lang/rfcs/pull/235),
this commit adds a new `borrow` module to libcore.

The module contains traits for borrowing data (`BorrowFrom` and
`BorrowFromMut`),
generalized cloning (`ToOwned`), and a clone-on-write smartpointer (`Cow`).
2014-11-17 11:26:30 -08:00
Niko Matsakis
d7bb01eb52 Use the quick reject mechanism during trait matching as well. Seems to
yield an incremental improvement (type-checking rustc drops from ~9s
to ~8s).
2014-11-17 14:25:11 -05:00
Niko Matsakis
d93921b348 Port a simplified versions of pcwalton's "quick reject" mechanism for quickly throwing out method candidates. Yields a 40%-50% improvement in typechecking time as well as lowering peak memory use from 2.2GB to 1.8GB (due to creating fewer types).
Conflicts:
	src/librustc/driver/config.rs
	src/librustc/middle/ty.rs
	src/librustc/middle/typeck/check/method.rs
	src/librustc/middle/typeck/check/mod.rs
	src/librustc/middle/typeck/coherence/mod.rs
2014-11-17 14:25:11 -05:00
Niko Matsakis
0ed0a4633b Correct indentation 2014-11-17 14:25:11 -05:00
Niko Matsakis
70aecde11d Correct long line 2014-11-17 14:25:11 -05:00
Niko Matsakis
e691192042 Substitute type/lifetimeInstatiate method type/early-bound lifetime parameters too when creating xform-self-type.
Fixes #18208.
2014-11-17 14:25:11 -05:00
Niko Matsakis
f8403aac81 Rewrite method resolution to be cleaner, more correct, and to lay
groundwork for better performance.

Key points:

- Separate out determining which method to use from actually selecting
  a method (this should enable caching, as well as the pcwalton fast-reject strategy).
- Merge the impl selection back into method resolution and don't rely on
  trait matching (this should perform better but also is needed to resolve some
  kind of conflicts, see e.g. `method-two-traits-distinguished-via-where-clause.rs`)
- Purge a lot of out-of-date junk and coercions from method lookups.
2014-11-17 14:25:11 -05:00