about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2015-01-20std: Rename Show/String to Debug/DisplayAlex Crichton-131/+131
This commit is an implementation of [RFC 565][rfc] which is a stabilization of the `std::fmt` module and the implementations of various formatting traits. Specifically, the following changes were performed: [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0565-show-string-guidelines.md * The `Show` trait is now deprecated, it was renamed to `Debug` * The `String` trait is now deprecated, it was renamed to `Display` * Many `Debug` and `Display` implementations were audited in accordance with the RFC and audited implementations now have the `#[stable]` attribute * Integers and floats no longer print a suffix * Smart pointers no longer print details that they are a smart pointer * Paths with `Debug` are now quoted and escape characters * The `unwrap` methods on `Result` now require `Display` instead of `Debug` * The `Error` trait no longer has a `detail` method and now requires that `Display` must be implemented. With the loss of `String`, this has moved into libcore. * `impl<E: Error> FromError<E> for Box<Error>` now exists * `derive(Show)` has been renamed to `derive(Debug)`. This is not currently warned about due to warnings being emitted on stage1+ While backwards compatibility is attempted to be maintained with a blanket implementation of `Display` for the old `String` trait (and the same for `Show`/`Debug`) this is still a breaking change due to primitives no longer implementing `String` as well as modifications such as `unwrap` and the `Error` trait. Most code is fairly straightforward to update with a rename or tweaks of method calls. [breaking-change] Closes #21436
2015-01-21Rollup merge of #21424 - sanxiyn:coerce-mut, r=nikomatsakisBarosl LEE-4/+29
This is caught in borrowck now, but catching in typeck is faster and improves diagnostics. CC #17561. r? @nikomatsakis
2015-01-21Rollup merge of #21404 - japaric:hash, r=alexcrichtonBarosl LEE-0/+18
closes #21402 cc #15294 r? @alexcrichton or @aturon cc @ExpHP (btw, this only covers arrays with arity up to 32)
2015-01-21Rollup merge of #21386 - Diggsey:issue-21384, r=alexcrichtonBarosl LEE-0/+27
Fixes #21384
2015-01-20Forbid coercing &T to &mut TSeo Sanghyeon-4/+29
2015-01-20Auto merge of #21364 - cmr:fix-ttseq-ice, r=alexcrichtonbors-0/+17
Closes #21350
2015-01-20Auto merge of #21304 - lifthrasiir:htmldocck, r=alexcrichtonbors-98/+34
The script is intended as a tool for doing every sort of verifications amenable to Rustdoc's HTML output. For example, link checkers would go to this script. It already parses HTML into a document tree form (with a slight caveat), so future tests can make use of it. As an example, relevant `rustdoc-*` run-make tests have been updated to use `htmldocck.py` and got their `verify.sh` removed. In the future they may go to a dedicated directory with htmldocck running by default. The detailed explanation of test scripts is provided as a docstring of htmldocck. cc #19723
2015-01-20Auto merge of #21257 - alexcrichton:issue-20064, r=pnkfelixbors-9/+53
These two attributes are used to change the entry point into a Rust program, but for now they're being put behind feature gates until we have a chance to think about them a little more. The #[start] attribute specifically may have its signature changed. This is a breaking change to due the usage of these attributes generating errors by default now. If your crate is using these attributes, add this to your crate root: #![feature(start)] // if you're using the #[start] attribute #![feature(main)] // if you're using the #[main] attribute cc #20064
2015-01-19Auto merge of #21165 - alexcrichton:second-pass-type-id, r=aturonbors-51/+46
This commit aims to stabilize the `TypeId` abstraction by moving it out of the `intrinsics` module into the `any` module of the standard library. Specifically, * `TypeId` is now defined at `std::any::TypeId` * `TypeId::hash` has been removed in favor of an implementation of `Hash`. This commit also performs a final pass over the `any` module, confirming the following: * `Any::get_type_id` remains unstable as *usage* of the `Any` trait will likely never require this, and the `Any` trait does not need to be implemented for any other types. As a result, this implementation detail can remain unstable until associated statics are implemented. * `Any::downcast_ref` is now stable * `Any::downcast_mut` is now stable * `BoxAny` remains unstable. While a direct impl on `Box<Any>` is allowed today it does not allow downcasting of trait objects like `Box<Any + Send>` (those returned from `Thread::join`). This is covered by #18737. * `BoxAny::downcast` is now stable.
2015-01-19impl Hash for arraysJorge Aparicio-0/+18
closes #21402 cc #15294
2015-01-19Auto merge of #21278 - thchittenden:issue-21033-struct-var-pattern-fix, ↵bors-1/+53
r=alexcrichton Closes #21033. The new strategy for parsing a field pattern is to look 1 token ahead and if it's a colon, parse as "fieldname: pat", otherwise parse the shorthand form "(box) (ref) (mut) fieldname)". The previous strategy was to parse "(ref) (mut) fieldname" then if we encounter a colon, throw an error if either "ref" or "mut" were encountered.
2015-01-19Fixes #21033 with accompanying test.Tom Chittenden-1/+53
2015-01-19Auto merge of #21269 - alexcrichton:issue-6936, r=pnkfelixbors-0/+44
This commit modifies resolve to prevent conflicts with typedef names in the same method that conflits are prevented with enum names. This is a breaking change due to the differing semantics in resolve, and any errors generated on behalf of this change require that a conflicting typedef, module, or structure to be renamed so they do not conflict. [breaking-change] Closes #6936
2015-01-19Auto merge of #21282 - Aatch:init-memzero, r=alexcrichtonbors-0/+25
LLVM gets overwhelmed when presented with a zeroinitializer for a large type. In unoptimised builds, it generates a long sequence of stores to memory. In optmised builds, it manages to generate a standard memset of zero values, but takes a long time doing so. Call out to the `llvm.memset` function to zero out the memory instead. Fixes #21264
2015-01-19Auto merge of #21099 - sanxiyn:opt-return-ty, r=alexcrichtonbors-0/+17
This avoids having ast::Ty nodes which have no counterpart in the source.
2015-01-19Ranges implement Clone where possibleDiggory Blake-0/+27
2015-01-18std: Stabilize TypeId and tweak BoxAnyAlex Crichton-51/+46
This commit aims to stabilize the `TypeId` abstraction by moving it out of the `intrinsics` module into the `any` module of the standard library. Specifically, * `TypeId` is now defined at `std::any::TypeId` * `TypeId::hash` has been removed in favor of an implementation of `Hash`. This commit also performs a final pass over the `any` module, confirming the following: * `Any::get_type_id` remains unstable as *usage* of the `Any` trait will likely never require this, and the `Any` trait does not need to be implemented for any other types. As a result, this implementation detail can remain unstable until associated statics are implemented. * `Any::downcast_ref` is now stable * `Any::downcast_mut` is now stable * `BoxAny` remains unstable. While a direct impl on `Box<Any>` is allowed today it does not allow downcasting of trait objects like `Box<Any + Send>` (those returned from `Thread::join`). This is covered by #18737. * `BoxAny::downcast` is now stable.
2015-01-18rustc_resolve: Do not allow mods to shadow typesAlex Crichton-0/+44
This commit modifies resolve to prevent conflicts with typedef names in the same method that conflits are prevented with enum names. This is a breaking change due to the differing semantics in resolve, and any errors generated on behalf of this change require that a conflicting typedef, module, or structure to be renamed so they do not conflict. [breaking-change] Closes #6936
2015-01-19Reduce size of array in test case to 1MBJames Miller-1/+1
2015-01-19Add test to catch performance regressionsJames Miller-0/+25
2015-01-18syntax: allow bare sequences in lhs for follow checkingCorey Richardson-0/+17
Closes #21350
2015-01-18Make output type in ast::FnDecl optionalSeo Sanghyeon-0/+17
2015-01-18auto merge of #20901 : dgrunwald/rust/update-token-can-begin-expr, r=sanxiynbors-0/+3
* add `Token::AndAnd` (double borrow) * add `Token::DotDot` (range notation) * remove `Token::Pound` and `Token::At` This fixes a syntax error when parsing `fn f() -> RangeTo<i32> { return ..1; }`. Also, remove `fn_expr_lookahead`. It's from the `fn~` days and seems to no longer be necessary.
2015-01-18auto merge of #21276 : huonw/rust/trait-suggestion-nits, r=nikomatsakisbors-7/+7
Follow up to #21008. r? @nikomatsakis
2015-01-17Add allow(unstable) to more testsBrian Anderson-0/+3
2015-01-17Add allow(unstable) to tests that need itBrian Anderson-0/+11
2015-01-17Register new snapshots.Eduard Burtescu-6/+6
2015-01-18tests: Tidy and allows multi-line htmldocck commands.Kang Seonghoon-4/+8
2015-01-18tests: Add htmldocck.py script for the use of Rustdoc tests.Kang Seonghoon-98/+30
The script is intended as a tool for doing every sort of verifications amenable to Rustdoc's HTML output. For example, link checkers would go to this script. It already parses HTML into a document tree form (with a slight caveat), so future tests can make use of it. As an example, relevant `rustdoc-*` run-make tests have been updated to use `htmldocck.py` and got their `verify.sh` removed. In the future they may go to a dedicated directory with htmldocck running by default. The detailed explanation of test scripts is provided as a docstring of htmldocck. cc #19723
2015-01-17Update syntax of ignored test.Steve Klabnik-1/+1
2015-01-17auto merge of #21233 : huonw/rust/simd-size, r=Aatchbors-0/+140
This stops the compiler ICEing on the use of SIMD types in FFI signatures. It emits correct code for LLVM intrinsics, but I am quite unsure about the ABI handling in general so I've added a new feature gate `simd_ffi` to try to ensure people don't use it without realising there's a non-trivial risk of codegen brokenness. Closes #20043.
2015-01-17auto merge of #21205 : alexcrichton/rust/issue-21202, r=nikomatsakisbors-0/+41
Loading methods from external crates was erroneously using the type's privacy for each method instead of each method's privacy. This commit fixes that. Closes #21202 This commit also moves privacy to its own crate because I thought that was where the bug was. Turns out it wasn't, but it helped me iterate at least!
2015-01-17Address nits in trait suggestions.Huon Wilson-7/+7
2015-01-17Feature gate SIMD in FFI, due to unknown ABIs.Huon Wilson-1/+27
I don't know if this handling of SIMD types is correct for the C ABI on all platforms, so lets add an even finer feature gate than just the `simd` one. The `simd` one can be used with (relatively) little risk of complete nonsense, the reason for it is that it is likely that things will change. Using the types in FFI with an incorrect ABI will at best give absolute nonsense results, but possibly cause serious breakage too, so this is a step up in badness, hence a new feature gate.
2015-01-17Add comprehensive test for no-ICE behaviour of SIMD FFI.Huon Wilson-0/+114
This just compiles a test using SIMD in FFI (mostly importing LLVM intrinsics) for almost all rustc's supported platforms, but not linking it or running it, so there's absolutely no guarantee that this is correct.
2015-01-16syntax: Feature gate #[start] and #[main]Alex Crichton-9/+53
These two attributes are used to change the entry point into a Rust program, but for now they're being put behind feature gates until we have a chance to think about them a little more. The #[start] attribute specifically may have its signature changed. This is a breaking change to due the usage of these attributes generating errors by default now. If your crate is using these attributes, add this to your crate root: #![feature(start)] // if you're using the #[start] attribute #![feature(main)] // if you're using the #[main] attribute cc #20064
2015-01-16auto merge of #21008 : huonw/rust/trait-suggestions, r=nikomatsakisbors-0/+105
For a call like `foo.bar()` where the method `bar` can't be resolved, the compiler will search for traits that have methods with name `bar` to give a more informative error, providing a list of possibilities. Closes #7643.
2015-01-16auto merge of #21113 : alexcrichton/rust/plug-a-hole, r=brsonbors-9/+55
With the addition of separate search paths to the compiler, it was intended that applications such as Cargo could require a `--extern` flag per `extern crate` directive in the source. The system can currently be subverted, however, due to the `existing_match()` logic in the crate loader. When loading crates we first attempt to match an `extern crate` directive against all previously loaded crates to avoid reading metadata twice. This "hit the cache if possible" step was erroneously leaking crates across the search path boundaries, however. For example: extern crate b; extern crate a; If `b` depends on `a`, then it will load crate `a` when the `extern crate b` directive is being processed. When the compiler reaches `extern crate a` it will use the previously loaded version no matter what. If the compiler was not invoked with `-L crate=path/to/a`, it will still succeed. This behavior is allowing `extern crate` declarations in Cargo without a corresponding declaration in the manifest of a dependency, which is considered a bug. This commit fixes this problem by keeping track of the origin search path for a crate. Crates loaded from the dependency search path are not candidates for crates which are loaded from the crate search path.
2015-01-16rustc: Fix a leak in dependency= pathsAlex Crichton-9/+55
With the addition of separate search paths to the compiler, it was intended that applications such as Cargo could require a `--extern` flag per `extern crate` directive in the source. The system can currently be subverted, however, due to the `existing_match()` logic in the crate loader. When loading crates we first attempt to match an `extern crate` directive against all previously loaded crates to avoid reading metadata twice. This "hit the cache if possible" step was erroneously leaking crates across the search path boundaries, however. For example: extern crate b; extern crate a; If `b` depends on `a`, then it will load crate `a` when the `extern crate b` directive is being processed. When the compiler reaches `extern crate a` it will use the previously loaded version no matter what. If the compiler was not invoked with `-L crate=path/to/a`, it will still succeed. This behavior is allowing `extern crate` declarations in Cargo without a corresponding declaration in the manifest of a dependency, which is considered a bug. This commit fixes this problem by keeping track of the origin search path for a crate. Crates loaded from the dependency search path are not candidates for crates which are loaded from the crate search path. As a result of this fix, this is a likely a breaking change for a number of Cargo packages. If the compiler starts informing that a crate can no longer be found, it likely means that the dependency was forgotten in your Cargo.toml. [breaking-change]
2015-01-16rustc_resolve: Correctly record privacy of methodsAlex Crichton-0/+41
Loading methods from external crates was erroneously using the type's privacy for each method instead of each method's privacy. This commit fixes that. Closes #21202
2015-01-16auto merge of #21162 : apasel422/rust/issue-16530, r=huonwbors-0/+18
This fixes #16530 by hashing nullary structs [the same way as the empty tuple] (https://github.com/rust-lang/rust/blob/master/src/libcore/hash/mod.rs#L185). Other approaches are possible, but this was the simplest.
2015-01-16Prefer implemented traits in suggestions.Huon Wilson-7/+44
If `a.method();` can't be resolved, we first look for implemented traits globally and suggest those. If there are no such traits found, we only then fall back to suggesting from the unfiltered list of traits.
2015-01-16fix pretty test falloutFlavio Percoco-6/+2
2015-01-16fix latest changes falloutFlavio Percoco-2/+0
2015-01-16addressed commentsFlavio Percoco-48/+39
2015-01-16Allow negative impls just for Send and SyncFlavio Percoco-0/+20
2015-01-16Don't use NoSend/NoSync in testsFlavio Percoco-41/+59
2015-01-16Fix coherence for negative implementationsFlavio Percoco-0/+20
2015-01-16add a run-pass test that used to failFlavio Percoco-0/+29
2015-01-16Check for negative impls for `Send` and `Sync`Flavio Percoco-20/+38