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 10 pull requests #83146

Closed
wants to merge 39 commits into from

Conversation

Dylan-DPC-zz
Copy link

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

tmiasko and others added 30 commits March 11, 2021 16:04
…o actual changes in behaviour

This makes `type_alias_impl_trait` not actually do anything anymore
This change makes it easier to follow the control flow.

I also moved the end-of-line comments attached to some symbols to before
the symbol listing. This allows rustfmt to format the code; otherwise no
formatting occurs (see rust-lang/rustfmt#4750).
E.g., `#[doc(123)]`.
"crate level attribute" -> "crate-level attribute"
It seems there are two copies of it: one in `src/test/ui/attributes/`
and one in `src/test/rustdoc-ui/`. I'm guessing this is to test that the
lint is emitted both when you run the compiler and when you run rustdoc.
Found while investigating rust-lang#82933 - all LocalDefIds are expected to have
HirIds, there's no point in pretending otherwise.
Merges `if-let` and `if x.is_some() { ... }` blocks
- Tweak lint message
- Display multi-segment paths correctly
Fixes rust-lang#83112

The location information for a dummy span isn't real, so don't encode
it. This brings the incr comp cache code into line with the Span
`StableHash` impl, which doesn't hash the location information for dummy
spans.

Previously, we would attempt to load the 'original' file from a dummy
span - if the file id changed (e.g. due to being moved on disk), we would get an
ICE, since the Span was still valid due to its hash being unchanged.
Now that future-incompat-report support has landed in nightly Cargo, we
can start to make progress towards removing the various proc-macro
back-compat hacks that have accumulated in the compiler.

This PR introduces a new lint `proc_macro_back_compat`, which results in
a future-incompat-report entry being generated. All proc-macro
back-compat warnings will be grouped under this lint. Note that this
lint will never actually become a hard error - instead, we will remove
the special cases for various macros, which will cause older versions of
those crates to emit some other error.

I've added code to fire this lint for the `time-macros-impl` case. This
is the easiest case out of all of our current back-compat hacks - the
crate was renamed to `time-macros`, so seeing a filename with
`time-macros-impl` guarantees that an older version of the parent `time`
crate is in use.

When Cargo's future-incompat-report feature gets stabilized, affected
users will start to see future-incompat warnings when they build their
crates.
This detects all Java literal types and all single word C data types,
and suggests the corresponding Rust literal type.
Add a `min_type_alias_impl_trait` feature gate

This new feature gate only permits type alias impl trait to be constrained by function and trait method return types. All other possible constraining sites like const/static types, closure return types and binding types are now forbidden and gated under the `type_alias_impl_trait` and `impl_trait_in_bindings` feature gates (which are both marked as incomplete, as they have various ways to ICE the compiler or cause query cycles where they shouldn't).

r? ``@nikomatsakis``

This is best reviewed commit-by-commit
… r=varkor

Custom error on literal names from other languages

This detects all Java literal types and all single word C data types, and suggests the corresponding Rust literal type.
…ange, r=davidtwco

Validate rustc_layout_scalar_valid_range_{start,end} attributes

Fixes rust-lang#82251, fixes rust-lang#82981.
…dtwco

Find more invalid doc attributes

- Lint on `#[doc(123)]`, `#[doc("hello")]`, etc.
- Lint every attribute; e.g., will now report two warnings for `#[doc(foo, bar)]`
- Add hyphen to "crate level"
- Display paths like `#[doc(foo::bar)]` correctly instead of as an empty string
Remove unused `opt_local_def_id_to_hir_id` function

Found while investigating rust-lang#82933 - all LocalDefIds are expected to have
HirIds, there's no point in pretending otherwise.
Fix typos in `library/core/src/ptr/mod.rs` and `library/std/src/sys_common/thread_local_dtor.rs`

adress -> address
…as-schievink

Minor refactoring in try_index_step

Merges `if-let` and `if x.is_some() { ... }` blocks
…petrochenkov

Introduce `proc_macro_back_compat` lint, and emit for `time-macros-impl`

Now that future-incompat-report support has landed in nightly Cargo, we
can start to make progress towards removing the various proc-macro
back-compat hacks that have accumulated in the compiler.

This PR introduces a new lint `proc_macro_back_compat`, which results in
a future-incompat-report entry being generated. All proc-macro
back-compat warnings will be grouped under this lint. Note that this
lint will never actually become a hard error - instead, we will remove
the special cases for various macros, which will cause older versions of
those crates to emit some other error.

I've added code to fire this lint for the `time-macros-impl` case. This
is the easiest case out of all of our current back-compat hacks - the
crate was renamed to `time-macros`, so seeing a filename with
`time-macros-impl` guarantees that an older version of the parent `time`
crate is in use.

When Cargo's future-incompat-report feature gets stabilized, affected
users will start to see future-incompat warnings when they build their
crates.
…stebank

Don't encode file information for span with a dummy location

Fixes rust-lang#83112

The location information for a dummy span isn't real, so don't encode
it. This brings the incr comp cache code into line with the Span
`StableHash` impl, which doesn't hash the location information for dummy
spans.

Previously, we would attempt to load the 'original' file from a dummy
span - if the file id changed (e.g. due to being moved on disk), we would get an
ICE, since the Span was still valid due to its hash being unchanged.
@rustbot rustbot added the rollup A PR which is a rollup label Mar 15, 2021
@Dylan-DPC-zz
Copy link
Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Mar 15, 2021

📌 Commit 6b865da has been approved by Dylan-DPC

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Mar 15, 2021
@bors
Copy link
Contributor

bors commented Mar 15, 2021

⌛ Testing commit 6b865da with merge f11c1b029808850d1bef82d8fe51c09feb3f3ab0...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-nopt failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test [ui] ui/invalid/invalid-rustc_args_required_const-arguments.rs ... ok
test [ui] ui/invalid_crate_type_syntax.rs ... ok
test [ui] ui/invalid/invalid-rustc_legacy_const_generics-arguments.rs ... ok
test [ui] ui/intrinsics/intrinsic-volatile.rs ... ok
test [ui] ui/invalid/invalid_rustc_layout_scalar_valid_range.rs ... ok
test [ui] ui/invalid_dispatch_from_dyn_impls.rs ... ok
test [ui] ui/issues/issue-10291.rs ... ok
test [ui] ui/issues/issue-10401.rs ... ok
test [ui] ui/issues/issue-10398.rs ... ok
---
test [ui (nll)] ui/invalid/invalid-rustc_legacy_const_generics-arguments.rs ... ok
test [ui (nll)] ui/intrinsics/intrinsic-volatile.rs ... ok
test [ui (nll)] ui/intrinsics/intrinsic-atomics-cc.rs ... ok
test [ui (nll)] ui/invalid_crate_type_syntax.rs ... ok
test [ui (nll)] ui/invalid/invalid_rustc_layout_scalar_valid_range.rs ... ok
test [ui (nll)] ui/invalid/invalid-path-in-const.rs ... ok
test [ui (nll)] ui/issues/issue-10291.rs ... ok
test [ui (nll)] ui/invalid_dispatch_from_dyn_impls.rs ... ok
test [ui (nll)] ui/issues/issue-10401.rs ... ok
---
test [ui (nll)] ui/wrong-hashset-issue-42918.rs ... ok

failures:

---- [ui (nll)] ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs#full_tait stdout ----

28            found opaque type `impl Sized`
29 
29 
30 error[E0310]: the parameter type `T` may not live long enough
-   --> $DIR/generic_type_does_not_live_long_enough.rs:12:24
32    |
32    |
- LL | type WrongGeneric<T> = impl 'static;
-    |                        ^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
- ...
36 LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
-    |                  - help: consider adding an explicit lifetime bound...: `T: 'static`
+    |
+    |
+    = help: consider adding an explicit lifetime bound `T: 'static`...
38 
39 error[E0310]: the parameter type `T` may not live long enough


The actual stderr differed from the expected stderr.
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.full_tait.nll/generic_type_does_not_live_long_enough.full_tait.nll.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args type-alias-impl-trait/generic_type_does_not_live_long_enough.rs`

error in revision `full_tait`: 1 errors occurred comparing output.
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "full_tait" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.full_tait.nll" "-Zborrowck=mir" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.full_tait.nll/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error: at least one trait must be specified
  --> /checkout/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs:12:24
   |
LL | type WrongGeneric<T> = impl 'static;


warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
   |
   |
LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
   |
   = note: `#[warn(incomplete_features)]` on by default
   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information


error[E0308]: mismatched types
  --> /checkout/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs:9:18
   |
LL |     let z: i32 = x; //~ ERROR mismatched types
   |            ---   ^ expected `i32`, found opaque type
   |            expected due to this
...
...
LL | type WrongGeneric<T> = impl 'static;
   |                        ------------ the found opaque type
   = note:     expected type `i32`
           found opaque type `impl Sized`


error[E0310]: the parameter type `T` may not live long enough
   |
   |
LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
   |
   |
   = help: consider adding an explicit lifetime bound `T: 'static`...

error[E0310]: the parameter type `T` may not live long enough
   |
   |
LL | type WrongGeneric<T> = impl 'static;
   |
   |
   = help: consider adding an explicit lifetime bound `T: 'static`...
   = note: ...so that the type `T` will meet its required lifetime bounds
error: aborting due to 4 previous errors; 1 warning emitted

Some errors have detailed explanations: E0308, E0310.
For more information about an error, try `rustc --explain E0308`.
For more information about an error, try `rustc --explain E0308`.

------------------------------------------


---- [ui (nll)] ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs#min_tait stdout ----

19            found opaque type `impl Sized`
20 
20 
21 error[E0310]: the parameter type `T` may not live long enough
-   --> $DIR/generic_type_does_not_live_long_enough.rs:12:24
23    |
23    |
- LL | type WrongGeneric<T> = impl 'static;
-    |                        ^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
- ...
27 LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
-    |                  - help: consider adding an explicit lifetime bound...: `T: 'static`
+    |
+    |
+    = help: consider adding an explicit lifetime bound `T: 'static`...
29 
30 error[E0310]: the parameter type `T` may not live long enough


The actual stderr differed from the expected stderr.
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.min_tait.nll/generic_type_does_not_live_long_enough.min_tait.nll.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args type-alias-impl-trait/generic_type_does_not_live_long_enough.rs`

error in revision `min_tait`: 1 errors occurred comparing output.
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "min_tait" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.min_tait.nll" "-Zborrowck=mir" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.min_tait.nll/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error: at least one trait must be specified
  --> /checkout/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs:12:24
   |
LL | type WrongGeneric<T> = impl 'static;

error[E0308]: mismatched types
  --> /checkout/src/test/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs:9:18
   |
   |
LL |     let z: i32 = x; //~ ERROR mismatched types
   |            ---   ^ expected `i32`, found opaque type
   |            expected due to this
...
...
LL | type WrongGeneric<T> = impl 'static;
   |                        ------------ the found opaque type
   = note:     expected type `i32`
           found opaque type `impl Sized`


error[E0310]: the parameter type `T` may not live long enough
   |
   |
LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
   |
   |
   = help: consider adding an explicit lifetime bound `T: 'static`...

error[E0310]: the parameter type `T` may not live long enough
   |
   |
LL | type WrongGeneric<T> = impl 'static;
   |
   |
   = help: consider adding an explicit lifetime bound `T: 'static`...
   = note: ...so that the type `T` will meet its required lifetime bounds
error: aborting due to 4 previous errors

Some errors have detailed explanations: E0308, E0310.
For more information about an error, try `rustc --explain E0308`.
For more information about an error, try `rustc --explain E0308`.

------------------------------------------


---- [ui (nll)] ui/type-alias-impl-trait/issue-57611-trait-alias.rs#full_tait stdout ----

7    = note: `#[warn(incomplete_features)]` on by default
8    = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
9 
9 
- error: implementation of `FnOnce` is not general enough
-   --> $DIR/issue-57611-trait-alias.rs:20:16
+ error: higher-ranked subtype error
12    |
12    |
- LL |     type Bar = impl Baz<Self, Self>;
-    |                ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
-    |
-    = note: closure with signature `fn(&'2 X) -> &X` must implement `FnOnce<(&'1 X,)>`, for any lifetime `'1`...
-    = note: ...but it actually implements `FnOnce<(&'2 X,)>`, for some specific lifetime `'2`
+ LL |         |x| x
18 
- error[E0308]: mismatched types
-   --> $DIR/issue-57611-trait-alias.rs:20:16
-    |
-    |
- LL |     type Bar = impl Baz<Self, Self>;
-    |                ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
-    |
-    = note: expected type `for<'r> Fn<(&'r X,)>`
-               found type `Fn<(&'<empty> X,)>`
- note: this closure does not fulfill the lifetime requirements
+ error: higher-ranked subtype error
29    |
30 LL |         |x| x

31    |         ^^^^^
31    |         ^^^^^
32 
- error: implementation of `FnOnce` is not general enough
-   --> $DIR/issue-57611-trait-alias.rs:20:16
-    |
- LL |     type Bar = impl Baz<Self, Self>;
-    |                ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
-    |
-    = note: closure with signature `fn(&'2 X) -> &'2 X` must implement `FnOnce<(&'1 X,)>`, for any lifetime `'1`...
-    = note: ...but it actually implements `FnOnce<(&'2 X,)>`, for some specific lifetime `'2`
42 error[E0308]: mismatched types
43   --> $DIR/issue-57611-trait-alias.rs:20:16
44    |


46    |                ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
47    |
48    = note: expected type `for<'r> Fn<(&'r X,)>`
-               found type `Fn<(&'<empty> X,)>`
+               found type `Fn<(&'static X,)>`
50 note: this closure does not fulfill the lifetime requirements
52    |


59 LL |     type Bar = impl Baz<Self, Self>;
60    |                ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
61    |
-    = note: closure with signature `fn(&'2 X) -> &'2 X` must implement `FnOnce<(&'1 X,)>`, for any lifetime `'1`...
-    = note: ...but it actually implements `FnOnce<(&'2 X,)>`, for some specific lifetime `'2`
+    = note: closure with signature `fn(&'static X) -> &'static X` must implement `FnOnce<(&'0 X,)>`, for any lifetime `'0`...
+    = note: ...but it actually implements `FnOnce<(&'static X,)>`
- error: aborting due to 5 previous errors; 1 warning emitted
+ error: aborting due to 4 previous errors; 1 warning emitted
66 
67 For more information about this error, try `rustc --explain E0308`.
67 For more information about this error, try `rustc --explain E0308`.
68 


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type-alias-impl-trait/issue-57611-trait-alias.full_tait.nll/issue-57611-trait-alias.full_tait.nll.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args type-alias-impl-trait/issue-57611-trait-alias.rs`

error in revision `full_tait`: 1 errors occurred comparing output.
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "full_tait" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type-alias-impl-trait/issue-57611-trait-alias.full_tait.nll" "-Zborrowck=mir" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type-alias-impl-trait/issue-57611-trait-alias.full_tait.nll/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
   |
   |
LL | #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
   |
   = note: `#[warn(incomplete_features)]` on by default
   = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information


error: higher-ranked subtype error
  --> /checkout/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs:28:9
   |
LL |         |x| x
   |         ^^^^^

Some tests failed in compiletest suite=ui compare_mode=Nll mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
error: higher-ranked subtype error
   |
LL |         |x| x
   |         ^^^^^


error[E0308]: mismatched types
  --> /checkout/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs:20:16
   |
LL |     type Bar = impl Baz<Self, Self>;
   |                ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
   |
   = note: expected type `for<'r> Fn<(&'r X,)>`
              found type `Fn<(&'static X,)>`
note: this closure does not fulfill the lifetime requirements
   |
LL |         |x| x
   |         ^^^^^


error: implementation of `FnOnce` is not general enough
   |
   |
LL |     type Bar = impl Baz<Self, Self>;
   |                ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
   |
   = note: closure with signature `fn(&'static X) -> &'static X` must implement `FnOnce<(&'0 X,)>`, for any lifetime `'0`...
   = note: ...but it actually implements `FnOnce<(&'static X,)>`
error: aborting due to 4 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0308`.


------------------------------------------


---- [ui (nll)] ui/type-alias-impl-trait/issue-57611-trait-alias.rs#min_tait stdout ----


- error: implementation of `FnOnce` is not general enough
-   --> $DIR/issue-57611-trait-alias.rs:20:16
+ error: higher-ranked subtype error
3    |
3    |
- LL |     type Bar = impl Baz<Self, Self>;
-    |                ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
-    |
-    = note: closure with signature `fn(&'2 X) -> &X` must implement `FnOnce<(&'1 X,)>`, for any lifetime `'1`...
-    = note: ...but it actually implements `FnOnce<(&'2 X,)>`, for some specific lifetime `'2`
+ LL |         |x| x
9 
- error[E0308]: mismatched types
-   --> $DIR/issue-57611-trait-alias.rs:20:16
-    |
-    |
- LL |     type Bar = impl Baz<Self, Self>;
-    |                ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
-    |
-    = note: expected type `for<'r> Fn<(&'r X,)>`
-               found type `Fn<(&'<empty> X,)>`
- note: this closure does not fulfill the lifetime requirements
+ error: higher-ranked subtype error
20    |
21 LL |         |x| x

22    |         ^^^^^
22    |         ^^^^^
23 
- error: implementation of `FnOnce` is not general enough
-   --> $DIR/issue-57611-trait-alias.rs:20:16
-    |
- LL |     type Bar = impl Baz<Self, Self>;
-    |                ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
-    |
-    = note: closure with signature `fn(&'2 X) -> &'2 X` must implement `FnOnce<(&'1 X,)>`, for any lifetime `'1`...
-    = note: ...but it actually implements `FnOnce<(&'2 X,)>`, for some specific lifetime `'2`
33 error[E0308]: mismatched types
34   --> $DIR/issue-57611-trait-alias.rs:20:16
35    |


37    |                ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
38    |
39    = note: expected type `for<'r> Fn<(&'r X,)>`
-               found type `Fn<(&'<empty> X,)>`
+               found type `Fn<(&'static X,)>`
41 note: this closure does not fulfill the lifetime requirements
43    |


50 LL |     type Bar = impl Baz<Self, Self>;
51    |                ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
52    |
-    = note: closure with signature `fn(&'2 X) -> &'2 X` must implement `FnOnce<(&'1 X,)>`, for any lifetime `'1`...
-    = note: ...but it actually implements `FnOnce<(&'2 X,)>`, for some specific lifetime `'2`
+    = note: closure with signature `fn(&'static X) -> &'static X` must implement `FnOnce<(&'0 X,)>`, for any lifetime `'0`...
+    = note: ...but it actually implements `FnOnce<(&'static X,)>`
- error: aborting due to 5 previous errors
+ error: aborting due to 4 previous errors
57 
58 For more information about this error, try `rustc --explain E0308`.
58 For more information about this error, try `rustc --explain E0308`.
59 


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type-alias-impl-trait/issue-57611-trait-alias.min_tait.nll/issue-57611-trait-alias.min_tait.nll.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args type-alias-impl-trait/issue-57611-trait-alias.rs`

error in revision `min_tait`: 1 errors occurred comparing output.
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "min_tait" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type-alias-impl-trait/issue-57611-trait-alias.min_tait.nll" "-Zborrowck=mir" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/type-alias-impl-trait/issue-57611-trait-alias.min_tait.nll/auxiliary"
------------------------------------------

------------------------------------------
stderr:
---

error[E0308]: mismatched types
  --> /checkout/src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.rs:20:16
   |
LL |     type Bar = impl Baz<Self, Self>;
   |                ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
   |
   = note: expected type `for<'r> Fn<(&'r X,)>`
              found type `Fn<(&'static X,)>`
note: this closure does not fulfill the lifetime requirements
   |
LL |         |x| x
   |         ^^^^^


error: implementation of `FnOnce` is not general enough
   |
   |
LL |     type Bar = impl Baz<Self, Self>;
   |                ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
   |
   = note: closure with signature `fn(&'static X) -> &'static X` must implement `FnOnce<(&'0 X,)>`, for any lifetime `'0`...
   = note: ...but it actually implements `FnOnce<(&'static X,)>`
error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0308`.

---
test result: FAILED. 11551 passed; 4 failed; 124 ignored; 0 measured; 0 filtered out; finished in 101.93s



command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "ui" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--host-rustcflags" "-Crpath -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python3" "--lldb-python" "/usr/bin/python3" "--gdb" "/usr/bin/gdb" "--llvm-version" "12.0.0-rust-1.52.0-nightly" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker engine executionengine extensions filecheck frontendopenacc frontendopenmp fuzzmutate globalisel hellonew hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interfacestub interpreter ipo irreader jitlink libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit orcshared orctargetprocess passes powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info xray" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always" "--compare-mode" "nll"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test
Build completed unsuccessfully in 0:21:47

@bors
Copy link
Contributor

bors commented Mar 15, 2021

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 15, 2021
@Dylan-DPC-zz Dylan-DPC-zz deleted the rollup-fvzxvs4 branch March 15, 2021 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.