Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9195ce5
CFI: Only encode Coroutine Parent Args
maurer Mar 27, 2024
d243f5f
CFI: Rewrite closure and coroutine instances to their trait method
maurer Mar 26, 2024
bf47641
compiler: fix unused_peekable clippy lint
klensy Mar 28, 2024
b6cfe71
compiler: fix some clippy needless_pass_by_ref_mut
klensy Mar 28, 2024
aa35530
compiler: fix few needless_pass_by_ref_mut clippy lints
klensy Mar 28, 2024
316bc1c
compiler: fix few needless_pass_by_ref_mut clippy lints
klensy Mar 28, 2024
ecb3992
compiler: fix few needless_pass_by_ref_mut clippy lints
klensy Mar 28, 2024
615bb53
compiler: fix few needless_pass_by_ref_mut clippy lints
klensy Mar 28, 2024
afd0a8e
change BuiltinDeriveFn type to get ExtCtxt by immutable ref and fix s…
klensy Mar 28, 2024
c64a440
fix few more
klensy Mar 28, 2024
5488e49
and few more
klensy Mar 28, 2024
9a6b3df
and few more
klensy Mar 28, 2024
8245718
and more
klensy Mar 28, 2024
a325bce
Normalize the result of Fields::ty_with_args
celinval Mar 28, 2024
5fe364a
copy any file from stage0/lib to stage0-sysroot/lib
onur-ozkan Mar 29, 2024
5eb78c5
Forward port 1.77.1 release notes
yedayak Mar 29, 2024
448d4c1
Rollup merge of #123106 - maurer:cfi-closures, r=compiler-errors
matthiaskrgr Mar 29, 2024
3d1d25f
Rollup merge of #123176 - celinval:smir-field-ty, r=oli-obk
matthiaskrgr Mar 29, 2024
36d1dc5
Rollup merge of #123186 - onur-ozkan:llvm-library-bug, r=Kobzol
matthiaskrgr Mar 29, 2024
7f69eb2
Rollup merge of #123187 - yedayak:relnotes-1.77.1, r=Mark-Simulacrum
matthiaskrgr Mar 29, 2024
224f3ea
Rollup merge of #123188 - klensy:clippy-me2, r=Nilstrieb
matthiaskrgr Mar 29, 2024
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
Prev Previous commit
Next Next commit
compiler: fix few needless_pass_by_ref_mut clippy lints
warning: this argument is a mutable reference, but not used mutably
   --> compiler\rustc_builtin_macros\src\deriving\mod.rs:120:9
    |
120 |     cx: &mut ExtCtxt<'_>,
    |         ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
    --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:1573:13
     |
1573 |         cx: &mut ExtCtxt<'_>,
     |             ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
    --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:1556:13
     |
1556 |         cx: &mut ExtCtxt<'_>,
     |             ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
    --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:1463:13
     |
1463 |         cx: &mut ExtCtxt<'_>,
     |             ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
    --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:1433:36
     |
1433 |     fn summarise_struct(&self, cx: &mut ExtCtxt<'_>, struct_def: &VariantData) -> StaticFields {
     |                                    ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
   --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:953:13
    |
953 |         cx: &mut ExtCtxt<'_>,
    |             ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
   --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:932:13
    |
932 |         cx: &mut ExtCtxt<'_>,
    |             ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
   --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:580:13
    |
580 |         cx: &mut ExtCtxt<'_>,
    |             ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
   --> compiler\rustc_builtin_macros\src\deriving\generic\mod.rs:989:13
    |
989 |         cx: &mut ExtCtxt<'_>,
    |             ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
  --> compiler\rustc_builtin_macros\src\deriving\clone.rs:97:9
   |
97 |     cx: &mut ExtCtxt<'_>,
   |         ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
  --> compiler\rustc_builtin_macros\src\deriving\cmp\eq.rs:52:9
   |
52 |     cx: &mut ExtCtxt<'_>,
   |         ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
  --> compiler\rustc_builtin_macros\src\deriving\hash.rs:50:9
   |
50 |     cx: &mut ExtCtxt<'_>,
   |         ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
   --> compiler\rustc_builtin_macros\src\deriving\encodable.rs:150:9
    |
150 |     cx: &mut ExtCtxt<'_>,
    |         ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
   --> compiler\rustc_builtin_macros\src\deriving\default.rs:176:9
    |
176 |     cx: &mut ExtCtxt<'_>,
    |         ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
   --> compiler\rustc_builtin_macros\src\deriving\default.rs:106:9
    |
106 |     cx: &mut ExtCtxt<'_>,
    |         ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
  --> compiler\rustc_builtin_macros\src\deriving\default.rs:57:9
   |
57 |     cx: &mut ExtCtxt<'_>,
   |         ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
  --> compiler\rustc_builtin_macros\src\deriving\default.rs:84:9
   |
84 |     cx: &mut ExtCtxt<'_>,
   |         ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
   --> compiler\rustc_builtin_macros\src\deriving\debug.rs:212:9
    |
212 |     cx: &mut ExtCtxt<'_>,
    |         ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
  --> compiler\rustc_builtin_macros\src\deriving\debug.rs:48:26
   |
48 | fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
   |                          ^^^^^^^^^^^^^^^^ help: consider changing to: `&ExtCtxt<'_>`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
  • Loading branch information
klensy committed Mar 28, 2024
commit ecb39926d86871ccec1e83d748452671a7202c38
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/deriving/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub fn expand_deriving_clone(

fn cs_clone_simple(
name: &str,
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
trait_span: Span,
substr: &Substructure<'_>,
is_union: bool,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub fn expand_deriving_eq(
}

fn cs_total_eq_assert(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
trait_span: Span,
substr: &Substructure<'_>,
) -> BlockOrExpr {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_builtin_macros/src/deriving/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn expand_deriving_debug(
trait_def.expand(cx, mitem, item, push)
}

fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
fn show_substructure(cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
// We want to make sure we have the ctxt set so that we can use unstable methods
let span = cx.with_def_site_ctxt(span);

Expand Down Expand Up @@ -209,7 +209,7 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
/// }
/// ```
fn show_fieldless_enum(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
span: Span,
def: &EnumDef,
substr: &Substructure<'_>,
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_builtin_macros/src/deriving/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub fn expand_deriving_default(
}

fn default_struct_substructure(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
trait_span: Span,
substr: &Substructure<'_>,
summary: &StaticFields,
Expand All @@ -81,7 +81,7 @@ fn default_struct_substructure(
}

fn default_enum_substructure(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
trait_span: Span,
enum_def: &EnumDef,
) -> BlockOrExpr {
Expand All @@ -103,7 +103,7 @@ fn default_enum_substructure(
}

fn extract_default_variant<'a>(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
enum_def: &'a EnumDef,
trait_span: Span,
) -> Result<&'a rustc_ast::Variant, ErrorGuaranteed> {
Expand Down Expand Up @@ -173,7 +173,7 @@ fn extract_default_variant<'a>(
}

fn validate_default_attribute(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
default_variant: &rustc_ast::Variant,
) -> Result<(), ErrorGuaranteed> {
let attrs: SmallVec<[_; 1]> =
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/deriving/encodable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pub fn expand_deriving_rustc_encodable(
}

fn encodable_substructure(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
trait_span: Span,
substr: &Substructure<'_>,
krate: Symbol,
Expand Down
16 changes: 8 additions & 8 deletions compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ impl<'a> TraitDef<'a> {
/// therefore does not get bound by the derived trait.
fn create_derived_impl(
&self,
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
type_ident: Ident,
generics: &Generics,
field_tys: Vec<P<ast::Ty>>,
Expand Down Expand Up @@ -929,7 +929,7 @@ impl<'a> MethodDef<'a> {

fn get_ret_ty(
&self,
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
trait_: &TraitDef<'_>,
generics: &Generics,
type_ident: Ident,
Expand All @@ -950,7 +950,7 @@ impl<'a> MethodDef<'a> {
// `&self`.
fn extract_arg_details(
&self,
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
trait_: &TraitDef<'_>,
type_ident: Ident,
generics: &Generics,
Expand Down Expand Up @@ -986,7 +986,7 @@ impl<'a> MethodDef<'a> {

fn create_method(
&self,
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
trait_: &TraitDef<'_>,
type_ident: Ident,
generics: &Generics,
Expand Down Expand Up @@ -1430,7 +1430,7 @@ impl<'a> MethodDef<'a> {

// general helper methods.
impl<'a> TraitDef<'a> {
fn summarise_struct(&self, cx: &mut ExtCtxt<'_>, struct_def: &VariantData) -> StaticFields {
fn summarise_struct(&self, cx: &ExtCtxt<'_>, struct_def: &VariantData) -> StaticFields {
let mut named_idents = Vec::new();
let mut just_spans = Vec::new();
for field in struct_def.fields() {
Expand Down Expand Up @@ -1460,7 +1460,7 @@ impl<'a> TraitDef<'a> {

fn create_struct_patterns(
&self,
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
struct_path: ast::Path,
struct_def: &'a VariantData,
prefixes: &[String],
Expand Down Expand Up @@ -1553,7 +1553,7 @@ impl<'a> TraitDef<'a> {

fn create_struct_pattern_fields(
&self,
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
struct_def: &'a VariantData,
prefixes: &[String],
) -> Vec<FieldInfo> {
Expand All @@ -1570,7 +1570,7 @@ impl<'a> TraitDef<'a> {

fn create_struct_field_access_fields(
&self,
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
selflike_args: &[P<Expr>],
struct_def: &'a VariantData,
is_packed: bool,
Expand Down
6 changes: 1 addition & 5 deletions compiler/rustc_builtin_macros/src/deriving/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ pub fn expand_deriving_hash(
hash_trait_def.expand(cx, mitem, item, push);
}

fn hash_substructure(
cx: &mut ExtCtxt<'_>,
trait_span: Span,
substr: &Substructure<'_>,
) -> BlockOrExpr {
fn hash_substructure(cx: &ExtCtxt<'_>, trait_span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
let [state_expr] = substr.nonselflike_args else {
cx.dcx().span_bug(trait_span, "incorrect number of arguments in `derive(Hash)`");
};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/deriving/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fn call_unreachable(cx: &ExtCtxt<'_>, span: Span) -> P<ast::Expr> {
}

fn assert_ty_bounds(
cx: &mut ExtCtxt<'_>,
cx: &ExtCtxt<'_>,
stmts: &mut ThinVec<ast::Stmt>,
ty: P<ast::Ty>,
span: Span,
Expand Down