Add INVALID_CRATE CrateNum constant.
This commit is contained in:
parent
6a5e2a5a9e
commit
115602b1be
2 changed files with 7 additions and 2 deletions
|
@ -36,7 +36,10 @@ pub const LOCAL_CRATE: CrateNum = CrateNum(0);
|
||||||
|
|
||||||
/// Virtual crate for builtin macros
|
/// Virtual crate for builtin macros
|
||||||
// FIXME(jseyfried): this is also used for custom derives until proc-macro crates get `CrateNum`s.
|
// FIXME(jseyfried): this is also used for custom derives until proc-macro crates get `CrateNum`s.
|
||||||
pub const BUILTIN_MACROS_CRATE: CrateNum = CrateNum(!0);
|
pub const BUILTIN_MACROS_CRATE: CrateNum = CrateNum(u32::MAX);
|
||||||
|
|
||||||
|
/// A CrateNum value that indicates that something is wrong.
|
||||||
|
pub const INVALID_CRATE: CrateNum = CrateNum(u32::MAX - 1);
|
||||||
|
|
||||||
impl CrateNum {
|
impl CrateNum {
|
||||||
pub fn new(x: usize) -> CrateNum {
|
pub fn new(x: usize) -> CrateNum {
|
||||||
|
|
|
@ -494,7 +494,9 @@ impl Decodable for FileMap {
|
||||||
name: name,
|
name: name,
|
||||||
name_was_remapped: name_was_remapped,
|
name_was_remapped: name_was_remapped,
|
||||||
// `crate_of_origin` has to be set by the importer.
|
// `crate_of_origin` has to be set by the importer.
|
||||||
crate_of_origin: 0xEFFF_FFFF,
|
// This value matches up with rustc::hir::def_id::INVALID_CRATE.
|
||||||
|
// That constant is not available here unfortunately :(
|
||||||
|
crate_of_origin: ::std::u32::MAX - 1,
|
||||||
start_pos: start_pos,
|
start_pos: start_pos,
|
||||||
end_pos: end_pos,
|
end_pos: end_pos,
|
||||||
src: None,
|
src: None,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue