Skip to content

Commit d2ff5d6

Browse files
committed
Typos and style fixes.
1 parent eb50e75 commit d2ff5d6

File tree

6 files changed

+23
-24
lines changed

6 files changed

+23
-24
lines changed

src/librustc/traits/auto_trait.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,16 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
7373
/// ```
7474
/// struct Foo<T> { data: Box<T> }
7575
/// ```
76-
76+
///
7777
/// then this might return that Foo<T>: Send if T: Send (encoded in the AutoTraitResult type).
7878
/// The analysis attempts to account for custom impls as well as other complex cases. This
7979
/// result is intended for use by rustdoc and other such consumers.
80-
80+
///
8181
/// (Note that due to the coinductive nature of Send, the full and correct result is actually
8282
/// quite simple to generate. That is, when a type has no custom impl, it is Send iff its field
8383
/// types are all Send. So, in our example, we might have that Foo<T>: Send if Box<T>: Send.
8484
/// But this is often not the best way to present to the user.)
85-
85+
///
8686
/// Warning: The API should be considered highly unstable, and it may be refactored or removed
8787
/// in the future.
8888
pub fn find_auto_trait_generics<A>(
@@ -288,7 +288,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
288288
// hold.
289289
//
290290
// One additional consideration is supertrait bounds. Normally, a ParamEnv is only ever
291-
// consutrcted once for a given type. As part of the construction process, the ParamEnv will
291+
// constructed once for a given type. As part of the construction process, the ParamEnv will
292292
// have any supertrait bounds normalized - e.g. if we have a type 'struct Foo<T: Copy>', the
293293
// ParamEnv will contain 'T: Copy' and 'T: Clone', since 'Copy: Clone'. When we construct our
294294
// own ParamEnv, we need to do this ourselves, through traits::elaborate_predicates, or else

src/librustc/traits/fulfill.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ impl<'tcx> ForestObligation for PendingPredicateObligation<'tcx> {
4545
/// along. Once all type inference constraints have been generated, the
4646
/// method `select_all_or_error` can be used to report any remaining
4747
/// ambiguous cases as errors.
48-
4948
pub struct FulfillmentContext<'tcx> {
5049
// A list of all obligations that have been registered with this
5150
// fulfillment context.
@@ -89,7 +88,7 @@ impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx> {
8988

9089
/// Attempts to select obligations using `selcx`.
9190
fn select(&mut self, selcx: &mut SelectionContext<'a, 'gcx, 'tcx>)
92-
-> Result<(),Vec<FulfillmentError<'tcx>>> {
91+
-> Result<(), Vec<FulfillmentError<'tcx>>> {
9392
debug!("select(obligation-forest-size={})", self.predicates.len());
9493

9594
let mut errors = Vec::new();

src/librustc/traits/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
644644
// have the errors get reported at a defined place (e.g.,
645645
// during typeck). Instead I have all parameter
646646
// environments, in effect, going through this function
647-
// and hence potentially reporting errors. This ensurse of
647+
// and hence potentially reporting errors. This ensures of
648648
// course that we never forget to normalize (the
649649
// alternative seemed like it would involve a lot of
650650
// manual invocations of this fn -- and then we'd have to

src/librustc/traits/select.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
582582
match self.confirm_candidate(obligation, candidate) {
583583
Err(SelectionError::Overflow) => {
584584
assert!(self.query_mode == TraitQueryMode::Canonical);
585-
return Err(SelectionError::Overflow);
585+
Err(SelectionError::Overflow)
586586
},
587587
Err(e) => Err(e),
588588
Ok(candidate) => Ok(Some(candidate))
@@ -879,7 +879,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
879879
// must be met of course). One obvious case this comes up is
880880
// marker traits like `Send`. Think of a linked list:
881881
//
882-
// struct List<T> { data: T, next: Option<Box<List<T>>> {
882+
// struct List<T> { data: T, next: Option<Box<List<T>>> }
883883
//
884884
// `Box<List<T>>` will be `Send` if `T` is `Send` and
885885
// `Option<Box<List<T>>>` is `Send`, and in turn
@@ -1407,7 +1407,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
14071407
stack: &TraitObligationStack<'o, 'tcx>)
14081408
-> Result<SelectionCandidateSet<'tcx>, SelectionError<'tcx>>
14091409
{
1410-
let TraitObligationStack { obligation, .. } = *stack;
1410+
let obligation = stack.obligation;
14111411
let ref obligation = Obligation {
14121412
param_env: obligation.param_env,
14131413
cause: obligation.cause.clone(),
@@ -1788,9 +1788,9 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
17881788
}
17891789

17901790
fn assemble_candidates_from_auto_impls(&mut self,
1791-
obligation: &TraitObligation<'tcx>,
1792-
candidates: &mut SelectionCandidateSet<'tcx>)
1793-
-> Result<(), SelectionError<'tcx>>
1791+
obligation: &TraitObligation<'tcx>,
1792+
candidates: &mut SelectionCandidateSet<'tcx>)
1793+
-> Result<(), SelectionError<'tcx>>
17941794
{
17951795
// OK to skip binder here because the tests we do below do not involve bound regions
17961796
let self_ty = *obligation.self_ty().skip_binder();
@@ -2433,7 +2433,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
24332433
fn confirm_candidate(&mut self,
24342434
obligation: &TraitObligation<'tcx>,
24352435
candidate: SelectionCandidate<'tcx>)
2436-
-> Result<Selection<'tcx>,SelectionError<'tcx>>
2436+
-> Result<Selection<'tcx>, SelectionError<'tcx>>
24372437
{
24382438
debug!("confirm_candidate({:?}, {:?})",
24392439
obligation,
@@ -2612,11 +2612,11 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
26122612
let mut obligations = self.collect_predicates_for_types(
26132613
obligation.param_env,
26142614
cause,
2615-
obligation.recursion_depth+1,
2615+
obligation.recursion_depth + 1,
26162616
trait_def_id,
26172617
nested);
26182618

2619-
let trait_obligations = self.in_snapshot(|this, snapshot| {
2619+
let trait_obligations: Vec<PredicateObligation<'_>> = self.in_snapshot(|this, snapshot| {
26202620
let poly_trait_ref = obligation.predicate.to_poly_trait_ref();
26212621
let (trait_ref, skol_map) =
26222622
this.infcx().skolemize_late_bound_regions(&poly_trait_ref);
@@ -2630,6 +2630,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
26302630
snapshot)
26312631
});
26322632

2633+
// Adds the predicates from the trait. Note that this contains a `Self: Trait`
2634+
// predicate as usual. It won't have any effect since auto traits are coinductive.
26332635
obligations.extend(trait_obligations);
26342636

26352637
debug!("vtable_auto_impl: obligations={:?}", obligations);

src/librustc_data_structures/obligation_forest/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl<O: ForestObligation> ObligationForest<O> {
187187
-> Result<(), ()>
188188
{
189189
if self.done_cache.contains(obligation.as_predicate()) {
190-
return Ok(())
190+
return Ok(());
191191
}
192192

193193
match self.waiting_cache.entry(obligation.as_predicate().clone()) {
@@ -269,8 +269,8 @@ impl<O: ForestObligation> ObligationForest<O> {
269269
self.nodes[index]);
270270

271271
let result = match self.nodes[index] {
272-
Node { state: ref _state, ref mut obligation, .. }
273-
if _state.get() == NodeState::Pending =>
272+
Node { ref state, ref mut obligation, .. }
273+
if state.get() == NodeState::Pending =>
274274
{
275275
processor.process_obligation(obligation)
276276
}

src/librustc_data_structures/obligation_forest/test.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ impl<OF, BF, O, E> ObligationProcessor for ClosureObligationProcessor<OF, BF, O,
5959

6060
fn process_backedge<'c, I>(&mut self, _cycle: I,
6161
_marker: PhantomData<&'c Self::Obligation>)
62-
where I: Clone + Iterator<Item=&'c Self::Obligation> {
63-
}
62+
where I: Clone + Iterator<Item=&'c Self::Obligation>
63+
{
64+
}
6465
}
6566

6667

@@ -350,11 +351,8 @@ fn done_dependency() {
350351
}, |_|{}));
351352
assert_eq!(ok, vec!["(A,B,C): Sized"]);
352353
assert_eq!(err.len(), 0);
353-
354-
355354
}
356355

357-
358356
#[test]
359357
fn orphan() {
360358
// check that orphaned nodes are handled correctly

0 commit comments

Comments
 (0)