Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rolling up some more PRs #13006

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1f4c630
Make method Vec::remove() public
Mar 18, 2014
1607871
rustc: disallow duplicate methods in trait impls
emberian Mar 18, 2014
f9e0baa
remove duplicate methods in impls
emberian Mar 18, 2014
873f740
rustc: test: don't silently ignore bad benches
emberian Mar 18, 2014
92f0bc2
rustc: buffer the output writer for -Z ast-json[-noexpand].
huonw Mar 18, 2014
87c7c03
syntax: Don't parameterize the the pretty printer
alexcrichton Mar 18, 2014
4ab95bc
`char`: s/character/Unicode scalar value/
SimonSapin Mar 18, 2014
083d423
Move syntax-extension-hexfloat.rs
nrc Mar 18, 2014
3301223
Fix linkage1 test which fails due to --as-needed
nrc Mar 17, 2014
c800c98
rustc: remove linker_private/linker_private_weak
bnoordhuis Mar 16, 2014
8f7a797
rustc: remove obsolete linkage types
bnoordhuis Mar 17, 2014
20e178c
libsyntax: librustdoc: ignore utf-8 BOM in .rs files
liigo Mar 18, 2014
2265512
closes #12967 fix [en|de]coding of HashMap<K,V> where K is a numeric …
olsonjeffery Mar 17, 2014
e627bce
Add impl IntoStr for ::std::vec_ng::Vec<Ascii>
Kroisse Mar 17, 2014
175bf94
deny missing docs
alan-andrade Mar 17, 2014
c297cff
Documentation and formatting changes for option.rs.
hatahet Mar 17, 2014
168cd3a
Relaxed the memory ordering on the implementation of UnsafeArc
Mar 17, 2014
783a00e
Typo fixes.
lkuper Mar 17, 2014
d717d61
Docsprint: Document ops module, primarily Deref.
mcpherrinm Mar 16, 2014
848f7b7
rustdoc: Implement cross-crate searching
alexcrichton Mar 16, 2014
1135966
Made the `clone_from` implementation for `~T` reuse the `T` itself if
Kimundi Mar 18, 2014
2a5e04c
Test fixes from the rollup
alexcrichton Mar 18, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/doc/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -3136,8 +3136,12 @@ machine.

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

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

A value of type `str` is a Unicode string,
represented as a vector of 8-bit unsigned bytes holding a sequence of UTF-8 codepoints.
Expand Down
18 changes: 9 additions & 9 deletions src/doc/rustdoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub fn recalibrate() {
Doc comments are markdown, and are currently parsed with the
[sundown][sundown] library. rustdoc does not yet do any fanciness such as
referencing other items inline, like javadoc's `@see`. One exception to this
is that the first paragrah will be used as the "summary" of an item in the
is that the first paragraph will be used as the "summary" of an item in the
generated documentation:

~~~
Expand Down Expand Up @@ -79,11 +79,11 @@ rustdoc can also generate JSON, for consumption by other tools, with

# Using the Documentation

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

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

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

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

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

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

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

When testing a library, code examples will often show how functions are used,
and this code often requires `use`-ing paths from the crate. To accomodate this,
and this code often requires `use`-ing paths from the crate. To accommodate this,
rustdoc will implicitly add `extern crate <crate>;` where `<crate>` is the name of
the crate being tested to the top of each code example. This means that rustdoc
must be able to find a compiled version of the library crate being tested. Extra
Expand Down
2 changes: 1 addition & 1 deletion src/libgetopts/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://static.rust-lang.org/doc/master")];
#[allow(missing_doc)];
#[deny(missing_doc)];
#[allow(deprecated_owned_vector)];

#[feature(globs, phase)];
Expand Down
12 changes: 6 additions & 6 deletions src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ pub fn phase_1_parse_input(sess: &Session, cfg: ast::CrateConfig, input: &Input)
});

if sess.opts.debugging_opts & session::AST_JSON_NOEXPAND != 0 {
let mut stdout = io::stdout();
let mut stdout = io::BufferedWriter::new(io::stdout());
let mut json = json::PrettyEncoder::new(&mut stdout);
krate.encode(&mut json);
}
Expand Down Expand Up @@ -261,7 +261,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
front::assign_node_ids_and_map::assign_node_ids_and_map(sess, krate));

if sess.opts.debugging_opts & session::AST_JSON != 0 {
let mut stdout = io::stdout();
let mut stdout = io::BufferedWriter::new(io::stdout());
let mut json = json::PrettyEncoder::new(&mut stdout);
krate.encode(&mut json);
}
Expand Down Expand Up @@ -596,15 +596,15 @@ struct IdentifiedAnnotation;

impl pprust::PpAnn for IdentifiedAnnotation {
fn pre(&self,
s: &mut pprust::State<IdentifiedAnnotation>,
s: &mut pprust::State,
node: pprust::AnnNode) -> io::IoResult<()> {
match node {
pprust::NodeExpr(_) => s.popen(),
_ => Ok(())
}
}
fn post(&self,
s: &mut pprust::State<IdentifiedAnnotation>,
s: &mut pprust::State,
node: pprust::AnnNode) -> io::IoResult<()> {
match node {
pprust::NodeItem(item) => {
Expand Down Expand Up @@ -634,15 +634,15 @@ struct TypedAnnotation {

impl pprust::PpAnn for TypedAnnotation {
fn pre(&self,
s: &mut pprust::State<TypedAnnotation>,
s: &mut pprust::State,
node: pprust::AnnNode) -> io::IoResult<()> {
match node {
pprust::NodeExpr(_) => s.popen(),
_ => Ok(())
}
}
fn post(&self,
s: &mut pprust::State<TypedAnnotation>,
s: &mut pprust::State,
node: pprust::AnnNode) -> io::IoResult<()> {
let tcx = &self.analysis.ty_cx;
match node {
Expand Down
15 changes: 10 additions & 5 deletions src/librustc/front/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,9 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
debug!("current path: {}",
ast_util::path_name_i(self.cx.path.get().as_slice()));

if is_test_fn(&self.cx, i) || is_bench_fn(i) {
if is_test_fn(&self.cx, i) || is_bench_fn(&self.cx, i) {
match i.node {
ast::ItemFn(_, purity, _, _, _)
if purity == ast::UnsafeFn => {
ast::ItemFn(_, ast::UnsafeFn, _, _, _) => {
let sess = self.cx.sess;
sess.span_fatal(i.span,
"unsafe functions cannot be used for \
Expand All @@ -109,7 +108,7 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
let test = Test {
span: i.span,
path: self.cx.path.get(),
bench: is_bench_fn(i),
bench: is_bench_fn(&self.cx, i),
ignore: is_ignored(&self.cx, i),
should_fail: should_fail(i)
};
Expand Down Expand Up @@ -233,7 +232,7 @@ fn is_test_fn(cx: &TestCtxt, i: @ast::Item) -> bool {
return has_test_attr && has_test_signature(i);
}

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

fn has_test_signature(i: @ast::Item) -> bool {
Expand All @@ -254,6 +253,12 @@ fn is_bench_fn(i: @ast::Item) -> bool {
}
}

if has_bench_attr && !has_test_signature(i) {
let sess = cx.sess;
sess.span_err(i.span, "functions used as benches must have signature \
`fn(&mut BenchHarness) -> ()`");
}

return has_bench_attr && has_test_signature(i);
}

Expand Down
10 changes: 4 additions & 6 deletions src/librustc/lib/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,22 @@ pub enum Visibility {
ProtectedVisibility = 2,
}

// This enum omits the obsolete (and no-op) linkage types DLLImportLinkage,
// DLLExportLinkage, GhostLinkage and LinkOnceODRAutoHideLinkage.
// LinkerPrivateLinkage and LinkerPrivateWeakLinkage are not included either;
// they've been removed in upstream LLVM commit r203866.
pub enum Linkage {
ExternalLinkage = 0,
AvailableExternallyLinkage = 1,
LinkOnceAnyLinkage = 2,
LinkOnceODRLinkage = 3,
LinkOnceODRAutoHideLinkage = 4,
WeakAnyLinkage = 5,
WeakODRLinkage = 6,
AppendingLinkage = 7,
InternalLinkage = 8,
PrivateLinkage = 9,
DLLImportLinkage = 10,
DLLExportLinkage = 11,
ExternalWeakLinkage = 12,
GhostLinkage = 13,
CommonLinkage = 14,
LinkerPrivateLinkage = 15,
LinkerPrivateWeakLinkage = 16,
}

#[deriving(Clone)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ struct LoopScope<'a> {

impl<'a, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, O> {
fn pre(&self,
ps: &mut pprust::State<DataFlowContext<'a, O>>,
ps: &mut pprust::State,
node: pprust::AnnNode) -> io::IoResult<()> {
let id = match node {
pprust::NodeExpr(expr) => expr.id,
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/middle/trans/foreign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ pub fn llvm_linkage_by_name(name: &str) -> Option<Linkage> {
"extern_weak" => Some(lib::llvm::ExternalWeakLinkage),
"external" => Some(lib::llvm::ExternalLinkage),
"internal" => Some(lib::llvm::InternalLinkage),
"linker_private" => Some(lib::llvm::LinkerPrivateLinkage),
"linker_private_weak" => Some(lib::llvm::LinkerPrivateWeakLinkage),
"linkonce" => Some(lib::llvm::LinkOnceAnyLinkage),
"linkonce_odr" => Some(lib::llvm::LinkOnceODRLinkage),
"private" => Some(lib::llvm::PrivateLinkage),
Expand Down
7 changes: 7 additions & 0 deletions src/librustc/middle/typeck/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ use util::ppaux::Repr;
use std::rc::Rc;
use std::vec_ng::Vec;
use std::vec_ng;
use collections::HashSet;

use syntax::abi::AbiSet;
use syntax::ast::{RegionTyParamBound, TraitTyParamBound};
use syntax::ast;
Expand Down Expand Up @@ -478,7 +480,12 @@ fn convert_methods(ccx: &CrateCtxt,
rcvr_visibility: ast::Visibility)
{
let tcx = ccx.tcx;
let mut seen_methods = HashSet::new();
for m in ms.iter() {
if !seen_methods.insert(m.ident.repr(ccx.tcx)) {
tcx.sess.span_err(m.span, "duplicate method in trait impl");
}

let num_rcvr_ty_params = rcvr_ty_generics.type_param_defs().len();
let m_ty_generics = ty_generics_for_fn_or_method(ccx, &m.generics,
num_rcvr_ty_params);
Expand Down
Loading