about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-02-09 16:33:19 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-02-11 12:14:59 -0800
commitbbbb571fee01532f63b105150654db8db0b01bf7 (patch)
treee3d8b2c3105e2c0dfb861ccc43b5f02d876c8518 /src/libsyntax
parent446bc899b28e988f4252beca0d1858e7f7d866b1 (diff)
downloadrust-bbbb571fee01532f63b105150654db8db0b01bf7.tar.gz
rust-bbbb571fee01532f63b105150654db8db0b01bf7.zip
rustc: Fix a number of stability lint holes
There are a number of holes that the stability lint did not previously cover,
including:

* Types
* Bounds on type parameters on functions and impls
* Where clauses
* Imports
* Patterns (structs and enums)

These holes have all been fixed by overriding the `visit_path` function on the
AST visitor instead of a few specialized cases. This change also necessitated a
few stability changes:

* The `collections::fmt` module is now stable (it was already supposed to be).
* The `thread_local::imp::Key` type is now stable (it was already supposed to
  be).
* The `std::rt::{begin_unwind, begin_unwind_fmt}` functions are now stable.
  These are required via the `panic!` macro.
* The `std::old_io::stdio::{println, println_args}` functions are now stable.
  These are required by the `print!` and `println!` macros.
* The `ops::{FnOnce, FnMut, Fn}` traits are now `#[stable]`. This is required to
  make bounds with these traits stable. Note that manual implementations of
  these traits are still gated by default, this stability only allows bounds
  such as `F: FnOnce()`.

Additionally, the compiler now has special logic to ignore its own generated
`__test` module for the `--test` harness in terms of stability.

Closes #8962
Closes #16360
Closes #20327

[breaking-change]
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/test.rs22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs
index 1a8cb2b376a..6511dffa6bf 100644
--- a/src/libsyntax/test.rs
+++ b/src/libsyntax/test.rs
@@ -436,40 +436,28 @@ fn mk_main(cx: &mut TestCtxt) -> P<ast::Item> {
     let sp = ignored_span(cx, DUMMY_SP);
     let ecx = &cx.ext_cx;
 
-    // std::slice::AsSlice
-    let as_slice_path = ecx.path(sp, vec![token::str_to_ident("std"),
-                                          token::str_to_ident("slice"),
-                                          token::str_to_ident("AsSlice")]);
     // test::test_main_static
     let test_main_path = ecx.path(sp, vec![token::str_to_ident("test"),
                                            token::str_to_ident("test_main_static")]);
-    // ::std::os::args
+    // ::std::env::args
     let os_args_path = ecx.path_global(sp, vec![token::str_to_ident("std"),
-                                                token::str_to_ident("os"),
+                                                token::str_to_ident("env"),
                                                 token::str_to_ident("args")]);
-    // use std::slice::AsSlice
-    let as_slice_path = P(nospan(ast::ViewPathSimple(token::str_to_ident("AsSlice"),
-                                                     as_slice_path)));
-    let use_as_slice = ecx.item_use(sp, ast::Inherited, as_slice_path);
-    let use_as_slice = ecx.stmt_item(sp, use_as_slice);
-    // ::std::os::args()
+    // ::std::env::args()
     let os_args_path_expr = ecx.expr_path(os_args_path);
     let call_os_args = ecx.expr_call(sp, os_args_path_expr, vec![]);
-    // ::std::os::args().as_slice()
-    let call_as_slice = ecx.expr_method_call(sp, call_os_args,
-                                             token::str_to_ident("as_slice"), vec![]);
     // test::test_main_static(...)
     let test_main_path_expr = ecx.expr_path(test_main_path);
     let tests_ident_expr = ecx.expr_ident(sp, token::str_to_ident("TESTS"));
     let call_test_main = ecx.expr_call(sp, test_main_path_expr,
-                                       vec![call_as_slice, tests_ident_expr]);
+                                       vec![call_os_args, tests_ident_expr]);
     let call_test_main = ecx.stmt_expr(call_test_main);
     // #![main]
     let main_meta = ecx.meta_word(sp, token::intern_and_get_ident("main"));
     let main_attr = ecx.attribute(sp, main_meta);
     // pub fn main() { ... }
     let main_ret_ty = ecx.ty(sp, ast::TyTup(vec![]));
-    let main_body = ecx.block_all(sp, vec![use_as_slice, call_test_main], None);
+    let main_body = ecx.block_all(sp, vec![call_test_main], None);
     let main = ast::ItemFn(ecx.fn_decl(vec![], main_ret_ty),
                            ast::Unsafety::Normal, ::abi::Rust, empty_generics(), main_body);
     let main = P(ast::Item {