Commit graph

767 commits

Author SHA1 Message Date
bors
c3db627cbf Auto merge of #29296 - zazdxscf:compiletest_noargs_show_help, r=alexcrichton
instead of this panic:
```
thread '<main>' panicked at 'index out of bounds: the len is 1 but the
index is 1', src/libcollections/vec.rs:1110
```

It still panics, just like `-h` does, so it should be okay in this
regard.
2015-10-26 00:19:51 +00:00
Alex Crichton
ff49733274 std: Stabilize library APIs for 1.5
This commit stabilizes and deprecates library APIs whose FCP has closed in the
last cycle, specifically:

Stabilized APIs:

* `fs::canonicalize`
* `Path::{metadata, symlink_metadata, canonicalize, read_link, read_dir, exists,
   is_file, is_dir}` - all moved to inherent methods from the `PathExt` trait.
* `Formatter::fill`
* `Formatter::width`
* `Formatter::precision`
* `Formatter::sign_plus`
* `Formatter::sign_minus`
* `Formatter::alternate`
* `Formatter::sign_aware_zero_pad`
* `string::ParseError`
* `Utf8Error::valid_up_to`
* `Iterator::{cmp, partial_cmp, eq, ne, lt, le, gt, ge}`
* `<[T]>::split_{first,last}{,_mut}`
* `Condvar::wait_timeout` - note that `wait_timeout_ms` is not yet deprecated
  but will be once 1.5 is released.
* `str::{R,}MatchIndices`
* `str::{r,}match_indices`
* `char::from_u32_unchecked`
* `VecDeque::insert`
* `VecDeque::shrink_to_fit`
* `VecDeque::as_slices`
* `VecDeque::as_mut_slices`
* `VecDeque::swap_remove_front` - (renamed from `swap_front_remove`)
* `VecDeque::swap_remove_back` - (renamed from `swap_back_remove`)
* `Vec::resize`
* `str::slice_mut_unchecked`
* `FileTypeExt`
* `FileTypeExt::{is_block_device, is_char_device, is_fifo, is_socket}`
* `BinaryHeap::from` - `from_vec` deprecated in favor of this
* `BinaryHeap::into_vec` - plus a `Into` impl
* `BinaryHeap::into_sorted_vec`

Deprecated APIs

* `slice::ref_slice`
* `slice::mut_ref_slice`
* `iter::{range_inclusive, RangeInclusive}`
* `std::dynamic_lib`

Closes #27706
Closes #27725
cc #27726 (align not stabilized yet)
Closes #27734
Closes #27737
Closes #27742
Closes #27743
Closes #27772
Closes #27774
Closes #27777
Closes #27781
cc #27788 (a few remaining methods though)
Closes #27790
Closes #27793
Closes #27796
Closes #27810
cc #28147 (not all parts stabilized)
2015-10-25 09:36:32 -07:00
Emanuel Czirai
351efd55e9 compiletest: show usage/help when passed no args
instead of this panic:
```
thread '<main>' panicked at 'index out of bounds: the len is 1 but the
index is 1', src/libcollections/vec.rs:1110
```

It still panics, just like `-h` does, so it should be okay in this
regard.
2015-10-25 11:53:47 +01:00
William Throwe
1e0c23d781 Allow multi-digit GDB minor version numbers
GDB 7.10 was recently released.
2015-09-24 13:04:22 -04:00
Richard Diamond
9a24025661 Avoid loading the whole gdb debug scripts section.
This is so LLVM isn't forced to load every byte of it. Also sets the alignment of
the load. Adds a test for the debug script section.
2015-09-21 15:43:52 -05:00
Nick Cameron
facdf2ebb1 Add an intital HIR and lowering step 2015-09-03 10:02:36 +12:00
llogiq
99383f8f5c refactored compiletest following clippy's suggestions 2015-09-01 14:43:42 +02:00
Diggory Blake
19dc4d0a30 Fix compile-fail tests on windows 2015-08-24 04:53:56 +01:00
Tim Neumann
f0ea2b66f3 Fix #27567: remove --crate-type=lib from pretty test 2015-08-11 13:00:38 +02:00
Alex Crichton
e648c96c5f trans: Stop informing LLVM about dllexport
Rust's current compilation model makes it impossible on Windows to generate one
object file with a complete and final set of dllexport annotations. This is
because when an object is generated the compiler doesn't actually know if it
will later be included in a dynamic library or not. The compiler works around
this today by flagging *everything* as dllexport, but this has the drawback of
exposing too much.

Thankfully there are alternate methods of specifying the exported surface area
of a dll on Windows, one of which is passing a `*.def` file to the linker which
lists all public symbols of the dynamic library. This commit removes all
locations that add `dllexport` to LLVM variables and instead dynamically
generates a `*.def` file which is passed to the linker. This file will include
all the public symbols of the current object file as well as all upstream
libraries, and the crucial aspect is that it's only used when generating a
dynamic library. When generating an executable this file isn't generated, so all
the symbols aren't exported from an executable.

To ensure that statically included native libraries are reexported correctly,
the previously added support for the `#[linked_from]` attribute is used to
determine the set of FFI symbols that are exported from a dynamic library, and
this is required to get the compiler to link correctly.
2015-08-10 18:20:42 -07:00
bors
05d8767289 Auto merge of #26957 - wesleywiser:rename_connect_to_join, r=alexcrichton
Fixes #26900
2015-07-12 22:05:59 +00:00
Simonas Kazlauskas
7a90865db5 Implement RFC 1058 2015-07-12 00:47:56 +03:00
Wesley Wiser
93ddee6cee Change some instances of .connect() to .join() 2015-07-10 19:40:46 -04:00
Dave Huseby
b77985fcfb this fixes the test failures on freebsd 2015-07-08 10:32:43 -07:00
bors
7c1e339f10 Auto merge of #25754 - geofft:remove-compiletest-jit, r=alexcrichton
jit support was removed from rustc in 6b34ba242d
(December 2013), so passing `--jit` wouldn't even work.
2015-07-05 19:05:14 +00:00
Alex Newman
0b7c4f57f6 Add netbsd amd64 support 2015-07-01 19:09:14 -07:00
Geoffrey Thomas
aadc2af03f compiletest: Minor cleanup from removal of jit test support
We're no longer passing extra args to the compiler, so remove the variable.
2015-06-18 16:07:23 -04:00
Alex Crichton
ce1a965cf5 Fallout in tests and docs from feature renamings 2015-06-17 09:07:16 -07:00
Tamir Duberstein
7f04b8ff07 compiletest: remove JIT 2015-06-13 12:53:07 -04:00
Joshua Landau
ca7418b846 Removed many pointless calls to *iter() and iter_mut() 2015-06-10 21:14:03 +01:00
Simon Sapin
c160192f5f Replace usage of String::from_str with String:from 2015-06-08 16:55:35 +02:00
Michael Sproul
25d0ef347a Improve diagnostic messages for range patterns. 2015-06-03 16:15:15 +10:00
Björn Steinbrink
677367599e Revamp codegen tests to check IR quality instead of quantity
The current codegen tests only compare IR line counts between similar
rust and C programs, the latter getting compiled with clang. That looked
like a good idea back then, but actually things like lifetime intrinsics
mean that less IR isn't always better, so the metric isn't really
helpful.

Instead, we can start doing tests that check specific aspects of the
generated IR, like attributes or metadata. To do that, we can use LLVM's
FileCheck tool which has a number of useful features for such tests.

To start off, I created some tests for a few things that were recently
added and/or broken.
2015-05-27 12:08:31 +02:00
Barosl Lee
ff332b6467 Squeeze the last bits of tasks in documentation in favor of thread
An automated script was run against the `.rs` and `.md` files,
subsituting every occurrence of `task` with `thread`. In the `.rs`
files, only the texts in the comment blocks were affected.
2015-05-09 02:24:18 +09:00
Huon Wilson
d73545ceca Run benchmarks once, as a test by default.
E.g. if `foo.rs` looks like

    #![feature(test)]
    extern crate test;

    #[bench]
    fn bar(b: &mut test::Bencher) {
        b.iter(|| {
            1
        })
    }

    #[test]
    fn baz() {}

    #[bench]
    fn qux(b: &mut test::Bencher) {
        b.iter(|| {
            panic!()
        })
    }

Then

    $ rustc --test foo.rs
    $ ./foo

    running 3 tests
    test baz ... ok
    test qux ... FAILED
    test bar ... ok

    failures:

    ---- qux stdout ----
    	thread 'qux' panicked at 'explicit panic', bench.rs:17

    failures:
        qux

    test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured

    $ ./foo --bench ba

    running 2 tests
    test baz ... ignored
    test bar ... bench:        97 ns/iter (+/- 74)

    test result: ok. 0 passed; 0 failed; 1 ignored; 1 measured

In particular, the two benchmark are being run as tests in the default
mode.

This helps for the main distribution, since benchmarks are only run with
`PLEASE_BENCH=1`, which is rarely set (and never set on the test bots),
and helps for code-coverage tools: benchmarks are run and so don't count
as dead code.

Fixes #15842.
2015-05-02 15:45:23 +10:00
Alex Crichton
60f8f6bde9 compiletest: Add support for // ignore-musl
Add the ability to ignore a test based on the environment of the triple being
used.
2015-04-27 10:11:15 -07:00
Alex Crichton
5f518ad658 compiletest: Don't force dylibs on musl
MUSL support is currently only with static builds, so building a dylib will
always fail.
2015-04-27 10:11:15 -07:00
bors
69e47c77b2 Auto merge of #24537 - rprichard:fix-parallel-check, r=alexcrichton
This required fixing the `pretty-rpass-full` tests to have the same `$$(CSREQ$(1)_T_$(2)_H_$(3))`  dependencies as the `rpass-full` and `cfail-full` tests.  It also required fixing the `run-make/simd-ffi` test to use unique names for its output files.
2015-04-23 17:32:16 +00:00
Ryan Prichard
38d26d811a Include the mode in compiletest's aux-build directory.
The run-pass and pretty run-pass tests could run concurrently, and if they
do, they need to keep their output segregated.

This change might be overkill. We need the suffix for the `pretty` mode,
but we might not need it otherwise. The `debuginfo-lldb` and
`debuginfo-gdb` modes look like they could also need it, but the current
`tests.mk` file happens not to enable both lldb and gdb at the same time,
for incidental reasons.
2015-04-22 20:32:14 -07:00
P1start
7d2231aa22 Change a few error messages to give code suggestions
PR #24242 added the ability to the compiler to directly give suggestions about
how to modify code to fix an error. The new errors look like this:

    foobar.rs:5:12: 5:25 error: expected a path on the left-hand side of `+`,
                                not `&'static Copy` [E0178]
    foobar.rs:5     let x: &'static Copy + 'static;
                           ^~~~~~~~~~~~~
    foobar.rs:5:12: 5:35 help: try adding parentheses (per RFC 438):
    foobar.rs:      let x: &'static (Copy + 'static);

    foobar.rs:2:13: 2:23 error: cast to unsized type: `&_` as `core::marker::Copy`
    foobar.rs:2     let x = &1 as Copy;
                            ^~~~~~~~~~
    foobar.rs:2:19: 2:23 help: try casting to a reference instead:
    foobar.rs:      let x = &1 as &Copy;

    foobar.rs:7:24: 7:25 error: expected expression, found `;`
    foobar.rs:7     let x = box (1 + 1);
                                       ^
    foobar.rs:7:13: 7:16 help: try using `box()` instead:
    foobar.rs:      let x = box() (1 + 1);

This also modifies compiletest to give the ability to directly test suggestions
given by error messages.
2015-04-21 21:13:42 +12:00
Tamir Duberstein
10f15e72e6 Negative case of len() -> is_empty()
`s/([^\(\s]+\.)len\(\) [(?:!=)>] 0/!$1is_empty()/g`
2015-04-14 20:26:03 -07:00
Tamir Duberstein
29ac04402d Positive case of len() -> is_empty()
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
2015-04-14 20:26:03 -07:00
Alex Crichton
b8760afe47 More test fixes 2015-04-14 10:14:19 -07:00
Alex Crichton
84a89ed3ef compiletest: Re-add raise_fd_limit
This apparently fixes obscure bugs on OSX!
2015-04-14 10:14:11 -07:00
Alex Crichton
445faca844 Test fixes and review feedback 2015-04-10 00:58:10 -07:00
Alex Crichton
a30f28edad rustdoc: Add a test for fixed issue #15347
Closes #15347
2015-04-07 17:54:34 -07:00
Alex Crichton
9ad133b4a1 rustdoc: Add a primitive page for raw pointers
Closes #15318
2015-04-07 17:54:33 -07:00
Alex Crichton
10359de405 compiletest: Add support for running rustdoc tests
Add a new test directory called 'rustdoc' where all files inside are documented
and run against the `htmldocck` script to have assertions about the output.
2015-04-07 17:54:33 -07:00
Will
fc2494b80c Fix charset of debuginfo test on FreeBSD 2015-04-07 20:41:34 +09:00
Dave Huseby
5387189d5b fixing some tests and temporarily disabling others to get Bitrig build working 100% 2015-04-04 12:33:44 -07:00
Alex Crichton
9bb05fd414 rollup merge of #23939: nikomatsakis/fn-box
Conflicts:
	src/liballoc/boxed.rs
2015-04-01 13:30:51 -07:00
Alex Crichton
e98dce3e00 std: Changing the meaning of the count to splitn
This commit is an implementation of [RFC 979][rfc] which changes the meaning of
the count parameter to the `splitn` function on strings and slices. The
parameter now means the number of items that are returned from the iterator, not
the number of splits that are made.

[rfc]: https://github.com/rust-lang/rfcs/pull/979

Closes #23911
[breaking-change]
2015-04-01 13:29:42 -07:00
Niko Matsakis
cade32acf6 Remove Thunk struct and Invoke trait; change Thunk to be an alias
for `Box<FnBox()>`. I found the alias was still handy because it is
shorter than the fully written type.

This is a [breaking-change]: convert code using `Invoke` to use `FnBox`,
which is usually pretty straight-forward. Code using thunk mostly works
if you change `Thunk::new => Box::new` and `foo.invoke(arg)` to
`foo(arg)`.
2015-04-01 14:41:21 -04:00
Aaron Turon
9fc51efe33 Stabilize std::convert and related code
* Marks `#[stable]` the contents of the `std::convert` module.

* Added methods `PathBuf::as_path`, `OsString::as_os_str`,
  `String::as_str`, `Vec::{as_slice, as_mut_slice}`.

* Deprecates `OsStr::from_str` in favor of a new, stable, and more
  general `OsStr::new`.

* Adds unstable methods `OsString::from_bytes` and `OsStr::{to_bytes,
  to_cstring}` for ergonomic FFI usage.

[breaking-change]
2015-03-31 11:24:38 -07:00
Alex Crichton
d65fee28d3 Test fixes and rebase conflicts, round 2 2015-03-27 13:43:42 -07:00
Alex Crichton
28a6b16130 rollup merge of #23741: alexcrichton/remove-int-uint
Conflicts:
	src/librustc/middle/ty.rs
	src/librustc_trans/trans/adt.rs
	src/librustc_typeck/check/mod.rs
	src/libserialize/json.rs
	src/test/run-pass/spawn-fn.rs
2015-03-27 10:10:05 -07:00
Alex Crichton
43bfaa4a33 Mass rename uint/int to usize/isize
Now that support has been removed, all lingering use cases are renamed.
2015-03-26 12:10:22 -07:00
Tamir Duberstein
d9d2236b09 Add iOS triple mapping so tests can run 2015-03-25 18:18:34 -07:00
Tamir Duberstein
71386e5774 Alphabetize 2015-03-25 18:18:30 -07:00
Alex Crichton
c608084ff5 rollup merge of #23598: brson/gate
Conflicts:
	src/compiletest/compiletest.rs
	src/libcollections/lib.rs
	src/librustc_back/lib.rs
	src/libserialize/lib.rs
	src/libstd/lib.rs
	src/libtest/lib.rs
	src/test/run-make/rustdoc-default-impl/foo.rs
	src/test/run-pass/env-home-dir.rs
2015-03-23 15:13:15 -07:00