Skip to content

Commit 9b476cd

Browse files
committed
---
yaml --- r: 232829 b: refs/heads/try c: 8ae2b1d h: refs/heads/master i: 232827: 772787c v: v3
1 parent 468d2fe commit 9b476cd

File tree

22 files changed

+150
-196
lines changed

22 files changed

+150
-196
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: edeb4f1c86cbf6af8ef9874d4b3af50f721ea1b8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: f3f23bf9c5ee16dab8c25bb5d301d689fbbe0cf1
4+
refs/heads/try: 8ae2b1d7dd9e25b09439d6494a3a9d2540c08dbf
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc/diagnostics.rs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,26 +1487,6 @@ fn main() {
14871487
```
14881488
"##,
14891489

1490-
E0281: r##"
1491-
You tried to supply a type which doesn't implement some trait in a location
1492-
which expected that trait. This error typically occurs when working with
1493-
`Fn`-based types. Erroneous code example:
1494-
1495-
```
1496-
fn foo<F: Fn()>(x: F) { }
1497-
1498-
fn main() {
1499-
// type mismatch: the type ... implements the trait `core::ops::Fn<(_,)>`,
1500-
// but the trait `core::ops::Fn<()>` is required (expected (), found tuple
1501-
// [E0281]
1502-
foo(|y| { });
1503-
}
1504-
```
1505-
1506-
The issue in this case is that `foo` is defined as accepting a `Fn` with no
1507-
arguments, but the closure we attempted to pass to it requires one argument.
1508-
"##,
1509-
15101490
E0282: r##"
15111491
This error indicates that type inference did not result in one unique possible
15121492
type, and extra information is required. In most cases this can be provided
@@ -1887,6 +1867,7 @@ register_diagnostics! {
18871867
E0278, // requirement is not satisfied
18881868
E0279, // requirement is not satisfied
18891869
E0280, // requirement is not satisfied
1870+
E0281, // type implements trait but other trait is required
18901871
E0283, // cannot resolve type
18911872
E0284, // cannot resolve type
18921873
E0285, // overflow evaluation builtin bounds

branches/try/src/librustc/plugin/registry.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ impl<'a> Registry<'a> {
145145
/// `Whitelisted` attributes will additionally not trigger the `unused_attribute`
146146
/// lint. `CrateLevel` attributes will not be allowed on anything other than a crate.
147147
pub fn register_attribute(&mut self, name: String, ty: AttributeType) {
148+
if let AttributeType::Gated(..) = ty {
149+
self.sess.span_err(self.krate_span, "plugin tried to register a gated \
150+
attribute. Only `Normal`, `Whitelisted`, \
151+
and `CrateLevel` attributes are allowed");
152+
}
148153
self.attributes.push((name, ty));
149154
}
150155
}

branches/try/src/librustc_lint/builtin.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -887,9 +887,10 @@ impl LintPass for UnusedAttributes {
887887

888888
fn check_attribute(&mut self, cx: &Context, attr: &ast::Attribute) {
889889
// Note that check_name() marks the attribute as used if it matches.
890-
for &(ref name, ty, _) in KNOWN_ATTRIBUTES {
890+
for &(ref name, ty) in KNOWN_ATTRIBUTES {
891891
match ty {
892-
AttributeType::Whitelisted if attr.check_name(name) => {
892+
AttributeType::Whitelisted
893+
| AttributeType::Gated(_, _) if attr.check_name(name) => {
893894
break;
894895
},
895896
_ => ()
@@ -906,11 +907,8 @@ impl LintPass for UnusedAttributes {
906907
if !attr::is_used(attr) {
907908
cx.span_lint(UNUSED_ATTRIBUTES, attr.span, "unused attribute");
908909
// Is it a builtin attribute that must be used at the crate level?
909-
let known_crate = KNOWN_ATTRIBUTES.iter().find(|&&(name, ty, _)| {
910-
attr.name() == name &&
911-
ty == AttributeType::CrateLevel
912-
}).is_some();
913-
910+
let known_crate = KNOWN_ATTRIBUTES.contains(&(&attr.name(),
911+
AttributeType::CrateLevel));
914912
// Has a plugin registered this attribute as one which must be used at
915913
// the crate level?
916914
let plugin_crate = plugin_attributes.iter()

branches/try/src/librustc_typeck/diagnostics.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1642,6 +1642,26 @@ static BAR: _ = "test"; // error, explicitly write out the type instead
16421642
```
16431643
"##,
16441644

1645+
E0122: r##"
1646+
An attempt was made to add a generic constraint to a type alias. While Rust will
1647+
allow this with a warning, it will not currently enforce the constraint.
1648+
Consider the example below:
1649+
1650+
```
1651+
trait Foo{}
1652+
1653+
type MyType<R: Foo> = (R, ());
1654+
1655+
fn main() {
1656+
let t: MyType<u32>;
1657+
}
1658+
```
1659+
1660+
We're able to declare a variable of type `MyType<u32>`, despite the fact that
1661+
`u32` does not implement `Foo`. As a result, one should avoid using generic
1662+
constraints in concert with type aliases.
1663+
"##,
1664+
16451665
E0124: r##"
16461666
You declared two fields of a struct with the same name. Erroneous code
16471667
example:
@@ -3010,7 +3030,6 @@ register_diagnostics! {
30103030
E0103, // @GuillaumeGomez: I was unable to get this error, try your best!
30113031
E0104,
30123032
E0118,
3013-
E0122,
30143033
// E0123,
30153034
// E0127,
30163035
// E0129,

branches/try/src/libsyntax/ext/deriving/bounds.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ pub fn expand_deriving_copy(cx: &mut ExtCtxt,
4040
path: path,
4141
additional_bounds: Vec::new(),
4242
generics: LifetimeBounds::empty(),
43-
is_unsafe: false,
4443
methods: Vec::new(),
4544
associated_types: Vec::new(),
4645
};

branches/try/src/libsyntax/ext/deriving/clone.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt,
3131
path: path_std!(cx, core::clone::Clone),
3232
additional_bounds: Vec::new(),
3333
generics: LifetimeBounds::empty(),
34-
is_unsafe: false,
3534
methods: vec!(
3635
MethodDef {
3736
name: "clone",

branches/try/src/libsyntax/ext/deriving/cmp/eq.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt,
5151
path: path_std!(cx, core::cmp::Eq),
5252
additional_bounds: Vec::new(),
5353
generics: LifetimeBounds::empty(),
54-
is_unsafe: false,
5554
methods: vec!(
5655
MethodDef {
5756
name: "assert_receiver_is_total_eq",

branches/try/src/libsyntax/ext/deriving/cmp/ord.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt,
3232
path: path_std!(cx, core::cmp::Ord),
3333
additional_bounds: Vec::new(),
3434
generics: LifetimeBounds::empty(),
35-
is_unsafe: false,
3635
methods: vec!(
3736
MethodDef {
3837
name: "cmp",

branches/try/src/libsyntax/ext/deriving/cmp/partial_eq.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt,
8585
path: path_std!(cx, core::cmp::PartialEq),
8686
additional_bounds: Vec::new(),
8787
generics: LifetimeBounds::empty(),
88-
is_unsafe: false,
8988
methods: vec!(
9089
md!("eq", cs_eq),
9190
md!("ne", cs_ne)

branches/try/src/libsyntax/ext/deriving/cmp/partial_ord.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt,
7373
path: path_std!(cx, core::cmp::PartialOrd),
7474
additional_bounds: vec![],
7575
generics: LifetimeBounds::empty(),
76-
is_unsafe: false,
7776
methods: vec![
7877
partial_cmp_def,
7978
md!("lt", true, false),

branches/try/src/libsyntax/ext/deriving/decodable.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt,
5959
path: Path::new_(vec!(krate, "Decodable"), None, vec!(), true),
6060
additional_bounds: Vec::new(),
6161
generics: LifetimeBounds::empty(),
62-
is_unsafe: false,
6362
methods: vec!(
6463
MethodDef {
6564
name: "decode",

branches/try/src/libsyntax/ext/deriving/default.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ pub fn expand_deriving_default(cx: &mut ExtCtxt,
3131
path: path_std!(cx, core::default::Default),
3232
additional_bounds: Vec::new(),
3333
generics: LifetimeBounds::empty(),
34-
is_unsafe: false,
3534
methods: vec!(
3635
MethodDef {
3736
name: "default",

branches/try/src/libsyntax/ext/deriving/encodable.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ fn expand_deriving_encodable_imp(cx: &mut ExtCtxt,
135135
path: Path::new_(vec!(krate, "Encodable"), None, vec!(), true),
136136
additional_bounds: Vec::new(),
137137
generics: LifetimeBounds::empty(),
138-
is_unsafe: false,
139138
methods: vec!(
140139
MethodDef {
141140
name: "encode",

branches/try/src/libsyntax/ext/deriving/generic/mod.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,6 @@ pub struct TraitDef<'a> {
229229
/// Any extra lifetimes and/or bounds, e.g. `D: serialize::Decoder`
230230
pub generics: LifetimeBounds<'a>,
231231

232-
/// Is it an `unsafe` trait?
233-
pub is_unsafe: bool,
234-
235232
pub methods: Vec<MethodDef<'a>>,
236233

237234
pub associated_types: Vec<(ast::Ident, Ty<'a>)>,
@@ -628,18 +625,11 @@ impl<'a> TraitDef<'a> {
628625
InternedString::new("unused_qualifications"))]));
629626
let mut a = vec![attr, unused_qual];
630627
a.extend(self.attributes.iter().cloned());
631-
632-
let unsafety = if self.is_unsafe {
633-
ast::Unsafety::Unsafe
634-
} else {
635-
ast::Unsafety::Normal
636-
};
637-
638628
cx.item(
639629
self.span,
640630
ident,
641631
a,
642-
ast::ItemImpl(unsafety,
632+
ast::ItemImpl(ast::Unsafety::Normal,
643633
ast::ImplPolarity::Positive,
644634
trait_generics,
645635
opt_trait_ref,

branches/try/src/libsyntax/ext/deriving/hash.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt,
3232
path: path,
3333
additional_bounds: Vec::new(),
3434
generics: LifetimeBounds::empty(),
35-
is_unsafe: false,
3635
methods: vec!(
3736
MethodDef {
3837
name: "hash",

branches/try/src/libsyntax/ext/deriving/primitive.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt,
3232
path: path_std!(cx, core::num::FromPrimitive),
3333
additional_bounds: Vec::new(),
3434
generics: LifetimeBounds::empty(),
35-
is_unsafe: false,
3635
methods: vec!(
3736
MethodDef {
3837
name: "from_i64",

branches/try/src/libsyntax/ext/deriving/show.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ pub fn expand_deriving_show(cx: &mut ExtCtxt,
3434
path: path_std!(cx, core::fmt::Debug),
3535
additional_bounds: Vec::new(),
3636
generics: LifetimeBounds::empty(),
37-
is_unsafe: false,
3837
methods: vec![
3938
MethodDef {
4039
name: "fmt",

0 commit comments

Comments
 (0)