Skip to content

Commit eaca5f8

Browse files
authored
Rollup merge of rust-lang#53743 - oconnor663:target_env, r=kennytm
fix a typo: taget_env -> target_env This typo was introduced in rust-lang#47334. A couple tests bitrotted as a result, so we fix those too, and move them to a more sensible place. Is there some lint we could turn on that would've caught this? It's a drag that cfg typos can silently pass through the compiler.
2 parents d52fea8 + 8486efa commit eaca5f8

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

src/libstd/sys/unix/net.rs

-27
Original file line numberDiff line numberDiff line change
@@ -395,30 +395,3 @@ fn on_resolver_failure() {
395395

396396
#[cfg(not(target_env = "gnu"))]
397397
fn on_resolver_failure() {}
398-
399-
#[cfg(all(test, taget_env = "gnu"))]
400-
mod test {
401-
use super::*;
402-
403-
#[test]
404-
fn test_res_init() {
405-
// This mostly just tests that the weak linkage doesn't panic wildly...
406-
res_init_if_glibc_before_2_26().unwrap();
407-
}
408-
409-
#[test]
410-
fn test_parse_glibc_version() {
411-
let cases = [
412-
("0.0", Some((0, 0))),
413-
("01.+2", Some((1, 2))),
414-
("3.4.5.six", Some((3, 4))),
415-
("1", None),
416-
("1.-2", None),
417-
("1.foo", None),
418-
("foo.1", None),
419-
];
420-
for &(version_str, parsed) in cases.iter() {
421-
assert_eq!(parsed, parse_glibc_version(version_str));
422-
}
423-
}
424-
}

src/libstd/sys/unix/os.rs

+27
Original file line numberDiff line numberDiff line change
@@ -569,3 +569,30 @@ fn parse_glibc_version(version: &str) -> Option<(usize, usize)> {
569569
_ => None
570570
}
571571
}
572+
573+
#[cfg(all(test, target_env = "gnu"))]
574+
mod test {
575+
use super::*;
576+
577+
#[test]
578+
fn test_glibc_version() {
579+
// This mostly just tests that the weak linkage doesn't panic wildly...
580+
glibc_version();
581+
}
582+
583+
#[test]
584+
fn test_parse_glibc_version() {
585+
let cases = [
586+
("0.0", Some((0, 0))),
587+
("01.+2", Some((1, 2))),
588+
("3.4.5.six", Some((3, 4))),
589+
("1", None),
590+
("1.-2", None),
591+
("1.foo", None),
592+
("foo.1", None),
593+
];
594+
for &(version_str, parsed) in cases.iter() {
595+
assert_eq!(parsed, parse_glibc_version(version_str));
596+
}
597+
}
598+
}

0 commit comments

Comments
 (0)