Skip to content

Commit a24c897

Browse files
committed
int -> i32
1 parent c4840db commit a24c897

File tree

12 files changed

+45
-43
lines changed

12 files changed

+45
-43
lines changed

src/librustc_infer/traits/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ crate use self::util::elaborate_predicates;
2929

3030
pub use rustc_middle::traits::*;
3131

32-
/// An `Obligation` represents some trait reference (e.g., `int: Eq`) for
32+
/// An `Obligation` represents some trait reference (e.g., `i32: Eq`) for
3333
/// which the "impl_source" must be found. The process of finding a "impl_source" is
3434
/// called "resolving" the `Obligation`. This process consists of
35-
/// either identifying an `impl` (e.g., `impl Eq for int`) that
35+
/// either identifying an `impl` (e.g., `impl Eq for i32`) that
3636
/// satisfies the obligation, or else finding a bound that is in
3737
/// scope. The eventual result is usually a `Selection` (defined below).
3838
#[derive(Clone, PartialEq, Eq, Hash)]

src/librustc_infer/traits/util.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ impl PredicateSet<'tcx> {
6363
fn insert(&mut self, pred: ty::Predicate<'tcx>) -> bool {
6464
// We have to be careful here because we want
6565
//
66-
// for<'a> Foo<&'a int>
66+
// for<'a> Foo<&'a i32>
6767
//
6868
// and
6969
//
70-
// for<'b> Foo<&'b int>
70+
// for<'b> Foo<&'b i32>
7171
//
7272
// to be considered equivalent. So normalize all late-bound
7373
// regions before we throw things into the underlying set.

src/librustc_middle/traits/mod.rs

+15-13
Original file line numberDiff line numberDiff line change
@@ -393,23 +393,25 @@ pub type SelectionResult<'tcx, T> = Result<Option<T>, SelectionError<'tcx>>;
393393
/// ```
394394
/// impl<T:Clone> Clone<T> for Option<T> { ... } // Impl_1
395395
/// impl<T:Clone> Clone<T> for Box<T> { ... } // Impl_2
396-
/// impl Clone for int { ... } // Impl_3
396+
/// impl Clone for i32 { ... } // Impl_3
397397
///
398-
/// fn foo<T:Clone>(concrete: Option<Box<int>>,
399-
/// param: T,
400-
/// mixed: Option<T>) {
398+
/// fn foo<T: Clone>(concrete: Option<Box<i32>>, param: T, mixed: Option<T>) {
399+
/// // Case A: Vtable points at a specific impl. Only possible when
400+
/// // type is concretely known. If the impl itself has bounded
401+
/// // type parameters, Vtable will carry resolutions for those as well:
402+
/// concrete.clone(); // Vtable(Impl_1, [Vtable(Impl_2, [Vtable(Impl_3)])])
401403
///
402-
/// // Case A: ImplSource points at a specific impl. Only possible when
403-
/// // type is concretely known. If the impl itself has bounded
404-
/// // type parameters, ImplSource will carry resolutions for those as well:
405-
/// concrete.clone(); // ImplSource(Impl_1, [ImplSource(Impl_2, [ImplSource(Impl_3)])])
404+
/// // Case A: ImplSource points at a specific impl. Only possible when
405+
/// // type is concretely known. If the impl itself has bounded
406+
/// // type parameters, ImplSource will carry resolutions for those as well:
407+
/// concrete.clone(); // ImplSource(Impl_1, [ImplSource(Impl_2, [ImplSource(Impl_3)])])
406408
///
407-
/// // Case B: ImplSource must be provided by caller. This applies when
408-
/// // type is a type parameter.
409-
/// param.clone(); // ImplSourceParam
409+
/// // Case B: ImplSource must be provided by caller. This applies when
410+
/// // type is a type parameter.
411+
/// param.clone(); // ImplSourceParam
410412
///
411-
/// // Case C: A mix of cases A and B.
412-
/// mixed.clone(); // ImplSource(Impl_1, [ImplSourceParam])
413+
/// // Case C: A mix of cases A and B.
414+
/// mixed.clone(); // ImplSource(Impl_1, [ImplSourceParam])
413415
/// }
414416
/// ```
415417
///

src/librustc_middle/ty/subst.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -599,12 +599,12 @@ impl<'a, 'tcx> SubstFolder<'a, 'tcx> {
599599
///
600600
/// ```
601601
/// type Func<A> = fn(A);
602-
/// type MetaFunc = for<'a> fn(Func<&'a int>)
602+
/// type MetaFunc = for<'a> fn(Func<&'a i32>)
603603
/// ```
604604
///
605605
/// The type `MetaFunc`, when fully expanded, will be
606606
///
607-
/// for<'a> fn(fn(&'a int))
607+
/// for<'a> fn(fn(&'a i32))
608608
/// ^~ ^~ ^~~
609609
/// | | |
610610
/// | | DebruijnIndex of 2
@@ -613,26 +613,26 @@ impl<'a, 'tcx> SubstFolder<'a, 'tcx> {
613613
/// Here the `'a` lifetime is bound in the outer function, but appears as an argument of the
614614
/// inner one. Therefore, that appearance will have a DebruijnIndex of 2, because we must skip
615615
/// over the inner binder (remember that we count De Bruijn indices from 1). However, in the
616-
/// definition of `MetaFunc`, the binder is not visible, so the type `&'a int` will have a
616+
/// definition of `MetaFunc`, the binder is not visible, so the type `&'a i32` will have a
617617
/// De Bruijn index of 1. It's only during the substitution that we can see we must increase the
618618
/// depth by 1 to account for the binder that we passed through.
619619
///
620620
/// As a second example, consider this twist:
621621
///
622622
/// ```
623623
/// type FuncTuple<A> = (A,fn(A));
624-
/// type MetaFuncTuple = for<'a> fn(FuncTuple<&'a int>)
624+
/// type MetaFuncTuple = for<'a> fn(FuncTuple<&'a i32>)
625625
/// ```
626626
///
627627
/// Here the final type will be:
628628
///
629-
/// for<'a> fn((&'a int, fn(&'a int)))
629+
/// for<'a> fn((&'a i32, fn(&'a i32)))
630630
/// ^~~ ^~~
631631
/// | |
632632
/// DebruijnIndex of 1 |
633633
/// DebruijnIndex of 2
634634
///
635-
/// As indicated in the diagram, here the same type `&'a int` is substituted once, but in the
635+
/// As indicated in the diagram, here the same type `&'a i32` is substituted once, but in the
636636
/// first case we do not increase the De Bruijn index and in the second case we do. The reason
637637
/// is that only in the second case have we passed through a fn binder.
638638
fn shift_vars_through_binders<T: TypeFoldable<'tcx>>(&self, val: T) -> T {

src/librustc_middle/ty/walk.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ impl<'tcx> TypeWalker<'tcx> {
2222
/// Skips the subtree corresponding to the last type
2323
/// returned by `next()`.
2424
///
25-
/// Example: Imagine you are walking `Foo<Bar<int>, usize>`.
25+
/// Example: Imagine you are walking `Foo<Bar<i32>, usize>`.
2626
///
2727
/// ```
2828
/// let mut iter: TypeWalker = ...;
2929
/// iter.next(); // yields Foo
30-
/// iter.next(); // yields Bar<int>
31-
/// iter.skip_current_subtree(); // skips int
30+
/// iter.next(); // yields Bar<i32>
31+
/// iter.skip_current_subtree(); // skips i32
3232
/// iter.next(); // yields usize
3333
/// ```
3434
pub fn skip_current_subtree(&mut self) {

src/librustc_trait_selection/traits/project.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
361361
// handle normalization within binders because
362362
// otherwise we wind up a need to normalize when doing
363363
// trait matching (since you can have a trait
364-
// obligation like `for<'a> T::B : Fn(&'a int)`), but
364+
// obligation like `for<'a> T::B: Fn(&'a i32)`), but
365365
// we can't normalize with bound regions in scope. So
366366
// far now we just ignore binders but only normalize
367367
// if all bound regions are gone (and then we still

src/librustc_trait_selection/traits/query/normalize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
145145
// handle normalization within binders because
146146
// otherwise we wind up a need to normalize when doing
147147
// trait matching (since you can have a trait
148-
// obligation like `for<'a> T::B : Fn(&'a int)`), but
148+
// obligation like `for<'a> T::B: Fn(&'a i32)`), but
149149
// we can't normalize with bound regions in scope. So
150150
// far now we just ignore binders but only normalize
151151
// if all bound regions are gone (and then we still

src/librustc_trait_selection/traits/select/confirmation.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -553,14 +553,14 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
553553
///
554554
/// Here is an example. Imagine we have a closure expression
555555
/// and we desugared it so that the type of the expression is
556-
/// `Closure`, and `Closure` expects an int as argument. Then it
556+
/// `Closure`, and `Closure` expects `i32` as argument. Then it
557557
/// is "as if" the compiler generated this impl:
558558
///
559-
/// impl Fn(int) for Closure { ... }
559+
/// impl Fn(i32) for Closure { ... }
560560
///
561-
/// Now imagine our obligation is `Fn(usize) for Closure`. So far
561+
/// Now imagine our obligation is `Closure: Fn(usize)`. So far
562562
/// we have matched the self type `Closure`. At this point we'll
563-
/// compare the `int` to `usize` and generate an error.
563+
/// compare the `i32` to `usize` and generate an error.
564564
///
565565
/// Note that this checking occurs *after* the impl has selected,
566566
/// because these output type parameters should not affect the

src/librustc_trait_selection/traits/select/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1762,7 +1762,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
17621762
// The strategy is to:
17631763
//
17641764
// 1. Instantiate those regions to placeholder regions (e.g.,
1765-
// `for<'a> &'a int` becomes `&0 i32`.
1765+
// `for<'a> &'a i32` becomes `&0 i32`.
17661766
// 2. Produce something like `&'0 i32 : Copy`
17671767
// 3. Re-bind the regions back to `for<'a> &'a i32 : Copy`
17681768

src/librustc_typeck/astconv.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1394,13 +1394,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
13941394
// That is, consider this case:
13951395
//
13961396
// ```
1397-
// trait SubTrait: SuperTrait<int> { }
1397+
// trait SubTrait: SuperTrait<i32> { }
13981398
// trait SuperTrait<A> { type T; }
13991399
//
14001400
// ... B: SubTrait<T = foo> ...
14011401
// ```
14021402
//
1403-
// We want to produce `<B as SuperTrait<int>>::T == foo`.
1403+
// We want to produce `<B as SuperTrait<i32>>::T == foo`.
14041404

14051405
// Find any late-bound regions declared in `ty` that are not
14061406
// declared in the trait-ref. These are not well-formed.

src/librustc_typeck/check/method/probe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
14681468
///
14691469
/// ```
14701470
/// trait Foo { ... }
1471-
/// impl Foo for Vec<int> { ... }
1471+
/// impl Foo for Vec<i32> { ... }
14721472
/// impl Foo for Vec<usize> { ... }
14731473
/// ```
14741474
///

src/librustc_typeck/check/pat.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
212212
// errors in some cases, such as this one:
213213
//
214214
// ```
215-
// fn foo<'x>(x: &'x int) {
215+
// fn foo<'x>(x: &'x i32) {
216216
// let a = 1;
217217
// let mut z = x;
218218
// z = &a;
219219
// }
220220
// ```
221221
//
222222
// The reason we might get an error is that `z` might be
223-
// assigned a type like `&'x int`, and then we would have
223+
// assigned a type like `&'x i32`, and then we would have
224224
// a problem when we try to assign `&a` to `z`, because
225225
// the lifetime of `&a` (i.e., the enclosing block) is
226226
// shorter than `'x`.
@@ -229,11 +229,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
229229
// expected type here is whatever type the user wrote, not
230230
// the initializer's type. In this case the user wrote
231231
// nothing, so we are going to create a type variable `Z`.
232-
// Then we will assign the type of the initializer (`&'x
233-
// int`) as a subtype of `Z`: `&'x int <: Z`. And hence we
234-
// will instantiate `Z` as a type `&'0 int` where `'0` is
235-
// a fresh region variable, with the constraint that `'x :
236-
// '0`. So basically we're all set.
232+
// Then we will assign the type of the initializer (`&'x i32`)
233+
// as a subtype of `Z`: `&'x i32 <: Z`. And hence we
234+
// will instantiate `Z` as a type `&'0 i32` where `'0` is
235+
// a fresh region variable, with the constraint that `'x : '0`.
236+
// So basically we're all set.
237237
//
238238
// Note that there are two tests to check that this remains true
239239
// (`regions-reassign-{match,let}-bound-pointer.rs`).

0 commit comments

Comments
 (0)