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

ices/81270.rs: fixed with no errors #1151

Merged
merged 1 commit into from
Mar 1, 2022
Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Mar 1, 2022

Issue: rust-lang/rust#81270

#![feature(allocator_api)]
use std::alloc::{Layout, Allocator, Global, AllocError};
use std::ptr::NonNull;
use std::marker::PhantomData;

struct S<A>{ a: PhantomData<A>, b: [u8; 1] }
unsafe impl<A> Allocator for S<A> {
    fn allocate(&self, _: Layout) -> Result<NonNull<[u8]>, AllocError> {
        todo!();
    }
    unsafe fn deallocate(&self, _: NonNull<u8>, _: Layout) {
        todo!();
    }
}

fn main() {
    let x: Box<u8, S<u8>> = Box::new_in(0, S { a: PhantomData, b: [0; 1] });
}
=== stdout ===
=== stderr ===
warning: unused import: `Global`
 --> /home/runner/work/glacier/glacier/ices/81270.rs:2:37
  |
2 | use std::alloc::{Layout, Allocator, Global, AllocError};
  |                                     ^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused variable: `x`
  --> /home/runner/work/glacier/glacier/ices/81270.rs:17:9
   |
17 |     let x: Box<u8, S<u8>> = Box::new_in(0, S { a: PhantomData, b: [0; 1] });
   |         ^ help: if this is intentional, prefix it with an underscore: `_x`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: field is never read: `b`
 --> /home/runner/work/glacier/glacier/ices/81270.rs:6:33
  |
6 | struct S<A>{ a: PhantomData<A>, b: [u8; 1] }
  |                                 ^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: 3 warnings emitted

==============

=== stdout ===
=== stderr ===
warning: unused import: `Global`
 --> /home/runner/work/glacier/glacier/ices/81270.rs:2:37
  |
2 | use std::alloc::{Layout, Allocator, Global, AllocError};
  |                                     ^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused variable: `x`
  --> /home/runner/work/glacier/glacier/ices/81270.rs:17:9
   |
17 |     let x: Box<u8, S<u8>> = Box::new_in(0, S { a: PhantomData, b: [0; 1] });
   |         ^ help: if this is intentional, prefix it with an underscore: `_x`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: field is never read: `b`
 --> /home/runner/work/glacier/glacier/ices/81270.rs:6:33
  |
6 | struct S<A>{ a: PhantomData<A>, b: [u8; 1] }
  |                                 ^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: 3 warnings emitted

==============
@Alexendoo Alexendoo merged commit 886b45d into master Mar 1, 2022
@Alexendoo Alexendoo deleted the autofix/ices/81270.rs branch March 1, 2022 14:51
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