File tree 4 files changed +42
-4
lines changed
4 files changed +42
-4
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,26 @@ impl rustc_driver::Callbacks for MiriBeRustCompilerCalls {
179
179
} ) ;
180
180
}
181
181
}
182
+
183
+ fn after_analysis < ' tcx > (
184
+ & mut self ,
185
+ _: & rustc_interface:: interface:: Compiler ,
186
+ queries : & ' tcx rustc_interface:: Queries < ' tcx > ,
187
+ ) -> Compilation {
188
+ queries. global_ctxt ( ) . unwrap ( ) . enter ( |tcx| {
189
+ if self . target_crate {
190
+ // cargo-miri has patched the compiler flags to make these into check-only builds,
191
+ // but we are still emulating regular rustc builds, which would perform post-mono
192
+ // const-eval during collection. So let's also do that here, even if we might be
193
+ // running with `--emit=metadata`. In particular this is needed to make
194
+ // `compile_fail` doc tests trigger post-mono errors.
195
+ // In general `collect_and_partition_mono_items` is not safe to call in check-only
196
+ // builds, but we are setting `-Zalways-encode-mir` which avoids those issues.
197
+ let _ = tcx. collect_and_partition_mono_items ( ( ) ) ;
198
+ }
199
+ } ) ;
200
+ Compilation :: Continue
201
+ }
182
202
}
183
203
184
204
fn show_error ( msg : & impl std:: fmt:: Display ) -> ! {
Original file line number Diff line number Diff line change 1
1
/// Doc-test test
2
+ ///
2
3
/// ```rust
3
4
/// assert!(cargo_miri_test::make_true());
4
5
/// ```
6
+ ///
7
+ /// `no_run` test:
8
+ ///
5
9
/// ```rust,no_run
6
10
/// assert!(!cargo_miri_test::make_true());
7
11
/// ```
12
+ ///
13
+ /// `compile_fail` test:
14
+ ///
8
15
/// ```rust,compile_fail
9
16
/// assert!(cargo_miri_test::make_true() == 5);
10
17
/// ```
18
+ ///
19
+ /// Post-monomorphization error in `compile_fail` test:
20
+ ///
21
+ /// ```rust,compile_fail
22
+ /// struct Fail<T>(T);
23
+ /// impl<T> Fail<T> {
24
+ /// const C: () = panic!();
25
+ /// }
26
+ ///
27
+ /// let _val = Fail::<i32>::C;
28
+ /// ```
11
29
#[ no_mangle]
12
30
pub fn make_true ( ) -> bool {
13
31
issue_1567:: use_the_dependency ( ) ;
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ running 6 tests
10
10
test result: ok. 5 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
11
11
12
12
13
- running 4 tests
14
- ....
15
- test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
13
+ running 5 tests
14
+ .....
15
+ test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
16
16
Original file line number Diff line number Diff line change @@ -13,5 +13,5 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 5 filtered out
13
13
14
14
running 0 tests
15
15
16
- test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 4 filtered out; finished in $TIME
16
+ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 5 filtered out; finished in $TIME
17
17
You can’t perform that action at this time.
0 commit comments