Commit Graph

184 Commits

Author SHA1 Message Date
Steve Klabnik
6ac7fc73f5 Update infrastructure for fail -> panic
This includes updating the language items and marking what needs to
change after a snapshot.

If you do not use the standard library, the language items you need to
implement have changed. For example:

```rust
 #[lang = "fail_fmt"] fn fail_fmt() -> ! { loop {} }
```

is now

```rust
 #[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
```

Related, lesser-implemented language items `fail` and
`fail_bounds_check` have become `panic` and `panic_bounds_check`, as
well. These are implemented by `libcore`, so it is unlikely (though
possible!) that these two renamings will affect you.

[breaking-change]

Fix test suite
2014-10-29 16:06:13 -04:00
Steve Klabnik
7828c3dd28 Rename fail! to panic!
https://github.com/rust-lang/rfcs/pull/221

The current terminology of "task failure" often causes problems when
writing or speaking about code. You often want to talk about the
possibility of an operation that returns a Result "failing", but cannot
because of the ambiguity with task failure. Instead, you have to speak
of "the failing case" or "when the operation does not succeed" or other
circumlocutions.

Likewise, we use a "Failure" header in rustdoc to describe when
operations may fail the task, but it would often be helpful to separate
out a section describing the "Err-producing" case.

We have been steadily moving away from task failure and toward Result as
an error-handling mechanism, so we should optimize our terminology
accordingly: Result-producing functions should be easy to describe.

To update your code, rename any call to `fail!` to `panic!` instead.
Assuming you have not created your own macro named `panic!`, this
will work on UNIX based systems:

    grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g'

You can of course also do this by hand.

[breaking-change]
2014-10-29 11:43:07 -04:00
Alex Crichton
9d5d97b55d Remove a large amount of deprecated functionality
Spring cleaning is here! In the Fall! This commit removes quite a large amount
of deprecated functionality from the standard libraries. I tried to ensure that
only old deprecated functionality was removed.

This is removing lots and lots of deprecated features, so this is a breaking
change. Please consult the deprecation messages of the deleted code to see how
to migrate code forward if it still needs migration.

[breaking-change]
2014-10-19 12:59:40 -07:00
Steven Fackler
aa3b1261b1 Continue cfg syntax transition
All deprecation warnings have been converted to errors. This includes
the warning for multiple cfgs on one item. We'll leave that as an error
for some period of time to ensure that all uses are updated before the
behavior changes from "or" to "and".
2014-10-12 11:40:19 -07:00
bors
45797a0765 auto merge of #17037 : kmcallister/rust/no-stack-check, r=thestinger
r? @brson 

Fixes #16980.
2014-10-10 07:52:00 +00:00
Keegan McAllister
bc3831b730 Disable no-stack-check test on Windows 2014-10-09 21:26:51 -07:00
Keegan McAllister
441796831f Add tests for no-stack-check attr and codegen option 2014-10-09 15:01:00 -07:00
Alex Crichton
d03a4b0046 test: Convert statics to constants
Additionally, add lots of tests for new functionality around statics and
`static mut`.
2014-10-09 09:44:52 -07:00
bors
5660db2508 auto merge of #16970 : kmcallister/rust/llvm-unreachable, r=thestinger
I'm not sure how to add an automated test for this.
2014-10-05 07:17:09 +00:00
Keegan McAllister
675aa7692d Add tests for intrinsics::unreachable 2014-10-04 20:09:09 -07:00
Alex Crichton
06a6ba1d6f test: Don't depend on /bin/bash
Our FreeBSD bots apparently don't have bash installed, and it's ok to run with
sh anyway!

Unblocks a snapshot
2014-10-02 19:34:26 -07:00
bors
dd7f00de80 auto merge of #17681 : jgallagher/rust/dep-info-escape-spaces, r=alexcrichton
cc #17627
2014-10-02 08:12:19 +00:00
Aaron Turon
60b859ab8a Remove all use of librustuv 2014-10-01 10:33:11 -07:00
John Gallagher
2883b7682a Make --dep-info escape spaces in filenames
Closes #17627
2014-10-01 11:40:00 -04:00
Alex Crichton
1a18258d86 rollup merge of #17619 : wizeman/fix-perm 2014-09-29 08:14:50 -07:00
Alex Crichton
6c23789ad1 rollup merge of #17531 : tomjakubowski/rustdoc-where-clauses 2014-09-29 08:10:47 -07:00
Tom Jakubowski
54831f128f rustdoc: Render where clauses as appropriate
Fix #16546
2014-09-29 06:38:47 -07:00
Ricardo M. Correia
991f506248 rustc: Fix permission denied error in 'ar' when lto is enabled
The reason that 'ar' can fail with permission denied is that when
link-time optimizations are enabled, rustc copies libraries into a
temporary directory, preserving file permissions, and subsequently
modifies them using 'ar'.

The modification can fail because some package managers may install
libraries in system directories as read-only files, which means the
temporary file also becomes read-only when it is copied.

I have fixed this by giving the temporary file's owner read+write
permissions after the copy.

I have also added a regression test for this issue.
2014-09-29 15:07:14 +02:00
Niko Matsakis
6473909a1b Fix various places that were affected by adding core as dep of libc 2014-09-25 13:59:24 -04:00
Alex Crichton
3d8ca595a1 rustdoc: Don't try to inline the crate root
Fixes other test cases found in #16274
2014-09-23 15:19:30 -07:00
Alex Crichton
d2b30f7d38 rustdoc: Prevent infinite recursion when inlining
Cyclic pub-use chains triggered infinite recursion, and this commit adds a hash
set to guard against cyclic recursion. This will cause one of the reexports to
render as a `pub use` instead of inlining the documentation.

Closes #16274
2014-09-23 15:13:56 -07:00
Colin Davidson
a7a1bf81d7 Move -Z lto to -C lto.
Closes #12443
2014-09-21 02:17:31 -04:00
Brian Koropoff
3da255d35a Add regression test for #17186 2014-09-12 18:09:47 -07:00
inrustwetrust
e7a000e717 Added test for link path ordering 2014-09-07 11:42:02 +02:00
Stuart Pernsteiner
1b676fb760 don't leave unwanted temporary files with --emit=ir/asm 2014-09-05 09:18:57 -07:00
Stuart Pernsteiner
4b70269854 add tests for separate compilation 2014-09-05 09:18:57 -07:00
Joseph Crail
b7bfe04b2d Fix spelling errors and capitalization. 2014-09-03 23:10:38 -04:00
bors
d398eb76ae auto merge of #16419 : huonw/rust/pretty-expanded-hygiene, r=pnkfelix
Different Identifiers and Names can have identical textual representations, but different internal representations, due to the macro hygiene machinery (syntax contexts and gensyms). This provides a way to see these internals by compiling with `--pretty expanded,hygiene`.

This is useful for debugging & hacking on macros (e.g. diagnosing https://github.com/rust-lang/rust/issues/15750/https://github.com/rust-lang/rust/issues/15962 likely would've been faster with this functionality).

E.g. 

```rust
#![feature(macro_rules)]
// minimal junk
#![no_std]

macro_rules! foo {
    ($x: ident) => { y + $x }
}

fn bar() {
    foo!(x)
}
```
```rust
#![feature(macro_rules)]
// minimal junk
#![no_std]


fn bar /* 61#0 */() { y /* 60#2 */ + x /* 58#3 */ }
```
2014-08-30 10:51:26 +00:00
Huon Wilson
32e437161d rustc: implement a pretty mode to print ident/name's ctxt & gensyms.
`--pretty expanded,hygiene` is helpful with debugging macro issues,
since two identifiers/names can be textually the same, but different
internally (resulting in weird "undefined variable" errors).
2014-08-30 16:50:38 +10:00
bors
51d0d06410 auto merge of #16767 : SiegeLord/rust/reexported_methods, r=cmr
Previously, this caused methods of re-exported types to not be inserted into
the search index. This fix may introduce some false positives, but in my
testing they appear as orphaned methods and end up not being inserted into the
final search index at a later stage.

Fixes issue #11943
2014-08-29 15:41:20 +00:00
Niko Matsakis
1b487a8906 Implement generalized object and type parameter bounds (Fixes #16462) 2014-08-27 21:46:52 -04:00
SiegeLord
0db6f4cb57 Add a simple test for rustdoc search index contents 2014-08-26 22:03:39 -04:00
Nick Cameron
52ef46251e Rebasing changes 2014-08-26 16:07:32 +12:00
Nick Cameron
3e626375d8 DST coercions and DST structs
[breaking-change]

1. The internal layout for traits has changed from (vtable, data) to (data, vtable). If you were relying on this in unsafe transmutes, you might get some very weird and apparently unrelated errors. You should not be doing this! Prefer not to do this at all, but if you must, you should use raw::TraitObject rather than hardcoding rustc's internal representation into your code.

2. The minimal type of reference-to-vec-literals (e.g., `&[1, 2, 3]`) is now a fixed size vec (e.g., `&[int, ..3]`) where it used to be an unsized vec (e.g., `&[int]`). If you want the unszied type, you must explicitly give the type (e.g., `let x: &[_] = &[1, 2, 3]`). Note in particular where multiple blocks must have the same type (e.g., if and else clauses, vec elements), the compiler will not coerce to the unsized type without a hint. E.g., `[&[1], &[1, 2]]` used to be a valid expression of type '[&[int]]'. It no longer type checks since the first element now has type `&[int, ..1]` and the second has type &[int, ..2]` which are incompatible.

3. The type of blocks (including functions) must be coercible to the expected type (used to be a subtype). Mostly this makes things more flexible and not less (in particular, in the case of coercing function bodies to the return type). However, in some rare cases, this is less flexible. TBH, I'm not exactly sure of the exact effects. I think the change causes us to resolve inferred type variables slightly earlier which might make us slightly more restrictive. Possibly it only affects blocks with unreachable code. E.g., `if ... { fail!(); "Hello" }` used to type check, it no longer does. The fix is to add a semicolon after the string.
2014-08-26 12:38:51 +12:00
Jonas Hietala
9968ae2554 Adjust the error messages to match the pattern "expected foo, found bar"
Closes #8492
2014-08-24 09:53:01 +02:00
Corey Richardson
6e8ff99958 librustc: handle repr on structs, require it for ffi, unify with packed
As of RFC 18, struct layout is undefined. Opting into a C-compatible struct
layout is now down with #[repr(C)]. For consistency, specifying a packed
layout is now also down with #[repr(packed)]. Both can be specified.

To fix errors caused by this, just add #[repr(C)] to the structs, and change
 #[packed] to #[repr(packed)]

Closes #14309

[breaking-change]
2014-08-20 21:02:23 -04:00
Luqman Aden
7382554496 Add fix for test on windows. 2014-08-19 13:32:41 -07:00
Luqman Aden
b90e2d4bc7 Add test for passing/getting packed structs with ffi. 2014-08-18 14:46:47 -04:00
klutzy
480674694e Remove workaround of #13793/#10872
LLVM assertion error has been fixed recently:
http://llvm.org/bugs/show_bug.cgi?id=18993

Fixes #13793
2014-08-18 13:45:08 +09:00
Björn Steinbrink
a5590b3c75 Properly canonicalize crate paths specified via --extern
Crates that are resolved normally have their path canonicalized and all
symlinks resolved. This does currently not happen for paths specified
using the --extern option to rustc, which can lead to rustc thinking
that it encountered two different versions of a crate, when it's
actually the same version found through different paths.

To fix this, we must store the canonical path for crates found via
--extern and also use the canonical path when comparing paths.

Fixes #16496
2014-08-15 14:40:09 +02:00
Felix S. Klock II
9434920b24 rustc lexer: regression tests for embedded Idents.
I chose to make two of them because I wanted something close to an
"end-to-end" test (*), but at the same time I wanted a test that
would run on Windows (**).

(*) The run-make test serves as the end-to-end: It constructs an input
that is trying to subvert the hack and we are going to check that it
fails in the attempt).

(**) The compile-fail-fulldeps test serves as a more narrow test that
will be tested on all platforms.  It also attempts to subvert the
hack, testing that when you use `new_parser_from_tts`, the resulting
parser does not support reading embedded Idents.
2014-08-13 17:41:35 +02:00
bors
c7d0b5259d auto merge of #16434 : vadimcn/rust/many-crates-but-no-match, r=alexcrichton 2014-08-12 09:31:17 +00:00
Vadim Chugunov
06d44aaad3 Fix many-crates-but-no-match test. (Issue #16348) 2014-08-11 18:41:47 -07:00
Joseph Crail
2016742e07 Fix misspelled comments for tests. 2014-08-09 22:08:36 -04:00
bors
351cc4fc99 auto merge of #16359 : epdtry/rust/mono-item-dedup-foreign, r=alexcrichton
Extend the changes from #16059 to the new generic foreign functions introduced by #15831.
2014-08-09 23:26:18 +00:00
bors
87134c7d72 auto merge of #16326 : pnkfelix/rust/fsk-add-path-suffix-lookup, r=huonw
Extended `ast_map::Map` with an iterator over all node id's that match a path suffix.

Extended pretty printer to let users choose particular items to pretty print, either by indicating an integer node-id, or by providing a path suffix.

 * Example 1: the suffix `typeck::check::check_struct` matches the item with the path `rustc::middle::typeck::check::check_struct` when compiling the `rustc` crate.

 * Example 2: the suffix `and` matches `core::option::Option::and` and `core::result::Result::and` when compiling the `core` crate.

Refactored `pprust` slightly to support the pretty printer changes.

(See individual commits for more description.)
2014-08-09 09:51:23 +00:00
Felix S. Klock II
db0e71f10a pretty printer: Added some run-make tests of path-suffix lookup functionality. 2014-08-09 10:19:06 +02:00
bors
413328b0f2 auto merge of #15964 : huonw/rust/gensym-test, r=alexcrichton
This requires avoiding `quote_...!` for constructing the parts of the
__test module, since that stringifies and reinterns the idents, losing
the special gensym'd nature of them. (#15962.)
2014-08-09 03:06:21 +00:00
Huon Wilson
c3284733e3 move a test into a run make, to check external affect rather than
implementation details.

(Mainly to avoid accessing the secret internal test module symbol name.)
2014-08-09 13:00:58 +10:00
Stuart Pernsteiner
0c158b4fbf don't translate items when monomorphizing foreign-ABI functions 2014-08-08 11:26:21 -07:00