Commit Graph

60 Commits

Author SHA1 Message Date
Michael Darakananda f079c94f72 rustc: Remove matching on ~str from the language
The `~str` type is not long for this world as it will be superseded by the
soon-to-come DST changes for the language. The new type will be
`~Str`, and matching over the allocation will no longer be supported.
Matching on `&str` will continue to work, in both a pre and post DST world.
2014-03-12 19:17:36 -04:00
Huon Wilson f22c96cc88 rustdoc: add table-of-contents recording & rendering, use it with plain
markdown files.

This means that

    # Foo
    ## Bar
    # Baz
    ### Qux
    ## Quz

Gets a TOC like

    1 Foo
       1.1 Bar
    2 Baz
       2.0.1 Qux
       2.1 Quz

This functionality is only used when rendering a single markdown file,
never on an individual module, although it could very feasibly be
extended to allow modules to opt-in to a table of contents (std::fmt
comes to mind).
2014-03-09 19:29:49 +11:00
Huon Wilson 69b8ef806b rustdoc: run on plain Markdown files.
This theoretically gives rustdoc the ability to render our guides,
tutorial and manual (not in practice, since the files themselves need to
be adjusted slightly to use Sundown-compatible functionality).

Fixes #11392.
2014-03-09 19:29:49 +11:00
Alex Crichton 6485917d7c Move extra::json to libserialize
This also inverts the dependency between libserialize and libcollections.

cc #8784
2014-02-24 09:51:39 -08:00
Nick Cameron 317a253b22 All uses of `extern fn` should mean `extern "C" fn`. Closes #9309. 2014-02-24 13:24:57 +13:00
Alex Crichton ad9e26dab3 rustdoc: Add syntax highlighting
This adds simple syntax highlighting based off libsyntax's lexer to be sure to
stay up to date with rust's grammar. Some of the highlighting is a bit ad-hoc,
but it definitely seems to get the job done!

This currently doesn't highlight rustdoc-rendered function signatures and
structs that are emitted to each page because the colors already signify what's
clickable and I think we'd have to figure out a different scheme before
colorizing them. This does, however, colorize all code examples and source code.

Closes #11393
2014-02-23 00:16:23 -08:00
Arcterus 66f93291ec Move time out of extra (cc #8784) 2014-02-21 07:44:11 -08:00
Alex Crichton 7bb498bd7a Mass rename if_ok! to try!
This "bubble up an error" macro was originally named if_ok! in order to get it
landed, but after the fact it was discovered that this name is not exactly
desirable.

The name `if_ok!` isn't immediately clear that is has much to do with error
handling, and it doesn't look fantastic in all contexts (if if_ok!(...) {}). In
general, the agreed opinion about `if_ok!` is that is came in as subpar.

The name `try!` is more invocative of error handling, it's shorter by 2 letters,
and it looks fitting in almost all circumstances. One concern about the word
`try!` is that it's too invocative of exceptions, but the belief is that this
will be overcome with documentation and examples.

Close #12037
2014-02-20 09:16:52 -08:00
Liigo Zhuang 53b9d1a324 move extra::test to libtest 2014-02-20 16:03:58 +08:00
Alex Crichton 68d576fd34 rustdoc: Fix json output and input
Turns out a hash map with integer keys isn't serializable to json.

Closes #10115
2014-02-19 01:10:31 -08:00
bors 57d273f65e auto merge of #12284 : brson/rust/install, r=alexcrichton
Work toward #9876.

This adds `prepare.mk`, which is simply a more heavily-parameterized `install.mk`, then uses `prepare` to implement both `install` and the windows installer (`dist`). Smoke tested on both Linux and Windows.
2014-02-17 03:26:51 -08:00
Brian Anderson 2b64cb294c Address review feedback 2014-02-16 17:36:43 -08:00
Brendan Zabarauskas cf0654c47c Improve naming of tuple getters, and add mutable tuple getter
Renames the `n*` and `n*_ref` tuple getters to `val*` and `ref*` respectively, and adds `mut*` getters.
2014-02-17 00:57:56 +11:00
Alex Crichton a41b0c2529 extern mod => extern crate
This was previously implemented, and it just needed a snapshot to go through
2014-02-14 22:55:21 -08:00
Flavio Percoco 968633b60a Replace `crate` usage with `krate`
This patch replaces all `crate` usage with `krate` before introducing the
new keyword. This ensures that after introducing the keyword, there
won't be any compilation errors.

krate might not be the most expressive substitution for crate but it's a
very close abbreviation for it. `module` was already used in several
places already.
2014-02-13 20:52:07 +01:00
HeroesGrave d81bb441da moved collections from libextra into libcollections 2014-02-07 19:49:26 +13:00
Arcterus c09ca940e5 getopts: replaced base functions with those from group 2014-02-06 10:04:26 -08:00
Arcterus 9752c63035 Move getopts out of extra 2014-02-06 10:00:17 -08:00
Jeff Olson b8852e89ce pull extra::{serialize, ebml} into a separate libserialize crate
- `extra::json` didn't make the cut, because of `extra::json` required
   dep on `extra::TreeMap`. If/when `extra::TreeMap` moves out of `extra`,
   then `extra::json` could move into `serialize`
- `libextra`, `libsyntax` and `librustc` depend on the newly created
  `libserialize`
- The extensions to various `extra` types like `DList`, `RingBuf`, `TreeMap`
  and `TreeSet` for `Encodable`/`Decodable` were moved into the respective
  modules in `extra`
- There is some trickery, evident in `src/libextra/lib.rs` where a stub
  of `extra::serialize` is set up (in `src/libextra/serialize.rs`) for
  use in the stage0 build, where the snapshot rustc is still making
  deriving for `Encodable` and `Decodable` point at extra. Big props to
  @huonw for help working out the re-export solution for this

extra: inline extra::serialize stub

fix stuff clobbered in rebase + don't reexport serialize::serialize

no more globs in libserialize

syntax: fix import of libserialize traits

librustc: fix bad imports in encoder/decoder

add serialize dep to librustdoc

fix failing run-pass tests w/ serialize dep

adjust uuid dep

more rebase de-clobbering for libserialize

fixing tests, pushing libextra dep into cfg(test)

fix doc code in extra::json

adjust index.md links to serialize and uuid library
2014-02-05 10:38:22 -08:00
JeremyLetang dd21a51d29 move concurrent stuff from libextra to libsync 2014-02-05 11:56:04 -05:00
Alex Crichton 6132f7f666 rustdoc: Remove io_error usage 2014-02-03 09:32:34 -08:00
Scott Lawrence af218d68e4 Removing do keyword from librustdoc 2014-01-29 09:15:41 -05:00
Salem Talha cc61fc0994 Removed all instances of XXX in preparation for relaxing of FIXME rule 2014-01-26 14:42:53 -05:00
Simon Sapin 05ae134ace [std::str] Rename from_utf8_owned_opt() to from_utf8_owned(), drop the old from_utf8_owned() behavior 2014-01-21 15:48:48 -08:00
Alex Crichton 295b46fc08 Tweak the interface of std::io
* Reexport io::mem and io::buffered structs directly under io, make mem/buffered
  private modules
* Remove with_mem_writer
* Remove DEFAULT_CAPACITY and use DEFAULT_BUF_SIZE (in io::buffered)
2014-01-17 10:00:47 -08:00
Brian Anderson 46905c04f5 Bump version to 0.10-pre 2014-01-12 17:45:22 -08:00
bors 01794cc993 auto merge of #11461 : alexcrichton/rust/rustdoc-fixes, r=brson
See the commits.
2014-01-11 02:41:23 -08:00
Brendan Zabarauskas 4fc0452ace Remove re-exports of std::io::stdio::{print, println} in the prelude.
The `print!` and `println!` macros are now the preferred method of printing, and so there is no reason to export the `stdio` functions in the prelude. The functions have also been replaced by their macro counterparts in the tutorial and other documentation so that newcomers don't get confused about what they should be using.
2014-01-11 10:46:00 +11:00
Alex Crichton 79e144ed64 rustdoc: Get --version working
Closes #11421
2014-01-10 15:12:06 -08:00
Derek Chiang 6f875c96b3 Fix #11421 2014-01-10 22:09:59 +08: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
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
Brian Anderson 14f59e8902 Remove references to rustdoc_ng 2013-12-31 14:50:38 -08:00
Alex Crichton ab431a20c0 Register new snapshots 2013-12-26 11:30:23 -08: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
Corey Richardson dee1107571 Rename pkgid to crate_id
Closes #11035
2013-12-19 10:10:23 -05: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 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 786dea207d libextra: Another round of de-`Cell`-ing.
34 uses of `Cell` remain.
2013-12-10 15:13:12 -08: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
Alex Crichton acc5e32e53 Register new snapshots 2013-12-03 14:31:54 -08: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
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