Review the Lang team project board and get updates
forbid(group)
and later do a allow(lint)
where lint
is in group
, you get a FCW but the allow takes effectderive
triggering itFoo(Bar(x) | Baz(x))
"" rust#54883
UNUSED_MUST_USE
" rust#76894
gecko_profiler_register_thread(CString::new("foo").unwrap().as_ptr());
CString::new()
is being converted to a raw pointer; that raw pointer is valid until end of statementgecko_profiler_register_thread
CString::new
into a let, but that is also quite possibly wrong (e.g., )let x = CString::new("foo").unwrap().as_ptr();
– good, guaranteed wronglet x = Some(CString::new("foo").unwrap().as_ptr());
let x = Foo { field: CString::new("foo").unwrap().as_ptr() };
let x = (CString::new("foo").unwrap().as_ptr(), ...)
let x = foo(CString::new("foo").unwrap().as_ptr());
let x = foo(Some(CString::new("foo").unwrap().as_ptr()));
let x = foo(x.as_ptr())
where foo
is the identity functionCurrent output:
warning: getting the inner pointer of a temporary `CString`
--> src/main.rs:9:69
|
9 | gecko_profiler_register_thread(CString::new("foo").unwrap().as_ptr());
| ---------------------------- ^^^^^^ this pointer will be invalid
| |
| this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
|
= note: `#[warn(temporary_cstring_as_ptr)]` on by default
= note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
= help: for more information, see https://doc.rust-lang.org/reference/destructors.html
#[derive]
into a regular macro attribute" rust#79078
unsafe_op_in_unsafe_fn
lint" rust#79208
panic!(); *foo
, the *foo
is dead code, it's hard to say whether (we care that) foo
is initialized or notlet foo: bool; let _ = *foo;
doesn't involve dead codestruct Foo<T: ?Sized> { x: T }
Arc<Foo<[u8; 32]>>
want to permit coercion to Arc<Foo<[u8]>>
Arc<T>
can be coerced to Arc<U>
if T: Unsize<U>
or something like thatstruct Foo2<T: ?Sized> { a: T, x: T }
Foo2<[u8]>
would affect type of both fieldsstruct A<T, U: ?Sized>(T, B<T, U>);
struct B<T, U: ?Sized>(T, U);
#[inline] const T: u32
, these were being silently ignored beforeconst fn
" rust#80962