Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up[MIR] Implement translation of references to various items #29907
Conversation
rust-highfive
assigned
nikomatsakis
Nov 18, 2015
This comment has been minimized.
This comment has been minimized.
|
Nits addressed. |
nagisa
force-pushed the
nagisa:mir-moar-constants
branch
from
53aa6b3
to
6bb92a5
Nov 18, 2015
nikomatsakis
reviewed
Nov 18, 2015
| substs: &'tcx Substs<'tcx>, | ||
| did: DefId) | ||
| -> OperandRef<'tcx> { | ||
| match ty.sty { |
This comment has been minimized.
This comment has been minimized.
nikomatsakis
Nov 18, 2015
Contributor
Checking the type of the item like this feels like a horrible hack. Perhaps we should just be including more information in the Literal MIR node? Or a Def (as I think you suggested on IRC)? Also, I haven't gone digging into trans, but is this code here a kind if port of code that exists elsewhere?
This comment has been minimized.
This comment has been minimized.
nagisa
Nov 18, 2015
Author
Contributor
Also, I haven't gone digging into trans, but is this code here a kind if port of code that exists elsewhere?
Nope. The trans_fn_ref below is a simplified “port”, but I haven’t found anything in old trans which would do matching like this (AFAICT it gathers such information from various other sources, esp. HIR).
Perhaps we should just be including more information in the Literal MIR node? Or a Def (as I think you suggested on IRC)?
This approach makes it pretty easy to match whether enum/struct references should be translated as functions or not. I’m not sure other methods would allow checking for this as easily.
I’m willing to explore for better methods to match correct path, but won’t be able to dedicate much time for that in coming weeks.
This comment has been minimized.
This comment has been minimized.
nagisa
Nov 20, 2015
Author
Contributor
Okay, I’m convinced now this is not only a hack but is also wrong (e.g. it will panic compiling a function that’s defined in impl block).
However, I won’t be able to get back to it for at least a week and a half. I’ll go ahead and mark the issue as [WIP] and hopefully work on it later.
This comment has been minimized.
This comment has been minimized.
|
|
nagisa
force-pushed the
nagisa:mir-moar-constants
branch
2 times, most recently
from
9a2607e
to
f013dd2
Nov 18, 2015
This comment has been minimized.
This comment has been minimized.
|
|
nagisa
force-pushed the
nagisa:mir-moar-constants
branch
from
a3485cc
to
250d9e7
Nov 20, 2015
nagisa
changed the title
[MIR] Implement translation of references to various items
[WIP][MIR] Implement translation of references to various items
Nov 20, 2015
This comment has been minimized.
This comment has been minimized.
|
|
nagisa
force-pushed the
nagisa:mir-moar-constants
branch
from
250d9e7
to
3673ee5
Dec 5, 2015
This comment has been minimized.
This comment has been minimized.
|
I changed my approach to storing relevant kind inside I’m not entirely sure I’m using the correct substs in all the correct locations, but things seem to be working; something to be reviewed more carefully. |
nagisa
changed the title
[WIP][MIR] Implement translation of references to various items
[MIR] Implement translation of references to various items
Dec 5, 2015
This comment has been minimized.
This comment has been minimized.
|
|
nagisa
force-pushed the
nagisa:mir-moar-constants
branch
from
f02c51a
to
09033dc
Dec 11, 2015
nagisa
referenced this pull request
Dec 13, 2015
Merged
[MIR] Initial implementation for translating calls. #30364
nagisa
added some commits
Nov 16, 2015
nagisa
force-pushed the
nagisa:mir-moar-constants
branch
from
09033dc
to
f95aae4
Dec 15, 2015
This comment has been minimized.
This comment has been minimized.
|
(I hate how github removed all the comments on force push :() nagisa@ece05d3 and nagisa@5fb2edc were the two commits that had comments. |
This comment has been minimized.
This comment has been minimized.
nikomatsakis
commented on src/librustc_trans/trans/consts.rs in b3720ea
Dec 17, 2015
|
can you add some sort of test for these? |
nagisa
force-pushed the
nagisa:mir-moar-constants
branch
from
f95aae4
to
7dd9579
Dec 17, 2015
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
nagisa commentedNov 18, 2015
Still will not translate references to items like
XorY::Vwherebut I must go work on university things so I’m PRing what I have.
r? @nikomatsakis