diff --git a/README.md b/README.md index 93f0daa7141f5..f92fc653e0ef3 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Read ["Installing Rust"] from [The Book]. # Choose one based on platform: $ pacman -S mingw-w64-i686-toolchain $ pacman -S mingw-w64-x86_64-toolchain - + $ pacman -S base-devel ``` diff --git a/mk/cfg/x86_64-unknown-linux-gnu.mk b/mk/cfg/x86_64-unknown-linux-gnu.mk index 845f9c1c52d19..e5866094ee84f 100644 --- a/mk/cfg/x86_64-unknown-linux-gnu.mk +++ b/mk/cfg/x86_64-unknown-linux-gnu.mk @@ -25,4 +25,3 @@ CFG_LDPATH_x86_64-unknown-linux-gnu := CFG_RUN_x86_64-unknown-linux-gnu=$(2) CFG_RUN_TARG_x86_64-unknown-linux-gnu=$(call CFG_RUN_x86_64-unknown-linux-gnu,,$(2)) CFG_GNU_TRIPLE_x86_64-unknown-linux-gnu := x86_64-unknown-linux-gnu - diff --git a/mk/prepare.mk b/mk/prepare.mk index f1c4aa65f5ffe..4ded8a7916b9b 100644 --- a/mk/prepare.mk +++ b/mk/prepare.mk @@ -221,5 +221,3 @@ prepare-maybe-clean-$(1): endef - - diff --git a/mk/util.mk b/mk/util.mk index 3bbc8f413aec5..b419c0bbe8ebe 100644 --- a/mk/util.mk +++ b/mk/util.mk @@ -17,4 +17,3 @@ else endif S := $(CFG_SRC_DIR) - diff --git a/src/doc/grammar.md b/src/doc/grammar.md index 68ca1cb72170a..1ea3c7d7bd9d8 100644 --- a/src/doc/grammar.md +++ b/src/doc/grammar.md @@ -290,7 +290,7 @@ transcriber : '(' transcriber * ')' | '[' transcriber * ']' # Items and attributes -**FIXME:** grammar? +**FIXME:** grammar? ## Items @@ -301,7 +301,7 @@ item : mod_item | fn_item | type_item | struct_item | enum_item ### Type Parameters -**FIXME:** grammar? +**FIXME:** grammar? ### Modules @@ -338,35 +338,35 @@ path_item : ident | "mod" ; ### Functions -**FIXME:** grammar? +**FIXME:** grammar? #### Generic functions -**FIXME:** grammar? +**FIXME:** grammar? #### Unsafety -**FIXME:** grammar? +**FIXME:** grammar? ##### Unsafe functions -**FIXME:** grammar? +**FIXME:** grammar? ##### Unsafe blocks -**FIXME:** grammar? +**FIXME:** grammar? #### Diverging functions -**FIXME:** grammar? +**FIXME:** grammar? ### Type definitions -**FIXME:** grammar? +**FIXME:** grammar? ### Structures -**FIXME:** grammar? +**FIXME:** grammar? ### Constant items @@ -382,15 +382,15 @@ static_item : "static" ident ':' type '=' expr ';' ; #### Mutable statics -**FIXME:** grammar? +**FIXME:** grammar? ### Traits -**FIXME:** grammar? +**FIXME:** grammar? ### Implementations -**FIXME:** grammar? +**FIXME:** grammar? ### External blocks @@ -401,11 +401,11 @@ extern_block : [ foreign_fn ] * ; ## Visibility and Privacy -**FIXME:** grammar? +**FIXME:** grammar? ### Re-exporting and Visibility -**FIXME:** grammar? +**FIXME:** grammar? ## Attributes @@ -420,11 +420,11 @@ meta_seq : meta_item [ ',' meta_seq ] ? ; ## Statements -**FIXME:** grammar? +**FIXME:** grammar? ### Declaration statements -**FIXME:** grammar? +**FIXME:** grammar? A _declaration statement_ is one that introduces one or more *names* into the enclosing statement block. The declared names may denote new slots or new @@ -432,7 +432,7 @@ items. #### Item declarations -**FIXME:** grammar? +**FIXME:** grammar? An _item declaration statement_ has a syntactic form identical to an [item](#items) declaration within a module. Declaring an item — a @@ -450,35 +450,35 @@ init : [ '=' ] expr ; ### Expression statements -**FIXME:** grammar? +**FIXME:** grammar? ## Expressions -**FIXME:** grammar? +**FIXME:** grammar? #### Lvalues, rvalues and temporaries -**FIXME:** grammar? +**FIXME:** grammar? #### Moved and copied types -**FIXME:** Do we want to capture this in the grammar as different productions? +**FIXME:** Do we want to capture this in the grammar as different productions? ### Literal expressions -**FIXME:** grammar? +**FIXME:** grammar? ### Path expressions -**FIXME:** grammar? +**FIXME:** grammar? ### Tuple expressions -**FIXME:** grammar? +**FIXME:** grammar? ### Unit expressions -**FIXME:** grammar? +**FIXME:** grammar? ### Structure expressions @@ -527,7 +527,7 @@ idx_expr : expr '[' expr ']' ; ### Unary operator expressions -**FIXME:** grammar? +**FIXME:** grammar? ### Binary operator expressions @@ -537,31 +537,31 @@ binop_expr : expr binop expr ; #### Arithmetic operators -**FIXME:** grammar? +**FIXME:** grammar? #### Bitwise operators -**FIXME:** grammar? +**FIXME:** grammar? #### Lazy boolean operators -**FIXME:** grammar? +**FIXME:** grammar? #### Comparison operators -**FIXME:** grammar? +**FIXME:** grammar? #### Type cast expressions -**FIXME:** grammar? +**FIXME:** grammar? #### Assignment expressions -**FIXME:** grammar? +**FIXME:** grammar? #### Compound assignment expressions -**FIXME:** grammar? +**FIXME:** grammar? #### Operator precedence @@ -680,49 +680,49 @@ return_expr : "return" expr ? ; # Type system -**FIXME:** is this entire chapter relevant here? Or should it all have been covered by some production already? +**FIXME:** is this entire chapter relevant here? Or should it all have been covered by some production already? ## Types ### Primitive types -**FIXME:** grammar? +**FIXME:** grammar? #### Machine types -**FIXME:** grammar? +**FIXME:** grammar? #### Machine-dependent integer types -**FIXME:** grammar? +**FIXME:** grammar? ### Textual types -**FIXME:** grammar? +**FIXME:** grammar? ### Tuple types -**FIXME:** grammar? +**FIXME:** grammar? ### Array, and Slice types -**FIXME:** grammar? +**FIXME:** grammar? ### Structure types -**FIXME:** grammar? +**FIXME:** grammar? ### Enumerated types -**FIXME:** grammar? +**FIXME:** grammar? ### Pointer types -**FIXME:** grammar? +**FIXME:** grammar? ### Function types -**FIXME:** grammar? +**FIXME:** grammar? ### Closure types @@ -739,15 +739,15 @@ bound := path | lifetime ### Object types -**FIXME:** grammar? +**FIXME:** grammar? ### Type parameters -**FIXME:** grammar? +**FIXME:** grammar? ### Self types -**FIXME:** grammar? +**FIXME:** grammar? ## Type kinds @@ -755,7 +755,7 @@ bound := path | lifetime # Memory and concurrency models -**FIXME:** is this entire chapter relevant here? Or should it all have been covered by some production already? +**FIXME:** is this entire chapter relevant here? Or should it all have been covered by some production already? ## Memory model diff --git a/src/doc/intro.md b/src/doc/intro.md index 9e575abeee217..51280e5885476 100644 --- a/src/doc/intro.md +++ b/src/doc/intro.md @@ -140,7 +140,7 @@ right at home if you've used tools like [Bundler](http://bundler.io/), [npm](https://www.npmjs.org/), or [pip](https://pip.pypa.io/en/latest/). There's no `Makefile`s or endless `autotools` output here. (Rust's tooling does [play nice with external libraries written in those -tools](http://crates.io/native-build.html), if you need to.) +tools](http://doc.crates.io/build-script.html), if you need to.) Enough about tools, let's talk code! diff --git a/src/doc/not_found.md b/src/doc/not_found.md index c746c5773dd09..eae2bf1925a99 100644 --- a/src/doc/not_found.md +++ b/src/doc/not_found.md @@ -63,4 +63,3 @@ function populate_rust_search() { populate_site_search(); populate_rust_search(); - diff --git a/src/doc/reference.md b/src/doc/reference.md index c4c122463a793..3fae49bfc6d3e 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -1961,16 +1961,18 @@ module through the rules above. It essentially allows public access into the re-exported item. For example, this program is valid: ``` -pub use self::implementation as api; +pub use self::implementation::api; mod implementation { - pub fn f() {} + pub mod api { + pub fn f() {} + } } # fn main() {} ``` -This means that any external crate referencing `implementation::f` would +This means that any external crate referencing `implementation::api::f` would receive a privacy violation, while the path `api::f` would be allowed. When re-exporting a private item, it can be thought of as allowing the "privacy diff --git a/src/doc/trpl/arrays-vectors-and-slices.md b/src/doc/trpl/arrays-vectors-and-slices.md index f1b5ecf4ff031..5d0f314e8c62e 100644 --- a/src/doc/trpl/arrays-vectors-and-slices.md +++ b/src/doc/trpl/arrays-vectors-and-slices.md @@ -49,7 +49,7 @@ languages. A *vector* is a dynamic or "growable" array, implemented as the standard library type [`Vec`](../std/vec/) (we'll talk about what the `` means -later). Vectors always allocate their data on the heap. Vectors are to slices +later). Vectors always allocate their data on the heap. Vectors are to slices what `String` is to `&str`. You can create them with the `vec!` macro: ```{rust} diff --git a/src/doc/trpl/crates-and-modules.md b/src/doc/trpl/crates-and-modules.md index 8eaad5067f09e..f6f6046b9b458 100644 --- a/src/doc/trpl/crates-and-modules.md +++ b/src/doc/trpl/crates-and-modules.md @@ -551,9 +551,9 @@ module, we now have a `phrases::japanese::hello()` function and a `phrases::japanese::farewells::goodbye()`. Our internal organization doesn't define our external interface. -Here we have a `pub use` for each function we want to bring into the +Here we have a `pub use` for each function we want to bring into the `japanese` scope. We could alternatively use the wildcard syntax to include -everything from `greetings` into the current scope: `pub use self::greetings::*`. +everything from `greetings` into the current scope: `pub use self::greetings::*`. What about the `self`? Well, by default, `use` declarations are absolute paths, starting from your crate root. `self` makes that path relative to your current diff --git a/src/doc/trpl/documentation.md b/src/doc/trpl/documentation.md index 0553fe3280c68..8e5b3b6a7f0af 100644 --- a/src/doc/trpl/documentation.md +++ b/src/doc/trpl/documentation.md @@ -306,23 +306,23 @@ println!("{}", x + y); Here's the same explanation, in raw text: > First, we set `x` to five: -> +> > ```text > let x = 5; > # let y = 6; > # println!("{}", x + y); > ``` -> +> > Next, we set `y` to six: -> +> > ```text > # let x = 5; > let y = 6; > # println!("{}", x + y); > ``` -> +> > Finally, we print the sum of `x` and `y`: -> +> > ```text > # let x = 5; > # let y = 6; @@ -521,4 +521,3 @@ This sets a few different options, with a logo, favicon, and a root URL. - `--html-before-content FILE`: includes the contents of FILE directly after ``, before the rendered content (including the search bar). - `--html-after-content FILE`: includes the contents of FILE after all the rendered content. - diff --git a/src/doc/trpl/ffi.md b/src/doc/trpl/ffi.md index 97e826579fd9b..20b0ffc1b2862 100644 --- a/src/doc/trpl/ffi.md +++ b/src/doc/trpl/ffi.md @@ -543,4 +543,3 @@ The `extern` makes this function adhere to the C calling convention, as discussed above in "[Foreign Calling Conventions](ffi.html#foreign-calling-conventions)". The `no_mangle` attribute turns off Rust's name mangling, so that it is easier to link to. - diff --git a/src/doc/trpl/method-syntax.md b/src/doc/trpl/method-syntax.md index 59be8c6704fd4..0ca42c3b12db2 100644 --- a/src/doc/trpl/method-syntax.md +++ b/src/doc/trpl/method-syntax.md @@ -61,15 +61,15 @@ struct Circle { impl Circle { fn reference(&self) { - println!("taking self by reference!"); + println!("taking self by reference!"); } fn mutable_reference(&mut self) { - println!("taking self by mutable reference!"); + println!("taking self by mutable reference!"); } fn takes_ownership(self) { - println!("taking ownership of self!"); + println!("taking ownership of self!"); } } ``` diff --git a/src/doc/trpl/static-and-dynamic-dispatch.md b/src/doc/trpl/static-and-dynamic-dispatch.md index 504ed63934c6a..a7794814156e6 100644 --- a/src/doc/trpl/static-and-dynamic-dispatch.md +++ b/src/doc/trpl/static-and-dynamic-dispatch.md @@ -95,7 +95,7 @@ However, the common case is that it is more efficient to use static dispatch, and one can always have a thin statically-dispatched wrapper function that does a dynamic dispatch, but not vice versa, meaning static calls are more flexible. The standard library tries to be statically dispatched where possible for this -reason. +reason. ## Dynamic dispatch diff --git a/src/doc/trpl/testing.md b/src/doc/trpl/testing.md index 54c74fdd3e2b5..537e100d7d830 100644 --- a/src/doc/trpl/testing.md +++ b/src/doc/trpl/testing.md @@ -1,7 +1,7 @@ % Testing > Program testing can be a very effective way to show the presence of bugs, but -> it is hopelessly inadequate for showing their absence. +> it is hopelessly inadequate for showing their absence. > > Edsger W. Dijkstra, "The Humble Programmer" (1972) @@ -308,7 +308,7 @@ extern crate adder; #[test] fn it_works() { assert_eq!(4, adder::add_two(2)); -} +} ``` This looks similar to our previous tests, but slightly different. We now have diff --git a/src/etc/featureck.py b/src/etc/featureck.py index ce972c91c8180..86fa779cced5f 100644 --- a/src/etc/featureck.py +++ b/src/etc/featureck.py @@ -242,4 +242,3 @@ for line in lines: print "* " + line print - diff --git a/src/etc/gdb_rust_pretty_printing.py b/src/etc/gdb_rust_pretty_printing.py index dbf27e88c143e..4e489df7dd75a 100755 --- a/src/etc/gdb_rust_pretty_printing.py +++ b/src/etc/gdb_rust_pretty_printing.py @@ -340,4 +340,4 @@ def extract_length_and_data_ptr_from_std_vec(vec_val): unique_ptr_val = vec_ptr_val[first_field(vec_ptr_val)] data_ptr = unique_ptr_val[first_field(unique_ptr_val)] assert data_ptr.type.code == gdb.TYPE_CODE_PTR - return (length, data_ptr) \ No newline at end of file + return (length, data_ptr) diff --git a/src/etc/mingw-fix-include/README.txt b/src/etc/mingw-fix-include/README.txt index 876db17a248a6..e36e6abde9178 100644 --- a/src/etc/mingw-fix-include/README.txt +++ b/src/etc/mingw-fix-include/README.txt @@ -1,6 +1,6 @@ The purpose of these headers is to fix issues with mingw v4.0, as described in #9246. -This works by adding this directory to GCC include search path before mingw system headers directories, +This works by adding this directory to GCC include search path before mingw system headers directories, so we can intercept their inclusions and add missing definitions without having to modify files in mingw/include. Once mingw fixes all 3 issues mentioned in #9246, this directory and all references to it from rust/mk/* may be removed. diff --git a/src/etc/third-party/COPYING.RUNTIME b/src/etc/third-party/COPYING.RUNTIME index e1b3c69c179df..e86f7fb58a465 100644 --- a/src/etc/third-party/COPYING.RUNTIME +++ b/src/etc/third-party/COPYING.RUNTIME @@ -70,4 +70,3 @@ consistent with the licensing of the Independent Modules. The availability of this Exception does not imply any general presumption that third-party software is unaffected by the copyleft requirements of the license of GCC. - diff --git a/src/grammar/check.sh b/src/grammar/check.sh index b5be3daa13e1d..b0628303b6601 100755 --- a/src/grammar/check.sh +++ b/src/grammar/check.sh @@ -50,4 +50,3 @@ else printf "failed. $passed passed; $failed failed; $skipped skipped\n\n" exit 1 fi - diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 748eb9dcb2fd4..8befb0579c3a6 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -94,7 +94,7 @@ use heap::deallocate; /// With simple pipes, without `Arc`, a copy would have to be made for each /// task. /// -/// ```rust +/// ``` /// use std::sync::Arc; /// use std::thread; /// diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 6d865d2bffa8a..451237d75969c 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -64,7 +64,7 @@ use core::raw::TraitObject; /// /// The following two examples are equivalent: /// -/// ```rust +/// ``` /// #![feature(box_syntax)] /// use std::boxed::HEAP; /// diff --git a/src/libbacktrace/Makefile.am b/src/libbacktrace/Makefile.am index 6add85d734151..437289982927d 100644 --- a/src/libbacktrace/Makefile.am +++ b/src/libbacktrace/Makefile.am @@ -6,12 +6,12 @@ # met: # (1) Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. +# notice, this list of conditions and the following disclaimer. # (2) Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the -# distribution. +# distribution. # (3) The name of the author may not be used to # endorse or promote products derived from this software without diff --git a/src/libbacktrace/Makefile.in b/src/libbacktrace/Makefile.in index 18c1ecaca545f..93ccec2dbf92f 100644 --- a/src/libbacktrace/Makefile.in +++ b/src/libbacktrace/Makefile.in @@ -23,12 +23,12 @@ # met: # (1) Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. +# notice, this list of conditions and the following disclaimer. # (2) Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the -# distribution. +# distribution. # (3) The name of the author may not be used to # endorse or promote products derived from this software without @@ -117,10 +117,10 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libbacktrace_la_SOURCES) $(EXTRA_libbacktrace_la_SOURCES) \ $(btest_SOURCES) -MULTISRCTOP = -MULTIBUILDTOP = -MULTIDIRS = -MULTISUBDIR = +MULTISRCTOP = +MULTIBUILDTOP = +MULTIDIRS = +MULTISUBDIR = MULTIDO = true MULTICLEAN = true ETAGS = etags @@ -362,7 +362,7 @@ config.h: stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ @@ -380,7 +380,7 @@ clean-noinstLTLIBRARIES: echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -libbacktrace.la: $(libbacktrace_la_OBJECTS) $(libbacktrace_la_DEPENDENCIES) +libbacktrace.la: $(libbacktrace_la_OBJECTS) $(libbacktrace_la_DEPENDENCIES) $(LINK) $(libbacktrace_la_OBJECTS) $(libbacktrace_la_LIBADD) $(LIBS) clean-checkPROGRAMS: @@ -391,7 +391,7 @@ clean-checkPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list -btest$(EXEEXT): $(btest_OBJECTS) $(btest_DEPENDENCIES) +btest$(EXEEXT): $(btest_OBJECTS) $(btest_DEPENDENCIES) @rm -f btest$(EXEEXT) $(btest_LINK) $(btest_OBJECTS) $(btest_LDADD) $(LIBS) diff --git a/src/libbacktrace/alloc.c b/src/libbacktrace/alloc.c index 37eca65349ee1..4aa85d050fd17 100644 --- a/src/libbacktrace/alloc.c +++ b/src/libbacktrace/alloc.c @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libbacktrace/atomic.c b/src/libbacktrace/atomic.c index f139d74aa5f37..b31fa64c798c8 100644 --- a/src/libbacktrace/atomic.c +++ b/src/libbacktrace/atomic.c @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libbacktrace/backtrace-supported.h.in b/src/libbacktrace/backtrace-supported.h.in index 901e3f72a431b..28488167c4e2b 100644 --- a/src/libbacktrace/backtrace-supported.h.in +++ b/src/libbacktrace/backtrace-supported.h.in @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libbacktrace/backtrace.c b/src/libbacktrace/backtrace.c index cc3105c06cb19..4b90357df5f80 100644 --- a/src/libbacktrace/backtrace.c +++ b/src/libbacktrace/backtrace.c @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libbacktrace/backtrace.h b/src/libbacktrace/backtrace.h index 03b5479081d31..3f77093f767ed 100644 --- a/src/libbacktrace/backtrace.h +++ b/src/libbacktrace/backtrace.h @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libbacktrace/btest.c b/src/libbacktrace/btest.c index 4b67c3d8bd0c7..a1818f1ef8311 100644 --- a/src/libbacktrace/btest.c +++ b/src/libbacktrace/btest.c @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. @@ -460,7 +460,7 @@ f23 (int f1line, int f2line) (unsigned int) bdata.index, j + 1); bdata.failed = 1; } - } + } check ("test3", 0, all, f3line, "f23", &bdata.failed); check ("test3", 1, all, f2line, "f22", &bdata.failed); diff --git a/src/libbacktrace/configure b/src/libbacktrace/configure index 694b5d23c490e..d5e08d93f6c30 100755 --- a/src/libbacktrace/configure +++ b/src/libbacktrace/configure @@ -15153,4 +15153,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi - diff --git a/src/libbacktrace/configure.ac b/src/libbacktrace/configure.ac index 878bd2c15806c..d661c7b2560fc 100644 --- a/src/libbacktrace/configure.ac +++ b/src/libbacktrace/configure.ac @@ -6,13 +6,13 @@ # met: # (1) Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. +# notice, this list of conditions and the following disclaimer. # (2) Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the -# distribution. - +# distribution. + # (3) The name of the author may not be used to # endorse or promote products derived from this software without # specific prior written permission. diff --git a/src/libbacktrace/dwarf.c b/src/libbacktrace/dwarf.c index ad52d73b752e5..5ecae711792e2 100644 --- a/src/libbacktrace/dwarf.c +++ b/src/libbacktrace/dwarf.c @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. @@ -1241,7 +1241,7 @@ add_unit_ranges (struct backtrace_state *state, uintptr_t base_address, static int find_address_ranges (struct backtrace_state *state, uintptr_t base_address, - struct dwarf_buf *unit_buf, + struct dwarf_buf *unit_buf, const unsigned char *dwarf_str, size_t dwarf_str_size, const unsigned char *dwarf_ranges, size_t dwarf_ranges_size, @@ -1599,7 +1599,7 @@ read_line_header (struct backtrace_state *state, struct unit *u, if (!advance (line_buf, hdrlen)) return 0; - + hdr->min_insn_len = read_byte (&hdr_buf); if (hdr->version < 4) hdr->max_ops_per_insn = 1; @@ -1608,7 +1608,7 @@ read_line_header (struct backtrace_state *state, struct unit *u, /* We don't care about default_is_stmt. */ read_byte (&hdr_buf); - + hdr->line_base = read_sbyte (&hdr_buf); hdr->line_range = read_byte (&hdr_buf); diff --git a/src/libbacktrace/elf.c b/src/libbacktrace/elf.c index 6c5b179e90d05..5fc74add05c18 100644 --- a/src/libbacktrace/elf.c +++ b/src/libbacktrace/elf.c @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libbacktrace/fileline.c b/src/libbacktrace/fileline.c index bab5351cab38d..f45cccff71306 100644 --- a/src/libbacktrace/fileline.c +++ b/src/libbacktrace/fileline.c @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libbacktrace/hashtab.h b/src/libbacktrace/hashtab.h index 4bb65d6c7a2b4..3736622e67739 100644 --- a/src/libbacktrace/hashtab.h +++ b/src/libbacktrace/hashtab.h @@ -1,4 +1,4 @@ -/* An expandable hash tables datatype. +/* An expandable hash tables datatype. Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2009, 2010 Free Software Foundation, Inc. Contributed by Vladimir Makarov (vmakarov@cygnus.com). @@ -61,7 +61,7 @@ typedef int (*htab_eq) (const void *, const void *); /* Cleanup function called whenever a live element is removed from the hash table. */ typedef void (*htab_del) (void *); - + /* Function called by htab_traverse for each live element. The first arg is the slot of the element (which can be passed to htab_clear_slot if desired), the second arg is the auxiliary pointer handed to diff --git a/src/libbacktrace/internal.h b/src/libbacktrace/internal.h index dd109db24aed9..a13c775b62873 100644 --- a/src/libbacktrace/internal.h +++ b/src/libbacktrace/internal.h @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libbacktrace/ltmain.sh b/src/libbacktrace/ltmain.sh index eaef55a59332a..84f5be9249e7c 100644 --- a/src/libbacktrace/ltmain.sh +++ b/src/libbacktrace/ltmain.sh @@ -8633,4 +8633,3 @@ build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # sh-indentation:2 # End: # vi:sw=2 - diff --git a/src/libbacktrace/mmap.c b/src/libbacktrace/mmap.c index b530e38238820..1c691b02e7cfa 100644 --- a/src/libbacktrace/mmap.c +++ b/src/libbacktrace/mmap.c @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libbacktrace/mmapio.c b/src/libbacktrace/mmapio.c index 72940b403a3d0..8b8f124da9a6d 100644 --- a/src/libbacktrace/mmapio.c +++ b/src/libbacktrace/mmapio.c @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libbacktrace/nounwind.c b/src/libbacktrace/nounwind.c index 0097966b422b4..f8fdbdc85acb4 100644 --- a/src/libbacktrace/nounwind.c +++ b/src/libbacktrace/nounwind.c @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libbacktrace/posix.c b/src/libbacktrace/posix.c index dba9e525e0826..7f1c35ab9707d 100644 --- a/src/libbacktrace/posix.c +++ b/src/libbacktrace/posix.c @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libbacktrace/print.c b/src/libbacktrace/print.c index bd224e6bf4d7d..70e347f62c290 100644 --- a/src/libbacktrace/print.c +++ b/src/libbacktrace/print.c @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libbacktrace/read.c b/src/libbacktrace/read.c index c618a50b36d3f..e373b61de2e6c 100644 --- a/src/libbacktrace/read.c +++ b/src/libbacktrace/read.c @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libbacktrace/simple.c b/src/libbacktrace/simple.c index efa8b6fc639df..dd70f831de74a 100644 --- a/src/libbacktrace/simple.c +++ b/src/libbacktrace/simple.c @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libbacktrace/state.c b/src/libbacktrace/state.c index a7d4e07d1a557..bef47bd1a0f54 100644 --- a/src/libbacktrace/state.c +++ b/src/libbacktrace/state.c @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libbacktrace/unknown.c b/src/libbacktrace/unknown.c index c1fe8811d477f..e5e8421b3a994 100644 --- a/src/libbacktrace/unknown.c +++ b/src/libbacktrace/unknown.c @@ -7,13 +7,13 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. - + distribution. + (3) The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs index 1dd463e0405ff..90fbe04d3482f 100644 --- a/src/libcollections/bit.rs +++ b/src/libcollections/bit.rs @@ -133,7 +133,7 @@ static FALSE: bool = false; /// /// # Examples /// -/// ```rust +/// ``` /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(10, false); diff --git a/src/libcollections/borrow.rs b/src/libcollections/borrow.rs index 5b799d3e5c0ff..4bedbdeb36876 100644 --- a/src/libcollections/borrow.rs +++ b/src/libcollections/borrow.rs @@ -129,7 +129,7 @@ impl ToOwned for T where T: Clone { /// /// # Examples /// -/// ```rust +/// ``` /// use std::borrow::Cow; /// /// fn abs_all(input: &mut Cow<[i32]>) { diff --git a/src/libcollections/fmt.rs b/src/libcollections/fmt.rs index bb7db1151e833..1deb08ad0d1c4 100644 --- a/src/libcollections/fmt.rs +++ b/src/libcollections/fmt.rs @@ -422,7 +422,7 @@ use string; /// /// # Examples /// -/// ```rust +/// ``` /// use std::fmt; /// /// let s = fmt::format(format_args!("Hello, {}!", "world")); diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index dd9c265874467..4993994d46bee 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -136,7 +136,7 @@ pub trait SliceExt { /// /// # Examples /// - /// ```rust + /// ``` /// let mut v = [5, 4, 1, 3, 2]; /// v.sort_by(|a, b| a.cmp(b)); /// assert!(v == [1, 2, 3, 4, 5]); @@ -162,7 +162,7 @@ pub trait SliceExt { /// /// # Examples /// - /// ```rust + /// ``` /// let mut a = [1, 2, 3, 4, 5]; /// let b = vec![6, 7, 8]; /// let num_moved = a.move_from(b, 0, 3); @@ -284,7 +284,7 @@ pub trait SliceExt { /// Print the adjacent pairs of a slice (i.e. `[1,2]`, `[2,3]`, /// `[3,4]`): /// - /// ```rust + /// ``` /// let v = &[1, 2, 3, 4]; /// for win in v.windows(2) { /// println!("{:?}", win); @@ -307,7 +307,7 @@ pub trait SliceExt { /// Print the slice two elements at a time (i.e. `[1,2]`, /// `[3,4]`, `[5]`): /// - /// ```rust + /// ``` /// let v = &[1, 2, 3, 4, 5]; /// for win in v.chunks(2) { /// println!("{:?}", win); @@ -398,7 +398,7 @@ pub trait SliceExt { /// uniquely determined position; the second and third are not /// found; the fourth could match any position in `[1,4]`. /// - /// ```rust + /// ``` /// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; /// let s = s.as_slice(); /// @@ -533,7 +533,7 @@ pub trait SliceExt { /// /// # Examples /// - /// ```rust + /// ``` /// let mut v = ["a", "b", "c", "d"]; /// v.swap(1, 3); /// assert!(v == ["a", "d", "c", "b"]); @@ -553,7 +553,7 @@ pub trait SliceExt { /// /// # Examples /// - /// ```rust + /// ``` /// let mut v = [1, 2, 3, 4, 5, 6]; /// /// // scoped to restrict the lifetime of the borrows @@ -582,7 +582,7 @@ pub trait SliceExt { /// /// # Examples /// - /// ```rust + /// ``` /// let mut v = [1, 2, 3]; /// v.reverse(); /// assert!(v == [3, 2, 1]); @@ -614,7 +614,7 @@ pub trait SliceExt { /// /// # Examples /// - /// ```rust + /// ``` /// let v = [1, 2, 3]; /// let mut perms = v.permutations(); /// @@ -625,7 +625,7 @@ pub trait SliceExt { /// /// Iterating through permutations one by one. /// - /// ```rust + /// ``` /// let v = [1, 2, 3]; /// let mut perms = v.permutations(); /// @@ -642,7 +642,7 @@ pub trait SliceExt { /// /// # Examples /// - /// ```rust + /// ``` /// let mut dst = [0, 0, 0]; /// let src = [1, 2]; /// @@ -662,7 +662,7 @@ pub trait SliceExt { /// /// # Examples /// - /// ```rust + /// ``` /// let mut v = [-5, 4, 1, -3, 2]; /// /// v.sort(); @@ -684,7 +684,7 @@ pub trait SliceExt { /// uniquely determined position; the second and third are not /// found; the fourth could match any position in `[1,4]`. /// - /// ```rust + /// ``` /// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; /// let s = s.as_slice(); /// @@ -711,7 +711,7 @@ pub trait SliceExt { /// /// # Examples /// - /// ```rust + /// ``` /// let v: &mut [_] = &mut [0, 1, 2]; /// v.next_permutation(); /// let b: &mut [_] = &mut [0, 2, 1]; @@ -731,7 +731,7 @@ pub trait SliceExt { /// /// # Examples /// - /// ```rust + /// ``` /// let v: &mut [_] = &mut [1, 0, 2]; /// v.prev_permutation(); /// let b: &mut [_] = &mut [0, 2, 1]; diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index e92e340b86cdd..b2273646b959e 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -911,7 +911,7 @@ pub trait StrExt: Index { /// /// # Examples /// - /// ```rust + /// ``` /// assert!("banana".ends_with("nana")); /// ``` #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 9d178eb5413c3..d2bc98096f647 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -138,7 +138,7 @@ impl String { /// /// # Examples /// - /// ```rust + /// ``` /// use std::str::Utf8Error; /// /// let hello_vec = vec![104, 101, 108, 108, 111]; @@ -164,7 +164,7 @@ impl String { /// /// # Examples /// - /// ```rust + /// ``` /// let input = b"Hello \xF0\x90\x80World"; /// let output = String::from_utf8_lossy(input); /// assert_eq!(output, "Hello \u{FFFD}World"); @@ -296,7 +296,7 @@ impl String { /// /// # Examples /// - /// ```rust + /// ``` /// // 𝄞music /// let mut v = &mut [0xD834, 0xDD1E, 0x006d, 0x0075, /// 0x0073, 0x0069, 0x0063]; @@ -324,7 +324,7 @@ impl String { /// /// # Examples /// - /// ```rust + /// ``` /// // 𝄞music /// let v = &[0xD834, 0xDD1E, 0x006d, 0x0075, /// 0x0073, 0xDD1E, 0x0069, 0x0063, diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 3bd57cc362448..404179bd48497 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -633,7 +633,7 @@ impl Vec { /// /// # Examples /// - /// ```rust + /// ``` /// let mut vec = vec!(1, 2); /// vec.push(3); /// assert_eq!(vec, [1, 2, 3]); @@ -671,7 +671,7 @@ impl Vec { /// /// # Examples /// - /// ```rust + /// ``` /// let mut vec = vec![1, 2, 3]; /// assert_eq!(vec.pop(), Some(3)); /// assert_eq!(vec, [1, 2]); diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index 95d43fa8fc0d5..aefcad49a5883 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -201,7 +201,7 @@ impl VecDeque { /// /// # Examples /// - /// ```rust + /// ``` /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -224,7 +224,7 @@ impl VecDeque { /// /// # Examples /// - /// ```rust + /// ``` /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -258,7 +258,7 @@ impl VecDeque { /// /// # Examples /// - /// ```rust + /// ``` /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -513,7 +513,7 @@ impl VecDeque { /// /// # Examples /// - /// ```rust + /// ``` /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -536,7 +536,7 @@ impl VecDeque { /// /// # Examples /// - /// ```rust + /// ``` /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -824,7 +824,7 @@ impl VecDeque { /// /// # Examples /// - /// ```rust + /// ``` /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -849,7 +849,7 @@ impl VecDeque { /// /// # Examples /// - /// ```rust + /// ``` /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -949,7 +949,7 @@ impl VecDeque { /// Panics if `i` is greater than ringbuf's length /// /// # Examples - /// ```rust + /// ``` /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -1151,7 +1151,7 @@ impl VecDeque { /// Returns `None` if `i` is out of bounds. /// /// # Examples - /// ```rust + /// ``` /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); diff --git a/src/libcore/default.rs b/src/libcore/default.rs index 7f46d9cbe5021..910cf805f3998 100644 --- a/src/libcore/default.rs +++ b/src/libcore/default.rs @@ -164,4 +164,3 @@ default_impl! { i64, 0 } default_impl! { f32, 0.0f32 } default_impl! { f64, 0.0f64 } - diff --git a/src/libcore/finally.rs b/src/libcore/finally.rs index 74806e52d261d..19cd34cdb0933 100644 --- a/src/libcore/finally.rs +++ b/src/libcore/finally.rs @@ -107,4 +107,3 @@ impl<'a, A, F> Drop for Finallyalizer<'a, A, F> where F: FnMut(&mut A) { (self.dtor)(self.mutate); } } - diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 6575bac501fe0..6dcae9879a0d0 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -216,7 +216,7 @@ macro_rules! writeln { /// /// Match arms: /// -/// ```rust +/// ``` /// fn foo(x: Option) { /// match x { /// Some(n) if n >= 0 => println!("Some(Non-negative)"), @@ -229,7 +229,7 @@ macro_rules! writeln { /// /// Iterators: /// -/// ```rust +/// ``` /// fn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3 /// for i in std::iter::count(0, 1) { /// if 3*i < i { panic!("u32 overflow"); } diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index d596a06709c5a..1b866501b8ea1 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -310,7 +310,7 @@ impl MarkerTrait for T { } /// /// Therefore, we can model a method like this as follows: /// -/// ```rust +/// ``` /// use std::marker::PhantomFn; /// trait Even : PhantomFn { } /// ``` @@ -318,7 +318,7 @@ impl MarkerTrait for T { } /// Another equivalent, but clearer, option would be to use /// `MarkerTrait`: /// -/// ```rust +/// ``` /// use std::marker::MarkerTrait; /// trait Even : MarkerTrait { } /// ``` diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 2aa8ec0c548d9..551f97ead12d8 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -251,7 +251,7 @@ pub fn swap(x: &mut T, y: &mut T) { /// `self.buf`. But `replace` can be used to disassociate the original value of `self.buf` from /// `self`, allowing it to be returned: /// -/// ```rust +/// ``` /// use std::mem; /// # struct Buffer { buf: Vec } /// impl Buffer { diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index 0d8e3044eccea..ae1b5f65eeb52 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -281,7 +281,7 @@ impl Float for f32 { /// The fractional part of the number, satisfying: /// - /// ```rust + /// ``` /// use core::num::Float; /// /// let x = 1.65f32; diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index d7e91058a46fb..4a73c1e8fcf45 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -288,7 +288,7 @@ impl Float for f64 { /// The fractional part of the number, satisfying: /// - /// ```rust + /// ``` /// use core::num::Float; /// /// let x = 1.65f64; diff --git a/src/libcore/num/float_macros.rs b/src/libcore/num/float_macros.rs index 20300d29fa0c5..b3adef53dabee 100644 --- a/src/libcore/num/float_macros.rs +++ b/src/libcore/num/float_macros.rs @@ -18,4 +18,3 @@ macro_rules! assert_approx_eq { "{} is not approximately equal to {}", *a, *b); }) } - diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 4381b1fb3c907..a77f970960054 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -84,7 +84,7 @@ pub trait Int /// /// # Examples /// - /// ```rust + /// ``` /// use std::num::Int; /// /// let n = 0b01001100u8; @@ -99,7 +99,7 @@ pub trait Int /// /// # Examples /// - /// ```rust + /// ``` /// use std::num::Int; /// /// let n = 0b01001100u8; @@ -118,7 +118,7 @@ pub trait Int /// /// # Examples /// - /// ```rust + /// ``` /// use std::num::Int; /// /// let n = 0b0101000u16; @@ -134,7 +134,7 @@ pub trait Int /// /// # Examples /// - /// ```rust + /// ``` /// use std::num::Int; /// /// let n = 0b0101000u16; @@ -150,7 +150,7 @@ pub trait Int /// /// # Examples /// - /// ```rust + /// ``` /// use std::num::Int; /// /// let n = 0x0123456789ABCDEFu64; @@ -167,7 +167,7 @@ pub trait Int /// /// # Examples /// - /// ```rust + /// ``` /// use std::num::Int; /// /// let n = 0x0123456789ABCDEFu64; @@ -183,7 +183,7 @@ pub trait Int /// /// # Examples /// - /// ```rust + /// ``` /// use std::num::Int; /// /// let n = 0x0123456789ABCDEFu64; @@ -200,7 +200,7 @@ pub trait Int /// /// # Examples /// - /// ```rust + /// ``` /// use std::num::Int; /// /// let n = 0x0123456789ABCDEFu64; @@ -223,7 +223,7 @@ pub trait Int /// /// # Examples /// - /// ```rust + /// ``` /// use std::num::Int; /// /// let n = 0x0123456789ABCDEFu64; @@ -246,7 +246,7 @@ pub trait Int /// /// # Examples /// - /// ```rust + /// ``` /// use std::num::Int; /// /// let n = 0x0123456789ABCDEFu64; @@ -269,7 +269,7 @@ pub trait Int /// /// # Examples /// - /// ```rust + /// ``` /// use std::num::Int; /// /// let n = 0x0123456789ABCDEFu64; @@ -291,7 +291,7 @@ pub trait Int /// /// # Examples /// - /// ```rust + /// ``` /// use std::num::Int; /// /// assert_eq!(5u16.checked_add(65530), Some(65535)); @@ -305,7 +305,7 @@ pub trait Int /// /// # Examples /// - /// ```rust + /// ``` /// use std::num::Int; /// /// assert_eq!((-127i8).checked_sub(1), Some(-128)); @@ -319,7 +319,7 @@ pub trait Int /// /// # Examples /// - /// ```rust + /// ``` /// use std::num::Int; /// /// assert_eq!(5u8.checked_mul(51), Some(255)); @@ -333,7 +333,7 @@ pub trait Int /// /// # Examples /// - /// ```rust + /// ``` /// use std::num::Int; /// /// assert_eq!((-127i8).checked_div(-1), Some(127)); @@ -371,7 +371,7 @@ pub trait Int /// /// # Examples /// - /// ```rust + /// ``` /// use std::num::Int; /// /// assert_eq!(2.pow(4), 16); diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index 077b44f2dd2a7..6324e8fa87443 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -78,7 +78,7 @@ use fmt; /// A trivial implementation of `Drop`. The `drop` method is called when `_x` goes /// out of scope, and therefore `main` prints `Dropping!`. /// -/// ```rust +/// ``` /// struct HasDrop; /// /// impl Drop for HasDrop { @@ -162,7 +162,7 @@ macro_rules! forward_ref_binop { /// A trivial implementation of `Add`. When `Foo + Foo` happens, it ends up /// calling `add`, and therefore, `main` prints `Adding!`. /// -/// ```rust +/// ``` /// use std::ops::Add; /// /// #[derive(Copy)] @@ -216,7 +216,7 @@ add_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 } /// A trivial implementation of `Sub`. When `Foo - Foo` happens, it ends up /// calling `sub`, and therefore, `main` prints `Subtracting!`. /// -/// ```rust +/// ``` /// use std::ops::Sub; /// /// #[derive(Copy)] @@ -270,7 +270,7 @@ sub_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 } /// A trivial implementation of `Mul`. When `Foo * Foo` happens, it ends up /// calling `mul`, and therefore, `main` prints `Multiplying!`. /// -/// ```rust +/// ``` /// use std::ops::Mul; /// /// #[derive(Copy)] diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 2dd8bf67220ab..455c68d4319d6 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -897,7 +897,7 @@ impl> FromIterator> for Option { /// Here is an example which increments every integer in a vector, /// checking for overflow: /// - /// ```rust + /// ``` /// use std::u16; /// /// let v = vec!(1, 2); diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 9fba9a4d8ec76..fee8caa04c47b 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -896,7 +896,7 @@ impl> FromIterator> for Result { /// Here is an example which increments every integer in a vector, /// checking for overflow: /// - /// ```rust + /// ``` /// use std::u32; /// /// let v = vec!(1, 2); diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index c8a8dd885018d..b1576c0d37739 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -1449,7 +1449,7 @@ pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] { /// /// # Examples /// -/// ```rust +/// ``` /// use std::slice; /// /// // manifest a slice out of thin air! @@ -1492,7 +1492,7 @@ pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: usize) -> &'a mut [T] { /// /// # Examples /// -/// ```rust +/// ``` /// use std::slice; /// /// // manifest a slice out of thin air! diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 3873f305b4234..bd46b093b76b0 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -140,7 +140,7 @@ impl FromStr for bool { /// /// # Examples /// - /// ```rust + /// ``` /// use std::str::FromStr; /// /// assert_eq!(FromStr::from_str("true"), Ok(true)); @@ -151,7 +151,7 @@ impl FromStr for bool { /// Note, in many cases, the StrExt::parse() which is based on /// this FromStr::from_str() is more proper. /// - /// ```rust + /// ``` /// assert_eq!("true".parse(), Ok(true)); /// assert_eq!("false".parse(), Ok(false)); /// assert!("not even a boolean".parse::().is_err()); @@ -1186,7 +1186,7 @@ mod traits { /// /// # Examples /// - /// ```rust + /// ``` /// let s = "Löwe 老虎 Léopard"; /// assert_eq!(&s[0 .. 1], "L"); /// diff --git a/src/libcoretest/intrinsics.rs b/src/libcoretest/intrinsics.rs index b836f5f3f69f4..c99fb8c197d83 100644 --- a/src/libcoretest/intrinsics.rs +++ b/src/libcoretest/intrinsics.rs @@ -28,4 +28,3 @@ fn test_typeid_unsized_types() { assert_eq!(TypeId::of::(), TypeId::of::()); assert!(TypeId::of::() != TypeId::of::()); } - diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs index 100a9e36e8677..695c71c73eded 100644 --- a/src/libflate/lib.rs +++ b/src/libflate/lib.rs @@ -25,7 +25,6 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![feature(int_uint)] #![feature(libc)] #![feature(staged_api)] #![feature(unique)] @@ -35,13 +34,33 @@ extern crate libc; use libc::{c_void, size_t, c_int}; +use std::fmt; use std::ops::Deref; use std::ptr::Unique; use std::slice; +#[derive(Clone, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub struct Error { + _unused: (), +} + +impl Error { + fn new() -> Error { + Error { + _unused: (), + } + } +} + +impl fmt::Debug for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + "decompression error".fmt(f) + } +} + pub struct Bytes { ptr: Unique, - len: uint, + len: usize, } impl Deref for Bytes { @@ -78,55 +97,56 @@ const LZ_NORM: c_int = 0x80; // LZ with 128 probes, "normal" const TINFL_FLAG_PARSE_ZLIB_HEADER: c_int = 0x1; // parse zlib header and adler32 checksum const TDEFL_WRITE_ZLIB_HEADER: c_int = 0x01000; // write zlib header and adler32 checksum -fn deflate_bytes_internal(bytes: &[u8], flags: c_int) -> Option { +fn deflate_bytes_internal(bytes: &[u8], flags: c_int) -> Bytes { unsafe { - let mut outsz : size_t = 0; + let mut outsz: size_t = 0; let res = tdefl_compress_mem_to_heap(bytes.as_ptr() as *const _, bytes.len() as size_t, &mut outsz, flags); - if !res.is_null() { - let res = Unique::new(res as *mut u8); - Some(Bytes { ptr: res, len: outsz as uint }) - } else { - None + assert!(!res.is_null()); + Bytes { + ptr: Unique::new(res as *mut u8), + len: outsz as usize, } } } /// Compress a buffer, without writing any sort of header on the output. -pub fn deflate_bytes(bytes: &[u8]) -> Option { +pub fn deflate_bytes(bytes: &[u8]) -> Bytes { deflate_bytes_internal(bytes, LZ_NORM) } /// Compress a buffer, using a header that zlib can understand. -pub fn deflate_bytes_zlib(bytes: &[u8]) -> Option { +pub fn deflate_bytes_zlib(bytes: &[u8]) -> Bytes { deflate_bytes_internal(bytes, LZ_NORM | TDEFL_WRITE_ZLIB_HEADER) } -fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> Option { +fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> Result { unsafe { - let mut outsz : size_t = 0; + let mut outsz: size_t = 0; let res = tinfl_decompress_mem_to_heap(bytes.as_ptr() as *const _, bytes.len() as size_t, &mut outsz, flags); if !res.is_null() { - let res = Unique::new(res as *mut u8); - Some(Bytes { ptr: res, len: outsz as uint }) + Ok(Bytes { + ptr: Unique::new(res as *mut u8), + len: outsz as usize, + }) } else { - None + Err(Error::new()) } } } /// Decompress a buffer, without parsing any sort of header on the input. -pub fn inflate_bytes(bytes: &[u8]) -> Option { +pub fn inflate_bytes(bytes: &[u8]) -> Result { inflate_bytes_internal(bytes, 0) } /// Decompress a buffer that starts with a zlib header. -pub fn inflate_bytes_zlib(bytes: &[u8]) -> Option { +pub fn inflate_bytes_zlib(bytes: &[u8]) -> Result { inflate_bytes_internal(bytes, TINFL_FLAG_PARSE_ZLIB_HEADER) } @@ -140,7 +160,7 @@ mod tests { #[test] fn test_flate_round_trip() { let mut r = rand::thread_rng(); - let mut words = vec!(); + let mut words = vec![]; for _ in 0..20 { let range = r.gen_range(1, 10); let v = r.gen_iter::().take(range).collect::>(); @@ -153,8 +173,8 @@ mod tests { } debug!("de/inflate of {} bytes of random word-sequences", input.len()); - let cmp = deflate_bytes(&input).expect("deflation failed"); - let out = inflate_bytes(&cmp).expect("inflation failed"); + let cmp = deflate_bytes(&input); + let out = inflate_bytes(&cmp).unwrap(); debug!("{} bytes deflated to {} ({:.1}% size)", input.len(), cmp.len(), 100.0 * ((cmp.len() as f64) / (input.len() as f64))); @@ -164,9 +184,9 @@ mod tests { #[test] fn test_zlib_flate() { - let bytes = vec!(1, 2, 3, 4, 5); - let deflated = deflate_bytes(&bytes).expect("deflation failed"); - let inflated = inflate_bytes(&deflated).expect("inflation failed"); + let bytes = vec![1, 2, 3, 4, 5]; + let deflated = deflate_bytes(&bytes); + let inflated = inflate_bytes(&deflated).unwrap(); assert_eq!(&*inflated, &*bytes); } } diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 11aba40afad73..82c54004e9975 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -3298,7 +3298,7 @@ pub mod consts { pub const MAP_DENYWRITE : c_int = 0x0800; pub const MAP_EXECUTABLE : c_int = 0x01000; pub const MAP_LOCKED : c_int = 0x02000; - pub const MAP_NONRESERVE : c_int = 0x04000; + pub const MAP_NORESERVE : c_int = 0x04000; pub const MAP_POPULATE : c_int = 0x08000; pub const MAP_NONBLOCK : c_int = 0x010000; pub const MAP_STACK : c_int = 0x020000; @@ -3325,7 +3325,7 @@ pub mod consts { pub const MAP_DENYWRITE : c_int = 0x02000; pub const MAP_EXECUTABLE : c_int = 0x04000; pub const MAP_LOCKED : c_int = 0x08000; - pub const MAP_NONRESERVE : c_int = 0x0400; + pub const MAP_NORESERVE : c_int = 0x0400; pub const MAP_POPULATE : c_int = 0x010000; pub const MAP_NONBLOCK : c_int = 0x020000; pub const MAP_STACK : c_int = 0x040000; diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index b03d77db4ec9c..c634a46888e56 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -175,7 +175,6 @@ #![feature(int_uint)] #![feature(core)] #![feature(std_misc)] -#![feature(io)] use std::boxed; use std::cell::RefCell; diff --git a/src/liblog/macros.rs b/src/liblog/macros.rs index 1aee6e0be2ecc..80eb1601035a8 100644 --- a/src/liblog/macros.rs +++ b/src/liblog/macros.rs @@ -197,4 +197,3 @@ macro_rules! log_enabled { ::log::mod_enabled(lvl, module_path!()) }) } - diff --git a/src/librand/distributions/exponential.rs b/src/librand/distributions/exponential.rs index 6820d9c5c48f2..3180f03cfd3c2 100644 --- a/src/librand/distributions/exponential.rs +++ b/src/librand/distributions/exponential.rs @@ -59,7 +59,7 @@ impl Rand for Exp1 { /// /// # Examples /// -/// ```rust +/// ``` /// use std::rand; /// use std::rand::distributions::{Exp, IndependentSample}; /// diff --git a/src/librand/distributions/gamma.rs b/src/librand/distributions/gamma.rs index 6659bf0f3eeb3..8eaac203fb4ad 100644 --- a/src/librand/distributions/gamma.rs +++ b/src/librand/distributions/gamma.rs @@ -39,7 +39,7 @@ use super::{IndependentSample, Sample, Exp}; /// /// # Examples /// -/// ```rust +/// ``` /// use std::rand; /// use std::rand::distributions::{IndependentSample, Gamma}; /// @@ -186,7 +186,7 @@ impl IndependentSample for GammaLargeShape { /// /// # Examples /// -/// ```rust +/// ``` /// use std::rand; /// use std::rand::distributions::{ChiSquared, IndependentSample}; /// @@ -243,7 +243,7 @@ impl IndependentSample for ChiSquared { /// /// # Examples /// -/// ```rust +/// ``` /// use std::rand; /// use std::rand::distributions::{FisherF, IndependentSample}; /// @@ -287,7 +287,7 @@ impl IndependentSample for FisherF { /// /// # Examples /// -/// ```rust +/// ``` /// use std::rand; /// use std::rand::distributions::{StudentT, IndependentSample}; /// diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs index 47bc2f5a11348..a46709932e2de 100644 --- a/src/librand/distributions/mod.rs +++ b/src/librand/distributions/mod.rs @@ -93,7 +93,7 @@ pub struct Weighted { /// /// # Examples /// -/// ```rust +/// ``` /// use std::rand; /// use std::rand::distributions::{Weighted, WeightedChoice, IndependentSample}; /// diff --git a/src/librand/distributions/normal.rs b/src/librand/distributions/normal.rs index aeca477fb94ce..d07964624bf58 100644 --- a/src/librand/distributions/normal.rs +++ b/src/librand/distributions/normal.rs @@ -75,7 +75,7 @@ impl Rand for StandardNormal { /// /// # Examples /// -/// ```rust +/// ``` /// use std::rand; /// use std::rand::distributions::{Normal, IndependentSample}; /// @@ -123,7 +123,7 @@ impl IndependentSample for Normal { /// /// # Examples /// -/// ```rust +/// ``` /// use std::rand; /// use std::rand::distributions::{LogNormal, IndependentSample}; /// diff --git a/src/librand/distributions/range.rs b/src/librand/distributions/range.rs index 9a2576a87fcb5..4086e149e7866 100644 --- a/src/librand/distributions/range.rs +++ b/src/librand/distributions/range.rs @@ -35,7 +35,7 @@ use distributions::{Sample, IndependentSample}; /// /// # Examples /// -/// ```rust +/// ``` /// use std::rand::distributions::{IndependentSample, Range}; /// /// fn main() { diff --git a/src/librand/lib.rs b/src/librand/lib.rs index c5ff8ffe4576a..5e52a176c9e16 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -148,7 +148,7 @@ pub trait Rng : Sized { /// /// # Examples /// - /// ```rust + /// ``` /// use std::rand::{thread_rng, Rng}; /// /// let mut v = [0; 13579]; @@ -183,7 +183,7 @@ pub trait Rng : Sized { /// /// # Examples /// - /// ```rust + /// ``` /// use std::rand::{thread_rng, Rng}; /// /// let mut rng = thread_rng(); @@ -228,7 +228,7 @@ pub trait Rng : Sized { /// /// # Examples /// - /// ```rust + /// ``` /// use std::rand::{thread_rng, Rng}; /// /// let mut rng = thread_rng(); @@ -246,7 +246,7 @@ pub trait Rng : Sized { /// /// # Examples /// - /// ```rust + /// ``` /// use std::rand::{thread_rng, Rng}; /// /// let mut rng = thread_rng(); @@ -260,7 +260,7 @@ pub trait Rng : Sized { /// /// # Examples /// - /// ```rust + /// ``` /// use std::rand::{thread_rng, Rng}; /// /// let s: String = thread_rng().gen_ascii_chars().take(10).collect(); @@ -296,7 +296,7 @@ pub trait Rng : Sized { /// /// # Examples /// - /// ```rust + /// ``` /// use std::rand::{thread_rng, Rng}; /// /// let mut rng = thread_rng(); @@ -359,7 +359,7 @@ pub trait SeedableRng: Rng { /// /// # Examples /// - /// ```rust + /// ``` /// use std::rand::{Rng, SeedableRng, StdRng}; /// /// let seed: &[_] = &[1, 2, 3, 4]; @@ -374,7 +374,7 @@ pub trait SeedableRng: Rng { /// /// # Examples /// - /// ```rust + /// ``` /// use std::rand::{Rng, SeedableRng, StdRng}; /// /// let seed: &[_] = &[1, 2, 3, 4]; @@ -478,7 +478,8 @@ impl Rand for XorShiftRng { /// `[0,1)`. /// /// # Examples -/// ```rust +/// +/// ``` /// use std::rand::{random, Open01}; /// /// let Open01(val) = random::>(); @@ -495,7 +496,7 @@ pub struct Open01(pub F); /// /// # Examples /// -/// ```rust +/// ``` /// use std::rand::{random, Closed01}; /// /// let Closed01(val) = random::>(); diff --git a/src/librand/reseeding.rs b/src/librand/reseeding.rs index f39021d4a5f04..81e65da37fc5f 100644 --- a/src/librand/reseeding.rs +++ b/src/librand/reseeding.rs @@ -102,7 +102,7 @@ impl, Rsdr: Reseeder + Default> /// /// # Examples /// -/// ```rust +/// ``` /// use std::rand::{Rng, SeedableRng, StdRng}; /// use std::rand::reseeding::{Reseeder, ReseedingRng}; /// diff --git a/src/librustc/README.txt b/src/librustc/README.txt index 37097764f717c..9b364768208eb 100644 --- a/src/librustc/README.txt +++ b/src/librustc/README.txt @@ -40,7 +40,7 @@ crates is preferable): driver that orchestrates all the other passes and various other bits of miscellany. In general it contains code that runs towards the end of the compilation process. - + Roughly speaking the "order" of the three crates is as follows: libsyntax -> librustc -> librustc_trans diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 133bef30e4083..70303bb3410b7 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -132,4 +132,3 @@ register_diagnostics! { } __build_diagnostic_array! { DIAGNOSTICS } - diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index 8486bf782b00b..e466dc8a3a018 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -784,8 +784,8 @@ fn get_metadata_section_imp(is_osx: bool, filename: &Path) -> Result return Ok(MetadataVec(inflated)), - None => {} + Ok(inflated) => return Ok(MetadataVec(inflated)), + Err(_) => {} } } llvm::LLVMMoveToNextSection(si.llsi); diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index b33839f33e820..d1a946d933f14 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -963,4 +963,3 @@ fn parse_region_bounds_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F) } } } - diff --git a/src/librustc/middle/cfg/graphviz.rs b/src/librustc/middle/cfg/graphviz.rs index 0c5eca3c12968..ac6524dad8057 100644 --- a/src/librustc/middle/cfg/graphviz.rs +++ b/src/librustc/middle/cfg/graphviz.rs @@ -124,4 +124,3 @@ impl<'a, 'ast> dot::GraphWalk<'a, Node<'a>, Edge<'a>> for LabelledCFG<'a, 'ast> fn source(&'a self, edge: &Edge<'a>) -> Node<'a> { self.cfg.source(edge) } fn target(&'a self, edge: &Edge<'a>) -> Node<'a> { self.cfg.target(edge) } } - diff --git a/src/librustc/middle/fast_reject.rs b/src/librustc/middle/fast_reject.rs index 063845c6c3425..f9bdc5dc313f4 100644 --- a/src/librustc/middle/fast_reject.rs +++ b/src/librustc/middle/fast_reject.rs @@ -96,4 +96,3 @@ pub fn simplify_type(tcx: &ty::ctxt, ty::ty_infer(_) | ty::ty_err => None, } } - diff --git a/src/librustc/middle/infer/resolve.rs b/src/librustc/middle/infer/resolve.rs index 547696c0c4c2f..b9025d01068cc 100644 --- a/src/librustc/middle/infer/resolve.rs +++ b/src/librustc/middle/infer/resolve.rs @@ -112,4 +112,3 @@ impl<'a, 'tcx> ty_fold::TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> { } } } - diff --git a/src/librustc/middle/infer/sub.rs b/src/librustc/middle/infer/sub.rs index 33da3092b2a25..a92c960cd3aa1 100644 --- a/src/librustc/middle/infer/sub.rs +++ b/src/librustc/middle/infer/sub.rs @@ -153,4 +153,3 @@ impl<'f, 'tcx> Combine<'tcx> for Sub<'f, 'tcx> { self.higher_ranked_sub(a, b) } } - diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 1f02f13a4a178..a57ea3759de9b 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -1635,4 +1635,3 @@ impl<'tcx> UserString<'tcx> for Upvar { format!("captured outer variable in an `{}` closure", kind) } } - diff --git a/src/librustc/middle/traits/project.rs b/src/librustc/middle/traits/project.rs index b9a863f4fe46f..6b66d7227d300 100644 --- a/src/librustc/middle/traits/project.rs +++ b/src/librustc/middle/traits/project.rs @@ -535,7 +535,7 @@ fn assemble_candidates_from_param_env<'cx,'tcx>( /// In the case of a nested projection like <::FooT as Bar>::BarT, we may find /// that the definition of `Foo` has some clues: /// -/// ```rust +/// ``` /// trait Foo { /// type FooT : Bar /// } diff --git a/src/librustc/middle/traits/util.rs b/src/librustc/middle/traits/util.rs index 4527985302aed..88b721ce95862 100644 --- a/src/librustc/middle/traits/util.rs +++ b/src/librustc/middle/traits/util.rs @@ -568,5 +568,3 @@ impl<'tcx> fmt::Debug for super::MismatchedProjectionTypes<'tcx> { write!(f, "MismatchedProjectionTypes(..)") } } - - diff --git a/src/librustc/middle/ty_walk.rs b/src/librustc/middle/ty_walk.rs index 5b5eac451783a..1069d1282eab1 100644 --- a/src/librustc/middle/ty_walk.rs +++ b/src/librustc/middle/ty_walk.rs @@ -82,7 +82,7 @@ impl<'tcx> TypeWalker<'tcx> { /// /// Example: Imagine you are walking `Foo, uint>`. /// - /// ```rust + /// ``` /// let mut iter: TypeWalker = ...; /// iter.next(); // yields Foo /// iter.next(); // yields Bar diff --git a/src/librustc_back/archive.rs b/src/librustc_back/archive.rs index ed44bf8952951..aec8ac38a5ad3 100644 --- a/src/librustc_back/archive.rs +++ b/src/librustc_back/archive.rs @@ -324,4 +324,3 @@ impl<'a> ArchiveBuilder<'a> { Ok(()) } } - diff --git a/src/librustc_back/target/dragonfly_base.rs b/src/librustc_back/target/dragonfly_base.rs index 79d79b7e736bb..a56621ff97ea5 100644 --- a/src/librustc_back/target/dragonfly_base.rs +++ b/src/librustc_back/target/dragonfly_base.rs @@ -32,4 +32,3 @@ pub fn opts() -> TargetOptions { .. Default::default() } } - diff --git a/src/librustc_back/target/freebsd_base.rs b/src/librustc_back/target/freebsd_base.rs index ab8398fc60511..dcf1a12f2c9ad 100644 --- a/src/librustc_back/target/freebsd_base.rs +++ b/src/librustc_back/target/freebsd_base.rs @@ -27,4 +27,3 @@ pub fn opts() -> TargetOptions { .. Default::default() } } - diff --git a/src/librustc_back/target/openbsd_base.rs b/src/librustc_back/target/openbsd_base.rs index 759147b939cb8..0f2ab32be2431 100644 --- a/src/librustc_back/target/openbsd_base.rs +++ b/src/librustc_back/target/openbsd_base.rs @@ -30,4 +30,3 @@ pub fn opts() -> TargetOptions { .. Default::default() } } - diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 1cbbcad955090..e62300098f678 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -14,16 +14,17 @@ //! any imports resolved. use {DefModifiers, PUBLIC, IMPORTABLE}; -use ImportDirective; -use ImportDirectiveSubclass::{self, SingleImport, GlobImport}; -use ImportResolution; +use resolve_imports::ImportDirective; +use resolve_imports::ImportDirectiveSubclass::{self, SingleImport, GlobImport}; +use resolve_imports::ImportResolution; use Module; use ModuleKind::*; use Namespace::{TypeNS, ValueNS}; use NameBindings; +use {names_to_string, module_to_string}; use ParentLink::{self, ModuleParentLink, BlockParentLink}; use Resolver; -use Shadowable; +use resolve_imports::Shadowable; use TypeNsDef; use self::DuplicateCheckingMode::*; @@ -371,8 +372,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> { ItemExternCrate(_) => { // n.b. we don't need to look at the path option here, because cstore already did - for &crate_id in self.session.cstore - .find_extern_mod_stmt_cnum(item.id).iter() { + if let Some(crate_id) = self.session.cstore.find_extern_mod_stmt_cnum(item.id) { let def_id = DefId { krate: crate_id, node: 0 }; self.external_exports.insert(def_id); let parent_link = ModuleParentLink(parent.downgrade(), name); @@ -382,7 +382,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> { false, true)); debug!("(build reduced graph for item) found extern `{}`", - self.module_to_string(&*external_module)); + module_to_string(&*external_module)); self.check_for_conflicts_between_external_crates(&**parent, name, sp); parent.external_module_children.borrow_mut() .insert(name, external_module.clone()); @@ -400,7 +400,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> { Some(def_id), NormalModuleKind, false, - item.vis == ast::Public, + is_public, sp); name_bindings.get_module() @@ -432,8 +432,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> { // These items live in the type namespace. ItemTy(..) => { let name_bindings = - self.add_child(name, parent, ForbidDuplicateTypesAndModules, - sp); + self.add_child(name, parent, ForbidDuplicateTypesAndModules, sp); name_bindings.define_type(DefTy(local_def(item.id), false), sp, modifiers); @@ -517,7 +516,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> { Some(local_def(item.id)), TraitModuleKind, false, - item.vis == ast::Public, + is_public, sp); let module_parent = name_bindings.get_module(); @@ -636,8 +635,8 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> { name: Name, new_parent: &Rc) { debug!("(building reduced graph for \ - external crate) building external def, priv {:?}", - vis); + external crate) building external def {}, priv {:?}", + final_ident, vis); let is_public = vis == ast::Public; let modifiers = if is_public { PUBLIC } else { DefModifiers::empty() } | IMPORTABLE; let is_exported = is_public && match new_parent.def_id.get() { @@ -667,7 +666,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> { Some(_) | None => { debug!("(building reduced graph for \ external crate) building module \ - {}", final_ident); + {} {}", final_ident, is_public); let parent_link = self.get_parent_link(new_parent, name); child_name_bindings.define_module(parent_link, @@ -838,7 +837,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> { /// Builds the reduced graph rooted at the given external module. fn populate_external_module(&mut self, module: &Rc) { debug!("(populating external module) attempting to populate {}", - self.module_to_string(&**module)); + module_to_string(&**module)); let def_id = match module.def_id.get() { None => { @@ -904,18 +903,14 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> { match subclass { SingleImport(target, _) => { - debug!("(building import directive) building import \ - directive: {}::{}", - self.names_to_string(&module_.imports.borrow().last().unwrap(). - module_path), + debug!("(building import directive) building import directive: {}::{}", + names_to_string(&module_.imports.borrow().last().unwrap().module_path), token::get_name(target)); - let mut import_resolutions = module_.import_resolutions - .borrow_mut(); + let mut import_resolutions = module_.import_resolutions.borrow_mut(); match import_resolutions.get_mut(&target) { Some(resolution) => { - debug!("(building import directive) bumping \ - reference"); + debug!("(building import directive) bumping reference"); resolution.outstanding_references += 1; // the source of this name is different now diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 124aa39243529..c586faae6e886 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -24,7 +24,9 @@ register_diagnostics! { E0258, // import conflicts with existing submodule E0259, // an extern crate has already been imported into this module E0260, // name conflicts with an external crate that has been imported into this module - E0317 // user-defined types or type parameters cannot shadow the primitive types + E0317, // user-defined types or type parameters cannot shadow the primitive types + E0364, // item is private + E0365 // item is private } __build_diagnostic_array! { DIAGNOSTICS } diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index e49fdc9c5d356..67e9f71551a22 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -38,7 +38,6 @@ use self::PatternBindingMode::*; use self::Namespace::*; use self::NamespaceResult::*; use self::NameDefinition::*; -use self::ImportDirectiveSubclass::*; use self::ResolveResult::*; use self::FallbackSuggestion::*; use self::TypeParameters::*; @@ -98,6 +97,10 @@ use std::mem::replace; use std::rc::{Rc, Weak}; use std::usize; +use resolve_imports::{Target, ImportDirective, ImportResolution}; +use resolve_imports::Shadowable; + + // NB: This module needs to be declared first so diagnostics are // registered before they are used. pub mod diagnostics; @@ -105,6 +108,7 @@ pub mod diagnostics; mod check_unused; mod record_exports; mod build_reduced_graph; +mod resolve_imports; #[derive(Copy)] struct BindingInfo { @@ -253,13 +257,6 @@ impl<'a, 'v, 'tcx> Visitor<'v> for Resolver<'a, 'tcx> { } } -/// Contains data for specific types of import directives. -#[derive(Copy,Debug)] -enum ImportDirectiveSubclass { - SingleImport(Name /* target */, Name /* source */), - GlobImport -} - type ErrorMessage = Option<(Span, String)>; enum ResolveResult { @@ -366,144 +363,6 @@ impl Rib { } } -/// Whether an import can be shadowed by another import. -#[derive(Debug,PartialEq,Clone,Copy)] -enum Shadowable { - Always, - Never -} - -/// One import directive. -#[derive(Debug)] -struct ImportDirective { - module_path: Vec, - subclass: ImportDirectiveSubclass, - span: Span, - id: NodeId, - is_public: bool, // see note in ImportResolution about how to use this - shadowable: Shadowable, -} - -impl ImportDirective { - fn new(module_path: Vec , - subclass: ImportDirectiveSubclass, - span: Span, - id: NodeId, - is_public: bool, - shadowable: Shadowable) - -> ImportDirective { - ImportDirective { - module_path: module_path, - subclass: subclass, - span: span, - id: id, - is_public: is_public, - shadowable: shadowable, - } - } -} - -/// The item that an import resolves to. -#[derive(Clone,Debug)] -struct Target { - target_module: Rc, - bindings: Rc, - shadowable: Shadowable, -} - -impl Target { - fn new(target_module: Rc, - bindings: Rc, - shadowable: Shadowable) - -> Target { - Target { - target_module: target_module, - bindings: bindings, - shadowable: shadowable, - } - } -} - -/// An ImportResolution represents a particular `use` directive. -#[derive(Debug)] -struct ImportResolution { - /// Whether this resolution came from a `use` or a `pub use`. Note that this - /// should *not* be used whenever resolution is being performed, this is - /// only looked at for glob imports statements currently. Privacy testing - /// occurs during a later phase of compilation. - is_public: bool, - - // The number of outstanding references to this name. When this reaches - // zero, outside modules can count on the targets being correct. Before - // then, all bets are off; future imports could override this name. - outstanding_references: uint, - - /// The value that this `use` directive names, if there is one. - value_target: Option, - /// The source node of the `use` directive leading to the value target - /// being non-none - value_id: NodeId, - - /// The type that this `use` directive names, if there is one. - type_target: Option, - /// The source node of the `use` directive leading to the type target - /// being non-none - type_id: NodeId, -} - -impl ImportResolution { - fn new(id: NodeId, is_public: bool) -> ImportResolution { - ImportResolution { - type_id: id, - value_id: id, - outstanding_references: 0, - value_target: None, - type_target: None, - is_public: is_public, - } - } - - fn target_for_namespace(&self, namespace: Namespace) - -> Option { - match namespace { - TypeNS => self.type_target.clone(), - ValueNS => self.value_target.clone(), - } - } - - fn id(&self, namespace: Namespace) -> NodeId { - match namespace { - TypeNS => self.type_id, - ValueNS => self.value_id, - } - } - - fn shadowable(&self, namespace: Namespace) -> Shadowable { - let target = self.target_for_namespace(namespace); - if target.is_none() { - return Shadowable::Always; - } - - target.unwrap().shadowable - } - - fn set_target_and_id(&mut self, - namespace: Namespace, - target: Option, - id: NodeId) { - match namespace { - TypeNS => { - self.type_target = target; - self.type_id = id; - } - ValueNS => { - self.value_target = target; - self.value_id = id; - } - } - } -} - /// The link from a module up to its nearest parent node. #[derive(Clone,Debug)] enum ParentLink { @@ -855,6 +714,19 @@ impl NameBindings { None } } + + fn is_public(&self, namespace: Namespace) -> bool { + match namespace { + TypeNS => { + let type_def = self.type_def.borrow(); + type_def.as_ref().unwrap().modifiers.contains(PUBLIC) + } + ValueNS => { + let value_def = self.value_def.borrow(); + value_def.as_ref().unwrap().modifiers.contains(PUBLIC) + } + } + } } /// Interns the names of the primitive types. @@ -963,7 +835,6 @@ enum FallbackChecks { OnlyTraitAndStatics } - impl<'a, 'tcx> Resolver<'a, 'tcx> { fn new(session: &'a Session, ast_map: &'a ast_map::Map<'tcx>, @@ -1023,151 +894,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } } - // Import resolution - // - // This is a fixed-point algorithm. We resolve imports until our efforts - // are stymied by an unresolved import; then we bail out of the current - // module and continue. We terminate successfully once no more imports - // remain or unsuccessfully when no forward progress in resolving imports - // is made. - - /// Resolves all imports for the crate. This method performs the fixed- - /// point iteration. - fn resolve_imports(&mut self) { - let mut i = 0; - let mut prev_unresolved_imports = 0; - loop { - debug!("(resolving imports) iteration {}, {} imports left", - i, self.unresolved_imports); - - let module_root = self.graph_root.get_module(); - self.resolve_imports_for_module_subtree(module_root.clone()); - - if self.unresolved_imports == 0 { - debug!("(resolving imports) success"); - break; - } - - if self.unresolved_imports == prev_unresolved_imports { - self.report_unresolved_imports(module_root); - break; - } - - i += 1; - prev_unresolved_imports = self.unresolved_imports; - } - } - - /// Attempts to resolve imports for the given module and all of its - /// submodules. - fn resolve_imports_for_module_subtree(&mut self, module_: Rc) { - debug!("(resolving imports for module subtree) resolving {}", - self.module_to_string(&*module_)); - let orig_module = replace(&mut self.current_module, module_.clone()); - self.resolve_imports_for_module(module_.clone()); - self.current_module = orig_module; - - build_reduced_graph::populate_module_if_necessary(self, &module_); - for (_, child_node) in &*module_.children.borrow() { - match child_node.get_module_if_available() { - None => { - // Nothing to do. - } - Some(child_module) => { - self.resolve_imports_for_module_subtree(child_module); - } - } - } - - for (_, child_module) in &*module_.anonymous_children.borrow() { - self.resolve_imports_for_module_subtree(child_module.clone()); - } - } - - /// Attempts to resolve imports for the given module only. - fn resolve_imports_for_module(&mut self, module: Rc) { - if module.all_imports_resolved() { - debug!("(resolving imports for module) all imports resolved for \ - {}", - self.module_to_string(&*module)); - return; - } - - let imports = module.imports.borrow(); - let import_count = imports.len(); - while module.resolved_import_count.get() < import_count { - let import_index = module.resolved_import_count.get(); - let import_directive = &(*imports)[import_index]; - match self.resolve_import_for_module(module.clone(), - import_directive) { - Failed(err) => { - let (span, help) = match err { - Some((span, msg)) => (span, format!(". {}", msg)), - None => (import_directive.span, String::new()) - }; - let msg = format!("unresolved import `{}`{}", - self.import_path_to_string( - &import_directive.module_path, - import_directive.subclass), - help); - self.resolve_error(span, &msg[..]); - } - Indeterminate => break, // Bail out. We'll come around next time. - Success(()) => () // Good. Continue. - } - - module.resolved_import_count - .set(module.resolved_import_count.get() + 1); - } - } - - fn names_to_string(&self, names: &[Name]) -> String { - let mut first = true; - let mut result = String::new(); - for name in names { - if first { - first = false - } else { - result.push_str("::") - } - result.push_str(&token::get_name(*name)); - }; - result - } - - fn path_names_to_string(&self, path: &Path, depth: usize) -> String { - let names: Vec = path.segments[..path.segments.len()-depth] - .iter() - .map(|seg| seg.identifier.name) - .collect(); - self.names_to_string(&names[..]) - } - - fn import_directive_subclass_to_string(&mut self, - subclass: ImportDirectiveSubclass) - -> String { - match subclass { - SingleImport(_, source) => { - token::get_name(source).to_string() - } - GlobImport => "*".to_string() - } - } - - fn import_path_to_string(&mut self, - names: &[Name], - subclass: ImportDirectiveSubclass) - -> String { - if names.is_empty() { - self.import_directive_subclass_to_string(subclass) - } else { - (format!("{}::{}", - self.names_to_string(names), - self.import_directive_subclass_to_string( - subclass))).to_string() - } - } - #[inline] fn record_import_use(&mut self, import_id: NodeId, name: Name) { if !self.make_glob_map { @@ -1191,102 +917,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } } - /// Attempts to resolve the given import. The return value indicates - /// failure if we're certain the name does not exist, indeterminate if we - /// don't know whether the name exists at the moment due to other - /// currently-unresolved imports, or success if we know the name exists. - /// If successful, the resolved bindings are written into the module. - fn resolve_import_for_module(&mut self, - module_: Rc, - import_directive: &ImportDirective) - -> ResolveResult<()> { - let mut resolution_result = Failed(None); - let module_path = &import_directive.module_path; - - debug!("(resolving import for module) resolving import `{}::...` in `{}`", - self.names_to_string(&module_path[..]), - self.module_to_string(&*module_)); - - // First, resolve the module path for the directive, if necessary. - let container = if module_path.len() == 0 { - // Use the crate root. - Some((self.graph_root.get_module(), LastMod(AllPublic))) - } else { - match self.resolve_module_path(module_.clone(), - &module_path[..], - DontUseLexicalScope, - import_directive.span, - ImportSearch) { - Failed(err) => { - resolution_result = Failed(err); - None - }, - Indeterminate => { - resolution_result = Indeterminate; - None - } - Success(container) => Some(container), - } - }; - - match container { - None => {} - Some((containing_module, lp)) => { - // We found the module that the target is contained - // within. Attempt to resolve the import within it. - - match import_directive.subclass { - SingleImport(target, source) => { - resolution_result = - self.resolve_single_import(&*module_, - containing_module, - target, - source, - import_directive, - lp); - } - GlobImport => { - resolution_result = - self.resolve_glob_import(&*module_, - containing_module, - import_directive, - lp); - } - } - } - } - - // Decrement the count of unresolved imports. - match resolution_result { - Success(()) => { - assert!(self.unresolved_imports >= 1); - self.unresolved_imports -= 1; - } - _ => { - // Nothing to do here; just return the error. - } - } - - // Decrement the count of unresolved globs if necessary. But only if - // the resolution result is indeterminate -- otherwise we'll stop - // processing imports here. (See the loop in - // resolve_imports_for_module.) - - if !resolution_result.indeterminate() { - match import_directive.subclass { - GlobImport => { - assert!(module_.glob_count.get() >= 1); - module_.glob_count.set(module_.glob_count.get() - 1); - } - SingleImport(..) => { - // Ignore. - } - } - } - - return resolution_result; - } - fn create_name_bindings_from_module(module: Rc) -> NameBindings { NameBindings { type_def: RefCell::new(Some(TypeNsDef { @@ -1299,604 +929,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } } - fn resolve_single_import(&mut self, - module_: &Module, - containing_module: Rc, - target: Name, - source: Name, - directive: &ImportDirective, - lp: LastPrivate) - -> ResolveResult<()> { - debug!("(resolving single import) resolving `{}` = `{}::{}` from \ - `{}` id {}, last private {:?}", - token::get_name(target), - self.module_to_string(&*containing_module), - token::get_name(source), - self.module_to_string(module_), - directive.id, - lp); - - let lp = match lp { - LastMod(lp) => lp, - LastImport {..} => { - self.session - .span_bug(directive.span, - "not expecting Import here, must be LastMod") - } - }; - - // We need to resolve both namespaces for this to succeed. - // - - let mut value_result = UnknownResult; - let mut type_result = UnknownResult; - - // Search for direct children of the containing module. - build_reduced_graph::populate_module_if_necessary(self, &containing_module); - - match containing_module.children.borrow().get(&source) { - None => { - // Continue. - } - Some(ref child_name_bindings) => { - if child_name_bindings.defined_in_namespace(ValueNS) { - debug!("(resolving single import) found value binding"); - value_result = BoundResult(containing_module.clone(), - (*child_name_bindings).clone()); - } - if child_name_bindings.defined_in_namespace(TypeNS) { - debug!("(resolving single import) found type binding"); - type_result = BoundResult(containing_module.clone(), - (*child_name_bindings).clone()); - } - } - } - - // Unless we managed to find a result in both namespaces (unlikely), - // search imports as well. - let mut value_used_reexport = false; - let mut type_used_reexport = false; - match (value_result.clone(), type_result.clone()) { - (BoundResult(..), BoundResult(..)) => {} // Continue. - _ => { - // If there is an unresolved glob at this point in the - // containing module, bail out. We don't know enough to be - // able to resolve this import. - - if containing_module.glob_count.get() > 0 { - debug!("(resolving single import) unresolved glob; \ - bailing out"); - return Indeterminate; - } - - // Now search the exported imports within the containing module. - match containing_module.import_resolutions.borrow().get(&source) { - None => { - debug!("(resolving single import) no import"); - // The containing module definitely doesn't have an - // exported import with the name in question. We can - // therefore accurately report that the names are - // unbound. - - if value_result.is_unknown() { - value_result = UnboundResult; - } - if type_result.is_unknown() { - type_result = UnboundResult; - } - } - Some(import_resolution) - if import_resolution.outstanding_references == 0 => { - - fn get_binding(this: &mut Resolver, - import_resolution: &ImportResolution, - namespace: Namespace, - source: &Name) - -> NamespaceResult { - - // Import resolutions must be declared with "pub" - // in order to be exported. - if !import_resolution.is_public { - return UnboundResult; - } - - match import_resolution. - target_for_namespace(namespace) { - None => { - return UnboundResult; - } - Some(Target { - target_module, - bindings, - shadowable: _ - }) => { - debug!("(resolving single import) found \ - import in ns {:?}", namespace); - let id = import_resolution.id(namespace); - // track used imports and extern crates as well - this.used_imports.insert((id, namespace)); - this.record_import_use(id, *source); - match target_module.def_id.get() { - Some(DefId{krate: kid, ..}) => { - this.used_crates.insert(kid); - }, - _ => {} - } - return BoundResult(target_module, bindings); - } - } - } - - // The name is an import which has been fully - // resolved. We can, therefore, just follow it. - if value_result.is_unknown() { - value_result = get_binding(self, - import_resolution, - ValueNS, - &source); - value_used_reexport = import_resolution.is_public; - } - if type_result.is_unknown() { - type_result = get_binding(self, - import_resolution, - TypeNS, - &source); - type_used_reexport = import_resolution.is_public; - } - - } - Some(_) => { - // If containing_module is the same module whose import we are resolving - // and there it has an unresolved import with the same name as `source`, - // then the user is actually trying to import an item that is declared - // in the same scope - // - // e.g - // use self::submodule; - // pub mod submodule; - // - // In this case we continue as if we resolved the import and let the - // check_for_conflicts_between_imports_and_items call below handle - // the conflict - match (module_.def_id.get(), containing_module.def_id.get()) { - (Some(id1), Some(id2)) if id1 == id2 => { - if value_result.is_unknown() { - value_result = UnboundResult; - } - if type_result.is_unknown() { - type_result = UnboundResult; - } - } - _ => { - // The import is unresolved. Bail out. - debug!("(resolving single import) unresolved import; \ - bailing out"); - return Indeterminate; - } - } - } - } - } - } - - // If we didn't find a result in the type namespace, search the - // external modules. - let mut value_used_public = false; - let mut type_used_public = false; - match type_result { - BoundResult(..) => {} - _ => { - match containing_module.external_module_children.borrow_mut() - .get(&source).cloned() { - None => {} // Continue. - Some(module) => { - debug!("(resolving single import) found external \ - module"); - // track the module as used. - match module.def_id.get() { - Some(DefId{krate: kid, ..}) => { self.used_crates.insert(kid); }, - _ => {} - } - let name_bindings = - Rc::new(Resolver::create_name_bindings_from_module( - module)); - type_result = BoundResult(containing_module.clone(), - name_bindings); - type_used_public = true; - } - } - } - } - - // We've successfully resolved the import. Write the results in. - let mut import_resolutions = module_.import_resolutions.borrow_mut(); - let import_resolution = &mut (*import_resolutions)[target]; - { - let mut check_and_write_import = |namespace, result: &_, used_public: &mut bool| { - let namespace_name = match namespace { - TypeNS => "type", - ValueNS => "value", - }; - - match *result { - BoundResult(ref target_module, ref name_bindings) => { - debug!("(resolving single import) found {:?} target: {:?}", - namespace_name, - name_bindings.def_for_namespace(namespace)); - self.check_for_conflicting_import( - &import_resolution.target_for_namespace(namespace), - directive.span, - target, - namespace); - - self.check_that_import_is_importable( - &**name_bindings, - directive.span, - target, - namespace); - - let target = Some(Target::new(target_module.clone(), - name_bindings.clone(), - directive.shadowable)); - import_resolution.set_target_and_id(namespace, target, directive.id); - import_resolution.is_public = directive.is_public; - *used_public = name_bindings.defined_in_public_namespace(namespace); - } - UnboundResult => { /* Continue. */ } - UnknownResult => { - panic!("{:?} result should be known at this point", namespace_name); - } - } - }; - check_and_write_import(ValueNS, &value_result, &mut value_used_public); - check_and_write_import(TypeNS, &type_result, &mut type_used_public); - } - - self.check_for_conflicts_between_imports_and_items( - module_, - import_resolution, - directive.span, - target); - - if value_result.is_unbound() && type_result.is_unbound() { - let msg = format!("There is no `{}` in `{}`", - token::get_name(source), - self.module_to_string(&*containing_module)); - return Failed(Some((directive.span, msg))); - } - let value_used_public = value_used_reexport || value_used_public; - let type_used_public = type_used_reexport || type_used_public; - - assert!(import_resolution.outstanding_references >= 1); - import_resolution.outstanding_references -= 1; - - // record what this import resolves to for later uses in documentation, - // this may resolve to either a value or a type, but for documentation - // purposes it's good enough to just favor one over the other. - let value_def_and_priv = import_resolution.value_target.as_ref().map(|target| { - let def = target.bindings.def_for_namespace(ValueNS).unwrap(); - (def, if value_used_public { lp } else { DependsOn(def.def_id()) }) - }); - let type_def_and_priv = import_resolution.type_target.as_ref().map(|target| { - let def = target.bindings.def_for_namespace(TypeNS).unwrap(); - (def, if type_used_public { lp } else { DependsOn(def.def_id()) }) - }); - - let import_lp = LastImport { - value_priv: value_def_and_priv.map(|(_, p)| p), - value_used: Used, - type_priv: type_def_and_priv.map(|(_, p)| p), - type_used: Used - }; - - if let Some((def, _)) = value_def_and_priv { - self.def_map.borrow_mut().insert(directive.id, PathResolution { - base_def: def, - last_private: import_lp, - depth: 0 - }); - } - if let Some((def, _)) = type_def_and_priv { - self.def_map.borrow_mut().insert(directive.id, PathResolution { - base_def: def, - last_private: import_lp, - depth: 0 - }); - } - - debug!("(resolving single import) successfully resolved import"); - return Success(()); - } - - // Resolves a glob import. Note that this function cannot fail; it either - // succeeds or bails out (as importing * from an empty module or a module - // that exports nothing is valid). containing_module is the module we are - // actually importing, i.e., `foo` in `use foo::*`. - fn resolve_glob_import(&mut self, - module_: &Module, - containing_module: Rc, - import_directive: &ImportDirective, - lp: LastPrivate) - -> ResolveResult<()> { - let id = import_directive.id; - let is_public = import_directive.is_public; - - // This function works in a highly imperative manner; it eagerly adds - // everything it can to the list of import resolutions of the module - // node. - debug!("(resolving glob import) resolving glob import {}", id); - - // We must bail out if the node has unresolved imports of any kind - // (including globs). - if !(*containing_module).all_imports_resolved() { - debug!("(resolving glob import) target module has unresolved \ - imports; bailing out"); - return Indeterminate; - } - - assert_eq!(containing_module.glob_count.get(), 0); - - // Add all resolved imports from the containing module. - let import_resolutions = containing_module.import_resolutions.borrow(); - for (ident, target_import_resolution) in &*import_resolutions { - debug!("(resolving glob import) writing module resolution \ - {} into `{}`", - token::get_name(*ident), - self.module_to_string(module_)); - - if !target_import_resolution.is_public { - debug!("(resolving glob import) nevermind, just kidding"); - continue - } - - // Here we merge two import resolutions. - let mut import_resolutions = module_.import_resolutions.borrow_mut(); - match import_resolutions.get_mut(ident) { - Some(dest_import_resolution) => { - // Merge the two import resolutions at a finer-grained - // level. - - match target_import_resolution.value_target { - None => { - // Continue. - } - Some(ref value_target) => { - self.check_for_conflicting_import(&dest_import_resolution.value_target, - import_directive.span, - *ident, - ValueNS); - dest_import_resolution.value_target = Some(value_target.clone()); - } - } - match target_import_resolution.type_target { - None => { - // Continue. - } - Some(ref type_target) => { - self.check_for_conflicting_import(&dest_import_resolution.type_target, - import_directive.span, - *ident, - TypeNS); - dest_import_resolution.type_target = Some(type_target.clone()); - } - } - dest_import_resolution.is_public = is_public; - continue; - } - None => {} - } - - // Simple: just copy the old import resolution. - let mut new_import_resolution = ImportResolution::new(id, is_public); - new_import_resolution.value_target = - target_import_resolution.value_target.clone(); - new_import_resolution.type_target = - target_import_resolution.type_target.clone(); - - import_resolutions.insert(*ident, new_import_resolution); - } - - // Add all children from the containing module. - build_reduced_graph::populate_module_if_necessary(self, &containing_module); - - for (&name, name_bindings) in &*containing_module.children.borrow() { - self.merge_import_resolution(module_, - containing_module.clone(), - import_directive, - name, - name_bindings.clone()); - - } - - // Add external module children from the containing module. - for (&name, module) in &*containing_module.external_module_children.borrow() { - let name_bindings = - Rc::new(Resolver::create_name_bindings_from_module(module.clone())); - self.merge_import_resolution(module_, - containing_module.clone(), - import_directive, - name, - name_bindings); - } - - // Record the destination of this import - if let Some(did) = containing_module.def_id.get() { - self.def_map.borrow_mut().insert(id, PathResolution { - base_def: DefMod(did), - last_private: lp, - depth: 0 - }); - } - - debug!("(resolving glob import) successfully resolved import"); - return Success(()); - } - - fn merge_import_resolution(&mut self, - module_: &Module, - containing_module: Rc, - import_directive: &ImportDirective, - name: Name, - name_bindings: Rc) { - let id = import_directive.id; - let is_public = import_directive.is_public; - - let mut import_resolutions = module_.import_resolutions.borrow_mut(); - let dest_import_resolution = import_resolutions.entry(name).get().unwrap_or_else( - |vacant_entry| { - // Create a new import resolution from this child. - vacant_entry.insert(ImportResolution::new(id, is_public)) - }); - - debug!("(resolving glob import) writing resolution `{}` in `{}` \ - to `{}`", - &token::get_name(name), - self.module_to_string(&*containing_module), - self.module_to_string(module_)); - - // Merge the child item into the import resolution. - { - let mut merge_child_item = |namespace| { - if name_bindings.defined_in_namespace_with(namespace, IMPORTABLE | PUBLIC) { - let namespace_name = match namespace { - TypeNS => "type", - ValueNS => "value", - }; - debug!("(resolving glob import) ... for {} target", namespace_name); - if dest_import_resolution.shadowable(namespace) == Shadowable::Never { - let msg = format!("a {} named `{}` has already been imported \ - in this module", - namespace_name, - &token::get_name(name)); - span_err!(self.session, import_directive.span, E0251, "{}", msg); - } else { - let target = Target::new(containing_module.clone(), - name_bindings.clone(), - import_directive.shadowable); - dest_import_resolution.set_target_and_id(namespace, - Some(target), - id); - } - } - }; - merge_child_item(ValueNS); - merge_child_item(TypeNS); - } - - dest_import_resolution.is_public = is_public; - - self.check_for_conflicts_between_imports_and_items( - module_, - dest_import_resolution, - import_directive.span, - name); - } - - /// Checks that imported names and items don't have the same name. - fn check_for_conflicting_import(&mut self, - target: &Option, - import_span: Span, - name: Name, - namespace: Namespace) { - debug!("check_for_conflicting_import: {}; target exists: {}", - &token::get_name(name), - target.is_some()); - - match *target { - Some(ref target) if target.shadowable != Shadowable::Always => { - let msg = format!("a {} named `{}` has already been imported \ - in this module", - match namespace { - TypeNS => "type", - ValueNS => "value", - }, - &token::get_name(name)); - span_err!(self.session, import_span, E0252, "{}", &msg[..]); - } - Some(_) | None => {} - } - } - - /// Checks that an import is actually importable - fn check_that_import_is_importable(&mut self, - name_bindings: &NameBindings, - import_span: Span, - name: Name, - namespace: Namespace) { - if !name_bindings.defined_in_namespace_with(namespace, IMPORTABLE) { - let msg = format!("`{}` is not directly importable", - token::get_name(name)); - span_err!(self.session, import_span, E0253, "{}", &msg[..]); - } - } - - /// Checks that imported names and items don't have the same name. - fn check_for_conflicts_between_imports_and_items(&mut self, - module: &Module, - import_resolution: - &ImportResolution, - import_span: Span, - name: Name) { - // First, check for conflicts between imports and `extern crate`s. - if module.external_module_children - .borrow() - .contains_key(&name) { - match import_resolution.type_target { - Some(ref target) if target.shadowable != Shadowable::Always => { - let msg = format!("import `{0}` conflicts with imported \ - crate in this module \ - (maybe you meant `use {0}::*`?)", - &token::get_name(name)); - span_err!(self.session, import_span, E0254, "{}", &msg[..]); - } - Some(_) | None => {} - } - } - - // Check for item conflicts. - let children = module.children.borrow(); - let name_bindings = match children.get(&name) { - None => { - // There can't be any conflicts. - return - } - Some(ref name_bindings) => (*name_bindings).clone(), - }; - - match import_resolution.value_target { - Some(ref target) if target.shadowable != Shadowable::Always => { - if let Some(ref value) = *name_bindings.value_def.borrow() { - span_err!(self.session, import_span, E0255, - "import `{}` conflicts with value in this module", - &token::get_name(name)); - if let Some(span) = value.value_span { - self.session.span_note(span, "conflicting value here"); - } - } - } - Some(_) | None => {} - } - - match import_resolution.type_target { - Some(ref target) if target.shadowable != Shadowable::Always => { - if let Some(ref ty) = *name_bindings.type_def.borrow() { - let (what, note) = if ty.module_def.is_some() { - ("existing submodule", "note conflicting module here") - } else { - ("type in this module", "note conflicting type here") - }; - span_err!(self.session, import_span, E0256, - "import `{}` conflicts with {}", - &token::get_name(name), what); - if let Some(span) = ty.type_span { - self.session.span_note(span, note); - } - } - } - Some(_) | None => {} - } - } - /// Checks that the names of external crates don't collide with other /// external crates. fn check_for_conflicts_between_external_crates(&self, @@ -1964,7 +996,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { false) { Failed(None) => { let segment_name = token::get_name(name); - let module_name = self.module_to_string(&*search_module); + let module_name = module_to_string(&*search_module); let mut span = span; let msg = if "???" == &module_name[..] { span.hi = span.lo + Pos::from_usize(segment_name.len()); @@ -1972,10 +1004,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { match search_parent_externals(name, &self.current_module) { Some(module) => { - let path_str = self.names_to_string(module_path); - let target_mod_str = self.module_to_string(&*module); + let path_str = names_to_string(module_path); + let target_mod_str = module_to_string(&*module); let current_mod_str = - self.module_to_string(&*self.current_module); + module_to_string(&*self.current_module); let prefix = if target_mod_str == current_mod_str { "self::".to_string() @@ -2066,8 +1098,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { assert!(module_path_len > 0); debug!("(resolving module path for import) processing `{}` rooted at `{}`", - self.names_to_string(module_path), - self.module_to_string(&*module_)); + names_to_string(module_path), + module_to_string(&*module_)); // Resolve the module prefix, if any. let module_prefix_result = self.resolve_module_prefix(module_.clone(), @@ -2078,7 +1110,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { let last_private; match module_prefix_result { Failed(None) => { - let mpath = self.names_to_string(module_path); + let mpath = names_to_string(module_path); let mpath = &mpath[..]; match mpath.rfind(':') { Some(idx) => { @@ -2161,7 +1193,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { namespace {:?} in `{}`", token::get_name(name), namespace, - self.module_to_string(&*module_)); + module_to_string(&*module_)); // The current module node is handled specially. First, check for // its immediate children. @@ -2398,7 +1430,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { break } debug!("(resolving module prefix) resolving `super` at {}", - self.module_to_string(&*containing_module)); + module_to_string(&*containing_module)); match self.get_nearest_normal_module_parent(containing_module) { None => return Failed(None), Some(new_module) => { @@ -2409,7 +1441,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } debug!("(resolving module prefix) finished resolving prefix at {}", - self.module_to_string(&*containing_module)); + module_to_string(&*containing_module)); return Success(PrefixFound(containing_module, i)); } @@ -2429,7 +1461,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { -> ResolveResult<(Target, bool)> { debug!("(resolving name in module) resolving `{}` in `{}`", &token::get_name(name), - self.module_to_string(&*module_)); + module_to_string(&*module_)); // First, check the direct children of the module. build_reduced_graph::populate_module_if_necessary(self, &module_); @@ -2583,7 +1615,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { None => { debug!("!!! (with scope) didn't find `{}` in `{}`", token::get_name(name), - self.module_to_string(&*orig_module)); + module_to_string(&*orig_module)); } Some(name_bindings) => { match (*name_bindings).get_module_if_available() { @@ -2591,7 +1623,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { debug!("!!! (with scope) didn't find module \ for `{}` in `{}`", token::get_name(name), - self.module_to_string(&*orig_module)); + module_to_string(&*orig_module)); } Some(module_) => { self.current_module = module_; @@ -2970,7 +2002,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } else { self.resolve_error(trait_path.span, &format!("`{}` is not a trait", - self.path_names_to_string(trait_path, path_depth))); + path_names_to_string(trait_path, path_depth))); // If it's a typedef, give a note if let DefTy(..) = path_res.base_def { @@ -2981,7 +2013,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } } else { let msg = format!("use of undeclared trait name `{}`", - self.path_names_to_string(trait_path, path_depth)); + path_names_to_string(trait_path, path_depth)); self.resolve_error(trait_path.span, &msg); Err(()) } @@ -3097,7 +2129,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { // If there is a TraitRef in scope for an impl, then the method must be in the trait. if let Some((did, ref trait_ref)) = self.current_trait_ref { if !self.trait_item_map.contains_key(&(name, did)) { - let path_str = self.path_names_to_string(&trait_ref.path, 0); + let path_str = path_names_to_string(&trait_ref.path, 0); self.resolve_error(span, &format!("method `{}` is not a member of trait `{}`", token::get_name(name), @@ -3279,7 +2311,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { // Write the result into the def map. debug!("(resolving type) writing resolution for `{}` \ (id {}) = {:?}", - self.path_names_to_string(path, 0), + path_names_to_string(path, 0), ty.id, def); self.record_def(ty.id, def); } @@ -3294,7 +2326,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { }; let msg = format!("use of undeclared {} `{}`", kind, - self.path_names_to_string(path, 0)); + path_names_to_string(path, 0)); self.resolve_error(ty.span, &msg[..]); } } @@ -3465,7 +2497,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { debug!("(resolving pattern) didn't find struct \ def: {:?}", result); let msg = format!("`{}` does not name a structure", - self.path_names_to_string(path, 0)); + path_names_to_string(path, 0)); self.resolve_error(path.span, &msg[..]); } } @@ -3718,7 +2750,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { Some((span, msg)) => (span, msg), None => { let msg = format!("Use of undeclared type or module `{}`", - self.names_to_string(&module_path)); + names_to_string(&module_path)); (span, msg) } }; @@ -3778,7 +2810,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { Some((span, msg)) => (span, msg), None => { let msg = format!("Use of undeclared module `::{}`", - self.names_to_string(&module_path[..])); + names_to_string(&module_path[..])); (span, msg) } }; @@ -3998,7 +3030,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { if let Some(binding) = module.children.borrow().get(&name) { if let Some(DefMethod(did, _)) = binding.def_for_namespace(ValueNS) { if is_static_method(self, did) { - return StaticMethod(self.path_names_to_string(&path, 0)) + return StaticMethod(path_names_to_string(&path, 0)) } if self.current_trait_ref.is_some() { return TraitItem; @@ -4013,7 +3045,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { if let Some((trait_did, ref trait_ref)) = self.current_trait_ref { if let Some(&did) = self.trait_item_map.get(&(name, trait_did)) { if is_static_method(self, did) { - return TraitMethod(self.path_names_to_string(&trait_ref.path, 0)); + return TraitMethod(path_names_to_string(&trait_ref.path, 0)); } else { return TraitItem; } @@ -4105,7 +3137,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { if let Some(path_res) = resolution { // Check if struct variant if let DefVariant(_, _, true) = path_res.base_def { - let path_name = self.path_names_to_string(path, 0); + let path_name = path_names_to_string(path, 0); self.resolve_error(expr.span, &format!("`{}` is a struct variant name, but \ this expression \ @@ -4123,7 +3155,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } else { // Write the result into the def map. debug!("(resolving expr) resolved `{}`", - self.path_names_to_string(path, 0)); + path_names_to_string(path, 0)); // Partial resolutions will need the set of traits in scope, // so they can be completed during typeck. @@ -4140,7 +3172,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { // (The pattern matching def_tys where the id is in self.structs // matches on regular structs while excluding tuple- and enum-like // structs, which wouldn't result in this error.) - let path_name = self.path_names_to_string(path, 0); + let path_name = path_names_to_string(path, 0); let type_res = self.with_no_errors(|this| { this.resolve_path(expr.id, path, 0, TypeNS, false) }); @@ -4227,7 +3259,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { None => { debug!("(resolving expression) didn't find struct def",); let msg = format!("`{}` does not name a structure", - self.path_names_to_string(path, 0)); + path_names_to_string(path, 0)); self.resolve_error(path.span, &msg[..]); } } @@ -4417,36 +3449,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { // hit. // - /// A somewhat inefficient routine to obtain the name of a module. - fn module_to_string(&self, module: &Module) -> String { - let mut names = Vec::new(); - - fn collect_mod(names: &mut Vec, module: &Module) { - match module.parent_link { - NoParentLink => {} - ModuleParentLink(ref module, name) => { - names.push(name); - collect_mod(names, &*module.upgrade().unwrap()); - } - BlockParentLink(ref module, _) => { - // danger, shouldn't be ident? - names.push(special_idents::opaque.name); - collect_mod(names, &*module.upgrade().unwrap()); - } - } - } - collect_mod(&mut names, module); - - if names.len() == 0 { - return "???".to_string(); - } - self.names_to_string(&names.into_iter().rev() - .collect::>()) - } - #[allow(dead_code)] // useful for debugging fn dump_module(&mut self, module_: Rc) { - debug!("Dump of module `{}`:", self.module_to_string(&*module_)); + debug!("Dump of module `{}`:", module_to_string(&*module_)); debug!("Children:"); build_reduced_graph::populate_module_if_necessary(self, &module_); @@ -4480,6 +3485,56 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } } + +fn names_to_string(names: &[Name]) -> String { + let mut first = true; + let mut result = String::new(); + for name in names { + if first { + first = false + } else { + result.push_str("::") + } + result.push_str(&token::get_name(*name)); + }; + result +} + +fn path_names_to_string(path: &Path, depth: usize) -> String { + let names: Vec = path.segments[..path.segments.len()-depth] + .iter() + .map(|seg| seg.identifier.name) + .collect(); + names_to_string(&names[..]) +} + +/// A somewhat inefficient routine to obtain the name of a module. +fn module_to_string(module: &Module) -> String { + let mut names = Vec::new(); + + fn collect_mod(names: &mut Vec, module: &Module) { + match module.parent_link { + NoParentLink => {} + ModuleParentLink(ref module, name) => { + names.push(name); + collect_mod(names, &*module.upgrade().unwrap()); + } + BlockParentLink(ref module, _) => { + // danger, shouldn't be ident? + names.push(special_idents::opaque.name); + collect_mod(names, &*module.upgrade().unwrap()); + } + } + } + collect_mod(&mut names, module); + + if names.len() == 0 { + return "???".to_string(); + } + names_to_string(&names.into_iter().rev().collect::>()) +} + + pub struct CrateMap { pub def_map: DefMap, pub freevars: RefCell, @@ -4507,7 +3562,7 @@ pub fn resolve_crate<'a, 'tcx>(session: &'a Session, build_reduced_graph::build_reduced_graph(&mut resolver, krate); session.abort_if_errors(); - resolver.resolve_imports(); + resolve_imports::resolve_imports(&mut resolver); session.abort_if_errors(); record_exports::record(&mut resolver); diff --git a/src/librustc_resolve/record_exports.rs b/src/librustc_resolve/record_exports.rs index 5d025f40d3239..e953b6398f9c0 100644 --- a/src/librustc_resolve/record_exports.rs +++ b/src/librustc_resolve/record_exports.rs @@ -22,6 +22,7 @@ use {Module, NameBindings, Resolver}; use Namespace::{self, TypeNS, ValueNS}; use build_reduced_graph; +use module_to_string; use rustc::middle::def::Export; use syntax::ast; @@ -60,19 +61,19 @@ impl<'a, 'b, 'tcx> ExportRecorder<'a, 'b, 'tcx> { // OK. Continue. debug!("(recording exports for module subtree) recording \ exports for local module `{}`", - self.module_to_string(&*module_)); + module_to_string(&*module_)); } None => { // Record exports for the root module. debug!("(recording exports for module subtree) recording \ exports for root module `{}`", - self.module_to_string(&*module_)); + module_to_string(&*module_)); } Some(_) => { // Bail out. debug!("(recording exports for module subtree) not recording \ exports for `{}`", - self.module_to_string(&*module_)); + module_to_string(&*module_)); return; } } @@ -133,13 +134,13 @@ impl<'a, 'b, 'tcx> ExportRecorder<'a, 'b, 'tcx> { fn add_exports_for_module(&mut self, exports: &mut Vec, module_: &Module) { - for (name, importresolution) in &*module_.import_resolutions.borrow() { - if !importresolution.is_public { + for (name, import_resolution) in &*module_.import_resolutions.borrow() { + if !import_resolution.is_public { continue } let xs = [TypeNS, ValueNS]; for &ns in &xs { - match importresolution.target_for_namespace(ns) { + match import_resolution.target_for_namespace(ns) { Some(target) => { debug!("(computing exports) maybe export '{}'", token::get_name(*name)); diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs new file mode 100644 index 0000000000000..737ec71cab3da --- /dev/null +++ b/src/librustc_resolve/resolve_imports.rs @@ -0,0 +1,1021 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use self::ImportDirectiveSubclass::*; + +use {PUBLIC, IMPORTABLE}; +use Module; +use Namespace::{self, TypeNS, ValueNS}; +use NameBindings; +use NamespaceResult::{BoundResult, UnboundResult, UnknownResult}; +use NamespaceResult; +use NameSearchType; +use ResolveResult; +use Resolver; +use UseLexicalScopeFlag; +use {names_to_string, module_to_string}; + +use build_reduced_graph; + +use rustc::middle::def::*; +use rustc::middle::privacy::*; + +use syntax::ast::{DefId, NodeId, Name}; +use syntax::attr::AttrMetaMethods; +use syntax::parse::token; +use syntax::codemap::Span; + +use std::mem::replace; +use std::rc::Rc; + + +/// Contains data for specific types of import directives. +#[derive(Copy,Debug)] +pub enum ImportDirectiveSubclass { + SingleImport(Name /* target */, Name /* source */), + GlobImport +} + +/// Whether an import can be shadowed by another import. +#[derive(Debug,PartialEq,Clone,Copy)] +pub enum Shadowable { + Always, + Never +} + +/// One import directive. +#[derive(Debug)] +pub struct ImportDirective { + pub module_path: Vec, + pub subclass: ImportDirectiveSubclass, + pub span: Span, + pub id: NodeId, + pub is_public: bool, // see note in ImportResolution about how to use this + pub shadowable: Shadowable, +} + +impl ImportDirective { + pub fn new(module_path: Vec , + subclass: ImportDirectiveSubclass, + span: Span, + id: NodeId, + is_public: bool, + shadowable: Shadowable) + -> ImportDirective { + ImportDirective { + module_path: module_path, + subclass: subclass, + span: span, + id: id, + is_public: is_public, + shadowable: shadowable, + } + } +} + +/// The item that an import resolves to. +#[derive(Clone,Debug)] +pub struct Target { + pub target_module: Rc, + pub bindings: Rc, + pub shadowable: Shadowable, +} + +impl Target { + pub fn new(target_module: Rc, + bindings: Rc, + shadowable: Shadowable) + -> Target { + Target { + target_module: target_module, + bindings: bindings, + shadowable: shadowable, + } + } +} + +/// An ImportResolution represents a particular `use` directive. +#[derive(Debug)] +pub struct ImportResolution { + /// Whether this resolution came from a `use` or a `pub use`. Note that this + /// should *not* be used whenever resolution is being performed. Privacy + /// testing occurs during a later phase of compilation. + pub is_public: bool, + + // The number of outstanding references to this name. When this reaches + // zero, outside modules can count on the targets being correct. Before + // then, all bets are off; future imports could override this name. + // Note that this is usually either 0 or 1 - shadowing is forbidden the only + // way outstanding_references is > 1 in a legal program is if the name is + // used in both namespaces. + pub outstanding_references: uint, + + /// The value that this `use` directive names, if there is one. + pub value_target: Option, + /// The source node of the `use` directive leading to the value target + /// being non-none + pub value_id: NodeId, + + /// The type that this `use` directive names, if there is one. + pub type_target: Option, + /// The source node of the `use` directive leading to the type target + /// being non-none + pub type_id: NodeId, +} + +impl ImportResolution { + pub fn new(id: NodeId, is_public: bool) -> ImportResolution { + ImportResolution { + type_id: id, + value_id: id, + outstanding_references: 0, + value_target: None, + type_target: None, + is_public: is_public, + } + } + + pub fn target_for_namespace(&self, namespace: Namespace) + -> Option { + match namespace { + TypeNS => self.type_target.clone(), + ValueNS => self.value_target.clone(), + } + } + + pub fn id(&self, namespace: Namespace) -> NodeId { + match namespace { + TypeNS => self.type_id, + ValueNS => self.value_id, + } + } + + pub fn shadowable(&self, namespace: Namespace) -> Shadowable { + let target = self.target_for_namespace(namespace); + if target.is_none() { + return Shadowable::Always; + } + + target.unwrap().shadowable + } + + pub fn set_target_and_id(&mut self, + namespace: Namespace, + target: Option, + id: NodeId) { + match namespace { + TypeNS => { + self.type_target = target; + self.type_id = id; + } + ValueNS => { + self.value_target = target; + self.value_id = id; + } + } + } +} + + +struct ImportResolver<'a, 'b:'a, 'tcx:'b> { + resolver: &'a mut Resolver<'b, 'tcx> +} + +impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> { + // Import resolution + // + // This is a fixed-point algorithm. We resolve imports until our efforts + // are stymied by an unresolved import; then we bail out of the current + // module and continue. We terminate successfully once no more imports + // remain or unsuccessfully when no forward progress in resolving imports + // is made. + + /// Resolves all imports for the crate. This method performs the fixed- + /// point iteration. + fn resolve_imports(&mut self) { + let mut i = 0; + let mut prev_unresolved_imports = 0; + loop { + debug!("(resolving imports) iteration {}, {} imports left", + i, self.resolver.unresolved_imports); + + let module_root = self.resolver.graph_root.get_module(); + self.resolve_imports_for_module_subtree(module_root.clone()); + + if self.resolver.unresolved_imports == 0 { + debug!("(resolving imports) success"); + break; + } + + if self.resolver.unresolved_imports == prev_unresolved_imports { + self.resolver.report_unresolved_imports(module_root); + break; + } + + i += 1; + prev_unresolved_imports = self.resolver.unresolved_imports; + } + } + + /// Attempts to resolve imports for the given module and all of its + /// submodules. + fn resolve_imports_for_module_subtree(&mut self, module_: Rc) { + debug!("(resolving imports for module subtree) resolving {}", + module_to_string(&*module_)); + let orig_module = replace(&mut self.resolver.current_module, module_.clone()); + self.resolve_imports_for_module(module_.clone()); + self.resolver.current_module = orig_module; + + build_reduced_graph::populate_module_if_necessary(self.resolver, &module_); + for (_, child_node) in &*module_.children.borrow() { + match child_node.get_module_if_available() { + None => { + // Nothing to do. + } + Some(child_module) => { + self.resolve_imports_for_module_subtree(child_module); + } + } + } + + for (_, child_module) in &*module_.anonymous_children.borrow() { + self.resolve_imports_for_module_subtree(child_module.clone()); + } + } + + /// Attempts to resolve imports for the given module only. + fn resolve_imports_for_module(&mut self, module: Rc) { + if module.all_imports_resolved() { + debug!("(resolving imports for module) all imports resolved for \ + {}", + module_to_string(&*module)); + return; + } + + let imports = module.imports.borrow(); + let import_count = imports.len(); + while module.resolved_import_count.get() < import_count { + let import_index = module.resolved_import_count.get(); + let import_directive = &(*imports)[import_index]; + match self.resolve_import_for_module(module.clone(), + import_directive) { + ResolveResult::Failed(err) => { + let (span, help) = match err { + Some((span, msg)) => (span, format!(". {}", msg)), + None => (import_directive.span, String::new()) + }; + let msg = format!("unresolved import `{}`{}", + import_path_to_string( + &import_directive.module_path, + import_directive.subclass), + help); + self.resolver.resolve_error(span, &msg[..]); + } + ResolveResult::Indeterminate => break, // Bail out. We'll come around next time. + ResolveResult::Success(()) => () // Good. Continue. + } + + module.resolved_import_count + .set(module.resolved_import_count.get() + 1); + } + } + + /// Attempts to resolve the given import. The return value indicates + /// failure if we're certain the name does not exist, indeterminate if we + /// don't know whether the name exists at the moment due to other + /// currently-unresolved imports, or success if we know the name exists. + /// If successful, the resolved bindings are written into the module. + fn resolve_import_for_module(&mut self, + module_: Rc, + import_directive: &ImportDirective) + -> ResolveResult<()> { + let mut resolution_result = ResolveResult::Failed(None); + let module_path = &import_directive.module_path; + + debug!("(resolving import for module) resolving import `{}::...` in `{}`", + names_to_string(&module_path[..]), + module_to_string(&*module_)); + + // First, resolve the module path for the directive, if necessary. + let container = if module_path.len() == 0 { + // Use the crate root. + Some((self.resolver.graph_root.get_module(), LastMod(AllPublic))) + } else { + match self.resolver.resolve_module_path(module_.clone(), + &module_path[..], + UseLexicalScopeFlag::DontUseLexicalScope, + import_directive.span, + NameSearchType::ImportSearch) { + ResolveResult::Failed(err) => { + resolution_result = ResolveResult::Failed(err); + None + }, + ResolveResult::Indeterminate => { + resolution_result = ResolveResult::Indeterminate; + None + } + ResolveResult::Success(container) => Some(container), + } + }; + + match container { + None => {} + Some((containing_module, lp)) => { + // We found the module that the target is contained + // within. Attempt to resolve the import within it. + + match import_directive.subclass { + SingleImport(target, source) => { + resolution_result = + self.resolve_single_import(&module_, + containing_module, + target, + source, + import_directive, + lp); + } + GlobImport => { + resolution_result = + self.resolve_glob_import(&module_, + containing_module, + import_directive, + lp); + } + } + } + } + + // Decrement the count of unresolved imports. + match resolution_result { + ResolveResult::Success(()) => { + assert!(self.resolver.unresolved_imports >= 1); + self.resolver.unresolved_imports -= 1; + } + _ => { + // Nothing to do here; just return the error. + } + } + + // Decrement the count of unresolved globs if necessary. But only if + // the resolution result is indeterminate -- otherwise we'll stop + // processing imports here. (See the loop in + // resolve_imports_for_module). + + if !resolution_result.indeterminate() { + match import_directive.subclass { + GlobImport => { + assert!(module_.glob_count.get() >= 1); + module_.glob_count.set(module_.glob_count.get() - 1); + } + SingleImport(..) => { + // Ignore. + } + } + } + + return resolution_result; + } + + fn resolve_single_import(&mut self, + module_: &Module, + target_module: Rc, + target: Name, + source: Name, + directive: &ImportDirective, + lp: LastPrivate) + -> ResolveResult<()> { + debug!("(resolving single import) resolving `{}` = `{}::{}` from \ + `{}` id {}, last private {:?}", + token::get_name(target), + module_to_string(&*target_module), + token::get_name(source), + module_to_string(module_), + directive.id, + lp); + + let lp = match lp { + LastMod(lp) => lp, + LastImport {..} => { + self.resolver.session + .span_bug(directive.span, + "not expecting Import here, must be LastMod") + } + }; + + // We need to resolve both namespaces for this to succeed. + // + + let mut value_result = UnknownResult; + let mut type_result = UnknownResult; + + // Search for direct children of the containing module. + build_reduced_graph::populate_module_if_necessary(self.resolver, &target_module); + + match target_module.children.borrow().get(&source) { + None => { + // Continue. + } + Some(ref child_name_bindings) => { + // pub_err makes sure we don't give the same error twice. + let mut pub_err = false; + if child_name_bindings.defined_in_namespace(ValueNS) { + debug!("(resolving single import) found value binding"); + value_result = BoundResult(target_module.clone(), + (*child_name_bindings).clone()); + if directive.is_public && !child_name_bindings.is_public(ValueNS) { + let msg = format!("`{}` is private", token::get_name(source)); + span_err!(self.resolver.session, directive.span, E0364, "{}", &msg); + pub_err = true; + } + } + if child_name_bindings.defined_in_namespace(TypeNS) { + debug!("(resolving single import) found type binding"); + type_result = BoundResult(target_module.clone(), + (*child_name_bindings).clone()); + if !pub_err && directive.is_public && !child_name_bindings.is_public(TypeNS) { + let msg = format!("`{}` is private", token::get_name(source)); + span_err!(self.resolver.session, directive.span, E0365, "{}", &msg); + } + } + } + } + + // Unless we managed to find a result in both namespaces (unlikely), + // search imports as well. + let mut value_used_reexport = false; + let mut type_used_reexport = false; + match (value_result.clone(), type_result.clone()) { + (BoundResult(..), BoundResult(..)) => {} // Continue. + _ => { + // If there is an unresolved glob at this point in the + // containing module, bail out. We don't know enough to be + // able to resolve this import. + + if target_module.glob_count.get() > 0 { + debug!("(resolving single import) unresolved glob; \ + bailing out"); + return ResolveResult::Indeterminate; + } + + // Now search the exported imports within the containing module. + match target_module.import_resolutions.borrow().get(&source) { + None => { + debug!("(resolving single import) no import"); + // The containing module definitely doesn't have an + // exported import with the name in question. We can + // therefore accurately report that the names are + // unbound. + + if value_result.is_unknown() { + value_result = UnboundResult; + } + if type_result.is_unknown() { + type_result = UnboundResult; + } + } + Some(import_resolution) + if import_resolution.outstanding_references == 0 => { + + fn get_binding(this: &mut Resolver, + import_resolution: &ImportResolution, + namespace: Namespace, + source: &Name) + -> NamespaceResult { + + // Import resolutions must be declared with "pub" + // in order to be exported. + if !import_resolution.is_public { + return UnboundResult; + } + + match import_resolution.target_for_namespace(namespace) { + None => { + return UnboundResult; + } + Some(Target { + target_module, + bindings, + shadowable: _ + }) => { + debug!("(resolving single import) found \ + import in ns {:?}", namespace); + let id = import_resolution.id(namespace); + // track used imports and extern crates as well + this.used_imports.insert((id, namespace)); + this.record_import_use(id, *source); + match target_module.def_id.get() { + Some(DefId{krate: kid, ..}) => { + this.used_crates.insert(kid); + }, + _ => {} + } + return BoundResult(target_module, bindings); + } + } + } + + // The name is an import which has been fully + // resolved. We can, therefore, just follow it. + if value_result.is_unknown() { + value_result = get_binding(self.resolver, + import_resolution, + ValueNS, + &source); + value_used_reexport = import_resolution.is_public; + } + if type_result.is_unknown() { + type_result = get_binding(self.resolver, + import_resolution, + TypeNS, + &source); + type_used_reexport = import_resolution.is_public; + } + + } + Some(_) => { + // If target_module is the same module whose import we are resolving + // and there it has an unresolved import with the same name as `source`, + // then the user is actually trying to import an item that is declared + // in the same scope + // + // e.g + // use self::submodule; + // pub mod submodule; + // + // In this case we continue as if we resolved the import and let the + // check_for_conflicts_between_imports_and_items call below handle + // the conflict + match (module_.def_id.get(), target_module.def_id.get()) { + (Some(id1), Some(id2)) if id1 == id2 => { + if value_result.is_unknown() { + value_result = UnboundResult; + } + if type_result.is_unknown() { + type_result = UnboundResult; + } + } + _ => { + // The import is unresolved. Bail out. + debug!("(resolving single import) unresolved import; \ + bailing out"); + return ResolveResult::Indeterminate; + } + } + } + } + } + } + + let mut value_used_public = false; + let mut type_used_public = false; + + // If we didn't find a result in the type namespace, search the + // external modules. + match type_result { + BoundResult(..) => {} + _ => { + match target_module.external_module_children.borrow_mut().get(&source).cloned() { + None => {} // Continue. + Some(module) => { + debug!("(resolving single import) found external module"); + // track the module as used. + match module.def_id.get() { + Some(DefId{krate: kid, ..}) => { + self.resolver.used_crates.insert(kid); + } + _ => {} + } + let name_bindings = + Rc::new(Resolver::create_name_bindings_from_module(module)); + type_result = BoundResult(target_module.clone(), name_bindings); + type_used_public = true; + } + } + } + } + + // We've successfully resolved the import. Write the results in. + let mut import_resolutions = module_.import_resolutions.borrow_mut(); + let import_resolution = &mut (*import_resolutions)[target]; + + { + let mut check_and_write_import = |namespace, result: &_, used_public: &mut bool| { + let namespace_name = match namespace { + TypeNS => "type", + ValueNS => "value", + }; + + match *result { + BoundResult(ref target_module, ref name_bindings) => { + debug!("(resolving single import) found {:?} target: {:?}", + namespace_name, + name_bindings.def_for_namespace(namespace)); + self.check_for_conflicting_import( + &import_resolution.target_for_namespace(namespace), + directive.span, + target, + namespace); + + self.check_that_import_is_importable( + &**name_bindings, + directive.span, + target, + namespace); + + let target = Some(Target::new(target_module.clone(), + name_bindings.clone(), + directive.shadowable)); + import_resolution.set_target_and_id(namespace, target, directive.id); + import_resolution.is_public = directive.is_public; + *used_public = name_bindings.defined_in_public_namespace(namespace); + } + UnboundResult => { /* Continue. */ } + UnknownResult => { + panic!("{:?} result should be known at this point", namespace_name); + } + } + }; + check_and_write_import(ValueNS, &value_result, &mut value_used_public); + check_and_write_import(TypeNS, &type_result, &mut type_used_public); + } + + self.check_for_conflicts_between_imports_and_items( + module_, + import_resolution, + directive.span, + target); + + if value_result.is_unbound() && type_result.is_unbound() { + let msg = format!("There is no `{}` in `{}`", + token::get_name(source), + module_to_string(&target_module)); + return ResolveResult::Failed(Some((directive.span, msg))); + } + let value_used_public = value_used_reexport || value_used_public; + let type_used_public = type_used_reexport || type_used_public; + + assert!(import_resolution.outstanding_references >= 1); + import_resolution.outstanding_references -= 1; + + // Record what this import resolves to for later uses in documentation, + // this may resolve to either a value or a type, but for documentation + // purposes it's good enough to just favor one over the other. + let value_def_and_priv = import_resolution.value_target.as_ref().map(|target| { + let def = target.bindings.def_for_namespace(ValueNS).unwrap(); + (def, if value_used_public { lp } else { DependsOn(def.def_id()) }) + }); + let type_def_and_priv = import_resolution.type_target.as_ref().map(|target| { + let def = target.bindings.def_for_namespace(TypeNS).unwrap(); + (def, if type_used_public { lp } else { DependsOn(def.def_id()) }) + }); + + let import_lp = LastImport { + value_priv: value_def_and_priv.map(|(_, p)| p), + value_used: Used, + type_priv: type_def_and_priv.map(|(_, p)| p), + type_used: Used + }; + + if let Some((def, _)) = value_def_and_priv { + self.resolver.def_map.borrow_mut().insert(directive.id, PathResolution { + base_def: def, + last_private: import_lp, + depth: 0 + }); + } + if let Some((def, _)) = type_def_and_priv { + self.resolver.def_map.borrow_mut().insert(directive.id, PathResolution { + base_def: def, + last_private: import_lp, + depth: 0 + }); + } + + debug!("(resolving single import) successfully resolved import"); + return ResolveResult::Success(()); + } + + // Resolves a glob import. Note that this function cannot fail; it either + // succeeds or bails out (as importing * from an empty module or a module + // that exports nothing is valid). target_module is the module we are + // actually importing, i.e., `foo` in `use foo::*`. + fn resolve_glob_import(&mut self, + module_: &Module, + target_module: Rc, + import_directive: &ImportDirective, + lp: LastPrivate) + -> ResolveResult<()> { + let id = import_directive.id; + let is_public = import_directive.is_public; + + // This function works in a highly imperative manner; it eagerly adds + // everything it can to the list of import resolutions of the module + // node. + debug!("(resolving glob import) resolving glob import {}", id); + + // We must bail out if the node has unresolved imports of any kind + // (including globs). + if !(*target_module).all_imports_resolved() { + debug!("(resolving glob import) target module has unresolved \ + imports; bailing out"); + return ResolveResult::Indeterminate; + } + + assert_eq!(target_module.glob_count.get(), 0); + + // Add all resolved imports from the containing module. + let import_resolutions = target_module.import_resolutions.borrow(); + for (ident, target_import_resolution) in &*import_resolutions { + debug!("(resolving glob import) writing module resolution \ + {} into `{}`", + token::get_name(*ident), + module_to_string(module_)); + + if !target_import_resolution.is_public { + debug!("(resolving glob import) nevermind, just kidding"); + continue + } + + // Here we merge two import resolutions. + let mut import_resolutions = module_.import_resolutions.borrow_mut(); + match import_resolutions.get_mut(ident) { + Some(dest_import_resolution) => { + // Merge the two import resolutions at a finer-grained + // level. + + match target_import_resolution.value_target { + None => { + // Continue. + } + Some(ref value_target) => { + self.check_for_conflicting_import(&dest_import_resolution.value_target, + import_directive.span, + *ident, + ValueNS); + dest_import_resolution.value_target = Some(value_target.clone()); + } + } + match target_import_resolution.type_target { + None => { + // Continue. + } + Some(ref type_target) => { + self.check_for_conflicting_import(&dest_import_resolution.type_target, + import_directive.span, + *ident, + TypeNS); + dest_import_resolution.type_target = Some(type_target.clone()); + } + } + dest_import_resolution.is_public = is_public; + continue; + } + None => {} + } + + // Simple: just copy the old import resolution. + let mut new_import_resolution = ImportResolution::new(id, is_public); + new_import_resolution.value_target = + target_import_resolution.value_target.clone(); + new_import_resolution.type_target = + target_import_resolution.type_target.clone(); + + import_resolutions.insert(*ident, new_import_resolution); + } + + // Add all children from the containing module. + build_reduced_graph::populate_module_if_necessary(self.resolver, &target_module); + + for (&name, name_bindings) in &*target_module.children.borrow() { + self.merge_import_resolution(module_, + target_module.clone(), + import_directive, + name, + name_bindings.clone()); + + } + + // Add external module children from the containing module. + for (&name, module) in &*target_module.external_module_children.borrow() { + let name_bindings = + Rc::new(Resolver::create_name_bindings_from_module(module.clone())); + self.merge_import_resolution(module_, + target_module.clone(), + import_directive, + name, + name_bindings); + } + + // Record the destination of this import + if let Some(did) = target_module.def_id.get() { + self.resolver.def_map.borrow_mut().insert(id, PathResolution { + base_def: DefMod(did), + last_private: lp, + depth: 0 + }); + } + + debug!("(resolving glob import) successfully resolved import"); + return ResolveResult::Success(()); + } + + fn merge_import_resolution(&mut self, + module_: &Module, + containing_module: Rc, + import_directive: &ImportDirective, + name: Name, + name_bindings: Rc) { + let id = import_directive.id; + let is_public = import_directive.is_public; + + let mut import_resolutions = module_.import_resolutions.borrow_mut(); + let dest_import_resolution = import_resolutions.entry(name).get().unwrap_or_else( + |vacant_entry| { + // Create a new import resolution from this child. + vacant_entry.insert(ImportResolution::new(id, is_public)) + }); + + debug!("(resolving glob import) writing resolution `{}` in `{}` \ + to `{}`", + &token::get_name(name), + module_to_string(&*containing_module), + module_to_string(module_)); + + // Merge the child item into the import resolution. + { + let mut merge_child_item = |namespace| { + if name_bindings.defined_in_namespace_with(namespace, IMPORTABLE | PUBLIC) { + let namespace_name = match namespace { + TypeNS => "type", + ValueNS => "value", + }; + debug!("(resolving glob import) ... for {} target", namespace_name); + if dest_import_resolution.shadowable(namespace) == Shadowable::Never { + let msg = format!("a {} named `{}` has already been imported \ + in this module", + namespace_name, + &token::get_name(name)); + span_err!(self.resolver.session, import_directive.span, E0251, "{}", msg); + } else { + let target = Target::new(containing_module.clone(), + name_bindings.clone(), + import_directive.shadowable); + dest_import_resolution.set_target_and_id(namespace, + Some(target), + id); + } + } + }; + merge_child_item(ValueNS); + merge_child_item(TypeNS); + } + + dest_import_resolution.is_public = is_public; + + self.check_for_conflicts_between_imports_and_items( + module_, + dest_import_resolution, + import_directive.span, + name); + } + + /// Checks that imported names and items don't have the same name. + fn check_for_conflicting_import(&mut self, + target: &Option, + import_span: Span, + name: Name, + namespace: Namespace) { + debug!("check_for_conflicting_import: {}; target exists: {}", + &token::get_name(name), + target.is_some()); + + match *target { + Some(ref target) if target.shadowable != Shadowable::Always => { + let msg = format!("a {} named `{}` has already been imported \ + in this module", + match namespace { + TypeNS => "type", + ValueNS => "value", + }, + &token::get_name(name)); + span_err!(self.resolver.session, import_span, E0252, "{}", &msg[..]); + } + Some(_) | None => {} + } + } + + /// Checks that an import is actually importable + fn check_that_import_is_importable(&mut self, + name_bindings: &NameBindings, + import_span: Span, + name: Name, + namespace: Namespace) { + if !name_bindings.defined_in_namespace_with(namespace, IMPORTABLE) { + let msg = format!("`{}` is not directly importable", + token::get_name(name)); + span_err!(self.resolver.session, import_span, E0253, "{}", &msg[..]); + } + } + + /// Checks that imported names and items don't have the same name. + fn check_for_conflicts_between_imports_and_items(&mut self, + module: &Module, + import_resolution: + &ImportResolution, + import_span: Span, + name: Name) { + // First, check for conflicts between imports and `extern crate`s. + if module.external_module_children + .borrow() + .contains_key(&name) { + match import_resolution.type_target { + Some(ref target) if target.shadowable != Shadowable::Always => { + let msg = format!("import `{0}` conflicts with imported \ + crate in this module \ + (maybe you meant `use {0}::*`?)", + &token::get_name(name)); + span_err!(self.resolver.session, import_span, E0254, "{}", &msg[..]); + } + Some(_) | None => {} + } + } + + // Check for item conflicts. + let children = module.children.borrow(); + let name_bindings = match children.get(&name) { + None => { + // There can't be any conflicts. + return + } + Some(ref name_bindings) => (*name_bindings).clone(), + }; + + match import_resolution.value_target { + Some(ref target) if target.shadowable != Shadowable::Always => { + if let Some(ref value) = *name_bindings.value_def.borrow() { + span_err!(self.resolver.session, import_span, E0255, + "import `{}` conflicts with value in this module", + &token::get_name(name)); + if let Some(span) = value.value_span { + self.resolver.session.span_note(span, "conflicting value here"); + } + } + } + Some(_) | None => {} + } + + match import_resolution.type_target { + Some(ref target) if target.shadowable != Shadowable::Always => { + if let Some(ref ty) = *name_bindings.type_def.borrow() { + let (what, note) = if ty.module_def.is_some() { + ("existing submodule", "note conflicting module here") + } else { + ("type in this module", "note conflicting type here") + }; + span_err!(self.resolver.session, import_span, E0256, + "import `{}` conflicts with {}", + &token::get_name(name), what); + if let Some(span) = ty.type_span { + self.resolver.session.span_note(span, note); + } + } + } + Some(_) | None => {} + } + } +} + +fn import_path_to_string(names: &[Name], + subclass: ImportDirectiveSubclass) + -> String { + if names.is_empty() { + import_directive_subclass_to_string(subclass) + } else { + (format!("{}::{}", + names_to_string(names), + import_directive_subclass_to_string(subclass))).to_string() + } +} + +fn import_directive_subclass_to_string(subclass: ImportDirectiveSubclass) -> String { + match subclass { + SingleImport(_, source) => { + token::get_name(source).to_string() + } + GlobImport => "*".to_string() + } +} + +pub fn resolve_imports(resolver: &mut Resolver) { + let mut import_resolver = ImportResolver { + resolver: resolver, + }; + import_resolver.resolve_imports(); +} diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs index 3087a8ea45ddc..34a23f3efac42 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs @@ -626,12 +626,7 @@ fn link_rlib<'a>(sess: &'a Session, e)) } - let bc_data_deflated = match flate::deflate_bytes(&bc_data[..]) { - Some(compressed) => compressed, - None => sess.fatal(&format!("failed to compress bytecode \ - from {}", - bc_filename.display())) - }; + let bc_data_deflated = flate::deflate_bytes(&bc_data[..]); let mut bc_file_deflated = match fs::File::create(&bc_deflated_filename) { Ok(file) => file, diff --git a/src/librustc_trans/back/lto.rs b/src/librustc_trans/back/lto.rs index 219f48f78dc46..a3ab863c4eca4 100644 --- a/src/librustc_trans/back/lto.rs +++ b/src/librustc_trans/back/lto.rs @@ -95,8 +95,8 @@ pub fn run(sess: &session::Session, llmod: ModuleRef, (link::RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET + data_size as uint)]; match flate::inflate_bytes(compressed_data) { - Some(inflated) => inflated, - None => { + Ok(inflated) => inflated, + Err(_) => { sess.fatal(&format!("failed to decompress bc of `{}`", name)) } @@ -111,8 +111,8 @@ pub fn run(sess: &session::Session, llmod: ModuleRef, // the object must be in the old, pre-versioning format, so simply // inflate everything and let LLVM decide if it can make sense of it match flate::inflate_bytes(bc_encoded) { - Some(bc) => bc, - None => { + Ok(bc) => bc, + Err(_) => { sess.fatal(&format!("failed to decompress bc of `{}`", name)) } diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index ccf24f7e859dd..e9f58ec53dfb3 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -2974,10 +2974,7 @@ pub fn write_metadata(cx: &SharedCrateContext, krate: &ast::Crate) -> Vec { let encode_parms = crate_ctxt_to_encode_parms(cx, encode_inlined_item); let metadata = encoder::encode_metadata(encode_parms, krate); let mut compressed = encoder::metadata_encoding_version.to_vec(); - compressed.push_all(&match flate::deflate_bytes(&metadata) { - Some(compressed) => compressed, - None => cx.sess().fatal("failed to compress metadata"), - }); + compressed.push_all(&flate::deflate_bytes(&metadata)); let llmeta = C_bytes_in_context(cx.metadata_llcx(), &compressed[..]); let llconst = C_struct_in_context(cx.metadata_llcx(), &[llmeta], false); let name = format!("rust_metadata_{}_{}", diff --git a/src/librustc_trans/trans/callee.rs b/src/librustc_trans/trans/callee.rs index 861233bafdfac..cf36ec1f3ed96 100644 --- a/src/librustc_trans/trans/callee.rs +++ b/src/librustc_trans/trans/callee.rs @@ -253,7 +253,7 @@ fn trans_fn_ref_with_substs_to_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, /// Translates an adapter that implements the `Fn` trait for a fn /// pointer. This is basically the equivalent of something like: /// -/// ```rust +/// ``` /// impl<'a> Fn(&'a int) -> &'a int for fn(&int) -> &int { /// extern "rust-abi" fn call(&self, args: (&'a int,)) -> &'a int { /// (*self)(args.0) diff --git a/src/librustc_trans/trans/closure.rs b/src/librustc_trans/trans/closure.rs index 7fa26a7c12841..c1bc7219ad825 100644 --- a/src/librustc_trans/trans/closure.rs +++ b/src/librustc_trans/trans/closure.rs @@ -259,4 +259,3 @@ pub fn trans_closure_expr<'a, 'tcx>(dest: Dest<'a, 'tcx>, Some(bcx) } - diff --git a/src/librustc_trans/trans/llrepr.rs b/src/librustc_trans/trans/llrepr.rs index de0f714276d0d..6dd566797970e 100644 --- a/src/librustc_trans/trans/llrepr.rs +++ b/src/librustc_trans/trans/llrepr.rs @@ -34,5 +34,3 @@ impl LlvmRepr for ValueRef { ccx.tn().val_to_string(*self) } } - - diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs index 0d4edc01a4c1d..32f91a175f3c3 100644 --- a/src/librustc_typeck/check/closure.rs +++ b/src/librustc_typeck/check/closure.rs @@ -248,5 +248,3 @@ fn self_type_matches_expected_vid<'a,'tcx>( _ => None, } } - - diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index f452c8488ce1c..17fc2aad286ea 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -556,5 +556,3 @@ impl<'a,'tcx> euv::Delegate<'tcx> for AdjustBorrowKind<'a,'tcx> { self.adjust_upvar_borrow_kind_for_mut(assignee_cmt); } } - - diff --git a/src/librustc_typeck/check/vtable.rs b/src/librustc_typeck/check/vtable.rs index 630530cf11f84..963be9aa2e2d2 100644 --- a/src/librustc_typeck/check/vtable.rs +++ b/src/librustc_typeck/check/vtable.rs @@ -302,4 +302,3 @@ pub fn select_new_fcx_obligations(fcx: &FnCtxt) { Err(errors) => { report_fulfillment_errors(fcx.infcx(), &errors); } } } - diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 03fa269ccf829..396d060de9e90 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -181,4 +181,3 @@ register_diagnostics! { } __build_diagnostic_array! { DIAGNOSTICS } - diff --git a/src/librustc_typeck/variance.rs b/src/librustc_typeck/variance.rs index 9b27128ce2ffd..ac1ff29e7f545 100644 --- a/src/librustc_typeck/variance.rs +++ b/src/librustc_typeck/variance.rs @@ -1350,4 +1350,3 @@ fn glb(v1: ty::Variance, v2: ty::Variance) -> ty::Variance { (x, ty::Bivariant) | (ty::Bivariant, x) => x, } } - diff --git a/src/librustdoc/html/item_type.rs b/src/librustdoc/html/item_type.rs index 1d63f01be524a..d2385702a73d2 100644 --- a/src/librustdoc/html/item_type.rs +++ b/src/librustdoc/html/item_type.rs @@ -111,4 +111,3 @@ impl fmt::Display for ItemType { self.to_static_str().fmt(f) } } - diff --git a/src/librustdoc/html/static/Heuristica-LICENSE.txt b/src/librustdoc/html/static/Heuristica-LICENSE.txt index 9693dc1db2df3..dd85e40e64548 100644 --- a/src/librustdoc/html/static/Heuristica-LICENSE.txt +++ b/src/librustdoc/html/static/Heuristica-LICENSE.txt @@ -1,7 +1,7 @@ Copyright 1989, 1991 Adobe Systems Incorporated. All rights reserved. Utopia is either a registered trademark or trademark of Adobe Systems Incorporated in the United States and/or other countries. Used under -license. +license. Copyright 2006 Han The Thanh, Vntopia font family, http://vntex.sf.net @@ -26,7 +26,7 @@ with others. The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The -fonts, including any derivative works, can be bundled, embedded, +fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The diff --git a/src/librustdoc/html/static/SourceCodePro-LICENSE.txt b/src/librustdoc/html/static/SourceCodePro-LICENSE.txt index 1177330426de9..07542572e33bd 100644 --- a/src/librustdoc/html/static/SourceCodePro-LICENSE.txt +++ b/src/librustdoc/html/static/SourceCodePro-LICENSE.txt @@ -18,7 +18,7 @@ with others. The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The -fonts, including any derivative works, can be bundled, embedded, +fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The diff --git a/src/librustdoc/html/static/SourceSerifPro-LICENSE.txt b/src/librustdoc/html/static/SourceSerifPro-LICENSE.txt index 14b54813758d0..b77d653ad4f0d 100644 --- a/src/librustdoc/html/static/SourceSerifPro-LICENSE.txt +++ b/src/librustdoc/html/static/SourceSerifPro-LICENSE.txt @@ -18,7 +18,7 @@ with others. The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The -fonts, including any derivative works, can be bundled, embedded, +fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The diff --git a/src/librustdoc/html/static/playpen.js b/src/librustdoc/html/static/playpen.js index 8fb979875cd76..06b3c4e42d633 100644 --- a/src/librustdoc/html/static/playpen.js +++ b/src/librustdoc/html/static/playpen.js @@ -25,4 +25,3 @@ }); } }()); - diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs index 26994a6d79d7f..1f8d45a007d2b 100644 --- a/src/libserialize/hex.rs +++ b/src/libserialize/hex.rs @@ -31,7 +31,7 @@ impl ToHex for [u8] { /// /// # Examples /// - /// ```rust + /// ``` /// extern crate serialize; /// use serialize::hex::ToHex; /// @@ -100,7 +100,7 @@ impl FromHex for str { /// /// This converts a string literal to hexadecimal and back. /// - /// ```rust + /// ``` /// extern crate serialize; /// use serialize::hex::{FromHex, ToHex}; /// diff --git a/src/libstd/bool.rs b/src/libstd/bool.rs index 0d8b233a1697d..df703b3e43e32 100644 --- a/src/libstd/bool.rs +++ b/src/libstd/bool.rs @@ -12,4 +12,3 @@ #![doc(primitive = "bool")] #![stable(feature = "rust1", since = "1.0.0")] - diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 27f78906ec2d0..4b6fbe01f760b 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -41,7 +41,7 @@ use sys::os as os_imp; /// /// # Examples /// -/// ```rust +/// ``` /// use std::env; /// /// // We assume that we are in a valid directory. @@ -58,7 +58,7 @@ pub fn current_dir() -> io::Result { /// /// # Examples /// -/// ```rust +/// ``` /// use std::env; /// use std::path::Path; /// @@ -102,7 +102,7 @@ pub struct VarsOs { inner: os_imp::Env } /// /// # Examples /// -/// ```rust +/// ``` /// use std::env; /// /// // We will iterate through the references to the element returned by @@ -125,7 +125,7 @@ pub fn vars() -> Vars { /// /// # Examples /// -/// ```rust +/// ``` /// use std::env; /// /// // We will iterate through the references to the element returned by @@ -166,7 +166,7 @@ impl Iterator for VarsOs { /// /// # Examples /// -/// ```rust +/// ``` /// use std::env; /// /// let key = "HOME"; @@ -188,7 +188,7 @@ pub fn var(key: &K) -> Result where K: AsOsStr { /// /// # Examples /// -/// ```rust +/// ``` /// use std::env; /// /// let key = "HOME"; @@ -246,7 +246,7 @@ impl Error for VarError { /// /// # Examples /// -/// ```rust +/// ``` /// use std::env; /// /// let key = "KEY"; @@ -282,7 +282,7 @@ pub struct SplitPaths<'a> { inner: os_imp::SplitPaths<'a> } /// /// # Examples /// -/// ```rust +/// ``` /// use std::env; /// /// let key = "PATH"; @@ -326,7 +326,7 @@ pub struct JoinPathsError { /// /// # Examples /// -/// ```rust +/// ``` /// use std::env; /// use std::path::PathBuf; /// @@ -374,7 +374,7 @@ impl Error for JoinPathsError { /// /// # Examples /// -/// ```rust +/// ``` /// use std::env; /// /// match env::home_dir() { @@ -416,7 +416,7 @@ pub fn temp_dir() -> PathBuf { /// /// # Examples /// -/// ```rust +/// ``` /// use std::env; /// /// match env::current_exe() { @@ -481,7 +481,7 @@ pub struct ArgsOs { inner: os_imp::Args } /// /// # Examples /// -/// ```rust +/// ``` /// use std::env; /// /// // Prints each argument on a separate line @@ -503,7 +503,7 @@ pub fn args() -> Args { /// /// # Examples /// -/// ```rust +/// ``` /// use std::env; /// /// // Prints each argument on a separate line diff --git a/src/libstd/fs/mod.rs b/src/libstd/fs/mod.rs index d072d1f102b3f..ba89b3a0ea63f 100644 --- a/src/libstd/fs/mod.rs +++ b/src/libstd/fs/mod.rs @@ -473,7 +473,7 @@ pub fn rename(from: P, to: Q) -> io::Result<()> { /// /// # Examples /// -/// ```rust +/// ``` /// use std::fs; /// /// fs::copy("foo.txt", "bar.txt"); @@ -540,7 +540,7 @@ pub fn read_link(path: P) -> io::Result { /// /// # Examples /// -/// ```rust +/// ``` /// use std::fs; /// /// fs::create_dir("/some/dir"); @@ -576,7 +576,7 @@ pub fn create_dir_all(path: P) -> io::Result<()> { /// /// # Examples /// -/// ```rust +/// ``` /// use std::fs; /// /// fs::remove_dir("/some/dir"); @@ -627,7 +627,7 @@ pub fn remove_dir_all(path: P) -> io::Result<()> { /// /// # Examples /// -/// ```rust +/// ``` /// use std::io; /// use std::fs::{self, PathExt, DirEntry}; /// use std::path::Path; diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 03416eb86a0eb..73dcf058e4512 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -118,15 +118,16 @@ impl fmt::Debug for BufReader where R: fmt::Debug { /// `BufWriter` keeps an in memory buffer of data and writes it to the /// underlying `Write` in large, infrequent batches. /// -/// This writer will be flushed when it is dropped. +/// The buffer will be written out when the writer is dropped. #[stable(feature = "rust1", since = "1.0.0")] pub struct BufWriter { inner: Option, buf: Vec, } -/// An error returned by `into_inner` which indicates whether a flush error -/// happened or not. +/// An error returned by `into_inner` which combines an error that +/// happened while writing out the buffer, and the buffered writer object +/// which may be used to recover from the condition. #[derive(Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub struct IntoInnerError(W, Error); @@ -155,7 +156,7 @@ impl BufWriter { match self.inner.as_mut().unwrap().write(&self.buf[written..]) { Ok(0) => { ret = Err(Error::new(ErrorKind::WriteZero, - "failed to flush", None)); + "failed to write the buffered data", None)); break; } Ok(n) => written += n, @@ -190,7 +191,7 @@ impl BufWriter { /// Unwraps this `BufWriter`, returning the underlying writer. /// - /// The buffer is flushed before returning the writer. + /// The buffer is written out before returning the writer. #[stable(feature = "rust1", since = "1.0.0")] pub fn into_inner(mut self) -> Result>> { match self.flush_buf() { @@ -239,14 +240,14 @@ impl Drop for BufWriter { impl IntoInnerError { /// Returns the error which caused the call to `into_inner` to fail. /// - /// This error was returned when attempting to flush the internal buffer. + /// This error was returned when attempting to write the internal buffer. #[stable(feature = "rust1", since = "1.0.0")] pub fn error(&self) -> &Error { &self.1 } - /// Returns the underlying `BufWriter` instance which generated the error. + /// Returns the buffered writer instance which generated the error. /// - /// The returned object can be used to retry a flush or re-inspect the - /// buffer. + /// The returned object can be used for error recovery, such as + /// re-inspecting the buffer. #[stable(feature = "rust1", since = "1.0.0")] pub fn into_inner(self) -> W { self.0 } } @@ -273,7 +274,7 @@ impl fmt::Display for IntoInnerError { /// Wraps a Writer and buffers output to it, flushing whenever a newline /// (`0x0a`, `'\n'`) is detected. /// -/// This writer will be flushed when it is dropped. +/// The buffer will be written out when the writer is dropped. #[stable(feature = "rust1", since = "1.0.0")] pub struct LineWriter { inner: BufWriter, @@ -307,7 +308,7 @@ impl LineWriter { /// Unwraps this `LineWriter`, returning the underlying writer. /// - /// The internal buffer is flushed before returning the writer. + /// The internal buffer is written out before returning the writer. #[stable(feature = "rust1", since = "1.0.0")] pub fn into_inner(self) -> Result>> { self.inner.into_inner().map_err(|IntoInnerError(buf, e)| { @@ -364,7 +365,7 @@ impl Read for InternalBufWriter { /// call. A `BufStream` keeps in memory buffers of data, making large, /// infrequent calls to `read` and `write` on the underlying `Read+Write`. /// -/// The output half will be flushed when this stream is dropped. +/// The output buffer will be written out when this stream is dropped. #[stable(feature = "rust1", since = "1.0.0")] pub struct BufStream { inner: BufReader> @@ -410,8 +411,8 @@ impl BufStream { /// Unwraps this `BufStream`, returning the underlying stream. /// - /// The internal buffer is flushed before returning the stream. Any leftover - /// data in the read buffer is lost. + /// The internal write buffer is written out before returning the stream. + /// Any leftover data in the read buffer is lost. #[stable(feature = "rust1", since = "1.0.0")] pub fn into_inner(self) -> Result>> { let BufReader { inner: InternalBufWriter(w), buf } = self.inner; diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 72d014e77a780..d1231f549bb41 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -363,7 +363,7 @@ pub trait Write { /// /// It is considered an error if not all bytes could be written due to /// I/O errors or EOF being reached. - #[unstable(feature = "io", reason = "waiting for RFC 950")] + #[stable(feature = "rust1", since = "1.0.0")] fn flush(&mut self) -> Result<()>; /// Attempts to write an entire buffer into this write. diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 7378f43f757bf..e1ef30627948d 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -182,7 +182,7 @@ pub mod builtin { /// /// # Examples /// - /// ```rust + /// ``` /// use std::fmt; /// /// let s = fmt::format(format_args!("hello {}", "world")); @@ -205,7 +205,7 @@ pub mod builtin { /// /// # Examples /// - /// ```rust + /// ``` /// let path: &'static str = env!("PATH"); /// println!("the $PATH variable at the time of compiling was: {}", path); /// ``` @@ -224,7 +224,7 @@ pub mod builtin { /// /// # Examples /// - /// ```rust + /// ``` /// let key: Option<&'static str> = option_env!("SECRET_KEY"); /// println!("the secret key might be: {:?}", key); /// ``` @@ -372,7 +372,7 @@ pub mod builtin { /// /// # Examples /// - /// ```rust + /// ``` /// mod test { /// pub fn foo() { /// assert!(module_path!().ends_with("test")); @@ -395,7 +395,7 @@ pub mod builtin { /// /// # Examples /// - /// ```rust + /// ``` /// let my_directory = if cfg!(windows) { /// "windows-specific-directory" /// } else { diff --git a/src/libstd/old_io/buffered.rs b/src/libstd/old_io/buffered.rs index 2f4e1e870997d..82a48a72499b6 100644 --- a/src/libstd/old_io/buffered.rs +++ b/src/libstd/old_io/buffered.rs @@ -34,7 +34,7 @@ use vec::Vec; /// /// # Examples /// -/// ```rust +/// ``` /// use std::old_io::{BufferedReader, File}; /// /// let file = File::open(&Path::new("message.txt")); @@ -137,7 +137,7 @@ impl Reader for BufferedReader { /// /// # Examples /// -/// ```rust +/// ``` /// use std::old_io::{BufferedWriter, File}; /// /// let file = File::create(&Path::new("message.txt")).unwrap(); @@ -323,7 +323,7 @@ impl Reader for InternalBufferedWriter { /// /// # Examples /// -/// ```rust +/// ``` /// # #![allow(unused_must_use)] /// use std::old_io::{BufferedStream, File}; /// diff --git a/src/libstd/old_io/fs.rs b/src/libstd/old_io/fs.rs index a6ed76688ca68..ff3af380b7d6a 100644 --- a/src/libstd/old_io/fs.rs +++ b/src/libstd/old_io/fs.rs @@ -176,7 +176,7 @@ impl File { /// /// # Examples /// - /// ```rust + /// ``` /// use std::old_io::File; /// /// let contents = File::open(&Path::new("foo.txt")).read_to_end(); @@ -195,7 +195,7 @@ impl File { /// /// # Examples /// - /// ```rust + /// ``` /// # #![allow(unused_must_use)] /// use std::old_io::File; /// @@ -286,7 +286,7 @@ impl File { /// /// # Examples /// -/// ```rust +/// ``` /// # #![allow(unused_must_use)] /// use std::old_io::fs; /// @@ -317,7 +317,7 @@ pub fn unlink(path: &Path) -> IoResult<()> { /// /// # Examples /// -/// ```rust +/// ``` /// use std::old_io::fs; /// /// let p = Path::new("/some/file/path.txt"); @@ -359,7 +359,7 @@ pub fn lstat(path: &Path) -> IoResult { /// /// # Examples /// -/// ```rust +/// ``` /// # #![allow(unused_must_use)] /// use std::old_io::fs; /// @@ -387,7 +387,7 @@ pub fn rename(from: &Path, to: &Path) -> IoResult<()> { /// /// # Examples /// -/// ```rust +/// ``` /// # #![allow(unused_must_use)] /// use std::old_io::fs; /// @@ -437,7 +437,7 @@ pub fn copy(from: &Path, to: &Path) -> IoResult<()> { /// /// # Examples /// -/// ```rust +/// ``` /// # #![allow(unused_must_use)] /// use std::old_io; /// use std::old_io::fs; @@ -508,7 +508,7 @@ pub fn readlink(path: &Path) -> IoResult { /// /// # Examples /// -/// ```rust +/// ``` /// # #![allow(unused_must_use)] /// use std::old_io; /// use std::old_io::fs; @@ -532,7 +532,7 @@ pub fn mkdir(path: &Path, mode: FilePermission) -> IoResult<()> { /// /// # Examples /// -/// ```rust +/// ``` /// # #![allow(unused_must_use)] /// use std::old_io::fs; /// @@ -556,7 +556,7 @@ pub fn rmdir(path: &Path) -> IoResult<()> { /// /// # Examples /// -/// ```rust +/// ``` /// use std::old_io::fs::PathExtensions; /// use std::old_io::fs; /// use std::old_io; diff --git a/src/libstd/old_io/mem.rs b/src/libstd/old_io/mem.rs index 43182e4fcd6a8..72774334c13b0 100644 --- a/src/libstd/old_io/mem.rs +++ b/src/libstd/old_io/mem.rs @@ -56,7 +56,7 @@ impl Writer for Vec { /// /// # Examples /// -/// ```rust +/// ``` /// # #![allow(unused_must_use)] /// use std::old_io::MemWriter; /// @@ -116,7 +116,7 @@ impl Writer for MemWriter { /// /// # Examples /// -/// ```rust +/// ``` /// # #![allow(unused_must_use)] /// use std::old_io::MemReader; /// @@ -246,7 +246,7 @@ impl<'a> Buffer for &'a [u8] { /// /// # Examples /// -/// ```rust +/// ``` /// # #![allow(unused_must_use)] /// use std::old_io::BufWriter; /// @@ -318,7 +318,7 @@ impl<'a> Seek for BufWriter<'a> { /// /// # Examples /// -/// ```rust +/// ``` /// # #![allow(unused_must_use)] /// use std::old_io::BufReader; /// diff --git a/src/libstd/old_io/mod.rs b/src/libstd/old_io/mod.rs index e1341e0e5cfc4..15a80e34451f9 100644 --- a/src/libstd/old_io/mod.rs +++ b/src/libstd/old_io/mod.rs @@ -1410,7 +1410,7 @@ pub trait Buffer: Reader { /// /// # Examples /// - /// ```rust + /// ``` /// use std::old_io::BufReader; /// /// let mut reader = BufReader::new(b"hello\nworld"); diff --git a/src/libstd/old_io/net/pipe.rs b/src/libstd/old_io/net/pipe.rs index 5935253290283..ad0e7a7284de4 100644 --- a/src/libstd/old_io/net/pipe.rs +++ b/src/libstd/old_io/net/pipe.rs @@ -52,7 +52,7 @@ impl UnixStream { /// /// # Examples /// - /// ```rust + /// ``` /// # #![allow(unused_must_use)] /// use std::old_io::net::pipe::UnixStream; /// diff --git a/src/libstd/old_io/stdio.rs b/src/libstd/old_io/stdio.rs index 92fad2316714c..b699b93f2b88c 100644 --- a/src/libstd/old_io/stdio.rs +++ b/src/libstd/old_io/stdio.rs @@ -142,7 +142,7 @@ impl StdinReader { /// /// # Examples /// - /// ```rust + /// ``` /// use std::old_io; /// /// let mut stdin = old_io::stdin(); diff --git a/src/libstd/old_io/timer.rs b/src/libstd/old_io/timer.rs index de7883c715a2c..65c62a9933522 100644 --- a/src/libstd/old_io/timer.rs +++ b/src/libstd/old_io/timer.rs @@ -115,7 +115,7 @@ impl Timer { /// /// # Examples /// - /// ```rust + /// ``` /// use std::old_io::Timer; /// use std::time::Duration; /// @@ -128,7 +128,7 @@ impl Timer { /// ten_milliseconds.recv().unwrap(); /// ``` /// - /// ```rust + /// ``` /// use std::old_io::Timer; /// use std::time::Duration; /// @@ -167,7 +167,7 @@ impl Timer { /// /// # Examples /// - /// ```rust + /// ``` /// use std::old_io::Timer; /// use std::time::Duration; /// @@ -186,7 +186,7 @@ impl Timer { /// ten_milliseconds.recv().unwrap(); /// ``` /// - /// ```rust + /// ``` /// use std::old_io::Timer; /// use std::time::Duration; /// diff --git a/src/libstd/os.rs b/src/libstd/os.rs index fc05eb1d62703..46233a46ee556 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -132,7 +132,7 @@ pub const TMPBUF_SZ : uint = 1000; /// /// # Examples /// -/// ```rust +/// ``` /// use std::os; /// /// // We assume that we are in a valid directory. @@ -152,7 +152,7 @@ pub fn getcwd() -> IoResult { /// /// # Examples /// -/// ```rust +/// ``` /// use std::os; /// /// // We will iterate through the references to the element returned by os::env(); @@ -188,7 +188,7 @@ pub fn env_as_bytes() -> Vec<(Vec, Vec)> { /// /// # Examples /// -/// ```rust +/// ``` /// use std::os; /// /// let key = "HOME"; @@ -230,7 +230,7 @@ fn byteify(s: OsString) -> Vec { /// /// # Examples /// -/// ```rust +/// ``` /// use std::os; /// /// let key = "KEY"; @@ -270,7 +270,8 @@ pub fn unsetenv(n: &str) { /// environment variable. /// /// # Examples -/// ```rust +/// +/// ``` /// use std::os; /// /// let key = "PATH"; @@ -302,7 +303,7 @@ pub fn split_paths(unparsed: T) -> Vec { /// /// # Examples /// -/// ```rust +/// ``` /// use std::os; /// use std::old_path::Path; /// @@ -363,7 +364,7 @@ pub fn dll_filename(base: &str) -> String { /// /// # Examples /// -/// ```rust +/// ``` /// use std::os; /// /// match os::self_exe_name() { @@ -383,7 +384,7 @@ pub fn self_exe_name() -> Option { /// /// # Examples /// -/// ```rust +/// ``` /// use std::os; /// /// match os::self_exe_path() { @@ -412,7 +413,7 @@ pub fn self_exe_path() -> Option { /// /// # Examples /// -/// ```rust +/// ``` /// use std::os; /// /// match os::homedir() { @@ -501,7 +502,8 @@ pub fn tmpdir() -> Path { /// as is. /// /// # Examples -/// ```rust +/// +/// ``` /// use std::os; /// use std::old_path::Path; /// @@ -532,7 +534,8 @@ pub fn make_absolute(p: &Path) -> IoResult { /// whether the change was completed successfully or not. /// /// # Examples -/// ```rust +/// +/// ``` /// use std::os; /// use std::old_path::Path; /// @@ -553,7 +556,8 @@ pub fn errno() -> i32 { /// Return the string corresponding to an `errno()` value of `errnum`. /// /// # Examples -/// ```rust +/// +/// ``` /// use std::os; /// /// // Same as println!("{}", last_os_error()); @@ -749,7 +753,7 @@ extern "system" { /// See `String::from_utf8_lossy` for details. /// # Examples /// -/// ```rust +/// ``` /// use std::os; /// /// // Prints each argument on a separate line diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 29c779df4d275..2d97d65136637 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -856,7 +856,7 @@ impl<'a> cmp::Ord for Components<'a> { /// /// # Examples /// -/// ```rust +/// ``` /// use std::path::PathBuf; /// /// let mut path = PathBuf::new("c:\\"); @@ -948,7 +948,7 @@ impl PathBuf { /// /// # Examples /// - /// ```rust + /// ``` /// use std::path::PathBuf; /// /// let mut buf = PathBuf::new("/"); @@ -1105,7 +1105,7 @@ impl AsOsStr for PathBuf { /// /// # Examples /// -/// ```rust +/// ``` /// use std::path::Path; /// /// let path = Path::new("/tmp/foo/bar.txt"); @@ -1210,7 +1210,7 @@ impl Path { /// /// # Examples /// - /// ```rust + /// ``` /// use std::path::Path; /// /// let path = Path::new("/foo/bar"); diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index e8407ab1115db..69053252ed1de 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -426,7 +426,7 @@ pub fn random() -> T { /// /// # Examples /// -/// ```rust +/// ``` /// use std::rand::{thread_rng, sample}; /// /// let mut rng = thread_rng(); diff --git a/src/libstd/rand/reader.rs b/src/libstd/rand/reader.rs index eac5aa4256c8c..42c153af03639 100644 --- a/src/libstd/rand/reader.rs +++ b/src/libstd/rand/reader.rs @@ -25,7 +25,7 @@ use slice::SliceExt; /// /// # Examples /// -/// ```rust +/// ``` /// use std::rand::{reader, Rng}; /// use std::old_io::MemReader; /// diff --git a/src/libstd/sync/barrier.rs b/src/libstd/sync/barrier.rs index f697d10d5dfab..ebf4d3377499e 100644 --- a/src/libstd/sync/barrier.rs +++ b/src/libstd/sync/barrier.rs @@ -13,7 +13,7 @@ use sync::{Mutex, Condvar}; /// A barrier enables multiple tasks to synchronize the beginning /// of some computation. /// -/// ```rust +/// ``` /// use std::sync::{Arc, Barrier}; /// use std::thread; /// diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 41378a6b3127b..1cbfbbf29278f 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -46,7 +46,7 @@ use fmt; /// /// # Examples /// -/// ```rust +/// ``` /// use std::sync::{Arc, Mutex}; /// use std::thread; /// use std::sync::mpsc::channel; @@ -84,7 +84,7 @@ use fmt; /// /// To recover from a poisoned mutex: /// -/// ```rust +/// ``` /// use std::sync::{Arc, Mutex}; /// use std::thread; /// @@ -135,7 +135,7 @@ unsafe impl Sync for Mutex { } /// /// # Examples /// -/// ```rust +/// ``` /// use std::sync::{StaticMutex, MUTEX_INIT}; /// /// static LOCK: StaticMutex = MUTEX_INIT; diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 5cad2916624d2..258cf1d38a8ca 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -26,7 +26,7 @@ use sync::{StaticMutex, MUTEX_INIT}; /// /// # Examples /// -/// ```rust +/// ``` /// use std::sync::{Once, ONCE_INIT}; /// /// static START: Once = ONCE_INIT; diff --git a/src/libstd/sync/task_pool.rs b/src/libstd/sync/task_pool.rs index 3d31790550b96..8a1946b86ab4a 100644 --- a/src/libstd/sync/task_pool.rs +++ b/src/libstd/sync/task_pool.rs @@ -60,7 +60,7 @@ impl<'a> Drop for Sentinel<'a> { /// /// # Examples /// -/// ```rust +/// ``` /// use std::sync::TaskPool; /// use std::iter::AdditiveIterator; /// use std::sync::mpsc::channel; diff --git a/src/libstd/thread.rs b/src/libstd/thread.rs index adc3b77407a61..a40b26c85bee1 100644 --- a/src/libstd/thread.rs +++ b/src/libstd/thread.rs @@ -402,18 +402,18 @@ pub fn park() { /// the specified duration has been reached (may wake spuriously). /// /// The semantics of this function are equivalent to `park()` except that the -/// thread will be blocked for roughly no longer than dur. This method +/// thread will be blocked for roughly no longer than *duration*. This method /// should not be used for precise timing due to anomalies such as /// preemption or platform differences that may not cause the maximum -/// amount of time waited to be precisely dur +/// amount of time waited to be precisely *duration* long. /// /// See the module doc for more detail. #[unstable(feature = "std_misc", reason = "recently introduced, depends on Duration")] -pub fn park_timeout(dur: Duration) { +pub fn park_timeout(duration: Duration) { let thread = current(); let mut guard = thread.inner.lock.lock().unwrap(); if !*guard { - let (g, _) = thread.inner.cvar.wait_timeout(guard, dur).unwrap(); + let (g, _) = thread.inner.cvar.wait_timeout(guard, duration).unwrap(); guard = g; } *guard = false; @@ -502,11 +502,11 @@ impl Thread { /// Deprecated: use module-level free function. #[deprecated(since = "1.0.0", reason = "use module-level free function")] #[unstable(feature = "std_misc", reason = "recently introduced")] - pub fn park_timeout(dur: Duration) { + pub fn park_timeout(duration: Duration) { let thread = current(); let mut guard = thread.inner.lock.lock().unwrap(); if !*guard { - let (g, _) = thread.inner.cvar.wait_timeout(guard, dur).unwrap(); + let (g, _) = thread.inner.cvar.wait_timeout(guard, duration).unwrap(); guard = g; } *guard = false; diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index f60ac8f3f33b2..b53bb4bc75ee2 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -37,7 +37,6 @@ #![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] -#![feature(io)] #![feature(path_ext)] extern crate arena; diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index 5e858d8a79f76..2a47a696b1cf2 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -121,13 +121,11 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> { debug!("current path: {}", ast_util::path_name_i(&self.cx.path)); - if is_test_fn(&self.cx, &*i) || is_bench_fn(&self.cx, &*i) { + let i = if is_test_fn(&self.cx, &*i) || is_bench_fn(&self.cx, &*i) { match i.node { ast::ItemFn(_, ast::Unsafety::Unsafe, _, _, _) => { let diag = self.cx.span_diagnostic; - diag.span_fatal(i.span, - "unsafe functions cannot be used for \ - tests"); + diag.span_fatal(i.span, "unsafe functions cannot be used for tests"); } _ => { debug!("this is a test function"); @@ -142,9 +140,19 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> { self.tests.push(i.ident); // debug!("have {} test/bench functions", // cx.testfns.len()); + + // Make all tests public so we can call them from outside + // the module (note that the tests are re-exported and must + // be made public themselves to avoid privacy errors). + i.map(|mut i| { + i.vis = ast::Public; + i + }) } } - } + } else { + i + }; // We don't want to recurse into anything other than mods, since // mods or tests inside of functions will break things diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index 36225fad2211e..89960d5d62f5b 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -57,7 +57,6 @@ #![feature(box_syntax)] #![feature(collections)] #![feature(int_uint)] -#![feature(io)] #![feature(rustc_private)] #![feature(staged_api)] #![feature(std_misc)] diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 8fe0cd6ebd4e0..02ddeea46bfc8 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -42,7 +42,6 @@ #![feature(rustc_private)] #![feature(staged_api)] #![feature(std_misc)] -#![feature(io)] #![feature(libc)] #![feature(set_stdio)] diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs index 6a80f3bc2c189..917c2d2dfbe88 100644 --- a/src/libunicode/u_str.rs +++ b/src/libunicode/u_str.rs @@ -482,7 +482,7 @@ impl<'a> Iterator for Utf16Items<'a> { /// /// # Examples /// -/// ```rust +/// ``` /// use unicode::str::Utf16Item::{ScalarValue, LoneSurrogate}; /// /// // 𝄞music diff --git a/src/rt/msvc/typeof.h b/src/rt/msvc/typeof.h index b83f530b0e9bc..7de08af314a5a 100644 --- a/src/rt/msvc/typeof.h +++ b/src/rt/msvc/typeof.h @@ -94,4 +94,3 @@ namespace msvc_typeof_impl { #endif #endif - diff --git a/src/rt/valgrind/memcheck.h b/src/rt/valgrind/memcheck.h index 3af0728f01796..ee72707d3194e 100644 --- a/src/rt/valgrind/memcheck.h +++ b/src/rt/valgrind/memcheck.h @@ -1,4 +1,3 @@ - /* ---------------------------------------------------------------- @@ -284,4 +283,3 @@ typedef (zznbytes), 0, 0 ) #endif - diff --git a/src/test/auxiliary/changing-crates-a2.rs b/src/test/auxiliary/changing-crates-a2.rs index a54dcbbbfc245..28eae023d684b 100644 --- a/src/test/auxiliary/changing-crates-a2.rs +++ b/src/test/auxiliary/changing-crates-a2.rs @@ -11,4 +11,3 @@ #![crate_name = "a"] pub fn foo() { println!("hello!"); } - diff --git a/src/test/auxiliary/coherence-orphan-lib.rs b/src/test/auxiliary/coherence-orphan-lib.rs index cc42b288e6638..93d8fd3da88fb 100644 --- a/src/test/auxiliary/coherence-orphan-lib.rs +++ b/src/test/auxiliary/coherence-orphan-lib.rs @@ -11,4 +11,3 @@ pub trait TheTrait : ::std::marker::PhantomFn { fn the_fn(&self); } - diff --git a/src/test/auxiliary/default_type_params_xc.rs b/src/test/auxiliary/default_type_params_xc.rs index 0a65174911ec7..fe852e5d8eaee 100644 --- a/src/test/auxiliary/default_type_params_xc.rs +++ b/src/test/auxiliary/default_type_params_xc.rs @@ -13,4 +13,3 @@ pub struct Heap; pub struct FakeHeap; pub struct FakeVec { pub f: Option<(T,A)> } - diff --git a/src/test/auxiliary/iss.rs b/src/test/auxiliary/iss.rs index 690d5783c4bc2..b231efa0fece4 100644 --- a/src/test/auxiliary/iss.rs +++ b/src/test/auxiliary/iss.rs @@ -20,4 +20,3 @@ fn no_op() { } pub const D : C = C { k: no_op as fn() }; - diff --git a/src/test/auxiliary/issue-12133-dylib2.rs b/src/test/auxiliary/issue-12133-dylib2.rs index ee2b11da8f0ad..cf1953005ba44 100644 --- a/src/test/auxiliary/issue-12133-dylib2.rs +++ b/src/test/auxiliary/issue-12133-dylib2.rs @@ -14,4 +14,3 @@ extern crate "issue-12133-rlib" as a; extern crate "issue-12133-dylib" as b; - diff --git a/src/test/auxiliary/issue-13560-3.rs b/src/test/auxiliary/issue-13560-3.rs index 5510d3e2e0df1..f1f16af6f0e3f 100644 --- a/src/test/auxiliary/issue-13560-3.rs +++ b/src/test/auxiliary/issue-13560-3.rs @@ -14,4 +14,3 @@ #[macro_use] #[no_link] extern crate "issue-13560-1" as t1; #[macro_use] extern crate "issue-13560-2" as t2; - diff --git a/src/test/auxiliary/issue-16725.rs b/src/test/auxiliary/issue-16725.rs index 7f388c13e15a8..b3b04b4a5ac13 100644 --- a/src/test/auxiliary/issue-16725.rs +++ b/src/test/auxiliary/issue-16725.rs @@ -11,4 +11,3 @@ extern { fn bar(); } - diff --git a/src/test/auxiliary/issue-5521.rs b/src/test/auxiliary/issue-5521.rs index d9d393cc7492c..2ffdddcc798ca 100644 --- a/src/test/auxiliary/issue-5521.rs +++ b/src/test/auxiliary/issue-5521.rs @@ -12,4 +12,3 @@ use std::collections::HashMap; pub type map = Box>; - diff --git a/src/test/auxiliary/issue13213aux.rs b/src/test/auxiliary/issue13213aux.rs index 227fab73048d7..c2acc51434615 100644 --- a/src/test/auxiliary/issue13213aux.rs +++ b/src/test/auxiliary/issue13213aux.rs @@ -27,4 +27,3 @@ mod private { } pub static A: S = S { p: private::THREE }; - diff --git a/src/test/auxiliary/issue_3907.rs b/src/test/auxiliary/issue_3907.rs index 545e15fe1664d..c118f7e4854fa 100644 --- a/src/test/auxiliary/issue_3907.rs +++ b/src/test/auxiliary/issue_3907.rs @@ -13,4 +13,3 @@ use std::marker::MarkerTrait; pub trait Foo : MarkerTrait { fn bar(); } - diff --git a/src/test/auxiliary/issue_5844_aux.rs b/src/test/auxiliary/issue_5844_aux.rs index 0f898ae83859f..e12af579c571d 100644 --- a/src/test/auxiliary/issue_5844_aux.rs +++ b/src/test/auxiliary/issue_5844_aux.rs @@ -13,4 +13,3 @@ extern crate libc; extern "C" { pub fn rand() -> libc::c_int; } - diff --git a/src/test/auxiliary/issue_8401.rs b/src/test/auxiliary/issue_8401.rs index 9006a5d1775f7..04b56442d0b8f 100644 --- a/src/test/auxiliary/issue_8401.rs +++ b/src/test/auxiliary/issue_8401.rs @@ -24,4 +24,3 @@ fn foo(t: &T) { let b = B; bar(unsafe { mem::transmute(&b as &A) }, t) } - diff --git a/src/test/auxiliary/issue_9123.rs b/src/test/auxiliary/issue_9123.rs index 4f2792aebcd24..8c2546e76cfd4 100644 --- a/src/test/auxiliary/issue_9123.rs +++ b/src/test/auxiliary/issue_9123.rs @@ -17,4 +17,3 @@ pub trait X { } fn dummy(&self) { } } - diff --git a/src/test/auxiliary/issue_9188.rs b/src/test/auxiliary/issue_9188.rs index 5f5a8f02fd9d1..d17e4afb5e8ac 100644 --- a/src/test/auxiliary/issue_9188.rs +++ b/src/test/auxiliary/issue_9188.rs @@ -21,4 +21,3 @@ pub fn foo() -> &'static int { pub fn bar() -> &'static int { foo::() } - diff --git a/src/test/auxiliary/kinds_in_metadata.rs b/src/test/auxiliary/kinds_in_metadata.rs index 7e090523984da..82f182c04bd38 100644 --- a/src/test/auxiliary/kinds_in_metadata.rs +++ b/src/test/auxiliary/kinds_in_metadata.rs @@ -16,4 +16,3 @@ #![crate_type="lib"] pub fn f() {} - diff --git a/src/test/auxiliary/lang-item-public.rs b/src/test/auxiliary/lang-item-public.rs index b9cc20b63cc56..c5d4182eae653 100644 --- a/src/test/auxiliary/lang-item-public.rs +++ b/src/test/auxiliary/lang-item-public.rs @@ -32,5 +32,3 @@ extern fn eh_personality() {} pub trait Copy : PhantomFn { // Empty. } - - diff --git a/src/test/auxiliary/namespaced_enums.rs b/src/test/auxiliary/namespaced_enums.rs index 5b21d130d1704..3c0138a707717 100644 --- a/src/test/auxiliary/namespaced_enums.rs +++ b/src/test/auxiliary/namespaced_enums.rs @@ -18,4 +18,3 @@ impl Foo { pub fn foo() {} pub fn bar(&self) {} } - diff --git a/src/test/auxiliary/plugin_crate_outlive_expansion_phase.rs b/src/test/auxiliary/plugin_crate_outlive_expansion_phase.rs index c460c60b02b06..420151c471ea6 100644 --- a/src/test/auxiliary/plugin_crate_outlive_expansion_phase.rs +++ b/src/test/auxiliary/plugin_crate_outlive_expansion_phase.rs @@ -32,4 +32,3 @@ pub fn registrar(_: &mut Registry) { thread_local!(static FOO: RefCell>> = RefCell::new(None)); FOO.with(|s| *s.borrow_mut() = Some(box Foo { foo: 10 } as Box)); } - diff --git a/src/test/auxiliary/privacy_reexport.rs b/src/test/auxiliary/privacy_reexport.rs index 266903169c7b0..e60dbb290b079 100644 --- a/src/test/auxiliary/privacy_reexport.rs +++ b/src/test/auxiliary/privacy_reexport.rs @@ -10,6 +10,6 @@ pub use foo as bar; -mod foo { +pub mod foo { pub fn frob() {} } diff --git a/src/test/auxiliary/pub_static_array.rs b/src/test/auxiliary/pub_static_array.rs new file mode 100644 index 0000000000000..4419a5ae83cfa --- /dev/null +++ b/src/test/auxiliary/pub_static_array.rs @@ -0,0 +1,11 @@ +// Copyright 2014 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub static ARRAY: &'static [u8] = &[1]; diff --git a/src/test/auxiliary/struct_variant_privacy.rs b/src/test/auxiliary/struct_variant_privacy.rs index 0bdda23508038..8d9b304aa51e0 100644 --- a/src/test/auxiliary/struct_variant_privacy.rs +++ b/src/test/auxiliary/struct_variant_privacy.rs @@ -11,4 +11,3 @@ enum Bar { Baz { a: int } } - diff --git a/src/test/auxiliary/trait_bounds_on_structs_and_enums_xc.rs b/src/test/auxiliary/trait_bounds_on_structs_and_enums_xc.rs index a7c469fccaa5a..beee83f9f7cd5 100644 --- a/src/test/auxiliary/trait_bounds_on_structs_and_enums_xc.rs +++ b/src/test/auxiliary/trait_bounds_on_structs_and_enums_xc.rs @@ -21,4 +21,3 @@ pub enum Bar { BBar(T), CBar(uint), } - diff --git a/src/test/auxiliary/weak-lang-items.rs b/src/test/auxiliary/weak-lang-items.rs index fa254cb91ad53..85f49b4bb7fad 100644 --- a/src/test/auxiliary/weak-lang-items.rs +++ b/src/test/auxiliary/weak-lang-items.rs @@ -34,4 +34,3 @@ pub fn foo() { mod std { pub use core::{option, fmt}; } - diff --git a/src/test/auxiliary/where_clauses_xc.rs b/src/test/auxiliary/where_clauses_xc.rs index 002b31f099f38..4549bd719c65e 100644 --- a/src/test/auxiliary/where_clauses_xc.rs +++ b/src/test/auxiliary/where_clauses_xc.rs @@ -27,4 +27,3 @@ impl Equal for T where T: Eq { pub fn equal(x: &T, y: &T) -> bool where T: Eq { x == y } - diff --git a/src/test/auxiliary/xcrate_struct_aliases.rs b/src/test/auxiliary/xcrate_struct_aliases.rs index a0ec7272720dc..5556ee6971c4a 100644 --- a/src/test/auxiliary/xcrate_struct_aliases.rs +++ b/src/test/auxiliary/xcrate_struct_aliases.rs @@ -14,4 +14,3 @@ pub struct S { } pub type S2 = S; - diff --git a/src/test/auxiliary/xcrate_unit_struct.rs b/src/test/auxiliary/xcrate_unit_struct.rs index 7ae3655407916..538abf00a6703 100644 --- a/src/test/auxiliary/xcrate_unit_struct.rs +++ b/src/test/auxiliary/xcrate_unit_struct.rs @@ -36,4 +36,3 @@ pub enum EnumWithVariants { EnumVariant, EnumVariantArg(int) } - diff --git a/src/test/compile-fail/associated-types-coherence-failure.rs b/src/test/compile-fail/associated-types-coherence-failure.rs index b7a16c68a34e1..915cb077787ea 100644 --- a/src/test/compile-fail/associated-types-coherence-failure.rs +++ b/src/test/compile-fail/associated-types-coherence-failure.rs @@ -57,4 +57,3 @@ pub trait ToOwned { fn main() {} - diff --git a/src/test/compile-fail/associated-types-eq-expr-path.rs b/src/test/compile-fail/associated-types-eq-expr-path.rs index c48f9972ebc18..0d68b960f3135 100644 --- a/src/test/compile-fail/associated-types-eq-expr-path.rs +++ b/src/test/compile-fail/associated-types-eq-expr-path.rs @@ -22,5 +22,5 @@ impl Foo for isize { pub fn main() { let x: isize = Foo::::bar(); - //~^ERROR unexpected binding of associated item in expression path + //~^ ERROR unexpected binding of associated item in expression path } diff --git a/src/test/compile-fail/associated-types-issue-17359.rs b/src/test/compile-fail/associated-types-issue-17359.rs index 625f4cdb8ef3d..5c36e3356a5c0 100644 --- a/src/test/compile-fail/associated-types-issue-17359.rs +++ b/src/test/compile-fail/associated-types-issue-17359.rs @@ -18,4 +18,3 @@ trait Trait : ::std::marker::MarkerTrait { impl Trait for isize {} //~ ERROR missing: `Type` fn main() {} - diff --git a/src/test/compile-fail/bad-crate-id2.rs b/src/test/compile-fail/bad-crate-id2.rs index 4899252a1a42c..6425908672d12 100644 --- a/src/test/compile-fail/bad-crate-id2.rs +++ b/src/test/compile-fail/bad-crate-id2.rs @@ -11,4 +11,3 @@ extern crate "#a" as bar; //~ ERROR: invalid character `#` in crate name: `#a` fn main() {} - diff --git a/src/test/compile-fail/borrowck-box-insensitivity.rs b/src/test/compile-fail/borrowck-box-insensitivity.rs index 59514f75a77d8..c980e77df6f96 100644 --- a/src/test/compile-fail/borrowck-box-insensitivity.rs +++ b/src/test/compile-fail/borrowck-box-insensitivity.rs @@ -152,4 +152,3 @@ fn main() { borrow_after_mut_borrow_nested(); mut_borrow_after_borrow_nested(); } - diff --git a/src/test/compile-fail/borrowck-closures-unique-imm.rs b/src/test/compile-fail/borrowck-closures-unique-imm.rs index dcf43c01e1775..247a4fe89a501 100644 --- a/src/test/compile-fail/borrowck-closures-unique-imm.rs +++ b/src/test/compile-fail/borrowck-closures-unique-imm.rs @@ -22,4 +22,3 @@ pub fn main() { }; r() } - diff --git a/src/test/compile-fail/borrowck-field-sensitivity.rs b/src/test/compile-fail/borrowck-field-sensitivity.rs index fe5142a77341f..13fd5fce95569 100644 --- a/src/test/compile-fail/borrowck-field-sensitivity.rs +++ b/src/test/compile-fail/borrowck-field-sensitivity.rs @@ -124,4 +124,3 @@ fn main() { borrow_after_field_assign_after_uninit(); move_after_field_assign_after_uninit(); } - diff --git a/src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs b/src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs index b6b260065557a..31ec5aea7f3a6 100644 --- a/src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs +++ b/src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs @@ -32,4 +32,3 @@ fn main() { for &a in x.iter() { //~ ERROR cannot move out } } - diff --git a/src/test/compile-fail/borrowck-for-loop-head-linkage.rs b/src/test/compile-fail/borrowck-for-loop-head-linkage.rs index 01a649ae2475d..b79fc5b2bf622 100644 --- a/src/test/compile-fail/borrowck-for-loop-head-linkage.rs +++ b/src/test/compile-fail/borrowck-for-loop-head-linkage.rs @@ -18,4 +18,3 @@ fn main() { vector[1] = 5; //~ ERROR cannot borrow } } - diff --git a/src/test/compile-fail/borrowck-issue-14498.rs b/src/test/compile-fail/borrowck-issue-14498.rs index deae1fbad20c8..8278b4fb971c3 100644 --- a/src/test/compile-fail/borrowck-issue-14498.rs +++ b/src/test/compile-fail/borrowck-issue-14498.rs @@ -62,4 +62,3 @@ fn main() { borrow_in_field_from_var(); borrow_in_field_from_field(); } - diff --git a/src/test/compile-fail/borrowck-let-suggestion.rs b/src/test/compile-fail/borrowck-let-suggestion.rs index 5729f8c56179e..d760f3db0c2cc 100644 --- a/src/test/compile-fail/borrowck-let-suggestion.rs +++ b/src/test/compile-fail/borrowck-let-suggestion.rs @@ -17,4 +17,3 @@ fn f() { fn main() { f(); } - diff --git a/src/test/compile-fail/borrowck-multiple-captures.rs b/src/test/compile-fail/borrowck-multiple-captures.rs index f417416e7b53e..042b914ce41a4 100644 --- a/src/test/compile-fail/borrowck-multiple-captures.rs +++ b/src/test/compile-fail/borrowck-multiple-captures.rs @@ -63,4 +63,3 @@ fn main() { same_var_after_borrow(); same_var_after_move(); } - diff --git a/src/test/compile-fail/borrowck-mutate-in-guard.rs b/src/test/compile-fail/borrowck-mutate-in-guard.rs index 44353ab5d960a..e35edca639e45 100644 --- a/src/test/compile-fail/borrowck-mutate-in-guard.rs +++ b/src/test/compile-fail/borrowck-mutate-in-guard.rs @@ -30,4 +30,3 @@ fn foo() -> isize { fn main() { foo(); } - diff --git a/src/test/compile-fail/borrowck-object-lifetime.rs b/src/test/compile-fail/borrowck-object-lifetime.rs index bbb58e211988e..021b3f38e0019 100644 --- a/src/test/compile-fail/borrowck-object-lifetime.rs +++ b/src/test/compile-fail/borrowck-object-lifetime.rs @@ -37,4 +37,3 @@ fn imm_owned_receiver(mut x: Box) { } fn main() {} - diff --git a/src/test/compile-fail/borrowck-object-mutability.rs b/src/test/compile-fail/borrowck-object-mutability.rs index 9b5087bd7e0b7..1bdc32b09750b 100644 --- a/src/test/compile-fail/borrowck-object-mutability.rs +++ b/src/test/compile-fail/borrowck-object-mutability.rs @@ -35,4 +35,3 @@ fn mut_owned_receiver(mut x: Box) { } fn main() {} - diff --git a/src/test/compile-fail/borrowck-overloaded-call.rs b/src/test/compile-fail/borrowck-overloaded-call.rs index 04d73cc36f04c..673c025e86345 100644 --- a/src/test/compile-fail/borrowck-overloaded-call.rs +++ b/src/test/compile-fail/borrowck-overloaded-call.rs @@ -77,4 +77,3 @@ fn h() { } fn main() {} - diff --git a/src/test/compile-fail/borrowck-overloaded-index-and-overloaded-deref.rs b/src/test/compile-fail/borrowck-overloaded-index-and-overloaded-deref.rs index 4188cf001423e..430f2fcc13a73 100644 --- a/src/test/compile-fail/borrowck-overloaded-index-and-overloaded-deref.rs +++ b/src/test/compile-fail/borrowck-overloaded-index-and-overloaded-deref.rs @@ -44,4 +44,3 @@ fn main() { } fn read(_: usize) { } - diff --git a/src/test/compile-fail/borrowck-partial-reinit-2.rs b/src/test/compile-fail/borrowck-partial-reinit-2.rs index 0926ba6e43250..c9cdeff9c7a17 100644 --- a/src/test/compile-fail/borrowck-partial-reinit-2.rs +++ b/src/test/compile-fail/borrowck-partial-reinit-2.rs @@ -31,4 +31,3 @@ fn main() { stuff(); println!("Hello, world!") } - diff --git a/src/test/compile-fail/borrowck-unboxed-closures.rs b/src/test/compile-fail/borrowck-unboxed-closures.rs index 8e7e2e3e77782..3eca850e493c7 100644 --- a/src/test/compile-fail/borrowck-unboxed-closures.rs +++ b/src/test/compile-fail/borrowck-unboxed-closures.rs @@ -26,4 +26,3 @@ fn c isize>(f: F) { } fn main() {} - diff --git a/src/test/compile-fail/borrowck-use-mut-borrow.rs b/src/test/compile-fail/borrowck-use-mut-borrow.rs index 52f89da10b977..e14df7329eac4 100644 --- a/src/test/compile-fail/borrowck-use-mut-borrow.rs +++ b/src/test/compile-fail/borrowck-use-mut-borrow.rs @@ -94,4 +94,3 @@ fn main() { field_deref_after_var_borrow(); field_deref_after_field_borrow(); } - diff --git a/src/test/compile-fail/closure-reform-bad.rs b/src/test/compile-fail/closure-reform-bad.rs index d2295eba6d7a4..490734d463da4 100644 --- a/src/test/compile-fail/closure-reform-bad.rs +++ b/src/test/compile-fail/closure-reform-bad.rs @@ -20,4 +20,3 @@ fn main() { let f = |s: &str| println!("{}{}", s, string); call_bare(f) //~ ERROR mismatched types } - diff --git a/src/test/compile-fail/cross-borrow-trait.rs b/src/test/compile-fail/cross-borrow-trait.rs index 871f52cbebddc..d60fb1d5d1966 100644 --- a/src/test/compile-fail/cross-borrow-trait.rs +++ b/src/test/compile-fail/cross-borrow-trait.rs @@ -24,4 +24,3 @@ pub fn main() { //~| expected &-ptr //~| found box } - diff --git a/src/test/compile-fail/drop-with-active-borrows-1.rs b/src/test/compile-fail/drop-with-active-borrows-1.rs index dc8deb0483345..903365fb909f5 100644 --- a/src/test/compile-fail/drop-with-active-borrows-1.rs +++ b/src/test/compile-fail/drop-with-active-borrows-1.rs @@ -16,4 +16,3 @@ fn main() { println!("{}", *s); } } - diff --git a/src/test/compile-fail/duplicate-parameter.rs b/src/test/compile-fail/duplicate-parameter.rs index 18ec55e10bb9a..7586bc61cd6d4 100644 --- a/src/test/compile-fail/duplicate-parameter.rs +++ b/src/test/compile-fail/duplicate-parameter.rs @@ -13,4 +13,3 @@ fn f(a: isize, a: isize) {} fn main() { } - diff --git a/src/test/compile-fail/duplicate-type-parameter.rs b/src/test/compile-fail/duplicate-type-parameter.rs index d535ce4a69a2d..42b67337c64e5 100644 --- a/src/test/compile-fail/duplicate-type-parameter.rs +++ b/src/test/compile-fail/duplicate-type-parameter.rs @@ -36,4 +36,3 @@ impl Qux for Option {} fn main() { } - diff --git a/src/test/compile-fail/explicit-self-lifetime-mismatch.rs b/src/test/compile-fail/explicit-self-lifetime-mismatch.rs index 92542ab3bcb81..922e58698dd75 100644 --- a/src/test/compile-fail/explicit-self-lifetime-mismatch.rs +++ b/src/test/compile-fail/explicit-self-lifetime-mismatch.rs @@ -26,4 +26,3 @@ impl<'a,'b> Foo<'a,'b> { } fn main() {} - diff --git a/src/test/compile-fail/extern-with-type-bounds.rs b/src/test/compile-fail/extern-with-type-bounds.rs index 21334e1d51375..2553bdcbb273e 100644 --- a/src/test/compile-fail/extern-with-type-bounds.rs +++ b/src/test/compile-fail/extern-with-type-bounds.rs @@ -28,4 +28,3 @@ extern "rust-intrinsic" { } fn main() {} - diff --git a/src/test/compile-fail/feature-gate-advanced-slice-features.rs b/src/test/compile-fail/feature-gate-advanced-slice-features.rs index d5841e1e77e40..a4524ccd9db08 100644 --- a/src/test/compile-fail/feature-gate-advanced-slice-features.rs +++ b/src/test/compile-fail/feature-gate-advanced-slice-features.rs @@ -16,4 +16,3 @@ fn main() { [ 1, 2, xs.. ] => {} // OK without feature gate } } - diff --git a/src/test/compile-fail/feature-gate-box-expr.rs b/src/test/compile-fail/feature-gate-box-expr.rs index 39f54be456169..8f8b035f4a96b 100644 --- a/src/test/compile-fail/feature-gate-box-expr.rs +++ b/src/test/compile-fail/feature-gate-box-expr.rs @@ -20,4 +20,3 @@ fn main() { let x = box (HEAP) 'c'; //~ ERROR box expression syntax is experimental println!("x: {}", x); } - diff --git a/src/test/compile-fail/feature-gate-start.rs b/src/test/compile-fail/feature-gate-start.rs index 6a9acf04290e4..7a0924d8adf1b 100644 --- a/src/test/compile-fail/feature-gate-start.rs +++ b/src/test/compile-fail/feature-gate-start.rs @@ -10,4 +10,3 @@ #[start] fn foo() {} //~ ERROR: a #[start] function is an experimental feature - diff --git a/src/test/compile-fail/generic-no-mangle.rs b/src/test/compile-fail/generic-no-mangle.rs index f4ead18ee168d..4163d531e870e 100644 --- a/src/test/compile-fail/generic-no-mangle.rs +++ b/src/test/compile-fail/generic-no-mangle.rs @@ -15,4 +15,3 @@ fn foo() {} //~ ERROR generic functions must be mangled #[no_mangle] extern fn foo() {} //~ ERROR generic functions must be mangled - diff --git a/src/test/compile-fail/indexing-requires-a-uint.rs b/src/test/compile-fail/indexing-requires-a-uint.rs index 901d8783d0278..3ca00fcb66ac1 100644 --- a/src/test/compile-fail/indexing-requires-a-uint.rs +++ b/src/test/compile-fail/indexing-requires-a-uint.rs @@ -23,4 +23,3 @@ fn main() { bar::(i); // i should not be re-coerced back to an isize //~^ ERROR: mismatched types } - diff --git a/src/test/compile-fail/infinite-macro-expansion.rs b/src/test/compile-fail/infinite-macro-expansion.rs index 74835f4bf22ca..14d22702db7a4 100644 --- a/src/test/compile-fail/infinite-macro-expansion.rs +++ b/src/test/compile-fail/infinite-macro-expansion.rs @@ -15,4 +15,3 @@ macro_rules! recursive { fn main() { recursive!() } - diff --git a/src/test/compile-fail/integral-indexing.rs b/src/test/compile-fail/integral-indexing.rs index e8998dd7a9d48..e2fb0fa4f2fa5 100644 --- a/src/test/compile-fail/integral-indexing.rs +++ b/src/test/compile-fail/integral-indexing.rs @@ -24,11 +24,11 @@ pub fn main() { s.as_bytes()[3_usize]; s.as_bytes()[3]; s.as_bytes()[3u8]; //~ERROR the trait `core::ops::Index` is not implemented - //~^ERROR the trait `core::ops::Index` is not implemented + //~^ ERROR the trait `core::ops::Index` is not implemented s.as_bytes()[3i8]; //~ERROR the trait `core::ops::Index` is not implemented - //~^ERROR the trait `core::ops::Index` is not implemented + //~^ ERROR the trait `core::ops::Index` is not implemented s.as_bytes()[3u32]; //~ERROR the trait `core::ops::Index` is not implemented - //~^ERROR the trait `core::ops::Index` is not implemented + //~^ ERROR the trait `core::ops::Index` is not implemented s.as_bytes()[3i32]; //~ERROR the trait `core::ops::Index` is not implemented - //~^ERROR the trait `core::ops::Index` is not implemented + //~^ ERROR the trait `core::ops::Index` is not implemented } diff --git a/src/test/compile-fail/intrinsic-return-address.rs b/src/test/compile-fail/intrinsic-return-address.rs index a80d393155539..b83f0f73436cf 100644 --- a/src/test/compile-fail/intrinsic-return-address.rs +++ b/src/test/compile-fail/intrinsic-return-address.rs @@ -27,5 +27,3 @@ unsafe fn g() -> isize { } fn main() {} - - diff --git a/src/test/compile-fail/issue-10536.rs b/src/test/compile-fail/issue-10536.rs index 370a6228db6ac..3b0ea55cfa9c1 100644 --- a/src/test/compile-fail/issue-10536.rs +++ b/src/test/compile-fail/issue-10536.rs @@ -29,4 +29,3 @@ pub fn main() { // least throw a conventional error. assert!({one! two}); } - diff --git a/src/test/compile-fail/issue-11192.rs b/src/test/compile-fail/issue-11192.rs index 7313d357ffc1a..7d8a1528aba36 100644 --- a/src/test/compile-fail/issue-11192.rs +++ b/src/test/compile-fail/issue-11192.rs @@ -30,4 +30,3 @@ fn main() { test(&*ptr); //~^ ERROR: cannot borrow `*ptr` as immutable } - diff --git a/src/test/compile-fail/issue-11593.rs b/src/test/compile-fail/issue-11593.rs index ecc584d81b0e1..2749438433d16 100644 --- a/src/test/compile-fail/issue-11593.rs +++ b/src/test/compile-fail/issue-11593.rs @@ -18,4 +18,3 @@ impl private_trait_xc::Foo for Bar {} //~^ ERROR: trait `Foo` is private fn main() {} - diff --git a/src/test/compile-fail/issue-11844.rs b/src/test/compile-fail/issue-11844.rs index 560cbe1b8a87f..a6dbe954ec0ac 100644 --- a/src/test/compile-fail/issue-11844.rs +++ b/src/test/compile-fail/issue-11844.rs @@ -18,4 +18,3 @@ fn main() { None => panic!() } } - diff --git a/src/test/compile-fail/issue-12041.rs b/src/test/compile-fail/issue-12041.rs index 735f529277c36..f0f4bf5ca71bb 100644 --- a/src/test/compile-fail/issue-12041.rs +++ b/src/test/compile-fail/issue-12041.rs @@ -21,4 +21,3 @@ fn main() { } }); } - diff --git a/src/test/compile-fail/issue-12612.rs b/src/test/compile-fail/issue-12612.rs index 0550472dabb80..41cd386300138 100644 --- a/src/test/compile-fail/issue-12612.rs +++ b/src/test/compile-fail/issue-12612.rs @@ -20,4 +20,3 @@ mod test { } fn main() {} - diff --git a/src/test/compile-fail/issue-13407.rs b/src/test/compile-fail/issue-13407.rs new file mode 100644 index 0000000000000..f845eba406041 --- /dev/null +++ b/src/test/compile-fail/issue-13407.rs @@ -0,0 +1,19 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +mod A { + struct C; +} + +fn main() { + A::C = 1; + //~^ ERROR: illegal left-hand side expression + //~| ERROR: mismatched types +} diff --git a/src/test/compile-fail/issue-13446.rs b/src/test/compile-fail/issue-13446.rs index a0a7660428d41..53d1486288984 100644 --- a/src/test/compile-fail/issue-13446.rs +++ b/src/test/compile-fail/issue-13446.rs @@ -16,4 +16,3 @@ static VEC: [u32; 256] = vec!(); fn main() {} - diff --git a/src/test/compile-fail/issue-14092.rs b/src/test/compile-fail/issue-14092.rs index 0ab37a888267f..c87dcb8ae79b2 100644 --- a/src/test/compile-fail/issue-14092.rs +++ b/src/test/compile-fail/issue-14092.rs @@ -11,4 +11,3 @@ fn fn1(0: Box) {} //~ ERROR: wrong number of type arguments: expected 1, found 0 fn main() {} - diff --git a/src/test/compile-fail/issue-16149.rs b/src/test/compile-fail/issue-16149.rs index a924cc9f9bbd5..4954c95fcd1f2 100644 --- a/src/test/compile-fail/issue-16149.rs +++ b/src/test/compile-fail/issue-16149.rs @@ -19,4 +19,3 @@ fn main() { _ => false }; } - diff --git a/src/test/compile-fail/issue-16338.rs b/src/test/compile-fail/issue-16338.rs index ba936561ae53d..ba369734daa47 100644 --- a/src/test/compile-fail/issue-16338.rs +++ b/src/test/compile-fail/issue-16338.rs @@ -18,4 +18,3 @@ fn main() { //~| expected &-ptr //~| found struct `core::raw::Slice` } - diff --git a/src/test/compile-fail/issue-16725.rs b/src/test/compile-fail/issue-16725.rs index 218e9dba065b9..67fcd820429ce 100644 --- a/src/test/compile-fail/issue-16725.rs +++ b/src/test/compile-fail/issue-16725.rs @@ -16,4 +16,3 @@ fn main() { unsafe { foo::bar(); } //~^ ERROR: function `bar` is private } - diff --git a/src/test/compile-fail/issue-16922.rs b/src/test/compile-fail/issue-16922.rs new file mode 100644 index 0000000000000..b525d5f64fc9a --- /dev/null +++ b/src/test/compile-fail/issue-16922.rs @@ -0,0 +1,20 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::any::Any; + +fn foo(value: &T) -> Box { + Box::new(value) as Box + //~^ ERROR: cannot infer an appropriate lifetime +} + +fn main() { + let _ = foo(&5); +} diff --git a/src/test/compile-fail/issue-17718-const-bad-values.rs b/src/test/compile-fail/issue-17718-const-bad-values.rs index 2347d3f3d5c0a..6ee869d65a8f2 100644 --- a/src/test/compile-fail/issue-17718-const-bad-values.rs +++ b/src/test/compile-fail/issue-17718-const-bad-values.rs @@ -17,4 +17,3 @@ const C2: &'static mut usize = &mut S; //~^^ ERROR: references in constants may only refer to immutable values fn main() {} - diff --git a/src/test/compile-fail/issue-18919.rs b/src/test/compile-fail/issue-18919.rs new file mode 100644 index 0000000000000..8c2c52e6fad41 --- /dev/null +++ b/src/test/compile-fail/issue-18919.rs @@ -0,0 +1,17 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +type FuncType<'f> = Fn(&isize) -> isize + 'f; + +fn ho_func(f: Option) { + //~^ ERROR: the trait `core::marker::Sized` is not implemented for the type +} + +fn main() {} diff --git a/src/test/compile-fail/issue-19982.rs b/src/test/compile-fail/issue-19982.rs new file mode 100644 index 0000000000000..9dbca997341fc --- /dev/null +++ b/src/test/compile-fail/issue-19982.rs @@ -0,0 +1,17 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(unboxed_closures)] + +struct Foo; + +impl Fn<(&(),)> for Foo { } //~ ERROR missing lifetime specifier + +fn main() {} diff --git a/src/test/compile-fail/issue-20225.rs b/src/test/compile-fail/issue-20225.rs new file mode 100644 index 0000000000000..e4bedbbb7e1e5 --- /dev/null +++ b/src/test/compile-fail/issue-20225.rs @@ -0,0 +1,22 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(unboxed_closures)] + +struct Foo; + +impl<'a, T> Fn<(&'a T,)> for Foo { + type Output = (); + + extern "rust-call" fn call(&self, (_,): (T,)) {} + //~^ ERROR: has an incompatible type for trait: expected &-ptr +} + +fn main() {} diff --git a/src/test/compile-fail/issue-20261.rs b/src/test/compile-fail/issue-20261.rs new file mode 100644 index 0000000000000..33e00f9a823ca --- /dev/null +++ b/src/test/compile-fail/issue-20261.rs @@ -0,0 +1,17 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + for (ref i,) in [].iter() { //~ ERROR: type mismatch resolving + i.clone(); + //~^ ERROR: the type of this value must be known in this context + //~| ERROR: reached the recursion limit while auto-dereferencing + } +} diff --git a/src/test/compile-fail/issue-20714.rs b/src/test/compile-fail/issue-20714.rs new file mode 100644 index 0000000000000..cb322f00723d2 --- /dev/null +++ b/src/test/compile-fail/issue-20714.rs @@ -0,0 +1,15 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct G; + +fn main() { + let g = G(); //~ ERROR: expected function, found `G` +} diff --git a/src/test/compile-fail/issue-3008-2.rs b/src/test/compile-fail/issue-3008-2.rs index 1e8f81a05e7f9..c744dff0c04d4 100644 --- a/src/test/compile-fail/issue-3008-2.rs +++ b/src/test/compile-fail/issue-3008-2.rs @@ -15,4 +15,3 @@ struct bar { x: bar } fn main() { } - diff --git a/src/test/compile-fail/issue-3907.rs b/src/test/compile-fail/issue-3907.rs index 001de796b4ad7..a3d90a00d038e 100644 --- a/src/test/compile-fail/issue-3907.rs +++ b/src/test/compile-fail/issue-3907.rs @@ -28,4 +28,3 @@ fn main() { }; s.bar(); } - diff --git a/src/test/compile-fail/issue-5844.rs b/src/test/compile-fail/issue-5844.rs index 6c85a97f7f57f..02e5b9b092197 100644 --- a/src/test/compile-fail/issue-5844.rs +++ b/src/test/compile-fail/issue-5844.rs @@ -15,4 +15,3 @@ extern crate issue_5844_aux; fn main () { issue_5844_aux::rand(); //~ ERROR: requires unsafe } - diff --git a/src/test/compile-fail/issue-7607-1.rs b/src/test/compile-fail/issue-7607-1.rs index 4ac901776099d..40c3d96bc9a11 100644 --- a/src/test/compile-fail/issue-7607-1.rs +++ b/src/test/compile-fail/issue-7607-1.rs @@ -17,4 +17,3 @@ impl Fo { //~ ERROR use of undeclared type name `Fo` } fn main() {} - diff --git a/src/test/compile-fail/issue-8767.rs b/src/test/compile-fail/issue-8767.rs index 2ef0a75f77b5a..9abd8c9e3fcda 100644 --- a/src/test/compile-fail/issue-8767.rs +++ b/src/test/compile-fail/issue-8767.rs @@ -15,4 +15,3 @@ impl B { //~ ERROR use of undeclared type name `B` fn main() { } - diff --git a/src/test/compile-fail/kindck-copy.rs b/src/test/compile-fail/kindck-copy.rs index 74e372e41eb0a..d5bfe3d16925c 100644 --- a/src/test/compile-fail/kindck-copy.rs +++ b/src/test/compile-fail/kindck-copy.rs @@ -80,4 +80,3 @@ fn test<'a,T,U:Copy>(_: &'a isize) { pub fn main() { } - diff --git a/src/test/compile-fail/kindck-nonsendable-1.rs b/src/test/compile-fail/kindck-nonsendable-1.rs index c370aa4b8fb1a..bf2a209c4c48e 100644 --- a/src/test/compile-fail/kindck-nonsendable-1.rs +++ b/src/test/compile-fail/kindck-nonsendable-1.rs @@ -20,4 +20,3 @@ fn main() { bar(move|| foo(x)); //~^ ERROR `core::marker::Send` is not implemented } - diff --git a/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs b/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs index 55cce01633540..1fa7284f6b5dc 100644 --- a/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs +++ b/src/test/compile-fail/lifetime-elision-return-type-requires-explicit-lifetime.rs @@ -37,4 +37,3 @@ fn i(_x: isize) -> &isize { //~ ERROR missing lifetime specifier } fn main() {} - diff --git a/src/test/compile-fail/linkage3.rs b/src/test/compile-fail/linkage3.rs index c75c7002e5e0f..8343f718902dc 100644 --- a/src/test/compile-fail/linkage3.rs +++ b/src/test/compile-fail/linkage3.rs @@ -18,4 +18,3 @@ extern { fn main() { println!("{:?}", foo); } - diff --git a/src/test/compile-fail/lint-dead-code-3.rs b/src/test/compile-fail/lint-dead-code-3.rs index f60c39ba02085..13ee3f163616e 100644 --- a/src/test/compile-fail/lint-dead-code-3.rs +++ b/src/test/compile-fail/lint-dead-code-3.rs @@ -19,7 +19,7 @@ extern crate libc; pub use extern_foo as x; extern { - fn extern_foo(); + pub fn extern_foo(); } struct Foo; //~ ERROR: struct is never used diff --git a/src/test/compile-fail/lint-exceeding-bitshifts.rs b/src/test/compile-fail/lint-exceeding-bitshifts.rs index 345e56e2e5800..171dedd5b2e58 100644 --- a/src/test/compile-fail/lint-exceeding-bitshifts.rs +++ b/src/test/compile-fail/lint-exceeding-bitshifts.rs @@ -60,4 +60,3 @@ fn main() { let n = 1_isize << std::isize::BITS; //~ ERROR: bitshift exceeds the type's number of bits let n = 1_usize << std::usize::BITS; //~ ERROR: bitshift exceeds the type's number of bits } - diff --git a/src/test/compile-fail/lint-stability3.rs b/src/test/compile-fail/lint-stability3.rs index 88a93134b47c0..44a36f215f3d4 100644 --- a/src/test/compile-fail/lint-stability3.rs +++ b/src/test/compile-fail/lint-stability3.rs @@ -22,4 +22,3 @@ use lint_stability::*; fn main() { macro_test_arg_nested!(deprecated_text); } - diff --git a/src/test/compile-fail/lint-uppercase-variables.rs b/src/test/compile-fail/lint-uppercase-variables.rs index a4f46cbd1874f..517be0eb8acd9 100644 --- a/src/test/compile-fail/lint-uppercase-variables.rs +++ b/src/test/compile-fail/lint-uppercase-variables.rs @@ -40,4 +40,3 @@ fn main() { let _ = Something { X: 0 }; } - diff --git a/src/test/compile-fail/macro-inner-attributes.rs b/src/test/compile-fail/macro-inner-attributes.rs index e76eaea365ea6..abf0ed420e7a2 100644 --- a/src/test/compile-fail/macro-inner-attributes.rs +++ b/src/test/compile-fail/macro-inner-attributes.rs @@ -29,4 +29,3 @@ fn main() { //~^^ ERROR unresolved name `a::bar` b::bar(); } - diff --git a/src/test/compile-fail/macro-outer-attributes.rs b/src/test/compile-fail/macro-outer-attributes.rs index cff01f36f3ad7..0469a9d1cc859 100644 --- a/src/test/compile-fail/macro-outer-attributes.rs +++ b/src/test/compile-fail/macro-outer-attributes.rs @@ -28,4 +28,3 @@ fn main() { a::bar(); //~ ERROR unresolved name `a::bar` b::bar(); } - diff --git a/src/test/compile-fail/manual-link-bad-form.rs b/src/test/compile-fail/manual-link-bad-form.rs index bd2a3eba0b5b8..c251ce6a3c834 100644 --- a/src/test/compile-fail/manual-link-bad-form.rs +++ b/src/test/compile-fail/manual-link-bad-form.rs @@ -13,5 +13,3 @@ fn main() { } - - diff --git a/src/test/compile-fail/manual-link-bad-kind.rs b/src/test/compile-fail/manual-link-bad-kind.rs index 4614440ddafd5..5ab073c33bcb3 100644 --- a/src/test/compile-fail/manual-link-bad-kind.rs +++ b/src/test/compile-fail/manual-link-bad-kind.rs @@ -13,4 +13,3 @@ fn main() { } - diff --git a/src/test/compile-fail/method-ambig-two-traits-cross-crate.rs b/src/test/compile-fail/method-ambig-two-traits-cross-crate.rs index 981c4c6f40d57..c1d4551fd9ec4 100644 --- a/src/test/compile-fail/method-ambig-two-traits-cross-crate.rs +++ b/src/test/compile-fail/method-ambig-two-traits-cross-crate.rs @@ -19,4 +19,3 @@ trait me2 { } impl me2 for usize { fn me(&self) -> usize { *self } } fn main() { 1_usize.me(); } //~ ERROR E0034 - diff --git a/src/test/compile-fail/method-missing-call.rs b/src/test/compile-fail/method-missing-call.rs index 6616dcc8e1b03..b13d4250ee958 100644 --- a/src/test/compile-fail/method-missing-call.rs +++ b/src/test/compile-fail/method-missing-call.rs @@ -40,4 +40,3 @@ fn main() { .filter_map; //~ ERROR attempted to take value of method `filter_map` on type //~^ HELP maybe a `()` to call it is missing } - diff --git a/src/test/compile-fail/mut-cross-borrowing.rs b/src/test/compile-fail/mut-cross-borrowing.rs index 6829cd574e1b0..73982fa2811a0 100644 --- a/src/test/compile-fail/mut-cross-borrowing.rs +++ b/src/test/compile-fail/mut-cross-borrowing.rs @@ -16,4 +16,3 @@ fn main() { let mut x: Box<_> = box 3; f(x) //~ ERROR mismatched types } - diff --git a/src/test/compile-fail/object-safety-by-value-self-use.rs b/src/test/compile-fail/object-safety-by-value-self-use.rs index 1b20a902c9d52..36356cb7d527e 100644 --- a/src/test/compile-fail/object-safety-by-value-self-use.rs +++ b/src/test/compile-fail/object-safety-by-value-self-use.rs @@ -26,4 +26,3 @@ fn use_bar(t: Box) { } fn main() { } - diff --git a/src/test/compile-fail/opt-in-copy.rs b/src/test/compile-fail/opt-in-copy.rs index 56f71c844ac29..bc18b52a0c1c9 100644 --- a/src/test/compile-fail/opt-in-copy.rs +++ b/src/test/compile-fail/opt-in-copy.rs @@ -30,4 +30,3 @@ impl Copy for IWantToCopyThisToo {} //~^ ERROR the trait `Copy` may not be implemented for this type fn main() {} - diff --git a/src/test/compile-fail/overloaded-calls-nontuple.rs b/src/test/compile-fail/overloaded-calls-nontuple.rs index 41ecf7146138d..c4019fa22097a 100644 --- a/src/test/compile-fail/overloaded-calls-nontuple.rs +++ b/src/test/compile-fail/overloaded-calls-nontuple.rs @@ -31,4 +31,3 @@ fn main() { }; drop(s(3)) //~ ERROR cannot use call notation } - diff --git a/src/test/compile-fail/pattern-bindings-after-at.rs b/src/test/compile-fail/pattern-bindings-after-at.rs index 80544099329cf..da2a97b0ca8ab 100644 --- a/src/test/compile-fail/pattern-bindings-after-at.rs +++ b/src/test/compile-fail/pattern-bindings-after-at.rs @@ -23,4 +23,3 @@ fn main() { _ => () } } - diff --git a/src/test/compile-fail/pattern-ident-path-generics.rs b/src/test/compile-fail/pattern-ident-path-generics.rs index 58288fa484221..0b7886842b49e 100644 --- a/src/test/compile-fail/pattern-ident-path-generics.rs +++ b/src/test/compile-fail/pattern-ident-path-generics.rs @@ -14,4 +14,3 @@ fn main() { Some(_) => {} } } - diff --git a/src/test/compile-fail/privacy1.rs b/src/test/compile-fail/privacy1.rs index 1ae79adbad76a..67dccb4c93e1a 100644 --- a/src/test/compile-fail/privacy1.rs +++ b/src/test/compile-fail/privacy1.rs @@ -27,10 +27,6 @@ mod bar { // can't publicly re-export private items pub use self::baz::{foo, bar}; - //~^ ERROR: function `bar` is private - - pub use self::private::ppriv; - //~^ ERROR: function `ppriv` is private pub struct A; impl A { @@ -61,10 +57,8 @@ mod bar { fn bar2(&self) {} } - // both of these are re-exported by `bar`, but only one should be - // validly re-exported pub fn foo() {} - fn bar() {} + pub fn bar() {} } extern { @@ -92,10 +86,6 @@ mod bar { pub fn gpub() {} fn gpriv() {} } - - mod private { - fn ppriv() {} - } } pub fn gpub() {} @@ -142,13 +132,13 @@ mod foo { ::bar::baz::foo(); //~ ERROR: function `foo` is inaccessible //~^ NOTE: module `baz` is private - ::bar::baz::bar(); //~ ERROR: function `bar` is private + ::bar::baz::bar(); //~ ERROR: function `bar` is inaccessible } fn test2() { use bar::baz::{foo, bar}; //~^ ERROR: function `foo` is inaccessible - //~^^ ERROR: function `bar` is private + //~^^ ERROR: function `bar` is inaccessible foo(); bar(); } diff --git a/src/test/compile-fail/region-bound-on-closure-outlives-call.rs b/src/test/compile-fail/region-bound-on-closure-outlives-call.rs index 9f35c636b4526..b73c283fa515e 100644 --- a/src/test/compile-fail/region-bound-on-closure-outlives-call.rs +++ b/src/test/compile-fail/region-bound-on-closure-outlives-call.rs @@ -13,4 +13,3 @@ fn call_rec(mut f: F) -> usize where F: FnMut(usize) -> usize { } fn main() {} - diff --git a/src/test/compile-fail/region-object-lifetime-1.rs b/src/test/compile-fail/region-object-lifetime-1.rs index 2095fb903b844..1e615be9d6acc 100644 --- a/src/test/compile-fail/region-object-lifetime-1.rs +++ b/src/test/compile-fail/region-object-lifetime-1.rs @@ -26,4 +26,3 @@ fn borrowed_receiver_same_lifetime<'a>(x: &'a Foo) -> &'a () { #[rustc_error] fn main() {} //~ ERROR compilation successful - diff --git a/src/test/compile-fail/region-object-lifetime-2.rs b/src/test/compile-fail/region-object-lifetime-2.rs index f9bf4e257b363..e011b8f56972b 100644 --- a/src/test/compile-fail/region-object-lifetime-2.rs +++ b/src/test/compile-fail/region-object-lifetime-2.rs @@ -21,4 +21,3 @@ fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { } fn main() {} - diff --git a/src/test/compile-fail/region-object-lifetime-3.rs b/src/test/compile-fail/region-object-lifetime-3.rs index 097053276c7fb..84dd97643a107 100644 --- a/src/test/compile-fail/region-object-lifetime-3.rs +++ b/src/test/compile-fail/region-object-lifetime-3.rs @@ -26,4 +26,3 @@ fn borrowed_receiver_related_lifetimes<'a,'b>(x: &'a (Foo+'b)) -> &'a () { #[rustc_error] fn main() {} //~ ERROR compilation successful - diff --git a/src/test/compile-fail/region-object-lifetime-4.rs b/src/test/compile-fail/region-object-lifetime-4.rs index fe0ff8dc3fe5d..0a68e7f1076ca 100644 --- a/src/test/compile-fail/region-object-lifetime-4.rs +++ b/src/test/compile-fail/region-object-lifetime-4.rs @@ -23,4 +23,3 @@ fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { } fn main() {} - diff --git a/src/test/compile-fail/region-object-lifetime-5.rs b/src/test/compile-fail/region-object-lifetime-5.rs index f07f753d82529..26aad0e33b1b4 100644 --- a/src/test/compile-fail/region-object-lifetime-5.rs +++ b/src/test/compile-fail/region-object-lifetime-5.rs @@ -22,4 +22,3 @@ fn owned_receiver(x: Box) -> &'static () { } fn main() {} - diff --git a/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs b/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs index 9418156ffcd08..5db9a01c01286 100644 --- a/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs +++ b/src/test/compile-fail/regionck-unboxed-closure-lifetimes.rs @@ -20,4 +20,3 @@ fn main() { f = move |a: isize, b: isize| { a + b + *c_ref }; } } - diff --git a/src/test/compile-fail/regions-close-associated-type-into-object.rs b/src/test/compile-fail/regions-close-associated-type-into-object.rs index 72a024e563c6f..f80b0ffa5aadf 100644 --- a/src/test/compile-fail/regions-close-associated-type-into-object.rs +++ b/src/test/compile-fail/regions-close-associated-type-into-object.rs @@ -84,4 +84,3 @@ fn meh1<'a, T: Iter>(v: &'a T) -> Box } fn main() {} - diff --git a/src/test/compile-fail/regions-close-object-into-object-1.rs b/src/test/compile-fail/regions-close-object-into-object-1.rs index 7bbce7dad530d..4c831a2b65953 100644 --- a/src/test/compile-fail/regions-close-object-into-object-1.rs +++ b/src/test/compile-fail/regions-close-object-into-object-1.rs @@ -25,4 +25,3 @@ fn f<'a, T:'static, U>(v: Box+'static>) -> Box { } fn main() {} - diff --git a/src/test/compile-fail/regions-close-object-into-object-3.rs b/src/test/compile-fail/regions-close-object-into-object-3.rs index e22d0c7d0a4f5..b723efff3c902 100644 --- a/src/test/compile-fail/regions-close-object-into-object-3.rs +++ b/src/test/compile-fail/regions-close-object-into-object-3.rs @@ -24,4 +24,3 @@ fn h<'a, T, U>(v: Box+'static>) -> Box { } fn main() {} - diff --git a/src/test/compile-fail/regions-close-object-into-object-4.rs b/src/test/compile-fail/regions-close-object-into-object-4.rs index 147a575d38cac..9b311588bb1ea 100644 --- a/src/test/compile-fail/regions-close-object-into-object-4.rs +++ b/src/test/compile-fail/regions-close-object-into-object-4.rs @@ -23,4 +23,3 @@ fn i<'a, T, U>(v: Box+'a>) -> Box { } fn main() {} - diff --git a/src/test/compile-fail/regions-close-object-into-object-5.rs b/src/test/compile-fail/regions-close-object-into-object-5.rs index bdc52eca2cb2d..f3b5ccabe79eb 100644 --- a/src/test/compile-fail/regions-close-object-into-object-5.rs +++ b/src/test/compile-fail/regions-close-object-into-object-5.rs @@ -27,4 +27,3 @@ fn f<'a, T, U>(v: Box+'static>) -> Box { } fn main() {} - diff --git a/src/test/compile-fail/regions-close-param-into-object.rs b/src/test/compile-fail/regions-close-param-into-object.rs index eebf93bc89377..7324d4a4a0ed6 100644 --- a/src/test/compile-fail/regions-close-param-into-object.rs +++ b/src/test/compile-fail/regions-close-param-into-object.rs @@ -37,4 +37,3 @@ fn p4<'a,T>(v: Box) -> Box } fn main() {} - diff --git a/src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs b/src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs index 8673d95de1b17..af3ee7f353731 100644 --- a/src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs +++ b/src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs @@ -12,4 +12,3 @@ extern crate std; //~^ ERROR an external crate named `std` has already been imported fn main(){} - diff --git a/src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs b/src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs index f27b11d5411c9..0c601a81178b3 100644 --- a/src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs +++ b/src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs @@ -12,4 +12,3 @@ use std::slice as std; //~ ERROR import `std` conflicts with imported crate fn main() { } - diff --git a/src/test/compile-fail/resolve-conflict-import-vs-import.rs b/src/test/compile-fail/resolve-conflict-import-vs-import.rs index beb4b74f3264b..10afe82f2ef0f 100644 --- a/src/test/compile-fail/resolve-conflict-import-vs-import.rs +++ b/src/test/compile-fail/resolve-conflict-import-vs-import.rs @@ -14,4 +14,3 @@ use std::mem::transmute; fn main() { } - diff --git a/src/test/compile-fail/resolve-conflict-item-vs-extern-crate.rs b/src/test/compile-fail/resolve-conflict-item-vs-extern-crate.rs index 9d40196d4ac6b..e685353592f52 100644 --- a/src/test/compile-fail/resolve-conflict-item-vs-extern-crate.rs +++ b/src/test/compile-fail/resolve-conflict-item-vs-extern-crate.rs @@ -12,4 +12,3 @@ fn std() {} //~ ERROR the name `std` conflicts with an external crate fn main() { } - diff --git a/src/test/compile-fail/resolve-conflict-item-vs-import.rs b/src/test/compile-fail/resolve-conflict-item-vs-import.rs index 96800918351c1..1edf815ecaeca 100644 --- a/src/test/compile-fail/resolve-conflict-item-vs-import.rs +++ b/src/test/compile-fail/resolve-conflict-item-vs-import.rs @@ -15,4 +15,3 @@ fn transmute() {} fn main() { } - diff --git a/src/test/compile-fail/resolve-unknown-trait.rs b/src/test/compile-fail/resolve-unknown-trait.rs index 3983a84f6ad17..fd4dce51fc8db 100644 --- a/src/test/compile-fail/resolve-unknown-trait.rs +++ b/src/test/compile-fail/resolve-unknown-trait.rs @@ -17,4 +17,3 @@ impl SomeNonExistentTrait for isize {} fn f() {} //~^ ERROR use of undeclared trait name `SomeNonExistentTrait` - diff --git a/src/test/compile-fail/shadowing-in-the-same-pattern.rs b/src/test/compile-fail/shadowing-in-the-same-pattern.rs index c29534128ae45..e847d3324169c 100644 --- a/src/test/compile-fail/shadowing-in-the-same-pattern.rs +++ b/src/test/compile-fail/shadowing-in-the-same-pattern.rs @@ -15,4 +15,3 @@ fn f((a, a): (isize, isize)) {} //~ ERROR identifier `a` is bound more than once fn main() { let (a, a) = (1, 1); //~ ERROR identifier `a` is bound more than once } - diff --git a/src/test/compile-fail/static-array-across-crate.rs b/src/test/compile-fail/static-array-across-crate.rs new file mode 100644 index 0000000000000..422cf630429ca --- /dev/null +++ b/src/test/compile-fail/static-array-across-crate.rs @@ -0,0 +1,20 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:pub_static_array.rs + +extern crate "pub_static_array" as array; + +use array::ARRAY; + +static X: &'static u8 = &ARRAY[0]; +//~^ ERROR: cannot refer to the interior of another static, use a constant + +pub fn main() {} diff --git a/src/test/compile-fail/struct-variant-privacy-xc.rs b/src/test/compile-fail/struct-variant-privacy-xc.rs index c58273361ad0b..b8be7d0cdc20a 100644 --- a/src/test/compile-fail/struct-variant-privacy-xc.rs +++ b/src/test/compile-fail/struct-variant-privacy-xc.rs @@ -18,4 +18,3 @@ fn f(b: struct_variant_privacy::Bar) { //~ ERROR enum `Bar` is private } fn main() {} - diff --git a/src/test/compile-fail/structure-constructor-type-mismatch.rs b/src/test/compile-fail/structure-constructor-type-mismatch.rs index ea6d63ca540ef..02c4f3d5d5268 100644 --- a/src/test/compile-fail/structure-constructor-type-mismatch.rs +++ b/src/test/compile-fail/structure-constructor-type-mismatch.rs @@ -62,4 +62,3 @@ fn main() { y: 10, }; } - diff --git a/src/test/compile-fail/trait-as-struct-constructor.rs b/src/test/compile-fail/trait-as-struct-constructor.rs index fff144140947a..1fd711ca4fb2c 100644 --- a/src/test/compile-fail/trait-as-struct-constructor.rs +++ b/src/test/compile-fail/trait-as-struct-constructor.rs @@ -14,4 +14,3 @@ fn main() { TraitNotAStruct{ value: 0 }; //~^ ERROR: use of trait `TraitNotAStruct` as a struct constructor [E0159] } - diff --git a/src/test/compile-fail/trait-bounds-impl-comparison-2.rs b/src/test/compile-fail/trait-bounds-impl-comparison-2.rs index 284c4fac953f2..217540415a7dd 100644 --- a/src/test/compile-fail/trait-bounds-impl-comparison-2.rs +++ b/src/test/compile-fail/trait-bounds-impl-comparison-2.rs @@ -32,4 +32,3 @@ struct ZipIterator { } fn main() {} - diff --git a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs index 448b186f6a5c6..e126a3040e992 100644 --- a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs +++ b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs @@ -15,7 +15,7 @@ trait Foo { // This should emit the less confusing error, not the more confusing one. fn foo(_x: Foo + Send) { - //~^ERROR the trait `core::marker::Sized` is not implemented + //~^ ERROR the trait `core::marker::Sized` is not implemented } fn main() { } diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs index df44e847c50fd..d39b7e15edc34 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs @@ -25,4 +25,3 @@ fn main() { let baz: Foo = panic!(); //~^ ERROR not implemented } - diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs index 18871d0d386d7..d93c9bafaef27 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs @@ -23,4 +23,3 @@ static X: Foo = Foo { fn main() { } - diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs index ded75aa1d85e4..5f95a7ca6e204 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs @@ -22,4 +22,3 @@ fn kaboom(y: Bar) {} fn main() { } - diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs index 8a9732de7fbd7..840787022e65c 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs @@ -23,4 +23,3 @@ fn main() { //~^ ERROR not implemented let _ = bar; } - diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs index 8dfdb2f205d6f..ce0a7d3bb36cf 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs @@ -66,4 +66,3 @@ impl PolyTrait> for Struct { fn main() { } - diff --git a/src/test/compile-fail/trait-coercion-generic-regions.rs b/src/test/compile-fail/trait-coercion-generic-regions.rs index bbe256d1c8fd2..9ba017e150e61 100644 --- a/src/test/compile-fail/trait-coercion-generic-regions.rs +++ b/src/test/compile-fail/trait-coercion-generic-regions.rs @@ -28,4 +28,3 @@ fn main() { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let s: Box> = Box::new(Struct { person: person }); } - diff --git a/src/test/compile-fail/transmute-different-sizes.rs b/src/test/compile-fail/transmute-different-sizes.rs index 5c61212a7f5a5..918589b8fd3ac 100644 --- a/src/test/compile-fail/transmute-different-sizes.rs +++ b/src/test/compile-fail/transmute-different-sizes.rs @@ -25,5 +25,3 @@ unsafe fn g(x: &T) { } fn main() {} - - diff --git a/src/test/compile-fail/type-params-in-different-spaces-2.rs b/src/test/compile-fail/type-params-in-different-spaces-2.rs index 3a4cc9e874e7d..71e9113603a60 100644 --- a/src/test/compile-fail/type-params-in-different-spaces-2.rs +++ b/src/test/compile-fail/type-params-in-different-spaces-2.rs @@ -29,4 +29,3 @@ trait B: Tr { fn main() { } - diff --git a/src/test/compile-fail/type-params-in-different-spaces-3.rs b/src/test/compile-fail/type-params-in-different-spaces-3.rs index c113e1b781521..3ad1e9ab538db 100644 --- a/src/test/compile-fail/type-params-in-different-spaces-3.rs +++ b/src/test/compile-fail/type-params-in-different-spaces-3.rs @@ -15,4 +15,3 @@ trait Tr : Sized { } fn main() {} - diff --git a/src/test/compile-fail/ufcs-explicit-self-bad.rs b/src/test/compile-fail/ufcs-explicit-self-bad.rs index cbcf31b5b7edb..5d2b5fa52db41 100644 --- a/src/test/compile-fail/ufcs-explicit-self-bad.rs +++ b/src/test/compile-fail/ufcs-explicit-self-bad.rs @@ -63,4 +63,3 @@ fn main() { }; println!("{} {}", bar.foo(2), bar.bar(2)); } - diff --git a/src/test/compile-fail/ufcs-qpath-self-mismatch.rs b/src/test/compile-fail/ufcs-qpath-self-mismatch.rs index 868c1eae4a9e1..8e60064beca17 100644 --- a/src/test/compile-fail/ufcs-qpath-self-mismatch.rs +++ b/src/test/compile-fail/ufcs-qpath-self-mismatch.rs @@ -18,4 +18,3 @@ fn main() { >::add(1, 2u32); //~^ ERROR mismatched types } - diff --git a/src/test/compile-fail/unboxed-closure-sugar-nonexistent-trait.rs b/src/test/compile-fail/unboxed-closure-sugar-nonexistent-trait.rs index f28bf7acadd37..b195a932acaa6 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-nonexistent-trait.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-nonexistent-trait.rs @@ -17,4 +17,3 @@ type Typedef = isize; fn g isize>(x: F) {} //~ ERROR `Typedef` is not a trait fn main() {} - diff --git a/src/test/compile-fail/unboxed-closure-sugar-not-used-on-fn.rs b/src/test/compile-fail/unboxed-closure-sugar-not-used-on-fn.rs index 1f0d5aae36db5..55156e28cd703 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-not-used-on-fn.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-not-used-on-fn.rs @@ -20,4 +20,3 @@ fn bar2(x: &T) where T: Fn<()> { } fn main() { } - diff --git a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs index a3991a87b78f8..1e36c47c0973b 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs @@ -22,4 +22,3 @@ fn bar() { } fn main() { } - diff --git a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs index ad85cdcaa03a1..f50d91a4ddd9f 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs @@ -20,4 +20,3 @@ fn foo(b: Box) { } fn main() { } - diff --git a/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs b/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs index 5810ffcf21ab6..e6e18d996b9e2 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-wrong-trait.rs @@ -17,4 +17,3 @@ fn f isize>(x: F) {} //~| ERROR no associated type `Output` fn main() {} - diff --git a/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs b/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs index bbafd5109edff..92e6affa4c202 100644 --- a/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs +++ b/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs @@ -35,4 +35,3 @@ fn main() { //~^ ERROR not implemented //~| ERROR not implemented } - diff --git a/src/test/compile-fail/unboxed-closures-infer-explicit-call-too-early.rs b/src/test/compile-fail/unboxed-closures-infer-explicit-call-too-early.rs index f993b8fa8c4d1..226b516e09db2 100644 --- a/src/test/compile-fail/unboxed-closures-infer-explicit-call-too-early.rs +++ b/src/test/compile-fail/unboxed-closures-infer-explicit-call-too-early.rs @@ -15,4 +15,3 @@ fn main() { let () = zero.call_mut(()); //~^ ERROR we have not yet inferred what kind of closure it is } - diff --git a/src/test/compile-fail/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs b/src/test/compile-fail/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs index afbc141b5d246..7c5ea03159656 100644 --- a/src/test/compile-fail/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs +++ b/src/test/compile-fail/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs @@ -29,4 +29,3 @@ fn main() { tick2(); //~ ERROR cannot borrow } - diff --git a/src/test/compile-fail/unboxed-closures-static-call-wrong-trait.rs b/src/test/compile-fail/unboxed-closures-static-call-wrong-trait.rs index f430e9fc75902..1a52e22419eb4 100644 --- a/src/test/compile-fail/unboxed-closures-static-call-wrong-trait.rs +++ b/src/test/compile-fail/unboxed-closures-static-call-wrong-trait.rs @@ -16,4 +16,3 @@ fn main() { let mut_ = to_fn_mut(|x| x); mut_.call((0, )); //~ ERROR does not implement any method in scope named `call` } - diff --git a/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs b/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs index c2a2e5162ace0..28e8b8db2a46b 100644 --- a/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs +++ b/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs @@ -25,4 +25,3 @@ pub fn main() { //~| ERROR type mismatch println!("{}", z); } - diff --git a/src/test/compile-fail/unboxed-closures-wrong-abi.rs b/src/test/compile-fail/unboxed-closures-wrong-abi.rs index 96619bef36fd5..40655f8a3cec4 100644 --- a/src/test/compile-fail/unboxed-closures-wrong-abi.rs +++ b/src/test/compile-fail/unboxed-closures-wrong-abi.rs @@ -35,4 +35,3 @@ fn c() { } fn main() { } - diff --git a/src/test/compile-fail/variance-issue-20533.rs b/src/test/compile-fail/variance-issue-20533.rs index e5473f12bf2d6..60690012485e2 100644 --- a/src/test/compile-fail/variance-issue-20533.rs +++ b/src/test/compile-fail/variance-issue-20533.rs @@ -51,4 +51,3 @@ fn main() { drop(x); } } - diff --git a/src/test/compile-fail/variance-trait-matching.rs b/src/test/compile-fail/variance-trait-matching.rs index d4dab5f0ed05d..ec020f1881893 100644 --- a/src/test/compile-fail/variance-trait-matching.rs +++ b/src/test/compile-fail/variance-trait-matching.rs @@ -27,4 +27,3 @@ fn f() -> &'static mut isize { } fn main() {} - diff --git a/src/test/compile-fail/vector-cast-weirdness.rs b/src/test/compile-fail/vector-cast-weirdness.rs index c5109ce473e9e..97e67cd2eae27 100644 --- a/src/test/compile-fail/vector-cast-weirdness.rs +++ b/src/test/compile-fail/vector-cast-weirdness.rs @@ -28,4 +28,3 @@ fn main() { let t1: *mut [u8; 2] = &mut x1.y as *mut _; let h1: *mut [u8; 2] = &mut x1.y as *mut [u8; 2]; } - diff --git a/src/test/compile-fail/walk-struct-literal-with.rs b/src/test/compile-fail/walk-struct-literal-with.rs index 0f3754e09e41e..10503084b9d9f 100644 --- a/src/test/compile-fail/walk-struct-literal-with.rs +++ b/src/test/compile-fail/walk-struct-literal-with.rs @@ -25,4 +25,3 @@ fn main(){ let end = Mine{other_val:1, ..start.make_string_bar()}; println!("{}", start.test); //~ ERROR use of moved value: `start.test` } - diff --git a/src/test/compile-fail/where-clauses-unsatisfied.rs b/src/test/compile-fail/where-clauses-unsatisfied.rs index 4a4a5f3193d3a..269df212489cb 100644 --- a/src/test/compile-fail/where-clauses-unsatisfied.rs +++ b/src/test/compile-fail/where-clauses-unsatisfied.rs @@ -17,4 +17,3 @@ fn main() { drop(equal(&Struct, &Struct)) //~^ ERROR the trait `core::cmp::Eq` is not implemented } - diff --git a/src/test/debuginfo/function-arg-initialization.rs b/src/test/debuginfo/function-arg-initialization.rs index 9eadf3cc19b92..7cefb6044f64f 100644 --- a/src/test/debuginfo/function-arg-initialization.rs +++ b/src/test/debuginfo/function-arg-initialization.rs @@ -330,6 +330,3 @@ fn main() { while_expr(40, 41, 42); loop_expr(43, 44, 45); } - - - diff --git a/src/test/debuginfo/generic-method-on-generic-struct.rs b/src/test/debuginfo/generic-method-on-generic-struct.rs index 8b698d900af04..07b6d745544bb 100644 --- a/src/test/debuginfo/generic-method-on-generic-struct.rs +++ b/src/test/debuginfo/generic-method-on-generic-struct.rs @@ -149,4 +149,3 @@ fn main() { } fn zzz() {()} - diff --git a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs index e097ec2adb1a7..59935e55b3337 100644 --- a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs +++ b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs @@ -20,4 +20,3 @@ fn main() { let _ = ||(); let _ = (1_usize..3).map(|_| 5); } - diff --git a/src/test/debuginfo/limited-debuginfo.rs b/src/test/debuginfo/limited-debuginfo.rs index e51842992ccd3..c140390604b94 100644 --- a/src/test/debuginfo/limited-debuginfo.rs +++ b/src/test/debuginfo/limited-debuginfo.rs @@ -54,4 +54,3 @@ fn some_function(a: int, b: int) { } fn some_other_function(a: int, b: int) -> bool { true } - diff --git a/src/test/debuginfo/method-on-enum.rs b/src/test/debuginfo/method-on-enum.rs index 638d73f0d4e3c..7172a880f4c3d 100644 --- a/src/test/debuginfo/method-on-enum.rs +++ b/src/test/debuginfo/method-on-enum.rs @@ -151,4 +151,3 @@ fn main() { } fn zzz() {()} - diff --git a/src/test/debuginfo/method-on-generic-struct.rs b/src/test/debuginfo/method-on-generic-struct.rs index 784d60eec9a1a..bf6635f833f6e 100644 --- a/src/test/debuginfo/method-on-generic-struct.rs +++ b/src/test/debuginfo/method-on-generic-struct.rs @@ -150,4 +150,3 @@ fn main() { } fn zzz() {()} - diff --git a/src/test/debuginfo/method-on-struct.rs b/src/test/debuginfo/method-on-struct.rs index a91586a6aa6be..54779e007088f 100644 --- a/src/test/debuginfo/method-on-struct.rs +++ b/src/test/debuginfo/method-on-struct.rs @@ -150,4 +150,3 @@ fn main() { } fn zzz() {()} - diff --git a/src/test/debuginfo/method-on-trait.rs b/src/test/debuginfo/method-on-trait.rs index e2c827ee5170f..7954bcae1b231 100644 --- a/src/test/debuginfo/method-on-trait.rs +++ b/src/test/debuginfo/method-on-trait.rs @@ -156,4 +156,3 @@ fn main() { } fn zzz() {()} - diff --git a/src/test/debuginfo/method-on-tuple-struct.rs b/src/test/debuginfo/method-on-tuple-struct.rs index e8bc40f1810f3..af1287066504e 100644 --- a/src/test/debuginfo/method-on-tuple-struct.rs +++ b/src/test/debuginfo/method-on-tuple-struct.rs @@ -148,4 +148,3 @@ fn main() { } fn zzz() {()} - diff --git a/src/test/debuginfo/no-debug-attribute.rs b/src/test/debuginfo/no-debug-attribute.rs index 5b2045d59dc77..f39e8ee222932 100644 --- a/src/test/debuginfo/no-debug-attribute.rs +++ b/src/test/debuginfo/no-debug-attribute.rs @@ -40,4 +40,3 @@ fn main() { function_without_debuginfo(); function_with_debuginfo(); } - diff --git a/src/test/debuginfo/recursive-struct.rs b/src/test/debuginfo/recursive-struct.rs index 25afd3514b016..fe262a7ea8da6 100644 --- a/src/test/debuginfo/recursive-struct.rs +++ b/src/test/debuginfo/recursive-struct.rs @@ -219,4 +219,3 @@ fn main() { } fn zzz() {()} - diff --git a/src/test/debuginfo/self-in-default-method.rs b/src/test/debuginfo/self-in-default-method.rs index 03a799933421c..008eeda92d055 100644 --- a/src/test/debuginfo/self-in-default-method.rs +++ b/src/test/debuginfo/self-in-default-method.rs @@ -150,4 +150,3 @@ fn main() { } fn zzz() {()} - diff --git a/src/test/debuginfo/self-in-generic-default-method.rs b/src/test/debuginfo/self-in-generic-default-method.rs index 5869625bafe59..94e5f6f6c1052 100644 --- a/src/test/debuginfo/self-in-generic-default-method.rs +++ b/src/test/debuginfo/self-in-generic-default-method.rs @@ -151,4 +151,3 @@ fn main() { } fn zzz() {()} - diff --git a/src/test/parse-fail/ascii-only-character-escape.rs b/src/test/parse-fail/ascii-only-character-escape.rs index 1ba25a827a5b1..bcfcc4347039b 100644 --- a/src/test/parse-fail/ascii-only-character-escape.rs +++ b/src/test/parse-fail/ascii-only-character-escape.rs @@ -14,4 +14,3 @@ fn main() { let z = "\xe2"; //~ ERROR may only be used let a = b"\x00e2"; // ok because byte literal } - diff --git a/src/test/parse-fail/byte-literals.rs b/src/test/parse-fail/byte-literals.rs index 436078fa762e5..08935a24a1b61 100644 --- a/src/test/parse-fail/byte-literals.rs +++ b/src/test/parse-fail/byte-literals.rs @@ -21,5 +21,3 @@ pub fn main() { b'é'; //~ ERROR byte constant must be ASCII b'a //~ ERROR unterminated byte constant } - - diff --git a/src/test/parse-fail/byte-string-literals.rs b/src/test/parse-fail/byte-string-literals.rs index ec67cdd77e19f..ee3d86a6638d8 100644 --- a/src/test/parse-fail/byte-string-literals.rs +++ b/src/test/parse-fail/byte-string-literals.rs @@ -19,5 +19,3 @@ pub fn main() { b"é"; //~ ERROR byte constant must be ASCII b"a //~ ERROR unterminated double quote byte string } - - diff --git a/src/test/parse-fail/issue-10392-2.rs b/src/test/parse-fail/issue-10392-2.rs index b077081c5b0c8..2a3dd7fba0cff 100644 --- a/src/test/parse-fail/issue-10392-2.rs +++ b/src/test/parse-fail/issue-10392-2.rs @@ -15,4 +15,3 @@ fn a() -> A { panic!() } fn main() { let A { .., } = a(); //~ ERROR: expected `}` } - diff --git a/src/test/parse-fail/issue-17718-const-mut.rs b/src/test/parse-fail/issue-17718-const-mut.rs index 5177ebbc1882f..b7feeecbfd91e 100644 --- a/src/test/parse-fail/issue-17718-const-mut.rs +++ b/src/test/parse-fail/issue-17718-const-mut.rs @@ -15,4 +15,3 @@ FOO: usize = 3; fn main() { } - diff --git a/src/test/parse-fail/issue-20711-2.rs b/src/test/parse-fail/issue-20711-2.rs index a6c4570c60f7f..a50a757160dde 100644 --- a/src/test/parse-fail/issue-20711-2.rs +++ b/src/test/parse-fail/issue-20711-2.rs @@ -17,4 +17,3 @@ impl Foo { } //~ ERROR expected one of `extern`, `fn`, `pub`, `type`, or `unsafe`, found `}` fn main() {} - diff --git a/src/test/parse-fail/issue-2354-1.rs b/src/test/parse-fail/issue-2354-1.rs index d37837b9714f0..48cdeeb0d7027 100644 --- a/src/test/parse-fail/issue-2354-1.rs +++ b/src/test/parse-fail/issue-2354-1.rs @@ -9,4 +9,3 @@ // except according to those terms. static foo: isize = 2; } //~ ERROR incorrect close delimiter: - diff --git a/src/test/parse-fail/keywords-followed-by-double-colon.rs b/src/test/parse-fail/keywords-followed-by-double-colon.rs index f69b041597edf..ba04a5ac9af09 100644 --- a/src/test/parse-fail/keywords-followed-by-double-colon.rs +++ b/src/test/parse-fail/keywords-followed-by-double-colon.rs @@ -12,4 +12,3 @@ fn main() { struct::foo(); //~ ERROR expected identifier mut::baz(); //~ ERROR expected identifier } - diff --git a/src/test/parse-fail/macro-attribute.rs b/src/test/parse-fail/macro-attribute.rs index 77ea0c9c4f302..52f867fe913b8 100644 --- a/src/test/parse-fail/macro-attribute.rs +++ b/src/test/parse-fail/macro-attribute.rs @@ -10,4 +10,3 @@ #[doc = $not_there] //~ error: unexpected token: `$` fn main() { } - diff --git a/src/test/parse-fail/macros-no-semicolon.rs b/src/test/parse-fail/macros-no-semicolon.rs index 0e85551e2161c..23b27b49a86f6 100644 --- a/src/test/parse-fail/macros-no-semicolon.rs +++ b/src/test/parse-fail/macros-no-semicolon.rs @@ -13,4 +13,3 @@ fn main() { assert!(3 == 4) //~ ERROR expected one of `.`, `;`, `}`, or an operator, found `assert` println!("hello"); } - diff --git a/src/test/parse-fail/obsolete-proc.rs b/src/test/parse-fail/obsolete-proc.rs index f1ed0be7640a9..4767c66c2a058 100644 --- a/src/test/parse-fail/obsolete-proc.rs +++ b/src/test/parse-fail/obsolete-proc.rs @@ -14,4 +14,4 @@ fn foo(p: proc()) { } //~ ERROR `proc` is a reserved keyword fn bar() { proc() 1; } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/parse-fail/raw-byte-string-eof.rs b/src/test/parse-fail/raw-byte-string-eof.rs index 83ea9db39b798..ccf9e2d86882b 100644 --- a/src/test/parse-fail/raw-byte-string-eof.rs +++ b/src/test/parse-fail/raw-byte-string-eof.rs @@ -12,5 +12,3 @@ pub fn main() { br##"a"#; //~ unterminated raw string } - - diff --git a/src/test/parse-fail/raw-byte-string-literals.rs b/src/test/parse-fail/raw-byte-string-literals.rs index 7a3d1b2318a31..d6073a10307fd 100644 --- a/src/test/parse-fail/raw-byte-string-literals.rs +++ b/src/test/parse-fail/raw-byte-string-literals.rs @@ -13,5 +13,3 @@ pub fn main() { br"é"; //~ raw byte string must be ASCII br##~"a"~##; //~ only `#` is allowed in raw string delimitation } - - diff --git a/src/test/parse-fail/struct-literal-in-for.rs b/src/test/parse-fail/struct-literal-in-for.rs index 4bb5d5e6aa176..a6d4da526fb0e 100644 --- a/src/test/parse-fail/struct-literal-in-for.rs +++ b/src/test/parse-fail/struct-literal-in-for.rs @@ -25,4 +25,3 @@ fn main() { println!("yo"); } } - diff --git a/src/test/parse-fail/struct-literal-in-if.rs b/src/test/parse-fail/struct-literal-in-if.rs index b2bc8a4901f4c..00ece3fcca341 100644 --- a/src/test/parse-fail/struct-literal-in-if.rs +++ b/src/test/parse-fail/struct-literal-in-if.rs @@ -25,4 +25,3 @@ fn main() { println!("yo"); } } - diff --git a/src/test/parse-fail/struct-literal-in-match-discriminant.rs b/src/test/parse-fail/struct-literal-in-match-discriminant.rs index e6948b7c7c995..cdcf98a42f94b 100644 --- a/src/test/parse-fail/struct-literal-in-match-discriminant.rs +++ b/src/test/parse-fail/struct-literal-in-match-discriminant.rs @@ -21,4 +21,3 @@ fn main() { } => {} } } - diff --git a/src/test/parse-fail/struct-literal-in-while.rs b/src/test/parse-fail/struct-literal-in-while.rs index 05fa3a8dd5fc2..c23b5dbb9cc86 100644 --- a/src/test/parse-fail/struct-literal-in-while.rs +++ b/src/test/parse-fail/struct-literal-in-while.rs @@ -25,4 +25,3 @@ fn main() { println!("yo"); } } - diff --git a/src/test/parse-fail/type-parameters-in-field-exprs.rs b/src/test/parse-fail/type-parameters-in-field-exprs.rs index 54ddb3e19fa48..191bd78212458 100644 --- a/src/test/parse-fail/type-parameters-in-field-exprs.rs +++ b/src/test/parse-fail/type-parameters-in-field-exprs.rs @@ -21,4 +21,3 @@ fn main() { f.x::; //~^ ERROR field expressions may not have type parameters } - diff --git a/src/test/parse-fail/unboxed-closure-sugar-used-on-struct-3.rs b/src/test/parse-fail/unboxed-closure-sugar-used-on-struct-3.rs index d86f55d53685a..de6291c7cc38b 100644 --- a/src/test/parse-fail/unboxed-closure-sugar-used-on-struct-3.rs +++ b/src/test/parse-fail/unboxed-closure-sugar-used-on-struct-3.rs @@ -26,4 +26,3 @@ fn bar() { } fn main() { } - diff --git a/src/test/parse-fail/use-mod-4.rs b/src/test/parse-fail/use-mod-4.rs index a8b551b5376c9..52d0d1a5fba15 100644 --- a/src/test/parse-fail/use-mod-4.rs +++ b/src/test/parse-fail/use-mod-4.rs @@ -12,4 +12,3 @@ use foo::self; //~^ ERROR expected identifier, found keyword `self` fn main() {} - diff --git a/src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs b/src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs index b96c7c2de6b3c..ebdbdc4b2b54f 100644 --- a/src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs +++ b/src/test/parse-fail/where-clauses-no-bounds-or-predicates.rs @@ -20,4 +20,3 @@ fn equal2(_: &T, _: &T) -> bool where T: { fn main() { } - diff --git a/src/test/pretty/asm-clobbers.rs b/src/test/pretty/asm-clobbers.rs index 20a3ac226bdc5..c72add8d3d68a 100644 --- a/src/test/pretty/asm-clobbers.rs +++ b/src/test/pretty/asm-clobbers.rs @@ -11,4 +11,3 @@ #![feature(asm)] pub fn main() { unsafe { asm!("" : : : "hello", "world") }; } - diff --git a/src/test/pretty/closure-reform-pretty.rs b/src/test/pretty/closure-reform-pretty.rs index 094e3ce915686..33a80f469469c 100644 --- a/src/test/pretty/closure-reform-pretty.rs +++ b/src/test/pretty/closure-reform-pretty.rs @@ -24,4 +24,3 @@ fn call_extern(f: fn() -> int) { } fn call_abid_extern(f: extern "C" fn() -> int) { } pub fn main() { } - diff --git a/src/test/pretty/path-type-bounds.rs b/src/test/pretty/path-type-bounds.rs index 9e1f2aa8bfe01..0a20300e4f4de 100644 --- a/src/test/pretty/path-type-bounds.rs +++ b/src/test/pretty/path-type-bounds.rs @@ -23,4 +23,3 @@ fn main() { Box::new(1) as Box; } - diff --git a/src/test/pretty/where-clauses.rs b/src/test/pretty/where-clauses.rs index 0f3b914334e12..ad582ac1b62be 100644 --- a/src/test/pretty/where-clauses.rs +++ b/src/test/pretty/where-clauses.rs @@ -13,4 +13,3 @@ fn f<'a, 'b, T>(t: T) -> int where T: 'a, 'a:'b, T: Eq { 0 } fn main() { } - diff --git a/src/test/run-make/allow-non-lint-warnings-cmdline/Makefile b/src/test/run-make/allow-non-lint-warnings-cmdline/Makefile index 961342591aa51..c14006cc2e052 100644 --- a/src/test/run-make/allow-non-lint-warnings-cmdline/Makefile +++ b/src/test/run-make/allow-non-lint-warnings-cmdline/Makefile @@ -9,4 +9,3 @@ all: foo # This is just to make sure the above command actually succeeds foo: $(RUSTC) foo.rs -A warnings - diff --git a/src/test/run-make/allow-warnings-cmdline-stability/Makefile b/src/test/run-make/allow-warnings-cmdline-stability/Makefile index 64b7f58caeaf3..3eecaf9314226 100644 --- a/src/test/run-make/allow-warnings-cmdline-stability/Makefile +++ b/src/test/run-make/allow-warnings-cmdline-stability/Makefile @@ -13,7 +13,3 @@ bar: foo: bar $(RUSTC) foo.rs -A warnings - - - - diff --git a/src/test/run-make/compiler-lookup-paths/c.rs b/src/test/run-make/compiler-lookup-paths/c.rs index 8a801d589fb81..b5c54558a4f0a 100644 --- a/src/test/run-make/compiler-lookup-paths/c.rs +++ b/src/test/run-make/compiler-lookup-paths/c.rs @@ -10,4 +10,3 @@ #![crate_type = "lib"] extern crate b; - diff --git a/src/test/run-make/crate-name-priority/foo1.rs b/src/test/run-make/crate-name-priority/foo1.rs index 0f02f1005728e..a397d6bc749fe 100644 --- a/src/test/run-make/crate-name-priority/foo1.rs +++ b/src/test/run-make/crate-name-priority/foo1.rs @@ -11,4 +11,3 @@ #![crate_name = "foo"] fn main() {} - diff --git a/src/test/run-make/extern-flag-disambiguates/Makefile b/src/test/run-make/extern-flag-disambiguates/Makefile index 049b76c1b648a..81930e969a9f6 100644 --- a/src/test/run-make/extern-flag-disambiguates/Makefile +++ b/src/test/run-make/extern-flag-disambiguates/Makefile @@ -23,4 +23,3 @@ all: @echo after $(RUSTC) --cfg after d.rs --extern a=$(TMPDIR)/liba-1.rlib $(call RUN,d) - diff --git a/src/test/run-make/extern-flag-fun/bar.rs b/src/test/run-make/extern-flag-fun/bar.rs index 2152aa79c3370..e6c760257380c 100644 --- a/src/test/run-make/extern-flag-fun/bar.rs +++ b/src/test/run-make/extern-flag-fun/bar.rs @@ -7,4 +7,3 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. - diff --git a/src/test/run-make/extern-overrides-distribution/main.rs b/src/test/run-make/extern-overrides-distribution/main.rs index 92b353c892ae7..451841e736899 100644 --- a/src/test/run-make/extern-overrides-distribution/main.rs +++ b/src/test/run-make/extern-overrides-distribution/main.rs @@ -13,4 +13,3 @@ extern crate libc; fn main() { libc::foo(); } - diff --git a/src/test/run-make/interdependent-c-libraries/Makefile b/src/test/run-make/interdependent-c-libraries/Makefile index 7654917b46232..cf7683479f08e 100644 --- a/src/test/run-make/interdependent-c-libraries/Makefile +++ b/src/test/run-make/interdependent-c-libraries/Makefile @@ -12,4 +12,3 @@ all: $(call STATICLIB,foo) $(call STATICLIB,bar) $(RUSTC) foo.rs $(RUSTC) bar.rs $(RUSTC) main.rs -Z print-link-args - diff --git a/src/test/run-make/interdependent-c-libraries/bar.rs b/src/test/run-make/interdependent-c-libraries/bar.rs index 5311af2959b2c..88fc98615f0b3 100644 --- a/src/test/run-make/interdependent-c-libraries/bar.rs +++ b/src/test/run-make/interdependent-c-libraries/bar.rs @@ -20,4 +20,3 @@ extern { pub fn doit() { unsafe { bar(); } } - diff --git a/src/test/run-make/issue-14500/Makefile b/src/test/run-make/issue-14500/Makefile index 446c6e5c81b69..c19d3d5c30f14 100644 --- a/src/test/run-make/issue-14500/Makefile +++ b/src/test/run-make/issue-14500/Makefile @@ -11,4 +11,3 @@ all: $(RUSTC) bar.rs --crate-type=staticlib -C lto -L. -o $(TMPDIR)/libbar.a $(CC) foo.c -lbar -o $(call RUN_BINFILE,foo) $(EXTRACFLAGS) $(call RUN,foo) - diff --git a/src/test/run-make/libs-and-bins/Makefile b/src/test/run-make/libs-and-bins/Makefile index 4d975d2f71718..cc3b257a5c5bf 100644 --- a/src/test/run-make/libs-and-bins/Makefile +++ b/src/test/run-make/libs-and-bins/Makefile @@ -4,4 +4,3 @@ all: $(RUSTC) foo.rs $(call RUN,foo) rm $(TMPDIR)/$(call DYLIB_GLOB,foo) - diff --git a/src/test/run-make/link-path-order/Makefile b/src/test/run-make/link-path-order/Makefile index b8ebe6db6fd8f..116c7ae991cf6 100644 --- a/src/test/run-make/link-path-order/Makefile +++ b/src/test/run-make/link-path-order/Makefile @@ -14,4 +14,3 @@ all: $(TMPDIR)/libcorrect.a $(TMPDIR)/libwrong.a $(call RUN,should_succeed) $(RUSTC) main.rs -o $(TMPDIR)/should_fail -L $(WRONG_DIR) -L $(CORRECT_DIR) $(call FAIL,should_fail) - diff --git a/src/test/run-make/linkage-attr-on-static/Makefile b/src/test/run-make/linkage-attr-on-static/Makefile index 6bcde96335cff..1871a5bbdc7f6 100644 --- a/src/test/run-make/linkage-attr-on-static/Makefile +++ b/src/test/run-make/linkage-attr-on-static/Makefile @@ -5,4 +5,3 @@ all: $(AR) rcs $(TMPDIR)/libfoo.a $(TMPDIR)/foo.o $(RUSTC) bar.rs -lfoo -L $(TMPDIR) $(call RUN,bar) || exit 1 - diff --git a/src/test/run-make/manual-link/Makefile b/src/test/run-make/manual-link/Makefile index d053695615250..dccf0d99b0f82 100644 --- a/src/test/run-make/manual-link/Makefile +++ b/src/test/run-make/manual-link/Makefile @@ -4,4 +4,3 @@ all: $(TMPDIR)/libbar.a $(RUSTC) foo.rs -lstatic=bar $(RUSTC) main.rs $(call RUN,main) - diff --git a/src/test/run-make/many-crates-but-no-match/Makefile b/src/test/run-make/many-crates-but-no-match/Makefile index da5fc78f3284e..edf8e9df465dc 100644 --- a/src/test/run-make/many-crates-but-no-match/Makefile +++ b/src/test/run-make/many-crates-but-no-match/Makefile @@ -16,7 +16,7 @@ A3=$(TMPDIR)/a3 # A hack to match distinct lines of output from a single run. LOG=$(TMPDIR)/log.txt -all: +all: mkdir -p $(A1) $(A2) $(A3) $(RUSTC) --crate-type=rlib crateA1.rs mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A1) diff --git a/src/test/run-make/missing-crate-dependency/Makefile b/src/test/run-make/missing-crate-dependency/Makefile index 3f8b97f256652..275658047d3ce 100644 --- a/src/test/run-make/missing-crate-dependency/Makefile +++ b/src/test/run-make/missing-crate-dependency/Makefile @@ -1,6 +1,6 @@ -include ../tools.mk -all: +all: $(RUSTC) --crate-type=rlib crateA.rs $(RUSTC) --crate-type=rlib crateB.rs $(call REMOVE_RLIBS,crateA) diff --git a/src/test/run-make/mixing-formats/baz2.rs b/src/test/run-make/mixing-formats/baz2.rs index 4cfa65330bd19..c5066ccd6566f 100644 --- a/src/test/run-make/mixing-formats/baz2.rs +++ b/src/test/run-make/mixing-formats/baz2.rs @@ -12,4 +12,3 @@ extern crate bar1; extern crate bar2; fn main() {} - diff --git a/src/test/run-make/obey-crate-type-flag/test.rs b/src/test/run-make/obey-crate-type-flag/test.rs index 8eb82b48eacf7..e6c8b8eb179e6 100644 --- a/src/test/run-make/obey-crate-type-flag/test.rs +++ b/src/test/run-make/obey-crate-type-flag/test.rs @@ -10,4 +10,3 @@ #![crate_type = "rlib"] #![crate_type = "dylib"] - diff --git a/src/test/run-make/rustdoc-default-impl/bar.rs b/src/test/run-make/rustdoc-default-impl/bar.rs index c9fae80d85829..60a2f7202f8fc 100644 --- a/src/test/run-make/rustdoc-default-impl/bar.rs +++ b/src/test/run-make/rustdoc-default-impl/bar.rs @@ -14,4 +14,3 @@ pub use foo::bar; pub fn wut() { } - diff --git a/src/test/run-make/rustdoc-extern-method/Makefile b/src/test/run-make/rustdoc-extern-method/Makefile index c87684f59ea01..55cbd2da6ae2e 100644 --- a/src/test/run-make/rustdoc-extern-method/Makefile +++ b/src/test/run-make/rustdoc-extern-method/Makefile @@ -5,4 +5,3 @@ all: foo.rs bar.rs $(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs $(HOST_RPATH_ENV) $(RUSTDOC) -L $(TMPDIR) -w html -o $(TMPDIR)/doc bar.rs $(HTMLDOCCK) $(TMPDIR)/doc bar.rs - diff --git a/src/test/run-make/rustdoc-negative-impl/Makefile b/src/test/run-make/rustdoc-negative-impl/Makefile index 1316ee256e147..c1b1683efdb7f 100644 --- a/src/test/run-make/rustdoc-negative-impl/Makefile +++ b/src/test/run-make/rustdoc-negative-impl/Makefile @@ -3,4 +3,3 @@ all: foo.rs $(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs $(HTMLDOCCK) $(TMPDIR)/doc foo.rs - diff --git a/src/test/run-make/rustdoc-recursion/Makefile b/src/test/run-make/rustdoc-recursion/Makefile index b7fc6d6c0ad5b..ba971836e5a9d 100644 --- a/src/test/run-make/rustdoc-recursion/Makefile +++ b/src/test/run-make/rustdoc-recursion/Makefile @@ -9,4 +9,3 @@ all: else all: endif - diff --git a/src/test/run-make/rustdoc-recursion/foo.rs b/src/test/run-make/rustdoc-recursion/foo.rs index 29a909f139ead..7505d20566dbb 100644 --- a/src/test/run-make/rustdoc-recursion/foo.rs +++ b/src/test/run-make/rustdoc-recursion/foo.rs @@ -22,4 +22,3 @@ mod m { pub use super::*; } } - diff --git a/src/test/run-make/rustdoc-viewpath-self/Makefile b/src/test/run-make/rustdoc-viewpath-self/Makefile index 1316ee256e147..c1b1683efdb7f 100644 --- a/src/test/run-make/rustdoc-viewpath-self/Makefile +++ b/src/test/run-make/rustdoc-viewpath-self/Makefile @@ -3,4 +3,3 @@ all: foo.rs $(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs $(HTMLDOCCK) $(TMPDIR)/doc foo.rs - diff --git a/src/test/run-make/rustdoc-where/Makefile b/src/test/run-make/rustdoc-where/Makefile index 1316ee256e147..c1b1683efdb7f 100644 --- a/src/test/run-make/rustdoc-where/Makefile +++ b/src/test/run-make/rustdoc-where/Makefile @@ -3,4 +3,3 @@ all: foo.rs $(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs $(HTMLDOCCK) $(TMPDIR)/doc foo.rs - diff --git a/src/test/run-make/tools.mk b/src/test/run-make/tools.mk index 23c422bc7a7fe..7b604bedfd00b 100644 --- a/src/test/run-make/tools.mk +++ b/src/test/run-make/tools.mk @@ -83,4 +83,3 @@ REMOVE_RLIBS = rm $(TMPDIR)/$(call RLIB_GLOB,$(1)) $(TMPDIR)/lib%.o: %.c $(CC) -c -o $@ $< - diff --git a/src/test/run-pass-fulldeps/compiler-calls.rs b/src/test/run-pass-fulldeps/compiler-calls.rs index 75a968c3f8113..8492424a1457a 100644 --- a/src/test/run-pass-fulldeps/compiler-calls.rs +++ b/src/test/run-pass-fulldeps/compiler-calls.rs @@ -80,4 +80,3 @@ fn main() { rustc_driver::run_compiler(args.as_slice(), &mut tc); assert!(tc.count == 30); } - diff --git a/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs b/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs index aecec44f6fd3d..0bbb9ed128592 100644 --- a/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs +++ b/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs @@ -36,4 +36,3 @@ pub fn main() { assert!(DROP_RAN); } } - diff --git a/src/test/run-pass/as-precedence.rs b/src/test/run-pass/as-precedence.rs index 0760f13200c8f..de294f88a4c9b 100644 --- a/src/test/run-pass/as-precedence.rs +++ b/src/test/run-pass/as-precedence.rs @@ -15,4 +15,3 @@ fn main() { assert_eq!(3 as uint + 3, 6); assert_eq!(3 as (uint) + 3, 6); } - diff --git a/src/test/run-pass/backtrace-debuginfo-aux.rs b/src/test/run-pass/backtrace-debuginfo-aux.rs index 074ee97c37a1e..f0d36ea976ef7 100644 --- a/src/test/run-pass/backtrace-debuginfo-aux.rs +++ b/src/test/run-pass/backtrace-debuginfo-aux.rs @@ -19,4 +19,3 @@ pub fn callback(f: F) where F: FnOnce((&'static str, u32)) { pub fn callback_inlined(f: F) where F: FnOnce((&'static str, u32)) { f((file!(), line!())) } - diff --git a/src/test/run-pass/backtrace-debuginfo.rs b/src/test/run-pass/backtrace-debuginfo.rs index 23aadbc70537e..088fa19356c4e 100644 --- a/src/test/run-pass/backtrace-debuginfo.rs +++ b/src/test/run-pass/backtrace-debuginfo.rs @@ -157,4 +157,3 @@ fn main() { run_test(&args[0]); } } - diff --git a/src/test/run-pass/bare-fn-implements-fn-mut.rs b/src/test/run-pass/bare-fn-implements-fn-mut.rs index 758776298e146..e8118e90a9f3f 100644 --- a/src/test/run-pass/bare-fn-implements-fn-mut.rs +++ b/src/test/run-pass/bare-fn-implements-fn-mut.rs @@ -35,4 +35,3 @@ fn main() { assert_eq!(call_g(g, "foo".to_string(), "bar".to_string()), "foobar"); } - diff --git a/src/test/run-pass/bitv-perf-test.rs b/src/test/run-pass/bitv-perf-test.rs index 24bfbd9eb4408..e6982949501c2 100644 --- a/src/test/run-pass/bitv-perf-test.rs +++ b/src/test/run-pass/bitv-perf-test.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/borrowck-field-sensitivity.rs b/src/test/run-pass/borrowck-field-sensitivity.rs index 89d80190042c7..533445052ae65 100644 --- a/src/test/run-pass/borrowck-field-sensitivity.rs +++ b/src/test/run-pass/borrowck-field-sensitivity.rs @@ -270,4 +270,3 @@ fn main() { borrow_after_assign_after_uninit(); move_after_assign_after_uninit(); } - diff --git a/src/test/run-pass/borrowck-move-by-capture-ok.rs b/src/test/run-pass/borrowck-move-by-capture-ok.rs index 27fbfc9641088..269063bbd05b6 100644 --- a/src/test/run-pass/borrowck-move-by-capture-ok.rs +++ b/src/test/run-pass/borrowck-move-by-capture-ok.rs @@ -17,4 +17,3 @@ pub fn main() { let h = || -> int *bar; assert_eq!(h(), 3); } - diff --git a/src/test/run-pass/borrowck-use-mut-borrow.rs b/src/test/run-pass/borrowck-use-mut-borrow.rs index 7be12ff3cc965..4b69e554cda66 100644 --- a/src/test/run-pass/borrowck-use-mut-borrow.rs +++ b/src/test/run-pass/borrowck-use-mut-borrow.rs @@ -57,4 +57,3 @@ fn main() { field_move_after_field_borrow(); fu_field_move_after_field_borrow(); } - diff --git a/src/test/run-pass/can-copy-pod.rs b/src/test/run-pass/can-copy-pod.rs index 099374b593781..9c8bc5411ef91 100644 --- a/src/test/run-pass/can-copy-pod.rs +++ b/src/test/run-pass/can-copy-pod.rs @@ -21,5 +21,3 @@ fn can_copy_copy(v: T) { } pub fn main() {} - - diff --git a/src/test/run-pass/capture-clauses-boxed-closures.rs b/src/test/run-pass/capture-clauses-boxed-closures.rs index 1a85797fa6db5..6518df11517e9 100644 --- a/src/test/run-pass/capture-clauses-boxed-closures.rs +++ b/src/test/run-pass/capture-clauses-boxed-closures.rs @@ -20,4 +20,3 @@ fn main() { each(&elems, |val| sum += *val); assert_eq!(sum, 15); } - diff --git a/src/test/run-pass/class-exports.rs b/src/test/run-pass/class-exports.rs index 1cf4c35ee96e0..a3f857ab4b069 100644 --- a/src/test/run-pass/class-exports.rs +++ b/src/test/run-pass/class-exports.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/cleanup-arm-conditional.rs b/src/test/run-pass/cleanup-arm-conditional.rs index 0d155ae085c73..cb152f1c64e94 100644 --- a/src/test/run-pass/cleanup-arm-conditional.rs +++ b/src/test/run-pass/cleanup-arm-conditional.rs @@ -52,4 +52,3 @@ pub fn main() { let t = Test { x: 1 }; do_something(&t); } - diff --git a/src/test/run-pass/cleanup-shortcircuit.rs b/src/test/run-pass/cleanup-shortcircuit.rs index 59f63a79c3ddf..4466dda6c6927 100644 --- a/src/test/run-pass/cleanup-shortcircuit.rs +++ b/src/test/run-pass/cleanup-shortcircuit.rs @@ -36,4 +36,3 @@ pub fn main() { unsafe { *(0 as *mut int) = 0; } } } - diff --git a/src/test/run-pass/closure-reform.rs b/src/test/run-pass/closure-reform.rs index a4495c3c68e8b..af64553b91387 100644 --- a/src/test/run-pass/closure-reform.rs +++ b/src/test/run-pass/closure-reform.rs @@ -66,4 +66,3 @@ pub fn main() { call_bare_again(println); } - diff --git a/src/test/run-pass/conditional-compile.rs b/src/test/run-pass/conditional-compile.rs index 178fc3dcd4f0d..f77be4d9c0631 100644 --- a/src/test/run-pass/conditional-compile.rs +++ b/src/test/run-pass/conditional-compile.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/deriving-meta-multiple.rs b/src/test/run-pass/deriving-meta-multiple.rs index 62ec2f8e5902d..3164021a72e64 100644 --- a/src/test/run-pass/deriving-meta-multiple.rs +++ b/src/test/run-pass/deriving-meta-multiple.rs @@ -1,4 +1,3 @@ - // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/deriving-meta.rs b/src/test/run-pass/deriving-meta.rs index 82cf9db3232c0..16df6e7004fe4 100644 --- a/src/test/run-pass/deriving-meta.rs +++ b/src/test/run-pass/deriving-meta.rs @@ -1,4 +1,3 @@ - // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/deriving-via-extension-hash-enum.rs b/src/test/run-pass/deriving-via-extension-hash-enum.rs index 10bd1b29444d2..2d6997341fb5d 100644 --- a/src/test/run-pass/deriving-via-extension-hash-enum.rs +++ b/src/test/run-pass/deriving-via-extension-hash-enum.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/deriving-via-extension-hash-struct.rs b/src/test/run-pass/deriving-via-extension-hash-struct.rs index 19809def9a10d..448d5bfd4cb74 100644 --- a/src/test/run-pass/deriving-via-extension-hash-struct.rs +++ b/src/test/run-pass/deriving-via-extension-hash-struct.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/deriving-via-extension-type-params.rs b/src/test/run-pass/deriving-via-extension-type-params.rs index 890b4e6978309..1a31743b4c0c3 100644 --- a/src/test/run-pass/deriving-via-extension-type-params.rs +++ b/src/test/run-pass/deriving-via-extension-type-params.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/drop-with-type-ascription-1.rs b/src/test/run-pass/drop-with-type-ascription-1.rs index f9fcf8ced28bb..4f1fc91a53cea 100644 --- a/src/test/run-pass/drop-with-type-ascription-1.rs +++ b/src/test/run-pass/drop-with-type-ascription-1.rs @@ -14,4 +14,3 @@ fn main() { let invalid_string = &foo[0]; assert_eq!(*invalid_string, "hello"); } - diff --git a/src/test/run-pass/drop-with-type-ascription-2.rs b/src/test/run-pass/drop-with-type-ascription-2.rs index f3d79f0c7d558..ec8de2a709e66 100644 --- a/src/test/run-pass/drop-with-type-ascription-2.rs +++ b/src/test/run-pass/drop-with-type-ascription-2.rs @@ -14,4 +14,3 @@ fn main() { assert_eq!(arr[0], "asdf"); assert_eq!(arr[0], "asdf"); } - diff --git a/src/test/run-pass/duplicated-external-mods.rs b/src/test/run-pass/duplicated-external-mods.rs index 65e2b178abf70..f7b1cef83ea53 100644 --- a/src/test/run-pass/duplicated-external-mods.rs +++ b/src/test/run-pass/duplicated-external-mods.rs @@ -13,4 +13,3 @@ extern crate anonexternmod; pub fn main() { } - diff --git a/src/test/run-pass/export-multi.rs b/src/test/run-pass/export-multi.rs index 2e44bf5be5bc6..09e816cff0bb5 100644 --- a/src/test/run-pass/export-multi.rs +++ b/src/test/run-pass/export-multi.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/export-non-interference3.rs b/src/test/run-pass/export-non-interference3.rs index 091c389840ac0..b7ef4df7ed6c0 100644 --- a/src/test/run-pass/export-non-interference3.rs +++ b/src/test/run-pass/export-non-interference3.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/extern-compare-with-return-type.rs b/src/test/run-pass/extern-compare-with-return-type.rs index 3febff18704de..612b6ee14e196 100644 --- a/src/test/run-pass/extern-compare-with-return-type.rs +++ b/src/test/run-pass/extern-compare-with-return-type.rs @@ -31,4 +31,3 @@ pub fn main() { assert!(uintuintuintuintret as uintuintuintuintret == uintuintuintuintret as uintuintuintuintret); } - diff --git a/src/test/run-pass/extern-mod-syntax.rs b/src/test/run-pass/extern-mod-syntax.rs index 3e430b6e72881..4d4f5036fc1b8 100644 --- a/src/test/run-pass/extern-mod-syntax.rs +++ b/src/test/run-pass/extern-mod-syntax.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/for-loop-goofiness.rs b/src/test/run-pass/for-loop-goofiness.rs index 7754751120e48..84218befcd83b 100644 --- a/src/test/run-pass/for-loop-goofiness.rs +++ b/src/test/run-pass/for-loop-goofiness.rs @@ -21,4 +21,3 @@ pub fn main() { assert_eq!(*i, 3); } } - diff --git a/src/test/run-pass/format-nan.rs b/src/test/run-pass/format-nan.rs index 1024bc21d2b0a..9670d2de3efca 100644 --- a/src/test/run-pass/format-nan.rs +++ b/src/test/run-pass/format-nan.rs @@ -15,4 +15,3 @@ pub fn main() { assert_eq!(format!("{:e}", f64::NAN), x); assert_eq!(format!("{:E}", f64::NAN), x); } - diff --git a/src/test/run-pass/import-from.rs b/src/test/run-pass/import-from.rs index bbf914411fde4..38602bef229bc 100644 --- a/src/test/run-pass/import-from.rs +++ b/src/test/run-pass/import-from.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import-trailing-comma.rs b/src/test/run-pass/import-trailing-comma.rs index 42a90b3e39a4e..b46f81479bf04 100644 --- a/src/test/run-pass/import-trailing-comma.rs +++ b/src/test/run-pass/import-trailing-comma.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import2.rs b/src/test/run-pass/import2.rs index d684c30aca1b8..4086acc0a8eb4 100644 --- a/src/test/run-pass/import2.rs +++ b/src/test/run-pass/import2.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import3.rs b/src/test/run-pass/import3.rs index 4a3358488d8a3..2c09eff7b12e5 100644 --- a/src/test/run-pass/import3.rs +++ b/src/test/run-pass/import3.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import4.rs b/src/test/run-pass/import4.rs index 44f6b6140fbff..229813ff55ceb 100644 --- a/src/test/run-pass/import4.rs +++ b/src/test/run-pass/import4.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import5.rs b/src/test/run-pass/import5.rs index 18cc1aa08482a..0cad094d55dd7 100644 --- a/src/test/run-pass/import5.rs +++ b/src/test/run-pass/import5.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import6.rs b/src/test/run-pass/import6.rs index 802dfc1f2ed14..545bd7cee5ea8 100644 --- a/src/test/run-pass/import6.rs +++ b/src/test/run-pass/import6.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import7.rs b/src/test/run-pass/import7.rs index 15e935c8f4f5f..4b9d1328951fe 100644 --- a/src/test/run-pass/import7.rs +++ b/src/test/run-pass/import7.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/import8.rs b/src/test/run-pass/import8.rs index 119107404d74d..532c3843284d2 100644 --- a/src/test/run-pass/import8.rs +++ b/src/test/run-pass/import8.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/inherent-trait-method-order.rs b/src/test/run-pass/inherent-trait-method-order.rs index 6643636c5704d..9674c86b379a5 100644 --- a/src/test/run-pass/inherent-trait-method-order.rs +++ b/src/test/run-pass/inherent-trait-method-order.rs @@ -31,4 +31,3 @@ fn main() { let x = &(&(&Foo)); x.foo(); } - diff --git a/src/test/run-pass/integer-literal-suffix-inference-2.rs b/src/test/run-pass/integer-literal-suffix-inference-2.rs index 05973a545a20d..77e7ee6264319 100644 --- a/src/test/run-pass/integer-literal-suffix-inference-2.rs +++ b/src/test/run-pass/integer-literal-suffix-inference-2.rs @@ -14,4 +14,3 @@ fn main() { let a = 3; foo(&a as *const _ as *const ()); } - diff --git a/src/test/run-pass/integer-literal-suffix-inference-3.rs b/src/test/run-pass/integer-literal-suffix-inference-3.rs index 05b275a0d8cab..31aca964def1c 100644 --- a/src/test/run-pass/integer-literal-suffix-inference-3.rs +++ b/src/test/run-pass/integer-literal-suffix-inference-3.rs @@ -11,4 +11,3 @@ fn main() { println!("{}", std::mem::size_of_val(&1)); } - diff --git a/src/test/run-pass/intrinsic-assume.rs b/src/test/run-pass/intrinsic-assume.rs index abf9b94c59d8a..837c2d21513de 100644 --- a/src/test/run-pass/intrinsic-assume.rs +++ b/src/test/run-pass/intrinsic-assume.rs @@ -22,4 +22,3 @@ fn main() { let x = unsafe { f(34) }; assert_eq!(x, 42); } - diff --git a/src/test/run-pass/intrinsic-return-address.rs b/src/test/run-pass/intrinsic-return-address.rs index 91af669340d61..99578abed38e7 100644 --- a/src/test/run-pass/intrinsic-return-address.rs +++ b/src/test/run-pass/intrinsic-return-address.rs @@ -40,4 +40,3 @@ fn main() { let actual_address = &pt as *const Point as uint; assert_eq!(intrinsic_reported_address, actual_address); } - diff --git a/src/test/run-pass/intrinsics-math.rs b/src/test/run-pass/intrinsics-math.rs index ab65f35dd34d8..028b2bfb0ecdb 100644 --- a/src/test/run-pass/intrinsics-math.rs +++ b/src/test/run-pass/intrinsics-math.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-11736.rs b/src/test/run-pass/issue-11736.rs index b09d516dd3592..c6e0a5be76333 100644 --- a/src/test/run-pass/issue-11736.rs +++ b/src/test/run-pass/issue-11736.rs @@ -32,4 +32,3 @@ fn main() { } } } - diff --git a/src/test/run-pass/issue-11820.rs b/src/test/run-pass/issue-11820.rs new file mode 100644 index 0000000000000..f7aaf4953774a --- /dev/null +++ b/src/test/run-pass/issue-11820.rs @@ -0,0 +1,19 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct NoClone; + +fn main() { + let rnc = &NoClone; + let rsnc = &Some(NoClone); + + let _: &NoClone = rnc.clone(); + let _: &Option = rsnc.clone(); +} diff --git a/src/test/run-pass/issue-12729.rs b/src/test/run-pass/issue-12729.rs index 09c0c8604adc2..9bf4c94d7e397 100644 --- a/src/test/run-pass/issue-12729.rs +++ b/src/test/run-pass/issue-12729.rs @@ -18,4 +18,3 @@ mod bar { } } fn main() {} - diff --git a/src/test/run-pass/issue-14421.rs b/src/test/run-pass/issue-14421.rs index c595f98cd0e4a..4bdf5a31c713b 100644 --- a/src/test/run-pass/issue-14421.rs +++ b/src/test/run-pass/issue-14421.rs @@ -19,4 +19,3 @@ pub fn main() { let mut an_A: B = make(); an_A.foo(); } - diff --git a/src/test/run-pass/issue-15155.rs b/src/test/run-pass/issue-15155.rs index 3a63e63355cd0..e1ecaaab026cf 100644 --- a/src/test/run-pass/issue-15155.rs +++ b/src/test/run-pass/issue-15155.rs @@ -28,5 +28,3 @@ fn main() { test_trait::(); test_trait::(); } - - diff --git a/src/test/run-pass/issue-15221.rs b/src/test/run-pass/issue-15221.rs index 49e5b14aff805..6310ce39d99db 100644 --- a/src/test/run-pass/issue-15221.rs +++ b/src/test/run-pass/issue-15221.rs @@ -20,4 +20,3 @@ fn main() { let outer!(g1) = 13; g1; } - diff --git a/src/test/run-pass/issue-16151.rs b/src/test/run-pass/issue-16151.rs index 5401d6a6fdced..60d5ea8c84cee 100644 --- a/src/test/run-pass/issue-16151.rs +++ b/src/test/run-pass/issue-16151.rs @@ -35,4 +35,3 @@ fn main() { assert_eq!(DROP_COUNT, 3); } } - diff --git a/src/test/run-pass/issue-16278.rs b/src/test/run-pass/issue-16278.rs index ade312da21b70..41af72db20089 100644 --- a/src/test/run-pass/issue-16278.rs +++ b/src/test/run-pass/issue-16278.rs @@ -17,4 +17,3 @@ fn main() {assert_eq!(b"", b"\ assert_eq!(b"\n", b" "); } - diff --git a/src/test/run-pass/issue-16452.rs b/src/test/run-pass/issue-16452.rs index da480207490ca..f89dbfd2da939 100644 --- a/src/test/run-pass/issue-16452.rs +++ b/src/test/run-pass/issue-16452.rs @@ -14,4 +14,3 @@ fn main() { () => { static MAGIC: uint = 0; } } } - diff --git a/src/test/run-pass/issue-16597.rs b/src/test/run-pass/issue-16597.rs index 72e948e613b2e..d074095dbdedd 100644 --- a/src/test/run-pass/issue-16597.rs +++ b/src/test/run-pass/issue-16597.rs @@ -15,5 +15,5 @@ mod test { use super::*; #[test] - fn test(){} + pub fn test(){} } diff --git a/src/test/run-pass/issue-16922.rs b/src/test/run-pass/issue-16922.rs new file mode 100644 index 0000000000000..25909bcbfe9a8 --- /dev/null +++ b/src/test/run-pass/issue-16922.rs @@ -0,0 +1,18 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::any::Any; + +fn foo(_: &u8) { +} + +fn main() { + let _ = &foo as &Any; +} diff --git a/src/test/run-pass/issue-19982.rs b/src/test/run-pass/issue-19982.rs new file mode 100644 index 0000000000000..3082fc27a7dec --- /dev/null +++ b/src/test/run-pass/issue-19982.rs @@ -0,0 +1,22 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(core,unboxed_closures)] + +#[allow(dead_code)] +struct Foo; + +impl<'a> Fn<(&'a (),)> for Foo { + type Output = (); + + extern "rust-call" fn call(&self, (_,): (&(),)) {} +} + +fn main() {} diff --git a/src/test/run-pass/issue-20396.rs b/src/test/run-pass/issue-20396.rs new file mode 100644 index 0000000000000..63a88988162a4 --- /dev/null +++ b/src/test/run-pass/issue-20396.rs @@ -0,0 +1,23 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] + +trait Foo { + fn noop(&self, _: T); +} + +enum Bar { Bla(T) } + +struct Baz<'a> { + inner: for<'b> Foo> + 'a, +} + +fn main() {} diff --git a/src/test/run-pass/issue-20823.rs b/src/test/run-pass/issue-20823.rs index 561b61954768e..c297998b6493a 100644 --- a/src/test/run-pass/issue-20823.rs +++ b/src/test/run-pass/issue-20823.rs @@ -14,4 +14,4 @@ #![deny(unstable)] #[test] -fn foo() {} +pub fn foo() {} diff --git a/src/test/run-pass/issue-21520.rs b/src/test/run-pass/issue-21520.rs index 3a813641a3f37..6eed357415226 100644 --- a/src/test/run-pass/issue-21520.rs +++ b/src/test/run-pass/issue-21520.rs @@ -26,4 +26,3 @@ struct Bar } fn main() { } - diff --git a/src/test/run-pass/issue-2214.rs b/src/test/run-pass/issue-2214.rs index a319ee5e600cc..1dcbfd92fa05a 100644 --- a/src/test/run-pass/issue-2214.rs +++ b/src/test/run-pass/issue-2214.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-2383.rs b/src/test/run-pass/issue-2383.rs index a5a05283f80fd..9599a90895079 100644 --- a/src/test/run-pass/issue-2383.rs +++ b/src/test/run-pass/issue-2383.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index ae146d8d35356..3a1178c2824cb 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-2804-2.rs b/src/test/run-pass/issue-2804-2.rs index 952ea1e9d3de7..4f89d28332a23 100644 --- a/src/test/run-pass/issue-2804-2.rs +++ b/src/test/run-pass/issue-2804-2.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs index 25b933b8f96fe..b9b5aec62fcda 100644 --- a/src/test/run-pass/issue-2804.rs +++ b/src/test/run-pass/issue-2804.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index b55f369135868..3f954c3c9180d 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-3026.rs b/src/test/run-pass/issue-3026.rs index 98c9f3d5ec5ad..8da1549684471 100644 --- a/src/test/run-pass/issue-3026.rs +++ b/src/test/run-pass/issue-3026.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/issue-3979.rs b/src/test/run-pass/issue-3979.rs index 4f69342830b93..36939a2877ec0 100644 --- a/src/test/run-pass/issue-3979.rs +++ b/src/test/run-pass/issue-3979.rs @@ -1,4 +1,3 @@ - // 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. diff --git a/src/test/run-pass/issue-4759.rs b/src/test/run-pass/issue-4759.rs index 2245e80971a90..142f088a68469 100644 --- a/src/test/run-pass/issue-4759.rs +++ b/src/test/run-pass/issue-4759.rs @@ -25,4 +25,3 @@ pub fn main() { let T { a: a } = T { a: box 0 }; a.f(); } - diff --git a/src/test/run-pass/issue-5060.rs b/src/test/run-pass/issue-5060.rs index 7c3b0a5f1f014..5726f236e2e0b 100644 --- a/src/test/run-pass/issue-5060.rs +++ b/src/test/run-pass/issue-5060.rs @@ -24,4 +24,3 @@ macro_rules! print_hd_tl { pub fn main() { print_hd_tl!(x, y, z, w) } - diff --git a/src/test/run-pass/issue-5666.rs b/src/test/run-pass/issue-5666.rs index 4f304e3b4361c..e28a929d52723 100644 --- a/src/test/run-pass/issue-5666.rs +++ b/src/test/run-pass/issue-5666.rs @@ -35,4 +35,3 @@ pub fn main() { println!("{}", pup.bark()); } } - diff --git a/src/test/run-pass/issue-5950.rs b/src/test/run-pass/issue-5950.rs index c9413258e0fb8..88bbba44bbe14 100644 --- a/src/test/run-pass/issue-5950.rs +++ b/src/test/run-pass/issue-5950.rs @@ -11,6 +11,6 @@ pub use local as local_alias; -mod local { } +pub mod local { } pub fn main() {} diff --git a/src/test/run-pass/issue-6318.rs b/src/test/run-pass/issue-6318.rs index 6e608d34bd578..61bc70465e0f2 100644 --- a/src/test/run-pass/issue-6318.rs +++ b/src/test/run-pass/issue-6318.rs @@ -28,4 +28,3 @@ pub fn main() { Thing::A(_a) => 0, }; } - diff --git a/src/test/run-pass/issue-6919.rs b/src/test/run-pass/issue-6919.rs index c684c4d897b04..10dae96d88d94 100644 --- a/src/test/run-pass/issue-6919.rs +++ b/src/test/run-pass/issue-6919.rs @@ -16,4 +16,3 @@ extern crate issue6919_3; pub fn main() { let _ = issue6919_3::D.k; } - diff --git a/src/test/run-pass/issue-7222.rs b/src/test/run-pass/issue-7222.rs index 65ea895c2c85f..0ca4e428bc403 100644 --- a/src/test/run-pass/issue-7222.rs +++ b/src/test/run-pass/issue-7222.rs @@ -16,4 +16,3 @@ pub fn main() { _ => () } } - diff --git a/src/test/run-pass/issue-7607-2.rs b/src/test/run-pass/issue-7607-2.rs index c52051fab96e3..a0408a0359070 100644 --- a/src/test/run-pass/issue-7607-2.rs +++ b/src/test/run-pass/issue-7607-2.rs @@ -20,5 +20,3 @@ pub mod b { } pub fn main() { } - - diff --git a/src/test/run-pass/issue-8248.rs b/src/test/run-pass/issue-8248.rs index 7bc8dbe616ff3..3800564b867ba 100644 --- a/src/test/run-pass/issue-8248.rs +++ b/src/test/run-pass/issue-8248.rs @@ -20,4 +20,3 @@ pub fn main() { let mut b = B; foo(&mut b as &mut A); } - diff --git a/src/test/run-pass/issue-8249.rs b/src/test/run-pass/issue-8249.rs index 83c9e9bf45053..10d3ade648d0c 100644 --- a/src/test/run-pass/issue-8249.rs +++ b/src/test/run-pass/issue-8249.rs @@ -24,4 +24,3 @@ fn foo(a: &mut A) { pub fn main() { } - diff --git a/src/test/run-pass/issue-8398.rs b/src/test/run-pass/issue-8398.rs index e52e3295c6e0b..f8065d0bcd363 100644 --- a/src/test/run-pass/issue-8398.rs +++ b/src/test/run-pass/issue-8398.rs @@ -15,4 +15,3 @@ fn foo(a: &mut old_io::Writer) { } pub fn main(){} - diff --git a/src/test/run-pass/issue-9188.rs b/src/test/run-pass/issue-9188.rs index 31797deccf91c..73d3b35593569 100644 --- a/src/test/run-pass/issue-9188.rs +++ b/src/test/run-pass/issue-9188.rs @@ -17,4 +17,3 @@ pub fn main() { let b = issue_9188::foo::(); assert_eq!(*a, *b); } - diff --git a/src/test/run-pass/issue-9951.rs b/src/test/run-pass/issue-9951.rs new file mode 100644 index 0000000000000..210f647e5be2f --- /dev/null +++ b/src/test/run-pass/issue-9951.rs @@ -0,0 +1,28 @@ +// Copyright 2015 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(unused_variables)] + +trait Bar { + fn noop(&self); +} +impl Bar for u8 { + fn noop(&self) {} +} + +fn main() { + let (a, b) = (&5u8 as &Bar, &9u8 as &Bar); + let (c, d): (&Bar, &Bar) = (a, b); + + let (a, b) = (Box::new(5u8) as Box, Box::new(9u8) as Box); + let (c, d): (&Bar, &Bar) = (&*a, &*b); + + let (c, d): (&Bar, &Bar) = (&5, &9); +} diff --git a/src/test/run-pass/kindck-implicit-close-over-mut-var.rs b/src/test/run-pass/kindck-implicit-close-over-mut-var.rs index f2d509ee61ddd..9d6ca1e9cfb10 100644 --- a/src/test/run-pass/kindck-implicit-close-over-mut-var.rs +++ b/src/test/run-pass/kindck-implicit-close-over-mut-var.rs @@ -50,4 +50,3 @@ fn car() { } pub fn main() {} - diff --git a/src/test/run-pass/kinds-in-metadata.rs b/src/test/run-pass/kinds-in-metadata.rs index 233db83d289bd..bd75f547507c7 100644 --- a/src/test/run-pass/kinds-in-metadata.rs +++ b/src/test/run-pass/kinds-in-metadata.rs @@ -22,4 +22,3 @@ use kinds_in_metadata::f; pub fn main() { f::(); } - diff --git a/src/test/run-pass/loop-label-shadowing.rs b/src/test/run-pass/loop-label-shadowing.rs index d96ff869fa0ab..090872e69eadb 100644 --- a/src/test/run-pass/loop-label-shadowing.rs +++ b/src/test/run-pass/loop-label-shadowing.rs @@ -16,4 +16,3 @@ fn main() { foo.push(*i); } } - diff --git a/src/test/run-pass/macro-delimiter-significance.rs b/src/test/run-pass/macro-delimiter-significance.rs index 01362f0f83f90..a2ae3fbf83b0f 100644 --- a/src/test/run-pass/macro-delimiter-significance.rs +++ b/src/test/run-pass/macro-delimiter-significance.rs @@ -11,4 +11,3 @@ fn main() { vec![1_usize, 2, 3].len(); } - diff --git a/src/test/run-pass/macro-meta-items.rs b/src/test/run-pass/macro-meta-items.rs index 47e3a0723993e..605cade2b3f7e 100644 --- a/src/test/run-pass/macro-meta-items.rs +++ b/src/test/run-pass/macro-meta-items.rs @@ -38,4 +38,3 @@ pub fn main() { emit!(baz); println!("{}", MISTYPED); } - diff --git a/src/test/run-pass/macro-method-issue-4621.rs b/src/test/run-pass/macro-method-issue-4621.rs index fd16958d8964b..c58a03014246c 100644 --- a/src/test/run-pass/macro-method-issue-4621.rs +++ b/src/test/run-pass/macro-method-issue-4621.rs @@ -16,6 +16,3 @@ impl A { make_thirteen_method!(); } fn main() { assert_eq!(A.thirteen(),13); } - - - diff --git a/src/test/run-pass/macro-with-attrs2.rs b/src/test/run-pass/macro-with-attrs2.rs index d683979462bd2..b56dff6b01fc5 100644 --- a/src/test/run-pass/macro-with-attrs2.rs +++ b/src/test/run-pass/macro-with-attrs2.rs @@ -17,4 +17,3 @@ macro_rules! foo { () => (2) } pub fn main() { assert_eq!(foo!(), 2); } - diff --git a/src/test/run-pass/method-normalize-bounds-issue-20604.rs b/src/test/run-pass/method-normalize-bounds-issue-20604.rs index 73489948da5de..5ba5d7f8d7227 100644 --- a/src/test/run-pass/method-normalize-bounds-issue-20604.rs +++ b/src/test/run-pass/method-normalize-bounds-issue-20604.rs @@ -62,4 +62,3 @@ fn foo>(map: &Map) { } fn main() {} - diff --git a/src/test/run-pass/mid-path-type-params.rs b/src/test/run-pass/mid-path-type-params.rs index 4a04a71f9a016..85c05d408e8ab 100644 --- a/src/test/run-pass/mid-path-type-params.rs +++ b/src/test/run-pass/mid-path-type-params.rs @@ -40,4 +40,3 @@ pub fn main() { let _ = S::::new::(1, 1.0); let _: S2 = Trait::::new::(1, 1.0); } - diff --git a/src/test/run-pass/mod-view-items.rs b/src/test/run-pass/mod-view-items.rs index f03ec7b6f3e12..1513eb8883527 100644 --- a/src/test/run-pass/mod-view-items.rs +++ b/src/test/run-pass/mod-view-items.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/namespaced-enum-emulate-flat-xc.rs b/src/test/run-pass/namespaced-enum-emulate-flat-xc.rs index 680cdf14e8f2a..ea7e05d24e2f3 100644 --- a/src/test/run-pass/namespaced-enum-emulate-flat-xc.rs +++ b/src/test/run-pass/namespaced-enum-emulate-flat-xc.rs @@ -28,4 +28,3 @@ fn _f2(f: Bar) { } pub fn main() {} - diff --git a/src/test/run-pass/namespaced-enums-xcrate.rs b/src/test/run-pass/namespaced-enums-xcrate.rs index 7545908dcbbf6..3b56d6c59a162 100644 --- a/src/test/run-pass/namespaced-enums-xcrate.rs +++ b/src/test/run-pass/namespaced-enums-xcrate.rs @@ -21,4 +21,3 @@ fn _foo (f: Foo) { } pub fn main() {} - diff --git a/src/test/run-pass/new-box.rs b/src/test/run-pass/new-box.rs index 1f2207ad87378..3e4665bb231f4 100644 --- a/src/test/run-pass/new-box.rs +++ b/src/test/run-pass/new-box.rs @@ -39,4 +39,3 @@ fn main() { f(box 1234); g(box Struct as Box); } - diff --git a/src/test/run-pass/overloaded-calls-simple.rs b/src/test/run-pass/overloaded-calls-simple.rs index f9e838d9b3d34..d18a91c545280 100644 --- a/src/test/run-pass/overloaded-calls-simple.rs +++ b/src/test/run-pass/overloaded-calls-simple.rs @@ -70,4 +70,3 @@ fn main() { let ans = s(3, 1); assert_eq!(ans, 27); } - diff --git a/src/test/run-pass/overloaded-calls-zero-args.rs b/src/test/run-pass/overloaded-calls-zero-args.rs index ce7395673b390..78e84b9d55bca 100644 --- a/src/test/run-pass/overloaded-calls-zero-args.rs +++ b/src/test/run-pass/overloaded-calls-zero-args.rs @@ -32,5 +32,3 @@ fn main() { let ans = s(); assert_eq!(ans, 9); } - - diff --git a/src/test/run-pass/placement-new-arena.rs b/src/test/run-pass/placement-new-arena.rs index 7ad93d271a989..c4cf8357baa61 100644 --- a/src/test/run-pass/placement-new-arena.rs +++ b/src/test/run-pass/placement-new-arena.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/ranges-precedence.rs b/src/test/run-pass/ranges-precedence.rs index 41ed9a74d1310..18afcdd7f3f79 100644 --- a/src/test/run-pass/ranges-precedence.rs +++ b/src/test/run-pass/ranges-precedence.rs @@ -58,4 +58,3 @@ fn main() { let y = ..; assert!(y == (..)); } - diff --git a/src/test/run-pass/self-shadowing-import.rs b/src/test/run-pass/self-shadowing-import.rs index 19fdd04069edb..47380287ab65e 100644 --- a/src/test/run-pass/self-shadowing-import.rs +++ b/src/test/run-pass/self-shadowing-import.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/sepcomp-fns-backwards.rs b/src/test/run-pass/sepcomp-fns-backwards.rs index 61f008ad854eb..35a8c9330bff3 100644 --- a/src/test/run-pass/sepcomp-fns-backwards.rs +++ b/src/test/run-pass/sepcomp-fns-backwards.rs @@ -38,4 +38,3 @@ fn main() { assert_eq!(a::two(), 2); assert_eq!(b::three(), 3); } - diff --git a/src/test/run-pass/sepcomp-statics.rs b/src/test/run-pass/sepcomp-statics.rs index 26a5c4d1c5026..0e8d33f74f806 100644 --- a/src/test/run-pass/sepcomp-statics.rs +++ b/src/test/run-pass/sepcomp-statics.rs @@ -36,4 +36,3 @@ fn main() { assert_eq!(a::TWO, 2); assert_eq!(b::THREE, 3); } - diff --git a/src/test/run-pass/struct-aliases-xcrate.rs b/src/test/run-pass/struct-aliases-xcrate.rs index 9046cafe7579a..7d99a2d1dcf54 100644 --- a/src/test/run-pass/struct-aliases-xcrate.rs +++ b/src/test/run-pass/struct-aliases-xcrate.rs @@ -28,4 +28,3 @@ fn main() { } } } - diff --git a/src/test/run-pass/struct-aliases.rs b/src/test/run-pass/struct-aliases.rs index 2cf961a5c0c94..2e24bb64bedb7 100644 --- a/src/test/run-pass/struct-aliases.rs +++ b/src/test/run-pass/struct-aliases.rs @@ -30,4 +30,3 @@ fn main() { } } } - diff --git a/src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs b/src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs index 7c99c968e3523..df3c9a0f119ec 100644 --- a/src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs +++ b/src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs @@ -13,8 +13,7 @@ extern crate test; #[bench] -fn bench_explicit_return_type(_: &mut ::test::Bencher) -> () {} +pub fn bench_explicit_return_type(_: &mut ::test::Bencher) -> () {} #[test] -fn test_explicit_return_type() -> () {} - +pub fn test_explicit_return_type() -> () {} diff --git a/src/test/run-pass/test-should-fail-good-message.rs b/src/test/run-pass/test-should-fail-good-message.rs index b8e05b4d35ab7..28698499303a9 100644 --- a/src/test/run-pass/test-should-fail-good-message.rs +++ b/src/test/run-pass/test-should-fail-good-message.rs @@ -13,14 +13,12 @@ #[test] #[should_panic(expected = "foo")] -fn test_foo() { +pub fn test_foo() { panic!("foo bar") } #[test] #[should_panic(expected = "foo")] -fn test_foo_dynamic() { +pub fn test_foo_dynamic() { panic!("{} bar", "foo") } - - diff --git a/src/test/run-pass/trait-bounds-impl-comparison-duplicates.rs b/src/test/run-pass/trait-bounds-impl-comparison-duplicates.rs index 5b744a4413271..5c913f7921d7d 100644 --- a/src/test/run-pass/trait-bounds-impl-comparison-duplicates.rs +++ b/src/test/run-pass/trait-bounds-impl-comparison-duplicates.rs @@ -21,5 +21,3 @@ impl A for int { } fn main() {} - - diff --git a/src/test/run-pass/trait-coercion-generic.rs b/src/test/run-pass/trait-coercion-generic.rs index 1565ccfe459d2..96203ba47793a 100644 --- a/src/test/run-pass/trait-coercion-generic.rs +++ b/src/test/run-pass/trait-coercion-generic.rs @@ -32,4 +32,3 @@ pub fn main() { let c: &Trait<&'static str> = &a; c.f("Joe"); } - diff --git a/src/test/run-pass/trait-coercion.rs b/src/test/run-pass/trait-coercion.rs index 6db7113b0504c..b02f8eb0aa9d5 100644 --- a/src/test/run-pass/trait-coercion.rs +++ b/src/test/run-pass/trait-coercion.rs @@ -45,4 +45,3 @@ pub fn main() { let out = old_io::stdout(); foo(Box::new(out)); } - diff --git a/src/test/run-pass/trait-contravariant-self.rs b/src/test/run-pass/trait-contravariant-self.rs index 19d76b8890118..17c68d64948ed 100644 --- a/src/test/run-pass/trait-contravariant-self.rs +++ b/src/test/run-pass/trait-contravariant-self.rs @@ -38,5 +38,3 @@ fn main() { let x: Box = (box SFoo); wants_bar(&x); } - - diff --git a/src/test/run-pass/trait-inheritance-num.rs b/src/test/run-pass/trait-inheritance-num.rs index 9a30d51f4c5ac..5fb28eb9d8dd2 100644 --- a/src/test/run-pass/trait-inheritance-num.rs +++ b/src/test/run-pass/trait-inheritance-num.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/trait-inheritance-num0.rs b/src/test/run-pass/trait-inheritance-num0.rs index d68b6a54f7135..183d6659062fe 100644 --- a/src/test/run-pass/trait-inheritance-num0.rs +++ b/src/test/run-pass/trait-inheritance-num0.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/trait-inheritance-num2.rs b/src/test/run-pass/trait-inheritance-num2.rs index f89eea46090d0..1fb28c50652b4 100644 --- a/src/test/run-pass/trait-inheritance-num2.rs +++ b/src/test/run-pass/trait-inheritance-num2.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/trait-static-method-overwriting.rs b/src/test/run-pass/trait-static-method-overwriting.rs index 10439d5c86aa3..31968da6ee310 100644 --- a/src/test/run-pass/trait-static-method-overwriting.rs +++ b/src/test/run-pass/trait-static-method-overwriting.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/ufcs-explicit-self.rs b/src/test/run-pass/ufcs-explicit-self.rs index 832c1f8802d1f..810148b012d13 100644 --- a/src/test/run-pass/ufcs-explicit-self.rs +++ b/src/test/run-pass/ufcs-explicit-self.rs @@ -57,4 +57,3 @@ fn main() { let bar: Box> = bar; println!("{} {} {}", bar.foo(2), bar.bar(2), bar.baz(2)); } - diff --git a/src/test/run-pass/unboxed-closures-all-traits.rs b/src/test/run-pass/unboxed-closures-all-traits.rs index 7e71e1da462fd..b4b0d2b014852 100644 --- a/src/test/run-pass/unboxed-closures-all-traits.rs +++ b/src/test/run-pass/unboxed-closures-all-traits.rs @@ -28,4 +28,3 @@ fn main() { assert_eq!(b(move |x: int, y| x + y + z), 14); assert_eq!(c(move |x: int, y| x + y + z), 18); } - diff --git a/src/test/run-pass/unboxed-closures-boxed.rs b/src/test/run-pass/unboxed-closures-boxed.rs index d515ccf2ec0a5..5dea6a7c6db3b 100644 --- a/src/test/run-pass/unboxed-closures-boxed.rs +++ b/src/test/run-pass/unboxed-closures-boxed.rs @@ -25,4 +25,3 @@ pub fn main() { println!("{}", z); assert_eq!(z, 5); } - diff --git a/src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs b/src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs index 52311544297ae..271381f520e38 100644 --- a/src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs +++ b/src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs @@ -26,4 +26,3 @@ pub fn main() { println!("{}", z); assert_eq!(z, 5); } - diff --git a/src/test/run-pass/unboxed-closures-call-sugar-object.rs b/src/test/run-pass/unboxed-closures-call-sugar-object.rs index a34799fdcc543..e51e35d2c65c9 100644 --- a/src/test/run-pass/unboxed-closures-call-sugar-object.rs +++ b/src/test/run-pass/unboxed-closures-call-sugar-object.rs @@ -24,4 +24,3 @@ pub fn main() { println!("{}", z); assert_eq!(z, 5); } - diff --git a/src/test/run-pass/unboxed-closures-direct-sugary-call.rs b/src/test/run-pass/unboxed-closures-direct-sugary-call.rs index 0c49c81517086..6b2dcfa69b4ef 100644 --- a/src/test/run-pass/unboxed-closures-direct-sugary-call.rs +++ b/src/test/run-pass/unboxed-closures-direct-sugary-call.rs @@ -14,4 +14,3 @@ fn main() { let mut unboxed = || {}; unboxed(); } - diff --git a/src/test/run-pass/unboxed-closures-drop.rs b/src/test/run-pass/unboxed-closures-drop.rs index f4a24c17e6e99..e61d454023f5a 100644 --- a/src/test/run-pass/unboxed-closures-drop.rs +++ b/src/test/run-pass/unboxed-closures-drop.rs @@ -124,4 +124,3 @@ fn main() { test_fn_mut(); test_fn_once(); } - diff --git a/src/test/run-pass/unboxed-closures-extern-fn-hr.rs b/src/test/run-pass/unboxed-closures-extern-fn-hr.rs index df753f0f33eb6..6a071f6a4c51f 100644 --- a/src/test/run-pass/unboxed-closures-extern-fn-hr.rs +++ b/src/test/run-pass/unboxed-closures-extern-fn-hr.rs @@ -42,4 +42,3 @@ fn main() { assert_eq!(y, square(&22)); assert_eq!(z, square(&22)); } - diff --git a/src/test/run-pass/unboxed-closures-extern-fn.rs b/src/test/run-pass/unboxed-closures-extern-fn.rs index a25f5e265e814..ed941ac0fdb99 100644 --- a/src/test/run-pass/unboxed-closures-extern-fn.rs +++ b/src/test/run-pass/unboxed-closures-extern-fn.rs @@ -37,4 +37,3 @@ fn main() { assert_eq!(y, square(22)); assert_eq!(z, square(22)); } - diff --git a/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs b/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs index 5d6029e703b82..0aab5be2877e1 100644 --- a/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs +++ b/src/test/run-pass/unboxed-closures-fn-as-fnmut-and-fnonce.rs @@ -44,4 +44,3 @@ fn main() { assert_eq!(x, y); assert_eq!(y, z); } - diff --git a/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs b/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs index 95dae41c6840e..a8bb091893271 100644 --- a/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs +++ b/src/test/run-pass/unboxed-closures-fnmut-as-fnonce.rs @@ -39,4 +39,3 @@ fn main() { let z = call_it_once(S, 22); assert_eq!(y, z); } - diff --git a/src/test/run-pass/unboxed-closures-generic.rs b/src/test/run-pass/unboxed-closures-generic.rs index f4af42a866b6d..47936ba938284 100644 --- a/src/test/run-pass/unboxed-closures-generic.rs +++ b/src/test/run-pass/unboxed-closures-generic.rs @@ -22,4 +22,3 @@ pub fn main() { println!("{}", z); assert_eq!(z, 5); } - diff --git a/src/test/run-pass/unboxed-closures-infer-fnmut-calling-fnmut.rs b/src/test/run-pass/unboxed-closures-infer-fnmut-calling-fnmut.rs index 09b8c8f4454b5..17833033492d0 100644 --- a/src/test/run-pass/unboxed-closures-infer-fnmut-calling-fnmut.rs +++ b/src/test/run-pass/unboxed-closures-infer-fnmut-calling-fnmut.rs @@ -26,4 +26,3 @@ fn main() { assert_eq!(counter, 2); } - diff --git a/src/test/run-pass/unboxed-closures-manual-impl.rs b/src/test/run-pass/unboxed-closures-manual-impl.rs index 37075de0405ad..f1b79a1829eab 100644 --- a/src/test/run-pass/unboxed-closures-manual-impl.rs +++ b/src/test/run-pass/unboxed-closures-manual-impl.rs @@ -1,4 +1,3 @@ - // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -37,4 +36,3 @@ fn main() { assert!(x == 4); assert!(y == 4); } - diff --git a/src/test/run-pass/unboxed-closures-prelude.rs b/src/test/run-pass/unboxed-closures-prelude.rs index 16a55ab550d2f..4ed3fa5ca2dac 100644 --- a/src/test/run-pass/unboxed-closures-prelude.rs +++ b/src/test/run-pass/unboxed-closures-prelude.rs @@ -28,4 +28,3 @@ fn main() { fn call int>(f: F, x: int) -> int { f(x) } - diff --git a/src/test/run-pass/unboxed-closures-single-word-env.rs b/src/test/run-pass/unboxed-closures-single-word-env.rs index 9e543f925f82e..84544d6d24b35 100644 --- a/src/test/run-pass/unboxed-closures-single-word-env.rs +++ b/src/test/run-pass/unboxed-closures-single-word-env.rs @@ -31,4 +31,3 @@ fn main() { assert_eq!(b(move |x: int, y| x + y + z), 17); assert_eq!(c(move |x: int, y| x + y + z), 21); } - diff --git a/src/test/run-pass/unboxed-closures-static-call-fn-once.rs b/src/test/run-pass/unboxed-closures-static-call-fn-once.rs index 7a6b68a5e09ec..1f5481ccde955 100644 --- a/src/test/run-pass/unboxed-closures-static-call-fn-once.rs +++ b/src/test/run-pass/unboxed-closures-static-call-fn-once.rs @@ -14,4 +14,3 @@ fn main() { let onetime = |x| x; onetime(0); } - diff --git a/src/test/run-pass/unboxed-closures-zero-args.rs b/src/test/run-pass/unboxed-closures-zero-args.rs index 8e3d44df798a7..c81b0515aec6b 100644 --- a/src/test/run-pass/unboxed-closures-zero-args.rs +++ b/src/test/run-pass/unboxed-closures-zero-args.rs @@ -14,4 +14,3 @@ fn main() { let mut zero = || {}; let () = zero(); } - diff --git a/src/test/run-pass/use.rs b/src/test/run-pass/use.rs index 65a392e63c510..c25cd15b2cd4b 100644 --- a/src/test/run-pass/use.rs +++ b/src/test/run-pass/use.rs @@ -1,4 +1,3 @@ - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/variance-trait-matching.rs b/src/test/run-pass/variance-trait-matching.rs index 10441bee3cb9f..d46ffa801836f 100644 --- a/src/test/run-pass/variance-trait-matching.rs +++ b/src/test/run-pass/variance-trait-matching.rs @@ -45,5 +45,3 @@ fn main() { let y = get(&x); assert_eq!(y, 23); } - - diff --git a/src/test/run-pass/visible-private-types-feature-gate.rs b/src/test/run-pass/visible-private-types-feature-gate.rs index 46e93b25697bb..3060c12d39aa6 100644 --- a/src/test/run-pass/visible-private-types-feature-gate.rs +++ b/src/test/run-pass/visible-private-types-feature-gate.rs @@ -19,4 +19,3 @@ struct Baz; pub fn f(_: Baz) {} fn main() {} - diff --git a/src/test/run-pass/where-clause-method-substituion.rs b/src/test/run-pass/where-clause-method-substituion.rs index ecc210ea579db..e2280f0b07b78 100644 --- a/src/test/run-pass/where-clause-method-substituion.rs +++ b/src/test/run-pass/where-clause-method-substituion.rs @@ -27,4 +27,3 @@ impl Bar for i32 { fn main() { 1.method::(); } - diff --git a/src/test/run-pass/where-clauses-cross-crate.rs b/src/test/run-pass/where-clauses-cross-crate.rs index b822abd67329e..6a2fec7260af0 100644 --- a/src/test/run-pass/where-clauses-cross-crate.rs +++ b/src/test/run-pass/where-clauses-cross-crate.rs @@ -20,4 +20,3 @@ fn main() { println!("{}", "hello".equal(&"hello")); println!("{}", "hello".equals::(&1, &1, &"foo", &"bar")); } - diff --git a/src/test/run-pass/where-clauses-unboxed-closures.rs b/src/test/run-pass/where-clauses-unboxed-closures.rs index 7edcdf6429223..dbff4b9599b78 100644 --- a/src/test/run-pass/where-clauses-unboxed-closures.rs +++ b/src/test/run-pass/where-clauses-unboxed-closures.rs @@ -23,4 +23,3 @@ fn main() { // OK warm_up(|b| () ); } - diff --git a/src/test/run-pass/where-clauses.rs b/src/test/run-pass/where-clauses.rs index 92bc7edf28564..0f0741dcea738 100644 --- a/src/test/run-pass/where-clauses.rs +++ b/src/test/run-pass/where-clauses.rs @@ -34,4 +34,3 @@ fn main() { println!("{}", "hello".equal(&"hello")); println!("{}", "hello".equals::(&1, &1, &"foo", &"bar")); } - diff --git a/src/test/run-pass/where-for-self.rs b/src/test/run-pass/where-for-self.rs index 67757d7efa837..4e841029a6b20 100644 --- a/src/test/run-pass/where-for-self.rs +++ b/src/test/run-pass/where-for-self.rs @@ -62,4 +62,3 @@ fn main() { assert!(COUNT == 12); } } -