Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0bf5cae
Remove __query_compute module.
cjgillot Mar 6, 2020
fc82376
Make QueryAccessor::dep_kind an associated const.
cjgillot Mar 6, 2020
cf238fd
Inline QueryAccessor::query.
cjgillot Mar 7, 2020
1249032
Move impl of Queries with its definition.
cjgillot Mar 7, 2020
b089433
Unpack type arguments for QueryStateShard.
cjgillot Mar 6, 2020
486a082
Unpack type arguments for QueryLookup.
cjgillot Mar 6, 2020
a0f57e2
Unpack type arguments for QueryState.
cjgillot Mar 6, 2020
fa02dca
Remove Q parameter from QueryCache::lookup.
cjgillot Mar 6, 2020
a18aa81
Remove Q parameter from alloc_self_profile_query_strings_for_query_ca…
cjgillot Mar 6, 2020
d125bbb
Remove Q parameter from query stats.
cjgillot Mar 6, 2020
fa0794d
Remove Q parameter from JobOwner.
cjgillot Mar 7, 2020
5dc7c2e
Remove Q parameter from try_get_cached.
cjgillot Mar 7, 2020
7d84f4f
Offload try_collect_active_jobs.
cjgillot Mar 7, 2020
7309b3c
Simplify type aliases.
cjgillot Mar 7, 2020
3abd475
Make QueryCache parameters associated types.
cjgillot Mar 7, 2020
5557407
Remove QueryState type alias.
cjgillot Mar 7, 2020
8aa1328
Make stuff private.
cjgillot Mar 15, 2020
f8178c7
rustc: use LocalDefId instead of DefId in TypeckTables.
eddyb Mar 18, 2020
82920f3
Don't unwind when hitting the macro expansion recursion limit
Zoxc Feb 26, 2020
d641ad0
Update test
Zoxc Feb 29, 2020
6cb5846
sort generic param order in generics_of
lcnr Mar 19, 2020
17c94c6
fix FIXME comment
lcnr Mar 19, 2020
5edaa7e
Fix abort-on-eprintln during process shutdown
alexcrichton Mar 12, 2020
0296d49
fix layout_test visitor name
RalfJung Mar 10, 2020
55c2cf2
add debug option to #[rustc_layout]
RalfJung Mar 10, 2020
d9f60bc
add a test for rustc_layout(debug)
RalfJung Mar 10, 2020
c62e36b
make rustc_layout also work for type definitions
RalfJung Mar 20, 2020
7b49678
fmt
RalfJung Mar 20, 2020
e548df7
normalize away preferred alignment
RalfJung Mar 21, 2020
a6596f2
Rollup merge of #69497 - Zoxc:ast-fragment-error, r=petrochenkov
Dylan-DPC Mar 21, 2020
fd3f917
Rollup merge of #69901 - RalfJung:rustc_layout, r=eddyb
Dylan-DPC Mar 21, 2020
8deeac1
Rollup merge of #69910 - cjgillot:polym, r=Zoxc
Dylan-DPC Mar 21, 2020
276b54e
Rollup merge of #69955 - alexcrichton:stderr-infallible, r=sfackler
Dylan-DPC Mar 21, 2020
266801d
Rollup merge of #70032 - lcnr:issue69970, r=varkor
Dylan-DPC Mar 21, 2020
f1ab750
Rollup merge of #70119 - eddyb:typeck-tables-local-def-id, r=petroche…
Dylan-DPC Mar 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/librustc_expand/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,7 @@ pub struct ExpansionData {
pub struct ExtCtxt<'a> {
pub parse_sess: &'a ParseSess,
pub ecfg: expand::ExpansionConfig<'a>,
pub reduced_recursion_limit: Option<usize>,
pub root_path: PathBuf,
pub resolver: &'a mut dyn Resolver,
pub current_expansion: ExpansionData,
Expand All @@ -940,6 +941,7 @@ impl<'a> ExtCtxt<'a> {
ExtCtxt {
parse_sess,
ecfg,
reduced_recursion_limit: None,
resolver,
extern_mod_loaded,
root_path: PathBuf::new(),
Expand Down
16 changes: 12 additions & 4 deletions src/librustc_expand/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use rustc_ast::util::map_in_place::MapInPlace;
use rustc_ast::visit::{self, AssocCtxt, Visitor};
use rustc_ast_pretty::pprust;
use rustc_attr::{self as attr, is_builtin_attr, HasAttrs};
use rustc_errors::{Applicability, FatalError, PResult};
use rustc_errors::{Applicability, PResult};
use rustc_feature::Features;
use rustc_parse::parser::Parser;
use rustc_parse::validate_attr;
Expand Down Expand Up @@ -645,7 +645,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
))
.emit();
self.cx.trace_macros_diag();
FatalError.raise();
}

/// A macro's expansion does not fit in this fragment kind.
Expand All @@ -665,8 +664,17 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
invoc: Invocation,
ext: &SyntaxExtensionKind,
) -> ExpandResult<AstFragment, Invocation> {
if self.cx.current_expansion.depth > self.cx.ecfg.recursion_limit {
self.error_recursion_limit_reached();
let recursion_limit =
self.cx.reduced_recursion_limit.unwrap_or(self.cx.ecfg.recursion_limit);
if self.cx.current_expansion.depth > recursion_limit {
if self.cx.reduced_recursion_limit.is_none() {
self.error_recursion_limit_reached();
}

// Reduce the recursion limit by half each time it triggers.
self.cx.reduced_recursion_limit = Some(recursion_limit / 2);

return ExpandResult::Ready(invoc.fragment_kind.dummy(invoc.span()));
}

let (fragment_kind, span) = (invoc.fragment_kind, invoc.span());
Expand Down
13 changes: 11 additions & 2 deletions src/librustc_interface/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ fn configure_and_expand_inner<'a>(
ecx.parse_sess.missing_fragment_specifiers.borrow().iter().cloned().collect();
missing_fragment_specifiers.sort();

let recursion_limit_hit = ecx.reduced_recursion_limit.is_some();

for span in missing_fragment_specifiers {
let lint = lint::builtin::MISSING_FRAGMENT_SPECIFIER;
let msg = "missing fragment specifier";
Expand All @@ -320,8 +322,15 @@ fn configure_and_expand_inner<'a>(
if cfg!(windows) {
env::set_var("PATH", &old_path);
}
krate
});

if recursion_limit_hit {
// If we hit a recursion limit, exit early to avoid later passes getting overwhelmed
// with a large AST
Err(ErrorReported)
} else {
Ok(krate)
}
})?;

sess.time("maybe_building_test_harness", || {
rustc_builtin_macros::test_harness::inject(
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/macros/trace_faulty_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ macro_rules! pat_macro {
pat_macro!(A{a:a, b:0, c:_, ..});
};
($a:pat) => {
$a
$a //~ ERROR expected expression
};
}

Expand Down
13 changes: 12 additions & 1 deletion src/test/ui/macros/trace_faulty_macros.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,16 @@ LL | my_recursive_macro!();
= note: expanding `my_recursive_macro! { }`
= note: to `my_recursive_macro ! () ;`

error: aborting due to 2 previous errors
error: expected expression, found `A { a: a, b: 0, c: _, .. }`
--> $DIR/trace_faulty_macros.rs:16:9
|
LL | $a
| ^^ expected expression
...
LL | let a = pat_macro!();
| ------------ in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 3 previous errors