File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -3324,6 +3324,24 @@ impl<'a> Resolver<'a> {
33243324 Some ( LexicalScopeBinding :: Item ( binding) ) => Ok ( binding) ,
33253325 Some ( LexicalScopeBinding :: Def ( def) )
33263326 if opt_ns == Some ( TypeNS ) || opt_ns == Some ( ValueNS ) => {
3327+
3328+ if let Some ( id) = node_id {
3329+ if i == 1 && self . session . features_untracked ( ) . crate_in_paths
3330+ && !self . session . rust_2018 ( ) {
3331+ let prev_name = path[ 0 ] . name ;
3332+ if prev_name == keywords:: Extern . name ( ) ||
3333+ prev_name == keywords:: CrateRoot . name ( ) {
3334+ let diag = lint:: builtin:: BuiltinLintDiagnostics
3335+ :: AbsPathWithModule ( path_span) ;
3336+ self . session . buffer_lint_with_diagnostic (
3337+ lint:: builtin:: ABSOLUTE_PATH_STARTING_WITH_MODULE ,
3338+ id, path_span,
3339+ "Absolute paths must start with `self`, `super`, \
3340+ `crate`, or an external crate name in the 2018 edition",
3341+ diag) ;
3342+ }
3343+ }
3344+ }
33273345 return PathResult :: NonModule ( PathResolution :: with_unresolved_segments (
33283346 def, path. len ( ) - 1
33293347 ) ) ;
You can’t perform that action at this time.
0 commit comments