Skip to content

[Panic]: not implemented: lifetimes? #334

Open

Description

@matthiaskrgr

Summary

No response

Reproducer

// run-pass
// Test that even with prior inferred parameters, object lifetimes of objects after are still
// valid.

// pretty-expanded FIXME #23616

#![allow(dead_code)]
#![feature(generic_arg_infer)]

trait Test {
    fn foo(&self) { }
}

struct Foo;
impl Test for Foo {}

struct SomeStruct<'a> {
    t: &'a dyn Test,
    u: &'a (dyn Test+'a),
}

fn a<'a, const N: usize>(_: [u8; N], t: &'a (dyn Test+'a), mut ss: SomeStruct<'a>) {
    ss.t = t;
}

fn b<'a, T>(_: T, t: &'a (dyn Test+'a), mut ss: SomeStruct<'a>) {
    ss.u = t;
}

fn main() {
    // Inside a function body, we can just infer both
    // lifetimes, to allow &'tmp (Display+'static).
    a::<_>([], &Foo as &dyn Test, SomeStruct{t:&Foo,u:&Foo});
    b::<_>(0u8, &Foo as &dyn Test, SomeStruct{t:&Foo,u:&Foo});
}

Version

No response

Logs and Backtrace

MARKER_ERROR_TRACE=1 MARKER_LOG=info RUST_BACKTRACE=1    LD_LIBRARY_PATH='/home/matthias/o/target/debug/deps:/home/matthias/.rustup/toolchains/nightly-2023-11-16-x86_64-unknown-linux-gnu/lib:/home/matthias/.rustup/toolchains/nightly-2023-11-16-x86_64-unknown-linux-gnu/lib:/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib'  RUSTC_WORKSPACE_WRAPPER=/home/matthias/.rustup/toolchains/nightly-2023-11-16-x86_64-unknown-linux-gnu/bin/marker_rustc_driver MARKER_LINT_CRATES=marker_lints:/home/matthias/o/target/marker/lints/libmarker_lints.so   RUSTUP_TOOLCHAIN=nightly-2023-11-16    /home/matthias/.rustup/toolchains/nightly-2023-11-16-x86_64-unknown-linux-gnu/bin/marker_rustc_driver /home/matthias/vcs/github/rust_misc_stuff/tests/ui/object-lifetime/object-lifetime-default-inferred.rs
thread 'rustc' panicked at /home/matthias/.cargo/registry/src/index.crates.io-6f17d22bba15001f/marker_rustc_driver-0.4.3/src/conversion/marker/ast/generic.rs:53:52:
not yet implemented
stack backtrace:
   0: rust_begin_unwind
             at /rustc/6b771f6b5a6c8b03b6322a9c77ac77cb346148f0/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/6b771f6b5a6c8b03b6322a9c77ac77cb346148f0/library/core/src/panicking.rs:72:14
   2: core::panicking::panic
             at /rustc/6b771f6b5a6c8b03b6322a9c77ac77cb346148f0/library/core/src/panicking.rs:127:5
   3: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
   4: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
   5: marker_rustc_driver::conversion::marker::ast::generic::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_syn_generic_args
   6: marker_rustc_driver::conversion::marker::common::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_path
   7: marker_rustc_driver::conversion::marker::common::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_qpath
   8: marker_rustc_driver::conversion::marker::ast::expr::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_expr
   9: marker_rustc_driver::conversion::marker::ast::expr::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_expr
  10: marker_rustc_driver::conversion::marker::ast::stmts::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_stmt
  11: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  12: marker_rustc_driver::conversion::marker::ast::expr::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_block_expr
  13: marker_rustc_driver::conversion::marker::ast::expr::<impl marker_rustc_driver::conversion::marker::MarkerConverterInner>::to_expr
  14: marker_rustc_driver::conversion::marker::MarkerConverter::body
  15: marker_utils::visitor::traverse_item
  16: marker_utils::visitor::traverse_item
  17: marker_adapter::Adapter::process_krate
  18: marker_rustc_driver::lint_pass::process_crate
  19: rustc_lint::late::check_crate::{closure#0}
  20: rustc_lint::late::check_crate
  21: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  22: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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

note: we would appreciate a bug report: https://github.com/rust-marker/marker/issues/new?template=panic.yml

note: please attach the file at `/tmp/marker/rustc-ice-2023-12-17T23_47_02-1811473.txt` to your bug report

query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
note: marker_rustc_driver 0.4.3

note: Achievement Unlocked: [Free Ice Cream]

Activity

  1. added
    C-bugCategory: Something isn't working
    I-panicIssue: Some part of the linter panicked unexpectedly
    S-needs-triageStatus: This issue needs triage
    on Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Something isn't workingI-panicIssue: Some part of the linter panicked unexpectedly

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions