Commit Graph

1499 Commits

Author SHA1 Message Date
Eduard Burtescu
5d0a68d1d3 Do not expect blocks to have type str. 2016-02-14 15:38:48 +02:00
bors
4b7245047b Auto merge of #31588 - soltanmm:layer, r=nikomatsakis
<sup>**context:** moving back to a layered approach to type checking.</sup>

It looks like they'd not ended up tightly coupled in the time one was owned by the other. Every instance outside of `FnCtxt.inh` was from an `InferCtxt` created and dropped in the same function body.

This conflicts slightly with #30652, but there too it looks like the `FulfillmentContext` is from an `InferCtxt` that is created and dropped within the same function body (across one call to a module-private function).

That said, I heard that the PR that originally moved `FulfillmentContext` into `InferCtxt` was big, which leaves me concerned that I'm missing something.

r? @nikomatsakis
2016-02-13 15:25:23 +00:00
bors
3548b8c273 Auto merge of #31524 - jonas-schievink:autoderef, r=steveklabnik 2016-02-13 00:16:03 +00:00
Jonas Schievink
f831d98ba2 Autoderef in librustc_typeck 2016-02-12 19:28:42 +01:00
bors
ce4b75f256 Auto merge of #30726 - GuillaumeGomez:compile-fail, r=brson
r? @brson
cc @alexcrichton

I still need to add error code explanation test with this, but I can't figure out a way to generate the `.md` files in order to test example source codes.

Will fix #27328.
2016-02-12 18:25:08 +00:00
Alex Crichton
2581b14147 bootstrap: Add a bunch of Cargo.toml files
These describe the structure of all our crate dependencies.
2016-02-11 11:12:32 -08:00
Oliver Schneider
498a2e416e [breaking-change] don't pub export ast::IntLitType variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
69072c4f5d [breaking-change] don't pub export ast::Lit_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
bfa66bb389 [breaking-change] remove the sign from integer literals in the ast 2016-02-11 12:34:48 +01:00
Oliver Schneider
625e78b700 [breaking-change] don't glob export ast::{UintTy, IntTy} variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
ccf48bcd40 [breaking-change] don't glob export ast::FloatTy variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
243a30c931 [breaking-change] don't glob import/export syntax::abi enum variants 2016-02-11 12:34:48 +01:00
Masood Malekghassemi
0ff7021dd3 Move FulfillmentContext out of InferCtxt 2016-02-11 00:03:37 -08:00
Carlos E. Garcia
02aa0aff2f Minor spelling fixes 2016-02-09 11:52:39 -05:00
Guillaume Gomez
ed6b575648 Update Makefile 2016-02-09 05:22:24 +01:00
Guillaume Gomez
6407b9405f Update long error explanations 2016-02-07 13:03:35 +01:00
Niko Matsakis
8a29040989 Update collect to use the standard visit routine, rather than rolling
its own.
2016-02-05 13:19:55 -05:00
Niko Matsakis
35b6e2b0bb Instrument a bunch of tasks that employ the HIR map in one way or
another and were not previously instrumented.
2016-02-05 13:19:55 -05:00
Jeffrey Seyfried
298346dd5b Improve detection of unused imports 2016-02-03 23:39:08 +00:00
Manish Goregaokar
688f607352 Rollup merge of #31347 - GuillaumeGomez:fix_E0118, r=Manishearth
r? @eddyb
2016-02-03 02:54:25 +05:30
bors
b94cd7a5bd Auto merge of #31250 - nrc:more-aborts, r=@nikomatsakis
With this PR we can save-analysis on code with errors, essential foundation work for IDE support.
2016-02-01 21:22:59 +00:00
bors
14dc9fcc67 Auto merge of #31232 - stepancheg:enum-univariant, r=nrc
```
enum Univariant {
    X = 17
}
```

Fixes #10292
2016-02-01 07:06:05 +00:00
Nick Cameron
b6e4f18e55 Replace some aborts with Results
Fixes #31207

by removing abort_if_new_errors
2016-02-01 08:42:27 +13:00
Guillaume Gomez
db63a55b29 Fix E0118 2016-01-31 05:46:21 +01:00
Alex Crichton
3e9589c0f4 trans: Reimplement unwinding on MSVC
This commit transitions the compiler to using the new exception handling
instructions in LLVM for implementing unwinding for MSVC. This affects both 32
and 64-bit MSVC as they're both now using SEH-based strategies. In terms of
standard library support, lots more details about how SEH unwinding is
implemented can be found in the commits.

In terms of trans, this change necessitated a few modifications:

* Branches were added to detect when the old landingpad instruction is used or
  the new cleanuppad instruction is used to `trans::cleanup`.
* The return value from `cleanuppad` is not stored in an `alloca` (because it
  cannot be).
* Each block in trans now has an `Option<LandingPad>` instead of `is_lpad: bool`
  for indicating whether it's in a landing pad or not. The new exception
  handling intrinsics require that on MSVC each `call` inside of a landing pad
  is annotated with which landing pad that it's in. This change to the basic
  block means that whenever a `call` or `invoke` instruction is generated we
  know whether to annotate it as part of a cleanuppad or not.
* Lots of modifications were made to the instruction builders to construct the
  new instructions as well as pass the tagging information for the call/invoke
  instructions.
* The translation of the `try` intrinsics for MSVC has been overhauled to use
  the new `catchpad` instruction. The filter function is now also a
  rustc-generated function instead of a purely libstd-defined function. The
  libstd definition still exists, it just has a stable ABI across architectures
  and leaves some of the really weird implementation details to the compiler
  (e.g. the `localescape` and `localrecover` intrinsics).
2016-01-29 16:25:20 -08:00
bors
142214d1f2 Auto merge of #30411 - mitaa:multispan, r=nrc
This allows to render multiple spans on one line, or to splice multiple replacements into a code suggestion.

fixes #28124
2016-01-28 22:13:25 +00:00
mitaa
727f959095 Implement MultiSpan error reporting
This allows to render multiple spans on one line,
or to splice multiple replacements into a code suggestion.
2016-01-28 20:51:06 +01:00
Stepan Koltsov
641267e4c2 Allow #[repr(i32)] for univariant enum
```
#[repr(i32)]
enum Univariant {
    X = 17
}
```

Fixes #10292
2016-01-27 04:50:04 +03:00
bors
4b615854f0 Auto merge of #31120 - alexcrichton:attribute-deny-warnings, r=brson
This commit removes the `-D warnings` flag being passed through the makefiles to
all crates to instead be a crate attribute. We want these attributes always
applied for all our standard builds, and this is more amenable to Cargo-based
builds as well.

Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)`
attribute currently to match the same semantics we have today
2016-01-26 22:10:10 +00:00
Manish Goregaokar
ced313cf19 Rollup merge of #31184 - arielb1:remove-implicator, r=nikomatsakis
it is pre-RFC1214 junk and completely useless.

r? @nikomatsakis
2016-01-26 13:11:57 +05:30
bors
faf6d1e873 Auto merge of #31065 - nrc:ident-correct, r=pnkfelix
This PR adds some minor error correction to the parser - if there is a missing ident, we recover and carry on. It also makes compilation more robust so that non-fatal errors (which is still most of them, unfortunately) in parsing do not cause us to abort compilation. The effect is that a program with a missing or incorrect ident can get all the way to type checking.
2016-01-26 00:42:08 +00:00
Ariel Ben-Yehuda
e0fd9c3b00 remove implicator
it is pre-RFC1214 junk
2016-01-25 15:17:31 +02:00
Alex Crichton
2273b52023 mk: Move from -D warnings to #![deny(warnings)]
This commit removes the `-D warnings` flag being passed through the makefiles to
all crates to instead be a crate attribute. We want these attributes always
applied for all our standard builds, and this is more amenable to Cargo-based
builds as well.

Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)`
attribute currently to match the same semantics we have today
2016-01-24 20:35:55 -08:00
Steve Klabnik
9e5c8aa23f Rollup merge of #31130 - marcbowes:master, r=nrc
E0210 explains about orphan rules and suggests using a local type as a workaround. It wasn't obvious to me that I couldn't use a type alias, so I added a note.
2016-01-23 09:38:44 -05:00
Steve Klabnik
e598b43243 Rollup merge of #30997 - bluss:trait-default, r=nikomatsakis
Fix type parameter default error to mention type and trait definitions

Introduced in PR #30724, needs to mention that type parameter defaults
are legal in trait and type definitions too.
2016-01-23 09:38:41 -05:00
bors
8ff48fea13 Auto merge of #31126 - arielb1:remote-errors, r=eddyb
Also removed an unused and similarly buggy error path.

Fixes #30535

r? @eddyb
2016-01-23 05:54:38 +00:00
Marc Bowes
97f9cad569 E0210: Add a warning about type aliases
E0210 explains about orphan rules and suggests using a local type as a
workaround. It wasn't obvious to me that I couldn't use a type
alias, so I added a note.
2016-01-22 22:20:36 +02:00
Ariel Ben-Yehuda
f78ce412ef astconv: don't use as_local_node_id for ids in a Def
Fixes #30535
2016-01-22 21:27:34 +02:00
Nick Cameron
f3b525fb97 test fallout 2016-01-22 08:19:27 +13:00
Nick Cameron
585cf6fb5f Prevent missing idents from causing problems down the line 2016-01-22 08:19:27 +13:00
Ariel Ben-Yehuda
29c296f90b clean up trans_static_method_callee and friends 2016-01-21 14:42:09 +02:00
Vadim Petrochenkov
2084c2c33a Rename Def's variants and don't reexport them 2016-01-20 22:31:10 +03:00
Vadim Petrochenkov
ceaaa1bc33 Refactor definitions of ADTs in rustc::middle::def 2016-01-20 21:50:57 +03:00
Ulrik Sverdrup
9d77694d5d Fix type parameter default error to mention type and trait definitions
Introduced in PR #30724, needs to mention that type parameter defaults
are legal in trait and type definitions too.
2016-01-19 12:38:24 +01:00
bors
0b524edb04 Auto merge of #30931 - oli-obk:trans_disr_newtype, r=arielb1
This is groundwork for #30587 (typestrong constant integrals), but imo it's a change that in itself is good, too, since we don't just juggle `u64`s around anymore.

`ty::Disr` will be changed to a `ConstInt` in #30587
2016-01-17 10:31:47 +00:00
bors
c14b615534 Auto merge of #30533 - nikomatsakis:fulfillment-tree, r=aturon
This PR introduces an `ObligationForest` data structure that the fulfillment context can use to track what's going on, instead of the current flat vector. This enables a number of improvements:

1. transactional support, at least for pushing new obligations
2. remove the "errors will be reported" hack -- instead, we only add types to the global cache once their entire subtree has been proven safe. Before, we never knew when this point was reached because we didn't track the subtree.
   - this in turn allows us to limit coinductive reasoning to structural traits, which sidesteps #29859
3. keeping the backtrace should allow for an improved error message, where we give the user full context
    - we can also remove chained obligation causes

This PR is not 100% complete. In particular:

- [x] Currently, types that embed themselves like `struct Foo { f: Foo }` give an overflow when evaluating whether `Foo: Sized`. This is not a very user-friendly error message, and this is a common beginner error. I plan to special-case this scenario, I think.
- [x] I should do some perf. measurements. (Update: 2% regression.)
- [x] More tests targeting #29859
- [ ] The transactional support is not fully integrated, though that should be easy enough.
- [ ] The error messages are not taking advantage of the backtrace.

I'd certainly like to do 1 through 3 before landing, but 4 and 5 could come as separate PRs.

r? @aturon // good way to learn more about this part of the trait system
f? @arielb1 // already knows this part of the trait system :)
2016-01-16 16:03:22 +00:00
Oliver 'ker' Schneider
6fef118bc0 use a newtype for the variant discriminant instead of u64 2016-01-16 16:03:09 +01:00
Niko Matsakis
0723d6c6ed Pacify tidy. 2016-01-16 05:22:33 -05:00
Niko Matsakis
3046ac217f Detect cycles and specialize error reporting for Sized. It is important
to get the `Sized` error usable, since that hits new users
frequently. Further work is needed for the error reporting for non-Sized
cycle cases; those currently just fallback to the old path. Also adjust tests.
2016-01-16 05:22:32 -05:00
Niko Matsakis
20e088c4e2 fallout from removing the errors_will_be_reported flag 2016-01-16 05:22:32 -05:00