about summary refs log tree commit diff
path: root/src/librustc_mir_build/lints.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-161/+0
2020-08-22Use smaller def span for functionsAaron Hill-1/+1
Currently, the def span of a funtion encompasses the entire function signature and body. However, this is usually unnecessarily verbose - when we are pointing at an entire function in a diagnostic, we almost always want to point at the signature. The actual contents of the body tends to be irrelevant to the diagnostic we are emitting, and just takes up additional screen space. This commit changes the `def_span` of all function items (freestanding functions, `impl`-block methods, and `trait`-block methods) to be the span of the signature. For example, the function ```rust pub fn foo<T>(val: T) -> T { val } ``` now has a `def_span` corresponding to `pub fn foo<T>(val: T) -> T` (everything before the opening curly brace). Trait methods without a body have a `def_span` which includes the trailing semicolon. For example: ```rust trait Foo { fn bar(); }``` the function definition `Foo::bar` has a `def_span` of `fn bar();` This makes our diagnostic output much shorter, and emphasizes information that is relevant to whatever diagnostic we are reporting. We continue to use the full span (including the body) in a few of places: * MIR building uses the full span when building source scopes. * 'Outlives suggestions' use the full span to sort the diagnostics being emitted. * The `#[rustc_on_unimplemented(enclosing_scope="in this scope")]` attribute points the entire scope body. * The 'unconditional recursion' lint uses the full span to show additional context for the recursive call. All of these cases work only with local items, so we don't need to add anything extra to crate metadata.
2020-08-13merge `as_local_hir_id` with `local_def_id_to_hir_id`Bastian Kauschke-2/+2
2020-06-07rename FalseEdges -> FalseEdgeRalf Jung-2/+2
2020-05-18Fix handling on InlineAsm for the unconditional recursion lint.Amanieu d'Antras-3/+8
2020-05-18Add asm! to MIRAmanieu d'Antras-0/+4
2020-04-28Move a few queries to using an arena.Camille GILLOT-1/+1
2020-04-27Accept `LocalDefId` as argument for `mir_build::lint::check`marmeladema-8/+9
2020-04-23Modify `as_local_hir_id` to return a bare `HirId`marmeladema-2/+2
2020-04-23Modify `as_local_hir_id` to accept a `LocalDefId` instead of a `DefId`marmeladema-2/+2
2020-04-18Detect mistyped associated consts in `Instance::resolve`.Eduard-Mihai Burtescu-1/+1
2020-04-09Use tri-color search for unconditional recursion lintDylan MacKenzie-133/+109
2020-04-07Further improve commentsJonas Schievink-3/+4
2020-04-07Add some more commentsJonas Schievink-0/+11
2020-04-06Add some comments and rename variableJonas Schievink-2/+9
2020-04-06Merge redundant match armsJonas Schievink-11/+8
2020-04-06Move closure check upwardsJonas Schievink-7/+6
2020-04-06Don't lint for self-recursion when the function can divergeJonas Schievink-90/+112
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-3/+3
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-4/+4
2020-03-25Rename `def_span` to `guess_head_span`Esteban Küber-1/+1
2020-03-16use direct imports for `rustc::{lint, session}`.Mazdak Farrokhzad-1/+1
2020-02-11Run RustFmtjumbatm-15/+10
2020-02-11Invert control in struct_lint_level.jumbatm-9/+11
Caller now passes in a `decorate` function, which is only run if the lint is allowed.
2020-01-12Split `rustc_mir::{build, hair, lints}` into their own crateMatthew Jasper-0/+141