Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn inline_attr<'gcc, 'tcx>(
/// attributes.
pub fn from_fn_attrs<'gcc, 'tcx>(
cx: &CodegenCx<'gcc, 'tcx>,
#[cfg_attr(not(feature = "master"), allow(unused_variables))] func: Function<'gcc>,
#[cfg_attr(not(feature = "master"), expect(unused_variables))] func: Function<'gcc>,
instance: ty::Instance<'tcx>,
) {
let codegen_fn_attrs = cx.tcx.codegen_instance_attrs(instance.def);
Expand Down
2 changes: 1 addition & 1 deletion src/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ pub fn optimize_thin_module(
save_temp_bitcode(cgcx, &module, "thin-lto-after-pm");
}
}*/
#[allow(clippy::let_and_return)]
#[expect(clippy::let_and_return)]
module
}

Expand Down
3 changes: 1 addition & 2 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
variable.to_rvalue()
}

#[allow(dead_code)]
fn va_arg(&mut self, _list: RValue<'gcc>, _ty: Type<'gcc>) -> RValue<'gcc> {
unimplemented!();
}
Expand Down Expand Up @@ -2517,7 +2516,7 @@ impl ToGccComp for RealPredicate {
}

#[repr(C)]
#[allow(non_camel_case_types)]
#[expect(non_camel_case_types)]
enum MemOrdering {
__ATOMIC_RELAXED,
__ATOMIC_CONSUME,
Expand Down
3 changes: 1 addition & 2 deletions src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ impl<'gcc, 'tcx> StaticCodegenMethods for CodegenCx<'gcc, 'tcx> {
global_value
}

#[cfg_attr(not(feature = "master"), allow(unused_mut))]
fn codegen_static(&mut self, def_id: DefId) {
let attrs = self.tcx.codegen_fn_attrs(def_id);

Expand Down Expand Up @@ -162,7 +161,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
// TODO(antoyo)
}

#[cfg_attr(not(feature = "master"), allow(unused_variables))]
#[cfg_attr(not(feature = "master"), expect(unused_variables))]
pub fn add_used_function(&self, function: Function<'gcc>) {
#[cfg(feature = "master")]
function.add_attribute(FnAttribute::Used);
Expand Down
4 changes: 2 additions & 2 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::abi::conv_to_fn_attribute;
use crate::callee::get_fn;
use crate::common::SignType;

#[cfg_attr(not(feature = "master"), allow(dead_code))]
#[cfg_attr(not(feature = "master"), expect(dead_code))]
pub struct CodegenCx<'gcc, 'tcx> {
/// A cache of converted ConstAllocs
pub const_cache: RefCell<HashMap<Allocation, RValue<'gcc>>>,
Expand Down Expand Up @@ -132,7 +132,7 @@ pub struct CodegenCx<'gcc, 'tcx> {
}

impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub fn new(
context: &'gcc Context<'gcc>,
codegen_unit: &'tcx CodegenUnit<'tcx>,
Expand Down
2 changes: 1 addition & 1 deletion src/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
///
/// If there’s a value with the same name already declared, the function will
/// update the declaration and return existing Value instead.
#[allow(clippy::let_and_return)]
#[expect(clippy::let_and_return)]
fn declare_raw_fn<'gcc>(
cx: &CodegenCx<'gcc, '_>,
name: &str,
Expand Down
20 changes: 1 addition & 19 deletions src/intrinsic/archs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
};
match arch {
"AMDGPU" => {
#[allow(non_snake_case)]
#[expect(non_snake_case)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is generated by generate_intrinsics.py, so next time it gets regenerated these changes will be overwritten.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should try to remember what the code I wrote is actually doing. ^^'

fn AMDGPU(name: &str, full_name: &str) -> &'static str {
match name {
// AMDGPU
Expand Down Expand Up @@ -48,7 +48,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
AMDGPU(name, full_name)
}
"aarch64" => {
#[allow(non_snake_case)]
fn aarch64(name: &str, full_name: &str) -> &'static str {
match name {
// aarch64
Expand Down Expand Up @@ -81,7 +80,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
aarch64(name, full_name)
}
"amdgcn" => {
#[allow(non_snake_case)]
fn amdgcn(name: &str, full_name: &str) -> &'static str {
match name {
// amdgcn
Expand Down Expand Up @@ -524,7 +522,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
amdgcn(name, full_name)
}
"arm" => {
#[allow(non_snake_case)]
fn arm(name: &str, full_name: &str) -> &'static str {
match name {
// arm
Expand Down Expand Up @@ -633,7 +630,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
arm(name, full_name)
}
"bpf" => {
#[allow(non_snake_case)]
fn bpf(name: &str, full_name: &str) -> &'static str {
match name {
// bpf
Expand All @@ -655,7 +651,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
bpf(name, full_name)
}
"cuda" => {
#[allow(non_snake_case)]
fn cuda(name: &str, full_name: &str) -> &'static str {
match name {
// cuda
Expand All @@ -666,7 +661,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
cuda(name, full_name)
}
"hexagon" => {
#[allow(non_snake_case)]
fn hexagon(name: &str, full_name: &str) -> &'static str {
match name {
// hexagon
Expand Down Expand Up @@ -2653,7 +2647,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
hexagon(name, full_name)
}
"loongarch" => {
#[allow(non_snake_case)]
fn loongarch(name: &str, full_name: &str) -> &'static str {
match name {
// loongarch
Expand Down Expand Up @@ -4162,7 +4155,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
loongarch(name, full_name)
}
"mips" => {
#[allow(non_snake_case)]
fn mips(name: &str, full_name: &str) -> &'static str {
match name {
// mips
Expand Down Expand Up @@ -4843,7 +4835,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
mips(name, full_name)
}
"nvvm" => {
#[allow(non_snake_case)]
fn nvvm(name: &str, full_name: &str) -> &'static str {
match name {
// nvvm
Expand Down Expand Up @@ -5652,7 +5643,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
nvvm(name, full_name)
}
"ppc" => {
#[allow(non_snake_case)]
fn ppc(name: &str, full_name: &str) -> &'static str {
match name {
// ppc
Expand Down Expand Up @@ -6245,7 +6235,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
ppc(name, full_name)
}
"ptx" => {
#[allow(non_snake_case)]
fn ptx(name: &str, full_name: &str) -> &'static str {
match name {
// ptx
Expand Down Expand Up @@ -6273,7 +6262,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
ptx(name, full_name)
}
"r600" => {
#[allow(non_snake_case)]
fn r600(name: &str, full_name: &str) -> &'static str {
match name {
// r600
Expand All @@ -6298,7 +6286,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
r600(name, full_name)
}
"riscv" => {
#[allow(non_snake_case)]
fn riscv(name: &str, full_name: &str) -> &'static str {
match name {
// riscv
Expand Down Expand Up @@ -6332,7 +6319,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
riscv(name, full_name)
}
"s390" => {
#[allow(non_snake_case)]
fn s390(name: &str, full_name: &str) -> &'static str {
match name {
// s390
Expand Down Expand Up @@ -6526,7 +6512,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
s390(name, full_name)
}
"spv" => {
#[allow(non_snake_case)]
fn spv(name: &str, full_name: &str) -> &'static str {
match name {
// spv
Expand All @@ -6543,7 +6528,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
spv(name, full_name)
}
"ve" => {
#[allow(non_snake_case)]
fn ve(name: &str, full_name: &str) -> &'static str {
match name {
// ve
Expand Down Expand Up @@ -7816,7 +7800,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
ve(name, full_name)
}
"x86" => {
#[allow(non_snake_case)]
fn x86(name: &str, full_name: &str) -> &'static str {
match name {
// x86
Expand Down Expand Up @@ -10384,7 +10367,6 @@ fn map_arch_intrinsic(full_name: &str) -> &'static str {
x86(name, full_name)
}
"xcore" => {
#[allow(non_snake_case)]
fn xcore(name: &str, full_name: &str) -> &'static str {
match name {
// xcore
Expand Down
2 changes: 1 addition & 1 deletion src/intrinsic/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ fn wide_aes_output_type<'a, 'gcc, 'tcx>(
(aes_output_type.as_type(), field1, field2)
}

#[cfg_attr(not(feature = "master"), allow(unused_variables))]
#[cfg_attr(not(feature = "master"), expect(unused_variables))]
pub fn adjust_function<'gcc>(
context: &'gcc Context<'gcc>,
func_name: &str,
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
* TODO(antoyo): remove the patches.
*/

#![allow(internal_features)]
#![expect(internal_features)]
#![doc(rust_logo)]
#![feature(rustdoc_internals)]
#![feature(rustc_private)]
#![recursion_limit = "256"]
#![warn(rust_2018_idioms)]
#![warn(unused_lifetimes)]
#![deny(clippy::pattern_type_mismatch)]
#![allow(clippy::needless_lifetimes, clippy::uninlined_format_args)]
#![expect(clippy::uninlined_format_args)]

// The rustc crates we need
extern crate rustc_abi;
Expand All @@ -46,7 +46,7 @@ extern crate rustc_target;
extern crate rustc_type_ir;

// This prevents duplicating functions and statics that are already part of the host rustc process.
#[allow(unused_extern_crates)]
#[expect(unused_extern_crates)]
extern crate rustc_driver;

mod abi;
Expand Down
3 changes: 1 addition & 2 deletions src/mono_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::type_of::LayoutGccExt;
use crate::{attributes, base};

impl<'gcc, 'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
#[cfg_attr(not(feature = "master"), allow(unused_variables))]
#[cfg_attr(not(feature = "master"), expect(unused_variables))]
fn predefine_static(
&mut self,
def_id: DefId,
Expand All @@ -41,7 +41,6 @@ impl<'gcc, 'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
self.instances.borrow_mut().insert(instance, global);
}

#[cfg_attr(not(feature = "master"), allow(unused_variables))]
fn predefine_fn(
&mut self,
instance: Instance<'tcx>,
Expand Down
2 changes: 1 addition & 1 deletion src/type_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ impl<'gcc, 'tcx> BaseTypeCodegenMethods for CodegenCx<'gcc, 'tcx> {
value.get_type()
}

#[cfg_attr(feature = "master", allow(unused_mut))]
#[cfg_attr(feature = "master", expect(unused_mut))]
fn type_array(&self, ty: Type<'gcc>, mut len: u64) -> Type<'gcc> {
#[cfg(not(feature = "master"))]
if let Some(struct_type) = ty.is_struct()
Expand Down
3 changes: 2 additions & 1 deletion tools/generate_intrinsics.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ def update_intrinsics(llvm_path, llvmint, llvmint2):
for arch in archs:
if len(intrinsics[arch]) == 0:
continue
out.write("\"{}\" => {{ #[allow(non_snake_case)] fn {}(name: &str,full_name:&str) -> &'static str {{ match name {{".format(arch,arch))
attribute = "#[expect(non_snake_case)]" if arch[0].isupper() else ""
out.write("\"{}\" => {{ {} fn {}(name: &str,full_name:&str) -> &'static str {{ match name {{".format(arch, attribute, arch))
intrinsics[arch].sort(key=lambda x: (x[0], x[2]))
out.write(' // {}\n'.format(arch))
for entry in intrinsics[arch]:
Expand Down