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

!Struct bounds break #58860

Closed
OptimisticPeach opened this issue Mar 1, 2019 · 1 comment
Closed

!Struct bounds break #58860

OptimisticPeach opened this issue Mar 1, 2019 · 1 comment

Comments

@OptimisticPeach
Copy link
Contributor

I made a typo. I tried to type this:

struct Foo;
trait B {}
impl B for Foo {}
struct C<T: !B>(std::marker::PhantomData<T>);

Yet instead I got:

struct Foo;
trait B {}
impl B for Foo {}
struct C<T: !Foo>(std::marker::PhantomData<T>);

Which can be summarized to

struct Foo;
struct C<T: !Foo>;

I expected it to tell me that it wouldn't be able to use a struct as a type parameter constraint like with this case:

error[E0404]: expected trait, found struct `Foo`
 --> src\main.rs:2:13
  |
2 | struct C<T: Foo>;
  |             ^^^ not a trait

Meta

> cargo build
Compiling forum_examples v0.1.0 (C:\Users\User\Desktop\forum_examples)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src\libcore\option.rs:345:21
stack backtrace:
   0: std::sys_common::alloc::realloc_fallback
   1: std::panicking::take_hook
   2: std::panicking::take_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic_fmt
   5: rust_begin_unwind
   6: core::panicking::panic_fmt
   7: core::panicking::panic
   8: syntax::parse::parser::Parser::parse_block
   9: syntax::parse::parser::Parser::parse_block
  10: syntax::parse::parser::Parser::parse_block
  11: syntax::parse::parser::Parser::default_submod_path
  12: syntax::parse::parser::Parser::default_submod_path
  13: syntax::parse::parser::Parser::parse_item
  14: syntax::parse::parser::Parser::parse_visibility
  15: syntax::parse::parser::Parser::parse_crate_mod
  16: syntax::parse::parse_crate_from_file
  17: rustc_driver::profile::dump
  18: rand::os::OsRng::new
  19: rustc_driver::driver::phase_1_parse_input
  20: rustc_driver::driver::compile_input
  21: rustc_driver::run_compiler
  22: <rustc_driver::CompilationFailure as core::fmt::Debug>::fmt
  23: rustc_driver::run_compiler
  24: <rustc_driver::CompilationFailure as core::fmt::Debug>::fmt
  25: _rust_maybe_catch_panic
  26: <rustc_driver::profile::trace::Query as core::fmt::Debug>::fmt
  27: std::sys::windows::thread::Thread::new
  28: BaseThreadInitThunk
  29: RtlUserThreadStart

error: internal compiler error: unexpected panic

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.34.0-nightly (097c04cf4 2019-02-24) running on x86_64-pc-windows-msvc

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden
@jonas-schievink
Copy link
Contributor

Duplicate of #58857

@jonas-schievink jonas-schievink marked this as a duplicate of #58857 Mar 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants