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 for issue #27008 #27244

Merged
merged 1 commit into from
Jul 24, 2015
Merged

Fix for issue #27008 #27244

merged 1 commit into from
Jul 24, 2015

Conversation

Detegr
Copy link
Contributor

@Detegr Detegr commented Jul 23, 2015

Hi all.
This is my first contribution to Rust and fixes an issue causing an invalid error message to be presented to the user when using unit struct as length of a repeat expression, issue #27008. The solution is based on suggestions by @oli-obk, but as I'm a complete newbie to this, I have no clue if I got them right :)
The biggest concern I have is that if the NodeId I'm returning is the correct one or not (it's not meaningful in this case but I think it would be nice to get it right).

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @arielb1 (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@arielb1
Copy link
Contributor

arielb1 commented Jul 23, 2015

r? @eddyb

@rust-highfive rust-highfive assigned eddyb and unassigned arielb1 Jul 23, 2015
@@ -967,6 +967,12 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
Some(def::DefVariant(enum_def, variant_def, _)) => {
(lookup_variant_by_id(tcx, enum_def, variant_def), None)
}
Some(def::DefStruct(struct_def)) => {
if ast_util::is_local(struct_def) {
return Ok(ConstVal::Struct(struct_def.node))
Copy link
Member

Choose a reason for hiding this comment

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

Why restrict this to same-crate struct types? It should work fine either way.

@eddyb
Copy link
Member

eddyb commented Jul 23, 2015

Thank you! @bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jul 23, 2015

📌 Commit e981311 has been approved by eddyb

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Jul 24, 2015
Hi all.
This is my first contribution to Rust and fixes an issue causing an invalid error message to be presented to the user when using unit struct as length of a repeat expression, issue rust-lang#27008. The solution is based on suggestions by @oli-obk, but as I'm a complete newbie to this, I have no clue if I got them right :)
The biggest concern I have is that if the `NodeId` I'm returning is the correct one or not (it's not meaningful in this case but I think it would be nice to get it right).
bors added a commit that referenced this pull request Jul 24, 2015
@bors bors merged commit e981311 into rust-lang:master Jul 24, 2015
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.

5 participants