Skip to content

Commit 30bfdc8

Browse files
Merge pull request #5 from oliver-giersch/master
sync with upstream
2 parents 3527d1d + 5891a64 commit 30bfdc8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1062
-666
lines changed

src/Cargo.lock

+11-10
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ dependencies = [
204204
"env_logger 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)",
205205
"failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
206206
"filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
207-
"flate2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
207+
"flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
208208
"fs2 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
209209
"fwdansi 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
210210
"git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -737,7 +737,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
737737

738738
[[package]]
739739
name = "flate2"
740-
version = "1.0.2"
740+
version = "1.0.3"
741741
source = "registry+https://github.com/rust-lang/crates.io-index"
742742
dependencies = [
743743
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -959,7 +959,7 @@ version = "0.0.0"
959959
dependencies = [
960960
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
961961
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
962-
"flate2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
962+
"flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
963963
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
964964
"rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
965965
"tar 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1649,7 +1649,7 @@ dependencies = [
16491649

16501650
[[package]]
16511651
name = "racer"
1652-
version = "2.1.6"
1652+
version = "2.1.7"
16531653
source = "registry+https://github.com/rust-lang/crates.io-index"
16541654
dependencies = [
16551655
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1797,7 +1797,7 @@ dependencies = [
17971797
"log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
17981798
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
17991799
"ordslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
1800-
"racer 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
1800+
"racer 2.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
18011801
"rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
18021802
"rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
18031803
"regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1814,6 +1814,7 @@ dependencies = [
18141814
"serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
18151815
"serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
18161816
"serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)",
1817+
"toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
18171818
"url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
18181819
"walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
18191820
]
@@ -1889,7 +1890,7 @@ dependencies = [
18891890
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
18901891
"byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
18911892
"chalk-engine 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
1892-
"flate2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1893+
"flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
18931894
"fmt_macros 0.0.0",
18941895
"graphviz 0.0.0",
18951896
"jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2133,7 +2134,7 @@ dependencies = [
21332134
name = "rustc_codegen_utils"
21342135
version = "0.0.0"
21352136
dependencies = [
2136-
"flate2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
2137+
"flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
21372138
"log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
21382139
"rustc 0.0.0",
21392140
"rustc_data_structures 0.0.0",
@@ -2276,7 +2277,7 @@ dependencies = [
22762277
name = "rustc_metadata"
22772278
version = "0.0.0"
22782279
dependencies = [
2279-
"flate2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
2280+
"flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
22802281
"log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
22812282
"proc_macro 0.0.0",
22822283
"rustc 0.0.0",
@@ -3222,7 +3223,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
32223223
"checksum failure_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "946d0e98a50d9831f5d589038d2ca7f8f455b1c21028c0db0e84116a12696426"
32233224
"checksum filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "da4b9849e77b13195302c174324b5ba73eec9b236b24c221a61000daefb95c5f"
32243225
"checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33"
3225-
"checksum flate2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "37847f133aae7acf82bb9577ccd8bda241df836787642654286e79679826a54b"
3226+
"checksum flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4af030962d89d62aa52cd9492083b1cd9b2d1a77764878102a6c0f86b4d5444d"
32263227
"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
32273228
"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
32283229
"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
@@ -3319,7 +3320,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
33193320
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
33203321
"checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8"
33213322
"checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5"
3322-
"checksum racer 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "99e820b7f7701c834c3f6f8226f388c19c0ea948a3ef79ddc96aa7398b5ba87a"
3323+
"checksum racer 2.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0beefbfaed799c3554021a48856113ad53862311395f6d75376192884ba5fbe6"
33233324
"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd"
33243325
"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c"
33253326
"checksum rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2"

src/bootstrap/dist.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1263,14 +1263,16 @@ impl Step for Clippy {
12631263
builder.install(&cargoclippy, &image.join("bin"), 0o755);
12641264
let doc = image.join("share/doc/clippy");
12651265
builder.install(&src.join("README.md"), &doc, 0o644);
1266-
builder.install(&src.join("LICENSE"), &doc, 0o644);
1266+
builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644);
1267+
builder.install(&src.join("LICENSE-MIT"), &doc, 0o644);
12671268

12681269
// Prepare the overlay
12691270
let overlay = tmp.join("clippy-overlay");
12701271
drop(fs::remove_dir_all(&overlay));
12711272
t!(fs::create_dir_all(&overlay));
12721273
builder.install(&src.join("README.md"), &overlay, 0o644);
1273-
builder.install(&src.join("LICENSE"), &doc, 0o644);
1274+
builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644);
1275+
builder.install(&src.join("LICENSE-MIT"), &doc, 0o644);
12741276
builder.create(&overlay.join("version"), &version);
12751277

12761278
// Generate the installer tarball

src/bootstrap/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1288,6 +1288,9 @@ impl Build {
12881288
t!(fs::create_dir_all(dstdir));
12891289
drop(fs::remove_file(&dst));
12901290
{
1291+
if !src.exists() {
1292+
panic!("Error: File \"{}\" not found!", src.display());
1293+
}
12911294
let mut s = t!(fs::File::open(&src));
12921295
let mut d = t!(fs::File::create(&dst));
12931296
io::copy(&mut s, &mut d).expect("failed to copy");

src/liballoc/fmt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
//! Additionally, the return value of this function is [`fmt::Result`] which is a
153153
//! type alias of [`Result`]`<(), `[`std::fmt::Error`]`>`. Formatting implementations
154154
//! should ensure that they propagate errors from the [`Formatter`][`Formatter`] (e.g., when
155-
//! calling [`write!`]) however, they should never return errors spuriously. That
155+
//! calling [`write!`]). However, they should never return errors spuriously. That
156156
//! is, a formatting implementation must and may only return an error if the
157157
//! passed-in [`Formatter`] returns an error. This is because, contrary to what
158158
//! the function signature might suggest, string formatting is an infallible

src/liballoc/rc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ impl<T: ?Sized> Clone for Rc<T> {
867867
///
868868
/// let five = Rc::new(5);
869869
///
870-
/// Rc::clone(&five);
870+
/// let _ = Rc::clone(&five);
871871
/// ```
872872
#[inline]
873873
fn clone(&self) -> Rc<T> {
@@ -1304,7 +1304,7 @@ impl<T: ?Sized> Clone for Weak<T> {
13041304
///
13051305
/// let weak_five = Rc::downgrade(&Rc::new(5));
13061306
///
1307-
/// Weak::clone(&weak_five);
1307+
/// let _ = Weak::clone(&weak_five);
13081308
/// ```
13091309
#[inline]
13101310
fn clone(&self) -> Weak<T> {

src/liballoc/sync.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ impl<T: ?Sized> Clone for Arc<T> {
713713
///
714714
/// let five = Arc::new(5);
715715
///
716-
/// Arc::clone(&five);
716+
/// let _ = Arc::clone(&five);
717717
/// ```
718718
#[inline]
719719
fn clone(&self) -> Arc<T> {
@@ -1135,7 +1135,7 @@ impl<T: ?Sized> Clone for Weak<T> {
11351135
///
11361136
/// let weak_five = Arc::downgrade(&Arc::new(5));
11371137
///
1138-
/// Weak::clone(&weak_five);
1138+
/// let _ = Weak::clone(&weak_five);
11391139
/// ```
11401140
#[inline]
11411141
fn clone(&self) -> Weak<T> {

src/librustc/diagnostics.rs

+16-2
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,8 @@ Erroneous code example:
637637
```compile_fail,E0152
638638
#![feature(lang_items)]
639639
640-
#[lang = "panic_impl"]
641-
struct Foo; // error: duplicate lang item found: `panic_impl`
640+
#[lang = "arc"]
641+
struct Foo; // error: duplicate lang item found: `arc`
642642
```
643643
644644
Lang items are already implemented in the standard library. Unless you are
@@ -2116,6 +2116,20 @@ struct Foo;
21162116
```
21172117
"##,
21182118

2119+
E0718: r##"
2120+
This error indicates that a `#[lang = ".."]` attribute was placed
2121+
on the wrong type of item.
2122+
2123+
Examples of erroneous code:
2124+
2125+
```compile_fail,E0718
2126+
#![feature(lang_items)]
2127+
2128+
#[lang = "arc"]
2129+
static X: u32 = 42;
2130+
```
2131+
"##,
2132+
21192133
}
21202134

21212135

src/librustc/hir/check_attr.rs

+57-17
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,80 @@
1414
//! conflicts between multiple such attributes attached to the same
1515
//! item.
1616
17-
use syntax_pos::Span;
18-
use ty::TyCtxt;
19-
2017
use hir;
2118
use hir::intravisit::{self, Visitor, NestedVisitorMap};
19+
use ty::TyCtxt;
20+
use std::fmt::{self, Display};
21+
use syntax_pos::Span;
2222

2323
#[derive(Copy, Clone, PartialEq)]
24-
enum Target {
24+
pub(crate) enum Target {
25+
ExternCrate,
26+
Use,
27+
Static,
28+
Const,
2529
Fn,
30+
Closure,
31+
Mod,
32+
ForeignMod,
33+
GlobalAsm,
34+
Ty,
35+
Existential,
36+
Enum,
2637
Struct,
2738
Union,
28-
Enum,
29-
Const,
30-
ForeignMod,
39+
Trait,
40+
TraitAlias,
41+
Impl,
3142
Expression,
3243
Statement,
33-
Closure,
34-
Static,
35-
Trait,
36-
Other,
44+
}
45+
46+
impl Display for Target {
47+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
48+
write!(f, "{}", match *self {
49+
Target::ExternCrate => "extern crate",
50+
Target::Use => "use",
51+
Target::Static => "static item",
52+
Target::Const => "constant item",
53+
Target::Fn => "function",
54+
Target::Closure => "closure",
55+
Target::Mod => "module",
56+
Target::ForeignMod => "foreign module",
57+
Target::GlobalAsm => "global asm",
58+
Target::Ty => "type alias",
59+
Target::Existential => "existential type",
60+
Target::Enum => "enum",
61+
Target::Struct => "struct",
62+
Target::Union => "union",
63+
Target::Trait => "trait",
64+
Target::TraitAlias => "trait alias",
65+
Target::Impl => "item",
66+
Target::Expression => "expression",
67+
Target::Statement => "statement",
68+
})
69+
}
3770
}
3871

3972
impl Target {
40-
fn from_item(item: &hir::Item) -> Target {
73+
pub(crate) fn from_item(item: &hir::Item) -> Target {
4174
match item.node {
75+
hir::ItemKind::ExternCrate(..) => Target::ExternCrate,
76+
hir::ItemKind::Use(..) => Target::Use,
77+
hir::ItemKind::Static(..) => Target::Static,
78+
hir::ItemKind::Const(..) => Target::Const,
4279
hir::ItemKind::Fn(..) => Target::Fn,
80+
hir::ItemKind::Mod(..) => Target::Mod,
81+
hir::ItemKind::ForeignMod(..) => Target::ForeignMod,
82+
hir::ItemKind::GlobalAsm(..) => Target::GlobalAsm,
83+
hir::ItemKind::Ty(..) => Target::Ty,
84+
hir::ItemKind::Existential(..) => Target::Existential,
85+
hir::ItemKind::Enum(..) => Target::Enum,
4386
hir::ItemKind::Struct(..) => Target::Struct,
4487
hir::ItemKind::Union(..) => Target::Union,
45-
hir::ItemKind::Enum(..) => Target::Enum,
46-
hir::ItemKind::Const(..) => Target::Const,
47-
hir::ItemKind::ForeignMod(..) => Target::ForeignMod,
48-
hir::ItemKind::Static(..) => Target::Static,
4988
hir::ItemKind::Trait(..) => Target::Trait,
50-
_ => Target::Other,
89+
hir::ItemKind::TraitAlias(..) => Target::TraitAlias,
90+
hir::ItemKind::Impl(..) => Target::Impl,
5191
}
5292
}
5393
}

0 commit comments

Comments
 (0)