Skip to content

Commit

Permalink
Update to comply with legal review (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaoliello authored Apr 26, 2023
1 parent a99eacc commit 7529bc5
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 23 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

# no_global_oom_handling is currently broken in 1.69: https://github.com/rust-lang/rust/pull/110649
# So use 1.68 until it gets fixed.
- name: Update Rust toolchain
run: rustup update
run: rustup install 1.68

- name: Add the rust-src component
run: rustup component add rust-src --toolchain stable-${{ matrix.target }}
- name: Set 1.68 as the default
run: rustup default 1.68

- name: Add required components
run: rustup component add rust-src clippy rustfmt rust-docs --toolchain 1.68-${{ matrix.target }}

- name: Run build script
shell: pwsh
Expand Down
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Contributing

This project welcomes contributions and suggestions. Most contributions require you to
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
and actually do, grant us the rights to use your contribution. For details, visit
https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need
to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "fallible_vec"
description = "Fallible allocation functions for the Rust standard library's `Vec` type."
version = "0.3.0"
version = "0.3.1"
edition = "2021"
license-file = "LICENSE"
repository = "https://github.com/microsoft/rust_fallible_vec"
Expand Down
34 changes: 17 additions & 17 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
MIT License
Copyright (c) Microsoft Corporation.

Copyright (c) Microsoft Corporation.
MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ in its CI.

Comparing `fallible_vec` to [`fallible_collections`](https://crates.io/crates/fallible_collections):

| | `fallible_vec` v0.1.0 | `fallible_collections` v0.4.7 |
| | `fallible_vec` v0.3.1 | `fallible_collections` v0.4.7 |
|-------------------------------------------|:---------------------:|:-----------------------------:|
| Supports `no_std` | X | X |
| Supports `#[cfg(no_global_oom_handling)]` | X | |
Expand Down
17 changes: 17 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ function Invoke-WithEnvironment([System.Collections.IDictionary] $Environment, [
}
}

# Verify that all sources files have the copyright header.
[string[]] $copyrightHeader = @("// Copyright (c) Microsoft Corporation.", "// Licensed under the MIT license.")
[bool] $hadMissingCopyright = $false
foreach ($file in (Get-ChildItem -Path (Join-Path $PSScriptRoot 'src') -Filter '*.rs' -Recurse)) {
$contents = Get-Content -Path $file -TotalCount $copyrightHeader.Length
if ($null -ne (Compare-Object -ReferenceObject $copyrightHeader -DifferenceObject $contents)) {
$hadMissingCopyright = $true
$fileName = $file.FullName
Write-Error "'$fileName' is missing the copyright header." -ErrorAction Continue
}
}
if ($hadMissingCopyright) {
$mergedCopyrightHeader = $copyrightHeader | Join-String -Separator "`n"
Write-Error "One or more files was missing the copyright header. To fix this, add the copyright header to any non-compliant files:`n$mergedCopyrightHeader"
exit 1
}

Invoke-WithEnvironment `
-Environment @{
# Enable unstable features on stable toolchain.
Expand Down
3 changes: 3 additions & 0 deletions src/collect.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

use crate::FallibleVec;
use crate::TryReserveError;
use alloc::vec::Vec;
Expand Down
3 changes: 3 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

use core::alloc::Layout;

#[allow(dead_code)]
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

//! Fallible allocation functions for the Rust standard library's [`alloc::vec::Vec`]
//! type.
//!
Expand Down
3 changes: 3 additions & 0 deletions src/set_len_on_drop.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

// Forked from the Rust Standard Library: library/alloc/src/vec/set_len_on_drop.rs

use alloc::vec::Vec;
Expand Down
3 changes: 3 additions & 0 deletions src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

use crate::*;
use alloc::{alloc::Global, vec::Vec};
use core::sync::atomic::{AtomicI32, Ordering};
Expand Down

0 comments on commit 7529bc5

Please sign in to comment.