Skip to content

Commit 272bae3

Browse files
committed
Update tests
1 parent 9bc0e5b commit 272bae3

30 files changed

+71
-60
lines changed

compiler/rustc_middle/src/hir/nested_filter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_hir::intravisit::nested_filter::NestedFilter;
1111
/// to use `visit_all_item_likes_in_crate()` as an outer loop,
1212
/// and to have the visitor that visits the contents of each item
1313
/// using this setting.
14-
pub struct OnlyBodies(());
14+
pub struct OnlyBodies;
1515
impl<'hir> NestedFilter<'hir> for OnlyBodies {
1616
type Map = crate::hir::map::Map<'hir>;
1717
const INTER: bool = false;

compiler/rustc_mir_transform/src/validate.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,8 +689,10 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
689689
if Some(adt_def.did()) == self.tcx.lang_items().dyn_metadata() {
690690
self.fail(
691691
location,
692-
format!("You can't project to field {f:?} of `DynMetadata` because \
693-
layout is weird and thinks it doesn't have fields."),
692+
format!(
693+
"You can't project to field {f:?} of `DynMetadata` because \
694+
layout is weird and thinks it doesn't have fields."
695+
),
694696
);
695697
}
696698

library/alloc/src/string.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ pub struct FromUtf8Error {
420420
///
421421
/// assert!(String::from_utf16(v).is_err());
422422
/// ```
423+
#[cfg(not(no_global_oom_handling))]
423424
#[stable(feature = "rust1", since = "1.0.0")]
424425
#[derive(Debug)]
425426
pub struct FromUtf16Error(());
@@ -2069,6 +2070,7 @@ impl fmt::Display for FromUtf8Error {
20692070
}
20702071
}
20712072

2073+
#[cfg(not(no_global_oom_handling))]
20722074
#[stable(feature = "rust1", since = "1.0.0")]
20732075
impl fmt::Display for FromUtf16Error {
20742076
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -2084,6 +2086,7 @@ impl Error for FromUtf8Error {
20842086
}
20852087
}
20862088

2089+
#[cfg(not(no_global_oom_handling))]
20872090
#[stable(feature = "rust1", since = "1.0.0")]
20882091
impl Error for FromUtf16Error {
20892092
#[allow(deprecated)]

library/core/src/ptr/metadata.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,18 +209,14 @@ impl<Dyn: ?Sized> DynMetadata<Dyn> {
209209
// Consider a reference like `&(i32, dyn Send)`: the vtable will only store the size of the
210210
// `Send` part!
211211
// SAFETY: DynMetadata always contains a valid vtable pointer
212-
return unsafe {
213-
crate::intrinsics::vtable_size(self.vtable_ptr() as *const ())
214-
};
212+
return unsafe { crate::intrinsics::vtable_size(self.vtable_ptr() as *const ()) };
215213
}
216214

217215
/// Returns the alignment of the type associated with this vtable.
218216
#[inline]
219217
pub fn align_of(self) -> usize {
220218
// SAFETY: DynMetadata always contains a valid vtable pointer
221-
return unsafe {
222-
crate::intrinsics::vtable_align(self.vtable_ptr() as *const ())
223-
};
219+
return unsafe { crate::intrinsics::vtable_align(self.vtable_ptr() as *const ()) };
224220
}
225221

226222
/// Returns the size and alignment together as a `Layout`

tests/codegen-units/item-collection/generic-impl.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ impl<T> Struct<T> {
2424
}
2525
}
2626

27-
pub struct LifeTimeOnly<'a> {
27+
pub struct _LifeTimeOnly<'a> {
2828
_a: &'a u32
2929
}
3030

31-
impl<'a> LifeTimeOnly<'a> {
31+
impl<'a> _LifeTimeOnly<'a> {
3232

33-
//~ MONO_ITEM fn LifeTimeOnly::<'_>::foo
33+
//~ MONO_ITEM fn _LifeTimeOnly::<'_>::foo
3434
pub fn foo(&self) {}
35-
//~ MONO_ITEM fn LifeTimeOnly::<'_>::bar
35+
//~ MONO_ITEM fn _LifeTimeOnly::<'_>::bar
3636
pub fn bar(&'a self) {}
37-
//~ MONO_ITEM fn LifeTimeOnly::<'_>::baz
37+
//~ MONO_ITEM fn _LifeTimeOnly::<'_>::baz
3838
pub fn baz<'b>(&'b self) {}
3939

4040
pub fn non_instantiated<T>(&self) {}

tests/codegen-units/item-collection/overloaded-operators.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
use std::ops::{Index, IndexMut, Add, Deref};
77

8-
pub struct Indexable {
8+
pub struct _Indexable {
99
data: [u8; 3]
1010
}
1111

12-
impl Index<usize> for Indexable {
12+
impl Index<usize> for _Indexable {
1313
type Output = u8;
1414

15-
//~ MONO_ITEM fn <Indexable as std::ops::Index<usize>>::index
15+
//~ MONO_ITEM fn <_Indexable as std::ops::Index<usize>>::index
1616
fn index(&self, index: usize) -> &Self::Output {
1717
if index >= 3 {
1818
&self.data[0]
@@ -22,8 +22,8 @@ impl Index<usize> for Indexable {
2222
}
2323
}
2424

25-
impl IndexMut<usize> for Indexable {
26-
//~ MONO_ITEM fn <Indexable as std::ops::IndexMut<usize>>::index_mut
25+
impl IndexMut<usize> for _Indexable {
26+
//~ MONO_ITEM fn <_Indexable as std::ops::IndexMut<usize>>::index_mut
2727
fn index_mut(&mut self, index: usize) -> &mut Self::Output {
2828
if index >= 3 {
2929
&mut self.data[0]
@@ -34,25 +34,25 @@ impl IndexMut<usize> for Indexable {
3434
}
3535

3636

37-
//~ MONO_ITEM fn <Equatable as std::cmp::PartialEq>::eq
38-
//~ MONO_ITEM fn <Equatable as std::cmp::PartialEq>::ne
37+
//~ MONO_ITEM fn <_Equatable as std::cmp::PartialEq>::eq
38+
//~ MONO_ITEM fn <_Equatable as std::cmp::PartialEq>::ne
3939
#[derive(PartialEq)]
40-
pub struct Equatable(u32);
40+
pub struct _Equatable(u32);
4141

4242

43-
impl Add<u32> for Equatable {
43+
impl Add<u32> for _Equatable {
4444
type Output = u32;
4545

46-
//~ MONO_ITEM fn <Equatable as std::ops::Add<u32>>::add
46+
//~ MONO_ITEM fn <_Equatable as std::ops::Add<u32>>::add
4747
fn add(self, rhs: u32) -> u32 {
4848
self.0 + rhs
4949
}
5050
}
5151

52-
impl Deref for Equatable {
52+
impl Deref for _Equatable {
5353
type Target = u32;
5454

55-
//~ MONO_ITEM fn <Equatable as std::ops::Deref>::deref
55+
//~ MONO_ITEM fn <_Equatable as std::ops::Deref>::deref
5656
fn deref(&self) -> &Self::Target {
5757
&self.0
5858
}

tests/ui/coherence/re-rebalance-coherence.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
extern crate re_rebalance_coherence_lib as lib;
55
use lib::*;
66

7+
#[allow(dead_code)]
78
struct Oracle;
89
impl Backend for Oracle {}
910
impl<'a, T:'a, Tab> QueryFragment<Oracle> for BatchInsert<'a, T, Tab> {}

tests/ui/const-generics/defaults/repr-c-issue-82792.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
//@ run-pass
44

5+
#[allow(dead_code)]
56
#[repr(C)]
67
pub struct Loaf<T: Sized, const N: usize = 1> {
78
head: [T; N],

tests/ui/const-generics/generic_const_exprs/associated-consts.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ impl BlockCipher for BarCipher {
1616
const BLOCK_SIZE: usize = 32;
1717
}
1818

19-
pub struct Block<C>(#[allow(dead_code)] C);
19+
#[allow(dead_code)]
20+
pub struct Block<C>(C);
2021

2122
pub fn test<C: BlockCipher, const M: usize>()
2223
where

tests/ui/const-generics/transparent-maybeunit-array-wrapper.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use std::mem::MaybeUninit;
88

9+
#[allow(dead_code)]
910
#[repr(transparent)]
1011
pub struct MaybeUninitWrapper<const N: usize>(MaybeUninit<[u64; N]>);
1112

0 commit comments

Comments
 (0)