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

Fix async-std by special-casing rustdoc in typeck #75127

Merged
merged 5 commits into from
Aug 10, 2020

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Aug 4, 2020

This is the same sort of idea as #73566, but for typeck instead of resolve. I don't claim this is anywhere close to a good solution, but hopefully it's enough to unbreak async-std until we find a more principled fix.

On the bright side, unlike everybody_loops, this allows errors in any impl Trait, not just async fn.

Fixes #75100.

@rust-highfive

This comment has been minimized.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 4, 2020
@jyn514
Copy link
Member Author

jyn514 commented Aug 4, 2020

r? @ghost

@jyn514 jyn514 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 4, 2020
@jyn514
Copy link
Member Author

jyn514 commented Aug 4, 2020

rustdoc-ui failures - outdated, these are now fixed
Check compiletest suite=rustdoc-ui mode=ui (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 60 tests
iiiiiiiiiiiiiiiiiiiiiiiiiiFiiiiiiiiiiiiiiiiiiiiiiiiii.......
failures:

---- [ui] rustdoc-ui/infinite-recursive-type.rs stdout ----

error: /home/joshua/rustc/src/test/rustdoc-ui/infinite-recursive-type.rs:1: unexpected error: '1:1: 1:7: cycle detected when computing `Sized` constraints for `E` [E0391]'

error: /home/joshua/rustc/src/test/rustdoc-ui/infinite-recursive-type.rs:1: unexpected error: '1:1: 1:1: TyKind::Error constructed but no error reported'

error: /home/joshua/rustc/src/test/rustdoc-ui/infinite-recursive-type.rs:1: expected error not found: recursive type `E` has infinite size

error: 2 unexpected errors found, 1 expected errors not found
status: exit code: 1
command: "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/stage1/bin/rustdoc" "/home/joshua/rustc/src/test/rustdoc-ui/infinite-recursive-type.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-o" "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/infinite-recursive-type" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/home/joshua/rustc/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/test/rustdoc-ui/infinite-recursive-type/auxiliary"
unexpected errors (from JSON output): [
    Error {
        line_num: 1,
        kind: Some(
            Error,
        ),
        msg: "1:1: 1:7: cycle detected when computing `Sized` constraints for `E` [E0391]",
    },
    Error {
        line_num: 1,
        kind: Some(
            Error,
        ),
        msg: "1:1: 1:1: TyKind::Error constructed but no error reported",
    },
]

not found errors (from test file): [
    Error {
        line_num: 1,
        kind: Some(
            Error,
        ),
        msg: "recursive type `E` has infinite size",
    },
]

thread '[ui] rustdoc-ui/infinite-recursive-type.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:1483:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    [ui] rustdoc-ui/infinite-recursive-type.rs

test result: FAILED. 7 passed; 1 failed; 52 ignored; 0 measured; 0 filtered out
ui failures outdated - these are now fixed
failures:

---- [ui] ui/impl-trait/xcrate.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit code: 101
command: "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/home/joshua/rustc/src/test/ui/impl-trait/xcrate.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-C" "prefer-dynamic" "-o" "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/xcrate/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/home/joshua/rustc/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/xcrate/auxiliary"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:802:9: cannot create local mono-item for DefId(18:3 ~ xcrate[8787]::some_internal_fn[0])

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:915:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.47.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0

error: aborting due to previous error


------------------------------------------


---- [ui] ui/impl-trait/xcrate_simple.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit code: 101
command: "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/home/joshua/rustc/src/test/ui/impl-trait/xcrate_simple.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-C" "prefer-dynamic" "-o" "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/xcrate_simple/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/home/joshua/rustc/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/xcrate_simple/auxiliary"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:802:9: cannot create local mono-item for DefId(18:4 ~ xcrate[8787]::other_internal_fn[0])

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:915:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.47.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0

error: aborting due to previous error


------------------------------------------


---- [ui] ui/issues/issue-50865-private-impl-trait/main.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit code: 101
command: "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/home/joshua/rustc/src/test/ui/issues/issue-50865-private-impl-trait/main.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-C" "prefer-dynamic" "-o" "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50865-private-impl-trait/main/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/home/joshua/rustc/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-50865-private-impl-trait/main/auxiliary"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:802:9: cannot create local mono-item for DefId(18:7 ~ lib[8787]::foo[0])

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:915:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.47.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0

error: aborting due to previous error


------------------------------------------


---- [ui] ui/generator/xcrate-reachable.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit code: 101
command: "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/home/joshua/rustc/src/test/ui/generator/xcrate-reachable.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-C" "prefer-dynamic" "-o" "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/test/ui/generator/xcrate-reachable/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/home/joshua/rustc/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/test/ui/generator/xcrate-reachable/auxiliary"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:802:9: cannot create local mono-item for DefId(18:4 ~ xcrate_reachable[8787]::msg[0])

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:915:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.47.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0

error: aborting due to previous error


------------------------------------------



failures:
    [ui] ui/generator/xcrate-reachable.rs
    [ui] ui/impl-trait/xcrate.rs
    [ui] ui/impl-trait/xcrate_simple.rs
    [ui] ui/issues/issue-50865-private-impl-trait/main.rs

test result: FAILED. 3 passed; 4 failed; 10535 ignored; 0 measured; 0 filtered out

@jyn514
Copy link
Member Author

jyn514 commented Aug 4, 2020

Maybe we could have a reachability pass for rustdoc that's separate from the one for rustc? #73566 (comment)

This seems like the easiest fix to me for the impl trait error - to avoid having two passes, we could have a 'ignore impl trait' parameter to the current one.

The hard thing is going to be fixing the cycle on types with infinite size. If any compiler team member has ideas, please let me know.

@jyn514

This comment has been minimized.

@jyn514 jyn514 marked this pull request as draft August 4, 2020 01:57
@jyn514
Copy link
Member Author

jyn514 commented Aug 4, 2020

UI test failures are fixed so this might actually be feasible. Need to figure out how to fix the cycle error somehow.

@jyn514 jyn514 force-pushed the impl-trait branch 2 times, most recently from c4ff128 to 9fa7c32 Compare August 8, 2020 00:18
@jyn514 jyn514 changed the title [Don't merge] Fix async-std at the price of breaking half the test suite Fix async-std by special-casing rustdoc in typeck Aug 8, 2020
@jyn514 jyn514 marked this pull request as ready for review August 8, 2020 00:20
@jyn514

This comment has been minimized.

@jyn514 jyn514 force-pushed the impl-trait branch 2 times, most recently from 3205406 to a356ed8 Compare August 8, 2020 00:32
@jyn514 jyn514 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 8, 2020
This runs _just_ enough of typeck that later queries don't panic.
Because this is in the same part of the compiler that errors on `impl
Trait`, this special-cases impl Trait for rustdoc and no one else.
Everything is fine.
@pnkfelix
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Aug 10, 2020

📌 Commit a306e12 has been approved by pnkfelix

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 10, 2020
@pnkfelix
Copy link
Member

pnkfelix commented Aug 10, 2020

@bors rollup=never

(I want to be able to easily bisect to this change if this hack has unexpected consequences down the road.)

@bors
Copy link
Contributor

bors commented Aug 10, 2020

⌛ Testing commit a306e12 with merge d495ef5...

@bors
Copy link
Contributor

bors commented Aug 10, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: pnkfelix
Pushing d495ef5 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 10, 2020
@bors bors merged commit d495ef5 into rust-lang:master Aug 10, 2020
@jyn514 jyn514 deleted the impl-trait branch August 10, 2020 21:59
@Manishearth
Copy link
Member

Manishearth commented Aug 10, 2020

@yoshuawuyts @dignifiedquire Stuff should be fine in the next nightly! You can try it out now if you'd like with RTIM, and please let us know if things are still broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

async-std docs no longer build on recent nightlies
7 participants