From fc16c3ee338237d53eb30d8a730b4a47933a8fae Mon Sep 17 00:00:00 2001 From: Blake Loring Date: Sat, 4 Jul 2015 23:12:08 +0100 Subject: [PATCH 01/18] Improve the expected constant integer error message Print error followed by expected to make the error more clear --- src/librustc/middle/ty.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 3497a8d690479..1f0b56b66266f 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -6414,20 +6414,16 @@ pub fn eval_repeat_count(tcx: &ctxt, count_expr: &ast::Expr) -> usize { found); } Err(err) => { - let err_description = err.description(); - let found = match count_expr.node { + let err_msg = match count_expr.node { ast::ExprPath(None, ast::Path { global: false, ref segments, .. }) if segments.len() == 1 => - format!("{}", "found variable"), - _ => - format!("but {}", err_description), + format!("found variable, expected constant integer for repeat count"), + _ => format!("{}, expected constant integer for repeat count", err.description()), }; - span_err!(tcx.sess, count_expr.span, E0307, - "expected constant integer for repeat count, {}", - found); + span_err!(tcx.sess, count_expr.span, E0307, "{}", err_msg); } } 0 From f395b2b9e85b3b52372ef1a4e063d6332ca26992 Mon Sep 17 00:00:00 2001 From: Blake Loring Date: Sat, 4 Jul 2015 23:32:50 +0100 Subject: [PATCH 02/18] Make the message slightly clearer --- src/librustc/middle/ty.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 38c434115eeed..851fb490c0f42 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -6175,17 +6175,16 @@ impl<'tcx> ctxt<'tcx> { found); } Err(err) => { - let err_description = err.description(); let err_msg = match count_expr.node { ast::ExprPath(None, ast::Path { global: false, ref segments, .. }) if segments.len() == 1 => - format!("found variable, expected constant integer for repeat count"), - _ => format!("{}, expected constant integer for repeat count", err.description()), + format!("found variable"), + _ => format!("{}", err.description()), }; - span_err!(tcx.sess, count_expr.span, E0307, "{}", err_msg); + span_err!(tcx.sess, count_expr.span, E0307, "{}, expected valid constant integer for repeat count", err_msg); } } 0 From 8c5ffd30fb7d50f430346d7849c2b38b8e39c680 Mon Sep 17 00:00:00 2001 From: Blake Loring Date: Sat, 4 Jul 2015 23:34:57 +0100 Subject: [PATCH 03/18] Reduce line length --- src/librustc/middle/ty.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 851fb490c0f42..5b50bbcbc80a6 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -6184,7 +6184,9 @@ impl<'tcx> ctxt<'tcx> { format!("found variable"), _ => format!("{}", err.description()), }; - span_err!(tcx.sess, count_expr.span, E0307, "{}, expected valid constant integer for repeat count", err_msg); + span_err!(tcx.sess, count_expr.span, E0307, + "{}, expected valid constant integer for repeat count", + err_msg); } } 0 From 02dd732702a44b4ec09f788a9da9287f4de75fdb Mon Sep 17 00:00:00 2001 From: Blake Loring Date: Sun, 5 Jul 2015 01:45:32 +0100 Subject: [PATCH 04/18] Self.sess -> txc.sess --- src/librustc/middle/ty.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 5b50bbcbc80a6..ee4817b33be7b 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -6184,7 +6184,7 @@ impl<'tcx> ctxt<'tcx> { format!("found variable"), _ => format!("{}", err.description()), }; - span_err!(tcx.sess, count_expr.span, E0307, + span_err!(self.sess, count_expr.span, E0307, "{}, expected valid constant integer for repeat count", err_msg); } From 48724631d4cbecd96219269af4acc23cdf7bec1f Mon Sep 17 00:00:00 2001 From: Blake Loring Date: Sun, 5 Jul 2015 13:03:39 +0100 Subject: [PATCH 05/18] Remove 'valid' from error --- src/librustc/middle/ty.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index ee4817b33be7b..3c7b677e85887 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -6185,7 +6185,7 @@ impl<'tcx> ctxt<'tcx> { _ => format!("{}", err.description()), }; span_err!(self.sess, count_expr.span, E0307, - "{}, expected valid constant integer for repeat count", + "{}, expected constant integer for repeat count", err_msg); } } From affbc729f44c2ff9c92a75266a5c00215d54c1ed Mon Sep 17 00:00:00 2001 From: Blake Loring Date: Sun, 19 Jul 2015 10:55:03 +0100 Subject: [PATCH 06/18] Modified to add 'found' to error message instead --- src/librustc/middle/ty.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 3c7b677e85887..ec1500d8767ae 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -46,7 +46,7 @@ use metadata::csearch; use middle; use middle::cast; use middle::check_const; -use middle::const_eval::{self, ConstVal}; +use middle::const_eval::{self, ConstVal, ErrKind}; use middle::def::{self, DefMap, ExportMap}; use middle::dependency_format; use middle::fast_reject; @@ -6182,11 +6182,13 @@ impl<'tcx> ctxt<'tcx> { .. }) if segments.len() == 1 => format!("found variable"), - _ => format!("{}", err.description()), + _ => match err.kind { + ErrKind::MiscCatchAll => format!("but found {}", err.description()), + _ => format!("but {}", err.description()) + } }; span_err!(self.sess, count_expr.span, E0307, - "{}, expected constant integer for repeat count", - err_msg); + "expected constant integer for repeat count, {}", err_msg); } } 0 From b684826cab859cc6e16419de448f99a47ce2f8f2 Mon Sep 17 00:00:00 2001 From: Andrew Paseltiner Date: Sun, 19 Jul 2015 15:39:26 -0400 Subject: [PATCH 07/18] add test for #20162 closes #20162 --- src/test/compile-fail/issue-20162.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/test/compile-fail/issue-20162.rs diff --git a/src/test/compile-fail/issue-20162.rs b/src/test/compile-fail/issue-20162.rs new file mode 100644 index 0000000000000..d3a87689ac5e1 --- /dev/null +++ b/src/test/compile-fail/issue-20162.rs @@ -0,0 +1,17 @@ +// 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. + +struct X { x: i32 } + +fn main() { + let mut b: Vec = vec![]; + b.sort(); + //~^ ERROR the trait `core::cmp::Ord` is not implemented for the type `X` +} From 871ccfb5a92468056e5492c7f2e54a244657a3e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinbrink?= Date: Mon, 20 Jul 2015 10:33:44 +0200 Subject: [PATCH 08/18] Add a test for #26468 The fix for #26468 was made upstream and landed with the LLVM update in #27076. Closes #26468 --- src/test/run-pass/issue-26468.rs | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/test/run-pass/issue-26468.rs diff --git a/src/test/run-pass/issue-26468.rs b/src/test/run-pass/issue-26468.rs new file mode 100644 index 0000000000000..9fb8675e84e9d --- /dev/null +++ b/src/test/run-pass/issue-26468.rs @@ -0,0 +1,38 @@ +// 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. + +#![allow(dead_code)] + +enum FooMode { + Check = 0x1001, +} + +enum BarMode { + Check = 0x2001, +} + +enum Mode { + Foo(FooMode), + Bar(BarMode), +} + +#[inline(never)] +fn broken(mode: &Mode) -> u32 { + for _ in 0..1 { + if let Mode::Foo(FooMode::Check) = *mode { return 17 } + if let Mode::Bar(BarMode::Check) = *mode { return 19 } + } + return 42; +} + +fn main() { + let mode = Mode::Bar(BarMode::Check); + assert_eq!(broken(&mode), 19); +} From 9bb6545124ca70dff4fa68ecd5188c45607bbdec Mon Sep 17 00:00:00 2001 From: Andrew Paseltiner Date: Mon, 20 Jul 2015 08:31:54 -0400 Subject: [PATCH 09/18] add test for #14229 closes #14229 --- src/test/run-pass/issue-14229.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/test/run-pass/issue-14229.rs diff --git a/src/test/run-pass/issue-14229.rs b/src/test/run-pass/issue-14229.rs new file mode 100644 index 0000000000000..ee2bbe63750c3 --- /dev/null +++ b/src/test/run-pass/issue-14229.rs @@ -0,0 +1,30 @@ +// 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. + +trait Foo: Sized { + fn foo(self) {} +} + +trait Bar: Sized { + fn bar(self) {} +} + +struct S; + +impl<'l> Foo for &'l S {} + +impl Bar for T {} + +fn main() { + let s = S; + s.foo(); + (&s).bar(); + s.bar(); +} From 4c73dbddcf4f6bce64424203acad203cfb70072a Mon Sep 17 00:00:00 2001 From: Andrew Paseltiner Date: Mon, 20 Jul 2015 08:39:51 -0400 Subject: [PATCH 10/18] add test for #19404 closes #19404 --- src/test/run-pass/issue-19404.rs | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/test/run-pass/issue-19404.rs diff --git a/src/test/run-pass/issue-19404.rs b/src/test/run-pass/issue-19404.rs new file mode 100644 index 0000000000000..0eea6ba22cae8 --- /dev/null +++ b/src/test/run-pass/issue-19404.rs @@ -0,0 +1,47 @@ +// 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. + +#![feature(reflect_marker)] + +use std::any::TypeId; +use std::marker::Reflect; +use std::rc::Rc; + +type Fp = Rc; + +struct Engine; + +trait Component: 'static + Reflect {} +impl Component for Engine {} + +trait Env { + fn get_component_type_id(&self, type_id: TypeId) -> Option>; +} + +impl<'a> Env+'a { + fn get_component(&self) -> Option> { + let x = self.get_component_type_id(TypeId::of::()); + None + } +} + +trait Figment { + fn init(&mut self, env: &Env); +} + +struct MyFigment; + +impl Figment for MyFigment { + fn init(&mut self, env: &Env) { + let engine = env.get_component::(); + } +} + +fn main() {} From 31a62d3b4be308dbfb71dd7114cbb1594a4986f7 Mon Sep 17 00:00:00 2001 From: Paolo Falabella Date: Mon, 20 Jul 2015 17:29:34 +0200 Subject: [PATCH 11/18] s/has gained/has not gained/g I'm pretty sure this was a typo --- src/libcore/iter.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 4c8511eb1902c..415326a8a616e 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -2555,7 +2555,7 @@ impl RandomAccessIterator for Inspect #[unstable(feature = "iter_unfold")] #[derive(Clone)] #[deprecated(since = "1.2.0", - reason = "has gained enough traction to retain its position \ + reason = "has not gained enough traction to retain its position \ in the standard library")] #[allow(deprecated)] pub struct Unfold { @@ -2567,7 +2567,7 @@ pub struct Unfold { #[unstable(feature = "iter_unfold")] #[deprecated(since = "1.2.0", - reason = "has gained enough traction to retain its position \ + reason = "has not gained enough traction to retain its position \ in the standard library")] #[allow(deprecated)] impl Unfold where F: FnMut(&mut St) -> Option { @@ -3018,7 +3018,7 @@ type IterateState = (F, Option, bool); /// from a given seed value. #[unstable(feature = "iter_iterate")] #[deprecated(since = "1.2.0", - reason = "has gained enough traction to retain its position \ + reason = "has not gained enough traction to retain its position \ in the standard library")] #[allow(deprecated)] pub type Iterate = Unfold, fn(&mut IterateState) -> Option>; @@ -3027,7 +3027,7 @@ pub type Iterate = Unfold, fn(&mut IterateState) /// repeated applications of the given function `f`. #[unstable(feature = "iter_iterate")] #[deprecated(since = "1.2.0", - reason = "has gained enough traction to retain its position \ + reason = "has not gained enough traction to retain its position \ in the standard library")] #[allow(deprecated)] pub fn iterate(seed: T, f: F) -> Iterate where From a7e5c6302b2458a91d4140a6fefea223a4df758d Mon Sep 17 00:00:00 2001 From: Andrew Paseltiner Date: Mon, 20 Jul 2015 12:59:33 -0400 Subject: [PATCH 12/18] add test for #10436 closes #10436 --- src/test/run-pass/issue-10436.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/test/run-pass/issue-10436.rs diff --git a/src/test/run-pass/issue-10436.rs b/src/test/run-pass/issue-10436.rs new file mode 100644 index 0000000000000..81a955b0f22e4 --- /dev/null +++ b/src/test/run-pass/issue-10436.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. + +fn works(x: T) -> Vec { vec![x] } + +fn also_works(x: T) -> Vec { vec![x] } + +fn main() { + let _: Vec = works(0); + let _: Vec = also_works(0); + let _ = works(0); + let _ = also_works(0); +} From 3ae7b72970104d1269fd1ebc31aaaf50830f3a3b Mon Sep 17 00:00:00 2001 From: Alisdair Owens Date: Mon, 20 Jul 2015 18:14:12 +0100 Subject: [PATCH 13/18] Fix wording nit for E0253 --- src/librustc_resolve/diagnostics.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index a0d06e5e1244a..23d323440c9b3 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -106,8 +106,7 @@ mod foo { use foo::MyTrait::do_something; ``` -In general, it's not legal to directly import methods belonging to a -trait or concrete type. +It's illegal to directly import methods belonging to a trait or concrete type. "##, E0255: r##" From 27fc0f21c48ad9a8788044467c14611b41afeab3 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Mon, 20 Jul 2015 13:16:57 -0400 Subject: [PATCH 14/18] Document iterators in std::io Make them all consistent and link up the documentation. --- src/libstd/io/mod.rs | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 2447473103101..2a0efb9d8a28c 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -1188,9 +1188,12 @@ impl Write for Broadcast { } } -/// Adaptor to chain together two instances of `Read`. +/// Adaptor to chain together two readers. /// -/// For more information, see `Read::chain`. +/// This struct is generally created by calling [`chain()`][chain] on a reader. +/// Please see the documentation of `chain()` for more details. +/// +/// [chain]: trait.Read.html#method.chain #[stable(feature = "rust1", since = "1.0.0")] pub struct Chain { first: T, @@ -1266,7 +1269,10 @@ impl BufRead for Take { /// An adaptor which will emit all read data to a specified writer as well. /// -/// For more information see `Read::tee` +/// This struct is generally created by calling [`tee()`][tee] on a reader. +/// Please see the documentation of `tee()` for more details. +/// +/// [tee]: trait.Read.html#method.tee #[unstable(feature = "io", reason = "awaiting stability of Read::tee")] pub struct Tee { reader: R, @@ -1283,9 +1289,12 @@ impl Read for Tee { } } -/// A bridge from implementations of `Read` to an `Iterator` of `u8`. +/// An iterator over `u8` values of a reader. +/// +/// This struct is generally created by calling [`bytes()`][bytes] on a reader. +/// Please see the documentation of `bytes()` for more details. /// -/// See `Read::bytes` for more information. +/// [bytes]: trait.Read.html#method.bytes #[stable(feature = "rust1", since = "1.0.0")] pub struct Bytes { inner: R, @@ -1305,9 +1314,12 @@ impl Iterator for Bytes { } } -/// A bridge from implementations of `Read` to an `Iterator` of `char`. +/// An iterator over the `char`s of a reader. /// -/// See `Read::chars` for more information. +/// This struct is generally created by calling [`chars()`][chars] on a reader. +/// Please see the documentation of `chars()` for more details. +/// +/// [chars]: trait.Read.html#method.chars #[unstable(feature = "io", reason = "awaiting stability of Read::chars")] pub struct Chars { inner: R, @@ -1389,7 +1401,10 @@ impl fmt::Display for CharsError { /// An iterator over the contents of an instance of `BufRead` split on a /// particular byte. /// -/// See `BufRead::split` for more information. +/// This struct is generally created by calling [`split()`][split] on a +/// `BufRead`. Please see the documentation of `split()` for more details. +/// +/// [split]: trait.BufRead.html#method.split #[stable(feature = "rust1", since = "1.0.0")] pub struct Split { buf: B, @@ -1415,10 +1430,12 @@ impl Iterator for Split { } } -/// An iterator over the lines of an instance of `BufRead` split on a newline -/// byte. +/// An iterator over the lines of an instance of `BufRead`. +/// +/// This struct is generally created by calling [`lines()`][lines] on a +/// `BufRead`. Please see the documentation of `lines()` for more details. /// -/// See `BufRead::lines` for more information. +/// [lines]: trait.BufRead.html#method.lines #[stable(feature = "rust1", since = "1.0.0")] pub struct Lines { buf: B, From 5a2bcd3bfa12080c5d7ecf78bcd717c109cc66dc Mon Sep 17 00:00:00 2001 From: Andrew Paseltiner Date: Mon, 20 Jul 2015 13:31:04 -0400 Subject: [PATCH 15/18] add test for #14382 closes #14382 --- src/test/run-pass/issue-14382.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/test/run-pass/issue-14382.rs diff --git a/src/test/run-pass/issue-14382.rs b/src/test/run-pass/issue-14382.rs new file mode 100644 index 0000000000000..cd5d3b1270897 --- /dev/null +++ b/src/test/run-pass/issue-14382.rs @@ -0,0 +1,24 @@ +// 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. + +#[derive(Debug)] +struct Matrix4(S); +trait POrd {} + +fn translate>(_: S) -> Matrix4 { unimplemented!() } + +impl POrd for f32 {} +impl POrd for f64 {} + +fn main() { + let x = 1.0; + let m : Matrix4 = translate(x); + println!("m: {:?}", m); +} From 686d32643913040d5074fd632fba6a628ea5807c Mon Sep 17 00:00:00 2001 From: Alisdair Owens Date: Sun, 19 Jul 2015 15:18:09 +0100 Subject: [PATCH 16/18] Add diagnostics for E0172, fix inline error message for E0139 --- src/librustc/middle/intrinsicck.rs | 2 +- src/librustc_typeck/diagnostics.rs | 28 +++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs index c5f6f0126de37..a10e0b8dfc29e 100644 --- a/src/librustc/middle/intrinsicck.rs +++ b/src/librustc/middle/intrinsicck.rs @@ -165,7 +165,7 @@ impl<'a, 'tcx> IntrinsicCheckingVisitor<'a, 'tcx> { if from_tc.interior_param() || to_tc.interior_param() { span_err!(self.tcx.sess, span, E0139, "cannot transmute to or from a type that contains \ - type parameters in its interior"); + unsubstituted type parameters"); return; } diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index a002ed311e8c5..a6c574e29ef93 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1476,6 +1476,33 @@ return, for example with a `loop` that never breaks or a call to another diverging function (such as `panic!()`). "##, +E0172: r##" +This error means that an attempt was made to specify the type of a variable with +a combination of a concrete type and a trait. Consider the following example: + +``` +fn foo(bar: i32+std::fmt::Display) {} +``` + +The code is trying to specify that we want to receive a signed 32-bit integer +which also implements `Display`. This doesn't make sense: when we pass `i32`, a +concrete type, it implicitly includes all of the traits that it implements. +This includes `Display`, `Debug`, `Clone`, and a host of others. + +If `i32` implements the trait we desire, there's no need to specify the trait +separately. If it does not, then we need to `impl` the trait for `i32` before +passing it into `foo`. Either way, a fixed definition for `foo` will look like +the following: + +``` +fn foo(bar: i32) {} +``` + +To learn more about traits, take a look at the Book: + +https://doc.rust-lang.org/book/traits.html +"##, + E0178: r##" In types, the `+` type operator has low precedence, so it is often necessary to use parentheses. @@ -2196,7 +2223,6 @@ register_diagnostics! { E0164, E0167, E0168, - E0172, E0173, // manual implementations of unboxed closure traits are experimental E0174, // explicit use of unboxed closure methods are experimental E0182, From 7e7ec6b5cd78d16c260b251dfd69cc150332f83d Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Mon, 20 Jul 2015 14:41:00 -0400 Subject: [PATCH 17/18] Document structures in std::io::utils These provide various special readers, so point their docs to their constructor functions in a manner consistent with everything else. --- src/libstd/io/util.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index c0bced26beffa..dc29811ed5ba1 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -61,6 +61,11 @@ pub fn copy(reader: &mut R, writer: &mut W) -> io::Result Date: Mon, 20 Jul 2015 15:52:43 -0400 Subject: [PATCH 18/18] Update docs for take and broadcast Better and more consistent links to their creators. --- src/libstd/io/mod.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 2447473103101..25f0c9cf55016 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -1167,7 +1167,10 @@ pub trait BufRead: Read { /// A `Write` adaptor which will write data to multiple locations. /// -/// For more information, see `Write::broadcast`. +/// This struct is generally created by calling [`broadcast()`][broadcast] on a +/// writer. Please see the documentation of `broadcast()` for more details. +/// +/// [broadcast]: trait.Write.html#method.broadcast #[unstable(feature = "io", reason = "awaiting stability of Write::broadcast")] pub struct Broadcast { first: T, @@ -1213,7 +1216,10 @@ impl Read for Chain { /// Reader adaptor which limits the bytes read from an underlying reader. /// -/// For more information, see `Read::take`. +/// This struct is generally created by calling [`take()`][take] on a reader. +/// Please see the documentation of `take()` for more details. +/// +/// [take]: trait.Read.html#method.take #[stable(feature = "rust1", since = "1.0.0")] pub struct Take { inner: T,