Auto merge of #99745 - JohnTitor:rollup-lvrie64, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #98211 (Implement `fs::get_path` for FreeBSD.) - #99353 (Slightly improve mismatched GAT where clause error) - #99593 (Suggest removing the tuple struct field for the unwrapped value) - #99615 (Remove some explicit `self.infcx` for `FnCtxt`, which already derefs into `InferCtxt`) - #99711 (Remove reachable coverage without counters) - #99718 (Avoid `&str`/`Symbol` to `String` conversions) - #99720 (Sync rustc_codegen_cranelift) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
b629c85bd7
74 changed files with 843 additions and 550 deletions
|
|
@ -1,21 +1,28 @@
|
|||
1| |// Regression test for issue #98833.
|
||||
2| |// compile-flags: -Zinline-mir
|
||||
2| |// compile-flags: -Zinline-mir -Cdebug-assertions=off
|
||||
3| |
|
||||
4| 1|fn main() {
|
||||
5| 1| println!("{}", live::<false>());
|
||||
6| 1|}
|
||||
7| |
|
||||
8| |#[inline]
|
||||
9| 1|fn live<const B: bool>() -> u32 {
|
||||
10| 1| if B {
|
||||
11| 0| dead()
|
||||
12| | } else {
|
||||
13| 1| 0
|
||||
14| | }
|
||||
15| 1|}
|
||||
16| |
|
||||
17| |#[inline]
|
||||
18| 0|fn dead() -> u32 {
|
||||
19| 0| 42
|
||||
20| 0|}
|
||||
6| 1|
|
||||
7| 1| let f = |x: bool| {
|
||||
8| | debug_assert!(
|
||||
9| | x
|
||||
10| | );
|
||||
11| 1| };
|
||||
12| 1| f(false);
|
||||
13| 1|}
|
||||
14| |
|
||||
15| |#[inline]
|
||||
16| 1|fn live<const B: bool>() -> u32 {
|
||||
17| 1| if B {
|
||||
18| 0| dead()
|
||||
19| | } else {
|
||||
20| 1| 0
|
||||
21| | }
|
||||
22| 1|}
|
||||
23| |
|
||||
24| |#[inline]
|
||||
25| 0|fn dead() -> u32 {
|
||||
26| 0| 42
|
||||
27| 0|}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,15 @@
|
|||
// Regression test for issue #98833.
|
||||
// compile-flags: -Zinline-mir
|
||||
// compile-flags: -Zinline-mir -Cdebug-assertions=off
|
||||
|
||||
fn main() {
|
||||
println!("{}", live::<false>());
|
||||
|
||||
let f = |x: bool| {
|
||||
debug_assert!(
|
||||
x
|
||||
);
|
||||
};
|
||||
f(false);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ trait Foo {
|
|||
|
||||
impl<'a> Foo for &'a () {
|
||||
const NAME: &'a str = "unit";
|
||||
//~^ ERROR mismatched types [E0308]
|
||||
//~^ ERROR const not compatible with trait
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0308]: mismatched types
|
||||
error[E0308]: const not compatible with trait
|
||||
--> $DIR/associated-const-impl-wrong-lifetime.rs:7:5
|
||||
|
|
||||
LL | const NAME: &'a str = "unit";
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ LL | type Assoc2<T: std::fmt::Display> = Vec<T>;
|
|||
| +++++++++++++++++++
|
||||
|
||||
error[E0276]: impl has stricter requirements than trait
|
||||
--> $DIR/generic-associated-types-where.rs:22:5
|
||||
--> $DIR/generic-associated-types-where.rs:22:38
|
||||
|
|
||||
LL | type Assoc3<T>;
|
||||
| -------------- definition of `Assoc3` from trait
|
||||
...
|
||||
LL | type Assoc3<T> = Vec<T> where T: Iterator;
|
||||
| ^^^^^^^^^^^^^^ impl has extra requirement `T: Iterator`
|
||||
| ^^^^^^^^ impl has extra requirement `T: Iterator`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ struct Fooy<T>(T);
|
|||
|
||||
impl<T> Foo for Fooy<T> {
|
||||
type A<'a> = (&'a ()) where Self: 'static;
|
||||
//~^ ERROR `impl` associated type
|
||||
//~^ ERROR impl has stricter requirements than trait
|
||||
type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
|
||||
//~^ ERROR `impl` associated type
|
||||
//~^ ERROR impl has stricter requirements than trait
|
||||
//~| ERROR lifetime bound not satisfied
|
||||
type C = String where Self: Copy;
|
||||
//~^ ERROR the trait bound `T: Copy` is not satisfied
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
error: `impl` associated type signature for `A` doesn't match `trait` associated type signature
|
||||
--> $DIR/impl_bounds.rs:15:5
|
||||
error[E0276]: impl has stricter requirements than trait
|
||||
--> $DIR/impl_bounds.rs:15:39
|
||||
|
|
||||
LL | type A<'a> where Self: 'a;
|
||||
| ---------- expected
|
||||
| ---------- definition of `A` from trait
|
||||
...
|
||||
LL | type A<'a> = (&'a ()) where Self: 'static;
|
||||
| ^^^^^^^^^^ found
|
||||
| ^^^^^^^ impl has extra requirement `T: 'static`
|
||||
|
||||
error: `impl` associated type signature for `B` doesn't match `trait` associated type signature
|
||||
--> $DIR/impl_bounds.rs:17:5
|
||||
error[E0276]: impl has stricter requirements than trait
|
||||
--> $DIR/impl_bounds.rs:17:48
|
||||
|
|
||||
LL | type B<'a, 'b> where 'a: 'b;
|
||||
| -------------- expected
|
||||
| -------------- definition of `B` from trait
|
||||
...
|
||||
LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
|
||||
| ^^^^^^^^^^^^^^ found
|
||||
| ^^ impl has extra requirement `'b: 'a`
|
||||
|
||||
error[E0478]: lifetime bound not satisfied
|
||||
--> $DIR/impl_bounds.rs:17:22
|
||||
|
|
@ -37,24 +37,24 @@ LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
|
|||
| ^^
|
||||
|
||||
error[E0277]: the trait bound `T: Copy` is not satisfied
|
||||
--> $DIR/impl_bounds.rs:20:5
|
||||
--> $DIR/impl_bounds.rs:20:33
|
||||
|
|
||||
LL | type C = String where Self: Copy;
|
||||
| ^^^^^^ the trait `Copy` is not implemented for `T`
|
||||
| ^^^^ the trait `Copy` is not implemented for `T`
|
||||
|
|
||||
note: required because of the requirements on the impl of `Copy` for `Fooy<T>`
|
||||
--> $DIR/impl_bounds.rs:11:10
|
||||
|
|
||||
LL | #[derive(Copy, Clone)]
|
||||
| ^^^^
|
||||
note: the requirement `Fooy<T>: Copy` appears on the associated impl type `C` but not on the corresponding associated trait type
|
||||
--> $DIR/impl_bounds.rs:7:5
|
||||
note: the requirement `Fooy<T>: Copy` appears on the `impl`'s associated type `C` but not on the corresponding trait's associated type
|
||||
--> $DIR/impl_bounds.rs:7:10
|
||||
|
|
||||
LL | trait Foo {
|
||||
| --- in this trait
|
||||
...
|
||||
LL | type C where Self: Clone;
|
||||
| ^^^^^^ this trait associated type doesn't have the requirement `Fooy<T>: Copy`
|
||||
| ^ this trait's associated type doesn't have the requirement `Fooy<T>: Copy`
|
||||
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `T`
|
||||
|
|
||||
|
|
@ -72,14 +72,14 @@ note: required because of the requirements on the impl of `Copy` for `Fooy<T>`
|
|||
|
|
||||
LL | #[derive(Copy, Clone)]
|
||||
| ^^^^
|
||||
note: the requirement `Fooy<T>: Copy` appears on the impl method `d` but not on the corresponding trait method
|
||||
note: the requirement `Fooy<T>: Copy` appears on the `impl`'s method `d` but not on the corresponding trait's method
|
||||
--> $DIR/impl_bounds.rs:8:8
|
||||
|
|
||||
LL | trait Foo {
|
||||
| --- in this trait
|
||||
...
|
||||
LL | fn d() where Self: Clone;
|
||||
| ^ this trait method doesn't have the requirement `Fooy<T>: Copy`
|
||||
| ^ this trait's method doesn't have the requirement `Fooy<T>: Copy`
|
||||
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `T`
|
||||
|
|
||||
|
|
@ -88,5 +88,5 @@ LL | impl<T: std::marker::Copy> Foo for Fooy<T> {
|
|||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0478.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
Some errors have detailed explanations: E0276, E0277, E0478.
|
||||
For more information about an error, try `rustc --explain E0276`.
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
error[E0276]: impl has stricter requirements than trait
|
||||
--> $DIR/issue-47206-where-clause.rs:12:5
|
||||
--> $DIR/issue-47206-where-clause.rs:12:38
|
||||
|
|
||||
LL | type Assoc3<T>;
|
||||
| -------------- definition of `Assoc3` from trait
|
||||
...
|
||||
LL | type Assoc3<T> = Vec<T> where T: Iterator;
|
||||
| ^^^^^^^^^^^^^^ impl has extra requirement `T: Iterator`
|
||||
| ^^^^^^^^ impl has extra requirement `T: Iterator`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ trait Foo {
|
|||
}
|
||||
impl Foo for () {
|
||||
type Assoc<'a, 'b> = () where 'a: 'b;
|
||||
//~^ `impl` associated type
|
||||
//~^ impl has stricter requirements than trait
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
error: `impl` associated type signature for `Assoc` doesn't match `trait` associated type signature
|
||||
--> $DIR/missing-where-clause-on-trait.rs:9:5
|
||||
error[E0276]: impl has stricter requirements than trait
|
||||
--> $DIR/missing-where-clause-on-trait.rs:9:39
|
||||
|
|
||||
LL | type Assoc<'a, 'b>;
|
||||
| ------------------ expected
|
||||
| ------------------ definition of `Assoc` from trait
|
||||
...
|
||||
LL | type Assoc<'a, 'b> = () where 'a: 'b;
|
||||
| ^^^^^^^^^^^^^^^^^^ found
|
||||
| ^^ impl has extra requirement `'a: 'b`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0276`.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
// run-rustfix
|
||||
|
||||
macro_rules! my_wrapper {
|
||||
($expr:expr) => { MyWrapper($expr) }
|
||||
}
|
||||
|
||||
pub struct MyWrapper(u32);
|
||||
|
||||
fn main() {
|
||||
let value = MyWrapper(123);
|
||||
some_fn(value); //~ ERROR mismatched types
|
||||
some_fn(my_wrapper!(123)); //~ ERROR mismatched types
|
||||
}
|
||||
|
||||
fn some_fn(wrapped: MyWrapper) {
|
||||
drop(wrapped);
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
// run-rustfix
|
||||
|
||||
macro_rules! my_wrapper {
|
||||
($expr:expr) => { MyWrapper($expr) }
|
||||
}
|
||||
|
||||
pub struct MyWrapper(u32);
|
||||
|
||||
fn main() {
|
||||
let value = MyWrapper(123);
|
||||
some_fn(value.0); //~ ERROR mismatched types
|
||||
some_fn(my_wrapper!(123).0); //~ ERROR mismatched types
|
||||
}
|
||||
|
||||
fn some_fn(wrapped: MyWrapper) {
|
||||
drop(wrapped);
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/suggest-removing-tulpe-struct-field.rs:11:13
|
||||
|
|
||||
LL | some_fn(value.0);
|
||||
| ------- ^^^^^^^ expected struct `MyWrapper`, found `u32`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/suggest-removing-tulpe-struct-field.rs:15:4
|
||||
|
|
||||
LL | fn some_fn(wrapped: MyWrapper) {
|
||||
| ^^^^^^^ ------------------
|
||||
help: consider removing the tuple struct field `0`
|
||||
|
|
||||
LL - some_fn(value.0);
|
||||
LL + some_fn(value);
|
||||
|
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/suggest-removing-tulpe-struct-field.rs:12:13
|
||||
|
|
||||
LL | some_fn(my_wrapper!(123).0);
|
||||
| ------- ^^^^^^^^^^^^^^^^^^ expected struct `MyWrapper`, found `u32`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/suggest-removing-tulpe-struct-field.rs:15:4
|
||||
|
|
||||
LL | fn some_fn(wrapped: MyWrapper) {
|
||||
| ^^^^^^^ ------------------
|
||||
help: consider removing the tuple struct field `0`
|
||||
|
|
||||
LL - some_fn(my_wrapper!(123).0);
|
||||
LL + some_fn(my_wrapper!(123));
|
||||
|
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
@ -19,7 +19,7 @@ struct FailStruct { }
|
|||
|
||||
impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct {
|
||||
const AC: Option<&'c str> = None;
|
||||
//~^ ERROR: mismatched types
|
||||
//~^ ERROR: const not compatible with trait
|
||||
}
|
||||
|
||||
struct OKStruct2 { }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0308]: mismatched types
|
||||
error[E0308]: const not compatible with trait
|
||||
--> $DIR/trait-associated-constant.rs:21:5
|
||||
|
|
||||
LL | const AC: Option<&'c str> = None;
|
||||
|
|
|
|||
|
|
@ -55,12 +55,13 @@ const EXCEPTIONS_CRANELIFT: &[(&str, &str)] = &[
|
|||
("cranelift-codegen-shared", "Apache-2.0 WITH LLVM-exception"),
|
||||
("cranelift-entity", "Apache-2.0 WITH LLVM-exception"),
|
||||
("cranelift-frontend", "Apache-2.0 WITH LLVM-exception"),
|
||||
("cranelift-isle", "Apache-2.0 WITH LLVM-exception"),
|
||||
("cranelift-jit", "Apache-2.0 WITH LLVM-exception"),
|
||||
("cranelift-module", "Apache-2.0 WITH LLVM-exception"),
|
||||
("cranelift-native", "Apache-2.0 WITH LLVM-exception"),
|
||||
("cranelift-object", "Apache-2.0 WITH LLVM-exception"),
|
||||
("mach", "BSD-2-Clause"),
|
||||
("regalloc", "Apache-2.0 WITH LLVM-exception"),
|
||||
("regalloc2", "Apache-2.0 WITH LLVM-exception"),
|
||||
("target-lexicon", "Apache-2.0 WITH LLVM-exception"),
|
||||
];
|
||||
|
||||
|
|
@ -258,10 +259,12 @@ const PERMITTED_DEPENDENCIES: &[&str] = &[
|
|||
];
|
||||
|
||||
const PERMITTED_CRANELIFT_DEPENDENCIES: &[&str] = &[
|
||||
"ahash",
|
||||
"anyhow",
|
||||
"ar",
|
||||
"autocfg",
|
||||
"bitflags",
|
||||
"byteorder",
|
||||
"cfg-if",
|
||||
"cranelift-bforest",
|
||||
"cranelift-codegen",
|
||||
|
|
@ -269,11 +272,14 @@ const PERMITTED_CRANELIFT_DEPENDENCIES: &[&str] = &[
|
|||
"cranelift-codegen-shared",
|
||||
"cranelift-entity",
|
||||
"cranelift-frontend",
|
||||
"cranelift-isle",
|
||||
"cranelift-jit",
|
||||
"cranelift-module",
|
||||
"cranelift-native",
|
||||
"cranelift-object",
|
||||
"crc32fast",
|
||||
"fxhash",
|
||||
"getrandom",
|
||||
"gimli",
|
||||
"hashbrown",
|
||||
"indexmap",
|
||||
|
|
@ -284,11 +290,13 @@ const PERMITTED_CRANELIFT_DEPENDENCIES: &[&str] = &[
|
|||
"memchr",
|
||||
"object",
|
||||
"once_cell",
|
||||
"regalloc",
|
||||
"regalloc2",
|
||||
"region",
|
||||
"rustc-hash",
|
||||
"slice-group-by",
|
||||
"smallvec",
|
||||
"target-lexicon",
|
||||
"version_check",
|
||||
"wasi",
|
||||
"winapi",
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue