]> git.lizzy.rs Git - rust.git/commitdiff
Correctly get source for metadata crate type;
authorAustin Bonander <austin.bonander@gmail.com>
Wed, 15 Mar 2017 08:27:43 +0000 (01:27 -0700)
committerPeter Atashian <retep998@gmail.com>
Tue, 21 Mar 2017 20:34:56 +0000 (16:34 -0400)
replace `unwrap()` with `expect()`

src/librustc_metadata/creader.rs

index 5af4db6041115b8bba881e6e6b6d9cdacc9c02a8..fcdb968dc06152ceca6c81d41140876336ab79f8 100644 (file)
@@ -236,7 +236,8 @@ fn existing_match(&self, name: Symbol, hash: Option<&Svh>, kind: PathKind)
             // path (this is a top-level dependency) as we don't want to
             // implicitly load anything inside the dependency lookup path.
             let prev_kind = source.dylib.as_ref().or(source.rlib.as_ref())
-                                  .unwrap().1;
+                                  .or(source.rmeta.as_ref())
+                                  .expect("No sources for crate").1;
             if ret.is_none() && (prev_kind == kind || prev_kind == PathKind::All) {
                 ret = Some(cnum);
             }