Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stdlib] Update stdlib corresponding to 2024-05-08 nightly/mojo #2593

Merged
merged 52 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
30ae6bb
[mojo-stdlib] Remove `Reference.unsafe_bitcast`. (#39389)
lattner May 6, 2024
20977d8
[stdlib] Publish Arc (#39385)
Dan13llljws May 6, 2024
a5cf7f3
Revert "[stdlib] Add move constructor to `Atomic` (#36718)" (#39147)
JoeLoser May 6, 2024
f101349
[mojo-stdlib] Remove `Reference.get_legacy_pointer`. (#39401)
lattner May 6, 2024
052dfd5
[stdlib] Unified getters of pointer to contiguous collection of memor…
Dan13llljws May 6, 2024
67fcb41
[stdlib] Migrating ffi.mojo use cases from Pointer -> UnsafePointer
rparolin May 6, 2024
a904bdb
[mojo-tooling] Add support for erroring out on invalid doc strings
River707 May 7, 2024
97e70f4
[mojo-stdlib] Replace VariadicPack.get_element with refitem
lattner May 7, 2024
1a62310
[mojo-stdlib][mojo-tooling] Add a new decorator to hide decls from do…
River707 May 7, 2024
901f109
[External] [stdlib] Add `bool` for `Boolable`. (#39454)
soraros May 7, 2024
db216cc
[External] [mojo-stdlib] Add `divmod(Int, Int)` to builtins (#39382)
gabrieldemarmiesse May 7, 2024
67b7043
[External] [stdlib] Remove `Bool` constructor from `SIMD` (#39459)
soraros May 7, 2024
ac12708
[External] [stdlib] add in-place bitwise for `Bool` (#39461)
helehex May 7, 2024
5932fac
[External] [stdlib] Use `reversed(range(...))` in more places (#39453)
soraros May 7, 2024
57f02b5
[External] [stdlib] Make the use of the unsafe constructor of List ex…
gabrieldemarmiesse May 7, 2024
4611668
[External] [stdlib] Add unit tests for the SIMD __rfloordiv__() metho…
peymanbr May 7, 2024
d4f409e
[External] [docs] Two helpful documentation additions (#39480)
KarateCowboy May 7, 2024
19ec29b
[Docs] Fix code example.
arthurevans May 7, 2024
8f70c3d
Delete obsolete front matter
scottamain May 7, 2024
87280f0
Unify the install procedure for Mojo and MAX packages
scottamain May 7, 2024
b793e93
[External] [tools] Fix all typos found in #2295 (#39503)
gabrieldemarmiesse May 7, 2024
e662497
[Docs] Edit contributed docs.
arthurevans May 7, 2024
2f5bf00
[Docs] Add Mojo docstring style guide for stdlib.
arthurevans May 7, 2024
6b6424a
[External] [stdlib] Make `repr()` work with `DType` (#39511)
gabrieldemarmiesse May 7, 2024
a26cf43
[mojo] Update changelog with `@deprecated` decorator
Mogball May 8, 2024
7dd99d3
[External] [stdlib] [bugfix] Make memcmp function robust against over…
mzaks May 8, 2024
39d23be
[External] [stdlib] Add `Dict.get(key) -> Optional[T]` and `Dict.get…
modularbot May 8, 2024
461965d
[mojo-stdlib] Move OptionalReg off -> Self inits
lattner May 8, 2024
cd09e5d
[External] [mojo-stdlib] Used explicit str in `_location.mojo` (#39536)
StandinKP May 8, 2024
8202d2f
[External] [mojo-stdlib] Used explicit str in `string.mojo` (#39538)
StandinKP May 8, 2024
afa556b
[External] [mojo-stdlib] Used explicit str in `os.mojo` (#39537)
StandinKP May 8, 2024
4ae47b3
[External] [mojo-stdlib] Used explicit str in `list.mojo` (#39539)
StandinKP May 8, 2024
344c417
[External] [mojo-stdlib] Used explicit str in `inlined_string.mojo` (…
StandinKP May 8, 2024
fbfc30c
[External] [mojo-stdlib] Used explicit str in `test_object.mojo` (#39…
StandinKP May 8, 2024
076441f
[External] [mojo-stdlib] Used explicit str in `test_string.mojo` (#39…
StandinKP May 8, 2024
e2c871a
[External] [mojo-stdlib] Used explicit str in `test_format.mojo` (#39…
StandinKP May 8, 2024
4f1ea4a
[External] [mojo-stdlib] Used explicit str in `testing.mojo` (#39541)
StandinKP May 8, 2024
a78f956
[External] [mojo-stdlib] Used explicit str in `test_simd.mojo` (#39544)
StandinKP May 8, 2024
36b693f
[External] [mojo-stdlib] Used explicit str in `test_remove.mojo` (#39…
StandinKP May 8, 2024
ffdc372
[External] [mojo-stdlib] Used explicit str in `test_dict.mojo` (#39546)
StandinKP May 8, 2024
27dad38
[External] [mojo-stdlib] Used explicit str in `test_python_interop.mo…
StandinKP May 8, 2024
472ee24
[External] [stdlib] Use UInt8 as the storage type for `StringRef` (#3…
gabrieldemarmiesse May 8, 2024
ff1e79d
[External] [mojo-stdlib] Used explicit str in `test_error.mojo` (#39550)
StandinKP May 8, 2024
9beeedb
[External] [mojo-stdlib] Used explicit str in `test_file.mojo` (#39542)
StandinKP May 8, 2024
8af5898
[External] [stdlib] Enhance Handling of Infinity and NaN in `assert_a…
modularbot May 8, 2024
3db85f7
[stdlib] Rename `Variant.take()` to `unsafe_take()`
Dan13llljws May 8, 2024
7e3da1e
[stdlib] Fix using wrong variable in `test_float_literal`
JoeLoser May 8, 2024
326f299
Functions like `initialize_pointee_move` need to invoke methods
lattner May 8, 2024
129f0bd
[External] [stdlib] remove uses of StaticTuple where possible (#39559)
modularbot May 8, 2024
dfffbc0
[External] [stdlib] add `SIMD._Mask` alias (#39460)
helehex May 8, 2024
7ad882a
[stdlib] Added changelog for
Dan13llljws May 8, 2024
c728488
[stdlib] Bump compiler version to 2024.5.822
modularbot May 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 5 additions & 10 deletions docs/changelog-released.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ title: Mojo🔥 changelog
sidebar_label: Changelog
description: A history of significant Mojo changes.
toc_max_heading_level: 2
website:
open-graph:
image: /static/images/mojo-social-card.png
twitter-card:
image: /static/images/mojo-social-card.png
---

This is a running list of significant changes for the Mojo language and tools.
Expand Down Expand Up @@ -68,7 +63,7 @@ modular update mojo

- Improvements to variadic arguments support.

- Heterogenous variadic pack arguments now work reliably even with memory types,
- Heterogeneous variadic pack arguments now work reliably even with memory types,
and have a more convenient API to use, as defined by the
[`VariadicPack`](/mojo/stdlib/builtin/builtin_list/VariadicPack) type. For
example, a simplified version of `print` can be implemented like this:
Expand Down Expand Up @@ -1612,7 +1607,7 @@ experience without dedicated sugar.
`num_physical_cores()`, `num_logical_cores()`, and `num_performance_cores()`
functions.

- Homogenous variadic arguments consisting of memory-only types, such as
- Homogeneous variadic arguments consisting of memory-only types, such as
`String` are more powerful and easier to use. These arguments are projected
into a
[`VariadicListMem`](/mojo/stdlib/builtin/builtin_list/VariadicListMem).
Expand Down Expand Up @@ -1656,7 +1651,7 @@ experience without dedicated sugar.
i[] += " world"
```

Heterogenous variadic arguments have not yet been moved to the new model, but
Heterogeneous variadic arguments have not yet been moved to the new model, but
will in future updates.

Note that for variadic arguments of register-passable types like `Int`, the
Expand Down Expand Up @@ -2077,7 +2072,7 @@ experience without dedicated sugar.
```

Traits can also inherit from other traits, which simply requires that
implementors of the child trait also conform to all parent traits.
implementers of the child trait also conform to all parent traits.

```mojo
trait Parent:
Expand Down Expand Up @@ -3985,7 +3980,7 @@ busy this week.

- 📚 Memcpy and memcmp now consistently use count as the byte count.

- 📚 Add a variadic sting join on strings.
- 📚 Add a variadic string join on strings.

- 📚 Introduce a `reduce_bit_count` method to count the number of 1 across all
elements in a SIMD vector.
Expand Down
47 changes: 45 additions & 2 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,28 @@ what we publish.

### ⭐️ New

- Mojo now supports adding a `@deprecated` decorator on structs, functions,
traits, aliases, and global variables. The decorator marks the attached decl
as deprecated and causes a warning to be emitted when the deprecated decl is
referenced in user code. The decorator requires a deprecation message to be
specified as a string literal.

```mojo
@deprecated("Foo is deprecated, use Bar instead")
struct Foo:
pass

fn outdated_api(x: Foo): # warning: Foo is deprecated, use Bar instead
pass

@deprecated("use another function!")
fn bar():
pass

fn techdebt():
bar() # warning: use another function!
```

- `int()` can now take a string and a specified base to parse an integer from a
string: `int("ff", 16)` returns `255`. Additionally, if a base of zero is
specified, the string will be parsed as if it was an integer literal, with the
Expand Down Expand Up @@ -45,8 +67,9 @@ what we publish.
return Self(round(self.re), round(self.im))
```

- The `abs, round, min, and max` functions have moved from `math` to `builtin`,
so you no longer need to do `from math import abs, round, min, max`.
- The `abs, round, min, max, and divmod` functions have moved from `math` to
`builtin`, so you no longer need to do
`from math import abs, round, min, max, divmod`.

- Mojo now allows types to opt in to use the `floor()` and `ceil()` functions in
the `math` module by implementing the `__floor__()` and `__ceil__()` methods
Expand Down Expand Up @@ -100,11 +123,31 @@ what we publish.
- `object` now implements all the bitwise operators.
([PR #2324](https://github.com/modularml/mojo/pull/2324) by [@LJ-9801](https://github.com/LJ-9801))

- A new `--validate-doc-strings` option has been added to `mojo` to emit errors
on invalid doc strings instead of warnings.

- A new decorator, `@doc_private`, was added that can be used to hide a decl
from being generated in the output of `mojo doc`. It also removes the
requirement that the decl has documentation (e.g. when used with
--diagnose-missing-doc-strings).

- `Dict` now implements `get(key)` and `get(key, default)` functions.
([PR #2519](https://github.com/modularml/mojo/pull/2519) by [@martinvuyk](https://github.com/martinvuyk))

### 🦋 Changed

- The `abs` and `round` functions have moved from `math` to `builtin`, so you no
longer need to do `from math import abs, round`.

- Many functions returning a pointer type have been unified to have a public
API function of `unsafe_ptr()`.

- The `--warn-missing-doc-strings` flag for `mojo` has been renamed to
`--diagnose-missing-doc-strings`.

- The `take` function in `Variant` and `Optional` has been renamed to
`unsafe_take`.

### ❌ Removed

- The method `object.print()` has been removed. Since now, `object` has the
Expand Down
5 changes: 0 additions & 5 deletions docs/community.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ title: Mojo🔥 community
sidebar_label: Community
description: Resources to share feedback, report issues, and chat.
hide_table_of_contents: true
website:
open-graph:
image: /static/images/mojo-social-card.png
twitter-card:
image: /static/images/mojo-social-card.png
---


Expand Down
5 changes: 0 additions & 5 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
title: Mojo🔥 FAQ
sidebar_label: FAQ
description: Answers to questions we expect about Mojo.
website:
open-graph:
image: /static/images/mojo-social-card.png
twitter-card:
image: /static/images/mojo-social-card.png
---

We tried to anticipate your questions about Mojo on this page. If this page
Expand Down
15 changes: 5 additions & 10 deletions docs/manual/basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,16 @@
"cells": [
{
"cell_type": "raw",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "raw"
}
},
"source": [
"---\n",
"title: Introduction to Mojo\n",
"order: 1\n",
"sidebar_position: 1\n",
"description: Introduction to Mojo's basic language features.\n",
"aliases:\n",
" - /mojo/notebooks/HelloMojo.html\n",
"css: /static/styles/page-navigation.css\n",
"website:\n",
" open-graph:\n",
" image: /static/images/mojo-social-card.png\n",
" twitter-card:\n",
" image: /static/images/mojo-social-card.png\n",
"---"
]
},
Expand Down
12 changes: 5 additions & 7 deletions docs/manual/decorators/always-inline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@
"cells": [
{
"cell_type": "raw",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "raw"
}
},
"source": [
"---\n",
"title: '`@always_inline`'\n",
"description: Copies the body of a function directly into the body of the calling function.\n",
"css: /static/styles/page-navigation.css\n",
"website:\n",
" open-graph:\n",
" image: /static/images/mojo-social-card.png\n",
" twitter-card:\n",
" image: /static/images/mojo-social-card.png\n",
"---"
]
},
Expand Down
13 changes: 7 additions & 6 deletions docs/manual/decorators/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ sidebar_label: Decorators
sidebar_position: 1
description: A reference of Mojo's built-in decorators
hide_table_of_contents: true
css: /static/styles/page-navigation.css
website:
open-graph:
image: /static/images/mojo-social-card.png
twitter-card:
image: /static/images/mojo-social-card.png
listing:
- id: docs
contents:
Expand All @@ -31,6 +25,13 @@ actually calling the higher-order function, you simply add the decorator (such
as the `@value` decorator) above your code (such as a struct). The Mojo
compiler then uses the decorator function to modify your code at compile time.

:::note No custom decorators

The creation of custom decorators is not yet supported. The available ones are
built directly into the compiler.

:::

The following pages describe each built-in decorator with examples.

:::{#docs}
Expand Down
12 changes: 5 additions & 7 deletions docs/manual/decorators/nonmaterializable.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@
"cells": [
{
"cell_type": "raw",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "raw"
}
},
"source": [
"---\n",
"title: '`@nonmaterializable`'\n",
"description: Declares that a type should exist only in the parameter domain.\n",
"css: /static/styles/page-navigation.css\n",
"website:\n",
" open-graph:\n",
" image: /static/images/mojo-social-card.png\n",
" twitter-card:\n",
" image: /static/images/mojo-social-card.png\n",
"---"
]
},
Expand Down
12 changes: 5 additions & 7 deletions docs/manual/decorators/parameter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@
"cells": [
{
"cell_type": "raw",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "raw"
}
},
"source": [
"---\n",
"title: '`@parameter`'\n",
"description: Executes a function or if statement at compile time.\n",
"css: /static/styles/page-navigation.css\n",
"website:\n",
" open-graph:\n",
" image: /static/images/mojo-social-card.png\n",
" twitter-card:\n",
" image: /static/images/mojo-social-card.png\n",
"---"
]
},
Expand Down
12 changes: 5 additions & 7 deletions docs/manual/decorators/register-passable.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@
"cells": [
{
"cell_type": "raw",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "raw"
}
},
"source": [
"---\n",
"title: '`@register_passable`'\n",
"description: Declares that a type should be passed in machine registers.\n",
"css: /static/styles/page-navigation.css\n",
"website:\n",
" open-graph:\n",
" image: /static/images/mojo-social-card.png\n",
" twitter-card:\n",
" image: /static/images/mojo-social-card.png\n",
"---"
]
},
Expand Down
12 changes: 5 additions & 7 deletions docs/manual/decorators/staticmethod.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@
"cells": [
{
"cell_type": "raw",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "raw"
}
},
"source": [
"---\n",
"title: '`@staticmethod`'\n",
"description: Declares a struct method as static.\n",
"css: /static/styles/page-navigation.css\n",
"website:\n",
" open-graph:\n",
" image: /static/images/mojo-social-card.png\n",
" twitter-card:\n",
" image: /static/images/mojo-social-card.png\n",
"---"
]
},
Expand Down
12 changes: 5 additions & 7 deletions docs/manual/decorators/unroll.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@
"cells": [
{
"cell_type": "raw",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "raw"
}
},
"source": [
"---\n",
"title: '`@unroll`'\n",
"description: Unrolls a loop at compile time.\n",
"css: /static/styles/page-navigation.css\n",
"website:\n",
" open-graph:\n",
" image: /static/images/mojo-social-card.png\n",
" twitter-card:\n",
" image: /static/images/mojo-social-card.png\n",
"---"
]
},
Expand Down
12 changes: 5 additions & 7 deletions docs/manual/decorators/value.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@
"cells": [
{
"cell_type": "raw",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "raw"
}
},
"source": [
"---\n",
"title: '`@value`'\n",
"description: Generates boilerplate lifecycle methods for a struct.\n",
"css: /static/styles/page-navigation.css\n",
"website:\n",
" open-graph:\n",
" image: /static/images/mojo-social-card.png\n",
" twitter-card:\n",
" image: /static/images/mojo-social-card.png\n",
"---"
]
},
Expand Down
13 changes: 5 additions & 8 deletions docs/manual/functions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@
"cells": [
{
"cell_type": "raw",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "raw"
}
},
"source": [
"---\n",
"title: Functions\n",
"order: 2\n",
"sidebar_position: 2\n",
"description: Introduction to Mojo `fn` and `def` functions.\n",
"css: /static/styles/page-navigation.css\n",
"website:\n",
" open-graph:\n",
" image: /static/images/mojo-social-card.png\n",
" twitter-card:\n",
" image: /static/images/mojo-social-card.png\n",
"---"
]
},
Expand Down