Fix up partial res of segment in primitive resolution hack
This commit is contained in:
parent
2196affd01
commit
18c787f48f
4 changed files with 31 additions and 0 deletions
|
@ -4598,6 +4598,11 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Fix up partial res of segment from `resolve_path` call.
|
||||||
|
if let Some(id) = path[0].id {
|
||||||
|
self.r.partial_res_map.insert(id, PartialRes::new(Res::PrimTy(prim)));
|
||||||
|
}
|
||||||
|
|
||||||
PartialRes::with_unresolved_segments(Res::PrimTy(prim), path.len() - 1)
|
PartialRes::with_unresolved_segments(Res::PrimTy(prim), path.len() - 1)
|
||||||
}
|
}
|
||||||
PathResult::Module(ModuleOrUniformRoot::Module(module)) => {
|
PathResult::Module(ModuleOrUniformRoot::Module(module)) => {
|
||||||
|
|
1
tests/ui/resolve/auxiliary/empty.rs
Normal file
1
tests/ui/resolve/auxiliary/empty.rs
Normal file
|
@ -0,0 +1 @@
|
||||||
|
// Intentionally empty.
|
8
tests/ui/resolve/prim-crate-partial-res.rs
Normal file
8
tests/ui/resolve/prim-crate-partial-res.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
//@ aux-build: empty.rs
|
||||||
|
|
||||||
|
extern crate empty as usize;
|
||||||
|
|
||||||
|
fn foo() -> usize<()> { 0 }
|
||||||
|
//~^ ERROR type arguments are not allowed on builtin type `usize`
|
||||||
|
|
||||||
|
fn main() {}
|
17
tests/ui/resolve/prim-crate-partial-res.stderr
Normal file
17
tests/ui/resolve/prim-crate-partial-res.stderr
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
error[E0109]: type arguments are not allowed on builtin type `usize`
|
||||||
|
--> $DIR/prim-crate-partial-res.rs:5:19
|
||||||
|
|
|
||||||
|
LL | fn foo() -> usize<()> { 0 }
|
||||||
|
| ----- ^^ type argument not allowed
|
||||||
|
| |
|
||||||
|
| not allowed on builtin type `usize`
|
||||||
|
|
|
||||||
|
help: primitive type `usize` doesn't have generic parameters
|
||||||
|
|
|
||||||
|
LL - fn foo() -> usize<()> { 0 }
|
||||||
|
LL + fn foo() -> usize { 0 }
|
||||||
|
|
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0109`.
|
Loading…
Add table
Add a link
Reference in a new issue