Auto merge of #106256 - matthiaskrgr:rollup-g1ovcqq, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #106208 (Make trait/impl `where` clause mismatch on region error a bit more actionable) - #106216 (Powershell: Use `WaitForExit` instead of `-Wait`) - #106217 (rustdoc: remove unnecessary `.tooltip::after { text-align: center }`) - #106218 (Migrate css var scraped examples) - #106221 (Rename `Rptr` to `Ref` in AST and HIR) - #106223 (On unsized locals with explicit types suggest `&`) - #106225 (Remove CraftSpider from review rotation) - #106229 (update Miri) - #106242 (Detect diff markers in the parser) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
e37ff7e71a
129 changed files with 1174 additions and 412 deletions
|
@ -3295,9 +3295,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-build-sysroot"
|
name = "rustc-build-sysroot"
|
||||||
version = "0.4.0"
|
version = "0.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "20c4b4625eeb148cccf82d5e9b90ad7fab3b11a0204cf75cc7fa04981a0fdffd"
|
checksum = "d65b1271cdac365b71b59570ea35d945dea2dd2cc47eba3d33b4bd1e0190ac6d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
|
|
|
@ -572,7 +572,7 @@ impl Pat {
|
||||||
PatKind::MacCall(mac) => TyKind::MacCall(mac.clone()),
|
PatKind::MacCall(mac) => TyKind::MacCall(mac.clone()),
|
||||||
// `&mut? P` can be reinterpreted as `&mut? T` where `T` is `P` reparsed as a type.
|
// `&mut? P` can be reinterpreted as `&mut? T` where `T` is `P` reparsed as a type.
|
||||||
PatKind::Ref(pat, mutbl) => {
|
PatKind::Ref(pat, mutbl) => {
|
||||||
pat.to_ty().map(|ty| TyKind::Rptr(None, MutTy { ty, mutbl: *mutbl }))?
|
pat.to_ty().map(|ty| TyKind::Ref(None, MutTy { ty, mutbl: *mutbl }))?
|
||||||
}
|
}
|
||||||
// A slice/array pattern `[P]` can be reparsed as `[T]`, an unsized array,
|
// A slice/array pattern `[P]` can be reparsed as `[T]`, an unsized array,
|
||||||
// when `P` can be reparsed as a type `T`.
|
// when `P` can be reparsed as a type `T`.
|
||||||
|
@ -1193,7 +1193,7 @@ impl Expr {
|
||||||
ExprKind::Paren(expr) => expr.to_ty().map(TyKind::Paren)?,
|
ExprKind::Paren(expr) => expr.to_ty().map(TyKind::Paren)?,
|
||||||
|
|
||||||
ExprKind::AddrOf(BorrowKind::Ref, mutbl, expr) => {
|
ExprKind::AddrOf(BorrowKind::Ref, mutbl, expr) => {
|
||||||
expr.to_ty().map(|ty| TyKind::Rptr(None, MutTy { ty, mutbl: *mutbl }))?
|
expr.to_ty().map(|ty| TyKind::Ref(None, MutTy { ty, mutbl: *mutbl }))?
|
||||||
}
|
}
|
||||||
|
|
||||||
ExprKind::Repeat(expr, expr_len) => {
|
ExprKind::Repeat(expr, expr_len) => {
|
||||||
|
@ -2031,7 +2031,7 @@ impl Clone for Ty {
|
||||||
impl Ty {
|
impl Ty {
|
||||||
pub fn peel_refs(&self) -> &Self {
|
pub fn peel_refs(&self) -> &Self {
|
||||||
let mut final_ty = self;
|
let mut final_ty = self;
|
||||||
while let TyKind::Rptr(_, MutTy { ty, .. }) = &final_ty.kind {
|
while let TyKind::Ref(_, MutTy { ty, .. }) = &final_ty.kind {
|
||||||
final_ty = ty;
|
final_ty = ty;
|
||||||
}
|
}
|
||||||
final_ty
|
final_ty
|
||||||
|
@ -2058,7 +2058,7 @@ pub enum TyKind {
|
||||||
/// A raw pointer (`*const T` or `*mut T`).
|
/// A raw pointer (`*const T` or `*mut T`).
|
||||||
Ptr(MutTy),
|
Ptr(MutTy),
|
||||||
/// A reference (`&'a T` or `&'a mut T`).
|
/// A reference (`&'a T` or `&'a mut T`).
|
||||||
Rptr(Option<Lifetime>, MutTy),
|
Ref(Option<Lifetime>, MutTy),
|
||||||
/// A bare function (e.g., `fn(usize) -> bool`).
|
/// A bare function (e.g., `fn(usize) -> bool`).
|
||||||
BareFn(P<BareFnTy>),
|
BareFn(P<BareFnTy>),
|
||||||
/// The never type (`!`).
|
/// The never type (`!`).
|
||||||
|
@ -2286,7 +2286,7 @@ impl Param {
|
||||||
if ident.name == kw::SelfLower {
|
if ident.name == kw::SelfLower {
|
||||||
return match self.ty.kind {
|
return match self.ty.kind {
|
||||||
TyKind::ImplicitSelf => Some(respan(self.pat.span, SelfKind::Value(mutbl))),
|
TyKind::ImplicitSelf => Some(respan(self.pat.span, SelfKind::Value(mutbl))),
|
||||||
TyKind::Rptr(lt, MutTy { ref ty, mutbl }) if ty.kind.is_implicit_self() => {
|
TyKind::Ref(lt, MutTy { ref ty, mutbl }) if ty.kind.is_implicit_self() => {
|
||||||
Some(respan(self.pat.span, SelfKind::Region(lt, mutbl)))
|
Some(respan(self.pat.span, SelfKind::Region(lt, mutbl)))
|
||||||
}
|
}
|
||||||
_ => Some(respan(
|
_ => Some(respan(
|
||||||
|
@ -2319,7 +2319,7 @@ impl Param {
|
||||||
Mutability::Not,
|
Mutability::Not,
|
||||||
P(Ty {
|
P(Ty {
|
||||||
id: DUMMY_NODE_ID,
|
id: DUMMY_NODE_ID,
|
||||||
kind: TyKind::Rptr(lt, MutTy { ty: infer_ty, mutbl }),
|
kind: TyKind::Ref(lt, MutTy { ty: infer_ty, mutbl }),
|
||||||
span,
|
span,
|
||||||
tokens: None,
|
tokens: None,
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -459,7 +459,7 @@ pub fn noop_visit_ty<T: MutVisitor>(ty: &mut P<Ty>, vis: &mut T) {
|
||||||
TyKind::Infer | TyKind::ImplicitSelf | TyKind::Err | TyKind::Never | TyKind::CVarArgs => {}
|
TyKind::Infer | TyKind::ImplicitSelf | TyKind::Err | TyKind::Never | TyKind::CVarArgs => {}
|
||||||
TyKind::Slice(ty) => vis.visit_ty(ty),
|
TyKind::Slice(ty) => vis.visit_ty(ty),
|
||||||
TyKind::Ptr(mt) => vis.visit_mt(mt),
|
TyKind::Ptr(mt) => vis.visit_mt(mt),
|
||||||
TyKind::Rptr(lt, mt) => {
|
TyKind::Ref(lt, mt) => {
|
||||||
visit_opt(lt, |lt| noop_visit_lifetime(lt, vis));
|
visit_opt(lt, |lt| noop_visit_lifetime(lt, vis));
|
||||||
vis.visit_mt(mt);
|
vis.visit_mt(mt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ impl<'a> FnKind<'a> {
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub enum LifetimeCtxt {
|
pub enum LifetimeCtxt {
|
||||||
/// Appears in a reference type.
|
/// Appears in a reference type.
|
||||||
Rptr,
|
Ref,
|
||||||
/// Appears as a bound on a type or another lifetime.
|
/// Appears as a bound on a type or another lifetime.
|
||||||
Bound,
|
Bound,
|
||||||
/// Appears as a generic argument.
|
/// Appears as a generic argument.
|
||||||
|
@ -396,8 +396,8 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) {
|
||||||
match &typ.kind {
|
match &typ.kind {
|
||||||
TyKind::Slice(ty) | TyKind::Paren(ty) => visitor.visit_ty(ty),
|
TyKind::Slice(ty) | TyKind::Paren(ty) => visitor.visit_ty(ty),
|
||||||
TyKind::Ptr(mutable_type) => visitor.visit_ty(&mutable_type.ty),
|
TyKind::Ptr(mutable_type) => visitor.visit_ty(&mutable_type.ty),
|
||||||
TyKind::Rptr(opt_lifetime, mutable_type) => {
|
TyKind::Ref(opt_lifetime, mutable_type) => {
|
||||||
walk_list!(visitor, visit_lifetime, opt_lifetime, LifetimeCtxt::Rptr);
|
walk_list!(visitor, visit_lifetime, opt_lifetime, LifetimeCtxt::Ref);
|
||||||
visitor.visit_ty(&mutable_type.ty)
|
visitor.visit_ty(&mutable_type.ty)
|
||||||
}
|
}
|
||||||
TyKind::Tup(tuple_element_types) => {
|
TyKind::Tup(tuple_element_types) => {
|
||||||
|
|
|
@ -1238,7 +1238,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||||
TyKind::Err => hir::TyKind::Err,
|
TyKind::Err => hir::TyKind::Err,
|
||||||
TyKind::Slice(ty) => hir::TyKind::Slice(self.lower_ty(ty, itctx)),
|
TyKind::Slice(ty) => hir::TyKind::Slice(self.lower_ty(ty, itctx)),
|
||||||
TyKind::Ptr(mt) => hir::TyKind::Ptr(self.lower_mt(mt, itctx)),
|
TyKind::Ptr(mt) => hir::TyKind::Ptr(self.lower_mt(mt, itctx)),
|
||||||
TyKind::Rptr(region, mt) => {
|
TyKind::Ref(region, mt) => {
|
||||||
let region = region.unwrap_or_else(|| {
|
let region = region.unwrap_or_else(|| {
|
||||||
let id = if let Some(LifetimeRes::ElidedAnchor { start, end }) =
|
let id = if let Some(LifetimeRes::ElidedAnchor { start, end }) =
|
||||||
self.resolver.get_lifetime_res(t.id)
|
self.resolver.get_lifetime_res(t.id)
|
||||||
|
@ -1252,7 +1252,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||||
Lifetime { ident: Ident::new(kw::UnderscoreLifetime, span), id }
|
Lifetime { ident: Ident::new(kw::UnderscoreLifetime, span), id }
|
||||||
});
|
});
|
||||||
let lifetime = self.lower_lifetime(®ion);
|
let lifetime = self.lower_lifetime(®ion);
|
||||||
hir::TyKind::Rptr(lifetime, self.lower_mt(mt, itctx))
|
hir::TyKind::Ref(lifetime, self.lower_mt(mt, itctx))
|
||||||
}
|
}
|
||||||
TyKind::BareFn(f) => {
|
TyKind::BareFn(f) => {
|
||||||
let generic_params = self.lower_lifetime_binder(t.id, &f.generic_params);
|
let generic_params = self.lower_lifetime_binder(t.id, &f.generic_params);
|
||||||
|
@ -1771,7 +1771,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||||
// Given we are only considering `ImplicitSelf` types, we needn't consider
|
// Given we are only considering `ImplicitSelf` types, we needn't consider
|
||||||
// the case where we have a mutable pattern to a reference as that would
|
// the case where we have a mutable pattern to a reference as that would
|
||||||
// no longer be an `ImplicitSelf`.
|
// no longer be an `ImplicitSelf`.
|
||||||
TyKind::Rptr(_, mt) if mt.ty.kind.is_implicit_self() => match mt.mutbl {
|
TyKind::Ref(_, mt) if mt.ty.kind.is_implicit_self() => match mt.mutbl {
|
||||||
hir::Mutability::Not => hir::ImplicitSelfKind::ImmRef,
|
hir::Mutability::Not => hir::ImplicitSelfKind::ImmRef,
|
||||||
hir::Mutability::Mut => hir::ImplicitSelfKind::MutRef,
|
hir::Mutability::Mut => hir::ImplicitSelfKind::MutRef,
|
||||||
},
|
},
|
||||||
|
|
|
@ -83,7 +83,7 @@ impl<'ast> Visitor<'ast> for LifetimeCollectVisitor<'ast> {
|
||||||
visit::walk_ty(self, t);
|
visit::walk_ty(self, t);
|
||||||
self.current_binders.pop();
|
self.current_binders.pop();
|
||||||
}
|
}
|
||||||
TyKind::Rptr(None, _) => {
|
TyKind::Ref(None, _) => {
|
||||||
self.record_elided_anchor(t.id, t.span);
|
self.record_elided_anchor(t.id, t.span);
|
||||||
visit::walk_ty(self, t);
|
visit::walk_ty(self, t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1025,7 +1025,7 @@ impl<'a> State<'a> {
|
||||||
self.word("*");
|
self.word("*");
|
||||||
self.print_mt(mt, true);
|
self.print_mt(mt, true);
|
||||||
}
|
}
|
||||||
ast::TyKind::Rptr(lifetime, mt) => {
|
ast::TyKind::Ref(lifetime, mt) => {
|
||||||
self.word("&");
|
self.word("&");
|
||||||
self.print_opt_lifetime(lifetime);
|
self.print_opt_lifetime(lifetime);
|
||||||
self.print_mt(mt, false);
|
self.print_mt(mt, false);
|
||||||
|
|
|
@ -2681,7 +2681,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
// Need to use the `rustc_middle::ty` types to compare against the
|
// Need to use the `rustc_middle::ty` types to compare against the
|
||||||
// `return_region`. Then use the `rustc_hir` type to get only
|
// `return_region`. Then use the `rustc_hir` type to get only
|
||||||
// the lifetime span.
|
// the lifetime span.
|
||||||
if let hir::TyKind::Rptr(lifetime, _) = &fn_decl.inputs[index].kind {
|
if let hir::TyKind::Ref(lifetime, _) = &fn_decl.inputs[index].kind {
|
||||||
// With access to the lifetime, we can get
|
// With access to the lifetime, we can get
|
||||||
// the span of it.
|
// the span of it.
|
||||||
arguments.push((*argument, lifetime.ident.span));
|
arguments.push((*argument, lifetime.ident.span));
|
||||||
|
@ -2702,7 +2702,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
let return_ty = sig.output().skip_binder();
|
let return_ty = sig.output().skip_binder();
|
||||||
let mut return_span = fn_decl.output.span();
|
let mut return_span = fn_decl.output.span();
|
||||||
if let hir::FnRetTy::Return(ty) = &fn_decl.output {
|
if let hir::FnRetTy::Return(ty) = &fn_decl.output {
|
||||||
if let hir::TyKind::Rptr(lifetime, _) = ty.kind {
|
if let hir::TyKind::Ref(lifetime, _) = ty.kind {
|
||||||
return_span = lifetime.ident.span;
|
return_span = lifetime.ident.span;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1209,7 +1209,7 @@ fn get_mut_span_in_struct_field<'tcx>(
|
||||||
// Now we're dealing with the actual struct that we're going to suggest a change to,
|
// Now we're dealing with the actual struct that we're going to suggest a change to,
|
||||||
// we can expect a field that is an immutable reference to a type.
|
// we can expect a field that is an immutable reference to a type.
|
||||||
&& let hir::Node::Field(field) = node
|
&& let hir::Node::Field(field) = node
|
||||||
&& let hir::TyKind::Rptr(lt, hir::MutTy { mutbl: hir::Mutability::Not, ty }) = field.ty.kind
|
&& let hir::TyKind::Ref(lt, hir::MutTy { mutbl: hir::Mutability::Not, ty }) = field.ty.kind
|
||||||
{
|
{
|
||||||
return Some(lt.ident.span.between(ty.span));
|
return Some(lt.ident.span.between(ty.span));
|
||||||
}
|
}
|
||||||
|
|
|
@ -493,10 +493,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
|
||||||
//
|
//
|
||||||
// &
|
// &
|
||||||
// - let's call the lifetime of this reference `'1`
|
// - let's call the lifetime of this reference `'1`
|
||||||
(
|
(ty::Ref(region, referent_ty, _), hir::TyKind::Ref(_lifetime, referent_hir_ty)) => {
|
||||||
ty::Ref(region, referent_ty, _),
|
|
||||||
hir::TyKind::Rptr(_lifetime, referent_hir_ty),
|
|
||||||
) => {
|
|
||||||
if region.to_region_vid() == needle_fr {
|
if region.to_region_vid() == needle_fr {
|
||||||
// Just grab the first character, the `&`.
|
// Just grab the first character, the `&`.
|
||||||
let source_map = self.infcx.tcx.sess.source_map();
|
let source_map = self.infcx.tcx.sess.source_map();
|
||||||
|
|
|
@ -117,8 +117,7 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
|
||||||
// `let names: &'static _ = &["field1", "field2"];`
|
// `let names: &'static _ = &["field1", "field2"];`
|
||||||
let names_let = if is_struct {
|
let names_let = if is_struct {
|
||||||
let lt_static = Some(cx.lifetime_static(span));
|
let lt_static = Some(cx.lifetime_static(span));
|
||||||
let ty_static_ref =
|
let ty_static_ref = cx.ty_ref(span, cx.ty_infer(span), lt_static, ast::Mutability::Not);
|
||||||
cx.ty_rptr(span, cx.ty_infer(span), lt_static, ast::Mutability::Not);
|
|
||||||
Some(cx.stmt_let_ty(
|
Some(cx.stmt_let_ty(
|
||||||
span,
|
span,
|
||||||
false,
|
false,
|
||||||
|
@ -138,13 +137,13 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
|
||||||
);
|
);
|
||||||
let ty_slice = cx.ty(
|
let ty_slice = cx.ty(
|
||||||
span,
|
span,
|
||||||
ast::TyKind::Slice(cx.ty_rptr(span, ty_dyn_debug, None, ast::Mutability::Not)),
|
ast::TyKind::Slice(cx.ty_ref(span, ty_dyn_debug, None, ast::Mutability::Not)),
|
||||||
);
|
);
|
||||||
let values_let = cx.stmt_let_ty(
|
let values_let = cx.stmt_let_ty(
|
||||||
span,
|
span,
|
||||||
false,
|
false,
|
||||||
Ident::new(sym::values, span),
|
Ident::new(sym::values, span),
|
||||||
Some(cx.ty_rptr(span, ty_slice, None, ast::Mutability::Not)),
|
Some(cx.ty_ref(span, ty_slice, None, ast::Mutability::Not)),
|
||||||
cx.expr_array_ref(span, value_exprs),
|
cx.expr_array_ref(span, value_exprs),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ impl Ty {
|
||||||
match self {
|
match self {
|
||||||
Ref(ty, mutbl) => {
|
Ref(ty, mutbl) => {
|
||||||
let raw_ty = ty.to_ty(cx, span, self_ty, self_generics);
|
let raw_ty = ty.to_ty(cx, span, self_ty, self_generics);
|
||||||
cx.ty_rptr(span, raw_ty, None, *mutbl)
|
cx.ty_ref(span, raw_ty, None, *mutbl)
|
||||||
}
|
}
|
||||||
Path(p) => p.to_ty(cx, span, self_ty, self_generics),
|
Path(p) => p.to_ty(cx, span, self_ty, self_generics),
|
||||||
Self_ => cx.ty_path(self.to_path(cx, span, self_ty, self_generics)),
|
Self_ => cx.ty_path(self.to_path(cx, span, self_ty, self_generics)),
|
||||||
|
|
|
@ -30,7 +30,7 @@ pub fn expand_option_env<'cx>(
|
||||||
sp,
|
sp,
|
||||||
true,
|
true,
|
||||||
cx.std_path(&[sym::option, sym::Option, sym::None]),
|
cx.std_path(&[sym::option, sym::Option, sym::None]),
|
||||||
vec![GenericArg::Type(cx.ty_rptr(
|
vec![GenericArg::Type(cx.ty_ref(
|
||||||
sp,
|
sp,
|
||||||
cx.ty_ident(sp, Ident::new(sym::str, sp)),
|
cx.ty_ident(sp, Ident::new(sym::str, sp)),
|
||||||
Some(lt),
|
Some(lt),
|
||||||
|
|
|
@ -349,7 +349,7 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
|
||||||
.item_static(
|
.item_static(
|
||||||
span,
|
span,
|
||||||
Ident::new(sym::_DECLS, span),
|
Ident::new(sym::_DECLS, span),
|
||||||
cx.ty_rptr(
|
cx.ty_ref(
|
||||||
span,
|
span,
|
||||||
cx.ty(
|
cx.ty(
|
||||||
span,
|
span,
|
||||||
|
|
|
@ -87,14 +87,14 @@ impl<'a> ExtCtxt<'a> {
|
||||||
self.anon_const(span, ast::ExprKind::Path(None, self.path_ident(span, ident)))
|
self.anon_const(span, ast::ExprKind::Path(None, self.path_ident(span, ident)))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ty_rptr(
|
pub fn ty_ref(
|
||||||
&self,
|
&self,
|
||||||
span: Span,
|
span: Span,
|
||||||
ty: P<ast::Ty>,
|
ty: P<ast::Ty>,
|
||||||
lifetime: Option<ast::Lifetime>,
|
lifetime: Option<ast::Lifetime>,
|
||||||
mutbl: ast::Mutability,
|
mutbl: ast::Mutability,
|
||||||
) -> P<ast::Ty> {
|
) -> P<ast::Ty> {
|
||||||
self.ty(span, ast::TyKind::Rptr(lifetime, self.ty_mt(ty, mutbl)))
|
self.ty(span, ast::TyKind::Ref(lifetime, self.ty_mt(ty, mutbl)))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ty_ptr(&self, span: Span, ty: P<ast::Ty>, mutbl: ast::Mutability) -> P<ast::Ty> {
|
pub fn ty_ptr(&self, span: Span, ty: P<ast::Ty>, mutbl: ast::Mutability) -> P<ast::Ty> {
|
||||||
|
|
|
@ -2431,7 +2431,7 @@ impl<'hir> Ty<'hir> {
|
||||||
|
|
||||||
pub fn peel_refs(&self) -> &Self {
|
pub fn peel_refs(&self) -> &Self {
|
||||||
let mut final_ty = self;
|
let mut final_ty = self;
|
||||||
while let TyKind::Rptr(_, MutTy { ty, .. }) = &final_ty.kind {
|
while let TyKind::Ref(_, MutTy { ty, .. }) = &final_ty.kind {
|
||||||
final_ty = ty;
|
final_ty = ty;
|
||||||
}
|
}
|
||||||
final_ty
|
final_ty
|
||||||
|
@ -2588,7 +2588,7 @@ pub enum TyKind<'hir> {
|
||||||
/// A raw pointer (i.e., `*const T` or `*mut T`).
|
/// A raw pointer (i.e., `*const T` or `*mut T`).
|
||||||
Ptr(MutTy<'hir>),
|
Ptr(MutTy<'hir>),
|
||||||
/// A reference (i.e., `&'a T` or `&'a mut T`).
|
/// A reference (i.e., `&'a T` or `&'a mut T`).
|
||||||
Rptr(&'hir Lifetime, MutTy<'hir>),
|
Ref(&'hir Lifetime, MutTy<'hir>),
|
||||||
/// A bare function (e.g., `fn(usize) -> bool`).
|
/// A bare function (e.g., `fn(usize) -> bool`).
|
||||||
BareFn(&'hir BareFnTy<'hir>),
|
BareFn(&'hir BareFnTy<'hir>),
|
||||||
/// The never type (`!`).
|
/// The never type (`!`).
|
||||||
|
|
|
@ -809,7 +809,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) {
|
||||||
match typ.kind {
|
match typ.kind {
|
||||||
TyKind::Slice(ref ty) => visitor.visit_ty(ty),
|
TyKind::Slice(ref ty) => visitor.visit_ty(ty),
|
||||||
TyKind::Ptr(ref mutable_type) => visitor.visit_ty(mutable_type.ty),
|
TyKind::Ptr(ref mutable_type) => visitor.visit_ty(mutable_type.ty),
|
||||||
TyKind::Rptr(ref lifetime, ref mutable_type) => {
|
TyKind::Ref(ref lifetime, ref mutable_type) => {
|
||||||
visitor.visit_lifetime(lifetime);
|
visitor.visit_lifetime(lifetime);
|
||||||
visitor.visit_ty(mutable_type.ty)
|
visitor.visit_ty(mutable_type.ty)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2657,7 +2657,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
hir::TyKind::Ptr(ref mt) => {
|
hir::TyKind::Ptr(ref mt) => {
|
||||||
tcx.mk_ptr(ty::TypeAndMut { ty: self.ast_ty_to_ty(mt.ty), mutbl: mt.mutbl })
|
tcx.mk_ptr(ty::TypeAndMut { ty: self.ast_ty_to_ty(mt.ty), mutbl: mt.mutbl })
|
||||||
}
|
}
|
||||||
hir::TyKind::Rptr(ref region, ref mt) => {
|
hir::TyKind::Ref(ref region, ref mt) => {
|
||||||
let r = self.ast_region_to_region(region, None);
|
let r = self.ast_region_to_region(region, None);
|
||||||
debug!(?r);
|
debug!(?r);
|
||||||
let t = self.ast_ty_to_ty_inner(mt.ty, true, false);
|
let t = self.ast_ty_to_ty_inner(mt.ty, true, false);
|
||||||
|
|
|
@ -291,7 +291,7 @@ fn check_trait_item(tcx: TyCtxt<'_>, trait_item: &hir::TraitItem<'_>) {
|
||||||
// Do some rudimentary sanity checking to avoid an ICE later (issue #83471).
|
// Do some rudimentary sanity checking to avoid an ICE later (issue #83471).
|
||||||
if let Some(hir::FnSig { decl, span, .. }) = method_sig {
|
if let Some(hir::FnSig { decl, span, .. }) = method_sig {
|
||||||
if let [self_ty, _] = decl.inputs {
|
if let [self_ty, _] = decl.inputs {
|
||||||
if !matches!(self_ty.kind, hir::TyKind::Rptr(_, _)) {
|
if !matches!(self_ty.kind, hir::TyKind::Ref(_, _)) {
|
||||||
tcx.sess
|
tcx.sess
|
||||||
.struct_span_err(
|
.struct_span_err(
|
||||||
self_ty.span,
|
self_ty.span,
|
||||||
|
|
|
@ -1063,7 +1063,7 @@ fn is_suggestable_infer_ty(ty: &hir::Ty<'_>) -> bool {
|
||||||
is_suggestable_infer_ty(ty) || matches!(length, hir::ArrayLen::Infer(_, _))
|
is_suggestable_infer_ty(ty) || matches!(length, hir::ArrayLen::Infer(_, _))
|
||||||
}
|
}
|
||||||
Tup(tys) => tys.iter().any(is_suggestable_infer_ty),
|
Tup(tys) => tys.iter().any(is_suggestable_infer_ty),
|
||||||
Ptr(mut_ty) | Rptr(_, mut_ty) => is_suggestable_infer_ty(mut_ty.ty),
|
Ptr(mut_ty) | Ref(_, mut_ty) => is_suggestable_infer_ty(mut_ty.ty),
|
||||||
OpaqueDef(_, generic_args, _) => are_suggestable_generic_args(generic_args),
|
OpaqueDef(_, generic_args, _) => are_suggestable_generic_args(generic_args),
|
||||||
Path(hir::QPath::TypeRelative(ty, segment)) => {
|
Path(hir::QPath::TypeRelative(ty, segment)) => {
|
||||||
is_suggestable_infer_ty(ty) || are_suggestable_generic_args(segment.args().args)
|
is_suggestable_infer_ty(ty) || are_suggestable_generic_args(segment.args().args)
|
||||||
|
|
|
@ -617,7 +617,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||||
LifetimeName::Error => {}
|
LifetimeName::Error => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hir::TyKind::Rptr(ref lifetime_ref, ref mt) => {
|
hir::TyKind::Ref(ref lifetime_ref, ref mt) => {
|
||||||
self.visit_lifetime(lifetime_ref);
|
self.visit_lifetime(lifetime_ref);
|
||||||
let scope = Scope::ObjectLifetimeDefault {
|
let scope = Scope::ObjectLifetimeDefault {
|
||||||
lifetime: self.map.defs.get(&lifetime_ref.hir_id).cloned(),
|
lifetime: self.map.defs.get(&lifetime_ref.hir_id).cloned(),
|
||||||
|
|
|
@ -307,7 +307,7 @@ impl<'a> State<'a> {
|
||||||
self.word("*");
|
self.word("*");
|
||||||
self.print_mt(mt, true);
|
self.print_mt(mt, true);
|
||||||
}
|
}
|
||||||
hir::TyKind::Rptr(ref lifetime, ref mt) => {
|
hir::TyKind::Ref(ref lifetime, ref mt) => {
|
||||||
self.word("&");
|
self.word("&");
|
||||||
self.print_opt_lifetime(lifetime);
|
self.print_opt_lifetime(lifetime);
|
||||||
self.print_mt(mt, false);
|
self.print_mt(mt, false);
|
||||||
|
|
|
@ -1921,7 +1921,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
) -> Ty<'tcx> {
|
) -> Ty<'tcx> {
|
||||||
let tcx = self.tcx;
|
let tcx = self.tcx;
|
||||||
let expected = self.shallow_resolve(expected);
|
let expected = self.shallow_resolve(expected);
|
||||||
let (rptr_ty, inner_ty) = if self.check_dereferenceable(pat.span, expected, inner) {
|
let (ref_ty, inner_ty) = if self.check_dereferenceable(pat.span, expected, inner) {
|
||||||
// `demand::subtype` would be good enough, but using `eqtype` turns
|
// `demand::subtype` would be good enough, but using `eqtype` turns
|
||||||
// out to be equally general. See (note_1) for details.
|
// out to be equally general. See (note_1) for details.
|
||||||
|
|
||||||
|
@ -1936,9 +1936,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
kind: TypeVariableOriginKind::TypeInference,
|
kind: TypeVariableOriginKind::TypeInference,
|
||||||
span: inner.span,
|
span: inner.span,
|
||||||
});
|
});
|
||||||
let rptr_ty = self.new_ref_ty(pat.span, mutbl, inner_ty);
|
let ref_ty = self.new_ref_ty(pat.span, mutbl, inner_ty);
|
||||||
debug!("check_pat_ref: demanding {:?} = {:?}", expected, rptr_ty);
|
debug!("check_pat_ref: demanding {:?} = {:?}", expected, ref_ty);
|
||||||
let err = self.demand_eqtype_pat_diag(pat.span, expected, rptr_ty, ti);
|
let err = self.demand_eqtype_pat_diag(pat.span, expected, ref_ty, ti);
|
||||||
|
|
||||||
// Look for a case like `fn foo(&foo: u32)` and suggest
|
// Look for a case like `fn foo(&foo: u32)` and suggest
|
||||||
// `fn foo(foo: &u32)`
|
// `fn foo(foo: &u32)`
|
||||||
|
@ -1946,7 +1946,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
self.borrow_pat_suggestion(&mut err, pat);
|
self.borrow_pat_suggestion(&mut err, pat);
|
||||||
err.emit();
|
err.emit();
|
||||||
}
|
}
|
||||||
(rptr_ty, inner_ty)
|
(ref_ty, inner_ty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1954,7 +1954,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
(err, err)
|
(err, err)
|
||||||
};
|
};
|
||||||
self.check_pat(inner, inner_ty, def_bm, ti);
|
self.check_pat(inner, inner_ty, def_bm, ti);
|
||||||
rptr_ty
|
ref_ty
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a reference type with a fresh region variable.
|
/// Create a reference type with a fresh region variable.
|
||||||
|
|
|
@ -369,8 +369,8 @@ impl AddToDiagnostic for AddLifetimeParamsSuggestion<'_> {
|
||||||
{
|
{
|
||||||
let mut mk_suggestion = || {
|
let mut mk_suggestion = || {
|
||||||
let (
|
let (
|
||||||
hir::Ty { kind: hir::TyKind::Rptr(lifetime_sub, _), .. },
|
hir::Ty { kind: hir::TyKind::Ref(lifetime_sub, _), .. },
|
||||||
hir::Ty { kind: hir::TyKind::Rptr(lifetime_sup, _), .. },
|
hir::Ty { kind: hir::TyKind::Ref(lifetime_sup, _), .. },
|
||||||
) = (self.ty_sub, self.ty_sup) else {
|
) = (self.ty_sub, self.ty_sup) else {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
|
@ -96,8 +96,8 @@ impl<'tcx> Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hir::TyKind::Rptr(ref lifetime, _) => {
|
hir::TyKind::Ref(ref lifetime, _) => {
|
||||||
// the lifetime of the TyRptr
|
// the lifetime of the Ref
|
||||||
let hir_id = lifetime.hir_id;
|
let hir_id = lifetime.hir_id;
|
||||||
match (self.tcx.named_region(hir_id), self.bound_region) {
|
match (self.tcx.named_region(hir_id), self.bound_region) {
|
||||||
// Find the index of the named region that was part of the
|
// Find the index of the named region that was part of the
|
||||||
|
|
|
@ -147,7 +147,7 @@ impl<'tcx> Visitor<'tcx> for TypeParamSpanVisitor<'tcx> {
|
||||||
|
|
||||||
fn visit_ty(&mut self, arg: &'tcx hir::Ty<'tcx>) {
|
fn visit_ty(&mut self, arg: &'tcx hir::Ty<'tcx>) {
|
||||||
match arg.kind {
|
match arg.kind {
|
||||||
hir::TyKind::Rptr(_, ref mut_ty) => {
|
hir::TyKind::Ref(_, ref mut_ty) => {
|
||||||
// We don't want to suggest looking into borrowing `&T` or `&Self`.
|
// We don't want to suggest looking into borrowing `&T` or `&Self`.
|
||||||
hir::intravisit::walk_ty(self, mut_ty.ty);
|
hir::intravisit::walk_ty(self, mut_ty.ty);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2,11 +2,14 @@ use crate::errors::RegionOriginNote;
|
||||||
use crate::infer::error_reporting::{note_and_explain_region, TypeErrCtxt};
|
use crate::infer::error_reporting::{note_and_explain_region, TypeErrCtxt};
|
||||||
use crate::infer::{self, SubregionOrigin};
|
use crate::infer::{self, SubregionOrigin};
|
||||||
use rustc_errors::{
|
use rustc_errors::{
|
||||||
fluent, struct_span_err, AddToDiagnostic, Diagnostic, DiagnosticBuilder, ErrorGuaranteed,
|
fluent, struct_span_err, AddToDiagnostic, Applicability, Diagnostic, DiagnosticBuilder,
|
||||||
|
ErrorGuaranteed,
|
||||||
};
|
};
|
||||||
|
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||||
use rustc_middle::traits::ObligationCauseCode;
|
use rustc_middle::traits::ObligationCauseCode;
|
||||||
use rustc_middle::ty::error::TypeError;
|
use rustc_middle::ty::error::TypeError;
|
||||||
use rustc_middle::ty::{self, Region};
|
use rustc_middle::ty::{self, IsSuggestable, Region};
|
||||||
|
use rustc_span::symbol::kw;
|
||||||
|
|
||||||
use super::ObligationCauseAsDiagArg;
|
use super::ObligationCauseAsDiagArg;
|
||||||
|
|
||||||
|
@ -313,55 +316,38 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||||
);
|
);
|
||||||
err
|
err
|
||||||
}
|
}
|
||||||
infer::CompareImplItemObligation { span, impl_item_def_id, trait_item_def_id } => self
|
infer::CompareImplItemObligation { span, impl_item_def_id, trait_item_def_id } => {
|
||||||
.report_extra_impl_obligation(
|
let mut err = self.report_extra_impl_obligation(
|
||||||
span,
|
span,
|
||||||
impl_item_def_id,
|
impl_item_def_id,
|
||||||
trait_item_def_id,
|
trait_item_def_id,
|
||||||
&format!("`{}: {}`", sup, sub),
|
&format!("`{}: {}`", sup, sub),
|
||||||
),
|
);
|
||||||
|
// We should only suggest rewriting the `where` clause if the predicate is within that `where` clause
|
||||||
|
if let Some(generics) = self.tcx.hir().get_generics(impl_item_def_id)
|
||||||
|
&& generics.where_clause_span.contains(span)
|
||||||
|
{
|
||||||
|
self.suggest_copy_trait_method_bounds(
|
||||||
|
trait_item_def_id,
|
||||||
|
impl_item_def_id,
|
||||||
|
&mut err,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
err
|
||||||
|
}
|
||||||
infer::CheckAssociatedTypeBounds { impl_item_def_id, trait_item_def_id, parent } => {
|
infer::CheckAssociatedTypeBounds { impl_item_def_id, trait_item_def_id, parent } => {
|
||||||
let mut err = self.report_concrete_failure(*parent, sub, sup);
|
let mut err = self.report_concrete_failure(*parent, sub, sup);
|
||||||
|
|
||||||
let trait_item_span = self.tcx.def_span(trait_item_def_id);
|
let trait_item_span = self.tcx.def_span(trait_item_def_id);
|
||||||
let item_name = self.tcx.item_name(impl_item_def_id.to_def_id());
|
let item_name = self.tcx.item_name(impl_item_def_id.to_def_id());
|
||||||
err.span_label(
|
err.span_label(
|
||||||
trait_item_span,
|
trait_item_span,
|
||||||
format!("definition of `{}` from trait", item_name),
|
format!("definition of `{}` from trait", item_name),
|
||||||
);
|
);
|
||||||
|
self.suggest_copy_trait_method_bounds(
|
||||||
let trait_predicates = self.tcx.explicit_predicates_of(trait_item_def_id);
|
trait_item_def_id,
|
||||||
let impl_predicates = self.tcx.explicit_predicates_of(impl_item_def_id);
|
impl_item_def_id,
|
||||||
|
&mut err,
|
||||||
let impl_predicates: rustc_data_structures::fx::FxHashSet<_> =
|
);
|
||||||
impl_predicates.predicates.into_iter().map(|(pred, _)| pred).collect();
|
|
||||||
let clauses: Vec<_> = trait_predicates
|
|
||||||
.predicates
|
|
||||||
.into_iter()
|
|
||||||
.filter(|&(pred, _)| !impl_predicates.contains(pred))
|
|
||||||
.map(|(pred, _)| format!("{}", pred))
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
if !clauses.is_empty() {
|
|
||||||
let generics = self.tcx.hir().get_generics(impl_item_def_id).unwrap();
|
|
||||||
let where_clause_span = generics.tail_span_for_predicate_suggestion();
|
|
||||||
|
|
||||||
let suggestion = format!(
|
|
||||||
"{} {}",
|
|
||||||
generics.add_where_or_trailing_comma(),
|
|
||||||
clauses.join(", "),
|
|
||||||
);
|
|
||||||
err.span_suggestion(
|
|
||||||
where_clause_span,
|
|
||||||
&format!(
|
|
||||||
"try copying {} from the trait",
|
|
||||||
if clauses.len() > 1 { "these clauses" } else { "this clause" }
|
|
||||||
),
|
|
||||||
suggestion,
|
|
||||||
rustc_errors::Applicability::MaybeIncorrect,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
err
|
err
|
||||||
}
|
}
|
||||||
infer::AscribeUserTypeProvePredicate(span) => {
|
infer::AscribeUserTypeProvePredicate(span) => {
|
||||||
|
@ -388,6 +374,65 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn suggest_copy_trait_method_bounds(
|
||||||
|
&self,
|
||||||
|
trait_item_def_id: DefId,
|
||||||
|
impl_item_def_id: LocalDefId,
|
||||||
|
err: &mut Diagnostic,
|
||||||
|
) {
|
||||||
|
// FIXME(compiler-errors): Right now this is only being used for region
|
||||||
|
// predicate mismatches. Ideally, we'd use it for *all* predicate mismatches,
|
||||||
|
// but right now it's not really very smart when it comes to implicit `Sized`
|
||||||
|
// predicates and bounds on the trait itself.
|
||||||
|
|
||||||
|
let Some(impl_def_id) =
|
||||||
|
self.tcx.associated_item(impl_item_def_id).impl_container(self.tcx) else { return; };
|
||||||
|
let Some(trait_ref) = self
|
||||||
|
.tcx
|
||||||
|
.impl_trait_ref(impl_def_id)
|
||||||
|
else { return; };
|
||||||
|
let trait_substs = trait_ref
|
||||||
|
// Replace the explicit self type with `Self` for better suggestion rendering
|
||||||
|
.with_self_ty(self.tcx, self.tcx.mk_ty_param(0, kw::SelfUpper))
|
||||||
|
.substs;
|
||||||
|
let trait_item_substs =
|
||||||
|
ty::InternalSubsts::identity_for_item(self.tcx, impl_item_def_id.to_def_id())
|
||||||
|
.rebase_onto(self.tcx, impl_def_id, trait_substs);
|
||||||
|
|
||||||
|
let Ok(trait_predicates) = self
|
||||||
|
.tcx
|
||||||
|
.bound_explicit_predicates_of(trait_item_def_id)
|
||||||
|
.map_bound(|p| p.predicates)
|
||||||
|
.subst_iter_copied(self.tcx, trait_item_substs)
|
||||||
|
.map(|(pred, _)| {
|
||||||
|
if pred.is_suggestable(self.tcx, false) {
|
||||||
|
Ok(pred.to_string())
|
||||||
|
} else {
|
||||||
|
Err(())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect::<Result<Vec<_>, ()>>() else { return; };
|
||||||
|
|
||||||
|
let Some(generics) = self.tcx.hir().get_generics(impl_item_def_id) else { return; };
|
||||||
|
|
||||||
|
if trait_predicates.is_empty() {
|
||||||
|
err.span_suggestion_verbose(
|
||||||
|
generics.where_clause_span,
|
||||||
|
"remove the `where` clause",
|
||||||
|
String::new(),
|
||||||
|
Applicability::MachineApplicable,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
let space = if generics.where_clause_span.is_empty() { " " } else { "" };
|
||||||
|
err.span_suggestion_verbose(
|
||||||
|
generics.where_clause_span,
|
||||||
|
"copy the `where` clause predicates from the trait",
|
||||||
|
format!("{space}where {}", trait_predicates.join(", ")),
|
||||||
|
Applicability::MachineApplicable,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn report_placeholder_failure(
|
pub(super) fn report_placeholder_failure(
|
||||||
&self,
|
&self,
|
||||||
placeholder_origin: SubregionOrigin<'tcx>,
|
placeholder_origin: SubregionOrigin<'tcx>,
|
||||||
|
|
|
@ -22,7 +22,7 @@ declare_lint_pass!(PassByValue => [PASS_BY_VALUE]);
|
||||||
impl<'tcx> LateLintPass<'tcx> for PassByValue {
|
impl<'tcx> LateLintPass<'tcx> for PassByValue {
|
||||||
fn check_ty(&mut self, cx: &LateContext<'_>, ty: &'tcx hir::Ty<'tcx>) {
|
fn check_ty(&mut self, cx: &LateContext<'_>, ty: &'tcx hir::Ty<'tcx>) {
|
||||||
match &ty.kind {
|
match &ty.kind {
|
||||||
TyKind::Rptr(_, hir::MutTy { ty: inner_ty, mutbl: hir::Mutability::Not }) => {
|
TyKind::Ref(_, hir::MutTy { ty: inner_ty, mutbl: hir::Mutability::Not }) => {
|
||||||
if let Some(impl_did) = cx.tcx.impl_of_method(ty.hir_id.owner.to_def_id()) {
|
if let Some(impl_did) = cx.tcx.impl_of_method(ty.hir_id.owner.to_def_id()) {
|
||||||
if cx.tcx.impl_trait_ref(impl_did).is_some() {
|
if cx.tcx.impl_trait_ref(impl_did).is_some() {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -31,7 +31,8 @@ use rustc_ast::{
|
||||||
use rustc_ast_pretty::pprust;
|
use rustc_ast_pretty::pprust;
|
||||||
use rustc_data_structures::fx::FxHashSet;
|
use rustc_data_structures::fx::FxHashSet;
|
||||||
use rustc_errors::{
|
use rustc_errors::{
|
||||||
fluent, Applicability, DiagnosticBuilder, DiagnosticMessage, Handler, MultiSpan, PResult,
|
fluent, Applicability, DiagnosticBuilder, DiagnosticMessage, FatalError, Handler, MultiSpan,
|
||||||
|
PResult,
|
||||||
};
|
};
|
||||||
use rustc_errors::{pluralize, Diagnostic, ErrorGuaranteed, IntoDiagnostic};
|
use rustc_errors::{pluralize, Diagnostic, ErrorGuaranteed, IntoDiagnostic};
|
||||||
use rustc_session::errors::ExprParenthesesNeeded;
|
use rustc_session::errors::ExprParenthesesNeeded;
|
||||||
|
@ -1229,7 +1230,7 @@ impl<'a> Parser<'a> {
|
||||||
let sum_span = ty.span.to(self.prev_token.span);
|
let sum_span = ty.span.to(self.prev_token.span);
|
||||||
|
|
||||||
let sub = match &ty.kind {
|
let sub = match &ty.kind {
|
||||||
TyKind::Rptr(lifetime, mut_ty) => {
|
TyKind::Ref(lifetime, mut_ty) => {
|
||||||
let sum_with_parens = pprust::to_string(|s| {
|
let sum_with_parens = pprust::to_string(|s| {
|
||||||
s.s.word("&");
|
s.s.word("&");
|
||||||
s.print_opt_lifetime(lifetime);
|
s.print_opt_lifetime(lifetime);
|
||||||
|
@ -2556,6 +2557,75 @@ impl<'a> Parser<'a> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_diff_marker(&mut self, long_kind: &TokenKind, short_kind: &TokenKind) -> bool {
|
||||||
|
(0..3).all(|i| self.look_ahead(i, |tok| tok == long_kind))
|
||||||
|
&& self.look_ahead(3, |tok| tok == short_kind)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn diff_marker(&mut self, long_kind: &TokenKind, short_kind: &TokenKind) -> Option<Span> {
|
||||||
|
if self.is_diff_marker(long_kind, short_kind) {
|
||||||
|
let lo = self.token.span;
|
||||||
|
for _ in 0..4 {
|
||||||
|
self.bump();
|
||||||
|
}
|
||||||
|
return Some(lo.to(self.prev_token.span));
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn recover_diff_marker(&mut self) {
|
||||||
|
let Some(start) = self.diff_marker(&TokenKind::BinOp(token::Shl), &TokenKind::Lt) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
let mut spans = Vec::with_capacity(3);
|
||||||
|
spans.push(start);
|
||||||
|
let mut middlediff3 = None;
|
||||||
|
let mut middle = None;
|
||||||
|
let mut end = None;
|
||||||
|
loop {
|
||||||
|
if self.token.kind == TokenKind::Eof {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if let Some(span) = self.diff_marker(&TokenKind::OrOr, &TokenKind::BinOp(token::Or)) {
|
||||||
|
middlediff3 = Some(span);
|
||||||
|
}
|
||||||
|
if let Some(span) = self.diff_marker(&TokenKind::EqEq, &TokenKind::Eq) {
|
||||||
|
middle = Some(span);
|
||||||
|
}
|
||||||
|
if let Some(span) = self.diff_marker(&TokenKind::BinOp(token::Shr), &TokenKind::Gt) {
|
||||||
|
spans.push(span);
|
||||||
|
end = Some(span);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
self.bump();
|
||||||
|
}
|
||||||
|
let mut err = self.struct_span_err(spans, "encountered diff marker");
|
||||||
|
err.span_label(start, "after this is the code before the merge");
|
||||||
|
if let Some(middle) = middlediff3 {
|
||||||
|
err.span_label(middle, "");
|
||||||
|
}
|
||||||
|
if let Some(middle) = middle {
|
||||||
|
err.span_label(middle, "");
|
||||||
|
}
|
||||||
|
if let Some(end) = end {
|
||||||
|
err.span_label(end, "above this are the incoming code changes");
|
||||||
|
}
|
||||||
|
err.help(
|
||||||
|
"if you're having merge conflicts after pulling new code, the top section is the code \
|
||||||
|
you already had and the bottom section is the remote code",
|
||||||
|
);
|
||||||
|
err.help(
|
||||||
|
"if you're in the middle of a rebase, the top section is the code being rebased onto \
|
||||||
|
and the bottom section is the code coming from the current commit being rebased",
|
||||||
|
);
|
||||||
|
err.note(
|
||||||
|
"for an explanation on these markers from the `git` documentation, visit \
|
||||||
|
<https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>",
|
||||||
|
);
|
||||||
|
err.emit();
|
||||||
|
FatalError.raise()
|
||||||
|
}
|
||||||
|
|
||||||
/// Parse and throw away a parenthesized comma separated
|
/// Parse and throw away a parenthesized comma separated
|
||||||
/// sequence of patterns until `)` is reached.
|
/// sequence of patterns until `)` is reached.
|
||||||
fn skip_pat_list(&mut self) -> PResult<'a, ()> {
|
fn skip_pat_list(&mut self) -> PResult<'a, ()> {
|
||||||
|
|
|
@ -3039,6 +3039,7 @@ impl<'a> Parser<'a> {
|
||||||
/// Parses `ident (COLON expr)?`.
|
/// Parses `ident (COLON expr)?`.
|
||||||
fn parse_expr_field(&mut self) -> PResult<'a, ExprField> {
|
fn parse_expr_field(&mut self) -> PResult<'a, ExprField> {
|
||||||
let attrs = self.parse_outer_attributes()?;
|
let attrs = self.parse_outer_attributes()?;
|
||||||
|
self.recover_diff_marker();
|
||||||
self.collect_tokens_trailing_token(attrs, ForceCollect::No, |this, attrs| {
|
self.collect_tokens_trailing_token(attrs, ForceCollect::No, |this, attrs| {
|
||||||
let lo = this.token.span;
|
let lo = this.token.span;
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,9 @@ impl<'a> Parser<'a> {
|
||||||
fn_parse_mode: FnParseMode,
|
fn_parse_mode: FnParseMode,
|
||||||
force_collect: ForceCollect,
|
force_collect: ForceCollect,
|
||||||
) -> PResult<'a, Option<Item>> {
|
) -> PResult<'a, Option<Item>> {
|
||||||
|
self.recover_diff_marker();
|
||||||
let attrs = self.parse_outer_attributes()?;
|
let attrs = self.parse_outer_attributes()?;
|
||||||
|
self.recover_diff_marker();
|
||||||
self.parse_item_common(attrs, true, false, fn_parse_mode, force_collect)
|
self.parse_item_common(attrs, true, false, fn_parse_mode, force_collect)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,6 +706,7 @@ impl<'a> Parser<'a> {
|
||||||
if self.recover_doc_comment_before_brace() {
|
if self.recover_doc_comment_before_brace() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
self.recover_diff_marker();
|
||||||
match parse_item(self) {
|
match parse_item(self) {
|
||||||
Ok(None) => {
|
Ok(None) => {
|
||||||
let mut is_unnecessary_semicolon = !items.is_empty()
|
let mut is_unnecessary_semicolon = !items.is_empty()
|
||||||
|
@ -1039,8 +1042,11 @@ impl<'a> Parser<'a> {
|
||||||
/// USE_TREE_LIST = Ø | (USE_TREE `,`)* USE_TREE [`,`]
|
/// USE_TREE_LIST = Ø | (USE_TREE `,`)* USE_TREE [`,`]
|
||||||
/// ```
|
/// ```
|
||||||
fn parse_use_tree_list(&mut self) -> PResult<'a, Vec<(UseTree, ast::NodeId)>> {
|
fn parse_use_tree_list(&mut self) -> PResult<'a, Vec<(UseTree, ast::NodeId)>> {
|
||||||
self.parse_delim_comma_seq(Delimiter::Brace, |p| Ok((p.parse_use_tree()?, DUMMY_NODE_ID)))
|
self.parse_delim_comma_seq(Delimiter::Brace, |p| {
|
||||||
.map(|(r, _)| r)
|
p.recover_diff_marker();
|
||||||
|
Ok((p.parse_use_tree()?, DUMMY_NODE_ID))
|
||||||
|
})
|
||||||
|
.map(|(r, _)| r)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_rename(&mut self) -> PResult<'a, Option<Ident>> {
|
fn parse_rename(&mut self) -> PResult<'a, Option<Ident>> {
|
||||||
|
@ -1379,7 +1385,9 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_enum_variant(&mut self) -> PResult<'a, Option<Variant>> {
|
fn parse_enum_variant(&mut self) -> PResult<'a, Option<Variant>> {
|
||||||
|
self.recover_diff_marker();
|
||||||
let variant_attrs = self.parse_outer_attributes()?;
|
let variant_attrs = self.parse_outer_attributes()?;
|
||||||
|
self.recover_diff_marker();
|
||||||
self.collect_tokens_trailing_token(
|
self.collect_tokens_trailing_token(
|
||||||
variant_attrs,
|
variant_attrs,
|
||||||
ForceCollect::No,
|
ForceCollect::No,
|
||||||
|
@ -1573,9 +1581,32 @@ impl<'a> Parser<'a> {
|
||||||
self.parse_paren_comma_seq(|p| {
|
self.parse_paren_comma_seq(|p| {
|
||||||
let attrs = p.parse_outer_attributes()?;
|
let attrs = p.parse_outer_attributes()?;
|
||||||
p.collect_tokens_trailing_token(attrs, ForceCollect::No, |p, attrs| {
|
p.collect_tokens_trailing_token(attrs, ForceCollect::No, |p, attrs| {
|
||||||
|
let mut snapshot = None;
|
||||||
|
if p.is_diff_marker(&TokenKind::BinOp(token::Shl), &TokenKind::Lt) {
|
||||||
|
// Account for `<<<<<<<` diff markers. We can't proactively error here because
|
||||||
|
// that can be a valid type start, so we snapshot and reparse only we've
|
||||||
|
// encountered another parse error.
|
||||||
|
snapshot = Some(p.create_snapshot_for_diagnostic());
|
||||||
|
}
|
||||||
let lo = p.token.span;
|
let lo = p.token.span;
|
||||||
let vis = p.parse_visibility(FollowedByType::Yes)?;
|
let vis = match p.parse_visibility(FollowedByType::Yes) {
|
||||||
let ty = p.parse_ty()?;
|
Ok(vis) => vis,
|
||||||
|
Err(err) => {
|
||||||
|
if let Some(ref mut snapshot) = snapshot {
|
||||||
|
snapshot.recover_diff_marker();
|
||||||
|
}
|
||||||
|
return Err(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let ty = match p.parse_ty() {
|
||||||
|
Ok(ty) => ty,
|
||||||
|
Err(err) => {
|
||||||
|
if let Some(ref mut snapshot) = snapshot {
|
||||||
|
snapshot.recover_diff_marker();
|
||||||
|
}
|
||||||
|
return Err(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
FieldDef {
|
FieldDef {
|
||||||
|
@ -1596,7 +1627,9 @@ impl<'a> Parser<'a> {
|
||||||
|
|
||||||
/// Parses an element of a struct declaration.
|
/// Parses an element of a struct declaration.
|
||||||
fn parse_field_def(&mut self, adt_ty: &str) -> PResult<'a, FieldDef> {
|
fn parse_field_def(&mut self, adt_ty: &str) -> PResult<'a, FieldDef> {
|
||||||
|
self.recover_diff_marker();
|
||||||
let attrs = self.parse_outer_attributes()?;
|
let attrs = self.parse_outer_attributes()?;
|
||||||
|
self.recover_diff_marker();
|
||||||
self.collect_tokens_trailing_token(attrs, ForceCollect::No, |this, attrs| {
|
self.collect_tokens_trailing_token(attrs, ForceCollect::No, |this, attrs| {
|
||||||
let lo = this.token.span;
|
let lo = this.token.span;
|
||||||
let vis = this.parse_visibility(FollowedByType::No)?;
|
let vis = this.parse_visibility(FollowedByType::No)?;
|
||||||
|
@ -2427,6 +2460,7 @@ impl<'a> Parser<'a> {
|
||||||
let mut first_param = true;
|
let mut first_param = true;
|
||||||
// Parse the arguments, starting out with `self` being allowed...
|
// Parse the arguments, starting out with `self` being allowed...
|
||||||
let (mut params, _) = self.parse_paren_comma_seq(|p| {
|
let (mut params, _) = self.parse_paren_comma_seq(|p| {
|
||||||
|
p.recover_diff_marker();
|
||||||
let param = p.parse_param_general(req_name, first_param).or_else(|mut e| {
|
let param = p.parse_param_general(req_name, first_param).or_else(|mut e| {
|
||||||
e.emit();
|
e.emit();
|
||||||
let lo = p.prev_token.span;
|
let lo = p.prev_token.span;
|
||||||
|
|
|
@ -531,13 +531,23 @@ impl<'a> Parser<'a> {
|
||||||
recover: AttemptLocalParseRecovery,
|
recover: AttemptLocalParseRecovery,
|
||||||
) -> PResult<'a, P<Block>> {
|
) -> PResult<'a, P<Block>> {
|
||||||
let mut stmts = vec![];
|
let mut stmts = vec![];
|
||||||
|
let mut snapshot = None;
|
||||||
while !self.eat(&token::CloseDelim(Delimiter::Brace)) {
|
while !self.eat(&token::CloseDelim(Delimiter::Brace)) {
|
||||||
if self.token == token::Eof {
|
if self.token == token::Eof {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if self.is_diff_marker(&TokenKind::BinOp(token::Shl), &TokenKind::Lt) {
|
||||||
|
// Account for `<<<<<<<` diff markers. We can't proactively error here because
|
||||||
|
// that can be a valid path start, so we snapshot and reparse only we've
|
||||||
|
// encountered another parse error.
|
||||||
|
snapshot = Some(self.create_snapshot_for_diagnostic());
|
||||||
|
}
|
||||||
let stmt = match self.parse_full_stmt(recover) {
|
let stmt = match self.parse_full_stmt(recover) {
|
||||||
Err(mut err) if recover.yes() => {
|
Err(mut err) if recover.yes() => {
|
||||||
self.maybe_annotate_with_ascription(&mut err, false);
|
self.maybe_annotate_with_ascription(&mut err, false);
|
||||||
|
if let Some(ref mut snapshot) = snapshot {
|
||||||
|
snapshot.recover_diff_marker();
|
||||||
|
}
|
||||||
err.emit();
|
err.emit();
|
||||||
self.recover_stmt_(SemiColonMode::Ignore, BlockMode::Ignore);
|
self.recover_stmt_(SemiColonMode::Ignore, BlockMode::Ignore);
|
||||||
Some(self.mk_stmt_err(self.token.span))
|
Some(self.mk_stmt_err(self.token.span))
|
||||||
|
|
|
@ -504,7 +504,7 @@ impl<'a> Parser<'a> {
|
||||||
self.bump_with((dyn_tok, dyn_tok_sp));
|
self.bump_with((dyn_tok, dyn_tok_sp));
|
||||||
}
|
}
|
||||||
let ty = self.parse_ty_no_plus()?;
|
let ty = self.parse_ty_no_plus()?;
|
||||||
Ok(TyKind::Rptr(opt_lifetime, MutTy { ty, mutbl }))
|
Ok(TyKind::Ref(opt_lifetime, MutTy { ty, mutbl }))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parses the `typeof(EXPR)`.
|
// Parses the `typeof(EXPR)`.
|
||||||
|
|
|
@ -324,7 +324,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
||||||
Slice,
|
Slice,
|
||||||
Array,
|
Array,
|
||||||
Ptr,
|
Ptr,
|
||||||
Rptr,
|
Ref,
|
||||||
BareFn,
|
BareFn,
|
||||||
Never,
|
Never,
|
||||||
Tup,
|
Tup,
|
||||||
|
@ -580,7 +580,7 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
|
||||||
Slice,
|
Slice,
|
||||||
Array,
|
Array,
|
||||||
Ptr,
|
Ptr,
|
||||||
Rptr,
|
Ref,
|
||||||
BareFn,
|
BareFn,
|
||||||
Never,
|
Never,
|
||||||
Tup,
|
Tup,
|
||||||
|
|
|
@ -651,7 +651,7 @@ impl<'a: 'ast, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
|
||||||
let prev = self.diagnostic_metadata.current_trait_object;
|
let prev = self.diagnostic_metadata.current_trait_object;
|
||||||
let prev_ty = self.diagnostic_metadata.current_type_path;
|
let prev_ty = self.diagnostic_metadata.current_type_path;
|
||||||
match ty.kind {
|
match ty.kind {
|
||||||
TyKind::Rptr(None, _) => {
|
TyKind::Ref(None, _) => {
|
||||||
// Elided lifetime in reference: we resolve as if there was some lifetime `'_` with
|
// Elided lifetime in reference: we resolve as if there was some lifetime `'_` with
|
||||||
// NodeId `ty.id`.
|
// NodeId `ty.id`.
|
||||||
// This span will be used in case of elision failure.
|
// This span will be used in case of elision failure.
|
||||||
|
@ -2004,7 +2004,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
||||||
impl<'a> Visitor<'a> for SelfVisitor<'_, '_> {
|
impl<'a> Visitor<'a> for SelfVisitor<'_, '_> {
|
||||||
fn visit_ty(&mut self, ty: &'a Ty) {
|
fn visit_ty(&mut self, ty: &'a Ty) {
|
||||||
trace!("SelfVisitor considering ty={:?}", ty);
|
trace!("SelfVisitor considering ty={:?}", ty);
|
||||||
if let TyKind::Rptr(lt, ref mt) = ty.kind && self.is_self_ty(&mt.ty) {
|
if let TyKind::Ref(lt, ref mt) = ty.kind && self.is_self_ty(&mt.ty) {
|
||||||
let lt_id = if let Some(lt) = lt {
|
let lt_id = if let Some(lt) = lt {
|
||||||
lt.id
|
lt.id
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1554,7 +1554,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
||||||
fn extract_node_id(t: &Ty) -> Option<NodeId> {
|
fn extract_node_id(t: &Ty) -> Option<NodeId> {
|
||||||
match t.kind {
|
match t.kind {
|
||||||
TyKind::Path(None, _) => Some(t.id),
|
TyKind::Path(None, _) => Some(t.id),
|
||||||
TyKind::Rptr(_, ref mut_ty) => extract_node_id(&mut_ty.ty),
|
TyKind::Ref(_, ref mut_ty) => extract_node_id(&mut_ty.ty),
|
||||||
// This doesn't handle the remaining `Ty` variants as they are not
|
// This doesn't handle the remaining `Ty` variants as they are not
|
||||||
// that commonly the self_type, it might be interesting to provide
|
// that commonly the self_type, it might be interesting to provide
|
||||||
// support for those in future.
|
// support for those in future.
|
||||||
|
@ -2189,7 +2189,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
||||||
Some(LifetimeUseSet::One { use_span, use_ctxt }) => {
|
Some(LifetimeUseSet::One { use_span, use_ctxt }) => {
|
||||||
debug!(?param.ident, ?param.ident.span, ?use_span);
|
debug!(?param.ident, ?param.ident.span, ?use_span);
|
||||||
|
|
||||||
let elidable = matches!(use_ctxt, LifetimeCtxt::Rptr);
|
let elidable = matches!(use_ctxt, LifetimeCtxt::Ref);
|
||||||
|
|
||||||
let deletion_span = deletion_span();
|
let deletion_span = deletion_span();
|
||||||
self.r.lint_buffer.buffer_lint_with_diagnostic(
|
self.r.lint_buffer.buffer_lint_with_diagnostic(
|
||||||
|
|
|
@ -165,7 +165,7 @@ impl<'hir> Sig for hir::Ty<'hir> {
|
||||||
let text = format!("{}{}", prefix, nested.text);
|
let text = format!("{}{}", prefix, nested.text);
|
||||||
Ok(replace_text(nested, text))
|
Ok(replace_text(nested, text))
|
||||||
}
|
}
|
||||||
hir::TyKind::Rptr(ref lifetime, ref mt) => {
|
hir::TyKind::Ref(ref lifetime, ref mt) => {
|
||||||
let mut prefix = "&".to_owned();
|
let mut prefix = "&".to_owned();
|
||||||
prefix.push_str(&lifetime.ident.to_string());
|
prefix.push_str(&lifetime.ident.to_string());
|
||||||
prefix.push(' ');
|
prefix.push(' ');
|
||||||
|
|
|
@ -2771,7 +2771,7 @@ impl<'v> Visitor<'v> for FindTypeParam {
|
||||||
// and suggest `T: ?Sized` regardless of their obligations. This is fine because the errors
|
// and suggest `T: ?Sized` regardless of their obligations. This is fine because the errors
|
||||||
// in that case should make what happened clear enough.
|
// in that case should make what happened clear enough.
|
||||||
match ty.kind {
|
match ty.kind {
|
||||||
hir::TyKind::Ptr(_) | hir::TyKind::Rptr(..) | hir::TyKind::TraitObject(..) => {}
|
hir::TyKind::Ptr(_) | hir::TyKind::Ref(..) | hir::TyKind::TraitObject(..) => {}
|
||||||
hir::TyKind::Path(hir::QPath::Resolved(None, path))
|
hir::TyKind::Path(hir::QPath::Resolved(None, path))
|
||||||
if path.segments.len() == 1 && path.segments[0].ident.name == self.param =>
|
if path.segments.len() == 1 && path.segments[0].ident.name == self.param =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -2514,6 +2514,15 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||||
ObligationCauseCode::VariableType(hir_id) => {
|
ObligationCauseCode::VariableType(hir_id) => {
|
||||||
let parent_node = self.tcx.hir().get_parent_node(hir_id);
|
let parent_node = self.tcx.hir().get_parent_node(hir_id);
|
||||||
match self.tcx.hir().find(parent_node) {
|
match self.tcx.hir().find(parent_node) {
|
||||||
|
Some(Node::Local(hir::Local { ty: Some(ty), .. })) => {
|
||||||
|
err.span_suggestion_verbose(
|
||||||
|
ty.span.shrink_to_lo(),
|
||||||
|
"consider borrowing here",
|
||||||
|
"&",
|
||||||
|
Applicability::MachineApplicable,
|
||||||
|
);
|
||||||
|
err.note("all local variables must have a statically known size");
|
||||||
|
}
|
||||||
Some(Node::Local(hir::Local {
|
Some(Node::Local(hir::Local {
|
||||||
init: Some(hir::Expr { kind: hir::ExprKind::Index(_, _), span, .. }),
|
init: Some(hir::Expr { kind: hir::ExprKind::Index(_, _), span, .. }),
|
||||||
..
|
..
|
||||||
|
|
|
@ -1612,7 +1612,7 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T
|
||||||
match ty.kind {
|
match ty.kind {
|
||||||
TyKind::Never => Primitive(PrimitiveType::Never),
|
TyKind::Never => Primitive(PrimitiveType::Never),
|
||||||
TyKind::Ptr(ref m) => RawPointer(m.mutbl, Box::new(clean_ty(m.ty, cx))),
|
TyKind::Ptr(ref m) => RawPointer(m.mutbl, Box::new(clean_ty(m.ty, cx))),
|
||||||
TyKind::Rptr(ref l, ref m) => {
|
TyKind::Ref(ref l, ref m) => {
|
||||||
let lifetime = if l.is_anonymous() { None } else { Some(clean_lifetime(*l, cx)) };
|
let lifetime = if l.is_anonymous() { None } else { Some(clean_lifetime(*l, cx)) };
|
||||||
BorrowedRef { lifetime, mutability: m.mutbl, type_: Box::new(clean_ty(m.ty, cx)) }
|
BorrowedRef { lifetime, mutability: m.mutbl, type_: Box::new(clean_ty(m.ty, cx)) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1106,7 +1106,6 @@ pre.rust .doccomment {
|
||||||
}
|
}
|
||||||
|
|
||||||
.example-wrap .tooltip:hover::after {
|
.example-wrap .tooltip:hover::after {
|
||||||
text-align: center;
|
|
||||||
padding: 5px 3px 3px 3px;
|
padding: 5px 3px 3px 3px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
|
@ -1956,6 +1955,13 @@ in storage.js
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scraped-example .example-wrap .rust span.highlight {
|
||||||
|
background: var(--scrape-example-code-line-highlight);
|
||||||
|
}
|
||||||
|
.scraped-example .example-wrap .rust span.highlight.focus {
|
||||||
|
background: var(--scrape-example-code-line-highlight-focus);
|
||||||
|
}
|
||||||
|
|
||||||
.more-examples-toggle {
|
.more-examples-toggle {
|
||||||
max-width: calc(100% + 25px);
|
max-width: calc(100% + 25px);
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
|
|
@ -91,6 +91,8 @@ Original by Dempfi (https://github.com/dempfi/ayu)
|
||||||
--codeblock-link-background: #333;
|
--codeblock-link-background: #333;
|
||||||
--scrape-example-toggle-line-background: #999;
|
--scrape-example-toggle-line-background: #999;
|
||||||
--scrape-example-toggle-line-hover-background: #c5c5c5;
|
--scrape-example-toggle-line-hover-background: #c5c5c5;
|
||||||
|
--scrape-example-code-line-highlight: rgb(91, 59, 1);
|
||||||
|
--scrape-example-code-line-highlight-focus: rgb(124, 75, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
h1, h2, h3, h4 {
|
h1, h2, h3, h4 {
|
||||||
|
@ -206,12 +208,6 @@ above the `@media (max-width: 700px)` rules due to a bug in the css checker */
|
||||||
border-color: white;
|
border-color: white;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
.scraped-example .example-wrap .rust span.highlight {
|
|
||||||
background: rgb(91, 59, 1);
|
|
||||||
}
|
|
||||||
.scraped-example .example-wrap .rust span.highlight.focus {
|
|
||||||
background: rgb(124, 75, 15);
|
|
||||||
}
|
|
||||||
.scraped-example:not(.expanded) .code-wrapper::before {
|
.scraped-example:not(.expanded) .code-wrapper::before {
|
||||||
background: linear-gradient(to bottom, rgba(15, 20, 25, 1), rgba(15, 20, 25, 0));
|
background: linear-gradient(to bottom, rgba(15, 20, 25, 1), rgba(15, 20, 25, 0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,8 @@
|
||||||
--codeblock-link-background: #333;
|
--codeblock-link-background: #333;
|
||||||
--scrape-example-toggle-line-background: #999;
|
--scrape-example-toggle-line-background: #999;
|
||||||
--scrape-example-toggle-line-hover-background: #c5c5c5;
|
--scrape-example-toggle-line-hover-background: #c5c5c5;
|
||||||
|
--scrape-example-code-line-highlight: rgb(91, 59, 1);
|
||||||
|
--scrape-example-code-line-highlight-focus: rgb(124, 75, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
#search-tabs > button:not(.selected) {
|
#search-tabs > button:not(.selected) {
|
||||||
|
@ -106,12 +108,6 @@
|
||||||
border-color: white;
|
border-color: white;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
.scraped-example .example-wrap .rust span.highlight {
|
|
||||||
background: rgb(91, 59, 1);
|
|
||||||
}
|
|
||||||
.scraped-example .example-wrap .rust span.highlight.focus {
|
|
||||||
background: rgb(124, 75, 15);
|
|
||||||
}
|
|
||||||
.scraped-example:not(.expanded) .code-wrapper::before {
|
.scraped-example:not(.expanded) .code-wrapper::before {
|
||||||
background: linear-gradient(to bottom, rgba(53, 53, 53, 1), rgba(53, 53, 53, 0));
|
background: linear-gradient(to bottom, rgba(53, 53, 53, 1), rgba(53, 53, 53, 0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,8 @@
|
||||||
--codeblock-link-background: #eee;
|
--codeblock-link-background: #eee;
|
||||||
--scrape-example-toggle-line-background: #ccc;
|
--scrape-example-toggle-line-background: #ccc;
|
||||||
--scrape-example-toggle-line-hover-background: #999;
|
--scrape-example-toggle-line-hover-background: #999;
|
||||||
|
--scrape-example-code-line-highlight: #fcffd6;
|
||||||
|
--scrape-example-code-line-highlight-focus: #f6fdb0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#search-tabs > button:not(.selected) {
|
#search-tabs > button:not(.selected) {
|
||||||
|
@ -103,12 +105,6 @@
|
||||||
border-color: black;
|
border-color: black;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
.scraped-example .example-wrap .rust span.highlight {
|
|
||||||
background: #fcffd6;
|
|
||||||
}
|
|
||||||
.scraped-example .example-wrap .rust span.highlight.focus {
|
|
||||||
background: #f6fdb0;
|
|
||||||
}
|
|
||||||
.scraped-example:not(.expanded) .code-wrapper::before {
|
.scraped-example:not(.expanded) .code-wrapper::before {
|
||||||
background: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
|
background: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ define-function: (
|
||||||
".docblock .example-wrap.compile_fail .tooltip::after",
|
".docblock .example-wrap.compile_fail .tooltip::after",
|
||||||
{
|
{
|
||||||
"content": '"This example deliberately fails to compile"',
|
"content": '"This example deliberately fails to compile"',
|
||||||
"text-align": "center",
|
|
||||||
"padding": "5px 3px 3px",
|
"padding": "5px 3px 3px",
|
||||||
"background-color": |background|,
|
"background-color": |background|,
|
||||||
"color": |color|,
|
"color": |color|,
|
||||||
|
@ -74,7 +73,6 @@ define-function: (
|
||||||
".docblock .example-wrap.should_panic .tooltip::after",
|
".docblock .example-wrap.should_panic .tooltip::after",
|
||||||
{
|
{
|
||||||
"content": '"This example panics"',
|
"content": '"This example panics"',
|
||||||
"text-align": "center",
|
|
||||||
"padding": "5px 3px 3px",
|
"padding": "5px 3px 3px",
|
||||||
"background-color": |background|,
|
"background-color": |background|,
|
||||||
"color": |color|,
|
"color": |color|,
|
||||||
|
@ -114,7 +112,6 @@ define-function: (
|
||||||
".docblock .example-wrap.ignore .tooltip::after",
|
".docblock .example-wrap.ignore .tooltip::after",
|
||||||
{
|
{
|
||||||
"content": '"This example is not tested"',
|
"content": '"This example is not tested"',
|
||||||
"text-align": "center",
|
|
||||||
"padding": "5px 3px 3px",
|
"padding": "5px 3px 3px",
|
||||||
"background-color": |background|,
|
"background-color": |background|,
|
||||||
"color": |color|,
|
"color": |color|,
|
||||||
|
|
34
src/test/rustdoc-gui/scrape-examples-color.goml
Normal file
34
src/test/rustdoc-gui/scrape-examples-color.goml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
// Check that scrape example code blocks have the expected colors.
|
||||||
|
goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
|
||||||
|
|
||||||
|
define-function: (
|
||||||
|
"check-colors",
|
||||||
|
(theme, highlight, highlight_focus),
|
||||||
|
[
|
||||||
|
("local-storage", { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", }),
|
||||||
|
("reload"),
|
||||||
|
("wait-for", ".more-examples-toggle"),
|
||||||
|
("assert-css", (".scraped-example .example-wrap .rust span.highlight:not(.focus)", {
|
||||||
|
"background-color": |highlight|,
|
||||||
|
}, ALL)),
|
||||||
|
("assert-css", (".scraped-example .example-wrap .rust span.highlight.focus", {
|
||||||
|
"background-color": |highlight_focus|,
|
||||||
|
}, ALL)),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
call-function: ("check-colors", {
|
||||||
|
"theme": "ayu",
|
||||||
|
"highlight": "rgb(91, 59, 1)",
|
||||||
|
"highlight_focus": "rgb(124, 75, 15)",
|
||||||
|
})
|
||||||
|
call-function: ("check-colors", {
|
||||||
|
"theme": "dark",
|
||||||
|
"highlight": "rgb(91, 59, 1)",
|
||||||
|
"highlight_focus": "rgb(124, 75, 15)",
|
||||||
|
})
|
||||||
|
call-function: ("check-colors", {
|
||||||
|
"theme": "light",
|
||||||
|
"highlight": "rgb(252, 255, 214)",
|
||||||
|
"highlight_focus": "rgb(246, 253, 176)",
|
||||||
|
})
|
|
@ -59,7 +59,7 @@ pub async fn const_generics<const N: usize>(_: impl Trait<N>) {}
|
||||||
// @has - '//pre[@class="rust fn"]' 'pub async fn elided(foo: &str) -> &str'
|
// @has - '//pre[@class="rust fn"]' 'pub async fn elided(foo: &str) -> &str'
|
||||||
pub async fn elided(foo: &str) -> &str {}
|
pub async fn elided(foo: &str) -> &str {}
|
||||||
// This should really be shown as written, but for implementation reasons it's difficult.
|
// This should really be shown as written, but for implementation reasons it's difficult.
|
||||||
// See `impl Clean for TyKind::Rptr`.
|
// See `impl Clean for TyKind::Ref`.
|
||||||
// @has async_fn/fn.user_elided.html
|
// @has async_fn/fn.user_elided.html
|
||||||
// @has - '//pre[@class="rust fn"]' 'pub async fn user_elided(foo: &str) -> &str'
|
// @has - '//pre[@class="rust fn"]' 'pub async fn user_elided(foo: &str) -> &str'
|
||||||
pub async fn user_elided(foo: &'_ str) -> &str {}
|
pub async fn user_elided(foo: &'_ str) -> &str {}
|
||||||
|
|
|
@ -6,6 +6,11 @@ LL | fn renew<'b: 'a>(self) -> &'b mut [T];
|
||||||
...
|
...
|
||||||
LL | fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b {
|
LL | fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b {
|
||||||
| ^^ impl has extra requirement `'a: 'b`
|
| ^^ impl has extra requirement `'a: 'b`
|
||||||
|
|
|
||||||
|
help: copy the `where` clause predicates from the trait
|
||||||
|
|
|
||||||
|
LL | fn renew<'b: 'a>(self) -> &'b mut [T] where 'b: 'a {
|
||||||
|
| ~~~~~~~~~~~~
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,12 @@ LL | fn foo();
|
||||||
...
|
...
|
||||||
LL | fn foo() where 'a: 'b { }
|
LL | fn foo() where 'a: 'b { }
|
||||||
| ^^ impl has extra requirement `'a: 'b`
|
| ^^ impl has extra requirement `'a: 'b`
|
||||||
|
|
|
||||||
|
help: remove the `where` clause
|
||||||
|
|
|
||||||
|
LL - fn foo() where 'a: 'b { }
|
||||||
|
LL + fn foo() { }
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,11 @@ LL | type B<'a, 'b> where 'a: 'b;
|
||||||
...
|
...
|
||||||
LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
|
LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
|
||||||
| ^^ impl has extra requirement `'b: 'a`
|
| ^^ impl has extra requirement `'b: 'a`
|
||||||
|
|
|
||||||
|
help: copy the `where` clause predicates from the trait
|
||||||
|
|
|
||||||
|
LL | type B<'a, 'b> = (&'a(), &'b ()) where 'a: 'b;
|
||||||
|
| ~~~~~~~~~~~~
|
||||||
|
|
||||||
error[E0277]: the trait bound `T: Copy` is not satisfied
|
error[E0277]: the trait bound `T: Copy` is not satisfied
|
||||||
--> $DIR/impl_bounds.rs:18:33
|
--> $DIR/impl_bounds.rs:18:33
|
||||||
|
|
|
@ -5,13 +5,17 @@ LL | type Fut<'a> where Self: 'a;
|
||||||
| ------------ definition of `Fut` from trait
|
| ------------ definition of `Fut` from trait
|
||||||
...
|
...
|
||||||
LL | type Fut<'a> = impl Future<Output = ()>;
|
LL | type Fut<'a> = impl Future<Output = ()>;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^- help: try copying this clause from the trait: `where Self: 'a`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: type must outlive the lifetime `'a` as defined here
|
note: type must outlive the lifetime `'a` as defined here
|
||||||
--> $DIR/issue-90014.rs:13:14
|
--> $DIR/issue-90014.rs:13:14
|
||||||
|
|
|
|
||||||
LL | type Fut<'a> = impl Future<Output = ()>;
|
LL | type Fut<'a> = impl Future<Output = ()>;
|
||||||
| ^^
|
| ^^
|
||||||
|
help: copy the `where` clause predicates from the trait
|
||||||
|
|
|
||||||
|
LL | type Fut<'a> = impl Future<Output = ()> where Self: 'a;
|
||||||
|
| ++++++++++++++
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ LL | type Cursor<'tx>: Cursor<'tx>
|
||||||
| ----------------------------- definition of `Cursor` from trait
|
| ----------------------------- definition of `Cursor` from trait
|
||||||
...
|
...
|
||||||
LL | type Cursor<'tx> = CursorImpl<'tx>;
|
LL | type Cursor<'tx> = CursorImpl<'tx>;
|
||||||
| ^^^^^^^^^^^^^^^- help: try copying these clauses from the trait: `where 'db: 'tx, Self: 'tx`
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: lifetime parameter instantiated with the lifetime `'db` as defined here
|
note: lifetime parameter instantiated with the lifetime `'db` as defined here
|
||||||
--> $DIR/issue-91883.rs:29:6
|
--> $DIR/issue-91883.rs:29:6
|
||||||
|
@ -17,6 +17,10 @@ note: but lifetime parameter must outlive the lifetime `'tx` as defined here
|
||||||
|
|
|
|
||||||
LL | type Cursor<'tx> = CursorImpl<'tx>;
|
LL | type Cursor<'tx> = CursorImpl<'tx>;
|
||||||
| ^^^
|
| ^^^
|
||||||
|
help: copy the `where` clause predicates from the trait
|
||||||
|
|
|
||||||
|
LL | type Cursor<'tx> = CursorImpl<'tx> where 'db: 'tx, Self: 'tx;
|
||||||
|
| +++++++++++++++++++++++++
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,17 @@ LL | type TextureIter<'a>: Iterator<Item = &'a Texture>
|
||||||
| -------------------------------------------------- definition of `TextureIter` from trait
|
| -------------------------------------------------- definition of `TextureIter` from trait
|
||||||
...
|
...
|
||||||
LL | type TextureIter<'a> = std::option::IntoIter<&'a Texture>;
|
LL | type TextureIter<'a> = std::option::IntoIter<&'a Texture>;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try copying this clause from the trait: `where Self: 'a`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: type must outlive the lifetime `'a` as defined here
|
note: type must outlive the lifetime `'a` as defined here
|
||||||
--> $DIR/issue-92033.rs:20:22
|
--> $DIR/issue-92033.rs:20:22
|
||||||
|
|
|
|
||||||
LL | type TextureIter<'a> = std::option::IntoIter<&'a Texture>;
|
LL | type TextureIter<'a> = std::option::IntoIter<&'a Texture>;
|
||||||
| ^^
|
| ^^
|
||||||
|
help: copy the `where` clause predicates from the trait
|
||||||
|
|
|
||||||
|
LL | type TextureIter<'a> = std::option::IntoIter<&'a Texture> where Self: 'a;
|
||||||
|
| ++++++++++++++
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
trait Foo {
|
||||||
|
type T<'a1, 'b1>
|
||||||
|
where
|
||||||
|
'a1: 'b1;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Foo for () {
|
||||||
|
type T<'a2, 'b2> = () where 'b2: 'a2;
|
||||||
|
//~^ ERROR impl has stricter requirements than trait
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
|
@ -0,0 +1,17 @@
|
||||||
|
error[E0276]: impl has stricter requirements than trait
|
||||||
|
--> $DIR/mismatched-where-clause-regions.rs:8:38
|
||||||
|
|
|
||||||
|
LL | type T<'a1, 'b1>
|
||||||
|
| ---------------- definition of `T` from trait
|
||||||
|
...
|
||||||
|
LL | type T<'a2, 'b2> = () where 'b2: 'a2;
|
||||||
|
| ^^^ impl has extra requirement `'b2: 'a2`
|
||||||
|
|
|
||||||
|
help: copy the `where` clause predicates from the trait
|
||||||
|
|
|
||||||
|
LL | type T<'a2, 'b2> = () where 'a2: 'b2;
|
||||||
|
| ~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0276`.
|
|
@ -6,6 +6,12 @@ LL | type Assoc<'a, 'b>;
|
||||||
...
|
...
|
||||||
LL | type Assoc<'a, 'b> = () where 'a: 'b;
|
LL | type Assoc<'a, 'b> = () where 'a: 'b;
|
||||||
| ^^ impl has extra requirement `'a: 'b`
|
| ^^ impl has extra requirement `'a: 'b`
|
||||||
|
|
|
||||||
|
help: remove the `where` clause
|
||||||
|
|
|
||||||
|
LL - type Assoc<'a, 'b> = () where 'a: 'b;
|
||||||
|
LL + type Assoc<'a, 'b> = () ;
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -801,7 +801,7 @@ fn test_ty() {
|
||||||
assert_eq!(stringify_ty!(*const T), "*const T");
|
assert_eq!(stringify_ty!(*const T), "*const T");
|
||||||
assert_eq!(stringify_ty!(*mut T), "*mut T");
|
assert_eq!(stringify_ty!(*mut T), "*mut T");
|
||||||
|
|
||||||
// TyKind::Rptr
|
// TyKind::Ref
|
||||||
assert_eq!(stringify_ty!(&T), "&T");
|
assert_eq!(stringify_ty!(&T), "&T");
|
||||||
assert_eq!(stringify_ty!(&mut T), "&mut T");
|
assert_eq!(stringify_ty!(&mut T), "&mut T");
|
||||||
assert_eq!(stringify_ty!(&'a T), "&'a T");
|
assert_eq!(stringify_ty!(&'a T), "&'a T");
|
||||||
|
|
11
src/test/ui/parser/diff-markers/enum-2.rs
Normal file
11
src/test/ui/parser/diff-markers/enum-2.rs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
enum E {
|
||||||
|
Foo {
|
||||||
|
<<<<<<< HEAD //~ ERROR encountered diff marker
|
||||||
|
x: u8,
|
||||||
|
|||||||
|
||||||
|
z: (),
|
||||||
|
=======
|
||||||
|
y: i8,
|
||||||
|
>>>>>>> branch
|
||||||
|
}
|
||||||
|
}
|
21
src/test/ui/parser/diff-markers/enum-2.stderr
Normal file
21
src/test/ui/parser/diff-markers/enum-2.stderr
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
error: encountered diff marker
|
||||||
|
--> $DIR/enum-2.rs:3:1
|
||||||
|
|
|
||||||
|
LL | <<<<<<< HEAD
|
||||||
|
| ^^^^^^^ after this is the code before the merge
|
||||||
|
LL | x: u8,
|
||||||
|
LL | |||||||
|
||||||
|
| -------
|
||||||
|
LL | z: (),
|
||||||
|
LL | =======
|
||||||
|
| -------
|
||||||
|
LL | y: i8,
|
||||||
|
LL | >>>>>>> branch
|
||||||
|
| ^^^^^^^ above this are the incoming code changes
|
||||||
|
|
|
||||||
|
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
|
||||||
|
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
|
||||||
|
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
7
src/test/ui/parser/diff-markers/enum.rs
Normal file
7
src/test/ui/parser/diff-markers/enum.rs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
enum E {
|
||||||
|
<<<<<<< HEAD //~ ERROR encountered diff marker
|
||||||
|
Foo(u8),
|
||||||
|
=======
|
||||||
|
Bar(i8),
|
||||||
|
>>>>>>> branch
|
||||||
|
}
|
18
src/test/ui/parser/diff-markers/enum.stderr
Normal file
18
src/test/ui/parser/diff-markers/enum.stderr
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
error: encountered diff marker
|
||||||
|
--> $DIR/enum.rs:2:1
|
||||||
|
|
|
||||||
|
LL | <<<<<<< HEAD
|
||||||
|
| ^^^^^^^ after this is the code before the merge
|
||||||
|
LL | Foo(u8),
|
||||||
|
LL | =======
|
||||||
|
| -------
|
||||||
|
LL | Bar(i8),
|
||||||
|
LL | >>>>>>> branch
|
||||||
|
| ^^^^^^^ above this are the incoming code changes
|
||||||
|
|
|
||||||
|
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
|
||||||
|
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
|
||||||
|
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
16
src/test/ui/parser/diff-markers/fn-arg.rs
Normal file
16
src/test/ui/parser/diff-markers/fn-arg.rs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
trait T {
|
||||||
|
fn foo(
|
||||||
|
<<<<<<< HEAD //~ ERROR encountered diff marker
|
||||||
|
x: u8,
|
||||||
|
=======
|
||||||
|
x: i8,
|
||||||
|
>>>>>>> branch
|
||||||
|
) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct S;
|
||||||
|
impl T for S {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
S::foo(42);
|
||||||
|
}
|
18
src/test/ui/parser/diff-markers/fn-arg.stderr
Normal file
18
src/test/ui/parser/diff-markers/fn-arg.stderr
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
error: encountered diff marker
|
||||||
|
--> $DIR/fn-arg.rs:3:1
|
||||||
|
|
|
||||||
|
LL | <<<<<<< HEAD
|
||||||
|
| ^^^^^^^ after this is the code before the merge
|
||||||
|
LL | x: u8,
|
||||||
|
LL | =======
|
||||||
|
| -------
|
||||||
|
LL | x: i8,
|
||||||
|
LL | >>>>>>> branch
|
||||||
|
| ^^^^^^^ above this are the incoming code changes
|
||||||
|
|
|
||||||
|
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
|
||||||
|
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
|
||||||
|
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
10
src/test/ui/parser/diff-markers/item-with-attr.rs
Normal file
10
src/test/ui/parser/diff-markers/item-with-attr.rs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#[attribute]
|
||||||
|
<<<<<<< HEAD //~ ERROR encountered diff marker
|
||||||
|
fn foo() {}
|
||||||
|
=======
|
||||||
|
fn bar() {}
|
||||||
|
>>>>>>> branch
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
foo();
|
||||||
|
}
|
18
src/test/ui/parser/diff-markers/item-with-attr.stderr
Normal file
18
src/test/ui/parser/diff-markers/item-with-attr.stderr
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
error: encountered diff marker
|
||||||
|
--> $DIR/item-with-attr.rs:2:1
|
||||||
|
|
|
||||||
|
LL | <<<<<<< HEAD
|
||||||
|
| ^^^^^^^ after this is the code before the merge
|
||||||
|
LL | fn foo() {}
|
||||||
|
LL | =======
|
||||||
|
| -------
|
||||||
|
LL | fn bar() {}
|
||||||
|
LL | >>>>>>> branch
|
||||||
|
| ^^^^^^^ above this are the incoming code changes
|
||||||
|
|
|
||||||
|
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
|
||||||
|
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
|
||||||
|
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
9
src/test/ui/parser/diff-markers/item.rs
Normal file
9
src/test/ui/parser/diff-markers/item.rs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<<<<<<< HEAD //~ ERROR encountered diff marker
|
||||||
|
fn foo() {}
|
||||||
|
=======
|
||||||
|
fn bar() {}
|
||||||
|
>>>>>>> branch
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
foo();
|
||||||
|
}
|
18
src/test/ui/parser/diff-markers/item.stderr
Normal file
18
src/test/ui/parser/diff-markers/item.stderr
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
error: encountered diff marker
|
||||||
|
--> $DIR/item.rs:1:1
|
||||||
|
|
|
||||||
|
LL | <<<<<<< HEAD
|
||||||
|
| ^^^^^^^ after this is the code before the merge
|
||||||
|
LL | fn foo() {}
|
||||||
|
LL | =======
|
||||||
|
| -------
|
||||||
|
LL | fn bar() {}
|
||||||
|
LL | >>>>>>> branch
|
||||||
|
| ^^^^^^^ above this are the incoming code changes
|
||||||
|
|
|
||||||
|
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
|
||||||
|
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
|
||||||
|
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
15
src/test/ui/parser/diff-markers/statement.rs
Normal file
15
src/test/ui/parser/diff-markers/statement.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
trait T {
|
||||||
|
fn foo() {}
|
||||||
|
fn bar() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct S;
|
||||||
|
impl T for S {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
<<<<<<< HEAD //~ ERROR encountered diff marker
|
||||||
|
S::foo();
|
||||||
|
=======
|
||||||
|
S::bar();
|
||||||
|
>>>>>>> branch
|
||||||
|
}
|
18
src/test/ui/parser/diff-markers/statement.stderr
Normal file
18
src/test/ui/parser/diff-markers/statement.stderr
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
error: encountered diff marker
|
||||||
|
--> $DIR/statement.rs:10:1
|
||||||
|
|
|
||||||
|
LL | <<<<<<< HEAD
|
||||||
|
| ^^^^^^^ after this is the code before the merge
|
||||||
|
LL | S::foo();
|
||||||
|
LL | =======
|
||||||
|
| -------
|
||||||
|
LL | S::bar();
|
||||||
|
LL | >>>>>>> branch
|
||||||
|
| ^^^^^^^ above this are the incoming code changes
|
||||||
|
|
|
||||||
|
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
|
||||||
|
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
|
||||||
|
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
12
src/test/ui/parser/diff-markers/struct-expr.rs
Normal file
12
src/test/ui/parser/diff-markers/struct-expr.rs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
struct S {
|
||||||
|
x: u8,
|
||||||
|
}
|
||||||
|
fn main() {
|
||||||
|
let _ = S {
|
||||||
|
<<<<<<< HEAD //~ ERROR encountered diff marker
|
||||||
|
x: 42,
|
||||||
|
=======
|
||||||
|
x: 0,
|
||||||
|
>>>>>>> branch
|
||||||
|
}
|
||||||
|
}
|
18
src/test/ui/parser/diff-markers/struct-expr.stderr
Normal file
18
src/test/ui/parser/diff-markers/struct-expr.stderr
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
error: encountered diff marker
|
||||||
|
--> $DIR/struct-expr.rs:6:1
|
||||||
|
|
|
||||||
|
LL | <<<<<<< HEAD
|
||||||
|
| ^^^^^^^ after this is the code before the merge
|
||||||
|
LL | x: 42,
|
||||||
|
LL | =======
|
||||||
|
| -------
|
||||||
|
LL | x: 0,
|
||||||
|
LL | >>>>>>> branch
|
||||||
|
| ^^^^^^^ above this are the incoming code changes
|
||||||
|
|
|
||||||
|
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
|
||||||
|
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
|
||||||
|
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
7
src/test/ui/parser/diff-markers/struct.rs
Normal file
7
src/test/ui/parser/diff-markers/struct.rs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
struct S {
|
||||||
|
<<<<<<< HEAD //~ ERROR encountered diff marker
|
||||||
|
x: u8,
|
||||||
|
=======
|
||||||
|
x: i8,
|
||||||
|
>>>>>>> branch
|
||||||
|
}
|
18
src/test/ui/parser/diff-markers/struct.stderr
Normal file
18
src/test/ui/parser/diff-markers/struct.stderr
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
error: encountered diff marker
|
||||||
|
--> $DIR/struct.rs:2:1
|
||||||
|
|
|
||||||
|
LL | <<<<<<< HEAD
|
||||||
|
| ^^^^^^^ after this is the code before the merge
|
||||||
|
LL | x: u8,
|
||||||
|
LL | =======
|
||||||
|
| -------
|
||||||
|
LL | x: i8,
|
||||||
|
LL | >>>>>>> branch
|
||||||
|
| ^^^^^^^ above this are the incoming code changes
|
||||||
|
|
|
||||||
|
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
|
||||||
|
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
|
||||||
|
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
14
src/test/ui/parser/diff-markers/trait-item.rs
Normal file
14
src/test/ui/parser/diff-markers/trait-item.rs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
trait T {
|
||||||
|
<<<<<<< HEAD //~ ERROR encountered diff marker
|
||||||
|
fn foo() {}
|
||||||
|
=======
|
||||||
|
fn bar() {}
|
||||||
|
>>>>>>> branch
|
||||||
|
}
|
||||||
|
|
||||||
|
struct S;
|
||||||
|
impl T for S {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
S::foo();
|
||||||
|
}
|
18
src/test/ui/parser/diff-markers/trait-item.stderr
Normal file
18
src/test/ui/parser/diff-markers/trait-item.stderr
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
error: encountered diff marker
|
||||||
|
--> $DIR/trait-item.rs:2:1
|
||||||
|
|
|
||||||
|
LL | <<<<<<< HEAD
|
||||||
|
| ^^^^^^^ after this is the code before the merge
|
||||||
|
LL | fn foo() {}
|
||||||
|
LL | =======
|
||||||
|
| -------
|
||||||
|
LL | fn bar() {}
|
||||||
|
LL | >>>>>>> branch
|
||||||
|
| ^^^^^^^ above this are the incoming code changes
|
||||||
|
|
|
||||||
|
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
|
||||||
|
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
|
||||||
|
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
7
src/test/ui/parser/diff-markers/tuple-struct.rs
Normal file
7
src/test/ui/parser/diff-markers/tuple-struct.rs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
struct S(
|
||||||
|
<<<<<<< HEAD //~ ERROR encountered diff marker
|
||||||
|
u8,
|
||||||
|
=======
|
||||||
|
i8,
|
||||||
|
>>>>>>> branch
|
||||||
|
);
|
18
src/test/ui/parser/diff-markers/tuple-struct.stderr
Normal file
18
src/test/ui/parser/diff-markers/tuple-struct.stderr
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
error: encountered diff marker
|
||||||
|
--> $DIR/tuple-struct.rs:2:1
|
||||||
|
|
|
||||||
|
LL | <<<<<<< HEAD
|
||||||
|
| ^^^^^^^ after this is the code before the merge
|
||||||
|
LL | u8,
|
||||||
|
LL | =======
|
||||||
|
| -------
|
||||||
|
LL | i8,
|
||||||
|
LL | >>>>>>> branch
|
||||||
|
| ^^^^^^^ above this are the incoming code changes
|
||||||
|
|
|
||||||
|
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
|
||||||
|
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
|
||||||
|
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
9
src/test/ui/parser/diff-markers/use-statement.rs
Normal file
9
src/test/ui/parser/diff-markers/use-statement.rs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
use foo::{
|
||||||
|
<<<<<<< HEAD //~ ERROR encountered diff marker
|
||||||
|
bar,
|
||||||
|
=======
|
||||||
|
baz,
|
||||||
|
>>>>>>> branch
|
||||||
|
};
|
||||||
|
|
||||||
|
fn main() {}
|
18
src/test/ui/parser/diff-markers/use-statement.stderr
Normal file
18
src/test/ui/parser/diff-markers/use-statement.stderr
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
error: encountered diff marker
|
||||||
|
--> $DIR/use-statement.rs:2:1
|
||||||
|
|
|
||||||
|
LL | <<<<<<< HEAD
|
||||||
|
| ^^^^^^^ after this is the code before the merge
|
||||||
|
LL | bar,
|
||||||
|
LL | =======
|
||||||
|
| -------
|
||||||
|
LL | baz,
|
||||||
|
LL | >>>>>>> branch
|
||||||
|
| ^^^^^^^ above this are the incoming code changes
|
||||||
|
|
|
||||||
|
= help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code
|
||||||
|
= help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased
|
||||||
|
= note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts>
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
|
@ -41,8 +41,8 @@ ast-stats-1 - Wild 88 ( 1.2%) 1
|
||||||
ast-stats-1 - Ident 440 ( 5.9%) 5
|
ast-stats-1 - Ident 440 ( 5.9%) 5
|
||||||
ast-stats-1 PathSegment 720 ( 9.7%) 30 24
|
ast-stats-1 PathSegment 720 ( 9.7%) 30 24
|
||||||
ast-stats-1 Ty 896 (12.1%) 14 64
|
ast-stats-1 Ty 896 (12.1%) 14 64
|
||||||
ast-stats-1 - Rptr 64 ( 0.9%) 1
|
|
||||||
ast-stats-1 - Ptr 64 ( 0.9%) 1
|
ast-stats-1 - Ptr 64 ( 0.9%) 1
|
||||||
|
ast-stats-1 - Ref 64 ( 0.9%) 1
|
||||||
ast-stats-1 - ImplicitSelf 128 ( 1.7%) 2
|
ast-stats-1 - ImplicitSelf 128 ( 1.7%) 2
|
||||||
ast-stats-1 - Path 640 ( 8.6%) 10
|
ast-stats-1 - Path 640 ( 8.6%) 10
|
||||||
ast-stats-1 Item 1_656 (22.3%) 9 184
|
ast-stats-1 Item 1_656 (22.3%) 9 184
|
||||||
|
@ -100,8 +100,8 @@ ast-stats-2 - Lit 144 ( 1.8%) 2
|
||||||
ast-stats-2 - Block 216 ( 2.7%) 3
|
ast-stats-2 - Block 216 ( 2.7%) 3
|
||||||
ast-stats-2 PathSegment 792 ( 9.8%) 33 24
|
ast-stats-2 PathSegment 792 ( 9.8%) 33 24
|
||||||
ast-stats-2 Ty 896 (11.0%) 14 64
|
ast-stats-2 Ty 896 (11.0%) 14 64
|
||||||
ast-stats-2 - Rptr 64 ( 0.8%) 1
|
|
||||||
ast-stats-2 - Ptr 64 ( 0.8%) 1
|
ast-stats-2 - Ptr 64 ( 0.8%) 1
|
||||||
|
ast-stats-2 - Ref 64 ( 0.8%) 1
|
||||||
ast-stats-2 - ImplicitSelf 128 ( 1.6%) 2
|
ast-stats-2 - ImplicitSelf 128 ( 1.6%) 2
|
||||||
ast-stats-2 - Path 640 ( 7.9%) 10
|
ast-stats-2 - Path 640 ( 7.9%) 10
|
||||||
ast-stats-2 Item 2_024 (25.0%) 11 184
|
ast-stats-2 Item 2_024 (25.0%) 11 184
|
||||||
|
@ -154,7 +154,7 @@ hir-stats GenericParam 400 ( 4.4%) 5 80
|
||||||
hir-stats Generics 560 ( 6.2%) 10 56
|
hir-stats Generics 560 ( 6.2%) 10 56
|
||||||
hir-stats Ty 720 ( 8.0%) 15 48
|
hir-stats Ty 720 ( 8.0%) 15 48
|
||||||
hir-stats - Ptr 48 ( 0.5%) 1
|
hir-stats - Ptr 48 ( 0.5%) 1
|
||||||
hir-stats - Rptr 48 ( 0.5%) 1
|
hir-stats - Ref 48 ( 0.5%) 1
|
||||||
hir-stats - Path 624 ( 6.9%) 13
|
hir-stats - Path 624 ( 6.9%) 13
|
||||||
hir-stats Expr 768 ( 8.5%) 12 64
|
hir-stats Expr 768 ( 8.5%) 12 64
|
||||||
hir-stats - Path 64 ( 0.7%) 1
|
hir-stats - Path 64 ( 0.7%) 1
|
||||||
|
|
7
src/test/ui/unsized-locals/suggest-borrow.rs
Normal file
7
src/test/ui/unsized-locals/suggest-borrow.rs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
fn main() {
|
||||||
|
let x: [u8] = vec!(1, 2, 3)[..]; //~ ERROR E0277
|
||||||
|
let x: &[u8] = vec!(1, 2, 3)[..]; //~ ERROR E0308
|
||||||
|
let x: [u8] = &vec!(1, 2, 3)[..]; //~ ERROR E0308
|
||||||
|
//~^ ERROR E0277
|
||||||
|
let x: &[u8] = &vec!(1, 2, 3)[..];
|
||||||
|
}
|
60
src/test/ui/unsized-locals/suggest-borrow.stderr
Normal file
60
src/test/ui/unsized-locals/suggest-borrow.stderr
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||||
|
--> $DIR/suggest-borrow.rs:2:9
|
||||||
|
|
|
||||||
|
LL | let x: [u8] = vec!(1, 2, 3)[..];
|
||||||
|
| ^ doesn't have a size known at compile-time
|
||||||
|
|
|
||||||
|
= help: the trait `Sized` is not implemented for `[u8]`
|
||||||
|
= note: all local variables must have a statically known size
|
||||||
|
= help: unsized locals are gated as an unstable feature
|
||||||
|
help: consider borrowing here
|
||||||
|
|
|
||||||
|
LL | let x: &[u8] = vec!(1, 2, 3)[..];
|
||||||
|
| +
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/suggest-borrow.rs:3:20
|
||||||
|
|
|
||||||
|
LL | let x: &[u8] = vec!(1, 2, 3)[..];
|
||||||
|
| ----- ^^^^^^^^^^^^^^^^^
|
||||||
|
| | |
|
||||||
|
| | expected `&[u8]`, found slice `[{integer}]`
|
||||||
|
| | help: consider borrowing here: `&vec!(1, 2, 3)[..]`
|
||||||
|
| expected due to this
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/suggest-borrow.rs:4:19
|
||||||
|
|
|
||||||
|
LL | let x: [u8] = &vec!(1, 2, 3)[..];
|
||||||
|
| ---- ^^^^^^^^^^^^^^^^^^ expected slice `[u8]`, found `&[{integer}]`
|
||||||
|
| |
|
||||||
|
| expected due to this
|
||||||
|
|
|
||||||
|
help: consider removing the borrow
|
||||||
|
|
|
||||||
|
LL - let x: [u8] = &vec!(1, 2, 3)[..];
|
||||||
|
LL + let x: [u8] = vec!(1, 2, 3)[..];
|
||||||
|
|
|
||||||
|
help: alternatively, consider changing the type annotation
|
||||||
|
|
|
||||||
|
LL | let x: &[u8] = &vec!(1, 2, 3)[..];
|
||||||
|
| +
|
||||||
|
|
||||||
|
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||||
|
--> $DIR/suggest-borrow.rs:4:9
|
||||||
|
|
|
||||||
|
LL | let x: [u8] = &vec!(1, 2, 3)[..];
|
||||||
|
| ^ doesn't have a size known at compile-time
|
||||||
|
|
|
||||||
|
= help: the trait `Sized` is not implemented for `[u8]`
|
||||||
|
= note: all local variables must have a statically known size
|
||||||
|
= help: unsized locals are gated as an unstable feature
|
||||||
|
help: consider borrowing here
|
||||||
|
|
|
||||||
|
LL | let x: &[u8] = &vec!(1, 2, 3)[..];
|
||||||
|
| +
|
||||||
|
|
||||||
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
Some errors have detailed explanations: E0277, E0308.
|
||||||
|
For more information about an error, try `rustc --explain E0277`.
|
|
@ -27,6 +27,10 @@ LL | let _foo: [u8] = *foo;
|
||||||
= help: the trait `Sized` is not implemented for `[u8]`
|
= help: the trait `Sized` is not implemented for `[u8]`
|
||||||
= note: all local variables must have a statically known size
|
= note: all local variables must have a statically known size
|
||||||
= help: unsized locals are gated as an unstable feature
|
= help: unsized locals are gated as an unstable feature
|
||||||
|
help: consider borrowing here
|
||||||
|
|
|
||||||
|
LL | let _foo: &[u8] = *foo;
|
||||||
|
| +
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,10 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
||||||
LL - fn f1<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized>(x: &X) {
|
LL - fn f1<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized>(x: &X) {
|
||||||
LL + fn f1<W: ?Sized, X: ?Sized, Y, Z: ?Sized>(x: &X) {
|
LL + fn f1<W: ?Sized, X: ?Sized, Y, Z: ?Sized>(x: &X) {
|
||||||
|
|
|
|
||||||
|
help: consider borrowing here
|
||||||
|
|
|
||||||
|
LL | let y: &Y;
|
||||||
|
| +
|
||||||
|
|
||||||
error[E0277]: the size for values of type `X` cannot be known at compilation time
|
error[E0277]: the size for values of type `X` cannot be known at compilation time
|
||||||
--> $DIR/unsized6.rs:7:12
|
--> $DIR/unsized6.rs:7:12
|
||||||
|
@ -62,6 +66,10 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
||||||
LL - fn f2<X: ?Sized, Y: ?Sized>(x: &X) {
|
LL - fn f2<X: ?Sized, Y: ?Sized>(x: &X) {
|
||||||
LL + fn f2<X, Y: ?Sized>(x: &X) {
|
LL + fn f2<X, Y: ?Sized>(x: &X) {
|
||||||
|
|
|
|
||||||
|
help: consider borrowing here
|
||||||
|
|
|
||||||
|
LL | let y: &X;
|
||||||
|
| +
|
||||||
|
|
||||||
error[E0277]: the size for values of type `Y` cannot be known at compilation time
|
error[E0277]: the size for values of type `Y` cannot be known at compilation time
|
||||||
--> $DIR/unsized6.rs:17:12
|
--> $DIR/unsized6.rs:17:12
|
||||||
|
@ -94,6 +102,10 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
||||||
LL - fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
|
LL - fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
|
||||||
LL + fn f3<X>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
|
LL + fn f3<X>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
|
||||||
|
|
|
|
||||||
|
help: consider borrowing here
|
||||||
|
|
|
||||||
|
LL | let y: &X = *x1;
|
||||||
|
| +
|
||||||
|
|
||||||
error[E0277]: the size for values of type `X` cannot be known at compilation time
|
error[E0277]: the size for values of type `X` cannot be known at compilation time
|
||||||
--> $DIR/unsized6.rs:24:9
|
--> $DIR/unsized6.rs:24:9
|
||||||
|
@ -144,6 +156,10 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
||||||
LL - fn f4<X: ?Sized + T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
|
LL - fn f4<X: ?Sized + T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
|
||||||
LL + fn f4<X: T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
|
LL + fn f4<X: T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
|
||||||
|
|
|
|
||||||
|
help: consider borrowing here
|
||||||
|
|
|
||||||
|
LL | let y: &X = *x1;
|
||||||
|
| +
|
||||||
|
|
||||||
error[E0277]: the size for values of type `X` cannot be known at compilation time
|
error[E0277]: the size for values of type `X` cannot be known at compilation time
|
||||||
--> $DIR/unsized6.rs:32:9
|
--> $DIR/unsized6.rs:32:9
|
||||||
|
|
|
@ -969,14 +969,14 @@ fn binding_ty_auto_deref_stability<'tcx>(
|
||||||
precedence: i8,
|
precedence: i8,
|
||||||
binder_args: &'tcx List<BoundVariableKind>,
|
binder_args: &'tcx List<BoundVariableKind>,
|
||||||
) -> Position {
|
) -> Position {
|
||||||
let TyKind::Rptr(_, ty) = &ty.kind else {
|
let TyKind::Ref(_, ty) = &ty.kind else {
|
||||||
return Position::Other(precedence);
|
return Position::Other(precedence);
|
||||||
};
|
};
|
||||||
let mut ty = ty;
|
let mut ty = ty;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
break match ty.ty.kind {
|
break match ty.ty.kind {
|
||||||
TyKind::Rptr(_, ref ref_ty) => {
|
TyKind::Ref(_, ref ref_ty) => {
|
||||||
ty = ref_ty;
|
ty = ref_ty;
|
||||||
continue;
|
continue;
|
||||||
},
|
},
|
||||||
|
|
|
@ -152,7 +152,7 @@ fn captures_all_lifetimes(inputs: &[Ty<'_>], output_lifetimes: &[LifetimeName])
|
||||||
let input_lifetimes: Vec<LifetimeName> = inputs
|
let input_lifetimes: Vec<LifetimeName> = inputs
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|ty| {
|
.filter_map(|ty| {
|
||||||
if let TyKind::Rptr(lt, _) = ty.kind {
|
if let TyKind::Ref(lt, _) = ty.kind {
|
||||||
Some(lt.res)
|
Some(lt.res)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
|
@ -3986,7 +3986,7 @@ impl OutType {
|
||||||
(Self::Unit, &hir::FnRetTy::Return(ty)) if is_unit(ty) => true,
|
(Self::Unit, &hir::FnRetTy::Return(ty)) if is_unit(ty) => true,
|
||||||
(Self::Bool, &hir::FnRetTy::Return(ty)) if is_bool(ty) => true,
|
(Self::Bool, &hir::FnRetTy::Return(ty)) if is_bool(ty) => true,
|
||||||
(Self::Any, &hir::FnRetTy::Return(ty)) if !is_unit(ty) => true,
|
(Self::Any, &hir::FnRetTy::Return(ty)) if !is_unit(ty) => true,
|
||||||
(Self::Ref, &hir::FnRetTy::Return(ty)) => matches!(ty.kind, hir::TyKind::Rptr(_, _)),
|
(Self::Ref, &hir::FnRetTy::Return(ty)) => matches!(ty.kind, hir::TyKind::Ref(_, _)),
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for MutVisitor<'a, 'tcx> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let hir::TyKind::Rptr(
|
if let hir::TyKind::Ref(
|
||||||
_,
|
_,
|
||||||
hir::MutTy {
|
hir::MutTy {
|
||||||
ty: pty,
|
ty: pty,
|
||||||
|
@ -94,7 +94,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for MutVisitor<'a, 'tcx> {
|
||||||
},
|
},
|
||||||
) = ty.kind
|
) = ty.kind
|
||||||
{
|
{
|
||||||
if let hir::TyKind::Rptr(
|
if let hir::TyKind::Ref(
|
||||||
_,
|
_,
|
||||||
hir::MutTy {
|
hir::MutTy {
|
||||||
mutbl: hir::Mutability::Mut,
|
mutbl: hir::Mutability::Mut,
|
||||||
|
|
|
@ -124,7 +124,7 @@ impl EarlyLintPass for NeedlessArbitrarySelfType {
|
||||||
check_param_inner(cx, path, p.span.to(p.ty.span), &Mode::Value, mutbl);
|
check_param_inner(cx, path, p.span.to(p.ty.span), &Mode::Value, mutbl);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
TyKind::Rptr(lifetime, mut_ty) => {
|
TyKind::Ref(lifetime, mut_ty) => {
|
||||||
if_chain! {
|
if_chain! {
|
||||||
if let TyKind::Path(None, path) = &mut_ty.ty.kind;
|
if let TyKind::Path(None, path) = &mut_ty.ty.kind;
|
||||||
if let PatKind::Ident(BindingAnnotation::NONE, _, _) = p.pat.kind;
|
if let PatKind::Ident(BindingAnnotation::NONE, _, _) = p.pat.kind;
|
||||||
|
|
|
@ -184,7 +184,7 @@ impl<'tcx> PassByRefOrValue {
|
||||||
if is_copy(cx, ty)
|
if is_copy(cx, ty)
|
||||||
&& let Some(size) = cx.layout_of(ty).ok().map(|l| l.size.bytes())
|
&& let Some(size) = cx.layout_of(ty).ok().map(|l| l.size.bytes())
|
||||||
&& size <= self.ref_min_size
|
&& size <= self.ref_min_size
|
||||||
&& let hir::TyKind::Rptr(_, MutTy { ty: decl_ty, .. }) = input.kind
|
&& let hir::TyKind::Ref(_, MutTy { ty: decl_ty, .. }) = input.kind
|
||||||
{
|
{
|
||||||
if let Some(typeck) = cx.maybe_typeck_results() {
|
if let Some(typeck) = cx.maybe_typeck_results() {
|
||||||
// Don't lint if an unsafe pointer is created.
|
// Don't lint if an unsafe pointer is created.
|
||||||
|
|
|
@ -421,7 +421,7 @@ fn check_fn_args<'cx, 'tcx: 'cx>(
|
||||||
if let ty::Ref(_, ty, mutability) = *ty.kind();
|
if let ty::Ref(_, ty, mutability) = *ty.kind();
|
||||||
if let ty::Adt(adt, substs) = *ty.kind();
|
if let ty::Adt(adt, substs) = *ty.kind();
|
||||||
|
|
||||||
if let TyKind::Rptr(lt, ref ty) = hir_ty.kind;
|
if let TyKind::Ref(lt, ref ty) = hir_ty.kind;
|
||||||
if let TyKind::Path(QPath::Resolved(None, path)) = ty.ty.kind;
|
if let TyKind::Path(QPath::Resolved(None, path)) = ty.ty.kind;
|
||||||
|
|
||||||
// Check that the name as typed matches the actual name of the type.
|
// Check that the name as typed matches the actual name of the type.
|
||||||
|
@ -503,14 +503,14 @@ fn check_fn_args<'cx, 'tcx: 'cx>(
|
||||||
|
|
||||||
fn check_mut_from_ref<'tcx>(cx: &LateContext<'tcx>, sig: &FnSig<'_>, body: Option<&'tcx Body<'_>>) {
|
fn check_mut_from_ref<'tcx>(cx: &LateContext<'tcx>, sig: &FnSig<'_>, body: Option<&'tcx Body<'_>>) {
|
||||||
if let FnRetTy::Return(ty) = sig.decl.output
|
if let FnRetTy::Return(ty) = sig.decl.output
|
||||||
&& let Some((out, Mutability::Mut, _)) = get_rptr_lm(ty)
|
&& let Some((out, Mutability::Mut, _)) = get_ref_lm(ty)
|
||||||
{
|
{
|
||||||
let out_region = cx.tcx.named_region(out.hir_id);
|
let out_region = cx.tcx.named_region(out.hir_id);
|
||||||
let args: Option<Vec<_>> = sig
|
let args: Option<Vec<_>> = sig
|
||||||
.decl
|
.decl
|
||||||
.inputs
|
.inputs
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(get_rptr_lm)
|
.filter_map(get_ref_lm)
|
||||||
.filter(|&(lt, _, _)| cx.tcx.named_region(lt.hir_id) == out_region)
|
.filter(|&(lt, _, _)| cx.tcx.named_region(lt.hir_id) == out_region)
|
||||||
.map(|(_, mutability, span)| (mutability == Mutability::Not).then_some(span))
|
.map(|(_, mutability, span)| (mutability == Mutability::Not).then_some(span))
|
||||||
.collect();
|
.collect();
|
||||||
|
@ -704,8 +704,8 @@ fn matches_preds<'tcx>(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_rptr_lm<'tcx>(ty: &'tcx hir::Ty<'tcx>) -> Option<(&'tcx Lifetime, Mutability, Span)> {
|
fn get_ref_lm<'tcx>(ty: &'tcx hir::Ty<'tcx>) -> Option<(&'tcx Lifetime, Mutability, Span)> {
|
||||||
if let TyKind::Rptr(lt, ref m) = ty.kind {
|
if let TyKind::Ref(lt, ref m) = ty.kind {
|
||||||
Some((lt, m.mutbl, ty.span))
|
Some((lt, m.mutbl, ty.span))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
|
@ -59,7 +59,7 @@ impl RedundantStaticLifetimes {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// This is what we are looking for !
|
// This is what we are looking for !
|
||||||
TyKind::Rptr(ref optional_lifetime, ref borrow_type) => {
|
TyKind::Ref(ref optional_lifetime, ref borrow_type) => {
|
||||||
// Match the 'static lifetime
|
// Match the 'static lifetime
|
||||||
if let Some(lifetime) = *optional_lifetime {
|
if let Some(lifetime) = *optional_lifetime {
|
||||||
match borrow_type.ty.kind {
|
match borrow_type.ty.kind {
|
||||||
|
|
|
@ -39,7 +39,7 @@ declare_lint_pass!(RefOptionRef => [REF_OPTION_REF]);
|
||||||
impl<'tcx> LateLintPass<'tcx> for RefOptionRef {
|
impl<'tcx> LateLintPass<'tcx> for RefOptionRef {
|
||||||
fn check_ty(&mut self, cx: &LateContext<'tcx>, ty: &'tcx Ty<'tcx>) {
|
fn check_ty(&mut self, cx: &LateContext<'tcx>, ty: &'tcx Ty<'tcx>) {
|
||||||
if_chain! {
|
if_chain! {
|
||||||
if let TyKind::Rptr(_, ref mut_ty) = ty.kind;
|
if let TyKind::Ref(_, ref mut_ty) = ty.kind;
|
||||||
if mut_ty.mutbl == Mutability::Not;
|
if mut_ty.mutbl == Mutability::Not;
|
||||||
if let TyKind::Path(ref qpath) = &mut_ty.ty.kind;
|
if let TyKind::Path(ref qpath) = &mut_ty.ty.kind;
|
||||||
let last = last_path_segment(qpath);
|
let last = last_path_segment(qpath);
|
||||||
|
@ -52,7 +52,7 @@ impl<'tcx> LateLintPass<'tcx> for RefOptionRef {
|
||||||
GenericArg::Type(inner_ty) => Some(inner_ty),
|
GenericArg::Type(inner_ty) => Some(inner_ty),
|
||||||
_ => None,
|
_ => None,
|
||||||
});
|
});
|
||||||
if let TyKind::Rptr(_, ref inner_mut_ty) = inner_ty.kind;
|
if let TyKind::Ref(_, ref inner_mut_ty) = inner_ty.kind;
|
||||||
if inner_mut_ty.mutbl == Mutability::Not;
|
if inner_mut_ty.mutbl == Mutability::Not;
|
||||||
|
|
||||||
then {
|
then {
|
||||||
|
|
|
@ -71,7 +71,7 @@ pub(super) fn check<'tcx>(
|
||||||
/// Gets the type `Bar` in `…::transmute<Foo, &Bar>`.
|
/// Gets the type `Bar` in `…::transmute<Foo, &Bar>`.
|
||||||
fn get_explicit_type<'tcx>(path: &'tcx Path<'tcx>) -> Option<&'tcx hir::Ty<'tcx>> {
|
fn get_explicit_type<'tcx>(path: &'tcx Path<'tcx>) -> Option<&'tcx hir::Ty<'tcx>> {
|
||||||
if let GenericArg::Type(ty) = path.segments.last()?.args?.args.get(1)?
|
if let GenericArg::Type(ty) = path.segments.last()?.args?.args.get(1)?
|
||||||
&& let TyKind::Rptr(_, ty) = &ty.kind
|
&& let TyKind::Ref(_, ty) = &ty.kind
|
||||||
{
|
{
|
||||||
Some(ty.ty)
|
Some(ty.ty)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -539,7 +539,7 @@ impl Types {
|
||||||
QPath::LangItem(..) => {},
|
QPath::LangItem(..) => {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
TyKind::Rptr(lt, ref mut_ty) => {
|
TyKind::Ref(lt, ref mut_ty) => {
|
||||||
context.is_nested_call = true;
|
context.is_nested_call = true;
|
||||||
if !borrowed_box::check(cx, hir_ty, lt, mut_ty) {
|
if !borrowed_box::check(cx, hir_ty, lt, mut_ty) {
|
||||||
self.check_ty(cx, mut_ty.ty, context);
|
self.check_ty(cx, mut_ty.ty, context);
|
||||||
|
|
|
@ -44,7 +44,7 @@ impl<'tcx> Visitor<'tcx> for TypeComplexityVisitor {
|
||||||
fn visit_ty(&mut self, ty: &'tcx hir::Ty<'_>) {
|
fn visit_ty(&mut self, ty: &'tcx hir::Ty<'_>) {
|
||||||
let (add_score, sub_nest) = match ty.kind {
|
let (add_score, sub_nest) = match ty.kind {
|
||||||
// _, &x and *x have only small overhead; don't mess with nesting level
|
// _, &x and *x have only small overhead; don't mess with nesting level
|
||||||
TyKind::Infer | TyKind::Ptr(..) | TyKind::Rptr(..) => (1, 0),
|
TyKind::Infer | TyKind::Ptr(..) | TyKind::Ref(..) => (1, 0),
|
||||||
|
|
||||||
// the "normal" components of a type: named types, arrays/tuples
|
// the "normal" components of a type: named types, arrays/tuples
|
||||||
TyKind::Path(..) | TyKind::Slice(..) | TyKind::Tup(..) | TyKind::Array(..) => (10 * self.nest, 1),
|
TyKind::Path(..) | TyKind::Slice(..) | TyKind::Tup(..) | TyKind::Array(..) => (10 * self.nest, 1),
|
||||||
|
|
|
@ -13,7 +13,7 @@ pub(super) fn match_borrows_parameter(_cx: &LateContext<'_>, qpath: &QPath<'_>)
|
||||||
GenericArg::Type(ty) => Some(ty),
|
GenericArg::Type(ty) => Some(ty),
|
||||||
_ => None,
|
_ => None,
|
||||||
});
|
});
|
||||||
if let TyKind::Rptr(..) = ty.kind;
|
if let TyKind::Ref(..) = ty.kind;
|
||||||
then {
|
then {
|
||||||
return Some(ty.span);
|
return Some(ty.span);
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,7 +257,7 @@ impl<'tcx> LateLintPass<'tcx> for LintWithoutLintPass {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn is_lint_ref_type(cx: &LateContext<'_>, ty: &hir::Ty<'_>) -> bool {
|
pub(super) fn is_lint_ref_type(cx: &LateContext<'_>, ty: &hir::Ty<'_>) -> bool {
|
||||||
if let TyKind::Rptr(
|
if let TyKind::Ref(
|
||||||
_,
|
_,
|
||||||
MutTy {
|
MutTy {
|
||||||
ty: inner,
|
ty: inner,
|
||||||
|
|
|
@ -625,7 +625,7 @@ pub fn eq_ty(l: &Ty, r: &Ty) -> bool {
|
||||||
(Slice(l), Slice(r)) => eq_ty(l, r),
|
(Slice(l), Slice(r)) => eq_ty(l, r),
|
||||||
(Array(le, ls), Array(re, rs)) => eq_ty(le, re) && eq_expr(&ls.value, &rs.value),
|
(Array(le, ls), Array(re, rs)) => eq_ty(le, re) && eq_expr(&ls.value, &rs.value),
|
||||||
(Ptr(l), Ptr(r)) => l.mutbl == r.mutbl && eq_ty(&l.ty, &r.ty),
|
(Ptr(l), Ptr(r)) => l.mutbl == r.mutbl && eq_ty(&l.ty, &r.ty),
|
||||||
(Rptr(ll, l), Rptr(rl, r)) => {
|
(Ref(ll, l), Ref(rl, r)) => {
|
||||||
both(ll, rl, |l, r| eq_id(l.ident, r.ident)) && l.mutbl == r.mutbl && eq_ty(&l.ty, &r.ty)
|
both(ll, rl, |l, r| eq_id(l.ident, r.ident)) && l.mutbl == r.mutbl && eq_ty(&l.ty, &r.ty)
|
||||||
},
|
},
|
||||||
(BareFn(l), BareFn(r)) => {
|
(BareFn(l), BareFn(r)) => {
|
||||||
|
|
|
@ -430,7 +430,7 @@ impl HirEqInterExpr<'_, '_, '_> {
|
||||||
(&TyKind::Slice(l_vec), &TyKind::Slice(r_vec)) => self.eq_ty(l_vec, r_vec),
|
(&TyKind::Slice(l_vec), &TyKind::Slice(r_vec)) => self.eq_ty(l_vec, r_vec),
|
||||||
(&TyKind::Array(lt, ll), &TyKind::Array(rt, rl)) => self.eq_ty(lt, rt) && self.eq_array_length(ll, rl),
|
(&TyKind::Array(lt, ll), &TyKind::Array(rt, rl)) => self.eq_ty(lt, rt) && self.eq_array_length(ll, rl),
|
||||||
(TyKind::Ptr(l_mut), TyKind::Ptr(r_mut)) => l_mut.mutbl == r_mut.mutbl && self.eq_ty(l_mut.ty, r_mut.ty),
|
(TyKind::Ptr(l_mut), TyKind::Ptr(r_mut)) => l_mut.mutbl == r_mut.mutbl && self.eq_ty(l_mut.ty, r_mut.ty),
|
||||||
(TyKind::Rptr(_, l_rmut), TyKind::Rptr(_, r_rmut)) => {
|
(TyKind::Ref(_, l_rmut), TyKind::Ref(_, r_rmut)) => {
|
||||||
l_rmut.mutbl == r_rmut.mutbl && self.eq_ty(l_rmut.ty, r_rmut.ty)
|
l_rmut.mutbl == r_rmut.mutbl && self.eq_ty(l_rmut.ty, r_rmut.ty)
|
||||||
},
|
},
|
||||||
(TyKind::Path(l), TyKind::Path(r)) => self.eq_qpath(l, r),
|
(TyKind::Path(l), TyKind::Path(r)) => self.eq_qpath(l, r),
|
||||||
|
@ -950,7 +950,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
|
||||||
self.hash_ty(mut_ty.ty);
|
self.hash_ty(mut_ty.ty);
|
||||||
mut_ty.mutbl.hash(&mut self.s);
|
mut_ty.mutbl.hash(&mut self.s);
|
||||||
},
|
},
|
||||||
TyKind::Rptr(lifetime, ref mut_ty) => {
|
TyKind::Ref(lifetime, ref mut_ty) => {
|
||||||
self.hash_lifetime(lifetime);
|
self.hash_lifetime(lifetime);
|
||||||
self.hash_ty(mut_ty.ty);
|
self.hash_ty(mut_ty.ty);
|
||||||
mut_ty.mutbl.hash(&mut self.s);
|
mut_ty.mutbl.hash(&mut self.s);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue