diff --git a/.mailmap b/.mailmap index e5aad52ef4b79..ea8ef0eebf9a1 100644 --- a/.mailmap +++ b/.mailmap @@ -5,7 +5,6 @@ # email addresses. # -Aaron Power Erin Power Aaron Todd Abhishek Chanda Abhishek Chanda Adolfo Ochagavía @@ -84,6 +83,8 @@ Eric Holk Eric Holmes Eric Reed Erick Tryzelaar +Erin Power +Erin Power Esteban Küber Esteban Küber Esteban Küber diff --git a/src/bootstrap/toolstate.rs b/src/bootstrap/toolstate.rs index 5c39f5d5bc3ef..7cffc47293070 100644 --- a/src/bootstrap/toolstate.rs +++ b/src/bootstrap/toolstate.rs @@ -443,7 +443,7 @@ fn change_toolstate( if new_state != state { eprintln!("The state of `{}` has changed from `{}` to `{}`", tool, state, new_state); if new_state < state { - if !["rustc-guide", "miri", "embedded-book"].contains(&tool.as_str()) { + if !NIGHTLY_TOOLS.iter().any(|(name, _path)| name == tool) { regressed = true; } } diff --git a/src/doc/embedded-book b/src/doc/embedded-book index b2e1092bf67bd..b81ffb7a6f4c5 160000 --- a/src/doc/embedded-book +++ b/src/doc/embedded-book @@ -1 +1 @@ -Subproject commit b2e1092bf67bd4d7686c4553f186edbb7f5f92db +Subproject commit b81ffb7a6f4c5aaed92786e770e99db116aa4ebd diff --git a/src/doc/nomicon b/src/doc/nomicon index 3e6e1001dc6e0..71241f403091e 160000 --- a/src/doc/nomicon +++ b/src/doc/nomicon @@ -1 +1 @@ -Subproject commit 3e6e1001dc6e095dbd5c88005e80969f60e384e1 +Subproject commit 71241f403091e021842ca8275740e44d0ab0ece1 diff --git a/src/doc/reference b/src/doc/reference index 64239df6d1735..559e09caa9661 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 64239df6d173562b9deb4f012e4c3e6e960c4754 +Subproject commit 559e09caa9661043744cf7af7bd88432d966f743 diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example index 32facd5522ddb..db57f899ea2a5 160000 --- a/src/doc/rust-by-example +++ b/src/doc/rust-by-example @@ -1 +1 @@ -Subproject commit 32facd5522ddbbf37baf01e4e4b6562bc55c071a +Subproject commit db57f899ea2a56a544c8d280cbf033438666273d diff --git a/src/libcore/iter/adapters/mod.rs b/src/libcore/iter/adapters/mod.rs index 58606531a1ace..02dc9b8f82ed2 100644 --- a/src/libcore/iter/adapters/mod.rs +++ b/src/libcore/iter/adapters/mod.rs @@ -1894,9 +1894,7 @@ where let to_skip = self.n; self.n = 0; // nth(n) skips n+1 - if self.iter.nth(to_skip - 1).is_none() { - return None; - } + self.iter.nth(to_skip - 1)?; } self.iter.nth(n) } @@ -1916,9 +1914,7 @@ where fn last(mut self) -> Option { if self.n > 0 { // nth(n) skips n+1 - if self.iter.nth(self.n - 1).is_none() { - return None; - } + self.iter.nth(self.n - 1)?; } self.iter.last() } diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 4f7c4153ea173..bd26e02efb749 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -338,9 +338,8 @@ impl<'hir> Map<'hir> { Node::Variant(_) => DefKind::Variant, Node::Ctor(variant_data) => { // FIXME(eddyb) is this even possible, if we have a `Node::Ctor`? - if variant_data.ctor_hir_id().is_none() { - return None; - } + variant_data.ctor_hir_id()?; + let ctor_of = match self.find(self.get_parent_node(hir_id)) { Some(Node::Item(..)) => def::CtorOf::Struct, Some(Node::Variant(..)) => def::CtorOf::Variant, diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index f65822aba4c9e..4014d1d8ae250 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -115,9 +115,7 @@ impl<'tcx> Instance<'tcx> { } // If this a non-generic instance, it cannot be a shared monomorphization. - if self.substs.non_erasable_generics().next().is_none() { - return None; - } + self.substs.non_erasable_generics().next()?; match self.def { InstanceDef::Item(def_id) => tcx diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs index 89359bb1bfdff..11d1209923fb2 100644 --- a/src/librustc_error_codes/error_codes.rs +++ b/src/librustc_error_codes/error_codes.rs @@ -395,6 +395,7 @@ E0714: include_str!("./error_codes/E0714.md"), E0715: include_str!("./error_codes/E0715.md"), E0716: include_str!("./error_codes/E0716.md"), E0718: include_str!("./error_codes/E0718.md"), +E0719: include_str!("./error_codes/E0719.md"), E0720: include_str!("./error_codes/E0720.md"), E0723: include_str!("./error_codes/E0723.md"), E0725: include_str!("./error_codes/E0725.md"), @@ -605,7 +606,6 @@ E0748: include_str!("./error_codes/E0748.md"), E0710, // an unknown tool name found in scoped lint E0711, // a feature has been declared with conflicting stability attributes E0717, // rustc_promotable without stability attribute - E0719, // duplicate values for associated type binding // E0721, // `await` keyword E0722, // Malformed `#[optimize]` attribute E0724, // `#[ffi_returns_twice]` is only allowed in foreign functions diff --git a/src/librustc_error_codes/error_codes/E0378.md b/src/librustc_error_codes/error_codes/E0378.md index 311483c8900be..7f4374738de28 100644 --- a/src/librustc_error_codes/error_codes/E0378.md +++ b/src/librustc_error_codes/error_codes/E0378.md @@ -1,10 +1,28 @@ +The `DispatchFromDyn` trait was implemented on something which is not a pointer +or a newtype wrapper around a pointer. + +Erroneous code example: + +```compile-fail,E0378 +#![feature(dispatch_from_dyn)] +use std::ops::DispatchFromDyn; + +struct WrapperExtraField { + ptr: T, + extra_stuff: i32, +} + +impl DispatchFromDyn> for WrapperExtraField +where + T: DispatchFromDyn, +{} +``` + The `DispatchFromDyn` trait currently can only be implemented for builtin pointer types and structs that are newtype wrappers around them — that is, the struct must have only one field (except for`PhantomData`), and that field must itself implement `DispatchFromDyn`. -Examples: - ``` #![feature(dispatch_from_dyn, unsize)] use std::{ @@ -20,6 +38,8 @@ where {} ``` +Another example: + ``` #![feature(dispatch_from_dyn)] use std::{ @@ -37,21 +57,3 @@ where T: DispatchFromDyn, {} ``` - -Example of illegal `DispatchFromDyn` implementation -(illegal because of extra field) - -```compile-fail,E0378 -#![feature(dispatch_from_dyn)] -use std::ops::DispatchFromDyn; - -struct WrapperExtraField { - ptr: T, - extra_stuff: i32, -} - -impl DispatchFromDyn> for WrapperExtraField -where - T: DispatchFromDyn, -{} -``` diff --git a/src/librustc_error_codes/error_codes/E0719.md b/src/librustc_error_codes/error_codes/E0719.md new file mode 100644 index 0000000000000..38bc63550ac7f --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0719.md @@ -0,0 +1,35 @@ +The value for an associated type has already been specified. + +Erroneous code example: + +```compile_fail,E0719 +#![feature(associated_type_bounds)] + +trait FooTrait {} +trait BarTrait {} + +// error: associated type `Item` in trait `Iterator` is specified twice +struct Foo> { f: T } +``` + +`Item` in trait `Iterator` cannot be specified multiple times for struct `Foo`. +To fix this, create a new trait that is a combination of the desired traits and +specify the associated type with the new trait. + +Corrected example: + +``` +#![feature(associated_type_bounds)] + +trait FooTrait {} +trait BarTrait {} +trait FooBarTrait: FooTrait + BarTrait {} + +struct Foo> { f: T } +``` + +For more information about associated types, see [the book][bk-at]. For more +information on associated type bounds, see [RFC 2289][rfc-2289]. + +[bk-at]: https://doc.rust-lang.org/book/ch19-03-advanced-traits.html#specifying-placeholder-types-in-trait-definitions-with-associated-types +[rfc-2289]: https://rust-lang.github.io/rfcs/2289-associated-type-bounds.html diff --git a/src/librustc_incremental/persist/work_product.rs b/src/librustc_incremental/persist/work_product.rs index 65a742a202ddd..b1861acec0426 100644 --- a/src/librustc_incremental/persist/work_product.rs +++ b/src/librustc_incremental/persist/work_product.rs @@ -13,9 +13,7 @@ pub fn copy_cgu_workproducts_to_incr_comp_cache_dir( files: &[(WorkProductFileKind, PathBuf)], ) -> Option<(WorkProductId, WorkProduct)> { debug!("copy_cgu_workproducts_to_incr_comp_cache_dir({:?},{:?})", cgu_name, files); - if sess.opts.incremental.is_none() { - return None; - } + sess.opts.incremental.as_ref()?; let saved_files = files .iter() diff --git a/src/librustc_resolve/imports.rs b/src/librustc_resolve/imports.rs index 1d502e52de4b5..73bc038ea15f9 100644 --- a/src/librustc_resolve/imports.rs +++ b/src/librustc_resolve/imports.rs @@ -1252,7 +1252,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> { // this may resolve to either a value or a type, but for documentation // purposes it's good enough to just favor one over the other. self.r.per_ns(|this, ns| { - if let Some(binding) = source_bindings[ns].get().ok() { + if let Ok(binding) = source_bindings[ns].get() { this.import_res_map.entry(directive.id).or_default()[ns] = Some(binding.res()); } }); @@ -1293,7 +1293,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> { let mut redundant_span = PerNS { value_ns: None, type_ns: None, macro_ns: None }; self.r.per_ns(|this, ns| { - if let Some(binding) = source_bindings[ns].get().ok() { + if let Ok(binding) = source_bindings[ns].get() { if binding.res() == Res::Err { return; } diff --git a/src/librustc_traits/chalk_context/mod.rs b/src/librustc_traits/chalk_context/mod.rs index 240a93f0900a4..7846bf29410b8 100644 --- a/src/librustc_traits/chalk_context/mod.rs +++ b/src/librustc_traits/chalk_context/mod.rs @@ -112,9 +112,7 @@ impl context::AggregateOps> for ChalkContext<'tcx> { debug!("make_solution(root_goal = {:?})", root_goal); - if simplified_answers.peek_answer().is_none() { - return None; - } + simplified_answers.peek_answer()?; let SimplifiedAnswer { subst: constrained_subst, ambiguous } = simplified_answers.next_answer().unwrap(); diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index a59d7f0263bb0..57cba6b1f7a1b 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -901,7 +901,7 @@ impl ToSocketAddrs for str { type Iter = vec::IntoIter; fn to_socket_addrs(&self) -> io::Result> { // try to parse as a regular SocketAddr first - if let Some(addr) = self.parse().ok() { + if let Ok(addr) = self.parse() { return Ok(vec![addr].into_iter()); } diff --git a/src/test/ui/associated-type-bounds/duplicate.stderr b/src/test/ui/associated-type-bounds/duplicate.stderr index df1151d876c04..82b2d32d09d57 100644 --- a/src/test/ui/associated-type-bounds/duplicate.stderr +++ b/src/test/ui/associated-type-bounds/duplicate.stderr @@ -728,3 +728,4 @@ LL | type TADyn3 = dyn Iterator; error: aborting due to 96 previous errors +For more information about this error, try `rustc --explain E0719`. diff --git a/src/test/ui/error-codes/E0719.stderr b/src/test/ui/error-codes/E0719.stderr index a046fbfc3d04a..0e4bbf083baf3 100644 --- a/src/test/ui/error-codes/E0719.stderr +++ b/src/test/ui/error-codes/E0719.stderr @@ -16,3 +16,4 @@ LL | fn test() -> Box> { error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0719`.