Skip to content

Commit 5c7fdb5

Browse files
committed
fix(docs): fix typos
Signed-off-by: Eval EXEC <execvy@gmail.com>
1 parent 9be9b5e commit 5c7fdb5

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

compiler/rustc_borrowck/src/constraints/graph.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::{
1313
/// The construct graph organizes the constraints by their end-points.
1414
/// It can be used to view a `R1: R2` constraint as either an edge `R1
1515
/// -> R2` or `R2 -> R1` depending on the direction type `D`.
16-
pub(crate) struct ConstraintGraph<D: ConstraintGraphDirecton> {
16+
pub(crate) struct ConstraintGraph<D: ConstraintGraphDirection> {
1717
_direction: D,
1818
first_constraints: IndexVec<RegionVid, Option<OutlivesConstraintIndex>>,
1919
next_constraints: IndexVec<OutlivesConstraintIndex, Option<OutlivesConstraintIndex>>,
@@ -25,7 +25,7 @@ pub(crate) type ReverseConstraintGraph = ConstraintGraph<Reverse>;
2525

2626
/// Marker trait that controls whether a `R1: R2` constraint
2727
/// represents an edge `R1 -> R2` or `R2 -> R1`.
28-
pub(crate) trait ConstraintGraphDirecton: Copy + 'static {
28+
pub(crate) trait ConstraintGraphDirection: Copy + 'static {
2929
fn start_region(c: &OutlivesConstraint<'_>) -> RegionVid;
3030
fn end_region(c: &OutlivesConstraint<'_>) -> RegionVid;
3131
fn is_normal() -> bool;
@@ -38,7 +38,7 @@ pub(crate) trait ConstraintGraphDirecton: Copy + 'static {
3838
#[derive(Copy, Clone, Debug)]
3939
pub(crate) struct Normal;
4040

41-
impl ConstraintGraphDirecton for Normal {
41+
impl ConstraintGraphDirection for Normal {
4242
fn start_region(c: &OutlivesConstraint<'_>) -> RegionVid {
4343
c.sup
4444
}
@@ -59,7 +59,7 @@ impl ConstraintGraphDirecton for Normal {
5959
#[derive(Copy, Clone, Debug)]
6060
pub(crate) struct Reverse;
6161

62-
impl ConstraintGraphDirecton for Reverse {
62+
impl ConstraintGraphDirection for Reverse {
6363
fn start_region(c: &OutlivesConstraint<'_>) -> RegionVid {
6464
c.sub
6565
}
@@ -73,7 +73,7 @@ impl ConstraintGraphDirecton for Reverse {
7373
}
7474
}
7575

76-
impl<D: ConstraintGraphDirecton> ConstraintGraph<D> {
76+
impl<D: ConstraintGraphDirection> ConstraintGraph<D> {
7777
/// Creates a "dependency graph" where each region constraint `R1:
7878
/// R2` is treated as an edge `R1 -> R2`. We use this graph to
7979
/// construct SCCs for region inference but also for error
@@ -133,15 +133,15 @@ impl<D: ConstraintGraphDirecton> ConstraintGraph<D> {
133133
}
134134
}
135135

136-
pub(crate) struct Edges<'s, 'tcx, D: ConstraintGraphDirecton> {
136+
pub(crate) struct Edges<'s, 'tcx, D: ConstraintGraphDirection> {
137137
graph: &'s ConstraintGraph<D>,
138138
constraints: &'s OutlivesConstraintSet<'tcx>,
139139
pointer: Option<OutlivesConstraintIndex>,
140140
next_static_idx: Option<usize>,
141141
static_region: RegionVid,
142142
}
143143

144-
impl<'s, 'tcx, D: ConstraintGraphDirecton> Iterator for Edges<'s, 'tcx, D> {
144+
impl<'s, 'tcx, D: ConstraintGraphDirection> Iterator for Edges<'s, 'tcx, D> {
145145
type Item = OutlivesConstraint<'tcx>;
146146

147147
fn next(&mut self) -> Option<Self::Item> {
@@ -174,13 +174,13 @@ impl<'s, 'tcx, D: ConstraintGraphDirecton> Iterator for Edges<'s, 'tcx, D> {
174174
/// This struct brings together a constraint set and a (normal, not
175175
/// reverse) constraint graph. It implements the graph traits and is
176176
/// usd for doing the SCC computation.
177-
pub(crate) struct RegionGraph<'s, 'tcx, D: ConstraintGraphDirecton> {
177+
pub(crate) struct RegionGraph<'s, 'tcx, D: ConstraintGraphDirection> {
178178
set: &'s OutlivesConstraintSet<'tcx>,
179179
constraint_graph: &'s ConstraintGraph<D>,
180180
static_region: RegionVid,
181181
}
182182

183-
impl<'s, 'tcx, D: ConstraintGraphDirecton> RegionGraph<'s, 'tcx, D> {
183+
impl<'s, 'tcx, D: ConstraintGraphDirection> RegionGraph<'s, 'tcx, D> {
184184
/// Creates a "dependency graph" where each region constraint `R1:
185185
/// R2` is treated as an edge `R1 -> R2`. We use this graph to
186186
/// construct SCCs for region inference but also for error
@@ -202,35 +202,37 @@ impl<'s, 'tcx, D: ConstraintGraphDirecton> RegionGraph<'s, 'tcx, D> {
202202
}
203203
}
204204

205-
pub(crate) struct Successors<'s, 'tcx, D: ConstraintGraphDirecton> {
205+
pub(crate) struct Successors<'s, 'tcx, D: ConstraintGraphDirection> {
206206
edges: Edges<'s, 'tcx, D>,
207207
}
208208

209-
impl<'s, 'tcx, D: ConstraintGraphDirecton> Iterator for Successors<'s, 'tcx, D> {
209+
impl<'s, 'tcx, D: ConstraintGraphDirection> Iterator for Successors<'s, 'tcx, D> {
210210
type Item = RegionVid;
211211

212212
fn next(&mut self) -> Option<Self::Item> {
213213
self.edges.next().map(|c| D::end_region(&c))
214214
}
215215
}
216216

217-
impl<'s, 'tcx, D: ConstraintGraphDirecton> graph::DirectedGraph for RegionGraph<'s, 'tcx, D> {
217+
impl<'s, 'tcx, D: ConstraintGraphDirection> graph::DirectedGraph for RegionGraph<'s, 'tcx, D> {
218218
type Node = RegionVid;
219219
}
220220

221-
impl<'s, 'tcx, D: ConstraintGraphDirecton> graph::WithNumNodes for RegionGraph<'s, 'tcx, D> {
221+
impl<'s, 'tcx, D: ConstraintGraphDirection> graph::WithNumNodes for RegionGraph<'s, 'tcx, D> {
222222
fn num_nodes(&self) -> usize {
223223
self.constraint_graph.first_constraints.len()
224224
}
225225
}
226226

227-
impl<'s, 'tcx, D: ConstraintGraphDirecton> graph::WithSuccessors for RegionGraph<'s, 'tcx, D> {
227+
impl<'s, 'tcx, D: ConstraintGraphDirection> graph::WithSuccessors for RegionGraph<'s, 'tcx, D> {
228228
fn successors(&self, node: Self::Node) -> <Self as graph::GraphSuccessors<'_>>::Iter {
229229
self.outgoing_regions(node)
230230
}
231231
}
232232

233-
impl<'s, 'tcx, D: ConstraintGraphDirecton> graph::GraphSuccessors<'_> for RegionGraph<'s, 'tcx, D> {
233+
impl<'s, 'tcx, D: ConstraintGraphDirection> graph::GraphSuccessors<'_>
234+
for RegionGraph<'s, 'tcx, D>
235+
{
234236
type Item = RegionVid;
235237
type Iter = Successors<'s, 'tcx, D>;
236238
}

compiler/rustc_const_eval/src/const_eval/eval_queries.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ pub(crate) fn turn_into_const_value<'tcx>(
205205
let cid = key.value;
206206
let def_id = cid.instance.def.def_id();
207207
let is_static = tcx.is_static(def_id);
208-
// This is just accessing an already computed constant, so no need to check alginment here.
208+
// This is just accessing an already computed constant, so no need to check alignment here.
209209
let ecx = mk_eval_cx(
210210
tcx,
211211
tcx.def_span(key.value.instance.def_id()),

0 commit comments

Comments
 (0)