Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e813132
--wip-- [skip ci]
spanishpear Oct 23, 2022
5287004
Apply automatic suggestions from code review
spanishpear Dec 1, 2022
655beb4
Attempt to address review comments via github web...
spanishpear Dec 1, 2022
4447949
revert to previous span
spanishpear Jan 22, 2023
8292d07
move tests to new rust-lang location
spanishpear Jan 22, 2023
70bfcc2
move to multipart spans
spanishpear Jan 31, 2023
a3d32bb
fix formatting + test syntax
spanishpear Feb 1, 2023
44a2388
Make Ok value of repeat_while_none more general
spastorino Jan 31, 2023
873c83b
Extract try_move_finished_goal_to_global_cache from try_finalize_goal
spastorino Feb 13, 2023
826bee7
Implement repeat_while_none for both SearchGraph and EvalCtxt
spastorino Feb 6, 2023
ef6a59b
"Basic usage" is redundant for there is just one example
tshepang Feb 13, 2023
3180f1c
Fix #107998, avoid ICE when the generic_span is empty
chenyukang Feb 13, 2023
826abcc
Shrink size of array benchmarks
JulianKnodt Feb 14, 2023
2a5a1a8
add message to update Cargo.toml when x is changed
zephaniahong Feb 14, 2023
ba4b026
rustdoc: add more tooltips to intra-doc links
notriddle Feb 14, 2023
70fd729
change file path and improve message
zephaniahong Feb 14, 2023
936bf29
s/eval_usize/eval_target_usize/ for clarity
oli-obk Feb 14, 2023
0e185c2
Avoid using a dead email address as the main email address
oli-obk Feb 14, 2023
9e2947a
Ord entails its supertraits
eggyal Feb 14, 2023
c8dae10
Check for overflow in evaluate_canonical_goal
spastorino Feb 6, 2023
26136c6
Reduce visibility of some items
spastorino Feb 14, 2023
202c706
Rollup merge of #103478 - SpanishPear:spanishpear/issue_103366_fix, r…
matthiaskrgr Feb 14, 2023
9ee3c7a
Rollup merge of #107739 - spastorino:check-overflow-evaluate_canonica…
matthiaskrgr Feb 14, 2023
1f486f0
Rollup merge of #108003 - chenyukang:yukang/fix-107998, r=compiler-er…
matthiaskrgr Feb 14, 2023
3eb5731
Rollup merge of #108016 - tshepang:just-one-example, r=thomcc
matthiaskrgr Feb 14, 2023
d599be0
Rollup merge of #108023 - JulianKnodt:smaller_benchmark, r=workingjub…
matthiaskrgr Feb 14, 2023
43b42c5
Rollup merge of #108024 - zephaniahong:master, r=jyn514
matthiaskrgr Feb 14, 2023
8804e7f
Rollup merge of #108025 - notriddle:notriddle/intra-doc-link-tooltips…
matthiaskrgr Feb 14, 2023
f68864c
Rollup merge of #108029 - oli-obk:🞋_usize, r=RalfJung
matthiaskrgr Feb 14, 2023
7a9e6e8
Rollup merge of #108035 - oli-obk:oli_new_contributor_funkiness, r=Ma…
matthiaskrgr Feb 14, 2023
ea679fb
Rollup merge of #108038 - eggyal:remove_needless_supertrait_constrain…
matthiaskrgr Feb 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix #107998, avoid ICE when the generic_span is empty
  • Loading branch information
chenyukang committed Feb 14, 2023
commit 3180f1c828636a247777d277f10c9695d7141d20
10 changes: 9 additions & 1 deletion compiler/rustc_lint/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -837,9 +837,17 @@ pub trait LintContext: Sized {
(use_span, "'_".to_owned())
};
debug!(?deletion_span, ?use_span);

// issue 107998 for the case such as a wrong function pointer type
// `deletion_span` is empty and there is no need to report lifetime uses here
let suggestions = if deletion_span.is_empty() {
vec![(use_span, replace_lt)]
} else {
vec![(deletion_span, String::new()), (use_span, replace_lt)]
};
db.multipart_suggestion(
msg,
vec![(deletion_span, String::new()), (use_span, replace_lt)],
suggestions,
Applicability::MachineApplicable,
);
}
Expand Down
9 changes: 9 additions & 0 deletions tests/ui/single-use-lifetime/issue-107998.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#![deny(single_use_lifetimes)]

fn with<R>(f: &fn<'a>(x: &'a i32) -> R) -> R {
//~^ ERROR function pointer types may not have generic parameters
//~| ERROR lifetime parameter `'a` only used once
f(&3)
}

fn main() {}
30 changes: 30 additions & 0 deletions tests/ui/single-use-lifetime/issue-107998.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
error: function pointer types may not have generic parameters
--> $DIR/issue-107998.rs:3:18
|
LL | fn with<R>(f: &fn<'a>(x: &'a i32) -> R) -> R {
| ^^^^
|
help: consider moving the lifetime parameter to a `for` parameter list
|
LL - fn with<R>(f: &fn<'a>(x: &'a i32) -> R) -> R {
LL + fn with<R>(f: &for<'a> fn(x: &'a i32) -> R) -> R {
|

error: lifetime parameter `'a` only used once
--> $DIR/issue-107998.rs:3:19
|
LL | fn with<R>(f: &fn<'a>(x: &'a i32) -> R) -> R {
| ^^ ---
| | |
| | ...is used only here
| | help: elide the single-use lifetime
| this lifetime...
|
note: the lint level is defined here
--> $DIR/issue-107998.rs:1:9
|
LL | #![deny(single_use_lifetimes)]
| ^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors