diff options
| author | Andrei Formiga <archimedes_siracusa@hotmail.com> | 2013-11-08 16:51:40 -0300 |
|---|---|---|
| committer | Andrei Formiga <archimedes_siracusa@hotmail.com> | 2013-11-08 17:42:46 -0300 |
| commit | cf24280a3c84d2ef2df73e810da409a0f8474919 (patch) | |
| tree | df6c51de1a248ed9edf7d1e4dc7e8a0ebbef9ddb /src/librustc/back | |
| parent | ffcbd8d767bec1382e401120f01f94fce8851ced (diff) | |
Added default value for package_id attribute when encoding metadata for lib crates
Diffstat (limited to 'src/librustc/back')
| -rw-r--r-- | src/librustc/back/link.rs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index ab0763aac9e..b88966c0ab2 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -634,20 +634,12 @@ pub fn build_link_meta(sess: Session, } } - fn crate_meta_pkgid(sess: Session, output: &Path, opt_pkg_id: Option<@str>) + fn crate_meta_pkgid(sess: Session, name: @str, opt_pkg_id: Option<@str>) -> @str { match opt_pkg_id { Some(v) if !v.is_empty() => v, _ => { - let pkg_id = session::expect(sess, - output.filestem_str(), - || format!("output file name `{}` doesn't\ - appear to have a stem", - output.display())).to_managed(); - if pkg_id.is_empty() { - sess.fatal("missing crate link meta `package_id`, and the \ - inferred name is blank"); - } + let pkg_id = name.clone(); warn_missing(sess, "package_id", pkg_id); pkg_id } @@ -662,7 +654,7 @@ pub fn build_link_meta(sess: Session, } = provided_link_metas(sess, c); let name = crate_meta_name(sess, output, opt_name); let vers = crate_meta_vers(sess, opt_vers); - let pkg_id = crate_meta_pkgid(sess, output, opt_pkg_id); + let pkg_id = crate_meta_pkgid(sess, name, opt_pkg_id); let dep_hashes = cstore::get_dep_hashes(sess.cstore); let extras_hash = crate_meta_extras_hash(symbol_hasher, cmh_items, |
