aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/tests
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-16 21:28:23 +0100
committerGitHub <[email protected]>2021-06-16 21:28:23 +0100
commit7b4f5c0262bbdf7e9db81734eb9c82dd04eb82cb (patch)
treec96519e0107b3f844ba4e7d3dc988ef6c3735886 /crates/hir_ty/src/tests
parentd6b8af44829521a9f925c4d87599efa3fef38edc (diff)
parent35772256f8ff3c52e469fc2bd388ad80ff8d79c7 (diff)
Merge #9304
9304: internal: cleanup tests r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/tests')
-rw-r--r--crates/hir_ty/src/tests/regression.rs47
-rw-r--r--crates/hir_ty/src/tests/traits.rs16
2 files changed, 9 insertions, 54 deletions
diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs
index 1edec1615..e0ad41fb9 100644
--- a/crates/hir_ty/src/tests/regression.rs
+++ b/crates/hir_ty/src/tests/regression.rs
@@ -418,48 +418,17 @@ fn issue_2705() {
418fn issue_2683_chars_impl() { 418fn issue_2683_chars_impl() {
419 check_types( 419 check_types(
420 r#" 420 r#"
421//- /main.rs crate:main deps:std 421//- minicore: iterator
422pub struct Chars<'a> {}
423impl<'a> Iterator for Chars<'a> {
424 type Item = char;
425 fn next(&mut self) -> Option<char> {}
426}
427
422fn test() { 428fn test() {
423 let chars: std::str::Chars<'_>; 429 let chars: Chars<'_>;
424 (chars.next(), chars.nth(1)); 430 (chars.next(), chars.nth(1));
425} //^ (Option<char>, Option<char>) 431} //^ (Option<char>, Option<char>)
426
427//- /std.rs crate:std
428#[prelude_import]
429use self::prelude::rust_2018::*;
430pub mod prelude {
431 pub mod rust_2018 {
432 pub use crate::iter::Iterator;
433 pub use crate::option::Option;
434 }
435}
436
437pub mod iter {
438 pub use self::traits::Iterator;
439 pub mod traits {
440 pub use self::iterator::Iterator;
441
442 pub mod iterator {
443 pub trait Iterator {
444 type Item;
445 fn next(&mut self) -> Option<Self::Item>;
446 fn nth(&mut self, n: usize) -> Option<Self::Item> {}
447 }
448 }
449 }
450}
451
452pub mod option {
453 pub enum Option<T> {}
454}
455
456pub mod str {
457 pub struct Chars<'a> {}
458 impl<'a> Iterator for Chars<'a> {
459 type Item = char;
460 fn next(&mut self) -> Option<char> {}
461 }
462}
463"#, 432"#,
464 ); 433 );
465} 434}
diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs
index 065cca74f..22e0bfc49 100644
--- a/crates/hir_ty/src/tests/traits.rs
+++ b/crates/hir_ty/src/tests/traits.rs
@@ -1492,7 +1492,7 @@ fn test<T: Trait<Type = u32>>(x: T, y: impl Trait<Type = i64>) {
1492fn impl_trait_assoc_binding_projection_bug() { 1492fn impl_trait_assoc_binding_projection_bug() {
1493 check_types( 1493 check_types(
1494 r#" 1494 r#"
1495//- /main.rs crate:main deps:std 1495//- minicore: iterator
1496pub trait Language { 1496pub trait Language {
1497 type Kind; 1497 type Kind;
1498} 1498}
@@ -1512,20 +1512,6 @@ fn api_walkthrough() {
1512 node.clone(); 1512 node.clone();
1513 } //^ {unknown} 1513 } //^ {unknown}
1514} 1514}
1515
1516//- /std.rs crate:std
1517#[prelude_import] use iter::*;
1518mod iter {
1519 trait IntoIterator {
1520 type Item;
1521 }
1522 trait Iterator {
1523 type Item;
1524 }
1525 impl<T: Iterator> IntoIterator for T {
1526 type Item = <T as Iterator>::Item;
1527 }
1528}
1529"#, 1515"#,
1530 ); 1516 );
1531} 1517}