Skip to content

Commit cb42008

Browse files
committed
Add test for #10021
1 parent d822110 commit cb42008

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

tests/ui/unnecessary_to_owned.fixed

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,3 +454,23 @@ mod issue_9771b {
454454
Key(v.to_vec())
455455
}
456456
}
457+
458+
// This is a watered down version of the code in: https://github.com/oxigraph/rio
459+
// The ICE is triggered by the call to `to_owned` on this line:
460+
// https://github.com/oxigraph/rio/blob/66635b9ff8e5423e58932353fa40d6e64e4820f7/testsuite/src/parser_evaluator.rs#L116
461+
mod issue_10021 {
462+
#![allow(unused)]
463+
464+
pub struct Iri<T>(T);
465+
466+
impl<T: AsRef<str>> Iri<T> {
467+
pub fn parse(iri: T) -> Result<Self, ()> {
468+
unimplemented!()
469+
}
470+
}
471+
472+
pub fn parse_w3c_rdf_test_file(url: &str) -> Result<(), ()> {
473+
let base_iri = Iri::parse(url.to_owned())?;
474+
Ok(())
475+
}
476+
}

tests/ui/unnecessary_to_owned.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,3 +454,23 @@ mod issue_9771b {
454454
Key(v.to_vec())
455455
}
456456
}
457+
458+
// This is a watered down version of the code in: https://github.com/oxigraph/rio
459+
// The ICE is triggered by the call to `to_owned` on this line:
460+
// https://github.com/oxigraph/rio/blob/66635b9ff8e5423e58932353fa40d6e64e4820f7/testsuite/src/parser_evaluator.rs#L116
461+
mod issue_10021 {
462+
#![allow(unused)]
463+
464+
pub struct Iri<T>(T);
465+
466+
impl<T: AsRef<str>> Iri<T> {
467+
pub fn parse(iri: T) -> Result<Self, ()> {
468+
unimplemented!()
469+
}
470+
}
471+
472+
pub fn parse_w3c_rdf_test_file(url: &str) -> Result<(), ()> {
473+
let base_iri = Iri::parse(url.to_owned())?;
474+
Ok(())
475+
}
476+
}

0 commit comments

Comments
 (0)