summaryrefslogtreecommitdiff
path: root/src/codegen/mod.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-10-21 02:49:30 -0500
committerGitHub <noreply@github.com>2016-10-21 02:49:30 -0500
commitc21c6f55d5aaf87b0dc6ce4a86aa0614b39713c5 (patch)
treed2e834552775e65c8c6c0d3f67ae6140a4ad280a /src/codegen/mod.rs
parentb9030224dd83b5cb8bed580908e63c2a6c21708a (diff)
parent7b432d31759fe3045402dd4af5401330256d2ac4 (diff)
Auto merge of #66 - emilio:const-methods, r=nox
Take pointer constness into account, to fix generation of const methods. We signal method constness in the `this` pointer creating a `const` pointer, but the `to_rust_ty` implementation never checked that.
Diffstat (limited to 'src/codegen/mod.rs')
-rw-r--r--src/codegen/mod.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 55312c31..17789e19 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -1444,7 +1444,8 @@ impl ToRustTy for Type {
if inner_ty.canonical_type(ctx).is_function() {
ty
} else {
- ty.to_ptr(inner.expect_type().is_const(), ctx.span())
+ let is_const = self.is_const() || inner.expect_type().is_const();
+ ty.to_ptr(is_const, ctx.span())
}
}
TypeKind::Named(..) => {