File tree 2 files changed +24
-2
lines changed
2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -754,7 +754,7 @@ impl<'a> LexicalScopeBinding<'a> {
754
754
}
755
755
}
756
756
757
- #[ derive( Copy , Clone ) ]
757
+ #[ derive( Copy , Clone , PartialEq ) ]
758
758
enum PathScope {
759
759
Global ,
760
760
Lexical ,
@@ -2292,7 +2292,9 @@ impl<'a> Resolver<'a> {
2292
2292
//
2293
2293
// Such behavior is required for backward compatibility.
2294
2294
// The same fallback is used when `a` resolves to nothing.
2295
- _ if self . primitive_type_table . primitive_types . contains_key ( & path[ 0 ] . name ) => {
2295
+ PathResult :: Module ( ..) | PathResult :: Failed ( ..)
2296
+ if scope == PathScope :: Lexical && ( ns == TypeNS || path. len ( ) > 1 ) &&
2297
+ self . primitive_type_table . primitive_types . contains_key ( & path[ 0 ] . name ) => {
2296
2298
PathResolution {
2297
2299
base_def : Def :: PrimTy ( self . primitive_type_table . primitive_types [ & path[ 0 ] . name ] ) ,
2298
2300
depth : segments. len ( ) - 1 ,
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 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
+ fn main ( ) {
12
+ // Make sure primitive type fallback doesn't work in value namespace
13
+ std:: mem:: size_of ( u16) ;
14
+ //~^ ERROR unresolved name `u16`
15
+ //~| ERROR this function takes 0 parameters but 1 parameter was supplied
16
+
17
+ // Make sure primitive type fallback doesn't work with global paths
18
+ let _: :: u8 ;
19
+ //~^ ERROR type name `u8` is undefined or not in scope
20
+ }
You can’t perform that action at this time.
0 commit comments