Skip to content

Commit 772787c

Browse files
committed
---
yaml --- r: 232827 b: refs/heads/try c: 9ed30c6 h: refs/heads/master i: 232825: 1ecef8b 232823: 7678034 v: v3
1 parent e542ef5 commit 772787c

File tree

21 files changed

+149
-176
lines changed

21 files changed

+149
-176
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: 9982314577e3d86da87b8024496d932b2cfff298
4+
refs/heads/try: 9ed30c62143f2615f8424d9da63eef77978e3346
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: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1487,6 +1487,26 @@ 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+
14901510
E0282: r##"
14911511
This error indicates that type inference did not result in one unique possible
14921512
type, and extra information is required. In most cases this can be provided
@@ -1867,7 +1887,6 @@ register_diagnostics! {
18671887
E0278, // requirement is not satisfied
18681888
E0279, // requirement is not satisfied
18691889
E0280, // requirement is not satisfied
1870-
E0281, // type implements trait but other trait is required
18711890
E0283, // cannot resolve type
18721891
E0284, // cannot resolve type
18731892
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/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)