Skip to content

librustc: Add missing case for the Pod bound in tydecode. #11060

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 20, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/librustc/metadata/tydecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,14 +590,17 @@ fn parse_bounds(st: &mut PState, conv: conv_did) -> ty::ParamBounds {
'Z' => {
param_bounds.builtin_bounds.add(ty::BoundSized);
}
'P' => {
param_bounds.builtin_bounds.add(ty::BoundPod);
}
'I' => {
param_bounds.trait_bounds.push(@parse_trait_ref(st, |x,y| conv(x,y)));
}
'.' => {
return param_bounds;
}
_ => {
fail!("parse_bounds: bad bounds")
c => {
fail!("parse_bounds: bad bounds ('{}')", c)
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/test/auxiliary/kinds_in_metadata.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */

// Tests that metadata serialization works for the `Pod` kind.

#[crate_type="lib"];

pub fn f<T:Pod>() {}

1 change: 1 addition & 0 deletions src/test/auxiliary/trait_superkinds_in_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@

pub trait RequiresFreeze : Freeze { }
pub trait RequiresRequiresFreezeAndSend : RequiresFreeze + Send { }
pub trait RequiresPod : Pod { }
3 changes: 3 additions & 0 deletions src/test/run-pass/builtin-superkinds-in-metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@

extern mod trait_superkinds_in_metadata;
use trait_superkinds_in_metadata::{RequiresRequiresFreezeAndSend, RequiresFreeze};
use trait_superkinds_in_metadata::{RequiresPod};

struct X<T>(T);

impl <T:Freeze> RequiresFreeze for X<T> { }

impl <T:Freeze+Send> RequiresRequiresFreezeAndSend for X<T> { }

impl <T:Pod> RequiresPod for X<T> { }

fn main() { }
16 changes: 16 additions & 0 deletions src/test/run-pass/kinds-in-metadata.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// xfail-fast
// aux-build:kinds_in_metadata.rs

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */

// Tests that metadata serialization works for the `Pod` kind.

extern mod kinds_in_metadata;

use kinds_in_metadata::f;

pub fn main() {
f::<int>();
}