Commit Graph

92807 Commits

Author SHA1 Message Date
bors
92b5e20ad5 Auto merge of #59008 - varkor:const-generics-infer, r=eddyb
Add const generics to infer (and transitive dependencies)

Split out from #53645. This work is a collaborative effort with @yodaldevoid.

There are a number of stubs. These are mainly to ensure we don't overlook them when completing the implementation, but are not necessary for the initial implementation. We plan to address these in follow up PRs.

r? @eddyb / @nikomatsakis
2019-05-02 04:47:36 +00:00
bors
767f594626 Auto merge of #60460 - Centril:rollup-gz5bc8i, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #59634 (Added an explanation for the E0704 error.)
 - #60348 (move some functions from parser.rs to diagostics.rs)
 - #60385 (Emit metadata files earlier)
 - #60428 (Refactor `eval_body_using_ecx` so that it doesn't need to query for MIR)
 - #60437 (Ensure that drop order of `async fn` matches `fn` and that users cannot refer to generated arguments.)
 - #60439 (doc: Warn about possible zombie apocalypse)
 - #60452 (Remove Context and ContextKind)

Failed merges:

r? @ghost
2019-05-02 02:01:31 +00:00
Mazdak Farrokhzad
4ff12347d9
Rollup merge of #60452 - JohnTitor:remove-context, r=matthewjasper
Remove Context and ContextKind

Fixes #60421

r? @matthewjasper
2019-05-02 01:09:32 +02:00
Mazdak Farrokhzad
3dfee3a038
Rollup merge of #60439 - vorner:zombie-apocalypse-warn, r=TimNN
doc: Warn about possible zombie apocalypse

Extend the std::process::Child docs with warning about possible zombies.
The previous version mentioned that when dropping the Child, the
process is not killed. However, the wording gave the impression that
such behaviour is fine to do (leaving the reader believe low-level
details like reaping zombies of the dead processes is taken over by std
somehow; or simply leaving the reader unaware about the problem).
2019-05-02 01:09:31 +02:00
Mazdak Farrokhzad
16939a50ea
Rollup merge of #60437 - davidtwco:issue-60236, r=nikomatsakis
Ensure that drop order of `async fn` matches `fn` and that users cannot refer to generated arguments.

Fixes #60236 and fixes #60438.

This PR modifies the lowering of `async fn` arguments so that the
drop order matches the equivalent `fn`.

Previously, async function arguments were lowered as shown below:

    async fn foo(<pattern>: <ty>) {
      async move {
      }
    } // <-- dropped as you "exit" the fn

    // ...becomes...
    fn foo(__arg0: <ty>) {
      async move {
        let <pattern> = __arg0;
      } // <-- dropped as you "exit" the async block
    }

After this PR, async function arguments will be lowered as:

    async fn foo(<pattern>: <ty>, <pattern>: <ty>, <pattern>: <ty>) {
      async move {
      }
    } // <-- dropped as you "exit" the fn

    // ...becomes...
    fn foo(__arg0: <ty>, __arg1: <ty>, __arg2: <ty>) {
      async move {
        let __arg2 = __arg2;
        let <pattern> = __arg2;
        let __arg1 = __arg1;
        let <pattern> = __arg1;
        let __arg0 = __arg0;
        let <pattern> = __arg0;
      } // <-- dropped as you "exit" the async block
    }

If `<pattern>` is a simple ident, then it is lowered to a single
`let <pattern> = <pattern>;` statement as an optimization.

This PR also stops users from referring to the generated `__argN`
identifiers.

r? @nikomatsakis
2019-05-02 01:09:29 +02:00
Mazdak Farrokhzad
12bf981552
Rollup merge of #60428 - wesleywiser:refactor_const_eval, r=oli-obk
Refactor `eval_body_using_ecx` so that it doesn't need to query for MIR

This is the first step toward removing the `mir` field of `ConstPropagator` which will eventually allow us to actually const propagate in MIR.

r? @oli-obk
2019-05-02 01:09:28 +02:00
Mazdak Farrokhzad
a7cbd92d13
Rollup merge of #60385 - nnethercote:earlier-metadata, r=alexcrichton
Emit metadata files earlier

This will make cargo pipelining much more effective.
2019-05-02 01:09:26 +02:00
Mazdak Farrokhzad
01ce87ad14
Rollup merge of #60348 - agnxy:refactor-parser, r=petrochenkov
move some functions from parser.rs to diagostics.rs

Starting with a few functions mentioned in https://github.com/rust-lang/rust/issues/60015#issuecomment-484259773. We might refactor parser.rs further in subsequent changes.
r? @petrochenkov
2019-05-02 01:09:25 +02:00
Mazdak Farrokhzad
eabdce578b
Rollup merge of #59634 - DevQps:explain-E0704, r=estebank
Added an explanation for the E0704 error.

# Description
Adds an explanation on the E0704 error. I tried to stick as closely to the message that the compiler generates. It's the first time I am fixing error messages here, so if there is something I did wrong or should improve, please let me know.

closes #55398
2019-05-02 01:09:23 +02:00
bors
ea68bee369 Auto merge of #60432 - Manishearth:clippyup, r=Manishearth
Update clippy

r? @ghost
2019-05-01 23:00:14 +00:00
Manish Goregaokar
badbd956bd Update clippy 2019-05-01 15:24:52 -07:00
Yuki Okushi
99ebb7a517 Remove Context and ContextKind 2019-05-02 07:12:32 +09:00
varkor
a68ed060bd Split ct_err out into CommonConsts
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-05-01 23:12:31 +01:00
varkor
541de81f8e Create ShallowResolver
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-05-01 23:11:20 +01:00
varkor
1369132afa Add a test for const args that cannot be inferred
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-05-01 23:11:20 +01:00
varkor
a188850ded Add a test for incorrect numbers of const args 2019-05-01 23:11:19 +01:00
varkor
16d6ee3952 Fold const in writeback 2019-05-01 23:11:19 +01:00
varkor
c7deb5bdc2 Add a test for const arguments 2019-05-01 23:11:19 +01:00
varkor
a29eca5d82 Fix issue with const params in operand.rs 2019-05-01 23:11:19 +01:00
varkor
beb2f84b31 Resolve FIXME in probe.rs 2019-05-01 23:11:19 +01:00
varkor
388f823c03 Correct name of constrained_generic_params alias 2019-05-01 23:11:19 +01:00
varkor
d8b1ddba9b Fix unused variable warning 2019-05-01 23:11:19 +01:00
varkor
b872e63585 Fix known-known const unification case 2019-05-01 23:11:19 +01:00
varkor
97c0c6653b Remove spurious assertion 2019-05-01 23:11:19 +01:00
varkor
67176f751b Add const-types test 2019-05-01 23:11:19 +01:00
varkor
5cf45bc27a Fix rebase issue 2019-05-01 23:11:19 +01:00
varkor
972e254106 Implement const generics for InferenceFudger 2019-05-01 23:11:19 +01:00
varkor
f241693662 Fix missing parenthesis 2019-05-01 23:11:19 +01:00
varkor
d8b9387ace Take ConstValue::Placeholder into account in new locations 2019-05-01 23:11:19 +01:00
varkor
fc16b0a147 Fix rebase from LazyConst removal 2019-05-01 23:11:19 +01:00
varkor
c888af52be Replace ConstVariableTable with UnificationTable 2019-05-01 23:10:58 +01:00
varkor
2308d2d68a Handle ConstValue::Placeholder in canonicalizer 2019-05-01 23:10:57 +01:00
varkor
e70797b575 Add PlaceholderConst 2019-05-01 23:10:57 +01:00
varkor
f5712d2de0 Add ConstValue::Placeholder 2019-05-01 23:10:57 +01:00
varkor
245a474ab7 Inline ConstError into TypeError 2019-05-01 23:10:57 +01:00
varkor
cf1a719c19 Implement fold_const for BoundVarReplacer 2019-05-01 23:10:57 +01:00
Gabriel Smith
fa394c2283 impl fold_const for Shifter
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
2019-05-01 23:10:57 +01:00
Gabriel Smith
57d3a5a32d impl visit_const for HasEscapingVarsVisitor
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
2019-05-01 23:10:57 +01:00
Gabriel Smith
c13aa09d49 impl fold_const for TypeFreshener
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
2019-05-01 23:10:57 +01:00
Gabriel Smith
e965b75603 impl mk_const_infer
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
2019-05-01 23:10:57 +01:00
Gabriel Smith
bd2fa222c0 Rename mk_infer to mk_ty_infer
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
2019-05-01 23:10:57 +01:00
Gabriel Smith
7bf175f30c impl fold_const for RegionFudger
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
2019-05-01 23:10:57 +01:00
varkor
ef1b2acf12 Remove fold_const override for ReverseMapper
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-05-01 23:10:57 +01:00
varkor
ed3dae4aca Rename *shallow_resolve to *shallow_resolve_type
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-05-01 23:10:57 +01:00
varkor
3f675ab038 Drive-by comment fixes
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-05-01 23:10:57 +01:00
varkor
d113ff8ada Handle generic consts in relate and infer
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-05-01 23:10:57 +01:00
varkor
69423b3345 Add stubs for fold_const
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-05-01 23:10:57 +01:00
varkor
bfc39b9b87 Implement TypeRelation::consts
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-05-01 23:10:57 +01:00
varkor
7d71a1c8a4 Add const generics to unification tables
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-05-01 23:10:57 +01:00
varkor
b9b9994c72 Define const_unification_error
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-05-01 23:10:57 +01:00