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

Add const generics to the HIR #58503

Merged
merged 13 commits into from Feb 19, 2019

Conversation

Projects
None yet
7 participants
@varkor
Copy link
Member

varkor commented Feb 15, 2019

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

r? @eddyb

varkor and others added some commits Feb 15, 2019

Add Const kind to HIR
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Add pretty-printing for const generics
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Move const generic error from lowering to collect
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Add Const kind to rustdoc
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Add E0111
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Take Const into account in HIR
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Drive-by cleanup
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Take Const into account with nonstandard style lint
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
Update tests
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

rust-highfive commented Feb 15, 2019

The job x86_64-gnu-llvm-6.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.
travis_time:end:054f9488:start=1550269907233521994,finish=1550269908072747248,duration=839225254
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---
[00:05:48]    Compiling rustc_errors v0.0.0 (/checkout/src/librustc_errors)
[00:06:58]    Compiling syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:12:39]    Compiling rustc_mir v0.0.0 (/checkout/src/librustc_mir)
[00:12:39]    Compiling rustc_typeck v0.0.0 (/checkout/src/librustc_typeck)
[00:12:41] error[E0425]: cannot find value `impl_node_id` in this scope
[00:12:41]    --> src/librustc_typeck/check/compare_method.rs:845:56
[00:12:41]     |
[00:12:41] 845 |                                     if param.hir_id == impl_node_id {
[00:12:41]     |                                                        ^^^^^^^^^^^^ help: a local variable with a similar name exists: `impl_def_id`
[00:12:46] error: aborting due to previous error
[00:12:46] 
[00:12:46] For more information about this error, try `rustc --explain E0425`.
[00:12:47] error: Could not compile `rustc_typeck`.
[00:12:47] error: Could not compile `rustc_typeck`.
[00:12:47] warning: build failed, waiting for other jobs to finish...
[00:16:46] error: build failed
[00:16:46] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:16:46] expected success, got: exit code: 101
[00:16:46] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:16:46] Build completed unsuccessfully in 0:13:04
[00:16:46] make: *** [all] Error 1
[00:16:46] Makefile:18: recipe for target 'all' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0e7516f0
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Fri Feb 15 22:48:47 UTC 2019
---
199368 ./obj/build/cache/2019-01-18
156148 ./src/llvm-project/clang
155976 ./obj/build/bootstrap/debug/incremental
141204 ./obj/build/bootstrap/debug/incremental/bootstrap-2ahv8almm435e
141200 ./obj/build/bootstrap/debug/incremental/bootstrap-2ahv8almm435e/s-f9iw89h4bv-1kw3swl-2ee07hmknei1u
123516 ./src/llvm-project/llvm/test/CodeGen
108528 ./src/llvm-project/lldb
102208 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu
102204 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release

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)

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

rust-highfive commented Feb 15, 2019

The job x86_64-gnu-llvm-6.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.
travis_time:end:099bf600:start=1550271127176465394,finish=1550271129346161345,duration=2169695951
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---
[00:19:05]    Compiling rustc_lint v0.0.0 (/checkout/src/librustc_lint)
[00:19:05] error: hidden lifetime parameters in types are deprecated
[00:19:05]    --> src/librustc_lint/nonstandard_style.rs:459:44
[00:19:05]     |
[00:19:05] 459 |     fn check_generic_param(&mut self, cx: &LateContext, param: &hir::GenericParam) {
[00:19:05]     |
[00:19:05] note: lint level defined here
[00:19:05]    --> src/librustc_lint/lib.rs:22:9
[00:19:05]     |
[00:19:05]     |
[00:19:05] 22  | #![deny(rust_2018_idioms)]
[00:19:05]     |         ^^^^^^^^^^^^^^^^
[00:19:05]     = note: #[deny(elided_lifetimes_in_paths)] implied by #[deny(rust_2018_idioms)]
[00:19:06] error: aborting due to previous error
[00:19:06] 
[00:19:06] error: Could not compile `rustc_lint`.
[00:19:06] warning: build failed, waiting for other jobs to finish...
[00:19:06] warning: build failed, waiting for other jobs to finish...
[00:19:49] error: build failed
[00:19:49] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:19:49] expected success, got: exit code: 101
[00:19:49] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:19:49] Build completed unsuccessfully in 0:15:25
[00:19:49] Makefile:18: recipe for target 'all' failed
[00:19:49] make: *** [all] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:02da71a0
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Fri Feb 15 23:12:09 UTC 2019
---
travis_time:end:014f58d2:start=1550272330220711906,finish=1550272330225332581,duration=4620675
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:2141a86e
$ 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 --batch -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:08acdfd4
travis_time:start:08acdfd4
$ 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:17241fd8
$ 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)

@varkor varkor force-pushed the varkor:const-generics-hir branch from 14dfb4d to 0b4cd07 Feb 15, 2019

@varkor varkor force-pushed the varkor:const-generics-hir branch from 0b4cd07 to 18ce997 Feb 15, 2019

@petrochenkov petrochenkov self-assigned this Feb 16, 2019

#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct ConstArg {
pub value: AnonConst,
pub span: Span,

This comment has been minimized.

@petrochenkov

petrochenkov Feb 16, 2019

Contributor

This span is identical to the span in body of AnonConst, is it viable to use it instead?
Other AnonConsts don't create extra spans during lowering as far as can I see.

This comment has been minimized.

@petrochenkov

petrochenkov Feb 16, 2019

Contributor

(The whole ConstArg could be refactored away in that case.)

This comment has been minimized.

@petrochenkov

petrochenkov Feb 16, 2019

Contributor

Ugh, I see GenericArg::span wants to work in isolation without any contexts.

This comment has been minimized.

@yodaldevoid

yodaldevoid Feb 16, 2019

Contributor

Yeah, we went through the same thought process when this was implemented. If you can see a way to refactor this, I'd be all ears.

@petrochenkov

This comment has been minimized.

Copy link
Contributor

petrochenkov commented Feb 16, 2019

LGTM, r=me modulo removing abort / adding lint test (#58503 (comment)).

I'll keep @eddyb assigned in case he wants to look.

@petrochenkov petrochenkov removed their assignment Feb 16, 2019

@varkor

This comment has been minimized.

Copy link
Member Author

varkor commented Feb 16, 2019

@bors r=petrochenkov p=1

(Increasing priority because this unblocks other work.)

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 16, 2019

📌 Commit 727e204 has been approved by petrochenkov

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 17, 2019

⌛️ Testing commit 727e204 with merge 3cdf81e...

bors added a commit that referenced this pull request Feb 17, 2019

Auto merge of #58503 - varkor:const-generics-hir, r=petrochenkov
Add const generics to the HIR

Split out from #53645.

cc @yodaldevoid

r? @eddyb
@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Feb 17, 2019

@bors retry

@@ -1684,6 +1707,11 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> {
let encode_info = IsolatedEncoder::encode_info_for_ty_param;
self.record(def_id, encode_info, (def_id, has_default));
}
hir::GenericParamKind::Const { .. } => {
let def_id = self.tcx.hir().local_def_id(param.id);
let encode_info = IsolatedEncoder::encode_info_for_const_param;

This comment has been minimized.

@eddyb

eddyb Feb 17, 2019

Member

Maybe open an issue about unifying the param encoding in metadata, the same way GenericParamDef has common fields?

This comment has been minimized.

@varkor

varkor Feb 19, 2019

Author Member

Opened #58581.

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 19, 2019

⌛️ Testing commit 727e204 with merge 32471f7...

bors added a commit that referenced this pull request Feb 19, 2019

Auto merge of #58503 - varkor:const-generics-hir, r=petrochenkov
Add const generics to the HIR

Split out from #53645.

cc @yodaldevoid

r? @eddyb
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 19, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: petrochenkov
Pushing 32471f7 to master...

@bors bors added the merged-by-bors label Feb 19, 2019

@bors bors merged commit 727e204 into rust-lang:master Feb 19, 2019

1 check passed

homu Test successful
Details

@mikerite mikerite referenced this pull request Feb 19, 2019

Closed

Build Broken 2019-02-19 #3785

@varkor varkor deleted the varkor:const-generics-hir branch Feb 19, 2019

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.