Commit Graph

926 Commits

Author SHA1 Message Date
Huon Wilson
b95a8c63fd std::ascii: Provide a copyless [Ascii] -> str method.
This renames to_str_ascii to as_str_ascii and makes it non-copying,
which is possible now that strings no longer have a hidden extra
byte/null terminator.

Fixes #6120.
2013-11-08 10:20:06 +11:00
Eric Holk
0a478b4ac6 Add ~ to the list of allowable URL characters. 2013-11-07 17:21:33 -05:00
niftynif
fbde419b38 Addressed style concerns in btree.rs and added it to the lib file.
Added documentation within btree.rs.
2013-11-07 13:34:20 -05:00
niftynif
058d785369 Re-arranging some things in btree.rs to accommodate testing. 2013-11-05 19:44:21 -05:00
niftynif
e6dde28c95 Added skeleton implementation of a B-tree with a few bells and
whistles.  No major functionality added yet (such as insertion and
removal).
2013-11-04 19:45:49 -05:00
Alex Crichton
3c3ed1499a Move io::file to io::fs and fns out of File
This renames the `file` module to `fs` because that more accurately describes
its current purpose (manipulating the filesystem, not just files).

Additionally, this adds an UnstableFileStat structure as a nested structure of
FileStat to signify that the fields should not be depended on. The structure is
currently flagged with #[unstable], but it's unlikely that it has much meaning.

Closes #10241
2013-11-04 10:28:55 -08:00
Alex Crichton
f19d083362 Fill out the remaining functionality in io::file
This adds bindings to the remaining functions provided by libuv, all of which
are useful operations on files which need to get exposed somehow.

Some highlights:

* Dropped `FileReader` and `FileWriter` and `FileStream` for one `File` type
* Moved all file-related methods to be static methods under `File`
* All directory related methods are still top-level functions
* Created `io::FilePermission` types (backed by u32) that are what you'd expect
* Created `io::FileType` and refactored `FileStat` to use FileType and
  FilePermission
* Removed the expanding matrix of `FileMode` operations. The mode of reading a
  file will not have the O_CREAT flag, but a write mode will always have the
  O_CREAT flag.

Closes #10130
Closes #10131
Closes #10121
2013-11-03 15:15:42 -08:00
Alex Crichton
9c1851019f Remove all blocking std::os blocking functions
This commit moves all thread-blocking I/O functions from the std::os module.
Their replacements can be found in either std::rt::io::file or in a hidden
"old_os" module inside of native::file. I didn't want to outright delete these
functions because they have a lot of special casing learned over time for each
OS/platform, and I imagine that these will someday get integrated into a
blocking implementation of IoFactory. For now, they're moved to a private module
to prevent bitrot and still have tests to ensure that they work.

I've also expanded the extensions to a few more methods defined on Path, most of
which were previously defined in std::os but now have non-thread-blocking
implementations as part of using the current IoFactory.

The api of io::file is in flux, but I plan on changing it in the next commit as
well.

Closes #10057
2013-11-03 15:15:42 -08:00
Chris Morgan
0369a41f0e Rename files to match current recommendations.
New standards have arisen in recent months, mostly for the use of
rustpkg, but the main Rust codebase has not been altered to match these
new specifications. This changeset rectifies most of these issues.

- Renamed the crate source files `src/libX/X.rs` to `lib.rs`, for
  consistency with current styles; this affects extra, rustc, rustdoc,
  rustpkg, rustuv, std, syntax.

- Renamed `X/X.rs` to `X/mod.rs,` as is now recommended style, for
  `std::num` and `std::terminfo`.

- Shifted `src/libstd/str/ascii.rs` out of the otherwise unused `str`
  directory, to be consistent with its import path of `std::ascii`;
  libstd is flat at present so it's more appropriate thus.

While this removes some `#[path = "..."]` directives, it does not remove
all of them, and leaves certain other inconsistencies, such as `std::u8`
et al. which are actually stored in `src/libstd/num/` (one subdirectory
down). No quorum has been reached on this issue, so I felt it best to
leave them all alone at present. #9208 deals with the possibility of
making libstd more hierarchical (such as changing the crate to match the
current filesystem structure, which would make the module path
`std::num::u8`).

There is one thing remaining in which this repository is not
rustpkg-compliant: rustpkg would have `src/std/` et al. rather than
`src/libstd/` et al. I have not endeavoured to change that at this point
as it would guarantee prompt bitrot and confusion. A change of that
magnitude needs to be discussed first.
2013-11-03 23:49:01 +11:00
Alex Crichton
9df164c145 Register new snapshots
Closes #2240
2013-11-01 16:51:33 -07:00
Alex Crichton
e2a68b6867 Give test and main tasks better names
Tests now have the same name as the test that they're running (to allow for
easier diagnosing of failure sources), and the main task is now specially named
<main> instead of <unnamed>.

Closes #10195
Closes #10073
2013-11-01 09:16:11 -07:00
bors
c7d5a52144 auto merge of #10189 : alexcrichton/rust/inner-statics, r=cmr
Closes #9186
2013-10-31 04:46:34 -07:00
Alex Crichton
0db50056ae Forbid type parameters in inner statics
Closes #9186
2013-10-30 19:52:00 -07:00
bors
f73a48e9fd auto merge of #10120 : Kimundi/rust/remove_sys, r=alexcrichton
- `begin_unwind` and `fail!` is now generic over any `T: Any + Send`.
- Every value you fail with gets boxed as an `~Any`.
- Because of implementation issues, `&'static str` and `~str` are still
  handled specially behind the scenes.
- Changed the big macro source string in libsyntax to a raw string
  literal, and enabled doc comments there.
2013-10-30 18:31:26 -07:00
Marvin Löbel
54f4dcd76a Prepared std::sys for removal, and made begin_unwind simpler
- `begin_unwind` is now generic over any `T: Any + Send`.
- Every value you fail with gets boxed as an `~Any`.
- Because of implementation details, `&'static str` and `~str` are still
  handled specially behind the scenes.
- Changed the big macro source string in libsyntax to a raw string
  literal, and enabled doc comments there.
2013-10-30 21:19:18 +01:00
Jed Davis
727731f89e Assorted cleanups suggested by reviewers. 2013-10-29 09:09:20 -07:00
Jed Davis
c8c08763ec Add repr attributes in various places that need them. 2013-10-29 09:09:20 -07:00
Alex Crichton
2290131543 Register new snapshots 2013-10-28 16:56:24 -07:00
Alex Crichton
72557d8312 Remove the extension traits for Readers/Writers
These methods are all excellent candidates for default methods, so there's no
need to require extra imports of various traits.
2013-10-28 10:16:45 -07:00
Marvin Löbel
fa8e71a825 Allow fail messages to be caught, and introduce the Any trait
Some code cleanup, sorting of import blocks

Removed std::unstable::UnsafeArc's use of Either

Added run-fail tests for the new FailWithCause impls

Changed future_result and try to return Result<(), ~Any>.

- Internally, there is an enum of possible fail messages passend around.
- In case of linked failure or a string message, the ~Any gets
  lazyly allocated in future_results recv method.
- For that, future result now returns a wrapper around a Port.
- Moved and renamed task::TaskResult into rt::task::UnwindResult
  and made it an internal enum.
- Introduced a replacement typedef `type TaskResult = Result<(), ~Any>`.
2013-10-28 08:50:32 +01:00
bors
cb5b21eba7 auto merge of #10050 : gifnksm/rust/ratio-methods, r=pcwalton
After merging 0ada7c7, user code have not been able to access to `Ratio`'s numerator and denominator fields.
In some algorithms, it is needed to get an rational number's numerator or denominator, but keeping these fields private is necessary for guaranteeing that `Ratio` numbers are irreducible.
So, I added the getter methods `numer()` and `denom()`.

As a bonus, this commit adds utility methods relating to the ratio-integer conversion.
2013-10-27 22:41:18 -07:00
Palmer Cox
ff9e573a67 Remove MD4. 2013-10-27 21:25:19 -04:00
Palmer Cox
653ee13839 Remove MD5 and Sha2. Move Sha1 and support code into librustpkg. 2013-10-27 21:25:19 -04:00
Palmer Cox
c5f10b47f3 Update workcache to no longer use Sha1. 2013-10-27 21:25:19 -04:00
bors
deeca5d586 auto merge of #10054 : alexcrichton/rust/basic-event-loop, r=brson
This is more progress towards #9128 and all its related tree of issues. This implements a new `BasicLoop` on top of pthreads synchronization primitives (wrapped in `LittleLock`). This also removes the wonky `callback_ms` function from the interface of the event loop.

After #9901 is taking forever to land, I'm going to try to do all this runtime work in much smaller chunks than before. Right now this will not work unless #9901 lands first, but I'm close to landing it (hopefully), and I wanted to go ahead and get this reviewed before throwing it at bors later on down the road.

This "pausible idle callback" is also a bit of a weird idea, but it wasn't as difficult to implement as callback_ms so I'm more semi-ok with it.
2013-10-25 00:46:11 -07:00
Alex Crichton
64a5c3bc1e Implement a basic event loop built on LittleLock
It's not guaranteed that there will always be an event loop to run, and this
implementation will serve as an incredibly basic one which does not provide any
I/O, but allows the scheduler to still run.

cc #9128
2013-10-24 23:49:11 -07:00
bors
b0c475229a auto merge of #10055 : pcwalton/rust/arc-clone-inline, r=alexcrichton
r? @thestinger
2013-10-24 17:36:07 -07:00
Alex Crichton
188e471339 Another round of test fixes and merge conflicts 2013-10-24 14:22:35 -07:00
Alex Crichton
6bb1df9251 Remove std::io once and for all! 2013-10-24 14:22:34 -07:00
Alex Crichton
c4907cfd14 Remove std::io from ebml 2013-10-24 14:21:58 -07:00
Alex Crichton
61ed2cfb55 Remove even more of std::io
Big fish fried here:

    extra::json
    most of the compiler
    extra::io_util removed
    extra::fileinput removed

Fish left to fry

    extra::ebml
2013-10-24 14:21:57 -07:00
Patrick Walton
b13415cccc libextra: Make arc::get and arc::new inline too.
Should be a 2x improvement in a Servo test case.
2013-10-24 13:50:21 -07:00
Patrick Walton
76287ccbb0 libextra: Make arc clone inline 2013-10-24 13:21:49 -07:00
gifnksm
7d5c7b8083 extra: Add getter methods to extra::rational::Ratio
After merging 0ada7c7, user code have not been able to access to `Ratio`'s numerator and denominator fields.
In some algorithms, it is needed to get an rational number's numerator or denominator, but keeping these fields private is necessary for guaranteeing that `Ratio` numbers are irreducible.
So, I added the getter methods `numer()` and `denom()`.

As a bonus, this commit adds utility methods relating to the ratio-integer conversion.
2013-10-24 23:05:03 +09:00
bors
e2428b791c auto merge of #10032 : thestinger/rust/snapshot, r=huonw 2013-10-23 15:11:07 -07:00
Daniel Micay
142672dca4 register snapshots 2013-10-23 18:06:12 -04:00
bors
f09959361b auto merge of #10034 : sfackler/rust/time, r=alexcrichton
These are supposed to be raw C-like structs mirroring time.h's struct tm
and struct timespec.
2013-10-23 09:41:14 -07:00
Steven Fackler
870f3bc341 Re-make time struct fields public
These are supposed to be raw C-like structs mirroring time.h's struct tm
and struct timespec.
2013-10-23 09:06:31 -07:00
bors
a4ec8af4c5 auto merge of #9810 : huonw/rust/rand3, r=alexcrichton
- Adds the `Sample` and `IndependentSample` traits for generating numbers where there are parameters (e.g. a list of elements to draw from, or the mean/variance of a normal distribution). The former takes `&mut self` and the latter takes `&self` (this is the only difference).
- Adds proper `Normal` and `Exp`-onential distributions
- Adds `Range` which generates `[lo, hi)` generically & properly (via a new trait) replacing the incorrect behaviour of `Rng.gen_integer_range` (this has become `Rng.gen_range` for convenience, it's far more efficient to use `Range` itself)
- Move the `Weighted` struct from `std::rand` to `std::rand::distributions` & improve it
- optimisations and docs
2013-10-23 08:31:21 -07:00
Huon Wilson
148f737c19 std::rand: add distributions::Range for generating [lo, hi).
This reifies the computations required for uniformity done by
(the old) `Rng.gen_integer_range` (now Rng.gen_range), so that they can
be amortised over many invocations, if it is called in a loop.

Also, it makes it correct, but using a trait + impls for each type,
rather than trying to coerce `Int` + `u64` to do the right thing. This
also makes it more extensible, e.g. big integers could & should
implement SampleRange.
2013-10-23 10:40:06 +11:00
reedlepee
92662a9f91 Removed unnecessary comments and white spaces as suggested 2013-10-23 01:10:50 +05:30
reedlepee
ad465441ba Removed Unnecessary comments and white spaces #4386 2013-10-23 01:10:50 +05:30
reedlepee
0ada7c7ffe Making fields in std and extra : private #4386 2013-10-23 01:10:50 +05:30
Alex Crichton
daf5f5a4d1 Drop the '2' suffix from logging macros
Who doesn't like a massive renaming?
2013-10-22 08:09:56 -07:00
Georges Dubus
1dc3d0bf86 Add support for nested comments
Fixes #9468.
2013-10-21 21:58:34 +02:00
Tim Chevalier
1cf029c229 rustpkg: Make rustpkg tests stop comparing dates
Instead of scrutinizing modification times in rustpkg tests,
change output files to be read-only and detect attempts to write
to them (hack suggested by Jack). This avoids time granularity problems.

As part of this change, I discovered that some dependencies weren't
getting written correctly (involving built executables and library
files), so this patch fixes that too.

This partly addresses #9441, but one test (test_rebuild_when_needed)
is still ignored on Linux.
2013-10-18 18:36:17 -07:00
bors
a1848bc755 auto merge of #9927 : chris-morgan/rust/fix-url-to_str-so-it-includes-the-port, r=huonw
Fixes #9451.
Fixes chris-morgan/rust-http#16.
2013-10-18 07:21:25 -07:00
Chris Morgan
1093730d72 Fix extra::url::to_str to include the port.
Fixes #9451.
Fixes chris-morgan/rust-http#16.
2013-10-19 00:25:03 +11:00
bors
3f240fedec auto merge of #9926 : Kimundi/rust/future_result_bad_sig, r=huonw 2013-10-18 06:11:18 -07:00
Marvin Löbel
3011801256 Made std::task::TaskBuilder::future_result() easier to use 2013-10-18 10:43:41 +02:00
Brian Anderson
34d376f3cf std: Move size/align functions to std::mem. #2240 2013-10-17 17:31:35 -07:00
bors
386fa1d818 auto merge of #9897 : thestinger/rust/rusti, r=alexcrichton
Closes #9818
Closes #9567
Closes #8924
Closes #8910
Closes #8392
Closes #7692
Closes #7499
Closes #7220
Closes #5038
2013-10-17 01:36:33 -07:00
bors
6c08cc2db4 auto merge of #9846 : cmr/rust/serialize_uuid, r=alexcrichton 2013-10-16 21:41:23 -07:00
Daniel Micay
f766acad62 drop the linenoise library
Closes #5038
2013-10-16 22:57:51 -04:00
Corey Richardson
75cedf8e62 uuid: serialize test and documentations 2013-10-16 21:36:41 -04:00
bors
c92f2168d4 auto merge of #9833 : alexcrichton/rust/fixes, r=brson
Commits have all the fun details
2013-10-16 18:11:22 -07:00
bors
40180cdbea auto merge of #9655 : kballard/rust/path-rewrite, r=alexcrichton
Rewrite the entire `std::path` module from scratch.

`PosixPath` is now based on `~[u8]`, which fixes #7225.
Unnecessary allocation has been eliminated.

There are a lot of clients of `Path` that still assume utf-8 paths.
This is covered in #9639.
2013-10-16 11:26:35 -07:00
Kevin Ballard
6eade9e914 path2: Update for latest master
Also fix some issues that crept into earlier commits during the conflict
resoution for the rebase.
2013-10-16 11:18:06 -07:00
Kevin Ballard
bab7eb20df path2: Update based on more review feedback
Standardize the is_sep() functions to be the same in both posix and
windows, and re-export from path. Update extra::glob to use this.

Remove the usage of either, as it's going away.

Move the WindowsPath-specific methods out of WindowsPath and make them
top-level functions of path::windows instead. This way you cannot
accidentally write code that will fail to compile on non-windows
architectures without typing ::windows anywhere.

Remove GenericPath::from_c_str() and just impl BytesContainer for
CString instead.

Remove .join_path() and .push_path() and just implement BytesContainer
for Path instead.

Remove FilenameDisplay and add a boolean flag to Display instead.

Remove .each_parent(). It only had one caller, so just inline its
definition there.
2013-10-16 10:26:48 -07:00
Alex Crichton
a84c2999c9 Require module documentation with missing_doc
Closes #9824
2013-10-15 22:27:10 -07:00
Kevin Ballard
d6d9b92683 path2: Adjust the API to remove all the _str mutation methods
Add a new trait BytesContainer that is implemented for both byte vectors
and strings.

Convert Path::from_vec and ::from_str to one function, Path::new().

Remove all the _str-suffixed mutation methods (push, join, with_*,
set_*) and modify the non-suffixed versions to use BytesContainer.
2013-10-15 22:18:30 -07:00
Kevin Ballard
e65d33e9ed path2: Update for loop -> continue 2013-10-15 21:56:54 -07:00
Kevin Ballard
73d3d00ec4 path2: Replace the path module outright
Remove the old path.
Rename path2 to path.
Update all clients for the new path.

Also make some miscellaneous changes to the Path APIs to help the
adoption process.
2013-10-15 21:56:54 -07:00
Steven Fackler
194302493c Remove extra::flatpipes
Closes #9884
2013-10-15 18:54:35 -07:00
Felix S. Klock II
602b3cd56c Only use padded test names to calculate the target padding size. 2013-10-14 17:19:15 -04:00
Felix S. Klock II
c56bf67150 Issue 7655: align the bench printouts so that the numbers tend to be aligned.
(scratching an itch.)

Rebased and updated.
Fixed bug: omitted field init from embedded struct literal in a test.
Fixed bug: int underflow during padding length calculation.
2013-10-14 17:18:34 -04:00
Steve Klabnik
309ab958e6 Removing ccdecl
as per https://github.com/mozilla/rust/pull/9606#discussion_r6930872
2013-10-14 14:33:05 +02:00
Steve Klabnik
16fc6a694c Remove unused abi attributes.
They've been replaced by putting the name on the extern block.

  #[abi = "foo"]

goes to

  extern "foo" { }

Closes #9483.
2013-10-14 13:10:36 +02:00
Corey Richardson
023466ccca extra: implement Encodable/Decodable for Uuid 2013-10-14 01:47:55 -04:00
bors
c147ec6d06 auto merge of #9794 : thestinger/rust/rc, r=alexcrichton
I've left out a way to construct from a `Send` type until #9509 is resolved. I am confident that this interface can remain backwards compatible though, assuming we name the `Pointer` trait method `borrow`.

When there is a way to convert from `Send` (`from_send`), a future RAII-based `Mut` type can be used with this to implemented a mutable reference-counted pointer. For now, I've left around the `RcMut` type but it may drastically change or be removed.
2013-10-11 11:11:21 -07:00
Daniel Micay
18be986c99 clean up the Rc/RcMut types and move to libstd 2013-10-11 13:28:36 -04:00
bors
ed37b00b06 auto merge of #9803 : alexcrichton/rust/less-pub2, r=brson
This change was waiting for privacy to get sorted out, which should be true now
that #8215 has landed.

Closes #4427
2013-10-11 08:56:19 -07:00
Benjamin Herr
63e9e496f6 extra::tempfile: replace mkdtemp with an RAII wrapper
this incidentally stops `make check` from leaving directories in `/tmp`
2013-10-11 15:55:37 +02:00
Alex Crichton
8b4423b04f De-pub some private runtime components
This change was waiting for privacy to get sorted out, which should be true now
that #8215 has landed.

Closes #4427
2013-10-11 06:49:18 -07:00
bors
62812f1e38 auto merge of #9386 : Geal/rust/base64-doc, r=alexcrichton
Standard is now uppercase in the base64 module, and from_base64 now returns a Result
2013-10-09 10:41:31 -07:00
Geoffroy Couprie
0b4f052422 Correct code examples for base64 documentation 2013-10-09 18:36:51 +02:00
Daniel Micay
6a90e80b62 option: rewrite the API to use composition 2013-10-09 09:17:29 -04:00
Huon Wilson
92725ae765 std::rand: Add a trait for seeding RNGs: SeedableRng.
This provides 2 methods: .reseed() and ::from_seed that modify and
create respecitively.

Implement this trait for the RNGs in the stdlib for which this makes
sense.
2013-10-09 22:22:42 +11:00
Huon Wilson
a2b509656a std::rand: Add an implementation of ISAAC64.
This is 2x faster on 64-bit computers at generating anything larger
than 32-bits.

It has been verified against the canonical C implementation from the
website of the creator of ISAAC64.

Also, move `Rng.next` to `Rng.next_u32` and add `Rng.next_u64` to
take full advantage of the wider word width; otherwise Isaac64 will
always be squeezed down into a u32 wasting half the entropy and
offering no advantage over the 32-bit variant.
2013-10-09 22:22:42 +11:00
Alex Crichton
de7d143176 Fix existing privacy/visibility violations
This commit fixes all of the fallout of the previous commit which is an attempt
to refine privacy. There were a few unfortunate leaks which now must be plugged,
and the most horrible one is the current `shouldnt_be_public` module now inside
`std::rt`. I think that this either needs a slight reorganization of the
runtime, or otherwise it needs to just wait for the external users of these
modules to get replaced with their `rt` implementations.

Other fixes involve making things pub which should be pub, and otherwise
updating error messages that now reference privacy instead of referencing an
"unresolved name" (yay!).
2013-10-07 13:00:52 -07:00
Alex Crichton
dd98f7089f Implement feature-gating for the compiler
A few features are now hidden behind various #[feature(...)] directives. These
include struct-like enum variants, glob imports, and macro_rules! invocations.

Closes #9304
Closes #9305
Closes #9306
Closes #9331
2013-10-05 20:19:33 -07:00
bors
549f70989e auto merge of #9734 : luisbg/rust/master, r=alexcrichton
These formats are already covered with 'T' | 'X' in line 571 and 'D' | 'x' in
line 446.
2013-10-05 17:26:35 -07:00
Luis de Bethencourt
72490c9d48 extra: remove commented out 'X' and 'x' formats
These formats are already covered with 'T' | 'X' in line 571 and 'D' | 'x' in
line 446.
2013-10-05 17:30:26 -04:00
bors
2733b189ac auto merge of #9250 : erickt/rust/num, r=erickt
This PR solves one of the pain points with c-style enums. Simplifies writing a fn to convert from an int/uint to an enum. It does this through a `#[deriving(FromPrimitive)]` syntax extension.

Before this is committed though, we need to discuss if `ToPrimitive`/`FromPrimitive` has the right design (cc #4819). I've changed all the `.to_int()` and `from_int()` style functions to return `Option<int>` so we can handle partial functions. For this PR though only enums and `extra::num::bigint::*` take advantage of returning None for unrepresentable values. In the long run it'd be better if `i64.to_i8()` returned `None` if the value was too large, but I'll save this for a future PR.

Closes #3868.
2013-10-05 14:26:44 -07:00
Erick Tryzelaar
0e8ad4d8a2 extra: fix BigInt on 32bit machines 2013-10-05 13:59:06 -07:00
Erick Tryzelaar
e323749397 extra: Don't truncate {u64,i64} when converting to BigInts 2013-10-05 13:59:05 -07:00
Luis de Bethencourt
a0c59941e3 extra: remove unnecessary second level functions
do_strptime() and do_strftime()
2013-10-03 16:01:42 -04:00
bors
8f40641e01 auto merge of #9691 : alexcrichton/rust/rustdoc, r=cmr
This slurps in the commits from #9684 as well as closing #9539.
2013-10-03 00:56:34 -07:00
bors
20760739e9 auto merge of #9689 : luisbg/rust/strftime, r=alexcrichton
Plus testing added for %X and %x which were supported but not tested.

Working towards #2350
2013-10-02 17:01:32 -07:00
Alex Crichton
d06043ba0b rustdoc: Generate hyperlinks between crates
The general idea of hyperlinking between crates is that it should require as
little configuration as possible, if any at all. In this vein, there are two
separate ways to generate hyperlinks between crates:

1. When you're generating documentation for a crate 'foo' into folder 'doc',
   then if foo's external crate dependencies already have documented in the
   folder 'doc', then hyperlinks will be generated. This will work because all
   documentation is in the same folder, allowing links to work seamlessly both
   on the web and on the local filesystem browser.

   The rationale for this use case is a package with multiple libraries/crates
   that all want to link to one another, and you don't want to have to deal with
   going to the web. In theory this could be extended to have a RUST_PATH-style
   searching situtation, but I'm not sure that it would work seamlessly on the
   web as it does on the local filesystem, so I'm not attempting to explore this
   case in this pull request. I believe to fully realize this potential rustdoc
   would have to be acting as a server instead of a static site generator.

2. One of foo's external dependencies has a #[doc(html_root_url = "...")]
   attribute. This means that all hyperlinks to the dependency will be rooted at
   this url.

   This use case encompasses all packages using libstd/libextra. These two
   crates now have this attribute encoded (currently at the /doc/master url) and
   will be read by anything which has a dependency on libstd/libextra. This
   should also work for arbitrary crates in the wild that have online
   documentation. I don't like how the version is hard-wired into the url, but I
   think that this may be a case-by-case thing which doesn't end up being too
   bad in the long run.

Closes #9539
2013-10-02 16:17:08 -07:00
Luis de Bethencourt
8f6e43e273 extra: %W and %+ support in time::strftime
Plus testing added for %X and %x which were supported but not tested.

Working towards #2350
2013-10-02 18:01:44 -04:00
bors
371a7ec569 auto merge of #9675 : sfackler/rust/lint, r=alexcrichton
Closes #9671
2013-10-02 13:26:36 -07:00
bors
aaeb7605c9 auto merge of #9670 : luisbg/rust/strftime, r=alexcrichton 2013-10-02 10:11:38 -07:00
Steven Fackler
b7fe83d573 Check enums in missing_doc lint
Closes #9671
2013-10-02 08:57:03 -07:00
Luis de Bethencourt
1005b7976b extra: %G, %g and %V support in time::strftime
Fixes #2350
2013-10-02 11:22:59 -04:00
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
d9d1dfc195 std: Replace num::IntConvertible with {To,From}Primitive 2013-10-02 07:55:41 -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
Luis de Bethencourt
c463772ebd extra: %U support in time::strftime
Fixes #2350
2013-10-01 22:20:46 -04:00
Alex Crichton
4f67dcb24a Migrate users of 'loop' to 'continue'
Closes #9467
2013-10-01 15:53:13 -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
Alex Crichton
af3b132285 syntax: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
Alex Crichton
7e709bfd0d extra: Remove usage of fmt! 2013-09-30 23:21:18 -07:00
bors
67394f20eb auto merge of #9552 : brson/rust/0.9-pre, r=alexcrichton 2013-09-27 13:51:07 -07:00
bors
10e7f12daf auto merge of #9550 : alexcrichton/rust/remove-printf, r=thestinger
The 0.8 release was cut, down with printf!
2013-09-27 08:21:23 -07:00
bors
fcd3776e82 auto merge of #9523 : huonw/rust/kud1ing-docs, r=huonw
Collation of @kud1ing's work in #9511, #9512, #9513 and #9518.
2013-09-26 20:06:09 -07:00
Brian Anderson
99c1fb8c66 Update version numbers to 0.9-pre 2013-09-26 18:18:42 -07:00
Alex Crichton
409182de6d Update the compiler to not use printf/printfln 2013-09-26 17:05:59 -07:00
bors
f210a16718 auto merge of #9520 : blake2-ppc/rust/ringbuf-swap, r=thestinger
extra::ringbuf: Implement method `.swap(uint, uint)` just like vector

RingBuf::swap(&mut self, i, j) swaps the element at indices `i` and `j`
if both elements are in bounds, otherwise it fails.
2013-09-26 13:21:08 -07:00
bors
6f991a2441 auto merge of #9506 : sfackler/rust/visibility, r=alexcrichton 2013-09-26 09:21:09 -07:00
bors
0f9bcaf7fe auto merge of #9503 : dcrewi/rust/fix-digest-visibility, r=alexcrichton
I really have no idea why the tests didn't fail. Maybe it's another cross-crate issue?
2013-09-26 06:56:00 -07:00
kud1ing
3165ddeb40 bitv: backticks for code in documentation 2013-09-26 23:15:42 +10:00
kud1ing
c873216ab6 bigint: backticks for code in documentation 2013-09-26 23:15:42 +10:00
kud1ing
d964f79998 base64: backticks for code in documentation 2013-09-26 23:15:42 +10:00
kud1ing
d798e00337 Enclose code in documentation in backticks 2013-09-26 23:15:42 +10:00
bors
0022f2b204 auto merge of #9500 : fhahn/rust/rename-str_from_bytes-fix, r=alexcrichton
As @Dretch pointed out [here](de39874801 (L2L526)) , from_bytes was accidentally renamed to from_utf8.
2013-09-26 05:36:01 -07:00
blake2-ppc
57757a8051 extra::ringbuf: Implement method .swap(uint, uint) just like vector
RingBuf::swap(&mut self, i, j) swaps the element at indices `i` and `j`
if both elements are in bounds, otherwise it fails.
2013-09-26 09:25:32 +02:00
Steven Fackler
d8957e6332 Some struct visibility fixes 2013-09-25 19:42:02 -07:00
David Creswick
252c6dbe85 Fix visibility of digest implementations 2013-09-25 19:39:17 -05:00
bors
41826c48ed auto merge of #9475 : alexcrichton/rust/rustdoc++, r=cmr
The commit messages are a good technical summary, a good visual summary (contrib is this version):

Pub use statements now rendered. Notice how almost all components are also clickable!
* http://static.rust-lang.org/doc/master/std/prelude/index.html
* http://www.contrib.andrew.cmu.edu/~acrichto/doc/std/prelude/index.html

Private things hidden by default (for at least some approximation of privacy). I hope to improve this once privacy is totally ironed out.
* http://static.rust-lang.org/doc/master/std/hashmap/struct.HashMap.html
* http://www.contrib.andrew.cmu.edu/~acrichto/doc/std/hashmap/struct.HashMap.html

Unindentation now works properly:
* http://static.rust-lang.org/doc/master/extra/getopts/index.html
* http://www.contrib.andrew.cmu.edu/~acrichto/doc/extra/getopts/index.html

Also sundown has massively reduced compilation time (of docs, not the of the crates)
2013-09-25 15:40:52 -07:00
Alex Crichton
f648690234 rustdoc: Strip hidden docs by default. 2013-09-25 14:27:43 -07:00
Alex Crichton
bcc7daa6bc rustdoc: Improve comment stripping
There is less implicit removal of various comment styles, and it also removes
extraneous stars occasionally found in docblock comments. It turns out that the
bug for getops was just a differently formatted block.

Closes #9425
Closes #9417
2013-09-25 14:27:42 -07:00
Alex Crichton
3585c64d09 rustdoc: Change all code-blocks with a script
find src -name '*.rs' | xargs sed -i '' 's/~~~.*{\.rust}/```rust/g'
    find src -name '*.rs' | xargs sed -i '' 's/ ~~~$/ ```/g'
    find src -name '*.rs' | xargs sed -i '' 's/^~~~$/ ```/g'
2013-09-25 14:27:42 -07:00
bors
24d46a0f45 auto merge of #9345 : Dretch/rust/digest-result-bytes, r=cmr
I would find this function useful.
2013-09-25 14:25:52 -07:00
Florian Hahn
23a067dc2c Rename from_utf8 to from_bytes again 2013-09-25 22:58:57 +02:00
bors
4531184614 auto merge of #9432 : alexcrichton/rust/correct-item-visibility, r=pcwalton
This fixes private statics and functions from being usable cross-crates, along
with some bad privacy error messages. This is a reopening of #8365 with all the
privacy checks in privacy.rs instead of resolve.rs (where they should be
anyway).

These maps of exported items will hopefully get used for generating
documentation by rustdoc

Closes #8592
2013-09-25 00:55:53 -07:00
Brian Anderson
6d03897376 Don't use libc::exit. #9473
This can cause unexpected errors in the runtime when done while
scheduler threads are still initializing. Required some restructuring
of the main_args functions in our libraries.
2013-09-24 16:34:23 -07:00
Alex Crichton
10a583ce1a Correctly encode item visibility in metadata
This fixes private statics and functions from being usable cross-crates, along
with some bad privacy error messages. This is a reopening of #8365 with all the
privacy checks in privacy.rs instead of resolve.rs (where they should be
anyway).

These maps of exported items will hopefully get used for generating
documentation by rustdoc

Closes #8592
2013-09-24 09:57:25 -07:00
Patrick Walton
3b1d3e5bf8 librustc: Fix merge fallout. 2013-09-23 18:23:23 -07:00
Patrick Walton
90d3da9711 test: Fix rustdoc and tests. 2013-09-23 18:23:22 -07:00
Patrick Walton
68ea9aed96 librustc: Remove @fn managed closures from the language. 2013-09-23 18:23:21 -07:00
Patrick Walton
9a4de3f305 libsyntax: Introduce routines and remove all @fns from libsyntax save the old visitor 2013-09-23 18:23:21 -07:00
Scott Lawrence
a5cf9fdb61 Add docs for extra::semver 2013-09-22 20:23:45 -04:00
Huon Wilson
fb923c7d3f std: merge rand::{Rng,RngUtil} with default methods.
Also, documentation & general clean-up:
- remove `gen_char_from`: better served by `sample` or `choose`.
- `gen_bytes` generalised to `gen_vec`.
- `gen_int_range`/`gen_uint_range` merged into `gen_integer_range` and
  made to be properly uniformly distributed. Fixes #8644.

Minor adjustments to other functions.
2013-09-23 00:11:42 +10:00
Brian Anderson
695cb9fc2b Update version numbers to 0.8 2013-09-21 16:25:08 -07:00
bors
44dc3fba8b auto merge of #9380 : thestinger/rust/par, r=alexcrichton
This was a dead end experiment, and not a sensible way of implementing
generic data parallelism. This also removes the `graph500-bfs.rs`
benchmark because it relies on `extra::par`.

Closes #5626
2013-09-21 10:10:56 -07:00
bors
b094cf48e1 auto merge of #9360 : huonw/rust/4449, r=pnkfelix
Fixes #4449. (Ran it through try-bsd: http://buildbot.rust-lang.org/builders/try-bsd/builds/451)
2013-09-21 02:56:01 -07:00
Alex Crichton
4fd061c426 Implement a web backend for rustdoc_ng
This large commit implements and `html` output option for rustdoc_ng. The
executable has been altered to be invoked as "rustdoc_ng html <crate>" and
it will dump everything into the local "doc" directory. JSON can still be
generated by changing 'html' to 'json'.

This also fixes a number of bugs in rustdoc_ng relating to comment stripping,
along with some other various issues that I found along the way.

The `make doc` command has been altered to generate the new documentation into
the `doc/ng/$(CRATE)` directories.
2013-09-20 22:49:03 -07:00
Daniel Micay
e753618b6b drop extra::par
This was a dead end experiment, and not a sensible way of implementing
generic data parallelism. This also removes the `graph500-bfs.rs`
benchmark because it relies on `extra::par`.

Closes #5626
2013-09-21 01:02:56 -04:00
Huon Wilson
76a53911b4 Uncomment a test. Fixes #4449. 2013-09-20 21:47:57 +10:00
bors
e5fdc7dee5 auto merge of #9320 : chris-morgan/rust/unreachable-macro-part-two-of-two-containing-the-destruction-of-the-unreachable-function, r=alexcrichton
This is the second of two parts of #8991, now possible as a new snapshot
has been made. (The first part implemented the unreachable!() macro; it
was #8992, 6b7b8f2682.)

``std::util::unreachable()`` is removed summarily; any code which used
it should now use the ``unreachable!()`` macro.

Closes #9312.

Closes #8991.
2013-09-20 00:36:11 -07:00
Gareth Smith
b82e0d32ce Add a new Digest.result_bytes convenience function. 2013-09-20 00:05:27 +01:00
Steven Fackler
963707f45d Clean up unused imports 2013-09-19 15:19:25 -07:00
Steven Fackler
48d5b4b8e1 Add Future::spawn_with 2013-09-19 15:19:25 -07:00
Steven Fackler
ff85389344 Modernize extra::future API 2013-09-19 15:19:20 -07:00
Steven Fackler
2df5a13334 Removed future's destructor
It was only there to prevent Future from being copyable, but it's
noncopyable anyways since it contains a ~fn.
2013-09-19 09:06:42 -07:00
bors
99ec14dbb0 auto merge of #9267 : Kimundi/rust/master, r=huonw 2013-09-19 05:06:00 -07:00
Marvin Löbel
06d1dccf95 Turned extra::getopts functions into methods
Some minor api and doc adjustments
2013-09-19 12:32:18 +02:00
bors
a7cf7b7b0b auto merge of #9291 : jzelinskie/rust/remove-cond, r=alexcrichton
This is my first contribution, so please point out anything that I may have missed.

I consulted IRC and settled on `match () { ... }` for most of the replacements.
2013-09-19 00:31:05 -07:00