Commit Graph

17561 Commits

Author SHA1 Message Date
Brendan Zabarauskas
ab8068c9f2 Improve divide-by-zero error messages 2013-04-24 14:20:00 +10:00
Brendan Zabarauskas
f39152e07b Implement Natural trait
This adds the following methods to ints and uints:

- div
- modulo
- div_mod
- quot_rem
- gcd
- lcm
- divisible_by
- is_even
- is_odd

I have not implemented Natural for BigInt and BigUInt because they're a little over my head.
2013-04-24 14:18:01 +10:00
Brian Anderson
6373861510 core: Convert reinterpret_cast to transmute in TLS. #6039 2013-04-23 19:52:16 -07:00
Brendan Zabarauskas
aef249056e Implement Signed and Unsigned traits and remove related predicate functions 2013-04-24 12:46:26 +10:00
Brian Anderson
e944c7dade Merge remote-tracking branch 'brson/io'
This also reverts some changes to TLS that were leaking memory.

Conflicts:
	src/libcore/rt/uv/net.rs
	src/libcore/task/local_data_priv.rs
	src/libcore/unstable/lang.rs
2013-04-23 19:19:32 -07:00
bors
706096b319 auto merge of #6038 : alexcrichton/rust/more-unsafe, r=pcwalton
Because unsafe functions are never warned about, then all `unsafe` blocks in unsafe functions should definitely be warned about (no need to be redundant). This fixes this case, adds tests, cleans up remaining cases, and then fixes a few other import warnings being spit out.
2013-04-23 18:27:48 -07:00
Alex Crichton
0c2ab662b7 Fixing some various warnings about unused imports 2013-04-23 19:59:14 -04:00
Alex Crichton
4c08a8d6c3 Removing more unnecessary unsafe blocks throughout 2013-04-23 19:59:13 -04:00
Alex Crichton
c089a17854 Improve the unused unsafe block warning to include unsafe blocks in unsafe functions 2013-04-23 19:40:34 -04:00
Brian Anderson
2a819ae465 core::rt: Tasks to not require an unwinder
A task without an unwinder will abort the process on failure.
I'm using this in the runtime tests to guarantee that a call to
`assert!` actually triggers some kind of failure (an abort)
instead of silently doing nothing. This is essentially in lieu
of a working linked failure implementation.
2013-04-23 15:11:28 -07:00
bors
8708e0c099 auto merge of #6010 : Dretch/rust/run-windows, r=brson
This fixes #5976.

It also removes `os::waitpid` in favour of (the existing) `run::waitpid`. I included this change because I figured it is kind of related.

r?
2013-04-23 14:12:48 -07:00
gareth
62befac51f Cleanup some mistakes made during rebasing/merging. 2013-04-23 21:23:16 +01:00
gareth
ceeffa1ec6 Oops, the should_fail test needs to be ignored on windows. 2013-04-23 21:23:16 +01:00
gareth
690120d6bc Remove os::waitpid because:
- The return value meant different things on different
   platforms (on windows, it was the exit code, on unix it was
   the status information returned from waitpid).
 - It was undocumented.
 - There also exists run::waitpid, which does much the same
   thing but has a more consistent return value and also some
   documentation.
2013-04-23 21:23:16 +01:00
gareth
91aeecf7e3 Fix issue #5976 - HANDLE leaks and undefined/bad behavour
on windows.
2013-04-23 21:23:15 +01:00
bors
0b90493f7e auto merge of #6034 : thestinger/rust/num, r=catamorphism,pcwalton 2013-04-23 12:27:47 -07:00
bors
d9896d592b auto merge of #6028 : Kimundi/rust/strconv-test-fixup, r=brson
r? @brson 

Can't test atm, but it probably failed because of 32bit float precision loss of the float literal.
2013-04-23 11:30:54 -07:00
Daniel Micay
a3e33cfb6e inline the primitive numeric operations 2013-04-23 14:05:41 -04:00
bors
88ccee78a8 auto merge of #6022 : catamorphism/rust/warning-police, r=catamorphism 2013-04-23 10:36:50 -07:00
Tim Chevalier
7169907e9f rustc: Remove dead code 2013-04-23 10:17:41 -07:00
Tim Chevalier
aac73b24ae rustc: Comments only: change XXX to FIXME 2013-04-23 10:17:41 -07:00
Tim Chevalier
52d3f5558e core, rustc: Warning police 2013-04-23 10:17:38 -07:00
bors
8cadcc47ee auto merge of #6027 : alexcrichton/rust/more-backticks, r=catamorphism
It seems that the general convention of error messages is to have keywords in backticks, so it's probably a good idea to keep doing that.
2013-04-23 09:48:49 -07:00
bors
0290caa885 auto merge of #6026 : isanbard/rust/ca73fbf72615575f106ee18160580711aca89d85, r=catamorphism
When the number of parameters is 1, then 'parameter' should remain singular.
Otherwise pluralize it.
2013-04-23 02:33:49 -07:00
Marvin Löbel
b813d68abe Attempt to fix x86 only strconv test failure 2013-04-23 11:10:37 +02:00
bors
212256b1a0 auto merge of #6025 : alexcrichton/rust/issue-2697, r=catamorphism
Closes #2697

I guess all of the uses weren't around any more, because everything continued to compile (at least on OSX). If bors doesn't like it for another platform I can try to track it down as well.
2013-04-23 01:36:48 -07:00
bors
54b0cbf86e auto merge of #6020 : yichoi/rust/pull-0423, r=brson
fix for missing ARM support to pass make stage of rpass
2013-04-23 00:06:49 -07:00
bors
da601be9f2 auto merge of #6017 : brson/rust/revert-span-merge, r=catamorphism
This reverts commit 6030e3982a.

This reorders error messages in ways that aren't intended. A more satisfying solution will require an interface that allows diagnostics to be grouped together, so that messages that logically belong together aren't reordered.

#4569
2013-04-22 23:09:51 -07:00
Alex Crichton
8884c6abdb Use backticks for the unsafe keyword in error messages 2013-04-23 02:06:47 -04:00
Bill Wendling
ca73fbf726 Use correct grammar for error message.
When the number of parameters is 1, then 'parameter' should remain singular.
Otherwise pluralize it.
2013-04-22 22:08:09 -07:00
bors
2871f4df6f auto merge of #6015 : catamorphism/rust/rustpkg-doc-second-try, r=catamorphism
r? @graydon

Only change from the version that you read is that I addressed your comment about `RUST_PATH`.
2013-04-22 22:03:49 -07:00
Alex Crichton
391de1c690 Remove a stray new operator in rust_task.h 2013-04-23 00:55:13 -04:00
Brian Anderson
f4af40a1db mk: core has another level of directories with rt/io/net 2013-04-22 21:27:24 -07:00
bors
3867470feb auto merge of #6013 : gifnksm/rust/bigint-quot-rem, r=graydon
BigInt had been supported quot/rem and div/mod correctly, but after merging #5990 they have been broken.
This commit fixes it.
2013-04-22 21:09:49 -07:00
bors
309f0c5603 auto merge of #6019 : brson/rust/xfail, r=brson 2013-04-22 19:36:50 -07:00
Young-il Choi
8eb22ecd6d test: fix for missing ARM support 2013-04-23 11:31:54 +09:00
Brian Anderson
08bbf4b019 core: ignore test from_str_ignore_underscores. Broken on i686. #6018 2013-04-22 19:25:25 -07:00
Brian Anderson
8a2f9cae21 core::rt: Fix a use after free in uv 'write' 2013-04-22 19:20:31 -07:00
Brian Anderson
a292d51750 mk: Pass CFLAGS to the uv build 2013-04-22 19:20:12 -07:00
bors
b8441ca8a6 auto merge of #6007 : pcwalton/rust/use-mod, r=brson
r? @brson
2013-04-22 18:36:50 -07:00
Tim Chevalier
4508da226a rustpkg: In doc, mention other implicit RUST_PATH entries
as per Graydon's comment
2013-04-22 18:17:32 -07:00
Tim Chevalier
d834c0d59d docs: Sketch out rustpkg manual 2013-04-22 18:17:32 -07:00
Brian Anderson
81110c55e8 Revert "Errors with the same span print the span once"
This reverts commit 6030e3982a.
2013-04-22 17:47:49 -07:00
bors
773f7e7560 auto merge of #5996 : sanxiyn/rust/target-feature, r=graydon
Fix #1879.
2013-04-22 17:36:49 -07:00
Brian Anderson
42c0f88232 core::rt: Add unwinding to newsched tasks 2013-04-22 17:15:31 -07:00
bors
05f9586d06 auto merge of #5980 : Kimundi/rust/ascii-encoding, r=thestinger
Added Ascii type to use for byte inputs that are known to contain Ascii only.
2013-04-22 16:33:51 -07:00
bors
aba93c6b60 auto merge of #5966 : alexcrichton/rust/issue-3083, r=graydon
Closes #3083.

This takes a similar approach to #5797 where a set is present on the `tcx` of used mutable definitions. Everything is by default warned about, and analyses must explicitly add mutable definitions to this set so they're not warned about.

Most of this was pretty straightforward, although there was one caveat that I ran into when implementing it. Apparently when the old modes are used (or maybe `legacy_modes`, I'm not sure) some different code paths are taken to cause spurious warnings to be issued which shouldn't be issued. I'm not really sure how modes even worked, so I was having a lot of trouble tracking this down. I figured that because they're a legacy thing that I'd just de-mode the compiler so that the warnings wouldn't be a problem anymore (or at least for the compiler).

Other than that, the entire compiler compiles without warnings of unused mutable variables. To prevent bad warnings, #5965 should be landed (which in turn is waiting on #5963) before landing this. I figured I'd stick it out for review anyway though.
2013-04-22 15:36:51 -07:00
Brian Anderson
5fbb0949a5 core::rt: Add implementations of Reader, Writer, and Listener for Option
These will make it easier to write I/O code without worrying about errors
2013-04-22 15:08:47 -07:00
gifnksm
a117cf03bc libstd: correct bigint's quot/rem, div/modulo 2013-04-23 07:04:05 +09:00
Brian Anderson
fe13b86519 Make conditions public. #6009 2013-04-22 14:43:02 -07:00