Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] The Genesis of Generic Germination #53645

Open
wants to merge 49 commits into
base: master
from

Conversation

@varkor
Copy link
Member

varkor commented Aug 23, 2018

Long had its coming been foretold: a collaborative effort with @yodaldevoid, set in motion by @jplatte, to beget a new Kind: one of a very different Sort to those that come before it. Amidst promises of ineffable powers previously thought unobtainable, few dared believe that the prophecies were true. But as they gazed upon that which claimed to be the Beginning, a few gentle sparks of hope fluttered deep within. It was not Time yet. But it was a Sign. And maybe, for some, that was enough.

There's a long way to go, but we're at the point where we would benefit from GitHub's reviewing capabilities.

r? @eddyb

@rust-highfive

This comment was marked as off-topic.

Copy link
Collaborator

rust-highfive commented Aug 23, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.

[00:04:28] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:28] tidy error: /checkout/src/librustc_resolve/lib.rs:138: line longer than 100 chars
[00:04:28] tidy error: /checkout/src/librustdoc/core.rs:225: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustdoc/html/render.rs:1470: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustdoc/clean/mod.rs:1258: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustdoc/clean/mod.rs:2547: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustdoc/clean/mod.rs:2798: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustdoc/clean/mod.rs:3759: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/libsyntax/parse/parser.rs:5047: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/libsyntax/parse/parser.rs:5187: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustc/ty/context.rs:2279: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustc/ty/sty.rs:117: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustc/ty/subst.rs:508: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustc/ty/relate.rs:481: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustc/ty/relate.rs:614: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustc/ty/relate.rs:620: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustc/infer/mod.rs:592: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustc/infer/mod.rs:917: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustc_typeck/check/mod.rs:5190: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustc_typeck/diagnostics.rs:1043: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustc_typeck/diagnostics.rs:1071: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustc_typeck/astconv.rs:1534: TODO is deprecated; use FIXME
[00:04:28] tidy error: /checkout/src/librustc_typeck/collect.rs:1191: TODO is deprecated; use FIXME
[00:04:28] tidy error: duplicate error code: 85
[00:04:28] tidy error: /checkout/src/librustc_typeck/diagnostics.rs:1045: E0085: r##"
[00:04:28] tidy error: /checkout/src/librustc_typeck/diagnostics.rs:4798: //  E0085,
[00:04:28] tidy error: duplicate error code: 107
[00:04:28] tidy error: /checkout/src/librustc_typeck/diagnostics.rs:1043: // TODO(const_generics:docs): these should be unified with E0107 (i.e. these can just be
[00:04:28] tidy error: /checkout/src/librustc_typeck/diagnostics.rs:1291: E0107: r##"
[00:04:28] tidy error: duplicate error code: 86
[00:04:28] tidy error: /checkout/src/librustc_typeck/diagnostics.rs:1060: E0086: r##"
[00:04:28] tidy error: /checkout/src/librustc_typeck/diagnostics.rs:4799: //  E0086,
[00:04:29] Expected a gate test for the feature 'const_generics'.
[00:04:29] Hint: create a failing test file named 'feature-gate-const_generics.rs'
[00:04:29] tidy error: Found 1 features without a gate test.
[00:04:29]       in the 'ui' test suite, with its failures due to
[00:04:29]       missing usage of #![feature(const_generics)].
[00:04:29] Hint: If you already have such a test and don't want to rename it,
[00:04:29]       you can also add a // gate-test-const_generics line to the test file.
[00:04:29] some tidy checks failed
[00:04:29] 
[00:04:29] 
[00:04:29] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:29] 
[00:04:29] 
[00:04:29] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:29] Build completed unsuccessfully in 0:00:50
[00:04:29] Build completed unsuccessfully in 0:00:50
[00:04:29] make: *** [tidy] Error 1
[00:04:29] Makefile:79: recipe for target 'tidy' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0d7ce8e7
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:213c91e3:start=1535050856368938027,finish=1535050856377184018,duration=8245991
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0abcf093
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0080c712
travis_time:start:0080c712
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0a56e2c7
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Aug 24, 2018

☔️ The latest upstream changes (presumably #53662) made this pull request unmergeable. Please resolve the merge conflicts.

@kennytm

This comment has been minimized.

Copy link
Member

kennytm commented Aug 28, 2018

(Somehow I read the title as "Genesis of Germanic Germination" and thought why we're adding i18n into rustc itself 😐)

@petrochenkov petrochenkov self-assigned this Aug 28, 2018

Show resolved Hide resolved src/librustc/hir/mod.rs Outdated
// parsing problem. Either mark all const args with const (or
// something else, it doesn't really matter) or merge const args
// and type args together at the AST level and separate them
// later on, probably when lowering to the HIR.

This comment has been minimized.

@petrochenkov

petrochenkov Aug 31, 2018

Contributor

If S<MY_CONST> is supposed to work, then it can use same approach as identifiers in patterns.
In AST it's PatKind::Ident, but in HIR it's turned into a proper pattern based on resolution, for const arguments it would be something like ast::GenericArg::Ident.
I agree this is not necessary to do in this PR though.

@petrochenkov petrochenkov removed their assignment Sep 1, 2018

@varkor

This comment has been minimized.

Copy link
Member Author

varkor commented Sep 6, 2018

(Note for triage: I'm going to get around to addressing these comments and hopefully fixing the existing crashes soon.)

@TimNN

This comment has been minimized.

Copy link
Contributor

TimNN commented Sep 25, 2018

Ping from triage! Since it's been I while, I was wondering if you could give us a small update on the status of this PR?

@eddyb eddyb referenced this pull request Sep 26, 2018

Open

RFC: Elide array size #2545

@varkor

This comment has been minimized.

Copy link
Member Author

varkor commented Sep 28, 2018

I'm going to start investigating the ICE again soon (been busier than I expected). I think @eddyb's going to be leaving some comments soon as well.

@TimNN

This comment has been minimized.

Copy link
Contributor

TimNN commented Oct 16, 2018

Ping from triage! Since it's been I while, I was wondering if you could give us a small update on the status of this PR?

@varkor

This comment has been minimized.

Copy link
Member Author

varkor commented Oct 16, 2018

I've made progress in my local branch since last time, though not quite ready to push. I think a full review will be unlikely before the 2018 edition though, as things are getting busy close to the deadline.

@varkor varkor force-pushed the varkor:const-generics-redux branch from f0bae41 to bfc4b41 Oct 16, 2018

@TimNN

This comment has been minimized.

Copy link
Contributor

TimNN commented Oct 23, 2018

@vakor: Thanks for the update!

varkor and others added some commits Jan 13, 2019

infer: const_var: Properly roll back both the unification table and v…
…alues Vec

As the unification table was made public and modified directly, values added
were able to be rolled back or commited without also modifying the `Vec` keeping
tack of all of the values added. The Vec was made into a `SnapshotVec` and
all of the required methods were added to `ConstVariableTable` to allow
snapshots, roll-backs, and commits.

Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
Rename shallow_resolve to shallow_resolve_type
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
Tack the universe for unknown const variables
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
Canonicalize infer consts
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
Added an error-typed const to CommonTypes
In same cases an error value is needed where a `LazyConst` is expected
to be returned. This error value is a zero-sized constant using
`TyKind::Error`.

Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
Resolve infer consts
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
Correct test for fewer const args case
If there are no const args given on a function then the const values
will be attempted to be infered, skipping the error message.

Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
Add test for failed const arg inference
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>

@varkor varkor force-pushed the varkor:const-generics-redux branch from d8d3cba to 1febe6c Feb 25, 2019

@yodaldevoid

This comment has been minimized.

Copy link
Collaborator

yodaldevoid commented on src/librustc/infer/opaque_types/mod.rs in ed69aa2 Mar 1, 2019

It looks like this doesn't need to be implemented for ReverseMapper. fold_ty is only implemented because of some funkiness around closures and otherwise is just the default impl.

bors added a commit that referenced this pull request Mar 6, 2019

Auto merge of #58583 - varkor:const-generics-ty, r=oli-obk
Add const generics to ty (and transitive dependencies)

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

There are a number of stubs. Some I plan to leave for the next PRs (e.g. `infer` and `rustdoc`). Others I can either fix up in this PR, or as follow ups (which would avoid the time-consuming rebasing).

It was a little hard to split this up, as so much depends on ty and friends. Apologies for the large diff.

r? @eddyb

bors added a commit that referenced this pull request Mar 6, 2019

Auto merge of #58583 - varkor:const-generics-ty, r=oli-obk
Add const generics to ty (and transitive dependencies)

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

There are a number of stubs. Some I plan to leave for the next PRs (e.g. `infer` and `rustdoc`). Others I can either fix up in this PR, or as follow ups (which would avoid the time-consuming rebasing).

It was a little hard to split this up, as so much depends on ty and friends. Apologies for the large diff.

r? @eddyb

bors added a commit that referenced this pull request Mar 6, 2019

Auto merge of #58583 - varkor:const-generics-ty, r=oli-obk
Add const generics to ty (and transitive dependencies)

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

There are a number of stubs. Some I plan to leave for the next PRs (e.g. `infer` and `rustdoc`). Others I can either fix up in this PR, or as follow ups (which would avoid the time-consuming rebasing).

It was a little hard to split this up, as so much depends on ty and friends. Apologies for the large diff.

r? @eddyb

bors added a commit that referenced this pull request Mar 6, 2019

Auto merge of #58583 - varkor:const-generics-ty, r=oli-obk
Add const generics to ty (and transitive dependencies)

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

There are a number of stubs. Some I plan to leave for the next PRs (e.g. `infer` and `rustdoc`). Others I can either fix up in this PR, or as follow ups (which would avoid the time-consuming rebasing).

It was a little hard to split this up, as so much depends on ty and friends. Apologies for the large diff.

r? @eddyb

bors added a commit that referenced this pull request Mar 6, 2019

Auto merge of #58583 - varkor:const-generics-ty, r=oli-obk
Add const generics to ty (and transitive dependencies)

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

There are a number of stubs. Some I plan to leave for the next PRs (e.g. `infer` and `rustdoc`). Others I can either fix up in this PR, or as follow ups (which would avoid the time-consuming rebasing).

It was a little hard to split this up, as so much depends on ty and friends. Apologies for the large diff.

r? @eddyb

bors added a commit that referenced this pull request Mar 7, 2019

Auto merge of #58583 - varkor:const-generics-ty, r=oli-obk
Add const generics to ty (and transitive dependencies)

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

There are a number of stubs. Some I plan to leave for the next PRs (e.g. `infer` and `rustdoc`). Others I can either fix up in this PR, or as follow ups (which would avoid the time-consuming rebasing).

It was a little hard to split this up, as so much depends on ty and friends. Apologies for the large diff.

r? @eddyb
@mark-i-m

This comment has been minimized.

Copy link
Contributor

mark-i-m commented Mar 7, 2019

#58583 merged 🎉

@varkor

This comment has been minimized.

Copy link
Member Author

varkor commented Mar 8, 2019

#59008 has been opened with the changes to type inference.

@varkor

This comment has been minimized.

Copy link
Member Author

varkor commented Mar 13, 2019

#59008 is blocked on some refactoring to consts for now, so #59170 has been opened in the meantime extending the support for const generics in rustdoc.

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Mar 22, 2019

Rollup merge of rust-lang#59170 - varkor:const-generics-rustdoc, r=Qu…
…ietMisdreavus,eddyb

Add const generics to rustdoc

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

The `FIXME`s are waiting on a refactor to `LazyConst`. I'll address these in a follow up, but I thought it would be better to implement the rest now to avoid bitrot.

r? @QuietMisdreavus

Centril added a commit to Centril/rust that referenced this pull request Mar 22, 2019

Rollup merge of rust-lang#59170 - varkor:const-generics-rustdoc, r=Qu…
…ietMisdreavus,eddyb

Add const generics to rustdoc

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

The `FIXME`s are waiting on a refactor to `LazyConst`. I'll address these in a follow up, but I thought it would be better to implement the rest now to avoid bitrot.

r? @QuietMisdreavus
@Dylan-DPC

This comment has been minimized.

Copy link
Member

Dylan-DPC commented Mar 25, 2019

ping from triage @varkor i'm assuming this is still blocked on #59170 ?

@varkor

This comment has been minimized.

Copy link
Member Author

varkor commented Mar 25, 2019

This is currently blocked on #59008 (#59170 was merged), which in turn is currently blocked on rust-lang-nursery/ena#22 (but which is expected to be merged soon).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.