diff options
| author | Patrick Walton <[email protected]> | 2011-03-03 14:10:36 -0800 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-03-03 14:10:36 -0800 |
| commit | 2a241ece3a8fdaa536946b29eeab4524da164903 (patch) | |
| tree | 89a0406929dbb323b67d64611e6f96887cc48915 | |
| parent | rustc: Don't call type_of() in GEP_tup_like() if there are any type parameter... (diff) | |
| download | rust-2a241ece3a8fdaa536946b29eeab4524da164903.tar.xz rust-2a241ece3a8fdaa536946b29eeab4524da164903.zip | |
rustc: Disallow calling type_of() on dynamically-sized types
| -rw-r--r-- | src/comp/middle/trans.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 9587b008..65f5b135 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -417,7 +417,17 @@ fn T_opaque_obj_ptr(type_names tn) -> TypeRef { } +// This function now fails if called on a type with dynamic size (as its +// return value was always meaningless in that case anyhow). Beware! +// +// TODO: Enforce via a predicate. fn type_of(@crate_ctxt cx, @ty.t t) -> TypeRef { + if (ty.type_has_dynamic_size(t)) { + log "type_of() called on a type with dynamic size: " + + ty.ty_to_str(t); + fail; + } + ret type_of_inner(cx, t); } |