Commit Graph

694 Commits

Author SHA1 Message Date
Alex Crichton 594807951f rustdoc: Don't show private modules 2014-01-10 15:12:07 -08:00
Alex Crichton 79e144ed64 rustdoc: Get --version working
Closes #11421
2014-01-10 15:12:06 -08:00
Alex Crichton 18e7f3b3ec rustdoc: Don't strip empty modules with documentation
Closes #11443
2014-01-10 15:12:06 -08:00
Derek Chiang 6f875c96b3 Fix #11421 2014-01-10 22:09:59 +08:00
Eduard Burtescu 72ee4a57b7 Updated librustdoc and librustpkg to use the proper UpperCase names from libsyntax. 2014-01-09 22:25:28 +02:00
Eduard Burtescu 6b221768cf libsyntax: Renamed types, traits and enum variants to CamelCase. 2014-01-09 22:25:28 +02:00
Alex Crichton 6df57ec2e2 Remove the io::Decorator trait
This is just an unnecessary trait that no one's ever going to parameterize over
and it's more useful to just define the methods directly on the types
themselves. The implementors of this type almost always don't want
inner_mut_ref() but they're forced to define it as well.
2014-01-08 23:42:28 -08:00
Alex Crichton 3425901d93 Inline reexports in rustdoc
If a reexport comes from a non-public module, then the documentation for the
reexport will be inlined into the module that exports it, but if the reexport is
targeted at a public type (like the prelude), then it is not inlined but rather
hyperlinked.
2014-01-07 18:46:16 -08:00
Eduard Burtescu 3119d18e55 Disowned the Visitor. 2014-01-06 14:00:46 +02:00
Brian Anderson 3b1862a82f Don't allow newtype structs to be dereferenced. #6246 2014-01-04 14:44:12 -08:00
Patrick Walton 82a09b9a04 librustc: Remove `@mut` support from the parser 2014-01-03 14:02:01 -08:00
Patrick Walton c38456a92f librustdoc: De-`@mut` `librustdoc` 2014-01-03 14:02:00 -08:00
Brian Anderson 56ec9c23a4 Bump version to 0.9 2014-01-02 12:55:20 -08:00
bors 0df9b850ac auto merge of #10696 : fhahn/rust/issue9543-remove-extern-mod-foo, r=pcwalton
This patch for  #9543 throws an `obsolete syntax` error for `extern mod foo (name="bar")` . 
I was wondering if [this](https://github.com/fhahn/rust/compare/mozilla:master...fhahn:issue9543-remove-extern-mod-foo?expand=1#diff-da9d34ca1d0f6beee2838cf02e07345cR4444) is the correct place to do this?

I think the wording of the error message could probably be improved as well.

If this approach is OK, I'm going to run the whole test suite tomorrow and update the old syntax to the new one.
2014-01-02 11:32:09 -08:00
Florian Hahn f42a36cded Remove `extern mod foo (name="bar")` syntax, closes #9543 2014-01-01 23:36:57 +01:00
bors c34ef5d7e4 auto merge of #11255 : klutzy/rust/small-cleanup, r=pcwalton
This patchset removes some `@`s and unnecessary traits,
and replaces a function (`dummy_sp()`) returning constant value
by static variable.
2014-01-01 11:06:51 -08:00
klutzy 9cdad685a3 syntax::codemap: Add static DUMMY_SP
It replaces `dummy_sp()`.
2014-01-01 19:51:35 +09:00
klutzy a52cdfdfce rustc::driver: Remove two @s 2014-01-01 19:10:43 +09:00
Brian Anderson 14f59e8902 Remove references to rustdoc_ng 2013-12-31 14:50:38 -08:00
Alan Andrade 6bc278c8c6 Remove features from librustdoc 2013-12-30 22:37:44 -06:00
bors a4f30bf0c0 auto merge of #11185 : huonw/rust/doc-ignore, r=cmr
Currently any line starting with `#` is filtered from the output,
including line like `#[deriving]`; this patch makes it so lines are only
filtered when followed by a space similar to the current behaviour of
the tutorial/manual tester.
2013-12-30 05:51:51 -08:00
Huon Wilson dedc29f128 rustdoc: Unify the handling of the hidden example lines. 2013-12-30 16:55:49 +11:00
Huon Wilson 582ad8ffc2 rustdoc: only filter lines starting with '# ' from the shown code.
Currently any line starting with `#` is filtered from the output,
including line like `#[deriving]`; this patch makes it so lines are only
filtered when followed by a space similar to the current behaviour of
the tutorial/manual tester.
2013-12-30 16:55:49 +11:00
Luis de Bethencourt 4bc09713df Rename pkgid variables 2013-12-29 15:25:26 -05:00
Corey Richardson 7b382e58b1 Fix rustdoc bug involving PatLit 2013-12-29 00:13:29 -05:00
Patrick Walton cc0584731a librustc: De-`@mut` the def map.
This is the last `@mut` in `librustc` that does not depend on libsyntax.
2013-12-26 15:54:37 -08:00
Patrick Walton 02d31b7d1a librustc: De-`@mut` the additional library search paths 2013-12-26 15:54:31 -08:00
Alex Crichton ab431a20c0 Register new snapshots 2013-12-26 11:30:23 -08:00
Steven Fackler c7cf5dc270 Method-ify CStore 2013-12-25 21:50:36 -07:00
Alex Crichton 6c9c045064 rustdoc: Add the ability to test code in comments
This adds support for the `--test` flag to rustdoc which will parse a crate,
extract all code examples in doc comments, and then run each test in the
extra::test driver.
2013-12-23 09:10:36 -08:00
bors 55cbef611a auto merge of #11064 : huonw/rust/vec-sort, r=alexcrichton
This uses quite a bit of unsafe code for speed and failure safety, and allocates `2*n` temporary storage.

[Performance](https://gist.github.com/huonw/5547f2478380288a28c2):

|      n |      new | priority_queue |   quick3 |
|-------:|---------:|---------------:|---------:|
|      5 |      200 |            155 |      106 |
|    100 |     6490 |           8750 |     5810 |
|  10000 |  1300000 |        1790000 |  1060000 |
| 100000 | 16700000 |       23600000 | 12700000 |
| sorted |   520000 |        1380000 | 53900000 |
|  trend |  1310000 |        1690000 |  1100000 |

(The times are in nanoseconds, having subtracted the set-up time (i.e. the `just_generate` bench target).)

I imagine that there is still significant room for improvement, particularly because both priority_queue and quick3 are doing a static call via `Ord` or `TotalOrd` for the comparisons, while this is using a (boxed) closure.

Also, this code does not `clone`, unlike `quick_sort3`; and is stable, unlike both of the others.
2013-12-22 00:41:39 -08:00
Huon Wilson 2e8c522c62 std::vec: make the sorting closure use `Ordering` rather than just being
(implicitly) less_eq.
2013-12-22 18:16:50 +11:00
Huon Wilson 1b1e4caa79 std::vec: add a sugary .sort() method for plain Ord sorting.
This moves the custom sorting to `.sort_by`.
2013-12-21 09:35:18 +11:00
Huon Wilson 48fedcb36f extra: remove sort in favour of the std method.
Fixes #9676.
2013-12-20 12:38:46 +11:00
bors 5c24bfa8c3 auto merge of #11057 : alexcrichton/rust/no-at-in-ebml, r=pcwalton
Now that the metadata is an owned value with a lifetime of a borrowed byte
slice, it's possible to have future optimizations where the metadata doesn't
need to be copied around (very expensive operation).
2013-12-19 17:11:40 -08:00
Alex Crichton 73fceca7d6 Purge @-boxes from the reading half of EBML
Now that the metadata is an owned value with a lifetime of a borrowed byte
slice, it's possible to have future optimizations where the metadata doesn't
need to be copied around (very expensive operation).
2013-12-19 17:08:05 -08:00
bors d760f994de auto merge of #11041 : cmr/rust/pkgid_changes, r=cmr,metajack 2013-12-19 07:51:36 -08:00
Corey Richardson b25a0524dc Add some things to inspect crate-id's 2013-12-19 10:18:37 -05:00
Corey Richardson dee1107571 Rename pkgid to crate_id
Closes #11035
2013-12-19 10:10:23 -05:00
bors 3c2c13bae4 auto merge of #11029 : huonw/rust/rm-vec-as-buf, r=cmr
For `str.as_mut_buf`, un-closure-ification is achieved by outright removal (see commit message). The others are replaced by `.as_ptr`, `.as_mut_ptr` and `.len`
2013-12-18 17:11:42 -08:00
Huon Wilson 17ac2aa523 std::str: replace .as_imm_buf with .as_ptr. 2013-12-19 10:18:02 +11:00
Corey Richardson 21bec4f11b rustdoc: thread through the context for rendering
This partially reverts 8b5a317.
2013-12-18 15:21:34 -05:00
bors 1fee5cd953 auto merge of #11018 : sfackler/rust/variant-strip, r=alexcrichton
Previously, if every variant was private, it would display as a
variantless enum instead of having the "some variants stripped" comment.
2013-12-17 23:51:34 -08:00
bors b870ce7a9f auto merge of #11030 : cmr/rust/rustdoc_on_fire, r=metajack
By returning the items to process and storing them in a queue, we were losing
the context that was setup for that item during the recursion. This is an easy
fix, rather than hoisting out the state that it needs.
2013-12-17 09:01:58 -08:00
Corey Richardson 8b5a317d48 Fix rustdoc HTML rendering
By returning the items to process and storing them in a queue, we were losing
the context that was setup for that item during the recursion. This is an easy
fix, rather than hoisting out the state that it needs.
2013-12-17 11:19:14 -05:00
bors 1a26bd166a auto merge of #11005 : sanxiyn/rust/mut, r=alexcrichton
There is no `~mut T` and `[mut T]` any more.
2013-12-17 06:26:40 -08:00
Steven Fackler 758f6e6e68 Fix rustdoc output of enums with private variants
Previously, if every variant was private, it would display as a
variantless enum instead of having the "some variants stripped" comment.
2013-12-16 21:30:02 -08:00
Alex Crichton 529e268ab9 Fallout of rewriting std::comm 2013-12-16 17:47:11 -08:00
Seo Sanghyeon 4a13364010 Remove obsolete mutability from ast::Ty 2013-12-17 03:01:40 +09:00
Alex Crichton d9ea475feb Register new snapshots
Understand 'pkgid' in stage0. As a bonus, the snapshot now contains now metadata
(now that those changes have landed), and the snapshot download is half as large
as it used to be!
2013-12-15 22:17:59 -08:00
bors 386b455b1b auto merge of #10948 : cmr/rust/update_pkgid, r=metajack 2013-12-15 01:01:43 -08:00
Corey Richardson b20aa5b77d librustpkg: don't clobber the crate attributes for the pkgid 2013-12-14 19:31:02 -05:00
bors fbbadae80f auto merge of #10849 : adridu59/rust/patch-css, r=alexcrichton
rustdoc:
- fix search-bar layout

doc: CSS:
- switch to native pandoc toc depth
- rm some dead code
- clamp width to be readable (we're not Wikipedia!)
- don't background-color titles, it's bloating
- make syntax-highlighting colors inline with rust-lang.org
- space indents

@alexcrichton
2013-12-13 14:21:35 -08:00
Corey Richardson cecc13a704 librustdoc: use pkgid instead of link meta 2013-12-13 02:13:18 -05:00
Erik Price 5731ca3078 Make 'self lifetime illegal.
Also remove all instances of 'self within the codebase.

This fixes #10889.
2013-12-11 10:54:06 -08:00
bors b8b16ae099 auto merge of #10791 : pcwalton/rust/decelling, r=pcwalton
34 uses of `Cell` remain.

r? @alexcrichton
2013-12-10 19:16:19 -08:00
Jack Moffitt b349036e5f Make crate hash stable and externally computable.
This replaces the link meta attributes with a pkgid attribute and uses a hash
of this as the crate hash. This makes the crate hash computable by things
other than the Rust compiler. It also switches the hash function ot SHA1 since
that is much more likely to be available in shell, Python, etc than SipHash.

Fixes #10188, #8523.
2013-12-10 17:04:24 -07:00
Patrick Walton 9a6ebbbecc librustdoc: Remove a couple of `Cell`s. 2013-12-10 15:13:12 -08:00
Patrick Walton ebe8ac88a7 librustdoc: Don't use `finally`, shaving off a `Cell`. 2013-12-10 15:13:12 -08:00
Patrick Walton 786dea207d libextra: Another round of de-`Cell`-ing.
34 uses of `Cell` remain.
2013-12-10 15:13:12 -08:00
Kiet Tran 1755408d1a Remove dead codes 2013-12-08 02:55:28 -05:00
Adrien Tétar 89e1fb3223 rustdoc: fix the search-bar layout
Now with broader compatibility.
2013-12-07 17:15:16 +01:00
bors 9fc48061d7 auto merge of #10721 : osa1/rust/intermediatestr, r=brson
as recommended by @huonw on this PR https://github.com/mozilla/rust/pull/10711 , I removed intermediate step that generates a string instead of directly writing to Writer without generating intermediate string.
2013-12-05 18:56:19 -08:00
Kevin Ballard 2c4a1b55e6 Rename extra::json::*::init() constructors to *::new() 2013-12-04 22:33:53 -08:00
Kevin Ballard 408dc5ad1b Revert "libstd: Change `Path::new` to `Path::init`."
This reverts commit c54427ddfb.

Leave the #[ignores] in that were added to rustpkg tests.

Conflicts:
	src/librustc/driver/driver.rs
	src/librustc/metadata/creader.rs
2013-12-04 22:33:53 -08:00
bors 693ec73b9b auto merge of #10747 : alexcrichton/rust/snapshots, r=cmr
This registers new snapshots after the landing of #10528, and then goes on to tweak the build process to build a monolithic `rustc` binary for use in future snapshots. This mainly involved dropping the dynamic dependency on `librustllvm`, so that's now built as a static library (with a dynamically generated rust file listing LLVM dependencies).

This currently doesn't actually make the snapshot any smaller (24MB => 23MB), but I noticed that the executable has 11MB of metadata so once progress is made on #10740 we should have a much smaller snapshot.

There's not really a super-compelling reason to distribute just a binary because we have all the infrastructure for dealing with a directory structure, but to me it seems "more correct" that a snapshot compiler is just a `rustc` binary.
2013-12-03 14:36:59 -08:00
Alex Crichton acc5e32e53 Register new snapshots 2013-12-03 14:31:54 -08:00
Alex Crichton 6600ba97c3 rustdoc: Tell rustc we're building a library
This makes sure that when generating documentation we don't waste time doing
things like looking for a main function.
2013-12-02 21:26:40 -08:00
SiegeLord e73d50653f Add a type="search" to the search bar in the documentation. 2013-12-01 21:36:59 -05:00
SiegeLord a3aa325c93 Add placeholder text to the search bar in the documentation. 2013-12-01 20:42:38 -05:00
bors df41115213 auto merge of #10750 : Blei/rust/no-at-struct-field, r=alexcrichton 2013-12-01 05:42:06 -08:00
bors b2aa00ba8b auto merge of #10676 : eddyb/rust/ast-box-in-enums, r=cmr
**Note**: I only tested on top of my #10670 PR, size reductions come from both change sets.

With this, [more enums are shrinked](https://gist.github.com/eddyb/08fef0dfc6ff54e890bc), the most significant one being `ast_node`, from 104 bytes (master) to 96 (#10670) and now to 32 bytes.

My own testcase requires **200MB** less when compiling (not including the other **200MB** gained in #10670), and rustc-stage2 is down by about **130MB**.

I believe there is more to gain by fiddling with the enums' layouts.
2013-12-01 03:11:58 -08:00
Philipp Brüschweiler 47ce981903 ast: Remove one `@` and fix the fallout 2013-12-01 11:24:58 +01:00
bors 4252a24ae1 auto merge of #10528 : alexcrichton/rust/static-linking-v2, r=pcwalton
In this series of commits, I've implemented static linking for rust. The scheme I implemented was the same as my [mailing list post](https://mail.mozilla.org/pipermail/rust-dev/2013-November/006686.html).

The commits have more details to the nitty gritty of what went on. I've rebased this on top of my native mutex pull request (#10479), but I imagine that it will land before this lands, I just wanted to pre-emptively get all the rebase conflicts out of the way (becuase this is reorganizing building librustrt as well).

Some contentious points I want to make sure are all good:

* I've added more "compiler chooses a default" behavior than I would like, I want to make sure that this is all very clearly outlined in the code, and if not I would like to remove behavior or make it clearer.
* I want to make sure that the new "fancy suite" tests are ok (using make/python instead of another rust crate)

If we do indeed pursue this, I would be more than willing to write up a document describing how linking in rust works. I believe that this behavior should be very understandable, and the compiler should never hinder someone just because linking is a little fuzzy.
2013-11-30 14:41:40 -08:00
Eduard Burtescu a9c4b18b18 Box Block, fn_decl, variant and Ty in the AST, as they were inflating critical enum sizes. 2013-12-01 00:00:39 +02:00
bors 9bf62f71bc auto merge of #10727 : erickt/rust/json, r=huonw
This PR does some small modernizations to the json library. First is to remove the `@` boxes, second is to rename the constructors to `new`.
2013-11-30 06:06:42 -08:00
Erick Tryzelaar a7b311ac61 extra: missed a couple `@` in json 2013-11-29 21:26:03 -08:00
Alex Crichton e338a4154b Add generation of static libraries to rustc
This commit implements the support necessary for generating both intermediate
and result static rust libraries. This is an implementation of my thoughts in
https://mail.mozilla.org/pipermail/rust-dev/2013-November/006686.html.

When compiling a library, we still retain the "lib" option, although now there
are "rlib", "staticlib", and "dylib" as options for crate_type (and these are
stackable). The idea of "lib" is to generate the "compiler default" instead of
having too choose (although all are interchangeable). For now I have left the
"complier default" to be a dynamic library for size reasons.

Of the rust libraries, lib{std,extra,rustuv} will bootstrap with an
rlib/dylib pair, but lib{rustc,syntax,rustdoc,rustpkg} will only be built as a
dynamic object. I chose this for size reasons, but also because you're probably
not going to be embedding the rustc compiler anywhere any time soon.

Other than the options outlined above, there are a few defaults/preferences that
are now opinionated in the compiler:

* If both a .dylib and .rlib are found for a rust library, the compiler will
  prefer the .rlib variant. This is overridable via the -Z prefer-dynamic option
* If generating a "lib", the compiler will generate a dynamic library. This is
  overridable by explicitly saying what flavor you'd like (rlib, staticlib,
  dylib).
* If no options are passed to the command line, and no crate_type is found in
  the destination crate, then an executable is generated

With this change, you can successfully build a rust program with 0 dynamic
dependencies on rust libraries. There is still a dynamic dependency on
librustrt, but I plan on removing that in a subsequent commit.

This change includes no tests just yet. Our current testing
infrastructure/harnesses aren't very amenable to doing flavorful things with
linking, so I'm planning on adding a new mode of testing which I believe belongs
as a separate commit.

Closes #552
2013-11-29 18:36:13 -08:00
Erick Tryzelaar f7b739c34c extra: Rename json constructors into *::init 2013-11-29 11:19:19 -08:00
Patrick Walton c54427ddfb libstd: Change `Path::new` to `Path::init`. 2013-11-29 10:55:13 -08:00
osa1 bc423583a4 don't create intermediate string while creating json (rustdoc) 2013-11-29 10:06:21 +02:00
Alex Crichton ab387a6838 Register new snapshots 2013-11-28 20:27:56 -08:00
klutzy 79ed898f64 rustdoc: Use new ||/proc syntax 2013-11-28 02:27:04 +09:00
Patrick Walton 8ceb374ab7 librustc: Remove non-procedure uses of `do` from librustc, librustdoc,
and librustpkg.
2013-11-26 08:25:00 -08:00
Patrick Walton 9e610573ba librustc: Remove remaining uses of `&fn()` in favor of `||`. 2013-11-26 08:20:58 -08:00
Marvin Löbel 24b316a3b9 Removed unneccessary `_iter` suffixes from various APIs 2013-11-26 10:02:26 +01:00
bors 1746c0269d auto merge of #10644 : cmr/rust/rustdoc_cfg, r=alexcrichton
Closes #10623
2013-11-25 03:42:40 -08:00
bors 2cc1e16ac0 auto merge of #10603 : alexcrichton/rust/no-linked-failure, r=brson
The reasons for doing this are:

* The model on which linked failure is based is inherently complex
* The implementation is also very complex, and there are few remaining who
  fully understand the implementation
* There are existing race conditions in the core context switching function of
  the scheduler, and possibly others.
* It's unclear whether this model of linked failure maps well to a 1:1 threading
  model

Linked failure is often a desired aspect of tasks, but we would like to take a
much more conservative approach in re-implementing linked failure if at all.

Closes #8674
Closes #8318
Closes #8863
2013-11-24 21:32:13 -08:00
Alex Crichton acca9e3834 Remove linked failure from the runtime
The reasons for doing this are:

* The model on which linked failure is based is inherently complex
* The implementation is also very complex, and there are few remaining who
  fully understand the implementation
* There are existing race conditions in the core context switching function of
  the scheduler, and possibly others.
* It's unclear whether this model of linked failure maps well to a 1:1 threading
  model

Linked failure is often a desired aspect of tasks, but we would like to take a
much more conservative approach in re-implementing linked failure if at all.

Closes #8674
Closes #8318
Closes #8863
2013-11-24 21:21:12 -08:00
Corey Richardson 6fbe2a0c8b rustdoc: pass through --cfg to rustc
Closes #10623
2013-11-24 23:33:44 -05:00
Alex Crichton 0036f7bbba Process ffi generics in rustdoc
This prevents an assertion from being tripped because the generics weren't
categorized.

Closes #10597
2013-11-21 13:18:40 -08:00
Brian Anderson 85f107d8cb Use '..' as slice wildcard in vectors 2013-11-18 16:19:48 -08:00
bors 49c6ae10cb auto merge of #10421 : adridu59/rust/patch-www, r=alexcrichton
* Closes #10330
* Improves on #9873
* Adds favicon for tutorial files
2013-11-13 14:41:19 -08:00
bors 314d6f693f auto merge of #10277 : dcrewi/rust/missing-doc-and-visibility-rules, r=alexcrichton
Now the privacy pass returns enough information that other passes do not need to duplicate the visibility rules, and the missing_doc implementation is more consistent with other lint checks.
2013-11-13 10:16:29 -08:00
David Creswick 1f7eb4f9aa make missing_doc lint respect the visibility rules
Previously, the `exported_items` set created by the privacy pass was
incomplete. Specifically, it did not include items that had been defined
at a private path but then `pub use`d at a public path. This commit
finds all crate exports during the privacy pass. Consequently, some code
in the reachable pass and in rustdoc is no longer necessary. This commit
then removes the separate `MissingDocLintVisitor` lint pass, opting to
check missing_doc lint in the same pass as the other lint checkers using
the visibility result computed by the privacy pass.

Fixes #9777.
2013-11-13 11:31:59 -06:00
Adrien Tétar 5a01dbe67b doc: disable parser error highlighting + a few fixes
CodeMirror parser errors are related to #9873.
2013-11-13 09:32:29 +01:00
Adrien Tétar 123e0cefb6 doc: CSS: fix code fonts
Closes #10330.
2013-11-12 21:36:09 +01:00
Alex Crichton 49ee49296b Move std::rt::io to std::io 2013-11-11 20:44:07 -08:00
Alex Crichton 7755ffd013 Remove #[fixed_stack_segment] and #[rust_stack]
These two attributes are no longer useful now that Rust has decided to leave
segmented stacks behind. It is assumed that the rust task's stack is always
large enough to make an FFI call (due to the stack being very large).

There's always the case of stack overflow, however, to consider. This does not
change the behavior of stack overflow in Rust. This is still normally triggered
by the __morestack function and aborts the whole process.

C stack overflow will continue to corrupt the stack, however (as it did before
this commit as well). The future improvement of a guard page at the end of every
rust stack is still unimplemented and is intended to be the mechanism through
which we attempt to detect C stack overflow.

Closes #8822
Closes #10155
2013-11-11 10:40:34 -08:00
bors 8379890c05 auto merge of #10153 : nikomatsakis/rust/issue-4846-multiple-lifetime-parameters-7, r=pnkfelix
Fully support multiple lifetime parameters on types and elsewhere, removing special treatment for `'self`. I am submitting this a touch early in that I plan to push a new commit with more tests specifically targeting types with multiple lifetime parameters -- but the current code bootstraps and passes `make check`.

Fixes #4846
2013-11-09 08:36:09 -08:00
Niko Matsakis 1f4faaee40 Generalize AST and ty::Generics to accept multiple lifetimes. 2013-11-08 19:42:46 -05:00
Andrei Formiga 455de85163 Specify package_id for rust libs, to avoid spurious warnings 2013-11-08 17:42:46 -03: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
bors b5c1b48048 auto merge of #10199 : alexcrichton/rust/no-propagate, r=brson
This commit removes the propagation of `link_args` attributes across crates. The first commit message has the reasons as to why. Additionally, this starts statically linking some C/C++ helper libraries that we have to their respective crates instead of throwing then in librustrt and then having everything depend on librustrt.

The major downside of this movement is that we're losing the ability to control visible symbols. I couldn't figure out a way to internalize symbols from a static library during the linking process, so everyone who links to librustdoc will be able to use its sundown implementation (not exactly ideal). I'm not entirely sure how to fix this (beyond generating a list of all public symbols, including rust ones, and passing that to the linker), but we may have a much easier time with this once we start using llvm's linker toolchain.

There's certainly a lot more possibilities in where this can go, but I didn't want to go too deep just yet. The main idea here is to stop propagating linker arguments and then see how we're able to start statically linking libraries as a result.

r? @catamorphism, you're going to be working on linking soon, so feel free to completely throw this away for something else!
2013-11-02 22:16:02 -07:00
Steven Fackler ea9432ef00 Rustdoc: Properly strip private modules
A private module will survive the strip-private pass if it contains
trait implementations, which aren't stripped until a separate pass in
render.
2013-11-01 23:32:58 -07:00
Alex Crichton 7f31b079e5 Statically link sundown to librustdoc
Closes #10103
2013-11-01 21:28:48 -07:00
Joshua Yanovski a239c0ed66 Make addl_lib_search_paths a HashSet (Closes #7718). 2013-10-26 10:46:38 -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
Daniel Micay 142672dca4 register snapshots 2013-10-23 18:06:12 -04:00
Luqman Aden af163579ed libsyntax/librustc: Allow specifying mut on ~self. 2013-10-22 21:22:19 -04:00
Luqman Aden 5754848f8c libsyntax/librustc: Allow specifying mut on by-value self. 2013-10-22 21:21:21 -04:00
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
bors c6337f2099 auto merge of #10003 : alexcrichton/rust/issue-fixes, r=brson
Commits have all the fun details.
2013-10-22 01:31:24 -07:00
Alex Crichton 41f6e97a44 rustdoc: Render default methods for impls as well
This does not work for cross-crate implementations of traits. Cross-crate
implementations are a separate issue that should be addressed separately.
Basically when an implementation of an external trait is detected, the trait
would have to be loaded at that time (or possibly sooner...). Rustdoc currently
doesn't have the proper infrastructure for adding this.

Closes #9985
cc #9999
2013-10-21 11:43:14 -07:00
Alex Crichton bf6bb01a22 rustdoc: Don't overflow long type/module names
Closes #9862
2013-10-21 10:48:57 -07:00
Adrien Tétar 694b624305 rustdoc: nitpicks & cleanup 2013-10-21 04:13:09 +02:00
bors 5751794d97 auto merge of #9946 : sfackler/rust/enum-doc, r=alexcrichton
Struct fields with inherited visibility were previously stripped.

Closes #9899
2013-10-19 05:06:17 -07:00
Steven Fackler 590b50f71a Fix struct field visibility and add enum field doc
Struct fields with inherited visibility were previously stripped.

Closes #9899
2013-10-18 22:03:14 -07:00
Alex Crichton 7168e70bcb rustdoc: Strip methods correctly based on privacy
Beforehand the id of a method was the id of the 'self' argument, but this is not
the id which privacy was using (the id of the ast::method) struct, so by moving
the ids over to the privacy-target ones the methods are now stripped correctly.
2013-10-18 18:16:38 -07:00
bors d052912297 auto merge of #9851 : alexcrichton/rust/include_bin, r=huonw
Previously an ExprLit was created *per byte* causing a huge increase in memory
bloat. This adds a new `lit_binary` to contain a literal of binary data, which
is currently only used by the include_bin! syntax extension. This massively
speeds up compilation times of the shootout-k-nucleotide-pipes test

    before:
        time: 469s
        memory: 6GB
        assertion failure in LLVM (section too large)

    after:
        time: 2.50s
        memory: 124MB

Closes #2598
2013-10-18 09:41:33 -07:00
Alex Crichton 273784e9bf Optimize include_bin! for large inputs
Previously an ExprLit was created *per byte* causing a huge increase in memory
bloat. This adds a new `lit_binary` to contain a literal of binary data, which
is currently only used by the include_bin! syntax extension. This massively
speeds up compilation times of the shootout-k-nucleotide-pipes test

    before:
        time: 469s
        memory: 6GB
        assertion failure in LLVM (section too large)

    after:
        time: 2.50s
        memory: 124MB

Closes #2598
2013-10-18 09:20:08 -07:00
Alex Crichton cf844abced rustdoc: Don't treat "super" specially for urls
This was just incorrectly handled before, the path component shouldn't be looked
at at all (we used absolute paths everywhere instead of relative to the current
module location).

Closes #9861
2013-10-17 17:15:42 -07: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
Kevin Ballard c01a97b7a9 path2: Remove .with_display_str and friends
Rewrite these methods as methods on Display and FilenameDisplay. This
turns

  do path.with_display_str |s| { ... }

into

  do path.display().with_str |s| { ... }
2013-10-15 22:19:53 -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 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
Alex Crichton 4d2a402555 rustdoc: Don't abort if there's nothing to document
Instead there's no index.html file emitted because there wasn't anything to
document.

Closes #9828
2013-10-14 18:00:54 -07:00
Alex Crichton 3d693d74b8 rustdoc: Use privacy visibility for pruning
This commit ends rustdoc's approximation of privacy and instead uses the result
of the various compiler passes instead.

Closes #9827
2013-10-14 18:00:54 -07:00
Steven Fackler d6d31d788d Make Rustdoc strip private fields
In addition, the renderer will add comments to structs and enums saying
that fields or variants have been stripped.
2013-10-13 22:28:45 -07:00
Daniel Micay 6a90e80b62 option: rewrite the API to use composition 2013-10-09 09:17:29 -04:00
bors c9196290af auto merge of #9674 : ben0x539/rust/raw-str, r=alexcrichton
This branch parses raw string literals as in #9411.
2013-10-07 23:01:39 -07:00
Benjamin Herr 9d7b130041 add new enum ast::StrStyle as field to ast::lit_str
For the benefit of the pretty printer we want to keep track of how
string literals in the ast were originally represented in the source
code.

This commit changes parser functions so they don't extract strings from
the token stream without at least also returning what style of string
literal it was. This is stored in the resulting ast node for string
literals, obviously, for the package id in `extern mod = r"package id"`
view items, for the inline asm in `asm!()` invocations.

For `asm!()`'s other arguments or for `extern "Rust" fn()` items, I just
the style of string, because it seemed disproportionally cumbersome to
thread that information through the string processing that happens with
those string literals, given the limited advantage raw string literals
would provide in these positions.

The other syntax extensions don't seem to store passed string literals
in the ast, so they also discard the style of strings they parse.
2013-10-08 03:43:28 +02: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
Alex Crichton cdb7701434 rustdoc: Document what's going on throughout
This addresses some of @huonw's in #9691 about the startling lack of
documentation guiding one throughout the innards of rustdoc::html
2013-10-03 10:24:40 -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
Jordi Boggiano f00d72b78b Make source links highlight the entire definition and not just the first line 2013-10-02 16:17:07 -07:00
Jordi Boggiano 49e6db7f35 Prevent source view from wrapping lines 2013-10-02 12:32:20 -07:00
Jordi Boggiano 1501d65112 Highlight line numbers of the lines referred to in the url hash 2013-10-02 12:32:16 -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
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
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
Alex Crichton a7f19f36be rustdoc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
Alex Crichton 56da32c556 rustdoc: Don't ignore dox on impl blocks
Closes #9611
2013-09-30 20:31:20 -07:00
Alex Crichton d505f70f6f rustdoc: Stop ignoring dox on fields/variants
This is progress towards #9611
2013-09-30 20:31:20 -07:00
Alex Crichton fb259855dc rustdoc: Use a BufferedWriter when emitting source
This takes the rendering time of source files for libstd from 12.5s to 0.1s,
turns out write! calls the write function *a lot*
2013-09-30 20:31:20 -07:00
Alex Crichton cc1791584f rustdoc: Detect repeated keys and fix width
When a key is pressed and held, this now does the OS-style repeating after a bit
of a pause. Also fixes the width of search results to be correct (was changed
beforehand and didn't catch this).
2013-09-30 20:31:19 -07:00
Alex Crichton 863555f4fd rustdoc: Update the man page
Closes #9622
2013-09-30 20:31:19 -07:00
Alex Crichton e523f99fb9 rustdoc: Add the ability to input json
This modifies the command-line usage of rustdoc to intake its own JSON output as
well as a rust source file. This also alters the command line from
`rustdoc input file`  to `rustdoc file` with the input/output formats specified
as -r and -w, respectively.

When using a JSON input, no passes or plugins are re-run over the json, instead
the output is generated directly from the JSON that was provided. Passes and
plugins are still run on rust source input, however.
2013-09-30 20:31:19 -07:00
Alex Crichton a3ccbdc904 rustdoc: Generate valid code for struct-variants
Closes #9587
2013-09-30 12:32:04 -07:00
Alex Crichton 7b18976f08 Remove all usage of @ast::Crate 2013-09-29 16:21:25 -07:00
bors 9cc11ca6a3 auto merge of #9577 : alexcrichton/rust/rustdoc, r=cmr
They're getting smaller each time though!

The highlight of this round is source files in documentation. Still trying to figure out the best syntax-highlighting solution.
2013-09-28 13:46:11 -07:00
Alex Crichton 88866a4c20 rustdoc: Show type parameters on external paths
This removes the internal type representation of an `External` type and instead
relies on passing around DefId structures and interpreting them accordingly.

Progress on #9539, but there's still the problem of a crate => url mapping.
2013-09-28 13:43:43 -07:00
blake2-ppc 3709aa78d8 std::vec: Remove functions concat, connect
std::vec::{concat, connect, concat_slices, connect_slices} are replaced
by the already existing trait methods .concat_vec() and .connect_vec().
2013-09-28 05:56:49 +02:00
Alex Crichton dd8d565083 rustdoc: Include source files with documentation
All items have source links back to their actual code. Source files can be
omitted with the doc(html_no_source) attribute on the crate. Currently there is
no syntax highlighting, but that will come with syntax highlighting with all
other snippets.

Closes #2072
2013-09-27 16:54:19 -07:00
bors 67394f20eb auto merge of #9552 : brson/rust/0.9-pre, r=alexcrichton 2013-09-27 13:51:07 -07:00
Alex Crichton b93678eca5 rustdoc: Fix search for something on the same page 2013-09-27 11:06:07 -07:00
Alex Crichton a925762c3b rustdoc: Fix searching for default methods
Closes #9566
2013-09-27 10:45:09 -07:00
Alex Crichton c5e03bec4d rustdoc: Don't emit redirect pages for variants/fields
It's just a waste of disk space and it can be done just as well in JS.
2013-09-27 10:40:41 -07:00
bors 78c3fac852 auto merge of #9535 : alexcrichton/rust/no-format-default, r=thestinger
As mentioned in #9456, the format! syntax extension would previously consider an
empty format as a 'Unknown' format which could then also get coerced into a
different style of format on another argument.

This is unusual behavior because `{}` is a very common format and if you have
`{0} {0:?}` you wouldn't expect them both to be coereced to the `Poly`
formatter. This commit removes this coercion, but still retains the requirement
that each argument has exactly one format specified for it (an empty format now
counts as well).

Perhaps at a later date we can add support for multiple formats of one argument,
but this puts us in at least a backwards-compatible situation if we decide to do
that.
2013-09-27 09:41:07 -07:00
Alex Crichton b74663e027 Remove the notion of an "unknown format"
As mentioned in #9456, the format! syntax extension would previously consider an
empty format as a 'Unknown' format which could then also get coerced into a
different style of format on another argument.

This is unusual behavior because `{}` is a very common format and if you have
`{0} {0:?}` you wouldn't expect them both to be coereced to the `Poly`
formatter. This commit removes this coercion, but still retains the requirement
that each argument has exactly one format specified for it (an empty format now
counts as well).

Perhaps at a later date we can add support for multiple formats of one argument,
but this puts us in at least a backwards-compatible situation if we decide to do
that.
2013-09-27 09:39:05 -07:00
Brian Anderson 99c1fb8c66 Update version numbers to 0.9-pre 2013-09-26 18:18:42 -07:00
Alex Crichton 42bcf638b0 rustdoc: Render stability attributes
Closes #8965
2013-09-26 13:39:06 -07:00
Alex Crichton 6a277dc4ba rustdoc: Strip implementations of private traits
Closes #5416
2013-09-26 12:27:38 -07:00
Alex Crichton ca697d3705 rustdoc: Generate documentation for foreign items
This slurps up everything inside of an 'extern' block into the enclosing module
in order to document them. The documentation must be on the items themselves,
and they'll show up next to everything else on the module index pages.

Closes #5953
2013-09-26 11:57:25 -07:00
Alex Crichton c429c7c04b rustdoc: Fix broken struct field search links
Takes the same approach as variants, writes a redirect index page back to the
struct with an anchor to the field in question.

Closes #9524
2013-09-26 11:31:40 -07:00
Alex Crichton 3d5873fa42 rustdoc: Fix merge fallout 2013-09-25 14:28:20 -07:00
Alex Crichton 38eab97d16 rustdoc: Fix an unindentation bug when collapsing
Turns out eagerly trimming comes back to bite you :(
2013-09-25 14:27:43 -07:00
Alex Crichton bcb8657842 rustdoc: Collapse before unindenting
Doesn't make much sense to unindent each line individually and *then* collapse
them all together.
2013-09-25 14:27:43 -07:00
Alex Crichton e7fa081c18 rustdoc: Reduce ambiguity with clean::Type
The "Unresolved" variant could be completely removed becuase it turns out that
the interim state only very briefly lives.
2013-09-25 14:27:43 -07:00
Alex Crichton f648690234 rustdoc: Strip hidden docs by default. 2013-09-25 14:27:43 -07:00
Alex Crichton c4219a4783 rustdoc: Highlight function names
Closes #9460
2013-09-25 14:27:42 -07:00
Alex Crichton 5636ca625e rustdoc: Start rendering variants (redirect to enum)
This allows reasonable behavior when an enum is clicked in an import.
2013-09-25 14:27:42 -07:00
Alex Crichton 5c6f8a976f rustdoc: Linkify all reexports.
This way each component of a reexport path is click-able to the destination that
it's referencing.
2013-09-25 14:27:42 -07:00
Alex Crichton c838351ba6 rustdoc: Implement stripping based on privacy
This will probably need to get tweaked once the privacy rules have been fully
agreed on, but for now this has all of the infrastructure necessary for
filtering out private items.

Closes #9410
2013-09-25 14:27:42 -07:00
Alex Crichton acab4a8c8e rustdoc: Emit purity to function dox for traits
Closes #3804
2013-09-25 14:27:42 -07:00
Alex Crichton eaaf2bd41f rustdoc: Add the ability to list all passes
In doing so, also remove the collapse-privacy pass because it's a little
over-zealous and may not be right 100% of the time (not used right now as well)
2013-09-25 14:27:42 -07:00
Alex Crichton 35c0cdff5a rustdoc: Enable various useful markdown extensions 2013-09-25 14:27:42 -07:00
Alex Crichton db28c29980 rustdoc: Use sundown for markdown highlighting
This takes rendering times of documentation down from 30s to 0.5s. Kinda sad
that none of the parallelism is needed, but oh well!

Closes #7380
cc #3546
2013-09-25 14:27:42 -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
Patrick Walton d126be068b librustpkg: Fix diagnostic invocation syntax in librustdoc, librusti, and librustpkg. 2013-09-23 18:23:20 -07:00
Alex Crichton 83499d1a89 Place *all* rustdoc output in doc/{crate} 2013-09-22 20:09:42 -07:00
Alex Crichton 7b24efd6f3 rustdoc: Out with the old, in with the new
Removes old rustdoc, moves rustdoc_ng into its place instead (plus drops the _ng
suffix). Also shreds all reference to rustdoc_ng from the Makefile rules.
2013-09-22 09:51:15 -07:00
Brian Anderson 695cb9fc2b Update version numbers to 0.8 2013-09-21 16:25:08 -07: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
Steven Fackler ff85389344 Modernize extra::future API 2013-09-19 15:19:20 -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
Chris Morgan e2807a4565 Replace unreachable() calls with unreachable!().
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-19 15:04:03 +10:00
Daniel Micay 4e161a4d40 switch Drop to `&mut self` 2013-09-16 22:19:23 -04:00
Erick Tryzelaar 38f97ea103 std: Rename {Option,Result}::chain{,_err}* to {and_then,or_else} 2013-09-12 18:54:13 -07:00
Erick Tryzelaar 45c62c08f9 std: rename Option::unwrap_or_default() to unwrap_or() 2013-09-12 18:54:11 -07:00
bors 753d8c226c auto merge of #9088 : nikomatsakis/rust/issue-6304-AST-tree-not-DAG, r=catamorphism
Ensures that each AST node has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two
representative tests.

Fixes #7971
Fixes #6304
Fixes #8367
Fixes #8754
Fixes #8852
Fixes #2543
Fixes #7654
2013-09-10 03:10:59 -07:00
Niko Matsakis a5ad4c3794 Delay assignment of node ids until after expansion. Ensures that each AST node
has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two
representative tests.

Fixes #7971
Fixes #6304
Fixes #8367
Fixes #8754
Fixes #8852
Fixes #2543
Fixes #7654
2013-09-10 05:45:12 -04:00
blake2-ppc 6212729315 std::vec: Change fn unzip to take an iterator argument
Remove unzip_slice since it's redundant. Old unzip is equivalent to the
`|x| unzip(x.move_iter())`
2013-09-10 05:39:59 +02:00
Florian Hahn de39874801 Rename str::from_bytes to str::from_utf8, closes #8985 2013-09-05 14:17:24 +02:00
Marvin Löbel 857f867320 Renamed syntax::ast::ident -> Ident 2013-09-02 02:51:21 +02:00
Brian Anderson 3c5a43e5b6 Revert "auto merge of #8645 : alexcrichton/rust/issue-6436-run-non-blocking, r=brson"
This reverts commit b8d1fa3994, reversing
changes made to f22b4b1698.

Conflicts:
	mk/rt.mk
	src/libuv
2013-08-29 14:23:44 -07:00
Alex Crichton b89e1c000e Implement process bindings to libuv
Closes #6436
2013-08-27 20:46:43 -07:00
Do Nhat Minh 77df8b809a removed os::set_args, closing #8325
removed pub on real_args, changed test to use args
2013-08-23 10:26:37 +08:00
Nick Desaulniers 0932ab336f Remove unused automatic cfg bindings Fixes #7169 2013-08-13 17:06:27 -07:00
Alex Crichton 930885d5e5 Forbid pub/priv where it has no effect
Closes #5495
2013-08-12 23:20:46 -07:00
Erick Tryzelaar 6fcf2ee8e3 std: Transform.find_ -> .find 2013-08-10 07:33:22 -07:00
Erick Tryzelaar 68f40d215e std: Rename Iterator.transform -> .map
cc #5898
2013-08-10 07:33:21 -07:00
Erick Tryzelaar fad7857c7b Mass rename of .consume{,_iter}() to .move_iter()
cc #7887
2013-08-10 07:01:07 -07:00
Corey Richardson 878e74e1ce Fix more priv fallout 2013-08-08 17:02:03 -04:00
Sangeun Kim a9b7bec2e7 Change const to static 2013-08-07 22:41:13 -04:00
Sangeun Kim 19d0eb9060 Change Freeze to Static 2013-08-07 22:41:13 -04:00
bors 98ec79c957 auto merge of #8294 : erickt/rust/map-move, r=bblum
According to #7887, we've decided to use the syntax of `fn map<U>(f: &fn(&T) -> U) -> U`, which passes a reference to the closure, and to `fn map_move<U>(f: &fn(T) -> U) -> U` which moves the value into the closure. This PR adds these `.map_move()` functions to `Option` and `Result`.

In addition, it has these other minor features:
 
* Replaces a couple uses of `option.get()`, `result.get()`, and `result.get_err()` with `option.unwrap()`, `result.unwrap()`, and `result.unwrap_err()`. (See #8268 and #8288 for a more thorough adaptation of this functionality.
* Removes `option.take_map()` and `option.take_map_default()`. These two functions can be easily written as `.take().map_move(...)`.
* Adds a better error message to `result.unwrap()` and `result.unwrap_err()`.
2013-08-07 13:23:07 -07:00
Erick Tryzelaar 1e490813b0 core: option.map_consume -> option.map_move 2013-08-07 08:52:09 -07:00
Daniel Micay 8f9bbc476d remove `extra::iter`
This module provided adaptors for the old internal iterator protocol,
but they proved to be quite unreadable and are not generic enough to
handle borrowed pointers well.

Since Rust no longer defines an internal iteration protocol, I don't
think there's going to be any reuse via these adaptors.
2013-08-06 23:41:20 -04:00
Marvin Löbel 0ac7a219f0 Updated std::Option, std::Either and std::Result
- Made naming schemes consistent between Option, Result and Either
- Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None)
- Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-08-05 22:42:21 +02:00
Daniel Micay 1008945528 remove obsolete `foreach` keyword
this has been replaced by `for`
2013-08-03 22:48:02 -04:00
Patrick Walton 9457ebee55 librustc: Disallow "unsafe" for external functions 2013-08-02 21:57:59 -07:00
blake2-ppc 78cde5b9fb std: Change `Times` trait to use `do` instead of `for`
Change the former repetition::

    for 5.times { }

to::

    do 5.times { }

.times() cannot be broken with `break` or `return` anymore; for those
cases, use a numerical range loop instead.
2013-08-01 16:54:22 +02:00
Daniel Micay 1fc4db2d08 migrate many `for` loops to `foreach` 2013-08-01 05:34:55 -04:00
Michael Woerister 8a329770b6 New naming convention for ast::{node_id, local_crate, crate_node_id, blk_check_mode, ty_field, ty_method} 2013-07-29 16:16:48 +02:00
maikklein f6bcf5d5f1 cleanup .chain and .chain_err + fixing other files 2013-07-27 23:41:09 -07:00
Birunthan Mohanathas d047cf1ec6 Change 'print(fmt!(...))' to printf!/printfln! in src/lib* 2013-07-24 09:45:20 -04:00
Michael Woerister 4bd1424622 Ast spanned<T> refactoring, renaming: crate, local, blk, crate_num, crate_cfg.
`crate => Crate`
`local => Local`
`blk => Block`
`crate_num => CrateNum`
`crate_cfg => CrateConfig`

Also, Crate and Local are not wrapped in spanned<T> anymore.
2013-07-22 15:35:28 +02:00
Huon Wilson cc760a647a syntax: modernise attribute handling in syntax::attr.
This does a number of things, but especially dramatically reduce the
number of allocations performed for operations involving attributes/
meta items:

- Converts ast::meta_item & ast::attribute and other associated enums
  to CamelCase.
- Converts several standalone functions in syntax::attr into methods,
  defined on two traits AttrMetaMethods & AttributeMethods. The former
  is common to both MetaItem and Attribute since the latter is a thin
  wrapper around the former.
- Deletes functions that are unnecessary due to iterators.
- Converts other standalone functions to use iterators and the generic
  AttrMetaMethods rather than allocating a lot of new vectors (e.g. the
  old code would have to allocate a new vector to use functions that
  operated on &[meta_item] on &[attribute].)
- Moves the core algorithm of the #[cfg] matching to syntax::attr,
  similar to find_inline_attr and find_linkage_metas.

This doesn't have much of an effect on the speed of #[cfg] stripping,
despite hugely reducing the number of allocations performed; presumably
most of the time is spent in the ast folder rather than doing attribute
checks.

Also fixes the Eq instance of MetaItem_ to correctly ignore spaces, so
that `rustc --cfg 'foo(bar)'` now works.
2013-07-20 01:06:16 +10:00
Felix S. Klock II 3b158b3e42 Silence various warnings in bootstrap build. 2013-07-18 09:35:12 +02:00
Patrick Walton e20549ff19 librustc: Remove all uses of the `Copy` bound. 2013-07-17 14:57:53 -07:00
Patrick Walton 99b33f7219 librustc: Remove all uses of "copy". 2013-07-17 14:57:51 -07:00
Patrick Walton b4e674f6e6 librustc: Add a lint mode for unnecessary `copy` and remove a bunch of them. 2013-07-17 14:56:42 -07:00
Huon Wilson e4f7561bcd Clean-up tests after debug!/std-macros change.
The entire testsuite is converted to using info! rather than debug!
because some depend on the code within the debug! being trans'd.
2013-07-17 03:10:13 +10:00
Huon Wilson b48e37e8ee syntax: make a macros-injection pass; conditionally define debug! to a noop based on cfg(debug).
Macros can be conditionally defined because stripping occurs before macro
expansion, but, the built-in macros were only added as part of the actual
expansion process and so couldn't be stripped to have definitions conditional
on cfg flags.

debug! is defined conditionally in terms of the debug config, expanding to
nothing unless the --cfg debug flag is passed (to be precise it expands to
`if false { normal_debug!(...) }` so that they are still type checked, and
to avoid unused variable lints).
2013-07-16 15:05:50 +10:00
bors e388a80c23 auto merge of #7117 : jensnockert/rust/freestanding, r=cmr
The free-standing functions in f32, f64, i8, i16, i32, i64, u8, u16,
u32, u64, float, int, and uint are replaced with generic functions in
num instead.

This means that instead of having to know everywhere what the type is, like

~~~
f64::sin(x)
~~~

You can simply write code that uses the type-generic versions in num instead, this works for all types that implement the corresponding trait in num.

~~~
num::sin(x)
~~~

Note 1: If you were previously using any of those functions, just replace them
with the corresponding function with the same name in num.

Note 2: If you were using a function that corresponds to an operator, use the
operator instead.

Note 3: This is just https://github.com/mozilla/rust/pull/7090 reopened against master.
2013-07-09 13:34:50 -07:00
Brian Anderson b0a9d8193f Bump version numbers to 0.8-pre 2013-07-08 10:25:45 -07:00
Jens Nockert 1aae28a57d Replaces the free-standing functions in f32, &c.
The free-standing functions in f32, f64, i8, i16, i32, i64, u8, u16,
u32, u64, float, int, and uint are replaced with generic functions in
num instead.

If you were previously using any of those functions, just replace them
with the corresponding function with the same name in num.

Note: If you were using a function that corresponds to an operator, use
the operator instead.
2013-07-08 18:05:17 +02:00
Daniel Micay 641aec7407 remove some method resolve workarounds 2013-07-07 19:51:13 -04:00
James Miller fb19205b1b Fix rustdoc and rusti 2013-07-07 22:51:10 +12:00
Huon Wilson f19fb2459f Remove standalone comparison functions in vec, make the trait impls better. 2013-07-04 00:46:50 +10:00
Huon Wilson de0d696561 Remove vec::{filter, filtered, filter_map, filter_mapped}, replaced by iterators. 2013-07-04 00:46:49 +10:00
Huon Wilson c437a16c5d rustc: add a lint to enforce uppercase statics. 2013-07-01 17:52:57 +10:00
bors 07feeb95c5 auto merge of #7487 : huonw/rust/vec-kill, r=cmr
Continuation of #7430.

I haven't removed the `map` method, since the replacement `v.iter().transform(f).collect::<~[SomeType]>()` is a little ridiculous at the moment.
2013-06-30 21:14:13 -07:00
Brian Anderson a766a955a9 Bump version from 0.7-pre to 0.7 2013-06-30 16:36:48 -07:00
Huon Wilson c0a20d2929 Remove vec::{map, mapi, zip_map} and the methods, except for .map, since this
is very common, and the replacement (.iter().transform().collect()) is very
ugly.
2013-06-30 21:59:44 +10:00
Corey Richardson 1662bd371c Great renaming: propagate throughout the rest of the codebase 2013-06-29 11:20:02 -04:00
Patrick Walton a1531ed946 librustc: Remove the broken overloaded assign-ops from the language.
They evaluated the receiver twice. They should be added back with
`AddAssign`, `SubAssign`, etc., traits.
2013-06-28 10:44:16 -04:00
Patrick Walton 1c0aa78481 librustc: Change "Owned" to "Send" everywhere 2013-06-28 10:44:15 -04:00
Patrick Walton 1eec3bba13 librustc: Rename Const to Freeze 2013-06-28 10:44:15 -04:00
Luqman Aden ca2966c6d0 Change finalize -> drop. 2013-06-25 21:14:39 -04:00
Alex Crichton 42b44b21b1 Rename all files with the 'rc' extension 2013-06-25 08:55:15 -07:00
Alex Crichton 8fdc8f392c Support foreign 'static mut' variables as well 2013-06-23 18:00:32 -07:00
Alex Crichton 1841b31c61 Add 'static mut' items to the language 2013-06-23 17:59:35 -07:00
Daniel Micay d2e9912aea vec: remove BaseIter implementation
I removed the `static-method-test.rs` test because it was heavily based
on `BaseIter` and there are plenty of other more complex uses of static
methods anyway.
2013-06-23 02:05:20 -04:00