Skip to content

crash ./ui/trivial-bounds/trivial-bounds-inconsistent.rs #3969

Closed
@matthiaskrgr

Description

@matthiaskrgr

#3142

code from rust src/test/trivial-bounds/trivial-bounds-inconsistent.rs

// run-pass

// Check that tautalogically false bounds are accepted, and are used
// in type inference.
#![feature(trivial_bounds)]
#![allow(unused)]


trait A {}

impl A for i32 {}

struct Dst<X: ?Sized> {
    x: X,
}

struct TwoStrs(str, str) where str: Sized;

fn unsized_local() where for<'a> Dst<A + 'a>: Sized {
    let x: Dst<A> = *(Box::new(Dst { x: 1 }) as Box<Dst<A>>);
}

fn return_str() -> str where str: Sized {
    *"Sized".to_string().into_boxed_str()
}

fn use_op(s: String) -> String where String: ::std::ops::Neg<Output=String> {
    -s
}

fn use_for() where i32: Iterator {
    for _ in 2i32 {}
}

fn main() {}
    Checking crash v0.1.0 (/tmp/crash)
error: internal compiler error: src/librustc_traits/normalize_erasing_regions.rs:43: could not fully normalize `<i32 as std::iter::Iterator>::Item`

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:635:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:197
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:478
   6: std::panicking::begin_panic
   7: rustc_errors::Handler::bug
   8: rustc::util::bug::opt_span_bug_fmt::{{closure}}
   9: rustc::ty::context::tls::with_opt::{{closure}}
  10: rustc::ty::context::tls::with_context_opt
  11: rustc::ty::context::tls::with_opt
  12: rustc::util::bug::opt_span_bug_fmt
  13: rustc::util::bug::bug_fmt
  14: rustc::ty::context::GlobalCtxt::enter_local
  15: rustc_traits::normalize_erasing_regions::normalize_ty_after_erasing_regions
  16: rustc::ty::query::__query_compute::normalize_ty_after_erasing_regions
  17: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::normalize_ty_after_erasing_regions>::compute
  18: rustc::dep_graph::graph::DepGraph::with_task_impl
  19: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  20: <rustc::traits::query::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc::ty::fold::TypeFolder>::fold_ty
  21: rustc_mir::util::elaborate_drops::DropCtxt<D>::move_paths_for_fields::{{closure}}
  22: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
  23: rustc_mir::util::elaborate_drops::DropCtxt<D>::elaborate_drop
  24: <rustc_mir::transform::elaborate_drops::ElaborateDrops as rustc_mir::transform::MirPass>::run_pass
  25: rustc_mir::transform::run_passes::{{closure}}
  26: rustc_mir::transform::run_passes
  27: rustc_mir::transform::optimized_mir
  28: rustc::ty::query::__query_compute::optimized_mir
  29: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::optimized_mir>::compute
  30: rustc::dep_graph::graph::DepGraph::with_task_impl
  31: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  32: <clippy_lints::implicit_return::Pass as rustc::lint::LateLintPass>::check_fn
  33: <rustc::lint::context::LateLintPassObjects as rustc::lint::LateLintPass>::check_fn
  34: rustc::hir::intravisit::walk_item
  35: rustc::hir::intravisit::Visitor::visit_nested_item
  36: rustc::hir::intravisit::walk_crate
  37: rustc::lint::context::late_lint_pass_crate
  38: rustc::lint::context::late_lint_crate
  39: rustc_data_structures::sync::serial_join
  40: rustc::util::common::time
  41: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:87
  42: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  43: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:87
  44: rustc_interface::passes::analysis::{{closure}}
  45: rustc::util::common::time
  46: rustc_interface::passes::analysis
  47: rustc::ty::query::__query_compute::analysis
  48: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::analysis>::compute
  49: rustc::dep_graph::graph::DepGraph::with_task_impl
  50: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  51: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  52: rustc_interface::passes::create_global_ctxt::{{closure}}
  53: rustc_interface::interface::run_compiler_in_existing_thread_pool
  54: std::thread::local::LocalKey<T>::with
  55: scoped_tls::ScopedKey<T>::set
  56: syntax::with_globals
query stack during panic:
#0 [normalize_ty_after_erasing_regions] normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All, def_id: None }, value: <i32 as std::iter::Iterator>::Item }`
#1 [optimized_mir] processing `use_for`
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error


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.35.0-nightly (3de010678 2019-04-11) running on x86_64-unknown-linux-gnu

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

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `crash`.

To learn more, run the command again with --verbose.

clippy 0.0.212 (37f5c1e 2019-04-09)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingE-needs-testCall for participation: writing testsI-ICEIssue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions