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

Restructure hir::map::Node and hir::map::Entry #53616

Merged
merged 8 commits into from
Aug 28, 2018

Conversation

varkor
Copy link
Member

@varkor varkor commented Aug 22, 2018

  • Moves hir::map::Node to hir::Node and removes the Node* prefix from its variants.
  • Changes hir::map::Entry to a struct hir::map::Entry.
  • Removes the Node* prefix from each of AnnNodes variants.

r? @eddyb

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 22, 2018
@rust-highfive

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Aug 24, 2018

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

@eddyb
Copy link
Member

eddyb commented Aug 25, 2018

Entry being an enum is a dead optimization FWIW (because of DepNodeIndex), what you want is this:

struct Entry {
    parent: NodeId,
    dep_node: DepNodeIndex,
    node: Node,
}

Add RootCrate to Node as just Crate, then NotPresent is replaced by having Option<Entry> (which nowadays should be the same size as Entry).

Also, since Node isn't a struct, you can just have e.g. Node::Expr which is IMO nicer.
Oh and you can move Node to hir, keep only Entry in hir::map.

@varkor varkor changed the title Rename hir::map::Node and hir::map::Entry Restructure hir::map::Node and hir::map::Entry Aug 25, 2018
@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@varkor
Copy link
Member Author

varkor commented Aug 25, 2018

All done!

@@ -114,7 +114,11 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
hcx,
hir_body_nodes,
};
collector.insert_entry(CRATE_NODE_ID, RootCrate(root_mod_sig_dep_index));
collector.insert_entry(CRATE_NODE_ID, Entry {
parent: ast::DUMMY_NODE_ID,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you actually want CRATE_NODE_ID here.

RootCrate(_) => return None
})
match self.node {
Node::Crate => None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is useful.

Visibility(&'hir Visibility),

/// Roots for node trees. Its DepNodeIndex when in `Entry`
/// is the dependency node of the crate's root module.
Copy link
Member

@eddyb eddyb Aug 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is super relevant. Also, we could technically make this point to data as well, it'd just not be cleanly separated yet, so we can't do it (would break incremental).

@eddyb
Copy link
Member

eddyb commented Aug 25, 2018

LGTM! r? @nikomatsakis or @michaelwoerister

@rust-highfive rust-highfive assigned nikomatsakis and unassigned eddyb Aug 25, 2018
@rust-highfive

This comment has been minimized.

@rust-highfive
Copy link
Collaborator

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.
151200 ./src/tools/clang
149112 ./src/llvm-emscripten/test
148696 ./obj/build/bootstrap/debug/incremental
134264 ./obj/build/bootstrap/debug/incremental/bootstrap-1fo02lb1azu6i
134260 ./obj/build/bootstrap/debug/incremental/bootstrap-1fo02lb1azu6i/s-f471wmgryq-spukfx-heneaay3bnr5
103868 ./src/tools/lldb
98948 ./obj/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends
93756 ./src/tools/clang/test
90416 ./obj/build/x86_64-unknown-linux-gnu/stage1

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
Copy link
Member Author

varkor commented Aug 25, 2018

@eddyb: well, it didn't like those changes. I guess excluding the crate root was important.

@rust-highfive
Copy link
Collaborator

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:20:37]    Compiling rustc_asan v0.0.0 (file:///checkout/src/librustc_asan)
[00:20:37]    Compiling rustc_tsan v0.0.0 (file:///checkout/src/librustc_tsan)
[00:20:38]    Compiling rustc_lsan v0.0.0 (file:///checkout/src/librustc_lsan)
[00:20:38]    Compiling rustc_msan v0.0.0 (file:///checkout/src/librustc_msan)
[00:21:03] error: internal compiler error: librustc/middle/reachable.rs:324: found unexpected thingy in worklist: root_crate
[00:21:03] thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:586:9
[00:21:03] note: Run with `RUST_BACKTRACE=1` for a backtrace.
inux-gnu
285392 ./src/tools
---
151200 ./src/tools/clang
149116 ./src/llvm-emscripten/test
148696 ./obj/build/bootstrap/debug/incremental
134264 ./obj/build/bootstrap/debug/incremental/bootstrap-1fo02lb1azu6i
134260 ./obj/build/bootstrap/debug/incremental/bootstrap-1fo02lb1azu6i/s-f473byonm0-ymn7ph-heneaay3bnr5
103868 ./src/tools/lldb
98952 ./obj/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends
93756 ./src/tools/clang/test
90416 ./obj/build/x86_64-unknown-linux-gnu/stage1

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)

@eddyb
Copy link
Member

eddyb commented Aug 26, 2018

@varkor That just means there are bugs lurking around and they warrant further investigation.

@bors
Copy link
Contributor

bors commented Aug 27, 2018

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

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Aug 27, 2018

📌 Commit 55c34e5c6e0a4f18e89828f6cf8e1581b8d8ed2e has been approved by nikomatsakis

@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 27, 2018
@nikomatsakis
Copy link
Contributor

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 27, 2018
@nikomatsakis
Copy link
Contributor

r=me post rebase =)

@@ -29,7 +29,7 @@ pub(super) struct NodeCollector<'a, 'hir> {
/// The crate
krate: &'hir Crate,
/// The node map
map: Vec<EntryKind<'hir>>,
map: Vec<Option<Entry<'hir>>>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@varkor
Copy link
Member Author

varkor commented Aug 27, 2018

@bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented Aug 27, 2018

📌 Commit a9d075e has been approved by nikomatsakis

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 27, 2018
@bors
Copy link
Contributor

bors commented Aug 28, 2018

⌛ Testing commit a9d075e with merge 59e52b1...

bors added a commit that referenced this pull request Aug 28, 2018
Restructure hir::map::Node and hir::map::Entry

- Moves `hir::map::Node` to `hir::Node` and removes the `Node*` prefix from its variants.
- Changes `hir::map::Entry` to a struct `hir::map::Entry`.
- Removes the `Node*` prefix from each of `AnnNode`s variants.

r? @eddyb
@bors
Copy link
Contributor

bors commented Aug 28, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 59e52b1 to master...

@bors bors merged commit a9d075e into rust-lang:master Aug 28, 2018
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #53616!

Tested on commit 59e52b1.
Direct link to PR: #53616

💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra).
💔 clippy-driver on linux: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra).
💔 rls on windows: test-pass → build-fail (cc @nrc, @rust-lang/infra).
💔 rls on linux: test-pass → build-fail (cc @nrc, @rust-lang/infra).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Aug 28, 2018
Tested on commit rust-lang/rust@59e52b1.
Direct link to PR: <rust-lang/rust#53616>

💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra).
💔 clippy-driver on linux: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra).
💔 rls on windows: test-pass → build-fail (cc @nrc, @rust-lang/infra).
💔 rls on linux: test-pass → build-fail (cc @nrc, @rust-lang/infra).
@oli-obk
Copy link
Contributor

oli-obk commented Aug 28, 2018

on it wrt clippy failure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants