Skip to content

syntax: Make asm! clobbers a proper vector. #19411

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

Merged
merged 2 commits into from
Nov 30, 2014

Conversation

lifthrasiir
Copy link
Contributor

I.e. we should not prematurely build operand constraints at the expansion time. Otherwise --pretty expanded diverges:

$ cat t.rs
#![feature(asm)]

pub fn main() { unsafe { asm!("" : : : "hello", "world") }; }

$ rustc t.rs --pretty
#![feature(asm)]

pub fn main() { unsafe { asm!("" : : : "hello" , "world") }; }

$ rustc t.rs --pretty expanded
#![feature(asm)]
#![feature(phase)]
#![no_std]
#![feature(globs)]
#[phase(plugin, link)]
extern crate "std" as std;
#[prelude_import]
use std::prelude::*;

pub fn main() { unsafe { asm!("":  :  : "~{hello},~{world}") }; }

(The last code does compile, but won't do the expected thing.)

Otherwise `--pretty expanded` diverges.
@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (or someone else) soon.

.map(|s| format!("~{{{}}}", s.get()))
.collect::<Vec<String>>()
.connect(",")
.as_slice());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The String::from_str shouldn't be necessary here, right? I thought connect returned a String.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I guess it's a leftover from the old code (I didn't notice that :).

@alexcrichton
Copy link
Member

Thanks @lifthrasiir! Just one small nit and otherwise r=me

@alexcrichton alexcrichton assigned alexcrichton and unassigned aturon Nov 30, 2014
@lifthrasiir
Copy link
Contributor Author

@alexcrichton Removed two occurrences (both clobbers and the original code) of allocations. r?

bors added a commit that referenced this pull request Nov 30, 2014
…crichton

I.e. we should not prematurely build operand constraints at the expansion time. Otherwise `--pretty expanded` diverges:

```
$ cat t.rs
#![feature(asm)]

pub fn main() { unsafe { asm!("" : : : "hello", "world") }; }

$ rustc t.rs --pretty
#![feature(asm)]

pub fn main() { unsafe { asm!("" : : : "hello" , "world") }; }

$ rustc t.rs --pretty expanded
#![feature(asm)]
#![feature(phase)]
#![no_std]
#![feature(globs)]
#[phase(plugin, link)]
extern crate "std" as std;
#[prelude_import]
use std::prelude::*;

pub fn main() { unsafe { asm!("":  :  : "~{hello},~{world}") }; }
```

(The last code *does* compile, but won't do the expected thing.)
@bors bors closed this Nov 30, 2014
@bors bors merged commit 133266f into rust-lang:master Nov 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants