rust/compiler/rustc_lint/src
bors 8ecaad85f6 Auto merge of #105919 - uweigand:s390x-stack-overflow, r=Nilstrieb
Fix stack overflow in recursive AST walk in early lint

The src/test/ui/issues/issue-74564-if-expr-stack-overflow.rs test case added to verify https://github.com/rust-lang/rust/issues/74564 still crashes with a stack overflow on s390x-ibm-linux.

Symptom is a very deep recursion in compiler/rustc_lint/src/early.rs:
    fn visit_expr(&mut self, e: &'a ast::Expr) {
        self.with_lint_attrs(e.id, &e.attrs, |cx| {
            lint_callback!(cx, check_expr, e);
            ast_visit::walk_expr(cx, e);
        })
    }
(where walk_expr recursively calls back into visit_expr).  The crash happens at a nesting depth of over 17000 stack frames when using the default 8 MB stack size on s390x.

This patch fixes the problem by adding a ensure_sufficient_stack call to the with_lint_attrs routine (which also should take care of all the other mutually recursive visitors here).

Fixes part of https://github.com/rust-lang/rust/issues/105383.
2023-01-11 08:50:38 +00:00
..
nonstandard_style mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
array_into_iter.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
builtin.rs get_parent and find_parent 2023-01-04 00:43:13 +00:00
context.rs fix more clippy::style findings 2022-12-25 17:32:26 +01:00
deref_into_dyn_supertrait.rs Use nicer spans for deref_into_dyn_supertrait 2022-11-23 16:12:51 +00:00
early.rs Auto merge of #105919 - uweigand:s390x-stack-overflow, r=Nilstrieb 2023-01-11 08:50:38 +00:00
enum_intrinsics_non_enums.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
errors.rs Convert all #[suggestion_*] attributes to #[suggestion(style = "...")] 2022-10-26 15:04:09 +02:00
expect.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
for_loops_over_fallibles.rs use &str / String literals instead of format!() 2022-12-18 16:17:46 +01:00
hidden_unicode_codepoints.rs Inline some hot lint pass functions. 2022-12-07 19:29:31 +11:00
internal.rs get_parent and find_parent 2023-01-04 00:43:13 +00:00
late.rs fix dupe word typos 2023-01-03 15:48:16 +08:00
let_underscore.rs Merge branch 'master' into patch-2 2022-11-15 21:16:11 +01:00
levels.rs A few small cleanups for newtype_index 2022-12-18 21:47:28 +01:00
lib.rs Revert "Implement allow-by-default multiple_supertrait_upcastable lint" 2022-12-29 00:47:23 -08:00
methods.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
non_ascii_idents.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
non_fmt_panic.rs rustc: Remove needless lifetimes 2022-12-20 22:10:40 +01:00
nonstandard_style.rs get_parent and find_parent 2023-01-04 00:43:13 +00:00
noop_method_call.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
opaque_hidden_inferred_bound.rs Ensure no one constructs AliasTys themselves 2022-12-14 15:36:39 +00:00
pass_by_value.rs Rename Rptr to Ref in AST and HIR 2022-12-28 18:52:36 +01:00
passes.rs Reinstate {Early,Late}LintPassObjects. 2022-12-12 08:59:27 +11:00
redundant_semicolon.rs Migrate all diagnostics 2022-10-23 10:09:44 +02:00
tests.rs Update to last upstream version 2021-07-08 17:14:28 +02:00
traits.rs Introduce PredicateKind::Clause 2022-11-25 00:04:54 -03:00
types.rs get_parent and find_parent 2023-01-04 00:43:13 +00:00
unused.rs Address comments 2023-01-04 00:51:50 +00:00