Commit Graph

56 Commits

Author SHA1 Message Date
Brian Anderson a5be12ce7e Replace most ~exprs with 'box'. #11779 2014-05-02 23:00:58 -07:00
Richo Healey 919889a1d6 Replace all ~"" with "".to_owned() 2014-04-18 17:25:34 -07:00
Alex Crichton 675b82657e Update the rest of the compiler with ~[T] changes 2014-04-18 10:57:10 -07: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
Steven Fackler d0e60b72ee De-~[] Reader and Writer
There's a little more allocation here and there now since
from_utf8_owned can't be used with Vec.
2014-04-06 15:39:56 -07:00
bors e5f1b9f6dc auto merge of #13272 : ipetkov/rust/rustdoc-ignored-tests, r=alexcrichton
librustdoc: instead of skipping ignored tests, pass them to libtest
so it can report them as such.  If a test is marked as `notrust`,
however, it will not show up in the final report.

Fix #12939
2014-04-04 11:56:53 -07:00
Ivan Petkov a0a7693101 rustdoc: Fix reporting of ignored tests
librustdoc: instead of skipping ignored tests, pass them to libtest
so it can report them as such.  If a test is marked as `notrust`,
however, it will not show up in the final report.
2014-04-03 23:07:00 -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 eb08e8fec2 rustdoc: Switch field privacy as necessary 2014-03-31 15:47:36 -07:00
Alex Crichton bb9172d7b5 Fix fallout of removing default bounds
This is all purely fallout of getting the previous commit to compile.
2014-03-27 10:14:50 -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
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
Eduard Burtescu 4fae06824c De-@ Session usage. 2014-03-17 09:53:06 +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
bors b35e8fbfcb auto merge of #12861 : huonw/rust/lint-owned-vecs, r=thestinger
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-13 22:26:35 -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
Alex Crichton 7858065113 std: Rename Chan/Port types and constructor
* Chan<T> => Sender<T>
* Port<T> => Receiver<T>
* Chan::new() => channel()
* constructor returns (Sender, Receiver) instead of (Receiver, Sender)
* local variables named `port` renamed to `rx`
* local variables named `chan` renamed to `tx`

Closes #11765
2014-03-13 13:23:29 -07:00
Huon Wilson 8e90412048 rustdoc: adding some common feature gates when testing a markdown file.
The manual, tutorial and guides need the feature gates quite often,
unfortunately, so this is the low-cost path to migrating to use
rustdoc. This is only activated for pure-Markdown files.

Preferably this would be avoided: #12773
2014-03-09 19:34:40 +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
Steven Fackler 71cab0410f Add an option to not run rustdoc blocks
This is useful for code that would be expensive to run or has some kind
of external dependency (e.g. a database or server).
2014-03-08 19:57:00 -08:00
Patrick Walton 15d9acc46c librustdoc: Fix librustdoc for the `Vec<T>` change. 2014-03-08 21:41:42 +01:00
Alex Crichton 0e1a860789 rustdoc: Capture all output from rustc by default
This helps prevent interleaving of error messages when running rustdoc tests.
This has an interesting bit of shuffling with I/O handles, but other than that
this is just using the APIs laid out in the previous commit.

Closes #12623
2014-02-28 21:17:08 -08:00
Alex Crichton 324547140e syntax: Refactor diagnostics to focus on Writers
This commit alters the diagnostic emission machinery to be focused around a
Writer for emitting errors. This allows it to not hard-code emission of errors
to stderr (useful for other applications).
2014-02-28 11:37:04 -08:00
Felix Crux e3a251a410 Provide a more helpful error for tests that fail due to noexec
The rustdoc tests create and execute a file in a temporary directory. By
default on UNIX-like platforms this is in `/tmp`, which some users mount
with the `noexec` option. In those cases, the tests fail in a mysterious
way. This change adds a note that suggests what the problem might be, if
the error looks like it could have been caused by the `noexec` setup.

Closes #12558
2014-02-27 21:03:41 -08:00
Alex Crichton a9bd447400 Roll std::run into std::io::process
The std::run module is a relic from a standard library long since past, and
there's not much use to having two modules to execute processes with where one
is slightly more convenient. This commit merges the two modules, moving lots of
functionality from std::run into std::io::process and then deleting
std::run.

New things you can find in std::io::process are:

* Process::new() now only takes prog/args
* Process::configure() takes a ProcessConfig
* Process::status() is the same as run::process_status
* Process::output() is the same as run::process_output
* I/O for spawned tasks is now defaulted to captured in pipes instead of ignored
* Process::kill() was added (plus an associated green/native implementation)
* Process::wait_with_output() is the same as the old finish_with_output()
* destroy() is now signal_exit()
* force_destroy() is now signal_kill()

Closes #2625
Closes #10016
2014-02-23 21:51:17 -08:00
Alex Crichton 2a14e084cf Move std::{trie, hashmap} to libcollections
These two containers are indeed collections, so their place is in
libcollections, not in libstd. There will always be a hash map as part of the
standard distribution of Rust, but by moving it out of the standard library it
makes libstd that much more portable to more platforms and environments.

This conveniently also removes the stuttering of 'std::hashmap::HashMap',
although 'collections::HashMap' is only one character shorter.
2014-02-23 00:35:11 -08:00
Liigo Zhuang 53b9d1a324 move extra::test to libtest 2014-02-20 16:03:58 +08:00
Steven Fackler 0658913616 rustdoc: Only inject extern crates if not present 2014-02-18 20:42:29 -08:00
bors 0c62d9d83d auto merge of #12298 : alexcrichton/rust/rustdoc-testing, r=sfackler
It's too easy to forget the `rust` tag to test something.

Closes #11698
2014-02-15 16:36:27 -08:00
Alex Crichton 6667f90292 Update rustdoc testing to test all code blocks
It's too easy to forget the `rust` tag to have a code example tested, and it's
far more common to have testable code than untestable code.

This alters rustdoc to have only two directives, `ignore` and `should_fail`. The
`ignore` directive ignores the code block entirely, and the `should_fail`
directive has been fixed to only fail the test if the code execution fails, not
also compilation.
2014-02-14 23:30:10 -08: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
Seo Sanghyeon d1cbdc6b1b Remove binary field 2014-02-11 01:10:26 +09:00
Alex Crichton 071ee96277 Consolidate codegen-related compiler flags
Move them all behind a new -C switch. This migrates some -Z flags and some
top-level flags behind this -C codegen option.

The -C flag takes values of the form "-C name=value" where the "=value" is
optional for some flags.

Flags affected:

* --llvm-args           => -C llvm-args
* --passes              => -C passes
* --ar                  => -C ar
* --linker              => -C linker
* --link-args           => -C link-args
* --target-cpu          => -C target-cpu
* --target-feature      => -C target-fature
* --android-cross-path  => -C android-cross-path
* --save-temps          => -C save-temps
* --no-rpath            => -C no-rpath
* -Z no-prepopulate     => -C no-prepopulate-passes
* -Z no-vectorize-loops => -C no-vectorize-loops
* -Z no-vectorize-slp   => -C no-vectorize-slp
* -Z soft-float         => -C soft-float
* -Z gen-crate-map      => -C gen-crate-map
* -Z prefer-dynamic     => -C prefer-dynamic
* -Z no-integrated-as   => -C no-integrated-as

As a bonus, this also promotes the -Z extra-debug-info flag to a first class -g
or --debuginfo flag.

* -Z debug-info         => removed
* -Z extra-debug-info   => -g or --debuginfo

Closes #9770
Closes #12000
2014-02-10 00:50:39 -08:00
Eduard Burtescu b2d30b72bf Removed @self and @Trait. 2014-02-07 00:38:33 +02:00
bors c13a929d58 auto merge of #12020 : alexcrichton/rust/output-flags, r=brson
This commit removes the -c, --emit-llvm, -s, --rlib, --dylib, --staticlib,
--lib, and --bin flags from rustc, adding the following flags:

* --emit=[asm,ir,bc,obj,link]
* --crate-type=[dylib,rlib,staticlib,bin,lib]

The -o option has also been redefined to be used for *all* flavors of outputs.
This means that we no longer ignore it for libraries. The --out-dir remains the
same as before.

The new logic for files that rustc emits is as follows:

1. Output types are dictated by the --emit flag. The default value is
   --emit=link, and this option can be passed multiple times and have all options
   stacked on one another.
2. Crate types are dictated by the --crate-type flag and the #[crate_type]
   attribute. The flags can be passed many times and stack with the crate
   attribute.
3. If the -o flag is specified, and only one output type is specified, the
   output will be emitted at this location. If more than one output type is
   specified, then the filename of -o is ignored, and all output goes in the
   directory that -o specifies. The -o option always ignores the --out-dir
   option.
4. If the --out-dir flag is specified, all output goes in this directory.
5. If -o and --out-dir are both not present, all output goes in the directory of
   the crate file.
6. When multiple output types are specified, the filestem of all output is the
   same as the name of the CrateId (derived from a crate attribute or from the
   filestem of the crate file).

Closes #7791
Closes #11056
Closes #11667
2014-02-06 12:41:30 -08:00
Alex Crichton 6e7968b10a Redesign output flags for rustc
This commit removes the -c, --emit-llvm, -s, --rlib, --dylib, --staticlib,
--lib, and --bin flags from rustc, adding the following flags:

* --emit=[asm,ir,bc,obj,link]
* --crate-type=[dylib,rlib,staticlib,bin,lib]

The -o option has also been redefined to be used for *all* flavors of outputs.
This means that we no longer ignore it for libraries. The --out-dir remains the
same as before.

The new logic for files that rustc emits is as follows:

1. Output types are dictated by the --emit flag. The default value is
   --emit=link, and this option can be passed multiple times and have all
   options stacked on one another.
2. Crate types are dictated by the --crate-type flag and the #[crate_type]
   attribute. The flags can be passed many times and stack with the crate
   attribute.
3. If the -o flag is specified, and only one output type is specified, the
   output will be emitted at this location. If more than one output type is
   specified, then the filename of -o is ignored, and all output goes in the
   directory that -o specifies. The -o option always ignores the --out-dir
   option.
4. If the --out-dir flag is specified, all output goes in this directory.
5. If -o and --out-dir are both not present, all output goes in the current
   directory of the process.
6. When multiple output types are specified, the filestem of all output is the
   same as the name of the CrateId (derived from a crate attribute or from the
   filestem of the crate file).

Closes #7791
Closes #11056
Closes #11667
2014-02-06 11:14:13 -08:00
Arcterus 9752c63035 Move getopts out of extra 2014-02-06 10:00:17 -08:00
Seo Sanghyeon b653fa0c4a Avoid cloning ast::CrateConfig 2014-02-06 02:26:00 +09:00
Alex Crichton 6132f7f666 rustdoc: Remove io_error usage 2014-02-03 09:32:34 -08:00
Patrick Walton e68108b3e8 librustc: Stop using `@str` for source. 2014-02-02 01:44:48 +11:00
Michael Woerister 0a03bc073a debuginfo: Fix name attribute for DWARF compile units 2014-01-27 17:56:05 +01:00
Alex Crichton d84c3369f7 Remove no-debug-borrows from the makefiles 2014-01-21 10:02:48 -08:00
klutzy f30a9b3d5b rustc::driver: Capitalize structs and enums
driver::session::crate_metadata is unused; removed.
2014-01-17 13:27:47 +09:00
Steven Fackler 328b47d837 Load macros from external modules 2014-01-16 15:01:48 -08:00
Alex Crichton 3425901d93 Inline reexports in rustdoc
If a reexport comes from a non-public module, then the documentation for the
reexport will be inlined into the module that exports it, but if the reexport is
targeted at a public type (like the prelude), then it is not inlined but rather
hyperlinked.
2014-01-07 18:46:16 -08:00
Eduard Burtescu 3119d18e55 Disowned the Visitor. 2014-01-06 14:00:46 +02:00
Patrick Walton c38456a92f librustdoc: De-`@mut` `librustdoc` 2014-01-03 14:02:00 -08:00