}
pub fn output_lib_filename(id: &CrateId) -> String {
- format_strbuf!("{}-{}-{}",
- id.name,
- crate_id_hash(id),
- id.version_or_default())
+ format!("{}-{}-{}", id.name, crate_id_hash(id), id.version_or_default())
}
pub fn get_cc_prog(sess: &Session) -> String {
let libname = output_lib_filename(id);
match crate_type {
config::CrateTypeRlib => {
- out_filename.with_filename(format_strbuf!("lib{}.rlib", libname))
+ out_filename.with_filename(format!("lib{}.rlib", libname))
}
config::CrateTypeDylib => {
let (prefix, suffix) = match sess.targ_cfg.os {
abi::OsAndroid => (loader::ANDROID_DLL_PREFIX, loader::ANDROID_DLL_SUFFIX),
abi::OsFreebsd => (loader::FREEBSD_DLL_PREFIX, loader::FREEBSD_DLL_SUFFIX),
};
- out_filename.with_filename(format_strbuf!("{}{}{}",
- prefix,
- libname,
- suffix))
+ out_filename.with_filename(format!("{}{}{}", prefix, libname,
+ suffix))
}
config::CrateTypeStaticlib => {
- out_filename.with_filename(format_strbuf!("lib{}.a", libname))
+ out_filename.with_filename(format!("lib{}.a", libname))
}
config::CrateTypeExecutable => out_filename.clone(),
}
a.add_native_library("compiler-rt").unwrap();
let crates = sess.cstore.get_used_crates(cstore::RequireStatic);
+ let mut all_native_libs = vec![];
+
for &(cnum, ref path) in crates.iter() {
let name = sess.cstore.get_crate_data(cnum).name.clone();
let p = match *path {
}
};
a.add_rlib(&p, name.as_slice(), sess.lto()).unwrap();
+
let native_libs = csearch::get_native_libraries(&sess.cstore, cnum);
- for &(kind, ref lib) in native_libs.iter() {
- let name = match kind {
- cstore::NativeStatic => "static library",
- cstore::NativeUnknown => "library",
- cstore::NativeFramework => "framework",
- };
- sess.warn(format!("unlinked native {}: {}",
- name,
- *lib).as_slice());
- }
+ all_native_libs.extend(native_libs.move_iter());
+ }
+
+ if !all_native_libs.is_empty() {
+ sess.warn("link against the following native artifacts when linking against \
+ this static library");
+ sess.note("the order and any duplication can be significant on some platforms, \
+ and so may need to be preserved");
+ }
+
+ for &(kind, ref lib) in all_native_libs.iter() {
+ let name = match kind {
+ cstore::NativeStatic => "static library",
+ cstore::NativeUnknown => "library",
+ cstore::NativeFramework => "framework",
+ };
+ sess.note(format!("{}: {}", name, *lib).as_slice());
}
}
cmd.arg("-Wl,-Bdynamic");
}
}
- cmd.arg(format_strbuf!("-l{}", *l));
+ cmd.arg(format!("-l{}", *l));
}
cstore::NativeFramework => {
cmd.arg("-framework");
for &(kind, ref lib) in libs.iter() {
match kind {
cstore::NativeUnknown => {
- cmd.arg(format_strbuf!("-l{}", *lib));
+ cmd.arg(format!("-l{}", *lib));
}
cstore::NativeFramework => {
cmd.arg("-framework");
ty::ty_vec(..) | ty::ty_rptr(..) => {
match *ctor {
vec(n) => {
- Some(format_strbuf!("vectors of length {}", n))
+ Some(format!("vectors of length {}", n))
}
_ => None
}
}
}
};
- let msg = format_strbuf!("non-exhaustive patterns{}", match ext {
- Some(ref s) => format_strbuf!(": {} not covered", *s),
+ let msg = format!("non-exhaustive patterns{}", match ext {
+ Some(ref s) => format!(": {} not covered", *s),
None => "".to_string()
});
cx.tcx.sess.span_err(sp, msg.as_slice());
None => Some(vec(before.len() + after.len()))
}
}
+ PatMac(_) => cx.tcx.sess.bug("unexpanded macro"),
}
}
_ => None
}
}
+ PatMac(_) => {
+ cx.tcx.sess.span_err(pat_span, "unexpanded macro");
+ None
+ }
}
}
}
}
PatEnum(_,_) => {}
PatVec(..) => { this_pattern!() }
+ PatMac(_) => cx.tcx.sess.bug("unexpanded macro"),
}
}
ast::PatLit(_) | ast::PatRange(_, _) => {
/*always ok*/
}
+
+ ast::PatMac(_) => {
+ self.tcx().sess.span_bug(pat.span, "unexpanded macro");
+ }
}
Ok(())
"captured outer variable".to_string()
}
_ => {
- format_strbuf!("dereference of `{}`-pointer",
- ptr_sigil(pk))
+ format!("dereference of `{}`-pointer", ptr_sigil(pk))
}
}
}
impl Repr for cmt_ {
fn repr(&self, tcx: &ty::ctxt) -> String {
- format_strbuf!("\\{{} id:{} m:{:?} ty:{}\\}",
- self.cat.repr(tcx),
- self.id,
- self.mutbl,
- self.ty.repr(tcx))
+ format!("\\{{} id:{} m:{:?} ty:{}\\}",
+ self.cat.repr(tcx),
+ self.id,
+ self.mutbl,
+ self.ty.repr(tcx))
}
}
cat_local(..) |
cat_upvar(..) |
cat_arg(..) => {
- format_strbuf!("{:?}", *self)
+ format!("{:?}", *self)
}
cat_deref(ref cmt, derefs, ptr) => {
- format_strbuf!("{}-{}{}->",
- cmt.cat.repr(tcx),
- ptr_sigil(ptr),
- derefs)
+ format!("{}-{}{}->", cmt.cat.repr(tcx), ptr_sigil(ptr), derefs)
}
cat_interior(ref cmt, interior) => {
- format_strbuf!("{}.{}", cmt.cat.repr(tcx), interior.repr(tcx))
+ format!("{}.{}", cmt.cat.repr(tcx), interior.repr(tcx))
}
cat_downcast(ref cmt) => {
- format_strbuf!("{}->(enum)", cmt.cat.repr(tcx))
+ format!("{}->(enum)", cmt.cat.repr(tcx))
}
cat_discr(ref cmt, _) => {
cmt.cat.repr(tcx)
InteriorField(NamedField(fld)) => {
token::get_name(fld).get().to_str().to_string()
}
- InteriorField(PositionalField(i)) => format_strbuf!("\\#{:?}", i),
+ InteriorField(PositionalField(i)) => format!("\\#{:?}", i),
InteriorElement(_) => "[]".to_string(),
}
}
// for many programs, this just take too long to serialize
self.pats.repr(tcx)
} else {
- format_strbuf!("{} pats", self.pats.len())
+ format!("{} pats", self.pats.len())
}
}
}
bcx.sess().span_bug(pat.span,
"vector patterns are never irrefutable!");
}
+ ast::PatMac(..) => {
+ bcx.sess().span_bug(pat.span, "unexpanded macro");
+ }
ast::PatWild | ast::PatWildMulti | ast::PatLit(_) | ast::PatRange(_, _) => ()
}
return bcx;
}
fn param_substs_to_str(this: ¶m_substs, tcx: &ty::ctxt) -> String {
- format_strbuf!("param_substs({})", this.substs.repr(tcx))
+ format!("param_substs({})", this.substs.repr(tcx))
}
impl Repr for param_substs {
pub fn to_str(&self) -> String {
let blk: *Block = self;
- format_strbuf!("[block {}]", blk)
+ format!("[block {}]", blk)
}
}
pub fn C_str_slice(cx: &CrateContext, s: InternedString) -> ValueRef {
unsafe {
let len = s.get().len();
- let cs = llvm::LLVMConstPointerCast(C_cstr(cx, s, false), Type::i8p(cx).to_ref());
+ let cs = llvm::LLVMConstPointerCast(C_cstr(cx, s, false),
+ Type::i8p(cx).to_ref());
C_struct(cx, [cs, C_uint(cx, len)], false)
}
}
param_bounds.get(n_bound).clone()
}
-pub fn filename_and_line_num_from_span(bcx: &Block, span: Span)
- -> (ValueRef, ValueRef) {
- let loc = bcx.sess().codemap().lookup_char_pos(span.lo);
- let filename_cstr = C_cstr(bcx.ccx(),
- token::intern_and_get_ident(loc.file
- .name
- .as_slice()),
- true);
- let filename = build::PointerCast(bcx, filename_cstr, Type::i8p(bcx.ccx()));
- let line = C_int(bcx.ccx(), loc.line as int);
- (filename, line)
-}
-
// Casts a Rust bool value to an i1.
pub fn bool_to_i1(bcx: &Block, llval: ValueRef) -> ValueRef {
build::ICmp(bcx, lib::llvm::IntNE, llval, C_bool(bcx.ccx(), false))
fn generate_unique_type_id(prefix: &'static str) -> String {
unsafe {
static mut unique_id_counter: atomics::AtomicUint = atomics::INIT_ATOMIC_UINT;
- format_strbuf!("{}{}",
- prefix,
- unique_id_counter.fetch_add(1, atomics::SeqCst))
+ format!("{}{}", prefix,
+ unique_id_counter.fetch_add(1, atomics::SeqCst))
}
}
walk_pattern(cx, sub_pat, scope_stack, scope_map);
}
}
+
+ ast::PatMac(_) => {
+ cx.sess().span_bug(pat.span, "debuginfo::populate_scope_map() - \
+ Found unexpanded macro.");
+ }
}
}
fcx.infcx().type_error_message_str_with_expected(pat.span,
|expected, actual| {
expected.map_or("".to_string(), |e| {
- format_strbuf!("mismatched types: expected `{}` but \
- found {}",
- e,
- actual)
+ format!("mismatched types: expected `{}` but found {}",
+ e, actual)
})},
Some(expected),
"a structure pattern".to_string(),
|expected, actual| {
expected.map_or("".to_string(),
|e| {
- format_strbuf!("mismatched types: expected `{}` but \
- found {}",
- e,
- actual)
+ format!("mismatched types: expected `{}` but found {}",
+ e, actual)
})
},
Some(expected),
|expected, actual| {
expected.map_or("".to_string(),
|e| {
- format_strbuf!("mismatched types: expected \
- `{}` but found {}",
- e,
- actual)
+ format!("mismatched types: expected \
+ `{}` but found {}", e, actual)
})},
Some(expected),
"a structure pattern".to_string(),
|expected,
actual| {
expected.map_or("".to_string(), |e| {
- format_strbuf!("mismatched types: expected `{}` \
- but found {}",
- e,
- actual)
+ format!("mismatched types: expected `{}` \
+ but found {}", e, actual)
}
)},
Some(expected),
|expected, actual| {
expected.map_or("".to_string(),
|e| {
- format_strbuf!("mismatched types: expected `{}` but \
- found {}",
- e,
- actual)
+ format!("mismatched types: expected `{}` but found {}",
+ e, actual)
})
},
Some(expected),
}
fcx.write_ty(pat.id, expected);
}
+
+ ast::PatMac(_) => tcx.sess.bug("unexpanded macro"),
}
}
span,
|expected, actual| {
expected.map_or("".to_string(), |e| {
- format_strbuf!("mismatched types: expected `{}` but \
- found {}",
- e,
- actual)
+ format!("mismatched types: expected `{}` but found {}",
+ e, actual)
})
},
Some(expected),
- format_strbuf!("{} pattern", match pointer_kind {
+ format!("{} pattern", match pointer_kind {
Send => "a box",
Borrowed => "an `&`-pointer",
}),
ty::ty_str => String,
ty::ty_vec(mt, None) => Vector(box mt.ty.clean()),
ty::ty_vec(mt, Some(i)) => FixedVector(box mt.ty.clean(),
- format_strbuf!("{}", i)),
+ format!("{}", i)),
ty::ty_ptr(mt) => RawPointer(mt.mutbl.clean(), box mt.ty.clean()),
ty::ty_rptr(r, mt) => BorrowedRef {
lifetime: r.clean(),
fn lit_to_str(lit: &ast::Lit) -> String {
match lit.node {
ast::LitStr(ref st, _) => st.get().to_string(),
- ast::LitBinary(ref data) => format_strbuf!("{:?}", data.as_slice()),
- ast::LitChar(c) => format_strbuf!("'{}'", c),
+ ast::LitBinary(ref data) => format!("{:?}", data.as_slice()),
+ ast::LitChar(c) => format!("'{}'", c),
ast::LitInt(i, _t) => i.to_str().to_string(),
ast::LitUint(u, _t) => u.to_str().to_string(),
ast::LitIntUnsuffixed(i) => i.to_str().to_string(),
PatRange(..) => fail!("tried to get argument name from PatRange, \
which is not allowed in function arguments"),
PatVec(..) => fail!("tried to get argument name from pat_vec, \
- which is not allowed in function arguments")
+ which is not allowed in function arguments"),
+ PatMac(..) => {
+ warn!("can't document the name of a function argument \
+ produced by a pattern macro");
+ "(argument produced by macro)".to_string()
+ }
}
}
impl Clean<Item> for doctree::Macro {
fn clean(&self) -> Item {
Item {
- name: Some(format_strbuf!("{}!", self.name.clean())),
+ name: Some(format!("{}!", self.name.clean())),
attrs: self.attrs.clean(),
source: self.where.clean(),
visibility: ast::Public.clean(),
pub use core::str::{from_utf8, CharEq, Chars, CharOffsets};
pub use core::str::{Bytes, CharSplits};
pub use core::str::{CharSplitsN, Words, AnyLines, MatchIndices, StrSplits};
-pub use core::str::{eq_slice, is_utf8, is_utf16, UTF16Items};
-pub use core::str::{UTF16Item, ScalarValue, LoneSurrogate, utf16_items};
+pub use core::str::{eq_slice, is_utf8, is_utf16, Utf16Items};
+pub use core::str::{Utf16Item, ScalarValue, LoneSurrogate, utf16_items};
pub use core::str::{truncate_utf16_at_nul, utf8_char_width, CharRange};
pub use core::str::{Str, StrSlice};
assert_eq!(s.len(), 5);
assert_eq!(s.as_slice(), "abcde");
assert_eq!(s.to_str(), "abcde".to_string());
- assert_eq!(format_strbuf!("{}", s), "abcde".to_string());
+ assert_eq!(format!("{}", s), "abcde".to_string());
assert!(s.lt(&Owned("bcdef".to_string())));
assert_eq!(Slice(""), Default::default());
assert_eq!(o.len(), 5);
assert_eq!(o.as_slice(), "abcde");
assert_eq!(o.to_str(), "abcde".to_string());
- assert_eq!(format_strbuf!("{}", o), "abcde".to_string());
+ assert_eq!(format!("{}", o), "abcde".to_string());
assert!(o.lt(&Slice("bcdef")));
assert_eq!(Owned("".to_string()), Default::default());