Commit Graph

502 Commits

Author SHA1 Message Date
bors
f32f1113c9 Auto merge of #55150 - pnkfelix:issues-47215-54797-fix-ice-from-moving-out-of-thread-local-under-ast-borrowck, r=nikomatsakis
Do not allow moving out of thread local under ast borrowck

AST borrowck failed to prevent moving out of a thread-local static.

This was broken. And it also (sometimes?) caused an ICE during drop elaboration.

Fix #47215
Fix #54797
2018-10-27 09:56:37 +00:00
Felix S. Klock II
26c406945b Remove PlaceContext from API of mir::Visitor::visit_projection_elem.
It is unused, and would not make sense to maintain in the commits later in this PR.
2018-10-26 23:40:38 +02:00
Matthias Krüger
4972beaf65 fix typos in various places 2018-10-23 15:56:25 +02:00
Oliver Scherer
ee81739dc1 Deprecate the FxHashMap() and FxHashSet() constructor function hack 2018-10-19 14:34:44 +02:00
Felix S. Klock II
a75f7810a7 AST-borrowck: add separate mem category for thread-locals, as they are not quite rvalues
(and of course they are not quite statics either).

Namely, they *do* have a restricted region (like rvalues), but they
also cannot be moved out of (like statics).
2018-10-17 16:31:22 +02:00
Oliver Schneider
9e46c0b689 Only promote calls to #[rustc_promotable] const fns 2018-10-03 10:07:05 +02:00
Ralf Jung
1397836380 do not promote comparing function pointers 2018-09-30 19:48:54 +02:00
Josh Stone
ce034951fb Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
bors
4591a245c7 Auto merge of #54188 - lqd:fallout-53695, r=nikomatsakis
NLL: disallow creation of immediately unusable variables

Fix #53695

Original description follows

----

This WIP PR is for discussing the impact of fixing #53695 by injecting a fake read in let patterns.

(Travis will fail, at least the `mir-opt` suite is failing in its current state)
2018-09-22 20:38:19 +00:00
Remy Rakic
f5e310530a Refactor 'ReadForMatch' into 'FakeRead' and add the cause of the fake read 2018-09-18 14:36:37 +02:00
Vitaly _Vi Shukela
d0790c490a
Whitespace fix again. 2018-09-17 20:26:05 +03:00
Vitaly _Vi Shukela
2b77760944
Fill in suggestions Applicability according to @estebank
Also fix some formatting along the way.
2018-09-17 03:20:08 +03:00
Vitaly _Vi Shukela
6ebb9161ea
Fix style according to review comments. 2018-09-17 02:49:27 +03:00
Vitaly _Vi Shukela
b6fea3255c
Remove usages of span_suggestion without Applicability
Use Applicability::Unspecified for all of them instead.
2018-09-16 21:42:46 +03:00
F001
2157958b27 introduce SelfCtor 2018-09-13 12:27:29 +08:00
bors
6810f5286b Auto merge of #53793 - toidiu:ak-stabalize, r=nikomatsakis
stabilize outlives requirements

https://github.com/rust-lang/rust/issues/44493

r? @nikomatsakis
2018-09-12 11:27:48 +00:00
kennytm
b365de94df
Rollup merge of #54031 - ljedrz:cleanup_passes, r=oli-obk
A few cleanups and minor improvements to rustc_passes

- prefer `if let` to `match` when only one branch matters
- prefer equality checks to pattern matching
- prefer `is_empty` to `len() == 0`
- collapse a couple of `if` expressions
- rename `label` to `destination` when destructuring `hir::ExprKind::Continue`
- `derive Copy` for `Promotability`
- `impl BitAndAssign` for `Promotability`
- a few formatting fixes
- a few other minor cleanups
2018-09-12 12:17:26 +08:00
bors
2f1547c0aa Auto merge of #53873 - nikomatsakis:nll-universe-subtyping-and-pattern-ascription, r=pnkfelix
support ascription for patterns in NLL

This implements the strategy outlined in [this comment](https://github.com/rust-lang/rust/issues/47184#issuecomment-416669986):

- We first extend the NLL subtyping code so it can handle inference variables and subtyping.
- Then we extend HAIR patterns with type ascription.
- Then we treat the type `T` in `let pat: T = ...` as an ascription.

Before landing, a few things:

- [x] Fix the WF rule bug (filed a FIXME https://github.com/rust-lang/rust/issues/54105)
- [x] Fix an ICE I encountered locally around bound regions, or else file a follow-up
- [x] More tests probably =)

r? @pnkfelix
2018-09-11 20:59:11 +00:00
toidiu
731f4efae5 stabalize infer outlives requirements (RFC 2093).
Co-authored-by: nikomatsakis
2018-09-11 11:40:04 -04:00
Niko Matsakis
dd3cc9669a add the AscribeUserType statement kind
Make it have the semantics of subtype.
2018-09-10 08:22:31 -04:00
bors
fb945f0ebb Auto merge of #53854 - davidtwco:issue-53668, r=nikomatsakis
if- and while-let-chains, take 2 - edition changes

Part of #53668.

r? @nikomatsakis
2018-09-10 04:05:14 +00:00
ljedrz
8bbe1789fa A few cleanups and minor improvements to rustc_passes 2018-09-07 15:10:16 +02:00
David Wood
0a8cf67e61
Added note referencing issue which added error. 2018-09-07 00:37:44 +02:00
David Wood
8c92cbe90e
Moved let-chain warning/error to ast_validation and changed to unconditional error. 2018-09-02 10:54:28 +02:00
bors
28bcffead7 Auto merge of #53815 - F001:if-let-guard, r=petrochenkov
refactor match guard

This is the first step to implement RFC 2294: if-let-guard. Tracking issue: https://github.com/rust-lang/rust/issues/51114

The second step should be introducing another variant `IfLet` in the Guard enum. I separated them into 2 PRs for the convenience of reviewers.

r? @petrochenkov
2018-09-01 20:31:29 +00:00
bors
fea32f1b77 Auto merge of #53604 - oli-obk:min_const_fn, r=Centril,varkor
Implement the `min_const_fn` feature gate

cc @RalfJung @eddyb

r? @Centril

implements the feature gate for #53555

I added a hack so the `const_fn` feature gate also enables the `min_const_fn` feature gate. This ensures that nightly users of `const_fn` don't have to touch their code at all.

The `min_const_fn` checks are run first, and if they succeeded, the `const_fn` checks are run additionally to ensure we didn't miss anything.
2018-09-01 11:26:24 +00:00
bors
163adf2860 Auto merge of #53699 - oli-obk:promotion_stability_hole, r=nikomatsakis
Fix promotion stability hole in old borrowck

r? @nikomatsakis

I screwed up the promotion stability checks. Big time. They were basically nonexistant. We had tests for it. I also screwed up said tests. This is in stable already :(

Basically stability checks of promotion only worked if you tried to use a const fn defined in the same crate.

cc @eddyb
2018-08-31 14:06:14 +00:00
Oliver Schneider
472ca71598 Implement the min_const_fn feature gate 2018-08-31 08:39:59 +02:00
F001
7a083ca25f introduce Guard enum 2018-08-30 12:18:11 +08:00
varkor
e2a1cce9c5 Rename hir::map::NodeKind to hir::Node 2018-08-27 21:46:23 +01:00
varkor
11665ca45a Remove path prefixes from NodeKind 2018-08-27 21:46:13 +01:00
varkor
befc4b1100 Rename hir::map::Node to hir::map::NodeKind 2018-08-27 21:45:46 +01:00
Oliver Schneider
458f5a21e2 Properly prevent the promotion of unstable const fns 2018-08-25 14:58:39 +02:00
Niko Matsakis
73fb1622b3 check that adding infer-outlives requirement to all crates works 2018-08-24 17:10:50 -04:00
bors
f1b506af02 Auto merge of #53607 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 10 pull requests

Successful merges:

 - #53418 (Mark some suggestions as MachineApplicable)
 - #53431 (Moved some feature gate ui tests to correct location)
 - #53442 (Update version of rls-data used with save-analysis)
 - #53504 (Set applicability for more suggestions.)
 - #53541 (Fix missing impl trait display as ret type)
 - #53544 (Point at the trait argument when using unboxed closure)
 - #53558 (Normalize source line and column numbers.)
 - #53562 (Lament the invincibility of the Turbofish)
 - #53574 (Suggest direct raw-pointer dereference)
 - #53585 (Remove super old comment on function that parses items)

Failed merges:

 - #53472 (Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.)
 - #53563 (use String::new() instead of String::from(""), "".to_string(), "".to_owned() or "".into())

r? @ghost
2018-08-22 19:59:52 +00:00
Guillaume Gomez
4fa4bb5633
Rollup merge of #53504 - ekse:suggestions-applicability-2, r=estebank
Set applicability for more suggestions.

Converts a couple more calls to `span_suggestion_with_applicability`  (#50723). To be on the safe side, I marked suggestions that depend on the intent of the user or that are potentially lossy conversions as MaybeIncorrect.

r? @estebank
2018-08-22 17:45:34 +02:00
varkor
6f637da50c Remove Ty prefix from Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error} 2018-08-22 16:07:44 +01:00
bors
1558ae7cfd Auto merge of #51880 - varkor:generics-hir-generalisation-followup, r=eddyb
The Great Generics Generalisation: HIR Followup

Addresses the final comments in #48149.

r? @eddyb, but there are a few things I have yet to clean up. Making the PR now to more easily see when things break.

cc @yodaldevoid
2018-08-20 15:47:39 +00:00
varkor
aa3b5c58e4 Fix diagnostic regression 2018-08-20 16:16:39 +01:00
Sébastien Duquette
5a23a0d283 Set applicability for more suggestions. 2018-08-20 03:56:06 -04:00
Donato Sciarra
82607d2cf3 mv (mod) codemap source_map 2018-08-19 23:01:00 +02:00
varkor
11adc1300c Address minor comments 2018-08-19 20:02:32 +01:00
varkor
5c814e2e4e Clean up and add extra tests 2018-08-11 21:25:48 +01:00
varkor
e4c3b49fe7 Emit an error during parsing 2018-08-11 21:08:24 +01:00
varkor
a478cd41e3 Improve diagnostics 2018-08-11 21:08:24 +01:00
varkor
235905c080 Fix handling of trait methods with bodies and improve efficiency 2018-08-11 21:08:24 +01:00
varkor
b05f0bec1a Suggest replacing patterns with underscores 2018-08-11 21:08:24 +01:00
varkor
90a6954327 Emit error for pattern arguments in trait methods
The error and check for this already existed, but the parser didn't try to parse trait method arguments as patterns, so the error was never emitted. This surfaces the error, so we get better errors than simple parse errors.
2018-08-11 21:08:24 +01:00
memoryruins
95b64188c9 [nll] librustc_passes: enable feature(nll) for bootstrap 2018-08-09 04:09:07 -04:00
Mark Rousskov
3baec3cdd7 Add HirId to VisibilityKind::Restricted 2018-08-07 10:13:17 -06:00