forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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#67880 - lbonn:fix/multi-substs, r=petrochenkov
Handle multiple error fix suggestions carefuly The existing code seems to assume that substitutions spans are disjoint, which is not always the case. In the example: pub trait AAAA {} pub trait B {} pub trait C {} pub type T<P: AAAA + B + C> = P; , we get three substituions starting from ':' and ending respectively at the end of each trait token. With the former offset calculation, this would cause `underline_start` to eventually become negative before being converted to `usize`... The new version may report erroneous results for non perfectly overlapping substitutions but I don't know if such examples exist. Alternatively, we could detect these cases and trim out overlapping substitutions. Fixes rust-lang#67690
- Loading branch information
Showing
5 changed files
with
37 additions
and
9 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
8 changes: 8 additions & 0 deletions
8
src/test/ui/type/issue-67690-type-alias-bound-diagnostic-crash.rs
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,8 @@ | ||
// Regression test for issue #67690 | ||
// Rustc endless loop out-of-memory and consequent SIGKILL in generic new type | ||
|
||
// check-pass | ||
pub type T<P: Send + Send + Send> = P; | ||
//~^ WARN bounds on generic parameters are not enforced in type aliases | ||
|
||
fn main() {} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr
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,12 @@ | ||
warning: bounds on generic parameters are not enforced in type aliases | ||
--> $DIR/issue-67690-type-alias-bound-diagnostic-crash.rs:5:15 | ||
| | ||
LL | pub type T<P: Send + Send + Send> = P; | ||
| ^^^^ ^^^^ ^^^^ | ||
| | ||
= note: `#[warn(type_alias_bounds)]` on by default | ||
help: the bound will not be checked when the type alias is used, and should be removed | ||
| | ||
LL | pub type T<P> = P; | ||
| -- | ||
|
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