Skip to content

Commit 87e72c3

Browse files
committed
auto merge of #13006 : alexcrichton/rust/rollup, r=alexcrichton
Closes #13008 (Made the `clone_from` implementation for `~T` reuse the `T` itself if possible) Closes #13003 (Make method Vec::remove() public) Closes #13002 (disallow duplicate methods in trait impls) Closes #13000 (rustc: test: don't silently ignore bad benches) Closes #12999 (rustc: buffer the output writer for -Z ast-json[-noexpand].) Closes #12993 (syntax: Don't parameterize the the pretty printer) Closes #12990 (`char` reference: s/character/Unicode scalar value/) Closes #12987 (Move syntax-extension-hexfloat.rs) Closes #12983 (Fix linkage1 test which fails due to --as-needed) Closes #12978 (rustc: remove linker_private/linker_private_weak) Closes #12976 (libsyntax: librustdoc: ignore utf-8 BOM in .rs files) Closes #12973 (closes #12967 fix [en|de]coding of HashMap<K,V> where K is a numeric type) Closes #12972 (Add impl IntoStr for ::std::vec_ng::Vec<Ascii>) Closes #12968 (deny missing docs getopts) Closes #12965 (Documentation and formatting changes for option.rs.) Closes #12962 (Relax the memory ordering on the implementation of UnsafeArc) Closes #12958 (Typo fixes.) Closes #12950 (Docsprint: Document ops module, primarily Deref.) Closes #12946 (rustdoc: Implement cross-crate searching)
2 parents 891eab9 + 2a5e04c commit 87e72c3

File tree

33 files changed

+784
-238
lines changed

33 files changed

+784
-238
lines changed

src/doc/rust.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -3136,8 +3136,12 @@ machine.
31363136

31373137
The types `char` and `str` hold textual data.
31383138

3139-
A value of type `char` is a Unicode character,
3140-
represented as a 32-bit unsigned word holding a UCS-4 codepoint.
3139+
A value of type `char` is a [Unicode scalar value](
3140+
http://www.unicode.org/glossary/#unicode_scalar_value)
3141+
(ie. a code point that is not a surrogate),
3142+
represented as a 32-bit unsigned word in the 0x0000 to 0xD7FF
3143+
or 0xE000 to 0x10FFFF range.
3144+
A `[char]` vector is effectively an UCS-4 / UTF-32 string.
31413145

31423146
A value of type `str` is a Unicode string,
31433147
represented as a vector of 8-bit unsigned bytes holding a sequence of UTF-8 codepoints.

src/doc/rustdoc.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub fn recalibrate() {
4343
Doc comments are markdown, and are currently parsed with the
4444
[sundown][sundown] library. rustdoc does not yet do any fanciness such as
4545
referencing other items inline, like javadoc's `@see`. One exception to this
46-
is that the first paragrah will be used as the "summary" of an item in the
46+
is that the first paragraph will be used as the "summary" of an item in the
4747
generated documentation:
4848

4949
~~~
@@ -79,11 +79,11 @@ rustdoc can also generate JSON, for consumption by other tools, with
7979

8080
# Using the Documentation
8181

82-
The web pages generated by rustdoc present the same logical heirarchy that one
82+
The web pages generated by rustdoc present the same logical hierarchy that one
8383
writes a library with. Every kind of item (function, struct, etc) has its own
8484
color, and one can always click on a colored type to jump to its
8585
documentation. There is a search bar at the top, which is powered by some
86-
javascript and a statically-generated search index. No special web server is
86+
JavaScript and a statically-generated search index. No special web server is
8787
required for the search.
8888

8989
[sundown]: https://github.com/vmg/sundown/
@@ -108,7 +108,7 @@ code, the `ignore` string can be added to the three-backtick form of markdown
108108
code block.
109109

110110
/**
111-
# nested codefences confuse sundown => indentation + comment to
111+
# nested code fences confuse sundown => indentation + comment to
112112
# avoid failing tests
113113
```
114114
// This is a testable code block
@@ -126,7 +126,7 @@ You can specify that the test's execution should fail with the `should_fail`
126126
directive.
127127

128128
/**
129-
# nested codefences confuse sundown => indentation + comment to
129+
# nested code fences confuse sundown => indentation + comment to
130130
# avoid failing tests
131131
```should_fail
132132
// This code block is expected to generate a failure when run
@@ -138,7 +138,7 @@ You can specify that the code block should be compiled but not run with the
138138
`no_run` directive.
139139

140140
/**
141-
# nested codefences confuse sundown => indentation + comment to
141+
# nested code fences confuse sundown => indentation + comment to
142142
# avoid failing tests
143143
```no_run
144144
// This code will be compiled but not executed
@@ -153,7 +153,7 @@ testing the code block (NB. the space after the `#` is required, so
153153
that one can still write things like `#[deriving(Eq)]`).
154154

155155
/**
156-
# nested codefences confuse sundown => indentation + comment to
156+
# nested code fences confuse sundown => indentation + comment to
157157
# avoid failing tests
158158
```rust
159159
# /!\ The three following lines are comments, which are usually stripped off by
@@ -162,7 +162,7 @@ that one can still write things like `#[deriving(Eq)]`).
162162
# these first five lines but a non breakable one.
163163
#
164164
# // showing 'fib' in this documentation would just be tedious and detracts from
165-
# // what's actualy being documented.
165+
# // what's actually being documented.
166166
# fn fib(n: int) { n + 2 }
167167

168168
do spawn { fib(200); }
@@ -190,7 +190,7 @@ $ rustdoc --test lib.rs --test-args '--help'
190190
~~~
191191

192192
When testing a library, code examples will often show how functions are used,
193-
and this code often requires `use`-ing paths from the crate. To accomodate this,
193+
and this code often requires `use`-ing paths from the crate. To accommodate this,
194194
rustdoc will implicitly add `extern crate <crate>;` where `<crate>` is the name of
195195
the crate being tested to the top of each code example. This means that rustdoc
196196
must be able to find a compiled version of the library crate being tested. Extra

src/libgetopts/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
8484
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
8585
html_root_url = "http://static.rust-lang.org/doc/master")];
86-
#[allow(missing_doc)];
86+
#[deny(missing_doc)];
8787
#[allow(deprecated_owned_vector)];
8888

8989
#[feature(globs, phase)];

src/librustc/driver/driver.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ pub fn phase_1_parse_input(sess: &Session, cfg: ast::CrateConfig, input: &Input)
186186
});
187187

188188
if sess.opts.debugging_opts & session::AST_JSON_NOEXPAND != 0 {
189-
let mut stdout = io::stdout();
189+
let mut stdout = io::BufferedWriter::new(io::stdout());
190190
let mut json = json::PrettyEncoder::new(&mut stdout);
191191
krate.encode(&mut json);
192192
}
@@ -261,7 +261,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
261261
front::assign_node_ids_and_map::assign_node_ids_and_map(sess, krate));
262262

263263
if sess.opts.debugging_opts & session::AST_JSON != 0 {
264-
let mut stdout = io::stdout();
264+
let mut stdout = io::BufferedWriter::new(io::stdout());
265265
let mut json = json::PrettyEncoder::new(&mut stdout);
266266
krate.encode(&mut json);
267267
}
@@ -596,15 +596,15 @@ struct IdentifiedAnnotation;
596596

597597
impl pprust::PpAnn for IdentifiedAnnotation {
598598
fn pre(&self,
599-
s: &mut pprust::State<IdentifiedAnnotation>,
599+
s: &mut pprust::State,
600600
node: pprust::AnnNode) -> io::IoResult<()> {
601601
match node {
602602
pprust::NodeExpr(_) => s.popen(),
603603
_ => Ok(())
604604
}
605605
}
606606
fn post(&self,
607-
s: &mut pprust::State<IdentifiedAnnotation>,
607+
s: &mut pprust::State,
608608
node: pprust::AnnNode) -> io::IoResult<()> {
609609
match node {
610610
pprust::NodeItem(item) => {
@@ -634,15 +634,15 @@ struct TypedAnnotation {
634634
635635
impl pprust::PpAnn for TypedAnnotation {
636636
fn pre(&self,
637-
s: &mut pprust::State<TypedAnnotation>,
637+
s: &mut pprust::State,
638638
node: pprust::AnnNode) -> io::IoResult<()> {
639639
match node {
640640
pprust::NodeExpr(_) => s.popen(),
641641
_ => Ok(())
642642
}
643643
}
644644
fn post(&self,
645-
s: &mut pprust::State<TypedAnnotation>,
645+
s: &mut pprust::State,
646646
node: pprust::AnnNode) -> io::IoResult<()> {
647647
let tcx = &self.analysis.ty_cx;
648648
match node {

src/librustc/front/test.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,9 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
9595
debug!("current path: {}",
9696
ast_util::path_name_i(self.cx.path.get().as_slice()));
9797

98-
if is_test_fn(&self.cx, i) || is_bench_fn(i) {
98+
if is_test_fn(&self.cx, i) || is_bench_fn(&self.cx, i) {
9999
match i.node {
100-
ast::ItemFn(_, purity, _, _, _)
101-
if purity == ast::UnsafeFn => {
100+
ast::ItemFn(_, ast::UnsafeFn, _, _, _) => {
102101
let sess = self.cx.sess;
103102
sess.span_fatal(i.span,
104103
"unsafe functions cannot be used for \
@@ -109,7 +108,7 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
109108
let test = Test {
110109
span: i.span,
111110
path: self.cx.path.get(),
112-
bench: is_bench_fn(i),
111+
bench: is_bench_fn(&self.cx, i),
113112
ignore: is_ignored(&self.cx, i),
114113
should_fail: should_fail(i)
115114
};
@@ -233,7 +232,7 @@ fn is_test_fn(cx: &TestCtxt, i: @ast::Item) -> bool {
233232
return has_test_attr && has_test_signature(i);
234233
}
235234

236-
fn is_bench_fn(i: @ast::Item) -> bool {
235+
fn is_bench_fn(cx: &TestCtxt, i: @ast::Item) -> bool {
237236
let has_bench_attr = attr::contains_name(i.attrs.as_slice(), "bench");
238237

239238
fn has_test_signature(i: @ast::Item) -> bool {
@@ -254,6 +253,12 @@ fn is_bench_fn(i: @ast::Item) -> bool {
254253
}
255254
}
256255

256+
if has_bench_attr && !has_test_signature(i) {
257+
let sess = cx.sess;
258+
sess.span_err(i.span, "functions used as benches must have signature \
259+
`fn(&mut BenchHarness) -> ()`");
260+
}
261+
257262
return has_bench_attr && has_test_signature(i);
258263
}
259264

src/librustc/lib/llvm.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,22 @@ pub enum Visibility {
4343
ProtectedVisibility = 2,
4444
}
4545

46+
// This enum omits the obsolete (and no-op) linkage types DLLImportLinkage,
47+
// DLLExportLinkage, GhostLinkage and LinkOnceODRAutoHideLinkage.
48+
// LinkerPrivateLinkage and LinkerPrivateWeakLinkage are not included either;
49+
// they've been removed in upstream LLVM commit r203866.
4650
pub enum Linkage {
4751
ExternalLinkage = 0,
4852
AvailableExternallyLinkage = 1,
4953
LinkOnceAnyLinkage = 2,
5054
LinkOnceODRLinkage = 3,
51-
LinkOnceODRAutoHideLinkage = 4,
5255
WeakAnyLinkage = 5,
5356
WeakODRLinkage = 6,
5457
AppendingLinkage = 7,
5558
InternalLinkage = 8,
5659
PrivateLinkage = 9,
57-
DLLImportLinkage = 10,
58-
DLLExportLinkage = 11,
5960
ExternalWeakLinkage = 12,
60-
GhostLinkage = 13,
6161
CommonLinkage = 14,
62-
LinkerPrivateLinkage = 15,
63-
LinkerPrivateWeakLinkage = 16,
6462
}
6563

6664
#[deriving(Clone)]

src/librustc/middle/dataflow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ struct LoopScope<'a> {
8585

8686
impl<'a, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, O> {
8787
fn pre(&self,
88-
ps: &mut pprust::State<DataFlowContext<'a, O>>,
88+
ps: &mut pprust::State,
8989
node: pprust::AnnNode) -> io::IoResult<()> {
9090
let id = match node {
9191
pprust::NodeExpr(expr) => expr.id,

src/librustc/middle/trans/foreign.rs

-2
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@ pub fn llvm_linkage_by_name(name: &str) -> Option<Linkage> {
121121
"extern_weak" => Some(lib::llvm::ExternalWeakLinkage),
122122
"external" => Some(lib::llvm::ExternalLinkage),
123123
"internal" => Some(lib::llvm::InternalLinkage),
124-
"linker_private" => Some(lib::llvm::LinkerPrivateLinkage),
125-
"linker_private_weak" => Some(lib::llvm::LinkerPrivateWeakLinkage),
126124
"linkonce" => Some(lib::llvm::LinkOnceAnyLinkage),
127125
"linkonce_odr" => Some(lib::llvm::LinkOnceODRLinkage),
128126
"private" => Some(lib::llvm::PrivateLinkage),

src/librustc/middle/typeck/collect.rs

+7
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ use util::ppaux::Repr;
4848
use std::rc::Rc;
4949
use std::vec_ng::Vec;
5050
use std::vec_ng;
51+
use collections::HashSet;
52+
5153
use syntax::abi::AbiSet;
5254
use syntax::ast::{RegionTyParamBound, TraitTyParamBound};
5355
use syntax::ast;
@@ -478,7 +480,12 @@ fn convert_methods(ccx: &CrateCtxt,
478480
rcvr_visibility: ast::Visibility)
479481
{
480482
let tcx = ccx.tcx;
483+
let mut seen_methods = HashSet::new();
481484
for m in ms.iter() {
485+
if !seen_methods.insert(m.ident.repr(ccx.tcx)) {
486+
tcx.sess.span_err(m.span, "duplicate method in trait impl");
487+
}
488+
482489
let num_rcvr_ty_params = rcvr_ty_generics.type_param_defs().len();
483490
let m_ty_generics = ty_generics_for_fn_or_method(ccx, &m.generics,
484491
num_rcvr_ty_params);

0 commit comments

Comments
 (0)