-
Notifications
You must be signed in to change notification settings - Fork 13k
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
don't go through llvm for const indexing #25370
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
_ => signal!(e, IndexedNonVec), | ||
} | ||
} | ||
ast::ExprVec(ref arr) => const_val::Array(arr.clone()), // FIXME: eval elements? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... I would imagine you do need to eval the elements ...
(... well, maybe not ... i guess you are effectively doing some sort of lazy-evaluation in the constant evaluator, which may be okay. But what happens if no one ever indexes the element in a constant expression?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what happens if no one ever indexes the element in a constant expression?
Then they get evaluated in https://github.com/oli-obk/rust/blob/const_indexing/src/librustc_trans/trans/consts.rs#L694-717
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated this to simply memorize the ast::NodeId
like tuples and structs do. Note: tuples and structs also do lazy evaluation for the field accesses.
hmmm... getting quite a few test failures. I guess I broke creating references to const arrays and their elements. I'm evaluating this.
|
this isn't as trivial as I thought. I'm closing this until I've got a working version. sorry about that. |
closes #3170