Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #128142

Merged
merged 27 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
91af6b5
Add edge-case examples to `{count,leading,trailing}_{ones,zeros}` met…
fitzgen Jul 2, 2024
6519c14
Reset sigpipe not supported for vxworks
Jul 8, 2024
287b66b
size_of_val_raw: for length 0 this is safe to call
RalfJung Jun 8, 2024
f6fe7e4
lib: replace some `mem::forget`'s with `ManuallyDrop`
GrigorenkoPV Jul 14, 2024
c807ac0
Use verbose suggestion for "wrong # of generics"
estebank Jul 5, 2024
5c2b36a
Change suggestion message wording
estebank Jul 5, 2024
b30fdec
On generic and lifetime removal suggestion, do not leave behind stray…
estebank Jul 5, 2024
921de9d
Revert suggestion verbosity change
estebank Jul 22, 2024
2561d91
Allow unused unsafe for vxworks in read_at and write at
Jul 23, 2024
a598ca0
Disable dirfd for vxworks, Return unsupported error from set_times an…
Jul 23, 2024
5c9f376
Cfg disable on_broken_pipe_flag_used() for vxworks
Jul 23, 2024
786ad3d
Update process vxworks, set default stack size of 256 Kib for vxworks…
Jul 23, 2024
23e346e
make tidy fast without compromising case alternation
donno2048 Jul 23, 2024
b82f878
Gate AsyncFn* under async_closure feature
compiler-errors Jul 23, 2024
0ea5694
Add chroot unsupported implementation for VxWorks
Jul 24, 2024
9b87fbc
Import `core::ffi::c_void` in more places
ChrisDenton Jul 24, 2024
7cd25b1
Forbid unsafe_op_in_unsafe_fn in sys/pal/windows
ChrisDenton Jul 24, 2024
ac26b88
Improve spans on evaluated `cfg_attr`s.
nnethercote Jul 24, 2024
130d15e
Rollup merge of #126152 - RalfJung:size_of_val_raw, r=saethlin
matthiaskrgr Jul 24, 2024
720c6f1
Rollup merge of #127252 - fitzgen:edge-cases-for-bitwise-operations, …
matthiaskrgr Jul 24, 2024
91c03ef
Rollup merge of #127374 - estebank:wrong-generic-args, r=oli-obk
matthiaskrgr Jul 24, 2024
122b0b2
Rollup merge of #127457 - donno2048:master, r=albertlarsan68
matthiaskrgr Jul 24, 2024
ce523d6
Rollup merge of #127480 - biabbas:vxworks, r=workingjubilee
matthiaskrgr Jul 24, 2024
34abb96
Rollup merge of #127733 - GrigorenkoPV:don't-forget, r=Amanieu
matthiaskrgr Jul 24, 2024
e342efe
Rollup merge of #128120 - compiler-errors:async-fn-name, r=oli-obk
matthiaskrgr Jul 24, 2024
f3a7c3f
Rollup merge of #128131 - ChrisDenton:stuff, r=workingjubilee
matthiaskrgr Jul 24, 2024
2dc88bf
Rollup merge of #128133 - nnethercote:fix-cfg_attr-spans, r=petrochenkov
matthiaskrgr Jul 24, 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
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
let comma = if args.len() > 0 { ", " } else { "" };
let trait_path = self.tcx.def_path_str(trait_def_id);
let method_name = self.tcx.item_name(self.def_id);
err.span_suggestion(
err.span_suggestion_verbose(
expr.span,
msg,
format!("{trait_path}::{generics}::{method_name}({rcvr}{comma}{rest})"),
Expand Down Expand Up @@ -939,18 +939,20 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
}
}

let span_lo_redundant_lt_args = lt_arg_spans[self.num_expected_lifetime_args()];
let span_lo_redundant_lt_args = if self.num_expected_lifetime_args() == 0 {
lt_arg_spans[0]
} else {
lt_arg_spans[self.num_expected_lifetime_args() - 1]
};
let span_hi_redundant_lt_args = lt_arg_spans[lt_arg_spans.len() - 1];

let span_redundant_lt_args = span_lo_redundant_lt_args.to(span_hi_redundant_lt_args);
let span_redundant_lt_args =
span_lo_redundant_lt_args.shrink_to_hi().to(span_hi_redundant_lt_args);
debug!("span_redundant_lt_args: {:?}", span_redundant_lt_args);

let num_redundant_lt_args = lt_arg_spans.len() - self.num_expected_lifetime_args();
let msg_lifetimes = format!(
"remove {these} lifetime argument{s}",
these = pluralize!("this", num_redundant_lt_args),
s = pluralize!(num_redundant_lt_args),
);
let msg_lifetimes =
format!("remove the lifetime argument{s}", s = pluralize!(num_redundant_lt_args));

err.span_suggestion(
span_redundant_lt_args,
Expand Down Expand Up @@ -979,18 +981,22 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
}

let span_lo_redundant_type_or_const_args =
gen_arg_spans[self.num_expected_type_or_const_args()];
if self.num_expected_type_or_const_args() == 0 {
gen_arg_spans[0]
} else {
gen_arg_spans[self.num_expected_type_or_const_args() - 1]
};
let span_hi_redundant_type_or_const_args = gen_arg_spans[gen_arg_spans.len() - 1];
let span_redundant_type_or_const_args = span_lo_redundant_type_or_const_args
.shrink_to_hi()
.to(span_hi_redundant_type_or_const_args);

let span_redundant_type_or_const_args =
span_lo_redundant_type_or_const_args.to(span_hi_redundant_type_or_const_args);
debug!("span_redundant_type_or_const_args: {:?}", span_redundant_type_or_const_args);

let num_redundant_gen_args =
gen_arg_spans.len() - self.num_expected_type_or_const_args();
let msg_types_or_consts = format!(
"remove {these} generic argument{s}",
these = pluralize!("this", num_redundant_gen_args),
"remove the unnecessary generic argument{s}",
s = pluralize!(num_redundant_gen_args),
);

Expand Down Expand Up @@ -1036,7 +1042,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
.with_lo(self.path_segment.ident.span.hi());

let msg = format!(
"remove these {}generics",
"remove the unnecessary {}generics",
if self.gen_args.parenthesized == hir::GenericArgsParentheses::ParenSugar {
"parenthetical "
} else {
Expand Down
6 changes: 3 additions & 3 deletions tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/invalid_const_in_lifetime_position.rs:4:26
|
LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
| ^--- help: remove these generics
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
Expand Down Expand Up @@ -49,7 +49,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/invalid_const_in_lifetime_position.rs:4:26
|
LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
| ^--- help: remove these generics
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
Expand Down Expand Up @@ -81,7 +81,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/invalid_const_in_lifetime_position.rs:4:26
|
LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {}
| ^--- help: remove these generics
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-ui/mismatched_arg_count.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were
--> $DIR/mismatched_arg_count.rs:7:29
|
LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {}
| ^^^^^ -- help: remove this lifetime argument
| ^^^^^ ---- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/argument-suggestions/issue-100154.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp
--> $DIR/issue-100154.rs:4:5
|
LL | foo::<()>(());
| ^^^------ help: remove these generics
| ^^^------ help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
|
LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
| ^^^^^^^^^^^^---- help: remove these generics
| ^^^^^^^^^^^^---- help: remove the unnecessary generics
| |
| expected 0 lifetime arguments
|
Expand Down Expand Up @@ -32,7 +32,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp
--> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59
|
LL | async fn buy_lock(coroutine: &Mutex<MarketMultiplier>) -> LockedMarket<'_> {
| ^^^^^^^^^^^^---- help: remove these generics
| ^^^^^^^^^^^^---- help: remove the unnecessary generics
| |
| expected 0 lifetime arguments
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0107]: trait takes at most 2 generic arguments but 3 generic arguments we
--> $DIR/transmutable-ice-110969.rs:11:14
|
LL | Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME>,
| ^^^^^^^^^^^^^^^^^^^^^ ------ help: remove this generic argument
| ^^^^^^^^^^^^^^^^^^^^^ -------- help: remove the unnecessary generic argument
| |
| expected at most 2 generic arguments

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supp
--> $DIR/infer-arg-test.rs:18:10
|
LL | let a: All<_, _, _>;
| ^^^ - help: remove this generic argument
| ^^^ --- help: remove the unnecessary generic argument
| |
| expected 2 generic arguments
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0107]: function takes 1 generic argument but 2 generic arguments were sup
--> $DIR/issue_114151.rs:17:5
|
LL | foo::<_, L>([(); L + 1 + L]);
| ^^^ - help: remove this generic argument
| ^^^ --- help: remove the unnecessary generic argument
| |
| expected 1 generic argument
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/issue-102768.rs:9:30
|
LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
| ^--- help: remove these generics
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
Expand Down Expand Up @@ -49,7 +49,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/issue-102768.rs:9:30
|
LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
| ^--- help: remove these generics
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
Expand Down Expand Up @@ -81,7 +81,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w
--> $DIR/issue-102768.rs:9:30
|
LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {}
| ^--- help: remove these generics
| ^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ error[E0107]: function takes 2 generic arguments but 3 generic arguments were su
--> $DIR/incorrect-number-of-const-args.rs:9:5
|
LL | foo::<0, 0, 0>();
| ^^^ - help: remove this generic argument
| ^^^ --- help: remove the unnecessary generic argument
| |
| expected 2 generic arguments
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ help: consider moving this generic argument to the `TryInto` trait, which takes
|
LL | let _: u32 = TryInto::<32>::try_into(5i32).unwrap();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: remove these generics
help: remove the unnecessary generics
|
LL - let _: u32 = 5i32.try_into::<32>().unwrap();
LL + let _: u32 = 5i32.try_into().unwrap();
Expand All @@ -27,7 +27,7 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/invalid-const-arg-for-type-param.rs:12:5
|
LL | S::<0>;
| ^----- help: remove these generics
| ^----- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/const-generics/invalid-constant-in-args.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl
--> $DIR/invalid-constant-in-args.rs:4:12
|
LL | let _: Cell<&str, "a"> = Cell::new("");
| ^^^^ --- help: remove this generic argument
| ^^^^ ----- help: remove the unnecessary generic argument
| |
| expected 1 generic argument

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/constructor-lifetime-args.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were su
--> $DIR/constructor-lifetime-args.rs:19:5
|
LL | S::<'static, 'static, 'static>(&0, &0);
| ^ ------- help: remove this lifetime argument
| ^ --------- help: remove the lifetime argument
| |
| expected 2 lifetime arguments
|
Expand Down Expand Up @@ -52,7 +52,7 @@ error[E0107]: enum takes 2 lifetime arguments but 3 lifetime arguments were supp
--> $DIR/constructor-lifetime-args.rs:24:8
|
LL | E::V::<'static, 'static, 'static>(&0);
| ^ ------- help: remove this lifetime argument
| ^ --------- help: remove the lifetime argument
| |
| expected 2 lifetime arguments
|
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/consts/effect_param.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli
--> $DIR/effect_param.rs:11:9
|
LL | i8::checked_sub::<false>(42, 43);
| ^^^^^^^^^^^--------- help: remove these generics
| ^^^^^^^^^^^--------- help: remove the unnecessary generics
| |
| expected 0 generic arguments

error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/effect_param.rs:13:9
|
LL | i8::checked_sub::<true>(42, 43);
| ^^^^^^^^^^^-------- help: remove these generics
| ^^^^^^^^^^^-------- help: remove the unnecessary generics
| |
| expected 0 generic arguments

error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/effect_param.rs:4:9
|
LL | i8::checked_sub::<true>(42, 43);
| ^^^^^^^^^^^-------- help: remove these generics
| ^^^^^^^^^^^-------- help: remove the unnecessary generics
| |
| expected 0 generic arguments

error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/effect_param.rs:6:9
|
LL | i8::checked_sub::<false>(42, 43);
| ^^^^^^^^^^^--------- help: remove these generics
| ^^^^^^^^^^^--------- help: remove the unnecessary generics
| |
| expected 0 generic arguments

Expand Down
16 changes: 8 additions & 8 deletions tests/ui/error-codes/E0107.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,35 @@ struct Baz<'a, 'b, 'c> {

bar: Bar<'a>,
//~^ ERROR enum takes 0 lifetime arguments
//~| HELP remove these generics
//~| HELP remove the unnecessary generics

foo2: Foo<'a, 'b, 'c>,
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove these lifetime arguments
//~| HELP remove the lifetime arguments

qux1: Qux<'a, 'b, i32>,
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove this lifetime argument
//~| HELP remove the lifetime argument

qux2: Qux<'a, i32, 'b>,
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove this lifetime argument
//~| HELP remove the lifetime argument

qux3: Qux<'a, 'b, 'c, i32>,
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove these lifetime arguments
//~| HELP remove the lifetime arguments

qux4: Qux<'a, i32, 'b, 'c>,
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove these lifetime arguments
//~| HELP remove the lifetime arguments

qux5: Qux<'a, 'b, i32, 'c>,
//~^ ERROR struct takes 1 lifetime argument
//~| HELP remove this lifetime argument
//~| HELP remove the lifetime argument

quux: Quux<'a, i32, 'b>,
//~^ ERROR struct takes 0 lifetime arguments
//~| HELP remove this lifetime argument
//~| HELP remove the lifetime argument
}

pub trait T {
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/error-codes/E0107.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was suppli
--> $DIR/E0107.rs:17:10
|
LL | bar: Bar<'a>,
| ^^^---- help: remove these generics
| ^^^---- help: remove the unnecessary generics
| |
| expected 0 lifetime arguments
|
Expand All @@ -34,7 +34,7 @@ error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were sup
--> $DIR/E0107.rs:21:11
|
LL | foo2: Foo<'a, 'b, 'c>,
| ^^^ ------ help: remove these lifetime arguments
| ^^^ -------- help: remove the lifetime arguments
| |
| expected 1 lifetime argument
|
Expand All @@ -48,7 +48,7 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup
--> $DIR/E0107.rs:25:11
|
LL | qux1: Qux<'a, 'b, i32>,
| ^^^ -- help: remove this lifetime argument
| ^^^ ---- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
Expand All @@ -62,7 +62,7 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup
--> $DIR/E0107.rs:29:11
|
LL | qux2: Qux<'a, i32, 'b>,
| ^^^ -- help: remove this lifetime argument
| ^^^ --------- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
Expand All @@ -76,7 +76,7 @@ error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were sup
--> $DIR/E0107.rs:33:11
|
LL | qux3: Qux<'a, 'b, 'c, i32>,
| ^^^ ------ help: remove these lifetime arguments
| ^^^ -------- help: remove the lifetime arguments
| |
| expected 1 lifetime argument
|
Expand All @@ -90,7 +90,7 @@ error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were sup
--> $DIR/E0107.rs:37:11
|
LL | qux4: Qux<'a, i32, 'b, 'c>,
| ^^^ ------ help: remove these lifetime arguments
| ^^^ ------------- help: remove the lifetime arguments
| |
| expected 1 lifetime argument
|
Expand All @@ -104,7 +104,7 @@ error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were sup
--> $DIR/E0107.rs:41:11
|
LL | qux5: Qux<'a, 'b, i32, 'c>,
| ^^^ -- help: remove this lifetime argument
| ^^^ ---- help: remove the lifetime argument
| |
| expected 1 lifetime argument
|
Expand All @@ -118,7 +118,7 @@ error[E0107]: struct takes 0 lifetime arguments but 2 lifetime arguments were su
--> $DIR/E0107.rs:45:11
|
LL | quux: Quux<'a, i32, 'b>,
| ^^^^ -- help: remove this lifetime argument
| ^^^^ -- help: remove the lifetime argument
| |
| expected 0 lifetime arguments
|
Expand Down
Loading