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

Revamp symbol names for impls (and make them deterministic, etc) #32293

Merged
merged 45 commits into from
Mar 26, 2016

Conversation

nikomatsakis
Copy link
Contributor

This builds on @michaelwoerister's epic PR #31539 (note that his PR never landed, so I just incorporated it into this one). The main change here is that we remove the "name" from DefPathData for impls, since that name is synthetic and not sufficiently predictable for incr comp. However, just doing that would cause bad symbol names since those are based on the DefPath. Therefore, I introduce a new mechanism for getting symbol names (and also paths for user display) called item_path. This is kind of simplistic for now (based on strings) but I expect to expand it later to support richer types, hopefully generating C++-mangled names that gdb etc can understand. Along the way I cleaned up how we track the path that leads to an extern crate.

There is still some cleanup left undone here. Notably, I didn't remove the impl names altogether -- that would probably make sense. I also didn't try to remove the item_symbols vector. Mostly I want to unblock my other incr. comp. work. =)

r? @eddyb
cc @eddyb @alexcrichton @michaelwoerister

@nikomatsakis
Copy link
Contributor Author

Note that the review is technically only for my comments, not mw's, but of course feel free to comment on those too and I'll patch up any nits or whatever.

/// the original crate but also its def-id. This is kind of an
/// augmented version of a `DefPath` that includes a `DefId`. This is
/// all sort of ugly but the hope is that inlined items will be going
/// away soon anyway.
Copy link
Member

Choose a reason for hiding this comment

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

MIR can't come soon enough 😞.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could pass the original id in the trans::inline path just like MIR.

@eddyb
Copy link
Member

eddyb commented Mar 17, 2016

LGTM, except for the nits, some of which GitHub is marking as being on an outdated diff.

pub struct Foo { x: u32 }

impl Foo {
#[rustc_symbol_name] //~ ERROR _ZN5impl13foo3Foo3bar
Copy link
Member

Choose a reason for hiding this comment

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

ok, this is pretty slick

@bors
Copy link
Contributor

bors commented Mar 18, 2016

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


#[rustc_symbol_name] //~ ERROR _ZN5basic4main
Copy link
Member

Choose a reason for hiding this comment

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

This name and others should end with an 'E' to close the nested name that was started with the 'N'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On Sat, Mar 19, 2016 at 04:01:27PM -0700, Michael Woerister wrote:

+#[rustc_symbol_name] //~ ERROR _ZN5basic4main

This name and others should end with an 'E' to close the nested name that was started with the 'N'.

The names do end with E. I just left that out of the test because I didn't want to put the hash in there.

@michaelwoerister
Copy link
Member

Looks good to me too. Consolidating path rendering into its own module is a good idea and it's great that we'll be testing symbol names from now on. Looking forward to tinkering with the name mangling scheme.

@nikomatsakis nikomatsakis force-pushed the incr-comp-def-path-munging branch 2 times, most recently from 3214c33 to bdfc0b4 Compare March 21, 2016 17:31
@nikomatsakis
Copy link
Contributor Author

Rebased. Some of the poor @michaelwoerister's beautifully clean commit history got a bit messed up (I suspect the individual commits no longer build), but seems to build locally. Not yet finished withmake check though.

@nikomatsakis
Copy link
Contributor Author

@bors r=eddyb

@bors
Copy link
Contributor

bors commented Mar 21, 2016

📌 Commit 8786477 has been approved by eddyb

@nikomatsakis
Copy link
Contributor Author

@bors r-

@nikomatsakis
Copy link
Contributor Author

@eddyb

If this fixes run-pass/command-before-exec, I think a revert of the static linking hack @alexcrichton suggested and I merged, is in order.

Does this just mean removing the comment on the test? If so, I did that in the most recent commit.

@nikomatsakis
Copy link
Contributor Author

@bors r=eddyb

@bors
Copy link
Contributor

bors commented Mar 21, 2016

📌 Commit ea70d16 has been approved by eddyb

@bors
Copy link
Contributor

bors commented Mar 22, 2016

⌛ Testing commit ea70d16 with merge dec92c1...

@bors
Copy link
Contributor

bors commented Mar 22, 2016

💔 Test failed - auto-mac-64-nopt-t

@nikomatsakis
Copy link
Contributor Author

@bors r=eddyb

@bors
Copy link
Contributor

bors commented Mar 22, 2016

📌 Commit 4eadadf has been approved by eddyb

@nikomatsakis
Copy link
Contributor Author

question to @alexcrichton -- do you know if the windows builders have nm and cmp available? If not, feel to r- this PR.

@nikomatsakis
Copy link
Contributor Author

@bors r=alexcrichton

@bors
Copy link
Contributor

bors commented Mar 25, 2016

📌 Commit 726ba66 has been approved by alexcrichton

@nikomatsakis
Copy link
Contributor Author

@bors p=1

@nikomatsakis
Copy link
Contributor Author

(This PR has been hanging around way too long.)

@bors
Copy link
Contributor

bors commented Mar 25, 2016

⌛ Testing commit 726ba66 with merge 07ee0ed...

@bors
Copy link
Contributor

bors commented Mar 25, 2016

💔 Test failed - auto-win-gnu-64-nopt-t

@nikomatsakis
Copy link
Contributor Author

@bors r=alexcrichton

@bors
Copy link
Contributor

bors commented Mar 25, 2016

📌 Commit 874574d has been approved by alexcrichton

@nikomatsakis
Copy link
Contributor Author

@bors force

@bors
Copy link
Contributor

bors commented Mar 25, 2016

⌛ Testing commit 874574d with merge 0f50c0d...

@bors
Copy link
Contributor

bors commented Mar 25, 2016

💔 Test failed - auto-win-gnu-64-nopt-t

@nikomatsakis
Copy link
Contributor Author

@bors r=alexcrichton

@bors
Copy link
Contributor

bors commented Mar 25, 2016

📌 Commit 1ea93c2 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Mar 26, 2016

⌛ Testing commit 1ea93c2 with merge 8d2d2be...

bors added a commit that referenced this pull request Mar 26, 2016
…xcrichton

Revamp symbol names for impls (and make them deterministic, etc)

This builds on @michaelwoerister's epic PR #31539 (note that his PR never landed, so I just incorporated it into this one). The main change here is that we remove the "name" from `DefPathData` for impls, since that name is synthetic and not sufficiently predictable for incr comp. However, just doing that would cause bad symbol names since those are based on the `DefPath`. Therefore, I introduce a new mechanism for getting symbol names (and also paths for user display) called `item_path`. This is kind of simplistic for now (based on strings) but I expect to expand it later to support richer types, hopefully generating C++-mangled names that gdb etc can understand. Along the way I cleaned up how we track the path that leads to an extern crate.

There is still some cleanup left undone here. Notably, I didn't remove the impl names altogether -- that would probably make sense. I also didn't try to remove the `item_symbols` vector. Mostly I want to unblock my other incr. comp. work. =)

r? @eddyb
cc @eddyb @alexcrichton @michaelwoerister
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants