Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename uneval_consts to required_consts
- Loading branch information
1 parent
da9aa2d
commit c1ed7cc
Showing
7 changed files
with
44 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use rustc_middle::mir::visit::Visitor; | ||
use rustc_middle::mir::{Constant, Location}; | ||
use rustc_middle::ty::ConstKind; | ||
|
||
pub struct RequiredConstsVisitor<'a, 'tcx> { | ||
required_consts: &'a mut Vec<Constant<'tcx>>, | ||
} | ||
|
||
impl<'a, 'tcx> RequiredConstsVisitor<'a, 'tcx> { | ||
pub fn new(required_consts: &'a mut Vec<Constant<'tcx>>) -> Self { | ||
RequiredConstsVisitor { required_consts } | ||
} | ||
} | ||
|
||
impl<'a, 'tcx> Visitor<'tcx> for RequiredConstsVisitor<'a, 'tcx> { | ||
fn visit_constant(&mut self, constant: &Constant<'tcx>, _: Location) { | ||
let const_kind = constant.literal.val; | ||
|
||
if let ConstKind::Unevaluated(_, _, _) = const_kind { | ||
self.required_consts.push(*constant); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.