From 5c7a94459c97836b2cea66d1346ba854e0f46ebe Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 3 Apr 2019 22:20:18 +0200 Subject: [PATCH 01/18] Add documentation on the -Z flag on the command-line arguments section in the rustc book. --- src/doc/rustc/src/command-line-arguments.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/doc/rustc/src/command-line-arguments.md b/src/doc/rustc/src/command-line-arguments.md index d7e789b5a11f7..18d7052c2c574 100644 --- a/src/doc/rustc/src/command-line-arguments.md +++ b/src/doc/rustc/src/command-line-arguments.md @@ -86,6 +86,12 @@ This flag will set which lints should be set to the [deny level](lints/levels.ht This flag will set which lints should be set to the [forbid level](lints/levels.html#forbid). +## `-Z`: set options for debugging rustc + +This flag lets you set options for debugging rustc. In order to set multiple options, the -Z flag +can be used multiple times. For example: `rustc -Z verbose -Z time`. Specifying options with -Z is +only available on nightly. To view all available options run: `rustc -Z help`. + ## `--cap-lints`: set the most restrictive lint level This flag lets you 'cap' lints, for more, [see here](lints/levels.html#capping-lints). From 894142de5d55d4efd249c5d6c72cffa99a3a1914 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 4 Apr 2019 22:28:52 +0200 Subject: [PATCH 02/18] Add back the substring test --- src/test/rustdoc-js/substring.js | 8 ++++++++ src/test/rustdoc-js/substring.rs | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/test/rustdoc-js/substring.js create mode 100644 src/test/rustdoc-js/substring.rs diff --git a/src/test/rustdoc-js/substring.js b/src/test/rustdoc-js/substring.js new file mode 100644 index 0000000000000..af05cd1ad34d1 --- /dev/null +++ b/src/test/rustdoc-js/substring.js @@ -0,0 +1,8 @@ +const QUERY = 'waker_from'; + +const EXPECTED = { + 'others': [ + { 'path': 'substring::SuperWaker', 'name': 'local_waker_from_nonlocal' }, + { 'path': 'substring::SuperWakerTask', 'name': 'local_waker_from_nonlocal' }, + ], +}; diff --git a/src/test/rustdoc-js/substring.rs b/src/test/rustdoc-js/substring.rs new file mode 100644 index 0000000000000..e729c722c7999 --- /dev/null +++ b/src/test/rustdoc-js/substring.rs @@ -0,0 +1,21 @@ +pub struct SuperWaker; + +impl SuperWaker { + pub fn local_waker_from_nonlocal() {} + pub fn local_waker_frm_nonlocal() {} + pub fn some_method() {} + pub fn some_other_method() {} + pub fn waker_non_local() {} + pub fn from_non_local() {} +} + +pub struct SuperWakerTask; + +impl SuperWakerTask { + pub fn local_waker_from_nonlocal() {} + pub fn local_waker_frm_nonlocal() {} + pub fn some_method() {} + pub fn some_other_method() {} + pub fn waker_non_local() {} + pub fn from_non_local() {} +} From edebed9fc93d433578aef6b0e2b6a47b580a2f95 Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Mon, 8 Apr 2019 21:32:38 +0200 Subject: [PATCH 03/18] compiletest: Improve no_prefer_dynamic docs This adds some extra docs for the `no-prefer-dynamic` header. And also a `s/must_compile_successfully/compile_pass`. `must_compile_successfully` has been renamed to `compile_pass` at some point in the past and this comment was still referring to the old name. --- src/tools/compiletest/src/header.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index d735d3351e666..2fe837e99d33f 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -303,6 +303,10 @@ pub struct TestProps { // For UI tests, allows compiler to generate arbitrary output to stderr pub dont_check_compiler_stderr: bool, // Don't force a --crate-type=dylib flag on the command line + // + // Set this for example if you have an auxiliary test file that contains + // a proc-macro and needs `#![crate_type = "proc-macro"]`. This ensures + // that the aux file is compiled as a `proc-macro` and not as a `dylib`. pub no_prefer_dynamic: bool, // Run --pretty expanded when running pretty printing tests pub pretty_expanded: bool, @@ -490,7 +494,7 @@ impl TestProps { } if !self.compile_pass { - // run-pass implies must_compile_successfully + // run-pass implies compile_pass self.compile_pass = config.parse_compile_pass(ln) || self.run_pass; } From 9017d46901700a4b877f47b2c715841557b388a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Tue, 9 Apr 2019 10:19:53 +0200 Subject: [PATCH 04/18] Make trait_methods_not_found use a lock --- src/librustc/session/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 2f3df32945ceb..9cd6c30e272f5 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -166,7 +166,7 @@ pub struct Session { pub driver_lint_caps: FxHashMap, /// `Span`s of trait methods that weren't found to avoid emitting object safety errors - pub trait_methods_not_found: OneThread>>, + pub trait_methods_not_found: Lock>, } pub struct PerfStats { @@ -1236,7 +1236,7 @@ fn build_session_( has_global_allocator: Once::new(), has_panic_handler: Once::new(), driver_lint_caps, - trait_methods_not_found: OneThread::new(RefCell::new(Default::default())), + trait_methods_not_found: Lock::new(Default::default()), }; validate_commandline_args_with_session_available(&sess); From 3262d1e25242a6dc0c486e78be8b03b71a9106b7 Mon Sep 17 00:00:00 2001 From: Edd Barrett Date: Tue, 9 Apr 2019 11:48:31 +0100 Subject: [PATCH 05/18] Kill dead code dominator code. --- .../graph/dominators/mod.rs | 47 ------------------- 1 file changed, 47 deletions(-) diff --git a/src/librustc_data_structures/graph/dominators/mod.rs b/src/librustc_data_structures/graph/dominators/mod.rs index aaed41d9fa362..93a2a261c6fde 100644 --- a/src/librustc_data_structures/graph/dominators/mod.rs +++ b/src/librustc_data_structures/graph/dominators/mod.rs @@ -8,8 +8,6 @@ use super::super::indexed_vec::{Idx, IndexVec}; use super::iterate::reverse_post_order; use super::ControlFlowGraph; -use std::fmt; - #[cfg(test)] mod test; @@ -158,48 +156,3 @@ impl<'dom, Node: Idx> Iterator for Iter<'dom, Node> { } } } - -pub struct DominatorTree { - root: N, - children: IndexVec>, -} - -impl DominatorTree { - pub fn children(&self, node: Node) -> &[Node] { - &self.children[node] - } -} - -impl fmt::Debug for DominatorTree { - fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Debug::fmt( - &DominatorTreeNode { - tree: self, - node: self.root, - }, - fmt, - ) - } -} - -struct DominatorTreeNode<'tree, Node: Idx> { - tree: &'tree DominatorTree, - node: Node, -} - -impl<'tree, Node: Idx> fmt::Debug for DominatorTreeNode<'tree, Node> { - fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { - let subtrees: Vec<_> = self.tree - .children(self.node) - .iter() - .map(|&child| DominatorTreeNode { - tree: self.tree, - node: child, - }) - .collect(); - fmt.debug_tuple("") - .field(&self.node) - .field(&subtrees) - .finish() - } -} From 757ef3843192b27100ec1746721386d245a8644d Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Mon, 8 Apr 2019 17:58:18 -0400 Subject: [PATCH 06/18] improve unknown enum variant errors --- src/librustc_typeck/astconv.rs | 21 +++--- src/librustc_typeck/check/method/suggest.rs | 51 ++++++++------- .../associated-item/associated-item-enum.rs | 20 ++++++ .../associated-item-enum.stderr | 36 ++++++++++ src/test/ui/auto-ref-slice-plus-ref.stderr | 2 +- src/test/ui/block-result/issue-3563.stderr | 2 +- src/test/ui/bogus-tag.stderr | 6 +- src/test/ui/empty/empty-struct-braces-expr.rs | 6 +- .../ui/empty/empty-struct-braces-expr.stderr | 20 ++++-- src/test/ui/issues/issue-22933-2.rs | 2 +- src/test/ui/issues/issue-22933-2.stderr | 6 +- src/test/ui/issues/issue-23173.rs | 12 ++-- src/test/ui/issues/issue-23173.stderr | 12 ++-- src/test/ui/issues/issue-23217.rs | 3 +- src/test/ui/issues/issue-23217.stderr | 8 +-- src/test/ui/issues/issue-28344.stderr | 4 +- src/test/ui/issues/issue-28971.rs | 4 +- src/test/ui/issues/issue-28971.stderr | 10 +-- src/test/ui/issues/issue-34209.rs | 3 +- src/test/ui/issues/issue-34209.stderr | 11 ++-- .../result-deref-err.stderr | 2 +- .../ui/suggestions/suggest-methods.stderr | 6 +- src/test/ui/suggestions/suggest-variants.rs | 3 + .../ui/suggestions/suggest-variants.stderr | 65 ++++++++++++++++--- 24 files changed, 216 insertions(+), 99 deletions(-) create mode 100644 src/test/ui/associated-item/associated-item-enum.rs create mode 100644 src/test/ui/associated-item/associated-item-enum.stderr diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 8805dade40e4c..0c206b27f8058 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1362,12 +1362,11 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { let msg = format!("expected type, found variant `{}`", assoc_ident); tcx.sess.span_err(span, &msg); } else if qself_ty.is_enum() { - // Report as incorrect enum variant rather than ambiguous type. let mut err = tcx.sess.struct_span_err( - span, - &format!("no variant `{}` on enum `{}`", &assoc_ident.as_str(), qself_ty), + assoc_ident.span, + &format!("no variant `{}` in enum `{}`", assoc_ident, qself_ty), ); - // Check if it was a typo. + let adt_def = qself_ty.ty_adt_def().expect("enum is not an ADT"); if let Some(suggested_name) = find_best_match_for_name( adt_def.variants.iter().map(|variant| &variant.ident.name), @@ -1375,14 +1374,20 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { None, ) { err.span_suggestion( - span, - "did you mean", - format!("{}::{}", qself_ty, suggested_name), + assoc_ident.span, + "there is a variant with a similar name", + suggested_name.to_string(), Applicability::MaybeIncorrect, ); } else { - err.span_label(span, "unknown variant"); + err.span_label(span, format!("variant not found in `{}`", qself_ty)); } + + if let Some(sp) = tcx.hir().span_if_local(adt_def.did) { + let sp = tcx.sess.source_map().def_span(sp); + err.span_label(sp, format!("variant `{}` not found here", assoc_ident)); + } + err.emit(); } else if !qself_ty.references_error() { // Don't print `TyErr` to the user. diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 5f5c7cfec9578..31b7724d63816 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -14,11 +14,11 @@ use rustc::hir::map as hir_map; use rustc::hir::print; use rustc::infer::type_variable::TypeVariableOrigin; use rustc::traits::Obligation; -use rustc::ty::{self, Adt, Ty, TyCtxt, ToPolyTraitRef, ToPredicate, TypeFoldable}; +use rustc::ty::{self, Ty, TyCtxt, ToPolyTraitRef, ToPredicate, TypeFoldable}; use rustc::ty::print::with_crate_prefix; use syntax_pos::{Span, FileName}; use syntax::ast; -use syntax::util::lev_distance::find_best_match_for_name; +use syntax::util::lev_distance; use std::cmp::Ordering; @@ -188,17 +188,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let actual = self.resolve_type_vars_if_possible(&rcvr_ty); let ty_str = self.ty_to_string(actual); let is_method = mode == Mode::MethodCall; - let mut suggestion = None; let item_kind = if is_method { "method" } else if actual.is_enum() { - if let Adt(ref adt_def, _) = actual.sty { - let names = adt_def.variants.iter().map(|s| &s.ident.name); - suggestion = find_best_match_for_name(names, - &item_name.as_str(), - None); - } - "variant" + "variant or associated item" } else { match (item_name.as_str().chars().next(), actual.is_fresh_ty()) { (Some(name), false) if name.is_lowercase() => { @@ -299,7 +292,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { return; } else { span = item_name.span; - let mut err = struct_span_err!( + struct_span_err!( tcx.sess, span, E0599, @@ -307,17 +300,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { item_kind, item_name, ty_str - ); - if let Some(suggestion) = suggestion { - // enum variant - err.span_suggestion( - span, - "did you mean", - suggestion.to_string(), - Applicability::MaybeIncorrect, - ); - } - err + ) } } else { tcx.sess.diagnostic().struct_dummy() @@ -469,14 +452,36 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { out_of_scope_traits); } + if actual.is_enum() { + let adt_def = actual.ty_adt_def().expect("enum is not an ADT"); + if let Some(suggestion) = lev_distance::find_best_match_for_name( + adt_def.variants.iter().map(|s| &s.ident.name), + &item_name.as_str(), + None, + ) { + err.span_suggestion( + span, + "there is a variant with a similar name", + suggestion.to_string(), + Applicability::MaybeIncorrect, + ); + } + } + if let Some(lev_candidate) = lev_candidate { + let def = lev_candidate.def(); err.span_suggestion( span, - "did you mean", + &format!( + "there is {} {} with a similar name", + def.article(), + def.kind_name(), + ), lev_candidate.ident.to_string(), Applicability::MaybeIncorrect, ); } + err.emit(); } diff --git a/src/test/ui/associated-item/associated-item-enum.rs b/src/test/ui/associated-item/associated-item-enum.rs new file mode 100644 index 0000000000000..30ba258155bb9 --- /dev/null +++ b/src/test/ui/associated-item/associated-item-enum.rs @@ -0,0 +1,20 @@ +enum Enum { Variant } + +impl Enum { + const MISSPELLABLE: i32 = 0; + fn misspellable() {} +} + +trait Trait { + fn misspellable_trait() {} +} + +impl Trait for Enum { + fn misspellable_trait() {} +} + +fn main() { + Enum::mispellable(); //~ ERROR no variant or associated item + Enum::mispellable_trait(); //~ ERROR no variant or associated item + Enum::MISPELLABLE; //~ ERROR no variant or associated item +} diff --git a/src/test/ui/associated-item/associated-item-enum.stderr b/src/test/ui/associated-item/associated-item-enum.stderr new file mode 100644 index 0000000000000..5a62b9736dedd --- /dev/null +++ b/src/test/ui/associated-item/associated-item-enum.stderr @@ -0,0 +1,36 @@ +error[E0599]: no variant or associated item named `mispellable` found for type `Enum` in the current scope + --> $DIR/associated-item-enum.rs:17:11 + | +LL | enum Enum { Variant } + | --------- variant or associated item `mispellable` not found here +... +LL | Enum::mispellable(); + | ^^^^^^^^^^^ + | | + | variant or associated item not found in `Enum` + | help: there is a method with a similar name: `misspellable` + +error[E0599]: no variant or associated item named `mispellable_trait` found for type `Enum` in the current scope + --> $DIR/associated-item-enum.rs:18:11 + | +LL | enum Enum { Variant } + | --------- variant or associated item `mispellable_trait` not found here +... +LL | Enum::mispellable_trait(); + | ^^^^^^^^^^^^^^^^^ variant or associated item not found in `Enum` + +error[E0599]: no variant or associated item named `MISPELLABLE` found for type `Enum` in the current scope + --> $DIR/associated-item-enum.rs:19:11 + | +LL | enum Enum { Variant } + | --------- variant or associated item `MISPELLABLE` not found here +... +LL | Enum::MISPELLABLE; + | ^^^^^^^^^^^ + | | + | variant or associated item not found in `Enum` + | help: there is an associated constant with a similar name: `MISSPELLABLE` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/auto-ref-slice-plus-ref.stderr b/src/test/ui/auto-ref-slice-plus-ref.stderr index 97b9cd961a026..f2e0d379d1b30 100644 --- a/src/test/ui/auto-ref-slice-plus-ref.stderr +++ b/src/test/ui/auto-ref-slice-plus-ref.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `test_mut` found for type `std::vec::Vec<{integer} --> $DIR/auto-ref-slice-plus-ref.rs:7:7 | LL | a.test_mut(); - | ^^^^^^^^ help: did you mean: `get_mut` + | ^^^^^^^^ help: there is a method with a similar name: `get_mut` | = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `test_mut`, perhaps you need to implement it: diff --git a/src/test/ui/block-result/issue-3563.stderr b/src/test/ui/block-result/issue-3563.stderr index a6346a5233f4c..237b8c54ce301 100644 --- a/src/test/ui/block-result/issue-3563.stderr +++ b/src/test/ui/block-result/issue-3563.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `b` found for type `&Self` in the current scope --> $DIR/issue-3563.rs:3:17 | LL | || self.b() - | ^ help: did you mean: `a` + | ^ help: there is a method with a similar name: `a` error: aborting due to previous error diff --git a/src/test/ui/bogus-tag.stderr b/src/test/ui/bogus-tag.stderr index 0bf0d4b14ee91..890f6800c22af 100644 --- a/src/test/ui/bogus-tag.stderr +++ b/src/test/ui/bogus-tag.stderr @@ -1,11 +1,11 @@ -error[E0599]: no variant named `Hsl` found for type `Color` in the current scope +error[E0599]: no variant or associated item named `Hsl` found for type `Color` in the current scope --> $DIR/bogus-tag.rs:7:16 | LL | enum Color { Rgb(isize, isize, isize), Rgba(isize, isize, isize, isize), } - | ---------- variant `Hsl` not found here + | ---------- variant or associated item `Hsl` not found here ... LL | Color::Hsl(h, s, l) => { println!("hsl"); } - | ^^^ variant not found in `Color` + | ^^^ variant or associated item not found in `Color` error: aborting due to previous error diff --git a/src/test/ui/empty/empty-struct-braces-expr.rs b/src/test/ui/empty/empty-struct-braces-expr.rs index 2f2f41ae8c1f0..e33fcb70db775 100644 --- a/src/test/ui/empty/empty-struct-braces-expr.rs +++ b/src/test/ui/empty/empty-struct-braces-expr.rs @@ -19,6 +19,8 @@ fn main() { let xe1 = XEmpty1; //~ ERROR expected value, found struct `XEmpty1` let xe1 = XEmpty1(); //~ ERROR expected function, found struct `XEmpty1` - let xe3 = XE::Empty3; //~ ERROR no variant named `Empty3` found for type - let xe3 = XE::Empty3(); //~ ERROR no variant named `Empty3` found for type + let xe3 = XE::Empty3; //~ ERROR no variant or associated item named `Empty3` found for type + let xe3 = XE::Empty3(); //~ ERROR no variant or associated item named `Empty3` found for type + + XE::Empty1 {}; //~ ERROR no variant `Empty1` in enum `empty_struct::XE` } diff --git a/src/test/ui/empty/empty-struct-braces-expr.stderr b/src/test/ui/empty/empty-struct-braces-expr.stderr index 57c8c1c85dd41..f5609c8e1bf7b 100644 --- a/src/test/ui/empty/empty-struct-braces-expr.stderr +++ b/src/test/ui/empty/empty-struct-braces-expr.stderr @@ -46,25 +46,31 @@ LL | let xe1 = XEmpty1(); | did you mean `XEmpty1 { /* fields */ }`? | help: a unit struct with a similar name exists: `XEmpty2` -error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the current scope +error[E0599]: no variant or associated item named `Empty3` found for type `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:22:19 | LL | let xe3 = XE::Empty3; | ^^^^^^ | | - | variant not found in `empty_struct::XE` - | help: did you mean: `XEmpty3` + | variant or associated item not found in `empty_struct::XE` + | help: there is a variant with a similar name: `XEmpty3` -error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the current scope +error[E0599]: no variant or associated item named `Empty3` found for type `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:23:19 | LL | let xe3 = XE::Empty3(); | ^^^^^^ | | - | variant not found in `empty_struct::XE` - | help: did you mean: `XEmpty3` + | variant or associated item not found in `empty_struct::XE` + | help: there is a variant with a similar name: `XEmpty3` -error: aborting due to 8 previous errors +error: no variant `Empty1` in enum `empty_struct::XE` + --> $DIR/empty-struct-braces-expr.rs:25:9 + | +LL | XE::Empty1 {}; + | ^^^^^^ help: there is a variant with a similar name: `XEmpty3` + +error: aborting due to 9 previous errors Some errors occurred: E0423, E0599. For more information about an error, try `rustc --explain E0423`. diff --git a/src/test/ui/issues/issue-22933-2.rs b/src/test/ui/issues/issue-22933-2.rs index 68d9ef2cfa809..98a354b1bd0fc 100644 --- a/src/test/ui/issues/issue-22933-2.rs +++ b/src/test/ui/issues/issue-22933-2.rs @@ -2,7 +2,7 @@ enum Delicious { Pie = 0x1, Apple = 0x2, ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, - //~^ ERROR no variant named `PIE` found for type `Delicious` + //~^ ERROR no variant or associated item named `PIE` found for type `Delicious` } fn main() {} diff --git a/src/test/ui/issues/issue-22933-2.stderr b/src/test/ui/issues/issue-22933-2.stderr index 23b1474bde704..72038ea20a3fa 100644 --- a/src/test/ui/issues/issue-22933-2.stderr +++ b/src/test/ui/issues/issue-22933-2.stderr @@ -1,11 +1,11 @@ -error[E0599]: no variant named `PIE` found for type `Delicious` in the current scope +error[E0599]: no variant or associated item named `PIE` found for type `Delicious` in the current scope --> $DIR/issue-22933-2.rs:4:55 | LL | enum Delicious { - | -------------- variant `PIE` not found here + | -------------- variant or associated item `PIE` not found here ... LL | ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, - | ^^^ variant not found in `Delicious` + | ^^^ variant or associated item not found in `Delicious` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23173.rs b/src/test/ui/issues/issue-23173.rs index 2922ebddf4c8a..7c15598448d7f 100644 --- a/src/test/ui/issues/issue-23173.rs +++ b/src/test/ui/issues/issue-23173.rs @@ -6,12 +6,8 @@ struct Struct { fn use_token(token: &Token) { unimplemented!() } fn main() { - use_token(&Token::Homura); - //~^ ERROR no variant named `Homura` - Struct::method(); - //~^ ERROR no function or associated item named `method` found for type - Struct::method; - //~^ ERROR no function or associated item named `method` found for type - Struct::Assoc; - //~^ ERROR no associated item named `Assoc` found for type `Struct` in + use_token(&Token::Homura); //~ ERROR no variant or associated item named `Homura` + Struct::method(); //~ ERROR no function or associated item named `method` found for type + Struct::method; //~ ERROR no function or associated item named `method` found for type + Struct::Assoc; //~ ERROR no associated item named `Assoc` found for type `Struct` in } diff --git a/src/test/ui/issues/issue-23173.stderr b/src/test/ui/issues/issue-23173.stderr index 75dba883608e9..699e41156fa80 100644 --- a/src/test/ui/issues/issue-23173.stderr +++ b/src/test/ui/issues/issue-23173.stderr @@ -1,14 +1,14 @@ -error[E0599]: no variant named `Homura` found for type `Token` in the current scope +error[E0599]: no variant or associated item named `Homura` found for type `Token` in the current scope --> $DIR/issue-23173.rs:9:23 | LL | enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ } - | ---------- variant `Homura` not found here + | ---------- variant or associated item `Homura` not found here ... LL | use_token(&Token::Homura); - | ^^^^^^ variant not found in `Token` + | ^^^^^^ variant or associated item not found in `Token` error[E0599]: no function or associated item named `method` found for type `Struct` in the current scope - --> $DIR/issue-23173.rs:11:13 + --> $DIR/issue-23173.rs:10:13 | LL | struct Struct { | ------------- function or associated item `method` not found for this @@ -17,7 +17,7 @@ LL | Struct::method(); | ^^^^^^ function or associated item not found in `Struct` error[E0599]: no function or associated item named `method` found for type `Struct` in the current scope - --> $DIR/issue-23173.rs:13:13 + --> $DIR/issue-23173.rs:11:13 | LL | struct Struct { | ------------- function or associated item `method` not found for this @@ -26,7 +26,7 @@ LL | Struct::method; | ^^^^^^ function or associated item not found in `Struct` error[E0599]: no associated item named `Assoc` found for type `Struct` in the current scope - --> $DIR/issue-23173.rs:15:13 + --> $DIR/issue-23173.rs:12:13 | LL | struct Struct { | ------------- associated item `Assoc` not found for this diff --git a/src/test/ui/issues/issue-23217.rs b/src/test/ui/issues/issue-23217.rs index 11426df6177ca..157f20d22d8ae 100644 --- a/src/test/ui/issues/issue-23217.rs +++ b/src/test/ui/issues/issue-23217.rs @@ -1,6 +1,5 @@ pub enum SomeEnum { - B = SomeEnum::A, - //~^ ERROR no variant named `A` found for type `SomeEnum` + B = SomeEnum::A, //~ ERROR no variant or associated item named `A` found for type `SomeEnum` } fn main() {} diff --git a/src/test/ui/issues/issue-23217.stderr b/src/test/ui/issues/issue-23217.stderr index 2a982422cab9c..97100ed375374 100644 --- a/src/test/ui/issues/issue-23217.stderr +++ b/src/test/ui/issues/issue-23217.stderr @@ -1,13 +1,13 @@ -error[E0599]: no variant named `A` found for type `SomeEnum` in the current scope +error[E0599]: no variant or associated item named `A` found for type `SomeEnum` in the current scope --> $DIR/issue-23217.rs:2:19 | LL | pub enum SomeEnum { - | ----------------- variant `A` not found here + | ----------------- variant or associated item `A` not found here LL | B = SomeEnum::A, | ^ | | - | variant not found in `SomeEnum` - | help: did you mean: `B` + | variant or associated item not found in `SomeEnum` + | help: there is a variant with a similar name: `B` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-28344.stderr b/src/test/ui/issues/issue-28344.stderr index fcd98b111cfc5..f3a8019e2329c 100644 --- a/src/test/ui/issues/issue-28344.stderr +++ b/src/test/ui/issues/issue-28344.stderr @@ -11,7 +11,7 @@ LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); | ^^^^^ | | | function or associated item not found in `dyn std::ops::BitXor<_>` - | help: did you mean: `bitxor` + | help: there is a method with a similar name: `bitxor` error[E0191]: the value of the associated type `Output` (from the trait `std::ops::BitXor`) must be specified --> $DIR/issue-28344.rs:8:13 @@ -26,7 +26,7 @@ LL | let g = BitXor::bitor; | ^^^^^ | | | function or associated item not found in `dyn std::ops::BitXor<_>` - | help: did you mean: `bitxor` + | help: there is a method with a similar name: `bitxor` error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-28971.rs b/src/test/ui/issues/issue-28971.rs index 3f0d2fafb0478..6493565d21647 100644 --- a/src/test/ui/issues/issue-28971.rs +++ b/src/test/ui/issues/issue-28971.rs @@ -1,5 +1,3 @@ -// This should not cause an ICE - enum Foo { Bar(u8) } @@ -7,7 +5,7 @@ fn main(){ foo(|| { match Foo::Bar(1) { Foo::Baz(..) => (), - //~^ ERROR no variant named `Baz` found for type `Foo` + //~^ ERROR no variant or associated item named `Baz` found for type `Foo` _ => (), } }); diff --git a/src/test/ui/issues/issue-28971.stderr b/src/test/ui/issues/issue-28971.stderr index 4781f7abe8116..7411896443dfe 100644 --- a/src/test/ui/issues/issue-28971.stderr +++ b/src/test/ui/issues/issue-28971.stderr @@ -1,14 +1,14 @@ -error[E0599]: no variant named `Baz` found for type `Foo` in the current scope - --> $DIR/issue-28971.rs:9:18 +error[E0599]: no variant or associated item named `Baz` found for type `Foo` in the current scope + --> $DIR/issue-28971.rs:7:18 | LL | enum Foo { - | -------- variant `Baz` not found here + | -------- variant or associated item `Baz` not found here ... LL | Foo::Baz(..) => (), | ^^^ | | - | variant not found in `Foo` - | help: did you mean: `Bar` + | variant or associated item not found in `Foo` + | help: there is a variant with a similar name: `Bar` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-34209.rs b/src/test/ui/issues/issue-34209.rs index 50095be7740ef..fc2c3679e13b8 100644 --- a/src/test/ui/issues/issue-34209.rs +++ b/src/test/ui/issues/issue-34209.rs @@ -4,8 +4,7 @@ enum S { fn bug(l: S) { match l { - S::B { } => { }, - //~^ ERROR no variant `B` on enum `S` + S::B {} => {}, //~ ERROR no variant `B` in enum `S` } } diff --git a/src/test/ui/issues/issue-34209.stderr b/src/test/ui/issues/issue-34209.stderr index 79aba89c1484e..194bb2bfab8ae 100644 --- a/src/test/ui/issues/issue-34209.stderr +++ b/src/test/ui/issues/issue-34209.stderr @@ -1,8 +1,11 @@ -error: no variant `B` on enum `S` - --> $DIR/issue-34209.rs:7:9 +error: no variant `B` in enum `S` + --> $DIR/issue-34209.rs:7:12 | -LL | S::B { } => { }, - | ^^^^ help: did you mean: `S::A` +LL | enum S { + | ------ variant `B` not found here +... +LL | S::B {} => {}, + | ^ help: there is a variant with a similar name: `A` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr index 96d6814b0fe93..333036127eadb 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `deref_err` found for type `std::result::Result<_, --> $DIR/result-deref-err.rs:4:28 | LL | let _result = &Err(41).deref_err(); - | ^^^^^^^^^ help: did you mean: `deref_ok` + | ^^^^^^^^^ help: there is a method with a similar name: `deref_ok` | = note: the method `deref_err` exists but the following trait bounds were not satisfied: `{integer} : std::ops::Deref` diff --git a/src/test/ui/suggestions/suggest-methods.stderr b/src/test/ui/suggestions/suggest-methods.stderr index 09d58575d97dd..ad4a4deb5a886 100644 --- a/src/test/ui/suggestions/suggest-methods.stderr +++ b/src/test/ui/suggestions/suggest-methods.stderr @@ -5,19 +5,19 @@ LL | struct Foo; | ----------- method `bat` not found for this ... LL | f.bat(1.0); - | ^^^ help: did you mean: `bar` + | ^^^ help: there is a method with a similar name: `bar` error[E0599]: no method named `is_emtpy` found for type `std::string::String` in the current scope --> $DIR/suggest-methods.rs:21:15 | LL | let _ = s.is_emtpy(); - | ^^^^^^^^ help: did you mean: `is_empty` + | ^^^^^^^^ help: there is a method with a similar name: `is_empty` error[E0599]: no method named `count_eos` found for type `u32` in the current scope --> $DIR/suggest-methods.rs:25:19 | LL | let _ = 63u32.count_eos(); - | ^^^^^^^^^ help: did you mean: `count_zeros` + | ^^^^^^^^^ help: there is a method with a similar name: `count_zeros` error[E0599]: no method named `count_o` found for type `u32` in the current scope --> $DIR/suggest-methods.rs:28:19 diff --git a/src/test/ui/suggestions/suggest-variants.rs b/src/test/ui/suggestions/suggest-variants.rs index 6d6e280d9652f..d418834432e08 100644 --- a/src/test/ui/suggestions/suggest-variants.rs +++ b/src/test/ui/suggestions/suggest-variants.rs @@ -12,4 +12,7 @@ fn main() { println!("My shape is {:?}", Shape::Squareee { size: 5}); //~ ERROR no variant `Squareee` println!("My shape is {:?}", Shape::Circl { size: 5}); //~ ERROR no variant `Circl` println!("My shape is {:?}", Shape::Rombus{ size: 5}); //~ ERROR no variant `Rombus` + Shape::Squareee; //~ ERROR no variant + Shape::Circl; //~ ERROR no variant + Shape::Rombus; //~ ERROR no variant } diff --git a/src/test/ui/suggestions/suggest-variants.stderr b/src/test/ui/suggestions/suggest-variants.stderr index 08ae68ea71302..ef0ba70c34066 100644 --- a/src/test/ui/suggestions/suggest-variants.stderr +++ b/src/test/ui/suggestions/suggest-variants.stderr @@ -1,20 +1,65 @@ -error: no variant `Squareee` on enum `Shape` - --> $DIR/suggest-variants.rs:12:34 +error: no variant `Squareee` in enum `Shape` + --> $DIR/suggest-variants.rs:12:41 | +LL | enum Shape { + | ---------- variant `Squareee` not found here +... LL | println!("My shape is {:?}", Shape::Squareee { size: 5}); - | ^^^^^^^^^^^^^^^ help: did you mean: `Shape::Square` + | ^^^^^^^^ help: there is a variant with a similar name: `Square` -error: no variant `Circl` on enum `Shape` - --> $DIR/suggest-variants.rs:13:34 +error: no variant `Circl` in enum `Shape` + --> $DIR/suggest-variants.rs:13:41 | +LL | enum Shape { + | ---------- variant `Circl` not found here +... LL | println!("My shape is {:?}", Shape::Circl { size: 5}); - | ^^^^^^^^^^^^ help: did you mean: `Shape::Circle` + | ^^^^^ help: there is a variant with a similar name: `Circle` -error: no variant `Rombus` on enum `Shape` - --> $DIR/suggest-variants.rs:14:34 +error: no variant `Rombus` in enum `Shape` + --> $DIR/suggest-variants.rs:14:41 | +LL | enum Shape { + | ---------- variant `Rombus` not found here +... LL | println!("My shape is {:?}", Shape::Rombus{ size: 5}); - | ^^^^^^^^^^^^^ unknown variant + | -------^^^^^^ + | | + | variant not found in `Shape` -error: aborting due to 3 previous errors +error[E0599]: no variant or associated item named `Squareee` found for type `Shape` in the current scope + --> $DIR/suggest-variants.rs:15:12 + | +LL | enum Shape { + | ---------- variant or associated item `Squareee` not found here +... +LL | Shape::Squareee; + | ^^^^^^^^ + | | + | variant or associated item not found in `Shape` + | help: there is a variant with a similar name: `Square` + +error[E0599]: no variant or associated item named `Circl` found for type `Shape` in the current scope + --> $DIR/suggest-variants.rs:16:12 + | +LL | enum Shape { + | ---------- variant or associated item `Circl` not found here +... +LL | Shape::Circl; + | ^^^^^ + | | + | variant or associated item not found in `Shape` + | help: there is a variant with a similar name: `Circle` + +error[E0599]: no variant or associated item named `Rombus` found for type `Shape` in the current scope + --> $DIR/suggest-variants.rs:17:12 + | +LL | enum Shape { + | ---------- variant or associated item `Rombus` not found here +... +LL | Shape::Rombus; + | ^^^^^^ variant or associated item not found in `Shape` + +error: aborting due to 6 previous errors +For more information about this error, try `rustc --explain E0599`. From 3e01901fcdbe40ebefe706bf6f460742b9f15d2e Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 9 Apr 2019 15:41:38 -0700 Subject: [PATCH 07/18] Remove strange formatting in `Ordering` docs. --- src/libcore/cmp.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 807b35e1af10b..14908108fc5a6 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -286,13 +286,13 @@ pub struct AssertParamIsEq { _field: ::marker::PhantomData } #[derive(Clone, Copy, PartialEq, Debug, Hash)] #[stable(feature = "rust1", since = "1.0.0")] pub enum Ordering { - /// An ordering where a compared value is less [than another]. + /// An ordering where a compared value is less than another. #[stable(feature = "rust1", since = "1.0.0")] Less = -1, - /// An ordering where a compared value is equal [to another]. + /// An ordering where a compared value is equal to another. #[stable(feature = "rust1", since = "1.0.0")] Equal = 0, - /// An ordering where a compared value is greater [than another]. + /// An ordering where a compared value is greater than another. #[stable(feature = "rust1", since = "1.0.0")] Greater = 1, } From 38264937fc16624b4f3959dec12c0440e5a8f628 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 9 Apr 2019 21:43:41 -0700 Subject: [PATCH 08/18] std::ops::Div examples: correct nominator to numerator Signed-off-by: Anders Kaseorg --- src/libcore/ops/arith.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/libcore/ops/arith.rs b/src/libcore/ops/arith.rs index 0688a606591e4..8139305f5302d 100644 --- a/src/libcore/ops/arith.rs +++ b/src/libcore/ops/arith.rs @@ -220,21 +220,21 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } /// // derive `Eq` and `PartialEq`. /// #[derive(Debug, Eq, PartialEq)] /// struct Rational { -/// nominator: usize, +/// numerator: usize, /// denominator: usize, /// } /// /// impl Rational { -/// fn new(nominator: usize, denominator: usize) -> Self { +/// fn new(numerator: usize, denominator: usize) -> Self { /// if denominator == 0 { /// panic!("Zero is an invalid denominator!"); /// } /// /// // Reduce to lowest terms by dividing by the greatest common /// // divisor. -/// let gcd = gcd(nominator, denominator); +/// let gcd = gcd(numerator, denominator); /// Rational { -/// nominator: nominator / gcd, +/// numerator: numerator / gcd, /// denominator: denominator / gcd, /// } /// } @@ -245,9 +245,9 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } /// type Output = Self; /// /// fn mul(self, rhs: Self) -> Self { -/// let nominator = self.nominator * rhs.nominator; +/// let numerator = self.numerator * rhs.numerator; /// let denominator = self.denominator * rhs.denominator; -/// Rational::new(nominator, denominator) +/// Rational::new(numerator, denominator) /// } /// } /// @@ -340,21 +340,21 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } /// // derive `Eq` and `PartialEq`. /// #[derive(Debug, Eq, PartialEq)] /// struct Rational { -/// nominator: usize, +/// numerator: usize, /// denominator: usize, /// } /// /// impl Rational { -/// fn new(nominator: usize, denominator: usize) -> Self { +/// fn new(numerator: usize, denominator: usize) -> Self { /// if denominator == 0 { /// panic!("Zero is an invalid denominator!"); /// } /// /// // Reduce to lowest terms by dividing by the greatest common /// // divisor. -/// let gcd = gcd(nominator, denominator); +/// let gcd = gcd(numerator, denominator); /// Rational { -/// nominator: nominator / gcd, +/// numerator: numerator / gcd, /// denominator: denominator / gcd, /// } /// } @@ -365,13 +365,13 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } /// type Output = Self; /// /// fn div(self, rhs: Self) -> Self::Output { -/// if rhs.nominator == 0 { +/// if rhs.numerator == 0 { /// panic!("Cannot divide by zero-valued `Rational`!"); /// } /// -/// let nominator = self.nominator * rhs.denominator; -/// let denominator = self.denominator * rhs.nominator; -/// Rational::new(nominator, denominator) +/// let numerator = self.numerator * rhs.denominator; +/// let denominator = self.denominator * rhs.numerator; +/// Rational::new(numerator, denominator) /// } /// } /// From 7acfa453df8f3c4b458614ff86d857ad53a7994d Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 10 Apr 2019 12:10:25 +0200 Subject: [PATCH 09/18] Updated the documentation, now claiming the -Z is associated to unstable compiler flags, instead of flags for debugging. --- src/librustc_driver/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 4b7cffaad5509..ca6bd9616536e 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -743,7 +743,7 @@ fn usage(verbose: bool, include_unstable_options: bool) { } let message = "Usage: rustc [OPTIONS] INPUT"; let nightly_help = if nightly_options::is_nightly_build() { - "\n -Z help Print internal options for debugging rustc" + "\n -Z help Print unstable compiler options" } else { "" }; @@ -891,7 +891,7 @@ Available lint options: } fn describe_debug_flags() { - println!("\nAvailable debug options:\n"); + println!("\nAvailable options:\n"); print_flag_list("-Z", config::DB_OPTIONS); } From cdeb7455eaa66a531f56c1366b96b9f4db25384d Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 10 Apr 2019 12:20:47 +0200 Subject: [PATCH 10/18] Updated the description of -Z in the rustc book. --- src/doc/rustc/src/command-line-arguments.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/doc/rustc/src/command-line-arguments.md b/src/doc/rustc/src/command-line-arguments.md index 18d7052c2c574..dfb40284ef6cf 100644 --- a/src/doc/rustc/src/command-line-arguments.md +++ b/src/doc/rustc/src/command-line-arguments.md @@ -86,11 +86,12 @@ This flag will set which lints should be set to the [deny level](lints/levels.ht This flag will set which lints should be set to the [forbid level](lints/levels.html#forbid). -## `-Z`: set options for debugging rustc +## `-Z`: set unstable options -This flag lets you set options for debugging rustc. In order to set multiple options, the -Z flag -can be used multiple times. For example: `rustc -Z verbose -Z time`. Specifying options with -Z is -only available on nightly. To view all available options run: `rustc -Z help`. +This flag will allow you to set unstable options of rustc. In order to set multiple options, +the -Z flag can be used multiple times. For example: `rustc -Z verbose -Z time`. +Specifying options with -Z is only available on nightly. To view all available options +run: `rustc -Z help`. ## `--cap-lints`: set the most restrictive lint level From e2d1d667e283de5183822b333cb3a5e08def9874 Mon Sep 17 00:00:00 2001 From: Jethro Beekman Date: Wed, 10 Apr 2019 14:08:54 -0700 Subject: [PATCH 11/18] SGX target: fix cfg(test) build --- src/libstd/sys/sgx/alloc.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libstd/sys/sgx/alloc.rs b/src/libstd/sys/sgx/alloc.rs index b385d567dd8c4..40daec758a9fc 100644 --- a/src/libstd/sys/sgx/alloc.rs +++ b/src/libstd/sys/sgx/alloc.rs @@ -1,4 +1,4 @@ -use crate::alloc::{self, GlobalAlloc, Layout, System}; +use crate::alloc::{GlobalAlloc, Layout, System}; use super::waitqueue::SpinMutex; @@ -36,11 +36,11 @@ unsafe impl GlobalAlloc for System { #[cfg(not(test))] #[no_mangle] pub unsafe extern "C" fn __rust_c_alloc(size: usize, align: usize) -> *mut u8 { - alloc::alloc(Layout::from_size_align_unchecked(size, align)) + crate::alloc::alloc(Layout::from_size_align_unchecked(size, align)) } #[cfg(not(test))] #[no_mangle] pub unsafe extern "C" fn __rust_c_dealloc(ptr: *mut u8, size: usize, align: usize) { - alloc::dealloc(ptr, Layout::from_size_align_unchecked(size, align)) + crate::alloc::dealloc(ptr, Layout::from_size_align_unchecked(size, align)) } From 023487867c407860e8d25128be372bf9e0021752 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Thu, 11 Apr 2019 07:56:25 -0400 Subject: [PATCH 12/18] Update TRPL to use mdbook 0.2 --- src/bootstrap/doc.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index d831d2f1af2dd..330f66c1df0df 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -277,7 +277,7 @@ impl Step for TheBook { builder.ensure(Rustbook { target, name: INTERNER.intern_string(name.to_string()), - version: RustbookVersion::MdBook1, + version: RustbookVersion::MdBook2, }); // building older edition redirects @@ -286,21 +286,21 @@ impl Step for TheBook { builder.ensure(Rustbook { target, name: INTERNER.intern_string(source_name), - version: RustbookVersion::MdBook1, + version: RustbookVersion::MdBook2, }); let source_name = format!("{}/second-edition", name); builder.ensure(Rustbook { target, name: INTERNER.intern_string(source_name), - version: RustbookVersion::MdBook1, + version: RustbookVersion::MdBook2, }); let source_name = format!("{}/2018-edition", name); builder.ensure(Rustbook { target, name: INTERNER.intern_string(source_name), - version: RustbookVersion::MdBook1, + version: RustbookVersion::MdBook2, }); // build the version info page and CSS From f54df449072895f258876adf9545fe3a0840492f Mon Sep 17 00:00:00 2001 From: Scott Olson Date: Thu, 11 Apr 2019 07:56:35 -0600 Subject: [PATCH 13/18] Remove note about transmute for float bitpatterns. --- src/libcore/intrinsics.rs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 7756a6f71dbd6..2f725db22ca6a 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -737,16 +737,6 @@ extern "rust-intrinsic" { /// /// There are a few things that `transmute` is really useful for. /// - /// Getting the bitpattern of a floating point type (or, more generally, - /// type punning, when `T` and `U` aren't pointers): - /// - /// ``` - /// let bitpattern = unsafe { - /// std::mem::transmute::(1.0) - /// }; - /// assert_eq!(bitpattern, 0x3F800000); - /// ``` - /// /// Turning a pointer into a function pointer. This is *not* portable to /// machines where function pointers and data pointers have different sizes. /// From ae2a68bcf575261060eb41e5001d58067f16ae75 Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Tue, 9 Apr 2019 15:41:46 +0100 Subject: [PATCH 14/18] Fix broken links on std::boxed doc page --- src/liballoc/boxed.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index cb33b4d47842e..6a6a9146e2432 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -63,6 +63,8 @@ //! //! [dereferencing]: ../../std/ops/trait.Deref.html //! [`Box`]: struct.Box.html +//! [`Global`]: ../alloc/struct.Global.html +//! [`Layout`]: ../alloc/struct.Layout.html #![stable(feature = "rust1", since = "1.0.0")] From aefc1581b125876f37c652f84fddc81b0b25fe12 Mon Sep 17 00:00:00 2001 From: Andrew Banchich Date: Thu, 11 Apr 2019 16:12:04 -0400 Subject: [PATCH 15/18] Update diagnostics.rs Add `a` and other minor text improvements --- src/librustc_mir/diagnostics.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_mir/diagnostics.rs b/src/librustc_mir/diagnostics.rs index e1b66312da2d3..c8836fe51931e 100644 --- a/src/librustc_mir/diagnostics.rs +++ b/src/librustc_mir/diagnostics.rs @@ -2307,10 +2307,10 @@ let q = *p; ``` Here, the expression `&foo()` is borrowing the expression -`foo()`. As `foo()` is call to a function, and not the name of +`foo()`. As `foo()` is a call to a function, and not the name of a variable, this creates a **temporary** -- that temporary stores the return value from `foo()` so that it can be borrowed. -So you might imagine that `let p = bar(&foo())` is equivalent +You could imagine that `let p = bar(&foo());` is equivalent to this: ```compile_fail,E0597 From 90d97279192c7da262dbd427693c1ed94fee5d61 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 11 Apr 2019 14:04:52 -0700 Subject: [PATCH 16/18] Fix the link to sort_by_cached_key It's a primitive slice method, not a standalone function. --- RELEASES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASES.md b/RELEASES.md index 821889d64a5fb..fcaaa73bdc0f4 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -133,7 +133,7 @@ Compatibility Notes [`num::NonZeroI64`]: https://doc.rust-lang.org/std/num/struct.NonZeroI64.html [`num::NonZeroI8`]: https://doc.rust-lang.org/std/num/struct.NonZeroI8.html [`num::NonZeroIsize`]: https://doc.rust-lang.org/std/num/struct.NonZeroIsize.html -[`slice::sort_by_cached_key`]: https://doc.rust-lang.org/std/slice/fn.sort_by_cached_key +[`slice::sort_by_cached_key`]: https://doc.rust-lang.org/std/primitive.slice.html#method.sort_by_cached_key [`str::escape_debug`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_debug [`str::escape_default`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_default [`str::escape_unicode`]: https://doc.rust-lang.org/std/primitive.str.html#method.escape_unicode From 1ced262653bbd8dfbc44a69cc5039d6e4ae6f46b Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Thu, 11 Apr 2019 23:31:34 +0200 Subject: [PATCH 17/18] save-analysis: use `qpath_def` for associated types --- src/librustc_save_analysis/lib.rs | 21 +++------------------ src/librustc_typeck/lib.rs | 2 +- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index a363fe1141891..9b21e42bf3870 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -23,7 +23,6 @@ use rustc::middle::cstore::ExternCrate; use rustc::session::config::{CrateType, Input, OutputType}; use rustc::ty::{self, DefIdTree, TyCtxt}; use rustc::{bug, span_bug}; -use rustc_typeck::hir_ty_to_ty; use rustc_codegen_utils::link::{filename_for_metadata, out_filename}; use rustc_data_structures::sync::Lrc; @@ -658,23 +657,9 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { .. }) => HirDef::Local(self.tcx.hir().hir_to_node_id(canonical_id)), - Node::Ty(ty) => if let hir::Ty { - node: hir::TyKind::Path(ref qpath), - .. - } = *ty - { - match *qpath { - hir::QPath::Resolved(_, ref path) => path.def, - hir::QPath::TypeRelative(..) => { - let ty = hir_ty_to_ty(self.tcx, ty); - if let ty::Projection(proj) = ty.sty { - return HirDef::AssociatedTy(proj.item_def_id); - } - HirDef::Err - } - } - } else { - HirDef::Err + Node::Ty(&hir::Ty { node: hir::TyKind::Path(ref qpath), .. } ) => { + let hir_id = self.tcx.hir().node_to_hir_id(id); + self.tables.qpath_def(qpath, hir_id) }, _ => HirDef::Err, diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 4a7b1e67366e8..710c84a6bc980 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -379,7 +379,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) } } -/// A quasi-deprecated helper used in rustdoc and save-analysis to get +/// A quasi-deprecated helper used in rustdoc and clippy to get /// the type from a HIR node. pub fn hir_ty_to_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_ty: &hir::Ty) -> Ty<'tcx> { // In case there are any projections etc, find the "environment" From bcd263e1f13494197503ec2f3eba554fe6055595 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Thu, 11 Apr 2019 23:53:59 +0200 Subject: [PATCH 18/18] save-analysis: Simplify match arm for type node def --- src/librustc_save_analysis/lib.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 9b21e42bf3870..d6923b4490d59 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -647,6 +647,10 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { Node::Pat(&hir::Pat { node: hir::PatKind::TupleStruct(ref qpath, ..), .. + }) | + Node::Ty(&hir::Ty { + node: hir::TyKind::Path(ref qpath), + .. }) => { let hir_id = self.tcx.hir().node_to_hir_id(id); self.tables.qpath_def(qpath, hir_id) @@ -657,11 +661,6 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { .. }) => HirDef::Local(self.tcx.hir().hir_to_node_id(canonical_id)), - Node::Ty(&hir::Ty { node: hir::TyKind::Path(ref qpath), .. } ) => { - let hir_id = self.tcx.hir().node_to_hir_id(id); - self.tables.qpath_def(qpath, hir_id) - }, - _ => HirDef::Err, } }