]> git.lizzy.rs Git - rust.git/commitdiff
Removed @self and @Trait.
authorEduard Burtescu <edy.burt@gmail.com>
Thu, 6 Feb 2014 22:38:33 +0000 (00:38 +0200)
committerEduard Burtescu <edy.burt@gmail.com>
Thu, 6 Feb 2014 22:38:33 +0000 (00:38 +0200)
122 files changed:
src/doc/rust.md
src/doc/tutorial.md
src/librustc/driver/driver.rs
src/librustc/lib.rs
src/librustc/metadata/decoder.rs
src/librustc/metadata/encoder.rs
src/librustc/metadata/tydecode.rs
src/librustc/metadata/tyencode.rs
src/librustc/middle/astencode.rs
src/librustc/middle/borrowck/gather_loans/mod.rs
src/librustc/middle/dataflow.rs
src/librustc/middle/lint.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/trans/build.rs
src/librustc/middle/trans/builder.rs
src/librustc/middle/trans/context.rs
src/librustc/middle/trans/debuginfo.rs
src/librustc/middle/trans/expr.rs
src/librustc/middle/trans/glue.rs
src/librustc/middle/trans/meth.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/astconv.rs
src/librustc/middle/typeck/check/method.rs
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/regionck.rs
src/librustc/middle/typeck/check/vtable.rs
src/librustc/middle/typeck/coherence.rs
src/librustc/middle/typeck/infer/coercion.rs
src/librustc/middle/typeck/infer/combine.rs
src/librustc/middle/typeck/infer/error_reporting.rs
src/librustc/middle/typeck/infer/glb.rs
src/librustc/middle/typeck/infer/lattice.rs
src/librustc/middle/typeck/infer/lub.rs
src/librustc/middle/typeck/infer/mod.rs
src/librustc/middle/typeck/infer/resolve.rs
src/librustc/middle/typeck/infer/sub.rs
src/librustc/middle/typeck/mod.rs
src/librustc/util/ppaux.rs
src/librustdoc/clean.rs
src/librustdoc/core.rs
src/librustdoc/html/format.rs
src/librustdoc/test.rs
src/libstd/any.rs
src/libstd/reflect.rs
src/libsyntax/ast.rs
src/libsyntax/diagnostic.rs
src/libsyntax/ext/base.rs
src/libsyntax/ext/build.rs
src/libsyntax/ext/deriving/encodable.rs
src/libsyntax/ext/deriving/ty.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/trace_macros.rs
src/libsyntax/ext/tt/macro_parser.rs
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/ext/tt/transcribe.rs
src/libsyntax/fold.rs
src/libsyntax/parse/comments.rs
src/libsyntax/parse/lexer.rs
src/libsyntax/parse/mod.rs
src/libsyntax/parse/parser.rs
src/libsyntax/print/pprust.rs
src/libsyntax/util/parser_testing.rs
src/libsyntax/visit.rs
src/test/auxiliary/issue-2380.rs
src/test/compile-fail/borrowck-object-lifetime.rs
src/test/compile-fail/borrowck-object-mutability.rs
src/test/compile-fail/class-cast-to-trait.rs
src/test/compile-fail/issue-5153.rs
src/test/compile-fail/kindck-owned-trait.rs [deleted file]
src/test/compile-fail/lint-heap-memory.rs
src/test/compile-fail/map-types.rs
src/test/compile-fail/object-does-not-impl-trait.rs
src/test/compile-fail/object-pointer-types.rs
src/test/compile-fail/regions-trait-1.rs
src/test/compile-fail/selftype-traittype.rs
src/test/compile-fail/trait-bounds-sugar.rs
src/test/compile-fail/trait-coercion-generic-bad.rs
src/test/compile-fail/trait-coercion-generic-regions.rs
src/test/compile-fail/trait-test-2.rs
src/test/debug-info/generic-method-on-generic-struct.rs
src/test/debug-info/method-on-enum.rs
src/test/debug-info/method-on-generic-struct.rs
src/test/debug-info/method-on-struct.rs
src/test/debug-info/method-on-trait.rs
src/test/debug-info/method-on-tuple-struct.rs
src/test/debug-info/self-in-default-method.rs
src/test/debug-info/self-in-generic-default-method.rs
src/test/debug-info/trait-pointers.rs
src/test/run-fail/unwind-box-trait.rs [deleted file]
src/test/run-pass/alignment-gep-tup-like-1.rs
src/test/run-pass/alignment-gep-tup-like-2.rs [deleted file]
src/test/run-pass/autoderef-method-on-trait.rs
src/test/run-pass/autoderef-method-twice-but-not-thrice.rs
src/test/run-pass/autoderef-method-twice.rs
src/test/run-pass/autoderef-method.rs
src/test/run-pass/boxed-trait-with-vstore.rs [deleted file]
src/test/run-pass/class-cast-to-trait-cross-crate-2.rs
src/test/run-pass/class-separate-impl.rs
src/test/run-pass/close-over-big-then-small-data.rs
src/test/run-pass/explicit-self-objects-box.rs [deleted file]
src/test/run-pass/explicit-self-objects-simple.rs [deleted file]
src/test/run-pass/explicit-self.rs
src/test/run-pass/generic-object.rs
src/test/run-pass/issue-2288.rs
src/test/run-pass/issue-2380-b.rs
src/test/run-pass/issue-2734.rs
src/test/run-pass/issue-2735.rs
src/test/run-pass/issue-2935.rs
src/test/run-pass/issue-3702.rs
src/test/run-pass/issue-3794.rs
src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs
src/test/run-pass/issue-9129.rs
src/test/run-pass/kindck-owned-trait-contains-1.rs
src/test/run-pass/objects-coerce-from-managed-to-borrowed.rs [deleted file]
src/test/run-pass/reflect-visit-data.rs
src/test/run-pass/trait-coercion-generic.rs
src/test/run-pass/trait-coercion.rs
src/test/run-pass/trait-default-method-xc.rs
src/test/run-pass/trait-object-generics.rs

index b412fa4967df0861656c57a14c1224ce5fc50325..ff2e2b5236998bb148bfc60494b5b753754cf7f3 100644 (file)
@@ -1335,7 +1335,7 @@ to pointers to the trait name, used as a type.
 # impl Shape for int { }
 # let mycircle = 0;
 
-let myshape: @Shape = @mycircle as @Shape;
+let myshape: ~Shape = ~mycircle as ~Shape;
 ~~~~
 
 The resulting value is a managed box containing the value that was cast,
@@ -1396,7 +1396,7 @@ Likewise, supertrait methods may also be called on trait objects.
 # impl Circle for int { fn radius(&self) -> f64 { 0.0 } }
 # let mycircle = 0;
 
-let mycircle: Circle = @mycircle as @Circle;
+let mycircle: Circle = ~mycircle as ~Circle;
 let nonsense = mycircle.radius() * mycircle.area();
 ~~~~
 
@@ -3290,8 +3290,8 @@ Whereas most calls to trait methods are "early bound" (statically resolved) to s
 a call to a method on an object type is only resolved to a vtable entry at compile time.
 The actual implementation for each vtable entry can vary on an object-by-object basis.
 
-Given a pointer-typed expression `E` of type `&T`, `~T` or `@T`, where `T` implements trait `R`,
-casting `E` to the corresponding pointer type `&R`, `~R` or `@R` results in a value of the _object type_ `R`.
+Given a pointer-typed expression `E` of type `&T` or `~T`, where `T` implements trait `R`,
+casting `E` to the corresponding pointer type `&R` or `~R` results in a value of the _object type_ `R`.
 This result is represented as a pair of pointers:
 the vtable pointer for the `T` implementation of `R`, and the pointer value of `E`.
 
@@ -3306,12 +3306,12 @@ impl Printable for int {
   fn to_string(&self) -> ~str { self.to_str() }
 }
 
-fn print(a: @Printable) {
+fn print(a: ~Printable) {
    println!("{}", a.to_string());
 }
 
 fn main() {
-   print(@10 as @Printable);
+   print(~10 as ~Printable);
 }
 ~~~~
 
index 7010eb4e48d8b27a09b3dd0f05e8ea460f0fcd57..5d60b90a8f36c2f36b3e73b7f7b2e935bc3288d7 100644 (file)
@@ -1857,7 +1857,7 @@ like any other function, except for the name `self`.
 
 The type of `self` is the type on which the method is implemented,
 or a pointer thereof. As an argument it is written either `self`,
-`&self`, `@self`, or `~self`.
+`&self`, or `~self`.
 A caller must in turn have a compatible pointer type to call the method.
 
 ~~~
@@ -1870,14 +1870,12 @@ A caller must in turn have a compatible pointer type to call the method.
 # }
 impl Shape {
     fn draw_reference(&self) { ... }
-    fn draw_managed(@self) { ... }
     fn draw_owned(~self) { ... }
     fn draw_value(self) { ... }
 }
 
 let s = Circle(Point { x: 1.0, y: 2.0 }, 3.0);
 
-(@s).draw_managed();
 (~s).draw_owned();
 (&s).draw_reference();
 s.draw_value();
@@ -1897,7 +1895,6 @@ to a reference.
 # }
 # impl Shape {
 #    fn draw_reference(&self) { ... }
-#    fn draw_managed(@self) { ... }
 #    fn draw_owned(~self) { ... }
 #    fn draw_value(self) { ... }
 # }
@@ -2368,29 +2365,29 @@ an _object_.
 
 ~~~~
 # trait Drawable { fn draw(&self); }
-fn draw_all(shapes: &[@Drawable]) {
+fn draw_all(shapes: &[~Drawable]) {
     for shape in shapes.iter() { shape.draw(); }
 }
 ~~~~
 
-In this example, there is no type parameter. Instead, the `@Drawable`
-type denotes any managed box value that implements the `Drawable`
-trait. To construct such a value, you use the `as` operator to cast a
-value to an object:
+In this example, there is no type parameter. Instead, the `~Drawable`
+type denotes any owned box value that implements the `Drawable` trait.
+To construct such a value, you use the `as` operator to cast a value
+to an object:
 
 ~~~~
 # type Circle = int; type Rectangle = bool;
 # trait Drawable { fn draw(&self); }
 # fn new_circle() -> Circle { 1 }
 # fn new_rectangle() -> Rectangle { true }
-# fn draw_all(shapes: &[@Drawable]) {}
+# fn draw_all(shapes: &[~Drawable]) {}
 
 impl Drawable for Circle { fn draw(&self) { ... } }
 impl Drawable for Rectangle { fn draw(&self) { ... } }
 
-let c: @Circle = @new_circle();
-let r: @Rectangle = @new_rectangle();
-draw_all([c as @Drawable, r as @Drawable]);
+let c: ~Circle = ~new_circle();
+let r: ~Rectangle = ~new_rectangle();
+draw_all([c as ~Drawable, r as ~Drawable]);
 ~~~~
 
 We omit the code for `new_circle` and `new_rectangle`; imagine that
@@ -2407,8 +2404,6 @@ for example, an `@Circle` may not be cast to an `~Drawable`.
 # impl Drawable for int { fn draw(&self) {} }
 # fn new_circle() -> int { 1 }
 # fn new_rectangle() -> int { 2 }
-// A managed object
-let boxy: @Drawable = @new_circle() as @Drawable;
 // An owned object
 let owny: ~Drawable = ~new_circle() as ~Drawable;
 // A borrowed object
@@ -2427,7 +2422,6 @@ particular set of built-in kinds that their contents must fulfill in
 order to be packaged up in a trait object of that storage class.
 
 * The contents of owned traits (`~Trait`) must fulfill the `Send` bound.
-* The contents of managed traits (`@Trait`) must fulfill the `'static` bound.
 * The contents of reference traits (`&Trait`) are not constrained by any bound.
 
 Consequently, the trait objects themselves automatically fulfill their
@@ -2439,7 +2433,6 @@ to fulfilling `Send`, contents must also fulfill `Freeze`, and as a consequence,
 the trait itself fulfills `Freeze`.
 
 * `~Trait:Send` is equivalent to `~Trait`.
-* `@Trait:'static` is equivalent to `@Trait`.
 * `&Trait:` is equivalent to `&Trait`.
 
 Builtin kind bounds can also be specified on closure types in the same way (for
index b7bb603dd65e7f9fdc0a6429ae98fbf60febb85f..d2c2763eab1ac24949c5d4377f73429417284ed8 100644 (file)
@@ -42,6 +42,7 @@
 use syntax::attr::{AttrMetaMethods};
 use syntax::codemap;
 use syntax::diagnostic;
+use syntax::diagnostic::Emitter;
 use syntax::ext::base::CrateLoader;
 use syntax::parse;
 use syntax::parse::token::InternedString;
@@ -136,10 +137,10 @@ pub fn build_configuration(sess: Session) ->
 }
 
 // Convert strings provided as --cfg [cfgspec] into a crate_cfg
-fn parse_cfgspecs(cfgspecs: ~[~str], demitter: @diagnostic::Emitter)
+fn parse_cfgspecs(cfgspecs: ~[~str])
                   -> ast::CrateConfig {
     cfgspecs.move_iter().map(|s| {
-        let sess = parse::new_parse_sess(Some(demitter));
+        let sess = parse::new_parse_sess();
         parse::parse_meta_from_source_str("cfgspec".to_str(), s, ~[], sess)
     }).collect::<ast::CrateConfig>()
 }
@@ -539,9 +540,7 @@ pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &Input,
     phase_6_link_output(sess, &trans, &outputs);
 }
 
-struct IdentifiedAnnotation {
-    contents: (),
-}
+struct IdentifiedAnnotation;
 
 impl pprust::PpAnn for IdentifiedAnnotation {
     fn pre(&self, node: pprust::AnnNode) -> io::IoResult<()> {
@@ -619,18 +618,16 @@ pub fn pretty_print_input(sess: Session,
 
     let annotation = match ppm {
         PpmIdentified | PpmExpandedIdentified => {
-            @IdentifiedAnnotation {
-                contents: (),
-            } as @pprust::PpAnn
+            ~IdentifiedAnnotation as ~pprust::PpAnn
         }
         PpmTyped => {
             let ast_map = ast_map.expect("--pretty=typed missing ast_map");
             let analysis = phase_3_run_analysis_passes(sess, &crate, ast_map);
-            @TypedAnnotation {
+            ~TypedAnnotation {
                 analysis: analysis
-            } as @pprust::PpAnn
+            } as ~pprust::PpAnn:
         }
-        _ => @pprust::NoAnn as @pprust::PpAnn,
+        _ => ~pprust::NoAnn as ~pprust::PpAnn:,
     };
 
     let src = &sess.codemap.get_filemap(source_name(input)).src;
@@ -682,17 +679,15 @@ pub fn get_arch(triple: &str) -> Option<abi::Architecture> {
 
     ("mips",   abi::Mips)];
 
-pub fn build_target_config(sopts: @session::Options,
-                           demitter: @diagnostic::Emitter)
+pub fn build_target_config(sopts: @session::Options)
                            -> @session::Config {
     let os = match get_os(sopts.target_triple) {
       Some(os) => os,
-      None => early_error(demitter, "unknown operating system")
+      None => early_error("unknown operating system")
     };
     let arch = match get_arch(sopts.target_triple) {
       Some(arch) => arch,
-      None => early_error(demitter,
-                          "unknown architecture: " + sopts.target_triple)
+      None => early_error("unknown architecture: " + sopts.target_triple)
     };
     let (int_type, uint_type) = match arch {
       abi::X86 => (ast::TyI32, ast::TyU32),
@@ -730,8 +725,7 @@ pub fn host_triple() -> ~str {
 }
 
 pub fn build_session_options(binary: ~str,
-                             matches: &getopts::Matches,
-                             demitter: @diagnostic::Emitter)
+                             matches: &getopts::Matches)
                              -> @session::Options {
     let crate_types = matches.opt_strs("crate-type").flat_map(|s| {
         s.split(',').map(|part| {
@@ -741,8 +735,7 @@ pub fn build_session_options(binary: ~str,
                 "staticlib" => session::CrateTypeStaticlib,
                 "dylib"     => session::CrateTypeDylib,
                 "bin"       => session::CrateTypeExecutable,
-                _ => early_error(demitter,
-                                 format!("unknown crate type: `{}`", part))
+                _ => early_error(format!("unknown crate type: `{}`", part))
             }
         }).collect()
     });
@@ -767,8 +760,8 @@ pub fn build_session_options(binary: ~str,
             let lint_name = lint_name.replace("-", "_");
             match lint_dict.find_equiv(&lint_name) {
               None => {
-                early_error(demitter, format!("unknown {} flag: {}",
-                                           level_name, lint_name));
+                early_error(format!("unknown {} flag: {}",
+                                    level_name, lint_name));
               }
               Some(lint) => {
                 lint_opts.push((lint.lint, *level));
@@ -787,7 +780,7 @@ pub fn build_session_options(binary: ~str,
             if *name == *debug_flag { this_bit = bit; break; }
         }
         if this_bit == 0 {
-            early_error(demitter, format!("unknown debug flag: {}", *debug_flag))
+            early_error(format!("unknown debug flag: {}", *debug_flag))
         }
         debugging_opts |= this_bit;
     }
@@ -807,9 +800,7 @@ pub fn build_session_options(binary: ~str,
                     "bc"   => link::OutputTypeBitcode,
                     "obj"  => link::OutputTypeObject,
                     "link" => link::OutputTypeExe,
-                    _ => early_error(demitter,
-                                     format!("unknown emission type: `{}`",
-                                             part))
+                    _ => early_error(format!("unknown emission type: `{}`", part))
                 }
             }).collect()
         })
@@ -830,7 +821,7 @@ pub fn build_session_options(binary: ~str,
             No
         } else if matches.opt_present("O") {
             if matches.opt_present("opt-level") {
-                early_error(demitter, "-O and --opt-level both provided");
+                early_error("-O and --opt-level both provided");
             }
             Default
         } else if matches.opt_present("opt-level") {
@@ -840,7 +831,7 @@ pub fn build_session_options(binary: ~str,
               ~"2" => Default,
               ~"3" => Aggressive,
               _ => {
-                early_error(demitter, "optimization level needs to be between 0-3")
+                early_error("optimization level needs to be between 0-3")
               }
             }
         } else { No }
@@ -865,7 +856,7 @@ pub fn build_session_options(binary: ~str,
         }).collect()
     });
 
-    let cfg = parse_cfgspecs(matches.opt_strs("cfg"), demitter);
+    let cfg = parse_cfgspecs(matches.opt_strs("cfg"));
     let test = matches.opt_present("test");
     let android_cross_path = matches.opt_str("android-cross-path");
     let write_dependency_info = (matches.opt_present("dep-info"),
@@ -926,25 +917,23 @@ pub fn build_session_options(binary: ~str,
 }
 
 pub fn build_session(sopts: @session::Options,
-                     local_crate_source_file: Option<Path>,
-                     demitter: @diagnostic::Emitter)
+                     local_crate_source_file: Option<Path>)
                      -> Session {
     let codemap = @codemap::CodeMap::new();
     let diagnostic_handler =
-        diagnostic::mk_handler(Some(demitter));
+        diagnostic::mk_handler();
     let span_diagnostic_handler =
         diagnostic::mk_span_handler(diagnostic_handler, codemap);
 
-    build_session_(sopts, local_crate_source_file, codemap, demitter, span_diagnostic_handler)
+    build_session_(sopts, local_crate_source_file, codemap, span_diagnostic_handler)
 }
 
 pub fn build_session_(sopts: @session::Options,
                       local_crate_source_file: Option<Path>,
                       codemap: @codemap::CodeMap,
-                      demitter: @diagnostic::Emitter,
                       span_diagnostic_handler: @diagnostic::SpanHandler)
                       -> Session {
-    let target_cfg = build_target_config(sopts, demitter);
+    let target_cfg = build_target_config(sopts);
     let p_s = parse::new_parse_sess_special_handler(span_diagnostic_handler, codemap);
     let cstore = @CStore::new(token::get_ident_interner());
     let filesearch = @filesearch::FileSearch::new(
@@ -1167,8 +1156,8 @@ pub fn build_output_filenames(input: &Input,
     }
 }
 
-pub fn early_error(emitter: &diagnostic::Emitter, msg: &str) -> ! {
-    emitter.emit(None, msg, diagnostic::Fatal);
+pub fn early_error(msg: &str) -> ! {
+    diagnostic::DefaultEmitter.emit(None, msg, diagnostic::Fatal);
     fail!(diagnostic::FatalError);
 }
 
@@ -1198,8 +1187,8 @@ fn test_switch_implies_cfg_test() {
               Ok(m) => m,
               Err(f) => fail!("test_switch_implies_cfg_test: {}", f.to_err_msg())
             };
-        let sessopts = build_session_options(~"rustc", matches, @diagnostic::DefaultEmitter);
-        let sess = build_session(sessopts, None, @diagnostic::DefaultEmitter);
+        let sessopts = build_session_options(~"rustc", matches);
+        let sess = build_session(sessopts, None);
         let cfg = build_configuration(sess);
         assert!((attr::contains_name(cfg, "test")));
     }
@@ -1216,8 +1205,8 @@ fn test_switch_implies_cfg_test_unless_cfg_test() {
                        f.to_err_msg());
               }
             };
-        let sessopts = build_session_options(~"rustc", matches, @diagnostic::DefaultEmitter);
-        let sess = build_session(sessopts, None, @diagnostic::DefaultEmitter);
+        let sessopts = build_session_options(~"rustc", matches);
+        let sess = build_session(sessopts, None);
         let cfg = build_configuration(sess);
         let mut test_items = cfg.iter().filter(|m| m.name().equiv(&("test")));
         assert!(test_items.next().is_some());
index 2c7821f965f48f28fd2af53f50f4945776944e7b..452499af7cff9e42283ae8eed5993633d92c1ccf 100644 (file)
@@ -193,7 +193,7 @@ pub fn describe_debug_flags() {
     }
 }
 
-pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
+pub fn run_compiler(args: &[~str]) {
     let mut args = args.to_owned();
     let binary = args.shift().unwrap();
 
@@ -203,7 +203,7 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
         &match getopts::getopts(args, d::optgroups()) {
           Ok(m) => m,
           Err(f) => {
-            d::early_error(demitter, f.to_err_msg());
+            d::early_error(f.to_err_msg());
           }
         };
 
@@ -235,7 +235,7 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
         return;
     }
     let (input, input_file_path) = match matches.free.len() {
-      0u => d::early_error(demitter, "no input filename given"),
+      0u => d::early_error("no input filename given"),
       1u => {
         let ifile = matches.free[0].as_slice();
         if ifile == "-" {
@@ -246,11 +246,11 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
             (d::FileInput(Path::new(ifile)), Some(Path::new(ifile)))
         }
       }
-      _ => d::early_error(demitter, "multiple input filenames provided")
+      _ => d::early_error("multiple input filenames provided")
     };
 
-    let sopts = d::build_session_options(binary, matches, demitter);
-    let sess = d::build_session(sopts, input_file_path, demitter);
+    let sopts = d::build_session_options(binary, matches);
+    let sess = d::build_session(sopts, input_file_path);
     let odir = matches.opt_str("out-dir").map(|o| Path::new(o));
     let ofile = matches.opt_str("o").map(|o| Path::new(o));
     let cfg = d::build_configuration(sess);
@@ -273,7 +273,7 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
                              &mut stdout as &mut io::Writer).unwrap();
           }
           d::StrInput(_) => {
-            d::early_error(demitter, "can not list metadata for stdin");
+            d::early_error("can not list metadata for stdin");
           }
         }
         return;
@@ -337,7 +337,7 @@ fn parse_crate_attrs(sess: session::Session,
 ///
 /// The diagnostic emitter yielded to the procedure should be used for reporting
 /// errors of the compiler.
-pub fn monitor(f: proc(@diagnostic::Emitter)) {
+pub fn monitor(f: proc()) {
     // FIXME: This is a hack for newsched since it doesn't support split stacks.
     // rustc needs a lot of stack! When optimizations are disabled, it needs
     // even *more* stack than usual as well.
@@ -361,7 +361,7 @@ pub fn monitor(f: proc(@diagnostic::Emitter)) {
 
     match task_builder.try(proc() {
         io::stdio::set_stderr(~w as ~io::Writer);
-        f(@diagnostic::DefaultEmitter)
+        f()
     }) {
         Ok(()) => { /* fallthrough */ }
         Err(value) => {
@@ -400,6 +400,6 @@ pub fn main() {
 
 pub fn main_args(args: &[~str]) -> int {
     let owned_args = args.to_owned();
-    monitor(proc(demitter) run_compiler(owned_args, demitter));
+    monitor(proc() run_compiler(owned_args));
     0
 }
index d18017d00439be083683c6e5fd2672ab7b4d0597..029682d93159b95de8b9d92fac75862c18f60196 100644 (file)
@@ -772,7 +772,6 @@ fn get_mutability(ch: u8) -> ast::Mutability {
     match explicit_self_kind as char {
         's' => ast::SelfStatic,
         'v' => ast::SelfValue,
-        '@' => ast::SelfBox,
         '~' => ast::SelfUniq,
         // FIXME(#4846) expl. region
         '&' => ast::SelfRegion(None, get_mutability(string[1])),
index ba33f57309f8e41324d9adfa752443a881978c58..07997577a9ff6d8083496eccc93c734287392928 100644 (file)
@@ -671,7 +671,6 @@ fn encode_explicit_self(ebml_w: &mut writer::Encoder, explicit_self: ast::Explic
     match explicit_self {
         SelfStatic => { ebml_w.writer.write(&[ 's' as u8 ]); }
         SelfValue  => { ebml_w.writer.write(&[ 'v' as u8 ]); }
-        SelfBox    => { ebml_w.writer.write(&[ '@' as u8 ]); }
         SelfUniq   => { ebml_w.writer.write(&[ '~' as u8 ]); }
         SelfRegion(_, m) => {
             // FIXME(#4846) encode custom lifetime
index 92af631c2bd3e71a034bc9fcc3feaa63990feccc..8da097a1b6a2da25d87f664979af5990701c8106 100644 (file)
@@ -164,7 +164,6 @@ fn parse_vstore(st: &mut PState, conv: conv_did) -> ty::vstore {
 fn parse_trait_store(st: &mut PState, conv: conv_did) -> ty::TraitStore {
     match next(st) {
         '~' => ty::UniqTraitStore,
-        '@' => ty::BoxTraitStore,
         '&' => ty::RegionTraitStore(parse_region(st, conv)),
         c => st.tcx.sess.bug(format!("parse_trait_store(): bad input '{}'", c))
     }
index 913c5dac46039c687b80599a47f8a57f25f34769..4f6ac8607ee1b055a179e75379a6840e992733d5 100644 (file)
@@ -236,7 +236,6 @@ pub fn enc_trait_ref(w: &mut MemWriter, cx: @ctxt, s: &ty::TraitRef) {
 pub fn enc_trait_store(w: &mut MemWriter, cx: @ctxt, s: ty::TraitStore) {
     match s {
         ty::UniqTraitStore => mywrite!(w, "~"),
-        ty::BoxTraitStore => mywrite!(w, "@"),
         ty::RegionTraitStore(re) => {
             mywrite!(w, "&");
             enc_region(w, cx, re);
index 8adbd37462b9463f110925221d7d115c68706817..d59ec370e07b5cdef64f43471c0a81db287bea5f 100644 (file)
@@ -1427,10 +1427,7 @@ trait fake_ext_ctxt {
 }
 
 #[cfg(test)]
-type fake_session = @parse::ParseSess;
-
-#[cfg(test)]
-impl fake_ext_ctxt for fake_session {
+impl fake_ext_ctxt for @parse::ParseSess {
     fn cfg(&self) -> ast::CrateConfig { ~[] }
     fn parse_sess(&self) -> @parse::ParseSess { *self }
     fn call_site(&self) -> Span {
@@ -1446,8 +1443,8 @@ fn ident_of(&self, st: &str) -> ast::Ident {
 }
 
 #[cfg(test)]
-fn mk_ctxt() -> @fake_ext_ctxt {
-    @parse::new_parse_sess(None) as @fake_ext_ctxt
+fn mk_ctxt() -> @parse::ParseSess {
+    parse::new_parse_sess()
 }
 
 #[cfg(test)]
index 0ae1fefa2a077a380032eae92364f64ce34dccff..38d54ddfb4201de115fa84dfefef55cd375c0f49 100644 (file)
@@ -416,7 +416,7 @@ pub fn guarantee_adjustments(&mut self,
             }
 
             ty::AutoObject(..) => {
-                // FIXME: Handle @Trait to &Trait casts here?
+                // FIXME: Handle ~Trait to &Trait casts here?
             }
         }
     }
index 78221d2adb34191176b6228661d3e9d9e68cb6b9..6645450a970bc79754a38129ba29e611692611a1 100644 (file)
@@ -347,16 +347,15 @@ pub fn propagate(&mut self, blk: &ast::Block) {
 
         debug!("Dataflow result:");
         debug!("{}", {
-            let this = @(*self).clone();
-            this.pretty_print_to(~io::stderr() as ~io::Writer, blk).unwrap();
+            self.pretty_print_to(~io::stderr(), blk).unwrap();
             ""
         });
     }
 
-    fn pretty_print_to(@self, wr: ~io::Writer,
+    fn pretty_print_to(&self, wr: ~io::Writer,
                        blk: &ast::Block) -> io::IoResult<()> {
         let mut ps = pprust::rust_printer_annotated(wr, self.tcx.sess.intr(),
-                                                    self as @pprust::PpAnn);
+                                                    self as &pprust::PpAnn);
         if_ok!(pprust::cbox(&mut ps, pprust::indent_unit));
         if_ok!(pprust::ibox(&mut ps, 0u));
         if_ok!(pprust::print_block(&mut ps, blk));
index e674af6b3b3e3444254006fc3483a4f9d037b021..3568f59d9a2ded2f6620ecafaa698bb1664e80f9 100644 (file)
@@ -660,8 +660,7 @@ fn get_trait_def(&self, id: ast::DefId) -> @ty::TraitDef {
     }
 
     fn ty_infer(&self, _span: Span) -> ty::t {
-        let infcx: @infer::InferCtxt = infer::new_infer_ctxt(self.tcx);
-        infcx.next_ty_var()
+        infer::new_infer_ctxt(self.tcx).next_ty_var()
     }
 }
 
@@ -669,8 +668,7 @@ fn ty_infer(&self, _span: Span) -> ty::t {
 fn check_unused_casts(cx: &Context, e: &ast::Expr) {
     return match e.node {
         ast::ExprCast(expr, ty) => {
-            let infcx: @infer::InferCtxt = infer::new_infer_ctxt(cx.tcx);
-            let t_t = ast_ty_to_ty(cx, &infcx, ty);
+            let t_t = ast_ty_to_ty(cx, &infer::new_infer_ctxt(cx.tcx), ty);
             if  ty::get(ty::expr_ty(cx.tcx, expr)).sty == ty::get(t_t).sty {
                 cx.span_lint(UnnecessaryTypecast, ty.span,
                              "unnecessary type cast");
@@ -887,8 +885,7 @@ fn check_heap_type(cx: &Context, span: Span, ty: ty::t) {
         let mut n_uniq = 0;
         ty::fold_ty(cx.tcx, ty, |t| {
             match ty::get(t).sty {
-                ty::ty_box(_) |
-                ty::ty_trait(_, _, ty::BoxTraitStore, _, _) => {
+                ty::ty_box(_) => {
                     n_box += 1;
                 }
                 ty::ty_uniq(_) | ty::ty_str(ty::vstore_uniq) |
index 72fd98e56ed6743548907bc974b4d4d5d48ccb09..7c5d1439edfcbe02b3066afcbc9a28fd0e289a30 100644 (file)
@@ -177,8 +177,7 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
             Some(deref_ptr(region_ptr(ast::MutImmutable, r)))
         }
 
-        ty::ty_box(_) |
-        ty::ty_trait(_, _, ty::BoxTraitStore, _, _) => {
+        ty::ty_box(_) => {
             Some(deref_ptr(gc_ptr))
         }
 
@@ -1105,7 +1104,7 @@ pub enum AliasableReason {
 }
 
 impl cmt_ {
-    pub fn guarantor(@self) -> cmt {
+    pub fn guarantor(self) -> cmt {
         //! Returns `self` after stripping away any owned pointer derefs or
         //! interior content. The return value is basically the `cmt` which
         //! determines how long the value in `self` remains live.
@@ -1119,7 +1118,7 @@ pub fn guarantor(@self) -> cmt {
             cat_deref(_, _, unsafe_ptr(..)) |
             cat_deref(_, _, gc_ptr) |
             cat_deref(_, _, region_ptr(..)) => {
-                self
+                @self
             }
             cat_downcast(b) |
             cat_stack_upvar(b) |
index 44410ae24b9e4b3a0bba5d39be627ddc6fabefc6..e54b2ab29b2e96faba91936326670cd56d19d072 100644 (file)
@@ -34,7 +34,7 @@ pub fn check_not_terminated(cx: &Block) {
     }
 }
 
-pub fn B(cx: &Block) -> Builder {
+pub fn B<'a>(cx: &'a Block) -> Builder<'a> {
     let b = cx.fcx.ccx.builder();
     b.position_at_end(cx.llbb);
     b
index cedd98e261cc7a1c207b7ebf855ce9e74d297af0..e4eeaa5fded7f7fbb500cf657bd1fc5e1ba0b2fb 100644 (file)
@@ -23,9 +23,9 @@
 use syntax::codemap::Span;
 use std::ptr::is_not_null;
 
-pub struct Builder {
+pub struct Builder<'a> {
     llbuilder: BuilderRef,
-    ccx: @CrateContext,
+    ccx: &'a CrateContext,
 }
 
 // This is a really awful way to get a zero-length c-string, but better (and a
@@ -37,8 +37,8 @@ pub fn noname() -> *c_char {
     }
 }
 
-impl Builder {
-    pub fn new(ccx: @CrateContext) -> Builder {
+impl<'a> Builder<'a> {
+    pub fn new(ccx: &'a CrateContext) -> Builder<'a> {
         Builder {
             llbuilder: ccx.builder.B,
             ccx: ccx,
index 2872d5566339bb0b5f65c795a2ac8b590267f11b..93d874cf83ee4a06ecd512b6f4084993ca45dd1e 100644 (file)
@@ -237,7 +237,7 @@ pub fn new(sess: session::Session,
         }
     }
 
-    pub fn builder(@self) -> Builder {
+    pub fn builder<'a>(&'a self) -> Builder<'a> {
         Builder::new(self)
     }
 
index 3cdb1c52d3c5beea3fdbd93ed65a222ab4accf01..ed233142238dcd6002b4f3de82fa97cd2cd8fb42 100644 (file)
@@ -1130,9 +1130,31 @@ fn pointer_type_metadata(cx: &CrateContext,
     return ptr_metadata;
 }
 
-trait MemberDescriptionFactory {
+enum MemberDescriptionFactory {
+    StructMD(StructMemberDescriptionFactory),
+    TupleMD(TupleMemberDescriptionFactory),
+    GeneralMD(GeneralMemberDescriptionFactory),
+    EnumVariantMD(EnumVariantMemberDescriptionFactory)
+}
+
+impl MemberDescriptionFactory {
     fn create_member_descriptions(&self, cx: &CrateContext)
-                                  -> ~[MemberDescription];
+                                  -> ~[MemberDescription] {
+        match *self {
+            StructMD(ref this) => {
+                this.create_member_descriptions(cx)
+            }
+            TupleMD(ref this) => {
+                this.create_member_descriptions(cx)
+            }
+            GeneralMD(ref this) => {
+                this.create_member_descriptions(cx)
+            }
+            EnumVariantMD(ref this) => {
+                this.create_member_descriptions(cx)
+            }
+        }
+    }
 }
 
 struct StructMemberDescriptionFactory {
@@ -1140,7 +1162,7 @@ struct StructMemberDescriptionFactory {
     span: Span,
 }
 
-impl MemberDescriptionFactory for StructMemberDescriptionFactory {
+impl StructMemberDescriptionFactory {
     fn create_member_descriptions(&self, cx: &CrateContext)
                                   -> ~[MemberDescription] {
         self.fields.map(|field| {
@@ -1189,10 +1211,10 @@ fn prepare_struct_metadata(cx: &CrateContext,
         metadata_stub: struct_metadata_stub,
         llvm_type: struct_llvm_type,
         file_metadata: file_metadata,
-        member_description_factory: @StructMemberDescriptionFactory {
+        member_description_factory: StructMD(StructMemberDescriptionFactory {
             fields: fields,
             span: span,
-        } as @MemberDescriptionFactory,
+        }),
     }
 }
 
@@ -1202,7 +1224,7 @@ enum RecursiveTypeDescription {
         metadata_stub: DICompositeType,
         llvm_type: Type,
         file_metadata: DIFile,
-        member_description_factory: @MemberDescriptionFactory,
+        member_description_factory: MemberDescriptionFactory,
     },
     FinalMetadata(DICompositeType)
 }
@@ -1217,7 +1239,7 @@ fn finalize(&self, cx: &CrateContext) -> DICompositeType {
                 metadata_stub,
                 llvm_type,
                 file_metadata,
-                member_description_factory
+                ref member_description_factory
             } => {
                 // Insert the stub into the cache in order to allow recursive references ...
                 {
@@ -1246,7 +1268,7 @@ struct TupleMemberDescriptionFactory {
     span: Span,
 }
 
-impl MemberDescriptionFactory for TupleMemberDescriptionFactory {
+impl TupleMemberDescriptionFactory {
     fn create_member_descriptions(&self, cx: &CrateContext)
                                   -> ~[MemberDescription] {
         self.component_types.map(|&component_type| {
@@ -1281,10 +1303,10 @@ fn prepare_tuple_metadata(cx: &CrateContext,
                                           span),
         llvm_type: tuple_llvm_type,
         file_metadata: file_metadata,
-        member_description_factory: @TupleMemberDescriptionFactory {
+        member_description_factory: TupleMD(TupleMemberDescriptionFactory {
             component_types: component_types.to_owned(),
             span: span,
-        } as @MemberDescriptionFactory
+        })
     }
 }
 
@@ -1297,7 +1319,7 @@ struct GeneralMemberDescriptionFactory {
     span: Span,
 }
 
-impl MemberDescriptionFactory for GeneralMemberDescriptionFactory {
+impl GeneralMemberDescriptionFactory {
     fn create_member_descriptions(&self, cx: &CrateContext)
                                   -> ~[MemberDescription] {
         // Capture type_rep, so we don't have to copy the struct_defs array
@@ -1344,7 +1366,7 @@ struct EnumVariantMemberDescriptionFactory {
     span: Span,
 }
 
-impl MemberDescriptionFactory for EnumVariantMemberDescriptionFactory {
+impl EnumVariantMemberDescriptionFactory {
     fn create_member_descriptions(&self, cx: &CrateContext)
                                   -> ~[MemberDescription] {
         self.args.iter().enumerate().map(|(i, &(ref name, ty))| {
@@ -1368,7 +1390,7 @@ fn describe_enum_variant(cx: &CrateContext,
                          containing_scope: DIScope,
                          file_metadata: DIFile,
                          span: Span)
-                      -> (DICompositeType, Type, @MemberDescriptionFactory) {
+                      -> (DICompositeType, Type, MemberDescriptionFactory) {
     let variant_info_string = token::get_ident(variant_info.name.name);
     let variant_name = variant_info_string.get();
     let variant_llvm_type = Type::struct_(struct_def.fields.map(|&t| type_of::type_of(cx, t)),
@@ -1424,11 +1446,11 @@ fn describe_enum_variant(cx: &CrateContext,
         .collect();
 
     let member_description_factory =
-        @EnumVariantMemberDescriptionFactory {
+        EnumVariantMD(EnumVariantMemberDescriptionFactory {
             args: args,
             discriminant_type_metadata: discriminant_type_metadata,
             span: span,
-        } as @MemberDescriptionFactory;
+        });
 
     (metadata_stub, variant_llvm_type, member_description_factory)
 }
@@ -1556,14 +1578,14 @@ fn prepare_enum_metadata(cx: &CrateContext,
                 metadata_stub: enum_metadata,
                 llvm_type: enum_llvm_type,
                 file_metadata: file_metadata,
-                member_description_factory: @GeneralMemberDescriptionFactory {
+                member_description_factory: GeneralMD(GeneralMemberDescriptionFactory {
                     type_rep: type_rep,
                     variants: variants,
                     discriminant_type_metadata: discriminant_type_metadata,
                     containing_scope: containing_scope,
                     file_metadata: file_metadata,
                     span: span,
-                } as @MemberDescriptionFactory,
+                }),
             }
         }
         adt::NullablePointer { nonnull: ref struct_def, nndiscr, .. } => {
index 517f9e1a31d81c7ff643ed25b6b7419859edfc88..8f0101efb168cebc14915d324d014a38f043e3da 100644 (file)
@@ -213,8 +213,7 @@ fn apply_adjustments<'a>(bcx: &'a Block<'a>,
                     unpack_datum!(bcx, auto_borrow_fn(bcx, adjusted_ty, datum))
                 }
                 Some(AutoBorrowObj(..)) => {
-                    unpack_datum!(bcx, auto_borrow_obj(
-                        bcx, adj.autoderefs, expr, datum))
+                    unpack_datum!(bcx, auto_borrow_obj(bcx, expr, datum))
                 }
             };
         }
@@ -326,88 +325,17 @@ fn auto_slice_and_ref<'a>(
         auto_ref(bcx, datum, expr)
     }
 
-    fn auto_borrow_obj<'a>(
-                       mut bcx: &'a Block<'a>,
-                       autoderefs: uint,
-                       expr: &ast::Expr,
-                       source_datum: Datum<Expr>)
-                       -> DatumBlock<'a, Expr> {
+    fn auto_borrow_obj<'a>(bcx: &'a Block<'a>,
+                           expr: &ast::Expr,
+                           source_datum: Datum<Expr>)
+                           -> DatumBlock<'a, Expr> {
         let tcx = bcx.tcx();
         let target_obj_ty = expr_ty_adjusted(bcx, expr);
-        debug!("auto_borrow_obj(target={})",
-               target_obj_ty.repr(tcx));
-
-        // Extract source store information
-        let (source_store, source_mutbl) = match ty::get(source_datum.ty).sty {
-            ty::ty_trait(_, _, s, m, _) => (s, m),
-            _ => {
-                bcx.sess().span_bug(
-                    expr.span,
-                    format!("auto_borrow_trait_obj expected a trait, found {}",
-                         source_datum.ty.repr(bcx.tcx())));
-            }
-        };
-
-        // check if any borrowing is really needed or we could reuse
-        // the source_datum instead
-        match ty::get(target_obj_ty).sty {
-            ty::ty_trait(_, _, ty::RegionTraitStore(target_scope), target_mutbl, _) => {
-                if target_mutbl == ast::MutImmutable && target_mutbl == source_mutbl {
-                    match source_store {
-                        ty::RegionTraitStore(source_scope) => {
-                            if tcx.region_maps.is_subregion_of(target_scope, source_scope) {
-                                return DatumBlock { bcx: bcx, datum: source_datum };
-                            }
-                        },
-                        _ => {}
+        debug!("auto_borrow_obj(target={})", target_obj_ty.repr(tcx));
 
-                    };
-                }
-            },
-            _ => {}
-        }
-
-        let scratch = rvalue_scratch_datum(bcx, target_obj_ty,
-                                           "__auto_borrow_obj");
-
-        // Convert a @Object, ~Object, or &Object pair into an &Object pair.
-
-        // Get a pointer to the source object, which is represented as
-        // a (vtable, data) pair.
-        let source_datum = unpack_datum!(
-            bcx, source_datum.to_lvalue_datum(bcx, "auto_borrow_obj", expr.id));
-        let source_llval = source_datum.to_llref();
-
-        // Set the vtable field of the new pair
-        let vtable_ptr = GEPi(bcx, source_llval, [0u, abi::trt_field_vtable]);
-        let vtable = Load(bcx, vtable_ptr);
-        Store(bcx, vtable, GEPi(bcx, scratch.val, [0u, abi::trt_field_vtable]));
-
-        // Load the data for the source, which is either an @T,
-        // ~T, or &T, depending on source_obj_ty.
-        let source_data_ptr = GEPi(bcx, source_llval, [0u, abi::trt_field_box]);
-        let target_data = match source_store {
-            ty::BoxTraitStore(..) => {
-                // For deref of @T, create a dummy datum and use the
-                // datum's deref method. This is more work than just
-                // calling GEPi ourselves, but it ensures that any
-                // necessary rooting is performed. Note that we don't
-                // know the type T, so just substitute `i8`-- it
-                // doesn't really matter for our purposes right now.
-                let source_ty = ty::mk_box(tcx, ty::mk_i8());
-                let source_datum = Datum(source_data_ptr, source_ty, LvalueExpr);
-                let derefd_datum = unpack_datum!(
-                    bcx, deref_once(bcx, expr, source_datum, autoderefs));
-                derefd_datum.assert_lvalue(bcx).to_llref()
-            }
-            ty::UniqTraitStore(..) | ty::RegionTraitStore(..) => {
-                Load(bcx, source_data_ptr)
-            }
-        };
-        Store(bcx, target_data,
-              GEPi(bcx, scratch.val, [0u, abi::trt_field_box]));
-
-        DatumBlock(bcx, scratch.to_expr_datum())
+        let mut datum = source_datum.to_expr_datum();
+        datum.ty = target_obj_ty;
+        DatumBlock(bcx, datum)
     }
 }
 
index 99eccb8f40b99250e4e414184b2f3e5d601bdb9f..abf77b4b5fa950a55363e308f62d2d159a8525ac 100644 (file)
@@ -65,9 +65,6 @@ pub fn take_ty<'a>(bcx: &'a Block<'a>, v: ValueRef, t: ty::t)
     let _icx = push_ctxt("take_ty");
     match ty::get(t).sty {
         ty::ty_box(_) => incr_refcnt_of_boxed(bcx, v),
-        ty::ty_trait(_, _, ty::BoxTraitStore, _, _) => {
-            incr_refcnt_of_boxed(bcx, GEPi(bcx, v, [0u, abi::trt_field_box]))
-        }
         _ if ty::type_is_structural(t)
           && ty::type_needs_drop(bcx.tcx(), t) => {
             iter_structural_ty(bcx, v, t, take_ty)
@@ -323,7 +320,7 @@ fn make_drop_glue<'a>(bcx: &'a Block<'a>, v0: ValueRef, t: ty::t) -> &'a Block<'
     let ccx = bcx.ccx();
     match ty::get(t).sty {
         ty::ty_box(body_ty) => {
-            decr_refcnt_maybe_free(bcx, v0, Some(body_ty))
+            decr_refcnt_maybe_free(bcx, v0, body_ty)
         }
         ty::ty_uniq(content_ty) => {
             let llbox = Load(bcx, v0);
@@ -354,10 +351,6 @@ fn make_drop_glue<'a>(bcx: &'a Block<'a>, v0: ValueRef, t: ty::t) -> &'a Block<'
                 }
             }
         }
-        ty::ty_trait(_, _, ty::BoxTraitStore, _, _) => {
-            let llbox_ptr = GEPi(bcx, v0, [0u, abi::trt_field_box]);
-            decr_refcnt_maybe_free(bcx, llbox_ptr, None)
-        }
         ty::ty_trait(_, _, ty::UniqTraitStore, _, _) => {
             let lluniquevalue = GEPi(bcx, v0, [0, abi::trt_field_box]);
             // Only drop the value when it is non-null
@@ -400,8 +393,9 @@ fn make_drop_glue<'a>(bcx: &'a Block<'a>, v0: ValueRef, t: ty::t) -> &'a Block<'
     }
 }
 
-fn decr_refcnt_maybe_free<'a>(bcx: &'a Block<'a>, box_ptr_ptr: ValueRef,
-                              t: Option<ty::t>) -> &'a Block<'a> {
+fn decr_refcnt_maybe_free<'a>(bcx: &'a Block<'a>,
+                              box_ptr_ptr: ValueRef,
+                              t: ty::t) -> &'a Block<'a> {
     let _icx = push_ctxt("decr_refcnt_maybe_free");
     let fcx = bcx.fcx;
     let ccx = bcx.ccx();
@@ -421,16 +415,7 @@ fn decr_refcnt_maybe_free<'a>(bcx: &'a Block<'a>, box_ptr_ptr: ValueRef,
 
     let v = Load(free_bcx, box_ptr_ptr);
     let body = GEPi(free_bcx, v, [0u, abi::box_field_body]);
-    let free_bcx = match t {
-        Some(t) => drop_ty(free_bcx, body, t),
-        None => {
-            // Generate code that, dynamically, indexes into the
-            // tydesc and calls the drop glue that got set dynamically
-            let td = Load(free_bcx, GEPi(free_bcx, v, [0u, abi::box_field_tydesc]));
-            call_tydesc_glue_full(free_bcx, body, td, abi::tydesc_field_drop_glue, None);
-            free_bcx
-        }
-    };
+    let free_bcx = drop_ty(free_bcx, body, t);
     let free_bcx = trans_free(free_bcx, v);
     Br(free_bcx, next_bcx.llbb);
 
index b13a8800cee84d238d621e0df6c2adf689c0ba7a..5d1c67a27ba2e6969628125d588f5d73f6032ba8 100644 (file)
@@ -350,7 +350,7 @@ fn trans_trait_callee<'a>(bcx: &'a Block<'a>,
                           -> Callee<'a> {
     /*!
      * Create a method callee where the method is coming from a trait
-     * object (e.g., @Trait type).  In this case, we must pull the fn
+     * object (e.g., ~Trait type).  In this case, we must pull the fn
      * pointer out of the vtable that is packaged up with the object.
      * Objects are represented as a pair, so we first evaluate the self
      * expression and then extract the self data and vtable out of the
index 39a99ef995012f9d9cceb7ef24cb4f484ac982f5..8eccbf8d956a7420293cfb057504413d744a4c0d 100644 (file)
@@ -13,8 +13,6 @@
 use lib::llvm::{llvm, TypeRef, Bool, False, True, TypeKind};
 use lib::llvm::{Float, Double, X86_FP80, PPC_FP128, FP128};
 
-use middle::ty;
-
 use middle::trans::context::CrateContext;
 use middle::trans::base;
 
@@ -245,14 +243,9 @@ pub fn at_box(ctx: &CrateContext, ty: Type) -> Type {
         ], false)
     }
 
-    pub fn opaque_trait(ctx: &CrateContext, store: ty::TraitStore) -> Type {
+    pub fn opaque_trait() -> Type {
         let vtable = Type::glue_fn(Type::i8p()).ptr_to().ptr_to();
-        let box_ty = match store {
-            ty::BoxTraitStore => Type::at_box(ctx, Type::i8()),
-            ty::UniqTraitStore => Type::i8(),
-            ty::RegionTraitStore(..) => Type::i8()
-        };
-        Type::struct_([vtable, box_ty.ptr_to()], false)
+        Type::struct_([vtable, Type::i8p()], false)
     }
 
     pub fn kind(&self) -> TypeKind {
index 0bc5ffd10196f78c4debeabcf7e1a43a5227a384..00d67a60ac4831cb2a2c4a37b16a7f0e1e0bfd41 100644 (file)
@@ -129,7 +129,7 @@ pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type {
 
         ty::ty_bare_fn(..) => Type::i8p(),
         ty::ty_closure(..) => Type::struct_([Type::i8p(), Type::i8p()], false),
-        ty::ty_trait(_, _, store, _, _) => Type::opaque_trait(cx, store),
+        ty::ty_trait(..) => Type::opaque_trait(),
 
         ty::ty_str(ty::vstore_fixed(size)) => Type::array(&Type::i8(), size as u64),
         ty::ty_vec(mt, ty::vstore_fixed(size)) => {
@@ -262,7 +262,7 @@ pub fn type_of(cx: &CrateContext, t: ty::t) -> Type {
           let fn_ty = type_of_fn_from_ty(cx, t).ptr_to();
           Type::struct_([fn_ty, Type::i8p()], false)
       }
-      ty::ty_trait(_, _, store, _, _) => Type::opaque_trait(cx, store),
+      ty::ty_trait(..) => Type::opaque_trait(),
       ty::ty_type => cx.tydesc_type.ptr_to(),
       ty::ty_tup(..) => {
           let repr = adt::represent_type(cx, t);
index 003a10eb48258967753a84b73c66fd3b19851db9..1ff6da63fea24681f2717d42c44c32c388fbc39b 100644 (file)
@@ -135,7 +135,6 @@ pub enum vstore {
 
 #[deriving(Clone, Eq, IterBytes, Encodable, Decodable, ToStr)]
 pub enum TraitStore {
-    BoxTraitStore,              // @Trait
     UniqTraitStore,             // ~Trait
     RegionTraitStore(Region),   // &Trait
 }
@@ -238,7 +237,7 @@ pub enum AutoRef {
     /// Convert from T to *T
     AutoUnsafe(ast::Mutability),
 
-    /// Convert from @Trait/~Trait/&Trait to &Trait
+    /// Convert from ~Trait/&Trait to &Trait
     AutoBorrowObj(Region, ast::Mutability),
 }
 
@@ -2156,10 +2155,9 @@ fn closure_contents(cx: ctxt, cty: &ClosureTy) -> TypeContents {
         let st = match cty.sigil {
             ast::BorrowedSigil =>
                 object_contents(cx, RegionTraitStore(cty.region), MutMutable, cty.bounds),
-            ast::ManagedSigil =>
-                object_contents(cx, BoxTraitStore, MutImmutable, cty.bounds),
             ast::OwnedSigil =>
                 object_contents(cx, UniqTraitStore, MutImmutable, cty.bounds),
+            ast::ManagedSigil => unreachable!()
         };
 
         // FIXME(#3569): This borrowed_contents call should be taken care of in
@@ -2190,9 +2188,6 @@ fn object_contents(cx: ctxt,
             UniqTraitStore => {
                 contents.owned_pointer()
             }
-            BoxTraitStore => {
-                contents.managed_pointer()
-            }
             RegionTraitStore(r) => {
                 contents.reference(borrowed_contents(r, mutbl))
             }
@@ -3060,7 +3055,7 @@ pub fn trait_adjustment_to_ty(cx: ctxt, sigil: &ast::Sigil, region: &Option<Regi
     let trait_store = match *sigil {
         BorrowedSigil => RegionTraitStore(region.expect("expected valid region")),
         OwnedSigil => UniqTraitStore,
-        ManagedSigil => BoxTraitStore
+        ManagedSigil => unreachable!()
     };
 
     mk_trait(cx, def_id, substs.clone(), trait_store, m, bounds)
@@ -4935,10 +4930,9 @@ fn iter<T: IterBytes>(hash: &mut SipState, t: &T) {
                 hash.input([17]);
                 did(&mut hash, d);
                 match store {
-                    BoxTraitStore => hash.input([0]),
-                    UniqTraitStore => hash.input([1]),
+                    UniqTraitStore => hash.input([0]),
                     RegionTraitStore(r) => {
-                        hash.input([2]);
+                        hash.input([1]);
                         region(&mut hash, r);
                     }
                 }
index 63d6e2ae4428a53f3bcc98c3ee8f794df0c482d2..9c923077d7d60fda8d519e2d54f1595cd1c03378 100644 (file)
@@ -211,7 +211,6 @@ pub fn super_fold_trait_store<T:TypeFolder>(this: &mut T,
                                             -> ty::TraitStore {
     match trait_store {
         ty::UniqTraitStore      => ty::UniqTraitStore,
-        ty::BoxTraitStore       => ty::BoxTraitStore,
         ty::RegionTraitStore(r) => ty::RegionTraitStore(this.fold_region(r)),
     }
 }
index 906bb504bb05326c9d698ef0bd66056331134289..f80658e8ac20bf168900fe3f958de4fa4e6edabc 100644 (file)
@@ -409,7 +409,7 @@ fn expect_vstore(&self, tcx: ty::ctxt, span: Span, ty: &str) -> ty::vstore {
         }
     }
 
-    // Handle @, ~, and & being able to mean strs and vecs.
+    // Handle ~, and & being able to mean strs and vecs.
     // If a_seq_ty is a str or a vec, make it a str/vec.
     // Also handle first-class trait types.
     fn mk_pointer<AC:AstConv,
@@ -449,17 +449,16 @@ fn mk_pointer<AC:AstConv,
                         let result = ast_path_to_trait_ref(
                             this, rscope, trait_def_id, None, path);
                         let trait_store = match ptr_ty {
-                            Box => ty::BoxTraitStore,
                             VStore(ty::vstore_uniq) => ty::UniqTraitStore,
                             VStore(ty::vstore_slice(r)) => {
                                 ty::RegionTraitStore(r)
                             }
-                            VStore(ty::vstore_fixed(..)) => {
+                            _ => {
                                 tcx.sess.span_err(
                                     path.span,
-                                    "@trait, ~trait or &trait are the only supported \
+                                    "~trait or &trait are the only supported \
                                      forms of casting-to-trait");
-                                ty::BoxTraitStore
+                                return ty::mk_err();
                             }
                         };
                         let bounds = conv_builtin_bounds(this.tcx(), bounds, trait_store);
@@ -546,7 +545,7 @@ fn mk_pointer<AC:AstConv,
                         // if none were specified.
                         ast::BorrowedSigil => ty::RegionTraitStore(ty::ReEmpty), // dummy region
                         ast::OwnedSigil    => ty::UniqTraitStore,
-                        ast::ManagedSigil  => ty::BoxTraitStore,
+                        ast::ManagedSigil  => return ty::mk_err()
                     });
                 let fn_decl = ty_of_closure(this,
                                             rscope,
@@ -718,9 +717,6 @@ fn ty_of_method_or_bare_fn<AC:AstConv>(this: &AC, id: ast::NodeId,
                                  ty::mt {ty: self_info.untransformed_self_ty,
                                          mutbl: mutability}))
             }
-            ast::SelfBox => {
-                Some(ty::mk_box(this.tcx(), self_info.untransformed_self_ty))
-            }
             ast::SelfUniq => {
                 Some(ty::mk_uniq(this.tcx(), self_info.untransformed_self_ty))
             }
@@ -868,9 +864,7 @@ fn conv_builtin_bounds(tcx: ty::ctxt, ast_bounds: &Option<OptVec<ast::TyParamBou
         (&None, ty::UniqTraitStore) => {
             let mut set = ty::EmptyBuiltinBounds(); set.add(ty::BoundSend); set
         }
-        // @Trait is sugar for @Trait:'static.
         // &'static Trait is sugar for &'static Trait:'static.
-        (&None, ty::BoxTraitStore) |
         (&None, ty::RegionTraitStore(ty::ReStatic)) => {
             let mut set = ty::EmptyBuiltinBounds(); set.add(ty::BoundStatic); set
         }
index d32d51c251a86277a3647183ee2169826a982e19..2463bf679d08f5cdc80bc543da40237c93a154b6 100644 (file)
@@ -72,9 +72,9 @@ trait `ToStr` imported, and I call `to_str()` on a value of type `T`,
 proceed by progressively deref'ing the receiver type, after all.  The
 answer is that two phases are needed to elegantly deal with explicit
 self.  After all, if there is an impl for the type `Foo`, it can
-define a method with the type `@self`, which means that it expects a
-receiver of type `@Foo`.  If we have a receiver of type `@Foo`, but we
-waited to search for that impl until we have deref'd the `@` away and
+define a method with the type `~self`, which means that it expects a
+receiver of type `~Foo`.  If we have a receiver of type `~Foo`, but we
+waited to search for that impl until we have deref'd the `~` away and
 obtained the type `Foo`, we would never match this method.
 
 */
@@ -101,7 +101,7 @@ trait `ToStr` imported, and I call `to_str()` on a value of type `T`,
 use std::hashmap::HashSet;
 use std::result;
 use std::vec;
-use syntax::ast::{DefId, SelfValue, SelfRegion, SelfBox};
+use syntax::ast::{DefId, SelfValue, SelfRegion};
 use syntax::ast::{SelfUniq, SelfStatic, NodeId};
 use syntax::ast::{MutMutable, MutImmutable};
 use syntax::ast;
@@ -201,8 +201,8 @@ pub struct Candidate {
 /// considered to "match" a given method candidate. Typically the test
 /// is whether the receiver is of a particular type. However, this
 /// type is the type of the receiver *after accounting for the
-/// method's self type* (e.g., if the method is an `@self` method, we
-/// have *already verified* that the receiver is of some type `@T` and
+/// method's self type* (e.g., if the method is an `~self` method, we
+/// have *already verified* that the receiver is of some type `~T` and
 /// now we must check that the type `T` is correct).  Unfortunately,
 /// because traits are not types, this is a pain to do.
 #[deriving(Clone)]
@@ -1081,7 +1081,7 @@ fn construct_transformed_self_ty_for_object(
             ast::SelfValue => {
                 ty::mk_err() // error reported in `enforce_object_limitations()`
             }
-            ast::SelfRegion(..) | ast::SelfBox | ast::SelfUniq => {
+            ast::SelfRegion(..) | ast::SelfUniq => {
                 let transformed_self_ty = method_ty.fty.sig.inputs[0];
                 match ty::get(transformed_self_ty).sty {
                     ty::ty_rptr(r, mt) => { // must be SelfRegion
@@ -1089,11 +1089,6 @@ fn construct_transformed_self_ty_for_object(
                                      substs, RegionTraitStore(r), mt.mutbl,
                                      ty::EmptyBuiltinBounds())
                     }
-                    ty::ty_box(_) => { // must be SelfBox
-                        ty::mk_trait(self.tcx(), trait_def_id,
-                                     substs, BoxTraitStore, ast::MutImmutable,
-                                     ty::EmptyBuiltinBounds())
-                    }
                     ty::ty_uniq(_) => { // must be SelfUniq
                         ty::mk_trait(self.tcx(), trait_def_id,
                                      substs, UniqTraitStore, ast::MutImmutable,
@@ -1140,7 +1135,7 @@ fn enforce_object_limitations(&self, candidate: &Candidate) {
                      through an object");
             }
 
-            ast::SelfRegion(..) | ast::SelfBox | ast::SelfUniq => {}
+            ast::SelfRegion(..) | ast::SelfUniq => {}
         }
 
         // reason (a) above
@@ -1232,21 +1227,6 @@ fn is_relevant(&self, rcvr_ty: ty::t, candidate: &Candidate) -> bool {
                 }
             }
 
-            SelfBox => {
-                debug!("(is relevant?) explicit self is a box");
-                match ty::get(rcvr_ty).sty {
-                    ty::ty_box(typ) => {
-                        rcvr_matches_ty(self.fcx, typ, candidate)
-                    }
-
-                    ty::ty_trait(self_did, _, BoxTraitStore, ast::MutImmutable, _) => {
-                        rcvr_matches_object(self_did, candidate)
-                    }
-
-                    _ => false
-                }
-            }
-
             SelfUniq => {
                 debug!("(is relevant?) explicit self is a unique pointer");
                 match ty::get(rcvr_ty).sty {
@@ -1360,8 +1340,8 @@ fn report_trait_candidate(&self, idx: uint, did: DefId) {
                  ty::item_path_str(self.tcx(), did)));
     }
 
-    fn infcx(&self) -> @infer::InferCtxt {
-        self.fcx.inh.infcx
+    fn infcx(&'a self) -> &'a infer::InferCtxt {
+        &self.fcx.inh.infcx
     }
 
     fn tcx(&self) -> ty::ctxt {
index e1679c81a0e2db6c682337587d2b9927c53e864b..42d9e6f88e2897ad171dbe817c13d1efa37f4b12 100644 (file)
 /// `bar()` will each have their own `FnCtxt`, but they will
 /// share the inherited fields.
 pub struct Inherited {
-    infcx: @infer::InferCtxt,
+    infcx: infer::InferCtxt,
     locals: @RefCell<HashMap<ast::NodeId, ty::t>>,
     param_env: ty::ParameterEnvironment,
 
@@ -936,7 +936,7 @@ fn compare_impl_method(tcx: ty::ctxt,
     };
     debug!("trait_fty (post-subst): {}", trait_fty.repr(tcx));
 
-    match infer::mk_subty(infcx, false, infer::MethodCompatCheck(impl_m_span),
+    match infer::mk_subty(&infcx, false, infer::MethodCompatCheck(impl_m_span),
                           impl_fty, trait_fty) {
         result::Ok(()) => {}
         result::Err(ref terr) => {
@@ -967,8 +967,8 @@ fn ty_infer(&self, _span: Span) -> ty::t {
 }
 
 impl FnCtxt {
-    pub fn infcx(&self) -> @infer::InferCtxt {
-        self.inh.infcx
+    pub fn infcx<'a>(&'a self) -> &'a infer::InferCtxt {
+        &self.inh.infcx
     }
 
     pub fn err_count_since_creation(&self) -> uint {
@@ -983,13 +983,12 @@ 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], ()> {
-        Ok(vec::from_fn(
-                count,
-                |_| self.next_region_var(infer::MiscVariable(span))))
+impl RegionScope for infer::InferCtxt {
+    fn anon_regions(&self, span: Span, count: uint)
+                    -> Result<~[ty::Region], ()> {
+        Ok(vec::from_fn(count, |_| {
+            self.next_region_var(infer::MiscVariable(span))
+        }))
     }
 }
 
@@ -1076,7 +1075,7 @@ pub fn write_error(&self, node_id: ast::NodeId) {
     }
 
     pub fn to_ty(&self, ast_t: &ast::Ty) -> ty::t {
-        ast_ty_to_ty(self, &self.infcx(), ast_t)
+        ast_ty_to_ty(self, self.infcx(), ast_t)
     }
 
     pub fn pat_to_str(&self, pat: &ast::Pat) -> ~str {
@@ -2243,7 +2242,7 @@ fn check_expr_fn(fcx: @FnCtxt,
 
         // construct the function type
         let fn_ty = astconv::ty_of_closure(fcx,
-                                           &fcx.infcx(),
+                                           fcx.infcx(),
                                            expr.id,
                                            sigil,
                                            purity,
index 6d46cd38087c73fb93d640d9a668670e8a9e610c..1a45a1d549137d2c6d95c2c6df354d81644d1827 100644 (file)
@@ -1213,9 +1213,7 @@ fn pointer_categorize(ty: ty::t) -> PointerCategorization {
             ty::ty_vec(_, ty::vstore_uniq) => {
                 OwnedPointer
             }
-            ty::ty_box(..) |
-            ty::ty_ptr(..) |
-            ty::ty_trait(_, _, ty::BoxTraitStore, _, _) => {
+            ty::ty_box(..) | ty::ty_ptr(..) => {
                 OtherPointer
             }
             ty::ty_closure(ref closure_ty) => {
index 4db43b2c9137089bdcd7fd7dd23c578569a011a3..64589e64f9837e2a83324435331870aea670c575 100644 (file)
@@ -73,7 +73,7 @@ pub struct LocationInfo {
 /// A vtable context includes an inference context, a crate context, and a
 /// callback function to call in case of type error.
 pub struct VtableContext<'a> {
-    infcx: @infer::InferCtxt,
+    infcx: &'a infer::InferCtxt,
     param_env: &'a ty::ParameterEnvironment,
 }
 
@@ -578,11 +578,10 @@ fn mutability_allowed(a_mutbl: ast::Mutability,
               // Look up vtables for the type we're casting to,
               // passing in the source and target type.  The source
               // must be a pointer type suitable to the object sigil,
-              // e.g.: `@x as @Trait`, `&x as &Trait` or `~x as ~Trait`
+              // e.g.: `&x as &Trait` or `~x as ~Trait`
               let ty = structurally_resolved_type(fcx, ex.span,
                                                   fcx.expr_ty(src));
               match (&ty::get(ty).sty, store) {
-                  (&ty::ty_box(..), ty::BoxTraitStore) |
                   (&ty::ty_uniq(..), ty::UniqTraitStore)
                     if !mutability_allowed(ast::MutImmutable,
                                            target_mutbl) => {
@@ -596,7 +595,6 @@ fn mutability_allowed(a_mutbl: ast::Mutability,
                                               format!("types differ in mutability"));
                   }
 
-                  (&ty::ty_box(..), ty::BoxTraitStore) |
                   (&ty::ty_uniq(..), ty::UniqTraitStore) |
                   (&ty::ty_rptr(..), ty::RegionTraitStore(..)) => {
                     let typ = match &ty::get(ty).sty {
@@ -657,14 +655,6 @@ fn mutability_allowed(a_mutbl: ast::Mutability,
                                ty::ty_sort_str(fcx.tcx(), ty)));
                   }
 
-                  (_, ty::BoxTraitStore) => {
-                      fcx.ccx.tcx.sess.span_err(
-                          ex.span,
-                          format!("can only cast an @-pointer \
-                                to an @-object, not a {}",
-                               ty::ty_sort_str(fcx.tcx(), ty)));
-                  }
-
                   (_, ty::RegionTraitStore(_)) => {
                       fcx.ccx.tcx.sess.span_err(
                           ex.span,
@@ -791,7 +781,7 @@ pub fn resolve_impl(ccx: @CrateCtxt,
 
     let impl_trait_ref = @impl_trait_ref.subst(ccx.tcx, &param_env.free_substs);
 
-    let infcx = infer::new_infer_ctxt(ccx.tcx);
+    let infcx = &infer::new_infer_ctxt(ccx.tcx);
     let vcx = VtableContext { infcx: infcx, param_env: &param_env };
     let loc_info = location_info_for_item(impl_item);
 
index 06776fc672eb0e2fea3ffb867bb275b060ba5161..27d52aade93e608a6eb220c71d0d41196a1fb0a5 100644 (file)
 use std::rc::Rc;
 use std::vec;
 
-pub struct UniversalQuantificationResult {
+struct UniversalQuantificationResult {
     monotype: t,
     type_variables: ~[ty::t],
     type_param_defs: Rc<~[ty::TypeParameterDef]>
 }
 
-pub fn get_base_type(inference_context: @InferCtxt,
-                     span: Span,
-                     original_type: t)
-                  -> Option<t> {
+fn get_base_type(inference_context: &InferCtxt,
+                 span: Span,
+                 original_type: t)
+                 -> Option<t> {
     let resolved_type;
     match resolve_type(inference_context,
                        original_type,
@@ -92,7 +92,7 @@ pub fn get_base_type(inference_context: @InferCtxt,
     }
 }
 
-pub fn type_is_defined_in_local_crate(original_type: t) -> bool {
+fn type_is_defined_in_local_crate(original_type: t) -> bool {
     /*!
      *
      * For coherence, when we have `impl Trait for Type`, we need to
@@ -119,10 +119,10 @@ pub fn type_is_defined_in_local_crate(original_type: t) -> bool {
 }
 
 // Returns the def ID of the base type, if there is one.
-pub fn get_base_type_def_id(inference_context: @InferCtxt,
-                            span: Span,
-                            original_type: t)
-                         -> Option<DefId> {
+fn get_base_type_def_id(inference_context: &InferCtxt,
+                        span: Span,
+                        original_type: t)
+                        -> Option<DefId> {
     match get_base_type(inference_context, span, original_type) {
         None => {
             return None;
@@ -143,21 +143,16 @@ pub fn get_base_type_def_id(inference_context: @InferCtxt,
     }
 }
 
-pub fn CoherenceChecker(crate_context: @CrateCtxt) -> CoherenceChecker {
-    CoherenceChecker {
-        crate_context: crate_context,
-        inference_context: new_infer_ctxt(crate_context.tcx),
-    }
-}
-
-pub struct CoherenceChecker {
+struct CoherenceChecker {
     crate_context: @CrateCtxt,
-    inference_context: @InferCtxt,
+    inference_context: InferCtxt,
 }
 
-struct CoherenceCheckVisitor { cc: CoherenceChecker }
+struct CoherenceCheckVisitor<'a> {
+    cc: &'a CoherenceChecker
+}
 
-impl visit::Visitor<()> for CoherenceCheckVisitor {
+impl<'a> visit::Visitor<()> for CoherenceCheckVisitor<'a> {
     fn visit_item(&mut self, item: &Item, _: ()) {
 
 //      debug!("(checking coherence) item '{}'",
@@ -181,9 +176,9 @@ fn visit_item(&mut self, item: &Item, _: ()) {
     }
 }
 
-struct PrivilegedScopeVisitor { cc: CoherenceChecker }
+struct PrivilegedScopeVisitor<'a> { cc: &'a CoherenceChecker }
 
-impl visit::Visitor<()> for PrivilegedScopeVisitor {
+impl<'a> visit::Visitor<()> for PrivilegedScopeVisitor<'a> {
     fn visit_item(&mut self, item: &Item, _: ()) {
 
         match item.node {
@@ -232,11 +227,17 @@ fn visit_item(&mut self, item: &Item, _: ()) {
 }
 
 impl CoherenceChecker {
-    pub fn check_coherence(self, crate: &Crate) {
+    fn new(crate_context: @CrateCtxt) -> CoherenceChecker {
+        CoherenceChecker {
+            crate_context: crate_context,
+            inference_context: new_infer_ctxt(crate_context.tcx),
+        }
+    }
+
+    fn check(&self, crate: &Crate) {
         // Check implementations and traits. This populates the tables
         // containing the inherent methods and extension methods. It also
         // builds up the trait inheritance table.
-
         let mut visitor = CoherenceCheckVisitor { cc: self };
         visit::walk_crate(&mut visitor, crate, ());
 
@@ -257,9 +258,8 @@ pub fn check_coherence(self, crate: &Crate) {
         self.populate_destructor_table();
     }
 
-    pub fn check_implementation(&self,
-                                item: &Item,
-                                associated_traits: &[TraitRef]) {
+    fn check_implementation(&self, item: &Item,
+                            associated_traits: &[TraitRef]) {
         let tcx = self.crate_context.tcx;
         let self_type = ty::lookup_item_type(tcx, local_def(item.id));
 
@@ -271,7 +271,7 @@ pub fn check_implementation(&self,
                     '{}'",
                    self.crate_context.tcx.sess.str_of(item.ident));
 
-            match get_base_type_def_id(self.inference_context,
+            match get_base_type_def_id(&self.inference_context,
                                        item.span,
                                        self_type.ty) {
                 None => {
@@ -301,7 +301,7 @@ pub fn check_implementation(&self,
         // Add the implementation to the mapping from implementation to base
         // type def ID, if there is a base type for this implementation and
         // the implementation does not have any associated traits.
-        match get_base_type_def_id(self.inference_context,
+        match get_base_type_def_id(&self.inference_context,
                                    item.span,
                                    self_type.ty) {
             None => {
@@ -322,10 +322,9 @@ pub fn check_implementation(&self,
     // Creates default method IDs and performs type substitutions for an impl
     // and trait pair. Then, for each provided method in the trait, inserts a
     // `ProvidedMethodInfo` instance into the `provided_method_sources` map.
-    pub fn instantiate_default_methods(&self,
-                                       impl_id: ast::DefId,
-                                       trait_ref: &ty::TraitRef,
-                                       all_methods: &mut ~[@Method]) {
+    fn instantiate_default_methods(&self, impl_id: ast::DefId,
+                                   trait_ref: &ty::TraitRef,
+                                   all_methods: &mut ~[@Method]) {
         let tcx = self.crate_context.tcx;
         debug!("instantiate_default_methods(impl_id={:?}, trait_ref={})",
                impl_id, trait_ref.repr(tcx));
@@ -385,9 +384,8 @@ pub fn instantiate_default_methods(&self,
         }
     }
 
-    pub fn add_inherent_impl(&self,
-                             base_def_id: DefId,
-                             implementation: @Impl) {
+    fn add_inherent_impl(&self, base_def_id: DefId,
+                         implementation: @Impl) {
         let tcx = self.crate_context.tcx;
         let implementation_list;
         let mut inherent_impls = tcx.inherent_impls.borrow_mut();
@@ -405,9 +403,8 @@ pub fn add_inherent_impl(&self,
         implementation_list.get().push(implementation);
     }
 
-    pub fn add_trait_impl(&self,
-                          base_def_id: DefId,
-                          implementation: @Impl) {
+    fn add_trait_impl(&self, base_def_id: DefId,
+                      implementation: @Impl) {
         let tcx = self.crate_context.tcx;
         let implementation_list;
         let mut trait_impls = tcx.trait_impls.borrow_mut();
@@ -425,14 +422,14 @@ pub fn add_trait_impl(&self,
         implementation_list.get().push(implementation);
     }
 
-    pub fn check_implementation_coherence(&self) {
+    fn check_implementation_coherence(&self) {
         let trait_impls = self.crate_context.tcx.trait_impls.borrow();
         for &trait_id in trait_impls.get().keys() {
             self.check_implementation_coherence_of(trait_id);
         }
     }
 
-    pub fn check_implementation_coherence_of(&self, trait_def_id: DefId) {
+    fn check_implementation_coherence_of(&self, trait_def_id: DefId) {
         // Unify pairs of polytypes.
         self.iter_impls_of_trait_local(trait_def_id, |a| {
             let implementation_a = a;
@@ -471,7 +468,7 @@ pub fn check_implementation_coherence_of(&self, trait_def_id: DefId) {
         })
     }
 
-    pub fn iter_impls_of_trait(&self, trait_def_id: DefId, f: |@Impl|) {
+    fn iter_impls_of_trait(&self, trait_def_id: DefId, f: |@Impl|) {
         self.iter_impls_of_trait_local(trait_def_id, |x| f(x));
 
         if trait_def_id.crate == LOCAL_CRATE {
@@ -486,7 +483,7 @@ pub fn iter_impls_of_trait(&self, trait_def_id: DefId, f: |@Impl|) {
         });
     }
 
-    pub fn iter_impls_of_trait_local(&self, trait_def_id: DefId, f: |@Impl|) {
+    fn iter_impls_of_trait_local(&self, trait_def_id: DefId, f: |@Impl|) {
         let trait_impls = self.crate_context.tcx.trait_impls.borrow();
         match trait_impls.get().find(&trait_def_id) {
             Some(impls) => {
@@ -499,10 +496,10 @@ pub fn iter_impls_of_trait_local(&self, trait_def_id: DefId, f: |@Impl|) {
         }
     }
 
-    pub fn polytypes_unify(&self,
-                           polytype_a: ty_param_bounds_and_ty,
-                           polytype_b: ty_param_bounds_and_ty)
-                           -> bool {
+    fn polytypes_unify(&self,
+                       polytype_a: ty_param_bounds_and_ty,
+                       polytype_b: ty_param_bounds_and_ty)
+                       -> bool {
         let universally_quantified_a =
             self.universally_quantify_polytype(polytype_a);
         let universally_quantified_b =
@@ -516,9 +513,8 @@ pub fn polytypes_unify(&self,
 
     // Converts a polytype to a monotype by replacing all parameters with
     // type variables. Returns the monotype and the type variables created.
-    pub fn universally_quantify_polytype(&self,
-                                         polytype: ty_param_bounds_and_ty)
-                                         -> UniversalQuantificationResult {
+    fn universally_quantify_polytype(&self, polytype: ty_param_bounds_and_ty)
+                                     -> UniversalQuantificationResult {
         let region_parameter_count = polytype.generics.region_param_defs().len();
         let region_parameters =
             self.inference_context.next_region_vars(
@@ -544,30 +540,28 @@ pub fn universally_quantify_polytype(&self,
         }
     }
 
-    pub fn can_unify_universally_quantified<'a>(&self,
-                                                a: &'a
-                                                UniversalQuantificationResult,
-                                                b: &'a
-                                                UniversalQuantificationResult)
-                                                -> bool {
-        infer::can_mk_subty(self.inference_context,
+    fn can_unify_universally_quantified<'a>(&self,
+                                            a: &'a UniversalQuantificationResult,
+                                            b: &'a UniversalQuantificationResult)
+                                            -> bool {
+        infer::can_mk_subty(&self.inference_context,
                             a.monotype,
                             b.monotype).is_ok()
     }
 
-    pub fn get_self_type_for_implementation(&self, implementation: @Impl)
-                                            -> ty_param_bounds_and_ty {
+    fn get_self_type_for_implementation(&self, implementation: @Impl)
+                                        -> ty_param_bounds_and_ty {
         let tcache = self.crate_context.tcx.tcache.borrow();
         return tcache.get().get_copy(&implementation.did);
     }
 
     // Privileged scope checking
-    pub fn check_privileged_scopes(self, crate: &Crate) {
-        let mut visitor = PrivilegedScopeVisitor{ cc: self };
+    fn check_privileged_scopes(&self, crate: &Crate) {
+        let mut visitor = PrivilegedScopeVisitor { cc: self };
         visit::walk_crate(&mut visitor, crate, ());
     }
 
-    pub fn trait_ref_to_trait_def_id(&self, trait_ref: &TraitRef) -> DefId {
+    fn trait_ref_to_trait_def_id(&self, trait_ref: &TraitRef) -> DefId {
         let def_map = self.crate_context.tcx.def_map;
         let def_map = def_map.borrow();
         let trait_def = def_map.get().get_copy(&trait_ref.ref_id);
@@ -578,8 +572,7 @@ pub fn trait_ref_to_trait_def_id(&self, trait_ref: &TraitRef) -> DefId {
     /// For coherence, when we have `impl Type`, we need to guarantee that
     /// `Type` is "local" to the crate. For our purposes, this means that it
     /// must precisely name some nominal type defined in this crate.
-    pub fn ast_type_is_defined_in_local_crate(&self, original_type: &ast::Ty)
-                                              -> bool {
+    fn ast_type_is_defined_in_local_crate(&self, original_type: &ast::Ty) -> bool {
         match original_type.node {
             TyPath(_, _, path_id) => {
                 let def_map = self.crate_context.tcx.def_map.borrow();
@@ -614,7 +607,7 @@ pub fn ast_type_is_defined_in_local_crate(&self, original_type: &ast::Ty)
     }
 
     // Converts an implementation in the AST to an Impl structure.
-    pub fn create_impl_from_item(&self, item: &Item) -> @Impl {
+    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) => {
@@ -646,7 +639,7 @@ pub fn create_impl_from_item(&self, item: &Item) -> @Impl {
         }
     }
 
-    pub fn span_of_impl(&self, implementation: @Impl) -> Span {
+    fn span_of_impl(&self, implementation: @Impl) -> Span {
         assert_eq!(implementation.did.crate, LOCAL_CRATE);
         match self.crate_context.tcx.items.find(implementation.did.node) {
             Some(NodeItem(item, _)) => {
@@ -661,9 +654,9 @@ pub fn span_of_impl(&self, implementation: @Impl) -> Span {
 
     // External crate handling
 
-    pub fn add_external_impl(&self,
-                             impls_seen: &mut HashSet<DefId>,
-                             impl_def_id: DefId) {
+    fn add_external_impl(&self,
+                         impls_seen: &mut HashSet<DefId>,
+                         impl_def_id: DefId) {
         let tcx = self.crate_context.tcx;
         let implementation = @csearch::get_impl(tcx, impl_def_id);
 
@@ -701,7 +694,7 @@ pub fn add_external_impl(&self,
 
     // Adds implementations and traits from external crates to the coherence
     // info.
-    pub fn add_external_crates(&self) {
+    fn add_external_crates(&self) {
         let mut impls_seen = HashSet::new();
 
         let crate_store = self.crate_context.tcx.sess.cstore;
@@ -717,7 +710,7 @@ pub fn add_external_crates(&self) {
     // Destructors
     //
 
-    pub fn populate_destructor_table(&self) {
+    fn populate_destructor_table(&self) {
         let tcx = self.crate_context.tcx;
         let drop_trait = match tcx.lang_items.drop_trait() {
             Some(id) => id, None => { return }
@@ -853,6 +846,5 @@ fn subst_receiver_types_in_method_ty(tcx: ty::ctxt,
 }
 
 pub fn check_coherence(crate_context: @CrateCtxt, crate: &Crate) {
-    let coherence_checker = CoherenceChecker(crate_context);
-    coherence_checker.check_coherence(crate);
+    CoherenceChecker::new(crate_context).check(crate);
 }
index adf36cf973bac44e6cd78ef7e69b811a47827727..0db17c8148e8087db3308378dd31930633f4ad8b 100644 (file)
@@ -83,10 +83,10 @@ fn foo<A>(a: A, b: A) { ... }
 // Note: Coerce is not actually a combiner, in that it does not
 // conform to the same interface, though it performs a similar
 // function.
-pub struct Coerce(CombineFields);
+pub struct Coerce<'f>(CombineFields<'f>);
 
-impl Coerce {
-    pub fn get_ref<'a>(&'a self) -> &'a CombineFields {
+impl<'f> Coerce<'f> {
+    pub fn get_ref<'a>(&'a self) -> &'a CombineFields<'f> {
         let Coerce(ref v) = *self; v
     }
 
@@ -131,23 +131,6 @@ pub fn tys(&self, a: ty::t, b: ty::t) -> CoerceResult {
                 });
             }
 
-            ty::ty_trait(def_id, ref substs, ty::BoxTraitStore, m, bounds) => {
-                let result = self.unpack_actual_value(a, |sty_a| {
-                    match *sty_a {
-                        ty::ty_box(..) => {
-                            self.coerce_object(a, sty_a, b, def_id, substs,
-                                               ty::BoxTraitStore, m, bounds)
-                        }
-                        _ => Err(ty::terr_mismatch)
-                    }
-                });
-
-                match result {
-                    Ok(t) => return Ok(t),
-                    Err(..) => {}
-                }
-            }
-
             ty::ty_trait(def_id, ref substs, ty::UniqTraitStore, m, bounds) => {
                 let result = self.unpack_actual_value(a, |sty_a| {
                     match *sty_a {
@@ -462,7 +445,6 @@ pub fn coerce_object(&self,
                b.inf_str(self.get_ref().infcx));
 
         let (sigil, region) = match trait_store {
-            ty::BoxTraitStore => (ast::ManagedSigil, None),
             ty::UniqTraitStore => (ast::OwnedSigil, None),
             ty::RegionTraitStore(region) => (ast::BorrowedSigil, Some(region))
         };
index e5d9ee97098140f6b31b1aae34bb234c04c725c8..eb45065952da3f404a492b0057c897cef761ba58 100644 (file)
 use syntax::abi::AbiSet;
 
 pub trait Combine {
-    fn infcx(&self) -> @InferCtxt;
+    fn infcx<'a>(&'a self) -> &'a InferCtxt;
     fn tag(&self) -> ~str;
     fn a_is_expected(&self) -> bool;
     fn trace(&self) -> TypeTrace;
 
-    fn sub(&self) -> Sub;
-    fn lub(&self) -> Lub;
-    fn glb(&self) -> Glb;
+    fn sub<'a>(&'a self) -> Sub<'a>;
+    fn lub<'a>(&'a self) -> Lub<'a>;
+    fn glb<'a>(&'a self) -> Glb<'a>;
 
     fn mts(&self, a: &ty::mt, b: &ty::mt) -> cres<ty::mt>;
     fn contratys(&self, a: ty::t, b: ty::t) -> cres<ty::t>;
@@ -329,8 +329,8 @@ fn trait_refs(&self,
     }
 }
 
-pub struct CombineFields {
-    infcx: @InferCtxt,
+pub struct CombineFields<'a> {
+    infcx: &'a InferCtxt,
     a_is_expected: bool,
     trace: TypeTrace,
 }
index d1bf998e989365f4bd1d138ebf8b29e6a9d5ebb1..657b75a44ed305bbbbf50f3b08e330c739e324d4 100644 (file)
 use util::ppaux::note_and_explain_region;
 
 pub trait ErrorReporting {
-    fn report_region_errors(@self,
+    fn report_region_errors(&self,
                             errors: &OptVec<RegionResolutionError>);
 
-    fn report_and_explain_type_error(@self,
+    fn report_and_explain_type_error(&self,
                                      trace: TypeTrace,
                                      terr: &ty::type_err);
 
-    fn values_str(@self, values: &ValuePairs) -> Option<~str>;
+    fn values_str(&self, values: &ValuePairs) -> Option<~str>;
 
     fn expected_found_str<T:UserString+Resolvable>(
-        @self,
+        &self,
         exp_found: &ty::expected_found<T>)
         -> Option<~str>;
 
-    fn report_concrete_failure(@self,
+    fn report_concrete_failure(&self,
                                origin: SubregionOrigin,
                                sub: Region,
                                sup: Region);
 
-    fn report_sub_sup_conflict(@self,
+    fn report_sub_sup_conflict(&self,
                                var_origin: RegionVariableOrigin,
                                sub_origin: SubregionOrigin,
                                sub_region: Region,
                                sup_origin: SubregionOrigin,
                                sup_region: Region);
 
-    fn report_sup_sup_conflict(@self,
+    fn report_sup_sup_conflict(&self,
                                var_origin: RegionVariableOrigin,
                                origin1: SubregionOrigin,
                                region1: Region,
@@ -112,15 +112,15 @@ fn report_sup_sup_conflict(@self,
 }
 
 trait ErrorReportingHelpers {
-    fn report_inference_failure(@self,
+    fn report_inference_failure(&self,
                                 var_origin: RegionVariableOrigin);
 
-    fn note_region_origin(@self,
+    fn note_region_origin(&self,
                           origin: SubregionOrigin);
 }
 
 impl ErrorReporting for InferCtxt {
-    fn report_region_errors(@self,
+    fn report_region_errors(&self,
                             errors: &OptVec<RegionResolutionError>) {
         for error in errors.iter() {
             match *error {
@@ -147,11 +147,9 @@ fn report_region_errors(@self,
         }
     }
 
-    fn report_and_explain_type_error(@self,
+    fn report_and_explain_type_error(&self,
                                      trace: TypeTrace,
                                      terr: &ty::type_err) {
-        let tcx = self.tcx;
-
         let expected_found_str = match self.values_str(&trace.values) {
             Some(v) => v,
             None => {
@@ -174,12 +172,12 @@ fn report_and_explain_type_error(@self,
             format!("{}: {} ({})",
                  message_root_str,
                  expected_found_str,
-                 ty::type_err_to_str(tcx, terr)));
+                 ty::type_err_to_str(self.tcx, terr)));
 
         ty::note_and_explain_type_err(self.tcx, terr);
     }
 
-    fn values_str(@self, values: &ValuePairs) -> Option<~str> {
+    fn values_str(&self, values: &ValuePairs) -> Option<~str> {
         /*!
          * Returns a string of the form "expected `{}` but found `{}`",
          * or None if this is a derived error.
@@ -195,7 +193,7 @@ fn values_str(@self, values: &ValuePairs) -> Option<~str> {
     }
 
     fn expected_found_str<T:UserString+Resolvable>(
-        @self,
+        &self,
         exp_found: &ty::expected_found<T>)
         -> Option<~str>
     {
@@ -214,7 +212,7 @@ fn expected_found_str<T:UserString+Resolvable>(
                   found.user_string(self.tcx)))
     }
 
-    fn report_concrete_failure(@self,
+    fn report_concrete_failure(&self,
                                origin: SubregionOrigin,
                                sub: Region,
                                sup: Region) {
@@ -400,7 +398,7 @@ fn report_concrete_failure(@self,
         }
     }
 
-    fn report_sub_sup_conflict(@self,
+    fn report_sub_sup_conflict(&self,
                                var_origin: RegionVariableOrigin,
                                sub_origin: SubregionOrigin,
                                sub_region: Region,
@@ -425,7 +423,7 @@ fn report_sub_sup_conflict(@self,
         self.note_region_origin(sub_origin);
     }
 
-    fn report_sup_sup_conflict(@self,
+    fn report_sup_sup_conflict(&self,
                                var_origin: RegionVariableOrigin,
                                origin1: SubregionOrigin,
                                region1: Region,
@@ -452,7 +450,7 @@ fn report_sup_sup_conflict(@self,
 }
 
 impl ErrorReportingHelpers for InferCtxt {
-    fn report_inference_failure(@self,
+    fn report_inference_failure(&self,
                                 var_origin: RegionVariableOrigin) {
         let var_description = match var_origin {
             infer::MiscVariable(_) => ~"",
@@ -484,7 +482,7 @@ fn report_inference_failure(@self,
                     var_description));
     }
 
-    fn note_region_origin(@self, origin: SubregionOrigin) {
+    fn note_region_origin(&self, origin: SubregionOrigin) {
         match origin {
             infer::Subtype(ref trace) => {
                 let desc = match trace.origin {
@@ -611,12 +609,12 @@ fn note_region_origin(@self, origin: SubregionOrigin) {
 }
 
 trait Resolvable {
-    fn resolve(&self, infcx: @InferCtxt) -> Self;
+    fn resolve(&self, infcx: &InferCtxt) -> Self;
     fn contains_error(&self) -> bool;
 }
 
 impl Resolvable for ty::t {
-    fn resolve(&self, infcx: @InferCtxt) -> ty::t {
+    fn resolve(&self, infcx: &InferCtxt) -> ty::t {
         infcx.resolve_type_vars_if_possible(*self)
     }
     fn contains_error(&self) -> bool {
@@ -625,7 +623,7 @@ fn contains_error(&self) -> bool {
 }
 
 impl Resolvable for @ty::TraitRef {
-    fn resolve(&self, infcx: @InferCtxt) -> @ty::TraitRef {
+    fn resolve(&self, infcx: &InferCtxt) -> @ty::TraitRef {
         @infcx.resolve_type_vars_in_trait_ref_if_possible(*self)
     }
     fn contains_error(&self) -> bool {
index 075a45e16130ed7f1384340a35cbd1975cb70839..4af6364642e8a1a4a0ed4d37d1be212c4ff743fd 100644 (file)
 use util::common::{indenter};
 use util::ppaux::mt_to_str;
 
-pub struct Glb(CombineFields);  // "greatest lower bound" (common subtype)
+pub struct Glb<'f>(CombineFields<'f>);  // "greatest lower bound" (common subtype)
 
-impl Glb {
-    pub fn get_ref<'a>(&'a self) -> &'a CombineFields { let Glb(ref v) = *self; v }
+impl<'f> Glb<'f> {
+    pub fn get_ref<'a>(&'a self) -> &'a CombineFields<'f> { let Glb(ref v) = *self; v }
 }
 
-impl Combine for Glb {
-    fn infcx(&self) -> @InferCtxt { self.get_ref().infcx }
+impl<'f> Combine for Glb<'f> {
+    fn infcx<'a>(&'a self) -> &'a InferCtxt { self.get_ref().infcx }
     fn tag(&self) -> ~str { ~"glb" }
     fn a_is_expected(&self) -> bool { self.get_ref().a_is_expected }
     fn trace(&self) -> TypeTrace { self.get_ref().trace }
 
-    fn sub(&self) -> Sub { Sub(*self.get_ref()) }
-    fn lub(&self) -> Lub { Lub(*self.get_ref()) }
-    fn glb(&self) -> Glb { Glb(*self.get_ref()) }
+    fn sub<'a>(&'a self) -> Sub<'a> { Sub(*self.get_ref()) }
+    fn lub<'a>(&'a self) -> Lub<'a> { Lub(*self.get_ref()) }
+    fn glb<'a>(&'a self) -> Glb<'a> { Glb(*self.get_ref()) }
 
     fn mts(&self, a: &ty::mt, b: &ty::mt) -> cres<ty::mt> {
         let tcx = self.get_ref().infcx.tcx;
index 69bc3e13113442a496f016b1a8bde84f82fc7bc1..d96cf84eb13633845e18df98987f6c70e4954bb5 100644 (file)
@@ -109,7 +109,7 @@ fn bnds<T:Clone + InferStr + LatticeValue>(
             -> ures;
 }
 
-impl CombineFieldsLatticeMethods for CombineFields {
+impl<'f> CombineFieldsLatticeMethods for CombineFields<'f> {
     fn var_sub_var<T:Clone + InferStr + LatticeValue,
                    V:Clone + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(
                    &self,
@@ -326,7 +326,7 @@ fn bnds<T:Clone + InferStr + LatticeValue>(&self,
 // for pairs of variables or for variables and values.
 
 pub trait LatticeDir {
-    fn combine_fields(&self) -> CombineFields;
+    fn combine_fields<'a>(&'a self) -> CombineFields<'a>;
     fn bnd<T:Clone>(&self, b: &Bounds<T>) -> Option<T>;
     fn with_bnd<T:Clone>(&self, b: &Bounds<T>, t: T) -> Bounds<T>;
 }
@@ -335,29 +335,29 @@ pub trait TyLatticeDir {
     fn ty_bot(&self, t: ty::t) -> cres<ty::t>;
 }
 
-impl LatticeDir for Lub {
-    fn combine_fields(&self) -> CombineFields { *self.get_ref() }
+impl<'f> LatticeDir for Lub<'f> {
+    fn combine_fields<'a>(&'a self) -> CombineFields<'a> { *self.get_ref() }
     fn bnd<T:Clone>(&self, b: &Bounds<T>) -> Option<T> { b.ub.clone() }
     fn with_bnd<T:Clone>(&self, b: &Bounds<T>, t: T) -> Bounds<T> {
         Bounds { ub: Some(t), ..(*b).clone() }
     }
 }
 
-impl TyLatticeDir for Lub {
+impl<'f> TyLatticeDir for Lub<'f> {
     fn ty_bot(&self, t: ty::t) -> cres<ty::t> {
         Ok(t)
     }
 }
 
-impl LatticeDir for Glb {
-    fn combine_fields(&self) -> CombineFields { *self.get_ref() }
+impl<'f> LatticeDir for Glb<'f> {
+    fn combine_fields<'a>(&'a self) -> CombineFields<'a> { *self.get_ref() }
     fn bnd<T:Clone>(&self, b: &Bounds<T>) -> Option<T> { b.lb.clone() }
     fn with_bnd<T:Clone>(&self, b: &Bounds<T>, t: T) -> Bounds<T> {
         Bounds { lb: Some(t), ..(*b).clone() }
     }
 }
 
-impl TyLatticeDir for Glb {
+impl<'f> TyLatticeDir for Glb<'f> {
     fn ty_bot(&self, _t: ty::t) -> cres<ty::t> {
         Ok(ty::mk_bot())
     }
index 23bd0600383dd3f3a20173766931b857a13b91ed..dc6df33327693f98e151b4aacabd37a43d2ae698 100644 (file)
 use syntax::ast::{Onceness, Purity};
 use util::ppaux::mt_to_str;
 
-pub struct Lub(CombineFields);  // least-upper-bound: common supertype
+pub struct Lub<'f>(CombineFields<'f>);  // least-upper-bound: common supertype
 
-impl Lub {
-    pub fn get_ref<'a>(&'a self) -> &'a CombineFields { let Lub(ref v) = *self; v }
+impl<'f> Lub<'f> {
+    pub fn get_ref<'a>(&'a self) -> &'a CombineFields<'f> { let Lub(ref v) = *self; v }
     pub fn bot_ty(&self, b: ty::t) -> cres<ty::t> { Ok(b) }
     pub fn ty_bot(&self, b: ty::t) -> cres<ty::t> {
         self.bot_ty(b) // commutative
     }
 }
 
-impl Combine for Lub {
-    fn infcx(&self) -> @InferCtxt { self.get_ref().infcx }
+impl<'f> Combine for Lub<'f> {
+    fn infcx<'a>(&'a self) -> &'a InferCtxt { self.get_ref().infcx }
     fn tag(&self) -> ~str { ~"lub" }
     fn a_is_expected(&self) -> bool { self.get_ref().a_is_expected }
     fn trace(&self) -> TypeTrace { self.get_ref().trace }
 
-    fn sub(&self) -> Sub { Sub(*self.get_ref()) }
-    fn lub(&self) -> Lub { Lub(*self.get_ref()) }
-    fn glb(&self) -> Glb { Glb(*self.get_ref()) }
+    fn sub<'a>(&'a self) -> Sub<'a> { Sub(*self.get_ref()) }
+    fn lub<'a>(&'a self) -> Lub<'a> { Lub(*self.get_ref()) }
+    fn glb<'a>(&'a self) -> Glb<'a> { Glb(*self.get_ref()) }
 
     fn mts(&self, a: &ty::mt, b: &ty::mt) -> cres<ty::mt> {
         let tcx = self.get_ref().infcx.tcx;
index 812b7ffd97d60dccf9fbd106bed48792a6ce5945..abaeefd516720a8faeb2322deaeef84aabcba834 100644 (file)
@@ -258,8 +258,8 @@ fn new_ValsAndBindings<V:Clone,T:Clone>() -> ValsAndBindings<V, T> {
     }
 }
 
-pub fn new_infer_ctxt(tcx: ty::ctxt) -> @InferCtxt {
-    @InferCtxt {
+pub fn new_infer_ctxt(tcx: ty::ctxt) -> InferCtxt {
+    InferCtxt {
         tcx: tcx,
 
         ty_var_bindings: RefCell::new(new_ValsAndBindings()),
@@ -275,7 +275,7 @@ pub fn new_infer_ctxt(tcx: ty::ctxt) -> @InferCtxt {
     }
 }
 
-pub fn common_supertype(cx: @InferCtxt,
+pub fn common_supertype(cx: &InferCtxt,
                         origin: TypeOrigin,
                         a_is_expected: bool,
                         a: ty::t,
@@ -303,7 +303,7 @@ pub fn common_supertype(cx: @InferCtxt,
     }
 }
 
-pub fn mk_subty(cx: @InferCtxt,
+pub fn mk_subty(cx: &InferCtxt,
                 a_is_expected: bool,
                 origin: TypeOrigin,
                 a: ty::t,
@@ -321,7 +321,7 @@ pub fn mk_subty(cx: @InferCtxt,
     }).to_ures()
 }
 
-pub fn can_mk_subty(cx: @InferCtxt, a: ty::t, b: ty::t) -> ures {
+pub fn can_mk_subty(cx: &InferCtxt, a: ty::t, b: ty::t) -> ures {
     debug!("can_mk_subty({} <: {})", a.inf_str(cx), b.inf_str(cx));
     indent(|| {
         cx.probe(|| {
@@ -334,7 +334,7 @@ pub fn can_mk_subty(cx: @InferCtxt, a: ty::t, b: ty::t) -> ures {
     }).to_ures()
 }
 
-pub fn mk_subr(cx: @InferCtxt,
+pub fn mk_subr(cx: &InferCtxt,
                _a_is_expected: bool,
                origin: SubregionOrigin,
                a: ty::Region,
@@ -345,7 +345,7 @@ pub fn mk_subr(cx: @InferCtxt,
     cx.region_vars.commit();
 }
 
-pub fn mk_eqty(cx: @InferCtxt,
+pub fn mk_eqty(cx: &InferCtxt,
                a_is_expected: bool,
                origin: TypeOrigin,
                a: ty::t,
@@ -364,7 +364,7 @@ pub fn mk_eqty(cx: @InferCtxt,
     }).to_ures()
 }
 
-pub fn mk_sub_trait_refs(cx: @InferCtxt,
+pub fn mk_sub_trait_refs(cx: &InferCtxt,
                          a_is_expected: bool,
                          origin: TypeOrigin,
                          a: @ty::TraitRef,
@@ -395,7 +395,7 @@ fn expected_found<T>(a_is_expected: bool,
     }
 }
 
-pub fn mk_coercety(cx: @InferCtxt,
+pub fn mk_coercety(cx: &InferCtxt,
                    a_is_expected: bool,
                    origin: TypeOrigin,
                    a: ty::t,
@@ -413,7 +413,7 @@ pub fn mk_coercety(cx: @InferCtxt,
     })
 }
 
-pub fn can_mk_coercety(cx: @InferCtxt, a: ty::t, b: ty::t) -> ures {
+pub fn can_mk_coercety(cx: &InferCtxt, a: ty::t, b: ty::t) -> ures {
     debug!("can_mk_coercety({} -> {})", a.inf_str(cx), b.inf_str(cx));
     indent(|| {
         cx.probe(|| {
@@ -427,7 +427,7 @@ pub fn can_mk_coercety(cx: @InferCtxt, a: ty::t, b: ty::t) -> ures {
 }
 
 // See comment on the type `resolve_state` below
-pub fn resolve_type(cx: @InferCtxt,
+pub fn resolve_type(cx: &InferCtxt,
                     a: ty::t,
                     modes: uint)
                  -> fres<ty::t> {
@@ -435,7 +435,7 @@ pub fn resolve_type(cx: @InferCtxt,
     resolver.resolve_type_chk(a)
 }
 
-pub fn resolve_region(cx: @InferCtxt, r: ty::Region, modes: uint)
+pub fn resolve_region(cx: &InferCtxt, r: ty::Region, modes: uint)
                    -> fres<ty::Region> {
     let mut resolver = resolver(cx, modes);
     resolver.resolve_region_chk(r)
@@ -502,18 +502,18 @@ struct Snapshot {
 }
 
 impl InferCtxt {
-    pub fn combine_fields(@self, a_is_expected: bool, trace: TypeTrace)
-                          -> CombineFields {
+    pub fn combine_fields<'a>(&'a self, a_is_expected: bool, trace: TypeTrace)
+                              -> CombineFields<'a> {
         CombineFields {infcx: self,
                        a_is_expected: a_is_expected,
                        trace: trace}
     }
 
-    pub fn sub(@self, a_is_expected: bool, trace: TypeTrace) -> Sub {
+    pub fn sub<'a>(&'a self, a_is_expected: bool, trace: TypeTrace) -> Sub<'a> {
         Sub(self.combine_fields(a_is_expected, trace))
     }
 
-    pub fn lub(@self, a_is_expected: bool, trace: TypeTrace) -> Lub {
+    pub fn lub<'a>(&'a self, a_is_expected: bool, trace: TypeTrace) -> Lub<'a> {
         Lub(self.combine_fields(a_is_expected, trace))
     }
 
@@ -547,7 +547,7 @@ pub fn rollback_to(&self, snapshot: &Snapshot) {
     }
 
     /// Execute `f` and commit the bindings if successful
-    pub fn commit<T,E>(@self, f: || -> Result<T,E>) -> Result<T,E> {
+    pub fn commit<T,E>(&self, f: || -> Result<T,E>) -> Result<T,E> {
         assert!(!self.in_snapshot());
 
         debug!("commit()");
@@ -564,7 +564,7 @@ pub fn commit<T,E>(@self, f: || -> Result<T,E>) -> Result<T,E> {
     }
 
     /// Execute `f`, unroll bindings on failure
-    pub fn try<T,E>(@self, f: || -> Result<T,E>) -> Result<T,E> {
+    pub fn try<T,E>(&self, f: || -> Result<T,E>) -> Result<T,E> {
         debug!("try()");
         let snapshot = self.start_snapshot();
         let r = f();
@@ -579,7 +579,7 @@ pub fn try<T,E>(@self, f: || -> Result<T,E>) -> Result<T,E> {
     }
 
     /// Execute `f` then unroll any bindings it creates
-    pub fn probe<T,E>(@self, f: || -> Result<T,E>) -> Result<T,E> {
+    pub fn probe<T,E>(&self, f: || -> Result<T,E>) -> Result<T,E> {
         debug!("probe()");
         indent(|| {
             let snapshot = self.start_snapshot();
@@ -661,34 +661,34 @@ pub fn fresh_bound_region(&self, binder_id: ast::NodeId) -> ty::Region {
         self.region_vars.new_bound(binder_id)
     }
 
-    pub fn resolve_regions(@self) {
+    pub fn resolve_regions(&self) {
         let errors = self.region_vars.resolve_regions();
         self.report_region_errors(&errors); // see error_reporting.rs
     }
 
-    pub fn ty_to_str(@self, t: ty::t) -> ~str {
+    pub fn ty_to_str(&self, t: ty::t) -> ~str {
         ty_to_str(self.tcx,
                   self.resolve_type_vars_if_possible(t))
     }
 
-    pub fn tys_to_str(@self, ts: &[ty::t]) -> ~str {
+    pub fn tys_to_str(&self, ts: &[ty::t]) -> ~str {
         let tstrs = ts.map(|t| self.ty_to_str(*t));
         format!("({})", tstrs.connect(", "))
     }
 
-    pub fn trait_ref_to_str(@self, t: &ty::TraitRef) -> ~str {
+    pub fn trait_ref_to_str(&self, t: &ty::TraitRef) -> ~str {
         let t = self.resolve_type_vars_in_trait_ref_if_possible(t);
         trait_ref_to_str(self.tcx, &t)
     }
 
-    pub fn resolve_type_vars_if_possible(@self, typ: ty::t) -> ty::t {
+    pub fn resolve_type_vars_if_possible(&self, typ: ty::t) -> ty::t {
         match resolve_type(self, typ, resolve_nested_tvar | resolve_ivar) {
           result::Ok(new_type) => new_type,
           result::Err(_) => typ
         }
     }
 
-    pub fn resolve_type_vars_in_trait_ref_if_possible(@self,
+    pub fn resolve_type_vars_in_trait_ref_if_possible(&self,
                                                       trait_ref:
                                                       &ty::TraitRef)
                                                       -> ty::TraitRef {
@@ -728,7 +728,7 @@ pub fn resolve_type_vars_in_trait_ref_if_possible(@self,
     // in this case. The typechecker should only ever report type errors involving mismatched
     // types using one of these four methods, and should not call span_err directly for such
     // errors.
-    pub fn type_error_message_str(@self,
+    pub fn type_error_message_str(&self,
                                   sp: Span,
                                   mk_msg: |Option<~str>, ~str| -> ~str,
                                   actual_ty: ~str,
@@ -736,7 +736,7 @@ pub fn type_error_message_str(@self,
         self.type_error_message_str_with_expected(sp, mk_msg, None, actual_ty, err)
     }
 
-    pub fn type_error_message_str_with_expected(@self,
+    pub fn type_error_message_str_with_expected(&self,
                                                 sp: Span,
                                                 mk_msg: |Option<~str>,
                                                          ~str|
@@ -767,7 +767,7 @@ pub fn type_error_message_str_with_expected(@self,
         }
     }
 
-    pub fn type_error_message(@self,
+    pub fn type_error_message(&self,
                               sp: Span,
                               mk_msg: |~str| -> ~str,
                               actual_ty: ty::t,
@@ -782,7 +782,7 @@ pub fn type_error_message(@self,
         self.type_error_message_str(sp, |_e, a| { mk_msg(a) }, self.ty_to_str(actual_ty), err);
     }
 
-    pub fn report_mismatched_types(@self,
+    pub fn report_mismatched_types(&self,
                                    sp: Span,
                                    e: ty::t,
                                    a: ty::t,
index 85585ecaf5483b005645684fff77b3d5d242b4a1..fec6e357e5ac07dfef3e812fcc61e541b70fa3ee 100644 (file)
 pub static resolve_and_force_all_but_regions: uint =
     (resolve_all | force_all) & not_regions;
 
-pub struct ResolveState {
-    infcx: @InferCtxt,
+pub struct ResolveState<'a> {
+    infcx: &'a InferCtxt,
     modes: uint,
     err: Option<fixup_err>,
     v_seen: ~[TyVid],
     type_depth: uint
 }
 
-pub fn resolver(infcx: @InferCtxt, modes: uint) -> ResolveState {
+pub fn resolver<'a>(infcx: &'a InferCtxt, modes: uint) -> ResolveState<'a> {
     ResolveState {
         infcx: infcx,
         modes: modes,
@@ -97,7 +97,7 @@ pub fn resolver(infcx: @InferCtxt, modes: uint) -> ResolveState {
     }
 }
 
-impl ty_fold::TypeFolder for ResolveState {
+impl<'a> ty_fold::TypeFolder for ResolveState<'a> {
     fn tcx(&self) -> ty::ctxt {
         self.infcx.tcx
     }
@@ -111,7 +111,7 @@ fn fold_region(&mut self, r: ty::Region) -> ty::Region {
     }
 }
 
-impl ResolveState {
+impl<'a> ResolveState<'a> {
     pub fn should(&mut self, mode: uint) -> bool {
         (self.modes & mode) == mode
     }
index 19abbecaa8a72929756416f7a5979d851a34c58b..57953313324bca9a76da0204f893b3a8192cfbf2 100644 (file)
 
 use syntax::ast::{Onceness, Purity};
 
-pub struct Sub(CombineFields);  // "subtype", "subregion" etc
+pub struct Sub<'f>(CombineFields<'f>);  // "subtype", "subregion" etc
 
-impl Sub {
-    pub fn get_ref<'a>(&'a self) -> &'a CombineFields { let Sub(ref v) = *self; v }
+impl<'f> Sub<'f> {
+    pub fn get_ref<'a>(&'a self) -> &'a CombineFields<'f> { let Sub(ref v) = *self; v }
 }
 
-impl Combine for Sub {
-    fn infcx(&self) -> @InferCtxt { self.get_ref().infcx }
+impl<'f> Combine for Sub<'f> {
+    fn infcx<'a>(&'a self) -> &'a InferCtxt { self.get_ref().infcx }
     fn tag(&self) -> ~str { ~"sub" }
     fn a_is_expected(&self) -> bool { self.get_ref().a_is_expected }
     fn trace(&self) -> TypeTrace { self.get_ref().trace }
 
-    fn sub(&self) -> Sub { Sub(*self.get_ref()) }
-    fn lub(&self) -> Lub { Lub(*self.get_ref()) }
-    fn glb(&self) -> Glb { Glb(*self.get_ref()) }
+    fn sub<'a>(&'a self) -> Sub<'a> { Sub(*self.get_ref()) }
+    fn lub<'a>(&'a self) -> Lub<'a> { Lub(*self.get_ref()) }
+    fn glb<'a>(&'a self) -> Glb<'a> { Glb(*self.get_ref()) }
 
     fn contratys(&self, a: ty::t, b: ty::t) -> cres<ty::t> {
         let opp = CombineFields {
index a6fc91899f06732734d3eb452772f145fba7da4b..6d2e06c34ca8158645b69c40fc6af7aadb8baa86 100644 (file)
@@ -71,7 +71,6 @@
 use std::cell::RefCell;
 use std::hashmap::HashMap;
 use std::rc::Rc;
-use std::result;
 use extra::list::List;
 use extra::list;
 use syntax::codemap::Span;
@@ -279,32 +278,29 @@ pub fn no_params(t: ty::t) -> ty::ty_param_bounds_and_ty {
 }
 
 pub fn require_same_types(tcx: ty::ctxt,
-                          maybe_infcx: Option<@infer::InferCtxt>,
+                          maybe_infcx: Option<&infer::InferCtxt>,
                           t1_is_expected: bool,
                           span: Span,
                           t1: ty::t,
                           t2: ty::t,
                           msg: || -> ~str)
                           -> bool {
-    let l_tcx;
-    let l_infcx;
-    match maybe_infcx {
-      None => {
-        l_tcx = tcx;
-        l_infcx = infer::new_infer_ctxt(tcx);
-      }
-      Some(i) => {
-        l_tcx = i.tcx;
-        l_infcx = i;
-      }
-    }
+    let result = match maybe_infcx {
+        None => {
+            let infcx = infer::new_infer_ctxt(tcx);
+            infer::mk_eqty(&infcx, t1_is_expected, infer::Misc(span), t1, t2)
+        }
+        Some(infcx) => {
+            infer::mk_eqty(infcx, t1_is_expected, infer::Misc(span), t1, t2)
+        }
+    };
 
-    match infer::mk_eqty(l_infcx, t1_is_expected, infer::Misc(span), t1, t2) {
-        result::Ok(()) => true,
-        result::Err(ref terr) => {
-            l_tcx.sess.span_err(span, msg() + ": " +
-                                ty::type_err_to_str(l_tcx, terr));
-            ty::note_and_explain_type_err(l_tcx, terr);
+    match result {
+        Ok(_) => true,
+        Err(ref terr) => {
+            tcx.sess.span_err(span, msg() + ": " +
+                              ty::type_err_to_str(tcx, terr));
+            ty::note_and_explain_type_err(tcx, terr);
             false
         }
     }
index 334407ff12275ae321c022493a2c4d302731abed..5a9c3fd031dc47b7a6591ed42ad4b2d38cc5ee94 100644 (file)
@@ -267,7 +267,6 @@ pub fn vstore_to_str(cx: ctxt, vs: ty::vstore) -> ~str {
 pub fn trait_store_to_str(cx: ctxt, s: ty::TraitStore) -> ~str {
     match s {
       ty::UniqTraitStore => ~"~",
-      ty::BoxTraitStore => ~"@",
       ty::RegionTraitStore(r) => region_ptr_to_str(cx, r)
     }
 }
@@ -918,7 +917,6 @@ fn repr(&self, _tcx: ctxt) -> ~str {
 impl Repr for ty::TraitStore {
     fn repr(&self, tcx: ctxt) -> ~str {
         match self {
-            &ty::BoxTraitStore => ~"@Trait",
             &ty::UniqTraitStore => ~"~Trait",
             &ty::RegionTraitStore(r) => format!("&{} Trait", r.repr(tcx))
         }
index 8220be1046166106e5eaac81afcbab4530d38879..ca7f502a2e82d95c8f01b00651aceeb064c9c973 100644 (file)
@@ -404,7 +404,6 @@ pub enum SelfTy {
     SelfStatic,
     SelfValue,
     SelfBorrowed(Option<Lifetime>, Mutability),
-    SelfManaged,
     SelfOwned,
 }
 
@@ -415,7 +414,6 @@ fn clean(&self) -> SelfTy {
             ast::SelfValue => SelfValue,
             ast::SelfUniq => SelfOwned,
             ast::SelfRegion(lt, mt) => SelfBorrowed(lt.clean(), mt.clean()),
-            ast::SelfBox => SelfManaged,
         }
     }
 }
index 174841f282a5bdd05d73bebf570f4f55c428d101..9ac0e1acec53cf652d5fcadfedb9b503097a24e0 100644 (file)
@@ -14,7 +14,6 @@
 use rustc::middle::privacy;
 
 use syntax::ast;
-use syntax::diagnostic;
 use syntax::parse::token;
 use syntax::parse;
 use syntax;
@@ -48,7 +47,7 @@ fn get_ast_and_resolve(cpath: &Path,
                                 phase_2_configure_and_expand,
                                 phase_3_run_analysis_passes};
 
-    let parsesess = parse::new_parse_sess(None);
+    let parsesess = parse::new_parse_sess();
     let input = FileInput(cpath.clone());
 
     let sessopts = @driver::session::Options {
@@ -60,14 +59,13 @@ fn get_ast_and_resolve(cpath: &Path,
     };
 
 
-    let diagnostic_handler = syntax::diagnostic::mk_handler(None);
+    let diagnostic_handler = syntax::diagnostic::mk_handler();
     let span_diagnostic_handler =
         syntax::diagnostic::mk_span_handler(diagnostic_handler, parsesess.cm);
 
     let sess = driver::driver::build_session_(sessopts,
                                               Some(cpath.clone()),
                                               parsesess.cm,
-                                              @diagnostic::DefaultEmitter,
                                               span_diagnostic_handler);
 
     let mut cfg = build_configuration(sess);
index 92d15fbcd672d13081152e5824278db3a8db2b76..a1a6a173ede981a81add2faddbbe29dc8caf37f8 100644 (file)
@@ -435,7 +435,6 @@ fn fmt(m: &Method<'a>, f: &mut fmt::Formatter) -> fmt::Result {
             clean::SelfStatic => {},
             clean::SelfValue => args.push_str("self"),
             clean::SelfOwned => args.push_str("~self"),
-            clean::SelfManaged => args.push_str("@self"),
             clean::SelfBorrowed(Some(ref lt), clean::Immutable) => {
                 args.push_str(format!("&amp;{} self", *lt));
             }
index b2216b3a28c57491e738c660b79be9e1627e4fb0..58c89d6aa4a7c3663531d2107a27e044ef83b96a 100644 (file)
@@ -34,7 +34,7 @@
 use visit_ast::RustdocVisitor;
 
 pub fn run(input: &str, matches: &getopts::Matches) -> int {
-    let parsesess = parse::new_parse_sess(None);
+    let parsesess = parse::new_parse_sess();
     let input_path = Path::new(input);
     let input = driver::FileInput(input_path.clone());
     let libs = matches.opt_strs("L").map(|s| Path::new(s.as_slice()));
@@ -49,14 +49,13 @@ pub fn run(input: &str, matches: &getopts::Matches) -> int {
     };
 
 
-    let diagnostic_handler = diagnostic::mk_handler(None);
+    let diagnostic_handler = diagnostic::mk_handler();
     let span_diagnostic_handler =
         diagnostic::mk_span_handler(diagnostic_handler, parsesess.cm);
 
     let sess = driver::build_session_(sessopts,
                                       Some(input_path),
                                       parsesess.cm,
-                                      @diagnostic::DefaultEmitter,
                                       span_diagnostic_handler);
 
     let cfg = driver::build_configuration(sess);
@@ -98,7 +97,7 @@ pub fn run(input: &str, matches: &getopts::Matches) -> int {
 
 fn runtest(test: &str, cratename: &str, libs: HashSet<Path>) {
     let test = maketest(test, cratename);
-    let parsesess = parse::new_parse_sess(None);
+    let parsesess = parse::new_parse_sess();
     let input = driver::StrInput(test);
 
     let sessopts = @session::Options {
@@ -111,14 +110,13 @@ fn runtest(test: &str, cratename: &str, libs: HashSet<Path>) {
         .. (*session::basic_options()).clone()
     };
 
-    let diagnostic_handler = diagnostic::mk_handler(None);
+    let diagnostic_handler = diagnostic::mk_handler();
     let span_diagnostic_handler =
         diagnostic::mk_span_handler(diagnostic_handler, parsesess.cm);
 
     let sess = driver::build_session_(sessopts,
                                       None,
                                       parsesess.cm,
-                                      @diagnostic::DefaultEmitter,
                                       span_diagnostic_handler);
 
     let outdir = TempDir::new("rustdoctest").expect("rustdoc needs a tempdir");
index 72ccf6be023eac4d2734d21f161a2d325ad04a29..4433bd9096f4bdd33743c7ffec4c1eb0b842b903 100644 (file)
@@ -177,15 +177,6 @@ fn any_as_void_ptr() {
         assert_eq!(b.as_void_ptr(), b_r.as_void_ptr());
         assert_eq!(c.as_void_ptr(), c_r.as_void_ptr());
 
-        let (a, b, c) = (@5u as @Any, @TEST as @Any, @Test as @Any);
-        let a_r: &Any = a;
-        let b_r: &Any = b;
-        let c_r: &Any = c;
-
-        assert_eq!(a.as_void_ptr(), a_r.as_void_ptr());
-        assert_eq!(b.as_void_ptr(), b_r.as_void_ptr());
-        assert_eq!(c.as_void_ptr(), c_r.as_void_ptr());
-
         let (a, b, c) = (&5u as &Any, &TEST as &Any, &Test as &Any);
         let a_r: &Any = a;
         let b_r: &Any = b;
@@ -303,23 +294,6 @@ fn any_owning() {
         assert!(c.is::<Test>());
     }
 
-    #[test]
-    fn any_managed() {
-        let (a, b, c) = (@5u as @Any, @TEST as @Any, @Test as @Any);
-
-        assert!(a.is::<uint>());
-        assert!(!b.is::<uint>());
-        assert!(!c.is::<uint>());
-
-        assert!(!a.is::<&'static str>());
-        assert!(b.is::<&'static str>());
-        assert!(!c.is::<&'static str>());
-
-        assert!(!a.is::<Test>());
-        assert!(!b.is::<Test>());
-        assert!(c.is::<Test>());
-    }
-
     #[test]
     fn any_as_ref() {
         let a = &5u as &Any;
index 168ed5835701907d8c84fb8c092bbacd0315dc1c..e441ea6ec74ebbc9b8c6a914aea5c98f5c5e2bb6 100644 (file)
@@ -424,9 +424,9 @@ fn visit_leave_enum(&mut self, n_variants: uint,
     }
 
     fn visit_trait(&mut self, name: &str) -> bool {
-        self.align_to::<@TyVisitor>();
+        self.align_to::<~TyVisitor>();
         if ! self.inner.visit_trait(name) { return false; }
-        self.bump_past::<@TyVisitor>();
+        self.bump_past::<~TyVisitor>();
         true
     }
 
index 69c886e79ce729d3b59cdce9bc12b41f0806d4f4..ca876054fa866f642a27e5e243c3a749d20f5bdb 100644 (file)
@@ -964,7 +964,6 @@ pub enum ExplicitSelf_ {
     SelfStatic,                                // no self
     SelfValue,                                 // `self`
     SelfRegion(Option<Lifetime>, Mutability),  // `&'lt self`, `&'lt mut self`
-    SelfBox,                                   // `@self`
     SelfUniq                                   // `~self`
 }
 
@@ -1231,6 +1230,6 @@ fn check_asts_encodable() {
             },
         };
         // doesn't matter which encoder we use....
-        let _f = (@e as @serialize::Encodable<extra::json::Encoder>);
+        let _f = (&e as &serialize::Encodable<extra::json::Encoder>);
     }
 }
index 5b3b436a6fc5a71813d230249a3d4b03b40637c0..3f6540570b0ef7b6f741b2240771c5ee65f3a808 100644 (file)
 static MAX_LINES: uint = 6u;
 
 pub trait Emitter {
-    fn emit(&self,
-            cmsp: Option<(&codemap::CodeMap, Span)>,
-            msg: &str,
-            lvl: Level);
+    fn emit(&self, cmsp: Option<(&codemap::CodeMap, Span)>,
+            msg: &str, lvl: Level);
     fn custom_emit(&self, cm: &codemap::CodeMap,
                    sp: Span, msg: &str, lvl: Level);
 }
@@ -46,30 +44,30 @@ pub struct SpanHandler {
 }
 
 impl SpanHandler {
-    pub fn span_fatal(@self, sp: Span, msg: &str) -> ! {
+    pub fn span_fatal(&self, sp: Span, msg: &str) -> ! {
         self.handler.emit(Some((&*self.cm, sp)), msg, Fatal);
         fail!(FatalError);
     }
-    pub fn span_err(@self, sp: Span, msg: &str) {
+    pub fn span_err(&self, sp: Span, msg: &str) {
         self.handler.emit(Some((&*self.cm, sp)), msg, Error);
         self.handler.bump_err_count();
     }
-    pub fn span_warn(@self, sp: Span, msg: &str) {
+    pub fn span_warn(&self, sp: Span, msg: &str) {
         self.handler.emit(Some((&*self.cm, sp)), msg, Warning);
     }
-    pub fn span_note(@self, sp: Span, msg: &str) {
+    pub fn span_note(&self, sp: Span, msg: &str) {
         self.handler.emit(Some((&*self.cm, sp)), msg, Note);
     }
-    pub fn span_end_note(@self, sp: Span, msg: &str) {
+    pub fn span_end_note(&self, sp: Span, msg: &str) {
         self.handler.custom_emit(&*self.cm, sp, msg, Note);
     }
-    pub fn span_bug(@self, sp: Span, msg: &str) -> ! {
+    pub fn span_bug(&self, sp: Span, msg: &str) -> ! {
         self.span_fatal(sp, ice_msg(msg));
     }
-    pub fn span_unimpl(@self, sp: Span, msg: &str) -> ! {
+    pub fn span_unimpl(&self, sp: Span, msg: &str) -> ! {
         self.span_bug(sp, ~"unimplemented " + msg);
     }
-    pub fn handler(@self) -> @Handler {
+    pub fn handler(&self) -> @Handler {
         self.handler
     }
 }
@@ -79,28 +77,28 @@ pub fn handler(@self) -> @Handler {
 // others log errors for later reporting.
 pub struct Handler {
     err_count: Cell<uint>,
-    emit: @Emitter,
+    emit: DefaultEmitter,
 }
 
 impl Handler {
-    pub fn fatal(@self, msg: &str) -> ! {
+    pub fn fatal(&self, msg: &str) -> ! {
         self.emit.emit(None, msg, Fatal);
         fail!(FatalError);
     }
-    pub fn err(@self, msg: &str) {
+    pub fn err(&self, msg: &str) {
         self.emit.emit(None, msg, Error);
         self.bump_err_count();
     }
-    pub fn bump_err_count(@self) {
+    pub fn bump_err_count(&self) {
         self.err_count.set(self.err_count.get() + 1u);
     }
-    pub fn err_count(@self) -> uint {
+    pub fn err_count(&self) -> uint {
         self.err_count.get()
     }
-    pub fn has_errors(@self) -> bool {
+    pub fn has_errors(&self) -> bool {
         self.err_count.get()> 0u
     }
-    pub fn abort_if_errors(@self) {
+    pub fn abort_if_errors(&self) {
         let s;
         match self.err_count.get() {
           0u => return,
@@ -112,25 +110,25 @@ pub fn abort_if_errors(@self) {
         }
         self.fatal(s);
     }
-    pub fn warn(@self, msg: &str) {
+    pub fn warn(&self, msg: &str) {
         self.emit.emit(None, msg, Warning);
     }
-    pub fn note(@self, msg: &str) {
+    pub fn note(&self, msg: &str) {
         self.emit.emit(None, msg, Note);
     }
-    pub fn bug(@self, msg: &str) -> ! {
+    pub fn bug(&self, msg: &str) -> ! {
         self.fatal(ice_msg(msg));
     }
-    pub fn unimpl(@self, msg: &str) -> ! {
+    pub fn unimpl(&self, msg: &str) -> ! {
         self.bug(~"unimplemented " + msg);
     }
-    pub fn emit(@self,
-            cmsp: Option<(&codemap::CodeMap, Span)>,
-            msg: &str,
-            lvl: Level) {
+    pub fn emit(&self,
+                cmsp: Option<(&codemap::CodeMap, Span)>,
+                msg: &str,
+                lvl: Level) {
         self.emit.emit(cmsp, msg, lvl);
     }
-    pub fn custom_emit(@self, cm: &codemap::CodeMap,
+    pub fn custom_emit(&self, cm: &codemap::CodeMap,
                        sp: Span, msg: &str, lvl: Level) {
         self.emit.custom_emit(cm, sp, msg, lvl);
     }
@@ -149,15 +147,10 @@ pub fn mk_span_handler(handler: @Handler, cm: @codemap::CodeMap)
     }
 }
 
-pub fn mk_handler(emitter: Option<@Emitter>) -> @Handler {
-    let emit: @Emitter = match emitter {
-        Some(e) => e,
-        None => @DefaultEmitter as @Emitter
-    };
-
+pub fn mk_handler() -> @Handler {
     @Handler {
         err_count: Cell::new(0),
-        emit: emit,
+        emit: DefaultEmitter,
     }
 }
 
index 08098b71ce450544f989231545aec3d8564e6d61..800eda64d5198d717309d40163ca093a002285e3 100644 (file)
@@ -105,7 +105,7 @@ pub trait AnyMacro {
 pub enum MacResult {
     MRExpr(@ast::Expr),
     MRItem(@ast::Item),
-    MRAny(@AnyMacro),
+    MRAny(~AnyMacro:),
     MRDef(MacroDef),
 }
 impl MacResult {
index c5ee19484668e675f3194d23dde290ef6c188490..e41decbd8ef280f1789067c2a5cf70034b8168a3 100644 (file)
@@ -56,7 +56,6 @@ fn ty_rptr(&self, span: Span,
                lifetime: Option<ast::Lifetime>,
                mutbl: ast::Mutability) -> P<ast::Ty>;
     fn ty_uniq(&self, span: Span, ty: P<ast::Ty>) -> P<ast::Ty>;
-    fn ty_box(&self, span: Span, ty: P<ast::Ty>) -> P<ast::Ty>;
 
     fn ty_option(&self, ty: P<ast::Ty>) -> P<ast::Ty>;
     fn ty_infer(&self, sp: Span) -> P<ast::Ty>;
@@ -329,10 +328,6 @@ fn ty_uniq(&self, span: Span, ty: P<ast::Ty>) -> P<ast::Ty> {
         self.ty(span, ast::TyUniq(ty))
     }
 
-    fn ty_box(&self, span: Span, ty: P<ast::Ty>) -> P<ast::Ty> {
-        self.ty(span, ast::TyBox(ty))
-    }
-
     fn ty_option(&self, ty: P<ast::Ty>) -> P<ast::Ty> {
         self.ty_path(
             self.path_all(DUMMY_SP,
index 66b744ecbcb4ace93be39d2f03d5116e9474699c..a44e4af5b6b4fd36333b012c249efcb6aa133eb7 100644 (file)
@@ -75,7 +75,7 @@ fn decode(d: &D) -> spanned<T> {
     }
 */
 
-use ast::{MetaItem, Item, Expr, MutImmutable, MutMutable};
+use ast::{MetaItem, Item, Expr, MutMutable};
 use codemap::Span;
 use ext::base::ExtCtxt;
 use ext::build::AstBuilder;
@@ -100,7 +100,7 @@ pub fn expand_deriving_encodable(cx: &ExtCtxt,
             MethodDef {
                 name: "encode",
                 generics: LifetimeBounds::empty(),
-                explicit_self: Some(Some(Borrowed(None, MutImmutable))),
+                explicit_self: borrowed_explicit_self(),
                 args: ~[Ptr(~Literal(Path::new_local("__E")),
                             Borrowed(None, MutMutable))],
                 ret_ty: nil_ty(),
index 893a1c68426579cbd73fc3ae687cd2da5f110d42..f37abbe1ef4192a9a5e434be4f343741b0ed7c2a 100644 (file)
@@ -24,7 +24,6 @@
 /// The types of pointers
 pub enum PtrTy<'a> {
     Send, // ~
-    Managed, // @
     Borrowed(Option<&'a str>, ast::Mutability), // &['lifetime] [mut]
 }
 
@@ -138,9 +137,6 @@ pub fn to_ty(&self,
                     Send => {
                         cx.ty_uniq(span, raw_ty)
                     }
-                    Managed => {
-                        cx.ty_box(span, raw_ty)
-                    }
                     Borrowed(ref lt, mutbl) => {
                         let lt = mk_lifetime(cx, span, lt);
                         cx.ty_rptr(span, raw_ty, lt, mutbl)
@@ -251,7 +247,6 @@ pub fn get_explicit_self(cx: &ExtCtxt, span: Span, self_ptr: &Option<PtrTy>)
                 span,
                 match *ptr {
                     Send => ast::SelfUniq,
-                    Managed => ast::SelfBox,
                     Borrowed(ref lt, mutbl) => {
                         let lt = lt.map(|s| cx.lifetime(span, cx.ident_of(s)));
                         ast::SelfRegion(lt, mutbl)
index 76aa0e981bd4423ffdabbfef6a519a4fc7315d5d..5dc16b9b6b6a1ebbbfe0a8e8b86657bec8ee35fb 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use ast::{P, Block, Crate, DeclLocal, ExprMac, SyntaxContext};
+use ast::{P, Block, Crate, DeclLocal, ExprMac};
 use ast::{Local, Ident, MacInvocTT};
 use ast::{ItemMac, Mrk, Stmt, StmtDecl, StmtMac, StmtExpr, StmtSemi};
 use ast::{TokenTree};
@@ -134,7 +134,7 @@ pub fn expand_expr(e: @ast::Expr, fld: &mut MacroExpander) -> @ast::Expr {
 
         // Desugar expr_for_loop
         // From: `['<ident>:] for <src_pat> in <src_expr> <src_loop_block>`
-        // FIXME #6993 : change type of opt_ident to Option<Name>
+        // FIXME #6993: change type of opt_ident to Option<Name>
         ast::ExprForLoop(src_pat, src_expr, src_loop_block, opt_ident) => {
             // Expand any interior macros etc.
             // NB: we don't fold pats yet. Curious.
@@ -818,59 +818,16 @@ pub fn expand_crate(parse_sess: @parse::ParseSess,
 // element that has one. a CtxtFn is a trait-ified
 // version of a closure in (SyntaxContext -> SyntaxContext).
 // the ones defined here include:
-// Renamer - add a rename to a context
-// MultiRenamer - add a set of renames to a context
 // Marker - add a mark to a context
-// Repainter - replace a context (maybe Replacer would be a better name?)
 
-// a function in SyntaxContext -> SyntaxContext
-pub trait CtxtFn{
-    fn f(&self, ast::SyntaxContext) -> ast::SyntaxContext;
-}
-
-// a renamer adds a rename to the syntax context
-pub struct Renamer {
-    from : ast::Ident,
-    to : ast::Name
-}
+// A Marker adds the given mark to the syntax context
+struct Marker { mark: Mrk }
 
-impl CtxtFn for Renamer {
-    fn f(&self, ctxt : ast::SyntaxContext) -> ast::SyntaxContext {
-        new_rename(self.from,self.to,ctxt)
-    }
-}
-
-// a marker adds the given mark to the syntax context
-pub struct Marker { mark : Mrk }
-
-impl CtxtFn for Marker {
-    fn f(&self, ctxt : ast::SyntaxContext) -> ast::SyntaxContext {
-        new_mark(self.mark,ctxt)
-    }
-}
-
-// a repainter just replaces the given context with the one it's closed over
-pub struct Repainter { ctxt : SyntaxContext }
-
-impl CtxtFn for Repainter {
-    fn f(&self, _ctxt : ast::SyntaxContext) -> ast::SyntaxContext {
-        self.ctxt
-    }
-}
-
-pub struct ContextWrapper {
-    context_function: @CtxtFn,
-}
-
-impl Folder for ContextWrapper {
+impl Folder for Marker {
     fn fold_ident(&mut self, id: ast::Ident) -> ast::Ident {
-        let ast::Ident {
-            name,
-            ctxt
-        } = id;
         ast::Ident {
-            name: name,
-            ctxt: self.context_function.f(ctxt),
+            name: id.name,
+            ctxt: new_mark(self.mark, id.ctxt)
         }
     }
     fn fold_mac(&mut self, m: &ast::Mac) -> ast::Mac {
@@ -878,7 +835,7 @@ fn fold_mac(&mut self, m: &ast::Mac) -> ast::Mac {
             MacInvocTT(ref path, ref tts, ctxt) => {
                 MacInvocTT(self.fold_path(path),
                            fold_tts(*tts, self),
-                           self.context_function.f(ctxt))
+                           new_mark(self.mark, ctxt))
             }
         };
         Spanned {
@@ -888,50 +845,32 @@ fn fold_mac(&mut self, m: &ast::Mac) -> ast::Mac {
     }
 }
 
-// given a function from ctxts to ctxts, produce
-// a Folder that applies that function to all ctxts:
-pub fn fun_to_ctxt_folder<T : 'static + CtxtFn>(cf: @T) -> ContextWrapper {
-    ContextWrapper {
-        context_function: cf as @CtxtFn,
-    }
-}
-
 // just a convenience:
-pub fn new_mark_folder(m: Mrk) -> ContextWrapper {
-    fun_to_ctxt_folder(@Marker{mark:m})
-}
-
-pub fn new_rename_folder(from: ast::Ident, to: ast::Name) -> ContextWrapper {
-    fun_to_ctxt_folder(@Renamer{from:from,to:to})
+fn new_mark_folder(m: Mrk) -> Marker {
+    Marker {mark: m}
 }
 
 // apply a given mark to the given token trees. Used prior to expansion of a macro.
-fn mark_tts(tts : &[TokenTree], m : Mrk) -> ~[TokenTree] {
+fn mark_tts(tts: &[TokenTree], m: Mrk) -> ~[TokenTree] {
     fold_tts(tts, &mut new_mark_folder(m))
 }
 
 // apply a given mark to the given expr. Used following the expansion of a macro.
-fn mark_expr(expr : @ast::Expr, m : Mrk) -> @ast::Expr {
+fn mark_expr(expr: @ast::Expr, m: Mrk) -> @ast::Expr {
     new_mark_folder(m).fold_expr(expr)
 }
 
 // apply a given mark to the given stmt. Used following the expansion of a macro.
-fn mark_stmt(expr : &ast::Stmt, m : Mrk) -> @ast::Stmt {
+fn mark_stmt(expr: &ast::Stmt, m: Mrk) -> @ast::Stmt {
     new_mark_folder(m).fold_stmt(expr)
             .expect_one("marking a stmt didn't return a stmt")
 }
 
 // apply a given mark to the given item. Used following the expansion of a macro.
-fn mark_item(expr : @ast::Item, m : Mrk) -> SmallVector<@ast::Item> {
+fn mark_item(expr: @ast::Item, m: Mrk) -> SmallVector<@ast::Item> {
     new_mark_folder(m).fold_item(expr)
 }
 
-// replace all contexts in a given expr with the given mark. Used
-// for capturing macros
-pub fn replace_ctxts(expr : @ast::Expr, ctxt : SyntaxContext) -> @ast::Expr {
-    fun_to_ctxt_folder(@Repainter{ctxt:ctxt}).fold_expr(expr)
-}
-
 fn original_span(cx: &ExtCtxt) -> @codemap::ExpnInfo {
     let mut relevant_info = cx.backtrace();
     let mut einfo = relevant_info.unwrap();
@@ -1025,7 +964,7 @@ fn get_registrar_symbol(&mut self, _: ast::CrateNum) -> Option<~str> {
     #[test] fn macros_cant_escape_fns_test () {
         let src = ~"fn bogus() {macro_rules! z (() => (3+4))}\
                     fn inty() -> int { z!() }";
-        let sess = parse::new_parse_sess(None);
+        let sess = parse::new_parse_sess();
         let crate_ast = parse::parse_crate_from_source_str(
             ~"<test>",
             src,
@@ -1040,7 +979,7 @@ fn get_registrar_symbol(&mut self, _: ast::CrateNum) -> Option<~str> {
     #[test] fn macros_cant_escape_mods_test () {
         let src = ~"mod foo {macro_rules! z (() => (3+4))}\
                     fn inty() -> int { z!() }";
-        let sess = parse::new_parse_sess(None);
+        let sess = parse::new_parse_sess();
         let crate_ast = parse::parse_crate_from_source_str(
             ~"<test>",
             src,
@@ -1054,7 +993,7 @@ fn get_registrar_symbol(&mut self, _: ast::CrateNum) -> Option<~str> {
     #[test] fn macros_can_escape_flattened_mods_test () {
         let src = ~"#[macro_escape] mod foo {macro_rules! z (() => (3+4))}\
                     fn inty() -> int { z!() }";
-        let sess = parse::new_parse_sess(None);
+        let sess = parse::new_parse_sess();
         let crate_ast = parse::parse_crate_from_source_str(
             ~"<test>",
             src,
@@ -1089,41 +1028,6 @@ fn make_dummy_attr(s: &str) -> ast::Attribute {
         }
     }
 
-    #[test]
-    fn renaming () {
-        let item_ast = string_to_crate(~"fn f() -> int { a }");
-        let a_name = intern("a");
-        let a2_name = gensym("a2");
-        let mut renamer = new_rename_folder(ast::Ident{name:a_name,ctxt:EMPTY_CTXT},
-                                        a2_name);
-        let renamed_ast = renamer.fold_crate(item_ast.clone());
-        let mut path_finder = new_path_finder(~[]);
-        visit::walk_crate(&mut path_finder, &renamed_ast, ());
-
-        match path_finder.path_accumulator {
-            [ast::Path{segments:[ref seg],..}] =>
-                assert_eq!(mtwt_resolve(seg.identifier),a2_name),
-            _ => assert_eq!(0,1)
-        }
-
-        // try a double-rename, with pending_renames.
-        let a3_name = gensym("a3");
-        // a context that renames from ("a",empty) to "a2" :
-        let ctxt2 = new_rename(ast::Ident::new(a_name),a2_name,EMPTY_CTXT);
-        let mut pending_renames = ~[
-            (ast::Ident::new(a_name),a2_name),
-            (ast::Ident{name:a_name,ctxt:ctxt2},a3_name)
-        ];
-        let double_renamed = renames_to_fold(&mut pending_renames).fold_crate(item_ast);
-        let mut path_finder = new_path_finder(~[]);
-        visit::walk_crate(&mut path_finder, &double_renamed, ());
-        match path_finder.path_accumulator {
-            [ast::Path{segments:[ref seg],..}] =>
-                assert_eq!(mtwt_resolve(seg.identifier),a3_name),
-            _ => assert_eq!(0,1)
-        }
-    }
-
     //fn fake_print_crate(crate: &ast::Crate) {
     //    let mut out = ~std::io::stderr() as ~std::io::Writer;
     //    let mut s = pprust::rust_printer(out, get_ident_interner());
@@ -1142,7 +1046,7 @@ fn expand_crate_str(crate_str: ~str) -> ast::Crate {
         // println!("expanded: {:?}\n",expanded_ast);
         //mtwt_resolve_crate(expanded_ast)
     //}
-    //fn expand_and_resolve_and_pretty_print (crate_str : @str) -> ~str {
+    //fn expand_and_resolve_and_pretty_print (crate_str: @str) -> ~str {
         //let resolved_ast = expand_and_resolve(crate_str);
         //pprust::to_str(&resolved_ast,fake_print_crate,get_ident_interner())
     //}
@@ -1175,12 +1079,12 @@ fn expand_crate_str(crate_str: ~str) -> ast::Crate {
 
     #[test]
     fn automatic_renaming () {
-        let tests : ~[RenamingTest] =
+        let tests: ~[RenamingTest] =
             ~[// b & c should get new names throughout, in the expr too:
                 ("fn a() -> int { let b = 13; let c = b; b+c }",
                  ~[~[0,1],~[2]], false),
                 // both x's should be renamed (how is this causing a bug?)
-                ("fn main () {let x : int = 13;x;}",
+                ("fn main () {let x: int = 13;x;}",
                  ~[~[0]], false),
                 // the use of b after the + should be renamed, the other one not:
                 ("macro_rules! f (($x:ident) => (b + $x)) fn a() -> int { let b = 13; f!(b)}",
@@ -1300,7 +1204,7 @@ fn run_renaming_test(t: &RenamingTest, test_idx: uint) {
         visit::walk_crate(&mut name_finder, &cr, ());
         let bindings = name_finder.ident_accumulator;
 
-        let cxbinds : ~[&ast::Ident] =
+        let cxbinds: ~[&ast::Ident] =
             bindings.iter().filter(|b| {
                 let string = token::get_ident(b.name);
                 "xx" == string.get()
@@ -1337,7 +1241,7 @@ fn run_renaming_test(t: &RenamingTest, test_idx: uint) {
                 {
                     let table = table.table.borrow();
                     for (idx,val) in table.get().iter().enumerate() {
-                        println!("{:4u} : {:?}",idx,val);
+                        println!("{:4u}: {:?}",idx,val);
                     }
                 }
             }
index 83c6c6a1762351142c7a3d5a812c93f50d688908..4189ea6a967a82ec1c653b34236499425996cb0e 100644 (file)
@@ -25,8 +25,7 @@ pub fn expand_trace_macros(cx: &mut ExtCtxt,
     let tt_rdr = new_tt_reader(cx.parse_sess().span_diagnostic,
                                None,
                                tt.to_owned());
-    let rdr = tt_rdr as @Reader;
-    let mut rust_parser = Parser(sess, cfg.clone(), rdr.dup());
+    let mut rust_parser = Parser(sess, cfg.clone(), tt_rdr.dup());
 
     if rust_parser.is_keyword(keywords::True) {
         cx.set_trace_macros(true);
@@ -39,7 +38,7 @@ pub fn expand_trace_macros(cx: &mut ExtCtxt,
 
     rust_parser.bump();
 
-    let mut rust_parser = Parser(sess, cfg, rdr.dup());
+    let mut rust_parser = Parser(sess, cfg, tt_rdr.dup());
     let result = rust_parser.parse_expr();
     base::MRExpr(result)
 }
index 6d1b8dd235854254086f12b6c87174ed79480a2b..a18f80ad4c9f6d6d53db76c9c4f5751a83d8bfb6 100644 (file)
@@ -202,11 +202,11 @@ pub enum ParseResult {
     Error(codemap::Span, ~str)
 }
 
-pub fn parse_or_else(sess: @ParseSess,
-                     cfg: ast::CrateConfig,
-                     rdr: @Reader,
-                     ms: ~[Matcher])
-                     -> HashMap<Ident, @NamedMatch> {
+pub fn parse_or_else<R: Reader>(sess: @ParseSess,
+                                cfg: ast::CrateConfig,
+                                rdr: R,
+                                ms: ~[Matcher])
+                                -> HashMap<Ident, @NamedMatch> {
     match parse(sess, cfg, rdr, ms) {
         Success(m) => m,
         Failure(sp, str) => sess.span_diagnostic.span_fatal(sp, str),
@@ -223,11 +223,11 @@ pub fn token_name_eq(t1 : &Token, t2 : &Token) -> bool {
     }
 }
 
-pub fn parse(sess: @ParseSess,
-             cfg: ast::CrateConfig,
-             rdr: @Reader,
-             ms: &[Matcher])
-             -> ParseResult {
+pub fn parse<R: Reader>(sess: @ParseSess,
+                        cfg: ast::CrateConfig,
+                        rdr: R,
+                        ms: &[Matcher])
+                        -> ParseResult {
     let mut cur_eis = ~[];
     cur_eis.push(initial_matcher_pos(ms.to_owned(), None, rdr.peek().sp.lo));
 
index c179e9959e0be50bc44ad2a42c2449bfa7431ac9..e196bdccfe34b621af1dc7906aed81ec3a438526 100644 (file)
@@ -18,7 +18,7 @@
 use ext::tt::macro_parser::{Success, Error, Failure};
 use ext::tt::macro_parser::{NamedMatch, MatchedSeq, MatchedNonterminal};
 use ext::tt::macro_parser::{parse, parse_or_else};
-use parse::lexer::{new_tt_reader, Reader};
+use parse::lexer::new_tt_reader;
 use parse::parser::Parser;
 use parse::attr::ParserAttr;
 use parse::token::{get_ident_interner, special_idents, gensym_ident};
@@ -129,8 +129,8 @@ fn generic_extension(cx: &ExtCtxt,
     for (i, lhs) in lhses.iter().enumerate() { // try each arm's matchers
         match **lhs {
           MatchedNonterminal(NtMatchers(ref mtcs)) => {
-            // `none` is because we're not interpolating
-            let arg_rdr = new_tt_reader(s_d, None, arg.to_owned()) as @Reader;
+            // `None` is because we're not interpolating
+            let arg_rdr = new_tt_reader(s_d, None, arg.to_owned());
             match parse(cx.parse_sess(), cx.cfg(), arg_rdr, *mtcs) {
               Success(named_matches) => {
                 let rhs = match *rhses[i] {
@@ -150,12 +150,12 @@ fn generic_extension(cx: &ExtCtxt,
                 // rhs has holes ( `$id` and `$(...)` that need filled)
                 let trncbr = new_tt_reader(s_d, Some(named_matches),
                                            rhs);
-                let p = Parser(cx.parse_sess(), cx.cfg(), trncbr as @Reader);
+                let p = Parser(cx.parse_sess(), cx.cfg(), ~trncbr);
                 // Let the context choose how to interpret the result.
                 // Weird, but useful for X-macros.
-                return MRAny(@ParserAnyMacro {
+                return MRAny(~ParserAnyMacro {
                     parser: RefCell::new(p),
-                } as @AnyMacro)
+                })
               }
               Failure(sp, ref msg) => if sp.lo >= best_fail_spot.lo {
                 best_fail_spot = sp;
@@ -210,7 +210,7 @@ fn ms(m: Matcher_) -> Matcher {
                                    arg.clone());
     let argument_map = parse_or_else(cx.parse_sess(),
                                      cx.cfg(),
-                                     arg_reader as @Reader,
+                                     arg_reader,
                                      argument_gram);
 
     // Extract the arguments:
index d2fa24b1cfede7b66b7065e61077b5c574c69b95..430bd02119a03b95870f57bf1656f1dd764b6be7 100644 (file)
@@ -49,8 +49,8 @@ pub struct TtReader {
 pub fn new_tt_reader(sp_diag: @SpanHandler,
                      interp: Option<HashMap<Ident, @NamedMatch>>,
                      src: ~[ast::TokenTree])
-                     -> @TtReader {
-    let r = @TtReader {
+                     -> TtReader {
+    let r = TtReader {
         sp_diag: sp_diag,
         stack: RefCell::new(@TtFrame {
             forest: @src,
@@ -69,7 +69,7 @@ pub fn new_tt_reader(sp_diag: @SpanHandler,
         cur_tok: RefCell::new(EOF),
         cur_span: RefCell::new(DUMMY_SP),
     };
-    tt_next_token(r); /* get cur_tok and cur_span set up */
+    tt_next_token(&r); /* get cur_tok and cur_span set up */
     return r;
 }
 
@@ -86,8 +86,8 @@ fn dup_tt_frame(f: @TtFrame) -> @TtFrame {
     }
 }
 
-pub fn dup_tt_reader(r: @TtReader) -> @TtReader {
-    @TtReader {
+pub fn dup_tt_reader(r: &TtReader) -> TtReader {
+    TtReader {
         sp_diag: r.sp_diag,
         stack: RefCell::new(dup_tt_frame(r.stack.get())),
         repeat_idx: r.repeat_idx.clone(),
index 297ec6acf51052d9008ba418ab63e82aacca4bb9..8fbaea7ac1ee01b086fd44f105c38785951c624a 100644 (file)
@@ -306,7 +306,7 @@ fn fold_explicit_self(&mut self, es: &ExplicitSelf) -> ExplicitSelf {
 
     fn fold_explicit_self_(&mut self, es: &ExplicitSelf_) -> ExplicitSelf_ {
         match *es {
-            SelfStatic | SelfValue | SelfUniq | SelfBox => *es,
+            SelfStatic | SelfValue | SelfUniq => *es,
             SelfRegion(ref lifetime, m) => {
                 SelfRegion(fold_opt_lifetime(lifetime, self), m)
             }
index f65bc3ad7a3511bc4e296ba76e805bac6ced47c0..77b047a63c3866946c6a3f968b66264ac0ed2489 100644 (file)
@@ -134,7 +134,7 @@ fn horizontal_trim(lines: ~[~str]) -> ~[~str] {
     fail!("not a doc-comment: {}", comment);
 }
 
-fn read_to_eol(rdr: @StringReader) -> ~str {
+fn read_to_eol(rdr: &StringReader) -> ~str {
     let mut val = ~"";
     while rdr.curr.get() != '\n' && !is_eof(rdr) {
         val.push_char(rdr.curr.get());
@@ -144,21 +144,21 @@ fn read_to_eol(rdr: @StringReader) -> ~str {
     return val;
 }
 
-fn read_one_line_comment(rdr: @StringReader) -> ~str {
+fn read_one_line_comment(rdr: &StringReader) -> ~str {
     let val = read_to_eol(rdr);
     assert!((val[0] == '/' as u8 && val[1] == '/' as u8) ||
                  (val[0] == '#' as u8 && val[1] == '!' as u8));
     return val;
 }
 
-fn consume_non_eol_whitespace(rdr: @StringReader) {
+fn consume_non_eol_whitespace(rdr: &StringReader) {
     while is_whitespace(rdr.curr.get()) && rdr.curr.get() != '\n' &&
             !is_eof(rdr) {
         bump(rdr);
     }
 }
 
-fn push_blank_line_comment(rdr: @StringReader, comments: &mut ~[Comment]) {
+fn push_blank_line_comment(rdr: &StringReader, comments: &mut ~[Comment]) {
     debug!(">>> blank-line comment");
     let v: ~[~str] = ~[];
     comments.push(Comment {
@@ -168,7 +168,7 @@ fn push_blank_line_comment(rdr: @StringReader, comments: &mut ~[Comment]) {
     });
 }
 
-fn consume_whitespace_counting_blank_lines(rdr: @StringReader,
+fn consume_whitespace_counting_blank_lines(rdr: &StringReader,
                                            comments: &mut ~[Comment]) {
     while is_whitespace(rdr.curr.get()) && !is_eof(rdr) {
         if rdr.col.get() == CharPos(0u) && rdr.curr.get() == '\n' {
@@ -179,7 +179,7 @@ fn consume_whitespace_counting_blank_lines(rdr: @StringReader,
 }
 
 
-fn read_shebang_comment(rdr: @StringReader, code_to_the_left: bool,
+fn read_shebang_comment(rdr: &StringReader, code_to_the_left: bool,
                                             comments: &mut ~[Comment]) {
     debug!(">>> shebang comment");
     let p = rdr.last_pos.get();
@@ -191,7 +191,7 @@ fn read_shebang_comment(rdr: @StringReader, code_to_the_left: bool,
     });
 }
 
-fn read_line_comments(rdr: @StringReader, code_to_the_left: bool,
+fn read_line_comments(rdr: &StringReader, code_to_the_left: bool,
                                           comments: &mut ~[Comment]) {
     debug!(">>> line comments");
     let p = rdr.last_pos.get();
@@ -248,7 +248,7 @@ fn trim_whitespace_prefix_and_push_line(lines: &mut ~[~str],
     lines.push(s1);
 }
 
-fn read_block_comment(rdr: @StringReader,
+fn read_block_comment(rdr: &StringReader,
                       code_to_the_left: bool,
                       comments: &mut ~[Comment]) {
     debug!(">>> block comment");
@@ -279,7 +279,7 @@ fn read_block_comment(rdr: @StringReader,
         while level > 0 {
             debug!("=== block comment level {}", level);
             if is_eof(rdr) {
-                (rdr as @Reader).fatal(~"unterminated block comment");
+                rdr.fatal(~"unterminated block comment");
             }
             if rdr.curr.get() == '\n' {
                 trim_whitespace_prefix_and_push_line(&mut lines, curr_line,
@@ -317,13 +317,13 @@ fn read_block_comment(rdr: @StringReader,
     comments.push(Comment {style: style, lines: lines, pos: p});
 }
 
-fn peeking_at_comment(rdr: @StringReader) -> bool {
+fn peeking_at_comment(rdr: &StringReader) -> bool {
     return ((rdr.curr.get() == '/' && nextch(rdr) == '/') ||
          (rdr.curr.get() == '/' && nextch(rdr) == '*')) ||
          (rdr.curr.get() == '#' && nextch(rdr) == '!');
 }
 
-fn consume_comment(rdr: @StringReader,
+fn consume_comment(rdr: &StringReader,
                    code_to_the_left: bool,
                    comments: &mut ~[Comment]) {
     debug!(">>> consume comment");
@@ -359,17 +359,17 @@ pub fn gather_comments_and_literals(span_diagnostic:
     let mut comments: ~[Comment] = ~[];
     let mut literals: ~[Literal] = ~[];
     let mut first_read: bool = true;
-    while !is_eof(rdr) {
+    while !is_eof(&rdr) {
         loop {
             let mut code_to_the_left = !first_read;
-            consume_non_eol_whitespace(rdr);
+            consume_non_eol_whitespace(&rdr);
             if rdr.curr.get() == '\n' {
                 code_to_the_left = false;
-                consume_whitespace_counting_blank_lines(rdr, &mut comments);
+                consume_whitespace_counting_blank_lines(&rdr, &mut comments);
             }
-            while peeking_at_comment(rdr) {
-                consume_comment(rdr, code_to_the_left, &mut comments);
-                consume_whitespace_counting_blank_lines(rdr, &mut comments);
+            while peeking_at_comment(&rdr) {
+                consume_comment(&rdr, code_to_the_left, &mut comments);
+                consume_whitespace_counting_blank_lines(&rdr, &mut comments);
             }
             break;
         }
@@ -380,7 +380,7 @@ pub fn gather_comments_and_literals(span_diagnostic:
         //discard, and look ahead; we're working with internal state
         let TokenAndSpan {tok: tok, sp: sp} = rdr.peek();
         if token::is_lit(&tok) {
-            with_str_from(rdr, bstart, |s| {
+            with_str_from(&rdr, bstart, |s| {
                 debug!("tok lit: {}", s);
                 literals.push(Literal {lit: s.to_owned(), pos: sp.lo});
             })
index 8c55990289aa8067eb7f1a47328629eb85caaa40..1bcff324e082f968f04793f71aed820090f2a9ed 100644 (file)
@@ -12,8 +12,7 @@
 use codemap::{BytePos, CharPos, CodeMap, Pos, Span};
 use codemap;
 use diagnostic::SpanHandler;
-use ext::tt::transcribe::{tt_next_token};
-use ext::tt::transcribe::{dup_tt_reader};
+use ext::tt::transcribe::{dup_tt_reader, tt_next_token};
 use parse::token;
 use parse::token::{str_to_ident};
 
 pub use ext::tt::transcribe::{TtReader, new_tt_reader};
 
 pub trait Reader {
-    fn is_eof(@self) -> bool;
-    fn next_token(@self) -> TokenAndSpan;
-    fn fatal(@self, ~str) -> !;
-    fn span_diag(@self) -> @SpanHandler;
-    fn peek(@self) -> TokenAndSpan;
-    fn dup(@self) -> @Reader;
+    fn is_eof(&self) -> bool;
+    fn next_token(&self) -> TokenAndSpan;
+    fn fatal(&self, ~str) -> !;
+    fn span_diag(&self) -> @SpanHandler;
+    fn peek(&self) -> TokenAndSpan;
+    fn dup(&self) -> ~Reader:;
 }
 
 #[deriving(Clone, Eq)]
@@ -58,19 +57,19 @@ pub struct StringReader {
 
 pub fn new_string_reader(span_diagnostic: @SpanHandler,
                          filemap: @codemap::FileMap)
-                      -> @StringReader {
+                      -> StringReader {
     let r = new_low_level_string_reader(span_diagnostic, filemap);
-    string_advance_token(r); /* fill in peek_* */
-    return r;
+    string_advance_token(&r); /* fill in peek_* */
+    r
 }
 
 /* For comments.rs, which hackily pokes into 'pos' and 'curr' */
 pub fn new_low_level_string_reader(span_diagnostic: @SpanHandler,
                                    filemap: @codemap::FileMap)
-                                -> @StringReader {
+                                -> StringReader {
     // Force the initial reader bump to start on a fresh line
     let initial_char = '\n';
-    let r = @StringReader {
+    let r = StringReader {
         span_diagnostic: span_diagnostic,
         pos: Cell::new(filemap.start_pos),
         last_pos: Cell::new(filemap.start_pos),
@@ -81,15 +80,15 @@ pub fn new_low_level_string_reader(span_diagnostic: @SpanHandler,
         peek_tok: RefCell::new(token::EOF),
         peek_span: RefCell::new(codemap::DUMMY_SP),
     };
-    bump(r);
-    return r;
+    bump(&r);
+    r
 }
 
 // duplicating the string reader is probably a bad idea, in
 // that using them will cause interleaved pushes of line
 // offsets to the underlying filemap...
-fn dup_string_reader(r: @StringReader) -> @StringReader {
-    @StringReader {
+fn dup_string_reader(r: &StringReader) -> StringReader {
+    StringReader {
         span_diagnostic: r.span_diagnostic,
         pos: Cell::new(r.pos.get()),
         last_pos: Cell::new(r.last_pos.get()),
@@ -102,9 +101,9 @@ fn dup_string_reader(r: @StringReader) -> @StringReader {
 }
 
 impl Reader for StringReader {
-    fn is_eof(@self) -> bool { is_eof(self) }
+    fn is_eof(&self) -> bool { is_eof(self) }
     // return the next token. EFFECT: advances the string_reader.
-    fn next_token(@self) -> TokenAndSpan {
+    fn next_token(&self) -> TokenAndSpan {
         let ret_val = {
             let mut peek_tok = self.peek_tok.borrow_mut();
             TokenAndSpan {
@@ -115,45 +114,45 @@ fn next_token(@self) -> TokenAndSpan {
         string_advance_token(self);
         ret_val
     }
-    fn fatal(@self, m: ~str) -> ! {
+    fn fatal(&self, m: ~str) -> ! {
         self.span_diagnostic.span_fatal(self.peek_span.get(), m)
     }
-    fn span_diag(@self) -> @SpanHandler { self.span_diagnostic }
-    fn peek(@self) -> TokenAndSpan {
+    fn span_diag(&self) -> @SpanHandler { self.span_diagnostic }
+    fn peek(&self) -> TokenAndSpan {
         // FIXME(pcwalton): Bad copy!
         TokenAndSpan {
             tok: self.peek_tok.get(),
             sp: self.peek_span.get(),
         }
     }
-    fn dup(@self) -> @Reader { dup_string_reader(self) as @Reader }
+    fn dup(&self) -> ~Reader: { ~dup_string_reader(self) as ~Reader: }
 }
 
 impl Reader for TtReader {
-    fn is_eof(@self) -> bool {
+    fn is_eof(&self) -> bool {
         let cur_tok = self.cur_tok.borrow();
         *cur_tok.get() == token::EOF
     }
-    fn next_token(@self) -> TokenAndSpan {
+    fn next_token(&self) -> TokenAndSpan {
         let r = tt_next_token(self);
         debug!("TtReader: r={:?}", r);
         return r;
     }
-    fn fatal(@self, m: ~str) -> ! {
+    fn fatal(&self, m: ~str) -> ! {
         self.sp_diag.span_fatal(self.cur_span.get(), m);
     }
-    fn span_diag(@self) -> @SpanHandler { self.sp_diag }
-    fn peek(@self) -> TokenAndSpan {
+    fn span_diag(&self) -> @SpanHandler { self.sp_diag }
+    fn peek(&self) -> TokenAndSpan {
         TokenAndSpan {
             tok: self.cur_tok.get(),
             sp: self.cur_span.get(),
         }
     }
-    fn dup(@self) -> @Reader { dup_tt_reader(self) as @Reader }
+    fn dup(&self) -> ~Reader: { ~dup_tt_reader(self) as ~Reader: }
 }
 
 // report a lexical error spanning [`from_pos`, `to_pos`)
-fn fatal_span(rdr: @StringReader,
+fn fatal_span(rdr: &StringReader,
               from_pos: BytePos,
               to_pos: BytePos,
               m: ~str)
@@ -164,7 +163,7 @@ fn fatal_span(rdr: @StringReader,
 
 // report a lexical error spanning [`from_pos`, `to_pos`), appending an
 // escaped character to the error message
-fn fatal_span_char(rdr: @StringReader,
+fn fatal_span_char(rdr: &StringReader,
                    from_pos: BytePos,
                    to_pos: BytePos,
                    m: ~str,
@@ -178,7 +177,7 @@ fn fatal_span_char(rdr: @StringReader,
 
 // report a lexical error spanning [`from_pos`, `to_pos`), appending the
 // offending string to the error message
-fn fatal_span_verbose(rdr: @StringReader,
+fn fatal_span_verbose(rdr: &StringReader,
                       from_pos: BytePos,
                       to_pos: BytePos,
                       m: ~str)
@@ -194,7 +193,7 @@ fn fatal_span_verbose(rdr: @StringReader,
 
 // EFFECT: advance peek_tok and peek_span to refer to the next token.
 // EFFECT: update the interner, maybe.
-fn string_advance_token(r: @StringReader) {
+fn string_advance_token(r: &StringReader) {
     match consume_whitespace_and_comments(r) {
         Some(comment) => {
             r.peek_span.set(comment.sp);
@@ -221,7 +220,7 @@ fn byte_offset(rdr: &StringReader, pos: BytePos) -> BytePos {
 /// up to but excluding `rdr.last_pos`, meaning the slice does not include
 /// the character `rdr.curr`.
 pub fn with_str_from<T>(
-                     rdr: @StringReader,
+                     rdr: &StringReader,
                      start: BytePos,
                      f: |s: &str| -> T)
                      -> T {
@@ -231,7 +230,7 @@ pub fn with_str_from<T>(
 /// Calls `f` with astring slice of the source text spanning from `start`
 /// up to but excluding `end`.
 fn with_str_from_to<T>(
-                    rdr: @StringReader,
+                    rdr: &StringReader,
                     start: BytePos,
                     end: BytePos,
                     f: |s: &str| -> T)
@@ -269,10 +268,10 @@ pub fn bump(rdr: &StringReader) {
         rdr.curr.set(unsafe { transmute(-1u32) }); // FIXME: #8971: unsound
     }
 }
-pub fn is_eof(rdr: @StringReader) -> bool {
+pub fn is_eof(rdr: &StringReader) -> bool {
     rdr.curr.get() == unsafe { transmute(-1u32) } // FIXME: #8971: unsound
 }
-pub fn nextch(rdr: @StringReader) -> char {
+pub fn nextch(rdr: &StringReader) -> char {
     let offset = byte_offset(rdr, rdr.pos.get()).to_uint();
     if offset < (rdr.filemap.src).len() {
         return rdr.filemap.src.char_at(offset);
@@ -303,7 +302,7 @@ fn is_hex_digit(c: char) -> bool {
 
 // EFFECT: eats whitespace and comments.
 // returns a Some(sugared-doc-attr) if one exists, None otherwise.
-fn consume_whitespace_and_comments(rdr: @StringReader)
+fn consume_whitespace_and_comments(rdr: &StringReader)
                                 -> Option<TokenAndSpan> {
     while is_whitespace(rdr.curr.get()) { bump(rdr); }
     return consume_any_line_comment(rdr);
@@ -316,7 +315,7 @@ pub fn is_line_non_doc_comment(s: &str) -> bool {
 // PRECONDITION: rdr.curr is not whitespace
 // EFFECT: eats any kind of comment.
 // returns a Some(sugared-doc-attr) if one exists, None otherwise
-fn consume_any_line_comment(rdr: @StringReader)
+fn consume_any_line_comment(rdr: &StringReader)
                          -> Option<TokenAndSpan> {
     if rdr.curr.get() == '/' {
         match nextch(rdr) {
@@ -377,7 +376,7 @@ pub fn is_block_non_doc_comment(s: &str) -> bool {
 }
 
 // might return a sugared-doc-attr
-fn consume_block_comment(rdr: @StringReader) -> Option<TokenAndSpan> {
+fn consume_block_comment(rdr: &StringReader) -> Option<TokenAndSpan> {
     // block comments starting with "/**" or "/*!" are doc-comments
     let is_doc_comment = rdr.curr.get() == '*' || rdr.curr.get() == '!';
     let start_bpos = rdr.pos.get() - BytePos(if is_doc_comment {3} else {2});
@@ -424,7 +423,7 @@ fn consume_block_comment(rdr: @StringReader) -> Option<TokenAndSpan> {
     if res.is_some() { res } else { consume_whitespace_and_comments(rdr) }
 }
 
-fn scan_exponent(rdr: @StringReader, start_bpos: BytePos) -> Option<~str> {
+fn scan_exponent(rdr: &StringReader, start_bpos: BytePos) -> Option<~str> {
     let mut c = rdr.curr.get();
     let mut rslt = ~"";
     if c == 'e' || c == 'E' {
@@ -445,7 +444,7 @@ fn scan_exponent(rdr: @StringReader, start_bpos: BytePos) -> Option<~str> {
     } else { return None::<~str>; }
 }
 
-fn scan_digits(rdr: @StringReader, radix: uint) -> ~str {
+fn scan_digits(rdr: &StringReader, radix: uint) -> ~str {
     let mut rslt = ~"";
     loop {
         let c = rdr.curr.get();
@@ -460,7 +459,7 @@ fn scan_digits(rdr: @StringReader, radix: uint) -> ~str {
     };
 }
 
-fn check_float_base(rdr: @StringReader, start_bpos: BytePos, last_bpos: BytePos,
+fn check_float_base(rdr: &StringReader, start_bpos: BytePos, last_bpos: BytePos,
                     base: uint) {
     match base {
       16u => fatal_span(rdr, start_bpos, last_bpos,
@@ -473,7 +472,7 @@ fn check_float_base(rdr: @StringReader, start_bpos: BytePos, last_bpos: BytePos,
     }
 }
 
-fn scan_number(c: char, rdr: @StringReader) -> token::Token {
+fn scan_number(c: char, rdr: &StringReader) -> token::Token {
     let mut num_str;
     let mut base = 10u;
     let mut c = c;
@@ -599,7 +598,7 @@ enum Result { Signed(ast::IntTy), Unsigned(ast::UintTy) }
     }
 }
 
-fn scan_numeric_escape(rdr: @StringReader, n_hex_digits: uint) -> char {
+fn scan_numeric_escape(rdr: &StringReader, n_hex_digits: uint) -> char {
     let mut accum_int = 0;
     let mut i = n_hex_digits;
     let start_bpos = rdr.last_pos.get();
@@ -640,7 +639,7 @@ fn ident_continue(c: char) -> bool {
 // return the next token from the string
 // EFFECT: advances the input past that token
 // EFFECT: updates the interner
-fn next_token_inner(rdr: @StringReader) -> token::Token {
+fn next_token_inner(rdr: &StringReader) -> token::Token {
     let c = rdr.curr.get();
     if ident_start(c) && nextch(rdr) != '"' && nextch(rdr) != '#' {
         // Note: r as in r" or r#" is part of a raw string literal,
@@ -665,7 +664,7 @@ fn next_token_inner(rdr: @StringReader) -> token::Token {
     if is_dec_digit(c) {
         return scan_number(c, rdr);
     }
-    fn binop(rdr: @StringReader, op: token::BinOp) -> token::Token {
+    fn binop(rdr: &StringReader, op: token::BinOp) -> token::Token {
         bump(rdr);
         if rdr.curr.get() == '=' {
             bump(rdr);
@@ -953,7 +952,7 @@ fn binop(rdr: @StringReader, op: token::BinOp) -> token::Token {
     }
 }
 
-fn consume_whitespace(rdr: @StringReader) {
+fn consume_whitespace(rdr: &StringReader) {
     while is_whitespace(rdr.curr.get()) && !is_eof(rdr) { bump(rdr); }
 }
 
@@ -968,15 +967,14 @@ mod test {
 
     // represents a testing reader (incl. both reader and interner)
     struct Env {
-        string_reader: @StringReader
+        string_reader: StringReader
     }
 
     // open a string reader for the given string
     fn setup(teststr: ~str) -> Env {
         let cm = CodeMap::new();
         let fm = cm.new_filemap(~"zebra.rs", teststr);
-        let span_handler =
-            diagnostic::mk_span_handler(diagnostic::mk_handler(None),@cm);
+        let span_handler = diagnostic::mk_span_handler(diagnostic::mk_handler(), @cm);
         Env {
             string_reader: new_string_reader(span_handler,fm)
         }
index 050ff5cef325f79c605182db620fbbf7c34f6615..6ddb4bbc11fb767121e9f66fda8e3e5237386289 100644 (file)
@@ -14,7 +14,7 @@
 use ast;
 use codemap::{Span, CodeMap, FileMap};
 use codemap;
-use diagnostic::{SpanHandler, mk_span_handler, mk_handler, Emitter};
+use diagnostic::{SpanHandler, mk_span_handler, mk_handler};
 use parse::attr::ParserAttr;
 use parse::parser::Parser;
 
@@ -45,11 +45,11 @@ pub struct ParseSess {
     included_mod_stack: RefCell<~[Path]>,
 }
 
-pub fn new_parse_sess(demitter: Option<@Emitter>) -> @ParseSess {
+pub fn new_parse_sess() -> @ParseSess {
     let cm = @CodeMap::new();
     @ParseSess {
         cm: cm,
-        span_diagnostic: mk_span_handler(mk_handler(demitter), cm),
+        span_diagnostic: mk_span_handler(mk_handler(), cm),
         included_mod_stack: RefCell::new(~[]),
     }
 }
@@ -261,7 +261,7 @@ pub fn filemap_to_tts(sess: @ParseSess, filemap: @FileMap)
     // parsing tt's probably shouldn't require a parser at all.
     let cfg = ~[];
     let srdr = lexer::new_string_reader(sess.span_diagnostic, filemap);
-    let mut p1 = Parser(sess, cfg, srdr as @lexer::Reader);
+    let mut p1 = Parser(sess, cfg, ~srdr);
     p1.parse_all_token_trees()
 }
 
@@ -270,7 +270,7 @@ pub fn tts_to_parser(sess: @ParseSess,
                      tts: ~[ast::TokenTree],
                      cfg: ast::CrateConfig) -> Parser {
     let trdr = lexer::new_tt_reader(sess.span_diagnostic, None, tts);
-    Parser(sess, cfg, trdr as @lexer::Reader)
+    Parser(sess, cfg, ~trdr)
 }
 
 // abort if necessary
index b80c222d4dc8bec94d2d430fcd4f323714685a6d..e1cbdd12bd320784ae65a8fa0272a1d15c78c4ab 100644 (file)
@@ -48,7 +48,7 @@
 use ast::{StmtExpr, StmtSemi, StmtMac, StructDef, StructField};
 use ast::{StructVariantKind, BiSub};
 use ast::StrStyle;
-use ast::{SelfBox, SelfRegion, SelfStatic, SelfUniq, SelfValue};
+use ast::{SelfRegion, SelfStatic, SelfUniq, SelfValue};
 use ast::{TokenTree, TraitMethod, TraitRef, TTDelim, TTSeq, TTTok};
 use ast::{TTNonterminal, TupleVariantKind, Ty, Ty_, TyBot, TyBox};
 use ast::{TypeField, TyFixedLengthVec, TyClosure, TyBareFn, TyTypeof};
@@ -285,7 +285,7 @@ struct ParsedItemsAndViewItems {
 
 /* ident is handled by common.rs */
 
-pub fn Parser(sess: @ParseSess, cfg: ast::CrateConfig, rdr: @Reader)
+pub fn Parser(sess: @ParseSess, cfg: ast::CrateConfig, rdr: ~Reader:)
               -> Parser {
     let tok0 = rdr.next_token();
     let interner = get_ident_interner();
@@ -339,7 +339,7 @@ pub struct Parser {
     tokens_consumed: uint,
     restriction: restriction,
     quote_depth: uint, // not (yet) related to the quasiquoter
-    reader: @Reader,
+    reader: ~Reader:,
     interner: @token::IdentInterner,
     /// The set of seen errors about obsolete syntax. Used to suppress
     /// extra detail when the same error is seen twice
@@ -3580,19 +3580,6 @@ fn expect_self_ident(&mut self) {
     // that may have a self type.
     fn parse_fn_decl_with_self(&mut self, parse_arg_fn: |&mut Parser| -> Arg)
                                -> (ExplicitSelf, P<FnDecl>) {
-        fn maybe_parse_explicit_self(explicit_self: ast::ExplicitSelf_,
-                                     p: &mut Parser)
-                                     -> ast::ExplicitSelf_ {
-            // We need to make sure it isn't a type
-            if p.look_ahead(1, |t| token::is_keyword(keywords::Self, t)) {
-                p.bump();
-                p.expect_self_ident();
-                explicit_self
-            } else {
-                SelfStatic
-            }
-        }
-
         fn maybe_parse_borrowed_explicit_self(this: &mut Parser)
                                               -> ast::ExplicitSelf_ {
             // The following things are possible to see here:
@@ -3650,11 +3637,15 @@ fn maybe_parse_borrowed_explicit_self(this: &mut Parser)
             token::BINOP(token::AND) => {
                 maybe_parse_borrowed_explicit_self(self)
             }
-            token::AT => {
-                maybe_parse_explicit_self(SelfBox, self)
-            }
             token::TILDE => {
-                maybe_parse_explicit_self(SelfUniq, self)
+                // We need to make sure it isn't a type
+                if self.look_ahead(1, |t| token::is_keyword(keywords::Self, t)) {
+                    self.bump();
+                    self.expect_self_ident();
+                    SelfUniq
+                } else {
+                    SelfStatic
+                }
             }
             token::IDENT(..) if self.is_self_ident() => {
                 self.bump();
index e291583d121d7ff00daae27dd204441055cb6c9f..7f7f57b13a94a75cdd999880e4118b2683a40b03 100644 (file)
 use std::io::MemWriter;
 
 // The &mut State is stored here to prevent recursive type.
-pub enum AnnNode<'a,'b> {
-    NodeBlock(&'b mut State, &'a ast::Block),
-    NodeItem(&'b mut State, &'a ast::Item),
-    NodeExpr(&'b mut State, &'a ast::Expr),
-    NodePat(&'b mut State, &'a ast::Pat),
+pub enum AnnNode<'a, 'b> {
+    NodeBlock(&'a mut State<'a>, &'b ast::Block),
+    NodeItem(&'a mut State<'a>, &'b ast::Item),
+    NodeExpr(&'a mut State<'a>, &'b ast::Expr),
+    NodePat(&'a mut State<'a>, &'b ast::Pat),
 }
 
 pub trait PpAnn {
@@ -56,7 +56,7 @@ pub struct CurrentCommentAndLiteral {
     cur_lit: uint,
 }
 
-pub struct State {
+pub struct State<'a> {
     s: pp::Printer,
     cm: Option<@CodeMap>,
     intr: @token::IdentInterner,
@@ -64,7 +64,7 @@ pub struct State {
     literals: Option<~[comments::Literal]>,
     cur_cmnt_and_lit: CurrentCommentAndLiteral,
     boxes: RefCell<~[pp::Breaks]>,
-    ann: @PpAnn
+    ann: &'a PpAnn
 }
 
 pub fn ibox(s: &mut State, u: uint) -> io::IoResult<()> {
@@ -83,15 +83,15 @@ pub fn end(s: &mut State) -> io::IoResult<()> {
     pp::end(&mut s.s)
 }
 
-pub fn rust_printer(writer: ~io::Writer, intr: @IdentInterner) -> State {
-    return rust_printer_annotated(writer, intr, @NoAnn as @PpAnn);
+pub fn rust_printer(writer: ~io::Writer, intr: @IdentInterner) -> State<'static> {
+    rust_printer_annotated(writer, intr, &NoAnn)
 }
 
-pub fn rust_printer_annotated(writer: ~io::Writer,
-                              intr: @IdentInterner,
-                              ann: @PpAnn)
-                              -> State {
-    return State {
+pub fn rust_printer_annotated<'a>(writer: ~io::Writer,
+                                  intr: @IdentInterner,
+                                  ann: &'a PpAnn)
+                                  -> State<'a> {
+    State {
         s: pp::mk_printer(writer, default_columns),
         cm: None,
         intr: intr,
@@ -103,7 +103,7 @@ pub fn rust_printer_annotated(writer: ~io::Writer,
         },
         boxes: RefCell::new(~[]),
         ann: ann
-    };
+    }
 }
 
 pub static indent_unit: uint = 4u;
@@ -120,7 +120,7 @@ pub fn print_crate(cm: @CodeMap,
                    filename: ~str,
                    input: &mut io::Reader,
                    out: ~io::Writer,
-                   ann: @PpAnn,
+                   ann: &PpAnn,
                    is_expanded: bool) -> io::IoResult<()> {
     let (cmnts, lits) = comments::gather_comments_and_literals(
         span_diagnostic,
@@ -1844,9 +1844,6 @@ fn print_explicit_self(s: &mut State,
             if_ok!(print_mutability(s, m));
             if_ok!(word(&mut s.s, "self"));
         }
-        ast::SelfBox => {
-            if_ok!(word(&mut s.s, "@self"));
-        }
     }
     return Ok(true);
 }
index aa22f47221bfa629044aad5135bcb1e28775b20f..8c7ad028a8ee06a787015583f1fc7c3760c38590 100644 (file)
@@ -18,7 +18,7 @@
 // map a string to tts, using a made-up filename: return both the TokenTree's
 // and the ParseSess
 pub fn string_to_tts_and_sess (source_str : ~str) -> (~[ast::TokenTree], @ParseSess) {
-    let ps = new_parse_sess(None);
+    let ps = new_parse_sess();
     (filemap_to_tts(ps,string_to_filemap(ps,source_str,~"bogofile")),ps)
 }
 
@@ -29,7 +29,7 @@ pub fn string_to_tts(source_str : ~str) -> ~[ast::TokenTree] {
 }
 
 pub fn string_to_parser_and_sess(source_str: ~str) -> (Parser,@ParseSess) {
-    let ps = new_parse_sess(None);
+    let ps = new_parse_sess();
     (new_parser_from_source_str(ps,~[],~"bogofile",source_str),ps)
 }
 
index 2a6c14f0eaef721d0281d745f43525ae480aecf8..0c6ecf73f6a938e268a4794d536d2f570ba9f601 100644 (file)
@@ -186,7 +186,7 @@ fn walk_explicit_self<E: Clone, V: Visitor<E>>(visitor: &mut V,
                                                explicit_self: &ExplicitSelf,
                                                env: E) {
     match explicit_self.node {
-        SelfStatic | SelfValue | SelfBox | SelfUniq => {}
+        SelfStatic | SelfValue | SelfUniq => {}
         SelfRegion(ref lifetime, _) => {
             visitor.visit_opt_lifetime_ref(explicit_self.span, lifetime, env)
         }
index c7ffa4a39ac40263c3253a21d29dff59c1eff9c0..cb0eac704d965bd80ab27f7b8cfc1436ba05f0d4 100644 (file)
@@ -8,14 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
 #[crate_id="a"];
 #[crate_type = "lib"];
 
 pub trait i<T> { }
 
-pub fn f<T>() -> @i<T> {
+pub fn f<T>() -> ~i<T> {
     impl<T> i<T> for () { }
 
-    @() as @i<T>
+    ~() as ~i<T>
 }
index ce762e351f93dd680e98c8b855708d5f76842072..daeb5b728571663425c87be3ea05bf72756d7864 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 trait Foo {
     fn borrowed<'a>(&'a self) -> &'a ();
 }
@@ -18,14 +16,6 @@ fn borrowed_receiver<'a>(x: &'a Foo) -> &'a () {
     x.borrowed()
 }
 
-fn managed_receiver(x: @Foo) -> &() {
-    x.borrowed() //~ ERROR cannot root managed value long enough
-}
-
-fn managed_receiver_1(x: @Foo) {
-    *x.borrowed()
-}
-
 fn owned_receiver(x: ~Foo) -> &() {
     x.borrowed() //~ ERROR borrowed value does not live long enough
 }
index 1d1b993f5d1fee7faa7bf0cde4a696d18822a13b..d4203dc9916ab41ea36a2846723160af47e050ea 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 trait Foo {
     fn borrowed(&self);
     fn borrowed_mut(&mut self);
@@ -25,11 +23,6 @@ fn borrowed_mut_receiver(x: &mut Foo) {
     x.borrowed_mut();
 }
 
-fn managed_receiver(x: @Foo) {
-    x.borrowed();
-    x.borrowed_mut(); //~ ERROR cannot borrow
-}
-
 fn owned_receiver(x: ~Foo) {
     x.borrowed();
     x.borrowed_mut(); //~ ERROR cannot borrow
index 4abd9898d8778c3139221fc81288efe062190701..18f6fc25149bf89da3dadce114ec1b9595d492d5 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 trait noisy {
   fn speak(&self);
 }
@@ -59,6 +57,6 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
 }
 
 fn main() {
-  let nyan : @noisy  = @cat(0, 2, ~"nyan") as @noisy;
+  let nyan: ~noisy = ~cat(0, 2, ~"nyan") as ~noisy;
   nyan.eat(); //~ ERROR does not implement any method in scope named `eat`
 }
index 619ce688d0835c1259be3ed8853f8756de6473d4..5228e03b8bd82aee71d0212a902e9077a591fcc2 100644 (file)
@@ -8,9 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
-// error-pattern: type `@Foo:'static` does not implement any method in scope named `foo`
+// error-pattern: type `&Foo<no-bounds>` does not implement any method in scope named `foo`
 
 trait Foo {
     fn foo(~self);
@@ -21,5 +19,5 @@ fn foo(~self) { }
 }
 
 fn main() {
-    (@5 as @Foo).foo();
+    (&5 as &Foo).foo();
 }
diff --git a/src/test/compile-fail/kindck-owned-trait.rs b/src/test/compile-fail/kindck-owned-trait.rs
deleted file mode 100644 (file)
index 87e9769..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[feature(managed_boxes)];
-
-trait foo { fn foo(&self); }
-
-fn to_foo<T:Clone + foo>(t: T) -> @foo {
-    @t as @foo
-    //~^ ERROR value may contain references; add `'static` bound
-    //~^^ ERROR cannot pack type
-    //~^^^ ERROR value may contain references
-}
-
-fn to_foo2<T:Clone + foo + 'static>(t: T) -> @foo {
-    @t as @foo
-}
-
-fn main() {}
index 8899f3f5dbbcfd1b986342ab39c2295c2827422b..fa359dcd538f7f4c7e7834f8fab11a1d25f3025c 100644 (file)
@@ -23,8 +23,6 @@ fn main() {
 
     @2; //~ ERROR type uses managed
 
-    fn f(_: @Clone) {} //~ ERROR type uses managed
-
     ~2; //~ ERROR type uses owned
     ~[1]; //~ ERROR type uses owned
     //~^ ERROR type uses owned
index 0a1eab913be199c0ae53a5291ff6800cb863cdb7..697678e286d82ec2020cefe71d8664f09c7b1288 100644 (file)
@@ -8,16 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 use std::container::Map;
 use std::hashmap::HashMap;
 
 // Test that trait types printed in error msgs include the type arguments.
 
 fn main() {
-    let x: @HashMap<~str, ~str> = @HashMap::new();
-    let x: @Map<~str, ~str> = x;
-    let y: @Map<uint, ~str> = @x;
-    //~^ ERROR failed to find an implementation of trait std::container::Map<uint,~str> for @std::container::Map<~str,~str>:'static
+    let x: ~HashMap<~str, ~str> = ~HashMap::new();
+    let x: ~Map<~str, ~str> = x;
+    let y: ~Map<uint, ~str> = ~x;
+    //~^ ERROR failed to find an implementation of trait std::container::Map<uint,~str> for ~std::container::Map<~str,~str>:Send
 }
index 916bb74edb251fc577219c10aaae44e718a54305..95f92380816657bd029ffdc8e61854fbb5f80ee9 100644 (file)
@@ -8,12 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
-// Test that an object type `@Foo` is not considered to implement the
+// Test that an object type `~Foo` is not considered to implement the
 // trait `Foo`. Issue #5087.
 
 trait Foo {}
 fn take_foo<F:Foo>(f: F) {}
-fn take_object(f: @Foo) { take_foo(f); } //~ ERROR failed to find an implementation of trait
+fn take_object(f: ~Foo) { take_foo(f); } //~ ERROR failed to find an implementation of trait
 fn main() {}
index 2270cb6f498b1f479958644eba0f0edece7d713c..ab2aa928c263925b01b7c47a3c419e5ce627aef5 100644 (file)
@@ -8,35 +8,22 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 trait Foo {
     fn borrowed(&self);
     fn borrowed_mut(&mut self);
 
-    fn managed(@self);
-
     fn owned(~self);
 }
 
 fn borrowed_receiver(x: &Foo) {
     x.borrowed();
     x.borrowed_mut(); // See [1]
-    x.managed(); //~ ERROR does not implement any method
     x.owned(); //~ ERROR does not implement any method
 }
 
 fn borrowed_mut_receiver(x: &mut Foo) {
     x.borrowed();
     x.borrowed_mut();
-    x.managed(); //~ ERROR does not implement any method
-    x.owned(); //~ ERROR does not implement any method
-}
-
-fn managed_receiver(x: @Foo) {
-    x.borrowed();
-    x.borrowed_mut(); // See [1]
-    x.managed();
     x.owned(); //~ ERROR does not implement any method
 }
 
index 8e6b821294b26d620fa0059e702ffb773fe82269..7aa545ab1b940378f296d2a824987b2e73241a11 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 struct ctxt { v: uint }
 
 trait get_ctxt {
@@ -29,12 +27,12 @@ fn get_ctxt(&self) -> &'a ctxt { //~ ERROR method `get_ctxt` has an incompatible
 
 }
 
-fn get_v(gc: @get_ctxt) -> uint {
+fn get_v(gc: ~get_ctxt) -> uint {
     gc.get_ctxt().v
 }
 
 fn main() {
     let ctxt = ctxt { v: 22u };
     let hc = has_ctxt { c: &ctxt };
-    assert_eq!(get_v(@hc as @get_ctxt), 22u);
+    assert_eq!(get_v(~hc as ~get_ctxt), 22u);
 }
index d6c9780620135b90874cd44ad666ef1f7efa04f3..73df5c3967c0918f5dde6208d92151ad36ad2108 100644 (file)
@@ -8,13 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 trait add {
     fn plus(&self, x: Self) -> Self;
 }
 
-fn do_add(x: @add, y: @add) -> @add {
+fn do_add(x: ~add, y: ~add) -> ~add {
     x.plus(y) //~ ERROR cannot call a method whose type contains a self-type through an object
 }
 
index d907022da71dc2202688e097fdec52d42b642834..b9fb94e09ed5a37d747124ebc99514d7389dc883 100644 (file)
@@ -8,32 +8,22 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 // Tests for "default" bounds inferred for traits with no bounds list.
 
-trait Foo {
-}
+trait Foo {}
 
 fn a(_x: ~Foo) { // should be same as ~Foo:Send
 }
 
-fn b(_x: @Foo) { // should be same as ~Foo:'static
-}
-
-fn c(_x: &'static Foo) { // should be same as &'static Foo:'static
+fn b(_x: &'static Foo) { // should be same as &'static Foo:'static
 }
 
-fn d(x: ~Foo:Freeze) {
+fn c(x: ~Foo:Freeze) {
     a(x); //~ ERROR expected bounds `Send`
 }
 
-fn e(x: @Foo:Freeze) {
+fn d(x: &'static Foo:Freeze) {
     b(x); //~ ERROR expected bounds `'static`
 }
 
-fn f(x: &'static Foo:Freeze) {
-    c(x); //~ ERROR expected bounds `'static`
-}
-
-fn main() { }
+fn main() {}
index 2d73158add2e14176f99033d21643d957a6737b9..f04770409a2858bd08d9dfe3812ee0369620a91c 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 struct Struct {
     person: &'static str
 }
@@ -25,7 +23,7 @@ fn f(&self, x: &'static str) {
 }
 
 fn main() {
-    let s: @Trait<int> = @Struct { person: "Fred" };    //~ ERROR expected Trait<int>, but found Trait<&'static str>
+    let s: ~Trait<int> = ~Struct { person: "Fred" };    //~ ERROR expected Trait<int>, but found Trait<&'static str>
     //~^ ERROR expected Trait<int>, but found Trait<&'static str>
     s.f(1);
 }
index 1ea18a7c75b4d1c8fdbed3f5584adc5350507f01..2aeebc0f1a8dc0badacd0019243137d3733e5631 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 struct Struct {
     person: &'static str
 }
@@ -27,6 +25,6 @@ fn f(&self, x: &'static str) {
 fn main() {
     let person = ~"Fred";
     let person: &str = person;  //~ ERROR borrowed value does not live long enough
-    let s: @Trait<&'static str> = @Struct { person: person };
+    let s: ~Trait<&'static str> = ~Struct { person: person };
 }
 
index 3006b6e5acf3549b12a8a53d49ead42b200fb935..acac7ae9556cd89b84616485f6789ae706713bd8 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
 impl bar for int { fn dup(&self) -> int { *self } fn blah<X>(&self) {} }
 impl bar for uint { fn dup(&self) -> uint { *self } fn blah<X>(&self) {} }
@@ -17,5 +15,5 @@ impl bar for uint { fn dup(&self) -> uint { *self } fn blah<X>(&self) {} }
 fn main() {
     10i.dup::<int>(); //~ ERROR does not take type parameters
     10i.blah::<int, int>(); //~ ERROR incorrect number of type parameters
-    (@10 as @bar).dup(); //~ ERROR contains a self-type
+    (~10 as ~bar).dup(); //~ ERROR contains a self-type
 }
index 767293c3dc8c86bc95524746dca15da02291ff30..f71106cacb161b2750771b8ee51572e64337ec6f 100644 (file)
 // check:$15 = -10.5
 // debugger:continue
 
-// MANAGED BY REF
-// debugger:finish
-// debugger:print *self
-// check:$16 = {x = -1}
-// debugger:print arg1
-// check:$17 = -11
-// debugger:print arg2
-// check:$18 = -12.5
-// debugger:continue
-
-// MANAGED BY VAL
-// debugger:finish
-// debugger:print self
-// check:$19 = {x = -1}
-// debugger:print arg1
-// check:$20 = -13
-// debugger:print *arg2
-// check:$21 = {-14, 14}
-// debugger:continue
-
-// MANAGED SELF
-// debugger:finish
-// debugger:print self->val
-// check:$22 = {x = -1}
-// debugger:print arg1
-// check:$23 = -15
-// debugger:print *arg2
-// check:$24 = {-16, 16.5}
-// debugger:continue
-
-#[feature(managed_boxes)];
-
 struct Struct<T> {
     x: T
 }
@@ -116,11 +84,6 @@ fn self_owned<T2>(~self, arg1: int, arg2: T2) -> int {
         zzz();
         arg1
     }
-
-    fn self_managed<T2>(@self, arg1: int, arg2: T2) -> int {
-        zzz();
-        arg1
-    }
 }
 
 fn main() {
@@ -132,11 +95,6 @@ fn main() {
     let _ = owned.self_by_ref(-5, -6_i32);
     let _ = owned.self_by_val(-7, -8_i64);
     let _ = owned.self_owned(-9, -10.5_f32);
-
-    let managed = @Struct { x: -1_i16 };
-    let _ = managed.self_by_ref(-11, -12.5_f64);
-    let _ = managed.self_by_val(-13, &(-14, 14));
-    let _ = managed.self_managed(-15, &(-16, 16.5));
 }
 
 fn zzz() {()}
index 272da1690fd192a87ff11f4f3f1647385b27928c..79594c5d3895d8d12f441ff84c08e24d9ba39e66 100644 (file)
 // check:$15 = -10
 // debugger:continue
 
-// MANAGED BY REF
-// debugger:finish
-// debugger:print *self
-// check:$16 = {{Variant2, [...]}, {Variant2, 117901063}}
-// debugger:print arg1
-// check:$17 = -11
-// debugger:print arg2
-// check:$18 = -12
-// debugger:continue
-
-// MANAGED BY VAL
-// debugger:finish
-// debugger:print self
-// check:$19 = {{Variant2, [...]}, {Variant2, 117901063}}
-// debugger:print arg1
-// check:$20 = -13
-// debugger:print arg2
-// check:$21 = -14
-// debugger:continue
-
-// MANAGED SELF
-// debugger:finish
-// debugger:print self->val
-// check:$22 = {{Variant2, [...]}, {Variant2, 117901063}}
-// debugger:print arg1
-// check:$23 = -15
-// debugger:print arg2
-// check:$24 = -16
-// debugger:continue
-
-#[feature(managed_boxes)];
 #[feature(struct_variant)];
 
 enum Enum {
@@ -118,11 +87,6 @@ fn self_owned(~self, arg1: int, arg2: int) -> int {
         zzz();
         arg1 + arg2
     }
-
-    fn self_managed(@self, arg1: int, arg2: int) -> int {
-        zzz();
-        arg1 + arg2
-    }
 }
 
 fn main() {
@@ -134,11 +98,6 @@ fn main() {
     let _ = owned.self_by_ref(-5, -6);
     let _ = owned.self_by_val(-7, -8);
     let _ = owned.self_owned(-9, -10);
-
-    let managed = @Variant2(117901063);
-    let _ = managed.self_by_ref(-11, -12);
-    let _ = managed.self_by_val(-13, -14);
-    let _ = managed.self_managed(-15, -16);
 }
 
 fn zzz() {()}
index ebfdea0437709006af744268d07ca7446aec7c0b..fc78aba707fe5eed966ca513a4339de1014f0ed9 100644 (file)
 // check:$15 = -10
 // debugger:continue
 
-// MANAGED BY REF
-// debugger:finish
-// debugger:print *self
-// check:$16 = {x = -1}
-// debugger:print arg1
-// check:$17 = -11
-// debugger:print arg2
-// check:$18 = -12
-// debugger:continue
-
-// MANAGED BY VAL
-// debugger:finish
-// debugger:print self
-// check:$19 = {x = -1}
-// debugger:print arg1
-// check:$20 = -13
-// debugger:print arg2
-// check:$21 = -14
-// debugger:continue
-
-// MANAGED SELF
-// debugger:finish
-// debugger:print self->val
-// check:$22 = {x = -1}
-// debugger:print arg1
-// check:$23 = -15
-// debugger:print arg2
-// check:$24 = -16
-// debugger:continue
-
-#[feature(managed_boxes)];
-
 struct Struct<T> {
     x: T
 }
@@ -116,11 +84,6 @@ fn self_owned(~self, arg1: int, arg2: int) -> int {
         zzz();
         arg1 + arg2
     }
-
-    fn self_managed(@self, arg1: int, arg2: int) -> int {
-        zzz();
-        arg1 + arg2
-    }
 }
 
 fn main() {
@@ -132,11 +95,6 @@ fn main() {
     let _ = owned.self_by_ref(-5, -6);
     let _ = owned.self_by_val(-7, -8);
     let _ = owned.self_owned(-9, -10);
-
-    let managed = @Struct { x: -1_i16 };
-    let _ = managed.self_by_ref(-11, -12);
-    let _ = managed.self_by_val(-13, -14);
-    let _ = managed.self_managed(-15, -16);
 }
 
 fn zzz() {()}
index e88e5a5ca636c593ceb3ef4eaab6ebedbab69f6b..035ebf9caebd3fecc5e35acfd477c32b27040325 100644 (file)
 // check:$15 = -10
 // debugger:continue
 
-// MANAGED BY REF
-// debugger:finish
-// debugger:print *self
-// check:$16 = {x = 300}
-// debugger:print arg1
-// check:$17 = -11
-// debugger:print arg2
-// check:$18 = -12
-// debugger:continue
-
-// MANAGED BY VAL
-// debugger:finish
-// debugger:print self
-// check:$19 = {x = 300}
-// debugger:print arg1
-// check:$20 = -13
-// debugger:print arg2
-// check:$21 = -14
-// debugger:continue
-
-// MANAGED SELF
-// debugger:finish
-// debugger:print self->val
-// check:$22 = {x = 300}
-// debugger:print arg1
-// check:$23 = -15
-// debugger:print arg2
-// check:$24 = -16
-// debugger:continue
-
-#[feature(managed_boxes)];
-
 struct Struct {
     x: int
 }
@@ -116,11 +84,6 @@ fn self_owned(~self, arg1: int, arg2: int) -> int {
         zzz();
         self.x + arg1 + arg2
     }
-
-    fn self_managed(@self, arg1: int, arg2: int) -> int {
-        zzz();
-        self.x + arg1 + arg2
-    }
 }
 
 fn main() {
@@ -132,11 +95,6 @@ fn main() {
     let _ = owned.self_by_ref(-5, -6);
     let _ = owned.self_by_val(-7, -8);
     let _ = owned.self_owned(-9, -10);
-
-    let managed = @Struct { x: 300 };
-    let _ = managed.self_by_ref(-11, -12);
-    let _ = managed.self_by_val(-13, -14);
-    let _ = managed.self_managed(-15, -16);
 }
 
 fn zzz() {()}
index fd58cc1a7d3ba7fd4080b9f30cbb7696eda1e147..7cd5a845cba149849979a0510589c2a4ec7645b9 100644 (file)
 // check:$15 = -10
 // debugger:continue
 
-// MANAGED BY REF
-// debugger:finish
-// debugger:print *self
-// check:$16 = {x = 300}
-// debugger:print arg1
-// check:$17 = -11
-// debugger:print arg2
-// check:$18 = -12
-// debugger:continue
-
-// MANAGED BY VAL
-// debugger:finish
-// debugger:print self
-// check:$19 = {x = 300}
-// debugger:print arg1
-// check:$20 = -13
-// debugger:print arg2
-// check:$21 = -14
-// debugger:continue
-
-// MANAGED SELF
-// debugger:finish
-// debugger:print self->val
-// check:$22 = {x = 300}
-// debugger:print arg1
-// check:$23 = -15
-// debugger:print arg2
-// check:$24 = -16
-// debugger:continue
-
-#[feature(managed_boxes)];
-
 struct Struct {
     x: int
 }
@@ -104,7 +72,6 @@ trait Trait {
     fn self_by_ref(&self, arg1: int, arg2: int) -> int;
     fn self_by_val(self, arg1: int, arg2: int) -> int;
     fn self_owned(~self, arg1: int, arg2: int) -> int;
-    fn self_managed(@self, arg1: int, arg2: int) -> int;
 }
 
 impl Trait for Struct {
@@ -123,11 +90,6 @@ fn self_owned(~self, arg1: int, arg2: int) -> int {
         zzz();
         self.x + arg1 + arg2
     }
-
-    fn self_managed(@self, arg1: int, arg2: int) -> int {
-        zzz();
-        self.x + arg1 + arg2
-    }
 }
 
 fn main() {
@@ -139,11 +101,6 @@ fn main() {
     let _ = owned.self_by_ref(-5, -6);
     let _ = owned.self_by_val(-7, -8);
     let _ = owned.self_owned(-9, -10);
-
-    let managed = @Struct { x: 300 };
-    let _ = managed.self_by_ref(-11, -12);
-    let _ = managed.self_by_val(-13, -14);
-    let _ = managed.self_managed(-15, -16);
 }
 
 fn zzz() {()}
index 98dbff988e74d83112c69eb68a5ca7d0732cc215..029a5cd4c913a470e0e59c790aedb85056ab6396 100644 (file)
 // check:$15 = -10
 // debugger:continue
 
-// MANAGED BY REF
-// debugger:finish
-// debugger:print *self
-// check:$16 = {300, -300.5}
-// debugger:print arg1
-// check:$17 = -11
-// debugger:print arg2
-// check:$18 = -12
-// debugger:continue
-
-// MANAGED BY VAL
-// debugger:finish
-// debugger:print self
-// check:$19 = {300, -300.5}
-// debugger:print arg1
-// check:$20 = -13
-// debugger:print arg2
-// check:$21 = -14
-// debugger:continue
-
-// MANAGED SELF
-// debugger:finish
-// debugger:print self->val
-// check:$22 = {300, -300.5}
-// debugger:print arg1
-// check:$23 = -15
-// debugger:print arg2
-// check:$24 = -16
-// debugger:continue
-
-#[feature(managed_boxes)];
-
 struct TupleStruct(int, f64);
 
 impl TupleStruct {
@@ -114,11 +82,6 @@ fn self_owned(~self, arg1: int, arg2: int) -> int {
         zzz();
         arg1 + arg2
     }
-
-    fn self_managed(@self, arg1: int, arg2: int) -> int {
-        zzz();
-        arg1 + arg2
-    }
 }
 
 fn main() {
@@ -130,11 +93,6 @@ fn main() {
     let _ = owned.self_by_ref(-5, -6);
     let _ = owned.self_by_val(-7, -8);
     let _ = owned.self_owned(-9, -10);
-
-    let managed = @TupleStruct(300, -300.5);
-    let _ = managed.self_by_ref(-11, -12);
-    let _ = managed.self_by_val(-13, -14);
-    let _ = managed.self_managed(-15, -16);
 }
 
 fn zzz() {()}
index d5f735e77f4e1f68be49bbe79e80c6f4de2886a4..9f0b0ea84142d1e8b6244c31f37d7db7d6c974d2 100644 (file)
 // check:$15 = -10
 // debugger:continue
 
-// MANAGED BY REF
-// debugger:finish
-// debugger:print *self
-// check:$16 = {x = 300}
-// debugger:print arg1
-// check:$17 = -11
-// debugger:print arg2
-// check:$18 = -12
-// debugger:continue
-
-// MANAGED BY VAL
-// debugger:finish
-// debugger:print self
-// check:$19 = {x = 300}
-// debugger:print arg1
-// check:$20 = -13
-// debugger:print arg2
-// check:$21 = -14
-// debugger:continue
-
-// MANAGED SELF
-// debugger:finish
-// debugger:print self->val
-// check:$22 = {x = 300}
-// debugger:print arg1
-// check:$23 = -15
-// debugger:print arg2
-// check:$24 = -16
-// debugger:continue
-
-#[feature(managed_boxes)];
-
 struct Struct {
     x: int
 }
@@ -115,11 +83,6 @@ fn self_owned(~self, arg1: int, arg2: int) -> int {
         zzz();
         arg1 + arg2
     }
-
-    fn self_managed(@self, arg1: int, arg2: int) -> int {
-        zzz();
-        arg1 + arg2
-    }
 }
 
 impl Trait for Struct {}
@@ -133,11 +96,6 @@ fn main() {
     let _ = owned.self_by_ref(-5, -6);
     let _ = owned.self_by_val(-7, -8);
     let _ = owned.self_owned(-9, -10);
-
-    let managed = @Struct { x: 300 };
-    let _ = managed.self_by_ref(-11, -12);
-    let _ = managed.self_by_val(-13, -14);
-    let _ = managed.self_managed(-15, -16);
 }
 
 fn zzz() {()}
index e7a6ee776104ed845f91409a04a37a4e1aa15bf2..5ae88b3d0ce385934f4b3245a8c28bbe30439c19 100644 (file)
 // check:$15 = -10.5
 // debugger:continue
 
-// MANAGED BY REF
-// debugger:finish
-// debugger:print *self
-// check:$16 = {x = 897}
-// debugger:print arg1
-// check:$17 = -11
-// debugger:print arg2
-// check:$18 = -12.5
-// debugger:continue
-
-// MANAGED BY VAL
-// debugger:finish
-// debugger:print self
-// check:$19 = {x = 897}
-// debugger:print arg1
-// check:$20 = -13
-// debugger:print *arg2
-// check:$21 = {-14, 14}
-// debugger:continue
-
-// MANAGED SELF
-// debugger:finish
-// debugger:print self->val
-// check:$22 = {x = 897}
-// debugger:print arg1
-// check:$23 = -15
-// debugger:print *arg2
-// check:$24 = {-16, 16.5}
-// debugger:continue
-
-#[feature(managed_boxes)];
-
 struct Struct {
     x: int
 }
@@ -116,11 +84,6 @@ fn self_owned<T>(~self, arg1: int, arg2: T) -> int {
         zzz();
         arg1
     }
-
-    fn self_managed<T>(@self, arg1: int, arg2: T) -> int {
-        zzz();
-        arg1
-    }
 }
 
 impl Trait for Struct {}
@@ -134,11 +97,6 @@ fn main() {
     let _ = owned.self_by_ref(-5, -6_i32);
     let _ = owned.self_by_val(-7, -8_i64);
     let _ = owned.self_owned(-9, -10.5_f32);
-
-    let managed = @Struct { x: 897 };
-    let _ = managed.self_by_ref(-11, -12.5_f64);
-    let _ = managed.self_by_val(-13, &(-14, 14));
-    let _ = managed.self_managed(-15, &(-16, 16.5));
 }
 
 fn zzz() {()}
index 4bdfc6bfaf61a3d1710321b525ff7b6e41c6587f..de46e1aea5822be7219341a63c274ea44084fb17 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 // xfail-android: FIXME(#10381)
 
 // compile-flags:-Z extra-debug-info
@@ -32,6 +30,5 @@ impl Trait for Struct {}
 fn main() {
     let stack_struct = Struct { a:0, b: 1.0 };
     let reference: &Trait = &stack_struct as &Trait;
-    let managed: @Trait = @Struct { a:2, b: 3.0 } as @Trait;
     let unique: ~Trait = ~Struct { a:2, b: 3.0 } as ~Trait;
 }
diff --git a/src/test/run-fail/unwind-box-trait.rs b/src/test/run-fail/unwind-box-trait.rs
deleted file mode 100644 (file)
index 2139508..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[feature(managed_boxes)];
-
-// error-pattern:fail
-
-fn failfn() {
-    fail!();
-}
-
-trait i {
-    fn foo(&self);
-}
-
-impl i for ~int {
-    fn foo(&self) { }
-}
-
-fn main() {
-    let x = @~0 as @i;
-    failfn();
-    error!("{:?}", x);
-}
index 6c4cc9de4147da4c11c004b08930e61f06bdcc22..5683a2b66986118b7613260cd0494559a57bda24 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 struct pair<A,B> {
     a: A, b: B
 }
@@ -29,11 +27,11 @@ fn f(&self) -> (A, u16) {
     }
 }
 
-fn f<A:Clone + 'static>(a: A, b: u16) -> @Invokable<A> {
-    @Invoker {
+fn f<A:Clone + 'static>(a: A, b: u16) -> ~Invokable:<A> {
+    ~Invoker {
         a: a,
         b: b,
-    } as @Invokable<A>
+    } as ~Invokable:<A>
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/alignment-gep-tup-like-2.rs b/src/test/run-pass/alignment-gep-tup-like-2.rs
deleted file mode 100644 (file)
index e00f414..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[feature(managed_boxes)];
-
-use std::cell::RefCell;
-
-struct Pair<A,B> {
-    a: A, b: B
-}
-
-struct RecEnum<A>(Rec<A>);
-struct Rec<A> {
-    val: A,
-    rec: Option<@RefCell<RecEnum<A>>>
-}
-
-fn make_cycle<A:'static>(a: A) {
-    let g: @RefCell<RecEnum<A>> = @RefCell::new(RecEnum(Rec {val: a, rec: None}));
-    {
-        let mut gb = g.borrow_mut();
-        let gg = gb.get();
-        let RecEnum(ref mut gg) = *gg;
-        gg.rec = Some(g);
-    }
-}
-
-struct Invoker<A,B> {
-    a: A,
-    b: B,
-}
-
-trait Invokable<A,B> {
-    fn f(&self) -> (A, B);
-}
-
-impl<A:Clone,B:Clone> Invokable<A,B> for Invoker<A,B> {
-    fn f(&self) -> (A, B) {
-        (self.a.clone(), self.b.clone())
-    }
-}
-
-fn f<A:Send + Clone + 'static,
-     B:Send + Clone + 'static>(
-     a: A,
-     b: B)
-     -> @Invokable<A,B> {
-    @Invoker {
-        a: a,
-        b: b,
-    } as @Invokable<A,B>
-}
-
-pub fn main() {
-    let x = 22_u8;
-    let y = 44_u64;
-    let z = f(~x, y);
-    make_cycle(z);
-    let (a, b) = z.f();
-    info!("a={} b={}", *a as uint, b as uint);
-    assert_eq!(*a, x);
-    assert_eq!(b, y);
-}
index b3b09988cc3afdf847d9282c3b45d24e36904ec6..6f0bba72025f481f6563dd9ac7f7f088c293fa3e 100644 (file)
@@ -8,17 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 trait double {
-    fn double(@self) -> uint;
+    fn double(~self) -> uint;
 }
 
 impl double for uint {
-    fn double(@self) -> uint { *self * 2u }
+    fn double(~self) -> uint { *self * 2u }
 }
 
 pub fn main() {
-    let x = @(@3u as @double);
+    let x = ~(~3u as ~double);
     assert_eq!(x.double(), 6u);
 }
index 036bbcd48a5423e149290f9b858b8f95934ae3a9..a03ac80a3f16b111499316bc304f8576f3e9411b 100644 (file)
@@ -8,17 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 trait double {
-    fn double(@self) -> uint;
+    fn double(~self) -> uint;
 }
 
-impl double for @uint {
-    fn double(@self) -> uint { **self * 2u }
+impl double for ~uint {
+    fn double(~self) -> uint { **self * 2u }
 }
 
 pub fn main() {
-    let x = @@@@@3u;
+    let x = ~~~~~3u;
     assert_eq!(x.double(), 6u);
 }
index 79784688d497dbd325ca8adc2d87e2df08918736..7835eaae510d36a9127818d12be7cd3f5594c3f1 100644 (file)
@@ -8,17 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 trait double {
-    fn double(@self) -> uint;
+    fn double(~self) -> uint;
 }
 
 impl double for uint {
-    fn double(@self) -> uint { *self * 2u }
+    fn double(~self) -> uint { *self * 2u }
 }
 
 pub fn main() {
-    let x = @@3u;
+    let x = ~~3u;
     assert_eq!(x.double(), 6u);
 }
index 1a04abe3196e01e5336986c3f833f7c0b46862fb..81469e5454a880c7490f1f8b4db78863e7b0330c 100644 (file)
@@ -8,17 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 trait double {
-    fn double(@self) -> uint;
+    fn double(~self) -> uint;
 }
 
 impl double for uint {
-    fn double(@self) -> uint { *self * 2u }
+    fn double(~self) -> uint { *self * 2u }
 }
 
 pub fn main() {
-    let x = @3u;
+    let x = ~3u;
     assert_eq!(x.double(), 6u);
 }
diff --git a/src/test/run-pass/boxed-trait-with-vstore.rs b/src/test/run-pass/boxed-trait-with-vstore.rs
deleted file mode 100644 (file)
index aab5053..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[feature(managed_boxes)];
-
-trait Foo {
-    fn foo(@self);
-}
-
-impl Foo for int {
-    fn foo(@self) {
-        println!("Hello world!");
-    }
-}
-
-pub fn main() {
-    let x = @3 as @Foo;
-    x.foo();
-}
index 258ed4fb30babb7006487a5e8f23e4f32568511c..bfc6550523b1b9ac160d840ae5c977aa4c6e591c 100644 (file)
@@ -8,21 +8,19 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 // xfail-fast
 // aux-build:cci_class_cast.rs
 extern mod cci_class_cast;
 use std::to_str::ToStr;
 use cci_class_cast::kitty::cat;
 
-fn print_out(thing: @ToStr, expected: ~str) {
+fn print_out(thing: ~ToStr, expected: ~str) {
   let actual = thing.to_str();
   info!("{}", actual);
   assert_eq!(actual, expected);
 }
 
 pub fn main() {
-  let nyan : @ToStr = @cat(0u, 2, ~"nyan") as @ToStr;
+  let nyan: ~ToStr = ~cat(0u, 2, ~"nyan") as ~ToStr;
   print_out(nyan, ~"nyan");
 }
index 3e9765f0b2b248f19ea9838554420586ecc29da1..e93b3266b254ee04be8d1cd0a53b69b17939399d 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 // xfail-fast
 struct cat {
     meows : uint,
@@ -58,13 +56,13 @@ fn to_str(&self) -> ~str {
     }
 }
 
-fn print_out(thing: @ToStr, expected: ~str) {
+fn print_out(thing: ~ToStr, expected: ~str) {
   let actual = thing.to_str();
   info!("{}", actual);
   assert_eq!(actual, expected);
 }
 
 pub fn main() {
-  let nyan : @ToStr = @cat(0u, 2, ~"nyan") as @ToStr;
+  let nyan: ~ToStr = ~cat(0u, 2, ~"nyan") as ~ToStr;
   print_out(nyan, ~"nyan");
 }
index a1624e206caa2ab8eae55420dde3a31d9526d483..6ba665e4005f556aae1a5003e0e4af085b6f09fb 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 // If we use GEPi rathern than GEP_tup_like when
 // storing closure data (as we used to do), the u64 would
 // overwrite the u16.
@@ -33,11 +31,11 @@ fn f(&self) -> (A, u16) {
     }
 }
 
-fn f<A:Clone + 'static>(a: A, b: u16) -> @Invokable<A> {
-    @Invoker {
+fn f<A:Clone + 'static>(a: A, b: u16) -> ~Invokable:<A> {
+    ~Invoker {
         a: a,
         b: b,
-    } as @Invokable<A>
+    } as ~Invokable:<A>
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/explicit-self-objects-box.rs b/src/test/run-pass/explicit-self-objects-box.rs
deleted file mode 100644 (file)
index faf2a61..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[feature(managed_boxes)];
-
-trait Foo {
-    fn f(@self);
-}
-
-struct S {
-    x: int
-}
-
-impl Foo for S {
-    fn f(@self) {
-        assert_eq!(self.x, 3);
-    }
-}
-
-pub fn main() {
-    let x = @S { x: 3 };
-    let y = x as @Foo;
-    y.f();
-    y.f();
-    y.f();
-    y.f();
-}
diff --git a/src/test/run-pass/explicit-self-objects-simple.rs b/src/test/run-pass/explicit-self-objects-simple.rs
deleted file mode 100644 (file)
index ca64516..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[feature(managed_boxes)];
-
-trait Foo {
-    fn f(&self);
-}
-
-struct S {
-    x: int
-}
-
-impl Foo for S {
-    fn f(&self) {
-        assert_eq!(self.x, 3);
-    }
-}
-
-pub fn main() {
-    let x = @S { x: 3 };
-    let y = x as @Foo;
-    y.f();
-}
index 65e6e384c5f1820b86ebe1400418a388fc5c8dd7..1076fc1662fa2e71c888d42c3c6d42c0799ee4bd 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 static tau: f64 = 2.0*3.14159265358979323;
 
 struct Point {x: f64, y: f64}
@@ -49,7 +47,7 @@ struct thing {
 
 #[deriving(Clone)]
 struct A {
-    a: @int
+    a: int
 }
 
 fn thing(x: A) -> thing {
@@ -59,26 +57,20 @@ fn thing(x: A) -> thing {
 }
 
 impl thing {
-    pub fn foo(@self) -> int { *self.x.a }
-    pub fn bar(~self) -> int { *self.x.a }
-    pub fn quux(&self) -> int { *self.x.a }
+    pub fn bar(~self) -> int { self.x.a }
+    pub fn quux(&self) -> int { self.x.a }
     pub fn baz<'a>(&'a self) -> &'a A { &self.x }
-    pub fn spam(self) -> int { *self.x.a }
+    pub fn spam(self) -> int { self.x.a }
 }
 
 trait Nus { fn f(&self); }
 impl Nus for thing { fn f(&self) {} }
 
 pub fn main() {
-
-    let x = @thing(A {a: @10});
-    assert_eq!(x.foo(), 10);
-    assert_eq!(x.quux(), 10);
-
-    let y = ~thing(A {a: @10});
+    let y = ~thing(A {a: 10});
     assert_eq!(y.clone().bar(), 10);
     assert_eq!(y.quux(), 10);
 
-    let z = thing(A {a: @11});
+    let z = thing(A {a: 11});
     assert_eq!(z.spam(), 11);
 }
index bff51d32333be31504ddb10925e09d0461e229a9..76db4a01829abe006a1eb5084593fa166d340e95 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 trait Foo<T> {
     fn get(&self) -> T;
 }
@@ -25,7 +23,7 @@ fn get(&self) -> int {
 }
 
 pub fn main() {
-    let x = @S { x: 1 };
-    let y = x as @Foo<int>;
+    let x = ~S { x: 1 };
+    let y = x as ~Foo<int>;
     assert_eq!(y.get(), 1);
 }
index 6ba253ca46149aeb3cb9f3e0796d0628b5e6473c..9e03023a9e9bac9c6392762f3d6034dc180849bb 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 trait clam<A> {
   fn chowder(&self, y: A);
 }
@@ -28,13 +26,13 @@ fn foo<A>(b: A) -> foo<A> {
     }
 }
 
-fn f<A>(x: @clam<A>, a: A) {
+fn f<A>(x: ~clam<A>, a: A) {
   x.chowder(a);
 }
 
 pub fn main() {
 
   let c = foo(42);
-  let d: @clam<int> = @c as @clam<int>;
+  let d: ~clam<int> = ~c as ~clam<int>;
   f(d, c.x);
 }
index 0c41d071ab0420cb22ce169805e6e3d4ebad1cef..d61622e6b0fca99d0fb2d54d7e516eefca72899f 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 // xfail-fast
 // aux-build:issue-2380.rs
 
index 4b932e2e57ebbc020e8a7df3f1cf079d1909dd99..a2a9228091e93de5b01a6ebe2fbd8bf5f7d57b0e 100644 (file)
@@ -8,19 +8,17 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 trait hax { }
 impl<A> hax for A { }
 
-fn perform_hax<T:'static>(x: @T) -> @hax {
-    @x as @hax
+fn perform_hax<T: 'static>(x: ~T) -> ~hax: {
+    ~x as ~hax:
 }
 
 fn deadcode() {
-    perform_hax(@~"deadcode");
+    perform_hax(~~"deadcode");
 }
 
 pub fn main() {
-    let _ = perform_hax(@42);
+    let _ = perform_hax(~42);
 }
index b1c357538ab7b118db13a4fae6ef67da36d861ed..327f2cb897fd026bc5bcb0e077bd40e2f271a056 100644 (file)
@@ -8,19 +8,17 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 trait hax { }
 impl<A> hax for A { }
 
-fn perform_hax<T:'static>(x: @T) -> @hax {
-    @x as @hax
+fn perform_hax<T: 'static>(x: ~T) -> ~hax: {
+    ~x as ~hax:
 }
 
 fn deadcode() {
-    perform_hax(@~"deadcode");
+    perform_hax(~~"deadcode");
 }
 
 pub fn main() {
-    perform_hax(@42);
+    perform_hax(~42);
 }
index 269093c010c90fd86cd1b9c986eed996e8547c08..8cf9436ef5134ec4c406de8d2be7a0ca8c0cd1ad 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 //type t = { a: int };
 // type t = { a: bool };
 type t = bool;
@@ -24,10 +22,10 @@ fn f(&self) { }
 
 pub fn main() {
   //    let x = ({a: 4i} as it);
-  //   let y = @({a: 4i});
-  //    let z = @({a: 4i} as it);
-  //    let z = @({a: true} as it);
-    let z = @(@true as @it);
+  //   let y = ~({a: 4i});
+  //    let z = ~({a: 4i} as it);
+  //    let z = ~({a: true} as it);
+    let z = ~(~true as ~it);
     //  x.f();
     // y.f();
     // (*z).f();
index 6f2d0481aec14462b0ed7754ba9021de34056f69..43f2e764e69027de8fc1d4b6997acf629a499d95 100644 (file)
@@ -8,14 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 pub fn main() {
   trait Text {
     fn to_str(&self) -> ~str;
   }
 
-  fn to_string(t: @Text) {
+  fn to_string(t: ~Text) {
     println!("{}", t.to_str());
   }
 
index f6c531334c95412f7ca1a7e42e80bcbfbdf3c6fb..8cc7d275789e979e959d9df9bfae9147debaa5c5 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 trait T {
     fn print(&self);
 }
@@ -33,9 +31,9 @@ fn print_s(s: &S) {
 }
 
 pub fn main() {
-    let s: @S = @S { s: 5 };
+    let s: ~S = ~S { s: 5 };
     print_s(s);
-    let t: @T = s as @T;
+    let t: ~T = s as ~T;
     print_t(t);
 
 }
index 2e59111e6897b5c0369845e5d22efa17604ab3c6..cf1f979acb4b01f9e3bcc5d31d5a5f105f4f378d 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 /*
 
 #7673 Polymorphically creating traits barely works
@@ -24,7 +22,3 @@ impl<T: 'static> A for T {}
 fn owned1<T: 'static>(a: T) { ~a as ~A:; } /* note `:` */
 fn owned2<T: 'static>(a: ~T) { a as ~A:; }
 fn owned3<T: 'static>(a: ~T) { ~a as ~A:; }
-
-fn managed1<T: 'static>(a: T) { @a as @A; }
-fn managed2<T: 'static>(a: @T) { a as @A; }
-fn managed3<T: 'static>(a: @T) { @a as @A; }
index bc6702c6df645db0c70a800ccfda3034a27a2ee1..3cb6f525cbcc02d7f5969e0f8d32cbc6a316af9b 100644 (file)
 
 // xfail-pretty
 
-#[feature(managed_boxes, macro_rules)];
+#[feature(macro_rules)];
 
-pub trait bomb { fn boom(@self, Ident); }
+pub trait bomb { fn boom(&self, Ident); }
 pub struct S;
-impl bomb for S { fn boom(@self, _: Ident) { } }
+impl bomb for S { fn boom(&self, _: Ident) { } }
 
 pub struct Ident { name: uint }
 
@@ -26,7 +26,7 @@ fn Ident_new() -> Ident {
     Ident {name: 0x6789ABCD }
 }
 
-pub fn light_fuse(fld: @bomb) {
+pub fn light_fuse(fld: ~bomb) {
     int3!();
     let f = || {
         int3!();
@@ -36,6 +36,6 @@ pub fn light_fuse(fld: @bomb) {
 }
 
 pub fn main() {
-    let b = @S as @bomb;
+    let b = ~S as ~bomb;
     light_fuse(b);
 }
index dab8a83ea36bb900c658bca87b68fd86caa3c83e..0a7e164ca5b985ad46ba04907a8dbb11a09be163 100644 (file)
@@ -8,23 +8,21 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 trait repeat<A> { fn get(&self) -> A; }
 
-impl<A:Clone + 'static> repeat<A> for @A {
+impl<A:Clone + 'static> repeat<A> for ~A {
     fn get(&self) -> A {
         (**self).clone()
     }
 }
 
-fn repeater<A:Clone + 'static>(v: @A) -> @repeat:<A> {
+fn repeater<A:Clone + 'static>(v: ~A) -> ~repeat:<A> {
     // Note: owned kind is not necessary as A appears in the trait type
-    @v as @repeat:<A> // No
+    ~v as ~repeat:<A> // No
 }
 
 pub fn main() {
     let x = 3;
-    let y = repeater(@x);
+    let y = repeater(~x);
     assert_eq!(x, y.get());
 }
diff --git a/src/test/run-pass/objects-coerce-from-managed-to-borrowed.rs b/src/test/run-pass/objects-coerce-from-managed-to-borrowed.rs
deleted file mode 100644 (file)
index 52792c8..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[feature(managed_boxes)];
-
-// Test that we can coerce an `@Object` to an `&Object`
-
-trait Foo {
-    fn foo(&self) -> uint;
-}
-
-impl Foo for uint {
-    fn foo(&self) -> uint {
-        *self
-    }
-}
-
-fn do_it_imm(obj: &Foo, v: uint) {
-    let y = obj.foo();
-    assert_eq!(v, y);
-}
-
-pub fn main() {
-    let x = @22u as @Foo;
-    do_it_imm(x, 22u);
-}
index 6a817bf03d40180c3e9c724981cdfd7b4851bc44..fbd58de1a7eb3d1f3f6d72d2828a26ecc0875f7d 100644 (file)
@@ -408,9 +408,9 @@ fn visit_leave_enum(&mut self, n_variants: uint,
     }
 
     fn visit_trait(&mut self, name: &str) -> bool {
-        self.align_to::<@TyVisitor>();
+        self.align_to::<~TyVisitor>();
         if ! self.inner().visit_trait(name) { return false; }
-        self.bump_past::<@TyVisitor>();
+        self.bump_past::<~TyVisitor>();
         true
     }
 
index f6ccf987fcbc1ae8d5b9352c1300a647be255450..2d8a42005df4dda4a3dd2e704a8aebe67b4a9c74 100644 (file)
@@ -8,10 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
-use std::io::println;
-
 trait Trait<T> {
     fn f(&self, x: T);
 }
@@ -27,18 +23,11 @@ fn f(&self, x: &'static str) {
     }
 }
 
-fn f(x: @Trait<&'static str>) {
-    x.f("Sue");
-}
-
 pub fn main() {
     let a = Struct { x: 1, y: 2 };
-    let b: @Trait<&'static str> = @a;
-    b.f("Fred");
-    let c: ~Trait<&'static str> = ~a;
-    c.f("Mary");
-    let d: &Trait<&'static str> = &a;
-    d.f("Joe");
-    f(@a);
+    let b: ~Trait<&'static str> = ~a;
+    b.f("Mary");
+    let c: &Trait<&'static str> = &a;
+    c.f("Joe");
 }
 
index 365831eda83dfc2d7049cf026545d9b68ec3653d..ea6d59a906809af9febd3b050a50e809c4077301 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 use std::io;
 
 trait Trait {
@@ -27,23 +25,16 @@ fn f(&self) {
     }
 }
 
-fn f(x: @Trait) {
-    x.f();
-}
-
 fn foo(mut a: ~Writer) {
     a.write(bytes!("Hello\n"));
 }
 
 pub fn main() {
     let a = Struct { x: 1, y: 2 };
-    let b: @Trait = @a;
+    let b: ~Trait = ~a;
     b.f();
-    let c: ~Trait = ~a;
+    let c: &Trait = &a;
     c.f();
-    let d: &Trait = &a;
-    d.f();
-    f(@a);
 
     let out = io::stdout();
     foo(~out);
index 3323b3c952ab9a75d309abe7747bb22f872097cb..e8387458ab60fea1b0ddc2e00256222855cfff48 100644 (file)
@@ -1,5 +1,3 @@
-#[feature(managed_boxes)];
-
 // xfail-fast
 // aux-build:trait_default_method_xc_aux.rs
 
@@ -66,7 +64,7 @@ pub fn main () {
     assert_eq!(g(0i, 3.14, 1), (3.14, 1));
     assert_eq!(g(false, 3.14, 1), (3.14, 1));
 
-    let obj = @0i as @A;
+    let obj = ~0i as ~A;
     assert_eq!(obj.h(), 11);
 
 
index fdae975a637cc9c5b0621b6c537de06aaa4216df..ebde7e787e41e4928b2f1fd5d8a7a97453c0ace6 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[feature(managed_boxes)];
-
 // test for #8664
 
 pub trait Trait2<A> {
@@ -42,7 +40,7 @@ impl<V> Trait<u8,V> for () {
     fn method(&self, _x: Type<(u8,V)>) -> int { 0 }
 }
 
-pub fn main () {
-    let a = @() as @Trait<u8, u8>;
+pub fn main() {
+    let a = ~() as ~Trait<u8, u8>;
     assert_eq!(a.method(Constant), 0);
 }