rustc_lint_defs::builtin

Static TYVAR_BEHIND_RAW_POINTER

Source
pub static TYVAR_BEHIND_RAW_POINTER: &Lint
Expand description

The tyvar_behind_raw_pointer lint detects raw pointer to an inference variable.

§Example

// edition 2015
let data = std::ptr::null();
let _ = &data as *const *const ();

if data.is_null() {}

{{produces}}

§Explanation

This kind of inference was previously allowed, but with the future arrival of arbitrary self types, this can introduce ambiguity. To resolve this, use an explicit type instead of relying on type inference.

This is a future-incompatible lint to transition this to a hard error in the 2018 edition. See issue #46906 for more details. This is currently a hard-error on the 2018 edition, and is “warn” by default in the 2015 edition.