summaryrefslogtreecommitdiff
path: root/src/ir/ty.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2018-05-15 19:31:50 -0400
committerGitHub <noreply@github.com>2018-05-15 19:31:50 -0400
commitd6d097cc1a662ef8131e47eaea72bc0c863e43b2 (patch)
tree10ab032849549f0e74e39caa5ac4551515317e70 /src/ir/ty.rs
parent74dcb202e398f8101a5bb387628d21ed0f781359 (diff)
parent716d53b02d363880184c05e80f8bf4982ee1ed23 (diff)
Auto merge of #1312 - emilio:constness-woes, r=fitzgen
ir: Handle *const T at the codegen level. Followup to #1311.
Diffstat (limited to 'src/ir/ty.rs')
-rw-r--r--src/ir/ty.rs17
1 files changed, 1 insertions, 16 deletions
diff --git a/src/ir/ty.rs b/src/ir/ty.rs
index b742dcc1..b805dd62 100644
--- a/src/ir/ty.rs
+++ b/src/ir/ty.rs
@@ -1195,22 +1195,7 @@ impl Type {
let name = if name.is_empty() { None } else { Some(name) };
- // Just using ty.is_const() is wrong here, because when we declare an
- // argument like 'int* const arg0', arg0 is considered
- // const but the pointer itself points to mutable data.
- //
- // Without canonicalizing the type to the pointer type, we'll get the
- // following mapping:
- //
- // arg0: *const c_int
- //
- // So by canonicalizing the type first, we can check constness by
- // calling is_const() on the pointer type.
- let is_const = if let Some(pty) = ty.pointee_type() {
- pty.is_const()
- } else {
- ty.is_const()
- };
+ let is_const = ty.is_const();
let ty = Type::new(name, layout, kind, is_const);
// TODO: maybe declaration.canonical()?