@@ -1623,6 +1623,7 @@ fn crate_env_vars() {
1623
1623
static VERSION_PRE: &'static str = env!("CARGO_PKG_VERSION_PRE");
1624
1624
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
1625
1625
static CARGO_MANIFEST_DIR: &'static str = env!("CARGO_MANIFEST_DIR");
1626
+ static CARGO_MANIFEST_PATH: &'static str = env!("CARGO_MANIFEST_PATH");
1626
1627
static PKG_NAME: &'static str = env!("CARGO_PKG_NAME");
1627
1628
static HOMEPAGE: &'static str = env!("CARGO_PKG_HOMEPAGE");
1628
1629
static REPOSITORY: &'static str = env!("CARGO_PKG_REPOSITORY");
@@ -1636,9 +1637,9 @@ fn crate_env_vars() {
1636
1637
1637
1638
1638
1639
fn main() {
1639
- let s = format!("{}-{}-{} @ {} in {}", VERSION_MAJOR,
1640
+ let s = format!("{}-{}-{} @ {} in {} file {} ", VERSION_MAJOR,
1640
1641
VERSION_MINOR, VERSION_PATCH, VERSION_PRE,
1641
- CARGO_MANIFEST_DIR);
1642
+ CARGO_MANIFEST_DIR, CARGO_MANIFEST_PATH );
1642
1643
assert_eq!(s, foo::version());
1643
1644
println!("{}", s);
1644
1645
assert_eq!("foo", PKG_NAME);
@@ -1672,12 +1673,13 @@ fn crate_env_vars() {
1672
1673
use std::path::PathBuf;
1673
1674
1674
1675
pub fn version() -> String {
1675
- format!("{}-{}-{} @ {} in {}",
1676
+ format!("{}-{}-{} @ {} in {} file {} ",
1676
1677
env!("CARGO_PKG_VERSION_MAJOR"),
1677
1678
env!("CARGO_PKG_VERSION_MINOR"),
1678
1679
env!("CARGO_PKG_VERSION_PATCH"),
1679
1680
env!("CARGO_PKG_VERSION_PRE"),
1680
- env!("CARGO_MANIFEST_DIR"))
1681
+ env!("CARGO_MANIFEST_DIR"),
1682
+ env!("CARGO_MANIFEST_PATH"))
1681
1683
}
1682
1684
1683
1685
pub fn check_no_int_test_env() {
@@ -1793,7 +1795,7 @@ fn crate_env_vars() {
1793
1795
println ! ( "bin" ) ;
1794
1796
p. process ( & p. bin ( "foo-bar" ) )
1795
1797
. with_stdout_data ( str![ [ r#"
1796
- 0-5-1 @ alpha.1 in [ROOT]/foo
1798
+ 0-5-1 @ alpha.1 in [ROOT]/foo file [ROOT]/foo/Cargo.toml
1797
1799
1798
1800
"# ] ] )
1799
1801
. run ( ) ;
@@ -1861,12 +1863,15 @@ fn cargo_rustc_current_dir_foreign_workspace_dep() {
1861
1863
fn baz_env() {
1862
1864
let workspace_dir = Path::new(option_env!("CARGO_RUSTC_CURRENT_DIR").expect("CARGO_RUSTC_CURRENT_DIR"));
1863
1865
let manifest_dir = Path::new(option_env!("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR"));
1866
+ let manifest_path = Path::new(option_env!("CARGO_MANIFEST_PATH").expect("CARGO_MANIFEST_PATH"));
1864
1867
let current_dir = std::env::current_dir().expect("current_dir");
1865
1868
let file_path = workspace_dir.join(file!());
1866
1869
assert!(file_path.exists(), "{}", file_path.display());
1867
1870
let workspace_dir = std::fs::canonicalize(current_dir.join(workspace_dir)).expect("CARGO_RUSTC_CURRENT_DIR");
1871
+ let manifest_path = std::fs::canonicalize(current_dir.join(manifest_dir.clone()).join("Cargo.toml")).expect("CARGO_MANIFEST_PATH");
1868
1872
let manifest_dir = std::fs::canonicalize(current_dir.join(manifest_dir)).expect("CARGO_MANIFEST_DIR");
1869
- assert_eq!(workspace_dir, manifest_dir);
1873
+ assert_eq!(workspace_dir, manifest_dir.clone());
1874
+ assert_eq!(manifest_dir.join("Cargo.toml"), manifest_path);
1870
1875
}
1871
1876
"# ,
1872
1877
)
@@ -1955,12 +1960,15 @@ fn cargo_rustc_current_dir_non_local_dep() {
1955
1960
fn bar_env() {
1956
1961
let workspace_dir = Path::new(option_env!("CARGO_RUSTC_CURRENT_DIR").expect("CARGO_RUSTC_CURRENT_DIR"));
1957
1962
let manifest_dir = Path::new(option_env!("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR"));
1963
+ let manifest_path = Path::new(option_env!("CARGO_MANIFEST_PATH").expect("CARGO_MANIFEST_PATH"));
1958
1964
let current_dir = std::env::current_dir().expect("current_dir");
1959
1965
let file_path = workspace_dir.join(file!());
1960
1966
assert!(file_path.exists(), "{}", file_path.display());
1961
1967
let workspace_dir = std::fs::canonicalize(current_dir.join(workspace_dir)).expect("CARGO_RUSTC_CURRENT_DIR");
1968
+ let manifest_path = std::fs::canonicalize(current_dir.join(manifest_dir.clone()).join("Cargo.toml")).expect("CARGO_MANIFEST_PATH");
1962
1969
let manifest_dir = std::fs::canonicalize(current_dir.join(manifest_dir)).expect("CARGO_MANIFEST_DIR");
1963
- assert_eq!(workspace_dir, manifest_dir);
1970
+ assert_eq!(workspace_dir, manifest_dir.clone());
1971
+ assert_eq!(manifest_dir.join("Cargo.toml"), manifest_path);
1964
1972
}
1965
1973
"# ,
1966
1974
)
0 commit comments