Skip to content

Commit 50e1a64

Browse files
committed
Add documentation to src/{analyze,refine,refine/basic_block}.rs
1 parent 273e930 commit 50e1a64

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

src/analyze.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//! Analysis of Rust MIR to generate a CHC system.
2+
//!
3+
//! The [`Analyzer`] generates subtyping constraints in the form of CHCs ([`chc::System`]).
4+
//! The entry point is [`crate_::Analyzer::run`], followed by [`local_def::Analyzer::run`]
5+
//! and [`basic_block::Analyzer::run`], while accumulating the necessary information in
6+
//! [`Analyzer`]. Once [`chc::System`] is collected for the entire input, it invokes an external
7+
//! CHC solver with the [`Analyzer::solve`] and subsequently reports the result.
8+
19
use std::cell::RefCell;
210
use std::collections::HashMap;
311
use std::rc::Rc;

src/refine.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
//! Core logic of refinement typing.
2+
//!
3+
//! This module includes the definition of the refinement typing environment along with the template
4+
//! type generation from MIR types.
5+
//!
6+
//! This module is used by the [`crate::analyze`] module. There is currently no clear boundary between
7+
//! the `analyze` and `refine` modules, so it is a TODO to integrate this into the `analyze`
8+
//! module and remove this one.
9+
110
mod template;
211
pub use template::{TemplateScope, TemplateTypeGenerator, UnrefinedTypeGenerator};
312

src/refine/basic_block.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1+
//! The refinement type for a basic block.
2+
13
use pretty::{termcolor, Pretty};
24
use rustc_index::IndexVec;
35
use rustc_middle::mir::Local;
46
use rustc_middle::ty as mir_ty;
57

68
use crate::rty;
79

8-
/// `BasicBlockType` is a special case of `FunctionType` whose parameters are
9-
/// associated with `Local`s.
10+
/// A special case of [`FunctionType`] whose parameters are
11+
/// associated with [`Local`]s.
12+
///
13+
//! Thrust essentially handles basic blocks as functions, but it needs to associate function
14+
//! parameters with MIR [`Local`]s during its analysis. [`BasicBlockType`] includes the mapping
15+
//! from function parameters to [`Local`]s along with the underlying function type.
1016
#[derive(Debug, Clone)]
1117
pub struct BasicBlockType {
1218
// TODO: make this completely private by exposing appropriate ctor

0 commit comments

Comments
 (0)