From 8474af03218101e1b6adae323dcd840ffc267158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Marie?= Date: Mon, 21 Sep 2015 19:17:25 +0200 Subject: [PATCH 01/10] run-make: search libstdc++ in /usr/local/lib too extend the search path of libraries to /usr/local/lib in `run-make` testsuite. It should permit to find libstdc++.so on usual directory. --- src/test/run-make/tools.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/run-make/tools.mk b/src/test/run-make/tools.mk index 14d8e468f50d3..23af568697f9f 100644 --- a/src/test/run-make/tools.mk +++ b/src/test/run-make/tools.mk @@ -85,6 +85,11 @@ ifeq ($(UNAME),Bitrig) else ifeq ($(UNAME),OpenBSD) EXTRACFLAGS := -lm -lpthread + # extend search lib for found estdc++ if build using gcc from + # ports under OpenBSD. This is needed for: + # - run-make/execution-engine + # - run-make/issue-19371 + RUSTC := $(RUSTC) -L/usr/local/lib else EXTRACFLAGS := -lm -lrt -ldl -lpthread EXTRACXXFLAGS := -lstdc++ From 54792febe063f8dd013576121ec56c80142a26eb Mon Sep 17 00:00:00 2001 From: Seo Sanghyeon Date: Wed, 23 Sep 2015 11:52:37 +0900 Subject: [PATCH 02/10] Do not traverse RHS of assignment twice for unused variables lint walk_expr includes call to visit_expr for subexpressions. --- src/librustc/middle/liveness.rs | 3 +-- src/test/compile-fail/issue-22599.rs | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 src/test/compile-fail/issue-22599.rs diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 9bb19bb37d8e4..7eb8f7c9806ff 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -1399,9 +1399,8 @@ fn check_arm(this: &mut Liveness, arm: &hir::Arm) { fn check_expr(this: &mut Liveness, expr: &Expr) { match expr.node { - hir::ExprAssign(ref l, ref r) => { + hir::ExprAssign(ref l, _) => { this.check_lvalue(&**l); - this.visit_expr(&**r); visit::walk_expr(this, expr); } diff --git a/src/test/compile-fail/issue-22599.rs b/src/test/compile-fail/issue-22599.rs new file mode 100644 index 0000000000000..b9ea358329677 --- /dev/null +++ b/src/test/compile-fail/issue-22599.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(unused_variables)] + +fn f(_: i32) {} + +fn main() { + let mut v = 0; + f(v); + v = match 0 { a => 0 }; //~ ERROR: unused variable: `a` + f(v); +} From 3b42b60bf675214d668b92b4791d58b63b143f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Marie?= Date: Wed, 23 Sep 2015 06:39:42 +0200 Subject: [PATCH 03/10] unbreak openbsd after netbsd integration separate use code between openbsd/netbsd. netbsd use c_int and c_uint, but openbsd not, resulting a unused_import error. --- src/liblibc/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index fc6bd6c016719..2ee69543c3cf3 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -1683,10 +1683,12 @@ pub mod types { pub mod posix01 { use types::common::c95::{c_void}; use types::common::c99::{uint32_t, uint64_t}; - use types::os::arch::c95::{c_int, c_uint, c_long, time_t}; + use types::os::arch::c95::{c_long, time_t}; use types::os::arch::posix88::{dev_t, gid_t}; use types::os::arch::posix88::{mode_t, off_t}; use types::os::arch::posix88::{uid_t}; + #[cfg(target_os = "netbsd")] + use types::os::arch::c95::{c_int, c_uint}; pub type nlink_t = uint32_t; pub type blksize_t = uint32_t; From f78115434c78d6d0aa7ecca7276cdd709c06cff6 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Wed, 23 Sep 2015 11:43:49 -0400 Subject: [PATCH 04/10] Make lexer tooling message more generic We don't actually probe for javac in all circumstances, so if you have javac installed, but don't have antlr4 installed, and you're on Mac OS X, then you'll get a message that javac is missing, even though that's wrong. To fix this, let's just be a bit more generic in the message, so that it's the same no matter what part of the lexer tests you're missing. cc https://www.reddit.com/r/rust/comments/3m199d/running_make_check_on_the_source_code_says_javac/ --- mk/grammar.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mk/grammar.mk b/mk/grammar.mk index d9c66e282bc4e..0d527bd068860 100644 --- a/mk/grammar.mk +++ b/mk/grammar.mk @@ -58,17 +58,17 @@ check-lexer: $(BG) $(BG)RustLexer.class check-build-lexer-verifier $(Q)$(SG)check.sh $(S) "$(BG)" \ "$(CFG_GRUN)" "$(BG)verify" "$(BG)RustLexer.tokens" else -$(info cfg: grun not available, skipping lexer test...) +$(info cfg: lexer tooling not available, skipping lexer test...) check-lexer: endif else -$(info cfg: antlr4 not available, skipping lexer test...) +$(info cfg: lexer tooling not available, skipping lexer test...) check-lexer: endif else -$(info cfg: javac not available, skipping lexer test...) +$(info cfg: lexer tooling not available, skipping lexer test...) check-lexer: endif From 30fbf44fbc3d844c3e609bffa239151d5efcbccd Mon Sep 17 00:00:00 2001 From: Remi Rampin Date: Wed, 23 Sep 2015 14:35:53 -0400 Subject: [PATCH 05/10] Fix bad copypasta for patterns doc in std::str --- src/libcollections/str.rs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 23c21a732b520..2f74ab5026e92 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -715,8 +715,7 @@ impl str { /// Returns `None` if it doesn't exist. /// /// The pattern can be a simple `&str`, `char`, or a closure that - /// determines the - /// split. + /// determines if a character matches. /// /// # Examples /// @@ -760,7 +759,7 @@ impl str { /// Returns `None` if it doesn't exist. /// /// The pattern can be a simple `&str`, `char`, - /// or a closure that determines the split. + /// or a closure that determines if a character matches. /// /// # Examples /// @@ -1096,7 +1095,7 @@ impl str { /// An iterator over the matches of a pattern within `self`. /// /// The pattern can be a simple `&str`, `char`, or a closure that - /// determines the split. + /// determines if a character matches. /// Additional libraries might provide more complex patterns like /// regular expressions. /// @@ -1129,7 +1128,7 @@ impl str { /// reverse order. /// /// The pattern can be a simple `&str`, `char`, or a closure that - /// determines the split. + /// determines if a character matches. /// Additional libraries might provide more complex patterns like /// regular expressions. /// @@ -1166,8 +1165,7 @@ impl str { /// match are returned. /// /// The pattern can be a simple `&str`, `char`, or a closure that - /// determines - /// the split. + /// determines if a character matches. /// Additional libraries might provide more complex patterns like /// regular expressions. /// @@ -1214,8 +1212,7 @@ impl str { /// match are returned. /// /// The pattern can be a simple `&str`, `char`, or a closure that - /// determines - /// the split. + /// determines if a character matches. /// Additional libraries might provide more complex patterns like /// regular expressions. /// @@ -1296,7 +1293,7 @@ impl str { /// repeatedly removed. /// /// The pattern can be a simple `char`, or a closure that determines - /// the split. + /// if a character matches. /// /// # Examples /// @@ -1326,7 +1323,7 @@ impl str { /// repeatedly removed. /// /// The pattern can be a simple `&str`, `char`, or a closure that - /// determines the split. + /// determines if a character matches. /// /// # Examples /// @@ -1346,7 +1343,7 @@ impl str { /// repeatedly removed. /// /// The pattern can be a simple `&str`, `char`, or a closure that - /// determines the split. + /// determines if a character matches. /// /// # Examples /// From 5f73037b8a556d393d2960bb7986131726ddd78c Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Thu, 24 Sep 2015 07:50:44 +0200 Subject: [PATCH 06/10] reference: not sure this is the right place to discuss design --- src/doc/reference.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index 83849574260e1..1aad12c08b957 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -4036,10 +4036,6 @@ In general, `--crate-type=bin` or `--crate-type=lib` should be sufficient for all compilation needs, and the other options are just available if more fine-grained control is desired over the output format of a Rust crate. -# Appendix: Rationales and design trade-offs - -*TODO*. - # Appendix: Influences Rust is not a particularly original language, with design elements coming from From e0f35da9c1839aced4b0db840486b6da0742f444 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Thu, 24 Sep 2015 07:55:59 +0200 Subject: [PATCH 07/10] reference: fix anchor link --- src/doc/reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index 83849574260e1..5d2bb1e190428 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -3897,7 +3897,7 @@ references to boxes are dropped. ### Variables A _variable_ is a component of a stack frame, either a named function parameter, -an anonymous [temporary](#lvalues,-rvalues-and-temporaries), or a named local +an anonymous [temporary](#lvalues-rvalues-and-temporaries), or a named local variable. A _local variable_ (or *stack-local* allocation) holds a value directly, From 70770753722fc302d7db634f8215362c1079d217 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Thu, 24 Sep 2015 08:04:55 +0200 Subject: [PATCH 08/10] doc: "familiarity" does not need to be repeated here --- src/doc/grammar.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/grammar.md b/src/doc/grammar.md index 3ae93b8f279dc..7bfe8b62e8a5d 100644 --- a/src/doc/grammar.md +++ b/src/doc/grammar.md @@ -9,7 +9,7 @@ provides only one kind of material: This document does not serve as an introduction to the language. Background familiarity with the language is assumed. A separate [guide] is available to -help acquire such background familiarity. +help acquire such background. This document also does not serve as a reference to the [standard] library included in the language distribution. Those libraries are documented From 996bd9d0d6b7887e4720d5a595ce9fd2c6a82c80 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Thu, 24 Sep 2015 08:18:00 +0200 Subject: [PATCH 09/10] reference: 3 of the 4 things mentioned here are optional --- src/doc/reference.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index 83849574260e1..7cae6a515cb07 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -900,9 +900,10 @@ fn main() {} ### Functions -A _function item_ defines a sequence of [statements](#statements) and an -optional final [expression](#expressions), along with a name and a set of -parameters. Functions are declared with the keyword `fn`. Functions declare a +A _function item_ defines a sequence of [statements](#statements) and a +final [expression](#expressions), along with a name and a set of +parameters. Other than a name, all these are optional. +Functions are declared with the keyword `fn`. Functions may declare a set of *input* [*variables*](#variables) as parameters, through which the caller passes arguments into the function, and the *output* [*type*](#types) of the value the function will return to its caller on completion. From f34eafdcf9486189f594dc1e38a5b490bcba67ec Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Thu, 24 Sep 2015 08:25:29 +0200 Subject: [PATCH 10/10] reference: follow idiom in code snippet --- src/doc/reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index 83849574260e1..e8ac474b07eaf 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -921,7 +921,7 @@ An example of a function: ``` fn add(x: i32, y: i32) -> i32 { - return x + y; + x + y } ```