summary refs log tree commit diff
path: root/src/librustdoc/test.rs
AgeCommit message (Collapse)AuthorLines
2014-09-16Fallout from renamingAaron Turon-2/+2
2014-09-14rustdoc: fix fallout from using ptr::P.Eduard Burtescu-6/+6
2014-09-08rustdoc: fix fallout from the addition of a 'tcx lifetime on tcx.Eduard Burtescu-4/+3
2014-09-07Changed addl_lib_search_paths from HashSet to Vecinrustwetrust-4/+4
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-06auto merge of #16907 : SimonSapin/rust/tempdir-result, r=huonwbors-1/+1
This allows using `try!()` [breaking-change] Fixes #16875
2014-09-05move back::link::write into a separate fileStuart Pernsteiner-2/+2
2014-08-31Have std::io::TempDir::new and new_in return IoResultSimon Sapin-1/+1
This allows using `try!()` [breaking-change] Fixes #16875
2014-07-31rustdoc: Use --crate-name with --testAlex Crichton-2/+7
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-23collections: Deprecate shift/unshiftBrian Anderson-1/+1
Use insert/remove instead.
2014-07-21rustdoc: Add an --extern flag analagous to rustc'sTom Jakubowski-4/+11
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-21rustc: Pass optional additional plugins to compile_inputBrian Anderson-2/+2
This provides a way for clients of the rustc library to add their own features to the pipeline.
2014-07-10auto merge of #15336 : jakub-/rust/diagnostics, r=brsonbors-2/+2
This is a continuation of @brson's work from https://github.com/rust-lang/rust/pull/12144. This implements the minimal scaffolding that allows mapping diagnostic messages to alpha-numeric codes, which could improve the searchability of errors. In addition, there's a new compiler option, `--explain {code}` which takes an error code and prints out a somewhat detailed explanation of the error. Example: ```rust fn f(x: Option<bool>) { match x { Some(true) | Some(false) => (), None => (), Some(true) => () } } ``` ```shell [~/rust]$ ./build/x86_64-apple-darwin/stage2/bin/rustc ./diagnostics.rs --crate-type dylib diagnostics.rs:5:3: 5:13 error: unreachable pattern [E0001] (pass `--explain E0001` to see a detailed explanation) diagnostics.rs:5 Some(true) => () ^~~~~~~~~~ error: aborting due to previous error [~/rust]$ ./build/x86_64-apple-darwin/stage2/bin/rustc --explain E0001 This error suggests that the expression arm corresponding to the noted pattern will never be reached as for all possible values of the expression being matched, one of the preceeding patterns will match. This means that perhaps some of the preceeding patterns are too general, this one is too specific or the ordering is incorrect. ``` I've refrained from migrating many errors to actually use the new macros as it can be done in an incremental fashion but if we're happy with the approach, it'd be good to do all of them sooner rather than later. Originally, I was going to make libdiagnostics a separate crate but that's posing some interesting challenges with semi-circular dependencies. In particular, librustc would have a plugin-phase dependency on libdiagnostics, which itself depends on librustc. Per my conversation with @alexcrichton, it seems like the snapshotting process would also have to change. So for now the relevant modules from libdiagnostics are included using `#[path = ...] mod`.
2014-07-11Add scaffolding for assigning alpha-numeric codes to rustc diagnosticsJakub Wieczorek-2/+2
2014-07-10io::process::Command: add fine-grained env builderAaron Turon-17/+6
This commit changes the `io::process::Command` API to provide fine-grained control over the environment: * The `env` method now inserts/updates a key/value pair. * The `env_remove` method removes a key from the environment. * The old `env` method, which sets the entire environment in one shot, is renamed to `env_set_all`. It can be used in conjunction with the finer-grained methods. This renaming is a breaking change. To support these new methods, the internal `env` representation for `Command` has been changed to an optional `HashMap` holding owned `CString`s (to support non-utf8 data). The `HashMap` is only materialized if the environment is updated. The implementation does not try hard to avoid allocation, since the cost of launching a process will dwarf any allocation cost. This patch also adds `PartialOrd`, `Eq`, and `Hash` implementations for `CString`. [breaking-change]
2014-07-05rustc: Remove CrateId and all related supportAlex Crichton-1/+1
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-06-28librustc: Match trait self types exactly.Patrick Walton-1/+8
This can break code that looked like: impl Foo for Box<Any> { fn f(&self) { ... } } let x: Box<Any + Send> = ...; x.f(); Change such code to: impl Foo for Box<Any> { fn f(&self) { ... } } let x: Box<Any> = ...; x.f(); That is, upcast before calling methods. This is a conservative solution to #5781. A more proper treatment (see the xfail'd `trait-contravariant-self.rs`) would take variance into account. This change fixes the soundness hole. Some library changes had to be made to make this work. In particular, `Box<Any>` is no longer showable, and only `Box<Any+Send>` is showable. Eventually, this restriction can be lifted; for now, it does not prove too onerous, because `Any` is only used for propagating the result of task failure. This patch also adds a test for the variance inference work in #12828, which accidentally landed as part of DST. Closes #5781. [breaking-change]
2014-06-24Store the registered lints in the SessionKeegan McAllister-1/+2
2014-06-20auto merge of #15039 : huonw/rust/rustdoc-testharnesss, r=alexcrichtonbors-6/+11
```test_harness #[test] fn foo() {} ``` will now compile and run the tests, rather than just ignoring & stripping them (i.e. it is as if `--test` was passed). Also, the specific example in https://github.com/rust-lang/rust/issues/12242 was fixed (but that issue is broader than that example).
2014-06-19rustdoc: add the ability to run tests with --test.Huon Wilson-6/+11
This adds the `test_harness` directive that runs a code block using the test runner, to allow for `#[test]` items to be demonstrated and still tested (currently they are just stripped and not even compiled, let alone run).
2014-06-18rustdoc: Don't inject `extern crate std`.Alex Crichton-1/+3
No need to duplicate the compiler's work! Closes #14999
2014-06-18rustdoc: Fix testing indented code blocksAlex Crichton-1/+1
The collapse/unindent passes were run in the wrong order, generating different markdown for indented tests.
2014-06-15Register new snapshotsAlex Crichton-1/+1
2014-06-14rustc: Obsolete the `@` syntax entirelyAlex Crichton-2/+3
This removes all remnants of `@` pointers from rustc. Additionally, this removes the `GC` structure from the prelude as it seems odd exporting an experimental type in the prelude by default. Closes #14193 [breaking-change]
2014-06-11rustc: Move the AST from @T to Gc<T>Alex Crichton-3/+3
2014-06-09std: Move dynamic_lib from std::unstable to stdBrian Anderson-1/+1
This leaves a deprecated reexport in place temporarily. Closes #1457.
2014-06-09Implement #[plugin_registrar]Keegan McAllister-2/+1
See RFC 22. [breaking-change]
2014-06-07Remove the attribute_usage lintSteven Fackler-1/+1
It has been superseded by the unused_attribute lint. [breaking change]
2014-06-06rustdoc: Submit examples to play.rust-lang.orgAlex Crichton-8/+16
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-06doc: Turn off special features for rustdoc testsAlex Crichton-18/+5
These were only used for the markdown tests, and there's no reason they should be distinct from the other tests.
2014-06-05Fallout from the libcollections movementAlex Crichton-1/+1
2014-05-31rustdoc: Suck in all impls from external cratesAlex Crichton-0/+1
There is currently no way to query all impls for a type from an external crate, and with primitive types in play this is also quite difficult. Instead of filtering, just suck in all impls from upstream crates into the local AST, and have them get stripped later. This will allow population of all implementations of traits for primitive types, as well as filling in some corner cases with inlining documentation in other cases.
2014-05-28std: Remove format_strbuf!()Alex Crichton-2/+2
This was only ever a transitionary macro.
2014-05-27rustdoc: Only link to local inlined foreign itemsAlex Crichton-0/+1
This commit alters rustdoc to keep a hash set of known inlined items which is a whitelist for generating URLs to. Closes #14438
2014-05-27std: Rename strbuf operations to stringRicho Healey-4/+4
[breaking-change]
2014-05-27std: Remove String's to_ownedRicho Healey-3/+3
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-12/+12
[breaking-change]
2014-05-22libcore: Remove all uses of `~str` from `libcore`.Patrick Walton-2/+2
[breaking-change]
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-1/+2
2014-05-22rustdoc: Fill in external trait methodsAlex Crichton-0/+2
This commit alters rustdoc to crawl the metadata of upstream libraries in order to fill in default methods for traits implemented in downstream crates. This, for example, documents the `insert` function on hash maps. This is a fairly lossy extraction from the metadata. Documentation and attributes are lost, but they aren't used anyway. Unfortunately, argument names are also lost because they are not present in the metadata. Source links are also lost because the spans are not serialized. While not perfect, it appears that presenting this documentation through rustdoc is much better than nothing, so I wanted to land this to allow iteration on it later on.
2014-05-18Fixing rustdoc stage1.Felix S. Klock II-1/+27
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-15auto merge of #14040 : hannobraun/rust/force-color-output, r=alexcrichtonbors-1/+1
This pull request fixes #12881. Two caveats: 1. As explained in the commit message, this doesn't include a regression test. If this is unacceptable, please let me know, I'll see what I can do. 1. I'm getting some test failures on make check, all from debuginfo. I suspect this is due to #13680 and not related to my changes (I have GDB 7.7). This is the list of failed tests: > [debuginfo-gdb] debuginfo/basic-types-globals.rs > [debuginfo-gdb] debuginfo/basic-types-mut-globals.rs > [debuginfo-gdb] debuginfo/basic-types.rs > [debuginfo-gdb] debuginfo/borrowed-basic.rs > [debuginfo-gdb] debuginfo/borrowed-managed-basic.rs > [debuginfo-gdb] debuginfo/borrowed-struct.rs > [debuginfo-gdb] debuginfo/borrowed-unique-basic.rs > [debuginfo-gdb] debuginfo/box.rs > [debuginfo-gdb] debuginfo/by-value-non-immediate-argument.rs > [debuginfo-gdb] debuginfo/by-value-self-argument-in-trait-impl.rs > [debuginfo-gdb] debuginfo/closure-in-generic-function.rs > [debuginfo-gdb] debuginfo/evec-in-struct.rs > [debuginfo-gdb] debuginfo/function-arg-initialization.rs > [debuginfo-gdb] debuginfo/function-prologue-stepping-no-split-stack.rs > [debuginfo-gdb] debuginfo/generic-function.rs > [debuginfo-gdb] debuginfo/generic-functions-nested.rs > [debuginfo-gdb] debuginfo/generic-method-on-generic-struct.rs > [debuginfo-gdb] debuginfo/generic-static-method-on-struct-and-enum.rs > [debuginfo-gdb] debuginfo/generic-struct.rs > [debuginfo-gdb] debuginfo/lexical-scope-in-stack-closure.rs > [debuginfo-gdb] debuginfo/lexical-scope-in-unique-closure.rs > [debuginfo-gdb] debuginfo/method-on-generic-struct.rs > [debuginfo-gdb] debuginfo/method-on-tuple-struct.rs > [debuginfo-gdb] debuginfo/name-shadowing-and-scope-nesting.rs > [debuginfo-gdb] debuginfo/recursive-struct.rs > [debuginfo-gdb] debuginfo/self-in-generic-default-method.rs > [debuginfo-gdb] debuginfo/shadowed-argument.rs > [debuginfo-gdb] debuginfo/shadowed-variable.rs > [debuginfo-gdb] debuginfo/simd.rs > [debuginfo-gdb] debuginfo/simple-lexical-scope.rs > [debuginfo-gdb] debuginfo/simple-struct.rs > [debuginfo-gdb] debuginfo/simple-tuple.rs > [debuginfo-gdb] debuginfo/static-method-on-struct-and-enum.rs > [debuginfo-gdb] debuginfo/tuple-struct.rs > [debuginfo-gdb] debuginfo/var-captured-in-nested-closure.rs > [debuginfo-gdb] debuginfo/var-captured-in-sendable-closure.rs > [debuginfo-gdb] debuginfo/var-captured-in-stack-closure.rs I can provide the full output on request.
2014-05-15Add compiler flag to configure output coloringHanno Braun-1/+1
This adds the flag --color, which allows the user to force coloring or turn it off. The default behavior stays the same as before (colorize, if output goes to tty). Why this is beneficial is explained in issue #12881. Please note that this commit doesn't include any regression tests. I thought about how I'd write a test for this and it doesn't seem to be worth the effort to me for a UI change like this. Fixes #12881.
2014-05-14Process::new etc should support non-utf8 commands/argsAaron Turon-4/+2
The existing APIs for spawning processes took strings for the command and arguments, but the underlying system may not impose utf8 encoding, so this is overly limiting. The assumption we actually want to make is just that the command and arguments are viewable as [u8] slices with no interior NULLs, i.e., as CStrings. The ToCStr trait is a handy bound for types that meet this requirement (such as &str and Path). However, since the commands and arguments are often a mixture of strings and paths, it would be inconvenient to take a slice with a single T: ToCStr bound. So this patch revamps the process creation API to instead use a builder-style interface, called `Command`, allowing arguments to be added one at a time with differing ToCStr implementations for each. The initial cut of the builder API has some drawbacks that can be addressed once issue #13851 (libstd as a facade) is closed. These are detailed as FIXMEs. Closes #11650. [breaking-change]
2014-05-14libtest: Remove all uses of `~str` from `libtest`.Patrick Walton-6/+3
2014-05-12librustdoc: Remove all `~str` usage from librustdoc.Patrick Walton-16/+24
2014-05-12librustc: Remove all uses of `~str` from librustc.Patrick Walton-1/+1
2014-05-11Reorganise driver code.Nick Cameron-12/+13
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-09rustdoc: Hyperlink cross-crate reexportsAlex Crichton-1/+2
This should improve the libcore experience quite a bit when looking at the libstd documentation.
2014-05-07std: Modernize the local_data apiAlex Crichton-2/+1
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-07auto merge of #13958 : pcwalton/rust/detilde, r=pcwaltonbors-3/+6
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. r? @brson or @alexcrichton or whoever