Open matthiaskrgr opened 5 months ago
```
error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time
--> /tmp/icemaker_global_tempdir.DeGTikoAenpp/rustc_testrunner_tmpdir_reporting.slPe3eVWcNgu/mvce.rs:3:18
|
3 | static STATIC_1: dyn Debug + Sync = *();
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
error[E0614]: type `()` cannot be dereferenced
--> /tmp/icemaker_global_tempdir.DeGTikoAenpp/rustc_testrunner_tmpdir_reporting.slPe3eVWcNgu/mvce.rs:3:37
|
3 | static STATIC_1: dyn Debug + Sync = *();
| ^^^
error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time
--> /tmp/icemaker_global_tempdir.DeGTikoAenpp/rustc_testrunner_tmpdir_reporting.slPe3eVWcNgu/mvce.rs:3:37
|
3 | static STATIC_1: dyn Debug + Sync = *();
| ^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
= note: constant expressions must have a statically known size
thread 'rustc' panicked at /home/matthias/vcs/github/rust_debug_assertions/compiler/rustc_const_eval/src/interpret/operand.rs:195:9:
immediate Scalar(alloc1) does not fit to layout TyAndLayout { ty: &dyn Debug + Sync, layout: Layout { size: Size(16 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), pref: Align(8 bytes) }, abi: ScalarPair(Initialized { value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }, Initialized { value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), fields: Arbitrary { offsets: [Size(0 bytes), Size(8 bytes)], memory_index: [0, 1] }, largest_niche: Some(Niche { offset: Size(0 bytes), value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), variants: Single { index: 0 }, max_repr_align: None, unadjusted_abi_align: Align(8 bytes) } }
stack backtrace:
0: 0x7fed34f64e6d - std::backtrace_rs::backtrace::libunwind::trace::h71aa28bdc5089aab
at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
1: 0x7fed34f64e6d - std::backtrace_rs::backtrace::trace_unsynchronized::hc71f6f29c4d7cf67
at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7fed34f64e6d - std::sys_common::backtrace::_print_fmt::h8e1e2ea27397ed17
at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/sys_common/backtrace.rs:68:5
3: 0x7fed34f64e6d -
This also triggers on code that compiles with mir inlining:
auto-reduced (treereduce-rust):
#![feature(trivial_bounds)]
use std::fmt::Debug;
pub fn foo()
where
Vec<str>: Debug,
str: Copy,
{
let x = vec![*"1"];
println!("{:?}", x);
}
original:
//@ run-pass
// Test that inconsistent bounds are used in well-formedness checks
#![feature(trivial_bounds)]
use std::fmt::Debug;
pub fn foo() where Vec<str>: Debug, str: Copy {
//~^ WARNING Debug does not depend on any type or lifetime
//~| WARNING Copy does not depend on any type or lifetime
let x = vec![*"1"];
println!("{:?}", x);
}
fn main() {}
Version information
rustc 1.78.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.78.0-dev
LLVM version: 18.1.0
Command:
/home/matthias/.rustup/toolchains/local-debug-assertions/bin/rustc -Zinline-mir=yes --crate-type=lib
```
warning: trait bound Vec
snippet:
Version information
Command:
/home/matthias/.rustup/toolchains/local-debug-assertions/bin/rustc