make Str + Result work

This commit is contained in:
Folkert 2022-02-26 17:52:24 +01:00
parent d1d7cfef44
commit c0d3543d5a
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
12 changed files with 401 additions and 142 deletions

View file

@ -620,7 +620,7 @@ impl<'a, T> Collection<'a, T> {
}
}
pub fn with_items(items: &'a [T]) -> Collection<'a, T> {
pub const fn with_items(items: &'a [T]) -> Collection<'a, T> {
Collection {
items,
final_comments: None,

View file

@ -6,6 +6,7 @@ use crate::parser::{specialize, word1, EPackageEntry, EPackageName, Parser};
use crate::state::State;
use crate::string_literal;
use bumpalo::collections::Vec;
use roc_module::symbol::Symbol;
use roc_region::all::Loc;
#[derive(Debug)]
@ -17,6 +18,10 @@ pub enum HeaderFor<'a> {
generates: UppercaseIdent<'a>,
generates_with: &'a [Loc<ExposedName<'a>>],
},
/// Only created during canonicalization, never actually parsed from source
Builtin {
generates_with: &'a [Symbol],
},
PkgConfig {
/// usually `pf`
config_shorthand: &'a str,
@ -60,11 +65,11 @@ impl<'a> From<ModuleName<'a>> for &'a str {
}
impl<'a> ModuleName<'a> {
pub fn new(name: &'a str) -> Self {
pub const fn new(name: &'a str) -> Self {
ModuleName(name)
}
pub fn as_str(&'a self) -> &'a str {
pub const fn as_str(&'a self) -> &'a str {
self.0
}
}