Commit Graph

55862 Commits

Author SHA1 Message Date
Rahul Sharma
02fa14fc8e updated compile-fail tests 2016-08-14 16:18:58 +05:30
Eduard Burtescu
1bb1444516 Get rid of the .note interpretation of rustc dylib metadata. 2016-08-14 11:16:28 +03:00
bors
eec30ea657 Auto merge of #35453 - jseyfried:hygienize_metavariables, r=nrc
macros: Make metavariables hygienic

This PR makes metavariables hygienic. For example, consider:
```rust
macro_rules! foo {
    ($x:tt) => { // Suppose that this token tree argument is always a metavariable.
        macro_rules! bar { ($x:expr, $y:expr) => { ($x, $y) } }
    }
}

fn main() {
    foo!($z); // This currently compiles.
    foo!($y); // This is an error today but compiles after this PR.
}
```
Today, the `macro_rules! bar { ... }` definition is only valid when the metavariable passed to `foo` is not `$y` (since it unhygienically conflicts with the `$y` in the definition of `bar`) or `$x` (c.f. #35450).

After this PR, the definition of `bar` is always valid (and `bar!(a, b)` always expands to `(a, b)` as expected).

This can break code that was allowed in #34925 (landed two weeks ago). For example,
```rust
macro_rules! outer {
    ($t:tt) => {
        macro_rules! inner { ($i:item) => { $t } }
    }
}

outer!($i); // This `$i` should not interact with the `$i` in the definition of `inner!`.
inner!(fn main() {}); // After this PR, this is an error ("unknown macro variable `i`").
```

Due to the severe limitations on nested `macro_rules!` before #34925, this is not a breaking change for stable/beta.

Fixes #35450.

r? @nrc
2016-08-13 23:37:11 -07:00
Ivan Ukhov
10fce6e2d7 Fix a couple of typos in RawVec 2016-08-14 06:59:43 +02:00
Eduard Burtescu
02aec40dc9 [MIR] Add Storage{Live,Dead} statements to emit llvm.lifetime.{start,end}. 2016-08-14 06:34:14 +03:00
Diggory Blake
b3908d08ee Fix make-tidy lock file checks 2016-08-13 22:36:04 +01:00
Jeffrey Seyfried
4943e96a0c Add regression test. 2016-08-13 20:08:45 +00:00
Jeffrey Seyfried
b08043ee69 Allow attributes to be marked used before cfg proccessing. 2016-08-13 20:08:42 +00:00
bors
2b7ea14cc4 Auto merge of #35414 - jupp0r:feature/test-threads-flag, r=alexcrichton
Add --test-threads option to test binaries

This change allows parallelism of test runs to be specified by a
command line flag names --test-threads in addition to the existing
environment variable RUST_TEST_THREADS. Fixes #25636.
2016-08-13 09:52:49 -07:00
Andrew Cann
0add394ee3 Remove diagnostic E0166 2016-08-14 00:30:05 +08:00
Andrew Cann
c3131f256d Fix bug in PostExpansionVisitor 2016-08-13 21:37:09 +08:00
Andrew Cann
ef1b507535 Fix build after rebase 2016-08-13 21:37:09 +08:00
Andrew Cann
6b8dacee9e Improve comments on ! tests 2016-08-13 21:37:09 +08:00
Andrew Cann
5bd54a2468 Fix make tidy 2016-08-13 21:37:09 +08:00
Andrew Cann
29f3636282 Add explanations to tests 2016-08-13 21:37:09 +08:00
Andrew Cann
bcff5a78b3 Permit ! as T with test 2016-08-13 21:37:09 +08:00
Andrew Cann
06747c669f Add another test for ! 2016-08-13 21:37:09 +08:00
Andrew Cann
00a71ea644 Add tests for ! type 2016-08-13 21:37:09 +08:00
Andrew Cann
2eff282aef Add some tests for ! type 2016-08-13 21:37:09 +08:00
Andrew Cann
c6890e17a0 Revert Ty::is_uninhabited to its original state 2016-08-13 21:37:09 +08:00
Andrew Cann
a4e6009bf0 Minor fixups based on feedback 2016-08-13 21:37:09 +08:00
Andrew Cann
a05560bebe Add run-pass/never_coercions.rs test 2016-08-13 21:37:09 +08:00
Andrew Cann
f019a92b77 Correctly handle AdjustNeverToAny in try_find_coercion_lub 2016-08-13 21:37:09 +08:00
Andrew Cann
69e27614c6 Minor fixup. 2016-08-13 21:37:09 +08:00
Andrew Cann
a6d6fff068 Lookup node type in map rather than using write_ty_expr 2016-08-13 21:37:09 +08:00
Andrew Cann
3639341685 Default diverging types based on feature gate.
Default to either `!` or `()` depending on whether feature(never_type)
is on or not.
2016-08-13 21:37:09 +08:00
Andrew Cann
54c72d8f98 Minor fix 2016-08-13 21:37:09 +08:00
Andrew Cann
8010314190 Un-improve Ty::is_uninabited 2016-08-13 21:37:09 +08:00
Andrew Cann
fadabe08f5 Rename empty/bang to never
Split Ty::is_empty method into is_never and is_uninhabited
2016-08-13 21:37:09 +08:00
Andrew Cann
f0a8b6d43f Minor fixups based on @eddyb's feedback
Mainly, remove mk_empty() method and replace with tcx.types.empty
2016-08-13 21:37:09 +08:00
Andrew Cann
5096a8c5c0 Control usage of ! through a feature gate.
Adds the `bang_type` feature gate. `!` in a non-return-type position now
relies on that feature.
2016-08-13 21:37:09 +08:00
Andrew Cann
0e1c2aa52e Make AdjustEmptyToAny actually perform the adjustment 2016-08-13 21:37:09 +08:00
Andrew Cann
ba65d2e15b Remove invalid compile-fail tests related to !
These tests check for the old error messages "`return` in a function
declared as diverging" and "computation may converge in a function
declared as diverging". The first of these is now invalid as `return` is
permitted in functions that return `!`. The second of these is subsumed
by the "mismatched types" error.
2016-08-13 21:37:09 +08:00
Andrew Cann
51c6ae25e2 implement std::cmp::* traits for ! 2016-08-13 21:37:09 +08:00
Andrew Cann
b22beed737 Fix build after rebase to lastest master 2016-08-13 21:37:09 +08:00
Andrew Cann
ed02344fbc Remove obsolete divergence related stuff
Replace FnOutput with Ty
Replace FnConverging(ty) with ty
Purge FnDiverging, FunctionRetTy::NoReturn and FunctionRetTy::None
2016-08-13 21:37:09 +08:00
Andrew Cann
ee78f37e2a impl Debug + Display for ! 2016-08-13 21:37:09 +08:00
Andrew Cann
082915290d Make unused lint ignore unused ! 2016-08-13 21:37:09 +08:00
Andrew Cann
f31d9757f8 Fix super_relate_tys so that ! == ! 2016-08-13 21:37:09 +08:00
Andrew Cann
104963c539 Switch on TyEmpty
Parse -> ! as FnConverging(!)
Add AdjustEmptyToAny coercion to all ! expressions
Some fixes
2016-08-13 21:37:09 +08:00
Andrew Cann
9f9f8567eb Fix rustdoc after rebase 2016-08-13 21:37:09 +08:00
Andrew Cann
533a389962 Small optimization
Optimiize ExprKind::EmptyToAny expressions applied to function calls.
2016-08-13 21:37:09 +08:00
Andrew Cann
798f719daf Add run-fail/adjust_empty.rs test 2016-08-13 21:37:09 +08:00
Andrew Cann
c88c54ec5a Invoke coercions on ! 2016-08-13 21:37:09 +08:00
Andrew Cann
0d863616e0 Add EmptyToAny adjustment 2016-08-13 21:37:09 +08:00
Andrew Cann
b0a9acd783 Parse ! as TyEmpty (except in fn return type) 2016-08-13 21:37:09 +08:00
Andrew Cann
ba7330c1cc Start implementation of RFC 1216 (make ! a type)
Add `TyKind::Empty` and fix resulting build errors.
2016-08-13 21:37:09 +08:00
Ahmed Charles
ab00b940bb Predicates haven't existed in almost 5 years.
This test probably adds negative value other than historical amusement.
2016-08-13 02:45:53 -07:00
Ahmed Charles
6fbff4f06a Ensure that attributes are spelled properly. 2016-08-13 02:41:43 -07:00
José manuel Barroso Galindo
85388f0958 E0094 error message updated
Part of #35233
Fixes #35231
2016-08-13 16:32:43 +07:00