summary refs log tree commit diff
path: root/compiler/rustc_lint/src
AgeCommit message (Collapse)AuthorLines
2020-09-27Separate `private_intra_doc_links` and `broken_intra_doc_links` into ↵Joshua Nelson-0/+1
separate lints This is not ideal because it means `deny(broken_intra_doc_links)` will no longer `deny(private_intra_doc_links)`. However, it can't be fixed with a new lint group, because `broken` is already in the `rustdoc` lint group; there would need to be a way to nest groups somehow. This also removes the early `return` so that the link will be generated even though it gives a warning.
2020-09-26Rollup merge of #77211 - est31:remove_unused_allow, r=oli-obkRalf Jung-2/+0
Remove unused #[allow(...)] statements from compiler/
2020-09-26Remove unused #[allow(...)] statements from compiler/est31-2/+0
2020-09-25Simplify some match statements on `DefPathDataName'marmeladema-7/+2
2020-09-25Rename `DefPathData::get_name()` to `DefPathData::name()`marmeladema-1/+1
2020-09-25Move from {{closure}}#0 syntax to {closure#0} for (def) path componentsmarmeladema-2/+7
2020-09-25Rollup merge of #77121 - duckymirror:html-root-url, r=jyn514Jonas Schievink-1/+1
Updated html_root_url for compiler crates Closes #77103 r? @jyn514
2020-09-23/nightly/nightly-rustcErik Hofmayer-1/+1
2020-09-23Updated html_root_url for compiler cratesErik Hofmayer-1/+1
2020-09-23Rollup merge of #76994 - yuk1ty:fix-small-typo, r=estebankDylan DPC-1/+1
fix small typo in docs and comments Fixed `the the` to `the`, as far as I found.
2020-09-21Rollup merge of #77032 - lcnr:visit-all-the-item-likes, r=davidtwcoecstatic-morse-0/+13
lint missing docs for extern items fixes #76991
2020-09-21Rollup merge of #76914 - lcnr:path-no-more, r=ecstatic-morseecstatic-morse-5/+27
extend `Ty` and `TyCtxt` lints to self types blocked on #76891 r? @ecstatic-morse cc @Aaron1011
2020-09-22lint missing docs for extern itemsBastian Kauschke-0/+13
2020-09-21add testBastian Kauschke-0/+6
2020-09-21fix typo in docs and commentsyuk1ty-1/+1
2020-09-20Rollup merge of #76910 - lcnr:foreign-item-like, r=oli-obkRalf Jung-8/+5
transmute: use diagnostic item closes #66075, we now have no remaining uses of `match_def_path` in the compiler while some uses still remain in `clippy`. cc @RalfJung
2020-09-20Rollup merge of #76890 - matthiaskrgr:matches_simpl, r=lcnrRalf Jung-6/+7
use matches!() macro for simple if let conditions
2020-09-20Auto merge of #76964 - RalfJung:rollup-ybn06fs, r=RalfJungbors-2/+3
Rollup of 15 pull requests Successful merges: - #76722 (Test and fix Send and Sync traits of BTreeMap artefacts) - #76766 (Extract some intrinsics out of rustc_codegen_llvm) - #76800 (Don't generate bootstrap usage unless it's needed) - #76809 (simplfy condition in ItemLowerer::with_trait_impl_ref()) - #76815 (Fix wording in mir doc) - #76818 (Don't compile regex at every function call.) - #76821 (Remove redundant nightly features) - #76823 (black_box: silence unused_mut warning when building with cfg(miri)) - #76825 (use `array_windows` instead of `windows` in the compiler) - #76827 (fix array_windows docs) - #76828 (use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip)) - #76840 (Move to intra doc links in core/src/future) - #76845 (Use intra docs links in core::{ascii, option, str, pattern, hash::map}) - #76853 (Use intra-doc links in library/core/src/task/wake.rs) - #76871 (support panic=abort in Miri) Failed merges: r? `@ghost`
2020-09-20Auto merge of #74949 - oli-obk:validate_const_eval_raw, r=RalfJungbors-9/+7
Validate constants during `const_eval_raw` This PR implements the groundwork for https://github.com/rust-lang/rust/issues/72396 * constants are now validated during `const_eval_raw` * to prevent cycle errors, we do not validate references to statics anymore beyond the fact that they are not dangling * the `const_eval` query ICEs if used on `static` items * as a side effect promoteds are now evaluated to `ConstValue::Scalar` again (since they are just a reference to the actual promoted allocation in most cases).
2020-09-20use `array_windows` instead of `windows` in the compilerBastian Kauschke-2/+3
2020-09-19update docsBastian Kauschke-1/+2
2020-09-19extend `is_ty_or_ty_ctxt` to self typesBastian Kauschke-5/+21
2020-09-19Rollup merge of #75099 - davidtwco:is-zst-abstraction-violation, r=eddybRalf Jung-6/+26
lint/ty: move fns to avoid abstraction violation This PR moves `transparent_newtype_field` and `is_zst` to `LateContext` where they are used, rather than being on the `VariantDef` and `TyS` types, hopefully addressing @eddyb's concern [from this comment](https://github.com/rust-lang/rust/pull/74340#discussion_r456534910).
2020-09-19wordingBastian Kauschke-1/+2
2020-09-19transmute: use diagnostic itemBastian Kauschke-8/+3
2020-09-19Reflect the "do not call this query directly" mentality in its nameOliver Scherer-0/+1
2020-09-19Stop using the `const_eval` query for initializers of staticsOliver Scherer-9/+6
As a side effect, we now represent most promoteds as `ConstValue::Scalar` again. This is useful because all implict promoteds are just references anyway and most explicit promoteds are numeric arguments to `asm!` or SIMD instructions.
2020-09-18use matches!() macro for simple if let conditionsMatthias Krüger-6/+7
2020-09-15don't lazily evaulate some trivial values for Option::None replacements ↵Matthias Krüger-1/+1
(clippy::unnecessary_lazy_evaluations)
2020-09-14Auto merge of #76541 - matthiaskrgr:unstable_sort, r=davidtwcobors-1/+2
use sort_unstable to sort primitive types It's not important to retain original order if we have &[1, 1, 2, 3] for example. clippy::stable_sort_primitive
2020-09-14Auto merge of #76549 - ehuss:lints-comments, r=wesleywiserbors-0/+974
Auto-generate lint documentation. This adds a tool which will generate the lint documentation in the rustc book automatically. This is motivated by keeping the documentation up-to-date, and consistently formatted. It also ensures the examples are correct and that they actually generate the expected lint. The lint groups table is also auto-generated. See https://github.com/rust-lang/compiler-team/issues/349 for the original proposal. An outline of how this works: - The `declare_lint!` macro now accepts a doc comment where the documentation is written. This is inspired by how clippy works. - A new tool `src/tools/lint-docs` scrapes the documentation and adds it to the rustc book during the build. - It runs each example and verifies its output and embeds the output in the book. - It does a few formatting checks. - It verifies that every lint is documented. - Groups are collected from `rustc -W help`. I updated the documentation for all the missing lints. I have also added an "Explanation" section to each lint providing a reason for the lint and suggestions on how to resolve it. This can lead towards a future enhancement of possibly showing these docs via the `--explain` flag to make them easily accessible and discoverable.
2020-09-13Auto-generate lint documentation.Eric Huss-0/+974
2020-09-10use sort_unstable to sort primitive typesMatthias Krüger-1/+2
It's not important to retain original order if we have &[1, 1, 2, 3] for example. clippy::stable_sort_primitive
2020-09-09Remove def_id field from ParamEnvBram van den Heuvel-1/+2
2020-09-04Change ty.kind to a methodLeSeulArtichaut-24/+24
2020-09-03rustc_lint: avoid trimmed paths for ty_find_init_errorDan Aloni-1/+4
2020-09-02pretty: trim paths of unique symbolsDan Aloni-10/+17
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-08-30lint/ty: move fns to avoid abstraction violationDavid Wood-6/+26
This commit moves `transparent_newtype_field` and `is_zst` to `LateContext` where they are used, rather than being on the `VariantDef` and `TyS` types. Signed-off-by: David Wood <david@davidtw.co>
2020-08-30mv compiler to compiler/mark-0/+8842