Closed
Description
Code
trait StreamOnce {
type Position;
}
impl StreamOnce for &str {
type Position = usize;
}
fn follow(_: &str) -> <&str as StreamOnce>::Position {
String::new
}
Meta
rustc --version --verbose
:
rustc 1.56.0-nightly (9c25eb7aa 2021-07-25)
binary: rustc
commit-hash: 9c25eb7aa3a71fb951564b0ddf131be59c2c951d
commit-date: 2021-07-25
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 12.0.1
Error output
error[E0601]: `main` function not found in crate `mutant`
--> mutant.rs:1:1
|
1 | / trait StreamOnce {
2 | | type Position;
3 | | }
4 | | impl StreamOnce for &str {
... |
8 | | String::new
9 | | }
| |_^ consider adding a `main` function to `mutant.rs`
error[E0308]: mismatched types
--> mutant.rs:8:5
|
7 | fn follow(_: &str) -> <&str as StreamOnce>::Position {
| ------------------------------ expected `usize` because of return type
8 | String::new
| ^^^^^^^^^^^ expected `usize`, found fn item
|
= note: expected type `usize`
found fn item `fn() -> String {String::new}`
error: internal compiler error: compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:498:17: cannot relate region: LUB(ReErased, ReEmpty(U0))
thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1034: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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.56.0-nightly (9c25eb7aa 2021-07-25) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `follow`
#1 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0308, E0601.
For more information about an error, try `rustc --explain E0308`.
Backtrace
error[E0601]: `main` function not found in crate `mutant`
--> mutant.rs:1:1
|
1 | / trait StreamOnce {
2 | | type Position;
3 | | }
4 | | impl StreamOnce for &str {
... |
8 | | String::new
9 | | }
| |_^ consider adding a `main` function to `mutant.rs`
error[E0308]: mismatched types
--> mutant.rs:8:5
|
7 | fn follow(_: &str) -> <&str as StreamOnce>::Position {
| ------------------------------ expected `usize` because of return type
8 | String::new
| ^^^^^^^^^^^ expected `usize`, found fn item
|
= note: expected type `usize`
found fn item `fn() -> String {String::new}`
error: internal compiler error: compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:498:17: cannot relate region: LUB(ReErased, ReEmpty(U0))
thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1034:9
stack backtrace:
0: std::panicking::begin_panic
1: std::panic::panic_any
2: rustc_errors::HandlerInner::bug
3: rustc_errors::Handler::bug
4: rustc_middle::ty::context::tls::with_opt
5: rustc_middle::util::bug::opt_span_bug_fmt
6: rustc_middle::util::bug::bug_fmt
7: rustc_infer::infer::lexical_region_resolve::LexicalResolver::lub_concrete_regions
8: rustc_infer::infer::lexical_region_resolve::LexicalResolver::expand_node
9: rustc_infer::infer::lexical_region_resolve::LexicalResolver::infer_variable_values
10: rustc_infer::infer::lexical_region_resolve::resolve
11: rustc_infer::infer::InferCtxt::resolve_regions_and_report_errors
12: rustc_typeck::check::regionck::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::regionck_fn
13: rustc_infer::infer::InferCtxtBuilder::enter
14: rustc_typeck::check::typeck
15: rustc_query_system::query::plumbing::get_query_impl
16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
17: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
18: rustc_typeck::check::typeck_item_bodies
19: rustc_query_system::query::plumbing::get_query_impl
20: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
21: rustc_session::utils::<impl rustc_session::session::Session>::time
22: rustc_typeck::check_crate
23: rustc_interface::passes::analysis
24: rustc_query_system::query::plumbing::get_query_impl
25: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
26: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
27: rustc_span::with_source_map
28: rustc_interface::interface::create_compiler_and_run
29: scoped_tls::ScopedKey<T>::set
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.56.0-nightly (9c25eb7aa 2021-07-25) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `follow`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0308, E0601.
For more information about an error, try `rustc --explain E0308`.
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Low priorityRelevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.Performance or correctness regression from stable to nightly.