Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: unresolved name: core::error #3781

Closed
jesse99 opened this issue Oct 16, 2012 · 1 comment
Closed

error: unresolved name: core::error #3781

jesse99 opened this issue Oct 16, 2012 · 1 comment
Labels
A-resolve Area: Name resolution
Milestone

Comments

@jesse99
Copy link
Contributor

jesse99 commented Oct 16, 2012

One of my rust libraries is failing to build with rust 0.4 for most of the modules that call error!, info!, etc with errors like the one above. The modules that fail do glob imports of an external rust library.

I wasn't able to get a repro with a one rs file app, but I did get a repro with a multi-file app (and multi-file library). I'll clean up the repro a bit and attach it after I get back from work.

This is a rather serious error because it's something that people will do and there's no indication of what the problem is.

@jesse99
Copy link
Contributor Author

jesse99 commented Oct 17, 2012

Can't seem to attach a file to a ticket so I'll attach the files below. To repro the compiler error just run make with no arguments. Might be able to condense this a bit more (e.g. by removing validation.rs).

---- ./Makefile --------
all: xml-client

.PHONY : xml-client
xml-client:
    cd sxml && rustc sxml.rc
    cd xml-client && rustc -L ../sxml --test client.rc && ./client

---- sxml/parsing.rs --------
use result::{Result, Err};

pub fn parse_str(_text: &str) -> Result<Xml, @~str>
{
    Err(@~"not implemented")
}

---- sxml/sxml.rc --------
#[link(name = "sxml", vers = "1.0", uuid = "333BE970-5A76-40CD-A101-3DD27CB469E5")];
#[crate_type = "lib"];

extern mod std;

pub mod parsing;
pub mod validation;

---- sxml/sxml.rs --------
use result::{Err, Ok, Result};
use std::map::{HashMap};

pub use parsing::{parse_str};
pub use validation::{validate_xml};

pub type Attributes = HashMap<@~str, @~str>;

pub enum Xml
{
    Content(@~str),
    Element(@~str, Attributes, @[@Xml]),
}

pub fn from_str(text: &str) -> Result<Xml, @~str>
{
    do parse_str(text).chain |xml|
    {
        match validate_xml(&xml)
        {
            @~""   => Ok(xml),
            errors => Err(errors),
        }
    }
}

---- sxml/validation.rs --------
pub fn validate_xml(_xml: &Xml) -> @~str
{
    @~""
}

---- xml-client/client.rc --------
#[link(name = "client", vers = "0.2", uuid = "D71AEFEB-650C-46E5-91C3-36E9406AEE8E")];

extern mod std;
extern mod sxml (name = "sxml", vers = "1.0");

mod client;

---- xml-client/client.rs --------
use sxml::*;                // compiler error with this present (see below)

//use sxml::{from_str};     // unit test compiles and runs with this instead
//use sxml::parsing;

use result::{Err, Ok, Result};

#[test]
fn test_inner_modules()
{
    info!("hmm");
    match parsing::parse_str("<hmm/>")
    {
        Ok(*) => assert false,
        Err(mesg) => assert *mesg == ~"not implemented",
    }
}

// With `use sxml::*;` get:
//<core-macros>:5:31: 5:41 error: unresolved name: core::info
//<core-macros>:5     #macro[[#info[f, ...], log(core::info, #fmt[f, ...])]];
//                                               ^~~~~~~~~~
//<core-macros>:5:10: 5:59 note: in expansion of #info
//client.rs:11:4: 11:17 note: expansion site
//error: aborting due to previous error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Name resolution
Projects
None yet
Development

No branches or pull requests

2 participants