Skip to content

Commit ce76bff

Browse files
committed
Auto merge of #23630 - nrc:coerce-tidy, r=<try>
See notes on the first commit Closes #18601 r? @nikomatsakis cc @eddyb
2 parents 809a554 + a7b6af9 commit ce76bff

File tree

95 files changed

+574
-600
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+574
-600
lines changed

src/libarena/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,8 @@ impl<T> TypedArenaChunk<T> {
429429
// Destroy the next chunk.
430430
let next = self.next;
431431
let size = calculate_size::<T>(self.capacity);
432-
deallocate(self as *mut TypedArenaChunk<T> as *mut u8, size,
432+
let self_ptr: *mut TypedArenaChunk<T> = self;
433+
deallocate(self_ptr as *mut u8, size,
433434
mem::min_align_of::<TypedArenaChunk<T>>());
434435
if !next.is_null() {
435436
let capacity = (*next).capacity;

src/libcollections/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
html_root_url = "http://doc.rust-lang.org/nightly/",
2424
html_playground_url = "http://play.rust-lang.org/")]
2525

26+
#![allow(trivial_casts)]
27+
#![allow(trivial_numeric_casts)]
2628
#![feature(alloc)]
2729
#![feature(box_syntax)]
2830
#![feature(box_patterns)]

src/libcollections/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,8 +1186,8 @@ impl<T: PartialEq> Vec<T> {
11861186

11871187
// Avoid bounds checks by using unsafe pointers.
11881188
let p = self.as_mut_ptr();
1189-
let mut r = 1;
1190-
let mut w = 1;
1189+
let mut r: usize = 1;
1190+
let mut w: usize = 1;
11911191

11921192
while r < ln {
11931193
let p_r = p.offset(r as isize);

src/libcore/cell.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,11 @@ impl<T> UnsafeCell<T> {
712712
/// ```
713713
#[inline]
714714
#[stable(feature = "rust1", since = "1.0.0")]
715-
pub fn get(&self) -> *mut T { &self.value as *const T as *mut T }
715+
pub fn get(&self) -> *mut T {
716+
// FIXME(#23542) Replace with type ascription.
717+
#![allow(trivial_casts)]
718+
&self.value as *const T as *mut T
719+
}
716720

717721
/// Unwraps the value
718722
///

src/libcore/fmt/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,20 +829,26 @@ impl<T> Pointer for *const T {
829829
#[stable(feature = "rust1", since = "1.0.0")]
830830
impl<T> Pointer for *mut T {
831831
fn fmt(&self, f: &mut Formatter) -> Result {
832+
// FIXME(#23542) Replace with type ascription.
833+
#![allow(trivial_casts)]
832834
Pointer::fmt(&(*self as *const T), f)
833835
}
834836
}
835837

836838
#[stable(feature = "rust1", since = "1.0.0")]
837839
impl<'a, T> Pointer for &'a T {
838840
fn fmt(&self, f: &mut Formatter) -> Result {
841+
// FIXME(#23542) Replace with type ascription.
842+
#![allow(trivial_casts)]
839843
Pointer::fmt(&(*self as *const T), f)
840844
}
841845
}
842846

843847
#[stable(feature = "rust1", since = "1.0.0")]
844848
impl<'a, T> Pointer for &'a mut T {
845849
fn fmt(&self, f: &mut Formatter) -> Result {
850+
// FIXME(#23542) Replace with type ascription.
851+
#![allow(trivial_casts)]
846852
Pointer::fmt(&(&**self as *const T), f)
847853
}
848854
}

src/libcore/fmt/num.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// FIXME: #6220 Implement floating point formatting
1414

1515
#![allow(unsigned_negation)]
16+
#![allow(trivial_numeric_casts)]
1617

1718
use fmt;
1819
use iter::IteratorExt;

src/libcore/hash/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ mod impls {
180180
}
181181

182182
fn hash_slice<H: Hasher>(data: &[$ty], state: &mut H) {
183+
// FIXME(#23542) Replace with type ascription.
184+
#![allow(trivial_casts)]
183185
let newlen = data.len() * ::$ty::BYTES as usize;
184186
let ptr = data.as_ptr() as *const u8;
185187
state.write(unsafe { slice::from_raw_parts(ptr, newlen) })

src/libcore/mem.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ pub fn drop<T>(_x: T) { }
313313
#[inline]
314314
#[stable(feature = "rust1", since = "1.0.0")]
315315
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
316+
// FIXME(#23542) Replace with type ascription.
317+
#![allow(trivial_casts)]
316318
ptr::read(src as *const T as *const U)
317319
}
318320

src/libcore/num/i16.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
1313
#![stable(feature = "rust1", since = "1.0.0")]
1414
#![doc(primitive = "i16")]
15+
#![allow(trivial_numeric_casts)]
1516

1617
int_module! { i16, 16 }

src/libcore/num/i32.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
1313
#![stable(feature = "rust1", since = "1.0.0")]
1414
#![doc(primitive = "i32")]
15+
#![allow(trivial_numeric_casts)]
1516

1617
int_module! { i32, 32 }

0 commit comments

Comments
 (0)