Erick Tryzelaar
01be9e9904
extra: Add ToBigInt and ToBigUint traits
2013-10-02 07:55:42 -07:00
Erick Tryzelaar
9de7ad2d8c
std: Swap {To,From}Primitive to use the 64bit as the unimplemented version
...
One downside with this current implementation is that since BigInt's
default is now 64 bit, we can convert larger BigInt's to a primitive,
however the current implementation on 32 bit architectures does not
take advantage of this fact.
2013-10-02 07:55:42 -07:00
Erick Tryzelaar
5a64e1a35a
test: add compile-fail test for #[deriving(FromPrimitive)]
2013-10-02 07:55:41 -07:00
Erick Tryzelaar
8f8cc061d9
syntax: swap from .span_fatal to .span_err in #[deriving(FromPrimitive)]
2013-10-02 07:55:41 -07:00
Erick Tryzelaar
0feaccf526
syntax: Add #[deriving(FromPrimitive)] syntax extension
...
Right now this only works for c-style enums.
2013-10-02 07:55:41 -07:00
Erick Tryzelaar
d9d1dfc195
std: Replace num::IntConvertible with {To,From}Primitive
2013-10-02 07:55:41 -07:00
Daniel Micay
f2932e4661
make small (<= size_of::<int>()) enums immediate
...
C-like enums are excluded from this for now, because the code paths
specific to them need to be changed.
fn foo() -> Option<~int> { Some(~5) }
Before:
; Function Attrs: uwtable
define void @_ZN3foo18hdec6e36682b87eeaf4v0.0E(%"enum.std::option::Option<~int>[#1 ]"* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
"function top level":
%2 = tail call %"enum.std::libc::types::common::c95::c_void[#1 ]"* @"_ZN2rt11global_heap10malloc_raw17h56c543b77f9b78aY11v0.9$x2dpreE"({ i64, %tydesc*, i8*, i8*, i8 }* undef, i64 8)
%3 = bitcast %"enum.std::libc::types::common::c95::c_void[#1 ]"* %2 to i64*
store i64 5, i64* %3, align 8
%4 = getelementptr inbounds %"enum.std::option::Option<~int>[#1 ]"* %0, i64 0, i32 0
store i64* %3, i64** %4, align 8
ret void
}
After:
; Function Attrs: uwtable
define %"enum.std::option::Option<~int>[#1 ]" @_ZN3foo18h2cbf6557a3143edah4v0.0E({ i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
"function top level":
%1 = tail call %"enum.std::libc::types::common::c95::c_void[#1 ]"* @"_ZN2rt11global_heap10malloc_raw18hb1e9dd1beab35edau11v0.9$x2dpreE"({ i64, %tydesc*, i8*, i8*, i8 }* undef, i64 8)
%2 = bitcast %"enum.std::libc::types::common::c95::c_void[#1 ]"* %1 to i64*
store i64 5, i64* %2, align 8
%oldret = insertvalue %"enum.std::option::Option<~int>[#1 ]" undef, i64* %2, 0
ret %"enum.std::option::Option<~int>[#1 ]" %oldret
}
2013-10-02 10:02:52 -04:00
Daniel Micay
abe648d608
treat uninhabited enums as voidish
2013-10-02 10:02:52 -04:00
Florian Gilcher
4dc3ff9c80
Add an implementation of FromStr for ~str and @str
...
This fixes an issue for APIs that return FromStr. Before this change,
they would have to offer a seperate function for returning the source
string.
2013-10-02 15:37:59 +02:00
bors
17548378a7
auto merge of #9679 : pnkfelix/rust/de-pub-resolve-code, r=huonw
...
r? anyone
For context (and the archaeological dig that @huonw did to see how this arose), see:
https://botbot.me/mozilla/rust-internals/msg/6547222/
2013-10-02 06:36:30 -07:00
Daniel Micay
ee114b6cb1
avoid alloca in with_overflow intrinsics
...
This is pointless, since it's just used to load an `undef` value and
never touched again.
2013-10-02 08:53:47 -04:00
Felix S. Klock II
55da145ab1
De-pub resolve.rs
2013-10-02 14:33:01 +02:00
bors
d616603c84
auto merge of #9673 : huonw/rust/macros, r=catamorphism
...
That is, only a single expression or item gets parsed, so if there are
any extra tokens (e.g. the start of another item/expression) the user
should be told, rather than silently dropping them.
An example:
macro_rules! foo {
() => {
println("hi");
println("bye);
}
}
would expand to just `println("hi")`, which is almost certainly not
what the programmer wanted.
Fixes #8012 .
2013-10-02 04:21:26 -07:00
bors
d00c9269dc
auto merge of #9665 : alexcrichton/rust/snapshot, r=brson
...
Uses the new snapshots to kill the old `loop` and introduce the new `continue`.
2013-10-02 02:31:29 -07:00
bors
97cd495aca
auto merge of #9638 : pnkfelix/rust/fsk-issue7526-attempt-to-catch-nonuc-statics-in-match-patterns, r=alexcrichton
...
r? anyone
Address scariest part of #7526 by adding a new more specific lint (that is set to warn by default, rather than allow).
2013-10-02 01:16:31 -07:00
bors
33a5928b46
auto merge of #9656 : thestinger/rust/immediate, r=alexcrichton
...
fn foo() -> (u32, u8, u8, u8, u8) {
(4, 5, 6, 7, 8)
}
Before:
; Function Attrs: nounwind uwtable
define void @_ZN3foo18hbb616262f874f8daf4v0.0E({ i32, i8, i8, i8, i8 }* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
"function top level":
%2 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 0
store i32 4, i32* %2, align 4
%3 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 1
store i8 5, i8* %3, align 4
%4 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 2
store i8 6, i8* %4, align 1
%5 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 3
store i8 7, i8* %5, align 2
%6 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 4
store i8 8, i8* %6, align 1
ret void
}
After:
; Function Attrs: nounwind readnone uwtable
define { i32, i8, i8, i8, i8 } @_ZN3foo18hbb616262f874f8daf4v0.0E({ i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
"function top level":
ret { i32, i8, i8, i8, i8 } { i32 4, i8 5, i8 6, i8 7, i8 8 }
}
2013-10-01 21:56:27 -07:00
Huon Wilson
8284df9e7c
syntax: indicate an error when a macro ignores trailing tokens.
...
That is, only a single expression or item gets parsed, so if there are
any extra tokens (e.g. the start of another item/expression) the user
should be told, rather than silently dropping them.
An example:
macro_rules! foo {
() => {
println("hi");
println("bye);
}
}
would expand to just `println("hi")`, which is almost certainly not
what the programmer wanted.
Fixes #8012 .
2013-10-02 14:43:15 +10:00
Luis de Bethencourt
c463772ebd
extra: %U support in time::strftime
...
Fixes #2350
2013-10-01 22:20:46 -04:00
bors
1d6c01148c
auto merge of #9600 : MicahChalmer/rust/fill-with-code-around, r=catamorphism
...
This fixes a problem with paragraph fills: hitting M-q on a single-line-style (`//`) comment with code immediately before or after it would try to fill the code as part of the paragraph too.
2013-10-01 18:56:26 -07:00
Huon Wilson
bbbafc4e46
syntax: remove some dead code.
2013-10-02 11:43:10 +10:00
bors
88b0b511be
auto merge of #9578 : alexcrichton/rust/un-ignore-libuv-process-tests, r=brson
...
Closes #9341
2013-10-01 17:41:29 -07:00
Alex Crichton
02cbfce0b3
Move the rt::io::process tests to run-pass
...
Closes #9341
2013-10-01 17:04:17 -07:00
Alex Crichton
4f67dcb24a
Migrate users of 'loop' to 'continue'
...
Closes #9467
2013-10-01 15:53:13 -07:00
Alex Crichton
4af849bc12
Obsolete parsing 'loop' as 'continue'
2013-10-01 15:52:41 -07:00
bors
fe4e7478c5
auto merge of #9560 : pcwalton/rust/xc-tuple-structs, r=pcwalton
...
r? @thestinger
2013-10-01 15:06:25 -07:00
Patrick Walton
76d92c5472
librustc: Inline cross-crate tuple struct constructors
2013-10-01 14:24:34 -07:00
Alex Crichton
7f9b918562
Register new snapshots
2013-10-01 14:12:29 -07:00
bors
08b510c351
auto merge of #9519 : thestinger/rust/float, r=catamorphism
...
It is simply defined as `f64` across every platform right now.
A use case hasn't been presented for a `float` type defined as the
highest precision floating point type implemented in hardware on the
platform. Performance-wise, using the smallest precision correct for the
use case greatly saves on cache space and allows for fitting more
numbers into SSE/AVX registers.
If there was a use case, this could be implemented as simply a type
alias or a struct thanks to `#[cfg(...)]`.
Closes #6592
The mailing list thread, for reference:
https://mail.mozilla.org/pipermail/rust-dev/2013-July/004632.html
2013-10-01 13:01:28 -07:00
Daniel Micay
c9d4ad07c4
remove the float
type
...
It is simply defined as `f64` across every platform right now.
A use case hasn't been presented for a `float` type defined as the
highest precision floating point type implemented in hardware on the
platform. Performance-wise, using the smallest precision correct for the
use case greatly saves on cache space and allows for fitting more
numbers into SSE/AVX registers.
If there was a use case, this could be implemented as simply a type
alias or a struct thanks to `#[cfg(...)]`.
Closes #6592
The mailing list thread, for reference:
https://mail.mozilla.org/pipermail/rust-dev/2013-July/004632.html
2013-10-01 14:54:10 -04:00
bors
c8cdabc32f
auto merge of #9633 : alexcrichton/rust/issue-9631, r=huonw
...
Closes #9631
2013-10-01 11:26:27 -07:00
bors
24a253778a
auto merge of #9659 : alexcrichton/rust/fix-fmt, r=huonw
...
I was a little too trigger-happy in migrating from `format!` to `fmt!`...
2013-10-01 10:11:31 -07:00
Alex Crichton
62855e2c08
Fix usage of the old debug! macros
2013-10-01 10:01:14 -07:00
Alex Crichton
eafbcfb73c
Change the format! statics to be all-caps
...
This lets them get past the non_uppercase_statics lint mode (if it's turned on)
Closes #9631
2013-10-01 09:26:15 -07:00
Felix S. Klock II
2461b31026
incoporate suggestion from huonw to move code into lint.rs
2013-10-01 18:03:26 +02:00
Felix S. Klock II
88d34ff249
fix tests for check-fast.
2013-10-01 18:02:39 +02:00
Felix S. Klock II
06f46902ca
fix tests for check-fast.
2013-10-01 18:02:11 +02:00
bors
320af9b157
auto merge of #9645 : dckc/rust/patch-2, r=catamorphism
...
the switch from package `hello` to `pkg_id` is a little jarring; I'd use `<var>` but I don't see how. ALL_CAPS i.e. PKG_ID seems like a reasonable poor-man's `<var>`.
2013-10-01 07:36:35 -07:00
bors
12404aaadd
auto merge of #9644 : alexcrichton/rust/clarify, r=huonw
...
It was a little ambiguous before how explicitl positional parameters and
implicit positional parameters intermingled, and this clarifies how the two
intermingle. This also updates a little bit of documentation/code examples
elsewhere as well.
2013-10-01 06:26:31 -07:00
bors
0dce112af7
auto merge of #9636 : alexcrichton/rust/rustdoc, r=huonw
...
Commits have all the juicy details.
Import thing to note in this pull request is that `rustdoc html crate.rs` becomes `rustdoc crate.rs`
2013-10-01 04:31:31 -07:00
bors
ec2b9cc228
auto merge of #9657 : huonw/rust/oldfmt, r=huonw
...
This meant the "smooth" migration path @alexcrichton had planned was broken, since any use of the old `fmt!` met with an undefined macro error (and the logging was using the new syntax, accidentally).
2013-10-01 03:16:32 -07:00
Huon Wilson
6f166894ba
Fix typo with format migration: s/oldformat/oldfmt/.
2013-10-01 19:45:17 +10:00
bors
d6c3b67348
auto merge of #9576 : FlaPer87/rust/issue/9125, r=alexcrichton
...
Fixes #9125
2013-10-01 02:06:32 -07:00
bors
8bb48cc1e6
auto merge of #9599 : alexcrichton/rust/less-fmt, r=huonw
...
This also prevents future fmt! usage from leaking into the compiler, but it's still turned on by default for everyone else.
2013-10-01 00:56:33 -07:00
Alex Crichton
dec37051dd
Merge fall out of removing fmt!
2013-10-01 00:06:51 -07:00
Flavio Percoco
d379ff474f
Update std::task::mod docstring
2013-10-01 09:03:04 +02:00
Daniel Micay
5e4ae4f45f
make small (<= size_of::<int>()) tuples immediate
...
fn foo() -> (u32, u8, u8, u8, u8) {
(4, 5, 6, 7, 8)
}
Before:
; Function Attrs: nounwind uwtable
define void @_ZN3foo18hbb616262f874f8daf4v0.0E({ i32, i8, i8, i8, i8 }* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
"function top level":
%2 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 0
store i32 4, i32* %2, align 4
%3 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 1
store i8 5, i8* %3, align 4
%4 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 2
store i8 6, i8* %4, align 1
%5 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 3
store i8 7, i8* %5, align 2
%6 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 4
store i8 8, i8* %6, align 1
ret void
}
After:
; Function Attrs: nounwind readnone uwtable
define { i32, i8, i8, i8, i8 } @_ZN3foo18hbb616262f874f8daf4v0.0E({ i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
"function top level":
ret { i32, i8, i8, i8, i8 } { i32 4, i8 5, i8 6, i8 7, i8 8 }
}
2013-10-01 02:57:59 -04:00
bors
f6df7ab839
auto merge of #9617 : crabtw/rust/softfp, r=alexcrichton
...
This change adds --soft-float option for generating
software floating point library calls.
It also implies using soft float ABI, that is the same as llc.
It is useful for targets that have no FPU.
2013-09-30 23:51:31 -07:00
Alex Crichton
1f52cf439b
pretty: Remove usage of fmt!
2013-09-30 23:21:20 -07:00
Alex Crichton
9ce31f6dd9
tutorial: Remove usage of fmt!
2013-09-30 23:21:20 -07:00
Alex Crichton
73c6c9109f
bench: Remove usage of fmt!
2013-09-30 23:21:20 -07:00