Skip to content

Commit 5ce9f36

Browse files
committed
---
yaml --- r: 234463 b: refs/heads/tmp c: 5d9dc1d h: refs/heads/master i: 234461: 955a211 234459: 21bb787 234455: b6f75b5 234447: db260cb 234431: 091a817 v: v3
1 parent f4a456e commit 5ce9f36

File tree

14 files changed

+177
-137
lines changed

14 files changed

+177
-137
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: d2e13e822a73e0ea46ae9e21afdd3155fc997f6d
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: a1758aea18e9008e5b47a99706cab21ca12f1b0a
28+
refs/heads/tmp: 5d9dc1d7a1d2ee601673bf17003852255c577144
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: ab792abf1fcc28afbd315426213f6428da25c085
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/COPYRIGHT

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -22,104 +22,6 @@ The Rust Project includes packages written by third parties.
2222
The following third party packages are included, and carry
2323
their own copyright notices and license terms:
2424

25-
* Two header files that are part of the Valgrind
26-
package. These files are found at src/rt/valgrind/valgrind.h and
27-
src/rt/valgrind/memcheck.h, within this distribution. These files
28-
are redistributed under the following terms, as noted in
29-
them:
30-
31-
for src/rt/valgrind/valgrind.h:
32-
33-
This file is part of Valgrind, a dynamic binary
34-
instrumentation framework.
35-
36-
Copyright (C) 2000-2010 Julian Seward. All rights
37-
reserved.
38-
39-
Redistribution and use in source and binary forms, with
40-
or without modification, are permitted provided that the
41-
following conditions are met:
42-
43-
1. Redistributions of source code must retain the above
44-
copyright notice, this list of conditions and the
45-
following disclaimer.
46-
47-
2. The origin of this software must not be
48-
misrepresented; you must not claim that you wrote the
49-
original software. If you use this software in a
50-
product, an acknowledgment in the product
51-
documentation would be appreciated but is not
52-
required.
53-
54-
3. Altered source versions must be plainly marked as
55-
such, and must not be misrepresented as being the
56-
original software.
57-
58-
4. The name of the author may not be used to endorse or
59-
promote products derived from this software without
60-
specific prior written permission.
61-
62-
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
63-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
64-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
65-
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
66-
NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
67-
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
68-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
69-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
70-
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
71-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
72-
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
73-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
74-
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
75-
OF SUCH DAMAGE.
76-
77-
for src/rt/valgrind/memcheck.h:
78-
79-
This file is part of MemCheck, a heavyweight Valgrind
80-
tool for detecting memory errors.
81-
82-
Copyright (C) 2000-2010 Julian Seward. All rights
83-
reserved.
84-
85-
Redistribution and use in source and binary forms, with
86-
or without modification, are permitted provided that the
87-
following conditions are met:
88-
89-
1. Redistributions of source code must retain the above
90-
copyright notice, this list of conditions and the
91-
following disclaimer.
92-
93-
2. The origin of this software must not be
94-
misrepresented; you must not claim that you wrote the
95-
original software. If you use this software in a
96-
product, an acknowledgment in the product
97-
documentation would be appreciated but is not
98-
required.
99-
100-
3. Altered source versions must be plainly marked as
101-
such, and must not be misrepresented as being the
102-
original software.
103-
104-
4. The name of the author may not be used to endorse or
105-
promote products derived from this software without
106-
specific prior written permission.
107-
108-
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
109-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
110-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
111-
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
112-
NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
113-
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
114-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
115-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
116-
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
117-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
118-
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
119-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
120-
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
121-
OF SUCH DAMAGE.
122-
12325
* The src/rt/miniz.c file, carrying an implementation of
12426
RFC1950/RFC1951 DEFLATE, by Rich Geldreich
12527
<[email protected]>. All uses of this file are

branches/tmp/src/doc/trpl/macros.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ fn main() {
313313
}
314314
```
315315

316-
This works because Rust has a [hygienic macro system][https://en.wikipedia.org/wiki/Hygienic_macro]. Each macro expansion
316+
This works because Rust has a [hygienic macro system]. Each macro expansion
317317
happens in a distinct ‘syntax context’, and each variable is tagged with the
318318
syntax context where it was introduced. It’s as though the variable `state`
319319
inside `main` is painted a different "color" from the variable `state` inside

branches/tmp/src/doc/trpl/mutability.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn foo(mut x: i32) {
6262
# Interior vs. Exterior Mutability
6363

6464
However, when we say something is ‘immutable’ in Rust, that doesn’t mean that
65-
it’s not able to be changed: We mean something has ‘exterior mutability’. Consider,
65+
it’s not able to be changed: we mean something has ‘exterior mutability’. Consider,
6666
for example, [`Arc<T>`][arc]:
6767

6868
```rust
@@ -85,8 +85,8 @@ philosophy, memory safety, and the mechanism by which Rust guarantees it, the
8585
> You may have one or the other of these two kinds of borrows, but not both at
8686
> the same time:
8787
>
88-
> * one or more references (`&T`) to a resource.
89-
> * exactly one mutable reference (`&mut T`)
88+
> * one or more references (`&T`) to a resource,
89+
> * exactly one mutable reference (`&mut T`).
9090
9191
[ownership]: ownership.html
9292
[borrowing]: references-and-borrowing.html#borrowing

branches/tmp/src/doc/trpl/references-and-borrowing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ First, any borrow must last for a scope no greater than that of the owner.
159159
Second, you may have one or the other of these two kinds of borrows, but not
160160
both at the same time:
161161

162-
* one or more references (`&T`) to a resource.
163-
* exactly one mutable reference (`&mut T`)
162+
* one or more references (`&T`) to a resource,
163+
* exactly one mutable reference (`&mut T`).
164164

165165

166166
You may notice that this is very similar, though not exactly the same as,
@@ -298,8 +298,8 @@ We can’t modify `v` because it’s borrowed by the loop.
298298

299299
### use after free
300300

301-
References must live as long as the resource they refer to. Rust will check the
302-
scopes of your references to ensure that this is true.
301+
References must not live longer than the resource they refer to. Rust will
302+
check the scopes of your references to ensure that this is true.
303303

304304
If Rust didn’t check this property, we could accidentally use a reference
305305
which was invalid. For example:

branches/tmp/src/librustc/middle/infer/error_reporting.rs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ use rustc_front::hir;
7878
use rustc_front::print::pprust;
7979

8080
use middle::def;
81+
use middle::def_id::DefId;
8182
use middle::infer;
8283
use middle::region;
8384
use middle::subst;
@@ -226,6 +227,8 @@ pub trait ErrorReporting<'tcx> {
226227

227228
fn report_type_error(&self, trace: TypeTrace<'tcx>, terr: &ty::TypeError<'tcx>);
228229

230+
fn check_and_note_conflicting_crates(&self, terr: &ty::TypeError<'tcx>, sp: Span);
231+
229232
fn report_and_explain_type_error(&self,
230233
trace: TypeTrace<'tcx>,
231234
terr: &ty::TypeError<'tcx>);
@@ -484,13 +487,60 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
484487
expected_found_str,
485488
terr);
486489

490+
self.check_and_note_conflicting_crates(terr, trace.origin.span());
491+
487492
match trace.origin {
488493
infer::MatchExpressionArm(_, arm_span) =>
489494
self.tcx.sess.span_note(arm_span, "match arm with an incompatible type"),
490495
_ => ()
491496
}
492497
}
493498

499+
/// Adds a note if the types come from similarly named crates
500+
fn check_and_note_conflicting_crates(&self, terr: &ty::TypeError<'tcx>, sp: Span) {
501+
let report_path_match = |did1: DefId, did2: DefId| {
502+
// Only external crates, if either is from a local
503+
// module we could have false positives
504+
if !(did1.is_local() || did2.is_local()) && did1.krate != did2.krate {
505+
let exp_path = self.tcx.with_path(did1,
506+
|p| p.map(|x| x.to_string())
507+
.collect::<Vec<_>>());
508+
let found_path = self.tcx.with_path(did2,
509+
|p| p.map(|x| x.to_string())
510+
.collect::<Vec<_>>());
511+
// We compare strings because PathMod and PathName can be different
512+
// for imported and non-imported crates
513+
if exp_path == found_path {
514+
let crate_name = self.tcx.sess.cstore
515+
.get_crate_data(did1.krate).name();
516+
self.tcx.sess.span_note(sp, &format!("Perhaps two different versions \
517+
of crate `{}` are being used?",
518+
crate_name));
519+
}
520+
}
521+
};
522+
match *terr {
523+
ty::TypeError::Sorts(ref exp_found) => {
524+
// if they are both "path types", there's a chance of ambiguity
525+
// due to different versions of the same crate
526+
match (&exp_found.expected.sty, &exp_found.found.sty) {
527+
(&ty::TyEnum(ref exp_adt, _), &ty::TyEnum(ref found_adt, _)) |
528+
(&ty::TyStruct(ref exp_adt, _), &ty::TyStruct(ref found_adt, _)) |
529+
(&ty::TyEnum(ref exp_adt, _), &ty::TyStruct(ref found_adt, _)) |
530+
(&ty::TyStruct(ref exp_adt, _), &ty::TyEnum(ref found_adt, _)) => {
531+
report_path_match(exp_adt.did, found_adt.did);
532+
},
533+
_ => ()
534+
}
535+
},
536+
ty::TypeError::Traits(ref exp_found) => {
537+
self.tcx.sess.note("errrr0");
538+
report_path_match(exp_found.expected, exp_found.found);
539+
},
540+
_ => () // FIXME(#22750) handle traits and stuff
541+
}
542+
}
543+
494544
fn report_and_explain_type_error(&self,
495545
trace: TypeTrace<'tcx>,
496546
terr: &ty::TypeError<'tcx>) {

branches/tmp/src/librustc/middle/ty.rs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5311,6 +5311,16 @@ impl<'tcx> TyS<'tcx> {
53115311
impl<'tcx> fmt::Display for TypeError<'tcx> {
53125312
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
53135313
use self::TypeError::*;
5314+
fn report_maybe_different(f: &mut fmt::Formatter,
5315+
expected: String, found: String) -> fmt::Result {
5316+
// A naive approach to making sure that we're not reporting silly errors such as:
5317+
// (expected closure, found closure).
5318+
if expected == found {
5319+
write!(f, "expected {}, found a different {}", expected, found)
5320+
} else {
5321+
write!(f, "expected {}, found {}", expected, found)
5322+
}
5323+
}
53145324

53155325
match *self {
53165326
CyclicTy => write!(f, "cyclic type of infinite size"),
@@ -5371,20 +5381,15 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
53715381
found bound lifetime parameter {}", br)
53725382
}
53735383
Sorts(values) => tls::with(|tcx| {
5374-
// A naive approach to making sure that we're not reporting silly errors such as:
5375-
// (expected closure, found closure).
5376-
let expected_str = values.expected.sort_string(tcx);
5377-
let found_str = values.found.sort_string(tcx);
5378-
if expected_str == found_str {
5379-
write!(f, "expected {}, found a different {}", expected_str, found_str)
5380-
} else {
5381-
write!(f, "expected {}, found {}", expected_str, found_str)
5382-
}
5384+
report_maybe_different(f, values.expected.sort_string(tcx),
5385+
values.found.sort_string(tcx))
53835386
}),
53845387
Traits(values) => tls::with(|tcx| {
5385-
write!(f, "expected trait `{}`, found trait `{}`",
5386-
tcx.item_path_str(values.expected),
5387-
tcx.item_path_str(values.found))
5388+
report_maybe_different(f,
5389+
format!("trait `{}`",
5390+
tcx.item_path_str(values.expected)),
5391+
format!("trait `{}`",
5392+
tcx.item_path_str(values.found)))
53885393
}),
53895394
BuiltinBoundsMismatch(values) => {
53905395
if values.expected.is_empty() {

branches/tmp/src/librustdoc/html/layout.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ r##"<!DOCTYPE html>
6262
6363
{before_content}
6464
65-
<section class="sidebar">
65+
<nav class="sidebar">
6666
{logo}
6767
{sidebar}
68-
</section>
68+
</nav>
6969
7070
<nav class="sub">
7171
<form class="search-form js-only">
@@ -83,10 +83,12 @@ r##"<!DOCTYPE html>
8383
8484
<section class="footer"></section>
8585
86-
<div id="help" class="hidden">
86+
<aside id="help" class="hidden">
8787
<div>
88+
<h1 class="hidden">Help</h1>
89+
8890
<div class="shortcuts">
89-
<h1>Keyboard Shortcuts</h1>
91+
<h2>Keyboard Shortcuts</h2>
9092
9193
<dl>
9294
<dt>?</dt>
@@ -103,7 +105,7 @@ r##"<!DOCTYPE html>
103105
</div>
104106
105107
<div class="infos">
106-
<h1>Search Tricks</h1>
108+
<h2>Search Tricks</h2>
107109
108110
<p>
109111
Prefix searches with a type followed by a colon (e.g.
@@ -123,7 +125,7 @@ r##"<!DOCTYPE html>
123125
</p>
124126
</div>
125127
</div>
126-
</div>
128+
</aside>
127129
128130
{after_content}
129131

branches/tmp/src/librustdoc/html/static/main.css

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ h3.impl, h3.method, h4.method, h3.type, h4.type {
104104
h3.impl, h3.method, h3.type {
105105
margin-top: 15px;
106106
}
107-
h1, h2, h3, h4, section.sidebar, a.source, .search-input, .content table :not(code)>a, .collapse-toggle {
107+
h1, h2, h3, h4, .sidebar, a.source, .search-input, .content table :not(code)>a, .collapse-toggle {
108108
font-family: "Fira Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
109109
}
110110

@@ -189,11 +189,16 @@ nav.sub {
189189
padding: 0 10px;
190190
margin-bottom: 14px;
191191
}
192-
.block h2 {
192+
.block h2, .block h3 {
193193
margin-top: 0;
194194
margin-bottom: 8px;
195195
text-align: center;
196196
}
197+
.block ul, .block li {
198+
margin: 0;
199+
padding: 0;
200+
list-style: none;
201+
}
197202

198203
.block a {
199204
display: block;
@@ -381,7 +386,7 @@ nav.main .separator {
381386
nav.sum { text-align: right; }
382387
nav.sub form { display: inline; }
383388

384-
nav, .content {
389+
nav.sub, .content {
385390
margin-left: 230px;
386391
}
387392

@@ -407,6 +412,7 @@ a {
407412
.content span.method, .content a.method, .block a.current.method { color: #8c6067; }
408413
.content span.tymethod, .content a.tymethod, .block a.current.tymethod { color: #8c6067; }
409414
.content .fnname { color: #8c6067; }
415+
.block a.current.crate { font-weight: 500; }
410416

411417
.search-input {
412418
width: 100%;
@@ -489,7 +495,7 @@ body.blur > :not(#help) {
489495
}
490496
#help dd { margin: 5px 33px; }
491497
#help .infos { padding-left: 0; }
492-
#help h1 { margin-top: 0; }
498+
#help h1, #help h2 { margin-top: 0; }
493499
#help > div div {
494500
width: 50%;
495501
float: left;

0 commit comments

Comments
 (0)