Unnamed: 0 int64 0 25 | Prompt stringlengths 28 427 | Response stringlengths 150 1.22k |
|---|---|---|
0 | fn main() {
let x = String::from("hello");
f(&x);
println!("{}", x);
}
fn f(s : &String) {
println!("{}", *s);
} | /* --- BEGIN Variable Definitions ---
Owner x;
StaticRef s;
Function String::from();
Function f();
Function println!()
--- END Variable Definitions --- */
fn main() {
let x = String::from("hello"); // !{ Move(String::from()->x) }
f(&x); // !{ PassByStaticReference(x->f()) }
println!("{}", x); // !{ PassByS... |
1 | fn main() {
let s = String::from("hello");
let len1 = String::len(&s);
let len2 = s.len(); // shorthand for the above
println!("len1 = {} = len2 = {}", len1, len2);
} | /* --- BEGIN Variable Definitions ---
Owner s;
Owner len1;
Owner len2;
Function String::from();
Function String::len();
Function len();
Function println!()
--- END Variable Definitions --- */
fn main() {
let s = String::from("hello"); // !{ Move(String::from()->s) }
let len1 = String::len(&s); // !{ PassByStat... |
2 | fn main() {
let s = String::from("hello");
takes_ownership(s);
let mut x = 5;
let y = x;
x = 6;
}
fn takes_ownership(some_string: String) {
println!("{}", some_string);
} | /* --- BEGIN Variable Definitions ---
Owner s; Owner mut x; Owner y; Owner some_string;
Function String::from();
Function takes_ownership();
Function println!()
--- END Variable Definitions --- */
fn main() {
let s = String::from("hello"); // !{ Move(String::from()->s) }
takes_ownership(s); // !{ Move(s->takes... |
3 | fn main() {
let s = String::from("hello");
takes_ownership(s);
let mut x = 5;
let y = x;
x = 6;
}
fn takes_ownership(some_string: String) {
println!("{}", some_string);
} | /* --- BEGIN Variable Definitions ---
Owner s; Owner mut x; Owner y; Owner some_string;
Function String::from();
Function takes_ownership();
Function println!()
--- END Variable Definitions --- */
fn main() {
let s = String::from("hello"); // !{ Move(String::from()->s) }
takes_ownership(s); // !{ Move(s->takes... |
4 | fn main() {
let x = String::from("hello");
let z = {
let y = x;
println("{}", y);
// ...
};
println!("Hello, world!");
} | /* --- BEGIN Variable Definitions ---
Owner x;
Owner y;
Owner z;
Function String::from();
Function println!()
--- END Variable Definitions --- */
fn main() {
let x = String::from("hello"); // !{ Move(String::from()->x) }
let z = {
let y = x; // !{ Move(x->y) }
println("{}", y); // !{ PassByStati... |
5 | fn main() {
let x = String::from("hello");
let y = x;
println!("{}", y);
} | /* --- BEGIN Variable Definitions ---
Owner x;
Owner y;
Function String::from();
Function println!()
--- END Variable Definitions --- */
fn main() {
let x = String::from("hello"); // !{ Move(String::from()->x) }
let y = x; // !{ Move(x->y) }
println!("{}", y); // !{ PassByStaticReference(y->println!()) }
}... |
6 | fn main() {
let x = 1;
let y = 2;
println!("x = {} and y = {}", x, y);
} | /* --- BEGIN Variable Definitions ---
Owner x; Owner y; Function println!()
--- END Variable Definitions --- */
fn main() {
let x = 1; // !{ Bind(x) }
let y = 2; // !{ Bind(y) }
println!("x = {} and y = {}", x, y); // !{ PassByStaticReference(x->println!()), PassByStaticReference(y->println!()) }
} // !{ Go... |
7 | fn take_and_return_ownership(some_string : String) -> String {
println!("{}", some_string);
some_string
}
fn main() {
let mut s = String::from("hello");
s = take_and_return_ownership(s);
println!("{}", s); // OK
} | /* --- BEGIN Variable Definitions ---
Owner mut s;
Owner some_string;
Function String::from();
Function take_and_return_ownership();
Function println!()
--- END Variable Definitions --- */
fn take_and_return_ownership(some_string : String) -> String { // !{ InitOwnerParam(some_string) }
println!("{}", some_string);... |
8 | fn main() {
let six = plus_one(5);
}
fn plus_one(x: i32) -> i32 {
x + 1
} | /* --- BEGIN Variable Definitions ---
Owner six;
Owner x;
Function plus_one()
--- END Variable Definitions --- */
fn main() {
let six = plus_one(5); // !{ Copy(None->plus_one()), Copy(plus_one()->six) }
} // !{ GoOutOfScope(six) }
fn plus_one(x: i32) -> i32 { // !{ InitOwnerParam(x) }
x + 1 // !{ Copy(x->None)... |
9 | struct Excerpt<'a> {
p: &'a str,
}
fn some_function() {
let n = String::from("Ok. I'm fine.");
let first = n.split('.').next().expect("Could not find a '.'");
let i = Excerpt {
p: first,
};
println!("{}", first);
// 'i' cannot be returned be returned
// because the struct outliv... | /* --- BEGIN Variable Definitions ---
Struct i{p};
StaticRef first;
StaticRef n;
Function String::from();
Function println!()
--- END Variable Definitions --- */
struct Excerpt<'a> {
p: &'a str,
}
fn some_function() {
let n = String::from("Ok. I'm fine."); // !{ Move(String::from()->n) }
let first = n.spli... |
10 | fn f() {
let x = String::from("hello");
// ...
x
}
fn main() {
let s = f();
println!("{}", s);
} | /* --- BEGIN Variable Definitions ---
Owner x;
Owner s;
Function String::from();
Function f();
Function println!()
--- END Variable Definitions --- */
fn f() {
let x = String::from("hello"); // !{ Move(String::from()->x) }
// ...
x // !{ Move(x->None) }
} // !{ GoOutOfScope(x) }
fn main() {
let s = ... |
11 | struct Rectangle {
width: u32,
height: u32,
}
impl Rectangle {
fn area(&self) -> u32 {
self.width * self.height
}
}
fn print_area(rect: &Rectangle) {
println!(
"The area of the rectangle is {} square pixels.",
rect.area() // dot even though it's actually a reference
);
... | /* --- BEGIN Variable Definitions ---
Struct r{width, height};
StaticRef rect;
StaticRef self;
Function area();
Function print_area();
--- END Variable Definitions --- */
struct Rectangle {
width: u32,
height: u32,
}
impl Rectangle {
fn area(&self) -> u32 { // !{ InitRefParam(self) }
self.width * s... |
12 | fn main() {
let mut s1 = String::from("Hello");
let s2 = String::from(", world");
String::push_str(&mut s1, &s2);
s1.push_str(&s2); // shorthand for the above
println!("{}", s1); // prints "Hello, world, world"
} | /* --- BEGIN Variable Definitions ---
Owner mut s1;
Owner s2;
Function String::from();
Function String::push_str();
Function push_str();
Function println!()
--- END Variable Definitions --- */
fn main() {
let mut s1 = String::from("Hello"); // !{ Move(String::from()->s1) }
let s2 = String::from(", world"); // ... |
13 | fn main() {
let mut x = String::from("Hello");
world(&mut x);
println!("{}", x);
}
fn world(s : &mut String) {
s.push_str(", world");
} | /* --- BEGIN Variable Definitions ---
Owner mut x;
MutRef s;
Function String::from();
Function world();
Function println!();
Function push_str()
--- END Variable Definitions --- */
fn main() {
let mut x = String::from("Hello"); // !{ Move(String::from()->x) }
world(&mut x); // !{ PassByMutableReference(x->world... |
14 | fn main(){
let mut s = String::from("hello");
let r1 = &s;
let r2 = &s;
assert!(compare_strings(r1, r2));
let r3 = &mut s;
clear_string(r3);
} | /* --- BEGIN Variable Definitions ---
Owner mut s; StaticRef r1; StaticRef r2; MutRef r3;
Function String::from();
Function compare_strings();
Function clear_string()
--- END Variable Definitions --- */
fn main(){
let mut s = String::from("hello"); // !{ Move(String::from()->s) }
let r1 = &s; // !{ StaticBorro... |
15 | fn main() {
let x = 5;
let y = x;
} | /* --- BEGIN Variable Definitions ---
Owner x; Owner y
--- END Variable Definitions --- */
fn main() {
let x = 5; // !{ Bind(x) }
let y = x; // !{ Copy(x->y) }
} /* !{
GoOutOfScope(x),
GoOutOfScope(y)
} */
|
16 | fn main() {
let x = 5;
} | /* --- BEGIN Variable Definitions ---
Owner x
--- END Variable Definitions --- */
fn main() {
let x = 5; // !{ Bind(x) }
} // !{ GoOutOfScope(x) } |
17 | fn main() {
let mut x = String::from("Hello");
let y = &mut x;
world(y);
let z = &mut x; // OK, because y's lifetime has ended (last use was on previous line)
world(z);
x.push_str("!!"); // Also OK, because y and z's lifetimes have ended
println!("{}", x);
}
fn world(s : &mut String) {
... | /* --- BEGIN Variable Definitions ---
Owner mut x;
MutRef y;
MutRef z;
MutRef s;
Function String::from();
Function world();
Function push_str();
Function println!()
--- END Variable Definitions --- */
fn main() {
let mut x = String::from("Hello"); // !{ Move(String::from()->x) }
let y = &mut x; // !{ MutableBor... |
18 | struct Foo {
x: i32,
y: String,
}
fn main() {
let _y = String :: from("bar");
let f = Foo { x: 5, y: _y };
println!("{}", f.x);
println!("{}", f.y);
} | /* --- BEGIN Variable Definitions ---
Struct f{x,y};
Owner _y;
Function String::from();
Function println!();
--- END Variable Definitions --- */
struct Foo {
x: i32,
y: String,
}
fn main() {
let _y = String :: from("bar"); // !{ Move(String::from()->_y) }
let f = Foo { x: 5, y: _y }; // !{ Bind(f), Bin... |
19 | fn main() {
let x = String::from("hello");
let y = &x;
let z = &x;
f(y, z);
}
fn f(s1 : &String, s2 : &String) {
println!("{} and {}", s1, s2);
} | /* --- BEGIN Variable Definitions ---
Owner x;
StaticRef y;
StaticRef z;
StaticRef s1;
StaticRef s2;
Function String::from();
Function f();
Function println!()
--- END Variable Definitions --- */
fn main() {
let x = String::from("hello"); // !{ Move(String::from()->x) }
let y = &x; // !{ StaticBorrow(x->y) }
... |
20 | struct Rect {
w: u32,
h: u32,
}
fn main() {
let r = Rect {
w: 30,
h: 50,
};
println!(
"The area of the rectangle is {} square pixels.",
area(&r)
);
println!("The height of that is {}.", r.h);
}
fn area(rect: &Rect) -> u32 {
rect.w * rect.h
} | /* --- BEGIN Variable Definitions ---
Struct r{w, h}; StaticRef rect;
Function area(); Function println!();
--- END Variable Definitions --- */
struct Rect {
w: u32,
h: u32,
}
fn main() {
let r = Rect { // !{ Bind(r) }
w: 30, // !{ Bind(r.w) }
h: 50 // !{ Bind(r.h) }
};
println!(
... |
21 | fn main() {
let mut x = 5;
x = 6; //OK
} | /* --- BEGIN Variable Definitions ---
Owner mut x
--- END Variable Definitions --- */
fn main() {
let mut x = 5; // !{ Bind(x) }
x = 6; //OK !{ Bind(x) }
} // !{ GoOutOfScope(x) } |
22 | fn main() {
let x = String::from("hello");
let mut y = String::from("test");
y = x;
} | /* --- BEGIN Variable Definitions ---
Owner x;
Owner mut y;
Function String::from()
--- END Variable Definitions --- */
fn main() {
let x = String::from("hello"); // !{ Move(String::from()->x) }
let mut y = String::from("test"); // !{ Move(String::from()->y) }
y = x; // !{ Move(x->y) }
} // !{ GoOutOfScope(... |
23 | fn main() {
let s = String::from("hello");
println!("{}", s);
} | /* --- BEGIN Variable Definitions ---
Owner s;
Function String::from();
Function println!()
--- END Variable Definitions --- */
fn main() {
let s = String::from("hello"); // !{ Move(String::from()->s) }
println!("{}", s); // !{ PassByStaticReference(s->println!()) }
} // !{ GoOutOfScope(s) } |
24 | fn main() {
let string1 = String::from("abcd");
let string2 = String::from("xyz");
let result = longest(&string1, &string2);
println!("The longest string is {}", result);
}
fn longest<'a>(x: &'a String, y: &'a String) -> &'a String {
if x.len() > y.len() {
x
} else {
y
}
}
| /* --- BEGIN Variable Definitions ---
Owner string1;
Owner string2;
StaticRef x;
StaticRef y;
StaticRef result;
Function String::from();
Function longest();
Function println!()
--- END Variable Definitions --- */
fn main() {
let string1 = String::from("abcd"); // !{ Move(String::from()->string1) }
let string2 =... |
25 | fn main() {
let s = String::from("hello");
takes_ownership(s);
// println!("{}", s) // won't compile if added
}
fn takes_ownership(some_string: String) {
println!("{}", some_string);
} | /* --- BEGIN Variable Definitions ---
Owner s;
Owner some_string;
Function String::from();
Function takes_ownership();
Function println!()
--- END Variable Definitions --- */
fn main() {
let s = String::from("hello"); // !{ Move(String::from()->s) }
takes_ownership(s); // !{ Move(s->takes_ownership()) }
// ... |
Dataset Card for Dataset Name
This dataset card aims to be a base template for new datasets. It has been generated using this raw template.
Dataset Details
Dataset Description
- Curated by: [More Information Needed]
- Funded by [optional]: [More Information Needed]
- Shared by [optional]: [More Information Needed]
- Language(s) (NLP): [More Information Needed]
- License: [More Information Needed]
Dataset Sources [optional]
- Repository: [More Information Needed]
- Paper [optional]: [More Information Needed]
- Demo [optional]: [More Information Needed]
Uses
Direct Use
[More Information Needed]
Out-of-Scope Use
[More Information Needed]
Dataset Structure
[More Information Needed]
Dataset Creation
Curation Rationale
[More Information Needed]
Source Data
Data Collection and Processing
[More Information Needed]
Who are the source data producers?
[More Information Needed]
Annotations [optional]
Annotation process
[More Information Needed]
Who are the annotators?
[More Information Needed]
Personal and Sensitive Information
[More Information Needed]
Bias, Risks, and Limitations
[More Information Needed]
Recommendations
Users should be made aware of the risks, biases and limitations of the dataset. More information needed for further recommendations.
Citation [optional]
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
Glossary [optional]
[More Information Needed]
More Information [optional]
[More Information Needed]
Dataset Card Authors [optional]
[More Information Needed]
Dataset Card Contact
[More Information Needed]
- Downloads last month
- 9