forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#130673 - GrigorenkoPV:path-triple-colon, r=compiler-errors Parser: recover from `:::` to `::` Closes rust-lang#130613
- Loading branch information
Showing
11 changed files
with
366 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//@ run-rustfix | ||
|
||
#![feature(fn_delegation)] | ||
#![allow(incomplete_features, unused)] | ||
|
||
trait Trait { | ||
fn foo(&self) {} | ||
} | ||
|
||
struct F; | ||
impl Trait for F {} | ||
|
||
pub mod to_reuse { | ||
pub fn bar() {} | ||
} | ||
|
||
mod fn_to_other { | ||
use super::*; | ||
|
||
reuse Trait::foo; //~ ERROR path separator must be a double colon | ||
reuse to_reuse::bar; //~ ERROR path separator must be a double colon | ||
} | ||
|
||
impl Trait for u8 {} | ||
|
||
struct S(u8); | ||
|
||
mod to_import { | ||
pub fn check(arg: &u8) -> &u8 { arg } | ||
} | ||
|
||
impl Trait for S { | ||
reuse Trait::* { //~ ERROR path separator must be a double colon | ||
use to_import::check; | ||
|
||
let _arr = Some(self.0).map(|x| [x * 2; 3]); | ||
check(&self.0) | ||
} | ||
} | ||
|
||
fn main() { | ||
let s = S(0); | ||
s.foo(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//@ run-rustfix | ||
|
||
#![feature(fn_delegation)] | ||
#![allow(incomplete_features, unused)] | ||
|
||
trait Trait { | ||
fn foo(&self) {} | ||
} | ||
|
||
struct F; | ||
impl Trait for F {} | ||
|
||
pub mod to_reuse { | ||
pub fn bar() {} | ||
} | ||
|
||
mod fn_to_other { | ||
use super::*; | ||
|
||
reuse Trait:::foo; //~ ERROR path separator must be a double colon | ||
reuse to_reuse:::bar; //~ ERROR path separator must be a double colon | ||
} | ||
|
||
impl Trait for u8 {} | ||
|
||
struct S(u8); | ||
|
||
mod to_import { | ||
pub fn check(arg: &u8) -> &u8 { arg } | ||
} | ||
|
||
impl Trait for S { | ||
reuse Trait:::* { //~ ERROR path separator must be a double colon | ||
use to_import::check; | ||
|
||
let _arr = Some(self.0).map(|x| [x * 2; 3]); | ||
check(&self.0) | ||
} | ||
} | ||
|
||
fn main() { | ||
let s = S(0); | ||
s.foo(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
error: path separator must be a double colon | ||
--> $DIR/triple-colon-delegation.rs:20:18 | ||
| | ||
LL | reuse Trait:::foo; | ||
| ^ | ||
| | ||
help: use a double colon instead | ||
| | ||
LL - reuse Trait:::foo; | ||
LL + reuse Trait::foo; | ||
| | ||
|
||
error: path separator must be a double colon | ||
--> $DIR/triple-colon-delegation.rs:21:21 | ||
| | ||
LL | reuse to_reuse:::bar; | ||
| ^ | ||
| | ||
help: use a double colon instead | ||
| | ||
LL - reuse to_reuse:::bar; | ||
LL + reuse to_reuse::bar; | ||
| | ||
|
||
error: path separator must be a double colon | ||
--> $DIR/triple-colon-delegation.rs:33:18 | ||
| | ||
LL | reuse Trait:::* { | ||
| ^ | ||
| | ||
help: use a double colon instead | ||
| | ||
LL - reuse Trait:::* { | ||
LL + reuse Trait::* { | ||
| | ||
|
||
error: aborting due to 3 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//@ run-rustfix | ||
|
||
#![allow(unused)] | ||
|
||
use ::std::{cell as _}; //~ ERROR path separator must be a double colon | ||
use std::cell::*; //~ ERROR path separator must be a double colon | ||
use std::cell::Cell; //~ ERROR path separator must be a double colon | ||
use std::{cell as _}; //~ ERROR path separator must be a double colon | ||
|
||
mod foo{ | ||
use ::{}; //~ ERROR path separator must be a double colon | ||
use ::*; //~ ERROR path separator must be a double colon | ||
} | ||
|
||
fn main() { | ||
let c: ::std::cell::Cell::<u8> = Cell::<u8>::new(0); | ||
//~^ ERROR path separator must be a double colon | ||
//~| ERROR path separator must be a double colon | ||
//~| ERROR path separator must be a double colon | ||
//~| ERROR path separator must be a double colon | ||
//~| ERROR path separator must be a double colon | ||
//~| ERROR path separator must be a double colon | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//@ run-rustfix | ||
|
||
#![allow(unused)] | ||
|
||
use :::std::{cell as _}; //~ ERROR path separator must be a double colon | ||
use std::cell:::*; //~ ERROR path separator must be a double colon | ||
use std::cell:::Cell; //~ ERROR path separator must be a double colon | ||
use std:::{cell as _}; //~ ERROR path separator must be a double colon | ||
|
||
mod foo{ | ||
use :::{}; //~ ERROR path separator must be a double colon | ||
use :::*; //~ ERROR path separator must be a double colon | ||
} | ||
|
||
fn main() { | ||
let c: :::std:::cell:::Cell:::<u8> = Cell:::<u8>:::new(0); | ||
//~^ ERROR path separator must be a double colon | ||
//~| ERROR path separator must be a double colon | ||
//~| ERROR path separator must be a double colon | ||
//~| ERROR path separator must be a double colon | ||
//~| ERROR path separator must be a double colon | ||
//~| ERROR path separator must be a double colon | ||
} |
Oops, something went wrong.