]> git.lizzy.rs Git - rust.git/commitdiff
librustc: Automatically change uses of `~[T]` to `Vec<T>` in rustc.
authorPatrick Walton <pcwalton@mimiga.net>
Tue, 4 Mar 2014 18:02:49 +0000 (10:02 -0800)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Sat, 8 Mar 2014 20:24:27 +0000 (21:24 +0100)
98 files changed:
src/librustc/back/archive.rs
src/librustc/back/arm.rs
src/librustc/back/link.rs
src/librustc/back/mips.rs
src/librustc/back/rpath.rs
src/librustc/back/target_strs.rs
src/librustc/back/x86.rs
src/librustc/back/x86_64.rs
src/librustc/driver/driver.rs
src/librustc/driver/session.rs
src/librustc/front/config.rs
src/librustc/front/feature_gate.rs
src/librustc/front/test.rs
src/librustc/lib.rs
src/librustc/metadata/creader.rs
src/librustc/metadata/csearch.rs
src/librustc/metadata/cstore.rs
src/librustc/metadata/decoder.rs
src/librustc/metadata/encoder.rs
src/librustc/metadata/filesearch.rs
src/librustc/metadata/loader.rs
src/librustc/metadata/tydecode.rs
src/librustc/metadata/tyencode.rs
src/librustc/middle/astencode.rs
src/librustc/middle/borrowck/check_loans.rs
src/librustc/middle/borrowck/gather_loans/mod.rs
src/librustc/middle/borrowck/gather_loans/restrictions.rs
src/librustc/middle/borrowck/mod.rs
src/librustc/middle/borrowck/move_data.rs
src/librustc/middle/cfg/construct.rs
src/librustc/middle/check_const.rs
src/librustc/middle/check_match.rs
src/librustc/middle/const_eval.rs
src/librustc/middle/dataflow.rs
src/librustc/middle/dead.rs
src/librustc/middle/entry.rs
src/librustc/middle/freevars.rs
src/librustc/middle/graph.rs
src/librustc/middle/kind.rs
src/librustc/middle/lang_items.rs
src/librustc/middle/lint.rs
src/librustc/middle/liveness.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/moves.rs
src/librustc/middle/pat_util.rs
src/librustc/middle/reachable.rs
src/librustc/middle/region.rs
src/librustc/middle/resolve.rs
src/librustc/middle/subst.rs
src/librustc/middle/trans/_match.rs
src/librustc/middle/trans/adt.rs
src/librustc/middle/trans/asm.rs
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/builder.rs
src/librustc/middle/trans/cabi.rs
src/librustc/middle/trans/cabi_arm.rs
src/librustc/middle/trans/cabi_mips.rs
src/librustc/middle/trans/cabi_x86.rs
src/librustc/middle/trans/cabi_x86_64.rs
src/librustc/middle/trans/callee.rs
src/librustc/middle/trans/closure.rs
src/librustc/middle/trans/common.rs
src/librustc/middle/trans/consts.rs
src/librustc/middle/trans/context.rs
src/librustc/middle/trans/controlflow.rs
src/librustc/middle/trans/debuginfo.rs
src/librustc/middle/trans/expr.rs
src/librustc/middle/trans/foreign.rs
src/librustc/middle/trans/glue.rs
src/librustc/middle/trans/intrinsic.rs
src/librustc/middle/trans/meth.rs
src/librustc/middle/trans/monomorphize.rs
src/librustc/middle/trans/reflect.rs
src/librustc/middle/trans/type_.rs
src/librustc/middle/trans/type_of.rs
src/librustc/middle/ty.rs
src/librustc/middle/ty_fold.rs
src/librustc/middle/typeck/check/_match.rs
src/librustc/middle/typeck/check/method.rs
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/regionmanip.rs
src/librustc/middle/typeck/check/vtable.rs
src/librustc/middle/typeck/check/writeback.rs
src/librustc/middle/typeck/coherence.rs
src/librustc/middle/typeck/collect.rs
src/librustc/middle/typeck/infer/combine.rs
src/librustc/middle/typeck/infer/lattice.rs
src/librustc/middle/typeck/infer/mod.rs
src/librustc/middle/typeck/infer/region_inference/mod.rs
src/librustc/middle/typeck/infer/resolve.rs
src/librustc/middle/typeck/infer/test.rs
src/librustc/middle/typeck/infer/unify.rs
src/librustc/middle/typeck/mod.rs
src/librustc/middle/typeck/rscope.rs
src/librustc/middle/typeck/variance.rs
src/librustc/util/common.rs
src/librustc/util/ppaux.rs
src/librustc/util/sha2.rs

index e0c570664fe5c9a38885962dee7fec92e7f1e709..ef8c2ddf38456943c7528466bc969ca96dd7b416 100644 (file)
@@ -16,6 +16,7 @@
 use lib::llvm::{ArchiveRef, llvm};
 
 use std::cast;
+use std::vec_ng::Vec;
 use std::io::fs;
 use std::io;
 use std::libc;
@@ -41,7 +42,7 @@ fn run_ar(sess: Session, args: &str, cwd: Option<&Path>,
         paths: &[&Path]) -> ProcessOutput {
     let ar = get_ar_prog(sess);
 
-    let mut args = ~[args.to_owned()];
+    let mut args = vec!(args.to_owned());
     let mut paths = paths.iter().map(|p| p.as_str().unwrap().to_owned());
     args.extend(&mut paths);
     debug!("{} {}", ar, args.connect(" "));
@@ -89,7 +90,7 @@ pub fn open(sess: Session, dst: Path) -> Archive {
     }
 
     /// Read a file in the archive
-    pub fn read(&self, file: &str) -> ~[u8] {
+    pub fn read(&self, file: &str) -> Vec<u8> {
         // Apparently if "ar p" is used on windows, it generates a corrupt file
         // which has bad headers and LLVM will immediately choke on it
         if cfg!(windows) && cfg!(windows) { // FIXME(#10734) double-and
@@ -119,7 +120,7 @@ pub fn add_rlib(&mut self, rlib: &Path, name: &str,
                     lto: bool) -> io::IoResult<()> {
         let object = format!("{}.o", name);
         let bytecode = format!("{}.bc", name);
-        let mut ignore = ~[METADATA_FILENAME, bytecode.as_slice()];
+        let mut ignore = vec!(METADATA_FILENAME, bytecode.as_slice());
         if lto {
             ignore.push(object.as_slice());
         }
@@ -143,7 +144,7 @@ pub fn update_symbols(&mut self) {
     }
 
     /// Lists all files in an archive
-    pub fn files(&self) -> ~[~str] {
+    pub fn files(&self) -> Vec<~str> {
         let output = run_ar(self.sess, "t", None, [&self.dst]);
         let output = str::from_utf8(output.output).unwrap();
         // use lines_any because windows delimits output with `\r\n` instead of
@@ -168,7 +169,7 @@ fn add_archive(&mut self, archive: &Path, name: &str,
         // all SYMDEF files as these are just magical placeholders which get
         // re-created when we make a new archive anyway.
         let files = try!(fs::readdir(loc.path()));
-        let mut inputs = ~[];
+        let mut inputs = Vec::new();
         for file in files.iter() {
             let filename = file.filename_str().unwrap();
             if skip.iter().any(|s| *s == filename) { continue }
@@ -182,7 +183,7 @@ fn add_archive(&mut self, archive: &Path, name: &str,
         if inputs.len() == 0 { return Ok(()) }
 
         // Finally, add all the renamed files to this archive
-        let mut args = ~[&self.dst];
+        let mut args = vec!(&self.dst);
         args.extend(&mut inputs.iter());
         run_ar(self.sess, "r", None, args.as_slice());
         Ok(())
index 92a0c90cd9ded2b56aa1c39bfced27141d8762bb..f86c87af726746e6da28a093755b7bbf5e6c47a8 100644 (file)
@@ -15,9 +15,9 @@
 
 pub fn get_target_strs(target_triple: ~str, target_os: abi::Os) -> target_strs::t {
     let cc_args = if target_triple.contains("thumb") {
-        ~[~"-mthumb"]
+        vec!(~"-mthumb")
     } else {
-        ~[~"-marm"]
+        vec!(~"-marm")
     };
     return target_strs::t {
         module_asm: ~"",
index 1bf2046c0331228db45fda6c67b26d22834f2ccc..5f65b6c156fc64d78a6808a3b5bdcdd990cecb40 100644 (file)
@@ -363,8 +363,8 @@ unsafe fn configure_llvm(sess: Session) {
         let vectorize_slp = !sess.opts.cg.no_vectorize_slp &&
                             sess.opts.optimize == session::Aggressive;
 
-        let mut llvm_c_strs = ~[];
-        let mut llvm_args = ~[];
+        let mut llvm_c_strs = Vec::new();
+        let mut llvm_args = Vec::new();
         {
             let add = |arg: &str| {
                 let s = arg.to_c_str();
@@ -781,8 +781,8 @@ fn remove(sess: Session, path: &Path) {
 pub fn link_binary(sess: Session,
                    trans: &CrateTranslation,
                    outputs: &OutputFilenames,
-                   id: &CrateId) -> ~[Path] {
-    let mut out_filenames = ~[];
+                   id: &CrateId) -> Vec<Path> {
+    let mut out_filenames = Vec::new();
     let crate_types = sess.crate_types.borrow();
     for &crate_type in crate_types.get().iter() {
         let out_file = link_binary_output(sess, trans, crate_type, outputs, id);
@@ -1071,7 +1071,7 @@ fn link_args(sess: Session,
              dylib: bool,
              tmpdir: &Path,
              obj_filename: &Path,
-             out_filename: &Path) -> ~[~str] {
+             out_filename: &Path) -> Vec<~str> {
 
     // The default library location, we need this to find the runtime.
     // The location of crates will be determined as needed.
@@ -1079,7 +1079,7 @@ fn link_args(sess: Session,
     let lib_path = sess.filesearch.get_target_lib_path();
     let stage: ~str = ~"-L" + lib_path.as_str().unwrap();
 
-    let mut args = ~[stage];
+    let mut args = vec!(stage);
 
     // FIXME (#9639): This needs to handle non-utf8 paths
     args.push_all([
@@ -1230,7 +1230,7 @@ fn link_args(sess: Session,
 // Also note that the native libraries linked here are only the ones located
 // in the current crate. Upstream crates with native library dependencies
 // may have their native library pulled in above.
-fn add_local_native_libraries(args: &mut ~[~str], sess: Session) {
+fn add_local_native_libraries(args: &mut Vec<~str> , sess: Session) {
     let addl_lib_search_paths = sess.opts.addl_lib_search_paths.borrow();
     for path in addl_lib_search_paths.get().iter() {
         // FIXME (#9639): This needs to handle non-utf8 paths
@@ -1263,7 +1263,7 @@ fn add_local_native_libraries(args: &mut ~[~str], sess: Session) {
 // Rust crates are not considered at all when creating an rlib output. All
 // dependencies will be linked when producing the final output (instead of
 // the intermediate rlib version)
-fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
+fn add_upstream_rust_crates(args: &mut Vec<~str> , sess: Session,
                             dylib: bool, tmpdir: &Path) {
 
     // As a limitation of the current implementation, we require that everything
@@ -1347,7 +1347,7 @@ fn unlib(config: @session::Config, stem: &str) -> ~str {
     // returning `None` if not all libraries could be found with that
     // preference.
     fn get_deps(cstore: &cstore::CStore,  preference: cstore::LinkagePreference)
-            -> Option<~[(ast::CrateNum, Path)]>
+            -> Option<Vec<(ast::CrateNum, Path)> >
     {
         let crates = cstore.get_used_crates(preference);
         if crates.iter().all(|&(_, ref p)| p.is_some()) {
@@ -1358,8 +1358,8 @@ fn get_deps(cstore: &cstore::CStore,  preference: cstore::LinkagePreference)
     }
 
     // Adds the static "rlib" versions of all crates to the command line.
-    fn add_static_crates(args: &mut ~[~str], sess: Session, tmpdir: &Path,
-                         crates: ~[(ast::CrateNum, Path)]) {
+    fn add_static_crates(args: &mut Vec<~str> , sess: Session, tmpdir: &Path,
+                         crates: Vec<(ast::CrateNum, Path)> ) {
         for (cnum, cratepath) in crates.move_iter() {
             // When performing LTO on an executable output, all of the
             // bytecode from the upstream libraries has already been
@@ -1405,8 +1405,8 @@ fn add_static_crates(args: &mut ~[~str], sess: Session, tmpdir: &Path,
     }
 
     // Same thing as above, but for dynamic crates instead of static crates.
-    fn add_dynamic_crates(args: &mut ~[~str], sess: Session,
-                          crates: ~[(ast::CrateNum, Path)]) {
+    fn add_dynamic_crates(args: &mut Vec<~str> , sess: Session,
+                          crates: Vec<(ast::CrateNum, Path)> ) {
         // If we're performing LTO, then it should have been previously required
         // that all upstream rust dependencies were available in an rlib format.
         assert!(!sess.lto());
@@ -1440,7 +1440,7 @@ fn add_dynamic_crates(args: &mut ~[~str], sess: Session,
 // generic function calls a native function, then the generic function must
 // be instantiated in the target crate, meaning that the native symbol must
 // also be resolved in the target crate.
-fn add_upstream_native_libraries(args: &mut ~[~str], sess: Session) {
+fn add_upstream_native_libraries(args: &mut Vec<~str> , sess: Session) {
     let cstore = sess.cstore;
     cstore.iter_crate_data(|cnum, _| {
         let libs = csearch::get_native_libraries(cstore, cnum);
index ce716f6f94b3570e079ae24928f2b199a3616ca1..c1f3abe23c6b29fd41febdca72a66571a30588b5 100644 (file)
@@ -63,6 +63,6 @@ pub fn get_target_strs(target_triple: ~str, target_os: abi::Os) -> target_strs::
 
         target_triple: target_triple,
 
-        cc_args: ~[],
+        cc_args: Vec::new(),
     };
 }
index 4b331925b393f91f56d2749372cc7002b4897df4..df0160faaf89e119299bc893efb8eae8c38d75a4 100644 (file)
@@ -21,15 +21,15 @@ fn not_win32(os: abi::Os) -> bool {
   os != abi::OsWin32
 }
 
-pub fn get_rpath_flags(sess: session::Session, out_filename: &Path) -> ~[~str] {
+pub fn get_rpath_flags(sess: session::Session, out_filename: &Path) -> Vec<~str> {
     let os = sess.targ_cfg.os;
 
     // No rpath on windows
     if os == abi::OsWin32 {
-        return ~[];
+        return Vec::new();
     }
 
-    let mut flags = ~[];
+    let mut flags = Vec::new();
 
     if sess.targ_cfg.os == abi::OsFreebsd {
         flags.push_all([~"-Wl,-rpath,/usr/local/lib/gcc46",
@@ -60,8 +60,8 @@ fn get_sysroot_absolute_rt_lib(sess: session::Session) -> Path {
     p
 }
 
-pub fn rpaths_to_flags(rpaths: &[~str]) -> ~[~str] {
-    let mut ret = ~[];
+pub fn rpaths_to_flags(rpaths: &[~str]) -> Vec<~str> {
+    let mut ret = Vec::new();
     for rpath in rpaths.iter() {
         ret.push("-Wl,-rpath," + *rpath);
     }
@@ -72,7 +72,7 @@ fn get_rpaths(os: abi::Os,
               sysroot: &Path,
               output: &Path,
               libs: &[Path],
-              target_triple: &str) -> ~[~str] {
+              target_triple: &str) -> Vec<~str> {
     debug!("sysroot: {}", sysroot.display());
     debug!("output: {}", output.display());
     debug!("libs:");
@@ -91,7 +91,7 @@ fn get_rpaths(os: abi::Os,
     let abs_rpaths = get_absolute_rpaths(libs);
 
     // And a final backup rpath to the global library location.
-    let fallback_rpaths = ~[get_install_prefix_rpath(target_triple)];
+    let fallback_rpaths = vec!(get_install_prefix_rpath(target_triple));
 
     fn log_rpaths(desc: &str, rpaths: &[~str]) {
         debug!("{} rpaths:", desc);
@@ -115,7 +115,7 @@ fn log_rpaths(desc: &str, rpaths: &[~str]) {
 
 fn get_rpaths_relative_to_output(os: abi::Os,
                                  output: &Path,
-                                 libs: &[Path]) -> ~[~str] {
+                                 libs: &[Path]) -> Vec<~str> {
     libs.iter().map(|a| get_rpath_relative_to_output(os, output, a)).collect()
 }
 
@@ -145,7 +145,7 @@ pub fn get_rpath_relative_to_output(os: abi::Os,
     prefix+"/"+relative.as_str().expect("non-utf8 component in path")
 }
 
-fn get_absolute_rpaths(libs: &[Path]) -> ~[~str] {
+fn get_absolute_rpaths(libs: &[Path]) -> Vec<~str> {
     libs.iter().map(|a| get_absolute_rpath(a)).collect()
 }
 
@@ -167,9 +167,9 @@ pub fn get_install_prefix_rpath(target_triple: &str) -> ~str {
     path.as_str().expect("non-utf8 component in rpath").to_owned()
 }
 
-pub fn minimize_rpaths(rpaths: &[~str]) -> ~[~str] {
+pub fn minimize_rpaths(rpaths: &[~str]) -> Vec<~str> {
     let mut set = HashSet::new();
-    let mut minimized = ~[];
+    let mut minimized = Vec::new();
     for rpath in rpaths.iter() {
         if set.insert(rpath.as_slice()) {
             minimized.push(rpath.clone());
@@ -190,7 +190,7 @@ mod test {
     #[test]
     fn test_rpaths_to_flags() {
         let flags = rpaths_to_flags([~"path1", ~"path2"]);
-        assert_eq!(flags, ~[~"-Wl,-rpath,path1", ~"-Wl,-rpath,path2"]);
+        assert_eq!(flags, vec!(~"-Wl,-rpath,path1", ~"-Wl,-rpath,path2"));
     }
 
     #[test]
index 044b5c7017c15d874516c37a8cee3d855c05f592..1528fff511310f0c9c7c539fd489a08db66564b3 100644 (file)
@@ -15,5 +15,5 @@ pub struct t {
     meta_sect_name: ~str,
     data_layout: ~str,
     target_triple: ~str,
-    cc_args: ~[~str],
+    cc_args: Vec<~str> ,
 }
index de0372b83b972453783381bcfd56ba85481c73cc..9b22c82e91776a9f01061a694e736e9f755e1f7e 100644 (file)
@@ -46,6 +46,6 @@ pub fn get_target_strs(target_triple: ~str, target_os: abi::Os) -> target_strs::
 
         target_triple: target_triple,
 
-        cc_args: ~[~"-m32"],
+        cc_args: vec!(~"-m32"),
     };
 }
index dce4de3dce3c10d593d232090213d9e58970e91b..524ae5e55248485c8b03b8bb16fbc364d4d2acbf 100644 (file)
@@ -54,6 +54,6 @@ pub fn get_target_strs(target_triple: ~str, target_os: abi::Os) -> target_strs::
 
         target_triple: target_triple,
 
-        cc_args: ~[~"-m64"],
+        cc_args: vec!(~"-m64"),
     };
 }
index 5b335d163d8d097084b5c0e31ccfe1b5d11a7ed6..af3970fcf7a4b7cb3d6f920def896974d2f24a34 100644 (file)
@@ -145,7 +145,7 @@ pub fn build_configuration(sess: Session) -> ast::CrateConfig {
 }
 
 // Convert strings provided as --cfg [cfgspec] into a crate_cfg
-fn parse_cfgspecs(cfgspecs: ~[~str])
+fn parse_cfgspecs(cfgspecs: Vec<~str> )
                   -> ast::CrateConfig {
     cfgspecs.move_iter().map(|s| {
         let sess = parse::new_parse_sess();
@@ -399,8 +399,8 @@ pub struct CrateTranslation {
     module: ModuleRef,
     metadata_module: ModuleRef,
     link: LinkMeta,
-    metadata: ~[u8],
-    reachable: ~[~str],
+    metadata: Vec<u8> ,
+    reachable: Vec<~str> ,
 }
 
 /// Run the translation phase to LLVM, after which the AST and analysis can
@@ -489,7 +489,7 @@ fn write_out_deps(sess: Session,
                   krate: &ast::Crate) -> io::IoResult<()> {
     let id = link::find_crate_id(krate.attrs.as_slice(), outputs);
 
-    let mut out_filenames = ~[];
+    let mut out_filenames = Vec::new();
     for output_type in sess.opts.output_types.iter() {
         let file = outputs.path(*output_type);
         match *output_type {
@@ -524,7 +524,7 @@ fn write_out_deps(sess: Session,
 
     // Build a list of files used to compile the output and
     // write Makefile-compatible dependency rules
-    let files: ~[~str] = {
+    let files: Vec<~str> = {
         let files = sess.codemap.files.borrow();
         files.get()
              .iter()
@@ -786,14 +786,14 @@ pub fn build_session_options(matches: &getopts::Matches)
 
     let lint_levels = [lint::allow, lint::warn,
                        lint::deny, lint::forbid];
-    let mut lint_opts = ~[];
+    let mut lint_opts = Vec::new();
     let lint_dict = lint::get_lint_dict();
     for level in lint_levels.iter() {
         let level_name = lint::level_to_str(*level);
 
         let level_short = level_name.slice_chars(0, 1);
         let level_short = level_short.to_ascii().to_upper().into_str();
-        let flags = vec::append(matches.opt_strs(level_short),
+        let flags = vec_ng::append(matches.opt_strs(level_short),
                                 matches.opt_strs(level_name));
         for lint_name in flags.iter() {
             let lint_name = lint_name.replace("-", "_");
@@ -829,7 +829,7 @@ pub fn build_session_options(matches: &getopts::Matches)
     }
 
     let mut output_types = if parse_only || no_trans {
-        ~[]
+        Vec::new()
     } else {
         matches.opt_strs("emit").flat_map(|s| {
             s.split(',').map(|part| {
@@ -1005,7 +1005,7 @@ pub fn build_session_(sopts: @session::Options,
         working_dir: os::getcwd(),
         lints: RefCell::new(HashMap::new()),
         node_id: Cell::new(1),
-        crate_types: @RefCell::new(~[]),
+        crate_types: @RefCell::new(Vec::new()),
         features: front::feature_gate::Features::new()
     }
 }
@@ -1026,8 +1026,8 @@ pub fn parse_pretty(sess: Session, name: &str) -> PpMode {
 }
 
 // rustc command line options
-pub fn optgroups() -> ~[getopts::OptGroup] {
- ~[
+pub fn optgroups() -> Vec<getopts::OptGroup> {
+ vec!(
   optflag("h", "help", "Display this message"),
   optmulti("", "cfg", "Configure the compilation environment", "SPEC"),
   optmulti("L", "",   "Add a directory to the library search path", "PATH"),
@@ -1071,8 +1071,7 @@ pub fn optgroups() -> ~[getopts::OptGroup] {
   optmulti("F", "forbid", "Set lint forbidden", "OPT"),
   optmulti("C", "codegen", "Set a codegen option", "OPT[=VALUE]"),
   optmulti("Z", "", "Set internal debugging options", "FLAG"),
-  optflag( "v", "version", "Print version info and exit"),
- ]
+  optflag( "v", "version", "Print version info and exit"))
 }
 
 pub struct OutputFilenames {
index 10ec54d0dce0fbe2a6985f6c9a95e7f3db30f292..62d85af399d80461013ddede551ca270efbf8e68 100644 (file)
@@ -74,8 +74,8 @@ macro_rules! debugging_opts(
     0
 )
 
-pub fn debugging_opts_map() -> ~[(&'static str, &'static str, u64)] {
-    ~[("verbose", "in general, enable more debug printouts", VERBOSE),
+pub fn debugging_opts_map() -> Vec<(&'static str, &'static str, u64)> {
+    vec!(("verbose", "in general, enable more debug printouts", VERBOSE),
      ("time-passes", "measure time of each rustc pass", TIME_PASSES),
      ("count-llvm-insns", "count where LLVM \
                            instrs originate", COUNT_LLVM_INSNS),
@@ -102,8 +102,7 @@ pub fn debugging_opts_map() -> ~[(&'static str, &'static str, u64)] {
       PRINT_LLVM_PASSES),
      ("lto", "Perform LLVM link-time optimizations", LTO),
      ("ast-json", "Print the AST as JSON and halt", AST_JSON),
-     ("ast-json-noexpand", "Print the pre-expansion AST as JSON and halt", AST_JSON_NOEXPAND),
-    ]
+     ("ast-json-noexpand", "Print the pre-expansion AST as JSON and halt", AST_JSON_NOEXPAND))
 }
 
 #[deriving(Clone, Eq)]
@@ -125,13 +124,13 @@ pub enum DebugInfoLevel {
 pub struct Options {
     // The crate config requested for the session, which may be combined
     // with additional crate configurations during the compile process
-    crate_types: ~[CrateType],
+    crate_types: Vec<CrateType> ,
 
     gc: bool,
     optimize: OptLevel,
     debuginfo: DebugInfoLevel,
-    lint_opts: ~[(lint::Lint, lint::level)],
-    output_types: ~[back::link::OutputType],
+    lint_opts: Vec<(lint::Lint, lint::level)> ,
+    output_types: Vec<back::link::OutputType> ,
     // This was mutable for rustpkg, which updates search paths based on the
     // parsed code. It remains mutable in case its replacements wants to use
     // this.
@@ -192,9 +191,9 @@ pub struct Session_ {
     local_crate_source_file: Option<Path>,
     working_dir: Path,
     lints: RefCell<HashMap<ast::NodeId,
-                           ~[(lint::Lint, codemap::Span, ~str)]>>,
+                           Vec<(lint::Lint, codemap::Span, ~str)> >>,
     node_id: Cell<ast::NodeId>,
-    crate_types: @RefCell<~[CrateType]>,
+    crate_types: @RefCell<Vec<CrateType> >,
     features: front::feature_gate::Features
 }
 
@@ -259,7 +258,7 @@ pub fn add_lint(&self,
             Some(arr) => { arr.push((lint, sp, msg)); return; }
             None => {}
         }
-        lints.get().insert(id, ~[(lint, sp, msg)]);
+        lints.get().insert(id, vec!((lint, sp, msg)));
     }
     pub fn next_node_id(&self) -> ast::NodeId {
         self.reserve_node_ids(1)
@@ -318,12 +317,22 @@ pub fn show_span(&self) -> bool {
 /// Some reasonable defaults
 pub fn basic_options() -> @Options {
     @Options {
-        crate_types: ~[],
+        crate_types: Vec::new(),
         gc: false,
         optimize: No,
+<<<<<<< HEAD
         debuginfo: NoDebugInfo,
         lint_opts: ~[],
         output_types: ~[],
+||||||| merged common ancestors
+        debuginfo: false,
+        lint_opts: ~[],
+        output_types: ~[],
+=======
+        debuginfo: false,
+        lint_opts: Vec::new(),
+        output_types: Vec::new(),
+>>>>>>> librustc: Automatically change uses of `~[T]` to `Vec<T>` in rustc.
         addl_lib_search_paths: @RefCell::new(HashSet::new()),
         maybe_sysroot: None,
         target_triple: host_triple(),
@@ -394,7 +403,7 @@ fn parse_string(slot: &mut ~str, v: Option<&str>) -> bool {
             }
         }
 
-        fn parse_list(slot: &mut ~[~str], v: Option<&str>) -> bool {
+        fn parse_list(slot: &mut Vec<~str> , v: Option<&str>) -> bool {
             match v {
                 Some(s) => {
                     for s in s.words() {
@@ -414,15 +423,15 @@ fn parse_list(slot: &mut ~[~str], v: Option<&str>) -> bool {
         "tool to assemble archives with"),
     linker: Option<~str> = (None, parse_opt_string,
         "system linker to link outputs with"),
-    link_args: ~[~str] = (~[], parse_list,
+    link_args: Vec<~str> = (Vec::new(), parse_list,
         "extra arguments to pass to the linker (space separated)"),
     target_cpu: ~str = (~"generic", parse_string,
         "select target processor (llc -mcpu=help for details)"),
     target_feature: ~str = (~"", parse_string,
         "target specific attributes (llc -mattr=help for details)"),
-    passes: ~[~str] = (~[], parse_list,
+    passes: Vec<~str> = (Vec::new(), parse_list,
         "a list of extra LLVM passes to run (space separated)"),
-    llvm_args: ~[~str] = (~[], parse_list,
+    llvm_args: Vec<~str> = (Vec::new(), parse_list,
         "a list of arguments to pass to llvm (space separated)"),
     save_temps: bool = (false, parse_bool,
         "save all temporary output files during compilation"),
@@ -476,11 +485,11 @@ pub fn default_lib_output() -> CrateType {
 }
 
 pub fn collect_crate_types(session: &Session,
-                           attrs: &[ast::Attribute]) -> ~[CrateType] {
+                           attrs: &[ast::Attribute]) -> Vec<CrateType> {
     // If we're generating a test executable, then ignore all other output
     // styles at all other locations
     if session.opts.test {
-        return ~[CrateTypeExecutable];
+        return Vec<CrateTypeExecutable> ;
     }
     let mut base = session.opts.crate_types.clone();
     let mut iter = attrs.iter().filter_map(|a| {
index 26d72f843515e76e192110936a99b064e5033d8c..cf2c0d0775c560ef1c7f2c1fc1f8a28030d8739d 100644 (file)
@@ -58,7 +58,7 @@ fn filter_view_item<'r>(cx: &Context, view_item: &'r ast::ViewItem)
 }
 
 fn fold_mod(cx: &mut Context, m: &ast::Mod) -> ast::Mod {
-    let filtered_items: ~[&@ast::Item] = m.items.iter()
+    let filtered_items: Vec<&@ast::Item> = m.items.iter()
             .filter(|&a| item_in_cfg(cx, *a))
             .collect();
     let flattened_items = filtered_items.move_iter()
@@ -170,7 +170,7 @@ fn retain_stmt(cx: &Context, stmt: @ast::Stmt) -> bool {
 }
 
 fn fold_block(cx: &mut Context, b: ast::P<ast::Block>) -> ast::P<ast::Block> {
-    let resulting_stmts: ~[&@ast::Stmt] =
+    let resulting_stmts: Vec<&@ast::Stmt> =
         b.stmts.iter().filter(|&a| retain_stmt(cx, *a)).collect();
     let resulting_stmts = resulting_stmts.move_iter()
         .flat_map(|&stmt| cx.fold_stmt(stmt).move_iter())
index fb58b3f4b7ba3ea7fd7ff9eea8df7c492da49eaa..81aa48a6435bfa43ddb228ff0afaa5978eae8603 100644 (file)
@@ -85,7 +85,7 @@ pub fn new() -> Features {
 }
 
 struct Context {
-    features: ~[&'static str],
+    features: Vec<&'static str> ,
     sess: Session,
 }
 
@@ -280,7 +280,7 @@ fn visit_generics(&mut self, generics: &ast::Generics, _: ()) {
 
 pub fn check_crate(sess: Session, krate: &ast::Crate) {
     let mut cx = Context {
-        features: ~[],
+        features: Vec::new(),
         sess: sess,
     };
 
index 9c2ebb4fb5d6ede66b8a8d0d7f48e97e51d99e3d..82fae11f873a4b1da401f9617263ea56f397e041 100644 (file)
@@ -40,7 +40,7 @@
 
 struct Test {
     span: Span,
-    path: ~[ast::Ident],
+    path: Vec<ast::Ident> ,
     bench: bool,
     ignore: bool,
     should_fail: bool
@@ -48,9 +48,9 @@ struct Test {
 
 struct TestCtxt<'a> {
     sess: session::Session,
-    path: RefCell<~[ast::Ident]>,
+    path: RefCell<Vec<ast::Ident> >,
     ext_cx: ExtCtxt<'a>,
-    testfns: RefCell<~[Test]>,
+    testfns: RefCell<Vec<Test> >,
     is_test_crate: bool,
     config: ast::CrateConfig,
 }
@@ -171,8 +171,8 @@ fn generate_test_harness(sess: session::Session, krate: ast::Crate)
                                  loader: loader,
                                  deriving_hash_type_parameter: false,
                              }),
-        path: RefCell::new(~[]),
-        testfns: RefCell::new(~[]),
+        path: RefCell::new(Vec::new()),
+        testfns: RefCell::new(Vec::new()),
         is_test_crate: is_test_crate(&krate),
         config: krate.config.clone(),
     };
@@ -303,7 +303,7 @@ fn mk_std(cx: &TestCtxt) -> ast::ViewItem {
     let vi = if cx.is_test_crate {
         ast::ViewItemUse(
             vec!(@nospan(ast::ViewPathSimple(id_test,
-                                             path_node(~[id_test]),
+                                             path_node(vec!(id_test)),
                                              ast::DUMMY_NODE_ID))))
     } else {
         ast::ViewItemExternCrate(id_test,
@@ -363,7 +363,7 @@ fn nospan<T>(t: T) -> codemap::Spanned<T> {
     codemap::Spanned { node: t, span: DUMMY_SP }
 }
 
-fn path_node(ids: ~[ast::Ident]) -> ast::Path {
+fn path_node(ids: Vec<ast::Ident> ) -> ast::Path {
     ast::Path {
         span: DUMMY_SP,
         global: false,
@@ -375,7 +375,7 @@ fn path_node(ids: ~[ast::Ident]) -> ast::Path {
     }
 }
 
-fn path_node_global(ids: ~[ast::Ident]) -> ast::Path {
+fn path_node_global(ids: Vec<ast::Ident> ) -> ast::Path {
     ast::Path {
         span: DUMMY_SP,
         global: true,
index d1560abf773d1eb035765b2e919f07a815b40054..6ff0733e98b096f2c45fdf1cbe0f3975d866a507 100644 (file)
@@ -164,7 +164,7 @@ pub fn describe_warnings() {
     let lint_dict = lint::get_lint_dict();
     let mut lint_dict = lint_dict.move_iter()
                                  .map(|(k, v)| (v, k))
-                                 .collect::<~[(lint::LintSpec, &'static str)]>();
+                                 .collect::<Vec<(lint::LintSpec, &'static str)> >();
     lint_dict.sort();
 
     let mut max_key = 0;
@@ -236,7 +236,7 @@ pub fn run_compiler(args: &[~str]) {
         return;
     }
 
-    let lint_flags = vec::append(matches.opt_strs("W"),
+    let lint_flags = vec_ng::append(matches.opt_strs("W"),
                                  matches.opt_strs("warn"));
     if lint_flags.iter().any(|x| x == &~"help") {
         describe_warnings();
@@ -337,7 +337,7 @@ pub fn run_compiler(args: &[~str]) {
 }
 
 fn parse_crate_attrs(sess: session::Session, input: &d::Input) ->
-                     ~[ast::Attribute] {
+                     Vec<ast::Attribute> {
     let result = match *input {
         d::FileInput(ref ifile) => {
             parse::parse_crate_attrs_from_file(ifile,
index 7289155291a6e235cd7204a99dd67157e3755264..36f5929ba261d59f13d0fc6d41ec9304bfe58041 100644 (file)
@@ -46,7 +46,7 @@ pub fn read_crates(sess: Session,
     let mut e = Env {
         sess: sess,
         os: os,
-        crate_cache: @RefCell::new(~[]),
+        crate_cache: @RefCell::new(Vec::new()),
         next_crate_num: 1,
         intr: intr
     };
@@ -121,7 +121,7 @@ fn warn_if_multiple_versions(e: &mut Env,
 struct Env {
     sess: Session,
     os: loader::Os,
-    crate_cache: @RefCell<~[cache_entry]>,
+    crate_cache: @RefCell<vec!(cache_entry)>,
     next_crate_num: ast::CrateNum,
     intr: @IdentInterner
 }
@@ -401,7 +401,7 @@ pub fn new(sess: Session) -> Loader {
             env: Env {
                 sess: sess,
                 os: os,
-                crate_cache: @RefCell::new(~[]),
+                crate_cache: @RefCell::new(Vec::new()),
                 next_crate_num: 1,
                 intr: token::get_ident_interner(),
             }
index f238bc880a32660d5cdd6885e159e0151c883b2f..fa00b3c69b2cb8c91f948485a6d9758bc27f94a2 100644 (file)
@@ -86,14 +86,14 @@ pub fn each_top_level_item_of_crate(cstore: @cstore::CStore,
                                           callback)
 }
 
-pub fn get_item_path(tcx: ty::ctxt, def: ast::DefId) -> ~[ast_map::PathElem] {
+pub fn get_item_path(tcx: ty::ctxt, def: ast::DefId) -> Vec<ast_map::PathElem> {
     let cstore = tcx.cstore;
     let cdata = cstore.get_crate_data(def.krate);
     let path = decoder::get_item_path(cdata, def.node);
 
     // FIXME #1920: This path is not always correct if the crate is not linked
     // into the root namespace.
-    vec::append(~[ast_map::PathMod(token::intern(cdata.name))], path)
+    vec_ng::append(vec!(ast_map::PathMod(token::intern(cdata.name))), path)
 }
 
 pub enum found_ast {
@@ -114,7 +114,7 @@ pub fn maybe_get_item_ast(tcx: ty::ctxt, def: ast::DefId,
 }
 
 pub fn get_enum_variants(tcx: ty::ctxt, def: ast::DefId)
-                      -> ~[@ty::VariantInfo] {
+                      -> Vec<@ty::VariantInfo> {
     let cstore = tcx.cstore;
     let cdata = cstore.get_crate_data(def.krate);
     return decoder::get_enum_variants(cstore.intr, cdata, def.node, tcx)
@@ -141,7 +141,7 @@ pub fn get_method_name_and_explicit_self(cstore: @cstore::CStore,
 }
 
 pub fn get_trait_method_def_ids(cstore: @cstore::CStore,
-                                def: ast::DefId) -> ~[ast::DefId] {
+                                def: ast::DefId) -> Vec<ast::DefId> {
     let cdata = cstore.get_crate_data(def.krate);
     decoder::get_trait_method_def_ids(cdata, def.node)
 }
@@ -154,13 +154,13 @@ pub fn get_item_variances(cstore: @cstore::CStore,
 
 pub fn get_provided_trait_methods(tcx: ty::ctxt,
                                   def: ast::DefId)
-                               -> ~[@ty::Method] {
+                               -> Vec<@ty::Method> {
     let cstore = tcx.cstore;
     let cdata = cstore.get_crate_data(def.krate);
     decoder::get_provided_trait_methods(cstore.intr, cdata, def.node, tcx)
 }
 
-pub fn get_supertraits(tcx: ty::ctxt, def: ast::DefId) -> ~[@ty::TraitRef] {
+pub fn get_supertraits(tcx: ty::ctxt, def: ast::DefId) -> Vec<@ty::TraitRef> {
     let cstore = tcx.cstore;
     let cdata = cstore.get_crate_data(def.krate);
     decoder::get_supertraits(cdata, def.node, tcx)
@@ -174,21 +174,21 @@ pub fn get_type_name_if_impl(cstore: @cstore::CStore, def: ast::DefId)
 
 pub fn get_static_methods_if_impl(cstore: @cstore::CStore,
                                   def: ast::DefId)
-                               -> Option<~[StaticMethodInfo]> {
+                               -> Option<Vec<StaticMethodInfo> > {
     let cdata = cstore.get_crate_data(def.krate);
     decoder::get_static_methods_if_impl(cstore.intr, cdata, def.node)
 }
 
 pub fn get_item_attrs(cstore: @cstore::CStore,
                       def_id: ast::DefId,
-                      f: |~[@ast::MetaItem]|) {
+                      f: |Vec<@ast::MetaItem> |) {
     let cdata = cstore.get_crate_data(def_id.krate);
     decoder::get_item_attrs(cdata, def_id.node, f)
 }
 
 pub fn get_struct_fields(cstore: @cstore::CStore,
                          def: ast::DefId)
-                      -> ~[ty::field_ty] {
+                      -> Vec<ty::field_ty> {
     let cdata = cstore.get_crate_data(def.krate);
     decoder::get_struct_fields(cstore.intr, cdata, def.node)
 }
@@ -222,8 +222,8 @@ pub fn get_field_type(tcx: ty::ctxt, class_id: ast::DefId,
                  class_id, def) );
     let ty = decoder::item_type(def, the_field, tcx, cdata);
     ty::ty_param_bounds_and_ty {
-        generics: ty::Generics {type_param_defs: Rc::new(~[]),
-                                region_param_defs: Rc::new(~[])},
+        generics: ty::Generics {type_param_defs: Rc::new(Vec::new()),
+                                region_param_defs: Rc::new(Vec::new())},
         ty: ty
     }
 }
@@ -262,7 +262,7 @@ pub fn get_item_visibility(cstore: @cstore::CStore,
 
 pub fn get_native_libraries(cstore: @cstore::CStore,
                             crate_num: ast::CrateNum)
-                                -> ~[(cstore::NativeLibaryKind, ~str)] {
+                                -> Vec<(cstore::NativeLibaryKind, ~str)> {
     let cdata = cstore.get_crate_data(crate_num);
     decoder::get_native_libraries(cdata)
 }
@@ -308,7 +308,7 @@ pub fn get_macro_registrar_fn(cstore: @cstore::CStore,
 
 pub fn get_exported_macros(cstore: @cstore::CStore,
                            crate_num: ast::CrateNum)
-                           -> ~[~str] {
+                           -> Vec<~str> {
     let cdata = cstore.get_crate_data(crate_num);
     decoder::get_exported_macros(cdata)
 }
index d6cee8fadb56d424a3a29129b36eaf81db1832df..f0c67c4140aba9f592234f61853d2e5743758d19 100644 (file)
@@ -67,9 +67,9 @@ pub struct CrateSource {
 pub struct CStore {
     priv metas: RefCell<HashMap<ast::CrateNum, @crate_metadata>>,
     priv extern_mod_crate_map: RefCell<extern_mod_crate_map>,
-    priv used_crate_sources: RefCell<~[CrateSource]>,
-    priv used_libraries: RefCell<~[(~str, NativeLibaryKind)]>,
-    priv used_link_args: RefCell<~[~str]>,
+    priv used_crate_sources: RefCell<Vec<CrateSource> >,
+    priv used_libraries: RefCell<Vec<(~str, NativeLibaryKind)> >,
+    priv used_link_args: RefCell<Vec<~str> >,
     intr: @IdentInterner
 }
 
@@ -81,9 +81,9 @@ pub fn new(intr: @IdentInterner) -> CStore {
         CStore {
             metas: RefCell::new(HashMap::new()),
             extern_mod_crate_map: RefCell::new(HashMap::new()),
-            used_crate_sources: RefCell::new(~[]),
-            used_libraries: RefCell::new(~[]),
-            used_link_args: RefCell::new(~[]),
+            used_crate_sources: RefCell::new(Vec::new()),
+            used_libraries: RefCell::new(Vec::new()),
+            used_link_args: RefCell::new(Vec::new()),
             intr: intr
         }
     }
@@ -143,7 +143,7 @@ pub fn reset(&self) {
     }
 
     pub fn get_used_crates(&self, prefer: LinkagePreference)
-                           -> ~[(ast::CrateNum, Option<Path>)] {
+                           -> Vec<(ast::CrateNum, Option<Path>)> {
         let used_crate_sources = self.used_crate_sources.borrow();
         used_crate_sources.get()
             .iter()
@@ -161,7 +161,7 @@ pub fn add_used_library(&self, lib: ~str, kind: NativeLibaryKind) {
     }
 
     pub fn get_used_libraries<'a>(&'a self)
-                              -> &'a RefCell<~[(~str, NativeLibaryKind)]> {
+                              -> &'a RefCell<Vec<(~str, NativeLibaryKind)> > {
         &self.used_libraries
     }
 
@@ -172,7 +172,7 @@ pub fn add_used_link_args(&self, args: &str) {
         }
     }
 
-    pub fn get_used_link_args<'a>(&'a self) -> &'a RefCell<~[~str]> {
+    pub fn get_used_link_args<'a>(&'a self) -> &'a RefCell<Vec<~str> > {
         &self.used_link_args
     }
 
index 2bf54e0373d2b99a27ea62660082f582f4c67ca2..0c0dcf340d8bc5156cf8f14b2e97bdc070da2ea0 100644 (file)
@@ -250,8 +250,8 @@ fn item_ty_param_defs(item: ebml::Doc,
                       tcx: ty::ctxt,
                       cdata: Cmd,
                       tag: uint)
-                      -> Rc<~[ty::TypeParameterDef]> {
-    let mut bounds = ~[];
+                      -> Rc<Vec<ty::TypeParameterDef> > {
+    let mut bounds = Vec::new();
     reader::tagged_docs(item, tag, |p| {
         let bd = parse_type_param_def_data(
             p.data, p.start, cdata.cnum, tcx,
@@ -263,8 +263,8 @@ fn item_ty_param_defs(item: ebml::Doc,
 }
 
 fn item_region_param_defs(item_doc: ebml::Doc, cdata: Cmd)
-                          -> Rc<~[ty::RegionParameterDef]> {
-    let mut v = ~[];
+                          -> Rc<Vec<ty::RegionParameterDef> > {
+    let mut v = Vec::new();
     reader::tagged_docs(item_doc, tag_region_param_def, |rp_doc| {
             let ident_str_doc = reader::get_doc(rp_doc,
                                                 tag_region_param_def_ident);
@@ -287,8 +287,8 @@ fn item_ty_param_count(item: ebml::Doc) -> uint {
     n
 }
 
-fn enum_variant_ids(item: ebml::Doc, cdata: Cmd) -> ~[ast::DefId] {
-    let mut ids: ~[ast::DefId] = ~[];
+fn enum_variant_ids(item: ebml::Doc, cdata: Cmd) -> Vec<ast::DefId> {
+    let mut ids: Vec<ast::DefId> = Vec::new();
     let v = tag_items_data_item_variant;
     reader::tagged_docs(item, v, |p| {
         let ext = reader::with_doc_data(p, parse_def_id);
@@ -298,7 +298,7 @@ fn enum_variant_ids(item: ebml::Doc, cdata: Cmd) -> ~[ast::DefId] {
     return ids;
 }
 
-fn item_path(item_doc: ebml::Doc) -> ~[ast_map::PathElem] {
+fn item_path(item_doc: ebml::Doc) -> Vec<ast_map::PathElem> {
     let path_doc = reader::get_doc(item_doc, tag_path);
 
     let len_doc = reader::get_doc(path_doc, tag_path_len);
@@ -667,15 +667,15 @@ pub fn each_top_level_item_of_crate(intr: @IdentInterner,
                                 callback)
 }
 
-pub fn get_item_path(cdata: Cmd, id: ast::NodeId) -> ~[ast_map::PathElem] {
+pub fn get_item_path(cdata: Cmd, id: ast::NodeId) -> Vec<ast_map::PathElem> {
     item_path(lookup_item(id, cdata.data()))
 }
 
 pub type DecodeInlinedItem<'a> = 'a |cdata: @cstore::crate_metadata,
                                      tcx: ty::ctxt,
-                                     path: ~[ast_map::PathElem],
+                                     path: Vec<ast_map::PathElem> ,
                                      par_doc: ebml::Doc|
-                                     -> Result<ast::InlinedItem, ~[ast_map::PathElem]>;
+                                     -> Result<ast::InlinedItem, Vec<ast_map::PathElem> >;
 
 pub fn maybe_get_item_ast(cdata: Cmd, tcx: ty::ctxt, id: ast::NodeId,
                           decode_inlined_item: DecodeInlinedItem)
@@ -702,11 +702,11 @@ pub fn maybe_get_item_ast(cdata: Cmd, tcx: ty::ctxt, id: ast::NodeId,
 }
 
 pub fn get_enum_variants(intr: @IdentInterner, cdata: Cmd, id: ast::NodeId,
-                     tcx: ty::ctxt) -> ~[@ty::VariantInfo] {
+                     tcx: ty::ctxt) -> Vec<@ty::VariantInfo> {
     let data = cdata.data();
     let items = reader::get_doc(reader::Doc(data), tag_items);
     let item = find_item(id, items);
-    let mut infos: ~[@ty::VariantInfo] = ~[];
+    let mut infos: Vec<@ty::VariantInfo> = Vec::new();
     let variant_ids = enum_variant_ids(item, cdata);
     let mut disr_val = 0;
     for did in variant_ids.iter() {
@@ -716,7 +716,7 @@ pub fn get_enum_variants(intr: @IdentInterner, cdata: Cmd, id: ast::NodeId,
         let name = item_name(intr, item);
         let arg_tys = match ty::get(ctor_ty).sty {
           ty::ty_bare_fn(ref f) => f.sig.inputs.clone(),
-          _ => ~[], // Nullary enum variant.
+          _ => Vec::new(), // Nullary enum variant.
         };
         match variant_disr_val(item) {
           Some(val) => { disr_val = val; }
@@ -761,8 +761,8 @@ fn get_mutability(ch: u8) -> ast::Mutability {
 }
 
 fn item_impl_methods(intr: @IdentInterner, cdata: Cmd, item: ebml::Doc,
-                     tcx: ty::ctxt) -> ~[@ty::Method] {
-    let mut rslt = ~[];
+                     tcx: ty::ctxt) -> Vec<@ty::Method> {
+    let mut rslt = Vec::new();
     reader::tagged_docs(item, tag_item_impl_method, |doc| {
         let m_did = reader::with_doc_data(doc, parse_def_id);
         rslt.push(@get_method(intr, cdata, m_did.node, tcx));
@@ -838,10 +838,10 @@ pub fn get_method(intr: @IdentInterner, cdata: Cmd, id: ast::NodeId,
 }
 
 pub fn get_trait_method_def_ids(cdata: Cmd,
-                                id: ast::NodeId) -> ~[ast::DefId] {
+                                id: ast::NodeId) -> Vec<ast::DefId> {
     let data = cdata.data();
     let item = lookup_item(id, data);
-    let mut result = ~[];
+    let mut result = Vec::new();
     reader::tagged_docs(item, tag_item_trait_method, |mth| {
         result.push(item_def_id(mth, cdata));
         true
@@ -859,10 +859,10 @@ pub fn get_item_variances(cdata: Cmd, id: ast::NodeId) -> ty::ItemVariances {
 
 pub fn get_provided_trait_methods(intr: @IdentInterner, cdata: Cmd,
                                   id: ast::NodeId, tcx: ty::ctxt) ->
-        ~[@ty::Method] {
+        Vec<@ty::Method> {
     let data = cdata.data();
     let item = lookup_item(id, data);
-    let mut result = ~[];
+    let mut result = Vec::new();
 
     reader::tagged_docs(item, tag_item_trait_method, |mth_id| {
         let did = item_def_id(mth_id, cdata);
@@ -879,8 +879,8 @@ pub fn get_provided_trait_methods(intr: @IdentInterner, cdata: Cmd,
 
 /// Returns the supertraits of the given trait.
 pub fn get_supertraits(cdata: Cmd, id: ast::NodeId, tcx: ty::ctxt)
-                    -> ~[@ty::TraitRef] {
-    let mut results = ~[];
+                    -> Vec<@ty::TraitRef> {
+    let mut results = Vec::new();
     let item_doc = lookup_item(id, cdata.data());
     reader::tagged_docs(item_doc, tag_item_super_trait_ref, |trait_doc| {
         // NB. Only reads the ones that *aren't* builtin-bounds. See also
@@ -914,7 +914,7 @@ pub fn get_type_name_if_impl(cdata: Cmd,
 pub fn get_static_methods_if_impl(intr: @IdentInterner,
                                   cdata: Cmd,
                                   node_id: ast::NodeId)
-                               -> Option<~[StaticMethodInfo]> {
+                               -> Option<Vec<StaticMethodInfo> > {
     let item = lookup_item(node_id, cdata.data());
     if item_family(item) != Impl {
         return None;
@@ -927,13 +927,13 @@ pub fn get_static_methods_if_impl(intr: @IdentInterner,
 
     if !ret { return None }
 
-    let mut impl_method_ids = ~[];
+    let mut impl_method_ids = Vec::new();
     reader::tagged_docs(item, tag_item_impl_method, |impl_method_doc| {
         impl_method_ids.push(reader::with_doc_data(impl_method_doc, parse_def_id));
         true
     });
 
-    let mut static_impl_methods = ~[];
+    let mut static_impl_methods = Vec::new();
     for impl_method_id in impl_method_ids.iter() {
         let impl_method_doc = lookup_item(impl_method_id.node, cdata.data());
         let family = item_family(impl_method_doc);
@@ -975,7 +975,7 @@ pub fn get_tuple_struct_definition_if_ctor(cdata: Cmd,
 
 pub fn get_item_attrs(cdata: Cmd,
                       node_id: ast::NodeId,
-                      f: |~[@ast::MetaItem]|) {
+                      f: |Vec<@ast::MetaItem> |) {
     // The attributes for a tuple struct are attached to the definition, not the ctor;
     // we assume that someone passing in a tuple struct ctor is actually wanting to
     // look at the definition
@@ -1000,10 +1000,10 @@ fn struct_field_family_to_visibility(family: Family) -> ast::Visibility {
 }
 
 pub fn get_struct_fields(intr: @IdentInterner, cdata: Cmd, id: ast::NodeId)
-    -> ~[ty::field_ty] {
+    -> Vec<ty::field_ty> {
     let data = cdata.data();
     let item = lookup_item(id, data);
-    let mut result = ~[];
+    let mut result = Vec::new();
     reader::tagged_docs(item, tag_item_field, |an_item| {
         let f = item_family(an_item);
         if f == PublicField || f == PrivateField || f == InheritedField {
@@ -1035,8 +1035,8 @@ pub fn get_item_visibility(cdata: Cmd, id: ast::NodeId)
     item_visibility(lookup_item(id, cdata.data()))
 }
 
-fn get_meta_items(md: ebml::Doc) -> ~[@ast::MetaItem] {
-    let mut items: ~[@ast::MetaItem] = ~[];
+fn get_meta_items(md: ebml::Doc) -> Vec<@ast::MetaItem> {
+    let mut items: Vec<@ast::MetaItem> = Vec::new();
     reader::tagged_docs(md, tag_meta_item_word, |meta_item_doc| {
         let nd = reader::get_doc(meta_item_doc, tag_meta_item_name);
         let n = token::intern_and_get_ident(nd.as_str_slice());
@@ -1063,8 +1063,8 @@ fn get_meta_items(md: ebml::Doc) -> ~[@ast::MetaItem] {
     return items;
 }
 
-fn get_attributes(md: ebml::Doc) -> ~[ast::Attribute] {
-    let mut attrs: ~[ast::Attribute] = ~[];
+fn get_attributes(md: ebml::Doc) -> Vec<ast::Attribute> {
+    let mut attrs: Vec<ast::Attribute> = Vec::new();
     match reader::maybe_get_doc(md, tag_attributes) {
       option::Some(attrs_d) => {
         reader::tagged_docs(attrs_d, tag_attribute, |attr_doc| {
@@ -1102,7 +1102,7 @@ fn list_crate_attributes(md: ebml::Doc, hash: &Svh,
     write!(out, "\n\n")
 }
 
-pub fn get_crate_attributes(data: &[u8]) -> ~[ast::Attribute] {
+pub fn get_crate_attributes(data: &[u8]) -> Vec<ast::Attribute> {
     return get_attributes(reader::Doc(data));
 }
 
@@ -1113,8 +1113,8 @@ pub struct CrateDep {
     hash: Svh,
 }
 
-pub fn get_crate_deps(data: &[u8]) -> ~[CrateDep] {
-    let mut deps: ~[CrateDep] = ~[];
+pub fn get_crate_deps(data: &[u8]) -> Vec<CrateDep> {
+    let mut deps: Vec<CrateDep> = Vec::new();
     let cratedoc = reader::Doc(data);
     let depsdoc = reader::get_doc(cratedoc, tag_crate_deps);
     let mut crate_num = 1;
@@ -1255,10 +1255,10 @@ pub fn get_trait_of_method(cdata: Cmd, id: ast::NodeId, tcx: ty::ctxt)
 }
 
 
-pub fn get_native_libraries(cdata: Cmd) -> ~[(cstore::NativeLibaryKind, ~str)] {
+pub fn get_native_libraries(cdata: Cmd) -> Vec<(cstore::NativeLibaryKind, ~str)> {
     let libraries = reader::get_doc(reader::Doc(cdata.data()),
                                     tag_native_libraries);
-    let mut result = ~[];
+    let mut result = Vec::new();
     reader::tagged_docs(libraries, tag_native_libraries_lib, |lib_doc| {
         let kind_doc = reader::get_doc(lib_doc, tag_native_libraries_kind);
         let name_doc = reader::get_doc(lib_doc, tag_native_libraries_name);
@@ -1276,10 +1276,10 @@ pub fn get_macro_registrar_fn(cdata: Cmd) -> Option<ast::DefId> {
         .map(|doc| item_def_id(doc, cdata))
 }
 
-pub fn get_exported_macros(cdata: Cmd) -> ~[~str] {
+pub fn get_exported_macros(cdata: Cmd) -> Vec<~str> {
     let macros = reader::get_doc(reader::Doc(cdata.data()),
                                  tag_exported_macros);
-    let mut result = ~[];
+    let mut result = Vec::new();
     reader::tagged_docs(macros, tag_macro_def, |macro_doc| {
         result.push(macro_doc.as_str());
         true
index 7d5688ba19ba3ebc7243927332d0717ab708ec8c..c81ee348016209b5fec818a68249ac4303dca86a 100644 (file)
@@ -324,7 +324,7 @@ fn encode_enum_variant_info(ecx: &EncodeContext,
                             ebml_w: &mut writer::Encoder,
                             id: NodeId,
                             variants: &[P<Variant>],
-                            index: @RefCell<~[entry<i64>]>,
+                            index: @RefCell<Vec<entry<i64>> >,
                             generics: &ast::Generics) {
     debug!("encode_enum_variant_info(id={:?})", id);
 
@@ -687,11 +687,11 @@ fn encode_provided_source(ebml_w: &mut writer::Encoder,
 fn encode_info_for_struct(ecx: &EncodeContext,
                           ebml_w: &mut writer::Encoder,
                           fields: &[StructField],
-                          global_index: @RefCell<~[entry<i64>]>)
-                          -> ~[entry<i64>] {
+                          global_index: @RefCell<Vec<entry<i64>> >)
+                          -> Vec<entry<i64>> {
     /* Each class has its own index, since different classes
        may have fields with the same name */
-    let mut index = ~[];
+    let mut index = Vec::new();
     let tcx = ecx.tcx;
      /* We encode both private and public fields -- need to include
         private fields to get the offsets right */
@@ -726,7 +726,7 @@ fn encode_info_for_struct_ctor(ecx: &EncodeContext,
                                ebml_w: &mut writer::Encoder,
                                name: ast::Ident,
                                ctor_id: NodeId,
-                               index: @RefCell<~[entry<i64>]>,
+                               index: @RefCell<Vec<entry<i64>> >,
                                struct_id: NodeId) {
     {
         let mut index = index.borrow_mut();
@@ -888,13 +888,13 @@ fn encode_extension_implementations(ecx: &EncodeContext,
 fn encode_info_for_item(ecx: &EncodeContext,
                         ebml_w: &mut writer::Encoder,
                         item: &Item,
-                        index: @RefCell<~[entry<i64>]>,
+                        index: @RefCell<Vec<entry<i64>> >,
                         path: PathElems,
                         vis: ast::Visibility) {
     let tcx = ecx.tcx;
 
     fn add_to_index(item: &Item, ebml_w: &writer::Encoder,
-                     index: @RefCell<~[entry<i64>]>) {
+                     index: @RefCell<Vec<entry<i64>> >) {
         let mut index = index.borrow_mut();
         index.get().push(entry {
             val: item.id as i64,
@@ -1239,7 +1239,7 @@ fn add_to_index(item: &Item, ebml_w: &writer::Encoder,
 fn encode_info_for_foreign_item(ecx: &EncodeContext,
                                 ebml_w: &mut writer::Encoder,
                                 nitem: &ForeignItem,
-                                index: @RefCell<~[entry<i64>]>,
+                                index: @RefCell<Vec<entry<i64>> >,
                                 path: PathElems,
                                 abi: AbiSet) {
     {
@@ -1284,7 +1284,7 @@ fn my_visit_expr(_e: &Expr) { }
 fn my_visit_item(i: &Item,
                  ebml_w: &mut writer::Encoder,
                  ecx_ptr: *int,
-                 index: @RefCell<~[entry<i64>]>) {
+                 index: @RefCell<Vec<entry<i64>> >) {
     let mut ebml_w = unsafe { ebml_w.unsafe_clone() };
     // See above
     let ecx: &EncodeContext = unsafe { cast::transmute(ecx_ptr) };
@@ -1296,7 +1296,7 @@ fn my_visit_item(i: &Item,
 fn my_visit_foreign_item(ni: &ForeignItem,
                          ebml_w: &mut writer::Encoder,
                          ecx_ptr:*int,
-                         index: @RefCell<~[entry<i64>]>) {
+                         index: @RefCell<Vec<entry<i64>> >) {
     // See above
     let ecx: &EncodeContext = unsafe { cast::transmute(ecx_ptr) };
     debug!("writing foreign item {}::{}",
@@ -1317,7 +1317,7 @@ fn my_visit_foreign_item(ni: &ForeignItem,
 struct EncodeVisitor<'a,'b> {
     ebml_w_for_visit_item: &'a mut writer::Encoder<'b>,
     ecx_ptr:*int,
-    index: @RefCell<~[entry<i64>]>,
+    index: @RefCell<Vec<entry<i64>> >,
 }
 
 impl<'a,'b> visit::Visitor<()> for EncodeVisitor<'a,'b> {
@@ -1344,8 +1344,8 @@ fn visit_foreign_item(&mut self, ni: &ForeignItem, _: ()) {
 fn encode_info_for_items(ecx: &EncodeContext,
                          ebml_w: &mut writer::Encoder,
                          krate: &Crate)
-                         -> ~[entry<i64>] {
-    let index = @RefCell::new(~[]);
+                         -> Vec<entry<i64>> {
+    let index = @RefCell::new(Vec::new());
     ebml_w.start_tag(tag_items_data);
     {
         let mut index = index.borrow_mut();
@@ -1382,11 +1382,11 @@ fn encode_info_for_items(ecx: &EncodeContext,
 // Path and definition ID indexing
 
 fn create_index<T:Clone + Hash + 'static>(
-                index: ~[entry<T>])
-                -> ~[@~[entry<T>]] {
-    let mut buckets: ~[@RefCell<~[entry<T>]>] = ~[];
+                index: Vec<entry<T>> )
+                -> Vec<@Vec<entry<T>> > {
+    let mut buckets: Vec<@RefCell<Vec<entry<T>> >> = Vec::new();
     for _ in range(0u, 256u) {
-        buckets.push(@RefCell::new(~[]));
+        buckets.push(@RefCell::new(Vec::new()));
     }
     for elt in index.iter() {
         let h = hash::hash(&elt.val) as uint;
@@ -1394,7 +1394,7 @@ fn create_index<T:Clone + Hash + 'static>(
         bucket.get().push((*elt).clone());
     }
 
-    let mut buckets_frozen = ~[];
+    let mut buckets_frozen = Vec::new();
     for bucket in buckets.iter() {
         buckets_frozen.push(@/*bad*/(**bucket).get());
     }
@@ -1403,10 +1403,10 @@ fn create_index<T:Clone + Hash + 'static>(
 
 fn encode_index<T:'static>(
                 ebml_w: &mut writer::Encoder,
-                buckets: ~[@~[entry<T>]],
+                buckets: Vec<@Vec<entry<T>> > ,
                 write_fn: |&mut MemWriter, &T|) {
     ebml_w.start_tag(tag_index);
-    let mut bucket_locs = ~[];
+    let mut bucket_locs = Vec::new();
     ebml_w.start_tag(tag_index_buckets);
     for bucket in buckets.iter() {
         bucket_locs.push(ebml_w.writer.tell().unwrap());
@@ -1491,7 +1491,7 @@ fn encode_attributes(ebml_w: &mut writer::Encoder, attrs: &[Attribute]) {
 // metadata that Rust cares about for linking crates. If the user didn't
 // provide it we will throw it in anyway with a default value.
 fn synthesize_crate_attrs(ecx: &EncodeContext,
-                          krate: &Crate) -> ~[Attribute] {
+                          krate: &Crate) -> Vec<Attribute> {
 
     fn synthesize_crateid_attr(ecx: &EncodeContext) -> Attribute {
         assert!(!ecx.link_meta.crateid.name.is_empty());
@@ -1502,7 +1502,7 @@ fn synthesize_crateid_attr(ecx: &EncodeContext) -> Attribute {
                 token::intern_and_get_ident(ecx.link_meta.crateid.to_str())))
     }
 
-    let mut attrs = ~[];
+    let mut attrs = Vec::new();
     for attr in krate.attrs.iter() {
         if !attr.name().equiv(&("crate_id")) {
             attrs.push(*attr);
@@ -1514,9 +1514,9 @@ fn synthesize_crateid_attr(ecx: &EncodeContext) -> Attribute {
 }
 
 fn encode_crate_deps(ebml_w: &mut writer::Encoder, cstore: &cstore::CStore) {
-    fn get_ordered_deps(cstore: &cstore::CStore) -> ~[decoder::CrateDep] {
+    fn get_ordered_deps(cstore: &cstore::CStore) -> Vec<decoder::CrateDep> {
         // Pull the cnums and name,vers,hash out of cstore
-        let mut deps = ~[];
+        let mut deps = Vec::new();
         cstore.iter_crate_data(|key, val| {
             let dep = decoder::CrateDep {
                 cnum: key,
@@ -1767,7 +1767,7 @@ fn encode_crate_id(ebml_w: &mut writer::Encoder, crate_id: &CrateId) {
       0x74, //'t' as u8,
       0, 0, 0, 1 ];
 
-pub fn encode_metadata(parms: EncodeParams, krate: &Crate) -> ~[u8] {
+pub fn encode_metadata(parms: EncodeParams, krate: &Crate) -> Vec<u8> {
     let mut wr = MemWriter::new();
     encode_metadata_inner(&mut wr, parms, krate);
     wr.unwrap()
index 2ab3f8a147e9047bb9d8fefddc66136c4a2bdaa9..c22caafab3034586116553a2d742cdec990443d3 100644 (file)
@@ -205,14 +205,14 @@ pub fn get_rust_path() -> Option<~str> {
 /// $HOME/.rust
 /// DIR/.rust for any DIR that's the current working directory
 /// or an ancestor of it
-pub fn rust_path() -> ~[Path] {
-    let mut env_rust_path: ~[Path] = match get_rust_path() {
+pub fn rust_path() -> Vec<Path> {
+    let mut env_rust_path: Vec<Path> = match get_rust_path() {
         Some(env_path) => {
-            let env_path_components: ~[&str] =
+            let env_path_components: Vec<&str> =
                 env_path.split_str(PATH_ENTRY_SEPARATOR).collect();
             env_path_components.map(|&s| Path::new(s))
         }
-        None => ~[]
+        None => Vec::new()
     };
     let mut cwd = os::getcwd();
     // now add in default entries
index 617a8654eedab2b30df8c898d8bafdc02c781c1c..e9b6d241b171047651866fee6561693e8b7a294d 100644 (file)
@@ -183,7 +183,7 @@ fn find_library_crate(&mut self) -> Option<Library> {
         // A Library candidate is created if the metadata for the set of
         // libraries corresponds to the crate id and hash criteria that this
         // serach is being performed for.
-        let mut libraries = ~[];
+        let mut libraries = Vec::new();
         for (_hash, (rlibs, dylibs)) in candidates.move_iter() {
             let mut metadata = None;
             let rlib = self.extract_one(rlibs, "rlib", &mut metadata);
index f566571d0eb3c91c1f5e68fdfe00e0c0c7319c04..0f7fcdc4791ea3a85f451b255c9cd0752caa6344 100644 (file)
@@ -177,7 +177,7 @@ fn parse_substs(st: &mut PState, conv: conv_did) -> ty::substs {
     let self_ty = parse_opt(st, |st| parse_ty(st, |x,y| conv(x,y)) );
 
     assert_eq!(next(st), '[');
-    let mut params: ~[ty::t] = ~[];
+    let mut params: Vec<ty::t> = Vec::new();
     while peek(st) != ']' { params.push(parse_ty(st, |x,y| conv(x,y))); }
     st.pos = st.pos + 1u;
 
@@ -362,7 +362,7 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
       }
       'T' => {
         assert_eq!(next(st), '[');
-        let mut params = ~[];
+        let mut params = Vec::new();
         while peek(st) != ']' { params.push(parse_ty(st, |x,y| conv(x,y))); }
         st.pos = st.pos + 1u;
         return ty::mk_tup(st.tcx, params);
@@ -520,7 +520,7 @@ fn parse_sig(st: &mut PState, conv: conv_did) -> ty::FnSig {
     assert_eq!(next(st), '[');
     let id = parse_uint(st) as ast::NodeId;
     assert_eq!(next(st), '|');
-    let mut inputs = ~[];
+    let mut inputs = Vec::new();
     while peek(st) != ']' {
         inputs.push(parse_ty(st, |x,y| conv(x,y)));
     }
@@ -583,7 +583,7 @@ fn parse_type_param_def(st: &mut PState, conv: conv_did) -> ty::TypeParameterDef
 fn parse_bounds(st: &mut PState, conv: conv_did) -> ty::ParamBounds {
     let mut param_bounds = ty::ParamBounds {
         builtin_bounds: ty::EmptyBuiltinBounds(),
-        trait_bounds: ~[]
+        trait_bounds: Vec::new()
     };
     loop {
         match next(st) {
index c9b234743fae61463c8f102bd27d915b425a9bb7..1477a1fb95131775b2b891c3b267350655d49f6c 100644 (file)
@@ -286,7 +286,7 @@ fn enc_sty(w: &mut MemWriter, cx: @ctxt, st: &ty::sty) {
             enc_trait_store(w, cx, store);
             enc_mutability(w, mt);
             let bounds = ty::ParamBounds {builtin_bounds: bounds,
-                                          trait_bounds: ~[]};
+                                          trait_bounds: Vec::new()};
             enc_bounds(w, cx, &bounds);
             mywrite!(w, "]");
         }
@@ -383,7 +383,7 @@ fn enc_closure_ty(w: &mut MemWriter, cx: @ctxt, ft: &ty::ClosureTy) {
     enc_onceness(w, ft.onceness);
     enc_region(w, cx, ft.region);
     let bounds = ty::ParamBounds {builtin_bounds: ft.bounds,
-                                  trait_bounds: ~[]};
+                                  trait_bounds: Vec::new()};
     enc_bounds(w, cx, &bounds);
     enc_fn_sig(w, cx, &ft.sig);
 }
index 3fb127f470e972785ba5499395fc53b5cb74c6e5..b3d26b2bb7947b5d40abb27c618be57cc7d57539 100644 (file)
@@ -116,9 +116,9 @@ pub fn encode_exported_macro(ebml_w: &mut writer::Encoder, i: &ast::Item) {
 pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
                            tcx: ty::ctxt,
                            maps: Maps,
-                           path: ~[ast_map::PathElem],
+                           path: Vec<ast_map::PathElem> ,
                            par_doc: ebml::Doc)
-                           -> Result<ast::InlinedItem, ~[ast_map::PathElem]> {
+                           -> Result<ast::InlinedItem, Vec<ast_map::PathElem> > {
     let dcx = @DecodeContext {
         cdata: cdata,
         tcx: tcx,
@@ -395,7 +395,7 @@ fn new_span(&self, span: Span) -> Span {
 
 fn renumber_and_map_ast(xcx: @ExtendedDecodeContext,
                         map: &ast_map::Map,
-                        path: ~[ast_map::PathElem],
+                        path: Vec<ast_map::PathElem> ,
                         ii: ast::InlinedItem) -> ast::InlinedItem {
     ast_map::map_decoded_item(map,
                               path.move_iter().collect(),
@@ -1100,7 +1100,7 @@ fn opt_child(&self, tag: c::astencode_tag) -> Option<ebml::Doc<'a>> {
 
 trait ebml_decoder_decoder_helpers {
     fn read_ty(&mut self, xcx: @ExtendedDecodeContext) -> ty::t;
-    fn read_tys(&mut self, xcx: @ExtendedDecodeContext) -> ~[ty::t];
+    fn read_tys(&mut self, xcx: @ExtendedDecodeContext) -> Vec<ty::t> ;
     fn read_type_param_def(&mut self, xcx: @ExtendedDecodeContext)
                            -> ty::TypeParameterDef;
     fn read_ty_param_bounds_and_ty(&mut self, xcx: @ExtendedDecodeContext)
@@ -1119,7 +1119,7 @@ fn read_ty_noxcx(&mut self,
                      tcx: ty::ctxt, cdata: @cstore::crate_metadata) -> ty::t;
     fn read_tys_noxcx(&mut self,
                       tcx: ty::ctxt,
-                      cdata: @cstore::crate_metadata) -> ~[ty::t];
+                      cdata: @cstore::crate_metadata) -> Vec<ty::t> ;
 }
 
 impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> {
@@ -1137,7 +1137,7 @@ fn read_ty_noxcx(&mut self,
 
     fn read_tys_noxcx(&mut self,
                       tcx: ty::ctxt,
-                      cdata: @cstore::crate_metadata) -> ~[ty::t] {
+                      cdata: @cstore::crate_metadata) -> Vec<ty::t> {
         self.read_to_vec(|this| this.read_ty_noxcx(tcx, cdata) )
     }
 
@@ -1169,7 +1169,7 @@ fn type_string(doc: ebml::Doc) -> ~str {
         }
     }
 
-    fn read_tys(&mut self, xcx: @ExtendedDecodeContext) -> ~[ty::t] {
+    fn read_tys(&mut self, xcx: @ExtendedDecodeContext) -> Vec<ty::t> {
         self.read_to_vec(|this| this.read_ty(xcx) )
     }
 
@@ -1510,14 +1510,14 @@ fn test_simplification() {
     let item = quote_item!(cx,
         fn new_int_alist<B>() -> alist<int, B> {
             fn eq_int(a: int, b: int) -> bool { a == b }
-            return alist {eq_fn: eq_int, data: ~[]};
+            return alist {eq_fn: eq_int, data: Vec::new()};
         }
     ).unwrap();
     let item_in = e::IIItemRef(item);
     let item_out = simplify_ast(item_in);
     let item_exp = ast::IIItem(quote_item!(cx,
         fn new_int_alist<B>() -> alist<int, B> {
-            return alist {eq_fn: eq_int, data: ~[]};
+            return alist {eq_fn: eq_int, data: Vec::new()};
         }
     ).unwrap());
     match (item_out, item_exp) {
index 3a500a82664dd83df6630e2a786c9b4ed39fa72b..a44d4f55cd086a36ee09a375473d21aa9008827c 100644 (file)
@@ -143,11 +143,11 @@ pub fn each_in_scope_restriction(&self,
         })
     }
 
-    pub fn loans_generated_by(&self, scope_id: ast::NodeId) -> ~[uint] {
+    pub fn loans_generated_by(&self, scope_id: ast::NodeId) -> Vec<uint> {
         //! Returns a vector of the loans that are generated as
         //! we encounter `scope_id`.
 
-        let mut result = ~[];
+        let mut result = Vec::new();
         self.dfcx_loans.each_gen_bit_frozen(scope_id, |loan_index| {
             result.push(loan_index);
             true
index 202ea4978688a88e2e26d5c9254ad073e3f8e931..0583268b9e5e0fe7aa44623649cedd12a1d76bae 100644 (file)
@@ -70,10 +70,9 @@ struct GatherLoanCtxt<'a> {
     bccx: &'a BorrowckCtxt,
     id_range: IdRange,
     move_data: move_data::MoveData,
-    all_loans: @RefCell<~[Loan]>,
+    all_loans: @RefCell<Vec<Loan> >,
     item_ub: ast::NodeId,
-    repeating_ids: ~[ast::NodeId]
-}
+    repeating_ids: Vec<ast::NodeId> }
 
 impl<'a> visit::Visitor<()> for GatherLoanCtxt<'a> {
     fn visit_expr(&mut self, ex: &Expr, _: ()) {
@@ -103,13 +102,13 @@ fn visit_item(&mut self, _: &ast::Item, _: ()) { }
 }
 
 pub fn gather_loans(bccx: &BorrowckCtxt, decl: &ast::FnDecl, body: &ast::Block)
-                    -> (IdRange, @RefCell<~[Loan]>, move_data::MoveData) {
+                    -> (IdRange, @RefCell<Vec<Loan> >, move_data::MoveData) {
     let mut glcx = GatherLoanCtxt {
         bccx: bccx,
         id_range: IdRange::max(),
-        all_loans: @RefCell::new(~[]),
+        all_loans: @RefCell::new(Vec::new()),
         item_ub: body.id,
-        repeating_ids: ~[body.id],
+        repeating_ids: vec!(body.id),
         move_data: MoveData::new()
     };
     glcx.gather_fn_arg_patterns(decl, body);
index 575119ba6904b34933032277c803acfcbc564ada..a21de25a76afd3d51db8443c1c4817eab87d66e2 100644 (file)
@@ -21,7 +21,7 @@
 
 pub enum RestrictionResult {
     Safe,
-    SafeIf(@LoanPath, ~[Restriction])
+    SafeIf(@LoanPath, Vec<Restriction> )
 }
 
 pub fn compute_restrictions(bccx: &BorrowckCtxt,
@@ -75,8 +75,8 @@ fn restrict(&self,
             mc::cat_upvar(ty::UpvarId {var_id: local_id, ..}, _) => {
                 // R-Variable
                 let lp = @LpVar(local_id);
-                SafeIf(lp, ~[Restriction {loan_path: lp,
-                                          set: restrictions}])
+                SafeIf(lp, vec!(Restriction {loan_path: lp,
+                                          set: restrictions}))
             }
 
             mc::cat_downcast(cmt_base) => {
index 9e70b89d5483c44f8adc8b76f558c5c26b039657..77c3af898945fc5eb91fe4e482719af8f11512f5 100644 (file)
@@ -209,7 +209,7 @@ pub struct Loan {
     loan_path: @LoanPath,
     cmt: mc::cmt,
     kind: ty::BorrowKind,
-    restrictions: ~[Restriction],
+    restrictions: Vec<Restriction> ,
     gen_scope: ast::NodeId,
     kill_scope: ast::NodeId,
     span: Span,
index 35368645eb3281604fd506ca4ba1a35c0192c396..2cc312cccdc6fc754fde80135351839c640a9e21 100644 (file)
 
 pub struct MoveData {
     /// Move paths. See section "Move paths" in `doc.rs`.
-    paths: RefCell<~[MovePath]>,
+    paths: RefCell<Vec<MovePath> >,
 
     /// Cache of loan path to move path index, for easy lookup.
     path_map: RefCell<HashMap<@LoanPath, MovePathIndex>>,
 
     /// Each move or uninitialized variable gets an entry here.
-    moves: RefCell<~[Move]>,
+    moves: RefCell<Vec<Move> >,
 
     /// Assignments to a variable, like `x = foo`. These are assigned
     /// bits for dataflow, since we must track them to ensure that
     /// immutable variables are assigned at most once along each path.
-    var_assignments: RefCell<~[Assignment]>,
+    var_assignments: RefCell<Vec<Assignment> >,
 
     /// Assignments to a path, like `x.f = foo`. These are not
     /// assigned dataflow bits, but we track them because they still
     /// kill move bits.
-    path_assignments: RefCell<~[Assignment]>,
+    path_assignments: RefCell<Vec<Assignment> >,
     assignee_ids: RefCell<HashSet<ast::NodeId>>,
 }
 
@@ -173,11 +173,11 @@ fn clone(&self) -> AssignDataFlowOperator {
 impl MoveData {
     pub fn new() -> MoveData {
         MoveData {
-            paths: RefCell::new(~[]),
+            paths: RefCell::new(Vec::new()),
             path_map: RefCell::new(HashMap::new()),
-            moves: RefCell::new(~[]),
-            path_assignments: RefCell::new(~[]),
-            var_assignments: RefCell::new(~[]),
+            moves: RefCell::new(Vec::new()),
+            path_assignments: RefCell::new(Vec::new()),
+            var_assignments: RefCell::new(Vec::new()),
             assignee_ids: RefCell::new(HashSet::new()),
         }
     }
index 099ef284d95b1ab77f014f733b23102314fd327a..5e22f35a47fab85e9a254d897c4528cf771cdbd9 100644 (file)
@@ -22,7 +22,7 @@ struct CFGBuilder {
     method_map: typeck::MethodMap,
     exit_map: NodeMap<CFGIndex>,
     graph: CFGGraph,
-    loop_scopes: ~[LoopScope],
+    loop_scopes: Vec<LoopScope> ,
 }
 
 struct LoopScope {
@@ -39,7 +39,7 @@ pub fn construct(tcx: ty::ctxt,
         graph: graph::Graph::new(),
         tcx: tcx,
         method_map: method_map,
-        loop_scopes: ~[]
+        loop_scopes: Vec::new()
     };
     let entry = cfg_builder.add_node(0, []);
     let exit = cfg_builder.block(blk, entry);
@@ -375,7 +375,7 @@ fn expr(&mut self, expr: @ast::Expr, pred: CFGIndex) -> CFGIndex {
 
             ast::ExprStruct(_, ref fields, base) => {
                 let base_exit = self.opt_expr(base, pred);
-                let field_exprs: ~[@ast::Expr] =
+                let field_exprs: Vec<@ast::Expr> =
                     fields.iter().map(|f| f.expr).collect();
                 self.straightline(expr, base_exit, field_exprs)
             }
index 3b8e7086762353c8d8d8c99b8ee31482fdc397e0..218a4b0a71b78935a567ee512328a652c4d68afe 100644 (file)
@@ -207,8 +207,7 @@ struct CheckItemRecursionVisitor<'a> {
     sess: Session,
     ast_map: &'a ast_map::Map,
     def_map: resolve::DefMap,
-    idstack: ~[NodeId]
-}
+    idstack: Vec<NodeId> }
 
 // Make sure a const item doesn't recursively refer to itself
 // FIXME: Should use the dependency graph when it's available (#1356)
@@ -222,7 +221,7 @@ pub fn check_item_recursion<'a>(sess: Session,
         sess: sess,
         ast_map: ast_map,
         def_map: def_map,
-        idstack: ~[]
+        idstack: Vec::new()
     };
     visitor.visit_item(it, ());
 }
index 0ca5ad8b44c5ab0d5979db40b6e65765075ad41c..5bc4cd878e1d3c45d4e999cc2df5caf6be70c595 100644 (file)
@@ -105,7 +105,7 @@ fn check_expr(v: &mut CheckMatchVisitor,
           _ => { /* We assume only enum types can be uninhabited */ }
        }
 
-       let pats: ~[@Pat] = arms.iter()
+       let pats: Vec<@Pat> = arms.iter()
                                .filter_map(unguarded_pat)
                                .flat_map(|pats| pats.move_iter())
                                .collect();
@@ -121,7 +121,7 @@ fn check_expr(v: &mut CheckMatchVisitor,
 
 // Check for unreachable patterns
 fn check_arms(cx: &MatchCheckCtxt, arms: &[Arm]) {
-    let mut seen = ~[];
+    let mut seen = Vec::new();
     for arm in arms.iter() {
         for pat in arm.pats.iter() {
 
@@ -151,7 +151,7 @@ fn check_arms(cx: &MatchCheckCtxt, arms: &[Arm]) {
                 true
             });
 
-            let v = ~[*pat];
+            let v = vec!(*pat);
             match is_useful(cx, &seen, v) {
               not_useful => {
                 cx.tcx.sess.span_err(pat.span, "unreachable pattern");
@@ -170,9 +170,9 @@ fn raw_pat(p: @Pat) -> @Pat {
     }
 }
 
-fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: ~[@Pat]) {
+fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: Vec<@Pat> ) {
     assert!((!pats.is_empty()));
-    let ext = match is_useful(cx, &pats.map(|p| ~[*p]), [wild()]) {
+    let ext = match is_useful(cx, &pats.map(|p| vec!(*p)), [wild()]) {
         not_useful => {
             // This is good, wildcard pattern isn't reachable
             return;
@@ -218,7 +218,7 @@ fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: ~[@Pat]) {
     cx.tcx.sess.span_err(sp, msg);
 }
 
-type matrix = ~[~[@Pat]];
+type matrix = Vec<Vec<@Pat> > ;
 
 #[deriving(Clone)]
 enum useful {
@@ -413,7 +413,7 @@ fn missing_ctor(cx: &MatchCheckCtxt,
         return Some(single);
       }
       ty::ty_enum(eid, _) => {
-        let mut found = ~[];
+        let mut found = Vec::new();
         for r in m.iter() {
             let r = pat_ctor_id(cx, r[0]);
             for id in r.iter() {
@@ -481,7 +481,7 @@ fn missing_ctor(cx: &MatchCheckCtxt,
                 }
                 _ => None
             }
-        }).collect::<~[(uint, bool)]>();
+        }).collect::<Vec<(uint, bool)> >();
 
         // Sort them by length such that for patterns of the same length,
         // those with a destructured slice come first.
@@ -559,17 +559,17 @@ fn specialize(cx: &MatchCheckCtxt,
                   ctor_id: &ctor,
                   arity: uint,
                   left_ty: ty::t)
-               -> Option<~[@Pat]> {
+               -> Option<Vec<@Pat> > {
     // Sad, but I can't get rid of this easily
     let r0 = (*raw_pat(r[0])).clone();
     match r0 {
         Pat{id: pat_id, node: n, span: pat_span} =>
             match n {
             PatWild => {
-                Some(vec::append(vec::from_elem(arity, wild()), r.tail()))
+                Some(vec_ng::append(vec::from_elem(arity, wild()), r.tail()))
             }
             PatWildMulti => {
-                Some(vec::append(vec::from_elem(arity, wild_multi()), r.tail()))
+                Some(vec_ng::append(vec::from_elem(arity, wild_multi()), r.tail()))
             }
             PatIdent(_, _, _) => {
                 let opt_def = {
@@ -624,7 +624,7 @@ fn specialize(cx: &MatchCheckCtxt,
                     }
                     _ => {
                         Some(
-                            vec::append(
+                            vec_ng::append(
                                 vec::from_elem(arity, wild()),
                                 r.tail()
                             )
@@ -678,7 +678,7 @@ fn specialize(cx: &MatchCheckCtxt,
                             Some(args) => args.iter().map(|x| *x).collect(),
                             None => vec::from_elem(arity, wild())
                         };
-                        Some(vec::append(args, r.tail()))
+                        Some(vec_ng::append(args, r.tail()))
                     }
                     DefVariant(_, _, _) => None,
 
@@ -691,7 +691,7 @@ fn specialize(cx: &MatchCheckCtxt,
                             }
                             None => new_args = vec::from_elem(arity, wild())
                         }
-                        Some(vec::append(new_args, r.tail()))
+                        Some(vec_ng::append(new_args, r.tail()))
                     }
                     _ => None
                 }
@@ -712,7 +712,7 @@ fn specialize(cx: &MatchCheckCtxt,
                                     _ => wild()
                                 }
                             });
-                            Some(vec::append(args, r.tail()))
+                            Some(vec_ng::append(args, r.tail()))
                         } else {
                             None
                         }
@@ -743,15 +743,15 @@ fn specialize(cx: &MatchCheckCtxt,
                                 _ => wild()
                             }
                         }).collect();
-                        Some(vec::append(args, r.tail()))
+                        Some(vec_ng::append(args, r.tail()))
                     }
                 }
             }
             PatTup(args) => {
-                Some(vec::append(args.iter().map(|x| *x).collect(), r.tail()))
+                Some(vec_ng::append(args.iter().map(|x| *x).collect(), r.tail()))
             }
             PatUniq(a) | PatRegion(a) => {
-                Some(vec::append(~[a], r.tail()))
+                Some(vec_ng::append(vec!(a), r.tail()))
             }
             PatLit(expr) => {
                 let e_v = eval_const_expr(cx.tcx, expr);
@@ -812,7 +812,7 @@ fn specialize(cx: &MatchCheckCtxt,
                     vec(_) => {
                         let num_elements = before.len() + after.len();
                         if num_elements < arity && slice.is_some() {
-                            let mut result = ~[];
+                            let mut result = Vec::new();
                             for pat in before.iter() {
                                 result.push((*pat).clone());
                             }
@@ -827,7 +827,7 @@ fn specialize(cx: &MatchCheckCtxt,
                             }
                             Some(result)
                         } else if num_elements == arity {
-                            let mut result = ~[];
+                            let mut result = Vec::new();
                             for pat in before.iter() {
                                 result.push((*pat).clone());
                             }
@@ -849,7 +849,7 @@ fn specialize(cx: &MatchCheckCtxt,
     }
 }
 
-fn default(cx: &MatchCheckCtxt, r: &[@Pat]) -> Option<~[@Pat]> {
+fn default(cx: &MatchCheckCtxt, r: &[@Pat]) -> Option<Vec<@Pat> > {
     if is_wild(cx, r[0]) { Some(r.tail().to_owned()) }
     else { None }
 }
index 877c8a6d592cd26f535c62fd28c243e1b886b97d..9898be5532b51e9740b789f66cc2f3f87219d26f 100644 (file)
@@ -321,7 +321,7 @@ pub enum const_val {
     const_int(i64),
     const_uint(u64),
     const_str(InternedString),
-    const_binary(Rc<~[u8]>),
+    const_binary(Rc<Vec<u8> >),
     const_bool(bool)
 }
 
index 700a3d5a4a4c0360918a6a28ef3c2ef6ed440fa9..e0a9d0080f6a2e24ed666b1b6fc6eac6e500c76f 100644 (file)
@@ -54,15 +54,14 @@ pub struct DataFlowContext<O> {
     // the full vector (see the method `compute_id_range()`).
 
     /// bits generated as we exit the scope `id`. Updated by `add_gen()`.
-    priv gens: ~[uint],
+    priv gens: Vec<uint> ,
 
     /// bits killed as we exit the scope `id`. Updated by `add_kill()`.
-    priv kills: ~[uint],
+    priv kills: Vec<uint> ,
 
     /// bits that are valid on entry to the scope `id`. Updated by
     /// `propagate()`.
-    priv on_entry: ~[uint]
-}
+    priv on_entry: Vec<uint> }
 
 /// Parameterization for the precise form of data flow that is used.
 pub trait DataFlowOperator {
@@ -80,8 +79,7 @@ struct PropagationContext<'a, O> {
 
 struct LoopScope<'a> {
     loop_id: ast::NodeId,
-    break_bits: ~[uint]
-}
+    break_bits: Vec<uint> }
 
 impl<O:DataFlowOperator> pprust::PpAnn for DataFlowContext<O> {
     fn pre(&self, node: pprust::AnnNode) -> io::IoResult<()> {
@@ -131,9 +129,9 @@ pub fn new(tcx: ty::ctxt,
         debug!("DataFlowContext::new(id_range={:?}, bits_per_id={:?}, words_per_id={:?})",
                id_range, bits_per_id, words_per_id);
 
-        let gens = ~[];
-        let kills = ~[];
-        let on_entry = ~[];
+        let gens = Vec::new();
+        let kills = Vec::new();
+        let on_entry = Vec::new();
 
         DataFlowContext {
             tcx: tcx,
@@ -332,7 +330,7 @@ pub fn propagate(&mut self, blk: &ast::Block) {
             };
 
             let mut temp = vec::from_elem(self.words_per_id, 0u);
-            let mut loop_scopes = ~[];
+            let mut loop_scopes = Vec::new();
 
             while propcx.changed {
                 propcx.changed = false;
@@ -367,7 +365,7 @@ fn tcx(&self) -> ty::ctxt {
     fn walk_block(&mut self,
                   blk: &ast::Block,
                   in_out: &mut [uint],
-                  loop_scopes: &mut ~[LoopScope]) {
+                  loop_scopes: &mut Vec<LoopScope> ) {
         debug!("DataFlowContext::walk_block(blk.id={}, in_out={})",
                blk.id, bits_to_str(in_out));
 
@@ -385,7 +383,7 @@ fn walk_block(&mut self,
     fn walk_stmt(&mut self,
                  stmt: @ast::Stmt,
                  in_out: &mut [uint],
-                 loop_scopes: &mut ~[LoopScope]) {
+                 loop_scopes: &mut Vec<LoopScope> ) {
         match stmt.node {
             ast::StmtDecl(decl, _) => {
                 self.walk_decl(decl, in_out, loop_scopes);
@@ -404,7 +402,7 @@ fn walk_stmt(&mut self,
     fn walk_decl(&mut self,
                  decl: @ast::Decl,
                  in_out: &mut [uint],
-                 loop_scopes: &mut ~[LoopScope]) {
+                 loop_scopes: &mut Vec<LoopScope> ) {
         match decl.node {
             ast::DeclLocal(local) => {
                 self.walk_opt_expr(local.init, in_out, loop_scopes);
@@ -418,7 +416,7 @@ fn walk_decl(&mut self,
     fn walk_expr(&mut self,
                  expr: &ast::Expr,
                  in_out: &mut [uint],
-                 loop_scopes: &mut ~[LoopScope]) {
+                 loop_scopes: &mut Vec<LoopScope> ) {
         debug!("DataFlowContext::walk_expr(expr={}, in_out={})",
                expr.repr(self.dfcx.tcx), bits_to_str(in_out));
 
@@ -701,7 +699,7 @@ fn break_from_to(&mut self,
     fn walk_exprs(&mut self,
                   exprs: &[@ast::Expr],
                   in_out: &mut [uint],
-                  loop_scopes: &mut ~[LoopScope]) {
+                  loop_scopes: &mut Vec<LoopScope> ) {
         for &expr in exprs.iter() {
             self.walk_expr(expr, in_out, loop_scopes);
         }
@@ -710,7 +708,7 @@ fn walk_exprs(&mut self,
     fn walk_opt_expr(&mut self,
                      opt_expr: Option<@ast::Expr>,
                      in_out: &mut [uint],
-                     loop_scopes: &mut ~[LoopScope]) {
+                     loop_scopes: &mut Vec<LoopScope> ) {
         for &expr in opt_expr.iter() {
             self.walk_expr(expr, in_out, loop_scopes);
         }
@@ -720,7 +718,7 @@ fn walk_call(&mut self,
                  call_id: ast::NodeId,
                  args: &[@ast::Expr],
                  in_out: &mut [uint],
-                 loop_scopes: &mut ~[LoopScope]) {
+                 loop_scopes: &mut Vec<LoopScope> ) {
         self.walk_exprs(args, in_out, loop_scopes);
 
         // FIXME(#6268) nested method calls
@@ -737,7 +735,7 @@ fn walk_call(&mut self,
     fn walk_pat(&mut self,
                 pat: @ast::Pat,
                 in_out: &mut [uint],
-                _loop_scopes: &mut ~[LoopScope]) {
+                _loop_scopes: &mut Vec<LoopScope> ) {
         debug!("DataFlowContext::walk_pat(pat={}, in_out={})",
                pat.repr(self.dfcx.tcx), bits_to_str(in_out));
 
@@ -752,7 +750,7 @@ fn walk_pat(&mut self,
     fn walk_pat_alternatives(&mut self,
                              pats: &[@ast::Pat],
                              in_out: &mut [uint],
-                             loop_scopes: &mut ~[LoopScope]) {
+                             loop_scopes: &mut Vec<LoopScope> ) {
         if pats.len() == 1 {
             // Common special case:
             return self.walk_pat(pats[0], in_out, loop_scopes);
@@ -772,7 +770,7 @@ fn walk_pat_alternatives(&mut self,
     fn find_scope<'a>(&self,
                       expr: &ast::Expr,
                       label: Option<ast::Ident>,
-                      loop_scopes: &'a mut ~[LoopScope]) -> &'a mut LoopScope {
+                      loop_scopes: &'a mut Vec<LoopScope> ) -> &'a mut LoopScope {
         let index = match label {
             None => {
                 let len = loop_scopes.len();
index eaf665119d3e28df4c331c3b8102edad0bb1875e..4b4820be3a79aa8de533c318ef327f37401bc399 100644 (file)
@@ -49,7 +49,7 @@ fn should_explore(tcx: ty::ctxt, def_id: ast::DefId) -> bool {
 }
 
 struct MarkSymbolVisitor {
-    worklist: ~[ast::NodeId],
+    worklist: Vec<ast::NodeId> ,
     method_map: typeck::MethodMap,
     tcx: ty::ctxt,
     live_symbols: ~HashSet<ast::NodeId>,
@@ -58,7 +58,7 @@ struct MarkSymbolVisitor {
 impl MarkSymbolVisitor {
     fn new(tcx: ty::ctxt,
            method_map: typeck::MethodMap,
-           worklist: ~[ast::NodeId]) -> MarkSymbolVisitor {
+           worklist: Vec<ast::NodeId> ) -> MarkSymbolVisitor {
         MarkSymbolVisitor {
             worklist: worklist,
             method_map: method_map,
@@ -216,7 +216,7 @@ fn has_allow_dead_code_or_lang_attr(attrs: &[ast::Attribute]) -> bool {
 //   2) We are not sure to be live or not
 //     * Implementation of a trait method
 struct LifeSeeder {
-    worklist: ~[ast::NodeId],
+    worklist: Vec<ast::NodeId> ,
 }
 
 impl Visitor<()> for LifeSeeder {
@@ -254,8 +254,8 @@ fn visit_fn(&mut self, fk: &visit::FnKind,
 fn create_and_seed_worklist(tcx: ty::ctxt,
                             exported_items: &privacy::ExportedItems,
                             reachable_symbols: &NodeSet,
-                            krate: &ast::Crate) -> ~[ast::NodeId] {
-    let mut worklist = ~[];
+                            krate: &ast::Crate) -> Vec<ast::NodeId> {
+    let mut worklist = Vec::new();
 
     // Preferably, we would only need to seed the worklist with reachable
     // symbols. However, since the set of reachable symbols differs
index 2623ddb15297e0672514acc372150dd1ffacbfec..a2716893430f6baf268398c7961a636cd061e549 100644 (file)
@@ -38,7 +38,7 @@ struct EntryContext<'a> {
 
     // The functions that one might think are 'main' but aren't, e.g.
     // main functions not defined at the top level. For diagnostics.
-    non_main_fns: ~[(NodeId, Span)],
+    non_main_fns: Vec<(NodeId, Span)> ,
 }
 
 impl<'a> Visitor<()> for EntryContext<'a> {
@@ -66,7 +66,7 @@ pub fn find_entry_point(session: Session, krate: &Crate, ast_map: &ast_map::Map)
         main_fn: None,
         attr_main_fn: None,
         start_fn: None,
-        non_main_fns: ~[],
+        non_main_fns: Vec::new(),
     };
 
     visit::walk_crate(&mut ctxt, krate, ());
index b41398b440156785f2a75e13b5815227fdaa9aa0..acafe550a704b8ef15a5ead7fa18109f5aed87f5 100644 (file)
@@ -29,12 +29,12 @@ pub struct freevar_entry {
     def: ast::Def, //< The variable being accessed free.
     span: Span     //< First span where it is accessed (there can be multiple)
 }
-pub type freevar_info = @~[@freevar_entry];
+pub type freevar_info = @Vec<@freevar_entry> ;
 pub type freevar_map = NodeMap<freevar_info>;
 
 struct CollectFreevarsVisitor {
     seen: NodeSet,
-    refs: ~[@freevar_entry],
+    refs: Vec<@freevar_entry> ,
     def_map: resolve::DefMap,
 }
 
@@ -90,7 +90,7 @@ fn visit_expr(&mut self, expr: &ast::Expr, depth: int) {
 // in order to start the search.
 fn collect_freevars(def_map: resolve::DefMap, blk: &ast::Block) -> freevar_info {
     let seen = NodeSet::new();
-    let refs = ~[];
+    let refs = Vec::new();
 
     let mut v = CollectFreevarsVisitor {
         seen: seen,
index b59922a61cb192338afd1392b1e569c9f31378e8..f2973a7b09c732fc9a6ce9ada4b439b3ba9efb1b 100644 (file)
@@ -38,8 +38,8 @@
 use std::vec;
 
 pub struct Graph<N,E> {
-    priv nodes: ~[Node<N>],
-    priv edges: ~[Edge<E>],
+    priv nodes: Vec<Node<N>> ,
+    priv edges: Vec<Edge<E>> ,
 }
 
 pub struct Node<N> {
@@ -77,7 +77,7 @@ impl EdgeIndex {
 
 impl<N,E> Graph<N,E> {
     pub fn new() -> Graph<N,E> {
-        Graph {nodes: ~[], edges: ~[]}
+        Graph {nodes: Vec::new(), edges: Vec::new()}
     }
 
     pub fn with_capacity(num_nodes: uint,
index 5b7ac704e2a228cec546a39a7eb242197de7426c..392a95ee563ef85a94dc6e2e44cbc4922415a2b1 100644 (file)
@@ -94,7 +94,7 @@ fn check_struct_safe_for_destructor(cx: &mut Context,
         let struct_ty = ty::mk_struct(cx.tcx, struct_did, ty::substs {
             regions: ty::NonerasedRegions(opt_vec::Empty),
             self_ty: None,
-            tps: ~[]
+            tps: Vec::new()
         });
         if !ty::type_is_sendable(cx.tcx, struct_ty) {
             cx.tcx.sess.span_err(span,
@@ -533,7 +533,7 @@ pub fn check_cast_for_escaping_regions(
     // Collect up the regions that appear in the target type.  We want to
     // ensure that these lifetimes are shorter than all lifetimes that are in
     // the source type.  See test `src/test/compile-fail/regions-trait-2.rs`
-    let mut target_regions = ~[];
+    let mut target_regions = Vec::new();
     ty::walk_regions_and_ty(
         cx.tcx,
         target_ty,
index ba5d9663c3bfdf333f1164bd948c44b743c7a9f6..2dde7003798b5a5217010aa26d4b8e2f1a35b030 100644 (file)
@@ -47,7 +47,7 @@ pub enum LangItem {
 }
 
 pub struct LanguageItems {
-    items: ~[Option<ast::DefId>],
+    items: Vec<Option<ast::DefId>> ,
 }
 
 impl LanguageItems {
@@ -55,7 +55,7 @@ pub fn new() -> LanguageItems {
         fn foo(_: LangItem) -> Option<ast::DefId> { None }
 
         LanguageItems {
-            items: ~[$(foo($variant)),*]
+            items: vec!($(foo($variant)),*)
         }
     }
 
index f8cf376582aab516fcb1adfb570fceb6897f9763..6b7f25ea21e75de9c010a7a1025f9ae17e66116d 100644 (file)
@@ -432,7 +432,7 @@ struct Context<'a> {
     // When recursing into an attributed node of the ast which modifies lint
     // levels, this stack keeps track of the previous lint levels of whatever
     // was modified.
-    lint_stack: ~[(Lint, level, LintSource)],
+    lint_stack: Vec<(Lint, level, LintSource)> ,
 
     // id of the last visited negated expression
     negated_expr_id: ast::NodeId
@@ -1738,7 +1738,7 @@ pub fn check_crate(tcx: ty::ctxt,
         exported_items: exported_items,
         cur_struct_def_id: -1,
         is_doc_hidden: false,
-        lint_stack: ~[],
+        lint_stack: Vec::new(),
         negated_expr_id: -1
     };
 
index 3ae85bbd6c7ace7a18395b439a248e97e4d27821..df16a7fe2c7d3d6f3b3da3e9daa157d36c64e44d 100644 (file)
@@ -261,8 +261,8 @@ pub struct IrMaps {
     live_node_map: RefCell<NodeMap<LiveNode>>,
     variable_map: RefCell<NodeMap<Variable>>,
     capture_info_map: RefCell<NodeMap<@~[CaptureInfo]>>,
-    var_kinds: RefCell<~[VarKind]>,
-    lnks: RefCell<~[LiveNodeKind]>,
+    var_kinds: RefCell<Vec<VarKind> >,
+    lnks: RefCell<Vec<LiveNodeKind> >,
 }
 
 fn IrMaps(tcx: ty::ctxt,
@@ -278,8 +278,8 @@ fn IrMaps(tcx: ty::ctxt,
         live_node_map: RefCell::new(NodeMap::new()),
         variable_map: RefCell::new(NodeMap::new()),
         capture_info_map: RefCell::new(NodeMap::new()),
-        var_kinds: RefCell::new(~[]),
-        lnks: RefCell::new(~[]),
+        var_kinds: RefCell::new(Vec::new()),
+        lnks: RefCell::new(Vec::new()),
     }
 }
 
@@ -347,12 +347,12 @@ pub fn variable_name(&self, var: Variable) -> ~str {
         }
     }
 
-    pub fn set_captures(&self, node_id: NodeId, cs: ~[CaptureInfo]) {
+    pub fn set_captures(&self, node_id: NodeId, cs: Vec<CaptureInfo> ) {
         let mut capture_info_map = self.capture_info_map.borrow_mut();
         capture_info_map.get().insert(node_id, @cs);
     }
 
-    pub fn captures(&self, expr: &Expr) -> @~[CaptureInfo] {
+    pub fn captures(&self, expr: &Expr) -> @Vec<CaptureInfo> {
         let capture_info_map = self.capture_info_map.borrow();
         match capture_info_map.get().find(&expr.id) {
           Some(&caps) => caps,
@@ -504,7 +504,7 @@ fn visit_expr(v: &mut LivenessVisitor, expr: &Expr, this: @IrMaps) {
         // construction site.
         let capture_map = this.capture_map.borrow();
         let cvs = capture_map.get().get(&expr.id);
-        let mut call_caps = ~[];
+        let mut call_caps = Vec::new();
         for cv in cvs.borrow().iter() {
             match moves::moved_variable_node_id_from_def(cv.def) {
               Some(rv) => {
@@ -590,11 +590,11 @@ pub struct Liveness {
     tcx: ty::ctxt,
     ir: @IrMaps,
     s: Specials,
-    successors: @RefCell<~[LiveNode]>,
-    users: @RefCell<~[Users]>,
+    successors: @RefCell<Vec<LiveNode> >,
+    users: @RefCell<Vec<Users> >,
     // The list of node IDs for the nested loop scopes
     // we're in.
-    loop_scope: @RefCell<~[NodeId]>,
+    loop_scope: @RefCell<Vec<NodeId> >,
     // mappings from loop node ID to LiveNode
     // ("break" label should map to loop node ID,
     // it probably doesn't now)
@@ -612,7 +612,7 @@ fn Liveness(ir: @IrMaps, specials: Specials) -> Liveness {
         users: @RefCell::new(vec::from_elem(ir.num_live_nodes.get() *
                                             ir.num_vars.get(),
                                             invalid_users())),
-        loop_scope: @RefCell::new(~[]),
+        loop_scope: @RefCell::new(Vec::new()),
         break_ln: @RefCell::new(NodeMap::new()),
         cont_ln: @RefCell::new(NodeMap::new()),
     }
index 45d1f112e958522105a6d8bd41f5842ff739a508..609a8d712c8a2f089f5f0c0684dd4892a7381a1d 100644 (file)
@@ -723,7 +723,7 @@ pub fn cat_deref_fn_or_obj<N:ast_node>(&mut self,
         // know what type lies at the other end, so we just call it
         // `()` (the empty tuple).
 
-        let opaque_ty = ty::mk_tup(self.tcx(), ~[]);
+        let opaque_ty = ty::mk_tup(self.tcx(), Vec::new());
         return self.cat_deref_common(node, base_cmt, deref_cnt, opaque_ty);
     }
 
index 41ea80cff28e73908f0767149c741a58bbde5f65..92b663ff8db0b96dcc04aba779a74252bb7b0efc 100644 (file)
@@ -159,7 +159,7 @@ pub struct CaptureVar {
     mode: CaptureMode // How variable is being accessed
 }
 
-pub type CaptureMap = @RefCell<NodeMap<Rc<~[CaptureVar]>>>;
+pub type CaptureMap = @RefCell<NodeMap<Rc<Vec<CaptureVar> >>>;
 
 pub type MovesMap = @RefCell<NodeSet>;
 
@@ -680,7 +680,7 @@ pub fn use_fn_arg(&mut self, arg_expr: @Expr) {
         self.consume_expr(arg_expr)
     }
 
-    pub fn compute_captures(&mut self, fn_expr_id: NodeId) -> Rc<~[CaptureVar]> {
+    pub fn compute_captures(&mut self, fn_expr_id: NodeId) -> Rc<Vec<CaptureVar> > {
         debug!("compute_capture_vars(fn_expr_id={:?})", fn_expr_id);
         let _indenter = indenter();
 
index d352771ef5015795f59b934ccc414c3da90f44f8..36c6c19028444df0c33cb7b06dd707867e4ea24f 100644 (file)
@@ -88,8 +88,8 @@ pub fn pat_bindings(dm: resolve::DefMap,
     });
 }
 
-pub fn pat_binding_ids(dm: resolve::DefMap, pat: &Pat) -> ~[NodeId] {
-    let mut found = ~[];
+pub fn pat_binding_ids(dm: resolve::DefMap, pat: &Pat) -> Vec<NodeId> {
+    let mut found = Vec::new();
     pat_bindings(dm, pat, |_bm, b_id, _sp, _pt| found.push(b_id) );
     return found;
 }
index 4ade65294d9e4c9f07260032ad0e0e3058ba83e2..9deb51e412e8d0a2a30183ffbca8570f5b5adf9d 100644 (file)
@@ -92,11 +92,11 @@ struct ReachableContext {
     reachable_symbols: @RefCell<NodeSet>,
     // A worklist of item IDs. Each item ID in this worklist will be inlined
     // and will be scanned for further references.
-    worklist: @RefCell<~[ast::NodeId]>,
+    worklist: @RefCell<Vec<ast::NodeId> >,
 }
 
 struct MarkSymbolVisitor {
-    worklist: @RefCell<~[ast::NodeId]>,
+    worklist: @RefCell<Vec<ast::NodeId> >,
     method_map: typeck::MethodMap,
     tcx: ty::ctxt,
     reachable_symbols: @RefCell<NodeSet>,
@@ -190,7 +190,7 @@ fn new(tcx: ty::ctxt, method_map: typeck::MethodMap) -> ReachableContext {
             tcx: tcx,
             method_map: method_map,
             reachable_symbols: @RefCell::new(NodeSet::new()),
-            worklist: @RefCell::new(~[]),
+            worklist: @RefCell::new(Vec::new()),
         }
     }
 
index 07b68900ba5f1a2494308deba465990a5f0ea213..a575a8e3fcf57325a8ff0b2aa73158d6753b3db2 100644 (file)
@@ -77,7 +77,7 @@
 pub struct RegionMaps {
     priv scope_map: RefCell<NodeMap<ast::NodeId>>,
     priv var_map: RefCell<NodeMap<ast::NodeId>>,
-    priv free_region_map: RefCell<HashMap<FreeRegion, ~[FreeRegion]>>,
+    priv free_region_map: RefCell<HashMap<FreeRegion, Vec<FreeRegion> >>,
     priv rvalue_scopes: RefCell<NodeMap<ast::NodeId>>,
     priv terminating_scopes: RefCell<HashSet<ast::NodeId>>,
 }
@@ -113,7 +113,7 @@ pub fn relate_free_regions(&self, sub: FreeRegion, sup: FreeRegion) {
 
         debug!("relate_free_regions(sub={:?}, sup={:?})", sub, sup);
 
-        free_region_map.get().insert(sub, ~[sup]);
+        free_region_map.get().insert(sub, vec!(sup));
     }
 
     pub fn record_encl_scope(&self, sub: ast::NodeId, sup: ast::NodeId) {
@@ -283,7 +283,7 @@ pub fn sub_free_region(&self, sub: FreeRegion, sup: FreeRegion) -> bool {
         // doubles as a way to detect if we've seen a particular FR
         // before.  Note that we expect this graph to be an *extremely
         // shallow* tree.
-        let mut queue = ~[sub];
+        let mut queue = vec!(sub);
         let mut i = 0;
         while i < queue.len() {
             let free_region_map = self.free_region_map.borrow();
@@ -386,10 +386,9 @@ pub fn nearest_common_ancestor(&self,
         }
 
         fn ancestors_of(this: &RegionMaps, scope: ast::NodeId)
-            -> ~[ast::NodeId]
-        {
+            -> Vec<ast::NodeId> {
             // debug!("ancestors_of(scope={})", scope);
-            let mut result = ~[scope];
+            let mut result = vec!(scope);
             let mut scope = scope;
             loop {
                 let scope_map = this.scope_map.borrow();
index 7e333818912838bbc25771c8030f7a1e29cd774b..f75b45f2b21dbc91dc156e01f16270965ff8cad4 100644 (file)
@@ -48,11 +48,11 @@ struct binding_info {
 type BindingMap = HashMap<Name,binding_info>;
 
 // Trait method resolution
-pub type TraitMap = NodeMap<~[DefId]>;
+pub type TraitMap = NodeMap<Vec<DefId> >;
 
 // This is the replacement export map. It maps a module to all of the exports
 // within.
-pub type ExportMap2 = @RefCell<NodeMap<~[Export2]>>;
+pub type ExportMap2 = @RefCell<NodeMap<Vec<Export2> >>;
 
 pub struct Export2 {
     name: ~str,        // The name of the target.
@@ -319,7 +319,7 @@ fn new(kind: RibKind) -> Rib {
 
 /// One import directive.
 struct ImportDirective {
-    module_path: ~[Ident],
+    module_path: Vec<Ident> ,
     subclass: @ImportDirectiveSubclass,
     span: Span,
     id: NodeId,
@@ -327,7 +327,7 @@ struct ImportDirective {
 }
 
 impl ImportDirective {
-    fn new(module_path: ~[Ident],
+    fn new(module_path: Vec<Ident> ,
            subclass: @ImportDirectiveSubclass,
            span: Span,
            id: NodeId,
@@ -438,7 +438,7 @@ struct Module {
     is_public: bool,
 
     children: RefCell<HashMap<Name, @NameBindings>>,
-    imports: RefCell<~[@ImportDirective]>,
+    imports: RefCell<Vec<@ImportDirective> >,
 
     // The external module children of this node that were declared with
     // `extern crate`.
@@ -488,7 +488,7 @@ fn new(parent_link: ParentLink,
             kind: Cell::new(kind),
             is_public: is_public,
             children: RefCell::new(HashMap::new()),
-            imports: RefCell::new(~[]),
+            imports: RefCell::new(Vec::new()),
             external_module_children: RefCell::new(HashMap::new()),
             anonymous_children: RefCell::new(NodeMap::new()),
             import_resolutions: RefCell::new(HashMap::new()),
@@ -815,9 +815,9 @@ fn Resolver(session: Session,
         unresolved_imports: 0,
 
         current_module: current_module,
-        value_ribs: @RefCell::new(~[]),
-        type_ribs: @RefCell::new(~[]),
-        label_ribs: @RefCell::new(~[]),
+        value_ribs: @RefCell::new(Vec::new()),
+        type_ribs: @RefCell::new(Vec::new()),
+        label_ribs: @RefCell::new(Vec::new()),
 
         current_trait_refs: None,
 
@@ -826,7 +826,7 @@ fn Resolver(session: Session,
 
         primitive_type_table: @PrimitiveTypeTable(),
 
-        namespaces: ~[ TypeNS, ValueNS ],
+        namespaces: Vec<TypeNS, ValueNS > ,
 
         def_map: @RefCell::new(NodeMap::new()),
         export_map2: @RefCell::new(NodeMap::new()),
@@ -859,16 +859,16 @@ struct Resolver {
 
     // The current set of local scopes, for values.
     // FIXME #4948: Reuse ribs to avoid allocation.
-    value_ribs: @RefCell<~[@Rib]>,
+    value_ribs: @RefCell<Vec<@Rib> >,
 
     // The current set of local scopes, for types.
-    type_ribs: @RefCell<~[@Rib]>,
+    type_ribs: @RefCell<Vec<@Rib> >,
 
     // The current set of local scopes, for labels.
-    label_ribs: @RefCell<~[@Rib]>,
+    label_ribs: @RefCell<Vec<@Rib> >,
 
     // The trait that the current context can refer to.
-    current_trait_refs: Option<~[DefId]>,
+    current_trait_refs: Option<Vec<DefId> >,
 
     // The ident for the keyword "self".
     self_ident: Ident,
@@ -879,7 +879,7 @@ struct Resolver {
     primitive_type_table: @PrimitiveTypeTable,
 
     // The four namespaces.
-    namespaces: ~[Namespace],
+    namespaces: Vec<Namespace> ,
 
     def_map: DefMap,
     export_map2: ExportMap2,
@@ -1452,7 +1452,7 @@ fn build_reduced_graph_for_view_item(&mut self, view_item: &ViewItem,
                     // globs and lists, the path is found directly in the AST;
                     // for simple paths we have to munge the path a little.
 
-                    let mut module_path = ~[];
+                    let mut module_path = Vec::new();
                     match view_path.node {
                         ViewPathSimple(_, ref full_path, _) => {
                             let path_len = full_path.segments.len();
@@ -1951,7 +1951,7 @@ fn build_reduced_graph_for_external_crate(&mut self,
     /// Creates and adds an import directive to the given module.
     fn build_import_directive(&mut self,
                               module_: @Module,
-                              module_path: ~[Ident],
+                              module_path: Vec<Ident> ,
                               subclass: @ImportDirectiveSubclass,
                               span: Span,
                               id: NodeId,
@@ -2124,7 +2124,7 @@ fn idents_to_str(&mut self, idents: &[Ident]) -> ~str {
     }
 
     fn path_idents_to_str(&mut self, path: &Path) -> ~str {
-        let identifiers: ~[ast::Ident] = path.segments
+        let identifiers: Vec<ast::Ident> = path.segments
                                              .iter()
                                              .map(|seg| seg.identifier)
                                              .collect();
@@ -3374,7 +3374,7 @@ fn record_exports_for_module_subtree(&mut self,
     }
 
     fn record_exports_for_module(&mut self, module_: @Module) {
-        let mut exports2 = ~[];
+        let mut exports2 = Vec::new();
 
         self.add_exports_for_module(&mut exports2, module_);
         match module_.def_id.get() {
@@ -3389,7 +3389,7 @@ fn record_exports_for_module(&mut self, module_: @Module) {
     }
 
     fn add_exports_of_namebindings(&mut self,
-                                   exports2: &mut ~[Export2],
+                                   exports2: &mut Vec<Export2> ,
                                    name: Name,
                                    namebindings: @NameBindings,
                                    ns: Namespace) {
@@ -3410,7 +3410,7 @@ fn add_exports_of_namebindings(&mut self,
     }
 
     fn add_exports_for_module(&mut self,
-                              exports2: &mut ~[Export2],
+                              exports2: &mut Vec<Export2> ,
                               module_: @Module) {
         let import_resolutions = module_.import_resolutions.borrow();
         for (name, importresolution) in import_resolutions.get().iter() {
@@ -3495,7 +3495,7 @@ fn with_scope(&mut self, name: Option<Ident>, f: |&mut Resolver|) {
     /// Wraps the given definition in the appropriate number of `def_upvar`
     /// wrappers.
     fn upvarify(&mut self,
-                    ribs: &mut ~[@Rib],
+                    ribs: &mut Vec<@Rib> ,
                     rib_index: uint,
                     def_like: DefLike,
                     span: Span)
@@ -3610,7 +3610,7 @@ fn upvarify(&mut self,
     }
 
     fn search_ribs(&mut self,
-                       ribs: &mut ~[@Rib],
+                       ribs: &mut Vec<@Rib> ,
                        name: Name,
                        span: Span)
                        -> Option<DefLike> {
@@ -4095,7 +4095,7 @@ fn resolve_implementation(&mut self,
                         TraitImplementation);
 
                     // Record the current set of trait references.
-                    let mut new_trait_refs = ~[];
+                    let mut new_trait_refs = Vec::new();
                     {
                         let def_map = this.def_map.borrow();
                         let r = def_map.get().find(&trait_reference.ref_id);
@@ -5054,8 +5054,8 @@ fn find_best_match_for_name(&mut self, name: &str, max_distance: uint)
                                 -> Option<~str> {
         let this = &mut *self;
 
-        let mut maybes: ~[token::InternedString] = ~[];
-        let mut values: ~[uint] = ~[];
+        let mut maybes: Vec<token::InternedString> = Vec::new();
+        let mut values: Vec<uint> = Vec::new();
 
         let mut j = {
             let value_ribs = this.value_ribs.borrow();
@@ -5274,11 +5274,11 @@ fn record_candidate_traits_for_expr_if_necessary(&mut self, expr: &Expr) {
         }
     }
 
-    fn search_for_traits_containing_method(&mut self, name: Ident) -> ~[DefId] {
+    fn search_for_traits_containing_method(&mut self, name: Ident) -> Vec<DefId> {
         debug!("(searching for traits containing method) looking for '{}'",
                token::get_ident(name));
 
-        let mut found_traits = ~[];
+        let mut found_traits = Vec::new();
         let mut search_module = self.current_module;
         let method_map = self.method_map.borrow();
         match method_map.get().find(&name.name) {
@@ -5350,7 +5350,7 @@ fn search_for_traits_containing_method(&mut self, name: Ident) -> ~[DefId] {
     }
 
     fn add_trait_info(&self,
-                          found_traits: &mut ~[DefId],
+                          found_traits: &mut Vec<DefId> ,
                           trait_def_id: DefId,
                           name: Ident) {
         debug!("(adding trait info) found trait {}:{} for method '{}'",
@@ -5495,7 +5495,7 @@ fn finalize_import(&mut self, id: NodeId, span: Span) {
 
     /// A somewhat inefficient routine to obtain the name of a module.
     fn module_to_str(&mut self, module_: @Module) -> ~str {
-        let mut idents = ~[];
+        let mut idents = Vec::new();
         let mut current_module = module_;
         loop {
             match current_module.parent_link {
@@ -5516,7 +5516,7 @@ fn module_to_str(&mut self, module_: @Module) -> ~str {
         if idents.len() == 0 {
             return ~"???";
         }
-        return self.idents_to_str(idents.move_rev_iter().collect::<~[ast::Ident]>());
+        return self.idents_to_str(idents.move_rev_iter().collect::<Vec<ast::Ident> >());
     }
 
     #[allow(dead_code)]   // useful for debugging
index 7176b512c719ff6bf0b7a03b56c4b8f669973e62..f19d168a729be34f0d1c58f7135f4cb9dff06898 100644 (file)
@@ -130,10 +130,10 @@ fn fold_ty(&mut self, t: ty::t) -> ty::t {
 ///////////////////////////////////////////////////////////////////////////
 // Other types
 
-impl<T:Subst> Subst for ~[T] {
+impl<T:Subst> Subst for Vec<T> {
     fn subst_spanned(&self, tcx: ty::ctxt,
                      substs: &ty::substs,
-                     span: Option<Span>) -> ~[T] {
+                     span: Option<Span>) -> Vec<T> {
         self.map(|t| t.subst_spanned(tcx, substs, span))
     }
 }
index 13104cfa40ae718854058517891c9fb13408f447..93040a36c0e2405d7f8a7e55d591acc748692893 100644 (file)
@@ -421,10 +421,9 @@ fn clone(&self) -> ArmData<'a, 'b> { *self }
  */
 #[deriving(Clone)]
 struct Match<'a,'b> {
-    pats: ~[@ast::Pat],
+    pats: Vec<@ast::Pat> ,
     data: ArmData<'a,'b>,
-    bound_ptrs: ~[(Ident, ValueRef)]
-}
+    bound_ptrs: Vec<(Ident, ValueRef)> }
 
 impl<'a,'b> Repr for Match<'a,'b> {
     fn repr(&self, tcx: ty::ctxt) -> ~str {
@@ -452,7 +451,7 @@ fn expand_nested_bindings<'r,'b>(
                           m: &[Match<'r,'b>],
                           col: uint,
                           val: ValueRef)
-                          -> ~[Match<'r,'b>] {
+                          -> vec!(Match<'r,'b>) {
     debug!("expand_nested_bindings(bcx={}, m={}, col={}, val={})",
            bcx.to_str(),
            m.repr(bcx.tcx()),
@@ -463,9 +462,9 @@ fn expand_nested_bindings<'r,'b>(
     m.map(|br| {
         match br.pats[col].node {
             ast::PatIdent(_, ref path, Some(inner)) => {
-                let pats = vec::append(
+                let pats = vec_ng::append(
                     br.pats.slice(0u, col).to_owned(),
-                    vec::append(~[inner],
+                    vec_ng::append(vec!(inner),
                                 br.pats.slice(col + 1u,
                                            br.pats.len())));
 
@@ -491,7 +490,7 @@ fn assert_is_binding_or_wild(bcx: &Block, p: @ast::Pat) {
     }
 }
 
-type enter_pat<'a> = 'a |@ast::Pat| -> Option<~[@ast::Pat]>;
+type enter_pat<'a> = 'a |@ast::Pat| -> Option<Vec<@ast::Pat> >;
 
 fn enter_match<'r,'b>(
                bcx: &'b Block<'b>,
@@ -500,7 +499,7 @@ fn enter_match<'r,'b>(
                col: uint,
                val: ValueRef,
                e: enter_pat)
-               -> ~[Match<'r,'b>] {
+               -> vec!(Match<'r,'b>) {
     debug!("enter_match(bcx={}, m={}, col={}, val={})",
            bcx.to_str(),
            m.repr(bcx.tcx()),
@@ -508,13 +507,13 @@ fn enter_match<'r,'b>(
            bcx.val_to_str(val));
     let _indenter = indenter();
 
-    let mut result = ~[];
+    let mut result = Vec::new();
     for br in m.iter() {
         match e(br.pats[col]) {
             Some(sub) => {
                 let pats =
-                    vec::append(
-                        vec::append(sub, br.pats.slice(0u, col)),
+                    vec_ng::append(
+                        vec_ng::append(sub, br.pats.slice(0u, col)),
                         br.pats.slice(col + 1u, br.pats.len()));
 
                 let this = br.pats[col];
@@ -550,7 +549,7 @@ fn enter_default<'r,'b>(
                  col: uint,
                  val: ValueRef,
                  chk: &FailureHandler)
-                 -> ~[Match<'r,'b>] {
+                 -> vec!(Match<'r,'b>) {
     debug!("enter_default(bcx={}, m={}, col={}, val={})",
            bcx.to_str(),
            m.repr(bcx.tcx()),
@@ -561,8 +560,8 @@ fn enter_default<'r,'b>(
     // Collect all of the matches that can match against anything.
     let matches = enter_match(bcx, dm, m, col, val, |p| {
         match p.node {
-          ast::PatWild | ast::PatWildMulti | ast::PatTup(_) => Some(~[]),
-          ast::PatIdent(_, _, None) if pat_is_binding(dm, p) => Some(~[]),
+          ast::PatWild | ast::PatWildMulti | ast::PatTup(_) => Some(Vec::new()),
+          ast::PatIdent(_, _, None) if pat_is_binding(dm, p) => Some(Vec::new()),
           _ => None
         }
     });
@@ -587,7 +586,7 @@ fn enter_default<'r,'b>(
         _ => false
     };
 
-    if is_exhaustive { ~[] } else { matches }
+    if is_exhaustive { Vec::new() } else { matches }
 }
 
 // <pcwalton> nmatsakis: what does enter_opt do?
@@ -621,7 +620,7 @@ fn enter_opt<'r,'b>(
              col: uint,
              variant_size: uint,
              val: ValueRef)
-             -> ~[Match<'r,'b>] {
+             -> vec!(Match<'r,'b>) {
     debug!("enter_opt(bcx={}, m={}, opt={:?}, col={}, val={})",
            bcx.to_str(),
            m.repr(bcx.tcx()),
@@ -643,7 +642,7 @@ fn enter_opt<'r,'b>(
                 };
                 let const_def_id = ast_util::def_id_of_def(const_def);
                 if opt_eq(tcx, &lit(ConstLit(const_def_id)), opt) {
-                    Some(~[])
+                    Some(Vec::new())
                 } else {
                     None
                 }
@@ -664,16 +663,16 @@ fn enter_opt<'r,'b>(
             ast::PatIdent(_, _, None)
                     if pat_is_variant_or_struct(tcx.def_map, p) => {
                 if opt_eq(tcx, &variant_opt(bcx, p.id), opt) {
-                    Some(~[])
+                    Some(Vec::new())
                 } else {
                     None
                 }
             }
             ast::PatLit(l) => {
-                if opt_eq(tcx, &lit(ExprLit(l)), opt) {Some(~[])} else {None}
+                if opt_eq(tcx, &lit(ExprLit(l)), opt) {Some(Vec::new())} else {None}
             }
             ast::PatRange(l1, l2) => {
-                if opt_eq(tcx, &range(l1, l2), opt) {Some(~[])} else {None}
+                if opt_eq(tcx, &range(l1, l2), opt) {Some(Vec::new())} else {None}
             }
             ast::PatStruct(_, ref field_pats, _) => {
                 if opt_eq(tcx, &variant_opt(bcx, p.id), opt) {
@@ -695,7 +694,7 @@ fn enter_opt<'r,'b>(
                     // Reorder the patterns into the same order they were
                     // specified in the struct definition. Also fill in
                     // unspecified fields with dummy.
-                    let mut reordered_patterns = ~[];
+                    let mut reordered_patterns = Vec::new();
                     let r = ty::lookup_struct_fields(tcx, struct_id);
                     for field in r.iter() {
                             match field_pats.iter().find(|p| p.ident.name
@@ -722,7 +721,7 @@ fn enter_opt<'r,'b>(
                         let this_opt = vec_len(n, vec_len_ge(before.len()),
                                                (lo, hi));
                         if opt_eq(tcx, &this_opt, opt) {
-                            let mut new_before = ~[];
+                            let mut new_before = Vec::new();
                             for pat in before.iter() {
                                 new_before.push(*pat);
                             }
@@ -738,7 +737,7 @@ fn enter_opt<'r,'b>(
                     None if i >= lo && i <= hi => {
                         let n = before.len();
                         if opt_eq(tcx, &vec_len(n, vec_len_eq, (lo,hi)), opt) {
-                            let mut new_before = ~[];
+                            let mut new_before = Vec::new();
                             for pat in before.iter() {
                                 new_before.push(*pat);
                             }
@@ -778,7 +777,7 @@ fn enter_rec_or_struct<'r,'b>(
                        col: uint,
                        fields: &[ast::Ident],
                        val: ValueRef)
-                       -> ~[Match<'r,'b>] {
+                       -> vec!(Match<'r,'b>) {
     debug!("enter_rec_or_struct(bcx={}, m={}, col={}, val={})",
            bcx.to_str(),
            m.repr(bcx.tcx()),
@@ -790,7 +789,7 @@ fn enter_rec_or_struct<'r,'b>(
     enter_match(bcx, dm, m, col, val, |p| {
         match p.node {
             ast::PatStruct(_, ref fpats, _) => {
-                let mut pats = ~[];
+                let mut pats = Vec::new();
                 for fname in fields.iter() {
                     match fpats.iter().find(|p| p.ident.name == fname.name) {
                         None => pats.push(dummy),
@@ -814,7 +813,7 @@ fn enter_tup<'r,'b>(
              col: uint,
              val: ValueRef,
              n_elts: uint)
-             -> ~[Match<'r,'b>] {
+             -> vec!(Match<'r,'b>) {
     debug!("enter_tup(bcx={}, m={}, col={}, val={})",
            bcx.to_str(),
            m.repr(bcx.tcx()),
@@ -826,7 +825,7 @@ fn enter_tup<'r,'b>(
     enter_match(bcx, dm, m, col, val, |p| {
         match p.node {
             ast::PatTup(ref elts) => {
-                let mut new_elts = ~[];
+                let mut new_elts = Vec::new();
                 for elt in elts.iter() {
                     new_elts.push((*elt).clone())
                 }
@@ -847,7 +846,7 @@ fn enter_tuple_struct<'r,'b>(
                       col: uint,
                       val: ValueRef,
                       n_elts: uint)
-                      -> ~[Match<'r,'b>] {
+                      -> vec!(Match<'r,'b>) {
     debug!("enter_tuple_struct(bcx={}, m={}, col={}, val={})",
            bcx.to_str(),
            m.repr(bcx.tcx()),
@@ -875,7 +874,7 @@ fn enter_uniq<'r,'b>(
               m: &[Match<'r,'b>],
               col: uint,
               val: ValueRef)
-              -> ~[Match<'r,'b>] {
+              -> vec!(Match<'r,'b>) {
     debug!("enter_uniq(bcx={}, m={}, col={}, val={})",
            bcx.to_str(),
            m.repr(bcx.tcx()),
@@ -887,11 +886,11 @@ fn enter_uniq<'r,'b>(
     enter_match(bcx, dm, m, col, val, |p| {
         match p.node {
             ast::PatUniq(sub) => {
-                Some(~[sub])
+                Some(vec!(sub))
             }
             _ => {
                 assert_is_binding_or_wild(bcx, p);
-                Some(~[dummy])
+                Some(vec!(dummy))
             }
         }
     })
@@ -904,7 +903,7 @@ fn enter_region<'r,
                 m: &[Match<'r,'b>],
                 col: uint,
                 val: ValueRef)
-                -> ~[Match<'r,'b>] {
+                -> vec!(Match<'r,'b>) {
     debug!("enter_region(bcx={}, m={}, col={}, val={})",
            bcx.to_str(),
            m.repr(bcx.tcx()),
@@ -916,11 +915,11 @@ fn enter_region<'r,
     enter_match(bcx, dm, m, col, val, |p| {
         match p.node {
             ast::PatRegion(sub) => {
-                Some(~[sub])
+                Some(vec!(sub))
             }
             _ => {
                 assert_is_binding_or_wild(bcx, p);
-                Some(~[dummy])
+                Some(vec!(dummy))
             }
         }
     })
@@ -929,9 +928,9 @@ fn enter_region<'r,
 // Returns the options in one column of matches. An option is something that
 // needs to be conditionally matched at runtime; for example, the discriminant
 // on a set of enum variants or a literal.
-fn get_options(bcx: &Block, m: &[Match], col: uint) -> ~[Opt] {
+fn get_options(bcx: &Block, m: &[Match], col: uint) -> Vec<Opt> {
     let ccx = bcx.ccx();
-    fn add_to_set(tcx: ty::ctxt, set: &mut ~[Opt], val: Opt) {
+    fn add_to_set(tcx: ty::ctxt, set: &mut Vec<Opt> , val: Opt) {
         if set.iter().any(|l| opt_eq(tcx, l, &val)) {return;}
         set.push(val);
     }
@@ -939,7 +938,7 @@ fn add_to_set(tcx: ty::ctxt, set: &mut ~[Opt], val: Opt) {
     // conditions over-match, we need to be careful about them. This
     // means that in order to properly handle things in order, we need
     // to not always merge conditions.
-    fn add_veclen_to_set(set: &mut ~[Opt], i: uint,
+    fn add_veclen_to_set(set: &mut Vec<Opt> , i: uint,
                          len: uint, vlo: VecLenOpt) {
         match set.last() {
             // If the last condition in the list matches the one we want
@@ -952,7 +951,7 @@ fn add_veclen_to_set(set: &mut ~[Opt], i: uint,
         }
     }
 
-    let mut found = ~[];
+    let mut found = Vec::new();
     for (i, br) in m.iter().enumerate() {
         let cur = br.pats[col];
         match cur.node {
@@ -1020,7 +1019,7 @@ fn add_veclen_to_set(set: &mut ~[Opt], i: uint,
 }
 
 struct ExtractedBlock<'a> {
-    vals: ~[ValueRef],
+    vals: Vec<ValueRef> ,
     bcx: &'a Block<'a>,
 }
 
@@ -1108,8 +1107,8 @@ fn collect_record_or_struct_fields<'a>(
                                    bcx: &'a Block<'a>,
                                    m: &[Match],
                                    col: uint)
-                                   -> Option<~[ast::Ident]> {
-    let mut fields: ~[ast::Ident] = ~[];
+                                   -> Option<Vec<ast::Ident> > {
+    let mut fields: Vec<ast::Ident> = Vec::new();
     let mut found = false;
     for br in m.iter() {
         match br.pats[col].node {
@@ -1131,7 +1130,7 @@ fn collect_record_or_struct_fields<'a>(
         return None;
     }
 
-    fn extend(idents: &mut ~[ast::Ident], field_pats: &[ast::FieldPat]) {
+    fn extend(idents: &mut Vec<ast::Ident> , field_pats: &[ast::FieldPat]) {
         for field_pat in field_pats.iter() {
             let field_ident = field_pat.ident;
             if !idents.iter().any(|x| x.name == field_ident.name) {
@@ -1530,7 +1529,7 @@ fn compile_submatch_continue<'r,
     let tcx = bcx.tcx();
     let dm = tcx.def_map;
 
-    let vals_left = vec::append(vals.slice(0u, col).to_owned(),
+    let vals_left = vec_ng::append(vals.slice(0u, col).to_owned(),
                                 vals.slice(col + 1u, vals.len()));
     let ccx = bcx.fcx.ccx;
     let mut pat_id = 0;
@@ -1558,7 +1557,7 @@ fn compile_submatch_continue<'r,
                 compile_submatch(
                         bcx,
                         enter_rec_or_struct(bcx, dm, m, col, *rec_fields, val),
-                        vec::append(rec_vals, vals_left),
+                        vec_ng::append(rec_vals, vals_left),
                         chk);
             });
             return;
@@ -1577,7 +1576,7 @@ fn compile_submatch_continue<'r,
             adt::trans_field_ptr(bcx, tup_repr, val, 0, i)
         });
         compile_submatch(bcx, enter_tup(bcx, dm, m, col, val, n_tup_elts),
-                         vec::append(tup_vals, vals_left), chk);
+                         vec_ng::append(tup_vals, vals_left), chk);
         return;
     }
 
@@ -1601,7 +1600,7 @@ fn compile_submatch_continue<'r,
         compile_submatch(bcx,
                          enter_tuple_struct(bcx, dm, m, col, val,
                                             struct_element_count),
-                         vec::append(llstructvals, vals_left),
+                         vec_ng::append(llstructvals, vals_left),
                          chk);
         return;
     }
@@ -1609,14 +1608,14 @@ fn compile_submatch_continue<'r,
     if any_uniq_pat(m, col) {
         let llbox = Load(bcx, val);
         compile_submatch(bcx, enter_uniq(bcx, dm, m, col, val),
-                         vec::append(~[llbox], vals_left), chk);
+                         vec_ng::append(vec!(llbox), vals_left), chk);
         return;
     }
 
     if any_region_pat(m, col) {
         let loaded_val = Load(bcx, val);
         compile_submatch(bcx, enter_region(bcx, dm, m, col, val),
-                         vec::append(~[loaded_val], vals_left), chk);
+                         vec_ng::append(vec!(loaded_val), vals_left), chk);
         return;
     }
 
@@ -1773,7 +1772,7 @@ fn compile_submatch_continue<'r,
         }
 
         let mut size = 0u;
-        let mut unpacked = ~[];
+        let mut unpacked = Vec::new();
         match *opt {
             var(disr_val, repr) => {
                 let ExtractedBlock {vals: argvals, bcx: new_bcx} =
@@ -1796,7 +1795,7 @@ fn compile_submatch_continue<'r,
             lit(_) | range(_, _) => ()
         }
         let opt_ms = enter_opt(opt_cx, m, opt, col, size, val);
-        let opt_vals = vec::append(unpacked, vals_left);
+        let opt_vals = vec_ng::append(unpacked, vals_left);
 
         match branch_chk {
             None => compile_submatch(opt_cx, opt_ms, opt_vals, chk),
@@ -1884,8 +1883,8 @@ fn trans_match_inner<'a>(scope_cx: &'a Block<'a>,
         return bcx;
     }
 
-    let mut arm_datas = ~[];
-    let mut matches = ~[];
+    let mut arm_datas = Vec::new();
+    let mut matches = Vec::new();
     for arm in arms.iter() {
         let body = fcx.new_id_block("case_body", arm.body.id);
         let bindings_map = create_bindings_map(bcx, *arm.pats.get(0));
@@ -1897,9 +1896,9 @@ fn trans_match_inner<'a>(scope_cx: &'a Block<'a>,
         arm_datas.push(arm_data.clone());
         for p in arm.pats.iter() {
             matches.push(Match {
-                pats: ~[*p],
+                pats: vec!(*p),
                 data: arm_data.clone(),
-                bound_ptrs: ~[],
+                bound_ptrs: Vec::new(),
             });
         }
     }
@@ -1924,7 +1923,7 @@ fn trans_match_inner<'a>(scope_cx: &'a Block<'a>,
     let lldiscr = discr_datum.val;
     compile_submatch(bcx, matches, [lldiscr], &chk);
 
-    let mut arm_cxs = ~[];
+    let mut arm_cxs = Vec::new();
     for arm_data in arm_datas.iter() {
         let mut bcx = arm_data.bodycx;
 
index ae0025ffa30841a66e477be380e19667cf6c6a57..c41783cc29496e17f20d5aff91c64496ccc359d9 100644 (file)
@@ -83,7 +83,7 @@ pub enum Repr {
      * General-case enums: for each case there is a struct, and they
      * all start with a field for the discriminant.
      */
-    General(IntType, ~[Struct]),
+    General(IntType, Vec<Struct> ),
     /**
      * Two cases distinguished by a nullable pointer: the case with discriminant
      * `nndiscr` is represented by the struct `nonnull`, where the `ptrfield`th
@@ -96,7 +96,7 @@ pub enum Repr {
      * identity function.
      */
     NullablePointer{ nonnull: Struct, nndiscr: Disr, ptrfield: uint,
-                     nullfields: ~[ty::t] }
+                     nullfields: Vec<ty::t> }
 }
 
 /// For structs, and struct-like parts of anything fancier.
@@ -104,8 +104,7 @@ pub struct Struct {
     size: u64,
     align: u64,
     packed: bool,
-    fields: ~[ty::t]
-}
+    fields: Vec<ty::t> }
 
 /**
  * Convenience for `represent_type`.  There should probably be more or
@@ -217,7 +216,7 @@ fn represent_type_uncached(cx: &CrateContext, t: ty::t) -> Repr {
             let bounds = IntBounds { ulo: 0, uhi: (cases.len() - 1) as u64,
                                      slo: 0, shi: (cases.len() - 1) as i64 };
             let ity = range_to_inttype(cx, hint, &bounds);
-            let discr = ~[ty_of_inttype(ity)];
+            let discr = vec!(ty_of_inttype(ity));
             return General(ity, cases.map(|c| mk_struct(cx, discr + c.tys, false)))
         }
         _ => cx.sess.bug("adt::represent_type called on non-ADT type")
@@ -254,7 +253,7 @@ pub fn is_ffi_safe(tcx: ty::ctxt, def_id: ast::DefId) -> bool {
 }
 
 // this should probably all be in ty
-struct Case { discr: Disr, tys: ~[ty::t] }
+struct Case { discr: Disr, tys: Vec<ty::t> }
 impl Case {
     fn is_zerolen(&self, cx: &CrateContext) -> bool {
         mk_struct(cx, self.tys, false).size == 0
@@ -264,7 +263,7 @@ fn find_ptr(&self) -> Option<uint> {
     }
 }
 
-fn get_cases(tcx: ty::ctxt, def_id: ast::DefId, substs: &ty::substs) -> ~[Case] {
+fn get_cases(tcx: ty::ctxt, def_id: ast::DefId, substs: &ty::substs) -> Vec<Case> {
     ty::enum_variants(tcx, def_id).map(|vi| {
         let arg_tys = vi.args.map(|&raw_ty| {
             ty::subst(tcx, substs, raw_ty)
@@ -438,9 +437,9 @@ fn generic_type_of(cx: &CrateContext, r: &Repr, name: Option<&str>, sizing: bool
             };
             assert_eq!(machine::llalign_of_min(cx, pad_ty) as u64, align);
             assert_eq!(align % discr_size, 0);
-            let fields = ~[discr_ty,
+            let fields = vec!(discr_ty,
                            Type::array(&discr_ty, align / discr_size - 1),
-                           pad_ty];
+                           pad_ty);
             match name {
                 None => Type::struct_(fields, false),
                 Some(name) => {
@@ -453,7 +452,7 @@ fn generic_type_of(cx: &CrateContext, r: &Repr, name: Option<&str>, sizing: bool
     }
 }
 
-fn struct_llfields(cx: &CrateContext, st: &Struct, sizing: bool) -> ~[Type] {
+fn struct_llfields(cx: &CrateContext, st: &Struct, sizing: bool) -> Vec<Type> {
     if sizing {
         st.fields.map(|&ty| type_of::sizing_type_of(cx, ty))
     } else {
@@ -741,7 +740,7 @@ pub fn trans_const(ccx: &CrateContext, r: &Repr, discr: Disr,
             let case = &cases[discr];
             let max_sz = cases.iter().map(|x| x.size).max().unwrap();
             let lldiscr = C_integral(ll_inttype(ccx, ity), discr as u64, true);
-            let contents = build_const_struct(ccx, case, ~[lldiscr] + vals);
+            let contents = build_const_struct(ccx, case, vec!(lldiscr) + vals);
             C_struct(contents + &[padding(max_sz - case.size)], false)
         }
         Univariant(ref st, _dro) => {
@@ -757,7 +756,7 @@ pub fn trans_const(ccx: &CrateContext, r: &Repr, discr: Disr,
                     // Always use null even if it's not the `ptrfield`th
                     // field; see #8506.
                     C_null(type_of::sizing_type_of(ccx, ty))
-                });
+                }).collect::<Vec<ValueRef> >();
                 C_struct(build_const_struct(ccx, nonnull, vals), false)
             }
         }
@@ -775,11 +774,11 @@ pub fn trans_const(ccx: &CrateContext, r: &Repr, discr: Disr,
  * will read the wrong memory.
  */
 fn build_const_struct(ccx: &CrateContext, st: &Struct, vals: &[ValueRef])
-    -> ~[ValueRef] {
+    -> Vec<ValueRef> {
     assert_eq!(vals.len(), st.fields.len());
 
     let mut offset = 0;
-    let mut cfields = ~[];
+    let mut cfields = Vec::new();
     for (i, &ty) in st.fields.iter().enumerate() {
         let llty = type_of::sizing_type_of(ccx, ty);
         let type_align = machine::llalign_of_min(ccx, llty)
index 59ef31751ebf36f40145470ad35feecb3530d15c..83d5420d5d33f2559148660f922f94fdc0953286 100644 (file)
@@ -32,8 +32,8 @@ pub fn trans_inline_asm<'a>(bcx: &'a Block<'a>, ia: &ast::InlineAsm)
                         -> &'a Block<'a> {
     let fcx = bcx.fcx;
     let mut bcx = bcx;
-    let mut constraints = ~[];
-    let mut output_types = ~[];
+    let mut constraints = Vec::new();
+    let mut output_types = Vec::new();
 
     let temp_scope = fcx.push_custom_cleanup_scope();
 
index 625b130d47af96be708b871d3580dbbf4a6696fd..f4540a07794a55b7f6f690d32a5f1119b6540777 100644 (file)
@@ -94,7 +94,7 @@
 
 pub use middle::trans::context::task_llcx;
 
-local_data_key!(task_local_insn_key: ~[&'static str])
+local_data_key!(task_local_insn_key: Vec<&'static str> )
 
 pub fn with_insn_ctxt(blk: |&[&'static str]|) {
     local_data::get(task_local_insn_key, |c| {
@@ -106,7 +106,7 @@ pub fn with_insn_ctxt(blk: |&[&'static str]|) {
 }
 
 pub fn init_insn_ctxt() {
-    local_data::set(task_local_insn_key, ~[]);
+    local_data::set(task_local_insn_key, Vec::new());
 }
 
 pub struct _InsnCtxt { _x: () }
@@ -902,7 +902,7 @@ pub fn trans_external_path(ccx: &CrateContext, did: ast::DefId, t: ty::t) -> Val
 pub fn invoke<'a>(
               bcx: &'a Block<'a>,
               llfn: ValueRef,
-              llargs: ~[ValueRef],
+              llargs: Vec<ValueRef> ,
               attributes: &[(uint, lib::llvm::Attribute)],
               call_info: Option<NodeInfo>)
               -> (ValueRef, &'a Block<'a>) {
@@ -1255,7 +1255,7 @@ pub fn new_fn_ctxt<'a>(ccx: @CrateContext,
           block_arena: block_arena,
           ccx: ccx,
           debug_context: debug_context,
-          scopes: RefCell::new(~[])
+          scopes: RefCell::new(Vec::new())
     };
 
     if has_env {
@@ -1331,7 +1331,7 @@ fn arg_kind(cx: &FunctionContext, t: ty::t) -> datum::Rvalue {
 // appropriate lvalue datums.
 pub fn create_datums_for_fn_args(fcx: &FunctionContext,
                                  arg_tys: &[ty::t])
-                                 -> ~[RvalueDatum] {
+                                 -> Vec<RvalueDatum> {
     let _icx = push_ctxt("create_datums_for_fn_args");
 
     // Return an array wrapping the ValueRefs that we get from
@@ -1348,7 +1348,7 @@ fn copy_args_to_allocas<'a>(fcx: &FunctionContext<'a>,
                             arg_scope: cleanup::CustomScopeIndex,
                             bcx: &'a Block<'a>,
                             args: &[ast::Arg],
-                            arg_datums: ~[RvalueDatum])
+                            arg_datums: Vec<RvalueDatum> )
                             -> &'a Block<'a> {
     debug!("copy_args_to_allocas");
 
@@ -1633,7 +1633,7 @@ fn trans_enum_variant_or_tuple_like_struct(ccx: @CrateContext,
 }
 
 pub fn trans_enum_def(ccx: @CrateContext, enum_definition: &ast::EnumDef,
-                      id: ast::NodeId, vi: @~[@ty::VariantInfo],
+                      id: ast::NodeId, vi: @Vec<@ty::VariantInfo> ,
                       i: &mut uint) {
     for &variant in enum_definition.variants.iter() {
         let disr_val = vi[*i].disr_val;
@@ -1876,19 +1876,19 @@ fn create_entry_fn(ccx: @CrateContext,
                         llvm::LLVMBuildPointerCast(bld, rust_main, Type::i8p().to_ref(), buf)
                     });
 
-                    ~[
+                    vec!(
                         opaque_rust_main,
                         llvm::LLVMGetParam(llfn, 0),
                         llvm::LLVMGetParam(llfn, 1)
-                     ]
+                     )
                 };
                 (start_fn, args)
             } else {
                 debug!("using user-defined start fn");
-                let args = ~[
+                let args = vec!(
                     llvm::LLVMGetParam(llfn, 0 as c_uint),
                     llvm::LLVMGetParam(llfn, 1 as c_uint)
-                ];
+                );
 
                 (rust_main, args)
             };
@@ -2450,13 +2450,13 @@ pub fn create_module_map(ccx: &CrateContext) -> (ValueRef, uint) {
         }
     });
     lib::llvm::SetLinkage(map, lib::llvm::InternalLinkage);
-    let mut elts: ~[ValueRef] = ~[];
+    let mut elts: Vec<ValueRef> = Vec::new();
 
     // This is not ideal, but the borrow checker doesn't
     // like the multiple borrows. At least, it doesn't
     // like them on the current snapshot. (2013-06-14)
     let keys = {
-        let mut keys = ~[];
+        let mut keys = Vec::new();
         let module_data = ccx.module_data.borrow();
         for (k, _) in module_data.get().iter() {
             keys.push(k.clone());
@@ -2526,7 +2526,7 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
 }
 
 pub fn fill_crate_map(ccx: @CrateContext, map: ValueRef) {
-    let mut subcrates: ~[ValueRef] = ~[];
+    let mut subcrates: Vec<ValueRef> = Vec::new();
     let mut i = 1;
     let cstore = ccx.sess.cstore;
     while cstore.have_crate_data(i) {
@@ -2600,11 +2600,11 @@ pub fn crate_ctxt_to_encode_parms<'r>(cx: &'r CrateContext, ie: encoder::EncodeI
         }
 }
 
-pub fn write_metadata(cx: &CrateContext, krate: &ast::Crate) -> ~[u8] {
+pub fn write_metadata(cx: &CrateContext, krate: &ast::Crate) -> Vec<u8> {
     use flate;
 
     if !cx.sess.building_library.get() {
-        return ~[]
+        return Vec::new()
     }
 
     let encode_inlined_item: encoder::EncodeInlinedItem =
index 92f2ffa08ecb200f980d78a6a09a99c0bb826746..74a6edf95e3f5441a993f5c0aedcbcb3d461642b 100644 (file)
@@ -540,7 +540,7 @@ pub fn gepi(&self, base: ValueRef, ixs: &[uint]) -> ValueRef {
             }
             self.inbounds_gep(base, small_vec.slice(0, ixs.len()))
         } else {
-            let v = ixs.iter().map(|i| C_i32(*i as i32)).collect::<~[ValueRef]>();
+            let v = ixs.iter().map(|i| C_i32(*i as i32)).collect::<Vec<ValueRef> >();
             self.count_insn("gepi");
             self.inbounds_gep(base, v)
         }
index bb05221ae10190880eb1add628ad1438fe90c3a4..df916d5800b4fe8db148df58af73ba1d2da5164e 100644 (file)
@@ -83,7 +83,7 @@ pub fn is_indirect(&self) -> bool {
 /// comments are reverse-engineered and may be inaccurate. -NDM
 pub struct FnType {
     /// The LLVM types of each argument.
-    arg_tys: ~[ArgType],
+    arg_tys: Vec<ArgType> ,
 
     /// LLVM return type.
     ret_ty: ArgType,
index ca80ce26ae3962b0ff33dccb4a7f01f0b999da62..5ae642a24047c138875854cd5efed79c4bfc370a 100644 (file)
@@ -131,7 +131,7 @@ pub fn compute_abi_info(_ccx: &CrateContext,
                         atys: &[Type],
                         rty: Type,
                         ret_def: bool) -> FnType {
-    let mut arg_tys = ~[];
+    let mut arg_tys = Vec::new();
     for &aty in atys.iter() {
         let ty = classify_arg_ty(aty);
         arg_tys.push(ty);
index c3bd84dd583ad5c02e9738fe90c3187be449318d..1cc562c8f714898dab3e65628725957927624ff3 100644 (file)
@@ -132,9 +132,9 @@ fn padding_ty(align: uint, offset: uint) -> Option<Type> {
     return None;
 }
 
-fn coerce_to_int(size: uint) -> ~[Type] {
+fn coerce_to_int(size: uint) -> Vec<Type> {
     let int_ty = Type::i32();
-    let mut args = ~[];
+    let mut args = Vec::new();
 
     let mut n = size / 32;
     while n > 0 {
@@ -169,7 +169,7 @@ pub fn compute_abi_info(_ccx: &CrateContext,
     };
 
     let sret = ret_ty.is_indirect();
-    let mut arg_tys = ~[];
+    let mut arg_tys = Vec::new();
     let mut offset = if sret { 4 } else { 0 };
 
     for aty in atys.iter() {
index 616dc0703a73e7616c4e8369c9fab3a4ba6c1c47..27501e370b5867487fdc59daef65d84fb3ac7c84 100644 (file)
@@ -20,7 +20,7 @@ pub fn compute_abi_info(ccx: &CrateContext,
                         atys: &[Type],
                         rty: Type,
                         ret_def: bool) -> FnType {
-    let mut arg_tys = ~[];
+    let mut arg_tys = Vec::new();
 
     let ret_ty;
     if !ret_def {
index 4d2e0eeb4762eee0cf2b0871f3af10bfdf6d7da9..aaa32c2f4c096c84f8f47f857bcd1070af67e0cf 100644 (file)
@@ -84,7 +84,7 @@ fn is_ret_bysret(&self) -> bool {
     }
 }
 
-fn classify_ty(ty: Type) -> ~[RegClass] {
+fn classify_ty(ty: Type) -> Vec<RegClass> {
     fn align(off: uint, ty: Type) -> uint {
         let a = ty_align(ty);
         return (off + a - 1u) / a * a;
@@ -304,7 +304,7 @@ fn llvec_len(cls: &[RegClass]) -> uint {
         return len;
     }
 
-    let mut tys = ~[];
+    let mut tys = Vec::new();
     let mut i = 0u;
     let e = cls.len();
     while i < e {
@@ -352,7 +352,7 @@ fn x86_64_ty(ty: Type,
         }
     }
 
-    let mut arg_tys = ~[];
+    let mut arg_tys = Vec::new();
     for t in atys.iter() {
         let ty = x86_64_ty(*t, |cls| cls.is_pass_byval(), ByValAttribute);
         arg_tys.push(ty);
index 9a780678e4fe50977282ee80c8e5a72ba3b308f8..97b2c0299b23d5a2809a8fca2af6554adf1fe7db 100644 (file)
@@ -218,7 +218,7 @@ fn resolve_default_method_vtables(bcx: &Block,
                 vtables.len() - num_method_vtables;
             vtables.tailn(num_impl_type_parameters).to_owned()
         },
-        None => vec::from_elem(num_method_vtables, @~[])
+        None => vec::from_elem(num_method_vtables, @Vec::new())
     };
 
     let param_vtables = @(*trait_vtables_fixed + method_vtables);
@@ -640,7 +640,7 @@ pub fn trans_call_inner<'a>(
     // written in opt_llretslot (if it is Some) or `llresult` will be
     // set appropriately (otherwise).
     if is_rust_fn {
-        let mut llargs = ~[];
+        let mut llargs = Vec::new();
 
         // Push the out-pointer if we use an out-pointer for this
         // return type, otherwise push "undef".
@@ -666,7 +666,7 @@ pub fn trans_call_inner<'a>(
         // available, so we have to apply any attributes with ABI
         // implications directly to the call instruction. Right now,
         // the only attribute we need to worry about is `sret`.
-        let mut attrs = ~[];
+        let mut attrs = Vec::new();
         if type_of::return_uses_outptr(ccx, ret_ty) {
             attrs.push((1, StructRetAttribute));
         }
@@ -704,7 +704,7 @@ pub fn trans_call_inner<'a>(
         // they are always Rust fns.
         assert!(dest.is_some());
 
-        let mut llargs = ~[];
+        let mut llargs = Vec::new();
         bcx = trans_args(bcx, args, callee_ty, &mut llargs,
                          cleanup::CustomScope(arg_cleanup_scope), false);
         fcx.pop_custom_cleanup_scope(arg_cleanup_scope);
@@ -746,7 +746,7 @@ pub enum CallArgs<'a> {
 fn trans_args<'a>(cx: &'a Block<'a>,
                   args: CallArgs,
                   fn_ty: ty::t,
-                  llargs: &mut ~[ValueRef],
+                  llargs: &mut Vec<ValueRef> ,
                   arg_cleanup_scope: cleanup::ScopeId,
                   ignore_self: bool)
                   -> &'a Block<'a> {
index aabe19deefccc6743a213dfd90dd6d387d3d284a..80cfe2f56905345a60affd6e5f326548d4e448d5 100644 (file)
@@ -152,7 +152,7 @@ pub fn mk_closure_tys(tcx: ty::ctxt,
 
 fn tuplify_box_ty(tcx: ty::ctxt, t: ty::t) -> ty::t {
     let ptr = ty::mk_imm_ptr(tcx, ty::mk_i8());
-    ty::mk_tup(tcx, ~[ty::mk_uint(), ty::mk_nil_ptr(tcx), ptr, ptr, t])
+    ty::mk_tup(tcx, vec!(ty::mk_uint(), ty::mk_nil_ptr(tcx), ptr, ptr, t))
 }
 
 fn allocate_cbox<'a>(bcx: &'a Block<'a>,
@@ -191,7 +191,7 @@ pub struct ClosureResult<'a> {
 // Otherwise, it is stack allocated and copies pointers to the upvars.
 pub fn store_environment<'a>(
                          bcx: &'a Block<'a>,
-                         bound_values: ~[EnvValue],
+                         bound_values: Vec<EnvValue> ,
                          sigil: ast::Sigil)
                          -> ClosureResult<'a> {
     let _icx = push_ctxt("closure::store_environment");
@@ -258,7 +258,7 @@ fn build_closure<'a>(bcx0: &'a Block<'a>,
     let bcx = bcx0;
 
     // Package up the captured upvars
-    let mut env_vals = ~[];
+    let mut env_vals = Vec::new();
     for cap_var in cap_vars.iter() {
         debug!("Building closure: captured variable {:?}", *cap_var);
         let datum = expr::trans_local_var(bcx, cap_var.def);
@@ -471,7 +471,7 @@ pub fn get_wrapper_for_bare_fn(ccx: @CrateContext,
     let bcx = fcx.entry_bcx.get().unwrap();
 
     let args = create_datums_for_fn_args(&fcx, ty::ty_fn_args(closure_ty));
-    let mut llargs = ~[];
+    let mut llargs = Vec::new();
     match fcx.llretptr.get() {
         Some(llretptr) => {
             llargs.push(llretptr);
index 90f3765183388e38aad760859ae0fb439184abfd..957b31553a2073d9ce45ced05bec9d032e1d3f40 100644 (file)
@@ -161,7 +161,7 @@ pub struct Stats {
     n_llvm_insns: Cell<uint>,
     llvm_insns: RefCell<HashMap<~str, uint>>,
     // (ident, time-in-ms, llvm-instructions)
-    fn_stats: RefCell<~[(~str, uint, uint)]>,
+    fn_stats: RefCell<Vec<(~str, uint, uint)> >,
 }
 
 pub struct BuilderRef_res {
@@ -187,7 +187,7 @@ pub fn BuilderRef_res(b: BuilderRef) -> BuilderRef_res {
 // Here `self_ty` is the real type of the self parameter to this method. It
 // will only be set in the case of default methods.
 pub struct param_substs {
-    tys: ~[ty::t],
+    tys: Vec<ty::t> ,
     self_ty: Option<ty::t>,
     vtables: Option<typeck::vtable_res>,
     self_vtables: Option<typeck::vtable_param_res>
@@ -285,7 +285,7 @@ pub struct FunctionContext<'a> {
     debug_context: debuginfo::FunctionDebugContext,
 
     // Cleanup scopes.
-    scopes: RefCell<~[cleanup::CleanupScope<'a>]>,
+    scopes: RefCell<Vec<cleanup::CleanupScope<'a>> >,
 }
 
 impl<'a> FunctionContext<'a> {
@@ -639,7 +639,7 @@ pub fn C_binary_slice(cx: &CrateContext, data: &[u8]) -> ValueRef {
 pub fn C_zero_byte_arr(size: uint) -> ValueRef {
     unsafe {
         let mut i = 0u;
-        let mut elts: ~[ValueRef] = ~[];
+        let mut elts: Vec<ValueRef> = Vec::new();
         while i < size { elts.push(C_u8(0u)); i += 1u; }
         return llvm::LLVMConstArray(Type::i8().to_ref(),
                                     elts.as_ptr(), elts.len() as c_uint);
@@ -725,7 +725,7 @@ pub fn is_null(val: ValueRef) -> bool {
 // Used to identify cached monomorphized functions and vtables
 #[deriving(Eq, Hash)]
 pub enum mono_param_id {
-    mono_precise(ty::t, Option<@~[mono_id]>),
+    mono_precise(ty::t, Option<@Vec<mono_id> >),
     mono_any,
     mono_repr(uint /* size */,
               uint /* align */,
@@ -758,8 +758,7 @@ pub fn mono_data_classify(t: ty::t) -> MonoDataClass {
 #[deriving(Eq, Hash)]
 pub struct mono_id_ {
     def: ast::DefId,
-    params: ~[mono_param_id]
-}
+    params: Vec<mono_param_id> }
 
 pub type mono_id = @mono_id_;
 
@@ -808,7 +807,7 @@ pub fn expr_ty_adjusted(bcx: &Block, ex: &ast::Expr) -> ty::t {
     monomorphize_type(bcx, t)
 }
 
-pub fn node_id_type_params(bcx: &Block, id: ast::NodeId, is_method: bool) -> ~[ty::t] {
+pub fn node_id_type_params(bcx: &Block, id: ast::NodeId, is_method: bool) -> Vec<ty::t> {
     let tcx = bcx.tcx();
     let params = if is_method {
         bcx.ccx().maps.method_map.borrow().get().get(&id).substs.tps.clone()
@@ -925,7 +924,7 @@ pub fn find_vtable(tcx: ty::ctxt,
     param_bounds[n_bound].clone()
 }
 
-pub fn dummy_substs(tps: ~[ty::t]) -> ty::substs {
+pub fn dummy_substs(tps: Vec<ty::t> ) -> ty::substs {
     substs {
         regions: ty::ErasedRegions,
         self_ty: None,
index 55d44e00bae462eafd8ab6baab859c59c4e6f727..62723c1c4deb4f99d0e3ec5790aa8e9b3cd58981 100644 (file)
@@ -302,8 +302,9 @@ fn const_expr_unadjusted(cx: @CrateContext, e: &ast::Expr,
                          is_local: bool) -> (ValueRef, bool) {
     let map_list = |exprs: &[@ast::Expr]| {
         exprs.iter().map(|&e| const_expr(cx, e, is_local))
-             .fold((~[], true), |(l, all_inlineable), (val, inlineable)| {
-                (vec::append_one(l, val), all_inlineable && inlineable)
+             .fold((Vec::new(), true),
+                   |(L, all_inlineable), (val, inlineable)| {
+                (vec::append_one(L, val), all_inlineable && inlineable)
              })
     };
     unsafe {
index 652336ecc000b4c889ebb767a8e2cba9d048c61d..db6bca095b5993935e9171883a5e2778150a11e0 100644 (file)
@@ -226,7 +226,7 @@ pub fn new(sess: session::Session,
                    n_closures: Cell::new(0u),
                    n_llvm_insns: Cell::new(0u),
                    llvm_insns: RefCell::new(HashMap::new()),
-                   fn_stats: RefCell::new(~[]),
+                   fn_stats: RefCell::new(Vec::new()),
                  },
                  tydesc_type: tydesc_type,
                  int_type: int_type,
@@ -250,7 +250,7 @@ pub fn const_inbounds_gepi(&self,
                                indices: &[uint]) -> ValueRef {
         debug!("const_inbounds_gepi: pointer={} indices={:?}",
                self.tn.val_to_str(pointer), indices);
-        let v: ~[ValueRef] =
+        let v: Vec<ValueRef> =
             indices.iter().map(|i| C_i32(*i as i32)).collect();
         unsafe {
             llvm::LLVMConstInBoundsGEP(pointer,
index 215f36a776d2f37969fd8d9f6bdf34e0824f95d2..4def17bbea0040ada1917804ba4d2cdfc22fe08f 100644 (file)
@@ -341,7 +341,7 @@ pub fn trans_fail<'a>(
     let v_line = loc.line as int;
     let v_str = PointerCast(bcx, v_fail_str, Type::i8p());
     let v_filename = PointerCast(bcx, v_filename, Type::i8p());
-    let args = ~[v_str, v_filename, C_int(ccx, v_line)];
+    let args = vec!(v_str, v_filename, C_int(ccx, v_line));
     let did = langcall(bcx, Some(sp), "", FailFnLangItem);
     let bcx = callee::trans_lang_call(bcx, did, args, Some(expr::Ignore)).bcx;
     Unreachable(bcx);
@@ -356,7 +356,7 @@ pub fn trans_fail_bounds_check<'a>(
                                -> &'a Block<'a> {
     let _icx = push_ctxt("trans_fail_bounds_check");
     let (filename, line) = filename_and_line_num_from_span(bcx, sp);
-    let args = ~[filename, line, index, len];
+    let args = vec!(filename, line, index, len);
     let did = langcall(bcx, Some(sp), "", FailBoundsCheckFnLangItem);
     let bcx = callee::trans_lang_call(bcx, did, args, Some(expr::Ignore)).bcx;
     Unreachable(bcx);
index e88319e6d6773fadd3855a053a755ab887a43312..76199e50ffa003ff291409208ac0f8fab08a8a9d 100644 (file)
@@ -177,7 +177,7 @@ pub struct CrateDebugContext {
     priv current_debug_location: Cell<DebugLocation>,
     priv created_files: RefCell<HashMap<~str, DIFile>>,
     priv created_types: RefCell<HashMap<uint, DIType>>,
-    priv namespace_map: RefCell<HashMap<~[ast::Name], @NamespaceTreeNode>>,
+    priv namespace_map: RefCell<HashMap<Vec<ast::Name> , @NamespaceTreeNode>>,
     // This collection is used to assert that composite types (structs, enums, ...) have their
     // members only set once:
     priv composite_types_completed: RefCell<HashSet<DIType>>,
@@ -771,7 +771,7 @@ fn get_template_parameters(cx: &CrateContext,
         name_to_append_suffix_to.push_char('<');
 
         // The list to be filled with template parameters:
-        let mut template_params: ~[DIDescriptor] = vec::with_capacity(generics.ty_params.len() + 1);
+        let mut template_params: Vec<DIDescriptor> = vec::with_capacity(generics.ty_params.len() + 1);
 
         // Handle self type
         if has_self_type {
@@ -1136,7 +1136,7 @@ enum MemberDescriptionFactory {
 
 impl MemberDescriptionFactory {
     fn create_member_descriptions(&self, cx: &CrateContext)
-                                  -> ~[MemberDescription] {
+                                  -> Vec<MemberDescription> {
         match *self {
             StructMD(ref this) => {
                 this.create_member_descriptions(cx)
@@ -1155,13 +1155,13 @@ fn create_member_descriptions(&self, cx: &CrateContext)
 }
 
 struct StructMemberDescriptionFactory {
-    fields: ~[ty::field],
+    fields: Vec<ty::field> ,
     span: Span,
 }
 
 impl StructMemberDescriptionFactory {
     fn create_member_descriptions(&self, cx: &CrateContext)
-                                  -> ~[MemberDescription] {
+                                  -> Vec<MemberDescription> {
         self.fields.map(|field| {
             let name = if field.ident.name == special_idents::unnamed_field.name {
                 ~""
@@ -1260,13 +1260,13 @@ fn finalize(&self, cx: &CrateContext) -> DICompositeType {
 }
 
 struct TupleMemberDescriptionFactory {
-    component_types: ~[ty::t],
+    component_types: Vec<ty::t> ,
     span: Span,
 }
 
 impl TupleMemberDescriptionFactory {
     fn create_member_descriptions(&self, cx: &CrateContext)
-                                  -> ~[MemberDescription] {
+                                  -> Vec<MemberDescription> {
         self.component_types.map(|&component_type| {
             MemberDescription {
                 name: ~"",
@@ -1308,7 +1308,7 @@ fn prepare_tuple_metadata(cx: &CrateContext,
 
 struct GeneralMemberDescriptionFactory {
     type_rep: @adt::Repr,
-    variants: @~[@ty::VariantInfo],
+    variants: @Vec<@ty::VariantInfo> ,
     discriminant_type_metadata: ValueRef,
     containing_scope: DIScope,
     file_metadata: DIFile,
@@ -1317,7 +1317,7 @@ struct GeneralMemberDescriptionFactory {
 
 impl GeneralMemberDescriptionFactory {
     fn create_member_descriptions(&self, cx: &CrateContext)
-                                  -> ~[MemberDescription] {
+                                  -> Vec<MemberDescription> {
         // Capture type_rep, so we don't have to copy the struct_defs array
         let struct_defs = match *self.type_rep {
             adt::General(_, ref struct_defs) => struct_defs,
@@ -1357,14 +1357,14 @@ fn create_member_descriptions(&self, cx: &CrateContext)
 }
 
 struct EnumVariantMemberDescriptionFactory {
-    args: ~[(~str, ty::t)],
+    args: Vec<(~str, ty::t)> ,
     discriminant_type_metadata: Option<DIType>,
     span: Span,
 }
 
 impl EnumVariantMemberDescriptionFactory {
     fn create_member_descriptions(&self, cx: &CrateContext)
-                                  -> ~[MemberDescription] {
+                                  -> Vec<MemberDescription> {
         self.args.iter().enumerate().map(|(i, &(ref name, ty))| {
             MemberDescription {
                 name: name.to_str(),
@@ -1420,7 +1420,7 @@ fn describe_enum_variant(cx: &CrateContext,
     }
 
     // Build an array of (field name, field type) pairs to be captured in the factory closure.
-    let args: ~[(~str, ty::t)] = arg_names.iter()
+    let args: Vec<(~str, ty::t)> = arg_names.iter()
         .zip(struct_def.fields.iter())
         .map(|(s, &t)| (s.to_str(), t))
         .collect();
@@ -1462,7 +1462,7 @@ fn prepare_enum_metadata(cx: &CrateContext,
 
     let variants = ty::enum_variants(cx.tcx, enum_def_id);
 
-    let enumerators_metadata: ~[DIDescriptor] = variants
+    let enumerators_metadata: Vec<DIDescriptor> = variants
         .iter()
         .map(|v| {
             token::get_ident(v.name).get().with_c_str(|name| {
@@ -1650,7 +1650,7 @@ fn set_members_of_composite_type(cx: &CrateContext,
 
     let loc = span_start(cx, definition_span);
 
-    let member_metadata: ~[DIDescriptor] = member_descriptions
+    let member_metadata: Vec<DIDescriptor> = member_descriptions
         .iter()
         .enumerate()
         .map(|(i, member_description)| {
@@ -1954,7 +1954,7 @@ fn subroutine_type_metadata(cx: &CrateContext,
     let loc = span_start(cx, span);
     let file_metadata = file_metadata(cx, loc.file.name);
 
-    let mut signature_metadata: ~[DIType] = vec::with_capacity(signature.inputs.len() + 1);
+    let mut signature_metadata: Vec<DIType> = vec::with_capacity(signature.inputs.len() + 1);
 
     // return type
     signature_metadata.push(match ty::get(signature.output).sty {
@@ -2265,7 +2265,7 @@ struct ScopeStackEntry {
         ident: Option<ast::Ident>
     }
 
-    let mut scope_stack = ~[ScopeStackEntry { scope_metadata: fn_metadata, ident: None }];
+    let mut scope_stack = vec!(ScopeStackEntry { scope_metadata: fn_metadata, ident: None });
 
     // Push argument identifiers onto the stack so arguments integrate nicely with variable
     // shadowing.
@@ -2288,10 +2288,10 @@ struct ScopeStackEntry {
     // local helper functions for walking the AST.
     fn with_new_scope(cx: &CrateContext,
                       scope_span: Span,
-                      scope_stack: &mut ~[ScopeStackEntry],
+                      scope_stack: &mut Vec<ScopeStackEntry> ,
                       scope_map: &mut HashMap<ast::NodeId, DIScope>,
                       inner_walk: |&CrateContext,
-                                   &mut ~[ScopeStackEntry],
+                                   &mut Vec<ScopeStackEntry> ,
                                    &mut HashMap<ast::NodeId, DIScope>|) {
         // Create a new lexical scope and push it onto the stack
         let loc = cx.sess.codemap.lookup_char_pos(scope_span.lo);
@@ -2325,7 +2325,7 @@ fn with_new_scope(cx: &CrateContext,
 
     fn walk_block(cx: &CrateContext,
                   block: &ast::Block,
-                  scope_stack: &mut ~[ScopeStackEntry],
+                  scope_stack: &mut Vec<ScopeStackEntry> ,
                   scope_map: &mut HashMap<ast::NodeId, DIScope>) {
         scope_map.insert(block.id, scope_stack.last().unwrap().scope_metadata);
 
@@ -2349,7 +2349,7 @@ fn walk_block(cx: &CrateContext,
 
     fn walk_decl(cx: &CrateContext,
                  decl: &ast::Decl,
-                 scope_stack: &mut ~[ScopeStackEntry],
+                 scope_stack: &mut Vec<ScopeStackEntry> ,
                  scope_map: &mut HashMap<ast::NodeId, DIScope>) {
         match *decl {
             codemap::Spanned { node: ast::DeclLocal(local), .. } => {
@@ -2367,7 +2367,7 @@ fn walk_decl(cx: &CrateContext,
 
     fn walk_pattern(cx: &CrateContext,
                     pat: @ast::Pat,
-                    scope_stack: &mut ~[ScopeStackEntry],
+                    scope_stack: &mut Vec<ScopeStackEntry> ,
                     scope_map: &mut HashMap<ast::NodeId, DIScope>) {
 
         let def_map = cx.tcx.def_map;
@@ -2512,7 +2512,7 @@ fn walk_pattern(cx: &CrateContext,
 
     fn walk_expr(cx: &CrateContext,
                  exp: &ast::Expr,
-                 scope_stack: &mut ~[ScopeStackEntry],
+                 scope_stack: &mut Vec<ScopeStackEntry> ,
                  scope_map: &mut HashMap<ast::NodeId, DIScope>) {
 
         scope_map.insert(exp.id, scope_stack.last().unwrap().scope_metadata);
@@ -2741,7 +2741,7 @@ fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> @NamespaceTreeNo
         };
         let mut path = krate.move_iter().chain(path).peekable();
 
-        let mut current_key = ~[];
+        let mut current_key = Vec::new();
         let mut parent_node: Option<@NamespaceTreeNode> = None;
 
         // Create/Lookup namespace for each element of the path.
index db9f3ed5a8157bf24076c991a64be529995282d1..9dae8f435ec91453967105cdfd2325df5970ad74 100644 (file)
@@ -741,7 +741,7 @@ fn trans_rvalue_dps_unadjusted<'a>(bcx: &'a Block<'a>,
         }
         ast::ExprTup(ref args) => {
             let repr = adt::represent_type(bcx.ccx(), expr_ty(bcx, expr));
-            let numbered_fields: ~[(uint, @ast::Expr)] =
+            let numbered_fields: Vec<(uint, @ast::Expr)> =
                 args.iter().enumerate().map(|(i, arg)| (i, *arg)).collect();
             trans_adt(bcx, repr, 0, numbered_fields, None, dest)
         }
@@ -1047,7 +1047,7 @@ fn trans_rec_or_struct<'a>(
         });
         let optbase = match base {
             Some(base_expr) => {
-                let mut leftovers = ~[];
+                let mut leftovers = Vec::new();
                 for (i, b) in need_base.iter().enumerate() {
                     if *b {
                         leftovers.push((i, field_tys[i].mt.ty))
@@ -1081,8 +1081,7 @@ struct StructBaseInfo {
     /// The base expression; will be evaluated after all explicit fields.
     expr: @ast::Expr,
     /// The indices of fields to copy paired with their types.
-    fields: ~[(uint, ty::t)]
-}
+    fields: Vec<(uint, ty::t)> }
 
 /**
  * Constructs an ADT instance:
@@ -1709,7 +1708,7 @@ fn trans_log_level<'a>(bcx: &'a Block<'a>) -> DatumBlock<'a, Expr> {
                     _ => false
                 }
             });
-            let modpath: ~[ast_map::PathElem] = path.collect();
+            let modpath: Vec<ast_map::PathElem> = path.collect();
             let modname = ast_map::path_to_str(ast_map::Values(modpath.iter()));
             (modpath, modname)
         })
index f836a1312c5cca4b7136987c289ccea619e1497a..1c794728c1ef31aa50a4462ad8137568cb74ab00 100644 (file)
@@ -56,7 +56,7 @@ struct ForeignTypes {
 
 struct LlvmSignature {
     // LLVM versions of the types of this function's arguments.
-    llarg_tys: ~[Type],
+    llarg_tys: Vec<Type> ,
 
     // LLVM version of the type that this function returns.  Note that
     // this *may not be* the declared return type of the foreign
@@ -163,7 +163,7 @@ pub fn trans_native_call<'a>(
                          llfn: ValueRef,
                          llretptr: ValueRef,
                          llargs_rust: &[ValueRef],
-                         passed_arg_tys: ~[ty::t])
+                         passed_arg_tys: Vec<ty::t> )
                          -> &'a Block<'a> {
     /*!
      * Prepares a call to a native function. This requires adapting
@@ -205,7 +205,7 @@ pub fn trans_native_call<'a>(
 
     let arg_tys: &[cabi::ArgType] = fn_type.arg_tys;
 
-    let mut llargs_foreign = ~[];
+    let mut llargs_foreign = Vec::new();
 
     // If the foreign ABI expects return value by pointer, supply the
     // pointer that Rust gave us. Sometimes we have to bitcast
@@ -503,7 +503,7 @@ unsafe fn build_wrap_fn(ccx: @CrateContext,
         llvm::LLVMPositionBuilderAtEnd(builder, the_block);
 
         // Array for the arguments we will pass to the rust function.
-        let mut llrust_args = ~[];
+        let mut llrust_args = Vec::new();
         let mut next_foreign_arg_counter: c_uint = 0;
         let next_foreign_arg: |pad: bool| -> c_uint = |pad: bool| {
             next_foreign_arg_counter += if pad {
@@ -777,7 +777,7 @@ fn foreign_types_for_fn_ty(ccx: &CrateContext,
 }
 
 fn lltype_for_fn_from_foreign_types(tys: &ForeignTypes) -> Type {
-    let mut llargument_tys = ~[];
+    let mut llargument_tys = Vec::new();
 
     let ret_ty = tys.fn_ty.ret_ty;
     let llreturn_ty = if ret_ty.is_indirect() {
index 25d49bd789d871d5aed7f0bb4c914ff437421d45..c48882f3f528e5949f016aa3895c4faf4b259863 100644 (file)
@@ -263,7 +263,7 @@ fn trans_struct_drop<'a>(bcx: &'a Block<'a>,
     let field_scope = bcx.fcx.push_custom_cleanup_scope();
 
     let self_arg = PointerCast(bcx, v0, params[0]);
-    let args = ~[self_arg];
+    let args = vec!(self_arg);
 
     // Add all the fields as a value which needs to be cleaned at the end of
     // this scope.
index 8871f0bf61fb2d85a90bb7efbfdc6f5e27d7f4c1..7bd415b9d54d89ab8c6d3392732ee84591660666 100644 (file)
@@ -207,7 +207,7 @@ fn count_zeros_intrinsic(bcx: &Block, name: &'static str) {
     // This requires that atomic intrinsics follow a specific naming pattern:
     // "atomic_<operation>[_<ordering>], and no ordering means SeqCst
     if name.get().starts_with("atomic_") {
-        let split: ~[&str] = name.get().split('_').collect();
+        let split: Vec<&str> = name.get().split('_').collect();
         assert!(split.len() >= 2, "Atomic intrinsic not correct format");
         let order = if split.len() == 2 {
             lib::llvm::SequentiallyConsistent
index a9473d9f4801996e8b7e4fc17cb7d7b66e3a6dab..16fa8e12f419004dc91b6a3f09715158059c02f3 100644 (file)
@@ -292,7 +292,7 @@ fn combine_impl_and_methods_tps(bcx: &Block,
                                 is_method: bool,
                                 rcvr_substs: &[ty::t],
                                 rcvr_origins: typeck::vtable_res)
-                                -> (~[ty::t], typeck::vtable_res) {
+                                -> (Vec<ty::t> , typeck::vtable_res) {
     /*!
     *
     * Creates a concatenated set of substitutions which includes
@@ -316,7 +316,7 @@ fn combine_impl_and_methods_tps(bcx: &Block,
     let node_substs = node_id_type_params(bcx, expr_id, is_method);
     debug!("rcvr_substs={:?}", rcvr_substs.repr(ccx.tcx));
     let ty_substs
-        = vec::append(rcvr_substs.to_owned(),
+        = vec_ng::append(rcvr_substs.to_owned(),
                       node_substs.tailn(node_substs.len() - n_m_tps));
     debug!("n_m_tps={:?}", n_m_tps);
     debug!("node_substs={:?}", node_substs.repr(ccx.tcx));
@@ -327,10 +327,10 @@ fn combine_impl_and_methods_tps(bcx: &Block,
     // exist, in which case we need to make them.
     let r_m_origins = match node_vtables(bcx, expr_id) {
         Some(vt) => vt,
-        None => @vec::from_elem(node_substs.len(), @~[])
+        None => @vec::from_elem(node_substs.len(), @Vec::new())
     };
     let vtables
-        = @vec::append(rcvr_origins.to_owned(),
+        = @vec_ng::append(rcvr_origins.to_owned(),
                        r_m_origins.tailn(r_m_origins.len() - n_m_tps));
 
     (ty_substs, vtables)
@@ -496,7 +496,7 @@ pub fn make_vtable(ccx: &CrateContext,
     unsafe {
         let _icx = push_ctxt("meth::make_vtable");
 
-        let mut components = ~[drop_glue];
+        let mut components = vec!(drop_glue);
         for &ptr in ptrs.iter() {
             components.push(ptr)
         }
@@ -517,7 +517,7 @@ fn emit_vtable_methods(bcx: &Block,
                        impl_id: ast::DefId,
                        substs: &[ty::t],
                        vtables: typeck::vtable_res)
-                       -> ~[ValueRef] {
+                       -> Vec<ValueRef> {
     let ccx = bcx.ccx();
     let tcx = ccx.tcx;
 
index c76d1cbcd20a4a9c97752862420eae64c99fcc52..e5774a5cd6e247a83156b7b3f72f37a54cae82c2 100644 (file)
@@ -299,7 +299,7 @@ pub fn make_mono_id(ccx: @CrateContext,
     // FIXME (possibly #5801): Need a lot of type hints to get
     // .collect() to work.
     let substs_iter = substs.self_ty.iter().chain(substs.tys.iter());
-    let precise_param_ids: ~[(ty::t, Option<@~[mono_id]>)] = match substs.vtables {
+    let precise_param_ids: Vec<(ty::t, Option<@Vec<mono_id> >)> = match substs.vtables {
       Some(vts) => {
         debug!("make_mono_id vtables={} substs={}",
                vts.repr(ccx.tcx), substs.tys.repr(ccx.tcx));
@@ -309,7 +309,7 @@ pub fn make_mono_id(ccx: @CrateContext,
             (*subst, if !v.is_empty() { Some(@v) } else { None })
         }).collect()
       }
-      None => substs_iter.map(|subst| (*subst, None::<@~[mono_id]>)).collect()
+      None => substs_iter.map(|subst| (*subst, None::<@Vec<mono_id> >)).collect()
     };
 
 
index bb31ed0aef85f44d8cd13a88218cd370b9336914..000094245450d128cba84ca5f4f4a66c1583b5c5 100644 (file)
@@ -37,7 +37,7 @@
 
 pub struct Reflector<'a> {
     visitor_val: ValueRef,
-    visitor_methods: @~[@ty::Method],
+    visitor_methods: @Vec<@ty::Method> ,
     final_bcx: &'a Block<'a>,
     tydesc_ty: Type,
     bcx: &'a Block<'a>
@@ -70,12 +70,12 @@ pub fn c_slice(&mut self, s: InternedString) -> ValueRef {
         scratch.val
     }
 
-    pub fn c_size_and_align(&mut self, t: ty::t) -> ~[ValueRef] {
+    pub fn c_size_and_align(&mut self, t: ty::t) -> Vec<ValueRef> {
         let tr = type_of(self.bcx.ccx(), t);
         let s = machine::llsize_of_real(self.bcx.ccx(), tr);
         let a = machine::llalign_of_min(self.bcx.ccx(), tr);
-        return ~[self.c_uint(s as uint),
-             self.c_uint(a as uint)];
+        return vec!(self.c_uint(s as uint),
+             self.c_uint(a as uint));
     }
 
     pub fn c_tydesc(&mut self, t: ty::t) -> ValueRef {
@@ -85,9 +85,9 @@ pub fn c_tydesc(&mut self, t: ty::t) -> ValueRef {
         PointerCast(bcx, static_ti.tydesc, self.tydesc_ty.ptr_to())
     }
 
-    pub fn c_mt(&mut self, mt: &ty::mt) -> ~[ValueRef] {
-        ~[self.c_uint(mt.mutbl as uint),
-          self.c_tydesc(mt.ty)]
+    pub fn c_mt(&mut self, mt: &ty::mt) -> Vec<ValueRef> {
+        vec!(self.c_uint(mt.mutbl as uint),
+          self.c_tydesc(mt.ty))
     }
 
     pub fn visit(&mut self, ty_name: &str, args: &[ValueRef]) {
@@ -130,15 +130,15 @@ pub fn bracketed(&mut self,
     pub fn vstore_name_and_extra(&mut self,
                                  t: ty::t,
                                  vstore: ty::vstore)
-                                 -> (~str, ~[ValueRef]) {
+                                 -> (~str, Vec<ValueRef> ) {
         match vstore {
             ty::vstore_fixed(n) => {
-                let extra = vec::append(~[self.c_uint(n)],
+                let extra = vec_ng::append(vec!(self.c_uint(n)),
                                         self.c_size_and_align(t));
                 (~"fixed", extra)
             }
-            ty::vstore_slice(_) => (~"slice", ~[]),
-            ty::vstore_uniq => (~"uniq", ~[]),
+            ty::vstore_slice(_) => (~"slice", Vec::new()),
+            ty::vstore_uniq => (~"uniq", Vec::new()),
         }
     }
 
@@ -210,11 +210,11 @@ pub fn visit_ty(&mut self, t: ty::t) {
           }
 
           ty::ty_tup(ref tys) => {
-              let extra = ~[self.c_uint(tys.len())]
+              let extra = vec!(self.c_uint(tys.len()))
                   + self.c_size_and_align(t);
               self.bracketed("tup", extra, |this| {
                   for (i, t) in tys.iter().enumerate() {
-                      let extra = ~[this.c_uint(i), this.c_tydesc(*t)];
+                      let extra = vec!(this.c_uint(i), this.c_tydesc(*t));
                       this.visit("tup_field", extra);
                   }
               })
@@ -226,10 +226,10 @@ pub fn visit_ty(&mut self, t: ty::t) {
             let pureval = ast_purity_constant(fty.purity);
             let sigilval = ast_sigil_constant(fty.sigil);
             let retval = if ty::type_is_bot(fty.sig.output) {0u} else {1u};
-            let extra = ~[self.c_uint(pureval),
+            let extra = vec!(self.c_uint(pureval),
                           self.c_uint(sigilval),
                           self.c_uint(fty.sig.inputs.len()),
-                          self.c_uint(retval)];
+                          self.c_uint(retval));
             self.visit("enter_fn", extra);
             self.visit_sig(retval, &fty.sig);
             self.visit("leave_fn", extra);
@@ -241,10 +241,10 @@ pub fn visit_ty(&mut self, t: ty::t) {
             let pureval = ast_purity_constant(fty.purity);
             let sigilval = 0u;
             let retval = if ty::type_is_bot(fty.sig.output) {0u} else {1u};
-            let extra = ~[self.c_uint(pureval),
+            let extra = vec!(self.c_uint(pureval),
                           self.c_uint(sigilval),
                           self.c_uint(fty.sig.inputs.len()),
-                          self.c_uint(retval)];
+                          self.c_uint(retval));
             self.visit("enter_fn", extra);
             self.visit_sig(retval, &fty.sig);
             self.visit("leave_fn", extra);
@@ -258,19 +258,19 @@ pub fn visit_ty(&mut self, t: ty::t) {
                         fields[0].ident.name != special_idents::unnamed_field.name;
               }
 
-              let extra = ~[
+              let extra = vec!(
                   self.c_slice(token::intern_and_get_ident(ty_to_str(tcx,
                                                                      t))),
                   self.c_bool(named_fields),
                   self.c_uint(fields.len())
-              ] + self.c_size_and_align(t);
+              ) + self.c_size_and_align(t);
               self.bracketed("class", extra, |this| {
                   for (i, field) in fields.iter().enumerate() {
-                      let extra = ~[
+                      let extra = vec!(
                         this.c_uint(i),
                         this.c_slice(token::get_ident(field.ident)),
                         this.c_bool(named_fields)
-                      ] + this.c_mt(&field.mt);
+                      ) + this.c_mt(&field.mt);
                       this.visit("class_field", extra);
                   }
               })
@@ -319,24 +319,24 @@ pub fn visit_ty(&mut self, t: ty::t) {
                 llfdecl
             };
 
-            let enum_args = ~[self.c_uint(variants.len()), make_get_disr()]
+            let enum_args = vec!(self.c_uint(variants.len()), make_get_disr())
                 + self.c_size_and_align(t);
             self.bracketed("enum", enum_args, |this| {
                 for (i, v) in variants.iter().enumerate() {
                     let name = token::get_ident(v.name);
-                    let variant_args = ~[this.c_uint(i),
+                    let variant_args = vec!(this.c_uint(i),
                                          C_u64(v.disr_val),
                                          this.c_uint(v.args.len()),
-                                         this.c_slice(name)];
+                                         this.c_slice(name));
                     this.bracketed("enum_variant", variant_args, |this| {
                         for (j, a) in v.args.iter().enumerate() {
                             let bcx = this.bcx;
                             let null = C_null(llptrty);
                             let ptr = adt::trans_field_ptr(bcx, repr, null, v.disr_val, j);
                             let offset = p2i(ccx, ptr);
-                            let field_args = ~[this.c_uint(j),
+                            let field_args = vec!(this.c_uint(j),
                                                offset,
-                                               this.c_tydesc(*a)];
+                                               this.c_tydesc(*a));
                             this.visit("enum_variant_field", field_args);
                         }
                     })
@@ -355,7 +355,7 @@ pub fn visit_ty(&mut self, t: ty::t) {
           ty::ty_infer(_) => self.leaf("infer"),
           ty::ty_err => self.leaf("err"),
           ty::ty_param(ref p) => {
-              let extra = ~[self.c_uint(p.idx)];
+              let extra = vec!(self.c_uint(p.idx));
               self.visit("param", extra)
           }
           ty::ty_self(..) => self.leaf("self")
@@ -365,14 +365,14 @@ pub fn visit_ty(&mut self, t: ty::t) {
     pub fn visit_sig(&mut self, retval: uint, sig: &ty::FnSig) {
         for (i, arg) in sig.inputs.iter().enumerate() {
             let modeval = 5u;   // "by copy"
-            let extra = ~[self.c_uint(i),
+            let extra = vec!(self.c_uint(i),
                          self.c_uint(modeval),
-                         self.c_tydesc(*arg)];
+                         self.c_tydesc(*arg));
             self.visit("fn_input", extra);
         }
-        let extra = ~[self.c_uint(retval),
+        let extra = vec!(self.c_uint(retval),
                       self.c_bool(sig.variadic),
-                      self.c_tydesc(sig.output)];
+                      self.c_tydesc(sig.output));
         self.visit("fn_output", extra);
     }
 }
index 61d00ed2eda535ca1d9bd6e6def799039392db3f..03114ca2842e8c3f975d89de58fff1bb6d5f9065 100644 (file)
@@ -295,11 +295,11 @@ pub fn array_length(&self) -> uint {
         }
     }
 
-    pub fn field_types(&self) -> ~[Type] {
+    pub fn field_types(&self) -> Vec<Type> {
         unsafe {
             let n_elts = llvm::LLVMCountStructElementTypes(self.to_ref()) as uint;
             if n_elts == 0 {
-                return ~[];
+                return Vec::new();
             }
             let mut elts = vec::from_elem(n_elts, 0 as TypeRef);
             llvm::LLVMGetStructElementTypes(self.to_ref(), &mut elts[0]);
@@ -311,7 +311,7 @@ pub fn return_type(&self) -> Type {
         ty!(llvm::LLVMGetReturnType(self.to_ref()))
     }
 
-    pub fn func_params(&self) -> ~[Type] {
+    pub fn func_params(&self) -> Vec<Type> {
         unsafe {
             let n_args = llvm::LLVMCountParamTypes(self.to_ref()) as uint;
             let args = vec::from_elem(n_args, 0 as TypeRef);
index 55e237fda5dddbc9363e7055cd9edc08b54fb7ae..36da8be0b5d1b6ebc79de0aa3aae23dc5fec9db8 100644 (file)
@@ -41,7 +41,7 @@ pub fn type_of_explicit_arg(ccx: &CrateContext, arg_ty: ty::t) -> Type {
 
 pub fn type_of_rust_fn(cx: &CrateContext, has_env: bool,
                        inputs: &[ty::t], output: ty::t) -> Type {
-    let mut atys: ~[Type] = ~[];
+    let mut atys: Vec<Type> = Vec::new();
 
     // Arg 0: Output pointer.
     // (if the output type is non-immediate)
index c364e099009fc5bd9cb9b0ce579e9f6b0890abbd..ac1ac8105556e0ba10775f61dd3a039f0c0e1dca 100644 (file)
@@ -122,8 +122,7 @@ pub fn container_id(&self) -> ast::DefId {
 pub struct Impl {
     did: DefId,
     ident: Ident,
-    methods: ~[@Method]
-}
+    methods: Vec<@Method> }
 
 #[deriving(Clone, Eq, Hash)]
 pub struct mt {
@@ -280,16 +279,16 @@ pub struct ctxt_ {
     // of this node.  This only applies to nodes that refer to entities
     // parameterized by type parameters, such as generic fns, types, or
     // other items.
-    node_type_substs: RefCell<NodeMap<~[t]>>,
+    node_type_substs: RefCell<NodeMap<vec!(t)>>,
 
     // Maps from a method to the method "descriptor"
     methods: RefCell<DefIdMap<@Method>>,
 
     // Maps from a trait def-id to a list of the def-ids of its methods
-    trait_method_def_ids: RefCell<DefIdMap<@~[DefId]>>,
+    trait_method_def_ids: RefCell<DefIdMap<@Vec<DefId> >>,
 
     // A cache for the trait_methods() routine
-    trait_methods_cache: RefCell<DefIdMap<@~[@Method]>>,
+    trait_methods_cache: RefCell<DefIdMap<@Vec<@Method> >>,
 
     impl_trait_cache: RefCell<DefIdMap<Option<@ty::TraitRef>>>,
 
@@ -305,14 +304,14 @@ pub struct ctxt_ {
     needs_unwind_cleanup_cache: RefCell<HashMap<t, bool>>,
     tc_cache: RefCell<HashMap<uint, TypeContents>>,
     ast_ty_to_ty_cache: RefCell<NodeMap<ast_ty_to_ty_cache_entry>>,
-    enum_var_cache: RefCell<DefIdMap<@~[@VariantInfo]>>,
+    enum_var_cache: RefCell<DefIdMap<@Vec<@VariantInfo> >>,
     ty_param_defs: RefCell<NodeMap<TypeParameterDef>>,
     adjustments: RefCell<NodeMap<@AutoAdjustment>>,
     normalized_cache: RefCell<HashMap<t, t>>,
     lang_items: @middle::lang_items::LanguageItems,
     // A mapping of fake provided method def_ids to the default implementation
     provided_method_sources: RefCell<DefIdMap<ast::DefId>>,
-    supertraits: RefCell<DefIdMap<@~[@TraitRef]>>,
+    supertraits: RefCell<DefIdMap<@Vec<@TraitRef> >>,
 
     // Maps from def-id of a type or region parameter to its
     // (inferred) variance.
@@ -328,12 +327,12 @@ pub struct ctxt_ {
     destructors: RefCell<DefIdSet>,
 
     // Maps a trait onto a list of impls of that trait.
-    trait_impls: RefCell<DefIdMap<@RefCell<~[@Impl]>>>,
+    trait_impls: RefCell<DefIdMap<@RefCell<Vec<@Impl> >>>,
 
     // Maps a def_id of a type to a list of its inherent impls.
     // Contains implementations of methods that are inherent to a type.
     // Methods in these implementations don't need to be exported.
-    inherent_impls: RefCell<DefIdMap<@RefCell<~[@Impl]>>>,
+    inherent_impls: RefCell<DefIdMap<@RefCell<Vec<@Impl> >>>,
 
     // Maps a def_id of an impl to an Impl structure.
     // Note that this contains all of the impls that we know about,
@@ -461,7 +460,7 @@ pub struct ClosureTy {
 #[deriving(Clone, Eq, Hash)]
 pub struct FnSig {
     binder_id: ast::NodeId,
-    inputs: ~[t],
+    inputs: vec!(t),
     output: t,
     variadic: bool
 }
@@ -684,7 +683,7 @@ pub enum RegionSubsts {
 #[deriving(Clone, Eq, Hash)]
 pub struct substs {
     self_ty: Option<ty::t>,
-    tps: ~[t],
+    tps: vec!(t),
     regions: RegionSubsts,
 }
 
@@ -756,7 +755,7 @@ pub enum sty {
     ty_closure(ClosureTy),
     ty_trait(DefId, substs, TraitStore, ast::Mutability, BuiltinBounds),
     ty_struct(DefId, substs),
-    ty_tup(~[t]),
+    ty_tup(vec!(t)),
 
     ty_param(param_ty), // type parameter
     ty_self(DefId), /* special, implicit `self` type parameter;
@@ -836,8 +835,7 @@ pub enum type_err {
 #[deriving(Eq, Hash)]
 pub struct ParamBounds {
     builtin_bounds: BuiltinBounds,
-    trait_bounds: ~[@TraitRef]
-}
+    trait_bounds: Vec<@TraitRef> }
 
 pub type BuiltinBounds = EnumSet<BuiltinBound>;
 
@@ -1006,10 +1004,10 @@ pub struct RegionParameterDef {
 #[deriving(Clone)]
 pub struct Generics {
     /// List of type parameters declared on the item.
-    type_param_defs: Rc<~[TypeParameterDef]>,
+    type_param_defs: Rc<Vec<TypeParameterDef> >,
 
     /// List of region parameters declared on the item.
-    region_param_defs: Rc<~[RegionParameterDef]>,
+    region_param_defs: Rc<Vec<RegionParameterDef> >,
 }
 
 impl Generics {
@@ -1048,7 +1046,7 @@ pub struct ParameterEnvironment {
     self_param_bound: Option<@TraitRef>,
 
     /// Bounds on each numbered type parameter
-    type_param_bounds: ~[ParamBounds],
+    type_param_bounds: Vec<ParamBounds> ,
 }
 
 /// A polytype.
@@ -1412,7 +1410,7 @@ pub fn mk_mut_unboxed_vec(cx: ctxt, ty: t) -> t {
     mk_t(cx, ty_unboxed_vec(mt {ty: ty, mutbl: ast::MutImmutable}))
 }
 
-pub fn mk_tup(cx: ctxt, ts: ~[t]) -> t { mk_t(cx, ty_tup(ts)) }
+pub fn mk_tup(cx: ctxt, ts: vec!(t)) -> t { mk_t(cx, ty_tup(ts)) }
 
 pub fn mk_closure(cx: ctxt, fty: ClosureTy) -> t {
     mk_t(cx, ty_closure(fty))
@@ -2391,7 +2389,7 @@ pub fn type_moves_by_default(cx: ctxt, ty: t) -> bool {
 
 // True if instantiating an instance of `r_ty` requires an instance of `r_ty`.
 pub fn is_instantiable(cx: ctxt, r_ty: t) -> bool {
-    fn type_requires(cx: ctxt, seen: &mut ~[DefId],
+    fn type_requires(cx: ctxt, seen: &mut Vec<DefId> ,
                      r_ty: t, ty: t) -> bool {
         debug!("type_requires({}, {})?",
                ::util::ppaux::ty_to_str(cx, r_ty),
@@ -2409,7 +2407,7 @@ fn type_requires(cx: ctxt, seen: &mut ~[DefId],
         return r;
     }
 
-    fn subtypes_require(cx: ctxt, seen: &mut ~[DefId],
+    fn subtypes_require(cx: ctxt, seen: &mut Vec<DefId> ,
                         r_ty: t, ty: t) -> bool {
         debug!("subtypes_require({}, {})?",
                ::util::ppaux::ty_to_str(cx, r_ty),
@@ -2497,7 +2495,7 @@ fn subtypes_require(cx: ctxt, seen: &mut ~[DefId],
         return r;
     }
 
-    let mut seen = ~[];
+    let mut seen = Vec::new();
     !subtypes_require(cx, &mut seen, r_ty, r_ty)
 }
 
@@ -2518,7 +2516,7 @@ pub enum Representability {
 pub fn is_type_representable(cx: ctxt, ty: t) -> Representability {
 
     // Iterate until something non-representable is found
-    fn find_nonrepresentable<It: Iterator<t>>(cx: ctxt, seen: &mut ~[DefId],
+    fn find_nonrepresentable<It: Iterator<t>>(cx: ctxt, seen: &mut Vec<DefId> ,
                                               mut iter: It) -> Representability {
         for ty in iter {
             let r = type_structurally_recursive(cx, seen, ty);
@@ -2531,7 +2529,7 @@ fn find_nonrepresentable<It: Iterator<t>>(cx: ctxt, seen: &mut ~[DefId],
 
     // Does the type `ty` directly (without indirection through a pointer)
     // contain any types on stack `seen`?
-    fn type_structurally_recursive(cx: ctxt, seen: &mut ~[DefId],
+    fn type_structurally_recursive(cx: ctxt, seen: &mut Vec<DefId> ,
                                    ty: t) -> Representability {
         debug!("type_structurally_recursive: {}",
                ::util::ppaux::ty_to_str(cx, ty));
@@ -2597,7 +2595,7 @@ fn type_structurally_recursive(cx: ctxt, seen: &mut ~[DefId],
     // To avoid a stack overflow when checking an enum variant or struct that
     // contains a different, structurally recursive type, maintain a stack
     // of seen types and check recursion for each of them (issues #3008, #3779).
-    let mut seen: ~[DefId] = ~[];
+    let mut seen: Vec<DefId> = Vec::new();
     type_structurally_recursive(cx, &mut seen, ty)
 }
 
@@ -2788,10 +2786,10 @@ pub fn node_id_to_type_opt(cx: ctxt, id: ast::NodeId) -> Option<t> {
 }
 
 // FIXME(pcwalton): Makes a copy, bleh. Probably better to not do that.
-pub fn node_id_to_type_params(cx: ctxt, id: ast::NodeId) -> ~[t] {
+pub fn node_id_to_type_params(cx: ctxt, id: ast::NodeId) -> Vec<t> {
     let node_type_substs = cx.node_type_substs.borrow();
     match node_type_substs.get().find(&id) {
-      None => return ~[],
+      None => return Vec::new(),
       Some(ts) => return (*ts).clone(),
     }
 }
@@ -2822,7 +2820,7 @@ pub fn ty_fn_sig(fty: t) -> FnSig {
 }
 
 // Type accessors for substructures of types
-pub fn ty_fn_args(fty: t) -> ~[t] {
+pub fn ty_fn_args(fty: t) -> Vec<t> {
     match get(fty).sty {
         ty_bare_fn(ref f) => f.sig.inputs.clone(),
         ty_closure(ref f) => f.sig.inputs.clone(),
@@ -2925,7 +2923,7 @@ pub fn replace_closure_return_type(tcx: ctxt, fn_type: t, ret_type: t) -> t {
 }
 
 // Returns a vec of all the input and output types of fty.
-pub fn tys_in_fn_sig(sig: &FnSig) -> ~[t] {
+pub fn tys_in_fn_sig(sig: &FnSig) -> Vec<t> {
     vec::append_one(sig.inputs.map(|a| *a), sig.output)
 }
 
@@ -3213,7 +3211,7 @@ pub fn map_region(&self, f: |Region| -> Region) -> AutoRef {
 }
 
 pub struct ParamsTy {
-    params: ~[t],
+    params: vec!(t),
     ty: t
 }
 
@@ -3231,7 +3229,7 @@ pub fn expr_has_ty_params(cx: ctxt, expr: &ast::Expr) -> bool {
 }
 
 pub fn method_call_type_param_defs(tcx: ctxt, origin: typeck::MethodOrigin)
-                                   -> Rc<~[TypeParameterDef]> {
+                                   -> Rc<Vec<TypeParameterDef> > {
     match origin {
         typeck::MethodStatic(did) => {
             // n.b.: When we encode impl methods, the bounds
@@ -3250,7 +3248,7 @@ pub fn method_call_type_param_defs(tcx: ctxt, origin: typeck::MethodOrigin)
             // trait itself.  This ought to be harmonized.
             let trait_type_param_defs =
                 lookup_trait_def(tcx, trt_id).generics.type_param_defs();
-            Rc::new(vec::append(
+            Rc::new(vec_ng::append(
                 trait_type_param_defs.to_owned(),
                 ty::trait_method(tcx,
                                  trt_id,
@@ -3480,8 +3478,8 @@ pub fn method_idx(id: ast::Ident, meths: &[@Method]) -> Option<uint> {
 /// Returns a vector containing the indices of all type parameters that appear
 /// in `ty`.  The vector may contain duplicates.  Probably should be converted
 /// to a bitset or some other representation.
-pub fn param_tys_in_type(ty: t) -> ~[param_ty] {
-    let mut rslt = ~[];
+pub fn param_tys_in_type(ty: t) -> Vec<param_ty> {
+    let mut rslt = Vec::new();
     walk_ty(ty, |ty| {
         match get(ty).sty {
           ty_param(p) => {
@@ -3496,8 +3494,8 @@ pub fn param_tys_in_type(ty: t) -> ~[param_ty] {
 pub fn occurs_check(tcx: ctxt, sp: Span, vid: TyVid, rt: t) {
     // Returns a vec of all the type variables occurring in `ty`. It may
     // contain duplicates.  (Integral type vars aren't counted.)
-    fn vars_in_type(ty: t) -> ~[TyVid] {
-        let mut rslt = ~[];
+    fn vars_in_type(ty: t) -> Vec<TyVid> {
+        let mut rslt = Vec::new();
         walk_ty(ty, |ty| {
             match get(ty).sty {
               ty_infer(TyVar(v)) => rslt.push(v),
@@ -3742,7 +3740,7 @@ pub fn provided_source(cx: ctxt, id: ast::DefId) -> Option<ast::DefId> {
     provided_method_sources.get().find(&id).map(|x| *x)
 }
 
-pub fn provided_trait_methods(cx: ctxt, id: ast::DefId) -> ~[@Method] {
+pub fn provided_trait_methods(cx: ctxt, id: ast::DefId) -> Vec<@Method> {
     if is_local(id) {
         {
             match cx.map.find(id.node) {
@@ -3774,7 +3772,7 @@ pub fn provided_trait_methods(cx: ctxt, id: ast::DefId) -> ~[@Method] {
     }
 }
 
-pub fn trait_supertraits(cx: ctxt, id: ast::DefId) -> @~[@TraitRef] {
+pub fn trait_supertraits(cx: ctxt, id: ast::DefId) -> @Vec<@TraitRef> {
     // Check the cache.
     {
         let supertraits = cx.supertraits.borrow();
@@ -3796,7 +3794,7 @@ pub fn trait_supertraits(cx: ctxt, id: ast::DefId) -> @~[@TraitRef] {
     return result;
 }
 
-pub fn trait_ref_supertraits(cx: ctxt, trait_ref: &ty::TraitRef) -> ~[@TraitRef] {
+pub fn trait_ref_supertraits(cx: ctxt, trait_ref: &ty::TraitRef) -> Vec<@TraitRef> {
     let supertrait_refs = trait_supertraits(cx, trait_ref.def_id);
     supertrait_refs.map(
         |supertrait_ref| supertrait_ref.subst(cx, &trait_ref.substs))
@@ -3836,7 +3834,7 @@ pub fn trait_method(cx: ctxt, trait_did: ast::DefId, idx: uint) -> @Method {
 }
 
 
-pub fn trait_methods(cx: ctxt, trait_did: ast::DefId) -> @~[@Method] {
+pub fn trait_methods(cx: ctxt, trait_did: ast::DefId) -> @Vec<@Method> {
     let mut trait_methods_cache = cx.trait_methods_cache.borrow_mut();
     match trait_methods_cache.get().find(&trait_did) {
         Some(&methods) => methods,
@@ -3856,7 +3854,7 @@ pub fn method(cx: ctxt, id: ast::DefId) -> @Method {
     })
 }
 
-pub fn trait_method_def_ids(cx: ctxt, id: ast::DefId) -> @~[DefId] {
+pub fn trait_method_def_ids(cx: ctxt, id: ast::DefId) -> @Vec<DefId> {
     let mut trait_method_def_ids = cx.trait_method_def_ids.borrow_mut();
     lookup_locally_or_in_crate_store("trait_method_def_ids",
                                      id,
@@ -3934,8 +3932,8 @@ pub fn ty_to_def_id(ty: t) -> Option<ast::DefId> {
 // Enum information
 #[deriving(Clone)]
 pub struct VariantInfo {
-    args: ~[t],
-    arg_names: Option<~[ast::Ident]>,
+    args: vec!(t),
+    arg_names: Option<Vec<ast::Ident> >,
     ctor_ty: t,
     name: ast::Ident,
     id: ast::DefId,
@@ -3955,7 +3953,7 @@ pub fn from_ast_variant(cx: ctxt,
 
         match ast_variant.node.kind {
             ast::TupleVariantKind(ref args) => {
-                let arg_tys = if args.len() > 0 { ty_fn_args(ctor_ty).map(|a| *a) } else { ~[] };
+                let arg_tys = if args.len() > 0 { ty_fn_args(ctor_ty).map(|a| *a) } else { Vec::new() };
 
                 return VariantInfo {
                     args: arg_tys,
@@ -3999,7 +3997,7 @@ pub fn from_ast_variant(cx: ctxt,
 pub fn substd_enum_variants(cx: ctxt,
                             id: ast::DefId,
                             substs: &substs)
-                         -> ~[@VariantInfo] {
+                         -> Vec<@VariantInfo> {
     enum_variants(cx, id).iter().map(|variant_info| {
         let substd_args = variant_info.args.iter()
             .map(|aty| subst(cx, substs, *aty)).collect();
@@ -4080,7 +4078,7 @@ pub fn type_is_empty(cx: ctxt, t: t) -> bool {
      }
 }
 
-pub fn enum_variants(cx: ctxt, id: ast::DefId) -> @~[@VariantInfo] {
+pub fn enum_variants(cx: ctxt, id: ast::DefId) -> @Vec<@VariantInfo> {
     {
         let enum_var_cache = cx.enum_var_cache.borrow();
         match enum_var_cache.get().find(&id) {
@@ -4295,7 +4293,7 @@ pub fn lookup_field_type(tcx: ctxt,
 
 // Look up the list of field names and IDs for a given struct
 // Fails if the id is not bound to a struct.
-pub fn lookup_struct_fields(cx: ctxt, did: ast::DefId) -> ~[field_ty] {
+pub fn lookup_struct_fields(cx: ctxt, did: ast::DefId) -> Vec<field_ty> {
   if did.krate == ast::LOCAL_CRATE {
       {
           match cx.map.find(did.node) {
@@ -4342,7 +4340,7 @@ pub fn lookup_struct_field(cx: ctxt,
     }
 }
 
-fn struct_field_tys(fields: &[StructField]) -> ~[field_ty] {
+fn struct_field_tys(fields: &[StructField]) -> Vec<field_ty> {
     fields.map(|field| {
         match field.node.kind {
             NamedField(ident, visibility) => {
@@ -4366,7 +4364,7 @@ fn struct_field_tys(fields: &[StructField]) -> ~[field_ty] {
 // Returns a list of fields corresponding to the struct's items. trans uses
 // this. Takes a list of substs with which to instantiate field types.
 pub fn struct_fields(cx: ctxt, did: ast::DefId, substs: &substs)
-                     -> ~[field] {
+                     -> Vec<field> {
     lookup_struct_fields(cx, did).map(|f| {
        field {
             // FIXME #6993: change type of field to Name and get rid of new()
@@ -4451,7 +4449,7 @@ fn tycat(cx: ctxt, ty: t) -> int {
     return tbl[tycat(cx, ty)][opcat(op)];
 }
 
-pub fn ty_params_to_tys(tcx: ty::ctxt, generics: &ast::Generics) -> ~[t] {
+pub fn ty_params_to_tys(tcx: ty::ctxt, generics: &ast::Generics) -> Vec<t> {
     vec::from_fn(generics.ty_params.len(), |i| {
         let id = generics.ty_params.get(i).id;
         ty::mk_param(tcx, i, ast_util::local_def(id))
@@ -4607,7 +4605,7 @@ pub fn each_bound_trait_and_supertraits(tcx: ctxt,
                                         -> bool {
     for &bound_trait_ref in bounds.iter() {
         let mut supertrait_set = HashMap::new();
-        let mut trait_refs = ~[];
+        let mut trait_refs = Vec::new();
         let mut i = 0;
 
         // Seed the worklist with the trait from the bound
@@ -4681,7 +4679,7 @@ pub fn visitor_object_ty(tcx: ctxt,
     let substs = substs {
         regions: ty::NonerasedRegions(opt_vec::Empty),
         self_ty: None,
-        tps: ~[]
+        tps: Vec::new()
     };
     let trait_ref = @TraitRef { def_id: trait_lang_item, substs: substs };
     Ok((trait_ref,
@@ -4708,7 +4706,7 @@ fn record_trait_implementation(tcx: ctxt,
     let mut trait_impls = tcx.trait_impls.borrow_mut();
     match trait_impls.get().find(&trait_def_id) {
         None => {
-            implementation_list = @RefCell::new(~[]);
+            implementation_list = @RefCell::new(Vec::new());
             trait_impls.get().insert(trait_def_id, implementation_list);
         }
         Some(&existing_implementation_list) => {
@@ -4763,7 +4761,7 @@ pub fn populate_implementations_for_type_if_necessary(tcx: ctxt,
             let mut inherent_impls = tcx.inherent_impls.borrow_mut();
             match inherent_impls.get().find(&type_id) {
                 None => {
-                    implementation_list = @RefCell::new(~[]);
+                    implementation_list = @RefCell::new(Vec::new());
                     inherent_impls.get().insert(type_id, implementation_list);
                 }
                 Some(&existing_implementation_list) => {
@@ -5128,7 +5126,7 @@ impl substs {
     pub fn empty() -> substs {
         substs {
             self_ty: None,
-            tps: ~[],
+            tps: Vec::new(),
             regions: NonerasedRegions(opt_vec::Empty)
         }
     }
index c0977d3c43fef22b5853c1529bcc3436b52441a7..859423d952393bb0d82c07767d4bd78cfb165e5f 100644 (file)
@@ -86,7 +86,7 @@ pub fn fold_opt_ty<T:TypeFolder>(this: &mut T,
 
 pub fn fold_ty_vec<T:TypeFolder>(this: &mut T,
                                  tys: &[ty::t])
-                                 -> ~[ty::t] {
+                                 -> Vec<ty::t> {
     tys.map(|t| this.fold_ty(*t))
 }
 
index c1865839e639a361d86817b557139b3331a82797..f1c8b121b4c6b593ec22740f1f42785b8f06a74f 100644 (file)
@@ -115,7 +115,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path,
     let fcx = pcx.fcx;
     let tcx = pcx.fcx.ccx.tcx;
 
-    let arg_types: ~[ty::t];
+    let arg_types: Vec<ty::t> ;
     let kind_name;
 
     // structure_of requires type variables to be resolved.
@@ -295,7 +295,7 @@ pub fn check_struct_pat_fields(pcx: &pat_ctxt,
                                span: Span,
                                path: &ast::Path,
                                fields: &[ast::FieldPat],
-                               class_fields: ~[ty::field_ty],
+                               class_fields: Vec<ty::field_ty> ,
                                class_id: ast::DefId,
                                substitutions: &ty::substs,
                                etc: bool) {
@@ -562,7 +562,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) {
                                           supplied_def_id,
                                           &ty::substs {
                                               self_ty: None,
-                                              tps: ~[],
+                                              tps: Vec::new(),
                                               regions: ty::ErasedRegions,
                                           });
                     }
index d7f85bd01234e550b30967b6a290aa36faaa845f..e563e6b2415652979eaf7de0da85db4942b58bc0 100644 (file)
@@ -139,8 +139,8 @@ pub fn lookup(
         m_name: m_name,
         supplied_tps: supplied_tps,
         impl_dups: @RefCell::new(HashSet::new()),
-        inherent_candidates: @RefCell::new(~[]),
-        extension_candidates: @RefCell::new(~[]),
+        inherent_candidates: @RefCell::new(Vec::new()),
+        extension_candidates: @RefCell::new(Vec::new()),
         deref_args: deref_args,
         check_traits: check_traits,
         autoderef_receiver: autoderef_receiver,
@@ -184,8 +184,8 @@ pub fn lookup_in_trait(
         m_name: m_name,
         supplied_tps: supplied_tps,
         impl_dups: @RefCell::new(HashSet::new()),
-        inherent_candidates: @RefCell::new(~[]),
-        extension_candidates: @RefCell::new(~[]),
+        inherent_candidates: @RefCell::new(Vec::new()),
+        extension_candidates: @RefCell::new(Vec::new()),
         deref_args: check::DoDerefArgs,
         check_traits: CheckTraitsOnly,
         autoderef_receiver: autoderef_receiver,
@@ -208,8 +208,8 @@ pub struct LookupContext<'a> {
     m_name: ast::Name,
     supplied_tps: &'a [ty::t],
     impl_dups: @RefCell<HashSet<DefId>>,
-    inherent_candidates: @RefCell<~[Candidate]>,
-    extension_candidates: @RefCell<~[Candidate]>,
+    inherent_candidates: @RefCell<Vec<Candidate> >,
+    extension_candidates: @RefCell<Vec<Candidate> >,
     deref_args: check::DerefArgs,
     check_traits: CheckTraitsFlag,
     autoderef_receiver: AutoderefReceiverFlag,
@@ -311,8 +311,8 @@ fn deref(&self, ty: ty::t) -> Option<ty::t> {
     // Candidate collection (see comment at start of file)
 
     fn reset_candidates(&self) {
-        self.inherent_candidates.set(~[]);
-        self.extension_candidates.set(~[]);
+        self.inherent_candidates.set(Vec::new());
+        self.extension_candidates.set(Vec::new());
     }
 
     fn push_inherent_candidates(&self, self_ty: ty::t) {
@@ -584,7 +584,7 @@ fn push_inherent_impl_candidates_for_type(&self, did: DefId) {
     }
 
     fn push_candidates_from_impl(&self,
-                                     candidates: &mut ~[Candidate],
+                                     candidates: &mut Vec<Candidate> ,
                                      impl_info: &ty::Impl) {
         {
             let mut impl_dups = self.impl_dups.borrow_mut();
@@ -892,10 +892,10 @@ fn search_for_method(&self, rcvr_ty: ty::t)
 
     fn consider_candidates(&self,
                            rcvr_ty: ty::t,
-                           candidates: &mut ~[Candidate])
+                           candidates: &mut Vec<Candidate> )
                            -> Option<MethodCallee> {
         // FIXME(pcwalton): Do we need to clone here?
-        let relevant_candidates: ~[Candidate] =
+        let relevant_candidates: Vec<Candidate> =
             candidates.iter().map(|c| (*c).clone()).
                 filter(|c| self.is_relevant(rcvr_ty, c)).collect();
 
@@ -917,8 +917,8 @@ fn consider_candidates(&self,
         Some(self.confirm_candidate(rcvr_ty, &relevant_candidates[0]))
     }
 
-    fn merge_candidates(&self, candidates: &[Candidate]) -> ~[Candidate] {
-        let mut merged = ~[];
+    fn merge_candidates(&self, candidates: &[Candidate]) -> Vec<Candidate> {
+        let mut merged = Vec::new();
         let mut i = 0;
         while i < candidates.len() {
             let candidate_a = &candidates[i];
@@ -1011,7 +1011,7 @@ fn confirm_candidate(&self, rcvr_ty: ty::t, candidate: &Candidate)
         // Construct the full set of type parameters for the method,
         // which is equal to the class tps + the method tps.
         let all_substs = substs {
-            tps: vec::append(candidate.rcvr_substs.tps.clone(), m_substs),
+            tps: vec_ng::append(candidate.rcvr_substs.tps.clone(), m_substs),
             regions: candidate.rcvr_substs.regions.clone(),
             self_ty: candidate.rcvr_substs.self_ty,
         };
index 6a41f63a779d3c0b5059df02f1a2619d78dceedb..ec2a68d2ae979b736096cc04920f53bf38ef34a9 100644 (file)
@@ -280,7 +280,7 @@ pub fn blank_fn_ctxt(ccx: @CrateCtxt,
     // and statement context, but we might as well do write the code only once
     let param_env = ty::ParameterEnvironment { free_substs: substs::empty(),
                                                self_param_bound: None,
-                                               type_param_bounds: ~[] };
+                                               type_param_bounds: Vec::new() };
     @FnCtxt {
         err_count_on_creation: ccx.tcx.sess.err_count(),
         ret_ty: rty,
@@ -510,7 +510,7 @@ fn check_fn(ccx: @CrateCtxt,
 }
 
 pub fn check_no_duplicate_fields(tcx: ty::ctxt,
-                                 fields: ~[(ast::Ident, Span)]) {
+                                 fields: Vec<(ast::Ident, Span)> ) {
     let mut field_names = HashMap::new();
 
     for p in fields.iter() {
@@ -730,7 +730,7 @@ fn check_impl_methods_against_trait(ccx: @CrateCtxt,
     // Check for missing methods from trait
     let provided_methods = ty::provided_trait_methods(tcx,
                                                       impl_trait_ref.def_id);
-    let mut missing_methods = ~[];
+    let mut missing_methods = Vec::new();
     for trait_method in trait_methods.iter() {
         let is_implemented =
             impl_methods.iter().any(
@@ -887,11 +887,11 @@ trait = ty::item_path_str(tcx, trait_m.def_id),
     // in the self type with free regions.  So, for example, if the
     // impl type is "&'a str", then this would replace the self
     // type with a free region `self`.
-    let dummy_impl_tps: ~[ty::t] =
+    let dummy_impl_tps: Vec<ty::t> =
         impl_generics.type_param_defs().iter().enumerate().
         map(|(i,t)| ty::mk_param(tcx, i, t.def_id)).
         collect();
-    let dummy_method_tps: ~[ty::t] =
+    let dummy_method_tps: Vec<ty::t> =
         impl_m.generics.type_param_defs().iter().enumerate().
         map(|(i,t)| ty::mk_param(tcx, i + impl_tps, t.def_id)).
         collect();
@@ -902,7 +902,7 @@ trait = ty::item_path_str(tcx, trait_m.def_id),
                 bound_region: ty::BrNamed(l.def_id, l.ident)})).
         collect();
     let dummy_substs = ty::substs {
-        tps: vec::append(dummy_impl_tps, dummy_method_tps),
+        tps: vec_ng::append(dummy_impl_tps, dummy_method_tps),
         regions: ty::NonerasedRegions(dummy_impl_regions),
         self_ty: None };
 
@@ -929,7 +929,7 @@ trait = ty::item_path_str(tcx, trait_m.def_id),
                      self_ty: self_ty } = trait_substs.subst(tcx, &dummy_substs);
         let substs = substs {
             regions: trait_regions,
-            tps: vec::append(trait_tps, dummy_method_tps),
+            tps: vec_ng::append(trait_tps, dummy_method_tps),
             self_ty: self_ty,
         };
         debug!("trait_fty (pre-subst): {} substs={}",
@@ -987,7 +987,7 @@ pub fn vtable_context<'a>(&'a self) -> VtableContext<'a> {
 
 impl RegionScope for infer::InferCtxt {
     fn anon_regions(&self, span: Span, count: uint)
-                    -> Result<~[ty::Region], ()> {
+                    -> Result<Vec<ty::Region> , ()> {
         Ok(vec::from_fn(count, |_| {
             self.next_region_var(infer::MiscVariable(span))
         }))
@@ -1259,7 +1259,7 @@ pub fn do_autoderef(fcx: @FnCtxt, sp: Span, t: ty::t) -> (ty::t, uint) {
      * so that trans/borrowck/etc know about this autoderef. */
 
     let mut t1 = t;
-    let mut enum_dids = ~[];
+    let mut enum_dids = Vec::new();
     let mut autoderefs = 0;
     loop {
         let sty = structure_of(fcx, sp, t1);
@@ -1840,7 +1840,7 @@ fn check_argument_types(fcx: @FnCtxt,
         }
     }
 
-    fn err_args(len: uint) -> ~[ty::t] {
+    fn err_args(len: uint) -> Vec<ty::t> {
         vec::from_fn(len, |_| ty::mk_err())
     }
 
@@ -2324,7 +2324,7 @@ fn check_field(fcx: @FnCtxt,
             _ => ()
         }
 
-        let tps: ~[ty::t] = tys.iter().map(|&ty| fcx.to_ty(ty)).collect();
+        let tps: Vec<ty::t> = tys.iter().map(|&ty| fcx.to_ty(ty)).collect();
         match method::lookup(fcx,
                              expr,
                              base,
@@ -2426,7 +2426,7 @@ fn check_struct_or_variant_fields(fcx: @FnCtxt,
             // Make sure the programmer specified all the fields.
             assert!(fields_found <= field_types.len());
             if fields_found < field_types.len() {
-                let mut missing_fields = ~[];
+                let mut missing_fields = Vec::new();
                 for class_field in field_types.iter() {
                     let name = class_field.name;
                     let (_, seen) = *class_field_map.get(&name);
@@ -2652,10 +2652,10 @@ fn check_struct_enum_variant(fcx: @FnCtxt,
                                                       gc_struct_id,
                                                       substs {
                                                         self_ty: None,
-                                                        tps: ~[
+                                                        tps: vec!(
                                                             fcx.expr_ty(
                                                                 subexpr)
-                                                        ],
+                                                        ),
                                                         regions: regions,
                                                       });
                               fcx.write_ty(id, sty);
@@ -3544,11 +3544,11 @@ fn do_check(ccx: @CrateCtxt,
                 vs: &[ast::P<ast::Variant>],
                 id: ast::NodeId,
                 hint: attr::ReprAttr)
-                -> ~[@ty::VariantInfo] {
+                -> Vec<@ty::VariantInfo> {
 
         let rty = ty::node_id_to_type(ccx.tcx, id);
-        let mut variants: ~[@ty::VariantInfo] = ~[];
-        let mut disr_vals: ~[ty::Disr] = ~[];
+        let mut variants: Vec<@ty::VariantInfo> = Vec::new();
+        let mut disr_vals: Vec<ty::Disr> = Vec::new();
         let mut prev_disr_val: Option<ty::Disr> = None;
 
         for &v in vs.iter() {
@@ -3797,7 +3797,7 @@ pub fn instantiate_path(fcx: @FnCtxt,
 
         // Build up the list of type parameters, inserting the self parameter
         // at the appropriate position.
-        let mut tps = ~[];
+        let mut tps = Vec::new();
         let mut pushed = false;
         for (i, ty) in pth.segments.iter()
                                    .flat_map(|segment| segment.types.iter())
@@ -4024,40 +4024,39 @@ fn param(ccx: @CrateCtxt, n: uint) -> ty::t {
     let tcx = ccx.tcx;
     let name = token::get_ident(it.ident);
     let (n_tps, inputs, output) = if name.get().starts_with("atomic_") {
-        let split : ~[&str] = name.get().split('_').collect();
+        let split : Vec<&str> = name.get().split('_').collect();
         assert!(split.len() >= 2, "Atomic intrinsic not correct format");
 
         //We only care about the operation here
         match split[1] {
-            "cxchg" => (1, ~[ty::mk_mut_rptr(tcx,
+            "cxchg" => (1, vec!(ty::mk_mut_rptr(tcx,
                                              ty::ReLateBound(it.id, ty::BrAnon(0)),
                                              param(ccx, 0)),
                         param(ccx, 0),
-                        param(ccx, 0),
-                        ], param(ccx, 0)),
+                        param(ccx, 0)), param(ccx, 0)),
             "load" => (1,
-               ~[
+               vec!(
                   ty::mk_imm_rptr(tcx, ty::ReLateBound(it.id, ty::BrAnon(0)),
                                   param(ccx, 0))
-               ],
+               ),
               param(ccx, 0)),
             "store" => (1,
-               ~[
+               vec!(
                   ty::mk_mut_rptr(tcx, ty::ReLateBound(it.id, ty::BrAnon(0)),
                                   param(ccx, 0)),
                   param(ccx, 0)
-               ],
+               ),
                ty::mk_nil()),
 
             "xchg" | "xadd" | "xsub" | "and"  | "nand" | "or" | "xor" | "max" |
             "min"  | "umax" | "umin" => {
-                (1, ~[ty::mk_mut_rptr(tcx,
+                (1, vec!(ty::mk_mut_rptr(tcx,
                                       ty::ReLateBound(it.id, ty::BrAnon(0)),
-                                      param(ccx, 0)), param(ccx, 0) ],
+                                      param(ccx, 0)), param(ccx, 0) ),
                  param(ccx, 0))
             }
             "fence" => {
-                (0, ~[], ty::mk_nil())
+                (0, Vec::new(), ty::mk_nil())
             }
             op => {
                 tcx.sess.span_err(it.span,
@@ -4069,24 +4068,24 @@ fn param(ccx: @CrateCtxt, n: uint) -> ty::t {
 
     } else {
         match name.get() {
-            "abort" => (0, ~[], ty::mk_bot()),
-            "breakpoint" => (0, ~[], ty::mk_nil()),
+            "abort" => (0, Vec::new(), ty::mk_bot()),
+            "breakpoint" => (0, Vec::new(), ty::mk_nil()),
             "size_of" |
-            "pref_align_of" | "min_align_of" => (1u, ~[], ty::mk_uint()),
-            "init" => (1u, ~[], param(ccx, 0u)),
-            "uninit" => (1u, ~[], param(ccx, 0u)),
-            "forget" => (1u, ~[ param(ccx, 0) ], ty::mk_nil()),
-            "transmute" => (2, ~[ param(ccx, 0) ], param(ccx, 1)),
+            "pref_align_of" | "min_align_of" => (1u, Vec::new(), ty::mk_uint()),
+            "init" => (1u, Vec::new(), param(ccx, 0u)),
+            "uninit" => (1u, Vec::new(), param(ccx, 0u)),
+            "forget" => (1u, vec!( param(ccx, 0) ), ty::mk_nil()),
+            "transmute" => (2, vec!( param(ccx, 0) ), param(ccx, 1)),
             "move_val_init" => {
                 (1u,
-                 ~[
+                 vec!(
                     ty::mk_mut_rptr(tcx, ty::ReLateBound(it.id, ty::BrAnon(0)), param(ccx, 0)),
                     param(ccx, 0u)
-                  ],
+                  ),
                ty::mk_nil())
             }
-            "needs_drop" => (1u, ~[], ty::mk_bool()),
-            "owns_managed" => (1u, ~[], ty::mk_bool()),
+            "needs_drop" => (1u, Vec::new(), ty::mk_bool()),
+            "owns_managed" => (1u, Vec::new(), ty::mk_bool()),
 
             "get_tydesc" => {
               let tydesc_ty = match ty::get_tydesc_ty(ccx.tcx) {
@@ -4097,14 +4096,14 @@ fn param(ccx: @CrateCtxt, n: uint) -> ty::t {
                   ty: tydesc_ty,
                   mutbl: ast::MutImmutable
               });
-              (1u, ~[], td_ptr)
+              (1u, Vec::new(), td_ptr)
             }
             "type_id" => {
                 let langid = ccx.tcx.lang_items.require(TypeIdLangItem);
                 match langid {
-                    Ok(did) => (1u, ~[], ty::mk_struct(ccx.tcx, did, substs {
+                    Ok(did) => (1u, Vec::new(), ty::mk_struct(ccx.tcx, did, substs {
                                                  self_ty: None,
-                                                 tps: ~[],
+                                                 tps: Vec::new(),
                                                  regions: ty::NonerasedRegions(opt_vec::Empty)
                                                  }) ),
                     Err(msg) => { tcx.sess.span_fatal(it.span, msg); }
@@ -4125,17 +4124,17 @@ fn param(ccx: @CrateCtxt, n: uint) -> ty::t {
                   ty: tydesc_ty,
                   mutbl: ast::MutImmutable
               });
-              (0, ~[ td_ptr, visitor_object_ty ], ty::mk_nil())
+              (0, vec!( td_ptr, visitor_object_ty ), ty::mk_nil())
             }
             "offset" => {
               (1,
-               ~[
+               vec!(
                   ty::mk_ptr(tcx, ty::mt {
                       ty: param(ccx, 0),
                       mutbl: ast::MutImmutable
                   }),
                   ty::mk_int()
-               ],
+               ),
                ty::mk_ptr(tcx, ty::mt {
                    ty: param(ccx, 0),
                    mutbl: ast::MutImmutable
@@ -4143,7 +4142,7 @@ fn param(ccx: @CrateCtxt, n: uint) -> ty::t {
             }
             "copy_nonoverlapping_memory" => {
               (1,
-               ~[
+               vec!(
                   ty::mk_ptr(tcx, ty::mt {
                       ty: param(ccx, 0),
                       mutbl: ast::MutMutable
@@ -4153,12 +4152,12 @@ fn param(ccx: @CrateCtxt, n: uint) -> ty::t {
                       mutbl: ast::MutImmutable
                   }),
                   ty::mk_uint()
-               ],
+               ),
                ty::mk_nil())
             }
             "copy_memory" => {
               (1,
-               ~[
+               vec!(
                   ty::mk_ptr(tcx, ty::mt {
                       ty: param(ccx, 0),
                       mutbl: ast::MutMutable
@@ -4168,135 +4167,135 @@ fn param(ccx: @CrateCtxt, n: uint) -> ty::t {
                       mutbl: ast::MutImmutable
                   }),
                   ty::mk_uint()
-               ],
+               ),
                ty::mk_nil())
             }
             "set_memory" => {
               (1,
-               ~[
+               vec!(
                   ty::mk_ptr(tcx, ty::mt {
                       ty: param(ccx, 0),
                       mutbl: ast::MutMutable
                   }),
                   ty::mk_u8(),
                   ty::mk_uint()
-               ],
+               ),
                ty::mk_nil())
             }
-            "sqrtf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
-            "sqrtf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
+            "sqrtf32" => (0, vec!( ty::mk_f32() ), ty::mk_f32()),
+            "sqrtf64" => (0, vec!( ty::mk_f64() ), ty::mk_f64()),
             "powif32" => {
                (0,
-                ~[ ty::mk_f32(), ty::mk_i32() ],
+                vec!( ty::mk_f32(), ty::mk_i32() ),
                 ty::mk_f32())
             }
             "powif64" => {
                (0,
-                ~[ ty::mk_f64(), ty::mk_i32() ],
+                vec!( ty::mk_f64(), ty::mk_i32() ),
                 ty::mk_f64())
             }
-            "sinf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
-            "sinf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
-            "cosf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
-            "cosf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
+            "sinf32" => (0, vec!( ty::mk_f32() ), ty::mk_f32()),
+            "sinf64" => (0, vec!( ty::mk_f64() ), ty::mk_f64()),
+            "cosf32" => (0, vec!( ty::mk_f32() ), ty::mk_f32()),
+            "cosf64" => (0, vec!( ty::mk_f64() ), ty::mk_f64()),
             "powf32" => {
                (0,
-                ~[ ty::mk_f32(), ty::mk_f32() ],
+                vec!( ty::mk_f32(), ty::mk_f32() ),
                 ty::mk_f32())
             }
             "powf64" => {
                (0,
-                ~[ ty::mk_f64(), ty::mk_f64() ],
+                vec!( ty::mk_f64(), ty::mk_f64() ),
                 ty::mk_f64())
             }
-            "expf32"   => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
-            "expf64"   => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
-            "exp2f32"  => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
-            "exp2f64"  => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
-            "logf32"   => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
-            "logf64"   => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
-            "log10f32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
-            "log10f64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
-            "log2f32"  => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
-            "log2f64"  => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
+            "expf32"   => (0, vec!( ty::mk_f32() ), ty::mk_f32()),
+            "expf64"   => (0, vec!( ty::mk_f64() ), ty::mk_f64()),
+            "exp2f32"  => (0, vec!( ty::mk_f32() ), ty::mk_f32()),
+            "exp2f64"  => (0, vec!( ty::mk_f64() ), ty::mk_f64()),
+            "logf32"   => (0, vec!( ty::mk_f32() ), ty::mk_f32()),
+            "logf64"   => (0, vec!( ty::mk_f64() ), ty::mk_f64()),
+            "log10f32" => (0, vec!( ty::mk_f32() ), ty::mk_f32()),
+            "log10f64" => (0, vec!( ty::mk_f64() ), ty::mk_f64()),
+            "log2f32"  => (0, vec!( ty::mk_f32() ), ty::mk_f32()),
+            "log2f64"  => (0, vec!( ty::mk_f64() ), ty::mk_f64()),
             "fmaf32" => {
                 (0,
-                 ~[ ty::mk_f32(), ty::mk_f32(), ty::mk_f32() ],
+                 vec!( ty::mk_f32(), ty::mk_f32(), ty::mk_f32() ),
                  ty::mk_f32())
             }
             "fmaf64" => {
                 (0,
-                 ~[ ty::mk_f64(), ty::mk_f64(), ty::mk_f64() ],
+                 vec!( ty::mk_f64(), ty::mk_f64(), ty::mk_f64() ),
                  ty::mk_f64())
             }
-            "fabsf32"      => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
-            "fabsf64"      => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
-            "copysignf32"  => (0, ~[ ty::mk_f32(), ty::mk_f32() ], ty::mk_f32()),
-            "copysignf64"  => (0, ~[ ty::mk_f64(), ty::mk_f64() ], ty::mk_f64()),
-            "floorf32"     => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
-            "floorf64"     => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
-            "ceilf32"      => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
-            "ceilf64"      => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
-            "truncf32"     => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
-            "truncf64"     => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
-            "rintf32"      => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
-            "rintf64"      => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
-            "nearbyintf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
-            "nearbyintf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
-            "roundf32"     => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
-            "roundf64"     => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
-            "ctpop8"       => (0, ~[ ty::mk_i8()  ], ty::mk_i8()),
-            "ctpop16"      => (0, ~[ ty::mk_i16() ], ty::mk_i16()),
-            "ctpop32"      => (0, ~[ ty::mk_i32() ], ty::mk_i32()),
-            "ctpop64"      => (0, ~[ ty::mk_i64() ], ty::mk_i64()),
-            "ctlz8"        => (0, ~[ ty::mk_i8()  ], ty::mk_i8()),
-            "ctlz16"       => (0, ~[ ty::mk_i16() ], ty::mk_i16()),
-            "ctlz32"       => (0, ~[ ty::mk_i32() ], ty::mk_i32()),
-            "ctlz64"       => (0, ~[ ty::mk_i64() ], ty::mk_i64()),
-            "cttz8"        => (0, ~[ ty::mk_i8()  ], ty::mk_i8()),
-            "cttz16"       => (0, ~[ ty::mk_i16() ], ty::mk_i16()),
-            "cttz32"       => (0, ~[ ty::mk_i32() ], ty::mk_i32()),
-            "cttz64"       => (0, ~[ ty::mk_i64() ], ty::mk_i64()),
-            "bswap16"      => (0, ~[ ty::mk_i16() ], ty::mk_i16()),
-            "bswap32"      => (0, ~[ ty::mk_i32() ], ty::mk_i32()),
-            "bswap64"      => (0, ~[ ty::mk_i64() ], ty::mk_i64()),
+            "fabsf32"      => (0, vec!( ty::mk_f32() ), ty::mk_f32()),
+            "fabsf64"      => (0, vec!( ty::mk_f64() ), ty::mk_f64()),
+            "copysignf32"  => (0, vec!( ty::mk_f32(), ty::mk_f32() ), ty::mk_f32()),
+            "copysignf64"  => (0, vec!( ty::mk_f64(), ty::mk_f64() ), ty::mk_f64()),
+            "floorf32"     => (0, vec!( ty::mk_f32() ), ty::mk_f32()),
+            "floorf64"     => (0, vec!( ty::mk_f64() ), ty::mk_f64()),
+            "ceilf32"      => (0, vec!( ty::mk_f32() ), ty::mk_f32()),
+            "ceilf64"      => (0, vec!( ty::mk_f64() ), ty::mk_f64()),
+            "truncf32"     => (0, vec!( ty::mk_f32() ), ty::mk_f32()),
+            "truncf64"     => (0, vec!( ty::mk_f64() ), ty::mk_f64()),
+            "rintf32"      => (0, vec!( ty::mk_f32() ), ty::mk_f32()),
+            "rintf64"      => (0, vec!( ty::mk_f64() ), ty::mk_f64()),
+            "nearbyintf32" => (0, vec!( ty::mk_f32() ), ty::mk_f32()),
+            "nearbyintf64" => (0, vec!( ty::mk_f64() ), ty::mk_f64()),
+            "roundf32"     => (0, vec!( ty::mk_f32() ), ty::mk_f32()),
+            "roundf64"     => (0, vec!( ty::mk_f64() ), ty::mk_f64()),
+            "ctpop8"       => (0, vec!( ty::mk_i8()  ), ty::mk_i8()),
+            "ctpop16"      => (0, vec!( ty::mk_i16() ), ty::mk_i16()),
+            "ctpop32"      => (0, vec!( ty::mk_i32() ), ty::mk_i32()),
+            "ctpop64"      => (0, vec!( ty::mk_i64() ), ty::mk_i64()),
+            "ctlz8"        => (0, vec!( ty::mk_i8()  ), ty::mk_i8()),
+            "ctlz16"       => (0, vec!( ty::mk_i16() ), ty::mk_i16()),
+            "ctlz32"       => (0, vec!( ty::mk_i32() ), ty::mk_i32()),
+            "ctlz64"       => (0, vec!( ty::mk_i64() ), ty::mk_i64()),
+            "cttz8"        => (0, vec!( ty::mk_i8()  ), ty::mk_i8()),
+            "cttz16"       => (0, vec!( ty::mk_i16() ), ty::mk_i16()),
+            "cttz32"       => (0, vec!( ty::mk_i32() ), ty::mk_i32()),
+            "cttz64"       => (0, vec!( ty::mk_i64() ), ty::mk_i64()),
+            "bswap16"      => (0, vec!( ty::mk_i16() ), ty::mk_i16()),
+            "bswap32"      => (0, vec!( ty::mk_i32() ), ty::mk_i32()),
+            "bswap64"      => (0, vec!( ty::mk_i64() ), ty::mk_i64()),
 
             "volatile_load" =>
-                (1, ~[ ty::mk_imm_ptr(tcx, param(ccx, 0)) ], param(ccx, 0)),
+                (1, vec!( ty::mk_imm_ptr(tcx, param(ccx, 0)) ), param(ccx, 0)),
             "volatile_store" =>
-                (1, ~[ ty::mk_mut_ptr(tcx, param(ccx, 0)), param(ccx, 0) ], ty::mk_nil()),
+                (1, vec!( ty::mk_mut_ptr(tcx, param(ccx, 0)), param(ccx, 0) ), ty::mk_nil()),
 
             "i8_add_with_overflow" | "i8_sub_with_overflow" | "i8_mul_with_overflow" =>
-                (0, ~[ty::mk_i8(), ty::mk_i8()],
-                ty::mk_tup(tcx, ~[ty::mk_i8(), ty::mk_bool()])),
+                (0, vec!(ty::mk_i8(), ty::mk_i8()),
+                ty::mk_tup(tcx, vec!(ty::mk_i8(), ty::mk_bool()))),
 
             "i16_add_with_overflow" | "i16_sub_with_overflow" | "i16_mul_with_overflow" =>
-                (0, ~[ty::mk_i16(), ty::mk_i16()],
-                ty::mk_tup(tcx, ~[ty::mk_i16(), ty::mk_bool()])),
+                (0, vec!(ty::mk_i16(), ty::mk_i16()),
+                ty::mk_tup(tcx, vec!(ty::mk_i16(), ty::mk_bool()))),
 
             "i32_add_with_overflow" | "i32_sub_with_overflow" | "i32_mul_with_overflow" =>
-                (0, ~[ty::mk_i32(), ty::mk_i32()],
-                ty::mk_tup(tcx, ~[ty::mk_i32(), ty::mk_bool()])),
+                (0, vec!(ty::mk_i32(), ty::mk_i32()),
+                ty::mk_tup(tcx, vec!(ty::mk_i32(), ty::mk_bool()))),
 
             "i64_add_with_overflow" | "i64_sub_with_overflow" | "i64_mul_with_overflow" =>
-                (0, ~[ty::mk_i64(), ty::mk_i64()],
-                ty::mk_tup(tcx, ~[ty::mk_i64(), ty::mk_bool()])),
+                (0, vec!(ty::mk_i64(), ty::mk_i64()),
+                ty::mk_tup(tcx, vec!(ty::mk_i64(), ty::mk_bool()))),
 
             "u8_add_with_overflow" | "u8_sub_with_overflow" | "u8_mul_with_overflow" =>
-                (0, ~[ty::mk_u8(), ty::mk_u8()],
-                ty::mk_tup(tcx, ~[ty::mk_u8(), ty::mk_bool()])),
+                (0, vec!(ty::mk_u8(), ty::mk_u8()),
+                ty::mk_tup(tcx, vec!(ty::mk_u8(), ty::mk_bool()))),
 
             "u16_add_with_overflow" | "u16_sub_with_overflow" | "u16_mul_with_overflow" =>
-                (0, ~[ty::mk_u16(), ty::mk_u16()],
-                ty::mk_tup(tcx, ~[ty::mk_u16(), ty::mk_bool()])),
+                (0, vec!(ty::mk_u16(), ty::mk_u16()),
+                ty::mk_tup(tcx, vec!(ty::mk_u16(), ty::mk_bool()))),
 
             "u32_add_with_overflow" | "u32_sub_with_overflow" | "u32_mul_with_overflow"=>
-                (0, ~[ty::mk_u32(), ty::mk_u32()],
-                ty::mk_tup(tcx, ~[ty::mk_u32(), ty::mk_bool()])),
+                (0, vec!(ty::mk_u32(), ty::mk_u32()),
+                ty::mk_tup(tcx, vec!(ty::mk_u32(), ty::mk_bool()))),
 
             "u64_add_with_overflow" | "u64_sub_with_overflow"  | "u64_mul_with_overflow" =>
-                (0, ~[ty::mk_u64(), ty::mk_u64()],
-                ty::mk_tup(tcx, ~[ty::mk_u64(), ty::mk_bool()])),
+                (0, vec!(ty::mk_u64(), ty::mk_u64()),
+                ty::mk_tup(tcx, vec!(ty::mk_u64(), ty::mk_bool()))),
 
             ref other => {
                 tcx.sess.span_err(it.span,
index 9192bdfda291692c2e8907351ccef48e62a8eeee..b05a876ec7a407867ddbe8a594d90e941678e200 100644 (file)
@@ -74,7 +74,7 @@ pub fn relate_nested_regions(tcx: ty::ctxt,
      */
 
     let mut rr = RegionRelator { tcx: tcx,
-                                 stack: ~[],
+                                 stack: Vec::new(),
                                  relate_op: relate_op };
     match opt_region {
         Some(o_r) => { rr.stack.push(o_r); }
@@ -84,7 +84,7 @@ pub fn relate_nested_regions(tcx: ty::ctxt,
 
     struct RegionRelator<'a> {
         tcx: ty::ctxt,
-        stack: ~[ty::Region],
+        stack: Vec<ty::Region> ,
         relate_op: 'a |ty::Region, ty::Region|,
     }
 
@@ -147,7 +147,7 @@ pub fn relate_free_regions(tcx: ty::ctxt, fn_sig: &ty::FnSig) {
 
     debug!("relate_free_regions >>");
 
-    let mut all_tys = ~[];
+    let mut all_tys = Vec::new();
     for arg in fn_sig.inputs.iter() {
         all_tys.push(*arg);
     }
index a9ea968fe1d19d6da361a5ff41c857a56e17c1ca..1905e1e387bce6e9418ca6094b67fe6db99ea044 100644 (file)
@@ -132,7 +132,7 @@ fn lookup_vtables_for_param(vcx: &VtableContext,
     let tcx = vcx.tcx();
 
     // ty is the value supplied for the type parameter A...
-    let mut param_result = ~[];
+    let mut param_result = Vec::new();
 
     ty::each_bound_trait_and_supertraits(tcx, type_param_bounds.trait_bounds, |trait_ref| {
         // ...and here trait_ref is each bound that was declared on A,
@@ -323,7 +323,7 @@ fn search_for_vtable(vcx: &VtableContext,
                      -> Option<vtable_origin> {
     let tcx = vcx.tcx();
 
-    let mut found = ~[];
+    let mut found = Vec::new();
     let mut impls_seen = HashSet::new();
 
     // Load the implementations from external metadata if necessary.
@@ -336,7 +336,7 @@ fn search_for_vtable(vcx: &VtableContext,
         let trait_impls = tcx.trait_impls.borrow();
         trait_impls.get()
                    .find(&trait_ref.def_id)
-                   .map_or(@RefCell::new(~[]), |x| *x)
+                   .map_or(@RefCell::new(Vec::new()), |x| *x)
     };
     // impls is the list of all impls in scope for trait_ref.
     let impls = impls.borrow();
@@ -614,7 +614,7 @@ fn mutability_allowed(a_mutbl: ast::Mutability,
 
                       let param_bounds = ty::ParamBounds {
                           builtin_bounds: ty::EmptyBuiltinBounds(),
-                          trait_bounds: ~[target_trait_ref]
+                          trait_bounds: vec!(target_trait_ref)
                       };
                       let vtables =
                             lookup_vtables_for_param(&vcx,
@@ -625,7 +625,7 @@ fn mutability_allowed(a_mutbl: ast::Mutability,
                                                      is_early);
 
                       if !is_early {
-                          insert_vtables(fcx, ex.id, @~[vtables]);
+                          insert_vtables(fcx, ex.id, @vec!(vtables));
                       }
 
                       // Now, if this is &trait, we need to link the
@@ -787,7 +787,7 @@ pub fn resolve_impl(tcx: ty::ctxt,
     // but that falls out of doing this.
     let param_bounds = ty::ParamBounds {
         builtin_bounds: ty::EmptyBuiltinBounds(),
-        trait_bounds: ~[impl_trait_ref]
+        trait_bounds: vec!(impl_trait_ref)
     };
     let t = ty::node_id_to_type(tcx, impl_item.id);
     let t = t.subst(tcx, &param_env.free_substs);
index ec230761d350fc22a995d33a9490e9f1d547dc69..c22b06996ff43f85295525bdebd8d3f932ebfea6 100644 (file)
@@ -53,7 +53,7 @@ fn resolve_type_vars_in_type(fcx: @FnCtxt, sp: Span, typ: ty::t)
 }
 
 fn resolve_type_vars_in_types(fcx: @FnCtxt, sp: Span, tys: &[ty::t])
-                          -> ~[ty::t] {
+                          -> Vec<ty::t> {
     tys.map(|t| {
         match resolve_type_vars_in_type(fcx, sp, *t) {
             Some(t1) => t1,
@@ -78,7 +78,7 @@ fn resolve_method_map_entry(wbcx: &mut WbCtxt, sp: Span, id: ast::NodeId) {
                     return;
                 }
             };
-            let mut new_tps = ~[];
+            let mut new_tps = Vec::new();
             for &subst in method.substs.tps.iter() {
                 match resolve_type_vars_in_type(fcx, sp, subst) {
                     Some(t) => new_tps.push(t),
@@ -242,7 +242,7 @@ fn resolve_type_vars_for_node(wbcx: &mut WbCtxt, sp: Span, id: ast::NodeId)
         write_ty_to_tcx(tcx, id, t);
         let mut ret = Some(t);
         fcx.opt_node_ty_substs(id, |substs| {
-          let mut new_tps = ~[];
+          let mut new_tps = Vec::new();
           for subst in substs.tps.iter() {
               match resolve_type_vars_in_type(fcx, sp, *subst) {
                 Some(t) => new_tps.push(t),
index e47b6e722f386ecd17844cdc2f67777389798fe8..e64dbed1b35d0afa8f1ba8ef94fe8fd4e4785ef2 100644 (file)
@@ -53,8 +53,8 @@
 
 struct UniversalQuantificationResult {
     monotype: t,
-    type_variables: ~[ty::t],
-    type_param_defs: Rc<~[ty::TypeParameterDef]>
+    type_variables: Vec<ty::t> ,
+    type_param_defs: Rc<Vec<ty::TypeParameterDef> >
 }
 
 fn get_base_type(inference_context: &InferCtxt,
@@ -323,7 +323,7 @@ fn check_implementation(&self, item: &Item,
     // `ProvidedMethodInfo` instance into the `provided_method_sources` map.
     fn instantiate_default_methods(&self, impl_id: ast::DefId,
                                    trait_ref: &ty::TraitRef,
-                                   all_methods: &mut ~[@Method]) {
+                                   all_methods: &mut Vec<@Method> ) {
         let tcx = self.crate_context.tcx;
         debug!("instantiate_default_methods(impl_id={:?}, trait_ref={})",
                impl_id, trait_ref.repr(tcx));
@@ -354,7 +354,7 @@ fn instantiate_default_methods(&self, impl_id: ast::DefId,
             // construct the polytype for the method based on the method_ty
             let new_generics = ty::Generics {
                 type_param_defs:
-                    Rc::new(vec::append(
+                    Rc::new(vec_ng::append(
                         impl_poly_type.generics.type_param_defs().to_owned(),
                             new_method_ty.generics.type_param_defs())),
                 region_param_defs:
@@ -390,7 +390,7 @@ fn add_inherent_impl(&self, base_def_id: DefId,
         let mut inherent_impls = tcx.inherent_impls.borrow_mut();
         match inherent_impls.get().find(&base_def_id) {
             None => {
-                implementation_list = @RefCell::new(~[]);
+                implementation_list = @RefCell::new(Vec::new());
                 inherent_impls.get().insert(base_def_id, implementation_list);
             }
             Some(&existing_implementation_list) => {
@@ -409,7 +409,7 @@ fn add_trait_impl(&self, base_def_id: DefId,
         let mut trait_impls = tcx.trait_impls.borrow_mut();
         match trait_impls.get().find(&base_def_id) {
             None => {
-                implementation_list = @RefCell::new(~[]);
+                implementation_list = @RefCell::new(Vec::new());
                 trait_impls.get().insert(base_def_id, implementation_list);
             }
             Some(&existing_implementation_list) => {
@@ -611,7 +611,7 @@ fn create_impl_from_item(&self, item: &Item) -> @Impl {
         let tcx = self.crate_context.tcx;
         match item.node {
             ItemImpl(_, ref trait_refs, _, ref ast_methods) => {
-                let mut methods = ~[];
+                let mut methods = Vec::new();
                 for ast_method in ast_methods.iter() {
                     methods.push(ty::method(tcx, local_def(ast_method.id)));
                 }
index e40ff6be667076b50661e10eadc7bb3dc3331b8e..9bfa89819ae898cd1fa13419f02abd01177f270d 100644 (file)
@@ -336,7 +336,7 @@ fn make_static_method_ty(ccx: &CrateCtxt,
         // the substitution to any traits that appear in their bounds.
 
         // add in the type parameters from the trait
-        let mut new_type_param_defs = ~[];
+        let mut new_type_param_defs = Vec::new();
         let substd_type_param_defs =
             trait_ty_generics.type_param_defs.subst(tcx, &substs);
         new_type_param_defs.push_all(*substd_type_param_defs.borrow());
@@ -349,7 +349,7 @@ fn make_static_method_ty(ccx: &CrateCtxt,
             def_id: dummy_defid,
             bounds: @ty::ParamBounds {
                 builtin_bounds: ty::EmptyBuiltinBounds(),
-                trait_bounds: ~[self_trait_ref]
+                trait_bounds: vec!(self_trait_ref)
             },
             default: None
         });
@@ -420,7 +420,7 @@ pub fn ensure_supertraits(ccx: &CrateCtxt,
     }
 
     let self_ty = ty::mk_self(ccx.tcx, local_def(id));
-    let mut ty_trait_refs: ~[@ty::TraitRef] = ~[];
+    let mut ty_trait_refs: Vec<@ty::TraitRef> = Vec::new();
     let mut bounds = ty::EmptyBuiltinBounds();
     for ast_trait_ref in ast_trait_refs.iter() {
         let trait_def_id = ty::trait_ref_to_def_id(ccx.tcx, ast_trait_ref);
@@ -494,7 +494,7 @@ fn convert_methods(ccx: &CrateCtxt,
                 // itself
                 ty_param_bounds_and_ty {
                     generics: ty::Generics {
-                        type_param_defs: Rc::new(vec::append(
+                        type_param_defs: Rc::new(vec_ng::append(
                             rcvr_ty_generics.type_param_defs().to_owned(),
                             m_ty_generics.type_param_defs())),
                         region_param_defs: rcvr_ty_generics.region_param_defs.clone(),
@@ -860,7 +860,7 @@ pub fn ty_of_item(ccx: &CrateCtxt, it: &ast::Item)
             let tpt = ty_param_bounds_and_ty {
                 generics: ty::Generics {
                     type_param_defs: ty_generics.type_param_defs.clone(),
-                    region_param_defs: Rc::new(~[]),
+                    region_param_defs: Rc::new(Vec::new()),
                 },
                 ty: ty::mk_bare_fn(ccx.tcx, tofd)
             };
@@ -946,8 +946,8 @@ pub fn ty_of_foreign_item(ccx: &CrateCtxt,
         ast::ForeignItemStatic(t, _) => {
             ty::ty_param_bounds_and_ty {
                 generics: ty::Generics {
-                    type_param_defs: Rc::new(~[]),
-                    region_param_defs: Rc::new(~[]),
+                    type_param_defs: Rc::new(Vec::new()),
+                    region_param_defs: Rc::new(Vec::new()),
                 },
                 ty: ast_ty_to_ty(ccx, &ExplicitRscope, t)
             }
@@ -1008,7 +1008,7 @@ fn compute_bounds(
 
         let mut param_bounds = ty::ParamBounds {
             builtin_bounds: ty::EmptyBuiltinBounds(),
-            trait_bounds: ~[]
+            trait_bounds: Vec::new()
         };
         for ast_bound in ast_bounds.iter() {
             match *ast_bound {
@@ -1083,7 +1083,7 @@ pub fn mk_item_substs(ccx: &CrateCtxt,
                       ty_generics: &ty::Generics,
                       self_ty: Option<ty::t>) -> ty::substs
 {
-    let params: ~[ty::t] =
+    let params: Vec<ty::t> =
         ty_generics.type_param_defs().iter().enumerate().map(
             |(i, t)| ty::mk_param(ccx.tcx, i, t.def_id)).collect();
 
index 95d605823da3e450d83051f30f17d27dc4c4b41a..076a10fcbfd060a865722da6160bdbb301447e9d 100644 (file)
@@ -82,7 +82,7 @@ pub trait Combine {
     fn contratys(&self, a: ty::t, b: ty::t) -> cres<ty::t>;
     fn tys(&self, a: ty::t, b: ty::t) -> cres<ty::t>;
 
-    fn tps(&self, as_: &[ty::t], bs: &[ty::t]) -> cres<~[ty::t]> {
+    fn tps(&self, as_: &[ty::t], bs: &[ty::t]) -> cres<Vec<ty::t> > {
 
         // Note: type parameters are always treated as *invariant*
         // (otherwise the type system would be unsound).  In the
@@ -396,7 +396,7 @@ pub fn eq_opt_regions<C:Combine>(
 
 pub fn super_fn_sigs<C:Combine>(this: &C, a: &ty::FnSig, b: &ty::FnSig) -> cres<ty::FnSig> {
 
-    fn argvecs<C:Combine>(this: &C, a_args: &[ty::t], b_args: &[ty::t]) -> cres<~[ty::t]> {
+    fn argvecs<C:Combine>(this: &C, a_args: &[ty::t], b_args: &[ty::t]) -> cres<Vec<ty::t> > {
         if a_args.len() == b_args.len() {
             result::collect(a_args.iter().zip(b_args.iter())
                             .map(|(a, b)| this.args(*a, *b)))
index 94f679954fbd2d9eb358c45bbdd5184ebf5d739a..48bd78457096d78df863f548f941dcc14e10ca5a 100644 (file)
@@ -522,7 +522,7 @@ pub fn lattice_var_and_t<L:LatticeDir + Combine,
 
 pub fn var_ids<T:Combine>(this: &T,
                           map: &HashMap<ty::BoundRegion, ty::Region>)
-                          -> ~[RegionVid] {
+                          -> Vec<RegionVid> {
     map.iter().map(|(_, r)| match *r {
             ty::ReInfer(ty::ReVar(r)) => { r }
             r => {
index 28a3e822a1ae99571e584d4bfdfe9ee1ad2bc3e2..03db6882a798422aac898f0f064dc23a6bbb5a79 100644 (file)
@@ -260,7 +260,7 @@ pub fn fixup_err_to_str(f: fixup_err) -> ~str {
 fn new_ValsAndBindings<V:Clone,T:Clone>() -> ValsAndBindings<V, T> {
     ValsAndBindings {
         vals: SmallIntMap::new(),
-        bindings: ~[]
+        bindings: Vec::new()
     }
 }
 
@@ -622,7 +622,7 @@ pub fn next_ty_var(&self) -> ty::t {
         ty::mk_var(self.tcx, self.next_ty_var_id())
     }
 
-    pub fn next_ty_vars(&self, n: uint) -> ~[ty::t] {
+    pub fn next_ty_vars(&self, n: uint) -> Vec<ty::t> {
         vec::from_fn(n, |_i| self.next_ty_var())
     }
 
@@ -659,7 +659,7 @@ pub fn next_region_var(&self, origin: RegionVariableOrigin) -> ty::Region {
     pub fn next_region_vars(&self,
                             origin: RegionVariableOrigin,
                             count: uint)
-                            -> ~[ty::Region] {
+                            -> Vec<ty::Region> {
         vec::from_fn(count, |_| self.next_region_var(origin))
     }
 
index 98fe0bedb3be8d8807aaf9f644ece7f9828e8821..88c234eb10f143f5462fbd37d0e6311dadc5698e 100644 (file)
@@ -88,7 +88,7 @@ pub enum RegionResolutionError {
 
 pub struct RegionVarBindings {
     tcx: ty::ctxt,
-    var_origins: RefCell<~[RegionVariableOrigin]>,
+    var_origins: RefCell<Vec<RegionVariableOrigin> >,
     constraints: RefCell<HashMap<Constraint, SubregionOrigin>>,
     lubs: RefCell<CombineMap>,
     glbs: RefCell<CombineMap>,
@@ -103,24 +103,24 @@ pub struct RegionVarBindings {
     // actively snapshotting.  The reason for this is that otherwise
     // we end up adding entries for things like the lower bound on
     // a variable and so forth, which can never be rolled back.
-    undo_log: RefCell<~[UndoLogEntry]>,
+    undo_log: RefCell<Vec<UndoLogEntry> >,
 
     // This contains the results of inference.  It begins as an empty
     // option and only acquires a value after inference is complete.
-    values: RefCell<Option<~[VarValue]>>,
+    values: RefCell<Option<Vec<VarValue> >>,
 }
 
 pub fn RegionVarBindings(tcx: ty::ctxt) -> RegionVarBindings {
     RegionVarBindings {
         tcx: tcx,
-        var_origins: RefCell::new(~[]),
+        var_origins: RefCell::new(Vec::new()),
         values: RefCell::new(None),
         constraints: RefCell::new(HashMap::new()),
         lubs: RefCell::new(HashMap::new()),
         glbs: RefCell::new(HashMap::new()),
         skolemization_count: Cell::new(0),
         bound_count: Cell::new(0),
-        undo_log: RefCell::new(~[])
+        undo_log: RefCell::new(Vec::new())
     }
 }
 
@@ -423,7 +423,7 @@ pub fn combine_vars(&self,
     }
 
     pub fn vars_created_since_snapshot(&self, snapshot: uint)
-                                       -> ~[RegionVid] {
+                                       -> Vec<RegionVid> {
         let undo_log = self.undo_log.borrow();
         undo_log.get().slice_from(snapshot).iter()
             .filter_map(|&elt| match elt {
@@ -433,7 +433,7 @@ pub fn vars_created_since_snapshot(&self, snapshot: uint)
             .collect()
     }
 
-    pub fn tainted(&self, snapshot: uint, r0: Region) -> ~[Region] {
+    pub fn tainted(&self, snapshot: uint, r0: Region) -> Vec<Region> {
         /*!
          * Computes all regions that have been related to `r0` in any
          * way since the snapshot `snapshot` was taken---`r0` itself
@@ -453,7 +453,7 @@ pub fn tainted(&self, snapshot: uint, r0: Region) -> ~[Region] {
         // `result_set` acts as a worklist: we explore all outgoing
         // edges and add any new regions we find to result_set.  This
         // is not a terribly efficient implementation.
-        let mut result_set = ~[r0];
+        let mut result_set = vec!(r0);
         let mut result_index = 0;
         while result_index < result_set.len() {
             // nb: can't use uint::range() here because result_set grows
@@ -504,11 +504,10 @@ pub fn tainted(&self, snapshot: uint, r0: Region) -> ~[Region] {
 
         return result_set;
 
-        fn consider_adding_edge(result_set: ~[Region],
+        fn consider_adding_edge(result_set: Vec<Region> ,
                                 r: Region,
                                 r1: Region,
-                                r2: Region) -> ~[Region]
-        {
+                                r2: Region) -> Vec<Region> {
             let mut result_set = result_set;
             if r == r1 { // Clearly, this is potentially inefficient.
                 if !result_set.iter().any(|x| *x == r2) {
@@ -781,7 +780,7 @@ struct RegionAndOrigin {
 impl RegionVarBindings {
     fn infer_variable_values(&self,
                              errors: &mut OptVec<RegionResolutionError>)
-                             -> ~[VarValue] {
+                             -> Vec<VarValue> {
         let mut var_data = self.construct_var_data();
         self.expansion(var_data);
         self.contraction(var_data);
@@ -789,7 +788,7 @@ fn infer_variable_values(&self,
         self.extract_values_and_collect_conflicts(var_data, errors)
     }
 
-    fn construct_var_data(&self) -> ~[VarData] {
+    fn construct_var_data(&self) -> Vec<VarData> {
         vec::from_fn(self.num_vars(), |_| {
             VarData {
                 // All nodes are initially classified as contracting; during
@@ -999,8 +998,7 @@ fn extract_values_and_collect_conflicts(
         &self,
         var_data: &[VarData],
         errors: &mut OptVec<RegionResolutionError>)
-        -> ~[VarValue]
-    {
+        -> Vec<VarValue> {
         debug!("extract_values_and_collect_conflicts()");
 
         // This is the best way that I have found to suppress
@@ -1218,17 +1216,17 @@ fn collect_concrete_regions(&self,
                                 orig_node_idx: RegionVid,
                                 dir: Direction,
                                 dup_vec: &mut [uint])
-                                -> (~[RegionAndOrigin], bool) {
+                                -> (Vec<RegionAndOrigin> , bool) {
         struct WalkState {
             set: HashSet<RegionVid>,
-            stack: ~[RegionVid],
-            result: ~[RegionAndOrigin],
+            stack: Vec<RegionVid> ,
+            result: Vec<RegionAndOrigin> ,
             dup_found: bool
         }
         let mut state = WalkState {
             set: HashSet::new(),
-            stack: ~[orig_node_idx],
-            result: ~[],
+            stack: vec!(orig_node_idx),
+            result: Vec::new(),
             dup_found: false
         };
         state.set.insert(orig_node_idx);
index fec6e357e5ac07dfef3e812fcc61e541b70fa3ee..f698f988c40fe7bd6d6655cb61be032538cb73ac 100644 (file)
@@ -83,7 +83,7 @@ pub struct ResolveState<'a> {
     infcx: &'a InferCtxt,
     modes: uint,
     err: Option<fixup_err>,
-    v_seen: ~[TyVid],
+    v_seen: Vec<TyVid> ,
     type_depth: uint
 }
 
@@ -92,7 +92,7 @@ pub fn resolver<'a>(infcx: &'a InferCtxt, modes: uint) -> ResolveState<'a> {
         infcx: infcx,
         modes: modes,
         err: None,
-        v_seen: ~[],
+        v_seen: Vec::new(),
         type_depth: 0
     }
 }
index 0a447a5f8e6fd7e8152ff6c96b32464b0ece9893..a3f44c9a06906a4961c0de5c359c6a6e20e17b5d 100644 (file)
@@ -46,7 +46,7 @@ struct RH {
 
 fn setup_env(test_name: &str, source_string: &str) -> Env {
     let messages = @DVec();
-    let matches = getopts(~[~"-Z", ~"verbose"], optgroups()).get();
+    let matches = getopts(vec!(~"-Z", ~"verbose"), optgroups()).get();
     let diag = diagnostic::collect(messages);
     let sessopts = build_session_options(~"rustc", &matches, diag);
     let sess = build_session(sessopts, None, diag);
@@ -186,7 +186,7 @@ pub fn t_fn(&self, input_tys: &[ty::t], output_ty: ty::t) -> ty::t {
                           proto: ast::ProtoBare,
                           onceness: ast::Many,
                           region: ty::ReStatic,
-                          bounds: @~[]},
+                          bounds: @Vec::new()},
             sig: FnSig {
                 inputs: inputs,
                 output: output_ty,
index c55bdcd0bf99b3b43400e09102be611c95672904..5241830ec771ffa4978b8bff6d1b9ac177b29f6f 100644 (file)
@@ -27,7 +27,7 @@ pub enum VarValue<V, T> {
 
 pub struct ValsAndBindings<V, T> {
     vals: SmallIntMap<VarValue<V, T>>,
-    bindings: ~[(V, VarValue<V, T>)],
+    bindings: Vec<(V, VarValue<V, T>)> ,
 }
 
 pub struct Node<V, T> {
index aee2b24e60f4ca69bb06a521c2af01e99c49f2f2..a21ba0b7a2c17314f337b4ce6188e88f226420d7 100644 (file)
@@ -152,9 +152,9 @@ pub struct MethodCallee {
 // of the method to be invoked
 pub type MethodMap = @RefCell<NodeMap<MethodCallee>>;
 
-pub type vtable_param_res = @~[vtable_origin];
+pub type vtable_param_res = @Vec<vtable_origin> ;
 // Resolutions for bounds of all parameters, left to right, for a given path.
-pub type vtable_res = @~[vtable_param_res];
+pub type vtable_res = @Vec<vtable_param_res> ;
 
 #[deriving(Clone)]
 pub enum vtable_origin {
@@ -163,7 +163,7 @@ pub enum vtable_origin {
       from whence comes the vtable, and tys are the type substs.
       vtable_res is the vtable itself
      */
-    vtable_static(ast::DefId, ~[ty::t], vtable_res),
+    vtable_static(ast::DefId, Vec<ty::t> , vtable_res),
 
     /*
       Dynamic vtable, comes from a parameter that has a bound on it:
@@ -235,7 +235,7 @@ pub fn write_ty_to_tcx(tcx: ty::ctxt, node_id: ast::NodeId, ty: ty::t) {
 }
 pub fn write_substs_to_tcx(tcx: ty::ctxt,
                            node_id: ast::NodeId,
-                           substs: ~[ty::t]) {
+                           substs: Vec<ty::t> ) {
     if substs.len() > 0u {
         debug!("write_substs_to_tcx({}, {:?})", node_id,
                substs.map(|t| ppaux::ty_to_str(tcx, *t)));
@@ -271,8 +271,8 @@ pub fn lookup_def_ccx(ccx: &CrateCtxt, sp: Span, id: ast::NodeId)
 
 pub fn no_params(t: ty::t) -> ty::ty_param_bounds_and_ty {
     ty::ty_param_bounds_and_ty {
-        generics: ty::Generics {type_param_defs: Rc::new(~[]),
-                                region_param_defs: Rc::new(~[])},
+        generics: ty::Generics {type_param_defs: Rc::new(Vec::new()),
+                                region_param_defs: Rc::new(Vec::new())},
         ty: t
     }
 }
@@ -352,7 +352,7 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
                 abis: abi::AbiSet::Rust(),
                 sig: ty::FnSig {
                     binder_id: main_id,
-                    inputs: ~[],
+                    inputs: Vec::new(),
                     output: ty::mk_nil(),
                     variadic: false
                 }
@@ -398,10 +398,10 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
                 abis: abi::AbiSet::Rust(),
                 sig: ty::FnSig {
                     binder_id: start_id,
-                    inputs: ~[
+                    inputs: vec!(
                         ty::mk_int(),
                         ty::mk_imm_ptr(tcx, ty::mk_imm_ptr(tcx, ty::mk_u8()))
-                    ],
+                    ),
                     output: ty::mk_int(),
                     variadic: false
                 }
index 4fc027e6fee6901da8e9c9d4f7fdf241eb63637f..fb391fe6fc8e593c37ff973d9f7c94d16db67371 100644 (file)
@@ -31,7 +31,7 @@ pub trait RegionScope {
     fn anon_regions(&self,
                     span: Span,
                     count: uint)
-                    -> Result<~[ty::Region], ()>;
+                    -> Result<Vec<ty::Region> , ()>;
 }
 
 // A scope in which all regions must be explicitly named
@@ -41,7 +41,7 @@ impl RegionScope for ExplicitRscope {
     fn anon_regions(&self,
                     _span: Span,
                     _count: uint)
-                    -> Result<~[ty::Region], ()> {
+                    -> Result<Vec<ty::Region> , ()> {
         Err(())
     }
 }
@@ -66,7 +66,7 @@ impl RegionScope for BindingRscope {
     fn anon_regions(&self,
                     _: Span,
                     count: uint)
-                    -> Result<~[ty::Region], ()> {
+                    -> Result<Vec<ty::Region> , ()> {
         let idx = self.anon_bindings.get();
         self.anon_bindings.set(idx + count);
         Ok(vec::from_fn(count, |i| ty::ReLateBound(self.binder_id,
index bd244b431c20e02823b1fefeb7ce3f47d872893b..829a4c2f316deba40ddbabdc2ecf4de0619f9218 100644 (file)
@@ -261,7 +261,7 @@ struct TermsContext<'a> {
     inferred_map: HashMap<ast::NodeId, InferredIndex>,
 
     // Maps from an InferredIndex to the info for that variable.
-    inferred_infos: ~[InferredInfo<'a>],
+    inferred_infos: Vec<InferredInfo<'a>> ,
 }
 
 enum ParamKind { TypeParam, RegionParam, SelfParam }
@@ -282,7 +282,7 @@ fn determine_parameters_to_be_inferred<'a>(tcx: ty::ctxt,
         tcx: tcx,
         arena: arena,
         inferred_map: HashMap::new(),
-        inferred_infos: ~[],
+        inferred_infos: Vec::new(),
 
         // cache and share the variance struct used for items with
         // no type/region parameters
@@ -410,7 +410,7 @@ struct ConstraintContext<'a> {
     invariant: VarianceTermPtr<'a>,
     bivariant: VarianceTermPtr<'a>,
 
-    constraints: ~[Constraint<'a>],
+    constraints: Vec<Constraint<'a>> ,
 }
 
 /// Declares that the variable `decl_id` appears in a location with
@@ -457,7 +457,7 @@ fn add_constraints_from_crate<'a>(terms_cx: TermsContext<'a>,
         contravariant: contravariant,
         invariant: invariant,
         bivariant: bivariant,
-        constraints: ~[],
+        constraints: Vec::new(),
     };
     visit::walk_crate(&mut constraint_cx, krate, ());
     constraint_cx
@@ -835,11 +835,10 @@ fn add_constraints_from_mt(&mut self,
 
 struct SolveContext<'a> {
     terms_cx: TermsContext<'a>,
-    constraints: ~[Constraint<'a>],
+    constraints: Vec<Constraint<'a>> ,
 
     // Maps from an InferredIndex to the inferred value for that variable.
-    solutions: ~[ty::Variance]
-}
+    solutions: Vec<ty::Variance> }
 
 fn solve_constraints(constraints_cx: ConstraintContext) {
     let ConstraintContext { terms_cx, constraints, .. } = constraints_cx;
index c139e21c8649a8ee5f1b782810943de3a0801385..732723fec9cd51105a71760f341285aff678202c 100644 (file)
@@ -66,7 +66,7 @@ pub fn indenter() -> _indenter {
 
 pub fn field_expr(f: ast::Field) -> @ast::Expr { return f.expr; }
 
-pub fn field_exprs(fields: ~[ast::Field]) -> ~[@ast::Expr] {
+pub fn field_exprs(fields: Vec<ast::Field> ) -> Vec<@ast::Expr> {
     fields.map(|f| f.expr)
 }
 
index 1384bf182a76229dec1d27176272756cfb6cd9d5..c6ccb4275add4a35ae0dfae0057cc17cf59d1bc7 100644 (file)
@@ -501,7 +501,7 @@ pub fn parameterized(cx: ctxt,
                      did: ast::DefId,
                      is_trait: bool) -> ~str {
 
-    let mut strs = ~[];
+    let mut strs = Vec::new();
     match *regions {
         ty::ErasedRegions => { }
         ty::NonerasedRegions(ref regions) => {
@@ -610,7 +610,7 @@ fn repr(&self, tcx: ctxt) -> ~str {
 
 // This is necessary to handle types like Option<~[T]>, for which
 // autoderef cannot convert the &[T] handler
-impl<T:Repr> Repr for ~[T] {
+impl<T:Repr> Repr for Vec<T> {
     fn repr(&self, tcx: ctxt) -> ~str {
         repr_vec(tcx, *self)
     }
@@ -658,7 +658,7 @@ fn repr(&self, tcx: ctxt) -> ~str {
 
 impl Repr for ty::ParamBounds {
     fn repr(&self, tcx: ctxt) -> ~str {
-        let mut res = ~[];
+        let mut res = Vec::new();
         for b in self.builtin_bounds.iter() {
             res.push(match b {
                 ty::BoundStatic => ~"'static",
@@ -973,7 +973,7 @@ fn user_string(&self, tcx: ctxt) -> ~str {
 impl UserString for ty::BuiltinBounds {
     fn user_string(&self, tcx: ctxt) -> ~str {
         if self.is_empty() { ~"<no-bounds>" } else {
-            let mut result = ~[];
+            let mut result = Vec::new();
             for bb in self.iter() {
                 result.push(bb.user_string(tcx));
             }
index 2741dc285f99a738ddc9f1f28c4bf6b0e973d3a2..8b0b08d9cc30236bee2e528e0f5ab63673dee181 100644 (file)
@@ -253,7 +253,7 @@ fn input_str(&mut self, input: &str) {
 
     /// Convenience function that retrieves the result of a digest as a
     /// newly allocated vec of bytes.
-    fn result_bytes(&mut self) -> ~[u8] {
+    fn result_bytes(&mut self) -> Vec<u8> {
         let mut buf = vec::from_elem((self.output_bits()+7)/8, 0u8);
         self.result(buf);
         buf
@@ -576,7 +576,7 @@ fn test_hash<D: Digest>(sh: &mut D, tests: &[Test]) {
     #[test]
     fn test_sha256() {
         // Examples from wikipedia
-        let wikipedia_tests = ~[
+        let wikipedia_tests = vec!(
             Test {
                 input: ~"",
                 output_str: ~"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
@@ -588,8 +588,7 @@ fn test_sha256() {
             Test {
                 input: ~"The quick brown fox jumps over the lazy dog.",
                 output_str: ~"ef537f25c895bfa782526529a9b63d97aa631564d5d789c2b765448c8635fb6c"
-            },
-        ];
+            });
 
         let tests = wikipedia_tests;