diff --git a/doc/tutorial-rustpkg.md b/doc/tutorial-rustpkg.md index 43d83093e..f1cf78fc6 100644 --- a/doc/tutorial-rustpkg.md +++ b/doc/tutorial-rustpkg.md @@ -7,7 +7,7 @@ package up your Rust code and share it with other people. This tutorial will get you started on all of the concepts and commands you need to give the gift of Rust code to someone else. -## Installing External Packages +# Installing External Packages First, let's try to use an external package somehow. I've made a sample package called `hello` to demonstrate how to do so. Here's how `hello` is used: @@ -68,7 +68,7 @@ Hello, world. Simple! That's all it takes. -## Workspaces +# Workspaces Before we can talk about how to make packages of your own, you have to understand the big concept with `rustpkg`: workspaces. A 'workspace' is simply @@ -88,14 +88,14 @@ There are also default file names you'll want to follow as well: * `main.rs`: A file that's going to become an executable. * `lib.rs`: A file that's going to become a library. -## Building your own Package +# Building your own Package Now that you've got workspaces down, let's build your own copy of `hello`. Go to wherever you keep your personal projects, and let's make all of the directories we'll need. I'll refer to this personal project directory as `~/src` for the rest of this tutorial. -### Creating our workspace +## Creating our workspace ~~~ {.notrust} $ cd ~/src @@ -150,7 +150,7 @@ pub fn world() { Put this into `src/hello/lib.rs`. Let's talk about each of these attributes: -### Crate attributes for packages +## Crate attributes for packages `license` is equally simple: the license we want this code to have. I chose MIT here, but you should pick whatever license makes the most sense for you. @@ -158,7 +158,7 @@ here, but you should pick whatever license makes the most sense for you. `desc` is a description of the package and what it does. This should just be a sentence or two. -### Building your package +## Building your package Building your package is simple: @@ -206,7 +206,7 @@ note: Installed package github.com/YOUR_USERNAME/hello-0.1 to /home/yourusername That's it! -## More resources +# More resources There's a lot more going on with `rustpkg`, this is just to get you started. Check out [the rustpkg manual](rustpkg.html) for the full details on how to diff --git a/doc/tutorial.md b/doc/tutorial.md index a8d384226..2f9a84d98 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -2995,7 +2995,7 @@ There is further documentation on the [wiki], however those tend to be even more [tasks]: tutorial-tasks.html [macros]: tutorial-macros.html [ffi]: tutorial-ffi.html -[rustpkg]: rustpkg.html +[rustpkg]: tutorial-rustpkg.html [wiki]: https://github.com/mozilla/rust/wiki/Docs diff --git a/mk/docs.mk b/mk/docs.mk index b89bf3483..e38590188 100644 --- a/mk/docs.mk +++ b/mk/docs.mk @@ -160,6 +160,16 @@ doc/tutorial-conditions.html: tutorial-conditions.md doc/version_info.html doc/r --include-before-body=doc/version_info.html \ --output=$@ +DOCS += doc/tutorial-rustpkg.html +doc/tutorial-rustpkg.html: tutorial-rustpkg.md doc/version_info.html doc/rust.css + @$(call E, pandoc: $@) + $(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \ + $(CFG_PANDOC) --standalone --toc \ + --section-divs --number-sections \ + --from=markdown --to=html --css=rust.css \ + --include-before-body=doc/version_info.html \ + --output=$@ + ifeq ($(CFG_PDFLATEX),) $(info cfg: no pdflatex found, omitting doc/rust.pdf) else diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index 48d630b4a..36c9b30c7 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -372,7 +372,7 @@ impl<'self> LookupContext<'self> { // to a trait and its supertraits. fn get_method_index(&self, trait_ref: @TraitRef, - subtrait_id: ast::DefId, + subtrait: @TraitRef, n_method: uint) -> uint { let tcx = self.tcx(); @@ -382,15 +382,14 @@ impl<'self> LookupContext<'self> { // we find the trait the method came from, counting up the // methods from them. let mut method_count = 0; - do ty::each_bound_trait_and_supertraits(tcx, &[trait_ref]) + do ty::each_bound_trait_and_supertraits(tcx, &[subtrait]) |bound_ref| { - if bound_ref.def_id == subtrait_id { false } + if bound_ref.def_id == trait_ref.def_id { false } else { - method_count += ty::trait_methods(tcx, bound_ref.def_id).len(); + method_count+=ty::trait_methods(tcx, bound_ref.def_id).len(); true } }; - return method_count + n_method; } @@ -418,9 +417,9 @@ impl<'self> LookupContext<'self> { let trait_ref = @TraitRef { def_id: did, substs: rcvr_substs.clone() }; do self.push_inherent_candidates_from_bounds_inner(&[trait_ref]) - |trait_ref, m, method_num, _bound_num| { + |new_trait_ref, m, method_num, _bound_num| { let vtable_index = - self.get_method_index(trait_ref, trait_ref.def_id, method_num); + self.get_method_index(new_trait_ref, trait_ref, method_num); // We need to fix up the transformed self type. let transformed_self_ty = self.construct_transformed_self_ty_for_object(