Auto merge of #115104 - compiler-errors:rollup-8235xz5, r=compiler-errors
Rollup of 6 pull requests Successful merges: - #114959 (fix #113702 emit a proper diagnostic message for unstable lints passed from CLI) - #115011 (Warn on elided lifetimes in associated constants (`ELIDED_LIFETIMES_IN_ASSOCIATED_CONSTANT`)) - #115077 (Do not emit invalid suggestion in E0191 when spans overlap) - #115087 (Add disclaimer on size assertion macro) - #115090 (Always use `os-release` rather than `/lib` to detect `NixOS` (bootstrap)) - #115101 (triagebot: add dependency licensing pings) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
712d962cef
24 changed files with 296 additions and 57 deletions
|
@ -3376,6 +3376,7 @@ declare_lint_pass! {
|
|||
DEPRECATED_IN_FUTURE,
|
||||
DEPRECATED_WHERE_CLAUSE_LOCATION,
|
||||
DUPLICATE_MACRO_ATTRIBUTES,
|
||||
ELIDED_LIFETIMES_IN_ASSOCIATED_CONSTANT,
|
||||
ELIDED_LIFETIMES_IN_PATHS,
|
||||
EXPORTED_PRIVATE_DEPENDENCIES,
|
||||
FFI_UNWIND_CALLS,
|
||||
|
@ -4527,3 +4528,44 @@ declare_lint! {
|
|||
reference: "issue #114095 <https://github.com/rust-lang/rust/issues/114095>",
|
||||
};
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
/// The `elided_lifetimes_in_associated_constant` lint detects elided lifetimes
|
||||
/// that were erroneously allowed in associated constants.
|
||||
///
|
||||
/// ### Example
|
||||
///
|
||||
/// ```rust,compile_fail
|
||||
/// #![deny(elided_lifetimes_in_associated_constant)]
|
||||
///
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Foo {
|
||||
/// const STR: &str = "hello, world";
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// {{produces}}
|
||||
///
|
||||
/// ### Explanation
|
||||
///
|
||||
/// Previous version of Rust
|
||||
///
|
||||
/// Implicit static-in-const behavior was decided [against] for associated
|
||||
/// constants because of ambiguity. This, however, regressed and the compiler
|
||||
/// erroneously treats elided lifetimes in associated constants as lifetime
|
||||
/// parameters on the impl.
|
||||
///
|
||||
/// This is a [future-incompatible] lint to transition this to a
|
||||
/// hard error in the future.
|
||||
///
|
||||
/// [against]: https://github.com/rust-lang/rust/issues/38831
|
||||
/// [future-incompatible]: ../index.md#future-incompatible-lints
|
||||
pub ELIDED_LIFETIMES_IN_ASSOCIATED_CONSTANT,
|
||||
Warn,
|
||||
"elided lifetimes cannot be used in associated constants in impls",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseError,
|
||||
reference: "issue #115010 <https://github.com/rust-lang/rust/issues/115010>",
|
||||
};
|
||||
}
|
||||
|
|
|
@ -573,6 +573,10 @@ pub enum BuiltinLintDiagnostics {
|
|||
/// The span of the unnecessarily-qualified path to remove.
|
||||
removal_span: Span,
|
||||
},
|
||||
AssociatedConstElidedLifetime {
|
||||
elided: bool,
|
||||
span: Span,
|
||||
},
|
||||
}
|
||||
|
||||
/// Lints that are buffered up early on in the `Session` before the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue