The following are experimental:
- std::from_str::FromStr and impls - may need to return Result instead of Option
- std::int::parse_bytes, etc. - ditto
- std::num::FromStrRadix and impls - ditto
- std::num::from_str_radix - ditto
The following are deprecated:
- std::num::ToStrRadix and imples - Wrapper around fmt::radix. Wrong name (Str vs String)
See https://github.com/rust-lang/rust/wiki/Meeting-API-review-2014-06-23#uint
Steve Klabnik [Mon, 23 Jun 2014 22:19:16 +0000 (18:19 -0400)]
Add the Guide, add warning to tutorial.
In line with what @brson, @cmr, @nikomatsakis and I discussed this morning, my
redux of the tutorial will be implemented as the Guide. This way, I can work in
small iterations, rather than dropping a huge PR, which is hard to review. In
addition, the community can observe my work as I'm doing it.
This adds a note in line with [this comment][reddit] that clarifies the state
of the tutorial, and the community's involvement with it.
Alex Crichton [Mon, 23 Jun 2014 19:54:56 +0000 (12:54 -0700)]
rustc: Always include the morestack library
It was previously assumed that the object file generated by LLVM would always
require the __morestack function, but that assumption appears to be incorrect,
as outlined in #15108. This commit forcibly tells the linker to include the
entire archive, regardless of whether it's currently necessary or not.
Edward Wang [Mon, 23 Jun 2014 17:42:13 +0000 (01:42 +0800)]
Add tests for #12470 and #14285
The #14869 removed `TraitStore` from `ty_trait` and represented trait
reference as regular `ty_rptr`. An old bug of the missing constraint
upon lifetime parameter of trait reference then is fixed as a side
effect. Adds tests for affected bugs and closes them.
Alex Crichton [Wed, 28 May 2014 04:34:00 +0000 (21:34 -0700)]
std: Bring back half of Add on String
This adds an implementation of Add for String where the rhs is <S: Str>. The
other half of adding strings is where the lhs is <S: Str>, but coherence and
the libcore separation currently prevent that.
bors [Tue, 24 Jun 2014 22:06:48 +0000 (22:06 +0000)]
auto merge of #15024 : kmcallister/rust/lint, r=alexcrichton
This is a rebase of #14804 with two new commits on top to implement and test lint plugins.
r? @alexcrichton @huonw: Can you take a look at the new commits, and also weigh in about any issues from the old PR that you feel are still unresolved? I'm leaving the old branch alone to preserve discussion history.
* moving the state specific to a single lint out of Context, and
* replacing the soup of function calls in the Visitor impl with
more structured control flow
We're going to have more modules under lint, and the paths get unwieldy. We
also plan to have lints run at multiple points in the compilation pipeline.
bors [Tue, 24 Jun 2014 17:16:48 +0000 (17:16 +0000)]
auto merge of #15114 : ben0x539/rust/run-make-libpath, r=alexcrichton
It was accidentally removed in #15006 and that somehow got past the
build bots, causing `src/test/run-make/c-dynamic-dylib` to fail on at
least my linux system.
bors [Tue, 24 Jun 2014 13:46:54 +0000 (13:46 +0000)]
auto merge of #14963 : w3ln4/rust/master, r=alexcrichton
The aim of these changes is not working out a generic bi-endianness architectures support but to allow people develop for little endian MIPS machines (issue #7190).
bors [Tue, 24 Jun 2014 06:06:52 +0000 (06:06 +0000)]
auto merge of #15079 : nikomatsakis/rust/issue-5527-unify-refactor, r=pnkfelix
This is just a cleanup of the code. Doesn't really change anything deep about the way we operate. This is a prelude to implementing a good solution for one-way matching for #5527.
r? @pnkfelix (we were just crawling about this code, after all)
bors [Tue, 24 Jun 2014 04:16:53 +0000 (04:16 +0000)]
auto merge of #14952 : alexcrichton/rust/const-unsafe-pointers, r=brson
This does not yet change the compiler and libraries from `*T` to `*const T` as
it will require a snapshot to do so.
cc #7362
---
Note that the corresponding RFC, https://github.com/rust-lang/rfcs/pull/68, has not yet been accepted. It was [discussed at the last meeting](https://github.com/rust-lang/rust/wiki/Meeting-weekly-2014-06-10#rfc-pr-68-unsafe-pointers-rename-t-to-const-t) and decided to be accepted, however. I figured I'd get started on the preliminary work for the RFC that will be required regardless.
Benjamin Herr [Mon, 23 Jun 2014 11:12:37 +0000 (13:12 +0200)]
test: readd TMPDIR to LD_LIBRARY_PATH for run-make
It was accidentally removed in #15006 and that somehow got past the
build bots, causing `src/test/run-make/c-dynamic-dylib` to fail on at
least my linux system.
bors [Mon, 23 Jun 2014 00:11:39 +0000 (00:11 +0000)]
auto merge of #15068 : erickt/rust/mem-inline, r=pcwalton
This is a couple micro-optimizations I've been sitting on for a while. This inlines a couple functions that are important to the `std::io::mem`. Ultimately, this results in about a 15% performance increase in some micro-benchmarks for my [libserialize](https://github.com/erickt/rust-serde) rewrite.
Benjamin Herr [Sun, 22 Jun 2014 17:53:56 +0000 (19:53 +0200)]
libsyntax: don't allow enum structs with no fields
Unit-like structs are written as `struct Foo;`, but we erroneously
accepted `struct Foo();` and took it to mean the same thing. Now we
don't, so use the `struct Foo;` form!
Niko Matsakis [Fri, 20 Jun 2014 10:35:06 +0000 (06:35 -0400)]
Refactor the unification code and rejuvenate the unit test
infrastructure that has been accidentally left out of the build
for a rather long time (it was still using `@DVec`!)
bors [Sun, 22 Jun 2014 00:01:34 +0000 (00:01 +0000)]
auto merge of #15005 : dotdash/rust/i1_bool, r=alexcrichton
We currently compiled bools to i8 values, because there was a bug in
LLVM that sometimes caused miscompilations when using i1 in, for
example, structs.
Using i8 means a lot of unnecessary zero-extend and truncate operations
though, since we have to convert the value from and to i1 when using for
example icmp or br instructions. Besides the unnecessary overhead caused
by this, it also sometimes made LLVM miss some optimizations.
First, we have to fix some bugs concerning the handling of
attributes in foreign function declarations and calls. These
are required because the i1 type needs the ZExt attribute when
used as a function parameter or return type.
Then we have to update LLVM to get a bugfix without which LLVM
sometimes generates broken code when using i1.
And then, finally, we can switch bools over to i1.
Erick Tryzelaar [Sat, 21 Jun 2014 03:05:42 +0000 (23:05 -0400)]
std: inline many of the Writer/Reader methods
This allows llvm to optimize away much of the overhead from using
the MemReader/MemWriters. My benchmarks showed it to shave 15% off
of my in progress serialization/json encoding.
Erick Tryzelaar [Tue, 3 Jun 2014 04:56:29 +0000 (21:56 -0700)]
std: micro-optimize Vec constructors and add benchmarks
Generally speaking, inlining doesn't really help out with
constructing vectors, except for when we construct a zero-sized
vector. This patch allows llvm to optimize this case away in
a lot of cases, which shaves off 4-8ns. It's not much, but it
might help in some inner loop somewhere.
before:
running 12 tests
test bench_extend_0 ... bench: 123 ns/iter (+/- 6)
test bench_extend_5 ... bench: 323 ns/iter (+/- 11)
test bench_from_fn_0 ... bench: 7 ns/iter (+/- 0)
test bench_from_fn_5 ... bench: 49 ns/iter (+/- 6)
test bench_from_iter_0 ... bench: 11 ns/iter (+/- 0)
test bench_from_iter_5 ... bench: 176 ns/iter (+/- 11)
test bench_from_slice_0 ... bench: 8 ns/iter (+/- 1)
test bench_from_slice_5 ... bench: 73 ns/iter (+/- 5)
test bench_new ... bench: 0 ns/iter (+/- 0)
test bench_with_capacity_0 ... bench: 6 ns/iter (+/- 1)
test bench_with_capacity_100 ... bench: 41 ns/iter (+/- 3)
test bench_with_capacity_5 ... bench: 40 ns/iter (+/- 2)
after:
test bench_extend_0 ... bench: 123 ns/iter (+/- 7)
test bench_extend_5 ... bench: 339 ns/iter (+/- 27)
test bench_from_fn_0 ... bench: 7 ns/iter (+/- 0)
test bench_from_fn_5 ... bench: 54 ns/iter (+/- 4)
test bench_from_iter_0 ... bench: 11 ns/iter (+/- 1)
test bench_from_iter_5 ... bench: 182 ns/iter (+/- 16)
test bench_from_slice_0 ... bench: 4 ns/iter (+/- 0)
test bench_from_slice_5 ... bench: 62 ns/iter (+/- 3)
test bench_new ... bench: 0 ns/iter (+/- 0)
test bench_with_capacity_0 ... bench: 0 ns/iter (+/- 0)
test bench_with_capacity_100 ... bench: 41 ns/iter (+/- 1)
test bench_with_capacity_5 ... bench: 41 ns/iter (+/- 3)
Björn Steinbrink [Sun, 16 Mar 2014 08:29:05 +0000 (09:29 +0100)]
Compile bools to i1
We currently compiled bools to i8 values, because there was a bug in
LLVM that sometimes caused miscompilations when using i1 in, for
example, structs.
Using i8 means a lot of unnecessary zero-extend and truncate operations
though, since we have to convert the value from and to i1 when using for
example icmp or br instructions. Besides the unnecessary overhead caused
by this, it also sometimes made LLVM miss some optimizations.
Björn Steinbrink [Tue, 17 Jun 2014 16:34:50 +0000 (18:34 +0200)]
Update LLVM
To fix #8106, we need an LLVM version that contains r211082 aka 0dee6756
which fixes a bug that blocks that issue.
There have been some tiny API changes in LLVM, and cmpxchg changed its
return type. The i1 part of the new return type is only interesting when
using the new weak cmpxchg, which we don't do.
Björn Steinbrink [Tue, 17 Jun 2014 19:51:24 +0000 (21:51 +0200)]
Add missing attributes to indirect calls for foreign functions
When calling a foreign function, some arguments and/or return value
attributes are required to conform to the foreign ABI. Currently those
attributes are only added to the declaration of foreign functions. With
direct calls, this is no problem, because LLVM can see that those
attributes apply to the call. But with an indirect call, LLVM cannot do
that and the attribute is missing.
To fix that, we have to add those attribute to the calls to foreign
functions as well.
This also allows to remove the special handling of the SRet attribute,
which is ABI-dependent and will be set via the `attr` field of the
return type's `ArgType`.
Björn Steinbrink [Wed, 18 Jun 2014 11:01:23 +0000 (13:01 +0200)]
Correctly set return type attributes on foreign function declarations
The ArgType type gives us a generic way to specify an attribute for a
type to ensure ABI conformance for foreign functions. But the code that
actually sets the argument attributes in the function declaration
only sets the attribute for the return type when the type is indirect.
Since LLVMAddAttribute() doesn't allow to set attributes on the return
type, we have to use LLVMAddFunctionAttribute() instead.
This didn't cause problems yet, because currently only some indirect
types require attributes to be set.
bors [Sat, 21 Jun 2014 04:01:25 +0000 (04:01 +0000)]
auto merge of #15029 : aturon/rust/stability-index, r=brson
This commit makes several changes to the stability index infrastructure:
* Stability levels are now inherited lexically, i.e., each item's
stability level becomes the default for any nested items.
* The computed stability level for an item is stored as part of the
metadata. When using an item from an external crate, this data is
looked up and cached.
* The stability lint works from the computed stability level, rather
than manual stability attribute annotations. However, the lint still
checks only a limited set of item uses (e.g., it does not check every
component of a path on import). This will be addressed in a later PR,
as part of issue #8962.
* The stability lint only applies to items originating from external
crates, since the stability index is intended as a promise to
downstream crates.
* The "experimental" lint is now _allow_ by default. This is because
almost all existing crates have been marked "experimental", pending
library stabilization. With inheritance in place, this would generate
a massive explosion of warnings for every Rust program.
The lint should be changed back to deny-by-default after library
stabilization is complete.
* The "deprecated" lint still warns by default.
The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.
bors [Sat, 21 Jun 2014 02:11:22 +0000 (02:11 +0000)]
auto merge of #14731 : jakub-/rust/pattern-matching-refactor, r=alexcrichton
This PR is changing the error messages for non-exhaustive pattern matching to include a more accurate witness, i.e. a pattern that is not covered by any of the ones provided by the user. Example: