Skip to content

Commit 19306c0

Browse files
committed
Fix tests that depended on loose visibility restriction
1 parent e75afeb commit 19306c0

File tree

12 files changed

+90
-89
lines changed

12 files changed

+90
-89
lines changed

crates/hir-def/src/nameres/tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ extern {
5858
"#,
5959
expect![[r#"
6060
crate
61-
E: t
61+
E: _
6262
S: t v
63-
V: t v
63+
V: _
6464
foo: t
6565
6666
crate::foo
@@ -307,7 +307,7 @@ pub struct FromLib;
307307
Bar: t v
308308
309309
crate::foo
310-
Bar: t v
310+
Bar: _
311311
FromLib: t v
312312
"#]],
313313
);

crates/hir-def/src/nameres/tests/globs.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ use foo::*;
119119
use foo::bar::*;
120120
121121
//- /foo/mod.rs
122-
mod bar;
122+
pub mod bar;
123123
fn Foo() {};
124124
pub struct Foo {};
125125
@@ -132,6 +132,7 @@ pub(crate) struct PubCrateStruct;
132132
crate
133133
Foo: t
134134
PubCrateStruct: t v
135+
bar: t
135136
foo: t
136137
137138
crate::foo

crates/hir-def/src/nameres/tests/mod_resolution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ fn module_resolution_decl_inside_inline_module_in_crate_root() {
580580
//- /main.rs
581581
mod foo {
582582
#[path = "baz.rs"]
583-
mod bar;
583+
pub mod bar;
584584
}
585585
use self::foo::bar::Baz;
586586

crates/hir-ty/src/tests/method_resolution.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,16 @@ fn infer_associated_method_with_modules() {
164164
check_infer(
165165
r#"
166166
mod a {
167-
struct A;
167+
pub struct A;
168168
impl A { pub fn thing() -> A { A {} }}
169169
}
170170
171171
mod b {
172-
struct B;
172+
pub struct B;
173173
impl B { pub fn thing() -> u32 { 99 }}
174174
175-
mod c {
176-
struct C;
175+
pub mod c {
176+
pub struct C;
177177
impl C { pub fn thing() -> C { C {} }}
178178
}
179179
}
@@ -186,22 +186,22 @@ fn infer_associated_method_with_modules() {
186186
}
187187
"#,
188188
expect![[r#"
189-
55..63 '{ A {} }': A
190-
57..61 'A {}': A
191-
125..131 '{ 99 }': u32
192-
127..129 '99': u32
193-
201..209 '{ C {} }': C
194-
203..207 'C {}': C
195-
240..324 '{ ...g(); }': ()
196-
250..251 'x': A
197-
254..265 'a::A::thing': fn thing() -> A
198-
254..267 'a::A::thing()': A
199-
277..278 'y': u32
200-
281..292 'b::B::thing': fn thing() -> u32
201-
281..294 'b::B::thing()': u32
202-
304..305 'z': C
203-
308..319 'c::C::thing': fn thing() -> C
204-
308..321 'c::C::thing()': C
189+
59..67 '{ A {} }': A
190+
61..65 'A {}': A
191+
133..139 '{ 99 }': u32
192+
135..137 '99': u32
193+
217..225 '{ C {} }': C
194+
219..223 'C {}': C
195+
256..340 '{ ...g(); }': ()
196+
266..267 'x': A
197+
270..281 'a::A::thing': fn thing() -> A
198+
270..283 'a::A::thing()': A
199+
293..294 'y': u32
200+
297..308 'b::B::thing': fn thing() -> u32
201+
297..310 'b::B::thing()': u32
202+
320..321 'z': C
203+
324..335 'c::C::thing': fn thing() -> C
204+
324..337 'c::C::thing()': C
205205
"#]],
206206
);
207207
}

crates/hir-ty/src/tests/simple.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ fn infer_paths() {
214214
fn a() -> u32 { 1 }
215215
216216
mod b {
217-
fn c() -> u32 { 1 }
217+
pub fn c() -> u32 { 1 }
218218
}
219219
220220
fn test() {
@@ -225,13 +225,13 @@ fn test() {
225225
expect![[r#"
226226
14..19 '{ 1 }': u32
227227
16..17 '1': u32
228-
47..52 '{ 1 }': u32
229-
49..50 '1': u32
230-
66..90 '{ ...c(); }': ()
231-
72..73 'a': fn a() -> u32
232-
72..75 'a()': u32
233-
81..85 'b::c': fn c() -> u32
234-
81..87 'b::c()': u32
228+
51..56 '{ 1 }': u32
229+
53..54 '1': u32
230+
70..94 '{ ...c(); }': ()
231+
76..77 'a': fn a() -> u32
232+
76..79 'a()': u32
233+
85..89 'b::c': fn c() -> u32
234+
85..91 'b::c()': u32
235235
"#]],
236236
);
237237
}
@@ -1856,7 +1856,7 @@ fn not_shadowing_module_by_primitive() {
18561856
check_types(
18571857
r#"
18581858
//- /str.rs
1859-
fn foo() -> u32 {0}
1859+
pub fn foo() -> u32 {0}
18601860
18611861
//- /main.rs
18621862
mod str;

crates/hir-ty/src/tests/traits.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,7 @@ fn where_clause_trait_in_scope_for_method_resolution() {
17061706
check_types(
17071707
r#"
17081708
mod foo {
1709-
trait Trait {
1709+
pub trait Trait {
17101710
fn foo(&self) -> u32 { 0 }
17111711
}
17121712
}
@@ -1723,7 +1723,7 @@ fn super_trait_method_resolution() {
17231723
check_infer(
17241724
r#"
17251725
mod foo {
1726-
trait SuperTrait {
1726+
pub trait SuperTrait {
17271727
fn foo(&self) -> u32 {}
17281728
}
17291729
}
@@ -1735,15 +1735,15 @@ fn test<T: Trait1, U: Trait2>(x: T, y: U) {
17351735
y.foo();
17361736
}"#,
17371737
expect![[r#"
1738-
49..53 'self': &Self
1739-
62..64 '{}': u32
1740-
181..182 'x': T
1741-
187..188 'y': U
1742-
193..222 '{ ...o(); }': ()
1743-
199..200 'x': T
1744-
199..206 'x.foo()': u32
1745-
212..213 'y': U
1746-
212..219 'y.foo()': u32
1738+
53..57 'self': &Self
1739+
66..68 '{}': u32
1740+
185..186 'x': T
1741+
191..192 'y': U
1742+
197..226 '{ ...o(); }': ()
1743+
203..204 'x': T
1744+
203..210 'x.foo()': u32
1745+
216..217 'y': U
1746+
216..223 'y.foo()': u32
17471747
"#]],
17481748
);
17491749
}
@@ -1754,7 +1754,7 @@ fn super_trait_impl_trait_method_resolution() {
17541754
r#"
17551755
//- minicore: sized
17561756
mod foo {
1757-
trait SuperTrait {
1757+
pub trait SuperTrait {
17581758
fn foo(&self) -> u32 {}
17591759
}
17601760
}
@@ -1764,12 +1764,12 @@ fn test(x: &impl Trait1) {
17641764
x.foo();
17651765
}"#,
17661766
expect![[r#"
1767-
49..53 'self': &Self
1768-
62..64 '{}': u32
1769-
115..116 'x': &impl Trait1
1770-
132..148 '{ ...o(); }': ()
1771-
138..139 'x': &impl Trait1
1772-
138..145 'x.foo()': u32
1767+
53..57 'self': &Self
1768+
66..68 '{}': u32
1769+
119..120 'x': &impl Trait1
1770+
136..152 '{ ...o(); }': ()
1771+
142..143 'x': &impl Trait1
1772+
142..149 'x.foo()': u32
17731773
"#]],
17741774
);
17751775
}

crates/ide-assists/src/handlers/add_missing_impl_members.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -379,14 +379,14 @@ impl Foo for S {
379379
r#"
380380
mod foo {
381381
pub struct Bar;
382-
trait Foo { fn foo(&self, bar: Bar); }
382+
pub trait Foo { fn foo(&self, bar: Bar); }
383383
}
384384
struct S;
385385
impl foo::Foo for S { $0 }"#,
386386
r#"
387387
mod foo {
388388
pub struct Bar;
389-
trait Foo { fn foo(&self, bar: Bar); }
389+
pub trait Foo { fn foo(&self, bar: Bar); }
390390
}
391391
struct S;
392392
impl foo::Foo for S {
@@ -439,14 +439,14 @@ impl bar::Foo for S {
439439
r#"
440440
mod foo {
441441
pub struct Bar<T>;
442-
trait Foo { fn foo(&self, bar: Bar<u32>); }
442+
pub trait Foo { fn foo(&self, bar: Bar<u32>); }
443443
}
444444
struct S;
445445
impl foo::Foo for S { $0 }"#,
446446
r#"
447447
mod foo {
448448
pub struct Bar<T>;
449-
trait Foo { fn foo(&self, bar: Bar<u32>); }
449+
pub trait Foo { fn foo(&self, bar: Bar<u32>); }
450450
}
451451
struct S;
452452
impl foo::Foo for S {
@@ -464,14 +464,14 @@ impl foo::Foo for S {
464464
r#"
465465
mod foo {
466466
pub struct Bar<T>;
467-
trait Foo<T> { fn foo(&self, bar: Bar<T>); }
467+
pub trait Foo<T> { fn foo(&self, bar: Bar<T>); }
468468
}
469469
struct S;
470470
impl foo::Foo<u32> for S { $0 }"#,
471471
r#"
472472
mod foo {
473473
pub struct Bar<T>;
474-
trait Foo<T> { fn foo(&self, bar: Bar<T>); }
474+
pub trait Foo<T> { fn foo(&self, bar: Bar<T>); }
475475
}
476476
struct S;
477477
impl foo::Foo<u32> for S {
@@ -489,15 +489,15 @@ impl foo::Foo<u32> for S {
489489
add_missing_impl_members,
490490
r#"
491491
mod foo {
492-
trait Foo<T> { fn foo(&self, bar: T); }
492+
pub trait Foo<T> { fn foo(&self, bar: T); }
493493
pub struct Param;
494494
}
495495
struct Param;
496496
struct S;
497497
impl foo::Foo<Param> for S { $0 }"#,
498498
r#"
499499
mod foo {
500-
trait Foo<T> { fn foo(&self, bar: T); }
500+
pub trait Foo<T> { fn foo(&self, bar: T); }
501501
pub struct Param;
502502
}
503503
struct Param;
@@ -518,15 +518,15 @@ impl foo::Foo<Param> for S {
518518
mod foo {
519519
pub struct Bar<T>;
520520
impl Bar<T> { type Assoc = u32; }
521-
trait Foo { fn foo(&self, bar: Bar<u32>::Assoc); }
521+
pub trait Foo { fn foo(&self, bar: Bar<u32>::Assoc); }
522522
}
523523
struct S;
524524
impl foo::Foo for S { $0 }"#,
525525
r#"
526526
mod foo {
527527
pub struct Bar<T>;
528528
impl Bar<T> { type Assoc = u32; }
529-
trait Foo { fn foo(&self, bar: Bar<u32>::Assoc); }
529+
pub trait Foo { fn foo(&self, bar: Bar<u32>::Assoc); }
530530
}
531531
struct S;
532532
impl foo::Foo for S {
@@ -545,15 +545,15 @@ impl foo::Foo for S {
545545
mod foo {
546546
pub struct Bar<T>;
547547
pub struct Baz;
548-
trait Foo { fn foo(&self, bar: Bar<Baz>); }
548+
pub trait Foo { fn foo(&self, bar: Bar<Baz>); }
549549
}
550550
struct S;
551551
impl foo::Foo for S { $0 }"#,
552552
r#"
553553
mod foo {
554554
pub struct Bar<T>;
555555
pub struct Baz;
556-
trait Foo { fn foo(&self, bar: Bar<Baz>); }
556+
pub trait Foo { fn foo(&self, bar: Bar<Baz>); }
557557
}
558558
struct S;
559559
impl foo::Foo for S {
@@ -571,14 +571,14 @@ impl foo::Foo for S {
571571
r#"
572572
mod foo {
573573
pub trait Fn<Args> { type Output; }
574-
trait Foo { fn foo(&self, bar: dyn Fn(u32) -> i32); }
574+
pub trait Foo { fn foo(&self, bar: dyn Fn(u32) -> i32); }
575575
}
576576
struct S;
577577
impl foo::Foo for S { $0 }"#,
578578
r#"
579579
mod foo {
580580
pub trait Fn<Args> { type Output; }
581-
trait Foo { fn foo(&self, bar: dyn Fn(u32) -> i32); }
581+
pub trait Foo { fn foo(&self, bar: dyn Fn(u32) -> i32); }
582582
}
583583
struct S;
584584
impl foo::Foo for S {

crates/ide-assists/src/handlers/generate_enum_variant.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,12 @@ fn main() {
261261
}
262262
263263
//- /foo.rs
264-
enum Foo {
264+
pub enum Foo {
265265
Bar,
266266
}
267267
",
268268
r"
269-
enum Foo {
269+
pub enum Foo {
270270
Bar,
271271
Baz,
272272
}
@@ -310,7 +310,7 @@ fn main() {
310310
generate_enum_variant,
311311
r"
312312
mod m {
313-
enum Foo {
313+
pub enum Foo {
314314
Bar,
315315
}
316316
}
@@ -320,7 +320,7 @@ fn main() {
320320
",
321321
r"
322322
mod m {
323-
enum Foo {
323+
pub enum Foo {
324324
Bar,
325325
Baz,
326326
}
@@ -516,10 +516,10 @@ mod foo;
516516
use foo::Foo::Bar$0;
517517
518518
//- /foo.rs
519-
enum Foo {}
519+
pub enum Foo {}
520520
",
521521
r"
522-
enum Foo {
522+
pub enum Foo {
523523
Bar,
524524
}
525525
",

0 commit comments

Comments
 (0)