Commit Graph

43541 Commits

Author SHA1 Message Date
Niko Matsakis
13cee1e198 This new caching sometimes suppresses duplicate errors that occur in
different parts of the crate, so modify the test cases that were relying
on that to test distinct types etc.
2015-06-15 17:31:27 -04:00
Niko Matsakis
f0f13f86ef Rather than expanding the where-clauses in the environment over and over
again, do it once and then just remember the expanded form. At the same
time, filter globally nameable predicates out of the environment, since
they can cause cache errors (and they are not necessary in any case).
2015-06-15 17:31:27 -04:00
Niko Matsakis
ff89fcf83b Add a (somewhat hacky) cache to the tcx that tracks "global" trait refs
that are known to have been satisfied *somewhere*. This means that if
one fn finds that `SomeType: Foo`, then every other fn can just consider
that to hold.

Unfortunately, there are some complications:

1. If `SomeType: Foo` includes dependent conditions, those conditions
   may trigger an error. This error will be repored in the first fn
   where `SomeType: Foo` is evaluated, but not in the other fns, which
   can lead to uneven error reporting (which is sometimes confusing).

2. This kind of caching can be unsound in the presence of
   unsatisfiable where clauses. For example, suppose that the first fn
   has a where-clause like `i32: Bar<u32>`, which in fact does not
   hold. This will "fool" trait resolution into thinking that `i32:
   Bar<u32>` holds. This is ok currently, because it means that the
   first fn can never be calle (since its where clauses cannot be
   satisfied), but if the first fn's successful resolution is cached, it
   can allow other fns to compile that should not. This problem is fixed
   in the next commit.
2015-06-15 17:31:26 -04:00
bors
0d82fb55db Auto merge of #26307 - nrc:save-bugs, r=cmr
r? @brson (or anyone, really)
2015-06-15 09:02:31 +00:00
bors
7517ecf4fc Auto merge of #26168 - sfackler:stdout-panic, r=alexcrichton
Closes #25977

The various `stdfoo_raw` methods in std::io now return `io::Result`s,
since they may not exist on Windows. They will always return `Ok` on
Unix-like platforms.

[breaking-change]
2015-06-15 06:44:42 +00:00
Nick Cameron
a54bbac99a save-analysis: fix a couple of span bugs 2015-06-15 18:10:49 +12:00
bors
a54a809219 Auto merge of #25359 - thepowersgang:result-expect-2, r=alexcrichton
As it says in the title. I've added an `expect` method to `Result` that allows printing both an error message (e.g. what operation was attempted), and the error value. This is separate from the `unwrap` and `ok().expect("message")` behaviours.
2015-06-15 05:11:53 +00:00
John Hodge
0937c10f3c libcore/Result - RFC#1119 Add an 'expect' method to Result 2015-06-15 12:00:16 +08:00
Steven Fackler
a7bbd7da4e Implement RFC 1014
Closes #25977

The various `stdfoo_raw` methods in std::io now return `io::Result`s,
since they may not exist on Windows. They will always return `Ok` on
Unix-like platforms.

[breaking-change]
2015-06-14 20:17:06 -07:00
bors
7d04623033 Auto merge of #26290 - michaelsproul:url-line-limit, r=alexcrichton
The plugin that enforces error explanation line-length is a bit restrictive, particularly when attempting to use URLs in explanations (cf #26163).

Jashank will still have to do some mucking around with `#[cfg(not(stage0))]` attributes or else wait until a snapshot with this commit lands.
2015-06-15 01:57:17 +00:00
bors
8937ec1004 Auto merge of #26265 - retep998:heapalloc, r=alexcrichton
This removes our dependency on the CRT for memory allocation.
2015-06-15 00:24:31 +00:00
bors
4f3c19f547 Auto merge of #26110 - nrc:save-api-3, r=brson
r? @huonw
2015-06-14 22:47:55 +00:00
Nick Cameron
718268398e Rebasing and bug fixing 2015-06-15 10:06:01 +12:00
bors
b26eeffacb Auto merge of #26213 - semarie:openbsd-morestack, r=alexcrichton
don't try to bind __morestack symbol under OpenBSD as the platform don't
have morestack support.

r? @alexcrichton 

it unbreak build under OpenBSD. Does some others platforms don't have morestack too ? They should be impacted by this problem too.
2015-06-14 21:15:32 +00:00
Nick Cameron
92d6676412 save-analysis: use a macro for 'downcasting' 2015-06-15 08:16:35 +12:00
Nick Cameron
788fdddf37 save-analysis: API-ify struct lits 2015-06-15 08:16:35 +12:00
Nick Cameron
04b32cecac save-analysis: merge StructRef and TypeRef 2015-06-15 08:15:29 +12:00
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
Aidan Hobson Sayers
5ef250427d musl only uses rlib files for stdlib linking 2015-06-14 16:18:51 +01: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
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
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