Repository: brendanzab/gl-rs (language: rust)

Issue:
update for rename of methods from str to string
Fixed things so that it works, at least for me on the latest windows nightly.



Discussion / hints:

Fix patch:
diff --git a/deps/glfw-rs b/deps/glfw-rs
index d43e290b..69be01b2 160000
--- a/deps/glfw-rs
+++ b/deps/glfw-rs
@@ -1,1 +1,1 @@
-Subproject commit d43e290b95d7755570561c3c3a2373b1a7e3e99b
+Subproject commit 69be01b2fb9643f324b73e2ba0bfa4c5447820d9
diff --git a/deps/sax-rs b/deps/sax-rs
index 130aee4a..c70eb6bf 160000
--- a/deps/sax-rs
+++ b/deps/sax-rs
@@ -1,1 +1,1 @@
-Subproject commit 130aee4aa3ffeeb8489c4cd37ffda4be7919494e
+Subproject commit c70eb6bf6b2e02765ce472fe3ab4b7ec63cebc8c
diff --git a/src/gl_generator/src/generator.rs b/src/gl_generator/src/generator.rs
index 4ef76fd1..753d811f 100644
--- a/src/gl_generator/src/generator.rs
+++ b/src/gl_generator/src/generator.rs
@@ -16,13 +16,13 @@ fn gen_binding_ident(binding: &Binding, use_idents: bool) -> String {
     // fixed
     if use_idents {
         match binding.ident.as_slice() {
-            "in" => "in_".to_str(),
-            "ref" => "ref_".to_str(),
-            "type" => "type_".to_str(),
-            ident => ident.to_str(),
+            "in" => "in_".to_string(),
+            "ref" => "ref_".to_string(),
+            "type" => "type_".to_string(),
+            ident => ident.to_string(),
         }
     } else {
-        "_".to_str()
+        "_".to_string()
     }
 }
 
@@ -62,7 +62,7 @@ fn gen_symbol_name(ns: &Ns, cmd: &Cmd) -> String {
         Gl => "gl",
         Glx => "glx",
         Wgl => "wgl",
-    }).to_str().append(cmd.proto.ident.as_slice())
+    }).to_string().append(cmd.proto.ident.as_slice())
 }
 
 impl<'a, W: Writer> Generator<'a, W> {
@@ -140,7 +140,7 @@ impl<'a, W: Writer> Generator<'a, W> {
         self.write_line("// See the License for the specific language governing permissions and");
         self.write_line("// limitations under the License.");
         self.write_line("");
-        let ns = self.ns.to_str();
+        let ns = self.ns.to_string();
         self.write_line(format!("#![crate_name = \"{}\"]", ns).as_slice());
         self.write_line("#![comment = \"An OpenGL function loader.\"]");
         self.write_line("#![license = \"ASL2\"]");
diff --git a/src/gl_generator/src/gl_generator.rs b/src/gl_generator/src/gl_generator.rs
index 0e241df0..b6380561 100644
--- a/src/gl_generator/src/gl_generator.rs
+++ b/src/gl_generator/src/gl_generator.rs
@@ -23,15 +23,6 @@
 #![feature(plugin_registrar)]
 #![feature(quote)]
 
-//! Requires libxml2
-//!
-//! This will be used to generate the loader from the [registry xml files]
-//! (https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/):
-//!
-//! - `$ wget --no-check-certificate https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/gl.xml`
-//! - `$ wget --no-check-certificate https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/glx.xml`
-//! - `$ wget --no-check-certificate https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/wgl.xml`
-
 #[phase(plugin, link)]
 extern crate log;
 
diff --git a/src/gl_generator/src/main.rs b/src/gl_generator/src/main.rs
index f1dfe2b6..2b68020e 100644
--- a/src/gl_generator/src/main.rs
+++ b/src/gl_generator/src/main.rs
@@ -21,15 +21,6 @@
 #![feature(macro_rules)]
 #![feature(phase)]
 
-//! Requires libxml2
-//!
-//! This will be used to generate the loader from the [registry xml files]
-//! (https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/):
-//!
-//! - `$ wget --no-check-certificate https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/gl.xml`
-//! - `$ wget --no-check-certificate https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/glx.xml`
-//! - `$ wget --no-check-certificate https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/wgl.xml`
-
 extern crate getopts;
 
 #[phase(plugin, link)]
@@ -60,7 +51,7 @@ fn main() {
         optopt("", "xml", "The xml spec file (<namespace>.xml by default)", ""),
     ];
 
-    let os_args = os::args().iter().map(|x| x.to_str()).collect::<Vec<String>>();
+    let os_args = os::args().iter().map(|x| x.to_string()).collect::<Vec<String>>();
     let args = match getopts(os_args.as_slice(), opts) {
         Ok(a) => a,
         Err(x) => fail!("Error: {}\n{}", x, usage("glrsgen", opts)),
@@ -71,7 +62,7 @@ fn main() {
         return;
     }
 
-    let ns = match args.opt_str("namespace").unwrap_or("gl".to_str()).as_slice() {
+    let ns = match args.opt_str("namespace").unwrap_or("gl".to_string()).as_slice() {
         "gl"  => Gl,
         "glx" => fail!("glx generation unimplemented"),
         "wgl" => fail!("wgl generation unimplemented"),
@@ -87,16 +78,16 @@ fn main() {
     } else {
         Some(Filter {
             extensions: args.opt_strs("extension"),
-            profile: args.opt_str("profile").unwrap_or("core".to_str()),
-            version: args.opt_str("version").unwrap_or("4.3".to_str()),
-            api: args.opt_str("api").unwrap_or("gl".to_str()),
+            profile: args.opt_str("profile").unwrap_or("core".to_string()),
+            version: args.opt_str("version").unwrap_or("4.3".to_string()),
+            api: args.opt_str("api").unwrap_or("gl".to_string()),
         })
     };
 
     let reg = Registry::from_xml(
         File::open(&path).ok()
             .expect(format!("Could not read {}", path.display()).as_slice())
-            .read_to_str().ok()
+            .read_to_string().ok()
             .expect( "registry source not utf8!" ).as_slice(), ns, filter
     );
 
diff --git a/src/gl_generator/src/registry.rs b/src/gl_generator/src/registry.rs
index 8bbfa42c..38ba94a4 100644
--- a/src/gl_generator/src/registry.rs
+++ b/src/gl_generator/src/registry.rs
@@ -263,7 +263,7 @@ impl<'a> RegistryBuilder {
                 Ok(Characters(ref ch)) if ch.as_slice().is_whitespace() => (),
                 Ok(EndDocument) => fail!("The end of the document has been reached"),
                 Ok(event) => return event,
-                Err(err) => fail!("XML error: {}", err.to_str()),
+                Err(err) => fail!("XML error: {}", err.to_string()),
             }
         }
     }
@@ -271,21 +271,21 @@ impl<'a> RegistryBuilder {
     fn expect_characters(&self) -> String {
         match self.recv() {
             Characters(ref ch) => ch.clone(),
-            msg => fail!("Expected characters, found: {}", msg.to_str()),
+            msg => fail!("Expected characters, found: {}", msg.to_string()),
         }
     }
 
     fn expect_start_element(&self, name: &str) -> Attributes {
         match self.recv() {
             StartElement(ref n, ref atts) if name == n.as_slice() => atts.clone(),
-            msg => fail!("Expected <{}>, found: {}", name, msg.to_str()),
+            msg => fail!("Expected <{}>, found: {}", name, msg.to_string()),
         }
     }
 
     fn expect_end_element(&self, name: &str) {
         match self.recv() {
             EndElement(ref n) if name == n.as_slice() => (),
-            msg => fail!("Expected </{}>, found: {}", name, msg.to_str()),
+            msg => fail!("Expected </{}>, found: {}", name, msg.to_string()),
         }
     }
 
@@ -293,7 +293,7 @@ impl<'a> RegistryBuilder {
         loop {
             match self.recv() {
                 EndDocument => fail!("Expected {}, but reached the end of the document.",
-                                     event.to_str()),
+                                     event.to_string()),
                 ref msg if *msg == event => break,
                 _ => (),
             }
@@ -314,8 +314,8 @@ impl<'a> RegistryBuilder {
             match self.recv() {
                 // ignores
                 Characters(_) | Comment(_) => (),
-                StartElement(ref s, _) if s.as_slice() == "comment" => self.skip_until(EndElement("comment".to_str())),
-                StartElement(ref s, _) if s.as_slice() == "types" => self.skip_until(EndElement("types".to_str())),
+                StartElement(ref s, _) if s.as_slice() == "comment" => self.skip_until(EndElement("comment".to_string())),
+                StartElement(ref s, _) if s.as_slice() == "types" => self.skip_until(EndElement("types".to_string())),
 
                 // add groups
                 StartElement(ref s, _) if s.as_slice() == "groups" => {
@@ -327,7 +327,7 @@ impl<'a> RegistryBuilder {
                                 );
                             }
                             EndElement(ref s) if s.as_slice() == "groups" => break,
-                            msg => fail!("Expected </groups>, found: {}", msg.to_str()),
+                            msg => fail!("Expected </groups>, found: {}", msg.to_string()),
                         }
                     }
                 }
@@ -354,7 +354,7 @@ impl<'a> RegistryBuilder {
                                 registry.extensions.push(FromXML::convert(self, atts));
                             }
                             EndElement(ref s) if s.as_slice() == "extensions" => break,
-                            msg => fail!("Unexpected message {}", msg.to_str()),
+                            msg => fail!("Unexpected message {}", msg.to_string()),
                         }
                     }
                 }
@@ -363,7 +363,7 @@ impl<'a> RegistryBuilder {
                 EndElement(ref s) if s.as_slice() == "registry" => break,
 
                 // error handling
-                msg => fail!("Expected </registry>, found: {}", msg.to_str()),
+                msg => fail!("Expected </registry>, found: {}", msg.to_string()),
             }
         }
 
@@ -428,8 +428,8 @@ impl<'a> RegistryBuilder {
 
                 Registry {
                     groups: groups,
-                    enums: enums.move_iter().filter(|e| desired_enums.contains(&("GL_".to_str().append(e.ident.as_slice())))).collect::<Vec<Enum>>(),
-                    cmds: cmds.move_iter().filter(|c| desired_cmds.contains(&("gl".to_str().append(c.proto.ident.as_slice())))).collect::<Vec<Cmd>>(),
+                    enums: enums.move_iter().filter(|e| desired_enums.contains(&("GL_".to_string().append(e.ident.as_slice())))).collect::<Vec<Enum>>(),
+                    cmds: cmds.move_iter().filter(|c| desired_cmds.contains(&("gl".to_string().append(c.proto.ident.as_slice())))).collect::<Vec<Cmd>>(),
                     // these aren't important after this step
                     features: Vec::new(),
                     extensions: Vec::new(),
@@ -484,7 +484,7 @@ impl<'a> RegistryBuilder {
                         fail!("Unexpected end element {}", name);
                     }
                 },
-                msg => fail!("Unexpected message {}", msg.to_str()) }
+                msg => fail!("Unexpected message {}", msg.to_string()) }
         }
     }
 
@@ -497,7 +497,7 @@ impl<'a> RegistryBuilder {
                     self.expect_end_element("enum");
                 }
                 EndElement(ref s) if s.as_slice() == "group" => break,
-                msg => fail!("Expected </group>, found: {}", msg.to_str()),
+                msg => fail!("Expected </group>, found: {}", msg.to_string()),
             }
         }
         Group {
@@ -512,13 +512,13 @@ impl<'a> RegistryBuilder {
             match self.recv() {
                 // ignores
                 Characters(_) | Comment(_) => (),
-                StartElement(ref s, _) if s.as_slice() == "unused" => self.skip_until(EndElement("unused".to_str())),
+                StartElement(ref s, _) if s.as_slice() == "unused" => self.skip_until(EndElement("unused".to_string())),
 
                 // add enum definition
                 StartElement(ref s, ref atts) if s.as_slice() == "enum" => {
                     enums.push(
                         Enum {
-                            ident:  trim_enum_prefix(atts.get("name"), self.ns).to_str(),
+                            ident:  trim_enum_prefix(atts.get("name"), self.ns).to_string(),
                             value:  atts.get_clone("value"),
                             alias:  atts.find_clone("alias"),
                             ty:     atts.find_clone("type"),
@@ -530,7 +530,7 @@ impl<'a> RegistryBuilder {
                 // finished building the namespace
                 EndElement(ref s) if s.as_slice() == "enums" => break,
                 // error handling
-                msg => fail!("Expected </enums>, found: {}", msg.to_str()),
+                msg => fail!("Expected </enums>, found: {}", msg.to_string()),
             }
         }
         enums
@@ -547,7 +547,7 @@ impl<'a> RegistryBuilder {
                 // finished building the namespace
                 EndElement(ref s) if s.as_slice() == "commands" => break,
                 // error handling
-                msg => fail!("Expected </commands>, found: {}", msg.to_str()),
+                msg => fail!("Expected </commands>, found: {}", msg.to_string()),
             }
         }
         cmds
@@ -557,7 +557,7 @@ impl<'a> RegistryBuilder {
         // consume command prototype
         let proto_atts = self.expect_start_element("proto");
         let mut proto = self.consume_binding(proto_atts.find_clone("group"));
-        proto.ident = trim_cmd_prefix(proto.ident.as_slice(), self.ns).to_str();
+        proto.ident = trim_cmd_prefix(proto.ident.as_slice(), self.ns).to_string();
         self.expect_end_element("proto");
 
         let mut params = Vec::new();
@@ -590,7 +590,7 @@ impl<'a> RegistryBuilder {
                     self.expect_end_element("glx");
                 }
                 EndElement(ref s) if s.as_slice() == "command" => break,
-                msg => fail!("Expected </command>, found: {}", msg.to_str()),
+                msg => fail!("Expected </command>, found: {}", msg.to_string()),
             }
         }
         let is_safe = params.len() <= 0 || params.iter().all(|p| !p.ty.as_slice().contains_char('*'));
@@ -614,7 +614,7 @@ impl<'a> RegistryBuilder {
                 StartElement(ref s, _) if s.as_slice() == "ptype" => (),
                 EndElement(ref s) if s.as_slice() == "ptype" => (),
                 StartElement(ref s, _) if s.as_slice() == "name" => break,
-                msg => fail!("Expected binding, found: {}", msg.to_str()),
+                msg => fail!("Expected binding, found: {}", msg.to_string()),
             }
         }
         // consume identifier
@@ -686,7 +686,7 @@ impl FromXML for Extension {
     fn convert(r: &RegistryBuilder, a: &sax::Attributes) -> Extension {
         debug!("Doing a FromXML on Extension");
         let name = a.get_clone("name");
-        let supported = a.get("supported").split('|').map(|x| x.to_str()).collect::<Vec<String>>();
+        let supported = a.get("supported").split('|').map(|x| x.to_string()).collect::<Vec<String>>();
         let mut require = Vec::new();
         loop {
             match r.recv() {
@@ -694,7 +694,7 @@ impl FromXML for Extension {
                     require.push(FromXML::convert(r, atts));
                 }
                 EndElement(ref s) if s.as_slice() == "extension" => break,
-                msg => fail!("Unexpected message {}", msg.to_str())
+                msg => fail!("Unexpected message {}", msg.to_string())
             }
         }
 
diff --git a/src/gl_generator/src/ty.rs b/src/gl_generator/src/ty.rs
index 6fd6fc13..767fe75d 100644
--- a/src/gl_generator/src/ty.rs
+++ b/src/gl_generator/src/ty.rs
@@ -15,7 +15,7 @@
 
 pub fn to_return_suffix(ty: &str) -> String {
     match ty {
-        "c_void" | "VOID" | "GLvoid" => "".to_str(),
+        "c_void" | "VOID" | "GLvoid" => "".to_string(),
         ty_str => format!(" -> {}", ty_str.replace("*mut ", "*const ")),
     }
 }


Test patch: