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 31 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

// 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

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

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

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!

yodaldevoid and others added some commits Jan 1, 2019

const_generics: substs: add function to get all generic params that a…
…re not regions as it is commonly needed

Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
const_generics: check all non-region generic params when checking if …
…an item is generic

Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
const_generics: include const parameters in string representations of…
… item names

Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
const_params: check the inherent flags for const params
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
correct comment of sub_relations refering to eq_relations
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
Rename identify_constrained_type_params and the containing file to si…
…gnify changed behavior

`identify_constrained_type_params` and the other functions in `constrained_type_params` have dealt
with more than just type params before const params were added, but with the addition of const
params it makes even less sense to keep the names as they are.

Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
const_generics: Change ast_const_to_const and FnCtxt::to_const to tak…
…e an AnonConst rather than ConstArg

These functions don't need to span that is bundled in a ConstArg, and this
change allows ast_const_to_const to be used elsewhere.

Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
const_generics: Use ast_const_to_const to create the length of arrays
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
const_generics: Check variance contraints in consts to catch const pa…
…rams

Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
const_generics: Allow checking the type of const generics on structs,…
… enums, and unions

Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
Track const var origin
It's not currently used for anything, though.
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>
Fix trailing attribute in generic parameters label
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>

@yodaldevoid yodaldevoid force-pushed the varkor:const-generics-redux branch from 42bdd2f to bb9fc94 Feb 1, 2019

@yodaldevoid

This comment has been minimized.

Copy link
Contributor

yodaldevoid commented Feb 1, 2019

Ok, that may have been the most annoying rebase I have had to deal with so far, but it is done.

We have a few failing tests outside of the const-generic ones. Most of these tests have to do with catching problems with the order of generics as that has been messed with.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Feb 1, 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:00bc407b:start=1548987861403247297,finish=1548987863818068729,duration=2414821432
$ 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
---
[01:05:10] .................................................................................................... 400/5365
[01:05:14] .................................................................................................... 500/5365
[01:05:17] .............................i...................................................................... 600/5365
[01:05:21] .................................................................................................... 700/5365
[01:05:26] .FF.F............................................................................................... 800/5365
[01:05:35] .................................................................................................... 1000/5365
[01:05:39] ......iiiii......................................................................................... 1100/5365
[01:05:42] .................................................................................................... 1200/5365
[01:05:44] .................................................................................................... 1300/5365
---
[01:07:05] .................................................................................................... 3500/5365
[01:07:09] .................................................................................................... 3600/5365
[01:07:13] .......................................................................................ii........... 3700/5365
[01:07:16] .................................................................................................... 3800/5365
[01:07:18] .....i..............................................F...F.........................F................. 3900/5365
[01:07:22] .................................................................................................... 4100/5365
[01:07:31] .................................................................................................... 4200/5365
[01:07:37] .................................................................................................... 4300/5365
[01:07:40] .................................................................................................... 4400/5365
[01:07:40] .................................................................................................... 4400/5365
[01:07:44] .................................................................................................... 4500/5365
[01:07:48] ................i................................................................................... 4600/5365
[01:07:54] .................................................................................................... 4700/5365
[01:07:57] .................................................................................................... 4800/5365
[01:08:02] ...............................................................................F.................... 4900/5365
[01:08:05] ..............................................................F..................................... 5000/5365
[01:08:12] .................................................................................................... 5200/5365
[01:08:15] .................................................................................................... 5300/5365
[01:08:17] ....i............................................................
[01:08:17] failures:
[01:08:17] failures:
[01:08:17] 
[01:08:17] ---- [ui] ui/const_generics/const-param-type-depends-on-type-param.rs stdout ----
[01:08:17] 
[01:08:17] error: /checkout/src/test/ui/const_generics/const-param-type-depends-on-type-param.rs:3: unexpected error: '3:22: 3:23: parameter `T` is never used [E0392]'
[01:08:17] error: 1 unexpected errors found, 0 expected errors not found
[01:08:17] status: exit code: 1
[01:08:17] status: exit code: 1
[01:08:17] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/const_generics/const-param-type-depends-on-type-param.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/const_generics/const-param-type-depends-on-type-param/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/const_generics/const-param-type-depends-on-type-param/auxiliary" "-A" "unused"
[01:08:17]     Error {
[01:08:17]         line_num: 3,
[01:08:17]         kind: Some(
[01:08:17]             Error
[01:08:17]             Error
[01:08:17]         ),
[01:08:17]         msg: "3:22: 3:23: parameter `T` is never used [E0392]"
[01:08:17] ]
[01:08:17] 
[01:08:17] thread '[ui] ui/const_generics/const-param-type-depends-on-type-param.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:1378:13
[01:08:17] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[01:08:17] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[01:08:17] 
[01:08:17] ---- [ui] ui/const_generics/const-impl.rs stdout ----
[01:08:17] 
[01:08:17] error: test compilation failed although it shouldn't!
[01:08:17] status: exit code: 101
[01:08:17] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/const_generics/const-impl.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/const_generics/const-impl/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/const_generics/const-impl/auxiliary" "-A" "unused"
[01:08:17] ------------------------------------------
[01:08:17] 
[01:08:17] ------------------------------------------
[01:08:17] stderr:
[01:08:17] stderr:
[01:08:17] ------------------------------------------
[01:08:17] {"message":"src/librustc/middle/dead.rs:99: no type-dependent def for method","code":null,"level":"error: internal compiler error","spans":[],"children":[],"rendered":"error: internal compiler error: src/librustc/middle/dead.rs:99: no type-dependent def for method\n\n"}
[01:08:17] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[01:08:17] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[01:08:17] 
[01:08:17] note: the compiler unexpectedly panicked. this is a bug.
[01:08:17] note: the compiler unexpectedly panicked. this is a bug.
[01:08:17] 
[01:08:17] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[01:08:17] 
[01:08:17] note: rustc 1.34.0-dev running on x86_64-unknown-linux-gnu
[01:08:17] 
[01:08:17] note: compiler flags: -Z threads=1 -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath
[01:08:17] 
[01:08:17] ------------------------------------------
[01:08:17] 
[01:08:17] thread '[ui] ui/const_generics/const-impl.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3295:9
[01:08:17] thread '[ui] ui/const_generics/const-impl.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3295:9
[01:08:17] 
[01:08:17] ---- [ui] ui/const_generics/incorrect-number-of-const-args.rs stdout ----
[01:08:17] 
[01:08:17] error: Error: expected failure status (Some(1)) but received status Some(101).
[01:08:17] status: exit code: 101
[01:08:17] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/const_generics/incorrect-number-of-const-args.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/const_generics/incorrect-number-of-const-args/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/const_generics/incorrect-number-of-const-args/auxiliary" "-A" "unused"
[01:08:17] ------------------------------------------
[01:08:17] 
[01:08:17] ------------------------------------------
[01:08:17] stderr:
[01:08:17] stderr:
[01:08:17] ------------------------------------------
[01:08:17] {"message":"src/librustc/infer/canonical/canonicalizer.rs:485: failed to lift `TypeOf(DefId(0/0:3 ~ incorrect_number_of_const_args[317d]::foo[0]), UserSubsts { substs: [Evaluated(Const { ty: usize, val: Infer(Var(_#0f)) })], user_self_ty: None })`, canonicalized from `TypeOf(DefId(0/0:3 ~ incorrect_number_of_const_args[317d]::foo[0]), UserSubsts { substs: [Evaluated(Const { ty: usize, val: Infer(Var(_#0f)) })], user_self_ty: None })`","code":null,"level":"error: internal compiler error","spans":[],"children":[],"rendered":"error: internal compiler error: src/librustc/infer/canonical/canonicalizer.rs:485: failed to lift `TypeOf(DefId(0/0:3 ~ incorrect_number_of_const_args[317d]::foo[0]), UserSubsts { substs: [Evaluated(Const { ty: usize, val: Infer(Var(_#0f)) })], user_self_ty: None })`, canonicalized from `TypeOf(DefId(0/0:3 ~ incorrect_number_of_const_args[317d]::foo[0]), UserSubsts { substs: [Evaluated(Const { ty: usize, val: Infer(Var(_#0f)) })], user_self_ty: None })`\n\n"}
[01:08:17] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[01:08:17] {"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}
[01:08:17] 
[01:08:17] note: the compiler unexpectedly panicked. this is a bug.
[01:08:17] note: the compiler unexpectedly panicked. this is a bug.
[01:08:17] 
[01:08:17] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[01:08:17] 
[01:08:17] note: rustc 1.34.0-dev running on x86_64-unknown-linux-gnu
[01:08:17] 
[01:08:17] note: compiler flags: -Z threads=1 -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath
[01:08:17] 
[01:08:17] ------------------------------------------
[01:08:17] 
[01:08:17] thread '[ui] ui/const_generics/incorrect-number-of-const-args.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3295:9
[01:08:17] thread '[ui] ui/const_generics/incorrect-number-of-const-args.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3295:9
[01:08:17] 
[01:08:17] ---- [ui] ui/parser/issue-14303-fncall.rs stdout ----
[01:08:17] diff of stderr:
[01:08:17] 
[01:08:17] - error: lifetime parameters must be declared prior to type parameters
[01:08:17] + error: lifetime may not live long enough
[01:08:17] 3    |
[01:08:17] 3    |
[01:08:17] - LL |         .collect::<Vec<S<_, 'a>>>();
[01:08:17] -    |                             ^^ must be declared prior to type parameters
[01:08:17] - help: move the lifetime parameter prior to the first type parameter
[01:08:17] -    |
[01:08:17] - LL |         .collect::<Vec<S<'a, _>>>();
[01:08:17] -    |                          ^^^ --
[01:08:17] + LL | fn foo<'a, 'b>(start: &'a usize, end: &'a usize) {
[01:08:17] +    |        -- lifetime `'a` defined here
[01:08:17] + LL |     let _x = (*start..*end)
[01:08:17] + LL |         .map(|x| S { a: start, b: end })
[01:08:17] +    |                  ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
[01:08:17] 11 error: aborting due to previous error
[01:08:17] 12 
[01:08:17] 
[01:08:17] 
[01:08:17] 
[01:08:17] The actual stderr differed from the expected stderr.
[01:08:17] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/parser/issue-14303-fncall/issue-14303-fncall.stderr
[01:08:17] To update references, rerun the tests and pass the `--bless` flag
[01:08:17] To only update this specific test, also pass `--test-args parser/issue-14303-fncall.rs`
[01:08:17] error: 1 errors occurred comparing output.
[01:08:17] status: exit code: 1
[01:08:17] status: exit code: 1
[01:08:17] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/parser/issue-14303-fncall.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/parser/issue-14303-fncall/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Zborrowck=mir" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/parser/issue-14303-fncall/auxiliary" "-A" "unused"
[01:08:17] ------------------------------------------
[01:08:17] 
[01:08:17] ------------------------------------------
[01:08:17] stderr:
[01:08:17] stderr:
[01:08:17] ------------------------------------------
[01:08:17] {"message":"lifetime may not live long enough","code":null,"level":"error","spans":[{"file_name":"/checkout/src/test/ui/parser/issue-14303-fncall.rs","byte_start":238,"byte_end":240,"line_start":10,"line_end":10,"column_start":8,"column_end":10,"is_primary":false,"text":[{"text":"fn foo<'a, 'b>(start: &'a usize, end: &'a usize) {","highlight_start":8,"highlight_end":10}],"label":"lifetime `'a` defined here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/parser/issue-14303-fncall.rs","byte_start":327,"byte_end":349,"line_start":12,"line_end":12,"column_start":18,"column_end":40,"is_primary":true,"text":[{"text":"        .map(|x| S { a: start, b: end })","highlight_start":18,"highlight_end":40}],"label":"returning this value requires that `'a` must outlive `'static`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: lifetime may not live long enough\n  --> /checkout/src/test/ui/parser/issue-14303-fncall.rs:12:18\n   |\nLL | fn foo<'a, 'b>(start: &'a usize, end: &'a usize) {\n   |        -- lifetime `'a` defined here\nLL |     let _x = (*start..*end)\nLL |         .map(|x| S { a: start, b: end })\n   |                  ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`\n\n"}
[01:08:17] 
[01:08:17] ------------------------------------------
[01:08:17] 
[01:08:17] thread '[ui] ui/parser/issue-14303-fncall.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3295:9
[01:08:17] thread '[ui] ui/parser/issue-14303-fncall.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3295:9
[01:08:17] 
[01:08:17] ---- [ui] ui/parser/issue-14303-path.rs stdout ----
[01:08:17] 
[01:08:17] error: ui test compiled successfully!
[01:08:17] status: exit code: 0
[01:08:17] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/parser/issue-14303-path.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/parser/issue-14303-path/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/parser/issue-14303-path/auxiliary" "-A" "unused"
[01:08:17] ------------------------------------------
[01:08:17] 
[01:08:17] ------------------------------------------
[01:08:17] stderr:
---
[01:08:17] diff of stderr:
[01:08:17] 
[01:08:17] - error: type parameters must be declared prior to associated type bindings
[01:08:17] -   --> $DIR/issue-32214.rs:5:34
[01:08:17] + error[E0445]: private trait `Trait<W>` in public interface
[01:08:17] 3    |
[01:08:17] 3    |
[01:08:17] + LL | trait Trait<T> { type Item; }
[01:08:17] +    | - `Trait<W>` declared as private
[01:08:17] + LL | 
[01:08:17] 4 LL | pub fn test<W, I: Trait<Item=(), W> >() {}
[01:08:17] -    |                                  ^ must be declared prior to associated type bindings
[01:08:17] - help: move the type parameter prior to the first associated type binding
[01:08:17] -    |
[01:08:17] - LL | pub fn test<W, I: Trait<W, Item=()> >() {}
[01:08:17] -    |                         ^^       --
[01:08:17] 10 
[01:08:17] 11 error: aborting due to previous error
[01:08:17] 12 
[01:08:17] 
[01:08:17] 
[01:08:17] + For more information about this error, try `rustc --explain E0445`.
[01:08:17] 13 
[01:08:17] 
[01:08:17] 
[01:08:17] The actual stderr differed from the expected stderr.
[01:08:17] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/parser/issue-32214/issue-32214.stderr
[01:08:17] To update references, rerun the tests and pass the `--bless` flag
[01:08:17] To only update this specific test, also pass `--test-args parser/issue-32214.rs`
[01:08:17] error: 1 errors occurred comparing output.
[01:08:17] status: exit code: 1
[01:08:17] status: exit code: 1
[01:08:17] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/parser/issue-32214.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/parser/issue-32214/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "continue-parse-after-error" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/parser/issue-32214/auxiliary" "-A" "unused"
[01:08:17] ------------------------------------------
[01:08:17] 
[01:08:17] ------------------------------------------
[01:08:17] stderr:
[01:08:17] stderr:
[01:08:17] ------------------------------------------
[01:08:17] {"message":"private trait `Trait<W>` in public interface","code":{"code":"E0445","explanation":"\nA private trait was used on a public type parameter bound. Erroneous code\nexamples:\n\n```compile_fail,E0445\n#![deny(private_in_public)]\n\ntrait Foo {\n    fn dummy(&self) { }\n}\n\npub trait Bar : Foo {} // error: private trait in public interface\npub struct Bar2<T: Foo>(pub T); // same error\npub fn foo<T: Foo> (t: T) {} // same error\n```\n\nTo solve this error, please ensure that the trait is also public. The trait\ncan be made inaccessible if necessary by placing it into a private inner\nmodule, but it still has to be marked with `pub`. Example:\n\n```\npub trait Foo { // we set the Foo trait public\n    fn dummy(&self) { }\n}\n\npub trait Bar : Foo {} // ok!\npub struct Bar2<T: Foo>(pub T); // ok!\npub fn foo<T: Foo> (t: T) {} // ok!\n```\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/parser/issue-32214.rs","byte_start":80,"byte_end":122,"line_start":5,"line_end":5,"column_start":1,"column_end":43,"is_primary":true,"text":[{"text":"pub fn test<W, I: Trait<Item=(), W> >() {}","highlight_start":1,"highlight_end":43}],"label":"can't leak private trait","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"/checkout/src/test/ui/parser/issue-32214.rs","byte_start":49,"byte_end":49,"line_start":3,"line_end":3,"column_start":1,"column_end":1,"is_primary":false,"text":[{"text":"trait Trait<T> { type Item; }","highlight_start":1,"highlight_end":1}],"label":"`Trait<W>` declared as private","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0445]: private trait `Trait<W>` in public interface\n  --> /checkout/src/test/ui/parser/issue-32214.rs:5:1\n   |\nLL | trait Trait<T> { type Item; }\n   | - `Trait<W>` declared as private\nLL | \nLL | pub fn test<W, I: Trait<Item=(), W> >() {}\n   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait\n\n"}
[01:08:17] {"message":"For more information about this error, try `rustc --explain E0445`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0445`.\n"}
[01:08:17] 
[01:08:17] ------------------------------------------
[01:08:17] 
[01:08:17] 
[01:08:17] thread '[ui] ui/parser/issue-32214.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3295:9
[01:08:17] 
[01:08:17] ---- [ui] ui/suggestions/suggest-move-types.rs stdout ----
[01:08:17] 
[01:08:17] error: ui test compiled successfully!
[01:08:17] status: exit code: 0
[01:08:17] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/suggestions/suggest-move-types.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/suggest-move-types/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/suggestions/suggest-move-types/auxiliary" "-A" "unused"
[01:08:17] ------------------------------------------
[01:08:17] 
[01:08:17] ------------------------------------------
[01:08:17] stderr:
---
[01:08:17] 
[01:08:17] - error: lifetime parameters must be declared prior to type and const parameters
[01:08:17] -   --> $DIR/trait-object-vs-lifetime.rs:14:25
[01:08:17] -    |
[01:08:17] - LL |     let _: S<'static +, 'static>;
[01:08:17] -    |                         ^^^^^^^ must be declared prior to type and const parameters
[01:08:17] - help: move the lifetime parameter prior to the first type parameter
[01:08:17] -    |
[01:08:17] - LL |     let _: S<'static, 'static +>;
[01:08:17] - 
[01:08:17] 11 error[E0224]: at least one non-builtin trait is required for an object type
[01:08:17] 12   --> $DIR/trait-object-vs-lifetime.rs:9:23
[01:08:17] 13    |
[01:08:17] 13    |
[01:08:17] 
[01:08:17] 32 LL |     let _: S<'static +, 'static>;
[01:08:17] 34 
[01:08:17] - error: aborting due to 5 previous errors
[01:08:17] + error: aborting due to 4 previous errors
[01:08:17] 36 
[01:08:17] 36 
[01:08:17] 37 Some errors occurred: E0107, E0224.
[01:08:17] 38 For more information about an error, try `rustc --explain E0107`.
[01:08:17] 
[01:08:17] 
[01:08:17] The actual stderr differed from the expected stderr.
[01:08:17] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-object-vs-lifetime/trait-object-vs-lifetime.stderr
[01:08:17] To update references, rerun the tests and pass the `--bless` flag
[01:08:17] To only update this specific test, also pass `--test-args traits/trait-object-vs-lifetime.rs`
[01:08:17] error: 1 errors occurred comparing output.
[01:08:17] status: exit code: 1
[01:08:17] status: exit code: 1
[01:08:17] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/traits/trait-object-vs-lifetime.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-object-vs-lifetime/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/trait-object-vs-lifetime/auxiliary" "-A" "unused"
[01:08:17] ------------------------------------------
[01:08:17] 
[01:08:17] ------------------------------------------
[01:08:17] stderr:
[01:08:17] stderr:
[01:08:17] ------------------------------------------
[01:08:17] {"message":"at least one non-builtin trait is required for an object type","code":{"code":"E0224","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-object-vs-lifetime.rs","byte_start":332,"byte_end":341,"line_start":9,"line_end":9,"column_start":23,"column_end":32,"is_primary":true,"text":[{"text":"    let _: S<'static, 'static +>;","highlight_start":23,"highlight_end":32}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0224]: at least one non-builtin trait is required for an object type\n  --> /checkout/src/test/ui/traits/trait-object-vs-lifetime.rs:9:23\n   |\nLL |     let _: S<'static, 'static +>;\n   |                       ^^^^^^^^^\n\n"}
[01:08:17] {"message":"wrong number of lifetime arguments: expected 1, found 2","code":{"code":"E0107","explanation":"\nThis error means that an incorrect number of generic arguments were provided:\n\n```compile_fail,E0107\nstruct Foo<T> { x: T }\n\nstruct Bar { x: Foo }             // error: wrong number of type arguments:\n                                  //        expected 1, found 0\nstruct Baz<S, T> { x: Foo<S, T> } // error: wrong number of type arguments:\n                                  //        expected 1, found 2\n\nfn foo<T, U>(x: T, y: U) {}\n\nfn main() {\n    let x: bool = true;\n    foo::<bool>(x);                 // error: wrong number of type arguments:\n                                    //        expected 2, found 1\n    foo::<bool, i32, i32>(x, 2, 4); // error: wrong number of type arguments:\n                                    //        expected 2, found 3\n}\n\nfn f() {}\n\nfn main() {\n    f::<'static>(); // error: wrong number of lifetime arguments:\n                    //        expected 0, found 1\n}\n```\n\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-object-vs-lifetime.rs","byte_start":437,"byte_end":444,"line_start":11,"line_end":11,"column_start":23,"column_end":30,"is_primary":true,"text":[{"text":"    let _: S<'static, 'static>;","highlight_start":23,"highlight_end":30}],"label":"unexpected lifetime argument","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0107]: wrong number of lifetime arguments: expected 1, found 2\n  --> /checkout/src/test/ui/traits/trait-object-vs-lifetime.rs:11:23\n   |\nLL |     let _: S<'static, 'static>;\n   |                       ^^^^^^^ unexpected lifetime argument\n\n"}
[01:08:17] {"message":"wrong number of type arguments: expected 1, found 0","code":{"code":"E0107","explanation":"\nThis error means that an incorrect number of generic arguments were provided:\n\n```compile_fail,E0107\nstruct Foo<T> { x: T }\n\nstruct Bar { x: Foo }             // error: wrong number of type arguments:\n                                  //        expected 1, found 0\nstruct Baz<S, T> { x: Foo<S, T> } // error: wrong number of type arguments:\n                                  //        expected 1, found 2\n\nfn foo<T, U>(x: T, y: U) {}\n\nfn main() {\n    let x: bool = true;\n    foo::<bool>(x);                 // error: wrong number of type arguments:\n                                    //        expected 2, found 1\n    foo::<bool, i32, i32>(x, 2, 4); // error: wrong number of type arguments:\n                                    //        expected 2, found 3\n}\n\nfn f() {}\n\nfn main() {\n    f::<'static>(); // error: wrong number of lifetime arguments:\n                    //        expected 0, found 1\n}\n```\n\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-object-vs-lifetime.rs","byte_start":426,"byte_end":445,"line_start":11,"line_end":11,"column_start":12,"column_end":31,"is_primary":true,"text":[{"text":"    let _: S<'static, 'static>;","highlight_start":12,"highlight_end":31}],"label":"expected 1 type argument","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0107]: wrong number of type arguments: expected 1, found 0\n  --> /checkout/src/test/ui/traits/trait-object-vs-lifetime.rs:11:12\n   |\nLL |     let _: S<'static, 'static>;\n   |            ^^^^^^^^^^^^^^^^^^^ expected 1 type argument\n\n"}
[01:08:17] {"message":"at least one non-builtin trait is required for an object type","code":{"code":"E0224","explanation":null},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/traits/trait-object-vs-lifetime.rs","byte_start":598,"byte_end":607,"line_start":14,"line_end":14,"column_start":14,"column_end":23,"is_primary":true,"text":[{"text":"    let _: S<'static +, 'static>;","highlight_start":14,"highlight_end":23}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0224]: at least one non-builtin trait is required for an object type\n  --> /checkout/src/test/ui/traits/trait-object-vs-lifetime.rs:14:14\n   |\nLL |     let _: S<'static +, 'static>;\n   |              ^^^^^^^^^\n\n"}
[01:08:17] {"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors\n\n"}
[01:08:17] {"message":"Some errors occurred: E0107, E0224.","code":null,"level":"","spans":[],"children":[],"rendered":"Some errors occurred: E0107, E0224.\n"}
[01:08:17] 
[01:08:17] ------------------------------------------
[01:08:17] 
[01:08:17] thread '[ui] ui/traits/trait-object-vs-lifetime.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3295:9
---
[01:08:17] 
[01:08:17] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:502:22
[01:08:17] 
[01:08:17] 
[01:08:17] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:08:17] 
[01:08:17] 
[01:08:17] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:08:17] Build completed unsuccessfully in 0:04:21
[01:08:17] Build completed unsuccessfully in 0:04:21
[01:08:17] make: *** [check] Error 1
[01:08:17] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:2b09d9af
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Fri Feb  1 03:32:52 UTC 2019
---
travis_time:end:13815a70:start=1548991973782739091,finish=1548991973787262267,duration=4523176
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:13407ca8
$ ln -s . checkout && for CORE in o

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)

@phil-opp phil-opp referenced this pull request Feb 1, 2019

Open

Provide an example #8

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 3, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment