Skip to content

Commit

Permalink
librustc_trans has been updated
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Feb 6, 2015
1 parent 1ff6e53 commit b009778
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 63 deletions.
6 changes: 3 additions & 3 deletions src/librustc_trans/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pub fn find_crate_name(sess: Option<&Session>,
if let Some(sess) = sess {
if let Some(ref s) = sess.opts.crate_name {
if let Some((attr, ref name)) = attr_crate_name {
if *s != name.get() {
if *s != &name[] {
let msg = format!("--crate-name and #[crate_name] are \
required to match, but `{}` != `{}`",
s, name);
Expand All @@ -153,7 +153,7 @@ pub fn find_crate_name(sess: Option<&Session>,
}

if let Some((attr, s)) = attr_crate_name {
return validate(s.get().to_string(), Some(attr.span));
return validate(s.to_string(), Some(attr.span));
}
if let Input::File(ref path) = *input {
if let Some(s) = path.filestem_str() {
Expand Down Expand Up @@ -293,7 +293,7 @@ pub fn mangle<PI: Iterator<Item=PathElem>>(path: PI,

// First, connect each component with <len, name> pairs.
for e in path {
push(&mut n, &token::get_name(e.name()).get()[])
push(&mut n, &token::get_name(e.name())[])
}

match hash {
Expand Down
20 changes: 10 additions & 10 deletions src/librustc_trans/save/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
},
};

let qualname = format!("{}::{}", qualname, get_ident(method.pe_ident()).get());
let qualname = format!("{}::{}", qualname, &get_ident(method.pe_ident())[]);
let qualname = &qualname[];

// record the decl for this def (if it has one)
Expand Down Expand Up @@ -436,7 +436,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
Some(sub_span) => self.fmt.field_str(field.span,
Some(sub_span),
field.node.id,
&name.get()[],
&name[],
&qualname[],
&typ[],
scope_id),
Expand Down Expand Up @@ -525,7 +525,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
self.fmt.static_str(item.span,
sub_span,
item.id,
get_ident(item.ident).get(),
&get_ident(item.ident)[],
&qualname[],
&value[],
&ty_to_string(&*typ)[],
Expand All @@ -548,7 +548,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
self.fmt.static_str(item.span,
sub_span,
item.id,
get_ident(item.ident).get(),
&get_ident(item.ident)[],
&qualname[],
"",
&ty_to_string(&*typ)[],
Expand Down Expand Up @@ -607,7 +607,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
}
for variant in &enum_definition.variants {
let name = get_ident(variant.node.name);
let name = name.get();
let name = &name[];
let mut qualname = enum_name.clone();
qualname.push_str("::");
qualname.push_str(name);
Expand Down Expand Up @@ -1094,7 +1094,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DxrVisitor<'l, 'tcx> {
sub_span,
item.id,
mod_id,
get_ident(ident).get(),
&get_ident(ident)[],
self.cur_scope);
self.write_sub_paths_truncated(path, true);
}
Expand Down Expand Up @@ -1149,9 +1149,9 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DxrVisitor<'l, 'tcx> {
}
ast::ItemExternCrate(ref s) => {
let name = get_ident(item.ident);
let name = name.get();
let name = &name[];
let location = match *s {
Some((ref s, _)) => s.get().to_string(),
Some((ref s, _)) => s.to_string(),
None => name.to_string(),
};
let alias_span = self.span.span_for_last_ident(item.span);
Expand Down Expand Up @@ -1259,7 +1259,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DxrVisitor<'l, 'tcx> {
},
};

qualname.push_str(get_ident(method_type.ident).get());
qualname.push_str(&get_ident(method_type.ident)[]);
let qualname = &qualname[];

let sub_span = self.span.sub_span_after_keyword(method_type.span, keywords::Fn);
Expand Down Expand Up @@ -1541,7 +1541,7 @@ pub fn process_crate(sess: &Session,

assert!(analysis.glob_map.is_some());
let cratename = match attr::find_crate_name(&krate.attrs[]) {
Some(name) => name.get().to_string(),
Some(name) => name.to_string(),
None => {
info!("Could not find crate name, using 'unknown_crate'");
String::from_str("unknown_crate")
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_trans/trans/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ pub fn trans_inline_asm<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ia: &ast::InlineAsm)
fcx.pop_custom_cleanup_scope(temp_scope);

let mut constraints = constraints.iter()
.map(|s| s.get().to_string())
.map(|s| s.to_string())
.chain(ext_constraints.into_iter())
.collect::<Vec<String>>()
.connect(",");

let mut clobbers = ia.clobbers.iter()
.map(|s| format!("~{{{}}}", s.get()))
.map(|s| format!("~{{{}}}", &s[]))
.collect::<Vec<String>>()
.connect(",");
let more_clobbers = get_clobbers();
Expand Down Expand Up @@ -120,7 +120,7 @@ pub fn trans_inline_asm<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ia: &ast::InlineAsm)
ast::AsmIntel => llvm::AD_Intel
};

let asm = CString::from_slice(ia.asm.get().as_bytes());
let asm = CString::from_slice(ia.asm.as_bytes());
let constraints = CString::from_slice(constraints.as_bytes());
let r = InlineAsmCall(bcx,
asm.as_ptr(),
Expand Down
16 changes: 8 additions & 8 deletions src/librustc_trans/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ pub fn set_llvm_fn_attrs(ccx: &CrateContext, attrs: &[ast::Attribute], llfn: Val

for attr in attrs {
let mut used = true;
match attr.name().get() {
match &attr.name()[] {
"no_stack_check" => unset_split_stack(llfn),
"no_split_stack" => {
unset_split_stack(llfn);
Expand Down Expand Up @@ -2248,7 +2248,7 @@ pub fn update_linkage(ccx: &CrateContext,
let item = ccx.tcx().map.get(id);
if let ast_map::NodeItem(i) = item {
if let Some(name) = attr::first_attr_value_str_by_name(&i.attrs, "linkage") {
if let Some(linkage) = llvm_linkage_by_name(name.get()) {
if let Some(linkage) = llvm_linkage_by_name(&name[]) {
llvm::SetLinkage(llval, linkage);
} else {
ccx.sess().span_fatal(i.span, "invalid linkage specified");
Expand Down Expand Up @@ -2721,15 +2721,15 @@ fn exported_name<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, id: ast::NodeId,

match attr::first_attr_value_str_by_name(attrs, "export_name") {
// Use provided name
Some(name) => name.get().to_string(),
Some(name) => name.to_string(),

_ => ccx.tcx().map.with_path(id, |path| {
if attr::contains_name(attrs, "no_mangle") {
// Don't mangle
path.last().unwrap().to_string()
} else {
match weak_lang_items::link_name(attrs) {
Some(name) => name.get().to_string(),
Some(name) => name.to_string(),
None => {
// Usual name mangling
mangle_exported_name(ccx, path, ty, id)
Expand Down Expand Up @@ -2824,12 +2824,12 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
match attr::first_attr_value_str_by_name(&i.attrs[],
"link_section") {
Some(sect) => {
if contains_null(sect.get()) {
if contains_null(&sect[]) {
ccx.sess().fatal(&format!("Illegal null byte in link_section value: `{}`",
sect.get())[]);
&sect[])[]);
}
unsafe {
let buf = CString::from_slice(sect.get().as_bytes());
let buf = CString::from_slice(sect.as_bytes());
llvm::LLVMSetSection(v, buf.as_ptr());
}
},
Expand Down Expand Up @@ -2869,7 +2869,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
let abi = ccx.tcx().map.get_foreign_abi(id);
let ty = ty::node_id_to_type(ccx.tcx(), ni.id);
let name = foreign::link_name(&*ni);
foreign::register_foreign_item_fn(ccx, abi, ty, &name.get()[])
foreign::register_foreign_item_fn(ccx, abi, ty, &name[])
}
ast::ForeignItemStatic(..) => {
foreign::register_static(ccx, &*ni)
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_trans/trans/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ impl<'blk, 'tcx> BlockS<'blk, 'tcx> {
pub fn sess(&self) -> &'blk Session { self.fcx.ccx.sess() }

pub fn ident(&self, ident: Ident) -> String {
token::get_ident(ident).get().to_string()
token::get_ident(ident).to_string()
}

pub fn node_id_to_string(&self, id: ast::NodeId) -> String {
Expand Down Expand Up @@ -834,8 +834,8 @@ pub fn C_cstr(cx: &CrateContext, s: InternedString, null_terminated: bool) -> Va
}

let sc = llvm::LLVMConstStringInContext(cx.llcx(),
s.get().as_ptr() as *const c_char,
s.get().len() as c_uint,
s.as_ptr() as *const c_char,
s.len() as c_uint,
!null_terminated as Bool);

let gsym = token::gensym("str");
Expand All @@ -853,7 +853,7 @@ pub fn C_cstr(cx: &CrateContext, s: InternedString, null_terminated: bool) -> Va
// NB: Do not use `do_spill_noroot` to make this into a constant string, or
// you will be kicked off fast isel. See issue #4352 for an example of this.
pub fn C_str_slice(cx: &CrateContext, s: InternedString) -> ValueRef {
let len = s.get().len();
let len = s.len();
let cs = consts::ptrcast(C_cstr(cx, s, false), Type::i8p(cx));
C_named_struct(cx.tn().find_type("str_slice").unwrap(), &[cs, C_uint(cx, len)])
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_trans/trans/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ pub fn const_lit(cx: &CrateContext, e: &ast::Expr, lit: &ast::Lit)
}
}
ast::LitFloat(ref fs, t) => {
C_floating(fs.get(), Type::float_from_ty(cx, t))
C_floating(&fs[], Type::float_from_ty(cx, t))
}
ast::LitFloatUnsuffixed(ref fs) => {
let lit_float_ty = ty::node_id_to_type(cx.tcx(), e.id);
match lit_float_ty.sty {
ty::ty_float(t) => {
C_floating(fs.get(), Type::float_from_ty(cx, t))
C_floating(&fs[], Type::float_from_ty(cx, t))
}
_ => {
cx.sess().span_bug(lit.span,
Expand Down
Loading

0 comments on commit b009778

Please sign in to comment.