Skip to content

Commit 86affcd

Browse files
authored
Auto merge of #36805 - jonathandturner:rollup, r=jonathandturner
Rollup of 11 pull requests - Successful merges: #36376, #36672, #36740, #36757, #36765, #36769, #36782, #36783, #36784, #36795, #36796 - Failed merges:
2 parents f17b1e0 + ac82eaa commit 86affcd

File tree

19 files changed

+301
-136
lines changed

19 files changed

+301
-136
lines changed

src/bootstrap/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -659,12 +659,6 @@ impl Build {
659659
.env(format!("CFLAGS_{}", target), self.cflags(target).join(" "));
660660
}
661661

662-
// If we're building for OSX, inform the compiler and the linker that
663-
// we want to build a compiler runnable on 10.7
664-
if target.contains("apple-darwin") {
665-
cargo.env("MACOSX_DEPLOYMENT_TARGET", "10.7");
666-
}
667-
668662
// Environment variables *required* needed throughout the build
669663
//
670664
// FIXME: should update code to not require this env var
@@ -933,7 +927,6 @@ impl Build {
933927
// LLVM/jemalloc/etc are all properly compiled.
934928
if target.contains("apple-darwin") {
935929
base.push("-stdlib=libc++".into());
936-
base.push("-mmacosx-version-min=10.7".into());
937930
}
938931
// This is a hack, because newer binutils broke things on some vms/distros
939932
// (i.e., linking against unknown relocs disabled by the following flag)

src/doc/book/getting-started.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,22 @@ you can find the Rust executables in a directory like
166166
`"C:\Program Files\Rust stable GNU 1.x\bin"`.
167167

168168
Rust does not do its own linking, and so you’ll need to have a linker
169-
installed. Doing so will depend on your specific system, consult its
170-
documentation for more details.
171-
172-
If not, there are a number of places where we can get help. The easiest is
173-
[the #rust-beginners IRC channel on irc.mozilla.org][irc-beginners] and for
174-
general discussion [the #rust IRC channel on irc.mozilla.org][irc], which we
169+
installed. Doing so will depend on your specific system. For
170+
Linux-based systems, Rust will attempt to call `cc` for linking. On
171+
`windows-msvc` (Rust built on Windows with Microsoft Visual Studio),
172+
this depends on having [Microsoft Visual C++ Build Tools][msvbt]
173+
installed. These do not need to be in `%PATH%` as `rustc` will find
174+
them automatically. In general, if you have your linker in a
175+
non-traditional location you can call `rustc
176+
linker=/path/to/cc`, where `/path/to/cc` should point to your linker path.
177+
178+
[msvbt]: http://landinghub.visualstudio.com/visual-cpp-build-tools
179+
180+
If you are still stuck, there are a number of places where we can get
181+
help. The easiest is
182+
[the #rust-beginners IRC channel on irc.mozilla.org][irc-beginners]
183+
and for general discussion
184+
[the #rust IRC channel on irc.mozilla.org][irc], which we
175185
can access through [Mibbit][mibbit]. Then we'll be chatting with other
176186
Rustaceans (a silly nickname we call ourselves) who can help us out. Other great
177187
resources include [the user’s forum][users] and [Stack Overflow][stackoverflow].

src/doc/book/variable-bindings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ Could not compile `hello_world`.
161161

162162
Rust will not let us use a value that has not been initialized.
163163

164-
Let take a minute to talk about this stuff we've added to `println!`.
164+
Let us take a minute to talk about this stuff we've added to `println!`.
165165

166166
If you include two curly braces (`{}`, some call them moustaches...) in your
167167
string to print, Rust will interpret this as a request to interpolate some sort

src/libcore/intrinsics.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,19 @@ extern "rust-intrinsic" {
596596

597597
/// Invokes memset on the specified pointer, setting `count * size_of::<T>()`
598598
/// bytes of memory starting at `dst` to `val`.
599+
///
600+
/// # Examples
601+
///
602+
/// ```
603+
/// use std::ptr;
604+
///
605+
/// let mut vec = vec![0; 4];
606+
/// unsafe {
607+
/// let vec_ptr = vec.as_mut_ptr();
608+
/// ptr::write_bytes(vec_ptr, b'a', 2);
609+
/// }
610+
/// assert_eq!(vec, [b'a', b'a', 0, 0]);
611+
/// ```
599612
#[stable(feature = "rust1", since = "1.0.0")]
600613
pub fn write_bytes<T>(dst: *mut T, val: u8, count: usize);
601614

src/librustc/hir/map/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl<'ast> Map<'ast> {
260260
EntryVariant(p, _) |
261261
EntryExpr(p, _) |
262262
EntryStmt(p, _) |
263-
EntryTy(p, _) |
263+
EntryTy(p, _) |
264264
EntryLocal(p, _) |
265265
EntryPat(p, _) |
266266
EntryBlock(p, _) |

src/librustc_back/target/mips64_unknown_linux_gnuabi64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn target() -> TargetResult {
1515
llvm_target: "mips64-unknown-linux-gnuabi64".to_string(),
1616
target_endian: "big".to_string(),
1717
target_pointer_width: "64".to_string(),
18-
data_layout: "E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
18+
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
1919
arch: "mips64".to_string(),
2020
target_os: "linux".to_string(),
2121
target_env: "gnu".to_string(),

src/librustc_back/target/mips64el_unknown_linux_gnuabi64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn target() -> TargetResult {
1515
llvm_target: "mips64el-unknown-linux-gnuabi64".to_string(),
1616
target_endian: "little".to_string(),
1717
target_pointer_width: "64".to_string(),
18-
data_layout: "e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
18+
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
1919
arch: "mips64".to_string(),
2020
target_os: "linux".to_string(),
2121
target_env: "gnu".to_string(),

src/librustc_typeck/check/_match.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -675,14 +675,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
675675
for &Spanned { node: ref field, span } in fields {
676676
let field_ty = match used_fields.entry(field.name) {
677677
Occupied(occupied) => {
678-
let mut err = struct_span_err!(tcx.sess, span, E0025,
679-
"field `{}` bound multiple times \
680-
in the pattern",
681-
field.name);
682-
span_note!(&mut err, *occupied.get(),
683-
"field `{}` previously bound here",
684-
field.name);
685-
err.emit();
678+
struct_span_err!(tcx.sess, span, E0025,
679+
"field `{}` bound multiple times \
680+
in the pattern",
681+
field.name)
682+
.span_label(span,
683+
&format!("multiple uses of `{}` in pattern", field.name))
684+
.span_label(*occupied.get(), &format!("first use of `{}`", field.name))
685+
.emit();
686686
tcx.types.err
687687
}
688688
Vacant(vacant) => {

src/librustc_typeck/check/compare_method.rs

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,70 @@ pub fn compare_impl_method<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
148148
}
149149

150150
if impl_m.fty.sig.0.inputs.len() != trait_m.fty.sig.0.inputs.len() {
151-
span_err!(tcx.sess, impl_m_span, E0050,
151+
let trait_number_args = trait_m.fty.sig.0.inputs.len();
152+
let impl_number_args = impl_m.fty.sig.0.inputs.len();
153+
let trait_m_node_id = tcx.map.as_local_node_id(trait_m.def_id);
154+
let trait_span = if let Some(trait_id) = trait_m_node_id {
155+
match tcx.map.expect_trait_item(trait_id).node {
156+
TraitItem_::MethodTraitItem(ref trait_m_sig, _) => {
157+
if let Some(arg) = trait_m_sig.decl.inputs.get(
158+
if trait_number_args > 0 {
159+
trait_number_args - 1
160+
} else {
161+
0
162+
}) {
163+
Some(arg.pat.span)
164+
} else {
165+
trait_item_span
166+
}
167+
}
168+
_ => bug!("{:?} is not a method", impl_m)
169+
}
170+
} else {
171+
trait_item_span
172+
};
173+
let impl_m_node_id = tcx.map.as_local_node_id(impl_m.def_id).unwrap();
174+
let impl_span = match tcx.map.expect_impl_item(impl_m_node_id).node {
175+
ImplItemKind::Method(ref impl_m_sig, _) => {
176+
if let Some(arg) = impl_m_sig.decl.inputs.get(
177+
if impl_number_args > 0 {
178+
impl_number_args - 1
179+
} else {
180+
0
181+
}) {
182+
arg.pat.span
183+
} else {
184+
impl_m_span
185+
}
186+
}
187+
_ => bug!("{:?} is not a method", impl_m)
188+
};
189+
let mut err = struct_span_err!(tcx.sess, impl_span, E0050,
152190
"method `{}` has {} parameter{} \
153191
but the declaration in trait `{}` has {}",
154192
trait_m.name,
155-
impl_m.fty.sig.0.inputs.len(),
156-
if impl_m.fty.sig.0.inputs.len() == 1 {""} else {"s"},
193+
impl_number_args,
194+
if impl_number_args == 1 {""} else {"s"},
157195
tcx.item_path_str(trait_m.def_id),
158-
trait_m.fty.sig.0.inputs.len());
196+
trait_number_args);
197+
if let Some(trait_span) = trait_span {
198+
err.span_label(trait_span,
199+
&format!("trait requires {}",
200+
&if trait_number_args != 1 {
201+
format!("{} parameters", trait_number_args)
202+
} else {
203+
format!("{} parameter", trait_number_args)
204+
}));
205+
}
206+
err.span_label(impl_span,
207+
&format!("expected {}, found {}",
208+
&if trait_number_args != 1 {
209+
format!("{} parameters", trait_number_args)
210+
} else {
211+
format!("{} parameter", trait_number_args)
212+
},
213+
impl_number_args));
214+
err.emit();
159215
return;
160216
}
161217

src/libstd/collections/hash/map.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,22 @@ fn test_resize_policy() {
335335
/// println!("{:?} has {} hp", viking, health);
336336
/// }
337337
/// ```
338+
///
339+
/// A HashMap with fixed list of elements can be initialized from an array:
340+
///
341+
/// ```
342+
/// use std::collections::HashMap;
343+
///
344+
/// fn main() {
345+
/// let timber_resources: HashMap<&str, i32> =
346+
/// [("Norway", 100),
347+
/// ("Denmark", 50),
348+
/// ("Iceland", 10)]
349+
/// .iter().cloned().collect();
350+
/// // use the values stored in map
351+
/// }
352+
/// ```
353+
338354
#[derive(Clone)]
339355
#[stable(feature = "rust1", since = "1.0.0")]
340356
pub struct HashMap<K, V, S = RandomState> {

src/libstd/collections/hash/set.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,20 @@ use super::map::{self, HashMap, Keys, RandomState};
9898
/// println!("{:?}", x);
9999
/// }
100100
/// ```
101+
///
102+
/// HashSet with fixed list of elements can be initialized from an array:
103+
///
104+
/// ```
105+
/// use std::collections::HashSet;
106+
///
107+
/// fn main() {
108+
/// let viking_names: HashSet<&str> =
109+
/// [ "Einar", "Olaf", "Harald" ].iter().cloned().collect();
110+
/// // use the values stored in the set
111+
/// }
112+
/// ```
113+
114+
101115
#[derive(Clone)]
102116
#[stable(feature = "rust1", since = "1.0.0")]
103117
pub struct HashSet<T, S = RandomState> {

0 commit comments

Comments
 (0)