Skip to content

Commit 7648776

Browse files
committed
Auto merge of #26225 - arielb1:raw-self, r=eddyb
This can't be made to work with the current setup. Technically a [breaking-change], but a simple bug fix. Fixes #26194.
2 parents 400e955 + 3be18f0 commit 7648776

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/librustc_typeck/collect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,7 +2174,7 @@ fn check_method_self_type<'a, 'tcx, RS:RegionScope>(
21742174
if let ast::SelfExplicit(ref ast_type, _) = explicit_self.node {
21752175
let typ = ccx.icx(&method_type.predicates).to_ty(rs, &**ast_type);
21762176
let base_type = match typ.sty {
2177-
ty::ty_ptr(tm) | ty::ty_rptr(_, tm) => tm.ty,
2177+
ty::ty_rptr(_, tm) => tm.ty,
21782178
ty::ty_uniq(typ) => typ,
21792179
_ => typ,
21802180
};
@@ -2220,7 +2220,7 @@ fn check_method_self_type<'a, 'tcx, RS:RegionScope>(
22202220
ppaux::ty_to_string(tcx, required_type))
22212221
}));
22222222

2223-
// We could conceviably add more free-reion relations here,
2223+
// We could conceviably add more free-region relations here,
22242224
// but since this code is just concerned with checking that
22252225
// the `&Self` types etc match up, it's not really necessary.
22262226
// It would just allow people to be more approximate in some

src/test/compile-fail/issue-26194.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
struct S(String);
12+
13+
impl S {
14+
fn f(self: *mut S) -> String { self.0 }
15+
//~^ ERROR mismatched self type
16+
}
17+
18+
fn main() { S("".to_owned()).f(); }

0 commit comments

Comments
 (0)