File tree 4 files changed +37
-13
lines changed
4 files changed +37
-13
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,13 @@ categories = [
16
16
edition = " 2021"
17
17
rust-version = " 1.61.0"
18
18
19
+ # NOTE! As a workaround for https://github.com/rust-lang/rust/issues/97708,
20
+ # maitake uses some `no_mangle` functions. This will cause linker errors if
21
+ # you attempt to use two versions of maitake in the same binary. Until then,
22
+ # we use the "links" key to prevent two versions of maitake in the same
23
+ # dependency graph
24
+ links = " maitake"
25
+
19
26
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
20
27
21
28
[features ]
Original file line number Diff line number Diff line change
1
+ // Part of https://github.com/rust-lang/rust/issues/97708 workaround
2
+ fn main ( ) { }
Original file line number Diff line number Diff line change @@ -437,26 +437,32 @@ unsafe impl Sync for TaskRef {}
437
437
438
438
// === impl Header ===
439
439
440
+ // See https://github.com/rust-lang/rust/issues/97708 for why
441
+ // this is necessary
442
+ #[ no_mangle]
443
+ unsafe fn _maitake_header_nop ( _ptr : TaskRef ) -> Poll < ( ) > {
444
+ #[ cfg( debug_assertions) ]
445
+ unreachable ! ( "stub task ({_ptr:?}) should never be polled!" ) ;
446
+ #[ cfg( not( debug_assertions) ) ]
447
+ Poll :: Pending
448
+ }
449
+
450
+ // See https://github.com/rust-lang/rust/issues/97708 for why
451
+ // this is necessary
452
+ #[ no_mangle]
453
+ unsafe fn _maitake_header_nop_deallocate ( ptr : NonNull < Header > ) {
454
+ unreachable ! ( "stub task ({ptr:p}) should never be deallocated!" ) ;
455
+ }
456
+
440
457
impl Header {
441
458
#[ cfg( not( loom) ) ]
442
459
pub ( crate ) const fn new_stub ( ) -> Self {
443
- unsafe fn nop ( _ptr : TaskRef ) -> Poll < ( ) > {
444
- #[ cfg( debug_assertions) ]
445
- unreachable ! ( "stub task ({_ptr:?}) should never be polled!" ) ;
446
- #[ cfg( not( debug_assertions) ) ]
447
- Poll :: Pending
448
- }
449
-
450
- unsafe fn nop_deallocate ( ptr : NonNull < Header > ) {
451
- unreachable ! ( "stub task ({ptr:p}) should never be deallocated!" ) ;
452
- }
453
-
454
460
Self {
455
461
run_queue : mpsc_queue:: Links :: new_stub ( ) ,
456
462
state : StateCell :: new ( ) ,
457
463
vtable : & Vtable {
458
- poll : nop ,
459
- deallocate : nop_deallocate ,
464
+ poll : _maitake_header_nop ,
465
+ deallocate : _maitake_header_nop_deallocate ,
460
466
} ,
461
467
}
462
468
}
Original file line number Diff line number Diff line change
1
+ use maitake:: scheduler:: TaskStub ;
2
+
3
+ /// This test reproduces an internal compiler error:
4
+ /// https://github.com/rust-lang/rust/issues/97708
5
+ #[ test]
6
+ fn compiles ( ) {
7
+ #[ allow( dead_code) ]
8
+ static TASK_STUB : TaskStub = TaskStub :: new ( ) ;
9
+ }
You can’t perform that action at this time.
0 commit comments