Skip to content

Allow passing unsized types to std::intrinsics::get_tydesc #21170

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

Merged
merged 1 commit into from
Jan 16, 2015

Conversation

Diggsey
Copy link
Contributor

@Diggsey Diggsey commented Jan 15, 2015

While it's unstable and will probably be replaced or "reformed" at some point, it's useful in the mean time to be able to introspect the type system when debugging, and not be limited to sized types.

Fixes #21058

@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 @huonw (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 CONTRIBUTING.md for more information.

@huonw
Copy link
Member

huonw commented Jan 15, 2015

Thanks! Could you squash the two commits into one?

@Diggsey
Copy link
Contributor Author

Diggsey commented Jan 15, 2015

Np, done

@huonw
Copy link
Member

huonw commented Jan 15, 2015

Handing off to someone who knows more about this code: r? @nick29581

@rust-highfive rust-highfive assigned nrc and unassigned huonw Jan 15, 2015
@@ -459,7 +459,6 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, t: Ty<'tcx>)
}
ty::ty_vec(ty, None) => tvec::make_drop_glue_unboxed(bcx, v0, ty, false),
_ => {
assert!(type_is_sized(bcx.tcx(), t));
Copy link
Member

Choose a reason for hiding this comment

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

this is a bit suspicious, what kind of type triggers this assertion? Is it str? I expect we should be dealing with ty_str in the same way as ty_vec, but it seems to be missing treatment all over this file. This is not really your problem to fix (unless you want to!). I suggest creating a ty_str branch and panic!ing in it, with a FIXME comment, leave the assertion in, and change the test to use something other than a str

@Diggsey
Copy link
Contributor Author

Diggsey commented Jan 15, 2015

Made the changes - it seemed easier to just return the correct alignment instead of adding a FIXME, since it's a one line change.

@nrc
Copy link
Member

nrc commented Jan 15, 2015

thanks! r=me with the commits squashed

Fix tabs

Added missing ty_str cases when generating type descriptions

Reduce code duplication and improve test
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Jan 15, 2015
While it's unstable and will probably be replaced or "reformed" at some point, it's useful in the mean time to be able to introspect the type system when debugging, and not be limited to sized types.

Fixes rust-lang#21058
@bors bors merged commit 81c5fd8 into rust-lang:master Jan 16, 2015
@Diggsey Diggsey deleted the issue-21058 branch January 16, 2015 18:08
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.

std::intrinsics::get_tydesc will only accept sized types
5 participants