From 83cdae63e8c3428c3dd5c127f349cf8d4416ff5b Mon Sep 17 00:00:00 2001 From: reedlepee Date: Tue, 29 Oct 2013 05:01:56 +0530 Subject: [PATCH 1/6] Replaced empty destructors with NonCopyable #7427 closes #7427 --- src/libsyntax/parse/parser.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 5a5e310e56f43..59e92501fc276 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -340,13 +340,10 @@ pub struct Parser { mod_path_stack: @mut ~[@str], /// Stack of spans of open delimiters. Used for error message. open_braces: @mut ~[Span] + /// removed empty drop function and added a priv new_field of type std::util::NonCopyable + priv new_field: util::NonCopyable } -#[unsafe_destructor] -impl Drop for Parser { - /* do not copy the parser; its state is tied to outside state */ - fn drop(&mut self) {} -} fn is_plain_ident_or_underscore(t: &token::Token) -> bool { is_plain_ident(t) || *t == token::UNDERSCORE From b7e9b0ce32416161cbef7779941e1697bcbf88ee Mon Sep 17 00:00:00 2001 From: reedlepee Date: Tue, 29 Oct 2013 05:20:21 +0530 Subject: [PATCH 2/6] Added the comment #7427 --- src/libsyntax/parse/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 59e92501fc276..8a2d22dd3b2ab 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -340,7 +340,7 @@ pub struct Parser { mod_path_stack: @mut ~[@str], /// Stack of spans of open delimiters. Used for error message. open_braces: @mut ~[Span] - /// removed empty drop function and added a priv new_field of type std::util::NonCopyable + /* do not copy the parser; its state is tied to outside state */ priv new_field: util::NonCopyable } From 6e0737771552ddb3206f32877ede30597f952aa3 Mon Sep 17 00:00:00 2001 From: reedlepee Date: Tue, 29 Oct 2013 05:40:32 +0530 Subject: [PATCH 3/6] Changed name to non_copyable #7427 --- src/libsyntax/parse/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 8a2d22dd3b2ab..c5bdc379dba0f 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -341,7 +341,7 @@ pub struct Parser { /// Stack of spans of open delimiters. Used for error message. open_braces: @mut ~[Span] /* do not copy the parser; its state is tied to outside state */ - priv new_field: util::NonCopyable + priv non_copyable: util::NonCopyable } From 33b9afac4a864b2177046e9314e8e9c0a91b328d Mon Sep 17 00:00:00 2001 From: reedlepee Date: Tue, 29 Oct 2013 15:08:59 +0530 Subject: [PATCH 4/6] updated the places where the struct is created #7427 --- src/libsyntax/parse/parser.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index c5bdc379dba0f..2c09cca578c50 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -309,7 +309,8 @@ pub fn Parser(sess: @mut ParseSess, quote_depth: @mut 0, obsolete_set: @mut HashSet::new(), mod_path_stack: @mut ~[], - open_braces: @mut ~[] + open_braces: @mut ~[], + non_copyable: util::NonCopyable } } @@ -339,7 +340,7 @@ pub struct Parser { /// Used to determine the path to externally loaded source files mod_path_stack: @mut ~[@str], /// Stack of spans of open delimiters. Used for error message. - open_braces: @mut ~[Span] + open_braces: @mut ~[Span], /* do not copy the parser; its state is tied to outside state */ priv non_copyable: util::NonCopyable } From 697813747a2c9f832fa0344621187a23f273b4ca Mon Sep 17 00:00:00 2001 From: reedlepee Date: Tue, 29 Oct 2013 15:23:56 +0530 Subject: [PATCH 5/6] Indentation --- src/libsyntax/parse/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 2c09cca578c50..86061b49ae34c 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -310,7 +310,7 @@ pub fn Parser(sess: @mut ParseSess, obsolete_set: @mut HashSet::new(), mod_path_stack: @mut ~[], open_braces: @mut ~[], - non_copyable: util::NonCopyable + non_copyable: util::NonCopyable } } From b5e073830bb09acd3cd4146a35d5d077b88453b0 Mon Sep 17 00:00:00 2001 From: reedlepee Date: Tue, 29 Oct 2013 15:24:36 +0530 Subject: [PATCH 6/6] removed extra line --- src/libsyntax/parse/parser.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 86061b49ae34c..f6881e4bf31f4 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -345,7 +345,6 @@ pub struct Parser { priv non_copyable: util::NonCopyable } - fn is_plain_ident_or_underscore(t: &token::Token) -> bool { is_plain_ident(t) || *t == token::UNDERSCORE }