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

Commit ec65b3b

Browse files
committed
fix tests
1 parent 77efa02 commit ec65b3b

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

crates/base-db/src/fixture.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ impl ChangeFixture {
110110
let mut crates = FxHashMap::default();
111111
let mut crate_deps = Vec::new();
112112
let mut default_crate_root: Option<FileId> = None;
113+
let mut default_target_data_layout: Option<String> = None;
113114
let mut default_cfg = CfgOptions::default();
114115

115116
let mut file_set = FileSet::default();
@@ -175,6 +176,7 @@ impl ChangeFixture {
175176
assert!(default_crate_root.is_none());
176177
default_crate_root = Some(file_id);
177178
default_cfg = meta.cfg;
179+
default_target_data_layout = meta.target_data_layout;
178180
}
179181

180182
change.change_file(file_id, Some(Arc::new(text)));
@@ -198,7 +200,7 @@ impl ChangeFixture {
198200
Ok(Vec::new()),
199201
false,
200202
CrateOrigin::CratesIo { repo: None, name: None },
201-
None,
203+
default_target_data_layout.map(|x| x.into()),
202204
);
203205
} else {
204206
for (from, to, prelude) in crate_deps {

crates/ide/src/hover/tests.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ fn hover_field_offset() {
527527
// Hovering over the field when instantiating
528528
check(
529529
r#"
530+
//- /main.rs target_data_layout:e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128
530531
struct Foo { fiel$0d_a: u8, field_b: i32, field_c: i16 }
531532
"#,
532533
expect![[r#"
@@ -548,6 +549,7 @@ fn hover_shows_struct_field_info() {
548549
// Hovering over the field when instantiating
549550
check(
550551
r#"
552+
//- /main.rs target_data_layout:e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128
551553
struct Foo { field_a: u32 }
552554
553555
fn main() {
@@ -570,6 +572,7 @@ fn main() {
570572
// Hovering over the field in the definition
571573
check(
572574
r#"
575+
//- /main.rs target_data_layout:e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128
573576
struct Foo { field_a$0: u32 }
574577
575578
fn main() {
@@ -1515,6 +1518,8 @@ fn my() {}
15151518
fn test_hover_struct_doc_comment() {
15161519
check(
15171520
r#"
1521+
//- /main.rs target_data_layout:e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128
1522+
15181523
/// This is an example
15191524
/// multiline doc
15201525
///
@@ -1573,7 +1578,7 @@ fn foo() { let bar = Ba$0r; }
15731578
```
15741579
15751580
```rust
1576-
struct Bar // size = 0, align = 1
1581+
struct Bar
15771582
```
15781583
15791584
---
@@ -1602,7 +1607,7 @@ fn foo() { let bar = Ba$0r; }
16021607
```
16031608
16041609
```rust
1605-
struct Bar // size = 0, align = 1
1610+
struct Bar
16061611
```
16071612
16081613
---
@@ -1630,7 +1635,7 @@ pub struct B$0ar
16301635
```
16311636
16321637
```rust
1633-
pub struct Bar // size = 0, align = 1
1638+
pub struct Bar
16341639
```
16351640
16361641
---
@@ -1657,7 +1662,7 @@ pub struct B$0ar
16571662
```
16581663
16591664
```rust
1660-
pub struct Bar // size = 0, align = 1
1665+
pub struct Bar
16611666
```
16621667
16631668
---
@@ -2959,6 +2964,8 @@ fn main() { let foo_test = name_with_dashes::wrapper::Thing::new$0(); }
29592964
fn hover_field_pat_shorthand_ref_match_ergonomics() {
29602965
check(
29612966
r#"
2967+
//- /main.rs target_data_layout:e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128
2968+
29622969
struct S {
29632970
f: i32,
29642971
}
@@ -4398,6 +4405,7 @@ fn main() {
43984405
fn hover_intra_doc_links() {
43994406
check(
44004407
r#"
4408+
//- /main.rs target_data_layout:e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128
44014409
44024410
pub mod theitem {
44034411
/// This is the item. Cool!
@@ -4539,7 +4547,7 @@ trait A where
45394547
fn string_shadowed_with_inner_items() {
45404548
check(
45414549
r#"
4542-
//- /main.rs crate:main deps:alloc
4550+
//- /main.rs crate:main deps:alloc target_data_layout:e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128
45434551
45444552
/// Custom `String` type.
45454553
struct String;
@@ -5234,7 +5242,7 @@ foo_macro!(
52345242
```
52355243
52365244
```rust
5237-
pub struct Foo // size = 0, align = 1
5245+
pub struct Foo
52385246
```
52395247
52405248
---
@@ -5248,6 +5256,8 @@ foo_macro!(
52485256
fn hover_intra_in_attr() {
52495257
check(
52505258
r#"
5259+
//- /main.rs target_data_layout:e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128
5260+
52515261
#[doc = "Doc comment for [`Foo$0`]"]
52525262
pub struct Foo(i32);
52535263
"#,
@@ -5368,6 +5378,8 @@ enum Enum {
53685378
fn hover_record_variant_field() {
53695379
check(
53705380
r#"
5381+
//- /main.rs target_data_layout:e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128
5382+
53715383
enum Enum {
53725384
RecordV { field$0: u32 }
53735385
}

0 commit comments

Comments
 (0)