mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-01 17:42:47 +00:00
Fix over-optimistic resolution of self-methods within obj scopes. There is no such feature in the language at present. Add test to prevent regression. Closes #114.
This commit is contained in:
parent
bacb8e6b79
commit
f1db420317
@ -1758,11 +1758,7 @@ and lookup_by_ident
|
||||
check_slots scopes f.Ast.fn_input_slots
|
||||
|
||||
| Ast.MOD_ITEM_obj obj ->
|
||||
begin
|
||||
match htab_search obj.Ast.obj_fns ident with
|
||||
Some fn -> found cx scopes fn.id
|
||||
| None -> check_slots scopes obj.Ast.obj_state
|
||||
end
|
||||
check_slots scopes obj.Ast.obj_state
|
||||
|
||||
| Ast.MOD_ITEM_mod md ->
|
||||
project_ident_from_items cx lchk
|
||||
|
11
src/test/compile-fail/no-self-dispatch.rs
Normal file
11
src/test/compile-fail/no-self-dispatch.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// error-pattern: unresolved identifier
|
||||
obj oT() {
|
||||
fn get() -> int {
|
||||
ret 3;
|
||||
}
|
||||
fn foo() {
|
||||
auto c = get();
|
||||
}
|
||||
}
|
||||
fn main() {
|
||||
}
|
Loading…
Reference in New Issue
Block a user