-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #74932 - nnethercote:rm-ast-session-globals, r=petroche…
…nkov Remove `librustc_ast` session globals By moving the data onto `Session`. r? @petrochenkov
- Loading branch information
Showing
121 changed files
with
865 additions
and
842 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,7 @@ | ||
use crate::ast::{Item, ItemKind}; | ||
use crate::attr; | ||
use rustc_span::symbol::sym; | ||
|
||
pub enum EntryPointType { | ||
None, | ||
MainNamed, | ||
MainAttr, | ||
Start, | ||
OtherMain, // Not an entry point, but some other function named main | ||
} | ||
|
||
// Beware, this is duplicated in librustc_middle/middle/entry.rs, make sure to keep | ||
// them in sync. | ||
pub fn entry_point_type(item: &Item, depth: usize) -> EntryPointType { | ||
match item.kind { | ||
ItemKind::Fn(..) => { | ||
if attr::contains_name(&item.attrs, sym::start) { | ||
EntryPointType::Start | ||
} else if attr::contains_name(&item.attrs, sym::main) { | ||
EntryPointType::MainAttr | ||
} else if item.ident.name == sym::main { | ||
if depth == 1 { | ||
// This is a top-level function so can be 'main' | ||
EntryPointType::MainNamed | ||
} else { | ||
EntryPointType::OtherMain | ||
} | ||
} else { | ||
EntryPointType::None | ||
} | ||
} | ||
_ => EntryPointType::None, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,3 @@ | ||
//! Definitions shared by macros / syntax extensions and e.g. librustc_middle. | ||
use crate::ast::Attribute; | ||
use rustc_span::symbol::sym; | ||
|
||
pub mod allocator; | ||
|
||
pub fn is_proc_macro_attr(attr: &Attribute) -> bool { | ||
[sym::proc_macro, sym::proc_macro_attribute, sym::proc_macro_derive] | ||
.iter() | ||
.any(|kind| attr.check_name(*kind)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.