convert_variant_ctor(tcx, struct_def.id());
}
},
- hir::ItemExistential(..) |
+ hir::ItemExistential(..) => {}
hir::ItemTy(..) | hir::ItemStatic(..) | hir::ItemConst(..) | hir::ItemFn(..) => {
tcx.generics_of(def_id);
tcx.type_of(def_id);
ItemExistential(hir::ExistTy { impl_trait_fn: None, .. }) => unimplemented!(),
// existential types desugared from impl Trait
ItemExistential(hir::ExistTy { impl_trait_fn: Some(owner), .. }) => {
- tcx.typeck_tables_of(owner).concrete_existential_types
- .get(&def_id)
- .cloned()
- .unwrap_or_else(|| {
- // This can occur if some error in the
- // owner fn prevented us from populating
- // the `concrete_existential_types` table.
- tcx.sess.delay_span_bug(
- DUMMY_SP,
- &format!(
- "owner {:?} has no existential type for {:?} in its tables",
- owner,
- def_id,
- ),
- );
-
- tcx.types.err
- })
+ tcx.typeck_tables_of(owner).concrete_existential_types[&def_id]
},
ItemTrait(..) | ItemTraitAlias(..) |
ItemMod(..) |
-> Box<for<'a> Id<impl Lt<'a>>>
//~^ ERROR `impl Trait` can only capture lifetimes bound at the fn or impl level [E0657]
{
- () //~ ERROR mismatched types
+ Box::new(())
}
struct Foo;
-> Box<for<'a> Id<impl Lt<'a>>>
//~^ ERROR `impl Trait` can only capture lifetimes bound at the fn or impl level
{
- () //~ ERROR mismatched types
+ Box::new(())
}
}
LL | -> Box<for<'a> Id<impl Lt<'a>>>
| ^^
-error[E0308]: mismatched types
- --> $DIR/E0657.rs:22:5
- |
-LL | () //~ ERROR mismatched types
- | ^^ expected struct `std::boxed::Box`, found ()
- |
- = note: expected type `std::boxed::Box<(dyn Id<_> + 'static)>`
- found type `()`
-
-error[E0308]: mismatched types
- --> $DIR/E0657.rs:31:9
- |
-LL | () //~ ERROR mismatched types
- | ^^ expected struct `std::boxed::Box`, found ()
- |
- = note: expected type `std::boxed::Box<(dyn Id<_> + 'static)>`
- found type `()`
-
-error: aborting due to 4 previous errors
+error: aborting due to 2 previous errors
-Some errors occurred: E0308, E0657.
-For more information about an error, try `rustc --explain E0308`.
+For more information about this error, try `rustc --explain E0657`.
// return type, which can't depend on the obligation.
fn cycle1() -> impl Clone {
//~^ ERROR cycle detected
- //~| ERROR cycle detected
send(cycle2().clone());
- //~^ ERROR `std::rc::Rc<std::string::String>` cannot be sent between threads safely
Rc::new(Cell::new(5))
}
-error[E0391]: cycle detected when processing `cycle1::{{exist-impl-Trait}}`
- --> $DIR/auto-trait-leak.rs:24:16
- |
-LL | fn cycle1() -> impl Clone {
- | ^^^^^^^^^^
- |
-note: ...which requires processing `cycle1`...
+error[E0391]: cycle detected when processing `cycle1`
--> $DIR/auto-trait-leak.rs:24:1
|
LL | fn cycle1() -> impl Clone {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
note: ...which requires processing `cycle2::{{exist-impl-Trait}}`...
- --> $DIR/auto-trait-leak.rs:33:16
+ --> $DIR/auto-trait-leak.rs:31:16
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^^^^^
note: ...which requires processing `cycle2`...
- --> $DIR/auto-trait-leak.rs:33:1
+ --> $DIR/auto-trait-leak.rs:31:1
|
LL | fn cycle2() -> impl Clone {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
- = note: ...which again requires processing `cycle1::{{exist-impl-Trait}}`, completing the cycle
-
-error[E0391]: cycle detected when processing `cycle1::{{exist-impl-Trait}}`
+note: ...which requires processing `cycle1::{{exist-impl-Trait}}`...
--> $DIR/auto-trait-leak.rs:24:16
|
LL | fn cycle1() -> impl Clone {
| ^^^^^^^^^^
- |
-note: ...which requires processing `cycle1`...
- --> $DIR/auto-trait-leak.rs:24:1
- |
-LL | fn cycle1() -> impl Clone {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
-note: ...which requires processing `cycle2::{{exist-impl-Trait}}`...
- --> $DIR/auto-trait-leak.rs:33:16
- |
-LL | fn cycle2() -> impl Clone {
- | ^^^^^^^^^^
-note: ...which requires processing `cycle2`...
- --> $DIR/auto-trait-leak.rs:33:1
- |
-LL | fn cycle2() -> impl Clone {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: ...which again requires processing `cycle1::{{exist-impl-Trait}}`, completing the cycle
-
-error[E0277]: `std::rc::Rc<std::string::String>` cannot be sent between threads safely
- --> $DIR/auto-trait-leak.rs:27:5
- |
-LL | send(cycle2().clone());
- | ^^^^ `std::rc::Rc<std::string::String>` cannot be sent between threads safely
- |
- = help: within `impl std::clone::Clone`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::string::String>`
- = note: required because it appears within the type `impl std::clone::Clone`
-note: required by `send`
- --> $DIR/auto-trait-leak.rs:16:1
- |
-LL | fn send<T: Send>(_: T) {}
- | ^^^^^^^^^^^^^^^^^^^^^^
+ = note: ...which again requires processing `cycle1`, completing the cycle
+note: cycle used when type-checking all item bodies
-error: aborting due to 3 previous errors
+error: aborting due to previous error
-Some errors occurred: E0277, E0391.
-For more information about an error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0391`.
fn projection_with_named_trait_inside_path_is_disallowed()
-> <::std::ops::Range<impl Debug> as Iterator>::Item
//~^ ERROR `impl Trait` is not allowed in path parameters
-//~| ERROR trait bound `impl std::fmt::Debug: std::iter::Step` is not satisfied
-{ //~ ERROR trait bound `impl std::fmt::Debug: std::iter::Step` is not satisfied
- (1i32..100).next().unwrap() //~ ERROR mismatched types
+{
+ (1i32..100).next().unwrap()
}
fn projection_from_impl_trait_inside_dyn_trait_is_disallowed()
| ^^^^^^^^^^
error[E0667]: `impl Trait` is not allowed in path parameters
- --> $DIR/impl_trait_projections.rs:43:29
+ --> $DIR/impl_trait_projections.rs:42:29
|
LL | -> <dyn Iterator<Item = impl Debug> as Iterator>::Item
| ^^^^^^^^^^
|
= note: specify the type using the syntax `<impl std::iter::Iterator as Trait>::Item`
-error[E0277]: the trait bound `impl std::fmt::Debug: std::iter::Step` is not satisfied
- --> $DIR/impl_trait_projections.rs:38:1
- |
-LL | / { //~ ERROR trait bound `impl std::fmt::Debug: std::iter::Step` is not satisfied
-LL | | (1i32..100).next().unwrap() //~ ERROR mismatched types
-LL | | }
- | |_^ the trait `std::iter::Step` is not implemented for `impl std::fmt::Debug`
- |
- = note: required because of the requirements on the impl of `std::iter::Iterator` for `std::ops::Range<impl std::fmt::Debug>`
-
-error[E0308]: mismatched types
- --> $DIR/impl_trait_projections.rs:39:5
- |
-LL | (1i32..100).next().unwrap() //~ ERROR mismatched types
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected anonymized type, found i32
- |
- = note: expected type `impl std::fmt::Debug`
- found type `i32`
-
-error[E0277]: the trait bound `impl std::fmt::Debug: std::iter::Step` is not satisfied
- --> $DIR/impl_trait_projections.rs:35:8
- |
-LL | -> <::std::ops::Range<impl Debug> as Iterator>::Item
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::iter::Step` is not implemented for `impl std::fmt::Debug`
- |
- = note: required because of the requirements on the impl of `std::iter::Iterator` for `std::ops::Range<impl std::fmt::Debug>`
-
-error: aborting due to 8 previous errors
+error: aborting due to 5 previous errors
-Some errors occurred: E0223, E0277, E0308, E0667.
+Some errors occurred: E0223, E0667.
For more information about an error, try `rustc --explain E0223`.