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 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 diff --git a/src/doc/reference.md b/src/doc/reference.md index 336c25744ca76..cd24e33a232d8 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. @@ -921,7 +922,7 @@ An example of a function: ``` fn add(x: i32, y: i32) -> i32 { - return x + y; + x + y } ``` @@ -3897,7 +3898,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, @@ -4036,10 +4037,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 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 /// 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; 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); +} 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++