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

Check pandoc's version correctly for >=1.10. #3801

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
bdc1b7a
libcore: add a str::with_capacity to match the fn in vec
erickt Oct 9, 2012
25096a2
rustc: fix size computation of structs for the FFI
Blei Oct 10, 2012
97ecde2
Conditional usage of LLVM DebugFlag
lucab Oct 8, 2012
01aaeef
Use gpgv for signature verification in cargo
lucab Oct 14, 2012
ab89b5c
libstd: make Serializer a trait-level typaram
erickt Oct 13, 2012
f6211ab
Add various test cases (xfailed)
catamorphism Oct 15, 2012
7237268
Allow enum discriminator exprs to refer to declared consts
catamorphism Oct 15, 2012
0643466
Fix whitespace
catamorphism Oct 15, 2012
2a1aa9f
Check whether loans conflict with old loans or with themselves.
nikomatsakis Oct 14, 2012
c886629
rustc: Implement monomorphic default methods. r=nmatsakis
pcwalton Oct 8, 2012
4f9e7ba
Un-xfail test for #3521; it works now
catamorphism Oct 15, 2012
c5b82a6
Add test cases for #3668
catamorphism Oct 15, 2012
91ae541
rustc: Merge module and type namespaces. r=brson
pcwalton Oct 15, 2012
7d84505
Error out in resolve if structs try to capture type parameters
catamorphism Oct 15, 2012
d293286
Add test case for Issue 2895
catamorphism Oct 16, 2012
bbc46d5
Add test for Issue 2823
catamorphism Oct 16, 2012
b38092e
In ty::normalize_ty, don't replace self_regions with None
catamorphism Oct 16, 2012
4dc67c5
rustc: Implement intra-crate static methods on anonymous trait implem…
pcwalton Oct 16, 2012
a92c3db
add missing pub from multifile example in sec 12.3
nikomatsakis Oct 17, 2012
1679960
Change a use of map::get to map::find
catamorphism Oct 17, 2012
081a043
Remove integer suffixes
catamorphism Oct 17, 2012
47c83f1
Export std::net_url::encode_component
catamorphism Oct 17, 2012
7f12cc4
Merge pull request #3716 from Blei/fix-3656
catamorphism Oct 17, 2012
ebce097
Merge pull request #3706 from erickt/str-with-capacity
catamorphism Oct 17, 2012
f5e71f5
Merge pull request #3719 from lucab/lucab/to-upstream/pull-2
catamorphism Oct 17, 2012
5cf0c65
Merge pull request #3764 from lucab/lucab/to-upstream/pull-3
catamorphism Oct 17, 2012
e94e82c
Extraneous sigil patrol: ~"string literals"
bstrie Oct 12, 2012
5e1d0ba
Sigil patrol: change fn@ fn& fn~ to @fn &fn ~fn
bstrie Oct 13, 2012
f7ce3dc
Extraneous sigil patrol: turn &[] literals into []
bstrie Oct 13, 2012
ca5506a
fix the indentation of foreign constant
crabtw Oct 8, 2012
66151d0
remove duplicate visibility and fix indentation
crabtw Oct 14, 2012
7236472
word => word_space
catamorphism Oct 17, 2012
b532a8e
Line length
catamorphism Oct 17, 2012
32baf1c
Add a module to getopts to support verbose option definition
killerswan Oct 11, 2012
f2544d8
Fix long lines
catamorphism Oct 17, 2012
fd6be2f
std::treemap - changing types to reflect constraints, adding equality…
Oct 4, 2012
bbc90b6
Fix whitespace
catamorphism Oct 17, 2012
33adb7a
Merge pull request #3739 from killerswan/usagemsg
catamorphism Oct 17, 2012
cf8bded
Enable configure to detect 32 bit systems on 64 bit kernels
arkaitzj Oct 16, 2012
d9f1426
Fix copy warnings in str
catamorphism Oct 17, 2012
7dde840
Fix copy warnings in str
catamorphism Oct 17, 2012
e7e1bab
libsyntax: refactor the parser to consider foreign items as items
Blei Oct 9, 2012
fdd7b4d
core: first working sketch of a condition system.
graydon Oct 17, 2012
0f2fc71
Add examples to the parsing limitations section of the macro tutorial.
paulstansifer Oct 18, 2012
e28a161
Merge pull request #3799 from paulstansifer/master
catamorphism Oct 18, 2012
2c1ed18
Check pandoc's version correctly for >=1.10.
Oct 18, 2012
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
16 changes: 13 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,16 @@ case $CFG_CPUTYPE in
err "unknown CPU type: $CFG_CPUTYPE"
esac

# Detect 64 bit linux systems with 32 bit userland and force 32 bit compilation
if [ $CFG_OSTYPE = unknown-linux-gnu -a $CFG_CPUTYPE = x86_64 ]
then
file -L "$SHELL" | grep -q "x86[_-]64"
if [ $? != 0 ]; then
CFG_CPUTYPE=i686
fi
fi


DEFAULT_HOST_TRIPLE="${CFG_CPUTYPE}-${CFG_OSTYPE}"

CFG_SRC_DIR="$(cd $(dirname $0) && pwd)/"
Expand Down Expand Up @@ -352,10 +362,10 @@ fi

if [ ! -z "$CFG_PANDOC" ]
then
PV=$(pandoc --version | awk '/^pandoc/ {print $2}')
if [ "$PV" \< "1.8" ]
read PV_MAJOR PV_MINOR <<<$(pandoc --version | awk '/^pandoc/ {split($2, PV, "."); print PV[1] " " PV[2]}')
if [ "$PV_MAJOR" -lt "1" ] || [ "$PV_MINOR" -lt "8" ]
then
step_msg "pandoc $PV is too old. disabling"
step_msg "pandoc $PV_MAJOR.$PV_MINOR is too old. disabling"
BAD_PANDOC=1
fi
fi
Expand Down
21 changes: 13 additions & 8 deletions doc/tutorial-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,22 @@ If it is under more, it'll be repeated, as appropriate.

## Parsing limitations

The macro parser will parse Rust syntax with two limitations:

1. The parser will always parse as much as possible. For example, if the comma
were omitted from the syntax of `early_return!` above, `input_1 [` would've
been interpreted as the beginning of an array index. In fact, invoking the
macro would have been impossible.
2. The parser must have eliminated all ambiguity by the time it reaches a
For technical reasons, there are two limitations to the treatment of syntax
fragments by the macro parser:

1. The parser will always parse as much as possible of a Rust syntactic
fragment. For example, if the comma were omitted from the syntax of
`early_return!` above, `input_1 [` would've been interpreted as the beginning
of an array index. In fact, invoking the macro would have been impossible.
2. The parser must have eliminated all ambiguity by the time it reaches a
`$name:fragment_specifier` declaration. This limitation can result in parse
errors when declarations occur at the beginning of, or immediately after,
a `$(...)*`. Changing the invocation syntax to require a distinctive
token in front can solve the problem.
a `$(...)*`. For example, the grammar `$($t:ty)* $e:expr` will always fail to
parse because the parser would be forced to choose between parsing `t` and
parsing `e`. Changing the invocation syntax to require a distinctive token in
front can solve the problem. In the above example, `$(T $t:ty)* E $e:exp`
solves the problem.

## A final note

Expand Down
66 changes: 26 additions & 40 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -1502,9 +1502,9 @@ and [`core::str`]. Here are some examples.
# fn unwrap_crayon(c: Crayon) -> int { 0 }
# fn eat_crayon_wax(i: int) { }
# fn store_crayon_in_nasal_cavity(i: uint, c: Crayon) { }
# fn crayon_to_str(c: Crayon) -> ~str { ~"" }
# fn crayon_to_str(c: Crayon) -> &str { "" }

let crayons = &[Almond, AntiqueBrass, Apricot];
let crayons = [Almond, AntiqueBrass, Apricot];

// Check the length of the vector
assert crayons.len() == 3;
Expand Down Expand Up @@ -1569,7 +1569,7 @@ let bloop = |well, oh: mygoodness| -> what_the { fail oh(well) };
~~~~

There are several forms of closure, each with its own role. The most
common, called a _stack closure_, has type `fn&` and can directly
common, called a _stack closure_, has type `&fn` and can directly
access local variables in the enclosing scope.

~~~~
Expand All @@ -1591,7 +1591,7 @@ pervasively in Rust code.
When you need to store a closure in a data structure, a stack closure
will not do, since the compiler will refuse to let you store it. For
this purpose, Rust provides a type of closure that has an arbitrary
lifetime, written `fn@` (boxed closure, analogous to the `@` pointer
lifetime, written `@fn` (boxed closure, analogous to the `@` pointer
type described earlier). This type of closure *is* first-class.

A managed closure does not directly access its environment, but merely
Expand All @@ -1604,8 +1604,9 @@ returns it from a function, and then calls it:

~~~~
# extern mod std;
fn mk_appender(suffix: ~str) -> fn@(~str) -> ~str {
return fn@(s: ~str) -> ~str { s + suffix };
fn mk_appender(suffix: ~str) -> @fn(~str) -> ~str {
// The compiler knows that we intend this closure to be of type @fn
return |s| s + suffix;
}

fn main() {
Expand All @@ -1614,22 +1615,9 @@ fn main() {
}
~~~~

This example uses the long closure syntax, `fn@(s: ~str) ...`. Using
this syntax makes it explicit that we are declaring a boxed
closure. In practice, boxed closures are usually defined with the
short closure syntax introduced earlier, in which case the compiler
infers the type of closure. Thus our managed closure example could
also be written:

~~~~
fn mk_appender(suffix: ~str) -> fn@(~str) -> ~str {
return |s| s + suffix;
}
~~~~

## Owned closures

Owned closures, written `fn~` in analogy to the `~` pointer type,
Owned closures, written `~fn` in analogy to the `~` pointer type,
hold on to things that can safely be sent between
processes. They copy the values they close over, much like managed
closures, but they also own them: that is, no other code can access
Expand All @@ -1649,12 +1637,10 @@ callers may pass any kind of closure.

~~~~
fn call_twice(f: fn()) { f(); f(); }
call_twice(|| { ~"I am an inferred stack closure"; } );
call_twice(fn&() { ~"I am also a stack closure"; } );
call_twice(fn@() { ~"I am a managed closure"; });
call_twice(fn~() { ~"I am an owned closure"; });
fn bare_function() { ~"I am a plain function"; }
call_twice(bare_function);
let closure = || { "I'm a closure, and it doesn't matter what type I am"; };
fn function() { "I'm a normal function"; }
call_twice(closure);
call_twice(function);
~~~~

> ***Note:*** Both the syntax and the semantics will be changing
Expand Down Expand Up @@ -1693,7 +1679,7 @@ structure.
~~~~
# fn each(v: &[int], op: fn(v: &int)) { }
# fn do_some_work(i: &int) { }
each(&[1, 2, 3], |n| {
each([1, 2, 3], |n| {
do_some_work(n);
});
~~~~
Expand All @@ -1704,7 +1690,7 @@ call that can be written more like a built-in control structure:
~~~~
# fn each(v: &[int], op: fn(v: &int)) { }
# fn do_some_work(i: &int) { }
do each(&[1, 2, 3]) |n| {
do each([1, 2, 3]) |n| {
do_some_work(n);
}
~~~~
Expand All @@ -1715,7 +1701,7 @@ parentheses, where it looks more like a typical block of
code.

`do` is a convenient way to create tasks with the `task::spawn`
function. `spawn` has the signature `spawn(fn: fn~())`. In other
function. `spawn` has the signature `spawn(fn: ~fn())`. In other
words, it is a function that takes an owned closure that takes no
arguments.

Expand Down Expand Up @@ -1765,9 +1751,9 @@ And using this function to iterate over a vector:
~~~~
# use each = vec::each;
# use println = io::println;
each(&[2, 4, 8, 5, 16], |n| {
each([2, 4, 8, 5, 16], |n| {
if *n % 2 != 0 {
println(~"found odd number!");
println("found odd number!");
false
} else { true }
});
Expand All @@ -1782,9 +1768,9 @@ to the next iteration, write `loop`.
~~~~
# use each = vec::each;
# use println = io::println;
for each(&[2, 4, 8, 5, 16]) |n| {
for each([2, 4, 8, 5, 16]) |n| {
if *n % 2 != 0 {
println(~"found odd number!");
println("found odd number!");
break;
}
}
Expand Down Expand Up @@ -1967,12 +1953,12 @@ impl int: Printable {
fn print() { io::println(fmt!("%d", self)) }
}

impl ~str: Printable {
impl &str: Printable {
fn print() { io::println(self) }
}

# 1.print();
# (~"foo").print();
# ("foo").print();
~~~~

Methods defined in an implementation of a trait may be called just like
Expand Down Expand Up @@ -2120,7 +2106,7 @@ impl @Rectangle: Drawable { fn draw() { ... } }

let c: @Circle = @new_circle();
let r: @Rectangle = @new_rectangle();
draw_all(&[c as @Drawable, r as @Drawable]);
draw_all([c as @Drawable, r as @Drawable]);
~~~~

We omit the code for `new_circle` and `new_rectangle`; imagine that
Expand Down Expand Up @@ -2162,8 +2148,8 @@ additional modules.

~~~~
mod farm {
pub fn chicken() -> ~str { ~"cluck cluck" }
pub fn cow() -> ~str { ~"mooo" }
pub fn chicken() -> &str { "cluck cluck" }
pub fn cow() -> &str { "mooo" }
}

fn main() {
Expand Down Expand Up @@ -2360,13 +2346,13 @@ these two files:
~~~~
// world.rs
#[link(name = "world", vers = "1.0")];
fn explore() -> ~str { ~"world" }
pub fn explore() -> &str { "world" }
~~~~

~~~~ {.xfail-test}
// main.rs
extern mod world;
fn main() { io::println(~"hello " + world::explore()); }
fn main() { io::println("hello " + world::explore()); }
~~~~

Now compile and run like this (adjust to your platform if necessary):
Expand Down
37 changes: 18 additions & 19 deletions src/cargo/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1162,20 +1162,20 @@ fn sync_one_file(c: &Cargo, dir: &Path, src: @Source) -> bool {
}
match (src.key, src.keyfp) {
(Some(_), Some(f)) => {
let r = pgp::verify(&c.root, &pkgfile, &sigfile, f);
let r = pgp::verify(&c.root, &pkgfile, &sigfile);

if !r {
error(fmt!("signature verification failed for source %s",
name));
error(fmt!("signature verification failed for source %s with \
key %s", name, f));
return false;
}

if has_src_file {
let e = pgp::verify(&c.root, &srcfile, &srcsigfile, f);
let e = pgp::verify(&c.root, &srcfile, &srcsigfile);

if !e {
error(fmt!("signature verification failed for source %s",
name));
error(fmt!("signature verification failed for source %s \
with key %s", name, f));
return false;
}
}
Expand Down Expand Up @@ -1273,21 +1273,21 @@ fn sync_one_git(c: &Cargo, dir: &Path, src: @Source) -> bool {
}
match (src.key, src.keyfp) {
(Some(_), Some(f)) => {
let r = pgp::verify(&c.root, &pkgfile, &sigfile, f);
let r = pgp::verify(&c.root, &pkgfile, &sigfile);

if !r {
error(fmt!("signature verification failed for source %s",
name));
error(fmt!("signature verification failed for source %s with \
key %s", name, f));
rollback(name, dir, false);
return false;
}

if has_src_file {
let e = pgp::verify(&c.root, &srcfile, &srcsigfile, f);
let e = pgp::verify(&c.root, &srcfile, &srcsigfile);

if !e {
error(fmt!("signature verification failed for source %s",
name));
error(fmt!("signature verification failed for source %s \
with key %s", name, f));
rollback(name, dir, false);
return false;
}
Expand Down Expand Up @@ -1370,11 +1370,11 @@ fn sync_one_curl(c: &Cargo, dir: &Path, src: @Source) -> bool {
return false;
}

let r = pgp::verify(&c.root, &pkgfile, &sigfile, f);
let r = pgp::verify(&c.root, &pkgfile, &sigfile);

if !r {
error(fmt!("signature verification failed for source %s",
name));
error(fmt!("signature verification failed for source %s with \
key %s", name, f));
return false;
}

Expand All @@ -1390,11 +1390,11 @@ fn sync_one_curl(c: &Cargo, dir: &Path, src: @Source) -> bool {
return false;
}

let e = pgp::verify(&c.root, &srcfile, &srcsigfile, f);
let e = pgp::verify(&c.root, &srcfile, &srcsigfile);

if !e {
error(~"signature verification failed for " +
~"source " + name);
~"source " + name + ~" with key " + f);
return false;
}
}
Expand Down Expand Up @@ -1463,8 +1463,7 @@ fn cmd_init(c: &Cargo) {
return;
}

let r = pgp::verify(&c.root, &srcfile, &sigfile,
pgp::signing_key_fp());
let r = pgp::verify(&c.root, &srcfile, &sigfile);
if !r {
error(fmt!("signature verification failed for '%s'",
srcfile.to_str()));
Expand Down
23 changes: 11 additions & 12 deletions src/cargo/pgp.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn gpg(args: ~[~str]) -> { status: int, out: ~str, err: ~str } {
return run::program_output(~"gpg", args);
fn gpgv(args: ~[~str]) -> { status: int, out: ~str, err: ~str } {
return run::program_output(~"gpgv", args);
}

fn signing_key() -> ~str {
Expand Down Expand Up @@ -59,7 +59,7 @@ fn signing_key_fp() -> ~str {
}

fn supported() -> bool {
let r = gpg(~[~"--version"]);
let r = gpgv(~[~"--version"]);
r.status == 0
}

Expand Down Expand Up @@ -88,15 +88,14 @@ fn add(root: &Path, key: &Path) {
}
}

fn verify(root: &Path, data: &Path, sig: &Path, keyfp: ~str) -> bool {
fn verify(root: &Path, data: &Path, sig: &Path) -> bool {
let path = root.push("gpg");
let p = gpg(~[~"--homedir", path.to_str(),
~"--with-fingerprint",
~"--verify", sig.to_str(),
data.to_str()]);
let res = ~"Primary key fingerprint: " + keyfp;
for str::split_char_each(p.err, '\n') |line| {
if line == res { return true; }
let res = gpgv(~[~"--homedir", path.to_str(),
~"--keyring", ~"pubring.gpg",
~"--verbose",
sig.to_str(), data.to_str()]);
if res.status != 0 {
return false;
}
return false;
return true;
}
Loading