Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

ices/58987-1.rs: fixed with errors #333

Merged
merged 1 commit into from
Apr 16, 2020
Merged

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#58987

use std::mem;

fn foo<T: ?Sized>(t: T) {
    let _ = [(); 0 - !(mem::size_of::<&T>() == mem::size_of::<[usize; 2]>()) as usize];
}

fn main() {}
=== stdout ===
=== stderr ===
error[E0277]: the size for values of type `T` cannot be known at compilation time
 --> /home/runner/work/glacier/glacier/ices/58987-1.rs:3:19
  |
3 | fn foo<T: ?Sized>(t: T) {
  |        -          ^ doesn't have a size known at compile-time
  |        |
  |        this type parameter needs to be `std::marker::Sized`
  |
  = help: the trait `std::marker::Sized` is not implemented for `T`
  = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
  = note: all local variables must have a statically known size
  = help: unsized locals are gated as an unstable feature

error: constant expression depends on a generic parameter
 --> /home/runner/work/glacier/glacier/ices/58987-1.rs:4:18
  |
4 |     let _ = [(); 0 - !(mem::size_of::<&T>() == mem::size_of::<[usize; 2]>()) as usize];
  |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this may fail depending on what value the parameter takes

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
==============

=== stdout ===
=== stderr ===
error[E0277]: the size for values of type `T` cannot be known at compilation time
 --> /home/runner/work/glacier/glacier/ices/58987-1.rs:3:19
  |
3 | fn foo<T: ?Sized>(t: T) {
  |        -          ^ doesn't have a size known at compile-time
  |        |
  |        this type parameter needs to be `std::marker::Sized`
  |
  = help: the trait `std::marker::Sized` is not implemented for `T`
  = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
  = note: all local variables must have a statically known size
  = help: unsized locals are gated as an unstable feature

error: constant expression depends on a generic parameter
 --> /home/runner/work/glacier/glacier/ices/58987-1.rs:4:18
  |
4 |     let _ = [(); 0 - !(mem::size_of::<&T>() == mem::size_of::<[usize; 2]>()) as usize];
  |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this may fail depending on what value the parameter takes

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
==============
Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, it's fixed and 58987-2 is still ICE (thanks for taking a look @Alexendoo!).

@JohnTitor JohnTitor merged commit a59983c into master Apr 16, 2020
@JohnTitor JohnTitor deleted the autofix/ices/58987-1.rs branch April 16, 2020 12:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants