Commit Graph

43994 Commits

Author SHA1 Message Date
Nick Cameron
78c25eabd5 save-analysis: API-ify impls 2015-06-15 08:15:29 +12:00
Nick Cameron
abe5f7b95a save-analysis: move fields to the API 2015-06-15 08:14:50 +12:00
bors
e89bb24cb2 Auto merge of #26071 - petrochenkov:assert1, r=alexcrichton
`assert_eq!` has better diagnostics than `assert!` and is more helpful when something actually breaks, but the diagnostics has it's price - `assert_eq!` generate some formatting code which is slower to compile and possibly run.
[My measurements](https://internals.rust-lang.org/t/assert-a-b-or-assert-eq-a-b/1367/12?u=petrochenkov) show that presence of this formatting code doesn't affect compilation + execution time of the test suite significantly, so `assert_eq!` can be used instead of `assert!` consistently.

(Some tests doesn't reside in src/test, they are not affected by these changes, I'll probably open a separate PR for them later)
2015-06-14 19:42:26 +00:00
bors
cc44423566 Auto merge of #26296 - aidanhs:aphs-fix-musl-make-install, r=alexcrichton
musl only creates rlib files for stdlib linking so we need to ignore the `CFG_LIB_GLOB_` setting, otherwise we an error:
```
$ make --debug VERBOSE=1 dist-tar-bins
[...]
            Successfully remade target file `prepare-target-x86_64-unknown-linux-gnu-host-x86_64-unknown-linux-gnu-2-dir-x86_64-unknown-linux-gnu'.
             File `prepare-target-x86_64-unknown-linux-musl-host-x86_64-unknown-linux-gnu-2-dir-x86_64-unknown-linux-gnu' does not exist.
            Must remake target `prepare-target-x86_64-unknown-linux-musl-host-x86_64-unknown-linux-gnu-2-dir-x86_64-unknown-linux-gnu'.
umask 022 && mkdir -p tmp/dist/rustc-1.2.0-dev-x86_64-unknown-linux-gnu-image/lib/rustlib/x86_64-unknown-linux-musl/lib
umask 022 && mkdir -p tmp/dist/rustc-1.2.0-dev-x86_64-unknown-linux-gnu-image/lib/rustlib/x86_64-unknown-linux-gnu/bin
LIB_NAME="liblibc-d8ace771.rlib"; MATCHES=""; if [ -n "$MATCHES" ]; then echo "warning: one or libraries matching Rust library 'liblibc-*.rlib'" && echo "  (other than '$LIB_NAME' itself) alre
ady present"     && echo "  at destination tmp/dist/rustc-1.2.0-dev-x86_64-unknown-linux-gnu-image/lib/rustlib/x86_64-unknown-linux-musl/lib:"      && echo $MATCHES ; fi
install -m644 `ls -drt1 x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-*.rlib` tmp/dist/rustc-1.2.0-dev-x86_64-unknown-linux-gnu-image/lib/rustlib/x86_64-unk
nown-linux-musl/lib/
LIB_NAME=""; MATCHES=""; if [ -n "$MATCHES" ]; then echo "warning: one or libraries matching Rust library 'libstd-*.so'" && echo "  (other than '$LIB_NAME' itself) already present"     && echo
 "  at destination tmp/dist/rustc-1.2.0-dev-x86_64-unknown-linux-gnu-image/lib/rustlib/x86_64-unknown-linux-musl/lib:"      && echo $MATCHES ; fi
install -m644 `ls -drt1 x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-*.so` tmp/dist/rustc-1.2.0-dev-x86_64-unknown-linux-gnu-image/lib/rustlib/x86_64-unknow
n-linux-musl/lib/
ls: cannot access x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-*.so: No such file or directory
install: missing destination file operand after ‘tmp/dist/rustc-1.2.0-dev-x86_64-unknown-linux-gnu-image/lib/rustlib/x86_64-unknown-linux-musl/lib/’
Try 'install --help' for more information.
make: *** [prepare-target-x86_64-unknown-linux-musl-host-x86_64-unknown-linux-gnu-2-dir-x86_64-unknown-linux-gnu] Error 1
```

`CFG_INSTALL_ONLY_RLIB_` is provided for this reason and fixes `make install` and `make dist`.
2015-06-14 17:18:25 +00:00
Markus Westerlind
34d5b5450c Replaced a comment mentioning a fixed issue
Replaced it with a comment mentioning the rationale for checking the discriminants first.
2015-06-14 18:27:05 +02:00
Aidan Hobson Sayers
5ef250427d musl only uses rlib files for stdlib linking 2015-06-14 16:18:51 +01:00
Mihnea Dobrescu-Balaur
434684bc9e Find type of orphan methods for rustdoc search. 2015-06-14 14:35:44 +03:00
bors
606e4b26c7 Auto merge of #26252 - bluss:relative-paths, r=alexcrichton
mk: Build crates with relative source file paths

The path we pass to rustc will be visible in panic messages and
backtraces: they will be user visible!

Avoid junk in these paths by passing relative paths to rustc.

For most advanced users, `libcore` or `libstd` in the path will be
a clue to the location -- inside our code, not theirs.

Store both the relative path to the source as well as the absolute.
Use the relative path where it matters, compiling the main crates,
instead of changing all of the build process to cope with relative
paths.

Example output after this patch:

```
$ ./testunwrap
thread '<main>' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:362
$ RUST_BACKTRACE=1 ./testunwrap
thread '<main>' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:362
stack backtrace:
   1:     0x7ff59c1e9956 - sys::backtrace::write::h67a542fd2b201576des
                        at ../src/libstd/sys/unix/backtrace.rs:158
   2:     0x7ff59c1ed5b6 - panicking::on_panic::h3d21c41cdd5c12d41Xw
                        at ../src/libstd/panicking.rs:58
   3:     0x7ff59c1e7b6e - rt::unwind::begin_unwind_inner::h9f3a5440cebb8baeLDw
                        at ../src/libstd/rt/unwind/mod.rs:273
   4:     0x7ff59c1e7f84 - rt::unwind::begin_unwind_fmt::h4fe8a903e0c296b0RCw
                        at ../src/libstd/rt/unwind/mod.rs:212
   5:     0x7ff59c1eced7 - rust_begin_unwind
   6:     0x7ff59c22c11a - panicking::panic_fmt::h00b0cd49c98a9220i5B
                        at ../src/libcore/panicking.rs:64
   7:     0x7ff59c22b9e0 - panicking::panic::hf549420c0ee03339P3B
                        at ../src/libcore/panicking.rs:45
   8:     0x7ff59c1e621d - option::Option<T>::unwrap::h501963526474862829
   9:     0x7ff59c1e61b1 - main::hb5c91ce92347d1e6eaa
  10:     0x7ff59c1f1c18 - rust_try_inner
  11:     0x7ff59c1f1c05 - rust_try
  12:     0x7ff59c1ef374 - rt::lang_start::h7e51e19c6677cffe5Sw
                        at ../src/libstd/rt/unwind/mod.rs:147
                        at ../src/libstd/rt/unwind/mod.rs:130
                        at ../src/libstd/rt/mod.rs:128
  13:     0x7ff59c1e628e - main
  14:     0x7ff59b3f6b44 - __libc_start_main
  15:     0x7ff59c1e6078 - <unknown>
  16:                0x0 - <unknown>
```
2015-06-14 11:20:36 +00:00
Michael Sproul
328df8ebf9 diagnostics: Allow long URLs in error explanations. 2015-06-14 18:46:32 +10:00
Sébastien Marie
b804c241b3 inverse the logic in code inclusion
instead of enumerate the (long) list of platforms to exclude, use only
the short list of platforms to include.

should fixes __morestack symbol problem under openbsd
2015-06-14 07:08:10 +02:00
bors
043f93f278 Auto merge of #26285 - rick68:patch-3, r=alexcrichton
`FormatError` is not exist anymore.
2015-06-14 04:21:47 +00:00
Wei-Ming Yang
7f25185138 Update mod.rs
`FormatError` is not exist anymore.
2015-06-14 11:32:04 +08:00
bors
6e7fcc44ae Auto merge of #26278 - tamird:compiletest, r=alexcrichton 2015-06-13 23:35:28 +00:00
bors
5f3233f092 Auto merge of #26250 - steveklabnik:remove_html_literals_test, r=alexcrichton
This test now works again

Fixes #20673

r? @alexcrichton
2015-06-13 22:03:42 +00:00
bors
325066051f Auto merge of #26249 - steveklabnik:remove_extern_panic, r=alexcrichton
This test has an interesting history, because of fail -> panic. It was
originally called extern-fail.rs:
https://github.com/rust-lang/rust/commits/master/src/test/run-fail/extern-fail.rs

It lived for a while, but was disabled in August 2013:
ce95b01014

As you can see, that failure was not specific to this test, however,
this code does stuff with the runtime, which was removed. Given that
it hasn't even been able to compile in a long time, we should just
remove it.

r? @brson
2015-06-13 20:33:53 +00:00
Peter Atashian
ebbd90d28f Switch to direct HeapAlloc on Windows when not using jemalloc
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-06-13 15:13:16 -04:00
Markus
7721d46bd7 Utilize discriminant_value for more efficient deriving
The new code generated for deriving on enums looks something like this:

```rust
let __self0_vi = unsafe {
    std::intrinsics::discriminant_value(&self) } as i32;
let __self1_vi = unsafe {
    std::intrinsics::discriminant_value(&__arg1) } as i32;
let __self2_vi = unsafe {
    std::intrinsics::discriminant_value(&__arg2) } as i32;
///
if __self0_vi == __self1_vi && __self0_vi == __self2_vi && ... {
    match (...) {
        (Variant1, Variant1, ...) => Body1
        (Variant2, Variant2, ...) => Body2,
        ...
        _ => ::core::intrinsics::unreachable()
    }
}
else {
    ... // catch-all remainder can inspect above variant index values.
}
```
This helps massively for C-like enums since they will be compiled as a
single comparison giving observed speedups of up to 8x. For more complex
enums the speedup is more difficult to measure but it should not be
slower to generate code this way regardless.
2015-06-13 20:40:59 +02:00
bors
c43cdb8ffd Auto merge of #26277 - aidanhs:aphs-dont-make-random-directories, r=alexcrichton
The last commit is optional. If you opt not to take it I can improve on the 'this is magic' comment.
2015-06-13 17:14:51 +00:00
Tamir Duberstein
7f04b8ff07 compiletest: remove JIT 2015-06-13 12:53:07 -04:00
Aidan Hobson Sayers
fca66702a4 Replace nop hack, explain substitution reasoning 2015-06-13 17:27:12 +01:00
Aidan Hobson Sayers
b1e9ed3c19 nop hack required for PREPARE_DIR (PREPARE_MAN for safety)
Fixes #26274
2015-06-13 17:27:05 +01:00
Aidan Hobson Sayers
065c9ab59b No need to double-silence 2015-06-13 17:26:27 +01:00
Ariel Ben-Yehuda
3ca4d92cd6 Ensure projections are not counted as constraining type parameters.
Fixes #26262
2015-06-13 17:59:10 +03:00
bors
b850046ca1 Auto merge of #26272 - Manishearth:rollup, r=Manishearth
- Successful merges: #26255, #26256, #26257, #26259, #26260
- Failed merges:
2015-06-13 14:02:25 +00:00
Manish Goregaokar
023f66103d Rollup merge of #26260 - tshepang:improve-example, r=steveklabnik 2015-06-13 18:03:56 +05:30
Manish Goregaokar
4935ea92b1 Rollup merge of #26259 - tshepang:case-examples, r=steveklabnik 2015-06-13 18:03:56 +05:30
Manish Goregaokar
e7c10d5d31 Rollup merge of #26257 - Tonkpils:patch-1, r=alexcrichton 2015-06-13 18:03:55 +05:30
Manish Goregaokar
2b8e80914a Rollup merge of #26256 - steveklabnik:gh25915, r=alexcrichton
Fixes #25915
2015-06-13 18:03:55 +05:30
Manish Goregaokar
15aa3bbccc Rollup merge of #26255 - steveklabnik:gh25499, r=alexcrichton
Fixes #25499
2015-06-13 18:03:55 +05:30
petrochenkov
bddb685e73 Use assert_eq! instead of assert! in tests 2015-06-13 14:55:55 +03:00
bors
a27982623c Auto merge of #26267 - eefriedman:split-tyarray, r=eddyb
Arrays and slices are closely related, but not that closely; making the
separation more explicit is generally more clear.
2015-06-13 11:42:24 +00:00
bors
a9f1e29c4e Auto merge of #26253 - steveklabnik:remove_old_ignored_tests, r=brson
Two commits here: one which removes a bunch of tests, and re-enables a few that work.

Second updates the syntax of one of the failing tests. It still doesn't pass, but at least it compiles.
2015-06-13 10:08:51 +00:00
bors
6d6f086928 Auto merge of #26118 - tshepang:define-trait, r=steveklabnik
I saw a variation of this definition in [an article](http://pcwalton.github.io/blog/2012/08/08/a-gentle-introduction-to-traits-in-rust) by @pcwalton.
2015-06-13 08:34:12 +00:00
bors
7c38de89d4 Auto merge of #26108 - Marwes:field_pun_docs, r=steveklabnik
Adds a mention for the short form pattern syntax. Now without creating a PR to my own fork!

#25779
2015-06-13 07:00:26 +00:00
bors
bfd70aaf77 Auto merge of #26248 - steveklabnik:remove_2061, r=alexcrichton
This test was added on Nov 1, 2012:
0069bd2f46 (diff-b516ff69faf8886c48e6f5e833c2548c)

and then ignored on the same day:
a90020fe8d (diff-b516ff69faf8886c48e6f5e833c2548c)

and never unignored again.
2015-06-13 03:29:40 +00:00
bors
bca2ea6c4a Auto merge of #26247 - steveklabnik:remove_4120, r=alexcrichton
This test originated from an ICE in Rust 0.4:
373504a7ac (diff-214656000770dff71c8165d051c3f027)

it was ignored one day later:
1fa2b9980f (diff-214656000770dff71c8165d051c3f027)

and then never enabled again. I think we're safe without it.
2015-06-13 01:23:26 +00:00
Eli Friedman
33b7386d39 Split TyArray into TyArray and TySlice.
Arrays and slices are closely related, but not that closely; making the
separation more explicit is generally more clear.
2015-06-12 16:50:13 -07:00
Ulrik Sverdrup
70269cd8ef mk: Build crates with relative paths to rustc
The path we pass to rustc will be visible in panic messages and
backtraces: they will be user visible!

Avoid junk in these paths by passing relative paths to rustc.

For most advanced users, `libcore` or `libstd` in the path will be
a clue to the location -- inside our code, not theirs.

Store both the relative path to the source as well as the absolute.
Use the relative path where it matters, compiling the main crates,
instead of changing all of the build process to cope with relative
paths.

Example output after this patch:

```
$ ./testunwrap
thread '<main>' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:362
$ RUST_BACKTRACE=1 ./testunwrap
thread '<main>' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:362
stack backtrace:
   1:     0x7ff59c1e9956 - sys::backtrace::write::h67a542fd2b201576des
                        at ../src/libstd/sys/unix/backtrace.rs:158
   2:     0x7ff59c1ed5b6 - panicking::on_panic::h3d21c41cdd5c12d41Xw
                        at ../src/libstd/panicking.rs:58
   3:     0x7ff59c1e7b6e - rt::unwind::begin_unwind_inner::h9f3a5440cebb8baeLDw
                        at ../src/libstd/rt/unwind/mod.rs:273
   4:     0x7ff59c1e7f84 - rt::unwind::begin_unwind_fmt::h4fe8a903e0c296b0RCw
                        at ../src/libstd/rt/unwind/mod.rs:212
   5:     0x7ff59c1eced7 - rust_begin_unwind
   6:     0x7ff59c22c11a - panicking::panic_fmt::h00b0cd49c98a9220i5B
                        at ../src/libcore/panicking.rs:64
   7:     0x7ff59c22b9e0 - panicking::panic::hf549420c0ee03339P3B
                        at ../src/libcore/panicking.rs:45
   8:     0x7ff59c1e621d - option::Option<T>::unwrap::h501963526474862829
   9:     0x7ff59c1e61b1 - main::hb5c91ce92347d1e6eaa
  10:     0x7ff59c1f1c18 - rust_try_inner
  11:     0x7ff59c1f1c05 - rust_try
  12:     0x7ff59c1ef374 - rt::lang_start::h7e51e19c6677cffe5Sw
                        at ../src/libstd/rt/unwind/mod.rs:147
                        at ../src/libstd/rt/unwind/mod.rs:130
                        at ../src/libstd/rt/mod.rs:128
  13:     0x7ff59c1e628e - main
  14:     0x7ff59b3f6b44 - __libc_start_main
  15:     0x7ff59c1e6078 - <unknown>
  16:                0x0 - <unknown>
```
2015-06-13 01:41:52 +02:00
bors
c6b1483377 Auto merge of #26160 - alexcrichton:revert-rc-as-ref, r=aturon
This is a revert of PR #26008 which caused the unintended breakage reported in #26096. We may want to add these implementations in the long run, but for now this revert allows us to take some more time to evaluate the impact of such a change (e.g. run it through crater).

Closes #26096
2015-06-12 23:05:06 +00:00
Tshepang Lekhonkhobe
667a246442 doc: make char::from_u32 example more brief 2015-06-13 00:57:13 +02:00
Tshepang Lekhonkhobe
2c08654e09 doc: 'c' feels more suitable than 'i' for representing characters 2015-06-13 00:01:16 +02:00
Tshepang Lekhonkhobe
50de1d6e71 doc: improve escape_unicode example
Looks better without all that wasted whitespace
2015-06-12 23:58:50 +02:00
Tshepang Lekhonkhobe
7c8440eb2f doc: add examples for to_uppercase and to_lowercase 2015-06-12 23:47:54 +02:00
bors
50ab23ddbd Auto merge of #25844 - alexcrichton:stabilize-fs-features, r=aturon
This commit stabilizes the following APIs, slating them all to be cherry-picked
into the 1.1 release.

* fs::FileType (and transitively the derived trait implementations)
* fs::Metadata::file_type
* fs::FileType::is_dir
* fs::FileType::is_file
* fs::FileType::is_symlink
* fs::DirEntry::metadata
* fs::DirEntry::file_type
* fs::DirEntry::file_name
* fs::set_permissions
* fs::symlink_metadata
* os::raw::{self, *}
* os::{android, bitrig, linux, ...}::raw::{self, *}
* os::{android, bitrig, linux, ...}::fs::MetadataExt
* os::{android, bitrig, linux, ...}::fs::MetadataExt::as_raw_stat
* os::unix::fs::PermissionsExt
* os::unix::fs::PermissionsExt::mode
* os::unix::fs::PermissionsExt::set_mode
* os::unix::fs::PermissionsExt::from_mode
* os::unix::fs::OpenOptionsExt
* os::unix::fs::OpenOptionsExt::mode
* os::unix::fs::DirEntryExt
* os::unix::fs::DirEntryExt::ino
* os::windows::fs::MetadataExt
* os::windows::fs::MetadataExt::file_attributes
* os::windows::fs::MetadataExt::creation_time
* os::windows::fs::MetadataExt::last_access_time
* os::windows::fs::MetadataExt::last_write_time
* os::windows::fs::MetadataExt::file_size

The `os::unix::fs::Metadata` structure was also removed entirely, moving all of
its associated methods into the `os::unix::fs::MetadataExt` trait instead. The
methods are all marked as `#[stable]` still.

As some minor cleanup, some deprecated and unstable fs apis were also removed:

* File::path
* Metadata::accessed
* Metadata::modified

Features that were explicitly left unstable include:

* fs::WalkDir - the semantics of this were not considered in the recent fs
  expansion RFC.
* fs::DirBuilder - it's still not 100% clear if the naming is right here and if
  the set of functionality exposed is appropriate.
* fs::canonicalize - the implementation on Windows here is specifically in
  question as it always returns a verbatim path. Additionally the Unix
  implementation is susceptible to buffer overflows on long paths unfortunately.
* fs::PathExt - as this is just a convenience trait, it is not stabilized at
  this time.
* fs::set_file_times - this funciton is still waiting on a time abstraction.
2015-06-12 21:31:37 +00:00
Nick Howell
95dc32dde6 Convert playpen.js to plain JS.
It is still compatible with IE9+.

This removes the jQuery dependency from the "Book" entirely.
2015-06-12 16:26:07 -04:00
Leo Correa
57f1036ce9 usize -> u32 to match previous example 2015-06-12 15:59:39 -04:00
bors
85b5338e34 Auto merge of #26232 - eefriedman:rename-sty, r=nrc
Use camel-case naming, and use names which actually make sense in modern Rust.
2015-06-12 19:57:27 +00:00
Steve Klabnik
d46d229be7 Fix up wording in lifetime elision docs
Fixes #25915
2015-06-12 15:05:09 -04:00
Steve Klabnik
4500019783 Remove unstable feature from TRPL: iterators
Fixes #25499
2015-06-12 15:00:21 -04:00
bors
1671b9baec Auto merge of #26221 - sanxiyn:wf-span, r=arielb1
When checking field types of struct or enum definitions, use spans for field types instead of the entire item.
2015-06-12 18:25:55 +00:00