Skip to content

Instantly share code, notes, and snippets.

View compiler-errors's full-sized avatar
🫠
busy with job changes, not able to review PRs quickly

Michael Goulet compiler-errors

🫠
busy with job changes, not able to review PRs quickly
View GitHub Profile
diff --git a/compiler/rustc_typeck/src/astconv/mod.rs b/compiler/rustc_typeck/src/astconv/mod.rs
index ab79dcd4161..20b178ca6ad 100644
--- a/compiler/rustc_typeck/src/astconv/mod.rs
+++ b/compiler/rustc_typeck/src/astconv/mod.rs
@@ -2364,13 +2364,12 @@ pub fn res_to_ty(
let substs = self.ast_path_substs_for_ty(span, did, item_segment.0);
self.normalize_ty(span, tcx.mk_opaque(did, substs))
}
- Res::Def(DefKind::TyAlias, did) => {
- let item_segment = path.segments.split_last().unwrap();
diff --git a/compiler/rustc_middle/src/ty/fast_reject.rs b/compiler/rustc_middle/src/ty/fast_reject.rs
index 334789d460c..847a8588566 100644
--- a/compiler/rustc_middle/src/ty/fast_reject.rs
+++ b/compiler/rustc_middle/src/ty/fast_reject.rs
@@ -128,7 +128,9 @@ pub fn simplify_type<'tcx>(
TreatParams::AsPlaceholder => Some(PlaceholderSimplifiedType),
TreatParams::AsInfer => None,
},
- ty::Projection(_) => match treat_params {
+ // FIXME(compiler-errors): Is this correct? Either `TyAlias` acts just like a
|lint| {
lint.build(msg)
.multipart_suggestion_verbose(
sugg_msg,
sugg,
Applicability::MachineApplicable,
);
+ if is_local {
+ lint.multipart_suggestion(...);
+ }
<pre><font color="#26A269">I</font><font color="#8D8F8A">1201 01:13:04.724801 1025672 </font><b>main</b> [<b>yak_shave</b>] <b>examples/yak-shave.rs</b>:<b>34</b>] preparing to shave yaks, <b>number_of_yaks</b>: 3
<font color="#26A269">I</font><font color="#8D8F8A">1201 01:13:04.724948 1025672 </font><b>main</b> [<b>yak_shave</b>] <b>examples/yak-shave.rs</b>:<b>75</b>] [<b>shaving_yaks</b>{<i><b>yaks</b></i>: 3}] shaving yaks
<font color="#A2734C">W</font><font color="#8D8F8A">1201 01:13:04.725071 1025672 </font><b>main</b> [<b>yak_shave</b>] <b>examples/yak-shave.rs</b>:<b>56</b>] [<b>shaving_yaks</b>{<i><b>yaks</b></i>: 3}, <b>shave</b>{<i><b>yak</b></i>: 3}] could not locate yak
<font color="#C01C28">E</font><font color="#8D8F8A">1201 01:13:04.725135 1025672 </font><b>main</b> [<b>yak_shave</b>] <b>examples/yak-shave.rs</b>:<b>85</b>] [<b>shaving_yaks</b>{<i><b>yaks</b></i>: 3}] failed to shave yak, <b>yak</b>: 3, <b>error</b>: out of cash
<font color="#26A269">I</font><font color="#8D8F8A">1201 01:13:04.
I1201 01:14:08.541705 1026528 main [yak_shave] examples/yak-shave.rs:34] preparing to shave yaks, number_of_yaks: 3
I1201 01:14:08.541855 1026528 main [yak_shave] examples/yak-shave.rs:75] [shaving_yaks{yaks: 3}] shaving yaks
W1201 01:14:08.541978 1026528 main [yak_shave] examples/yak-shave.rs:56] [shaving_yaks{yaks: 3}, shave{yak: 3}] could not locate yak
E1201 01:14:08.542043 1026528 main [yak_shave] examples/yak-shave.rs:85] [shaving_yaks{yaks: 3}] failed to shave yak, yak: 3, error: out of cash
I1201 01:14:08.542103 1026528 main [yak_shave] examples/yak-shave.rs:38] yak shaving completed, all_yaks_shaved: false
error[E0601]: `main` function not found in crate `test2`
--> /home/michael/test2.rs:1:1
|
1 | / fn foo() -> impl std::future::Future<Output = ()> {
2 | | async { 1usize }
3 | | }
| |_^ consider adding a `main` function to `/home/michael/test2.rs`
error[E0271]: type mismatch resolving `<impl Future<Output = <[static generator@/home/michael/test2.rs:2:11: 2:21] as Generator<ResumeTy>>::Return> as Future>::Output == ()`
--> /home/michael/test2.rs:1:13
class Program
{
static async Task Main(string[] args)
{
try
{
MyAsyncMethod();
}
catch(Exception ex)
{
type FencerID = usize;// Make this explicit: struct FencerId(usize); and use #[derive(Clone, Copy, Hash, PartialEq, Eq)]
#[derive(Debug, Hash, Eq, PartialEq)]
struct FencerData {
name: String,
// rating: some kind of enum?
}
impl FencerData {
fn new(name: &str) -> FencerData {// MG: Also it's fine to take a String here. Prevents extra clones if I do eg Fencer::new(format!("..."))
@compiler-errors
compiler-errors / gist:7695ffa040a4fe3b587f63957e67875f
Last active December 1, 2019 08:02
Lazy types: motivations and syntax

{ 1 } is type lazy number

Functions can require that their parameters be lazy with the ~:

fn times n ~do = if (n <= 0) { nothing } { eval do; times (n - 1) do } (the ; meaning chain evaluation of two expressions)

If a lazy value is passed to a function that doesn't want a lazy value, then the lazy value is automatically evaluated. This, as a consequence means that the definition of the eval function in the language can

struct Value {
int reference; // Just a uniquely identifying value for this struct. Counts up from 0.
size_t data_size;
};
struct IntValue {
int reference;
size_t data_size; // Should always be sizeof(int) = 4.
int value;