Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c7519d4

Browse files
committedFeb 7, 2024
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
}

0 commit comments

Comments
 (0)