Skip to content

Commit 8fd7f1e

Browse files
committed
Rollup merge of rust-lang#30136 - fhahn:remove-int-from-doc-examples, r=steveklabnik
This PR replaces uses of int/uint in some doc examples in various crates.
2 parents 5e4adf9 + e48030d commit 8fd7f1e

File tree

8 files changed

+22
-20
lines changed

8 files changed

+22
-20
lines changed

src/librustc/middle/infer/region_inference/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ pub enum RegionResolutionError<'tcx> {
159159
/// like to indicate so to the user.
160160
/// For example, the following function
161161
/// ```
162-
/// struct Foo { bar: int }
163-
/// fn foo2<'a, 'b>(x: &'a Foo) -> &'b int {
162+
/// struct Foo { bar: isize }
163+
/// fn foo2<'a, 'b>(x: &'a Foo) -> &'b isize {
164164
/// &x.bar
165165
/// }
166166
/// ```

src/librustc/middle/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
15831583
let r = self.should_warn(var);
15841584
if let Some(name) = r {
15851585

1586-
// annoying: for parameters in funcs like `fn(x: int)
1586+
// annoying: for parameters in funcs like `fn(x: isize)
15871587
// {ret}`, there is only one node, so asking about
15881588
// assigned_on_exit() is not meaningful.
15891589
let is_assigned = if ln == self.s.exit_ln {

src/librustc_borrowck/borrowck/check_loans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,8 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
718718
///
719719
/// For example:
720720
///
721-
/// ```
722-
/// let a: int;
721+
/// ```ignore
722+
/// let a: isize;
723723
/// a = 10; // ok, even though a is uninitialized
724724
///
725725
/// struct Point { x: usize, y: usize }

src/librustc_borrowck/borrowck/gather_loans/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,9 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
486486
//! come about when variables of `&mut` type are re-borrowed,
487487
//! as in this example:
488488
//!
489-
//! fn counter<'a>(v: &'a mut Foo) -> &'a mut uint {
489+
//! struct Foo { counter: usize }
490+
//!
491+
//! fn counter<'a>(v: &'a mut Foo) -> &'a mut usize {
490492
//! &mut v.counter
491493
//! }
492494
//!

src/librustc_trans/trans/debuginfo/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
//!
6767
//! ```
6868
//! struct List {
69-
//! value: int,
69+
//! value: isize,
7070
//! tail: Option<Box<List>>,
7171
//! }
7272
//! ```

src/librustc_trans/trans/meth.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ fn trans_trait_callee_from_llval<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
456456
/// Generate a shim function that allows an object type like `SomeTrait` to
457457
/// implement the type `SomeTrait`. Imagine a trait definition:
458458
///
459-
/// trait SomeTrait { fn get(&self) -> int; ... }
459+
/// trait SomeTrait { fn get(&self) -> isize; ... }
460460
///
461461
/// And a generic bit of code:
462462
///
@@ -468,7 +468,7 @@ fn trans_trait_callee_from_llval<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
468468
/// What is the value of `x` when `foo` is invoked with `T=SomeTrait`?
469469
/// The answer is that it is a shim function generated by this routine:
470470
///
471-
/// fn shim(t: &SomeTrait) -> int {
471+
/// fn shim(t: &SomeTrait) -> isize {
472472
/// // ... call t.get() virtually ...
473473
/// }
474474
///

src/librustc_typeck/check/regionck.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
//! There are a number of troublesome scenarios in the tests
6060
//! `region-dependent-*.rs`, but here is one example:
6161
//!
62-
//! struct Foo { i: int }
62+
//! struct Foo { i: isize }
6363
//! struct Bar { foo: Foo }
6464
//! fn get_i(x: &'a Bar) -> &'a int {
6565
//! let foo = &x.foo; // Lifetime L1
@@ -233,8 +233,8 @@ impl<'a, 'tcx> Rcx<'a, 'tcx> {
233233
/// Consider this silly example:
234234
///
235235
/// ```
236-
/// fn borrow(x: &int) -> &int {x}
237-
/// fn foo(x: @int) -> int { // block: B
236+
/// fn borrow(x: &int) -> &isize {x}
237+
/// fn foo(x: @int) -> isize { // block: B
238238
/// let b = borrow(x); // region: <R0>
239239
/// *b
240240
/// }
@@ -243,7 +243,7 @@ impl<'a, 'tcx> Rcx<'a, 'tcx> {
243243
/// Here, the region of `b` will be `<R0>`. `<R0>` is constrained to be some subregion of the
244244
/// block B and some superregion of the call. If we forced it now, we'd choose the smaller
245245
/// region (the call). But that would make the *b illegal. Since we don't resolve, the type
246-
/// of b will be `&<R0>.int` and then `*b` will require that `<R0>` be bigger than the let and
246+
/// of b will be `&<R0>.isize` and then `*b` will require that `<R0>` be bigger than the let and
247247
/// the `*b` expression, so we will effectively resolve `<R0>` to be the block B.
248248
pub fn resolve_type(&self, unresolved_ty: Ty<'tcx>) -> Ty<'tcx> {
249249
self.fcx.infcx().resolve_type_vars_if_possible(&unresolved_ty)

src/librustc_typeck/variance.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,14 @@
172172
//!
173173
//! Now imagine that I have an implementation of `ConvertTo` for `Object`:
174174
//!
175-
//! impl ConvertTo<int> for Object { ... }
175+
//! impl ConvertTo<isize> for Object { ... }
176176
//!
177177
//! And I want to call `convertAll` on an array of strings. Suppose
178178
//! further that for whatever reason I specifically supply the value of
179179
//! `String` for the type parameter `T`:
180180
//!
181181
//! let mut vector = vec!["string", ...];
182-
//! convertAll::<int, String>(vector);
182+
//! convertAll::<isize, String>(vector);
183183
//!
184184
//! Is this legal? To put another way, can we apply the `impl` for
185185
//! `Object` to the type `String`? The answer is yes, but to see why
@@ -190,25 +190,25 @@
190190
//! - It will then call the impl of `convertTo()` that is intended
191191
//! for use with objects. This has the type:
192192
//!
193-
//! fn(self: &Object) -> int
193+
//! fn(self: &Object) -> isize
194194
//!
195195
//! It is ok to provide a value for `self` of type `&String` because
196196
//! `&String <: &Object`.
197197
//!
198198
//! OK, so intuitively we want this to be legal, so let's bring this back
199199
//! to variance and see whether we are computing the correct result. We
200200
//! must first figure out how to phrase the question "is an impl for
201-
//! `Object,int` usable where an impl for `String,int` is expected?"
201+
//! `Object,isize` usable where an impl for `String,isize` is expected?"
202202
//!
203203
//! Maybe it's helpful to think of a dictionary-passing implementation of
204204
//! type classes. In that case, `convertAll()` takes an implicit parameter
205205
//! representing the impl. In short, we *have* an impl of type:
206206
//!
207-
//! V_O = ConvertTo<int> for Object
207+
//! V_O = ConvertTo<isize> for Object
208208
//!
209209
//! and the function prototype expects an impl of type:
210210
//!
211-
//! V_S = ConvertTo<int> for String
211+
//! V_S = ConvertTo<isize> for String
212212
//!
213213
//! As with any argument, this is legal if the type of the value given
214214
//! (`V_O`) is a subtype of the type expected (`V_S`). So is `V_O <: V_S`?
@@ -217,7 +217,7 @@
217217
//! covariant, it means that:
218218
//!
219219
//! V_O <: V_S iff
220-
//! int <: int
220+
//! isize <: isize
221221
//! String <: Object
222222
//!
223223
//! These conditions are satisfied and so we are happy.

0 commit comments

Comments
 (0)