]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #25252 - inrustwetrust:crate-type-attribute, r=alexcrichton
authorManish Goregaokar <manishsmail@gmail.com>
Sun, 10 May 2015 05:31:46 +0000 (11:01 +0530)
committerManish Goregaokar <manishsmail@gmail.com>
Sun, 10 May 2015 05:31:46 +0000 (11:01 +0530)
Fixes the problem in #16974 with unhelpful error messages when accidentally using the wrong syntax for the `crate_type="lib"` attribute. The attribute syntax error now shows up instead of "main function not found".

1  2 
src/librustc_driver/driver.rs

index 45d81ff0f65297f9e7811c3528a9bd0b89345df5,a956b173f96c685d3ef7286c3d74d776998b581a..0073c0b061039806ff2503071d7eb167b18b8108
@@@ -479,8 -479,7 +479,8 @@@ pub fn phase_2_configure_and_expand(ses
              let mut _old_path = OsString::new();
              if cfg!(windows) {
                  _old_path = env::var_os("PATH").unwrap_or(_old_path);
 -                let mut new_path = sess.host_filesearch(PathKind::All).get_dylib_search_paths();
 +                let mut new_path = sess.host_filesearch(PathKind::All)
 +                                       .get_dylib_search_paths();
                  new_path.extend(env::split_paths(&_old_path));
                  env::set_var("PATH", &env::join_paths(new_path.iter()).unwrap());
              }
@@@ -872,11 -871,8 +872,8 @@@ pub fn collect_crate_types(session: &Se
                      None
                  }
                  _ => {
-                     session.add_lint(lint::builtin::UNKNOWN_CRATE_TYPES,
-                                      ast::CRATE_NODE_ID,
-                                      a.span,
-                                      "`crate_type` requires a \
-                                       value".to_string());
+                     session.span_err(a.span, "`crate_type` requires a value");
+                     session.note("for example: `#![crate_type=\"lib\"]`");
                      None
                  }
              }