about summary refs log tree commit diff
path: root/compiler/rustc_lint
AgeCommit message (Collapse)AuthorLines
2023-01-11Auto merge of #105919 - uweigand:s390x-stack-overflow, r=Nilstriebbors-1/+2
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-09refactor: cleanupRejyr-49/+3
2023-01-09migrate: `deref_into_dyn_supertrait.rs`Rejyr-18/+30
2023-01-09add: allow lints in `lints.rs`Rejyr-0/+2
2023-01-09migrate: rest of `builtin.rs` without `builtin_asm_labels`Rejyr-183/+353
2023-01-09migrate: `UnsafeCode` in `builtin.rs`Rejyr-83/+63
2023-01-09migrate: `hidden_unicode_codepoints.rs`Rejyr-50/+107
2023-01-09add: `#[rustc_lint_diagnostics]` for more `context.rs` functions.Rejyr-0/+5
2023-01-09refactor: refactor to derive for some lints.Rejyr-139/+96
2023-01-09migrate: `for_loops_over_fallibles.rs`Rejyr-46/+78
2023-01-09migrate: `expect.rs`Rejyr-30/+41
2023-01-09migrate(wip): `builtin.rs`Rejyr-229/+376
2023-01-09migrate: `internal.rs`Rejyr-76/+97
2023-01-09migrate: `ImproperCTypes`Rejyr-29/+55
2023-01-09migrate: `let_underscore.rs`Rejyr-33/+62
fix: NonBindingLetSub
2023-01-09migrate: `levels.rs`Rejyr-107/+116
2023-01-09add: `emit{,_spanned}_lint` for `LintLevelsBuilder`Rejyr-19/+39
add: `emit_spanned_lint` and `emit_lint` for `LintLevelsBuilder` migrate: `DeprecatedLintName`
2023-01-09refactor: comment about lint locationRejyr-0/+13
2023-01-09fix: merge conflictRejyr-29/+55
2023-01-09update: `lints.rs` for renamed traitsRejyr-11/+23
update: `lints.rs` for renamed `SessionSubdiagnostic` and `AddSubdiagnostic` fix: NonSnakeCaseDiagSub fix: OverflowingBinHexSign
2023-01-09add: `lints` for `errors.rs`Rejyr-1/+3
2023-01-09migrate: `early.rs` and `enum_intrinsics_non_enums.rs`Rejyr-8/+30
2023-01-09migrate: `array_into_iter.rs`Rejyr-39/+45
2023-01-09migrate: `methods.rs`Rejyr-9/+15
2023-01-09migrate: `non_ascii_idents.rs`Rejyr-35/+49
2023-01-09migrate: `non_fmt_panic.rs`Rejyr-33/+53
2023-01-09migrate: `nonstandard_style.rs`Rejyr-81/+156
2023-01-09migrate: `noop_method_call.rs`Rejyr-7/+19
2023-01-09migrate: `pass_by_value.rs`Rejyr-13/+14
2023-01-09migrate: `redundant_semicolon.rs`Rejyr-12/+13
2023-01-09migrate: `traits.rs`Rejyr-16/+41
2023-01-09migrate: `unused.rs`Rejyr-103/+201
2023-01-09migrate: `types.rs`Rejyr-154/+248
2023-01-09add: `lints.rs`Rejyr-10/+15
add: `lints.rs` refactor: move `InvalidAtomicOrderingDiag` to `lints.rs`
2023-01-04Rollup merge of #106403 - compiler-errors:rename-hir-methods, r=cjgillotMichael Goulet-8/+6
Rename `hir::Map::{get_,find_}parent_node` to `hir::Map::{,opt_}parent_id`, and add `hir::Map::{get,find}_parent` The `hir::Map::get_parent_node` function doesn't return a `Node`, and I think that's quite confusing. Let's rename it to something that sounds more like something that gets the parent hir id => `hir::Map::parent_id`. Same with `find_parent_node` => `opt_parent_id`. Also, combine `hir.get(hir.parent_id(hir_id))` and similar `hir.find(hir.parent_id(hir_id))` function into new functions that actually retrieve the parent node in one call. This last commit is the only one that might need to be looked at closely.
2023-01-04Address commentsMichael Goulet-1/+1
2023-01-04Simplify some iterator combinatorsMichael Goulet-16/+11
2023-01-04get_parent and find_parentMichael Goulet-5/+4
2023-01-04rename get_parent_node to parent_idMichael Goulet-7/+6
2023-01-03fix dupe word typosRageking8-3/+3
2022-12-30Rollup merge of #106248 - dtolnay:revertupcastlint, r=jackh726Michael Goulet-66/+0
Revert "Implement allow-by-default `multiple_supertrait_upcastable` lint" This is a clean revert of #105484. I confirmed that reverting that PR fixes the regression reported in #106247. ~~I can't say I understand what this code is doing, but maybe it can be re-landed with a different implementation.~~ **Edit:** https://github.com/rust-lang/rust/issues/106247#issuecomment-1367174384 has an explanation of why #105484 ends up surfacing spurious `where_clause_object_safety` errors. The implementation of `where_clause_object_safety` assumes we only check whether a trait is object safe when somebody actually uses that trait with `dyn`. However the implementation of `multiple_supertrait_upcastable` added in the problematic PR involves checking *every* trait for whether it is object-safe. FYI `@nbdd0121` `@compiler-errors`
2022-12-29Rollup merge of #106221 - Nilstrieb:rptr-more-like-ref-actually, ↵Matthias Krüger-1/+1
r=compiler-errors Rename `Rptr` to `Ref` in AST and HIR The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-29Revert "Implement allow-by-default multiple_supertrait_upcastable lint"David Tolnay-66/+0
This reverts commit 5e44a65517bfcccbe6624a70b54b9f192baa94f3.
2022-12-28Rename `Rptr` to `Ref` in AST and HIRNilstrieb-1/+1
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-28Rollup merge of #105484 - nbdd0121:upcast, r=compiler-errorsfee1-dead-0/+66
Implement allow-by-default `multiple_supertrait_upcastable` lint The lint detects when an object-safe trait has multiple supertraits. Enabled in libcore and liballoc as they are low-level enough that many embedded programs will use them. r? `@nikomatsakis`
2022-12-27Rollup merge of #106064 - lukas-code:outlives-macro, r=cjgillotMichael Goulet-63/+85
Partially fix `explicit_outlives_requirements` lint in macros Show the suggestion if and only if the bounds are from the same source context. fixes https://github.com/rust-lang/rust/issues/106044 fixes https://github.com/rust-lang/rust/issues/106063
2022-12-27Rollup merge of #105515 - estebank:issue-104141, r=oli-obkMatthias Krüger-0/+1
Account for macros in const generics Fix #104141.
2022-12-26address review comments + better testsLukas Markeffsky-51/+63
2022-12-25fix more clippy::style findingsMatthias Krüger-8/+6
match_result_ok obfuscated_if_else single_char_add writeln_empty_string collapsible_match iter_cloned_collect unnecessary_mut_passed
2022-12-24Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholkMatthias Krüger-1/+1
rustc: Remove needless lifetimes