Commit Graph

99 Commits

Author SHA1 Message Date
Alex Crichton 8ed728babb core: Inherit the any module 2014-05-07 08:13:56 -07:00
Alex Crichton 7192452545 core: Inherit the char module 2014-05-07 08:13:24 -07:00
Alex Crichton d9708539af core: Inherit the container module 2014-05-07 08:13:24 -07:00
Alex Crichton 2ad98fbb27 core: Inherit the ty module 2014-05-07 08:13:24 -07:00
Alex Crichton ead6e16a60 core: Inherit the ops module 2014-05-07 08:13:06 -07:00
Alex Crichton ec8a805b6d core: Inherit the kinds module 2014-05-07 08:13:06 -07:00
Alex Crichton 28624661c3 core: Inherit the cast module 2014-05-07 08:13:06 -07:00
Alex Crichton 645b157564 core: Inherit the ptr module 2014-05-07 08:13:06 -07:00
Alex Crichton dca8a0d6e4 core: Inherit the mem module 2014-05-07 08:12:48 -07:00
Alex Crichton 5b75e44fb0 core: Inherit the intrinsics module 2014-05-07 08:12:48 -07:00
Patrick Walton 090040bf40 librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, except
for `~str`/`~[]`.

Note that `~self` still remains, since I forgot to add support for
`Box<self>` before the snapshot.

How to update your code:

* Instead of `~EXPR`, you should write `box EXPR`.

* Instead of `~TYPE`, you should write `Box<Type>`.

* Instead of `~PATTERN`, you should write `box PATTERN`.

[breaking-change]
2014-05-06 23:12:54 -07:00
Brendan Zabarauskas 464e375d2f Move bitflags module to libstd
This will allow us to provide type-safe APIs in libstd that are C-compatible.
2014-04-30 10:01:14 -07:00
bors 95f2c4bcc3 auto merge of #13772 : brson/rust/cratedocs, r=alexcrichton
Also move prelude explanation to the prelude module.

This tries to provide a guide to what's in the standard library, organized bottom up from primitives to I/O.
2014-04-29 14:26:49 -07:00
Brian Anderson 3525bd8959 std: Rewrite crate docs
Also move prelude explanation to the prelude module.
2014-04-27 18:43:56 -07:00
Alex Crichton 568736182b Register new snapshots
These are the first successful snapshots after the LLVM upgrade, built with LLVM
that requires C++11
2014-04-23 14:58:50 -07:00
Daniel Micay dc7d7d2698 add support for quadruple precision floating point
This currently requires linking against a library like libquadmath (or
libgcc), because compiler-rt barely has any support for this and most
hardware does not yet have 128-bit precision floating point. For this
reason, it's currently hidden behind a feature gate.

When compiler-rt is updated to trunk, some tests can be added for
constant evaluation since there will be support for the comparison
operators.

Closes #13381
2014-04-22 20:47:28 -04:00
Patrick Walton d8e45ea7c0 libstd: Implement `StrBuf`, a new string buffer type like `Vec`, and
port all code over to use it.
2014-04-10 22:10:10 +10:00
Alex Crichton c3ea3e439f Register new snapshots 2014-04-08 00:03:11 -07:00
bors f1f50565a1 auto merge of #13315 : alexcrichton/rust/libc, r=alexcrichton,me
Rebasing of #12526 with a very obscure bug fixed on windows.
2014-04-06 02:56:39 -07:00
Alex Crichton d250ec0bdd Register new snapshots 2014-04-04 13:23:08 -07:00
Corey Richardson 308c03501a Remove libc from std
These wrappers are bound to a specific libc, and they don't need to be part of
libstd.
2014-04-04 09:31:21 -07:00
bors 286b62e0da auto merge of #13295 : huonw/rust/gate-concat-idents, r=alexcrichton
rustc: feature-gate `concat_idents!`.

concat_idents! is not as useful as it could be, due to macros only being
allowed in limited places, and hygiene, so lets feature gate it until we
make a decision about it.

cc #13294
2014-04-04 06:07:02 -07:00
Huon Wilson 6c5e1d0925 rustc: feature-gate `concat_idents!`.
concat_idents! is not as useful as it could be, due to macros only being
allowed in limited places, and hygiene, so lets feature gate it until we
make a decision about it.

cc #13294
2014-04-04 20:25:50 +11:00
bors 2a2d0dce87 auto merge of #13296 : brson/rust/0.11-pre, r=alexcrichton
This also changes some of the download links in the documentation
to 'nightly'.
2014-04-03 19:56:45 -07:00
bors e7fe207229 auto merge of #13290 : alexcrichton/rust/rollup, r=alexcrichton
Closes #13285 (rustc: Stop using LLVMGetSectionName)
Closes #13280 (std: override clone_from for Vec.)
Closes #13277 (serialize: add a few missing pubs to base64)
Closes #13275 (Add and remove some ignore-win32 flags)
Closes #13273 (Removed managed boxes from libarena.)
Closes #13270 (Minor copy-editing for the tutorial)
Closes #13267 (fix Option<~ZeroSizeType>)
Closes #13265 (Update emacs mode to support new `#![inner(attribute)]` syntax.)
Closes #13263 (syntax: Remove AbiSet, use one Abi)
2014-04-03 17:17:02 -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
bors bb31cb8d2e auto merge of #13286 : alexcrichton/rust/release, r=brson
Merging the 0.10 release into the master branch.
2014-04-03 13:52:03 -07:00
Huon Wilson f5a4837df0 std: override clone_from for Vec.
A vector can reuse its allocation (and the allocations/resources of any
contained values) when cloning into an already-instantiated vector, so
we might as well do so.
2014-04-03 13:42:32 -07:00
bors 1217cfb9e7 auto merge of #13225 : thestinger/rust/num, r=cmr
The `Float` trait methods will be usable as functions via UFCS, and
we came to a consensus to remove duplicate functions like this a long
time ago.

It does still make sense to keep the duplicate functions when the trait
methods are static, unless the decision to leave out the in-scope trait
name resolution for static methods changes.
2014-04-01 13:26:49 -07:00
Daniel Micay 5e12e1b1a4 remove the cmath module
This is an implementation detail of the `f32` and `f64` modules and it
should not be public. It renames many functions and leaves out any
provided by LLVM intrinsics, so it is not a sensible binding to the C
standard library's math library and will never be a stable target.

This also removes the abuse of link_name so that this can be switched to
using automatically generated definitions in the future. This also
removes the `scalbn` binding as it is equivalent to `ldexp` when
`FLT_RADIX` is 2, which must always be true for Rust.
2014-04-01 06:54:26 -04:00
Alex Crichton 9a3d04ae76 std: Switch field privacy as necessary 2014-03-31 15:17:12 -07:00
Alex Crichton a5681d2590 Bump version to 0.10 2014-03-31 14:40:44 -07:00
Brian Anderson 451e8c1c61 Convert most code to new inner attribute syntax.
Closes #2569
2014-03-28 17:12:21 -07:00
Alex Crichton b19261a749 green: Remove the dependence on the crate map
This is the final nail in the coffin for the crate map. The `start` function for
libgreen now has a new added parameter which is the event loop factory instead
of inferring it from the crate map. The two current valid values for this
parameter are `green::basic::event_loop` and `rustuv::event_loop`.
2014-03-24 11:19:28 -07:00
Flavio Percoco 576e36e674 Register new snapshots 2014-03-23 11:37:31 +01:00
Daniel Micay 31d5ffc5bd make std::managed private
This removes two tests built on `managed::refcount`, but these issues
are well-covered elsewhere for non-managed types.
2014-03-22 22:33:16 -04:00
Alex Crichton ab1dd09d73 rustc: Switch defaults from libgreen to libnative
The compiler will no longer inject libgreen as the default runtime for rust
programs, this commit switches it over to libnative by default. Now that
libnative has baked for some time, it is ready enough to start getting more
serious usage as the default runtime for rustc generated binaries.

We've found that there isn't really a correct decision in choosing a 1:1 or M:N
runtime as a default for all applications, but it seems that a larger number of
programs today would work more reasonable with a native default rather than a
green default.

With this commit come a number of bugfixes:

* The main native task is now named "<main>"
* The main native task has the stack bounds set up properly
* #[no_uv] was renamed to #[no_start]
* The core-run-destroy test was rewritten for both libnative and libgreen and
  one of the tests was modified to be more robust.
* The process-detach test was locked to libgreen because it uses signal handling
2014-03-21 12:03:13 -07:00
Alex Crichton 11ac4df4d2 Register new snapshots 2014-03-20 11:02:26 -07: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
bors 8e285208d5 auto merge of #12686 : FlaPer87/rust/shared, r=nikomatsakis
`Share` implies that all *reachable* content is *threadsafe*.

Threadsafe is defined as "exposing no operation that permits a data race if multiple threads have access to a &T pointer simultaneously". (NB: the type system should guarantee that if you have access to memory via a &T pointer, the only other way to gain access to that memory is through another &T pointer)...

Fixes #11781
cc #12577 

What this PR will do
================

- [x] Add Share kind and
- [x]  Replace usages of Freeze with Share in bounds.
- [x] Add Unsafe<T> #12577
- [x] Forbid taking the address of a immutable static item with `Unsafe<T>` interior

What's left to do in a separate PR (after the snapshot)?
===========================================

- Remove `Freeze` completely
2014-03-20 05:51:48 -07:00
Flavio Percoco 710f13f0ad Add Unsafe<T> type 2014-03-20 10:16:55 +01:00
Daniel Micay 14f656d1a7 rename std::vec_ng -> std::vec
Closes #12771
2014-03-20 04:25:32 -04:00
Daniel Micay ce620320a2 rename std::vec -> std::slice
Closes #12702
2014-03-20 01:30:27 -04: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
Huon Wilson 6fa4bbeed4 std: Move rand to librand.
This functionality is not super-core and so doesn't need to be included
in std. It's possible that std may need rand (it does a little bit now,
for io::test) in which case the functionality required could be moved to
a secret hidden module and reexposed by librand.

Unfortunately, using #[deprecated] here is hard: there's too much to
mock to make it feasible, since we have to ensure that programs still
typecheck to reach the linting phase.
2014-03-12 11:31:05 +11:00
Alex Crichton 699b33d060 rustc: Support various flavors of linkages
It is often convenient to have forms of weak linkage or other various types of
linkage. Sadly, just using these flavors of linkage are not compatible with
Rust's typesystem and how it considers some pointers to be non-null.

As a compromise, this commit adds support for weak linkage to external symbols,
but it requires that this is only placed on extern statics of type `*T`.
Codegen-wise, we get translations like:

    // rust code
    extern {
        #[linkage = "extern_weak"]
        static foo: *i32;
    }

    // generated IR
    @foo = extern_weak global i32
    @_some_internal_symbol = internal global *i32 @foo

All references to the rust value of `foo` then reference `_some_internal_symbol`
instead of the symbol `_foo` itself. This allows us to guarantee that the
address of `foo` will never be null while the value may sometimes be null.

An example was implemented in `std::rt::thread` to determine if
`__pthread_get_minstack()` is available at runtime, and a test is checked in to
use it for a static value as well. Function pointers a little odd because you
still need to transmute the pointer value to a function pointer, but it's
thankfully better than not having this capability at all.
2014-03-11 08:25:42 -07:00
Adrien Tétar 0106a04d70 doc: use the newer favicon 2014-03-04 18:37:51 +01:00
bors 25d68366b7 auto merge of #12522 : erickt/rust/hash, r=alexcrichton
This patch series does a couple things:

* replaces manual `Hash` implementations with `#[deriving(Hash)]`
* adds `Hash` back to `std::prelude`
* minor cleanup of whitespace and variable names.
2014-02-25 06:41:36 -08:00