File tree 3 files changed +42
-2
lines changed
compiler/rustc_mir_transform/src
tests/ui/polymorphization
3 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -505,6 +505,10 @@ impl<'tcx> Inliner<'tcx> {
505
505
) -> Result < ( ) , & ' static str > {
506
506
let tcx = self . tcx ;
507
507
508
+ if let Some ( _) = callee_body. tainted_by_errors {
509
+ return Err ( "Body is tainted" ) ;
510
+ }
511
+
508
512
let mut threshold = if self . caller_is_inline_forwarder {
509
513
self . tcx . sess . opts . unstable_opts . inline_mir_forwarder_threshold . unwrap_or ( 30 )
510
514
} else if cross_crate_inlinable {
Original file line number Diff line number Diff line change 1
1
//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes
2
- //@ known-bug: #122909
3
2
3
+ #![ feature( unboxed_closures) ]
4
4
5
- use std:: sync:: { Arc , Context , Weak } ;
5
+ use std:: sync:: Arc ;
6
6
7
7
pub struct WeakOnce < T > ( ) ;
8
+ //~^ ERROR type parameter `T` is never used
9
+
8
10
impl < T > WeakOnce < T > {
9
11
extern "rust-call" fn try_get ( & self ) -> Option < Arc < T > > { }
12
+ //~^ ERROR functions with the "rust-call" ABI must take a single non-self tuple argument
13
+ //~| ERROR mismatched types
10
14
11
15
pub fn get ( & self ) -> Arc < T > {
12
16
self . try_get ( )
13
17
. unwrap_or_else ( || panic ! ( "Singleton {} not available" , std:: any:: type_name:: <T >( ) ) )
14
18
}
15
19
}
20
+
21
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0392]: type parameter `T` is never used
2
+ --> $DIR/inline-tainted-body.rs:7:21
3
+ |
4
+ LL | pub struct WeakOnce<T>();
5
+ | ^ unused type parameter
6
+ |
7
+ = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
8
+ = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
9
+
10
+ error: functions with the "rust-call" ABI must take a single non-self tuple argument
11
+ --> $DIR/inline-tainted-body.rs:11:35
12
+ |
13
+ LL | extern "rust-call" fn try_get(&self) -> Option<Arc<T>> {}
14
+ | ^^^^^
15
+
16
+ error[E0308]: mismatched types
17
+ --> $DIR/inline-tainted-body.rs:11:45
18
+ |
19
+ LL | extern "rust-call" fn try_get(&self) -> Option<Arc<T>> {}
20
+ | ------- ^^^^^^^^^^^^^^ expected `Option<Arc<T>>`, found `()`
21
+ | |
22
+ | implicitly returns `()` as its body has no tail or `return` expression
23
+ |
24
+ = note: expected enum `Option<Arc<T>>`
25
+ found unit type `()`
26
+
27
+ error: aborting due to 3 previous errors
28
+
29
+ Some errors have detailed explanations: E0308, E0392.
30
+ For more information about an error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments