Commit Graph

398 Commits

Author SHA1 Message Date
Brian Anderson c27133e2ce Preliminary feature staging
This partially implements the feature staging described in the
[release channel RFC][rc]. It does not yet fully conform to the RFC as
written, but does accomplish its goals sufficiently for the 1.0 alpha
release.

It has three primary user-visible effects:

* On the nightly channel, use of unstable APIs generates a warning.
* On the beta channel, use of unstable APIs generates a warning.
* On the beta channel, use of feature gates generates a warning.

Code that does not trigger these warnings is considered 'stable',
modulo pre-1.0 bugs.

Disabling the warnings for unstable APIs continues to be done in the
existing (i.e. old) style, via `#[allow(...)]`, not that specified in
the RFC. I deem this marginally acceptable since any code that must do
this is not using the stable dialect of Rust.

Use of feature gates is itself gated with the new 'unstable_features'
lint, on nightly set to 'allow', and on beta 'warn'.

The attribute scheme used here corresponds to an older version of the
RFC, with the `#[staged_api]` crate attribute toggling the staging
behavior of the stability attributes, but the user impact is only
in-tree so I'm not concerned about having to make design changes later
(and I may ultimately prefer the scheme here after all, with the
`#[staged_api]` crate attribute).

Since the Rust codebase itself makes use of unstable features the
compiler and build system to a midly elaborate dance to allow it to
bootstrap while disobeying these lints (which would otherwise be
errors because Rust builds with `-D warnings`).

This patch includes one significant hack that causes a
regression. Because the `format_args!` macro emits calls to unstable
APIs it would trigger the lint.  I added a hack to the lint to make it
not trigger, but this in turn causes arguments to `println!` not to be
checked for feature gates. I don't presently understand macro
expansion well enough to fix. This is bug #20661.

Closes #16678

[rc]: https://github.com/rust-lang/rfcs/blob/master/text/0507-release-channels.md
2015-01-07 15:34:56 -08:00
Alex Crichton 36f5d122b8 rollup merge of #20615: aturon/stab-2-thread
This commit takes a first pass at stabilizing `std::thread`:

* It removes the `detach` method in favor of two constructors -- `spawn`
  for detached threads, `scoped` for "scoped" (i.e., must-join)
  threads. This addresses some of the surprise/frustrating debug
  sessions with the previous API, in which `spawn` produced a guard that
  on destruction joined the thread (unless `detach` was called).

  The reason to have the division in part is that `Send` will soon not
  imply `'static`, which means that `scoped` thread creation can take a
  closure over *shared stack data* of the parent thread. On the other
  hand, this means that the parent must not pop the relevant stack
  frames while the child thread is running. The `JoinGuard` is used to
  prevent this from happening by joining on drop (if you have not
  already explicitly `join`ed.) The APIs around `scoped` are
  future-proofed for the `Send` changes by taking an additional lifetime
  parameter. With the current definition of `Send`, this is forced to be
  `'static`, but when `Send` changes these APIs will gain their full
  flexibility immediately.

  Threads that are `spawn`ed, on the other hand, are detached from the
  start and do not yield an RAII guard.

  The hope is that, by making `scoped` an explicit opt-in with a very
  suggestive name, it will be drastically less likely to be caught by a
  surprising deadlock due to an implicit join at the end of a scope.

* The module itself is marked stable.

* Existing methods other than `spawn` and `scoped` are marked stable.

The migration path is:

```rust
Thread::spawn(f).detached()
```

becomes

```rust
Thread::spawn(f)
```

while

```rust
let res = Thread::spawn(f);
res.join()
```

becomes

```rust
let res = Thread::scoped(f);
res.join()
```

[breaking-change]
2015-01-06 15:38:38 -08:00
Alex Crichton e3f047c8c5 rollup merge of #20653: alexcrichton/entry-unstable
There's been some debate over the precise form that these APIs should take, and
they've undergone some changes recently, so these APIs are going to be left
unstable for now to be fleshed out during the next release cycle.
2015-01-06 15:29:18 -08:00
Alex Crichton e2f97f51ad Register new snapshots
Conflicts:
	src/librbml/lib.rs
	src/libserialize/json_stage0.rs
	src/libserialize/serialize_stage0.rs
	src/libsyntax/ast.rs
	src/libsyntax/ext/deriving/generic/mod.rs
	src/libsyntax/parse/token.rs
2015-01-06 15:24:24 -08:00
Aaron Turon caca9b2e71 Fallout from stabilization 2015-01-06 14:57:52 -08:00
Sean McArthur 44440e5c18 core: split into fmt::Show and fmt::String
fmt::Show is for debugging, and can and should be implemented for
all public types. This trait is used with `{:?}` syntax. There still
exists #[derive(Show)].

fmt::String is for types that faithfully be represented as a String.
Because of this, there is no way to derive fmt::String, all
implementations must be purposeful. It is used by the default format
syntax, `{}`.

This will break most instances of `{}`, since that now requires the type
to impl fmt::String. In most cases, replacing `{}` with `{:?}` is the
correct fix. Types that were being printed specifically for users should
receive a fmt::String implementation to fix this.

Part of #20013

[breaking-change]
2015-01-06 14:49:42 -08:00
Dylan Ede 25eada1574 [breaking change] Revert Entry behaviour to take keys by value. 2015-01-06 11:59:26 -08:00
Keegan McAllister 60be2f52d2 Replace #[phase] with #[plugin] / #[macro_use] / #[no_link] 2015-01-05 18:21:13 -08:00
Keegan McAllister 5bf385be6a Rename macro_escape to macro_use
In the future we want to support

    #[macro_use(foo, bar)]
    mod macros;

but it's not an essential part of macro reform.  Reserve the syntax for now.
2015-01-05 12:00:57 -08:00
Keegan McAllister fc58479323 Stop using macro_escape as an inner attribute
In preparation for the rename.
2015-01-05 12:00:57 -08:00
Ben Foppa 400c3a0ddc [breaking change] Update entry API as part of RFC 509. 2015-01-04 15:55:54 -05:00
Jorge Aparicio 56dcbd17fd sed -i -s 's/\bmod,/self,/g' **/*.rs 2015-01-03 22:42:21 -05:00
Jorge Aparicio 99017f82b6 use assoc types in binop traits 2015-01-03 16:29:19 -05:00
Alex Crichton 735c308aed rollup merge of #20416: nikomatsakis/coherence
Conflicts:
	src/test/run-pass/issue-15734.rs
	src/test/run-pass/issue-3743.rs
2015-01-02 09:23:42 -08:00
Niko Matsakis c61a0092bc Fix orphan checking (cc #19470). (This is not a complete fix of #19470 because of the backwards compatibility feature gate.)
This is a [breaking-change]. The new rules require that, for an impl of a trait defined
in some other crate, two conditions must hold:

1. Some type must be local.
2. Every type parameter must appear "under" some local type.

Here are some examples that are legal:

```rust
struct MyStruct<T> { ... }

// Here `T` appears "under' `MyStruct`.
impl<T> Clone for MyStruct<T> { }

// Here `T` appears "under' `MyStruct` as well. Note that it also appears
// elsewhere.
impl<T> Iterator<T> for MyStruct<T> { }
```

Here is an illegal example:

```rust
// Here `U` does not appear "under" `MyStruct` or any other local type.
// We call `U` "uncovered".
impl<T,U> Iterator<U> for MyStruct<T> { }
```

There are a couple of ways to rewrite this last example so that it is
legal:

1. In some cases, the uncovered type parameter (here, `U`) should be converted
   into an associated type. This is however a non-local change that requires access
   to the original trait. Also, associated types are not fully baked.
2. Add `U` as a type parameter of `MyStruct`:
   ```rust
   struct MyStruct<T,U> { ... }
   impl<T,U> Iterator<U> for MyStruct<T,U> { }
   ```
3. Create a newtype wrapper for `U`
   ```rust
   impl<T,U> Iterator<Wrapper<U>> for MyStruct<T,U> { }
   ```

Because associated types are not fully baked, which in the case of the
`Hash` trait makes adhering to this rule impossible, you can
temporarily disable this rule in your crate by using
`#![feature(old_orphan_check)]`. Note that the `old_orphan_check`
feature will be removed before 1.0 is released.
2015-01-02 04:06:09 -05:00
Alex Crichton e423fcf0e0 std: Enforce Unicode in fmt::Writer
This commit is an implementation of [RFC 526][rfc] which is a change to alter
the definition of the old `fmt::FormatWriter`. The new trait, renamed to
`Writer`, now only exposes one method `write_str` in order to guarantee that all
implementations of the formatting traits can only produce valid Unicode.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md

One of the primary improvements of this patch is the performance of the
`.to_string()` method by avoiding an almost-always redundant UTF-8 check. This
is a breaking change due to the renaming of the trait as well as the loss of the
`write` method, but migration paths should be relatively easy:

* All usage of `write` should move to `write_str`. If truly binary data was
  being written in an implementation of `Show`, then it will need to use a
  different trait or an altogether different code path.

* All usage of `write!` should continue to work as-is with no modifications.

* All usage of `Show` where implementations just delegate to another should
  continue to work as-is.

[breaking-change]

Closes #20352
2015-01-01 22:04:46 -08:00
Florian Hahn c11e1551d1 Add verbose option to rustdoc in order to fix problem with --version
closes #20340
2014-12-30 22:27:02 +01:00
Alex Crichton d085d9d315 rustc: Add knowledge of separate lookup paths
This commit adds support for the compiler to distinguish between different forms
of lookup paths in the compiler itself. Issue #19767 has some background on this
topic, as well as some sample bugs which can occur if these lookup paths are not
separated.

This commits extends the existing command line flag `-L` with the same trailing
syntax as the `-l` flag. Each argument to `-L` can now have a trailing `:all`,
`:native`, `:crate`, or `:dependency`. This suffix indicates what form of lookup
path the compiler should add the argument to. The `dependency` lookup path is
used when looking up crate dependencies, the `crate` lookup path is used when
looking for immediate dependencies (`extern crate` statements), and the `native`
lookup path is used for probing for native libraries to insert into rlibs. Paths
with `all` are used for all of these purposes (the default).

The default compiler lookup path (the rustlib libdir) is by default added to all
of these paths. Additionally, the `RUST_PATH` lookup path is added to all of
these paths.

Closes #19767
2014-12-23 10:08:17 -08:00
Alex Crichton a76a802768 serialize: Fully deprecate the library
This commit completes the deprecation story for the in-tree serialization
library. The compiler will now emit a warning whenever it encounters
`deriving(Encodable)` or `deriving(Decodable)`, and the library itself is now
marked `#[unstable]` for when feature staging is enabled.

All users of serialization can migrate to the `rustc-serialize` crate on
crates.io which provides the exact same interface as the libserialize library
in-tree. The new deriving modes are named `RustcEncodable` and `RustcDecodable`
and require `extern crate "rustc-serialize" as rustc_serialize` at the crate
root in order to expand correctly.

To migrate all crates, add the following to your `Cargo.toml`:

    [dependencies]
    rustc-serialize = "0.1.1"

And then add the following to your crate root:

    extern crate "rustc-serialize" as rustc_serialize;

Finally, rename `Encodable` and `Decodable` deriving modes to `RustcEncodable`
and `RustcDecodable`.

[breaking-change]
2014-12-22 00:14:56 -08:00
Corey Farwell 98af642f5c Remove a ton of public reexports
Remove most of the public reexports mentioned in #19253

These are all leftovers from the enum namespacing transition

In particular:

* src/libstd/num/strconv.rs
 * ExponentFormat
 * SignificantDigits
 * SignFormat
* src/libstd/path/windows.rs
 * PathPrefix
* src/libstd/sys/windows/timer.rs
 * Req
* src/libcollections/str.rs
 * MaybeOwned
* src/libstd/collections/hash/map.rs
 * Entry
* src/libstd/collections/hash/table.rs
 * BucketState
* src/libstd/dynamic_lib.rs
 * Rtld
* src/libstd/io/net/ip.rs
 * IpAddr
* src/libstd/os.rs
 * MemoryMapKind
 * MapOption
 * MapError
* src/libstd/sys/common/net.rs
 * SocketStatus
 * InAddr
* src/libstd/sys/unix/timer.rs
 * Req

[breaking-change]
2014-12-21 09:26:41 -08:00
bors f8f2c7a953 auto merge of #19900 : alexcrichton/rust/compiler-flags, r=cmr
This commit shuffles around some CLI flags of the compiler to some more stable
locations with some renamings. The changes made were:

* The `-v` flag has been repurposes as the "verbose" flag. The version flag has
  been renamed to `-V`.
* The `-h` screen has been split into two parts. Most top-level options (not
  all) show with `-h`, and the remaining options (generally obscure) can be
  shown with `--help -v` which is a "verbose help screen"
* The `-V` flag (version flag now) has lost its argument as it is now requested
  with `rustc -vV` "verbose version".
* The `--emit` option has had its `ir` and `bc` variants renamed to `llvm-ir`
  and `llvm-bc` to emphasize that they are LLVM's IR/bytecode.
* The `--emit` option has grown a new variant, `dep-info`, which subsumes the
  `--dep-info` CLI argument. The `--dep-info` flag is now deprecated.
* The `--parse-only`, `--no-trans`, `--no-analysis`, and `--pretty` flags have
  moved behind the `-Z` family of flags.
* The `--debuginfo` and `--opt-level` flags were moved behind the top-level `-C`
  flag.
* The `--print-file-name` and `--print-crate-name` flags were moved behind one
  global `--print` flag which now accepts one of `crate-name`, `file-names`, or
  `sysroot`. This global `--print` flag is intended to serve as a mechanism for
  learning various metadata about the compiler itself.
* The top-level `--pretty` flag was moved to a number of `-Z` options.

No warnings are currently enabled to allow tools like Cargo to have time to
migrate to the new flags before spraying warnings to all users.

cc https://github.com/rust-lang/rust/issues/19051
2014-12-20 13:52:27 +00:00
Alex Crichton 117984b884 rustc: Start "stabilizing" some flags
This commit shuffles around some CLI flags of the compiler to some more stable
locations with some renamings. The changes made were:

* The `-v` flag has been repurposes as the "verbose" flag. The version flag has
  been renamed to `-V`.
* The `-h` screen has been split into two parts. Most top-level options (not
  all) show with `-h`, and the remaining options (generally obscure) can be
  shown with `--help -v` which is a "verbose help screen"
* The `-V` flag (version flag now) has lost its argument as it is now requested
  with `rustc -vV` "verbose version".
* The `--emit` option has had its `ir` and `bc` variants renamed to `llvm-ir`
  and `llvm-bc` to emphasize that they are LLVM's IR/bytecode.
* The `--emit` option has grown a new variant, `dep-info`, which subsumes the
  `--dep-info` CLI argument. The `--dep-info` flag is now deprecated.
* The `--parse-only`, `--no-trans`, and `--no-analysis` flags have
  moved behind the `-Z` family of flags.
* The `--debuginfo` and `--opt-level` flags were moved behind the top-level `-C`
  flag.
* The `--print-file-name` and `--print-crate-name` flags were moved behind one
  global `--print` flag which now accepts one of `crate-name`, `file-names`, or
  `sysroot`. This global `--print` flag is intended to serve as a mechanism for
  learning various metadata about the compiler itself.

No warnings are currently enabled to allow tools like Cargo to have time to
migrate to the new flags before spraying warnings to all users.
2014-12-19 11:38:24 -08:00
Aaron Turon a27fbac868 Revise std::thread API to join by default
This commit is part of a series that introduces a `std::thread` API to
replace `std::task`.

In the new API, `spawn` returns a `JoinGuard`, which by default will
join the spawned thread when dropped. It can also be used to join
explicitly at any time, returning the thread's result. Alternatively,
the spawned thread can be explicitly detached (so no join takes place).

As part of this change, Rust processes now terminate when the main
thread exits, even if other detached threads are still running, moving
Rust closer to standard threading models. This new behavior may break code
that was relying on the previously implicit join-all.

In addition to the above, the new thread API also offers some built-in
support for building blocking abstractions in user space; see the module
doc for details.

Closes #18000

[breaking-change]
2014-12-18 23:31:52 -08:00
Aaron Turon 43ae4b3301 Fallout from new thread API 2014-12-18 23:31:51 -08:00
Alexis Beingessner 67d3823fc3 enumset fallout 2014-12-18 16:20:32 -05:00
Patrick Walton ddb2466f6a librustc: Always parse `macro!()`/`macro![]` as expressions if not
followed by a semicolon.

This allows code like `vec![1i, 2, 3].len();` to work.

This breaks code that uses macros as statements without putting
semicolons after them, such as:

    fn main() {
        ...
        assert!(a == b)
        assert!(c == d)
        println(...);
    }

It also breaks code that uses macros as items without semicolons:

    local_data_key!(foo)

    fn main() {
        println("hello world")
    }

Add semicolons to fix this code. Those two examples can be fixed as
follows:

    fn main() {
        ...
        assert!(a == b);
        assert!(c == d);
        println(...);
    }

    local_data_key!(foo);

    fn main() {
        println("hello world")
    }

RFC #378.

Closes #18635.

[breaking-change]
2014-12-18 12:09:07 -05:00
Niko Matsakis 5c3d398919 Mostly rote conversion of `proc()` to `move||` (and occasionally `Thunk::new`) 2014-12-14 04:21:56 -05:00
Jorge Aparicio e792338318 librustdoc: use tuple indexing 2014-12-13 20:04:41 -05:00
Jorge Aparicio 4d4915aa28 librustdoc: fix fallout 2014-12-13 17:03:45 -05:00
Alex Crichton 52edb2ecc9 Register new snapshots 2014-12-11 11:30:38 -08:00
Jorge Aparicio e6bd217ce8 librustdoc: remove unnecessary `as_slice()` calls 2014-12-06 19:05:58 -05:00
Corey Richardson 7f8f4abc55 rollup merge of #19422: scialex/fix-fmt-macro-doc
these are missing standard #![doc(...)]. add them
2014-12-05 10:06:55 -08:00
Niko Matsakis 61edb0ccb7 Separate the driver into its own crate that uses trans, typeck. 2014-12-04 10:04:52 -05:00
Alexander Light e621116b86 make fmt_macros and rustdoc have standard doc attributes 2014-12-03 12:49:59 -05:00
Jorge Aparicio 09707d70a4 Fix fallout 2014-12-03 10:41:48 -05:00
bors 66601647cd auto merge of #19343 : sfackler/rust/less-special-attrs, r=alexcrichton
Descriptions and licenses are handled by Cargo now, so there's no reason
to keep these attributes around.
2014-11-27 06:41:17 +00:00
Alex Crichton 60541cdc1e Test fixes and rebase conflicts 2014-11-26 16:50:13 -08:00
Steven Fackler 348cc9418a Remove special casing for some meta attributes
Descriptions and licenses are handled by Cargo now, so there's no reason
to keep these attributes around.
2014-11-26 11:44:45 -08:00
Tom Jakubowski dd4c7c00d8 rustdoc: Render associated types on traits and impls 2014-11-24 05:23:10 -08:00
Alex Crichton a9c1152c4b std: Add a new top-level thread_local module
This commit removes the `std::local_data` module in favor of a new
`std::thread_local` module providing thread local storage. The module provides
two variants of TLS: one which owns its contents and one which is based on
scoped references. Each implementation has pros and cons listed in the
documentation.

Both flavors have accessors through a function called `with` which yield a
reference to a closure provided. Both flavors also panic if a reference cannot
be yielded and provide a function to test whether an access would panic or not.
This is an implementation of [RFC 461][rfc] and full details can be found in
that RFC.

This is a breaking change due to the removal of the `std::local_data` module.
All users can migrate to the new thread local system like so:

    thread_local!(static FOO: Rc<RefCell<Option<T>>> = Rc::new(RefCell::new(None)))

The old `local_data` module inherently contained the `Rc<RefCell<Option<T>>>` as
an implementation detail which must now be explicitly stated by users.

[rfc]: https://github.com/rust-lang/rfcs/pull/461
[breaking-change]
2014-11-23 23:37:16 -08:00
bors 2a4c0100fe auto merge of #19122 : Kintaro/rust/remove_struct_variant, r=jakub-
The struct_variant is not gated anymore. This commit just removes it and the resulting warnings when compiling rust. Now compiles with the snapshot from 11/18 (as opposed to PR #19014)
2014-11-22 04:06:45 +00:00
Alexander Light 26107f6181 rustdoc: Allow private modules be included in docs
Made it so that what passes are used is passed onto the renderer so it
can intelligently deal with private modules.
2014-11-20 17:02:58 -05:00
Simon Wollwage 4a83726517 removed usage of struct_variant feature as it is no longer gated 2014-11-20 00:21:32 +01:00
Alex Crichton 4af3494bb0 std: Stabilize std::fmt
This commit applies the stabilization of std::fmt as outlined in [RFC 380][rfc].
There are a number of breaking changes as a part of this commit which will need
to be handled to migrated old code:

* A number of formatting traits have been removed: String, Bool, Char, Unsigned,
  Signed, and Float. It is recommended to instead use Show wherever possible or
  to use adaptor structs to implement other methods of formatting.

* The format specifier for Boolean has changed from `t` to `b`.

* The enum `FormatError` has been renamed to `Error` as well as becoming a unit
  struct instead of an enum. The `WriteError` variant no longer exists.

* The `format_args_method!` macro has been removed with no replacement. Alter
  code to use the `format_args!` macro instead.

* The public fields of a `Formatter` have become read-only with no replacement.
  Use a new formatting string to alter the formatting flags in combination with
  the `write!` macro. The fields can be accessed through accessor methods on the
  `Formatter` structure.

Other than these breaking changes, the contents of std::fmt should now also all
contain stability markers. Most of them are still #[unstable] or #[experimental]

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0380-stabilize-std-fmt.md
[breaking-change]

Closes #18904
2014-11-18 21:16:22 -08:00
bors 618bd5d1c5 auto merge of #19070 : nikomatsakis/rust/crates, r=nikomatsakis
Reduces memory usage significantly and opens opportunities for more parallel compilation.

This PR was previously #19002 but I closed it because bors didn't seem to recognize the `r+` annotations there.
2014-11-18 15:26:43 +00:00
Niko Matsakis dc6e414e6f Move trans, back, driver, and back into a new crate, rustc_trans. Reduces memory usage significantly and opens opportunities for more parallel compilation. 2014-11-18 07:32:43 -05:00
Daniel Micay 85c2c2e38c implement Writer for Vec<u8>
The trait has an obvious, sensible implementation directly on vectors so
the MemWriter wrapper is unnecessary. This will halt the trend towards
providing all of the vector methods on MemWriter along with eliminating
the noise caused by conversions between the two types. It also provides
the useful default Writer methods on Vec<u8>.

After the type is removed and code has been migrated, it would make
sense to add a new implementation of MemWriter with seeking support. The
simple use cases can be covered with vectors alone, and ones with the
need for seeks can use a new MemWriter implementation.
2014-11-18 01:09:46 -05:00
Alex Crichton fcd05ed99f time: Deprecate the library in the distribution
This commit deprecates the entire libtime library in favor of the
externally-provided libtime in the rust-lang organization. Users of the
`libtime` crate as-is today should add this to their Cargo manifests:

    [dependencies.time]
    git = "https://github.com/rust-lang/time"

To implement this transition, a new function `Duration::span` was added to the
`std::time::Duration` time. This function takes a closure and then returns the
duration of time it took that closure to execute. This interface will likely
improve with `FnOnce` unboxed closures as moving in and out will be a little
easier.

Due to the deprecation of the in-tree crate, this is a:

[breaking-change]

cc #18855, some of the conversions in the `src/test/bench` area may have been a
little nicer with that implemented
2014-11-12 09:18:35 -08:00
Aaron Turon 5f09a50e8f rustdoc: revise method counts in stability summary
Previously, the stability summary page attempted to associate impl
blocks with the module in which they were defined, rather than the
module defining the type they apply to (which is usually, but not
always, the same). Unfortunately, due to the basic architecture of
rustdoc, this meant that impls from re-exports were not being counted.

This commit makes the stability summary work the same way that rustdoc's
rendered output does: all methods are counted alongside the type they
apply to, no matter where the methods are defined.

In addition, for trait impl blocks only the stability of the overall
block is counted; the stability of the methods within is not
counted (since that stability level is part of the trait definition).

Fixes #18812
2014-11-10 15:36:03 -08:00
Alexis Beingessner eec145be3f Fallout from collection conventions 2014-11-06 12:26:08 -05:00
Alexis Beingessner 112c8a966f refactor libcollections as part of collection reform
* Moves multi-collection files into their own directory, and splits them into seperate files
* Changes exports so that each collection has its own module
* Adds underscores to public modules and filenames to match standard naming conventions

(that is, treemap::{TreeMap, TreeSet} => tree_map::TreeMap, tree_set::TreeSet)

* Renames PriorityQueue to BinaryHeap
* Renames SmallIntMap to VecMap
* Miscellanious fallout fixes

[breaking-change]
2014-11-02 18:58:11 -05:00
Steve Klabnik 7828c3dd28 Rename fail! to panic!
https://github.com/rust-lang/rfcs/pull/221

The current terminology of "task failure" often causes problems when
writing or speaking about code. You often want to talk about the
possibility of an operation that returns a Result "failing", but cannot
because of the ambiguity with task failure. Instead, you have to speak
of "the failing case" or "when the operation does not succeed" or other
circumlocutions.

Likewise, we use a "Failure" header in rustdoc to describe when
operations may fail the task, but it would often be helpful to separate
out a section describing the "Err-producing" case.

We have been steadily moving away from task failure and toward Result as
an error-handling mechanism, so we should optimize our terminology
accordingly: Result-producing functions should be easy to describe.

To update your code, rename any call to `fail!` to `panic!` instead.
Assuming you have not created your own macro named `panic!`, this
will work on UNIX based systems:

    grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g'

You can of course also do this by hand.

[breaking-change]
2014-10-29 11:43:07 -04:00
Luqman Aden 322aedd462 librustdoc: Remove all uses of {:?}. 2014-10-16 11:15:35 -04:00
Luqman Aden 38aca17c47 Remove libdebug and update tests. 2014-10-16 11:15:34 -04:00
Nick Cameron 2d3823441f Put slicing syntax behind a feature gate.
[breaking-change]

If you are using slicing syntax you will need to add #![feature(slicing_syntax)] to your crate.
2014-10-07 15:49:53 +13:00
Alex Crichton 7ae802f57b rollup merge of #17666 : eddyb/take-garbage-out
Conflicts:
	src/libcollections/lib.rs
	src/libcore/lib.rs
	src/librustdoc/lib.rs
	src/librustrt/lib.rs
	src/libserialize/lib.rs
	src/libstd/lib.rs
	src/test/run-pass/issue-8898.rs
2014-10-02 14:53:18 -07:00
Aaron Turon 7bf56df4c8 Revert "Put slicing syntax behind a feature gate."
This reverts commit 95cfc35607.
2014-10-02 11:47:51 -07:00
Eduard Burtescu db55e70c97 syntax: mark the managed_boxes feature as Removed. 2014-10-02 17:02:03 +03:00
Nick Cameron 95cfc35607 Put slicing syntax behind a feature gate.
[breaking-change]

If you are using slicing syntax you will need to add #![feature(slicing_syntax)] to your crate.
2014-10-02 13:23:36 +13:00
Brian Anderson 2acd6b7741 Remove windows TCB hack from rustdoc 2014-09-26 10:17:04 -07:00
Alexis Beingessner fe8a413fc0 handling fallout from entry api 2014-09-24 21:53:58 -04:00
Aaron Turon fc525eeb4e Fallout from renaming 2014-09-16 14:37:48 -07:00
Eduard Burtescu 8bfbcddf53 rustdoc: fix fallout from the addition of a 'tcx lifetime on tcx. 2014-09-08 15:28:25 +03:00
inrustwetrust 61414a9850 Changed addl_lib_search_paths from HashSet to Vec
This makes the extra library paths given to the gcc linker come in
the same order as the -L options on the rustc command line.
2014-09-07 11:42:02 +02:00
wickerwaka 2cb210d2c6 Updated to new extern crate syntax.
Added warning for old deprecated syntax
2014-09-01 09:02:00 -07:00
Aaron Turon 276b8b125d Fallout from stabilizing core::option 2014-08-28 09:12:54 -07:00
Brian Anderson bc450b17e3 core: Change the argument order on splitn and rsplitn for strs.
This makes it consistent with the same functions for slices,
and allows the search closure to be specified last.

[breaking-change]
2014-08-13 15:27:37 -07:00
Alex Crichton d9038fc3b3 rustdoc: Set a nonzero exit status on failure
Now that rustdoc is spawning a child task, the program won't exit with a default
error code if the main task fails (because it never fails). This commit forces
the main task to wait for a child task in order to correctly propagate failure.

Closes #16341
2014-08-07 20:19:18 -07:00
Alex Crichton cb8bd83888 rustdoc: Run all work in a separate task
There's a good long comment explaining why. The tl;dr; is that I have no idea
why this is necessary, but it gets --test to work on windows which is something,
right?

cc #13259
cc #16275
cc rust-lang/cargo#302
2014-08-05 20:20:54 -07:00
Alex Crichton 4dbe3eb657 rustdoc: Use --crate-name with --test
This ensures that the name of the crate is set from the command line for tests
so the auto-injection of `extern crate <name>` in doc tests works correctly.
2014-07-31 23:01:24 -07:00
Alex Crichton 51355478f4 rustdoc: Add a --target flag
Closes #13893
2014-07-25 07:55:25 -07:00
Alex Crichton 237738fa3e rustdoc: Add a --crate-name option
Like rustc, this is required by cargo to build documentation.
2014-07-24 07:26:26 -07:00
Aaron Turon 31ac8a90f1 rustdoc: make table of contents optional
rustdoc currently determines whether to produce a table of
contents (along with numbered sections) from the input type: yes for
markdown input, no for Rust input. This commit adds a flag to disable
the table of contents for markdown input, which is useful for embedding
the output in a larger context.
2014-07-24 07:26:17 -07:00
Brian Anderson 9db1d35687 collections: Deprecate shift/unshift
Use insert/remove instead.
2014-07-23 13:20:16 -07:00
Mike Robinson 6d3a623cc8 Fix rustdoc --passes list
Allow "rustdoc --passes list" to work without specifying input files,
as shown in the examples section of the man page.
2014-07-21 23:37:04 +01:00
Tom Jakubowski ec70f2bb6e rustdoc: Add an --extern flag analagous to rustc's
This adds an `--extern` flag to `rustdoc` much like the compiler's to
specify the path where a given crate can be found.
2014-07-21 09:54:29 -07:00
Nick Cameron aa760a849e deprecate Vec::get 2014-07-17 12:08:31 +12:00
Adolfo Ochagavía 584fbde5d1 Fix errors 2014-07-15 20:34:16 +02:00
Adolfo Ochagavía 211f1caa29 Deprecate `str::from_utf8_owned`
Use `String::from_utf8` instead

[breaking-change]
2014-07-15 19:55:17 +02:00
Aaron Turon 4d16de01d0 rustdoc: Add stability dashboard
This commit adds a crate-level dashboard summarizing the stability
levels of all items for all submodules of the crate.

The information is also written as a json file, intended for consumption
by pages like http://huonw.github.io/isrustfastyet/

Closes #13541
2014-07-10 20:51:35 -07:00
Alex Crichton 0c71e0c596 Register new snapshots
Closes #15544
2014-07-09 10:57:58 -07:00
Richo Healey 12c334a77b std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.
[breaking-change]
2014-07-08 13:01:43 -07:00
Alex Crichton 50ee1ec1b4 rustc: Remove CrateId and all related support
This commit removes all support in the compiler for the #[crate_id] attribute
and all of its derivative infrastructure. A list of the functionality removed is:

* The #[crate_id] attribute no longer exists
* There is no longer the concept of a version of a crate
* Version numbers are no longer appended to symbol names
* The --crate-id command line option has been removed

To migrate forward, rename #[crate_id] to #[crate_name] and only the name of the
crate itself should be mentioned. The version/path of the old crate id should be
removed.

For a transitionary state, the #[crate_id] attribute is still accepted if
the #[crate_name] is not present, but it is warned about if it is the only
identifier present.

RFC: 0035-remove-crate-id
[breaking-change]
2014-07-05 12:38:42 -07:00
Alex Crichton ff1dd44b40 Merge remote-tracking branch 'origin/master' into 0.11.0-release
Conflicts:
	src/libstd/lib.rs
2014-07-02 11:08:21 -07:00
Adolfo Ochagavía 035914edcf Fix issues in librustdoc 2014-06-30 21:35:49 +02:00
zzmp 63afc08262 Allow external html in rustdoc for crates.
Updated documentation to reflect md->html.
Modularized external file loading.
2014-06-30 00:03:34 -07:00
Alex Crichton aa1163b92d Update to 0.11.0 2014-06-27 12:50:16 -07:00
Piotr Jawniak f8e06c4965 Remove unnecessary to_string calls
This commit removes superfluous to_string calls from various places
2014-06-26 08:56:49 +02:00
Robert Buonpastore d6a4c431f4 Stabilize version output for rustc and rustdoc 2014-06-24 17:24:34 -07:00
Brian Anderson 77657baf2c Mark all crates except std as experimental 2014-06-17 22:13:36 -07:00
Alex Crichton f20b1293fc Register new snapshots 2014-06-14 10:28:09 -07:00
Huon Wilson 0642cbbde0 getopts: format failure messages with `Show`.
This obsoletes the old `to_err_msg` method. Replace

    println!("Error: {}", failure.to_err_msg())

    let string = failure.to_err_msg();

with

    println!("Error: {}", failure)

    let string = failure.to_str();

[breaking-change]
2014-06-14 11:11:09 +10:00
bors f9260d41d6 auto merge of #14746 : alexcrichton/rust/libsync, r=brson
This commit is the final step in the libstd facade, #13851. The purpose of this
commit is to move libsync underneath the standard library, behind the facade.
This will allow core primitives like channels, queues, and atomics to all live
in the same location.

There were a few notable changes and a few breaking changes as part of this
movement:

* The `Vec` and `String` types are reexported at the top level of libcollections
* The `unreachable!()` macro was copied to libcore
* The `std::rt::thread` module was moved to librustrt, but it is still
  reexported at the same location.
* The `std::comm` module was moved to libsync
* The `sync::comm` module was moved under `sync::comm`, and renamed to `duplex`.
  It is now a private module with types/functions being reexported under
  `sync::comm`. This is a breaking change for any existing users of duplex
  streams.
* All concurrent queues/deques were moved directly under libsync. They are also
  all marked with #![experimental] for now if they are public.
* The `task_pool` and `future` modules no longer live in libsync, but rather
  live under `std::sync`. They will forever live at this location, but they may
  move to libsync if the `std::task` module moves as well.

[breaking-change]
2014-06-11 11:47:04 -07:00
Alex Crichton b1c9ce9c6f sync: Move underneath libstd
This commit is the final step in the libstd facade, #13851. The purpose of this
commit is to move libsync underneath the standard library, behind the facade.
This will allow core primitives like channels, queues, and atomics to all live
in the same location.

There were a few notable changes and a few breaking changes as part of this
movement:

* The `Vec` and `String` types are reexported at the top level of libcollections
* The `unreachable!()` macro was copied to libcore
* The `std::rt::thread` module was moved to librustrt, but it is still
  reexported at the same location.
* The `std::comm` module was moved to libsync
* The `sync::comm` module was moved under `sync::comm`, and renamed to `duplex`.
  It is now a private module with types/functions being reexported under
  `sync::comm`. This is a breaking change for any existing users of duplex
  streams.
* All concurrent queues/deques were moved directly under libsync. They are also
  all marked with #![experimental] for now if they are public.
* The `task_pool` and `future` modules no longer live in libsync, but rather
  live under `std::sync`. They will forever live at this location, but they may
  move to libsync if the `std::task` module moves as well.

[breaking-change]
2014-06-11 10:00:43 -07:00
Alex Crichton 54c2a1e1ce rustc: Move the AST from @T to Gc<T> 2014-06-11 09:51:37 -07:00
Keegan McAllister ffb2f12ed8 Use phase(plugin) in bootstrap crates
Do this to avoid warnings on post-stage0 builds.
2014-06-09 14:29:30 -07:00
Alex Crichton e5bbbca33e rustdoc: Submit examples to play.rust-lang.org
This grows a new option inside of rustdoc to add the ability to submit examples
to an external website. If the `--markdown-playground-url` command line option
or crate doc attribute `html_playground_url` is present, then examples will have
a button on hover to submit the code to the playground specified.

This commit enables submission of example code to play.rust-lang.org. The code
submitted is that which is tested by rustdoc, not necessarily the exact code
shown in the example.

Closes #14654
2014-06-06 20:00:16 -07:00
bors 732e057815 auto merge of #14667 : aochagavia/rust/pr2, r=huonw 2014-06-06 01:21:54 -07:00
Adolfo Ochagavía 501b904bb7 Change to_str().to_string() to just to_str() 2014-06-06 09:56:59 +02:00
Alex Crichton 760b93adc0 Fallout from the libcollections movement 2014-06-05 13:55:11 -07:00
Alex Crichton 42aed6bde2 std: Remove format_strbuf!()
This was only ever a transitionary macro.
2014-05-28 08:35:41 -07:00
Alex Crichton b53454e2e4 Move std::{reflect,repr,Poly} to a libdebug crate
This commit moves reflection (as well as the {:?} format modifier) to a new
libdebug crate, all of which is marked experimental.

This is a breaking change because it now requires the debug crate to be
explicitly linked if the :? format qualifier is used. This means that any code
using this feature will have to add `extern crate debug;` to the top of the
crate. Any code relying on reflection will also need to do this.

Closes #12019

[breaking-change]
2014-05-27 21:44:51 -07:00
Richo Healey 1f1b2e42d7 std: Rename strbuf operations to string
[breaking-change]
2014-05-27 12:59:31 -07:00
Richo Healey 553074506e core: rename strbuf::StrBuf to string::String
[breaking-change]
2014-05-24 21:48:10 -07:00
Patrick Walton 36195eb91f libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`. 2014-05-22 14:42:01 -07:00
Felix S. Klock II eb6856c307 Fixing rustdoc stage1.
See #13983 and #14000.

Fix was originally authored by alexcrichton and then rebased a couple
times by pnkfelix, most recently atop PR 13954.

----

Regarding the change to librustdoc/lib.rs, to do `map_err` before
unwrapping a `TqskResult`: I do not understand how master is passing
without this change or something like it, since `Box<Any:Send>` does
not implement `Show`.  (Is this something that is only a problem for
the snapshot stage0 compiler?)  Still, the change I have put in here
(which was added as part of a rebase after alex's review) seems
harmless to me to apply to rustdoc at all stages, since a call to
`unwrap` is just going to `fail!` on the err case anyway.
2014-05-18 22:56:19 +02:00
Patrick Walton 1fb08f11b7 libgetopts: Remove all uses of `~str` from `libgetopts` 2014-05-16 11:41:27 -07:00
Patrick Walton 28bcef85e4 libserialize: Remove all uses of `~str` from `libserialize`.
Had to make `struct Tm` in `libtime` not serializable for now.
2014-05-16 11:41:27 -07:00
Brian Anderson 67fa90e48a Print 'rustc' and 'rustdoc' as the command name for --version
Instead of just blindly printing arg[0], use a constant string.
Partial fix for #13582
2014-05-14 15:34:14 -07:00
Brian Anderson c1da4f875f Add the patch number to version strings. Closes #13289 2014-05-12 19:52:29 -07:00
Patrick Walton 9ba91e1243 librustdoc: Remove all `~str` usage from librustdoc. 2014-05-12 17:57:26 -07:00
Nick Cameron 37ca36783c Reorganise driver code.
The goal of this refactoring is to make the rustc driver code easier to understand and use. Since this is as close to an API as we have, I think it is important that it is nice. On getting stuck in, I found that there wasn't as much to change as I'd hoped to make the stage... fns easier to use by tools.

This patch only moves code around - mostly just moving code to different files, but a few extracted method refactorings too. To summarise the changes: I added driver::config which handles everything about configuring the compiler. driver::session now just defines and builds session objects. I moved driver code from librustc/lib.rs to librustc/driver/mod.rs so all the code is one place. I extracted methods to make emulating the compiler without being the compiler a little easier. Within the driver directory, I moved code around to more logically fit in the modules.
2014-05-11 11:08:01 +12:00
Kevin Ballard 752048a271 Handle more fallout
os::args() no longer auto-borrows to &[~str].
2014-05-08 12:06:22 -07:00
Alex Crichton ab92ea526d std: Modernize the local_data api
This commit brings the local_data api up to modern rust standards with a few key
improvements:

* The `pop` and `set` methods have been combined into one method, `replace`

* The `get_mut` method has been removed. All interior mutability should be done
  through `RefCell`.

* All functionality is now exposed as a method on the keys themselves. Instead
  of importing std::local_data, you now use "key.replace()" and "key.get()".

* All closures have been removed in favor of RAII functionality. This means that
  get() and get_mut() no long require closures, but rather return
  Option<SmartPointer> where the smart pointer takes care of relinquishing the
  borrow and also implements the necessary Deref traits

* The modify() function was removed to cut the local_data interface down to its
  bare essentials (similarly to how RefCell removed set/get).

[breaking-change]
2014-05-07 23:43:39 -07:00
Brian Anderson a5be12ce7e Replace most ~exprs with 'box'. #11779 2014-05-02 23:00:58 -07:00
Jonathan S 03609e5a5e Deprecate the rev_iter pattern in all places where a DoubleEndedIterator is provided (everywhere but treemap)
This commit deprecates rev_iter, mut_rev_iter, move_rev_iter everywhere (except treemap) and also
deprecates related functions like rsplit, rev_components, and rev_str_components. In every case,
these functions can be replaced with the non-reversed form followed by a call to .rev(). To make this
more concrete, a translation table for all functional changes necessary follows:

* container.rev_iter() -> container.iter().rev()
* container.mut_rev_iter() -> container.mut_iter().rev()
* container.move_rev_iter() -> container.move_iter().rev()
* sliceorstr.rsplit(sep) -> sliceorstr.split(sep).rev()
* path.rev_components() -> path.components().rev()
* path.rev_str_components() -> path.str_components().rev()

In terms of the type system, this change also deprecates any specialized reversed iterator types (except
in treemap), opting instead to use Rev directly if any type annotations are needed. However, since
methods directly returning reversed iterators are now discouraged, the need for such annotations should
be small. However, in those cases, the general pattern for conversion is to take whatever follows Rev in
the original reversed name and surround it with Rev<>:

* RevComponents<'a> -> Rev<Components<'a>>
* RevStrComponents<'a> -> Rev<StrComponents<'a>>
* RevItems<'a, T> -> Rev<Items<'a, T>>
* etc.

The reasoning behind this change is that it makes the standard API much simpler without reducing readability,
performance, or power. The presence of functions such as rev_iter adds more boilerplate code to libraries
(all of which simply call .iter().rev()), clutters up the documentation, and only helps code by saving two
characters. Additionally, the numerous type synonyms that were used to make the type signatures look nice
like RevItems add even more boilerplate and clutter up the docs even more. With this change, all that cruft
goes away.

[breaking-change]
2014-04-28 16:45:36 -05:00
Kang Seonghoon bec77eb9c5 rustdoc: Moved `SCHEMA_VERSION` to `clean`.
it should be changed when the module gets updated, so it helps to
have the `SCHEMA_VERSION` with the definitions themselves.
2014-04-26 22:45:50 +09:00
Richo Healey 919889a1d6 Replace all ~"" with "".to_owned() 2014-04-18 17:25:34 -07:00
Kang Seonghoon f1de04c760 rustdoc: Represent item types as a small number in the search index.
Has negligible improvements with gzip, but saves about 7% without it.
This also has an effect of changing the tie-breaking order of item types.
2014-04-14 10:00:48 +09:00
bors e4779b5050 auto merge of #13165 : sfackler/rust/io-vec, r=alexcrichton
`Reader`, `Writer`, `MemReader`, `MemWriter`, and `MultiWriter` now work with `Vec<u8>` instead of `~[u8]`. This does introduce some extra copies since `from_utf8_owned` isn't usable anymore, but I think that can't be helped until `~str`'s representation changes.
2014-04-06 23:36:38 -07:00
Steven Fackler 49a8081095 De-~[] Mem{Reader,Writer} 2014-04-06 15:40:01 -07:00
Corey Richardson 0459ee77d0 Fix fallout from std::libc separation 2014-04-04 09:31:44 -07:00
bors 540c2a2a27 auto merge of #13255 : alexcrichton/rust/issue-5605, r=huonw
These syntax extensions need a place to be documented, and this starts passing a
`--cfg dox` parameter to `rustdoc` when building and testing documentation in
order to document macros so that they have no effect on the compiled crate, but
only documentation.

Closes #5605
2014-04-04 01:01:51 -07:00
Brian Anderson 0875ffcbff Bump version to 0.11-pre
This also changes some of the download links in the documentation
to 'nightly'.
2014-04-03 16:28:46 -07:00
Alex Crichton 78937b9779 std: Document builtin syntax extensions
These syntax extensions need a place to be documented, and this starts passing a
`--cfg dox` parameter to `rustdoc` when building and testing documentation in
order to document macros so that they have no effect on the compiled crate, but
only documentation.

Closes #5605
2014-04-03 16:17:48 -07:00
Alex Crichton a5681d2590 Bump version to 0.10 2014-03-31 14:40:44 -07:00
bors df9cf18c10 auto merge of #13188 : FlaPer87/rust/master, r=alexcrichton 2014-03-29 02:56:40 -07:00
Flavio Percoco a9c6061c9a Register new snapshot 2014-03-29 01:12:32 +01:00
Brian Anderson 451e8c1c61 Convert most code to new inner attribute syntax.
Closes #2569
2014-03-28 17:12:21 -07:00
Sean McArthur f1739b14a1 serialize: use Result
All of Decoder and Encoder's methods now return a Result.

Encodable.encode() and Decodable.decode() return a Result as well.

fixes #12292
2014-03-27 17:41:55 -07:00
Patrick Walton af79a5aa7d test: Make manual changes to deal with the fallout from removal of
`~[T]` in test, libgetopts, compiletest, librustdoc, and libnum.
2014-03-21 23:37:21 +11:00
Alex Crichton da3625161d Removing imports of std::vec_ng::Vec
It's now in the prelude.
2014-03-20 09:30:14 -07:00
Alex Crichton 848f7b734e rustdoc: Implement cross-crate searching
A major discoverability issue with rustdoc is that all crates have their
documentation built in isolation, so it's difficult when looking at the
documentation for libstd to learn that there's a libcollections crate with a
HashMap in it.

This commit moves rustdoc a little closer to improving the multiple crate
experience. This unifies all search indexes for all crates into one file so all
pages share the same search index. This allows searching to work across crates
in the same documentation directory (as the standard distribution is currently
built).

This strategy involves updating a shared file amongst many rustdoc processes, so
I implemented a simple file locking API for handling synchronization for updates
to the shared files.

cc #12554
2014-03-18 13:51:29 -07:00
Eduard Burtescu e2ebc8f811 Fix rustdoc and tests. 2014-03-17 09:55:41 +02:00
Eduard Burtescu f77c744142 De-@ filesearch. 2014-03-17 09:53:07 +02:00
Alex Crichton cc6ec8df95 log: Introduce liblog, the old std::logging
This commit moves all logging out of the standard library into an external
crate. This crate is the new crate which is responsible for all logging macros
and logging implementation. A few reasons for this change are:

* The crate map has always been a bit of a code smell among rust programs. It
  has difficulty being loaded on almost all platforms, and it's used almost
  exclusively for logging and only logging. Removing the crate map is one of the
  end goals of this movement.

* The compiler has a fair bit of special support for logging. It has the
  __log_level() expression as well as generating a global word per module
  specifying the log level. This is unfairly favoring the built-in logging
  system, and is much better done purely in libraries instead of the compiler
  itself.

* Initialization of logging is much easier to do if there is no reliance on a
  magical crate map being available to set module log levels.

* If the logging library can be written outside of the standard library, there's
  no reason that it shouldn't be. It's likely that we're not going to build the
  highest quality logging library of all time, so third-party libraries should
  be able to provide just as high-quality logging systems as the default one
  provided in the rust distribution.

With a migration such as this, the change does not come for free. There are some
subtle changes in the behavior of liblog vs the previous logging macros:

* The core change of this migration is that there is no longer a physical
  log-level per module. This concept is still emulated (it is quite useful), but
  there is now only a global log level, not a local one. This global log level
  is a reflection of the maximum of all log levels specified. The previously
  generated logging code looked like:

    if specified_level <= __module_log_level() {
        println!(...)
    }

  The newly generated code looks like:

    if specified_level <= ::log::LOG_LEVEL {
        if ::log::module_enabled(module_path!()) {
            println!(...)
        }
    }

  Notably, the first layer of checking is still intended to be "super fast" in
  that it's just a load of a global word and a compare. The second layer of
  checking is executed to determine if the current module does indeed have
  logging turned on.

  This means that if any module has a debug log level turned on, all modules
  with debug log levels get a little bit slower (they all do more expensive
  dynamic checks to determine if they're turned on or not).

  Semantically, this migration brings no change in this respect, but
  runtime-wise, this will have a perf impact on some code.

* A `RUST_LOG=::help` directive will no longer print out a list of all modules
  that can be logged. This is because the crate map will no longer specify the
  log levels of all modules, so the list of modules is not known. Additionally,
  warnings can no longer be provided if a malformed logging directive was
  supplied.

The new "hello world" for logging looks like:

    #[phase(syntax, link)]
    extern crate log;

    fn main() {
        debug!("Hello, world!");
    }
2014-03-15 22:26:36 -07:00
Alex Crichton 58e4ab2b33 extra: Put the nail in the coffin, delete libextra
This commit shreds all remnants of libextra from the compiler and standard
distribution. Two modules, c_vec/tempfile, were moved into libstd after some
cleanup, and the other modules were moved to separate crates as seen fit.

Closes #8784
Closes #12413
Closes #12576
2014-03-14 13:59:02 -07:00
Huon Wilson 62792f09f2 lint: add lint for use of a `~[T]`.
This is useless at the moment (since pretty much every crate uses
`~[]`), but should help avoid regressions once completely removed from a
crate.
2014-03-14 11:28:39 +11:00
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
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
Marvin Löbel 24b316a3b9 Removed unneccessary `_iter` suffixes from various APIs 2013-11-26 10:02:26 +01:00
Corey Richardson 6fbe2a0c8b rustdoc: pass through --cfg to rustc
Closes #10623
2013-11-24 23:33:44 -05:00
Alex Crichton 49ee49296b Move std::rt::io to std::io 2013-11-11 20:44:07 -08:00
Andrei Formiga 455de85163 Specify package_id for rust libs, to avoid spurious warnings 2013-11-08 17:42:46 -03: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