Skip to content

ICE -Zsave-analysis feature-gate-associated_type_bounds.rs #69415

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

rustc src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs -Zsave-analysis

#![feature(untagged_unions)]

trait Tr1 { type As1: Copy; }
trait Tr2 { type As2: Copy; }

struct S1;
#[derive(Copy, Clone)]
struct S2;
impl Tr1 for S1 { type As1 = S2; }

trait _Tr3 {
    type A: Iterator<Item: Copy>;
    //~^ ERROR associated type bounds are unstable

    type B: Iterator<Item: 'static>;
    //~^ ERROR associated type bounds are unstable
}

struct _St1<T: Tr1<As1: Tr2>> {
//~^ ERROR associated type bounds are unstable
    outest: T,
    outer: T::As1,
    inner: <T::As1 as Tr2>::As2,
}

enum _En1<T: Tr1<As1: Tr2>> {
//~^ ERROR associated type bounds are unstable
    Outest(T),
    Outer(T::As1),
    Inner(<T::As1 as Tr2>::As2),
}

union _Un1<T: Tr1<As1: Tr2>> {
//~^ ERROR associated type bounds are unstable
    outest: std::mem::ManuallyDrop<T>,
    outer: T::As1,
    inner: <T::As1 as Tr2>::As2,
}

type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
//~^ ERROR associated type bounds are unstable

fn _apit(_: impl Tr1<As1: Copy>) {}
//~^ ERROR associated type bounds are unstable
fn _apit_dyn(_: &dyn Tr1<As1: Copy>) {}
//~^ ERROR associated type bounds are unstable

fn _rpit() -> impl Tr1<As1: Copy> { S1 }
//~^ ERROR associated type bounds are unstable

fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
//~^ ERROR associated type bounds are unstable

const _cdef: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable
//~| ERROR `impl Trait` not allowed outside of function and inherent method return types [E0562]
// FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
// const _cdef_dyn: &dyn Tr1<As1: Copy> = &S1;

static _sdef: impl Tr1<As1: Copy> = S1;
//~^ ERROR associated type bounds are unstable
//~| ERROR `impl Trait` not allowed outside of function and inherent method return types [E0562]
// FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
// static _sdef_dyn: &dyn Tr1<As1: Copy> = &S1;

fn main() {
    let _: impl Tr1<As1: Copy> = S1;
    //~^ ERROR associated type bounds are unstable
    //~| ERROR `impl Trait` not allowed outside of function and inherent method return types [E0562]
    // FIXME: uncomment when `impl_trait_in_bindings` feature is fixed.
    // let _: &dyn Tr1<As1: Copy> = &S1;
}

Meta

rustc --version --verbose:

rustc 1.43.0-nightly (436494b8f 2020-02-22)
binary: rustc
commit-hash: 436494b8f8008b600d64b3951f63c2bb0ea81673
commit-date: 2020-02-22
host: x86_64-unknown-linux-gnu
release: 1.43.0-nightly
LLVM version: 9.0

Error output

error[E0658]: associated type bounds are unstable
  --> src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs:12:22
   |
12 |     type A: Iterator<Item: Copy>;
   |                      ^^^^^^^^^^
   |
   = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
   = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable

error[E0658]: associated type bounds are unstable
  --> src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs:15:22
   |
15 |     type B: Iterator<Item: 'static>;
   |                      ^^^^^^^^^^^^^
   |
   = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
   = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable

error[E0658]: associated type bounds are unstable
  --> src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs:19:20
   |
19 | struct _St1<T: Tr1<As1: Tr2>> {
   |                    ^^^^^^^^
   |
   = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
   = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable

error[E0658]: associated type bounds are unstable
  --> src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs:26:18
   |
26 | enum _En1<T: Tr1<As1: Tr2>> {
   |                  ^^^^^^^^
   |
   = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
   = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable

error[E0658]: associated type bounds are unstable
  --> src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs:33:19
   |
33 | union _Un1<T: Tr1<As1: Tr2>> {
   |                   ^^^^^^^^
   |
   = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
   = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable

error[E0658]: associated type bounds are unstable
  --> src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs:40:37
   |
40 | type _TaWhere1<T> where T: Iterator<Item: Copy> = T;
   |                                     ^^^^^^^^^^
   |
   = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
   = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable

error[E0658]: associated type bounds are unstable
  --> src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs:43:22
   |
43 | fn _apit(_: impl Tr1<As1: Copy>) {}
   |                      ^^^^^^^^^
   |
   = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
   = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable

error[E0658]: associated type bounds are unstable
  --> src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs:45:26
   |
45 | fn _apit_dyn(_: &dyn Tr1<As1: Copy>) {}
   |                          ^^^^^^^^^
   |
   = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
   = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable

error[E0658]: associated type bounds are unstable
  --> src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs:48:24
   |
48 | fn _rpit() -> impl Tr1<As1: Copy> { S1 }
   |                        ^^^^^^^^^
   |
   = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
   = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable

error[E0658]: associated type bounds are unstable
  --> src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs:51:31
   |
51 | fn _rpit_dyn() -> Box<dyn Tr1<As1: Copy>> { Box::new(S1) }
   |                               ^^^^^^^^^
   |
   = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
   = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable

error[E0658]: associated type bounds are unstable
  --> src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs:54:23
   |
54 | const _cdef: impl Tr1<As1: Copy> = S1;
   |                       ^^^^^^^^^
   |
   = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
   = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable

error[E0658]: associated type bounds are unstable
  --> src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs:60:24
   |
60 | static _sdef: impl Tr1<As1: Copy> = S1;
   |                        ^^^^^^^^^
   |
   = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
   = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable

error[E0658]: associated type bounds are unstable
  --> src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs:67:21
   |
67 |     let _: impl Tr1<As1: Copy> = S1;
   |                     ^^^^^^^^^
   |
   = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
   = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
  --> src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs:54:14
   |
54 | const _cdef: impl Tr1<As1: Copy> = S1;
   |              ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
  --> src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs:60:15
   |
60 | static _sdef: impl Tr1<As1: Copy> = S1;
   |               ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable

error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
  --> src/test/ui/feature-gates/feature-gate-associated_type_bounds.rs:67:12
   |
67 |     let _: impl Tr1<As1: Copy> = S1;
   |            ^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable

error: internal compiler error: src/librustc/hir/map/mod.rs:564: couldn't find hir id HirId { owner: DefIndex(0), local_id: 4294967040 } in the HIR map

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:881:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.43.0-nightly (436494b8f 2020-02-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z save-analysis

error: aborting due to 17 previous errors

Some errors have detailed explanations: E0562, E0658.
For more information about an error, try `rustc --explain E0562`.
Backtrace

error: internal compiler error: src/librustc/hir/map/mod.rs:564: couldn't find hir id HirId { owner: DefIndex(0), local_id: 4294967040 } in the HIR map

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:881:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1052
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1428
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:474
  12: std::panicking::begin_panic
  13: rustc_errors::HandlerInner::bug
  14: rustc_errors::Handler::bug
  15: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  16: rustc::ty::context::tls::with_opt::{{closure}}
  17: rustc::ty::context::tls::with_opt
  18: rustc::util::bug::opt_span_bug_fmt
  19: rustc::util::bug::bug_fmt
  20: rustc::hir::map::Map::get::{{closure}}
  21: rustc::hir::map::Map::get
  22: rustc_save_analysis::SaveContext::get_path_res
  23: rustc_save_analysis::SaveContext::get_path_segment_data_with_id
  24: rustc_save_analysis::dump_visitor::DumpVisitor::process_path
  25: <rustc_save_analysis::dump_visitor::DumpVisitor as syntax::visit::Visitor>::visit_ty
  26: rustc_save_analysis::dump_visitor::DumpVisitor::process_static_or_const_item
  27: <rustc_save_analysis::dump_visitor::DumpVisitor as syntax::visit::Visitor>::visit_mod
  28: rustc::dep_graph::graph::DepGraph::with_ignore
  29: rustc_session::utils::<impl rustc_session::session::Session>::time
  30: rustc::ty::context::tls::enter_global
  31: rustc_interface::interface::run_compiler_in_existing_thread_pool
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.43.0-nightly (436494b8f 2020-02-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z save-analysis

query stack during panic:
end of query stack
error: aborting due to 17 previous errors

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-save-analysisArea: saving results of analyses such as inference and borrowck results to a file.C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions