about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/builtin.rs
AgeCommit message (Collapse)AuthorLines
2021-10-06Use get_diagnostic_nameCameron Steffen-15/+13
2021-10-03Practice diagnostic message conventionHirochika Matsumoto-3/+3
2021-10-02Make diangostic item names consistentCameron Steffen-1/+1
2021-09-30Do not pass hir::Crate to lints.Camille GILLOT-1/+1
2021-09-29Avoid more invocations of hir_crate query.Camille GILLOT-2/+8
2021-09-20Adjust documentation for compatibility with 2021Mark Rousskov-1/+1
This also adjusts the lint docs generation to accept (and ignore) an allow attribute, rather than expecting the documentation to be immediately followed by the lint name.
2021-09-02rustc_target: move `LayoutOf` to `ty::layout`.Eduard-Mihai Burtescu-2/+3
2021-08-30`feature(const_generics)` -> `feature(const_param_types)`lcnr-1/+1
2021-08-28Treat macros as HIR itemsinquisitivecrystal-18/+1
2021-08-26update `TypeFlags` to deal with missing ct substslcnr-1/+1
2021-08-26add `tcx` to `fn walk`lcnr-2/+2
2021-08-24Move `named_asm_labels` to a HIR lintasquared31415-2/+122
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-12/+11
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-19introduce a Coerce predicateNiko Matsakis-0/+1
2021-08-13Auto merge of #86492 - hyd-dev:no-mangle-method, r=petrochenkovbors-22/+64
Associated functions that contain extern indicator or have `#[rustc_std_internal_symbol]` are reachable Previously these fails to link with ``undefined reference to `foo'``: <details> <summary>Example 1</summary> ```rs struct AssocFn; impl AssocFn { #[no_mangle] fn foo() {} } fn main() { extern "Rust" { fn foo(); } unsafe { foo() } } ``` ([Playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=f1244afcdd26e2a28445f6e82ca46b50)) </details> <details> <summary>Example 2</summary> ```rs #![crate_name = "lib"] #![crate_type = "lib"] struct AssocFn; impl AssocFn { #[no_mangle] fn foo() {} } ``` ```rs extern crate lib; fn main() { extern "Rust" { fn foo(); } unsafe { foo() } } ``` </details> But I believe they should link successfully, because this works: <details> ```rs #[no_mangle] fn foo() {} fn main() { extern "Rust" { fn foo(); } unsafe { foo() } } ``` ([Playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=789b3f283ee6126f53939429103ed98d)) </details> This PR fixes the problem, by adding associated functions that have "custom linkage" to `reachable_set`, just like normal functions. I haven't tested whether #76211 and [Miri](https://github.com/rust-lang/miri/issues/1837) are fixed by this PR yet, but I'm submitting this anyway since this fixes the examples above. I added a `run-pass` test that combines my two examples above, but I'm not sure if that's the right way to test this. Maybe I should add / modify an existing codegen test (`src/test/codegen/export-no-mangle.rs`?) instead?
2021-08-12Adjust `#[no_mangle]`-related checks and lints for `impl` itemshyd-dev-22/+64
2021-08-09Link to edition guide instead of issues for 2021 lints.Mara Bos-1/+1
2021-08-06Auto merge of #87462 - ibraheemdev:tidy-file-length-ignore-comment, ↵bors-2/+0
r=Mark-Simulacrum Ignore comments in tidy-filelength Ref https://github.com/rust-lang/rust/issues/60302#issuecomment-652402127
2021-07-31rustc: Replace `HirId`s with `LocalDefId`s in `AccessLevels` tablesVadim Petrochenkov-21/+23
and passes using them - primarily privacy checking, stability checking and dead code checking. WIP
2021-07-25ignore comments in tidy-filelengthibraheemdev-2/+0
2021-07-25Introduce OwnerNode::Crate.Camille GILLOT-1/+1
2021-07-25Merge the BTreeMap in hir::Crate.Camille GILLOT-1/+1
2021-07-16Make GATs no longer incompleteJack Huey-1/+1
2021-07-08Improve handing of `missing_docs` for macrosinquisitivecrystal-2/+3
2021-07-08Remove `missing_docs` lint on private 2.0 macrosinquisitivecrystal-0/+5
2021-07-03Add a help message to `unused_doc_comments` lintYuki Okushi-2/+13
2021-07-01Rollup merge of #85520 - FabianWolff:issue-85475, r=jackh726Yuki Okushi-1/+1
Fix typo and improve documentation for E0632 Edit: After https://github.com/rust-lang/rust/pull/85520#issuecomment-870095546, this PR has been boiled down to just an extended description for `E0632` and a fixed typo.
2021-06-29Fix typo and improve documentation for E0632Fabian Wolff-1/+1
2021-06-28Make incomplete features part of delcarationSmitty-1/+1
This prevents mistakes where the feature is in the list of incomplete features but not actually a feature by making the incompleteness a part of the declaration.
2021-06-25Change how edition based future compatibility warnings are handledRyan Levick-3/+4
2021-06-04Remove `doc(include)`Joshua Nelson-1/+1
2021-05-04Auto merge of #83213 - rylev:update-lints-to-errors, r=nikomatsakisbors-26/+55
Update BARE_TRAIT_OBJECT and ELLIPSIS_INCLUSIVE_RANGE_PATTERNS to errors in Rust 2021 This addresses https://github.com/rust-lang/rust/pull/81244 by updating two lints to errors in the Rust 2021 edition. r? `@estebank`
2021-05-02Change 'NULL' to 'null'Brent Kerby-2/+2
2021-04-19fix few typosklensy-1/+1
2021-04-14Auto merge of #83948 - ABouttefeux:lint-nullprt-deref, r=RalfJungbors-0/+87
add lint deref_nullptr detecting when a null ptr is dereferenced fixes #83856 changelog: add lint that detect code like ```rust unsafe { &*core::ptr::null::<i32>() }; unsafe { addr_of!(std::ptr::null::<i32>()) }; let x: i32 = unsafe {*core::ptr::null()}; let x: i32 = unsafe {*core::ptr::null_mut()}; unsafe {*(0 as *const i32)}; unsafe {*(core::ptr::null() as *const i32)}; ``` ``` warning: Dereferencing a null pointer causes undefined behavior --> src\main.rs:5:26 | 5 | let x: i32 = unsafe {*core::ptr::null()}; | ^^^^^^^^^^^^^^^^^^ | | | a null pointer is dereferenced | this code causes undefined behavior when executed | = note: `#[warn(deref_nullptr)]` on by default ``` Limitation: It does not detect code like ```rust const ZERO: usize = 0; unsafe {*(ZERO as *const i32)}; ``` or code where `0` is not directly a literal
2021-04-13Add compatibility info to lintsRyan Levick-1/+5
2021-04-12Turn old edition lints (anonymous-parameters, keyword-idents) into ↵Manish Goregaokar-4/+7
warn-by-default on 2015
2021-04-09changes based on reviewAliénore Bouttefeux-6/+4
2021-04-08Rollup merge of #83980 - pierwill:fix-compiler-librustc-names, r=davidtwcoDylan DPC-1/+1
Fix outdated crate names in compiler docs Changes `librustc_X` to `rustc_X`, only in documentation comments. Plain code comments are left unchanged.
2021-04-08Fix outdated crate names in compiler docspierwill-1/+1
Changes `librustc_X` to `rustc_X`, only in documentation comments. Plain code comments are left unchanged. Also fix incorrect file paths.
2021-04-08Change how edition is determinedRyan Levick-2/+2
2021-04-08Update BARE_TRAIT_OBJECT and ELLIPSIS_INCLUSIVE_RANGE_PATTERNS to errors in ↵Ryan Levick-25/+50
Rust 2021
2021-04-08fix lint docAliénore Bouttefeux-18/+7
2021-04-07change documentation of lintAliénore Bouttefeux-5/+14
2021-04-07add testAliénore Bouttefeux-0/+2
2021-04-06add lint deref_nullptrAliénore Bouttefeux-0/+89
2021-04-04Trigger `unused_doc_comments` on macros at onceYuki Okushi-1/+1
2021-03-30Remove hir::CrateItem.Camille GILLOT-1/+1
2021-03-27Remove (lots of) dead codeJoshua Nelson-1/+1
Found with https://github.com/est31/warnalyzer. Dubious changes: - Is anyone else using rustc_apfloat? I feel weird completely deleting x87 support. - Maybe some of the dead code in rustc_data_structures, in case someone wants to use it in the future? - Don't change rustc_serialize I plan to scrap most of the json module in the near future (see https://github.com/rust-lang/compiler-team/issues/418) and fixing the tests needed more work than I expected. TODO: check if any of the comments on the deleted code should be kept.
2021-03-16ast/hir: Rename field-related structuresVadim Petrochenkov-2/+2
StructField -> FieldDef ("field definition") Field -> ExprField ("expression field", not "field expression") FieldPat -> PatField ("pattern field", not "field pattern") Also rename visiting and other methods working on them.