about summary refs log tree commit diff
path: root/src/librustc/lint
AgeCommit message (Collapse)AuthorLines
2015-09-17Correctly walk import lists in AST visitorsVadim Petrochenkov-0/+7
2015-09-17rebasingNick Cameron-21/+13
2015-09-17Change to a multi-trait approachNick Cameron-124/+153
[breaking-change] for lint authors You must now implement LateLintPass or EarlyLintPass as well as LintPass and use either register_late_lint_pass or register_early_lint_pass, rather than register_lint_pass.
2015-09-17Changes to testsNick Cameron-2/+2
2015-09-17Add an early lint pass for lints that operate on the ASTNick Cameron-118/+472
There is a minor [breaking-change] for lint authors - some functions which were previously defined on `lint::Context` have moved to a trait - `LintContext`, you may need to import that trait to avoid name resolution errors.
2015-09-16Auto merge of #28353 - GuillaumeGomez:error_codes, r=Manishearthbors-5/+6
r? @Manishearth This is a work in progress.
2015-09-16Use ast attributes every where (remove HIR attributes).Nick Cameron-45/+11
This could be a [breaking-change] if your lint or syntax extension (is that even possible?) uses HIR attributes or literals.
2015-09-13Add part of new error codes in librustcGuillaume Gomez-5/+6
2015-09-03Move lints to HIRManish Goregaokar-78/+76
2015-09-03Add an intital HIR and lowering stepNick Cameron-2/+37
2015-08-25Respect `--color` when printing early errorsBarosl Lee-2/+3
Currently, `early_error` and `early_warn` in `librustc::session` always use `ColorConfig::Auto`. Modify them to follow the color configuration set by the `--color` option. As colored output is also printed during the early stage, parsing the `--color` option should be done as early as possible. However, there are still some cases when the output needs to be colored before knowing the exact color settings. In these cases, it will be defaulted to `ColorConfig::Auto`, which is the same as before. Fixes #27879.
2015-07-28rustc: Add a --cap-lints flag to the compilerAlex Crichton-1/+16
This commit is an implementation of [RFC 1193][rfc] which adds the ability to the compiler to cap the lint level for the entire compilation session. This flag will ensure that no lints will go above this level, and Cargo will primarily use this flag passing `--cap-lints allow` to all upstream dependencies. [rfc]: https://github.com/rust-lang/rfcs/pull/1193 Closes #27259
2015-07-15Implement lint deprecation/removal…Simonas Kazlauskas-10/+32
and deprecate/remove unsigned_negation lint. This is useful to avoid causing breaking changes in case #![deny(unknown_lints)] is used and lint is removed.
2015-06-18Make a better error message for using #[feature] on stable rustBrian Anderson-36/+1
It now says '#[feature] may not be used on the stable release channel'. I had to convert this error from a lint to a normal compiler error. I left the lint previously-used for this in place since removing it is a breaking change. It will just go unused until the end of time. Fixes #24125
2015-06-11Conver reborrows to .iter() calls where appropriateJoshua Landau-1/+1
2015-06-07change some statics to constantsOliver 'ker' Schneider-3/+2
2015-04-01Fallout out rustcNiko Matsakis-2/+2
2015-03-27Change the trivial cast lints to allow by defaultNick Cameron-2/+2
2015-03-25Change lint names to pluralsNick Cameron-4/+4
2015-03-25Add trivial cast lints.Nick Cameron-1/+14
This permits all coercions to be performed in casts, but adds lints to warn in those cases. Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference. [breaking change] * Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed. * The unused casts lint has gone. * Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are: - You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_` - Casts do not influence inference of integer types. E.g., the following used to type check: ``` let x = 42; let y = &x as *const u32; ``` Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information: ``` let x: u32 = 42; let y = &x as *const u32; ```
2015-03-23Require feature attributes, and add them where necessaryBrian Anderson-1/+1
2015-03-11syntax: gather common fields of impl & trait items into their respective types.Eduard Burtescu-26/+17
2015-03-02Enable recursion for visit_ty in lint visitorIvan Petkov-1/+1
* The lint visitor's visit_ty method did not recurse, and had a reference to the now closed #10894 * The newly enabled recursion has only affected the `deprectated` lint which now detects uses of deprecated items in trait impls and function return types * Renamed some references to `CowString` and `CowVec` to `Cow<str>` and `Cow<[T]>`, respectively, which appear outside of the crate which defines them * Replaced a few instances of `InvariantType<T>` with `PhantomData<Cell<T>>` * Disabled the `deprecated` lint in several places that reference/implement traits on deprecated items which will get cleaned up in the future * Disabled the `exceeding_bitshifts` lint for compile-fail/huge-array-simple test so it doesn't shadow the expected error on 32bit systems * Unfortunately, this means that if a library declares `#![deny(deprecated)]` and marks anything as deprecated, it will have to disable the lint for any uses of said item, e.g. any impl the now deprecated item For any library that denies deprecated items but has deprecated items of its own, this is a [breaking-change]
2015-02-28Rename LintPass::check_trait_method to check_trait_itemIvan Petkov-2/+2
Traits can have associated types and not just methods. This clarification reflects the the type of the input the method accepts. [breaking-change]
2015-02-28Update docs for rustc_lint crateification.Huon Wilson-15/+4
2015-02-28Separate most of rustc::lint::builtin into a separate crate.Huon Wilson-2141/+5
This pulls out the implementations of most built-in lints into a separate crate, to reduce edit-compile-test iteration times with librustc_lint and increase parallelism. This should enable lints to be refactored, added and deleted much more easily as it slashes the edit-compile cycle to get a minimal working compiler to test with (`make rustc-stage1`) from librustc -> librustc_typeck -> ... -> librustc_driver -> libcore -> ... -> libstd to librustc_lint -> librustc_driver -> libcore -> ... libstd which is significantly faster, mainly due to avoiding the librustc build itself. The intention would be to move as much as possible of the infrastructure into the crate too, but the plumbing is deeply intertwined with librustc itself at the moment. Also, there are lints for which diagnostics are registered directly in the compiler code, not in their own crate traversal, and their definitions have to remain in librustc. This is a [breaking-change] for direct users of the compiler APIs: callers of `rustc::session::build_session` or `rustc::session::build_session_` need to manually call `rustc_lint::register_builtins` on their return value. This should make #22206 easier.
2015-02-26Check stability of struct fields.Huon Wilson-0/+5
We were recording stability attributes applied to fields in the compiler, and even annotating it in the libs, but the compiler didn't actually do the checks to give errors/warnings in user crates.
2015-02-25Rollup merge of #22635 - kmcallister:macros-chapter, r=steveklabnikManish Goregaokar-19/+19
r? @steveklabnik
2015-02-25Rollup merge of #22752 - ipetkov:unsafe-lint-fix, r=alexcrichtonManish Goregaokar-32/+22
This allows selectively disabling the lint for individual methods or traits.
2015-02-24Implement `<T>::method` UFCS expression syntax.Eduard Burtescu-3/+3
2015-02-24rustc: combine partial_def_map and last_private_map into def_map.Eduard Burtescu-12/+13
2015-02-24syntax: use a single Path for Trait::Item in QPath.Eduard Burtescu-6/+0
2015-02-24syntax: don't use TraitRef in QPath.Eduard Burtescu-0/+6
2015-02-24syntax: don't store a secondary NodeId for TyPath.Eduard Burtescu-6/+5
2015-02-24Rollup merge of #22580 - pnkfelix:guard-pat-cfg2, r=pnkfelixManish Goregaokar-1/+1
aatch's cfg revisions, namely to match expressions Revise handling of match expressions so that arms branch to next arm. Update the graphviz tests accordingly. Fixes #22073. (Includes regression test for the issue.)
2015-02-23Properly reimplement `unsafe-code` lint to honor changing lint attributesIvan Petkov-32/+22
2015-02-23Update missing-docs lint to check associated type declarationsIvan Petkov-0/+8
[breaking-change] Fixes #20648
2015-02-22Auto merge of #22466 - Kimundi:str_pattern_ai_safe, r=aturonbors-1/+1
This is not a complete implementation of the RFC: - only existing methods got updated, no new ones added - doc comments are not extensive enough yet - optimizations got lost and need to be reimplemented See https://github.com/rust-lang/rfcs/pull/528 Technically a [breaking-change]
2015-02-22Distinguish between AST and various Dummy nodes in CFG.James Miller-1/+1
(Factoring of aatch CFG code, Part 1.)
2015-02-22Rollup merge of #22584 - alexcrichton:snapshots, r=GankroManish Goregaokar-8/+0
2015-02-22Rollup merge of #22592 - nikomatsakis:deprecate-bracket-bracket, r=aturonManish Goregaokar-23/+23
r? @aturon
2015-02-22Rollup merge of #22542 - ipetkov:unsafe-lint, r=huonwManish Goregaokar-9/+53
This allows warning or forbidding all uses of unsafe code, whereas previously only unsafe blocks were caught by the lint. The lint has been renamed from `unsafe-blocks` to `unsafe-code` to reflect its new purpose. This is a minor [breaking-change] Closes #22430
2015-02-20Register new snapshotsAlex Crichton-8/+0
2015-02-20Remove remaining uses of `[]`. This time I tried to use deref coercions ↵Niko Matsakis-23/+23
where possible.
2015-02-19Unsafe lint will also check for other unsafe codeIvan Petkov-9/+53
Checks include declaration/implementation of unsafe functions, traits, and methods. This allows warning or forbidding all uses of unsafe code, whereas previously only unsafe blocks were caught by the lint. The lint has been renamed from `unsafe-blocks` to `unsafe-code` to reflect its new purpose. This is a minor [breaking-change] Closes #22430
2015-02-20Addressed PR commentsMarvin Löbel-1/+1
2015-02-18rollup merge of #22502: nikomatsakis/deprecate-bracket-bracketAlex Crichton-25/+25
Conflicts: src/libcollections/slice.rs src/libcollections/str.rs src/librustc/middle/lang_items.rs src/librustc_back/rpath.rs src/librustc_typeck/check/regionck.rs src/libstd/ffi/os_str.rs src/libsyntax/diagnostic.rs src/libsyntax/parse/parser.rs src/libsyntax/util/interner.rs src/test/run-pass/regions-refcell.rs
2015-02-18Replace all uses of `&foo[]` with `&foo[..]` en masse.Niko Matsakis-25/+25
2015-02-18rollup merge of #22497: nikomatsakis/suffixesAlex Crichton-2/+1
Conflicts: src/librustc_trans/trans/tvec.rs
2015-02-18rollup merge of #22491: Gankro/into_iterAlex Crichton-2/+2
Conflicts: src/libcollections/bit.rs src/libcollections/linked_list.rs src/libcollections/vec_deque.rs src/libstd/sys/common/wtf8.rs