Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 155ca3d

Browse files
authored
Update tests
1 parent 999a162 commit 155ca3d

File tree

266 files changed

+1031
-230
lines changed

Some content is hidden

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

266 files changed

+1031
-230
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
}

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
@@ -1,28 +1,34 @@
11
trait Foo: PartialEq<i32> + std::fmt::Debug + Send + Sync {
2+
#[allow(dead_code)]
23
fn a(&self) -> i32 {
34
10
45
}
56

7+
#[allow(dead_code)]
68
fn z(&self) -> i32 {
79
11
810
}
911

12+
#[allow(dead_code)]
1013
fn y(&self) -> i32 {
1114
12
1215
}
1316
}
1417

1518
trait Bar: Foo {
19+
#[allow(dead_code)]
1620
fn b(&self) -> i32 {
1721
20
1822
}
1923

24+
#[allow(dead_code)]
2025
fn w(&self) -> i32 {
2126
21
2227
}
2328
}
2429

2530
trait Baz: Bar {
31+
#[allow(dead_code)]
2632
fn c(&self) -> i32 {
2733
30
2834
}

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
@@ -380,14 +380,17 @@ fn struct_() {
380380

381381
fn replace_vptr() {
382382
trait A {
383+
#[allow(dead_code)]
383384
fn foo_a(&self);
384385
}
385386

386387
trait B {
388+
#[allow(dead_code)]
387389
fn foo_b(&self);
388390
}
389391

390392
trait C: A + B {
393+
#[allow(dead_code)]
391394
fn foo_c(&self);
392395
}
393396

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use std::path::{Path, PathBuf};
1010

1111
const ENTRY_LIMIT: usize = 900;
1212
// FIXME: The following limits should be reduced eventually.
13-
const ISSUES_ENTRY_LIMIT: usize = 1849;
14-
const ROOT_ENTRY_LIMIT: usize = 870;
13+
const ISSUES_ENTRY_LIMIT: usize = 1861;
14+
const ROOT_ENTRY_LIMIT: usize = 872;
1515

1616
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
1717
"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]

tests/codegen-units/item-collection/trait-method-default-impl.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,8 @@ fn start(_: isize, _: *const *const u8) -> isize {
5757
//~ MONO_ITEM fn <u32 as SomeGenericTrait<i16>>::bar::<()>
5858
0u32.bar(0i16, ());
5959

60+
0i8.foo();
61+
0i32.foo();
62+
6063
0
6164
}

0 commit comments

Comments
 (0)