fix todo item check, remove unimplemented
This commit is contained in:
parent
61a2f972b3
commit
1317378b9e
@ -7,7 +7,7 @@
|
|||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
use rustc_hir::{Block, Destination, Expr, ExprKind, HirId, InlineAsmOperand, Pat, Stmt, StmtKind};
|
use rustc_hir::{Block, Destination, Expr, ExprKind, HirId, InlineAsmOperand, Pat, Stmt, StmtKind};
|
||||||
use rustc_lint::LateContext;
|
use rustc_lint::LateContext;
|
||||||
use rustc_span::Span;
|
use rustc_span::{sym, Span};
|
||||||
use std::iter::{once, Iterator};
|
use std::iter::{once, Iterator};
|
||||||
|
|
||||||
pub(super) fn check<'tcx>(
|
pub(super) fn check<'tcx>(
|
||||||
@ -273,7 +273,7 @@ fn never_loop_expr<'tcx>(
|
|||||||
});
|
});
|
||||||
if let NeverLoopResult::Diverging = result &&
|
if let NeverLoopResult::Diverging = result &&
|
||||||
let Some(macro_call) = root_macro_call_first_node(cx, expr) &&
|
let Some(macro_call) = root_macro_call_first_node(cx, expr) &&
|
||||||
let "todo" | "unimplemented" = cx.tcx.item_name(macro_call.def_id).as_str()
|
let Some(sym::todo_macro) = cx.tcx.get_diagnostic_name(macro_call.def_id)
|
||||||
{
|
{
|
||||||
// We return MayContinueMainLoop here because we treat `todo!()` and
|
// We return MayContinueMainLoop here because we treat `todo!()` and
|
||||||
// `unimplemented!()` macros as potentially containing any code,
|
// `unimplemented!()` macros as potentially containing any code,
|
||||||
|
@ -391,7 +391,7 @@ pub fn test32() {
|
|||||||
panic!("oh no");
|
panic!("oh no");
|
||||||
}
|
}
|
||||||
loop {
|
loop {
|
||||||
// no error
|
//~^ ERROR: this loop never actually loops
|
||||||
unimplemented!("not yet");
|
unimplemented!("not yet");
|
||||||
}
|
}
|
||||||
loop {
|
loop {
|
||||||
|
@ -170,5 +170,14 @@ LL | | panic!("oh no");
|
|||||||
LL | | }
|
LL | | }
|
||||||
| |_____^
|
| |_____^
|
||||||
|
|
||||||
error: aborting due to 15 previous errors
|
error: this loop never actually loops
|
||||||
|
--> $DIR/never_loop.rs:393:5
|
||||||
|
|
|
||||||
|
LL | / loop {
|
||||||
|
LL | |
|
||||||
|
LL | | unimplemented!("not yet");
|
||||||
|
LL | | }
|
||||||
|
| |_____^
|
||||||
|
|
||||||
|
error: aborting due to 16 previous errors
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user