diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index 3e571baaa4e51..da4a25e0860b1 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -941,7 +941,7 @@ impl<'a> State<'a> { self.maybe_print_comment(st.span.lo()); match st.node { hir::StmtKind::Local(ref loc) => { - self.print_local(loc.init.deref(), |this| this.print_local_decl(&loc)); + self.print_local(loc.init.as_deref(), |this| this.print_local_decl(&loc)); } hir::StmtKind::Item(item) => { self.ann.nested(self, Nested::Item(item)) diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index b02a7c21027d4..7dfc4b82515d1 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -226,7 +226,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { tcx.mk_unit() } ExprKind::Break(destination, ref expr_opt) => { - self.check_expr_break(destination, expr_opt.deref(), expr) + self.check_expr_break(destination, expr_opt.as_deref(), expr) } ExprKind::Continue(destination) => { if destination.target_id.is_ok() { @@ -237,7 +237,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } ExprKind::Ret(ref expr_opt) => { - self.check_expr_return(expr_opt.deref(), expr) + self.check_expr_return(expr_opt.as_deref(), expr) } ExprKind::Assign(ref lhs, ref rhs) => { self.check_expr_assign(expr, expected, lhs, rhs) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 5db82b23614fc..6270ed3785905 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2137,7 +2137,7 @@ impl Context { self.shared.fs.write(&final_file, &v)?; // Generating settings page. - let settings = Settings::new(self.shared.static_root_path.deref().unwrap_or("./"), + let settings = Settings::new(self.shared.static_root_path.as_deref().unwrap_or("./"), &self.shared.resource_suffix); page.title = "Rustdoc settings"; page.description = "Settings of Rustdoc"; diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr index 54efcfd045ae9..345f91437b827 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref` found for type `std::option::Option<{in --> $DIR/option-as_deref.rs:4:29 | LL | let _result = &Some(42).as_deref(); - | ^^^^^^^^ help: did you mean: `as_ref` + | ^^^^^^^^ help: there is a method with a similar name: `as_ref` | = note: the method `as_deref` exists but the following trait bounds were not satisfied: `{integer} : std::ops::Deref` diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr index 6007f29e566e5..5e016748770dc 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref` found for type `std::result::Result<{in --> $DIR/result-as_deref.rs:4:27 | LL | let _result = &Ok(42).as_deref(); - | ^^^^^^^^ help: did you mean: `as_ref` + | ^^^^^^^^ help: there is a method with a similar name: `as_ref` | = note: the method `as_deref` exists but the following trait bounds were not satisfied: `{integer} : std::ops::Deref` diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err.stderr index 2e918b6835b5a..6dc13da548b12 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_err` found for type `std::result::Result --> $DIR/result-as_deref_err.rs:4:28 | LL | let _result = &Err(41).as_deref_err(); - | ^^^^^^^^^^^^ help: did you mean: `as_deref_ok` + | ^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_ok` | = note: the method `as_deref_err` exists but the following trait bounds were not satisfied: `{integer} : std::ops::Deref` diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr index 3d10cad201ec4..f21e97388b6f4 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_mut` found for type `std::result::Result --> $DIR/result-as_deref_mut.rs:4:31 | LL | let _result = &mut Ok(42).as_deref_mut(); - | ^^^^^^^^^^^^ help: did you mean: `as_deref_err` + | ^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_err` | = note: the method `as_deref_mut` exists but the following trait bounds were not satisfied: `{integer} : std::ops::DerefMut` diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.stderr index 99f941d1bedad..44c0c954eeeca 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_mut_err` found for type `std::result::Re --> $DIR/result-as_deref_mut_err.rs:4:32 | LL | let _result = &mut Err(41).as_deref_mut_err(); - | ^^^^^^^^^^^^^^^^ help: did you mean: `as_deref_mut_ok` + | ^^^^^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_mut_ok` | = note: the method `as_deref_mut_err` exists but the following trait bounds were not satisfied: `{integer} : std::ops::DerefMut` diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_ok.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_ok.stderr index 6d2b019541ad0..b8369c9b82e1a 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_ok.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_ok.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_mut_ok` found for type `std::result::Res --> $DIR/result-as_deref_mut_ok.rs:4:31 | LL | let _result = &mut Ok(42).as_deref_mut_ok(); - | ^^^^^^^^^^^^^^^ help: did you mean: `as_deref_mut_err` + | ^^^^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_mut_err` | = note: the method `as_deref_mut_ok` exists but the following trait bounds were not satisfied: `{integer} : std::ops::DerefMut` diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_ok.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_ok.stderr index 5800bd37f9f7f..b26705a99e3bc 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_ok.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_ok.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_ok` found for type `std::result::Result< --> $DIR/result-as_deref_ok.rs:4:27 | LL | let _result = &Ok(42).as_deref_ok(); - | ^^^^^^^^^^^ help: did you mean: `as_deref_err` + | ^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_err` | = note: the method `as_deref_ok` exists but the following trait bounds were not satisfied: `{integer} : std::ops::Deref`