@@ -387,7 +387,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
387
387
self . path_all ( DUMMY_SP ,
388
388
true ,
389
389
vec ! (
390
- self . ident_of ( "std ") ,
390
+ self . ident_of_std ( "core ") ,
391
391
self . ident_of( "option" ) ,
392
392
self . ident_of( "Option" )
393
393
) ,
@@ -657,7 +657,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
657
657
}
658
658
fn expr_vec_ng ( & self , sp : Span ) -> P < ast:: Expr > {
659
659
self . expr_call_global ( sp,
660
- vec ! ( self . ident_of ( "std ") ,
660
+ vec ! ( self . ident_of_std ( "collections ") ,
661
661
self . ident_of( "vec" ) ,
662
662
self . ident_of( "Vec" ) ,
663
663
self . ident_of( "new" ) ) ,
@@ -677,7 +677,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
677
677
678
678
fn expr_some ( & self , sp : Span , expr : P < ast:: Expr > ) -> P < ast:: Expr > {
679
679
let some = vec ! (
680
- self . ident_of ( "std ") ,
680
+ self . ident_of_std ( "core ") ,
681
681
self . ident_of( "option" ) ,
682
682
self . ident_of( "Option" ) ,
683
683
self . ident_of( "Some" ) ) ;
@@ -686,7 +686,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
686
686
687
687
fn expr_none ( & self , sp : Span ) -> P < ast:: Expr > {
688
688
let none = self . path_global ( sp, vec ! (
689
- self . ident_of ( "std ") ,
689
+ self . ident_of_std ( "core ") ,
690
690
self . ident_of( "option" ) ,
691
691
self . ident_of( "Option" ) ,
692
692
self . ident_of( "None" ) ) ) ;
@@ -713,7 +713,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
713
713
self . expr_call_global (
714
714
span,
715
715
vec ! (
716
- self . ident_of ( "std ") ,
716
+ self . ident_of_std ( "core ") ,
717
717
self . ident_of( "rt" ) ,
718
718
self . ident_of( "begin_unwind" ) ) ,
719
719
vec ! (
@@ -729,7 +729,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
729
729
730
730
fn expr_ok ( & self , sp : Span , expr : P < ast:: Expr > ) -> P < ast:: Expr > {
731
731
let ok = vec ! (
732
- self . ident_of ( "std ") ,
732
+ self . ident_of_std ( "core ") ,
733
733
self . ident_of( "result" ) ,
734
734
self . ident_of( "Result" ) ,
735
735
self . ident_of( "Ok" ) ) ;
@@ -738,18 +738,28 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
738
738
739
739
fn expr_err ( & self , sp : Span , expr : P < ast:: Expr > ) -> P < ast:: Expr > {
740
740
let err = vec ! (
741
- self . ident_of ( "std ") ,
741
+ self . ident_of_std ( "core ") ,
742
742
self . ident_of( "result" ) ,
743
743
self . ident_of( "Result" ) ,
744
744
self . ident_of( "Err" ) ) ;
745
745
self . expr_call_global ( sp, err, vec ! ( expr) )
746
746
}
747
747
748
748
fn expr_try ( & self , sp : Span , head : P < ast:: Expr > ) -> P < ast:: Expr > {
749
- let ok = self . ident_of ( "Ok" ) ;
750
- let ok_path = self . path_ident ( sp, ok) ;
751
- let err = self . ident_of ( "Err" ) ;
752
- let err_path = self . path_ident ( sp, err) ;
749
+ let ok = vec ! [
750
+ self . ident_of_std( "core" ) ,
751
+ self . ident_of( "result" ) ,
752
+ self . ident_of( "Result" ) ,
753
+ self . ident_of( "Ok" )
754
+ ] ;
755
+ let ok_path = self . path_global ( sp, ok) ;
756
+ let err = vec ! [
757
+ self . ident_of_std( "core" ) ,
758
+ self . ident_of( "result" ) ,
759
+ self . ident_of( "Result" ) ,
760
+ self . ident_of( "Err" )
761
+ ] ;
762
+ let err_path = self . path_global ( sp, err) ;
753
763
754
764
let binding_variable = self . ident_of ( "__try_var" ) ;
755
765
let binding_pat = self . pat_ident ( sp, binding_variable) ;
@@ -759,8 +769,9 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
759
769
let ok_pat = self . pat_enum ( sp, ok_path, vec ! ( binding_pat. clone( ) ) ) ;
760
770
761
771
// Err(__try_var) (pattern and expression resp.)
762
- let err_pat = self . pat_enum ( sp, err_path, vec ! ( binding_pat) ) ;
763
- let err_inner_expr = self . expr_call_ident ( sp, err, vec ! ( binding_expr. clone( ) ) ) ;
772
+ let err_pat = self . pat_enum ( sp, err_path. clone ( ) , vec ! ( binding_pat) ) ;
773
+ let err_inner_expr = self . expr_call ( sp, self . expr_path ( err_path) ,
774
+ vec ! ( binding_expr. clone( ) ) ) ;
764
775
// return Err(__try_var)
765
776
let err_expr = self . expr ( sp, ast:: ExprRet ( Some ( err_inner_expr) ) ) ;
766
777
@@ -809,7 +820,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
809
820
810
821
fn pat_some ( & self , span : Span , pat : P < ast:: Pat > ) -> P < ast:: Pat > {
811
822
let some = vec ! (
812
- self . ident_of ( "std ") ,
823
+ self . ident_of_std ( "core ") ,
813
824
self . ident_of( "option" ) ,
814
825
self . ident_of( "Option" ) ,
815
826
self . ident_of( "Some" ) ) ;
@@ -819,7 +830,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
819
830
820
831
fn pat_none ( & self , span : Span ) -> P < ast:: Pat > {
821
832
let some = vec ! (
822
- self . ident_of ( "std ") ,
833
+ self . ident_of_std ( "core ") ,
823
834
self . ident_of( "option" ) ,
824
835
self . ident_of( "Option" ) ,
825
836
self . ident_of( "None" ) ) ;
@@ -829,7 +840,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
829
840
830
841
fn pat_ok ( & self , span : Span , pat : P < ast:: Pat > ) -> P < ast:: Pat > {
831
842
let some = vec ! (
832
- self . ident_of ( "std ") ,
843
+ self . ident_of_std ( "core ") ,
833
844
self . ident_of( "result" ) ,
834
845
self . ident_of( "Result" ) ,
835
846
self . ident_of( "Ok" ) ) ;
@@ -839,7 +850,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
839
850
840
851
fn pat_err ( & self , span : Span , pat : P < ast:: Pat > ) -> P < ast:: Pat > {
841
852
let some = vec ! (
842
- self . ident_of ( "std ") ,
853
+ self . ident_of_std ( "core ") ,
843
854
self . ident_of( "result" ) ,
844
855
self . ident_of( "Result" ) ,
845
856
self . ident_of( "Err" ) ) ;
0 commit comments