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

Do not ICE in codegen when using a extern_type static #58192

Merged
merged 1 commit into from Feb 7, 2019

Conversation

Projects
None yet
4 participants
@dlrobertson
Copy link
Contributor

dlrobertson commented Feb 5, 2019

The layout of a extern_type static is unsized, but may pass the
Well-Formed check in typeck (See #55257). As a result, we
cannot assume that a static is sized when generating the Place
for an r-value.

Fixes: #57876

r? @oli-obk

llextra: None,
layout: layout,
align: layout.align.abi
}

This comment has been minimized.

@dlrobertson

dlrobertson Feb 5, 2019

Author Contributor

This does feel a bit reckless to me. Would it be better to instead make the change here so that this is only allowed in the case of a r-value that is a reference to a static?

This comment has been minimized.

@oli-obk

oli-obk Feb 5, 2019

Contributor

I think the right thing to do is to create a new constructor method (new_thin_place maybe?) that uses !type_has_metadata instead of is_sized in the assertion.

This comment has been minimized.

@dlrobertson

dlrobertson Feb 5, 2019

Author Contributor

That is definitely a good check to add. At the very least it seems like a good idea to add it inline here.

This comment has been minimized.

@dlrobertson

dlrobertson Feb 5, 2019

Author Contributor

@oli-obk Added PlaceRef::new_thin_place. It is only used in place.rs currently, so I didn't make the function pub.

Do not ICE in codegen given a extern_type static
The layout of a extern_type static is unsized, but may pass the
Well-Formed check in typeck. As a result, we cannot assume that
a static is sized when generating the `Place` for an r-value.

@dlrobertson dlrobertson force-pushed the dlrobertson:fix_57876 branch from 0df22ba to 80c052b Feb 5, 2019

@oli-obk

This comment has been minimized.

Copy link
Contributor

oli-obk commented Feb 6, 2019

@bors r+ rollup

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 6, 2019

📌 Commit 80c052b has been approved by oli-obk

kennytm added a commit to kennytm/rust that referenced this pull request Feb 7, 2019

Rollup merge of rust-lang#58192 - dlrobertson:fix_57876, r=oli-obk
Do not ICE in codegen when using a extern_type static

The layout of a extern_type static is unsized, but may pass the
Well-Formed check in typeck (See rust-lang#55257).  As a result, we
cannot assume that a static is sized when generating the `Place`
for an r-value.

Fixes: rust-lang#57876

r? @oli-obk

bors added a commit that referenced this pull request Feb 7, 2019

Auto merge of #58254 - kennytm:rollup, r=kennytm
Rollup of 23 pull requests

Successful merges:

 - #58118 (Transition libtest to 2018 edition)
 - #58119 (libproc_macro => 2018)
 - #58123 (Avoid some bounds checks in binary_heap::{PeekMut,Hole})
 - #58124 (libsyntax_pos => 2018)
 - #58133 (libsyntax_ext => 2018)
 - #58136 (Improve error message and docs for non-UTF-8 bytes in stdio on Windows)
 - #58156 (update submodule: rust-installer from 27dec6c to ccdc47b)
 - #58192 (Do not ICE in codegen when using a extern_type static)
 - #58193 (Move librustc to 2018)
 - #58210 (Make an assert debug-only in `find_constraint_paths_between_regions`.)
 - #58217 (librustc_tsan => 2018)
 - #58218 (librustc_msan => 2018)
 - #58219 (librustc_asan => 2018)
 - #58220 (libprofiler_builtins => 2018)
 - #58223 (librustc_lsan => 2018)
 - #58225 (librustc_fs_util => 2018)
 - #58228 (librustc_plugin => 2018)
 - #58236 (librustc_resolve => 2018)
 - #58237 (Fix broken grammar in iter::from_fn() docs)
 - #58239 (librustc_apfloat => 2018)
 - #58240 (librustc_errors => 2018)
 - #58241 (librustc_llvm => 2018)
 - #58242 (Document the one TyKind that isn't documented)

Failed merges:

 - #58185 (Remove images' url to make it work even without internet connection)

r? @ghost

@bors bors merged commit 80c052b into rust-lang:master Feb 7, 2019

@dlrobertson dlrobertson deleted the dlrobertson:fix_57876 branch Feb 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.