107038 Commits

Author SHA1 Message Date
Camille GILLOT
2a899e2a2f Make TraitCandidate generic. 2020-02-13 16:47:51 +01:00
Camille GILLOT
4706c38e17 Use HirId in TraitCandidate. 2020-02-13 16:39:09 +01:00
Mazdak Farrokhzad
ad72c3abb9 parser: inline parse_assoc_macro_invoc 2020-02-13 16:29:10 +01:00
Mazdak Farrokhzad
aaaf0ba072 parser: misc small item related improvements & cleanups. 2020-02-13 16:29:10 +01:00
Mazdak Farrokhzad
46d3ef58a8 parser: extract recover_const_mut. 2020-02-13 15:16:36 +01:00
Mazdak Farrokhzad
15e07a6a11 parser: fuse trait parsing & layer with is_path_start_item 2020-02-13 15:16:36 +01:00
Mazdak Farrokhzad
fd64b3bcdf parser: make eat_macro_def redundant. 2020-02-13 15:16:36 +01:00
Mazdak Farrokhzad
c2026030b5 parser: remove Option<Vec<Attribute>> in ItemInfo. 2020-02-13 15:16:36 +01:00
Mazdak Farrokhzad
20ba6875e6 parser_item_mod: avoid cloning outer attributes 2020-02-13 15:16:36 +01:00
Mazdak Farrokhzad
73d5970cdc parser: introduce parse_item_kind as central ItemInfo logic.
this also extracts macro item parsers.
2020-02-13 15:16:36 +01:00
Mazdak Farrokhzad
511dfdb8b3 parser: extract recover_missing_kw_before_item 2020-02-13 15:16:36 +01:00
Mazdak Farrokhzad
7737d0ffde parser: unify item list parsing.
as a consequence, `trait X { #![attr] }` becomes legal.
2020-02-13 15:16:29 +01:00
Mazdak Farrokhzad
9fed2d587c parser: extract common foreign item code for each kind 2020-02-13 14:43:20 +01:00
Mazdak Farrokhzad
cec2a9fad0 macro_legacy_warnings -> error 2020-02-13 13:59:49 +01:00
bors
d538b80ad7 Auto merge of #68969 - RalfJung:dont-panic, r=oli-obk
remove Panic variant from InterpError

The interpreter engine itself does not raise `Panic` errors any more, so remove them from the error enum. Instead, const-prop and const-eval have to do their own handling of panics.

I used the opportunity to refactor the const-eval error handling a bit to use the `MachineStop` variant.

Also, in const-prop I could do some cleanup as now, no more lints are being reported in `use_ecx`. However, I am quite puzzled by why exactly the linting there works the way it does -- the code can certainly be cleaned up more, but I don't know enough of the intent to do that. I left some questions for the most confusing parts, but for now behavior should be unchanged by this PR (so, all that weirdness I am asking about is pre-existing and merely maintained here). Cc @wesleywiser

Fixes https://github.com/rust-lang/rust/issues/66902

r? @oli-obk
2020-02-13 12:53:43 +00:00
Mazdak Farrokhzad
f5bd9646be fix extra subslice lowering 2020-02-13 12:24:53 +01:00
Ralf Jung
33ba83c3a0
fix typo 2020-02-13 11:26:09 +01:00
Mazdak Farrokhzad
ec43450015 expand: simplify flat_map_item wrt. inline module detection 2020-02-13 11:25:34 +01:00
Mazdak Farrokhzad
dc6bd6a123 expand: simplify flat_map_item 2020-02-13 11:25:34 +01:00
Mazdak Farrokhzad
fcce5fa6e7 expand: simplify classify_* 2020-02-13 11:25:33 +01:00
Mazdak Farrokhzad
7518492315 expand: extract error_wrong_fragment_kind 2020-02-13 11:25:33 +01:00
Mazdak Farrokhzad
acad033424 expand: extract error_recursion_limit_reached 2020-02-13 11:25:33 +01:00
Ralf Jung
10f342abae miri: fix exact_div 2020-02-13 11:21:29 +01:00
Ralf Jung
ed2f22c5a9 rename PanicInfo -> AssertKind 2020-02-13 11:04:49 +01:00
Ralf Jung
7e7d1c39ed improve comments:
- comment for special handling of Shl/Shr
- reference a PR
2020-02-13 11:04:26 +01:00
Ralf Jung
55339f2eb7 small cleanup in ConstEvalErr::struct_generic 2020-02-13 11:04:26 +01:00
Ralf Jung
6457b29104 move PanicInfo to mir module 2020-02-13 11:04:26 +01:00
Ralf Jung
17a8cfd605 no need for hook_panic_fn to return a bool 2020-02-13 10:56:38 +01:00
Ralf Jung
f3ff02bdd8 remove PanicInfo::Panic variant that MIR does not use or need 2020-02-13 10:56:38 +01:00
Ralf Jung
c5709ff6b7 const-prop: handle overflow_check consistently for all operators 2020-02-13 10:56:38 +01:00
Ralf Jung
0633a0e380 remove Panic variant from InterpError 2020-02-13 10:54:37 +01:00
Mazdak Farrokhzad
64ea295fe9 expand: extract error_derive_forbidden_on_non_adt 2020-02-13 10:44:44 +01:00
Mazdak Farrokhzad
b8b32a9be3 simplify config::features 2020-02-13 10:44:44 +01:00
Mazdak Farrokhzad
4f17dce4dc StripUnconfigured::in_cfg: simplify with slice patterns 2020-02-13 10:44:44 +01:00
bors
be493fe8cc Auto merge of #69023 - Centril:parse_fn, r=petrochenkov
parse: unify function front matter parsing

Part of https://github.com/rust-lang/rust/pull/68728.

- `const extern fn` feature gating is now done post-expansion such that we do not have conditional compatibilities of function qualifiers *in parsing*.

- The `FnFrontMatter` grammar becomes:
   ```rust
   Extern = "extern" StringLit ;
   FnQual = "const"? "async"? "unsafe"? Extern? ;
   FnFrontMatter = FnQual "fn" ;
   ```

   That is, all item contexts now *syntactically* allow `const async unsafe extern "C" fn` and use semantic restrictions to rule out combinations previously prevented syntactically. The semantic restrictions include in particular:

   - `fn`s in `extern { ... }` can have no qualifiers.
   - `const` and `async` cannot be combined.

- We change `ast::{Unsafety, Spanned<Constness>}>` into `enum ast::{Unsafe, Const} { Yes(Span), No }` respectively. This change in formulation allow us to exclude `Span` in the case of `No`, which facilitates parsing. Moreover, we also add a `Span` to `IsAsync` which is renamed to `Async`. The new `Span`s in `Unsafety` and `Async` are then taken advantage of for better diagnostics. A reason this change was made is to have a more uniform and clear naming scheme.

  The HIR keeps the structures in AST (with those definitions moved into HIR) for now to avoid regressing perf.

r? @petrochenkov
2020-02-13 09:42:10 +00:00
Mazdak Farrokhzad
9828559aad parser: is_fn_front_matter -> check_fn_front_matter 2020-02-13 10:40:17 +01:00
Mazdak Farrokhzad
4ca3bbf0b2 parser: add test for 'extern crate async' 2020-02-13 10:40:17 +01:00
Mazdak Farrokhzad
27f60906aa rustc_bulltin_macros: tweak span_labels 2020-02-13 10:40:17 +01:00
Mazdak Farrokhzad
3341c94006 ast_validation: tweak diagnostic output 2020-02-13 10:40:17 +01:00
Mazdak Farrokhzad
79d139ac70 parser: simplify ParamCfg -> ReqName 2020-02-13 10:40:17 +01:00
Mazdak Farrokhzad
05e5530577 parser: address review comments 2020-02-13 10:39:24 +01:00
Mazdak Farrokhzad
cdbbc25cc3 parser: move ban_async_in_2015 to fn parsing & improve it. 2020-02-13 10:39:24 +01:00
Mazdak Farrokhzad
0425379195 parser: inline parse_assoc_fn and friends. 2020-02-13 10:39:24 +01:00
Mazdak Farrokhzad
b05e9d2b4d parser: solidify fn parsing with parse_fn. 2020-02-13 10:39:24 +01:00
Mazdak Farrokhzad
a833be2162 parser: fuse free fn parsing together. 2020-02-13 10:39:24 +01:00
Mazdak Farrokhzad
36a17e4067 parser_fn_front_matter: allow const .. extern 2020-02-13 10:39:24 +01:00
Mazdak Farrokhzad
c30f068dc8 IsAsync -> enum Async { Yes { span: Span, .. }, No }
use new span for better diagnostics.
2020-02-13 10:39:24 +01:00
Mazdak Farrokhzad
e839b2ec84 Constness -> enum Const { Yes(Span), No }
Same idea for `Unsafety` & use new span for better diagnostics.
2020-02-13 10:39:23 +01:00
Jethro Beekman
57a62f5335 Add comment to SGX entry code 2020-02-13 10:16:28 +01:00
Andreas Jonson
cec0ed0219 add selfprofiling for new llvm passmanager 2020-02-13 08:02:18 +01:00