Open
Description
Summary
No response
Reproducer
// /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs
// check-pass
// compile-flags: --cfg something
#![deny(unused_mut)]
extern "C" {
fn ffi(
#[allow(unused_mut)] a: i32,
#[cfg(something)] b: i32,
#[cfg_attr(something, cfg(nothing))] c: i32,
#[forbid(unused_mut)] d: i32,
#[deny(unused_mut)] #[warn(unused_mut)] ...
);
}
type FnType = fn(
#[allow(unused_mut)] a: i32,
#[cfg(something)] b: i32,
#[cfg_attr(something, cfg(nothing))] c: i32,
#[forbid(unused_mut)] d: i32,
#[deny(unused_mut)] #[warn(unused_mut)] e: i32
);
pub fn foo(
#[allow(unused_mut)] a: i32,
#[cfg(something)] b: i32,
#[cfg_attr(something, cfg(nothing))] c: i32,
#[forbid(unused_mut)] d: i32,
#[deny(unused_mut)] #[warn(unused_mut)] _e: i32
) {}
// self
struct SelfStruct {}
impl SelfStruct {
fn foo(
#[allow(unused_mut)] self,
#[cfg(something)] a: i32,
#[cfg_attr(something, cfg(nothing))]
#[deny(unused_mut)] b: i32,
) {}
}
struct RefStruct {}
impl RefStruct {
fn foo(
#[allow(unused_mut)] &self,
#[cfg(something)] a: i32,
#[cfg_attr(something, cfg(nothing))]
#[deny(unused_mut)] b: i32,
) {}
}
trait RefTrait {
fn foo(
#[forbid(unused_mut)] &self,
#[warn(unused_mut)] a: i32
) {}
}
impl RefTrait for RefStruct {
fn foo(
#[forbid(unused_mut)] &self,
#[warn(unused_mut)] a: i32
) {}
}
// Box<Self>
struct BoxSelfStruct {}
impl BoxSelfStruct {
fn foo(
#[allow(unused_mut)] self: Box<Self>,
#[cfg(something)] a: i32,
#[cfg_attr(something, cfg(nothing))]
#[deny(unused_mut)] b: i32,
) {}
}
trait BoxSelfTrait {
fn foo(
#[forbid(unused_mut)] self: Box<Self>,
#[warn(unused_mut)] a: i32
) {}
}
impl BoxSelfTrait for BoxSelfStruct {
fn foo(
#[forbid(unused_mut)] self: Box<Self>,
#[warn(unused_mut)] a: i32
) {}
}
fn main() {
let _: unsafe extern "C" fn(_, _, _, ...) = ffi;
let _: fn(_, _, _, _) = foo;
let _: FnType = |_, _, _, _| {};
let c = |
#[allow(unused_mut)] a: u32,
#[cfg(something)] b: i32,
#[cfg_attr(something, cfg(nothing))]
#[deny(unused_mut)] c: i32,
| {};
c(1, 2);
}
Version
No response
Logs and Backtrace
MARKER_ERROR_TRACE=1 MARKER_LOG=info RUST_BACKTRACE=1 LD_LIBRARY_PATH='/home/matthias/o/target/debug/deps:/home/matthias/.rustup/toolchains/nightly-2023-11-16-x86_64-unknown-linux-gnu/lib:/home/matthias/.rustup/toolchains/nightly-2023-11-16-x86_64-unknown-linux-gnu/lib:/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib' RUSTC_WORKSPACE_WRAPPER=/home/matthias/.rustup/toolchains/nightly-2023-11-16-x86_64-unknown-linux-gnu/bin/marker_rustc_driver MARKER_LINT_CRATES=marker_lints:/home/matthias/o/target/marker/lints/libmarker_lints.so RUSTUP_TOOLCHAIN=nightly-2023-11-16 /home/matthias/.rustup/toolchains/nightly-2023-11-16-x86_64-unknown-linux-gnu/bin/marker_rustc_driver /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs
warning: unused variable: `a`
--> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs:25:26
|
25 | #[allow(unused_mut)] a: i32,
| ^ help: if this is intentional, prefix it with an underscore: `_a`
|
= note: `#[warn(unused_variables)]` on by default
warning: unused variable: `c`
--> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs:27:42
|
27 | #[cfg_attr(something, cfg(nothing))] c: i32,
| ^ help: if this is intentional, prefix it with an underscore: `_c`
warning: unused variable: `d`
--> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs:28:27
|
28 | #[forbid(unused_mut)] d: i32,
| ^ help: if this is intentional, prefix it with an underscore: `_d`
warning: unused variable: `b`
--> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs:40:29
|
40 | #[deny(unused_mut)] b: i32,
| ^ help: if this is intentional, prefix it with an underscore: `_b`
warning: unused variable: `b`
--> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs:50:29
|
50 | #[deny(unused_mut)] b: i32,
| ^ help: if this is intentional, prefix it with an underscore: `_b`
warning: unused variable: `a`
--> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs:56:29
|
56 | #[warn(unused_mut)] a: i32
| ^ help: if this is intentional, prefix it with an underscore: `_a`
warning: unused variable: `a`
--> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs:62:29
|
62 | #[warn(unused_mut)] a: i32
| ^ help: if this is intentional, prefix it with an underscore: `_a`
warning: unused variable: `b`
--> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs:74:29
|
74 | #[deny(unused_mut)] b: i32,
| ^ help: if this is intentional, prefix it with an underscore: `_b`
warning: unused variable: `a`
--> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs:80:29
|
80 | #[warn(unused_mut)] a: i32
| ^ help: if this is intentional, prefix it with an underscore: `_a`
warning: unused variable: `a`
--> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs:86:29
|
86 | #[warn(unused_mut)] a: i32
| ^ help: if this is intentional, prefix it with an underscore: `_a`
warning: unused variable: `a`
--> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs:95:30
|
95 | #[allow(unused_mut)] a: u32,
| ^ help: if this is intentional, prefix it with an underscore: `_a`
warning: unused variable: `c`
--> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs:98:29
|
98 | #[deny(unused_mut)] c: i32,
| ^ help: if this is intentional, prefix it with an underscore: `_c`
warning: struct `SelfStruct` is never constructed
--> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs:34:8
|
34 | struct SelfStruct {}
| ^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: method `foo` is never used
--> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs:36:8
|
35 | impl SelfStruct {
| --------------- method in this implementation
36 | fn foo(
| ^^^
warning: method `foo` is never used
--> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs:46:8
|
45 | impl RefStruct {
| -------------- method in this implementation
46 | fn foo(
| ^^^
warning: method `foo` is never used
--> /home/matthias/vcs/github/rust_misc_stuff/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs:70:8
|
69 | impl BoxSelfStruct {
| ------------------ method in this implementation
70 | fn foo(
| ^^^
thread 'rustc' panicked at /home/matthias/.cargo/registry/src/index.crates.io-6f17d22bba15001f/marker_rustc_driver-0.4.3/src/conversion/marker/ast/ty.rs:73:9:
assertion `left == right` failed
left: 4
right: 3
stack backtrace:
0: rust_begin_unwind
at /rustc/6b771f6b5a6c8b03b6322a9c77ac77cb346148f0/library/std/src/panicking.rs:645:5
1: core::panicking::panic_fmt
at /rustc/6b771f6b5a6c8b03b6322a9c77ac77cb346148f0/library/core/src/panicking.rs:72:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
4: marker_rustc_driver::conversion::marker::ast::ty::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_syn_ty
5: marker_rustc_driver::conversion::marker::ast::stmts::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_stmt
6: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
7: marker_rustc_driver::conversion::marker::ast::expr::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_block_expr
8: marker_rustc_driver::conversion::marker::ast::expr::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_expr
9: marker_rustc_driver::conversion::marker::MarkerConverter::body
10: marker_utils::visitor::traverse_item
11: marker_utils::visitor::traverse_item
12: marker_adapter::Adapter::process_krate
13: marker_rustc_driver::lint_pass::process_crate
14: rustc_lint::late::check_crate::{closure#0}
15: rustc_lint::late::check_crate
16: rustc_interface::passes::analysis
[... omitted 1 frame ...]
17: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-marker/marker/issues/new?template=panic.yml
note: please attach the file at `/tmp/marker/rustc-ice-2023-12-17T23_43_38-1811164.txt` to your bug report
query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
note: marker_rustc_driver 0.4.3
note: Achievement Unlocked: [Free Ice Cream]
warning: 16 warnings emitted