Skip to content

Commit c7519d4

Browse files
committed
Update tests
1 parent 40878ca commit c7519d4

File tree

276 files changed

+1049
-234
lines changed

Some content is hidden

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

276 files changed

+1049
-234
lines changed

compiler/rustc_span/src/source_map/tests.rs

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use super::*;
22

3+
use rustc_data_structures::sync::FreezeLock;
4+
35
fn init_source_map() -> SourceMap {
46
let sm = SourceMap::new(FilePathMapping::empty());
57
sm.new_source_file(PathBuf::from("blork.rs").into(), "first line.\nsecond line".to_string());
@@ -263,53 +265,6 @@ fn t10() {
263265
);
264266
}
265267

266-
/// Returns the span corresponding to the `n`th occurrence of `substring` in `source_text`.
267-
trait SourceMapExtension {
268-
fn span_substr(
269-
&self,
270-
file: &Lrc<SourceFile>,
271-
source_text: &str,
272-
substring: &str,
273-
n: usize,
274-
) -> Span;
275-
}
276-
277-
impl SourceMapExtension for SourceMap {
278-
fn span_substr(
279-
&self,
280-
file: &Lrc<SourceFile>,
281-
source_text: &str,
282-
substring: &str,
283-
n: usize,
284-
) -> Span {
285-
eprintln!(
286-
"span_substr(file={:?}/{:?}, substring={:?}, n={})",
287-
file.name, file.start_pos, substring, n
288-
);
289-
let mut i = 0;
290-
let mut hi = 0;
291-
loop {
292-
let offset = source_text[hi..].find(substring).unwrap_or_else(|| {
293-
panic!(
294-
"source_text `{}` does not have {} occurrences of `{}`, only {}",
295-
source_text, n, substring, i
296-
);
297-
});
298-
let lo = hi + offset;
299-
hi = lo + substring.len();
300-
if i == n {
301-
let span = Span::with_root_ctxt(
302-
BytePos(lo as u32 + file.start_pos.0),
303-
BytePos(hi as u32 + file.start_pos.0),
304-
);
305-
assert_eq!(&self.span_to_snippet(span).unwrap()[..], substring);
306-
return span;
307-
}
308-
i += 1;
309-
}
310-
}
311-
}
312-
313268
// Takes a unix-style path and returns a platform specific path.
314269
fn path(p: &str) -> PathBuf {
315270
path_str(p).into()

library/core/tests/macros.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[allow(dead_code)]
12
trait Trait {
23
fn blah(&self);
34
}

library/std/src/sys_common/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,14 @@ cfg_if::cfg_if! {
5959

6060
/// A trait for viewing representations from std types
6161
#[doc(hidden)]
62+
#[allow(dead_code)] // not used on all platforms
6263
pub trait AsInner<Inner: ?Sized> {
6364
fn as_inner(&self) -> &Inner;
6465
}
6566

6667
/// A trait for viewing representations from std types
6768
#[doc(hidden)]
69+
#[allow(dead_code)] // not used on all platforms
6870
pub trait AsInnerMut<Inner: ?Sized> {
6971
fn as_inner_mut(&mut self) -> &mut Inner;
7072
}

src/tools/miri/tests/fail/dyn-call-trait-mismatch.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
trait T1 {
2+
#[allow(dead_code)]
23
fn method1(self: Box<Self>);
34
}
45
trait T2 {

src/tools/miri/tests/fail/dyn-upcast-trait-mismatch.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,36 @@
22
#![allow(incomplete_features)]
33

44
trait Foo: PartialEq<i32> + std::fmt::Debug + Send + Sync {
5+
#[allow(dead_code)]
56
fn a(&self) -> i32 {
67
10
78
}
89

10+
#[allow(dead_code)]
911
fn z(&self) -> i32 {
1012
11
1113
}
1214

15+
#[allow(dead_code)]
1316
fn y(&self) -> i32 {
1417
12
1518
}
1619
}
1720

1821
trait Bar: Foo {
22+
#[allow(dead_code)]
1923
fn b(&self) -> i32 {
2024
20
2125
}
2226

27+
#[allow(dead_code)]
2328
fn w(&self) -> i32 {
2429
21
2530
}
2631
}
2732

2833
trait Baz: Bar {
34+
#[allow(dead_code)]
2935
fn c(&self) -> i32 {
3036
30
3137
}

src/tools/miri/tests/pass/cast-rfc0401-vtable-kinds.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ trait Foo<T> {
99
}
1010
}
1111

12+
#[allow(dead_code)]
1213
trait Bar {
1314
fn bar(&self) {
1415
println!("Bar!");

src/tools/miri/tests/pass/dyn-upcast.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,14 +383,17 @@ fn struct_() {
383383

384384
fn replace_vptr() {
385385
trait A {
386+
#[allow(dead_code)]
386387
fn foo_a(&self);
387388
}
388389

389390
trait B {
391+
#[allow(dead_code)]
390392
fn foo_b(&self);
391393
}
392394

393395
trait C: A + B {
396+
#[allow(dead_code)]
394397
fn foo_c(&self);
395398
}
396399

src/tools/miri/tests/pass/weak_memory/weak.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use std::sync::atomic::Ordering::*;
1111
use std::sync::atomic::{fence, AtomicUsize};
1212
use std::thread::spawn;
1313

14+
#[allow(dead_code)]
1415
#[derive(Copy, Clone)]
1516
struct EvilSend<T>(pub T);
1617

src/tools/tidy/src/ui_tests.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ use std::path::{Path, PathBuf};
1313
// desirable, because large numbers of files are unwieldy in general. See issue
1414
// #73494.
1515
const ENTRY_LIMIT: usize = 900;
16-
const ISSUES_ENTRY_LIMIT: usize = 1807;
17-
const ROOT_ENTRY_LIMIT: usize = 868;
16+
// FIXME: The following limits should be reduced eventually.
17+
const ISSUES_ENTRY_LIMIT: usize = 1819;
18+
const ROOT_ENTRY_LIMIT: usize = 870;
1819

1920
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
2021
"rs", // test source files

tests/codegen-units/item-collection/instantiation-through-vtable.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ fn start(_: isize, _: *const *const u8) -> isize {
2626
//~ MONO_ITEM fn std::ptr::drop_in_place::<Struct<u32>> - shim(None) @@ instantiation_through_vtable-cgu.0[Internal]
2727
//~ MONO_ITEM fn <Struct<u32> as Trait>::foo
2828
//~ MONO_ITEM fn <Struct<u32> as Trait>::bar
29-
let _ = &s1 as &Trait;
29+
let r1 = &s1 as &Trait;
30+
r1.foo();
31+
r1.bar();
3032

3133
let s1 = Struct { _a: 0u64 };
3234
//~ MONO_ITEM fn std::ptr::drop_in_place::<Struct<u64>> - shim(None) @@ instantiation_through_vtable-cgu.0[Internal]

0 commit comments

Comments
 (0)