about summary refs log tree commit diff
path: root/src/librustc_interface/util.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-770/+0
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-2/+1
2020-08-15replaced log with tracingGurpreet Singh-1/+1
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-25/+23
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This means they are accessed via the `Session`, rather than via TLS. A few `Attr` methods and `librustc_ast` functions are now methods of `Session`. All of this required passing a `Session` to lots of functions that didn't already have one. Some of these functions also had arguments removed, because those arguments could be accessed directly via the `Session` argument. `contains_feature_attr()` was dead, and is removed. Some functions were moved from `librustc_ast` elsewhere because they now need to access `Session`, which isn't available in that crate. - `entry_point_type()` --> `librustc_builtin_macros` - `global_allocator_spans()` --> `librustc_metadata` - `is_proc_macro_attr()` --> `Session`
2020-08-03Remove `GCX_PTR`.Nicholas Nethercote-14/+10
We store an `ImplicitCtxt` pointer in a thread-local value (TLV). This allows implicit access to a `GlobalCtxt` and some other things. We also store a `GlobalCtxt` pointer in `GCX_PTR`. This is always the same `GlobalCtxt` as the one within the `ImplicitCtxt` pointer in TLV. `GCX_PTR` is only used in the parallel compiler's `handle_deadlock()` function. This commit does the following. - It removes `GCX_PTR`. - It also adds `ImplicitCtxt::new()`, which constructs an `ImplicitCtxt` from a `GlobalCtxt`. `ImplicitCtxt::new()` + `tls::enter_context()` is now equivalent to the old `tls::enter_global()`. - Makes `tls::get_tlv()` public for the parallel compiler, because it's now used in `handle_deadlock()`.
2020-07-16Remove leftover from emscripten fastcomp supportbjorn3-7/+2
This is no longer used since #63649
2020-07-15Remove lots of `Symbol::as_str()` calls.Nicholas Nethercote-5/+2
In various ways, such as changing functions to take a `Symbol` instead of a `&str`.
2020-07-15Add and use more static symbols.Nicholas Nethercote-1/+1
Note that the output of `unpretty-debug.stdout` has changed. In that test the hash values are normalized from a symbol numbers to small numbers like "0#0" and "0#1". The increase in the number of static symbols must have caused the original numbers to contain more digits, resulting in different pretty-printing prior to normalization.
2020-07-10Rollup merge of #74127 - tamird:allowlist, r=oli-obkManish Goregaokar-2/+2
Avoid "whitelist" Other terms are more inclusive and precise.
2020-07-10Avoid "whitelist"Tamir Duberstein-2/+2
Other terms are more inclusive and precise.
2020-07-10Change some function names.Nicholas Nethercote-3/+3
A couple of these are quite long, but they do a much better job of explaining what they do, which was non-obvious before.
2020-07-10Tweak `spawn_thread_pool`.Nicholas Nethercote-11/+12
This makes the two versions (parallel and non-parallel) more similar to each other.
2020-07-10Add an explanatory comment to `scoped_thread`.Nicholas Nethercote-0/+2
2020-07-09Eliminate confusing "globals" terminology.Nicholas Nethercote-10/+11
There are some structures that are called "globals", but are they global to a compilation session, and not truly global. I have always found this highly confusing, so this commit renames them as "session globals" and adds a comment explaining things. Also, the commit fixes an unnecessary nesting of `set()` calls `src/librustc_errors/json/tests.rs`
2020-05-27rustc_session: Cleanup session creationVadim Petrochenkov-4/+4
2020-05-24Collect tokens for `ast::Expr`Aaron Hill-0/+2
2020-05-22Use `OnceCell` instead of `Once`Dylan MacKenzie-1/+1
2020-05-18Implement AST lowering for asm!Amanieu d'Antras-3/+6
2020-05-10Auto merge of #71775 - petrochenkov:crtcfg, r=matthewjasperbors-1/+1
Enable `cfg` predicate for `target_feature = "crt-static"` only if the target supports it That's what all other `target_feature`s do.
2020-05-07Auto merge of #55617 - oli-obk:stacker, r=nagisa,oli-obkbors-8/+1
Prevent compiler stack overflow for deeply recursive code I was unable to write a test that 1. runs in under 1s 2. overflows on my machine without this patch The following reproduces the issue, but I don't think it's sensible to include a test that takes 30s to compile. We can now easily squash newly appearing overflows by the strategic insertion of calls to `ensure_sufficient_stack`. ```rust // compile-pass #![recursion_limit="1000000"] macro_rules! chain { (EE $e:expr) => {$e.sin()}; (RECURSE $i:ident $e:expr) => {chain!($i chain!($i chain!($i chain!($i $e))))}; (Z $e:expr) => {chain!(RECURSE EE $e)}; (Y $e:expr) => {chain!(RECURSE Z $e)}; (X $e:expr) => {chain!(RECURSE Y $e)}; (A $e:expr) => {chain!(RECURSE X $e)}; (B $e:expr) => {chain!(RECURSE A $e)}; (C $e:expr) => {chain!(RECURSE B $e)}; // causes overflow on x86_64 linux // less than 1 second until overflow on test machine // after overflow has been fixed, takes 30s to compile :/ (D $e:expr) => {chain!(RECURSE C $e)}; (E $e:expr) => {chain!(RECURSE D $e)}; (F $e:expr) => {chain!(RECURSE E $e)}; // more than 10 seconds (G $e:expr) => {chain!(RECURSE F $e)}; (H $e:expr) => {chain!(RECURSE G $e)}; (I $e:expr) => {chain!(RECURSE H $e)}; (J $e:expr) => {chain!(RECURSE I $e)}; (K $e:expr) => {chain!(RECURSE J $e)}; (L $e:expr) => {chain!(RECURSE L $e)}; } fn main() { let x = chain!(D 42.0_f32); } ``` fixes #55471 fixes #41884 fixes #40161 fixes #34844 fixes #32594 cc @alexcrichton @rust-lang/compiler I looked at all code that checks the recursion limit and inserted stack growth calls where appropriate.
2020-05-03Enable `cfg` predicate for `target_feature = "crt-static"` only if the ↵Vadim Petrochenkov-1/+1
target supports it
2020-05-02Set the default stack size to 8MBSimonas Kazlauskas-1/+1
This was the value used before we originally started raising the stack size to infinity.
2020-05-02Prevent stack overflow for deeply recursive codeOliver Scherer-8/+1
2020-05-02cleanup: `config::CrateType` -> `CrateType`Vadim Petrochenkov-13/+14
2020-04-26Rollup merge of #71537 - Mark-Simulacrum:no-self-open, r=davidtwcoDylan DPC-1/+1
Remove support for self-opening This was only used for linkage test cases, which is already covered by the [run-make-fulldeps/symbol-visibility test](https://github.com/rust-lang/rust/blob/master/src/test/run-make-fulldeps/symbol-visibility/Makefile) -- which fairly extensively makes sure we're correctly exporting the right symbols at the right visibility (for various Rust crate types). This fixes #10379 and resolves #10356 by removing the test case (and underlying support in the compiler). AFAICT, the better way to test visibility is via nm, like the symbol visibility test. It seems like that's sufficient; I suspect that given that we don't use this we should just drop it (android is tier 2 anyway). But happy to hear otherwise.
2020-04-26fix more clippy warningsMatthias Krüger-4/+4
clippy::{redundant_pattern_matching, clone_on_copy, iter_cloned_collect, option_as_ref_deref, match_ref_pats}
2020-04-25Remove support for self-openingMark Rousskov-1/+1
This was only used for linkage test cases, which is already covered by the run-make-fulldeps/symbol-visibility test -- which fairly extensively makes sure we're correctly exporting the right symbols at the right visibility (for various Rust crate types).
2020-04-24Replace filter_map().next() calls with find_map()Josh Stone-11/+8
These are semantically the same, but `find_map()` is more concise.
2020-04-02Add hash of source files in debug infoArlo Siemsen-5/+3
* Adds either an MD5 or SHA1 hash to the debug info. * Adds new unstable option `-Z src-hash-algorithm` to control the hashing algorithm.
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-1/+1
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-1/+1
2020-03-27parse: move constraint/arg restriction to ast_validation.Mazdak Farrokhzad-7/+9
2020-03-19Refactorings to begin getting rid of rustc_codegen_utilsMark Mansi-4/+4
2020-03-18Rollup merge of #69920 - Centril:hir-cleanup, r=ZoxcMazdak Farrokhzad-2/+1
Remove some imports to the rustc crate - When we have `NestedVisitorMap::None`, we use `type Map = dyn intravisit::Map<'v>;` instead of the actual map. This doesn't actually result in dynamic dispatch (in the future we may want to use an associated type default to simplify the code). - Use `rustc_session::` imports instead of `rustc::{session, lint}`. r? @Zoxc
2020-03-17Auto merge of #69519 - 12101111:remove-proc-macro-check, r=nagisabors-1/+1
Don't use static crt by default when build proc-macro Don't check value of `crt-static` when build proc-macro crates, since they are always built dynamically. For more information, see https://github.com/rust-lang/cargo/issues/7563#issuecomment-591965320 I hope this will fix issues about compiling `proc_macro` crates on musl host without bring more issues. Fix https://github.com/rust-lang/cargo/issues/7563
2020-03-16use direct imports for `rustc::{lint, session}`.Mazdak Farrokhzad-2/+1
2020-03-12ast: `Mac`/`Macro` -> `MacCall`Vadim Petrochenkov-1/+1
2020-03-04Don't use "if let" bindings to only check a value and not actually bind ↵Matthias Krüger-1/+1
anything. For example: `if let Some(_) = foo() {}` can be reduced to `if foo().is_some() {}` (clippy::redundant_pattern_matching)
2020-03-03Don't use static crt by default when build proc-macro.12101111-1/+1
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-9/+9
2020-02-29Make it build againVadim Petrochenkov-1/+1
2020-02-28Rollup merge of #69481 - matthiaskrgr:single_char, r=ecstatic-morseMazdak Farrokhzad-1/+1
use char instead of &str for single char patterns
2020-02-27don't use .into() to convert types into identical types.Matthias Krüger-1/+1
example: let s: String = format!("hello").into();
2020-02-27use char instead of &str for single char patternsMatthias Krüger-1/+1
2020-02-24parse/ast: move `Defaultness` into variants.Mazdak Farrokhzad-2/+2
2020-02-18Rollup merge of #69194 - Centril:assoc-extern-fuse, r=petrochenkovMazdak Farrokhzad-1/+1
parse: fuse associated and extern items up to defaultness Language changes: - The grammar of extern `type` aliases is unified with associated ones, and becomes: ```rust TypeItem = "type" ident generics {":" bounds}? where_clause {"=" type}? ";" ; ``` Semantic restrictions (`ast_validation`) are added to forbid any parameters in `generics`, any bounds in `bounds`, and any predicates in `where_clause`, as well as the presence of a type expression (`= u8`). (Work still remains to fuse this with free `type` aliases, but this can be done later.) - The grammar of constants and static items (free, associated, and extern) now permits the absence of an expression, and becomes: ```rust GlobalItem = {"const" {ident | "_"} | "static" "mut"? ident} {"=" expr}? ";" ; ``` - A semantic restriction is added to enforce the presence of the expression (the body). - A semantic restriction is added to reject `const _` in associated contexts. Together, these changes allow us to fuse the grammar of associated items and extern items up to `default`ness which is the main goal of the PR. ----------------------- We are now very close to fully fusing the entirely of item parsing and their ASTs. To progress further, we must make a decision: should we parse e.g. `default use foo::bar;` and whatnot? Accepting that is likely easiest from a parsing perspective, as it does not require using look-ahead, but it is perhaps not too onerous to only accept it for `fn`s (and all their various qualifiers), `const`s, `static`s, and `type`s. r? @petrochenkov
2020-02-17Rename `FunctionRetTy` to `FnRetTy`Yuki Okushi-2/+2
2020-02-15ast: move Generics into AssocItemKindsMazdak Farrokhzad-1/+1
2020-02-13Constness -> enum Const { Yes(Span), No }Mazdak Farrokhzad-1/+1
Same idea for `Unsafety` & use new span for better diagnostics.
2020-02-01syntax: reexport attr globalsMazdak Farrokhzad-4/+4