File tree 3 files changed +39
-0
lines changed
3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,11 @@ impl IntoSendStr for &'static str {
64
64
fn into_send_str ( self ) -> SendStr { SendStrStatic ( self ) }
65
65
}
66
66
67
+ impl IntoSendStr for SendStr {
68
+ #[ inline]
69
+ fn into_send_str ( self ) -> SendStr { self }
70
+ }
71
+
67
72
/*
68
73
Section: String trait impls.
69
74
`SendStr` should behave like a normal string, so we don't derive.
Original file line number Diff line number Diff line change @@ -974,6 +974,21 @@ fn test_static_named_task() {
974
974
}
975
975
}
976
976
977
+ #[ test]
978
+ fn test_send_named_task ( ) {
979
+ use rt:: test:: run_in_newsched_task;
980
+
981
+ do run_in_newsched_task {
982
+ let mut t = task ( ) ;
983
+ t. name ( "ada lovelace" . into_send_str ( ) ) ;
984
+ do t. spawn {
985
+ do with_task_name |name| {
986
+ assert ! ( name. unwrap( ) == "ada lovelace" ) ;
987
+ }
988
+ }
989
+ }
990
+ }
991
+
977
992
#[ test]
978
993
fn test_run_basic ( ) {
979
994
let ( po, ch) = stream :: < ( ) > ( ) ;
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // error-pattern:task 'send name' failed at 'test'
12
+
13
+ fn main ( ) {
14
+ let mut t = :: std:: task:: task ( ) ;
15
+ t. name ( "send name" . to_send_str ( ) ) ;
16
+ do t. spawn {
17
+ fail2 ! ( "test" ) ;
18
+ }
19
+ }
You can’t perform that action at this time.
0 commit comments