rust/compiler/rustc_lint/src
bors 71704c4f84 Auto merge of #116623 - Nadrieril:validate-range-endpoints, r=oli-obk
Fix overflow checking in range patterns

When a range pattern contains an overflowing literal, if we're not careful we might not notice the overflow and use the wrapped value. This makes for confusing error messages because linting against overflowing literals is only done in a later pass. So when a range is invalid we check for overflows to provide a better error.

This check didn't use to handle negative types; this PR fixes that. First commit adds tests, second cleans up without changing behavior, third does the fix.

EDIT: while I was at it, I fixed a small annoyance about the span of the overflow lint on negated literals.

Fixes https://github.com/rust-lang/rust/issues/94239
2023-10-11 10:07:19 +00:00
..
nonstandard_style
array_into_iter.rs make the reason: field mandatory for @future_incompatible lints 2023-09-22 08:59:32 +02:00
async_fn_in_trait.rs Apply suggestions from code review 2023-10-04 18:20:05 -04:00
builtin.rs Don't store lazyness in DefKind 2023-09-26 02:53:59 +00:00
context.rs Fix ICE by introducing an expr_or_init variant for outside bodies 2023-09-27 18:59:24 +02:00
deref_into_dyn_supertrait.rs make the reason: field mandatory for @future_incompatible lints 2023-09-22 08:59:32 +02:00
drop_forget_useless.rs Fix dropping_copy_types lint from linting in match-arm with side-effects 2023-07-01 16:05:55 +02:00
early.rs diagnostics: avoid wrong unused_parens on x as (T) < y 2023-08-31 20:14:49 -07:00
enum_intrinsics_non_enums.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
errors.rs feat(rustc_lint): make CheckLintName respect lint level 2023-08-30 19:24:44 +01:00
expect.rs Move expansion of query macros in rustc_middle to rustc_middle::query 2023-05-15 08:49:13 +02:00
for_loops_over_fallibles.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
foreign_modules.rs Remove rustc_lint_defs::lint_array 2023-09-28 23:01:25 +02:00
hidden_unicode_codepoints.rs migrate: hidden_unicode_codepoints.rs 2023-01-09 17:07:25 -05:00
internal.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
invalid_from_utf8.rs Fix ICE by introducing an expr_or_init variant for outside bodies 2023-09-27 18:59:24 +02:00
late.rs Auto merge of #115825 - cjgillot:expr-field-lint, r=compiler-errors 2023-09-14 06:29:23 +00:00
let_underscore.rs Fix typos in compiler 2023-04-10 22:02:52 +02:00
levels.rs Auto merge of #115825 - cjgillot:expr-field-lint, r=compiler-errors 2023-09-14 06:29:23 +00:00
lib.rs rustdoc: remove rust logo from non-Rust crates 2023-10-08 20:17:53 -07:00
lints.rs Rollup merge of #116421 - Urgau:inter-mut-invalid_ref_casting, r=oli-obk 2023-10-06 06:23:48 +02:00
map_unit_fn.rs Fix #109152, fix the scenario that we may can not get span of func 2023-03-15 14:07:39 +08:00
methods.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
multiple_supertrait_upcastable.rs Add missing feature gate in multiple_supertrait_upcastable doc 2023-07-31 12:28:53 +01:00
non_ascii_idents.rs Reword confusable idents lint 2023-08-04 16:46:08 +00:00
non_fmt_panic.rs Use Option::is_some_and and Result::is_ok_and in the compiler 2023-05-24 14:20:41 +00:00
nonstandard_style.rs allow host param to be lowercase 2023-07-04 11:47:46 +00:00
noop_method_call.rs Fix noop_method_call detection for new diagnostic items 2023-09-28 08:22:59 -04:00
opaque_hidden_inferred_bound.rs non_lifetime_binders: fix ICE in lint opaque-hidden-inferred-bound 2023-10-03 13:59:59 +02:00
pass_by_value.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
passes.rs Remove rustc_lint_defs::lint_array 2023-09-28 23:01:25 +02:00
ptr_nulls.rs Improve diagnostics and add tests for function calls 2023-08-06 19:08:14 +02:00
redundant_semicolon.rs refactor: cleanup 2023-01-09 18:57:02 -05:00
reference_casting.rs Clarify invalid_reference_casting lint around interior mutable types 2023-10-04 22:06:16 +02:00
tests.rs refactor(rustc_lint): inline check_lint_name_cmdline 2023-08-30 17:35:07 +01:00
traits.rs make comments less cryptic 2023-09-06 12:09:29 +03:00
types.rs Fix span of overflow lint for negated literals 2023-10-11 04:55:55 +02:00
unused.rs Move let expression checking to parsing 2023-09-11 15:51:18 +00:00