Skip to content

Bounds seem to be ignored in negative impls #23072

Closed
@japaric

Description

@japaric
#![feature(optin_builtin_traits)]

use std::marker::MarkerTrait;

unsafe trait Pod: MarkerTrait {}
unsafe impl Pod for .. {}

trait Bound: MarkerTrait {}

// it seems that the bound is ignored here, i.e. this gets treated as `impl<T> !Pod for T {}`
impl<T: Bound> !Pod for T {}

fn is_pod<T: Pod>(_: T) {}

fn main() {
    is_pod(0i32);  // `i32` doesn't implement `Bound`, so it should be `Pod`
    is_pod(&0i32);  // likewise here
}
rustc 1.0.0-nightly (3b3bb0e68 2015-03-04) (built 2015-03-05)

cc @nikomatsakis @flaper87

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions