Skip to content

Metadata decoding of more than one attribute like mutable and non_owned broken #7017

Closed
@bill-myers

Description

@bill-myers

It seems the decoding of [mutable] and [non_owned] is broken: specifically it seems they are ignored when applied on a struct in an external module, when another attribute follows.

In particular, it seems that when more than one attribute is present, only the last attribute survives encode+decode, and the others are somehow lost.

extern mod std;
use core::cell::Cell;
use std::rc::RcMut;
use std::arc::RWARC;

fn check_const<T: Const>(v: &T)
{
}

fn check_owned<T: Owned>(v: &T)
{
}

#[mutable]
#[deriving(Clone)]
pub struct MyCell<T> {
    priv value: Option<T>
}


fn test(c: &Cell<u32>, m: &RcMut<u32>, a: &RWARC<u32>, mc: &MyCell<u32>)
{
    // these succeed but should fail
    check_const(c);
    check_owned(m);

    // these fail as expected
    check_const(m);
    check_const(a);
    check_const(mc);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions