Rollup merge of #99911 - cjgillot:no-guess, r=davidtwco

Remove some uses of `guess_head_span`

That function cuts a span at the first occurrence of `{`.  Using `def_span` is almost always more precise.
This commit is contained in:
Matthias Krüger 2022-08-01 16:49:31 +02:00 committed by GitHub
commit 8db3d7cfb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 97 additions and 114 deletions

View file

@ -35,7 +35,7 @@ note: cycle used when checking item types in top-level module
--> $DIR/no-const-async.rs:4:1
|
LL | pub const async fn x() {}
| ^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -2,18 +2,18 @@ error[E0391]: cycle detected when evaluating type-level constant
--> $DIR/issue-44415.rs:6:17
|
LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
| ^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: ...which requires const-evaluating + checking `Foo::bytes::{constant#0}`...
--> $DIR/issue-44415.rs:6:17
|
LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
| ^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `Foo::bytes::{constant#0}`...
--> $DIR/issue-44415.rs:6:17
|
LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
| ^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which requires computing layout of `Foo`...
= note: ...which requires computing layout of `[u8; _]`...
= note: ...which requires normalizing `[u8; _]`...

View file

@ -8,8 +8,13 @@ LL | trait Foo<X = Box<dyn Foo>> {
note: cycle used when collecting item types in top-level module
--> $DIR/cycle-trait-default-type-trait.rs:4:1
|
LL | trait Foo<X = Box<dyn Foo>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | / trait Foo<X = Box<dyn Foo>> {
LL | |
LL | |
LL | | }
LL | |
LL | | fn main() { }
| |_____________^
error[E0391]: cycle detected when computing type of `Foo::X`
--> $DIR/cycle-trait-default-type-trait.rs:4:23
@ -21,8 +26,13 @@ LL | trait Foo<X = Box<dyn Foo>> {
note: cycle used when collecting item types in top-level module
--> $DIR/cycle-trait-default-type-trait.rs:4:1
|
LL | trait Foo<X = Box<dyn Foo>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | / trait Foo<X = Box<dyn Foo>> {
LL | |
LL | |
LL | | }
LL | |
LL | | fn main() { }
| |_____________^
error: aborting due to 2 previous errors

View file

@ -13,8 +13,10 @@ LL | trait Chromosome: Chromosome {
note: cycle used when collecting item types in top-level module
--> $DIR/cycle-trait-supertrait-direct.rs:3:1
|
LL | trait Chromosome: Chromosome {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | / trait Chromosome: Chromosome {
LL | |
LL | | }
| |_^
error: aborting due to previous error

View file

@ -4,12 +4,10 @@ warning: function cannot return without recursing
LL | / fn no_hrtb<'b, T>(mut t: T)
LL | | where
LL | | T: Bar<&'b isize>,
LL | | {
... |
LL | | no_hrtb(&mut t);
| | --------------- recursive call site
LL | | }
| |_^ cannot return without recursing
| |______________________^ cannot return without recursing
...
LL | no_hrtb(&mut t);
| --------------- recursive call site
|
= note: `#[warn(unconditional_recursion)]` on by default
= help: a `loop` may express intention better if this is on purpose
@ -20,12 +18,10 @@ warning: function cannot return without recursing
LL | / fn bar_hrtb<T>(mut t: T)
LL | | where
LL | | T: for<'b> Bar<&'b isize>,
LL | | {
... |
LL | | bar_hrtb(&mut t);
| | ---------------- recursive call site
LL | | }
| |_^ cannot return without recursing
| |______________________________^ cannot return without recursing
...
LL | bar_hrtb(&mut t);
| ---------------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
@ -35,14 +31,10 @@ warning: function cannot return without recursing
LL | / fn foo_hrtb_bar_not<'b, T>(mut t: T)
LL | | where
LL | | T: for<'a> Foo<&'a isize> + Bar<&'b isize>,
LL | | {
... |
LL | | foo_hrtb_bar_not(&mut t);
| | ------------------------ recursive call site
LL | |
LL | |
LL | | }
| |_^ cannot return without recursing
| |_______________________________________________^ cannot return without recursing
...
LL | foo_hrtb_bar_not(&mut t);
| ------------------------ recursive call site
|
= help: a `loop` may express intention better if this is on purpose
@ -70,12 +62,10 @@ warning: function cannot return without recursing
LL | / fn foo_hrtb_bar_hrtb<T>(mut t: T)
LL | | where
LL | | T: for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>,
LL | | {
LL | | // OK -- now we have `T : for<'b> Bar<&'b isize>`.
LL | | foo_hrtb_bar_hrtb(&mut t);
| | ------------------------- recursive call site
LL | | }
| |_^ cannot return without recursing
| |_______________________________________________________^ cannot return without recursing
...
LL | foo_hrtb_bar_hrtb(&mut t);
| ------------------------- recursive call site
|
= help: a `loop` may express intention better if this is on purpose

View file

@ -23,8 +23,10 @@ LL | trait T2 : T1 {
note: cycle used when collecting item types in top-level module
--> $DIR/issue-12511.rs:1:1
|
LL | trait T1 : T2 {
| ^^^^^^^^^^^^^
LL | / trait T1 : T2 {
LL | |
LL | | }
| |_^
error: aborting due to previous error

View file

@ -1,8 +1,8 @@
warning: unreachable `pub` item
--> $DIR/unreachable_pub.rs:8:5
--> $DIR/unreachable_pub.rs:8:13
|
LL | pub use std::fmt;
| ---^^^^^^^^^^^^^^
| --- ^^^^^^^^
| |
| help: consider restricting its visibility: `pub(crate)`
|
@ -93,7 +93,7 @@ warning: unreachable `pub` item
--> $DIR/unreachable_pub.rs:33:5
|
LL | pub const CARBON: usize = 1;
| ---^^^^^^^^^^^^^^^^^^^^^^^^^
| ---^^^^^^^^^^^^^^^^^^^^
| |
| help: consider restricting its visibility: `pub(crate)`
|
@ -103,7 +103,7 @@ warning: unreachable `pub` item
--> $DIR/unreachable_pub.rs:34:5
|
LL | pub static NITROGEN: usize = 2;
| ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ---^^^^^^^^^^^^^^^^^^^^^^^
| |
| help: consider restricting its visibility: `pub(crate)`
|
@ -113,7 +113,7 @@ warning: unreachable `pub` item
--> $DIR/unreachable_pub.rs:35:5
|
LL | pub type Oxygen = bool;
| ---^^^^^^^^^^^^^^^^^^^^
| ---^^^^^^^^^^^^
| |
| help: consider restricting its visibility: `pub(crate)`
|
@ -123,7 +123,7 @@ warning: unreachable `pub` item
--> $DIR/unreachable_pub.rs:38:47
|
LL | ($visibility: vis, $name: ident) => { $visibility struct $name {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | define_empty_struct_with_visibility!(pub, Fluorine);
| ---------------------------------------------------
@ -138,7 +138,7 @@ warning: unreachable `pub` item
--> $DIR/unreachable_pub.rs:44:9
|
LL | pub fn catalyze() -> bool;
| ---^^^^^^^^^^^^^^^^^^^^^^^
| ---^^^^^^^^^^^^^^^^^^^^^^
| |
| help: consider restricting its visibility: `pub(crate)`
|

View file

@ -8,8 +8,14 @@ LL | impl dyn ToNbt<Self> {}
note: cycle used when collecting item types in top-level module
--> $DIR/issue-23305.rs:1:1
|
LL | pub trait ToNbt<T> {
| ^^^^^^^^^^^^^^^^^^
LL | / pub trait ToNbt<T> {
LL | | fn new(val: T) -> Self;
LL | | }
LL | |
... |
LL | |
LL | | fn main() {}
| |____________^
error: aborting due to previous error

View file

@ -4,11 +4,10 @@ warning: function cannot return without recursing
LL | / fn recurse<T>(elements: T) -> Vec<char>
LL | | where
LL | | T: Iterator<Item = ()>,
LL | | {
LL | | recurse(IteratorOfWrapped(elements).map(|t| t.0))
| | ------------------------------------------------- recursive call site
LL | | }
| |_^ cannot return without recursing
| |___________________________^ cannot return without recursing
LL | {
LL | recurse(IteratorOfWrapped(elements).map(|t| t.0))
| ------------------------------------------------- recursive call site
|
= note: `#[warn(unconditional_recursion)]` on by default
= help: a `loop` may express intention better if this is on purpose

View file

@ -14,7 +14,7 @@ note: cycle used when collecting item types in top-level module
--> $DIR/cyclic-trait-resolution.rs:1:1
|
LL | trait A: B + A {}
| ^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -2,18 +2,18 @@ error[E0391]: cycle detected when simplifying constant for the type system `Alph
--> $DIR/self-in-enum-definition.rs:5:10
|
LL | V3 = Self::V1 {} as u8 + 2,
| ^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^
|
note: ...which requires simplifying constant for the type system `Alpha::V3::{constant#0}`...
--> $DIR/self-in-enum-definition.rs:5:10
|
LL | V3 = Self::V1 {} as u8 + 2,
| ^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `Alpha::V3::{constant#0}`...
--> $DIR/self-in-enum-definition.rs:5:10
|
LL | V3 = Self::V1 {} as u8 + 2,
| ^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^
= note: ...which requires computing layout of `Alpha`...
= note: ...which again requires simplifying constant for the type system `Alpha::V3::{constant#0}`, completing the cycle
note: cycle used when collecting item types in top-level module