diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-07-27 13:36:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-27 13:36:51 +0000 |
commit | f76ddb42f82c04baf6b14aef1b532ccb5a0425bb (patch) | |
tree | 5b2ddeb0e2c1839ff97d7aa78886345295ef607a /gcc/rust/backend/rust-compile-context.h | |
parent | 9526e6d62167ff824814c7ac8c09b36316029262 (diff) | |
parent | 7f8adccb5056152edc4aacf08ce2ed040f076171 (diff) | |
download | gcc-f76ddb42f82c04baf6b14aef1b532ccb5a0425bb.zip gcc-f76ddb42f82c04baf6b14aef1b532ccb5a0425bb.tar.gz gcc-f76ddb42f82c04baf6b14aef1b532ccb5a0425bb.tar.bz2 |
Merge #598
598: Hello world r=philberty a=philberty
```rust
extern "C" {
fn puts(s: *const i8);
}
fn main() {
unsafe {
let a = "Hello World\0";
let b = a as *const str;
let c = b as *const i8;
puts(c);
}
}
```
Fixes #421
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile-context.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-context.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h index bb4f0ab..0aaf084 100644 --- a/gcc/rust/backend/rust-compile-context.h +++ b/gcc/rust/backend/rust-compile-context.h @@ -371,9 +371,14 @@ public: parameters.push_back (compiled_param); } - translated = ctx->get_backend ()->function_type ( - receiver, parameters, results, NULL, - ctx->get_mappings ()->lookup_location (type.get_ref ())); + if (!type.is_varadic ()) + translated = ctx->get_backend ()->function_type ( + receiver, parameters, results, NULL, + ctx->get_mappings ()->lookup_location (type.get_ref ())); + else + translated = ctx->get_backend ()->function_type_varadic ( + receiver, parameters, results, NULL, + ctx->get_mappings ()->lookup_location (type.get_ref ())); } void visit (TyTy::FnPtr &type) override |