about summary refs log tree commit diff
path: root/src/test/compile-fail/lint-dead-code-1.rs
AgeCommit message (Collapse)AuthorLines
2018-08-14Moved compile-fail tests to ui tests.David Wood-116/+0
2018-07-21dead-code lint: say "constructed" for structsZack M. Davis-2/+2
This is a sequel to November 2017's #46103 / 1a9dc2e9. It had been reported (more than once—at least #19140, #44083, and #44565) that the "never used" language was confusing for enum variants that were "used" as match patterns, so the wording was changed to say never "constructed" specifically for enum variants. More recently, the same issue was raised for structs (#52325). It seems consistent to say "constructed" here, too, for the same reasons. We considered using more specific word "called" for unused functions and methods (while we declined to do this in #46103, the rationale given in the commit message doesn't actually make sense), but it turns out that Cargo's test suite expects the "never used" message, and maybe we don't care enough even to make a Cargo PR over such a petty and subjective wording change. This resolves #52325.
2017-11-19dead code lint to say "never constructed" for variantsZack M. Davis-1/+1
As reported in #19140, #44083, and #44565, some users were confused when the dead-code lint reported an enum variant to be "unused" when it was matched on (but not constructed). This wording change makes it clearer that the lint is in fact checking for construction. We continue to say "used" for all other items (it's tempting to say "called" for functions and methods, but this turns out not to be correct: functions can be passed as arguments and the dead-code lint isn't special-casing that or anything). Resolves #19140.
2015-12-18Fix the falloutVadim Petrochenkov-1/+1
2015-12-05std: Stabilize APIs for the 1.6 releaseAlex Crichton-1/+0
This commit is the standard API stabilization commit for the 1.6 release cycle. The list of issues and APIs below have all been through their cycle-long FCP and the libs team decisions are listed below Stabilized APIs * `Read::read_exact` * `ErrorKind::UnexpectedEof` (renamed from `UnexpectedEOF`) * libcore -- this was a bit of a nuanced stabilization, the crate itself is now marked as `#[stable]` and the methods appearing via traits for primitives like `char` and `str` are now also marked as stable. Note that the extension traits themeselves are marked as unstable as they're imported via the prelude. The `try!` macro was also moved from the standard library into libcore to have the same interface. Otherwise the functions all have copied stability from the standard library now. * The `#![no_std]` attribute * `fs::DirBuilder` * `fs::DirBuilder::new` * `fs::DirBuilder::recursive` * `fs::DirBuilder::create` * `os::unix::fs::DirBuilderExt` * `os::unix::fs::DirBuilderExt::mode` * `vec::Drain` * `vec::Vec::drain` * `string::Drain` * `string::String::drain` * `vec_deque::Drain` * `vec_deque::VecDeque::drain` * `collections::hash_map::Drain` * `collections::hash_map::HashMap::drain` * `collections::hash_set::Drain` * `collections::hash_set::HashSet::drain` * `collections::binary_heap::Drain` * `collections::binary_heap::BinaryHeap::drain` * `Vec::extend_from_slice` (renamed from `push_all`) * `Mutex::get_mut` * `Mutex::into_inner` * `RwLock::get_mut` * `RwLock::into_inner` * `Iterator::min_by_key` (renamed from `min_by`) * `Iterator::max_by_key` (renamed from `max_by`) Deprecated APIs * `ErrorKind::UnexpectedEOF` (renamed to `UnexpectedEof`) * `OsString::from_bytes` * `OsStr::to_cstring` * `OsStr::to_bytes` * `fs::walk_dir` and `fs::WalkDir` * `path::Components::peek` * `slice::bytes::MutableByteVector` * `slice::bytes::copy_memory` * `Vec::push_all` (renamed to `extend_from_slice`) * `Duration::span` * `IpAddr` * `SocketAddr::ip` * `Read::tee` * `io::Tee` * `Write::broadcast` * `io::Broadcast` * `Iterator::min_by` (renamed to `min_by_key`) * `Iterator::max_by` (renamed to `max_by_key`) * `net::lookup_addr` New APIs (still unstable) * `<[T]>::sort_by_key` (added to mirror `min_by_key`) Closes #27585 Closes #27704 Closes #27707 Closes #27710 Closes #27711 Closes #27727 Closes #27740 Closes #27744 Closes #27799 Closes #27801 cc #27801 (doesn't close as `Chars` is still unstable) Closes #28968
2015-08-03syntax: Implement #![no_core]Alex Crichton-3/+0
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The `#![no_std]` attribute now injects `extern crate core` at the top of the crate as well as the libcore prelude into all modules (in the same manner as the standard library's prelude). The `#![no_core]` attribute disables both std and core injection. [rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-02-07Feature-gate #![no_std]Keegan McAllister-0/+1
Fixes #21833. [breaking-change]
2015-02-03Switch missing_copy_implementations to default-allowSteven Fackler-1/+0
This was particularly helpful in the time just after OIBIT's implementation to make sure things that were supposed to be Copy continued to be, but it's now creates a lot of noise for types that intentionally don't want to be Copy.
2015-01-31Kill more `isize`sTobias Bucher-1/+1
2015-01-23Set unstable feature names appropriatelyBrian Anderson-1/+1
* `core` - for the core crate * `hash` - hashing * `io` - io * `path` - path * `alloc` - alloc crate * `rand` - rand crate * `collections` - collections crate * `std_misc` - other parts of std * `test` - test crate * `rustc_private` - everything else
2015-01-21Fix up some tests for feature stagingBrian Anderson-0/+1
2015-01-21Tie stability attributes to feature gatesBrian Anderson-1/+0
2015-01-17Add allow(unstable) to tests that need itBrian Anderson-0/+1
2015-01-08Update compile-fail tests to use is/us, not i/u.Huon Wilson-1/+1
2015-01-08Update compile fail tests to use isize.Huon Wilson-15/+15
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-0/+1
This change makes the compiler no longer infer whether types (structures and enumerations) implement the `Copy` trait (and thus are implicitly copyable). Rather, you must implement `Copy` yourself via `impl Copy for MyType {}`. A new warning has been added, `missing_copy_implementations`, to warn you if a non-generic public type has been added that could have implemented `Copy` but didn't. For convenience, you may *temporarily* opt out of this behavior by using `#![feature(opt_out_copy)]`. Note though that this feature gate will never be accepted and will be removed by the time that 1.0 is released, so you should transition your code away from using it. This breaks code like: #[deriving(Show)] struct Point2D { x: int, y: int, } fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } Change this code to: #[deriving(Show)] struct Point2D { x: int, y: int, } impl Copy for Point2D {} fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } This is the backwards-incompatible part of #13231. Part of RFC #3. [breaking-change]
2014-11-17Switch to purely namespaced enumsSteven Fackler-2/+2
This breaks code that referred to variant names in the same namespace as their enum. Reexport the variants in the old location or alter code to refer to the new locations: ``` pub enum Foo { A, B } fn main() { let a = A; } ``` => ``` pub use self::Foo::{A, B}; pub enum Foo { A, B } fn main() { let a = A; } ``` or ``` pub enum Foo { A, B } fn main() { let a = Foo::A; } ``` [breaking-change]
2014-10-28Update code with new lint namesAaron Turon-2/+2
2014-10-13rustc: Remove the dummy hack from check_matchAlex Crichton-3/+7
Turns out you can create &'static T quite easily in a constant, I just forgot about this!
2014-10-12rustc: Warn about dead constantsAlex Crichton-0/+7
A few catch-all blocks ended up not having this case for constants. Closes #17925
2014-10-09test: Convert statics to constantsAlex Crichton-11/+5
Additionally, add lots of tests for new functionality around statics and `static mut`.
2014-10-03Set the `non_uppercase_statics` lint to warn by defaultP1start-0/+1
2014-09-25auto merge of #17428 : fhahn/rust/issue-16114-rename-begin-unwind-2, ↵bors-1/+1
r=alexcrichton This is a PR for #16114 and includes to following things: * Rename `begin_unwind` lang item to `fail_fmt` * Rename `core::failure::begin_unwind` to `fail_impl` * Rename `fail_` lang item to `fail`
2014-09-25Rename `fail_` lang item to `fail`, closes #16114Florian Hahn-1/+1
2014-09-24Use more descriptive names in dead code messagesJakub Wieczorek-8/+8
2014-09-24Add detection of unused enum variantsJakub Wieczorek-1/+5
2014-09-22librustc: Forbid private types in public APIs.Patrick Walton-2/+1
This breaks code like: struct Foo { ... } pub fn make_foo() -> Foo { ... } Change this code to: pub struct Foo { // note `pub` ... } pub fn make_foo() -> Foo { ... } The `visible_private_types` lint has been removed, since it is now an error to attempt to expose a private type in a public API. In its place a `#[feature(visible_private_types)]` gate has been added. Closes #16463. RFC #48. [breaking-change]
2014-06-29librustc: Remove the fallback to `int` for integers and `f64` forPatrick Walton-2/+2
floating point numbers for real. This will break code that looks like: let mut x = 0; while ... { x += 1; } println!("{}", x); Change that code to: let mut x = 0i; while ... { x += 1; } println!("{}", x); Closes #15201. [breaking-change]
2014-06-28Rename all raw pointers as necessaryAlex Crichton-4/+4
2014-06-23librustc: Feature gate lang items and intrinsics.Patrick Walton-0/+1
If you define lang items in your crate, add `#[feature(lang_items)]`. If you define intrinsics (`extern "rust-intrinsic"`), add `#[feature(intrinsics)]`. Closes #12858. [breaking-change]
2014-06-22libsyntax: don't allow enum structs with no fieldsBenjamin Herr-1/+1
Unit-like structs are written as `struct Foo;`, but we erroneously accepted `struct Foo();` and took it to mean the same thing. Now we don't, so use the `struct Foo;` form! [breaking-change]
2014-06-08Remove the dead code identified by the new lintJakub Wieczorek-1/+5
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-2/+2
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-04-23Support unsized types with the `type` keywordNick Cameron-0/+4
2014-03-28Convert most code to new inner attribute syntax.Brian Anderson-6/+6
Closes #2569
2014-03-01rustc: implement a lint for publicly visible private types.Huon Wilson-0/+1
These are types that are in exported type signatures, but are not exported themselves, e.g. struct Foo { ... } pub fn bar() -> Foo { ... } will warn about the Foo. Such types are not listed in documentation, and cannot be named outside the crate in which they are declared, which is very user-unfriendly. cc #10573
2014-02-21Changed NonCamelCaseTypes lint to warn by defaultmr.Shu-0/+1
Added allow(non_camel_case_types) to librustc where necesary Tried to fix problems with non_camel_case_types outside rustc fixed failing tests Docs updated Moved #[allow(non_camel_case_types)] a level higher. markdown.rs reverted Fixed timer that was failing tests Fixed another timer
2014-01-12Mark allowed dead code and lang items as liveKiet Tran-0/+11
Dead code pass now explicitly checks for `#[allow(dead_code)]` and `#[lang=".."]` attributes on items and marks them as live if they have those attributes. The former is done so that if we want to suppress warnings for a group of dead functions, we only have to annotate the "root" of the call chain.
2013-12-16Check even more live Path nodes in dead-code passKiet Tran-0/+4
2013-12-16Mark live codes in struct/enum for dead-code passKiet Tran-0/+8
2013-12-14Check more live Path nodes in dead-code passKiet Tran-14/+20
2013-12-08Add dead-code warning passKiet Tran-0/+69